function toggle_generator_status() { $current = get_generator_status(); switch ($current['status']) { case 'enabled': set_generator_status('disabled'); break; case 'disabled': set_generator_status('enabled'); break; } return get_generator_status(); }
<?php require_once 'lib/header.php'; require_once 'lib/lib_generator.php'; $action = isset($_GET['act']) ? $_GET['act'] : ''; $current = get_generator_status(); $smarty->assign('status', $current['status']); $smarty->assign('since', $current['since']); $smarty->assign('tag', $current['tag']); $smarty->assign('next', $current['next']); switch ($action) { case 'toggle': $new = toggle_generator_status(); $smarty->assign('status', $new['status']); $smarty->assign('since', $new['since']); $smarty->assign('tag', $new['tag']); $smarty->assign('next', $new['next']); break; } $smarty->display('generator_cp.tpl'); log_timing();