Example #1
0
             foreach ($_POST['delete'] as $k => $id) {
                 unset($tSort[$id]);
             }
             $iCMS->cache(false, 'include/syscache', 0, true, false);
             $iCMS->addcache('tag.sort', $tSort, 0);
         }
         foreach ($_POST['name'] as $id => $value) {
             $tSort[] = array('id' => $id, 'name' => $value);
         }
         $iCMS->cache(false, 'include/syscache', 0, true, false);
         $iCMS->addcache('tag.sort', $tSort, 0);
     } elseif ($action == 'html') {
         if ($_POST['id']) {
             foreach ($_POST['id'] as $k => $id) {
                 $id && ($rs = $iCMS->db->getRow("SELECT `name`,`visible` FROM `#iCMS@__tags` WHERE `id` ='{$id}'"));
                 $rs->visible && MakeTagHtm($rs->name);
             }
         }
     } elseif ($action == 'tagedit') {
         if ($_POST['name']) {
             foreach ($_POST['name'] as $id => $value) {
                 $iCMS->db->query("update `#iCMS@__tags` set `name`='{$value}',`sortid`='" . $_POST['sortid'][$id] . "',`updatetime`='" . time() . "' where `id`='{$id}'");
             }
         }
         tags_cache();
     }
     _Header();
     break;
 case 'delsort':
     $id = (int) $_GET['id'];
     $tSort = $iCMS->cache('tag.sort', 'include/syscache', 0, true);
Example #2
0
                 flush();
             }
             _header(__SELF__ . '?do=html&operation=create&action=tag&startid=' . $startid . '&endid=' . $endid . '&g&loop=' . ($loop + 1) . '&i=' . $j . $QUERY_STRING);
         } else {
             redirect("标签更新完毕!", __SELF__ . '?do=html&operation=tag');
         }
     } elseif ($starttime) {
         $s = strtotime($starttime);
         $e = empty($endtime) ? time() + 86400 : strtotime($endtime);
         $rs = $iCMS->db->getArray("SELECT id FROM #iCMS@__tags WHERE `updatetime`>='{$s}' and `updatetime`<='{$e}' and `visible`='1' order by id DESC");
         empty($totle) && ($totle = count($rs));
         $tloop = ceil($totle / $speed);
         if ($loop <= $tloop) {
             $max = $i + $speed > $totle ? $totle : $i + $speed;
             for ($j = $i; $j < $max; $j++) {
                 MakeTagHtm($rs[$j]['id']);
                 echo "标签ID:" . $rs[$j]['id'] . "生成…<span style='color:green;'>√</span><br />";
                 flush();
             }
             _header(__SELF__ . '?do=html&operation=create&action=tag&starttime=' . $starttime . '&endtime=' . $endtime . '&totle=' . $totle . '&loop=' . ($loop + 1) . '&i=' . $j . $QUERY_STRING);
         } else {
             redirect("标签更新完毕!", __SELF__ . '?do=html&operation=tag');
         }
     } else {
         alert("请选择方式");
     }
 }
 if ($action == 'page') {
     $cids = $_GET['cid'];
     empty($cids) && alert("请选择栏目");
     is_array($cids) && ($cids = implode(",", $cids));
Example #3
0
function MakeTagHtm($tid, $p = 1, $loop = 0, $cpn = 0)
{
    global $iCMS;
    //,$Admin;
    if (!$iCMS->config['ishtm'] || empty($tid) || $iCMS->config['tagrule'] == "php") {
        return false;
    }
    $tags = $iCMS->cache('tags.id', 'include/syscache', 0, true);
    $rs = $tags[$tid];
    $name = $rs['name'];
    if (empty($rs) || $rs['visible'] == "0") {
        return false;
    }
    $tdir = $iCMS->taghtmrule($rs);
    $RootDir = path(iPATH . $iCMS->config['taghtmdir'] . $tdir);
    if ($iCMS->config['tagrule'] == "dir") {
        createdir($RootDir);
        $tfile = '/index';
    } else {
        createdir(path(iPATH . $iCMS->config['taghtmdir']));
    }
    $iCMS->url = path($iCMS->config['url'] . '/' . $iCMS->config['taghtmdir'] . $tdir . $tfile . '_');
    $GLOBALS['page'] = $p;
    $GLOBALS['cpn'] = $cpn;
    $iCMS->mode = 'CreateHtml';
    $htmldate = $iCMS->tag($name);
    $p == 1 && writefile($RootDir . $tfile . $iCMS->config['htmlext'], $htmldate, false);
    writefile($RootDir . $tfile . '_' . $p . $iCMS->config['htmlext'], $htmldate, false);
    $iCMS->pagesize > 0 && $p++;
    empty($loop) && ($loop = ceil($iCMS->pagesize / 25));
    if ($p < $cpn || empty($cpn)) {
        if ($p <= $iCMS->pagesize && $iCMS->pagesize > 0 && $loop == ceil(($iCMS->pagesize - $p) / 25)) {
            MakeTagHtm($tid, &$p, &$loop, $cpn);
        }
        return array('name' => $name, 'page' => $p, 'loop' => $loop, 'pagesize' => $iCMS->pagesize);
    } else {
        return array('name' => $name, 'page' => $p, 'loop' => 0, 'pagesize' => $iCMS->pagesize);
    }
}