mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-18 00:09:06 +01:00
Clean errors detected by PHPstan (level 1)
This commit is contained in:
parent
38fa02619d
commit
e71823b644
29 changed files with 107 additions and 93 deletions
14
phpstan.neon
14
phpstan.neon
|
@ -1,5 +1,5 @@
|
||||||
parameters:
|
parameters:
|
||||||
level: 0
|
level: 1
|
||||||
paths:
|
paths:
|
||||||
- src
|
- src
|
||||||
excludePaths:
|
excludePaths:
|
||||||
|
@ -7,10 +7,20 @@ parameters:
|
||||||
- src/tmp
|
- src/tmp
|
||||||
# Error message "Class Smarty_Resource_LdapSaisie extends unknown class Smarty_Resource_Custom." cannot be ignored, use excludePaths instead.
|
# Error message "Class Smarty_Resource_LdapSaisie extends unknown class Smarty_Resource_Custom." cannot be ignored, use excludePaths instead.
|
||||||
- src/includes/class/class.LStemplate_smarty3_support.php
|
- src/includes/class/class.LStemplate_smarty3_support.php
|
||||||
|
bootstrapFiles:
|
||||||
|
- src/includes/core.php
|
||||||
|
universalObjectCratesClasses:
|
||||||
|
- LSsearch
|
||||||
|
- LSsearchEntry
|
||||||
|
- LSrelation
|
||||||
|
- LSlog_handler
|
||||||
|
- LSlog_logger
|
||||||
|
- LSldapObject
|
||||||
|
- LSurlRequest
|
||||||
ignoreErrors:
|
ignoreErrors:
|
||||||
- "#Instantiated class (Smarty|Console_Table|ZxcvbnPhp\\\\Zxcvbn|phpseclib\\\\Crypt\\\\RSA|phpseclib\\\\Net\\\\SFTP|phpseclib\\\\Net\\\\SSH2|Net_FTP) not found\\.#"
|
- "#Instantiated class (Smarty|Console_Table|ZxcvbnPhp\\\\Zxcvbn|phpseclib\\\\Crypt\\\\RSA|phpseclib\\\\Net\\\\SFTP|phpseclib\\\\Net\\\\SSH2|Net_FTP) not found\\.#"
|
||||||
- "#Call to static method (connect|isError)\\(\\) on an unknown class Net_LDAP2\\.#"
|
- "#Call to static method (connect|isError)\\(\\) on an unknown class Net_LDAP2\\.#"
|
||||||
- "#Class (Net_LDAP2_Filter|Net_LDAP2_Entry|PEAR_Error) not found\\.#"
|
- "#(Class|Constant) (Net_LDAP2_Filter|Net_LDAP2_Entry|PEAR_Error) not found\\.#"
|
||||||
- "#Call to static method (create|parse|combine|escape)\\(\\) on an unknown class Net_LDAP2_Filter\\.#"
|
- "#Call to static method (create|parse|combine|escape)\\(\\) on an unknown class Net_LDAP2_Filter\\.#"
|
||||||
- "#Call to static method (createFresh)\\(\\) on an unknown class Net_LDAP2_Entry\\.#"
|
- "#Call to static method (createFresh)\\(\\) on an unknown class Net_LDAP2_Entry\\.#"
|
||||||
- "#Call to static method (forceAuthentication|getUser|logout|setDebug|client|setNoCasServerValidation|setCasServerCACert|setExtraCurlOption)\\(\\) on an unknown class phpCAS\\.#"
|
- "#Call to static method (forceAuthentication|getUser|logout|setDebug|client|setNoCasServerValidation|setCasServerCACert|setExtraCurlOption)\\(\\) on an unknown class phpCAS\\.#"
|
||||||
|
|
|
@ -105,7 +105,7 @@ LSerror :: defineError('ASTERISK_03',
|
||||||
}
|
}
|
||||||
|
|
||||||
$password = $ldapObject -> attrs[ LS_ASTERISK_USERPASSWORD_ATTR ] -> ldap -> getClearPassword();
|
$password = $ldapObject -> attrs[ LS_ASTERISK_USERPASSWORD_ATTR ] -> ldap -> getClearPassword();
|
||||||
if (!$password or empty($password)) {
|
if (!$password) {
|
||||||
LSerror :: addErrorCode('ASTERISK_03');
|
LSerror :: addErrorCode('ASTERISK_03');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,15 +304,15 @@ function triggerUpdateDynGroupsMembersCacheOnUserChanges(&$user, &$changed_attrs
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$is_impacted = false;
|
$impacted_attr = null;
|
||||||
foreach($filter_attrs as $attr) {
|
foreach($filter_attrs as $attr) {
|
||||||
if (in_array(strtolower($attr), $changed_attrs)) {
|
if (in_array(strtolower($attr), $changed_attrs)) {
|
||||||
$is_impacted = true;
|
$impacted_attr = $attr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$is_impacted) {
|
if (!$impacted_attr) {
|
||||||
LSlog :: get_logger('LSaddon_dyngroup') -> debug(
|
LSlog :: get_logger('LSaddon_dyngroup') -> debug(
|
||||||
"triggerUpdateDynGroupsMembersCacheOnUserChanges($user): $group is NOT impacted by user's changes."
|
"triggerUpdateDynGroupsMembersCacheOnUserChanges($user): $group is NOT impacted by user's changes."
|
||||||
);
|
);
|
||||||
|
@ -320,7 +320,7 @@ function triggerUpdateDynGroupsMembersCacheOnUserChanges(&$user, &$changed_attrs
|
||||||
}
|
}
|
||||||
LSlog :: get_logger('LSaddon_dyngroup') -> debug(
|
LSlog :: get_logger('LSaddon_dyngroup') -> debug(
|
||||||
"triggerUpdateDynGroupsMembersCacheOnUserChanges($user): $group is impacted by user's changes ".
|
"triggerUpdateDynGroupsMembersCacheOnUserChanges($user): $group is impacted by user's changes ".
|
||||||
"(at least by attribute '$attr')."
|
"(at least by attribute '$impacted_attr')."
|
||||||
);
|
);
|
||||||
$impacted_dyngroups++;
|
$impacted_dyngroups++;
|
||||||
if (updateDynGroupMembersCache($group, false))
|
if (updateDynGroupMembersCache($group, false))
|
||||||
|
|
|
@ -201,6 +201,7 @@ function ppolicy_extraDisplayColumn_password_expiration($entry) {
|
||||||
* @return boolean Void if CSV file is successfully generated and upload, false in other case
|
* @return boolean Void if CSV file is successfully generated and upload, false in other case
|
||||||
*/
|
*/
|
||||||
function ppolicy_export_search_info($LSsearch, $as_csv=true, $return=false) {
|
function ppolicy_export_search_info($LSsearch, $as_csv=true, $return=false) {
|
||||||
|
$csv = null;
|
||||||
if ($as_csv) {
|
if ($as_csv) {
|
||||||
$csv = fopen('php://temp/maxmemory:'. (5*1024*1024), 'r+');
|
$csv = fopen('php://temp/maxmemory:'. (5*1024*1024), 'r+');
|
||||||
|
|
||||||
|
@ -224,6 +225,7 @@ function ppolicy_export_search_info($LSsearch, $as_csv=true, $return=false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$data = array();
|
||||||
if ($as_csv) {
|
if ($as_csv) {
|
||||||
$headers = array($LSsearch->label_objectName, 'DN');
|
$headers = array($LSsearch->label_objectName, 'DN');
|
||||||
foreach($attrs as $attr) {
|
foreach($attrs as $attr) {
|
||||||
|
@ -236,9 +238,6 @@ function ppolicy_export_search_info($LSsearch, $as_csv=true, $return=false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$data = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($LSsearch -> getSearchEntries() as $e) {
|
foreach ($LSsearch -> getSearchEntries() as $e) {
|
||||||
$row = array(
|
$row = array(
|
||||||
|
@ -250,7 +249,7 @@ function ppolicy_export_search_info($LSsearch, $as_csv=true, $return=false) {
|
||||||
if ($as_csv) {
|
if ($as_csv) {
|
||||||
$values = ensureIsArray($e -> get($attr));
|
$values = ensureIsArray($e -> get($attr));
|
||||||
if ($values) {
|
if ($values) {
|
||||||
$row[] = ($as_json?$values:implode('|', $values));
|
$row[] = implode('|', $values);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$no_value_label = LSconfig::get(
|
$no_value_label = LSconfig::get(
|
||||||
|
|
|
@ -223,7 +223,7 @@ LSerror :: defineError('SSH_07',
|
||||||
*
|
*
|
||||||
* @retval boolean
|
* @retval boolean
|
||||||
*/
|
*/
|
||||||
function removeDirsBySFTP($connection_params, $dirs, $recursive=false) {
|
function removeDirsBySFTP($connection_params, $dirs, $recursive=false, $continue=false) {
|
||||||
$cnx = connectToSSH($connection_params, true);
|
$cnx = connectToSSH($connection_params, true);
|
||||||
if (! $cnx){
|
if (! $cnx){
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -146,6 +146,7 @@ class LSattr_ldap_password extends LSattr_ldap {
|
||||||
break;
|
break;
|
||||||
case 'sha256':
|
case 'sha256':
|
||||||
case 'sha512':
|
case 'sha512':
|
||||||
|
$mhash_type = null;
|
||||||
switch($encode) {
|
switch($encode) {
|
||||||
case 'sha256':
|
case 'sha256':
|
||||||
$mhash_type = MHASH_SHA256;
|
$mhash_type = MHASH_SHA256;
|
||||||
|
@ -163,6 +164,7 @@ class LSattr_ldap_password extends LSattr_ldap {
|
||||||
case 'ssha':
|
case 'ssha':
|
||||||
case 'ssha256':
|
case 'ssha256':
|
||||||
case 'ssha512':
|
case 'ssha512':
|
||||||
|
$mhash_type = null;
|
||||||
switch($encode) {
|
switch($encode) {
|
||||||
case 'ssha':
|
case 'ssha':
|
||||||
$mhash_type = MHASH_SHA1;
|
$mhash_type = MHASH_SHA1;
|
||||||
|
@ -263,12 +265,10 @@ class LSattr_ldap_password extends LSattr_ldap {
|
||||||
return (strcasecmp(call_user_func_array($encodeFunction, array(&$this -> attribute -> ldapObject, $clearPassword)), $hashedPassword) == 0);
|
return (strcasecmp(call_user_func_array($encodeFunction, array(&$this -> attribute -> ldapObject, $clearPassword)), $hashedPassword) == 0);
|
||||||
|
|
||||||
// Extract cipher
|
// Extract cipher
|
||||||
|
$hashedPasswordData = $cypher = null;
|
||||||
if (preg_match('/{([^}]+)}(.*)/',$hashedPassword,$matches)) {
|
if (preg_match('/{([^}]+)}(.*)/',$hashedPassword,$matches)) {
|
||||||
$hashedPasswordData = $matches[2];
|
$hashedPasswordData = $matches[2];
|
||||||
$cypher = strtolower($matches[1]);
|
$cypher = strtolower($matches[1]);
|
||||||
|
|
||||||
} else {
|
|
||||||
$cypher = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify password according on cypher
|
// Verify password according on cypher
|
||||||
|
|
|
@ -699,7 +699,7 @@ class LSattribute extends LSlog_staticLoggerClass {
|
||||||
call_user_func_array($e['fct'], array(&$e['params']));
|
call_user_func_array($e['fct'], array(&$e['params']));
|
||||||
}
|
}
|
||||||
catch(Exception $er) {
|
catch(Exception $er) {
|
||||||
self :: log_exception($er, strval($this)." -> fireEvent($event): exception occured running ".format_callable(e['fct']));
|
self :: log_exception($er, strval($this)." -> fireEvent($event): exception occured running ".format_callable($e['fct']));
|
||||||
$return = false;
|
$return = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ class LSformElement_image extends LSformElement {
|
||||||
$php_debug_params[] = "$param = '".ini_get($param)."'";
|
$php_debug_params[] = "$param = '".ini_get($param)."'";
|
||||||
$php_debug_params[] = "HTML form MAX_FILE_SIZE = '".MAX_SEND_FILE_SIZE."'";
|
$php_debug_params[] = "HTML form MAX_FILE_SIZE = '".MAX_SEND_FILE_SIZE."'";
|
||||||
self :: log_debug('LSformElement_image('.$this->name.')->getPostData(): '.implode(', ', $php_debug_params));
|
self :: log_debug('LSformElement_image('.$this->name.')->getPostData(): '.implode(', ', $php_debug_params));
|
||||||
$this -> form -> setElementError($this -> attr_html, $this -> getFileUploadErrorMessage($_FILES[$this -> name]));
|
$this -> form -> setElementError($this -> attr_html, $this -> getFileUploadErrorMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ class LSformElement_image extends LSformElement {
|
||||||
* @retval string The translated file upload error message
|
* @retval string The translated file upload error message
|
||||||
*/
|
*/
|
||||||
private function getFileUploadErrorMessage() {
|
private function getFileUploadErrorMessage() {
|
||||||
if (isset($_FILES) && isset($_FILES[$this -> name]) && isset($_FILES[$this -> name]['error'])) {
|
if (isset($_FILES[$this -> name]) && isset($_FILES[$this -> name]['error'])) {
|
||||||
switch($_FILES[$this -> name]['error']) {
|
switch($_FILES[$this -> name]['error']) {
|
||||||
case UPLOAD_ERR_INI_SIZE:
|
case UPLOAD_ERR_INI_SIZE:
|
||||||
return _('The uploaded file size exceeds the limit accepted by the server.');
|
return _('The uploaded file size exceeds the limit accepted by the server.');
|
||||||
|
|
|
@ -192,10 +192,8 @@ class LSformElement_select extends LSformElement {
|
||||||
*
|
*
|
||||||
* @retval void
|
* @retval void
|
||||||
**/
|
**/
|
||||||
function LSformElement_select_checkIsValidValue($params,$template) {
|
function LSformElement_select_checkIsValidValue($params, $template) {
|
||||||
extract($params);
|
$ret = LSformElement_select :: _isValidValue($params['value'], $params['possible_values']);
|
||||||
|
|
||||||
$ret = LSformElement_select :: _isValidValue($value, $possible_values);
|
|
||||||
|
|
||||||
if ($ret===False) {
|
if ($ret===False) {
|
||||||
$label='';
|
$label='';
|
||||||
|
|
|
@ -400,7 +400,7 @@ class LSformElement_supannCompositeAttribute extends LSformElement {
|
||||||
}
|
}
|
||||||
self :: log_debug($this." -> getPostData(): POST data = ".varDump($parseValues));
|
self :: log_debug($this." -> getPostData(): POST data = ".varDump($parseValues));
|
||||||
|
|
||||||
if (!$parseValue && $onlyIfPresent)
|
if (!$parseValues && $onlyIfPresent)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
$return[$this -> name] = array();
|
$return[$this -> name] = array();
|
||||||
|
@ -572,7 +572,7 @@ class LSformElement_supannCompositeAttribute extends LSformElement {
|
||||||
public function getApiValue($details=false) {
|
public function getApiValue($details=false) {
|
||||||
$values = array();
|
$values = array();
|
||||||
foreach(ensureIsArray($this -> values) as $value) {
|
foreach(ensureIsArray($this -> values) as $value) {
|
||||||
$decodedValue = $this -> parseCompositeValue($value, true);
|
$decodedValue = $this -> parseCompositeValue($value);
|
||||||
if (is_array($decodedValue)) {
|
if (is_array($decodedValue)) {
|
||||||
$parsedValue = array();
|
$parsedValue = array();
|
||||||
foreach(array_keys($this -> components) as $c) {
|
foreach(array_keys($this -> components) as $c) {
|
||||||
|
|
|
@ -178,6 +178,7 @@ class LSformElement_text extends LSformElement {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
$filters = array();
|
||||||
foreach($value_attributes as $attr) {
|
foreach($value_attributes as $attr) {
|
||||||
$filters[] = Net_LDAP2_Filter::create($attr, 'contains', $pattern);
|
$filters[] = Net_LDAP2_Filter::create($attr, 'contains', $pattern);
|
||||||
}
|
}
|
||||||
|
@ -217,19 +218,18 @@ class LSformElement_text extends LSformElement {
|
||||||
foreach($value_attributes as $attr) {
|
foreach($value_attributes as $attr) {
|
||||||
if (!isset($object['attrs'][$attr])) continue;
|
if (!isset($object['attrs'][$attr])) continue;
|
||||||
$values = ensureIsArray($object['attrs'][$attr]);
|
$values = ensureIsArray($object['attrs'][$attr]);
|
||||||
foreach($values as $value)
|
foreach($values as $value) {
|
||||||
|
$ret[$value] = (
|
||||||
if ($displayNameFormat)
|
$displayNameFormat?
|
||||||
$displayName = getFData(
|
getFData(
|
||||||
$displayNameFormat,
|
$displayNameFormat,
|
||||||
array_merge(
|
array_merge(
|
||||||
array('value' => $value, 'dn' => $object['dn']),
|
array('value' => $value, 'dn' => $object['dn']),
|
||||||
$object['attrs']
|
$object['attrs']
|
||||||
)
|
)
|
||||||
);
|
):$value
|
||||||
else
|
);
|
||||||
$displayName = $value;
|
}
|
||||||
$ret[$value] = $displayName;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,6 +166,7 @@ class LSformRule extends LSlog_staticLoggerClass {
|
||||||
$rule_name = null;
|
$rule_name = null;
|
||||||
$rule_class = null;
|
$rule_class = null;
|
||||||
$rule_name_arg_num = null;
|
$rule_name_arg_num = null;
|
||||||
|
$rule_name_quote_char = null;
|
||||||
$params = array();
|
$params = array();
|
||||||
for ($i=0; $i < count($command_args); $i++) {
|
for ($i=0; $i < count($command_args); $i++) {
|
||||||
switch ($command_args[$i]) {
|
switch ($command_args[$i]) {
|
||||||
|
|
|
@ -20,14 +20,6 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
use ZxcvbnPhp\Zxcvbn;
|
|
||||||
LSsession :: includeFile(
|
|
||||||
LSconfig :: get(
|
|
||||||
'params.zxcvbn_autoload_path', 'Zxcvbn/autoload.php',
|
|
||||||
'string', $options
|
|
||||||
), true
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rule to validate password using ZXCVBN-PHP lib
|
* Rule to validate password using ZXCVBN-PHP lib
|
||||||
*
|
*
|
||||||
|
@ -55,7 +47,13 @@ class LSformRule_zxcvbn extends LSformRule {
|
||||||
* @return boolean True if value is valid, False otherwise
|
* @return boolean True if value is valid, False otherwise
|
||||||
*/
|
*/
|
||||||
public static function validate($value, $options, &$formElement) {
|
public static function validate($value, $options, &$formElement) {
|
||||||
$zxcvbn = new Zxcvbn();
|
LSsession :: includeFile(
|
||||||
|
LSconfig :: get(
|
||||||
|
'params.zxcvbn_autoload_path', 'Zxcvbn/autoload.php',
|
||||||
|
'string', $options
|
||||||
|
), true
|
||||||
|
);
|
||||||
|
$zxcvbn = new ZxcvbnPhp\Zxcvbn();
|
||||||
$userData = array();
|
$userData = array();
|
||||||
$userDataAttrs = LSconfig :: get('params.userDataAttrs', array(), 'array', $options);
|
$userDataAttrs = LSconfig :: get('params.userDataAttrs', array(), 'array', $options);
|
||||||
if ($userDataAttrs) {
|
if ($userDataAttrs) {
|
||||||
|
|
|
@ -470,7 +470,7 @@ function _cli_parse_php_file($file) {
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif (!empty($quote)) {
|
elseif ($quote) {
|
||||||
// Quote char already detected : try to detect end quote char
|
// Quote char already detected : try to detect end quote char
|
||||||
if ($line[$i]=='\\') {
|
if ($line[$i]=='\\') {
|
||||||
// Escape char detected : pass this char and the following one
|
// Escape char detected : pass this char and the following one
|
||||||
|
@ -644,7 +644,7 @@ function cli_generate_lang_file($command_args) {
|
||||||
$only = strtolower($command_args[$i]);
|
$only = strtolower($command_args[$i]);
|
||||||
if (!in_array($only, $available_onlys))
|
if (!in_array($only, $available_onlys))
|
||||||
LScli :: usage("Invalid -O/--only parameter. Must be one of the following values : '".implode("','", $available_onlys)."'.");
|
LScli :: usage("Invalid -O/--only parameter. Must be one of the following values : '".implode("','", $available_onlys)."'.");
|
||||||
elseif ($without)
|
elseif ($withouts)
|
||||||
LScli :: usage("You could not use only -O/--only parameter combined with -W/--without parameter.");
|
LScli :: usage("You could not use only -O/--only parameter combined with -W/--without parameter.");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -914,6 +914,7 @@ function cli_generate_lang_file($command_args) {
|
||||||
if ($output) {
|
if ($output) {
|
||||||
$output = _cli_relative2absolute_path($output);
|
$output = _cli_relative2absolute_path($output);
|
||||||
$LSlang_cli_logger -> info("Write result in output file ($output)");
|
$LSlang_cli_logger -> info("Write result in output file ($output)");
|
||||||
|
$fd = null;
|
||||||
try {
|
try {
|
||||||
$LSlang_cli_logger -> debug("Open output file ($output)");
|
$LSlang_cli_logger -> debug("Open output file ($output)");
|
||||||
$fd = fopen($output, 'w');
|
$fd = fopen($output, 'w');
|
||||||
|
|
|
@ -459,7 +459,7 @@ class LSldap extends LSlog_staticLoggerClass {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!is_empty($val)) {
|
if (!is_empty($attrVal)) {
|
||||||
$drop = false;
|
$drop = false;
|
||||||
$changed_attrs[$attrName][]=$attrVal;
|
$changed_attrs[$attrName][]=$attrVal;
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,7 +158,7 @@ class LSldapObject extends LSlog_staticLoggerClass {
|
||||||
public function getDisplayName($spe=null, $full=false) {
|
public function getDisplayName($spe=null, $full=false) {
|
||||||
if (is_null($spe))
|
if (is_null($spe))
|
||||||
$spe = $this -> getDisplayNameFormat();
|
$spe = $this -> getDisplayNameFormat();
|
||||||
$val = $this -> getFData($spe, $this -> attrs, 'getDisplayValue');
|
$val = $this -> getDisplayFData($spe);
|
||||||
if (LSsession :: haveSubDn() && $full) {
|
if (LSsession :: haveSubDn() && $full) {
|
||||||
$val.=' ('.$this -> subDnName.')';
|
$val.=' ('.$this -> subDnName.')';
|
||||||
}
|
}
|
||||||
|
@ -216,11 +216,13 @@ class LSldapObject extends LSlog_staticLoggerClass {
|
||||||
$LSform = new LSform($this, $idForm, null, $api_mode);
|
$LSform = new LSform($this, $idForm, null, $api_mode);
|
||||||
$this -> forms[$idForm] = array($LSform, $load);
|
$this -> forms[$idForm] = array($LSform, $load);
|
||||||
|
|
||||||
|
$loadObject = null;
|
||||||
if ($load) {
|
if ($load) {
|
||||||
$type = $this -> getType();
|
$type = $this -> getType();
|
||||||
$loadObject = new $type();
|
$loadObject = new $type();
|
||||||
if (!$loadObject -> loadData($load)) {
|
if (!$loadObject -> loadData($load)) {
|
||||||
$load=false;
|
$load = false;
|
||||||
|
$loadObject = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -761,18 +763,19 @@ class LSldapObject extends LSlog_staticLoggerClass {
|
||||||
* - [1] : les paramètres suivants
|
* - [1] : les paramètres suivants
|
||||||
*/
|
*/
|
||||||
public static function getDnInfos($dn) {
|
public static function getDnInfos($dn) {
|
||||||
$infos=ldap_explode_dn($dn,0);
|
$infos = ldap_explode_dn($dn, 0);
|
||||||
if(!$infos)
|
if(!$infos)
|
||||||
return;
|
return;
|
||||||
$first=true;
|
$first = true;
|
||||||
for($i=1;$i<$infos['count'];$i++)
|
$basedn = "";
|
||||||
|
for($i=1; $i<$infos['count']; $i++)
|
||||||
if($first) {
|
if($first) {
|
||||||
$basedn.=$infos[$i];
|
$basedn .= $infos[$i];
|
||||||
$first=false;
|
$first = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$basedn.=','.$infos[$i];
|
$basedn .= ','.$infos[$i];
|
||||||
return array($infos[0],$basedn);
|
return array($infos[0], $basedn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2449,7 +2452,7 @@ class LSldapObject extends LSlog_staticLoggerClass {
|
||||||
* @retval boolean True on success, false otherwise
|
* @retval boolean True on success, false otherwise
|
||||||
**/
|
**/
|
||||||
public static function cli_create($command_args) {
|
public static function cli_create($command_args) {
|
||||||
$objType = null;
|
$objType = $obj = null;
|
||||||
$delimiter = "|";
|
$delimiter = "|";
|
||||||
$confirm = true;
|
$confirm = true;
|
||||||
$just_try = false;
|
$just_try = false;
|
||||||
|
@ -2484,6 +2487,7 @@ class LSldapObject extends LSlog_staticLoggerClass {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @phpstan-ignore-next-line
|
||||||
if (is_null($objType) || empty($attrs_values))
|
if (is_null($objType) || empty($attrs_values))
|
||||||
LScli :: usage('You must provide LSobject type, DN and at least one change.');
|
LScli :: usage('You must provide LSobject type, DN and at least one change.');
|
||||||
|
|
||||||
|
@ -2612,7 +2616,7 @@ class LSldapObject extends LSlog_staticLoggerClass {
|
||||||
* @retval boolean True on success, false otherwise
|
* @retval boolean True on success, false otherwise
|
||||||
**/
|
**/
|
||||||
public static function cli_modify($command_args) {
|
public static function cli_modify($command_args) {
|
||||||
$objType = null;
|
$objType = $obj = null;
|
||||||
$dn = null;
|
$dn = null;
|
||||||
$delimiter = "|";
|
$delimiter = "|";
|
||||||
$confirm = true;
|
$confirm = true;
|
||||||
|
@ -2651,6 +2655,7 @@ class LSldapObject extends LSlog_staticLoggerClass {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @phpstan-ignore-next-line
|
||||||
if (is_null($objType) || is_null($dn) || empty($changes))
|
if (is_null($objType) || is_null($dn) || empty($changes))
|
||||||
LScli :: usage('You must provide LSobject type, DN and at least one change.');
|
LScli :: usage('You must provide LSobject type, DN and at least one change.');
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ class LSlog_console extends LSlog_handler {
|
||||||
$this -> stdout = fopen('php://stdout', 'w');
|
$this -> stdout = fopen('php://stdout', 'w');
|
||||||
$this -> stderr = fopen('php://stderr', 'w');
|
$this -> stderr = fopen('php://stderr', 'w');
|
||||||
if ($this -> enabled)
|
if ($this -> enabled)
|
||||||
self :: log_trace("$this Enabled", get_class($this));
|
self :: log_trace("$this Enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -44,7 +44,7 @@ class LSlog_email extends LSlog_handler {
|
||||||
parent :: __construct($config);
|
parent :: __construct($config);
|
||||||
$this -> recipient = self :: getConfig('recipient');
|
$this -> recipient = self :: getConfig('recipient');
|
||||||
if ($this -> enabled)
|
if ($this -> enabled)
|
||||||
self :: log_trace("$this Enabled", get_class($this));
|
self :: log_trace("$this Enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -44,7 +44,7 @@ class LSlog_file extends LSlog_handler {
|
||||||
if (substr($this -> path, 0, 1) != '/')
|
if (substr($this -> path, 0, 1) != '/')
|
||||||
$this -> path = LS_ROOT_DIR."/".$this -> path;
|
$this -> path = LS_ROOT_DIR."/".$this -> path;
|
||||||
if ($this -> enabled)
|
if ($this -> enabled)
|
||||||
self :: log_trace("$this Enabled", get_class($this));
|
self :: log_trace("$this Enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -60,7 +60,7 @@ class LSlog_syslog extends LSlog_handler {
|
||||||
parent :: __construct($config);
|
parent :: __construct($config);
|
||||||
$this -> priority = static :: getConfig('priority');
|
$this -> priority = static :: getConfig('priority');
|
||||||
if ($this -> enabled)
|
if ($this -> enabled)
|
||||||
self :: log_trace("$this Enabled", get_class($this));
|
self :: log_trace("$this Enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,7 +40,7 @@ class LSlog_system extends LSlog_handler {
|
||||||
public function __construct($config) {
|
public function __construct($config) {
|
||||||
parent :: __construct($config);
|
parent :: __construct($config);
|
||||||
if ($this -> enabled)
|
if ($this -> enabled)
|
||||||
self :: log_trace("$this Enabled", get_class($this));
|
self :: log_trace("$this Enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -37,28 +37,28 @@ class LSmail {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function ajax_display(&$data) {
|
public static function ajax_display(&$data) {
|
||||||
if (isset($_REQUEST['object']['type']) && isset($_REQUEST['object']['dn'])) {
|
$msg = $_REQUEST['msg'];
|
||||||
if (LSsession ::loadLSobject($_REQUEST['object']['type'])) {
|
$subject = $_REQUEST['subject'];
|
||||||
$obj = new $_REQUEST['object']['type']();
|
if (
|
||||||
$obj -> loadData($_REQUEST['object']['dn']);
|
isset($_REQUEST['object']['type'])
|
||||||
$msg = $obj -> getFData($_REQUEST['msg']);
|
&& isset($_REQUEST['object']['dn'])
|
||||||
$subject = $obj -> getFData($_REQUEST['subject']);
|
&& LSsession ::loadLSobject($_REQUEST['object']['type'])
|
||||||
}
|
) {
|
||||||
}
|
$obj = new $_REQUEST['object']['type']();
|
||||||
else {
|
$obj -> loadData($_REQUEST['object']['dn']);
|
||||||
$msg = $_REQUEST['msg'];
|
$msg = $obj -> getFData($msg);
|
||||||
$subject = $_REQUEST['subject'];
|
$subject = $obj -> getFData($subject);
|
||||||
}
|
}
|
||||||
|
|
||||||
LStemplate :: assign('LSmail_msg',$msg);
|
LStemplate :: assign('LSmail_msg', $msg);
|
||||||
LStemplate :: assign('LSmail_subject',$subject);
|
LStemplate :: assign('LSmail_subject', $subject);
|
||||||
LStemplate :: assign('LSmail_options',$_REQUEST['options']);
|
LStemplate :: assign('LSmail_options', $_REQUEST['options']);
|
||||||
|
|
||||||
if (is_array($_REQUEST['mails'])) {
|
if (is_array($_REQUEST['mails'])) {
|
||||||
LStemplate :: assign('LSmail_mails',$_REQUEST['mails']);
|
LStemplate :: assign('LSmail_mails', $_REQUEST['mails']);
|
||||||
}
|
}
|
||||||
else if(empty($_REQUEST['mails'])) {
|
else if(empty($_REQUEST['mails'])) {
|
||||||
LStemplate :: assign('LSmail_mails',array($_REQUEST['mails']));
|
LStemplate :: assign('LSmail_mails', array($_REQUEST['mails']));
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
|
|
|
@ -719,7 +719,7 @@ class LSsearch extends LSlog_staticLoggerClass {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!empty($filters)) {
|
if($filters) {
|
||||||
$filter=LSldap::combineFilters('or',$filters);
|
$filter=LSldap::combineFilters('or',$filters);
|
||||||
if ($filter) {
|
if ($filter) {
|
||||||
return $filter;
|
return $filter;
|
||||||
|
|
|
@ -42,16 +42,19 @@ class LSsearchEntry extends LSlog_staticLoggerClass {
|
||||||
private $params = array();
|
private $params = array();
|
||||||
|
|
||||||
// The attributes list
|
// The attributes list
|
||||||
private $attrs_list=array();
|
private $attrs_list = array();
|
||||||
|
|
||||||
// The attributes values
|
// The attributes values
|
||||||
private $attrs=array();
|
private $attrs = array();
|
||||||
|
|
||||||
|
// The index of the entry in the result of the search
|
||||||
|
private $id = null;
|
||||||
|
|
||||||
// Cache
|
// Cache
|
||||||
private $cache=array();
|
private $cache = array();
|
||||||
|
|
||||||
// Other values
|
// Other values
|
||||||
private $other_values=array();
|
private $other_values = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
|
|
@ -373,7 +373,7 @@ class LSsession {
|
||||||
'libs_dir' => LS_ROOT_DIR. '/'. LS_LIB_DIR,
|
'libs_dir' => LS_ROOT_DIR. '/'. LS_LIB_DIR,
|
||||||
'compile_dir' => LS_TMP_DIR_PATH,
|
'compile_dir' => LS_TMP_DIR_PATH,
|
||||||
'debug' => LSdebug,
|
'debug' => LSdebug,
|
||||||
'debug_smarty' => (isset($_REQUEST) && isset($_REQUEST['LStemplate_debug'])),
|
'debug_smarty' => isset($_REQUEST['LStemplate_debug']),
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
return False;
|
return False;
|
||||||
|
@ -865,7 +865,7 @@ class LSsession {
|
||||||
if (self :: $ldapServerId) {
|
if (self :: $ldapServerId) {
|
||||||
LStemplate :: assign('ldapServerId',self :: $ldapServerId);
|
LStemplate :: assign('ldapServerId',self :: $ldapServerId);
|
||||||
}
|
}
|
||||||
if (isset($_GET['LSsession_recoverPassword'])) {
|
if (isset($recoveryPasswordInfos)) {
|
||||||
self :: displayRecoverPasswordForm($recoveryPasswordInfos);
|
self :: displayRecoverPasswordForm($recoveryPasswordInfos);
|
||||||
}
|
}
|
||||||
elseif(LSauth :: displayLoginForm()) {
|
elseif(LSauth :: displayLoginForm()) {
|
||||||
|
@ -1838,7 +1838,7 @@ class LSsession {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LSerror :: errorsDefined()) {
|
if (LSerror :: errorsDefined()) {
|
||||||
$data['errors'] = LSerror :: getErrors(self :: $api_mode);
|
$data['errors'] = LSerror :: getErrors();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self :: $api_mode && LSdebugDefined()) {
|
if (!self :: $api_mode && LSdebugDefined()) {
|
||||||
|
|
|
@ -652,18 +652,15 @@ class LStemplate extends LSlog_staticLoggerClass {
|
||||||
}
|
}
|
||||||
|
|
||||||
function LStemplate_smarty_getFData($params) {
|
function LStemplate_smarty_getFData($params) {
|
||||||
extract($params);
|
echo getFData($params['format'], $params['data'], $meth=NULL);
|
||||||
echo getFData($format,$data,$meth=NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function LStemplate_smarty_tr($params) {
|
function LStemplate_smarty_tr($params) {
|
||||||
extract($params);
|
echo __($params['msg']);
|
||||||
echo __($msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function LStemplate_smarty_img($params) {
|
function LStemplate_smarty_img($params) {
|
||||||
extract($params);
|
echo "image/".$params['name'];
|
||||||
echo "image/$name";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function LStemplate_smarty_css($params) {
|
function LStemplate_smarty_css($params) {
|
||||||
|
|
|
@ -131,7 +131,7 @@ class LSurl extends LSlog_staticLoggerClass {
|
||||||
// Reset last redirect
|
// Reset last redirect
|
||||||
if (isset($_SESSION['last_redirect']))
|
if (isset($_SESSION['last_redirect']))
|
||||||
unset($_SESSION['last_redirect']);
|
unset($_SESSION['last_redirect']);
|
||||||
self :: log_debug("URL : result :\n".varDump($request, 1));
|
self :: log_debug("URL : result :\n".varDump($request));
|
||||||
return $request;
|
return $request;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
ini_set( 'magic_quotes_gpc', 'off' );
|
ini_set( 'magic_quotes_gpc', 'off' );
|
||||||
ini_set( 'magic_quotes_sybase', 'off' );
|
ini_set( 'magic_quotes_sybase', 'off' );
|
||||||
ini_set( 'magic_quotes_runtime', 'off' );
|
ini_set( 'magic_quotes_runtime', 'off' );
|
||||||
if ((isset($_REQUEST) && isset($_REQUEST['LSdebug'])) || (isset($_SERVER['HTTP_HOST']) && preg_match('/^127\.[0-9]+\.[0-9]+\.[0-9]+$/', $_SERVER['HTTP_HOST'])))
|
if (isset($_REQUEST['LSdebug']) || (isset($_SERVER['HTTP_HOST']) && preg_match('/^127\.[0-9]+\.[0-9]+\.[0-9]+$/', $_SERVER['HTTP_HOST'])))
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
else
|
else
|
||||||
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
|
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
|
||||||
|
|
|
@ -262,6 +262,8 @@ LSurl :: add_handler('#^global_search\.php#', 'handle_old_global_search_php', fa
|
||||||
* @retval void
|
* @retval void
|
||||||
**/
|
**/
|
||||||
function handle_static_file($request) {
|
function handle_static_file($request) {
|
||||||
|
$path = null;
|
||||||
|
$mime_type = null;
|
||||||
switch ($request -> type) {
|
switch ($request -> type) {
|
||||||
case 'image':
|
case 'image':
|
||||||
$path = LStemplate :: getImagePath($request -> file);
|
$path = LStemplate :: getImagePath($request -> file);
|
||||||
|
@ -276,7 +278,7 @@ function handle_static_file($request) {
|
||||||
$mime_type = 'text/javascript';
|
$mime_type = 'text/javascript';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ($path && is_file($path)) {
|
if ($path && is_file($path)) {
|
||||||
dumpFile($path, $mime_type);
|
dumpFile($path, $mime_type);
|
||||||
}
|
}
|
||||||
LSurl :: error_404($request);
|
LSurl :: error_404($request);
|
||||||
|
|
Loading…
Reference in a new issue