xoopsのmainfile.phpメモ。
僕の使っているmainfile.phpです。

<?php

//要約。
//GNUGPLライセンスver2かそれ以降のものを尊守している範囲で再配布可能である。                                                                           //
//コメントや開発者のコメントやクレジットを変えてはいけない。
//このプログラムは人の役に立てばと願って配布されていますが、
//完全に無保証です。
//市場で普及することの保証も、あるいは特定の目的に合致するといった保証も出来ません。
//詳細は GNUGPLを読んでね。
//このプログラムにはGNUGPLのコピーが同梱されていたはずですが、もし無ければメールしてきてください。
// $Id: mainfile.dist.php,v 1.1 2004/09/09 05:14:50 onokazu Exp $
//  ------------------------------------------------------------------------ //
//                XOOPS - PHP Content Management System                      //
//                    Copyright (c) 2000 XOOPS.org                           //
//                       <http://www.xoops.org/>                             //
//  ------------------------------------------------------------------------ //
//  This program is free software; you can redistribute it and/or modify     //
//  it under the terms of the GNU General Public License as published by     //
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //


//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //





if ( !defined("XOOPS_MAINFILE_INCLUDED") ) {

	define("XOOPS_MAINFILE_INCLUDED",1);

	// XOOPS Physical Path
	// Physical path to your main XOOPS directory WITHOUT trailing slash
	define('XOOPS_ROOT_PATH', '/usr/local/apache/htdocs/x2/html');

	// XOOPS Virtual Path (URL)
	// Virtual path to your main XOOPS directory WITHOUT trailing slash
	define('XOOPS_URL', 'http://192.168.1.1/x2/html');

	define('XOOPS_CHECK_PATH', 0);
	// Protect against external scripts execution if safe mode is not enabled
	//もし、セーフモードが無効なら、外部スクリプトの実行を防ぐ。
	
	//ini_get -- 設定オプションの値を得る
	//関数の手前に@をつけるとエラーが返らなくなる。
	if ( XOOPS_CHECK_PATH && !@ini_get('safe_mode') ) {
	//function_exists --  指定した関数が定義されている場合にTRUEを返す
		if ( function_exists('debug_backtrace') ) {
			
			//debug_backtrace --  バックトレースを生成する
			$xoopsScriptPath = debug_backtrace();
			
			//count -- 変数に含まれる要素の数を数える
			//count()は、セットされていない変数に関して0を返します
			if ( !count($xoopsScriptPath) ) {
			 	die("XOOPS path check: this file cannot be requested directly");
			}
			$xoopsScriptPath = $xoopsScriptPath[0]['file'];
		} else {
			//関数、debug_backtraceが無ければ、
			$xoopsScriptPath = isset($_SERVER['PATH_TRANSLATED']) ? $_SERVER['PATH_TRANSLATED'] :  $_SERVER['SCRIPT_FILENAME'];
		}
		if ( DIRECTORY_SEPARATOR != '/' ) {
			// IIS6 may double the \ chars
			//str_replace --  文字列 subject 中の文字列 search を全て文字列replaceに置換する
			//mixed str_replace ( mixed search, mixed replace, mixed subject [, int &count])		
			//$xoopsScriptPathの中の文字列
			
			//strpos --  文字列が最初に現れる場所を見つける
			//int strpos ( string haystack, string needle [, int offset])
			// 文字列 haystack の中で、 needleが最初に現れた位置を数字で返します。 
			$xoopsScriptPath = str_replace( strpos( $xoopsScriptPath, '\\\\', 2 ) ? '\\\\' : DIRECTORY_SEPARATOR, '/', $xoopsScriptPath);
		}
//$xoopsScriptPathがXOOPS_ROOT_PATHになければ正
		if ( strcasecmp( substr($xoopsScriptPath, 0, strlen(XOOPS_ROOT_PATH)), str_replace( DIRECTORY_SEPARATOR, '/', XOOPS_ROOT_PATH)) ) {
//strcasecmp --  大文字小文字を区別しないバイナリにも使用可能な文字列比較を行う
//int strcasecmp ( string str1, string str2)
//str1 が str2 より 小さい場合は負、str1 が str2 より大きい場合は正、等しい場合は 0 を返します。

//substr -- 文字列の一部分を返す
//string substr ( string string, int start, int [length])
//substr() は文字列 string の、start で指定された 位置から length バイト分の文字列を 返します。
//start が正の場合、返される文字列は、 string の 0 から数えて start番目から始まる文字列となります。 
//例えば、文字列'abcdef'において位置 0にある文字は、'a'であり、 位置2には'c'があります。

//strlen -- 文字列の長さを得る
//int strlen ( string str)
//stringの長さを返します。 


			exit("XOOPS path check: Script is not inside XOOPS_ROOT_PATH and cannot run.");
		}
	}
	// Database
	// Choose the database to be used
	define('XOOPS_DB_TYPE', 'mysql');

	// Table Prefix
	// This prefix will be added to all new tables created to avoid name conflict in the database. If you are unsure, just use the default 'xoops'.
	define('XOOPS_DB_PREFIX', 'xoops');

	// Database Hostname
	// Hostname of the database server. If you are unsure, 'localhost' works in most cases.
	define('XOOPS_DB_HOST', '127.0.0.1');

	// Database Username
	// Your database user account on the host
	define('XOOPS_DB_USER', 'root');

	// Database Password
	// Password for your database user account
	define('XOOPS_DB_PASS', '');

	// Database Name
	// The name of database on the host. The installer will attempt to create the database if not exist
	define('XOOPS_DB_NAME', 'x3');

	// Use persistent connection? (Yes=1 No=0)
	// Default is 'Yes'. Choose 'Yes' if you are unsure.
	define('XOOPS_DB_PCONNECT', 0);

	define('XOOPS_GROUP_ADMIN', '1');
	define('XOOPS_GROUP_USERS', '2');
	define('XOOPS_GROUP_ANONYMOUS', '3');

	if (!isset($xoopsOption['nocommon'])) {
		//isset -- 変数がセットされているかどうかを検査する
		include XOOPS_ROOT_PATH."/include/common.php";
	}
}
?>