Changeset 811
- Timestamp:
- May 28, 2014, 11:00:26 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Export/ProcessTask.php
r805 r811 6 6 include_once(dirname(__FILE__).'/../../includes/zip.lib.php'); 7 7 8 include_once('Export.php'); 9 include_once('ExportOutput.php'); 8 include_once('Export.php'); 9 include_once('ExportOutput.php'); 10 10 11 11 //LoadCommandLineParameters(); … … 25 25 { 26 26 $Dir = opendir($deldir.'/') ; 27 while(($File = readdir($Dir)) !== false) 27 while(($File = readdir($Dir)) !== false) 28 28 { 29 29 if(($File != '..') and ($File != '.') and (!is_dir("$File"))) unlink($deldir.'/'.$File); … … 38 38 if (file_exists($dst)) DeleteOldFiles($dst); 39 39 if (is_dir($src)) { 40 if (!file_exists($dst)) mkdir($dst, 0777, true); 40 if (!file_exists($dst)) mkdir($dst, 0777, true); 41 41 $files = scandir($src); 42 42 foreach ($files as $file) 43 if ($file != "." && $file != ".." and (!is_dir("$src/$file"))) rcopy("$src/$file", "$dst/$file"); 43 if ($file != "." && $file != ".." and (!is_dir("$src/$file"))) rcopy("$src/$file", "$dst/$file"); 44 44 } 45 45 else if (file_exists($src)) copy($src, $dst); … … 51 51 $patch = 'Z:'.$patch; 52 52 return $patch; 53 } 53 } 54 54 55 55 function MPQPack($packdir) { … … 58 58 { 59 59 $Dir = opendir($packdir.DIRECTORY_SEPARATOR) ; 60 while(($File = readdir($Dir)) !== false) 61 { 62 if(($File != '..') and ($File != '.')) { 60 while(($File = readdir($Dir)) !== false) 61 { 62 if(($File != '..') and ($File != '.')) { 63 63 $File = str_replace('/',DIRECTORY_SEPARATOR,$File); 64 64 $InDir = ''; … … 78 78 $InDir = 'Interface\\\\GlueXML\\\\'; 79 79 } 80 80 81 81 if (DIRECTORY_SEPARATOR == '/') // linux 82 82 echo exec('wine cmd /C mpq.exe "'.GetWinZPatch($packdir.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR).'patch-5.MPQ" '.$InDir.basename($File).' "'.GetWinZPatch($packdir.DIRECTORY_SEPARATOR).$File.'" '); 83 83 84 84 if (DIRECTORY_SEPARATOR == '\\') // windows 85 85 echo exec('mpq.exe "'.$packdir.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'patch-5.MPQ" '.$InDir.basename($File).' "'.$packdir.DIRECTORY_SEPARATOR.$File.'" '); 86 86 87 87 echo "\n"; 88 88 } … … 97 97 $DbResult = $System->Database->query('SELECT `ExportTask`.`Export`, `Export`.`Id` AS `ExportId` FROM `ExportTask`'. 98 98 ' LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE `Export`.`OutputType` = 9 AND `ExportTask`.`TimeFinish` IS NULL'); 99 while($DbRow = $DbResult->fetch_assoc()) 99 while($DbRow = $DbResult->fetch_assoc()) 100 100 { 101 101 echo(StrFTime("%d/%m/%Y %H:%M:%S", time()).': Generování DBC souborů pro export '.$DbRow['ExportId'].'.. '."\n"); 102 if($DbRow['ExportId'] != '') 103 { 104 try 102 if($DbRow['ExportId'] != '') 103 { 104 try 105 105 { 106 106 $Export = new Export($System); … … 111 111 112 112 echo('Mazání starých souborů...'."\n"); 113 113 114 114 // Delete old files 115 115 DeleteOldFiles($Export->TempDir.'dbc'); … … 117 117 118 118 SetProgress($Export,20); 119 if(function_exists('gzcompress')) 119 if(function_exists('gzcompress')) 120 120 { 121 121 $Export->ExportToDBC(); … … 126 126 } else echo('Funkce pro tvorbu Zip souboru není podporována!'."\n"); 127 127 $System->Database->query('UPDATE `ExportTask` SET `TimeFinish`=NOW() WHERE `Export`='.$Export->Id); 128 } catch (Exception $e) 128 } catch (Exception $e) 129 129 { 130 130 echo 'Caught exception: ', $e->getMessage(), "\n"; … … 141 141 $DbResult = $System->Database->query('SELECT `ExportTask`.`Export`, `Export`.`Id` AS `ExportId` FROM `ExportTask`'. 142 142 ' LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE `Export`.`OutputType` = 10 AND `ExportTask`.`TimeFinish` IS NULL'); 143 while($DbRow = $DbResult->fetch_assoc()) 143 while($DbRow = $DbResult->fetch_assoc()) 144 144 { 145 145 echo(StrFTime("%d/%m/%Y %H:%M:%S", time()).': Generování EXE souboru pro export '.$DbRow['ExportId'].'.. '."\n"); 146 if($DbRow['ExportId'] != '') 147 { 148 try 146 if($DbRow['ExportId'] != '') 147 { 148 try 149 149 { 150 150 // echo shell_exec('"'.dirname(__FILE__).'./client_cz_export.sh" '.$DbRow['ExportId'].''); … … 157 157 158 158 $nsifile = 'install.nsi'; 159 159 160 160 // Delete old files 161 161 SetProgress($Export,1); … … 164 164 DeleteOldFiles($Export->TempDir.'lua'); 165 165 DeleteOldFiles($Export->TempDir.'CzWoW'); 166 166 167 167 //copy need files 168 168 SetProgress($Export,5); … … 173 173 rcopy('files/'.$Export->ClientVersion['Version'].'/CzWoW/', $Export->TempDir.'CzWoW/'); 174 174 rcopy('files/WoW.ico', $Export->TempDir.'WoW.ico'); 175 rcopy('files/Fonts/', $Export->TempDir.'Fonts/'); 176 175 rcopy('files/Fonts/', $Export->TempDir.'Fonts/'); 176 177 177 SetProgress($Export,10); 178 178 echo('Export lua...'."\n"); … … 184 184 echo('Export dbc...'."\n"); 185 185 $Export->ExportToDBC(); 186 186 187 187 echo('Create readme...'."\n"); 188 188 SetProgress($Export,60); … … 191 191 $File->WriteLine($Export->GetReadme()); 192 192 unset($File); 193 193 194 194 echo('Packing files...'."\n"); 195 195 SetProgress($Export,70); … … 203 203 if (DIRECTORY_SEPARATOR == '/') // linux 204 204 echo exec('makensis '.$workdir.$nsifile); 205 205 206 206 if (DIRECTORY_SEPARATOR == '\\') // windows 207 echo exec('"'.$workdir.$nsifile.'" '); //"c:\Program Files (x86)\NSIS\makensisw.exe" /Xscriptcmd 207 echo exec('"'.$workdir.$nsifile.'" '); //"c:\Program Files (x86)\NSIS\makensisw.exe" /Xscriptcmd 208 208 209 209 SetProgress($Export,100); 210 210 echo ("\n"."Hotovo"."\n"); 211 211 $System->Database->query('UPDATE `ExportTask` SET `TimeFinish`=NOW() WHERE `Export`='.$DbRow['Export']); 212 } catch (Exception $e) 212 } catch (Exception $e) 213 213 { 214 214 echo 'Caught exception: ', $e->getMessage(), "\n"; -
trunk/Modules/Referrer/Referrer.php
r805 r811 41 41 { 42 42 $IP = GetRemoteAddress(); 43 44 // Check if client IP is not bl ocked as spam source45 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ` Referrer` WHERE `LastIP` = "'.$IP.'" AND (`Visible` = 0)');43 44 // Check if client IP is not blaclisted as spam source. If yes then add new referrer as invisible 45 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `BlackList` WHERE `IP` = "'.$IP.'"'); 46 46 $DbRow = $DbResult->fetch_row(); 47 if($DbRow[0] == 0) $Visible = '1'; 48 else $Visible = '0'; 47 if($DbRow[0] == 0) 48 { 49 $Visible = '1'; 50 $Description = ''; 51 } else 52 { 53 $Visible = '0'; 54 $Description = 'Spam'; 55 } 49 56 50 57 // Check if host name is already stored and need just to update hit counter … … 55 62 $this->System->Database->query('UPDATE `Referrer` SET `Hits` = `Hits` + 1, `DateLast` = NOW(), `LastURL` = "'. 56 63 addslashes($Referrer).'", `LastIP` = "'.$IP.'" WHERE `Id` = '.$DbRow['Id']); 57 } else $this->System->Database->query('INSERT INTO `Referrer` (`Web`, `DateFirst`, `DateLast`, `LastURL`, `Hits`, `LastIP`, `Visible`) '. 58 'VALUES ("'.$HostName.'", NOW(), NOW( ), "'.addslashes($Referrer).'", 1, "'.$IP.'", '.$Visible.')'); 64 } else 65 { 66 $this->System->Database->query('INSERT INTO `Referrer` (`Web`, `DateFirst`, `DateLast`, `LastURL`, `Hits`, `LastIP`, `Visible`, `Description`) '. 67 'VALUES ("'.$HostName.'", NOW(), NOW( ), "'.addslashes($Referrer).'", 1, "'.$IP.'", '.$Visible.', "'.$Description.'")'); 68 } 59 69 } 60 70 } … … 177 187 $Item = $DbResult->fetch_assoc(); 178 188 $this->Database->update('Referrer', 'Id='.$_GET['id'], array('Visible' => 0, 'Description' => 'Spam')); 189 $DbResult2 = $this->Database->select('BlackList', '*', 'IP="'.$Item['LastIP'].'"'); 190 if($DbResult2->num_rows == 0) 191 { 192 $this->Database->insert('BlackList', array('Time' => 'NOW()', 'IP' => $Item['LastIP'])); 193 } 179 194 $Output = ShowMessage(T('Set as spam'), MESSAGE_CRITICAL); 180 195 $Output .= $this->ShowList(); -
trunk/admin/UpdateTrace.php
r803 r811 2806 2806 } 2807 2807 2808 function UpdateTo811($Manager) 2809 { 2810 $Manager->Execute('CREATE TABLE IF NOT EXISTS `BlackList` ( 2811 `Id` int(11) NOT NULL AUTO_INCREMENT, 2812 `Time` datetime NOT NULL, 2813 `IP` varchar(255) NOT NULL, 2814 PRIMARY KEY (`Id`) 2815 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 2816 } 2817 2808 2818 $Updates = array( 2809 2819 498 => array('Revision' => 506, 'Function' => 'UpdateTo506'), … … 2833 2843 748 => array('Revision' => 787, 'Function' => 'UpdateTo787'), 2834 2844 787 => array('Revision' => 803, 'Function' => 'UpdateTo803'), 2845 803 => array('Revision' => 811, 'Function' => 'UpdateTo811'), 2835 2846 ); -
trunk/includes/Version.php
r810 r811 6 6 // and system will need database update. 7 7 8 $Revision = 81 0; // Subversion revision9 $DatabaseRevision = 8 03; // Database structure revision10 $ReleaseTime = '2014-05-2 5';8 $Revision = 811; // Subversion revision 9 $DatabaseRevision = 811; // Database structure revision 10 $ReleaseTime = '2014-05-28'; -
trunk/includes/system.php
r809 r811 250 250 and method_exists($this->OnPageNotFound[0], $this->OnPageNotFound[1])) 251 251 $Output = $this->BaseView->ShowPage(call_user_func_array($this->OnPageNotFound, array())); 252 else 252 else 253 253 { 254 254 $Output = $this->PageNotFound(); … … 452 452 { 453 453 $Output = $this->ShowHeader().$Content.$this->ShowFooter(); 454 if($this->System->Config['Web']['FormatOutput']) 454 if($this->System->Config['Web']['FormatOutput']) 455 455 $Output = $this->FormatOutput($Output); 456 456 return($Output);
Note:
See TracChangeset
for help on using the changeset viewer.