<?php
/**
* 核心类库
* @copyright reginx.com
* $Id: core.class.php 160 2013-03-05 17:28:26Z reginx $
*/
class core{
/**
* 应用信息
*
* @var unknown_type
*/
private $_app = array();
/**
* 配置
*
* @var unknown_type
*/
private $_conf = array();
/**
* 构造函数
*/
public function __construct($appfile, $conf){
/**
* 关闭自动转义
*/
PHP_VERSION < '5.3.0' && set_magic_quotes_runtime(0);
/**
* 安全过滤
*/
if(isset($_GET['GLOBALS']) || isset($_POST['GLOBALS']) || isset($_COOKIE['GLOBALS']) || isset($_FILES['GLOBALS'])){
self::error(self::L(('request-tainting')), 'Sys::initInput', 1);
}
/**
* 过滤非法全局变量
*/
if(isset($_GET['GLOBALS']) || isset($_POST['GLOBALS']) || isset($_COOKIE['GLOBALS']) || isset($_FILES['GLOBALS'])){
self::error(core::L('request-tainting'), 'Sys::initInput', 1);
}
$sglobal = array('GLOBALS','_GET','_POST','_REQUEST','_COOKIE','_SERVER','_ENV','_FILES','_MISC');
$tmpkeys = array_keys($GLOBALS);
foreach($tmpkeys as $key){
if(!in_array($key, $sglobal)){
$GLOBALS[$key] = NULL;
unset($GLOBALS[$key]);
}
}
$tmpkeys = null;
unset($tmpkeys);
/**
* 还原数据 , 如果被转义了.
*/
if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()){
$_GET = self::dstripslashes($_GET);
$_POST = self::dstripslashes($_POST);
$_COOKIE = self::dstripslashes($_COOKIE);
}
/**
* 默认配置
*/
$this->_conf = $conf;
/**
* 加载app配置信息
*/
if(file_exists(APP_PATH . 'config/config.php')){
$this->_conf = array_merge($this->_conf, include (APP_PATH . 'config/config.php'));
}
// 加载动态配置信息
if(!empty($this->_conf['config_file']) && is_file(BASE_PATH . 'data/' . $this->_conf['config_file'])){
$conf = include (BASE_PATH . 'data/' . $this->_conf['config_file']);
if(!empty($conf) && is_array($conf)){
$this->_conf = array_merge($this->_conf, $conf);
}
$conf = null; unset($conf);
}
/**
* 生成当前配置
*/
$this->_app = $this->_getapp($appfile);
$GLOBALS['_APP'] = &$this->_app;
/**
* 设置时区
*/
$this->timezone_set($this->_conf['time_offset']);
/**
* 加载语言变量
*/
$GLOBALS['_LANG'] = lang::load($this->_conf['lang']);
/**
* 模板操作对象
*/
$GLOBALS['_TPL'] = tpl::getTpl($GLOBALS['_APP']);
/**
* 缓存对象
*/
$GLOBALS['_CACHE'] = cache_extra::getCacheObj($GLOBALS['_APP']);
/**
* block
*/
if(is_file(DATA_PATH . 'install.lock') && isset($this->_app['block']) && $this->_app['block']){
$GLOBALS['_BLOCK'] = block::getobj();
}
/**
* 解析url
*/
$this->_parseurl();
if(isset($this->_conf['hooks']['startup'])){
call_user_func($this->_conf['hooks']['startup']);
}
}
/**
* 设置时区
*
* @param unknown_type $timeoffset
*/
public function timezone_set($timeoffset = 0){
if(function_exists('date_default_timezone_set')){
date_default_timezone_set('Etc/GMT' . ($timeoffset > 0 ? '-' : '+') . (abs($timeoffset)));
}
define('REQUEST_TIME', time());
}
/**
* 检测是否为爬虫
* @from x25
*
* @param mixed $ua
* @return boolean
*/
public function isrobot($ua = ''){
if(IS_CLI){
return false;
}
static $spiders = array('bot', 'crawl', 'spider','slurp','sohu-search','lycos','robozilla');
static $browsers = array('msie', 'netscape', 'opera', 'konqueror', 'mozilla');
$ua = strtolower(empty($ua) ? $_SERVER['HTTP_USER_AGENT'] : $ua);
if(strpos($ua, 'http://') === FALSE && self::dstrpos($ua, $browsers)){
return FALSE;
}
if(self::dstrpos($ua, $spiders)){
return TRUE;
}
return FALSE;
}
/**
* strpos 加强版 .
*
* ..
*
* @param string $string
* @param array $arr
* @param mixed $ret
* @return mixed
*/
public static function dstrpos($string, $arr, $ret = FALSE){
if(empty($string)){
return FALSE;
}
foreach((array)$arr as $v){
if(strpos($string, $v) !== FALSE){
return $ret ? $v : TRUE;
}
}
return FALSE;
}
/**
* 获取应用信息
*
* @param mixed $appfile
* @return array
*/
private function _getapp($appfile){
// 入口文件
$appfile = defined('APP_FILE') ? APP_FILE : $appfile;
$ret = array(
'app_path' => APP_PATH,
'app_name' => basename(dirname($appfile)),
'app_file' => basename($appfile),
'app_dir' => $this->_getappdir(),
'app_tpl_path' => APP_PATH . 'template/',
'base_path' => BASE_PATH,
'data_path' => BASE_PATH . 'data/',
'inc_path' => BASE_PATH . 'include/',
'temp_path' => BASE_PATH . 'data/temp/',
'cache_path' => BASE_PATH . 'data/cache/',
'reginx_path' => REGINX_PATH,
'extra_path' => REGINX_PATH . 'extra/',
'plugin_path' => BASE_PATH . 'data/plugin/',
);
$ret['base_url'] = $this->_getbaseurl($ret['app_name'], $ret['app_dir'] , isset($this->_conf['app_host']) && $this->_conf['default'] ? $this->_conf['app_host'] : null);
if(!isset($this->_conf['data_url'])){
$ret['data_url'] = !empty($this->_conf['data_url']) ? $this->_conf['data_url'] : ($ret['base_url'] . 'data/');
}else{
$ret['data_url'] = $this->_conf['data_url'];
}
if(!isset($this->_conf['upload_url'])){
$ret['upload_url'] = $ret['data_url'] . 'attachment/';
}else{
$ret['upload_url'] = $this->_conf['upload_url'];
}
$ret['upload_path'] = $ret['data_path'] . 'attachment/';
$ret['plugin_url'] = $ret['data_url'] . 'plugin/';
$ret['app_url'] = $ret['base_url'] . ($ret['app_dir'] == '/' ? '' : $ret['app_dir']);
$ret['is_robot'] = $this->isrobot();
$ret['html_path'] = $this->_gethtmlpath();
$ret['html_url'] = $this->_gethtmlurl($ret['base_url']);
$ret['db_queries'] = 0;
foreach($ret as $k => $v){
!defined(strtoupper($k)) && define(strtoupper($k), $v);
}
$ret['ctpl_url'] = $ret['curtpl_url'] = $ret['app_url'] . 'template/' . $this->_conf['tpl'] . '/';
// 合并配置信息
$ret = array_merge($this->_conf, $ret);
return $ret;
}
/**
* 获取html静态目录路径
*
* @return string
*/
private function _gethtmlpath(){
if(isset($this->_conf['html_dir'])){
return realpath(BASE_PATH . $this->_conf['html_dir']) . '/';
}
return BASE_PATH . 'html/';
}
/**
* 获取html文件目录url
*
* @pa
没有合适的资源?快使用搜索试试~ 我知道了~
基于PHP的蘑菇视频内容管理系统.zip
共772个文件
gif:267个
html:169个
php:149个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 27 浏览量
2023-08-26
22:01:31
上传
评论
收藏 2.25MB ZIP 举报
温馨提示
基于PHP的蘑菇视频内容管理系统.zip
资源推荐
资源详情
资源评论
收起资源包目录
基于PHP的蘑菇视频内容管理系统.zip (772个子文件)
style.css 16KB
style.css 16KB
ui.css 10KB
ui.css 10KB
ui.css 10KB
ui.css 10KB
ui.css 10KB
idialog.css 9KB
mac.css 9KB
jtop.css 8KB
discuz.css 8KB
blue.css 8KB
default.css 8KB
iblack.css 8KB
igreen.css 7KB
iblue.css 7KB
main.css 7KB
chrome.css 7KB
main.m.css 6KB
mini.css 3KB
iframe.css 2KB
iframe.css 2KB
iframe.css 2KB
iframe.css 2KB
iframe.css 2KB
style.css 2KB
style.css 2KB
multiupload.css 1KB
ad.css 114B
.htaccess.fcgi 438B
crazy.gif 8KB
angry.gif 8KB
doubt.gif 7KB
discuz_bg.gif 7KB
loading.gif 7KB
wronged.gif 6KB
icons.gif 5KB
curse.gif 5KB
icons.gif 5KB
icons.gif 5KB
icons.gif 5KB
icons.gif 5KB
sleep.gif 5KB
quiet.gif 4KB
panic.gif 4KB
ohmy.gif 4KB
shutup.gif 4KB
awkward.gif 4KB
shy.gif 3KB
9.gif 3KB
wail.gif 3KB
fastcry.gif 3KB
wordimg.gif 3KB
wordimg.gif 3KB
wordimg.gif 3KB
wordimg.gif 3KB
wordimg.gif 3KB
null_thumb.gif 3KB
null.gif 3KB
null.gif 3KB
blue_titbtn.gif 3KB
cute.gif 2KB
tongue.gif 2KB
chrome_s.gif 2KB
error.gif 2KB
success.gif 2KB
proud.gif 2KB
confirm.gif 2KB
5.gif 2KB
cry.gif 2KB
loading.gif 2KB
smile.gif 2KB
titter.gif 2KB
envy.gif 2KB
bye.gif 2KB
struggle.gif 2KB
despise.gif 2KB
laugh.gif 2KB
22.gif 2KB
knock.gif 2KB
null.gif 2KB
sad.gif 2KB
loading.gif 1KB
loading.gif 1KB
loading.gif 1KB
loading.gif 1KB
loading.gif 1KB
alert.gif 1KB
24.gif 1KB
mad.gif 1KB
add.gif 1KB
prompt.gif 1KB
23.gif 1KB
close.gif 1KB
20.gif 1KB
17.gif 1KB
18.gif 1KB
15.gif 1KB
16.gif 1KB
19.gif 1KB
共 772 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
助力毕业
- 粉丝: 2173
- 资源: 5117
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功