[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <? 2 //==================================================================================== 3 // OCS INVENTORY REPORTS 4 // Copyleft Pierre LEMMET 2006 5 // Web: http://ocsinventory.sourceforge.net 6 // 7 // This code is open source and may be copied and modified as long as the source 8 // code is always made freely available. 9 // Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt 10 //==================================================================================== 11 //Modified on 08/01/2006 12 13 PrintEnTete($l->g(465)); 14 15 if( isset( $_POST["actpack"] )) { 16 17 $proto = array("http://", "https://"); 18 $rien = array("", ""); 19 $sub = array( $_POST["https"], $_POST["frag"] ); 20 21 $_POST["https"] = str_replace($proto, $rien, $_POST["https"]); 22 $_POST["frag"] = str_replace($proto, $rien, $_POST["frag"]); 23 24 $opensslOk = function_exists("openssl_open"); 25 if( $opensslOk ) 26 $httpsOk = @fopen("https://".$_POST["https"]."/".$_POST["actpack"]."/info", "r"); 27 28 // checking if this package contains fragments 29 $reqFrags = "SELECT fragments FROM download_available WHERE fileid='".$_POST["actpack"]."'"; 30 $resFrags = mysql_query( $reqFrags, $_SESSION["readServer"] ); 31 $valFrags = mysql_fetch_array( $resFrags ); 32 $fragAvail = ($valFrags["fragments"] > 0) ; 33 34 if( $fragAvail ) 35 $fragOk = @fopen("http://".$_POST["frag"]."/".$_POST["actpack"]."/".$_POST["actpack"]."-1", "r"); 36 else 37 $fragOk = true; 38 39 if( !isset($_POST["conf"] )) { 40 41 if( ! $opensslOk ) 42 echo "<br><center><font color=red><b>WARNING: OpenSSL for PHP is not properly installed.<br>Your https server validity was not checked !</b></font></center>"; 43 44 if( ! $httpsOk && $opensslOk ) echo "<br><center><b><font color='red'>".$l->g(466)." https://".$_POST["https"]."/".$_POST["actpack"]."/</font></b></center>"; 45 46 if( $httpsOk ) fclose( $httpsOk ); 47 48 if( ! $fragOk ) echo "<br><center><b><font color='red'>".$l->g(467)." http://".$_POST["frag"]."/".$_POST["actpack"]."/</font></b></center>"; 49 else if( $fragAvail ) fclose( $fragOk ); 50 } 51 52 if( (! $fragOk || ! $httpsOk || ! $opensslOk) && !isset($_POST["conf"]) ) {?> 53 <br><center><b><font color='red'><? echo $l->g(468);?></font></b></center> 54 <form name='formserv' id='formserv' action='index.php?multi=21' method='POST'> 55 <input type='hidden' name='actpack' value='<? echo $_POST["actpack"]; ?>'> 56 <input type='hidden' name='https' id='https' value='<? echo $_POST["https"]; ?>'> 57 <input type='hidden' name='frag' id='frag' value='<? echo $_POST["frag"]; ?>'> 58 <input type='hidden' name='conf' id='conf' value='OK'> 59 <center> 60 <input type='submit' value='<? echo $l->g(455);?>'> 61 <input type='button' value='<? echo $l->g(454);?>' OnClick='window.location="index.php?multi=21"'> 62 </center> 63 </form> 64 <? 65 } 66 else { 67 $req = "INSERT INTO download_enable(FILEID, INFO_LOC, PACK_LOC, CERT_FILE, CERT_PATH ) VALUES 68 ( '".$_POST["actpack"]."', '".$_POST["https"]."', '".$_POST["frag"]."', 'INSTALL_PATH/cacert.pem','INSTALL_PATH')"; 69 70 mysql_query( $req, $_SESSION["writeServer"]); 71 echo "<p align='center' class='text'><b>".$l->g(469)."</b></p>"; 72 73 } 74 } 75 else if( isset( $_GET["actpack"] )) {?> 76 <script language='javascript'> 77 function verifServ() { 78 if ( document.getElementById('https').value =="" || document.getElementById('frag').value =="" ) 79 alert("<? echo $l->g(239);?>"); 80 else document.getElementById('formserv').submit(); 81 82 } 83 </script> 84 <br> 85 <form name='formserv' id='formserv' action='index.php?multi=21' method='POST'> 86 <input type='hidden' name='actpack' value='<? echo $_GET["actpack"]; ?>'> 87 <table BGCOLOR='#C7D9F5' BORDER='0' WIDTH = '600px' ALIGN = 'Center' CELLPADDING='0' BORDERCOLOR='#9894B5'> 88 <tr height='30px'><td align='center' colspan='10'><b><? echo $l->g(465);?> <? echo $_GET["actpack"]; ?></b></td></tr> 89 <tr height='30px' bgcolor='#FFFFFF'><td align='left'><? echo $l->g(470);?>:</td><td><input type='text' name='https' id='https'>/<? echo $_GET["actpack"]; ?></td></tr> 90 <tr height='30px' bgcolor='#F2F2F2'><td align='left'><? echo $l->g(471);?>:</td><td><input type='text' name='frag' id='frag'>/<? echo $_GET["actpack"]; ?></td></tr> 91 <tr height='30px' bgcolor='#FFFFFF'><td align='right' colspan='10'><input type='button' OnClick='javascript:verifServ();' id='envoyer' value='<? echo $l->g(13);?>'></td></tr> 92 </table> 93 </form> 94 <?} 95 else if( isset( $_GET["suppack"] )) { 96 @mysql_query("DELETE FROM download_available WHERE FILEID='".$_GET["suppack"]."'", $_SESSION["writeServer"]) or die(mysql_error()); 97 if( ! recursive_remove_directory( $_SERVER["DOCUMENT_ROOT"]."/download/".$_GET["suppack"] )) { 98 echo "<br><center><b><font color='red'>".$l->g(472)." ".$_SERVER["DOCUMENT_ROOT"]."/download/".$_GET["suppack"]."</font></b></center>"; 99 } 100 } 101 102 $lbl = "pack"; 103 $sql = ""; 104 $whereId = "d.FILEID"; 105 $linkId = "d.FILEID"; 106 $select = array( "d.FILEID"=>"Timestamp", "NAME"=>$l->g(49), "PRIORITY"=>$l->g(440), "FRAGMENTS"=>$l->g(464), "SIZE"=>$l->g(462), "OSNAME"=>$l->g(25)); 107 $selectPrelim = array("d.FILEID"=>"d.FILEID"); 108 $from = "download_available d"; 109 $fromPrelim = ""; 110 $group = ""; 111 $order = ""; 112 $countId = "d.FILEID"; 113 114 $requete = new Req($lbl,$whereId,$linkId,$sql,$select,$selectPrelim,$from,$fromPrelim,$group,$order,$countId,true); 115 ShowResults($requete,true,false,false,false,false,true); 116 117 118 function recursive_remove_directory($directory, $empty=FALSE) { 119 if(substr($directory,-1) == '/') 120 $directory = substr($directory,0,-1); 121 122 if(!file_exists($directory) || !is_dir($directory)) 123 return FALSE; 124 elseif(is_readable($directory)) { 125 $handle = opendir($directory); 126 while (FALSE !== ($item = readdir($handle))) { 127 if($item != '.' && $item != '..') { 128 $path = $directory.'/'.$item; 129 if(is_dir($path)) 130 recursive_remove_directory($path); 131 else 132 unlink($path); 133 } 134 } 135 closedir($handle); 136 if($empty == FALSE) { 137 if(!rmdir($directory)) 138 return FALSE; 139 } 140 } 141 return TRUE; 142 } 143 144 ?> 145 <script language='javascript'> 146 function manualActive() { 147 if( isNaN(document.getElementById('tstamp').value) || document.getElementById('tstamp').value=="" ) 148 alert('<? echo $l->g(473);?>'); 149 else { 150 if( document.getElementById('tstamp').value.length != 10 ) 151 alert("<? echo $l->g(474);?>"); 152 else 153 window.location = 'index.php?multi=21&man=1&actpack=' + document.getElementById('tstamp').value; 154 } 155 156 } 157 </script> 158 159 <p class='text' align='center'><b><? echo $l->g(476);?></b> 160 <? echo $l->g(475);?>:<input id='tstamp' type='text' size='10'> 161 <a href='javascript:void(0);' OnClick='javascript:manualActive();'> 162 <img src='image/Gest_admin1.png'></a></p> 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
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 |