function check_login_standard() { global $current_user, $current_user_acl, $url_string; try { $cookie = new Cookie(); $cookie->validate(); $userT = new User($db); $current_user = $userT->get_user($cookie->userauth()); $current_user_acl = $current_user->getACL(); session_id($cookie->session_id()); session_start(); } catch (Exception $e) { if (!($e instanceof Exception_Cookie || $e instanceof Exception_User)) { throw $e; } $q = hash2params(array('originating_uri' => $url_string)); header('Location: ' . CONFIG::get('APPURL') . 'app/c/login.php?' . $q); exit; } }
function makeListPageParams($total, $id, $max4page = 10) { $max4page = (int) $max4page; if (!$max4page) { $max4page = 10; } $page = (int) $_GET[$id]; $sort = $_GET["s_{$id}"]; $page = max(array($page, 1)); $orderBy = ''; if ($sort) { $criteria = split("_", $sort); $orderBy = $criteria[0] . " " . strtoupper($criteria[1]); } $href = $_GET; unset($href[$id]); $href = hash2params($href); $href = '?' . $href . ($href ? '&' : '') . $id . '='; $pages = ceil($total / $max4page); $params = array('start' => ($page - 1) * $max4page, 'count' => $max4page, 'order_by' => $orderBy, 'page' => $page, 'pages' => $pages, 'total' => $total, 'href' => $href); return $params; }
function add_params($url, $hash) { if (strpos($url, '?') === false) { return $url . '?' . hash2params($hash); } else { return $url . '&' . hash2params($hash); } }