/** * Toggles the current state of a block / control * * - calls sp_changeState to toggle the on/off status * - directs back based on type passed * * @param string $type type of control * @param int $id id of the control */ function sportal_admin_state_change($type, $id) { if (!in_array($type, array('block', 'category', 'article'))) { fatal_lang_error('error_sp_id_empty', false); } // Toggle the current state sp_changeState($type, $id); // Based on the type, find our way back if ($type == 'block') { $sides = array(1 => 'left', 2 => 'top', 3 => 'bottom', 4 => 'right'); $list = !empty($_GET['redirect']) && isset($sides[$_GET['redirect']]) ? $sides[$_GET['redirect']] : 'list'; redirectexit('action=admin;area=portalblocks;sa=' . $list); } elseif ($type == 'category') { redirectexit('action=admin;area=portalarticles;sa=categories'); } elseif ($type == 'article') { redirectexit('action=admin;area=portalarticles;sa=articles'); } else { redirectexit('action=admin;area=portalconfig'); } }
/** * Switch the active status (on/off) of a category */ public function action_sportal_admin_category_status() { checkSession('get'); $category_id = !empty($_REQUEST['category_id']) ? (int) $_REQUEST['category_id'] : 0; sp_changeState('category', $category_id); redirectexit('action=admin;area=portalcategories'); }
/** * Toggle an articles status */ public function action_sportal_admin_article_status() { checkSession('get'); $article_id = !empty($_REQUEST['article_id']) ? (int) $_REQUEST['article_id'] : 0; sp_changeState('article', $article_id); redirectexit('action=admin;area=portalarticles'); }
/** * Updates the system status of the shoutout, toggle on/off */ public function action_sportal_admin_shoutbox_status() { checkSession('get'); $shoutbox_id = !empty($_REQUEST['shoutbox_id']) ? (int) $_REQUEST['shoutbox_id'] : 0; sp_changeState('shout', $shoutbox_id); redirectexit('action=admin;area=portalshoutbox'); }