} // some additional security checks: // Check whether the section_id belongs to the page_id at all if (!is_numeric($section_id)) { $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL); } elseif ($section_id > 0) { $section = $admin->get_section_details($section_id, ADMIN_URL . '/pages/index.php'); if (!$admin->get_permission($section['module'], 'module')) { $admin->print_error($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS'], ADMIN_URL); } } // Workout if the developer wants to show the info banner if (isset($print_info_banner) && $print_info_banner == true) { // Get page details already defined // Get display name of person who last modified the page $user = $admin->get_user_details($page['modified_by']); // Convert the unix ts for modified_when to human a readable form $modified_ts = 'Unknown'; if ($page['modified_when'] != 0) { $modified_ts = gmdate(TIME_FORMAT . ', ' . DATE_FORMAT, $page['modified_when'] + TIMEZONE); } // Setup template object, parse vars to it, then parse it // Create new template object $template = new Template(dirname($admin->correct_theme_source('pages_modify.htt'))); // $template->debug = true; $template->set_file('page', 'pages_modify.htt'); $template->set_block('page', 'main_block', 'main'); $template->set_block('main_block', 'section_block', 'section_list'); $template->set_block('section_block', 'block_block', 'block_list'); $template->set_var(array('PAGE_ID' => $page['page_id'], 'PAGE_IDKEY' => $page['page_id'], 'PAGE_TITLE' => $page['page_title'], 'MENU_TITLE' => $page['menu_title'], 'ADMIN_URL' => ADMIN_URL, 'WB_URL' => WB_URL, 'THEME_URL' => THEME_URL)); $template->set_var(array('MODIFIED_BY' => $user['display_name'], 'MODIFIED_BY_USERNAME' => $user['username'], 'MODIFIED_WHEN' => $modified_ts, 'LAST_MODIFIED' => $MESSAGE['PAGES_LAST_MODIFIED']));
header("Location: index.php"); exit(0); } else { $page_id = $_GET['page_id']; } require_once LEPTON_PATH . '/framework/class.admin.php'; $admin = new admin('Pages', 'pages_modify'); // Get perms if (!$admin->get_page_permission($page_id, 'admin')) { $admin->print_error($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS']); } $sectionId = isset($_GET['wysiwyg']) ? htmlspecialchars($admin->get_get('wysiwyg')) : NULL; // Get page details $results_array = $admin->get_page_details($page_id); // Get display name of person who last modified the page $user = $admin->get_user_details($results_array['modified_by']); // Convert the unix ts for modified_when to human a readable form $modified_ts = $results_array['modified_when'] != 0 ? $modified_ts = date(TIME_FORMAT . ', ' . DATE_FORMAT, $results_array['modified_when']) : 'Unknown'; // Include page info script $template = new Template(THEME_PATH . '/templates'); $template->set_file('page', 'pages_modify.htt'); $template->set_block('page', 'main_block', 'main'); $template->set_var(array('PAGE_ID' => $results_array['page_id'], 'PAGE_TITLE' => $results_array['page_title'], 'MENU_TITLE' => $results_array['menu_title'], 'ADMIN_URL' => ADMIN_URL, 'LEPTON_URL' => LEPTON_URL, 'LEPTON_PATH' => LEPTON_PATH, 'THEME_URL' => THEME_URL)); $template->set_var(array('MODIFIED_BY' => $user['display_name'], 'MODIFIED_BY_USERNAME' => $user['username'], 'MODIFIED_WHEN' => $modified_ts, 'LAST_MODIFIED' => $MESSAGE['PAGES_LAST_MODIFIED'])); $template->set_block('main_block', 'show_modify_block', 'show_modify'); if ($modified_ts == 'Unknown') { $template->set_block('show_modify', ''); $template->set_var('CLASS_DISPLAY_MODIFIED', 'hide'); } else { $template->set_var('CLASS_DISPLAY_MODIFIED', ''); $template->parse('show_modify', 'show_modify_block', true);
// $database = new database(); not needed $sql = 'SELECT `page_id`,`page_title`,`modified_by`,`modified_when` FROM `' . TABLE_PREFIX . 'pages` '; $sql .= 'WHERE `page_id` = ' . intval($page_id); $res_pages = $database->query($sql); if ($database->is_error()) { // $admin->print_header(); don't know why $admin->print_error($database->get_error()); } if ($res_pages->numRows() == 0) { // $admin->print_header(); don't know why $admin->print_error($MESSAGE['PAGES']['NOT_FOUND']); } else { $rec_pages = $res_pages->fetchRow(); } // Get display name of person who last modified the page $user = $admin->get_user_details($rec_pages['modified_by']); // Convert the unix ts for modified_when to human a readable form if ($rec_pages['modified_when'] != 0) { $modified_ts = date(TIME_FORMAT . ', ' . DATE_FORMAT, $rec_pages['modified_when']); } else { $modified_ts = 'Unknown'; } // Include page info script $template = new Template(THEME_PATH . '/templates'); $template->set_file('page', 'pages_modify.htt'); $template->set_block('page', 'main_block', 'main'); $template->set_var(array('PAGE_ID' => $rec_pages['page_id'], 'PAGE_TITLE' => $rec_pages['page_title'], 'MODIFIED_BY' => $user['display_name'], 'MODIFIED_BY_USERNAME' => $user['username'], 'MODIFIED_WHEN' => $modified_ts, 'ADMIN_URL' => ADMIN_URL)); $template->set_block('main_block', 'show_modify_block', 'show_modify'); if ($modified_ts == 'Unknown') { $template->set_block('show_modify', ''); $template->set_var('CLASS_DISPLAY_MODIFIED', 'hide');