function CollapseCategory()
{
    global $user_info, $sourcedir, $context;
    // Just in case, no need, no need.
    $context['robot_no_index'] = true;
    checkSession('request');
    if (!isset($_GET['sa'])) {
        fatal_lang_error('no_access', false);
    }
    // Check if the input values are correct.
    if (in_array($_REQUEST['sa'], array('expand', 'collapse', 'toggle')) && isset($_REQUEST['c'])) {
        // And collapse/expand/toggle the category.
        require_once $sourcedir . '/Subs-Categories.php';
        collapseCategories(array((int) $_REQUEST['c']), $_REQUEST['sa'], array($user_info['id']));
    }
    // And go back to the board index.
    BoardIndex();
}
Example #2
0
function CollapseCategory()
{
    global $ID_MEMBER, $db_prefix, $sourcedir;
    $_REQUEST['c'] = (int) $_REQUEST['c'];
    // Not very complicated... just make sure the value is there.
    if ($_REQUEST['sa'] == 'collapse') {
        db_query("\n\t\t\tINSERT IGNORE INTO {$db_prefix}collapsed_categories\n\t\t\t\t(ID_CAT, ID_MEMBER)\n\t\t\tVALUES ({$_REQUEST['c']}, {$ID_MEMBER})", __FILE__, __LINE__);
    } elseif ($_REQUEST['sa'] == 'expand') {
        db_query("\n\t\t\tDELETE FROM {$db_prefix}collapsed_categories\n\t\t\tWHERE ID_MEMBER = {$ID_MEMBER}\n\t\t\t\tAND ID_CAT = {$_REQUEST['c']}\n\t\t\tLIMIT 1", __FILE__, __LINE__);
    }
    // And go back to the back to board index.
    require_once $sourcedir . '/BoardIndex.php';
    BoardIndex();
}