diff --git a/apps/maarch_entreprise/admin/contacts/manage_duplicates.php b/apps/maarch_entreprise/admin/contacts/manage_duplicates.php old mode 100644 new mode 100755 index 40a54b3675dbb68c221e7a89859037bcf76dd741..d967d34d35140bf1620bcf0229e4a50dcbdb4f10 --- a/apps/maarch_entreprise/admin/contacts/manage_duplicates.php +++ b/apps/maarch_entreprise/admin/contacts/manage_duplicates.php @@ -100,8 +100,8 @@ $htmlTabSoc .= '<tr style="display:table;width:100%;">'; $htmlTabSoc .= '<th style="width:7%;"> </th>'; $htmlTabSoc .= '<th style="width:8%;">' . _ID . '</th>'; $htmlTabSoc .= '<th style="width:30%;">' . _STRUCTURE_ORGANISM . '</th>'; -$htmlTabSoc .= '<th style="width:40%;">' . _ADDRESS.' '._INFO. '</th>'; -$htmlTabSoc .= '<th style="width:10%;">' . _ADDRESS.' '._NB. '</th>'; +$htmlTabSoc .= '<th style="width:40%;">' . _ADDRESS . '</th>'; +$htmlTabSoc .= '<th style="width:10%;">' . _ADDRESS_NB. '</th>'; $htmlTabSoc .= '<th style="width:5%;"> </th>'; $htmlTabSoc .= '</tr>'; $htmlTabSoc .= '</thead>'; @@ -208,8 +208,8 @@ $htmlTabName .= '<th style="width:5%;">' . _ID . '</th>'; $htmlTabName .= '<th style="width:10%;">' . _TITLE2 . '</th>'; $htmlTabName .= '<th style="width:15%;">' . _LASTNAME . '</th>'; $htmlTabName .= '<th style="width:15%;">' . _FIRSTNAME . '</th>'; -$htmlTabName .= '<th style="width:30%;">' . _ADDRESS.' '._INFO. '</th>'; -$htmlTabName .= '<th style="width:10%;">' . _ADDRESS.' '._NB. '</th>'; +$htmlTabName .= '<th style="width:30%;">' . _ADDRESS.' </th>'; +$htmlTabName .= '<th style="width:10%;">' . _ADDRESS_NB.' </th>'; $htmlTabName .= '<th style="width:5%;"> </th>'; $htmlTabName .= '</tr>'; $htmlTabName .= '</thead>'; diff --git a/apps/maarch_entreprise/lang/en.php b/apps/maarch_entreprise/lang/en.php index 7e084805e303033e4ddadf3247d87cc133b2c58d..545f23a8ecd2c9ba3bd4d3f3ff6b827d94ede1ac 100644 --- a/apps/maarch_entreprise/lang/en.php +++ b/apps/maarch_entreprise/lang/en.php @@ -1977,4 +1977,6 @@ if (!defined('_UPDATE_END')) if (!defined('_UPDATE_DESC_END')) define('_UPDATE_DESC_END', 'Update sucessful'); if (!defined('_NO_AVAILABLE_TAG_TO_UPDATE')) - define('_NO_AVAILABLE_TAG_TO_UPDATE', 'No available tag to update'); + define('_NO_AVAILABLE_TAG_TO_UPDATE', 'No available tag to update'); + +if (!defined("_ADDRESS_NB")) define("_ADDRESS_NB","Address number"); \ No newline at end of file diff --git a/apps/maarch_entreprise/lang/fr.php b/apps/maarch_entreprise/lang/fr.php index 619142c89d44ebca44ff64d21bcdcbe3870857c7..fd982a0115b20ddb5b30c73f931041892b9c6d97 100755 --- a/apps/maarch_entreprise/lang/fr.php +++ b/apps/maarch_entreprise/lang/fr.php @@ -997,6 +997,7 @@ if (!defined("_VIEW_TREE_CONTACTS")) define("_VIEW_TREE_CONTACTS","Arborescence if (!defined("_ADDRESSES_LIST")) define("_ADDRESSES_LIST","Liste des adresses"); if (!defined("_SEARCH_ADDRESSES")) define("_SEARCH_ADDRESSES","Rechercher Nom/Adresse"); +if (!defined("_ADDRESS_NB")) define("_ADDRESS_NB","Nombre d'adresse"); if (!defined("_CONTACT_TYPES_LIST")) define("_CONTACT_TYPES_LIST","Liste des types de contact"); if (!defined("_DESC_CONTACT_TYPES")) define("_DESC_CONTACT_TYPES","Type de contact"); diff --git a/core/class/class_security.php b/core/class/class_security.php index cab2f934bc9b7c46a8d10919d21f37cbb7338d56..c26279d59daff263d40a67b19c53047330a19130 100644 --- a/core/class/class_security.php +++ b/core/class/class_security.php @@ -136,69 +136,51 @@ class security extends Database if (isset($user)) { if ($user->__get('enabled') == 'Y') { - $ugc = new usergroups_controler(); - $sec_controler = new SecurityControler(); + $ugc = new usergroups_controler(); + $sec_controler = new SecurityControler(); $serv_controler = new ServiceControler(); if (isset($_SESSION['modules_loaded']['visa'])) { - /*if ($user->__get('signature_path') <> '' - && $user->__get('signature_file_name') <> '' - ) {*/ - /*$_SESSION['user']['signature_path'] = $user->__get('signature_path'); - $_SESSION['user']['signature_file_name'] = $user->__get('signature_file_name');*/ - require_once "modules" . DIRECTORY_SEPARATOR . "visa" . DIRECTORY_SEPARATOR. "class" . DIRECTORY_SEPARATOR. "class_user_signatures.php"; - $us = new UserSignatures(); - $db = new Database(); - $query = "select path_template from " - . _DOCSERVERS_TABLE_NAME - . " where docserver_id = 'TEMPLATES'"; - $stmt = $db->query($query); - $resDs = $stmt->fetchObject(); - $pathToDs = $resDs->path_template; - - $tab_sign = $us->getForUser($s_login); - $_SESSION['user']['pathToSignature'] = array(); - foreach ($tab_sign as $sign) { - $path = $pathToDs . str_replace( - "#", - DIRECTORY_SEPARATOR, - $sign['signature_path'] - ) - . $sign['signature_file_name']; - array_push($_SESSION['user']['pathToSignature'], $path); - } - - /*$_SESSION['user']['pathToSignature'] = $pathToDs . str_replace( - "#", - DIRECTORY_SEPARATOR, - $_SESSION['user']['signature_path'] - ) - . $_SESSION['user']['signature_file_name']; - */ - $_SESSION['user']['code_session'] = $ra_code; - //} + + require_once "modules" . DIRECTORY_SEPARATOR . "visa" . DIRECTORY_SEPARATOR. "class" . DIRECTORY_SEPARATOR. "class_user_signatures.php"; + $us = new UserSignatures(); + $db = new Database(); + $query = "select path_template from " + . _DOCSERVERS_TABLE_NAME + . " where docserver_id = 'TEMPLATES'"; + $stmt = $db->query($query); + $resDs = $stmt->fetchObject(); + $pathToDs = $resDs->path_template; + + $tab_sign = $us->getForUser($s_login); + $_SESSION['user']['pathToSignature'] = array(); + foreach ($tab_sign as $sign) { + $path = $pathToDs . str_replace( + "#", + DIRECTORY_SEPARATOR, + $sign['signature_path'] + ) + . $sign['signature_file_name']; + array_push($_SESSION['user']['pathToSignature'], $path); + } + + $_SESSION['user']['code_session'] = $ra_code; + } $array = array( - 'change_pass' => $user->__get('change_password'), - 'UserId' => $user->__get('user_id'), - 'FirstName' => $user->__get('firstname'), - 'LastName' => $user->__get('lastname'), - 'Initials' => $user->__get('initials'), - 'Phone' => $user->__get('phone'), - 'Mail' => $user->__get('mail'), - 'department' => $user->__get('department'), - 'thumbprint' => $user->__get('thumbprint'), - /*'signature_path' => $user->__get('signature_path'), - 'signature_file_name' => $user->__get('signature_file_name'),*/ + 'change_pass' => $user->__get('change_password'), + 'UserId' => $user->__get('user_id'), + 'FirstName' => $user->__get('firstname'), + 'LastName' => $user->__get('lastname'), + 'Initials' => $user->__get('initials'), + 'Phone' => $user->__get('phone'), + 'Mail' => $user->__get('mail'), + 'department' => $user->__get('department'), + 'thumbprint' => $user->__get('thumbprint'), 'pathToSignature' => $_SESSION['user']['pathToSignature'], 'Status' => $user->__get('status'), 'cookie_date' => $user->__get('cookie_date'), ); - // $_SESSION['error'] = ''; - /*setcookie( - 'maarch', 'UserId=' . $array['UserId'] . '&key=' - . $user->__get('cookie_key'), time() - 3600000, - 0, 0, $_SERVER["HTTPS"], 1 - );*/ + $key = md5( time() . '%' . $array['FirstName'] . '%' . $array['UserId'] . '%' . $array['UserId'] . '%' . date('dmYHmi') . '%' @@ -213,11 +195,7 @@ class security extends Database } // #TODO : usefull ? $uc->save($user, 'up'); - /*setcookie( - 'maarch', 'UserId=' . $array['UserId'] . '&key=' - . $key, time() + ($_SESSION['config']['cookietime'] * 1000), - 0, 0, $_SERVER["HTTPS"], 1 - );*/ + $array['primarygroup'] = $ugc ->getPrimaryGroup( $array['UserId'] ); @@ -257,9 +235,9 @@ class security extends Database $hist = new history(); $ip = $_SERVER['REMOTE_ADDR']; $navigateur = addslashes($_SERVER['HTTP_USER_AGENT']); - $_SESSION['user']['UserId'] = $s_login; - $_SESSION['user']['department'] = $array['department']; - $_SESSION['user']['thumbprint'] = $array['thumbprint']; + $_SESSION['user']['UserId'] = $s_login; + $_SESSION['user']['department'] = $array['department']; + $_SESSION['user']['thumbprint'] = $array['thumbprint']; $_SESSION['user']['primarygroup'] = $array['primarygroup']; $hist->add( $_SESSION['tablename']['users'], @@ -270,13 +248,13 @@ class security extends Database ); } - if ($array['change_pass'] == 'Y') { + if ($array['change_pass'] == 'Y' && !isset($_SESSION['web_cas_url'])) { return array( 'user' => $array, 'error' => $error, 'url' => 'index.php?display=true&page=change_pass' ); - }else if (isset($_SESSION['requestUri']) + } else if (isset($_SESSION['requestUri']) && trim($_SESSION['requestUri']) <> '' && ! preg_match('/page=login/', $_SESSION['requestUri'])) { return array( @@ -329,7 +307,6 @@ class security extends Database $users = new class_users(); $userInfo = $users->get_user($_SESSION['user']['UserId']); - $authorized_characters = '0123456789'; $cpt_motDePasse = 1; $cptMax_motDePasse = 4; @@ -346,7 +323,6 @@ class security extends Database $db->query("UPDATE users set ra_code = ? WHERE user_id = ?", array($this->getPasswordHash($raCodeGenerated), $_SESSION['user']['UserId']), false); $db->query("UPDATE users set ra_expiration_date = ? WHERE user_id = ?", array($expiration_date, $_SESSION['user']['UserId']), false); - /* GENERATION DU MAIL */ $mailToSend = '<html>'; $mailToSend .= '<body>'; @@ -380,14 +356,14 @@ class security extends Database $mailer->SMTPDebug = 0; $mailer->Debugoutput = 'html'; - $mailer->Host = (string)$mailerParams->smtp_host; - $mailer->Port = (string)$mailerParams->smtp_port; - $mailer->SMTPSecure = (string)$mailerParams->smtp_secure; - $mailer->SMTPAuth = filter_var($mailerParams->smtp_auth, FILTER_VALIDATE_BOOLEAN); + $mailer->Host = (string)$mailerParams->smtp_host; + $mailer->Port = (string)$mailerParams->smtp_port; + $mailer->SMTPSecure = (string)$mailerParams->smtp_secure; + $mailer->SMTPAuth = filter_var($mailerParams->smtp_auth, FILTER_VALIDATE_BOOLEAN); $mailer->Username = (string)$mailerParams->smtp_user; $mailer->Password = (string)$mailerParams->smtp_password; - $mailer->Helo = (string)$mailerParams->domains; + $mailer->Helo = (string)$mailerParams->domains; if ((string)$mailerParams->type == "smtp") $mailer->isSMTP(); $mailer->setFrom((string)$mailerParams->mailfrom,(string)$mailerParams->mailfromname); @@ -398,15 +374,11 @@ class security extends Database $mailer->msgHTML($mailToSend); if (!$mailer->send()) { $_SESSION['error'] .= ' mail not send to '.$userInfo['mail'].': '.$mailer->ErrorInfo; - //$_SESSION['error'] .= '<pre>'.print_r($mailer,true).'</pre>'; + if ($redirect){ if ($_SESSION['isSmartphone']) header('location: smartphone/index.php?page=login'); else header('location: index.php?page=login&display=true'); } - /*else{ - echo $_SESSION['error']; - exit(); - }*/ } else { $_SESSION['error'] .= ' '._CONFIRM_ASK_RA_CODE_7; $_SESSION['recup_user']['login'] = $login; @@ -435,52 +407,41 @@ class security extends Database { $serv_controler = new ServiceControler(); $_SESSION['user']['change_pass'] = $user->__get('change_password'); - $_SESSION['user']['UserId'] = $user->__get('user_id'); - $_SESSION['user']['FirstName'] = $user->__get('firstname'); - $_SESSION['user']['LastName'] = $user->__get('lastname'); - $_SESSION['user']['Phone'] = $user->__get('phone'); - $_SESSION['user']['Mail'] = $user->__get('mail'); - $_SESSION['user']['department'] = $user->__get('department'); - $_SESSION['user']['thumbprint'] = $user->__get('thumbprint'); + $_SESSION['user']['UserId'] = $user->__get('user_id'); + $_SESSION['user']['FirstName'] = $user->__get('firstname'); + $_SESSION['user']['LastName'] = $user->__get('lastname'); + $_SESSION['user']['Phone'] = $user->__get('phone'); + $_SESSION['user']['Mail'] = $user->__get('mail'); + $_SESSION['user']['department'] = $user->__get('department'); + $_SESSION['user']['thumbprint'] = $user->__get('thumbprint'); + if (isset($_SESSION['modules_loaded']['visa'])) { - /*if ($user->__get('signature_path') <> '' - && $user->__get('signature_file_name') <> '' - ) {*/ - /*$_SESSION['user']['signature_path'] = $user->__get('signature_path'); - $_SESSION['user']['signature_file_name'] = $user->__get('signature_file_name');*/ - require_once "modules" . DIRECTORY_SEPARATOR . "visa" . DIRECTORY_SEPARATOR. "class" . DIRECTORY_SEPARATOR. "class_user_signatures.php"; - $us = new UserSignatures(); - - $db = new Database(); - $query = "select path_template from " - . _DOCSERVERS_TABLE_NAME - . " where docserver_id = 'TEMPLATES'"; - $stmt = $db->query($query); - $resDs = $stmt->fetchObject(); - $pathToDs = $resDs->path_template; - - $tab_sign = $us->getForUser($_SESSION['user']['UserId']); - $_SESSION['user']['pathToSignature'] = array(); - foreach ($tab_sign as $sign) { - $path = $pathToDs . str_replace( - "#", - DIRECTORY_SEPARATOR, - $sign['signature_path'] - ) - . $sign['signature_file_name']; - array_push($_SESSION['user']['pathToSignature'], $path); - } - /*$_SESSION['user']['pathToSignature'] = $pathToDs . str_replace( - "#", - DIRECTORY_SEPARATOR, - $_SESSION['user']['signature_path'] - ) - . $_SESSION['user']['signature_file_name'];*/ - //} + require_once "modules" . DIRECTORY_SEPARATOR . "visa" . DIRECTORY_SEPARATOR. "class" . DIRECTORY_SEPARATOR. "class_user_signatures.php"; + $us = new UserSignatures(); + + $db = new Database(); + $query = "select path_template from " + . _DOCSERVERS_TABLE_NAME + . " where docserver_id = 'TEMPLATES'"; + $stmt = $db->query($query); + $resDs = $stmt->fetchObject(); + $pathToDs = $resDs->path_template; + + $tab_sign = $us->getForUser($_SESSION['user']['UserId']); + $_SESSION['user']['pathToSignature'] = array(); + foreach ($tab_sign as $sign) { + $path = $pathToDs . str_replace( + "#", + DIRECTORY_SEPARATOR, + $sign['signature_path'] + ) + . $sign['signature_file_name']; + array_push($_SESSION['user']['pathToSignature'], $path); + } } $_SESSION['error'] = ""; - /*setcookie("maarch", "UserId=".$_SESSION['user']['UserId']."&key=".$line->cookie_key,time()-3600000, 0, 0, $_SERVER["HTTPS"], 1);*/ + $key = md5(time()."%".$_SESSION['user']['FirstName']."%".$_SESSION['user']['UserId']."%".$_SESSION['user']['UserId']."%".date("dmYHmi")."%"); $user->__set('cookie_key', $key); @@ -490,7 +451,6 @@ class security extends Database $user->__set('cookie_date',date("Y-m-d")." ".date("H:m:i")); $uc->save($user, 'up'); - /*setcookie("maarch", "UserId=".$_SESSION['user']['UserId']."&key=".$key,time()+($_SESSION['config']['cookietime']*60), 0, 0, $_SERVER["HTTPS"], 1);*/ $_SESSION['user']['primarygroup'] = $ugc->getPrimaryGroup($_SESSION['user']['UserId']); $sec_controler = new SecurityControler(); @@ -517,36 +477,20 @@ class security extends Database $hist->add($_SESSION['tablename']['users'],$_SESSION['user']['UserId'],"LOGIN","IP : ".$ip.", BROWSER : ".$navigateur , $_SESSION['config']['databasetype']); } */ - if($_SESSION['user']['change_pass'] == 'Y') - { + if($_SESSION['user']['change_pass'] == 'Y' && !isset($_SESSION['web_cas_url'])) { header("location: ".$_SESSION['config']['businessappurl']."index.php?display=true&page=change_pass"); exit(); - } - /*if($_SESSION['origin'] == "scan") - { - header("location: ../../modules/indexing_searching/index_file.php"); - exit(); - } - elseif($_SESSION['origin'] == "files") - { - header("location: ../../modules/indexing_searching/index_file.php"); - exit(); - }*/ - else - { + + } else { header("location: ".$_SESSION['config']['businessappurl']."index.php"); exit(); } - } - else - { + } else { $_SESSION['error'] = _SUSPENDED_ACCOUNT; header("location: ".$_SESSION['config']['businessappurl']."index.php"); exit(); } - } - else - { + } else { $_SESSION['error'] = _ERROR; header("location: ".$_SESSION['config']['businessappurl']."index.php?display=true&page=login"); exit(); diff --git a/core/class/users_controler.php b/core/class/users_controler.php index 376b0385e649f3879a7b1d8ff4108f8bb4fae29c..abd1378c8c89b8dc6bdc24dd40151a1788f78735 100644 --- a/core/class/users_controler.php +++ b/core/class/users_controler.php @@ -401,7 +401,7 @@ class users_controler extends ObjectControler implements ObjectControlerIF $sec = new security(); $user->password = $sec->getPasswordHash($params['userdefaultpassword']); - if($_SESSION['config']['ldap'] == "true"){ + if($_SESSION['config']['ldap'] == "true" || isset($_SESSION['web_cas_url'])){ $user->change_password = "N"; } diff --git a/core/services/SessionAbstract.php b/core/services/SessionAbstract.php index 1cd99e60d98a0fbdee868c1e1b4990c03b1fefa9..dc1ae329d767ee0418f08e55919b026c317f1d98 100644 --- a/core/services/SessionAbstract.php +++ b/core/services/SessionAbstract.php @@ -282,29 +282,6 @@ class Core_SessionAbstract_Service extends Core_Abstract_Service { 'url' => 'index.php?' . $_SESSION['requestUri']*/ ); -/* - if ($array['change_pass'] == 'Y') { - return array( - 'user' => $array, - 'error' => $error, - 'url' => 'index.php?display=true&page=change_pass' - ); - }else if (isset($_SESSION['requestUri']) - && trim($_SESSION['requestUri']) <> '' - && ! preg_match('/page=login/', $_SESSION['requestUri'])) { - return array( - 'user' => $array, - 'error' => $error, - 'url' => 'index.php?' . $_SESSION['requestUri'] - ); - } else { - return array( - 'user' => $array, - 'error' => $error, - 'url' => 'index.php' - ); - } -*/ return true; } } \ No newline at end of file