From 0cc458e4e8bee3ad12f7150a10a676303b9950a8 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 21 Jul 2018 10:08:13 -0700 Subject: [PATCH 1/5] Fixes #3290, Fixes #3074 - Featurebox debug message was visible to public. --- e107_plugins/featurebox/featurebox_menu.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/e107_plugins/featurebox/featurebox_menu.php b/e107_plugins/featurebox/featurebox_menu.php index 2f96d9ff9..1730668f7 100644 --- a/e107_plugins/featurebox/featurebox_menu.php +++ b/e107_plugins/featurebox/featurebox_menu.php @@ -13,10 +13,9 @@ e107::includeLan(e_PLUGIN.'featurebox/languages/'.e_LANGUAGE.'_admin_featurebox. $type = vartrue(e107::getPlugPref('featurebox','menu_category'),'bootstrap_carousel'); $text = e107::getParser()->parseTemplate("{FEATUREBOX|".$type."}"); -if(!$text) +if(empty($text)) { - echo "
".$message = e107::getParser()->lanVars(FBLAN_25, array('x'=>$type))."
"; -// e107::getMessage()->addDebug("There are no featurebox items using the ".$type." template"); + e107::getMessage()->addDebug("DEBUG: There are no featurebox items using the ".$type." template"); } echo $text; From f50860a51e2db28ba2d545d21a1ca5bb23215fb6 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 21 Jul 2018 10:18:16 -0700 Subject: [PATCH 2/5] Preparation for 2.1.9 upgrade routine. --- e107_admin/update_routines.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/e107_admin/update_routines.php b/e107_admin/update_routines.php index 3ba070748..68caf7437 100644 --- a/e107_admin/update_routines.php +++ b/e107_admin/update_routines.php @@ -563,6 +563,27 @@ function update_core_database($type = '') return $just_check; } + + function update_218_to_219($type='') + { + $sql = e107::getDb(); + + // add common video and audio media categories if missing. + $count = $sql->select("core_media_cat","*","media_cat_category = '_common_video' LIMIT 1 "); + if(!$count) + { + if ($type !== 'do') return update_needed('Media-Manager is missing the video and audio categories and needs to be updated.'); + + $sql->gen("INSERT INTO `".MPREFIX."core_media_cat` VALUES(0, '_common', '_common_video', '(Common Videos)', 'Media in this category will be available in all areas of admin. ', 253, '', 0);"); + $sql->gen("INSERT INTO `".MPREFIX."core_media_cat` VALUES(0, '_common', '_common_audio', '(Common Audio)', 'Media in this category will be available in all areas of admin. ', 253, '', 0);"); + } + + + } + + + + /** * @param string $type * @return bool true = no update required, and false if update required. From 55be7e35a2b971de44fdfda11847ccab81128418 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 21 Jul 2018 12:23:44 -0700 Subject: [PATCH 3/5] Issue #3301 Revert "Removed problematic cache from e107plugin::getinfo()" This reverts commit 89e28e38c5f2a3f9762fa826299f8e6945adee03 because it breaks thumb.php --- e107_admin/plugin.php | 2 +- e107_handlers/plugin_class.php | 47 +++++++++++++++++++++------------- e107_handlers/pref_class.php | 2 +- 3 files changed, 31 insertions(+), 20 deletions(-) diff --git a/e107_admin/plugin.php b/e107_admin/plugin.php index a79b2d150..86e2c4c29 100755 --- a/e107_admin/plugin.php +++ b/e107_admin/plugin.php @@ -631,7 +631,7 @@ class plugin_ui extends e_admin_ui $eplug_addons = $plugin -> getAddons($eplug_folder); - $info = e107plugin::getPluginRecord($this->id); + $info = $plugin->getinfo($this->id); $name = deftrue($info['plugin_name'],$info['plugin_name']). " v".$eplug_version. "({e_PLUGIN}".$info['plugin_path'].")"; diff --git a/e107_handlers/plugin_class.php b/e107_handlers/plugin_class.php index 853fc7aa2..f0df2459a 100644 --- a/e107_handlers/plugin_class.php +++ b/e107_handlers/plugin_class.php @@ -1631,21 +1631,32 @@ class e107plugin * @param int $id * @return array plugin info */ - static function getPluginRecord($id) + function getinfo($id, $force = false) { $sql = e107::getDb(); - $getinfo_results = array(); - - $path = (!is_numeric($id)) ? $id : false; - $id = (int)$id; - - $qry = "plugin_id = " . $id; - $qry .= ($path != false) ? " OR plugin_path = '" . $path . "' " : ""; - - if ($sql->select('plugin', '*', $qry)) { - $getinfo_results[$id] = $sql->fetch(); + static $getinfo_results; + if (!is_array($getinfo_results)) + { + $getinfo_results = array(); } + $path = (!is_numeric($id)) ? $id : false; + $id = (int) $id; + + $qry = "plugin_id = ".$id; + $qry .= ($path != false) ? " OR plugin_path = '".$path."' " : ""; + + if (!isset($getinfo_results[$id]) || $force == true) + { + if ($sql->select('plugin', '*', $qry)) + { + $getinfo_results[$id] = $sql->fetch(); + } + else + { + return false; + } + } return $getinfo_results[$id]; } @@ -1934,7 +1945,7 @@ class e107plugin function manage_userclass($action, $class_name, $class_description='') { $this->log("Running ".__FUNCTION__); - $e107 = e107::getInstance(); + global $e107; $tp = e107::getParser(); $sql = e107::getDb(); $mes = e107::getMessage(); @@ -2490,12 +2501,12 @@ class e107plugin elseif(is_numeric($id)) // plugin database id { $id = (int) $id; - $plug = e107plugin::getPluginRecord($id); // Get plugin info from DB + $plug = $this->getinfo($id); // Get plugin info from DB } else // Plugin Path. { $id = $this->getId($id); - $plug = e107plugin::getPluginRecord($id); // Get plugin info from DB + $plug = $this->getinfo($id); // Get plugin info from DB } $this->current_plug = $plug; @@ -3874,7 +3885,7 @@ class e107plugin } else { - $plug = e107plugin::getPluginRecord($id); + $plug = $this->getinfo($id); } $_path = e_PLUGIN.$plug['plugin_path'].'/'; @@ -4007,7 +4018,7 @@ class e107plugin $sql = e107::getDb(); $tp = e107::getParser(); - $plug = e107plugin::getPluginRecord($dir); + $plug = $this->getinfo($dir); $this->options = array('nolinks'=>true); @@ -4060,7 +4071,7 @@ class e107plugin $text = ''; // install plugin ... - $plug = e107plugin::getPluginRecord($id); + $plug = $this->getinfo($id); if(!is_array($plug)) { @@ -4108,7 +4119,7 @@ class e107plugin $tp = e107::getParser(); $sql = e107::getDb(); - $plug = e107plugin::getPluginRecord($id); + $plug = $this->getinfo($id); $this->log("Uninstalling :".$plug['plugin_path']." with options: ".print_r($options, true)); diff --git a/e107_handlers/pref_class.php b/e107_handlers/pref_class.php index e219182a0..57549820a 100644 --- a/e107_handlers/pref_class.php +++ b/e107_handlers/pref_class.php @@ -845,7 +845,7 @@ final class e_core_pref extends e_pref parent::__construct($pref_id, $pref_alias); if($load && $pref_id) { - $this->load($pref_id, $load); + $this->load(); } From eef624c93b83f1d12b7c86fec4278348d9c84dd2 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 21 Jul 2018 13:07:44 -0700 Subject: [PATCH 4/5] Send a 500 error response code when thumb.php fails due to an exception. --- thumb.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/thumb.php b/thumb.php index eb72b772a..ff782da91 100755 --- a/thumb.php +++ b/thumb.php @@ -26,6 +26,13 @@ define('e107_INIT', true); // error_reporting(E_ALL); +function thumbErrorHandler() +{ + echo "Fatal Thumbnail Error"; + http_response_code(500); +} + +set_exception_handler('thumbErrorHandler'); // disable to troubleshoot. error_reporting(0); // suppress all errors or image will be corrupted. From 7d040347d0c4694c5053078e273799d1c4c43319 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 21 Jul 2018 13:20:17 -0700 Subject: [PATCH 5/5] Make video/audio thumbnails larger. --- e107_admin/image.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/e107_admin/image.php b/e107_admin/image.php index 296f3f1a5..9b5a3a93d 100644 --- a/e107_admin/image.php +++ b/e107_admin/image.php @@ -1610,8 +1610,8 @@ class media_admin_ui extends e_admin_ui 'type' =>'audio', 'tagid' => $this->getQuery('tagid'), 'action' =>'audio', // Used by AJAX to identify correct function. - 'perPage' => 12, - 'gridClass' => 'col-md-2 col-sm-3 media-carousel-item-audio', + 'perPage' => 8, + 'gridClass' => 'col-sm-3 media-carousel-item-audio', 'bbcode' => 'audio', 'close' => 'true' @@ -1668,8 +1668,8 @@ class media_admin_ui extends e_admin_ui 'type' =>'video', 'tagid' => $this->getQuery('tagid'), 'action' =>'video', // Used by AJAX to identify correct function. - 'perPage' => 12, - 'gridClass' => 'col-md-2 col-sm-3 admin-ui-grid media-carousel-item-video', + 'perPage' => 8, + 'gridClass' => ' col-sm-3 admin-ui-grid media-carousel-item-video', 'bbcode' => 'video', 'close' => 'true'