Esempio n. 1
0
 function doUpdate()
 {
     include_once iPATH . 'include/forum.class.php';
     if ($_POST['forum']) {
         $forum = new forum();
         $forum->cache();
     }
     if ($_POST['adm']) {
         include_once iPATH . 'admin/advertise.mo.php';
         $rs = iCMS_DB::getArray("SELECT * FROM `#iCMS@__advertise`", OBJECT);
         $_count = count($rs);
         for ($i = 0; $i < $_count; $i++) {
             adm($rs[$i]);
         }
     }
     $_POST['tpl'] && $this->iCMS->clear_compiled_tpl();
     $_POST['iCMS_list'] && FS::rmdir(iPATH . 'cache/list');
     $_POST['iCMS_forum'] && FS::rmdir(iPATH . 'cache/forum');
     $_POST['iCMS_tag'] && FS::rmdir(iPATH . 'cache/tags');
     if ($_POST['iCMS_ALL']) {
         FS::rmdir(iPATH . 'cache/list');
         FS::rmdir(iPATH . 'cache/forum');
         FS::rmdir(iPATH . 'cache/tags');
     }
     $_POST['keywords'] && keywords_cache();
     $_POST['tags'] && tags_cache();
     if ($_POST['model']) {
         include iPATH . 'include/model.class.php';
         model::cache();
     }
     $_POST['field'] && field_cache();
     $_POST['config'] && CreateConfigFile();
     if ($_POST['Re-Article-Count']) {
         $rs = iCMS_DB::getArray("SELECT fid FROM `#iCMS@__forum`");
         $_count = count($rs);
         for ($i = 0; $i < $_count; $i++) {
             $c = iCMS_DB::getValue("SELECT count(*) FROM #iCMS@__article where `fid`='" . $rs[$i]['fid'] . "' LIMIT 1 ");
             iCMS_DB::query("UPDATE `#iCMS@__forum` SET `count` ='{$c}' WHERE `fid` ='" . $rs[$i]['fid'] . "' LIMIT 1 ");
         }
     }
     if ($_POST['Re-Tag-Count']) {
         include_once iPATH . 'include/forum.class.php';
         $rs = iCMS_DB::getArray("SELECT id FROM `#iCMS@__tags`");
         $_count = count($rs);
         for ($i = 0; $i < $_count; $i++) {
             $_count = iCMS_DB::getValue("SELECT count(*) FROM `#iCMS@__taglist` WHERE `tid`='" . $rs[$i]['id'] . "'");
             iCMS_DB::query("UPDATE `#iCMS@__tags` SET `count` = '{$_count}'  WHERE `id` ='" . $rs[$i]['id'] . "'");
             tags_cache($rs[$i]['id']);
         }
     }
     javascript::dialog("执行完毕!", 'url:1');
 }
Esempio n. 2
0
 * @author coolmoo <*****@*****.**>
 */
!defined('iPATH') && exit('What are you doing?');
switch ($operation) {
    case 'post':
        if ($action == 'cache') {
            if ($_POST['catalog']) {
                include_once iPATH . 'include/catalog.class.php';
                $catalog = new catalog();
                $catalog->cache();
            }
            $_POST['tpl'] && $iCMS->clear_compiled_tpl();
            $_POST['keywords'] && keywords_cache();
            $_POST['tags'] && tags_cache();
            $_POST['model'] && model_cache();
            $_POST['field'] && field_cache();
            $_POST['config'] && CreateConfigFile();
            if ($_POST['Re-Statistics']) {
                $rs = $iCMS->db->getArray("SELECT id FROM `#iCMS@__catalog` ORDER BY `id` DESC");
                $_count = count($rs);
                for ($i = 0; $i < $_count; $i++) {
                    $c = $iCMS->db->getValue("SELECT count(*) FROM #iCMS@__article where `cid`='" . $rs[$i]['id'] . "' LIMIT 1 ");
                    $iCMS->db->query("UPDATE `#iCMS@__catalog` SET `count` ='{$c}' WHERE `id` ='" . $rs[$i]['id'] . "' LIMIT 1 ");
                }
            }
            redirect("执行完毕!", __SELF__ . '?do=cache');
        }
        break;
    default:
        $Admin->MP("menu_cache");
        include iCMS_admincp_tpl("cache");
Esempio n. 3
0
                        $fArray = explode(',', $mArray[$i]['field']);
                        if (in_array($oField['field'], $fArray)) {
                            $table = $mArray[$i]['table'] . '_content';
                            $sql = "alter table `#iCMS@__{$table}` change `{$oField['field']}` `{$field}` ";
                            $len = $type == "number" ? $_POST['rules']['number']['maxnum'] : $_POST['rules'][$type]['maxlength'];
                            $sql .= getSqlType($type, $len, $default);
                            $fKey = array_search($oField['field'], $fArray);
                            $fArray[$fKey] = $field;
                            $mField = implode(',', $fArray);
                            $sql && $iCMS->db->query($sql);
                            $iCMS->db->query("update `#iCMS@__model` SET `field`='{$mField}' where id='" . $mArray[$i]['id'] . "'");
                        }
                    }
                }
                $iCMS->db->update('field', compact('name', 'field', 'description', 'mid', 'type', 'default', 'validate', 'hidden', 'rules'), compact('id'));
                field_cache();
                redirect("字段编辑完成!", __SELF__ . "?do=field&operation=manage", '3');
            }
        }
        break;
    default:
        $id = (int) $_GET['mid'];
        $SystemField = getSystemField();
        $maxperpage = 20;
        $total = $iCMS->db->getValue("SELECT count(*) FROM `#iCMS@__field` order by id DESC");
        page($total, $maxperpage, "个字段");
        $rs = $iCMS->db->getArray("SELECT * FROM `#iCMS@__field` order by id DESC LIMIT {$firstcount},{$maxperpage}");
        $_count = count($rs);
        $model = $iCMS->cache('model.id', 'include/syscache', 0, true);
        include iCMS_admincp_tpl("field.manage");
}