From 6b9256c8727da63624c0faa9429df64d06a09945 Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 7 Apr 2015 00:32:53 -0700 Subject: [PATCH] LAN File fixes. Hide comment status when comments are not enabled. etc. --- e107_admin/banlist.php | 4 +++- e107_admin/cron.php | 13 ++++++------- e107_core/shortcodes/batch/admin_shortcodes.php | 15 ++++++++++++--- e107_languages/English/admin/lan_banlist.php | 2 +- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/e107_admin/banlist.php b/e107_admin/banlist.php index d676dda14..b59347fc6 100644 --- a/e107_admin/banlist.php +++ b/e107_admin/banlist.php @@ -337,7 +337,9 @@ class banlist_form_ui extends e_admin_form_ui // $val = ($curVal ? strftime($pref['ban_date_format'], $curVal).(($curVal < time()) ? ' ('.BANLAN_34.')' : '') : LAN_NEVER); // ."
".$this->banexpires(); // $val .= " (".$curVal.")"; // $mod = preg_replace('/[^\w]/', '', vartrue($_GET['mode'], '')); - $val = vartrue($curVal) ? $date->computeLapse(time(), $curVal) : LAN_NEVER; + $val = vartrue($curVal) ? $date->computeLapse(time(), $curVal) : LAN_NEVER; + + $val = str_replace("ago", "", $val); // quick fix for the 'ago'. if(vartrue($curVal) && $curVal < time()) { diff --git a/e107_admin/cron.php b/e107_admin/cron.php index 72e953930..0288e3318 100644 --- a/e107_admin/cron.php +++ b/e107_admin/cron.php @@ -344,11 +344,11 @@ class cron_admin_ui extends e_admin_ui $frm = e107::getForm(); e107::getCache()->CachePageMD5 = '_'; - $lastload = e107::getCache()->retrieve('cronLastLoad', FALSE, TRUE, TRUE); + $lastload = e107::getCache()->retrieve('cronLastLoad', false, true, true); $ago = (time() - $lastload); - $active = ($ago < 901) ? TRUE : FALSE; + $active = ($ago < 1200) ? true : false; // longer than 20 minutes, so lets assume it's inactive. $status = ($active) ? LAN_ENABLED : LAN_DISABLED; // "Enabled" : "Offline"; $mins = floor($ago / 60); @@ -365,13 +365,12 @@ class cron_admin_ui extends e_admin_ui $mes->addInfo(LAN_CRON_11.": ".$this->activeCrons.""); $mes->addInfo(LAN_CRON_12.": ".$lastRefresh."

"); - - - //FIXME: for Windows, the is_executable() function only checks the file + // extensions of exe, com, bat and cmd. $isWin = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; $actualPerm = substr(decoct(fileperms(e_BASE."cron.php")),3); + if($isWin) { $mes->addWarning(LAN_CRON_13); @@ -402,9 +401,9 @@ class cron_admin_ui extends e_admin_ui function cronExecute($cron_id) { $sql = e107::getDb(); - if($sql->db_Select("cron","cron_name,cron_function","cron_id = ".intval($cron_id))) + if($sql->select("cron","cron_name,cron_function","cron_id = ".intval($cron_id))) { - $row = $sql->db_Fetch(MYSQL_ASSOC); + $row = $sql->fetch(MYSQL_ASSOC); $class_func = $row['cron_function']; $cron_name = $row['cron_name']; } diff --git a/e107_core/shortcodes/batch/admin_shortcodes.php b/e107_core/shortcodes/batch/admin_shortcodes.php index 6d86efc8b..a4d2c934b 100644 --- a/e107_core/shortcodes/batch/admin_shortcodes.php +++ b/e107_core/shortcodes/batch/admin_shortcodes.php @@ -423,7 +423,12 @@ class admin_shortcodes $oldconfigs = array(); $oldconfigs['e-news'][0] = array('icon'=>E_16_NEWS, 'title'=>ADLAN_LAT_2, 'url'=> e_ADMIN."newspost.php?mode=sub&action=list", 'total'=>$submitted_news); - $oldconfigs['e-comment'][0] = array('icon'=>E_16_COMMENT, 'title'=>ADLAN_LAT_9, 'url'=> e_ADMIN_ABS."comment.php?searchquery=&filter_options=comment_blocked__2", 'total'=>$comments_pending); + + if(empty($pref['comments_disabled'])) + { + $oldconfigs['e-comment'][0] = array('icon'=>E_16_COMMENT, 'title'=>ADLAN_LAT_9, 'url'=> e_ADMIN_ABS."comment.php?searchquery=&filter_options=comment_blocked__2", 'total'=>$comments_pending); + } + $oldconfigs['e-upload'][0] = array('icon'=>E_16_UPLOADS, 'title'=>ADLAN_LAT_7, 'url'=> e_ADMIN."upload.php", 'total'=>$active_uploads); $messageTypes = array('Broken Download', 'Dev Team Message'); @@ -1092,8 +1097,12 @@ class admin_shortcodes $oldconfigs['e-user'][0] = array('icon'=>E_16_USER, 'title'=>ADLAN_110, 'url'=> e_ADMIN_ABS."users.php?searchquery=&filter_options=user_ban__0", 'total'=>$members); $oldconfigs['e-user'][1] = array('icon'=>E_16_USER, 'title'=>ADLAN_111, 'url'=> e_ADMIN."users.php?searchquery=&filter_options=user_ban__2", 'total'=>$unverified); $oldconfigs['e-user'][2] = array('icon'=>E_16_BANLIST, 'title'=>ADLAN_112, 'url'=> e_ADMIN."users.php?searchquery=&filter_options=user_ban__1", 'total'=>$banned); - $oldconfigs['e-comments'][0] = array('icon'=>E_16_COMMENT, 'title'=>ADLAN_114, 'url'=> e_ADMIN_ABS."comment.php", 'total'=>$comments); - + + + if(empty($pref['comments_disabled'])) + { + $oldconfigs['e-comments'][0] = array('icon'=>E_16_COMMENT, 'title'=>ADLAN_114, 'url'=> e_ADMIN_ABS."comment.php", 'total'=>$comments); + } if($flo = $sql->count('generic', '(*)', "WHERE gen_type='failed_login'")) { //$text .= "\n\t\t\t\t\t
".E_16_FAILEDLOGIN." ".ADLAN_146.": $flo
"; diff --git a/e107_languages/English/admin/lan_banlist.php b/e107_languages/English/admin/lan_banlist.php index 1f1c017f3..7c8c49aa4 100644 --- a/e107_languages/English/admin/lan_banlist.php +++ b/e107_languages/English/admin/lan_banlist.php @@ -82,7 +82,7 @@ define("BANLAN_74", "Banlist Maintenance"); define("BANLAN_75", "Remove expired bans from list"); define("BANLAN_76", "Execute"); define("BANLAN_77", "Messages/Ban Periods"); -// define("BANLAN_78", "Hit count exceeded (--HITS-- requests within allotted time)"); +define("BANLAN_78", "Hit count exceeded (--HITS-- requests within allotted time)"); define("BANLAN_79", "CSV Export format:"); define("BANLAN_80", "CSV Import format:"); define("BANLAN_81", "Ban Action Log");