Esempio n. 1
0
 public function run()
 {
     include_once SANWEN_LIB . '/Common/functions.php';
     include_used_file();
     //include the file that used
     Log::write('begin initApp');
     $this->initApp();
     //use the filter
     $filter = new Filter();
     //filter all url
     Log::write('begin to filter url');
     if ($filter->filter_all_url()) {
         $include_file = get_include_file();
         if (file_exists($include_file)) {
             Log::write('get_include_file:' . $include_file);
             include_once $include_file;
             execute(null, null);
         } else {
             //对应地址的类不存在的时候,执行默认首页
             if (file_exists(APP . '/Index/Action/Index.action.php')) {
                 include_once APP . '/Index/Action/Index.action.php';
                 execute("Index", "Index");
             } else {
                 //默认首页不存在的时候,抛出错误信息
                 echo get_langage_message('system.lang.php', 'DEFAULT_INDEX_NOT_FOUND');
             }
         }
     } else {
         echo get_langage_message('system.lang.php', 'CAN_NOT_ACCESS');
     }
 }
Esempio n. 2
0
 function __construct()
 {
     if (defined('CONFIG_DB')) {
         if (is_file(CONFIG_DB)) {
             $this->db_info = (include CONFIG_DB);
         } else {
             exit(get_langage_message('system.lang.php', 'DB_CONFIG_NOT_FOUND'));
         }
     } else {
         exit(get_langage_message('system.lang.php', 'DB_CONFIG_NOT_STE'));
     }
 }
Esempio n. 3
0
 private function is_dir_exists()
 {
     if (!is_dir(TPL_DIR)) {
         //检测是否存在模板文件夹
         exit(get_langage_message('template.lang.php', 'TEMPLATE_DIR_NOT_FOUND'));
     }
     if (!is_dir(TPL_C_DIR)) {
         //检测是否存在编译文件夹
         exit('编译文件夹不存在!');
     }
     if (!is_dir(CACHE_DIR)) {
         //检测是否存在缓存文件夹
         exit('缓存文件夹不存在!');
     }
 }
Esempio n. 4
0
 public function display($app = null, $view = null)
 {
     //add by pantingwen@hotmail.com 2014-08-05 begin
     //如果没有指定模板的话,可以默认获取
     if (empty($app)) {
         $app = $_GET['app'];
     }
     if (empty($view)) {
         $view = $_GET['action'];
     }
     //add by pantingwen@hotmail.com 2014-08-05 end
     //判断当前是不是开启了模板模式
     if (!defined('TEMPLATE_OPEN') || !TEMPLATE_OPEN) {
         $view_file = APP . '/' . $app . '/View/' . $view . '.view.php';
         if (defined("LANG_VIEW") && LANG_VIEW == true) {
             //如果语言没定义,就使用英文的语言
             if (!defined("LANG")) {
                 $view_file = APP . '/' . $app . '/View/' . $view . '_EN_US.view.php';
             } else {
                 $view_file = APP . '/' . $app . '/View/' . $view . '_' . LANG . '.view.php';
             }
         }
         if (file_exists($view_file)) {
             include_once $view_file;
         } else {
             echo get_langage_message('system.lang.php', 'VIEW_NOT_FOUND', array('VIEW_FILE' => $view_file));
         }
     } else {
         if (!is_file(CONFIG_TEMPLATE)) {
             echo get_langage_message('template.lang.php', 'TEMPLATE_NEED_CONFIG_FILE');
         } else {
             include_once CONFIG_TEMPLATE;
             $tpl = new Templates();
             $tpl->set_vars($this->view_data);
             $tpl->display($app . '/' . $view);
         }
     }
 }
Esempio n. 5
0
function jump_url($jump_type, $jump_message, $jump_url, $jump_time)
{
    $jump_types = array('success', 'failure');
    if (in_array($jump_type, $jump_types)) {
        $file_content = file_get_contents(SANWEN_LIB . '/Template/jump_url.html');
        $file_content = str_replace("{jump_type}", $jump_type, $file_content);
        $file_content = str_replace("{jump_message}", $jump_message, $file_content);
        $file_content = str_replace("{jump_url}", $jump_url, $file_content);
        $file_content = str_replace("{jump_time}", $jump_time, $file_content);
        echo $file_content;
    } else {
        echo get_langage_message('system.lang.php', 'JUMP_TYPE_NOT_ALLOWED', array('JUMP_TYPE' => $jump_type));
    }
}
Esempio n. 6
0
 function modify($table_name, $table_fields, $table_condition_files)
 {
     $this->crud->modify($table_name, $table_fields, $table_condition_files);
     return array('jump_type' => $this->SUCCESS, 'jump_message' => get_langage_message("system.lang.php", "REMOVE_SUCCESSED"));
 }