1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-20 12:41:51 +02:00

PHP warning fixes.

This commit is contained in:
Cameron 2020-12-29 09:48:36 -08:00
parent 75f595adb0
commit 21e3c3f8ab
16 changed files with 93 additions and 91 deletions

View File

@ -896,7 +896,7 @@ class banlist_form_ui extends e_admin_form_ui
// optional
public function init()
{
if($_POST['etrigger_batch'] == 'gen_intdata__1' && count($_POST['e-multiselect'])) // Do we need BAN here?
if(varset($_POST['etrigger_batch']) == 'gen_intdata__1' && count($_POST['e-multiselect'])) // Do we need BAN here?
{
$dels = implode(',',$_POST['e-multiselect']);
//$e107::getDb()->insert('banlist',

View File

@ -106,7 +106,7 @@ e107::coreLan('userclass2', true);
public function init()
{
if(E107_DBG_BASIC && intval($_GET['id']) === 254) // Experimental
if(E107_DBG_BASIC && isset($_GET['id']) && intval($_GET['id']) === 254) // Experimental
{
e107::getMessage()->addDebug("Experimental Feature active");
$this->tabs = array(LAN_GENERAL,"Administrator Permissions");

View File

@ -770,7 +770,7 @@ e107::js('footer-inline', js());
<tr>
<td>{$var['user_extended_struct_name']}</td>
<td>".constant(strtoupper($var['user_extended_struct_text'])."_DESC")."</td>
<td>".$ue->user_extended_edit($var,$uVal)."</td>
<td>".$ue->user_extended_edit($var,'')."</td>
<td>".$tp->toHTML($var['type'], false, 'defs')."</td>
<td class='center'>".($active ? ADMIN_TRUE_ICON : "&nbsp;")."</td>
";
@ -927,7 +927,7 @@ e107::js('footer-inline', js());
$current = $this->getController()->getModel()->getData();
$type = intval($current['user_extended_struct_type']);
$type = (int) varset($current['user_extended_struct_type']);
$val_hide = ($type !== EUF_DB_FIELD && $type !== EUF_TEXT && $type !== EUF_COUNTRY ) ? "visible" : "none";

View File

@ -4474,7 +4474,7 @@ class e_admin_controller_ui extends e_admin_controller
$searchable_types[] = 'method';
}
if($var['__tableField'] && trim($searchQuery) !== '' && in_array($var['type'], $searchable_types) )
if(!empty($var['__tableField']) && trim($searchQuery) !== '' && in_array($var['type'], $searchable_types) )
{
// Search for customer filter handler.
$cutomerSearchMethod = 'handle'.$this->getRequest()->getActionName().$this->getRequest()->camelize($key).'Search';

View File

@ -4704,7 +4704,7 @@ class e_parser
if(!isset($parm['size']))
{
$srcSetParm['size'] = ($parm['w'] < 100) ? '4x' : '2x';
$srcSetParm['size'] = (varset($parm['w']) < 100) ? '4x' : '2x';
}
else
{

View File

@ -5093,7 +5093,7 @@ var_dump($select_options);*/
{
if(isset($parms['sep']))
{
$value = number_format($value, $parms['decimals'], vartrue($parms['point'], '.'), vartrue($parms['sep'], ' '));
$value = number_format($value, varset($parms['decimals'],0), vartrue($parms['point'], '.'), vartrue($parms['sep'], ' '));
}
else
{
@ -7323,7 +7323,7 @@ var_dump($select_options);*/
$key = $att['field'];
}
if($key === 'checkboxes' || $key === 'options' || ($att['type'] === null) || ($att['type'] === false))
if($key === 'checkboxes' || $key === 'options' || (varset($att['type']) === null) || (varset($att['type']) === false))
{
continue;
}

View File

@ -73,22 +73,6 @@ class e107_user_extended
}
}
/*
@define('EUF_CATEGORY', 0);
@define('EUF_TEXT',1);
@define('EUF_RADIO',2);
@define('EUF_DROPDOWN',3);
@define('EUF_DB_FIELD',4);
@define('EUF_TEXTAREA',5);
@define('EUF_INTEGER',6);
@define('EUF_DATE',7);
@define('EUF_LANGUAGE',8);
@define('EUF_PREDEFINED',9); // should be EUF_LIST IMO
@define('EUF_CHECKBOX',10);
@define('EUF_PREFIELD',11); // should be EUF_PREDEFINED, useful when creating fields from e.g. plugin XML
@define('EUF_ADDON', 12); // defined within e_user.php addon @todo
@define('EUF_COUNTRY', 13); // $frm->country()
@define('EUF_RICHTEXTAREA', 14); // $frm->bbarea()*/
$this->typeArray = array(
'text' => EUF_TEXT,
@ -1244,23 +1228,24 @@ class e107_user_extended
unset($info);
foreach($data['item'] as $item)
{
if(is_array($item['include_text']) && !count($item['include_text']))
if(isset($item['include_text']) && is_array($item['include_text']) && !count($item['include_text']))
{
$item['include_text'] = '';
}
$info = array(
"name" => $item['@attributes']['name'],
"text" => "UE_LAN_".strtoupper($item['@attributes']['name']),
"type" => $item['type'],
"values" => $item['values'],
"default" => $item['default'],
"required" => $item['required'],
"read" => $item['read'],
"write" => $item['write'],
"applicable" => $item['applicable'],
"include_text" => $item['include_text'],
"parms" => $item['include_text'],
"regex" => $item['regex']
"type" => varset($item['type']),
"values" => varset($item['values']),
"default" => varset($item['default']),
"required" => varset($item['required']),
"read" => varset($item['read']),
"write" => varset($item['write']),
"applicable" => varset($item['applicable']),
"include_text" => varset($item['include_text']),
"parms" => varset($item['include_text']),
"regex" => varset($item['regex'])
);
if(is_array($item['default']) && $item['default'] == '')
{

View File

@ -2000,8 +2000,8 @@ class e_userperms
if(is_array($info))
{
$label = $info[0];
$icon_16 = $info[1];
$icon_32 = $info[2];
$icon_16 = varset($info[1]);
$icon_32 = varset($info[2]);
}
elseif($info)
{

View File

@ -72,21 +72,22 @@ class user_class
$this->isAdmin = FALSE;
$this->fixed_classes = array(
e_UC_PUBLIC => UC_LAN_0,
e_UC_GUEST => UC_LAN_1,
e_UC_NOBODY => UC_LAN_2,
e_UC_MEMBER => UC_LAN_3,
e_UC_ADMIN => UC_LAN_5,
e_UC_MAINADMIN => UC_LAN_6,
e_UC_READONLY => UC_LAN_4,
e_UC_NEWUSER => UC_LAN_9,
e_UC_BOTS => UC_LAN_10
);
e_UC_PUBLIC => UC_LAN_0,
e_UC_GUEST => UC_LAN_1,
e_UC_NOBODY => UC_LAN_2,
e_UC_MEMBER => UC_LAN_3,
e_UC_ADMIN => UC_LAN_5,
e_UC_MAINADMIN => UC_LAN_6,
e_UC_READONLY => UC_LAN_4,
e_UC_NEWUSER => UC_LAN_9,
e_UC_BOTS => UC_LAN_10,
// e_UC_MODS => UC_LAN_7 // specific to Forum plugin
);
$this->text_class_link = array('public' => e_UC_PUBLIC, 'guest' => e_UC_GUEST, 'nobody' => e_UC_NOBODY, 'member' => e_UC_MEMBER,
'admin' => e_UC_ADMIN, 'main' => e_UC_MAINADMIN, 'new' => e_UC_NEWUSER, 'mods' => e_UC_MODS,
'admin' => e_UC_ADMIN, 'main' => e_UC_MAINADMIN, 'new' => e_UC_NEWUSER,/* 'mods' => e_UC_MODS,*/
'bots' => e_UC_BOTS, 'readonly' => e_UC_READONLY);
@ -2033,12 +2034,12 @@ class user_class_admin extends user_class
'userclass_parent' => e_UC_NOBODY,
'userclass_visibility' => e_UC_MEMBER
),
array('userclass_id' => e_UC_MODS, 'userclass_name' => UC_LAN_7,
/* array('userclass_id' => e_UC_MODS, 'userclass_name' => UC_LAN_7,
'userclass_description' => UCSLAN_78,
'userclass_editclass' => e_UC_MAINADMIN,
'userclass_parent' => e_UC_ADMINMOD,
'userclass_visibility' => e_UC_MEMBER
),
),*/
array('userclass_id' => e_UC_NEWUSER, 'userclass_name' => UC_LAN_9,
'userclass_description' => UCSLAN_87,
'userclass_editclass' => e_UC_MAINADMIN,

View File

@ -31,7 +31,7 @@ TODO:
if (!defined('e107_INIT')) { exit; }
/*
define('AUTH_SUCCESS', -1);
define('AUTH_NOUSER', 1);
@ -39,7 +39,7 @@ if (!defined('e107_INIT')) { exit; }
define('AUTH_NOCONNECT', 3);
define('AUTH_UNKNOWN', 4);
define('AUTH_NOT_AVAILABLE', 5);
*/
require_once(e_HANDLER.'user_extended_class.php');
require_once(e_PLUGIN.'alt_auth/alt_auth_login_class.php'); // Has base methods class
@ -562,7 +562,11 @@ function alt_auth_adminmenu()
{
$authlist = alt_auth_admin::alt_auth_get_authlist();
}
define('ALT_AUTH_ACTION', 'main');
if(!defined('ALT_AUTH_ACTION'))
{
define('ALT_AUTH_ACTION', 'main');
}
$var['main']['text'] = LAN_ALT_31;
$var['main']['link'] = e_PLUGIN . 'alt_auth/alt_auth_conf.php';

View File

@ -182,7 +182,7 @@ $text .= "<option value='1' {$sel} >".LAN_ALT_FALLBACK."</option>
<td>".LAN_ALT_8.":<br />
</td>
<td>".$altAuthAdmin->alt_auth_get_dropdown('auth_method2', $pref['auth_method2'], 'none')."
<td>".$altAuthAdmin->alt_auth_get_dropdown('auth_method2', varset($pref['auth_method2']), 'none')."
<div class='smalltext field-help'>".LAN_ALT_9."</div>
</td>
</tr>
@ -227,7 +227,7 @@ if ($euf->userCount)
<td class='center'><input type='checkbox' name='auth_euf_include[]' value='{$f['user_extended_struct_name']}'{$checked} /></td>
<td>{$f['user_extended_struct_name']}</td>
<td>".$tp->toHTML($f['user_extended_struct_text'],FALSE,'TITLE')."</td>
<td>{$euf->user_extended_types[$f['user_extended_struct_type']]}</td></tr>\n";
<td>". varset($euf->user_extended_types[$f['user_extended_struct_type']])."</td></tr>\n";
}
$text .= "</tbody>
</table><div class='buttons-bar center'>

View File

@ -26,14 +26,23 @@ define('AA_DEBUG1',FALSE);
//TODO convert to class constants (but may be more useful as globals, perhaps within a general login manager scheme)
define('AUTH_SUCCESS', -1);
define('AUTH_NOUSER', 1);
define('AUTH_BADPASSWORD', 2);
define('AUTH_NOCONNECT', 3);
define('AUTH_UNKNOWN', 4);
define('AUTH_NOT_AVAILABLE', 5);
define('AUTH_NORESOURCE', 6); // Used to indicate, for example, that a required PHP module isn't loaded
$authConst = array(
'AUTH_SUCCESS' => -1,
'AUTH_NOUSER' => 1,
'AUTH_BADPASSWORD' => 2,
'AUTH_NOCONNECT' => 3,
'AUTH_UNKNOWN' => 4,
'AUTH_NOT_AVAILABLE' => 5,
'AUTH_NORESOURCE' => 6, // Used to indicate => for example => that a required PHP module isn't loaded
);
foreach($authConst as $def => $val)
{
if(!defined($def))
{
define($def, $val);
}
}
/**
* Methods used by a number of alt_auth classes.

View File

@ -97,30 +97,30 @@ $text = "
</colgroup>
<tr>
<td>".CHBLAN_11.":</td>
<td>".$frm->select('chatbox_posts', array(5, 10, 15, 20, 25), $pref['chatbox_posts'],'useValues=1')."<span class='field-help'>".CHBLAN_12."</span></td>
<td>".$frm->select('chatbox_posts', array(5, 10, 15, 20, 25), varset($pref['chatbox_posts']),'useValues=1')."<span class='field-help'>".CHBLAN_12."</span></td>
</tr>
<tr>
<td>".CHBLAN_32.": </td>
<td>". r_userclass("cb_mod", $pref['cb_mod'], 'off', "nobody,main,admin, classes")."</td>
<td>". r_userclass("cb_mod", varset($pref['cb_mod']), 'off', "nobody,main,admin, classes")."</td>
</tr>
<tr>
<td>".CHBLAN_36."</td>
<td>".$frm->radio('cb_layer', array(0 => CHBLAN_37, 1 => str_replace("[x]", $frm->number('cb_layer_height', $pref['cb_layer_height'], 3), CHBLAN_29), 2 => CHBLAN_38), $pref['cb_layer'], array('sep' => '<br />'))."</td>
<td>".$frm->radio('cb_layer', array(0 => CHBLAN_37, 1 => str_replace("[x]", $frm->number('cb_layer_height', varset($pref['cb_layer_height']), 3), CHBLAN_29), 2 => CHBLAN_38), varset($pref['cb_layer']), array('sep' => '<br />'))."</td>
</tr>
";
if($pref['smiley_activate'])
if(!empty($pref['smiley_activate']))
{
$text .= "<tr>
<td>".CHBLAN_31."?: </td>
<td>".$frm->radio_switch('cb_emote', $pref['cb_emote'])."</td>
<td>".$frm->radio_switch('cb_emote', varset($pref['cb_emote']))."</td>
</tr>";
}
$text .= "
<tr>
<td>".CHBLAN_42."</td>
<td>".$frm->radio_switch('cb_user_addon', $pref['cb_user_addon'])."</td>
<td>".$frm->radio_switch('cb_user_addon', varset($pref['cb_user_addon']))."</td>
</tr>
<tr>
<td>".LAN_PRUNE.":</td>

View File

@ -538,11 +538,12 @@ $columnInfo = array(
}
/*
function orphanFiles() //TODO
{
$sql = e107::getDb();
$tp = e107::getParser();
$files = e107::getFile()->get_files(e_DOWNLOAD);
$foundSome = false;
foreach($files as $file)
@ -569,7 +570,7 @@ $columnInfo = array(
}
}
}
}*/
/**
* @inheritdoc
@ -734,7 +735,7 @@ $columnInfo = array(
function showMaint() //XXX Deprecated.
function showMaint()
{
$mes = e107::getMessage();
$mes->addInfo("Deprecated Area - please use filter instead under 'Manage' ");
@ -742,6 +743,7 @@ $columnInfo = array(
global $pref;
$ns = e107::getRender();
$sql = e107::getDb();
$sql2 = e107::getDb('sql2');
$frm = e107::getForm();
$tp = e107::getParser();
@ -790,7 +792,7 @@ $columnInfo = array(
$text .= '<td>*</td>';
}
$text .= '<td>'.$row['download_id'].'</td>';
$text .= "<td><a href='".e_PLUGIN."download/download.php?view.".$row['download_id']."'>".$e107->tp->toHTML($row['download_name']).'</a></td>';
$text .= "<td><a href='".e_PLUGIN."download/download.php?view.".$row['download_id']."'>".$tp->toHTML($row['download_name']).'</a></td>';
$text .= '<td>'.$tp->toHTML($row['download_category_name']).'</td>';
$text .= '<td>
<a href="'.e_SELF.'?create.edit.'.$row["download_id"].'.maint.duplicates">'.ADMIN_EDIT_ICON.'</a>
@ -928,8 +930,8 @@ $columnInfo = array(
$text .= '<tr>';
$text .= '<td>'.$row['download_id'].'</td>';
$text .= "<td><a href='".e_PLUGIN."download/download.php?view.".$row['download_id']."'>".$e107->tp->toHTML($row['download_name']).'</a></td>';
$text .= '<td>'.$e107->tp->toHTML($row['download_category_name']).'</td>';
$text .= "<td><a href='".e_PLUGIN."download/download.php?view.".$row['download_id']."'>".$tp->toHTML($row['download_name']).'</a></td>';
$text .= '<td>'.$tp->toHTML($row['download_category_name']).'</td>';
if (strlen($row['download_url']) > 0) {
$text .= '<td>'.$row['download_url'].'</td>';
} else {
@ -981,9 +983,9 @@ $columnInfo = array(
}
$text .= '<tr>';
$text .= '<td>'.$row['download_id'].'</td>';
$text .= "<td><a href='".e_PLUGIN."download/download.php?view.".$row['download_id']."'>".$e107->tp->toHTML($row['download_name']).'</a></td>';
$text .= "<td><a href='".e_PLUGIN."download/download.php?view.".$row['download_id']."'>".$tp->toHTML($row['download_name']).'</a></td>';
if (strlen($row['download_url']) > 0) {
$text .= '<td>'.$e107->tp->toHTML($row['download_url']).'</td>';
$text .= '<td>'.$tp->toHTML($row['download_url']).'</td>';
} else {
$mirrorArray = download::makeMirrorArray($row['download_mirror'], TRUE);
$text .= '<td>';
@ -1037,9 +1039,9 @@ $columnInfo = array(
}
$text .= '<tr>';
$text .= '<td>'.$row['download_id'].'</td>';
$text .= "<td><a href='".e_PLUGIN."download/download.php?view.".$row['download_id']."'>".$e107->tp->toHTML($row['download_name']).'</a></td>';
$text .= '<td>'.$e107->tp->toHTML($row['download_category_name']).'</td>';
$text .= '<td>'.$e107->tp->toHTML($row['download_url']).'</td>';
$text .= "<td><a href='".e_PLUGIN."download/download.php?view.".$row['download_id']."'>".$tp->toHTML($row['download_name']).'</a></td>';
$text .= '<td>'.$tp->toHTML($row['download_category_name']).'</td>';
$text .= '<td>'.$tp->toHTML($row['download_url']).'</td>';
$text .= '<td>'.$row['download_filesize'].' / ';
$text .= $filesize;
$text .= '</td>';
@ -1883,7 +1885,7 @@ $columnInfo = array(
$dlInfo['download_id'] = $id;
$this->downloadLog('DOWNL_06',$dlInfo,$dlMirrors);
$dlInfo['download_datestamp'] = $time; // This is what 0.7 did, regardless of settings
$dlInfo['download_datestamp'] = time(); // $time; // This is what 0.7 did, regardless of settings
unset($dlInfo['download_class']); // Also replicating 0.7
$e_event->trigger('dlupdate', $dlInfo); // @deprecated
@ -1903,7 +1905,7 @@ $columnInfo = array(
$dlInfo['download_id'] = $download_id;
$this->downloadLog('DOWNL_05',$dlInfo,$dlMirrors);
$dlInfo['download_datestamp'] = $time; // This is what 0.7 did, regardless of settings
$dlInfo['download_datestamp'] = time(); // $time; // This is what 0.7 did, regardless of settings
unset($dlInfo['download_class']); // Also replicating 0.7
$e_event->trigger("dlpost", $dlInfo); // @deprecated

View File

@ -7,6 +7,7 @@ if(!e107::isInstalled('poll'))
{
return;
}
$poll_active = false;
if(e107::getPlugPref('forum', 'poll') != '255')
{

View File

@ -440,11 +440,11 @@ class hero_form_ui extends e_admin_form_ui
$val = varset($value[$v], array());
$text .= "<tr>
<td class='text-center'>".$this->glyphPicker($name.'[icon]', $val['icon'])."</td>
<td>".$this->btnClass($name.'[icon_style]', $val['icon_style'])."</td>
<td>".$this->textarea($name.'[text]',$val['text'],1,80,array('size'=>'block-level'))."</td>
<td>".$this->select($name.'[animation]',$optAnimation, $val['animation'], array( 'useValues'=>1), true)."</td>
<td>".$this->select($name.'[animation_delay]',$optDelay, $val['animation_delay'], array('size'=>'small'), true)."</td>
<td class='text-center'>".$this->glyphPicker($name.'[icon]', varset($val['icon']))."</td>
<td>".$this->btnClass($name.'[icon_style]', varset($val['icon_style']))."</td>
<td>".$this->textarea($name.'[text]', varset($val['text']),1,80,array('size'=>'block-level'))."</td>
<td>".$this->select($name.'[animation]',$optAnimation, varset($val['animation']), array( 'useValues'=>1), true)."</td>
<td>".$this->select($name.'[animation_delay]',$optDelay, varset($val['animation_delay']), array('size'=>'small'), true)."</td>
</tr>";
}
@ -511,10 +511,10 @@ class hero_form_ui extends e_admin_form_ui
$text .= "<tr>
<td class='text-center'>".$this->glyphPicker($name.'[icon]', $val['icon'])."</td>
<td>".$this->text($name.'[label]',$val['label'],255,array('size'=>'block-level', 'placeholder'=>'Label'))."</td>
<td> ".$this->text($name.'[url]',$val['url'],255,array('size'=>'block-level', 'placeholder'=>'URL'))."</td>
<td> ".$this->btnClass($name.'[class]', $val['class'])."</td>
<td class='text-center'>".$this->glyphPicker($name.'[icon]', varset($val['icon']))."</td>
<td>".$this->text($name.'[label]', varset($val['label']), 255, array('size'=>'block-level', 'placeholder'=>'Label'))."</td>
<td> ".$this->text($name.'[url]', varset($val['url']), 255, array('size'=>'block-level', 'placeholder'=>'URL'))."</td>
<td> ".$this->btnClass($name.'[class]', varset($val['class']))."</td>
</tr>";