diff --git a/class2.php b/class2.php index 6454aec64..9df9c9108 100755 --- a/class2.php +++ b/class2.php @@ -832,103 +832,6 @@ if(!defined('USERTHEME')) define('USERTHEME', (e107::getUser()->getPref('sitetheme') && file_exists(e_THEME.e107::getUser()->getPref('sitetheme'). '/theme.php') ? e107::getUser()->getPref('sitetheme') : false)); } -//########### Module redefinable functions ############### -if (!function_exists('checkvalidtheme')) -{ - - function checkvalidtheme($theme_check) - { - // arg1 = theme to check - //global $ADMIN_DIRECTORY, $tp, $e107; - // global $sql; - $sql = e107::getDb(); - $e107 = e107::getInstance(); - $tp = e107::getParser(); - $ADMIN_DIRECTORY = $e107->getFolder('admin'); - - // e_QUERY not set when in single entry mod - if (ADMIN && strpos($_SERVER['QUERY_STRING'], 'themepreview') !== false) - { - list($action, $id) = explode('.', $_SERVER['QUERY_STRING']); - - require_once(e_HANDLER.'theme_handler.php'); - $themeobj = new themeHandler; - $themeArray = $themeobj->getThemes('id'); - - $id = (int) $id; - - $themeDef = $themeobj->findDefault($themeArray[$id]); - - define('THEME_LAYOUT',$themeDef); - - define('PREVIEWTHEME', e_THEME.$themeArray[$id].'/'); - define('PREVIEWTHEMENAME', $themeArray[$id]); - define('THEME', e_THEME.$themeArray[$id].'/'); - define('THEME_ABS', e_THEME_ABS.$themeArray[$id].'/'); - - $legacy = (file_exists( e_THEME_ABS.$themeArray[$id].'/theme.xml') === false); - - define('THEME_LEGACY',$legacy); - unset($action); - - return; - } - - e107::getDebug()->logTime('Theme Check'); - - if (@fopen(e_THEME.$theme_check.'/theme.php', 'r')) - // if (is_readable(e_THEME.$theme_check.'/theme.php')) - { - define('THEME', e_THEME.$theme_check.'/'); - define('THEME_ABS', e_THEME_ABS.$theme_check.'/'); - - $legacy = (file_exists(e_THEME.$theme_check.'/theme.xml') === false); - - define('THEME_LEGACY',$legacy); - - $e107->site_theme = $theme_check; - } - else - { - function search_validtheme() - { - $e107 = e107::getInstance(); - $th = substr(e_THEME, 0, -1); - $handle = opendir($th); - while ($file = readdir($handle)) - { - if (is_dir(e_THEME.$file) && is_readable(e_THEME.$file.'/theme.php')) - { - closedir($handle); - $e107->site_theme = $file; - return $file; - } - } - closedir($handle); - return null; - } - - $e107tmp_theme = 'bootstrap3'; // set to bootstrap3 by default. search_validtheme(); - define('THEME', e_THEME.$e107tmp_theme.'/'); - define('THEME_ABS', e_THEME_ABS.$e107tmp_theme.'/'); - if (ADMIN && strpos(e_SELF, $ADMIN_DIRECTORY) === false) - { - echo ''; - $tm = e107::getSingleton('themeHandler'); - $tm->setTheme($e107tmp_theme); - // $config = e107::getConfig(); - // $config->set('sitetheme','core'); - - } - } - e107::getDebug()->logTime('Theme Check End'); - - $themes_dir = $e107->getFolder('themes'); - $e107->http_theme_dir = "{$e107->server_path}{$themes_dir}{$e107->site_theme}/"; - - unset($sql); - } -} // // Q: ALL OTHER SETUP CODE @@ -1346,7 +1249,7 @@ if (($_SERVER['QUERY_STRING'] === 'logout')/* || (($pref['user_tracking'] == 'se } } - // $ip = e107::getIPHandler()->getIP(FALSE); Appears to not be used, so removed + // $ip = e107::getIPHandler()->getIP(false); Appears to not be used, so removed $udata = (USER === true ? USERID.'.'.USERNAME : '0'); // TODO - should be done inside online handler, more core areas need it (session handler for example) @@ -1481,22 +1384,15 @@ if(!defined('THEME')) if (e_ADMIN_AREA && vartrue($pref['admintheme'])) { - //We have now e_IFRAME mod and USER_AREA force - // && (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE) - -/* if (strpos(e_SELF, "newspost.php") !== FALSE) - { - define("MAINTHEME", e_THEME.$pref['sitetheme']."/"); MAINTHEME no longer used in core distribution - } */ - checkvalidtheme($pref['admintheme']); + e_theme::initTheme($pref['admintheme']); } - elseif (USERTHEME !== false/* && USERTHEME != 'USERTHEME'*/ && !e_ADMIN_AREA) + elseif (USERTHEME !== false && !e_ADMIN_AREA) { - checkvalidtheme(USERTHEME); + e_theme::initTheme(USERTHEME); } else { - checkvalidtheme($pref['sitetheme']); + e_theme::initTheme($pref['sitetheme']); } @@ -1504,33 +1400,7 @@ if(!defined('THEME')) $theme_pref = varset($pref['sitetheme_pref']); // -------------------------------------------------------------- -$dbg->logTime('Find/Load Theme-Layout'); // needs to run after checkvalidtheme() (for theme previewing). -if(deftrue('e_ADMIN_AREA')) -{ - define('THEME_STYLE', $pref['admincss']); -} -elseif(varset($pref['themecss']) && file_exists(THEME.$pref['themecss'])) -{ - define('THEME_STYLE', $pref['themecss']); -} -else -{ - define('THEME_STYLE', 'style.css'); -} - -if(!defined('THEME_LAYOUT')) -{ - $user_pref = e107::getUser()->getPref(); - $pref = e107::getPref(); - $cusPagePref = (!empty($user_pref['sitetheme_custompages'])) ? $user_pref['sitetheme_custompages'] : varset($pref['sitetheme_custompages'],array()); - $cusPageDef = (empty($user_pref['sitetheme_deflayout'])) ? varset($pref['sitetheme_deflayout']) : $user_pref['sitetheme_deflayout']; - $deflayout = e107::getTheme()->getThemeLayout($cusPagePref, $cusPageDef, e_REQUEST_URL, varset($_SERVER['SCRIPT_FILENAME'])); - - define('THEME_LAYOUT',$deflayout); - - unset($cusPageDef,$lyout,$cusPagePref,$menus_equery,$deflayout); -} // Load library dependencies. $dbg->logTime('Load Libraries'); @@ -1580,28 +1450,6 @@ else $dbg->logTime("Init Theme Class"); e107::getRender()->init(); // initialize theme class. -//---------------------------- -// Load shortcode handler -//---------------------------- -// ********* This is probably a bodge! Work out what to do properly. Has to be done when $pref valid -//FIXED - undefined $register_sc -//$tp->sch_load(); - will be auto-initialized by first $tp->e_sc call - see e_parse->__get() - -/* -$exclude_lan = array('lan_signup.php'); // required for multi-language. - -if ($inAdminDir) -{ - e107_include_once(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE); - e107_include_once(e_LANGUAGEDIR.'English/admin/lan_'.e_PAGE); -} -elseif (!in_array('lan_'.e_PAGE,$exclude_lan) && !$isPluginDir) -{ - e107_include_once(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE); - e107_include_once(e_LANGUAGEDIR.'English/lan_'.e_PAGE); -} -*/ - if ($pref['anon_post']) { define('ANON', true); @@ -1622,7 +1470,7 @@ else if (!empty($pref['antiflood1']) && !defined('FLOODPROTECT')) { - define('FLOODPROTECT', TRUE); + define('FLOODPROTECT', true); define('FLOODTIMEOUT', max(varset($pref['antiflood_timeout'], 10), 3)); } else @@ -1630,7 +1478,7 @@ else /** * @ignore */ - define('FLOODPROTECT', FALSE); + define('FLOODPROTECT', false); } $layout = isset($layout) ? $layout : '_default'; @@ -1664,20 +1512,18 @@ else /** * @ignore */ - define('e_REFERER_SELF', FALSE); + define('e_REFERER_SELF', false); } -//BC, DEPRECATED - use e107::getDateConvert(), catched by __autoload as well -/*if (!class_exists('convert')) -{ - require_once(e_HANDLER.'date_handler.php'); -}*/ -//@require_once(e_HANDLER."IPB_int.php"); -//@require_once(e_HANDLER."debug_handler.php"); -//------------------------------------------------------------------------------------------------------------------------------------------- +/** + * @deprecated Use e107::getRedirect()->go($url) instead. + * @param $qry + */ function js_location($qry) { + trigger_error('js_location() is deprecated. e107::getRedirect()->go($url) instead.', E_USER_DEPRECATED); // NO LAN + global $error_handler; if (count($error_handler->errors)) { @@ -1716,8 +1562,8 @@ function check_email($email) /** * @param mixed $var is a single class number or name, or a comma-separated list of the same. * @param mixed $userclass a custom list of userclasses or leave blank for the current user's permissions. - * If a class is prefixed with '-' this means 'exclude' - returns FALSE if the user is in this class (overrides 'includes'). - * Otherwise returns TRUE if the user is in any of the classes listed in $var. + * If a class is prefixed with '-' this means 'exclude' - returns false if the user is in this class (overrides 'includes'). + * Otherwise returns true if the user is in any of the classes listed in $var. * @param int $uid * @return bool */ @@ -1767,7 +1613,7 @@ function check_class($var, $userclass = USERCLASS_LIST, $uid = 0) if ($v[0] === '-') { - $invert = TRUE; + $invert = true; $v = substr($v, 1); } $v = $e107->user_class->ucGetClassIDFromName($v); @@ -1777,7 +1623,7 @@ function check_class($var, $userclass = USERCLASS_LIST, $uid = 0) $invert = true; $v = -$v; } - if ($v !== FALSE) + if ($v !== false) { // var_dump($v); // Ignore non-valid userclass names @@ -1787,7 +1633,7 @@ function check_class($var, $userclass = USERCLASS_LIST, $uid = 0) { return false; } - $latchedAccess = TRUE; + $latchedAccess = true; } elseif ($invert && count($varList) == 1) { @@ -1839,7 +1685,7 @@ function getperms($arg, $ap = ADMINPERMS) $ap_array = explode('.',$ap); - if (in_array($arg,$ap_array,FALSE)) + if (in_array($arg,$ap_array,false)) { return true; } @@ -2025,7 +1871,7 @@ class floodprotect return ($row[$orderfield] <= (time() - FLOODTIMEOUT)); } - return TRUE; + return true; } } @@ -2252,7 +2098,7 @@ $dbg->logTime('(After Go online)'); */ function cookie($name, $value, $expire=0, $path = e_HTTP, $domain = '', $secure = 0) { - if(!e_SUBDOMAIN || (defined('MULTILANG_SUBDOMAIN') && MULTILANG_SUBDOMAIN === TRUE)) + if(!e_SUBDOMAIN || (defined('MULTILANG_SUBDOMAIN') && MULTILANG_SUBDOMAIN === true)) { $domain = (e_DOMAIN !== false) ? ".".e_DOMAIN : ""; } @@ -2270,9 +2116,9 @@ function session_set($name, $value, $expire='', $path = e_HTTP, $domain = '', $s } else { - if((empty($domain) && !e_SUBDOMAIN) || (defined('MULTILANG_SUBDOMAIN') && MULTILANG_SUBDOMAIN === TRUE)) + if((empty($domain) && !e_SUBDOMAIN) || (defined('MULTILANG_SUBDOMAIN') && MULTILANG_SUBDOMAIN === true)) { - $domain = (e_DOMAIN !== FALSE) ? ".".e_DOMAIN : ""; + $domain = (e_DOMAIN !== false) ? ".".e_DOMAIN : ""; } if(defined('e_MULTISITE_MATCH')) @@ -2317,9 +2163,9 @@ function table_exists($check) foreach ($GLOBALS['mySQLtablelist'] as $lang) { - if (strpos($lang, $mltable) !== FALSE) + if (strpos($lang, $mltable) !== false) { - return TRUE; + return true; } } } @@ -2408,13 +2254,13 @@ function include_lan($path, $force = false) // 'admin' - the standard admin language file for a plugin // 'theme' - the standard language file for a plugin (these are usually pretty small, so one is enough) // Otherwise, $type is treated as part of a filename within the plugin's language directory, prefixed with the current language -// Returns FALSE on failure (not found). +// Returns false on failure (not found). // Returns the include_once error return if there is one // Otherwise returns an empty string. // Note - if the code knows precisely where the language file is located, use include_lan() -// $pref['noLanguageSubs'] can be set TRUE to prevent searching for the English files if the files for the current site language don't exist. +// $pref['noLanguageSubs'] can be set true to prevent searching for the English files if the files for the current site language don't exist. //DEPRECATED - use e107::loadLanFiles(); /** * @deprecated - use e107::loadLanFiles(); @@ -2438,13 +2284,13 @@ function loadLanFiles($unitName, $type='runtime') /** * Check that all required user fields (including extended fields) are valid. * @param array $currentUser - data for user - * @return boolean TRUE if update required + * @return boolean true if update required */ function force_userupdate($currentUser) { - if (e_PAGE == 'usersettings.php' || (defined('FORCE_USERUPDATE') && (FORCE_USERUPDATE == FALSE)) || strpos(e_SELF, ADMINDIR) == TRUE ) + if (e_PAGE == 'usersettings.php' || (defined('FORCE_USERUPDATE') && (FORCE_USERUPDATE == false)) || strpos(e_SELF, ADMINDIR) == true ) { - return FALSE; + return false; } $signup_option_names = array('realname', 'signature', 'image', 'timezone', 'class'); @@ -2457,7 +2303,7 @@ function force_userupdate($currentUser) } } - if (!e107::getPref('disable_emailcheck',TRUE) && !trim($currentUser['user_email'])) return TRUE; + if (!e107::getPref('disable_emailcheck',true) && !trim($currentUser['user_email'])) return true; if(e107::getDb()->select('user_extended_struct', 'user_extended_struct_applicable, user_extended_struct_write, user_extended_struct_name, user_extended_struct_type', 'user_extended_struct_required = 1 AND user_extended_struct_applicable != '.e_UC_NOBODY)) { @@ -2468,17 +2314,17 @@ function force_userupdate($currentUser) $user_extended_struct_name = "user_{$row['user_extended_struct_name']}"; if (!isset($currentUser[$user_extended_struct_name])) { - //e107::admin_log->addEvent(4, __FILE__."|".__FUNCTION__."@".__LINE__, 'FORCE', 'Force User update', 'Trigger field: '.$user_extended_struct_name, FALSE, LOG_TO_ROLLING); - return TRUE; + //e107::admin_log->addEvent(4, __FILE__."|".__FUNCTION__."@".__LINE__, 'FORCE', 'Force User update', 'Trigger field: '.$user_extended_struct_name, false, LOG_TO_ROLLING); + return true; } if (($row['user_extended_struct_type'] == 7) && ($currentUser[$user_extended_struct_name] == '0000-00-00')) { - //e107::admin_log->addEvent(4, __FILE__."|".__FUNCTION__."@".__LINE__, 'FORCE', 'Force User update', 'Trigger field: '.$user_extended_struct_name, FALSE, LOG_TO_ROLLING); - return TRUE; + //e107::admin_log->addEvent(4, __FILE__."|".__FUNCTION__."@".__LINE__, 'FORCE', 'Force User update', 'Trigger field: '.$user_extended_struct_name, false, LOG_TO_ROLLING); + return true; } } } - return FALSE; + return false; } @@ -2692,7 +2538,7 @@ class error_handler } } - return ($ret) ? "\n".$ret."
" : FALSE; + return ($ret) ? "\n".$ret."
" : false; } /** @@ -2959,22 +2805,25 @@ class e_http_header -} - - - - - - +} +/** + * @deprecated Use ini_set() directly. + * @param $var + * @param $value + * @return false|string + */ function e107_ini_set($var, $value) { + trigger_error('e107_ini_set() is deprecated. Use ini_set() instead.', E_USER_DEPRECATED); // NO LAN + if (function_exists('ini_set')) { return ini_set($var, $value); } - return FALSE; + + return false; } // Return true if specified plugin installed, false if not diff --git a/e107_handlers/core_functions.php b/e107_handlers/core_functions.php index 4ac89425c..1adfb1b52 100644 --- a/e107_handlers/core_functions.php +++ b/e107_handlers/core_functions.php @@ -181,7 +181,7 @@ function e_dump($expr = null) /** * Strips slashes from a var if magic_quotes_gqc is enabled - * + * @deprecated * @param mixed $data * @return mixed */ diff --git a/e107_handlers/db_debug_class.php b/e107_handlers/db_debug_class.php index 31da726a3..11958b0ac 100644 --- a/e107_handlers/db_debug_class.php +++ b/e107_handlers/db_debug_class.php @@ -528,7 +528,7 @@ { // First time: emit headers $bRowHeaders = true; - $text .= "" . implode(" ", array_keys($tMarker)) . " OB Lev \n"; + $head = "" . implode(" ", array_keys($tMarker)) . " OB Lev \n"; $aUnits = $tMarker; foreach($aUnits as $key => $val) { @@ -546,7 +546,8 @@ $aUnits['OB Lev'] = 'lev(buf bytes)'; $aUnits['Memory'] = '(kb)'; $aUnits['Memory Used'] = '(kb)'; - $text .= "" . implode(" ", $aUnits) . " \n"; + $head .= "" . implode(" ", $aUnits) . " \n"; + $text .= $head; } @@ -627,6 +628,8 @@ } } + $text .= $head; + $aSum['%Time'] = $totTime ? number_format(100.0 * ($aSum['Time'] / $totTime), 0) : 0; $aSum['%DB Time'] = $db_time ? number_format(100.0 * ($aSum['DB Time'] / $db_time), 0) : 0; $aSum['%DB Count'] = ($sql->db_QueryCount()) ? number_format(100.0 * ($aSum['DB Count'] / ($sql->db_QueryCount())), 0) : 0; @@ -673,8 +676,9 @@ $bRowHeaders = false; $aSum = $this->aDBbyTable['core']; // create a template from the 'real' array $aSum['Table'] = 'Total'; - $aSum['%DB Count'] = 0; $aSum['%DB Time'] = 0; + $aSum['%DB Count'] = 0; + $aSum['DB Time'] = 0; $aSum['DB Count'] = 0; diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index b3017250f..d9c41969e 100644 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -52,7 +52,7 @@ class e107 public $_host_name_cache; public $site_theme; // class2 -> check valid theme - public $http_theme_dir; // class2 -> check valid theme +// public $http_theme_dir; // class2 -> check valid theme /** * Contains reference to global $_E107 array @@ -5390,7 +5390,7 @@ class e107 break; case 'admin_log': - $ret = self::getAdminLog(); + $ret = self::getLog(); break; case 'override': diff --git a/e107_handlers/sitelinks_class.php b/e107_handlers/sitelinks_class.php index 9b927b9f4..4d61d3c33 100644 --- a/e107_handlers/sitelinks_class.php +++ b/e107_handlers/sitelinks_class.php @@ -33,7 +33,7 @@ class sitelinks $this->eLinkList = array(); // clear the array in case getlinks is called 2x on the same page. $sql = e107::getDb('sqlSiteLinks'); - $ins = ($cat > 0) ? "link_category = ".intval($cat)." AND " : ""; + $ins = ($cat > 0) ? "link_category = ". (int) $cat ." AND " : ""; $query = "SELECT * FROM #links WHERE ".$ins." ((link_class >= 0 AND link_class IN (".USERCLASS_LIST.")) OR (link_class < 0 AND ABS(link_class) NOT IN (".USERCLASS_LIST.")) ) ORDER BY link_order ASC"; if($sql->gen($query)) { @@ -220,7 +220,7 @@ class sitelinks $mnu = $style['prelink']; foreach($this->eLinkList[$k] as $link) { - if($k != 'head_menu') + if($k !== 'head_menu') { $mnu .= $this->makeLink($link, true, $style, $css_class); } @@ -337,7 +337,7 @@ class sitelinks { $linkInfo['link_url'] = $tp->parseTemplate($linkInfo['link_url'], TRUE); // shortcode in URL support - dynamic urls for multilanguage. } - elseif($linkInfo['link_url'][0] != '/' && strpos($linkInfo['link_url'],'http') !== 0) + elseif($linkInfo['link_url'][0] !== '/' && strpos($linkInfo['link_url'],'http') !== 0) { $linkInfo['link_url'] = e_HTTP.ltrim($linkInfo['link_url'],'/'); } @@ -474,7 +474,7 @@ class sitelinks $link_pge = basename($link_slf); $link_match = (empty($tmp[0])) ? "": strpos(e_SELF,$tmp[0]); // e_SELF is the actual displayed page - if(e_MENU == "debug" && getperms('0')) + if(e_MENU === "debug" && getperms('0')) { echo "
link= ".$link; echo "
link_q= ".$link_qry; @@ -512,7 +512,7 @@ class sitelinks } } list($fp,$fp_q) = explode("?",$full_url."?"); // extra '?' ensure the array is filled - if (e_MENU == "debug" && getperms('0')) + if (e_MENU === "debug" && getperms('0')) { echo "\$fp = ".$fp."
"; echo "\$fp_q = ".$fp_q."
"; @@ -544,19 +544,19 @@ class sitelinks // --------------- highlight for news items.---------------- // eg. news.php, news.php?list.1 or news.php?cat.2 etc - if(substr(basename($link),0,8) == "news.php") + if(strpos(basename($link), "news.php") === 0) { if (strpos($link, "news.php?") !== FALSE && strpos(e_SELF,"/news.php")!==FALSE) { $lnk = explode(".",$link_qry); // link queries. $qry = explode(".",e_QUERY); // current page queries. - if($qry[0] == "item") + if($qry[0] === "item") { return ($qry[2] == $lnk[1]) ? TRUE : FALSE; } - if($qry[0] == "all" && $lnk[0] == "all") + if($qry[0] === "all" && $lnk[0] === "all") { return TRUE; } @@ -566,7 +566,7 @@ class sitelinks return TRUE; } - if($qry[1] == "list" && $lnk[0] == "list" && $lnk[1] == $qry[2]) + if($qry[1] === "list" && $lnk[0] === "list" && $lnk[1] == $qry[2]) { return TRUE; } @@ -582,7 +582,7 @@ class sitelinks // eg. page.php?1, or page.php?5.7 [2nd parameter is page # within item] //echo "Link: {$link}, link query: {$link_qry}, e_SELF: ".e_SELF.", link_slf: {$link_slf}, link_pge: {$link_pge}, e_PAGE: ".e_PAGE."
"; - if (($link_slf == e_HTTP.'page.php') && (e_PAGE == 'page.php')) + if (($link_slf == e_HTTP.'page.php') && (e_PAGE === 'page.php')) { list($custom,$page) = explode('.',$link_qry.'.'); list($q_custom,$q_page) = explode('.',e_QUERY.'.'); @@ -799,7 +799,7 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; } // Misc. $this->admin_cat['title'][6] = ADLAN_CL_8; $this->admin_cat['id'][6] = 'miscMenu'; - $this->admin_cat['img'][6] = 'fa-puzzle-piece.glyph'; ; // E_16_CAT_MISC; + $this->admin_cat['img'][6] = 'fa-puzzle-piece.glyph'; // E_16_CAT_MISC; $this->admin_cat['lrg_img'][6] = ''; // E_32_CAT_MISC; $this->admin_cat['sort'][6] = TRUE; } @@ -820,12 +820,12 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; } function adminLinks($mode=false) { - if($mode == 'plugin') + if($mode === 'plugin') { return $this->pluginLinks(E_16_PLUGMANAGER, "array") ; } - if($mode == 'plugin2') + if($mode === 'plugin2') { return $this->pluginLinks(E_16_PLUGMANAGER, "standard") ; } @@ -835,7 +835,7 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; } $this->setIconArray(); - if($mode=='sub') + if($mode === 'sub') { //FIXME array structure suitable for e_admin_menu - see shortcodes/admin_navigation.php @@ -910,7 +910,7 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; } ); - if($mode == 'legacy') + if($mode === 'legacy') { return $array_functions; // Old BC format. } @@ -920,7 +920,7 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; } - if($mode == 'core') // Core links only. + if($mode === 'core') // Core links only. { return $array_functions_assoc; } @@ -1188,7 +1188,7 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; } foreach($plugs->plug_vars['adminLinks']['link'] as $tag) { - if(varset($tag['@attributes']['primary']) !='true') + if(varset($tag['@attributes']['primary']) !== 'true') { continue; } @@ -1230,7 +1230,7 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; } ksort($plugin_array, SORT_STRING); // To FIX, without changing the current key format, sort by 'title' - if($linkStyle == "array" || $iconSize == 'assoc') + if($linkStyle === "array" || $iconSize === 'assoc') { return $plugin_array; } @@ -1278,7 +1278,9 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; } $tp = e107::getParser(); if (!$tmpl) + { $tmpl = $E_ADMIN_MENU; + } /* * Search for id @@ -1413,7 +1415,7 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; } - if($rid == 'adminhome') + if($rid === 'adminhome') { $temp = $tmpl['button_other'.$kpost]; } @@ -1475,7 +1477,7 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; } $replace['LINK_BADGE'] = isset($e107_vars[$act]['badge']['value']) ? $tp->toLabel($e107_vars[$act]['badge']['value'], varset($e107_vars[$act]['badge']['type'])) : ''; - if($rid == 'logout' || $rid == 'home' || $rid == 'language') + if($rid === 'logout' || $rid === 'home' || $rid === 'language') { $START_SUB = $tmpl['start_other_sub']; } @@ -1532,7 +1534,7 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; } if (getperms($perms)) { $description = strip_tags($description); - if ($mode == 'adminb') + if ($mode === 'adminb') { $text = "
0) ? " link_category = ".intval($cat)." AND " : ""; + $ins = ($cat > 0) ? " link_category = ". (int) $cat ." AND " : ""; $query = "SELECT * FROM #links WHERE ".$ins." ((link_class >= 0 AND link_class IN (".USERCLASS_LIST.")) OR (link_class < 0 AND ABS(link_class) NOT IN (".USERCLASS_LIST.")) ) ORDER BY link_order,link_parent ASC"; @@ -1751,7 +1756,10 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; } $val['link_identifier'] = $frm->name2id($val['link_function']); } // prevent loop of death - if( $val['link_id'] != $pid) $this->compile($inArray, $val['link_sub'], $val['link_id']); + if( $val['link_id'] != $pid) + { + $this->compile($inArray, $val['link_sub'], $val['link_id']); + } $outArray[] = $val; } } @@ -1820,7 +1828,10 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; } */ public function isActive(&$data=array(), $removeOnly = false, $exactMatch = false) { - if(empty($data)) return null; + if(empty($data)) + { + return null; + } ### experimental active match added to the URL (and removed after parsing) @@ -1849,10 +1860,16 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; } } // No need of further checks - if($removeOnly) return null; + if($removeOnly) + { + return null; + } // already checked by compile() or external source - if(isset($data['link_active'])) return $data['link_active']; + if(isset($data['link_active'])) + { + return $data['link_active']; + } $dbLink = e_HTTP. e107::getParser()->replaceConstants($data['link_url'], TRUE, TRUE); // $dbLink = e107::getParser()->replaceConstants($data['link_url'], TRUE, TRUE); @@ -1871,7 +1888,10 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; } if($exactMatch) { - if(e_REQUEST_URI == $dbLink) return true; + if(e_REQUEST_URI == $dbLink) + { + return true; + } } // XXX this one should go soon - no cotroll at all elseif(e_REQUEST_HTTP == $dbLink) @@ -1950,19 +1970,19 @@ class navigation_shortcodes extends e_shortcode */ function sc_link_id($parm=null) { - return intval($this->var['link_id']); + return (int) $this->var['link_id']; } function sc_link_depth($parm=null) { unset($parm); - return isset($this->var['link_depth']) ? intval($this->var['link_depth']) : $this->depth; + return isset($this->var['link_depth']) ? (int) $this->var['link_depth'] : $this->depth; } function setDepth($val) { - $this->depth = intval($val); + $this->depth = (int) $val; } @@ -1978,7 +1998,7 @@ class navigation_shortcodes extends e_shortcode return null; } - if(substr($this->var['link_name'],0,8) == 'submenu.') // BC Fix. + if(strpos($this->var['link_name'], 'submenu.') === 0) // BC Fix. { list($tmp,$tmp2,$link) = explode('.',$this->var['link_name'],3); unset($tmp,$tmp2); @@ -1998,7 +2018,7 @@ class navigation_shortcodes extends e_shortcode */ function sc_link_parent($parm=null) { - return intval($this->var['link_parent']); + return (int) $this->var['link_parent']; } @@ -2024,7 +2044,7 @@ class navigation_shortcodes extends e_shortcode { $url = "{e_BASE}".substr($this->var['link_url'], strlen(e_HTTP)); } - elseif($this->var['link_url'][0] != "{" && strpos($this->var['link_url'],"://")===false) + elseif($this->var['link_url'][0] !== "{" && strpos($this->var['link_url'],"://")===false) { $url = "{e_BASE}".$this->var['link_url']; // Add e_BASE to links like: 'news.php' or 'contact.php' } @@ -2119,7 +2139,10 @@ class navigation_shortcodes extends e_shortcode { $tp = e107::getParser(); - if (empty($this->var['link_button'])) return ''; + if (empty($this->var['link_button'])) + { + return ''; + } // if($icon = $tp->toGlyph($this->var['link_button'])) // { @@ -2187,7 +2210,10 @@ class navigation_shortcodes extends e_shortcode $this->setVars($val); // isActive is allowed to alter data $tmpl = !empty($val['link_sub']) ? varset($this->template['submenu_loweritem'.$active]) : varset($this->template['submenu_item'.$active]); $text .= e107::getParser()->parseTemplate($tmpl, TRUE, $this); - if($active) $this->activeSubFound = true; + if($active) + { + $this->activeSubFound = true; + } } $text .= e107::getParser()->parseTemplate(str_replace('{LINK_SUB}', '', $endTemplate), true, $this); diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php index addb23c6b..0cd40a64e 100644 --- a/e107_handlers/theme_handler.php +++ b/e107_handlers/theme_handler.php @@ -1026,6 +1026,116 @@ class e_theme } + private static function initThemePreview($id) + { + $themeobj = new themeHandler; + $themeArray = $themeobj->getThemes('id'); + $id = (int) $id; + + $themeDef = $themeobj->findDefault($themeArray[$id]); + + define('THEME_LAYOUT', $themeDef); + define('PREVIEWTHEME', e_THEME . $themeArray[$id] . '/'); + define('PREVIEWTHEMENAME', $themeArray[$id]); + define('THEME', e_THEME . $themeArray[$id] . '/'); + define('THEME_ABS', e_THEME_ABS . $themeArray[$id] . '/'); + + $legacy = (file_exists(e_THEME_ABS . $themeArray[$id] . '/theme.xml') === false); + + define('THEME_LEGACY', $legacy); + unset($action); + + } + + private static function initThemeLayout() + { + e107::getDebug()->logTime('Find/Load Theme-Layout'); // needs to run after checkvalidtheme() (for theme previewing). + + if(deftrue('e_ADMIN_AREA')) + { + define('THEME_STYLE', $pref['admincss']); + } + elseif(!empty($pref['themecss']) && file_exists(THEME.$pref['themecss'])) + { + define('THEME_STYLE', $pref['themecss']); + } + else + { + define('THEME_STYLE', 'style.css'); + } + + if(!defined('THEME_LAYOUT')) + { + $user_pref = e107::getUser()->getPref(); + $pref = e107::getPref(); + $cusPagePref = (!empty($user_pref['sitetheme_custompages'])) ? $user_pref['sitetheme_custompages'] : varset($pref['sitetheme_custompages'],array()); + $cusPageDef = (empty($user_pref['sitetheme_deflayout'])) ? varset($pref['sitetheme_deflayout']) : $user_pref['sitetheme_deflayout']; + $deflayout = e107::getTheme()->getThemeLayout($cusPagePref, $cusPageDef, e_REQUEST_URL, varset($_SERVER['SCRIPT_FILENAME'])); + + define('THEME_LAYOUT',$deflayout); + + unset($cusPageDef,$lyout,$cusPagePref,$menus_equery,$deflayout); + } + + + } + /** + * Replacement of checkvalidtheme() + * @param string $themeDir + */ + public static function initTheme($themeDir) + { + $sql = e107::getDb(); + $e107 = e107::getInstance(); + $tp = e107::getParser(); + + e107::getDebug()->logTime('Theme Check'); + + // e_QUERY not set when in single entry mod + if (ADMIN && strpos($_SERVER['QUERY_STRING'], 'themepreview') !== false) + { + list($action, $id) = explode('.', $_SERVER['QUERY_STRING']); + self::initThemePreview($id); + self::initThemeLayout(); + return; + } + + + // check for valid theme. + if (@fopen(e_THEME . $themeDir . '/theme.php', 'r')) + { + define('THEME', e_THEME . $themeDir . '/'); + define('THEME_ABS', e_THEME_ABS . $themeDir . '/'); + + $legacy = (file_exists(e_THEME . $themeDir . '/theme.xml') === false); + define('THEME_LEGACY', $legacy); + + $e107->site_theme = $themeDir; + e107::getDebug()->logTime('Theme Check End'); + + self::initThemeLayout(); + return; + } + + // fallback in case selected theme failed. + + $ADMIN_DIRECTORY = e107::getFolder('admin'); + $e107tmp_theme = 'bootstrap3'; // set to bootstrap3 by default. + define('THEME', e_THEME . $e107tmp_theme . '/'); + define('THEME_ABS', e_THEME_ABS . $e107tmp_theme . '/'); + + if (ADMIN && strpos(e_SELF, $ADMIN_DIRECTORY) === false) + { + echo ''; + $tm = e107::getSingleton('themeHandler'); + $tm->setTheme($e107tmp_theme); + } + + e107::getDebug()->logTime('Theme Check End'); + self::initThemeLayout(); + + } + } diff --git a/e107_tests/tests/unit/ConstantsTest.php b/e107_tests/tests/unit/ConstantsTest.php index 2fa0c6c4e..bf56b039e 100644 --- a/e107_tests/tests/unit/ConstantsTest.php +++ b/e107_tests/tests/unit/ConstantsTest.php @@ -96,5 +96,25 @@ $this->assertTrue($res); + } + + + public function testThemeConstants() + { + $this->assertStringEndsWith('e107_themes/bootstrap3/', THEME); + $this->assertStringEndsWith('/e107_themes/bootstrap3/', THEME_ABS); + + $this->assertNotNull(THEME_LEGACY); + $this->assertFalse(THEME_LEGACY); + + $this->assertSame('style.css', THEME_STYLE); + $this->assertSame('jumbotron_sidebar_right', THEME_LAYOUT); + + $e107 = e107::getInstance(); + $this->assertSame('bootstrap3', $e107->site_theme); + // $this->assertStringEndsWith('/e107_themes/bootstrap3/', $e107->http_theme_dir); + + + } } diff --git a/install.php b/install.php index d1e6988de..3f37e227f 100644 --- a/install.php +++ b/install.php @@ -93,7 +93,7 @@ class installLog static function clear() { - if(!is_writable(__DIR__) || !MAKE_INSTALL_LOG) + if(!MAKE_INSTALL_LOG || !is_writable(__DIR__)) { return null; } @@ -111,7 +111,7 @@ class installLog */ static function add($message, $type='info') { - if(!is_writable(__DIR__) || !MAKE_INSTALL_LOG) + if(!MAKE_INSTALL_LOG || !is_writable(__DIR__)) { return null; } @@ -143,7 +143,7 @@ define("e_UC_NOBODY", 255);*/ define("E107_INSTALL",true); -if($_SERVER['QUERY_STRING'] != "debug") +if($_SERVER['QUERY_STRING'] !== "debug") { error_reporting(0); // suppress all errors unless debugging. } @@ -152,7 +152,7 @@ else error_reporting(E_ALL); } -if($_SERVER['QUERY_STRING'] == 'clear') +if($_SERVER['QUERY_STRING'] === 'clear') { unset($_SESSION); } @@ -168,11 +168,10 @@ function e107_ini_set($var, $value) } // setup some php options -e107_ini_set('magic_quotes_runtime', 0); -e107_ini_set('magic_quotes_sybase', 0); -e107_ini_set('arg_separator.output', '&'); -e107_ini_set('session.use_only_cookies', 1); -e107_ini_set('session.use_trans_sid', 0); + +ini_set('arg_separator.output', '&'); +ini_set('session.use_only_cookies', 1); +ini_set('session.use_trans_sid', 0); if (function_exists('date_default_timezone_set')) { @@ -181,7 +180,7 @@ if (function_exists('date_default_timezone_set')) define('MAGIC_QUOTES_GPC', false); // (ini_get('magic_quotes_gpc') ? true : false)); -$php_version = phpversion(); +$php_version = PHP_VERSION; if(version_compare($php_version, MIN_PHP_VERSION, "<")) { die_fatal_error('A minimum version of PHP '.MIN_PHP_VERSION.' is required'); // no LAN DEF translation accepted by lower versions <5.3 @@ -195,7 +194,7 @@ if(!class_exists('DOMDocument', false)) // Ensure that '.' is the first part of the include path $inc_path = explode(PATH_SEPARATOR, ini_get('include_path')); -if($inc_path[0] != ".") +if($inc_path[0] !== ".") { array_unshift($inc_path, "."); $inc_path = implode(PATH_SEPARATOR, $inc_path); @@ -219,7 +218,7 @@ if (trim($disabled_functions) != '') $disabled_functions = explode( ',', $disabled_functions ); foreach ($disabled_functions as $function) { - if(trim($function) == "realpath") + if(trim($function) === "realpath") { $functions_ok = false; } @@ -352,7 +351,7 @@ class e_install // define('e_UC_MAINADMIN', 250); define('E107_DEBUG_LEVEL',0); - if($_SERVER['QUERY_STRING'] == "debug") + if($_SERVER['QUERY_STRING'] === "debug") { $this->debug = true; } @@ -426,13 +425,13 @@ class e_install global $e_forms; $e_forms->form .= "
"; - if($id != 'start') + if($id !== 'start') { // $this->form .= "« ".LAN_BACK." "; $prevStage = ($this->stage - 1); $e_forms->form .= " "; } - if($id != 'back') + if($id !== 'back') { $e_forms->form .= ""; } @@ -482,7 +481,7 @@ class e_install $this->raise_error("Install stage information from client makes no sense to me."); } - if($_SERVER['QUERY_STRING'] == "debug") + if($_SERVER['QUERY_STRING'] === "debug") { $this->template->SetTag("debug_info", print_a($this->previous_steps,TRUE)); } @@ -539,7 +538,7 @@ class e_install $this->template->SetTag("percent", 10); $this->template->SetTag("bartype", 'warning'); - $e_forms->start_form("language_select", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : "")); + $e_forms->start_form("language_select", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] === "debug" ? "?debug" : "")); $e_forms->add_select_item("language", $this->get_languages(), "English"); $this->finish_form(); $this->add_button("start", LAN_CONTINUE); @@ -584,8 +583,8 @@ class e_install // $this->template->SetTag("onload", "document.getElementById('name').focus()"); // $page_info = nl2br(LANINS_023); $page_info = "
".LANINS_141."
"; - $e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : "")); - $isrequired = (($_SERVER['SERVER_ADDR'] == "127.0.0.1") || ($_SERVER['SERVER_ADDR'] == "localhost") || ($_SERVER['SERVER_ADDR'] == "::1") || preg_match('^192\.168\.\d{1,3}\.\d{1,3}$',$_SERVER['SERVER_ADDR'])) ? "" : "required='required'"; // Deals with IP V6, and 192.168.x.x address ranges, could be improved to validate x.x to a valid IP but for this use, I dont think its required to be that picky. + $e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] === "debug" ? "?debug" : "")); + $isrequired = (($_SERVER['SERVER_ADDR'] === "127.0.0.1") || ($_SERVER['SERVER_ADDR'] === "localhost") || ($_SERVER['SERVER_ADDR'] === "::1") || preg_match('/^192\.168\.\d{1,3}\.\d{1,3}$/',$_SERVER['SERVER_ADDR'])) ? "" : "required='required'"; // Deals with IP V6, and 192.168.x.x address ranges, could be improved to validate x.x to a valid IP but for this use, I dont think its required to be that picky. $output = "
@@ -721,7 +720,7 @@ class e_install { $this->stage = 3; $this->template->SetTag("stage_num", LANINS_021); - $e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : "")); + $e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] === "debug" ? "?debug" : "")); $head = LANINS_039."

\n"; $output = "
@@ -781,14 +780,14 @@ class e_install // if (!$res = @mysql_connect($this->previous_steps['mysql']['server'], $this->previous_steps['mysql']['user'], $this->previous_steps['mysql']['password'])) { $success = FALSE; - $e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : "")); + $e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] === "debug" ? "?debug" : "")); $page_content = LANINS_041.nl2br("\n\n".LANINS_083."\n".$sql->getLastErrorText().""); $alertType = 'error'; } elseif(($this->previous_steps['mysql']['createdb'] == 1) && empty($this->previous_steps['mysql']['overwritedb']) && $sql->database($this->previous_steps['mysql']['db'], $this->previous_steps['mysql']['prefix'])) { - $e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : "")); + $e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] === "debug" ? "?debug" : "")); $head = str_replace('[x]', ''.$this->previous_steps['mysql']['db'].'', "
". LANINS_127."
"); $alertType = 'error'; $this->add_button('overwritedb', LANINS_128); @@ -804,7 +803,7 @@ class e_install } else { - $e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : "")); + $e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] === "debug" ? "?debug" : "")); $page_content = " ".LANINS_042; // @TODO Check database version here? /* @@ -916,7 +915,7 @@ class e_install $perms_pass = false; foreach ($not_writable as $file) { - $perms_errors .= (substr($file, -1) == "/" ? LANINS_010a : LANINS_010)."
{$file}
\n"; + $perms_errors .= (substr($file, -1) === "/" ? LANINS_010a : LANINS_010)."
{$file}
\n"; } $perms_notes = LANINS_018; } @@ -925,7 +924,7 @@ class e_install $perms_pass = true; foreach ($opt_writable as $file) { - $perms_errors .= (substr($file, -1) == "/" ? LANINS_010a : LANINS_010)."
{$file}
\n"; + $perms_errors .= (substr($file, -1) === "/" ? LANINS_010a : LANINS_010)."
{$file}
\n"; } $perms_notes = LANINS_106; } @@ -975,7 +974,7 @@ class e_install } } - $php_version = phpversion(); + $php_version = PHP_VERSION; if(version_compare($php_version, MIN_PHP_VERSION, ">=")) { @@ -988,7 +987,7 @@ class e_install - $e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : "")); + $e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] === "debug" ? "?debug" : "")); @@ -1086,7 +1085,7 @@ class e_install $this->template->SetTag("percent", 60); $this->template->SetTag("bartype", 'warning'); - $e_forms->start_form("admin_info", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : "")); + $e_forms->start_form("admin_info", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] === "debug" ? "?debug" : "")); $output = "
@@ -1276,7 +1275,7 @@ class e_install $this->template->SetTag("percent", 70); $this->template->SetTag("bartype", 'warning'); - $e_forms->start_form("pref_info", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : "")); + $e_forms->start_form("pref_info", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] === "debug" ? "?debug" : "")); $output = "
@@ -1552,7 +1551,7 @@ if($this->pdo == true) $this->template->SetTag("percent", 80); $this->template->SetTag("bartype", 'warning'); - $e_forms->start_form("confirmation", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : "")); + $e_forms->start_form("confirmation", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] === "debug" ? "?debug" : "")); $page = '
'.nl2br(LANINS_057).'
'; $this->finish_form(); $this->add_button("submit", LAN_CONTINUE); @@ -1678,7 +1677,7 @@ if($this->pdo == true) { $error = LANINS_142; } - elseif($_SERVER['QUERY_STRING'] == "debug") + elseif($_SERVER['QUERY_STRING'] === "debug") { rename(".htaccess","e107.htaccess"); $error = "DEBUG: Rename from e107.htaccess to .htaccess was successful"; @@ -1777,18 +1776,12 @@ if($this->pdo == true) installLog::add('Plugins table updated'); // Install Theme-required plugins - if(vartrue($this->previous_steps['install_plugins'])) + if(vartrue($this->previous_steps['install_plugins']) && ($themeInfo = $this->get_theme_xml($this->previous_steps['prefs']['sitetheme'])) && isset($themeInfo['plugins']['plugin'])) { - if($themeInfo = $this->get_theme_xml($this->previous_steps['prefs']['sitetheme'])) + foreach($themeInfo['plugins']['plugin'] as $k=>$plug) { - if(isset($themeInfo['plugins']['plugin'])) - { - foreach($themeInfo['plugins']['plugin'] as $k=>$plug) - { - $this->install_plugin($plug['@attributes']['name']); - installLog::add('Theme-related plugin installed: '.$plug['@attributes']['name']); - } - } + $this->install_plugin($plug['@attributes']['name']); + installLog::add('Theme-related plugin installed: '.$plug['@attributes']['name']); } } @@ -1918,9 +1911,13 @@ if($this->pdo == true) function check_name($str, $blank_ok = FALSE) { if ($str == '') + { return $blank_ok; + } if (preg_match("#^\d+[e|E]#", $str)) - return FALSE; + { + return false; + } return TRUE; } @@ -1932,15 +1929,15 @@ if($this->pdo == true) */ function checkDbFields($fields) { - if (!is_array($fields)) return FALSE; + if (!is_array($fields)) + { + return false; + } foreach (array('server', 'user', 'db', 'prefix') as $key) { - if (isset($fields[$key])) + if (isset($fields[$key]) && strtr($fields[$key], "';", ' ') != $fields[$key]) { - if (strtr($fields[$key],"';", ' ') != $fields[$key]) - { - return FALSE; // Invalid character found - } + return FALSE; // Invalid character found } } return TRUE; @@ -1985,7 +1982,7 @@ if($this->pdo == true) $lanlist = array(); while ($file = readdir($handle)) { - if ($file != "." && $file != ".." && $file != "/" && $file != "CVS" && $file != 'index.html') + if ($file !== "." && $file !== ".." && $file !== "/" && $file !== "CVS" && $file !== 'index.html') { if(file_exists("./{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}{$file}/lan_installer.php")) { @@ -2008,7 +2005,7 @@ if($this->pdo == true) $themelist = array(); while ($file = readdir($handle)) { - if (is_dir($this->e107->e107_dirs['THEMES_DIRECTORY'].$file) && $file !='_blank') + if (is_dir($this->e107->e107_dirs['THEMES_DIRECTORY'].$file) && $file !== '_blank') { if(is_readable("./{$this->e107->e107_dirs['THEMES_DIRECTORY']}{$file}/theme.xml")) { @@ -2081,7 +2078,10 @@ if($this->pdo == true) $data['must_write'] = 'e107_config.php|{$MEDIA_DIRECTORY}|{$SYSTEM_DIRECTORY}'; // all-sub folders are created on-the-fly $data['can_write'] = '{$PLUGINS_DIRECTORY}|{$THEMES_DIRECTORY}|{$WEB_DIRECTORY}cache|{$WEB_DIRECTORY}lib'; - if (!isset($data[$list])) return $bad_files; + if (!isset($data[$list])) + { + return $bad_files; + } $find = array(); $replace = array();