1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

PHP8 Warning removal.

This commit is contained in:
Cameron
2021-01-01 10:45:26 -08:00
parent 81634d5f5a
commit 14862f0463
18 changed files with 114 additions and 86 deletions

View File

@@ -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

View File

@@ -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';

View File

@@ -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]) : '';
}
}

View File

@@ -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:

View File

@@ -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;

View File

@@ -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');
}

View File

@@ -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);
}

View File

@@ -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(['[', ']'], ["<a href='" . e_LOGIN . "'>", '</a>'],
CHATBOX_L3);
if ($pref['user_reg'] === 1)
if($pref['user_reg'] === 1)
{
$text1 .= str_replace(['[', ']'],
["<a href='" . e_SIGNUP . "'>", '</a>'], 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<form id='chatbox' action='" . e_SELF . '?' . e_QUERY . "' method='post' onsubmit='return(false);'>
@@ -185,13 +185,13 @@ else
$texta .= "<div class='control-group form-group' id='chatbox-input-block'>";
if (($pref['anon_post'] == '1' && USER === false))
if(($pref['anon_post'] == '1' && USER === false))
{
$texta .= "\n<input class='tbox chatbox' type='text' id='nick' name='nick' value='' maxlength='50' " . ($cb_width
? "style='width: " . $cb_width . ";'" : '') . ' /><br />';
}
if ($pref['cb_layer'] === 2)
if($pref['cb_layer'] === 2)
{
$oc =
@@ -215,7 +215,7 @@ else
// $texta .= "<input type='reset' name='reset' value='".CHATBOX_L5."' />"; // How often do we see these lately? ;-)
if ($pref['cb_emote'] && $pref['smiley_activate'])
if(!empty($pref['cb_emote']) && !empty($pref['smiley_activate']))
{
$texta .= "
<input class='btn btn-default btn-secondary button' type='button' style='cursor:pointer' size='30' value='" . CHATBOX_L14 . "' onclick=\"expandit('emote')\" />
@@ -226,28 +226,27 @@ else
}
if ($emessage !== '')
if($emessage !== '')
{
$texta .= "<div style='text-align:center'><b>" . $emessage . '</b></div>';
}
if (!$text = $e107cache->retrieve('nq_chatbox'))
if(!$text = $e107cache->retrieve('nq_chatbox'))
{
global $pref, $tp;
$pref['chatbox_posts'] =
($pref['chatbox_posts'] ? $pref['chatbox_posts'] : 10);
$pref['chatbox_posts'] = (!empty($pref['chatbox_posts']) ? (int) $pref['chatbox_posts'] : 10);
$chatbox_posts = $pref['chatbox_posts'];
if (!isset($pref['cb_mod']))
if(!isset($pref['cb_mod']))
{
$pref['cb_mod'] = e_UC_ADMIN;
}
if (!defined('CB_MOD'))
if(!defined('CB_MOD'))
{
define('CB_MOD', check_class($pref['cb_mod']));
}
@@ -258,7 +257,7 @@ if (!$text = $e107cache->retrieve('nq_chatbox'))
global $CHATBOXSTYLE;
if ($CHATBOXSTYLE) // legacy chatbox style
if($CHATBOXSTYLE) // legacy chatbox style
{
$legacyIconSrc = e_IMAGE_ABS . 'admin_images/chatbox_16.png';
$currentIconSrc = e_PLUGIN . 'chatbox_menu/images/chatbox_16.png';
@@ -284,7 +283,7 @@ if (!$text = $e107cache->retrieve('nq_chatbox'))
$sc = e107::getScBatch('chatbox_menu', true);
if ($sql->gen($qry))
if($sql->gen($qry))
{
$cbpost = $sql->rows();
@@ -293,7 +292,7 @@ if (!$text = $e107cache->retrieve('nq_chatbox'))
$text .= $tp->parseTemplate($CHATBOX_TEMPLATE['start'], false, $sc);
foreach ($cbpost as $cb)
foreach($cbpost as $cb)
{
$sc->setVars($cb);
$text .= $tp->parseTemplate($CHATBOX_TEMPLATE['item'], false, $sc);
@@ -311,7 +310,7 @@ if (!$text = $e107cache->retrieve('nq_chatbox'))
$total_chats = $sql->count('chatbox');
if ($total_chats > $chatbox_posts || CB_MOD)
if($total_chats > $chatbox_posts || CB_MOD)
{
$text .= "<br /><div style='text-align:center'><a href='" . e_PLUGIN_ABS . "chatbox_menu/chat.php'>" . (CB_MOD
? CHATBOX_L13
@@ -327,7 +326,7 @@ $caption = (file_exists(THEME . 'images/chatbox_menu.png')
: LAN_PLUGIN_CHATBOX_MENU_NAME);
if ($pref['cb_layer'] === 1)
if(varset($pref['cb_layer']) === 1)
{
$text =
@@ -336,7 +335,7 @@ if ($pref['cb_layer'] === 1)
$ns->tablerender($caption, $text, 'chatbox');
}
elseif ($pref['cb_layer'] === 2 && e_AJAX_REQUEST)
elseif(varset($pref['cb_layer']) === 2 && e_AJAX_REQUEST)
{
$text = $texta . $text;
@@ -349,7 +348,7 @@ else
$text = $texta . $text;
if ($pref['cb_layer'] === 2)
if($pref['cb_layer'] === 2)
{
$text = "<div id='chatbox_posts'>" . $text . '</div>';
}

View File

@@ -76,7 +76,7 @@ class chatbox_menu_shortcodes extends e_shortcode
public function sc_cb_avatar($parm = null)
{
$tp = e107::getParser();
$size = $parm['size'] ?: 40;
$size = !empty($parm['size']) ? $parm['size'] : 40;
$options = array('h' => $size, 'w' => $size, 'crop' => 'C');
if ( ! isset($this->var['user_image']) ) {
@@ -154,7 +154,7 @@ class chatbox_menu_shortcodes extends e_shortcode
}
$pref = e107::getPref();
$emotes_active = $pref['cb_emote'] ? 'USER_BODY, emotes_on'
$emotes_active = !empty($pref['cb_emote']) ? 'USER_BODY, emotes_on'
: 'USER_BODY, emotes_off';
$cb_message = e107::getParser()

View File

@@ -402,7 +402,7 @@ class faqs_shortcodes extends e_shortcode
$text = $frm->open('faq-search-form','get', $target);
$text .= '<span class="input-group e-search">';
$text .= $frm->text('srch', $_GET['srch'], 20,'class=search-query&placeholder='.LAN_SEARCH).'
$text .= $frm->text('srch', varset($_GET['srch']), 20,'class=search-query&placeholder='.LAN_SEARCH).'
<span class="input-group-btn"><button class="btn btn-primary" type="submit">'.$tp->toGlyph('fa-search').'</button>';
$text .= '</span></span>';
$text .= $frm->close();

View File

@@ -319,17 +319,18 @@ class gallery_shortcodes extends e_shortcode
$tp = e107::getParser();
$this->slideMode = true;
$parms = eHelper::scDualParams($parm);
$amount = $parms[1] ? intval($parms[1]) : 3; // vartrue(e107::getPlugPref('gallery','slideshow_perslide'),3);
$parms = $parms[2];
$limit = (integer) vartrue($parms['limit'], 16);
$list = e107::getMedia()->getImages('gallery_image|gallery_' . $this->sliderCat . '|gallery_image_' . $this->sliderCat, 0, $limit, null, $orderBy);
$tmpl = e107::getTemplate('gallery', 'gallery');
$tmpl = array_change_key_case($tmpl); // change template key to lowercase (BC fix)
$tmpl_key = vartrue($parms['template'], 'slideshow_slide_item');
$parms = eHelper::scDualParams($parm);
$amount = $parms[1] ? intval($parms[1]) : 3; // vartrue(e107::getPlugPref('gallery','slideshow_perslide'),3);
$parms = $parms[2];
$limit = (integer) vartrue($parms['limit'], 16);
$list = e107::getMedia()->getImages('gallery_image|gallery_' . $this->sliderCat . '|gallery_image_' . $this->sliderCat, 0, $limit, null, $orderBy);
$tmpl = e107::getTemplate('gallery', 'gallery');
$tmpl = array_change_key_case($tmpl); // change template key to lowercase (BC fix)
$tmpl_key = vartrue($parms['template'], 'slideshow_slide_item');
$item_template = $tmpl[$tmpl_key]; // e107::getTemplate('gallery','gallery', vartrue($parms['template'], 'SLIDESHOW_SLIDE_ITEM'));
$catList = e107::getMedia()->getCategories('gallery');
$cat = $catList['gallery_' . $this->sliderCat];
$catList = e107::getMedia()->getCategories('gallery');
$cat = varset($catList['gallery_' . $this->sliderCat]);
$count = 1;
$inner = '';

View File

@@ -184,29 +184,29 @@ li .hero-list-text {
#carousel-hero h2 { font-size: 1.2em}
/* CAROUSEL FADE */
.carousel-fade .carousel-inner .item {
#carousel-hero.carousel-fade .carousel-inner .item {
-webkit-transition-property: opacity;
transition-property: opacity; }
.carousel-fade .carousel-inner .item,
.carousel-fade .carousel-inner .active.left,
.carousel-fade .carousel-inner .active.right {
#carousel-hero.carousel-fade .carousel-inner .item,
#carousel-hero.carousel-fade .carousel-inner .active.left,
#carousel-hero.carousel-fade .carousel-inner .active.right {
opacity: 0; }
.carousel-fade .carousel-inner .active,
.carousel-fade .carousel-inner .next.left,
.carousel-fade .carousel-inner .prev.right {
#carousel-hero.carousel-fade .carousel-inner .active,
#carousel-hero.carousel-fade .carousel-inner .next.left,
#carousel-hero.carousel-fade .carousel-inner .prev.right {
opacity: 1; }
.carousel-fade .carousel-inner .next,
.carousel-fade .carousel-inner .prev,
.carousel-fade .carousel-inner .active.left,
.carousel-fade .carousel-inner .active.right {
#carousel-hero.carousel-fade .carousel-inner .next,
#carousel-hero.carousel-fade .carousel-inner .prev,
#carousel-hero.carousel-fade .carousel-inner .active.left,
#carousel-hero.carousel-fade .carousel-inner .active.right {
left: 0;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0); }
.carousel-fade .carousel-control {
#carousel-hero.carousel-fade .carousel-control {
z-index: 2; }
/* ANIMATION */

View File

@@ -13,5 +13,13 @@
if (!defined('e107_INIT')) { exit; }
$text = e107::getParser()->parseTemplate("{HERO}", true);
e107::getRender()->tablerender(null, $text, 'hero-menu');
if(deftrue('e_FRONTPAGE'))
{
$text = e107::getParser()->parseTemplate("{HERO}", true);
e107::getRender()->tablerender(null, $text, 'hero-menu');
}
elseif(ADMIN)
{
$text = "<div class='alert alert-danger'>Hero only runs on the frontpage of your site.</div>";
e107::getRender()->tablerender(null, $text,'hero-menu');
}

View File

@@ -25,7 +25,7 @@ $HERO_TEMPLATE['default']['footer'] = '</div><div class="carousel-controls">
<!-- Indicators -->
{HERO_CAROUSEL_INDICATORS: target=carousel-hero&class=animated fadeInUpBig}
</ol>-->
</ol>
</div>
</div>';

View File

@@ -65,6 +65,11 @@ class list_shortcodes
function sc_list_heading()
{
if(empty($this->row['heading']))
{
return null;
}
return e107::getParser()->toHTML($this->row['heading'], true, "TITLE");
}
@@ -75,6 +80,11 @@ class list_shortcodes
function sc_list_category()
{
if(empty($this->row['category']))
{
return null;
}
return e107::getParser()->toHTML($this->row['category'], true, "");
}

View File

@@ -30,6 +30,7 @@ foreach($tmp as $id => $val)
}
$template = e107::getTemplate('news', 'news_menu', 'archive',true, true);
$text = '';
if(ADMIN && empty($template))
{

View File

@@ -136,7 +136,7 @@ class newsfeedClass
$cachedData = e107::getCache()->retrieve(NEWSFEED_NEWS_CACHE_TAG.$feedID,$maxAge, true);
if(empty($this->newsList[$feedID]['newsfeed_timestamp']) || empty($cachedData) || strpos($this->newsList[$feedID]['newsfeed_data'],'MagpieRSS')) //BC Fix to update newsfeed_data from v1 to v2 spec.
if(empty($this->newsList[$feedID]['newsfeed_timestamp']) || empty($cachedData) || (!empty($this->newsList[$feedID]['newsfeed_data']) && strpos($this->newsList[$feedID]['newsfeed_data'],'MagpieRSS'))) //BC Fix to update newsfeed_data from v1 to v2 spec.
{
$force = true;
// e107::getDebug()->log("NewsFeed Force");

View File

@@ -39,7 +39,7 @@ if(deftrue('SOCIAL_FACEBOOK_INIT') )
elseif(deftrue('XURL_FACEBOOK'))
{
$width = vartrue($pref['facebook_like_menu_width'], 350);
$text .= '<iframe src="//www.facebook.com/plugins/likebox.php?href='.urlencode(XURL_FACEBOOK).'&amp;width='.$width.'&amp;height=200&amp;colorscheme=light&amp;show_faces=true&amp;header=false&amp;stream=false&amp;show_border=false" scrolling="no" style="border:none; overflow:hidden; width:350px;height:200px;max-width:100%;" allowtransparency="true" frameborder="0"></iframe>';
$text = '<iframe src="//www.facebook.com/plugins/likebox.php?href='.urlencode(XURL_FACEBOOK).'&amp;width='.$width.'&amp;height=200&amp;colorscheme=light&amp;show_faces=true&amp;header=false&amp;stream=false&amp;show_border=false" scrolling="no" style="border:none; overflow:hidden; width:350px;height:200px;max-width:100%;" allowtransparency="true" frameborder="0"></iframe>';
e107::getRender()->tablerender($caption,$text,'facebook-like-menu');
}
elseif(ADMIN)