auth(); $inc->template(); $inc->hotpage(); // Check to see if the person is not logged in $GLOBALS['auth']->check_logout(); // Define the three sets of links in the template if ($GLOBALS['auth']->admin()) { $GLOBALS['template']->links('conf', 'conf'); } else { header('Location: '.$GLOBALS['conf']['url'].'/admin/index.php'); } $GLOBALS['template']->assign('links_main', array( array('title' => $GLOBALS['lang']['view_all'], 'url' => $GLOBALS['conf']['url'].'/admin/hotpages.php?view'), array('title' => $GLOBALS['lang']['add'], 'url' => $GLOBALS['conf']['url'].'/admin/hotpages.php?add') )); if (isset($_GET['add'])) { $GLOBALS['template']->assign('action', 'add'); } elseif (isset($_POST['add'])) { $GLOBALS['template']->assign('action', 'added'); $GLOBALS['hotpage']->insert(addslashes($_POST['page'])); } elseif (isset($_GET['edit'])) { $GLOBALS['template']->assign('action', 'edit'); $GLOBALS['template']->assign('hotpage', $GLOBALS['hotpage']->get(addslashes($_GET['id']))); } elseif (isset($_POST['edit'])) { $GLOBALS['template']->assign('action', 'edited'); $GLOBALS['hotpage']->update(addslashes($_POST['id']), addslashes($_POST['page'])); } elseif (isset($_POST['delete'])) { $GLOBALS['template']->assign('action', 'delete'); foreach ($_POST as $key => $val) { if ($key == $val && is_numeric($val)) { $GLOBALS['hotpage']->delete($val); } } $GLOBALS['template']->assign('hotpages', $GLOBALS['hotpage']->listall()); } else { $GLOBALS['template']->assign('action', 'view'); $GLOBALS['template']->assign('hotpages', $GLOBALS['hotpage']->listall()); } // Assign the page's title and the content template that needs to be used $GLOBALS['template']->assign('title', $GLOBALS['lang']['hot_pages']); $GLOBALS['template']->assign('content', 'admin_hotpages.tpl'); // Include the javascript files $GLOBALS['template']->assign('javascript', 'misc'); // Display the output $GLOBALS['template']->display('admin.tpl'); // do events that need to be done at the end of the file $inc->finished(); ?>