diff --git a/application/loginwebpage.class.inc.php b/application/loginwebpage.class.inc.php
index d7d0368d2..1e4f6fbe8 100644
--- a/application/loginwebpage.class.inc.php
+++ b/application/loginwebpage.class.inc.php
@@ -233,7 +233,8 @@ class LoginWebPage extends NiceWebPage
try
{
UserRights::Login($sAuthUser); // Set the user's language (if possible!)
- $oUser = UserRights::GetUserObject();
+ /** @var UserInternal $oUser */
+ $oUser = UserRights::GetUserObject();
if ($oUser == null)
{
throw new Exception(Dict::Format('UI:ResetPwd-Error-WrongLogin', $sAuthUser));
@@ -257,6 +258,7 @@ class LoginWebPage extends NiceWebPage
$sToken = substr(md5(APPROOT.uniqid()), 0, 16);
$oUser->Set('reset_pwd_token', $sToken);
CMDBObject::SetTrackInfo('Reset password');
+ $oUser->AllowWrite(true);
$oUser->DBUpdate();
$oEmail = new Email();
diff --git a/setup/setuputils.class.inc.php b/setup/setuputils.class.inc.php
index e9c041bdc..f60b9860a 100644
--- a/setup/setuputils.class.inc.php
+++ b/setup/setuputils.class.inc.php
@@ -71,7 +71,7 @@ class SetupUtils
*
...
*
*
- * @internal SetupPage $oP The page used only for its 'log' method
+ * @internal SetupPage $oP The page used only for its 'log' method
* @return CheckResult[]
*/
static function CheckPhpAndExtensions()
@@ -85,17 +85,17 @@ class SetupUtils
}
self::CheckPhpVersion($aResult);
-
+
// Check the common directories
$aWritableDirsErrors = self::CheckWritableDirs(array('log', 'env-production', 'env-production-build', 'conf', 'data'));
$aResult = array_merge($aResult, $aWritableDirsErrors);
-
+
$aMandatoryExtensions = array('mysqli', 'iconv', 'simplexml', 'soap', 'hash', 'json', 'session', 'pcre', 'dom', 'zlib', 'zip');
$aOptionalExtensions = array( 'mcrypt, sodium or openssl' => array( 'mcrypt' => 'Strong encryption will not be used.',
- 'sodium' => 'Strong encryption will not be used.',
- 'openssl' => 'Strong encryption will not be used.',),
- 'ldap' => 'LDAP authentication will be disabled.',
- 'gd' => 'PDF export will be disabled. Also, image resizing will be disabled on profile pictures (May increase database size).');
+ 'sodium' => 'Strong encryption will not be used.',
+ 'openssl' => 'Strong encryption will not be used.',),
+ 'ldap' => 'LDAP authentication will be disabled.',
+ 'gd' => 'PDF export will be disabled. Also, image resizing will be disabled on profile pictures (May increase database size).');
asort($aMandatoryExtensions); // Sort the list to look clean !
ksort($aOptionalExtensions); // Sort the list to look clean !
$aExtensionsOk = array();
@@ -253,9 +253,9 @@ class SetupUtils
$aResult[] = new CheckResult(CheckResult::ERROR, "'magic_quotes_gpc' is set to On. Please turn it Off in php.ini before continuing.");
}
}
- if (function_exists('get_magic_quotes_runtime'))
- {
- if (@get_magic_quotes_runtime())
+ if (function_exists('get_magic_quotes_runtime'))
+ {
+ if (@get_magic_quotes_runtime())
{
$aResult[] = new CheckResult(CheckResult::ERROR, "'magic_quotes_runtime' is set to On. Please turn it Off in php.ini before continuing.");
}
@@ -326,16 +326,16 @@ class SetupUtils
}
$aResult[] = new CheckResult(CheckResult::INFO, "Loaded php.ini files: $sPhpIniFile");
}
-
+
// Check the configuration of the sessions persistence, since this is critical for the authentication
if (ini_get('session.save_handler') == 'files')
{
$sSavePath = ini_get('session.save_path');
SetupPage::log("Info - session.save_path is: '$sSavePath'.");
-
+
// According to the PHP documentation, the format can be /path/where/to_save_sessions or "N;/path/where/to_save_sessions" or "N;MODE;/path/where/to_save_sessions"
$sSavePath = ltrim(rtrim($sSavePath, '"'), '"'); // remove surrounding quotes (if any)
-
+
if (!empty($sSavePath))
{
if (($iPos = strrpos($sSavePath, ';', 0)) !== false)
@@ -345,23 +345,23 @@ class SetupUtils
}
if (!is_writable($sSavePath))
{
- $aResult[] = new CheckResult(CheckResult::ERROR, "The value for session.save_path ($sSavePath) is not writable for the web server. Make sure that PHP can actually save session variables. (Refer to the PHP documentation: http://php.net/manual/en/session.configuration.php#ini.session.save-path)");
+ $aResult[] = new CheckResult(CheckResult::ERROR, "The value for session.save_path ($sSavePath) is not writable for the web server. Make sure that PHP can actually save session variables. (Refer to the PHP documentation: http://php.net/manual/en/session.configuration.php#ini.session.save-path)");
}
else
{
- $aResult[] = new CheckResult(CheckResult::INFO, "The value for session.save_path ($sSavePath) is writable for the web server.");
+ $aResult[] = new CheckResult(CheckResult::INFO, "The value for session.save_path ($sSavePath) is writable for the web server.");
}
}
else
{
- $aResult[] = new CheckResult(CheckResult::WARNING, "Empty path for session.save_path. Make sure that PHP can actually save session variables. (Refer to the PHP documentation: http://php.net/manual/en/session.configuration.php#ini.session.save-path)");
+ $aResult[] = new CheckResult(CheckResult::WARNING, "Empty path for session.save_path. Make sure that PHP can actually save session variables. (Refer to the PHP documentation: http://php.net/manual/en/session.configuration.php#ini.session.save-path)");
}
}
else
{
$aResult[] = new CheckResult(CheckResult::INFO, "session.save_handler is: '".ini_get('session.save_handler')."' (different from 'files').");
}
-
+
return $aResult;
}
@@ -407,13 +407,13 @@ class SetupUtils
}
}
- /**
- * Check that the selected modules meet their dependencies
- * @param $sSourceDir
- * @param $sExtensionDir
- * @param $aSelectedModules
- * @return array
- */
+ /**
+ * Check that the selected modules meet their dependencies
+ * @param $sSourceDir
+ * @param $sExtensionDir
+ * @param $aSelectedModules
+ * @return array
+ */
static function CheckSelectedModules($sSourceDir, $sExtensionDir, $aSelectedModules)
{
$aResult = array();
@@ -438,12 +438,12 @@ class SetupUtils
return $aResult;
}
- /**
- * Check that the backup could be executed
- * @param $sDestDir
- * @return array An array of CheckResults objects
- * @internal param Page $oP The page used only for its 'log' method
- */
+ /**
+ * Check that the backup could be executed
+ * @param $sDestDir
+ * @return array An array of CheckResults objects
+ * @internal param Page $oP The page used only for its 'log' method
+ */
static function CheckBackupPrerequisites($sDestDir, $sMySQLBinDir = null)
{
$aResult = array();
@@ -497,13 +497,13 @@ class SetupUtils
}
elseif ($iRetCode == 1)
{
- // Unfortunately $aOutput is not really usable since we don't know its encoding (character set)
+ // Unfortunately $aOutput is not really usable since we don't know its encoding (character set)
$aResult[] = new CheckResult(CheckResult::ERROR, "mysqldump could not be found. Please make sure it is installed and in the path.");
}
else
{
- // Unfortunately $aOutput is not really usable since we don't know its encoding (character set)
- $aResult[] = new CheckResult(CheckResult::ERROR, "mysqldump could not be executed (retcode=$iRetCode): Please make sure it is installed and " . (empty($sMySQLBinDir) ? "in the path" : "located at : $sMySQLDump"));
+ // Unfortunately $aOutput is not really usable since we don't know its encoding (character set)
+ $aResult[] = new CheckResult(CheckResult::ERROR, "mysqldump could not be executed (retcode=$iRetCode): Please make sure it is installed and " . (empty($sMySQLBinDir) ? "in the path" : "located at : $sMySQLDump"));
}
foreach($aOutput as $sLine)
{
@@ -519,17 +519,17 @@ class SetupUtils
return $aResult;
}
- /**
- * Check that graphviz can be launched
- * @param $sGraphvizPath
- * @return CheckResult The result of the check
- * @internal param string $GraphvizPath The path where graphviz' dot program is installed
- */
+ /**
+ * Check that graphviz can be launched
+ * @param $sGraphvizPath
+ * @return CheckResult The result of the check
+ * @internal param string $GraphvizPath The path where graphviz' dot program is installed
+ */
static function CheckGraphviz($sGraphvizPath)
{
$oResult = null;
SetupPage::log('Info - CheckGraphviz');
-
+
// availability of exec()
//
$aDisabled = explode(', ', ini_get('disable_functions'));
@@ -538,14 +538,14 @@ class SetupUtils
{
$aResult[] = new CheckResult(CheckResult::ERROR, "The PHP exec() function has been disabled on this server");
}
-
+
// availability of dot / dot.exe
if (empty($sGraphvizPath))
{
$sGraphvizPath = 'dot';
}
$sCommand = "\"$sGraphvizPath\" -V 2>&1";
-
+
$aOutput = array();
$iRetCode = 0;
exec($sCommand, $aOutput, $iRetCode);
@@ -565,13 +565,13 @@ class SetupUtils
{
SetupPage::log('Info - '.$sGraphvizPath.' -V said: '.$sLine);
}
-
+
return $oResult;
}
-
+
/**
* Helper function to retrieve the system's temporary directory
- * Emulates sys_get_temp_dir if needed (PHP < 5.2.1)
+ * Emulates sys_get_temp_dir if needed (PHP < 5.2.1)
* @return string Path to the system's temp directory
*/
static function GetTmpDir()
@@ -593,11 +593,11 @@ class SetupUtils
return $sPath;
}
- /**
- * Helper to recursively remove a directory
- * @param $dir
- * @throws Exception
- */
+ /**
+ * Helper to recursively remove a directory
+ * @param $dir
+ * @throws Exception
+ */
public static function rrmdir($dir)
{
if ((strlen(trim($dir)) == 0) || ($dir == '/') || ($dir == '\\'))
@@ -608,11 +608,11 @@ class SetupUtils
self::rmdir_safe($dir);
}
- /**
- * Helper to recursively cleanup a directory
- * @param $dir
- * @throws Exception
- */
+ /**
+ * Helper to recursively cleanup a directory
+ * @param $dir
+ * @throws Exception
+ */
public static function tidydir($dir)
{
if ((strlen(trim($dir)) == 0) || ($dir == '/') || ($dir == '\\'))
@@ -648,10 +648,10 @@ class SetupUtils
}
}
- /**
- * Helper to build the full path of a new directory
- * @param $dir
- */
+ /**
+ * Helper to build the full path of a new directory
+ * @param $dir
+ */
public static function builddir($dir)
{
$parent = dirname($dir);
@@ -683,15 +683,15 @@ class SetupUtils
}
}
- /**
- * Helper to copy a directory to a target directory, skipping .SVN files (for developer's comfort!)
- * Returns true if successful
- * @param $sSource
- * @param $sDest
- * @param bool $bUseSymbolicLinks
- * @return bool
- * @throws Exception
- */
+ /**
+ * Helper to copy a directory to a target directory, skipping .SVN files (for developer's comfort!)
+ * Returns true if successful
+ * @param $sSource
+ * @param $sDest
+ * @param bool $bUseSymbolicLinks
+ * @return bool
+ * @throws Exception
+ */
public static function copydir($sSource, $sDest, $bUseSymbolicLinks = false)
{
if (is_dir($sSource))
@@ -799,20 +799,20 @@ class SetupUtils
self::copydir($sSource, $sDest);
self::tidydir($sSource);
if($bRemoveSource === true)
- {
- self::rmdir_safe($sSource);
- }
+ {
+ self::rmdir_safe($sSource);
+ }
}
static function GetPreviousInstance($sDir)
{
$sSourceDir = '';
- $sSourceEnvironment = '';
+ $sSourceEnvironment = '';
$sConfigFile = '';
$aResult = array(
'found' => false,
);
-
+
if (file_exists($sDir.'/config-itop.php'))
{
$sSourceDir = $sDir;
@@ -827,7 +827,7 @@ class SetupUtils
$sConfigFile = $sDir.'/conf/production/config-itop.php';
$aResult['found'] = true;
}
-
+
if ($aResult['found'])
{
$oPrevConf = new Config($sConfigFile);
@@ -848,7 +848,7 @@ class SetupUtils
'mysql_bindir' => $oPrevConf->GetModuleSetting('itop-backup', 'mysql_bindir', ''),
);
}
-
+
return $aResult;
}
@@ -866,10 +866,10 @@ class SetupUtils
if ($sDir == '.') break;
$sDir = dirname($sDir);
}
-
+
return $f;
}
-
+
static function HumanReadableSize($fBytes)
{
$aSizes = array('bytes', 'Kb', 'Mb', 'Gb', 'Tb', 'Pb', 'Hb');
@@ -879,7 +879,7 @@ class SetupUtils
$index++;
$fBytes = $fBytes / 1000;
}
-
+
return sprintf('%.2f %s', $fBytes, $aSizes[$index]);
}
@@ -926,9 +926,9 @@ class SetupUtils
$oPage->add('');
$oPage->add('');
$oPage->add('');
-
+
$oPage->add('