示例#1
1
 private static function loader($class_name)
 {
     $require_file = AWS_PATH . preg_replace('#_+#', '/', $class_name) . '.php';
     if (file_exists($require_file)) {
         $class_file_location = $require_file;
     } else {
         if (class_exists('AWS_APP', false)) {
             self::$aliases = array_merge(self::$aliases, AWS_APP::plugins()->model());
         }
         if (isset(self::$aliases[$class_name])) {
             $class_file_location = self::$aliases[$class_name];
         } else {
             if (file_exists(ROOT_PATH . 'models/' . str_replace(array('_class', '_'), array('', '/'), $class_name) . '.php')) {
                 $class_file_location = ROOT_PATH . 'models/' . str_replace(array('_class', '_'), array('', '/'), $class_name) . '.php';
             } else {
                 if (file_exists(AWS_PATH . 'class/' . $class_name . '.inc.php')) {
                     $class_file_location = AWS_PATH . 'class/' . $class_name . '.inc.php';
                 }
             }
         }
     }
     if ($class_file_location) {
         require $class_file_location;
         self::$loaded_class[$class_name] = $class_file_location;
         if ($class_name == 'TPL') {
             TPL::initialize();
         }
         return true;
     }
 }
示例#2
0
 public function run_action()
 {
     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
     // Date in the past
     header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
     // always modified
     header('Cache-Control: no-cache, must-revalidate');
     // HTTP/1.1
     header('Pragma: no-cache');
     // HTTP/1.0
     @set_time_limit(0);
     if ($call_actions = $this->model('crond')->start()) {
         foreach ($call_actions as $call_action) {
             if ($plugins = AWS_APP::plugins()->parse('crond', 'main', $call_action)) {
                 foreach ($plugins as $plugin_file) {
                     include $plugin_file;
                 }
             }
             $call_function = $call_action;
             $this->model('crond')->{$call_function}();
         }
     }
     if (AWS_APP::config()->get('system')->debug) {
         TPL::output('global/debuger.tpl.htm');
     }
 }
 public function __construct($process_setup = true)
 {
     // 获取当前用户 User ID
     $this->user_id = AWS_APP::user()->get_info('uid');
     if ($this->user_info = $this->model('account')->get_user_info_by_uid($this->user_id, TRUE)) {
         $user_group = $this->model('account')->get_user_group($this->user_info['group_id'], $this->user_info['reputation_group']);
         if ($this->user_info['default_timezone']) {
             date_default_timezone_set($this->user_info['default_timezone']);
         }
         $this->model('online')->online_active($this->user_id, $this->user_info['last_active']);
     } else {
         if ($this->user_id) {
             $this->model('account')->logout();
         } else {
             $user_group = $this->model('account')->get_user_group_by_id(99);
             if ($_GET['fromuid']) {
                 HTTP::set_cookie('fromuid', $_GET['fromuid']);
             }
         }
     }
     $this->user_info['group_name'] = $user_group['group_name'];
     $this->user_info['permission'] = $user_group['permission'];
     AWS_APP::session()->permission = $this->user_info['permission'];
     if ($this->user_info['forbidden'] == 1) {
         $this->model('account')->logout();
         H::redirect_msg(AWS_APP::lang()->_t('抱歉, 你的账号已经被禁止登录'), '/');
     } else {
         TPL::assign('user_id', $this->user_id);
         TPL::assign('user_info', $this->user_info);
     }
     if ($this->user_id and !$this->user_info['permission']['human_valid']) {
         unset(AWS_APP::session()->human_valid);
     } else {
         if ($this->user_info['permission']['human_valid'] and !is_array(AWS_APP::session()->human_valid)) {
             AWS_APP::session()->human_valid = array();
         }
     }
     // 引入系统 CSS 文件
     TPL::import_css(array('css/common.css', 'css/link.css', 'js/plug_module/style.css'));
     if (defined('SYSTEM_LANG')) {
         TPL::import_js(base_url() . '/language/' . SYSTEM_LANG . '.js');
     }
     if (HTTP::is_browser('ie', 8)) {
         TPL::import_js(array('js/jquery.js', 'js/respond.js'));
     } else {
         TPL::import_js('js/jquery.2.js');
     }
     // 引入系统 JS 文件
     TPL::import_js(array('js/jquery.form.js', 'js/plug_module/plug-in_module.js', 'js/aws.js', 'js/aw_template.js', 'js/app.js'));
     // 产生面包屑导航数据
     $this->crumb(get_setting('site_name'), base_url());
     // 载入插件
     if ($plugins = AWS_APP::plugins()->parse($_GET['app'], $_GET['c'], 'setup')) {
         foreach ($plugins as $plugin_file) {
             include $plugin_file;
         }
     }
     if (get_setting('site_close') == 'Y' and $this->user_info['group_id'] != 1 and !in_array($_GET['app'], array('admin', 'account', 'upgrade'))) {
         $this->model('account')->logout();
         H::redirect_msg(get_setting('close_notice'), '/account/login/');
     }
     if ($_GET['ignore_ua_check'] == 'TRUE') {
         HTTP::set_cookie('_ignore_ua_check', 'TRUE', time() + 3600 * 24 * 7);
     }
     // 执行控制器 Setup 动作
     if ($process_setup) {
         $this->setup();
     }
 }
示例#4
0
 /**
  * 获取系统插件处理类
  *
  * 调用 core/plugins.php
  *
  * @access	public
  * @return	object
  */
 public static function plugins()
 {
     if (!self::$plugins) {
         self::$plugins = load_class('core_plugins');
     }
     return self::$plugins;
 }
示例#5
0
 public static function output($template_filename, $display = true)
 {
     if (!strstr($template_filename, self::$template_ext)) {
         $template_filename .= self::$template_ext;
     }
     $display_template_filename = 'default/' . $template_filename;
     if (self::$in_app) {
         if (get_setting('ui_style') != 'default') {
             $custom_template_filename = get_setting('ui_style') . '/' . $template_filename;
             if (file_exists(self::$template_path . '/' . $custom_template_filename)) {
                 $display_template_filename = $custom_template_filename;
             }
         }
         self::assign('template_name', get_setting('ui_style'));
         if (!self::$view->_meta_keywords) {
             self::set_meta('keywords', get_setting('keywords'));
         }
         if (!self::$view->_meta_description) {
             self::set_meta('description', get_setting('description'));
         }
     } else {
         self::assign('template_name', 'default');
     }
     if (self::$in_app and $display) {
         if ($plugins = AWS_APP::plugins()->parse($_GET['app'], $_GET['c'], $_GET['act'], str_replace(self::$template_ext, '', $template_filename))) {
             foreach ($plugins as $plugin_file) {
                 include_once $plugin_file;
             }
         }
     }
     $output = self::$view->getOutput($display_template_filename);
     if (self::$in_app and basename($template_filename) != 'debuger.tpl.htm') {
         $template_dirs = explode('/', $template_filename);
         /*
         /if ($template_dirs[0] != 'admin')
         {
         	$output = H::sensitive_words($output);
         }
         */
         if (get_setting('url_rewrite_enable') != 'Y' or $template_dirs[0] == 'admin') {
             //$output = preg_replace('/(href|action)=([\"|\'])(?!http)(?!mailto)(?!file)(?!ftp)(?!javascript)(?![\/|\#])(?!\.\/)([^\"\']+)([\"|\'])/is', '\1=\2' . base_url() . '/' . G_INDEX_SCRIPT . '\3\4', $output);
             $output = preg_replace('/<([^>]*?)(href|action)=([\\"|\'])(?!http)(?!mailto)(?!file)(?!ftp)(?!javascript)(?![\\/|\\#])(?!\\.\\/)([^\\"\']+)([\\"|\'])([^>]*?)>/is', '<\\1\\2=\\3' . base_url() . '/' . G_INDEX_SCRIPT . '\\4\\5\\6>', $output);
         }
         if ($request_routes = get_request_route() and $template_dirs[0] != 'admin' and get_setting('url_rewrite_enable') == 'Y') {
             foreach ($request_routes as $key => $val) {
                 $output = preg_replace("/href=[\"|']" . $val[0] . "[\\#]/", "href=\"" . $val[1] . "#", $output);
                 $output = preg_replace("/href=[\"|']" . $val[0] . "[\"|']/", "href=\"" . $val[1] . "\"", $output);
             }
         }
         if (get_setting('url_rewrite_enable') == 'Y' and $template_dirs[0] != 'admin') {
             //$output = preg_replace('/(href|action)=([\"|\'])(?!mailto)(?!file)(?!ftp)(?!http)(?!javascript)(?![\/|\#])(?!\.\/)([^\"\']+)([\"|\'])/is', '\1=\2' . base_url() . '/' . '\3\4', $output);
             $output = preg_replace('/<([^>]*?)(href|action)=([\\"|\'])(?!mailto)(?!file)(?!ftp)(?!http)(?!javascript)(?![\\/|\\#])(?!\\.\\/)([^\\"\']{0,})([\\"|\'])([^>]*?)>/is', '<\\1\\2=\\3' . base_url() . '/' . '\\4\\5\\6>', $output);
         }
         //$output = preg_replace("/([a-zA-Z0-9]+_?[a-zA-Z0-9]+)-__|(__[a-zA-Z0-9]+_?[a-zA-Z0-9]+)-$/i", '', $output);
         $output = preg_replace('/[a-zA-Z0-9]+_?[a-zA-Z0-9]*\\-__/', '', $output);
         $output = preg_replace('/(__)?[a-zA-Z0-9]+_?[a-zA-Z0-9]*\\-([\'|"])/', '\\2', $output);
         if (AWS_APP::config()->get('system')->debug) {
             $output .= "\r\n<!-- Template End: " . $display_template_filename . " -->\r\n";
         }
     }
     if ($display) {
         echo $output;
         flush();
     } else {
         return $output;
     }
 }