Exemple #1
0
 /**
  * 构造函数
  *
  * @param string $class_name 类名
  */
 public function __construct($class_name)
 {
     parent::__construct();
     try {
         $context = KISS_Framework_Context::getInstance();
         $context->mClassName = $this->_checkClass($class_name);
         $filter = KISS_Class::getClassConstant($context->mClassName, 'FILTERS');
         $this->mFilters = $filter == '' ? array() : explode(',', $filter);
         $context->mFilters = $this->mFilters;
         $context->mCacheTime = intval(KISS_Class::getClassConstant($context->mClassName, 'CACHE_TIME'));
     } catch (Exception $error) {
         $page = new KISS_Page();
         $page->showMessage($error->getMessage());
     }
 }
Exemple #2
0
 /**
  * 构造函数
  *
  * @param string $class_name 类名
  */
 public function __construct($class_name)
 {
     parent::__construct();
     try {
         $context = KISS_Framework_Context::getInstance();
         $context->mClassName = $class_name;
         $filter = KISS_Class::getClassConstant($context->mClassName, 'FILTERS');
         $filters = $filter == '' ? array() : explode(',', $filter);
     } catch (Exception $error) {
         $page = new KISS_Page();
         $page->showMessage($error->getMessage());
     }
     while (count($filters) > 0) {
         $filter = array_shift($filters);
         $filter = new $filter();
         $filter->doPreProcessing($context, $this);
     }
 }
Exemple #3
0
 private function config()
 {
     $config_path = $this->mRoot . $this->mPath['config'];
     parent::__construct();
     if (isset($_GET['table']) && isset($_GET['config'])) {
         $config_file = $config_path . "/{$_GET['config']}_{$_GET['table']}.serialize";
         if (!file_exists($config_file)) {
             $SqlCommand =& KISS_KDO_SqlCommand::getInstance(intval($_GET['config']));
             $fields = $SqlCommand->ExecuteArrayQuery("show full fields from `{$_GET['table']}`");
             foreach ($fields as $row) {
                 $config[] = array('name' => $row['Field'], 'comment' => $row['Comment'], 'type' => 'text', 'insert' => '1', 'update' => '1', 'select' => '1', 'list' => '1', 'search' => '1');
             }
             /*var_dump($fields);
             
                     $this->mMappingTableObject = new BaseTableObject($_GET['table'],$_GET['config']);
                     foreach($this->mMappingTableObject->mMapHash as $key => $value) {
                     $config[] = array (    'name' => $key,'comment' => $key,'type' => 'text','insert' => '1','update' => '1','select' => '1','list' => '1','search' => '1');
                     }*/
             file_put_contents($config_file, serialize($config));
         }
         if ($_SERVER['REQUEST_METHOD'] == "POST") {
             file_put_contents($config_file, serialize($_POST['table_config']));
         }
         $table_config = unserialize(file_get_contents($config_file));
         $this->mSmarty->assign('list', $table_config);
         $this->mSmarty->assign('_action', 'config');
         $this->mSmarty->assign('types', array('text' => '单行文本', 'textarea' => '多行文本', 'file' => '文件', 'password' => '密码', 'select' => '列表', 'date' => '日期'));
         $this->mSmarty->assign('yesno', array('1' => '是', '0' => '否'));
         $this->mSmarty->display("tpl.config.htm");
     } else {
         die("没有指定表名");
     }
 }
Exemple #4
0
 /**
  * 框架入口函数
  *
  * @return void
  */
 public function serve()
 {
     try {
         new KISS_Controller();
     } catch (Exception $e) {
         var_dump($e);
         $page = new KISS_Page();
         $page->showMessage($e->getMessage());
     }
 }
Exemple #5
0
 /**
  * 程序逻辑入口点
  *
  * @return void
  */
 function run()
 {
     $this->clear_all_assign();
     if (count($this->mGET) > 0) {
         foreach ($this->mGET as $key => $value) {
             if (in_array($key, $this->mReserve)) {
                 $this->assign($key, $value);
             }
         }
     }
     $this->beforeRunAction();
     if (!empty($this->mActionFunctions[$this->mAction]['before'])) {
         call_user_func_array(array($this, $this->mActionFunctions[$this->mAction]['before']), array());
     }
     try {
         call_user_func_array(array($this, '_' . $this->mAction), array());
     } catch (Exception $error) {
         $page = new KISS_Page();
         $page->showMessage($error->getMessage());
     }
     if (method_exists($this, 'afterRunAction')) {
         $this->afterRunAction();
     }
     $this->assignUrl();
     $this->assign("_table", $this->mTableName);
     $this->display($this->mTemplateFile);
 }