$lbl_action = $l->g(907); } $sql = "select da.name from devices d, \n\t\t\t\t\t\t download_enable de,\n\t\t\t\t\t\t\tdownload_available da\n where de.id='%s' and de.FILEID=da.FILEID\n\t\t\tand d.IVALUE=de.ID\n\t\t\tAND d.hardware_id='%s' AND d.name='%s'\n\t\t\tand tvalue like '%s'"; $arg = array($id_pack_affect, $protectedGet['systemid'], "DOWNLOAD", "ERR_%"); $res = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg); $val = mysql_fetch_array($res); if (isset($val['name'])) { $tab_typ_champ[0]['INPUT_NAME'] = "MOTIF"; $tab_typ_champ[0]['INPUT_TYPE'] = 1; $data_form[0] = "<center>" . $lbl_action . "</center>"; tab_modif_values($data_form, $tab_typ_champ, array('NAME_PACK' => $val['name'], 'ACTION' => $hidden_action), $title_action . $val['name'], ""); } } if (isset($protectedGet["suppack"]) & $_SESSION['OCS']['CONFIGURATION']['TELEDIFF'] == "YES") { if ($_SESSION['OCS']["justAdded"] == false) { desactive_packet($systemid, $protectedGet["suppack"]); } else { $_SESSION['OCS']["justAdded"] = false; } addLog($l->g(512), $l->g(886) . " " . $protectedGet["suppack"] . " => " . $systemid); } else { $_SESSION['OCS']["justAdded"] = false; } if (isset($protectedGet["actgrp"])) { //this id is it a group? $reqGroups = "SELECT h.id id\n\t\t\t\t\t FROM hardware h \n\t\t\t\t\t WHERE h.deviceid='_SYSTEMGROUP_' "; //If you hav'nt permission => see only visible groups if (!($_SESSION['OCS']['CONFIGURATION']['GROUPS'] == "YES")) { $reqGroups .= " and h.workgroup = 'GROUP_4_ALL'"; } $resGroups = mysql2_query_secure($reqGroups, $_SESSION['OCS']["readServer"]);
$sql_listIDdel = "select distinct ID from download_enable where FILEID=%s"; $arg_listIDdel = $protectedPost['DEL_ALL']; $res_listIDdel = mysql2_query_secure($sql_listIDdel, $_SESSION['OCS']["readServer"], $arg_listIDdel); while ($val_listIDdel = mysqli_fetch_array($res_listIDdel)) { $listIDdel[] = $val_listIDdel['ID']; } if ($listIDdel != '') { foreach ($listIDdel as $k => $v) { desactive_packet('', $v); } } mysql2_query_secure("DELETE FROM download_enable WHERE FILEID=%s", $_SESSION['OCS']["writeServer"], $protectedPost['DEL_ALL']); echo "<script>window.opener.document.packlist.submit(); self.close();</script>"; } if ($protectedPost['SUP_PROF'] != '') { desactive_packet('', $protectedPost['SUP_PROF']); mysql2_query_secure("DELETE FROM download_enable WHERE ID=%s", $_SESSION['OCS']["writeServer"], $protectedPost['SUP_PROF']); } } $sql_details = "select distinct priority,fragments,size from download_available where fileid=%s"; $res_details = mysql2_query_secure($sql_details, $_SESSION['OCS']["readServer"], $protectedGet['timestamp']); $val_details = mysqli_fetch_array($res_details); $tps = "<br>" . $l->g(992) . " : <b><font color=red>" . tps_estimated($val_details) . "</font></b>"; PrintEnTete($l->g(481) . $tps); echo "<br>"; $form_name = "tele_actives"; //ouverture du formulaire echo open_form($form_name); $list_fields = array($l->g(460) => 'e.ID', 'Timestamp' => 'e.FILEID', $l->g(470) => 'e.INFO_LOC', $l->g(471) => 'e.PACK_LOC', $l->g(49) => 'a.NAME', $l->g(440) => 'a.PRIORITY', $l->g(480) => 'a.FRAGMENTS', $l->g(462) => 'a.SIZE', $l->g(25) => 'a.OSNAME'); if (!$cant_active) { $list_fields['SUP'] = 'e.ID';
} } if (isset($data_fields_account)) { updateinfo_computer($list_id, $data_fields_account, 'LIST'); unset($_SESSION['OCS']['DATA_CACHE']['TAB_MULTICRITERE']); echo "<script language='javascript'> window.opener.document.multisearch.submit();</script>"; } } //CAS OF TELEDEPLOY if (isset($protectedPost['RAZ']) and $protectedPost['RAZ'] != "" and $protectedPost['pack_list'] != "") { $sql = "select ID from download_enable \n\t\t\t\twhere fileid='%s'"; $arg = $protectedPost['pack_list']; $result = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg); $item = mysqli_fetch_object($result); require_once 'require/function_telediff.php'; $nb_line_affected = desactive_packet($list_id, $item->ID); msg_success($nb_line_affected . " " . $l->g(1026)); } //CAS OF WOL if (isset($protectedPost['WOL']) and $protectedPost['WOL'] != '') { require_once 'require/function_wol.php'; $wol = new Wol(); $sql = "select IPADDRESS,MACADDR from networks WHERE status='Up' and hardware_id in "; $arg = array(); $tab_result = mysql2_prepare($sql, $arg, $list_id); $resultDetails = mysql2_query_secure($tab_result['SQL'], $_SESSION['OCS']["writeServer"], $tab_result['ARG']); $msg = ""; while ($item = mysqli_fetch_object($resultDetails)) { $wol->wake($item->MACADDR, $item->IPADDRESS); $msg .= "<br>" . $wol->wol_send . "=>" . $item->MACADDR . "/" . $item->IPADDRESS; }
function del_pack($fileid) { global $l; //find all activate package $reqEnable = "SELECT id FROM download_enable WHERE FILEID='%s'"; $argEnable = $fileid; $resEnable = mysql2_query_secure($reqEnable, $_SESSION['OCS']["readServer"], $argEnable); while ($valEnable = mysqli_fetch_array($resEnable)) { $list_id[] = $valEnable["id"]; } //delete packet in DEVICES table if ($list_id != "") { foreach ($list_id as $k => $v) { desactive_packet('', $v); } } //delete activation of this pack $reqDelEnable = "DELETE FROM download_enable WHERE FILEID='%s'"; $argDelEnable = $fileid; mysql2_query_secure($reqDelEnable, $_SESSION['OCS']["writeServer"], $argDelEnable); //delete info of this pack $reqDelAvailable = "DELETE FROM download_available WHERE FILEID='%s'"; $argDelAvailable = $fileid; mysql2_query_secure($reqDelAvailable, $_SESSION['OCS']["writeServer"], $argDelAvailable); //what is the directory of this package? $info = look_config_default_values('DOWNLOAD_PACK_DIR'); $document_root = $info['tvalue']['DOWNLOAD_PACK_DIR']; //if no directory in base, take $_SERVER["DOCUMENT_ROOT"] if (!isset($document_root)) { $document_root = VARLIB_DIR; } if (@opendir($document_root . "/download/" . $fileid)) { //delete all files from this package if (!@recursive_remove_directory($document_root . "/download/" . $fileid)) { msg_error($l->g(472) . " " . $document_root . "/download/" . $fileid); } } // delete redistribution package $dl_rep_redist = look_config_default_values('DOWNLOAD_REP_CREAT'); $document_root = $dl_rep_redist['tvalue']['DOWNLOAD_REP_CREAT']; if (!$document_root) { $document_root = VARLIB_DIR . '/download/server'; } $redist_package = realpath($document_root . "/" . $fileid); if ($redist_package and @opendir($redist_package)) { //delete all files from this package if (!@recursive_remove_directory($redist_package)) { msg_error($l->g(472) . " " . $redist_package); } } addLog($l->g(512), $l->g(888) . " " . $fileid); }
//==================================================================================== //Modified on $Date: 2010 $$Author: Erwan Goalou require 'require/function_stats.php'; if ($_SESSION['OCS']['CONFIGURATION']['TELEDIFF'] == "YES" and isset($protectedPost["ACTION"]) and $protectedPost["ACTION"] != '') { if ($protectedPost["ACTION"] == "VAL_SUCC") { $result_line_delete = find_device_line('SUCCESS%', $protectedGet["stat"]); } if ($protectedPost["ACTION"] == "DEL_ALL") { $result_line_delete = find_device_line('NOTNULL', $protectedGet["stat"]); } if ($protectedPost["ACTION"] == "DEL_NOT") { $result_line_delete = find_device_line('NULL', $protectedGet["stat"]); } if (isset($result_line_delete) and is_array($result_line_delete)) { require 'require/function_telediff.php'; desactive_packet($result_line_delete['HARDWARE_ID'], $result_line_delete['IVALUE'][0]); } } $form_name = "show_stats"; $table_name = $form_name; echo open_form($form_name); $sql = "SELECT name FROM download_available WHERE fileid='%s'"; $arg = $protectedGet["stat"]; $res = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg); $row = mysql_fetch_object($res); printEnTete($l->g(498) . " <b>" . $row->name . "</b> (" . $l->g(296) . ": " . $protectedGet["stat"] . " )"); //count max values for stats $sql_count = "SELECT COUNT(id) as nb \n\t\t\tFROM devices d, download_enable e \n\t\t\tWHERE e.fileid='%s'\n \t\t\t\tAND e.id=d.ivalue \n\t\t\t\tAND name='DOWNLOAD' \n\t\t\t\tAND hardware_id NOT IN (SELECT id FROM hardware WHERE deviceid='_SYSTEMGROUP_' or deviceid='_DOWNLOADGROUP_')"; $arg = $protectedGet["stat"]; $rescount = mysql2_query_secure($sql_count, $_SESSION['OCS']["readServer"], $arg); $row = mysql_fetch_object($rescount);