diff --git a/e107_plugins/forum/forum_admin.php b/e107_plugins/forum/forum_admin.php index 3990c6972..d1ea7e54b 100644 --- a/e107_plugins/forum/forum_admin.php +++ b/e107_plugins/forum/forum_admin.php @@ -17,10 +17,8 @@ if (!getperms('P')) } -e107::lan('forum', 'admin',true); -e107::lan('forum','front', true); -//e107::includeLan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/English_admin.php'); -//e107::lan('forum','', 'front'); +e107::lan('forum', 'admin', true); +e107::lan('forum', 'front', true); e107::css('inline'," @@ -45,7 +43,6 @@ if(!deftrue('OLD_FORUMADMIN')) class forum_admin extends e_admin_dispatcher { - protected $modes = array( 'main' => array( @@ -75,23 +72,22 @@ if(!deftrue('OLD_FORUMADMIN')) ); - protected $adminMenu = array( + 'main/list' => array('caption' => LAN_MANAGE, 'perm' => 'P'), + 'main/create' => array('caption' => LAN_CREATE, 'perm' => 'P'), - 'main/list' => array('caption'=> LAN_MANAGE, 'perm' => 'P'), - 'main/create' => array('caption'=> LAN_CREATE, 'perm' => 'P'), - 'main/opt1' => array('divider'=>true), + 'main/opt1' => array('divider' => true), + 'main/rules' => array('caption' => WMGLAN_5, 'perm' => 'P'), + 'mods/list' => array('caption' => LAN_FORUM_2003, 'perm'=>'P'), + 'main/prefs' => array('caption' => LAN_PREFS, 'perm' => 'P'), - 'main/rules' => array('caption'=> WMGLAN_5, 'perm' => 'P'), - 'mods/list' => array('caption'=> LAN_FORUM_2003, 'perm'=>'P'), - 'main/prefs' => array('caption'=> LAN_PREFS, 'perm' => 'P'), - 'main/opt2' => array('divider'=>true), - 'report/list' => array('caption'=> FORLAN_116, 'perm'=>'P'), - 'post/list' => array('caption'=>LAN_PLUGIN_FORUM_LATESTPOSTS, 'perm'=>'P'), - 'main/prune' => array('caption'=> LAN_PRUNE, 'perm' => 'P'), - 'main/tools' => array('caption'=>FORLAN_153, 'perm'=>'p') + 'main/opt2' => array('divider' => true), + 'report/list' => array('caption' => FORLAN_116, 'perm'=>'P'), + 'post/list' => array('caption' => LAN_PLUGIN_FORUM_LATESTPOSTS, 'perm'=>'P'), + 'main/prune' => array('caption' => LAN_PRUNE, 'perm' => 'P'), + 'main/tools' => array('caption' => FORLAN_153, 'perm'=>'p') ); protected $adminMenuAliases = array( @@ -100,25 +96,16 @@ if(!deftrue('OLD_FORUMADMIN')) protected $menuTitle = LAN_PLUGIN_FORUM_NAME; - function init() { if(E107_DEBUG_LEVEL > 0) { $this->adminMenu['opt3'] = array('divider'=>true); $this->adminMenu['main/update'] = array('caption'=>"Redo v1.x Forum Upgrade", 'perm'=>0, 'uri'=>'{e_PLUGIN}forum/forum_update.php'); - - - } - } } - - - - class forum_ui extends e_admin_ui { @@ -177,30 +164,25 @@ if(!deftrue('OLD_FORUMADMIN')) protected $prefs = array( - 'enclose' => array('title'=> FORLAN_44, 'type'=>'boolean', 'data' => 'int','help'=>FORLAN_45), - 'title' => array('title'=> FORLAN_65, 'type'=>'text', 'data' => 'str','help'=>''), - 'notify' => array('title'=> FORLAN_47, 'type'=>'boolean', 'data' => 'int','help'=>FORLAN_48), - 'notify_on' => array('title'=> FORLAN_177, 'type'=>'boolean', 'data' => 'int','help'=>FORLAN_178), - 'poll' => array('title'=> FORLAN_49, 'type'=>'userclass', 'data' => 'int','help'=>FORLAN_50), - 'attach' => array('title'=> FORLAN_70, 'type'=>'boolean', 'data' => 'str','help'=>FORLAN_71), - 'maxwidth' => array('title'=> FORLAN_134, 'type'=>'number', 'data' => 'str','help'=>FORLAN_135), - 'linkimg' => array('title'=> FORLAN_136, 'type'=>'boolean', 'data' => 'int','help'=>FORLAN_137), - 'track' => array('title'=> FORLAN_200, 'type'=>'boolean', 'data' => 'int','help'=>FORLAN_201), - 'trackemail' => array('title'=> FORLAN_202, 'type'=>'boolean', 'data' => 'int','help'=>FORLAN_203), - 'redirect' => array('title'=> FORLAN_112, 'type'=>'boolean', 'data' => 'int','help'=>FORLAN_113), - 'reported_post_email' => array('title'=> FORLAN_116, 'type'=>'boolean', 'data' => 'int','help'=>FORLAN_122), - 'tooltip' => array('title'=> FORLAN_126, 'type'=>'boolean', 'data' => 'int','help'=>FORLAN_127), - 'ranks' => array('title'=> FORLAN_63, 'type'=>'boolean', 'data' => 'int','help'=>''), - - 'tiplength' => array('title'=> FORLAN_128, 'type'=>'number', 'data' => 'int','help'=>FORLAN_129), - 'eprefix' => array('title'=> FORLAN_53, 'type'=>'text', 'data' => 'string','help'=>FORLAN_54), - 'popular' => array('title'=> FORLAN_55, 'type'=>'number', 'data' => 'int','help'=>FORLAN_56), - 'postspage' => array('title'=> FORLAN_57, 'type'=>'number', 'data' => 'int','help'=>FORLAN_58), - 'threadspage' => array('title'=> FORLAN_186, 'type'=>'number', 'data' => 'int','help'=>FORLAN_187), - - - - + 'enclose' => array('title' => FORLAN_44, 'type'=>'boolean', 'data' => 'int','help'=>FORLAN_45), + 'title' => array('title' => FORLAN_65, 'type'=>'text', 'data' => 'str','help'=>''), + 'notify' => array('title' => FORLAN_47, 'type'=>'boolean', 'data' => 'int','help'=>FORLAN_48), + 'notify_on' => array('title' => FORLAN_177, 'type'=>'boolean', 'data' => 'int','help'=>FORLAN_178), + 'poll' => array('title' => FORLAN_49, 'type'=>'userclass', 'data' => 'int','help'=>FORLAN_50), + 'attach' => array('title' => FORLAN_70, 'type'=>'boolean', 'data' => 'str','help'=>FORLAN_71), + 'maxwidth' => array('title' => FORLAN_134, 'type'=>'number', 'data' => 'str','help'=>FORLAN_135), + 'linkimg' => array('title' => FORLAN_136, 'type'=>'boolean', 'data' => 'int','help'=>FORLAN_137), + 'track' => array('title' => FORLAN_200, 'type'=>'boolean', 'data' => 'int','help'=>FORLAN_201), + 'trackemail' => array('title' => FORLAN_202, 'type'=>'boolean', 'data' => 'int','help'=>FORLAN_203), + 'redirect' => array('title' => FORLAN_112, 'type'=>'boolean', 'data' => 'int','help'=>FORLAN_113), + 'reported_post_email' => array('title' => FORLAN_116, 'type'=>'boolean', 'data' => 'int','help'=>FORLAN_122), + 'tooltip' => array('title' => FORLAN_126, 'type'=>'boolean', 'data' => 'int','help'=>FORLAN_127), + 'ranks' => array('title' => FORLAN_63, 'type'=>'boolean', 'data' => 'int','help'=>''), + 'tiplength' => array('title' => FORLAN_128, 'type'=>'number', 'data' => 'int','help'=>FORLAN_129), + 'eprefix' => array('title' => FORLAN_53, 'type'=>'text', 'data' => 'string','help'=>FORLAN_54), + 'popular' => array('title' => FORLAN_55, 'type'=>'number', 'data' => 'int','help'=>FORLAN_56), + 'postspage' => array('title' => FORLAN_57, 'type'=>'number', 'data' => 'int','help'=>FORLAN_58), + 'threadspage' => array('title' => FORLAN_186, 'type'=>'number', 'data' => 'int','help'=>FORLAN_187), ); public $forumParents = array(); @@ -234,11 +216,7 @@ if(!deftrue('OLD_FORUMADMIN')) $sql2->update('forum', 'forum_order = '.$c.' WHERE forum_id = '.$row['forum_id'].' LIMIT 1'); } - - } - - } @@ -247,13 +225,11 @@ if(!deftrue('OLD_FORUMADMIN')) $this->checkOrder(); - if(e107::isInstalled('poll') == false) { $this->prefs['poll']['writeParms']['post'] = " ".FORLAN_215.""; } - if($this->getMode() == 'mods') { $this->fieldpref = array('forum_name', 'forum_moderators'); @@ -264,7 +240,6 @@ if(!deftrue('OLD_FORUMADMIN')) $this->fields['forum_postclass']['batch'] = false; $this->fields['forum_threadclass']['batch'] = false; $this->fields['forum_moderators']['batch'] = true; - } require_once(e_PLUGIN.'forum/forum_class.php'); @@ -275,7 +250,6 @@ if(!deftrue('OLD_FORUMADMIN')) $this->forumObj->upgradeLegacyPrefs(); } - if (!empty($_POST['do_prune']) && !empty($_POST['prune_days']) && !empty($_POST['pruneForum'])) { $msg = $this->forumObj->forumPrune($_POST['prune_type'], $_POST['prune_days'], $_POST['pruneForum']); @@ -287,15 +261,11 @@ if(!deftrue('OLD_FORUMADMIN')) $this->saveRules(); } - - - if($this->getAction() == 'edit') { $this->fields['forum_order']['noedit'] = true; } - $data = e107::getDb()->retrieve('forum', 'forum_id,forum_name,forum_parent', 'forum_id != 0',true); $this->forumParents[0] = FORLAN_216; $forumSubParents = array(); @@ -318,7 +288,6 @@ if(!deftrue('OLD_FORUMADMIN')) $this->fields['forum_parent']['writeParms'] = $this->forumParents; $this->fields['forum_sub']['writeParms']['optArray'] = $forumSubParents; $this->fields['forum_sub']['writeParms']['default'] = 'blank'; - } @@ -326,7 +295,6 @@ if(!deftrue('OLD_FORUMADMIN')) public function afterSort($result, $selected) { - return; $sql = e107::getDb(); @@ -336,7 +304,6 @@ if(!deftrue('OLD_FORUMADMIN')) { $id = $val['forum_id']; $parent[$id] = $val['forum_order']; - } $previous = 0; @@ -356,9 +323,7 @@ if(!deftrue('OLD_FORUMADMIN')) // echo "
".$row['forum_name']." with parent: ".$p." old: ".$row['forum_order']." new: ".$c; $sql->update('forum','forum_order = '.$c.' WHERE forum_id = '.intval($row['forum_id']).' LIMIT 1'); - } - } @@ -420,7 +385,7 @@ if(!deftrue('OLD_FORUMADMIN')) } - // optional - a custom page. + // optional - a custom page. public function prunePage() { $ns = e107::getRender(); @@ -486,10 +451,6 @@ if(!deftrue('OLD_FORUMADMIN')) "; return $text; - - - - } @@ -498,33 +459,27 @@ if(!deftrue('OLD_FORUMADMIN')) $tp = e107::getParser(); $sql = e107::getDb(); + $guestrules = $tp->toDB($_POST['guestrules']); + $memberrules = $tp->toDB($_POST['memberrules']); + $adminrules = $tp->toDB($_POST['adminrules']); - $guestrules = $tp->toDB($_POST['guestrules']); - $memberrules = $tp->toDB($_POST['memberrules']); - $adminrules = $tp->toDB($_POST['adminrules']); - - if(!$sql->update("generic", "gen_chardata ='$guestrules', gen_intdata='".$_POST['guest_active']."' WHERE gen_type='forum_rules_guest' ")) - { - $sql->insert("generic", "0, 'forum_rules_guest', '".time()."', 0, '', '".$_POST['guest_active']."', '$guestrules' "); - } - if(!$sql->update("generic", "gen_chardata ='$memberrules', gen_intdata='".$_POST['member_active']."' WHERE gen_type='forum_rules_member' ")) - { - $sql->insert("generic", "0, 'forum_rules_member', '".time()."', 0, '', '".$_POST['member_active']."', '$memberrules' "); - } - if(!$sql->update("generic", "gen_chardata ='$adminrules', gen_intdata='".$_POST['admin_active']."' WHERE gen_type='forum_rules_admin' ")) - { - $sql->insert("generic", "0, 'forum_rules_admin', '".time()."', 0, '', '".$_POST['admin_active']."', '$adminrules' "); - } - - - e107::getMessage()->addSuccess(LAN_SAVED); - return null; - + if(!$sql->update("generic", "gen_chardata ='$guestrules', gen_intdata='".$_POST['guest_active']."' WHERE gen_type='forum_rules_guest' ")) + { + $sql->insert("generic", "0, 'forum_rules_guest', '".time()."', 0, '', '".$_POST['guest_active']."', '$guestrules' "); + } + if(!$sql->update("generic", "gen_chardata ='$memberrules', gen_intdata='".$_POST['member_active']."' WHERE gen_type='forum_rules_member' ")) + { + $sql->insert("generic", "0, 'forum_rules_member', '".time()."', 0, '', '".$_POST['member_active']."', '$memberrules' "); + } + if(!$sql->update("generic", "gen_chardata ='$adminrules', gen_intdata='".$_POST['admin_active']."' WHERE gen_type='forum_rules_admin' ")) + { + $sql->insert("generic", "0, 'forum_rules_admin', '".time()."', 0, '', '".$_POST['admin_active']."', '$adminrules' "); + } + e107::getMessage()->addSuccess(LAN_SAVED); + return null; } - - function rulesPage() { @@ -544,7 +499,6 @@ if(!deftrue('OLD_FORUMADMIN')) list($id, $adminrules, $wm_active6) = $sql->fetch(); */ - if($sql->select('generic','*',"gen_type='forum_rules_guest'")) { $guest_rules = $sql->fetch(); @@ -633,7 +587,6 @@ if(!deftrue('OLD_FORUMADMIN')) $ns->tablerender(WMGLAN_5, $text); - /* echo " ";*/ - } - - - function modsPage() { @@ -679,11 +628,11 @@ if(!deftrue('OLD_FORUMADMIN')) $tp = e107::getParser(); $txt = "
- - - - - "; +
+ + + + "; foreach($parentList as $p) { @@ -720,19 +669,10 @@ if(!deftrue('OLD_FORUMADMIN')) "; return $txt; - - - - - - } - - function toolsPageProcess() { - $mes = e107::getMessage(); $fList = array(); @@ -780,11 +720,8 @@ if(!deftrue('OLD_FORUMADMIN')) $mes->addSuccess($msg); // $ns->tablerender($caption, $mes->render().$text); } - - } - //TODO Add SEF-url generation for forum and threads where missing. function toolsPage() { @@ -796,84 +733,77 @@ if(!deftrue('OLD_FORUMADMIN')) $this->toolsPageProcess(); $txt = " - -
- - - - - - - + +
".FORLAN_156."
+ + + + + + + - - - - + //TODO LAN - see below + $txt .= " + + + + - - - - + + + + - - - - + + + + - - -
".FORLAN_156." - "; - if($sql->select("forum", "*", "1 ORDER BY forum_order")) - { - $fList = $sql->db_getList(); - foreach($fList as $f) + + "; + if($sql->select("forum", "*", "1 ORDER BY forum_order")) { - $key = 'forumlist['.$f['forum_id'].']'; - $txt .= $frm->checkbox($key, 1, false, $tp->toHTML($f['forum_name'])); - // $txt .= " ".$tp->toHTML($f['forum_name'])."
"; + $fList = $sql->db_getList(); + foreach($fList as $f) + { + $key = 'forumlist['.$f['forum_id'].']'; + $txt .= $frm->checkbox($key, 1, false, $tp->toHTML($f['forum_name'])); + // $txt .= " ".$tp->toHTML($f['forum_name'])."
"; + } + $txt .= "
"; + $txt .= $frm->checkbox('forum_all', 1, false, LAN_PLUGIN_FORUM_ALLFORUMS); + // $txt .= " ".LAN_PLUGIN_FORUM_ALLFORUMS.""; } - $txt .= "
"; - $txt .= $frm->checkbox('forum_all', 1, false, LAN_PLUGIN_FORUM_ALLFORUMS); - // $txt .= " ".LAN_PLUGIN_FORUM_ALLFORUMS.""; - } - //TODO LAN - see below - $txt .= " -
".FORLAN_158."
".FORLAN_158."".$frm->checkbox('lastpost', 1, false, LAN_ACTIVE). - "". - $frm->select('lastpost_nothread', array(0=>FORLAN_207, 1=>FORLAN_208))." + ".$frm->checkbox('lastpost', 1, false, LAN_ACTIVE). + "". + $frm->select('lastpost_nothread', array(0=>FORLAN_207, 1=>FORLAN_208))." -
".FORLAN_161."
".FORLAN_161."".$frm->checkbox('counts', 1, false, LAN_ACTIVE). - "". - $frm->checkbox('counts_threads', 1, false, FORLAN_182)." - ".FORLAN_183." + ".$frm->checkbox('counts', 1, false, LAN_ACTIVE). + "". + $frm->checkbox('counts_threads', 1, false, FORLAN_182)." + ".FORLAN_183." -
".FORLAN_163."
".FORLAN_163."".$frm->checkbox('userpostcounts',1, false, LAN_ACTIVE)."
-
- ".$frm->admin_button('tools', LAN_GO, 'submit')." -
- - "; + ".$frm->checkbox('userpostcounts',1, false, LAN_ACTIVE)." + + +
+ ".$frm->admin_button('tools', LAN_GO, 'submit')." +
+ + "; return $txt; - // $ns->tablerender(FORLAN_166, $txt); - - + // $ns->tablerender(FORLAN_166, $txt); } - - } - class forum_form_ui extends e_admin_form_ui { - function forum_name($curVal,$mode,$parm) { - $frm = e107::getForm(); if($mode == 'read') @@ -884,8 +814,6 @@ if(!deftrue('OLD_FORUMADMIN')) $id = $this->getController()->getListModel()->get('forum_id'); $sub = $this->getController()->getListModel()->get('forum_sub'); - - $level = 1; if(!empty($sub)) @@ -896,8 +824,6 @@ if(!deftrue('OLD_FORUMADMIN')) $linkQ = e_SELF."?searchquery=&filter_options=page_chapter__".$id."&mode=page&action=list"; $level_image = $parent ? ' ' : ''; - - return ($parent) ? $level_image.$curVal : $curVal; } @@ -986,10 +912,6 @@ if(!deftrue('OLD_FORUMADMIN')) } } - - - - // Custom Method/Function function forum_lastpost_info($curVal,$mode) { @@ -1012,7 +934,6 @@ if(!deftrue('OLD_FORUMADMIN')) } } - // Custom Method/Function function forum_options($curVal,$mode) { @@ -1038,8 +959,6 @@ if(!deftrue('OLD_FORUMADMIN')) } - - class reported_ui extends e_admin_ui { @@ -1064,7 +983,6 @@ if(!deftrue('OLD_FORUMADMIN')) protected $fieldpref = array('gen_datestamp', 'gen_ip', 'gen_user_id', 'gen_chardata'); - // optional public function init() { @@ -1081,15 +999,11 @@ if(!deftrue('OLD_FORUMADMIN')) return array('caption'=>LAN_HELP, 'text'=>FORLAN_189); } - } - class reported_form_ui extends e_admin_form_ui { - - // Custom Method/Function function gen_intdata($curVal,$mode) { @@ -1114,7 +1028,6 @@ if(!deftrue('OLD_FORUMADMIN')) } } - // Custom Method/Function function gen_chardata($curVal,$mode) { @@ -1153,12 +1066,8 @@ if(!deftrue('OLD_FORUMADMIN')) return $text; } } - - } - - class post_ui extends e_admin_ui { @@ -1208,14 +1117,11 @@ if(!deftrue('OLD_FORUMADMIN')) { // $sql2->db_Delete('banlist', "banlist_ip='{$banIP}'"); } - } - class post_form_ui extends e_admin_form_ui { - function post_attachments($curVal,$mode) { @@ -1227,7 +1133,6 @@ if(!deftrue('OLD_FORUMADMIN')) $tp = e107::getParser(); $fl = e107::getFile(); - $text = ''; if(!empty($data['img'])) @@ -1266,13 +1171,8 @@ if(!deftrue('OLD_FORUMADMIN')) break; } } - - - } - - new forum_admin(); require_once(e_ADMIN."auth.php"); @@ -1280,11 +1180,10 @@ if(!deftrue('OLD_FORUMADMIN')) require_once(e_ADMIN."footer.php"); exit; - - } + /* $e_sub_cat = 'forum';