form = "wmform"; $pst->page = "wmessage.php?create"; $pst->id = "admin_wmessage"; require_once("auth.php"); $pst->save_preset(); // save and render result require_once(e_HANDLER.'form_handler.php'); require_once(e_HANDLER.'userclass_class.php'); require_once(e_HANDLER."ren_help.php"); $rs = new form; if (e_QUERY) { $tmp = explode('.', e_QUERY); $action = $tmp[0]; $sub_action = $tmp[1]; $id = $tmp[2]; unset($tmp); } if($_POST) { $e107cache->clear("wmessage"); } if (isset($_POST['wm_update'])) { $data = $tp->toDB($_POST['data']); $wm_title = $tp->toDB($_POST['wm_caption']); $message = ($sql->db_Update("generic", "gen_chardata ='$data',gen_ip ='$wm_title', gen_intdata='".$_POST['wm_active']."' WHERE gen_id='".$_POST['wm_id']."' ")) ? LAN_UPDATED : LAN_UPDATED_FAILED; } if (isset($_POST['wm_insert'])) { $wmtext = $tp->toDB($_POST['data']); $wmtitle = $tp->toDB($_POST['wm_caption']); $message = ($sql->db_Insert("generic", "0, 'wmessage', '".time()."', ".USERID.", '{$wmtitle}', '{$_POST['wm_active']}', '{$wmtext}' ")) ? LAN_CREATED : LAN_CREATED_FAILED ; } if (isset($_POST['updateoptions'])) { $pref['wm_enclose'] = $_POST['wm_enclose']; $pref['wmessage_sc'] = $_POST['wmessage_sc']; save_prefs(); $message = LAN_SETSAVED; } if (isset($_POST['main_delete'])) { $del_id = array_keys($_POST['main_delete']); $message = ($sql->db_Delete("generic", "gen_id='".$del_id[0]."' ")) ? LAN_DELETED : LAN_DELETED_FAILED ; } if (isset($message)) { $ns->tablerender("", "
".$message."
"); } // Show Existing ------- if ($action == "main" || $action == "") { if ($wm_total = $sql->db_Select("generic", "*", "gen_type='wmessage' ORDER BY gen_id ASC")) { $wmList = $sql->db_getList(); $text = $rs->form_open("post", e_SELF, "myform_{$gen_id}", "", ""); $text .= "
"; foreach($wmList as $row) { $text .= " "; } $text .= "
ID ".WMLAN_02." ".WMLAN_03." ".LAN_OPTIONS."
".$row['gen_id']." ".strip_tags($tp->toHTML($row['gen_ip']))." ".r_userclass_name($row['gen_intdata'])." ".ADMIN_EDIT_ICON."
"; $text .= $rs->form_close(); } else { $text .= "
".WMLAN_09."
"; } $ns->tablerender(WMLAN_00, $text); } // Create and Edit if ($action == "create" || $action == "edit") { if ($sub_action == "edit") { $sql->db_Select("generic", "gen_intdata, gen_ip, gen_chardata", "gen_id = $id"); $row = $sql->db_Fetch(); } if ($sub_action != 'edit') { $preset = $pst->read_preset("admin_wmessage"); extract($preset); } $text = "
"; $text .= " "; $text .= ""; $text .= "
".WMLAN_10." toForm($row['gen_ip'])."\" />
".WMLAN_04."
"; $text .= display_help("helpb", "admin"); $text .= "
".WMLAN_03." ".r_userclass("wm_active", $row['gen_intdata'], "off", "public,guest,nobody,member,admin,classes")."
"; $text .= ($sub_action == "edit") ? "" : "" ; $text .= ""; $text .= "
"; $ns->tablerender(WMLAN_01, $text); } if ($action == "opt") { global $pref, $ns; $text = "
\n
".WMLAN_05."
".WMLAN_06."
". ($pref['wm_enclose'] ? "" : "")."
".WMLAN_07." ". ($pref['wmessage_sc'] ? "" : "")."
"; $ns->tablerender(WMLAN_00.": ".LAN_PREFS, $text); } function wmessage_adminmenu() { global $action; if ($action == "") { $action = "main"; } $var['main']['text'] = WMLAN_00; $var['main']['link'] = e_SELF; $var['create']['text'] = WMLAN_01; $var['create']['link'] = e_SELF."?create"; $var['opt']['text'] = LAN_PREFS; $var['opt']['link'] = e_SELF."?opt"; show_admin_menu(LAN_OPTIONS, $action, $var); } require_once("footer.php"); ?>