From 783be2995394bf6ac0e1bc6723100cd40c387858 Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 27 May 2019 10:45:35 -0700 Subject: [PATCH] PHP 7.3 Notice/Warning Fixes. --- e107_admin/emoticon.php | 4 +-- e107_admin/theme.php | 4 +-- e107_handlers/core_functions.php | 4 ++- e107_handlers/e_marketplace.php | 5 ++-- e107_handlers/form_handler.php | 2 +- e107_handlers/menumanager_class.php | 6 ++-- e107_handlers/theme_handler.php | 33 ++++++++++++++------- e107_languages/English/admin/lan_admin.php | 2 ++ e107_languages/English/admin/lan_plugin.php | 3 +- e107_languages/English/admin/lan_theme.php | 5 ++-- 10 files changed, 42 insertions(+), 26 deletions(-) diff --git a/e107_admin/emoticon.php b/e107_admin/emoticon.php index e43bc8e4e..264848733 100644 --- a/e107_admin/emoticon.php +++ b/e107_admin/emoticon.php @@ -54,7 +54,7 @@ if (isset($_POST['active'])) } -e107::getRender()->tablerender($caption, $mes->render() . $text); +//e107::getRender()->tablerender($caption, $mes->render() . $text); /* get packs */ require_once(e_HANDLER."file_class.php"); @@ -102,7 +102,7 @@ foreach($filtered as $key => $value) } } -$ns->tablerender($caption, $mes->render() . $text); +// $ns->tablerender($caption, $mes->render() . $text); $check = TRUE; diff --git a/e107_admin/theme.php b/e107_admin/theme.php index 876ad3283..b1273b5fe 100644 --- a/e107_admin/theme.php +++ b/e107_admin/theme.php @@ -721,7 +721,7 @@ class theme_admin_tree_model extends e_tree_model * Load data from theme meta file. * @param bool $force */ - function load() + function load($force=false) { $themeList = e107::getTheme()->getList(); $newArray = array(); @@ -786,7 +786,7 @@ class theme_admin_online_tree_model extends e_tree_model * Load data from theme meta file. * @param bool $force */ - function load() + function load($force=false) { $themeList = e107::getTheme()->getList(); diff --git a/e107_handlers/core_functions.php b/e107_handlers/core_functions.php index 84db8b4ea..c771c2391 100644 --- a/e107_handlers/core_functions.php +++ b/e107_handlers/core_functions.php @@ -301,10 +301,12 @@ if (!function_exists('asortbyindex')) } asort ($sort_values); reset ($sort_values); - while (list ($arr_key, $arr_val) = each ($sort_values)) + + foreach($sort_values as $arr_key =>$arr_val) { $sorted_arr[] = $array[$arr_key]; } + return $sorted_arr; } } diff --git a/e107_handlers/e_marketplace.php b/e107_handlers/e_marketplace.php index cfbddecc2..881d036f7 100644 --- a/e107_handlers/e_marketplace.php +++ b/e107_handlers/e_marketplace.php @@ -441,7 +441,7 @@ abstract class e_marketplace_adapter_abstract $remotefile = $this->downloadUrl."?auth=".$this->getAuthKey()."&".$qry; $localfile = md5($remotefile.time()).".zip"; - $mes->addSuccess(TPVLAN_81); + $mes->addSuccess(LAN_DOWNLOADING."..."); // FIXME call the service, check status first, then download (if status OK), else retireve the error break and show it @@ -479,7 +479,8 @@ abstract class e_marketplace_adapter_abstract if($fl->unzipArchive($localfile,$type, true)) { - $mes->addSuccess(TPVLAN_82); + $lan = defset('LAN_DOWNLOAD_COMPLETE', 'Download Complete!'); + $mes->addSuccess($lan); return true; } else diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index f7c57dd22..a6f22291b 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -5521,7 +5521,7 @@ var_dump($select_options);*/ break; case 'method': // Custom Function - $method = $attributes['field']; // prevents table alias in method names. ie. u.my_method. + $method = varset($attributes['field']); // prevents table alias in method names. ie. u.my_method. $_value = $value; if(!empty($attributes['data']) && $attributes['data'] == 'array') // FIXME @SecretR - please move this to where it should be. diff --git a/e107_handlers/menumanager_class.php b/e107_handlers/menumanager_class.php index 1f697db89..27dd1725c 100644 --- a/e107_handlers/menumanager_class.php +++ b/e107_handlers/menumanager_class.php @@ -577,7 +577,7 @@ class e_menuManager { $menu_perm['mainadmin'] = e_UC_MAINADMIN; $menu_perm['admin'] = e_UC_ADMIN; $menu_perm['nobody'] = e_UC_NOBODY; - $link_class = ($menu_perm[$link_class]) ? $menu_perm[$link_class] : e_UC_PUBLIC; + $link_class = isset($menu_perm[$link_class]) ? $menu_perm[$link_class] : e_UC_PUBLIC; return $link_class; } @@ -926,11 +926,13 @@ class e_menuManager { $areaID = $menus['@attributes']['id']; foreach($menus['menu'] as $k=>$v) { + $perm = isset($v['@attributes']['perm']) ? $v['@attributes']['perm'] : null; + $menuArea[] = array( 'menu_location' => $areaID, 'menu_order' => $k, 'menu_name' => $v['@attributes']['name']."_menu", - 'menu_class' => $this->menuPresetPerms($v['@attributes']['perm']) + 'menu_class' => $this->menuPresetPerms($perm) ); } } diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php index 2b94d5751..65eb1574d 100644 --- a/e107_handlers/theme_handler.php +++ b/e107_handlers/theme_handler.php @@ -613,7 +613,7 @@ class e_theme public static function parse_theme_php($path) { - $CUSTOMPAGES = ""; + $CUSTOMPAGES = null; $tp = e107::getParser(); // could be used by a theme file. $sql = e107::getDb(); // could be used by a theme file. @@ -2038,7 +2038,7 @@ class themeHandler } $tdClass = !empty($val['writeParms']['post']) ? 'form-inline' : ''; - $text .= "".$val['title'].":".$frm->renderElement($field, $value[$field], $val)."
".$val['help']."
"; + $text .= "".$val['title'].":".$frm->renderElement($field, $value[$field], $val)."
".varset($val['help'])."
"; } } @@ -2114,13 +2114,15 @@ class themeHandler $pref = e107::getPref(); $frm = e107::getForm(); $tp = e107::getParser(); + + $author = ($theme['email'] ? "".$theme['author']."" : $theme['author']); $website = ($theme['website'] ? "".$theme['website']."" : ""); // $preview = "".($theme['preview'] ? "" : "").""; $main_icon = ($pref['sitetheme'] != $theme['path']) ? "" : ""; // $info_icon = ""; - $info_icon = "".$tp->toGlyph('fa-info-circle',array('size'=>'2x')).""; + $info_icon = "".$tp->toGlyph('fa-info-circle',array('size'=>'2x')).""; // $preview_icon = "".E_32_SEARCH.""; $admin_icon = ($pref['admintheme'] != $theme['path'] ) ? "" : ""; @@ -2670,9 +2672,10 @@ class themeHandler unset($detected[$vl['name']]); } - switch($mode) - { - case 1: // frontend + + // frontend + if($mode === self::RENDER_SITEPREFS) + { if(substr($vl['name'], 0, 6) == "admin_") { @@ -2692,10 +2695,10 @@ class themeHandler continue; } - break; - - case 2: // admin + } + if($mode === self::RENDER_ADMINPREFS) + { if($vl['name'] == "style.css" || empty($vl['info'])) // Hide the admin css unless it has a header. eg. /* info: Default stylesheet */ { @@ -2716,10 +2719,10 @@ class themeHandler { $remove[$k] = $vl['name']; } - break; + } + - } } @@ -2838,6 +2841,14 @@ class themeHandler { e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_theme.php"); $text = "
".TPVLAN_1.".

"; + + $srch = array( + '{PREVIEWTHEMENAME}' => PREVIEWTHEMENAME, + '{e_ADMIN}' => e_ADMIN + ); + + $text = str_replace(array_keys($srch),$srch,$text); + global $ns; $ns->tablerender(TPVLAN_2, $text); } diff --git a/e107_languages/English/admin/lan_admin.php b/e107_languages/English/admin/lan_admin.php index 667500764..ce6c861f4 100644 --- a/e107_languages/English/admin/lan_admin.php +++ b/e107_languages/English/admin/lan_admin.php @@ -564,3 +564,5 @@ define("LAN_SUCC_RECALCULATE_COMMENT_COUNT", "Comment count successfully recalcu define("LAN_NO_RESULTS_FOUND", "No Results Found."); define("LAN_UI_DROPZONE_DROP_FILES", "Drop files here to upload"); + +define("LAN_DOWNLOAD_COMPLETE", "Download Complete!"); diff --git a/e107_languages/English/admin/lan_plugin.php b/e107_languages/English/admin/lan_plugin.php index 7cdced0f0..f0071eb77 100644 --- a/e107_languages/English/admin/lan_plugin.php +++ b/e107_languages/English/admin/lan_plugin.php @@ -271,8 +271,7 @@ define ("EPL_ADLAN_229","Refresh"); define ("EPL_ADLAN_230", "Downloading and Installing: "); define ("EPL_ADLAN_231", "Remove icons from Media-Manager"); define ("EPL_ADLAN_232", "Create Files"); -define ("TPVLAN_81", "Downloading..."); -define ("TPVLAN_82", "Download Complete!"); + define ("EPL_ADLAN_233", "Adding Link:"); define ("EPL_ADLAN_234", "Removing Link:"); define ("EPL_ADLAN_235", "Automated download not possible."); diff --git a/e107_languages/English/admin/lan_theme.php b/e107_languages/English/admin/lan_theme.php index d04c62bc6..79f1f81bf 100644 --- a/e107_languages/English/admin/lan_theme.php +++ b/e107_languages/English/admin/lan_theme.php @@ -5,7 +5,7 @@ * Theme manager language file */ -define("TPVLAN_1", "You are looking at a preview of the '".PREVIEWTHEMENAME."' theme. It has not been set as the main theme for your site, it has been activated to provide a preview of how the theme looks.
To set this theme as your site theme, return to your theme manager and select 'Set As Site Theme'.
To preview more themes please click here"); +define("TPVLAN_1", "You are looking at a preview of the {PREVIEWTHEMENAME} theme. It has not been set as the main theme for your site, it has been activated to provide a preview of how the theme looks.
To set this theme as your site theme, return to your theme manager and select 'Set As Site Theme'.
To preview more themes please click here"); define("TPVLAN_2", "Theme Preview"); define("TPVLAN_3", "Site theme changed."); //define("TPVLAN_4", "Author");//LAN_AUTHOR @@ -114,8 +114,7 @@ define("TPVLAN_CONV_15", "Give this stylesheet a name"); define("TPVLAN_CONV_16", "URL to a live-demo of this theme."); //marketplace -define("TPVLAN_81","Downloading..."); -define("TPVLAN_82","Download Complete!"); + define("TPVLAN_83","Automated download not possible!"); define("TPVLAN_84","[Please Download Manually]"); define("TPVLAN_85","Connecting...");