Example #1
0
 /**
  * 加载指定的配置文件
  */
 public static function load()
 {
     $agrs = func_get_args();
     for ($i = 0, $n = count($agrs); $i < $n; $i++) {
         loader::config($agrs[$i]);
     }
 }
Example #2
0
 function user_mdl()
 {
     parent::modelfactory();
     $config =& loader::config();
     $this->cookie_name = $config['cookie_name'];
     $this->cookie_auth_key = $config['cookie_auth_key'];
     $this->cookie_domain = $config['cookie_domain'];
     if (isset($_COOKIE[$this->cookie_name])) {
         $auth = authcode($_COOKIE[$this->cookie_name], 'DECODE', md5($this->cookie_auth_key));
         $auth = explode("\t", $auth);
         $uid = isset($auth[1]) ? $auth[1] : 0;
         $upass = isset($auth[0]) ? $auth[0] : '';
         $this->db->select('#@users', '*', "id=" . intval($uid));
         $uinfo = $this->db->getRow();
         if (!$uinfo) {
             $this->LOGIN_FLAG = false;
         } else {
             if ($uinfo['user_pass'] == $upass) {
                 $this->LOGIN_FLAG = true;
                 $this->uinfo = $uinfo;
             } else {
                 $this->LOGIN_FLAG = false;
             }
         }
     } else {
         $this->LOGIN_FLAG = false;
     }
 }
Example #3
0
 /**
  * 装载数据库
  */
 function &database($dbstr = 'default', $config = '')
 {
     if (!isset($GLOBALS[SP_LOADER]['DATABASES'][$dbstr])) {
         if (is_array($config)) {
             $DB_config = $config;
         } else {
             $Config =& loader::config();
             $DB_config = $Config['database'][$dbstr];
         }
         $db_class =& loader::lib('db');
         $db_class->init($DB_config);
         $GLOBALS[SP_LOADER]['DATABASES'][$dbstr] =& $db_class;
     }
     return $GLOBALS[SP_LOADER]['DATABASES'][$dbstr];
 }
Example #4
0
 /**
  * 装载数据库
  */
 static function &database($dbstr = 'default', $config = '')
 {
     if (!isset(self::$_databases[$dbstr])) {
         if (is_array($config)) {
             $DB_config = $config;
         } else {
             $Config =& loader::config();
             $DB_config = $Config['database'][$dbstr];
         }
         $db_class =& loader::lib('db');
         $db_class->init($DB_config);
         self::$_databases[$dbstr] = $db_class;
     }
     return self::$_databases[$dbstr];
 }
Example #5
0
 function plugins()
 {
     need_login('page');
     $plugins = $this->plugin->get_plugins();
     $this->output->set('plugins', $plugins);
     //面包屑
     $crumb_nav = array();
     $crumb_nav[] = array('name' => lang('system_setting'), 'link' => site_link('setting'));
     $crumb_nav[] = array('name' => lang('plugin_setting'));
     $this->page_crumb($crumb_nav);
     $page_title = lang('plugin_setting') . ' - ' . lang('system_setting') . ' - ' . $this->setting->get_conf('site.title');
     $page_keywords = $this->setting->get_conf('site.keywords');
     $page_description = $this->setting->get_conf('site.description');
     $Config = loader::config();
     $this->output->set('safemode', $Config['safemode']);
     $this->page_init($page_title, $page_keywords, $page_description);
     $this->render();
 }
Example #6
0
function meiu_bootstrap()
{
    unset_globals();
    global $base_url, $base_path, $base_root, $language, $templatelangs;
    timer_start('page');
    require_once COREDIR . 'loader.php';
    require_once INCDIR . 'functions.php';
    include_once INCDIR . 'plugin.php';
    init_defines();
    if (file_exists(COREDIR . 'lang' . DIRECTORY_SEPARATOR . LANGSET . '.lang.php')) {
        require_once COREDIR . 'lang' . DIRECTORY_SEPARATOR . LANGSET . '.lang.php';
    }
    boot_init();
    $plugin =& loader::lib('plugin');
    $Config =& loader::config();
    if (!$Config['safemode']) {
        $plugin->init_plugins();
    }
    $plugin->trigger('boot_init');
    //输出对象
    $output =& loader::lib('output');
    //载入当前用户信息
    $user =& loader::model('user');
    $output->set('loggedin', $user->loggedin());
    if ($user->loggedin()) {
        $output->set('u_info', $user->get_all_field());
        $user_extrainfo = $user->get_extra($user->get_field('id'));
        $output->set('u_extrainfo', $user_extrainfo);
        $user_theme = isset($user_extrainfo['theme']) ? $user_extrainfo['theme'] : '';
    } else {
        $user_theme = null;
    }
    init_template($user_theme);
    $templatelangs = array();
    $uri =& loader::lib('uri');
    $uriinfo = $uri->parse_uri();
    $setting_mdl =& loader::model('setting');
    //如果数据库中的版本和程序版本不一致则跳转到执行自动升级脚本
    $version = $setting_mdl->get_conf('system.version');
    if ($version != MPIC_VERSION) {
        if (file_exists(ROOTDIR . 'install/upgrade.php')) {
            include ROOTDIR . 'install/upgrade.php';
            exit;
        }
    }
    $output->set('base_path', $base_path);
    $output->set('statics_path', $base_path . 'statics/');
    $output->set('site_logo', $setting_mdl->get_conf('site.logo', ''));
    $output->set('site_name', $setting_mdl->get_conf('site.title', lang('myalbum')));
    define('IN_CTL', $uriinfo['ctl']);
    define('IN_ACT', $uriinfo['act']);
    $_GET = array_merge($_GET, $uriinfo['pars']);
    $_REQUEST = array_merge($_REQUEST, $uriinfo['pars']);
    require_once INCDIR . 'pagecore.php';
    if ($plugin->has_trigger('custom_page.' . IN_CTL . '.' . IN_ACT) || $plugin->has_trigger('custom_page.' . IN_CTL)) {
        $plugin->trigger('custom_page.' . IN_CTL . '.' . IN_ACT) || $plugin->trigger('custom_page.' . IN_CTL, IN_ACT);
    } else {
        if (file_exists(CTLDIR . $uriinfo['ctl'] . '.ctl.php')) {
            require_once CTLDIR . $uriinfo['ctl'] . '.ctl.php';
            $controller_name = $uriinfo['ctl'] . '_ctl';
            $controller = new $controller_name();
            $controller->_init();
            if (method_exists($controller, $uriinfo['act'])) {
                call_user_func(array($controller, $uriinfo['act']));
            } else {
                header("HTTP/1.1 404 Not Found");
                showError(lang('404_not_found'));
            }
            $controller->_called();
        } else {
            header("HTTP/1.1 404 Not Found");
            showError(lang('404_not_found'));
        }
    }
}
Example #7
0
    $db->query($sql);
}
//更新图片所属的分类
$album_mdl =& loader::model('album');
$photo_mdl =& loader::model('photo');
$albums = $album_mdl->get_all();
if ($albums) {
    foreach ($albums as $album) {
        $photo_mdl->update_by_aid($album['id'], array('cate_id' => $album['cate_id']));
    }
}
//setting新增值
$setting_mdl->set_conf('system.enable_comment_captcha', true);
$setting_mdl->set_conf('system.enable_login_captcha', false);
$setting_mdl->set_conf('system.comment_audit', 0);
$setting_mdl->set_conf('upload.enable_cut_big_pic', false);
$setting_mdl->set_conf('upload.max_width', 1600);
$setting_mdl->set_conf('upload.max_height', 1200);
$setting_mdl->set_conf('upload.enable_thumb_cut', false);
$setting_mdl->set_conf('upload.thumb_width', 180);
$setting_mdl->set_conf('upload.thumb_height', 180);
$setting_mdl->set_conf('upload.use_old_imgname', false);
$setting_mdl->set_conf('display.album_pageset', 12);
$setting_mdl->set_conf('display.photo_pageset', 12);
$setting_mdl->set_conf('display.album_sort_default', 'ct_desc');
$setting_mdl->set_conf('display.photo_sort_default', 'tu_desc');
$config =& loader::config();
$default_config =& loader::config('config.default');
$default_config['img_path_key'] = random(10);
save_config_file(ROOTDIR . 'conf/config.php', $config, $default_config);
//require_once(ROOTDIR.'install/upgrade_2.2.php');
Example #8
0
File: img.php Project: vluo/myPoto
 function thumb()
 {
     date_default_timezone_set('UTC');
     $params = $_SERVER["QUERY_STRING"];
     $config = loader::config();
     $params = mycrypt($params, $config['img_path_key'], 'DE');
     $params = @unserialize($params);
     if (!$params['path']) {
         header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found!');
         exit;
     }
     $path = $params['path'];
     $this->realpath = get_realpath(ROOTDIR . $path);
     if (isset($params['guard']) && $params['guard']) {
         //防盗链代码,具体代码需要在插件中实现
         include_once INCDIR . 'plugin.php';
         $plugin =& loader::lib('plugin');
         $Config =& loader::config();
         if (!$Config['safemode']) {
             $plugin->init_plugins();
         }
         $plugin->trigger('output_image', $path);
     }
     $this->pathCheck();
     //不处理图片直接输出
     if (isset($params['donothing']) && $params['donothing']) {
         $this->responseImg();
         return;
     }
     $this->cache_dir = ROOTDIR . 'cache/dimgs/';
     $this->param['w'] = isset($params['w']) ? intval($params['w']) : 0;
     //intval(getGet('w',0));
     $this->param['h'] = isset($params['h']) ? intval($params['h']) : 0;
     //intval(getGet('h',0));
     $this->param['zoom'] = isset($params['zoom']) ? intval($params['zoom']) : 0;
     //getGet('zoom',0);
     $open_cache = isset($params['cache']) ? intval($params['cache']) : 0;
     $cache_key = md5($path . $this->param['w'] . $this->param['h'] . $this->param['zoom']);
     $this->cache_subdir = $this->cache_dir . substr($cache_key, 0, 2);
     $this->cache_file = $this->cache_subdir . '/' . $cache_key . '.php';
     if ($this->browserCache()) {
         //尝试浏览器缓存
         exit;
     }
     if ($open_cache) {
         //如果开启了服务器缓存
         $this->cleanCache();
         if ($this->serverCache()) {
             //尝试服务器缓存
             exit;
         }
         if (!$this->processImage()) {
             //处理图片
             exit('Process image failed!');
         }
         if ($this->writeToCache()) {
             //写入缓存
             $this->serverCache();
         }
     } else {
         if (!$this->processImage()) {
             exit('Process image failed!');
         }
         $this->outputImg();
         //直接输出图片
         $this->imgHandler->close();
     }
 }