1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-12 09:34:54 +02:00

More PHP 8.1 fixes.

This commit is contained in:
Cameron
2021-11-26 12:36:25 -08:00
parent 5810f8148d
commit 2c9afc83ee
16 changed files with 48 additions and 49 deletions

View File

@@ -86,7 +86,7 @@ if (ADMIN)
$asuser = e107::getSystemUser(e107::getUser()->getSessionDataAs(), false);
$lanVars = array ('x' => ($asuser->getId() ? $asuser->getName().' ('.$asuser->getValue('email').')' : 'unknown')) ;
e107::getMessage()->addInfo($tp->lanVars(ADLAN_164, $lanVars).' <a href="'.e_ADMIN_ABS.'users.php?mode=main&amp;action=logoutas">['.LAN_LOGOUT.']</a>');
e107::getMessage()->addInfo(e107::getParser()->lanVars(ADLAN_164, $lanVars).' <a href="'.e_ADMIN_ABS.'users.php?mode=main&amp;action=logoutas">['.LAN_LOGOUT.']</a>');
}
// NEW, legacy 3rd party code fix, header called inside the footer o.O
@@ -133,7 +133,7 @@ else
else
{
e107::coreLan('log_messages', true);
e107::getLog()->addEvent(4, __FILE__."|".__FUNCTION__."@".__LINE__, "LOGIN", LAN_ROLL_LOG_11, "U: ".$tp->toDB($_POST['authname']), FALSE, LOG_TO_ROLLING);
e107::getLog()->addEvent(4, __FILE__."|".__FUNCTION__."@".__LINE__, "LOGIN", LAN_ROLL_LOG_11, "U: ".e107::getParser()->toDB($_POST['authname']), FALSE, LOG_TO_ROLLING);
e107::getRedirect()->redirect('admin.php?failed');
}

View File

@@ -107,6 +107,7 @@ if(e_AJAX_REQUEST && ADMIN && varset($_GET['mode']) == 'core' && ($_GET['type']
$text = '<div style="margin-left:10px;margin-top:10px">';
$count = 1;
$tp = e107::getParser();
foreach($rows['channel']['item'] as $row)
{
if($count > $limit){ break; }

View File

@@ -929,6 +929,8 @@ class system_tools
$mes = e107::getMessage();
$sql = e107::getDb('utf8-convert');
$qry = [];
if($sql->gen($query))
{

View File

@@ -39,13 +39,13 @@ if(varset($_GET['mode']) == "ajax")
{
$tmp = explode(".", e_QUERY);
$action = $tp->filter($tmp[0]);
$sub_action = varset($tmp[1], '');
$sub_action = varset($tmp[1]);
$sub_action = $tp->filter($sub_action);
$id = varset($tmp[2], 0);
unset($tmp);
}
if($sql->select('user_extended_struct', '*', "user_extended_struct_id = '{$sub_action}'"))
if($sql->select('user_extended_struct', '*', "user_extended_struct_id = '$sub_action'"))
{
$current = $sql->fetch();
}
@@ -68,7 +68,7 @@ if(varset($_GET['mode']) == "ajax")
foreach($result as $row2)
{
$fld = $row2;
$selected = (varset($_POST['table_db'], '') == $fld || $curVals[0] == $fld) ? " selected='selected'" : "";
$selected = (varset($_POST['table_db']) == $fld || $curVals[0] == $fld) ? " selected='selected'" : "";
$text .= "<option value=\"" . $fld . "\" $selected>" . $fld . "</option>\n";
}
$text .= "</select></td></tr>";
@@ -79,8 +79,8 @@ if(varset($_GET['mode']) == "ajax")
$text .= "<tr><td>" . EXTLAN_63 . "</td><td>";
$text .= "<select style='width:99%' class='tbox e-select' name='field_id'>";
$text .= "<option value='' class='caption'>" . LAN_NONE . "</option>";
$table_list = ($_POST['table_db']) ? $_POST['table_db'] : $curVals[0];
if($sql->gen("DESCRIBE " . MPREFIX . "{$table_list}"))
$table_list = !empty($_POST['table_db']) ? $_POST['table_db'] : $curVals[0];
if($sql->gen("DESCRIBE " . MPREFIX . $table_list))
{
while($row3 = $sql->fetch())
{
@@ -95,7 +95,7 @@ if(varset($_GET['mode']) == "ajax")
$text .= EXTLAN_64 . "</td><td>";
$text .= "<select style='width:99%' class='tbox e-select' name='field_value'>";
$text .= "<option value='' class='caption'>" . LAN_NONE . "</option>";
$table_list = ($_POST['table_db']) ? $_POST['table_db'] : $curVals[0];
$table_list = !empty($_POST['table_db']) ? $_POST['table_db'] : $curVals[0];
if($sql->gen("DESCRIBE " . MPREFIX . "{$table_list}"))
{
while($row3 = $sql->fetch())
@@ -111,7 +111,7 @@ if(varset($_GET['mode']) == "ajax")
$text .= LAN_ORDER . "</td><td>";
$text .= "<select style='width:99%' class='tbox e-select' name='field_order'>";
$text .= "<option value='' class='caption'>" . LAN_NONE . "</option>";
$table_list = ($_POST['table_db']) ? $_POST['table_db'] : $curVals[0];
$table_list = !empty($_POST['table_db']) ? $_POST['table_db'] : $curVals[0];
if($sql->gen("DESCRIBE " . MPREFIX . "{$table_list}"))
{
while($row3 = $sql->fetch())
@@ -930,7 +930,7 @@ e107::js('footer-inline', js());
$field['type'] = 'text';
$field['writeParms'] = $att;
$field['pattern'] = '[0-9a-z_]*';
return $this->renderElement('user_extended_struct_name', $curVal, $field);
break;
@@ -1037,7 +1037,7 @@ e107::js('footer-inline', js());
foreach($result as $row2)
{
$fld = $row2;
$selected = (varset($_POST['table_db'],'') == $fld || $curVals[0] == $fld) ? " selected='selected'" : "";
$selected = (varset($_POST['table_db']) == $fld || $curVals[0] == $fld) ? " selected='selected'" : "";
// if (MPREFIX!='' && strpos($row2[0], MPREFIX)!==FALSE)
{
$text .= "<option value=\"".$fld."\" $selected>".$fld."</option>\n";
@@ -1050,7 +1050,7 @@ e107::js('footer-inline', js());
// Field ID
$text .= "<tr><td>".EXTLAN_63."</td><td><select style='width:99%' class='tbox e-select' name='field_id' >\n
<option value='' class='caption'>".LAN_NONE."</option>\n";
$table_list = ($_POST['table_db']) ? $_POST['table_db'] : $curVals[0] ;
$table_list = !empty($_POST['table_db']) ? $_POST['table_db'] : $curVals[0] ;
if($sql->gen("DESCRIBE ".MPREFIX."{$table_list}"))
{
@@ -1065,7 +1065,7 @@ e107::js('footer-inline', js());
// Field Value
$text .= EXTLAN_64."</td><td><select style='width:99%' class='tbox e-select' name='field_value' >
<option value='' class='caption'>".LAN_NONE."</option>\n";
$table_list = ($_POST['table_db']) ? $_POST['table_db'] : $curVals[0] ;
$table_list = !empty($_POST['table_db']) ? $_POST['table_db'] : $curVals[0] ;
if($sql->gen("DESCRIBE ".MPREFIX."{$table_list}"))
{
@@ -1080,7 +1080,7 @@ e107::js('footer-inline', js());
$text .= LAN_ORDER."</td><td><select style='width:99%' class='tbox e-select' name='field_order' >
<option value='' class='caption'>".LAN_NONE."</option>\n";
$table_list = ($_POST['table_db']) ? $_POST['table_db'] : $curVals[0] ;
$table_list = !empty($_POST['table_db']) ? $_POST['table_db'] : $curVals[0] ;
if($sql ->gen("DESCRIBE ".MPREFIX."{$table_list}"))
{

View File

@@ -111,7 +111,7 @@ class bbcode_shortcodes extends e_shortcode
// $data = "[list]\n[*]Item 1\n[*]Item 2\n[/list]"; // works with jquery, but not onclick.
// $event = $this->getEvent($this->var['trigger'],$data,LANHELP_36);
$event = $this->getEvent('addtext',$data,LANHELP_36);
$text = "<a {$event} class='btn btn-default' id='{$id}' data-function='insert' href='#{$this->var['tagid']}' data-bbcode='{$data}' title='".$this->br2nl(LANHELP_36)."'>";
$text = "<a {$event} class='btn btn-default btn-secondary' id='{$id}' data-function='insert' href='#{$this->var['tagid']}' data-bbcode='{$data}' title='".$this->br2nl(LANHELP_36)."'>";
$text .= $this->button(e_IMAGE_ABS."bbcode/list.png", 'list'); // , LANHELP_36
@@ -207,7 +207,7 @@ class bbcode_shortcodes extends e_shortcode
{
$data = "[link=*]*[/link]";
$event = $this->getEvent('addinput',$data,LANHELP_35);
$text = "<a {$event} class='btn btn-default btn-secondary e-bb ' id='{$id}' data-function='input' href='#{$this->var['tagid']}' title='".$this->br2nl(LANHELP_23)."' data-bbcode='{$data}'>\n";
$text = "<a {$event} class='btn btn-default btn-secondary e-bb ' id='{$id}' data-function='input' href='#{$this->var['tagid']}' title='".$this->br2nl(LANHELP_23)."' data-bbcode='{$data}'>";
// $text .="<img class='btn btn-small bbcode_buttons e-pointer' src='".e_IMAGE_ABS."bbcode/link.png' alt='' title='".nl2br(LANHELP_23)."' />";
$text .= $this->button(e_IMAGE_ABS.'bbcode/link.png', 'link');
@@ -282,7 +282,7 @@ class bbcode_shortcodes extends e_shortcode
$text .= $this->button(e_IMAGE_ABS."bbcode/prefile.png", 'file');
// $text .= "<img class='btn btn-small bbcode bbcode_buttons e-pointer' src='".e_IMAGE_ABS."bbcode/prefile.png' title='".LANHELP_39."' alt='' />";
$text .= "</a>\n";
$text .= "</a>";
return $text;
}
@@ -337,7 +337,7 @@ class bbcode_shortcodes extends e_shortcode
$text .= "<option value='[size=".$s."][/size]'>".$s."px</option>\n";
}
$text .="</select></td></tr></table></div>
</div>\n<!-- End of Size selector -->";
</div><!-- End of Size selector -->";
return $text;
}
@@ -379,7 +379,7 @@ class bbcode_shortcodes extends e_shortcode
".$this->renderEmotes()."
</td></tr></table>
</div>
</div>\n<!-- End of Emoticon selector -->\n";
</div><!-- End of Emoticon selector -->";
return $text;
}
@@ -400,7 +400,7 @@ class bbcode_shortcodes extends e_shortcode
$value2 = substr($value, 0, strpos($value, " "));
$value = ($value2 ? $value2 : $value);
$value = ($value == '&|') ? ':((' : $value;
$text .= "\n<a style='display:inline-block; margin:2px; padding:2px' href=\"javascript:addtext('$value ',true)\"><img src='$key' alt='' /></a>";
$text .= "<a style='display:inline-block; margin:2px; padding:2px' href=\"javascript:addtext('$value ',true)\"><img src='$key' alt='' /></a>";
}
@@ -529,7 +529,7 @@ class bbcode_shortcodes extends e_shortcode
// e107::getMessage()->debug("Loaded BB: ".$parm);
$unique = $this->var['template']."--".$parm; // works in conjunction with media-manager category
return "\n\n<!-- {$parm} -->\n".$this->$meth($unique);
return "<!-- {$parm} -->".$this->$meth($unique);
}
//XXX NOTE: everything below here could be replaced with separate 'bb_xxxx' methods if need be. (see above)
@@ -626,8 +626,8 @@ class bbcode_shortcodes extends e_shortcode
if(empty($iconpath[$parm])) return '';
$pre = "\n";
$post = "\n";
$pre = "";
$post = "";
$_onclick_func = (isset($bbcode[$parm][0])) ? $bbcode[$parm][0] : $bbcode_func;
$_onclick_var = (isset($bbcode[$parm][1])) ? $bbcode[$parm][1] : '';
@@ -638,13 +638,13 @@ class bbcode_shortcodes extends e_shortcode
if($_onclick_func == 'e-dialog')
{ // $tagid = "news-body";
// $pre = "\n<a href='".e_ADMIN."image.php?mode=main&action=dialog&for=news&tagid=".$tagid."&iframe=1&bbcode=1' class='btn btn-default btn-secondary e-dialog' >";
$pre = "\n<a href='".e_ADMIN_ABS."image.php?mode=main&action=dialog&for=news&tagid=".$tagid."&iframe=1&bbcode=1' class='btn btn-default btn-secondary e-dialog' >";
$post = "</a>\n";
$pre = "<a href='".e_ADMIN_ABS."image.php?mode=main&action=dialog&for=news&tagid=".$tagid."&iframe=1&bbcode=1' class='btn btn-default btn-secondary e-dialog' >";
$post = "</a>";
}
else
{
$pre = "<a class='btn btn-default btn-secondary ".vartrue($bbcode[$parm][7], 'e-pointer')."' title=\"".str_replace('<br />','\\n',($_helptxt))."\" onclick=\"{$_onclick_func}('".$_onclick_var."')\" ".($bbcode_helpactive ? "onmouseout=\"{$bbcode_help}(''{$bbcode_tag})\" onmouseover=\"{$bbcode_help}('".$_helptxt."'{$bbcode_tag})\"" : "" )." >";
$post = "</a>\n"; // btn-small bbcode bbcode_buttons
$post = "</a>"; // btn-small bbcode bbcode_buttons
}
if($bbcode[$parm]) // default - insert text.

View File

@@ -55,7 +55,7 @@ function imageselector_shortcode($parm = '', $mod = '')
$imagelist[$row['media_category']][] = array('path' => $row['media_url'], 'fname' => $row['media_name']. " (".$row['media_dimensions'].") ");
}
asort($opts);
asort($imagelist);
}
}
else

View File

@@ -19,8 +19,7 @@
// This is used on the front-end. ie. comments etc.
$BBCODE_TEMPLATE = "
{BB=link}{BB=b}{BB=i}{BB=u}{BB=img}{BB=left}{BB=center}{BB=right}{BB=justify}
{BB=bq}{BB=list}{BB=emotes}
{BB=link}{BB=b}{BB=i}{BB=u}{BB=img}{BB=left}{BB=center}{BB=right}{BB=justify}{BB=bq}{BB=list}{BB=emotes}
<div class='field-spacer'><!-- --></div>
";
@@ -29,8 +28,7 @@ $BBCODE_TEMPLATE_COMMENT = ""; // no buttons on comments by default.
// $BBCODE_TEMPLATE .= "{BB=blank}";
$BBCODE_TEMPLATE_SIGNATURE = "
{BB=link}{BB=b}{BB=i}{BB=u}{BB=img}{BB=left}{BB=center}{BB=right}{BB=justify}
{BB=list}
{BB=link}{BB=b}{BB=i}{BB=u}{BB=img}{BB=left}{BB=center}{BB=right}{BB=justify}{BB=list}
<div class='field-spacer'><!-- --></div>
";
@@ -73,8 +71,7 @@ $BBCODE_TEMPLATE_MAILOUT = "
$BBCODE_TEMPLATE_NEWSPOST = "
<div class='btn-toolbar'>
{BB=link}{BB=b}{BB=i}{BB=u}{BB=img}{BB=format}{BB=left}{BB=center}{BB=right}{BB=justify}
{BB=list}{BB=table}{BB=fontcol}{BB=fontsize}{BB=emotes}{BB=flash}
{BB=link}{BB=b}{BB=i}{BB=u}{BB=img}{BB=format}{BB=left}{BB=center}{BB=right}{BB=justify}{BB=list}{BB=table}{BB=fontcol}{BB=fontsize}{BB=emotes}{BB=flash}
{BB_PREIMAGEDIR=news}
<div class='btn-group'>{BB=preimage}{BB=prefile}{BB=youtube}</div>
</div>

View File

@@ -590,8 +590,8 @@ class e_form
$active = ($key ==$initTab) ? ' class="nav-item active"' : ' class="nav-item"';
$text .= '<li'.$active.'><a class="nav-link" href="#'.$key.'" data-toggle="tab" data-bs-toggle="tab">'.$tab['caption'].'</a></li>';
$active = ($key ==$initTab) ? 'active"' : '';
$text .= '<li class="nav-item '.$active.'"><a class="nav-link '.$active.'" href="#'.$key.'" data-toggle="tab" data-bs-toggle="tab">'.$tab['caption'].'</a></li>';
$c++;
}

View File

@@ -378,9 +378,9 @@ class core_library
'variants' => array(),
// Override library path to CDN.
//https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css
'library_path' => 'https://cdn.jsdelivr.net/npm/bootstrap@5.1.1',
'library_path' => 'https://cdn.jsdelivr.net/npm/bootstrap@5.1.3',
'path' => '',
'version' => '5.1.1',
'version' => '5.1.3',
);
@@ -410,7 +410,7 @@ class core_library
'variants' => array(),
'library_path' => '{e_WEB}lib/bootstrap',
'path' => '5',
'version' => '5.1.1',
'version' => '5.1.3',
);

View File

@@ -432,7 +432,7 @@ function handle_upload_messages(&$upload_array, $errors_only = TRUE, $use_handle
{
// Display error messages, accumulate FMESSAGE
// Write as a separate routine - returns all messages displayed. Option to only display failures.
$f_message = '';
$f_message = [];
foreach ($upload_array as $k=>$r)
{
if (!$errors_only || $r['error'])

View File

@@ -29,7 +29,7 @@ class adminDownload extends download
function __construct()
{
global $pref;
parent::download();
parent::__construct();
$this->userclassOptions = 'blank,nobody,guest,public,main,admin,member,classes';
// Save basic search string

View File

@@ -62,7 +62,7 @@ class plugin_featurebox_item extends e_model
$ret = $tp->toHTML($this->get('fb_title'), false, 'TITLE');
if(isset($parm['url']) && $this->get('fb_imageurl'))
{
return '<a id="featurebox-titleurl-'.$this->getId().'" href="'.$tp->replaceConstants($this->get('fb_imageurl'), 'full').'" title="'.$tp->toAttribute($this->get('fb_title')).'" rel="'.$tp->toAttribute(vartrue($parm['rel'], '')).'">'.$ret.'</a>';
return '<a id="featurebox-titleurl-'.$this->getId().'" href="'.$tp->replaceConstants($this->get('fb_imageurl'), 'full').'" title="'.$tp->toAttribute($this->get('fb_title')).'" rel="'.$tp->toAttribute(vartrue($parm['rel'])).'">'.$ret.'</a>';
}
return $ret;
@@ -98,7 +98,7 @@ class plugin_featurebox_item extends e_model
return '<a '.$buttonCls.'id="featurebox-url-'.$this->getId().'" href="'.$url.'" title="'.$alt.'" rel="'.$tp->toAttribute(vartrue($parm['rel'], '')).'">'.$title.'</a>';
return '<a '.$buttonCls.'id="featurebox-url-'.$this->getId().'" href="'.$url.'" title="'.$alt.'" rel="'.$tp->toAttribute(vartrue($parm['rel'])).'">'.$title.'</a>';
}
@@ -147,7 +147,7 @@ class plugin_featurebox_item extends e_model
$imageSrc = ($parm != 'placeholder') ? $this->get('fb_image') : "";
if($tp->thumbWidth > 100 || $tp->thumbHeight > 100) //Guessing it's a featurebox image. Use {SETIMAGE} inside theme.php to configure.
if($tp->thumbWidth() > 100 || $tp->thumbHeight() > 100) //Guessing it's a featurebox image. Use {SETIMAGE} inside theme.php to configure.
{
$src = $tp->thumbUrl($imageSrc); //XXX TODO TBD Add a pref to use without resizing? Or, detect {SETIMAGE} in template to enable?
}

View File

@@ -13,7 +13,6 @@
$BBCODE_TEMPLATE['forum'] = "
<div class='field-spacer'><!-- --></div>
{BB=link}{BB=b}{BB=i}{BB=u}{BB=img}{BB=format}{BB=left}{BB=center}{BB=right}{BB=justify}
{BB=list}{BB=fontcol}{BB=fontsize}{BB=emotes}{BB=youtube}
{BB=link}{BB=b}{BB=i}{BB=u}{BB=img}{BB=format}{BB=left}{BB=center}{BB=right}{BB=justify}{BB=list}{BB=fontcol}{BB=fontsize}{BB=emotes}{BB=youtube}
<div class='field-spacer'><!-- --></div>
";

View File

@@ -14,11 +14,11 @@ $HERO_TEMPLATE['default']['header'] = '<!-- Hero Menu: header -->{SETIMAGE: w=4
$HERO_TEMPLATE['default']['footer'] = '</div><div class="carousel-controls">
<!-- Controls -->
<a title="{LAN=PREVIOUS}" class="left carousel-left carousel-control animated zoomIn animation-delay-30" href="#carousel-hero" role="button" data-slide="prev" data-bs-slide="prev">
<a title="{LAN=PREVIOUS}" class="left carousel-left carousel-control carousel-control-prev animated zoomIn animation-delay-30" href="#carousel-hero" role="button" data-slide="prev" data-bs-slide="prev">
<i class="fa fa-chevron-left fa-fw"></i>
<span class="sr-only">{LAN=PREVIOUS}</span>
</a>
<a title="{LAN=NEXT}" class="right carousel-right carousel-control animated zoomIn animation-delay-30" href="#carousel-hero" role="button" data-slide="next" data-bs-slide="next">
<a title="{LAN=NEXT}" class="right carousel-right carousel-control carousel-control-next animated zoomIn animation-delay-30" href="#carousel-hero" role="button" data-slide="next" data-bs-slide="next">
<i class="fa fa-chevron-right fa-fw"></i>
<span class="sr-only">{LAN=NEXT}</span>
</a>

View File

@@ -644,7 +644,7 @@ class newsletter
if($nl_row = $nl_sql->fetch())
{
$subscribers_list = explode(chr(1), trim($nl_row['newsletter_subscribers']));
sort($subscriber_list);
sort($subscribers_list);
$subscribers_total_count = count($subscribers_list) - 1; // Get a null entry as well
}
if ($subscribers_total_count<1)

View File

@@ -266,7 +266,7 @@ class rss_ui extends e_admin_ui
if(!$render)
{
$this->show_message(RSS_LAN_ADMIN_11, RSS_LAN_ERROR_6);
e107::getMessage()->addWarning(RSS_LAN_ERROR_6);
}
else
{