public function index()
 {
     $id = intval($_GET['id']);
     $article = sp_sql_post($id, '');
     $termid = $article['term_id'];
     $term_obj = M("Terms");
     $term = $term_obj->where("term_id='{$termid}'")->find();
     $article_id = $article['object_id'];
     $should_change_post_hits = sp_check_user_action("posts{$article_id}", 1, true);
     if ($should_change_post_hits) {
         $posts_model = M("Posts");
         $posts_model->save(array("id" => $article_id, "post_hits" => array("exp", "post_hits+1")));
     }
     $article_date = $article['post_modified'];
     $join = "" . C('DB_PREFIX') . 'posts as b on a.object_id =b.id';
     $join2 = "" . C('DB_PREFIX') . 'users as c on b.post_author = c.id';
     $rs = M("TermRelationships");
     $next = $rs->alias("a")->join($join)->join($join2)->where(array("post_modified" => array("egt", $article_date), "tid" => array('neq', $id), "status" => 1, 'term_id' => $termid))->order("post_modified asc")->find();
     $prev = $rs->alias("a")->join($join)->join($join2)->where(array("post_modified" => array("elt", $article_date), "tid" => array('neq', $id), "status" => 1, 'term_id' => $termid))->order("post_modified desc")->find();
     $this->assign("next", $next);
     $this->assign("prev", $prev);
     $smeta = json_decode($article['smeta'], true);
     $content_data = sp_content_page($article['post_content']);
     $article['post_content'] = $content_data['content'];
     $this->assign("page", $content_data['page']);
     $this->assign($article);
     $this->assign("smeta", $smeta);
     $this->assign("term", $term);
     $this->assign("article_id", $article_id);
     $tplname = $term["one_tpl"];
     $tplname = sp_get_apphome_tpl($tplname, "article");
     $this->display(":{$tplname}");
 }
Exemple #2
0
 public function index()
 {
     $id = intval($_GET['id']);
     $article = sp_sql_post($id, '');
     $termid = $article['term_id'];
     $term_obj = D("Terms");
     $term = $term_obj->where("term_id='{$termid}'")->find();
     $article_id = $article['object_id'];
     $should_change_post_hits = sp_check_user_action("posts{$article_id}", 1, true);
     if ($should_change_post_hits) {
         $posts_model = M("Posts");
         $posts_model->save(array("id" => $article_id, "post_hits" => array("exp", "post_hits+1")));
     }
     $smeta = json_decode($article['smeta'], true);
     $content_data = sp_content_page($article['post_content']);
     $article['post_content'] = $content_data['content'];
     $this->assign("page", $content_data['page']);
     $this->assign($article);
     $this->assign("smeta", $smeta);
     $this->assign("term", $term);
     $this->assign("article_id", $article_id);
     $tplname = $term["one_tpl"];
     $tplname = sp_get_apphome_tpl($tplname, "article");
     $this->display(":{$tplname}");
 }
Exemple #3
0
 public function index()
 {
     $id = intval($_GET['id']);
     $result = sp_sql_goods('goods_id:' . $id . ";", '');
     $goods = $result[0];
     if (empty($goods['content'])) {
         if (!empty($goods['click_url'])) {
             header("Location: " . $goods['click_url']);
         }
     }
     $termid = $goods['term_id'];
     $term_obj = D("Terms");
     $term = $term_obj->where("term_id='{$termid}'")->find();
     $goods_id = $goods['goods_id'];
     $should_change_goods_hits = sp_check_user_action("goods{$goods_id}", 1, true);
     if ($should_change_goods_hits) {
         $goods_model = M("goods");
         $goods_model->save(array("id" => $goods_id, "goods_hits" => array("exp", "goods_hits+1")));
     }
     //同类热卖
     $list = sp_sql_goods('cid:' . $goods['term_id'] . ";limit:5;order:listorder DESC,total_num DESC;field:goods_id,goods_name,goods_price,click_url,pic_url;", '');
     $this->assign('list', $list);
     $smeta = json_decode($goods['smeta'], true);
     $content_data = sp_content_page($goods['goods_body']);
     $goods['goods_body'] = $content_data['content'];
     $this->assign("page", $content_data['page']);
     $this->assign($goods);
     $this->assign("smeta", $smeta);
     $this->assign("term", $term);
     $this->assign("goods_id", $goods_id);
     $tplname = $term["one_tpl"];
     $tplname = sp_get_apphome_tpl($tplname, "goods");
     $this->display(":{$tplname}");
 }
Exemple #4
0
 public function index()
 {
     $term = sp_get_term($_GET['id']);
     $tplname = $term["list_tpl"];
     $tplname = sp_get_apphome_tpl($tplname, "list");
     $this->assign($term);
     $this->assign('cat_id', intval($_GET['id']));
     $this->display(":{$tplname}");
 }
 public function index()
 {
     $id = $_GET['id'];
     $content = sp_sql_page($id);
     $this->assign($content);
     $smeta = json_decode($content['smeta'], true);
     $tplname = isset($smeta['template']) ? $smeta['template'] : "";
     $tplname = sp_get_apphome_tpl($tplname, "page");
     $this->display(":{$tplname}");
 }
 public function index()
 {
     $term = sp_get_term($_GET['id']);
     if (empty($term)) {
         header('HTTP/1.1 404 Not Found');
         header('Status:404 Not Found');
         if (sp_template_file_exists(MODULE_NAME . "/404")) {
             $this->display(":404");
         }
         return;
     }
     $tplname = $term["list_tpl"];
     $tplname = sp_get_apphome_tpl($tplname, "list");
     $this->assign($term);
     $this->assign('cat_id', intval($_GET['id']));
     $this->display(":{$tplname}");
 }
 public function list_content()
 {
     $tplname = $term["list_tpl"];
     $tplname = sp_get_apphome_tpl($tplname, "list_content");
     if (empty($tplname)) {
         header('HTTP/1.1 404 Not Found');
         header('Status:404 Not Found');
         if (sp_template_file_exists(MODULE_NAME . "/404")) {
             $this->display(":404");
         }
         return;
     }
     $dbContent = M('content');
     $dbTR = M('term_relationships');
     $obj = $dbTR->where('status=1')->select();
     foreach ($obj as $item) {
         $obj_id[] = $item['object_id'];
     }
     $map['post_status'] = 1;
     //判断文章是否审核通过;
     $map['id'] = array('in', $obj_id);
     //判断文章是否被删除;
     $list = $dbContent->where($map)->order('post_date desc')->select();
     for ($i = 0; $i < count($list); $i++) {
         $user = M('users')->where('id=' . $list[$i]['post_author'])->find();
         $list[$i]['author'] = $user['user_name'];
         $list[$i]['like_list'] = D('like')->getLikeByUUID($list[$i]['id'], true);
         switch ($list[$i]['table_name']) {
             case 'content_paper':
                 $list[$i]['content_type'] = '论文';
                 break;
             case 'content_project':
                 $list[$i]['content_type'] = '项目';
                 break;
             case 'content_award':
                 $list[$i]['content_type'] = '获奖';
                 break;
             case 'content_patent':
                 $list[$i]['content_type'] = '专利';
                 break;
         }
     }
     $this->assign('lists_post', $list);
     $this->assign($term);
     $this->display(":{$tplname}");
 }
 public function index()
 {
     $id = $_GET['id'];
     $content = sp_sql_page($id);
     if (empty($content)) {
         header('HTTP/1.1 404 Not Found');
         header('Status:404 Not Found');
         if (sp_template_file_exists(MODULE_NAME . "/404")) {
             $this->display(":404");
         }
         return;
     }
     $this->assign($content);
     $smeta = json_decode($content['smeta'], true);
     $tplname = isset($smeta['template']) ? $smeta['template'] : "";
     $tplname = sp_get_apphome_tpl($tplname, "page");
     $this->display(":{$tplname}");
 }
 public function index()
 {
     $article_id = intval($_GET['id']);
     $article = sp_sql_post($article_id, '');
     $termid = $article['term_id'];
     $term_obj = D("Terms");
     $term = $term_obj->where("term_id='{$termid}'")->find();
     $smeta = json_decode($article[smeta], true);
     $content_data = sp_content_page($article['post_content']);
     $article['post_content'] = $content_data['content'];
     $this->assign("page", $content_data['page']);
     $this->assign($article);
     $this->assign("smeta", $smeta);
     $this->assign("term", $term);
     $this->assign("article_id", $article_id);
     $tplname = $term["one_tpl"];
     $tplname = sp_get_apphome_tpl($tplname, "article");
     $this->display(":{$tplname}");
 }
 public function index()
 {
     $terms_db = M('Terms');
     $term = sp_get_term($_GET['id']);
     if (empty($term)) {
         header('HTTP/1.1 404 Not Found');
         header('Status:404 Not Found');
         if (sp_template_file_exists(MODULE_NAME . "/404")) {
             $this->display(":404");
         }
         return;
     }
     $tlist = $terms_db->where(array('parent' => $_GET['id']))->select();
     $tplname = $term["list_tpl"];
     $tplname = sp_get_apphome_tpl($tplname, "list");
     $this->assign($term);
     $this->assign('tlist', $tlist);
     $this->assign('cat_id', intval($_GET['id']));
     $this->display(":{$tplname}");
 }
 public function index()
 {
     $term = sp_get_term($_GET['id']);
     if (empty($term)) {
         header('HTTP/1.1 404 Not Found');
         header('Status:404 Not Found');
         if (sp_template_file_exists(MODULE_NAME . "/404")) {
             $this->display(":404");
         }
         return;
     }
     $tplname = $term["list_tpl"];
     $tplname = sp_get_apphome_tpl($tplname, "list");
     $dbPosts = M('posts');
     $dieYear['max'] = $dbPosts->field(array('MAX(LEFT(post_diedate,4))' => 'max'))->find()['max'];
     $dieYear['min'] = $dbPosts->field(array('MIN(LEFT(post_diedate,4))' => 'min'))->find()['min'];
     $this->assign('dieYear', $dieYear);
     $this->assign($term);
     $this->assign('cat_id', intval($_GET['id']));
     $this->display(":{$tplname}");
 }
 public function index()
 {
     $id = intval($_GET['id']);
     $article = sp_sql_post($id, '');
     if (empty($article)) {
         header('HTTP/1.1 404 Not Found');
         header('Status:404 Not Found');
         if (sp_template_file_exists(MODULE_NAME . "/404")) {
             $this->display(":404");
         }
         return;
     }
     $termid = $article['term_id'];
     $term_obj = M("Terms");
     $term = $term_obj->where("term_id='{$termid}'")->find();
     $article_id = $article['object_id'];
     $posts_model = M("Posts");
     $posts_model->save(array("id" => $article_id, "post_hits" => array("exp", "post_hits+1")));
     $article_date = $article['post_modified'];
     $join = "" . C('DB_PREFIX') . 'posts as b on a.object_id =b.id';
     $join2 = "" . C('DB_PREFIX') . 'users as c on b.post_author = c.id';
     $rs = M("TermRelationships");
     $next = $rs->alias("a")->join($join)->join($join2)->where(array("post_modified" => array("egt", $article_date), "tid" => array('neq', $id), "status" => 1, 'term_id' => $termid))->order("post_modified asc")->find();
     $prev = $rs->alias("a")->join($join)->join($join2)->where(array("post_modified" => array("elt", $article_date), "tid" => array('neq', $id), "status" => 1, 'term_id' => $termid))->order("post_modified desc")->find();
     $this->assign("next", $next);
     $this->assign("prev", $prev);
     $smeta = json_decode($article['smeta'], true);
     $content_data = sp_content_page($article['post_content']);
     $article['post_content'] = $content_data['content'];
     $this->assign("page", $content_data['page']);
     $this->assign($article);
     $this->assign("smeta", $smeta);
     $this->assign("term", $term);
     $this->assign("article_id", $article_id);
     $this->assign("region", $article['post_region']);
     $tplname = $term["one_tpl"];
     $tplname = sp_get_apphome_tpl($tplname, "article");
     $this->display(":{$tplname}");
 }
 public function content()
 {
     $id = $_GET['id'];
     $article = sp_sql_content($id, '');
     if (empty($article)) {
         header('HTTP/1.1 404 Not Found');
         header('Status:404 Not Found');
         if (sp_template_file_exists(MODULE_NAME . "/404")) {
             $this->display(":404");
         }
         return;
     }
     $termid = $article['term_id'];
     $term_obj = M("Terms");
     $term = $term_obj->where("term_id='{$termid}'")->find();
     $str_like_list = D('like')->getLikeByUUID($id, true);
     $article_id = $article['object_id'];
     $dbContent = D("content");
     $dbContent->saveByUUID($id, array("post_hits" => array("exp", "post_hits+1")));
     $article_date = $article['post_modified'];
     $join = "" . C('DB_PREFIX') . 'content as b on a.object_id =b.id';
     $join2 = "" . C('DB_PREFIX') . 'users as c on b.post_author = c.id';
     $rs = M("TermRelationships");
     $next = $rs->alias("a")->join($join)->join($join2)->where(array("post_modified" => array("egt", $article_date), "tid" => array('neq', $id), "status" => 1, 'a.term_id' => $termid))->order("post_modified asc")->find();
     $prev = $rs->alias("a")->join($join)->join($join2)->where(array("post_modified" => array("elt", $article_date), "tid" => array('neq', $id), "status" => 1, 'a.term_id' => $termid))->order("post_modified desc")->find();
     $this->assign("next", $next);
     $this->assign("prev", $prev);
     $smeta = json_decode($article['smeta'], true);
     $content_data = sp_content_page($article['post_content']);
     $article['post_content'] = $content_data['content'];
     switch ($article['term_id']) {
         case 2:
             $article['content_type'] = '论文';
             break;
         case 3:
             $article['content_type'] = '项目';
             break;
         case 4:
             $article['content_type'] = '获奖';
             break;
         case 5:
             $article['content_type'] = '专利';
             break;
     }
     $this->assign("page", $content_data['page']);
     $this->assign("article", $article);
     $this->assign("smeta", $smeta);
     $this->assign("term", $term);
     $this->assign("article_id", $article_id);
     $this->assign("str_like_list", $str_like_list);
     $tplname = $term["one_tpl"];
     $tplname = sp_get_apphome_tpl($tplname, "article");
     $this->display(":{$tplname}");
 }