Example #1
0
     $categorydescription = $catinfo->description;
 }
 if (empty($categoryseotitle)) {
     $categoryseotitle = $catinfo->seotitle;
 }
 if (empty($categoryseokeywords)) {
     $categoryseokeywords = $catinfo->seokeywords;
 }
 if (empty($categoryseodescription)) {
     $categoryseodescription = $catinfo->seodescription;
 }
 if (empty($categoryfilename)) {
     $categoryfilename = date("YmdHis");
 }
 $categoryfilename = str_replace(" ", "-", $categoryfilename);
 $existfilename = $categorydata->ExistFilename($categoryfilename);
 if ($existfilename == 1) {
     if ($categoryfilename != $catinfo->filename) {
         if (strpos($categoryfilename, "http://") !== 0) {
             exit("指定的文件名已经存在");
         }
     }
 }
 $categorytemplets = str_replace("{style}/", "", $categorytemplets);
 $sql = "UPDATE yiqi_category SET name = '{$categoryname}',seotitle='{$categoryseotitle}',seokeywords='{$categoryseokeywords}',seodescription='{$categoryseodescription}',description='{$categorydescription}',filename = '{$categoryfilename}',templets = '{$categorytemplets}',takenumber = '{$categorytakenumber}' WHERE cid = '{$cid}'";
 $result = $yiqi_db->query(CheckSql($sql));
 if ($result == 1) {
     $genehtml = getset("urlrewrite")->value;
     if ($genehtml == "html") {
         $category = $categorydata->GetCategory($cid);
         if (!$tempinfo->template_exists($category->templets)) {
Example #2
0
 function TakeArticleListByName($name = "", $skip = 0, $take = 10, $orderby = "adddate desc", $all = false)
 {
     global $yiqi_db;
     $categorydata = new Category();
     $exist = $categorydata->ExistFilename($name);
     if ($exist == 1) {
         $category = $categorydata->GetCategoryByName($name);
         $cids = array($category->cid);
         $cids = array_merge($cids, $categorydata->GetSubCategoryIDs($category->cid));
         $cids = implode(',', $cids);
         if ($all) {
             return $yiqi_db->get_results(CheckSql("select * from yiqi_article where cid in ({$cids}) order by {$orderby} limit {$skip},{$take} "));
         } else {
             return $yiqi_db->get_results(CheckSql(sprintf("select * from yiqi_article where cid in ({$cids}) and adddate <= '%s' order by {$orderby} limit {$skip},{$take} ", date("Y-m-d H:i:s"))));
         }
     } else {
         if ($all) {
             return $yiqi_db->get_results(CheckSql("select * from yiqi_article order by {$orderby} limit {$skip},{$take}"));
         } else {
             return $yiqi_db->get_results(CheckSql(sprintf("select * from yiqi_article where adddate <= '%s' order by {$orderby} limit {$skip},{$take}", date("Y-m-d H:i:s"))));
         }
     }
 }