Пример #1
0
 function delete($typeid)
 {
     $typeid = intval($typeid);
     $this->db->query("DELETE FROM {$this->table} WHERE typeid={$typeid} AND item='{$this->item}'");
     if ($this->cache) {
         cache_type($this->item);
     }
 }
Пример #2
0
                 } else {
                     if ($step == 6) {
                         cache_clear('fields');
                         cache_fields();
                         cache_clear('option');
                         msg('自定义字段更新成功', '?action=' . $action . '&step=' . ($step + 1));
                     } else {
                         if ($step == 7) {
                             cache_clear_ad();
                             tohtml('index');
                             msg('全部缓存更新成功');
                         } else {
                             cache_clear('group');
                             cache_group();
                             cache_clear('type');
                             cache_type();
                             cache_clear('keylink');
                             cache_keylink();
                             cache_pay();
                             cache_banip();
                             cache_banword();
                             cache_bancomment();
                             msg('正在开始更新缓存', '?action=' . $action . '&step=' . ($step + 1));
                         }
                     }
                 }
             }
         }
     }
 }
 break;
Пример #3
0
function cache_type($item = '')
{
    global $db;
    if ($item) {
        $types = array();
        $result = $db->query("SELECT typeid,parentid,typename,style FROM {$db->pre}type WHERE item='{$item}' AND cache=1 ORDER BY listorder ASC,typeid DESC");
        while ($r = $db->fetch_array($result)) {
            $types[$r['typeid']] = $r;
        }
        cache_write('type-' . $item . '.php', $types);
        return $types;
    } else {
        $arr = array();
        $result = $db->query("SELECT item FROM {$db->pre}type WHERE item!='' AND cache=1 ORDER BY typeid DESC");
        while ($r = $db->fetch_array($result)) {
            if (!in_array($r['item'], $arr)) {
                $arr[] = $r['item'];
                cache_type($r['item']);
            }
        }
    }
}