Beispiel #1
0
 function select($currentid = "0", $fid = "0", $level = 1, $attr = NULL, $mid = NULL, $url = NULL)
 {
     foreach ((array) $this->_array[$fid] as $root => $F) {
         if ($F['modelid'] == $mid || $mid === NULL) {
             if (Admin::CP($F['fid'])) {
                 $t = $level == '1' ? "" : "├ ";
                 $selected = $currentid == $F['fid'] ? "selected='selected'" : "";
                 $text = str_repeat("│ ", $level - 1) . $t . $F['name'] . "[FID:{$F['fid']}]";
                 if (empty($F['url'])) {
                     if ($attr === NULL) {
                         if ($F['attr']) {
                             $option .= "<option value='{$F['fid']}' {$selected}>{$text}</option>";
                         } else {
                             $option .= "<optgroup label=\"{$text}\"></optgroup>";
                         }
                     } elseif ($attr == 'all') {
                         $option .= "<option value='{$F['fid']}' {$selected}>{$text}</option>";
                     } else {
                         $attr == $F['attr'] && ($option .= "<option value='{$F['fid']}' {$selected}>{$text}</option>");
                     }
                 } else {
                     if ($url) {
                         $option .= "<option value='{$F['fid']}' {$selected}>{$text}</option>";
                     } else {
                         $option .= "<optgroup label=\"{$text}\"></optgroup>";
                     }
                 }
             }
             $option .= $this->select($currentid, $F['fid'], $level + 1, $attr, $mid);
         }
     }
     return $option;
 }
Beispiel #2
0
=forums" id="cpform" target="iCMS_FRAME">
  <input name="do" type="hidden" id="do" value="save" />
  <input name="fid" type="hidden" value="<?php 
echo $rs['fid'];
?>
" />
  <table class="adminlist" border="0" cellspacing="0" cellpadding="0">
    <thead>
      <tr>
        <th colspan="3">基本设置</th>
      </tr>
    </thead>
    <tr>
      <td class="td80">上级版块:</td>
      <td class="vtop rowform"><?php 
if (Admin::CP($rootid) || empty($rootid)) {
    ?>
        <select name="rootid">
          <option value="0">======顶级版块=====</option>
          <?php 
    echo $forum->select($rootid, 0, 1, NULL, NULL, true);
    ?>
        </select>
        <?php 
} else {
    ?>
        <input name="rootid" id="rootid" type="hidden" value="<?php 
    echo $rootid;
    ?>
" />
        <input readonly="true" value="<?php 
Beispiel #3
0
 function dolist()
 {
     $id = (int) $_GET['id'];
     $fid = (int) $_GET['fid'];
     $tagName = iCMS_DB::getValue("SELECT name FROM #iCMS@__tags WHERE id='{$id}'");
     $forum = new forum();
     $sql = '#iCMS@__article.id = `indexId`';
     $_GET['keywords'] && ($sql .= " AND `title` REGEXP '{$_GET['keywords']}'");
     isset($_GET['nopic']) && ($sql .= " AND `isPic` ='0'");
     $_GET['starttime'] && ($sql .= " and `pubdate`>='" . strtotime($_GET['starttime']) . "'");
     $_GET['endtime'] && ($sql .= " and `pubdate`<='" . strtotime($_GET['endtime']) . "'");
     isset($_GET['at']) && $_GET['at'] != '-1' && ($sql .= " AND `type` ='" . $_GET['at'] . "'");
     isset($_GET['keyword']) && ($uri .= '&keyword=' . $_GET['keyword']);
     $fid = Admin::CP($fid) ? $fid : "0";
     if ($fid) {
         $cidIN = $forum->fid($fid) . $fid;
         if (isset($_GET['sub']) && strstr($cidIN, ',')) {
             $sql .= " AND fid IN(" . $cidIN . ")";
         } else {
             $sql .= " AND fid ='{$fid}'";
         }
     } else {
         Admin::$cpower && ($sql .= " AND fid IN(" . implode(',', (array) Admin::$cpower) . ")");
     }
     $maxperpage = (int) $_GET['perpage'] > 0 ? $_GET['perpage'] : 20;
     $total = $page == 1 || empty($_GET['rowNum']) ? iCMS_DB::getValue("SELECT count(#iCMS@__article.id) FROM `#iCMS@__article`,`#iCMS@__taglist` WHERE `tid`='" . $id . "' AND {$sql}") : (int) $_GET['rowNum'];
     page($total, $maxperpage, "篇文章");
     $rs = iCMS_DB::getArray("SELECT #iCMS@__article.* FROM `#iCMS@__article`,`#iCMS@__taglist` WHERE `tid`='" . $id . "' AND {$sql} ORDER BY #iCMS@__taglist.indexId DESC LIMIT {$this->firstcount} , {$maxperpage}");
     $_count = count($rs);
     include admincp::tpl('tag.list');
 }
Beispiel #4
0
 function doManage()
 {
     $mtime = microtime();
     $mtime = explode(' ', $mtime);
     $time_start = $mtime[1] + $mtime[0];
     Admin::MP(array("menu_article_manage", "menu_article_draft", "menu_article_user_manage", "menu_article_user_draft"));
     $forum = new forum();
     $fid = (int) $_GET['fid'];
     $type = $_GET['type'];
     $sql = " where ";
     switch ($type) {
         //postype: [0:用户][1:管理员][2:回收] status:[0:隐藏][1:正常]
         case 'draft':
             //草稿
             $sql .= "`status` ='0' AND `postype`='1'";
             $_ptxt = array(0 => '发布', 1 => '转成草稿');
             $position = UI::lang("menu_article_draft");
             break;
         case 'trash':
             //回收站
             $sql .= "`status` ='0' AND `postype`='2'";
             $_ptxt = array(0 => '还原', 1 => '放入回收站');
             $position = UI::lang("menu_article_trash");
             break;
         case 'user':
             //用户
             if ($_GET['act'] == "draft") {
                 $sql .= "`status` ='0'";
                 //用户审核
                 $position = UI::lang("menu_article_user_draft");
             } else {
                 $sql .= "`status` ='1'";
                 $position = UI::lang("menu_article_user_manage");
             }
             $sql .= " AND `postype`='0'";
             $_ptxt = array(0 => '通过审核', 1 => '取消审核');
             break;
         default:
             $sql .= " `status` ='1' AND `postype`='1'";
             $position = '';
             $fid && ($position = $forum->forum[$fid]['name']);
     }
     $position && ($position = "&nbsp;&raquo;&nbsp;" . $position);
     if ($_GET['keywords']) {
         if ($_GET['st'] == "title") {
             $sql .= " AND `title` REGEXP '{$_GET['keywords']}'";
         } else {
             if ($_GET['st'] == "top") {
                 $sql .= " AND `top`='{$_GET['keywords']}'";
             } else {
                 if ($_GET['st'] == "id") {
                     $sql .= " AND `id` REGEXP '{$_GET['keywords']}'";
                 } else {
                     if ($_GET['st'] == "tkd") {
                         $sql .= " AND CONCAT(title,keywords,description) REGEXP '{$_GET['keywords']}'";
                     }
                 }
             }
         }
     }
     $_GET['title'] && ($sql .= " AND `title` like '%{$_GET['title']}%'");
     $_GET['tag'] && ($sql .= " AND `tags` REGEXP '[[:<:]]" . preg_quote(rawurldecode($_GET['tag']), '/') . "[[:>:]]'");
     isset($_GET['at']) && $_GET['at'] != '-1' && ($sql .= " AND `type` ='" . $_GET['at'] . "'");
     isset($_GET['userid']) && ($sql .= " AND `userid`='" . (int) $_GET['userid'] . "'");
     $fid = Admin::CP($fid) ? $fid : "0";
     if ($fid) {
         $fidIN = $forum->fid($fid) . $fid;
         if (isset($_GET['sub']) && strstr($fidIN, ',')) {
             $sql .= " AND fid IN(" . $fidIN . ")";
         } else {
             $sql .= " AND fid ='{$fid}'";
         }
         //$sql.=" OR `vlink` REGEXP '[[:<:]]".preg_quote($fid, '/')."[[:>:]]')";
     } else {
         Admin::$cpower && ($sql .= " AND fid IN(" . implode(',', (array) Admin::$cpower) . ")");
     }
     isset($_GET['nopic']) && ($sql .= " AND `isPic` ='0'");
     $_GET['starttime'] && ($sql .= " and `pubdate`>='" . strtotime($_GET['starttime']) . "'");
     $_GET['endtime'] && ($sql .= " and `pubdate`<='" . strtotime($_GET['endtime']) . "'");
     $act == 'user' && ($uri .= '&act=user');
     $_GET['type'] == 'draft' && ($uri .= '&type=draft');
     isset($_GET['userid']) && ($uri .= '&userid=' . (int) $_GET['userid']);
     isset($_GET['keyword']) && ($uri .= '&keyword=' . $_GET['keyword']);
     isset($_GET['tag']) && ($uri .= '&tag=' . $_GET['tag']);
     $orderby = $_GET['orderby'] ? $_GET['orderby'] : "id DESC";
     $maxperpage = (int) $_GET['perpage'] > 0 ? $_GET['perpage'] : 20;
     $total = $page == 1 || empty($_GET['rowNum']) ? iCMS_DB::getValue("SELECT count(*) FROM `#iCMS@__article` {$sql}") : (int) $_GET['rowNum'];
     page($total, $maxperpage, "篇文章");
     $rs = iCMS_DB::getArray("SELECT * FROM `#iCMS@__article` {$sql} order by {$orderby} LIMIT {$this->firstcount} , {$maxperpage}");
     //echo iCMS_DB::$last_query;
     //iCMS_DB::last_query='explain '.iCMS_DB::$last_query;
     //$explain=iCMS_DB::getRow(iCMS_DB::last_query);
     //var_dump($explain);
     $_count = count($rs);
     include admincp::tpl("article.manage");
     //		$mtime = microtime();
     //		$mtime = explode(' ', $mtime);
     //		$time_end = $mtime[1] + $mtime[0];
     //		echo  "<h1>".($time_end - $time_start);
 }
Beispiel #5
0
 function doarticle()
 {
     include iPATH . 'include/forum.class.php';
     $forum = new forum();
     $callback = $_GET['callback'];
     $fid = (int) $_GET['fid'];
     $sql = " where ";
     $sql .= $_GET['type'] == 'draft' ? "`status` ='0'" : "`status` ='1'";
     $sql .= $act == 'user' ? " AND `postype`='0'" : " AND `postype`='1'";
     $_GET['keywords'] && ($sql .= " AND CONCAT(title,keywords,description) REGEXP '{$_GET['keywords']}'");
     $fid = Admin::CP($fid) ? $fid : "0";
     if ($fid) {
         if (isset($_GET['sub'])) {
             $sql .= " AND ( fid IN(" . $forum->fid($fid) . $fid . ")";
         } else {
             $sql .= " AND ( fid ='{$fid}'";
         }
         $sql .= " OR `vlink` REGEXP '[[:<:]]" . preg_quote($fid, '/') . "[[:>:]]')";
     } else {
         Admin::$cpower && ($sql .= " AND fid IN(" . implode(',', Admin::$cpower) . ")");
     }
     isset($_GET['keyword']) && ($uri .= '&keyword=' . $_GET['keyword']);
     $maxperpage = 8;
     $total = $page == 1 || empty($_GET['rowNum']) ? iCMS_DB::getValue("SELECT count(*) FROM `#iCMS@__article` {$sql}") : (int) $_GET['rowNum'];
     page($total, $maxperpage, "篇文章");
     $rs = iCMS_DB::getArray("SELECT * FROM `#iCMS@__article`{$sql} order by id DESC LIMIT {$this->firstcount} , {$maxperpage}");
     $_count = count($rs);
     include admincp::tpl();
 }
Beispiel #6
0
 function doDel()
 {
     $fid = (int) $_GET['fid'];
     Admin::CP($fid, 'Permission_Denied', __SELF__ . '?mo=forums');
     $forum = new forum();
     $msg = '请选择要删除的栏目!';
     if (empty($forum->_array[$id])) {
         iCMS_DB::query("DELETE FROM `#iCMS@__forum` WHERE `fid` = '{$fid}'");
         $this->iCMS->iCache->delete('system/forum/' . $fid);
         $art = iCMS_DB::getArray("SELECT id FROM `#iCMS@__article` WHERE `fid` = '{$fid}'");
         foreach ((array) $art as $a) {
             delArticle($a['fid']);
         }
         $forum = new forum();
         $forum->cache();
         $msg = '删除成功!';
     } else {
         $msg = '请先删除本栏目下的子栏目!';
     }
     javascript::dialog($msg, 'url:' . __SELF__ . '?mo=forums');
 }