diff --git a/e107_handlers/e107Url.php b/e107_handlers/e107Url.php index 41732d945..d43f39f3d 100755 --- a/e107_handlers/e107Url.php +++ b/e107_handlers/e107Url.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/e107Url.php,v $ -| $Revision: 1.3 $ -| $Date: 2008-11-25 17:02:02 $ +| $Revision: 1.4 $ +| $Date: 2008-11-26 03:24:51 $ | $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ @@ -37,7 +37,7 @@ class eURL $urlItems = array($urlItems => 1); } - $handlerId = $section . '/' . $urlType; + $handlerId = $section . '/' . $urlType; if (!isset($this->_link_handlers[$handlerId])) if (!isset($this->_link_handlers[$handlerId])) { $this->_link_handlers[$handlerId] = $this->_initHandler($section, $urlType); diff --git a/e107_plugins/forum/forum_admin.php b/e107_plugins/forum/forum_admin.php index 7cea8fd00..3bdac243a 100644 --- a/e107_plugins/forum/forum_admin.php +++ b/e107_plugins/forum/forum_admin.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_admin.php,v $ -| $Revision: 1.3 $ -| $Date: 2008-01-06 21:16:37 $ -| $Author: e107steved $ +| $Revision: 1.4 $ +| $Date: 2008-11-26 03:24:51 $ +| $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ $eplug_admin = true; @@ -28,14 +28,15 @@ if (!getperms("P")) } $e_sub_cat = 'forum'; -$forum = new forum; require_once(e_ADMIN.'auth.php'); -require_once(e_HANDLER."userclass_class.php"); -require_once(e_HANDLER."form_handler.php"); -require_once(e_HANDLER."ren_help.php"); -require_once(e_PLUGIN."forum/forum_class.php"); +require_once(e_HANDLER.'userclass_class.php'); +require_once(e_HANDLER.'form_handler.php'); +require_once(e_HANDLER.'ren_help.php'); +require_once(e_PLUGIN.'forum/forum_class.php'); +require_once(e_PLUGIN.'forum/forum_admin_class.php'); $rs = new form; $for = new e107forum; +$forum = new forumAdmin; define("IMAGE_new", ""); define("IMAGE_sub", "".FORLAN_145.""); define("IMAGE_nosub", "".FORLAN_145.""); @@ -108,20 +109,27 @@ if(isset($_POST['tools'])) if(isset($_POST['create_sub'])) { - $fid = intval($sub_action); - $_name = $tp->toDB($_POST['subname_new']); - $_desc = $tp->toDB($_POST['subdesc_new']); - $_order = intval($_POST['suborder_new']); - if($_name != "" && $sql->db_Select('forum', '*', "forum_id = {$fid}")) + $fid = (int)($sub_action); + $tmp = array(); + $tmp['forum_name'] = $tp->toDB($_POST['subname_new']); + $tmp['forum_description'] = $tp->toDB($_POST['subdesc_new']); + $tmp['forum_order'] = (int)$_POST['suborder_new']; + + if($tmp['forum_name'] != '' && $sql->db_Select('forum', '*', "forum_id = {$fid}")) { $row = $sql->db_Fetch(); - if($sql->db_Insert("forum", "0, '{$_name}', '{$_desc}', '{$row['forum_parent']}', '{$fid}', '".time()."', '{$row['forum_moderators']}', 0, 0, '', '', '{$row['forum_class']}', '{$_order}', '{$row['forum_postclass']}'")) + $tmp['forum_parent'] = $row['forum_parent']; + $tmp['forum_moderators'] = $row['forum_moderators']; + $tmp['forum_class'] = $row['forum_class']; + $tmp['forum_postclass'] = $row['forum_postclass']; + $tmp['forum_sub'] = $fid; + if($sql->db_Insert('forum', $tmp)) { - $forum->show_message(LAN_CREATED); + $forum->show_message(FORLAN_150.' - '.LAN_CREATED); } else { - $forum->show_message(LAN_CREATED_FAILED); + $forum->show_message(FORLAN_150.' - '.LAN_CREATED_FAILED); } } } @@ -159,9 +167,19 @@ if(isset($_POST['update_subs'])) if(isset($_POST['submit_parent'])) { - $_POST['forum_name'] = $tp->toDB($_POST['forum_name']); - $sql->db_Insert("forum", "0, '".$_POST['forum_name']."', '', '0', '0', '".time()."', '', '0', '0', '', '', '".$_POST['forum_class']."', '0', '{$_POST['forum_postclass']}'"); - $forum->show_message(FORLAN_13); + $tmp = array(); + $tmp['forum_name'] = $tp->toDB($_POST['forum_name']); + $tmp['forum_datestamp'] = time(); + $tmp['forum_class'] = (int)$_POST['forum_class']; + $tmp['forum_postclass'] = (int)$_POST['forum_postclass']; + if($e107->sql->db_Insert('forum',$tmp)) + { + $forum->show_message(FORLAN_22.' - '.LAN_CREATED); + } + else + { + $forum->show_message(FORLAN_22.' - '.LAN_CREATED_FAILED); + } } if(isset($_POST['update_parent'])) @@ -174,11 +192,22 @@ if(isset($_POST['update_parent'])) if(isset($_POST['submit_forum'])) { - $mods = $_POST['forum_moderators']; - $_POST['forum_name'] = $tp->toDB($_POST['forum_name']); - $_POST['forum_description'] = $tp->toDB($_POST['forum_description']); - $sql->db_Insert("forum", "0, '".$_POST['forum_name']."', '".$_POST['forum_description']."', '".$_POST['forum_parent']."', '0', '".time()."', '".$mods."', 0, 0, '', '', '".$_POST['forum_class']."', 0, '{$_POST['forum_postclass']}'"); - $forum->show_message(FORLAN_11); + $tmp = array(); + $tmp['forum_moderators'] = (int)$_POST['forum_moderators']; + $tmp['forum_name'] = $tp->toDB($_POST['forum_name']); + $tmp['forum_description'] = $tp->toDB($_POST['forum_description']); + $tmp['forum_datestamp'] = time(); + $tmp['forum_class'] = (int)$_POST['forum_class']; + $tmp['forum_postclass'] = (int)$_POST['forum_postclass']; + $tmp['forum_parent'] = (int)$_POST['forum_parent']; + if($e107->sql->db_Insert('forum',$tmp)) + { + $forum->show_message(FORLAN_36.' - '.LAN_CREATED); + } + else + { + $forum->show_message(FORLAN_36.' - '.LAN_CREATED_FAILED); + } } if(isset($_POST['update_forum'])) @@ -391,1128 +420,6 @@ function headerjs() return $headerjs; } -class forum -{ - - function show_options($action) - { - global $sql; - 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->db_Select("forum", "*", "forum_parent='0' ")) - { - $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'] = FORLAN_59; - $var['prune']['link'] = e_SELF."?prune"; - $var['rank']['text'] = FORLAN_63; - $var['rank']['link'] = e_SELF."?rank"; - $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) - { - global $sql; - $id = intval($id); - $confirm = isset($_POST['confirm']) ? TRUE : FALSE; - - if($sql->db_Select('forum', '*', "forum_id = {$id}")) - { - $txt = ""; - $row = $sql->db_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) - { - global $sql; - $ret = ""; - if($sql->db_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->db_Delete("forum", "forum_id = {$id}")) - { - $ret .= "Forum parent successfully deleted"; - } - else - { - $ret .= "Forum parent could not be deleted"; - } - return $ret; - } - return "The forum parent has the following info:
".$ret; - - } - - function delete_forum($id, $confirm = FALSE) - { - global $sql, $tp; - $ret = ""; - if($sql->db_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) - { - $cnt = $sql->db_Delete("forum_t","thread_forum_id = {$id}"); - $ret .= $cnt." forum {$id} thread(s) deleted
"; - if($sql->db_Delete("forum", "forum_id = {$id}")) - { - $ret .= "Forum {$id} successfully deleted"; - } - else - { - $ret .= "Forum {$id} could not be deleted"; - } - return $ret; - } - - $sql->db_Select("forum", "*", "forum_id = {$id}"); - $row = $sql->db_Fetch(); - return "Forum {$id} [".$tp->toHTML($row['forum_name'])."] has {$row['forum_threads']} threads, {$row['forum_replies']} replies.
".$ret; - } - - function delete_sub($id, $confirm = FALSE) - { - global $sql, $tp; - if($confirm) - { - $cnt = $sql->db_Delete("forum_t","thread_forum_id = {$id}"); - $ret .= $cnt." Sub-forum {$id} thread(s) deleted
"; - if($sql->db_Delete("forum", "forum_id = {$id}")) - { - $ret .= "Sub-forum {$id} successfully deleted"; - } - else - { - $ret .= "Sub-forum {$id} could not be deleted"; - } - return $ret; - } - - $sql->db_Select("forum", "*", "forum_id = {$id}"); - $row = $sql->db_Fetch(); - return "Sub-forum {$id} [".$tp->toHTML($row['forum_name'])."] has {$row['forum_threads']} threads, {$row['forum_replies']} replies.
".$ret; - } - - function delete_show_confirm($txt) - { - global $ns; - $this->show_message($txt); - $txt = " -
-
".FORLAN_180."

- -
-
- "; - $ns->tablerender(FORLAN_181, $txt); - } - - function show_subs($id) - { - global $sql, $tp, $ns; - $txt = " -
- - - - - - - - - "; - if($sql->db_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 .= " - - - - - - - - - - - - - - - - - -
".FORLAN_151."".FORLAN_31."".FORLAN_32."".FORLAN_37."".FORLAN_20."
{$sub['forum_id']} - ".ADMIN_DELETE_ICON." -
 
".FORLAN_146."
".FORLAN_151."".FORLAN_31."".FORLAN_32."".FORLAN_37." 
  
-
- "; - $ns->tablerender(FORLAN_149, $txt); - } - - function show_existing_forums($sub_action, $id, $mode = FALSE) - { - global $sql, $rs, $ns, $sql2, $sql3, $tp, $for; - - $subList = $for->forum_getsubs(); - if (!is_object($sql2)) - { - $sql2 = new db; - } - if (!is_object($sql3)) - { - $sql3 = new db; - } - if (!$mode) - { - $text = "
"; - } else { - $text = "
"; - } - $text .= " - - - - - "; - - if (!$parent_amount = $sql->db_Select("forum", "*", "forum_parent='0' ORDER BY forum_order ASC")) - { - $text .= ""; - } - else - { - $sql2 = new db; - $sql3 = new db; - while ($row = $sql->db_Fetch()) - { - extract($row); - $parent_id = $forum_id; - $text .= " - - "; - - $text .= ""; - - $forums = $sql2->db_Select("forum", "*", "forum_parent='".$forum_id."' AND forum_sub = 0 ORDER BY forum_order ASC"); - if (!$forums) - { - $text .= ""; - } - else - { - while ($row = $sql2->db_Fetch()) - { - extract($row); - - $text .= " - - \n - - \n"; - } - } - } - } - - if (!$mode) - { - $text .= "
".FORLAN_28."".FORLAN_80."
".FORLAN_29."
".$forum_name." -
".FORLAN_140.": ".r_userclass_name($forum_class)."  ".FORLAN_141.": ".r_userclass_name($forum_postclass)." -
"; - - if ($mode) - { - $text .= ""; - } - else - { - $forum_heading = str_replace("'", "\'", $forum_name); - $text .= " - - "; - } - $text .= "
".FORLAN_29."
".IMAGE_new."".$forum_name."" ; - - $text .= " -
".$forum_description."  -
".FORLAN_140.": ".r_userclass_name($forum_class)."  ".FORLAN_141.": ".r_userclass_name($forum_postclass)." - -
"; - - if ($mode) - { - $text .= ""; - } - else - { - $forum_heading = str_replace("'", "\'", $forum_name); - $sub_img = count($subList[$parent_id][$forum_id]) ? IMAGE_sub : IMAGE_nosub; - $text .= " - - "; - } - $text .= "
"; - $ns->tablerender(FORLAN_30, $text); - } - else - { - $text .= "\n\n\n\n\n\n"; - $ns->tablerender(FORLAN_37, $text); - } - - } - - function create_parents($sub_action, $id) - { - global $sql, $ns; - - if ($sub_action == "edit" && !$_POST['update_parent']) - { - if ($sql->db_Select("forum", "*", "forum_id=$id")) - { - $row = $sql->db_Fetch(); - extract($row); - } - } - $text = "
-
\n - - - - - - - - - - - - - - - - - - - - -
".FORLAN_31.": - -
".FORLAN_23.":
(".FORLAN_24.")
".r_userclass("forum_class", $forum_class, 'off', 'nobody,public,member,admin,classes')."
".FORLAN_142.":
(".FORLAN_143.")
".r_userclass("forum_postclass", $forum_postclass, 'off', 'nobody,public,member,admin,classes')."
"; - - if ($sub_action == "edit") - { - $text .= ""; - } - else - { - $text .= ""; - } - - $text .= "
-
-
"; - - $ns->tablerender(FORLAN_75, $text); - } - - function create_forums($sub_action, $id) - { - global $sql, $ns; - - if ($sub_action == "edit" && !$_POST['update_forum']) - { - if ($sql->db_Select("forum", "*", "forum_id=$id")) - { - $row = $sql->db_Fetch(); - extract($row); - } - } - - $text = "
-
\n - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
".FORLAN_22.":"; - - $sql->db_Select("forum", "*", "forum_parent=0"); - $text .= " -
".FORLAN_31.": -
".FORLAN_179."
-
- -
".FORLAN_32.": - -
".FORLAN_33.":
(".FORLAN_34.")
"; - $text .= r_userclass("forum_moderators", $forum_moderators, 'off', 'admin,classes'); - - // $admin_no = $sql->db_Select("user", "*", "user_admin='1' AND user_perms REGEXP('A.') OR user_perms='0' "); - // while ($row = $sql->db_Fetch()) - // { - // extract($row); - // $text .= ""; - // } - - $text .= "
".FORLAN_23.":
(".FORLAN_24.")
".r_userclass("forum_class", $forum_class, 'off', 'nobody,public,member,admin,classes')."
".FORLAN_142.":
(".FORLAN_143.")
".r_userclass("forum_postclass", $forum_postclass, 'off', 'nobody,public,member,admin,classes')."
"; - if ($sub_action == "edit") - { - $text .= ""; - } - else - { - $text .= ""; - } - $text .= "
-
-
"; - $ns->tablerender(FORLAN_28, $text); - } - - function show_message($message) - { - global $ns; - $ns->tablerender("", "
".$message."
"); - } - - function show_tools() - { - global $sql, $ns, $tp; - $txt = " -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
".FORLAN_156."
- "; - if($sql->db_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."
-
- -
-
- "; - $ns->tablerender(FORLAN_166, $txt); - } - - function show_prefs() - { - global $pref, $ns, $sql; - - if($sql->db_Count('plugin','(*)', "where plugin_path = 'poll' AND plugin_installflag = 1")) - { - $poll_installed = true; - } - else - { - $poll_installed = false; - if($pref['forum_poll'] == 1) - { - $pref['forum_poll'] = 0; - save_prefs(); - } - } - - $text = "
-
\n - - - - - - - - - - - - - - - - - - - - - - - - "; - if($poll_installed) - { - $text .= ""; - } - else - { - $text .= ""; - } - $text .= " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
".FORLAN_44."
".FORLAN_45."
".($pref['forum_enclose'] ? "" : "")."
".FORLAN_65."
".FORLAN_46."
".FORLAN_47."
".FORLAN_48."
".($pref['email_notify'] ? "" : "")."
".FORLAN_177."
".FORLAN_178."
".($pref['email_notify_on'] ? "" : "")."
".FORLAN_49."
".FORLAN_50."
".($pref['forum_poll'] ? "" : "")."".FORLAN_66."
".FORLAN_70."
".FORLAN_71." ".FORLAN_130." ". FORLAN_131.""; - - if(!$pref['image_post']) - { - $text .= "
".FORLAN_139.""; - } - - $text .= "
".($pref['forum_attach'] ? "" : "")."
".FORLAN_134."
".FORLAN_135."
".FORLAN_136."
".FORLAN_137."
".($pref['forum_linkimg'] ? "" : "")."
".FORLAN_51."
".FORLAN_52."
".($pref['forum_track'] ? "" : "")."
".FORLAN_112."
".FORLAN_113."
".($pref['forum_redirect'] ? "" : "")."
".FORLAN_116."
".FORLAN_122."
".($pref['reported_post_email'] ? "" : "")."
".FORLAN_126."
".FORLAN_127."
".($pref['forum_tooltip'] ? "" : "")."
".FORLAN_128."
".FORLAN_129."
".FORLAN_53."
".FORLAN_54."
".FORLAN_55."
".FORLAN_56."
".FORLAN_57."
".FORLAN_58."
".FORLAN_132."
".FORLAN_133."
".($pref['forum_hilightsticky'] ? "" : "")."
- -
-
-
"; - $ns->tablerender(FORLAN_62, $text); - } - - function show_reported ($sub_action, $id) - { - global $sql, $rs, $ns, $tp; - if ($sub_action) { - $sql -> db_Select("generic", "*", "gen_id='".$sub_action."'"); - $row = $sql -> db_Fetch(); - $sql -> db_Select("user", "*", "user_id='". $row['gen_user_id']."'"); - $user = $sql -> db_Fetch(); - $con = new convert; - $text = "
- - - - - - - - - - - - - - - - - - - - - - - \n"; - $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()." -
"; - $text .= "
"; - $ns -> tablerender(FORLAN_116, $text); - } else { - $text = "
"; - if ($reported_total = $sql->db_Select("generic", "*", "gen_type='reported_post' OR gen_type='Reported Forum Post'")) - { - $text .= " - - - - "; - while ($row = $sql->db_Fetch()) - { - $text .= " - - - \n"; - } - $text .= "
".FORLAN_170."".FORLAN_80."
".FORLAN_171." #".$row['gen_intdata']." - ".$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."
"; - } - $text .= "
"; - $ns->tablerender(FORLAN_116, $text); - } - } - - function show_prune() - { - global $ns, $sql; - - // $sql -> db_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 -> db_Select_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 .= "
- -
-
-
"; - $ns->tablerender(FORLAN_59, $text); - } - - function show_levels() - { - global $sql, $pref, $ns, $rs; - - $rank_names = explode(",", $pref['forum_levels']); - $rank_thresholds = ($pref['forum_thresholds'] ? explode(",", $pref['forum_thresholds']) : array(20, 100, 250, 410, 580, 760, 950, 1150, 1370, 1600)); - $rank_images = ($pref['forum_images'] ? explode(",", $pref['forum_images']) : array("lev1.png", "lev2.png", "lev3.png", "lev4.png", "lev5.png", "lev6.png", "lev7.png", "lev8.png", "lev9.png", "lev10.png")); - - $text = "
-
\n - - - - - - - - - - - - - "; - - $text .= " - - - - - - - - - - - - - - - - "; - - for($a = 0; $a <= 9; $a++) - { - $text .= " - - - - "; - } - - $text .= " - - -
".FORLAN_98."".FORLAN_102."
".FORLAN_104."
 ".FORLAN_99."".FORLAN_100."
 
 
 
- -
\n
\n
"; - $ns->tablerender("Ranks", $text); - } - - function show_mods() - { - global $sql, $ns, $for, $tp; - $forumList = $for->forum_getforums('all'); - $parentList = $for->forum_getparents('list'); - $subList = $for->forum_getsubs('bysub'); - - $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']}".r_userclass("mods[{$f['forum_id']}]", $f['forum_moderators'], 'off', 'admin,classes')."
    {$s['forum_name']}".r_userclass("mods[{$s['forum_id']}]", $s['forum_moderators'], 'off', 'admin,classes')."
- -
"; - $ns->tablerender(FORLAN_33, $txt); - } - - function show_rules() - { - global $sql, $pref, $ns, $tp; - - $sql->db_Select("wmessage"); - list($null) = $sql->db_Fetch(); - list($null) = $sql->db_Fetch(); - list($null) = $sql->db_Fetch(); - list($id, $guestrules, $wm_active4) = $sql->db_Fetch(); - list($id, $memberrules, $wm_active5) = $sql->db_Fetch(); - list($id, $adminrules, $wm_active6) = $sql->db_Fetch(); - - if($sql->db_Select('generic','*',"gen_type='forum_rules_guest'")) - { - $guest_rules = $sql->db_Fetch(); - } - if($sql->db_Select('generic','*',"gen_type='forum_rules_member'")) - { - $member_rules = $sql->db_Fetch(); - } - if($sql->db_Select('generic','*',"gen_type='forum_rules_admin'")) - { - $admin_rules = $sql->db_Fetch(); - } - - $guesttext = $tp->toFORM($guest_rules['gen_chardata']); - $membertext = $tp->toFORM($member_rules['gen_chardata']); - $admintext = $tp->toFORM($admin_rules['gen_chardata']); - - $text = " -
-
- - "; - - $text .= " - - - - - - - - - - - - - - - - - - - -
".WMGLAN_1.":
- ".WMGLAN_6.":"; - if ($guest_rules['gen_intdata']) - { - $text .= ""; - } - else - { - $text .= ""; - } - $text .= "
- -
- -
- ".display_help('helpb', 1, 'addtext1', 'help1')." -
".WMGLAN_2.":
- ".WMGLAN_6.":"; - if ($member_rules['gen_intdata']) - { - $text .= ""; - } - else - { - $text .= ""; - } - $text .= "
- -
- -
- ".display_help('helpb', 1, 'addtext2', 'help2')." -
".WMGLAN_3.":
- ".WMGLAN_6.": "; - - if ($admin_rules['gen_intdata']) - { - $text .= ""; - } - else - { - $text .= ""; - } - - $text .= "
- -
- -
- ".display_help('helpb', 1, 'addtext3', 'help3')." -
  - -
-
-
"; - - $ns->tablerender(WMGLAN_5, $text); - - echo " - - "; - - } - } function forum_admin_adminmenu() { diff --git a/e107_plugins/forum/forum_admin_class.php b/e107_plugins/forum/forum_admin_class.php new file mode 100755 index 000000000..97d33c140 --- /dev/null +++ b/e107_plugins/forum/forum_admin_class.php @@ -0,0 +1,1117 @@ +db_Select("forum", "*", "forum_parent='0' ")) + { + $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'] = FORLAN_59; + $var['prune']['link'] = e_SELF."?prune"; + $var['rank']['text'] = FORLAN_63; + $var['rank']['link'] = e_SELF."?rank"; + $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) + { + global $sql; + $id = intval($id); + $confirm = isset($_POST['confirm']) ? TRUE : FALSE; + + if($sql->db_Select('forum', '*', "forum_id = {$id}")) + { + $txt = ""; + $row = $sql->db_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) + { + global $sql; + $ret = ""; + if($sql->db_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->db_Delete("forum", "forum_id = {$id}")) + { + $ret .= "Forum parent successfully deleted"; + } + else + { + $ret .= "Forum parent could not be deleted"; + } + return $ret; + } + return "The forum parent has the following info:
".$ret; + + } + + function delete_forum($id, $confirm = FALSE) + { + global $sql, $tp; + $ret = ""; + if($sql->db_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) + { + $cnt = $sql->db_Delete("forum_t","thread_forum_id = {$id}"); + $ret .= $cnt." forum {$id} thread(s) deleted
"; + if($sql->db_Delete("forum", "forum_id = {$id}")) + { + $ret .= "Forum {$id} successfully deleted"; + } + else + { + $ret .= "Forum {$id} could not be deleted"; + } + return $ret; + } + + $sql->db_Select("forum", "*", "forum_id = {$id}"); + $row = $sql->db_Fetch(); + return "Forum {$id} [".$tp->toHTML($row['forum_name'])."] has {$row['forum_threads']} threads, {$row['forum_replies']} replies.
".$ret; + } + + function delete_sub($id, $confirm = FALSE) + { + global $sql, $tp; + if($confirm) + { + $cnt = $sql->db_Delete("forum_t","thread_forum_id = {$id}"); + $ret .= $cnt." Sub-forum {$id} thread(s) deleted
"; + if($sql->db_Delete("forum", "forum_id = {$id}")) + { + $ret .= "Sub-forum {$id} successfully deleted"; + } + else + { + $ret .= "Sub-forum {$id} could not be deleted"; + } + return $ret; + } + + $sql->db_Select("forum", "*", "forum_id = {$id}"); + $row = $sql->db_Fetch(); + return "Sub-forum {$id} [".$tp->toHTML($row['forum_name'])."] has {$row['forum_threads']} threads, {$row['forum_replies']} replies.
".$ret; + } + + function delete_show_confirm($txt) + { + global $ns; + $this->show_message($txt); + $txt = " +
+
".FORLAN_180."

+ +
+
+ "; + $ns->tablerender(FORLAN_181, $txt); + } + + function show_subs($id) + { + global $sql, $tp, $ns; + $txt = " +
+ + + + + + + + + "; + if($sql->db_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 .= " + + + + + + + + + + + + + + + + + +
".FORLAN_151."".FORLAN_31."".FORLAN_32."".FORLAN_37."".FORLAN_20."
{$sub['forum_id']} + ".ADMIN_DELETE_ICON." +
 
".FORLAN_146."
".FORLAN_151."".FORLAN_31."".FORLAN_32."".FORLAN_37." 
  
+
+ "; + $ns->tablerender(FORLAN_149, $txt); + } + + function show_existing_forums($sub_action, $id, $mode = false) + { + global $e107, $for; + + $subList = $for->forum_getsubs(); + + if (!$mode) + { + $text = "
"; + } + else + { + $text = "
"; + } + $text .= " + + + + + "; + + if (!$parent_amount = $e107->sql->db_Select('forum', '*', "forum_parent='0' ORDER BY forum_order ASC")) + { + $text .= ""; + } + else + { + while ($row = $e107->sql->db_Fetch(MYSQL_ASSOC)) + { + $parentList[] = $row; + } + foreach($parentList as $parent) + { + $text .= " + + "; + + $text .= ""; + + $forumCount = $e107->sql->db_Select('forum', '*', "forum_parent='".$parent['forum_id']."' AND forum_sub = 0 ORDER BY forum_order ASC"); + if (!$forumCount) + { + $text .= ""; + } + else + { + $forumList = array(); + while ($row = $e107->sql->db_Fetch(MYSQL_ASSOC)) + { + $forumList[] = $row; + } + foreach($forumList as $forum) + { + $text .= " + + \n\n + + \n"; + } + } + } + } + + if (!$mode) + { + $text .= "
".FORLAN_28."".FORLAN_80."
".FORLAN_29."
".$parent['forum_name']." +
".FORLAN_140.": ".r_userclass_name($parent['forum_class'])."  ".FORLAN_141.": ".r_userclass_name($parent['forum_postclass'])." +
"; + + if ($mode) + { + $text .= ""; + } + else + { + $text .= " + + "; + } + $text .= "
".FORLAN_29."
".IMAGE_new." 'view', 'id'=>$forum['forum_id']))."'>".$e107->tp->toHTML($forum['forum_name']).""; +// ".IMAGE_new."".$e107->tp->toHTML($forum['forum_name']).""; + + $text .= " +
".$e107->tp->toHTML($forum['forum_description'])."  +
".FORLAN_140.": ".r_userclass_name($forum['forum_class'])."  ".FORLAN_141.": ".r_userclass_name($forum['forum_postclass'])." + +
"; + + if ($mode) + { + $text .= ""; + } + else + { + $sub_img = count($subList[$forum['forum_parent']][$forum['forum_id']]) ? IMAGE_sub : IMAGE_nosub; + $text .= " + + "; + } + $text .= "
"; + $e107->ns->tablerender(FORLAN_30, $text); + } + else + { + $text .= "\n\n\n\n\n\n"; + $e107->ns->tablerender(FORLAN_37, $text); + } + + } + + function create_parents($sub_action, $id) + { + global $e107; + + $id = (int)$id; + if ($sub_action == 'edit' && !$_POST['update_parent']) + { + if ($e107->sql->db_Select('forum', '*', "forum_id=$id")) + { + $row = $e107->sql->db_Fetch(MYSQL_ASSOC); + } + } + $text = "
+
+ + + + + + + + + + + + + + + + + + + + +
".FORLAN_31.": + +
".FORLAN_23.":
(".FORLAN_24.")
".r_userclass("forum_class", $row['forum_class'], 'off', 'nobody,public,member,admin,classes')."
".FORLAN_142.":
(".FORLAN_143.")
".r_userclass("forum_postclass", $row['forum_postclass'], 'off', 'nobody,public,member,admin,classes')."
"; + + if ($sub_action == 'edit') + { + $text .= ""; + } + else + { + $text .= ""; + } + + $text .= "
+
+
"; + + $e107->ns->tablerender(FORLAN_75, $text); + } + + function create_forums($sub_action, $id) + { + global $e107; + + $id = (int)$id; + if ($sub_action == 'edit' && !$_POST['update_forum']) + { + if ($e107->sql->db_Select('forum', '*', "forum_id=$id")) + { + $fInfo = $e107->sql->db_Fetch(); + } + } + + $text = "
+
\n + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
".FORLAN_22.":"; + + $e107->sql->db_Select('forum', '*', 'forum_parent=0'); + $text .= " +
".FORLAN_31.": +
".FORLAN_179."
+
+ +
".FORLAN_32.": + +
".FORLAN_33.":
(".FORLAN_34.")
"; + $text .= r_userclass('forum_moderators', $fInfo['forum_moderators'], 'off', 'admin,classes'); + + $text .= "
".FORLAN_23.":
(".FORLAN_24.")
".r_userclass("forum_class", $fInfo['forum_class'], 'off', 'nobody,public,member,admin,classes')."
".FORLAN_142.":
(".FORLAN_143.")
".r_userclass("forum_postclass", $fInfo['forum_postclass'], 'off', 'nobody,public,member,admin,classes')."
"; + if ($sub_action == "edit") + { + $text .= ""; + } + else + { + $text .= ""; + } + $text .= "
+
+
"; + $e107->ns->tablerender(FORLAN_28, $text); + } + + function show_message($message) + { + global $e107; + $e107->ns->tablerender('', "
".$message."
"); + } + + function show_tools() + { + global $sql, $ns, $tp; + $txt = " +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
".FORLAN_156."
+ "; + if($sql->db_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."
+
+ +
+
+ "; + $ns->tablerender(FORLAN_166, $txt); + } + + function show_prefs() + { + global $pref, $ns, $sql; + + if($sql->db_Count('plugin','(*)', "where plugin_path = 'poll' AND plugin_installflag = 1")) + { + $poll_installed = true; + } + else + { + $poll_installed = false; + if($pref['forum_poll'] == 1) + { + $pref['forum_poll'] = 0; + save_prefs(); + } + } + + $text = "
+
\n + + + + + + + + + + + + + + + + + + + + + + + + "; + if($poll_installed) + { + $text .= ""; + } + else + { + $text .= ""; + } + $text .= " + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
".FORLAN_44."
".FORLAN_45."
".($pref['forum_enclose'] ? "" : "")."
".FORLAN_65."
".FORLAN_46."
".FORLAN_47."
".FORLAN_48."
".($pref['email_notify'] ? "" : "")."
".FORLAN_177."
".FORLAN_178."
".($pref['email_notify_on'] ? "" : "")."
".FORLAN_49."
".FORLAN_50."
".($pref['forum_poll'] ? "" : "")."".FORLAN_66."
".FORLAN_70."
".FORLAN_71." ".FORLAN_130." ". FORLAN_131.""; + + if(!$pref['image_post']) + { + $text .= "
".FORLAN_139.""; + } + + $text .= "
".($pref['forum_attach'] ? "" : "")."
".FORLAN_134."
".FORLAN_135."
".FORLAN_136."
".FORLAN_137."
".($pref['forum_linkimg'] ? "" : "")."
".FORLAN_51."
".FORLAN_52."
".($pref['forum_track'] ? "" : "")."
".FORLAN_112."
".FORLAN_113."
".($pref['forum_redirect'] ? "" : "")."
".FORLAN_116."
".FORLAN_122."
".($pref['reported_post_email'] ? "" : "")."
".FORLAN_126."
".FORLAN_127."
".($pref['forum_tooltip'] ? "" : "")."
".FORLAN_128."
".FORLAN_129."
".FORLAN_53."
".FORLAN_54."
".FORLAN_55."
".FORLAN_56."
".FORLAN_57."
".FORLAN_58."
".FORLAN_132."
".FORLAN_133."
".($pref['forum_hilightsticky'] ? "" : "")."
+ +
+
+
"; + $ns->tablerender(FORLAN_62, $text); + } + + function show_reported ($sub_action, $id) + { + global $sql, $rs, $ns, $tp; + if ($sub_action) { + $sql -> db_Select("generic", "*", "gen_id='".$sub_action."'"); + $row = $sql -> db_Fetch(); + $sql -> db_Select("user", "*", "user_id='". $row['gen_user_id']."'"); + $user = $sql -> db_Fetch(); + $con = new convert; + $text = "
+ + + + + + + + + + + + + + + + + + + + + + + \n"; + $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()." +
"; + $text .= "
"; + $ns -> tablerender(FORLAN_116, $text); + } else { + $text = "
"; + if ($reported_total = $sql->db_Select("generic", "*", "gen_type='reported_post' OR gen_type='Reported Forum Post'")) + { + $text .= " + + + + "; + while ($row = $sql->db_Fetch()) + { + $text .= " + + + \n"; + } + $text .= "
".FORLAN_170."".FORLAN_80."
".FORLAN_171." #".$row['gen_intdata']." + ".$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."
"; + } + $text .= "
"; + $ns->tablerender(FORLAN_116, $text); + } + } + + function show_prune() + { + global $ns, $sql; + + // $sql -> db_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 -> db_Select_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 .= "
+ +
+
+
"; + $ns->tablerender(FORLAN_59, $text); + } + + function show_levels() + { + global $sql, $pref, $ns, $rs; + + $rank_names = explode(",", $pref['forum_levels']); + $rank_thresholds = ($pref['forum_thresholds'] ? explode(",", $pref['forum_thresholds']) : array(20, 100, 250, 410, 580, 760, 950, 1150, 1370, 1600)); + $rank_images = ($pref['forum_images'] ? explode(",", $pref['forum_images']) : array("lev1.png", "lev2.png", "lev3.png", "lev4.png", "lev5.png", "lev6.png", "lev7.png", "lev8.png", "lev9.png", "lev10.png")); + + $text = "
+
\n + + + + + + + + + + + + + "; + + $text .= " + + + + + + + + + + + + + + + + "; + + for($a = 0; $a <= 9; $a++) + { + $text .= " + + + + "; + } + + $text .= " + + +
".FORLAN_98."".FORLAN_102."
".FORLAN_104."
 ".FORLAN_99."".FORLAN_100."
 
 
 
+ +
\n
\n
"; + $ns->tablerender("Ranks", $text); + } + + function show_mods() + { + global $sql, $ns, $for, $tp; + $forumList = $for->forum_getforums('all'); + $parentList = $for->forum_getparents('list'); + $subList = $for->forum_getsubs('bysub'); + + $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']}".r_userclass("mods[{$f['forum_id']}]", $f['forum_moderators'], 'off', 'admin,classes')."
    {$s['forum_name']}".r_userclass("mods[{$s['forum_id']}]", $s['forum_moderators'], 'off', 'admin,classes')."
+ +
"; + $ns->tablerender(FORLAN_33, $txt); + } + + function show_rules() + { + global $sql, $pref, $ns, $tp; + + $sql->db_Select("wmessage"); + list($null) = $sql->db_Fetch(); + list($null) = $sql->db_Fetch(); + list($null) = $sql->db_Fetch(); + list($id, $guestrules, $wm_active4) = $sql->db_Fetch(); + list($id, $memberrules, $wm_active5) = $sql->db_Fetch(); + list($id, $adminrules, $wm_active6) = $sql->db_Fetch(); + + if($sql->db_Select('generic','*',"gen_type='forum_rules_guest'")) + { + $guest_rules = $sql->db_Fetch(); + } + if($sql->db_Select('generic','*',"gen_type='forum_rules_member'")) + { + $member_rules = $sql->db_Fetch(); + } + if($sql->db_Select('generic','*',"gen_type='forum_rules_admin'")) + { + $admin_rules = $sql->db_Fetch(); + } + + $guesttext = $tp->toFORM($guest_rules['gen_chardata']); + $membertext = $tp->toFORM($member_rules['gen_chardata']); + $admintext = $tp->toFORM($admin_rules['gen_chardata']); + + $text = " +
+
+ + "; + + $text .= " + + + + + + + + + + + + + + + + + + + +
".WMGLAN_1.":
+ ".WMGLAN_6.":"; + if ($guest_rules['gen_intdata']) + { + $text .= ""; + } + else + { + $text .= ""; + } + $text .= "
+ +
+ +
+ ".display_help('helpb', 1, 'addtext1', 'help1')." +
".WMGLAN_2.":
+ ".WMGLAN_6.":"; + if ($member_rules['gen_intdata']) + { + $text .= ""; + } + else + { + $text .= ""; + } + $text .= "
+ +
+ +
+ ".display_help('helpb', 1, 'addtext2', 'help2')." +
".WMGLAN_3.":
+ ".WMGLAN_6.": "; + + if ($admin_rules['gen_intdata']) + { + $text .= ""; + } + else + { + $text .= ""; + } + + $text .= "
+ +
+ +
+ ".display_help('helpb', 1, 'addtext3', 'help3')." +
  + +
+
+
"; + + $ns->tablerender(WMGLAN_5, $text); + + echo " + + "; + + } + } diff --git a/e107_plugins/forum/forum_class.php b/e107_plugins/forum/forum_class.php index df07aebdb..db9eb03b4 100644 --- a/e107_plugins/forum/forum_class.php +++ b/e107_plugins/forum/forum_class.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_class.php,v $ -| $Revision: 1.6 $ -| $Date: 2008-10-03 19:27:56 $ -| $Author: e107steved $ +| $Revision: 1.7 $ +| $Date: 2008-11-26 03:24:51 $ +| $Author: mcfly_e107 $ +----------------------------------------------------------------------------+ */ if (!defined('e107_INIT')) { exit; } @@ -201,19 +201,19 @@ class e107forum return FALSE; } - function forum_getsubs($forum_id = "") + function forum_getsubs($forum_id = '') { global $sql; - $where = ($forum_id != "" && $forum_id != 'bysub' ? "AND forum_sub = ".intval($forum_id) : ""); + $where = ($forum_id != '' && $forum_id != 'bysub' ? "AND forum_sub = ".(int)$forum_id : ''); $qry = " SELECT f.*, u.user_name FROM #forum AS f - LEFT JOIN #user AS u ON SUBSTRING_INDEX(f.forum_lastpost_user,'.',1) = u.user_id + LEFT JOIN #user AS u ON f.forum_lastpost_user = u.user_id WHERE forum_sub != 0 {$where} ORDER BY f.forum_order ASC "; if ($sql->db_Select_gen($qry)) { - while ($row = $sql->db_Fetch()) + while ($row = $sql->db_Fetch(MYSQL_ASSOC)) { if($forum_id == "") { @@ -230,7 +230,7 @@ class e107forum } return $ret; } - return FALSE; + return false; } diff --git a/e107_plugins/forum/forum_sql.php b/e107_plugins/forum/forum_sql.php index 375213db3..665fd0ef2 100644 --- a/e107_plugins/forum/forum_sql.php +++ b/e107_plugins/forum/forum_sql.php @@ -1,39 +1,66 @@ -CREATE TABLE forum ( - forum_id int(10) unsigned NOT NULL auto_increment, - forum_name varchar(250) NOT NULL default '', - forum_description text NOT NULL, - forum_parent int(10) unsigned NOT NULL default '0', - forum_sub int(10) unsigned NOT NULL default '0', - forum_datestamp int(10) unsigned NOT NULL default '0', - forum_moderators text NOT NULL, - forum_threads int(10) unsigned NOT NULL default '0', - forum_replies int(10) unsigned NOT NULL default '0', - forum_lastpost_user varchar(200) NOT NULL default '', - forum_lastpost_info varchar(40) NOT NULL default '', - forum_class varchar(100) NOT NULL default '', - forum_order int(10) unsigned NOT NULL default '0', - forum_postclass tinyint(3) unsigned NOT NULL default '0', - PRIMARY KEY (forum_id) - ) TYPE=MyISAM; +CREATE TABLE forum ( + `forum_id` int(10) unsigned NOT NULL auto_increment, + `forum_name` varchar(250) NOT NULL default '', + `forum_description` text, + `forum_parent` int(10) unsigned NOT NULL default '0', + `forum_sub` int(10) unsigned NOT NULL default '0', + `forum_datestamp` int(10) unsigned NOT NULL default '0', + `forum_moderators` text, + `forum_threads` int(10) unsigned NOT NULL default '0', + `forum_replies` int(10) unsigned NOT NULL default '0', + `forum_lastpost_user` int(10) unsigned default NULL, + `forum_lastpost_info` varchar(40) default NULL, + `forum_class` varchar(100) NOT NULL default '', + `forum_order` int(10) unsigned NOT NULL default '0', + `forum_postclass` text NOT NULL, + `forum_threadclass` text, + `forum_options` text, + PRIMARY KEY (`forum_id`), + KEY `forum_parent` (`forum_parent`), + KEY `forum_sub` (`forum_sub`) +) Type=MyISAM AUTO_INCREMENT=1 ; -CREATE TABLE forum_t ( - thread_id int(10) unsigned NOT NULL auto_increment, - thread_name varchar(250) NOT NULL default '', - thread_thread text NOT NULL, - thread_forum_id int(10) unsigned NOT NULL default '0', - thread_datestamp int(10) unsigned NOT NULL default '0', - thread_parent int(10) unsigned NOT NULL default '0', - thread_user varchar(250) NOT NULL default '', - thread_views int(10) unsigned NOT NULL default '0', - thread_active tinyint(3) unsigned NOT NULL default '0', - thread_lastpost int(10) unsigned NOT NULL default '0', - thread_s tinyint(1) unsigned NOT NULL default '0', - thread_edit_datestamp int(10) unsigned NOT NULL default '0', - thread_lastuser varchar(30) NOT NULL default '', - thread_total_replies int(10) unsigned NOT NULL default '0', - PRIMARY KEY (thread_id), - KEY thread_parent (thread_parent), - KEY thread_datestamp (thread_datestamp), - KEY thread_forum_id (thread_forum_id) - ) TYPE=MyISAM; +CREATE TABLE forum_thread ( + `thread_id` int(10) unsigned NOT NULL auto_increment, + `thread_name` varchar(250) NOT NULL default '', + `thread_thread` text NOT NULL, + `thread_forum_id` int(10) unsigned NOT NULL default '0', + `thread_views` int(10) unsigned NOT NULL default '0', + `thread_active` tinyint(3) unsigned NOT NULL default '0', + `thread_lastpost` int(10) unsigned NOT NULL default '0', + `thread_s` tinyint(1) unsigned NOT NULL default '0', + `thread_lastuser` int(10) unsigned NOT NULL, + `thread_total_replies` int(10) unsigned NOT NULL default '0', + `thread_options` text, + PRIMARY KEY (`thread_id`), + KEY `thread_forum_id` (`thread_forum_id`), + KEY `thread_s` (`thread_s`), + KEY `thread_lastpost` (`thread_lastpost`) +) Type=MyISAM AUTO_INCREMENT=1 ; + +CREATE TABLE forum_post ( + `post_id` int(10) unsigned NOT NULL auto_increment, + `post_entry` text NOT NULL, + `post_thread` int(10) unsigned NOT NULL default '0', + `post_datestamp` int(10) unsigned NOT NULL default '0', + `post_user` int(10) unsigned NOT NULL, + `post_edit_datestamp` int(10) unsigned NOT NULL default '0', + `post_edit_user` int(10) unsigned NOT NULL, + `post_ip` varchar(45) NOT NULL, + `post_attachments` text NOT NULL, + `post_options` text, + PRIMARY KEY (`post_id`), + KEY `post_ip` (`post_ip`), + KEY `post_thread` (`post_thread`), + KEY `post_datestamp` (`post_datestamp`), + KEY `post_user` (`post_user`) +) Type=MyISAM AUTO_INCREMENT=1 ; + +CREATE TABLE forum_track ( + `track_userid` int(10) unsigned NOT NULL, + `track_threadid` int(10) unsigned NOT NULL, + PRIMARY KEY (`track_userid`,`track_threadid`), + KEY `track_userid` (`track_userid`), + KEY `track_threadid` (`track_threadid`) +) Type=MyISAM; diff --git a/e107_plugins/forum/plugin.xml b/e107_plugins/forum/plugin.xml index 73eaba852..9beedcdea 100755 --- a/e107_plugins/forum/plugin.xml +++ b/e107_plugins/forum/plugin.xml @@ -1,15 +1,13 @@ Forum - 1.2 + 2.0 e107dev http://e107.org This plugin is a fully featured Forum system 0.8 true forum - forum1 - forum2 forum_admin.php images/forums_32.png @@ -18,7 +16,6 @@ Your forum is now installed - @@ -30,15 +27,10 @@ - - - - - - - + + diff --git a/e107_plugins/forum/url/forum.php b/e107_plugins/forum/url/forum.php new file mode 100755 index 000000000..41b4aede6 --- /dev/null +++ b/e107_plugins/forum/url/forum.php @@ -0,0 +1,11 @@ +forum_get($forum_id); + +if (!check_class($forum_info['forum_class']) || !check_class($forum_info['parent_class']) || !$forum_info['forum_parent']) +{ + header("Location:".e_PLUGIN."forum/forum.php"); + exit; +} + +if (!$FORUM_VIEW_START) { + if (file_exists(THEME."forum_viewforum_template.php")) + { + require_once(THEME."forum_viewforum_template.php"); + } + else if (file_exists(THEME."forum_template.php")) + { + require_once(THEME."forum_template.php"); + } + else + { + require_once(e_PLUGIN."forum/templates/forum_viewforum_template.php"); + } +} + + +$forum_info['forum_name'] = $tp->toHTML($forum_info['forum_name'], TRUE, 'no_hook, emotes_off'); +$forum_info['forum_description'] = $tp->toHTML($forum_info['forum_description'], TRUE, 'no_hook'); + +$_forum_name = (substr($forum_info['forum_name'], 0, 1) == "*" ? substr($forum_info['forum_name'], 1) : $forum_info['forum_name']); +define("e_PAGETITLE", LAN_01." / ".$_forum_name); +define("MODERATOR", $forum_info['forum_moderators'] != "" && check_class($forum_info['forum_moderators'])); +$modArray = $forum->forum_getmods($forum_info['forum_moderators']); +$message = ""; +if (MODERATOR) +{ + if ($_POST) + { + require_once(e_PLUGIN."forum/forum_mod.php"); + $message = forum_thread_moderate($_POST); + } +} + +$member_users = $sql->db_Select("online", "*", "online_location REGEXP('forum_viewforum.php.$forum_id') AND online_user_id!='0' "); +$guest_users = $sql->db_Select("online", "*", "online_location REGEXP('forum_viewforum.php.$forum_id') AND online_user_id='0' "); +$users = $member_users+$guest_users; + +require_once(HEADERF); +$text=''; +if ($message) +{ + $ns->tablerender("", $message, array('forum_viewforum', 'msg')); +} + +$topics = $forum->forum_get_topic_count($forum_id); + +if ($topics > $view) +{ + $pages = ceil($topics/$view); +} +else +{ + $pages = FALSE; +} + +if ($pages) +{ + if(strpos($FORUM_VIEW_START, 'THREADPAGES') !== FALSE || strpos($FORUM_VIEW_END, 'THREADPAGES') !== FALSE) + { + $parms = "{$topics},{$view},{$thread_from},".e_SELF.'?'.$forum_id.'.[FROM],off'; + $THREADPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}"); + } +} + +if (check_class($forum_info['forum_postclass']) && check_class($forum_info['parent_postclass'])) +{ + $NEWTHREADBUTTON = "".IMAGE_newthread.""; +} + +if(substr($forum_info['forum_name'], 0, 1) == "*") +{ + $forum_info['forum_name'] = substr($forum_info['forum_name'], 1); + $container_only = true; +} +else +{ + $container_only = false; +} + +if(substr($forum_info['sub_parent'], 0, 1) == "*") +{ + $forum_info['sub_parent'] = substr($forum_info['sub_parent'], 1); +} + +$forum->set_crumb(); // set $BREADCRUMB (and $BACKLINK) + +$FORUMTITLE = $forum_info['forum_name']; +//$MODERATORS = LAN_404.": ".$forum_info['forum_moderators']; +$MODERATORS = LAN_404.": ".implode(", ", $modArray); +$BROWSERS = $users." ".($users == 1 ? LAN_405 : LAN_406)." (".$member_users." ".($member_users == 1 ? LAN_407 : LAN_409).", ".$guest_users." ".($guest_users == 1 ? LAN_408 : LAN_410).")"; + +$ICONKEY = " + + + + + + + + + + + + + + + + + + + + + +
".IMAGE_new_small."".LAN_79."".IMAGE_nonew_small."".LAN_80."".IMAGE_sticky_small."".LAN_202."".IMAGE_announce_small."".LAN_396."
".IMAGE_new_popular_small."".LAN_79." ".LAN_395."".IMAGE_nonew_popular_small."".LAN_80." ".LAN_395."".IMAGE_stickyclosed_small."".LAN_203."".IMAGE_closed_small."".LAN_81."
"; + +$SEARCH = " +
+

+ + + + +

+
"; + +if(check_class($forum_info['forum_postclass'])) +{ + $PERMS = LAN_204." - ".LAN_206." - ".LAN_208; +} +else +{ + $PERMS = LAN_205." - ".LAN_207." - ".LAN_209; +} + +$sticky_threads = 0; +$stuck = FALSE; +$reg_threads = 0; +$unstuck = FALSE; + +$thread_list = $forum->forum_get_topics($forum_id, $thread_from, $view); +$sub_list = $forum->forum_getsubs($forum_id); +//print_a($sub_list); +$gen = new convert; + +$SUBFORUMS = ""; +if(is_array($sub_list)) +{ + $newflag_list = $forum->forum_newflag_list(); + $sub_info = ""; + foreach($sub_list as $sub) + { + $sub_info .= parse_sub($sub); + } + $SUBFORUMS = $FORUM_VIEW_SUB_START.$sub_info.$FORUM_VIEW_SUB_END; +} + + +if (count($thread_list) ) +{ + foreach($thread_list as $thread_info) { + $idArray[] = $thread_info['thread_id']; + } + $inList = '('.implode(',', $idArray).')'; + foreach($thread_list as $thread_info) { + if ($thread_info['thread_s']) { + $sticky_threads ++; + } + if ($sticky_threads > 0 && !$stuck && $pref['forum_hilightsticky']) + { + if($FORUM_IMPORTANT_ROW) + { + $forum_view_forum .= $FORUM_IMPORTANT_ROW; + } + else + { + $forum_view_forum .= " ".LAN_411.""; + } + $stuck = TRUE; + } + if (!$thread_info['thread_s']) + { + $reg_threads ++; + } + if ($reg_threads == "1" && !$unstuck && $stuck) + { + if($FORUM_NORMAL_ROW) + { + $forum_view_forum .= $FORUM_NORMAL_ROW; + } + else + { + $forum_view_forum .= " ".LAN_412.""; + } + $unstuck = TRUE; + } + $forum_view_forum .= parse_thread($thread_info); + } +} +else +{ + $forum_view_forum .= "".LAN_58.""; +} + +$sql->db_Select("forum", "*", "forum_parent !=0 AND forum_class!='255' "); +$FORUMJUMP = forumjump(); +$TOPLINK = "".LAN_02.""; + +if($container_only) +{ + $FORUM_VIEW_START = ($FORUM_VIEW_START_CONTAINER ? $FORUM_VIEW_START_CONTAINER : $FORUM_VIEW_START); + $FORUM_VIEW_END = ($FORUM_VIEW_END_CONTAINER ? $FORUM_VIEW_END_CONTAINER : $FORUM_VIEW_END); + $forum_view_forum = ""; +} + +$forum_view_start = preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_VIEW_START); +$forum_view_end = preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_VIEW_END); + + +if ($pref['forum_enclose']) +{ + $ns->tablerender($pref['forum_title'], $forum_view_start.$forum_view_subs.$forum_view_forum.$forum_view_end, array('forum_viewforum', 'main1')); +} +else +{ + echo $forum_view_start.$forum_view_forum.$forum_view_end; +} + +echo ""; + +require_once(FOOTERF); + + +function parse_thread($thread_info) +{ + global $forum, $tp, $FORUM_VIEW_FORUM, $FORUM_VIEW_FORUM_STICKY, $FORUM_VIEW_FORUM_ANNOUNCE, $gen, $pref, $forum_id, $menu_pref; + $text = ""; + $VIEWS = $thread_info['thread_views']; + $REPLIES = $thread_info['thread_total_replies']; + + + if ($REPLIES) + { + $lastpost_datestamp = $gen->convert_date($thread_info['thread_lastpost'], 'forum'); + $tmp = explode(".", $thread_info['thread_lastuser'], 2); + if($thread_info['lastpost_username']) + { + $LASTPOST = "".$thread_info['lastpost_username'].""; + } + else + { + if($tmp[1]) + { + $LASTPOST = $tp->toHTML($tmp[1]); + } + else + { + $LASTPOST = FORLAN_19; + } + } + $LASTPOST .= "
".$lastpost_datestamp; + } + + $newflag = FALSE; + if (USER) + { + if ($thread_info['thread_lastpost'] > USERLV && !preg_match("#\b".$thread_info['thread_id']."\b#", USERVIEWED)) + { + $newflag = TRUE; + } + } + + $THREADDATE = $gen->convert_date($thread_info['thread_datestamp'], 'forum'); + $ICON = ($newflag ? IMAGE_new : IMAGE_nonew); + if ($REPLIES >= $pref['forum_popular']) + { + $ICON = ($newflag ? IMAGE_new_popular : IMAGE_nonew_popular); + } + + $THREADTYPE = ''; + if ($thread_info['thread_s'] == 1) + { + $ICON = ($thread_info['thread_active'] ? IMAGE_sticky : IMAGE_stickyclosed); + $THREADTYPE = '['.LAN_202.']
'; + } + elseif($thread_info['thread_s'] == 2) + { + $ICON = IMAGE_announce; + $THREADTYPE = '['.LAN_396.']
'; + } + elseif(!$thread_info['thread_active']) + { + $ICON = IMAGE_closed; + } + + $thread_name = strip_tags($tp->toHTML($thread_info['thread_name'], false, 'no_hook, emotes_off')); + if (strtoupper($THREADTYPE) == strtoupper(substr($thread_name, 0, strlen($THREADTYPE)))) { + $thread_name = substr($thread_name, strlen($THREADTYPE)); + } + if ($pref['forum_tooltip']) { + $thread_thread = strip_tags($tp->toHTML($thread_info['thread_thread'], true, 'no_hook')); + $tip_length = ($pref['forum_tiplength'] ? $pref['forum_tiplength'] : 400); + if (strlen($thread_thread) > $tip_length) { + $thread_thread = substr($thread_thread, 0, $tip_length)." ".$menu_pref['newforumposts_postfix']; + } + $thread_thread = str_replace("'", "'", $thread_thread); + $title = "title='".$thread_thread."'"; + } else { + $title = ""; + } + $THREADNAME = "{$thread_name}"; + + $pages = ceil(($REPLIES+1)/$pref['forum_postspage']); + if ($pages > 1) + { + if($pages > 6) + { + for($a = 0; $a <= 2; $a++) + { + $PAGES .= $PAGES ? " " : ""; + $PAGES .= "".($a+1).""; + } + $PAGES .= " ... "; + for($a = $pages-3; $a <= $pages-1; $a++) + { + $PAGES .= $PAGES ? " " : ""; + $PAGES .= "".($a+1).""; + } + } + else + { + for($a = 0; $a <= ($pages-1); $a++) + { + $PAGES .= $PAGES ? " " : ""; + $PAGES .= "".($a+1).""; + } + } + $PAGES = LAN_316." [ ".$PAGES." ]"; + } + else + { + $PAGES = ""; + } + + if (MODERATOR) + { + $thread_id = $thread_info['thread_id']; + $ADMIN_ICONS = " +
+ "; + + $ADMIN_ICONS .= " \n"; + + $ADMIN_ICONS .= ($thread_info['thread_s'] == 1) ? " " : + " "; + $ADMIN_ICONS .= ($thread_info['thread_active']) ? " " : + " "; + $ADMIN_ICONS .= "".IMAGE_admin_move.""; + $ADMIN_ICONS .= " +
+ "; + } + + $text .= " + ".$THREADDATE."
+ "; + $tmp = explode(".", $thread_info['thread_user'], 2); + if($thread_info['user_name']) + { + $POSTER = "".$thread_info['user_name'].""; + } + else + { + if($tmp[1]) + { + $x = explode(chr(1), $tmp[1]); + $POSTER = $tp->toHTML($x[0]); + } + else + { + $POSTER = FORLAN_19; + } + } + + if ($thread_info['thread_s'] == 1 && $FORUM_VIEW_FORUM_STICKY) + { + return(preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_VIEW_FORUM_STICKY)); + } + + if ($thread_info['thread_s'] == 2 && $FORUM_VIEW_FORUM_ANNOUNCE) + { + return(preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_VIEW_FORUM_ANNOUNCE)); + } + + if (!$REPLIES) + { + $REPLIES = LAN_317; // 'None' + $LASTPOST = " - "; + } + + return(preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_VIEW_FORUM)); +} + +function parse_sub($subInfo) +{ + global $FORUM_VIEW_SUB, $gen, $tp, $newflag_list; + $SUB_FORUMTITLE = "{$subInfo['forum_name']}"; + $SUB_DESCRIPTION = $tp->toHTML($subInfo['forum_description'], false, 'no_hook'); + $SUB_THREADS = $subInfo['forum_threads']; + $SUB_REPLIES = $subInfo['forum_replies']; + if(USER && is_array($newflag_list) && in_array($subInfo['forum_id'], $newflag_list)) + { + $NEWFLAG = "".IMAGE_new.""; + } + else + { + $NEWFLAG = IMAGE_nonew; + } + + if($subInfo['forum_lastpost_info']) + { + $tmp = explode(".", $subInfo['forum_lastpost_info']); + $lp_thread = "".IMAGE_post2.""; + $lp_date = $gen->convert_date($tmp[0], 'forum'); + $tmp = explode(".", $subInfo['forum_lastpost_user'],2); + if($subInfo['user_name']) + { + $lp_name = "{$subInfo['user_name']}"; + } + else + { + $lp_name = $tmp[1]; + } + $SUB_LASTPOST = $lp_date."
".$lp_name." ".$lp_thread; + } + else + { + $SUB_LASTPOST = "-"; + } + return (preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_VIEW_SUB)); +} + +function forumjump() +{ + global $forum; + $jumpList = $forum->forum_get_allowed(); + $text = "

".LAN_403.":     ".LAN_02."

"; + return $text; +} + +?> \ No newline at end of file