diff --git a/e107_plugins/forum/forum_admin.php b/e107_plugins/forum/forum_admin.php index 5df27479f..983071658 100644 --- a/e107_plugins/forum/forum_admin.php +++ b/e107_plugins/forum/forum_admin.php @@ -24,7 +24,7 @@ require_once(e_HANDLER.'userclass_class.php'); require_once(e_HANDLER.'form_handler.php'); require_once(e_HANDLER.'ren_help.php'); // FIXME require_once(e_PLUGIN.'forum/forum_class.php'); -require_once(e_PLUGIN.'forum/forum_admin_class.php'); +// require_once(e_PLUGIN.'forum/forum_admin_class.php'); $mes = e107::getMessage(); $for = new e107forum; @@ -460,4 +460,1157 @@ function forum_admin_adminmenu() global $action; $forum->show_options($action); } + + + + +class forumAdmin +{ + + function show_options($action) + { + + $sql = e107::getDb(); + if ($action == '') { $action = 'main'; } + // ##### Display options --------------------------------------------------------------------------------------------------------- + $var['main']['text'] = FORLAN_76; + $var['main']['link'] = e_SELF; + $var['cat']['text'] = FORLAN_83; + $var['cat']['link'] = e_SELF.'?cat'; + if ($sql->select('forum', 'forum_id', "forum_parent='0' LIMIT 1")) + { + $var['create']['text'] = FORLAN_77; + $var['create']['link'] = e_SELF.'?create'; + } + $var['order']['text'] = FORLAN_78; + $var['order']['link'] = e_SELF.'?order'; + $var['opt']['text'] = FORLAN_79; + $var['opt']['link'] = e_SELF.'?opt'; + $var['prune']['text'] = LAN_PRUNE; + $var['prune']['link'] = e_SELF.'?prune'; + $var['rules']['text'] = FORLAN_123; + $var['rules']['link'] = e_SELF.'?rules'; + $var['sr']['text'] = FORLAN_116; + $var['sr']['link'] = e_SELF.'?sr'; + $var['mods']['text'] = FORLAN_33; + $var['mods']['link'] = e_SELF.'?mods'; + $var['tools']['text'] = FORLAN_153; + $var['tools']['link'] = e_SELF.'?tools'; + + show_admin_menu(FORLAN_7, $action, $var); + } + + function delete_item($id) + { + $sql = e107::getDb(); + $id = (int)$id; + $confirm = isset($_POST['confirm']) ? true : false; + + if($sql->select('forum', '*', "forum_id = {$id}")) + { + $txt = ""; + $row = $sql->fetch(); + if($row['forum_parent'] == 0) + { + $txt .= $this->delete_parent($id, $confirm); + } + elseif($row['forum_sub'] > 0) + { + $txt .= $this->delete_sub($id, $confirm); + } + else + { + $txt .= $this->delete_forum($id, $confirm); + } + if($confirm) + { + $this->show_message($txt); + } + else + { + $this->delete_show_confirm($txt); + } + } + } + + function delete_parent($id, $confirm = false) + { + $sql = e107::getDb(); + $mes = e107::getMessage(); + $ns = e107::getRender(); + + //$ret = ''; + if($sql->select('forum', 'forum_id', "forum_parent = {$id} AND forum_sub = 0")) + { + $fList = $sql->db_getList(); + foreach($fList as $f) + { + $ret .= $this->delete_forum($f['forum_id'], $confirm); + } + } + if($confirm) + { + if($sql->delete('forum', "forum_id = {$id}")) + { + //$ret .= 'Forum parent successfully deleted'; + $mes->addSuccess(LAN_DELETED); + } + else + { + //$ret .= 'Forum parent could not be deleted'; // TODO LAN + $mes->addError(LAN_DELETED_FAILED); + } + //return $ret; + $ns->tablerender($caption, $mes->render(). $text); + } + //return 'The forum parent has the following info:
'.$ret; // TODO LAN + + } + + + + function deleteForum($forumId) + { + $sql = e107::getDb(); + $forumId = (int)$forumId; +// echo "id = $forumId
"; + // Check for any sub forums + if($sql->select('forum', 'forum_id', "forum_sub = {$forumId}")) + { + $list = $sql->db_getList(); + foreach($list as $f) + { + $ret .= $this->deleteForum($f['forum_id']); + } + } + require_once(e_PLUGIN.'forum/forum_class.php'); + $f = new e107Forum; + if($sql->delete('forum_thread', 'thread_id','thread_forum_id='.$forumId)) + { + $list = $sql->db_getList(); + foreach($list as $t) + { + $f->threadDelete($t['thread_id'], false); + } + } + return $sql->delete('forum', 'forum_id = '.$forumId); + } + + function delete_forum($id, $confirm = false) + { + $sql = e107::getDb(); + $tp = e107::getParser(); + $ns = e107::getRender(); + $mes = e107::getMessage(); + + //$ret = ''; + if($sql->select('forum', 'forum_id', 'forum_sub = '.$id)) + { + $fList = $sql->db_getList(); + foreach($fList as $f) + { + $ret .= $this->delete_sub($f['forum_id'], $confirm); + } + } + if($confirm) + { + if($this->deleteForum($id)) + { + //$ret .= "Forum {$id} successfully deleted"; // TODO LAN + $mes->addSuccess(LAN_DELETED); + } + else + { + //$ret .= "Forum {$id} could not be deleted"; // TODO LAN + $mes->addError(LAN_DELETED_FAILED); + } + } + + $sql->select('forum', 'forum_name, forum_threads, forum_replies', 'forum_id = '.$id); + $row = $sql->fetch(); + //return "Forum {$id} [".$tp->toHTML($row['forum_name'])."] has {$row['forum_threads']} threads, {$row['forum_replies']} replies.
".$ret; + $mes->addInfo("Forum {$id} [".$tp->toHTML($row['forum_name'])."] has {$row['forum_threads']} threads and {$row['forum_replies']} replies."); //FIXME combine multiple info's into one message + + $ns->tablerender($caption, $mes->render() . $text); + } + + function delete_sub($id, $confirm = FALSE) + { + $sql = e107::getDb(); + $tp = e107::getParser(); + $mes = e107::getMessage(); + $ns = e107::getRender(); + + if($confirm) + { + if($this->deleteForum($id)) + { + //$ret .= "Sub-forum {$id} successfully deleted"; // TODO LAN + $mes->addSuccess(LAN_DELETED); + } + else + { + //$ret .= "Sub-forum {$id} could not be deleted"; // TODO LAN + $mes->addError(LAN_DELETED); + } + //return $ret; + } + + $sql->select('forum', '*', 'forum_id = '.$id); + $row = $sql->fetch(); + //return "Sub-forum {$id} [".$tp->toHTML($row['forum_name'])."] has {$row['forum_threads']} threads, {$row['forum_replies']} replies.
".$ret; + $mes->addInfo("Sub-forum {$id} [".$tp->toHTML($row['forum_name'])."] has {$row['forum_threads']} threads, {$row['forum_replies']} replies."); // FIXME show just once on confirm and not LAN_DELETED + $ns->tablerender($caption, $mes->render() . $text); + } + + function delete_show_confirm($txt) + { + $ns = e107::getRender(); + $this->show_message($txt); + $frm = e107::getForm(); + $txt = " +
+
".LAN_CONFDELETE."

+ ".$frm->admin_button('confirm', LAN_UI_DELETE_LABEL, 'submit')." + +
+
+ "; + $ns->tablerender(LAN_UI_DELETE_LABEL, $txt); + } + + function show_subs($id) + { + $sql = e107::getDb(); + $tp = e107::getParser(); + $ns = e107::getRender(); + $frm = e107::getForm(); + $txt = " +
+ + + + + + + + + "; + if($sql->select('forum', 'forum_id, forum_name, forum_description, forum_order', "forum_sub = {$id} ORDER by forum_order ASC")) + { + $subList = $sql->db_getList(); + foreach($subList as $sub) + { + $txt .= " + + + + + + + + "; + } + $txt .= " + + + + + + + "; + + } + else + { + $txt .= ""; + } + + $txt .= " + + + + + + + + + + + + + + + + + +
".LAN_ID."".LAN_NAME."".LAN_DESCRIPTION."".FORLAN_37."".FORLAN_20."
{$sub['forum_id']} + ".ADMIN_DELETE_ICON." +
".$frm->admin_button('update_subs', LAN_UPDATE, 'update')."
 
".FORLAN_146."
".LAN_ID."".LAN_NAME."".LAN_DESCRIPTION."".FORLAN_37." 
  
".$frm->admin_button('create_sub', LAN_CREATE, 'submit')."
+
+ "; + $ns->tablerender(FORLAN_149, $txt); // TODO LAN + } + + function show_existing_forums($sub_action, $id, $mode = false) + { + global $e107, $for; + $frm = e107::getForm(); + $sql = e107::getDb(); + $tp = e107::getParser(); + $mes = e107::getMessage(); + $ns = e107::getRender(); + + $subList = $for->forumGetSubs(); + + if (!$mode) + { + $text = "
"; + } + else + { + $text = "
"; + } + + if (!$parent_amount = $sql->select('forum', '*', "forum_parent='0' ORDER BY forum_order ASC")) + { + //$text .= "".FORLAN_29.""; + $mes->addInfo(FORLAN_29); + } + else + { + $text .= " + + + + + "; + while ($row = $sql->fetch(MYSQL_ASSOC)) + { + $parentList[] = $row; + } + foreach($parentList as $parent) + { + $text .= " + + "; + + $text .= ""; + + $forumCount = $sql->select('forum', '*', "forum_parent='".$parent['forum_id']."' AND forum_sub = 0 ORDER BY forum_order ASC"); + if (!$forumCount) + { + $text .= ""; + } + else + { + $forumList = array(); + while ($row = $sql->fetch(MYSQL_ASSOC)) + { + $forumList[] = $row; + } + foreach($forumList as $forum) + { + $text .= " + + \n\n + + \n"; + } + } + } + } + + if (!$mode) + { + $text .= "
".FORLAN_28."".LAN_OPTIONS."
".$parent['forum_name']." +
".FORLAN_140.": ".$e107->user_class->uc_get_classname($parent['forum_class'])."  ".FORLAN_141.": ".$e107->user_class->uc_get_classname($parent['forum_postclass'])." +
"; + + if ($mode) + { + $text .= ""; + } + else + { + $text .= " + + "; + } + $text .= "
".FORLAN_29."
".IMAGE_new."".$tp->toHTML($forum['forum_name']).""; +// ".IMAGE_new."".$tp->toHTML($forum['forum_name']).""; + + $text .= " +
".$tp->toHTML($forum['forum_description'])."  +
".FORLAN_140.": ".$e107->user_class->uc_get_classname($forum['forum_class'])."  ".FORLAN_141.": ".$e107->user_class->uc_get_classname($forum['forum_postclass'])." + +
"; + + if ($mode) + { + $text .= ""; + } + else + { + //$sub_img = count($subList[$forum['forum_parent']][$forum['forum_id']]) ? IMAGE_sub : IMAGE_nosub; + $sub_img = ADMIN_DOWN_ICON; + $sub_total = count($subList[$forum['forum_parent']][$forum['forum_id']]); + $text .= " + + "; + } + $text .= "
"; + $ns->tablerender(FORLAN_30, $mes->render() . $text); + } + else + { + $text .= "
".$frm->admin_button('update_order', LAN_UPDATE, 'update')."
"; + $ns->tablerender(FORLAN_37, $mes->render() . $text); + } + + } + + + function create_parents($sub_action, $id) + { + global $e107; + $frm = e107::getForm(); + $sql = e107::getDb(); + $tp = e107::getParser(); + $ns = e107::getRender(); + + $id = (int)$id; + if ($sub_action == 'edit' && !$_POST['update_parent']) + { + if ($sql->select('forum', '*', "forum_id=$id")) + { + $row = $sql->fetch(MYSQL_ASSOC); + } + } + else + { + $row = array(); + $row['forum_name'] = ''; + $row['forum_class'] = e_UC_PUBLIC; + $row['forum_postclass'] = e_UC_MEMBER; + $row['forum_threadclass'] = e_UC_MEMBER; + } + + $text = " +
+ + + + + + + + + + + + + + + + + + + + + +
".LAN_NAME.":
".FORLAN_23.":".$e107->user_class->uc_dropdown('forum_class', $row['forum_class'], 'nobody,public,member,admin,classes')."".FORLAN_24."
".FORLAN_142.":".$e107->user_class->uc_dropdown("forum_postclass", $row['forum_postclass'], 'nobody,public,member,admin,classes')."".FORLAN_143."
".FORLAN_184.":".$e107->user_class->uc_dropdown('forum_threadclass', $row['forum_threadclass'], 'nobody,public,member,admin,classes')."".FORLAN_185."
+
"; + if ($sub_action == 'edit') + { + $text .= $frm->admin_button('update_parent', LAN_UPDATE, 'update'); + } + else + { + $text .= $frm->admin_button('submit_parent', LAN_CREATE, 'submit'); + } + $text .= " +
+
"; + + $ns->tablerender(FORLAN_75, $text); + } + + function create_forums($sub_action, $id) + { + global $e107; + $frm = e107::getForm(); + $sql = e107::getDb(); + $tp = e107::getParser(); + $ns = e107::getRender(); + + $id = (int)$id; + if ($sub_action == 'edit' && !$_POST['update_forum']) + { + if ($sql->select('forum', '*', "forum_id=$id")) + { + $fInfo = $sql->fetch(MYSQL_ASSOC); + } + } + else + { + $fInfo = array( + 'forum_parent' => 0, + 'forum_moderators' => e_UC_ADMIN, + 'forum_class' => e_UC_PUBLIC, + 'forum_postclass' => e_UC_MEMBER, + 'forum_threadclass' => e_UC_MEMBER + ); + } + + $text = " +
\n + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
".FORLAN_22.":"; + + $sql->select('forum', '*', 'forum_parent=0'); + $text .= " +
".LAN_NAME.":".FORLAN_179."
".LAN_DESCRIPTION.":
".FORLAN_33.":"; + $text .= $e107->user_class->uc_dropdown('forum_moderators', $fInfo['forum_moderators'], 'admin,classes')."".FORLAN_34.""; + $text .= "
".FORLAN_23.":".$e107->user_class->uc_dropdown('forum_class', $fInfo['forum_class'], 'nobody,public,member,admin,classes')."".FORLAN_24."
".FORLAN_142.":".$e107->user_class->uc_dropdown('forum_postclass', $fInfo['forum_postclass'], 'nobody,public,member,admin,classes')."".FORLAN_143."
".FORLAN_184.":".$e107->user_class->uc_dropdown('forum_threadclass', $fInfo['forum_threadclass'], 'nobody,public,member,admin,classes')."".FORLAN_185."
+ +
"; + if ($sub_action == "edit") + { + $text .= $frm->admin_button('update_forum', LAN_UPDATE, 'update'); + } + else + { + $text .= $frm->admin_button('submit_forum', LAN_CREATE, 'submit'); + } + $text .= " +
+
+"; + $ns->tablerender(FORLAN_28, $text); + } + + + function show_message($message) // FIX + { + $ns = e107::getRender(); + $ns->tablerender('', "
".$message."
"); //FIX: v2 style = render? + } + + + function show_tools() + { + $sql = e107::getDb(); + $ns = e107::getRender(); + $tp = e107::getParser(); + $frm = e107::getForm(); + + $txt = " +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
".FORLAN_156."
+ "; + if($sql->select("forum", "*", "1 ORDER BY forum_order")) + { + $fList = $sql->db_getList(); + foreach($fList as $f) + { + $txt .= " ".$tp->toHTML($f['forum_name'])."
"; + } + $txt .= " ".FORLAN_157.""; + } + $txt .= " +
".FORLAN_158."
+ ".FORLAN_159."
     + ".FORLAN_160." +
".FORLAN_161."
+ ".FORLAN_162."
+      ".FORLAN_182."
".FORLAN_183."

+
".FORLAN_163."
".FORLAN_164."
+
+ ".$frm->admin_button('tools', LAN_GO, 'submit')." +
+
+ "; + $ns->tablerender(FORLAN_166, $txt); + } + + function show_prefs() + { + global $fPref; + $ns = e107::getRender(); + $sql = e107::getDb(); + $e107 = e107::getInstance(); + $frm = e107::getForm(); + $mes = e107::getMessage(); + + $poll_installed = plugInstalled('poll'); + + + if(!$poll_installed) + { + if($fPref->get('poll') == 1) + { + $fPref['forum_poll'] = e_UC_NOBODY; + $fPref->save(false, true); + } + } + + $text = " +
\n + + + + + + + + + + + + + + + + + + + + + + + + + + + "; + if($poll_installed) + { + // + $text .= "'; + } + else + { + $text .= ""; + } + $text .= " + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
".FORLAN_44.":".($fPref->get('enclose') ? "" : "")."".FORLAN_45."
".FORLAN_65.":
".FORLAN_47.":".($fPref->get('notify') ? "" : "")."".FORLAN_48."
".FORLAN_177.":".($fPref->get('notify_on') ? "" : "")."".FORLAN_178."
".FORLAN_49.":".$e107->user_class->uc_dropdown("mods[{$f['forum_id']}]", $f['forum_moderators'], 'admin,classes')."".$e107->user_class->uc_dropdown('forum_poll', $fPref->get('poll'), 'admin,classes').''.FORLAN_50.'".FORLAN_66."
".FORLAN_70.":"; + + if(!$pref['image_post']) + { + $text .= "
".FORLAN_139.""; // TODO LAN + } + if(!is_writable(e_PLUGIN.'forum/attachments')) + { + $text .= "
Attachment dir (".e_PLUGIN_ABS.'forum/attachments'.") is not writable!"; // TODO LAN + } + + $text .= "
".($fPref->get('attach') ? "" : "")."".FORLAN_71." ".FORLAN_130." ". FORLAN_131."
".FORLAN_134.":".FORLAN_135."
".FORLAN_136.":".($fPref->get('linkimg') ? "" : "")."".FORLAN_137."
".FORLAN_51.":".($fPref->get('track') ? "" : "")."".FORLAN_52."
".FORLAN_112.":".($fPref->get('redirect') ? "" : "")."".FORLAN_113."
".FORLAN_116.":".($fPref->get('reported_post_email') ? "" : "")."".FORLAN_122."
".FORLAN_126.":".($fPref->get('forum_tooltip') ? "" : "")."".FORLAN_127."
".FORLAN_128.":".FORLAN_129."
".FORLAN_53.":".FORLAN_54."
".FORLAN_55.":".FORLAN_56."
".FORLAN_57.":".FORLAN_58."
".FORLAN_186.":".FORLAN_187."
".FORLAN_132.":".($fPref->get('hilightsticky') ? "" : "")."".FORLAN_133."
+ +
+ ".$frm->admin_button('updateoptions', LAN_UPDATE, 'update')." +
+
+"; + $ns->tablerender(FORLAN_62, $mes->render() . $text); + } + + function show_reported ($sub_action, $id) + { + global $rs; // FIX replace by $frm + $sql = e107::getDb(); + $ns = e107::getRender(); + $tp = e107::getParser(); + $mes = e107::getMessage(); + + if ($sub_action) { + $sql->select("generic", "*", "gen_id='".$sub_action."'"); + $row = $sql->fetch(); + $sql->select("user", "*", "user_id='". $row['gen_user_id']."'"); + $user = $sql->fetch(); + $con = new convert; + $text = " + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
".FORLAN_171.":#".$row['gen_intdata']."
".FORLAN_173.":".$row['gen_ip']."
".FORLAN_174.":".$user['user_name']." +
".FORLAN_175.":".$con -> convert_date($row['gen_datestamp'], "long")."
".FORLAN_176.":".$row['gen_chardata']."
+ ".$rs->form_open("post", e_SELF."?sr", "", "", "", " onsubmit=\"return confirm_('sr',".$row['gen_datestamp'].")\"")." + ".$rs->form_button("submit", "delete[reported_{$row['gen_id']}]", FORLAN_172)." + ".$rs->form_close()." +
"; + + $ns -> tablerender(FORLAN_116, $text); + + } + else + { + if ($reported_total = $sql->select("generic", "*", "gen_type='reported_post' OR gen_type='Reported Forum Post'")) + { + $text .= " + + + + + "; + while ($row = $sql->fetch()) + { + $text .= " + ".FORLAN_171." #".$row['gen_intdata']." + + \n"; + } + $text .= "
".FORLAN_170."".LAN_OPTIONS."
+ ".$rs->form_open("post", e_SELF."?sr", "", "", "", " onsubmit=\"return confirm_('sr',".$row['gen_datestamp'].")\"")." + ".$rs->form_button("submit", "delete[reported_{$row['gen_id']}]", FORLAN_172)." + ".$rs->form_close()." +
"; + } + else + { + //$text = "
".FORLAN_121."
"; + $mes->addInfo(FORLAN_121); + } + $ns->tablerender(FORLAN_116, $mes->render() . $text); + } + } + + function show_prune() + { + $ns = e107::getRender(); + $sql = e107::getDB(); + $frm = e107::getForm(); + + // $sql->select("forum", "forum_id, forum_name", "forum_parent!=0 ORDER BY forum_order ASC"); + $qry = " + SELECT f.forum_id, f.forum_name, sp.forum_name AS sub_parent, fp.forum_name AS forum_parent + FROM #forum AS f + LEFT JOIN #forum AS sp ON sp.forum_id = f.forum_sub + LEFT JOIN #forum AS fp ON fp.forum_id = f.forum_parent + WHERE f.forum_parent != 0 + ORDER BY f.forum_parent ASC, f.forum_sub, f.forum_order ASC + "; + $sql->gen($qry); + $forums = $sql->db_getList(); + + $text = " +
\n + + + + + + + + + + + + + + +
".FORLAN_60."
".FORLAN_87."
".FORLAN_2."
+ ".FORLAN_89."     + ".FORLAN_90." +
".FORLAN_138.":
"; + + foreach($forums as $forum) + { + $for_name = $forum['forum_parent']." -> "; + $for_name .= ($forum['sub_parent'] ? $forum['sub_parent']." -> " : ""); + $for_name .= $forum['forum_name']; + $text .= " ".$for_name."
"; + } + + + $text .= " +
+
+ ".$frm->admin_button('do_prune', LAN_PRUNE, 'submit')." +
+
"; + $ns->tablerender(LAN_PRUNE, $text); + } + + + function show_mods() + { + global $for; + $ns = e107::getRender(); + $sql = e107::getDB(); + $e107 = e107::getInstance(); // FIX needed? + $forumList = $for->forum_getforums('all'); + $parentList = $for->forum_getparents('list'); + $subList = $for->forumGetSubs('bysub'); + $frm = e107::getForm(); + $tp = e107::getParser(); + + $txt = "
+ + + + + "; + + foreach($parentList as $p) + { + $txt .= " + + + + "; + + foreach($forumList[$p['forum_id']] as $f) + { + $txt .= " + + + + + "; + foreach($subList[$f['forum_id']] as $s) + { + $txt .= " + + + + + "; + } + } + } + $txt .= " +
".$tp->toHTML($p['forum_name'])."
{$f['forum_name']}".$e107->user_class->uc_dropdown("mods[{$f['forum_id']}]", $f['forum_moderators'], 'admin,classes')."
    {$s['forum_name']}".$e107->user_class->uc_dropdown("mods[{$s['forum_id']}]", $s['forum_moderators'], 'admin,classes')."
+
+ ".$frm->admin_button('setMods', LAN_UPDATE, 'update')." +
+
"; + $ns->tablerender(FORLAN_33, $txt); // FIX: LAN button update was WMGLAN_4." ".FORLAN_33) + } + + function show_rules() + { + $pref = e107::getPref(); + $ns = e107::getRender(); + $sql = e107::getDB(); + $tp = e107::getParser(); + $frm = e107::getForm(); + + /* + $sql->select("wmessage"); + list($null) = $sql->fetch(); + list($null) = $sql->fetch(); + list($null) = $sql->fetch(); + list($id, $guestrules, $wm_active4) = $sql->fetch(); + list($id, $memberrules, $wm_active5) = $sql->fetch(); + list($id, $adminrules, $wm_active6) = $sql->fetch(); + */ + + + if($sql->select('generic','*',"gen_type='forum_rules_guest'")) + { + $guest_rules = $sql->fetch(); + } + if($sql->select('generic','*',"gen_type='forum_rules_member'")) + { + $member_rules = $sql->fetch(); + } + if($sql->select('generic','*',"gen_type='forum_rules_admin'")) + { + $admin_rules = $sql->fetch(); + } + + $guesttext = $tp->toFORM(vartrue($guest_rules['gen_chardata'])); + $membertext = $tp->toFORM(vartrue($member_rules['gen_chardata'])); + $admintext = $tp->toFORM(vartrue($admin_rules['gen_chardata'])); + + $text = " +
+ + + + + + + + + + + + + + + + + + + + + +
".WMGLAN_1.":
+ ".WMGLAN_6.":"; + if (vartrue($guest_rules['gen_intdata'])) + { + $text .= ""; + } + else + { + $text .= ""; + } + $text .= "
+ +
+ +
+ ".display_help('helpb', 1, 'addtext1', 'help1')." +
".WMGLAN_2.":
+ ".WMGLAN_6.":"; + if (vartrue($member_rules['gen_intdata'])) + { + $text .= ""; + } + else + { + $text .= ""; + } + $text .= "
+ +
+ +
+ ".display_help('helpb', 1, 'addtext2', 'help2')." +
".WMGLAN_3.":
+ ".WMGLAN_6.": "; + + if (vartrue($admin_rules['gen_intdata'])) + { + $text .= ""; + } + else + { + $text .= ""; + } + + $text .= "
+ +
+ +
+ ".display_help('helpb', 1, 'addtext3', 'help3')." +
+
+ ".$frm->admin_button('frsubmit', LAN_UPDATE, 'submit')." +
+
"; + + $ns->tablerender(WMGLAN_5, $text); + + echo " + + "; + + } + } ?> \ No newline at end of file diff --git a/e107_plugins/forum/forum_admin_class.php b/e107_plugins/forum/forum_admin_class.php index f33186cdf..d735794df 100755 --- a/e107_plugins/forum/forum_admin_class.php +++ b/e107_plugins/forum/forum_admin_class.php @@ -14,1153 +14,3 @@ - Needs rewriting to V2 style including $msg-> - LAN */ - -class forumAdmin -{ - - function show_options($action) - { - - $sql = e107::getDb(); - if ($action == '') { $action = 'main'; } - // ##### Display options --------------------------------------------------------------------------------------------------------- - $var['main']['text'] = FORLAN_76; - $var['main']['link'] = e_SELF; - $var['cat']['text'] = FORLAN_83; - $var['cat']['link'] = e_SELF.'?cat'; - if ($sql->select('forum', 'forum_id', "forum_parent='0' LIMIT 1")) - { - $var['create']['text'] = FORLAN_77; - $var['create']['link'] = e_SELF.'?create'; - } - $var['order']['text'] = FORLAN_78; - $var['order']['link'] = e_SELF.'?order'; - $var['opt']['text'] = FORLAN_79; - $var['opt']['link'] = e_SELF.'?opt'; - $var['prune']['text'] = LAN_PRUNE; - $var['prune']['link'] = e_SELF.'?prune'; - $var['rules']['text'] = FORLAN_123; - $var['rules']['link'] = e_SELF.'?rules'; - $var['sr']['text'] = FORLAN_116; - $var['sr']['link'] = e_SELF.'?sr'; - $var['mods']['text'] = FORLAN_33; - $var['mods']['link'] = e_SELF.'?mods'; - $var['tools']['text'] = FORLAN_153; - $var['tools']['link'] = e_SELF.'?tools'; - - show_admin_menu(FORLAN_7, $action, $var); - } - - function delete_item($id) - { - $sql = e107::getDb(); - $id = (int)$id; - $confirm = isset($_POST['confirm']) ? true : false; - - if($sql->select('forum', '*', "forum_id = {$id}")) - { - $txt = ""; - $row = $sql->fetch(); - if($row['forum_parent'] == 0) - { - $txt .= $this->delete_parent($id, $confirm); - } - elseif($row['forum_sub'] > 0) - { - $txt .= $this->delete_sub($id, $confirm); - } - else - { - $txt .= $this->delete_forum($id, $confirm); - } - if($confirm) - { - $this->show_message($txt); - } - else - { - $this->delete_show_confirm($txt); - } - } - } - - function delete_parent($id, $confirm = false) - { - $sql = e107::getDb(); - $mes = e107::getMessage(); - $ns = e107::getRender(); - - //$ret = ''; - if($sql->select('forum', 'forum_id', "forum_parent = {$id} AND forum_sub = 0")) - { - $fList = $sql->db_getList(); - foreach($fList as $f) - { - $ret .= $this->delete_forum($f['forum_id'], $confirm); - } - } - if($confirm) - { - if($sql->delete('forum', "forum_id = {$id}")) - { - //$ret .= 'Forum parent successfully deleted'; - $mes->addSuccess(LAN_DELETED); - } - else - { - //$ret .= 'Forum parent could not be deleted'; // TODO LAN - $mes->addError(LAN_DELETED_FAILED); - } - //return $ret; - $ns->tablerender($caption, $mes->render(). $text); - } - //return 'The forum parent has the following info:
'.$ret; // TODO LAN - - } - - - - function deleteForum($forumId) - { - $sql = e107::getDb(); - $forumId = (int)$forumId; -// echo "id = $forumId
"; - // Check for any sub forums - if($sql->select('forum', 'forum_id', "forum_sub = {$forumId}")) - { - $list = $sql->db_getList(); - foreach($list as $f) - { - $ret .= $this->deleteForum($f['forum_id']); - } - } - require_once(e_PLUGIN.'forum/forum_class.php'); - $f = new e107Forum; - if($sql->delete('forum_thread', 'thread_id','thread_forum_id='.$forumId)) - { - $list = $sql->db_getList(); - foreach($list as $t) - { - $f->threadDelete($t['thread_id'], false); - } - } - return $sql->delete('forum', 'forum_id = '.$forumId); - } - - function delete_forum($id, $confirm = false) - { - $sql = e107::getDb(); - $tp = e107::getParser(); - $ns = e107::getRender(); - $mes = e107::getMessage(); - - //$ret = ''; - if($sql->select('forum', 'forum_id', 'forum_sub = '.$id)) - { - $fList = $sql->db_getList(); - foreach($fList as $f) - { - $ret .= $this->delete_sub($f['forum_id'], $confirm); - } - } - if($confirm) - { - if($this->deleteForum($id)) - { - //$ret .= "Forum {$id} successfully deleted"; // TODO LAN - $mes->addSuccess(LAN_DELETED); - } - else - { - //$ret .= "Forum {$id} could not be deleted"; // TODO LAN - $mes->addError(LAN_DELETED_FAILED); - } - } - - $sql->select('forum', 'forum_name, forum_threads, forum_replies', 'forum_id = '.$id); - $row = $sql->fetch(); - //return "Forum {$id} [".$tp->toHTML($row['forum_name'])."] has {$row['forum_threads']} threads, {$row['forum_replies']} replies.
".$ret; - $mes->addInfo("Forum {$id} [".$tp->toHTML($row['forum_name'])."] has {$row['forum_threads']} threads and {$row['forum_replies']} replies."); //FIXME combine multiple info's into one message - - $ns->tablerender($caption, $mes->render() . $text); - } - - function delete_sub($id, $confirm = FALSE) - { - $sql = e107::getDb(); - $tp = e107::getParser(); - $mes = e107::getMessage(); - $ns = e107::getRender(); - - if($confirm) - { - if($this->deleteForum($id)) - { - //$ret .= "Sub-forum {$id} successfully deleted"; // TODO LAN - $mes->addSuccess(LAN_DELETED); - } - else - { - //$ret .= "Sub-forum {$id} could not be deleted"; // TODO LAN - $mes->addError(LAN_DELETED); - } - //return $ret; - } - - $sql->select('forum', '*', 'forum_id = '.$id); - $row = $sql->fetch(); - //return "Sub-forum {$id} [".$tp->toHTML($row['forum_name'])."] has {$row['forum_threads']} threads, {$row['forum_replies']} replies.
".$ret; - $mes->addInfo("Sub-forum {$id} [".$tp->toHTML($row['forum_name'])."] has {$row['forum_threads']} threads, {$row['forum_replies']} replies."); // FIXME show just once on confirm and not LAN_DELETED - $ns->tablerender($caption, $mes->render() . $text); - } - - function delete_show_confirm($txt) - { - $ns = e107::getRender(); - $this->show_message($txt); - $frm = e107::getForm(); - $txt = " -
-
".LAN_CONFDELETE."

- ".$frm->admin_button('confirm', LAN_UI_DELETE_LABEL, 'submit')." - -
-
- "; - $ns->tablerender(LAN_UI_DELETE_LABEL, $txt); - } - - function show_subs($id) - { - $sql = e107::getDb(); - $tp = e107::getParser(); - $ns = e107::getRender(); - $frm = e107::getForm(); - $txt = " -
- - - - - - - - - "; - if($sql->select('forum', 'forum_id, forum_name, forum_description, forum_order', "forum_sub = {$id} ORDER by forum_order ASC")) - { - $subList = $sql->db_getList(); - foreach($subList as $sub) - { - $txt .= " - - - - - - - - "; - } - $txt .= " - - - - - - - "; - - } - else - { - $txt .= ""; - } - - $txt .= " - - - - - - - - - - - - - - - - - -
".LAN_ID."".LAN_NAME."".LAN_DESCRIPTION."".FORLAN_37."".FORLAN_20."
{$sub['forum_id']} - ".ADMIN_DELETE_ICON." -
".$frm->admin_button('update_subs', LAN_UPDATE, 'update')."
 
".FORLAN_146."
".LAN_ID."".LAN_NAME."".LAN_DESCRIPTION."".FORLAN_37." 
  
".$frm->admin_button('create_sub', LAN_CREATE, 'submit')."
-
- "; - $ns->tablerender(FORLAN_149, $txt); // TODO LAN - } - - function show_existing_forums($sub_action, $id, $mode = false) - { - global $e107, $for; - $frm = e107::getForm(); - $sql = e107::getDb(); - $tp = e107::getParser(); - $mes = e107::getMessage(); - $ns = e107::getRender(); - - $subList = $for->forumGetSubs(); - - if (!$mode) - { - $text = "
"; - } - else - { - $text = "
"; - } - - if (!$parent_amount = $sql->select('forum', '*', "forum_parent='0' ORDER BY forum_order ASC")) - { - //$text .= "".FORLAN_29.""; - $mes->addInfo(FORLAN_29); - } - else - { - $text .= " - - - - - "; - while ($row = $sql->fetch(MYSQL_ASSOC)) - { - $parentList[] = $row; - } - foreach($parentList as $parent) - { - $text .= " - - "; - - $text .= ""; - - $forumCount = $sql->select('forum', '*', "forum_parent='".$parent['forum_id']."' AND forum_sub = 0 ORDER BY forum_order ASC"); - if (!$forumCount) - { - $text .= ""; - } - else - { - $forumList = array(); - while ($row = $sql->fetch(MYSQL_ASSOC)) - { - $forumList[] = $row; - } - foreach($forumList as $forum) - { - $text .= " - - \n\n - - \n"; - } - } - } - } - - if (!$mode) - { - $text .= "
".FORLAN_28."".LAN_OPTIONS."
".$parent['forum_name']." -
".FORLAN_140.": ".$e107->user_class->uc_get_classname($parent['forum_class'])."  ".FORLAN_141.": ".$e107->user_class->uc_get_classname($parent['forum_postclass'])." -
"; - - if ($mode) - { - $text .= ""; - } - else - { - $text .= " - - "; - } - $text .= "
".FORLAN_29."
".IMAGE_new."".$tp->toHTML($forum['forum_name']).""; -// ".IMAGE_new."".$tp->toHTML($forum['forum_name']).""; - - $text .= " -
".$tp->toHTML($forum['forum_description'])."  -
".FORLAN_140.": ".$e107->user_class->uc_get_classname($forum['forum_class'])."  ".FORLAN_141.": ".$e107->user_class->uc_get_classname($forum['forum_postclass'])." - -
"; - - if ($mode) - { - $text .= ""; - } - else - { - //$sub_img = count($subList[$forum['forum_parent']][$forum['forum_id']]) ? IMAGE_sub : IMAGE_nosub; - $sub_img = ADMIN_DOWN_ICON; - $sub_total = count($subList[$forum['forum_parent']][$forum['forum_id']]); - $text .= " - - "; - } - $text .= "
"; - $ns->tablerender(FORLAN_30, $mes->render() . $text); - } - else - { - $text .= "
".$frm->admin_button('update_order', LAN_UPDATE, 'update')."
"; - $ns->tablerender(FORLAN_37, $mes->render() . $text); - } - - } - - - function create_parents($sub_action, $id) - { - global $e107; - $frm = e107::getForm(); - $sql = e107::getDb(); - $tp = e107::getParser(); - $ns = e107::getRender(); - - $id = (int)$id; - if ($sub_action == 'edit' && !$_POST['update_parent']) - { - if ($sql->select('forum', '*', "forum_id=$id")) - { - $row = $sql->fetch(MYSQL_ASSOC); - } - } - else - { - $row = array(); - $row['forum_name'] = ''; - $row['forum_class'] = e_UC_PUBLIC; - $row['forum_postclass'] = e_UC_MEMBER; - $row['forum_threadclass'] = e_UC_MEMBER; - } - - $text = " -
- - - - - - - - - - - - - - - - - - - - - -
".LAN_NAME.":
".FORLAN_23.":".$e107->user_class->uc_dropdown('forum_class', $row['forum_class'], 'nobody,public,member,admin,classes')."".FORLAN_24."
".FORLAN_142.":".$e107->user_class->uc_dropdown("forum_postclass", $row['forum_postclass'], 'nobody,public,member,admin,classes')."".FORLAN_143."
".FORLAN_184.":".$e107->user_class->uc_dropdown('forum_threadclass', $row['forum_threadclass'], 'nobody,public,member,admin,classes')."".FORLAN_185."
-
"; - if ($sub_action == 'edit') - { - $text .= $frm->admin_button('update_parent', LAN_UPDATE, 'update'); - } - else - { - $text .= $frm->admin_button('submit_parent', LAN_CREATE, 'submit'); - } - $text .= " -
-
"; - - $ns->tablerender(FORLAN_75, $text); - } - - function create_forums($sub_action, $id) - { - global $e107; - $frm = e107::getForm(); - $sql = e107::getDb(); - $tp = e107::getParser(); - $ns = e107::getRender(); - - $id = (int)$id; - if ($sub_action == 'edit' && !$_POST['update_forum']) - { - if ($sql->select('forum', '*', "forum_id=$id")) - { - $fInfo = $sql->fetch(MYSQL_ASSOC); - } - } - else - { - $fInfo = array( - 'forum_parent' => 0, - 'forum_moderators' => e_UC_ADMIN, - 'forum_class' => e_UC_PUBLIC, - 'forum_postclass' => e_UC_MEMBER, - 'forum_threadclass' => e_UC_MEMBER - ); - } - - $text = " -
\n - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
".FORLAN_22.":"; - - $sql->select('forum', '*', 'forum_parent=0'); - $text .= " -
".LAN_NAME.":".FORLAN_179."
".LAN_DESCRIPTION.":
".FORLAN_33.":"; - $text .= $e107->user_class->uc_dropdown('forum_moderators', $fInfo['forum_moderators'], 'admin,classes')."".FORLAN_34.""; - $text .= "
".FORLAN_23.":".$e107->user_class->uc_dropdown('forum_class', $fInfo['forum_class'], 'nobody,public,member,admin,classes')."".FORLAN_24."
".FORLAN_142.":".$e107->user_class->uc_dropdown('forum_postclass', $fInfo['forum_postclass'], 'nobody,public,member,admin,classes')."".FORLAN_143."
".FORLAN_184.":".$e107->user_class->uc_dropdown('forum_threadclass', $fInfo['forum_threadclass'], 'nobody,public,member,admin,classes')."".FORLAN_185."
- -
"; - if ($sub_action == "edit") - { - $text .= $frm->admin_button('update_forum', LAN_UPDATE, 'update'); - } - else - { - $text .= $frm->admin_button('submit_forum', LAN_CREATE, 'submit'); - } - $text .= " -
-
-"; - $ns->tablerender(FORLAN_28, $text); - } - - - function show_message($message) // FIX - { - $ns = e107::getRender(); - $ns->tablerender('', "
".$message."
"); //FIX: v2 style = render? - } - - - function show_tools() - { - $sql = e107::getDb(); - $ns = e107::getRender(); - $tp = e107::getParser(); - $frm = e107::getForm(); - - $txt = " -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
".FORLAN_156."
- "; - if($sql->select("forum", "*", "1 ORDER BY forum_order")) - { - $fList = $sql->db_getList(); - foreach($fList as $f) - { - $txt .= " ".$tp->toHTML($f['forum_name'])."
"; - } - $txt .= " ".FORLAN_157.""; - } - $txt .= " -
".FORLAN_158."
- ".FORLAN_159."
     - ".FORLAN_160." -
".FORLAN_161."
- ".FORLAN_162."
-      ".FORLAN_182."
".FORLAN_183."

-
".FORLAN_163."
".FORLAN_164."
-
- ".$frm->admin_button('tools', LAN_GO, 'submit')." -
-
- "; - $ns->tablerender(FORLAN_166, $txt); - } - - function show_prefs() - { - global $fPref; - $ns = e107::getRender(); - $sql = e107::getDb(); - $e107 = e107::getInstance(); - $frm = e107::getForm(); - $mes = e107::getMessage(); - - $poll_installed = plugInstalled('poll'); - - - if(!$poll_installed) - { - if($fPref->get('poll') == 1) - { - $fPref['forum_poll'] = e_UC_NOBODY; - $fPref->save(false, true); - } - } - - $text = " -
\n - - - - - - - - - - - - - - - - - - - - - - - - - - - "; - if($poll_installed) - { - // - $text .= "'; - } - else - { - $text .= ""; - } - $text .= " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
".FORLAN_44.":".($fPref->get('enclose') ? "" : "")."".FORLAN_45."
".FORLAN_65.":
".FORLAN_47.":".($fPref->get('notify') ? "" : "")."".FORLAN_48."
".FORLAN_177.":".($fPref->get('notify_on') ? "" : "")."".FORLAN_178."
".FORLAN_49.":".$e107->user_class->uc_dropdown("mods[{$f['forum_id']}]", $f['forum_moderators'], 'admin,classes')."".$e107->user_class->uc_dropdown('forum_poll', $fPref->get('poll'), 'admin,classes').''.FORLAN_50.'".FORLAN_66."
".FORLAN_70.":"; - - if(!$pref['image_post']) - { - $text .= "
".FORLAN_139.""; // TODO LAN - } - if(!is_writable(e_PLUGIN.'forum/attachments')) - { - $text .= "
Attachment dir (".e_PLUGIN_ABS.'forum/attachments'.") is not writable!"; // TODO LAN - } - - $text .= "
".($fPref->get('attach') ? "" : "")."".FORLAN_71." ".FORLAN_130." ". FORLAN_131."
".FORLAN_134.":".FORLAN_135."
".FORLAN_136.":".($fPref->get('linkimg') ? "" : "")."".FORLAN_137."
".FORLAN_51.":".($fPref->get('track') ? "" : "")."".FORLAN_52."
".FORLAN_112.":".($fPref->get('redirect') ? "" : "")."".FORLAN_113."
".FORLAN_116.":".($fPref->get('reported_post_email') ? "" : "")."".FORLAN_122."
".FORLAN_126.":".($fPref->get('forum_tooltip') ? "" : "")."".FORLAN_127."
".FORLAN_128.":".FORLAN_129."
".FORLAN_53.":".FORLAN_54."
".FORLAN_55.":".FORLAN_56."
".FORLAN_57.":".FORLAN_58."
".FORLAN_186.":".FORLAN_187."
".FORLAN_132.":".($fPref->get('hilightsticky') ? "" : "")."".FORLAN_133."
- -
- ".$frm->admin_button('updateoptions', LAN_UPDATE, 'update')." -
-
-"; - $ns->tablerender(FORLAN_62, $mes->render() . $text); - } - - function show_reported ($sub_action, $id) - { - global $rs; // FIX replace by $frm - $sql = e107::getDb(); - $ns = e107::getRender(); - $tp = e107::getParser(); - $mes = e107::getMessage(); - - if ($sub_action) { - $sql->select("generic", "*", "gen_id='".$sub_action."'"); - $row = $sql->fetch(); - $sql->select("user", "*", "user_id='". $row['gen_user_id']."'"); - $user = $sql->fetch(); - $con = new convert; - $text = " - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
".FORLAN_171.":#".$row['gen_intdata']."
".FORLAN_173.":".$row['gen_ip']."
".FORLAN_174.":".$user['user_name']." -
".FORLAN_175.":".$con -> convert_date($row['gen_datestamp'], "long")."
".FORLAN_176.":".$row['gen_chardata']."
- ".$rs->form_open("post", e_SELF."?sr", "", "", "", " onsubmit=\"return confirm_('sr',".$row['gen_datestamp'].")\"")." - ".$rs->form_button("submit", "delete[reported_{$row['gen_id']}]", FORLAN_172)." - ".$rs->form_close()." -
"; - - $ns -> tablerender(FORLAN_116, $text); - - } - else - { - if ($reported_total = $sql->select("generic", "*", "gen_type='reported_post' OR gen_type='Reported Forum Post'")) - { - $text .= " - - - - - "; - while ($row = $sql->fetch()) - { - $text .= " - ".FORLAN_171." #".$row['gen_intdata']." - - \n"; - } - $text .= "
".FORLAN_170."".LAN_OPTIONS."
- ".$rs->form_open("post", e_SELF."?sr", "", "", "", " onsubmit=\"return confirm_('sr',".$row['gen_datestamp'].")\"")." - ".$rs->form_button("submit", "delete[reported_{$row['gen_id']}]", FORLAN_172)." - ".$rs->form_close()." -
"; - } - else - { - //$text = "
".FORLAN_121."
"; - $mes->addInfo(FORLAN_121); - } - $ns->tablerender(FORLAN_116, $mes->render() . $text); - } - } - - function show_prune() - { - $ns = e107::getRender(); - $sql = e107::getDB(); - $frm = e107::getForm(); - - // $sql->select("forum", "forum_id, forum_name", "forum_parent!=0 ORDER BY forum_order ASC"); - $qry = " - SELECT f.forum_id, f.forum_name, sp.forum_name AS sub_parent, fp.forum_name AS forum_parent - FROM #forum AS f - LEFT JOIN #forum AS sp ON sp.forum_id = f.forum_sub - LEFT JOIN #forum AS fp ON fp.forum_id = f.forum_parent - WHERE f.forum_parent != 0 - ORDER BY f.forum_parent ASC, f.forum_sub, f.forum_order ASC - "; - $sql->gen($qry); - $forums = $sql->db_getList(); - - $text = " -
\n - - - - - - - - - - - - - - -
".FORLAN_60."
".FORLAN_87."
".FORLAN_2."
- ".FORLAN_89."     - ".FORLAN_90." -
".FORLAN_138.":
"; - - foreach($forums as $forum) - { - $for_name = $forum['forum_parent']." -> "; - $for_name .= ($forum['sub_parent'] ? $forum['sub_parent']." -> " : ""); - $for_name .= $forum['forum_name']; - $text .= " ".$for_name."
"; - } - - - $text .= " -
-
- ".$frm->admin_button('do_prune', LAN_PRUNE, 'submit')." -
-
"; - $ns->tablerender(LAN_PRUNE, $text); - } - - - function show_mods() - { - global $for; - $ns = e107::getRender(); - $sql = e107::getDB(); - $e107 = e107::getInstance(); // FIX needed? - $forumList = $for->forum_getforums('all'); - $parentList = $for->forum_getparents('list'); - $subList = $for->forumGetSubs('bysub'); - $frm = e107::getForm(); - $tp = e107::getParser(); - - $txt = "
- - - - - "; - - foreach($parentList as $p) - { - $txt .= " - - - - "; - - foreach($forumList[$p['forum_id']] as $f) - { - $txt .= " - - - - - "; - foreach($subList[$f['forum_id']] as $s) - { - $txt .= " - - - - - "; - } - } - } - $txt .= " -
".$tp->toHTML($p['forum_name'])."
{$f['forum_name']}".$e107->user_class->uc_dropdown("mods[{$f['forum_id']}]", $f['forum_moderators'], 'admin,classes')."
    {$s['forum_name']}".$e107->user_class->uc_dropdown("mods[{$s['forum_id']}]", $s['forum_moderators'], 'admin,classes')."
-
- ".$frm->admin_button('setMods', LAN_UPDATE, 'update')." -
-
"; - $ns->tablerender(FORLAN_33, $txt); // FIX: LAN button update was WMGLAN_4." ".FORLAN_33) - } - - function show_rules() - { - $pref = e107::getPref(); - $ns = e107::getRender(); - $sql = e107::getDB(); - $tp = e107::getParser(); - $frm = e107::getForm(); - - /* - $sql->select("wmessage"); - list($null) = $sql->fetch(); - list($null) = $sql->fetch(); - list($null) = $sql->fetch(); - list($id, $guestrules, $wm_active4) = $sql->fetch(); - list($id, $memberrules, $wm_active5) = $sql->fetch(); - list($id, $adminrules, $wm_active6) = $sql->fetch(); - */ - - - if($sql->select('generic','*',"gen_type='forum_rules_guest'")) - { - $guest_rules = $sql->fetch(); - } - if($sql->select('generic','*',"gen_type='forum_rules_member'")) - { - $member_rules = $sql->fetch(); - } - if($sql->select('generic','*',"gen_type='forum_rules_admin'")) - { - $admin_rules = $sql->fetch(); - } - - $guesttext = $tp->toFORM(vartrue($guest_rules['gen_chardata'])); - $membertext = $tp->toFORM(vartrue($member_rules['gen_chardata'])); - $admintext = $tp->toFORM(vartrue($admin_rules['gen_chardata'])); - - $text = " -
- - - - - - - - - - - - - - - - - - - - - -
".WMGLAN_1.":
- ".WMGLAN_6.":"; - if (vartrue($guest_rules['gen_intdata'])) - { - $text .= ""; - } - else - { - $text .= ""; - } - $text .= "
- -
- -
- ".display_help('helpb', 1, 'addtext1', 'help1')." -
".WMGLAN_2.":
- ".WMGLAN_6.":"; - if (vartrue($member_rules['gen_intdata'])) - { - $text .= ""; - } - else - { - $text .= ""; - } - $text .= "
- -
- -
- ".display_help('helpb', 1, 'addtext2', 'help2')." -
".WMGLAN_3.":
- ".WMGLAN_6.": "; - - if (vartrue($admin_rules['gen_intdata'])) - { - $text .= ""; - } - else - { - $text .= ""; - } - - $text .= "
- -
- -
- ".display_help('helpb', 1, 'addtext3', 'help3')." -
-
- ".$frm->admin_button('frsubmit', LAN_UPDATE, 'submit')." -
-
"; - - $ns->tablerender(WMGLAN_5, $text); - - echo " - - "; - - } - } \ No newline at end of file