diff --git a/.editorconfig b/.editorconfig index 4ecca660c..6005e9107 100644 --- a/.editorconfig +++ b/.editorconfig @@ -727,22 +727,22 @@ ij_php_space_before_else_left_brace = true ij_php_space_before_finally_keyword = true ij_php_space_before_finally_left_brace = true ij_php_space_before_for_left_brace = true -ij_php_space_before_for_parentheses = true +ij_php_space_before_for_parentheses = false ij_php_space_before_for_semicolon = false ij_php_space_before_if_left_brace = true -ij_php_space_before_if_parentheses = true +ij_php_space_before_if_parentheses = false ij_php_space_before_method_call_parentheses = false ij_php_space_before_method_left_brace = true ij_php_space_before_method_parentheses = false ij_php_space_before_quest = true ij_php_space_before_short_closure_left_parenthesis = false ij_php_space_before_switch_left_brace = true -ij_php_space_before_switch_parentheses = true +ij_php_space_before_switch_parentheses = false ij_php_space_before_try_left_brace = true ij_php_space_before_unary_not = false ij_php_space_before_while_keyword = true ij_php_space_before_while_left_brace = true -ij_php_space_before_while_parentheses = true +ij_php_space_before_while_parentheses = false ij_php_space_between_ternary_quest_and_colon = false ij_php_spaces_around_additive_operators = true ij_php_spaces_around_arrow = false diff --git a/e107_core/shortcodes/batch/contact_shortcodes.php b/e107_core/shortcodes/batch/contact_shortcodes.php index 069c01fd9..ad77b708f 100644 --- a/e107_core/shortcodes/batch/contact_shortcodes.php +++ b/e107_core/shortcodes/batch/contact_shortcodes.php @@ -146,10 +146,8 @@ class contact_shortcodes extends e_shortcode $cols = vartrue($parm['cols'],70); $placeholder = !empty($parm['placeholder']) ? "placeholder=\"".$parm['placeholder']."\"" : ""; - if($cols > 60) - { - $size = 'input-xxlarge'; - } + $size = ($cols > 60) ? 'input-xxlarge' : ''; + $class = (!empty($parm['class'])) ? $parm['class'] : 'tbox '.$size.' form-control'; diff --git a/e107_core/shortcodes/batch/news_shortcodes.php b/e107_core/shortcodes/batch/news_shortcodes.php index d4c5d4dc8..8fff1db19 100644 --- a/e107_core/shortcodes/batch/news_shortcodes.php +++ b/e107_core/shortcodes/batch/news_shortcodes.php @@ -385,6 +385,7 @@ class news_shortcodes extends e_shortcode } $tp = e107::getParser(); + $srcPath = ''; if(is_string($parm)) { @@ -392,12 +393,15 @@ class news_shortcodes extends e_shortcode } - $tmp = $this->handleMultiple($parm); + if($tmp = $this->handleMultiple($parm)) + { + $srcPath = $tmp['file']; + } + - $srcPath = $tmp['file']; $class = (!empty($parm['class'])) ? $parm['class'] : "news_image news-image img-responsive img-fluid img-rounded rounded"; - $class .= ' news-image-'.$tmp['count']; + $class .= ' news-image-'.varset($tmp['count'],0); $dimensions = null; $srcset = null; $src = ''; @@ -416,7 +420,7 @@ class news_shortcodes extends e_shortcode $dimensions = $tp->thumbDimensions(); } } - elseif ($srcPath[0] == '{') // Always resize. Use {SETIMAGE: w=x&y=x&crop=0} PRIOR to calling shortcode to change. + elseif ($srcPath[0] === '{') // Always resize. Use {SETIMAGE: w=x&y=x&crop=0} PRIOR to calling shortcode to change. { $src = $tp->thumbUrl($srcPath); $dimensions = $tp->thumbDimensions(); @@ -443,7 +447,7 @@ class news_shortcodes extends e_shortcode } } - if($tmp['count'] > 1 && empty($parm['type'])) // link first image by default, but not others. + if(isset($tmp['count']) && ($tmp['count'] > 1) && empty($parm['type'])) // link first image by default, but not others. { $parm['type'] = 'tag'; } @@ -747,9 +751,10 @@ class news_shortcodes extends e_shortcode $tmp = preg_split('/(\.\s|!|\r|\n|\?)/i', trim($text), 2, PREG_SPLIT_DELIM_CAPTURE); $tmp = array_filter($tmp); - if($tmp[0]) + if(!empty($tmp[0])) { - $text = trim($tmp[0]).trim($tmp[1]); + $text = trim($tmp[0]); + $text .= (!empty($tmp[1])) ? trim($tmp[1]) : ''; } } diff --git a/e107_core/url/news/sef_noid_url.php b/e107_core/url/news/sef_noid_url.php index 3fed5abe9..ef3fcccbe 100644 --- a/e107_core/url/news/sef_noid_url.php +++ b/e107_core/url/news/sef_noid_url.php @@ -73,7 +73,7 @@ class core_news_sef_noid_url extends eUrlConfig switch ($route[1]) { case 'item': - $r[0] = $params['id']; // news/ID + $r[0] = varset($params['id']); // news/ID break; default: diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index 522f86d6d..75927da2c 100644 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -3161,7 +3161,14 @@ class e107 return array(); } - list($templateId, $templateKey) = explode('/', $templateId, 2); + if(strpos($templateId,'/') !== false) + { + list($templateId, $templateKey) = explode('/', $templateId, 2); + } + else + { + $templateKey = ''; + } $wrapperRegPath = 'templates/wrapper/'.$templateId; diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index c74905404..d38a495a4 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -4719,7 +4719,7 @@ class e_parser } } - elseif($file[0] === '{') // Legacy v1.x path. Example: {e_PLUGIN}myplugin/images/fixedimage.png + elseif(!empty($file) && $file[0] === '{') // Legacy v1.x path. Example: {e_PLUGIN}myplugin/images/fixedimage.png { $path = $tp->replaceConstants($file,'abs'); } diff --git a/e107_handlers/magpie_rss.php b/e107_handlers/magpie_rss.php index c889de199..f492c9f46 100644 --- a/e107_handlers/magpie_rss.php +++ b/e107_handlers/magpie_rss.php @@ -120,8 +120,7 @@ class MagpieRSS { # setup handlers # xml_set_object( $this->parser, $this ); - xml_set_element_handler($this->parser, - 'feed_start_element', 'feed_end_element' ); + xml_set_element_handler($this->parser, 'feed_start_element', 'feed_end_element' ); xml_set_character_data_handler( $this->parser, 'feed_cdata' ); @@ -144,7 +143,7 @@ class MagpieRSS { $this->normalize(); } - function feed_start_element($p, $element, &$attrs) { + function feed_start_element($p, $element, $attrs) { $el = $element = strtolower($element); $attrs = array_change_key_case($attrs, CASE_LOWER); @@ -560,9 +559,9 @@ class MagpieRSS { function error ($errormsg, $lvl=E_USER_WARNING) { // append PHP's error message if track_errors enabled - if ( $php_errormsg ) { + /* if ( $php_errormsg ) { $errormsg .= " ({$php_errormsg})"; - } + }*/ if ( defined('MAGPIE_DEBUG') && MAGPIE_DEBUG) { trigger_error( $errormsg, $lvl); } diff --git a/e107_plugins/chatbox_menu/chatbox_menu.php b/e107_plugins/chatbox_menu/chatbox_menu.php index b2ffdb8fe..954c474f9 100755 --- a/e107_plugins/chatbox_menu/chatbox_menu.php +++ b/e107_plugins/chatbox_menu/chatbox_menu.php @@ -10,10 +10,10 @@ * */ -if (isset($_POST['chatbox_ajax'])) +if(isset($_POST['chatbox_ajax'])) { define('e_MINIMAL', true); - if (!defined('e107_INIT')) + if(!defined('e107_INIT')) { require_once('../../class2.php'); } @@ -24,7 +24,7 @@ global $e107cache, $e_event, $e107; $tp = e107::getParser(); $pref = e107::getPref(); -if (!e107::isInstalled('chatbox_menu')) +if(!e107::isInstalled('chatbox_menu')) { return ''; } @@ -35,10 +35,10 @@ e107::lan('chatbox_menu', e_LANGUAGE); $emessage = ''; -if ((isset($_POST['chat_submit']) || e_AJAX_REQUEST) && $_POST['cmessage'] !== '') +if((isset($_POST['chat_submit']) || e_AJAX_REQUEST) && $_POST['cmessage'] !== '') { - if (!USER && !$pref['anon_post']) + if(!USER && !$pref['anon_post']) { $cmessage = ''; // disallow post } @@ -52,14 +52,14 @@ if ((isset($_POST['chat_submit']) || e_AJAX_REQUEST) && $_POST['cmessage'] !== ' $fp = new floodprotect; - if ($fp->flood('chatbox', 'cb_datestamp')) + if($fp->flood('chatbox', 'cb_datestamp')) { - if (trim($cmessage) !== '' && (strlen(trim($cmessage)) < 1000)) + if(trim($cmessage) !== '' && (strlen(trim($cmessage)) < 1000)) { $cmessage = $tp->toDB($cmessage); - if ($sql->select('chatbox', '*', + if($sql->select('chatbox', '*', "cb_message='{$cmessage}' AND cb_datestamp+84600>" . time())) { @@ -72,7 +72,7 @@ if ((isset($_POST['chat_submit']) || e_AJAX_REQUEST) && $_POST['cmessage'] !== ' $datestamp = time(); $ip = e107::getIPHandler()->getIP(false); - if (USER) + if(USER) { $nick = USERID . '.' . USERNAME; @@ -81,7 +81,7 @@ if ((isset($_POST['chat_submit']) || e_AJAX_REQUEST) && $_POST['cmessage'] !== ' $sql->update('user', "user_chats = user_chats + 1, user_lastpost = {$postTime} WHERE user_id = " . USERID); } - elseif (!$nick) + elseif(!$nick) { $nick = '0.Anonymous'; @@ -90,7 +90,7 @@ if ((isset($_POST['chat_submit']) || e_AJAX_REQUEST) && $_POST['cmessage'] !== ' else { - if ($sql->select('user', '*', "user_name='$nick' ")) + if($sql->select('user', '*', "user_name='$nick' ")) { $emessage = CHATBOX_L1; @@ -104,12 +104,12 @@ if ((isset($_POST['chat_submit']) || e_AJAX_REQUEST) && $_POST['cmessage'] !== ' } } - if (!$emessage) + if(!$emessage) { $insertId = $sql->insert('chatbox', "0, '{$nick}', '{$cmessage}', '{$datestamp}', 0, '{$ip}' "); - if ($insertId) + if($insertId) { $edata_cb = [ @@ -142,16 +142,16 @@ if ((isset($_POST['chat_submit']) || e_AJAX_REQUEST) && $_POST['cmessage'] !== ' } -if (!USER && !$pref['anon_post']) +if(!USER && !$pref['anon_post']) { - if ($pref['user_reg']) + if($pref['user_reg']) { $text1 = str_replace(['[', ']'], ["", ''], CHATBOX_L3); - if ($pref['user_reg'] === 1) + if($pref['user_reg'] === 1) { $text1 .= str_replace(['[', ']'], ["", ''], CHATBOX_L3b); @@ -166,7 +166,7 @@ else { $cb_width = (defined('CBWIDTH') ? CBWIDTH : ''); - if ($pref['cb_layer'] === 2) + if(varset($pref['cb_layer']) === 2) { $texta = "\n