*/ require_once("class_functions.php"); require_once("class_db.php"); require_once("class_diffusion.php"); include("session.php"); if(file_exists($_SESSION['config']['lang'].'.php')) { include($_SESSION['config']['lang'].'.php'); } else { $_SESSION['error'] = "Language file missing...
"; } $func = new functions(); if( !isset($_GET['valid']) && !isset($_GET['cancel']) && !isset($_GET['action']) && (!isset($_POST) || count($_POST) < 1) && !isset( $_GET['what_services'] ) && !isset( $_GET['what_users'] ) && !isset( $_GET['free_list_change']) ) { $_SESSION["copy_diffusion"] = clone $_SESSION["diffusion"]; } //Validation if($_GET['valid']) { if( isset($_GET['mail_actions_users']) ) { foreach( $_GET['mail_actions_users'] as $key => $value) $_SESSION["copy_diffusion"]->set_mailaction_user($key,$value); } if( isset($_GET['mail_actions_services']) ) { foreach( $_GET['mail_actions_services'] as $key => $value) $_SESSION["copy_diffusion"]->set_mailaction_service($key,$value); } $_SESSION["diffusion"] = $_SESSION["copy_diffusion"]; ?> reload(); } //Actions ? if(isset($_GET['action']) && $_GET['action'] == "add_copy_user" ) { if( isset($_GET['id']) ) $_SESSION["copy_diffusion"]->add_copy_user($_GET['id']); } else if(isset($_GET['action']) && $_GET['action'] == "add_copy_service" ) { if( isset($_GET['id']) ) $_SESSION["copy_diffusion"]->add_copy_service($_GET['id']); } else if(isset($_GET['action']) && $_GET['action'] == "remove_user" ) { //$rang = $_GET['rang']; if( isset($_GET['id']) ) $_SESSION["copy_diffusion"]->delete_user($_GET['id']); } else if(isset($_GET['action']) && $_GET['action'] == "remove_service" ) { //$rang = $_GET['rang']; if( isset($_GET['id']) ) $_SESSION["copy_diffusion"]->delete_service($_GET['id']); } else if(isset($_GET['action']) && $_GET['action'] == "add_primary_user" ) { //$rang = $_GET['rang']; if( isset($_GET['id']) ) $_SESSION["copy_diffusion"]->add_primary_user($_GET['id']); } //Search for service or users if(isset($_POST['what_users']) && !empty($_POST['what_users']) ) { $_GET['what_users'] = $_POST['what_users']; } if(isset($_POST['what_services']) && !empty($_POST['what_services']) ) { $_GET['what_services'] = $_POST['what_services']; } if(isset($_POST['what_lists']) && !empty($_POST['what_lists']) ) { $_GET['what_lists'] = $_POST['what_lists']; } //Free diffusion list if( $_SESSION['config']['free_diffusion_list'] == "true" ) { $db = new dbquery(); $db->connect(); $lists = array(); $db->query("select * from ".$_SESSION['tablename']['listmodel_assoc']." where ASSOC_SERVICE IS NULL"); while($res = $db->fetch_object()) { array_push($lists, array( 'ID' => $res->ID, 'NAME' => $res->NAME)); } } //Reload or not ? if( !isset($_GET["reload"]) && $_GET["reload"] == "Y") { $link = "popup_diff.php?reload=Y"; } else { $link = "popup_diff.php?reload=N"; } //Add_only_copy if( isset($_GET["add_only_copy"]) && $_GET["add_only_copy"] == "Y") { $link .= "&add_only_copy=Y"; } //Request for users and services $users = array(); $services = array(); $user_access = ""; if( $_SESSION['config']['restricted_diffusion_access'] === "true" ) { $brute_access = explode(",",$_SESSION['current_basket']['redirect_services']); if( is_array($brute_access) && count($brute_access) > 0 && $brute_access[0] != $_SESSION['current_basket']['redirect_services'] ) { $user_access = "AND DEPARTMENT IN ("; for($t=0; $twash($_GET['what_users'], "no", "", "no")); $where .= " and (u.LASTNAME like '%".strtolower($what_users)."%' OR u.LASTNAME like '%".strtoupper($what_users)."%' OR u.FIRSTNAME like '%".strtolower($what_users)."%' OR u.FIRSTNAME like '%".strtoupper($what_users)."%')"; $orderby = " ORDER BY u.LASTNAME asc, u.FIRSTNAME asc,s.SERVICE asc"; } if(isset($_GET['what_services']) && !empty($_GET['what_services']) ) { $what_services = addslashes($func->wash($_GET['what_services'], "no", "", "no")); $where .= " and (s.SERVICE like '%".strtolower($what_services)."%' or s.SERVICE like '%".strtoupper($what_services)."%')"; $orderby = " ORDER BY s.SERVICE asc, u.LASTNAME asc, u.FIRSTNAME asc"; } if($_SESSION['config']['show_only_elu_in_mailing_list'] == 'true') $where .= "AND u.ELU = 'Y' "; $db = new dbquery(); $db->connect(); if( !isset($_GET['what_users']) && !isset($_GET['what_services']) && !isset($_GET['what_lists']) ) $where = " AND 1=0 "; $db->query("select u.USER_ID, u.FIRSTNAME, u.LASTNAME, u.DEPARTMENT, u.MAIL, s.SERVICE FROM ".$_SESSION['tablename']['users']." u, ".$_SESSION['tablename']['services']." s WHERE u.DEPARTMENT = s.ID and STATUS <> 'DEL' AND u.ENABLED = 'Y'".$where.$user_access.$orderby); //$db->show(); $i=0; while($line = $db->fetch_object()) { array_push($users, array("ID" => $line->USER_ID, "PRENOM" => $line->FIRSTNAME, "NOM" => $line->LASTNAME, "DEP_ID" => $line->DEPARTMENT, "MAIL" => $line->MAIL, "DEP" =>$line->SERVICE)); $services[$line->DEPARTMENT] = $line->SERVICE; } $time = $func->get_session_time_expire(); ?> <?php echo _UPDATE_DIFFUSION_LIST;?>

'N') { ?>
/>
/>






get_diffusion(); if( count($diffusion) > 0 ) { $show_valid_button = true; if( !isset($_GET["add_only_copy"]) || $_GET["add_only_copy"] == "N" ) { $prim_diffusion = array_slice($diffusion,0,1); ?>

can_delete_user(key($prim_diffusion)) ) { ?>
 
     
1) { ?>

get_diffusion(),1) as $key_diff => $diffusion) { if($color == ' class="col"') { $color = ''; } else { $color = ' class="col"'; } if( isset($diffusion["USER"]) ) { ?> > can_delete_user($key_diff)) { ?> > can_delete_service($key_diff)) { ?>
     
     







> can_add_user($users[$j]["ID"]) ) { ?>
 
 

$d_serv ) { if($color == ' class="col"') { $color = ''; } else { $color = ' class="col"'; } ?> > can_add_service($k_serv) ) { ?>