- 最后登录
- 2013-8-5
- 在线时间
- 0 小时
- 威望
- 15
- 金币
- 15
- 注册时间
- 2010-11-6
- 阅读权限
- 0
- 主题
- 1
- 精华
- 0
- 积分
- 15
- 帖子
- 2

该用户从未签到
|
为了方便大家进行修改自己的站.,.也方便我自己学习PHP..所以进行源代码参详,...先放出index.php
-
- <?php
- /*******************************************************************
- *[JishiGou] (C)2005 - 2010 Cenwor Inc.
- *
- * This is NOT a freeware, use is subject to license terms
- *
- * @Filename master.mod.php $
- *
- * @Author http://www.jishigou.net $
- *
- * @Date 2010-09-02 10:14:03 $
- *******************************************************************/
- error_reporting(E_ALL ^ E_NOTICE);//显示错误
- @ini_set("arg_seperator.output", "&");//当启用自动在URL中添加PHPSESSID变量时所使用的分隔符,用于分隔PHPSESSID和原有的变量。
- @set_magic_quotes_runtime(0);//开启当遇到反斜杆、单引号,将会自动加上一个反斜杆
- @header('Content-Type: text/html; charset=gbk');//送出 HTTP 协议的标头到浏览器
- $time_start = microtime_float();
- define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());//定义一个常量。
- define('DEBUG',false);
- define('ROOT_PATH',dirname(__FILE__) . '/');//返回当前文件路径的 路径部分
- define('RELATIVE_ROOT_PATH','./');//总路径
-
- class initialize//定义类
- {
-
- function init()//建立函数
- {
- $config=array();//建立数组
- require(ROOT_PATH . 'setting/settings.php');//导入文件
-
- if($config['install_lock_time'] < 1)
- {
- if (!is_file(ROOT_PATH . 'install/install.lock') && is_file(ROOT_PATH . 'install.php'))
- {
- die("<a href='./install.php'>请点此进行系统的安装</a>");//判断是否安装了,如果没安装,就结束下边PHP
- }
- }
-
- if ($config['upgrade_lock_time'] > 0)
- {
- if(($config['upgrade_lock_time'] + 180 > time()) || (is_file(ROOT_PATH . 'cache/upgrade.lock') && filemtime(ROOT_PATH . 'cache/upgrade.lock')+600>time())) {
- die('系统升级中,请稍候……');//filemtime获取文件修改时间
- }
- }
-
- if ($config['site_closed'])
- {
- if ('login'!=$_GET['mod'] && @$site_enable_msg=file_get_contents('./cache/site_enable.php')) //file_get_contents读入文件内容为字符串
- {
- die($site_enable_msg);//判断是否网站关闭,是就终止运行下边的PHP
- }
- }
-
- require(ROOT_PATH . 'setting/constants.php');//UC连接功能
-
- if ($config['rewrite_enable']) //如果REWRITE开启
- {
- include(ROOT_PATH . 'include/rewrite.php');//导入文件
- }
-
- if($config['robot_enable']) //机器人设置
- {
- include(ROOT_PATH . 'setting/robot.php');
- }
-
- if($config['ad_enable']) //广告设置
- {
- include(ROOT_PATH . 'setting/ad.php');
- }
-
- require_once(ROOT_PATH . 'include/function/global.func.php');//导入全局函数
- require_once(ROOT_PATH . 'modules/master.mod.php');//基本设置,如标题,IP禁止
- require_once(ROOT_PATH . 'modules/' . $this->SetEvent($config['default_module']) . '.mod.php');//调用类SETEVENT的CONFIG函数来对URL提交的MOD数据进行跳转到各页面
- if($_GET)
- {
- $_GET = daddslashes($_GET, 1, TRUE);//对GET传的数据进行反斜杠处理
- }
- if($_POST)
- {
- $_POST = daddslashes($_POST, 1, TRUE);//对POST的数据进行处理
- }
- $moduleobject = new ModuleObject($config);
- if(DEBUG===true) $moduleobject->DatabaseHandler->Debug();//判断是否开启错误提示
- }
-
- function SetEvent($default='topic')
- {
- $modss = array('topic'=>1,'pm'=>1,'login'=>1,'member'=>1,'profile'=>1,'tag'=>1,'get_password'=>1,'report'=>1,'url'=>1,'share'=>1,'other'=>1,);//给数组加内容
-
- $mod = (isset($_POST['mod']) ? $_POST['mod'] : $_GET['mod']);//如果POST变量存在,或者POST提交的表单的MOD有内容,那么就采用POST处理,不然就用GET处理
-
- if(!isset($modss[$mod])) //如果变量的值不存在MODSS数组里,就执行下边
- {
- if($mod)
- {
- $_POST['mod_original'] = $_GET['mod_original'] = $mod;
- }
-
- $mod = ($default ? $default : 'index');//如果DEFAULT存在,就采用默认的,不然设置为INDEX
- }
-
- $_POST['mod'] = $_GET['mod'] = $mod;
-
- Return $mod;
- }
- }
- ob_start("my_output");//开启缓存输出
- $init=new initialize;
- $init->init();//运行类INITIALIZE里的INIT()函数
- unset($init);//释放变量
- ob_end_flush();//结束OB—START
- //检查GZIP的输出
- function my_output(&$buffer,$mode=5)
- {
- $modss = array('share'=>1);
- if(GZIP===true && function_exists('ob_gzhandler') && substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && !isset($modss[$_GET['mod']])) {
- $buffer=ob_gzhandler($buffer,$mode);
- }
- return $buffer;
- }
- //PHP的运行时间
- function microtime_float()
- {
- list($usec, $sec) = explode(" ", microtime());
- return ((float)$usec + (float)$sec);
- }
- ?>
复制代码 |
|