コード例 #1
0
ファイル: tool.func.php プロジェクト: pan289091315/Discuz
function updatesubcatid($upid = 0, $type = null)
{
    global $_G, $_SGLOBAL;
    $typequery = $type != null ? ' AND type = \'' . $type . '\'' : '';
    $topquery = NULL;
    $topcat = array();
    $topquery = DB::query('SELECT catid FROM ' . tname('categories') . ' WHERE  upid=\'' . $upid . '\' ' . $typequery . ' ORDER BY catid;');
    while ($topcat = DB::fetch($topquery)) {
        $subquery = NULL;
        $subcats = $subcat = array();
        $subcatstr = '';
        $subcats[$topcat['catid']] = $topcat['catid'];
        $subquery = DB::query('SELECT catid FROM ' . tname('categories') . ' WHERE upid=\'' . $topcat['catid'] . '\' ' . $typequery . ' ORDER BY catid;');
        while ($subcat = DB::fetch($subquery)) {
            $subcats[$subcat['catid']] = $subcat['catid'];
        }
        $subcatstr = implode(', ', $subcats);
        if (!$subcatstr) {
            $subcatstr = $topcat['catid'];
        }
        DB::query('UPDATE ' . tname('categories') . ' SET subcatid=\'' . $subcatstr . '\' WHERE catid=\'' . $topcat['catid'] . '\' LIMIT 1;');
        updatesubcatid($topcat['catid']);
        //遞歸處理所有子分類
    }
    return 'message_success';
}
コード例 #2
0
ファイル: category.inc.php プロジェクト: pan289091315/Discuz
    include_once B_ROOT . './source/function/cache.func.php';
    updatecategorycache();
    header('Location: admin.php?action=category&type=' . $type);
} elseif (!empty($_POST['listsubmit'])) {
    //提交了數據
    $item = array();
    foreach ($_POST['display'] as $key => $value) {
        $query = '';
        $key = intval($key);
        $value = intval($value);
        if ($key > 0) {
            $query = 'UPDATE ' . tname('categories') . ' SET displayorder=\'' . $value . '\' WHERE catid=\'' . $key . '\'; ';
            DB::query($query);
        }
    }
    updatesubcatid();
    //更新子分類關係
    include_once B_ROOT . './source/function/cache.func.php';
    updatecategorycache();
    header('Location: admin.php?action=category&type=' . $type);
} elseif ($_GET['op'] == 'add' || $_GET['op'] == 'edit') {
    //添加或更改分類的編輯頁面
    shownav('catmanage', 'category_' . $_GET['op']);
    showsubmenu('category_' . $_GET['op']);
    showtips('category_' . $_GET['op'] . '_tips');
    showformheader('category&op=' . $_GET['op'] . '&type=' . $_GET['type']);
    showtableheader('');
    if ($_GET['upid'] > 0) {
        showsetting('category_upname', 'upname', $categorylist[$_GET['upid']]['name'], 'text', true);
    }
    showsetting($_GET['op'] . '_category_name', 'subject', $categorylist[$_GET['catid']]['name'], $_GET['op'] == 'edit' ? 'text' : 'textarea');
コード例 #3
0
ファイル: tool.inc.php プロジェクト: pan289091315/Discuz
 *      [品牌空間] (C)2001-2010 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: tool.inc.php 4337 2010-09-06 04:48:05Z fanshengshuai $
 */
if (!defined('IN_ADMIN')) {
    exit('Acess Denied');
}
@set_time_limit(0);
require_once B_ROOT . './source/adminfunc/tool.func.php';
$checkresults = array();
if (!empty($_GET['operation'])) {
    switch ($_GET['operation']) {
        case 'updatesubcatid':
            shownav('tool', 'tool_updatesubcatid');
            cpmsg(updatesubcatid(), 'admin.php?action=tool&operation=updatecache');
            break;
        case 'updatememberstats':
            shownav('tool', 'tool_updatememberstats');
            cpmsg(updatememberstats(), 'admin.php?action=tool&operation=updatecache');
            break;
        case 'changeallowner':
            shownav('tool', 'tool_updateallowner');
            cpmsg(changeallowner(), 'admin.php?action=tool&operation=updatecache');
            break;
    }
    if ($_GET['operation'] == 'updatecache') {
        $_GET['step'] = max(1, intval($_GET['step']));
        shownav('global', 'tool_updatecache');
        showsubmenu('tool_updatecache', array(array('tool_updatecache', 'tool&operation=updatecache', '1'), array('menu_tool_updatesubcatid', 'tool&operation=updatesubcatid', '0'), array('menu_tool_updatememberstats', 'tool&operation=updatememberstats', '0'), array('menu_tool_changeallowner', 'tool&operation=changeallowner', '0'), array('menu_tool_updateshopitemnum', 'tool&operation=updateshopitemnum', '0')));
        showsubmenusteps('', array(array('tool_updatecache_confirm', $_GET['step'] == 1), array('tool_updatecache_verify', $_GET['step'] == 2), array('tool_updatecache_completed', $_GET['step'] == 3)));