public function admin_template($template_name, $vars = array(), $return = FALSE) { checkAdminUser(); if ($return) { $content = $this->view('admin/admin_template/admin_header', $vars, $return); $content .= $this->view('admin/admin_template/admin_sidebar', $vars, $return); $content .= $this->view($template_name, $vars, $return); $content .= $this->view('admin/admin_template/admin_footer', $vars, $return); return $content; } else { $this->view('admin/admin_template/admin_header', $vars); $this->view('admin/admin_template/admin_sidebar', $vars); $this->view($template_name, $vars); $this->view('admin/admin_template/admin_footer', $vars); } }
function isLoguedAsAdmin() { if (isset($_COOKIE['token'])) { $token = $_COOKIE['token']; return checkToken($token) && checkAdminUser($token); } else { return false; } }