PHP 8 and PHPStorm error fixes for setup

This commit is contained in:
Ralf Becker 2021-04-01 14:34:19 +02:00
parent db5831c5e4
commit 3fcac1ff72
9 changed files with 14 additions and 19 deletions

View File

@ -224,6 +224,7 @@ if(@$detail)
$setup_tpl->set_var('details', lang($setup_info[$detail]['title'])); $setup_tpl->set_var('details', lang($setup_info[$detail]['title']));
$setup_tpl->pparse('out','detail'); $setup_tpl->pparse('out','detail');
$i = 0;
foreach($setup_info[$detail] as $key => $val) foreach($setup_info[$detail] as $key => $val)
{ {
switch($key) switch($key)
@ -505,7 +506,7 @@ else
$setup_tpl->set_var('instimg','dep.png'); $setup_tpl->set_var('instimg','dep.png');
$setup_tpl->set_var('instalt',lang('Dependency Failure')); $setup_tpl->set_var('instalt',lang('Dependency Failure'));
$setup_tpl->set_var('install',' '); $setup_tpl->set_var('install',' ');
if ($values['currentver']) if ($value['currentver'])
{ {
$setup_tpl->set_var('remove',$key == 'api' ? '&nbsp;' : '<input type="checkbox" name="remove[' . $value['name'] . ']" />'); $setup_tpl->set_var('remove',$key == 'api' ? '&nbsp;' : '<input type="checkbox" name="remove[' . $value['name'] . ']" />');
$setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '">' . lang('Possible Solutions') . '</a>'); $setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '">' . lang('Possible Solutions') . '</a>');

View File

@ -44,10 +44,6 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST)
} }
/* Following to ensure windows file paths are saved correctly */ /* Following to ensure windows file paths are saved correctly */
if (function_exists('get_magic_quotes_runtime') && get_magic_quotes_runtime())
{
set_magic_quotes_runtime(0);
}
$GLOBALS['egw_setup']->loaddb(); $GLOBALS['egw_setup']->loaddb();
/* Check api version, use correct table */ /* Check api version, use correct table */

View File

@ -163,7 +163,7 @@ if ($_POST['upload'] && is_array($_FILES['uploaded']) && !$_FILES['uploaded']['e
$md5 .= ', sha1='.sha1_file($db_backup->backup_dir.'/'.$_FILES['uploaded']['name']); $md5 .= ', sha1='.sha1_file($db_backup->backup_dir.'/'.$_FILES['uploaded']['name']);
$setup_tpl->set_var('error_msg',lang("succesfully uploaded file %1",$_FILES['uploaded']['name'].', '. $setup_tpl->set_var('error_msg',lang("succesfully uploaded file %1",$_FILES['uploaded']['name'].', '.
sprintf('%3.1lf MB (%d)',$_FILES['uploaded']['size']/(1024*1024),$_FILES['uploaded']['size']).$md5)); sprintf('%3.1f MB (%d)',$_FILES['uploaded']['size']/(1024*1024),$_FILES['uploaded']['size']).$md5));
} }
// delete a backup // delete a backup
if ($_POST['delete']) if ($_POST['delete'])
@ -268,7 +268,7 @@ foreach($files as $file => $ctime)
$setup_tpl->set_var(array( $setup_tpl->set_var(array(
'filename' => $file, 'filename' => $file,
'mod' => date('Y-m-d H:i',$ctime), 'mod' => date('Y-m-d H:i',$ctime),
'size' => sprintf('%3.1lf MB (%d)',$size/(1024*1024),$size), 'size' => sprintf('%3.1f MB (%d)',$size/(1024*1024),$size),
'actions' => '<input type="submit" name="download['.$file.']" value="'.htmlspecialchars(lang('download')).'" />&nbsp;'."\n". 'actions' => '<input type="submit" name="download['.$file.']" value="'.htmlspecialchars(lang('download')).'" />&nbsp;'."\n".
'<input type="submit" name="delete['.$file.']" value="'.htmlspecialchars(lang('delete')).'" onclick="return confirm(\''. '<input type="submit" name="delete['.$file.']" value="'.htmlspecialchars(lang('delete')).'" onclick="return confirm(\''.
htmlspecialchars(lang('Confirm to delete this backup?')).'\');" />&nbsp;'."\n". htmlspecialchars(lang('Confirm to delete this backup?')).'\');" />&nbsp;'."\n".

View File

@ -110,7 +110,7 @@ abstract class setup_cmd extends admin_cmd
static private $egw_accounts_backup; static private $egw_accounts_backup;
/** /**
* Create the setup enviroment (for running within setup or EGw) * Create the setup environment (for running within setup or EGw)
*/ */
static protected function _setup_enviroment($domain=null) static protected function _setup_enviroment($domain=null)
{ {
@ -135,7 +135,6 @@ abstract class setup_cmd extends admin_cmd
self::$egw_accounts_backup = $GLOBALS['egw']->accounts; self::$egw_accounts_backup = $GLOBALS['egw']->accounts;
unset($GLOBALS['egw']->accounts); unset($GLOBALS['egw']->accounts);
} }
if ($this->config) self::$egw_setup->setup_account_object($this->config);
} }
if (is_object($GLOBALS['egw']->db) && $domain) if (is_object($GLOBALS['egw']->db) && $domain)
{ {
@ -165,7 +164,7 @@ abstract class setup_cmd extends admin_cmd
{ {
$GLOBALS['egw']->accounts = self::$egw_accounts_backup; $GLOBALS['egw']->accounts = self::$egw_accounts_backup;
Api\Accounts::cache_invalidate(); Api\Accounts::cache_invalidate();
unset(self::$egw_accounts_backup); self::$egw_accounts_backup = null;
} }
} }
} }

View File

@ -249,7 +249,8 @@ class setup_cmd_header extends setup_cmd
{ {
if (strpos($name,'/') !== false) if (strpos($name,'/') !== false)
{ {
$name = array_pop($parts = explode('/',$name)); $parts = explode('/',$name);
$name = array_pop($parts);
} }
if (isset($this->$name)) if (isset($this->$name))
{ {

View File

@ -67,7 +67,7 @@ class setup_cmd_ldap extends setup_cmd
/** /**
* Instance of ldap object * Instance of ldap object
* *
* @var ldap * @var Api\Ldap
*/ */
private $test_ldap; private $test_ldap;
@ -773,7 +773,6 @@ class setup_cmd_ldap extends setup_cmd
{ {
if ($account_id != $account['account_id']) // not all backends have as key the account_id if ($account_id != $account['account_id']) // not all backends have as key the account_id
{ {
unset($account);
$account_id = $account['account_id']; $account_id = $account['account_id'];
} }
$account += $accounts_obj->read($account_id); $account += $accounts_obj->read($account_id);

View File

@ -41,8 +41,6 @@ class setup_process
/** /**
* create schema_proc object * create schema_proc object
*
* @param none
*/ */
function init_process() function init_process()
{ {

View File

@ -135,10 +135,10 @@ function _mcrypt_test_module_mode($module,$mode)
} }
$key = substr($key_in, 0, mcrypt_enc_get_key_size($GLOBALS['td'])); $key = substr($key_in, 0, mcrypt_enc_get_key_size($GLOBALS['td']));
$iv_size = mcrypt_enc_get_iv_size($GLOBALS['td']); $iv_size = mcrypt_enc_get_iv_size($GLOBALS['td']);
$iv = @mcrypt_create_iv($iv_size, MCRYPT_RAND); $iv = @mcrypt_create_iv($iv_size, MCRYPT_DEV_RANDOM);
/* Initialize encryption handle */ /* Initialize encryption handle */
if(mcrypt_generic_init($GLOBALS['td'], $key, $iv) != -1) if($iv && mcrypt_generic_init($GLOBALS['td'], $key, $iv) != -1)
{ {
/* Encrypt data */ /* Encrypt data */
$c_t = mcrypt_generic($GLOBALS['td'], $plain_text); $c_t = mcrypt_generic($GLOBALS['td'], $plain_text);

View File

@ -177,6 +177,7 @@ $completed = $GLOBALS['egw_info']['server']['app_images'] . '/completed.png';
$setup_tpl->set_var('img_incomplete',$incomplete); $setup_tpl->set_var('img_incomplete',$incomplete);
$setup_tpl->set_var('img_completed',$completed); $setup_tpl->set_var('img_completed',$completed);
$num = 0;
$setup_tpl->set_var('db_step_text',lang('Step %1 - Simple Application Management', ++$num)); $setup_tpl->set_var('db_step_text',lang('Step %1 - Simple Application Management', ++$num));
$setup_tpl->set_var('lang_system_charset',lang('<b>charset to use</b> (use utf-8 if you plan to use languages with different charsets):')); $setup_tpl->set_var('lang_system_charset',lang('<b>charset to use</b> (use utf-8 if you plan to use languages with different charsets):'));
$setup_tpl->set_var('system_charset',str_replace('&amp;','&', $setup_tpl->set_var('system_charset',str_replace('&amp;','&',
@ -519,7 +520,7 @@ switch($GLOBALS['egw_info']['setup']['stage']['db'])
} }
// Backup and restore section // Backup and restore section
$setup_tpl->set_var('backup_step_text',lang('Step %1 - DB backup and restore', ++$num)); $setup_tpl->set_var('backup_step_text',lang('Step %1 - DB backup and restore', ++$num));
if ($GLOBALS['egw_info']['setup']['stage']['db'] == 10 && !$no_backup_dir) if ($GLOBALS['egw_info']['setup']['stage']['db'] == 10)
{ {
$setup_tpl->set_var('backup_status_img',$completed); $setup_tpl->set_var('backup_status_img',$completed);
$setup_tpl->set_var('backup_status_alt',lang('completed')); $setup_tpl->set_var('backup_status_alt',lang('completed'));
@ -533,7 +534,7 @@ else
{ {
$setup_tpl->set_var('backup_status_img',$incomplete); $setup_tpl->set_var('backup_status_img',$incomplete);
$setup_tpl->set_var('backup_status_alt',lang('not completed')); $setup_tpl->set_var('backup_status_alt',lang('not completed'));
$setup_tpl->set_var('backup_table_data',$no_backup_dir ? $no_backup_dir : lang('Not ready for this stage yet')); $setup_tpl->set_var('backup_table_data',lang('Not ready for this stage yet'));
} }
$setup_tpl->pparse('out','T_setup_main'); $setup_tpl->pparse('out','T_setup_main');