1 | <?php
|
---|
2 |
|
---|
3 | ini_set('memory_limit', '100M');
|
---|
4 |
|
---|
5 | if(!isset($_SERVER['REMOTE_ADDR']))
|
---|
6 | {
|
---|
7 | foreach($_SERVER['argv'] as $parameter)
|
---|
8 | {
|
---|
9 | if(strpos($parameter, '=') !== false)
|
---|
10 | {
|
---|
11 | $index = substr($parameter,0,strpos($parameter, '='));
|
---|
12 | $parameter = substr($parameter,strpos($parameter, '=')+1);
|
---|
13 | //echo ($index.' ---- '.$parameter);
|
---|
14 | $_GET[$index] = $parameter;
|
---|
15 | }
|
---|
16 | }
|
---|
17 | }
|
---|
18 |
|
---|
19 | include('../includes/global.php');
|
---|
20 | include('../includes/zip.lib.php');
|
---|
21 | include('export.php');
|
---|
22 | include('create_addon.php');
|
---|
23 | include('../includes/dbc.php');
|
---|
24 |
|
---|
25 | function CreateZipFromDir(&$Zip, $Path, $ZipPath)
|
---|
26 | {
|
---|
27 | //echo($Path.'<br />');
|
---|
28 | $FileList = scandir($Path);
|
---|
29 | foreach($FileList as $FileName)
|
---|
30 | {
|
---|
31 | if(file_exists($Path.$FileName) and ($FileName != '.') and ($FileName != '..'))
|
---|
32 | {
|
---|
33 | //echo($Path.$FileName.'<br />');
|
---|
34 | if(is_dir($Path.$FileName)) CreateZipFromDir($Zip, $Path.$FileName.'/', $ZipPath.$FileName.'/');
|
---|
35 | else $Zip->addFile(file_get_contents($Path.$FileName), $ZipPath.$FileName);
|
---|
36 | }
|
---|
37 | }
|
---|
38 | }
|
---|
39 |
|
---|
40 |
|
---|
41 | $sql = 'SELECT *, (SELECT user.user FROM user WHERE user.ID = tasks.User) as UserName FROM tasks WHERE Active = 1 ';
|
---|
42 | $ID = $Database->SQLCommand($sql);
|
---|
43 | while($Line = mysql_fetch_assoc($ID))
|
---|
44 | {
|
---|
45 | $ExportSetting = unserialize($Line['ExportSetting']);
|
---|
46 | $_SESSION['User'] = $Line['UserName'];
|
---|
47 | $_SESSION['UserID'] = $Line['User'];
|
---|
48 |
|
---|
49 | if(function_exists('gzcompress'))
|
---|
50 | {
|
---|
51 | $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/dbc/';
|
---|
52 | echo('Generování dbc souborů.. ');
|
---|
53 | ExportToDBC($ExportSetting);
|
---|
54 | $SaveFilename = $Config['Web']['TempFolder'].$_SESSION['User'].'/CzWoW_DBC.zip';
|
---|
55 | $Zip = new zipfile();
|
---|
56 | CreateZipFromDir($Zip, $TempDir, 'DBFilesClient/');
|
---|
57 | $Buffer = $Zip->file();
|
---|
58 | file_put_contents($SaveFilename, $Buffer);
|
---|
59 | echo('Hotovo');
|
---|
60 | } else echo('Funkce pro tvorbu Zip souboru není podporována!');
|
---|
61 | }
|
---|
62 |
|
---|
63 | $Database->SQLCommand('UPDATE tasks SET Active = 0');
|
---|
64 |
|
---|
65 |
|
---|
66 | // WriteLog('Generování dbc úloh', 2);
|
---|
67 | ?>
|
---|