+ $data = array();
+
+ $rows = db_get_assocs('cms_pages', 'id,coalesce(nullif(nav_title,""), title) as title,filename', 'order by coalesce(nullif(nav_title,""), title), filename limit 2000');
+ $have_home_page = false;
+ if (count($rows) !== 0) {
+ $data['rows'] = $rows;
+ foreach ($rows as &$row) {
+ if ($row['filename'] === 'index') {
+ $have_home_page = true;
+ break;
+ }
+ } unset($row);
+ }
+ if ($have_home_page === false) {
+ $data['no_home'] = true;
+ }
+ tem_set('listing', $data);
+}
+
+function admin_pages_main_page_history ($id) {
+ $data = array();
+
+ $rows = db_get_assocs('history_cms_pages left join users on history_cms_pages.history_user_id = users.id', 'history_cms_pages.id as page_id,history_cms_pages.history_id,history_cms_pages.filename,coalesce(nullif(history_cms_pages.nav_title,""), history_cms_pages.title) as title,history_when as timestamp,coalesce(nullif(users.name,""), users.username) as who', 'where history_cms_pages.id=%i order by history_id desc', $id);
+ if (count($rows) !== 0) {
+ $data['title'] = $rows[0]['title'];
+ $rows[0]['first'] = true;
+ if ($rows[0]['filename'] === 'index') {
+ $rows[0]['filename'] = './';
+ }
+ $data['rows'] = $rows;
+ }
+ tem_set('page_history', $data);
+}
+
+function admin_pages_main_history ($id) {
+ $cms_page = db_get_assoc('history_cms_pages', 'id,title,keywords,description,layout,content,sidebar_content', 'where history_id=%"', $id);
+ if (!$cms_page) {
+ message("Error 9393 please inform developer");
+ return './admin_pages';
+ }
+ message('You are viewing an archived version of this page. To publish this version (revert the page) click the "Edit this page" link at the top, then the "save" at the bottom of the editor page. Feel free to make changes before saving.');
+ cms_display_content($GLOBALS['wfpl_main_template'], $cms_page);
+ $GLOBALS['wfpl_main_template']->data['$admin_links']['$edit_page_id'] = null;
+ $GLOBALS['wfpl_main_template']->data['$admin_links']['$edit_page_history_id'] = $id;