diff --git a/apps/maarch_entreprise/admin/groups/add_grant.php b/apps/maarch_entreprise/admin/groups/add_grant.php deleted file mode 100755 index eaad1299c8bf8ae68f0289a5f742ab951b37d5b1..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/groups/add_grant.php +++ /dev/null @@ -1,187 +0,0 @@ -<?php -/* -* Copyright 2008,2009 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 Form to add a grant to a group, pop up page -* -* @file view.php -* @author Claire Figueras <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup admin -*/ -try{ - require_once('core/class/class_security.php'); - include_once('apps/'.$_SESSION['config']['app_id'].'/security_bitmask.php'); - include_once('core/manage_bitmask.php'); - include_once('core/where_targets.php'); -} catch (Exception $e){ - functions::xecho($e->getMessage()); -} - -$target_all = false; -if(count($_ENV['targets']) > 1 ) -{ - $target_all = true; -} - -core_tools::load_lang(); -core_tools::test_admin('admin_groups', 'apps'); - -$clause = ''; -$comment = ''; -$start_date = ''; -$stop_date = ''; -$target = 'ALL'; -$rights_bitmask = 0; -$coll_id = $_SESSION['collections'][0]['id']; -$ind = 0; -$mode = "add" ; -$access_ind = -1; -$sec = new security(); -if(isset($_REQUEST['mode']) && !empty($_REQUEST['mode'])) -{ - $mode = trim($_REQUEST['mode']); -} - -if(isset($_REQUEST['val']) && $_REQUEST['val'] >= 0) -{ - $access_ind = $_REQUEST['val']; -} - -if($mode == "up" && $access_ind >= 0) -{ - $security_id = $_SESSION['m_admin']['groups']['security'][$access_ind]['SECURITY_ID']; - $coll_id = $_SESSION['m_admin']['groups']['security'][$access_ind]['COLL_ID']; - $ind = $sec->get_ind_collection($coll_id); - if(!isset($ind) || $ind < 0){ - $ind = 0; - } - $coll_label = $_SESSION['collections'][$ind]['label']; - $target = $_SESSION['m_admin']['groups']['security'][$access_ind]['WHERE_TARGET']; - $clause = functions::show_string($_SESSION['m_admin']['groups']['security'][$access_ind]['WHERE_CLAUSE']); - $comment = functions::show_string($_SESSION['m_admin']['groups']['security'][$access_ind]['COMMENT']); - $start_date = functions::format_date_db($_SESSION['m_admin']['groups']['security'][$access_ind]['START_DATE'], false); - $stop_date = functions::format_date_db($_SESSION['m_admin']['groups']['security'][$access_ind]['STOP_DATE'], false); - $rights_bitmask = $_SESSION['m_admin']['groups']['security'][$access_ind]['RIGHTS_BITMASK']; -} -?> - -<h2 class="tit"><?php -if($mode == 'up') -{ - echo _UP_GRANT; -} -else -{ - echo _ADD_GRANT; -} - - ?></h2> -<div id="frm_error" class="error"></div> -<table width="100%"> -<tr> -<td> -<div class="popup_content"> -<form name="addGrantForm" id="addGrantForm" method="post" action="#" class="forms"> - <input type="hidden" id="mode" value="<?php functions::xecho($mode);?>" /> - <p> - <label><?php echo _COLLECTION;?> :</label> - <select name="coll_id" id="coll_id" > - <option value=""><?php echo _CHOOSE_COLLECTION;?></option> - <?php - for($i=0; $i < count($_SESSION['collections']); $i++) - { - ?> - <option value="<?php functions::xecho($_SESSION['collections'][$i]['id']);?>" <?php if ($coll_id == $_SESSION['collections'][$i]['id']) {echo 'selected="selected"'; }?>><?php functions::xecho($_SESSION['collections'][$i]['label']);?></option> - <?php - } - ?> - </select> - <span class="red_asterisk" ><i class="fa fa-star"></i></span> - </p> - <br/> - <p> - <label><?php echo _DESC;?> : </label> - <input type="text" name="comment" id="comment" value="<?php functions::xecho($comment);?>" /> - <span class="red_asterisk" ><i class="fa fa-star"></i></span> - </p> - <br/> - <p> - <?php echo _WHERE_CLAUSE_TARGET;?> :<br/> - <div style="margin-left:5%;"> - <?php if($target_all) - {?> - <input type="radio" class="check" name="target" value="ALL" id="target_ALL" <?php if($target == 'ALL'){ echo 'checked="checked"';}?> /><?php echo _ALL;?> <?php } - foreach(array_keys($_ENV['targets']) as $key) - {?> - <input type="radio" class="check" name="target" value="<?php functions::xecho($key);?>" id="target_<?php functions::xecho($key);?>" <?php if($target == $key || (!$target_all && $key == 'DOC')){ echo 'checked="checked"';}?> /><?php functions::xecho($_ENV['targets'][$key]);?> - <?php } ?> - <span class="red_asterisk" ><i class="fa fa-star"></i></span> - </div> - </p> - <br/> - <p> - <label><?php echo _WHERE_CLAUSE;?> :</label><br/> - <textarea rows="6" style="width:80%" name="where" id="where" /><?php functions::xecho($clause);?></textarea> - <span class="red_asterisk" ><i class="fa fa-star"></i></span> - </p> - <br/> - <p > - <?php echo _TASKS;?> :<br/> - <div style="margin-left:5%;"> - <?php for($k=0;$k<count($_ENV['security_bitmask']); $k++) - { - ?> - <input type="checkbox" class="check" name="rights_bitmask[]" id="<?php functions::xecho($_ENV['security_bitmask'][$k]['ID']);?>" value="true" <?php if(check_right($rights_bitmask , $_ENV['security_bitmask'][$k]['ID'])){ echo 'checked="checked"'; } ?> /> - <?php functions::xecho($_ENV['security_bitmask'][$k]['LABEL']).'<br/>'; - }?> - - </div> - </p> - <br/> - <p> - <label><?php echo _PERIOD;?> : </label> - <p> - <label><?php echo _SINCE;?></label> - <input type="text" id="start_date" name="start_date" value="<?php functions::xecho($start_date);?>" onclick="showCalender(this);"/> - </p> - <br/> - <p> - <label><?php echo _FOR;?></label> - <input type="text" id="stop_date" name="stop_date" value="<?php functions::xecho($stop_date);?>" onclick="showCalender(this);"/> - </p> - </p> - <br/> - <p class="buttons"> - <input type="button" name="Submit" value="<?php echo _VALIDATE;?>" class="button" onclick="checkAccess('addGrantForm', '<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&admin=groups&page=check_access';?>', '<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&admin=groups&page=manage_access';?>', '<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&admin=groups&page=groups_form';?>');" /> - <input type="button" name="cancel" value="<?php echo _CANCEL;?>" class="button" onclick="destroyModal('add_grant');"/> - </p> - -</form> -</div> -</td> - -<td width='400px'> - <?php - include("apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR."keywords_help.php");?> -</td> -</tr> -</table> diff --git a/apps/maarch_entreprise/admin/groups/check_access.php b/apps/maarch_entreprise/admin/groups/check_access.php deleted file mode 100755 index 9002e2cef26f7820cce223952b35a4c3540a5946..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/groups/check_access.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php - -core_tools::load_lang(); -$error = ''; - -function get_values_in_array($val) -{ - $tab = explode('$$',$val); - $values = array(); - for($i=0; $i<count($tab);$i++) - { - $tmp = explode('#', $tab[$i]); - if(isset($tmp[1])) - { - array_push($values, array('ID' => $tmp[0], 'VALUE' => trim($tmp[1]))); - } - } - return $values; -} - -function get_value_fields($values, $field) -{ - for($i=0; $i<count($values);$i++) - { - if($values[$i]['ID'] == $field) - { - return $values[$i]['VALUE']; - } - } - return false; -} - -if(!isset($_REQUEST['form_values']) || empty($_REQUEST['form_values'])) -{ - $error = _ERROR_FORM_VALUES." check<br/>"; - echo "{status : 2, error_txt : '".$error."'}"; - exit(); -} - -$values = get_values_in_array($_REQUEST['form_values']); -$coll_id = get_value_fields($values, 'coll_id'); -$comment = get_value_fields($values, 'comment'); -$target_all = get_value_fields($values, 'target_ALL'); -$target_doc = get_value_fields($values, 'target_DOC'); -$target_class = get_value_fields($values, 'target_CLASS'); -$mode = get_value_fields($values, 'mode'); - -if(!isset($mode ) || $mode == '') -{ - $error = _MODE_ERROR."<br/>"; - echo "{status : 3, error_txt : '".$error."'}"; - exit(); -} - -if(!isset($coll_id ) || $coll_id == '') -{ - $error = _COLLECTION.' '._MANDATORY."<br/>"; -} - -if(!isset($comment) || $comment == '') -{ - $error = _COMMENTS_MANDATORY."<br/>"; -} - -if((!isset($target_all) || $target_all == '') && (!isset($target_doc) || $target_doc == '') && (!isset($target_class) || $target_class == '') ) -{ - $error = _WHERE_CLAUSE_TARGET.' '._MANDATORY."<br/>"; -} - -if(!empty($error)) -{ - echo "{status : 1, error_txt : '".$error."'}"; -} -else -{ - echo "{status : 0, error_txt : '".$error."'}"; -} - exit(); diff --git a/apps/maarch_entreprise/admin/groups/groups_form.php b/apps/maarch_entreprise/admin/groups/groups_form.php deleted file mode 100755 index 16262780d9d5e4bc8721f0250a4940cf40c6042d..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/groups/groups_form.php +++ /dev/null @@ -1,164 +0,0 @@ -<?php -/* -* Copyright 2008,2009 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 Form to manage the group security -* -* -* @file -* @author Claire Figueras <dev@maarch.org> -* @author Laurent Giovannoni <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup admin -*/ - -core_tools::load_lang(); -core_tools::test_admin('admin_groups', 'apps'); -try{ - include('apps/'.$_SESSION['config']['app_id'].'/security_bitmask.php'); - include('core/where_targets.php'); - include('core/manage_bitmask.php'); -} catch (Exception $e){ - functions::xecho($e->getMessage()); -} - -function cmp($a, $b) -{ - return strcmp($a["COLL_ID"], $b["COLL_ID"]); -} -usort($_SESSION['m_admin']['groups']['security'], "cmp"); -$func = new functions(); -?> -<div class="block" > -<h2 class="tit"><small><?php echo _MANAGE_RIGHTS;?> : </small></h2> -<form name="security_form" id="security_form" method="get" > -<input type="hidden" name="display" value="true" /> -<input type="hidden" name="admin" value="groups" /> -<input type="hidden" name="page" value="groups_form" /> - <?php - if(count($_SESSION['m_admin']['groups']['security']) < 1 ) - { - echo _THE_GROUP." "._HAS_NO_SECURITY.".<br/>"; - echo _DEFINE_A_GRANT."<br/>"; - } - else - { - ?> - <table width="100%" border = "0"> - <?php - for($i=0; $i<count($_SESSION['m_admin']['groups']['security']);$i++) - { - if(isset($_SESSION['m_admin']['groups']['security'][$i]) && count($_SESSION['m_admin']['groups']['security'][$i]) > 0) - { - ?> - <tr> - <td> - <div align="left" id="access_<?php functions::xecho($_SESSION['m_admin']['groups']['security'][$i]['SECURITY_ID']);?>"> - <div style="float:left;"> - <input type="checkbox" class="check" name="security[]" value="<?php functions::xecho($i);?>" /> - </div> - <div> - <?php functions::xecho($func->show_string($_SESSION['m_admin']['groups']['security'][$i]['COMMENT']));?> - </div> - <div align="left" style="margin-left:5%;"> - - <span ><?php echo _COLLECTION;?> : </span><span><?php if(isset($_SESSION['collections'][$_SESSION['m_admin']['groups']['security'][$i]['IND_COLL_SESSION']]['label'])){functions::xecho($_SESSION['collections'][$_SESSION['m_admin']['groups']['security'][$i]['IND_COLL_SESSION']]['label']); }?></span> - </div> - <div style="margin-left:5%;"> - <span > - <?php if(!empty($_SESSION['m_admin']['groups']['security'][$i]['START_DATE']) ) - { - echo _SINCE.' : '.$func->format_date_db($_SESSION['m_admin']['groups']['security'][$i]['START_DATE']); - } - echo ' '; - if(!empty($_SESSION['m_admin']['groups']['security'][$i]['STOP_DATE']) ) - { - echo _FOR.' : '.$func->format_date_db($_SESSION['m_admin']['groups']['security'][$i]['STOP_DATE']); - }?> - </span> - </div> - <div align="right" onclick="new Effect.toggle('access_info_<?php functions::xecho($_SESSION['m_admin']['groups']['security'][$i]['SECURITY_ID']);?>', 'blind', {delay:0.2});return false;"> - <i class="fa fa-plus-square fa-2x" title="<?php _MORE_INFOS;?>" onmouseover="this.style.cursor='pointer';"/></i><span class="lb1-details"> </span> - </div> - <div style="display:none;" id="access_info_<?php functions::xecho($_SESSION['m_admin']['groups']['security'][$i]['SECURITY_ID']);?>" class="access_info desc"> - <div class="ref-unit"> - <div> - <?php echo _WHERE_CLAUSE_TARGET.' : '; - if(isset($_ENV['targets'][$_SESSION['m_admin']['groups']['security'][$i]['WHERE_TARGET']] )) - { - functions::xecho($_ENV['targets'][$_SESSION['m_admin']['groups']['security'][$i]['WHERE_TARGET']]); - } - else - { - echo _ALL; - } - ?></div> - <div> - <?php echo _WHERE_CLAUSE.' : '.$func->show_string($_SESSION['m_admin']['groups']['security'][$i]['WHERE_CLAUSE']);?> - </div> - <div> - <span><?php echo _TASKS;?> :</span><br/> - <?php - for($k=0;$k<count($_ENV['security_bitmask']); $k++) - { - echo '<div class="task"><i class="fa fa-'; - if(check_right($_SESSION['m_admin']['groups']['security'][$i]['RIGHTS_BITMASK'] , $_ENV['security_bitmask'][$k]['ID'])) - { - echo 'check'; - } - else - { - echo 'remove'; - } - echo ' fa-2x"></i> '; - functions::xecho($_ENV['security_bitmask'][$k]['LABEL']).'</div>'; - } ?> - - </div> - <p style="clear:both;"></p> - </div> - </div> - </div> - </td> - - </tr> - <?php - } - } - ?> - <tr><td height="20"> </td></tr> - </table> - <?php - } - if (count($_SESSION['m_admin']['groups']['security']) > 0) - { - ?> - <input type="button" name="modify_access" value="<?php echo _MODIFY_ACCESS;?>" class="button" onclick="modifyAccess('<?php echo $_SESSION['config']['businessappurl'];?>index.php?display=true&admin=groups&page=add_grant&mode=up');" /> - <input type="button" name="remove_access" value="<?php echo _REMOVE_ACCESS;?>" class="button" onclick="removeAccess('<?php echo $_SESSION['config']['businessappurl'];?>index.php?display=true&admin=groups&page=remove_access', '<?php echo $_SESSION['config']['businessappurl'];?>index.php?display=true&admin=groups&page=groups_form');"/> - <?php - } - ?> - <input type="button" name="addGrant" class="button" - onclick="displayModal('<?php echo $_SESSION['config']['businessappurl'];?>index.php?display=true&admin=groups&page=add_grant&mode=add', 'add_grant', 850, 650);" - value="<?php echo _ADD_GRANT;?>" /> - <br/><br/> -</form> -</div> diff --git a/apps/maarch_entreprise/admin/groups/groups_list_by_name.php b/apps/maarch_entreprise/admin/groups/groups_list_by_name.php deleted file mode 100755 index 2972ad910046f4103680ac1c0ce4f0738d2f36fa..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/groups/groups_list_by_name.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php -/* -* Copyright 2008,2009 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 groups for autocompletion -* -* -* @file -* @author Laurent Giovannoni <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup admin -*/ - -$db = new Database(); -$stmt = $db->query( - "SELECT group_desc as tag FROM ".$_SESSION['tablename']['usergroups'] - ." WHERE lower(group_desc) like lower(?) order by group_desc", - array($_REQUEST['what'].'%') -); - -$listArray = array(); -while($line = $stmt->fetchObject()) -{ - array_push($listArray, $line->tag); -} -echo "<ul>\n"; -$authViewList = 0; - -foreach($listArray as $what) -{ - if($authViewList >= 10) - { - $flagAuthView = true; - } - if(stripos($what, $_REQUEST['what']) === 0) - { - echo "<li>".$what."</li>\n"; - if(isset($flagAuthView)) - { - echo "<li>...</li>\n"; - break; - } - $authViewList++; - } -} -echo "</ul>"; diff --git a/apps/maarch_entreprise/admin/groups/manage_access.php b/apps/maarch_entreprise/admin/groups/manage_access.php deleted file mode 100755 index 7764acb5040d4f0fc66a2ae5180c31962984e706..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/groups/manage_access.php +++ /dev/null @@ -1,114 +0,0 @@ -<?php -$error = ''; -function getValuesInArray($val) -{ - $tab = explode('$$', $val); - $values = array(); - for ($i = 0; $i < count($tab); $i ++) { - $tmp = explode('#', $tab[$i]); - if (isset($tmp[1])) { - array_push( - $values, - array( - 'ID' => $tmp[0], - 'VALUE' => trim($tmp[1]) - ) - ); - } - } - return $values; -} - -function getValueFields($values, $field) -{ - for ($i = 0; $i < count($values); $i ++) { - if ($values[$i]['ID'] == $field) { - return $values[$i]['VALUE']; - } - } - return false; -} - -if (! isset($_REQUEST['form_values']) || empty($_REQUEST['form_values'])) { - $error = _ERROR_FORM_VALUES . "<br/>"; - echo "{status : 1, error_txt : '" . $error . "'}"; - exit(); -} - -try { - include 'apps/'.$_SESSION['config']['app_id'].'/security_bitmask.php'; - include 'core/manage_bitmask.php'; - include 'core/class/class_security.php'; -} catch (Exception $e) { - functions::xecho($e->getMessage()); -} - -$values = getValuesInArray($_REQUEST['form_values']); - -$collId = getValueFields($values, 'coll_id'); -$comment = getValueFields($values, 'comment'); -$where = getValueFields($values, 'where'); -$startDate = getValueFields($values, 'start_date'); -$stopDate = getValueFields($values, 'stop_date'); -$mode = getValueFields($values, 'mode'); - -$targetAll = getValueFields($values, 'target_ALL'); -$targetDoc = getValueFields($values, 'target_DOC'); -$targetClass = getValueFields($values, 'target_CLASS'); -$target = 'ALL'; -if (isset($targetAll) && ! empty($targetAll)) { - $target = $targetAll; -} else if (isset($targetDoc) && ! empty($targetDoc)) { - $target = $targetDoc; -} else if (isset($targetClass) && ! empty($targetClass)) { - $target = $targetClass; -} - -$bitmask = 0; -for ($i = 0; $i < count($_ENV['security_bitmask']); $i ++) { - $tmp = getValueFields($values, $_ENV['security_bitmask'][$i]['ID']); - if (isset($tmp) && $tmp == 'true') { - $bitmask = set_right($bitmask, $_ENV['security_bitmask'][$i]['ID']); - } -} - -if ($mode == 'up') { - for ($i = 0; $i < count($_SESSION['m_admin']['groups']['security']); $i ++) { - if ($_SESSION['m_admin']['groups']['security'][$i]['COLL_ID'] == $collId) { - $_SESSION['m_admin']['groups']['security'][$i]['WHERE_CLAUSE'] = $where; - $_SESSION['m_admin']['groups']['security'][$i]['COMMENT'] = $comment; - $_SESSION['m_admin']['groups']['security'][$i]['WHERE_TARGET'] = $target; - $_SESSION['m_admin']['groups']['security'][$i]['RIGHTS_BITMASK'] = $bitmask; - $_SESSION['m_admin']['groups']['security'][$i]['START_DATE'] = $startDate; - $_SESSION['m_admin']['groups']['security'][$i]['STOP_DATE'] = $stopDate; - break; - } - } -} else { - $sec = new security(); - $ind = $sec->get_ind_collection($collId); - $groupId = ''; - if (isset($_SESSION['m_admin']['groups']['group_id'])) { - $groupId = $_SESSION['m_admin']['groups']['group_id']; - } - $secId = count($_SESSION['m_admin']['groups']['security']); - array_push( - $_SESSION['m_admin']['groups']['security'] , - array( - 'SECURITY_ID' => $secId, - 'GROUP_ID' => $groupId , - 'COLL_ID' => $collId , - 'IND_COLL_SESSION' => $ind, - 'WHERE_CLAUSE' => $where, - 'COMMENT' => $comment, - 'WHERE_TARGET' => $target, - 'RIGHTS_BITMASK' => $bitmask, - 'START_DATE' => $startDate, - 'STOP_DATE' => $stopDate - ) - ); - $_SESSION['m_admin']['load_security'] = false; -} -echo "{status : 0, error_txt : '" . $error . "'}"; -exit(); - diff --git a/apps/maarch_entreprise/admin/groups/remove_access.php b/apps/maarch_entreprise/admin/groups/remove_access.php deleted file mode 100755 index 89369ae89e766783c60ff8add51b0120fd2d1c0a..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/groups/remove_access.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -if(isset($_REQUEST['security']) && $_REQUEST['security'] >= 0) -{ - $access_ind = explode('#', $_REQUEST['security']); - - for($i=0;$i<count($access_ind);$i++) - { - if($access_ind <> '') - { - unset($_SESSION['m_admin']['groups']['security'][$access_ind[$i]]); - } - } - $_SESSION['m_admin']['groups']['security'] = array_values($_SESSION['m_admin']['groups']['security']); - $_SESSION['m_admin']['load_security'] = false; - echo "{ status : 0 }"; -} -else -{ - echo "{ status : 1 }"; -} -?> diff --git a/apps/maarch_entreprise/admin/groups/usergroups_management.php b/apps/maarch_entreprise/admin/groups/usergroups_management.php deleted file mode 100755 index 599c86024784351c0cd5994d7af6f38213fbb5c7..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/groups/usergroups_management.php +++ /dev/null @@ -1,375 +0,0 @@ -<?php - -/* Affichage */ -if ($mode == 'list') { - $list = new list_show(); - $list->admin_list( - $groupsList['tab'], count($groupsList['tab']), $groupsList['title'], - 'group_id', 'usergroups_management_controler&mode=list', 'groups', - 'group_id', true, $groupsList['page_name_up'], - $groupsList['page_name_val'], $groupsList['page_name_ban'], - $groupsList['page_name_del'], $groupsList['page_name_add'], - $groupsList['label_add'], false, false, _ALL_GROUPS, _GROUP, - 'users', false, true, false, true, - $groupsList['what'], true, $groupsList['autoCompletionArray'] - ); -} else if ($mode == 'up' || $mode == 'add') { - ?><script type="text/javascript" src="<?php - echo $_SESSION['config']['businessappurl']; - ?>static.php?filename=usergroups_management.js"></script> - <h1><i class="fa fa-users fa-2x"></i> - <?php - if ($mode == 'add') { - echo _GROUP_ADDITION; - } else if ($mode == 'up') { - echo _GROUP_MODIFICATION; - } - ?> - </h1> - - <?php - if ($state == false) { - echo '<br /><br /><br /><br />' . _GROUP . ' ' . _UNKNOWN - .'<br /><br /><br /><br />'; - } else { - ?> - <div id="inner_content" class="clearfix"> - <div id="group_box" class="bloc" style="width:35%;"> - <?php - if ($mode == 'up') { - if (count($users) > 0) { - $uc = new users_controler(); - ?><div onclick="new Effect.toggle('users_list', 'blind', {delay:0.2});return false;" onmouseover="this.style.cursor='pointer';"> - <i class="fa fa-user fa-2x"></i><i><?php - echo _SEE_GROUP_MEMBERS; - ?></i> <i class="fa fa-angle-right"></i> - <span class="lb1-details"> </span></div> - <div class="desc" id="users_list" style="display:none;"> - <div class="ref-unit"> - <table cellpadding="0" cellspacing="0" border="0" class="listingsmall" summary=""> - <thead> - <tr> - <th><?php echo _LASTNAME;?></th> - <th ><?php echo _FIRSTNAME;?></th> - <!--<th ><?php echo _ENTITY;?></th>--> - <th></th> - </tr> - </thead> - - <tbody> - <?php - $color = ' class="col"'; - - for ($i = 0; $i < count($users[0]); $i ++) { - if ($color == ' class="col"') { - $color = ''; - } else { - $color = ' class="col"'; - } - ?> - <tr <?php echo $color;?> > - <td style="width:25%;"><?php - echo $uc->getLastName($users[0][$i]); - ?></td> - <td style="width:25%;"><?php - echo $uc->getFirstName($users[0][$i]); - ?></td> - <td ><?php - if ($core->test_service('admin_users', 'apps', false)) { - ?> - <a class="change" href="<?php - echo $_SESSION['config']['businessappurl'] - .'index.php?page=users_management_controler&mode=up&admin=users&id=' - .$users[0][$i]; - ?>" title="<?php - echo _GO_MANAGE_USER; - ?>"><i><?php - echo _GO_MANAGE_USER; - ?></i></a><?php - } - ?></td> - </tr> - <?php - } - ?> - </tbody> - </table> - <br/> - </div> - </div> - - <?php - } - if ($GLOBALS['basket_loaded'] && count($baskets) > 0) { - ?> - <div onclick="new Effect.toggle('baskets_list2', 'blind', {delay:0.2});return false;" onmouseover="this.style.cursor='pointer';" > - <i class="fa fa-inbox fa-2x"></i><i><?php - echo _SEE_BASKETS_RELATED; - ?></i> <i class="fa fa-angle-right"></i> - <span class="lb1-details"> </span></div> - <div class="desc" id="baskets_list2" style="display:none;"> - <div class="ref-unit"> - <table cellpadding="0" cellspacing="0" border="0" class="listingsmall" summary=""> - <thead> - <tr> - <th><?php echo _NAME;?></th> - <th ><?php echo _DESC;?></th> - <th></th> - </tr> - </thead> - - <tbody> - <?php - $color = ' class="col"'; - for ($i = 0; $i < count($baskets); $i ++) { - if ($color == ' class="col"') { - $color = ''; - } else { - $color = ' class="col"'; - } - ?> - <tr <?php echo $color;?> > - <td style="width:30%;"><?php - functions::xecho($baskets[$i]->__get('basket_name')); - ?></td> - <td style="width:50%;"><?php - functions::xecho($baskets[$i]->__get('basket_desc')); - ?></td> - <td > - <?php - if ($core->test_service( - 'admin_baskets', 'basket', false - ) - ) { - ?> - <a class="change" href="<?php - echo $_SESSION['config']['businessappurl'] - .'index.php?page=basket_up&module=basket&id=' - .$baskets[$i]->__get('basket_id'); - ?>" title="<?php - echo _GO_MANAGE_BASKET; - ?>"><i><?php - echo _GO_MANAGE_BASKET; - ?></i></a> - <?php - } - ?> - </td> - </tr> - <?php - } - ?> - </tbody> - </table> - <br/> - <br/> - </div> - </div> - <?php - } - } - ?><div id="access"></div> - </div> - <div class="block" style="float:left;width:60%;"> - <form id="formgroup" method="post" class="forms" action="<?php - echo $_SESSION['config']['businessappurl'] - ."index.php?display=true&admin=groups&page=usergroups_management_controler&mode=" - .$mode - ?>" > - <div> - <input type="hidden" name="display" value="true" /> - <input type="hidden" name="admin" value="groups" /> - <input type="hidden" name="page" value="usergroups_management_controler" /> - <input type="hidden" name="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']); - } - ?>" /> - - <h2><table border="0" summary=""> - <tr> - <td align="left"> - <?php echo _GROUP;?> : - </td> - <td align="left"> - <?php - if ($mode == 'up') { - functions::xecho($_SESSION['m_admin']['groups']['group_id']); - } - ?> - <input name="group_id" type="<?php - if ($mode == 'up') { - ?>hidden<?php - } else if ($mode == 'add') { - ?>text<?php - } - ?>" id="group_id" value="<?php - functions::xecho($_SESSION['m_admin']['groups']['group_id']); - ?>" /> - <input type="hidden" name="id" value="<?php - if (isset($groupId)) { - functions::xecho($groupId); - } - ?>" /> - </td> - </tr> - <tr> - <td align="right"> - <?php echo _DESC;?> : - </td> - <td align="left"> - <input name="desc" id="desc" class="text" type="text" value="<?php - if (isset($_SESSION['m_admin']['groups']['group_desc'])) { - functions::xecho($_SESSION['m_admin']['groups']['group_desc']); - } - ?>" alt="<?php - if (isset($_SESSION['m_admin']['groups']['group_desc'])) { - functions::xecho($_SESSION['m_admin']['groups']['group_desc']); - } - ?>" title="<?php - if (isset($_SESSION['m_admin']['groups']['group_desc'])) { - functions::xecho($_SESSION['m_admin']['groups']['group_desc']); - } - ?>"/> - </td> - </tr> - </table></h2> - <br/> - <div class="center_text"> - <i><?php echo _AVAILABLE_SERVICES;?> :</i> - <a href="#" onclick="checkAll();" ><?php echo _CHECK_ALL;?></a> - <a href="#" onclick="unCheckAll();" ><?php echo _UNCHECK_ALL;?></a> - </div> - <?php - $enabledServicesSortByParent = array(); - $j = 0; - - for ($i = 0; $i < count($_SESSION['enabled_services']); $i ++) { - if ($i > 0 - && $_SESSION['enabled_services'][$i]['parent'] <> $_SESSION['enabled_services'][$i - 1]['parent'] - ) { - $j = 0; - } - if ($_SESSION['enabled_services'][$i]['system'] == false) { - $enabledServicesSortByParent[$_SESSION['enabled_services'][$i]['parent']][$j] = $_SESSION['enabled_services'][$i]; - $j ++; - } - } - $_SESSION['cpt'] = 0; - foreach (array_keys($enabledServicesSortByParent) as $value) { - if ($value == 'application') { - $label = _APPS_COMMENT; - } else if ($value == 'core') { - $label = _CORE_COMMENT; - } else { - $label = $_SESSION['modules_loaded'][$value]['comment']; - } - if (count($enabledServicesSortByParent[$value]) > 0) { - ?> - <h5 onclick="change(<?php - echo $_SESSION['cpt']; - ?>)" id="h2<?php - echo $_SESSION['cpt']; - ?>" class="categorie" onmouseover="this.style.cursor='pointer';"> - <img src="<?php - echo $_SESSION['config']['businessappurl']; - ?>static.php?filename=plus.png" alt="" /> <b><?php - functions::xecho($label); - ?></b> - <span class="lb1-details"> </span> - </h5><br/> - <div class="desc block_light admin" id="desc<?php - functions::xecho($_SESSION['cpt']); - ?>" style="display:none"> - <div class="ref-unit"> - <table summary=""> - <?php - for ($i = 0; $i < count($enabledServicesSortByParent[$value]); - $i ++ - ) { - if ((isset($enabledServicesSortByParent[$value][$i]['system']) - && $enabledServicesSortByParent[$value][$i]['system'] == false) - || !isset($enabledServicesSortByParent[$value][$i]['system']) - ) { - ?> - <tr> - <td style="width:800px;" align="right" title="<?php - functions::xecho($enabledServicesSortByParent[$value][$i]['comment']); - ?>"> - <?php - functions::xecho($enabledServicesSortByParent[$value][$i]['label']); - if ($enabledServicesSortByParent[$value][$i]['type'] == "admin") { - ?> (<?php - echo _ADMIN; - ?>) <?php - } else if ($enabledServicesSortByParent[$value][$i]['type'] == "menu") { - ?> (<?php - echo _MENU; - ?>)<?php - } - ?> : - </td> - <td style="width:50px;" align="left"> - <input type="checkbox" class="check" name="services[]" value="<?php - functions::xecho($enabledServicesSortByParent[$value][$i]['id']);?>" <?php - if (in_array( - trim( - $enabledServicesSortByParent[$value][$i]['id'] - ), $_SESSION['m_admin']['groups']['services'] - ) || $mode == "add" - ) { - echo 'checked="checked"'; - } - ?> /> - </td> - </tr> - <?php - } - } - ?> - </table> - </div> - </div> - <?php - } - $_SESSION['cpt']++; - } - ?> - <p class="buttons"> - <input type="submit" name="group_submit" id="group_submit" value="<?php - echo _VALIDATE; - ?>" class="button"/> - <input type="button" class="button" name="cancel" value="<?php - echo _CANCEL; - ?>" onclick="javascript:window.location.href='<?php - echo $_SESSION['config']['businessappurl']; - ?>index.php?page=usergroups_management_controler&mode=list&admin=groups';"/> - </p> - </div> - </form> - </div> - </div> - <script type="text/javascript">updateContent('<?php - echo $_SESSION['config']['businessappurl']; - ?>index.php?display=true&page=groups_form&admin=groups', 'access');</script> - <?php - } -} - diff --git a/apps/maarch_entreprise/admin/groups/usergroups_management_controler.php b/apps/maarch_entreprise/admin/groups/usergroups_management_controler.php deleted file mode 100755 index 95eb90a20951e62664a0395861d0d772e86a118e..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/groups/usergroups_management_controler.php +++ /dev/null @@ -1,734 +0,0 @@ -<?php -$GLOBALS['basket_loaded'] = false; -$GLOBALS['entities_loaded'] = false; -$func = new functions(); -$core = new core_tools(); -$core_tools = new core_tools(); - -$core_tools->test_admin('admin_groups', 'apps'); - -if ($core->is_module_loaded('basket')) { - $GLOBALS['basket_loaded'] = true; -} -if ($core->is_module_loaded('entities')) { - $GLOBALS['entities_loaded'] = true; -} - -$mode = 'add'; -if (isset($_REQUEST['mode']) && ! empty($_REQUEST['mode'])) { - $mode = $_REQUEST['mode']; -} - -try { - require_once 'core/class/usergroups_controler.php'; - require_once 'core/class/users_controler.php'; - require_once 'core/class/SecurityControler.php'; - require_once 'core/class/class_security.php'; - if ($mode == 'list') { - require_once 'core/class/class_request.php'; - require_once 'apps' . DIRECTORY_SEPARATOR - . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR . 'class' - . DIRECTORY_SEPARATOR . 'class_list_show.php'; - } - if ($GLOBALS['basket_loaded']) { - require_once 'modules/basket/class/BasketControler.php'; - } - if ($mode == 'del' && $GLOBALS['entities_loaded']) { - require_once 'modules/entities/class/EntityControler.php'; - } - -} catch (Exception $e){ - functions::xecho($e->getMessage()); -} - -$core->load_lang(); - -if (isset($_REQUEST['id']) && ! empty($_REQUEST['id'])) { - $groupId = $_REQUEST['id']; -} - -if (isset($_REQUEST['group_submit'])) { - // Action to do with db - validateGroupSubmit(); - -} else { - // Display to do - $users = array(); - $baskets = array(); - $access = array(); - $services = array(); - $state = true; - switch ($mode) { - case "up" : - $res = displayUp($groupId); - $state = $res['state']; - $users = $res['users']; - $baskets = $res['baskets']; - $access = $res['access']; - $services = $res['services']; - locationBarManagement($mode); - break; - case "add" : - displayAdd(); - locationBarManagement($mode); - break; - case "del" : - displayDel($groupId); - break; - case "allow" : - displayEnable($groupId); - break; - case "ban" : - displayDisable($groupId); - break; - case "list" : - $groupsList = displayList(); - locationBarManagement($mode); - break; - case "check_del" : - displayDelCheck($groupId); - break; - } - include('usergroups_management.php'); -} - -///////////// FUNCTIONS -/** - * Management of the location bar - */ -function locationBarManagement($mode) -{ - $pageLabels = array( - 'add' => _ADDITION, - 'up' => _MODIFICATION, - 'list' => _GROUPS_LIST, - ); - $pagesIds = array( - 'add' => 'group_add', - 'up' => 'group_up', - 'list' => 'groups_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=' - . 'usergroups_management_controler&admin=groups&mode=' . $mode; - $pageLabel = $pageLabels[$mode]; - $pageId = $pagesIds[$mode]; - $core = new core_tools(); - $core->manage_location_bar($pagePath, $pageLabel, $pageId, $init, $level); -} - - -function initSession() -{ - $_SESSION['m_admin']['groups'] = array( - 'group_id' => '', - 'group_desc' => '', - 'security' => array(), - 'services' => array(), - 'init' => false, - 'load_security' => true, - 'load_services' => true, - ); -} - -function transformSecurityObjectIntoArray($security) -{ - if (! isset($security)) { - return array(); - } - - $securityId = $security->__get('security_id'); - $groupId = $security->__get('group_id'); - $comment = $security->__get('maarch_comment'); - $collId = $security->__get('coll_id'); - $where = $security->__get('where_clause'); - $target = $security->__get('where_target'); - $startDate = $security->__get('mr_start_date'); - $stopDate = $security->__get('mr_stop_date'); - $rightsBitmask = $security->__get('rights_bitmask'); - $sec = new security(); - $ind = $sec->get_ind_collection($collId); - - return array( - 'SECURITY_ID' => $securityId , - 'GROUP_ID' => $groupId, - 'COLL_ID' => $collId, - 'IND_COLL_SESSION' => $ind, - 'WHERE_CLAUSE' => $where, - 'COMMENT' => $comment, - 'WHERE_TARGET' => $target, - 'START_DATE' => $startDate, - 'STOP_DATE' => $stopDate, - 'RIGHTS_BITMASK' => $rightsBitmask - ); -} - -function transformArrayOfSecurityObject($securityArray){ - $res = array(); - for ($i = 0; $i < count($securityArray); $i ++) { - array_push($res, transformSecurityObjectIntoArray($securityArray[$i])); - } - return $res; -} - -/** - * Initialize session parameters for update display - * @param Long $scheme_id - */ -function displayUp($groupId) -{ - $core = new core_tools(); - $users = array(); - $baskets = array(); - $access = array(); - $services = array(); - $state = true; - $ugc = new usergroups_controler(); - $uc = new users_controler(); - $group = $ugc->get($groupId); - $secCtrl = new SecurityControler(); - if (! isset($group)) { - $state = false; - } else { - putInSession('groups', $group->getArray()); - } - if ( ! isset($_SESSION['m_admin']['load_security']) - || $_SESSION['m_admin']['load_security'] == true - ) { - // Get security accesses in an array - $access = $secCtrl->getAccessForGroup($groupId); - $_SESSION['m_admin']['groups']['security'] = transformArrayOfSecurityObject($access); - $_SESSION['m_admin']['load_security'] = false ; - } - if ( ! isset($_SESSION['m_admin']['load_services']) - || $_SESSION['m_admin']['load_services'] == true - ) { - $services = $ugc->getServices($groupId); // Get services array - $_SESSION['m_admin']['groups']['services'] = $services; - $_SESSION['m_admin']['load_services'] = false ; - } - //Get all user_id of all members of the group - $usersIds = $ugc->getUsers($groupId); - // Get all basket_id linked to the group - $basketsIds = $ugc->getBaskets($groupId); - for ($i = 0; $i < count($usersIds); $i ++) { - //$tmpUser = $uc ->get($usersIds[$i]); - if (isset($usersIds)) { - array_push($users, $usersIds); - } - } - - //unset($tmpUser); - - if (isset($GLOBALS['basket_loaded']) && $GLOBALS['basket_loaded'] == true - && count($basketsIds) > 0 - ) { - $bc = new BasketControler(); - for ($i = 0; $i < count($basketsIds); $i ++) { - $tmpBasket = $bc->get($basketsIds[$i]); - if (isset($tmpBasket)) { - $baskets[] = $tmpBasket; - } - } - } - - $res['state'] = $state; - $res['users'] = $users; - $res['baskets'] = $baskets; - $res['services'] = $services; - $res['access'] = $access; - return $res; -} - -/** - * Initialize session parameters for add display with given scheme - */ -function displayAdd(){ - if ($_SESSION['m_admin']['init'] == true - || ! isset($_SESSION['m_admin']['init']) - ) { - initSession(); - } -} - -/** - * Initialize session parameters for list display - */ -function displayList(){ - $_SESSION['m_admin'] = array(); - initSession(); - $func = new functions(); - $select[USERGROUPS_TABLE] = array(); - array_push($select[USERGROUPS_TABLE], 'group_id', 'group_desc', 'enabled'); - $where = ''; - $what = ''; - $arrayPDO = array(); - if (isset($_REQUEST['what']) && ! empty($_REQUEST['what'])) { - $what = $_REQUEST['what']; - $where = "lower(group_desc) like lower(?)"; - $arrayPDO = array($what.'%'); - } - // Checking order and order_field values - $order = 'asc'; - if (isset($_REQUEST['order']) && ! empty($_REQUEST['order'])) { - $order = trim($_REQUEST['order']); - } - - $field = 'group_id'; - if (isset($_REQUEST['order_field']) && ! empty($_REQUEST['order_field'])) { - $field = trim($_REQUEST['order_field']); - } - $list = new list_show(); - $orderstr = $list->define_order($order, $field); - $request = new request(); - $arr = $request->PDOselect( - $select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'] - ); - for ($i = 0; $i < count($arr); $i ++) { - foreach ($arr[$i] as &$item) { - switch ($item['column']){ - case 'group_id': - formatItem( - $item, _ID, '18', 'left', 'left', 'bottom', true - ); - break; - case 'group_desc': - formatItem( - $item, _DESC, '50', 'left', 'left', 'bottom', true - ); - break; - case 'enabled': - formatItem( - $item, _STATUS, '6', 'center', 'center', 'bottom', true - ); - break; - } - } - } - - $autoCompletionArray = array( - 'list_script_url' => $_SESSION['config']['businessappurl'] - . 'index.php?display=true&admin=groups&page=' - . 'groups_list_by_name', - 'number_to_begin' => 1, - ); - $result = array( - 'tab' => $arr, - 'what' => $what, - 'page_name' => 'usergroups_management_controler&mode=list', - 'page_name_up' => 'usergroups_management_controler&mode=up', - 'page_name_del' => 'usergroups_management_controler&mode=del', - 'page_name_val' => 'usergroups_management_controler&mode=allow', - 'page_name_ban' => 'usergroups_management_controler&mode=ban', - 'page_name_add' => 'usergroups_management_controler&mode=add', - 'label_add' => _GROUP_ADDITION, - 'title' => _GROUPS_LIST . ' : ' . $i . ' ' . _GROUPS, - 'autoCompletionArray' => $autoCompletionArray, - ); - - $_SESSION['m_admin']['load_security'] = true; - $_SESSION['m_admin']['load_services'] = true; - $_SESSION['m_admin']['init'] = true; - - return $result; -} - -/** - * Delete given usergroup if exists and initialize session parameters - * @param unknown_type $groupId - */ -function displayDel($groupId) -{ - $ugc = new usergroups_controler(); - - //information users exists in groups - $userExists = $ugc->getUsers($groupId); - if(!empty($userExists)){ - $usersGroups=implode(",", $ugc->getUsers($groupId));?> - <script type="text/javascript">window.top.location='<?php - echo $_SESSION['config']['businessappurl'] . 'index.php?page=' - . 'usergroups_management_controler&mode=check_del&admin=groups&id=' . $groupId; - ?>';</script> - <?php exit(); } - - $group = $ugc->get($groupId); - if (isset($group) && isset($groupId) && ! empty($groupId)) { - $control = array(); - $params = array(); - if (isset($_SESSION['history']['usergroupsdel'])) { - $params['log_group_del'] = $_SESSION['history']['usergroupsdel']; - } - if (isset($_SESSION['config']['databasetype'])) { - $params['databasetype'] = $_SESSION['config']['databasetype']; - } else { - $params['databasetype'] = 'POSTGRESQL'; - } - $control = $ugc->delete($group, $params); - if ($GLOBALS['basket_loaded']) { - $bc = new BasketControler(); - $bc->cleanFullGroupbasket($groupId, 'group_id'); - } - if ($GLOBALS['entities_loaded']) { - $ec = new EntityControler(); - $ec->cleanGroupbasketRedirect($groupId, 'group_id'); - } - if (! empty($control['error']) && $control['error'] <> 1) { - $_SESSION['error'] = str_replace("#", "<br />", $control['error']); - } else { - $_SESSION['info'] = _DELETED_GROUP.' : '.$groupId; - } - - ?><script type="text/javascript">window.top.location='<?php - echo $_SESSION['config']['businessappurl'] . 'index.php?page=' - . 'usergroups_management_controler&mode=list&admin=groups&order=' - . $_REQUEST['order'] . '&order_field=' . $_REQUEST['order_field'] - . '&start=' . $_REQUEST['start'] . '&what=' . addslashes($_REQUEST['what']); - ?>';</script> - <?php - exit(); - } else { - // Error management - $_SESSION['error'] = _GROUP . ' ' . _UNKNOWN; - } -} - - -/** - * Delete given usergroup if exists and initialize session parameters - * @param unknown_type $groupId - */ -function displayDelCheck($groupId) -{ - /****************Management of the location bar ************/ - $admin = new core_tools(); - $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=types'; - $pageLabel = _DELETION; - $pageId = "types"; - $admin->manage_location_bar($pagePath, $pageLabel, $pageId, $init, $level); - /***********************************************************/ - if(isset($_POST['group_id'])){ - $old_group=$_POST['id']; - $new_group=$_POST['group_id']; - $ugc = new usergroups_controler(); - $users = $ugc->getUsers($old_group); - //$users_sql = "'".implode("','", $users)."'"; - $db = new Database(); - $db->query( - "delete from usergroup_content WHERE group_id=? AND user_id in (?)", - array($old_group, $users) - ); - if($_POST['group_id'] != 'no_group'){ - $stmt = $db->query("select * from usergroup_content WHERE group_id = ?", array($new_group)); - $usersPresentInGroup = []; - while($res = $stmt->fetchObject()) - array_push($usersPresentInGroup, $res->user_id); - foreach ($users as $key => $value) { - if (!in_array($value, $usersPresentInGroup)){ - $db->query( - "INSERT INTO usergroup_content(group_id, user_id, primary_group) values (?, ?, 'N')", - array($new_group, $value) - ); - } - } - - $_SESSION['info'] = _DELETED_GROUP.' : '.$old_group; - } ?> - <script type="text/javascript">window.top.location='<?php - echo $_SESSION['config']['businessappurl'] . 'index.php?page=' - . 'usergroups_management_controler&mode=del&admin=groups&id=' . $groupId; - ?>';</script> <?php - } - $ugc = new usergroups_controler(); - $userExists = $ugc->getUsers($groupId); - echo '<h1><i class="fa fa-users fa-2x"></i>'._GROUP_DELETION.': <i>'.$groupId.'</i></h1>'; - echo "<div class='error' id='main_error'>".$_SESSION['error']."</div>"; - $_SESSION['error'] = ""; - ?> - <br> - <div class="block"> - <div id="main_error" style="text-align:center;"> - <b><?php - echo _WARNING_MESSAGE_DEL_GROUP; - ?></b> - </div> - <br/> - <form name="entity_del" id="entity_del" style="width: 250px;margin:auto;" method="post" class="forms"> - <input type="hidden" value="<?php functions::xecho($groupId);?>" name="id"> - <?php - - echo "<h3>".count($userExists)." "._USERS_IN_GROUPS .":</h3>"; - echo "<ul>"; - foreach ($userExists as $key => $value) { - echo "<li>".$value."</li>"; - } - echo "</ul>"; - ?> - <br> - <br> - <select name="group_id" id="group_id" onchange=''> - <option value="no_group"><?php echo _NO_REPLACEMENT;?></option> - <?php - $db = new Database(); - $stmt = $db->query("select * from usergroups order by group_desc ASC"); - while($groups = $stmt->fetchObject()) - { - if($groups->group_id != $groupId){ - ?> - <option value="<?php functions::xecho($groups->group_id);?>"><?php functions::xecho($groups->group_desc);?></option> - <?php - } - - } - ?> - </select> - <p class="buttons"> - <input type="submit" value="<?php echo _DEL_AND_REAFFECT;?>" name="valid" class="button" onclick='if(document.getElementById("doc_type_id").options[document.getElementById("doc_type_id").selectedIndex].value == ""){alert("<?php echo _CHOOSE_REPLACEMENT_DOCTYPES ?> !");return false;}else{return(confirm("<?php echo _REALLY_DELETE.$s_id;?> \n\r\n\r<?php echo _DEFINITIVE_ACTION?>"));}'/> - <input type="button" value="<?php echo _CANCEL;?>" class="button" onclick="window.location.href='<?php echo $_SESSION['config']['businessappurl'] ?>index.php?page=usergroups_management_controler&mode=list&admin=groups&order=<?php functions::xecho($_REQUEST['order']);?>&order_field=<?php functions::xecho($_REQUEST['order_field']);?>&start=<?php functions::xecho($_REQUEST['start']);?>&what=<?php functions::xecho($_REQUEST['what']);?>';"/> - </p> - </form> - </div> - <script type="text/javascript"></script> - <?php - exit(); -} - -/** - * Enable given usergroup if exists and initialize session parameters - * @param unknown_type $user_id - */ -function displayEnable($groupId) -{ - - $ugc = new usergroups_controler(); - $group = $ugc->get($groupId); - if (isset($group)) { - $control = array(); - $params = array(); - if (isset($_SESSION['history']['usergroupsval'])) { - $params['log_group_enabled'] = $_SESSION['history']['usergroupsval']; - } - if (isset($_SESSION['config']['databasetype'])) { - $params['databasetype'] = $_SESSION['config']['databasetype']; - } else { - $params['databasetype'] = 'POSTGRESQL'; - } - $control = $ugc->enable($group, $params); - if ( ! empty($control['error']) && $control['error'] <> 1) { - $_SESSION['error'] = str_replace("#", "<br />", $control['error']); - } else { - $_SESSION['info'] = _AUTORIZED_GROUP.' : '.$groupId; - } - $url = $_SESSION['config']['businessappurl'] . 'index.php?page=' - . 'usergroups_management_controler&mode=list&admin=groups&order=' - . $_REQUEST['order'] . '&order_field=' . $_REQUEST['order_field'] - . '&start=' . $_REQUEST['start'] . '&what=' . $_REQUEST['what']; - ?><script type="text/javascript">window.top.location='<?php functions::xecho($url);?>';</script> - <?php - exit(); - } else { - // Error management - $_SESSION['error'] = _GROUP.' '._UNKNOWN; - } -} - -/** - * Disable given user if exists and initialize session parameters - * @param unknown_type $user_id - */ -function displayDisable($groupId) -{ - $ugc = new usergroups_controler(); - $group = $ugc->get($groupId); - if (isset($group)) { - $control = array(); - $params = array(); - if (isset($_SESSION['history']['usergroupsban'])) { - $params['log_group_disabled'] = $_SESSION['history']['usergroupsban']; - } - if (isset($_SESSION['config']['databasetype'])) { - $params['databasetype'] = $_SESSION['config']['databasetype']; - } else { - $params['databasetype'] = 'POSTGRESQL'; - } - - $control = $ugc->disable($group, $params); - if (! empty($control['error']) && $control['error'] <> 1) { - $_SESSION['error'] = str_replace("#", "<br />", $control['error']); - } else { - $_SESSION['info'] = _SUSPENDED_GROUP.' : '.$groupId; - } - $url = $_SESSION['config']['businessappurl'] . 'index.php?page=' - . 'usergroups_management_controler&mode=list&admin=groups&order=' - . $order . '&order_field=' . $orderField . '&start=' . $start - . '&what=' . $what; - ?><script type="text/javascript">window.top.location='<?php functions::xecho($url);?>';</script> - <?php - exit(); - } else { - // Error management - $_SESSION['error'] = _GROUP . ' ' . _UNKNOWN; - } -} - -/** - * Format given item with given values, according with HTML formating. - * NOTE: given item needs to be an array with at least 2 keys: - * 'column' and 'value'. - * NOTE: given item is modified consequently. - * @param $item - * @param $label - * @param $size - * @param $labelAlign - * @param $align - * @param $valign - * @param $show - */ -function formatItem(&$item, $label, $size, $labelAlign, $align, $valign, $show, - $order= true) -{ - $func = new functions(); - $item['value'] = $func->show_string($item['value']); - $item[$item['column']] = $item['value']; - $item['label'] = $label; - $item['size'] = $size; - $item['label_align'] = $labelAlign; - $item['align'] = $align; - $item['valign'] = $valign; - $item['show'] = $show; - if ($order) { - $item['order'] = $item['value']; - } else { - $item['order' ]= ''; - } -} - -/** - * Validate a submit (add or up), - * up to saving object - */ -function validateGroupSubmit() -{ - $ugc = new usergroups_controler(); - $pageName = 'usergroups_management_controler'; - $group = new usergroups(); - $mode = $_REQUEST['mode']; - - $group->group_id = $_REQUEST['group_id']; - if (isset($_REQUEST['desc']) && ! empty($_REQUEST['desc'])) { - $group->group_desc = $_REQUEST['desc']; - } - - $status = array( - 'order' => $_REQUEST['order'], - 'order_field' => $_REQUEST['order_field'], - 'what' => $_REQUEST['what'], - 'start' => $_REQUEST['start'], - ); - - $control = array(); - $params = array( - 'modules_services' => $_SESSION['modules_services'], - 'log_group_up' => $_SESSION['history']['usergroupsup'], - 'log_group_add' => $_SESSION['history']['usergroupsadd'], - 'databasetype' => $_SESSION['config']['databasetype'], - 'user_id' => $_SESSION['user']['UserId'] - ); - - $services = array(); - if (isset($_REQUEST['services'])) { - $services = $_REQUEST['services']; - } - if (isset($_SESSION['m_admin']['groups']['security'])) { - $control = $ugc->save( - $group, $_SESSION['m_admin']['groups']['security'], $services, - $mode, $params - ); - } - if (! empty($control['error']) && $control['error'] <> 1) { - // Error management depending of mode - $_SESSION['error'] = str_replace("#", "<br />", $control['error']); - putInSession('status', $status); - putInSession('groups', $group->getArray()); - - switch ($mode) { - case 'up': - if (! empty($group->group_id)) { - header( - 'location: ' . $_SESSION['config']['businessappurl'] - . 'index.php?page=' . $pageName . '&mode=up&id=' - . $group->group_id . '&admin=groups' - ); - } else { - header( - 'location: ' . $_SESSION['config']['businessappurl'] - . 'index.php?page=' . $pageName . '&mode=list&admin=' - . 'groups&order=' . $status['order'] . '&order_field=' - . $status['order_field'] . '&start=' . $status['start'] - . '&what=' . $status['what'] - ); - } - exit; - case 'add': - $_SESSION['m_admin']['load_group'] = false; - header( - 'location: ' . $_SESSION['config']['businessappurl'] - . 'index.php?page=' . $pageName . '&mode=add&admin=groups' - ); - exit; - } - } else { - if ($mode == 'add') { - $_SESSION['info'] = _GROUP_ADDED; - } else { - $_SESSION['info'] = _GROUP_UPDATED; - } - unset($_SESSION['m_admin']); - header( - 'location: ' . $_SESSION['config']['businessappurl'] - . 'index.php?page=' . $pageName . '&mode=list&admin=groups&order=' - . $status['order'] . '&order_field=' . $status['order_field'] - . '&start=' . $status['start'] . '&what=' . $status['what'] - ); - } -} - -/** - * Put given object in session, according with given type - * NOTE: given object needs to be at least hashable - * @param string $type - * @param hashable $hashable - */ -function putInSession($type, $hashable, $showString = true) -{ - $func = new functions(); - foreach ($hashable as $key => $value) { - if ($showString) { - $_SESSION['m_admin'][$type][$key] = $func->show_string($value); - } else { - $_SESSION['m_admin'][$type][$key] = $value; - } - } -} -//////////////////////////////////////// - diff --git a/apps/maarch_entreprise/admin/history/history.php b/apps/maarch_entreprise/admin/history/history.php deleted file mode 100755 index 92c5c804e728125b8e8db0377c57f4d30700e6b0..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/history/history.php +++ /dev/null @@ -1,346 +0,0 @@ -<?php -/** -* Copyright Maarch since 2008 under licence GPLv3. -* See LICENCE.txt file at the root folder for more details. -* This file is part of Maarch software. - -* -* @brief history -* -* @author dev <dev@maarch.org> -* @ingroup apps -*/ -require_once 'apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_list_show.php'; -require_once 'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_request.php'; -$core_tools2 = new core_tools(); -$core_tools2->test_admin('view_history', 'apps'); -/****************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=history&admin=history'; -$page_label = _VIEW_HISTORY2; -$page_id = 'history'; -$core_tools2->manage_location_bar($page_path, $page_label, $page_id, $init, $level); -/***********************************************************/ -$db = new Database(); - -$where = ''; -$arrayPDO = array(); -$label = ''; -$tab = array(); -$modules = array(); - -function cmp($a, $b) -{ - return strcmp(strtolower($a['label']), strtolower($b['label'])); -} - -usort($_SESSION['history_keywords'], 'cmp'); -$history_action = ''; -$history_user = ''; -$history_module = ''; -$history_datefin = ''; -$history_datestart = ''; -$req = new request(); - -if (isset($_REQUEST['search']) || -(isset($_SESSION['m_admin']['history']['action']) && !empty($_SESSION['m_admin']['history']['action'])) || -(isset($_SESSION['m_admin']['history']['user']) && !empty($_SESSION['m_admin']['history']['user'])) || -(isset($_SESSION['m_admin']['history']['module']) && !empty($_SESSION['m_admin']['history']['module'])) || -(isset($_SESSION['m_admin']['history']['datefin']) && !empty($_SESSION['m_admin']['history']['datefin'])) || -(isset($_SESSION['m_admin']['history']['datestart']) && !empty($_SESSION['m_admin']['history']['datestart'])) -) { - $pattern = '/^[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]$/'; - $_SESSION['chosen_user'] = ''; - if ((isset($_REQUEST['action'])) || (isset($_SESSION['m_admin']['history']['action']) && !empty($_SESSION['m_admin']['history']['action']))) { - if (isset($_REQUEST['action'])) { - $history_action = $_REQUEST['action']; - $_SESSION['m_admin']['history']['action'] = $history_action; - } else { - $history_action = $_SESSION['m_admin']['history']['action']; - } - if (!empty($history_action)) { - $where .= ' '.$_SESSION['tablename']['history'].'.event_type = ? and '; - $arrayPDO = array_merge($arrayPDO, array($history_action)); - } - } - - if (isset($_REQUEST['user']) || (isset($_SESSION['m_admin']['history']['user']) && !empty($_SESSION['m_admin']['history']['user']))) { - if (isset($_REQUEST['user'])) { - $history_user = $_REQUEST['user']; - $_SESSION['m_admin']['history']['user'] = $history_user; - } else { - $history_user = $_SESSION['m_admin']['history']['user']; - } - if (!empty($history_user)) { - $tmp = str_replace(')', '', substr($history_user, strrpos($history_user, '(') + 1)); - $where .= ' '.$_SESSION['tablename']['history'].'.user_id = ? and'; - $arrayPDO = array_merge($arrayPDO, array($tmp)); - } - } - if (isset($_REQUEST['module']) || (isset($_SESSION['m_admin']['history']['module']) && !empty($_SESSION['m_admin']['history']['module']))) { - if (isset($_REQUEST['module'])) { - $history_module = $_REQUEST['module']; - $_SESSION['m_admin']['history']['module'] = $history_module; - } else { - $history_module = $_SESSION['m_admin']['history']['module']; - } - if (!empty($history_module)) { - $where .= ' lower('.$_SESSION['tablename']['history'].'.id_module) = lower(?) and'; - $arrayPDO = array_merge($arrayPDO, array($history_module)); - } - } - if (isset($_REQUEST['datestart']) || (isset($_SESSION['m_admin']['history']['datestart']) && !empty($_SESSION['m_admin']['history']['datestart']))) { - if (isset($_REQUEST['datestart'])) { - $_SESSION['m_admin']['history']['datestart'] = $_REQUEST['datestart']; - } - - if (preg_match($pattern, $_SESSION['m_admin']['history']['datestart']) == false) { - $_SESSION['error'] = _DATE.' '._WRONG_FORMAT; - } else { - //if ($_SESSION['config']['databasetype'] == "POSTGRESQL") { - $history_datestart = $_SESSION['m_admin']['history']['datestart']; - //} else { - // $history_datestart = str_replace('-','', $_SESSION['m_admin']['history']['datestart']); - //} - $where .= ' ('.$req->extract_date($_SESSION['tablename']['history'].'.event_date').' >= ?) and '; - $arrayPDO = array_merge($arrayPDO, array($history_datestart)); - } - } - if (isset($_REQUEST['datefin']) || (isset($_SESSION['m_admin']['history']['datefin']) && !empty($_SESSION['m_admin']['history']['datefin']))) { - if (isset($_REQUEST['datefin'])) { - $_SESSION['m_admin']['history']['datefin'] = $_REQUEST['datefin']; - } - if (preg_match($pattern, $_SESSION['m_admin']['history']['datefin']) == false) { - $_SESSION['error'] = _DATE.' '._WRONG_FORMAT; - } else { - //if ($_SESSION['config']['databasetype'] == "POSTGRESQL") { - $history_datefin = $_SESSION['m_admin']['history']['datefin']; - //} else { - // $history_datefin = str_replace('-','', $_SESSION['m_admin']['history']['datefin']); - //} - $where .= ' ('.$req->extract_date($_SESSION['tablename']['history'].'.event_date').' <= ?) and '; - $arrayPDO = array_merge($arrayPDO, array($history_datefin)); - } - } - $where = trim($where); - $where = preg_replace('/and$/', '', $where); -} - -$select[$_SESSION['tablename']['history']] = array(); -array_push($select[$_SESSION['tablename']['history']], 'id', 'event_date', 'user_id', 'table_name', 'record_id', 'event_type', 'info', 'id_module'); -$select[$_SESSION['tablename']['users']] = array(); -array_push($select[$_SESSION['tablename']['users']], 'lastname', 'firstname'); -$list = new list_show(); -if (isset($_REQUEST['order']) && !empty($_REQUEST['order'])) { - $order = trim($_REQUEST['order']); -} else { - $order = 'desc'; - $_REQUEST['order'] = 'desc'; -} -$field = 'event_date'; -if (isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) { - $field = trim($_REQUEST['order_field']); -} -$orderstr = $list->define_order($order, $field); -$tab = $req->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], $limit = '500', true, $_SESSION['tablename']['history'], $_SESSION['tablename']['users'], 'user_id'); - -$tmpIdModuleComp = []; -for ($i = 0; $i < count($tab); ++$i) { - for ($j = 0; $j < count($tab[$i]); ++$j) { - foreach (array_keys($tab[$i][$j]) as $value) { - if ($tab[$i][$j][$value] == 'id') { - $tab[$i][$j]['id'] = $tab[$i][$j]['value']; - $tab[$i][$j]['show'] = false; - } - if ($tab[$i][$j][$value] == 'event_date') { - $tab[$i][$j]['value'] = $req->dateformat($tab[$i][$j]['value'], '-'); - $tab[$i][$j]['label'] = _DATE; - $tab[$i][$j]['size'] = '17'; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = true; - $tab[$i][$j]['order'] = 'event_date'; - } - if ($tab[$i][$j][$value] == 'user_id') { - $tab[$i][$j]['user_id'] = $tab[$i][$j]['value']; - $tab[$i][$j]['label'] = _USERS; - $tab[$i][$j]['size'] = '10'; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = true; - $tab[$i][$j]['order'] = 'user_id'; - } - if ($tab[$i][$j][$value] == 'table_name') { - $tab[$i][$j]['table_name'] = $tab[$i][$j]['value']; - $tab[$i][$j]['label'] = _TABLE; - $tab[$i][$j]['size'] = '10'; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = true; - $tab[$i][$j]['order'] = 'table_name'; - } - if ($tab[$i][$j][$value] == 'record_id') { - $tab[$i][$j]['record_id'] = $tab[$i][$j]['value']; - $tab[$i][$j]['label'] = _ID; - $tab[$i][$j]['size'] = '10'; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = true; - $tab[$i][$j]['order'] = 'record_id'; - } - if ($tab[$i][$j][$value] == 'event_type') { - $tab[$i][$j]['value'] = $this->show_string($tab[$i][$j]['value']); - $tab[$i][$j]['event_type'] = $tab[$i][$j]['value']; - $tab[$i][$j]['label'] = _ACTION; - $tab[$i][$j]['size'] = '8'; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = true; - $tab[$i][$j]['order'] = 'event_type'; - } - if ($tab[$i][$j][$value] == 'info') { - $tab[$i][$j]['value'] = $this->show_string($tab[$i][$j]['value']); - $tab[$i][$j]['info'] = $tab[$i][$j]['value']; - $tab[$i][$j]['label'] = _COMMENTS; - $tab[$i][$j]['size'] = '65'; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = true; - $tab[$i][$j]['order'] = 'info'; - } - if ($tab[$i][$j][$value] == 'id_module' && $tab[$i][$j]['value'] != null && $tab[$i][$j]['value'] != 'null' && !empty($tab[$i][$j]['value']) && !in_array($tab[$i][$j]['value'], $tmpIdModuleComp)) { - $tmpIdModuleComp[] = $tab[$i][$j]['value']; - if ($tab[$i][$j]['value'] == 'admin') { - array_push($modules, array('id' => 'admin', 'label' => _ADMIN)); - } elseif (isset($_SESSION['modules_loaded'][$tab[$i][$j]['value']]['comment']) && !empty($_SESSION['modules_loaded'][$tab[$i][$j]['value']]['comment'])) { - array_push($modules, array('id' => $tab[$i][$j]['value'], 'label' => ucfirst($_SESSION['modules_loaded'][$tab[$i][$j]['value']]['comment']))); - } else { - array_push($modules, array('id' => $tab[$i][$j]['value'], 'label' => ucfirst(($tab[$i][$j]['value'])))); - } - } - } - } -} - -usort($modules, 'cmp'); - -if (!empty($history_module)) { - $modules = $_SESSION['m_admin']['history']['module_list']; -} else { - $_SESSION['m_admin']['history']['module_list'] = $modules; -} - -for ($i = 0; $i < count($tab); ++$i) { - for ($j = 0; $j < count($tab[$i]); ++$j) { - foreach (array_keys($tab[$i][$j]) as $value) { - if ($value == 'column' and $tab[$i][$j][$value] == 'event_type') { - $val = $core_tools2->is_var_in_history_keywords_tab($tab[$i][$j]['event_type']); - $tab[$i][$j]['value'] = $val; - } - } - } -} -$nb = count($tab); -?> -<h1><i class="fa fa-history fa-2x"> </i> <?php echo _HISTORY_TITLE.' : '.$nb.' '._RESULTS; ?></h1> -<div id="inner_content"> -<?php -$list->admin_list($tab, $nb, ' ', 'id', 'history', 'history', 'id', true, '', '', '', '', '', '', true, false, '', '', '', false, false); -?> -<br/> -<div id="search_hist" class="block"> -<form id ="frm_search_hist" style="position:relative;" action="<?php echo $_SESSION['config']['businessappurl']; ?>index.php?page=history&admin=history" method="post" class="form"> -<div> - <input type="hidden" name="page" value="history"/> - <input type="hidden" name="admin" value="history" /> - <table border="0" width="99%" class="forms" summary=""> - <tr> - <td style="width:33%;"> - <div><label><?php echo _ACTIONS; ?> :</label> - <select name="action" id="action"> - <option value=""><?php echo _CHOOSE_ACTION; ?></option> - <?php - for ($i = 0; $i < count($_SESSION['history_keywords']); ++$i) { - ?> - <option value="<?php functions::xecho($_SESSION['history_keywords'][$i]['id']); ?>" <?php if ($history_action == $_SESSION['history_keywords'][$i]['id']) { - echo 'selected="selected"'; - } ?>><?php echo $_SESSION['history_keywords'][$i]['label']; ?></option> - <?php - } - ?> - </select></div> - </td> - <td style="width:33%;"> - <div><label><?php echo _MODULES; ?> :</label> - <select name="module" id="module"> - <option value=""><?php echo _CHOOSE_MODULE; ?></option> - <?php - for ($i = 0; $i < count($modules); ++$i) { - ?> - <option value="<?php functions::xecho($modules[$i]['id']); ?>" <?php if ($history_module == $modules[$i]['id']) { - echo 'selected="selected"'; - } ?>><?php functions::xecho($modules[$i]['label']); ?></option> - <?php - } - ?> - </select></div> - </td> - <td style="width:33%;"> - <div> <label><?php echo _USER; ?> :</label> - <input type="text" name="user" id="user" value="<?php if (isset($history_user)) { - functions::xecho($history_user); - }?>" /><div id="show_user" class="autocomplete" style="position: relative; left:227px; top: 1px; width: 199.667px;"></div> - </div> - </td> - </tr> - </table> - <table border="0" width="99%" class="forms" summary=""> - <tr> - <td> - <p><span><?php echo _SINCE; ?> :</span> <input name="datestart" type="text" id="datestart" onclick='showCalender(this);' value="<?php if (isset($history_datestart)) { - functions::xecho($history_datestart); - }?>" /> - </p> - </td> - <td colspan="2"> - <p> - <span ><?php echo _FOR; ?> :</span> <input name="datefin" type="text" id="datefin" onclick="showCalender(this);" value="<?php if (isset($history_datefin)) { - functions::xecho($history_datefin); - }?>" /> - </p> - </td> - </tr> - <tr> - <td colspan="2" align="left"> - <p> - <input type="submit" name="search" value="<?php echo _SEARCH; ?>" class="button" /> - <input type="button" class="button" name="cancel" value="<?php echo _CANCEL; ?>" onclick="javascript:window.location.href='<?php echo $_SESSION['config']['businessappurl']; ?>index.php?page=admin';"/> - </p> - </td> - <td align="center"> - <a href="#" onclick="clear_form('frm_search_hist');$('frm_search_hist').submit();"> - <i class="fa fa-refresh fa-2x" title="<?php echo _CLEAR_FORM; ?>"></i> - </a> - </td> - </tr> - </table> -</div> -</form> -</div> -<div class="block_end"> </div> -<br/> -</div> -<script type="text/javascript">launch_autocompleter('<?php echo $_SESSION['config']['businessappurl']; ?>index.php?display=true&page=users_autocomplete_list&getDisableUser', 'user', 'show_user');</script> diff --git a/apps/maarch_entreprise/admin/history_batch/history_batch.php b/apps/maarch_entreprise/admin/history_batch/history_batch.php deleted file mode 100755 index f6792c92b55c455422da25920f75ce442a76edb4..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/history_batch/history_batch.php +++ /dev/null @@ -1,279 +0,0 @@ -<?php - -/** -* Copyright Maarch since 2008 under licence GPLv3. -* See LICENCE.txt file at the root folder for more details. -* This file is part of Maarch software. -* -*/ - -require_once 'apps/' . $_SESSION['config']['app_id'] . '/class/class_list_show.php'; -require_once 'core/class/class_request.php'; - -$core_tools2 = new core_tools(); -$core_tools2->test_admin('view_history_batch', 'apps'); -/****************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=' . 'history_batch&admin=history_batch'; -$page_label = _VIEW_HISTORY_BATCH2; -$page_id = 'history_batch'; -$core_tools2->manage_location_bar( - $page_path, $page_label, $page_id, $init, $level -); -/***********************************************************/ -$db = new Database(); - -$where = ''; -$arrayPDO = array(); -$label = ''; -$tab = array(); -$modules = array(); -$stmt = $db->query('SELECT DISTINCT module_name FROM history_batch'); - -while ($res = $stmt->fetchObject()) { - if ($res->module_name == 'admin') { - array_push( - $modules, array( - 'id' => 'admin', - 'label' => _ADMIN - ) - ); - } elseif (isset($_SESSION['modules_loaded'][$res->module_name]['comment']) - && !empty($_SESSION['modules_loaded'][$res->module_name]['comment'])) { - array_push( - $modules, array( - 'id' => $res->module_name, - 'label' => $_SESSION['modules_loaded'][$res->module_name]['comment'] - ) - ); - } else { - array_push( - $modules, array( - 'id' => $res->module_name, - 'label' => $res->module_name - ) - ); - } -} - -$pattern = '/^[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]$/'; - -if ($_REQUEST['module'] == 'no_module') { - $_SESSION['m_admin']['history_batch_module'] = ""; -} elseif (!empty($_REQUEST['module']) || !empty($_SESSION['m_admin']['history_batch_module'])) { - if (!empty($_REQUEST['module'])) { - $_SESSION['m_admin']['history_batch_module'] = $_REQUEST['module']; - } - $where .= ' module_name = ? and'; - $arrayPDO = array_merge($arrayPDO, array($_SESSION['m_admin']['history_batch_module'])); -} - -if (!empty($_REQUEST['onlyerrors']) || !empty($_SESSION['m_admin']['onlyerrors'])) { - if (!empty($_REQUEST['onlyerrors'])) { - $_SESSION['m_admin']['onlyerrors'] = $_REQUEST['onlyerrors']; - } - if ($_SESSION['m_admin']['onlyerrors'] == 'yes') { - $where .= " total_errors > 0 and"; - } -} - -if (isset($_REQUEST['datestart']) && $_REQUEST['datestart'] == "") { - $_SESSION['m_admin']['history_batch_datestart'] = ""; - $_SESSION['m_admin']['history_batch_datestart_value'] = ""; -} elseif (!empty($_REQUEST['datestart']) || !empty($_SESSION['m_admin']['history_batch_datestart'])) { - if (preg_match($pattern, $_REQUEST['datestart']) == false - && (!isset($_SESSION['m_admin']['history_batch_datestart']) || empty($_SESSION['m_admin']['history_batch_datestart'])) - ) { - $_SESSION['error'] = _DATE . ' ' . _WRONG_FORMAT; - } else { - if (!empty($_REQUEST['datestart'])) { - $_SESSION['m_admin']['history_batch_datestart_value'] = $_REQUEST['datestart']; - $_SESSION['m_admin']['history_batch_datestart'] = $core_tools2->format_date_db($_REQUEST['datestart']); - } - $where .= " (event_date >= ?) and "; - $arrayPDO = array_merge($arrayPDO, array($_SESSION['m_admin']['history_batch_datestart'])); - } -} - -if (isset($_REQUEST['dateend']) && $_REQUEST['dateend'] == "") { - $_SESSION['m_admin']['history_batch_dateend'] = ""; - $_SESSION['m_admin']['history_batch_dateend_value'] = ""; -} elseif (!empty($_REQUEST['dateend']) || !empty($_SESSION['m_admin']['history_batch_dateend'])) { - if (preg_match($pattern, $_REQUEST['dateend']) == false - && (!isset($_SESSION['m_admin']['history_batch_dateend']) || empty($_SESSION['m_admin']['history_batch_dateend'])) - ) { - $_SESSION['error'] = _DATE . ' ' . _WRONG_FORMAT; - } else { - if (!empty($_REQUEST['dateend'])) { - $_SESSION['m_admin']['history_batch_dateend_value'] = $_REQUEST['dateend']; - $_SESSION['m_admin']['history_batch_dateend'] = $core_tools2->format_date_db($_REQUEST['dateend']); - } - $where .= " (event_date <= ?) and "; - $arrayPDO = array_merge($arrayPDO, array($_SESSION['m_admin']['history_batch_dateend'])); - } -} - -$where = trim($where); -$where = preg_replace('/and$/', '', $where); - -$select['history_batch'] = array(); -array_push( - $select['history_batch'], 'id', 'event_date', - 'batch_id', 'module_name', 'total_processed', 'total_errors', 'info' -); - -$list = new list_show(); -$order = 'desc'; -if (isset($_REQUEST['order']) && ! empty($_REQUEST['order'])) { - $order = trim($_REQUEST['order']); -} -$field = 'event_date'; -if (isset($_REQUEST['order_field']) && ! empty($_REQUEST['order_field'])) { - $field = trim($_REQUEST['order_field']); -} - -$orderstr = $list->define_order($order, $field); - -$req = new request(); -$tab = $req->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], '500', false, 'history_batch'); - -$countTab = count($tab); -for ($i = 0; $i < $countTab; $i ++) { - for ($j = 0; $j < count($tab[$i]); $j ++) { - foreach (array_keys($tab[$i][$j]) as $value) { - if ($tab[$i][$j][$value] == 'id') { - $tab[$i][$j]['id'] = $tab[$i][$j]['value']; - $tab[$i][$j]['show'] = false; - } - if ($tab[$i][$j][$value] == 'event_date') { - $tab[$i][$j]['value'] = $core_tools2->format_date_db($tab[$i][$j]["value"], false, '', true); - $tab[$i][$j]['event_date'] = $tab[$i][$j]['value']; - $tab[$i][$j]['label'] = _DATE; - $tab[$i][$j]['size'] = '12'; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = true; - $tab[$i][$j]['order'] = 'event_date'; - } - if ($tab[$i][$j][$value] == 'module_name') { - $tab[$i][$j]['batch_id'] = $tab[$i][$j]['value']; - $tab[$i][$j]['label'] = _BATCH_NAME; - $tab[$i][$j]['size'] = '10'; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = true; - $tab[$i][$j]['order'] = 'module_name'; - } - if ($tab[$i][$j][$value] == 'batch_id') { - $tab[$i][$j]['batch_id'] = $tab[$i][$j]['value']; - $tab[$i][$j]['label'] =_BATCH_ID; - $tab[$i][$j]['size'] = '10'; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = true; - $tab[$i][$j]['order'] = 'batch_id'; - } - if ($tab[$i][$j][$value] == 'total_processed') { - $tab[$i][$j]['value'] = $tab[$i][$j]['value']; - $tab[$i][$j]['total_processed'] = $tab[$i][$j]['value']; - $tab[$i][$j]['label'] =_TOTAL_PROCESSED; - $tab[$i][$j]['size'] = '8'; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = true; - $tab[$i][$j]['order'] = 'total_processed'; - } - if ($tab[$i][$j][$value] == 'total_errors') { - $tab[$i][$j]['value'] = $tab[$i][$j]['value']; - $tab[$i][$j]['total_processed'] = $tab[$i][$j]['value']; - $tab[$i][$j]['label'] =_TOTAL_ERRORS; - $tab[$i][$j]['size'] = '8'; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = true; - $tab[$i][$j]['order'] = 'total_errors'; - } - if ($tab[$i][$j][$value] == 'info') { - $tab[$i][$j]['value'] = $this->show_string($tab[$i][$j]['value']); - $tab[$i][$j]['info'] = $tab[$i][$j]['value']; - $tab[$i][$j]['label'] = _INFOS; - $tab[$i][$j]['size'] = '40'; - $tab[$i][$j]['label_align'] = 'left'; - $tab[$i][$j]['align'] = 'left'; - $tab[$i][$j]['valign'] = 'bottom'; - $tab[$i][$j]['show'] = true; - $tab[$i][$j]['order'] = 'info'; - } - } - } -} -$list = new list_show(); -?> -<h1><i class="fa fa-history fa-2x"></i> <?php echo _HISTORY_BATCH_TITLE.' : '. $countTab.' '._RESULTS;?></h1> -<div id="inner_content"> -<?php -$list->admin_list( - $tab, $countTab, '', 'id', 'history_batch', 'history_batch', 'id', true, '', '', - '', '', '', '', TRUE, FALSE, '', '', '', false, false -); -?> -<br/> -<div id="search_hist" class="block"> - <form name="search_hist" action="<?php - echo $_SESSION['config']['businessappurl']; - ?>index.php?page=history_batch&admin=history_batch" method="post" class="forms"> - <input type="hidden" name="page" value="history_batch"/> - <input type="hidden" name="admin" value="history_batch" /> - <p> - <label for="module"><?php echo _BATCH_NAME;?> :</label> - <select name="module"> - <option value="no_module"><?php echo _CHOOSE_BATCH;?></option> - <?php - for ($i = 0; $i < count($modules); $i ++) { - ?> - <option value="<?php functions::xecho($modules[$i]['id']); ?>" <?php if ($modules[$i]['id'] == $_SESSION['m_admin']['history_batch_module']) { - echo "selected"; - } ?> > - <?php functions::xecho($modules[$i]['label']); ?> - </option><?php - - }?> - </select> - </p> - <p> - <label for="datestart"><?php echo _SINCE;?> :</label> - <input name="datestart" type="text" id="datestart" onclick='showCalender(this);' value="<?php echo $_SESSION['m_admin']['history_batch_datestart_value'];?>"/> - </p> - <p> - <label for="dateend"><?php echo _FOR;?> :</label> - <input name="dateend" type="text" id="dateend" onclick="showCalender(this);" value="<?php echo $_SESSION['m_admin']['history_batch_dateend_value'];?>"/> - </p> - <p> - <label for="onlyerrors"><?php echo _ONLY_ERRORS;?> :</label> - <?php echo _YES;?><input name="onlyerrors" class="check" type="radio" id="onlyerrors" value="yes" <?php if ($_SESSION['m_admin']['onlyerrors'] == "yes") { - echo "checked";}?> /> - <?php echo _NO;?><input name="onlyerrors" class="check" type="radio" id="onlyerrors" value="no" <?php if ($_SESSION['m_admin']['onlyerrors'] == "no" || empty($_SESSION['m_admin']['onlyerrors'])) { echo "checked";}?> /> - </p> - <p class="button"> - <input type="submit" name="search" value="<?php echo _SEARCH;?>" class="button"/> - <input type="button" class="button" name="cancel" value="<?php echo _CANCEL;?>" onclick="javascript:window.location.href='<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=admin';"/> - </p> - </form> -</div> -<div class="block_end"> </div> - <br/> -</div> diff --git a/apps/maarch_entreprise/admin/parameters/admin_parameter.php b/apps/maarch_entreprise/admin/parameters/admin_parameter.php deleted file mode 100755 index be789a8d8fa9d4882febb9bcbe8d447c0f0e56cc..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/parameters/admin_parameter.php +++ /dev/null @@ -1,164 +0,0 @@ -<?php -/* -* -* Copyright 2008,2012 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/>. -* -* @author Cyril Vazquez <dev@maarch.org> -*/ - -$admin = new core_tools(); -$admin->test_admin('admin_parameters', 'apps'); -$_SESSION['m_admin']= array(); -/****************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=admin_parameter&admin=parameter'; -$page_label = _PARAMETER; -$page_id = "admin_parameter"; -$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); -#****************************************************************************** - -require_once("apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_list_show.php"); -require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php"); -require_once("core/core_tables.php"); - -# Prepare view for UP/ADD -#****************************************************************************** -$view = new DOMDocument(); -@$view->loadHTMLFile( - $_SESSION['config']['corepath'] . - "apps" . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']. DIRECTORY_SEPARATOR - . 'template' . DIRECTORY_SEPARATOR . 'admin_parameter.html' -); -$xview = new DOMXPath($view); -# Set id attributes in view -$ids = $xview->query('//*[@id]'); -for($i=0, $l=$ids->length; $i<$l; $i++) { - $id = $ids->item($i); - $id->setIdAttribute('id', false); - $id->setIdAttribute('id', true); -} - -# Set action mode -$mode = $view->getElementById("mode"); -$mode->setAttribute('value', $_REQUEST['mode']); - -# Translate -$title = $view->getElementsByTagName('h1')->item(0); -if($text = @constant($title->nodeValue)) - $title->nodeValue = $text; - -$labels = $view->getElementsByTagName('label'); -for($i=0, $l=$labels->length; $i<$l; $i++) { - $label = $labels->item($i); - $const = $label->nodeValue; - if($text = @constant($const)) - $label->nodeValue = $text; -} -$buttons = $xview->query('//input[@type="button"]'); -for($i=0, $l=$buttons->length; $i<$l; $i++) { - $button = $buttons->item($i); - $value = $button->getAttribute('value'); - if($text = @constant($value)) - $button->setAttribute('value', $text); -} -$options = $xview->query('//option'); -for($i=0, $l=$options->length; $i<$l; $i++) { - $option = $options->item($i); - $label = $option->nodeValue; - if($text = @constant($label)) - $option->nodeValue = $text; -} - -$datalist = $view->getElementById("messages"); -$options = $datalist->getElementsByTagName("option"); -for($i=0, $l=$options->length; $i<$l; $i++) { - $option = $options->item($i); - $id = $option->getAttribute('id'); - if($message = @constant($id)) - $option->setAttribute('value', $message); -} - -# Manage local path -$cancel_btn = $view->getElementById("cancel"); -$cancel_btn->setAttribute( - 'onclick', - "goTo('index.php?admin=parameters&page=admin_parameters');" -); - -# Switch on mode/action -#****************************************************************************** -switch($_REQUEST['mode']) { -case 'add': - echo $view->saveHTML(); - break; - -case 'up': -case 'del': - $db = new Database(); - $stmt = $db->query( - "SELECT * FROM " . PARAM_TABLE - . " WHERE id = ? ", - array($_REQUEST['id']) - ); - $param = $stmt->fetchObject(); - - # param id (readonly) - $param_id = $view->getElementById("id"); - $param_id->setAttribute('value', $param->id); - $param_id->setAttribute('readonly', 'true'); - $param_id->setAttribute('disabled', 'true'); - - # param description - $param_description = $view->getElementById("description"); - $param_description->nodeValue = $param->description; - - # param value & type - if($param->param_value_string != '') - $type = 'string'; - elseif($param->param_value_int != '') - $type = 'int'; - elseif($param->param_value_date != '') - $type = 'date'; - - # Set value - $param_value_string = $view->getElementById("param_value_string"); - $param_value_string->setAttribute('value', $param->param_value_string); - $param_value_int = $view->getElementById("param_value_int"); - $param_value_int->setAttribute('value', $param->param_value_int); - $param_value_date = $view->getElementById("param_value_date"); - $param_value_date->setAttribute('value', $param->param_value_date); - - # Set type (readonly) - $param_type = $view->getElementById("type"); - $param_type->setAttribute('readonly', 'true'); - $param_type->setAttribute('disabled', 'true'); - if($type_option = $xview->query('//option[@value="'.$type.'"]')->item(0)) - $type_option->setAttribute('selected', 'true'); - - echo $view->saveHTML(); - break; -} diff --git a/apps/maarch_entreprise/admin/parameters/admin_parameter_save.php b/apps/maarch_entreprise/admin/parameters/admin_parameter_save.php deleted file mode 100755 index 41e562660630c4809f41c4f605dcea9c5e9b43b6..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/parameters/admin_parameter_save.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php -/* -listmodel_type_id : $('listmodel_type_id').value, -listmodel_type_label : $('listmodel_type_label').value, -*/ -require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php"); -require_once("core/core_tables.php"); -$db = new Database(); - -$mode = $_REQUEST['mode']; -$id = $_REQUEST['id']; -$description = $_REQUEST['description']; -$param_value_string = $_REQUEST['param_value_string']; -$param_value_int = $_REQUEST['param_value_int']; -$param_value_date = $_REQUEST['param_value_date']; - -$type = $_REQUEST['type']; - -switch($type) { -case 'string': - $column = 'param_value_string'; - $value = (string)$param_value_string; - break; - -case 'int': - $column = 'param_value_int'; - $value = (integer)$param_value_int; - break; - -case 'date': - $column = 'param_value_date'; - $value = $param_value_date; - break; -} - - -# If no error, proceed -switch($_REQUEST['mode']) { -case 'add': - $res = $db->query( - "INSERT INTO " . PARAM_TABLE - . " (id, description, ".$column.")" - . " values (?, ?, ? )", - array($id, $description, $value) - ); - break; - -case 'up': - $res = $db->query( - "UPDATE " . PARAM_TABLE - . " SET " - . "description = ?, " - . $column. " = ? " - . "where id = ?", - array($description, $value, $id) - ); - break; - -case 'del': - $res = $db->query( - "DELETE FROM " . PARAM_TABLE - . " WHERE id = ?", - array($id) - ); - break; - -} \ No newline at end of file diff --git a/apps/maarch_entreprise/admin/parameters/admin_parameters.php b/apps/maarch_entreprise/admin/parameters/admin_parameters.php deleted file mode 100755 index 26e7c0740efc0d1523608ff55782dffa0e326bea..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/parameters/admin_parameters.php +++ /dev/null @@ -1,191 +0,0 @@ -<?php -/* -* -* Copyright 2008,2015 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/>. -* -* @author Cyril Vazquez <dev@maarch.org> -*/ - -$admin = new core_tools(); -$admin->test_admin('admin_parameters', 'apps'); -$_SESSION['m_admin']= array(); -/****************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=admin_parameters&admin=parameters'; -$page_label = _PARAMETERS; -$page_id = "admin_parameters"; -$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); -/***********************************************************/ - -?> -<table width="100%" id="controlParamTechnicTable"> - <tr> - <td align="left"> - <input class="button" type="button" value="<?php echo _CONTROL_PARAM_TECHNIC; - ?>" onclick="window.location.href = '<?php echo $_SESSION['config']['businessappurl'] - . 'index.php?admin=parameters&page=control_param_technic';?>';"/> - </td> - </tr> -</table> -<?php - -require_once("apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_list_show.php"); -require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php"); -require_once("core".DIRECTORY_SEPARATOR."core_tables.php"); - -$func = new functions(); -$request = new request; - -$what = ''; -$where = ''; -$arrayPDO = array(); - -$list = new list_show(); - -if(isset($_REQUEST['what']) && !empty($_REQUEST['what'])) -{ - $what = $_REQUEST['what']; - $where = " lower(id) like lower(?) or lower(description) like lower(?) "; - $arrayPDO = array($what.'%', '%'.$what.'%'); -} - -$order = 'asc'; -if(isset($_REQUEST['order']) && !empty($_REQUEST['order'])) -{ - $order = trim($_REQUEST['order']); -} -$field = 'id'; -if(isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) -{ - $field = trim($_REQUEST['order_field']); -} - -$orderstr = $list->define_order($order, $field); - -$select[PARAM_TABLE] = array(); -array_push($select[PARAM_TABLE], "id", "description", "param_value_string", "param_value_int", "param_value_date"); - -$tab = $request->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype']); - -# loop on lines -for ($i=0;$i<count($tab);$i++) -{ - $value_shown = false; - # Loop on cols - for ($j=0;$j<count($tab[$i]);$j++) - { - if($tab[$i][$j]['column']=="id") - { - $tab[$i][$j]["id"]=$tab[$i][$j]['value']; - $tab[$i][$j]["label"]= _ID; - $tab[$i][$j]["size"]="20"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="left"; - $tab[$i][$j]["order"]=$tab[$i][$j][$col]; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - } - - if($tab[$i][$j]['column']=="description") - { - $tab[$i][$j]['value']=$request->show_string($tab[$i][$j]['value']); - $tab[$i][$j]["description"]=$tab[$i][$j]['value']; - $tab[$i][$j]["label"]=_DESC; - $tab[$i][$j]["size"]="30"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="left"; - $tab[$i][$j]["order"]=$tab[$i][$j][$col]; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - } - - if($tab[$i][$j]['column']=="param_value_string" && (string)$tab[$i][$j]['value'] <> "") - { - $tab[$i][$j]['value']=$request->show_string($tab[$i][$j]['value']); - // $tab[$i][$j]["label"]=_VALUE; - $tab[$i][$j]["size"]="30"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="left"; - $tab[$i][$j]["order"]=$tab[$i][$j][$col]; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - $value_shown = true; - } - if($tab[$i][$j]['column']=="param_value_int" && (string)$tab[$i][$j]['value'] <> "") - { - $tab[$i][$j]['value']=$request->show_string($tab[$i][$j]['value']); - // $tab[$i][$j]["label"]=_VALUE; - $tab[$i][$j]["size"]="50"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="left"; - $tab[$i][$j]["order"]=$tab[$i][$j][$col]; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - $value_shown = true; - } - if($tab[$i][$j]['column']=="param_value_date" && (string)$tab[$i][$j]['value'] <> "") - { - $tab[$i][$j]['value']=$request->show_string($tab[$i][$j]['value']); - // $tab[$i][$j]["label"]=_VALUE; - $tab[$i][$j]["size"]="50"; - $tab[$i][$j]["label_align"]="left"; - $tab[$i][$j]["align"]="left"; - $tab[$i][$j]["order"]=$tab[$i][$j][$col]; - $tab[$i][$j]["valign"]="bottom"; - $tab[$i][$j]["show"]=true; - $value_shown = true; - } - } - - if(!$value_shown) { - $tab[$i][2]['column'] = 'param_value_string'; - $tab[$i][2]['value']=''; - $tab[$i][2]["label"]=_VALUE; - $tab[$i][2]["size"]="50"; - $tab[$i][2]["label_align"]="left"; - $tab[$i][2]["align"]="left"; - $tab[$i][2]["order"]=''; - $tab[$i][2]["valign"]="bottom"; - $tab[$i][2]["show"]=true; - } - -} - -$tab[0][2]["label"]=_VALUE; - -$page_name = "admin_parameters"; -$page_name_up = "admin_parameter&mode=up"; -$page_name_add = "admin_parameter&mode=add"; -$page_name_del = "admin_parameter&mode=del"; -$label_add = _ADD_PARAMETER; -$_SESSION['m_admin']['init'] = true; - -$title = _PARAMETERS." : ".$i." "._PARAMETER_S; -$autoCompletionArray = false;//array(); - -$list->admin_list($tab, $i, $title, 'id','admin_parameters','parameters', 'id', true, $page_name_up, $page_name_val, $page_name_ban, $page_name_del, $page_name_add, $label_add, false, false, _ALL_PARAMETERS, _PARAMETER, 'wrench', false, true, false, true, "", true, $autoCompletionArray, false, true); -?> diff --git a/apps/maarch_entreprise/admin/parameters/ajaxMailBoxTest.php b/apps/maarch_entreprise/admin/parameters/ajaxMailBoxTest.php deleted file mode 100755 index 8a81366383990a72727d4b0245cb38675e1142d6..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/parameters/ajaxMailBoxTest.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php - -/* -* -* Copyright 2008,2015 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/>. -*/ - -/*var_dump($_REQUEST); -var_dump($_SESSION['mailAccounts'][$_REQUEST['mailBoxIndex']]);*/ -$uri = $_SESSION['mailAccounts'][$_REQUEST['mailBoxIndex']]['mailBoxUri']; -$login = $_SESSION['mailAccounts'][$_REQUEST['mailBoxIndex']]['mailBoxUsername']; -$password = $_SESSION['mailAccounts'][$_REQUEST['mailBoxIndex']]['mailBoxPassword']; - -try { - $imap = @imap_open( - $uri, - $login, - $password - ); -} catch (Exception $e) { - echo 'Exception : ', $e->getMessage(), ""; -} - -$errorDetails = ''; -$status = 'ok'; -if(!$imap) { - $status = 'ko'; - $errors = imap_errors(); - $alerts = imap_alerts(); - $errorDetails = $errors; -} else { - $status = 'ok'; -} - -echo "{status : '" . $status . "', errorDetails : '" - . json_encode($errorDetails) . "'}"; -exit; - - diff --git a/apps/maarch_entreprise/admin/parameters/ajaxSendmailTest.php b/apps/maarch_entreprise/admin/parameters/ajaxSendmailTest.php deleted file mode 100755 index 653f6294cf5cb2a42d47b5a1b78916eb95553f9d..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/parameters/ajaxSendmailTest.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php - -/* -* -* Copyright 2008,2015 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/>. -*/ - -include($_SESSION['config']['corepath'] - . '/apps/maarch_entreprise/tools/mails/htmlMimeMail.php'); -/*var_dump($_REQUEST); -var_dump($_SESSION['sendmailAccounts'][$_REQUEST['sendmailIndex']]);*/ -$mailer = new htmlMimeMail(); - -$mailer->setSMTPParams( - $host = (string)$_SESSION['sendmailAccounts'][$_REQUEST['sendmailIndex']]['sendmailHost'], - $port = (string)$_SESSION['sendmailAccounts'][$_REQUEST['sendmailIndex']]['sendmailPort'], - $helo = (string)$_SESSION['sendmailAccounts'][$_REQUEST['sendmailIndex']]['sendmailDomains'], - $auth = filter_var($_SESSION['sendmailAccounts'][$_REQUEST['sendmailIndex']]['sendmailAuth'], FILTER_VALIDATE_BOOLEAN), - $user = (string)$_SESSION['sendmailAccounts'][$_REQUEST['sendmailIndex']]['sendmailUser'], - $pass = (string)$_SESSION['sendmailAccounts'][$_REQUEST['sendmailIndex']]['sendmailPassword'] -); - -$mailer->setFrom(' <testSendmail@maarch.org> '); -$mailer->setSubject('test sendmail from Maarch'); -$mailer->setText('test sendmail from Maarch '); - -$mailer->setTextCharset((string)$_SESSION['sendmailAccounts'][$_REQUEST['sendmailIndex']]['sendmailCharset']); -$mailer->setHtmlCharset((string)$_SESSION['sendmailAccounts'][$_REQUEST['sendmailIndex']]['sendmailCharset']); -$mailer->setHeadCharset((string)$_SESSION['sendmailAccounts'][$_REQUEST['sendmailIndex']]['sendmailCharset']); -$recipients = array(); -array_push($recipients, $_SESSION['sendmailTo']); - -try { - $sendmail = $mailer->send($recipients, (string)$_SESSION['sendmailAccounts'][$_REQUEST['sendmailIndex']]['sendmailType']); -} catch (Exception $e) { - echo 'Exception : ', $e->getMessage(), ""; -} - -$errorDetails = ''; -$status = 'ok'; -if( - ($sendmail == 1 && ((string)$_SESSION['sendmailAccounts'][$_REQUEST['sendmailIndex']]['sendmailType'] == "smtp" || (string)$_SESSION['sendmailAccounts'][$_REQUEST['sendmailIndex']]['sendmailType'] == "mail" )) - || ($sendmail == 0 && (string)$_SESSION['sendmailAccounts'][$_REQUEST['sendmailIndex']]['sendmailType'] == "sendmail") -) { - $status = 'ok'; -} else { - $status = 'ko'; - $errorDetails = 'sendmail code : ' . $sendmail . ' Errors when sending message through SMTP :' - . $mailer->errors[0] . ' ' . $mailer->errors[1]; -} - -echo "{status : '" . $status . "', errorDetails : '" - . json_encode($errorDetails) . "'}"; -exit; - - diff --git a/apps/maarch_entreprise/admin/parameters/control_param_technic.php b/apps/maarch_entreprise/admin/parameters/control_param_technic.php deleted file mode 100755 index 8c738b90b7d785bbc5066627961dfad3e630ed00..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/parameters/control_param_technic.php +++ /dev/null @@ -1,287 +0,0 @@ -<?php -/* -* -* Copyright 2008,2015 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/>. -* -* @author Laurent Giovannoni <dev@maarch.org> -*/ - -$admin = new core_tools(); -$admin->test_admin('admin_parameters', 'apps'); -$_SESSION['m_admin']= array(); -/****************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=control_param_technic&admin=parameters'; -$page_label = _CONTROL_PARAM_TECHNIC; -$page_id = "control_param_technic"; -$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); -/***********************************************************/ - -//load XML configuration -if (file_exists( - $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR - . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'apps' - . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id'] - . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'config.xml' -) -) { - $path = $_SESSION['config']['corepath'] . 'custom' - . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] - . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR - . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR . 'xml' - . DIRECTORY_SEPARATOR . 'control_params.xml'; -} else { - $path = 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id'] - . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR - . 'control_params.xml'; -} - -if (!file_exists($path)) { - echo 'first create and configure ' . $path . '<br />'; - exit(); -} - -$xmlconfig = new DOMDocument(); -$xmlconfig->load($path); -$MaarchCaptureGenParam = $xmlconfig->getElementsByTagName('MaarchCapture'); -foreach ($MaarchCaptureGenParam as $MccParam) { - //do nothing -} -$MccTestIt = $MccParam->getElementsByTagName('testIt')->item(0)->nodeValue; -$pathToMaarchCapture = $MccParam->getElementsByTagName('pathToMaarchCapture')->item(0)->nodeValue; - -$func = new functions(); - -$pathToMailCapture = $pathToMaarchCapture . 'modules/MailCapture/'; - -echo '<br /><h2>' . _COMPONENT . ' : MaarchCapture/MailCapture</h2><br />'; -echo '<div id="mailBoxDiv">'; -echo '<ul class="fa-ul" style="font-size:14px;">'; -if ($MccTestIt == 'false') { - echo '<li>Component not configured to be tested.<br />'; - echo 'See ' . $path . ' to configure the test.<br /></li>'; -} else { - $arrayOfParams = array(); - $arrayOfParams = loadXmlParams($pathToMailCapture); - $cptMailBox = 0; - $_SESSION['mailAccounts'] = array(); - foreach ($arrayOfParams as $param) { - echo '---------------------------------------' - . '---------------------------------------<br />'; - echo '<br /><b>Config File : ' . $param->documentURI . '</b><br /><br />'; - $mailAccounts = array(); - $mailAccounts = $param->getElementsByTagName('accounts'); - foreach ($mailAccounts as $mailBox) { - $returnTest = false; - $_SESSION['mailAccounts'][$cptMailBox]['mailBoxUri'] = $mailBox->getElementsByTagName('mailbox')->item(0)->nodeValue; - $_SESSION['mailAccounts'][$cptMailBox]['mailBoxUsername'] = $mailBox->getElementsByTagName('username')->item(0)->nodeValue; - $_SESSION['mailAccounts'][$cptMailBox]['mailBoxPassword'] = $mailBox->getElementsByTagName('password')->item(0)->nodeValue; - $paramsDetails = '<b><i>Test mailbox : </i></b>' . '<br />' - . 'uri : ' . $_SESSION['mailAccounts'][$cptMailBox]['mailBoxUri'] . '<br />' - . 'login : ' . $_SESSION['mailAccounts'][$cptMailBox]['mailBoxUsername'] . '<br />' - . 'password : ***** <br />'; - ?> - <li> - <?php echo $paramsDetails;?> - - <span id="mailBox_<?php echo $cptMailBox;?>" name="mailBox_<?php echo $cptMailBox;?>"> - <i class="fa-li fa fa-spinner fa-spin" style="margin-left: -10px;position: inherit;margin-right: -7px;"></i> - </span> - <script language="javascript"> - var path_manage_script = '<?php echo $_SESSION["config"]["businessappurl"];?>' - + 'index.php?display=true&admin=parameters&page=ajaxMailBoxTest'; - - new Ajax.Request(path_manage_script, - { - method:'post', - parameters: { - mailBoxIndex : '<?php functions::xecho($cptMailBox);?>' - }, - onSuccess: function(answer) - { - eval('response = ' + answer.responseText); - //console.log(response); - if (response.status == 'ok' ) { - $('mailBox_<?php echo $cptMailBox;?>').innerHTML = '<i class="fa fa-check fa-2x" style="color:#45AE52;"></i>' - + 'test mailbox success <br />'; - } else { - $('mailBox_<?php echo $cptMailBox;?>').innerHTML = '<i class="fa fa-check fa-2x" style="color:red;"></i>' - + 'test mailbox failed <br /><br />error details : <br />' - + response.errorDetails; - } - - } - }); - </script> - <?php - echo '</li>'; - $cptMailBox++; - } - - } -} -echo '</ul>'; -echo '</div>'; -/***********************************************************************************************/ -/***********************************************************************************************/ -/***********************************************************************************************/ -echo '<br /><h2>' . _COMPONENT . ' : notifications/sendmail</h2> <br />'; -echo '<div id="sendmailDiv">'; -echo '<ul class="fa-ul" style="font-size:14px;">'; -echo '<li>'; - -$_SESSION['sendmailAccounts'] = array(); -$NotifSendmailGenParam = $xmlconfig->getElementsByTagName('notifications_sendmail'); -foreach ($NotifSendmailGenParam as $notifSendmailParam) { - //do nothing -} -$sendmailTestIt = $notifSendmailParam->getElementsByTagName('testIt')->item(0)->nodeValue; -$_SESSION['sendmailTo'] = $notifSendmailParam->getElementsByTagName('sendmailTo')->item(0)->nodeValue; -$sendmailConfPath = $notifSendmailParam->getElementsByTagName('sendmailConfPath')->item(0)->nodeValue; - -if ($sendmailTestIt == 'false') { - echo 'Component not configured to be tested.<br />'; - echo 'See ' . $path . ' to configure the test.<br />'; -} else { - - $pathToNotifications = $_SESSION['config']['corepath'] . 'modules/notifications/batch/config/'; - $pathToSendmail = $_SESSION['config']['corepath'] . 'modules/sendmail/batch/config/'; - $arrayOfParams = array(); - $arrayOfParams = loadXmlParams($pathToNotifications); - $arrayOfParams = loadXmlParams($pathToSendmail, $arrayOfParams); - $cptSendmail = 0; - - foreach ($arrayOfParams as $param) { - $cptSendmail++; - //var_dump($param); - echo '---------------------------------------' - . '---------------------------------------<br />'; - echo '<br /><b>Config File : ' . $param->documentURI . '</b><br /><br />'; - $returnTest = false; - $mailerParam = ''; - $mailerParam = $param->getElementsByTagName('MAILER'); - foreach ($mailerParam as $mailParam) { - //var_dump($mailParam); - //do nothing - } - - //$sendmailType = $mailParam->getElementsByTagName('type')->item(0)->nodeValue; - $_SESSION['sendmailAccounts'][$cptSendmail]['sendmailType'] = $mailParam->getElementsByTagName('type')->item(0)->nodeValue; - if ( - $_SESSION['sendmailAccounts'][$cptSendmail]['sendmailType'] <> 'sendmail' && - $_SESSION['sendmailAccounts'][$cptSendmail]['sendmailType'] <> 'mail' - ) { - $sendmailDetails .= 'host : '. $mailParam->getElementsByTagName('smtp_host')->item(0)->nodeValue . '<br/>'; - $_SESSION['sendmailAccounts'][$cptSendmail]['sendmailHost'] = $mailParam->getElementsByTagName('smtp_host')->item(0)->nodeValue; - - $sendmailDetails .= 'port : '. $mailParam->getElementsByTagName('smtp_port')->item(0)->nodeValue . '<br/>'; - $_SESSION['sendmailAccounts'][$cptSendmail]['sendmailPort'] = $mailParam->getElementsByTagName('smtp_port')->item(0)->nodeValue; - - $sendmailDetails .= 'user : '. $mailParam->getElementsByTagName('smtp_user')->item(0)->nodeValue . '<br/>'; - $_SESSION['sendmailAccounts'][$cptSendmail]['sendmailUser'] = $mailParam->getElementsByTagName('smtp_user')->item(0)->nodeValue; - - $_SESSION['sendmailAccounts'][$cptSendmail]['sendmailPassword'] = $mailParam->getElementsByTagName('smtp_password')->item(0)->nodeValue; - $sendmailDetails .= 'auth : '. $mailParam->getElementsByTagName('smtp_auth')->item(0)->nodeValue . '<br/>'; - - $_SESSION['sendmailAccounts'][$cptSendmail]['sendmailAuth'] = $mailParam->getElementsByTagName('smtp_auth')->item(0)->nodeValue; - $sendmailDetails .= 'secure : '. $mailParam->getElementsByTagName('smtp_secure')->item(0)->nodeValue . '<br/>'; - - $_SESSION['sendmailAccounts'][$cptSendmail]['sendmailSecure'] = $mailParam->getElementsByTagName('smtp_secure')->item(0)->nodeValue; - $sendmailDetails .= 'domains : '. $mailParam->getElementsByTagName('domains')->item(0)->nodeValue . '<br/>'; - - $_SESSION['sendmailAccounts'][$cptSendmail]['sendmailDomains'] = $mailParam->getElementsByTagName('domains')->item(0)->nodeValue; - $sendmailDetails .= 'charset : '. $mailParam->getElementsByTagName('charset')->item(0)->nodeValue . '<br/>'; - - $_SESSION['sendmailAccounts'][$cptSendmail]['sendmailCharset'] = $mailParam->getElementsByTagName('charset')->item(0)->nodeValue; - } else { - $sendmailDetails = 'see more details at ' . $sendmailConfPath; - } - - $paramsDetails = '<b><i>Test sendmail : </i></b>' . '<br />' - . 'type : ' . $_SESSION['sendmailAccounts'][$cptSendmail]['sendmailType'] . '<br />' - . 'sendmail to : ' . $_SESSION['sendmailTo'] . '<br />' - . 'details : ' . $sendmailDetails . '<br />'; - echo $paramsDetails; - - ?> - <span id="sendmail_<?php echo $cptSendmail;?>" name="sendmail_<?php echo $cptSendmail;?>"> - <i class="fa-li fa fa-spinner fa-spin" style="margin-left: -10px;position: inherit;margin-right: -7px;"></i> - </span> - <script language="javascript"> - var path_manage_script = '<?php echo $_SESSION["config"]["businessappurl"];?>' - + 'index.php?display=true&admin=parameters&page=ajaxSendmailTest'; - - new Ajax.Request(path_manage_script, - { - method:'post', - parameters: { - sendmailIndex : '<?php functions::xecho($cptSendmail);?>' - }, - onSuccess: function(answer) - { - eval('response = ' + answer.responseText); - //console.log(response); - if (response.status == 'ok' ) { - $('sendmail_<?php echo $cptSendmail;?>').innerHTML = '<i class="fa fa-check fa-2x" style="color:#45AE52;"></i>' - + 'test sendmail success <br />'; - } else { - $('sendmail_<?php echo $cptSendmail;?>').innerHTML = '<i class="fa fa-check fa-2x" style="color:red;"></i>' - + 'test sendmail failed <br /><br />error details : <br />' - + response.errorDetails; - } - - } - }); - </script> - <?php - } -} -echo '</li></ul>'; -echo '</div>'; - -function loadXmlParams ($pathToParams, $arrayOfParams = array()) -{ - if (is_dir($pathToParams)) { - $dir = opendir($pathToParams); - while($file = readdir($dir)) { - if (strtoupper(pathinfo($file, PATHINFO_EXTENSION)) == 'XML') { - $pathToXml = $pathToParams . $file; - $paramXml = new DOMDocument(); - $paramXml->load($pathToXml); - array_push($arrayOfParams, $paramXml); - } - } - closedir($dir); - } else { - functions::xecho ('path not exists : ' . $pathToParams); - } - return $arrayOfParams; -} - diff --git a/apps/maarch_entreprise/admin/reopen_mail/reopen_mail.php b/apps/maarch_entreprise/admin/reopen_mail/reopen_mail.php deleted file mode 100755 index a3a7f8d0ebb262dc5e4f34012b7817e0e77f9fb7..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/reopen_mail/reopen_mail.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php - -/* -* Copyright 2008,2015 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/>. -*/ - -$core_tools2 = new core_tools(); -//here we loading the lang vars -$core_tools2->load_lang(); -$core_tools2->test_admin('reopen_mail', 'apps'); - -/****************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=reopen_mail&admin=reopen_mail'; -$page_label = _REOPEN_MAIL; -$page_id = "reopen_mail"; -$core_tools2->manage_location_bar($page_path, $page_label, $page_id, $init, $level); -/***********************************************************/ - -require_once("apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_reopen_mail.php"); - -$reopen = new ReopenMail(); -$reopen->formreopenmail(); diff --git a/apps/maarch_entreprise/admin/reopen_mail/reopen_mail_db.php b/apps/maarch_entreprise/admin/reopen_mail/reopen_mail_db.php deleted file mode 100755 index 42ed572cf9593d9f6e74dd450c1b650363c7d859..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/reopen_mail/reopen_mail_db.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php -/* -* Copyright 2008,2009 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/>. -*/ - -$core_tools = new core_tools(); -$core_tools->load_lang(); -$core_tools->test_admin('reopen_mail', 'apps'); - -require_once("apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_reopen_mail.php"); - -$reopen = new ReopenMail(); -$reopen->update_db(); -?> diff --git a/apps/maarch_entreprise/admin/users/add_usergroup_content.php b/apps/maarch_entreprise/admin/users/add_usergroup_content.php deleted file mode 100755 index 999a08afa4567d4f2bc4d1999cd1d900c42c7ab3..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/users/add_usergroup_content.php +++ /dev/null @@ -1,101 +0,0 @@ -<?php -/* -* Copyright 2008,2009 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 Form to add a grant to a user, pop up page (User administration) -* -* -* @file -* @author Claire Figueras <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup admin -*/ - -try{ - require_once("core/class/usergroups_controler.php"); -} catch (Exception $e){ - functions::xecho($e->getMessage()); -} -core_tools::load_lang(); -core_tools::test_admin('admin_users', 'apps'); - -$ugc = new usergroups_controler(); -$tab = $ugc->getAllUsergroups(); - -$tab2 = array(); -if ( count($_SESSION['m_admin']['users']['groups']) > 0 ) -{ - for($i=0; $i < count($_SESSION['m_admin']['users']['groups']); $i++) - { - array_push($tab2, array('ID'=> $_SESSION['m_admin']['users']['groups'][$i]['GROUP_ID'], 'LABEL' => $_SESSION['m_admin']['users']['groups'][$i]['LABEL'])); - } -} - -$res = $tab; -for($j=0; $j < count($tab); $j++) -{ - for($k=0; $k < count($tab2); $k++) - { - if($tab[$j]->__get('group_id') == $tab2[$k]['ID']) - { - unset($res[$j]); - break; - } - } -} -$res = array_values($res); -unset($tab2); -unset($tab); -?> -<div class="popup_content"> -<h2 class="tit"><?php echo _ADD_GROUP;?></h2> -<form name="chooseGroup" id="chooseGroup" method="get" action="#" class="forms"> -<p> - <label for="group_id"> <?php echo _CHOOSE_GROUP_ADMIN;?> : </label> - <select name="group_id" id="group_id" > -<?php - -for($j=0; $j<count($res); $j++) -{ - $desc = $res[$j]->__get('group_desc'); - if(isset($res[$j]) && !empty($desc)) - { -?> - <option value="<?php functions::xecho($res[$j]->__get('group_id')); ?>"><?php functions::xecho($res[$j]->__get('group_desc'));?></option> -<?php - } -} -?> -</select> -</p> -<br/> -<p> - <label for="role"><?php echo _ROLE;?> : </label> - <input type="text" name="role" id="role" /> -</p> -<br/> -<p class="buttons"> - <input type="button" name="Submit" value="<?php echo _VALIDATE;?>" class="button" onclick="checkGroup('chooseGroup', '<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&admin=users&page=check_group';?>', '<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&admin=users&page=manage_group';?>', '<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&admin=users&page=ugc_form';?>');" /> - <input type="button" name="cancel" value="<?php echo _CANCEL;?>" class="button" onclick="destroyModal('add_ugc');"/> -</p> - -</form> -</div> diff --git a/apps/maarch_entreprise/admin/users/check_group.php b/apps/maarch_entreprise/admin/users/check_group.php deleted file mode 100755 index 5cb39adba822c7810288507d67df630c8b0eda0e..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/users/check_group.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php - -$error = ''; - -function get_values_in_array($val) -{ - $val = str_replace("'", "'", $val); - $tab = explode('$$',$val); - $values = array(); - for($i=0; $i<count($tab);$i++) - { - if(isset($tab[$i])) - { - $tmp = explode('#', $tab[$i]); - if(isset($tmp[1])) - { - $values[] = array('ID' => $tmp[0], 'VALUE' => trim($tmp[1])); - } - } - } - return $values; -} - -function get_value_fields($values, $field) -{ - for($i=0; $i<count($values);$i++) - { - if($values[$i]['ID'] == $field) - { - return $values[$i]['VALUE']; - } - } - return false; -} - -if(!isset($_REQUEST['form_values']) || empty($_REQUEST['form_values'])) -{ - $error = _ERROR_FORM_VALUES." check<br/>"; - echo "{status : 2, error_txt : '".$error."'}"; - exit(); -} - -$values = get_values_in_array($_REQUEST['form_values']); -$group_id = get_value_fields($values, 'group_id'); -$role = get_value_fields($values, 'role'); - -if(!isset($group_id ) || $group_id == '') -{ - $error = _NO_GROUP_SELECTED."!"; -} - -if(!empty($error)) -{ - echo "{status : 1, error_txt : '".$error."'}"; -} -else -{ - echo "{status : 0, error_txt : '".$error."'}"; -} - exit(); diff --git a/apps/maarch_entreprise/admin/users/manage_group.php b/apps/maarch_entreprise/admin/users/manage_group.php deleted file mode 100755 index 9d8d56aed727b4d1b38e8714c40203cde76b34e4..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/users/manage_group.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php -$error = ''; -function get_values_in_array($val) -{ - $val = str_replace("'", "'", $val); - $tab = explode('$$',$val); - $values = array(); - for($i=0; $i<count($tab);$i++) - { - $tmp = explode('#', $tab[$i]); - if(isset($tmp[1])) - { - array_push($values, array('ID' => $tmp[0], 'VALUE' => trim($tmp[1]))); - } - } - return $values; -} - -function get_value_fields($values, $field) -{ - for($i=0; $i<count($values);$i++) - { - if($values[$i]['ID'] == $field) - { - return $values[$i]['VALUE']; - } - } - return false; -} - -if(!isset($_REQUEST['form_values']) || empty($_REQUEST['form_values'])) -{ - $error = _ERROR_FORM_VALUES."<br/>"; - echo "{status : 1, error_txt : '".$error."'}"; - exit(); -} - -try{ - require_once("core/class/usergroups_controler.php"); -} catch (Exception $e){ - functions::xecho($e->getMessage()); -} -$ugc = new usergroups_controler(); -$values = get_values_in_array($_REQUEST['form_values']); - -$group_id = get_value_fields($values, 'group_id'); -$role = get_value_fields($values, 'role'); - -$group = $ugc->get($group_id); -array_push($_SESSION['m_admin']['users']['groups'] , array('USER_ID' => '', 'GROUP_ID' => $group_id , 'LABEL' => $group->__get('group_desc'), 'PRIMARY' => 'N', 'ROLE' => functions::show_string($role))); - -if(count($_SESSION['m_admin']['users']['groups']) == 1) -{ - $_SESSION['m_admin']['users']['groups'][0]['PRIMARY'] = 'Y'; -} - -echo "{status : 0, error_txt : '".$error."'}"; -exit(); -?> diff --git a/apps/maarch_entreprise/admin/users/manage_psw_changed.php b/apps/maarch_entreprise/admin/users/manage_psw_changed.php deleted file mode 100755 index 8a75bace06421915ab575e122e647ce7b33cec54..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/users/manage_psw_changed.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php - -$error = ''; -try{ - require_once "core/class/users_controler.php"; - require_once 'core/core_tables.php'; - require_once('core' . DIRECTORY_SEPARATOR . 'class' - . DIRECTORY_SEPARATOR . 'class_security.php'); -} catch (Exception $e){ - functions::xecho($e->getMessage()); -} -$core = new core_tools(); -$core->load_lang(); -if (! isset($_SESSION['config']['userdefaultpassword']) - || empty($_SESSION['config']['userdefaultpassword']) -) { - $_SESSION['config']['userdefaultpassword'] = 'maarch'; -} -$sec = new security(); -$defaultPassword = $sec->getPasswordHash($_SESSION['config']['userdefaultpassword']); - -$userCtrl = new users_controler(); -$res = $userCtrl->changePassword( - $_SESSION['m_admin']['users']['user_id'], $defaultPassword -); -if (!$res) { - $error = _PASSWORD_NOT_CHANGED; - echo "{status : 1, error_txt : '" . $error. "'}"; -} else { - if ($_SESSION['history']['usersup'] == "true") { - require_once "core/class/class_history.php"; - $hist = new history(); - $hist->add( - USERS_TABLE, $_SESSION['m_admin']['users']['user_id'], "UP",'usersup', - _NEW_PASSWORD_USER . " : " - . $_SESSION['m_admin']['users']['lastname'] . " " - . $_SESSION['m_admin']['users']['firstname'], - $_SESSION['config']['databasetype'] - ); - } - echo "{status : 0, error_txt : '" . $error . "'}"; -} -exit(); - diff --git a/apps/maarch_entreprise/admin/users/modify_user.php b/apps/maarch_entreprise/admin/users/modify_user.php deleted file mode 100755 index 5d84bbfb3218a94b19b146ad7cd59b286bcc414a..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/users/modify_user.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php -/* -* Copyright 2008,2009 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 Form to modify user data -* -* -* @file -* @author Claire Figueras <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup admin -*/ - -$core = new core_tools(); -//here we loading the lang vars -$core->load_lang(); - /****************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']; -} -$pagePath = $_SESSION['config']['businessappurl'] - . 'index.php?page=modify_user&admin=users'; -$pageLabel = _MY_INFO; -$pageId = 'modify_users'; -$core->manage_location_bar($pagePath, $pageLabel, $pageId, $init, $level); -/***********************************************************/ -require_once 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id'] - . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'class_users.php'; -$users = new class_users(); - -if ($_GET['reinit']) { - $userInfos = functions::infouser($_SESSION['user']['UserId']); - $_SESSION['user']['UserId'] = $userInfos['UserId']; - $_SESSION['user']['FirstName'] = $userInfos['FirstName']; - $_SESSION['user']['LastName'] = $userInfos['LastName']; - $_SESSION['user']['Phone'] = $userInfos['Phone']; - $_SESSION['user']['Mail'] = $userInfos['Mail']; - $_SESSION['user']['department'] = $userInfos['department']; - $_SESSION['user']['thumbprint'] = $userInfos['thumbprint']; - $_SESSION['user']['pathToSignature'] = $userInfos['pathToSignature']; -} - -$users->change_info_user(); diff --git a/apps/maarch_entreprise/admin/users/psw_changed.php b/apps/maarch_entreprise/admin/users/psw_changed.php deleted file mode 100755 index 41b697e309718a3bd7179b0cadb86c4b8732fb72..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/users/psw_changed.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php -/* -* Copyright 2008,2009 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 Form to modify user password at the first connexion -* -* -* @file -* @author Claire Figueras <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup admin -*/ - -core_tools::load_lang(); -if(!isset($_SESSION['config']['userdefaultpassword']) || empty($_SESSION['config']['userdefaultpassword'])) - $_SESSION['config']['userdefaultpassword'] = 'maarch'; -?> -<h2 class="tit"><?php echo _PASSWORD_MODIFICATION;?></h2> -<div id="frm_error"></div> -<p ><?php echo _PASSWORD_FOR_USER;?> <b><?php functions::xecho($_SESSION['m_admin']['users']['user_id'] );?></b> <?php echo _HAS_BEEN_RESET;?>. -</p> -<p><?php echo _NEW_PASW_IS." '".$_SESSION['config']['userdefaultpassword']."'";?></p> -<p > -<?php echo _DURING_NEXT_CONNEXION;?>, <?php functions::xecho($_SESSION['m_admin']['users']['user_id'] );?> <?php echo _MUST_CHANGE_PSW;?>. -</p> -<br/> -<p class="buttons" ><input type="button" class="button" onclick="changePassword('<?php echo $_SESSION['config']['businessappurl'].'index.php?display=true&admin=users&page=manage_psw_changed';?>');" name="close" value="<?php echo _CLOSE_WINDOW;?>" /></p> diff --git a/apps/maarch_entreprise/admin/users/remove_group.php b/apps/maarch_entreprise/admin/users/remove_group.php deleted file mode 100755 index 3f875c9739d2c7691aef5d6979be36f3f99b6388..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/users/remove_group.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -if(isset($_REQUEST['usergroups']) && $_REQUEST['usergroups'] >= 0) -{ - $group_ind = explode('#', $_REQUEST['usergroups']); - unset($group_ind[count($group_ind) -1]); - $to_unset = array(); - for($i=0;$i<count($group_ind);$i++) - { - for($j=0; $j<count($_SESSION['m_admin']['users']['groups']);$j++) - { - if(!empty($group_ind[$i]) && trim($group_ind[$i]) == trim($_SESSION['m_admin']['users']['groups'][$j]['GROUP_ID'])) - { - array_push($to_unset, $j); - break; - } - } - } - for($i=0;$i<count($to_unset);$i++) - { - unset($_SESSION['m_admin']['users']['groups'][$to_unset[$i]]); - } - $_SESSION['m_admin']['users']['groups'] = array_values($_SESSION['m_admin']['users']['groups']); - $_SESSION['m_admin']['load_group'] = false; - echo "{ status : 0 }"; -} -else -{ - echo "{ status : 1 }"; -} -?> diff --git a/apps/maarch_entreprise/admin/users/set_primary_group.php b/apps/maarch_entreprise/admin/users/set_primary_group.php deleted file mode 100755 index 586a72fba0512416eb8254851933a6832ec8500c..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/users/set_primary_group.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php - -if(isset($_REQUEST['usergroups']) && $_REQUEST['usergroups'] >= 0) -{ - $group_ind = explode('#', $_REQUEST['usergroups']); - $group_id =$group_ind[0]; - for($i=0; $i < count($_SESSION['m_admin']['users']['groups']); $i++) - { - $_SESSION['m_admin']['users']['groups'][$i]["PRIMARY"] = 'N'; - if ( $_SESSION['m_admin']['users']['groups'][$i]["GROUP_ID"] == $group_id) - $_SESSION['m_admin']['users']['groups'][$i]["PRIMARY"] = 'Y'; - } - - $_SESSION['m_admin']['load_group'] = false; - echo "{ status : 0 }"; -} -else -{ - echo "{ status : 1 }"; -} -?> diff --git a/apps/maarch_entreprise/admin/users/ugc_form.php b/apps/maarch_entreprise/admin/users/ugc_form.php deleted file mode 100755 index 6a752bd6fefd32ffe4e9ce3d437e22e7076c081e..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/users/ugc_form.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php -/* -* Copyright 2008,2009 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 Form to choose a group in the user management (iframe included in the user management) -* -* -* @file -* @author Claire Figueras <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup admin -*/ -core_tools::load_lang(); -header("Content-Type: text/html", true); -?> -<div class="block" style="height:400px;position:relative;"> -<form name="usergroup_content" method="get" action="#" > - <h2> <?php echo html_entity_decode(_USER_GROUPS_TITLE);?> :</h2> - <div class="content" style="height:150px;overflow:auto;"> -<?php - - if(empty($_SESSION['m_admin']['users']['groups']) ) - { - echo _USER_BELONGS_NO_GROUP.".<br/>"; - echo _CHOOSE_ONE_GROUP.".<br/>"; - } - else - { - for($theline = 0; $theline < count($_SESSION['m_admin']['users']['groups']) ; $theline++) - { - if( $_SESSION['m_admin']['users']['groups'][$theline]['PRIMARY'] == 'Y') - { - ?><i class="fa fa-arrow-right" title="<?php echo _PRIMARY_GROUP;?>"></i> <?php - } - else - { - echo " "; - } - ?> - <input type="checkbox" class="check" name="groups[]" value="<?php echo $_SESSION['m_admin']['users']['groups'][$theline]['GROUP_ID'];?>" /><?php functions::xecho($_SESSION['m_admin']['users']['groups'][$theline]['LABEL'] );?><br/> <i><?php functions::xecho($_SESSION['m_admin']['users']['groups'][$theline]['ROLE']);?></i><br/></input> - <?php - } - ?> <div style="position: absolute;bottom: 10px;"><input class="button" type="button" name="removeUsergroup" id="removeUsergroup" value="<?php echo _DELETE_GROUPS;?>" onclick="doActionGroup('<?php echo $_SESSION['config']['businessappurl'];?>index.php?display=true&admin=users&page=remove_group', '<?php echo $_SESSION['config']['businessappurl'];?>index.php?display=true&admin=users&page=ugc_form')"/><br/><br/> -<?php } - - if (count($_SESSION['m_admin']['users']['groups']) < $_SESSION['m_admin']['nbgroups'] || empty($_SESSION['m_admin']['users']['groups'])) - { - ?> - <input class="button" type="button" name="addGroup" id="addGroup" onclick="displayModal('<?php echo $_SESSION['config']['businessappurl'];?>index.php?display=true&admin=users&page=add_usergroup_content', 'add_ugc', 600, 150);" value="<?php echo _ADD_TO_GROUP;?>" /> - <?php - } - - ?> - <br/><br/> - <?php if (count($_SESSION['m_admin']['users']['groups']) > 0) - { - ?> - <input type="button" class="button" name="setPrimary" id="setPrimary" value="<?php echo _CHOOSE_PRIMARY_GROUP;?>" onclick="doActionGroup('<?php echo $_SESSION['config']['businessappurl'];?>index.php?display=true&admin=users&page=set_primary_group', '<?php echo $_SESSION['config']['businessappurl'];?>index.php?display=true&admin=users&page=ugc_form');"/> - <?php - } - ?> - </div> - </form> - </div> - </div> diff --git a/apps/maarch_entreprise/admin/users/user_modif.php b/apps/maarch_entreprise/admin/users/user_modif.php deleted file mode 100755 index 14f39171d53ff861ed624b400202b5a55944e001..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/users/user_modif.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php -/* -* Copyright 2008,2009 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 Process the user modification -* -* -* @file -* @author Claire Figueras <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup admin -*/ - -$core_tools = new core_tools(); -$core_tools->load_lang(); - -require_once("apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_users.php"); - -$users = new class_users(); -$users->user_modif(); -?> diff --git a/apps/maarch_entreprise/admin/users/users_management.php b/apps/maarch_entreprise/admin/users/users_management.php deleted file mode 100755 index f7a7cce4601a45607c9cfaa7f5446384993e68f0..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/users/users_management.php +++ /dev/null @@ -1,215 +0,0 @@ -<?php - -/* Affichage */ -if($mode == "list") -{ - $list = new list_show(); - $list->admin_list( - $users_list['tab'], - count($users_list['tab']), - $users_list['title'], - 'user_id', - 'users_management_controler&mode=list', - 'users','user_id', - true, - $users_list['page_name_up'], - $users_list['page_name_val'], - $users_list['page_name_ban'], - $users_list['page_name_del'], - $users_list['page_name_add'], - $users_list['label_add'], - false, - false, - _ALL_USERS, - _USER, - 'user', - false, - true, - false, - true, - $users_list['what'], - true, - $users_list['autoCompletionArray'] - ); -} -elseif($mode == "up" || $mode == "add") -{ - ?><script type="text/javascript" src="<?php echo $_SESSION['config']['businessappurl'];?>static.php?filename=users_management.js"></script><?php - if($mode == "add") - { - echo '<h1><i class="fa fa-user fa-2x"></i> '._USER_ADDITION.'</h1>'; - } - elseif($mode == "up") - { - echo '<h1><i class="fa fa-user fa-2x"></i> '._USER_MODIFICATION.'</h1>'; - } - echo '<br/>'; - $_SESSION['service_tag'] = 'formuser'; - core_tools::execute_modules_services($_SESSION['modules_services'], 'formuser', "include"); - ?> - <div id="ugc"></div> - <?php - if($state == false) - echo "<br /><br /><br /><br />"._USER.' '._UNKNOWN."<br /><br /><br /><br />"; - else - {?> - <form id="frmuser" class="block" method="post" enctype="multipart/form-data" action="<?php - echo $_SESSION['config']['businessappurl']; - ?>index.php?display=true&admin=users&page=users_management_controler&mode=<?php - functions::xecho($mode);?>" class="forms addforms" style="width:50%;height:auto;"> - <div class="content" style="width:400px;margin:auto;"> - <input type="hidden" name="display" value="true" /> - <input type="hidden" name="admin" value="users" /> - <input type="hidden" name="page" value="users_management_controler" /> - <input type="hidden" name="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> - <?php - if (isset($_SESSION['reactivateUser'])) { - echo $_SESSION['reactivateUser']; - unset($_SESSION['reactivateUser']); - } - ?> - </p> - <p> - <label for="user_id"><?php echo _ID;?> :</label> - <?php if($mode == "up" && isset($_SESSION['m_admin']['users']['user_id'])) { echo functions::show_string($_SESSION['m_admin']['users']['user_id']); }else{ echo '<br/>'; } ?><input name="user_id" type="<?php if($mode == "up") { ?>hidden<?php } elseif($mode == "add") { ?>text<?php } ?>" id="user_id" value="<?php if(isset($_SESSION['m_admin']['users']['user_id'])) {echo functions::show_string($_SESSION['m_admin']['users']['user_id']);} ?>" /> - <span class="red_asterisk"><?php if($mode != "up"){?>*<?php } ?></span> - <!--<input type="hidden" name="id" id="id" value="<?php functions::xecho($id);?>" />--> - </p> - <p> - <label for="LastName"><?php echo _LASTNAME;?> :</label><br/> - <input name="LastName" id="LastName" style="width: 95%;" type="text" value="<?php if(isset($_SESSION['m_admin']['users']['lastname'])){echo functions::show_string($_SESSION['m_admin']['users']['lastname']);} ?>" /> - <span class="red_asterisk"><i class="fa fa-star"></i></span> - </p> - <p> - <label for="FirstName"><?php echo _FIRSTNAME;?> :</label><br/> - <input name="FirstName" style="width: 95%;" id="FirstName" type="text" value="<?php if(isset($_SESSION['m_admin']['users']['firstname'])){ echo functions::show_string($_SESSION['m_admin']['users']['firstname']); }?>" /> - <span class="red_asterisk"><i class="fa fa-star"></i></span> - </p> - <p> - <?php echo _PHONE_NUMBER;?> :<br/> - <input name="Phone" id="Phone" style="width: 95%;" type="text" value="<?php if(isset($_SESSION['m_admin']['users']['phone'])){ functions::xecho($_SESSION['m_admin']['users']['phone']); }?>" /> - </p> - <p> - <label for="Mail"><?php echo _MAIL;?> :</label><br/> - <input name="Mail" id="Mail" style="width: 95%;" type="text" value="<?php if(isset($_SESSION['m_admin']['users']['mail'])){ functions::xecho($_SESSION['m_admin']['users']['mail']); }?>" /> - <span class="red_asterisk"><i class="fa fa-star"></i></span> - </p> - - <?php - if (isset($_SESSION['modules_loaded']['visa'])) { - ?> - <p> - <label for="thumbprint"><?php echo _THUMBPRINT; ?> : </label><br/> - <textarea name="thumbprint" id="thumbprint" style="width: 95%;" ><?php - if(isset($_SESSION['m_admin']['users']['thumbprint'])) { - functions::xecho($_SESSION['m_admin']['users']['thumbprint']); - }?></textarea> - </p> - <p> - <label for="signature"><?php echo _SIGNATURE; ?> : </label><br/> - <input type="file" name="signature" id="signature"/> - <br /> - <br /> - <?php - if (file_exists($_SESSION['m_admin']['users']['pathToSignature'][0])) { - $extension = explode(".", $_SESSION['m_admin']['users']['pathToSignature'][0]); - $count_level = count($extension)-1; - $the_ext = $extension[$count_level]; - $fileNameOnTmp = 'tmp_file_' . $_SESSION['user']['UserId'] - . '_' . rand() . '.' . strtolower($the_ext); - $filePathOnTmp = $_SESSION['config']['tmppath'] . $fileNameOnTmp; - - if (copy($_SESSION['m_admin']['users']['pathToSignature'][0], $filePathOnTmp)) { - ?> - <img src="<?php - echo $_SESSION['config']['businessappurl'] - . '/tmp/' . $fileNameOnTmp; - ?>" alt="signature" id="signFromDs"/> - <?php - } else { - echo _COPY_ERROR; - } - } - ?> - <canvas id="imageCanvas" style="display:none;"></canvas> - <script> - var signature = document.getElementById('signature'); - signature.addEventListener('change', handleImage, false); - var canvas = document.getElementById('imageCanvas'); - var signFromDs = document.getElementById('signFromDs'); - var ctx = canvas.getContext('2d'); - - function handleImage(e){ - var reader = new FileReader(); - reader.onload = function(event){ - var img = new Image(); - img.onload = function(){ - canvas.width = img.width; - canvas.height = img.height; - ctx.drawImage(img,0,0); - canvas.style.display = 'block'; - signFromDs.style.display = 'none'; - } - img.src = event.target.result; - } - reader.readAsDataURL(e.target.files[0]); - } - </script> - </p> - <?php - } - ?> - <p> - <?php echo _LOGIN_MODE;?> :<br/> - <?php - echo '<select name="LoginMode" style="width: 95%;" id="LoginMode">'; - - $ssoLogin = false; - foreach($_SESSION['login_method_memory'] as $METHOD) - { - if($METHOD['ACTIVATED'] == 'true') - { - $vala = ''; - if ($_SESSION['m_admin']['users']['loginmode'] == $METHOD['ID']) - $vala = 'selected="selected"'; - - echo '<option value="'.$METHOD['ID'].'" '.$vala.' >'.constant($METHOD['BRUT_LABEL']).'</option>'; - } - if (($METHOD['ID'] == 'sso' || $METHOD['ID'] == 'cas') && $METHOD['ACTIVATED'] == 'true') { - $ssoLogin = true; - } - } - - echo '</select>'; - ?> - <span class="red_asterisk"><i class="fa fa-star"></i></span> - </p> - <p class="buttons"> - <?php - if($mode == "up" && $_SESSION['config']['ldap'] != "true" && !$ssoLogin) - { - ?> - <input type="button" name="reset_pwd" value="<?php echo _RESET.' '._PASSWORD;?>" class="button" onclick="displayModal('<?php echo $_SESSION['config']['businessappurl'];?>index.php?display=true&admin=users&page=psw_changed', 'pwd_changed', 40, 150);" /> - <?php - } - ?><br/> - <input type="submit" name="user_submit" id="user_submit" value="<?php echo _VALIDATE;?>" class="button"/> - <input type="button" class="button" name="cancel" value="<?php echo _CANCEL;?>" onclick="javascript:window.location.href='<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=users_management_controler&mode=list&admin=users';"/> - </p> - </div> - </form> - <?php - if($mode == "up") - core_tools::execute_modules_services($_SESSION['modules_services'], 'users_up.php', "include");?> - - <script type="text/javascript">updateContent('<?php echo $_SESSION['config']['businessappurl'];?>index.php?display=true&page=ugc_form&admin=users', 'ugc');</script> - <?php - } -} - diff --git a/apps/maarch_entreprise/admin/users/users_management_controler.php b/apps/maarch_entreprise/admin/users/users_management_controler.php deleted file mode 100755 index 4b5ccd9672ff9f133acc7d4933959f04a865ab27..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/admin/users/users_management_controler.php +++ /dev/null @@ -1,1131 +0,0 @@ -<?php -/** -* Copyright Maarch since 2008 under licence GPLv3. -* See LICENCE.txt file at the root folder for more details. -* This file is part of Maarch software. - -* @brief users_management_controler -* @author dev <dev@maarch.org> -* @ingroup apps -*/ - -$core_tools = new core_tools(); -$core_tools->test_admin('admin_users', 'apps'); - -core_tools::load_lang(); -// var_dump($_REQUEST['mode']); -// var_dump($_REQUEST['page']); -$entities_loaded = false; -if (core_tools::is_module_loaded('entities')) { - $entities_loaded = true; -} -// Default mode is add -$mode = 'add'; -if (isset($_REQUEST['mode']) && !empty($_REQUEST['mode'])) { - $mode = $_REQUEST['mode']; -} - -// Include files -try{ - include_once "core/class/usergroups_controler.php"; - include_once "core/class/users_controler.php"; - if ($mode == 'list') { - include_once "core/class/class_request.php"; - include_once "apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_list_show.php"; - } - if (in_array($mode, ['del', 'up', 'add']) && $entities_loaded) { - include_once "modules/entities/class/EntityControler.php"; - } - -} catch (Exception $e){ - functions::xecho($e->getMessage()); -} - -if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) { - $user_id = $_REQUEST['id']; -} - -if (isset($_REQUEST['user_submit'])) { - // Action to do with db - validate_user_submit(); - -} else { - // Display to do - $ugc = new usergroups_controler(); - $state = true; - switch ($mode) { - case "up" : - $state=display_up($user_id); - $_SESSION['service_tag'] = 'user_init'; - core_tools::execute_modules_services($_SESSION['modules_services'], 'user_init', "include"); - $_SESSION['m_admin']['nbgroups'] = $ugc->getUsergroupsCount(); - location_bar_management($mode); - break; - case "add" : - display_add(); - $_SESSION['service_tag'] = 'user_init'; - core_tools::execute_modules_services($_SESSION['modules_services'], 'user_init', "include"); - $_SESSION['m_admin']['nbgroups'] = $ugc->getUsergroupsCount(); - location_bar_management($mode); - break; - case "del" : - display_del($user_id); - break; - case "allow" : - display_enable($user_id); - break; - case "ban" : - $result_Check_Dest = check_dest_listmodels($user_id); - if ($result_Check_Dest == true) { - display_disable($user_id); - } elseif ($result_Check_Dest == false) { ?> - - <script type="text/javascript">window.top.location='<?php echo $_SESSION['config']['businessappurl']."index.php?page=users_management_controler&mode=list&admin=users&order=".$_REQUEST['order']."&order_field=".$_REQUEST['order_field']."&start=".$_REQUEST['start']."&what=".$_REQUEST['what'];?>';</script> - <?php - exit(); - } - break; - case "list" : - $users_list=display_list(); - $_SESSION['m_admin']['nbgroups'] = $ugc->getUsergroupsCount(); - location_bar_management($mode); - break; - case "check_del" : - display_del_check($user_id); - break; - case "check_up" : - display_up_check($user_id); - break; - } - include 'apps/maarch_entreprise/admin/users/users_management.php'; -} - -/** - * [Permet de vérifier si l'utilisateur fait partie d'une liste de diffusion. Si il fait parti d'une liste de diffusion, dans l'administration, il ne pourra etre mis en pause sauf si il n'est plus destinataire.] - * - */ -function check_dest_listmodels($user_id) -{ - // - $db = new Database(); - $stmt = $db->query("select item_id, item_mode from listmodels where item_id = ? and item_mode = 'dest'",array($user_id)); - $res = $stmt->fetchObject(); - if ($res->item_mode == 'dest') { - return false; - } else { - return true; - } - -} -/** - * Management of the location bar - */ -function location_bar_management($mode) -{ - $page_labels = array('add' => _ADDITION, 'up' => _MODIFICATION, 'list' => _USERS_LIST); - $page_ids = array('add' => 'user_add', 'up' => 'user_up', 'list' => 'users_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=users_management_controler&admin=users&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); -} - -/** - * Initialize session parameters for update display - * @param String $user_id - */ -function display_up($user_id) -{ - $uc = new users_controler(); - $ugc = new usergroups_controler(); - $db = new Database(); - - $state=true; - $user = $uc->get($user_id); - - if (empty($user)) { - $state = false; - } else { - include_once "modules" . DIRECTORY_SEPARATOR . "visa" . DIRECTORY_SEPARATOR. "class" . DIRECTORY_SEPARATOR. "class_user_signatures.php"; - $us = new UserSignatures(); - - $query = "select path_template from " - . _DOCSERVERS_TABLE_NAME - . " where docserver_id = 'TEMPLATES'"; - $stmt = $db->query($query); - $resDs = $stmt->fetchObject(); - $pathToDs = $resDs->path_template; - - $tab_sign = $us->getForUser($user->user_id); - $user->pathToSignature = []; - foreach ($tab_sign as $sign) { - $path = $pathToDs . str_replace( - "#", - DIRECTORY_SEPARATOR, - $sign['signature_path'] - ) - . $sign['signature_file_name']; - $user->pathToSignature = [$path]; - } - put_in_session("users", $user->getArray()); - } - - if (($_SESSION['m_admin']['load_group'] == true || !isset($_SESSION['m_admin']['load_group'])) - && $_SESSION['m_admin']['users']['user_id'] <> "superadmin" - ) { - $tmp_array = $uc->getGroups($_SESSION['m_admin']['users']['user_id']); - for ($i=0; $i<count($tmp_array);$i++) { - $group = $ugc->get($tmp_array[$i]['GROUP_ID']); - $tmp_array[$i]['LABEL'] = $group->__get('group_desc'); - } - $_SESSION['m_admin']['users']['groups'] = $tmp_array; - unset($tmp_array); - } - return $state; -} - -/** - * Initialize session parameters for add display - */ -function display_add() -{ - if (!isset($_SESSION['m_admin']['init'])) { - init_session(); - } -} - -/** - * Initialize session parameters for list display - */ -function display_list() -{ - - $_SESSION['m_admin'] = array(); - $list = new list_show(); - $func = new functions(); - init_session(); - - $select[USERS_TABLE] = array(); - array_push($select[USERS_TABLE], 'user_id', 'lastname', 'firstname', 'enabled', 'status', 'mail'); - $where = " ((status = 'OK' or status = 'ABS') and user_id != 'superadmin')"; - $what = ''; - $arrayPDO = array(); - if (isset($_REQUEST['what'])) { - $what = $_REQUEST['what']; - $where .= " and (lower(lastname) like lower(?) or lower(users.user_id) like lower(?) or (users.lastname || ' ' || users.firstname) like ?)"; - $arrayPDO = array($what.'%', $what.'%', $what); - } - - // Checking order and order_field values - $order = 'asc'; - if (isset($_REQUEST['order']) && !empty($_REQUEST['order'])) { - $order = trim($_REQUEST['order']); - } - - $field = 'lastname'; - if(isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) - $field = trim($_REQUEST['order_field']); - - $orderstr = $list->define_order($order, $field); - $request = new request(); - - if ($entities_loaded == true ) { - $tab=$request->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype']); - } else { - include_once 'modules'.DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_manage_entities.php'; - $ent = new entity(); - $my_tab_entities_id = $ent->get_all_entities_id_user($_SESSION['user']['entities']); - - if ($_SESSION['user']['UserId'] != 'superadmin') { - $where = " ((status = 'OK' or status = 'ABS') and users.user_id != 'superadmin') and ((users_entities.entity_id is NULL) or users_entities.entity_id in (".join(',', $my_tab_entities_id)."))"; - } else { - $where = " ((status = 'OK' or status = 'ABS') and users.user_id != 'superadmin')"; - } - - $what = ''; - if (isset($_REQUEST['what'])) { - $what = $_REQUEST['what']; - $where .= " and (lower(lastname) like lower(?) or (users.lastname || ' ' || users.firstname) like ?)"; - $arrayPDO = array($what.'%',$what); - } - - // Checking order and order_field values - $order = 'asc'; - if (isset($_REQUEST['order']) && !empty($_REQUEST['order'])) { - $order = trim($_REQUEST['order']); - } - - $field = 'lastname'; - if (isset($_REQUEST['order_field']) && !empty($_REQUEST['order_field'])) { - $field = trim($_REQUEST['order_field']); - } - - $orderstr = $list->define_order($order, $field); - $tab=$request->PDOselect($select, $where, $arrayPDO, $orderstr, $_SESSION['config']['databasetype'], 'default', 'users_entities', 'users','users_entities', 'user_id', true, false, true); - - } - for ($i=0;$i<count($tab);$i++) { - foreach ($tab[$i] as &$item) { - switch ($item['column']) { - case "user_id": - format_item($item, _ID, "20", "left", "left", "bottom", true); - break; - case "lastname": - format_item($item, _LASTNAME, "20", "left", "left", "bottom", true); - break; - case "firstname": - format_item($item, _FIRSTNAME, "20", "left", "left", "bottom", true); - break; - case "enabled": - format_item($item, _STATUS, "3", "left", "center", "bottom", true); - break; - case "mail": - format_item($item, _MAIL, "27", "left", "left", "bottom", true); - break; - case "status": - if ($item['value'] == "ABS") { - $item['value'] = "<em>("._MISSING.")</em>"; - } else { - $item['value'] = ''; - } - format_item($item, '', "5", "left", "left", "bottom", true, false); - break; - } - } - } - - /* - * TODO Pour éviter les actions suivantes, il y a 2 solutions : - * - La plus propre : créer un objet "PageList" - * - La plus locale : si cela ne sert que pour admin_list dans classification_scheme_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'] = "users_management_controler&mode=list"; - $result['page_name_up'] = "users_management_controler&mode=up"; - $result['page_name_del'] = "users_management_controler&mode=del"; - $result['page_name_val']= "users_management_controler&mode=allow"; - $result['page_name_ban'] = "users_management_controler&mode=ban"; - $result['page_name_add'] = "users_management_controler&mode=add"; - $result['label_add'] = _USER_ADDITION; - $_SESSION['m_admin']['init'] = true; - $result['title'] = _USERS_LIST." : ".$i." "._USERS; - $result['autoCompletionArray'] = array(); - $result['autoCompletionArray']["list_script_url"] = $_SESSION['config']['businessappurl']."index.php?display=true&admin=users&page=users_list_by_name"; - $result['autoCompletionArray']["number_to_begin"] = 1; - return $result; -} - -/** - * Delete given user if exists and initialize session parameters - * @param unknown_type $user_id - */ -function display_del($user_id) -{ - $uc = new users_controler(); - - // information liste(s) de diffusion exists in users - $listDiffusion=array(); - $db = new Database(); - $stmt = $db->query( - "select * from listmodels WHERE item_id=? AND item_mode='dest'", - array($user_id) - ); - while ($res = $stmt->fetchObject()) { - array_push($listDiffusion, $res->description); - } - - if (!empty($listDiffusion)) { ?> - <script type="text/javascript">window.top.location='<?php - echo $_SESSION['config']['businessappurl'] . 'index.php?page=' - . 'users_management_controler&mode=check_del&admin=users&id=' . $user_id; - ?>';</script> - <?php exit(); - } - - $user = $uc->get($user_id); - if (isset($user)) { - // Deletion - $control = array(); - $params = array( 'log_user_del' => $_SESSION['history']['usersdel'], - 'databasetype' => $_SESSION['config']['databasetype'] - ); - $control = $uc->delete($user, $params); - if (!empty($control['error']) && $control['error'] <> 1) { - $_SESSION['error'] = str_replace("#", "<br />", $control['error']); - } else { - $_SESSION['info'] = _DELETED_USER.' : '.$user_id; - } - - ?><script type="text/javascript">window.top.location='<?php echo $_SESSION['config']['businessappurl']."index.php?page=users_management_controler&mode=list&admin=users&order=".functions::xssafe($_REQUEST['order'])."&order_field=".functions::xssafe($_REQUEST['order_field'])."&start=".functions::xssafe($_REQUEST['start'])."&what=".functions::xssafe($_REQUEST['what']);?>';</script> - <?php - exit; - } else { - // Error management - $_SESSION['error'] = _USER.' '._UNKNOWN; - } -} - - -function display_del_check($user_id) -{ - /****************Management of the location bar ************/ - $admin = new core_tools(); - $db = new Database(); - $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=users'; - $pageLabel = _DELETION; - $pageId = "users"; - $admin->manage_location_bar($pagePath, $pageLabel, $pageId, $init, $level); - /***********************************************************/ - - if (isset($_POST['user_id'])) { - $old_user=$_POST['id']; - $new_user=$_POST['user_id']; - - $listDiffusion=array(); - - $stmt = $db->query( - "select * from listmodels WHERE item_id=? AND item_mode='dest'", - array($user_id) - ); - while ($res = $stmt->fetchObject()) { - array_push($listDiffusion, $res->object_id); - } - - // Mise à jour des enregistrements (egal suppression puis insertion) - $listDiffusion_sql = "'".implode("','", $listDiffusion)."'"; - $db->query( - "update listmodels set item_id=:newItemId where item_id=:oldItemId and object_id in (" .$listDiffusion_sql. ")", - array( - ':newItemId' => $new_user, - ':oldItemId' => $old_user, - ) - ); - - $_SESSION['info'] = _DELETED_USER.' : '.$old_user; - - ?> - <script type="text/javascript">window.top.location='<?php - echo $_SESSION['config']['businessappurl'] . 'index.php?page=users_management_controler&mode=del&admin=users&id=' . $user_id;?>';</script> <?php - } - - $listDiffusion=array(); - $stmt = $db->query( - "select * from listmodels list, entities it WHERE list.object_id = it.entity_id and item_id=? AND item_mode='dest'", - array($user_id) - ); - while ($res = $stmt->fetchObject()) { - array_push($listDiffusion, $res->entity_label); - } - - echo '<h1><i class="fa fa-users fa-2x"></i>'._USER_DELETION.': <i>'.$user_id.'</i></h1>'; - echo "<div class='error' id='main_error'>".$_SESSION['error']."</div>"; - $_SESSION['error'] = ""; - ?> - <br> - <div class="block"> - <div id="main_error" style="text-align:center;"> - <b><?php - echo _WARNING_MESSAGE_DEL_USER; - ?></b> - </div> - <br/> - <form name="user_del" id="user_del" style="width: 350px;margin:auto;" method="post" class="forms"> - <input type="hidden" value="<?php functions::xecho($user_id);?>" name="id"> - <?php - echo "<h3>".count($listDiffusion)." "._LISTE_DIFFUSION_IN_USER .":</h3>"; - echo "<ul>"; - foreach ($listDiffusion as $key => $value) { - echo "<li>".$value."</li>"; - } - echo "</ul>"; - ?> - <br> - <br> - <select name="user_id" id="user_id" data-placeholder="<?php echo _CHOOSE_USER2 ;?>"> - <option value="no_user"><?php echo _NO_REPLACEMENT;?></option> - <?php - $stmt = $db->query("select * from users order by user_id ASC"); - while ($users = $stmt->fetchObject()) { - if ($users->user_id != $user_id) { - ?> - <option value="<?php functions::xecho($users->user_id);?>"><?php functions::xecho($users->lastname . " " . $users->firstname);?></option> - <?php - } - - } - ?> - </select> - <p class="buttons"> - <input type="submit" value="<?php echo _DEL_AND_REAFFECT;?>" name="valid" class="button" onclick='if(document.getElementById("doc_type_id").options[document.getElementById("doc_type_id").selectedIndex].value == ""){alert("<?php echo _CHOOSE_REPLACEMENT_DOCTYPES ?> !");return false;}else{return(confirm("<?php echo _REALLY_DELETE.$s_id;?> \n\r\n\r<?php echo _DEFINITIVE_ACTION?>"));}'/> - <input type="button" value="<?php echo _CANCEL;?>" class="button" onclick="window.location.href='<?php echo $_SESSION['config']['businessappurl'] ?>index.php?page=usergroups_management_controler&mode=list&admin=groups&order=<?php functions::xecho($_REQUEST['order']);?>&order_field=<?php functions::xecho($_REQUEST['order_field']);?>&start=<?php functions::xecho($_REQUEST['start']);?>&what=<?php functions::xecho($_REQUEST['what']);?>';"/> - </p> - </form> - </div> - <script type="text/javascript">$j("#user_id").chosen({width: "auto", disable_search_threshold: 10, search_contains: true, allow_single_deselect: true}); - </script> - - <?php - exit(); -} - -function display_up_check($user_id) -{ - - /****************Management of the location bar ************/ - $admin = new core_tools(); - $db = new Database(); - $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=users'; - $pageLabel = _UPDATE; - $pageId = "users"; - $admin->manage_location_bar($pagePath, $pageLabel, $pageId, $init, $level); - /***********************************************************/ - $_SESSION['info'] = _USER_UPDATED; - if (isset($_POST['user_id'])) { - $old_user=$_POST['id']; - $new_user=$_POST['user_id']; - - if ($new_user <> 'no_user') { - //LIST OF ENTITIES - $resListToCheck = []; - - foreach ($_SESSION['m_admin']['entitiesUserToRedirect']['entity_id'] as $entity) { - //CHECK LISTMODEL - if (isset($_POST['entityModels'])) { - $query = "UPDATE listmodels SET item_id = ? WHERE object_id = ? AND item_id = ?"; - $arrayPDO = array($new_user,$entity,$old_user); - $db->query($query, $arrayPDO); - } - - //CHECK DIFFLIST - $query = "SELECT distinct(r.res_id),r.dest_user FROM res_view_letterbox r INNER JOIN listinstance l ON r.res_id = l.res_id WHERE confidentiality = 'Y' AND destination = ? AND typist <> ? AND item_id = ? AND closing_date is null AND difflist_type = 'entity_id' and process_date is null"; - $arrayPDO = array($entity,$old_user,$old_user); - $stmt = $db->query($query, $arrayPDO); - while ($res = $stmt->fetchObject()) { - $resListToCheck[] = $res->res_id; - $destList[] = $res->dest_user; - } - - } - $i=0; - foreach ($resListToCheck as $res_id) { - if ($destList[$i] == $old_user) { - //UPDATE res_letterbox for dest - $query = "UPDATE res_letterbox SET dest_user = ? WHERE res_id = ?"; - $arrayPDO = array($new_user,$res_id); - $db->query($query, $arrayPDO); - } - - //UDPATE listinstance for all item_mode - $query = "UPDATE listinstance SET item_id = ? WHERE res_id = ? AND item_id = ? AND difflist_type = 'entity_id'"; - $arrayPDO = array($new_user, $res_id, $old_user); - $db->query($query, $arrayPDO); - - //ADD history entry - $query = "SELECT listinstance_id, item_mode FROM listinstance WHERE res_id = ? and item_id = ? AND difflist_type = 'entity_id'"; - $arrayPDO = array($res_id,$new_user); - $stmt = $db->query($query, $arrayPDO); - while ($res = $stmt->fetchObject()) { - $listinstance_id = $res->listinstance_id; - $item_mode = $res->item_mode; - include_once 'core' . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'class_history.php'; - $hist = new history(); - $hist->add( - ENT_LISTINSTANCE, - $listinstance_id, - 'UP', - 'diff'.$item_mode.'user', - 'Réaffectation du document confidentiel '.$res_id.' de '. $old_user .' à '. $new_user . ' en tant que "'.$item_mode.'"', - $_SESSION['config']['databasetype'], - 'entities' - ); - } - $i++; - } - - $resListToCheck = []; - foreach ($_SESSION['m_admin']['entitiesUserToRedirect']['entity_id'] as $entity) { - //CHECK VISA_CIRCUIT - $query = "SELECT distinct(r.res_id) FROM res_view_letterbox r INNER JOIN listinstance l ON r.res_id = l.res_id WHERE confidentiality = 'Y' AND destination = ? AND typist <> ? AND item_id = ? AND closing_date is null AND difflist_type = 'VISA_CIRCUIT' and process_date is null"; - $arrayPDO = array($entity,$old_user,$old_user); - $stmt = $db->query($query, $arrayPDO); - while ($res = $stmt->fetchObject()) { - $resListToCheck[] = $res->res_id; - } - } - foreach ($resListToCheck as $res_id) { - - //UDPATE listinstance - $query = "UPDATE listinstance SET item_id = ? WHERE res_id = ? AND item_id = ? AND difflist_type = 'VISA_CIRCUIT' and process_date is null"; - $arrayPDO = array($new_user,$res_id,$old_user); - $db->query($query, $arrayPDO); - - //ADD history entry - $query = "SELECT listinstance_id FROM listinstance WHERE res_id = ? AND item_id = ? AND difflist_type = 'VISA_CIRCUIT'"; - $arrayPDO = array($res_id,$new_user); - $stmt = $db->query($query, $arrayPDO); - $res = $stmt->fetchObject(); - $listinstance_id = $res->listinstance_id; - include_once 'core' . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'class_history.php'; - $hist = new history(); - $hist->add( - ENT_LISTINSTANCE, - $listinstance_id, - 'UP', - 'diffvisauser', - 'Réaffectation du document confidentiel '.$res_id.' de '. $old_user .' à '. $new_user . ' dans le circuit de visa', - $_SESSION['config']['databasetype'], - 'entities' - ); - - } - } else { - - $resListToCheck = []; - foreach ($_SESSION['m_admin']['entitiesUserToRedirect']['entity_id'] as $entity) { - if (isset($_POST['entityModels'])) { - //CHECK LISTMODELS - $query = "DELETE FROM listmodels WHERE item_id = ? AND object_id = ? AND item_mode <> 'dest'"; - $arrayPDO = array($old_user,$entity); - $db->query($query, $arrayPDO); - - } - - //CHECK VISA_CIRCUIT - $query = "SELECT distinct(r.res_id) FROM res_view_letterbox r INNER JOIN listinstance l ON r.res_id = l.res_id WHERE confidentiality = 'Y' AND destination = ? AND typist <> ? AND item_id = ? AND closing_date is null AND difflist_type = 'VISA_CIRCUIT' and process_date is null"; - $arrayPDO = array($entity,$old_user,$old_user); - $stmt = $db->query($query, $arrayPDO); - while ($res = $stmt->fetchObject()) { - $resListToCheck[] = $res->res_id; - } - } - - foreach ($resListToCheck as $res_id) { - - //UDPATE listinstance - $query = "UPDATE listinstance SET item_id = ?, process_comment = '[DEL] supprimé - changement d’entité', process_date = CURRENT_TIMESTAMP WHERE res_id = ? AND item_id = ? AND difflist_type = 'VISA_CIRCUIT' and process_date is null"; - $arrayPDO = array($old_user,$res_id,$old_user); - $db->query($query, $arrayPDO); - - $query = "SELECT l.listinstance_id,r.status FROM listinstance l INNER JOIN res_letterbox r ON l.res_id = r.res_id WHERE l.res_id = ? AND l.item_id = ? AND l.difflist_type = 'VISA_CIRCUIT'"; - $arrayPDO = array($res_id,$old_user); - $stmt = $db->query($query, $arrayPDO); - $res = $stmt->fetchObject(); - $listinstance_id = $res->listinstance_id; - $status = $res->status; - - //Update status to ESIG if necessary - include_once "modules" . DIRECTORY_SEPARATOR . "visa" . DIRECTORY_SEPARATOR . "class" . DIRECTORY_SEPARATOR . "class_modules_tools.php"; - if ($status == 'EVIS') { - - $visa = new visa(); - $visa->setStatusVisa($res_id, 'letterbox_coll'); - - } - - //Update status to EVIS if necessary - if ($status == 'ESIG') { - - $visa = new visa(); - $visa->setStatusVisa($res_id, 'letterbox_coll'); - - $whereSub = "res_id = ? AND item_mode = 'visa' AND difflist_type = 'VISA_CIRCUIT'"; - $orderSub = "ORDER BY sequence DESC"; - $subQuery = $db->limit_select(0, 1, 'listinstance_id', 'listinstance', $whereSub, '', '', $orderSub); - - $arrayPDO = array($res_id); - $stmt = $db->query($subQuery, $arrayPDO); - while ($resSub = $stmt->fetchObject()) { - $listinstanceIDs[] = $resSub->listinstance_id; - } - if (count($listinstanceIDs) > 0) { - $query = "UPDATE listinstance SET process_comment = null, process_date = null WHERE listinstance_id in (?)"; - $db->query($query, $listinstanceIDs); - } - - } - - //ADD history entry - include_once 'core' . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'class_history.php'; - $hist = new history(); - $hist->add( - ENT_LISTINSTANCE, - $listinstance_id, - 'UP', - 'diffvisauser', - 'Désactivation de l\'utilisateur '. $old_user .' dans le circuit de visa du document confidentiel '.$res_id, - $_SESSION['config']['databasetype'], - 'entities' - ); - - } - $resListToCheck = []; - foreach ($_SESSION['m_admin']['entitiesUserToRedirect']['entity_id'] as $entity) { - //CHECK Listinstance - $query = "SELECT distinct(r.res_id) FROM res_view_letterbox r INNER JOIN listinstance l ON r.res_id = l.res_id WHERE confidentiality = 'Y' AND destination = ? AND closing_date is null AND typist <> ? AND item_id = ? AND difflist_type = 'entity_id' AND item_mode <> 'dest' AND process_date is null"; - $arrayPDO = array($entity,$old_user,$old_user); - $stmt = $db->query($query, $arrayPDO); - while ($res = $stmt->fetchObject()) { - $resListToCheck[] = $res->res_id; - } - } - - foreach ($resListToCheck as $res_id) { - - //UDPATE listinstance - $query = "UPDATE listinstance SET item_id = ?, process_comment = '[DEL] supprimé - changement d’entité', process_date = CURRENT_TIMESTAMP WHERE res_id = ? AND item_id = ? AND difflist_type = 'entity_id' AND process_date is null and item_mode <> 'dest'"; - $arrayPDO = array($old_user,$res_id,$old_user); - $db->query($query, $arrayPDO); - - //ADD history entry - $query = "SELECT listinstance_id,item_mode FROM listinstance WHERE res_id = ? AND item_id = ? AND difflist_type = 'entity_id'"; - $arrayPDO = array($res_id,$old_user); - $stmt = $db->query($query, $arrayPDO); - while ($res = $stmt->fetchObject()) { - $listinstance_id = $res->listinstance_id; - $item_mode = $res->item_mode; - include_once 'core' . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'class_history.php'; - $hist = new history(); - $hist->add( - ENT_LISTINSTANCE, - $listinstance_id, - 'UP', - 'diff'.$item_mode.'user', - 'Désactivation de l\'utilisateur '. $old_user .' en tant que "'.$item_mode.'" du document confidentiel '.$res_id, - $_SESSION['config']['databasetype'], - 'entities' - ); - } - - } - - } - //echo '<script type="text/javascript">window.top.location=\''.$_SESSION['config']['businessappurl'] .'index.php?page=users_management_controler&admin=users&id='.$old_user.'&mode=up\'</script>'; - echo '<script type="text/javascript">window.top.location=\''.$_SESSION['config']['businessappurl'] .'index.php?page=users_management_controler&admin=users&mode=list\'</script>'; - } - $frm = ''; - $frm .= '<h1><i class="fa fa-user fa-2x"></i> '._UPDATE.' '.strtolower(_USER).': <i>'.$user_id.'</i></h1>'; - $frm .= '<div class="error" id="main_error">'.$_SESSION['error'].'</div>'; - $_SESSION['error'] = ""; - $frm .= '<br>'; - $frm .= '<div class="block">'; - - //INFO BLOCK - $frm .= '<h3 style="text-align:center;"><i class="fa fa-info-circle"></i> '._INFO_MESSAGE_UPDATE_USER.'</h3>'; - - //RESLIST - $frm .= '<br/>'; - $frm .= '<ul style="width: 400px;margin: auto;">'; - for ($i=0;$i<count($_SESSION['m_admin']['entitiesUserToRedirect']['entity_id']);$i++) { - $frm .= '<li style="list-style: inside;"><b>'.$_SESSION['m_admin']['entitiesUserToRedirect']['nbDocs'][$i].'</b> '._CONFIDENTIAL_DOCUMENTS .' ('._ENTITY.' <b>'.$_SESSION['m_admin']['entitiesUserToRedirect']['entity_id'][$i].')</b></li>'; - } - $frm .= '</ul>'; - $frm .= '<br/>'; - - //USER LIST REPLACEMENT - $frm .= '<form name="user_del" id="user_del" style="width: 100%;text-align:center;margin:auto;" method="post" class="forms">'; - $frm .= '<input type="hidden" value="'.$user_id.'" name="id">'; - $frm .= '<select name="user_id" id="user_id" data-placeholder="'._NO_REPLACEMENT.'">'; - $frm .= '<option value="no_user"></option>'; - $stmt = $db->query("select * from users order by user_id ASC"); - while ($users = $stmt->fetchObject()) { - if ($users->user_id != $user_id) { - $frm .= '<option value="'.$users->user_id.'">'.$users->lastname.' '.$users->firstname.'</option>'; - } - } - $frm .= '</select>'; - - //CLEAN LISTMODEL BUTTON - $frm .= '<input type="checkbox" name="entityModels" id="entityModels" /> '._MESSAGE_REAFFECT_USER_LISTMODEL; - - $frm .= '<br/>'; - $frm .= '<br/>'; - - //WARNING BLOCK - $frm .= '<p style="text-align:center;color:red;"><i class="fa fa-warning"></i> '._WARNING_MESSAGE_UPDATE_USER.'</p>'; - $frm .= '<p style="text-align:center;"><i class="fa fa-info-circle"></i> '._INFO_MESSAGE_UPDATE_USER2.'</p>'; - - //ACTIONS BUTTONS - $frm .= '<p class="buttons">'; - $frm .= '<input type="submit" value="'._DEL_AND_REAFFECT.'" name="valid" class="button" onclick="if (!confirm(\''. _REALLY_CONTINUE .' ?\')){return false;}" />'; - $frm .= ' <input type="button" value="'._NO_REAFFECT.'" class="button" onclick="if (confirm(\''. _REALLY_CONTINUE .' ?\')){window.location.href=\''.$_SESSION['config']['businessappurl'].'index.php?page=users_management_controler&mode=list&admin=users&order='.$_REQUEST['order'].'&order_field='.$_REQUEST['order_field'].'&start='.$_REQUEST['start'].'&what='.$_REQUEST['what'].'\';}" />'; - $frm .= '</p>'; - - $frm .= '</form>'; - $frm .= '</div>'; - //script - $frm .= '<script>'; - $frm .= '$j("#user_id").chosen({width: "220px", disable_search_threshold: 10, search_contains: true,allow_single_deselect: true});'; - - $frm .= '</script>'; - /*****************/ - echo $frm; - exit(); -} - -/** - * Enable given user if exists and initialize session parameters - * @param unknown_type $user_id - */ -function display_enable($user_id) -{ - $uc = new users_controler(); - $user = $uc->get($user_id); - if (isset($user)) { - $control = array(); - $params = array(); - if (isset($_SESSION['history']['usersval'])) { - $params['log_user_enabled'] = $_SESSION['history']['usersval']; - } - if (isset($_SESSION['config']['databasetype'])) { - $params['databasetype'] = $_SESSION['config']['databasetype']; - } else { - $params['databasetype'] = 'POSTGRESQL'; - } - - $control = $uc->enable($user, $params); - $_SESSION['error'] = ''; - if (!empty($control['error']) && $control['error'] <> 1) { - $_SESSION['error'] = str_replace("#", "<br />", $control['error']); - } else { - $_SESSION['info'] = _AUTORIZED_USER.' : '.$user_id; - } - - ?><script type="text/javascript"> - window.top.location='<?php echo $_SESSION['config']['businessappurl']."index.php?page=users_management_controler&mode=list&admin=users&order=".$_REQUEST['order']."&order_field=".$_REQUEST['order_field']."&start=".$_REQUEST['start']."&what=".$_REQUEST['what'];?>';</script> - <?php - exit(); - } else { - // Error management - $_SESSION['error'] = _USER.' '._UNKNOWN; - } -} - -/** - * Disable given user if exists and initialize session parameters - * @param unknown_type $user_id - */ -function display_disable($user_id) -{ - $uc = new users_controler(); - $user = $uc->get($user_id); - if (isset($user)) { - $control = array(); - $params = array(); - if (isset($_SESSION['history']['usersban'])) { - $params['log_user_disabled'] = $_SESSION['history']['usersban']; - } - if (isset($_SESSION['config']['databasetype'])) { - $params['databasetype'] = $_SESSION['config']['databasetype']; - } else { - $params['databasetype'] = 'POSTGRESQL'; - } - - $control = $uc->disable($user, $params); - if (!empty($control['error']) && $control['error'] <> 1) { - $_SESSION['error'] = str_replace("#", "<br />", $control['error']); - } else { - $_SESSION['info'] = _SUSPENDED_USER.' : '.$user_id; - } - - ?><script type="text/javascript">window.top.location='<?php echo $_SESSION['config']['businessappurl']."index.php?page=users_management_controler&mode=list&admin=users&order=".$_REQUEST['order']."&order_field=".$_REQUEST['order_field']."&start=".$_REQUEST['start']."&what=".$_REQUEST['what'];?>';</script> - <?php - exit(); - } else { - // Error management - $_SESSION['error'] = _USER.' '._UNKNOWN; - } -} - -/** - * Format given item with given values, according with HTML formating. - * NOTE: given item needs to be an array with at least 2 keys: - * 'column' and 'value'. - * NOTE: given item is modified consequently. - * @param $item - * @param $label - * @param $size - * @param $label_align - * @param $align - * @param $valign - * @param $show - */ -function format_item(&$item,$label,$size,$label_align,$align,$valign,$show,$order= true) -{ - $func = new functions(); - $item['value']=$func->show_string($item['value']); - $item[$item['column']]=$item['value']; - $item["label"]=$label; - $item["size"]=$size; - $item["label_align"]=$label_align; - $item["align"]=$align; - $item["valign"]=$valign; - $item["show"]=$show; - if ($order) { - $item["order"]=$item['value']; - } else { - $item["order"]=''; - } -} - -/** - * Validate a submit (add or up), - * up to saving object - */ -function validate_user_submit() -{ - $uc = new users_controler(); - $ec = new EntityControler(); - $db = new Database(); - - $pageName = "users_management_controler"; - - //check del services - $entitiesUserCheck = $ec->getUsersEntities($_REQUEST['user_id']); - $entitiesUserToRedirect = []; - //var_dump($_SESSION['m_admin']['entity']['entities']); - for ($i=0;$i<count($_SESSION['m_admin']['entity']['entities']);$i++) { - $newUserEntitiesList[] = $_SESSION['m_admin']['entity']['entities'][$i]['ENTITY_ID']; - } - for ($i=0;$i<count($entitiesUserCheck);$i++) { - if (!in_array($entitiesUserCheck[$i]['ENTITY_ID'], $newUserEntitiesList)) { - $query = "SELECT count(distinct(r.res_id)) - FROM res_view_letterbox r - INNER JOIN listinstance l ON r.res_id = l.res_id WHERE ( - (dest_user = ? and item_id = ?) OR - (item_id = ? AND difflist_type = 'entity_id' AND (process_comment is null or process_comment = '')) OR - (item_id = ? AND difflist_type = 'VISA_CIRCUIT' AND process_date is null) - ) - AND closing_date is null AND confidentiality = 'Y' AND destination = ?"; - $arrayPDO = array($_REQUEST['user_id'],$_REQUEST['user_id'],$_REQUEST['user_id'],$_REQUEST['user_id'],$entitiesUserCheck[$i]['ENTITY_ID']); - $stmt = $db->query($query, $arrayPDO); - $res = $stmt->fetchObject(); - if ($res->count > 0) { - $entitiesUserToRedirect['entity_id'][] = $entitiesUserCheck[$i]['ENTITY_ID']; - $entitiesUserToRedirect['nbDocs'][] = $res->count; - } - } - } - - - $mode = $_REQUEST['mode']; - $user = new users(); - $user->user_id=$_REQUEST['user_id']; - $_SESSION['m_admin']['users']['user_id']=$_REQUEST['user_id']; - - if (isset($_REQUEST['reactivate'])) { - $mode='up'; - $uc->reactivate($user); - } - - if ($mode == "add") { - if (isset($_SESSION['config']['userdefaultpassword']) && !empty($_SESSION['config']['userdefaultpassword'])) { - $user->password = $_SESSION['config']['userdefaultpassword']; - } else { - $user->password = 'maarch'; - } - } - $user->firstname = $_REQUEST['FirstName']; - $user->lastname = $_REQUEST['LastName']; - if (isset($_REQUEST['Department']) && !empty($_REQUEST['Department'])) { - $user->department = $_REQUEST['Department']; - } - if (isset($_REQUEST['Phone']) && !empty($_REQUEST['Phone'])) { - $user->phone = $_REQUEST['Phone']; - } - if (isset($_REQUEST['LoginMode']) && !empty($_REQUEST['LoginMode'])) { - $user->loginmode = $_REQUEST['LoginMode']; - } - if (isset($_REQUEST['Mail']) && !empty($_REQUEST['Mail'])) { - $user->mail = $_REQUEST['Mail']; - } - if (isset($_REQUEST['thumbprint']) && !empty($_REQUEST['thumbprint'])) { - $user->thumbprint = trim($_REQUEST['thumbprint']); - } - - if (isset($_FILES['signature']['name']) && !empty($_FILES['signature']['name'])) { - $extension = explode(".", $_FILES['signature']['name']); - $count_level = count($extension)-1; - $the_ext = $extension[$count_level]; - $fileNameOnTmp = 'tmp_file_' . $_SESSION['user']['UserId'] - . '_' . rand() . '.' . strtolower($the_ext); - $filePathOnTmp = $_SESSION['config']['tmppath'] . $fileNameOnTmp; - - if (!is_uploaded_file($_FILES['signature']['tmp_name'])) { - $_SESSION['error'] = _FILE_NOT_SEND . ". " . _TRY_AGAIN - . ". " . _MORE_INFOS . " (<a href=\"mailto:" - . $_SESSION['config']['adminmail'] . "\">" - . $_SESSION['config']['adminname'] . "</a>)"; - } elseif (!@move_uploaded_file($_FILES['signature']['tmp_name'], $filePathOnTmp)) { - $_SESSION['error'] = _FILE_NOT_SEND . ". " . _TRY_AGAIN . ". " - . _MORE_INFOS . " (<a href=\"mailto:" - . $_SESSION['config']['adminmail'] . "\">" - . $_SESSION['config']['adminname'] . "</a>)"; - } else { - include_once 'core/docservers_tools.php'; - $arrayIsAllowed = array(); - $arrayIsAllowed = Ds_isFileTypeAllowed($filePathOnTmp); - if (strtolower($the_ext) <> 'jpg' && strtolower($the_ext) <> 'jpeg') { - $_SESSION['error'] = _WRONG_FILE_TYPE . ' ' . $arrayIsAllowed['mime_type']; - $_SESSION['upfile'] = array(); - } else if ($arrayIsAllowed['status'] == false) { - $_SESSION['error'] = _WRONG_FILE_TYPE . ' ' . $arrayIsAllowed['mime_type']; - $_SESSION['upfile'] = array(); - } else { - include_once 'core/class/docservers_controler.php'; - $docservers_controler = new docservers_controler(); - $fileTemplateInfos = array( - 'tmpDir' => $_SESSION['config']['tmppath'], - 'size' => $_FILES['signature']['size'], - 'format' => $the_ext, - 'tmpFileName' => $fileNameOnTmp, - ); - $storeInfos = $docservers_controler->storeResourceOnDocserver( - 'templates', - $fileTemplateInfos - ); - if (!file_exists( - $storeInfos['path_template'] - . str_replace("#", DIRECTORY_SEPARATOR, $storeInfos['destination_dir']) - . $storeInfos['file_destination_name'] - ) - ) { - $_SESSION['error'] = _FILE_NOT_EXISTS . ' : ' . $storeInfos['path_template'] - . str_replace("#", DIRECTORY_SEPARATOR, $storeInfos['destination_dir']) - . $storeInfos['file_destination_name']; - return false; - } else { - $user->signature_path = $storeInfos['destination_dir']; - $user->signature_file_name = $storeInfos['file_destination_name']; - } - } - } - } - - $status= array(); - $status['order']=$_REQUEST['order']; - $status['order_field']=$_REQUEST['order_field']; - $status['what']=$_REQUEST['what']; - $status['start']=$_REQUEST['start']; - - if (isset($_SESSION['config']['userdefaultpassword']) && !empty($_SESSION['config']['userdefaultpassword'])) { - $tmp_pass = $_SESSION['config']['userdefaultpassword']; - } else { - $tmp_pass = 'maarch'; - } - - $control = array(); - $params = array('modules_services' => $_SESSION['modules_services'], - 'log_user_up' => $_SESSION['history']['usersup'], - 'log_user_add' => $_SESSION['history']['usersadd'], - 'databasetype' => $_SESSION['config']['databasetype'], - 'userdefaultpassword' => $tmp_pass, - ); - - if (isset($_SESSION['m_admin']['users']['groups'])) { - $query = $db->limit_select(0, 1, 'id', 'user_signatures', 'user_id = ? order by id desc '); - $stmt = $db->query($query, array($user->{'user_id'})); - $id_user_signature = $stmt->fetchObject(); - if ($id_user_signature && isset($user->{'signature_path'})) { - $db->query('UPDATE user_signatures SET signature_label = ?, signature_path = ?, signature_file_name = ? WHERE user_id = ? and id = ?', ['', $user->{'signature_path'}, $user->{'signature_file_name'}, $user->{'user_id'}, $id_user_signature->id]); - } elseif(isset($user->{'signature_path'})) { - $db->query('INSERT INTO user_signatures (user_id, signature_label, signature_path, signature_file_name) VALUES (?, ?, ?, ?)', [$user->{'user_id'}, '', $user->{'signature_path'}, $user->{'signature_file_name'}]); - } - $control = $uc->save($user, $_SESSION['m_admin']['users']['groups'], $mode, $params); - } - if (!empty($entitiesUserToRedirect)) { - $_SESSION['m_admin']['entitiesUserToRedirect'] = $entitiesUserToRedirect; - header("location: ".$_SESSION['config']['businessappurl']."index.php?page=".$pageName."&mode=check_up&id=".$_REQUEST['user_id']."&admin=users"); - exit(); - } - if (!empty($control['error']) && $control['error'] <> 1) { - // Error management depending of mode - $_SESSION['error'] = str_replace("#", "<br />", $control['error']); - put_in_session("status", $status); - put_in_session("users",$user->getArray()); - switch ($mode) { - case "up": - if (!empty($user->user_id)) { - header("location: ".$_SESSION['config']['businessappurl']."index.php?page=".$pageName."&mode=up&id=".$user->user_id."&admin=users"); - } else { - header("location: ".$_SESSION['config']['businessappurl']."index.php?page=".$pageName."&mode=list&admin=users&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&admin=users"); - exit; - } - } else { - if ($mode == "add") { - $_SESSION['info'] = _USER_ADDED; - } else { - $_SESSION['info'] = _USER_UPDATED; - } - unset($_SESSION['m_admin']); - header("location: ".$_SESSION['config']['businessappurl']."index.php?page=".$pageName."&mode=list&admin=users&order=".$status['order']."&order_field=".$status['order_field']."&start=".$status['start']."&what=".$status['what']); - //header("location: ".$_SESSION['config']['businessappurl']."index.php?page=".$pageName."&mode=up&admin=users&id=".$_REQUEST['user_id']."&order=".$status['order']."&order_field=".$status['order_field']."&start=".$status['start']."&what=".$status['what']); - } -} - -function init_session() -{ - $_SESSION['m_admin']['users'] = array(); - $_SESSION['m_admin']['users']['groups'] = array(); - $_SESSION['m_admin']['users']['nbbelonginggroups'] = 0; - $_SESSION['m_admin']['init'] = false ; - $_SESSION['m_admin']['load_group'] = true; -} - -/** - * Put given object in session, according with given type - * NOTE: given object needs to be at least hashable - * @param string $type - * @param hashable $hashable - */ -function put_in_session($type,$hashable, $show_string = true) -{ - $func = new functions(); - foreach ($hashable as $key=>$value) { - if ($show_string) { - $_SESSION['m_admin'][$type][$key]=$func->show_string($value); - } else { - $_SESSION['m_admin'][$type][$key]=$value; - } - } -} -?> diff --git a/apps/maarch_entreprise/class/class_reopen_mail.php b/apps/maarch_entreprise/class/class_reopen_mail.php deleted file mode 100755 index 79fdf0d9ebc26ce5e44a0ea57e0fe85f45e0e793..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/class/class_reopen_mail.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php - -/* -* -* Copyright 2015 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/>. -*/ - -/** -* Reopen Mail Class -* -* Contains all the specific functions to reopen mail -* -* @package Maarch LetterBox 2.0 -* @version 2.0 -* @since 06/2007 -* @license GPL -* @author Claire Figueras <dev@maarch.org> -* -*/ - -require_once 'apps/'. $_SESSION['config']['app_id'] .'/class/class_reopen_mail_Abstract.php'; - -class ReopenMail extends ReopenMail_Abstract -{ - // custom -} diff --git a/apps/maarch_entreprise/class/class_reopen_mail_Abstract.php b/apps/maarch_entreprise/class/class_reopen_mail_Abstract.php deleted file mode 100755 index 55d1e303ce8de533faaf201bdd92c0b7999cc34f..0000000000000000000000000000000000000000 --- a/apps/maarch_entreprise/class/class_reopen_mail_Abstract.php +++ /dev/null @@ -1,214 +0,0 @@ -<?php - -/* -* -* Copyright 2015 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/>. -*/ - -/** -* Reopen Mail Class -* -* Contains all the specific functions to reopen mail -* -* @package Maarch -* @version 2.0 -* @since 06/2007 -* @license GPL -* @author Claire Figueras <dev@maarch.org> -* -*/ - - -abstract class ReopenMail_Abstract extends Database -{ - - /** - * Redefinition of the LetterBox object constructor - */ - function __construct() - { - parent::__construct(); - } - - /** - * Checks the res_id - * - * @param string $mode add or up - */ - public function reopen_mail_check() - { - if (!empty($_REQUEST['id']) && !empty($_REQUEST['ref_id'])) { - $_SESSION['error'] = _ENTER_REF_ID_OR_GED_ID; - $_SESSION['m_admin']['reopen_mail']['REF_ID'] = ''; - $_SESSION['m_admin']['reopen_mail']['ID'] = ''; - return false; - } - if (empty($_REQUEST['id']) && empty($_REQUEST['ref_id'])) { - $_SESSION['error'] = _REF_ID . ', ' . _GED_ID . ' ' . _IS_EMPTY; - } else { - if (!empty($_REQUEST['ref_id'])) { - $_SESSION['m_admin']['reopen_mail']['REF_ID'] = $_REQUEST['ref_id']; - } elseif (!empty($_REQUEST['id'])) { - $_SESSION['m_admin']['reopen_mail']['ID'] = $this->wash( - $_REQUEST['id'], 'num', _GED_ID . ' '); - } - } - } - - /** - * Update databse - * - */ - public function update_db() - { - $db = new Database(); - // add ou modify users in the database - $this->reopen_mail_check(); - if (! empty($_SESSION['error'])) { - header( - 'location: ' . $_SESSION['config']['businessappurl'] - . 'index.php?page=reopen_mail&id=' - . $_SESSION['m_admin']['reopen_mail']['ID'] - . '&ref_id=' . $_SESSION['m_admin']['reopen_mail']['REF_ID'] - . '&admin=reopen_mail' - ); - exit(); - } else { - require_once 'core/class/class_security.php'; - - $sec = new security(); - $ind_coll = $sec->get_ind_collection('letterbox_coll'); - $table = $_SESSION['collections'][$ind_coll]['table']; - - if (!empty($_SESSION['m_admin']['reopen_mail']['REF_ID'])) { - $stmt = $db->query( - "SELECT res_id, alt_identifier, status FROM res_view_letterbox WHERE alt_identifier = ?", array($_SESSION['m_admin']['reopen_mail']['REF_ID']) - ); - $result_object=$stmt->fetchObject(); - $res_id = $result_object->res_id; - $_SESSION['m_admin']['reopen_mail']['ID'] = $res_id; - $errorMsg = _REF_ID . ' ' . _UNKNOWN; - } elseif (!empty($_SESSION['m_admin']['reopen_mail']['ID'])) { - $stmt = $db->query( - 'SELECT res_id, alt_identifier, status FROM res_view_letterbox WHERE res_id = ?', array($_SESSION['m_admin']['reopen_mail']['ID']) - ); - $errorMsg = _GED_ID . ' ' . _UNKNOWN; - } - - if ($stmt->rowCount() == 0) { - $_SESSION['error'] = $errorMsg; - header( - 'location: ' . $_SESSION['config']['businessappurl'] - . 'index.php?page=reopen_mail&id=' - . $_SESSION['m_admin']['reopen_mail']['ID'] - . '&admin=reopen_mail' - ); - exit(); - } - - $db->query( - 'UPDATE ' . $table . " SET status = ? where res_id = ?" - , array($_REQUEST['status_id'], $_SESSION['m_admin']['reopen_mail']['ID']) - ); - - $stmt = $db->query("SELECT id, label_status FROM status WHERE id = ?", array($_REQUEST['status_id'])); - while ( $line = $stmt->fetchObject()) {$label_status = $line->label_status;} - - $historyMsg = _MODIFICATION_OF_THE_STATUS_FROM_THIS_MAIL .$label_status. ' du courrier '; - if ($resultRes->alt_identifier <> '') { - $historyMsg .= $resultRes->alt_identifier . ' (' . $_SESSION['m_admin']['reopen_mail']['ID'] . ')'; - } else { - $historyMsg .= $_SESSION['m_admin']['reopen_mail']['ID']; - } - - if ($_SESSION['history']['resup'] == true) { - require_once 'core/class/class_history.php'; - $hist = new history(); - $hist->add( - $table, $_SESSION['m_admin']['reopen_mail']['ID'], 'UP','resup', - $historyMsg, - $_SESSION['config']['databasetype'], 'apps' - ); - } - - $_SESSION['info'] = $historyMsg; - - unset($_SESSION['m_admin']); - header( - 'location: ' . $_SESSION['config']['businessappurl'] - . 'index.php?page=admin' - ); - exit(); - } - } - - /** - * Form to reopen a mail - * - */ - public function formreopenmail() - { - $db = new Database(); - - $stmt = $db->query( - "SELECT id, label_status FROM status WHERE is_folder_status = 'N' "); - - $notesList = ''; - if ($stmt->rowCount() < 1) { - $notesList = 'No contact or error query'; - } - - ?> - <h1><i class="fa fa-envelope-square fa-2x"></i> <?php echo _REOPEN_MAIL;?></h1> - - <div id="inner_content" class="clearfix" align="center"> - <div class="block"> - <p ><?php echo _MAIL_SENTENCE2 . '<br />' . _MAIL_SENTENCE3 . '<br />' . _MAIL_SENTENCE4 ;?> </p> - <br/> - <p ></p> - <form name="form1" method="post" action="<?php echo $_SESSION['config']['businessappurl']."index.php?display=true&admin=reopen_mail&page=reopen_mail_db";?>" > - <p> - <?php echo _ENTER_REF_ID;?> : - <input type="text" name="ref_id" id="ref_id" value="<?php if(isset($_SESSION['m_admin']['reopen_mail']['REF_ID'])){ functions::xecho($_SESSION['m_admin']['reopen_mail']['REF_ID']);}?>" /> - <?php echo _ENTER_DOC_ID;?> : - <input type="text" name="id" id="id" value="<?php if(isset($_SESSION['m_admin']['reopen_mail']['ID'])){ functions::xecho($_SESSION['m_admin']['reopen_mail']['ID']);}?>" /> - </p> - <?php echo _CHOOSE_STATUS;?> : - <SELECT NAME='status_id'> - <?php - while ( $line = $stmt->fetchObject()) { - echo "<OPTION VALUE='".$line->id."'>".$line->label_status."</OPTION>"; - } - ?> - </SELECT> - <br/> - - <p >(<?php echo _TO_KNOW_ID;?>) </p> - - <br/> - <p class="buttons"> - <input type="submit" name="Submit" value="<?php echo _VALIDATE;?>" class="button"/> - <input type="button" name="close" value="<?php echo _CANCEL;?>" onclick="javascript:window.location.href='<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=admin';" class="button"/> - </p> - - </form> - </div> - </div> - <?php - } -} diff --git a/apps/maarch_entreprise/class/class_users_Abstract.php b/apps/maarch_entreprise/class/class_users_Abstract.php index ab6d69221b6c75b40fa7d488658d8bf408e8e24b..fa961268b4a5489c6863c4d57442af50dd601f3f 100755 --- a/apps/maarch_entreprise/class/class_users_Abstract.php +++ b/apps/maarch_entreprise/class/class_users_Abstract.php @@ -29,7 +29,6 @@ * @version 2.1 * @since 10/2005 * @license GPL -* @author Claire Figueras <dev@maarch.org> * */ @@ -46,500 +45,6 @@ abstract class class_users_Abstract extends Database parent::__construct(); } - protected function cleanHtml($htmlContent){ - - $htmlContent = str_replace(';', '###', $htmlContent); - $htmlContent = str_replace('--', '___', $htmlContent); - - $allowedTags = '<html><head><body><title>'; //Structure - $allowedTags .= '<h1><h2><h3><h4><h5><h6><b><i><tt><u><strike><blockquote><pre><blink><font><big><small><sup><sub><strong><em>'; // Text formatting - $allowedTags .='<p><br><hr><center><div><span>'; // Text position - $allowedTags .= '<li><ol><ul><dl><dt><dd>'; // Lists - $allowedTags .= '<img><a>'; // Multimedia - $allowedTags .= '<table><tr><td><th><tbody><thead><tfooter><caption>'; // Tables - $allowedTags .= '<form><input><textarea><select>'; // Forms - $htmlContent = strip_tags($htmlContent, $allowedTags); - - return $htmlContent; - } - - /** - * Treats the information returned by the form of change_info_user(). - * - */ - public function user_modif() - { - $core = new core_tools(); - $db = new Database(); - $_SESSION['user']['FirstName'] = $this->wash( - $_POST['FirstName'], 'no', _FIRSTNAME - ); - $_SESSION['user']['LastName'] = $this->wash( - $_POST['LastName'], 'no', _LASTNAME - ); - if (!empty($_POST['Initials'])) { - $_SESSION['user']['Initials'] = $_POST['Initials']; - } - - $ssoLogin = false; - foreach($_SESSION['login_method_memory'] as $METHOD) - { - if ($METHOD['ID'] == 'sso' && $METHOD['ACTIVATED'] == 'true') { - $ssoLogin = true; - break; - } - } - - if (!empty($_POST['pass1']) || !empty($_POST['pass2'])) { - $currentPassword = $_POST['currentPassword']; - if (!empty($currentPassword)) { - require_once('core' . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'class_security.php'); - $stmt = $db->query("SELECT password FROM " . USERS_TABLE . " WHERE user_id = ?", array($_SESSION['user']['UserId'])); - $obj = $stmt->fetchObject(); - $sec = new security(); - if ($obj->password === $sec->getPasswordHash($currentPassword)) { - if (($_SESSION['config']['ldap'] != "true" && !$ssoLogin ) || $_SESSION['user']['UserId'] == "superadmin") { - $_SESSION['user']['pass1'] = $this->wash( - $_POST['pass1'], 'no', _FIRST_PSW - ); - } - - if (($_SESSION['config']['ldap'] != "true" && !$ssoLogin ) || $_SESSION['user']['UserId'] == "superadmin") { - $_SESSION['user']['pass2'] = $this->wash( - $_POST['pass2'], 'no', _SECOND_PSW - ); - } - - if ($_SESSION['user']['pass1'] <> $_SESSION['user']['pass2'] && (($_SESSION['config']['ldap'] != "true" && !$ssoLogin ) || $_SESSION['user']['UserId'] == "superadmin")) { - $this->add_error(_WRONG_SECOND_PSW, ''); - } - } else { - $this->add_error(_WRONG_PSW, ''); - } - - } else { - $this->add_error(_EMPTY_PSW, ''); - } - } else { - $_SESSION['user']['pass1'] = ''; - $_SESSION['user']['pass2'] = ''; - } - - if(isset($_POST['Phone']) && !empty($_POST['Phone'])){ - $_SESSION['user']['Phone'] = $this->wash( - $_POST['Phone'], 'phone', _PHONE, "no", "",32 - ); - } - - if (isset($_POST['Fonction']) && ! empty($_POST['Fonction'])) { - $_SESSION['user']['Fonction'] = $_POST['Fonction']; - } - - if (isset($_POST['Department']) && ! empty($_POST['Department'])) { - $_SESSION['user']['department'] = $_POST['Department']; - } - - if (isset($_POST['Mail']) && ! empty($_POST['Mail'])) { - $_SESSION['user']['Mail'] = $_POST['Mail']; - } - - if (isset($_POST['thumbprint']) && ! empty($_POST['thumbprint'])) { - $_SESSION['user']['thumbprint'] = trim($_POST['thumbprint']); - } - - if (isset($_FILES['signature']['name']) && !empty($_FILES['signature']['name'])) { - $extension = explode(".", $_FILES['signature']['name']); - $count_level = count($extension)-1; - $the_ext = $extension[$count_level]; - $fileNameOnTmp = 'tmp_file_' . $_SESSION['user']['UserId'] - . '_' . rand() . '.' . strtolower($the_ext); - $filePathOnTmp = $_SESSION['config']['tmppath'] . $fileNameOnTmp; - - if (!is_uploaded_file($_FILES['signature']['tmp_name'])) { - $_SESSION['error'] = _FILE_NOT_SEND . ". " . _TRY_AGAIN - . ". " . _MORE_INFOS . " (<a href=\"mailto:" - . $_SESSION['config']['adminmail'] . "\">" - . $_SESSION['config']['adminname'] . "</a>)"; - } elseif (!@move_uploaded_file($_FILES['signature']['tmp_name'], $filePathOnTmp)) { - $_SESSION['error'] = _FILE_NOT_SEND . ". " . _TRY_AGAIN . ". " - . _MORE_INFOS . " (<a href=\"mailto:" - . $_SESSION['config']['adminmail'] . "\">" - . $_SESSION['config']['adminname'] . "</a>)"; - } else { - require_once 'core/docservers_tools.php'; - $arrayIsAllowed = array(); - $arrayIsAllowed = Ds_isFileTypeAllowed($filePathOnTmp); - if (strtolower($the_ext) <> 'jpg' && strtolower($the_ext) <> 'jpeg') { - $_SESSION['error'] = _WRONG_FILE_TYPE . ' ' . $arrayIsAllowed['mime_type']; - $_SESSION['upfile'] = array(); - } else if ($arrayIsAllowed['status'] == false) { - $_SESSION['error'] = _WRONG_FILE_TYPE . ' ' . $arrayIsAllowed['mime_type']; - $_SESSION['upfile'] = array(); - } else { - include_once 'core/class/docservers_controler.php'; - $docservers_controler = new docservers_controler(); - $fileTemplateInfos = array( - 'tmpDir' => $_SESSION['config']['tmppath'], - 'size' => $_FILES['signature']['size'], - 'format' => $the_ext, - 'tmpFileName' => $fileNameOnTmp, - ); - $storeInfos = $docservers_controler->storeResourceOnDocserver( - 'templates', - $fileTemplateInfos - ); - if (!file_exists( - $storeInfos['path_template'] - . str_replace("#", DIRECTORY_SEPARATOR, $storeInfos['destination_dir']) - . $storeInfos['file_destination_name'] - ) - ) { - $_SESSION['error'] = $storeInfos['error'] .' templates'; - //return false; - } else { - $_SESSION['user']['signature_path'] = $storeInfos['destination_dir']; - $_SESSION['user']['signature_file_name'] = $storeInfos['file_destination_name']; - } - } - } - } - - if (empty($_SESSION['error'])) { - $firstname = $_SESSION['user']['FirstName']; - $lastname = $_SESSION['user']['LastName']; - $department = $_SESSION['user']['department']; - - $query = "UPDATE " . USERS_TABLE . " SET"; - - $arrayPDO = array(); - if ((($_SESSION['config']['ldap'] != "true" && !$ssoLogin) || $_SESSION['user']['UserId'] == "superadmin") && $_SESSION['user']['pass1'] != '') { - require_once('core' . DIRECTORY_SEPARATOR . 'class' - . DIRECTORY_SEPARATOR . 'class_security.php'); - $query .= " password = ?,"; - $sec = new security(); - $arrayPDO = array_merge($arrayPDO, array($sec->getPasswordHash($_SESSION['user']['pass1']))); - } - - $query .= " firstname = ?, lastname = ?, initials = ?, phone = ?, mail = ? , department = ?, thumbprint = ?, signature_path = ?, signature_file_name = ? WHERE user_id = ?"; - - $arrayPDO = array_merge($arrayPDO, array($firstname, $lastname, $_SESSION['user']['Initials'], $_SESSION['user']['Phone'], $_SESSION['user']['Mail'], $department, $_SESSION['user']['thumbprint'], - $_SESSION['user']['signature_path'], $_SESSION['user']['signature_file_name'], $_SESSION['user']['UserId'])); - $db->query($query, $arrayPDO); - - $stmt = $db->query("SELECT user_id FROM user_signatures WHERE user_id = ?", [$_SESSION['user']['UserId']]); - $obj = $stmt->fetchObject(); - - if ($obj) { - $db->query('UPDATE user_signatures SET signature_label = ?, signature_path = ?, signature_file_name = ? WHERE user_id = ?', ['', $_SESSION['user']['signature_path'], $_SESSION['user']['signature_file_name'], $_SESSION['user']['UserId']]); - } else { - $db->query('INSERT INTO user_signatures (user_id, signature_label, signature_path, signature_file_name) VALUES (?, ?, ?, ?)', [$_SESSION['user']['UserId'], '', $_SESSION['user']['signature_path'], $_SESSION['user']['signature_file_name']]); - } - - // email_signatures - if ($core->is_module_loaded('sendmail')) { - if (isset($_POST['emailSignature']) && !empty($_POST['emailSignature'])) { - require_once 'modules/sendmail/class/class_email_signatures.php'; - $emailSignatures = new EmailSignatures(); - - $body = $this->cleanHtml($_POST['emailSignature']); - if (isset($_POST['selectSignatures']) && $_POST['selectSignatures'] == 'new' - && isset($_POST['signatureTitle']) && !empty($_POST['signatureTitle']) - ) { - $emailSignatures->createForCurrentUser(htmlspecialchars($_POST['signatureTitle']), $body); - } elseif (isset($_POST['selectSignatures']) && intval($_POST['selectSignatures'])) { - $emailSignatures->updateForCurrentUser($_POST['selectSignatures'], $body); - } - - } - } - - - if ($_SESSION['history']['usersup'] == 'true') { - require_once 'core' . DIRECTORY_SEPARATOR . 'class' - . DIRECTORY_SEPARATOR . 'class_history.php'; - $hist = new history(); - $hist->add( - USERS_TABLE, $_SESSION['user']['UserId'], 'UP','usersup', - _USER_UPDATE . ' : ' . $_SESSION['user']['LastName'] . ' ' - . $_SESSION['user']['FirstName'], - $_SESSION['config']['databasetype'] - ); - } - - $_SESSION['info'] = _USER_UPDATED; - - $userInfos = functions::infouser($_SESSION['user']['UserId']); - $_SESSION['user']['UserId'] = $userInfos['UserId']; - $_SESSION['user']['FirstName'] = $userInfos['FirstName']; - $_SESSION['user']['LastName'] = $userInfos['LastName']; - $_SESSION['user']['Initials'] = $userInfos['Initials']; - $_SESSION['user']['Phone'] = $userInfos['Phone']; - $_SESSION['user']['Mail'] = $userInfos['Mail']; - $_SESSION['user']['department'] = $userInfos['department']; - $_SESSION['user']['thumbprint'] = $userInfos['thumbprint']; - $_SESSION['user']['pathToSignature'] = $userInfos['pathToSignature']; - - header( - 'location: ' . $_SESSION['config']['businessappurl'] - . 'index.php' - ); - exit(); - } else { - header( - 'location: ' . $_SESSION['config']['businessappurl'] - . 'index.php?page=modify_user&admin=users' - ); - exit(); - } - } - - /** - * Form for the management of the current user. - * - */ - public function change_info_user() - { - $core = new core_tools(); - $db = new Database(); - ?> - <h1><i class="fa fa-user fa-2x" title=""></i> <?php echo _MY_INFO;?></h1> - - <div id="inner_content" class="clearfix"> - <div id="user_box" style="float:right;width:17%;"> - <div class="block" style="height:400px;"> - <?php if($core->is_module_loaded("entities") ) {?> - <h2 class="tit"><?php echo _USER_ENTITIES_TITLE;?> : </h2> - <ul id="my_profil" style="height:280px;overflow:auto;"> - <?php - $stmt = $db->query("SELECT e.entity_label, ue.primary_entity FROM ".$_SESSION['tablename']['ent_users_entities']." ue, ".$_SESSION['tablename']['ent_entities']." e - WHERE ue.user_id = ? and ue.entity_id = e.entity_id order by e.entity_label", - array($_SESSION['user']['UserId'])); - if($stmt->rowCount() < 1) - { - echo _USER_BELONGS_NO_ENTITY."."; - } - else - { - while($line = $stmt->fetchObject()) - { - if($line->primary_entity == 'Y'){ - echo "<li style='list-style-position:inside;padding:5px;'><i class=\"fa fa-arrow-right\"></i> ".$line->entity_label." </li>"; - }else{ - echo "<li style='padding:5px;'>".$line->entity_label." </li>"; - } - } - } ?> - </ul> - <?php }?> - </div> - <div class="block_end"> </div> - </div> - <div id="user_box_2" style="float:right;width:17%;"> - <div class="block" style="height:400px;"> - <h2 class="tit"><?php echo _USER_GROUPS_TITLE;?> : </h2> - <ul id="my_profil" style="height:280px;overflow:auto;"> - <?php - $stmt = $db->query( - "SELECT u.group_desc, uc.primary_group FROM " . USERGROUP_CONTENT_TABLE . " uc, " - . USERGROUPS_TABLE ." u WHERE uc.user_id = ? and uc.group_id = u.group_id" - . " order by u.group_desc", - array($_SESSION['user']['UserId']) - ); - - if ($stmt->rowCount() < 1) { - echo _USER_BELONGS_NO_GROUP . "."; - } else { - while ($line = $stmt->fetchObject()) { - if($line->primary_group == 'Y'){ - echo "<li style='list-style-position:inside;padding:5px;'><i class=\"fa fa-arrow-right\"></i> ".$line->group_desc." </li>"; - }else{ - echo "<li style='padding:5px;'>".$line->group_desc." </li>"; - } - } - } ?> - </ul> - </div> - <div class="block_end"> </div> - </div> - <div class="block" style="float:left;width:55%;height:auto;"> - <form name="frmuser" style="margin:auto;" enctype="multipart/form-data" id="frmuser" method="post" action="<?php echo $_SESSION['config']['businessappurl'];?>index.php?display=true&admin=users&page=user_modif" class="forms addforms"> - <input type="hidden" name="display" value="true" /> - <input type="hidden" name="admin" value="users" /> - <input type="hidden" name="page" value="user_modif" /> - <div id="user-infos"> - <p> - <label><?php echo _ID;?> : </label> - <input name="UserId" type="text" id="UserId" value="<?php functions::xecho($_SESSION['user']['UserId']);?>" readonly="readonly" /> - <input type="hidden" name="id" value="<?php functions::xecho($_SESSION['user']['UserId']);?>" /> - </p> - - <p> - <label for="LastName"><?php echo _LASTNAME;?> : </label> - <input name="LastName" type="text" id="LastName" size="45" value="<?php functions::xecho($this->show_string($_SESSION['user']['LastName']));?>" /> - </p> - <p> - <label for="FirstName"><?php echo _FIRSTNAME;?> : </label> - <input name="FirstName" type="text" id="FirstName" size="45" value="<?php functions::xecho($this->show_string($_SESSION['user']['FirstName']));?>" /> - </p> - <p> - <label for="Initials"><?php echo _INITIALS;?> : </label> - <input name="Initials" type="text" id="Initials" size="45" value="<?php functions::xecho($this->show_string($_SESSION['user']['Initials']));?>" /> - </p> - <?php if(!$core->is_module_loaded("entities") ) {?> - <p> - <label for="Department"><?php echo _DEPARTMENT;?> : </label> - <input name="Department" id="Department" type="text" disabled size="45" value="<?php functions::xecho($this->show_string($_SESSION['user']['department']));?>" /> - </p> - <?php }?> - <p> - <label for="Phone"><?php echo _PHONE_NUMBER;?> : </label> - <input name="Phone" type="text" id="Phone" value="<?php functions::xecho($_SESSION['user']['Phone']);?>" /> - </p> - <p> - <label for="Mail"><?php echo _MAIL;?> : </label> - <input name="Mail" type="text" id="Mail" size="45" value="<?php functions::xecho($_SESSION['user']['Mail']);?>" /> - </p> - <p> - <label for="thumbprint"><?php echo _THUMBPRINT; ?> : </label> - <textarea name="thumbprint" id="thumbprint"><?php functions::xecho($_SESSION['user']['thumbprint']);?></textarea> - </p> - <p> - <label for="signature"><?php echo _SIGNATURE; ?> : </label> - <input type="file" name="signature" id="signature"/> - <br /> - <?php - if (file_exists($_SESSION['user']['pathToSignature'][0])) { - $extension = explode(".", $_SESSION['user']['pathToSignature'][0]); - $count_level = count($extension)-1; - $the_ext = $extension[$count_level]; - $fileNameOnTmp = 'tmp_file_' . $_SESSION['user']['UserId'] . '_' . rand() . '.' . strtolower($the_ext); - $filePathOnTmp = $_SESSION['config']['tmppath'] . $fileNameOnTmp; - - if (copy($_SESSION['user']['pathToSignature'][0], $filePathOnTmp)) { ?> - <div style="text-align:center;"> - <img src="<?php echo $_SESSION['config']['businessappurl'] . '/tmp/' . $fileNameOnTmp; ?>" - alt="signature" id="signFromDs" style="width:150px;height:100px;"/> - </div> - <?php } else { - echo _COPY_ERROR; - } - } - ?> - <canvas id="imageCanvas" style="margin:auto;display:none;width:150px !important;height:100px !important;"></canvas> - <script> - var signature = document.getElementById('signature'); - signature.addEventListener('change', handleImage, false); - - var canvas = document.getElementById('imageCanvas'); - var signFromDs = document.getElementById('signFromDs'); - var ctx = canvas.getContext('2d'); - - function handleImage(e){ - var reader = new FileReader(); - reader.onload = function(event){ - var img = new Image(); - img.onload = function(){ - canvas.width = img.width; - canvas.height = img.height; - ctx.drawImage(img,0,0); - canvas.style.display = 'block'; - signFromDs.style.display = 'none'; - }; - img.src = event.target.result; - }; - reader.readAsDataURL(e.target.files[0]); - } - </script> - </p> - <h5 class="categorie" style="width:90%;margin-bottom: 3%" onmouseover="this.style.cursor='pointer';" - onclick="new Effect.toggle('complementary_fields', 'blind', {delay:0.2}); - whatIsTheDivStatus('complementary_fields', 'divStatus_complementary_fields');"> - <span id="divStatus_complementary_fields" style="color:#1C99C5;"><<</span> <?php echo _COMPLEMENTARY_OPT;?> - </h5> - <?php - if ($core->is_module_loaded('sendmail')) { - require_once 'modules/sendmail/class/class_email_signatures.php'; - ?> - <div id="complementary_fields" style="display:none;margin-bottom: 5%;" > - <?php - $emailSignaturesClass = new EmailSignatures(); - - $mailSignatures = $emailSignaturesClass->getForCurrentUser(); - ?> - <script type="text/javascript"> - var mailSignaturesJS = <?php echo json_encode($mailSignatures); ?>; - </script> - <label for="selectSignatures"> - <select style="width: 80%" name="selectSignatures" id ="selectSignatures" onchange="changeSignatureForProfil(this.options[this.selectedIndex], mailSignaturesJS)"> - <option value="new" data-nb="-1" selected><?php echo _NEW_EMAIL_SIGNATURE ?></option> - <?php - for ($i = 0; $mailSignatures[$i]; $i++) { - ?> - <option value="<?php echo $mailSignatures[$i]['id'] ?>" data-nb="<?php echo $i ?>"><?php echo $mailSignatures[$i]['title'] ?></option> - <?php - } - ?> - </select> - <span id="trashButton" style="display: none"> <i onclick="deleteSignature(mailSignaturesJS);" class="fa fa-trash fa-lg"></i></span> - </label> - <input style="margin-bottom: 1%" name="signatureTitle" id="signatureTitle" type="text" placeholder="Titre"/> - <?php - ob_start(); - include('apps/maarch_entreprise/load_editor.php'); - echo ob_get_clean(); - ob_end_flush(); - ?> - <div id="html_mode" style="display: block; width:420px;"> - <textarea name="emailSignature" id="emailSignature" style="width:100%" rows="15" cols="60"></textarea> - </div> - </div> - <?php - } - ?> - <?php - $ssoLogin = false; - foreach($_SESSION['login_method_memory'] as $METHOD) - { - if ($METHOD['ID'] == 'sso' && $METHOD['ACTIVATED'] == 'true') { - $ssoLogin = true; - break; - } - } - ?> - <p <?php if(($_SESSION['config']['ldap'] == "true" || $ssoLogin == true) && $_SESSION['user']['UserId'] != "superadmin"){echo 'style="display:none"';} ?> > - <em><?php echo _MODIFICATION_PSW_SNTE;?></em> - </p> - <p <?php if(($_SESSION['config']['ldap'] == "true" || $ssoLogin == true) && $_SESSION['user']['UserId'] != "superadmin"){echo 'style="display:none"';} ?> > - <label for="currentPassword"><?php echo _CURRENT_PSW;?> : </label> - <input type="password" style="display: none"/> - <input name="currentPassword" type="password" id="currentPassword" value="" /> - </p> - <p <?php if(($_SESSION['config']['ldap'] == "true" || $ssoLogin == true) && $_SESSION['user']['UserId'] != "superadmin"){echo 'style="display:none"';} ?> > - <label for="pass1"><?php echo _NEW_PSW;?> : </label> - <input name="pass1" type="password" id="pass1" value="" /> - </p> - <p <?php if(($_SESSION['config']['ldap'] == "true" || $ssoLogin == true) && $_SESSION['user']['UserId'] != "superadmin"){echo 'style="display:none"';} ?> > - <label for="pass2"><?php echo _REENTER_PSW;?> : </label> - <input name="pass2" type="password" id="pass2" value="" /> - </p> - <p class="buttons"> - <input type="submit" name="Submit" value="<?php echo _VALIDATE;?>" class="button" /> - <input type="button" name="cancel" value="<?php echo _CANCEL;?>" class="button" onclick="javascript:window.location.href='<?php echo $_SESSION['config']['businessappurl'];?>index.php';" /> - </p> - </div> - </form> - </div> - <div class="blank_space"></div> - <?php - // require_once("core/class/class_core_tools.php"); - $core = new core_tools; - echo $core->execute_modules_services($_SESSION['modules_services'], 'modify_user.php', "include"); - ?> - </div> - - <?php - } - /** * Return a array of user informations * diff --git a/apps/maarch_entreprise/xml/IVS/requests_definitions.xml b/apps/maarch_entreprise/xml/IVS/requests_definitions.xml index e635267e6ed15dcf9270e420a08425e8126a3619..ac2a29fa9c0c96576e57b18a49e276c8dcbb9d89 100755 --- a/apps/maarch_entreprise/xml/IVS/requests_definitions.xml +++ b/apps/maarch_entreprise/xml/IVS/requests_definitions.xml @@ -10,30 +10,6 @@ <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="index" /> <!-- Admin user --> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="admin_users_update" > - <parameter name="admin" value="users"/> - <parameter name="page" value="users_management_controler"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="ajax_form_values" > - <parameter name="admin" value="users"/> - <parameter name="page" value="check_group"/> - <parameter name="display" value="true"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="ajax_form_values" > - <parameter name="admin" value="users"/> - <parameter name="page" value="manage_group"/> - <parameter name="display" value="true"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="ajax_usergroups_ids" > - <parameter name="admin" value="users"/> - <parameter name="page" value="remove_group"/> - <parameter name="display" value="true"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="ajax_usergroups_ids" > - <parameter name="admin" value="users"/> - <parameter name="page" value="set_primary_group"/> - <parameter name="display" value="true"/> - </requestDefinition> <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="admin_ajax_search" > <parameter name="admin" value="users"/> <parameter name="page" value="users_list_by_name"/> @@ -44,11 +20,6 @@ <parameter name="page" value="users_list_by_name_search"/> <parameter name="display" value="true"/> </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="user_update" > - <parameter name="admin" value="users"/> - <parameter name="page" value="user_modif"/> - <parameter name="display" value="true"/> - </requestDefinition> <!-- Admin architecture --> <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="admin_architecture" > @@ -277,82 +248,6 @@ <parameter name="id"/> </requestDefinition> - <!-- Admin groups --> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="val_integer" > - <parameter name="admin" value="groups"/> - <parameter name="page" value="add_grant"/> - <parameter name="display" value="true"/> - <parameter name="val"/> - </requestDefinition> - - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="ajax_form_values" > - <parameter name="admin" value="groups"/> - <parameter name="page" value="check_access"/> - <parameter name="display" value="true"/> - </requestDefinition> - - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="admin_ajax_search" > - <parameter name="admin" value="groups"/> - <parameter name="page" value="groups_list_by_name"/> - <parameter name="display" value="true"/> - </requestDefinition> - - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="ajax_form_values" > - <parameter name="admin" value="groups"/> - <parameter name="page" value="manage_access"/> - <parameter name="display" value="true"/> - </requestDefinition> - - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="security" > - <parameter name="admin" value="groups"/> - <parameter name="page" value="remove_access"/> - <parameter name="display" value="true"/> - </requestDefinition> - - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="admin_groups" > - <parameter name="admin" value="groups"/> - <parameter name="page" value="usergroups_management_controler"/> - <parameter name="display" value="true"/> - </requestDefinition> - - <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="only_id_string" > - <parameter name="admin" value="groups"/> - <parameter name="page" value="usergroups_management_controler"/> - <parameter name="display" value="true"/> - <parameter name="id"/> - </requestDefinition> - - <!-- Admin history --> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="admin_history" > - <parameter name="admin" value="history"/> - <parameter name="page" value="history"/> - </requestDefinition> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="admin_history_batch" > - <parameter name="admin" value="history_batch"/> - <parameter name="page" value="history_batch"/> - </requestDefinition> - - <!-- Admin parameters --> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="admin_parameters" > - <parameter name="admin" value="parameter"/> - <parameter name="page" value="admin_parameter_save"/> - <parameter name="display" value="true"/> - </requestDefinition> - - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="only_id_string" > - <parameter name="admin" value="parameter"/> - <parameter name="page" value="admin_parameter"/> - <parameter name="display" value="true"/> - <parameter name="id"/> - </requestDefinition> - - <!-- Admin reopen --> - <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="admin_reopen" > - <parameter name="admin" value="reopen_mail"/> - <parameter name="page" value="reopen_mail_db"/> - <parameter name="display" value="true"/> - </requestDefinition> - <!-- indexing_searching --> <requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="multi_contacts" > <parameter name="dir" value="indexing_searching"/>