1
0
mirror of https://github.com/e107inc/e107.git synced 2025-03-11 07:59:44 +01:00

PHP8 class cleanup

This commit is contained in:
Cameron 2021-01-06 11:52:29 -08:00
parent 5404cf2dfc
commit ac9c19bae9
5 changed files with 40 additions and 9 deletions

View File

@ -140,6 +140,8 @@ class e_date
*/
function convert_date($datestamp, $mask = '')
{
$datestamp = (int) $datestamp;
if(empty($mask))
{
$mask = 'long';

View File

@ -4425,7 +4425,7 @@ class e_parser
$tp = e107::getParser();
$width = !empty($options['w']) ? intval($options['w']) : $tp->thumbWidth;
$height = ($tp->thumbHeight !== 0) ? $tp->thumbHeight : '';
$crop = !empty($options['crop']) ? $options['crop'] : $tp->thumbCrop;
$crop = isset($options['crop']) ? $options['crop'] : $tp->thumbCrop;
$linkStart = '';
$linkEnd = '';
$full = !empty($options['base64']) ? true : false;
@ -4691,6 +4691,7 @@ class e_parser
if(!isset($parm['w']) && !isset($parm['h']))
{
$parm = (array) $parm;
$parm['w'] = $tp->thumbWidth();
$parm['h'] = $tp->thumbHeight();
$parm['crop'] = $tp->thumbCrop();

View File

@ -235,7 +235,7 @@ class e_ranks
$lastRank = count($this->ranks['data']);
$rank = false;
if($level <= $this->ranks['data'][0]['thresh'])
if($level <= varset($this->ranks['data'][0]['thresh']))
{
$rank = 1;
}

View File

@ -1333,7 +1333,7 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; }
{
$kpost = '_sub';
}
else
elseif(isset($tmpl['start']))
{
$text = $tmpl['start'];
}
@ -1404,7 +1404,7 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; }
}
else
{
$temp = $tmpl['button'.$kpost];
$temp = isset($tmpl['button'.$kpost]) ? $tmpl['button'.$kpost] : '';
}
// e107::getDebug()->log($e107_vars[$act]['link']);
@ -1483,7 +1483,7 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; }
}
else
{
$START_SUB = $tmpl['start_sub'];
$START_SUB = isset($tmpl['start_sub']) ? $tmpl['start_sub'] : '';
}
if(!empty($e107_vars[$act]['sub']))
@ -1494,7 +1494,7 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; }
$replace['SUB_MENU'] = $tp->parseTemplate($START_SUB, false, $replace);
$replace['SUB_MENU'] .= $this->admin(false, $active_page, $e107_vars[$act]['sub'], $tmpl, true, (isset($e107_vars[$act]['sort']) ? $e107_vars[$act]['sort'] : $sortlist));
$replace['SUB_MENU'] .= $tmpl['end_sub'];
$replace['SUB_MENU'] .= isset($tmpl['end_sub']) ? $tmpl['end_sub'] : '';
}
@ -1504,7 +1504,7 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; }
//print_a($e107_vars[$act]);
}
$text .= (!$sub_link) ? $tmpl['end'] : '';
$text .= (!$sub_link && isset($tmpl['end'])) ? $tmpl['end'] : '';
if ($sub_link || empty($title))
{

View File

@ -465,7 +465,11 @@ class e107_user_extended
return $this->user_extended_get_categories($byID);
}
/**
* BC Alias of getCategories()
* @param bool $byID
* @return array
*/
function user_extended_get_categories($byID = TRUE)
{
$ret = array();
@ -1072,11 +1076,34 @@ class e107_user_extended
if(empty($choices))
{
e107::getDebug()->log("DB Field Choices is empty");
$error = true;
}
if(empty($choices[0]))
{
e107::getDebug()->log("DB Field Choices is missing a table");
$error = true;
}
if(empty($choices[1]))
{
e107::getDebug()->log("DB Field Choices is missing an index field");
$error = true;
}
if(empty($choices[2]))
{
e107::getDebug()->log("DB Field Choices is missing an value field");
$error = true;
}
if(!empty($error))
{
return "<span class='label label-danger'>Failed to load (misconfigured. See debug for more info.)</span>";
}
$sql = e107::getDb('ue');
$order = ($choices[3]) ? "ORDER BY " . $tp->toDB($choices[3], true) : "";
$order = !empty($choices[3]) ? "ORDER BY " . $tp->toDB($choices[3], true) : "";
if($sql->select($tp->toDB($choices[0], true), $tp->toDB($choices[1], true) . "," . $tp->toDB($choices[2], true), "1 $order"))
{
@ -1373,6 +1400,7 @@ class e107_user_extended
if(!$temp = $this->getFieldTypeClass($table))
{
"Couldn't find extended field class: ".$table;
return null;
}
return $temp->getValue($value);