From fbbe102a261432ef69b69911de98287873e0130f Mon Sep 17 00:00:00 2001 From: "florian.azizian" <florian.azizian@maarch.org> Date: Wed, 22 Apr 2020 17:44:57 +0100 Subject: [PATCH] FEAT #13679 TIME 1 camelCase in config.xml --- .../class_business_app_tools_Abstract.php | 138 ++++++++--------- apps/maarch_entreprise/xml/config.xml.default | 6 +- bin/notification/load_basket_event_stack.php | 4 +- bin/notification/load_process_email_stack.php | 2 +- bin/notification/load_process_event_stack.php | 4 +- .../load_stack_letterbox_alerts.php | 4 +- .../process_mailsFromSignatoryBook.php | 4 +- install/class/Class_Install.php | 48 ------ install/scripts/setConfig.php | 54 +++---- install/scripts/testSmtp.php | 35 ----- migration/20.10/migrateModulesConfig.php | 3 +- .../20.10/migrateNotificationsConfig.php | 6 +- .../migrateRemoteSignatureBookConfig.php | 4 +- .../class/class_modules_tools_Abstract.php | 142 ++++-------------- package.json | 6 +- .../controllers/AuthenticationController.php | 8 +- 16 files changed, 143 insertions(+), 325 deletions(-) diff --git a/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php b/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php index bcb144c0e70..9a9ee0a8bd9 100755 --- a/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php +++ b/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php @@ -64,9 +64,9 @@ abstract class business_app_tools_Abstract extends Database . 'config.xml'; } - if(file_exists($path)){ + if (file_exists($path)) { $xmlconfig = simplexml_load_file($path); - }else{ + } else { $xmlconfig = false; exit('<i style="color:red;">Fichier de configuration manquant ...</i><br/><br/>Si un custom est utilisé assurez-vous que l\'url soit correct'); } @@ -78,7 +78,9 @@ abstract class business_app_tools_Abstract extends Database $url = $_SESSION['config']['coreurl'] .substr($_SERVER['SCRIPT_NAME'], $uriBeginning); $_SESSION['config']['businessappurl'] = str_replace( - 'index.php', '', $url + 'index.php', + '', + $url ); $_SESSION['config']['databaseserver'] = @@ -107,7 +109,7 @@ abstract class business_app_tools_Abstract extends Database $_SESSION['config']['debug'] = (string) $config->debug; $_SESSION['config']['applicationname'] = (string) $config->applicationname; $_SESSION['config']['defaultPage'] = (string) $config->defaultPage; - $_SESSION['config']['cookietime'] = (string) $config->CookieTime; + $_SESSION['config']['cookietime'] = (string) $config->cookieTime; $_SESSION['config']['userdefaultpassword'] = (string) $config->userdefaultpassword; $_SESSION['config']['usePHPIDS'] = (string) $config->usePHPIDS; if (isset($config->showfooter)) { @@ -128,12 +130,12 @@ abstract class business_app_tools_Abstract extends Database $i = 0; - if ( isset($_SESSION['custom_override_id']) && file_exists( + if (isset($_SESSION['custom_override_id']) && file_exists( 'custom/' . $_SESSION['custom_override_id'] . '/' . $_SESSION['config']['lang'] . '.php' ) ) { - include_once 'custom/' . $_SESSION['custom_override_id'] . '/' + include_once 'custom/' . $_SESSION['custom_override_id'] . '/' . $_SESSION['config']['lang'] . '.php'; } include_once 'apps' . DIRECTORY_SEPARATOR @@ -144,7 +146,7 @@ abstract class business_app_tools_Abstract extends Database $_SESSION['coll_categories'] = array(); foreach ($xmlconfig->COLLECTION as $col) { $tmp = (string) $col->label; - if (!empty($tmp) && defined($tmp) && constant($tmp) <> NULL) { + if (!empty($tmp) && defined($tmp) && constant($tmp) <> null) { $tmp = constant($tmp); } $collId = (string) $col->id; @@ -239,7 +241,7 @@ abstract class business_app_tools_Abstract extends Database $_SESSION['history_keywords'] = array(); foreach ($xmlconfig->KEYWORDS as $keyword) { $tmp = (string) $keyword->label; - if (!empty($tmp) && defined($tmp) && constant($tmp) <> NULL) { + if (!empty($tmp) && defined($tmp) && constant($tmp) <> null) { $tmp = constant($tmp); } @@ -254,7 +256,6 @@ abstract class business_app_tools_Abstract extends Database $i = 0; foreach ($xmlconfig->MODULES as $modules) { - $_SESSION['modules'][$i] = array( 'moduleid' => (string) $modules->moduleid, //,"comment" => (string) $MODULES->comment @@ -305,7 +306,7 @@ abstract class business_app_tools_Abstract extends Database foreach ($xmlfile->ACTIONPAGE as $actionPage) { $label = (string) $actionPage->LABEL; if (!empty($label) && defined($label) - && constant($label) <> NULL + && constant($label) <> null ) { $label = constant($label); } @@ -336,7 +337,6 @@ abstract class business_app_tools_Abstract extends Database //LOAD actions in other modules foreach ($_SESSION['modules'] as $key => $value) { - if (file_exists( $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] . 'modules' . DIRECTORY_SEPARATOR . $value['moduleid'] @@ -348,7 +348,6 @@ abstract class business_app_tools_Abstract extends Database . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $value['moduleid'] . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'actions_pages.xml'; - } else { $path = 'modules' . DIRECTORY_SEPARATOR . $value['moduleid'] . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'actions_pages.xml'; @@ -366,32 +365,32 @@ abstract class business_app_tools_Abstract extends Database ) ) { - $xmlfile = simplexml_load_file($path); + $xmlfile = simplexml_load_file($path); - $langPath = 'modules' . DIRECTORY_SEPARATOR . $value['moduleid'] . DIRECTORY_SEPARATOR + $langPath = 'modules' . DIRECTORY_SEPARATOR . $value['moduleid'] . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR. $_SESSION['config']['lang'] . '.php'; - include_once($langPath); - foreach ($xmlfile->ACTIONPAGE as $actionPage) { - $label = (string) $actionPage->LABEL; - if (!empty($label) && defined($label) - && constant($label) <> NULL + include_once($langPath); + foreach ($xmlfile->ACTIONPAGE as $actionPage) { + $label = (string) $actionPage->LABEL; + if (!empty($label) && defined($label) + && constant($label) <> null ) { - $label = constant($label); - } - $keyword = ''; - if (isset($actionPage->KEYWORD) + $label = constant($label); + } + $keyword = ''; + if (isset($actionPage->KEYWORD) && ! empty($actionPage->KEYWORD) ) { - $keyword = (string) $actionPage->KEYWORD; - } - $createFlag = 'N'; - if (isset($actionPage->FLAG_CREATE) + $keyword = (string) $actionPage->KEYWORD; + } + $createFlag = 'N'; + if (isset($actionPage->FLAG_CREATE) && (string) $actionPage->FLAG_CREATE == 'true' ) { - $createFlag = 'Y'; - } - $_SESSION['actions_pages'][$i] = array( + $createFlag = 'Y'; + } + $_SESSION['actions_pages'][$i] = array( 'ID' => (string) $actionPage->ID, 'LABEL' => $label, 'NAME' => (string) $actionPage->NAME, @@ -400,11 +399,10 @@ abstract class business_app_tools_Abstract extends Database 'KEYWORD' => $keyword, 'FLAG_CREATE' => $createFlag ); - $i++; + $i++; + } } } - - } } public static function _loadEntrepriseVar() @@ -441,7 +439,7 @@ abstract class business_app_tools_Abstract extends Database $_SESSION['attachment_types_reconciliation'] = array(); //NCH01 $attachmentTypes = $xmlfile->attachment_types; if (count($attachmentTypes) > 0) { - foreach ($attachmentTypes->type as $type ) { + foreach ($attachmentTypes->type as $type) { $label = (string) $type->label; $with_chrono = (string) $type['with_chrono']; $get_chrono = (string) $type['get_chrono']; @@ -451,7 +449,7 @@ abstract class business_app_tools_Abstract extends Database $select_in_reconciliation = (string) $type['select_in_reconciliation']; //NCH01 $process = (string) $type->process_mode; if (!empty($label) && defined($label) - && constant($label) <> NULL + && constant($label) <> null ) { $label = constant($label); } @@ -503,10 +501,10 @@ abstract class business_app_tools_Abstract extends Database $mailTitles = $xmlfile->titles; if (count($mailTitles) > 0) { $i = 0; - foreach ($mailTitles->title as $title ) { + foreach ($mailTitles->title as $title) { $label = (string) $title->label; if (!empty($label) && defined($label) - && constant($label) <> NULL + && constant($label) <> null ) { $label = constant($label); } @@ -514,7 +512,6 @@ abstract class business_app_tools_Abstract extends Database } $_SESSION['default_mail_title'] = (string) $mailTitles->default_title; } - } public function compare_base_version($xmlVersionBase) @@ -541,7 +538,7 @@ abstract class business_app_tools_Abstract extends Database $_SESSION['maarch_entreprise']['database_version'] = $vbg->param_value_string; } //If this two parameters is not find, this is the end of this function - if ($_SESSION['maarch_entreprise']['xml_versionbase'] <> 'none' ) { + if ($_SESSION['maarch_entreprise']['xml_versionbase'] <> 'none') { if (($_SESSION['maarch_entreprise']['xml_versionbase'] <> $_SESSION['maarch_entreprise']['database_version']) || ($_SESSION['maarch_entreprise']['database_version'] == 'none') ) { @@ -584,12 +581,12 @@ abstract class business_app_tools_Abstract extends Database $_SESSION['features']['watermark']['text_color'] = (string) $watermark->text_color; $_SESSION['features']['type_calendar'] = (string) $feats->type_calendar; $send_to_contact_with_mandatory_attachment = (string) $feats->send_to_contact_with_mandatory_attachment; - if(strtoupper($send_to_contact_with_mandatory_attachment) == 'TRUE'){ - $_SESSION['features']['send_to_contact_with_mandatory_attachment'] = TRUE; - }elseif(strtoupper($send_to_contact_with_mandatory_attachment) == 'FALSE'){ - $_SESSION['features']['send_to_contact_with_mandatory_attachment'] = FALSE; + if (strtoupper($send_to_contact_with_mandatory_attachment) == 'TRUE') { + $_SESSION['features']['send_to_contact_with_mandatory_attachment'] = true; + } elseif (strtoupper($send_to_contact_with_mandatory_attachment) == 'FALSE') { + $_SESSION['features']['send_to_contact_with_mandatory_attachment'] = false; } - if(!empty($feats->notes_in_print_page->label)){ + if (!empty($feats->notes_in_print_page->label)) { foreach ($feats->notes_in_print_page->label as $value) { $_SESSION['features']['notes_in_print_page'][] = (string) $value; } @@ -612,8 +609,8 @@ abstract class business_app_tools_Abstract extends Database $this->_loadListsConfig(); } - protected function _loadListsConfig() { - + protected function _loadListsConfig() + { if (file_exists( $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'apps' @@ -637,16 +634,14 @@ abstract class business_app_tools_Abstract extends Database //Load filters $_SESSION['filters'] = array(); foreach ($xmlfile->FILTERS as $filtersObject) { - foreach ($filtersObject as $filter) { - $desc = (string) $filter->LABEL; - if (!empty($desc) && defined($desc) && constant($desc) <> NULL) { + if (!empty($desc) && defined($desc) && constant($desc) <> null) { $desc = constant($desc); } $id = (string) $filter->ID; $enabled = (string) $filter->ENABLED; - if( trim($enabled) == 'true') { + if (trim($enabled) == 'true') { $_SESSION['filters'][$id] = array( 'ID' => $id, 'LABEL' => $desc, @@ -673,11 +668,9 @@ abstract class business_app_tools_Abstract extends Database //Load templates foreach ($xmlfile->TEMPLATES as $templatesObject) { - foreach ($templatesObject as $template) { - $desc = (string) $template->LABEL; - if (!empty($desc) && defined($desc) && constant($desc) <> NULL) { + if (!empty($desc) && defined($desc) && constant($desc) <> null) { $desc = constant($desc); } $id = (string) $template->ID; @@ -698,24 +691,24 @@ abstract class business_app_tools_Abstract extends Database // The page is in the apps if (strtoupper($listOrigin) == 'APPS' ) { - if( file_exists( - $_SESSION['config']['corepath'].'custom' . DIRECTORY_SEPARATOR - . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'apps' - . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id'] + if (file_exists( + $_SESSION['config']['corepath'].'custom' . DIRECTORY_SEPARATOR + . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'apps' + . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR . $listName . '.php' ) || - file_exists('apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id'] + file_exists( + 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR . $listName.'.php' ) - ) - { + ) { $pathToList = $_SESSION['config']['businessappurl'] . 'index.php?display=true&page='. $listName; } - } else if (strtoupper( + } elseif (strtoupper( $listOrigin ) == "MODULE" - ) { + ) { // The page is in a module $core = new core_tools(); // Error : The module name is empty or the module is not loaded @@ -732,7 +725,8 @@ abstract class business_app_tools_Abstract extends Database . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $listModule . DIRECTORY_SEPARATOR . $listName . '.php' ) || - file_exists('modules' . DIRECTORY_SEPARATOR . $listModule + file_exists( + 'modules' . DIRECTORY_SEPARATOR . $listModule . DIRECTORY_SEPARATOR . $listName . '.php' ) ) { @@ -747,15 +741,15 @@ abstract class business_app_tools_Abstract extends Database //Path to template if ($origin == "apps") { //Origin apps - if(file_exists( - $_SESSION['config']['corepath'].'custom' . DIRECTORY_SEPARATOR - . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'apps' - . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id'] - . DIRECTORY_SEPARATOR . "template" . DIRECTORY_SEPARATOR + if (file_exists( + $_SESSION['config']['corepath'].'custom' . DIRECTORY_SEPARATOR + . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'apps' + . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id'] + . DIRECTORY_SEPARATOR . "template" . DIRECTORY_SEPARATOR . $name . '.html' ) ) { - $path = $_SESSION['config']['corepath'] . 'custom' + $path = $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR @@ -764,7 +758,7 @@ abstract class business_app_tools_Abstract extends Database $path = 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR . "template" . DIRECTORY_SEPARATOR . $name.'.html'; } - } else if ($origin == "module") { //Origin module + } elseif ($origin == "module") { //Origin module if (file_exists( $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'modules' @@ -785,7 +779,7 @@ abstract class business_app_tools_Abstract extends Database } //Values of html_templates array - if( trim($enabled) == 'true') { + if (trim($enabled) == 'true') { $_SESSION['html_templates'][$id] = array( 'ID' => $id, 'LABEL' => $desc, @@ -834,7 +828,7 @@ abstract class business_app_tools_Abstract extends Database $_SESSION['PHPIDS_EXCLUDES'] = array(); foreach ($xmlfile->exclude as $exclude) { array_push( - $_SESSION['PHPIDS_EXCLUDES'], + $_SESSION['PHPIDS_EXCLUDES'], array( 'TARGET' => (string) $exclude->target, 'PAGE' => (string) $exclude->page, diff --git a/apps/maarch_entreprise/xml/config.xml.default b/apps/maarch_entreprise/xml/config.xml.default index c6fe1b231c0..ce3edc29b48 100755 --- a/apps/maarch_entreprise/xml/config.xml.default +++ b/apps/maarch_entreprise/xml/config.xml.default @@ -16,13 +16,13 @@ <debug>false</debug> <applicationname>MAARCH COURRIER 20.1X</applicationname> <defaultPage>welcome</defaultPage> - <CookieTime>20</CookieTime> <!-- minutes --> + <cookieTime>20</cookieTime> <!-- minutes --> <timezone>Europe/Paris</timezone> <userdefaultpassword>maarch</userdefaultpassword> <!-- default user's password --> <usePHPIDS>true</usePHPIDS> - <MaarchDirectory>/var/www/html/MaarchCourrier/</MaarchDirectory> + <maarchDirectory>/var/www/html/MaarchCourrier/</maarchDirectory> <customID></customID> - <MaarchUrl>http://preview.maarchcourrier.com/</MaarchUrl> + <maarchUrl>http://preview.maarchcourrier.com/</maarchUrl> </CONFIG> <SIGNATUREBOOK> <validatedStatus>EENV</validatedStatus> diff --git a/bin/notification/load_basket_event_stack.php b/bin/notification/load_basket_event_stack.php index 61578c4dfd8..9edd8dbf634 100644 --- a/bin/notification/load_basket_event_stack.php +++ b/bin/notification/load_basket_event_stack.php @@ -86,7 +86,7 @@ if ($xmlconfig == false) { // Load config $config = $xmlconfig->CONFIG; -$maarchDirectory = (string)$config->MaarchDirectory; +$maarchDirectory = (string)$config->maarchDirectory; $customID = (string)$config->customID; $customIDPath = ''; @@ -94,7 +94,7 @@ if ($customID <> '') { $customIDPath = $customID . '_'; } chdir($maarchDirectory); -$maarchUrl = (string)$config->MaarchUrl; +$maarchUrl = (string)$config->maarchUrl; $GLOBALS['customId'] = $customID; $GLOBALS['batchDirectory'] = $maarchDirectory . 'bin' diff --git a/bin/notification/load_process_email_stack.php b/bin/notification/load_process_email_stack.php index b0623f81198..f8bd2e95d60 100644 --- a/bin/notification/load_process_email_stack.php +++ b/bin/notification/load_process_email_stack.php @@ -78,7 +78,7 @@ if ($xmlconfig == false) { // Load config $config = $xmlconfig->CONFIG; -$GLOBALS['maarchDirectory'] = (string)$config->MaarchDirectory; +$GLOBALS['maarchDirectory'] = (string)$config->maarchDirectory; $customID = (string)$config->customID; $customIDPath = ''; diff --git a/bin/notification/load_process_event_stack.php b/bin/notification/load_process_event_stack.php index 57f57dc34e9..46f460cb2b4 100644 --- a/bin/notification/load_process_event_stack.php +++ b/bin/notification/load_process_event_stack.php @@ -86,7 +86,7 @@ if ($xmlconfig == false) { // Load config $config = $xmlconfig->CONFIG; -$maarchDirectory = (string)$config->MaarchDirectory; +$maarchDirectory = (string)$config->maarchDirectory; $customID = (string)$config->customID; $customIDPath = ''; @@ -94,7 +94,7 @@ if ($customID <> '') { $customIDPath = $customID . '_'; } chdir($maarchDirectory); -$maarchUrl = (string)$config->MaarchUrl; +$maarchUrl = (string)$config->maarchUrl; $GLOBALS['customId'] = $customID; $GLOBALS['batchDirectory'] = $maarchDirectory . 'bin' diff --git a/bin/notification/load_stack_letterbox_alerts.php b/bin/notification/load_stack_letterbox_alerts.php index c454c351e5c..c82da2cb4f6 100644 --- a/bin/notification/load_stack_letterbox_alerts.php +++ b/bin/notification/load_stack_letterbox_alerts.php @@ -79,7 +79,7 @@ if ($xmlconfig == false) { // Load config $config = $xmlconfig->CONFIG; -$maarchDirectory = (string)$config->MaarchDirectory; +$maarchDirectory = (string)$config->maarchDirectory; $customID = (string)$config->customID; $customIDPath = ''; @@ -89,7 +89,7 @@ if ($customID <> '') { chdir($maarchDirectory); -$maarchUrl = (string)$config->MaarchUrl; +$maarchUrl = (string)$config->maarchUrl; $GLOBALS['customId'] = $customID; $GLOBALS['batchDirectory'] = $maarchDirectory . 'bin' diff --git a/bin/signatureBook/process_mailsFromSignatoryBook.php b/bin/signatureBook/process_mailsFromSignatoryBook.php index b798f7f43e9..267bb596862 100755 --- a/bin/signatureBook/process_mailsFromSignatoryBook.php +++ b/bin/signatureBook/process_mailsFromSignatoryBook.php @@ -72,9 +72,9 @@ if ($xmlconfig == false) { // Load config $config = $xmlconfig->CONFIG; -$GLOBALS['MaarchDirectory'] = (string)$config->MaarchDirectory; +$GLOBALS['MaarchDirectory'] = (string)$config->maarchDirectory; $GLOBALS['customId'] = (string)$config->customID; -$GLOBALS['applicationUrl'] = (string)$config->MaarchUrl; +$GLOBALS['applicationUrl'] = (string)$config->maarchUrl; $config = $xmlconfig->SIGNATUREBOOK; $GLOBALS['userWS'] = (string)$config->userWS; diff --git a/install/class/Class_Install.php b/install/class/Class_Install.php index 2d2a79273eb..0e31fe966fe 100755 --- a/install/class/Class_Install.php +++ b/install/class/Class_Install.php @@ -550,11 +550,6 @@ class Install extends functions exit; } - if (!$this->setConfig_batch_XmlNotifications()) { - return false; - exit; - } - if (!$this->setLog4php()) { return false; exit; @@ -642,11 +637,6 @@ class Install extends functions exit; } - if (!$this->setConfig_batch_XmlNotifications()) { - return false; - exit; - } - if (!$this->setLog4php()) { return false; exit; @@ -764,44 +754,6 @@ class Install extends functions return true; } - - private function setConfig_batch_XmlNotifications() - { - $xmlconfig = simplexml_load_file('bin/notification/config/config.xml.default'); - - $CONFIG = $xmlconfig->CONFIG; - - $chemin_core = realpath('.').'/core/'; - - $CONFIG = $xmlconfig->CONFIG; - $CONFIG->MaarchDirectory = realpath('.').'/'; - - if ($_SERVER['SERVER_ADDR'] == '::1') { - $SERVER_ADDR = 'localhost'; - } else { - $SERVER_ADDR = $_SERVER['SERVER_ADDR']; - } - $chemin = $SERVER_ADDR.dirname($_SERVER['PHP_SELF'].'cs_'.$_SESSION['config']['databasename']); - $maarchUrl = rtrim($chemin, 'install'); - $maarchUrl = $maarchUrl.'cs_'.$_SESSION['config']['databasename'].'/'; - $CONFIG->MaarchUrl = $maarchUrl; - $CONFIG->customID = 'cs_'.$_SESSION['config']['databasename']; - - $res = $xmlconfig->asXML(); - $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/bin/notification/config/config.xml', 'w+'); - if (!$fp) { - return false; - exit; - } - $write = fwrite($fp, $res); - if (!$write) { - return false; - exit; - } - - return true; - } - private function setConfig_LDAP() { $xmlconfig = simplexml_load_file('modules/ldap/xml/config.xml.default'); diff --git a/install/scripts/setConfig.php b/install/scripts/setConfig.php index a9bfb4d99c3..dac30132dfb 100755 --- a/install/scripts/setConfig.php +++ b/install/scripts/setConfig.php @@ -1,51 +1,45 @@ <?php function setConfigXmlofApps($applicationname) - { +{ $xmlconfig = simplexml_load_file(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/apps/maarch_entreprise/xml/config.xml'); $CONFIG = $xmlconfig->CONFIG; $CONFIG->applicationname = $applicationname; $res = $xmlconfig->asXML(); - $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/apps/maarch_entreprise/xml/config.xml', "w+"); - if (!$fp) { - return false; - exit; - } - $write = fwrite($fp,$res); - if (!$write) { - return false; - exit; - } - + $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/apps/maarch_entreprise/xml/config.xml', "w+"); + if (!$fp) { + return false; + exit; } + $write = fwrite($fp, $res); + if (!$write) { + return false; + exit; + } +} if (empty($_REQUEST['applicationname'])) { + $return2['status'] = 2; + $return2['text'] = _SET_CONFIG_KO; - $return2['status'] = 2; - $return2['text'] = _SET_CONFIG_KO; + $jsonReturn = json_encode($return2); - $jsonReturn = json_encode($return2); + echo $jsonReturn; + exit; - echo $jsonReturn; - exit; - - //echo("<p>" . $mail->getMessage() . "</p>"); +//echo("<p>" . $mail->getMessage() . "</p>"); } else { - - require_once 'install/class/Class_Install.php'; + require_once 'install/class/Class_Install.php'; -setConfigXmlofApps($_REQUEST['applicationname']); + setConfigXmlofApps($_REQUEST['applicationname']); -//setConfigNotification_batch_config_Xml($from,$to,$host,$user,$pass,$_REQUEST['smtpType'],$port,$auth,$charset,$smtpSecure); - $return2['status'] = 2; - $return2['text'] = _SET_CONFIG_OK; + $return2['status'] = 2; + $return2['text'] = _SET_CONFIG_OK; - $jsonReturn = json_encode($return2); - - echo $jsonReturn; - exit; + $jsonReturn = json_encode($return2); + echo $jsonReturn; + exit; } -?> diff --git a/install/scripts/testSmtp.php b/install/scripts/testSmtp.php index 3b0e2eada39..585e123976e 100755 --- a/install/scripts/testSmtp.php +++ b/install/scripts/testSmtp.php @@ -23,37 +23,6 @@ \Configuration\models\ConfigurationModel::update(['set' => ['value' => $data], 'where' => ['service = ?'], 'data' => ['admin_email_server']]); } - - function setConfigNotification_batch_config_Xml($from, $to, $host, $user, $pass, $type, $port, $auth, $charset, $smtpSecure, $mailfrom, $smtpDomains) - { - $xmlconfig = simplexml_load_file(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/bin/notification/config/config.xml'); - - $CONFIG = $xmlconfig->CONFIG; - - $CONFIG->MaarchDirectory = realpath('.')."/"; - if ($_SERVER['REMOTE_ADDR'] == '::1') { - $REMOTE_ADDR = 'localhost'; - } else { - $REMOTE_ADDR = $_SERVER['REMOTE_ADDR']; - } - $chemin = $REMOTE_ADDR . dirname($_SERVER['PHP_SELF']); - $maarchUrl = rtrim($chemin, "install"); - $maarchUrl = $maarchUrl . 'cs_'.$_SESSION['config']['databasename'].'/'; - $CONFIG->MaarchUrl = $maarchUrl; - - $res = $xmlconfig->asXML(); - $fp = @fopen(realpath('.')."/custom/cs_".$_SESSION['config']['databasename']."/bin/notification/config/config.xml", "w+"); - if (!$fp) { - return false; - exit; - } - $write = fwrite($fp, $res); - if (!$write) { - return false; - exit; - } - } - include($_SESSION['config']['corepath'] . '/apps/maarch_entreprise/tools/mails/htmlMimeMail.php'); @@ -91,8 +60,6 @@ if ($_REQUEST['type'] == 'test') { setConfigSendmail_batch_config_Xml($from, $to, $host, $user, $pass, $_REQUEST['smtpType'], $port, $auth, $charset, $smtpSecure, $from, $_REQUEST['smtpDomains']); - setConfigNotification_batch_config_Xml($from, $to, $host, $user, $pass, $_REQUEST['smtpType'], $port, $auth, $charset, $smtpSecure, $from, $_REQUEST['smtpDomains']); - $return2['status'] = 2; $return2['text'] = _SMTP_OK; @@ -104,8 +71,6 @@ if ($_REQUEST['type'] == 'test') { } elseif ($_REQUEST['type'] == 'add') { setConfigSendmail_batch_config_Xml($from, $to, $host, $user, $pass, $_REQUEST['smtpType'], $port, $auth, $charset, $smtpSecure, $from, $_REQUEST['smtpDomains']); - setConfigNotification_batch_config_Xml($from, $to, $host, $user, $pass, $_REQUEST['smtpType'], $port, $auth, $charset, $smtpSecure, $from, $_REQUEST['smtpDomains']); - $return2['status'] = 2; $return2['text'] = _INFO_SMTP_OK; diff --git a/migration/20.10/migrateModulesConfig.php b/migration/20.10/migrateModulesConfig.php index 8a75bbd5da1..5bf76fca229 100755 --- a/migration/20.10/migrateModulesConfig.php +++ b/migration/20.10/migrateModulesConfig.php @@ -25,7 +25,8 @@ foreach ($customs as $custom) { $loadedXml = simplexml_load_file($path); if ($loadedXml) { - $loadedXml->CONFIG->CookieTime = 10080; + unset($loadedXml->CONFIG->CookieTime); + $loadedXml->CONFIG->cookieTime = 10080; $i = 0; foreach ($loadedXml->MODULES as $value) { if (in_array($loadedXml->MODULES[$i]->moduleid, ['convert', 'reports', 'full_text', 'cases'])) { diff --git a/migration/20.10/migrateNotificationsConfig.php b/migration/20.10/migrateNotificationsConfig.php index 301e0869b23..ae6e8598d2f 100755 --- a/migration/20.10/migrateNotificationsConfig.php +++ b/migration/20.10/migrateNotificationsConfig.php @@ -38,10 +38,10 @@ foreach ($customs as $custom) { $loadedNotificationXml = simplexml_load_file($notificationFilePath); if ($loadedXml && $loadedNotificationXml) { - $loadedXml->CONFIG->MaarchDirectory = (string)$loadedNotificationXml->CONFIG->MaarchDirectory; + $loadedXml->CONFIG->maarchDirectory = (string)$loadedNotificationXml->CONFIG->MaarchDirectory; $loadedXml->CONFIG->customID = (string)$loadedNotificationXml->CONFIG->customID; - if (empty($loadedXml->CONFIG->MaarchUrl)) { - $loadedXml->CONFIG->MaarchUrl = (string)$loadedNotificationXml->CONFIG->MaarchUrl; + if (empty($loadedXml->CONFIG->maarchUrl)) { + $loadedXml->CONFIG->maarchUrl = (string)$loadedNotificationXml->CONFIG->MaarchUrl; } $res = formatXml($loadedXml); diff --git a/migration/20.10/migrateRemoteSignatureBookConfig.php b/migration/20.10/migrateRemoteSignatureBookConfig.php index 9506d5fc8dc..90ac312621a 100755 --- a/migration/20.10/migrateRemoteSignatureBookConfig.php +++ b/migration/20.10/migrateRemoteSignatureBookConfig.php @@ -43,8 +43,8 @@ foreach ($customs as $custom) { $loadedXml->SIGNATUREBOOK->refusedStatusAnnot = (string)$loadedVisaXml->CONFIG->refusedStatusAnnot; $loadedXml->SIGNATUREBOOK->userWS = (string)$loadedVisaXml->CONFIG->userWS; $loadedXml->SIGNATUREBOOK->passwordWS = (string)$loadedVisaXml->CONFIG->passwordWS; - if (empty($loadedXml->CONFIG->MaarchUrl)) { - $loadedXml->CONFIG->MaarchUrl = (string)$loadedVisaXml->CONFIG->applicationUrl; + if (empty($loadedXml->CONFIG->maarchUrl)) { + $loadedXml->CONFIG->maarchUrl = (string)$loadedVisaXml->CONFIG->applicationUrl; } $res = formatXml($loadedXml); diff --git a/modules/notifications/class/class_modules_tools_Abstract.php b/modules/notifications/class/class_modules_tools_Abstract.php index 532988778d1..cda4370f539 100755 --- a/modules/notifications/class/class_modules_tools_Abstract.php +++ b/modules/notifications/class/class_modules_tools_Abstract.php @@ -1,4 +1,4 @@ -<?php +<?php /* * Copyright 2008-2016 Maarch @@ -29,104 +29,19 @@ * @since 10/2005 * @license GPL v3 * @author Loic Vinet <dev@maarch.org> -* +* */ -abstract class notifications_Abstract { - -/** - * Build Maarch module tables into sessions vars with a xml configuration file - */ - function build_config($conf) { - - $xmlconfig = simplexml_load_file($conf); - foreach($xmlconfig->CONFIG as $CONFIG) { - $_SESSION['config']['databaseserver'] = utf8_decode((string) $CONFIG->databaseserver); - $_SESSION['config']['databaseserverport'] = utf8_decode((string) $CONFIG->databaseserverport); - $_SESSION['config']['databasename'] = utf8_decode((string) $CONFIG->databasename); - $_SESSION['config']['databaseuser'] = utf8_decode((string) $CONFIG->databaseuser); - $_SESSION['config']['databasetype'] = utf8_decode((string) $CONFIG->databasetype); - $_SESSION['config']['databasepassword'] = utf8_decode((string) $CONFIG->databasepassword); - - $_SESSION['config']['businessapppath'] = (string) $CONFIG->businessapppath; - $_SESSION['config']['businessappurl'] = (string) $CONFIG->businessappurl; - $_SESSION['config']['MaarchDirectory'] = utf8_decode((string) $CONFIG->MaarchDirectory); - - $_SESSION['config']['lang'] = utf8_decode((string) $CONFIG->lang); - $_SESSION['config']['mail'] = utf8_decode((string) $CONFIG->mailfrom); - $_SESSION['config']['debug'] = utf8_decode((string) $CONFIG->debug); - $_SESSION['config']['MaarchURL'] = utf8_decode((string) $CONFIG->MaarchURL); - $_SESSION['config']['tag_when_send'] = utf8_decode((string) $CONFIG->tag_when_send); - } - - $i=0; - - - foreach($xmlconfig->COLLECTION as $COLLECTION) - { - $_SESSION['collection'][$i] = array( - "id" => utf8_decode((string) $COLLECTION->id), - "label" => utf8_decode((string) $COLLECTION->label), - "table" => utf8_decode((string) $COLLECTION->table), - "view" => utf8_decode((string) $COLLECTION->view) - ); - $i++; - } - - - //Use this value par default for Maarch LetterBox v3 - $_SESSION['used_table'] = $_SESSION['collection'][0]['table']; - - $_SESSION['ressources']['letterbox_view'] = $_SESSION['collection'][0]['view']; - - foreach($xmlconfig->TABLENAME as $TABLENAME) - { - $_SESSION['tablename']['doctypes'] = utf8_decode((string) $TABLENAME->doctypes); - $_SESSION['tablename']['history'] = utf8_decode((string) $TABLENAME->history); - $_SESSION['tablename']['listinstance'] = utf8_decode((string) $TABLENAME->listinstance); - $_SESSION['tablename']['users'] = utf8_decode((string) $TABLENAME->users); - $_SESSION['tablename']['entities'] = utf8_decode((string) $TABLENAME->entities); - $_SESSION['tablename']['ent_entities'] = utf8_decode((string) $TABLENAME->entities); - $_SESSION['tablename']['ent_users_entities'] = utf8_decode((string) $TABLENAME->users_entities); - } - - foreach($xmlconfig->TEMPLATES as $TEMPLATE) - { - $_SESSION['templates_directory'] = utf8_decode((string) $TEMPLATE->templates_directory); - $_SESSION['templates']['notif'] = utf8_decode((string) $TEMPLATE->notif); - $_SESSION['templates']['notif_copy'] = utf8_decode((string) $TEMPLATE->notif_copy); - $_SESSION['templates']['alarm1'] = utf8_decode((string) $TEMPLATE->alarm1); - $_SESSION['templates']['alarm1_copy'] = utf8_decode((string) $TEMPLATE->alarm1_copy); - $_SESSION['templates']['alarm2'] = utf8_decode((string) $TEMPLATE->alarm2); - $_SESSION['templates']['alarm2_copy'] = utf8_decode((string) $TEMPLATE->alarm2_copy); - - } - - foreach($xmlconfig->FEATURES as $FEATURES) - { - $_SESSION['features']['copy_for_notif'] = utf8_decode((string) $FEATURES->copy_for_notif); - $_SESSION['features']['copy_for_alarm1'] = utf8_decode((string) $FEATURES->copy_for_alarm1); - $_SESSION['features']['copy_for_alarm2'] = utf8_decode((string) $FEATURES->copy_for_alarm2); - } - foreach($xmlconfig->DEBUG as $DEBUG) - { - $_SESSION['debug']['send_mail'] = utf8_decode((string) $DEBUG->send_mail); - $_SESSION['debug']['tag_when_send'] = utf8_decode((string) $DEBUG->tag_when_send); - $_SESSION['debug']['console'] = utf8_decode((string) $DEBUG->console); - - } - } - - - function build_modules_tables() { - - - require_once( - "modules" - .DIRECTORY_SEPARATOR."notifications" +abstract class notifications_Abstract +{ + public function build_modules_tables() + { + require_once( + "modules" + .DIRECTORY_SEPARATOR."notifications" .DIRECTORY_SEPARATOR."notifications_tables_definition.php" - ); - if (file_exists($_SESSION['config']['corepath'].'custom' + ); + if (file_exists($_SESSION['config']['corepath'].'custom' .DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'] .DIRECTORY_SEPARATOR."modules".DIRECTORY_SEPARATOR ."notifications".DIRECTORY_SEPARATOR @@ -141,12 +56,11 @@ abstract class notifications_Abstract { .DIRECTORY_SEPARATOR."xml".DIRECTORY_SEPARATOR."config.xml"; } $xmlconfig = simplexml_load_file($path); - - } - - function load_module_var_session() { - - if (file_exists($_SESSION['config']['corepath'].'custom' + } + + public function load_module_var_session() + { + if (file_exists($_SESSION['config']['corepath'].'custom' .DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'] .DIRECTORY_SEPARATOR."modules".DIRECTORY_SEPARATOR ."notifications".DIRECTORY_SEPARATOR @@ -161,17 +75,15 @@ abstract class notifications_Abstract { .DIRECTORY_SEPARATOR."xml".DIRECTORY_SEPARATOR."event_type.xml"; } $xmlconfig = simplexml_load_file($path); - - foreach($xmlconfig->event_type as $event) { - $id = (string)$event->id; - $label = (string)$event->label; - if(@constant($label)) { - $_SESSION['notif_events'][$id] = constant($label); - } else { - $_SESSION['notif_events'][$id] = $label; - } - - } - - } + + foreach ($xmlconfig->event_type as $event) { + $id = (string)$event->id; + $label = (string)$event->label; + if (@constant($label)) { + $_SESSION['notif_events'][$id] = constant($label); + } else { + $_SESSION['notif_events'][$id] = $label; + } + } + } } diff --git a/package.json b/package.json index 51403c2c5a8..513084aafb5 100755 --- a/package.json +++ b/package.json @@ -25,10 +25,10 @@ "zone.js": "~0.10.2" }, "devDependencies": { - "@angular-devkit/build-angular": "^0.901.1", + "@angular-devkit/build-angular": "^0.901.2", "@angular/animations": "^9.1.1", "@angular/cdk": "^9.2.0", - "@angular/cli": "^9.1.1", + "@angular/cli": "^9.1.2", "@angular/common": "^9.1.1", "@angular/compiler": "^9.1.1", "@angular/compiler-cli": "^9.1.1", @@ -76,7 +76,7 @@ "uglify-es": "3.3.9", "uglifyjs-webpack-plugin": "2.2.0", "url-loader": "^4.1.0", - "webpack": "^4.42.1" + "webpack": "^4.43.0" }, "repository": {} } diff --git a/src/core/controllers/AuthenticationController.php b/src/core/controllers/AuthenticationController.php index 5149922a83e..8a792796106 100755 --- a/src/core/controllers/AuthenticationController.php +++ b/src/core/controllers/AuthenticationController.php @@ -300,9 +300,9 @@ class AuthenticationController $loadedXml = CoreConfigModel::getXmlLoaded(['path' => 'apps/maarch_entreprise/xml/config.xml']); if ($loadedXml) { - if (!empty($loadedXml->CONFIG->CookieTime)) { - if ($sessionTime > (int)$loadedXml->CONFIG->CookieTime) { - $sessionTime = (int)$loadedXml->CONFIG->CookieTime; + if (!empty($loadedXml->CONFIG->cookieTime)) { + if ($sessionTime > (int)$loadedXml->CONFIG->cookieTime) { + $sessionTime = (int)$loadedXml->CONFIG->cookieTime; } } } @@ -325,7 +325,7 @@ class AuthenticationController $loadedXml = CoreConfigModel::getXmlLoaded(['path' => 'apps/maarch_entreprise/xml/config.xml']); if ($loadedXml) { - $sessionTime = (int)$loadedXml->CONFIG->CookieTime; + $sessionTime = (int)$loadedXml->CONFIG->cookieTime; } $token = [ -- GitLab