diff --git a/apps/maarch_entreprise/log.php b/apps/maarch_entreprise/log.php deleted file mode 100755 index 30fa1087a0098ccdf39148275a88e0193cfd08d1..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/log.php +++ /dev/null @@ -1,310 +0,0 @@ -<?php - - -/** - * File : log.php. - * - * User identification - * - * @version 2.1 - * - * @since 10/2005 - * - * @license GPL - * @author Claire Figueras <dev@maarch.org> - * @author Laurent Giovannoni <dev@maarch.org> - */ -if (empty($_COOKIE)) { - $_SESSION['error'] = 'Le cache utilisateur à été réinitialisé veuillez re-saisir vos identifiants'; - header( - 'location: '.$_SESSION['config']['businessappurl'] - .'index.php?display=true&page=login' - ); - exit; -} - -if (file_exists('../../core/init.php')) { - include_once '../../core/init.php'; -} -require_once 'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_functions.php'; -require_once 'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_db.php'; -require_once 'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_core_tools.php'; - -$core = new core_tools(); -$core->load_lang(); -$func = new functions(); - -$_SESSION['error'] = ''; -$method = false; -if (isset($_SESSION['web_cas_url'])) { - include_once 'apps/maarch_entreprise/tools/phpCAS/CAS.php'; - - phpCAS::client(constant($_SESSION['cas_version']), $_SESSION['cas_serveur'], (int) $_SESSION['cas_port'], $_SESSION['cas_context'], true); - - if (!empty($_SESSION['cas_certificate'])) { - phpCAS::setCasServerCACert($_SESSION['cas_certificate']); - } else { - phpCAS::setNoCasServerValidation(); - } - - phpCAS::forceAuthentication(); - $Id = phpCAS::getUser(); - - if (!empty($_SESSION['cas_id_separator'])) { - $tmpId = explode($_SESSION['cas_id_separator'], $Id); - $login = $tmpId[0]; - } else { - $login = $Id; - } - - $_REQUEST['pass'] = 'maarch'; - $method = 'cas'; -} elseif (!empty($_SESSION['keycloak']['userId'])) { - $login = $_SESSION['keycloak']['userId']; - $_REQUEST['pass'] = 'maarch'; -} elseif (!empty($_SESSION['sso']['userId'])) { - $login = $_SESSION['sso']['userId']; - $_REQUEST['pass'] = 'maarch'; - $method = 'sso'; -} elseif (isset($_REQUEST['login'])) { - $login = $func->wash($_REQUEST['login'], 'no', _THE_ID, 'yes'); -} else { - $login = ''; -} -if (isset($_REQUEST['pass'])) { - $password = $_REQUEST['pass']; -} else { - $password = ''; -} -require_once 'core/class/class_security.php'; -require_once 'core/class/class_request.php'; -require_once 'apps/'.$_SESSION['config']['app_id'] - .'/class/class_business_app_tools.php'; -$sec = new security(); -$businessAppTools = new business_app_tools(); - -if (empty($_SESSION['config']['databasename'])) { - $tmpPath = explode( - DIRECTORY_SEPARATOR, - str_replace( - '/', - DIRECTORY_SEPARATOR, - $_SERVER['SCRIPT_FILENAME'] - ) - ); - $serverPath = implode( - DIRECTORY_SEPARATOR, - array_slice( - $tmpPath, - 0, - array_search('apps', $tmpPath) - ) - ).DIRECTORY_SEPARATOR; - - $core->build_core_config('core/xml/config.xml'); - - $businessAppTools->build_business_app_config(); - $core->load_modules_config($_SESSION['modules']); - $core->load_lang(); - $core->load_app_services(); - $core->load_modules_services($_SESSION['modules']); -} - -if (empty($login) || empty($password)) { - $_SESSION['error'] = _BAD_LOGIN_OR_PSW . '...'; -} -if (!empty($_SESSION['error'])) { - header('location: '.$_SESSION['config']['businessappurl'] .'index.php?display=true&page=login'); - exit(); -} else { - $loginMethod = \SrcCore\models\CoreConfigModel::getLoggingMethod(); - if ($loginMethod['id'] == 'ldap' && $login != 'superadmin') { - //Extraction de /root/config dans le fichier de conf - if (file_exists($_SESSION['config']['corepath'] - .'/custom/'.$_SESSION['custom_override_id'] - .'/modules/ldap/xml/config.xml') - ) { - $pathtoConfig = $_SESSION['config']['corepath'] - .'/custom/'.$_SESSION['custom_override_id'] - .'/modules/ldap/xml/config.xml'; - } else { - $pathtoConfig = $_SESSION['config']['corepath'] - .'modules/ldap/xml/config.xml'; - } - $ldapConf = new DomDocument(); - try { - if (!@$ldapConf->load($pathtoConfig)) { - throw new Exception( - 'Impossible de charger le document : ' - .$pathtoConfig - ); - } - } catch (Exception $e) { - exit($e->getMessage()); - } - - if (!file_exists($pathtoConfig)) { - exit(); - } - - - $xpLdapConf = new domxpath($ldapConf); - $ldapConfig = simplexml_load_file($pathtoConfig); - - foreach ($ldapConfig->config->ldap as $ldap) { - $_SESSION['error'] = ''; - foreach ($ldap as $node => $value) { - ${$node} = (string)$value; - } - - //On inclus la class LDAP qui correspond à l'annuaire - if (strtolower($type_ldap) == 'openldap') { - $classLdap = 'class_openLDAP.php'; - } else { - $classLdap = 'class_adLDAP.php'; - } - - //customized or not - if (!@include_once $_SESSION['config']['corepath'] . '/custom/' . $_SESSION['custom_override_id'] . '/modules/ldap/class/' . $classLdap) { - if (!@include_once $_SESSION['config']['corepath'] . 'modules/ldap/class/' . $classLdap) { - exit('Impossible de charger class_' . $_SESSION['config']['corepath'] . '/modules/ldap/class/' . $classLdap . "\n"); - } - } - - if (!empty($prefix_login)) { - $login_admin = $prefix_login . '\\' . $login_admin; - } - - if (!empty($suffix_login)) { - $login_admin = $login_admin . $suffix_login; - } - - //Try to create a new ldap instance - try { - if (strtolower($type_ldap) == 'openldap') { - $ad = new LDAP($domain, $login_admin, $pass, $ssl, $hostname); - } else { - $ad = new LDAP($domain, $login_admin, $pass, $ssl); - } - } catch (Exception $conFailure) { - if (!empty($standardConnect) && $standardConnect == 'true') { - $res = $sec->login($login, $password, 'ldap', $standardConnect); - $login = $res['user']['UserId']; - $_SESSION['user'] = $res['user']; - if (empty($res['error'])) { - \SrcCore\models\AuthenticationModel::setCookieAuth(['userId' => $login]); - \SrcCore\models\AuthenticationModel::resetFailedAuthentication(['userId' => $login]); - $user = \User\models\UserModel::getByLogin(['login' => $login, 'select' => ['id']]); - header( - 'location: ' . $_SESSION['config']['businessappurl'] - . $res['url'] - ); - exit(); - } else { - $_SESSION['error'] = $res['error']; - } - - header('location: ' . $_SESSION['config']['businessappurl'] . $res['url']); - continue; - } else { - echo functions::xssafe($conFailure->getMessage()); - continue; - } - } - - if ($prefix_login != '') { - $loginToAd = $prefix_login . '\\' . $login; - } else { - $loginToAd = $login; - } - - if ($suffix_login != '') { - $loginToAd = $loginToAd . $suffix_login; - } - - if ($ad->authenticate($loginToAd, $password)) { - require_once 'core/class/class_db_pdo.php'; - - // Instantiate database. - $database = new Database(); - $stmt = $database->query( - 'SELECT * FROM users WHERE user_id ILIKE ?', - array($login) - ); //permet de rechercher les utilisateurs dans le LDAP sans prendre en compte la casse - $result = $stmt->fetch(); - $login = $result['user_id']; - - if (!empty($result['locked_until'])) { - $lockedDate = new \DateTime($result['locked_until']); - $currentDate = new \DateTime(); - if ($currentDate < $lockedDate) { - $_SESSION['error'] = _ACCOUNT_LOCKED_UNTIL . " {$lockedDate->format('d/m/Y H:i')}"; - header( - 'location: ' . $_SESSION['config']['businessappurl'] - . 'index.php?display=true&page=login' - ); - exit; - } - } - \SrcCore\models\AuthenticationModel::resetFailedAuthentication(['userId' => $login]); - - if ($result) { - $_SESSION['error'] = ''; - if (!empty($standardConnect) && $standardConnect == 'true') { - \User\models\UserModel::updatePassword(['id' => $result['id'], 'password' => $password]); - } - $res = $sec->login($login, $password, 'ldap', $standardConnect); - $_SESSION['user'] = $res['user']; - if ($res['error'] == '') { - \SrcCore\models\AuthenticationModel::setCookieAuth(['userId' => $login]); - } else { - $_SESSION['error'] = $res['error']; - } - header( - 'location: ' . $_SESSION['config']['businessappurl'] - . $res['url'] - ); - exit(); - } else { - $_SESSION['error'] = _BAD_LOGIN_OR_PSW; - header( - 'location: ' . $_SESSION['config']['businessappurl'] - . 'index.php?display=true&page=login' - ); - continue; - } - } else { - $error = _BAD_LOGIN_OR_PSW; - $_SESSION['error'] = $error; - header( - 'location: ' . $_SESSION['config']['businessappurl'] - . 'index.php?display=true&page=login' - ); - continue; - } - } - $error = \SrcCore\controllers\AuthenticationController::handleFailedAuthentication(['userId' => $login]); - $_SESSION['error'] = $error; - header( - 'location: ' . $_SESSION['config']['businessappurl'] - . 'index.php?display=true&page=login' - ); - } else { - $_SESSION['error'] = ''; - $res = $sec->login($login, $password, $method); - $_SESSION['user'] = $res['user']; - $login = $res['user']['UserId']; - if (empty($res['error'])) { - \SrcCore\models\AuthenticationModel::setCookieAuth(['userId' => $login]); - \SrcCore\models\AuthenticationModel::resetFailedAuthentication(['userId' => $login]); - } else { - $_SESSION['error'] = $res['error']; - } - - if ($_SESSION['user']['UserId'] == 'superadmin') { - $res['url'] .= '?administration=true'; - } - header('location: '.$_SESSION['config']['businessappurl'].$res['url']); - exit(); - } -} diff --git a/modules/ldap/class/class_adLDAP.php b/modules/ldap/class/class_adLDAP.php deleted file mode 100755 index 4916b6226cfe0020bdac8e0854ccb3700fabacc9..0000000000000000000000000000000000000000 --- a/modules/ldap/class/class_adLDAP.php +++ /dev/null @@ -1,379 +0,0 @@ -<?php /** - * PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY - * Version 3.0 - * - * PHP Version 5 with SSL and LDAP support - * - * Written by Scott Barnett, Richard Hyland - * email: scott@wiggumworld.com, adldap@richardhyland.com - * http://adldap.sourceforge.net/ - * - * Copyright (c) 2006-2009 Scott Barnett, Richard Hyland - * - * We'd appreciate any improvements or additions to be submitted back - * to benefit the entire community :) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * @category ToolsAndUtilities - * @package adLDAP - * @author Scott Barnett, Richard Hyland - * @copyright (c) 2006-2009 Scott Barnett, Richard Hyland - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1 - * @version 3.0 - * @link http://adldap.sourceforge.net/ - */ - - - /** -* Main adLDAP class -* -* Can be initialised using $adldap = new adLDAP(); -* -* Something to keep in mind is that Active Directory is a permissions -* based directory. If you bind as a domain user, you can't fetch as -* much information on other users as you could as a domain admin. -* -* Before asking questions, please read the Documentation at -* http://adldap.sourceforge.net/wiki/doku.php?id=api -*/ -class LDAP { - - /** - * Define the different types of account in AD - */ - const ADLDAP_NORMAL_ACCOUNT = 805306368; - const ADLDAP_WORKSTATION_TRUST = 805306369; - const ADLDAP_INTERDOMAIN_TRUST = 805306370; - const ADLDAP_SECURITY_GLOBAL_GROUP = 268435456; - const ADLDAP_DISTRIBUTION_GROUP = 268435457; - const ADLDAP_SECURITY_LOCAL_GROUP = 536870912; - const ADLDAP_DISTRIBUTION_LOCAL_GROUP = 536870913; - - - protected $_domain=NULL; - - /** - * Optional account with higher privileges for searching - * This should be set to a domain admin account - * - * @var string - * @var string - */ - protected $_login=NULL; - protected $_password=NULL; - - /** - * Use SSL, your server needs to be setup, please see - * http://adldap.sourceforge.net/wiki/doku.php?id=ldap_over_ssl - * - * @var bool - */ - protected $_use_ssl=false; - - /* - * Connection and bind default variables - * - * @var mixed - * @var mixed - */ - protected $_conn; - protected $_bind; - - - function __construct($domain,$login,$password,$ssl='false'){ - - $this->_domain = $domain; - $this->_login = $login; - $this->_password = $password; - $this->_use_ssl = ($ssl == 'true'); - - // Connect to the AD/LDAP server as the username/password - if ($this->_use_ssl) - { - //echo "ldaps://".$this->_domain; - $this->_conn = ldap_connect("ldaps://".$this->_domain); - } - else - { - $this->_conn = ldap_connect($this->_domain); - } - - // Set some ldap options for talking to AD - ldap_set_option($this->_conn, LDAP_OPT_PROTOCOL_VERSION, 3); - ldap_set_option($this->_conn, LDAP_OPT_REFERRALS, 0); - - // Bind as a domain admin if they've set it up - if ($this->_login!=NULL && $this->_password!=NULL){ - //$this->_bind = @ldap_bind($this->_conn,$this->_login."@".$this->_domain,$this->_password); - //echo '<pre>'; - //var_dump($this); - //echo '</pre>'; - $this->_bind = @ldap_bind($this->_conn,$this->_login,$this->_password); - if (!$this->_bind){ - if ($this->_use_ssl) - { - throw new Exception ('FATAL: AD bind failed. Either the LDAPS connection failed or the login credentials are incorrect.'); - } - else - { - throw new Exception ("FATAL: AD bind failed. Check the login credentials."); - } - } - } - } - - /** - * Default Destructor - * - * Closes the LDAP connection - * - * @return void - */ - function __destruct(){ ldap_close($this->_conn); } - - /** - * Validate a user's login credentials - * - * @param string $username A user's AD username - * @param string $password A user's AD password - * @param bool optional $prevent_rebind - * @return bool - */ - public function authenticate($login,$password,$prevent_rebind=false){ - - // Prevent null binding - echo 'ici1'.'<br />'; - if ($login==NULL || $password==NULL){ return (false);} - - // Bind as the user - echo 'ici2'.'<br />'; - try{ $this->_bind = ldap_bind($this->_conn,$login,$password); } - catch(Exception $e){} - - echo 'ici3'.'<br />'; - if (!$this->_bind){ return (false);} - - // Cnce we've checked their details, kick back into admin mode if we have it - echo 'ici4'.'<br />'; - if ($this->_login!=NULL && !$prevent_rebind){ - $this->_bind = @ldap_bind($this->_conn,$this->_login,$this->_password); - if (!$this->_bind){ echo ("FATAL: AD rebind failed."); exit(); } // This should never happen in theory - } - return (true); - } - - //***************************************************************************************************************** - // GROUP FUNCTIONS - - - /** - * Group Information. Returns an array of information about a group. - * The group name is the distinguishedname - * - * @param string $group_dn The group distinguishedname to retrieve info about - * @param array $fields Fields to retrieve - * @return array - */ - public function group_info($group_dn,$fields=array(),$dn='',$filter=''){ - if ($group_dn==NULL){ return (false); } - if (!$this->_bind){ return (false); } - - if(count($fields) < 1) - $fields[] = "distinguishedname"; - - if(empty($dn)) - $dn="DC=".str_replace(".",",DC=",$this->_domain); - - $entries = array(); - - $filter="(&(objectCategory=group)(distinguishedName=".$group_dn.")".$filter.")"; - $sr=ldap_search($this->_conn,$dn,$filter,$fields); - $entries = ldap_get_entries($this->_conn, $sr); - - if($entries['count'] != 1) - return array(); - - $ad_info_group = array(); - - foreach($fields as $fd) - { - if( $fd == 'memberof') - { - unset($entries[0][$fd]['count']); - $ad_info_group[$fd] = $entries[0][$fd]; - } - else if( $fd == 'objectguid' && !empty($entries[0][$fd][0]) ) - { - $ad_info_group[$fd] = bin2hex($entries[0][$fd][0]); - } - else if( $fd == 'objectguid' && empty($entries[0][$fd][0]) ) - { - //Le groupe n'a pas de objectguid (pb sur l'annuaire) - return array(); - } - else if( $fd == 'member') - { - unset($entries[0][$fd]['count']); - $ad_info_group[$fd] = $entries[0][$fd]; - } - else - { - $ad_info_group[$fd] = $entries[0][$fd][0]; - } - } - - return $ad_info_group; - } - - /** - * Return a list of all users in AD - * - * @param bool $include_desc Return a description of the user - * @param string $search Search parameter - * @param bool $sorted Sort the user accounts - * @return array - */ - public function all_users($fields=array(),$dn='',$filter=''){ - - if(empty($dn)) - $dn="DC=".str_replace(".",",DC=",$this->_domain); - - if (!$this->_bind){ return (false); } - - if(count($fields) < 1) - $fields[] = "distinguishedname"; - - $entries = array(); - - $filter = "(&(objectClass=user)(objectCategory=person)".$filter.")"; - $sr=ldap_search($this->_conn,$dn,$filter,$fields); - - /*Condition qui permet de parcourir tout l'annuaire en prenant les utilisateurs par ordres alphabétiques. Ainsi, on peut surpasser les 1000 utilisateurs*/ - $countResult=ldap_count_entries($this->_conn,$sr); - - if($countResult == 1000) - { - // loop trough the number 97-122 (ASCII number for the characters a-z) - for($a=97;$a<=122;$a++) - { - // translate the number to a character - $character = chr($a); - // the new search filter withs returns all users with a last name starting with $character - $filterNew = "(&(sn=$character*)(objectClass=user)(objectCategory=person)".$filter.")"; - $results = ldap_search($this->_conn, $dn, $filterNew); - - $users = array(); - $users = ldap_get_entries($this->_conn,$results); - $entries = array_merge($entries, $users); - } - } - else - { - $users = ldap_get_entries($this->_conn,$sr); - $entries = array_merge($entries, $users); - } - - - /*permet de récupérer les utilisateurs (va prendre que les 1000 premiers. Il faudra commenter la condition ci-dessus*/ - //$entries = array_merge(ldap_get_entries($this->_conn, $sr),$entries); - - $ad_users = array(); - - for ($i=0; $i < (count($entries)-1); $i++) - { - foreach($fields as $fd) - { - if( $fd == 'objectguid' && !empty($entries[$i][$fd][0]) ) - { - $ad_users[$i][$fd] = bin2hex($entries[$i][$fd][0]); - } - else if( $fd == 'objectguid' && empty($entries[$i][$fd][0]) ) - { - //L'utilisateur n'a pas de objectguid (pb sur l'annuaire) - unset($ad_users[$i]); - break; - } - else if( $fd == 'memberof') - { - unset($entries[$i][$fd]['count']); - $ad_users[$i][$fd] = $entries[$i][$fd]; - } - else if( $fd == 'useraccountcontrol') - { - if( ($entries[$i][$fd][0] & 2) == 0) - $ad_users[$i][$fd] = 'Y'; - else - $ad_users[$i][$fd] = 'N'; - } - else - { - $ad_users[$i][$fd] = $entries[$i][$fd][0]; - } - } - } - return $ad_users; - } - - public function all_groups($fields=array(),$dn='',$filter=''){ - - if(empty($dn)) - $dn="DC=".str_replace(".",",DC=",$this->_domain); - - if (!$this->_bind){ return (false); } - - if(count($fields) < 1) - $fields[]="distinguishedname"; - - $entries = array(); - - //Search for each filter - $filter = "(&(objectClass=group)".$filter.")"; - - $sr=ldap_search($this->_conn,$dn,$filter,$fields); - $entries = ldap_get_entries($this->_conn, $sr); - - for ($i=0; $i< ( count($entries) -1); $i++) - { - foreach($fields as $fd) - { - if( $fd == 'objectguid' && !empty($entries[$i][$fd][0]) ) - $ad_groups[$i][$fd] = bin2hex($entries[$i][$fd][0]); - - else if( $fd == 'objectguid' && empty($entries[$i][$fd][0]) ) - { - //Le groupe n'a pas de objectguid (pb sur l'annuaire) - unset($ad_groups[$i]); - break; - } - else if( $fd == 'memberof') - { - unset($entries[$i][$fd]['count']); - $ad_groups[$i][$fd] = $entries[$i][$fd]; - } - else if( $fd == 'member') - { - unset($entries[$i][$fd]['count']); - $ad_groups[$i][$fd] = $entries[$i][$fd]; - } - else - { - $ad_groups[$i][$fd] = $entries[$i][$fd][0]; - } - } - } - - return ($ad_groups); - } - -} - -?> diff --git a/modules/ldap/class/class_log.php b/modules/ldap/class/class_log.php deleted file mode 100755 index fa0cf9250cb7b29863d2ee373c5723f03fe7ef8d..0000000000000000000000000000000000000000 --- a/modules/ldap/class/class_log.php +++ /dev/null @@ -1,126 +0,0 @@ -<?php class log -{ - private $xml_file_path; - private $xml_file; - private $log_parent_node; - private $log_node; - private $log_date; - - function __construct($xml_file_path,$log_parent_node_name) - { - $this->xml_file_path = $xml_file_path; - $this->xml_file = new DomDocument('1.0', 'iso-8859-1'); - $this->xml_file->preserveWhiteSpace = false; - - if(@$this->xml_file->load($xml_file_path)) - { - if(!$log_parent_node = $this->xml_file->getElementsByTagName($log_parent_node_name)) - { - throw new Exception('Unable to find the parent node : '.$log_parent_node_name.' in the xml file '.$xml_file_path); - } - else - { - $this->log_parent_node = $log_parent_node->item(0); - } - } - else - { - $this->xml_file = new DomDocument('1.0', 'iso-8859-1'); - $this->xml_file->preserveWhiteSpace = false; - $this->log_parent_node = $this->xml_file->createElement($log_parent_node_name); - $this->xml_file->appendChild($this->log_parent_node); - } - $this->store(); - } - - function start() - { - $this->log_node = $this->xml_file->createElement("log"); - $this->log_node->setAttribute("date",date('dmY,H:i.s')); - $this->log_node->setAttribute("state","start"); - $this->log_parent_node->appendChild($this->log_node); - $this->store(); - } - - function count() - { - if($tab_logs = $this->xml_file->getElementsByTagName("log")) - return $tab_logs->length; - else - return 0; - } - - function __destruct() - { - //$this->remove($this->log_node); - } - - function remove($log_node) - { - $this->log_parent_node->removeChild($log_node); - $this->store(); - } - - function add_notice($notice) - { - $notice_node = $this->xml_file->createElement("notice"); - $notice_text = $this->xml_file->createTextNode($notice); - $notice_node->appendChild($notice_text); - $this->log_node->appendChild($notice_node); - $this->log_node->setAttribute("state","process"); - $this->store(); - } - - function add_error($error) - { - $erreur_node = $this->xml_file->createElement("error"); - $erreur_text = $this->xml_file->createTextNode($error); - $erreur_node->appendChild($erreur_text); - $this->log_node->appendChild($erreur_node); - $this->log_node->setAttribute("state","process"); - $this->store(); - } - - function add_fatal_error($error) - { - $this->add_error($error); - $this->log_node->setAttribute("state","error"); - $this->store(); - } - - function end() - { - if($this->log_node->getAttribute("state") != "error") - $this->log_node->setAttribute("state","done"); - $this->store(); - } - - function store() - { - $this->xml_file->formatOutput = true; - $this->xml_file->normalize(); - if(!$this->xml_file->save($this->xml_file_path)) - throw new Exception('Unable to store the document '.$this->xml_file_path); - } - - function purge($max_nb_log) - { - if( !$logs = $this->xml_file->getElementsByTagName("log") ) - return false; - else - { - if( $this->count() > $max_nb_log && $max_nb_log != 0 ) - { - $this->remove($logs->item(0)); - $this->purge($max_nb_log); - } - else - { - $this->store(); - } - return true; - } - } - -} -?> \ No newline at end of file diff --git a/modules/ldap/class/class_openLDAP.php b/modules/ldap/class/class_openLDAP.php deleted file mode 100755 index 6d129047d7bed4e8bea37a4aba2cb286c04b5c57..0000000000000000000000000000000000000000 --- a/modules/ldap/class/class_openLDAP.php +++ /dev/null @@ -1,287 +0,0 @@ -<?php - -class LDAP { - - protected $_domain=NULL; - protected $_hostname=NULL; - - /** - * Optional account with higher privileges for searching - * This should be set to a domain admin account - * - * @var string - * @var string - */ - protected $_login=NULL; - protected $_password=NULL; - - /** - * - * @var bool - */ - protected $_ssl=false; - - /* - * Connection and bind default variables - * - * @var mixed - * @var mixed - */ - protected $_conn; - protected $_bind; - - - function __construct($domain,$login,$password,$ssl='false',$hostname=null){ - - $this->_domain = $domain; - $this->_login = $login; - $this->_password = $password; - $this->_ssl = ($ssl == 'true'); - if( !empty($hostname) ) $this->_hostname = $hostname; - - // Connect to the openLDAP server as the username/password - if ($this->_ssl) - { - if( isset($this->_hostname) ) - $this->_conn = ldap_connect("ldaps://".$this->_hostname); - else - $this->_conn = ldap_connect("ldaps://".$this->_domain); - } - else - { - if( isset($this->_hostname) ) - $this->_conn = ldap_connect($this->_hostname); - else - $this->_conn = ldap_connect($this->_domain); - } - - - - // Set some ldap options for talking to sunLDAP - ldap_set_option($this->_conn, LDAP_OPT_PROTOCOL_VERSION, 3); - ldap_set_option($this->_conn, LDAP_OPT_REFERRALS, 0); - - // Bind as a domain admin if they've set it up - if ($this->_login!=NULL && $this->_password!=NULL){ - $this->_bind = @ldap_bind($this->_conn,$this->_login,$this->_password); - if (!$this->_bind){ - if ($this->_ssl) - { - throw new Exception ('FATAL: OpenLDAP bind failed. Either the LDAPS connection failed or the login credentials are incorrect.'); - } - else - { - throw new Exception ("FATAL: OpenLDAP bind failed. Check the login credentials."); - } - } - } - } - - /** - * Default Destructor - * - * Closes the LDAP connection - * - * @return void - */ - function __destruct(){ ldap_close($this->_conn); } - - /** - * Validate a user's login credentials - * - * @param string $username A user's AD username - * @param string $password A user's AD password - * @param bool optional $prevent_rebind - * @return bool - */ - public function authenticate($login,$password,$prevent_rebind=false){ - - // Prevent null binding - if ($login==NULL || $password==NULL){ return (false); } - - //On recherche le DN de l'utilisateur - $sr=ldap_search($this->_conn,"DC=".str_replace(".",",DC=",$this->_domain),"(uid=".$login.")",array("dn")); - - $entries = ldap_get_entries($this->_conn, $sr); - - if($entries['count'] != 1) - return false; - - // Bind as the user - try{ $this->_bind = @ldap_bind($this->_conn,$entries[0]['dn'],$password); } - catch(Exception $e){} - - if (!$this->_bind){ return (false); } - - // Cnce we've checked their details, kick back into admin mode if we have it - if ($this->_login!=NULL && !$prevent_rebind){ - $this->_bind = @ldap_bind($this->_conn,$this->_login,$this->_password); - if (!$this->_bind){ exit("FATAL: AD rebind failed."); } // This should never happen in theory - } - return (true); - } - - //***************************************************************************************************************** - // GROUP FUNCTIONS - - - /** - * Group Information. Returns an array of information about a group. - * The group name is the distinguishedname - * - * @param string $group_dn The group distinguishedname to retrieve info about - * @param array $fields Fields to retrieve - * @return array - */ - public function group_info($group_dn,$fields=array(),$dn='',$filter=''){ - - if ($group_dn==NULL){ return (false); } - if (!$this->_bind){ return (false); } - - if(count($fields) < 1) - $fields[] = "dn"; - - if(empty($dn)) - $dn="DC=".str_replace(".",",DC=",$this->_domain); - - $entries = array(); - $filter = "(&".$filter."(entrydn=".$group_dn."))"; - - $sr=ldap_search($this->_conn,$group_dn,$filter,$fields); - $entries = ldap_get_entries($this->_conn, $sr); - - if($entries['count'] != 1) - return array(); - - $ad_info_group = array(); - - foreach($fields as $fd) - { - if( $entries[0][$fd]['count'] > 1 ) - { - unset($entries[0][$fd]['count']); - $ad_info_group[$fd] = $entries[0][$fd]; - } - else - { - $ad_info_group[$fd] = $entries[0][$fd][0]; - } - } - - return $ad_info_group; - } - - - /** - * Return a list of all users in AD - * - * @param bool $include_desc Return a description of the user - * @param string $search Search parameter - * @param bool $sorted Sort the user accounts - * @return array - */ - public function all_users($fields=array(),$dn='',$filter=''){ - - if(empty($dn)) - $dn="DC=".str_replace(".",",DC=",$this->_domain); - - if (!$this->_bind){ return (false); } - - if(count($fields) < 1) - $fields[] = "dn"; - - $entries = array(); - - $filter = "(&".$filter.")"; - $sr=ldap_search($this->_conn,$dn,$filter,$fields); - - /*Condition qui permet de parcourir tout l'annuaire en prenant les utilisateurs par ordres alphabétiques. Ainsi, on peut surpasser les 1000 utilisateurs*/ - $countResult=ldap_count_entries($this->_conn,$sr); - - if($countResult == 1000) - { - // loop trough the number 97-122 (ASCII number for the characters a-z) - for($a=97;$a<=122;$a++) - { - // translate the number to a character - $character = chr($a); - // the new search filter withs returns all users with a last name starting with $character - $filterNew = "(&(sn=$character*)(objectClass=user)(objectCategory=person)".$filter.")"; - $results = ldap_search($this->_conn, $dn, $filterNew); - - $users = array(); - $users = ldap_get_entries($this->_conn,$results); - $entries = array_merge($entries, $users); - } - } - else - { - $users = ldap_get_entries($this->_conn,$sr); - $entries = array_merge($entries, $users); - } - - - /*permet de récupérer les utilisateurs (va prendre que les 1000 premiers. Il faudra commenter la condition ci-dessus*/ - //$entries = array_merge(ldap_get_entries($this->_conn, $sr),$entries); - - $ad_users = array(); - //for ($i=0; $i < 10; $i++) - for ($i=0; $i < (count($entries)-1); $i++) - { - foreach($fields as $fd) - { - if( $entries[$i][$fd]['count'] > 1 ) - { - unset($entries[$i][$fd]['count']); - $ad_users[$i][$fd] = $entries[$i][$fd]; - } - else - { - $ad_users[$i][$fd] = $entries[$i][$fd][0]; - } - } - } - - return $ad_users; - } - - public function all_groups($fields=array(),$dn='',$filter=''){ - - if(empty($dn)) - $dn="DC=".str_replace(".",",DC=",$this->_domain); - - if (!$this->_bind){ return (false); } - - if(count($fields) < 1) - $fields[]="dn"; - - $entries = array(); - - //Search for each filter - $filter = "(&".$filter.")"; - - $sr=ldap_search($this->_conn,$dn,$filter,$fields); - $entries = ldap_get_entries($this->_conn, $sr); - - for ($i=0; $i< ( count($entries) -1); $i++) - { - foreach($fields as $fd) - { - if( $entries[$i][$fd]['count'] > 1 ) - { - unset($entries[$i][$fd]['count']); - $ad_groups[$i][$fd] = $entries[$i][$fd]; - } - else - { - $ad_groups[$i][$fd] = $entries[$i][$fd][0]; - } - } - } - - return $ad_groups; - } - -} - -?> diff --git a/modules/ldap/process_entities_to_maarch.php b/modules/ldap/process_entities_to_maarch.php deleted file mode 100755 index d77bee05ea9d9c9f71a2601040ef28c9ef87da05..0000000000000000000000000000000000000000 --- a/modules/ldap/process_entities_to_maarch.php +++ /dev/null @@ -1,368 +0,0 @@ -<?php -session_start(); - -$fichier = 'ldap_entities'; - -echo "... CHARGEMENT DU FICHIER DE CONFIGURATION ...\n"; -if( !isset($argv) ){ - exit(htmlentities("Ce script ne peut-etre appelé qu'en PHP CLI")); -} - -else if( isset($argv) && count($argv) < 2){ - exit("/!\ Erreur de Syntaxe !\nLa syntaxe est $argv[0] <fichier de conf xml> <xml de sortie>\n\n"); -}else if(!file_exists($argv[1])){ - exit("/!\ Le fichier de configuration n'existe pas!\n\n"); -} -else -{ - $ldap_conf_file = trim($argv[1]); - echo "Fichier OK !\n\n"; -} -//Extraction de /root/config dans le fichier de conf -$ldap_conf = new DomDocument(); -try -{ - $ldap_conf->load($ldap_conf_file); -} -catch(Exception $e) -{ - exit("/!\ Impossible de charger le document : ".$ldap_conf_file."\n - Erreur : ".$e.getMessage."\n\n"); -} - -//**********************************// -// FILTER AND DNs // -//**********************************// -$i=0; -$xp_ldap_conf = new domxpath($ldap_conf); -foreach( $xp_ldap_conf->query("/root/filter/dn/@id") as $dn) -{ - - $type = $xp_ldap_conf->query("/root/filter/dn[@id= '".$dn->nodeValue."']/@type")->item(0)->nodeValue; //echo "for each filter ok\n"; - //$dn_and_filter[$i][$dn->nodeName] = $dn->nodeValue; - //echo "nodename : ".$dn_and_filter[$i][$dn->nodeName]."\n"; - if($type=='entities'){ - $dn_and_filter[$i]['id'] = $dn->nodeValue; - } -} -$xp_ldap_conf->query("/root/filter/dn/@id"); -unset($i); -$DnsEntities=array(); -foreach ($dn_and_filter as $key => $value) { - $DnsEntities[]=$value['id']; -} -//print_r($DnsEntities); -//Arguments - -//on charge le fichier config.xml pour pouvoir récupérer les données de connexion à la base de données. -$xml = simplexml_load_file($ldap_conf_file); -$host = $xml->config_base->databaseserver; -$dbname = $xml->config_base->databasename; -$user= $xml->config_base->databaseuser; -$password = $xml->config_base->databasepassword; - -//echo 'host : '.$host;echo "\n"; -//echo 'dbname :'.$dbname;echo "\n"; -//echo 'user : '.$user;echo "\n"; -//echo 'password :'.$password;echo "\n"; - -echo "... CONNEXION A LA BASE DE DONNEES MAARCH ...\n"; - -// Connexion, sélection de la base de données -try { - $db = new PDO("pgsql:host=$host;dbname=$dbname", "$user", "$password"); - echo 'Connexion OK'."\n\n"; - //exit; -} -catch(PDOException $e) { - $db = null; - echo '/!\ Erreur de connexion: ' . $e->getMessage()."\n\n"; - exit; -} -//exit; -/** -Les Fonctions -*/ - -/* -Fonction qui permet de récupérer l'information de la balise concernée dans le fichier xml -**/ -function infoBalise($description, $balise) -{ - if($description == NULL) { - return $contenu = '';} - else{ - $contenu = NULL; - $contenubalise = $description ->getElementsByTagName($balise); - foreach($contenubalise as $contenu) - $contenu = $contenu->firstChild->nodeValue . ""; - return $contenu ; - } - } - - - function insertThisEntity($entityId, $entity_label,$xml_ldap_id, $db){ - $short_label = substr($entity_label, 0, 49); - $qry = $db->prepare("INSERT into entities (entity_id, entity_label, short_label,entity_type,ldap_id, enabled) values (?,?,?,?,?,?) "); - $qry->execute(array($entityId,$entity_label,$short_label,'Direction',$xml_ldap_id,'Y')); - $result = $qry->fetchAll(); - if($result==null){ - echo "/!\ Error : L'entité $entity_label n'a pas été insérée !\n"; - - }else{ - echo "... L'entité $entity_label a été insérée ...\n"; - } - - } - - function seekLdapId($xml_ldap_id,$db){ - - $qry = $db->prepare("SELECT ldap_id from entities where ldap_id = ?"); - $qry->execute(array($xml_ldap_id)); - - while($row = $qry->fetch()){ - $info = $row['ldap_id']; - } - return $info; - - } - - function seekEntityId($xml_ldap_id,$db){ - - $qry = $db->prepare("SELECT entity_id from entities where ldap_id = ?"); - $qry->execute(array($xml_ldap_id)); - while($row = $qry->fetch()){ - $info = $row['entity_id']; - } - return $info; - - } - - - function updateEntity($entityId, $xml_entity_label, $xml_entity_ldap_id, $xml_parent_entity_id, $db){ - $short_label = substr($xml_entity_label, 0, 49); - if($xml_parent_entity_id != ''){ - //echo "UPDATE entities SET (entity_label,parent_entity_id) VALUES ('$xml_entity_label','$xml_parent_entity_id') WHERE entity_id = '$entityId'"; - $qry = $db->prepare("UPDATE entities SET entity_label = ?, short_label = ?, parent_entity_id = ? WHERE entity_id = ?"); - $qry->execute(array($xml_entity_label,$short_label,$xml_parent_entity_id,$entityId)); - }else{ - //echo "UPDATE entities SET entity_label ='$xml_entity_label' WHERE entity_id = '$entityId'"; - $qry = $db->prepare("UPDATE entities SET entity_label = ?, short_label = ? WHERE entity_id = ?"); - $qry->execute(array($xml_entity_label,$short_label,$entityId)); - } - $result = $qry->fetchAll(); - //print_r($qry->errorInfo()); - if(!$qry){ - echo "/!\ Error : les donnees n'ont pas ete mis a jour ! \n"; - print_r($qry->errorInfo()); - }else{ - echo "... les donnees ont ete mis a jour ...\n"; - } - } - - function deleteOldEntities($tableau, $db) - { - //print_r($tableau); - $entitiesXml= "'".implode("','",$tableau)."'"; - //echo $entitiesXml; - $select = "update entities set enabled = 'N' where ldap_id not in ($entitiesXml)"; - //print_r($select); - $qry= $db->prepare($select); - $qry->execute(array()); - - } - - function seekLastInsertId($db) - { - $info = null; - $qry = $db->prepare("SELECT max(cast(substring(entity_id,5) as integer)) as id from entities order by id asc"); - $qry->execute(array()); - while($row = $qry->fetch()){ - $info = $row['id']; - - } - if($info == null){return 100;}else{return $info;} - } - - - -/** -Chargement du fichier xml -*/ - -$xp_ldap_conf = new domxpath($ldap_conf); - -foreach($xp_ldap_conf->query("/root/config/ldap/*") as $cf) - ${$cf->nodeName} = $cf->nodeValue; - -//Si une class custom est définie -echo "type ldap : ".$type_ldap."\n"; -if( file_exists(dirname($ldap_conf_file)."/../class/class_".$type_ldap.".php") ) - include(dirname($ldap_conf_file)."/../class/class_".$type_ldap.".php"); - -//Sinon si la class est définie pour le module -else if( file_exists(dirname($ldap_conf_file)."/../../../../../modules/ldap/class/class_".$type_ldap.".php") ) - include(dirname($ldap_conf_file)."/../../../../../modules/ldap/class/class_".$type_ldap.".php"); - -//Sinon -else - exit("Impossible de charger class_".$type_ldap.".php\n"); - -//**********************************// -// LDAP CONNECTION // -//**********************************// - -echo "... CONNEXION A L'ANNUAIRE $type_ldap ...\n"; -//Try to create a new ldap instance -try -{ - if($prefix_login != ''){ - $login_admin =$prefix_login."\\".$login_admin; - } - $ad = new LDAP($domain,$login_admin,$pass,false); - echo "Connexion Ldap ok\n\n"; -} -catch(Exception $con_failure) -{ - exit("/!\ Impossible de se connecter à l'annuaire\n - Erreur : ".$con_failure->getMessage()."\n\n"); -} - -/*Lecture du fichier xml des entités pour remplir la table entities*/ - -$dom = new DomDocument(); -$dom->load('../xml/'.$fichier.'.xml'); -//$tableau=array(); - -echo "... TRAITEMENT du fichier $fichier ...\n"; - -/*On compte le nombre d'item dans le fichier xml. Ceci est réalisé car le nom de la balise est item suivi d'un chiffre*/ -for($m = 0; ; $m++) -{ - $nomItem = 'item_'.$m; - $list = $dom->getElementsByTagName("ldap_info")->item(0); - $listItem = $list->getElementsByTagName($nomItem)->item(0); - if($listItem == NULL){break;} -} - - -/** -Lecture du fichier ldap.xml des entités pour mise à jours des données de la table entities -*/ -/*Boucle qui permet de travailler sur les données contenues dans le fichier xml. On récupère les données puis on les insère dans la table entities en parcourant le fichier ldap.xml*/ -//$ldapEntityId = 1000; -$array_ldap_id = array(); - - -for($k = 0; $k<$m; $k++) -{ - $valeurLastInsert = seekLastInsertId($db); - - $entityId = $valeurLastInsert; - - $nomItemGroups = 'item_'.$k; - - $list = $dom->getElementsByTagName("ldap_info")->item(0); - $listItem = $list->getElementsByTagName($nomItemGroups)->item(0); - $xml_ldap_id = infoBalise($listItem, 'xml_ldap_id'); - $xml_entity_label = infoBalise($listItem, 'xml_entity_label'); - echo("=============== $xml_entity_label ===============\n"); - echo("-------------Informations-------------\n"); - echo "+ xml : $nomItemGroups\n"; - echo "+ ldap_id : $xml_ldap_id\n"; - echo "+ entity_label : $xml_entity_label\n"; - echo("--------------------------------------\n\n"); - $db_ldap_id = seekLdapId($xml_ldap_id,$db); - if($db_ldap_id == '' || $db_ldap_id == NULL){ - $entityId++; - $entityId = 'ldap'.$entityId; - echo "L'entite entity_label n'existe pas ..."; - echo "... generation de l'entity_id ... valeur ... $entityId\n"; - echo "... insertion de l'entité ...\n"; - insertThisEntity($entityId, $xml_entity_label, $xml_ldap_id, $db); - - - }else{ - echo "L'entite existe deja ...\n"; - $entityId = seekEntityId($xml_ldap_id,$db); - echo "... entity_id : $entityId ...\n"; - echo "... mise à jour ...\n"; - updateEntity($entityId, $xml_entity_label, $xml_ldap_id,'', $db); - - } - $array_ldap_id[]= $xml_ldap_id; - - //Recuperation de la branche des parent_entity - $listsParent = $listItem->getElementsByTagName("xml_parent_entity")->item(0); - /*On compte le nombre d'item xml dans la balise xml_user_entity. Ceci est réalisé car le nom de la balise est item suivi d'un chiffre*/ - - //$nb_parents = $listsParent->lastChild->previousSibling->tagName; - $nb_parents = $listsParent->lastChild->tagName; - - //exit('NOMBRE PARENTS : '.$nb_parents); - if($nb_parents != ''){ - $nb_parents = explode('_', $nb_parents); - - - $nb_parents = $nb_parents[1]; - - echo("\n-------------Entite Parente de $xml_entity_label-------------\n"); - for($q=0; $q<=$nb_parents; $q++){ - $nomXml = 'xml_'.$q; - $parent_entityDn = infoBalise($listsParent, 'xml_'.$q); - //echo $parent_entityDn."\n"; - - - if (preg_match('/'.$DnsEntities[0].'/', $parent_entityDn)) { - $xml_parent_entity_ldap_id = $ad->group_info($parent_entityDn,array('objectguid'),$DnsEntities[0]); - $xml_parent_entity_label = $ad->group_info($parent_entityDn,array('samaccountname'),$DnsEntities[0]); - - if(empty($xml_entity_label) || empty($xml_parent_entity_ldap_id)){ - echo "Entité non trouvé dans l'AD!"; - break; - } - - $xml_parent_entity_ldap_id=$xml_parent_entity_ldap_id['objectguid']; - $xml_parent_entity_label=$xml_parent_entity_label['samaccountname']; - - echo "+ xml : $nomXml\n"; - echo "+ DN : $parent_entityDn\n"; - echo "+ ldap_id : $xml_parent_entity_ldap_id\n"; - echo "+ entity_label : $xml_parent_entity_label\n\n"; - - $db_parent_ldap_id = seekLdapId($xml_parent_entity_ldap_id,$db); - if($db_parent_ldap_id == null){ - $parentEntityId = $entityId; - $parentEntityId=explode('ldap', $parentEntityId); - $parentEntityId[1]++; - $parentEntityId = 'ldap'.$parentEntityId[1]; - echo "L'entite $xml_parent_entity_label, parente de $xml_entity_label, n'existe pas\n"; - echo "... insertion ...\n"; - //ajouter function d'insertion de cette entite - insertThisEntity($parentEntityId, $xml_parent_entity_label, $xml_parent_entity_ldap_id, $db); - - //echo "Mise à jour de l'entité $xml_entity_label, fille de $xml_parent_entity_label\n"; - echo "... liaison de $xml_entity_label à $xml_parent_entity_label ...\n"; - updateEntity($entityId, $xml_entity_label, $xml_ldap_id,$parentEntityId, $db); - - }else{ - - echo "L'entite $xml_parent_entity_label, parente de $xml_entity_label existe deja\n"; - echo "... mise a jour ...\n"; - $parentEntityId = seekEntityId($xml_parent_entity_ldap_id,$db); - updateEntity($parentEntityId, $xml_parent_entity_label, $xml_parent_entity_ldap_id, '', $db); - - echo "... liaison de $xml_entity_label à $xml_parent_entity_label ...\n"; - updateEntity($entityId, $xml_entity_label, $xml_ldap_id,$parentEntityId, $db); - } - - } - } - echo "-------------------------------------------\n"; - } - echo("==========================================\n\n"); -} -deleteOldEntities($array_ldap_id, $db); - - -?> diff --git a/modules/ldap/process_ldap_to_xml.php b/modules/ldap/process_ldap_to_xml.php deleted file mode 100755 index c50b1f5ae2bd5afe62c06b9c0df42172cbcfbb2c..0000000000000000000000000000000000000000 --- a/modules/ldap/process_ldap_to_xml.php +++ /dev/null @@ -1,358 +0,0 @@ -<?php - -// function defination to convert array to xml -function array_to_xml($ldap_info, &$xml_ldap_info) { - foreach($ldap_info as $key => $value) { - if(is_array($value)) { - if(!is_numeric($key)){ - $subnode = $xml_ldap_info->addChild("xml_$key"); - array_to_xml($value, $subnode); - } - else{ - $subnode = $xml_ldap_info->addChild("item_$key"); - array_to_xml($value, $subnode); - } - } - else { - $xml_ldap_info->addChild("xml_$key",htmlspecialchars("$value")); - } - } -} -function fusionTableau($list_users,$user_fields_nodename){ - $t4 = array(); - $nombreLigneTableau = count($list_users); - //echo $nombreLigneTableau; - for($i=0; $i<$nombreLigneTableau;$i++){ - foreach($list_users as &$values){ - $t1 = $list_users[$i]; - } - $t1_ = array_values($t1); - $t2 = $user_fields_nodename; - $t2_ = array_values($t2); - $valeurUtilisateur = array(); - foreach ($t1_ as $o => $v1) { - $v2 = $t2_[$o]; - $valeurUtilisateur[$v2] = $v1; - } - $tableauComplet[]=$valeurUtilisateur; - } - //var_dump($tableauComplet); - return $tableauComplet; -} - -//Arguments - -if( !isset($argv) ) - exit(htmlentities("Ce script ne peut-etre appelé qu'en PHP CLI")); - -else if( isset($argv) && count($argv) < 2) - exit("Erreur de Syntaxe !\nLa syntaxe est $argv[0] <fichier de conf xml> <xml de sortie>"); - -else -{ - $ldap_conf_file = trim($argv[1]); -} - -//Extraction de /root/config dans le fichier de conf -$ldap_conf = new DomDocument(); -try -{ - $ldap_conf->load($ldap_conf_file); -} -catch(Exception $e) -{ - exit("Impossible de charger le document : ".$ldap_conf_file."\n - Erreur : ".$e.getMessage."\n"); -} - - -$xp_ldap_conf = new domxpath($ldap_conf); - -foreach($xp_ldap_conf->query("/root/config/ldap/*") as $cf) - ${$cf->nodeName} = $cf->nodeValue; - -//Si une class custom est définie -echo "type ldap : ".$type_ldap."\n"; -if( file_exists(dirname($ldap_conf_file)."/../class/class_".$type_ldap.".php") ) - include(dirname($ldap_conf_file)."/../class/class_".$type_ldap.".php"); - -//Sinon si la class est définie pour le module -else if( file_exists(dirname($ldap_conf_file)."/../../../../../modules/ldap/class/class_".$type_ldap.".php") ) - include(dirname($ldap_conf_file)."/../../../../../modules/ldap/class/class_".$type_ldap.".php"); - -//Sinon -else - exit("Impossible de charger class_".$type_ldap.".php\n"); - -//**********************************// -// LDAP CONNECTION // -//**********************************// - -//Try to create a new ldap instance -try -{ - if(!empty($prefix_login)){ - $login_admin =$prefix_login."\\".$login_admin; - } - if (!empty($suffix_login)) { - $login_admin = $login_admin . $suffix_login; - } - $ad = new LDAP($domain,$login_admin,$pass,false); - //echo "connection Ldap ok\n"; -} -catch(Exception $con_failure) -{ - exit("Impossible de se connecter à l'annuaire\n - Erreur : ".$con_failure->getMessage()."\n"); -} - -//**********************************// -// MAPPING // -//**********************************// - - -//User -foreach( $xp_ldap_conf->query("/root/mapping/user/@* | /root/mapping/user/* | /root/mapping/user/*/@*") as $us) - if( !empty($us->nodeValue) ){ - //$us_user_fieldname = $us->nodeName; - //$user_fields_nodename[$us->nodeName] = $us->nodeName; - $user_fields[$us->nodeValue] = $us->nodeValue; - //var_dump($user_fields); - } - -foreach( $xp_ldap_conf->query("/root/mapping/user/@* | /root/mapping/user/* | /root/mapping/user/*/@*") as $us) - if( !empty($us->nodeValue) ){ - //$us_user_fieldname = $us->nodeName; - $user_fields_nodename[$us->nodeName] = $us->nodeName; - //$user_fields[$us->nodeValue] = $us->nodeValue; - //var_dump($user_fields_nodename); - } - -//Group -foreach( $xp_ldap_conf->query("/root/mapping/entity/@* | /root/mapping/entity/* | /root/mapping/entity/*/@*") as $gs) - if( !empty($gs->nodeValue) ){ - $group_fields_nodename[$gs->nodeName] = $gs->nodeName; - } - -foreach( $xp_ldap_conf->query("/root/mapping/entity/@* | /root/mapping/entity/* | /root/mapping/entity/*/@*") as $gs) - if( !empty($gs->nodeValue) ){ - $group_fields[$gs->nodeValue] = $gs->nodeValue; - } - -//**********************************// -// FILTER AND DNs // -//**********************************// - -$i=0; -foreach( $xp_ldap_conf->query("/root/filter/dn/@id") as $dn) -{ - //echo "for each filter ok\n"; - $dn_and_filter[$i][$dn->nodeName] = $dn->nodeValue; - //echo "nodename : ".$dn_and_filter[$i][$dn->nodeName]."\n"; - if(empty($dn_and_filter[$i][$dn->nodeName])){ - $dn_and_filter[$i][$dn->nodeName]= "DC=".str_replace(".",",DC=",$domain); - } - //echo "nodename2 : ".$dn_and_filter[$i][$dn->nodeName]."\n"; - //echo "domain : ".$domain."\n"; - $dn_and_filter[$i]['type'] = $xp_ldap_conf->query("/root/filter/dn[@id= '".$dn->nodeValue."']/@type")->item(0)->nodeValue; - if(empty($dn_and_filter[$i]['type'])){ - $dn_and_filter[$i]['type'] = "users"; //Valeur par defaut - } - - $dn_and_filter[$i]['user'] = $xp_ldap_conf->query("/root/filter/dn[@id= '".$dn->nodeValue."']/user")->item(0)->nodeValue; - if(empty($dn_and_filter[$i]['user'])){ - $dn_and_filter[$i]['user'] = "(cn=*)"; //Valeur par defaut - } - - $dn_and_filter[$i]['group'] = $xp_ldap_conf->query("/root/filter/dn[@id='".$dn->nodeValue."']/entity")->item(0)->nodeValue; - if(empty($dn_and_filter[$i]['group'])){ - $dn_and_filter[$i]['group'] = "(cn=*)"; //Valeur par defaut - } - $i++; - //echo "i : ".$i."\n"; -} -unset($i); - -//Aucun DN de défini : on prend tout l'annuaire en mode organization -if(count($dn_and_filter) < 1) -{ - //echo "dn and filter <1 \n"; - $dn_and_filter[0]['id'] = "DC=".str_replace(".",",DC=",$domain); - $dn_and_filter[0]['type'] = "users"; - $dn_and_filter[0]['user'] = "(cn=*)"; - $dn_and_filter[0]['group'] = "(cn=*)"; -} - -//**********************************// -// XML OUT // -//**********************************// -$out_xml = new DomDocument('1.0', 'UTF-8'); -$xp_out = new domxpath($out_xml); - -$dns = $out_xml->createElement('dns'); -$out_xml->appendChild($dns); - -//**********************************// -// XML FUNCTIONS // -//**********************************// - -function createUserNode($parent,$user) -{ - - global $out_xml, $ad, $user_fields, $group_fields; - - if($parent == null || count($user) < 1 ) - return null; - - $u_node = $out_xml->createElement("user"); - //var_dump($u_node); - foreach($user as $k_fd => $v_fd) - { - if( $k_fd == "dn" || $k_fd == "ext_id"){ - $u_node->setAttribute($k_fd,$v_fd); - } - else if($k_fd == "memberof" && count($v_fd) > 0) - { - $mbof = $out_xml->createElement($k_fd); - - if( isset($user['role']) ) - $mbof->setAttribute("role",$user['role']); - - for($i=0;$i<count($v_fd);$i++) - { - $tmp_g_inf = groupInfo($v_fd[$i]); - - if( !empty( $tmp_g_inf ) ) - { - $mbof->appendChild( createGroupNode($mbof,$tmp_g_inf) ); - } - } - - if($mbof->hasChildNodes()) - $u_node->appendChild($mbof); - } - else if($k_fd == "memberof" && count($v_fd) < 1) - { - //Si l'utilisateur n'est membre d'aucun groupe : Rien à faire - } - else if($k_fd == 'role') - { - //Traité dans memberof - } - else{ - //var_dump($out_xml); - $createContenuElement = $out_xml->createElement($k_fd,$v_fd); - $u_node->appendChild($createContenuElement); - } - - - } - //var_dump($u_node); - return $u_node; -} - -function createGroupNode($parent,$group) -{ - global $out_xml, $ad, $user_fields, $group_fields; - - if($parent == null || count($group) < 1 ){ - return null; - } - - $g_node = $out_xml->createElement("group"); - - foreach($group as $k_fd => $v_fd) - { - if( $k_fd == "dn" || $k_fd == "ext_id" ){ - $g_node->setAttribute($k_fd,$v_fd); - } - - else if($k_fd == "memberof" && count($v_fd) > 0) - { - $mbof = $out_xml->createElement($k_fd); - - for($i=0;$i<count($v_fd);$i++) - { - $tmp_g_inf = groupInfo($v_fd[$i]); - - if( !empty( $tmp_g_inf ) ) - $mbof->appendChild( createGroupNode($mbof,$tmp_g_inf) ); - } - - if($mbof->hasChildNodes()) - $g_node->appendChild($mbof); - } - else if($k_fd == "memberof" && count($v_fd) < 1) - { - //Si le groupe n'est membre d'aucun groupe : Rien à faire - } - else - $g_node->appendChild($out_xml->createElement($k_fd,$v_fd)); - } - - return $g_node; -} - -function groupInfo($group_dn) -{ - global $ad, $group_fields, $dn_and_filter; - - if(!empty($dn_and_filter)){ - foreach($dn_and_filter as $dn_fil) - { - $tmp_g_inf = $ad->group_info($group_dn,array_values($group_fields),$dn_fil['id'],$dn_fil['group']); - - if( !empty($tmp_g_inf) ) - { - $group_node = array(); - foreach($group_fields as $k_gf => $v_gf) - $group_node[$k_gf] = $tmp_g_inf[$v_gf]; - - return $group_node; - } - } - return null; - } -} - -//**********************************// -// USER // -//**********************************// -if(!empty($dn_and_filter)){ - foreach($dn_and_filter as $dn_fil) - { - //var_dump($dn_and_filter); - //Pour chaque DN on extrait les utilisateurs comme feuilles du DN - - $dn = $out_xml->createElement('dn'); - $dn->setAttribute("id",$dn_fil['id']); - $dns->appendChild($dn); - $type = $dn_fil['type']; - $list_users = array(); - if($type == 'users'){ - //$user_fields = array("user_id" => "uid", "mail" => "mail"); - $xml_ldap_info = new SimpleXMLElement("<?xml version=\"1.0\"?><ldap_info></ldap_info>"); - $list_users = $ad->all_users(array_values($user_fields),$dn_fil['id'],$dn_fil['user']); - $user_node = array(); - // creating object of SimpleXMLElement - // function call to convert array to xml - $ldap_info = fusionTableau($list_users,$user_fields_nodename); - array_to_xml($ldap_info,$xml_ldap_info); - - //saving generated xml file - $xml_ldap_info->asXML('../xml/ldap_users.xml'); - echo "File ldap_users.xml created\n"; - }elseif($type == 'entities'){ - $xml_ldap_info = new SimpleXMLElement("<?xml version=\"1.0\"?><ldap_info></ldap_info>"); - $list_groups = $ad->all_groups(array_values($group_fields),$dn_fil['id'],$dn_fil['groups']); - $user_node = array(); - // creating object of SimpleXMLElement - // function call to convert array to xml - $ldap_info = fusionTableau($list_groups,$group_fields_nodename); - array_to_xml($ldap_info,$xml_ldap_info); - $xml_ldap_info->asXML('../xml/ldap_entities.xml'); - echo "File ldap_entities.xml created\n"; - } - } - -} diff --git a/modules/ldap/process_users_entities_to_maarch.php b/modules/ldap/process_users_entities_to_maarch.php deleted file mode 100755 index 6798dfcf8ce984c681adfd2e0cab750d3da94469..0000000000000000000000000000000000000000 --- a/modules/ldap/process_users_entities_to_maarch.php +++ /dev/null @@ -1,401 +0,0 @@ -<?php -session_start(); -//on charge le fichier config.xml du dossier apps/maarch_entreprise/xml pour pouvoir récupérer les données de connexion à la base de données. -//$xml = simplexml_load_file('../../../apps/maarch_entreprise/xml/config.xml'); -$nomFichier = date('Y-m-d_H-i-s') . '.log'; //nom du fichier log enregistrer dans le dossier logLdap - -$fichier = 'ldap_users'; - -echo "... CHARGEMENT DU FICHIER DE CONFIGURATION ...\n"; -if (!isset($argv)) { - exit(htmlentities("Ce script ne peut-etre appelé qu'en PHP CLI")); -} elseif (isset($argv) && count($argv) < 2) { - exit("Erreur de Syntaxe !\nLa syntaxe est $argv[0] <fichier de conf xml> <xml de sortie>\n\n"); -} elseif (!file_exists($argv[1])) { - exit("/!\ Le fichier de configuration n'existe pas!\n\n"); -} else { - $ldap_conf_file = trim($argv[1]); - echo "Fichier OK !\n\n"; -} -//Extraction de /root/config dans le fichier de conf -$ldap_conf = new DomDocument(); -try { - $ldap_conf->load($ldap_conf_file); -} catch (Exception $e) { - exit("/!\ Impossible de charger le document : ".$ldap_conf_file."\n - Erreur : ".$e.getMessage."\n\n"); -} - -//**********************************// -// FILTER AND DNs // -//**********************************// -$i=0; -$xp_ldap_conf = new domxpath($ldap_conf); -foreach ($xp_ldap_conf->query("/root/filter/dn/@id") as $dn) { - $type = $xp_ldap_conf->query("/root/filter/dn[@id= '".$dn->nodeValue."']/@type")->item(0)->nodeValue; //echo "for each filter ok\n"; - //$dn_and_filter[$i][$dn->nodeName] = $dn->nodeValue; - //echo "nodename : ".$dn_and_filter[$i][$dn->nodeName]."\n"; - if ($type=='entities') { - $dn_and_filter[$i]['id'] = $dn->nodeValue; - } -} -unset($i); -$DnsEntities=array(); -foreach ($dn_and_filter as $key => $value) { - $DnsEntities[]=$value['id']; -} -//print_r($DnsEntities); - -//on charge le fichier config.xml pour pouvoir récupérer les données de connexion à la base de données. -$xml = simplexml_load_file($ldap_conf_file); -$host = $xml->config_base->databaseserver; -$dbname = $xml->config_base->databasename; -$user= $xml->config_base->databaseuser; -$password = $xml->config_base->databasepassword; - -//echo 'host : '.$host;echo "\n"; -//echo 'dbname :'.$dbname;echo "\n"; -//echo 'user : '.$user;echo "\n"; -//echo 'password :'.$password;echo "\n"; - -echo "... CONNEXION A LA BASE DE DONNEES MAARCH ...\n"; - -// Connexion, sélection de la base de données -try { - $db = new PDO("pgsql:host=$host;dbname=$dbname", "$user", "$password"); - echo 'Connexion OK'."\n\n"; -} catch (PDOException $e) { - $db = null; - echo '/!\ Erreur de connexion: ' . $e->getMessage()."\n\n"; - exit; -} - -$xp_ldap_conf = new domxpath($ldap_conf); - -foreach ($xp_ldap_conf->query("/root/config/ldap/*") as $cf) { - ${$cf->nodeName} = $cf->nodeValue; -} - -//Si une class custom est définie - -if (file_exists(dirname($ldap_conf_file)."/../class/class_".$type_ldap.".php")) { - include(dirname($ldap_conf_file)."/../class/class_".$type_ldap.".php"); -} - -//Sinon si la class est définie pour le module -elseif (file_exists(dirname($ldap_conf_file)."/../../../../../modules/ldap/class/class_".$type_ldap.".php")) { - include(dirname($ldap_conf_file)."/../../../../../modules/ldap/class/class_".$type_ldap.".php"); -} - -//Sinon -else { - exit("Impossible de charger class_".$type_ldap.".php\n"); -} - -//**********************************// -// LDAP CONNECTION // -//**********************************// - -echo "... CONNEXION A L'ANNUAIRE $type_ldap ...\n"; -//Try to create a new ldap instance -try { - if ($prefix_login != '') { - $login_admin =$prefix_login."\\".$login_admin; - } - $ad = new LDAP($domain, $login_admin, $pass, false); - echo "Connexion Ldap ok\n\n"; -} catch (Exception $con_failure) { - exit("/!\ Impossible de se connecter à l'annuaire\n - Erreur : ".$con_failure->getMessage()."\n\n"); -} - -/** -Les Fonctions -*/ - - -/* -Fonction qui permet de récupérer l'information de la balise concernée dans le fichier xml -**/ -function infoBalise($description, $balise) -{ - if ($description == null) { - return $contenu = ''; - } else { - $contenu = null; - $contenubalise = $description ->getElementsByTagName($balise); - foreach ($contenubalise as $contenu) { - $contenu = $contenu->firstChild->nodeValue . ""; - } - //echo $contenu."\n"; - return $contenu ; - } -} - - - /*Fonction qui va llire les memberofs du ldap.xml*/ - function infoMemberOf($description, $balise, $OU) - { - if ($description == null) { - return $contenu = ''; - } else { - $contenu = null; - $contenubalise = $description ->getElementsByTagName($balise); - foreach ($contenubalise as $contenu) { - $contenu = $contenu->firstChild->nodeValue . ""; - } - $nomGroupe = strstr($contenu, $OU, true); - if ($nomGroupe != false and $contenu != null) { - return $contenu; - } elseif ($nomGroupe == false and $contenu == null) { - return null; - } elseif ($nomGroupe == false and $contenu !=null) { - return ok; - } - } - } - - - /*Fonction qui va vérifier si l'utilisateur est dans la table des users ou non*/ - function verifUser($user_id, $db) - { - $qry = $db->prepare("SELECT * from users where upper(user_id) = upper(?)"); - $qry->execute(array($user_id)); - while ($row = $qry->fetch()) { - $user_id = $row['user_id']; - if ($user_id == null) { - echo "le pseudo $user_id n'a pas été trouvé dans la base !"; - return false; - } else { - echo "le pseudo $user_id a été trouvé dans la base"; - return true; - } - } - } - - /*Fonction qui va vérifier les données de l'utilisateur dans la table users. Si il y a des données qui ne sont pas à jour, la fonction fait le update pour mettre à jour. */ - function verifUpdate($user_id, $firstname, $lastname, $phone, $mail, $employeNumber, $db) - { - $qry = $db->prepare("SELECT * from users where upper(user_id) = upper(?) and firstname = ? and lastname = ? and phone = ? and mail = ? and custom_t3 = ? and status = 'OK'"); - $qry->execute(array($user_id,$firstname,$lastname,$phone,$mail,$employeNumber)); - $result = $qry->fetchAll(); - if ($result==null) { - echo "les donnees doivent etre mis a jour !"; - $qry = $db->prepare("UPDATE users set user_id = ?, firstname = ? , lastname = ? , phone = ? , mail = ?,custom_t3 = ?, status = 'OK', loginmode = 'standard' where upper(user_id) = upper(?) "); - $result = $qry->execute(array($user_id,$firstname,$lastname,$phone,$mail,$employeNumber,$user_id)); - $result = $qry->fetchAll(); - if ($result==null) { - echo "Error, données non mises à jours!"; - } else { - echo "données mises à jour!"; - } - } else { - echo "les donnees de users sont a jour \n"; - return true; - } - } - - /*Function qui va insérer l'utilisateur dans la table des users. Si l'utilisateur n'est pas présent, on lui done le mot de passe de maarch*/ - function insertUser($user_id, $firstname, $lastname, $phone, $mail, $employeNumber, $db) - { - $qry = $db->prepare("INSERT into users (user_id, password, firstname, lastname, phone, mail, custom_t3, enabled, status,loginmode) values (upper(?),'ef9689be896dacd901cae4f13593e90d',?,?,?,?,?,'Y','OK','standard')"); - $qry->execute(array($user_id,$firstname,$lastname,$phone,$mail,$employeNumber)); - $result = $qry->fetchAll(); - if ($result==null) { - echo "Error : les donnees n'ont pas ete ajouté !\n"; - return false; - } else { - echo "la ligne a été ajouté \n"; - return true; - } - } - - - /*Fonction qui va supprimer tous les users de la table users_entities lorsque les entitées ne sont pas présente dans le ldap*/ - function deleteUsersEntities($idEntitiesTab, $user_id, $db) - { - $qry ="SELECT * from users_entities where user_id ='$user_id' and "; - $qry .= " entity_id not in ('".implode("','", $idEntitiesTab)."')"; - $qry = $db->prepare($qry); - $qry->execute(); - $result = $qry->fetchAll(); - if (!empty($result)) { - echo "Dissociation des anciens services affectes aux utilisateurs ...\n"; - $qry = "delete from users_entities where user_id ='$user_id' and "; - $qry .= " entity_id not in ('".implode("','", $idEntitiesTab)."')"; - $qry = $db->prepare($qry); - $qry->execute(); - $result = $qry->fetchAll(); - } else { - echo "les services sont a jour pour l'utilisateur $user_id! \n"; - } - } - - - - /*Fontion qui va écrire dans le fichier log . Cela permet de faire un suivie du processus*/ - function ecrire_log($event, $nomFichier) - { - -/* $fp = fopen('var/www/html/maarch_entreprise_prod/modules/ldap/logLdap/'.$nomFichier,'a+'); // ouvrir le fichier ou le créer - fseek($fp,SEEK_END); // poser le point de lecture à la fin du fichier - $nouverr=date('Y-m-d_H-i-s')." : ".$event."\r\n"; // ajouter un retour à la ligne au fichier - fputs($fp,$nouverr); // ecrire ce texte - fclose($fp); //fermer le fichier */ - } - - - - function seekEntityId($ldap_id, $db) - { - $qry = $db->prepare("SELECT entity_id, entity_label from entities WHERE ldap_id= ? "); - if ($qry->execute(array($ldap_id))) { - while ($row = $qry->fetch()) { - //echo "la valeur de la requete pour seekParentEntityId est : ".$row['entity_id']."\n"; - $info = $row['entity_id']; - } - } - return $info; - } - - - function insertUserEntity($pseudo, $entity_id, $db) - { - $is_primary='Y'; - $qry=$db->prepare("SELECT * from users_entities where user_id = ?"); - $qry->execute(array($pseudo)); - $result = $qry->fetchAll(); - if (empty($result)) { - $is_primary='Y'; - } else { - $is_primary='N'; - } - - $qry=$db->prepare("SELECT * from users_entities where user_id = ? and entity_id = ? "); - $result = null; - $qry->execute(array($pseudo,$entity_id)); - $result = $qry->fetchAll(); - //print_r($qry->errorInfo()); - if ($result != null) { - echo "les donnees de users_entities sont a jour \n"; - } else { - echo "les donnees de users_entities doivent etre mis a jour!"; - $qry2=$db->prepare("INSERT into users_entities (user_id,entity_id, primary_entity) values (?,?,?)"); - $result2 = $qry2->execute(array($pseudo, $entity_id, $is_primary)); - //print_r($qry2->errorInfo()); - $result2 = $qry2->fetchAll(); - if ($result2 ==null) { - echo "Error, aucun users_entities n'a ete ajoute \n"; - } else { - echo "Insertion du users_entities effectue! \n"; - } - } - } - -/** -Chargement du fichier xml -*/ - -$dom = new DomDocument(); -echo "... TRAITEMENT du fichier $fichier ...\n"; -if (!($dom->load('../xml/'.$fichier.'.xml'))) { - //echo "fichier : ".$fichier; - $event = "Unable to load : " . $fichier.'.xml'."\n"; - echo $event; - //ecrire_log($event,$nomFichier); - exit(); -} else { - $event = "able to load : " . $fichier.'.xml'."\n"; - echo $event; - //ecrire_log($event,$nomFichier); -} - - -/*On compte le nombre d'item dans le fichier xml. Ceci est réalisé car le nom de la balise est item suivi d'un chiffre*/ -for ($m = 0; ;$m++) { - $nomItem = 'item_'.$m; - $list = $dom->getElementsByTagName("ldap_info")->item(0); - $listItem = $list->getElementsByTagName($nomItem)->item(0); - if ($listItem == null) { - break; - } -} - - -/** -Lecture du fichier ldap.xml des users pour mise à jours des données des tables users et users_entities -*/ - - -$idUsersTab= array('superadmin'); //Ce tableau est initialisé avec superadmin pour qu'il ne soit pas passé en DEL lors de la mise à jour des users. -/*Boucle qui permet de travailler sur les données contenues dans le fichier xml. On récupère les données puis on les insère dans la table users_entities*/ -for ($i = 0; $i<$m ; $i++) { - $nomItem = 'item_'.$i; - - $list = $dom->getElementsByTagName("ldap_info")->item(0); - $listItem = $list->getElementsByTagName($nomItem)->item(0); - - $user_id = infoBalise($listItem, 'xml_user_id'); - - if ($user_id == null) { - $event = "Id du User de l'$nomItem absent, arret du processus"; - //ecrire_log($event,$nomFichier);break; - } - echo("=============== $user_id ===============\n"); - echo("-------------Informations-------------\n"); - echo "+ xml : $nomItem\n"; - echo "+ user_id : $user_id\n"; - echo("--------------------------------------\n"); - /*On Recherche les memberOf*/ - - echo ".\n"; - echo ".\n"; - echo ".\n"; - echo "... RECHERCHE DE MEMBER OF ...\n"; - echo ".\n"; - echo ".\n"; - echo ".\n\n"; - - $user_entity = $listItem->getElementsByTagName('xml_user_entity')->item(0); - - /*On initialise le tableau idEntitiesTab pour stocker les entités récupérées des membersOf*/ - $user_entities = array(); - - //La boucle permet de récupérer les données de chaques memberOf. - for ($j = 0; ; $j++) { - $nomItem = 'xml_'.$j; - $dnMemberof = infoBalise($user_entity, $nomItem); - // on arrête la lecture des memberof si cnMemberof est null - if ($dnMemberof == '') { - break; - } - //$pos = strpos($cnMemberof, $DnsEntities[$key]); - if (preg_match('/'.$DnsEntities[0].'/', $dnMemberof)) { - $entity_ldap_id = $ad->group_info($dnMemberof, array('objectguid'), $DnsEntities[0]); - $entity_ldap_id=$entity_ldap_id['objectguid']; - $entityId=seekEntityId($entity_ldap_id, $db); - echo("-------------Entite associee-------------\n"); - echo "+ xml : $nomItem\n"; - echo "+ DN entity : $dnMemberof\n"; - echo "+ ldap_id : $entity_ldap_id\n"; - echo "+ entity_id : $entityId\n"; - echo("----------------------------------------\n"); - if (!empty($user_id) and !empty($entityId)) { - insertUserEntity($user_id, $entityId, $db); - } - $user_entities[]=$entityId; - } - } - - if ($dnMemberof != '') { - deleteUsersEntities($user_entities, $user_id, $db); - } - - if ($dnMemberof == '' && $j==0) { - echo "... PAS DE MEMBER OF! ...\n"; - } - echo("========================================\n\n\n"); -} - - -//print_r($idUsersTab); diff --git a/modules/ldap/process_users_to_maarch.php b/modules/ldap/process_users_to_maarch.php deleted file mode 100755 index f239b57a7937c61ed533babf9a6adee218eddf4c..0000000000000000000000000000000000000000 --- a/modules/ldap/process_users_to_maarch.php +++ /dev/null @@ -1,253 +0,0 @@ -<?php -session_start(); -//on charge le fichier config.xml du dossier apps/maarch_entreprise/xml pour pouvoir récupérer les données de connexion à la base de données. -//$xml = simplexml_load_file('../../../apps/maarch_entreprise/xml/config.xml'); -$nomFichier = date('Y-m-d_H-i-s') . '.log'; //nom du fichier log enregistrer dans le dossier logLdap - -$fichier = 'ldap_users'; - -echo "... CHARGEMENT DU FICHIER DE CONFIGURATION ...\n"; -if (!isset($argv)) { - exit(htmlentities("Ce script ne peut-etre appelé qu'en PHP CLI")); -} elseif (isset($argv) && count($argv) < 2) { - exit("/!\ Erreur de Syntaxe !\nLa syntaxe est $argv[0] <fichier de conf xml> <xml de sortie>\n\n"); -} elseif (!file_exists($argv[1])) { - exit("/!\ Le fichier de configuration n'existe pas!\n\n"); -} else { - $ldap_conf_file = trim($argv[1]); - echo "Fichier OK !\n\n"; -} -//Extraction de /root/config dans le fichier de conf -$ldap_conf = new DomDocument(); -try { - $ldap_conf->load($ldap_conf_file); -} catch (Exception $e) { - exit("/!\ Impossible de charger le document : ".$ldap_conf_file."\n - Erreur : ".$e.getMessage."\n\n"); -} - -//on charge le fichier config.xml pour pouvoir récupérer les données de connexion à la base de données. -$xml = simplexml_load_file($ldap_conf_file); -$host = $xml->config_base->databaseserver; -$dbname = $xml->config_base->databasename; -$user= $xml->config_base->databaseuser; -$password = $xml->config_base->databasepassword; - -//echo 'host : '.$host;echo "\n"; -//echo 'dbname :'.$dbname;echo "\n"; -//echo 'user : '.$user;echo "\n"; -//echo 'password :'.$password;echo "\n"; - -echo "... CONNEXION A LA BASE DE DONNEES MAARCH ...\n"; - -// Connexion, sélection de la base de données -try { - $db = new PDO("pgsql:host=$host;dbname=$dbname", "$user", "$password"); - echo 'Connexion OK'."\n\n"; -} catch (PDOException $e) { - $db = null; - echo '/!\ Erreur de connexion: ' . $e->getMessage()."\n\n"; - exit; -} - - -/* -Fonction qui permet de récupérer l'information de la balise concernée dans le fichier xml -**/ -function infoBalise($description, $balise) -{ - if ($description == null) { - return $contenu = ''; - } else { - $contenu = null; - $contenubalise = $description ->getElementsByTagName($balise); - foreach ($contenubalise as $contenu) { - $contenu = $contenu->firstChild->nodeValue . ""; - } - return $contenu ; - } -} - - - /*Fonction qui va vérifier si l'utilisateur est dans la table des users ou non*/ - function verifUser($user_id, $db) - { - $qry = $db->prepare("SELECT * from users where upper(user_id) = upper(?)"); - $qry->execute(array($user_id)); - //print_r($qry->errorInfo()); - while ($row = $qry->fetch()) { - $user_id = $row['user_id']; - if ($user_id == '') { - return false; - } else { - return true; - } - } - } - - /*Fonction qui va vérifier les données de l'utilisateur dans la table users. Si il y a des données qui ne sont pas à jour, la fonction fait le update pour mettre à jour. */ - function verifUpdate($user_id, $firstname, $lastname, $phone, $mail, $db) - { - $qry = $db->prepare("SELECT * from users where upper(user_id) = upper(?) and firstname = ? and lastname = ? and phone = ? and mail = ? and (status = 'OK' or status = 'ABS')"); - $qry->execute(array($user_id,$firstname,$lastname,$phone,$mail)); - $result = $qry->fetchAll(); - if ($result==null) { - echo "Les donnees doivent etre mis a jour !"; - $qry = $db->prepare("UPDATE users set user_id = ?, firstname = ? , lastname = ? , phone = ? , mail = ? where upper(user_id) = upper(?) "); - $result = $qry->execute(array($user_id,$firstname,$lastname,$phone,$mail,$user_id)); - $result = $qry->fetchAll(); - if (!$result) { - echo "/!\ données non mises à jours!"; - } else { - echo "... données mises à jour! ...\n"; - } - } else { - echo "... les donnees de $user_id sont a jour ...\n"; - return true; - } - } - - /*Function qui va insérer l'utilisateur dans la table des users. Si l'utilisateur n'est pas présent, on lui done le mot de passe de maarch*/ - function insertUser($user_id, $firstname, $lastname, $phone, $mail, $db) - { - $qry = $db->prepare("INSERT into users (user_id, password, firstname, lastname, phone, mail, status,loginmode) values (?,?,?,?,?,?,?,?)"); - $qry->execute(array($user_id,'$2y$10$C.QSslBKD3yNMfRPuZfcaubFwPKiCkqqOUyAdOr5FSGKPaePwuEjG',$firstname,$lastname,$phone,$mail,'OK','standard')); - $result = $qry->fetchAll(); - if (!$result) { - echo "/!\ L'utilisateur $user_id n'a pas ete insere !\n"; - return false; - } else { - echo "... l'utilisateur $user_id a été ajouté ...\n"; - return true; - } - } - - /*Fonction qui change le status d'un user s'il n'est plus dans le ldap*/ - function changeStatusUsers($idUsersTab, $db) - { - $query = "select user_id from users where status not in ('DEL') and loginmode not in ('restMode') and "; - $query .= "user_id not in ('".implode("','", $idUsersTab)."')"; - $qry = $db->prepare($query); - $qry->execute(array()); - $result = $qry->fetchAll(); - if ($result == null) { - echo "Aucun utilisateur n'a besoin d'être passé en DEL\n"; - return true; - } else { - echo "Des utilisateurs doivent changer de status !\n"; - - $qry = $db->prepare("UPDATE users set status = 'DEL' where user_id in (select user_id from users where status not in ('DEL') and loginmode not in ('restMode') and user_id not in ('".implode("','", $idUsersTab)."')) "); - $qry->execute(); - $result = $qry->fetchAll(); - if (!$result) { - echo "/!\ Aucun utilisateur n'a pu etre passé en DEL !\n"; - } else { - echo "... des utilisateur ont été passé en DEL ...\n"; - } - } - } - - /*Fontion qui va écrire dans le fichier log . Cela permet de faire un suivie du processus*/ - function ecrire_log($event, $nomFichier) - { - -/* $fp = fopen('var/www/html/maarch_entreprise_prod/modules/ldap/logLdap/'.$nomFichier,'a+'); // ouvrir le fichier ou le créer - fseek($fp,SEEK_END); // poser le point de lecture à la fin du fichier - $nouverr=date('Y-m-d_H-i-s')." : ".$event."\r\n"; // ajouter un retour à la ligne au fichier - fputs($fp,$nouverr); // ecrire ce texte - fclose($fp); //fermer le fichier */ - } - -/** -Chargement du fichier xml -*/ - -$dom = new DomDocument(); -echo "... TRAITEMENT du fichier $fichier ...\n"; -if (!($dom->load('../xml/'.$fichier.'.xml'))) { - //echo "fichier : ".$fichier; - $event = "/!\ Unable to load : " . $fichier.'.xml'."\n"; - echo $event; - //ecrire_log($event,$nomFichier); - exit(); -} else { - $event = "Able to load : " . $fichier.'.xml'."\n"; - echo $event; - //ecrire_log($event,$nomFichier); -} - - -/*On compte le nombre d'item dans le fichier xml. Ceci est réalisé car le nom de la balise est item suivi d'un chiffre*/ - -for ($m = 0; ;$m++) { - //echo 'test'; - $nomItem = 'item_'.$m; - $list = $dom->getElementsByTagName("ldap_info")->item(0); - //print_r($list); - $listItem = $list->getElementsByTagName($nomItem)->item(0); - if ($listItem == null) { - break; - } -} - - -/** -Lecture du fichier ldap.xml des users pour mise à jours des données des tables users et users_entities -*/ - -$event = "Lecture du fichier $nomFichier.xml pour mise à jours des données de la table users"."\n"; -echo $event; -ecrire_log($event, $nomFichier); -$idUsersTab= array('superadmin'); //Ce tableau est initialisé avec superadmin pour qu'il ne soit pas passé en DEL lors de la mise à jour des users. -/*Boucle qui permet de travailler sur les données contenues dans le fichier xml. On récupère les données puis on les insère dans la table users_entities*/ - -for ($i = 0; $i<$m ; $i++) { - $nomItem = 'item_'.$i; - - $list = $dom->getElementsByTagName("ldap_info")->item(0); - $listItem = $list->getElementsByTagName($nomItem)->item(0); - - $user_id = infoBalise($listItem, 'xml_user_id'); - - if ($user_id == null) { - $event = "Id du User de l'$nomItem absent, arret du processus"; - //ecrire_log($event,$nomFichier); - break; - } - $firstname = infoBalise($listItem, 'xml_firstname'); - $lastname = infoBalise($listItem, 'xml_lastname'); - $phone = infoBalise($listItem, 'xml_phone'); - $mail = infoBalise($listItem, 'xml_mail'); - - echo("=============== $user_id ===============\n"); - echo("-------------Informations-------------\n"); - echo "+ xml : $nomItem\n"; - echo "+ user_id : $user_id\n"; - echo "+ firstname : $firstname\n"; - echo "+ lastname : $lastname\n"; - echo "+ phone : $phone\n"; - echo "+ mail : $mail\n"; - echo("--------------------------------------\n\n"); - - $idEntitiesTab = array(); - - array_push($idUsersTab, $user_id); - - - - //On vérifie le status des users. S'ils sont inexistants, on les ajoute. S'ils ont des données manquantes, on les met à jour. En revanche on ne supprime pas les utilisateurs. On les passe en DEL - $isUser=verifUser($user_id, $db); - print_r("\n"); - if ($isUser) { - echo "... L'utilisateur $user_id existe deja ...\n"; - verifUpdate($user_id, $firstname, $lastname, $phone, $mail, $db); - } else { - echo "... L'utilisateur $user_id n'existe pas, il va etre insere dans la base de donnees ...\n"; - insertUser($user_id, $firstname, $lastname, $phone, $mail, $db); - } - echo "============================================\n\n"; -} - -echo "\n... Vérification du status des users ...\n"; - -changeStatusUsers($idUsersTab, $db); //Fonction qui va permettre de passer en DEL les users qui ne sont pas dans le LDAP.XML diff --git a/modules/ldap/script/syn_ldap.sh.default b/modules/ldap/script/syn_ldap.sh.default deleted file mode 100755 index 87a1cd253f42bcda3dbbd798ff0cceec283845cd..0000000000000000000000000000000000000000 --- a/modules/ldap/script/syn_ldap.sh.default +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -cd /var/www/html/maarch_entreprise/modules/ldap/script/ - -#generation des fichiers xml -php /var/www/html/maarch_entreprise/modules/ldap/process_ldap_to_xml.php /var/www/html/maarch_entreprise/modules/ldap/xml/config.xml - - -#mise a jour bdd -php /var/www/html/maaarch_entreprise/modules/ldap/process_entities_to_maarch.php /var/www/html/maarch_entreprise/modules/ldap/xml/config.xml -php /var/www/html/maarch_entreprise/modules/ldap/process_users_to_maarch.php /var/www/html/maarch_entreprise/modules/ldap/xml/config.xml -php /var/www/html/maarch_entreprise/modules/ldap/process_users_entities_to_maarch.php /var/www/html/maarch_entreprise/modules/ldap/xml/config.xml diff --git a/modules/life_cycle/change_cycle_list.php b/modules/life_cycle/change_cycle_list.php deleted file mode 100755 index 90b51cf268e61dc37d4fcca4797ca66fd7a2541a..0000000000000000000000000000000000000000 --- a/modules/life_cycle/change_cycle_list.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -/** - *Change cycle list according to the life cycle policy - * - * - * - */ -require_once("core/class/class_core_tools.php"); -require_once("modules/life_cycle/class/lc_cycles_controler.php"); -$core_tools = new core_tools(); -$core_tools->load_lang(); -$lcCyclesControler = new lc_cycles_controler(); -$cyclesArray = $lcCyclesControler->getAllIdByPolicy($_POST['policy_id']); -$selectCycle = ''; -$selectCycle .= '<p>'; -$selectCycle .= '<label for="cycle_id">'. _CYCLE_ID.' : </label>'; -$selectCycle .= '<select name="cycle_id" id="cycle_id">'; -$selectCycle .= ' <option value="">'._CYCLE_ID.'</option>'; -for ($cptCycle = 0;$cptCycle < count($cyclesArray);$cptCycle++) { - $selectCycle .= '<option value="'.$cyclesArray[$cptCycle].'"'; - if (isset($_SESSION['m_admin']['lc_cycle_steps']['cycle_id']) - && $_SESSION['m_admin']['lc_cycle_steps'] - ['cycle_id'] == $cyclesArray[$cptCycle] - ) { - $selectCycle .= ' selected="selected"'; - } - $selectCycle .= '>'.$cyclesArray[$cptCycle].'</option>'; -} -$selectCycle .= '</select>'; -$selectCycle .= '</p>'; -echo "{status : 0, selectCycle : '" . addslashes($selectCycle) . "'}"; -exit (); diff --git a/modules/life_cycle/class/class_modules_tools.php b/modules/life_cycle/class/class_modules_tools.php deleted file mode 100755 index 88f537aac26f1e3f9217bfda0382467cd1dcb404..0000000000000000000000000000000000000000 --- a/modules/life_cycle/class/class_modules_tools.php +++ /dev/null @@ -1,205 +0,0 @@ -<?php - -/* -* Copyright 2010 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** -* @defgroup life_cycle life_cycle Module -*/ - -/** -* @brief Module life_cycle : Module Tools Class -* -* <ul> -* <li>Set the session variables needed to run the life_cycle module</li> -*</ul> -* -* @file -* @author Laurent Giovannoni <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup life_cycle -*/ - -/** -* @brief Module life_cycle : Module Tools Class -* -* <ul> -* <li>Loads the tables used by the life_cycle</li> -* <li>Set the session variables needed to run the life_cycle module</li> -*</ul> -* -* @ingroup life_cycle -*/ -class life_cycle extends Database -{ - function __construct() - { - parent::__construct(); - $this->index = array(); - } - - /** - * Loads life_cycle tables into sessions vars from the - * life_cycle/xml/config.xml - * Loads life_cycle log setting into sessions vars from the - * life_cycle/xml/config.xml - */ - public function build_modules_tables() - { - if (file_exists($_SESSION['config']['corepath'].'custom' - .DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'] - .DIRECTORY_SEPARATOR."modules".DIRECTORY_SEPARATOR - ."life_cycle".DIRECTORY_SEPARATOR - ."xml".DIRECTORY_SEPARATOR."config.xml") - ) { - $path = $_SESSION['config']['corepath'].'custom' - .DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'] - .DIRECTORY_SEPARATOR."modules".DIRECTORY_SEPARATOR."life_cycle" - .DIRECTORY_SEPARATOR."xml".DIRECTORY_SEPARATOR."config.xml"; - } else { - $path = "modules".DIRECTORY_SEPARATOR."life_cycle" - .DIRECTORY_SEPARATOR."xml".DIRECTORY_SEPARATOR."config.xml"; - } - $xmlconfig = simplexml_load_file($path); - //$CONFIG = $xmlconfig->CONFIG; - // Loads the tables of the module life_cycle - // into session ($_SESSION['tablename'] array) - $TABLENAME = $xmlconfig->TABLENAME ; - $_SESSION['tablename']['lc_cycle'] = (string) $TABLENAME->lc_cycle; - $_SESSION['tablename']['lc_cycle_seq'] = (string) $TABLENAME - ->lc_cycle_seq; - $_SESSION['tablename']['lc_stack'] = (string) $TABLENAME->lc_stack; - - // Loads the log setting of the module life_cycle - // into session ($_SESSION['history'] array) - $HISTORY = $xmlconfig->HISTORY; - $_SESSION['history']['lcadd'] = (string) $HISTORY->lcadd; - $_SESSION['history']['lcup'] = (string) $HISTORY->lcup; - $_SESSION['history']['lcdel'] = (string) $HISTORY->lcdel; - } - - /** - * Load into session vars all the life_cycle specific vars : - * calls private methods - */ - public function load_module_var_session($userData) - { - if (file_exists($_SESSION['config']['corepath'].'custom' - .DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'] - .DIRECTORY_SEPARATOR."modules" - .DIRECTORY_SEPARATOR."life_cycle" - .DIRECTORY_SEPARATOR."xml".DIRECTORY_SEPARATOR - ."life_cycle_features.xml") - ) { - $path = $_SESSION['config']['corepath'].'custom' - .DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'] - .DIRECTORY_SEPARATOR."modules".DIRECTORY_SEPARATOR - ."life_cycle".DIRECTORY_SEPARATOR."xml".DIRECTORY_SEPARATOR - ."life_cycle_features.xml"; - } else { - $path = "modules".DIRECTORY_SEPARATOR."life_cycle" - .DIRECTORY_SEPARATOR."xml".DIRECTORY_SEPARATOR - ."life_cycle_features.xml"; - } - $_SESSION['lifeCycleFeatures'] = array(); - $_SESSION['lifeCycleFeatures'] = functions::object2array( - simplexml_load_file($path) - ); - //functions::show_array($_SESSION['lifeCycleFeatures']); - } - - public function get_indexing_cycles() - { - $cycles = array(); - if (file_exists( - $_SESSION['config']['corepath'].'custom' . DIRECTORY_SEPARATOR - . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR - . "modules" . DIRECTORY_SEPARATOR . "life_cycle" - . DIRECTORY_SEPARATOR . "xml" . DIRECTORY_SEPARATOR . "params.xml" - ) - ) { - $path = $_SESSION['config']['corepath'] . 'custom' - . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] - . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR - . "life_cycle" . DIRECTORY_SEPARATOR . "xml" - . DIRECTORY_SEPARATOR . "params.xml"; - } else if (file_exists( - "modules" . DIRECTORY_SEPARATOR . "life_cycle" . DIRECTORY_SEPARATOR - . "xml" . DIRECTORY_SEPARATOR . "params.xml" - ) - ) { - $path = "modules" . DIRECTORY_SEPARATOR . "life_cycle" - . DIRECTORY_SEPARATOR . "xml" . DIRECTORY_SEPARATOR - . "params.xml"; - } else { - return $cycles; - } - $xml = simplexml_load_file($path); - if (!isset($xml->indexing_cycles)) { - return $cycles; - } - foreach ($xml->indexing_cycles->cycle as $cycle) { - $cycles [] = array( - 'policy_id' => (string) $cycle->policy_id, - 'cycle_id' => (string) $cycle->cycle_id, - ); - } - return $cycles; - } - - public function get_frozen_cycles() - { - $cycles = array(); - if (file_exists( - $_SESSION['config']['corepath'].'custom' . DIRECTORY_SEPARATOR - . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR - . "modules" . DIRECTORY_SEPARATOR . "life_cycle" - . DIRECTORY_SEPARATOR . "xml" . DIRECTORY_SEPARATOR . "params.xml" - ) - ) { - $path = $_SESSION['config']['corepath'] . 'custom' - . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] - . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR - . "life_cycle" . DIRECTORY_SEPARATOR . "xml" - . DIRECTORY_SEPARATOR . "params.xml"; - } else if (file_exists( - "modules" . DIRECTORY_SEPARATOR . "life_cycle" . DIRECTORY_SEPARATOR - . "xml" . DIRECTORY_SEPARATOR . "params.xml" - ) - ) { - $path = "modules" . DIRECTORY_SEPARATOR . "life_cycle" - . DIRECTORY_SEPARATOR . "xml" . DIRECTORY_SEPARATOR - . "params.xml"; - } else { - return $cycles; - } - $xml = simplexml_load_file($path); - if (! isset($xml->frozen_cycles)) { - return $cycles; - } - foreach ($xml->frozen_cycles->cycle as $cycle) { - $cycles [] = array( - 'policy_id' => (string) $cycle->policy_id, - 'cycle_id' => (string) $cycle->cycle_id, - ); - } - return $cycles; - } -} diff --git a/modules/life_cycle/class/lc_cycle_steps.php b/modules/life_cycle/class/lc_cycle_steps.php deleted file mode 100755 index 9bfd6c5aa6636a63a8e235524001c7d4f5173659..0000000000000000000000000000000000000000 --- a/modules/life_cycle/class/lc_cycle_steps.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/* -* Copyright 2008,2009,2010 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** -* @brief Contains the lc_cycle_steps Object (herits of the BaseObject class) -* -* -* @file -* @author Laurent Giovannoni <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup life_cycle -*/ - -// Loads the required class -try { - require_once("core/class/BaseObject.php"); -} catch (Exception $e) { - functions::xecho($e->getMessage()).' // '; -} - -/** -* @brief lc_policies Object, herits of the BaseObject class -* -* @ingroup life_cycle -*/ -class lc_cycle_steps - extends BaseObject -{ - /** - *Print a viewable string to render the object. - * @return string Rendering of the object - */ - public function __toString() - { - return $this->cycle_step_desc; - } -} diff --git a/modules/life_cycle/class/lc_cycle_steps_controler.php b/modules/life_cycle/class/lc_cycle_steps_controler.php deleted file mode 100755 index 2344a617314ad23fa020734db3e818b84e777149..0000000000000000000000000000000000000000 --- a/modules/life_cycle/class/lc_cycle_steps_controler.php +++ /dev/null @@ -1,506 +0,0 @@ -<?php - -/* -* Copyright 2008-2011 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** -* @brief Contains the controler of life_cycle_steps object -* (create, save, modify, etc...) -* -* -* @file -* @author Laurent Giovannoni -* @date $date$ -* @version $Revision$ -* @ingroup life_cycle -*/ - -// To activate de debug mode of the class -$_ENV['DEBUG'] = false; - -// Loads the required class -try { - require_once ("modules/life_cycle/class/lc_cycle_steps.php"); - require_once ("modules/life_cycle/life_cycle_tables_definition.php"); - require_once ("core/class/ObjectControlerAbstract.php"); - require_once ("core/class/ObjectControlerIF.php"); -} catch (Exception $e) { - functions::xecho($e->getMessage()) . ' // '; -} - -/** -* @brief Controler of the lc_cycle_steps object -* -*<ul> -* <li>Get an lc_cycle_steps object from an id</li> -* <li>Save in the database a lc_cycle_steps</li> -* <li>Manage the operation on the lc_cycle_steps related tables in the -* database (insert, select, update, delete)</li> -*</ul> -* @ingroup life_cycle -*/ -class lc_cycle_steps_controler - extends ObjectControler - implements ObjectControlerIF -{ - - /** - * Saves in the database a lc_cycle_steps object - * - * @param $cycle lc_cycle_steps object to be saved - * @return bool true if the save is complete, false otherwise - */ - public function save($cycle, $mode="") - { - $control = array(); - if (!isset($cycle) || empty($cycle)) { - $control = array( - "status" => "ko", - "value" => "", - "error" => _CYCLE_STEP_ID_EMPTY, - ); - return $control; - } - $cycle = $this->isACycleSteps($cycle); - $this->set_foolish_ids( - array( - 'policy_id', - 'cycle_id', - 'cycle_step_id', - 'docserver_type_id', - ) - ); - $this->set_specific_id('cycle_step_id'); - if ($mode == "up") { - $control = $this->control($cycle, "up"); - if ($control['status'] == "ok") { - //Update existing cycle steps - if ($this->update($cycle)) { - $control = array( - "status" => "ok", - "value" => $cycle->cycle_step_id, - ); - //history - if ($_SESSION['history']['lcadd'] == "true") { - $history = new history(); - $history->add( - _LC_CYCLE_STEPS_TABLE_NAME, - $cycle->cycle_step_id, "UP", 'lcadd', - _LC_CYCLE_STEP_UPDATED." : ".$cycle->cycle_step_id, - $_SESSION['config']['databasetype'] - ); - } - } else { - $control = array( - "status" => "ko", - "value" => "", - "error" => _PB_WITH_CYCLE, - ); - } - return $control; - } - } else { - $control = $this->control($cycle, "add"); - if ($control['status'] == "ok") { - //Insert new cycle - if ($this->insert($cycle)) { - $control = array( - "status" => "ok", - "value" => $cycle->cycle_step_id, - ); - //history - if ($_SESSION['history']['lcadd'] == "true") { - $history = new history(); - $history->add( - _LC_CYCLE_STEPS_TABLE_NAME, $cycle->cycle_step_id, - "ADD", 'lcadd', - _LC_CYCLE_STEP_UPDATED." : ".$cycle->cycle_step_id, - $_SESSION['config']['databasetype'] - ); - } - } else { - $control = array( - "status" => "ko", - "value" => "", - "error" => _PB_WITH_CYCLE_STEPS, - ); - } - } - } - return $control; - } - - /** - * control the cycle step object before action - * - * @param object $lc_cycle_steps cycle step object - * @param string $mode up or add - * @return array ok if the object is well formated, ko otherwise - */ - private function control($lc_cycle_steps, $mode) - { - $f = new functions(); - $error = ""; - if (isset($lc_cycle_steps->cycle_step_id) - && !empty($lc_cycle_steps->cycle_step_id) - ) { - // Update, so values exist - $lc_cycle_steps->cycle_step_id = - $f->wash( - $lc_cycle_steps->cycle_step_id, "nick", - _LC_CYCLE_STEP_ID." ", "yes", 0, 32 - ); - } - $lc_cycle_steps->policy_id = - $f->wash( - $lc_cycle_steps->policy_id, "no", _POLICY_ID." ", 'yes', 0, 32 - ); - if (isset($lc_cycle_steps->cycle_id) - && !empty($lc_cycle_steps->cycle_id) - ) { - $lc_cycle_steps->cycle_id = $f->wash( - $lc_cycle_steps->cycle_id, "no", _LC_CYCLE_ID." ", - 'yes', 0, 32 - ); - } else { - $lc_cycle_steps->policy_id = ''; - $error .= _LC_CYCLE_ID . ' ' . _MANDATORY; - } - $lc_cycle_steps->docserver_type_id = - $f->wash( - $lc_cycle_steps->docserver_type_id, "no", - _DOCSERVER_TYPE_ID." ", 'yes', 0, 32 - ); - $lc_cycle_steps->cycle_step_desc = - $f->wash( - $lc_cycle_steps->cycle_step_desc, "no", - _CYCLE_STEP_DESC." ", 'yes', 0, 255 - ); - $lc_cycle_steps->sequence_number = - $f->wash( - $lc_cycle_steps->sequence_number, "num", - _SEQUENCE_NUMBER." ", 'yes', 0, 255 - ); - $lc_cycle_steps->step_operation = - $f->wash( - $lc_cycle_steps->step_operation, - "no", _STEP_OPERATION." ", 'yes', 0, 32 - ); - if ($mode == "add" - && $this->cycleStepExists($lc_cycle_steps->cycle_step_id) - ) { - $error .= $lc_cycle_steps->cycle_step_id." "._ALREADY_EXISTS."#"; - } - $error .= $_SESSION['error']; - //TODO:rewrite wash to return errors without html - $error = str_replace("<br />", "#", $error); - $return = array(); - if (!empty($error)) { - $return = array( - "status" => "ko", - "value" => $lc_cycle_steps->cycle_step_id, - "error" => $error, - ); - } else { - $return = array( - "status" => "ok", - "value" => $lc_cycle_steps->cycle_step_id, - ); - } - return $return; - } - - /** - * Inserts in the database (lc_cycle_steps table) a lc_cycle_steps object - * - * @param $cycle lc_cycle_steps object - * @return bool true if the insertion is complete, false otherwise - */ - private function insert($cycle) - { - return $this->advanced_insert($cycle); - } - - /** - * Updates in the database (lc_cycle_steps table) a lc_cycle_steps object - * - * @param $cycle lc_cycle_steps object - * @return bool true if the update is complete, false otherwise - */ - private function update($cycle) - { - return $this->advanced_update($cycle); - } - - /** - * Returns an lc_cycle_steps object based on a lc_cycle_steps identifier - * - * @param $cycle_step_id string lc_cycle_steps identifier - * @param $comp_where string where clause arguments - * (must begin with and or or) - * @param $can_be_disabled bool if true gets the cycle even if it - * is disabled in the database (false by default) - * @return lc_cycle_steps object with properties from the database or null - */ - public function get( - $cycle_step_id, - $comp_where='', - $can_be_disabled=false - ) { - $this->set_foolish_ids( - array( - 'policy_id', - 'cycle_id', - 'cycle_step_id', - 'docserver_type_id', - ) - ); - $this->set_specific_id('cycle_step_id'); - $cycle = $this->advanced_get( - $cycle_step_id, _LC_CYCLE_STEPS_TABLE_NAME - ); - //var_dump($policy); - if (get_class($cycle) <> "lc_cycle_steps") { - return null; - } else { - //var_dump($cycle); - return $cycle; - } - } - - /** - * get lc_cycles_steps with given id for a ws. - * Can return null if no corresponding object. - * @param $cycle_step_id of cycle to send - * @return cycle steps - */ - public function getWs($cycle_step_id) - { - $this->set_foolish_ids( - array( - 'policy_id', - 'cycle_id', - 'cycle_step_id', - 'docserver_type_id', - ) - ); - $this->set_specific_id('cycle_step_id'); - $cycle = $this->advanced_get( - $cycle_step_id, _LC_CYCLE_STEPS_TABLE_NAME - ); - if (get_class($cycle) <> "lc_cycle_steps") { - return null; - } else { - $cycle = $cycle->getArray(); - return $cycle; - } - } - - /** - * Deletes in the database (lc_cycle_steps related tables) a given - * lc_cycle_steps (cycle_step_id) - * - * @param $cycle_step_id string lc_cycle_steps identifier - * @return bool true if the deletion is complete, false otherwise - */ - public function delete($cycle_step_id) - { - $control = array(); - if (!isset($cycle_step_id) || empty($cycle_step_id)) { - $control = array( - "status" => "ko", - "value" => "", - "error" => _LC_CYCLE_EMPTY, - ); - return $control; - } - $cycle = $this->isACycleSteps($cycle_step_id); - if (!$this->cycleStepExists($cycle->cycle_step_id)) { - $control = array( - "status" => "ko", - "value" => "", - "error" => _LC_CYCLE_STEP_NOT_EXISTS, - ); - return $control; - } - if ($this->linkExists($cycle->policy_id, $cycle->cycle_step_id)) { - $control = array( - "status" => "ko", - "value" => "", - "error" => _LINK_EXISTS, - ); - return $control; - } - $db = new Database(); - $query = "delete from "._LC_CYCLE_STEPS_TABLE_NAME - ." where cycle_step_id = ?"; - try { - $stmt = $db->query($query, array($cycle->cycle_step_id)); - $ok = true; - } catch (Exception $e) { - $control = array( - "status" => "ko", - "value" => "", - "error" => _CANNOT_DELETE_CYCLE_STEP_ID - ." ".$cycle->cycle_step_id, - ); - $ok = false; - } - $control = array( - "status" => "ok", - "value" => $cycle->cycle_step_id, - ); - if ($_SESSION['history']['lcdel'] == "true") { - require_once( - "core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR - ."class_history.php" - ); - $history = new history(); - $history->add( - _LC_CYCLE_STEPS_TABLE_NAME, $cycle->cycle_step_id, "DEL", 'lcdel', - _LC_CYCLE_STEP_DELETED." : ".$cycle->cycle_step_id, - $_SESSION['config']['databasetype'] - ); - } - return $control; - } - - /** - * Disables a given lc_cycle_steps - * - * @param $cycle lc_cycle_steps object - * @return bool true if the disabling is complete, false otherwise - */ - public function disable($cycle) - { - // - } - - /** - * Enables a given lc_cycle_steps - * - * @param $cycle lc_cycle_steps object - * @return bool true if the enabling is complete, false otherwise - */ - public function enable($cycle) - { - // - } - - /** - * Fill a cycle_steps object with an object if it's not a cycle_teps - * - * @param $object ws cycle_steps object - * @return object cycle_steps - */ - private function isACycleSteps($object) - { - if (get_class($object) <> "lc_cycle_steps") { - $func = new functions(); - $cycleStepsObject = new lc_cycle_steps(); - $array = array(); - $array = $func->object2array($object); - foreach (array_keys($array) as $key) { - $cycleStepsObject->{$key} = $array[$key]; - } - return $cycleStepsObject; - } else { - return $object; - } - } - - /** - * Check if the cycle step exists - * - * @param $cycle_step_id lc_cycle_steps identifier - * @return bool true if it exists - */ - public function cycleStepExists($cycle_step_id) - { - if (!isset ($cycle_step_id) || empty ($cycle_step_id)) { - return false; - } - $db = new Database(); - $query = "select cycle_step_id from " . _LC_CYCLE_STEPS_TABLE_NAME - . " where cycle_step_id = ?"; - try { - $stmt = $db->query($query, array($cycle_step_id)); - } catch (Exception $e) { - echo _UNKNOWN . _LC_CYCLE_STEP . " " . $cycle_step_id . ' // '; - } - - if ($stmt->rowCount() > 0) { - return true; - } - return false; - } - - /** - * Check if the cycle step is linked - * - * @param $cycle_step_id lc_cycle_steps identifier - * @param $policy_id lc_policies identifier - * @return bool true if it exists - */ - public function LinkExists($policy_id, $cycle_step_id) - { - if (!isset($policy_id) || empty($policy_id)) { - return false; - } - if (!isset($cycle_step_id) || empty($cycle_step_id)) { - return false; - } - $db = new Database(); - $query = "select cycle_step_id from "._LC_STACK_TABLE_NAME - ." where cycle_step_id = ? and policy_id = ?"; - $stmt = $db->query($query, array($cycle_step_id, $policy_id)); - if ($stmt->rowCount() > 0) { - return true; - } - } - - /** - * Return all cycles ID - * @param $policy_id police_id identifier - * @return array of cycles - */ - public function getAllId($policy_id) - { - $db = new Database(); - $query = "select cycle_id from " . _LC_CYCLES_TABLE_NAME - . " where policy_id = ?"; - try { - $stmt = $db->query($query, array($policy_id)); - } catch (Exception $e) { - echo _NO_CYCLE_ID . ' // '; - } - if ($stmt->rowCount() > 0) { - $result = array(); - $cptId = 0; - while ($queryResult = $stmt->fetchObject()) { - $result[$cptId] = $queryResult->cycle_id; - $cptId++; - } - return $result; - } else { - return null; - } - } -} - diff --git a/modules/life_cycle/class/lc_cycles.php b/modules/life_cycle/class/lc_cycles.php deleted file mode 100755 index bfc4be3555eba6b497c5e4938b5f7e5f1c8087bd..0000000000000000000000000000000000000000 --- a/modules/life_cycle/class/lc_cycles.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php - -/* -* Copyright 2008,2009,2010 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** -* @brief Contains the lc_cycles Object (herits of the BaseObject class) -* -* -* @file -* @author Laurent Giovannoni <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup life_cycle -*/ - -// Loads the required class -try { - require_once("core/class/BaseObject.php"); -} catch (Exception $e){ - functions::xecho($e->getMessage()).' // '; -} - -/** -* @brief lc_policies Object, herits of the BaseObject class -* -* @ingroup life_cycle -*/ -class lc_cycles extends BaseObject -{ - /** - *Print a viewable string to render the object. - * @return string Rendering of the object - */ - public function __toString() - { - return $this->cycle_desc; - } -} diff --git a/modules/life_cycle/class/lc_cycles_controler.php b/modules/life_cycle/class/lc_cycles_controler.php deleted file mode 100755 index 4104c8f4c772bc48f2b6f55c5fd5c35b939bddd9..0000000000000000000000000000000000000000 --- a/modules/life_cycle/class/lc_cycles_controler.php +++ /dev/null @@ -1,504 +0,0 @@ -<?php - -/* -* Copyright 2008-2011 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** -* @brief Contains the controler of life_cycle object -* (create, save, modify, etc...) -* -* -* @file -* @author Luc KEULEYAN - BULL -* @author Laurent Giovannoni -* @date $date$ -* @version $Revision$ -* @ingroup life_cycle -*/ - -// To activate de debug mode of the class -$_ENV['DEBUG'] = false; - -// Loads the required class -try { - require_once ("modules/life_cycle/class/lc_cycles.php"); - require_once ("modules/life_cycle/life_cycle_tables_definition.php"); - require_once ("core/class/ObjectControlerAbstract.php"); - require_once ("core/class/ObjectControlerIF.php"); - require_once ("core/class/SecurityControler.php"); -} catch (Exception $e) { - functions::xecho($e->getMessage()) . ' // '; -} - -/** -* @brief Controler of the lc_cycles object -* -*<ul> -* <li>Get an lc_cycles object from an id</li> -* <li>Save in the database a lc_cycles</li> -* <li>Manage the operation on the lc_cycles related tables in the database -* (insert, select, update, delete)</li> -*</ul> -* @ingroup life_cycle -*/ -class lc_cycles_controler extends ObjectControler implements ObjectControlerIF -{ - /** - * Save given object in database: - * - make an update if object already exists, - * - make an insert if new object. - * @param object $cycle - * @param string mode up or add - * @return array - */ - public function save($cycle, $mode='') - { - $control = array(); - if (!isset($cycle) || empty($cycle)) { - $control = array( - "status" => "ko", - "value" => "", - "error" => _CYCLE_ID_EMPTY, - ); - return $control; - } - $cycle = $this->isACycle($cycle); - $this->set_foolish_ids(array('policy_id', 'cycle_id')); - $this->set_specific_id('cycle_id'); - if ($mode == "up") { - $control = $this->control($cycle, "up"); - if ($control['status'] == "ok") { - //Update existing cycle - if ($this->update($cycle)) { - $control = array( - "status" => "ok", - "value" => $cycle->cycle_id, - ); - //history - if ($_SESSION['history']['lcadd'] == "true") { - $history = new history(); - $history->add( - _LC_CYCLES_TABLE_NAME, - $cycle->cycle_id, - "UP", 'lcadd', - _LC_CYCLE_UPDATED." : ".$cycle->cycle_id, - $_SESSION['config']['databasetype'] - ); - } - } else { - $control = array( - "status" => "ko", - "value" => "", - "error" => _PB_WITH_CYCLE, - ); - } - return $control; - } - } else { - $control = $this->control($cycle, "add"); - if ($control['status'] == "ok") { - //Insert new cycle - if ($this->insert($cycle)) { - $control = array( - "status" => "ok", - "value" => $cycle->cycle_id, - ); - //history - if ($_SESSION['history']['lcadd'] == "true") { - $history = new history(); - $history->add( - _LC_CYCLES_TABLE_NAME, - $cycle->cycle_id, - "ADD", 'lcadd', - _LC_CYCLE_UPDATED." : ".$cycle->cycle_id, - $_SESSION['config']['databasetype'] - ); - } - } else { - $control = array( - "status" => "ko", - "value" => "", - "error" => _PB_WITH_CYCLE, - ); - } - } - } - return $control; - } - - /** - * control the cycle object before action - * - * @param object $cycle cycle object - * @param string $mode up or add - * @return array ok if the object is well formated, ko otherwise - */ - private function control($cycle, $mode) - { - $f = new functions(); - $sec = new SecurityControler(); - $error = ""; - if (isset($cycle->cycle_id) && !empty($cycle->cycle_id)) { - // Update, so values exist - $cycle->cycle_id = $f->wash($cycle->cycle_id, "nick", _LC_CYCLE_ID." ", "yes", 0, 32); - } - $cycle->policy_id = $f->wash($cycle->policy_id, "no", _POLICY_ID." ", 'yes', 0, 32); - $cycle->cycle_desc = $f->wash($cycle->cycle_desc, "no", _CYCLE_DESC." ", 'yes', 0, 255); - $cycle->sequence_number = $f->wash($cycle->sequence_number, "num", _SEQUENCE_NUMBER." ", 'yes', 0, 255); - $cycle->break_key = $f->wash($cycle->break_key, "no", _BREAK_KEY." ", 'no', 0, 255); - if ($sec->isUnsecureRequest($cycle->where_clause)) { - $error .= _WHERE_CLAUSE_NOT_SECURE."#"; - } elseif (!$this->where_test($cycle->where_clause)) { - $error .= _PB_WITH_WHERE_CLAUSE."#"; - } - $cycle->where_clause = $f->wash($cycle->where_clause, "no", _WHERE_CLAUSE." ", 'yes', 0, 255); - $cycle->validation_mode = $f->wash($cycle->validation_mode, "no", _VALIDATION_MODE." ", 'yes', 0, 32); - if ($mode == "add" && $this->cycleExists($cycle->cycle_id)) { - $error .= $cycle->cycle_id." "._ALREADY_EXISTS."#"; - } - $error .= $_SESSION['error']; - //TODO:rewrite wash to return errors without html - $error = str_replace("<br />", "#", $error); - $return = array(); - if (!empty($error)) { - $return = array( - "status" => "ko", - "value" => $cycle->cycle_id, - "error" => $error, - ); - } else { - $return = array( - "status" => "ok", - "value" => $cycle->cycle_id, - ); - } - return $return; - } - - /** - * Inserts in the database (lc_cycles table) a lc_cycles object - * - * @param $cycle lc_cycles object - * @return bool true if the insertion is complete, false otherwise - */ - private function insert($cycle) - { - return $this->advanced_insert($cycle); - } - - /** - * Updates in the database (lc_cycles table) a lc_cycles object - * - * @param $cycle lc_cycles object - * @return bool true if the update is complete, false otherwise - */ - private function update($cycle) - { - return $this->advanced_update($cycle); - } - - /** - * Returns an lc_cycles object based on a lc_cycles identifier - * - * @param $cycle_id string lc_cycles identifier - * @param $comp_where string where clause arguments - * (must begin with and or or) - * @param $can_be_disabled bool if true gets the cycle even if it is - * disabled in the database (false by default) - * @return lc_cycles object with properties from the database or null - */ - public function get($cycle_id, $comp_where='', $can_be_disabled=false) - { - $this->set_foolish_ids(array('policy_id', 'cycle_id')); - $this->set_specific_id('cycle_id'); - $cycle = $this->advanced_get($cycle_id, _LC_CYCLES_TABLE_NAME); - //var_dump($policy); - if (get_class($cycle) <> "lc_cycles") { - return null; - } else { - //var_dump($cycle); - return $cycle; - } - } - - /** - * get lc_cycles with given id for a ws. - * Can return null if no corresponding object. - * @param $cycle_id of cycle to send - * @return cycle - */ - public function getWs($cycle_id) - { - $this->set_foolish_ids(array('policy_id', 'cycle_id')); - $this->set_specific_id('cycle_id'); - $cycle = $this->advanced_get($cycle_id, _LC_CYCLES_TABLE_NAME); - if (get_class($cycle) <> "lc_cycles") { - return null; - } else { - $cycle = $cycle->getArray(); - return $cycle; - } - } - - /** - * Deletes in the database (lc_cycles related tables) a given - * lc_cycles (cycle_id) - * - * @param $cycle string lc_cycles identifier - * @return bool true if the deletion is complete, false otherwise - */ - public function delete($cycle) - { - $control = array(); - if (!isset($cycle) || empty($cycle)) { - $control = array( - "status" => "ko", - "value" => "", - "error" => _LC_CYCLE_EMPTY, - ); - return $control; - } - $cycle = $this->isACycle($cycle); - if (!$this->cycleExists($cycle->cycle_id)) { - $control = array( - "status" => "ko", - "value" => "", - "error" => _LC_CYCLE_NOT_EXISTS, - ); - return $control; - } - if ($this->linkExists($cycle->policy_id, $cycle->cycle_id)) { - $control = array( - "status" => "ko", - "value" => "", - "error" => _LINK_EXISTS, - ); - return $control; - } - $db = new Database(); - $query = "delete from "._LC_CYCLES_TABLE_NAME." where cycle_id = ?"; - try { - $stmt = $db->query($query, array($cycle->cycle_id)); - $ok = true; - } catch (Exception $e) { - $control = array( - "status" => "ko", - "value" => "", - "error" => _CANNOT_DELETE_CYCLE_ID." ".$cycle->cycle_id, - ); - $ok = false; - } - $control = array( - "status" => "ok", - "value" => $cycle->cycle_id, - ); - if ($_SESSION['history']['lcdel'] == "true") { - require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR - ."class_history.php"); - $history = new history(); - $history->add( - _LC_CYCLES_TABLE_NAME, $cycle->cycle_id, "DEL", 'lcdel', - _LC_CYCLE_DELETED." : ".$cycle->cycle_id, - $_SESSION['config']['databasetype'] - ); - } - return $control; - } - - /** - * Disables a given lc_cycles - * - * @param $cycle lc_cycles object - * @return bool true if the disabling is complete, false otherwise - */ - public function disable($cycle) - { - // - } - - /** - * Enables a given lc_cycles - * - * @param $cycle lc_cycles object - * @return bool true if the enabling is complete, false otherwise - */ - public function enable($cycle) - { - // - } - - /** - * Fill a cycle object with an object if it's not a cycle - * - * @param $object ws cycle object - * @return object cycle - */ - private function isACycle($object) - { - if (get_class($object) <> "lc_cycles") { - $func = new functions(); - $cycleObject = new lc_cycles(); - $array = array(); - $array = $func->object2array($object); - foreach (array_keys($array) as $key) { - $cycleObject->{$key} = $array[$key]; - } - return $cycleObject; - } else { - return $object; - } - } - - /** - * Checks if the life cycle cycle exists - * - * @param $cycle_id lc_cycle identifier - * @return bool true if the cycle exists - */ - public function cycleExists($cycle_id) - { - if (!isset ($cycle_id) || empty ($cycle_id)) { - return false; - } - $db = new Database(); - $query = "select cycle_id from " . _LC_CYCLES_TABLE_NAME - . " where cycle_id = ?"; - try { - $stmt = $db->query($query, array($cycle_id)); - } catch (Exception $e) { - echo _UNKNOWN . _LC_CYCLE . " " . $cycle_id . ' // '; - } - if ($stmt->rowCount() > 0) { - return true; - } - return false; - } - - /** - * Checks if the life cycle cycle is linked - * - * @param $cycle_id lc_cycle identifier - * @param $policy_id lc_cycle policy identifier - * @return bool true if the cycle is linked - */ - public function linkExists($policy_id, $cycle_id) - { - if (!isset($policy_id) || empty($policy_id)) { - return false; - } - if (!isset($cycle_id) || empty($cycle_id)) { - return false; - } - $db = new Database(); - $query = "select cycle_id from "._LC_STACK_TABLE_NAME - ." where cycle_id = ? and policy_id = ?"; - $stmt = $db->query($query, array($cycle_id, $policy_id)); - if ($stmt->rowCount() > 0) { - return true; - } - $query = "select cycle_id from "._LC_CYCLE_STEPS_TABLE_NAME - ." where cycle_id = ? and policy_id = ? "; - $stmt = $db->query($query, array($cycle_id, $policy_id)); - if ($stmt->rowCount() > 0) { - return true; - } - } - - /** - * Return all cycles ID - * - * @return array of cycles - */ - public function getAllId($can_be_disabled=false) - { - $db = new Database(); - $query = "select cycle_id from " . _LC_CYCLES_TABLE_NAME . " "; - if (!$can_be_disabled) { - $query .= " where enabled = 'Y'"; - } - try { - $stmt = $db->query($query); - } catch (Exception $e) { - echo _NO_LC_CYCLE . ' // '; - } - if ($stmt->rowCount() > 0) { - $result = array(); - $cptId = 0; - while ($queryResult = $stmt->fetchObject()) { - $result[$cptId] = $queryResult->cycle_id; - $cptId++; - } - return $result; - } else { - return null; - } - } - - /** - * Displays lc_cycle according to a given policy_id - * - * @param $policy_id lc_cycle policy identifier - * @return array lc_cycle identifier - */ - public function getAllIdByPolicy($policy_id) - { - $db = new Database(); - $query = "select cycle_id from " . _LC_CYCLES_TABLE_NAME - . " where policy_id = ?"; - try { - $stmt = $db->query($query, array($policy_id)); - } catch (Exception $e) { - echo _NO_LC_CYCLE . ' // '; - } - if ($stmt->rowCount() > 0) { - $result = array(); - $cptId = 0; - while ($queryResult = $stmt->fetchObject()) { - $result[$cptId] = $queryResult->cycle_id; - $cptId++; - } - return $result; - } else { - return null; - } - } - - /** - * Check the where clause syntax - * - * @param $where_clause string The where clause to check - * @return bool true if the syntax is correct, false otherwise - */ - public function where_test($where_clause) - { - $res = true; - $db = new Database(); - if (!empty($where_clause)) { - $stmt = $db->query("select res_id from " - . $_SESSION['collections'][0]['view']." where " - . $where_clause, array(), true - ); - } - if (!$stmt) { - $stmt = false; - } - return $stmt; - } -} - diff --git a/modules/life_cycle/class/lc_policies.php b/modules/life_cycle/class/lc_policies.php deleted file mode 100755 index b3852ee2da23615d41d470338668eabac9c453d2..0000000000000000000000000000000000000000 --- a/modules/life_cycle/class/lc_policies.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php -/* -* Copyright 2008-2011 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** -* @brief Contains the users Object (herits of the BaseObject class) -* -* -* @file -* @author Laurent Giovannoni <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup life_cycle -*/ - -// Loads the required class -try { - require_once("core/class/BaseObject.php"); -} catch (Exception $e){ - functions::xecho($e->getMessage()).' // '; -} - -/** -* @brief lc_policies Object, herits of the BaseObject class -* -* @ingroup life_cycle -*/ -class lc_policies extends BaseObject -{ - /** - *Print a viewable string to render the object. - * @return string Rendering of the object - */ - public function __toString() - { - return $this->policy_name; - } -} diff --git a/modules/life_cycle/class/lc_policies_controler.php b/modules/life_cycle/class/lc_policies_controler.php deleted file mode 100755 index 8de0d741a5a20e917bbb6224739d4fa01f15680b..0000000000000000000000000000000000000000 --- a/modules/life_cycle/class/lc_policies_controler.php +++ /dev/null @@ -1,452 +0,0 @@ -<?php - -/* -* Copyright 2008-2011 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** -* @brief Contains the controler of life_cycle object (create, save, modify, etc...) -* -* -* @file -* @author Luc KEULEYAN - BULL -* @author Laurent Giovannoni -* @date $date$ -* @version $Revision$ -* @ingroup life_cycle -*/ - -// To activate de debug mode of the class -$_ENV['DEBUG'] = false; - -// Loads the required class -try { - require_once ("modules/life_cycle/class/lc_policies.php"); - require_once ("modules/life_cycle/life_cycle_tables_definition.php"); - require_once ("core/class/ObjectControlerAbstract.php"); - require_once ("core/class/ObjectControlerIF.php"); - require_once ("core/class/class_history.php"); -} catch (Exception $e) { - functions::xecho($e->getMessage()) . ' // '; -} - -/** -* @brief Controler of the lc_policies object -* -*<ul> -* <li>Get an lc_policies object from an id</li> -* <li>Save in the database a lc_policies</li> -* <li>Manage the operation on the lc_policies related tables in the database (insert, select, update, delete)</li> -*</ul> -* @ingroup life_cycle -*/ -class lc_policies_controler extends ObjectControler implements ObjectControlerIF -{ - - /** - * Save given object in database: - * - make an update if object already exists, - * - make an insert if new object. - * @param object $policy - * @param string mode up or add - * @return array - */ - public function save($policy, $mode = "") { - $control = array(); - if (!isset($policy) || empty($policy)) { - $control = array("status" => "ko", "value" => "", "error" => _POLICY_ID_EMPTY); - return $control; - } - $policy = $this->isAPolicy($policy); - $this->set_foolish_ids(array('policy_id')); - $this->set_specific_id('policy_id'); - if ($mode == "up") { - $control = $this->control($policy, "up"); - if ($control['status'] == "ok") { - //Update existing policy - if ($this->update($policy)) { - $control = array("status" => "ok", "value" => $policy->policy_id); - //history - if ($_SESSION['history']['lcadd'] == "true") { - $history = new history(); - $history->add( - _LC_POLICIES_TABLE_NAME, - $policy->policy_id, - 'UP', - 'lcaup', - _LC_POLICY_UPDATED." : ".$policy->policy_id, - $_SESSION['config']['databasetype'], - 'life_cycle' - ); - } - } else { - $control = array("status" => "ko", "value" => "", "error" => _PB_WITH_POLICY); - } - return $control; - } - } else { - $control = $this->control($policy, "add"); - if ($control['status'] == "ok") { - //Insert new policy - if ($this->insert($policy)) { - $control = array("status" => "ok", "value" => $policy->policy_id); - //history - if ($_SESSION['history']['lcadd'] == "true") { - $history = new history(); - $history->add( - _LC_POLICIES_TABLE_NAME, - $policy->policy_id, - 'ADD', - 'lcadd', - _LC_POLICY_ADDED." : ".$policy->policy_id, - $_SESSION['config']['databasetype'], - 'life_cycle' - ); - } - } else { - $control = array("status" => "ko", "value" => "", "error" => _PB_WITH_POLICY); - } - } - } - return $control; - } - - /** - * control the policy object before action - * - * @param object $policy policy object - * @param string $mode up or add - * @return array ok if the object is well formated, ko otherwise - */ - private function control($policy, $mode) { - $f = new functions(); - $error = ""; - // Update, so values exist - $policy->policy_id=$f->wash($policy->policy_id, "nick", _LC_POLICY_ID." ", 'yes', 0, 32); - $policy->policy_name=$f->wash($policy->policy_name, "no", _POLICY_NAME." ", 'yes', 0, 255); - $policy->policy_desc=$f->wash($policy->policy_desc, "no", _POLICY_DESC." ", 'yes', 0, 255); - if ($mode == "add" && $this->policyExists($policy->policy_id)) { - $error .= $policy->policy_id." "._ALREADY_EXISTS."#"; - } - $error .= $_SESSION['error']; - //TODO:rewrite wash to return errors without html - $error = str_replace("<br />", "#", $error); - $return = array(); - if (!empty($error)) { - $return = array("status" => "ko", "value" => $policy->policy_id, "error" => $error); - } else { - $return = array("status" => "ok", "value" => $policy->policy_id); - } - return $return; - } - - /** - * Inserts in the database (lc_policies table) a lc_policies object - * - * @param $policy lc_policies object - * @return bool true if the insertion is complete, false otherwise - */ - private function insert($policy) { - return $this->advanced_insert($policy); - } - - /** - * Updates in the database (lc_policies table) a lc_policies object - * - * @param $policy lc_policies object - * @return bool true if the update is complete, false otherwise - */ - private function update($policy) { - return $this->advanced_update($policy); - } - - /** - * Returns an lc_policies object based on a lc_policies identifier - * - * @param $policy_id string lc_policies identifier - * @return lc_policies object with properties from the database or null - */ - public function get($policy_id) { - $this->set_foolish_ids(array('policy_id')); - $this->set_specific_id('policy_id'); - $policy = $this->advanced_get($policy_id, _LC_POLICIES_TABLE_NAME); - //var_dump($policy); - if (get_class($policy) <> "lc_policies") { - return null; - } else { - //var_dump($policy); - return $policy; - } - } - - /** - * get lc_policies with given id for a ws. - * Can return null if no corresponding object. - * @param $policy_id of policy to send - * @return policy - */ - public function getWs($policy_id) { - $this->set_foolish_ids(array('policy_id')); - $this->set_specific_id('policy_id'); - $policy = $this->advanced_get($policy_id, _LC_POLICIES_TABLE_NAME); - if (get_class($policy) <> "lc_policies") { - return null; - } else { - $policy = $policy->getArray(); - return $policy; - } - } - - /** - * Deletes in the database (lc_policies related tables) a given lc_policies (policy_id) - * - * @param $policy object policy object - * @return array true if the deletion is complete, false otherwise - */ - public function delete($policy) { - $control = array(); - if (!isset($policy) || empty($policy)) { - $control = array("status" => "ko", "value" => "", "error" => _LC_POLICY_EMPTY); - return $control; - } - $policy = $this->isAPolicy($policy); - if (!$this->policyExists($policy->policy_id)) { - $control = array("status" => "ko", "value" => "", "error" => _LC_POLICY_NOT_EXISTS); - return $control; - } - if ($this->linkExists($policy->policy_id)) { - $control = array("status" => "ko", "value" => "", "error" => _LINK_EXISTS); - return $control; - } - $db=new Database(); - $query="delete from "._LC_POLICIES_TABLE_NAME." where policy_id = ?"; - try { - $stmt = $db->query($query, array($policy->policy_id)); - $ok = true; - } catch (Exception $e) { - $control = array("status" => "ko", "value" => "", "error" => _CANNOT_DELETE_POLICY_ID." ".$policy->policy_id); - $ok = false; - } - $control = array("status" => "ok", "value" => $policy->policy_id); - if ($_SESSION['history']['lcdel'] == "true") { - require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_history.php"); - $history = new history(); - $history->add( - _LC_POLICIES_TABLE_NAME, - $policy->policy_id, - 'DEL', - 'lcdel', - _LC_POLICY_DELETED." : ".$policy->policy_id, - $_SESSION['config']['databasetype'] - ); - } - return $control; - } - - /** - * Disables a given lc_policies - * - * @param $policy lc_policies object - * @return bool true if the disabling is complete, false otherwise - */ - public function disable($policy) { - // - } - - /** - * Enables a given lc_policies - * - * @param $policy lc_policies object - * @return bool true if the enabling is complete, false otherwise - */ - public function enable($policy) { - // - } - - /** - * Fill a policy object with an object if it's not a policy - * - * @param $object ws policy object - * @return object policy - */ - private function isAPolicy($object) { - if (get_class($object) <> "lc_policies") { - $func = new functions(); - $policyObject = new lc_policies(); - $array = array(); - $array = $func->object2array($object); - foreach(array_keys($array) as $key) { - $policyObject->{$key} = $array[$key]; - } - return $policyObject; - } else { - return $object; - } - } - - /** - * checks if the lc_policy exists - * - * @param $policy_id lc_policy identifier - * @return bool true if lc_policy exists - */ - public function policyExists($policy_id) { - if (!isset ($policy_id) || empty ($policy_id)) - return false; - $db = new Database(); - $query = "select policy_id from " . _LC_POLICIES_TABLE_NAME - . " where policy_id = ?"; - try { - $stmt = $db->query($query, array($policy_id)); - } catch (Exception $e) { - echo _UNKNOWN . _LC_POLICY . " " . $policy_id . ' // '; - } - if ($stmt->rowCount() > 0) { - return true; - } - return false; - } - - /** - * checks if the lc_policy is linked - * - * @param $policy_id lc_policy identifier - * @return bool true if lc_policy is linked - */ - public function linkExists($policy_id) { - if (!isset($policy_id) || empty($policy_id)) - return false; - $db = new Database(); - $query = "select policy_id from "._LC_STACK_TABLE_NAME." where policy_id = ?"; - $stmt = $db->query($query, array($policy_id)); - if ($stmt->rowCount()>0) { - return true; - } - $query = "select policy_id from "._LC_CYCLE_STEPS_TABLE_NAME." where policy_id = ?"; - $stmt = $db->query($query, array($policy_id)); - if ($stmt->rowCount()>0) { - return true; - } - $query = "select policy_id from "._LC_CYCLES_TABLE_NAME." where policy_id = ?"; - $stmt = $db->query($query, array($policy_id)); - if ($stmt->rowCount()>0) { - return true; - } - } - - /** - * Return all policies ID - * - * @return array of policies - */ - public function getAllId() { - $db = new Database(); - $query = "select policy_id from " . _LC_POLICIES_TABLE_NAME . " "; - try { - $stmt = $db->query($query); - } catch (Exception $e) { - echo _NO_LC_POLICY_LOCATION . ' // '; - } - if ($stmt->rowCount() > 0) { - $result = array (); - $cptId = 0; - while ($queryResult = $stmt->fetchObject()) { - $result[$cptId] = $queryResult->policy_id; - $cptId++; - } - return $result; - } else { - return null; - } - } - - /** - * Return array of the workflow if the policy have a cycle and a step - * - * @param $policy_id lc_policy identifier - * @return array describing the workflow - */ - public function designPolicyWorkflow($policyId) - { - if (!isset($policyId) || empty($policyId)) { - return false; - } - $db = new Database(); - $dbBis = new Database(); - $result = array(); - $query = "select * from " . _LC_CYCLES_TABLE_NAME - . " where policy_id = ? order by sequence_number"; - $stmt = $db->query($query, array($policyId)); - $cptCycles = 0; - if ($stmt->rowCount() > 0) { - while ($cycleLine = $stmt->fetchObject()) { - $cptSteps = 0; - $result['cycles'][$cptCycles]['cycle_id'] = - $cycleLine->cycle_id; - $result['cycles'][$cptCycles]['cycle_desc'] = - $cycleLine->cycle_desc; - $result['cycles'][$cptCycles]['sequence_number'] = - $cycleLine->sequence_number; - $result['cycles'][$cptCycles]['where_clause'] = - $cycleLine->where_clause; - $result['cycles'][$cptCycles]['break_key'] = - $cycleLine->break_key; - $query = "select * from " . _LC_CYCLE_STEPS_TABLE_NAME - . " where cycle_id = ? order by sequence_number"; - $stmtBis = $dbBis->query($query, array($cycleLine->cycle_id)); - if ($stmtBis->rowCount() > 0) { - while ($stepLine = $stmtBis->fetchObject()) { - $result['cycles'][$cptCycles]['steps'][$cptSteps] - ['cycle_step_id'] = $stepLine->cycle_step_id; - $result['cycles'][$cptCycles]['steps'][$cptSteps] - ['cycle_step_desc'] = $stepLine->cycle_step_desc; - $result['cycles'][$cptCycles]['steps'][$cptSteps] - ['docserver_type_id'] = - $stepLine->docserver_type_id; - $result['cycles'][$cptCycles]['steps'][$cptSteps] - ['step_operation'] = $stepLine->step_operation; - $result['cycles'][$cptCycles]['steps'][$cptSteps] - ['sequence_number'] = $stepLine->sequence_number; - $cptSteps++; - } - } else { - $return = array( - 'status' => 'ko', - 'value' => '', - 'error' => _MISSING_A_CYCLE_STEP, - ); - return $return; - } - $cptCycles++; - } - } else { - $return = array( - 'status' => 'ko', - 'value' => '', - 'error' => _MISSING_A_CYCLE_AND_A_CYCLE_STEP, - ); - return $return; - } - $return = array( - 'status' => 'ok', - 'value' => $result, - 'error' => '', - ); - return $return; - } -} diff --git a/modules/life_cycle/css/module.css b/modules/life_cycle/css/module.css deleted file mode 100755 index ae51020e491dff1aabdaea5cbfce5320450a9d3f..0000000000000000000000000000000000000000 --- a/modules/life_cycle/css/module.css +++ /dev/null @@ -1 +0,0 @@ -/* life_cycle module */ /* menu */ /* admin modules board */ #lc_admin_lc { background: url(static.php?module=life_cycle&filename=manage_lc.gif) no-repeat 2px top; } /* life cycle management*/ #admin_lc_policies { background: url(static.php?module=life_cycle&filename=manage_lc.gif) no-repeat 2px top; width: 315px; min-height: 110px; float: left; padding-top: 0px; padding-right: 18px; padding-bottom: 0px; padding-left: 0px; margin: 0px 0px 15px; position: relative; display: block; } #admin_lc_cycles { background: url(static.php?module=life_cycle&filename=manage_lc.gif) no-repeat 2px top; width: 315px; min-height: 110px; float: left; padding-top: 0px; padding-right: 18px; padding-bottom: 0px; padding-left: 0px; margin: 0px 0px 15px; position: relative; display: block; } #admin_lc_cycle_steps { background: url(static.php?module=life_cycle&filename=manage_lc.gif) no-repeat 2px top; width: 315px; min-height: 110px; float: left; padding-top: 0px; padding-right: 18px; padding-bottom: 0px; padding-left: 0px; margin: 0px 0px 15px; position: relative; display: block; } /*Help for the IPV6, IPV4, mask adresses*/ .bulle span { display:none; position:absolute; right:30ex; padding:3px; font-size: small; border:1px solid #963; background-color:#FF6; color:#000; -moz-border-radius: 5px; border-radius: 5px; } .bulle:hover span{ display:block; } \ No newline at end of file diff --git a/modules/life_cycle/js/functions.js b/modules/life_cycle/js/functions.js deleted file mode 100755 index 5f7c77da42a31858501935467493f7aa968f0a4c..0000000000000000000000000000000000000000 --- a/modules/life_cycle/js/functions.js +++ /dev/null @@ -1 +0,0 @@ -// diff --git a/modules/life_cycle/lang/en.php b/modules/life_cycle/lang/en.php index b6c711663d7396e66d5372f2dd76af69f83832db..c5a7bbb44470789ba44f19523ca623545e79fa95 100755 --- a/modules/life_cycle/lang/en.php +++ b/modules/life_cycle/lang/en.php @@ -20,156 +20,33 @@ * along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. */ -/*********************** ADMIN ***********************************/ -if (!defined("_LIFE_CYCLE_COMMENT")) - define("_LIFE_CYCLE_COMMENT", "Life cycle management"); -if (!defined("_ADMIN_LIFE_CYCLE")) - define("_ADMIN_LIFE_CYCLE", " Archiving politics"); -if (!defined("_ADMIN_LIFE_CYCLE_DESC")) - define("_ADMIN_LIFE_CYCLE_DESC", "Archiving politics definition, cycles and steps until final disposition"); -if (!defined("_LIFE_CYCLE")) - define("_LIFE_CYCLE", "Cycle de vie"); -if (!defined("_ADMIN_LIFE_CYCLE_SHORT")) - define("_ADMIN_LIFE_CYCLE_SHORT", " Life cycles administration"); -if (!defined("_MANAGE_LC_CYCLES")) - define("_MANAGE_LC_CYCLES", "Manage the life cycles "); -if (!defined("_MANAGE_LC_CYCLE_STEPS")) - define("_MANAGE_LC_CYCLE_STEPS", "Manage the life cycles steps"); -if (!defined("_MANAGE_LC_POLICIES")) - define("_MANAGE_LC_POLICIES", "Manage archiving politics"); - -/*****************CYCLE_STEPS************************************/ -if (!defined("_LC_CYCLE_STEPS")) - define("_LC_CYCLE_STEPS", ""); -if (!defined("_LC_CYCLE_STEP")) - define("_LC_CYCLE_STEP", "Life cycle step"); -if (!defined("_LC_CYCLE_STEP_ID")) - define("_LC_CYCLE_STEP_ID", "Life cycle step ID"); -if (!defined("_COLLECTION_IDENTIFIER")) - define("_COLLECTION_IDENTIFIER", "Collection ID"); -if (!defined("_LC_CYCLE_STEPS_LIST")) - define("_LC_CYCLE_STEPS_LIST", "Life cycle steps list"); -if (!defined("_ALL_LC_CYCLE_STEPS")) - define("_ALL_LC_CYCLE_STEPS", "Display everything"); -if (!defined("_POLICY_ID")) - define("_POLICY_ID", "Archiving policy ID"); -if (!defined("_CYCLE_STEP_ID")) - define("_CYCLE_STEP_ID", "Life cycle step ID "); -if (!defined("_CYCLE_STEP_DESC")) - define("_CYCLE_STEP_DESC","Life cycle step description"); -if (!defined("_STEP_OPERATION")) - define("_STEP_OPERATION", "Action on the life cycles steps"); -if (!defined("_IS_ALLOW_FAILURE")) - define("_IS_ALLOW_FAILURE", "Allow failures"); -if (!defined("_IS_MUST_COMPLETE")) - define("_IS_MUST_COMPLETE", "Must be complete"); -if (!defined("_PREPROCESS_SCRIPT")) - define("_PREPROCESS_SCRIPT", "Pre process script"); -if (!defined("_POSTPROCESS_SCRIPT")) - define("_POSTPROCESS_SCRIPT", "Post Process script"); -if (!defined("_LC_CYCLE_STEP_ADDITION")) - define("_LC_CYCLE_STEP_ADDITION","Add a step on the life cycle"); -if (!defined("_LC_CYCLE_STEP_UPDATED")) - define("_LC_CYCLE_STEP_UPDATED", "Updated life cycle step"); -if (!defined("_LC_CYCLE_STEP_ADDED")) - define("_LC_CYCLE_STEP_ADDED", " Added a life cycle step"); -if (!defined("_LC_CYCLE_STEP_DELETED")) - define("_LC_CYCLE_STEP_DELETED", "Deleted life cycle step"); -if (!defined("_LC_CYCLE_STEP_MODIFICATION")) - define("_LC_CYCLE_STEP_MODIFICATION","Modification of a life cycle step"); - -/****************CYCLES*************************************/ -if (!defined("_CYCLE_ID")) - define("_CYCLE_ID", "Life cycle ID"); -if (!defined("_LC_CYCLE_ID")) - define("_LC_CYCLE_ID", "Life cycle ID"); -if (!defined("_LC_CYCLE")) - define("_LC_CYCLE", "A life cycle"); -if (!defined("_LC_CYCLES")) - define("_LC_CYCLES", "Life cycle(s)"); -if (!defined("_CYCLE_DESC")) - define("_CYCLE_DESC", "Description of life cycle"); -if (!defined("_VALIDATION_MODE")) - define("_VALIDATION_MODE", "Validation mode"); -if (!defined("_ALL_LC_CYCLES")) - define("_ALL_LC_CYCLES", "Show everything"); -if (!defined("_LC_CYCLES_LIST")) - define("_LC_CYCLES_LIST", "life cycles lists"); -if (!defined("_SEQUENCE_NUMBER")) - define("_SEQUENCE_NUMBER", "Sequence number"); -if (!defined("_BREAK_KEY")) - define("_BREAK_KEY", "Breach key"); -if (!defined("_LC_CYCLE_ADDITION")) - define("_LC_CYCLE_ADDITION", "Add a life cycle"); -if (!defined("_LC_CYCLE_ADDED")) - define("_LC_CYCLE_ADDED", "Added life cycle"); -if (!defined("_LC_CYCLE_UPDATED")) - define("_LC_CYCLE_UPDATED", "Updated life cycle"); -if (!defined("_LC_CYCLE_DELETED")) - define("_LC_CYCLE_DELETED", "Deleted life cycle"); -if (!defined("_LC_CYCLE_MODIFICATION")) - define("_LC_CYCLE_MODIFICATION", "Life cycle modification"); -if (!defined("_PB_WITH_WHERE_CLAUSE")) - define("_PB_WITH_WHERE_CLAUSE", "Problem on clause where"); -if (!defined("_CANNOT_DELETE_CYCLE_ID")) - define("_CANNOT_DELETE_CYCLE_ID", "Impossible to delete the cycle"); - -/*************CYCLE POLICIES*************************************/ -if (!defined("_LC_POLICIES")) - define("_LC_POLICIES", ""); -if (!defined("_LC_POLICY")) - define("_LC_POLICY", "Archiving policy"); -if (!defined("_POLICY_NAME")) - define("_POLICY_NAME", "Policy name"); -if (!defined("_LC_POLICY_ID")) - define("_LC_POLICY_ID", "Policy ID"); -if (!defined("_LC_POLICY_NAME")) - define("_LC_POLICY_NAME", "Policy name"); -if (!defined("_POLICY_DESC")) - define("_POLICY_DESC", "Policy description"); -if (!defined("_LC_POLICY_ADDITION")) - define("_LC_POLICY_ADDITION", "Add a life cycle policy"); -if (!defined("_LC_POLICIES_LIST")) - define("_LC_POLICIES_LIST", "Life cycle policy list"); -if (!defined("_ALL_LC_POLICIES")) - define("_ALL_LC_POLICIES", "Show everything"); -if (!defined("_LC_POLICY_UPDATED")) - define("_LC_POLICY_UPDATED", "Updated life cycle policy"); -if (!defined("_LC_POLICY_ADDED")) - define("_LC_POLICY_ADDED", "Policy of added life cycle"); -if (!defined("_LC_POLICY_DELETED")) - define("_LC_POLICY_DELETED", "Deleted life cycle policy"); -if (!defined("_LC_POLICY_MODIFICATION")) - define("_LC_POLICY_MODIFICATION","Archiving policy modification"); -if (!defined("_MISSING_A_CYCLE_STEP")) - define("_MISSING_A_CYCLE_STEP", "You have to add one life cycle step at least to complete your configuration"); -if (!defined("_MISSING_A_CYCLE_AND_A_CYCLE_STEP")) - define("_MISSING_A_CYCLE_AND_A_CYCLE_STEP", "You have to add one life cycle et one step at least to complete your configuration"); - /*************BATCH*************************************/ -if (!defined("_PI_COMMENT_ROOT")) +if (!defined("_PI_COMMENT_ROOT")) { define("_PI_COMMENT_ROOT", "Packaging information: Archiving package utilisation (Archival Information package)"); -if (!defined("_PI_COMMENT_FINGERPRINT")) +} +if (!defined("_PI_COMMENT_FINGERPRINT")) { define("_PI_COMMENT_FINGERPRINT", "Print associated to the CI/ IC file"); -if (!defined("_PI_COMMENT_AIU")) +} +if (!defined("_PI_COMMENT_AIU")) { define("_PI_COMMENT_AIU", "Number of present resources in the AIP"); -if (!defined("_PI_COMMENT_CONTENT")) +} +if (!defined("_PI_COMMENT_CONTENT")) { define("_PI_COMMENT_CONTENT", "Digital resources in their native format (name + file extension)"); -if (!defined("_PI_COMMENT_PDI")) - define("_PI_COMMENT_PDI","Preservation Description Information: Descriptors catalogue of Source, Reference, Context, Integrity and Access Rights of present resources in <CONTENT_FILE>. For practical reasons, the processing history is stored apart in. See pdi.xsd for the commented structure"); -if (!defined("_HISTORY_COMMENT_ROOT")) +} +if (!defined("_PI_COMMENT_PDI")) { + define("_PI_COMMENT_PDI", "Preservation Description Information: Descriptors catalogue of Source, Reference, Context, Integrity and Access Rights of present resources in <CONTENT_FILE>. For practical reasons, the processing history is stored apart in. See pdi.xsd for the commented structure"); +} +if (!defined("_HISTORY_COMMENT_ROOT")) { define("_HISTORY_COMMENT_ROOT", "Preservation Description Information - History : Events list on the resource, each event game is identified by its file name in <CONTENT_FILE>. Chronologically classified"); -if (!defined("_PDI_COMMENT_ROOT")) - define("_PDI_COMMENT_ROOT","Preservation Description Information : Descriptors list of resource, classified by category : Source, Reference, Context, Integrity et access rights. There is a description by resource, each resource is identified by its file name in <CONTENT_FILE>"); -if (!defined("_PDI_COMMENT_HISTORY")) +} +if (!defined("_PDI_COMMENT_ROOT")) { + define("_PDI_COMMENT_ROOT", "Preservation Description Information : Descriptors list of resource, classified by category : Source, Reference, Context, Integrity et access rights. There is a description by resource, each resource is identified by its file name in <CONTENT_FILE>"); +} +if (!defined("_PDI_COMMENT_HISTORY")) { define("_PDI_COMMENT_HISTORY", "Preservation Description Information - History : Events list on the resource, each event game is identified by its folder name in <CONTENT_FILE>. Chronologically classified."); +} /*************OTHER*************************************/ -if (!defined("_DOCS")) +if (!defined("_DOCS")) { define("_DOCS", "Mails"); -if (!defined("_LINK_EXISTS")) - define("_LINK_EXISTS", "A link with an other object exists"); -if (!defined("_VIEW_GENERAL_PARAMETERS_OF_THE_POLICY")) - define("_VIEW_GENERAL_PARAMETERS_OF_THE_POLICY", "View the global setting of the life cycles policy"); - - +} diff --git a/modules/life_cycle/lang/fr.php b/modules/life_cycle/lang/fr.php index afeef261efb02342c2a39ffa258877a080d3715e..9639b0303c05f9a636b44f9fa098381feffbf016 100755 --- a/modules/life_cycle/lang/fr.php +++ b/modules/life_cycle/lang/fr.php @@ -20,156 +20,33 @@ * along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. */ -/*********************** ADMIN ***********************************/ -if (!defined("_LIFE_CYCLE_COMMENT")) - define("_LIFE_CYCLE_COMMENT", "Gestion du cycle de vie"); -if (!defined("_ADMIN_LIFE_CYCLE")) - define("_ADMIN_LIFE_CYCLE", " Politiques d'archivage"); -if (!defined("_ADMIN_LIFE_CYCLE_DESC")) - define("_ADMIN_LIFE_CYCLE_DESC", "Définition des politiques d'archivage, cycles et étapes jusqu'au sort final"); -if (!defined("_LIFE_CYCLE")) - define("_LIFE_CYCLE", "Cycle de vie"); -if (!defined("_ADMIN_LIFE_CYCLE_SHORT")) - define("_ADMIN_LIFE_CYCLE_SHORT", " Administration des cycles de vie"); -if (!defined("_MANAGE_LC_CYCLES")) - define("_MANAGE_LC_CYCLES", "Gérer les cycles de vie "); -if (!defined("_MANAGE_LC_CYCLE_STEPS")) - define("_MANAGE_LC_CYCLE_STEPS", "Gérer les étapes de cycle de vie"); -if (!defined("_MANAGE_LC_POLICIES")) - define("_MANAGE_LC_POLICIES", "Gérer les politiques d'archivage "); - -/*****************CYCLE_STEPS************************************/ -if (!defined("_LC_CYCLE_STEPS")) - define("_LC_CYCLE_STEPS", ""); -if (!defined("_LC_CYCLE_STEP")) - define("_LC_CYCLE_STEP", "une étape de cycle de vie"); -if (!defined("_LC_CYCLE_STEP_ID")) - define("_LC_CYCLE_STEP_ID", "Identifiant étape de cycle de vie"); -if (!defined("_COLLECTION_IDENTIFIER")) - define("_COLLECTION_IDENTIFIER", "identifiant de la collection"); -if (!defined("_LC_CYCLE_STEPS_LIST")) - define("_LC_CYCLE_STEPS_LIST", "Liste des étapes de cycle de vie"); -if (!defined("_ALL_LC_CYCLE_STEPS")) - define("_ALL_LC_CYCLE_STEPS", "Tout afficher"); -if (!defined("_POLICY_ID")) - define("_POLICY_ID", "Identifiant de la politique d'archivage"); -if (!defined("_CYCLE_STEP_ID")) - define("_CYCLE_STEP_ID", "Identifiant de l'etape de cycle de vie "); -if (!defined("_CYCLE_STEP_DESC")) - define("_CYCLE_STEP_DESC","Description de l'étape de cycle de vie"); -if (!defined("_STEP_OPERATION")) - define("_STEP_OPERATION", "Action sur les étapes de cycle de vie"); -if (!defined("_IS_ALLOW_FAILURE")) - define("_IS_ALLOW_FAILURE", "Permettre des échecs"); -if (!defined("_IS_MUST_COMPLETE")) - define("_IS_MUST_COMPLETE", "Doit être complet"); -if (!defined("_PREPROCESS_SCRIPT")) - define("_PREPROCESS_SCRIPT", "Script de pré-traitement"); -if (!defined("_POSTPROCESS_SCRIPT")) - define("_POSTPROCESS_SCRIPT", "Script de post-traitement"); -if (!defined("_LC_CYCLE_STEP_ADDITION")) - define("_LC_CYCLE_STEP_ADDITION","Ajouter une étape de cycle de vie"); -if (!defined("_LC_CYCLE_STEP_UPDATED")) - define("_LC_CYCLE_STEP_UPDATED", "Etape de cycle de vie mise à jour"); -if (!defined("_LC_CYCLE_STEP_ADDED")) - define("_LC_CYCLE_STEP_ADDED", "Etape de cycle de vie ajoutée"); -if (!defined("_LC_CYCLE_STEP_DELETED")) - define("_LC_CYCLE_STEP_DELETED", "Etape de cycle de vie supprimée"); -if (!defined("_LC_CYCLE_STEP_MODIFICATION")) - define("_LC_CYCLE_STEP_MODIFICATION","Modification d' une étape de cycle de vie"); - -/****************CYCLES*************************************/ -if (!defined("_CYCLE_ID")) - define("_CYCLE_ID", "Identifiant du cycle de vie"); -if (!defined("_LC_CYCLE_ID")) - define("_LC_CYCLE_ID", "Identifiant du cycle de vie"); -if (!defined("_LC_CYCLE")) - define("_LC_CYCLE", "un cycle de vie"); -if (!defined("_LC_CYCLES")) - define("_LC_CYCLES", "Cycle(s) de vie"); -if (!defined("_CYCLE_DESC")) - define("_CYCLE_DESC", "Descriptif du cycle de vie"); -if (!defined("_VALIDATION_MODE")) - define("_VALIDATION_MODE", "Mode de validation"); -if (!defined("_ALL_LC_CYCLES")) - define("_ALL_LC_CYCLES", "Tout afficher"); -if (!defined("_LC_CYCLES_LIST")) - define("_LC_CYCLES_LIST", "Liste des cycles de vie"); -if (!defined("_SEQUENCE_NUMBER")) - define("_SEQUENCE_NUMBER", "Numero de séquence"); -if (!defined("_BREAK_KEY")) - define("_BREAK_KEY", "Clé de rupture"); -if (!defined("_LC_CYCLE_ADDITION")) - define("_LC_CYCLE_ADDITION", "Ajouter un cycle de vie"); -if (!defined("_LC_CYCLE_ADDED")) - define("_LC_CYCLE_ADDED", "Cycle de vie ajouté"); -if (!defined("_LC_CYCLE_UPDATED")) - define("_LC_CYCLE_UPDATED", "Cycle de vie mis à jour"); -if (!defined("_LC_CYCLE_DELETED")) - define("_LC_CYCLE_DELETED", "Cycle de vie supprimé"); -if (!defined("_LC_CYCLE_MODIFICATION")) - define("_LC_CYCLE_MODIFICATION", "Modification du cycle de vie"); -if (!defined("_PB_WITH_WHERE_CLAUSE")) - define("_PB_WITH_WHERE_CLAUSE", "Clause where mal définie"); -if (!defined("_CANNOT_DELETE_CYCLE_ID")) - define("_CANNOT_DELETE_CYCLE_ID", "Impossible de supprimer le cycle"); - -/*************CYCLE POLICIES*************************************/ -if (!defined("_LC_POLICIES")) - define("_LC_POLICIES", ""); -if (!defined("_LC_POLICY")) - define("_LC_POLICY", "une politique d'archivage"); -if (!defined("_POLICY_NAME")) - define("_POLICY_NAME", "Nom de la politique"); -if (!defined("_LC_POLICY_ID")) - define("_LC_POLICY_ID", "Identifiant de la politique"); -if (!defined("_LC_POLICY_NAME")) - define("_LC_POLICY_NAME", "Nom de la politique"); -if (!defined("_POLICY_DESC")) - define("_POLICY_DESC", "Descriptif de la politique"); -if (!defined("_LC_POLICY_ADDITION")) - define("_LC_POLICY_ADDITION", "Ajouter une politique de cycle de vie"); -if (!defined("_LC_POLICIES_LIST")) - define("_LC_POLICIES_LIST", "Liste des politiques de cycle de vie"); -if (!defined("_ALL_LC_POLICIES")) - define("_ALL_LC_POLICIES", "Tout afficher"); -if (!defined("_LC_POLICY_UPDATED")) - define("_LC_POLICY_UPDATED", "Politique de cycle de vie mise à jour"); -if (!defined("_LC_POLICY_ADDED")) - define("_LC_POLICY_ADDED", "Politique de cycle de vie ajoutée"); -if (!defined("_LC_POLICY_DELETED")) - define("_LC_POLICY_DELETED", "Politique de cycle de vie supprimée"); -if (!defined("_LC_POLICY_MODIFICATION")) - define("_LC_POLICY_MODIFICATION","Modification de la politique d'archivage"); -if (!defined("_MISSING_A_CYCLE_STEP")) - define("_MISSING_A_CYCLE_STEP", "Vous devez ajouter au moins une étape de cycle de vie pour compléter votre paramétrage"); -if (!defined("_MISSING_A_CYCLE_AND_A_CYCLE_STEP")) - define("_MISSING_A_CYCLE_AND_A_CYCLE_STEP", "Vous devez ajouter au moins un cycle de vie et une étape pour compléter votre paramétrage"); - /*************BATCH*************************************/ -if (!defined("_PI_COMMENT_ROOT")) +if (!defined("_PI_COMMENT_ROOT")) { define("_PI_COMMENT_ROOT", "Packaging information: Utilisation du paquet d archivage (Archival Information package)"); -if (!defined("_PI_COMMENT_FINGERPRINT")) +} +if (!defined("_PI_COMMENT_FINGERPRINT")) { define("_PI_COMMENT_FINGERPRINT", "Empreinte associée au fichier CI"); -if (!defined("_PI_COMMENT_AIU")) +} +if (!defined("_PI_COMMENT_AIU")) { define("_PI_COMMENT_AIU", "Nombre de ressources présentes dans l AIP"); -if (!defined("_PI_COMMENT_CONTENT")) +} +if (!defined("_PI_COMMENT_CONTENT")) { define("_PI_COMMENT_CONTENT", "Ressources digitales dans leur format natif (nom + extension de fichier)"); -if (!defined("_PI_COMMENT_PDI")) - define("_PI_COMMENT_PDI","Preservation Description Information: Catalogue des descripteurs de Provenance, Référence, Contexte, Intégrité et Droits d accès des ressources présentes dans <CONTENT_FILE>. Pour des raisons pratiques l historique de traitement est stocké à part dans <HISTORY_FILE>. Voir pdi.xsd pour la structure commentée"); -if (!defined("_HISTORY_COMMENT_ROOT")) +} +if (!defined("_PI_COMMENT_PDI")) { + define("_PI_COMMENT_PDI", "Preservation Description Information: Catalogue des descripteurs de Provenance, Référence, Contexte, Intégrité et Droits d accès des ressources présentes dans <CONTENT_FILE>. Pour des raisons pratiques l historique de traitement est stocké à part dans <HISTORY_FILE>. Voir pdi.xsd pour la structure commentée"); +} +if (!defined("_HISTORY_COMMENT_ROOT")) { define("_HISTORY_COMMENT_ROOT", "Preservation Description Information - Historique : Liste des évènements sur la ressource, chaque jeu d évènement étant identifié par son nom de fichier dans <CONTENT_FILE>. Trié par date ascendante"); -if (!defined("_PDI_COMMENT_ROOT")) - define("_PDI_COMMENT_ROOT","Preservation Description Information : Liste des qualificateurs de ressource, rangés par catégorie : Provenance, Référence, Contexte, Intégrité et Droits d accès. Il y a une description par ressource, chaque ressource étant identifiée par son nom de fichier dans <CONTENT_FILE>"); -if (!defined("_PDI_COMMENT_HISTORY")) +} +if (!defined("_PDI_COMMENT_ROOT")) { + define("_PDI_COMMENT_ROOT", "Preservation Description Information : Liste des qualificateurs de ressource, rangés par catégorie : Provenance, Référence, Contexte, Intégrité et Droits d accès. Il y a une description par ressource, chaque ressource étant identifiée par son nom de fichier dans <CONTENT_FILE>"); +} +if (!defined("_PDI_COMMENT_HISTORY")) { define("_PDI_COMMENT_HISTORY", "Preservation Description Information - Historique : Liste des évènements sur la ressource, chaque jeu d évènement étant identifié par son nom de fichier dans <CONTENT_FILE>. Trié par date ascendante."); +} /*************OTHER*************************************/ -if (!defined("_DOCS")) +if (!defined("_DOCS")) { define("_DOCS", "Courriers"); -if (!defined("_LINK_EXISTS")) - define("_LINK_EXISTS", "Un lien avec un autre objet existe"); -if (!defined("_VIEW_GENERAL_PARAMETERS_OF_THE_POLICY")) - define("_VIEW_GENERAL_PARAMETERS_OF_THE_POLICY", "Voir le paramétrage global de la politique de cycle de vie"); - - +} diff --git a/modules/life_cycle/lang/nl.php b/modules/life_cycle/lang/nl.php index 2e936ab2d5caedac3fefe27325c547af490b26d4..dcbc1fbdecb7de6352a3792c2c722dfd3d48a757 100755 --- a/modules/life_cycle/lang/nl.php +++ b/modules/life_cycle/lang/nl.php @@ -6,191 +6,6 @@ * This file is part of Maarch software. */ -/*********************** ADMIN ***********************************/ -if (!defined("_LIFE_CYCLE_COMMENT")) { - define("_LIFE_CYCLE_COMMENT", "Gestion du cycle de vie"); -} -if (!defined("_ADMIN_LIFE_CYCLE")) { - define("_ADMIN_LIFE_CYCLE", " Politiques d'archivage"); -} -if (!defined("_ADMIN_LIFE_CYCLE_DESC")) { - define("_ADMIN_LIFE_CYCLE_DESC", "Définition des politiques d'archivage, cycles et étapes jusqu'au sort final"); -} -if (!defined("_LIFE_CYCLE")) { - define("_LIFE_CYCLE", "Cycle de vie"); -} -if (!defined("_ADMIN_LIFE_CYCLE_SHORT")) { - define("_ADMIN_LIFE_CYCLE_SHORT", " Administration des cycles de vie"); -} -if (!defined("_MANAGE_LC_CYCLES")) { - define("_MANAGE_LC_CYCLES", "Gérer les cycles de vie "); -} -if (!defined("_MANAGE_LC_CYCLE_STEPS")) { - define("_MANAGE_LC_CYCLE_STEPS", "Gérer les étapes de cycle de vie"); -} -if (!defined("_MANAGE_LC_POLICIES")) { - define("_MANAGE_LC_POLICIES", "Gérer les politiques d'archivage "); -} - -/*****************CYCLE_STEPS************************************/ -if (!defined("_LC_CYCLE_STEPS")) { - define("_LC_CYCLE_STEPS", ""); -} -if (!defined("_LC_CYCLE_STEP")) { - define("_LC_CYCLE_STEP", "une étape de cycle de vie"); -} -if (!defined("_LC_CYCLE_STEP_ID")) { - define("_LC_CYCLE_STEP_ID", "Identifiant étape de cycle de vie"); -} -if (!defined("_COLLECTION_IDENTIFIER")) { - define("_COLLECTION_IDENTIFIER", "identifiant de la collection"); -} -if (!defined("_LC_CYCLE_STEPS_LIST")) { - define("_LC_CYCLE_STEPS_LIST", "Liste des étapes de cycle de vie"); -} -if (!defined("_ALL_LC_CYCLE_STEPS")) { - define("_ALL_LC_CYCLE_STEPS", "Tout afficher"); -} -if (!defined("_POLICY_ID")) { - define("_POLICY_ID", "Identifiant de la politique d'archivage"); -} -if (!defined("_CYCLE_STEP_ID")) { - define("_CYCLE_STEP_ID", "Identifiant de l'etape de cycle de vie "); -} -if (!defined("_CYCLE_STEP_DESC")) { - define("_CYCLE_STEP_DESC", "Description de l'étape de cycle de vie"); -} -if (!defined("_STEP_OPERATION")) { - define("_STEP_OPERATION", "Action sur les étapes de cycle de vie"); -} -if (!defined("_IS_ALLOW_FAILURE")) { - define("_IS_ALLOW_FAILURE", "Permettre des échecs"); -} -if (!defined("_IS_MUST_COMPLETE")) { - define("_IS_MUST_COMPLETE", "Doit être complet"); -} -if (!defined("_PREPROCESS_SCRIPT")) { - define("_PREPROCESS_SCRIPT", "Script de pré-traitement"); -} -if (!defined("_POSTPROCESS_SCRIPT")) { - define("_POSTPROCESS_SCRIPT", "Script de post-traitement"); -} -if (!defined("_LC_CYCLE_STEP_ADDITION")) { - define("_LC_CYCLE_STEP_ADDITION", "Ajouter une étape de cycle de vie"); -} -if (!defined("_LC_CYCLE_STEP_UPDATED")) { - define("_LC_CYCLE_STEP_UPDATED", "Etape de cycle de vie mise à jour"); -} -if (!defined("_LC_CYCLE_STEP_ADDED")) { - define("_LC_CYCLE_STEP_ADDED", "Etape de cycle de vie ajoutée"); -} -if (!defined("_LC_CYCLE_STEP_DELETED")) { - define("_LC_CYCLE_STEP_DELETED", "Etape de cycle de vie supprimée"); -} -if (!defined("_LC_CYCLE_STEP_MODIFICATION")) { - define("_LC_CYCLE_STEP_MODIFICATION", "Modification d' une étape de cycle de vie"); -} - -/****************CYCLES*************************************/ -if (!defined("_CYCLE_ID")) { - define("_CYCLE_ID", "Identifiant du cycle de vie"); -} -if (!defined("_LC_CYCLE_ID")) { - define("_LC_CYCLE_ID", "Identifiant du cycle de vie"); -} -if (!defined("_LC_CYCLE")) { - define("_LC_CYCLE", "un cycle de vie"); -} -if (!defined("_LC_CYCLES")) { - define("_LC_CYCLES", "Cycle(s) de vie"); -} -if (!defined("_CYCLE_DESC")) { - define("_CYCLE_DESC", "Descriptif du cycle de vie"); -} -if (!defined("_VALIDATION_MODE")) { - define("_VALIDATION_MODE", "Mode de validation"); -} -if (!defined("_ALL_LC_CYCLES")) { - define("_ALL_LC_CYCLES", "Tout afficher"); -} -if (!defined("_LC_CYCLES_LIST")) { - define("_LC_CYCLES_LIST", "Liste des cycles de vie"); -} -if (!defined("_SEQUENCE_NUMBER")) { - define("_SEQUENCE_NUMBER", "Numero de séquence"); -} -if (!defined("_BREAK_KEY")) { - define("_BREAK_KEY", "Clé de rupture"); -} -if (!defined("_LC_CYCLE_ADDITION")) { - define("_LC_CYCLE_ADDITION", "Ajouter un cycle de vie"); -} -if (!defined("_LC_CYCLE_ADDED")) { - define("_LC_CYCLE_ADDED", "Cycle de vie ajouté"); -} -if (!defined("_LC_CYCLE_UPDATED")) { - define("_LC_CYCLE_UPDATED", "Cycle de vie mis à jour"); -} -if (!defined("_LC_CYCLE_DELETED")) { - define("_LC_CYCLE_DELETED", "Cycle de vie supprimé"); -} -if (!defined("_LC_CYCLE_MODIFICATION")) { - define("_LC_CYCLE_MODIFICATION", "Modification du cycle de vie"); -} -if (!defined("_PB_WITH_WHERE_CLAUSE")) { - define("_PB_WITH_WHERE_CLAUSE", "Clause where mal définie"); -} -if (!defined("_CANNOT_DELETE_CYCLE_ID")) { - define("_CANNOT_DELETE_CYCLE_ID", "Impossible de supprimer le cycle"); -} - -/*************CYCLE POLICIES*************************************/ -if (!defined("_LC_POLICIES")) { - define("_LC_POLICIES", ""); -} -if (!defined("_LC_POLICY")) { - define("_LC_POLICY", "une politique d'archivage"); -} -if (!defined("_POLICY_NAME")) { - define("_POLICY_NAME", "Nom de la politique"); -} -if (!defined("_LC_POLICY_ID")) { - define("_LC_POLICY_ID", "Identifiant de la politique"); -} -if (!defined("_LC_POLICY_NAME")) { - define("_LC_POLICY_NAME", "Nom de la politique"); -} -if (!defined("_POLICY_DESC")) { - define("_POLICY_DESC", "Descriptif de la politique"); -} -if (!defined("_LC_POLICY_ADDITION")) { - define("_LC_POLICY_ADDITION", "Ajouter une politique de cycle de vie"); -} -if (!defined("_LC_POLICIES_LIST")) { - define("_LC_POLICIES_LIST", "Liste des politiques de cycle de vie"); -} -if (!defined("_ALL_LC_POLICIES")) { - define("_ALL_LC_POLICIES", "Tout afficher"); -} -if (!defined("_LC_POLICY_UPDATED")) { - define("_LC_POLICY_UPDATED", "Politique de cycle de vie mise à jour"); -} -if (!defined("_LC_POLICY_ADDED")) { - define("_LC_POLICY_ADDED", "Politique de cycle de vie ajoutée"); -} -if (!defined("_LC_POLICY_DELETED")) { - define("_LC_POLICY_DELETED", "Politique de cycle de vie supprimée"); -} -if (!defined("_LC_POLICY_MODIFICATION")) { - define("_LC_POLICY_MODIFICATION", "Modification de la politique d'archivage"); -} -if (!defined("_MISSING_A_CYCLE_STEP")) { - define("_MISSING_A_CYCLE_STEP", "Vous devez ajouter au moins une étape de cycle de vie pour compléter votre paramétrage"); -} -if (!defined("_MISSING_A_CYCLE_AND_A_CYCLE_STEP")) { - define("_MISSING_A_CYCLE_AND_A_CYCLE_STEP", "Vous devez ajouter au moins un cycle de vie et une étape pour compléter votre paramétrage"); -} - /*************BATCH*************************************/ if (!defined("_PI_COMMENT_ROOT")) { define("_PI_COMMENT_ROOT", "Packaging information: Utilisation du paquet d archivage (Archival Information package)"); @@ -221,9 +36,3 @@ if (!defined("_PDI_COMMENT_HISTORY")) { if (!defined("_DOCS")) { define("_DOCS", "Brieven"); } -if (!defined("_LINK_EXISTS")) { - define("_LINK_EXISTS", "Un lien avec un autre objet existe"); -} -if (!defined("_VIEW_GENERAL_PARAMETERS_OF_THE_POLICY")) { - define("_VIEW_GENERAL_PARAMETERS_OF_THE_POLICY", "Voir le paramétrage global de la politique de cycle de vie"); -} diff --git a/modules/life_cycle/lc_cycle_steps_list_by_id.php b/modules/life_cycle/lc_cycle_steps_list_by_id.php deleted file mode 100755 index 59ad3b0d740f55216f2f6a70a1b353fea77810a7..0000000000000000000000000000000000000000 --- a/modules/life_cycle/lc_cycle_steps_list_by_id.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -/* -* Copyright 2008-2011 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** -* @brief List of steps for autocompletion -* -* -* @file -* @author Laurent Giovannoni <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup life_cycle -*/ - -require_once ("modules/life_cycle/life_cycle_tables_definition.php"); -require_once('core/admin_tools.php'); -$db = new Database(); -$stmt = $db->query("select cycle_step_id as tag from " - . _LC_CYCLE_STEPS_TABLE_NAME . " where lower(cycle_step_id) like lower(?) order by cycle_step_id", - array($_REQUEST['what'] . "%")); -At_showAjaxList($stmt, $_REQUEST['what']); diff --git a/modules/life_cycle/lc_cycle_steps_management.php b/modules/life_cycle/lc_cycle_steps_management.php deleted file mode 100755 index 4685773cac881f5b6a6de273ca93a9bc902ec187..0000000000000000000000000000000000000000 --- a/modules/life_cycle/lc_cycle_steps_management.php +++ /dev/null @@ -1,229 +0,0 @@ -<?php - -/* View */ -$func = new functions(); -if ($mode == 'list') { - $listshow = new list_show(); - $listshow->admin_list( - $lc_cycle_steps_list['tab'], - count($lc_cycle_steps_list['tab']), - $lc_cycle_steps_list['title'], - 'cycle_step_id', - 'lc_cycle_steps_management_controler&mode=list', - 'life_cycle', 'cycle_step_id', - true, - $lc_cycle_steps_list['page_name_up'], - '', - '', - $lc_cycle_steps_list['page_name_del'], - $lc_cycle_steps_list['page_name_add'], - $lc_cycle_steps_list['label_add'], - false, - false, - _ALL_LC_CYCLE_STEPS, - _LC_CYCLE_STEP, - 'recycle', - true, - true, - false, - true, - $lc_cycle_steps_list['what'], - true, - $lc_cycle_steps_list['autoCompletionArray'] - ); -} elseif ($mode == 'up' || $mode == 'add') { - ?> - <h1><i class="fa fa-cogs fa-2x"></i> - <?php - if ($mode == 'add') { - echo _LC_CYCLE_STEP_ADDITION; - } elseif ($mode == 'up') { - echo _LC_CYCLE_STEP_MODIFICATION; - } ?> - </h1> - <div id="inner_content" class="clearfix" align="center"> - <br><br> - <?php - if ($state == false) { - echo '<br /><br />'._THE_LC_CYCLE_STEP.' '._UNKOWN - .'<br /><br /><br /><br />'; - } else { - ?> - <div class="block"> - <form name="formdocserver" method="post" style="width:580px;" class="forms" - action="<?php echo $_SESSION['config']['businessappurl'] - .'index.php?display=true&page=' - .'lc_cycle_steps_management_controler&module=life_cycle&mode=' - .$mode; ?>"> - <input type="hidden" name="display" value="true" /> - <input type="hidden" name="module" value="life_cycle" /> - <input type="hidden" name="page" value=" - lc_cycle_steps_management_controler" /> - <input type="hidden" name="mode" id="mode" - value="<?php functions::xecho($mode); ?>" /> - <input type="hidden" name="order" id="order" - value="<?php if (isset($_REQUEST['order'])) { - functions::xecho($_REQUEST['order']); - } ?>" /> - <input type="hidden" name="order_field" - id="order_field" - value="<?php if (isset($_REQUEST['order_field'])) { - functions::xecho($_REQUEST['order_field']); - } ?>" /> - <input type="hidden" name="what" id="what" value="<?php if (isset($_REQUEST['what'])) { - functions::xecho($_REQUEST['what']); - } ?>" /> - <input type="hidden" name="start" id="start" value="<?php if (isset($_REQUEST['start'])) { - functions::xecho($_REQUEST['start']); - } ?>" /> - <?php - if ($mode == 'up') { - echo '<p><a href="'.$_SESSION['config']['businessappurl'] - .'?page=lc_policies_management_controler&mode=up&' - .'module=life_cycle&id='.$_SESSION['m_admin']['lc_cycle_steps']['policy_id'] - .'"><i class="fa fa-cogs fa-2x" title="'._VIEW_GENERAL_PARAMETERS_OF_THE_POLICY.' ' - ._LC_CYCLE_STEP.'"></i> '._VIEW_GENERAL_PARAMETERS_OF_THE_POLICY.'</a></p>'; ?> - <p> - <label for="policy_id"><?php echo _POLICY_ID; ?> : - </label> - <input name="policy_id" type="text" id="policy_id" - value="<?php if (isset($_SESSION['m_admin']['lc_cycle_steps']['policy_id'])) { - functions::xecho($func->show_str($_SESSION['m_admin']['lc_cycle_steps']['policy_id'])); - } ?>" readonly='readonly' class='readonly'/> - </p> - <?php - } else { - ?> - <p> - <label for="policy_id"><?php echo _POLICY_ID; ?> : - </label> - <select name="policy_id" id="policy_id" - onchange="changeCycle('<?php echo $_SESSION['config']['businessappurl']; ?>index.php?display=true&module=life_cycle&page=change_cycle_list');"> - <option value=""><?php echo _POLICY_ID; ?></option> - <?php - for ($cptPolicies = 0; $cptPolicies < count($policiesArray); ++$cptPolicies) { - ?> - <option value="<?php functions::xecho($policiesArray[$cptPolicies]); ?>" - <?php - if (isset($_SESSION['m_admin']['lc_cycle_steps']['policy_id']) - && $_SESSION['m_admin']['lc_cycle_steps']['policy_id'] == $policiesArray[$cptPolicies] - ) { - echo 'selected="selected"'; - } ?>><?php functions::xecho($policiesArray[$cptPolicies]); ?></option> - <?php - } ?> - </select> - </p> - <?php - } ?> - <?php - if (!empty($_SESSION['m_admin']['lc_cycle_steps']['policy_id']) && $mode == 'up' - ) { - ?> - <p> - <label for="cycle_id"><?php echo _CYCLE_ID; ?> : </label> - <input name="cycle_id" type="text" id="cycle_id" value="<?php if (isset($_SESSION['m_admin']['lc_cycle_steps']['cycle_id'])) { - functions::xecho($func->show_str($_SESSION['m_admin']['lc_cycle_steps']['cycle_id'])); - } ?>" readonly='readonly' class='readonly'/> - </p> - <?php - } else { - ?> - <div name="cycle_div" id="cycle_div"></div> - <?php - } ?> - <p> - <label for="id"><?php echo _CYCLE_STEP_ID; ?> : </label> - <input name="id" type="text" id="id" value="<?php if (isset($_SESSION['m_admin']['lc_cycle_steps']['cycle_step_id'])) { - functions::xecho($func->show_str($_SESSION['m_admin']['lc_cycle_steps']['cycle_step_id'])); - } ?>" <?php if ($mode == 'up') { - echo " readonly='readonly' class='readonly'"; - } ?>/> - </p> - <p> - <label for="cycle_step_desc"><?php echo _CYCLE_STEP_DESC; ?> : </label> - <textarea name="cycle_step_desc" type="text" id="cycle_step_desc" value="<?php if (isset($_SESSION['m_admin']['lc_cycle_steps']['cycle_step_desc'])) { - functions::xecho($func->show_str($_SESSION['m_admin']['lc_cycle_steps']['cycle_step_desc'])); - } ?>" ><?php if (isset($_SESSION['m_admin']['lc_cycle_steps']['cycle_step_desc'])) { - echo $_SESSION['m_admin']['lc_cycle_steps']['cycle_step_desc']; - } ?></textarea> - </p> - <p> - <label for="docserver_type_id"><?php echo _DOCSERVER_TYPE_ID; ?> : </label> - <select name="docserver_type_id" id="docserver_type_id"> - <option value=""><?php echo _DOCSERVER_TYPE_ID; ?></option> - <?php - for ($cptDocserverTypes = 0; $cptDocserverTypes < count($docserverTypesArray); ++$cptDocserverTypes) { - ?> - <option value="<?php functions::xecho($docserverTypesArray[$cptDocserverTypes]); ?>" <?php if (isset($_SESSION['m_admin']['lc_cycle_steps']['docserver_type_id']) && $_SESSION['m_admin']['lc_cycle_steps']['docserver_type_id'] == $docserverTypesArray[$cptDocserverTypes]) { - echo 'selected="selected"'; - } ?>><?php functions::xecho($docserverTypesArray[$cptDocserverTypes]); ?></option> - <?php - } ?> - </select> - </p> - <!--<p> - <label><?php echo _IS_ALLOW_FAILURE; ?> : </label> - <input type="radio" class="check" name="is_allow_failure" value="true" <?php if (isset($_SESSION['m_admin']['docservers']['is_allow_failure']) && $_SESSION['m_admin']['docservers']['is_allow_failure']) { - ?> checked="checked"<?php - } ?> /><?php echo _YES; ?> - <input type="radio" class="check" name="is_allow_failure" value="false" <?php if (isset($_SESSION['m_admin']['docservers']['is_allow_failure']) && (!$_SESSION['m_admin']['docservers']['is_allow_failure'] || $_SESSION['m_admin']['docservers']['is_allow_failure'] == '')) { - ?> checked="checked"<?php - } elseif (!isset($_SESSION['m_admin']['docservers']['is_allow_failure'])) { - ?> checked="checked"<?php - } ?> /><?php echo _NO; ?> - </p>--> - <p> - <label for="step_operation"><?php echo _STEP_OPERATION; ?> : </label> - <select name="step_operation" id="step_operation"> - <?php - for ($cptStepOperation = 0; $cptStepOperation < count($_SESSION['lifeCycleFeatures']['LIFE_CYCLE']['PROCESS']['MODE']); ++$cptStepOperation) { - ?> - <option value="<?php if (isset($_SESSION['lifeCycleFeatures']['LIFE_CYCLE']['PROCESS']['MODE'][$cptStepOperation])) { - functions::xecho($_SESSION['lifeCycleFeatures']['LIFE_CYCLE']['PROCESS']['MODE'][$cptStepOperation]); - } ?>" <?php if (isset($_SESSION['m_admin']['lc_cycle_steps']['step_operation']) && $_SESSION['m_admin']['lc_cycle_steps']['step_operation'] == $_SESSION['lifeCycleFeatures']['LIFE_CYCLE']['PROCESS']['MODE'][$cptStepOperation]) { - echo 'selected="selected"'; - } ?>><?php if (isset($_SESSION['lifeCycleFeatures']['LIFE_CYCLE']['PROCESS']['MODE'][$cptStepOperation])) { - echo $_SESSION['lifeCycleFeatures']['LIFE_CYCLE']['PROCESS']['MODE'][$cptStepOperation]; - } ?></option> - <?php - } ?> - </select> - </p> - <p> - <label for="sequence_number"><?php echo _SEQUENCE_NUMBER; ?> : </label> - <input name="sequence_number" type="text" id="sequence_number" value="<?php if (isset($_SESSION['m_admin']['lc_cycle_steps']['sequence_number'])) { - functions::xecho($func->show_str($_SESSION['m_admin']['lc_cycle_steps']['sequence_number'])); - } ?>" /> - </p> - <p class="buttons"> - <?php - if ($mode == 'up') { - ?> - <input class="button" type="submit" name="submit" value="<?php echo _MODIFY; ?>" /> - <?php - } elseif ($mode == 'add') { - ?> - <input type="submit" class="button" name="submit" value="<?php echo _ADD; ?>" /> - <?php - } ?> - <input type="button" class="button" name="cancel" value="<?php echo _CANCEL; ?>" onclick="javascript:window.location.href='<?php echo $_SESSION['config']['businessappurl']; ?>index.php?page=lc_cycle_steps_management_controler&module=life_cycle&mode=list';"/> - </p> - </form> - </div> - <?php - ?> - <script type="text/javascript"> - //on load show cycle if necessary - <?php - if (isset($_SESSION['m_admin']['lc_cycle_steps']['cycle_id']) && $_SESSION['m_admin']['lc_cycle_steps']['cycle_id'] != '') { - ?> - changeCycle('<?php echo $_SESSION['config']['businessappurl']; ?>index.php?display=true&module=life_cycle&page=change_cycle_list'); - <?php - } ?> - </script> - <?php - } ?> - </div> - <?php -} diff --git a/modules/life_cycle/lc_cycle_steps_management_controler.php b/modules/life_cycle/lc_cycle_steps_management_controler.php deleted file mode 100755 index 730531987db4dcc2403fb6d68da05d2f0cba5c55..0000000000000000000000000000000000000000 --- a/modules/life_cycle/lc_cycle_steps_management_controler.php +++ /dev/null @@ -1,415 +0,0 @@ -<?php - -/* -* Copyright 2008-2011 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** -* @brief Contains the life_cycle Object (herits of the BaseObject class) -* -* -* @file -* @author Laurent Giovannoni -* @author Sébastien Nana -* @date $date$ -* @version $Revision$ -* @ingroup life_cycle -*/ - -$sessionName = "lc_cycle_steps"; -$pageName = "lc_cycle_steps_management_controler"; -$tableName = "lc_cycle_steps"; -$idName = "cycle_step_id"; - -$mode = 'add'; - -$core = new core_tools(); -$core->load_lang(); - -$core->test_admin('admin_life_cycle', 'life_cycle'); - -if (isset($_REQUEST['mode']) && !empty($_REQUEST['mode'])) { - $mode = $_REQUEST['mode']; -} else { - $mode = 'list'; -} - -try { - require_once("modules/life_cycle/class/lc_cycle_steps_controler.php"); - require_once("modules/life_cycle/class/lc_policies_controler.php"); - require_once('core/admin_tools.php'); - require_once("core/class/class_request.php"); - require_once("core/class/docserver_types_controler.php"); - if ($mode == 'list') { - require_once("modules/life_cycle/lang/fr.php"); - require_once("apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'] - .DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR - ."class_list_show.php"); - } -} catch (Exception $e) { - functions::xecho($e->getMessage()); -} - -$lcPoliciesControler = new lc_policies_controler(); -$lcCycleStepsControler = new lc_cycle_steps_controler(); -$docserverTypesControler = new docserver_types_controler(); -if ($mode == "up" || $mode == "add") { - $policiesArray = array(); - $stepsArray = array(); - $docserverTypesArray = array(); - $policiesArray = $lcPoliciesControler->getAllId(); - if (isset($_SESSION['m_admin']['lc_cycle_steps']['policy_id'])) { - $stepsArray = $lcCycleStepsControler->getAllId( - $_SESSION['m_admin']['lc_cycle_steps']['policy_id'] - ); - } - $docserverTypesArray = $docserverTypesControler->getAllId(); -} - -if (isset($_REQUEST['submit'])) { - // Action to do with db - validate_cs_submit($mode); -} else { - // Display to do - if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) { - $cycleStepId = $_REQUEST['id']; - } - $state = true; - switch ($mode) { - case "up" : - $state = display_up($cycleStepId); - location_bar_management($mode); - break; - case "add" : - display_add(); - location_bar_management($mode); - break; - case "del" : - display_del($cycleStepId); - break; - case "list" : - $lc_cycle_steps_list = display_list(); - location_bar_management($mode); - break; - case "allow" : - display_enable($cycleStepId); - location_bar_management($mode); - case "ban" : - display_disable($cycleStepId); - location_bar_management($mode); - } - include('lc_cycle_steps_management.php'); -} - -/** - * Initialize session variables - */ -function init_session() -{ - $sessionName = "lc_cycle_steps"; - $_SESSION['m_admin'][$sessionName] = array(); -} - -/** - * Management of the location bar - */ -function location_bar_management($mode) -{ - //$sessionName = "lc_cycle_steps"; - $pageName = "lc_cycle_steps_management_controler"; - //$tableName = "lc_cycle_steps"; - //$idName = "cycle_step_id"; - - $pageLabels = array( - 'add' => _ADDITION, - 'up' => _MODIFICATION, - 'list' => _LC_CYCLE_STEPS_LIST, - ); - $pageIds = array( - 'add' => 'docserver_add', - 'up' => 'docserver_up', - 'list' => 'lc_cycle_steps_list', - ); - - $init = false; - if (isset($_REQUEST['reinit']) && $_REQUEST['reinit'] == "true") { - $init = true; - } - $level = ""; - if (isset($_REQUEST['level']) - && ($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 - || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1 - ) - ) { - $level = $_REQUEST['level']; - } - $pagePath = $_SESSION['config']['businessappurl'].'index.php?page=' - .$pageName.'&module=life_cycle&mode='.$mode; - $pageLabel = $pageLabels[$mode]; - $pageId = $pageIds[$mode]; - $ct = new core_tools(); - $ct->manage_location_bar($pagePath, $pageLabel, $pageId, $init, $level); -} - -/** - * Validate a submit (add or up), - * up to saving object - */ -function validate_cs_submit($mode) -{ - //$sessionName = "lc_cycle_steps"; - $pageName = "lc_cycle_steps_management_controler"; - //$tableName = "lc_cycle_steps"; - //$idName = "cycle_step_id"; - //$f=new functions(); - $lcCycleStepsControler = new lc_cycle_steps_controler(); - $status = array(); - $status['order'] = $_REQUEST['order']; - $status['order_field'] = $_REQUEST['order_field']; - $status['what'] = $_REQUEST['what']; - $status['start'] = $_REQUEST['start']; - $lc_cycle_steps = new lc_cycle_steps(); - if (isset($_REQUEST['id'])) { - $lc_cycle_steps->cycle_step_id = $_REQUEST['id']; - } - if (isset($_REQUEST['policy_id'])) { - $lc_cycle_steps->policy_id = $_REQUEST['policy_id']; - } - if (isset($_REQUEST['cycle_id'])) { - $lc_cycle_steps->cycle_id = $_REQUEST['cycle_id']; - } - if (isset($_REQUEST['docserver_type_id'])) { - $lc_cycle_steps->docserver_type_id = $_REQUEST['docserver_type_id']; - } - if (isset($_REQUEST['cycle_step_desc'])) { - $lc_cycle_steps->cycle_step_desc = $_REQUEST['cycle_step_desc']; - } - if (isset($_REQUEST['sequence_number'])) { - $lc_cycle_steps->sequence_number = $_REQUEST['sequence_number']; - } - //if (isset($_REQUEST['is_allow_failure'])) { - //$lc_cycle_steps->is_allow_failure = $_REQUEST['is_allow_failure']; - //} - //if (isset($_REQUEST['is_must_complete'])) { - //$lc_cycle_steps->is_must_complete = $_REQUEST['is_must_complete']; - //} - if (isset($_REQUEST['step_operation'])) { - $lc_cycle_steps->step_operation = $_REQUEST['step_operation']; - } - $control = array(); - $control = $lcCycleStepsControler->save($lc_cycle_steps, $mode); - if (!empty($control['error']) && $control['error'] <> 1) { - // Error management depending of mode - $_SESSION['error'] = str_replace("#", "<br />", $control['error']); - At_putInSession("status", $status); - At_putInSession("lc_cycle_steps", $lc_cycle_steps->getArray()); - switch ($mode) { - case "up": - if (!empty($_REQUEST['id'])) { - header("location: ".$_SESSION['config']['businessappurl'] - ."index.php?page=".$pageName."&mode=up&id=" - .$_REQUEST['id'] - ."&module=life_cycle"); - } else { - header("location: ".$_SESSION['config']['businessappurl'] - ."index.php?page=".$pageName - ."&mode=list&module=life_cycle&order=" - .$status['order']."&order_field=" - .$status['order_field']."&start=".$status['start'] - ."&what=".$status['what']); - } - exit; - case "add": - header("location: ".$_SESSION['config']['businessappurl'] - ."index.php?page=".$pageName - ."&mode=add&module=life_cycle"); - exit; - } - } else { - if ($mode == "add") { - $_SESSION['info'] = _LC_CYCLE_STEP_ADDED; - } else { - $_SESSION['info'] = _LC_CYCLE_STEP_UPDATED; - } - unset($_SESSION['m_admin']); - header("location: ".$_SESSION['config']['businessappurl'] - ."index.php?page=".$pageName - ."&mode=list&module=life_cycle&order=" - .$status['order']."&order_field=".$status['order_field'] - ."&start=".$status['start']."&what=".$status['what']); - } -} - -/** - * Initialize session parameters for update display - * @param Long $cycleStepId - */ -function display_up($cycleStepId) -{ - $state = true; - $lcCycleStepsControler = new lc_cycle_steps_controler(); - $lc_cycle_steps = $lcCycleStepsControler->get($cycleStepId); - if (empty($lc_cycle_steps)) { - $state = false; - } else { - At_putInSession("lc_cycle_steps", $lc_cycle_steps->getArray()); - } - return $state; -} - -/** - * Initialize session parameters for add display with given docserver - */ -function display_add() -{ - $sessionName = "lc_cycle_steps"; - if (!isset($_SESSION['m_admin'][$sessionName])) { - init_session(); - } -} - -/** - * Initialize session parameters for list display - */ -function display_list() -{ - //$sessionName = "lc_cycle_steps"; - $pageName = "lc_cycle_steps_management_controler"; - //$tableName = "lc_cycle_steps"; - $idName = "cycle_step_id"; - $func = new functions(); - $_SESSION['m_admin'] = array(); - init_session(); - $select[_LC_CYCLE_STEPS_TABLE_NAME] = array(); - array_push( - $select[_LC_CYCLE_STEPS_TABLE_NAME], - $idName, - "cycle_id", - "cycle_step_desc", - "policy_id" , - "sequence_number" - ); - $what = ""; - $where = ""; - $arrayPDO = array(); - if (isset($_REQUEST['what']) && !empty($_REQUEST['what'])) { - $what = $_REQUEST['what']; - $where = "lower(".$idName.") like lower(?) "; - $arrayPDO = array_merge($arrayPDO, array($what.'%')); - } - - // Checking order and order_field values - $order = 'asc'; - if (isset($_REQUEST['order']) && !empty($_REQUEST['order'])) { - $order = trim($_REQUEST['order']); - } - $field = $idName; - if (isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) { - $field = trim($_REQUEST['order_field']); - } - $listShow = new list_show(); - $orderstr = $listShow->define_order($order, $field); - $request = new request(); - $tab = $request->PDOselect( - $select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'] - ); - //$request->show(); - if (!empty($tab)) { - for ($i = 0;$i < count($tab);$i++) { - foreach ($tab[$i] as &$item) { - switch ($item['column']) { - case $idName: - At_formatItem( - $item, _ID, "15", "left", "left", "bottom", true - ); - break; - case "cycle_step_desc": - At_formatItem( - $item, _CYCLE_STEP_DESC, "40", "left", "left", - "bottom", true - ); - break; - case "cycle_id": - At_formatItem( - $item, _CYCLE_ID, "15", "left", "left", "bottom", true - ); - break; - case "policy_id": - At_formatItem( - $item, _POLICY_ID, "15", "left", "left", "bottom", true - ); - break; - case "sequence_number": - At_formatItem( - $item, _SEQUENCE_NUMBER, "15", "left", "left", - "bottom", true - ); - break; - } - } - } - } - $result = array(); - $result['tab'] = $tab; - $result['what'] = $what; - $result['page_name'] = $pageName."&mode=list"; - $result['page_name_up'] = $pageName."&mode=up"; - $result['page_name_del'] = $pageName."&mode=del"; - //$result['page_name_val']= $pageName."&mode=allow"; - //$result['page_name_ban'] = $pageName."&mode=ban"; - $result['page_name_add'] = $pageName."&mode=add"; - $result['label_add'] = _LC_CYCLE_STEP_ADDITION; - $_SESSION['m_admin']['init'] = true; - $result['title'] = _LC_CYCLE_STEPS_LIST." : ".count($tab)." " - ._LC_CYCLE_STEPS; - $result['autoCompletionArray'] = array(); - $result['autoCompletionArray']["list_script_url"] = - $_SESSION['config']['businessappurl'] - ."index.php?display=false&module=life_cycle&page=lc_cycle_steps_list_by_id"; - $result['autoCompletionArray']["number_to_begin"] = 1; - return $result; -} - -/** - * Delete given docserver if exists and initialize session parameters - * @param unknown_type $cycleStepId - */ -function display_del($cycleStepId) -{ - $lcCycleStepsControler = new lc_cycle_steps_controler(); - $lc_cycle_steps = $lcCycleStepsControler->get($cycleStepId); - if (isset($lc_cycle_steps)) { - // Deletion - $control = array(); - $control = $lcCycleStepsControler->delete($lc_cycle_steps); - if (!empty($control['error']) && $control['error'] <> 1) { - $_SESSION['error'] = str_replace("#", "<br />", $control['error']); - } else { - $_SESSION['info'] = _LC_CYCLE_STEP_DELETED." ".$cycleStepId; - } - $pageName = "lc_cycle_steps_management_controler"; - ?><script>window.top.location='<?php echo $_SESSION['config']['businessappurl'] - ."index.php?page=".$pageName."&mode=list&module=life_cycle";?>';</script> - <?php - exit; - } else { - // Error management - $_SESSION['error'] = _LC_CYCLE_STEP.' '._UNKNOWN; - } -} - diff --git a/modules/life_cycle/lc_cycles_list_by_id.php b/modules/life_cycle/lc_cycles_list_by_id.php deleted file mode 100755 index b3490d48a488ea4965ed343c8181b4a0ac455049..0000000000000000000000000000000000000000 --- a/modules/life_cycle/lc_cycles_list_by_id.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -/* -* Copyright 2008-2011 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** -* @brief List of policies for autocompletion -* -* -* @file -* @author Laurent Giovannoni <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup life_cycle -*/ - -require_once ('modules/life_cycle/life_cycle_tables_definition.php'); -require_once('core/admin_tools.php'); -$db = new Database(); -$stmt = $db->query("select cycle_id as tag from " . _LC_CYCLES_TABLE_NAME - . " where lower(cycle_id) like lower(?) order by cycle_id", array($_REQUEST['what'] . "%")); -At_showAjaxList($stmt, $_REQUEST['what']); diff --git a/modules/life_cycle/lc_cycles_management.php b/modules/life_cycle/lc_cycles_management.php deleted file mode 100755 index c3e2131a1cd1f88e93e1903c08bca074878dcdb0..0000000000000000000000000000000000000000 --- a/modules/life_cycle/lc_cycles_management.php +++ /dev/null @@ -1,159 +0,0 @@ -<?php -/* View */ -$func = new functions(); -if ($mode == 'list') { - $listshow = new list_show(); - $listshow->admin_list( - $lc_cycles_list['tab'], - count($lc_cycles_list['tab']), - $lc_cycles_list['title'], - 'cycle_id', - 'lc_cycles_management_controler&mode=list', - 'life_cycle', 'cycle_id', - true, - $lc_cycles_list['page_name_up'], - '', - '', - $lc_cycles_list['page_name_del'], - $lc_cycles_list['page_name_add'], - $lc_cycles_list['label_add'], - false, - false, - _ALL_LC_CYCLES, - _LC_CYCLE, - 'recycle', - true, - true, - false, - true, - $lc_cycles_list['what'], - true, - $lc_cycles_list['autoCompletionArray'] - ); -} elseif ($mode == 'up' || $mode == 'add') { - ?> - <h1><i class="fa fa-recycle fa-2x"></i> - <?php - if ($mode == 'add') { - echo _LC_CYCLE_ADDITION; - } elseif ($mode == 'up') { - echo _LC_CYCLE_MODIFICATION; - } ?> - </h1> - <div id="inner_content" class="clearfix" align="center"> - <br><br> - <?php - if ($state == false) { - echo '<br /><br />'._THE_LC_CYCLE.' '._UNKOWN.'<br /><br /><br /><br />'; - } else { - ?> - <div class="block"> - <form name="formdocserver" method="post" class="forms" style="width:400px;" action="<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&page=lc_cycles_management_controler&module=life_cycle&mode='.$mode; ?>"> - <input type="hidden" name="display" value="true" /> - <input type="hidden" name="module" value="life_cycle" /> - <input type="hidden" name="page" value="lc_cycles_management_controler" /> - <input type="hidden" name="mode" id="mode" value="<?php functions::xecho($mode); ?>" /> - <input type="hidden" name="order" id="order" value="<?php if (isset($_REQUEST['order'])) { - functions::xecho($_REQUEST['order']); - } ?>" /> - <input type="hidden" name="order_field" id="order_field" value="<?php if (isset($_REQUEST['order_field'])) { - functions::xecho($_REQUEST['order_field']); - } ?>" /> - <input type="hidden" name="what" id="what" value="<?php if (isset($_REQUEST['what'])) { - functions::xecho($_REQUEST['what']); - } ?>" /> - <input type="hidden" name="start" id="start" value="<?php if (isset($_REQUEST['start'])) { - functions::xecho($_REQUEST['start']); - } ?>" /> - <?php - if ($mode == 'up') { - echo '<p><a href="'.$_SESSION['config']['businessappurl'] - .'?page=lc_policies_management_controler&mode=up&' - .'module=life_cycle&id='.$_SESSION['m_admin']['lc_cycles']['policy_id'] - .'"><i class="fa fa-cogs fa-2x" title="'._VIEW_GENERAL_PARAMETERS_OF_THE_POLICY.' ' - ._LC_CYCLE_STEP.'"></i> '._VIEW_GENERAL_PARAMETERS_OF_THE_POLICY.'</a></p>'; ?> - <p> - <label for="policy_id"><?php echo _POLICY_ID; ?> : </label> - <input name="policy_id" type="text" id="policy_id" value="<?php if (isset($_SESSION['m_admin']['lc_cycles']['policy_id'])) { - functions::xecho($func->show_str($_SESSION['m_admin']['lc_cycles']['policy_id'])); - } ?>" readonly='readonly' class='readonly'/> - </p> - <?php - } else { - ?> - <p> - <label for="policy_id"><?php echo _POLICY_ID; ?> : </label> - <select name="policy_id" id="policy_id"> - <option value=""><?php echo _POLICY_ID; ?></option> - <?php - for ($cptPolicies = 0; $cptPolicies < count($policiesArray); ++$cptPolicies) { - ?> - <option value="<?php functions::xecho($policiesArray[$cptPolicies]); ?>" <?php if (isset($_SESSION['m_admin']['lc_cycles']['policy_id']) && $_SESSION['m_admin']['lc_cycles']['policy_id'] == $policiesArray[$cptPolicies]) { - echo 'selected="selected"'; - } ?>><?php if (isset($policiesArray[$cptPolicies])) { - functions::xecho($policiesArray[$cptPolicies]); - } ?></option> - <?php - } ?> - </select> - </p> - <?php - } ?> - <p> - <label for="id"><?php echo _CYCLE_ID; ?> : </label> - <input name="id" type="text" id="id" value="<?php if (isset($_SESSION['m_admin']['lc_cycles']['cycle_id'])) { - functions::xecho($func->show_str($_SESSION['m_admin']['lc_cycles']['cycle_id'])); - } ?>" <?php if ($mode == 'up') { - echo " readonly='readonly' class='readonly'"; - } ?>/> - </p> - <p> - <label for="cycle_desc"><?php echo _CYCLE_DESC; ?> : </label> - <textarea name="cycle_desc" type="text" id="cycle_desc" value="<?php if (isset($_SESSION['m_admin']['lc_cycles']['cycle_desc'])) { - functions::xecho($func->show_str($_SESSION['m_admin']['lc_cycles']['cycle_desc'])); - } ?>" /><?php if (isset($_SESSION['m_admin']['lc_cycles']['cycle_desc'])) { - echo $_SESSION['m_admin']['lc_cycles']['cycle_desc']; - } ?></textarea> - </p> - <p> - <label for="sequence_number"><?php echo _SEQUENCE_NUMBER; ?> : </label> - <input name="sequence_number" type="text" id="sequence_number" value="<?php if (isset($_SESSION['m_admin']['lc_cycles']['sequence_number'])) { - functions::xecho($func->show_str($_SESSION['m_admin']['lc_cycles']['sequence_number'])); - } ?>" /> - </p> - <p> - <label for="where_clause"><?php echo _WHERE_CLAUSE; ?> : </label> - <textarea name="where_clause" type="text" id="where_clause" value="<?php if (isset($_SESSION['m_admin']['lc_cycles']['where_clause'])) { - functions::xecho($func->show_str($_SESSION['m_admin']['lc_cycles']['where_clause'])); - } ?>" /><?php if (isset($_SESSION['m_admin']['lc_cycles']['where_clause'])) { - echo $_SESSION['m_admin']['lc_cycles']['where_clause']; - } ?></textarea> - </p> - <p> - <label for="break_key"><?php echo _BREAK_KEY; ?> : </label> - <input name="break_key" type="text" id="break_key" value="<?php if (isset($_SESSION['m_admin']['lc_cycles']['break_key'])) { - functions::xecho($func->show_str($_SESSION['m_admin']['lc_cycles']['break_key'])); - } ?>" /> - </p> - <input type="hidden" name="validation_mode" value="AUTO" /> - <p class="buttons"> - <?php - if ($mode == 'up') { - ?> - <input class="button" type="submit" name="submit" value="<?php echo _MODIFY; ?>" /> - <?php - } elseif ($mode == 'add') { - ?> - <input type="submit" class="button" name="submit" value="<?php echo _ADD; ?>" /> - <?php - } ?> - <input type="button" class="button" name="cancel" value="<?php echo _CANCEL; ?>" onclick="javascript:window.location.href='<?php echo $_SESSION['config']['businessappurl']; ?>index.php?page=lc_cycles_management_controler&module=life_cycle&mode=list';"/> - </p> - </form> - </div> - <?php - } ?> - </div> - <?php -} -?> diff --git a/modules/life_cycle/lc_cycles_management_controler.php b/modules/life_cycle/lc_cycles_management_controler.php deleted file mode 100755 index a19691c681ff2329ffc1cfd4ce7160982541a856..0000000000000000000000000000000000000000 --- a/modules/life_cycle/lc_cycles_management_controler.php +++ /dev/null @@ -1,314 +0,0 @@ -<?php - -/* -* Copyright 2008-2011 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** -* @brief Contains the life_cycle Object (herits of the BaseObject class) -* -* -* @file -* @author Luc KEULEYAN - BULL -* @author Laurent Giovannoni -* @date $date$ -* @version $Revision$ -* @ingroup life_cycle -*/ - -$sessionName = "lc_cycles"; -$pageName = "lc_cycles_management_controler"; -$tableName = "lc_cycles"; -$idName = "cycle_id"; - -$mode = 'add'; - -$core = new core_tools(); -$core->load_lang(); - -$core->test_admin('admin_life_cycle', 'life_cycle'); - -if (isset($_REQUEST['mode']) && !empty($_REQUEST['mode'])) { - $mode = $_REQUEST['mode']; -} else { - $mode = 'list'; -} - -try { - require_once("modules/life_cycle/class/lc_cycles_controler.php"); - require_once("modules/life_cycle/class/lc_policies_controler.php"); - require_once('core/admin_tools.php'); - require_once("core/class/class_request.php"); - if ($mode == 'list') { - require_once("modules/life_cycle/lang/fr.php"); - require_once("apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_list_show.php"); - } -} catch (Exception $e) { - functions::xecho($e->getMessage()); -} -$lcPoliciesControler = new lc_policies_controler(); -if ($mode == "up" || $mode =="add") { - $policiesArray = array(); - $policiesArray = $lcPoliciesControler->getAllId(); -} - -if (isset($_REQUEST['submit'])) { - // Action to do with db - validate_cs_submit($mode); -} else { - // Display to do - if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) - $cycle_id = $_REQUEST['id']; - $state = true; - switch ($mode) { - case "up" : - $state=display_up($cycle_id); - location_bar_management($mode); - break; - case "add" : - display_add(); - location_bar_management($mode); - break; - case "del" : - display_del($cycle_id); - break; - case "list" : - $lc_cycles_list=display_list(); - location_bar_management($mode); - break; - case "allow" : - display_enable($cycle_id); - location_bar_management($mode); - case "ban" : - display_disable($cycle_id); - location_bar_management($mode); - } - include('lc_cycles_management.php'); -} - -/** - * Initialize session variables - */ -function init_session() { - $sessionName = "lc_cycles"; - $_SESSION['m_admin'][$sessionName] = array(); -} - -/** - * Management of the location bar - */ -function location_bar_management($mode) { - //$sessionName = "lc_cycles"; - $pageName = "lc_cycles_management_controler"; - //$tableName = "lc_cycles"; - //$idName = "cycle_id"; - - $page_labels = array('add' => _ADDITION, 'up' => _MODIFICATION, 'list' => _LC_CYCLES_LIST); - $page_ids = array('add' => 'docserver_add', 'up' => 'docserver_up', 'list' => 'lc_cycles_list'); - - $init = false; - if (isset($_REQUEST['reinit']) && $_REQUEST['reinit'] == "true") - $init = true; - - $level = ""; - if (isset($_REQUEST['level']) && ($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1)) - $level = $_REQUEST['level']; - - $page_path = $_SESSION['config']['businessappurl'].'index.php?page='.$pageName.'&module=life_cycle&mode='.$mode; - $page_label = $page_labels[$mode]; - $page_id = $page_ids[$mode]; - $ct=new core_tools(); - $ct->manage_location_bar($page_path, $page_label, $page_id, $init, $level); -} - -/** - * Validate a submit (add or up), - * up to saving object - */ -function validate_cs_submit($mode) { - //$sessionName = "lc_cycles"; - $pageName = "lc_cycles_management_controler"; - //$tableName = "lc_cycles"; - //$idName = "cycle_id"; - //$f=new functions(); - $lcCyclesControler = new lc_cycles_controler(); - $status= array(); - $status['order']=$_REQUEST['order']; - $status['order_field']=$_REQUEST['order_field']; - $status['what']=$_REQUEST['what']; - $status['start']=$_REQUEST['start']; - $lc_cycles = new lc_cycles(); - if (isset($_REQUEST['id'])) $lc_cycles->cycle_id = $_REQUEST['id']; - if (isset($_REQUEST['policy_id'])) $lc_cycles->policy_id = $_REQUEST['policy_id']; - if (isset($_REQUEST['cycle_desc'])) $lc_cycles->cycle_desc = $_REQUEST['cycle_desc']; - if (isset($_REQUEST['sequence_number'])) $lc_cycles->sequence_number = $_REQUEST['sequence_number']; - if (isset($_REQUEST['break_key'])) $lc_cycles->break_key = $_REQUEST['break_key']; - if (isset($_REQUEST['where_clause'])) $lc_cycles->where_clause = $_REQUEST['where_clause']; - if (isset($_REQUEST['validation_mode'])) $lc_cycles->validation_mode = $_REQUEST['validation_mode']; - $control = array(); - $control = $lcCyclesControler->save($lc_cycles, $mode); - if (!empty($control['error']) && $control['error'] <> 1) { - // Error management depending of mode - $_SESSION['error'] = str_replace("#", "<br />", $control['error']); - At_putInSession("status", $status); - At_putInSession("lc_cycles", $lc_cycles->getArray()); - switch ($mode) { - case "up": - if (!empty($_REQUEST['id'])) { - header("location: ".$_SESSION['config']['businessappurl']."index.php?page=".$pageName."&mode=up&id=".$_REQUEST['id']."&module=life_cycle"); - } else { - header("location: ".$_SESSION['config']['businessappurl']."index.php?page=".$pageName."&mode=list&module=life_cycle&order=".$status['order']."&order_field=".$status['order_field']."&start=".$status['start']."&what=".$status['what']); - } - exit; - case "add": - header("location: ".$_SESSION['config']['businessappurl']."index.php?page=".$pageName."&mode=add&module=life_cycle"); - exit; - } - } else { - if ($mode == "add") - $_SESSION['info'] = _LC_CYCLE_ADDED; - else - $_SESSION['info'] = _LC_CYCLE_UPDATED; - unset($_SESSION['m_admin']); - header("location: ".$_SESSION['config']['businessappurl']."index.php?page=".$pageName."&mode=list&module=life_cycle&order=".$status['order']."&order_field=".$status['order_field']."&start=".$status['start']."&what=".$status['what']); - } -} - -/** - * Initialize session parameters for update display - * @param Long $cycle_id - */ -function display_up($cycle_id) { - $state=true; - $lcCyclesControler = new lc_cycles_controler(); - $lc_cycles = $lcCyclesControler->get($cycle_id); - if (empty($lc_cycles)) - $state = false; - else - At_putInSession("lc_cycles", $lc_cycles->getArray()); - - return $state; -} - -/** - * Initialize session parameters for add display with given docserver - */ -function display_add() { - $sessionName = "lc_cycles"; - if (!isset($_SESSION['m_admin'][$sessionName])) - init_session(); -} - -/** - * Initialize session parameters for list display - */ -function display_list() { - //$sessionName = "lc_cycles"; - $pageName = "lc_cycles_management_controler"; - //$tableName = "lc_cycles"; - $idName = "cycle_id"; - - $_SESSION['m_admin'] = array(); - - init_session(); - - $select[_LC_CYCLES_TABLE_NAME] = array(); - array_push($select[_LC_CYCLES_TABLE_NAME], $idName, "policy_id", "cycle_desc", "sequence_number"); - $what = ""; - $where =""; - $func = new functions(); - $arrayPDO = array(); - if (isset($_REQUEST['what']) && !empty($_REQUEST['what'])) { - $what = $_REQUEST['what']; - $where = "lower(".$idName.") like lower(?) "; - $arrayPDO = array_merge($arrayPDO, array($what.'%')); - } - - // Checking order and order_field values - $order = 'asc'; - if (isset($_REQUEST['order']) && !empty($_REQUEST['order'])) { - $order = trim($_REQUEST['order']); - } - $field = $idName; - if (isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) { - $field = trim($_REQUEST['order_field']); - } - $listShow = new list_show(); - $orderstr = $listShow->define_order($order, 'lc_cycles.' . $field); - $request = new request(); - $tab=$request->PDOselect($select,$where,$arrayPDO,$orderstr,$_SESSION['config']['databasetype']); - //$request->show(); - for ($i=0;$i<count($tab);$i++) { - foreach($tab[$i] as &$item) { - switch ($item['column']) { - case $idName: - At_formatItem($item,_ID,"15","left","left","bottom",true); break; - case "policy_id": - At_formatItem($item,_POLICY_ID,"15","left","left","bottom",true); break; - case "cycle_desc": - At_formatItem($item,_CYCLE_DESC,"40","left","left","bottom",true); break; - case "sequence_number": - At_formatItem($item,_SEQUENCE_NUMBER,"15","left","left","bottom",true); break; - } - } - } - $result = array(); - $result['tab']=$tab; - $result['what']=$what; - $result['page_name'] = $pageName."&mode=list"; - $result['page_name_up'] = $pageName."&mode=up"; - $result['page_name_del'] = $pageName."&mode=del"; - //$result['page_name_val']= $pageName."&mode=allow"; - //$result['page_name_ban'] = $pageName."&mode=ban"; - $result['page_name_add'] = $pageName."&mode=add"; - $result['label_add'] = _LC_CYCLE_ADDITION; - $_SESSION['m_admin']['init'] = true; - $result['title'] = _LC_CYCLES_LIST." : ".count($tab)." "._LC_CYCLES; - $result['autoCompletionArray'] = array(); - $result['autoCompletionArray']["list_script_url"] = $_SESSION['config']['businessappurl']."index.php?display=false&module=life_cycle&page=lc_cycles_list_by_id"; - $result['autoCompletionArray']["number_to_begin"] = 1; - return $result; -} - -/** - * Delete given docserver if exists and initialize session parameters - * @param string $cycle_id - */ -function display_del($cycle_id) { - $lcCyclesControler = new lc_cycles_controler(); - $lc_cycles = $lcCyclesControler->get($cycle_id); - if (isset($lc_cycles)) { - // Deletion - $control = array(); - $control = $lcCyclesControler->delete($lc_cycles); - if (!empty($control['error']) && $control['error'] <> 1) { - $_SESSION['error'] = str_replace("#", "<br />", $control['error']); - } else { - $_SESSION['info'] = _LC_CYCLE_DELETED." ".$cycle_id; - } - $pageName = "lc_cycles_management_controler"; - ?><script>window.top.location='<?php echo $_SESSION['config']['businessappurl']."index.php?page=".$pageName."&mode=list&module=life_cycle";?>';</script> - <?php - exit; - } else { - // Error management - $_SESSION['error'] = _LC_CYCLE.' '._UNKNOWN; - } -} - - diff --git a/modules/life_cycle/lc_policies_list_by_id.php b/modules/life_cycle/lc_policies_list_by_id.php deleted file mode 100755 index db2c1b97221a3dd1e44f281a1566bc3cc554a845..0000000000000000000000000000000000000000 --- a/modules/life_cycle/lc_policies_list_by_id.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -/* -* Copyright 2008-2011 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** -* @brief List of policies for autocompletion -* -* -* @file -* @author Laurent Giovannoni <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup life_cycle -*/ - -require_once ("modules/life_cycle/life_cycle_tables_definition.php"); -require_once('core/admin_tools.php'); -$db = new Database(); -$stmt = $db->query("select policy_id as tag from " . _LC_POLICIES_TABLE_NAME - . " where lower(policy_id) like lower(?) order by policy_id", array($_REQUEST['what'] . "%")); -At_showAjaxList($stmt, $_REQUEST['what']); diff --git a/modules/life_cycle/lc_policies_management.php b/modules/life_cycle/lc_policies_management.php deleted file mode 100755 index 06d8f34df7ffde08f9722be39599b6b5fad82a3d..0000000000000000000000000000000000000000 --- a/modules/life_cycle/lc_policies_management.php +++ /dev/null @@ -1,237 +0,0 @@ -<script language="javascript"> - function showHideElem(elem) - { - var elem_1 = window.document.getElementById(elem); - if (elem_1 != null && elem_1.style.display == "block") { - elem_1.style.display = "none"; - } else if (elem_1 != null && elem_1.style.display == "none") { - elem_1.style.display = "block"; - } - } -</script> -<?php -/* View */ -$func = new functions(); -if ($mode == 'list') { - $listShow = new list_show(); - $listShow->admin_list( - $lc_policies_list['tab'], - count($lc_policies_list['tab']), - $lc_policies_list['title'], - 'policy_id', - 'lc_policies_management_controler&mode=list', - 'life_cycle', 'policy_id', - true, - $lc_policies_list['page_name_up'], - '', - '', - $lc_policies_list['page_name_del'], - $lc_policies_list['page_name_add'], - $lc_policies_list['label_add'], - false, - false, - _ALL_LC_POLICIES, - _LC_POLICY, - 'recycle', - true, - true, - false, - true, - $lc_policies_list['what'], - true, - $lc_policies_list['autoCompletionArray'] - ); -} elseif ($mode == 'up' || $mode == 'add') { - ?> - <h1><i class="fa fa-recycle fa-2x"></i> - <?php - if ($mode == 'add') { - echo _LC_POLICY_ADDITION; - } elseif ($mode == 'up') { - echo _LC_POLICY_MODIFICATION; - } ?> - </h1> - <div id="inner_content" class="clearfix" align="center"> - <br/><br/> - <?php - if ($state == false) { - echo '<br /><br />'._THE_LC_POLICY.' '._UNKOWN.'<br /><br /><br /><br />'; - } else { - ?> - <div class="block"> - <form id="adminform" method="post" class="forms" style="width:400px;" action="<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&page=lc_policies_management_controler&module=life_cycle&mode='.$mode; ?>"> - <input type="hidden" name="display" value="true" /> - <input type="hidden" name="module" value="life_cycle" /> - <input type="hidden" name="page" value="lc_policies_management_controler" /> - <input type="hidden" name="mode" id="mode" value="<?php functions::xecho($mode); ?>" /> - <input type="hidden" name="order" id="order" value="<?php if (isset($_REQUEST['order'])) { - functions::xecho($_REQUEST['order']); - } ?>" /> - <input type="hidden" name="order_field" id="order_field" value="<?php if (isset($_REQUEST['order_field'])) { - functions::xecho($_REQUEST['order_field']); - } ?>" /> - <input type="hidden" name="what" id="what" value="<?php if (isset($_REQUEST['what'])) { - functions::xecho($_REQUEST['what']); - } ?>" /> - <input type="hidden" name="start" id="start" value="<?php if (isset($_REQUEST['start'])) { - functions::xecho($_REQUEST['start']); - } ?>" /> - <p> - <label for="id"><?php echo _LC_POLICY_ID; ?> : </label> - <input name="id" type="text" id="id" value="<?php if (isset($_SESSION['m_admin']['lc_policies']['policy_id'])) { - functions::xecho($func->show_str($_SESSION['m_admin']['lc_policies']['policy_id'])); - } ?>" <?php if ($mode == 'up') { - echo " readonly='readonly' class='readonly'"; - } ?>/> - </p> - <p> - <label for="policy_name"><?php echo _LC_POLICY_NAME; ?> : </label> - <input name="policy_name" type="text" id="policy_name" value="<?php if (isset($_SESSION['m_admin']['lc_policies']['policy_name'])) { - functions::xecho($func->show_str($_SESSION['m_admin']['lc_policies']['policy_name'])); - } ?>" /> - </p> - <p> - <label for="policy_desc"><?php echo _POLICY_DESC; ?> : </label> - <textarea name="policy_desc" type="text" id="policy_desc" value="<?php if (isset($_SESSION['m_admin']['lc_policies']['policy_desc'])) { - functions::xecho($func->show_str($_SESSION['m_admin']['lc_policies']['policy_desc'])); - } ?>" /><?php if (isset($_SESSION['m_admin']['lc_policies']['policy_desc'])) { - echo $_SESSION['m_admin']['lc_policies']['policy_desc']; - } ?></textarea> - </p> - <p class="buttons"> - <?php - if ($mode == 'up') { - ?> - <input class="button" type="submit" name="submit" value="<?php echo _MODIFY; ?>" /> - <?php - } elseif ($mode == 'add') { - ?> - <input type="submit" class="button" name="submit" value="<?php echo _ADD; ?>" /> - <?php - } ?> - <input type="button" class="button" name="cancel" value="<?php echo _CANCEL; ?>" onclick="javascript:window.location.href='<?php echo $_SESSION['config']['businessappurl']; ?>index.php?page=lc_policies_management_controler&module=life_cycle&mode=list';"/> - </p> - </form> - <?php - } - if ( - isset($_SESSION['m_admin']['lc_policies']['tabWf']) - && $_SESSION['m_admin']['lc_policies']['tabWf'] != '' - ) { - if ($_SESSION['m_admin']['lc_policies']['tabWf']['status'] != 'ko') { - $content = ''; - $content .= '<hr/>'; - for ( - $cptCycles = 0; - $cptCycles < count($_SESSION['m_admin']['lc_policies']['tabWf']['value']['cycles']); - ++$cptCycles - ) { - $content .= '<table border="1" rules="rows">'; - if ($cptCycles == 0) { - $content .= '<tr>'; - $content .= '<th align="left" width="180px">' - ._CYCLE_ID.'</th>'; - $content .= '<th align="left" width="300px">' - ._CYCLE_DESC.'</th>'; - $content .= '<th align="left" width="300px">' - ._WHERE_CLAUSE.'</th>'; - $content .= '<th align="left" width="100px">' - ._BREAK_KEY.'</th>'; - $content .= '<th align="right" width="100px">' - ._SEQUENCE_NUMBER.'</th>'; - $content .= '</tr>'; - } - $content .= '<tr>'; - $link = '<a href="#" onclick="javascript:showHideElem(\'step' - .$cptCycles.'\');">'; - $content .= '<td align="left" width="180px">'; - $content .= '<a href="'.$_SESSION['config']['businessappurl'] - .'?page=lc_cycles_management_controler&mode=up&' - .'module=life_cycle&id='.$_SESSION['m_admin']['lc_policies']['tabWf']['value']['cycles'][$cptCycles]['cycle_id'].'">'; - $content .= '<i class="fa fa-cogs fa-2x" title="'._SETUP.' ' - ._LC_CYCLE.'"></i></a> '; - $content .= $link; - $content .= $_SESSION['m_admin']['lc_policies']['tabWf']['value']['cycles'][$cptCycles]['cycle_id']; - $content .= '</a>'; - $content .= '</td>'; - $content .= '<td align="left" width="300px">'; - $content .= $link; - $content .= $_SESSION['m_admin']['lc_policies']['tabWf']['value']['cycles'][$cptCycles]['cycle_desc']; - $content .= '</a>'; - $content .= '</td>'; - $content .= '<td align="left" width="300px">'; - $content .= $link; - $content .= $_SESSION['m_admin']['lc_policies']['tabWf']['value']['cycles'][$cptCycles]['where_clause']; - $content .= '</a>'; - $content .= '</td>'; - $content .= '<td align="left" width="100px">'; - $content .= $link; - $content .= $_SESSION['m_admin']['lc_policies']['tabWf']['value']['cycles'][$cptCycles]['break_key']; - $content .= '</a>'; - $content .= '</td>'; - $content .= '<td align="right" width="100px">'; - $content .= $link; - $content .= $_SESSION['m_admin']['lc_policies']['tabWf']['value']['cycles'][$cptCycles]['sequence_number']; - $content .= '</a>'; - $content .= ' </td>'; - $content .= '</tr>'; - $content .= '</table>'; - $content .= '<br/>'; - $content .= '<div id="step'.$cptCycles.'" style="display:none;">'; - for ( - $cptSteps = 0; - $cptSteps < count($_SESSION['m_admin']['lc_policies']['tabWf']['value']['cycles'][$cptCycles]['steps']); - ++$cptSteps - ) { - $content .= '<table border="0" rules="rows">'; - if ($cptSteps == 0) { - $content .= '<tr>'; - $content .= '<th align="left" width="180px"><small>' - ._CYCLE_STEP_ID.'</small></th>'; - $content .= '<th align="left" width="300px"><small>' - ._CYCLE_STEP_DESC.'</small></th>'; - $content .= '<th align="left" width="200px"><small>' - ._DOCSERVER_TYPE_ID.'</small></th>'; - $content .= '<th align="left" width="150px"><small>' - ._STEP_OPERATION.'</small></th>'; - $content .= '<th align="left" width="80px"><small>' - ._SEQUENCE_NUMBER.'</small></th>'; - $content .= '</tr>'; - } - $content .= '<tr>'; - $content .= '<td align="left" width="180px"><small>'; - $content .= '<a href="'.$_SESSION['config']['businessappurl'] - .'?page=lc_cycle_steps_management_controler&mode=up&' - .'module=life_cycle&id='.$_SESSION['m_admin']['lc_policies']['tabWf']['value']['cycles'][$cptCycles]['steps'][$cptSteps]['cycle_step_id'].'">'; - $content .= '<i class="fa fa-cogs fa-2x" title="'._SETUP.' ' - ._LC_CYCLE_STEP.'"></i></a> '; - $content .= $_SESSION['m_admin']['lc_policies']['tabWf']['value']['cycles'][$cptCycles]['steps'][$cptSteps]['cycle_step_id']; - $content .= '</small></td>'; - $content .= '<td align="left" width="300px"><small>'; - $content .= $_SESSION['m_admin']['lc_policies']['tabWf']['value']['cycles'][$cptCycles]['steps'][$cptSteps]['cycle_step_desc']; - $content .= '</small></td>'; - $content .= '<td align="left" width="200px"><small>'; - $content .= $_SESSION['m_admin']['lc_policies']['tabWf']['value']['cycles'][$cptCycles]['steps'][$cptSteps]['docserver_type_id']; - $content .= '</small></td>'; - $content .= '<td align="left" width="150px"><small>'; - $content .= $_SESSION['m_admin']['lc_policies']['tabWf']['value']['cycles'][$cptCycles]['steps'][$cptSteps]['step_operation']; - $content .= '</small></td>'; - $content .= '<td align="right" width="80px"><small>'; - $content .= $_SESSION['m_admin']['lc_policies']['tabWf']['value']['cycles'][$cptCycles]['steps'][$cptSteps]['sequence_number']; - $content .= ' </small></td>'; - $content .= '</tr>'; - $content .= '</table>'; - } - $content .= '<br/>'; - $content .= '</div>'; - } - $content .= '<hr/>'; - echo $content; - } else { - echo $_SESSION['m_admin']['lc_policies']['tabWf']['error']; - } - } ?> - </div> - </div> - <?php -} diff --git a/modules/life_cycle/lc_policies_management_controler.php b/modules/life_cycle/lc_policies_management_controler.php deleted file mode 100755 index a183349aeece2ae085b3b855afe27abe8239bb21..0000000000000000000000000000000000000000 --- a/modules/life_cycle/lc_policies_management_controler.php +++ /dev/null @@ -1,318 +0,0 @@ -<?php - -/* -* Copyright 2008-2011 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** -* @brief Contains the life_cycle Object (herits of the BaseObject class) -* -* -* @file -* @author Luc KEULEYAN - BULL -* @author Laurent Giovannoni -* @date $date$ -* @version $Revision$ -* @ingroup life_cycle -*/ - -$sessionName = "lc_policies"; -$pageName = "lc_policies_management_controler"; -$tableName = "lc_policies"; -$idName = "policy_id"; - -$mode = 'add'; - -$core = new core_tools(); -$core->load_lang(); - -$core->test_admin('admin_life_cycle', 'life_cycle'); - -if (isset($_REQUEST['mode']) && !empty($_REQUEST['mode'])) { - $mode = $_REQUEST['mode']; -} else { - $mode = 'list'; -} - -try{ - require_once("modules/life_cycle/class/lc_policies_controler.php"); - require_once("core/class/class_request.php"); - require_once('core/admin_tools.php'); - if ($mode == 'list') { - require_once("modules/life_cycle/lang/fr.php"); - require_once("apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_list_show.php"); - } -} catch (Exception $e) { - functions::xecho($e->getMessage()); -} - -if (isset($_REQUEST['submit'])) { - // Action to do with db - validate_cs_submit($mode); -} else { - // Display to do - if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) - $policy_id = $_REQUEST['id']; - $state = true; - switch ($mode) { - case "up" : - $state=display_up($policy_id); - location_bar_management($mode); - break; - case "add" : - display_add(); - location_bar_management($mode); - break; - case "del" : - display_del($policy_id); - break; - case "list" : - $lc_policies_list=display_list(); - location_bar_management($mode); - break; - case "allow" : - display_enable($policy_id); - location_bar_management($mode); - case "ban" : - display_disable($policy_id); - location_bar_management($mode); - } - include('lc_policies_management.php'); -} - -/** - * Initialize session variables - */ -function init_session() -{ - $sessionName = "lc_policies"; - $_SESSION['m_admin'][$sessionName] = array(); -} - -/** - * Management of the location bar - */ -function location_bar_management($mode) -{ - //$sessionName = "lc_policies"; - $pageName = "lc_policies_management_controler"; - //$tableName = "lc_policies"; - //$idName = "policy_id"; - - $page_labels = array('add' => _ADDITION, 'up' => _MODIFICATION, 'list' => _LC_POLICIES_LIST); - $page_ids = array('add' => 'docserver_add', 'up' => 'docserver_up', 'list' => 'lc_policies_list'); - - $init = false; - if (isset($_REQUEST['reinit']) && $_REQUEST['reinit'] == "true") - $init = true; - - $level = ""; - if (isset($_REQUEST['level']) && ($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1)) - $level = $_REQUEST['level']; - - $page_path = $_SESSION['config']['businessappurl'].'index.php?page='.$pageName.'&module=life_cycle&mode='.$mode; - $page_label = $page_labels[$mode]; - $page_id = $page_ids[$mode]; - $ct=new core_tools(); - $ct->manage_location_bar($page_path, $page_label, $page_id, $init, $level); - -} - -/** - * Validate a submit (add or up), - * up to saving object - */ -function validate_cs_submit($mode) -{ - //$sessionName = "lc_policies"; - $pageName = "lc_policies_management_controler"; - //$tableName = "lc_policies"; - //$idName = "policy_id"; - //$f=new functions(); - $lcPoliciesControler = new lc_policies_controler(); - $status= array(); - $status['order']=$_REQUEST['order']; - $status['order_field']=$_REQUEST['order_field']; - $status['what']=$_REQUEST['what']; - $status['start']=$_REQUEST['start']; - $lc_policies = new lc_policies(); - if (isset($_REQUEST['id'])) $lc_policies->policy_id = $_REQUEST['id']; - if (isset($_REQUEST['policy_name'])) $lc_policies->policy_name = $_REQUEST['policy_name']; - if (isset($_REQUEST['policy_desc'])) $lc_policies->policy_desc = $_REQUEST['policy_desc']; - $control = array(); - $control = $lcPoliciesControler->save($lc_policies, $mode); - if (!empty($control['error']) && $control['error'] <> 1) { - // Error management depending of mode - $_SESSION['error'] = str_replace("#", "<br />", $control['error']); - At_putInSession("status", $status); - At_putInSession("lc_policies", $lc_policies->getArray()); - switch ($mode) { - case "up": - if (!empty($_REQUEST['id'])) { - header("location: ".$_SESSION['config']['businessappurl']."index.php?page=".$pageName."&mode=up&id=".$_REQUEST['id']."&module=life_cycle"); - } else { - header("location: ".$_SESSION['config']['businessappurl']."index.php?page=".$pageName."&mode=list&module=life_cycle&order=".$status['order']."&order_field=".$status['order_field']."&start=".$status['start']."&what=".$status['what']); - } - exit; - case "add": - header("location: ".$_SESSION['config']['businessappurl']."index.php?page=".$pageName."&mode=add&module=life_cycle"); - exit; - } - } else { - if ($mode == "add") - $_SESSION['info'] = _LC_POLICY_ADDED; - else - $_SESSION['info'] = _LC_POLICY_UPDATED; - unset($_SESSION['m_admin']); - header("location: ".$_SESSION['config']['businessappurl']."index.php?page=".$pageName."&mode=list&module=life_cycle&order=".$status['order']."&order_field=".$status['order_field']."&start=".$status['start']."&what=".$status['what']); - } -} - -/** - * Initialize session parameters for update display - * @param Long $policy_id - */ -function display_up($policyId) -{ - $state=true; - $lcPoliciesControler = new lc_policies_controler(); - $lc_policies = $lcPoliciesControler->get($policyId); - if (empty($lc_policies)) { - $state = false; - } else { - At_putInSession("lc_policies", $lc_policies->getArray()); - $_SESSION['m_admin']['lc_policies']['tabWf'] = array(); - $_SESSION['m_admin']['lc_policies']['tabWf'] - = $lcPoliciesControler->designPolicyWorkflow($policyId); - } - return $state; -} - -/** - * Initialize session parameters for add display with given docserver - */ -function display_add() -{ - $sessionName = "lc_policies"; - if (!isset($_SESSION['m_admin'][$sessionName])) - init_session(); -} - -/** - * Initialize session parameters for list display - */ -function display_list() -{ - //$sessionName = "lc_policies"; - $pageName = "lc_policies_management_controler"; - //$tableName = "lc_policies"; - $idName = "policy_id"; - - $_SESSION['m_admin'] = array(); - - init_session(); - - $select[_LC_POLICIES_TABLE_NAME] = array(); - array_push($select[_LC_POLICIES_TABLE_NAME], $idName, "policy_name", "policy_desc"); - $what = ""; - $where =""; - $arrayPDO = array(); - if (isset($_REQUEST['what']) && !empty($_REQUEST['what'])) { - $func = new functions(); - $what = $_REQUEST['what']; - $where = "lower(".$idName.") like lower(?) "; - $arrayPDO = array_merge($arrayPDO, array(strtoupper($what).'%')); - } - - // Checking order and order_field values - $order = 'asc'; - if (isset($_REQUEST['order']) && !empty($_REQUEST['order'])) { - $order = trim($_REQUEST['order']); - } - $field = $idName; - if (isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) { - $field = trim($_REQUEST['order_field']); - } - $listShow = new list_show(); - $orderstr = $listShow->define_order($order, $field); - $request = new request(); - $tab=$request->PDOselect($select,$where,$arrayPDO,$orderstr,$_SESSION['config']['databasetype']); - for ($i=0;$i<count($tab);$i++) { - foreach($tab[$i] as &$item) { - switch ($item['column']) { - case $idName: - At_formatItem($item,_ID,"20","left","left","bottom",true); break; - case "policy_name": - At_formatItem($item,_POLICY_NAME,"20","left","left","bottom",true); break; - case "policy_desc": - At_formatItem($item,_POLICY_DESC,"40","left","left","bottom",true); break; - } - } - } - - /** - * - La plus propre : créer un objet "PageList" - * - La plus locale : si cela ne sert que pour admin_list dans docserver_management.php, - * il est possible d'en construire directement la string et de la récupérer en return. - */ - $result = array(); - $result['tab']=$tab; - $result['what']=$what; - $result['page_name'] = $pageName."&mode=list"; - $result['page_name_up'] = $pageName."&mode=up"; - $result['page_name_del'] = $pageName."&mode=del"; - //$result['page_name_val']= $pageName."&mode=allow"; - //$result['page_name_ban'] = $pageName."&mode=ban"; - $result['page_name_add'] = $pageName."&mode=add"; - $result['label_add'] = _LC_POLICY_ADDITION; - $_SESSION['m_admin']['init'] = true; - $result['title'] = _LC_POLICIES_LIST." : ".count($tab)." "._LC_POLICIES; - $result['autoCompletionArray'] = array(); - $result['autoCompletionArray']["list_script_url"] = $_SESSION['config']['businessappurl']."index.php?display=false&module=life_cycle&page=lc_policies_list_by_id"; - $result['autoCompletionArray']["number_to_begin"] = 1; - return $result; -} - -/** - * Delete given docserver if exists and initialize session parameters - * @param string $policy_id - */ -function display_del($policy_id) -{ - $lcPoliciesControler = new lc_policies_controler(); - $lc_policies = $lcPoliciesControler->get($policy_id); - if (isset($lc_policies)) { - // Deletion - $control = array(); - $control = $lcPoliciesControler->delete($lc_policies); - if (!empty($control['error']) && $control['error'] <> 1) { - $_SESSION['error'] = str_replace("#", "<br />", $control['error']); - } else { - $_SESSION['info'] = _LC_POLICY_DELETED." ".$policy_id; - } - $pageName = "lc_policies_management_controler"; - ?> - <script type="text/javascript">window.top.location='<?php echo $_SESSION['config']['businessappurl']."index.php?page=".$pageName."&mode=list&module=life_cycle";?>';</script> - <?php - exit; - } else { - // Error management - $_SESSION['error'] = _LC_POLICY.' '._UNKNOWN; - } -} - diff --git a/modules/life_cycle/life_cycle_administration.php b/modules/life_cycle/life_cycle_administration.php deleted file mode 100755 index 43885363ad9a2d4b6c3ee8787df81fff82fbd226..0000000000000000000000000000000000000000 --- a/modules/life_cycle/life_cycle_administration.php +++ /dev/null @@ -1,89 +0,0 @@ -<?php - -/* -* Copyright 2010 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** -* @brief life cycle Administration summary Page -* -* life cycle Administration summary Page -* -* @file -* @author Laurent Giovannoni <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup life_cycle -*/ - -$admin = new core_tools(); -$admin->test_admin('admin_life_cycle', 'life_cycle'); -/****************Management of the location bar ************/ -$init = false; -if (isset($_REQUEST['reinit']) && $_REQUEST['reinit'] == "true") { - $init = true; -} -$level = ""; -if (isset($_REQUEST['level']) && ($_REQUEST['level'] == 2 - || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 - || $_REQUEST['level'] == 1) -) { - $level = $_REQUEST['level']; -} -$page_path = $_SESSION['config']['businessappurl'] - .'index.php?page=life_cycle_administration&module=life_cycle'; -$page_label = _ADMIN_LIFE_CYCLE_SHORT; -$page_id = "life_cycle_administration"; -$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); -/***********************************************************/ -unset($_SESSION['m_admin']); -?> -<h1><i class="fa fa-recycle fa-2x"></i> -<?php echo _ADMIN_LIFE_CYCLE_SHORT;?></h1> -<div id="inner_content" class="clearfix"> -<div class="block"> -<h2 style="text-align:center;"><?php echo _ADMIN_LIFE_CYCLE;?></h1></h2> - <div class="admin_item" title=" - <?php echo _MANAGE_LC_POLICIES;?>" - onclick=" - window.top.location='<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=lc_policies_management_controler&mode=list&module=life_cycle';"> - <div> - <i class="fa fa-recycle fa-4x"></i><br /> - <strong><?php echo _MANAGE_LC_POLICIES;?></strong> - </div> - </div> - <div class="admin_item" title=" - <?php echo _MANAGE_LC_CYCLES;?>" - onclick="window.top.location='<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=lc_cycles_management_controler&mode=list&module=life_cycle';"> - <div> - <i class="fa fa-recycle fa-4x"></i><br /> - <strong><?php echo _MANAGE_LC_CYCLES;?></strong> - </div> - </div> - <div class="admin_item" title=" - <?php echo _MANAGE_LC_CYCLE_STEPS;?>" onclick="window.top.location= - '<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=lc_cycle_steps_management_controler&mode=list&module=life_cycle';"> - <div> - <i class="fa fa-recycle fa-4x"></i><br /> - <strong><?php echo _MANAGE_LC_CYCLE_STEPS;?></strong> - </div> - </div> - <div class="clearfix"></div> - </div> - </div> -</div> diff --git a/modules/life_cycle/xml/IVS/data_types.xml b/modules/life_cycle/xml/IVS/data_types.xml deleted file mode 100755 index b353d8fa202c9eb0fb34cc23213c1d91b8e1fd9b..0000000000000000000000000000000000000000 --- a/modules/life_cycle/xml/IVS/data_types.xml +++ /dev/null @@ -1,5 +0,0 @@ -<dataTypes> - <dataType name="sample_lc" base="graph"> - <pattern value="/^\w+$/" /> - </dataType> -</dataTypes> \ No newline at end of file diff --git a/modules/life_cycle/xml/IVS/requests_definitions.xml b/modules/life_cycle/xml/IVS/requests_definitions.xml deleted file mode 100755 index 8b8d6868b0d92acdbe4a4cdc40ffc0daf89407bd..0000000000000000000000000000000000000000 --- a/modules/life_cycle/xml/IVS/requests_definitions.xml +++ /dev/null @@ -1,34 +0,0 @@ -<requestDefinitions> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="lc_manage_policies" > - <parameter name="page" value="lc_policies_management_controler"/> - <parameter name="module" value="life_cycle"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="lc_manage_cycles" > - <parameter name="page" value="lc_cycles_management_controler"/> - <parameter name="module" value="life_cycle"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="lc_manage_steps" > - <parameter name="page" value="lc_cycle_steps_management_controler"/> - <parameter name="module" value="life_cycle"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="lc_ajax_search" > - <parameter name="page" value="lc_policies_list_by_id"/> - <parameter name="module" value="life_cycle"/> - <parameter name="display" value="false"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="lc_ajax_search" > - <parameter name="page" value="lc_cycles_list_by_id"/> - <parameter name="module" value="life_cycle"/> - <parameter name="display" value="false"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="lc_ajax_search" > - <parameter name="page" value="lc_cycle_steps_list_by_id"/> - <parameter name="module" value="life_cycle"/> - <parameter name="display" value="false"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="lc_ajax_cycle_list" > - <parameter name="page" value="change_cycle_list"/> - <parameter name="module" value="life_cycle"/> - <parameter name="display" value="true"/> - </requestDefinition> -</requestDefinitions> \ No newline at end of file diff --git a/modules/life_cycle/xml/IVS/validation_rules.xml b/modules/life_cycle/xml/IVS/validation_rules.xml deleted file mode 100755 index b727b8ace7a48b31b5435454b987e8b1c698b7c1..0000000000000000000000000000000000000000 --- a/modules/life_cycle/xml/IVS/validation_rules.xml +++ /dev/null @@ -1,42 +0,0 @@ -<validationRules> - <validationRule name="lc_manage_policies" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="id" type="identifier" /> - <parameter name="policy_name" type="string" /> - <parameter name="policy_desc" type="string" /> - <parameter name="submit" type="string" /> - <parameter name="Submit" type="string" /> - </validationRule> - <validationRule name="lc_manage_cycles" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="policy_id" type="identifier" /> - <parameter name="id" type="identifier" /> - <parameter name="cycle_desc" type="string" /> - <parameter name="sequence_number" type="integer" /> - <parameter name="where_clause" type="string" /> - <parameter name="break_key" type="identifier" /> - <parameter name="validation_mode" type="identifier" /> - <parameter name="submit" type="string" /> - <parameter name="Submit" type="string" /> - </validationRule> - <validationRule name="lc_manage_steps" extends="standardForm" mode="error"> - <parameter name="module" type="identifier" /> - <parameter name="policy_id" type="identifier" /> - <parameter name="cycle_id" type="identifier" /> - <parameter name="id" type="identifier" /> - <parameter name="cycle_step_desc" type="string" /> - <parameter name="docserver_type_id" type="identifier" /> - <parameter name="step_operation" type="identifier" /> - <parameter name="sequence_number" type="integer" /> - <parameter name="submit" type="string" /> - <parameter name="Submit" type="string" /> - </validationRule> - <validationRule name="lc_ajax_search" extends="standardForm" mode="error"> - <parameter name="what" type="string" /> - <parameter name="module" type="identifier" /> - </validationRule> - <validationRule name="lc_ajax_cycle_list" extends="standardForm" mode="error"> - <parameter name="policy_id" type="identifier" /> - <parameter name="module" type="identifier" /> - </validationRule> -</validationRules> \ No newline at end of file diff --git a/modules/life_cycle/xml/config.xml b/modules/life_cycle/xml/config.xml index 342218fa5290e31edc2a82f9c08743894f0df01f..bdcc1f41e3f94e0864dcf75d237ddd94cc82a518 100755 --- a/modules/life_cycle/xml/config.xml +++ b/modules/life_cycle/xml/config.xml @@ -12,9 +12,4 @@ <lc_cycle_steps>lc_cycle_steps</lc_cycle_steps> <lc_stack>lc_stack</lc_stack> </TABLENAME> - <HISTORY> - <lcadd>true</lcadd> - <lcup>true</lcup> - <lcdel>true</lcdel> - </HISTORY> </root> diff --git a/modules/life_cycle/xml/life_cycle_features.xml b/modules/life_cycle/xml/life_cycle_features.xml deleted file mode 100755 index 61ac09353b28929845e7c41ab0eb72d945956ac6..0000000000000000000000000000000000000000 --- a/modules/life_cycle/xml/life_cycle_features.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<ROOT> - <LIFE_CYCLE> - <PROCESS> - <MODE>NONE</MODE> - <MODE>COPY</MODE> - <MODE>PURGE</MODE> - </PROCESS> - </LIFE_CYCLE> -</ROOT> diff --git a/modules/life_cycle/xml/menu.xml b/modules/life_cycle/xml/menu.xml deleted file mode 100755 index d15cc8033fce6abb48b9de486ec5ffba3204a7d5..0000000000000000000000000000000000000000 --- a/modules/life_cycle/xml/menu.xml +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<root> -</root> diff --git a/modules/life_cycle/xml/params.xml b/modules/life_cycle/xml/params.xml deleted file mode 100755 index 73c152b4d8d368bb8bf4f83bb1eee0d55d432b38..0000000000000000000000000000000000000000 --- a/modules/life_cycle/xml/params.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<root> - <indexing_cycles> - <cycle> - <policy_id>FNTC</policy_id> - <cycle_id>INIT</cycle_id> - </cycle> - </indexing_cycles> - <frozen_cycles> - <cycle> - <policy_id>FNTC</policy_id> - <cycle_id>OAIS</cycle_id> - </cycle> - </frozen_cycles> -</root>