示例#1
0
 public function index($args)
 {
     $db = $this->database();
     $s = new model_section($db);
     $p = new model_page($db);
     $md = new markdown_parser();
     $rt = explode("/", $args["_url"]);
     $s->load_from_name(strlen($rt[0]) > 0 ? $rt[0] : "home");
     array_shift($rt);
     $rt = implode("/", $rt);
     $cur_url = strlen($rt) > 0 ? $args["_url"] : $s->default_page();
     $p->load_from_url($cur_url);
     $navs = MODEL_SECTION::get_sections($db);
     $subnavs = $s->get_pages();
     $tpl = new view($this->registry);
     if ($args["article"]) {
         # Loading and displaying an article.
         $a = new model_article($db, $args["article"]);
         $tpl->set("content", array("markdown" => $md->transform($a->body)));
         $tpl->set("title", $a->title);
     } else {
         # Listing articles.
         switch ($args["_url"]) {
             case "projects/other.html":
                 $listed = array(8, 9, 14);
                 $subtitle = "Other";
                 break;
             default:
                 $listed = array(13, 12, 11, 10, 15, 16, 17);
                 $subtitle = "KT-EQUAL";
                 break;
         }
         $projects = array();
         $projects = MODEL_ARTICLE::get_articles($db, $listed);
         $tpl->set("include", "subviews/project_list.php");
         $tpl->set("projects", $projects);
         $tpl->set("title", $subtitle . " Projects");
     }
     $tpl->set("cur_url", $cur_url);
     $tpl->set("navs", $navs);
     $tpl->set("subnavs", $subnavs);
     $tpl->set("page", $s->name);
     $tpl->set("s_intro", $md->transform($s->introduction));
     $tpl->set("s_img", $s->image);
     $tpl->show("default");
 }
示例#2
0
 /**
  * table_article function.
  *
  * @access private
  * @return void
  */
 private function table_article()
 {
     include_once BG_PATH_MODEL . "article.class.php";
     //载入管理帐号模型
     $_mdl_article = new MODEL_ARTICLE();
     $_arr_articleRow = $_mdl_article->mdl_create_table();
     if ($_arr_articleRow["alert"] != "y120105") {
         $this->obj_ajax->halt_alert($_arr_articleRow["alert"]);
     }
     $_arr_articleRow = $_mdl_article->mdl_create_index();
     if ($_arr_articleRow["alert"] != "y120109") {
         $this->obj_ajax->halt_alert($_arr_articleRow["alert"]);
     }
 }
示例#3
0
 /**
  * table_article function.
  *
  * @access private
  * @return void
  */
 private function table_article()
 {
     include_once BG_PATH_MODEL . "article.class.php";
     //载入管理帐号模型
     $_mdl_article = new MODEL_ARTICLE();
     $_arr_articleTable = $_mdl_article->mdl_create_table();
     $_arr_articleIndex = $_mdl_article->mdl_create_index();
     $this->tplData["db_alert"]["article_table"] = array("alert" => $_arr_articleTable["alert"], "status" => substr($_arr_articleTable["alert"], 0, 1));
     $this->tplData["db_alert"]["article_index"] = array("alert" => $_arr_articleIndex["alert"], "status" => substr($_arr_articleIndex["alert"], 0, 1));
 }
示例#4
0
 /**
  * table_article function.
  *
  * @access private
  * @return void
  */
 private function table_article()
 {
     include_once BG_PATH_MODEL . "article.class.php";
     //载入管理帐号模型
     $_mdl_article = new MODEL_ARTICLE();
     $_arr_col = $_mdl_article->mdl_column();
     $_arr_alert = array();
     if (in_array("article_tag", $_arr_col)) {
         $_arr_alert["article_tag"] = array("DROP");
     }
     if (in_array("article_upfile_id", $_arr_col)) {
         $_arr_alert["article_upfile_id"] = array("CHANGE", "int NOT NULL COMMENT '附件ID'", "article_attach_id");
     }
     if (in_array("article_spec_id", $_arr_col)) {
         $_arr_alert["article_spec_id"] = array("CHANGE", "mediumint NOT NULL COMMENT '专题ID'", "article_spec_id");
     } else {
         $_arr_alert["article_spec_id"] = array("ADD", "mediumint NOT NULL COMMENT '专题ID'");
     }
     if (in_array("article_cate_id", $_arr_col)) {
         $_arr_alert["article_cate_id"] = array("CHANGE", "smallint NOT NULL COMMENT '隶属栏目ID'", "article_cate_id");
     }
     if (in_array("article_mark_id", $_arr_col)) {
         $_arr_alert["article_mark_id"] = array("CHANGE", "smallint NOT NULL COMMENT '标记ID'", "article_mark_id");
     }
     if (in_array("article_top", $_arr_col)) {
         $_arr_alert["article_top"] = array("CHANGE", "tinyint NOT NULL COMMENT '置顶'", "article_top");
     }
     if (in_array("article_status", $_arr_col)) {
         $_arr_alert["article_status"] = array("CHANGE", "enum('pub','wait','hide') NOT NULL COMMENT '状态'", "article_status");
     }
     if (in_array("article_box", $_arr_col)) {
         $_arr_alert["article_box"] = array("CHANGE", "enum('normal','draft','recycle') NOT NULL COMMENT '盒子'", "article_box");
     }
     if (in_array("article_hits_day", $_arr_col)) {
         $_arr_alert["article_hits_day"] = array("CHANGE", "mediumint NOT NULL COMMENT '日点击'", "article_hits_day");
     }
     if (in_array("article_hits_week", $_arr_col)) {
         $_arr_alert["article_hits_week"] = array("CHANGE", "mediumint NOT NULL COMMENT '周点击'", "article_hits_week");
     }
     if (in_array("article_hits_month", $_arr_col)) {
         $_arr_alert["article_hits_month"] = array("CHANGE", "mediumint NOT NULL COMMENT '月点击'", "article_hits_month");
     }
     if (in_array("article_hits_year", $_arr_col)) {
         $_arr_alert["article_hits_year"] = array("CHANGE", "mediumint NOT NULL COMMENT '年点击'", "article_hits_year");
     }
     if (!in_array("article_time_day", $_arr_col)) {
         $_arr_alert["article_time_day"] = array("ADD", "int NOT NULL COMMENT '日点击重置时间'");
     }
     if (!in_array("article_time_week", $_arr_col)) {
         $_arr_alert["article_time_week"] = array("ADD", "int NOT NULL COMMENT '周点击重置时间'");
     }
     if (!in_array("article_time_month", $_arr_col)) {
         $_arr_alert["article_time_month"] = array("ADD", "int NOT NULL COMMENT '月点击重置时间'");
     }
     if (!in_array("article_time_year", $_arr_col)) {
         $_arr_alert["article_time_year"] = array("ADD", "int NOT NULL COMMENT '年点击重置时间'");
     }
     /*if (!in_array("article_custom", $_arr_col)) {
     			$_arr_alert["article_custom"] = array("ADD", "text NOT NULL COMMENT '自定义字段'");
     		}*/
     if ($_arr_alert) {
         $_reselt = $this->obj_db->alert_table(BG_DB_TABLE . "article", $_arr_alert);
         if (!$_reselt) {
             $this->obj_ajax->halt_alert("x120106");
         }
     }
     $_arr_articleRow = $_mdl_article->mdl_create_index();
     if ($_arr_articleRow["alert"] != "y120109") {
         $this->obj_ajax->halt_alert($_arr_articleRow["alert"]);
     }
     if (in_array("article_content", $_arr_col)) {
         $_arr_articleRow = $_mdl_article->mdl_copy_table();
         if ($_arr_articleRow["alert"] != "y120105") {
             $this->obj_ajax->halt_alert($_arr_articleRow["alert"]);
         }
     }
     $_arr_alert = array();
     if (in_array("article_content", $_arr_col)) {
         $_arr_alert["article_content"] = array("DROP");
     }
     if ($_arr_alert) {
         $_reselt = $this->obj_db->alert_table(BG_DB_TABLE . "article", $_arr_alert);
         if (!$_reselt) {
             $this->obj_ajax->halt_alert("x120106");
         }
     }
 }