[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 5 * Page clamv 6 * @Version $Id: clamav-cron.php 8471 2015-02-14 17:19:26Z plouf $ 7 8 * @Projet LCS / SambaEdu 9 10 * @auteurs 11 12 * @Licence Distribue selon les termes de la licence GPL 13 14 * @note 15 16 */ 17 18 /** 19 20 * @Repertoire: /se3-clamav 21 * file: clamav-cron.php 22 */ 23 24 25 require("entete.inc.php"); 26 require ("ihm.inc.php"); 27 28 // HTMLpurifier 29 include ("../se3/includes/library/HTMLPurifier.auto.php"); 30 $config = HTMLPurifier_Config::createDefault(); 31 $purifier = new HTMLPurifier($config); 32 33 $id=$purifier->purify($_GET[id]); 34 $directory=$purifier->purify($_POST[directory]); 35 $frequency=$purifier->purify($_POST[frequency]); 36 $remove=$purifier->purify($_POST[remove]); 37 38 if ( isset($_POST['action'])) $cat = $purifier->purify($_POST['action']); 39 elseif ( isset($_GET['action'])) $cat = $purifier->purify($_GET['action']); 40 41 // Authorization 42 if ( is_admin("se3_is_admin",$login)!="Y") if ( ($uid != $login) || (($uid == $login)&&((!preg_match("//home/$login/", $wrep))&&($consul!=1)))) die (gettext("Vous n'avez pas les droits suffisants pour acc�der � cette fonction")."</BODY></HTML>"); 43 44 if ($action == "trash") 45 { 46 $query = "DELETE from clamav_dirs WHERE id=".$id; 47 $result = mysql_query($query); 48 } 49 50 if ($action == "croncreate") 51 { 52 // Recuperation des donnees dans la base SQL 53 $query = "SELECT * from clamav_dirs "; 54 $result = mysql_query($query); 55 // 56 while ($r=mysql_fetch_array($result)) { 57 $id = $r["id"]; 58 $frequency="frequency".$id; 59 $remove="remove".$id; 60 if (isset ($remove)) { 61 $remove = "1"; 62 } else { 63 $remove = "0"; 64 } 65 $update_query = "UPDATE clamav_dirs SET frequency='$frequency',remove='$remove' WHERE id='$id'"; 66 mysql_query($update_query); 67 } 68 } 69 70 if ($action == "diradd") 71 { 72 $query="INSERT into clamav_dirs (directory,frequency,remove) VALUES ('".$directory."','weekly','0')"; 73 mysql_query($query); 74 } 75 76 //the form 77 echo '<h1> Solution antivirus serveur</h1> 78 <h2> Programmation de l\'antivirus </h2> 79 '; 80 $query = "SELECT * from clamav_dirs "; 81 $result = mysql_query($query); 82 83 $form = "<form action=\"clamav-cron.php\" method=\"post\">\n"; 84 85 $form .="<table align='center' border='1'>\n"; 86 $form .="<TR><TH class=\"menuheader\"> Programmation de l'antivirus </TH></TR>\n"; 87 $form .="<TR><td><table align='center' border='1'>\n"; 88 $form .="<TR><th class=\"menuheader\"> Répertoire </th><th class=\"menuheader\"> périodicité du scan </th>"; 89 $form .="<th class=\"menuheader\"> retirer les fichiers (dangeureux)</th></TR>\n"; 90 if (mysql_num_rows($result)==0) { 91 } else { 92 while ($r=mysql_fetch_array($result)) { 93 $none_selected = ""; 94 $lundi_selected =""; 95 $mardi_selected =""; 96 $mercredi_selected =""; 97 $jeudi_selected =""; 98 $vendredi_selected =""; 99 $samedi_selected =""; 100 $dimanche_selected =""; 101 $daily_selected=""; 102 $weekly_selected=""; 103 switch ($r["frequency"]) { 104 case "none":$none_selected = "selected"; 105 break; 106 case "lundi":$lundi_selected ="selected"; 107 break; 108 case "mardi":$mardi_selected ="selected"; 109 break; 110 case "mercredi":$mercredi_selected ="selected"; 111 break; 112 case "jeudi":$jeudi_selected ="selected"; 113 break; 114 case "vendredi":$vendredi_selected ="selected"; 115 break; 116 case "samedi":$samedi_selected ="selected"; 117 break; 118 case "dimanche":$dimanche_selected ="selected"; 119 break; 120 case "daily":$daily_selected ="selected"; 121 break; 122 case "weekly":$weekly_selected="selected"; 123 break; 124 } 125 $form .="<tr><td align=\"left\">"; 126 $form .="<a href='clamav-cron.php?action=trash&id=".$r['id']."'>\n"; 127 $form .="<img src='/elements/images/edittrash.png' border='0' alt='Supprimer' title='Supprimer'>\n"; 128 $form .="</a>\n"; 129 $form .= $r['directory']."</td>\n"; 130 $form .="<td align=\"center\" ><select name=\"frequency".$r['id']."\"> \n"; 131 $form .="<option value=\"none\" $none_selected> Pas de scan </option> \n"; 132 $form .="<option value=\"lundi\" $lundi_selected> Scan lundi soir </option> \n"; 133 $form .="<option value=\"mardi\" $mardi_selected> Scan mardi soir </option> \n"; 134 $form .="<option value=\"mercredi\" $mercredi_selected> Scan mercredi soir </option> \n"; 135 $form .="<option value=\"jeudi\" $jeudi_selected> Scan jeudi soir </option> \n"; 136 $form .="<option value=\"vendredi\" $vendredi_selected> Scan vendredi soir </option> \n"; 137 $form .="<option value=\"samedi\" $samedi_selected> Scan samedi soir </option> \n"; 138 $form .="<option value=\"dimanche\" $dimanche_selected> Scan dimanche soir </option> \n"; 139 $form .="<option value=\"daily\" $daily_selected> Scan quotidien </option> \n"; 140 $form .="<option value=\"weekly\" $weekly_selected> Scan hebdomadaire </option> \n"; 141 $form .="</select></td>\n"; 142 if ($r['remove'] == 0 ) { $remove_selected=""; } else {$remove_selected ="checked";} 143 $form .="<td class=\"menucell\" align=\"center\" > Suppression des virus (dangereux) <input type=\"checkbox\" name=\"remove".$r['id']."\" value=\"remove".$r['id']."\" $remove_selected /><br/> \n"; 144 } 145 $form .= "</table></td></tr>\n"; 146 147 $form .="<tr><td align='right'><input type='hidden' name='action' value='croncreate'>\n"; 148 $form.="<input type=\"submit\" value=\"Valider\"></td></tr>\n"; 149 $form .= "</table>\n"; 150 $form.="</form>\n"; 151 152 } 153 154 echo $form; 155 156 157 $form = "<form action=\"clamav-cron.php\" method=\"post\">\n"; 158 $form .="<table align='center' border='1'>\n"; 159 $form .="<TR><TH> Ajout de répertoire </TH></TR>\n"; 160 $form .="<TR><TD>Répertoire à ajouter : <input type=\"text\" name=\"directory\" value=\"\"> 161 </TD></TR>"; 162 $form .= "</table>\n"; 163 $form .= "<input type=\"hidden\" name=\"action\" value=\"diradd\">"; 164 $form .= "<input type=\"submit\" value=\"Ajouter\">"; 165 $form.="</form>\n"; 166 167 168 echo $form; 169 170 171 require ("pdp.inc.php"); 172 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Mar 17 22:47:18 2015 | Cross-referenced by PHPXref 0.7.1 |