1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 04:10:38 +02:00

Code clean-up - remove empty space

This commit is contained in:
Tijn Kuyper
2017-02-04 17:17:48 +01:00
parent 030911c1a8
commit 69e5677ba3

View File

@@ -19,8 +19,6 @@ if (!getperms('P'))
e107::lan('forum', 'admin', true); e107::lan('forum', 'admin', true);
e107::lan('forum', 'front', true); e107::lan('forum', 'front', true);
//e107::includeLan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/English_admin.php');
//e107::lan('forum','', 'front');
e107::css('inline'," e107::css('inline',"
@@ -45,7 +43,6 @@ if(!deftrue('OLD_FORUMADMIN'))
class forum_admin extends e_admin_dispatcher class forum_admin extends e_admin_dispatcher
{ {
protected $modes = array( protected $modes = array(
'main' => array( 'main' => array(
@@ -75,23 +72,22 @@ if(!deftrue('OLD_FORUMADMIN'))
); );
protected $adminMenu = array( protected $adminMenu = array(
'main/list' => array('caption' => LAN_MANAGE, 'perm' => 'P'), 'main/list' => array('caption' => LAN_MANAGE, 'perm' => 'P'),
'main/create' => array('caption' => LAN_CREATE, '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'), 'main/rules' => array('caption' => WMGLAN_5, 'perm' => 'P'),
'mods/list' => array('caption' => LAN_FORUM_2003, 'perm'=>'P'), 'mods/list' => array('caption' => LAN_FORUM_2003, 'perm'=>'P'),
'main/prefs' => array('caption' => LAN_PREFS, 'perm' => 'P'), 'main/prefs' => array('caption' => LAN_PREFS, 'perm' => 'P'),
'main/opt2' => array('divider' => true), 'main/opt2' => array('divider' => true),
'report/list' => array('caption' => FORLAN_116, 'perm'=>'P'), 'report/list' => array('caption' => FORLAN_116, 'perm'=>'P'),
'post/list' => array('caption' => LAN_PLUGIN_FORUM_LATESTPOSTS, 'perm'=>'P'), 'post/list' => array('caption' => LAN_PLUGIN_FORUM_LATESTPOSTS, 'perm'=>'P'),
'main/prune' => array('caption' => LAN_PRUNE, 'perm' => 'P'), 'main/prune' => array('caption' => LAN_PRUNE, 'perm' => 'P'),
'main/tools' => array('caption' => FORLAN_153, 'perm'=>'p') 'main/tools' => array('caption' => FORLAN_153, 'perm'=>'p')
); );
protected $adminMenuAliases = array( protected $adminMenuAliases = array(
@@ -100,24 +96,15 @@ if(!deftrue('OLD_FORUMADMIN'))
protected $menuTitle = LAN_PLUGIN_FORUM_NAME; protected $menuTitle = LAN_PLUGIN_FORUM_NAME;
function init() function init()
{ {
if(E107_DEBUG_LEVEL > 0) if(E107_DEBUG_LEVEL > 0)
{ {
$this->adminMenu['opt3'] = array('divider'=>true); $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'); $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 class forum_ui extends e_admin_ui
{ {
@@ -191,16 +178,11 @@ if(!deftrue('OLD_FORUMADMIN'))
'reported_post_email' => array('title' => FORLAN_116, 'type'=>'boolean', 'data' => 'int','help'=>FORLAN_122), '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), 'tooltip' => array('title' => FORLAN_126, 'type'=>'boolean', 'data' => 'int','help'=>FORLAN_127),
'ranks' => array('title' => FORLAN_63, 'type'=>'boolean', 'data' => 'int','help'=>''), 'ranks' => array('title' => FORLAN_63, 'type'=>'boolean', 'data' => 'int','help'=>''),
'tiplength' => array('title' => FORLAN_128, 'type'=>'number', 'data' => 'int','help'=>FORLAN_129), 'tiplength' => array('title' => FORLAN_128, 'type'=>'number', 'data' => 'int','help'=>FORLAN_129),
'eprefix' => array('title' => FORLAN_53, 'type'=>'text', 'data' => 'string','help'=>FORLAN_54), 'eprefix' => array('title' => FORLAN_53, 'type'=>'text', 'data' => 'string','help'=>FORLAN_54),
'popular' => array('title' => FORLAN_55, 'type'=>'number', 'data' => 'int','help'=>FORLAN_56), 'popular' => array('title' => FORLAN_55, 'type'=>'number', 'data' => 'int','help'=>FORLAN_56),
'postspage' => array('title' => FORLAN_57, 'type'=>'number', 'data' => 'int','help'=>FORLAN_58), 'postspage' => array('title' => FORLAN_57, 'type'=>'number', 'data' => 'int','help'=>FORLAN_58),
'threadspage' => array('title' => FORLAN_186, 'type'=>'number', 'data' => 'int','help'=>FORLAN_187), 'threadspage' => array('title' => FORLAN_186, 'type'=>'number', 'data' => 'int','help'=>FORLAN_187),
); );
public $forumParents = array(); 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'); $sql2->update('forum', 'forum_order = '.$c.' WHERE forum_id = '.$row['forum_id'].' LIMIT 1');
} }
} }
} }
@@ -247,13 +225,11 @@ if(!deftrue('OLD_FORUMADMIN'))
$this->checkOrder(); $this->checkOrder();
if(e107::isInstalled('poll') == false) if(e107::isInstalled('poll') == false)
{ {
$this->prefs['poll']['writeParms']['post'] = " <span class='label label-important label-danger'>".FORLAN_215."</span>"; $this->prefs['poll']['writeParms']['post'] = " <span class='label label-important label-danger'>".FORLAN_215."</span>";
} }
if($this->getMode() == 'mods') if($this->getMode() == 'mods')
{ {
$this->fieldpref = array('forum_name', 'forum_moderators'); $this->fieldpref = array('forum_name', 'forum_moderators');
@@ -264,7 +240,6 @@ if(!deftrue('OLD_FORUMADMIN'))
$this->fields['forum_postclass']['batch'] = false; $this->fields['forum_postclass']['batch'] = false;
$this->fields['forum_threadclass']['batch'] = false; $this->fields['forum_threadclass']['batch'] = false;
$this->fields['forum_moderators']['batch'] = true; $this->fields['forum_moderators']['batch'] = true;
} }
require_once(e_PLUGIN.'forum/forum_class.php'); require_once(e_PLUGIN.'forum/forum_class.php');
@@ -275,7 +250,6 @@ if(!deftrue('OLD_FORUMADMIN'))
$this->forumObj->upgradeLegacyPrefs(); $this->forumObj->upgradeLegacyPrefs();
} }
if (!empty($_POST['do_prune']) && !empty($_POST['prune_days']) && !empty($_POST['pruneForum'])) if (!empty($_POST['do_prune']) && !empty($_POST['prune_days']) && !empty($_POST['pruneForum']))
{ {
$msg = $this->forumObj->forumPrune($_POST['prune_type'], $_POST['prune_days'], $_POST['pruneForum']); $msg = $this->forumObj->forumPrune($_POST['prune_type'], $_POST['prune_days'], $_POST['pruneForum']);
@@ -287,15 +261,11 @@ if(!deftrue('OLD_FORUMADMIN'))
$this->saveRules(); $this->saveRules();
} }
if($this->getAction() == 'edit') if($this->getAction() == 'edit')
{ {
$this->fields['forum_order']['noedit'] = true; $this->fields['forum_order']['noedit'] = true;
} }
$data = e107::getDb()->retrieve('forum', 'forum_id,forum_name,forum_parent', 'forum_id != 0',true); $data = e107::getDb()->retrieve('forum', 'forum_id,forum_name,forum_parent', 'forum_id != 0',true);
$this->forumParents[0] = FORLAN_216; $this->forumParents[0] = FORLAN_216;
$forumSubParents = array(); $forumSubParents = array();
@@ -318,7 +288,6 @@ if(!deftrue('OLD_FORUMADMIN'))
$this->fields['forum_parent']['writeParms'] = $this->forumParents; $this->fields['forum_parent']['writeParms'] = $this->forumParents;
$this->fields['forum_sub']['writeParms']['optArray'] = $forumSubParents; $this->fields['forum_sub']['writeParms']['optArray'] = $forumSubParents;
$this->fields['forum_sub']['writeParms']['default'] = 'blank'; $this->fields['forum_sub']['writeParms']['default'] = 'blank';
} }
@@ -326,7 +295,6 @@ if(!deftrue('OLD_FORUMADMIN'))
public function afterSort($result, $selected) public function afterSort($result, $selected)
{ {
return; return;
$sql = e107::getDb(); $sql = e107::getDb();
@@ -336,7 +304,6 @@ if(!deftrue('OLD_FORUMADMIN'))
{ {
$id = $val['forum_id']; $id = $val['forum_id'];
$parent[$id] = $val['forum_order']; $parent[$id] = $val['forum_order'];
} }
$previous = 0; $previous = 0;
@@ -356,9 +323,7 @@ if(!deftrue('OLD_FORUMADMIN'))
// echo "<br />".$row['forum_name']." with parent: ".$p." old: ".$row['forum_order']." new: ".$c; // echo "<br />".$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'); $sql->update('forum','forum_order = '.$c.' WHERE forum_id = '.intval($row['forum_id']).' LIMIT 1');
} }
} }
@@ -486,10 +451,6 @@ if(!deftrue('OLD_FORUMADMIN'))
</form>"; </form>";
return $text; return $text;
} }
@@ -498,7 +459,6 @@ if(!deftrue('OLD_FORUMADMIN'))
$tp = e107::getParser(); $tp = e107::getParser();
$sql = e107::getDb(); $sql = e107::getDb();
$guestrules = $tp->toDB($_POST['guestrules']); $guestrules = $tp->toDB($_POST['guestrules']);
$memberrules = $tp->toDB($_POST['memberrules']); $memberrules = $tp->toDB($_POST['memberrules']);
$adminrules = $tp->toDB($_POST['adminrules']); $adminrules = $tp->toDB($_POST['adminrules']);
@@ -516,15 +476,10 @@ if(!deftrue('OLD_FORUMADMIN'))
$sql->insert("generic", "0, 'forum_rules_admin', '".time()."', 0, '', '".$_POST['admin_active']."', '$adminrules' "); $sql->insert("generic", "0, 'forum_rules_admin', '".time()."', 0, '', '".$_POST['admin_active']."', '$adminrules' ");
} }
e107::getMessage()->addSuccess(LAN_SAVED); e107::getMessage()->addSuccess(LAN_SAVED);
return null; return null;
} }
function rulesPage() function rulesPage()
{ {
@@ -544,7 +499,6 @@ if(!deftrue('OLD_FORUMADMIN'))
list($id, $adminrules, $wm_active6) = $sql->fetch(); list($id, $adminrules, $wm_active6) = $sql->fetch();
*/ */
if($sql->select('generic','*',"gen_type='forum_rules_guest'")) if($sql->select('generic','*',"gen_type='forum_rules_guest'"))
{ {
$guest_rules = $sql->fetch(); $guest_rules = $sql->fetch();
@@ -633,7 +587,6 @@ if(!deftrue('OLD_FORUMADMIN'))
$ns->tablerender(WMGLAN_5, $text); $ns->tablerender(WMGLAN_5, $text);
/* /*
echo " echo "
<script type=\"text/javascript\"> <script type=\"text/javascript\">
@@ -657,12 +610,8 @@ if(!deftrue('OLD_FORUMADMIN'))
} }
</script> </script>
";*/ ";*/
} }
function modsPage() function modsPage()
{ {
@@ -720,19 +669,10 @@ if(!deftrue('OLD_FORUMADMIN'))
</form>"; </form>";
return $txt; return $txt;
} }
function toolsPageProcess() function toolsPageProcess()
{ {
$mes = e107::getMessage(); $mes = e107::getMessage();
$fList = array(); $fList = array();
@@ -780,11 +720,8 @@ if(!deftrue('OLD_FORUMADMIN'))
$mes->addSuccess($msg); $mes->addSuccess($msg);
// $ns->tablerender($caption, $mes->render().$text); // $ns->tablerender($caption, $mes->render().$text);
} }
} }
//TODO Add SEF-url generation for forum and threads where missing. //TODO Add SEF-url generation for forum and threads where missing.
function toolsPage() function toolsPage()
{ {
@@ -860,20 +797,13 @@ if(!deftrue('OLD_FORUMADMIN'))
return $txt; return $txt;
// $ns->tablerender(FORLAN_166, $txt); // $ns->tablerender(FORLAN_166, $txt);
} }
} }
class forum_form_ui extends e_admin_form_ui class forum_form_ui extends e_admin_form_ui
{ {
function forum_name($curVal,$mode,$parm) function forum_name($curVal,$mode,$parm)
{ {
$frm = e107::getForm(); $frm = e107::getForm();
if($mode == 'read') if($mode == 'read')
@@ -884,8 +814,6 @@ if(!deftrue('OLD_FORUMADMIN'))
$id = $this->getController()->getListModel()->get('forum_id'); $id = $this->getController()->getListModel()->get('forum_id');
$sub = $this->getController()->getListModel()->get('forum_sub'); $sub = $this->getController()->getListModel()->get('forum_sub');
$level = 1; $level = 1;
if(!empty($sub)) if(!empty($sub))
@@ -896,8 +824,6 @@ if(!deftrue('OLD_FORUMADMIN'))
$linkQ = e_SELF."?searchquery=&filter_options=page_chapter__".$id."&mode=page&action=list"; $linkQ = e_SELF."?searchquery=&filter_options=page_chapter__".$id."&mode=page&action=list";
$level_image = $parent ? '<img src="'.e_IMAGE_ABS.'generic/branchbottom.gif" class="icon" alt="" style="margin-left: '.($level * 20).'px" />&nbsp;' : ''; $level_image = $parent ? '<img src="'.e_IMAGE_ABS.'generic/branchbottom.gif" class="icon" alt="" style="margin-left: '.($level * 20).'px" />&nbsp;' : '';
return ($parent) ? $level_image.$curVal : $curVal; return ($parent) ? $level_image.$curVal : $curVal;
} }
@@ -986,10 +912,6 @@ if(!deftrue('OLD_FORUMADMIN'))
} }
} }
// Custom Method/Function // Custom Method/Function
function forum_lastpost_info($curVal,$mode) function forum_lastpost_info($curVal,$mode)
{ {
@@ -1012,7 +934,6 @@ if(!deftrue('OLD_FORUMADMIN'))
} }
} }
// Custom Method/Function // Custom Method/Function
function forum_options($curVal,$mode) function forum_options($curVal,$mode)
{ {
@@ -1038,8 +959,6 @@ if(!deftrue('OLD_FORUMADMIN'))
} }
class reported_ui extends e_admin_ui 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'); protected $fieldpref = array('gen_datestamp', 'gen_ip', 'gen_user_id', 'gen_chardata');
// optional // optional
public function init() public function init()
{ {
@@ -1081,15 +999,11 @@ if(!deftrue('OLD_FORUMADMIN'))
return array('caption'=>LAN_HELP, 'text'=>FORLAN_189); return array('caption'=>LAN_HELP, 'text'=>FORLAN_189);
} }
} }
class reported_form_ui extends e_admin_form_ui class reported_form_ui extends e_admin_form_ui
{ {
// Custom Method/Function // Custom Method/Function
function gen_intdata($curVal,$mode) function gen_intdata($curVal,$mode)
{ {
@@ -1114,7 +1028,6 @@ if(!deftrue('OLD_FORUMADMIN'))
} }
} }
// Custom Method/Function // Custom Method/Function
function gen_chardata($curVal,$mode) function gen_chardata($curVal,$mode)
{ {
@@ -1153,12 +1066,8 @@ if(!deftrue('OLD_FORUMADMIN'))
return $text; return $text;
} }
} }
} }
class post_ui extends e_admin_ui class post_ui extends e_admin_ui
{ {
@@ -1208,14 +1117,11 @@ if(!deftrue('OLD_FORUMADMIN'))
{ {
// $sql2->db_Delete('banlist', "banlist_ip='{$banIP}'"); // $sql2->db_Delete('banlist', "banlist_ip='{$banIP}'");
} }
} }
class post_form_ui extends e_admin_form_ui class post_form_ui extends e_admin_form_ui
{ {
function post_attachments($curVal,$mode) function post_attachments($curVal,$mode)
{ {
@@ -1227,7 +1133,6 @@ if(!deftrue('OLD_FORUMADMIN'))
$tp = e107::getParser(); $tp = e107::getParser();
$fl = e107::getFile(); $fl = e107::getFile();
$text = ''; $text = '';
if(!empty($data['img'])) if(!empty($data['img']))
@@ -1266,13 +1171,8 @@ if(!deftrue('OLD_FORUMADMIN'))
break; break;
} }
} }
} }
new forum_admin(); new forum_admin();
require_once(e_ADMIN."auth.php"); require_once(e_ADMIN."auth.php");
@@ -1280,11 +1180,10 @@ if(!deftrue('OLD_FORUMADMIN'))
require_once(e_ADMIN."footer.php"); require_once(e_ADMIN."footer.php");
exit; exit;
} }
/* /*
$e_sub_cat = 'forum'; $e_sub_cat = 'forum';