mySQLlanguage) ? $sql->mySQLlanguage : $pref['sitelanguage']; if (e_QUERY) { $tmp = explode(".", e_QUERY); $action = $tmp[0]; $sub_action = $tmp[1]; $id = $tmp[2]; $from = ($tmp[3] ? $tmp[3] : 0); } if(isset($_POST['submitPage'])) { $page -> submitPage(); } if(isset($_POST['submitMenu'])) { $page -> submitPage("", TRUE); } if(isset($_POST['updateMenu'])) { $page -> submitPage($_POST['pe_id'], TRUE); } if(isset($_POST['updatePage'])) { $page -> submitPage($_POST['pe_id']); } if(isset($_POST['delete'])) { foreach(array_keys($_POST['delete']) as $pid) { $page -> delete_page($pid); } } if (isset($_POST['saveOptions'])) { $page -> saveSettings(); } if($page->message) { $ns->tablerender("", "
".$page->message."
"); } if(!e_QUERY) { $page -> showExistingPages(); } else { $function = $action."Page"; $page -> $function(); } require_once(e_ADMIN."footer.php"); class page { var $message; function showExistingPages() { global $sql, $tp, $ns; $text = "
"; if(!$sql -> db_Select("page", "*", "ORDER BY page_datestamp DESC", "nowhere")) { $text .= CUSLAN_42; } else { $pages = $sql -> db_getList('ALL', FALSE, FALSE); $text .= "
"; foreach($pages as $pge) { $text .= " "; } $text .= "
ID ".CUSLAN_1." ".CUSLAN_2." ".CUSLAN_3."
$pge[page_id] $pge[page_title] ".($pge[page_theme] ? "menu" : "page")." ".ADMIN_EDIT_ICON."
"; } $text .= "
"; $ns -> tablerender(CUSLAN_5, $text); } function createmPage() { $this -> createPage(TRUE); } function createPage($mode=FALSE) { /* mode: FALSE == page, mode: TRUE == menu */ global $sql, $tp, $ns, $pref, $sub_action, $id; if ($sub_action == "edit" && !$_POST['preview'] && !$_POST['submit']) { if ($sql->db_Select("page", "*", "page_id='$id' ")) { $row = $sql->db_Fetch(); $page_class = $row['page_class']; $page_password = $row['page_password']; $page_title = $tp -> toFORM($row['page_title']); $page_rating_flag = $row['page_rating_flag']; $page_comment_flag = $row['page_comment_flag']; $page_display_authordate_flag = $row['page_author']; $data = $tp -> toFORM($row['page_text']); $edit = TRUE; } if ($sql -> db_Select("links", "*", "link_url='page.php?".$id."'")) { $row = $sql -> db_Fetch(); $page_link = $row['link_name']; } } $text = "
"; if($mode) { $text .= ""; } $text .= ""; if(!$mode) { $text .= ""; } $text .= "
".CUSLAN_7." "; if($edit) { $text .= $page_theme; } else { $text .= ""; } $text .= "
".CUSLAN_8."
".CUSLAN_9." "; $insertjs = (!$pref['wysiwyg'])?"rows='15' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'": "rows='25' style='width:100%' "; $data = $tp->toForm($data); $text .= ""; if (!$pref['wysiwyg']) { $text .= "
".display_help("helpb"); } $text .= "
".CUSLAN_10." ".CUSLAN_38."   ".CUSLAN_39."
".CUSLAN_13." ".CUSLAN_38."   ".CUSLAN_39."
".CUSLAN_41." ".CUSLAN_38."   ".CUSLAN_39."
".CUSLAN_14."
".CUSLAN_15."
".CUSLAN_16."
".CUSLAN_17."
".CUSLAN_18." ".r_userclass("page_class", $page_class)."
". (!$mode ? ($edit ? "" : "") : ($edit ? "" : "")) ."
"; $caption =(!$mode ? ($edit ? CUSLAN_23 : CUSLAN_24) : ($edit ? CUSLAN_25 : CUSLAN_26)); $ns -> tablerender($caption, $text); } function submitPage($mode = FALSE, $type=FALSE) { global $sql, $tp, $e107cache; $page_title = $tp -> toDB($_POST['page_title']); $page_text = $tp -> toDB($_POST['data']); $pauthor = ($_POST['page_display_authordate_flag'] ? USERID : 0); if($mode) { $update = $sql -> db_Update("page", "page_title='$page_title', page_text='$page_text', page_author='$pauthor', page_rating_flag='".intval($_POST['page_rating_flag'])."', page_comment_flag='".intval($_POST['page_comment_flag'])."', page_password='".$_POST['page_password']."', page_class='".$_POST['page_class']."', page_ip_restrict='".$_POST['page_ip_restrict']."' WHERE page_id='$mode'"); $e107cache->clear("page_{$mode}"); $e107cache->clear("page-t_{$mode}"); if ($_POST['page_link']) { if ($sql -> db_Select("links", "link_id", "link_url='page.php?".$mode."' && link_name!='".$tp -> toDB($_POST['page_link'])."'")) { $sql -> db_Update("links", "link_name='".$tp -> toDB($_POST['page_link'])."' WHERE link_url='page.php?".$mode."'"); $update++; $e107cache->clear("sitelinks"); } else if (!$sql -> db_Select("links", "link_id", "link_url='page.php?".$mode."'")) { $sql -> db_Insert("links", "0, '".$tp -> toDB($_POST['page_link'])."', 'page.php?".$mode."', '', '', 1, 0, 0, 0, ".$_POST['page_class']); $update++; $e107cache->clear("sitelinks"); } } else { if ($sql -> db_Select("links", "link_id", "link_url='page.php?".$mode."'")) { $sql -> db_Delete("links", "link_url='page.php?".$mode."'"); $update++; $e107cache->clear("sitelinks"); } } admin_update($update, 'update', "Page updated in database."); } else { $menuname = ($type ? $tp -> toDB($_POST['menu_name']) : ""); admin_update($sql -> db_Insert("page", "0, '$page_title', '$page_text', '$pauthor', '".time()."', '".intval($_POST['page_rating_flag'])."', '".intval($_POST['page_comment_flag'])."', '".$_POST['page_password']."', '".$_POST['page_class']."', '', '".$menuname."'"), 'insert', CUSLAN_27); if($type) { $sql -> db_Insert("menus", "0, '$menuname', '0', '0', '0', '', '".mysql_insert_id()."' "); } if($_POST['page_link']) { $link = "page.php?".mysql_insert_id(); if (!$sql->db_Select("links", "link_id", "link_name='".$tp -> toDB($_POST['page_link'])."'")) { $linkname = $tp -> toDB($_POST['page_link']); $sql->db_Insert("links", "0, '$linkname', '$link', '', '', 1, 0, 0, 0, ".$_POST['page_class']); $e107cache->clear("sitelinks"); } } } } function delete_page($del_id) { global $sql, $e107cache; admin_update($sql -> db_Delete("page", "page_id='$del_id' "), 'delete', CUSLAN_28); $sql -> db_Delete("menus", "menu_path='$del_id' "); if ($sql -> db_Select("links", "link_id", "link_url='page.php?".$del_id."'")) { $sql -> db_Delete("links", "link_url='page.php?".$del_id."'"); $e107cache->clear("sitelinks"); } } function optionsPage() { global $ns, $pref; if(!isset($pref['pageCookieExpire'])) $pref['pageCookieExpire'] = 84600; $text = "
".CUSLAN_29." ".CUSLAN_38."   ".CUSLAN_39."
".CUSLAN_30."
"; $ns->tablerender("Options", $text); } function saveSettings() { global $pref; $pref['listPages'] = $_POST['listPages']; $pref['pageCookieExpire'] = $_POST['pageCookieExpire']; save_prefs(); $this -> message = "Settings saved."; } function show_options($action) { if ($action == "") { $action = "main"; } $var['main']['text'] = CUSLAN_11; $var['main']['link'] = e_SELF; $var['create']['text'] = CUSLAN_12; $var['create']['link'] = e_SELF."?create"; $var['createm']['text'] = CUSLAN_31; $var['createm']['link'] = e_SELF."?createm"; $var['options']['text'] = LAN_OPTIONS; $var['options']['link'] = e_SELF."?options"; show_admin_menu(CUSLAN_33, $action, $var); } } function cpage_adminmenu() { global $page; global $action; $page -> show_options($action); } ?>