Version Description
- now Worpress Exports to XML can made
- new backup files formats tar, tar.gz, tar.bz2
- all job types can made in one job
- added php zip extension support (use pclzip only if not supported)
- removed PclZip trace code
- fixed time display and schedule bugs
- added some security
- Mantinance Mode on MySQL Operations
- new Design on some Pages
Download this release
Release Info
Developer | danielhuesken |
Plugin | BackWPup – WordPress Backup Plugin |
Version | 1.0.0 |
Comparing to | |
See all releases |
Code changes from version 0.8.1 to 1.0.0
- app/backwpup_dojob.php +295 -171
- app/functions.php +56 -39
- app/js/options.js +57 -0
- app/libs/{pclzip-trace.lib.php → pclzip.lib.php} +1 -683
- app/options-edit.php +0 -190
- app/options-jobs.php +238 -172
- app/options-logs.php +16 -16
- app/options-runnow-iframe.php +16 -13
- app/options-save.php +38 -46
- app/options-settings.php +87 -98
- app/options-tools.php +69 -58
- app/options-view_log-iframe.php +6 -5
- app/options.php +8 -8
- app/wp_xml_export.php +13 -0
- backwpup.php +2 -2
- lang/backwpup.pot +615 -432
- readme.txt +54 -8
app/backwpup_dojob.php
CHANGED
@@ -62,8 +62,11 @@ function backwpup_joberrorhandler($errno, $errstr, $errfile, $errline) {
|
|
62 |
@fputs($fd,"<span style=\"background-color:c3c3c3;\" title=\"".$title."\">".date_i18n('Y-m-d H:i.s').":</span> <span".$style.">".$errorstype." ".$errstr."</span><br />\n");
|
63 |
@fclose($fd);
|
64 |
|
65 |
-
if (!defined('DOING_CRON'))
|
66 |
echo "<span style=\"background-color:c3c3c3;\" title=\"".$title."\">".date_i18n('Y-m-d H:i.s').":</span> <span".$style.">".$errorstype." ".$errstr."</span><script type=\"text/javascript\">window.scrollBy(0, 15);</script><br />\n";
|
|
|
|
|
|
|
67 |
|
68 |
//write new log header
|
69 |
if (isset($errors) or isset($warnings)) {
|
@@ -72,21 +75,18 @@ function backwpup_joberrorhandler($errno, $errstr, $errfile, $errline) {
|
|
72 |
$line=@fgets($fd);
|
73 |
if (stripos($line,"<meta name=\"backwpup_errors\"") !== false and isset($errors)) {
|
74 |
@fseek($fd,$filepos);
|
75 |
-
@fputs($fd,"<meta name=\"backwpup_errors\" content=\"".$errors."\" />"
|
76 |
break;
|
77 |
}
|
78 |
if (stripos($line,"<meta name=\"backwpup_warnings\"") !== false and isset($warnings)) {
|
79 |
@fseek($fd,$filepos);
|
80 |
-
@fputs($fd,"<meta name=\"backwpup_warnings\" content=\"".$warnings."\" />"
|
81 |
break;
|
82 |
}
|
83 |
$filepos=ftell($fd);
|
84 |
}
|
85 |
@fclose($fd);
|
86 |
}
|
87 |
-
|
88 |
-
@flush();
|
89 |
-
@ob_flush();
|
90 |
|
91 |
if ($errno==E_ERROR or $errno==E_CORE_ERROR or $errno==E_COMPILE_ERROR) { //Die on fatal php errors.
|
92 |
die();
|
@@ -94,75 +94,6 @@ function backwpup_joberrorhandler($errno, $errstr, $errfile, $errline) {
|
|
94 |
//true for nor more php error hadling.
|
95 |
return true;
|
96 |
}
|
97 |
-
|
98 |
-
//PCL Zip trace functions
|
99 |
-
function PclTraceFctStart($p_file, $p_line, $p_name, $p_param="", $p_message="") {
|
100 |
-
return;
|
101 |
-
}
|
102 |
-
function TrFctStart($p_file, $p_line, $p_name, $p_param="", $p_message="") {
|
103 |
-
return;
|
104 |
-
}
|
105 |
-
function PclTraceFctEnd($p_file, $p_line, $p_level=1, $p_message="") {
|
106 |
-
return;
|
107 |
-
}
|
108 |
-
function TrFctEnd($p_file, $p_line, $p_level=1, $p_message="") {
|
109 |
-
return;
|
110 |
-
}
|
111 |
-
function PclTraceFctMessage($p_file, $p_line, $p_level, $p_message="") {
|
112 |
-
TrFctMessage($p_file, $p_line, $p_level, $p_message);
|
113 |
-
}
|
114 |
-
function TrFctMessage($p_file, $p_line, $p_level, $p_message="") {
|
115 |
-
global $backwpup_logfile;
|
116 |
-
global $backwpup_pcl_log_level;
|
117 |
-
|
118 |
-
if (($backwpup_pcl_log_level < $p_level))
|
119 |
-
return;
|
120 |
-
|
121 |
-
switch ($p_level) {
|
122 |
-
case 1:
|
123 |
-
$errorstype = __("[PCLZIP ERROR]");
|
124 |
-
$logheader=backwpup_read_logheader($backwpup_logfile); //read error count from log header
|
125 |
-
$errors=$logheader['errors']+1;
|
126 |
-
$style=' style="background-color:red;"';
|
127 |
-
break;
|
128 |
-
default:
|
129 |
-
$errorstype = "[PCLZIP ".$p_level."]";
|
130 |
-
$style='';
|
131 |
-
break;
|
132 |
-
}
|
133 |
-
|
134 |
-
$title="[Line: ".$p_line."|File: ".basename($p_file)."|Mem: ".backwpup_formatBytes(@memory_get_usage())."|Mem Max: ".backwpup_formatBytes(@memory_get_peak_usage())."|Mem Limit: ".ini_get('memory_limit')."]";
|
135 |
-
|
136 |
-
//wirte log file
|
137 |
-
$fd=@fopen($backwpup_logfile,"a+");
|
138 |
-
@fputs($fd,"<span style=\"background-color:c3c3c3;\" title=\"".$title."\">".date_i18n('Y-m-d H:i.s').":</span> <span".$style.">".$errorstype." ".$p_message."</span><br />\n");
|
139 |
-
@fclose($fd);
|
140 |
-
|
141 |
-
if (!defined('DOING_CRON'))
|
142 |
-
echo "<span style=\"background-color:c3c3c3;\" title=\"".$title."\">".date_i18n('Y-m-d H:i.s').":</span> <span".$style.">".$errorstype." ".$p_message."</span><script type=\"text/javascript\">window.scrollBy(0, 15);</script><br />\n";
|
143 |
-
|
144 |
-
//write new log header
|
145 |
-
if (isset($errors) or isset($warnings)) {
|
146 |
-
$fd=@fopen($backwpup_logfile,"r+");
|
147 |
-
while (!feof($fd)) {
|
148 |
-
$line=@fgets($fd);
|
149 |
-
if (stripos($line,"<meta name=\"backwpup_errors\"") !== false and isset($errors)) {
|
150 |
-
@fseek($fd,$filepos);
|
151 |
-
@fputs($fd,"<meta name=\"backwpup_errors\" content=\"".$errors."\" />".backwpup_fillspases(4-strlen($errors))."\n");
|
152 |
-
break;
|
153 |
-
}
|
154 |
-
if (stripos($line,"<meta name=\"backwpup_warnings\"") !== false and isset($warnings)) {
|
155 |
-
@fseek($fd,$filepos);
|
156 |
-
@fputs($fd,"<meta name=\"backwpup_warnings\" content=\"".$warnings."\" />".backwpup_fillspases(4-strlen($warnings))."\n");
|
157 |
-
break;
|
158 |
-
}
|
159 |
-
$filepos=ftell($fd);
|
160 |
-
}
|
161 |
-
@fclose($fd);
|
162 |
-
}
|
163 |
-
|
164 |
-
@flush();
|
165 |
-
}
|
166 |
|
167 |
|
168 |
/**
|
@@ -173,8 +104,10 @@ class backwpup_dojob {
|
|
173 |
|
174 |
private $jobid=0;
|
175 |
private $filelist=array();
|
|
|
176 |
private $allfilesize=0;
|
177 |
private $backupfile='';
|
|
|
178 |
private $backupdir='';
|
179 |
private $logdir='';
|
180 |
private $logfile='';
|
@@ -192,17 +125,23 @@ class backwpup_dojob {
|
|
192 |
if ($backwpup_pcl_log_level<1 or $backwpup_pcl_log_level>5) //set to 1 for false values
|
193 |
$backwpup_pcl_log_level=1;
|
194 |
$jobs=get_option('backwpup_jobs'); //load jobdata
|
195 |
-
$jobs[$this->jobid]['starttime']=
|
196 |
$jobs[$this->jobid]['stoptime']=''; //Set stop time for job
|
197 |
-
$
|
|
|
198 |
update_option('backwpup_jobs',$jobs); //Save job Settings
|
199 |
$this->job=$jobs[$this->jobid]; //Set job settings
|
|
|
|
|
|
|
|
|
|
|
200 |
//set Temp Dir
|
201 |
$this->tempdir=untrailingslashit($this->cfg['dirtemp']);
|
202 |
if (empty($this->tempdir))
|
203 |
$this->tempdir=get_temp_dir().'backwpup';
|
204 |
//set Backup Dir
|
205 |
-
$this->backupdir=untrailingslashit($this->job['backupdir']);
|
206 |
if (empty($this->backupdir))
|
207 |
$this->backupdir=get_temp_dir().'backwpup';
|
208 |
//set Logs Dir
|
@@ -210,8 +149,8 @@ class backwpup_dojob {
|
|
210 |
if (empty($this->logdir))
|
211 |
$this->logdir=get_temp_dir().'backwpup/logs';
|
212 |
//set Backup file name only for jos that makes backups
|
213 |
-
if (
|
214 |
-
$this->backupfile='backwpup_'.$this->jobid.'_'.date_i18n('Y-m-d_H-i-s')
|
215 |
//set Log file name
|
216 |
$this->logfile='backwpup_log_'.date_i18n('Y-m-d_H-i-s').'.html';
|
217 |
$backwpup_logfile=$this->logdir.'/'.$this->logfile;
|
@@ -221,15 +160,15 @@ class backwpup_dojob {
|
|
221 |
$fd=@fopen($backwpup_logfile,"a+");
|
222 |
@fputs($fd,"<html>\n<head>\n");
|
223 |
@fputs($fd,"<meta name=\"backwpup_version\" content=\"".BACKWPUP_VERSION."\" />\n");
|
224 |
-
@fputs($fd,"<meta name=\"backwpup_logtime\" content=\"".
|
225 |
-
@fputs($fd,"<meta name=\"backwpup_errors\" content=\"0\" />"
|
226 |
-
@fputs($fd,"<meta name=\"backwpup_warnings\" content=\"0\" />"
|
227 |
@fputs($fd,"<meta name=\"backwpup_jobid\" content=\"".$this->jobid."\" />\n");
|
228 |
@fputs($fd,"<meta name=\"backwpup_jobname\" content=\"".$this->job['name']."\" />\n");
|
229 |
-
@fputs($fd,"<meta name=\"backwpup_jobtype\" content=\""
|
230 |
if (!empty($this->backupfile))
|
231 |
@fputs($fd,"<meta name=\"backwpup_backupfile\" content=\"".$this->backupdir."/".$this->backupfile."\" />\n");
|
232 |
-
@fputs($fd,"<meta name=\"backwpup_jobruntime\" content=\"0\" />"
|
233 |
@fputs($fd,"<title>".sprintf(__('BackWPup Log for %1$s from %2$s at %3$s','backwpup'),$this->job['name'],date_i18n(get_option('date_format')),date_i18n(get_option('time_format')))."</title>\n</head>\n<body style=\"font-family:monospace;font-size:12px;white-space:nowrap;\">\n");
|
234 |
@fclose($fd);
|
235 |
//PHP Error handling
|
@@ -253,39 +192,45 @@ class backwpup_dojob {
|
|
253 |
trigger_error(sprintf(__('Memory limit set to %1$s ,because can not use PHP: memory_get_usage() function to dynamicli increase the Memeory!','backwpup'),ini_get('memory_limit')),E_USER_WARNING);
|
254 |
}
|
255 |
//run job parts
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
$this->
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
$this->
|
278 |
-
|
279 |
-
break;
|
280 |
-
case 'FILE':
|
281 |
-
$this->file_list();
|
282 |
-
$this->zip_files();
|
283 |
$this->destination_mail();
|
284 |
$this->destination_ftp();
|
285 |
$this->destination_s3();
|
286 |
-
$this->destination_dir();
|
287 |
-
|
288 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
289 |
}
|
290 |
|
291 |
private function _check_folders($folder) {
|
@@ -350,6 +295,40 @@ class backwpup_dojob {
|
|
350 |
return true;
|
351 |
}
|
352 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
353 |
private function check_db($exclude_tables) {
|
354 |
global $wpdb;
|
355 |
|
@@ -365,8 +344,10 @@ class backwpup_dojob {
|
|
365 |
}
|
366 |
}
|
367 |
|
|
|
368 |
//check tables
|
369 |
if (sizeof($tables)>0) {
|
|
|
370 |
foreach ($tables as $table) {
|
371 |
$check=$wpdb->get_row('CHECK TABLE `'.$table.'` MEDIUM', ARRAY_A);
|
372 |
if ($check['Msg_type']=='error')
|
@@ -393,16 +374,14 @@ class backwpup_dojob {
|
|
393 |
}
|
394 |
}
|
395 |
$wpdb->flush();
|
|
|
396 |
trigger_error(__('Database check done!','backwpup'),E_USER_NOTICE);
|
397 |
} else {
|
398 |
trigger_error(__('No Tables to check','backwpup'),E_USER_WARNING);
|
399 |
}
|
400 |
}
|
401 |
|
402 |
-
|
403 |
private function dump_db_table($table,$status,$file) {
|
404 |
-
global $wpdb;
|
405 |
-
$table = str_replace("�", "��", $table); //esc table name
|
406 |
|
407 |
// create dump
|
408 |
fwrite($file, "\n");
|
@@ -414,8 +393,8 @@ class backwpup_dojob {
|
|
414 |
fwrite($file, "/*!40101 SET character_set_client = '".mysql_client_encoding()."' */;\n");
|
415 |
//Dump the table structure
|
416 |
$result=mysql_query("SHOW CREATE TABLE `".$table."`");
|
417 |
-
if (
|
418 |
-
trigger_error(sprintf(__('BackWPup database error %1$s for query %2$s','backwpup'),
|
419 |
return false;
|
420 |
}
|
421 |
$tablestruc=mysql_fetch_assoc($result);
|
@@ -424,8 +403,8 @@ class backwpup_dojob {
|
|
424 |
|
425 |
//take data of table
|
426 |
$result=mysql_query("SELECT * FROM `".$table."`");
|
427 |
-
if (
|
428 |
-
trigger_error(sprintf(__('BackWPup database error %1$s for query %2$s','backwpup'),
|
429 |
return false;
|
430 |
}
|
431 |
|
@@ -435,6 +414,7 @@ class backwpup_dojob {
|
|
435 |
fwrite($file, "LOCK TABLES `".$table."` WRITE;\n\n");
|
436 |
if ($status['Engine']=='MyISAM')
|
437 |
fwrite($file, "/*!40000 ALTER TABLE `".$table."` DISABLE KEYS */;\n");
|
|
|
438 |
|
439 |
while ($data = mysql_fetch_assoc($result)) {
|
440 |
$keys = array();
|
@@ -444,10 +424,9 @@ class backwpup_dojob {
|
|
444 |
if($value === NULL) // Make Value NULL to string NULL
|
445 |
$value = "NULL";
|
446 |
elseif($value === "" or $value === false) // if empty or false Value make "" as Value
|
447 |
-
$value = '"
|
448 |
elseif(!is_numeric($value)) //is value not numeric esc
|
449 |
-
$value = "
|
450 |
-
|
451 |
$values[] = $value;
|
452 |
}
|
453 |
// make data dump
|
@@ -461,9 +440,12 @@ class backwpup_dojob {
|
|
461 |
public function dump_db($exclude_tables) {
|
462 |
global $wpdb;
|
463 |
trigger_error(__('Run Database Dump to file...','backwpup'),E_USER_NOTICE);
|
|
|
464 |
|
465 |
//Tables to backup
|
466 |
$tables=$wpdb->get_col('SHOW TABLES FROM `'.DB_NAME.'`');
|
|
|
|
|
467 |
if (is_array($exclude_tables)) {
|
468 |
foreach($tables as $tablekey => $tablevalue) {
|
469 |
if (in_array($tablevalue,$exclude_tables))
|
@@ -533,11 +515,25 @@ class backwpup_dojob {
|
|
533 |
trigger_error(__('Database Dump done!','backwpup'),E_USER_NOTICE);
|
534 |
//add database file to backupfiles
|
535 |
trigger_error(__('Add Database Dump to Backup:','backwpup').' '.DB_NAME.'.sql '.backwpup_formatBytes(filesize($this->tempdir.'/'.DB_NAME.'.sql')),E_USER_NOTICE);
|
536 |
-
$this->allfilesize
|
537 |
$this->filelist[]=array(79001=>$this->tempdir.'/'.DB_NAME.'.sql',79003=>DB_NAME.'.sql');
|
538 |
-
|
|
|
539 |
}
|
540 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
541 |
public function optimize_db($exclude_tables) {
|
542 |
global $wpdb;
|
543 |
|
@@ -554,6 +550,7 @@ class backwpup_dojob {
|
|
554 |
}
|
555 |
|
556 |
if (sizeof($tables)>0) {
|
|
|
557 |
foreach ($tables as $table) {
|
558 |
$optimize=$wpdb->get_row('OPTIMIZE TABLE `'.$table.'`', ARRAY_A);
|
559 |
if ($optimize['Msg_type']=='error')
|
@@ -568,6 +565,7 @@ class backwpup_dojob {
|
|
568 |
}
|
569 |
$wpdb->flush();
|
570 |
trigger_error(__('Database optimize done!','backwpup'),E_USER_NOTICE);
|
|
|
571 |
} else {
|
572 |
trigger_error(__('No Tables to optimize','backwpup'),E_USER_WARNING);
|
573 |
}
|
@@ -583,7 +581,7 @@ class backwpup_dojob {
|
|
583 |
if ( in_array($file, array('.', '..','.svn') ) )
|
584 |
continue;
|
585 |
foreach ($excludes as $exclusion) { //exclude dirs and files
|
586 |
-
if (false !== stripos($folder.'/'.$file
|
587 |
continue 2;
|
588 |
}
|
589 |
if (!$this->job['backuproot'] and false !== stripos($folder.'/'.$file,str_replace('\\','/',ABSPATH)) and false === stripos($folder.'/'.$file,str_replace('\\','/',WP_CONTENT_DIR)) and !is_dir($folder.'/'.$file))
|
@@ -595,10 +593,9 @@ class backwpup_dojob {
|
|
595 |
if ( is_dir( $folder . '/' . $file ) ) {
|
596 |
$this->_file_list_folder( $folder . '/' . $file, $levels - 1, $excludes);
|
597 |
} elseif (is_file( $folder . '/' . $file )) {
|
598 |
-
if (is_readable($folder . '/' . $file)) {
|
599 |
$this->filelist[]=array(79001=>$folder.'/' .$file,79003=>str_replace(str_replace('\\','/',trailingslashit(ABSPATH)),'',$folder.'/') . $file);
|
600 |
$this->allfilesize=$this->allfilesize+filesize($folder . '/' . $file);
|
601 |
-
trigger_error(__('Add File to Backup:','backwpup').' '.$folder . '/' . $file.' '.backwpup_formatBytes(filesize($folder . '/' . $file)),E_USER_NOTICE);
|
602 |
} else {
|
603 |
trigger_error(__('Can not read file:','backwpup').' '.$folder . '/' . $file,E_USER_WARNING);
|
604 |
}
|
@@ -612,6 +609,7 @@ class backwpup_dojob {
|
|
612 |
|
613 |
public function file_list() {
|
614 |
//Make filelist
|
|
|
615 |
$backwpup_exclude=array(); $dirinclude=array();
|
616 |
|
617 |
if (!empty($this->job['fileexclude']))
|
@@ -628,7 +626,7 @@ class backwpup_dojob {
|
|
628 |
|
629 |
//include dirs
|
630 |
if (!empty($this->job['dirinclude']))
|
631 |
-
$dirinclude=explode(','
|
632 |
|
633 |
if ($this->job['backuproot']) //Include extra path
|
634 |
$dirinclude[]=ABSPATH;
|
@@ -643,36 +641,149 @@ class backwpup_dojob {
|
|
643 |
if (is_dir($dirincludevalue))
|
644 |
$this->_file_list_folder(untrailingslashit(str_replace('\\','/',$dirincludevalue)),100,$backwpup_exclude);
|
645 |
}
|
646 |
-
}
|
647 |
-
}
|
648 |
|
649 |
-
public function zip_files() {
|
650 |
-
|
651 |
-
define( 'PCLZIP_TEMPORARY_DIR', $this->tempdir );
|
652 |
-
if (!class_exists('PclZip')) require_once 'libs/pclzip-trace.lib.php';
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
if (!is_array($this->filelist[0])) {
|
657 |
trigger_error(__('No files to Backup','backwpup'),E_USER_ERROR);
|
658 |
} else {
|
659 |
trigger_error(__('Size off all files:','backwpup').' '.backwpup_formatBytes($this->allfilesize),E_USER_NOTICE);
|
660 |
}
|
|
|
|
|
661 |
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
trigger_error(__('Create Backup Zip file...','backwpup'),E_USER_NOTICE);
|
666 |
-
$
|
667 |
-
if (
|
668 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
669 |
} else {
|
670 |
-
trigger_error(__('
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
671 |
}
|
672 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
673 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
674 |
}
|
675 |
|
|
|
676 |
public function _ftp_raw_helper($ftp_conn_id,$command) { //FTP Comands helper function
|
677 |
$return=ftp_raw($ftp_conn_id,$command);
|
678 |
if (strtoupper(substr(trim($command),0,4))=="PASS") {
|
@@ -703,6 +814,11 @@ class backwpup_dojob {
|
|
703 |
|
704 |
|
705 |
public function destination_ftp() {
|
|
|
|
|
|
|
|
|
|
|
706 |
if (empty($this->job['ftphost']) or empty($this->job['ftpuser']) or empty($this->job['ftppass']))
|
707 |
return false;
|
708 |
|
@@ -775,26 +891,26 @@ class backwpup_dojob {
|
|
775 |
}
|
776 |
}
|
777 |
|
778 |
-
if (ftp_put($ftp_conn_id,
|
779 |
-
trigger_error(__('Backup File transferred to FTP Server:','backwpup').' '
|
780 |
else
|
781 |
trigger_error(__('Can not transfer backup to FTP server.','backwpup'),E_USER_ERROR);
|
782 |
-
|
783 |
-
unset($backupfilelist);
|
784 |
if ($this->job['ftpmaxbackups']>0) { //Delete old backups
|
785 |
-
|
|
|
786 |
foreach($filelist as $files) {
|
787 |
-
if ('backwpup_'.$this->jobid.'_' == substr(basename($files),0,strlen('backwpup_'.$this->jobid.'_')) and
|
788 |
$backupfilelist[]=basename($files);
|
789 |
}
|
790 |
if (sizeof($backupfilelist)>0) {
|
791 |
rsort($backupfilelist);
|
792 |
$numdeltefiles=0;
|
793 |
for ($i=$this->job['ftpmaxbackups'];$i<sizeof($backupfilelist);$i++) {
|
794 |
-
if (ftp_delete($ftp_conn_id,
|
795 |
$numdeltefiles++;
|
796 |
else
|
797 |
-
trigger_error(__('Can not delete file on FTP Server:','backwpup').' '
|
798 |
}
|
799 |
if ($numdeltefiles>0)
|
800 |
trigger_error($numdeltefiles.' '.__('files deleted on FTP Server:','backwpup'),E_USER_NOTICE);
|
@@ -876,6 +992,10 @@ class backwpup_dojob {
|
|
876 |
}
|
877 |
|
878 |
public function destination_s3() {
|
|
|
|
|
|
|
|
|
879 |
if (empty($this->job['awsAccessKey']) or empty($this->job['awsSecretKey']) or empty($this->job['awsBucket']))
|
880 |
return false;
|
881 |
|
@@ -891,18 +1011,18 @@ class backwpup_dojob {
|
|
891 |
if (in_array($this->job['awsBucket'],$s3->listBuckets())) {
|
892 |
trigger_error(__('Connected to S3 Bucket:','backwpup').' '.$this->job['awsBucket'],E_USER_NOTICE);
|
893 |
//Transfer Backup to S3
|
894 |
-
if ($s3->putObjectFile($this->backupdir.'/'.$this->backupfile, $this->job['awsBucket'],
|
895 |
-
trigger_error(__('Backup File transferred to S3://','backwpup').$this->job['awsBucket'].'/'
|
896 |
else
|
897 |
trigger_error(__('Can not transfer backup to S3.','backwpup'),E_USER_ERROR);
|
898 |
-
|
899 |
-
unset($backupfilelist);
|
900 |
if ($this->job['awsmaxbackups']>0) { //Delete old backups
|
|
|
901 |
if (($contents = $s3->getBucket($this->job['awsBucket'])) !== false) {
|
902 |
foreach ($contents as $object) {
|
903 |
-
if (
|
904 |
$files=basename($object['name']);
|
905 |
-
if ('backwpup_'.$this->jobid.'_' == substr(basename($files),0,strlen('backwpup_'.$this->jobid.'_')) and
|
906 |
$backupfilelist[]=basename($object['name']);
|
907 |
}
|
908 |
}
|
@@ -911,10 +1031,10 @@ class backwpup_dojob {
|
|
911 |
rsort($backupfilelist);
|
912 |
$numdeltefiles=0;
|
913 |
for ($i=$this->job['awsmaxbackups'];$i<sizeof($backupfilelist);$i++) {
|
914 |
-
if ($s3->deleteObject($this->job['awsBucket'],
|
915 |
$numdeltefiles++;
|
916 |
else
|
917 |
-
trigger_error(__('Can not delete file on S3//:','backwpup').$this->job['awsBucket'].'/'
|
918 |
if ($numdeltefiles>0)
|
919 |
trigger_error($numdeltefiles.' '.__('files deleted on S3 Bucket!','backwpup'),E_USER_NOTICE);
|
920 |
}
|
@@ -927,10 +1047,11 @@ class backwpup_dojob {
|
|
927 |
|
928 |
public function destination_dir() {
|
929 |
//Delete old Backupfiles
|
|
|
930 |
if (!empty($this->job['maxbackups']) and !empty($this->job['backupdir']) and is_dir($this->job['backupdir'])) {
|
931 |
if ( $dir = @opendir($this->job['backupdir']) ) { //make file list
|
932 |
while (($file = readdir($dir)) !== false ) {
|
933 |
-
if ('backwpup_'.$this->jobid.'_' == substr($file,0,strlen('backwpup_'.$this->jobid.'_')) and
|
934 |
$backupfilelist[]=$file;
|
935 |
}
|
936 |
@closedir( $dir );
|
@@ -952,13 +1073,17 @@ class backwpup_dojob {
|
|
952 |
global $backwpup_logfile;
|
953 |
|
954 |
if (is_file($this->backupdir.'/'.$this->backupfile)) {
|
955 |
-
trigger_error(sprintf(__('Backup
|
956 |
}
|
957 |
|
958 |
if (is_file($this->tempdir.'/'.DB_NAME.'.sql') ) { //delete sql temp file
|
959 |
unlink($this->tempdir.'/'.DB_NAME.'.sql');
|
960 |
}
|
961 |
-
|
|
|
|
|
|
|
|
|
962 |
if (empty($this->job['backupdir']) and ($this->backupdir!=$this->tempdir) and is_file($this->backupdir.'/'.$this->backupfile)) { //delete backup file in temp dir
|
963 |
unlink($this->backupdir.'/'.$this->backupfile);
|
964 |
}
|
@@ -985,20 +1110,19 @@ class backwpup_dojob {
|
|
985 |
}
|
986 |
|
987 |
$jobs=get_option('backwpup_jobs');
|
988 |
-
$jobs[$this->jobid]['stoptime']=
|
989 |
$jobs[$this->jobid]['lastrun']=$jobs[$this->jobid]['starttime'];
|
990 |
$jobs[$this->jobid]['lastruntime']=$jobs[$this->jobid]['stoptime']-$jobs[$this->jobid]['starttime'];
|
991 |
-
$jobs[$this->jobid]['scheduletime']=wp_next_scheduled('backwpup_cron',array('jobid'=>$this->jobid));
|
992 |
update_option('backwpup_jobs',$jobs); //Save Settings
|
993 |
trigger_error(sprintf(__('Job done in %1s sec.','backwpup'),$jobs[$this->jobid]['lastruntime']),E_USER_NOTICE);
|
994 |
-
|
995 |
//write runtime header
|
996 |
$fd=@fopen($backwpup_logfile,"r+");
|
997 |
while (!feof($fd)) {
|
998 |
$line=@fgets($fd);
|
999 |
if (stripos($line,"<meta name=\"backwpup_jobruntime\"") !== false) {
|
1000 |
@fseek($fd,$filepos);
|
1001 |
-
@fputs($fd,"<meta name=\"backwpup_jobruntime\" content=\"".$jobs[$this->jobid]['lastruntime']."\" />"
|
1002 |
break;
|
1003 |
}
|
1004 |
$filepos=ftell($fd);
|
62 |
@fputs($fd,"<span style=\"background-color:c3c3c3;\" title=\"".$title."\">".date_i18n('Y-m-d H:i.s').":</span> <span".$style.">".$errorstype." ".$errstr."</span><br />\n");
|
63 |
@fclose($fd);
|
64 |
|
65 |
+
if (!defined('DOING_CRON')) {
|
66 |
echo "<span style=\"background-color:c3c3c3;\" title=\"".$title."\">".date_i18n('Y-m-d H:i.s').":</span> <span".$style.">".$errorstype." ".$errstr."</span><script type=\"text/javascript\">window.scrollBy(0, 15);</script><br />\n";
|
67 |
+
@flush();
|
68 |
+
@ob_flush();
|
69 |
+
}
|
70 |
|
71 |
//write new log header
|
72 |
if (isset($errors) or isset($warnings)) {
|
75 |
$line=@fgets($fd);
|
76 |
if (stripos($line,"<meta name=\"backwpup_errors\"") !== false and isset($errors)) {
|
77 |
@fseek($fd,$filepos);
|
78 |
+
@fputs($fd,str_pad("<meta name=\"backwpup_errors\" content=\"".$errors."\" />",100)."\n");
|
79 |
break;
|
80 |
}
|
81 |
if (stripos($line,"<meta name=\"backwpup_warnings\"") !== false and isset($warnings)) {
|
82 |
@fseek($fd,$filepos);
|
83 |
+
@fputs($fd,str_pad("<meta name=\"backwpup_warnings\" content=\"".$warnings."\" />",100)."\n");
|
84 |
break;
|
85 |
}
|
86 |
$filepos=ftell($fd);
|
87 |
}
|
88 |
@fclose($fd);
|
89 |
}
|
|
|
|
|
|
|
90 |
|
91 |
if ($errno==E_ERROR or $errno==E_CORE_ERROR or $errno==E_COMPILE_ERROR) { //Die on fatal php errors.
|
92 |
die();
|
94 |
//true for nor more php error hadling.
|
95 |
return true;
|
96 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
|
99 |
/**
|
104 |
|
105 |
private $jobid=0;
|
106 |
private $filelist=array();
|
107 |
+
private $todo=array();
|
108 |
private $allfilesize=0;
|
109 |
private $backupfile='';
|
110 |
+
private $backupfileformat='.zip';
|
111 |
private $backupdir='';
|
112 |
private $logdir='';
|
113 |
private $logfile='';
|
125 |
if ($backwpup_pcl_log_level<1 or $backwpup_pcl_log_level>5) //set to 1 for false values
|
126 |
$backwpup_pcl_log_level=1;
|
127 |
$jobs=get_option('backwpup_jobs'); //load jobdata
|
128 |
+
$jobs[$this->jobid]['starttime']=current_time('timestamp'); //set start time for job
|
129 |
$jobs[$this->jobid]['stoptime']=''; //Set stop time for job
|
130 |
+
if ($schedteime=wp_next_scheduled('backwpup_cron',array('jobid'=>$this->jobid))) //set Schedule time to next scheduled
|
131 |
+
$jobs[$this->jobid]['scheduletime']=$schedteime;
|
132 |
update_option('backwpup_jobs',$jobs); //Save job Settings
|
133 |
$this->job=$jobs[$this->jobid]; //Set job settings
|
134 |
+
//set waht to do
|
135 |
+
$this->todo=explode('+',$this->job['type']);
|
136 |
+
//set Backup File format Dir
|
137 |
+
if (!empty($this->job['fileformart']) or $this->job['fileformart']=='.zip' or $this->job['fileformart']=='.tar' or $this->job['fileformart']=='.tar.gz' or $this->job['fileformart']=='.tar.bz2')
|
138 |
+
$this->backupfileformat=$this->job['fileformart'];
|
139 |
//set Temp Dir
|
140 |
$this->tempdir=untrailingslashit($this->cfg['dirtemp']);
|
141 |
if (empty($this->tempdir))
|
142 |
$this->tempdir=get_temp_dir().'backwpup';
|
143 |
//set Backup Dir
|
144 |
+
$this->backupdir=untrailingslashit(str_replace('//','/',str_replace('\\','/',stripslashes($this->job['backupdir']))));
|
145 |
if (empty($this->backupdir))
|
146 |
$this->backupdir=get_temp_dir().'backwpup';
|
147 |
//set Logs Dir
|
149 |
if (empty($this->logdir))
|
150 |
$this->logdir=get_temp_dir().'backwpup/logs';
|
151 |
//set Backup file name only for jos that makes backups
|
152 |
+
if (in_array('FILE',$this->todo) or in_array('DB',$this->todo) or in_array('WPEXP',$this->todo))
|
153 |
+
$this->backupfile='backwpup_'.$this->jobid.'_'.date_i18n('Y-m-d_H-i-s').$this->backupfileformat;
|
154 |
//set Log file name
|
155 |
$this->logfile='backwpup_log_'.date_i18n('Y-m-d_H-i-s').'.html';
|
156 |
$backwpup_logfile=$this->logdir.'/'.$this->logfile;
|
160 |
$fd=@fopen($backwpup_logfile,"a+");
|
161 |
@fputs($fd,"<html>\n<head>\n");
|
162 |
@fputs($fd,"<meta name=\"backwpup_version\" content=\"".BACKWPUP_VERSION."\" />\n");
|
163 |
+
@fputs($fd,"<meta name=\"backwpup_logtime\" content=\"".current_time('timestamp')."\" />\n");
|
164 |
+
@fputs($fd,str_pad("<meta name=\"backwpup_errors\" content=\"0\" />",100)."\n");
|
165 |
+
@fputs($fd,str_pad("<meta name=\"backwpup_warnings\" content=\"0\" />",100)."\n");
|
166 |
@fputs($fd,"<meta name=\"backwpup_jobid\" content=\"".$this->jobid."\" />\n");
|
167 |
@fputs($fd,"<meta name=\"backwpup_jobname\" content=\"".$this->job['name']."\" />\n");
|
168 |
+
@fputs($fd,"<meta name=\"backwpup_jobtype\" content=\"".$this->job['type']."\" />\n");
|
169 |
if (!empty($this->backupfile))
|
170 |
@fputs($fd,"<meta name=\"backwpup_backupfile\" content=\"".$this->backupdir."/".$this->backupfile."\" />\n");
|
171 |
+
@fputs($fd,str_pad("<meta name=\"backwpup_jobruntime\" content=\"0\" />",100)."\n");
|
172 |
@fputs($fd,"<title>".sprintf(__('BackWPup Log for %1$s from %2$s at %3$s','backwpup'),$this->job['name'],date_i18n(get_option('date_format')),date_i18n(get_option('time_format')))."</title>\n</head>\n<body style=\"font-family:monospace;font-size:12px;white-space:nowrap;\">\n");
|
173 |
@fclose($fd);
|
174 |
//PHP Error handling
|
192 |
trigger_error(sprintf(__('Memory limit set to %1$s ,because can not use PHP: memory_get_usage() function to dynamicli increase the Memeory!','backwpup'),ini_get('memory_limit')),E_USER_WARNING);
|
193 |
}
|
194 |
//run job parts
|
195 |
+
foreach($this->todo as $key => $value) {
|
196 |
+
switch ($value) {
|
197 |
+
case 'DB':
|
198 |
+
$this->dump_db($this->job['dbexclude']);
|
199 |
+
break;
|
200 |
+
case 'WPEXP':
|
201 |
+
$this->export_wp();
|
202 |
+
break;
|
203 |
+
case 'FILE':
|
204 |
+
$this->file_list();
|
205 |
+
break;
|
206 |
+
}
|
207 |
+
}
|
208 |
+
|
209 |
+
if (isset($this->filelist[0][79001])) { // Zip Files and put it to destionation if filelist isnt empty
|
210 |
+
if ($this->backupfileformat==".zip")
|
211 |
+
$this->zip_files();
|
212 |
+
elseif ($this->backupfileformat==".tar.gz" or $this->backupfileformat==".tar.bz2" or $this->backupfileformat==".tar")
|
213 |
+
$this->tar_pack_files();
|
214 |
+
else
|
215 |
+
return;
|
216 |
+
if (!file_exists($this->backupdir.'/'.$this->backupfile))
|
217 |
+
return;
|
|
|
|
|
|
|
|
|
218 |
$this->destination_mail();
|
219 |
$this->destination_ftp();
|
220 |
$this->destination_s3();
|
221 |
+
$this->destination_dir();
|
222 |
+
}
|
223 |
+
|
224 |
+
foreach($this->todo as $key => $value) {
|
225 |
+
switch ($value) {
|
226 |
+
case 'CHECK':
|
227 |
+
$this->check_db($this->job['dbexclude']);
|
228 |
+
break;
|
229 |
+
case 'OPTIMIZE':
|
230 |
+
$this->optimize_db($this->job['dbexclude']);
|
231 |
+
break;
|
232 |
+
}
|
233 |
+
}
|
234 |
}
|
235 |
|
236 |
private function _check_folders($folder) {
|
295 |
return true;
|
296 |
}
|
297 |
|
298 |
+
private function maintenance_mode($enable = false) {
|
299 |
+
if (!$this->job['maintenance'])
|
300 |
+
return;
|
301 |
+
|
302 |
+
if ( $enable ) {
|
303 |
+
trigger_error(__('Set Blog to Maintenance Mode','backwpup'),E_USER_NOTICE);
|
304 |
+
if ( class_exists('WPMaintenanceMode') ) { //Support for WP Maintenance Mode Plugin
|
305 |
+
update_option('wp-maintenance-mode-msqld','1');
|
306 |
+
} elseif ( class_exists('MaintenanceMode') ) { //Support for Maintenance Mode Plugin
|
307 |
+
$mamo=get_option('plugin_maintenance-mode');
|
308 |
+
$mamo['mamo_activate']='on_'.current_time('timestamp');
|
309 |
+
$mamo['mamo_backtime_days']='0';
|
310 |
+
$mamo['mamo_backtime_hours']='0';
|
311 |
+
$mamo['mamo_backtime_mins']='5';
|
312 |
+
update_option('plugin_maintenance-mode',$mamo);
|
313 |
+
} else { //WP Support
|
314 |
+
$fdmain=fopen(trailingslashit(ABSPATH).'.maintenance','w');
|
315 |
+
fputs($fdmain,'<?php $upgrading = ' . time() . '; ?>');
|
316 |
+
fclose($fdmain);
|
317 |
+
}
|
318 |
+
} else {
|
319 |
+
trigger_error(__('Set Blog to normal Mode','backwpup'),E_USER_NOTICE);
|
320 |
+
if ( class_exists('WPMaintenanceMode') ) { //Support for WP Maintenance Mode Plugin
|
321 |
+
update_option('wp-maintenance-mode-msqld','0');
|
322 |
+
} elseif ( class_exists('MaintenanceMode') ) { //Support for Maintenance Mode Plugin
|
323 |
+
$mamo=get_option('plugin_maintenance-mode');
|
324 |
+
$mamo['mamo_activate']='off';
|
325 |
+
update_option('plugin_maintenance-mode',$mamo);
|
326 |
+
} else { //WP Support
|
327 |
+
@unlink(trailingslashit(ABSPATH).'.maintenance');
|
328 |
+
}
|
329 |
+
}
|
330 |
+
}
|
331 |
+
|
332 |
private function check_db($exclude_tables) {
|
333 |
global $wpdb;
|
334 |
|
344 |
}
|
345 |
}
|
346 |
|
347 |
+
|
348 |
//check tables
|
349 |
if (sizeof($tables)>0) {
|
350 |
+
$this->maintenance_mode(true);
|
351 |
foreach ($tables as $table) {
|
352 |
$check=$wpdb->get_row('CHECK TABLE `'.$table.'` MEDIUM', ARRAY_A);
|
353 |
if ($check['Msg_type']=='error')
|
374 |
}
|
375 |
}
|
376 |
$wpdb->flush();
|
377 |
+
$this->maintenance_mode(false);
|
378 |
trigger_error(__('Database check done!','backwpup'),E_USER_NOTICE);
|
379 |
} else {
|
380 |
trigger_error(__('No Tables to check','backwpup'),E_USER_WARNING);
|
381 |
}
|
382 |
}
|
383 |
|
|
|
384 |
private function dump_db_table($table,$status,$file) {
|
|
|
|
|
385 |
|
386 |
// create dump
|
387 |
fwrite($file, "\n");
|
393 |
fwrite($file, "/*!40101 SET character_set_client = '".mysql_client_encoding()."' */;\n");
|
394 |
//Dump the table structure
|
395 |
$result=mysql_query("SHOW CREATE TABLE `".$table."`");
|
396 |
+
if (!$result) {
|
397 |
+
trigger_error(sprintf(__('BackWPup database error %1$s for query %2$s','backwpup'), mysql_error(), "SHOW CREATE TABLE `".$table."`"),E_USER_ERROR);
|
398 |
return false;
|
399 |
}
|
400 |
$tablestruc=mysql_fetch_assoc($result);
|
403 |
|
404 |
//take data of table
|
405 |
$result=mysql_query("SELECT * FROM `".$table."`");
|
406 |
+
if (!$result) {
|
407 |
+
trigger_error(sprintf(__('BackWPup database error %1$s for query %2$s','backwpup'), mysql_error(), "SELECT * FROM `".$table."`"),E_USER_ERROR);
|
408 |
return false;
|
409 |
}
|
410 |
|
414 |
fwrite($file, "LOCK TABLES `".$table."` WRITE;\n\n");
|
415 |
if ($status['Engine']=='MyISAM')
|
416 |
fwrite($file, "/*!40000 ALTER TABLE `".$table."` DISABLE KEYS */;\n");
|
417 |
+
|
418 |
|
419 |
while ($data = mysql_fetch_assoc($result)) {
|
420 |
$keys = array();
|
424 |
if($value === NULL) // Make Value NULL to string NULL
|
425 |
$value = "NULL";
|
426 |
elseif($value === "" or $value === false) // if empty or false Value make "" as Value
|
427 |
+
$value = "''";
|
428 |
elseif(!is_numeric($value)) //is value not numeric esc
|
429 |
+
$value = "'".mysql_real_escape_string($value)."'";
|
|
|
430 |
$values[] = $value;
|
431 |
}
|
432 |
// make data dump
|
440 |
public function dump_db($exclude_tables) {
|
441 |
global $wpdb;
|
442 |
trigger_error(__('Run Database Dump to file...','backwpup'),E_USER_NOTICE);
|
443 |
+
$this->maintenance_mode(true);
|
444 |
|
445 |
//Tables to backup
|
446 |
$tables=$wpdb->get_col('SHOW TABLES FROM `'.DB_NAME.'`');
|
447 |
+
if ($sqlerr=mysql_error($wpdb->dbh))
|
448 |
+
trigger_error(sprintf(__('BackWPup database error %1$s for query %2$s','backwpup'), $sqlerr, "SHOW TABLES FROM `'.DB_NAME.'`"),E_USER_ERROR);
|
449 |
if (is_array($exclude_tables)) {
|
450 |
foreach($tables as $tablekey => $tablevalue) {
|
451 |
if (in_array($tablevalue,$exclude_tables))
|
515 |
trigger_error(__('Database Dump done!','backwpup'),E_USER_NOTICE);
|
516 |
//add database file to backupfiles
|
517 |
trigger_error(__('Add Database Dump to Backup:','backwpup').' '.DB_NAME.'.sql '.backwpup_formatBytes(filesize($this->tempdir.'/'.DB_NAME.'.sql')),E_USER_NOTICE);
|
518 |
+
$this->allfilesize+=filesize($this->tempdir.'/'.DB_NAME.'.sql');
|
519 |
$this->filelist[]=array(79001=>$this->tempdir.'/'.DB_NAME.'.sql',79003=>DB_NAME.'.sql');
|
520 |
+
|
521 |
+
$this->maintenance_mode(false);
|
522 |
}
|
523 |
+
|
524 |
+
public function export_wp() {
|
525 |
+
trigger_error(__('Run Wordpress Export to XML file...','backwpup'),E_USER_NOTICE);
|
526 |
+
if (copy(WP_PLUGIN_URL.'/'.BACKWPUP_PLUGIN_DIR.'/app/wp_xml_export.php?ABSPATH='.ABSPATH.'&_nonce='.substr(md5(md5(SECURE_AUTH_KEY)),10,10),$this->tempdir.'/wordpress.' . date( 'Y-m-d' ) . '.xml')) {
|
527 |
+
trigger_error(__('Export to XML done!','backwpup'),E_USER_NOTICE);
|
528 |
+
//add database file to backupfiles
|
529 |
+
trigger_error(__('Add XML Export to Backup:','backwpup').' wordpress.' . date( 'Y-m-d' ) . '.xml '.backwpup_formatBytes(filesize($this->tempdir.'/wordpress.' . date( 'Y-m-d' ) . '.xml')),E_USER_NOTICE);
|
530 |
+
$this->allfilesize+=filesize($this->tempdir.'/wordpress.' . date( 'Y-m-d' ) . '.xml');
|
531 |
+
$this->filelist[]=array(79001=>$this->tempdir.'/wordpress.' . date( 'Y-m-d' ) . '.xml',79003=>'wordpress.' . date( 'Y-m-d' ) . '.xml');
|
532 |
+
} else {
|
533 |
+
trigger_error(__('Can not Export to XML!','backwpup'),E_USER_ERROR);
|
534 |
+
}
|
535 |
+
}
|
536 |
+
|
537 |
public function optimize_db($exclude_tables) {
|
538 |
global $wpdb;
|
539 |
|
550 |
}
|
551 |
|
552 |
if (sizeof($tables)>0) {
|
553 |
+
$this->maintenance_mode(true);
|
554 |
foreach ($tables as $table) {
|
555 |
$optimize=$wpdb->get_row('OPTIMIZE TABLE `'.$table.'`', ARRAY_A);
|
556 |
if ($optimize['Msg_type']=='error')
|
565 |
}
|
566 |
$wpdb->flush();
|
567 |
trigger_error(__('Database optimize done!','backwpup'),E_USER_NOTICE);
|
568 |
+
$this->maintenance_mode(false);
|
569 |
} else {
|
570 |
trigger_error(__('No Tables to optimize','backwpup'),E_USER_WARNING);
|
571 |
}
|
581 |
if ( in_array($file, array('.', '..','.svn') ) )
|
582 |
continue;
|
583 |
foreach ($excludes as $exclusion) { //exclude dirs and files
|
584 |
+
if (false !== stripos($folder.'/'.$file,$exclusion))
|
585 |
continue 2;
|
586 |
}
|
587 |
if (!$this->job['backuproot'] and false !== stripos($folder.'/'.$file,str_replace('\\','/',ABSPATH)) and false === stripos($folder.'/'.$file,str_replace('\\','/',WP_CONTENT_DIR)) and !is_dir($folder.'/'.$file))
|
593 |
if ( is_dir( $folder . '/' . $file ) ) {
|
594 |
$this->_file_list_folder( $folder . '/' . $file, $levels - 1, $excludes);
|
595 |
} elseif (is_file( $folder . '/' . $file )) {
|
596 |
+
if (is_readable($folder . '/' . $file)) { //add file to filelist
|
597 |
$this->filelist[]=array(79001=>$folder.'/' .$file,79003=>str_replace(str_replace('\\','/',trailingslashit(ABSPATH)),'',$folder.'/') . $file);
|
598 |
$this->allfilesize=$this->allfilesize+filesize($folder . '/' . $file);
|
|
|
599 |
} else {
|
600 |
trigger_error(__('Can not read file:','backwpup').' '.$folder . '/' . $file,E_USER_WARNING);
|
601 |
}
|
609 |
|
610 |
public function file_list() {
|
611 |
//Make filelist
|
612 |
+
trigger_error(__('Make a list of files to Backup ....','backwpup'),E_USER_NOTICE);
|
613 |
$backwpup_exclude=array(); $dirinclude=array();
|
614 |
|
615 |
if (!empty($this->job['fileexclude']))
|
626 |
|
627 |
//include dirs
|
628 |
if (!empty($this->job['dirinclude']))
|
629 |
+
$dirinclude=explode(',',$this->job['dirinclude']);
|
630 |
|
631 |
if ($this->job['backuproot']) //Include extra path
|
632 |
$dirinclude[]=ABSPATH;
|
641 |
if (is_dir($dirincludevalue))
|
642 |
$this->_file_list_folder(untrailingslashit(str_replace('\\','/',$dirincludevalue)),100,$backwpup_exclude);
|
643 |
}
|
644 |
+
}
|
|
|
645 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
646 |
if (!is_array($this->filelist[0])) {
|
647 |
trigger_error(__('No files to Backup','backwpup'),E_USER_ERROR);
|
648 |
} else {
|
649 |
trigger_error(__('Size off all files:','backwpup').' '.backwpup_formatBytes($this->allfilesize),E_USER_NOTICE);
|
650 |
}
|
651 |
+
|
652 |
+
}
|
653 |
|
654 |
+
public function zip_files() {
|
655 |
+
|
656 |
+
if (class_exists('ZipArchive')) { //use php zip lib
|
657 |
trigger_error(__('Create Backup Zip file...','backwpup'),E_USER_NOTICE);
|
658 |
+
$zip = new ZipArchive;
|
659 |
+
if ($res=$zip->open($this->backupdir.'/'.$this->backupfile,ZIPARCHIVE::CREATE) === TRUE) {
|
660 |
+
foreach($this->filelist as $key => $files) {
|
661 |
+
if ($zip->addFile($files[79001], $files[79003])) {
|
662 |
+
trigger_error(__('Add File to ZIP file:','backwpup').' '.$files[79001].' '.backwpup_formatBytes(filesize($files[79001])),E_USER_NOTICE);
|
663 |
+
} else {
|
664 |
+
trigger_error(__('Can not add File to ZIP file:','backwpup').' '.$files[79001],E_USER_ERROR);
|
665 |
+
}
|
666 |
+
}
|
667 |
+
$zip->close();
|
668 |
+
trigger_error(__('Backup Zip file create done!','backwpup'),E_USER_NOTICE);
|
669 |
} else {
|
670 |
+
trigger_error(__('Can not create Backup ZIP file:','backwpup').' '.$res,E_USER_ERROR);
|
671 |
+
}
|
672 |
+
|
673 |
+
} else { //use PclZip
|
674 |
+
define( 'PCLZIP_TEMPORARY_DIR', $this->tempdir );
|
675 |
+
if (!class_exists('PclZip')) require_once 'libs/pclzip.lib.php';
|
676 |
+
|
677 |
+
//Create Zip File
|
678 |
+
if (is_array($this->filelist[0])) {
|
679 |
+
$this->need_free_memory(10485760); //10MB free memory for zip
|
680 |
+
trigger_error(__('Create Backup Zip (PclZip) file...','backwpup'),E_USER_NOTICE);
|
681 |
+
foreach($this->filelist as $key => $files) {
|
682 |
+
trigger_error(__('Add File to ZIP file:','backwpup').' '.$files[79001].' '.backwpup_formatBytes(filesize($files[79001])),E_USER_NOTICE);
|
683 |
+
}
|
684 |
+
$zipbackupfile = new PclZip($this->backupdir.'/'.$this->backupfile);
|
685 |
+
if (0==$zipbackupfile -> create($this->filelist,PCLZIP_OPT_ADD_TEMP_FILE_ON)) {
|
686 |
+
trigger_error(__('Zip file create:','backwpup').' '.$zipbackupfile->errorInfo(true),E_USER_ERROR);
|
687 |
+
} else {
|
688 |
+
trigger_error(__('Backup Zip file create done!','backwpup'),E_USER_NOTICE);
|
689 |
+
}
|
690 |
}
|
691 |
}
|
692 |
+
}
|
693 |
+
|
694 |
+
public function tar_pack_files() {
|
695 |
+
|
696 |
+
if ($this->backupfileformat=='.tar.gz') {
|
697 |
+
$tarbackup=gzopen($this->backupdir.'/'.$this->backupfile,'w9');
|
698 |
+
} elseif ($this->backupfileformat=='.tar.bz2') {
|
699 |
+
$tarbackup=bzopen($this->backupdir.'/'.$this->backupfile,'w');
|
700 |
+
} else {
|
701 |
+
$tarbackup=fopen($this->backupdir.'/'.$this->backupfile,'w');
|
702 |
+
}
|
703 |
+
|
704 |
+
if (!$tarbackup) {
|
705 |
+
trigger_error(__('Can not create TAR Backup file','backwpup'),E_USER_ERROR);
|
706 |
+
return;
|
707 |
+
} else {
|
708 |
+
trigger_error(__('Create Backup Archive file...','backwpup'),E_USER_NOTICE);
|
709 |
+
}
|
710 |
+
|
711 |
+
$this->need_free_memory(1048576); //1MB free memory for zip
|
712 |
+
|
713 |
+
foreach($this->filelist as $key => $files) {
|
714 |
+
trigger_error(__('Add File to Backup Archive:','backwpup').' '.$files[79001].' '.backwpup_formatBytes(filesize($files[79001])),E_USER_NOTICE);
|
715 |
+
// Get file information
|
716 |
+
$file_information = stat($files[79001]);
|
717 |
+
|
718 |
+
// Generate the TAR header for this file
|
719 |
+
$header = pack("a100a8a8a8a12a12a8a1a100a6a2a32a32a8a8a155a12",
|
720 |
+
substr($files[79003],0,100), //name of file 100
|
721 |
+
sprintf("%07o", $file_information['mode']), //file mode 8
|
722 |
+
sprintf("%07o", $file_information['uid']), //owner user ID 8
|
723 |
+
sprintf("%07o", $file_information['gid']), //owner group ID 8
|
724 |
+
sprintf("%011o", $file_information['size']), //length of file in bytes 12
|
725 |
+
sprintf("%011o", $file_information['mtime']), //modify time of file 12
|
726 |
+
" ", //checksum for header 8
|
727 |
+
0, //type of file 0 or null = File, 5=Dir
|
728 |
+
"", //name of linked file 100
|
729 |
+
"ustar ", //USTAR indicator 6
|
730 |
+
" ", //USTAR version 2
|
731 |
+
"Unknown", //owner user name 32
|
732 |
+
"Unknown", //owner group name 32
|
733 |
+
"", //device major number 8
|
734 |
+
"", //device minor number 8
|
735 |
+
substr($files[79003],101), //prefix for file name 155
|
736 |
+
""); //fill block 512K
|
737 |
+
|
738 |
+
// Computes the unsigned Checksum of a file's header
|
739 |
+
$checksum = 0;
|
740 |
+
for ($i = 0; $i < 512; $i++)
|
741 |
+
$checksum += ord(substr($header, $i, 1));
|
742 |
+
$checksum = pack("a8", sprintf("%07o", $checksum));
|
743 |
+
|
744 |
+
$header = substr_replace($header, $checksum, 148, 8);
|
745 |
+
|
746 |
+
if ($this->backupfileformat=='.tar.gz') {
|
747 |
+
gzwrite($tarbackup, $header);
|
748 |
+
} elseif ($this->backupfileformat=='.tar.bz2') {
|
749 |
+
bzwrite($tarbackup, $header);
|
750 |
+
} else {
|
751 |
+
fwrite($tarbackup, $header);
|
752 |
+
}
|
753 |
+
|
754 |
+
// read/write files in 512K Blocks
|
755 |
+
$fd=fopen($files[79001],'rb');
|
756 |
+
while(!feof($fd)) {
|
757 |
+
$filedata=fread($fd,512);
|
758 |
+
if (strlen($filedata)>0) {
|
759 |
+
if ($this->backupfileformat=='.tar.gz') {
|
760 |
+
gzwrite($tarbackup,pack("a512", $filedata));
|
761 |
+
} elseif ($this->backupfileformat=='.tar.bz2') {
|
762 |
+
bzwrite($tarbackup,pack("a512", $filedata));
|
763 |
+
} else {
|
764 |
+
fwrite($tarbackup,pack("a512", $filedata));
|
765 |
+
}
|
766 |
+
}
|
767 |
+
}
|
768 |
+
fclose($fd);
|
769 |
+
}
|
770 |
|
771 |
+
|
772 |
+
if ($this->backupfileformat=='.tar.gz') {
|
773 |
+
gzwrite($tarbackup, pack("a1024", "")); // Add 1024 bytes of NULLs to designate EOF
|
774 |
+
gzclose($tarbackup);
|
775 |
+
} elseif ($this->backupfileformat=='.tar.bz2') {
|
776 |
+
bzwrite($tarbackup, pack("a1024", "")); // Add 1024 bytes of NULLs to designate EOF
|
777 |
+
bzclose($tarbackup);
|
778 |
+
} else {
|
779 |
+
fwrite($tarbackup, pack("a1024", "")); // Add 1024 bytes of NULLs to designate EOF
|
780 |
+
fclose($tarbackup);
|
781 |
+
}
|
782 |
+
|
783 |
+
trigger_error(__('Backup Archive file create done!','backwpup'),E_USER_NOTICE);
|
784 |
}
|
785 |
|
786 |
+
|
787 |
public function _ftp_raw_helper($ftp_conn_id,$command) { //FTP Comands helper function
|
788 |
$return=ftp_raw($ftp_conn_id,$command);
|
789 |
if (strtoupper(substr(trim($command),0,4))=="PASS") {
|
814 |
|
815 |
|
816 |
public function destination_ftp() {
|
817 |
+
$this->job['ftpdir']=trailingslashit(str_replace('//','/',str_replace('\\','/',stripslashes(trim($this->job['ftpdir'])))));
|
818 |
+
if ($this->job['ftpdir']=='/')
|
819 |
+
$this->job['ftpdir']='';
|
820 |
+
|
821 |
+
|
822 |
if (empty($this->job['ftphost']) or empty($this->job['ftpuser']) or empty($this->job['ftppass']))
|
823 |
return false;
|
824 |
|
891 |
}
|
892 |
}
|
893 |
|
894 |
+
if (ftp_put($ftp_conn_id, $this->job['ftpdir'].$this->backupfile, $this->backupdir.'/'.$this->backupfile, FTP_BINARY)) //transfere file
|
895 |
+
trigger_error(__('Backup File transferred to FTP Server:','backwpup').' '.$this->job['ftpdir'].$this->backupfile,E_USER_NOTICE);
|
896 |
else
|
897 |
trigger_error(__('Can not transfer backup to FTP server.','backwpup'),E_USER_ERROR);
|
898 |
+
|
|
|
899 |
if ($this->job['ftpmaxbackups']>0) { //Delete old backups
|
900 |
+
$backupfilelist=array();
|
901 |
+
if ($filelist=ftp_nlist($ftp_conn_id, $this->job['ftpdir'])) {
|
902 |
foreach($filelist as $files) {
|
903 |
+
if ('backwpup_'.$this->jobid.'_' == substr(basename($files),0,strlen('backwpup_'.$this->jobid.'_')) and $this->backupfileformat == substr(basename($files),-strlen($this->backupfileformat)))
|
904 |
$backupfilelist[]=basename($files);
|
905 |
}
|
906 |
if (sizeof($backupfilelist)>0) {
|
907 |
rsort($backupfilelist);
|
908 |
$numdeltefiles=0;
|
909 |
for ($i=$this->job['ftpmaxbackups'];$i<sizeof($backupfilelist);$i++) {
|
910 |
+
if (ftp_delete($ftp_conn_id, $this->job['ftpdir'].$backupfilelist[$i])) //delte files on ftp
|
911 |
$numdeltefiles++;
|
912 |
else
|
913 |
+
trigger_error(__('Can not delete file on FTP Server:','backwpup').' '.$this->job['ftpdir'].$backupfilelist[$i],E_USER_ERROR);
|
914 |
}
|
915 |
if ($numdeltefiles>0)
|
916 |
trigger_error($numdeltefiles.' '.__('files deleted on FTP Server:','backwpup'),E_USER_NOTICE);
|
992 |
}
|
993 |
|
994 |
public function destination_s3() {
|
995 |
+
$this->job['awsdir']=trailingslashit(str_replace('//','/',str_replace('\\','/',stripslashes(trim($this->job['awsdir'])))));
|
996 |
+
if ($this->job['awsdir']=='/')
|
997 |
+
$this->job['awsdir']='';
|
998 |
+
|
999 |
if (empty($this->job['awsAccessKey']) or empty($this->job['awsSecretKey']) or empty($this->job['awsBucket']))
|
1000 |
return false;
|
1001 |
|
1011 |
if (in_array($this->job['awsBucket'],$s3->listBuckets())) {
|
1012 |
trigger_error(__('Connected to S3 Bucket:','backwpup').' '.$this->job['awsBucket'],E_USER_NOTICE);
|
1013 |
//Transfer Backup to S3
|
1014 |
+
if ($s3->putObjectFile($this->backupdir.'/'.$this->backupfile, $this->job['awsBucket'], $this->job['awsdir'].$this->backupfile, S3::ACL_PRIVATE)) //transfere file to S3
|
1015 |
+
trigger_error(__('Backup File transferred to S3://','backwpup').$this->job['awsBucket'].'/'.$this->job['awsdir'].$this->backupfile,E_USER_NOTICE);
|
1016 |
else
|
1017 |
trigger_error(__('Can not transfer backup to S3.','backwpup'),E_USER_ERROR);
|
1018 |
+
|
|
|
1019 |
if ($this->job['awsmaxbackups']>0) { //Delete old backups
|
1020 |
+
$backupfilelist=array();
|
1021 |
if (($contents = $s3->getBucket($this->job['awsBucket'])) !== false) {
|
1022 |
foreach ($contents as $object) {
|
1023 |
+
if ($this->job['awsdir']==dirname(str_replace('\\','/',$object['name']))) {
|
1024 |
$files=basename($object['name']);
|
1025 |
+
if ('backwpup_'.$this->jobid.'_' == substr(basename($files),0,strlen('backwpup_'.$this->jobid.'_')) and $this->backupfileformat == substr(basename($files),-strlen($this->backupfileformat)))
|
1026 |
$backupfilelist[]=basename($object['name']);
|
1027 |
}
|
1028 |
}
|
1031 |
rsort($backupfilelist);
|
1032 |
$numdeltefiles=0;
|
1033 |
for ($i=$this->job['awsmaxbackups'];$i<sizeof($backupfilelist);$i++) {
|
1034 |
+
if ($s3->deleteObject($this->job['awsBucket'], $this->job['awsdir'].$backupfilelist[$i])) //delte files on S3
|
1035 |
$numdeltefiles++;
|
1036 |
else
|
1037 |
+
trigger_error(__('Can not delete file on S3//:','backwpup').$this->job['awsBucket'].'/'.$this->job['awsdir'].$backupfilelist[$i],E_USER_ERROR);
|
1038 |
if ($numdeltefiles>0)
|
1039 |
trigger_error($numdeltefiles.' '.__('files deleted on S3 Bucket!','backwpup'),E_USER_NOTICE);
|
1040 |
}
|
1047 |
|
1048 |
public function destination_dir() {
|
1049 |
//Delete old Backupfiles
|
1050 |
+
$backupfilelist=array();
|
1051 |
if (!empty($this->job['maxbackups']) and !empty($this->job['backupdir']) and is_dir($this->job['backupdir'])) {
|
1052 |
if ( $dir = @opendir($this->job['backupdir']) ) { //make file list
|
1053 |
while (($file = readdir($dir)) !== false ) {
|
1054 |
+
if ('backwpup_'.$this->jobid.'_' == substr($file,0,strlen('backwpup_'.$this->jobid.'_')) and $this->backupfileformat == substr($file,-strlen($this->backupfileformat)))
|
1055 |
$backupfilelist[]=$file;
|
1056 |
}
|
1057 |
@closedir( $dir );
|
1073 |
global $backwpup_logfile;
|
1074 |
|
1075 |
if (is_file($this->backupdir.'/'.$this->backupfile)) {
|
1076 |
+
trigger_error(sprintf(__('Backup Archive File size is %1s','backwpup'),backwpup_formatBytes(filesize($this->backupdir.'/'.$this->backupfile))),E_USER_NOTICE);
|
1077 |
}
|
1078 |
|
1079 |
if (is_file($this->tempdir.'/'.DB_NAME.'.sql') ) { //delete sql temp file
|
1080 |
unlink($this->tempdir.'/'.DB_NAME.'.sql');
|
1081 |
}
|
1082 |
+
|
1083 |
+
if (is_file($this->tempdir.'/wordpress.' . date( 'Y-m-d' ) . '.xml') ) { //delete WP XML Export temp file
|
1084 |
+
unlink($this->tempdir.'/wordpress.' . date( 'Y-m-d' ) . '.xml');
|
1085 |
+
}
|
1086 |
+
|
1087 |
if (empty($this->job['backupdir']) and ($this->backupdir!=$this->tempdir) and is_file($this->backupdir.'/'.$this->backupfile)) { //delete backup file in temp dir
|
1088 |
unlink($this->backupdir.'/'.$this->backupfile);
|
1089 |
}
|
1110 |
}
|
1111 |
|
1112 |
$jobs=get_option('backwpup_jobs');
|
1113 |
+
$jobs[$this->jobid]['stoptime']=current_time('timestamp');
|
1114 |
$jobs[$this->jobid]['lastrun']=$jobs[$this->jobid]['starttime'];
|
1115 |
$jobs[$this->jobid]['lastruntime']=$jobs[$this->jobid]['stoptime']-$jobs[$this->jobid]['starttime'];
|
|
|
1116 |
update_option('backwpup_jobs',$jobs); //Save Settings
|
1117 |
trigger_error(sprintf(__('Job done in %1s sec.','backwpup'),$jobs[$this->jobid]['lastruntime']),E_USER_NOTICE);
|
1118 |
+
|
1119 |
//write runtime header
|
1120 |
$fd=@fopen($backwpup_logfile,"r+");
|
1121 |
while (!feof($fd)) {
|
1122 |
$line=@fgets($fd);
|
1123 |
if (stripos($line,"<meta name=\"backwpup_jobruntime\"") !== false) {
|
1124 |
@fseek($fd,$filepos);
|
1125 |
+
@fputs($fd,str_pad("<meta name=\"backwpup_jobruntime\" content=\"".$jobs[$this->jobid]['lastruntime']."\" />",100)."\n");
|
1126 |
break;
|
1127 |
}
|
1128 |
$filepos=ftell($fd);
|
app/functions.php
CHANGED
@@ -8,8 +8,24 @@ if ( !defined('ABSPATH') )
|
|
8 |
$hook = add_management_page(__('BackWPup','backwpup'), __('BackWPup','backwpup'), '10', 'BackWPup','backwpup_options_page') ;
|
9 |
add_action('load-'.$hook, 'backwpup_options_load');
|
10 |
add_contextual_help($hook,backwpup_show_help());
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
}
|
14 |
|
15 |
// Help too display
|
@@ -30,7 +46,7 @@ if ( !defined('ABSPATH') )
|
|
30 |
|
31 |
//Options Page
|
32 |
function backwpup_options_page() {
|
33 |
-
global $wpdb,$backwpup_message;
|
34 |
if (!current_user_can(10))
|
35 |
wp_die('No rights');
|
36 |
if(!empty($backwpup_message))
|
@@ -77,7 +93,7 @@ if ( !defined('ABSPATH') )
|
|
77 |
wp_die('No rights');
|
78 |
//Css for Admin Section
|
79 |
wp_enqueue_style('BackWpup',plugins_url('/'.BACKWPUP_PLUGIN_DIR.'/app/css/options.css'),'',BACKWPUP_VERSION,'screen');
|
80 |
-
|
81 |
//For save Options
|
82 |
require_once(WP_PLUGIN_DIR.'/'.BACKWPUP_PLUGIN_DIR.'/app/options-save.php');
|
83 |
}
|
@@ -111,9 +127,14 @@ if ( !defined('ABSPATH') )
|
|
111 |
if (empty($cfg['mailsendmail'])) $cfg['mailsendmail']=substr(ini_get('sendmail_path'),0,strpos(ini_get('sendmail_path'),' -'));
|
112 |
if (empty($cfg['memorylimit'])) $cfg['memorylimit']='128M';
|
113 |
if (empty($cfg['maxlogs'])) $cfg['maxlogs']=0;
|
114 |
-
if (empty($cfg['
|
115 |
-
|
116 |
-
|
|
|
|
|
|
|
|
|
|
|
117 |
update_option('backwpup',$cfg);
|
118 |
}
|
119 |
|
@@ -174,7 +195,7 @@ if ( !defined('ABSPATH') )
|
|
174 |
require_once('backwpup_dojob.php');
|
175 |
$dojob= new backwpup_dojob($jobid);
|
176 |
unset($dojob);
|
177 |
-
return
|
178 |
}
|
179 |
|
180 |
//file size
|
@@ -189,41 +210,38 @@ if ( !defined('ABSPATH') )
|
|
189 |
|
190 |
//echo long backup type name
|
191 |
function backwpup_backup_types($type='',$echo=false) {
|
192 |
-
|
193 |
-
|
194 |
-
$
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
|
|
|
|
|
|
|
|
|
|
211 |
}
|
212 |
-
|
|
|
213 |
echo $typename;
|
214 |
else
|
215 |
return $typename;
|
216 |
}
|
217 |
|
218 |
-
//add spases
|
219 |
-
function backwpup_fillspases($number) {
|
220 |
-
$spaces='';
|
221 |
-
for ($i=0;$i<$number;$i++) {
|
222 |
-
$spaces.=' ';
|
223 |
-
}
|
224 |
-
return $spaces;
|
225 |
-
}
|
226 |
-
|
227 |
//read log file header
|
228 |
function backwpup_read_logheader($logfile) {
|
229 |
$headers=array("backwpup_version" => "version","backwpup_logtime" => "logtime","backwpup_errors" => "errors","backwpup_warnings" => "warnings","backwpup_jobid" => "jobid","backwpup_jobname" => "name","backwpup_jobtype" => "type","backwpup_jobruntime" => "runtime","backwpup_backupfile" => "backupfile");
|
@@ -299,7 +317,7 @@ if ( !defined('ABSPATH') )
|
|
299 |
if (wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid))) {
|
300 |
echo '<a href="'.wp_nonce_url('admin.php?page=BackWPup&action=edit&jobid='.$jobid, 'edit-job').'" title="'.__('Edit Job','backwpup').'">';
|
301 |
if ($jobvalue['starttime']>0 and empty($jobvalue['stoptime'])) {
|
302 |
-
$runtime=
|
303 |
echo __('Running since:','backwpup').' '.$runtime.' '.__('sec.','backwpup');
|
304 |
} elseif ($time=wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid))) {
|
305 |
echo date_i18n(get_option('date_format'),$time).' '.date_i18n(get_option('time_format'),$time);
|
@@ -317,7 +335,6 @@ if ( !defined('ABSPATH') )
|
|
317 |
wp_add_dashboard_widget( 'backwpup_dashboard_widget', 'BackWPup', 'backwpup_dashboard_output' );
|
318 |
}
|
319 |
|
320 |
-
|
321 |
// add all action and so on only if plugin loaded.
|
322 |
function backwpup_init() {
|
323 |
//Disabele WP_Corn
|
8 |
$hook = add_management_page(__('BackWPup','backwpup'), __('BackWPup','backwpup'), '10', 'BackWPup','backwpup_options_page') ;
|
9 |
add_action('load-'.$hook, 'backwpup_options_load');
|
10 |
add_contextual_help($hook,backwpup_show_help());
|
11 |
+
switch($_REQUEST['action']) {
|
12 |
+
case 'logs':
|
13 |
+
register_column_headers($hook,array('cb'=>'<input type="checkbox" />','id'=>__('Job','backwpup'),'type'=>__('Type','backwpup'),'log'=>__('Backup/Log Date/Time','backwpup'),'status'=>__('Status','backwpup'),'size'=>__('Size','backwpup'),'runtime'=>__('Runtime','backwpup')));
|
14 |
+
break;
|
15 |
+
case 'edit':
|
16 |
+
break;
|
17 |
+
case 'settings':
|
18 |
+
break;
|
19 |
+
case 'tools':
|
20 |
+
break;
|
21 |
+
case 'runnow':
|
22 |
+
break;
|
23 |
+
case 'view_log':
|
24 |
+
break;
|
25 |
+
default:
|
26 |
+
register_column_headers($hook,array('cb'=>'<input type="checkbox" />','id'=>__('ID','backwpup'),'jobname'=>__('Job Name','backwpup'),'type'=>__('Type','backwpup'),'next'=>__('Next Run','backwpup'),'last'=>__('Last Run','backwpup')));
|
27 |
+
break;
|
28 |
+
}
|
29 |
}
|
30 |
|
31 |
// Help too display
|
46 |
|
47 |
//Options Page
|
48 |
function backwpup_options_page() {
|
49 |
+
global $wpdb,$backwpup_message,$page_hook;
|
50 |
if (!current_user_can(10))
|
51 |
wp_die('No rights');
|
52 |
if(!empty($backwpup_message))
|
93 |
wp_die('No rights');
|
94 |
//Css for Admin Section
|
95 |
wp_enqueue_style('BackWpup',plugins_url('/'.BACKWPUP_PLUGIN_DIR.'/app/css/options.css'),'',BACKWPUP_VERSION,'screen');
|
96 |
+
wp_enqueue_script('BackWpupOptions',plugins_url('/'.BACKWPUP_PLUGIN_DIR.'/app/js/options.js'),'',BACKWPUP_VERSION,true);
|
97 |
//For save Options
|
98 |
require_once(WP_PLUGIN_DIR.'/'.BACKWPUP_PLUGIN_DIR.'/app/options-save.php');
|
99 |
}
|
127 |
if (empty($cfg['mailsendmail'])) $cfg['mailsendmail']=substr(ini_get('sendmail_path'),0,strpos(ini_get('sendmail_path'),' -'));
|
128 |
if (empty($cfg['memorylimit'])) $cfg['memorylimit']='128M';
|
129 |
if (empty($cfg['maxlogs'])) $cfg['maxlogs']=0;
|
130 |
+
if (empty($cfg['dirtemp'])) {
|
131 |
+
$rand = substr( md5( md5( SECURE_AUTH_KEY ) ), -5 );
|
132 |
+
$cfg['dirtemp']=str_replace('\\','/',stripslashes(get_temp_dir().'backwpup-'.$rand));
|
133 |
+
}
|
134 |
+
if (empty($cfg['dirlogs'])) {
|
135 |
+
$rand = substr( md5( md5( SECURE_AUTH_KEY ) ), -5 );
|
136 |
+
$cfg['dirlogs']=str_replace('\\','/',WP_CONTENT_DIR).'/backwpup-'.$rand.'/logs';
|
137 |
+
}
|
138 |
update_option('backwpup',$cfg);
|
139 |
}
|
140 |
|
195 |
require_once('backwpup_dojob.php');
|
196 |
$dojob= new backwpup_dojob($jobid);
|
197 |
unset($dojob);
|
198 |
+
return $backwpup_logfile;
|
199 |
}
|
200 |
|
201 |
//file size
|
210 |
|
211 |
//echo long backup type name
|
212 |
function backwpup_backup_types($type='',$echo=false) {
|
213 |
+
$typename='';
|
214 |
+
if (!empty($type)) {
|
215 |
+
$todo=explode('+',$type);
|
216 |
+
foreach($todo as $key => $value) {
|
217 |
+
switch($value) {
|
218 |
+
case 'WPEXP':
|
219 |
+
$typename.=__('WP XML Export','backwpup')."<br />";
|
220 |
+
break;
|
221 |
+
case 'DB':
|
222 |
+
$typename.=__('Database Backup','backwpup')."<br />";
|
223 |
+
break;
|
224 |
+
case 'FILE':
|
225 |
+
$typename.=__('File Backup','backwpup')."<br />";
|
226 |
+
break;
|
227 |
+
case 'OPTIMIZE':
|
228 |
+
$typename.=__('Optimize Database Tables','backwpup')."<br />";
|
229 |
+
break;
|
230 |
+
case 'CHECK':
|
231 |
+
$typename.=__('Check Database Tables','backwpup')."<br />";
|
232 |
+
break;
|
233 |
+
}
|
234 |
+
}
|
235 |
+
} else {
|
236 |
+
$typename=array('WPEXP','DB','FILE','OPTIMIZE','CHECK');
|
237 |
}
|
238 |
+
|
239 |
+
if ($echo)
|
240 |
echo $typename;
|
241 |
else
|
242 |
return $typename;
|
243 |
}
|
244 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
//read log file header
|
246 |
function backwpup_read_logheader($logfile) {
|
247 |
$headers=array("backwpup_version" => "version","backwpup_logtime" => "logtime","backwpup_errors" => "errors","backwpup_warnings" => "warnings","backwpup_jobid" => "jobid","backwpup_jobname" => "name","backwpup_jobtype" => "type","backwpup_jobruntime" => "runtime","backwpup_backupfile" => "backupfile");
|
317 |
if (wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid))) {
|
318 |
echo '<a href="'.wp_nonce_url('admin.php?page=BackWPup&action=edit&jobid='.$jobid, 'edit-job').'" title="'.__('Edit Job','backwpup').'">';
|
319 |
if ($jobvalue['starttime']>0 and empty($jobvalue['stoptime'])) {
|
320 |
+
$runtime=current_time('timestamp')-$jobvalue['starttime'];
|
321 |
echo __('Running since:','backwpup').' '.$runtime.' '.__('sec.','backwpup');
|
322 |
} elseif ($time=wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid))) {
|
323 |
echo date_i18n(get_option('date_format'),$time).' '.date_i18n(get_option('time_format'),$time);
|
335 |
wp_add_dashboard_widget( 'backwpup_dashboard_widget', 'BackWPup', 'backwpup_dashboard_output' );
|
336 |
}
|
337 |
|
|
|
338 |
// add all action and so on only if plugin loaded.
|
339 |
function backwpup_init() {
|
340 |
//Disabele WP_Corn
|
app/js/options.js
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready( function($) {
|
2 |
+
|
3 |
+
$('.jobtype-select').change(function() {
|
4 |
+
if ( true == $('#jobtype-select-FILE').attr('checked') || true == $('#jobtype-select-DB').attr('checked') || true == $('#jobtype-select-WPEXP').attr('checked')) {
|
5 |
+
$('#fileformart').show();
|
6 |
+
$('#toftp').show();
|
7 |
+
$('#toamazon').show();
|
8 |
+
$('#todir').show();
|
9 |
+
$('#tomail').show();
|
10 |
+
} else {
|
11 |
+
$('#fileformart').hide();
|
12 |
+
$('#toftp').hide();
|
13 |
+
$('#toamazon').hide();
|
14 |
+
$('#todir').hide();
|
15 |
+
$('#tomail').hide();
|
16 |
+
}
|
17 |
+
if ( true == $('#jobtype-select-DB').attr('checked') || true == $('#jobtype-select-CHECK').attr('checked') || true == $('#jobtype-select-OPTIMIZE').attr('checked')) {
|
18 |
+
$('#databasejos').show();
|
19 |
+
} else {
|
20 |
+
$('#databasejos').hide();
|
21 |
+
}
|
22 |
+
if ( true == $('#jobtype-select-FILE').attr('checked')) {
|
23 |
+
$('#filebackup').show();
|
24 |
+
} else {
|
25 |
+
$('#filebackup').hide();
|
26 |
+
}
|
27 |
+
});
|
28 |
+
|
29 |
+
$('#mailmethod').change(function() {
|
30 |
+
if ( 'SMTP' == $('#mailmethod').val()) {
|
31 |
+
$('#mailsmtp').show();
|
32 |
+
$('#mailsendmail').hide();
|
33 |
+
} else if ( 'Sendmail' == $('#mailmethod').val()) {
|
34 |
+
$('#mailsmtp').hide();
|
35 |
+
$('#mailsendmail').show();
|
36 |
+
} else {
|
37 |
+
$('#mailsmtp').hide();
|
38 |
+
$('#mailsendmail').hide();
|
39 |
+
}
|
40 |
+
});
|
41 |
+
|
42 |
+
if ( $('#title').val() == '' )
|
43 |
+
$('#title').siblings('#title-prompt-text').css('visibility', '');
|
44 |
+
$('#title-prompt-text').click(function(){
|
45 |
+
$(this).css('visibility', 'hidden').siblings('#title').focus();
|
46 |
+
});
|
47 |
+
$('#title').blur(function(){
|
48 |
+
if (this.value == '')
|
49 |
+
$(this).siblings('#title-prompt-text').css('visibility', '');
|
50 |
+
}).focus(function(){
|
51 |
+
$(this).siblings('#title-prompt-text').css('visibility', 'hidden');
|
52 |
+
}).keydown(function(e){
|
53 |
+
$(this).siblings('#title-prompt-text').css('visibility', 'hidden');
|
54 |
+
$(this).unbind(e);
|
55 |
+
});
|
56 |
+
|
57 |
+
});
|
app/libs/{pclzip-trace.lib.php → pclzip.lib.php}
RENAMED
@@ -22,7 +22,7 @@
|
|
22 |
// The use of this software is at the risk of the user.
|
23 |
//
|
24 |
// --------------------------------------------------------------------------------
|
25 |
-
// $Id: pclzip
|
26 |
// --------------------------------------------------------------------------------
|
27 |
|
28 |
// ----- Constants
|
@@ -214,12 +214,10 @@
|
|
214 |
// --------------------------------------------------------------------------------
|
215 |
function PclZip($p_zipname)
|
216 |
{
|
217 |
-
PclTraceFctStart(__FILE__, __LINE__, 'PclZip::PclZip', "zipname=$p_zipname");
|
218 |
|
219 |
// ----- Tests the zlib
|
220 |
if (!function_exists('gzopen'))
|
221 |
{
|
222 |
-
PclTraceFctMessage(__FILE__, __LINE__, 1, "zlib extension seems to be missing");
|
223 |
die('Abort '.basename(__FILE__).' : Missing zlib extensions');
|
224 |
}
|
225 |
|
@@ -229,7 +227,6 @@
|
|
229 |
$this->magic_quotes_status = -1;
|
230 |
|
231 |
// ----- Return
|
232 |
-
PclTraceFctEnd(__FILE__, __LINE__, 1);
|
233 |
return;
|
234 |
}
|
235 |
// --------------------------------------------------------------------------------
|
@@ -273,7 +270,6 @@
|
|
273 |
// --------------------------------------------------------------------------------
|
274 |
function create($p_filelist)
|
275 |
{
|
276 |
-
PclTraceFctStart(__FILE__, __LINE__, 'PclZip::create', "filelist='$p_filelist', ...");
|
277 |
$v_result=1;
|
278 |
|
279 |
// ----- Reset the error handler
|
@@ -285,7 +281,6 @@
|
|
285 |
|
286 |
// ----- Look for variable options arguments
|
287 |
$v_size = func_num_args();
|
288 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
|
289 |
|
290 |
// ----- Look for arguments
|
291 |
if ($v_size > 1) {
|
@@ -298,7 +293,6 @@
|
|
298 |
|
299 |
// ----- Look for first arg
|
300 |
if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
|
301 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options detected");
|
302 |
|
303 |
// ----- Parse the options
|
304 |
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
|
@@ -315,7 +309,6 @@
|
|
315 |
//, PCLZIP_OPT_CRYPT => 'optional'
|
316 |
));
|
317 |
if ($v_result != 1) {
|
318 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0);
|
319 |
return 0;
|
320 |
}
|
321 |
}
|
@@ -324,7 +317,6 @@
|
|
324 |
// Here we need to support the first historic synopsis of the
|
325 |
// method.
|
326 |
else {
|
327 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
|
328 |
|
329 |
// ----- Get the first argument
|
330 |
$v_options[PCLZIP_OPT_ADD_PATH] = $v_arg_list[0];
|
@@ -336,7 +328,6 @@
|
|
336 |
else if ($v_size > 2) {
|
337 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
|
338 |
"Invalid number / type of arguments");
|
339 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
340 |
return 0;
|
341 |
}
|
342 |
}
|
@@ -375,7 +366,6 @@
|
|
375 |
// ----- Invalid variable type for $p_filelist
|
376 |
else {
|
377 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist");
|
378 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0);
|
379 |
return 0;
|
380 |
}
|
381 |
|
@@ -386,7 +376,6 @@
|
|
386 |
$v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
|
387 |
}
|
388 |
else {
|
389 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Ignore an empty filename");
|
390 |
}
|
391 |
}
|
392 |
}
|
@@ -406,7 +395,6 @@
|
|
406 |
$v_options,
|
407 |
$v_supported_attributes);
|
408 |
if ($v_result != 1) {
|
409 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0);
|
410 |
return 0;
|
411 |
}
|
412 |
}
|
@@ -414,19 +402,16 @@
|
|
414 |
// ----- Expand the filelist (expand directories)
|
415 |
$v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
|
416 |
if ($v_result != 1) {
|
417 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0);
|
418 |
return 0;
|
419 |
}
|
420 |
|
421 |
// ----- Call the create fct
|
422 |
$v_result = $this->privCreate($v_filedescr_list, $p_result_list, $v_options);
|
423 |
if ($v_result != 1) {
|
424 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0);
|
425 |
return 0;
|
426 |
}
|
427 |
|
428 |
// ----- Return
|
429 |
-
PclTraceFctEnd(__FILE__, __LINE__, $p_result_list);
|
430 |
return $p_result_list;
|
431 |
}
|
432 |
// --------------------------------------------------------------------------------
|
@@ -468,7 +453,6 @@
|
|
468 |
// --------------------------------------------------------------------------------
|
469 |
function add($p_filelist)
|
470 |
{
|
471 |
-
PclTraceFctStart(__FILE__, __LINE__, 'PclZip::add', "filelist='$p_filelist', ...");
|
472 |
$v_result=1;
|
473 |
|
474 |
// ----- Reset the error handler
|
@@ -480,7 +464,6 @@
|
|
480 |
|
481 |
// ----- Look for variable options arguments
|
482 |
$v_size = func_num_args();
|
483 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
|
484 |
|
485 |
// ----- Look for arguments
|
486 |
if ($v_size > 1) {
|
@@ -493,7 +476,6 @@
|
|
493 |
|
494 |
// ----- Look for first arg
|
495 |
if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
|
496 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options detected");
|
497 |
|
498 |
// ----- Parse the options
|
499 |
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
|
@@ -512,7 +494,6 @@
|
|
512 |
//, PCLZIP_OPT_CRYPT => 'optional'
|
513 |
));
|
514 |
if ($v_result != 1) {
|
515 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0);
|
516 |
return 0;
|
517 |
}
|
518 |
}
|
@@ -521,7 +502,6 @@
|
|
521 |
// Here we need to support the first historic synopsis of the
|
522 |
// method.
|
523 |
else {
|
524 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
|
525 |
|
526 |
// ----- Get the first argument
|
527 |
$v_options[PCLZIP_OPT_ADD_PATH] = $v_add_path = $v_arg_list[0];
|
@@ -535,7 +515,6 @@
|
|
535 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
|
536 |
|
537 |
// ----- Return
|
538 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
539 |
return 0;
|
540 |
}
|
541 |
}
|
@@ -574,7 +553,6 @@
|
|
574 |
// ----- Invalid variable type for $p_filelist
|
575 |
else {
|
576 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '".gettype($p_filelist)."' for p_filelist");
|
577 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0);
|
578 |
return 0;
|
579 |
}
|
580 |
|
@@ -600,7 +578,6 @@
|
|
600 |
$v_options,
|
601 |
$v_supported_attributes);
|
602 |
if ($v_result != 1) {
|
603 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0);
|
604 |
return 0;
|
605 |
}
|
606 |
}
|
@@ -608,19 +585,16 @@
|
|
608 |
// ----- Expand the filelist (expand directories)
|
609 |
$v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
|
610 |
if ($v_result != 1) {
|
611 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0);
|
612 |
return 0;
|
613 |
}
|
614 |
|
615 |
// ----- Call the create fct
|
616 |
$v_result = $this->privAdd($v_filedescr_list, $p_result_list, $v_options);
|
617 |
if ($v_result != 1) {
|
618 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0);
|
619 |
return 0;
|
620 |
}
|
621 |
|
622 |
// ----- Return
|
623 |
-
PclTraceFctEnd(__FILE__, __LINE__, $p_result_list);
|
624 |
return $p_result_list;
|
625 |
}
|
626 |
// --------------------------------------------------------------------------------
|
@@ -668,7 +642,6 @@
|
|
668 |
// --------------------------------------------------------------------------------
|
669 |
function listContent()
|
670 |
{
|
671 |
-
PclTraceFctStart(__FILE__, __LINE__, 'PclZip::listContent', "");
|
672 |
$v_result=1;
|
673 |
|
674 |
// ----- Reset the error handler
|
@@ -676,7 +649,6 @@
|
|
676 |
|
677 |
// ----- Check archive
|
678 |
if (!$this->privCheckFormat()) {
|
679 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0);
|
680 |
return(0);
|
681 |
}
|
682 |
|
@@ -685,12 +657,10 @@
|
|
685 |
if (($v_result = $this->privList($p_list)) != 1)
|
686 |
{
|
687 |
unset($p_list);
|
688 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
|
689 |
return(0);
|
690 |
}
|
691 |
|
692 |
// ----- Return
|
693 |
-
PclTraceFctEnd(__FILE__, __LINE__, $p_list);
|
694 |
return $p_list;
|
695 |
}
|
696 |
// --------------------------------------------------------------------------------
|
@@ -729,7 +699,6 @@
|
|
729 |
// --------------------------------------------------------------------------------
|
730 |
function extract()
|
731 |
{
|
732 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::extract", "");
|
733 |
$v_result=1;
|
734 |
|
735 |
// ----- Reset the error handler
|
@@ -737,7 +706,6 @@
|
|
737 |
|
738 |
// ----- Check archive
|
739 |
if (!$this->privCheckFormat()) {
|
740 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0);
|
741 |
return(0);
|
742 |
}
|
743 |
|
@@ -750,7 +718,6 @@
|
|
750 |
|
751 |
// ----- Look for variable options arguments
|
752 |
$v_size = func_num_args();
|
753 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
|
754 |
|
755 |
// ----- Default values for option
|
756 |
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
|
@@ -762,7 +729,6 @@
|
|
762 |
|
763 |
// ----- Look for first arg
|
764 |
if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
|
765 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options");
|
766 |
|
767 |
// ----- Parse the options
|
768 |
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
|
@@ -787,7 +753,6 @@
|
|
787 |
PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
|
788 |
));
|
789 |
if ($v_result != 1) {
|
790 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0);
|
791 |
return 0;
|
792 |
}
|
793 |
|
@@ -814,7 +779,6 @@
|
|
814 |
// Here we need to support the first historic synopsis of the
|
815 |
// method.
|
816 |
else {
|
817 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
|
818 |
|
819 |
// ----- Get the first argument
|
820 |
$v_path = $v_arg_list[0];
|
@@ -828,7 +792,6 @@
|
|
828 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
|
829 |
|
830 |
// ----- Return
|
831 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
|
832 |
return 0;
|
833 |
}
|
834 |
}
|
@@ -838,7 +801,6 @@
|
|
838 |
$this->privOptionDefaultThreshold($v_options);
|
839 |
|
840 |
// ----- Trace
|
841 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "path='$v_path', remove_path='$v_remove_path', remove_all_path='".($v_remove_path?'true':'false')."'");
|
842 |
|
843 |
// ----- Call the extracting fct
|
844 |
$p_list = array();
|
@@ -846,12 +808,10 @@
|
|
846 |
$v_remove_all_path, $v_options);
|
847 |
if ($v_result < 1) {
|
848 |
unset($p_list);
|
849 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
|
850 |
return(0);
|
851 |
}
|
852 |
|
853 |
// ----- Return
|
854 |
-
PclTraceFctEnd(__FILE__, __LINE__, $p_list);
|
855 |
return $p_list;
|
856 |
}
|
857 |
// --------------------------------------------------------------------------------
|
@@ -896,7 +856,6 @@
|
|
896 |
//function extractByIndex($p_index, options...)
|
897 |
function extractByIndex($p_index)
|
898 |
{
|
899 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::extractByIndex", "index='$p_index', ...");
|
900 |
$v_result=1;
|
901 |
|
902 |
// ----- Reset the error handler
|
@@ -904,7 +863,6 @@
|
|
904 |
|
905 |
// ----- Check archive
|
906 |
if (!$this->privCheckFormat()) {
|
907 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0);
|
908 |
return(0);
|
909 |
}
|
910 |
|
@@ -917,7 +875,6 @@
|
|
917 |
|
918 |
// ----- Look for variable options arguments
|
919 |
$v_size = func_num_args();
|
920 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
|
921 |
|
922 |
// ----- Default values for option
|
923 |
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
|
@@ -933,7 +890,6 @@
|
|
933 |
|
934 |
// ----- Look for first arg
|
935 |
if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
|
936 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options");
|
937 |
|
938 |
// ----- Parse the options
|
939 |
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
|
@@ -953,7 +909,6 @@
|
|
953 |
PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
|
954 |
));
|
955 |
if ($v_result != 1) {
|
956 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0);
|
957 |
return 0;
|
958 |
}
|
959 |
|
@@ -976,10 +931,8 @@
|
|
976 |
}
|
977 |
if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) {
|
978 |
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
|
979 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Option PCLZIP_OPT_EXTRACT_AS_STRING not set.");
|
980 |
}
|
981 |
else {
|
982 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Option PCLZIP_OPT_EXTRACT_AS_STRING set.");
|
983 |
}
|
984 |
}
|
985 |
|
@@ -987,7 +940,6 @@
|
|
987 |
// Here we need to support the first historic synopsis of the
|
988 |
// method.
|
989 |
else {
|
990 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
|
991 |
|
992 |
// ----- Get the first argument
|
993 |
$v_path = $v_arg_list[0];
|
@@ -1001,14 +953,12 @@
|
|
1001 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
|
1002 |
|
1003 |
// ----- Return
|
1004 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1005 |
return 0;
|
1006 |
}
|
1007 |
}
|
1008 |
}
|
1009 |
|
1010 |
// ----- Trace
|
1011 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "index='$p_index', path='$v_path', remove_path='$v_remove_path', remove_all_path='".($v_remove_path?'true':'false')."'");
|
1012 |
|
1013 |
// ----- Trick
|
1014 |
// Here I want to reuse extractByRule(), so I need to parse the $p_index
|
@@ -1018,7 +968,6 @@
|
|
1018 |
$v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick,
|
1019 |
array (PCLZIP_OPT_BY_INDEX => 'optional' ));
|
1020 |
if ($v_result != 1) {
|
1021 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0);
|
1022 |
return 0;
|
1023 |
}
|
1024 |
$v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX];
|
@@ -1028,12 +977,10 @@
|
|
1028 |
|
1029 |
// ----- Call the extracting fct
|
1030 |
if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) {
|
1031 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
|
1032 |
return(0);
|
1033 |
}
|
1034 |
|
1035 |
// ----- Return
|
1036 |
-
PclTraceFctEnd(__FILE__, __LINE__, $p_list);
|
1037 |
return $p_list;
|
1038 |
}
|
1039 |
// --------------------------------------------------------------------------------
|
@@ -1058,7 +1005,6 @@
|
|
1058 |
// --------------------------------------------------------------------------------
|
1059 |
function delete()
|
1060 |
{
|
1061 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::delete", "");
|
1062 |
$v_result=1;
|
1063 |
|
1064 |
// ----- Reset the error handler
|
@@ -1066,7 +1012,6 @@
|
|
1066 |
|
1067 |
// ----- Check archive
|
1068 |
if (!$this->privCheckFormat()) {
|
1069 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0);
|
1070 |
return(0);
|
1071 |
}
|
1072 |
|
@@ -1075,7 +1020,6 @@
|
|
1075 |
|
1076 |
// ----- Look for variable options arguments
|
1077 |
$v_size = func_num_args();
|
1078 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
|
1079 |
|
1080 |
// ----- Look for arguments
|
1081 |
if ($v_size > 0) {
|
@@ -1089,7 +1033,6 @@
|
|
1089 |
PCLZIP_OPT_BY_PREG => 'optional',
|
1090 |
PCLZIP_OPT_BY_INDEX => 'optional' ));
|
1091 |
if ($v_result != 1) {
|
1092 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0);
|
1093 |
return 0;
|
1094 |
}
|
1095 |
}
|
@@ -1102,7 +1045,6 @@
|
|
1102 |
if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) {
|
1103 |
$this->privSwapBackMagicQuotes();
|
1104 |
unset($v_list);
|
1105 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
|
1106 |
return(0);
|
1107 |
}
|
1108 |
|
@@ -1110,7 +1052,6 @@
|
|
1110 |
$this->privSwapBackMagicQuotes();
|
1111 |
|
1112 |
// ----- Return
|
1113 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_list);
|
1114 |
return $v_list;
|
1115 |
}
|
1116 |
// --------------------------------------------------------------------------------
|
@@ -1123,12 +1064,10 @@
|
|
1123 |
// --------------------------------------------------------------------------------
|
1124 |
function deleteByIndex($p_index)
|
1125 |
{
|
1126 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::deleteByIndex", "index='$p_index'");
|
1127 |
|
1128 |
$p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index);
|
1129 |
|
1130 |
// ----- Return
|
1131 |
-
PclTraceFctEnd(__FILE__, __LINE__, $p_list);
|
1132 |
return $p_list;
|
1133 |
}
|
1134 |
// --------------------------------------------------------------------------------
|
@@ -1149,7 +1088,6 @@
|
|
1149 |
// --------------------------------------------------------------------------------
|
1150 |
function properties()
|
1151 |
{
|
1152 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::properties", "");
|
1153 |
|
1154 |
// ----- Reset the error handler
|
1155 |
$this->privErrorReset();
|
@@ -1160,7 +1098,6 @@
|
|
1160 |
// ----- Check archive
|
1161 |
if (!$this->privCheckFormat()) {
|
1162 |
$this->privSwapBackMagicQuotes();
|
1163 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0);
|
1164 |
return(0);
|
1165 |
}
|
1166 |
|
@@ -1174,7 +1111,6 @@
|
|
1174 |
if (@is_file($this->zipname))
|
1175 |
{
|
1176 |
// ----- Open the zip file
|
1177 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
1178 |
if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
|
1179 |
{
|
1180 |
$this->privSwapBackMagicQuotes();
|
@@ -1183,7 +1119,6 @@
|
|
1183 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
|
1184 |
|
1185 |
// ----- Return
|
1186 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), 0);
|
1187 |
return 0;
|
1188 |
}
|
1189 |
|
@@ -1192,7 +1127,6 @@
|
|
1192 |
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
|
1193 |
{
|
1194 |
$this->privSwapBackMagicQuotes();
|
1195 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0);
|
1196 |
return 0;
|
1197 |
}
|
1198 |
|
@@ -1209,7 +1143,6 @@
|
|
1209 |
$this->privSwapBackMagicQuotes();
|
1210 |
|
1211 |
// ----- Return
|
1212 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_prop);
|
1213 |
return $v_prop;
|
1214 |
}
|
1215 |
// --------------------------------------------------------------------------------
|
@@ -1228,7 +1161,6 @@
|
|
1228 |
// --------------------------------------------------------------------------------
|
1229 |
function duplicate($p_archive)
|
1230 |
{
|
1231 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::duplicate", "");
|
1232 |
$v_result = 1;
|
1233 |
|
1234 |
// ----- Reset the error handler
|
@@ -1237,7 +1169,6 @@
|
|
1237 |
// ----- Look if the $p_archive is a PclZip object
|
1238 |
if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip'))
|
1239 |
{
|
1240 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "The parameter is valid PclZip object '".$p_archive->zipname."'");
|
1241 |
|
1242 |
// ----- Duplicate the archive
|
1243 |
$v_result = $this->privDuplicate($p_archive->zipname);
|
@@ -1246,7 +1177,6 @@
|
|
1246 |
// ----- Look if the $p_archive is a string (so a filename)
|
1247 |
else if (is_string($p_archive))
|
1248 |
{
|
1249 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "The parameter is a filename '$p_archive'");
|
1250 |
|
1251 |
// ----- Check that $p_archive is a valid zip file
|
1252 |
// TBC : Should also check the archive format
|
@@ -1270,7 +1200,6 @@
|
|
1270 |
}
|
1271 |
|
1272 |
// ----- Return
|
1273 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
1274 |
return $v_result;
|
1275 |
}
|
1276 |
// --------------------------------------------------------------------------------
|
@@ -1291,7 +1220,6 @@
|
|
1291 |
// --------------------------------------------------------------------------------
|
1292 |
function merge($p_archive_to_add)
|
1293 |
{
|
1294 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::merge", "");
|
1295 |
$v_result = 1;
|
1296 |
|
1297 |
// ----- Reset the error handler
|
@@ -1299,14 +1227,12 @@
|
|
1299 |
|
1300 |
// ----- Check archive
|
1301 |
if (!$this->privCheckFormat()) {
|
1302 |
-
PclTraceFctEnd(__FILE__, __LINE__, 0);
|
1303 |
return(0);
|
1304 |
}
|
1305 |
|
1306 |
// ----- Look if the $p_archive_to_add is a PclZip object
|
1307 |
if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip'))
|
1308 |
{
|
1309 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "The parameter is valid PclZip object");
|
1310 |
|
1311 |
// ----- Merge the archive
|
1312 |
$v_result = $this->privMerge($p_archive_to_add);
|
@@ -1315,7 +1241,6 @@
|
|
1315 |
// ----- Look if the $p_archive_to_add is a string (so a filename)
|
1316 |
else if (is_string($p_archive_to_add))
|
1317 |
{
|
1318 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "The parameter is a filename");
|
1319 |
|
1320 |
// ----- Create a temporary archive
|
1321 |
$v_object_archive = new PclZip($p_archive_to_add);
|
@@ -1333,7 +1258,6 @@
|
|
1333 |
}
|
1334 |
|
1335 |
// ----- Return
|
1336 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
1337 |
return $v_result;
|
1338 |
}
|
1339 |
// --------------------------------------------------------------------------------
|
@@ -1448,7 +1372,6 @@
|
|
1448 |
// --------------------------------------------------------------------------------
|
1449 |
function privCheckFormat($p_level=0)
|
1450 |
{
|
1451 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCheckFormat", "");
|
1452 |
$v_result = true;
|
1453 |
|
1454 |
// ----- Reset the file system cache
|
@@ -1461,7 +1384,6 @@
|
|
1461 |
if (!is_file($this->zipname)) {
|
1462 |
// ----- Error log
|
1463 |
PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '".$this->zipname."'");
|
1464 |
-
PclTraceFctEnd(__FILE__, __LINE__, false, PclZip::errorInfo());
|
1465 |
return(false);
|
1466 |
}
|
1467 |
|
@@ -1469,7 +1391,6 @@
|
|
1469 |
if (!is_readable($this->zipname)) {
|
1470 |
// ----- Error log
|
1471 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '".$this->zipname."'");
|
1472 |
-
PclTraceFctEnd(__FILE__, __LINE__, false, PclZip::errorInfo());
|
1473 |
return(false);
|
1474 |
}
|
1475 |
|
@@ -1483,7 +1404,6 @@
|
|
1483 |
// TBC
|
1484 |
|
1485 |
// ----- Return
|
1486 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
1487 |
return $v_result;
|
1488 |
}
|
1489 |
// --------------------------------------------------------------------------------
|
@@ -1505,13 +1425,11 @@
|
|
1505 |
// --------------------------------------------------------------------------------
|
1506 |
function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options=false)
|
1507 |
{
|
1508 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privParseOptions", "");
|
1509 |
$v_result=1;
|
1510 |
|
1511 |
// ----- Read the options
|
1512 |
$i=0;
|
1513 |
while ($i<$p_size) {
|
1514 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Looking for table index $i, option = '".PclZipUtilOptionText($p_options_list[$i])."(".$p_options_list[$i].")'");
|
1515 |
|
1516 |
// ----- Check if the option is supported
|
1517 |
if (!isset($v_requested_options[$p_options_list[$i]])) {
|
@@ -1519,7 +1437,6 @@
|
|
1519 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '".$p_options_list[$i]."' for this method");
|
1520 |
|
1521 |
// ----- Return
|
1522 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1523 |
return PclZip::errorCode();
|
1524 |
}
|
1525 |
|
@@ -1535,13 +1452,11 @@
|
|
1535 |
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1536 |
|
1537 |
// ----- Return
|
1538 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1539 |
return PclZip::errorCode();
|
1540 |
}
|
1541 |
|
1542 |
// ----- Get the value
|
1543 |
$v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
|
1544 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1545 |
$i++;
|
1546 |
break;
|
1547 |
|
@@ -1549,14 +1464,12 @@
|
|
1549 |
// ----- Check the number of parameters
|
1550 |
if (($i+1) >= $p_size) {
|
1551 |
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1552 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1553 |
return PclZip::errorCode();
|
1554 |
}
|
1555 |
|
1556 |
// ----- Check for incompatible options
|
1557 |
if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
|
1558 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
|
1559 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1560 |
return PclZip::errorCode();
|
1561 |
}
|
1562 |
|
@@ -1564,13 +1477,11 @@
|
|
1564 |
$v_value = $p_options_list[$i+1];
|
1565 |
if ((!is_integer($v_value)) || ($v_value<0)) {
|
1566 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1567 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1568 |
return PclZip::errorCode();
|
1569 |
}
|
1570 |
|
1571 |
// ----- Get the value (and convert it in bytes)
|
1572 |
$v_result_list[$p_options_list[$i]] = $v_value*1048576;
|
1573 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1574 |
$i++;
|
1575 |
break;
|
1576 |
|
@@ -1578,30 +1489,25 @@
|
|
1578 |
// ----- Check for incompatible options
|
1579 |
if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
|
1580 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
|
1581 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1582 |
return PclZip::errorCode();
|
1583 |
}
|
1584 |
|
1585 |
$v_result_list[$p_options_list[$i]] = true;
|
1586 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1587 |
break;
|
1588 |
|
1589 |
case PCLZIP_OPT_TEMP_FILE_OFF :
|
1590 |
// ----- Check for incompatible options
|
1591 |
if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_ON])) {
|
1592 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_ON'");
|
1593 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1594 |
return PclZip::errorCode();
|
1595 |
}
|
1596 |
// ----- Check for incompatible options
|
1597 |
if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
|
1598 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_THRESHOLD'");
|
1599 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1600 |
return PclZip::errorCode();
|
1601 |
}
|
1602 |
|
1603 |
$v_result_list[$p_options_list[$i]] = true;
|
1604 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1605 |
break;
|
1606 |
|
1607 |
case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION :
|
@@ -1611,7 +1517,6 @@
|
|
1611 |
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1612 |
|
1613 |
// ----- Return
|
1614 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1615 |
return PclZip::errorCode();
|
1616 |
}
|
1617 |
|
@@ -1619,11 +1524,9 @@
|
|
1619 |
if ( is_string($p_options_list[$i+1])
|
1620 |
&& ($p_options_list[$i+1] != '')) {
|
1621 |
$v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
|
1622 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1623 |
$i++;
|
1624 |
}
|
1625 |
else {
|
1626 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." set with an empty value is ignored.");
|
1627 |
}
|
1628 |
break;
|
1629 |
|
@@ -1635,7 +1538,6 @@
|
|
1635 |
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1636 |
|
1637 |
// ----- Return
|
1638 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1639 |
return PclZip::errorCode();
|
1640 |
}
|
1641 |
|
@@ -1651,10 +1553,8 @@
|
|
1651 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1652 |
|
1653 |
// ----- Return
|
1654 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1655 |
return PclZip::errorCode();
|
1656 |
}
|
1657 |
-
//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1658 |
$i++;
|
1659 |
break;
|
1660 |
|
@@ -1671,7 +1571,6 @@
|
|
1671 |
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1672 |
|
1673 |
// ----- Return
|
1674 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1675 |
return PclZip::errorCode();
|
1676 |
}
|
1677 |
|
@@ -1684,10 +1583,8 @@
|
|
1684 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1685 |
|
1686 |
// ----- Return
|
1687 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1688 |
return PclZip::errorCode();
|
1689 |
}
|
1690 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1691 |
$i++;
|
1692 |
break;
|
1693 |
|
@@ -1704,7 +1601,6 @@
|
|
1704 |
."'");
|
1705 |
|
1706 |
// ----- Return
|
1707 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1708 |
return PclZip::errorCode();
|
1709 |
}
|
1710 |
|
@@ -1720,10 +1616,8 @@
|
|
1720 |
."'");
|
1721 |
|
1722 |
// ----- Return
|
1723 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1724 |
return PclZip::errorCode();
|
1725 |
}
|
1726 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1727 |
$i++;
|
1728 |
break;
|
1729 |
|
@@ -1735,14 +1629,12 @@
|
|
1735 |
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1736 |
|
1737 |
// ----- Return
|
1738 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1739 |
return PclZip::errorCode();
|
1740 |
}
|
1741 |
|
1742 |
// ----- Get the value
|
1743 |
$v_work_list = array();
|
1744 |
if (is_string($p_options_list[$i+1])) {
|
1745 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is a string '".$p_options_list[$i+1]."'");
|
1746 |
|
1747 |
// ----- Remove spaces
|
1748 |
$p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', '');
|
@@ -1751,11 +1643,9 @@
|
|
1751 |
$v_work_list = explode(",", $p_options_list[$i+1]);
|
1752 |
}
|
1753 |
else if (is_integer($p_options_list[$i+1])) {
|
1754 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is an integer '".$p_options_list[$i+1]."'");
|
1755 |
$v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1];
|
1756 |
}
|
1757 |
else if (is_array($p_options_list[$i+1])) {
|
1758 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is an array");
|
1759 |
$v_work_list = $p_options_list[$i+1];
|
1760 |
}
|
1761 |
else {
|
@@ -1763,7 +1653,6 @@
|
|
1763 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1764 |
|
1765 |
// ----- Return
|
1766 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1767 |
return PclZip::errorCode();
|
1768 |
}
|
1769 |
|
@@ -1797,15 +1686,12 @@
|
|
1797 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Too many values in index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1798 |
|
1799 |
// ----- Return
|
1800 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1801 |
return PclZip::errorCode();
|
1802 |
}
|
1803 |
|
1804 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Extracted index item = [".$v_result_list[$p_options_list[$i]][$j]['start'].",".$v_result_list[$p_options_list[$i]][$j]['end']."]");
|
1805 |
|
1806 |
// ----- Look for list sort
|
1807 |
if ($v_result_list[$p_options_list[$i]][$j]['start'] < $v_sort_value) {
|
1808 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "The list should be sorted ...");
|
1809 |
$v_sort_flag=true;
|
1810 |
|
1811 |
// ----- TBC : An automatic sort should be writen ...
|
@@ -1813,7 +1699,6 @@
|
|
1813 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Invalid order of index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1814 |
|
1815 |
// ----- Return
|
1816 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1817 |
return PclZip::errorCode();
|
1818 |
}
|
1819 |
$v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start'];
|
@@ -1822,7 +1707,6 @@
|
|
1822 |
// ----- Sort the items
|
1823 |
if ($v_sort_flag) {
|
1824 |
// TBC : To Be Completed
|
1825 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "List sorting is not yet write ...");
|
1826 |
}
|
1827 |
|
1828 |
// ----- Next option
|
@@ -1837,7 +1721,6 @@
|
|
1837 |
case PCLZIP_OPT_REPLACE_NEWER :
|
1838 |
case PCLZIP_OPT_STOP_ON_ERROR :
|
1839 |
$v_result_list[$p_options_list[$i]] = true;
|
1840 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1841 |
break;
|
1842 |
|
1843 |
// ----- Look for options that request an octal value
|
@@ -1848,13 +1731,11 @@
|
|
1848 |
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1849 |
|
1850 |
// ----- Return
|
1851 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1852 |
return PclZip::errorCode();
|
1853 |
}
|
1854 |
|
1855 |
// ----- Get the value
|
1856 |
$v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
|
1857 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1858 |
$i++;
|
1859 |
break;
|
1860 |
|
@@ -1875,13 +1756,11 @@
|
|
1875 |
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1876 |
|
1877 |
// ----- Return
|
1878 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1879 |
return PclZip::errorCode();
|
1880 |
}
|
1881 |
|
1882 |
// ----- Get the value
|
1883 |
$v_function_name = $p_options_list[$i+1];
|
1884 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "call-back ".PclZipUtilOptionText($p_options_list[$i])." = '".$v_function_name."'");
|
1885 |
|
1886 |
// ----- Check that the value is a valid existing function
|
1887 |
if (!function_exists($v_function_name)) {
|
@@ -1889,7 +1768,6 @@
|
|
1889 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '".$v_function_name."()' is not an existing function for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1890 |
|
1891 |
// ----- Return
|
1892 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1893 |
return PclZip::errorCode();
|
1894 |
}
|
1895 |
|
@@ -1905,7 +1783,6 @@
|
|
1905 |
.$p_options_list[$i]."'");
|
1906 |
|
1907 |
// ----- Return
|
1908 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1909 |
return PclZip::errorCode();
|
1910 |
}
|
1911 |
|
@@ -1918,14 +1795,12 @@
|
|
1918 |
for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
|
1919 |
// ----- Look for mandatory option
|
1920 |
if ($v_requested_options[$key] == 'mandatory') {
|
1921 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Detect a mandatory option : ".PclZipUtilOptionText($key)."(".$key.")");
|
1922 |
// ----- Look if present
|
1923 |
if (!isset($v_result_list[$key])) {
|
1924 |
// ----- Error log
|
1925 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
|
1926 |
|
1927 |
// ----- Return
|
1928 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1929 |
return PclZip::errorCode();
|
1930 |
}
|
1931 |
}
|
@@ -1934,12 +1809,10 @@
|
|
1934 |
|
1935 |
// ----- Look for default values
|
1936 |
if (!isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
|
1937 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3,"Calculate auto threshold");
|
1938 |
|
1939 |
}
|
1940 |
|
1941 |
// ----- Return
|
1942 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
1943 |
return $v_result;
|
1944 |
}
|
1945 |
// --------------------------------------------------------------------------------
|
@@ -1952,16 +1825,13 @@
|
|
1952 |
// --------------------------------------------------------------------------------
|
1953 |
function privOptionDefaultThreshold(&$p_options)
|
1954 |
{
|
1955 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privOptionDefaultThreshold", "");
|
1956 |
$v_result=1;
|
1957 |
|
1958 |
if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
|
1959 |
|| isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) {
|
1960 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
1961 |
return $v_result;
|
1962 |
}
|
1963 |
|
1964 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3,"Create an auto-threshold for use of temporay files");
|
1965 |
// ----- Get 'memory_limit' configuration value
|
1966 |
$v_memory_limit = ini_get('memory_limit');
|
1967 |
$v_memory_limit = trim($v_memory_limit);
|
@@ -1978,17 +1848,13 @@
|
|
1978 |
|
1979 |
$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO);
|
1980 |
|
1981 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3,"Current memory usage : ".memory_get_usage(TRUE)." bytes");
|
1982 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3,"Threshold value is : ".$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]." bytes");
|
1983 |
|
1984 |
// ----- Sanity check : No threshold if value lower than 1M
|
1985 |
if ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] < 1048576) {
|
1986 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3,"Unset the threshold (value ".$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD].") because under 1Mo sanity check)");
|
1987 |
unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]);
|
1988 |
}
|
1989 |
|
1990 |
// ----- Return
|
1991 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
1992 |
return $v_result;
|
1993 |
}
|
1994 |
// --------------------------------------------------------------------------------
|
@@ -2003,7 +1869,6 @@
|
|
2003 |
// --------------------------------------------------------------------------------
|
2004 |
function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options=false)
|
2005 |
{
|
2006 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrParseAtt", "");
|
2007 |
$v_result=1;
|
2008 |
|
2009 |
// ----- For each file in the list check the attributes
|
@@ -2015,7 +1880,6 @@
|
|
2015 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '".$v_key."' for this file");
|
2016 |
|
2017 |
// ----- Return
|
2018 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2019 |
return PclZip::errorCode();
|
2020 |
}
|
2021 |
|
@@ -2024,16 +1888,13 @@
|
|
2024 |
case PCLZIP_ATT_FILE_NAME :
|
2025 |
if (!is_string($v_value)) {
|
2026 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
|
2027 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2028 |
return PclZip::errorCode();
|
2029 |
}
|
2030 |
|
2031 |
$p_filedescr['filename'] = PclZipUtilPathReduction($v_value);
|
2032 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
|
2033 |
|
2034 |
if ($p_filedescr['filename'] == '') {
|
2035 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'");
|
2036 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2037 |
return PclZip::errorCode();
|
2038 |
}
|
2039 |
|
@@ -2042,16 +1903,13 @@
|
|
2042 |
case PCLZIP_ATT_FILE_NEW_SHORT_NAME :
|
2043 |
if (!is_string($v_value)) {
|
2044 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
|
2045 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2046 |
return PclZip::errorCode();
|
2047 |
}
|
2048 |
|
2049 |
$p_filedescr['new_short_name'] = PclZipUtilPathReduction($v_value);
|
2050 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
|
2051 |
|
2052 |
if ($p_filedescr['new_short_name'] == '') {
|
2053 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '".PclZipUtilOptionText($v_key)."'");
|
2054 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2055 |
return PclZip::errorCode();
|
2056 |
}
|
2057 |
break;
|
@@ -2059,16 +1917,13 @@
|
|
2059 |
case PCLZIP_ATT_FILE_NEW_FULL_NAME :
|
2060 |
if (!is_string($v_value)) {
|
2061 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
|
2062 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2063 |
return PclZip::errorCode();
|
2064 |
}
|
2065 |
|
2066 |
$p_filedescr['new_full_name'] = PclZipUtilPathReduction($v_value);
|
2067 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
|
2068 |
|
2069 |
if ($p_filedescr['new_full_name'] == '') {
|
2070 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '".PclZipUtilOptionText($v_key)."'");
|
2071 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2072 |
return PclZip::errorCode();
|
2073 |
}
|
2074 |
break;
|
@@ -2077,28 +1932,23 @@
|
|
2077 |
case PCLZIP_ATT_FILE_COMMENT :
|
2078 |
if (!is_string($v_value)) {
|
2079 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
|
2080 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2081 |
return PclZip::errorCode();
|
2082 |
}
|
2083 |
|
2084 |
$p_filedescr['comment'] = $v_value;
|
2085 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
|
2086 |
break;
|
2087 |
|
2088 |
case PCLZIP_ATT_FILE_MTIME :
|
2089 |
if (!is_integer($v_value)) {
|
2090 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". Integer expected for attribute '".PclZipUtilOptionText($v_key)."'");
|
2091 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2092 |
return PclZip::errorCode();
|
2093 |
}
|
2094 |
|
2095 |
$p_filedescr['mtime'] = $v_value;
|
2096 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
|
2097 |
break;
|
2098 |
|
2099 |
case PCLZIP_ATT_FILE_CONTENT :
|
2100 |
$p_filedescr['content'] = $v_value;
|
2101 |
-
//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
|
2102 |
break;
|
2103 |
|
2104 |
default :
|
@@ -2107,7 +1957,6 @@
|
|
2107 |
"Unknown parameter '".$v_key."'");
|
2108 |
|
2109 |
// ----- Return
|
2110 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2111 |
return PclZip::errorCode();
|
2112 |
}
|
2113 |
|
@@ -2116,11 +1965,9 @@
|
|
2116 |
for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
|
2117 |
// ----- Look for mandatory option
|
2118 |
if ($v_requested_options[$key] == 'mandatory') {
|
2119 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Detect a mandatory option : ".PclZipUtilOptionText($key)."(".$key.")");
|
2120 |
// ----- Look if present
|
2121 |
if (!isset($p_file_list[$key])) {
|
2122 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
|
2123 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2124 |
return PclZip::errorCode();
|
2125 |
}
|
2126 |
}
|
@@ -2131,7 +1978,6 @@
|
|
2131 |
}
|
2132 |
|
2133 |
// ----- Return
|
2134 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2135 |
return $v_result;
|
2136 |
}
|
2137 |
// --------------------------------------------------------------------------------
|
@@ -2152,7 +1998,6 @@
|
|
2152 |
// --------------------------------------------------------------------------------
|
2153 |
function privFileDescrExpand(&$p_filedescr_list, &$p_options)
|
2154 |
{
|
2155 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrExpand", "");
|
2156 |
$v_result=1;
|
2157 |
|
2158 |
// ----- Create a result list
|
@@ -2160,34 +2005,27 @@
|
|
2160 |
|
2161 |
// ----- Look each entry
|
2162 |
for ($i=0; $i<sizeof($p_filedescr_list); $i++) {
|
2163 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Looking for file ".$i.".");
|
2164 |
|
2165 |
// ----- Get filedescr
|
2166 |
$v_descr = $p_filedescr_list[$i];
|
2167 |
|
2168 |
// ----- Reduce the filename
|
2169 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr before reduction :'".$v_descr['filename']."'");
|
2170 |
$v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename'], false);
|
2171 |
$v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']);
|
2172 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr after reduction :'".$v_descr['filename']."'");
|
2173 |
|
2174 |
// ----- Look for real file or folder
|
2175 |
if (file_exists($v_descr['filename'])) {
|
2176 |
if (@is_file($v_descr['filename'])) {
|
2177 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a file");
|
2178 |
$v_descr['type'] = 'file';
|
2179 |
}
|
2180 |
else if (@is_dir($v_descr['filename'])) {
|
2181 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a folder");
|
2182 |
$v_descr['type'] = 'folder';
|
2183 |
}
|
2184 |
else if (@is_link($v_descr['filename'])) {
|
2185 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Unsupported file type : link");
|
2186 |
// skip
|
2187 |
continue;
|
2188 |
}
|
2189 |
else {
|
2190 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Unsupported file type : unknown type");
|
2191 |
// skip
|
2192 |
continue;
|
2193 |
}
|
@@ -2195,18 +2033,15 @@
|
|
2195 |
|
2196 |
// ----- Look for string added as file
|
2197 |
else if (isset($v_descr['content'])) {
|
2198 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a string added as a file");
|
2199 |
$v_descr['type'] = 'virtual_file';
|
2200 |
}
|
2201 |
|
2202 |
// ----- Missing file
|
2203 |
else {
|
2204 |
// ----- Error log
|
2205 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_descr['filename']."' does not exist");
|
2206 |
PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$v_descr['filename']."' does not exist");
|
2207 |
|
2208 |
// ----- Return
|
2209 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2210 |
return PclZip::errorCode();
|
2211 |
}
|
2212 |
|
@@ -2223,7 +2058,6 @@
|
|
2223 |
$v_dirlist_nb = 0;
|
2224 |
if ($v_folder_handler = @opendir($v_descr['filename'])) {
|
2225 |
while (($v_item_handler = @readdir($v_folder_handler)) !== false) {
|
2226 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for '".$v_item_handler."' in the directory");
|
2227 |
|
2228 |
// ----- Skip '.' and '..'
|
2229 |
if (($v_item_handler == '.') || ($v_item_handler == '..')) {
|
@@ -2238,7 +2072,6 @@
|
|
2238 |
// files/sub-folders also change
|
2239 |
if (($v_descr['stored_filename'] != $v_descr['filename'])
|
2240 |
&& (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) {
|
2241 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3,"Inherite parent folder stored path");
|
2242 |
if ($v_descr['stored_filename'] != '') {
|
2243 |
$v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler;
|
2244 |
}
|
@@ -2253,7 +2086,6 @@
|
|
2253 |
@closedir($v_folder_handler);
|
2254 |
}
|
2255 |
else {
|
2256 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to open dir '".$v_descr['filename']."' in read mode. Skipped.");
|
2257 |
// TBC : unable to open folder in read mode
|
2258 |
}
|
2259 |
|
@@ -2261,17 +2093,13 @@
|
|
2261 |
if ($v_dirlist_nb != 0) {
|
2262 |
// ----- Expand
|
2263 |
if (($v_result = $this->privFileDescrExpand($v_dirlist_descr, $p_options)) != 1) {
|
2264 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2265 |
return $v_result;
|
2266 |
}
|
2267 |
|
2268 |
// ----- Concat the resulting list
|
2269 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Merging result list (size '".sizeof($v_result_list)."') with dirlist (size '".sizeof($v_dirlist_descr)."')");
|
2270 |
$v_result_list = array_merge($v_result_list, $v_dirlist_descr);
|
2271 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "merged result list is size '".sizeof($v_result_list)."'");
|
2272 |
}
|
2273 |
else {
|
2274 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Nothing in this folder to expand.");
|
2275 |
}
|
2276 |
|
2277 |
// ----- Free local array
|
@@ -2283,7 +2111,6 @@
|
|
2283 |
$p_filedescr_list = $v_result_list;
|
2284 |
|
2285 |
// ----- Return
|
2286 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2287 |
return $v_result;
|
2288 |
}
|
2289 |
// --------------------------------------------------------------------------------
|
@@ -2296,7 +2123,6 @@
|
|
2296 |
// --------------------------------------------------------------------------------
|
2297 |
function privCreate($p_filedescr_list, &$p_result_list, &$p_options)
|
2298 |
{
|
2299 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCreate", "list");
|
2300 |
$v_result=1;
|
2301 |
$v_list_detail = array();
|
2302 |
|
@@ -2307,7 +2133,6 @@
|
|
2307 |
if (($v_result = $this->privOpenFd('wb')) != 1)
|
2308 |
{
|
2309 |
// ----- Return
|
2310 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2311 |
return $v_result;
|
2312 |
}
|
2313 |
|
@@ -2321,7 +2146,6 @@
|
|
2321 |
$this->privSwapBackMagicQuotes();
|
2322 |
|
2323 |
// ----- Return
|
2324 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2325 |
return $v_result;
|
2326 |
}
|
2327 |
// --------------------------------------------------------------------------------
|
@@ -2334,34 +2158,29 @@
|
|
2334 |
// --------------------------------------------------------------------------------
|
2335 |
function privAdd($p_filedescr_list, &$p_result_list, &$p_options)
|
2336 |
{
|
2337 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAdd", "list");
|
2338 |
$v_result=1;
|
2339 |
$v_list_detail = array();
|
2340 |
|
2341 |
// ----- Look if the archive exists or is empty
|
2342 |
if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0))
|
2343 |
{
|
2344 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive does not exist, or is empty, create it.");
|
2345 |
|
2346 |
// ----- Do a create
|
2347 |
$v_result = $this->privCreate($p_filedescr_list, $p_result_list, $p_options);
|
2348 |
|
2349 |
// ----- Return
|
2350 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2351 |
return $v_result;
|
2352 |
}
|
2353 |
// ----- Magic quotes trick
|
2354 |
$this->privDisableMagicQuotes();
|
2355 |
|
2356 |
// ----- Open the zip file
|
2357 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
2358 |
if (($v_result=$this->privOpenFd('rb')) != 1)
|
2359 |
{
|
2360 |
// ----- Magic quotes trick
|
2361 |
$this->privSwapBackMagicQuotes();
|
2362 |
|
2363 |
// ----- Return
|
2364 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2365 |
return $v_result;
|
2366 |
}
|
2367 |
|
@@ -2371,20 +2190,16 @@
|
|
2371 |
{
|
2372 |
$this->privCloseFd();
|
2373 |
$this->privSwapBackMagicQuotes();
|
2374 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2375 |
return $v_result;
|
2376 |
}
|
2377 |
|
2378 |
// ----- Go to beginning of File
|
2379 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
|
2380 |
@rewind($this->zip_fd);
|
2381 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
|
2382 |
|
2383 |
// ----- Creates a temporay file
|
2384 |
$v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
|
2385 |
|
2386 |
// ----- Open the temporary file in write mode
|
2387 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
2388 |
if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
|
2389 |
{
|
2390 |
$this->privCloseFd();
|
@@ -2393,7 +2208,6 @@
|
|
2393 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');
|
2394 |
|
2395 |
// ----- Return
|
2396 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2397 |
return PclZip::errorCode();
|
2398 |
}
|
2399 |
|
@@ -2403,7 +2217,6 @@
|
|
2403 |
while ($v_size != 0)
|
2404 |
{
|
2405 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
2406 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
2407 |
$v_buffer = fread($this->zip_fd, $v_read_size);
|
2408 |
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
|
2409 |
$v_size -= $v_read_size;
|
@@ -2426,20 +2239,17 @@
|
|
2426 |
$this->privSwapBackMagicQuotes();
|
2427 |
|
2428 |
// ----- Return
|
2429 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2430 |
return $v_result;
|
2431 |
}
|
2432 |
|
2433 |
// ----- Store the offset of the central dir
|
2434 |
$v_offset = @ftell($this->zip_fd);
|
2435 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "New offset of central dir : $v_offset");
|
2436 |
|
2437 |
// ----- Copy the block of file headers from the old archive
|
2438 |
$v_size = $v_central_dir['size'];
|
2439 |
while ($v_size != 0)
|
2440 |
{
|
2441 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
2442 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
2443 |
$v_buffer = @fread($v_zip_temp_fd, $v_read_size);
|
2444 |
@fwrite($this->zip_fd, $v_buffer, $v_read_size);
|
2445 |
$v_size -= $v_read_size;
|
@@ -2457,7 +2267,6 @@
|
|
2457 |
$this->privSwapBackMagicQuotes();
|
2458 |
|
2459 |
// ----- Return
|
2460 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2461 |
return $v_result;
|
2462 |
}
|
2463 |
$v_count++;
|
@@ -2490,7 +2299,6 @@
|
|
2490 |
$this->privSwapBackMagicQuotes();
|
2491 |
|
2492 |
// ----- Return
|
2493 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2494 |
return $v_result;
|
2495 |
}
|
2496 |
|
@@ -2518,7 +2326,6 @@
|
|
2518 |
PclZipUtilRename($v_zip_temp_name, $this->zipname);
|
2519 |
|
2520 |
// ----- Return
|
2521 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2522 |
return $v_result;
|
2523 |
}
|
2524 |
// --------------------------------------------------------------------------------
|
@@ -2530,7 +2337,6 @@
|
|
2530 |
// --------------------------------------------------------------------------------
|
2531 |
function privOpenFd($p_mode)
|
2532 |
{
|
2533 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privOpenFd", 'mode='.$p_mode);
|
2534 |
$v_result=1;
|
2535 |
|
2536 |
// ----- Look if already open
|
@@ -2540,24 +2346,20 @@
|
|
2540 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file \''.$this->zipname.'\' already open');
|
2541 |
|
2542 |
// ----- Return
|
2543 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2544 |
return PclZip::errorCode();
|
2545 |
}
|
2546 |
|
2547 |
// ----- Open the zip file
|
2548 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Open file in '.$p_mode.' mode');
|
2549 |
if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0)
|
2550 |
{
|
2551 |
// ----- Error log
|
2552 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in '.$p_mode.' mode');
|
2553 |
|
2554 |
// ----- Return
|
2555 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2556 |
return PclZip::errorCode();
|
2557 |
}
|
2558 |
|
2559 |
// ----- Return
|
2560 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2561 |
return $v_result;
|
2562 |
}
|
2563 |
// --------------------------------------------------------------------------------
|
@@ -2569,7 +2371,6 @@
|
|
2569 |
// --------------------------------------------------------------------------------
|
2570 |
function privCloseFd()
|
2571 |
{
|
2572 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCloseFd", "");
|
2573 |
$v_result=1;
|
2574 |
|
2575 |
if ($this->zip_fd != 0)
|
@@ -2577,7 +2378,6 @@
|
|
2577 |
$this->zip_fd = 0;
|
2578 |
|
2579 |
// ----- Return
|
2580 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2581 |
return $v_result;
|
2582 |
}
|
2583 |
// --------------------------------------------------------------------------------
|
@@ -2598,7 +2398,6 @@
|
|
2598 |
// function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options)
|
2599 |
function privAddList($p_filedescr_list, &$p_result_list, &$p_options)
|
2600 |
{
|
2601 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddList", "list");
|
2602 |
$v_result=1;
|
2603 |
|
2604 |
// ----- Add the files
|
@@ -2606,7 +2405,6 @@
|
|
2606 |
if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1)
|
2607 |
{
|
2608 |
// ----- Return
|
2609 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2610 |
return $v_result;
|
2611 |
}
|
2612 |
|
@@ -2620,7 +2418,6 @@
|
|
2620 |
if ($v_header_list[$i]['status'] == 'ok') {
|
2621 |
if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
|
2622 |
// ----- Return
|
2623 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2624 |
return $v_result;
|
2625 |
}
|
2626 |
$v_count++;
|
@@ -2646,12 +2443,10 @@
|
|
2646 |
unset($v_header_list);
|
2647 |
|
2648 |
// ----- Return
|
2649 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2650 |
return $v_result;
|
2651 |
}
|
2652 |
|
2653 |
// ----- Return
|
2654 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2655 |
return $v_result;
|
2656 |
}
|
2657 |
// --------------------------------------------------------------------------------
|
@@ -2667,13 +2462,11 @@
|
|
2667 |
// --------------------------------------------------------------------------------
|
2668 |
function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options)
|
2669 |
{
|
2670 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFileList", "filedescr_list");
|
2671 |
$v_result=1;
|
2672 |
$v_header = array();
|
2673 |
|
2674 |
// ----- Recuperate the current number of elt in list
|
2675 |
$v_nb = sizeof($p_result_list);
|
2676 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Before add, list have ".$v_nb." elements");
|
2677 |
|
2678 |
// ----- Loop on the files
|
2679 |
for ($j=0; ($j<sizeof($p_filedescr_list)) && ($v_result==1); $j++) {
|
@@ -2681,21 +2474,17 @@
|
|
2681 |
$p_filedescr_list[$j]['filename']
|
2682 |
= PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false);
|
2683 |
|
2684 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for file '".$p_filedescr_list[$j]['filename']."'");
|
2685 |
|
2686 |
// ----- Skip empty file names
|
2687 |
// TBC : Can this be possible ? not checked in DescrParseAtt ?
|
2688 |
if ($p_filedescr_list[$j]['filename'] == "") {
|
2689 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Skip empty filename");
|
2690 |
continue;
|
2691 |
}
|
2692 |
|
2693 |
// ----- Check the filename
|
2694 |
if ( ($p_filedescr_list[$j]['type'] != 'virtual_file')
|
2695 |
&& (!file_exists($p_filedescr_list[$j]['filename']))) {
|
2696 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$p_filedescr_list[$j]['filename']."' does not exist");
|
2697 |
PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$p_filedescr_list[$j]['filename']."' does not exist");
|
2698 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2699 |
return PclZip::errorCode();
|
2700 |
}
|
2701 |
|
@@ -2714,7 +2503,6 @@
|
|
2714 |
$v_result = $this->privAddFile($p_filedescr_list[$j], $v_header,
|
2715 |
$p_options);
|
2716 |
if ($v_result != 1) {
|
2717 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2718 |
return $v_result;
|
2719 |
}
|
2720 |
|
@@ -2722,10 +2510,8 @@
|
|
2722 |
$p_result_list[$v_nb++] = $v_header;
|
2723 |
}
|
2724 |
}
|
2725 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "After add, list have ".$v_nb." elements");
|
2726 |
|
2727 |
// ----- Return
|
2728 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2729 |
return $v_result;
|
2730 |
}
|
2731 |
// --------------------------------------------------------------------------------
|
@@ -2738,7 +2524,6 @@
|
|
2738 |
// --------------------------------------------------------------------------------
|
2739 |
function privAddFile($p_filedescr, &$p_header, &$p_options)
|
2740 |
{
|
2741 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFile", "filename='".$p_filedescr['filename']."'");
|
2742 |
$v_result=1;
|
2743 |
|
2744 |
// ----- Working variable
|
@@ -2750,7 +2535,6 @@
|
|
2750 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file list parameter (invalid or empty list)");
|
2751 |
|
2752 |
// ----- Return
|
2753 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2754 |
return PclZip::errorCode();
|
2755 |
}
|
2756 |
|
@@ -2758,11 +2542,9 @@
|
|
2758 |
/* TBC : Removed
|
2759 |
if (isset($p_filedescr['stored_filename'])) {
|
2760 |
$v_stored_filename = $p_filedescr['stored_filename'];
|
2761 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, 'Stored filename is NOT the same "'.$v_stored_filename.'"');
|
2762 |
}
|
2763 |
else {
|
2764 |
$v_stored_filename = $p_filedescr['stored_filename'];
|
2765 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, 'Stored filename is the same');
|
2766 |
}
|
2767 |
*/
|
2768 |
|
@@ -2805,16 +2587,13 @@
|
|
2805 |
$p_header['size'] = strlen($p_filedescr['content']);
|
2806 |
}
|
2807 |
|
2808 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Header external extension '".sprintf("0x%X",$p_header['external'])."'");
|
2809 |
|
2810 |
// ----- Look for filetime
|
2811 |
if (isset($p_filedescr['mtime'])) {
|
2812 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3,"Overload mtime value with :'".$p_filedescr['mtime']."'");
|
2813 |
$p_header['mtime'] = $p_filedescr['mtime'];
|
2814 |
}
|
2815 |
else if ($p_filedescr['type'] == 'virtual_file') {
|
2816 |
$p_header['mtime'] = time();
|
2817 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Virtual file : use current time '".$p_header['mtime']."' for mtime value.");
|
2818 |
}
|
2819 |
else {
|
2820 |
$p_header['mtime'] = filemtime($p_filename);
|
@@ -2832,7 +2611,6 @@
|
|
2832 |
|
2833 |
// ----- Look for pre-add callback
|
2834 |
if (isset($p_options[PCLZIP_CB_PRE_ADD])) {
|
2835 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_ADD]."()') is defined for the extraction");
|
2836 |
|
2837 |
// ----- Generate a local information
|
2838 |
$v_local_header = array();
|
@@ -2853,7 +2631,6 @@
|
|
2853 |
// Only some fields can be modified
|
2854 |
if ($p_header['stored_filename'] != $v_local_header['stored_filename']) {
|
2855 |
$p_header['stored_filename'] = PclZipUtilPathReduction($v_local_header['stored_filename']);
|
2856 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "New stored filename is '".$p_header['stored_filename']."'");
|
2857 |
}
|
2858 |
}
|
2859 |
|
@@ -2885,22 +2662,15 @@
|
|
2885 |
|
2886 |
// ----- Use "in memory" zip algo
|
2887 |
else {
|
2888 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2,"In memory compression.");
|
2889 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2,"Current memory usage : ".memory_get_usage(TRUE)." bytes");
|
2890 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2,"Current memory peak : ".memory_get_peak_usage(TRUE)." bytes");
|
2891 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a file");
|
2892 |
|
2893 |
// ----- Open the source file
|
2894 |
if (($v_file = @fopen($p_filename, "rb")) == 0) {
|
2895 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
|
2896 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2897 |
return PclZip::errorCode();
|
2898 |
}
|
2899 |
|
2900 |
// ----- Read the file content
|
2901 |
$v_content = @fread($v_file, $p_header['size']);
|
2902 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory usage after reading file : ".memory_get_usage(TRUE)." bytes");
|
2903 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory peak after reading file : ".memory_get_peak_usage(TRUE)." bytes");
|
2904 |
|
2905 |
// ----- Close the file
|
2906 |
@fclose($v_file);
|
@@ -2910,7 +2680,6 @@
|
|
2910 |
|
2911 |
// ----- Look for no compression
|
2912 |
if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
|
2913 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be compressed");
|
2914 |
// ----- Set header parameters
|
2915 |
$p_header['compressed_size'] = $p_header['size'];
|
2916 |
$p_header['compression'] = 0;
|
@@ -2918,11 +2687,8 @@
|
|
2918 |
|
2919 |
// ----- Look for normal compression
|
2920 |
else {
|
2921 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "File will be compressed");
|
2922 |
// ----- Compress the content
|
2923 |
$v_content = @gzdeflate($v_content);
|
2924 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory usage after gzdeflate : ".memory_get_usage(TRUE)." bytes");
|
2925 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory peak after gzdeflate : ".memory_get_peak_usage(TRUE)." bytes");
|
2926 |
|
2927 |
// ----- Set header parameters
|
2928 |
$p_header['compressed_size'] = strlen($v_content);
|
@@ -2932,7 +2698,6 @@
|
|
2932 |
// ----- Call the header generation
|
2933 |
if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
|
2934 |
@fclose($v_file);
|
2935 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2936 |
return $v_result;
|
2937 |
}
|
2938 |
|
@@ -2946,7 +2711,6 @@
|
|
2946 |
// ----- Look for a virtual file (a file from string)
|
2947 |
else if ($p_filedescr['type'] == 'virtual_file') {
|
2948 |
|
2949 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Add by string");
|
2950 |
$v_content = $p_filedescr['content'];
|
2951 |
|
2952 |
// ----- Calculate the CRC
|
@@ -2954,7 +2718,6 @@
|
|
2954 |
|
2955 |
// ----- Look for no compression
|
2956 |
if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
|
2957 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be compressed");
|
2958 |
// ----- Set header parameters
|
2959 |
$p_header['compressed_size'] = $p_header['size'];
|
2960 |
$p_header['compression'] = 0;
|
@@ -2962,7 +2725,6 @@
|
|
2962 |
|
2963 |
// ----- Look for normal compression
|
2964 |
else {
|
2965 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "File will be compressed");
|
2966 |
// ----- Compress the content
|
2967 |
$v_content = @gzdeflate($v_content);
|
2968 |
|
@@ -2974,7 +2736,6 @@
|
|
2974 |
// ----- Call the header generation
|
2975 |
if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
|
2976 |
@fclose($v_file);
|
2977 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2978 |
return $v_result;
|
2979 |
}
|
2980 |
|
@@ -2984,7 +2745,6 @@
|
|
2984 |
|
2985 |
// ----- Look for a directory
|
2986 |
else if ($p_filedescr['type'] == 'folder') {
|
2987 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a folder");
|
2988 |
// ----- Look for directory last '/'
|
2989 |
if (@substr($p_header['stored_filename'], -1) != '/') {
|
2990 |
$p_header['stored_filename'] .= '/';
|
@@ -2998,7 +2758,6 @@
|
|
2998 |
// ----- Call the header generation
|
2999 |
if (($v_result = $this->privWriteFileHeader($p_header)) != 1)
|
3000 |
{
|
3001 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3002 |
return $v_result;
|
3003 |
}
|
3004 |
}
|
@@ -3006,7 +2765,6 @@
|
|
3006 |
|
3007 |
// ----- Look for post-add callback
|
3008 |
if (isset($p_options[PCLZIP_CB_POST_ADD])) {
|
3009 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_ADD]."()') is defined for the extraction");
|
3010 |
|
3011 |
// ----- Generate a local information
|
3012 |
$v_local_header = array();
|
@@ -3027,7 +2785,6 @@
|
|
3027 |
}
|
3028 |
|
3029 |
// ----- Return
|
3030 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3031 |
return $v_result;
|
3032 |
}
|
3033 |
// --------------------------------------------------------------------------------
|
@@ -3040,18 +2797,15 @@
|
|
3040 |
// --------------------------------------------------------------------------------
|
3041 |
function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options)
|
3042 |
{
|
3043 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFileUsingTempFile", "filename='".$p_filedescr['filename']."'");
|
3044 |
$v_result=PCLZIP_ERR_NO_ERROR;
|
3045 |
|
3046 |
// ----- Working variable
|
3047 |
$p_filename = $p_filedescr['filename'];
|
3048 |
|
3049 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a file");
|
3050 |
|
3051 |
// ----- Open the source file
|
3052 |
if (($v_file = @fopen($p_filename, "rb")) == 0) {
|
3053 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
|
3054 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3055 |
return PclZip::errorCode();
|
3056 |
}
|
3057 |
|
@@ -3060,7 +2814,6 @@
|
|
3060 |
if (($v_file_compressed = @gzopen($v_gzip_temp_name, "wb")) == 0) {
|
3061 |
fclose($v_file);
|
3062 |
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode');
|
3063 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3064 |
return PclZip::errorCode();
|
3065 |
}
|
3066 |
|
@@ -3068,7 +2821,6 @@
|
|
3068 |
$v_size = filesize($p_filename);
|
3069 |
while ($v_size != 0) {
|
3070 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
3071 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Read ".$v_read_size." bytes");
|
3072 |
$v_buffer = @fread($v_file, $v_read_size);
|
3073 |
//$v_binary_data = pack('a'.$v_read_size, $v_buffer);
|
3074 |
@gzputs($v_file_compressed, $v_buffer, $v_read_size);
|
@@ -3080,17 +2832,14 @@
|
|
3080 |
@gzclose($v_file_compressed);
|
3081 |
|
3082 |
// ----- Check the minimum file size
|
3083 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "gzip file size ".filesize($v_gzip_temp_name));
|
3084 |
if (filesize($v_gzip_temp_name) < 18) {
|
3085 |
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'gzip temporary file \''.$v_gzip_temp_name.'\' has invalid filesize - should be minimum 18 bytes');
|
3086 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3087 |
return PclZip::errorCode();
|
3088 |
}
|
3089 |
|
3090 |
// ----- Extract the compressed attributes
|
3091 |
if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) {
|
3092 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
|
3093 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3094 |
return PclZip::errorCode();
|
3095 |
}
|
3096 |
|
@@ -3099,28 +2848,17 @@
|
|
3099 |
$v_data_header = unpack('a1id1/a1id2/a1cm/a1flag/Vmtime/a1xfl/a1os', $v_binary_data);
|
3100 |
|
3101 |
// ----- Check some parameters
|
3102 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, '$v_data_header[id1]='.bin2hex($v_data_header['id1']));
|
3103 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, '$v_data_header[id2]='.bin2hex($v_data_header['id2']));
|
3104 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, '$v_data_header[cm]='.bin2hex($v_data_header['cm']));
|
3105 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, '$v_data_header[flag]='.bin2hex($v_data_header['flag']));
|
3106 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, '$v_data_header[mtime]='.$v_data_header['mtime']);
|
3107 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, '$v_data_header[xfl]='.bin2hex($v_data_header['xfl']));
|
3108 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, '$v_data_header[os]='.bin2hex($v_data_header['os']));
|
3109 |
$v_data_header['os'] = bin2hex($v_data_header['os']);
|
3110 |
|
3111 |
// ----- Read the gzip file footer
|
3112 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "File position after header ".ftell($v_file_compressed));
|
3113 |
@fseek($v_file_compressed, filesize($v_gzip_temp_name)-8);
|
3114 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "File position at beginning of footer ".ftell($v_file_compressed));
|
3115 |
$v_binary_data = @fread($v_file_compressed, 8);
|
3116 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "File position after footer ".ftell($v_file_compressed));
|
3117 |
$v_data_footer = unpack('Vcrc/Vcompressed_size', $v_binary_data);
|
3118 |
|
3119 |
// ----- Set the attributes
|
3120 |
$p_header['compression'] = ord($v_data_header['cm']);
|
3121 |
//$p_header['mtime'] = $v_data_header['mtime'];
|
3122 |
$p_header['crc'] = $v_data_footer['crc'];
|
3123 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Compressed size ".(filesize($v_gzip_temp_name)-18));
|
3124 |
$p_header['compressed_size'] = filesize($v_gzip_temp_name)-18;
|
3125 |
|
3126 |
// ----- Close the file
|
@@ -3128,7 +2866,6 @@
|
|
3128 |
|
3129 |
// ----- Call the header generation
|
3130 |
if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
|
3131 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3132 |
return $v_result;
|
3133 |
}
|
3134 |
|
@@ -3136,19 +2873,15 @@
|
|
3136 |
if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0)
|
3137 |
{
|
3138 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
|
3139 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3140 |
return PclZip::errorCode();
|
3141 |
}
|
3142 |
|
3143 |
// ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
|
3144 |
fseek($v_file_compressed, 10);
|
3145 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "File position before reading compressed data ".ftell($v_file_compressed));
|
3146 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, ' '.$p_header['compressed_size'].' bytes to read');
|
3147 |
$v_size = $p_header['compressed_size'];
|
3148 |
while ($v_size != 0)
|
3149 |
{
|
3150 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
3151 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Read ".$v_read_size." bytes");
|
3152 |
$v_buffer = @fread($v_file_compressed, $v_read_size);
|
3153 |
//$v_binary_data = pack('a'.$v_read_size, $v_buffer);
|
3154 |
@fwrite($this->zip_fd, $v_buffer, $v_read_size);
|
@@ -3162,7 +2895,6 @@
|
|
3162 |
@unlink($v_gzip_temp_name);
|
3163 |
|
3164 |
// ----- Return
|
3165 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3166 |
return $v_result;
|
3167 |
}
|
3168 |
// --------------------------------------------------------------------------------
|
@@ -3177,7 +2909,6 @@
|
|
3177 |
// --------------------------------------------------------------------------------
|
3178 |
function privCalculateStoredFilename(&$p_filedescr, &$p_options)
|
3179 |
{
|
3180 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCalculateStoredFilename", "filename='".$p_filedescr['filename']."'");
|
3181 |
$v_result=1;
|
3182 |
|
3183 |
// ----- Working variables
|
@@ -3194,7 +2925,6 @@
|
|
3194 |
else {
|
3195 |
$p_remove_dir = '';
|
3196 |
}
|
3197 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Remove path ='".$p_remove_dir."'");
|
3198 |
if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
|
3199 |
$p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH];
|
3200 |
}
|
@@ -3207,7 +2937,6 @@
|
|
3207 |
if (isset($p_filedescr['new_full_name'])) {
|
3208 |
// ----- Remove drive letter if any
|
3209 |
$v_stored_filename = PclZipUtilTranslateWinPath($p_filedescr['new_full_name']);
|
3210 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing full name of '".$p_filename."' for '".$v_stored_filename."'");
|
3211 |
}
|
3212 |
|
3213 |
// ----- Look for path and/or short name change
|
@@ -3222,7 +2951,6 @@
|
|
3222 |
$v_dir = $v_path_info['dirname'].'/';
|
3223 |
}
|
3224 |
$v_stored_filename = $v_dir.$p_filedescr['new_short_name'];
|
3225 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing short name of '".$p_filename."' for '".$v_stored_filename."'");
|
3226 |
}
|
3227 |
else {
|
3228 |
// ----- Calculate the stored filename
|
@@ -3232,11 +2960,9 @@
|
|
3232 |
// ----- Look for all path to remove
|
3233 |
if ($p_remove_all_dir) {
|
3234 |
$v_stored_filename = basename($p_filename);
|
3235 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Remove all path selected change '".$p_filename."' for '".$v_stored_filename."'");
|
3236 |
}
|
3237 |
// ----- Look for partial path remove
|
3238 |
else if ($p_remove_dir != "") {
|
3239 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Partial path to remove");
|
3240 |
if (substr($p_remove_dir, -1) != '/')
|
3241 |
$p_remove_dir .= "/";
|
3242 |
|
@@ -3258,13 +2984,10 @@
|
|
3258 |
if ($v_compare > 0) {
|
3259 |
if ($v_compare == 2) {
|
3260 |
$v_stored_filename = "";
|
3261 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Path to remove is the current folder");
|
3262 |
}
|
3263 |
else {
|
3264 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Remove path '$p_remove_dir' in file '$v_stored_filename'");
|
3265 |
$v_stored_filename = substr($v_stored_filename,
|
3266 |
strlen($p_remove_dir));
|
3267 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Result is '$v_stored_filename'");
|
3268 |
}
|
3269 |
}
|
3270 |
}
|
@@ -3278,17 +3001,14 @@
|
|
3278 |
$v_stored_filename = $p_add_dir.$v_stored_filename;
|
3279 |
else
|
3280 |
$v_stored_filename = $p_add_dir."/".$v_stored_filename;
|
3281 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Add path '$p_add_dir' in file '$p_filename' = '$v_stored_filename'");
|
3282 |
}
|
3283 |
}
|
3284 |
|
3285 |
// ----- Filename (reduce the path of stored name)
|
3286 |
$v_stored_filename = PclZipUtilPathReduction($v_stored_filename);
|
3287 |
$p_filedescr['stored_filename'] = $v_stored_filename;
|
3288 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Stored filename will be '".$p_filedescr['stored_filename']."', strlen ".strlen($p_filedescr['stored_filename']));
|
3289 |
|
3290 |
// ----- Return
|
3291 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3292 |
return $v_result;
|
3293 |
}
|
3294 |
// --------------------------------------------------------------------------------
|
@@ -3301,15 +3021,12 @@
|
|
3301 |
// --------------------------------------------------------------------------------
|
3302 |
function privWriteFileHeader(&$p_header)
|
3303 |
{
|
3304 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteFileHeader", 'file="'.$p_header['filename'].'", stored as "'.$p_header['stored_filename'].'"');
|
3305 |
$v_result=1;
|
3306 |
|
3307 |
// ----- Store the offset position of the file
|
3308 |
$p_header['offset'] = ftell($this->zip_fd);
|
3309 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, 'File offset of the header :'.$p_header['offset']);
|
3310 |
|
3311 |
// ----- Transform UNIX mtime to DOS format mdate/mtime
|
3312 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
|
3313 |
$v_date = getdate($p_header['mtime']);
|
3314 |
$v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
|
3315 |
$v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
|
@@ -3337,7 +3054,6 @@
|
|
3337 |
}
|
3338 |
|
3339 |
// ----- Return
|
3340 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3341 |
return $v_result;
|
3342 |
}
|
3343 |
// --------------------------------------------------------------------------------
|
@@ -3350,21 +3066,17 @@
|
|
3350 |
// --------------------------------------------------------------------------------
|
3351 |
function privWriteCentralFileHeader(&$p_header)
|
3352 |
{
|
3353 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteCentralFileHeader", 'file="'.$p_header['filename'].'", stored as "'.$p_header['stored_filename'].'"');
|
3354 |
$v_result=1;
|
3355 |
|
3356 |
// TBC
|
3357 |
//for(reset($p_header); $key = key($p_header); next($p_header)) {
|
3358 |
-
// PclTraceFctMessage(__FILE__, __LINE__, 3, "header[$key] = ".$p_header[$key]);
|
3359 |
//}
|
3360 |
|
3361 |
// ----- Transform UNIX mtime to DOS format mdate/mtime
|
3362 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
|
3363 |
$v_date = getdate($p_header['mtime']);
|
3364 |
$v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
|
3365 |
$v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
|
3366 |
|
3367 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Comment size : \''.$p_header['comment_len'].'\'');
|
3368 |
|
3369 |
// ----- Packed data
|
3370 |
$v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50,
|
@@ -3395,7 +3107,6 @@
|
|
3395 |
}
|
3396 |
|
3397 |
// ----- Return
|
3398 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3399 |
return $v_result;
|
3400 |
}
|
3401 |
// --------------------------------------------------------------------------------
|
@@ -3408,7 +3119,6 @@
|
|
3408 |
// --------------------------------------------------------------------------------
|
3409 |
function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment)
|
3410 |
{
|
3411 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteCentralHeader", 'nb_entries='.$p_nb_entries.', size='.$p_size.', offset='.$p_offset.', comment="'.$p_comment.'"');
|
3412 |
$v_result=1;
|
3413 |
|
3414 |
// ----- Packed data
|
@@ -3426,7 +3136,6 @@
|
|
3426 |
}
|
3427 |
|
3428 |
// ----- Return
|
3429 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3430 |
return $v_result;
|
3431 |
}
|
3432 |
// --------------------------------------------------------------------------------
|
@@ -3439,14 +3148,12 @@
|
|
3439 |
// --------------------------------------------------------------------------------
|
3440 |
function privList(&$p_list)
|
3441 |
{
|
3442 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privList", "list");
|
3443 |
$v_result=1;
|
3444 |
|
3445 |
// ----- Magic quotes trick
|
3446 |
$this->privDisableMagicQuotes();
|
3447 |
|
3448 |
// ----- Open the zip file
|
3449 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
3450 |
if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
|
3451 |
{
|
3452 |
// ----- Magic quotes trick
|
@@ -3456,7 +3163,6 @@
|
|
3456 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
|
3457 |
|
3458 |
// ----- Return
|
3459 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3460 |
return PclZip::errorCode();
|
3461 |
}
|
3462 |
|
@@ -3465,15 +3171,11 @@
|
|
3465 |
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
|
3466 |
{
|
3467 |
$this->privSwapBackMagicQuotes();
|
3468 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3469 |
return $v_result;
|
3470 |
}
|
3471 |
|
3472 |
// ----- Go to beginning of Central Dir
|
3473 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Offset : ".$v_central_dir['offset']."'");
|
3474 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");
|
3475 |
@rewind($this->zip_fd);
|
3476 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");
|
3477 |
if (@fseek($this->zip_fd, $v_central_dir['offset']))
|
3478 |
{
|
3479 |
$this->privSwapBackMagicQuotes();
|
@@ -3482,10 +3184,8 @@
|
|
3482 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
|
3483 |
|
3484 |
// ----- Return
|
3485 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3486 |
return PclZip::errorCode();
|
3487 |
}
|
3488 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");
|
3489 |
|
3490 |
// ----- Read each entry
|
3491 |
for ($i=0; $i<$v_central_dir['entries']; $i++)
|
@@ -3494,7 +3194,6 @@
|
|
3494 |
if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)
|
3495 |
{
|
3496 |
$this->privSwapBackMagicQuotes();
|
3497 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3498 |
return $v_result;
|
3499 |
}
|
3500 |
$v_header['index'] = $i;
|
@@ -3511,7 +3210,6 @@
|
|
3511 |
$this->privSwapBackMagicQuotes();
|
3512 |
|
3513 |
// ----- Return
|
3514 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3515 |
return $v_result;
|
3516 |
}
|
3517 |
// --------------------------------------------------------------------------------
|
@@ -3537,7 +3235,6 @@
|
|
3537 |
// --------------------------------------------------------------------------------
|
3538 |
function privConvertHeader2FileInfo($p_header, &$p_info)
|
3539 |
{
|
3540 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privConvertHeader2FileInfo", "Filename='".$p_header['filename']."'");
|
3541 |
$v_result=1;
|
3542 |
|
3543 |
// ----- Get the interesting attributes
|
@@ -3555,7 +3252,6 @@
|
|
3555 |
$p_info['crc'] = $p_header['crc'];
|
3556 |
|
3557 |
// ----- Return
|
3558 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3559 |
return $v_result;
|
3560 |
}
|
3561 |
// --------------------------------------------------------------------------------
|
@@ -3578,7 +3274,6 @@
|
|
3578 |
// --------------------------------------------------------------------------------
|
3579 |
function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
|
3580 |
{
|
3581 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privExtractByRule", "path='$p_path', remove_path='$p_remove_path', remove_all_path='".($p_remove_all_path?'true':'false')."'");
|
3582 |
$v_result=1;
|
3583 |
|
3584 |
// ----- Magic quotes trick
|
@@ -3597,9 +3292,7 @@
|
|
3597 |
// ----- Look for the path end '/'
|
3598 |
while (substr($p_path, -1) == "/")
|
3599 |
{
|
3600 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Destination path [$p_path] ends by '/'");
|
3601 |
$p_path = substr($p_path, 0, strlen($p_path)-1);
|
3602 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Modified to [$p_path]");
|
3603 |
}
|
3604 |
}
|
3605 |
|
@@ -3611,11 +3304,9 @@
|
|
3611 |
$p_remove_path_size = strlen($p_remove_path);
|
3612 |
|
3613 |
// ----- Open the zip file
|
3614 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
3615 |
if (($v_result = $this->privOpenFd('rb')) != 1)
|
3616 |
{
|
3617 |
$this->privSwapBackMagicQuotes();
|
3618 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3619 |
return $v_result;
|
3620 |
}
|
3621 |
|
@@ -3627,7 +3318,6 @@
|
|
3627 |
$this->privCloseFd();
|
3628 |
$this->privSwapBackMagicQuotes();
|
3629 |
|
3630 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3631 |
return $v_result;
|
3632 |
}
|
3633 |
|
@@ -3638,12 +3328,9 @@
|
|
3638 |
$j_start = 0;
|
3639 |
for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
|
3640 |
{
|
3641 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Read next file header entry : '$i'");
|
3642 |
|
3643 |
// ----- Read next Central dir entry
|
3644 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Position before rewind : ".ftell($this->zip_fd)."'");
|
3645 |
@rewind($this->zip_fd);
|
3646 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Position after rewind : ".ftell($this->zip_fd)."'");
|
3647 |
if (@fseek($this->zip_fd, $v_pos_entry))
|
3648 |
{
|
3649 |
// ----- Close the zip file
|
@@ -3654,10 +3341,8 @@
|
|
3654 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
|
3655 |
|
3656 |
// ----- Return
|
3657 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3658 |
return PclZip::errorCode();
|
3659 |
}
|
3660 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Position after fseek : ".ftell($this->zip_fd)."'");
|
3661 |
|
3662 |
// ----- Read the file header
|
3663 |
$v_header = array();
|
@@ -3667,7 +3352,6 @@
|
|
3667 |
$this->privCloseFd();
|
3668 |
$this->privSwapBackMagicQuotes();
|
3669 |
|
3670 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3671 |
return $v_result;
|
3672 |
}
|
3673 |
|
@@ -3683,26 +3367,21 @@
|
|
3683 |
// ----- Look for extract by name rule
|
3684 |
if ( (isset($p_options[PCLZIP_OPT_BY_NAME]))
|
3685 |
&& ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
|
3686 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByName'");
|
3687 |
|
3688 |
// ----- Look if the filename is in the list
|
3689 |
for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); $j++) {
|
3690 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Compare with file '".$p_options[PCLZIP_OPT_BY_NAME][$j]."'");
|
3691 |
|
3692 |
// ----- Look for a directory
|
3693 |
if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
|
3694 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "The searched item is a directory");
|
3695 |
|
3696 |
// ----- Look if the directory is in the filename path
|
3697 |
if ( (strlen($v_header['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
|
3698 |
&& (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
|
3699 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "The directory is in the file path");
|
3700 |
$v_extract = true;
|
3701 |
}
|
3702 |
}
|
3703 |
// ----- Look for a filename
|
3704 |
elseif ($v_header['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
|
3705 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "The file is the right one.");
|
3706 |
$v_extract = true;
|
3707 |
}
|
3708 |
}
|
@@ -3713,10 +3392,8 @@
|
|
3713 |
/*
|
3714 |
else if ( (isset($p_options[PCLZIP_OPT_BY_EREG]))
|
3715 |
&& ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
|
3716 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract by ereg '".$p_options[PCLZIP_OPT_BY_EREG]."'");
|
3717 |
|
3718 |
if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header['stored_filename'])) {
|
3719 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
|
3720 |
$v_extract = true;
|
3721 |
}
|
3722 |
}
|
@@ -3725,10 +3402,8 @@
|
|
3725 |
// ----- Look for extract by preg rule
|
3726 |
else if ( (isset($p_options[PCLZIP_OPT_BY_PREG]))
|
3727 |
&& ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
|
3728 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByEreg'");
|
3729 |
|
3730 |
if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) {
|
3731 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
|
3732 |
$v_extract = true;
|
3733 |
}
|
3734 |
}
|
@@ -3736,23 +3411,18 @@
|
|
3736 |
// ----- Look for extract by index rule
|
3737 |
else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX]))
|
3738 |
&& ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
|
3739 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");
|
3740 |
|
3741 |
// ----- Look if the index is in the list
|
3742 |
for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) {
|
3743 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Look if index '$i' is in [".$p_options[PCLZIP_OPT_BY_INDEX][$j]['start'].",".$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']."]");
|
3744 |
|
3745 |
if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
|
3746 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Found as part of an index range");
|
3747 |
$v_extract = true;
|
3748 |
}
|
3749 |
if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
|
3750 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Do not look this index range for next loop");
|
3751 |
$j_start = $j+1;
|
3752 |
}
|
3753 |
|
3754 |
if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
|
3755 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Index range is greater than index, stop loop");
|
3756 |
break;
|
3757 |
}
|
3758 |
}
|
@@ -3760,7 +3430,6 @@
|
|
3760 |
|
3761 |
// ----- Look for no rule, which means extract all the archive
|
3762 |
else {
|
3763 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with no rule (extract all)");
|
3764 |
$v_extract = true;
|
3765 |
}
|
3766 |
|
@@ -3768,13 +3437,11 @@
|
|
3768 |
if ( ($v_extract)
|
3769 |
&& ( ($v_header['compression'] != 8)
|
3770 |
&& ($v_header['compression'] != 0))) {
|
3771 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported compression method (".$v_header['compression'].")");
|
3772 |
$v_header['status'] = 'unsupported_compression';
|
3773 |
|
3774 |
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
3775 |
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
3776 |
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
3777 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
|
3778 |
|
3779 |
$this->privSwapBackMagicQuotes();
|
3780 |
|
@@ -3783,20 +3450,17 @@
|
|
3783 |
."compressed by an unsupported compression "
|
3784 |
."method (".$v_header['compression'].") ");
|
3785 |
|
3786 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3787 |
return PclZip::errorCode();
|
3788 |
}
|
3789 |
}
|
3790 |
|
3791 |
// ----- Check encrypted files
|
3792 |
if (($v_extract) && (($v_header['flag'] & 1) == 1)) {
|
3793 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported file encryption");
|
3794 |
$v_header['status'] = 'unsupported_encryption';
|
3795 |
|
3796 |
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
3797 |
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
3798 |
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
3799 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
|
3800 |
|
3801 |
$this->privSwapBackMagicQuotes();
|
3802 |
|
@@ -3805,20 +3469,17 @@
|
|
3805 |
." filename '".$v_header['stored_filename']
|
3806 |
."'");
|
3807 |
|
3808 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3809 |
return PclZip::errorCode();
|
3810 |
}
|
3811 |
}
|
3812 |
|
3813 |
// ----- Look for real extraction
|
3814 |
if (($v_extract) && ($v_header['status'] != 'ok')) {
|
3815 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "No need for extract");
|
3816 |
$v_result = $this->privConvertHeader2FileInfo($v_header,
|
3817 |
$p_file_list[$v_nb_extracted++]);
|
3818 |
if ($v_result != 1) {
|
3819 |
$this->privCloseFd();
|
3820 |
$this->privSwapBackMagicQuotes();
|
3821 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3822 |
return $v_result;
|
3823 |
}
|
3824 |
|
@@ -3828,12 +3489,9 @@
|
|
3828 |
// ----- Look for real extraction
|
3829 |
if ($v_extract)
|
3830 |
{
|
3831 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file '".$v_header['filename']."', index '$i'");
|
3832 |
|
3833 |
// ----- Go to the file position
|
3834 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
|
3835 |
@rewind($this->zip_fd);
|
3836 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
|
3837 |
if (@fseek($this->zip_fd, $v_header['offset']))
|
3838 |
{
|
3839 |
// ----- Close the zip file
|
@@ -3845,10 +3503,8 @@
|
|
3845 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
|
3846 |
|
3847 |
// ----- Return
|
3848 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3849 |
return PclZip::errorCode();
|
3850 |
}
|
3851 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");
|
3852 |
|
3853 |
// ----- Look for extraction as string
|
3854 |
if ($p_options[PCLZIP_OPT_EXTRACT_AS_STRING]) {
|
@@ -3860,7 +3516,6 @@
|
|
3860 |
if ($v_result1 < 1) {
|
3861 |
$this->privCloseFd();
|
3862 |
$this->privSwapBackMagicQuotes();
|
3863 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result1);
|
3864 |
return $v_result1;
|
3865 |
}
|
3866 |
|
@@ -3871,7 +3526,6 @@
|
|
3871 |
$this->privCloseFd();
|
3872 |
$this->privSwapBackMagicQuotes();
|
3873 |
|
3874 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3875 |
return $v_result;
|
3876 |
}
|
3877 |
|
@@ -3894,7 +3548,6 @@
|
|
3894 |
if ($v_result1 < 1) {
|
3895 |
$this->privCloseFd();
|
3896 |
$this->privSwapBackMagicQuotes();
|
3897 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result1);
|
3898 |
return $v_result1;
|
3899 |
}
|
3900 |
|
@@ -3902,7 +3555,6 @@
|
|
3902 |
if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) {
|
3903 |
$this->privCloseFd();
|
3904 |
$this->privSwapBackMagicQuotes();
|
3905 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3906 |
return $v_result;
|
3907 |
}
|
3908 |
|
@@ -3921,7 +3573,6 @@
|
|
3921 |
if ($v_result1 < 1) {
|
3922 |
$this->privCloseFd();
|
3923 |
$this->privSwapBackMagicQuotes();
|
3924 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result1);
|
3925 |
return $v_result1;
|
3926 |
}
|
3927 |
|
@@ -3932,7 +3583,6 @@
|
|
3932 |
$this->privCloseFd();
|
3933 |
$this->privSwapBackMagicQuotes();
|
3934 |
|
3935 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3936 |
return $v_result;
|
3937 |
}
|
3938 |
|
@@ -3949,7 +3599,6 @@
|
|
3949 |
$this->privSwapBackMagicQuotes();
|
3950 |
|
3951 |
// ----- Return
|
3952 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3953 |
return $v_result;
|
3954 |
}
|
3955 |
// --------------------------------------------------------------------------------
|
@@ -3965,18 +3614,15 @@
|
|
3965 |
// --------------------------------------------------------------------------------
|
3966 |
function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
|
3967 |
{
|
3968 |
-
PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFile', "path='$p_path', remove_path='$p_remove_path', remove_all_path='".($p_remove_all_path?'true':'false')."'");
|
3969 |
$v_result=1;
|
3970 |
|
3971 |
// ----- Read the file header
|
3972 |
if (($v_result = $this->privReadFileHeader($v_header)) != 1)
|
3973 |
{
|
3974 |
// ----- Return
|
3975 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3976 |
return $v_result;
|
3977 |
}
|
3978 |
|
3979 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");
|
3980 |
|
3981 |
// ----- Check that the file header is coherent with $p_entry info
|
3982 |
if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
|
@@ -3987,15 +3633,12 @@
|
|
3987 |
if ($p_remove_all_path == true) {
|
3988 |
// ----- Look for folder entry that not need to be extracted
|
3989 |
if (($p_entry['external']&0x00000010)==0x00000010) {
|
3990 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "The entry is a folder : need to be filtered");
|
3991 |
|
3992 |
$p_entry['status'] = "filtered";
|
3993 |
|
3994 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3995 |
return $v_result;
|
3996 |
}
|
3997 |
|
3998 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "All path is removed");
|
3999 |
// ----- Get the basename of the path
|
4000 |
$p_entry['filename'] = basename($p_entry['filename']);
|
4001 |
}
|
@@ -4003,28 +3646,23 @@
|
|
4003 |
// ----- Look for path to remove
|
4004 |
else if ($p_remove_path != "")
|
4005 |
{
|
4006 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Look for some path to remove");
|
4007 |
if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2)
|
4008 |
{
|
4009 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "The folder is the same as the removed path '".$p_entry['filename']."'");
|
4010 |
|
4011 |
// ----- Change the file status
|
4012 |
$p_entry['status'] = "filtered";
|
4013 |
|
4014 |
// ----- Return
|
4015 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4016 |
return $v_result;
|
4017 |
}
|
4018 |
|
4019 |
$p_remove_path_size = strlen($p_remove_path);
|
4020 |
if (substr($p_entry['filename'], 0, $p_remove_path_size) == $p_remove_path)
|
4021 |
{
|
4022 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Found path '$p_remove_path' to remove in file '".$p_entry['filename']."'");
|
4023 |
|
4024 |
// ----- Remove the path
|
4025 |
$p_entry['filename'] = substr($p_entry['filename'], $p_remove_path_size);
|
4026 |
|
4027 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Resulting file is '".$p_entry['filename']."'");
|
4028 |
}
|
4029 |
}
|
4030 |
|
@@ -4035,25 +3673,21 @@
|
|
4035 |
|
4036 |
// ----- Check a base_dir_restriction
|
4037 |
if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) {
|
4038 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Check the extract directory restriction");
|
4039 |
$v_inclusion
|
4040 |
= PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION],
|
4041 |
$p_entry['filename']);
|
4042 |
if ($v_inclusion == 0) {
|
4043 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_EXTRACT_DIR_RESTRICTION is selected, file is outside restriction");
|
4044 |
|
4045 |
PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION,
|
4046 |
"Filename '".$p_entry['filename']."' is "
|
4047 |
."outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION");
|
4048 |
|
4049 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4050 |
return PclZip::errorCode();
|
4051 |
}
|
4052 |
}
|
4053 |
|
4054 |
// ----- Look for pre-extract callback
|
4055 |
if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
|
4056 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_EXTRACT]."()') is defined for the extraction");
|
4057 |
|
4058 |
// ----- Generate a local information
|
4059 |
$v_local_header = array();
|
@@ -4072,7 +3706,6 @@
|
|
4072 |
|
4073 |
// ----- Look for abort result
|
4074 |
if ($v_result == 2) {
|
4075 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
|
4076 |
// ----- This status is internal and will be changed in 'skipped'
|
4077 |
$p_entry['status'] = "aborted";
|
4078 |
$v_result = PCLZIP_ERR_USER_ABORTED;
|
@@ -4081,10 +3714,8 @@
|
|
4081 |
// ----- Update the informations
|
4082 |
// Only some fields can be modified
|
4083 |
$p_entry['filename'] = $v_local_header['filename'];
|
4084 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "New filename is '".$p_entry['filename']."'");
|
4085 |
}
|
4086 |
|
4087 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) '".$p_entry['filename']."', size '$v_header[size]'");
|
4088 |
|
4089 |
// ----- Look if extraction should be done
|
4090 |
if ($p_entry['status'] == 'ok') {
|
@@ -4092,12 +3723,10 @@
|
|
4092 |
// ----- Look for specific actions while the file exist
|
4093 |
if (file_exists($p_entry['filename']))
|
4094 |
{
|
4095 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$p_entry['filename']."' already exists");
|
4096 |
|
4097 |
// ----- Look if file is a directory
|
4098 |
if (is_dir($p_entry['filename']))
|
4099 |
{
|
4100 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is a directory");
|
4101 |
|
4102 |
// ----- Change the file status
|
4103 |
$p_entry['status'] = "already_a_directory";
|
@@ -4107,20 +3736,17 @@
|
|
4107 |
// when this kind of error occurs.
|
4108 |
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
4109 |
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
4110 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
|
4111 |
|
4112 |
PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY,
|
4113 |
"Filename '".$p_entry['filename']."' is "
|
4114 |
."already used by an existing directory");
|
4115 |
|
4116 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4117 |
return PclZip::errorCode();
|
4118 |
}
|
4119 |
}
|
4120 |
// ----- Look if file is write protected
|
4121 |
else if (!is_writeable($p_entry['filename']))
|
4122 |
{
|
4123 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is write protected");
|
4124 |
|
4125 |
// ----- Change the file status
|
4126 |
$p_entry['status'] = "write_protected";
|
@@ -4130,13 +3756,11 @@
|
|
4130 |
// when this kind of error occurs.
|
4131 |
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
4132 |
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
4133 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
|
4134 |
|
4135 |
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
|
4136 |
"Filename '".$p_entry['filename']."' exists "
|
4137 |
."and is write protected");
|
4138 |
|
4139 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4140 |
return PclZip::errorCode();
|
4141 |
}
|
4142 |
}
|
@@ -4144,14 +3768,11 @@
|
|
4144 |
// ----- Look if the extracted file is older
|
4145 |
else if (filemtime($p_entry['filename']) > $p_entry['mtime'])
|
4146 |
{
|
4147 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is newer (".date("l dS of F Y h:i:s A", filemtime($p_entry['filename'])).") than the extracted file (".date("l dS of F Y h:i:s A", $p_entry['mtime']).")");
|
4148 |
// ----- Change the file status
|
4149 |
if ( (isset($p_options[PCLZIP_OPT_REPLACE_NEWER]))
|
4150 |
&& ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) {
|
4151 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_REPLACE_NEWER is selected, file will be replaced");
|
4152 |
}
|
4153 |
else {
|
4154 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be replaced");
|
4155 |
$p_entry['status'] = "newer_exist";
|
4156 |
|
4157 |
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
@@ -4159,19 +3780,16 @@
|
|
4159 |
// when this kind of error occurs.
|
4160 |
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
4161 |
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
4162 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
|
4163 |
|
4164 |
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
|
4165 |
"Newer version of '".$p_entry['filename']."' exists "
|
4166 |
."and option PCLZIP_OPT_REPLACE_NEWER is not selected");
|
4167 |
|
4168 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4169 |
return PclZip::errorCode();
|
4170 |
}
|
4171 |
}
|
4172 |
}
|
4173 |
else {
|
4174 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is older than the extrated one - will be replaced by the extracted one (".date("l dS of F Y h:i:s A", filemtime($p_entry['filename'])).") than the extracted file (".date("l dS of F Y h:i:s A", $p_entry['mtime']).")");
|
4175 |
}
|
4176 |
}
|
4177 |
|
@@ -4185,13 +3803,11 @@
|
|
4185 |
$v_dir_to_check = dirname($p_entry['filename']);
|
4186 |
|
4187 |
if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
|
4188 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to create path for '".$p_entry['filename']."'");
|
4189 |
|
4190 |
// ----- Change the file status
|
4191 |
$p_entry['status'] = "path_creation_fail";
|
4192 |
|
4193 |
// ----- Return
|
4194 |
-
//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4195 |
//return $v_result;
|
4196 |
$v_result = 1;
|
4197 |
}
|
@@ -4206,29 +3822,24 @@
|
|
4206 |
{
|
4207 |
// ----- Look for not compressed file
|
4208 |
if ($p_entry['compression'] == 0) {
|
4209 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
|
4210 |
|
4211 |
// ----- Opening destination file
|
4212 |
if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0)
|
4213 |
{
|
4214 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");
|
4215 |
|
4216 |
// ----- Change the file status
|
4217 |
$p_entry['status'] = "write_error";
|
4218 |
|
4219 |
// ----- Return
|
4220 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4221 |
return $v_result;
|
4222 |
}
|
4223 |
|
4224 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Read '".$p_entry['size']."' bytes");
|
4225 |
|
4226 |
// ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
|
4227 |
$v_size = $p_entry['compressed_size'];
|
4228 |
while ($v_size != 0)
|
4229 |
{
|
4230 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
4231 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Read $v_read_size bytes");
|
4232 |
$v_buffer = @fread($this->zip_fd, $v_read_size);
|
4233 |
/* Try to speed up the code
|
4234 |
$v_binary_data = pack('a'.$v_read_size, $v_buffer);
|
@@ -4247,13 +3858,10 @@
|
|
4247 |
|
4248 |
}
|
4249 |
else {
|
4250 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file (Compression method ".$p_entry['compression'].")");
|
4251 |
// ----- TBC
|
4252 |
// Need to be finished
|
4253 |
if (($p_entry['flag'] & 1) == 1) {
|
4254 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "File is encrypted");
|
4255 |
PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, 'File \''.$p_entry['filename'].'\' is encrypted. Encrypted files are not supported.');
|
4256 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4257 |
return PclZip::errorCode();
|
4258 |
}
|
4259 |
|
@@ -4272,7 +3880,6 @@
|
|
4272 |
// ----- Look for extract in memory
|
4273 |
else {
|
4274 |
|
4275 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".$p_entry['compressed_size']."' compressed bytes");
|
4276 |
|
4277 |
// ----- Read the compressed file in a buffer (one shot)
|
4278 |
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
|
@@ -4281,24 +3888,20 @@
|
|
4281 |
$v_file_content = @gzinflate($v_buffer);
|
4282 |
unset($v_buffer);
|
4283 |
if ($v_file_content === FALSE) {
|
4284 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to inflate compressed file");
|
4285 |
|
4286 |
// ----- Change the file status
|
4287 |
// TBC
|
4288 |
$p_entry['status'] = "error";
|
4289 |
|
4290 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4291 |
return $v_result;
|
4292 |
}
|
4293 |
|
4294 |
// ----- Opening destination file
|
4295 |
if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
|
4296 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");
|
4297 |
|
4298 |
// ----- Change the file status
|
4299 |
$p_entry['status'] = "write_error";
|
4300 |
|
4301 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4302 |
return $v_result;
|
4303 |
}
|
4304 |
|
@@ -4317,13 +3920,11 @@
|
|
4317 |
|
4318 |
// ----- Look for chmod option
|
4319 |
if (isset($p_options[PCLZIP_OPT_SET_CHMOD])) {
|
4320 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "chmod option activated '".$p_options[PCLZIP_OPT_SET_CHMOD]."'");
|
4321 |
|
4322 |
// ----- Change the mode of the file
|
4323 |
@chmod($p_entry['filename'], $p_options[PCLZIP_OPT_SET_CHMOD]);
|
4324 |
}
|
4325 |
|
4326 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
|
4327 |
}
|
4328 |
}
|
4329 |
|
@@ -4334,7 +3935,6 @@
|
|
4334 |
|
4335 |
// ----- Look for post-extract callback
|
4336 |
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
|
4337 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction");
|
4338 |
|
4339 |
// ----- Generate a local information
|
4340 |
$v_local_header = array();
|
@@ -4348,13 +3948,11 @@
|
|
4348 |
|
4349 |
// ----- Look for abort result
|
4350 |
if ($v_result == 2) {
|
4351 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
|
4352 |
$v_result = PCLZIP_ERR_USER_ABORTED;
|
4353 |
}
|
4354 |
}
|
4355 |
|
4356 |
// ----- Return
|
4357 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4358 |
return $v_result;
|
4359 |
}
|
4360 |
// --------------------------------------------------------------------------------
|
@@ -4367,7 +3965,6 @@
|
|
4367 |
// --------------------------------------------------------------------------------
|
4368 |
function privExtractFileUsingTempFile(&$p_entry, &$p_options)
|
4369 |
{
|
4370 |
-
PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFileUsingTempFile', "filename='".$p_entry['filename']."'");
|
4371 |
$v_result=1;
|
4372 |
|
4373 |
// ----- Creates a temporary file
|
@@ -4375,11 +3972,9 @@
|
|
4375 |
if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) {
|
4376 |
fclose($v_file);
|
4377 |
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode');
|
4378 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4379 |
return PclZip::errorCode();
|
4380 |
}
|
4381 |
|
4382 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Start extraction of '".$p_entry['filename']."'");
|
4383 |
|
4384 |
// ----- Write gz file format header
|
4385 |
$v_binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($p_entry['compression']), Chr(0x00), time(), Chr(0x00), Chr(3));
|
@@ -4387,11 +3982,9 @@
|
|
4387 |
|
4388 |
// ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
|
4389 |
$v_size = $p_entry['compressed_size'];
|
4390 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Compressed Size :".$v_size."");
|
4391 |
while ($v_size != 0)
|
4392 |
{
|
4393 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
4394 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Read ".$v_read_size." bytes");
|
4395 |
$v_buffer = @fread($this->zip_fd, $v_read_size);
|
4396 |
//$v_binary_data = pack('a'.$v_read_size, $v_buffer);
|
4397 |
@fwrite($v_dest_file, $v_buffer, $v_read_size);
|
@@ -4407,9 +4000,7 @@
|
|
4407 |
|
4408 |
// ----- Opening destination file
|
4409 |
if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
|
4410 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");
|
4411 |
$p_entry['status'] = "write_error";
|
4412 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4413 |
return $v_result;
|
4414 |
}
|
4415 |
|
@@ -4418,19 +4009,14 @@
|
|
4418 |
@fclose($v_dest_file);
|
4419 |
$p_entry['status'] = "read_error";
|
4420 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
|
4421 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4422 |
return PclZip::errorCode();
|
4423 |
}
|
4424 |
|
4425 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, 'File size is '.filesize($v_gzip_temp_name));
|
4426 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Reading '".$p_entry['size']."' bytes");
|
4427 |
|
4428 |
// ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
|
4429 |
$v_size = $p_entry['size'];
|
4430 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Size :".$v_size."");
|
4431 |
while ($v_size != 0) {
|
4432 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
4433 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Read ".$v_read_size." bytes");
|
4434 |
$v_buffer = @gzread($v_src_file, $v_read_size);
|
4435 |
//$v_binary_data = pack('a'.$v_read_size, $v_buffer);
|
4436 |
@fwrite($v_dest_file, $v_buffer, $v_read_size);
|
@@ -4443,7 +4029,6 @@
|
|
4443 |
@unlink($v_gzip_temp_name);
|
4444 |
|
4445 |
// ----- Return
|
4446 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4447 |
return $v_result;
|
4448 |
}
|
4449 |
// --------------------------------------------------------------------------------
|
@@ -4456,16 +4041,13 @@
|
|
4456 |
// --------------------------------------------------------------------------------
|
4457 |
function privExtractFileInOutput(&$p_entry, &$p_options)
|
4458 |
{
|
4459 |
-
PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFileInOutput', "");
|
4460 |
$v_result=1;
|
4461 |
|
4462 |
// ----- Read the file header
|
4463 |
if (($v_result = $this->privReadFileHeader($v_header)) != 1) {
|
4464 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4465 |
return $v_result;
|
4466 |
}
|
4467 |
|
4468 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");
|
4469 |
|
4470 |
// ----- Check that the file header is coherent with $p_entry info
|
4471 |
if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
|
@@ -4474,7 +4056,6 @@
|
|
4474 |
|
4475 |
// ----- Look for pre-extract callback
|
4476 |
if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
|
4477 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_EXTRACT]."()') is defined for the extraction");
|
4478 |
|
4479 |
// ----- Generate a local information
|
4480 |
$v_local_header = array();
|
@@ -4493,7 +4074,6 @@
|
|
4493 |
|
4494 |
// ----- Look for abort result
|
4495 |
if ($v_result == 2) {
|
4496 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
|
4497 |
// ----- This status is internal and will be changed in 'skipped'
|
4498 |
$p_entry['status'] = "aborted";
|
4499 |
$v_result = PCLZIP_ERR_USER_ABORTED;
|
@@ -4502,11 +4082,9 @@
|
|
4502 |
// ----- Update the informations
|
4503 |
// Only some fields can be modified
|
4504 |
$p_entry['filename'] = $v_local_header['filename'];
|
4505 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "New filename is '".$p_entry['filename']."'");
|
4506 |
}
|
4507 |
|
4508 |
// ----- Trace
|
4509 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) '".$p_entry['filename']."', size '$v_header[size]'");
|
4510 |
|
4511 |
// ----- Look if extraction should be done
|
4512 |
if ($p_entry['status'] == 'ok') {
|
@@ -4515,8 +4093,6 @@
|
|
4515 |
if (!(($p_entry['external']&0x00000010)==0x00000010)) {
|
4516 |
// ----- Look for not compressed file
|
4517 |
if ($p_entry['compressed_size'] == $p_entry['size']) {
|
4518 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
|
4519 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Reading '".$p_entry['size']."' bytes");
|
4520 |
|
4521 |
// ----- Read the file in a buffer (one shot)
|
4522 |
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
|
@@ -4526,8 +4102,6 @@
|
|
4526 |
unset($v_buffer);
|
4527 |
}
|
4528 |
else {
|
4529 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file");
|
4530 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Reading '".$p_entry['size']."' bytes");
|
4531 |
|
4532 |
// ----- Read the compressed file in a buffer (one shot)
|
4533 |
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
|
@@ -4540,7 +4114,6 @@
|
|
4540 |
echo $v_file_content;
|
4541 |
unset($v_file_content);
|
4542 |
}
|
4543 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
|
4544 |
}
|
4545 |
}
|
4546 |
|
@@ -4551,7 +4124,6 @@
|
|
4551 |
|
4552 |
// ----- Look for post-extract callback
|
4553 |
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
|
4554 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction");
|
4555 |
|
4556 |
// ----- Generate a local information
|
4557 |
$v_local_header = array();
|
@@ -4565,12 +4137,10 @@
|
|
4565 |
|
4566 |
// ----- Look for abort result
|
4567 |
if ($v_result == 2) {
|
4568 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
|
4569 |
$v_result = PCLZIP_ERR_USER_ABORTED;
|
4570 |
}
|
4571 |
}
|
4572 |
|
4573 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4574 |
return $v_result;
|
4575 |
}
|
4576 |
// --------------------------------------------------------------------------------
|
@@ -4583,7 +4153,6 @@
|
|
4583 |
// --------------------------------------------------------------------------------
|
4584 |
function privExtractFileAsString(&$p_entry, &$p_string, &$p_options)
|
4585 |
{
|
4586 |
-
PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFileAsString', "p_entry['filename']='".$p_entry['filename']."'");
|
4587 |
$v_result=1;
|
4588 |
|
4589 |
// ----- Read the file header
|
@@ -4591,11 +4160,9 @@
|
|
4591 |
if (($v_result = $this->privReadFileHeader($v_header)) != 1)
|
4592 |
{
|
4593 |
// ----- Return
|
4594 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4595 |
return $v_result;
|
4596 |
}
|
4597 |
|
4598 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");
|
4599 |
|
4600 |
// ----- Check that the file header is coherent with $p_entry info
|
4601 |
if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
|
@@ -4604,7 +4171,6 @@
|
|
4604 |
|
4605 |
// ----- Look for pre-extract callback
|
4606 |
if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
|
4607 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_EXTRACT]."()') is defined for the extraction");
|
4608 |
|
4609 |
// ----- Generate a local information
|
4610 |
$v_local_header = array();
|
@@ -4623,7 +4189,6 @@
|
|
4623 |
|
4624 |
// ----- Look for abort result
|
4625 |
if ($v_result == 2) {
|
4626 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
|
4627 |
// ----- This status is internal and will be changed in 'skipped'
|
4628 |
$p_entry['status'] = "aborted";
|
4629 |
$v_result = PCLZIP_ERR_USER_ABORTED;
|
@@ -4632,10 +4197,8 @@
|
|
4632 |
// ----- Update the informations
|
4633 |
// Only some fields can be modified
|
4634 |
$p_entry['filename'] = $v_local_header['filename'];
|
4635 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "New filename is '".$p_entry['filename']."'");
|
4636 |
}
|
4637 |
|
4638 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file in string (with path) '".$p_entry['filename']."', size '$v_header[size]'");
|
4639 |
|
4640 |
// ----- Look if extraction should be done
|
4641 |
if ($p_entry['status'] == 'ok') {
|
@@ -4645,14 +4208,11 @@
|
|
4645 |
// ----- Look for not compressed file
|
4646 |
// if ($p_entry['compressed_size'] == $p_entry['size'])
|
4647 |
if ($p_entry['compression'] == 0) {
|
4648 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
|
4649 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Reading '".$p_entry['size']."' bytes");
|
4650 |
|
4651 |
// ----- Reading the file
|
4652 |
$p_string = @fread($this->zip_fd, $p_entry['compressed_size']);
|
4653 |
}
|
4654 |
else {
|
4655 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file (compression method '".$p_entry['compression']."')");
|
4656 |
|
4657 |
// ----- Reading the file
|
4658 |
$v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
|
@@ -4664,7 +4224,6 @@
|
|
4664 |
}
|
4665 |
|
4666 |
// ----- Trace
|
4667 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
|
4668 |
}
|
4669 |
else {
|
4670 |
// TBC : error : can not extract a folder in a string
|
@@ -4679,7 +4238,6 @@
|
|
4679 |
|
4680 |
// ----- Look for post-extract callback
|
4681 |
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
|
4682 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction");
|
4683 |
|
4684 |
// ----- Generate a local information
|
4685 |
$v_local_header = array();
|
@@ -4701,13 +4259,11 @@
|
|
4701 |
|
4702 |
// ----- Look for abort result
|
4703 |
if ($v_result == 2) {
|
4704 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
|
4705 |
$v_result = PCLZIP_ERR_USER_ABORTED;
|
4706 |
}
|
4707 |
}
|
4708 |
|
4709 |
// ----- Return
|
4710 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4711 |
return $v_result;
|
4712 |
}
|
4713 |
// --------------------------------------------------------------------------------
|
@@ -4720,25 +4276,20 @@
|
|
4720 |
// --------------------------------------------------------------------------------
|
4721 |
function privReadFileHeader(&$p_header)
|
4722 |
{
|
4723 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadFileHeader", "");
|
4724 |
$v_result=1;
|
4725 |
|
4726 |
// ----- Read the 4 bytes signature
|
4727 |
$v_binary_data = @fread($this->zip_fd, 4);
|
4728 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");
|
4729 |
$v_data = unpack('Vid', $v_binary_data);
|
4730 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");
|
4731 |
|
4732 |
// ----- Check signature
|
4733 |
if ($v_data['id'] != 0x04034b50)
|
4734 |
{
|
4735 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid File header");
|
4736 |
|
4737 |
// ----- Error log
|
4738 |
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
|
4739 |
|
4740 |
// ----- Return
|
4741 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4742 |
return PclZip::errorCode();
|
4743 |
}
|
4744 |
|
@@ -4750,53 +4301,36 @@
|
|
4750 |
{
|
4751 |
$p_header['filename'] = "";
|
4752 |
$p_header['status'] = "invalid_header";
|
4753 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid block size : ".strlen($v_binary_data));
|
4754 |
|
4755 |
// ----- Error log
|
4756 |
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));
|
4757 |
|
4758 |
// ----- Return
|
4759 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4760 |
return PclZip::errorCode();
|
4761 |
}
|
4762 |
|
4763 |
// ----- Extract the values
|
4764 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Header : '".$v_binary_data."'");
|
4765 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Header (Hex) : '".bin2hex($v_binary_data)."'");
|
4766 |
$v_data = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v_binary_data);
|
4767 |
|
4768 |
// ----- Get filename
|
4769 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "File name length : ".$v_data['filename_len']);
|
4770 |
$p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']);
|
4771 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Filename : \''.$p_header['filename'].'\'');
|
4772 |
|
4773 |
// ----- Get extra_fields
|
4774 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Extra field length : ".$v_data['extra_len']);
|
4775 |
if ($v_data['extra_len'] != 0) {
|
4776 |
$p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']);
|
4777 |
}
|
4778 |
else {
|
4779 |
$p_header['extra'] = '';
|
4780 |
}
|
4781 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Extra field : \''.bin2hex($p_header['extra']).'\'');
|
4782 |
|
4783 |
// ----- Extract properties
|
4784 |
$p_header['version_extracted'] = $v_data['version'];
|
4785 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version need to extract : ('.$p_header['version_extracted'].') \''.($p_header['version_extracted']/10).'.'.($p_header['version_extracted']%10).'\'');
|
4786 |
$p_header['compression'] = $v_data['compression'];
|
4787 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compression method : \''.$p_header['compression'].'\'');
|
4788 |
$p_header['size'] = $v_data['size'];
|
4789 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size : \''.$p_header['size'].'\'');
|
4790 |
$p_header['compressed_size'] = $v_data['compressed_size'];
|
4791 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compressed Size : \''.$p_header['compressed_size'].'\'');
|
4792 |
$p_header['crc'] = $v_data['crc'];
|
4793 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : \''.sprintf("0x%X", $p_header['crc']).'\'');
|
4794 |
$p_header['flag'] = $v_data['flag'];
|
4795 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Flag : \''.$p_header['flag'].'\'');
|
4796 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Flag bit 11 (from right) : \''.($p_header['flag']&0x0400).'\'');
|
4797 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Flag bit 11 (from left) : \''.($p_header['flag']&0x0020).'\'');
|
4798 |
$p_header['filename_len'] = $v_data['filename_len'];
|
4799 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Filename_len : \''.$p_header['filename_len'].'\'');
|
4800 |
|
4801 |
// ----- Recuperate date in UNIX format
|
4802 |
$p_header['mdate'] = $v_data['mdate'];
|
@@ -4816,17 +4350,14 @@
|
|
4816 |
// ----- Get UNIX date format
|
4817 |
$p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
|
4818 |
|
4819 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
|
4820 |
}
|
4821 |
else
|
4822 |
{
|
4823 |
$p_header['mtime'] = time();
|
4824 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date is actual : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
|
4825 |
}
|
4826 |
|
4827 |
// TBC
|
4828 |
//for(reset($v_data); $key = key($v_data); next($v_data)) {
|
4829 |
-
// PclTraceFctMessage(__FILE__, __LINE__, 3, "Attribut[$key] = ".$v_data[$key]);
|
4830 |
//}
|
4831 |
|
4832 |
// ----- Set the stored filename
|
@@ -4836,7 +4367,6 @@
|
|
4836 |
$p_header['status'] = "ok";
|
4837 |
|
4838 |
// ----- Return
|
4839 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4840 |
return $v_result;
|
4841 |
}
|
4842 |
// --------------------------------------------------------------------------------
|
@@ -4849,25 +4379,20 @@
|
|
4849 |
// --------------------------------------------------------------------------------
|
4850 |
function privReadCentralFileHeader(&$p_header)
|
4851 |
{
|
4852 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadCentralFileHeader", "");
|
4853 |
$v_result=1;
|
4854 |
|
4855 |
// ----- Read the 4 bytes signature
|
4856 |
$v_binary_data = @fread($this->zip_fd, 4);
|
4857 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");
|
4858 |
$v_data = unpack('Vid', $v_binary_data);
|
4859 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");
|
4860 |
|
4861 |
// ----- Check signature
|
4862 |
if ($v_data['id'] != 0x02014b50)
|
4863 |
{
|
4864 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid Central Dir File signature");
|
4865 |
|
4866 |
// ----- Error log
|
4867 |
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
|
4868 |
|
4869 |
// ----- Return
|
4870 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4871 |
return PclZip::errorCode();
|
4872 |
}
|
4873 |
|
@@ -4879,53 +4404,36 @@
|
|
4879 |
{
|
4880 |
$p_header['filename'] = "";
|
4881 |
$p_header['status'] = "invalid_header";
|
4882 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid block size : ".strlen($v_binary_data));
|
4883 |
|
4884 |
// ----- Error log
|
4885 |
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));
|
4886 |
|
4887 |
// ----- Return
|
4888 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4889 |
return PclZip::errorCode();
|
4890 |
}
|
4891 |
|
4892 |
// ----- Extract the values
|
4893 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Header : '".$v_binary_data."'");
|
4894 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Header (Hex) : '".bin2hex($v_binary_data)."'");
|
4895 |
$p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data);
|
4896 |
|
4897 |
// ----- Get filename
|
4898 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "File name length : ".$p_header['filename_len']);
|
4899 |
if ($p_header['filename_len'] != 0)
|
4900 |
$p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']);
|
4901 |
else
|
4902 |
$p_header['filename'] = '';
|
4903 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, 'Filename : \''.$p_header['filename'].'\'');
|
4904 |
|
4905 |
// ----- Get extra
|
4906 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Extra length : ".$p_header['extra_len']);
|
4907 |
if ($p_header['extra_len'] != 0)
|
4908 |
$p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']);
|
4909 |
else
|
4910 |
$p_header['extra'] = '';
|
4911 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, 'Extra : \''.$p_header['extra'].'\'');
|
4912 |
|
4913 |
// ----- Get comment
|
4914 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Comment length : ".$p_header['comment_len']);
|
4915 |
if ($p_header['comment_len'] != 0)
|
4916 |
$p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']);
|
4917 |
else
|
4918 |
$p_header['comment'] = '';
|
4919 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, 'Comment : \''.$p_header['comment'].'\'');
|
4920 |
|
4921 |
// ----- Extract properties
|
4922 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version : \''.($p_header['version']/10).'.'.($p_header['version']%10).'\'');
|
4923 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version need to extract : \''.($p_header['version_extracted']/10).'.'.($p_header['version_extracted']%10).'\'');
|
4924 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, 'Size : \''.$p_header['size'].'\'');
|
4925 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, 'Compressed Size : \''.$p_header['compressed_size'].'\'');
|
4926 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, 'CRC : \''.sprintf("0x%X", $p_header['crc']).'\'');
|
4927 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, 'Flag : \''.$p_header['flag'].'\'');
|
4928 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, 'Offset : \''.$p_header['offset'].'\'');
|
4929 |
|
4930 |
// ----- Recuperate date in UNIX format
|
4931 |
//if ($p_header['mdate'] && $p_header['mtime'])
|
@@ -4945,12 +4453,10 @@
|
|
4945 |
// ----- Get UNIX date format
|
4946 |
$p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
|
4947 |
|
4948 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
|
4949 |
}
|
4950 |
else
|
4951 |
{
|
4952 |
$p_header['mtime'] = time();
|
4953 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, 'Date is actual : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
|
4954 |
}
|
4955 |
|
4956 |
// ----- Set the stored filename
|
@@ -4960,18 +4466,13 @@
|
|
4960 |
$p_header['status'] = 'ok';
|
4961 |
|
4962 |
// ----- Look if it is a directory
|
4963 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Internal (Hex) : '".sprintf("Ox%04X", $p_header['internal'])."'");
|
4964 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "External (Hex) : '".sprintf("Ox%04X", $p_header['external'])."' (".(($p_header['external']&0x00000010)==0x00000010?'is a folder':'is a file').')');
|
4965 |
if (substr($p_header['filename'], -1) == '/') {
|
4966 |
//$p_header['external'] = 0x41FF0010;
|
4967 |
$p_header['external'] = 0x00000010;
|
4968 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, 'Force folder external : \''.sprintf("Ox%04X", $p_header['external']).'\'');
|
4969 |
}
|
4970 |
|
4971 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Header of filename : \''.$p_header['filename'].'\'');
|
4972 |
|
4973 |
// ----- Return
|
4974 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4975 |
return $v_result;
|
4976 |
}
|
4977 |
// --------------------------------------------------------------------------------
|
@@ -4986,44 +4487,31 @@
|
|
4986 |
// --------------------------------------------------------------------------------
|
4987 |
function privCheckFileHeaders(&$p_local_header, &$p_central_header)
|
4988 |
{
|
4989 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCheckFileHeaders", "");
|
4990 |
$v_result=1;
|
4991 |
|
4992 |
// ----- Check the static values
|
4993 |
// TBC
|
4994 |
if ($p_local_header['filename'] != $p_central_header['filename']) {
|
4995 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename" : TBC To Be Completed');
|
4996 |
}
|
4997 |
if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) {
|
4998 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "version_extracted" : TBC To Be Completed');
|
4999 |
}
|
5000 |
if ($p_local_header['flag'] != $p_central_header['flag']) {
|
5001 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "flag" : TBC To Be Completed');
|
5002 |
}
|
5003 |
if ($p_local_header['compression'] != $p_central_header['compression']) {
|
5004 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "compression" : TBC To Be Completed');
|
5005 |
}
|
5006 |
if ($p_local_header['mtime'] != $p_central_header['mtime']) {
|
5007 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "mtime" : TBC To Be Completed');
|
5008 |
}
|
5009 |
if ($p_local_header['filename_len'] != $p_central_header['filename_len']) {
|
5010 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename_len" : TBC To Be Completed');
|
5011 |
}
|
5012 |
|
5013 |
// ----- Look for flag bit 3
|
5014 |
if (($p_local_header['flag'] & 8) == 8) {
|
5015 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Purpose bit flag bit 3 set !');
|
5016 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'File size, compression size and crc found in central header');
|
5017 |
$p_local_header['size'] = $p_central_header['size'];
|
5018 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size : \''.$p_local_header['size'].'\'');
|
5019 |
$p_local_header['compressed_size'] = $p_central_header['compressed_size'];
|
5020 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compressed Size : \''.$p_local_header['compressed_size'].'\'');
|
5021 |
$p_local_header['crc'] = $p_central_header['crc'];
|
5022 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : \''.sprintf("0x%X", $p_local_header['crc']).'\'');
|
5023 |
}
|
5024 |
|
5025 |
// ----- Return
|
5026 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5027 |
return $v_result;
|
5028 |
}
|
5029 |
// --------------------------------------------------------------------------------
|
@@ -5036,21 +4524,17 @@
|
|
5036 |
// --------------------------------------------------------------------------------
|
5037 |
function privReadEndCentralDir(&$p_central_dir)
|
5038 |
{
|
5039 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadEndCentralDir", "");
|
5040 |
$v_result=1;
|
5041 |
|
5042 |
// ----- Go to the end of the zip file
|
5043 |
$v_size = filesize($this->zipname);
|
5044 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Size of the file :$v_size");
|
5045 |
@fseek($this->zip_fd, $v_size);
|
5046 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position at end of zip file : \''.ftell($this->zip_fd).'\'');
|
5047 |
if (@ftell($this->zip_fd) != $v_size)
|
5048 |
{
|
5049 |
// ----- Error log
|
5050 |
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \''.$this->zipname.'\'');
|
5051 |
|
5052 |
// ----- Return
|
5053 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
5054 |
return PclZip::errorCode();
|
5055 |
}
|
5056 |
|
@@ -5058,28 +4542,22 @@
|
|
5058 |
// in this case the end of central dir is at 22 bytes of the file end
|
5059 |
$v_found = 0;
|
5060 |
if ($v_size > 26) {
|
5061 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, 'Look for central dir with no comment');
|
5062 |
@fseek($this->zip_fd, $v_size-22);
|
5063 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position after min central position : \''.ftell($this->zip_fd).'\'');
|
5064 |
if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22))
|
5065 |
{
|
5066 |
// ----- Error log
|
5067 |
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
|
5068 |
|
5069 |
// ----- Return
|
5070 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
5071 |
return PclZip::errorCode();
|
5072 |
}
|
5073 |
|
5074 |
// ----- Read for bytes
|
5075 |
$v_binary_data = @fread($this->zip_fd, 4);
|
5076 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");
|
5077 |
$v_data = @unpack('Vid', $v_binary_data);
|
5078 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");
|
5079 |
|
5080 |
// ----- Check signature
|
5081 |
if ($v_data['id'] == 0x06054b50) {
|
5082 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Found central dir at the default position.");
|
5083 |
$v_found = 1;
|
5084 |
}
|
5085 |
|
@@ -5088,7 +4566,6 @@
|
|
5088 |
|
5089 |
// ----- Go back to the maximum possible size of the Central Dir End Record
|
5090 |
if (!$v_found) {
|
5091 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, 'Start extended search of end central dir');
|
5092 |
$v_maximum_size = 65557; // 0xFFFF + 22;
|
5093 |
if ($v_maximum_size > $v_size)
|
5094 |
$v_maximum_size = $v_size;
|
@@ -5099,10 +4576,8 @@
|
|
5099 |
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
|
5100 |
|
5101 |
// ----- Return
|
5102 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
5103 |
return PclZip::errorCode();
|
5104 |
}
|
5105 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position after max central position : \''.ftell($this->zip_fd).'\'');
|
5106 |
|
5107 |
// ----- Read byte per byte in order to find the signature
|
5108 |
$v_pos = ftell($this->zip_fd);
|
@@ -5121,7 +4596,6 @@
|
|
5121 |
// ----- Compare the bytes
|
5122 |
if ($v_bytes == 0x504b0506)
|
5123 |
{
|
5124 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, 'Found End Central Dir signature at position : \''.ftell($this->zip_fd).'\'');
|
5125 |
$v_pos++;
|
5126 |
break;
|
5127 |
}
|
@@ -5132,13 +4606,11 @@
|
|
5132 |
// ----- Look if not found end of central dir
|
5133 |
if ($v_pos == $v_size)
|
5134 |
{
|
5135 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to find End of Central Dir Record signature");
|
5136 |
|
5137 |
// ----- Error log
|
5138 |
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Unable to find End of Central Dir Record signature");
|
5139 |
|
5140 |
// ----- Return
|
5141 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
5142 |
return PclZip::errorCode();
|
5143 |
}
|
5144 |
}
|
@@ -5149,25 +4621,19 @@
|
|
5149 |
// ----- Look for invalid block size
|
5150 |
if (strlen($v_binary_data) != 18)
|
5151 |
{
|
5152 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid End of Central Dir Record size : ".strlen($v_binary_data));
|
5153 |
|
5154 |
// ----- Error log
|
5155 |
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir Record size : ".strlen($v_binary_data));
|
5156 |
|
5157 |
// ----- Return
|
5158 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
5159 |
return PclZip::errorCode();
|
5160 |
}
|
5161 |
|
5162 |
// ----- Extract the values
|
5163 |
-
//PclTraceFctMessage(__FILE__, __LINE__, 4, "Central Dir Record : '".$v_binary_data."'");
|
5164 |
-
//PclTraceFctMessage(__FILE__, __LINE__, 4, "Central Dir Record (Hex) : '".bin2hex($v_binary_data)."'");
|
5165 |
$v_data = unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', $v_binary_data);
|
5166 |
|
5167 |
// ----- Check the global size
|
5168 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Comment length : ".$v_data['comment_size']);
|
5169 |
if (($v_pos + $v_data['comment_size'] + 18) != $v_size) {
|
5170 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "The central dir is not at the end of the archive. Some trailing bytes exists after the archive.");
|
5171 |
|
5172 |
// ----- Removed in release 2.2 see readme file
|
5173 |
// The check of the file size is a little too strict.
|
@@ -5180,40 +4646,29 @@
|
|
5180 |
.' Some trailing bytes exists after the archive.');
|
5181 |
|
5182 |
// ----- Return
|
5183 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
5184 |
return PclZip::errorCode();
|
5185 |
}
|
5186 |
}
|
5187 |
|
5188 |
// ----- Get comment
|
5189 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Comment size : \''.$v_data['comment_size'].'\'');
|
5190 |
if ($v_data['comment_size'] != 0) {
|
5191 |
$p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']);
|
5192 |
}
|
5193 |
else
|
5194 |
$p_central_dir['comment'] = '';
|
5195 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Comment : \''.$p_central_dir['comment'].'\'');
|
5196 |
|
5197 |
$p_central_dir['entries'] = $v_data['entries'];
|
5198 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Nb of entries : \''.$p_central_dir['entries'].'\'');
|
5199 |
$p_central_dir['disk_entries'] = $v_data['disk_entries'];
|
5200 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Nb of entries for this disk : \''.$p_central_dir['disk_entries'].'\'');
|
5201 |
$p_central_dir['offset'] = $v_data['offset'];
|
5202 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Offset of Central Dir : \''.$p_central_dir['offset'].'\'');
|
5203 |
$p_central_dir['size'] = $v_data['size'];
|
5204 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size of Central Dir : \''.$p_central_dir['size'].'\'');
|
5205 |
$p_central_dir['disk'] = $v_data['disk'];
|
5206 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Disk number : \''.$p_central_dir['disk'].'\'');
|
5207 |
$p_central_dir['disk_start'] = $v_data['disk_start'];
|
5208 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, 'Start disk number : \''.$p_central_dir['disk_start'].'\'');
|
5209 |
|
5210 |
// TBC
|
5211 |
//for(reset($p_central_dir); $key = key($p_central_dir); next($p_central_dir)) {
|
5212 |
-
// PclTraceFctMessage(__FILE__, __LINE__, 3, "central_dir[$key] = ".$p_central_dir[$key]);
|
5213 |
//}
|
5214 |
|
5215 |
// ----- Return
|
5216 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5217 |
return $v_result;
|
5218 |
}
|
5219 |
// --------------------------------------------------------------------------------
|
@@ -5226,16 +4681,13 @@
|
|
5226 |
// --------------------------------------------------------------------------------
|
5227 |
function privDeleteByRule(&$p_result_list, &$p_options)
|
5228 |
{
|
5229 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDeleteByRule", "");
|
5230 |
$v_result=1;
|
5231 |
$v_list_detail = array();
|
5232 |
|
5233 |
// ----- Open the zip file
|
5234 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
5235 |
if (($v_result=$this->privOpenFd('rb')) != 1)
|
5236 |
{
|
5237 |
// ----- Return
|
5238 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5239 |
return $v_result;
|
5240 |
}
|
5241 |
|
@@ -5244,21 +4696,16 @@
|
|
5244 |
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
|
5245 |
{
|
5246 |
$this->privCloseFd();
|
5247 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5248 |
return $v_result;
|
5249 |
}
|
5250 |
|
5251 |
// ----- Go to beginning of File
|
5252 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
|
5253 |
@rewind($this->zip_fd);
|
5254 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
|
5255 |
|
5256 |
// ----- Scan all the files
|
5257 |
// ----- Start at beginning of Central Dir
|
5258 |
$v_pos_entry = $v_central_dir['offset'];
|
5259 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
|
5260 |
@rewind($this->zip_fd);
|
5261 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
|
5262 |
if (@fseek($this->zip_fd, $v_pos_entry))
|
5263 |
{
|
5264 |
// ----- Close the zip file
|
@@ -5268,17 +4715,14 @@
|
|
5268 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
|
5269 |
|
5270 |
// ----- Return
|
5271 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
5272 |
return PclZip::errorCode();
|
5273 |
}
|
5274 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");
|
5275 |
|
5276 |
// ----- Read each entry
|
5277 |
$v_header_list = array();
|
5278 |
$j_start = 0;
|
5279 |
for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
|
5280 |
{
|
5281 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Read next file header entry (index '$i')");
|
5282 |
|
5283 |
// ----- Read the file header
|
5284 |
$v_header_list[$v_nb_extracted] = array();
|
@@ -5287,11 +4731,9 @@
|
|
5287 |
// ----- Close the zip file
|
5288 |
$this->privCloseFd();
|
5289 |
|
5290 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5291 |
return $v_result;
|
5292 |
}
|
5293 |
|
5294 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename (index '$i') : '".$v_header_list[$v_nb_extracted]['stored_filename']."'");
|
5295 |
|
5296 |
// ----- Store the index
|
5297 |
$v_header_list[$v_nb_extracted]['index'] = $i;
|
@@ -5302,31 +4744,25 @@
|
|
5302 |
// ----- Look for extract by name rule
|
5303 |
if ( (isset($p_options[PCLZIP_OPT_BY_NAME]))
|
5304 |
&& ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
|
5305 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByName'");
|
5306 |
|
5307 |
// ----- Look if the filename is in the list
|
5308 |
for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) {
|
5309 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Compare with file '".$p_options[PCLZIP_OPT_BY_NAME][$j]."'");
|
5310 |
|
5311 |
// ----- Look for a directory
|
5312 |
if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
|
5313 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "The searched item is a directory");
|
5314 |
|
5315 |
// ----- Look if the directory is in the filename path
|
5316 |
if ( (strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
|
5317 |
&& (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
|
5318 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "The directory is in the file path");
|
5319 |
$v_found = true;
|
5320 |
}
|
5321 |
elseif ( (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */
|
5322 |
&& ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
|
5323 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "The entry is the searched directory");
|
5324 |
$v_found = true;
|
5325 |
}
|
5326 |
}
|
5327 |
// ----- Look for a filename
|
5328 |
elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
|
5329 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "The file is the right one.");
|
5330 |
$v_found = true;
|
5331 |
}
|
5332 |
}
|
@@ -5337,10 +4773,8 @@
|
|
5337 |
/*
|
5338 |
else if ( (isset($p_options[PCLZIP_OPT_BY_EREG]))
|
5339 |
&& ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
|
5340 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract by ereg '".$p_options[PCLZIP_OPT_BY_EREG]."'");
|
5341 |
|
5342 |
if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
|
5343 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
|
5344 |
$v_found = true;
|
5345 |
}
|
5346 |
}
|
@@ -5349,10 +4783,8 @@
|
|
5349 |
// ----- Look for extract by preg rule
|
5350 |
else if ( (isset($p_options[PCLZIP_OPT_BY_PREG]))
|
5351 |
&& ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
|
5352 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByEreg'");
|
5353 |
|
5354 |
if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
|
5355 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
|
5356 |
$v_found = true;
|
5357 |
}
|
5358 |
}
|
@@ -5360,41 +4792,33 @@
|
|
5360 |
// ----- Look for extract by index rule
|
5361 |
else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX]))
|
5362 |
&& ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
|
5363 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");
|
5364 |
|
5365 |
// ----- Look if the index is in the list
|
5366 |
for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) {
|
5367 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Look if index '$i' is in [".$p_options[PCLZIP_OPT_BY_INDEX][$j]['start'].",".$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']."]");
|
5368 |
|
5369 |
if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
|
5370 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Found as part of an index range");
|
5371 |
$v_found = true;
|
5372 |
}
|
5373 |
if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
|
5374 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Do not look this index range for next loop");
|
5375 |
$j_start = $j+1;
|
5376 |
}
|
5377 |
|
5378 |
if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
|
5379 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Index range is greater than index, stop loop");
|
5380 |
break;
|
5381 |
}
|
5382 |
}
|
5383 |
}
|
5384 |
else {
|
5385 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "No argument mean remove all file");
|
5386 |
$v_found = true;
|
5387 |
}
|
5388 |
|
5389 |
// ----- Look for deletion
|
5390 |
if ($v_found)
|
5391 |
{
|
5392 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_header_list[$v_nb_extracted]['stored_filename']."', index '$i' need to be deleted");
|
5393 |
unset($v_header_list[$v_nb_extracted]);
|
5394 |
}
|
5395 |
else
|
5396 |
{
|
5397 |
-
PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_header_list[$v_nb_extracted]['stored_filename']."', index '$i' will not be deleted");
|
5398 |
$v_nb_extracted++;
|
5399 |
}
|
5400 |
}
|
@@ -5409,24 +4833,18 @@
|
|
5409 |
$v_temp_zip = new PclZip($v_zip_temp_name);
|
5410 |
|
5411 |
// ----- Open the temporary zip file in write mode
|
5412 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary write mode");
|
5413 |
if (($v_result = $v_temp_zip->privOpenFd('wb')) != 1) {
|
5414 |
$this->privCloseFd();
|
5415 |
|
5416 |
// ----- Return
|
5417 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5418 |
return $v_result;
|
5419 |
}
|
5420 |
|
5421 |
// ----- Look which file need to be kept
|
5422 |
for ($i=0; $i<sizeof($v_header_list); $i++) {
|
5423 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Keep entry index '$i' : '".$v_header_list[$i]['filename']."'");
|
5424 |
|
5425 |
// ----- Calculate the position of the header
|
5426 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset='". $v_header_list[$i]['offset']."'");
|
5427 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
|
5428 |
@rewind($this->zip_fd);
|
5429 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
|
5430 |
if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) {
|
5431 |
// ----- Close the zip file
|
5432 |
$this->privCloseFd();
|
@@ -5437,10 +4855,8 @@
|
|
5437 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
|
5438 |
|
5439 |
// ----- Return
|
5440 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
5441 |
return PclZip::errorCode();
|
5442 |
}
|
5443 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");
|
5444 |
|
5445 |
// ----- Read the file header
|
5446 |
$v_local_header = array();
|
@@ -5451,7 +4867,6 @@
|
|
5451 |
@unlink($v_zip_temp_name);
|
5452 |
|
5453 |
// ----- Return
|
5454 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5455 |
return $v_result;
|
5456 |
}
|
5457 |
|
@@ -5470,10 +4885,8 @@
|
|
5470 |
@unlink($v_zip_temp_name);
|
5471 |
|
5472 |
// ----- Return
|
5473 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5474 |
return $v_result;
|
5475 |
}
|
5476 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset for this file is '".$v_header_list[$i]['offset']."'");
|
5477 |
|
5478 |
// ----- Read/write the data block
|
5479 |
if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) {
|
@@ -5483,27 +4896,22 @@
|
|
5483 |
@unlink($v_zip_temp_name);
|
5484 |
|
5485 |
// ----- Return
|
5486 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5487 |
return $v_result;
|
5488 |
}
|
5489 |
}
|
5490 |
|
5491 |
// ----- Store the offset of the central dir
|
5492 |
$v_offset = @ftell($v_temp_zip->zip_fd);
|
5493 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "New offset of central dir : $v_offset");
|
5494 |
|
5495 |
// ----- Re-Create the Central Dir files header
|
5496 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Creates the new central directory");
|
5497 |
for ($i=0; $i<sizeof($v_header_list); $i++) {
|
5498 |
// ----- Create the file header
|
5499 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset of file : ".$v_header_list[$i]['offset']);
|
5500 |
if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
|
5501 |
$v_temp_zip->privCloseFd();
|
5502 |
$this->privCloseFd();
|
5503 |
@unlink($v_zip_temp_name);
|
5504 |
|
5505 |
// ----- Return
|
5506 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5507 |
return $v_result;
|
5508 |
}
|
5509 |
|
@@ -5511,7 +4919,6 @@
|
|
5511 |
$v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
|
5512 |
}
|
5513 |
|
5514 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Creates the central directory footer");
|
5515 |
|
5516 |
// ----- Zip file comment
|
5517 |
$v_comment = '';
|
@@ -5531,7 +4938,6 @@
|
|
5531 |
@unlink($v_zip_temp_name);
|
5532 |
|
5533 |
// ----- Return
|
5534 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5535 |
return $v_result;
|
5536 |
}
|
5537 |
|
@@ -5557,12 +4963,10 @@
|
|
5557 |
$this->privCloseFd();
|
5558 |
|
5559 |
if (($v_result = $this->privOpenFd('wb')) != 1) {
|
5560 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5561 |
return $v_result;
|
5562 |
}
|
5563 |
|
5564 |
if (($v_result = $this->privWriteCentralHeader(0, 0, 0, '')) != 1) {
|
5565 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5566 |
return $v_result;
|
5567 |
}
|
5568 |
|
@@ -5570,7 +4974,6 @@
|
|
5570 |
}
|
5571 |
|
5572 |
// ----- Return
|
5573 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5574 |
return $v_result;
|
5575 |
}
|
5576 |
// --------------------------------------------------------------------------------
|
@@ -5590,25 +4993,21 @@
|
|
5590 |
{
|
5591 |
$v_result = 1;
|
5592 |
|
5593 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDirCheck", "entry='$p_dir', is_dir='".($p_is_dir?"true":"false")."'");
|
5594 |
|
5595 |
// ----- Remove the final '/'
|
5596 |
if (($p_is_dir) && (substr($p_dir, -1)=='/'))
|
5597 |
{
|
5598 |
$p_dir = substr($p_dir, 0, strlen($p_dir)-1);
|
5599 |
}
|
5600 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Looking for entry '$p_dir'");
|
5601 |
|
5602 |
// ----- Check the directory availability
|
5603 |
if ((is_dir($p_dir)) || ($p_dir == ""))
|
5604 |
{
|
5605 |
-
PclTraceFctEnd(__FILE__, __LINE__, "'$p_dir' is a directory");
|
5606 |
return 1;
|
5607 |
}
|
5608 |
|
5609 |
// ----- Extract parent directory
|
5610 |
$p_parent_dir = dirname($p_dir);
|
5611 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Parent directory is '$p_parent_dir'");
|
5612 |
|
5613 |
// ----- Just a check
|
5614 |
if ($p_parent_dir != $p_dir)
|
@@ -5618,26 +5017,22 @@
|
|
5618 |
{
|
5619 |
if (($v_result = $this->privDirCheck($p_parent_dir)) != 1)
|
5620 |
{
|
5621 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5622 |
return $v_result;
|
5623 |
}
|
5624 |
}
|
5625 |
}
|
5626 |
|
5627 |
// ----- Create the directory
|
5628 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Create directory '$p_dir'");
|
5629 |
if (!@mkdir($p_dir, 0777))
|
5630 |
{
|
5631 |
// ----- Error log
|
5632 |
PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'");
|
5633 |
|
5634 |
// ----- Return
|
5635 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
5636 |
return PclZip::errorCode();
|
5637 |
}
|
5638 |
|
5639 |
// ----- Return
|
5640 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result, "Directory '$p_dir' created");
|
5641 |
return $v_result;
|
5642 |
}
|
5643 |
// --------------------------------------------------------------------------------
|
@@ -5651,41 +5046,34 @@
|
|
5651 |
// --------------------------------------------------------------------------------
|
5652 |
function privMerge(&$p_archive_to_add)
|
5653 |
{
|
5654 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privMerge", "archive='".$p_archive_to_add->zipname."'");
|
5655 |
$v_result=1;
|
5656 |
|
5657 |
// ----- Look if the archive_to_add exists
|
5658 |
if (!is_file($p_archive_to_add->zipname))
|
5659 |
{
|
5660 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive to add does not exist. End of merge.");
|
5661 |
|
5662 |
// ----- Nothing to merge, so merge is a success
|
5663 |
$v_result = 1;
|
5664 |
|
5665 |
// ----- Return
|
5666 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5667 |
return $v_result;
|
5668 |
}
|
5669 |
|
5670 |
// ----- Look if the archive exists
|
5671 |
if (!is_file($this->zipname))
|
5672 |
{
|
5673 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive does not exist, duplicate the archive_to_add.");
|
5674 |
|
5675 |
// ----- Do a duplicate
|
5676 |
$v_result = $this->privDuplicate($p_archive_to_add->zipname);
|
5677 |
|
5678 |
// ----- Return
|
5679 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5680 |
return $v_result;
|
5681 |
}
|
5682 |
|
5683 |
// ----- Open the zip file
|
5684 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
5685 |
if (($v_result=$this->privOpenFd('rb')) != 1)
|
5686 |
{
|
5687 |
// ----- Return
|
5688 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5689 |
return $v_result;
|
5690 |
}
|
5691 |
|
@@ -5694,23 +5082,18 @@
|
|
5694 |
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
|
5695 |
{
|
5696 |
$this->privCloseFd();
|
5697 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5698 |
return $v_result;
|
5699 |
}
|
5700 |
|
5701 |
// ----- Go to beginning of File
|
5702 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in zip : ".ftell($this->zip_fd)."'");
|
5703 |
@rewind($this->zip_fd);
|
5704 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in zip : ".ftell($this->zip_fd)."'");
|
5705 |
|
5706 |
// ----- Open the archive_to_add file
|
5707 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Open archive_to_add in binary read mode");
|
5708 |
if (($v_result=$p_archive_to_add->privOpenFd('rb')) != 1)
|
5709 |
{
|
5710 |
$this->privCloseFd();
|
5711 |
|
5712 |
// ----- Return
|
5713 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5714 |
return $v_result;
|
5715 |
}
|
5716 |
|
@@ -5721,20 +5104,16 @@
|
|
5721 |
$this->privCloseFd();
|
5722 |
$p_archive_to_add->privCloseFd();
|
5723 |
|
5724 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5725 |
return $v_result;
|
5726 |
}
|
5727 |
|
5728 |
// ----- Go to beginning of File
|
5729 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in archive_to_add : ".ftell($p_archive_to_add->zip_fd)."'");
|
5730 |
@rewind($p_archive_to_add->zip_fd);
|
5731 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in archive_to_add : ".ftell($p_archive_to_add->zip_fd)."'");
|
5732 |
|
5733 |
// ----- Creates a temporay file
|
5734 |
$v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
|
5735 |
|
5736 |
// ----- Open the temporary file in write mode
|
5737 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
5738 |
if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
|
5739 |
{
|
5740 |
$this->privCloseFd();
|
@@ -5743,7 +5122,6 @@
|
|
5743 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');
|
5744 |
|
5745 |
// ----- Return
|
5746 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
5747 |
return PclZip::errorCode();
|
5748 |
}
|
5749 |
|
@@ -5753,7 +5131,6 @@
|
|
5753 |
while ($v_size != 0)
|
5754 |
{
|
5755 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
5756 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
5757 |
$v_buffer = fread($this->zip_fd, $v_read_size);
|
5758 |
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
|
5759 |
$v_size -= $v_read_size;
|
@@ -5764,7 +5141,6 @@
|
|
5764 |
while ($v_size != 0)
|
5765 |
{
|
5766 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
5767 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
5768 |
$v_buffer = fread($p_archive_to_add->zip_fd, $v_read_size);
|
5769 |
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
|
5770 |
$v_size -= $v_read_size;
|
@@ -5772,14 +5148,12 @@
|
|
5772 |
|
5773 |
// ----- Store the offset of the central dir
|
5774 |
$v_offset = @ftell($v_zip_temp_fd);
|
5775 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "New offset of central dir : $v_offset");
|
5776 |
|
5777 |
// ----- Copy the block of file headers from the old archive
|
5778 |
$v_size = $v_central_dir['size'];
|
5779 |
while ($v_size != 0)
|
5780 |
{
|
5781 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
5782 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
5783 |
$v_buffer = @fread($this->zip_fd, $v_read_size);
|
5784 |
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
|
5785 |
$v_size -= $v_read_size;
|
@@ -5790,7 +5164,6 @@
|
|
5790 |
while ($v_size != 0)
|
5791 |
{
|
5792 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
5793 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
5794 |
$v_buffer = @fread($p_archive_to_add->zip_fd, $v_read_size);
|
5795 |
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
|
5796 |
$v_size -= $v_read_size;
|
@@ -5821,7 +5194,6 @@
|
|
5821 |
unset($v_header_list);
|
5822 |
|
5823 |
// ----- Return
|
5824 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5825 |
return $v_result;
|
5826 |
}
|
5827 |
|
@@ -5847,7 +5219,6 @@
|
|
5847 |
PclZipUtilRename($v_zip_temp_name, $this->zipname);
|
5848 |
|
5849 |
// ----- Return
|
5850 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5851 |
return $v_result;
|
5852 |
}
|
5853 |
// --------------------------------------------------------------------------------
|
@@ -5860,33 +5231,27 @@
|
|
5860 |
// --------------------------------------------------------------------------------
|
5861 |
function privDuplicate($p_archive_filename)
|
5862 |
{
|
5863 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDuplicate", "archive_filename='$p_archive_filename'");
|
5864 |
$v_result=1;
|
5865 |
|
5866 |
// ----- Look if the $p_archive_filename exists
|
5867 |
if (!is_file($p_archive_filename))
|
5868 |
{
|
5869 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive to duplicate does not exist. End of duplicate.");
|
5870 |
|
5871 |
// ----- Nothing to duplicate, so duplicate is a success.
|
5872 |
$v_result = 1;
|
5873 |
|
5874 |
// ----- Return
|
5875 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5876 |
return $v_result;
|
5877 |
}
|
5878 |
|
5879 |
// ----- Open the zip file
|
5880 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
5881 |
if (($v_result=$this->privOpenFd('wb')) != 1)
|
5882 |
{
|
5883 |
// ----- Return
|
5884 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5885 |
return $v_result;
|
5886 |
}
|
5887 |
|
5888 |
// ----- Open the temporary file in write mode
|
5889 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
5890 |
if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0)
|
5891 |
{
|
5892 |
$this->privCloseFd();
|
@@ -5894,7 +5259,6 @@
|
|
5894 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \''.$p_archive_filename.'\' in binary write mode');
|
5895 |
|
5896 |
// ----- Return
|
5897 |
-
PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
5898 |
return PclZip::errorCode();
|
5899 |
}
|
5900 |
|
@@ -5904,7 +5268,6 @@
|
|
5904 |
while ($v_size != 0)
|
5905 |
{
|
5906 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
5907 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Read $v_read_size bytes");
|
5908 |
$v_buffer = fread($v_zip_temp_fd, $v_read_size);
|
5909 |
@fwrite($this->zip_fd, $v_buffer, $v_read_size);
|
5910 |
$v_size -= $v_read_size;
|
@@ -5917,7 +5280,6 @@
|
|
5917 |
@fclose($v_zip_temp_fd);
|
5918 |
|
5919 |
// ----- Return
|
5920 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5921 |
return $v_result;
|
5922 |
}
|
5923 |
// --------------------------------------------------------------------------------
|
@@ -5964,36 +5326,28 @@
|
|
5964 |
// --------------------------------------------------------------------------------
|
5965 |
function privDisableMagicQuotes()
|
5966 |
{
|
5967 |
-
PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privDisableMagicQuotes', "");
|
5968 |
$v_result=1;
|
5969 |
|
5970 |
// ----- Look if function exists
|
5971 |
if ( (!function_exists("get_magic_quotes_runtime"))
|
5972 |
|| (!function_exists("set_magic_quotes_runtime"))) {
|
5973 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Functions *et_magic_quotes_runtime are not supported");
|
5974 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5975 |
return $v_result;
|
5976 |
}
|
5977 |
|
5978 |
// ----- Look if already done
|
5979 |
if ($this->magic_quotes_status != -1) {
|
5980 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "magic_quote already disabled");
|
5981 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5982 |
return $v_result;
|
5983 |
}
|
5984 |
|
5985 |
// ----- Get and memorize the magic_quote value
|
5986 |
$this->magic_quotes_status = @get_magic_quotes_runtime();
|
5987 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Current magic_quotes_runtime status is '".($this->magic_quotes_status==0?'disable':'enable')."'");
|
5988 |
|
5989 |
// ----- Disable magic_quotes
|
5990 |
if ($this->magic_quotes_status == 1) {
|
5991 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Disable magic_quotes");
|
5992 |
@set_magic_quotes_runtime(0);
|
5993 |
}
|
5994 |
|
5995 |
// ----- Return
|
5996 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5997 |
return $v_result;
|
5998 |
}
|
5999 |
// --------------------------------------------------------------------------------
|
@@ -6006,32 +5360,25 @@
|
|
6006 |
// --------------------------------------------------------------------------------
|
6007 |
function privSwapBackMagicQuotes()
|
6008 |
{
|
6009 |
-
PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privSwapBackMagicQuotes', "");
|
6010 |
$v_result=1;
|
6011 |
|
6012 |
// ----- Look if function exists
|
6013 |
if ( (!function_exists("get_magic_quotes_runtime"))
|
6014 |
|| (!function_exists("set_magic_quotes_runtime"))) {
|
6015 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Functions *et_magic_quotes_runtime are not supported");
|
6016 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
6017 |
return $v_result;
|
6018 |
}
|
6019 |
|
6020 |
// ----- Look if something to do
|
6021 |
if ($this->magic_quotes_status != -1) {
|
6022 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "magic_quote not modified");
|
6023 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
6024 |
return $v_result;
|
6025 |
}
|
6026 |
|
6027 |
// ----- Swap back magic_quotes
|
6028 |
if ($this->magic_quotes_status == 1) {
|
6029 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Enable back magic_quotes");
|
6030 |
@set_magic_quotes_runtime($this->magic_quotes_status);
|
6031 |
}
|
6032 |
|
6033 |
// ----- Return
|
6034 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
6035 |
return $v_result;
|
6036 |
}
|
6037 |
// --------------------------------------------------------------------------------
|
@@ -6048,7 +5395,6 @@
|
|
6048 |
// --------------------------------------------------------------------------------
|
6049 |
function PclZipUtilPathReduction($p_dir)
|
6050 |
{
|
6051 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathReduction", "dir='$p_dir'");
|
6052 |
$v_result = "";
|
6053 |
|
6054 |
// ----- Look for not empty path
|
@@ -6075,7 +5421,6 @@
|
|
6075 |
// ----- It is an invalid path, so the path is not modified
|
6076 |
// TBC
|
6077 |
$v_result = $p_dir;
|
6078 |
-
PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid path is unchanged");
|
6079 |
$v_skip = 0;
|
6080 |
}
|
6081 |
}
|
@@ -6110,7 +5455,6 @@
|
|
6110 |
}
|
6111 |
|
6112 |
// ----- Return
|
6113 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
6114 |
return $v_result;
|
6115 |
}
|
6116 |
// --------------------------------------------------------------------------------
|
@@ -6132,19 +5476,16 @@
|
|
6132 |
// --------------------------------------------------------------------------------
|
6133 |
function PclZipUtilPathInclusion($p_dir, $p_path)
|
6134 |
{
|
6135 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathInclusion", "dir='$p_dir', path='$p_path'");
|
6136 |
$v_result = 1;
|
6137 |
|
6138 |
// ----- Look for path beginning by ./
|
6139 |
if ( ($p_dir == '.')
|
6140 |
|| ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) {
|
6141 |
$p_dir = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_dir, 1);
|
6142 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Replacing ./ by full path in p_dir '".$p_dir."'");
|
6143 |
}
|
6144 |
if ( ($p_path == '.')
|
6145 |
|| ((strlen($p_path) >=2) && (substr($p_path, 0, 2) == './'))) {
|
6146 |
$p_path = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_path, 1);
|
6147 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Replacing ./ by full path in p_path '".$p_path."'");
|
6148 |
}
|
6149 |
|
6150 |
// ----- Explode dir and path by directory separator
|
@@ -6157,7 +5498,6 @@
|
|
6157 |
$i = 0;
|
6158 |
$j = 0;
|
6159 |
while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && ($v_result)) {
|
6160 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Working on dir($i)='".$v_list_dir[$i]."' and path($j)='".$v_list_path[$j]."'");
|
6161 |
|
6162 |
// ----- Look for empty dir (path reduction)
|
6163 |
if ($v_list_dir[$i] == '') {
|
@@ -6171,7 +5511,6 @@
|
|
6171 |
|
6172 |
// ----- Compare the items
|
6173 |
if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ( $v_list_path[$j] != '')) {
|
6174 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Items ($i,$j) are different");
|
6175 |
$v_result = 0;
|
6176 |
}
|
6177 |
|
@@ -6182,11 +5521,9 @@
|
|
6182 |
|
6183 |
// ----- Look if everything seems to be the same
|
6184 |
if ($v_result) {
|
6185 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Look for tie break");
|
6186 |
// ----- Skip all the empty items
|
6187 |
while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++;
|
6188 |
while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++;
|
6189 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Looking on dir($i)='".($i < $v_list_dir_size?$v_list_dir[$i]:'')."' and path($j)='".($j < $v_list_path_size?$v_list_path[$j]:'')."'");
|
6190 |
|
6191 |
if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) {
|
6192 |
// ----- There are exactly the same
|
@@ -6199,7 +5536,6 @@
|
|
6199 |
}
|
6200 |
|
6201 |
// ----- Return
|
6202 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
6203 |
return $v_result;
|
6204 |
}
|
6205 |
// --------------------------------------------------------------------------------
|
@@ -6217,30 +5553,23 @@
|
|
6217 |
// --------------------------------------------------------------------------------
|
6218 |
function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0)
|
6219 |
{
|
6220 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilCopyBlock", "size=$p_size, mode=$p_mode");
|
6221 |
$v_result = 1;
|
6222 |
|
6223 |
if ($p_mode==0)
|
6224 |
{
|
6225 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Src offset before read :".(@ftell($p_src)));
|
6226 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Dest offset before write :".(@ftell($p_dest)));
|
6227 |
while ($p_size != 0)
|
6228 |
{
|
6229 |
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
|
6230 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
6231 |
$v_buffer = @fread($p_src, $v_read_size);
|
6232 |
@fwrite($p_dest, $v_buffer, $v_read_size);
|
6233 |
$p_size -= $v_read_size;
|
6234 |
}
|
6235 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Src offset after read :".(@ftell($p_src)));
|
6236 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Dest offset after write :".(@ftell($p_dest)));
|
6237 |
}
|
6238 |
else if ($p_mode==1)
|
6239 |
{
|
6240 |
while ($p_size != 0)
|
6241 |
{
|
6242 |
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
|
6243 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
6244 |
$v_buffer = @gzread($p_src, $v_read_size);
|
6245 |
@fwrite($p_dest, $v_buffer, $v_read_size);
|
6246 |
$p_size -= $v_read_size;
|
@@ -6251,7 +5580,6 @@
|
|
6251 |
while ($p_size != 0)
|
6252 |
{
|
6253 |
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
|
6254 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
6255 |
$v_buffer = @fread($p_src, $v_read_size);
|
6256 |
@gzwrite($p_dest, $v_buffer, $v_read_size);
|
6257 |
$p_size -= $v_read_size;
|
@@ -6262,7 +5590,6 @@
|
|
6262 |
while ($p_size != 0)
|
6263 |
{
|
6264 |
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
|
6265 |
-
PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
6266 |
$v_buffer = @gzread($p_src, $v_read_size);
|
6267 |
@gzwrite($p_dest, $v_buffer, $v_read_size);
|
6268 |
$p_size -= $v_read_size;
|
@@ -6270,7 +5597,6 @@
|
|
6270 |
}
|
6271 |
|
6272 |
// ----- Return
|
6273 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
6274 |
return $v_result;
|
6275 |
}
|
6276 |
// --------------------------------------------------------------------------------
|
@@ -6289,26 +5615,21 @@
|
|
6289 |
// --------------------------------------------------------------------------------
|
6290 |
function PclZipUtilRename($p_src, $p_dest)
|
6291 |
{
|
6292 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilRename", "source=$p_src, destination=$p_dest");
|
6293 |
$v_result = 1;
|
6294 |
|
6295 |
// ----- Try to rename the files
|
6296 |
if (!@rename($p_src, $p_dest)) {
|
6297 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to rename file, try copy+unlink");
|
6298 |
|
6299 |
// ----- Try to copy & unlink the src
|
6300 |
if (!@copy($p_src, $p_dest)) {
|
6301 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to copy file");
|
6302 |
$v_result = 0;
|
6303 |
}
|
6304 |
else if (!@unlink($p_src)) {
|
6305 |
-
PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to unlink old filename");
|
6306 |
$v_result = 0;
|
6307 |
}
|
6308 |
}
|
6309 |
|
6310 |
// ----- Return
|
6311 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
6312 |
return $v_result;
|
6313 |
}
|
6314 |
// --------------------------------------------------------------------------------
|
@@ -6324,7 +5645,6 @@
|
|
6324 |
// --------------------------------------------------------------------------------
|
6325 |
function PclZipUtilOptionText($p_option)
|
6326 |
{
|
6327 |
-
PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilOptionText", "option='".$p_option."'");
|
6328 |
|
6329 |
$v_list = get_defined_constants();
|
6330 |
for (reset($v_list); $v_key = key($v_list); next($v_list)) {
|
@@ -6333,14 +5653,12 @@
|
|
6333 |
|| ($v_prefix == 'PCLZIP_CB_')
|
6334 |
|| ($v_prefix == 'PCLZIP_ATT'))
|
6335 |
&& ($v_list[$v_key] == $p_option)) {
|
6336 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_key);
|
6337 |
return $v_key;
|
6338 |
}
|
6339 |
}
|
6340 |
|
6341 |
$v_result = 'Unknown';
|
6342 |
|
6343 |
-
PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
6344 |
return $v_result;
|
6345 |
}
|
6346 |
// --------------------------------------------------------------------------------
|
22 |
// The use of this software is at the risk of the user.
|
23 |
//
|
24 |
// --------------------------------------------------------------------------------
|
25 |
+
// $Id: pclzip.lib.php,v 1.60 2009/09/30 21:01:04 vblavet Exp $
|
26 |
// --------------------------------------------------------------------------------
|
27 |
|
28 |
// ----- Constants
|
214 |
// --------------------------------------------------------------------------------
|
215 |
function PclZip($p_zipname)
|
216 |
{
|
|
|
217 |
|
218 |
// ----- Tests the zlib
|
219 |
if (!function_exists('gzopen'))
|
220 |
{
|
|
|
221 |
die('Abort '.basename(__FILE__).' : Missing zlib extensions');
|
222 |
}
|
223 |
|
227 |
$this->magic_quotes_status = -1;
|
228 |
|
229 |
// ----- Return
|
|
|
230 |
return;
|
231 |
}
|
232 |
// --------------------------------------------------------------------------------
|
270 |
// --------------------------------------------------------------------------------
|
271 |
function create($p_filelist)
|
272 |
{
|
|
|
273 |
$v_result=1;
|
274 |
|
275 |
// ----- Reset the error handler
|
281 |
|
282 |
// ----- Look for variable options arguments
|
283 |
$v_size = func_num_args();
|
|
|
284 |
|
285 |
// ----- Look for arguments
|
286 |
if ($v_size > 1) {
|
293 |
|
294 |
// ----- Look for first arg
|
295 |
if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
|
|
|
296 |
|
297 |
// ----- Parse the options
|
298 |
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
|
309 |
//, PCLZIP_OPT_CRYPT => 'optional'
|
310 |
));
|
311 |
if ($v_result != 1) {
|
|
|
312 |
return 0;
|
313 |
}
|
314 |
}
|
317 |
// Here we need to support the first historic synopsis of the
|
318 |
// method.
|
319 |
else {
|
|
|
320 |
|
321 |
// ----- Get the first argument
|
322 |
$v_options[PCLZIP_OPT_ADD_PATH] = $v_arg_list[0];
|
328 |
else if ($v_size > 2) {
|
329 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
|
330 |
"Invalid number / type of arguments");
|
|
|
331 |
return 0;
|
332 |
}
|
333 |
}
|
366 |
// ----- Invalid variable type for $p_filelist
|
367 |
else {
|
368 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist");
|
|
|
369 |
return 0;
|
370 |
}
|
371 |
|
376 |
$v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
|
377 |
}
|
378 |
else {
|
|
|
379 |
}
|
380 |
}
|
381 |
}
|
395 |
$v_options,
|
396 |
$v_supported_attributes);
|
397 |
if ($v_result != 1) {
|
|
|
398 |
return 0;
|
399 |
}
|
400 |
}
|
402 |
// ----- Expand the filelist (expand directories)
|
403 |
$v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
|
404 |
if ($v_result != 1) {
|
|
|
405 |
return 0;
|
406 |
}
|
407 |
|
408 |
// ----- Call the create fct
|
409 |
$v_result = $this->privCreate($v_filedescr_list, $p_result_list, $v_options);
|
410 |
if ($v_result != 1) {
|
|
|
411 |
return 0;
|
412 |
}
|
413 |
|
414 |
// ----- Return
|
|
|
415 |
return $p_result_list;
|
416 |
}
|
417 |
// --------------------------------------------------------------------------------
|
453 |
// --------------------------------------------------------------------------------
|
454 |
function add($p_filelist)
|
455 |
{
|
|
|
456 |
$v_result=1;
|
457 |
|
458 |
// ----- Reset the error handler
|
464 |
|
465 |
// ----- Look for variable options arguments
|
466 |
$v_size = func_num_args();
|
|
|
467 |
|
468 |
// ----- Look for arguments
|
469 |
if ($v_size > 1) {
|
476 |
|
477 |
// ----- Look for first arg
|
478 |
if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
|
|
|
479 |
|
480 |
// ----- Parse the options
|
481 |
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
|
494 |
//, PCLZIP_OPT_CRYPT => 'optional'
|
495 |
));
|
496 |
if ($v_result != 1) {
|
|
|
497 |
return 0;
|
498 |
}
|
499 |
}
|
502 |
// Here we need to support the first historic synopsis of the
|
503 |
// method.
|
504 |
else {
|
|
|
505 |
|
506 |
// ----- Get the first argument
|
507 |
$v_options[PCLZIP_OPT_ADD_PATH] = $v_add_path = $v_arg_list[0];
|
515 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
|
516 |
|
517 |
// ----- Return
|
|
|
518 |
return 0;
|
519 |
}
|
520 |
}
|
553 |
// ----- Invalid variable type for $p_filelist
|
554 |
else {
|
555 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '".gettype($p_filelist)."' for p_filelist");
|
|
|
556 |
return 0;
|
557 |
}
|
558 |
|
578 |
$v_options,
|
579 |
$v_supported_attributes);
|
580 |
if ($v_result != 1) {
|
|
|
581 |
return 0;
|
582 |
}
|
583 |
}
|
585 |
// ----- Expand the filelist (expand directories)
|
586 |
$v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
|
587 |
if ($v_result != 1) {
|
|
|
588 |
return 0;
|
589 |
}
|
590 |
|
591 |
// ----- Call the create fct
|
592 |
$v_result = $this->privAdd($v_filedescr_list, $p_result_list, $v_options);
|
593 |
if ($v_result != 1) {
|
|
|
594 |
return 0;
|
595 |
}
|
596 |
|
597 |
// ----- Return
|
|
|
598 |
return $p_result_list;
|
599 |
}
|
600 |
// --------------------------------------------------------------------------------
|
642 |
// --------------------------------------------------------------------------------
|
643 |
function listContent()
|
644 |
{
|
|
|
645 |
$v_result=1;
|
646 |
|
647 |
// ----- Reset the error handler
|
649 |
|
650 |
// ----- Check archive
|
651 |
if (!$this->privCheckFormat()) {
|
|
|
652 |
return(0);
|
653 |
}
|
654 |
|
657 |
if (($v_result = $this->privList($p_list)) != 1)
|
658 |
{
|
659 |
unset($p_list);
|
|
|
660 |
return(0);
|
661 |
}
|
662 |
|
663 |
// ----- Return
|
|
|
664 |
return $p_list;
|
665 |
}
|
666 |
// --------------------------------------------------------------------------------
|
699 |
// --------------------------------------------------------------------------------
|
700 |
function extract()
|
701 |
{
|
|
|
702 |
$v_result=1;
|
703 |
|
704 |
// ----- Reset the error handler
|
706 |
|
707 |
// ----- Check archive
|
708 |
if (!$this->privCheckFormat()) {
|
|
|
709 |
return(0);
|
710 |
}
|
711 |
|
718 |
|
719 |
// ----- Look for variable options arguments
|
720 |
$v_size = func_num_args();
|
|
|
721 |
|
722 |
// ----- Default values for option
|
723 |
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
|
729 |
|
730 |
// ----- Look for first arg
|
731 |
if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
|
|
|
732 |
|
733 |
// ----- Parse the options
|
734 |
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
|
753 |
PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
|
754 |
));
|
755 |
if ($v_result != 1) {
|
|
|
756 |
return 0;
|
757 |
}
|
758 |
|
779 |
// Here we need to support the first historic synopsis of the
|
780 |
// method.
|
781 |
else {
|
|
|
782 |
|
783 |
// ----- Get the first argument
|
784 |
$v_path = $v_arg_list[0];
|
792 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
|
793 |
|
794 |
// ----- Return
|
|
|
795 |
return 0;
|
796 |
}
|
797 |
}
|
801 |
$this->privOptionDefaultThreshold($v_options);
|
802 |
|
803 |
// ----- Trace
|
|
|
804 |
|
805 |
// ----- Call the extracting fct
|
806 |
$p_list = array();
|
808 |
$v_remove_all_path, $v_options);
|
809 |
if ($v_result < 1) {
|
810 |
unset($p_list);
|
|
|
811 |
return(0);
|
812 |
}
|
813 |
|
814 |
// ----- Return
|
|
|
815 |
return $p_list;
|
816 |
}
|
817 |
// --------------------------------------------------------------------------------
|
856 |
//function extractByIndex($p_index, options...)
|
857 |
function extractByIndex($p_index)
|
858 |
{
|
|
|
859 |
$v_result=1;
|
860 |
|
861 |
// ----- Reset the error handler
|
863 |
|
864 |
// ----- Check archive
|
865 |
if (!$this->privCheckFormat()) {
|
|
|
866 |
return(0);
|
867 |
}
|
868 |
|
875 |
|
876 |
// ----- Look for variable options arguments
|
877 |
$v_size = func_num_args();
|
|
|
878 |
|
879 |
// ----- Default values for option
|
880 |
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
|
890 |
|
891 |
// ----- Look for first arg
|
892 |
if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
|
|
|
893 |
|
894 |
// ----- Parse the options
|
895 |
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
|
909 |
PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
|
910 |
));
|
911 |
if ($v_result != 1) {
|
|
|
912 |
return 0;
|
913 |
}
|
914 |
|
931 |
}
|
932 |
if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) {
|
933 |
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
|
|
|
934 |
}
|
935 |
else {
|
|
|
936 |
}
|
937 |
}
|
938 |
|
940 |
// Here we need to support the first historic synopsis of the
|
941 |
// method.
|
942 |
else {
|
|
|
943 |
|
944 |
// ----- Get the first argument
|
945 |
$v_path = $v_arg_list[0];
|
953 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
|
954 |
|
955 |
// ----- Return
|
|
|
956 |
return 0;
|
957 |
}
|
958 |
}
|
959 |
}
|
960 |
|
961 |
// ----- Trace
|
|
|
962 |
|
963 |
// ----- Trick
|
964 |
// Here I want to reuse extractByRule(), so I need to parse the $p_index
|
968 |
$v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick,
|
969 |
array (PCLZIP_OPT_BY_INDEX => 'optional' ));
|
970 |
if ($v_result != 1) {
|
|
|
971 |
return 0;
|
972 |
}
|
973 |
$v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX];
|
977 |
|
978 |
// ----- Call the extracting fct
|
979 |
if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) {
|
|
|
980 |
return(0);
|
981 |
}
|
982 |
|
983 |
// ----- Return
|
|
|
984 |
return $p_list;
|
985 |
}
|
986 |
// --------------------------------------------------------------------------------
|
1005 |
// --------------------------------------------------------------------------------
|
1006 |
function delete()
|
1007 |
{
|
|
|
1008 |
$v_result=1;
|
1009 |
|
1010 |
// ----- Reset the error handler
|
1012 |
|
1013 |
// ----- Check archive
|
1014 |
if (!$this->privCheckFormat()) {
|
|
|
1015 |
return(0);
|
1016 |
}
|
1017 |
|
1020 |
|
1021 |
// ----- Look for variable options arguments
|
1022 |
$v_size = func_num_args();
|
|
|
1023 |
|
1024 |
// ----- Look for arguments
|
1025 |
if ($v_size > 0) {
|
1033 |
PCLZIP_OPT_BY_PREG => 'optional',
|
1034 |
PCLZIP_OPT_BY_INDEX => 'optional' ));
|
1035 |
if ($v_result != 1) {
|
|
|
1036 |
return 0;
|
1037 |
}
|
1038 |
}
|
1045 |
if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) {
|
1046 |
$this->privSwapBackMagicQuotes();
|
1047 |
unset($v_list);
|
|
|
1048 |
return(0);
|
1049 |
}
|
1050 |
|
1052 |
$this->privSwapBackMagicQuotes();
|
1053 |
|
1054 |
// ----- Return
|
|
|
1055 |
return $v_list;
|
1056 |
}
|
1057 |
// --------------------------------------------------------------------------------
|
1064 |
// --------------------------------------------------------------------------------
|
1065 |
function deleteByIndex($p_index)
|
1066 |
{
|
|
|
1067 |
|
1068 |
$p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index);
|
1069 |
|
1070 |
// ----- Return
|
|
|
1071 |
return $p_list;
|
1072 |
}
|
1073 |
// --------------------------------------------------------------------------------
|
1088 |
// --------------------------------------------------------------------------------
|
1089 |
function properties()
|
1090 |
{
|
|
|
1091 |
|
1092 |
// ----- Reset the error handler
|
1093 |
$this->privErrorReset();
|
1098 |
// ----- Check archive
|
1099 |
if (!$this->privCheckFormat()) {
|
1100 |
$this->privSwapBackMagicQuotes();
|
|
|
1101 |
return(0);
|
1102 |
}
|
1103 |
|
1111 |
if (@is_file($this->zipname))
|
1112 |
{
|
1113 |
// ----- Open the zip file
|
|
|
1114 |
if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
|
1115 |
{
|
1116 |
$this->privSwapBackMagicQuotes();
|
1119 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
|
1120 |
|
1121 |
// ----- Return
|
|
|
1122 |
return 0;
|
1123 |
}
|
1124 |
|
1127 |
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
|
1128 |
{
|
1129 |
$this->privSwapBackMagicQuotes();
|
|
|
1130 |
return 0;
|
1131 |
}
|
1132 |
|
1143 |
$this->privSwapBackMagicQuotes();
|
1144 |
|
1145 |
// ----- Return
|
|
|
1146 |
return $v_prop;
|
1147 |
}
|
1148 |
// --------------------------------------------------------------------------------
|
1161 |
// --------------------------------------------------------------------------------
|
1162 |
function duplicate($p_archive)
|
1163 |
{
|
|
|
1164 |
$v_result = 1;
|
1165 |
|
1166 |
// ----- Reset the error handler
|
1169 |
// ----- Look if the $p_archive is a PclZip object
|
1170 |
if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip'))
|
1171 |
{
|
|
|
1172 |
|
1173 |
// ----- Duplicate the archive
|
1174 |
$v_result = $this->privDuplicate($p_archive->zipname);
|
1177 |
// ----- Look if the $p_archive is a string (so a filename)
|
1178 |
else if (is_string($p_archive))
|
1179 |
{
|
|
|
1180 |
|
1181 |
// ----- Check that $p_archive is a valid zip file
|
1182 |
// TBC : Should also check the archive format
|
1200 |
}
|
1201 |
|
1202 |
// ----- Return
|
|
|
1203 |
return $v_result;
|
1204 |
}
|
1205 |
// --------------------------------------------------------------------------------
|
1220 |
// --------------------------------------------------------------------------------
|
1221 |
function merge($p_archive_to_add)
|
1222 |
{
|
|
|
1223 |
$v_result = 1;
|
1224 |
|
1225 |
// ----- Reset the error handler
|
1227 |
|
1228 |
// ----- Check archive
|
1229 |
if (!$this->privCheckFormat()) {
|
|
|
1230 |
return(0);
|
1231 |
}
|
1232 |
|
1233 |
// ----- Look if the $p_archive_to_add is a PclZip object
|
1234 |
if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip'))
|
1235 |
{
|
|
|
1236 |
|
1237 |
// ----- Merge the archive
|
1238 |
$v_result = $this->privMerge($p_archive_to_add);
|
1241 |
// ----- Look if the $p_archive_to_add is a string (so a filename)
|
1242 |
else if (is_string($p_archive_to_add))
|
1243 |
{
|
|
|
1244 |
|
1245 |
// ----- Create a temporary archive
|
1246 |
$v_object_archive = new PclZip($p_archive_to_add);
|
1258 |
}
|
1259 |
|
1260 |
// ----- Return
|
|
|
1261 |
return $v_result;
|
1262 |
}
|
1263 |
// --------------------------------------------------------------------------------
|
1372 |
// --------------------------------------------------------------------------------
|
1373 |
function privCheckFormat($p_level=0)
|
1374 |
{
|
|
|
1375 |
$v_result = true;
|
1376 |
|
1377 |
// ----- Reset the file system cache
|
1384 |
if (!is_file($this->zipname)) {
|
1385 |
// ----- Error log
|
1386 |
PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '".$this->zipname."'");
|
|
|
1387 |
return(false);
|
1388 |
}
|
1389 |
|
1391 |
if (!is_readable($this->zipname)) {
|
1392 |
// ----- Error log
|
1393 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '".$this->zipname."'");
|
|
|
1394 |
return(false);
|
1395 |
}
|
1396 |
|
1404 |
// TBC
|
1405 |
|
1406 |
// ----- Return
|
|
|
1407 |
return $v_result;
|
1408 |
}
|
1409 |
// --------------------------------------------------------------------------------
|
1425 |
// --------------------------------------------------------------------------------
|
1426 |
function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options=false)
|
1427 |
{
|
|
|
1428 |
$v_result=1;
|
1429 |
|
1430 |
// ----- Read the options
|
1431 |
$i=0;
|
1432 |
while ($i<$p_size) {
|
|
|
1433 |
|
1434 |
// ----- Check if the option is supported
|
1435 |
if (!isset($v_requested_options[$p_options_list[$i]])) {
|
1437 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '".$p_options_list[$i]."' for this method");
|
1438 |
|
1439 |
// ----- Return
|
|
|
1440 |
return PclZip::errorCode();
|
1441 |
}
|
1442 |
|
1452 |
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1453 |
|
1454 |
// ----- Return
|
|
|
1455 |
return PclZip::errorCode();
|
1456 |
}
|
1457 |
|
1458 |
// ----- Get the value
|
1459 |
$v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
|
|
|
1460 |
$i++;
|
1461 |
break;
|
1462 |
|
1464 |
// ----- Check the number of parameters
|
1465 |
if (($i+1) >= $p_size) {
|
1466 |
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
|
|
1467 |
return PclZip::errorCode();
|
1468 |
}
|
1469 |
|
1470 |
// ----- Check for incompatible options
|
1471 |
if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
|
1472 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
|
|
|
1473 |
return PclZip::errorCode();
|
1474 |
}
|
1475 |
|
1477 |
$v_value = $p_options_list[$i+1];
|
1478 |
if ((!is_integer($v_value)) || ($v_value<0)) {
|
1479 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
|
|
1480 |
return PclZip::errorCode();
|
1481 |
}
|
1482 |
|
1483 |
// ----- Get the value (and convert it in bytes)
|
1484 |
$v_result_list[$p_options_list[$i]] = $v_value*1048576;
|
|
|
1485 |
$i++;
|
1486 |
break;
|
1487 |
|
1489 |
// ----- Check for incompatible options
|
1490 |
if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
|
1491 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
|
|
|
1492 |
return PclZip::errorCode();
|
1493 |
}
|
1494 |
|
1495 |
$v_result_list[$p_options_list[$i]] = true;
|
|
|
1496 |
break;
|
1497 |
|
1498 |
case PCLZIP_OPT_TEMP_FILE_OFF :
|
1499 |
// ----- Check for incompatible options
|
1500 |
if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_ON])) {
|
1501 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_ON'");
|
|
|
1502 |
return PclZip::errorCode();
|
1503 |
}
|
1504 |
// ----- Check for incompatible options
|
1505 |
if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
|
1506 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_THRESHOLD'");
|
|
|
1507 |
return PclZip::errorCode();
|
1508 |
}
|
1509 |
|
1510 |
$v_result_list[$p_options_list[$i]] = true;
|
|
|
1511 |
break;
|
1512 |
|
1513 |
case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION :
|
1517 |
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1518 |
|
1519 |
// ----- Return
|
|
|
1520 |
return PclZip::errorCode();
|
1521 |
}
|
1522 |
|
1524 |
if ( is_string($p_options_list[$i+1])
|
1525 |
&& ($p_options_list[$i+1] != '')) {
|
1526 |
$v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
|
|
|
1527 |
$i++;
|
1528 |
}
|
1529 |
else {
|
|
|
1530 |
}
|
1531 |
break;
|
1532 |
|
1538 |
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1539 |
|
1540 |
// ----- Return
|
|
|
1541 |
return PclZip::errorCode();
|
1542 |
}
|
1543 |
|
1553 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1554 |
|
1555 |
// ----- Return
|
|
|
1556 |
return PclZip::errorCode();
|
1557 |
}
|
|
|
1558 |
$i++;
|
1559 |
break;
|
1560 |
|
1571 |
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1572 |
|
1573 |
// ----- Return
|
|
|
1574 |
return PclZip::errorCode();
|
1575 |
}
|
1576 |
|
1583 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1584 |
|
1585 |
// ----- Return
|
|
|
1586 |
return PclZip::errorCode();
|
1587 |
}
|
|
|
1588 |
$i++;
|
1589 |
break;
|
1590 |
|
1601 |
."'");
|
1602 |
|
1603 |
// ----- Return
|
|
|
1604 |
return PclZip::errorCode();
|
1605 |
}
|
1606 |
|
1616 |
."'");
|
1617 |
|
1618 |
// ----- Return
|
|
|
1619 |
return PclZip::errorCode();
|
1620 |
}
|
|
|
1621 |
$i++;
|
1622 |
break;
|
1623 |
|
1629 |
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1630 |
|
1631 |
// ----- Return
|
|
|
1632 |
return PclZip::errorCode();
|
1633 |
}
|
1634 |
|
1635 |
// ----- Get the value
|
1636 |
$v_work_list = array();
|
1637 |
if (is_string($p_options_list[$i+1])) {
|
|
|
1638 |
|
1639 |
// ----- Remove spaces
|
1640 |
$p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', '');
|
1643 |
$v_work_list = explode(",", $p_options_list[$i+1]);
|
1644 |
}
|
1645 |
else if (is_integer($p_options_list[$i+1])) {
|
|
|
1646 |
$v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1];
|
1647 |
}
|
1648 |
else if (is_array($p_options_list[$i+1])) {
|
|
|
1649 |
$v_work_list = $p_options_list[$i+1];
|
1650 |
}
|
1651 |
else {
|
1653 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1654 |
|
1655 |
// ----- Return
|
|
|
1656 |
return PclZip::errorCode();
|
1657 |
}
|
1658 |
|
1686 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Too many values in index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1687 |
|
1688 |
// ----- Return
|
|
|
1689 |
return PclZip::errorCode();
|
1690 |
}
|
1691 |
|
|
|
1692 |
|
1693 |
// ----- Look for list sort
|
1694 |
if ($v_result_list[$p_options_list[$i]][$j]['start'] < $v_sort_value) {
|
|
|
1695 |
$v_sort_flag=true;
|
1696 |
|
1697 |
// ----- TBC : An automatic sort should be writen ...
|
1699 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Invalid order of index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1700 |
|
1701 |
// ----- Return
|
|
|
1702 |
return PclZip::errorCode();
|
1703 |
}
|
1704 |
$v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start'];
|
1707 |
// ----- Sort the items
|
1708 |
if ($v_sort_flag) {
|
1709 |
// TBC : To Be Completed
|
|
|
1710 |
}
|
1711 |
|
1712 |
// ----- Next option
|
1721 |
case PCLZIP_OPT_REPLACE_NEWER :
|
1722 |
case PCLZIP_OPT_STOP_ON_ERROR :
|
1723 |
$v_result_list[$p_options_list[$i]] = true;
|
|
|
1724 |
break;
|
1725 |
|
1726 |
// ----- Look for options that request an octal value
|
1731 |
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1732 |
|
1733 |
// ----- Return
|
|
|
1734 |
return PclZip::errorCode();
|
1735 |
}
|
1736 |
|
1737 |
// ----- Get the value
|
1738 |
$v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
|
|
|
1739 |
$i++;
|
1740 |
break;
|
1741 |
|
1756 |
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1757 |
|
1758 |
// ----- Return
|
|
|
1759 |
return PclZip::errorCode();
|
1760 |
}
|
1761 |
|
1762 |
// ----- Get the value
|
1763 |
$v_function_name = $p_options_list[$i+1];
|
|
|
1764 |
|
1765 |
// ----- Check that the value is a valid existing function
|
1766 |
if (!function_exists($v_function_name)) {
|
1768 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '".$v_function_name."()' is not an existing function for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1769 |
|
1770 |
// ----- Return
|
|
|
1771 |
return PclZip::errorCode();
|
1772 |
}
|
1773 |
|
1783 |
.$p_options_list[$i]."'");
|
1784 |
|
1785 |
// ----- Return
|
|
|
1786 |
return PclZip::errorCode();
|
1787 |
}
|
1788 |
|
1795 |
for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
|
1796 |
// ----- Look for mandatory option
|
1797 |
if ($v_requested_options[$key] == 'mandatory') {
|
|
|
1798 |
// ----- Look if present
|
1799 |
if (!isset($v_result_list[$key])) {
|
1800 |
// ----- Error log
|
1801 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
|
1802 |
|
1803 |
// ----- Return
|
|
|
1804 |
return PclZip::errorCode();
|
1805 |
}
|
1806 |
}
|
1809 |
|
1810 |
// ----- Look for default values
|
1811 |
if (!isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
|
|
|
1812 |
|
1813 |
}
|
1814 |
|
1815 |
// ----- Return
|
|
|
1816 |
return $v_result;
|
1817 |
}
|
1818 |
// --------------------------------------------------------------------------------
|
1825 |
// --------------------------------------------------------------------------------
|
1826 |
function privOptionDefaultThreshold(&$p_options)
|
1827 |
{
|
|
|
1828 |
$v_result=1;
|
1829 |
|
1830 |
if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
|
1831 |
|| isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) {
|
|
|
1832 |
return $v_result;
|
1833 |
}
|
1834 |
|
|
|
1835 |
// ----- Get 'memory_limit' configuration value
|
1836 |
$v_memory_limit = ini_get('memory_limit');
|
1837 |
$v_memory_limit = trim($v_memory_limit);
|
1848 |
|
1849 |
$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO);
|
1850 |
|
|
|
|
|
1851 |
|
1852 |
// ----- Sanity check : No threshold if value lower than 1M
|
1853 |
if ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] < 1048576) {
|
|
|
1854 |
unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]);
|
1855 |
}
|
1856 |
|
1857 |
// ----- Return
|
|
|
1858 |
return $v_result;
|
1859 |
}
|
1860 |
// --------------------------------------------------------------------------------
|
1869 |
// --------------------------------------------------------------------------------
|
1870 |
function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options=false)
|
1871 |
{
|
|
|
1872 |
$v_result=1;
|
1873 |
|
1874 |
// ----- For each file in the list check the attributes
|
1880 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '".$v_key."' for this file");
|
1881 |
|
1882 |
// ----- Return
|
|
|
1883 |
return PclZip::errorCode();
|
1884 |
}
|
1885 |
|
1888 |
case PCLZIP_ATT_FILE_NAME :
|
1889 |
if (!is_string($v_value)) {
|
1890 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
|
|
|
1891 |
return PclZip::errorCode();
|
1892 |
}
|
1893 |
|
1894 |
$p_filedescr['filename'] = PclZipUtilPathReduction($v_value);
|
|
|
1895 |
|
1896 |
if ($p_filedescr['filename'] == '') {
|
1897 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'");
|
|
|
1898 |
return PclZip::errorCode();
|
1899 |
}
|
1900 |
|
1903 |
case PCLZIP_ATT_FILE_NEW_SHORT_NAME :
|
1904 |
if (!is_string($v_value)) {
|
1905 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
|
|
|
1906 |
return PclZip::errorCode();
|
1907 |
}
|
1908 |
|
1909 |
$p_filedescr['new_short_name'] = PclZipUtilPathReduction($v_value);
|
|
|
1910 |
|
1911 |
if ($p_filedescr['new_short_name'] == '') {
|
1912 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '".PclZipUtilOptionText($v_key)."'");
|
|
|
1913 |
return PclZip::errorCode();
|
1914 |
}
|
1915 |
break;
|
1917 |
case PCLZIP_ATT_FILE_NEW_FULL_NAME :
|
1918 |
if (!is_string($v_value)) {
|
1919 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
|
|
|
1920 |
return PclZip::errorCode();
|
1921 |
}
|
1922 |
|
1923 |
$p_filedescr['new_full_name'] = PclZipUtilPathReduction($v_value);
|
|
|
1924 |
|
1925 |
if ($p_filedescr['new_full_name'] == '') {
|
1926 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '".PclZipUtilOptionText($v_key)."'");
|
|
|
1927 |
return PclZip::errorCode();
|
1928 |
}
|
1929 |
break;
|
1932 |
case PCLZIP_ATT_FILE_COMMENT :
|
1933 |
if (!is_string($v_value)) {
|
1934 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
|
|
|
1935 |
return PclZip::errorCode();
|
1936 |
}
|
1937 |
|
1938 |
$p_filedescr['comment'] = $v_value;
|
|
|
1939 |
break;
|
1940 |
|
1941 |
case PCLZIP_ATT_FILE_MTIME :
|
1942 |
if (!is_integer($v_value)) {
|
1943 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". Integer expected for attribute '".PclZipUtilOptionText($v_key)."'");
|
|
|
1944 |
return PclZip::errorCode();
|
1945 |
}
|
1946 |
|
1947 |
$p_filedescr['mtime'] = $v_value;
|
|
|
1948 |
break;
|
1949 |
|
1950 |
case PCLZIP_ATT_FILE_CONTENT :
|
1951 |
$p_filedescr['content'] = $v_value;
|
|
|
1952 |
break;
|
1953 |
|
1954 |
default :
|
1957 |
"Unknown parameter '".$v_key."'");
|
1958 |
|
1959 |
// ----- Return
|
|
|
1960 |
return PclZip::errorCode();
|
1961 |
}
|
1962 |
|
1965 |
for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
|
1966 |
// ----- Look for mandatory option
|
1967 |
if ($v_requested_options[$key] == 'mandatory') {
|
|
|
1968 |
// ----- Look if present
|
1969 |
if (!isset($p_file_list[$key])) {
|
1970 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
|
|
|
1971 |
return PclZip::errorCode();
|
1972 |
}
|
1973 |
}
|
1978 |
}
|
1979 |
|
1980 |
// ----- Return
|
|
|
1981 |
return $v_result;
|
1982 |
}
|
1983 |
// --------------------------------------------------------------------------------
|
1998 |
// --------------------------------------------------------------------------------
|
1999 |
function privFileDescrExpand(&$p_filedescr_list, &$p_options)
|
2000 |
{
|
|
|
2001 |
$v_result=1;
|
2002 |
|
2003 |
// ----- Create a result list
|
2005 |
|
2006 |
// ----- Look each entry
|
2007 |
for ($i=0; $i<sizeof($p_filedescr_list); $i++) {
|
|
|
2008 |
|
2009 |
// ----- Get filedescr
|
2010 |
$v_descr = $p_filedescr_list[$i];
|
2011 |
|
2012 |
// ----- Reduce the filename
|
|
|
2013 |
$v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename'], false);
|
2014 |
$v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']);
|
|
|
2015 |
|
2016 |
// ----- Look for real file or folder
|
2017 |
if (file_exists($v_descr['filename'])) {
|
2018 |
if (@is_file($v_descr['filename'])) {
|
|
|
2019 |
$v_descr['type'] = 'file';
|
2020 |
}
|
2021 |
else if (@is_dir($v_descr['filename'])) {
|
|
|
2022 |
$v_descr['type'] = 'folder';
|
2023 |
}
|
2024 |
else if (@is_link($v_descr['filename'])) {
|
|
|
2025 |
// skip
|
2026 |
continue;
|
2027 |
}
|
2028 |
else {
|
|
|
2029 |
// skip
|
2030 |
continue;
|
2031 |
}
|
2033 |
|
2034 |
// ----- Look for string added as file
|
2035 |
else if (isset($v_descr['content'])) {
|
|
|
2036 |
$v_descr['type'] = 'virtual_file';
|
2037 |
}
|
2038 |
|
2039 |
// ----- Missing file
|
2040 |
else {
|
2041 |
// ----- Error log
|
|
|
2042 |
PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$v_descr['filename']."' does not exist");
|
2043 |
|
2044 |
// ----- Return
|
|
|
2045 |
return PclZip::errorCode();
|
2046 |
}
|
2047 |
|
2058 |
$v_dirlist_nb = 0;
|
2059 |
if ($v_folder_handler = @opendir($v_descr['filename'])) {
|
2060 |
while (($v_item_handler = @readdir($v_folder_handler)) !== false) {
|
|
|
2061 |
|
2062 |
// ----- Skip '.' and '..'
|
2063 |
if (($v_item_handler == '.') || ($v_item_handler == '..')) {
|
2072 |
// files/sub-folders also change
|
2073 |
if (($v_descr['stored_filename'] != $v_descr['filename'])
|
2074 |
&& (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) {
|
|
|
2075 |
if ($v_descr['stored_filename'] != '') {
|
2076 |
$v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler;
|
2077 |
}
|
2086 |
@closedir($v_folder_handler);
|
2087 |
}
|
2088 |
else {
|
|
|
2089 |
// TBC : unable to open folder in read mode
|
2090 |
}
|
2091 |
|
2093 |
if ($v_dirlist_nb != 0) {
|
2094 |
// ----- Expand
|
2095 |
if (($v_result = $this->privFileDescrExpand($v_dirlist_descr, $p_options)) != 1) {
|
|
|
2096 |
return $v_result;
|
2097 |
}
|
2098 |
|
2099 |
// ----- Concat the resulting list
|
|
|
2100 |
$v_result_list = array_merge($v_result_list, $v_dirlist_descr);
|
|
|
2101 |
}
|
2102 |
else {
|
|
|
2103 |
}
|
2104 |
|
2105 |
// ----- Free local array
|
2111 |
$p_filedescr_list = $v_result_list;
|
2112 |
|
2113 |
// ----- Return
|
|
|
2114 |
return $v_result;
|
2115 |
}
|
2116 |
// --------------------------------------------------------------------------------
|
2123 |
// --------------------------------------------------------------------------------
|
2124 |
function privCreate($p_filedescr_list, &$p_result_list, &$p_options)
|
2125 |
{
|
|
|
2126 |
$v_result=1;
|
2127 |
$v_list_detail = array();
|
2128 |
|
2133 |
if (($v_result = $this->privOpenFd('wb')) != 1)
|
2134 |
{
|
2135 |
// ----- Return
|
|
|
2136 |
return $v_result;
|
2137 |
}
|
2138 |
|
2146 |
$this->privSwapBackMagicQuotes();
|
2147 |
|
2148 |
// ----- Return
|
|
|
2149 |
return $v_result;
|
2150 |
}
|
2151 |
// --------------------------------------------------------------------------------
|
2158 |
// --------------------------------------------------------------------------------
|
2159 |
function privAdd($p_filedescr_list, &$p_result_list, &$p_options)
|
2160 |
{
|
|
|
2161 |
$v_result=1;
|
2162 |
$v_list_detail = array();
|
2163 |
|
2164 |
// ----- Look if the archive exists or is empty
|
2165 |
if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0))
|
2166 |
{
|
|
|
2167 |
|
2168 |
// ----- Do a create
|
2169 |
$v_result = $this->privCreate($p_filedescr_list, $p_result_list, $p_options);
|
2170 |
|
2171 |
// ----- Return
|
|
|
2172 |
return $v_result;
|
2173 |
}
|
2174 |
// ----- Magic quotes trick
|
2175 |
$this->privDisableMagicQuotes();
|
2176 |
|
2177 |
// ----- Open the zip file
|
|
|
2178 |
if (($v_result=$this->privOpenFd('rb')) != 1)
|
2179 |
{
|
2180 |
// ----- Magic quotes trick
|
2181 |
$this->privSwapBackMagicQuotes();
|
2182 |
|
2183 |
// ----- Return
|
|
|
2184 |
return $v_result;
|
2185 |
}
|
2186 |
|
2190 |
{
|
2191 |
$this->privCloseFd();
|
2192 |
$this->privSwapBackMagicQuotes();
|
|
|
2193 |
return $v_result;
|
2194 |
}
|
2195 |
|
2196 |
// ----- Go to beginning of File
|
|
|
2197 |
@rewind($this->zip_fd);
|
|
|
2198 |
|
2199 |
// ----- Creates a temporay file
|
2200 |
$v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
|
2201 |
|
2202 |
// ----- Open the temporary file in write mode
|
|
|
2203 |
if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
|
2204 |
{
|
2205 |
$this->privCloseFd();
|
2208 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');
|
2209 |
|
2210 |
// ----- Return
|
|
|
2211 |
return PclZip::errorCode();
|
2212 |
}
|
2213 |
|
2217 |
while ($v_size != 0)
|
2218 |
{
|
2219 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
|
|
2220 |
$v_buffer = fread($this->zip_fd, $v_read_size);
|
2221 |
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
|
2222 |
$v_size -= $v_read_size;
|
2239 |
$this->privSwapBackMagicQuotes();
|
2240 |
|
2241 |
// ----- Return
|
|
|
2242 |
return $v_result;
|
2243 |
}
|
2244 |
|
2245 |
// ----- Store the offset of the central dir
|
2246 |
$v_offset = @ftell($this->zip_fd);
|
|
|
2247 |
|
2248 |
// ----- Copy the block of file headers from the old archive
|
2249 |
$v_size = $v_central_dir['size'];
|
2250 |
while ($v_size != 0)
|
2251 |
{
|
2252 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
|
|
2253 |
$v_buffer = @fread($v_zip_temp_fd, $v_read_size);
|
2254 |
@fwrite($this->zip_fd, $v_buffer, $v_read_size);
|
2255 |
$v_size -= $v_read_size;
|
2267 |
$this->privSwapBackMagicQuotes();
|
2268 |
|
2269 |
// ----- Return
|
|
|
2270 |
return $v_result;
|
2271 |
}
|
2272 |
$v_count++;
|
2299 |
$this->privSwapBackMagicQuotes();
|
2300 |
|
2301 |
// ----- Return
|
|
|
2302 |
return $v_result;
|
2303 |
}
|
2304 |
|
2326 |
PclZipUtilRename($v_zip_temp_name, $this->zipname);
|
2327 |
|
2328 |
// ----- Return
|
|
|
2329 |
return $v_result;
|
2330 |
}
|
2331 |
// --------------------------------------------------------------------------------
|
2337 |
// --------------------------------------------------------------------------------
|
2338 |
function privOpenFd($p_mode)
|
2339 |
{
|
|
|
2340 |
$v_result=1;
|
2341 |
|
2342 |
// ----- Look if already open
|
2346 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file \''.$this->zipname.'\' already open');
|
2347 |
|
2348 |
// ----- Return
|
|
|
2349 |
return PclZip::errorCode();
|
2350 |
}
|
2351 |
|
2352 |
// ----- Open the zip file
|
|
|
2353 |
if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0)
|
2354 |
{
|
2355 |
// ----- Error log
|
2356 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in '.$p_mode.' mode');
|
2357 |
|
2358 |
// ----- Return
|
|
|
2359 |
return PclZip::errorCode();
|
2360 |
}
|
2361 |
|
2362 |
// ----- Return
|
|
|
2363 |
return $v_result;
|
2364 |
}
|
2365 |
// --------------------------------------------------------------------------------
|
2371 |
// --------------------------------------------------------------------------------
|
2372 |
function privCloseFd()
|
2373 |
{
|
|
|
2374 |
$v_result=1;
|
2375 |
|
2376 |
if ($this->zip_fd != 0)
|
2378 |
$this->zip_fd = 0;
|
2379 |
|
2380 |
// ----- Return
|
|
|
2381 |
return $v_result;
|
2382 |
}
|
2383 |
// --------------------------------------------------------------------------------
|
2398 |
// function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options)
|
2399 |
function privAddList($p_filedescr_list, &$p_result_list, &$p_options)
|
2400 |
{
|
|
|
2401 |
$v_result=1;
|
2402 |
|
2403 |
// ----- Add the files
|
2405 |
if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1)
|
2406 |
{
|
2407 |
// ----- Return
|
|
|
2408 |
return $v_result;
|
2409 |
}
|
2410 |
|
2418 |
if ($v_header_list[$i]['status'] == 'ok') {
|
2419 |
if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
|
2420 |
// ----- Return
|
|
|
2421 |
return $v_result;
|
2422 |
}
|
2423 |
$v_count++;
|
2443 |
unset($v_header_list);
|
2444 |
|
2445 |
// ----- Return
|
|
|
2446 |
return $v_result;
|
2447 |
}
|
2448 |
|
2449 |
// ----- Return
|
|
|
2450 |
return $v_result;
|
2451 |
}
|
2452 |
// --------------------------------------------------------------------------------
|
2462 |
// --------------------------------------------------------------------------------
|
2463 |
function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options)
|
2464 |
{
|
|
|
2465 |
$v_result=1;
|
2466 |
$v_header = array();
|
2467 |
|
2468 |
// ----- Recuperate the current number of elt in list
|
2469 |
$v_nb = sizeof($p_result_list);
|
|
|
2470 |
|
2471 |
// ----- Loop on the files
|
2472 |
for ($j=0; ($j<sizeof($p_filedescr_list)) && ($v_result==1); $j++) {
|
2474 |
$p_filedescr_list[$j]['filename']
|
2475 |
= PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false);
|
2476 |
|
|
|
2477 |
|
2478 |
// ----- Skip empty file names
|
2479 |
// TBC : Can this be possible ? not checked in DescrParseAtt ?
|
2480 |
if ($p_filedescr_list[$j]['filename'] == "") {
|
|
|
2481 |
continue;
|
2482 |
}
|
2483 |
|
2484 |
// ----- Check the filename
|
2485 |
if ( ($p_filedescr_list[$j]['type'] != 'virtual_file')
|
2486 |
&& (!file_exists($p_filedescr_list[$j]['filename']))) {
|
|
|
2487 |
PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$p_filedescr_list[$j]['filename']."' does not exist");
|
|
|
2488 |
return PclZip::errorCode();
|
2489 |
}
|
2490 |
|
2503 |
$v_result = $this->privAddFile($p_filedescr_list[$j], $v_header,
|
2504 |
$p_options);
|
2505 |
if ($v_result != 1) {
|
|
|
2506 |
return $v_result;
|
2507 |
}
|
2508 |
|
2510 |
$p_result_list[$v_nb++] = $v_header;
|
2511 |
}
|
2512 |
}
|
|
|
2513 |
|
2514 |
// ----- Return
|
|
|
2515 |
return $v_result;
|
2516 |
}
|
2517 |
// --------------------------------------------------------------------------------
|
2524 |
// --------------------------------------------------------------------------------
|
2525 |
function privAddFile($p_filedescr, &$p_header, &$p_options)
|
2526 |
{
|
|
|
2527 |
$v_result=1;
|
2528 |
|
2529 |
// ----- Working variable
|
2535 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file list parameter (invalid or empty list)");
|
2536 |
|
2537 |
// ----- Return
|
|
|
2538 |
return PclZip::errorCode();
|
2539 |
}
|
2540 |
|
2542 |
/* TBC : Removed
|
2543 |
if (isset($p_filedescr['stored_filename'])) {
|
2544 |
$v_stored_filename = $p_filedescr['stored_filename'];
|
|
|
2545 |
}
|
2546 |
else {
|
2547 |
$v_stored_filename = $p_filedescr['stored_filename'];
|
|
|
2548 |
}
|
2549 |
*/
|
2550 |
|
2587 |
$p_header['size'] = strlen($p_filedescr['content']);
|
2588 |
}
|
2589 |
|
|
|
2590 |
|
2591 |
// ----- Look for filetime
|
2592 |
if (isset($p_filedescr['mtime'])) {
|
|
|
2593 |
$p_header['mtime'] = $p_filedescr['mtime'];
|
2594 |
}
|
2595 |
else if ($p_filedescr['type'] == 'virtual_file') {
|
2596 |
$p_header['mtime'] = time();
|
|
|
2597 |
}
|
2598 |
else {
|
2599 |
$p_header['mtime'] = filemtime($p_filename);
|
2611 |
|
2612 |
// ----- Look for pre-add callback
|
2613 |
if (isset($p_options[PCLZIP_CB_PRE_ADD])) {
|
|
|
2614 |
|
2615 |
// ----- Generate a local information
|
2616 |
$v_local_header = array();
|
2631 |
// Only some fields can be modified
|
2632 |
if ($p_header['stored_filename'] != $v_local_header['stored_filename']) {
|
2633 |
$p_header['stored_filename'] = PclZipUtilPathReduction($v_local_header['stored_filename']);
|
|
|
2634 |
}
|
2635 |
}
|
2636 |
|
2662 |
|
2663 |
// ----- Use "in memory" zip algo
|
2664 |
else {
|
|
|
|
|
|
|
|
|
2665 |
|
2666 |
// ----- Open the source file
|
2667 |
if (($v_file = @fopen($p_filename, "rb")) == 0) {
|
2668 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
|
|
|
2669 |
return PclZip::errorCode();
|
2670 |
}
|
2671 |
|
2672 |
// ----- Read the file content
|
2673 |
$v_content = @fread($v_file, $p_header['size']);
|
|
|
|
|
2674 |
|
2675 |
// ----- Close the file
|
2676 |
@fclose($v_file);
|
2680 |
|
2681 |
// ----- Look for no compression
|
2682 |
if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
|
|
|
2683 |
// ----- Set header parameters
|
2684 |
$p_header['compressed_size'] = $p_header['size'];
|
2685 |
$p_header['compression'] = 0;
|
2687 |
|
2688 |
// ----- Look for normal compression
|
2689 |
else {
|
|
|
2690 |
// ----- Compress the content
|
2691 |
$v_content = @gzdeflate($v_content);
|
|
|
|
|
2692 |
|
2693 |
// ----- Set header parameters
|
2694 |
$p_header['compressed_size'] = strlen($v_content);
|
2698 |
// ----- Call the header generation
|
2699 |
if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
|
2700 |
@fclose($v_file);
|
|
|
2701 |
return $v_result;
|
2702 |
}
|
2703 |
|
2711 |
// ----- Look for a virtual file (a file from string)
|
2712 |
else if ($p_filedescr['type'] == 'virtual_file') {
|
2713 |
|
|
|
2714 |
$v_content = $p_filedescr['content'];
|
2715 |
|
2716 |
// ----- Calculate the CRC
|
2718 |
|
2719 |
// ----- Look for no compression
|
2720 |
if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
|
|
|
2721 |
// ----- Set header parameters
|
2722 |
$p_header['compressed_size'] = $p_header['size'];
|
2723 |
$p_header['compression'] = 0;
|
2725 |
|
2726 |
// ----- Look for normal compression
|
2727 |
else {
|
|
|
2728 |
// ----- Compress the content
|
2729 |
$v_content = @gzdeflate($v_content);
|
2730 |
|
2736 |
// ----- Call the header generation
|
2737 |
if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
|
2738 |
@fclose($v_file);
|
|
|
2739 |
return $v_result;
|
2740 |
}
|
2741 |
|
2745 |
|
2746 |
// ----- Look for a directory
|
2747 |
else if ($p_filedescr['type'] == 'folder') {
|
|
|
2748 |
// ----- Look for directory last '/'
|
2749 |
if (@substr($p_header['stored_filename'], -1) != '/') {
|
2750 |
$p_header['stored_filename'] .= '/';
|
2758 |
// ----- Call the header generation
|
2759 |
if (($v_result = $this->privWriteFileHeader($p_header)) != 1)
|
2760 |
{
|
|
|
2761 |
return $v_result;
|
2762 |
}
|
2763 |
}
|
2765 |
|
2766 |
// ----- Look for post-add callback
|
2767 |
if (isset($p_options[PCLZIP_CB_POST_ADD])) {
|
|
|
2768 |
|
2769 |
// ----- Generate a local information
|
2770 |
$v_local_header = array();
|
2785 |
}
|
2786 |
|
2787 |
// ----- Return
|
|
|
2788 |
return $v_result;
|
2789 |
}
|
2790 |
// --------------------------------------------------------------------------------
|
2797 |
// --------------------------------------------------------------------------------
|
2798 |
function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options)
|
2799 |
{
|
|
|
2800 |
$v_result=PCLZIP_ERR_NO_ERROR;
|
2801 |
|
2802 |
// ----- Working variable
|
2803 |
$p_filename = $p_filedescr['filename'];
|
2804 |
|
|
|
2805 |
|
2806 |
// ----- Open the source file
|
2807 |
if (($v_file = @fopen($p_filename, "rb")) == 0) {
|
2808 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
|
|
|
2809 |
return PclZip::errorCode();
|
2810 |
}
|
2811 |
|
2814 |
if (($v_file_compressed = @gzopen($v_gzip_temp_name, "wb")) == 0) {
|
2815 |
fclose($v_file);
|
2816 |
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode');
|
|
|
2817 |
return PclZip::errorCode();
|
2818 |
}
|
2819 |
|
2821 |
$v_size = filesize($p_filename);
|
2822 |
while ($v_size != 0) {
|
2823 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
|
|
2824 |
$v_buffer = @fread($v_file, $v_read_size);
|
2825 |
//$v_binary_data = pack('a'.$v_read_size, $v_buffer);
|
2826 |
@gzputs($v_file_compressed, $v_buffer, $v_read_size);
|
2832 |
@gzclose($v_file_compressed);
|
2833 |
|
2834 |
// ----- Check the minimum file size
|
|
|
2835 |
if (filesize($v_gzip_temp_name) < 18) {
|
2836 |
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'gzip temporary file \''.$v_gzip_temp_name.'\' has invalid filesize - should be minimum 18 bytes');
|
|
|
2837 |
return PclZip::errorCode();
|
2838 |
}
|
2839 |
|
2840 |
// ----- Extract the compressed attributes
|
2841 |
if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) {
|
2842 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
|
|
|
2843 |
return PclZip::errorCode();
|
2844 |
}
|
2845 |
|
2848 |
$v_data_header = unpack('a1id1/a1id2/a1cm/a1flag/Vmtime/a1xfl/a1os', $v_binary_data);
|
2849 |
|
2850 |
// ----- Check some parameters
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2851 |
$v_data_header['os'] = bin2hex($v_data_header['os']);
|
2852 |
|
2853 |
// ----- Read the gzip file footer
|
|
|
2854 |
@fseek($v_file_compressed, filesize($v_gzip_temp_name)-8);
|
|
|
2855 |
$v_binary_data = @fread($v_file_compressed, 8);
|
|
|
2856 |
$v_data_footer = unpack('Vcrc/Vcompressed_size', $v_binary_data);
|
2857 |
|
2858 |
// ----- Set the attributes
|
2859 |
$p_header['compression'] = ord($v_data_header['cm']);
|
2860 |
//$p_header['mtime'] = $v_data_header['mtime'];
|
2861 |
$p_header['crc'] = $v_data_footer['crc'];
|
|
|
2862 |
$p_header['compressed_size'] = filesize($v_gzip_temp_name)-18;
|
2863 |
|
2864 |
// ----- Close the file
|
2866 |
|
2867 |
// ----- Call the header generation
|
2868 |
if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
|
|
|
2869 |
return $v_result;
|
2870 |
}
|
2871 |
|
2873 |
if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0)
|
2874 |
{
|
2875 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
|
|
|
2876 |
return PclZip::errorCode();
|
2877 |
}
|
2878 |
|
2879 |
// ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
|
2880 |
fseek($v_file_compressed, 10);
|
|
|
|
|
2881 |
$v_size = $p_header['compressed_size'];
|
2882 |
while ($v_size != 0)
|
2883 |
{
|
2884 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
|
|
2885 |
$v_buffer = @fread($v_file_compressed, $v_read_size);
|
2886 |
//$v_binary_data = pack('a'.$v_read_size, $v_buffer);
|
2887 |
@fwrite($this->zip_fd, $v_buffer, $v_read_size);
|
2895 |
@unlink($v_gzip_temp_name);
|
2896 |
|
2897 |
// ----- Return
|
|
|
2898 |
return $v_result;
|
2899 |
}
|
2900 |
// --------------------------------------------------------------------------------
|
2909 |
// --------------------------------------------------------------------------------
|
2910 |
function privCalculateStoredFilename(&$p_filedescr, &$p_options)
|
2911 |
{
|
|
|
2912 |
$v_result=1;
|
2913 |
|
2914 |
// ----- Working variables
|
2925 |
else {
|
2926 |
$p_remove_dir = '';
|
2927 |
}
|
|
|
2928 |
if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
|
2929 |
$p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH];
|
2930 |
}
|
2937 |
if (isset($p_filedescr['new_full_name'])) {
|
2938 |
// ----- Remove drive letter if any
|
2939 |
$v_stored_filename = PclZipUtilTranslateWinPath($p_filedescr['new_full_name']);
|
|
|
2940 |
}
|
2941 |
|
2942 |
// ----- Look for path and/or short name change
|
2951 |
$v_dir = $v_path_info['dirname'].'/';
|
2952 |
}
|
2953 |
$v_stored_filename = $v_dir.$p_filedescr['new_short_name'];
|
|
|
2954 |
}
|
2955 |
else {
|
2956 |
// ----- Calculate the stored filename
|
2960 |
// ----- Look for all path to remove
|
2961 |
if ($p_remove_all_dir) {
|
2962 |
$v_stored_filename = basename($p_filename);
|
|
|
2963 |
}
|
2964 |
// ----- Look for partial path remove
|
2965 |
else if ($p_remove_dir != "") {
|
|
|
2966 |
if (substr($p_remove_dir, -1) != '/')
|
2967 |
$p_remove_dir .= "/";
|
2968 |
|
2984 |
if ($v_compare > 0) {
|
2985 |
if ($v_compare == 2) {
|
2986 |
$v_stored_filename = "";
|
|
|
2987 |
}
|
2988 |
else {
|
|
|
2989 |
$v_stored_filename = substr($v_stored_filename,
|
2990 |
strlen($p_remove_dir));
|
|
|
2991 |
}
|
2992 |
}
|
2993 |
}
|
3001 |
$v_stored_filename = $p_add_dir.$v_stored_filename;
|
3002 |
else
|
3003 |
$v_stored_filename = $p_add_dir."/".$v_stored_filename;
|
|
|
3004 |
}
|
3005 |
}
|
3006 |
|
3007 |
// ----- Filename (reduce the path of stored name)
|
3008 |
$v_stored_filename = PclZipUtilPathReduction($v_stored_filename);
|
3009 |
$p_filedescr['stored_filename'] = $v_stored_filename;
|
|
|
3010 |
|
3011 |
// ----- Return
|
|
|
3012 |
return $v_result;
|
3013 |
}
|
3014 |
// --------------------------------------------------------------------------------
|
3021 |
// --------------------------------------------------------------------------------
|
3022 |
function privWriteFileHeader(&$p_header)
|
3023 |
{
|
|
|
3024 |
$v_result=1;
|
3025 |
|
3026 |
// ----- Store the offset position of the file
|
3027 |
$p_header['offset'] = ftell($this->zip_fd);
|
|
|
3028 |
|
3029 |
// ----- Transform UNIX mtime to DOS format mdate/mtime
|
|
|
3030 |
$v_date = getdate($p_header['mtime']);
|
3031 |
$v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
|
3032 |
$v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
|
3054 |
}
|
3055 |
|
3056 |
// ----- Return
|
|
|
3057 |
return $v_result;
|
3058 |
}
|
3059 |
// --------------------------------------------------------------------------------
|
3066 |
// --------------------------------------------------------------------------------
|
3067 |
function privWriteCentralFileHeader(&$p_header)
|
3068 |
{
|
|
|
3069 |
$v_result=1;
|
3070 |
|
3071 |
// TBC
|
3072 |
//for(reset($p_header); $key = key($p_header); next($p_header)) {
|
|
|
3073 |
//}
|
3074 |
|
3075 |
// ----- Transform UNIX mtime to DOS format mdate/mtime
|
|
|
3076 |
$v_date = getdate($p_header['mtime']);
|
3077 |
$v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
|
3078 |
$v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
|
3079 |
|
|
|
3080 |
|
3081 |
// ----- Packed data
|
3082 |
$v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50,
|
3107 |
}
|
3108 |
|
3109 |
// ----- Return
|
|
|
3110 |
return $v_result;
|
3111 |
}
|
3112 |
// --------------------------------------------------------------------------------
|
3119 |
// --------------------------------------------------------------------------------
|
3120 |
function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment)
|
3121 |
{
|
|
|
3122 |
$v_result=1;
|
3123 |
|
3124 |
// ----- Packed data
|
3136 |
}
|
3137 |
|
3138 |
// ----- Return
|
|
|
3139 |
return $v_result;
|
3140 |
}
|
3141 |
// --------------------------------------------------------------------------------
|
3148 |
// --------------------------------------------------------------------------------
|
3149 |
function privList(&$p_list)
|
3150 |
{
|
|
|
3151 |
$v_result=1;
|
3152 |
|
3153 |
// ----- Magic quotes trick
|
3154 |
$this->privDisableMagicQuotes();
|
3155 |
|
3156 |
// ----- Open the zip file
|
|
|
3157 |
if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
|
3158 |
{
|
3159 |
// ----- Magic quotes trick
|
3163 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
|
3164 |
|
3165 |
// ----- Return
|
|
|
3166 |
return PclZip::errorCode();
|
3167 |
}
|
3168 |
|
3171 |
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
|
3172 |
{
|
3173 |
$this->privSwapBackMagicQuotes();
|
|
|
3174 |
return $v_result;
|
3175 |
}
|
3176 |
|
3177 |
// ----- Go to beginning of Central Dir
|
|
|
|
|
3178 |
@rewind($this->zip_fd);
|
|
|
3179 |
if (@fseek($this->zip_fd, $v_central_dir['offset']))
|
3180 |
{
|
3181 |
$this->privSwapBackMagicQuotes();
|
3184 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
|
3185 |
|
3186 |
// ----- Return
|
|
|
3187 |
return PclZip::errorCode();
|
3188 |
}
|
|
|
3189 |
|
3190 |
// ----- Read each entry
|
3191 |
for ($i=0; $i<$v_central_dir['entries']; $i++)
|
3194 |
if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)
|
3195 |
{
|
3196 |
$this->privSwapBackMagicQuotes();
|
|
|
3197 |
return $v_result;
|
3198 |
}
|
3199 |
$v_header['index'] = $i;
|
3210 |
$this->privSwapBackMagicQuotes();
|
3211 |
|
3212 |
// ----- Return
|
|
|
3213 |
return $v_result;
|
3214 |
}
|
3215 |
// --------------------------------------------------------------------------------
|
3235 |
// --------------------------------------------------------------------------------
|
3236 |
function privConvertHeader2FileInfo($p_header, &$p_info)
|
3237 |
{
|
|
|
3238 |
$v_result=1;
|
3239 |
|
3240 |
// ----- Get the interesting attributes
|
3252 |
$p_info['crc'] = $p_header['crc'];
|
3253 |
|
3254 |
// ----- Return
|
|
|
3255 |
return $v_result;
|
3256 |
}
|
3257 |
// --------------------------------------------------------------------------------
|
3274 |
// --------------------------------------------------------------------------------
|
3275 |
function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
|
3276 |
{
|
|
|
3277 |
$v_result=1;
|
3278 |
|
3279 |
// ----- Magic quotes trick
|
3292 |
// ----- Look for the path end '/'
|
3293 |
while (substr($p_path, -1) == "/")
|
3294 |
{
|
|
|
3295 |
$p_path = substr($p_path, 0, strlen($p_path)-1);
|
|
|
3296 |
}
|
3297 |
}
|
3298 |
|
3304 |
$p_remove_path_size = strlen($p_remove_path);
|
3305 |
|
3306 |
// ----- Open the zip file
|
|
|
3307 |
if (($v_result = $this->privOpenFd('rb')) != 1)
|
3308 |
{
|
3309 |
$this->privSwapBackMagicQuotes();
|
|
|
3310 |
return $v_result;
|
3311 |
}
|
3312 |
|
3318 |
$this->privCloseFd();
|
3319 |
$this->privSwapBackMagicQuotes();
|
3320 |
|
|
|
3321 |
return $v_result;
|
3322 |
}
|
3323 |
|
3328 |
$j_start = 0;
|
3329 |
for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
|
3330 |
{
|
|
|
3331 |
|
3332 |
// ----- Read next Central dir entry
|
|
|
3333 |
@rewind($this->zip_fd);
|
|
|
3334 |
if (@fseek($this->zip_fd, $v_pos_entry))
|
3335 |
{
|
3336 |
// ----- Close the zip file
|
3341 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
|
3342 |
|
3343 |
// ----- Return
|
|
|
3344 |
return PclZip::errorCode();
|
3345 |
}
|
|
|
3346 |
|
3347 |
// ----- Read the file header
|
3348 |
$v_header = array();
|
3352 |
$this->privCloseFd();
|
3353 |
$this->privSwapBackMagicQuotes();
|
3354 |
|
|
|
3355 |
return $v_result;
|
3356 |
}
|
3357 |
|
3367 |
// ----- Look for extract by name rule
|
3368 |
if ( (isset($p_options[PCLZIP_OPT_BY_NAME]))
|
3369 |
&& ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
|
|
|
3370 |
|
3371 |
// ----- Look if the filename is in the list
|
3372 |
for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); $j++) {
|
|
|
3373 |
|
3374 |
// ----- Look for a directory
|
3375 |
if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
|
|
|
3376 |
|
3377 |
// ----- Look if the directory is in the filename path
|
3378 |
if ( (strlen($v_header['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
|
3379 |
&& (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
|
|
|
3380 |
$v_extract = true;
|
3381 |
}
|
3382 |
}
|
3383 |
// ----- Look for a filename
|
3384 |
elseif ($v_header['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
|
|
|
3385 |
$v_extract = true;
|
3386 |
}
|
3387 |
}
|
3392 |
/*
|
3393 |
else if ( (isset($p_options[PCLZIP_OPT_BY_EREG]))
|
3394 |
&& ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
|
|
|
3395 |
|
3396 |
if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header['stored_filename'])) {
|
|
|
3397 |
$v_extract = true;
|
3398 |
}
|
3399 |
}
|
3402 |
// ----- Look for extract by preg rule
|
3403 |
else if ( (isset($p_options[PCLZIP_OPT_BY_PREG]))
|
3404 |
&& ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
|
|
|
3405 |
|
3406 |
if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) {
|
|
|
3407 |
$v_extract = true;
|
3408 |
}
|
3409 |
}
|
3411 |
// ----- Look for extract by index rule
|
3412 |
else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX]))
|
3413 |
&& ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
|
|
|
3414 |
|
3415 |
// ----- Look if the index is in the list
|
3416 |
for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) {
|
|
|
3417 |
|
3418 |
if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
|
|
|
3419 |
$v_extract = true;
|
3420 |
}
|
3421 |
if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
|
|
|
3422 |
$j_start = $j+1;
|
3423 |
}
|
3424 |
|
3425 |
if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
|
|
|
3426 |
break;
|
3427 |
}
|
3428 |
}
|
3430 |
|
3431 |
// ----- Look for no rule, which means extract all the archive
|
3432 |
else {
|
|
|
3433 |
$v_extract = true;
|
3434 |
}
|
3435 |
|
3437 |
if ( ($v_extract)
|
3438 |
&& ( ($v_header['compression'] != 8)
|
3439 |
&& ($v_header['compression'] != 0))) {
|
|
|
3440 |
$v_header['status'] = 'unsupported_compression';
|
3441 |
|
3442 |
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
3443 |
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
3444 |
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
|
|
3445 |
|
3446 |
$this->privSwapBackMagicQuotes();
|
3447 |
|
3450 |
."compressed by an unsupported compression "
|
3451 |
."method (".$v_header['compression'].") ");
|
3452 |
|
|
|
3453 |
return PclZip::errorCode();
|
3454 |
}
|
3455 |
}
|
3456 |
|
3457 |
// ----- Check encrypted files
|
3458 |
if (($v_extract) && (($v_header['flag'] & 1) == 1)) {
|
|
|
3459 |
$v_header['status'] = 'unsupported_encryption';
|
3460 |
|
3461 |
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
3462 |
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
3463 |
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
|
|
3464 |
|
3465 |
$this->privSwapBackMagicQuotes();
|
3466 |
|
3469 |
." filename '".$v_header['stored_filename']
|
3470 |
."'");
|
3471 |
|
|
|
3472 |
return PclZip::errorCode();
|
3473 |
}
|
3474 |
}
|
3475 |
|
3476 |
// ----- Look for real extraction
|
3477 |
if (($v_extract) && ($v_header['status'] != 'ok')) {
|
|
|
3478 |
$v_result = $this->privConvertHeader2FileInfo($v_header,
|
3479 |
$p_file_list[$v_nb_extracted++]);
|
3480 |
if ($v_result != 1) {
|
3481 |
$this->privCloseFd();
|
3482 |
$this->privSwapBackMagicQuotes();
|
|
|
3483 |
return $v_result;
|
3484 |
}
|
3485 |
|
3489 |
// ----- Look for real extraction
|
3490 |
if ($v_extract)
|
3491 |
{
|
|
|
3492 |
|
3493 |
// ----- Go to the file position
|
|
|
3494 |
@rewind($this->zip_fd);
|
|
|
3495 |
if (@fseek($this->zip_fd, $v_header['offset']))
|
3496 |
{
|
3497 |
// ----- Close the zip file
|
3503 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
|
3504 |
|
3505 |
// ----- Return
|
|
|
3506 |
return PclZip::errorCode();
|
3507 |
}
|
|
|
3508 |
|
3509 |
// ----- Look for extraction as string
|
3510 |
if ($p_options[PCLZIP_OPT_EXTRACT_AS_STRING]) {
|
3516 |
if ($v_result1 < 1) {
|
3517 |
$this->privCloseFd();
|
3518 |
$this->privSwapBackMagicQuotes();
|
|
|
3519 |
return $v_result1;
|
3520 |
}
|
3521 |
|
3526 |
$this->privCloseFd();
|
3527 |
$this->privSwapBackMagicQuotes();
|
3528 |
|
|
|
3529 |
return $v_result;
|
3530 |
}
|
3531 |
|
3548 |
if ($v_result1 < 1) {
|
3549 |
$this->privCloseFd();
|
3550 |
$this->privSwapBackMagicQuotes();
|
|
|
3551 |
return $v_result1;
|
3552 |
}
|
3553 |
|
3555 |
if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) {
|
3556 |
$this->privCloseFd();
|
3557 |
$this->privSwapBackMagicQuotes();
|
|
|
3558 |
return $v_result;
|
3559 |
}
|
3560 |
|
3573 |
if ($v_result1 < 1) {
|
3574 |
$this->privCloseFd();
|
3575 |
$this->privSwapBackMagicQuotes();
|
|
|
3576 |
return $v_result1;
|
3577 |
}
|
3578 |
|
3583 |
$this->privCloseFd();
|
3584 |
$this->privSwapBackMagicQuotes();
|
3585 |
|
|
|
3586 |
return $v_result;
|
3587 |
}
|
3588 |
|
3599 |
$this->privSwapBackMagicQuotes();
|
3600 |
|
3601 |
// ----- Return
|
|
|
3602 |
return $v_result;
|
3603 |
}
|
3604 |
// --------------------------------------------------------------------------------
|
3614 |
// --------------------------------------------------------------------------------
|
3615 |
function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
|
3616 |
{
|
|
|
3617 |
$v_result=1;
|
3618 |
|
3619 |
// ----- Read the file header
|
3620 |
if (($v_result = $this->privReadFileHeader($v_header)) != 1)
|
3621 |
{
|
3622 |
// ----- Return
|
|
|
3623 |
return $v_result;
|
3624 |
}
|
3625 |
|
|
|
3626 |
|
3627 |
// ----- Check that the file header is coherent with $p_entry info
|
3628 |
if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
|
3633 |
if ($p_remove_all_path == true) {
|
3634 |
// ----- Look for folder entry that not need to be extracted
|
3635 |
if (($p_entry['external']&0x00000010)==0x00000010) {
|
|
|
3636 |
|
3637 |
$p_entry['status'] = "filtered";
|
3638 |
|
|
|
3639 |
return $v_result;
|
3640 |
}
|
3641 |
|
|
|
3642 |
// ----- Get the basename of the path
|
3643 |
$p_entry['filename'] = basename($p_entry['filename']);
|
3644 |
}
|
3646 |
// ----- Look for path to remove
|
3647 |
else if ($p_remove_path != "")
|
3648 |
{
|
|
|
3649 |
if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2)
|
3650 |
{
|
|
|
3651 |
|
3652 |
// ----- Change the file status
|
3653 |
$p_entry['status'] = "filtered";
|
3654 |
|
3655 |
// ----- Return
|
|
|
3656 |
return $v_result;
|
3657 |
}
|
3658 |
|
3659 |
$p_remove_path_size = strlen($p_remove_path);
|
3660 |
if (substr($p_entry['filename'], 0, $p_remove_path_size) == $p_remove_path)
|
3661 |
{
|
|
|
3662 |
|
3663 |
// ----- Remove the path
|
3664 |
$p_entry['filename'] = substr($p_entry['filename'], $p_remove_path_size);
|
3665 |
|
|
|
3666 |
}
|
3667 |
}
|
3668 |
|
3673 |
|
3674 |
// ----- Check a base_dir_restriction
|
3675 |
if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) {
|
|
|
3676 |
$v_inclusion
|
3677 |
= PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION],
|
3678 |
$p_entry['filename']);
|
3679 |
if ($v_inclusion == 0) {
|
|
|
3680 |
|
3681 |
PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION,
|
3682 |
"Filename '".$p_entry['filename']."' is "
|
3683 |
."outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION");
|
3684 |
|
|
|
3685 |
return PclZip::errorCode();
|
3686 |
}
|
3687 |
}
|
3688 |
|
3689 |
// ----- Look for pre-extract callback
|
3690 |
if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
|
|
|
3691 |
|
3692 |
// ----- Generate a local information
|
3693 |
$v_local_header = array();
|
3706 |
|
3707 |
// ----- Look for abort result
|
3708 |
if ($v_result == 2) {
|
|
|
3709 |
// ----- This status is internal and will be changed in 'skipped'
|
3710 |
$p_entry['status'] = "aborted";
|
3711 |
$v_result = PCLZIP_ERR_USER_ABORTED;
|
3714 |
// ----- Update the informations
|
3715 |
// Only some fields can be modified
|
3716 |
$p_entry['filename'] = $v_local_header['filename'];
|
|
|
3717 |
}
|
3718 |
|
|
|
3719 |
|
3720 |
// ----- Look if extraction should be done
|
3721 |
if ($p_entry['status'] == 'ok') {
|
3723 |
// ----- Look for specific actions while the file exist
|
3724 |
if (file_exists($p_entry['filename']))
|
3725 |
{
|
|
|
3726 |
|
3727 |
// ----- Look if file is a directory
|
3728 |
if (is_dir($p_entry['filename']))
|
3729 |
{
|
|
|
3730 |
|
3731 |
// ----- Change the file status
|
3732 |
$p_entry['status'] = "already_a_directory";
|
3736 |
// when this kind of error occurs.
|
3737 |
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
3738 |
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
|
|
3739 |
|
3740 |
PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY,
|
3741 |
"Filename '".$p_entry['filename']."' is "
|
3742 |
."already used by an existing directory");
|
3743 |
|
|
|
3744 |
return PclZip::errorCode();
|
3745 |
}
|
3746 |
}
|
3747 |
// ----- Look if file is write protected
|
3748 |
else if (!is_writeable($p_entry['filename']))
|
3749 |
{
|
|
|
3750 |
|
3751 |
// ----- Change the file status
|
3752 |
$p_entry['status'] = "write_protected";
|
3756 |
// when this kind of error occurs.
|
3757 |
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
3758 |
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
|
|
3759 |
|
3760 |
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
|
3761 |
"Filename '".$p_entry['filename']."' exists "
|
3762 |
."and is write protected");
|
3763 |
|
|
|
3764 |
return PclZip::errorCode();
|
3765 |
}
|
3766 |
}
|
3768 |
// ----- Look if the extracted file is older
|
3769 |
else if (filemtime($p_entry['filename']) > $p_entry['mtime'])
|
3770 |
{
|
|
|
3771 |
// ----- Change the file status
|
3772 |
if ( (isset($p_options[PCLZIP_OPT_REPLACE_NEWER]))
|
3773 |
&& ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) {
|
|
|
3774 |
}
|
3775 |
else {
|
|
|
3776 |
$p_entry['status'] = "newer_exist";
|
3777 |
|
3778 |
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
3780 |
// when this kind of error occurs.
|
3781 |
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
3782 |
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
|
|
3783 |
|
3784 |
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
|
3785 |
"Newer version of '".$p_entry['filename']."' exists "
|
3786 |
."and option PCLZIP_OPT_REPLACE_NEWER is not selected");
|
3787 |
|
|
|
3788 |
return PclZip::errorCode();
|
3789 |
}
|
3790 |
}
|
3791 |
}
|
3792 |
else {
|
|
|
3793 |
}
|
3794 |
}
|
3795 |
|
3803 |
$v_dir_to_check = dirname($p_entry['filename']);
|
3804 |
|
3805 |
if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
|
|
|
3806 |
|
3807 |
// ----- Change the file status
|
3808 |
$p_entry['status'] = "path_creation_fail";
|
3809 |
|
3810 |
// ----- Return
|
|
|
3811 |
//return $v_result;
|
3812 |
$v_result = 1;
|
3813 |
}
|
3822 |
{
|
3823 |
// ----- Look for not compressed file
|
3824 |
if ($p_entry['compression'] == 0) {
|
|
|
3825 |
|
3826 |
// ----- Opening destination file
|
3827 |
if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0)
|
3828 |
{
|
|
|
3829 |
|
3830 |
// ----- Change the file status
|
3831 |
$p_entry['status'] = "write_error";
|
3832 |
|
3833 |
// ----- Return
|
|
|
3834 |
return $v_result;
|
3835 |
}
|
3836 |
|
|
|
3837 |
|
3838 |
// ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
|
3839 |
$v_size = $p_entry['compressed_size'];
|
3840 |
while ($v_size != 0)
|
3841 |
{
|
3842 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
|
|
3843 |
$v_buffer = @fread($this->zip_fd, $v_read_size);
|
3844 |
/* Try to speed up the code
|
3845 |
$v_binary_data = pack('a'.$v_read_size, $v_buffer);
|
3858 |
|
3859 |
}
|
3860 |
else {
|
|
|
3861 |
// ----- TBC
|
3862 |
// Need to be finished
|
3863 |
if (($p_entry['flag'] & 1) == 1) {
|
|
|
3864 |
PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, 'File \''.$p_entry['filename'].'\' is encrypted. Encrypted files are not supported.');
|
|
|
3865 |
return PclZip::errorCode();
|
3866 |
}
|
3867 |
|
3880 |
// ----- Look for extract in memory
|
3881 |
else {
|
3882 |
|
|
|
3883 |
|
3884 |
// ----- Read the compressed file in a buffer (one shot)
|
3885 |
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
|
3888 |
$v_file_content = @gzinflate($v_buffer);
|
3889 |
unset($v_buffer);
|
3890 |
if ($v_file_content === FALSE) {
|
|
|
3891 |
|
3892 |
// ----- Change the file status
|
3893 |
// TBC
|
3894 |
$p_entry['status'] = "error";
|
3895 |
|
|
|
3896 |
return $v_result;
|
3897 |
}
|
3898 |
|
3899 |
// ----- Opening destination file
|
3900 |
if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
|
|
|
3901 |
|
3902 |
// ----- Change the file status
|
3903 |
$p_entry['status'] = "write_error";
|
3904 |
|
|
|
3905 |
return $v_result;
|
3906 |
}
|
3907 |
|
3920 |
|
3921 |
// ----- Look for chmod option
|
3922 |
if (isset($p_options[PCLZIP_OPT_SET_CHMOD])) {
|
|
|
3923 |
|
3924 |
// ----- Change the mode of the file
|
3925 |
@chmod($p_entry['filename'], $p_options[PCLZIP_OPT_SET_CHMOD]);
|
3926 |
}
|
3927 |
|
|
|
3928 |
}
|
3929 |
}
|
3930 |
|
3935 |
|
3936 |
// ----- Look for post-extract callback
|
3937 |
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
|
|
|
3938 |
|
3939 |
// ----- Generate a local information
|
3940 |
$v_local_header = array();
|
3948 |
|
3949 |
// ----- Look for abort result
|
3950 |
if ($v_result == 2) {
|
|
|
3951 |
$v_result = PCLZIP_ERR_USER_ABORTED;
|
3952 |
}
|
3953 |
}
|
3954 |
|
3955 |
// ----- Return
|
|
|
3956 |
return $v_result;
|
3957 |
}
|
3958 |
// --------------------------------------------------------------------------------
|
3965 |
// --------------------------------------------------------------------------------
|
3966 |
function privExtractFileUsingTempFile(&$p_entry, &$p_options)
|
3967 |
{
|
|
|
3968 |
$v_result=1;
|
3969 |
|
3970 |
// ----- Creates a temporary file
|
3972 |
if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) {
|
3973 |
fclose($v_file);
|
3974 |
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode');
|
|
|
3975 |
return PclZip::errorCode();
|
3976 |
}
|
3977 |
|
|
|
3978 |
|
3979 |
// ----- Write gz file format header
|
3980 |
$v_binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($p_entry['compression']), Chr(0x00), time(), Chr(0x00), Chr(3));
|
3982 |
|
3983 |
// ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
|
3984 |
$v_size = $p_entry['compressed_size'];
|
|
|
3985 |
while ($v_size != 0)
|
3986 |
{
|
3987 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
|
|
3988 |
$v_buffer = @fread($this->zip_fd, $v_read_size);
|
3989 |
//$v_binary_data = pack('a'.$v_read_size, $v_buffer);
|
3990 |
@fwrite($v_dest_file, $v_buffer, $v_read_size);
|
4000 |
|
4001 |
// ----- Opening destination file
|
4002 |
if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
|
|
|
4003 |
$p_entry['status'] = "write_error";
|
|
|
4004 |
return $v_result;
|
4005 |
}
|
4006 |
|
4009 |
@fclose($v_dest_file);
|
4010 |
$p_entry['status'] = "read_error";
|
4011 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
|
|
|
4012 |
return PclZip::errorCode();
|
4013 |
}
|
4014 |
|
|
|
|
|
4015 |
|
4016 |
// ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
|
4017 |
$v_size = $p_entry['size'];
|
|
|
4018 |
while ($v_size != 0) {
|
4019 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
|
|
4020 |
$v_buffer = @gzread($v_src_file, $v_read_size);
|
4021 |
//$v_binary_data = pack('a'.$v_read_size, $v_buffer);
|
4022 |
@fwrite($v_dest_file, $v_buffer, $v_read_size);
|
4029 |
@unlink($v_gzip_temp_name);
|
4030 |
|
4031 |
// ----- Return
|
|
|
4032 |
return $v_result;
|
4033 |
}
|
4034 |
// --------------------------------------------------------------------------------
|
4041 |
// --------------------------------------------------------------------------------
|
4042 |
function privExtractFileInOutput(&$p_entry, &$p_options)
|
4043 |
{
|
|
|
4044 |
$v_result=1;
|
4045 |
|
4046 |
// ----- Read the file header
|
4047 |
if (($v_result = $this->privReadFileHeader($v_header)) != 1) {
|
|
|
4048 |
return $v_result;
|
4049 |
}
|
4050 |
|
|
|
4051 |
|
4052 |
// ----- Check that the file header is coherent with $p_entry info
|
4053 |
if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
|
4056 |
|
4057 |
// ----- Look for pre-extract callback
|
4058 |
if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
|
|
|
4059 |
|
4060 |
// ----- Generate a local information
|
4061 |
$v_local_header = array();
|
4074 |
|
4075 |
// ----- Look for abort result
|
4076 |
if ($v_result == 2) {
|
|
|
4077 |
// ----- This status is internal and will be changed in 'skipped'
|
4078 |
$p_entry['status'] = "aborted";
|
4079 |
$v_result = PCLZIP_ERR_USER_ABORTED;
|
4082 |
// ----- Update the informations
|
4083 |
// Only some fields can be modified
|
4084 |
$p_entry['filename'] = $v_local_header['filename'];
|
|
|
4085 |
}
|
4086 |
|
4087 |
// ----- Trace
|
|
|
4088 |
|
4089 |
// ----- Look if extraction should be done
|
4090 |
if ($p_entry['status'] == 'ok') {
|
4093 |
if (!(($p_entry['external']&0x00000010)==0x00000010)) {
|
4094 |
// ----- Look for not compressed file
|
4095 |
if ($p_entry['compressed_size'] == $p_entry['size']) {
|
|
|
|
|
4096 |
|
4097 |
// ----- Read the file in a buffer (one shot)
|
4098 |
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
|
4102 |
unset($v_buffer);
|
4103 |
}
|
4104 |
else {
|
|
|
|
|
4105 |
|
4106 |
// ----- Read the compressed file in a buffer (one shot)
|
4107 |
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
|
4114 |
echo $v_file_content;
|
4115 |
unset($v_file_content);
|
4116 |
}
|
|
|
4117 |
}
|
4118 |
}
|
4119 |
|
4124 |
|
4125 |
// ----- Look for post-extract callback
|
4126 |
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
|
|
|
4127 |
|
4128 |
// ----- Generate a local information
|
4129 |
$v_local_header = array();
|
4137 |
|
4138 |
// ----- Look for abort result
|
4139 |
if ($v_result == 2) {
|
|
|
4140 |
$v_result = PCLZIP_ERR_USER_ABORTED;
|
4141 |
}
|
4142 |
}
|
4143 |
|
|
|
4144 |
return $v_result;
|
4145 |
}
|
4146 |
// --------------------------------------------------------------------------------
|
4153 |
// --------------------------------------------------------------------------------
|
4154 |
function privExtractFileAsString(&$p_entry, &$p_string, &$p_options)
|
4155 |
{
|
|
|
4156 |
$v_result=1;
|
4157 |
|
4158 |
// ----- Read the file header
|
4160 |
if (($v_result = $this->privReadFileHeader($v_header)) != 1)
|
4161 |
{
|
4162 |
// ----- Return
|
|
|
4163 |
return $v_result;
|
4164 |
}
|
4165 |
|
|
|
4166 |
|
4167 |
// ----- Check that the file header is coherent with $p_entry info
|
4168 |
if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
|
4171 |
|
4172 |
// ----- Look for pre-extract callback
|
4173 |
if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
|
|
|
4174 |
|
4175 |
// ----- Generate a local information
|
4176 |
$v_local_header = array();
|
4189 |
|
4190 |
// ----- Look for abort result
|
4191 |
if ($v_result == 2) {
|
|
|
4192 |
// ----- This status is internal and will be changed in 'skipped'
|
4193 |
$p_entry['status'] = "aborted";
|
4194 |
$v_result = PCLZIP_ERR_USER_ABORTED;
|
4197 |
// ----- Update the informations
|
4198 |
// Only some fields can be modified
|
4199 |
$p_entry['filename'] = $v_local_header['filename'];
|
|
|
4200 |
}
|
4201 |
|
|
|
4202 |
|
4203 |
// ----- Look if extraction should be done
|
4204 |
if ($p_entry['status'] == 'ok') {
|
4208 |
// ----- Look for not compressed file
|
4209 |
// if ($p_entry['compressed_size'] == $p_entry['size'])
|
4210 |
if ($p_entry['compression'] == 0) {
|
|
|
|
|
4211 |
|
4212 |
// ----- Reading the file
|
4213 |
$p_string = @fread($this->zip_fd, $p_entry['compressed_size']);
|
4214 |
}
|
4215 |
else {
|
|
|
4216 |
|
4217 |
// ----- Reading the file
|
4218 |
$v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
|
4224 |
}
|
4225 |
|
4226 |
// ----- Trace
|
|
|
4227 |
}
|
4228 |
else {
|
4229 |
// TBC : error : can not extract a folder in a string
|
4238 |
|
4239 |
// ----- Look for post-extract callback
|
4240 |
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
|
|
|
4241 |
|
4242 |
// ----- Generate a local information
|
4243 |
$v_local_header = array();
|
4259 |
|
4260 |
// ----- Look for abort result
|
4261 |
if ($v_result == 2) {
|
|
|
4262 |
$v_result = PCLZIP_ERR_USER_ABORTED;
|
4263 |
}
|
4264 |
}
|
4265 |
|
4266 |
// ----- Return
|
|
|
4267 |
return $v_result;
|
4268 |
}
|
4269 |
// --------------------------------------------------------------------------------
|
4276 |
// --------------------------------------------------------------------------------
|
4277 |
function privReadFileHeader(&$p_header)
|
4278 |
{
|
|
|
4279 |
$v_result=1;
|
4280 |
|
4281 |
// ----- Read the 4 bytes signature
|
4282 |
$v_binary_data = @fread($this->zip_fd, 4);
|
|
|
4283 |
$v_data = unpack('Vid', $v_binary_data);
|
|
|
4284 |
|
4285 |
// ----- Check signature
|
4286 |
if ($v_data['id'] != 0x04034b50)
|
4287 |
{
|
|
|
4288 |
|
4289 |
// ----- Error log
|
4290 |
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
|
4291 |
|
4292 |
// ----- Return
|
|
|
4293 |
return PclZip::errorCode();
|
4294 |
}
|
4295 |
|
4301 |
{
|
4302 |
$p_header['filename'] = "";
|
4303 |
$p_header['status'] = "invalid_header";
|
|
|
4304 |
|
4305 |
// ----- Error log
|
4306 |
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));
|
4307 |
|
4308 |
// ----- Return
|
|
|
4309 |
return PclZip::errorCode();
|
4310 |
}
|
4311 |
|
4312 |
// ----- Extract the values
|
|
|
|
|
4313 |
$v_data = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v_binary_data);
|
4314 |
|
4315 |
// ----- Get filename
|
|
|
4316 |
$p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']);
|
|
|
4317 |
|
4318 |
// ----- Get extra_fields
|
|
|
4319 |
if ($v_data['extra_len'] != 0) {
|
4320 |
$p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']);
|
4321 |
}
|
4322 |
else {
|
4323 |
$p_header['extra'] = '';
|
4324 |
}
|
|
|
4325 |
|
4326 |
// ----- Extract properties
|
4327 |
$p_header['version_extracted'] = $v_data['version'];
|
|
|
4328 |
$p_header['compression'] = $v_data['compression'];
|
|
|
4329 |
$p_header['size'] = $v_data['size'];
|
|
|
4330 |
$p_header['compressed_size'] = $v_data['compressed_size'];
|
|
|
4331 |
$p_header['crc'] = $v_data['crc'];
|
|
|
4332 |
$p_header['flag'] = $v_data['flag'];
|
|
|
|
|
|
|
4333 |
$p_header['filename_len'] = $v_data['filename_len'];
|
|
|
4334 |
|
4335 |
// ----- Recuperate date in UNIX format
|
4336 |
$p_header['mdate'] = $v_data['mdate'];
|
4350 |
// ----- Get UNIX date format
|
4351 |
$p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
|
4352 |
|
|
|
4353 |
}
|
4354 |
else
|
4355 |
{
|
4356 |
$p_header['mtime'] = time();
|
|
|
4357 |
}
|
4358 |
|
4359 |
// TBC
|
4360 |
//for(reset($v_data); $key = key($v_data); next($v_data)) {
|
|
|
4361 |
//}
|
4362 |
|
4363 |
// ----- Set the stored filename
|
4367 |
$p_header['status'] = "ok";
|
4368 |
|
4369 |
// ----- Return
|
|
|
4370 |
return $v_result;
|
4371 |
}
|
4372 |
// --------------------------------------------------------------------------------
|
4379 |
// --------------------------------------------------------------------------------
|
4380 |
function privReadCentralFileHeader(&$p_header)
|
4381 |
{
|
|
|
4382 |
$v_result=1;
|
4383 |
|
4384 |
// ----- Read the 4 bytes signature
|
4385 |
$v_binary_data = @fread($this->zip_fd, 4);
|
|
|
4386 |
$v_data = unpack('Vid', $v_binary_data);
|
|
|
4387 |
|
4388 |
// ----- Check signature
|
4389 |
if ($v_data['id'] != 0x02014b50)
|
4390 |
{
|
|
|
4391 |
|
4392 |
// ----- Error log
|
4393 |
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
|
4394 |
|
4395 |
// ----- Return
|
|
|
4396 |
return PclZip::errorCode();
|
4397 |
}
|
4398 |
|
4404 |
{
|
4405 |
$p_header['filename'] = "";
|
4406 |
$p_header['status'] = "invalid_header";
|
|
|
4407 |
|
4408 |
// ----- Error log
|
4409 |
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));
|
4410 |
|
4411 |
// ----- Return
|
|
|
4412 |
return PclZip::errorCode();
|
4413 |
}
|
4414 |
|
4415 |
// ----- Extract the values
|
|
|
|
|
4416 |
$p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data);
|
4417 |
|
4418 |
// ----- Get filename
|
|
|
4419 |
if ($p_header['filename_len'] != 0)
|
4420 |
$p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']);
|
4421 |
else
|
4422 |
$p_header['filename'] = '';
|
|
|
4423 |
|
4424 |
// ----- Get extra
|
|
|
4425 |
if ($p_header['extra_len'] != 0)
|
4426 |
$p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']);
|
4427 |
else
|
4428 |
$p_header['extra'] = '';
|
|
|
4429 |
|
4430 |
// ----- Get comment
|
|
|
4431 |
if ($p_header['comment_len'] != 0)
|
4432 |
$p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']);
|
4433 |
else
|
4434 |
$p_header['comment'] = '';
|
|
|
4435 |
|
4436 |
// ----- Extract properties
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4437 |
|
4438 |
// ----- Recuperate date in UNIX format
|
4439 |
//if ($p_header['mdate'] && $p_header['mtime'])
|
4453 |
// ----- Get UNIX date format
|
4454 |
$p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
|
4455 |
|
|
|
4456 |
}
|
4457 |
else
|
4458 |
{
|
4459 |
$p_header['mtime'] = time();
|
|
|
4460 |
}
|
4461 |
|
4462 |
// ----- Set the stored filename
|
4466 |
$p_header['status'] = 'ok';
|
4467 |
|
4468 |
// ----- Look if it is a directory
|
|
|
|
|
4469 |
if (substr($p_header['filename'], -1) == '/') {
|
4470 |
//$p_header['external'] = 0x41FF0010;
|
4471 |
$p_header['external'] = 0x00000010;
|
|
|
4472 |
}
|
4473 |
|
|
|
4474 |
|
4475 |
// ----- Return
|
|
|
4476 |
return $v_result;
|
4477 |
}
|
4478 |
// --------------------------------------------------------------------------------
|
4487 |
// --------------------------------------------------------------------------------
|
4488 |
function privCheckFileHeaders(&$p_local_header, &$p_central_header)
|
4489 |
{
|
|
|
4490 |
$v_result=1;
|
4491 |
|
4492 |
// ----- Check the static values
|
4493 |
// TBC
|
4494 |
if ($p_local_header['filename'] != $p_central_header['filename']) {
|
|
|
4495 |
}
|
4496 |
if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) {
|
|
|
4497 |
}
|
4498 |
if ($p_local_header['flag'] != $p_central_header['flag']) {
|
|
|
4499 |
}
|
4500 |
if ($p_local_header['compression'] != $p_central_header['compression']) {
|
|
|
4501 |
}
|
4502 |
if ($p_local_header['mtime'] != $p_central_header['mtime']) {
|
|
|
4503 |
}
|
4504 |
if ($p_local_header['filename_len'] != $p_central_header['filename_len']) {
|
|
|
4505 |
}
|
4506 |
|
4507 |
// ----- Look for flag bit 3
|
4508 |
if (($p_local_header['flag'] & 8) == 8) {
|
|
|
|
|
4509 |
$p_local_header['size'] = $p_central_header['size'];
|
|
|
4510 |
$p_local_header['compressed_size'] = $p_central_header['compressed_size'];
|
|
|
4511 |
$p_local_header['crc'] = $p_central_header['crc'];
|
|
|
4512 |
}
|
4513 |
|
4514 |
// ----- Return
|
|
|
4515 |
return $v_result;
|
4516 |
}
|
4517 |
// --------------------------------------------------------------------------------
|
4524 |
// --------------------------------------------------------------------------------
|
4525 |
function privReadEndCentralDir(&$p_central_dir)
|
4526 |
{
|
|
|
4527 |
$v_result=1;
|
4528 |
|
4529 |
// ----- Go to the end of the zip file
|
4530 |
$v_size = filesize($this->zipname);
|
|
|
4531 |
@fseek($this->zip_fd, $v_size);
|
|
|
4532 |
if (@ftell($this->zip_fd) != $v_size)
|
4533 |
{
|
4534 |
// ----- Error log
|
4535 |
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \''.$this->zipname.'\'');
|
4536 |
|
4537 |
// ----- Return
|
|
|
4538 |
return PclZip::errorCode();
|
4539 |
}
|
4540 |
|
4542 |
// in this case the end of central dir is at 22 bytes of the file end
|
4543 |
$v_found = 0;
|
4544 |
if ($v_size > 26) {
|
|
|
4545 |
@fseek($this->zip_fd, $v_size-22);
|
|
|
4546 |
if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22))
|
4547 |
{
|
4548 |
// ----- Error log
|
4549 |
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
|
4550 |
|
4551 |
// ----- Return
|
|
|
4552 |
return PclZip::errorCode();
|
4553 |
}
|
4554 |
|
4555 |
// ----- Read for bytes
|
4556 |
$v_binary_data = @fread($this->zip_fd, 4);
|
|
|
4557 |
$v_data = @unpack('Vid', $v_binary_data);
|
|
|
4558 |
|
4559 |
// ----- Check signature
|
4560 |
if ($v_data['id'] == 0x06054b50) {
|
|
|
4561 |
$v_found = 1;
|
4562 |
}
|
4563 |
|
4566 |
|
4567 |
// ----- Go back to the maximum possible size of the Central Dir End Record
|
4568 |
if (!$v_found) {
|
|
|
4569 |
$v_maximum_size = 65557; // 0xFFFF + 22;
|
4570 |
if ($v_maximum_size > $v_size)
|
4571 |
$v_maximum_size = $v_size;
|
4576 |
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
|
4577 |
|
4578 |
// ----- Return
|
|
|
4579 |
return PclZip::errorCode();
|
4580 |
}
|
|
|
4581 |
|
4582 |
// ----- Read byte per byte in order to find the signature
|
4583 |
$v_pos = ftell($this->zip_fd);
|
4596 |
// ----- Compare the bytes
|
4597 |
if ($v_bytes == 0x504b0506)
|
4598 |
{
|
|
|
4599 |
$v_pos++;
|
4600 |
break;
|
4601 |
}
|
4606 |
// ----- Look if not found end of central dir
|
4607 |
if ($v_pos == $v_size)
|
4608 |
{
|
|
|
4609 |
|
4610 |
// ----- Error log
|
4611 |
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Unable to find End of Central Dir Record signature");
|
4612 |
|
4613 |
// ----- Return
|
|
|
4614 |
return PclZip::errorCode();
|
4615 |
}
|
4616 |
}
|
4621 |
// ----- Look for invalid block size
|
4622 |
if (strlen($v_binary_data) != 18)
|
4623 |
{
|
|
|
4624 |
|
4625 |
// ----- Error log
|
4626 |
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir Record size : ".strlen($v_binary_data));
|
4627 |
|
4628 |
// ----- Return
|
|
|
4629 |
return PclZip::errorCode();
|
4630 |
}
|
4631 |
|
4632 |
// ----- Extract the values
|
|
|
|
|
4633 |
$v_data = unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', $v_binary_data);
|
4634 |
|
4635 |
// ----- Check the global size
|
|
|
4636 |
if (($v_pos + $v_data['comment_size'] + 18) != $v_size) {
|
|
|
4637 |
|
4638 |
// ----- Removed in release 2.2 see readme file
|
4639 |
// The check of the file size is a little too strict.
|
4646 |
.' Some trailing bytes exists after the archive.');
|
4647 |
|
4648 |
// ----- Return
|
|
|
4649 |
return PclZip::errorCode();
|
4650 |
}
|
4651 |
}
|
4652 |
|
4653 |
// ----- Get comment
|
|
|
4654 |
if ($v_data['comment_size'] != 0) {
|
4655 |
$p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']);
|
4656 |
}
|
4657 |
else
|
4658 |
$p_central_dir['comment'] = '';
|
|
|
4659 |
|
4660 |
$p_central_dir['entries'] = $v_data['entries'];
|
|
|
4661 |
$p_central_dir['disk_entries'] = $v_data['disk_entries'];
|
|
|
4662 |
$p_central_dir['offset'] = $v_data['offset'];
|
|
|
4663 |
$p_central_dir['size'] = $v_data['size'];
|
|
|
4664 |
$p_central_dir['disk'] = $v_data['disk'];
|
|
|
4665 |
$p_central_dir['disk_start'] = $v_data['disk_start'];
|
|
|
4666 |
|
4667 |
// TBC
|
4668 |
//for(reset($p_central_dir); $key = key($p_central_dir); next($p_central_dir)) {
|
|
|
4669 |
//}
|
4670 |
|
4671 |
// ----- Return
|
|
|
4672 |
return $v_result;
|
4673 |
}
|
4674 |
// --------------------------------------------------------------------------------
|
4681 |
// --------------------------------------------------------------------------------
|
4682 |
function privDeleteByRule(&$p_result_list, &$p_options)
|
4683 |
{
|
|
|
4684 |
$v_result=1;
|
4685 |
$v_list_detail = array();
|
4686 |
|
4687 |
// ----- Open the zip file
|
|
|
4688 |
if (($v_result=$this->privOpenFd('rb')) != 1)
|
4689 |
{
|
4690 |
// ----- Return
|
|
|
4691 |
return $v_result;
|
4692 |
}
|
4693 |
|
4696 |
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
|
4697 |
{
|
4698 |
$this->privCloseFd();
|
|
|
4699 |
return $v_result;
|
4700 |
}
|
4701 |
|
4702 |
// ----- Go to beginning of File
|
|
|
4703 |
@rewind($this->zip_fd);
|
|
|
4704 |
|
4705 |
// ----- Scan all the files
|
4706 |
// ----- Start at beginning of Central Dir
|
4707 |
$v_pos_entry = $v_central_dir['offset'];
|
|
|
4708 |
@rewind($this->zip_fd);
|
|
|
4709 |
if (@fseek($this->zip_fd, $v_pos_entry))
|
4710 |
{
|
4711 |
// ----- Close the zip file
|
4715 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
|
4716 |
|
4717 |
// ----- Return
|
|
|
4718 |
return PclZip::errorCode();
|
4719 |
}
|
|
|
4720 |
|
4721 |
// ----- Read each entry
|
4722 |
$v_header_list = array();
|
4723 |
$j_start = 0;
|
4724 |
for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
|
4725 |
{
|
|
|
4726 |
|
4727 |
// ----- Read the file header
|
4728 |
$v_header_list[$v_nb_extracted] = array();
|
4731 |
// ----- Close the zip file
|
4732 |
$this->privCloseFd();
|
4733 |
|
|
|
4734 |
return $v_result;
|
4735 |
}
|
4736 |
|
|
|
4737 |
|
4738 |
// ----- Store the index
|
4739 |
$v_header_list[$v_nb_extracted]['index'] = $i;
|
4744 |
// ----- Look for extract by name rule
|
4745 |
if ( (isset($p_options[PCLZIP_OPT_BY_NAME]))
|
4746 |
&& ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
|
|
|
4747 |
|
4748 |
// ----- Look if the filename is in the list
|
4749 |
for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) {
|
|
|
4750 |
|
4751 |
// ----- Look for a directory
|
4752 |
if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
|
|
|
4753 |
|
4754 |
// ----- Look if the directory is in the filename path
|
4755 |
if ( (strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
|
4756 |
&& (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
|
|
|
4757 |
$v_found = true;
|
4758 |
}
|
4759 |
elseif ( (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */
|
4760 |
&& ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
|
|
|
4761 |
$v_found = true;
|
4762 |
}
|
4763 |
}
|
4764 |
// ----- Look for a filename
|
4765 |
elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
|
|
|
4766 |
$v_found = true;
|
4767 |
}
|
4768 |
}
|
4773 |
/*
|
4774 |
else if ( (isset($p_options[PCLZIP_OPT_BY_EREG]))
|
4775 |
&& ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
|
|
|
4776 |
|
4777 |
if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
|
|
|
4778 |
$v_found = true;
|
4779 |
}
|
4780 |
}
|
4783 |
// ----- Look for extract by preg rule
|
4784 |
else if ( (isset($p_options[PCLZIP_OPT_BY_PREG]))
|
4785 |
&& ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
|
|
|
4786 |
|
4787 |
if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
|
|
|
4788 |
$v_found = true;
|
4789 |
}
|
4790 |
}
|
4792 |
// ----- Look for extract by index rule
|
4793 |
else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX]))
|
4794 |
&& ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
|
|
|
4795 |
|
4796 |
// ----- Look if the index is in the list
|
4797 |
for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) {
|
|
|
4798 |
|
4799 |
if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
|
|
|
4800 |
$v_found = true;
|
4801 |
}
|
4802 |
if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
|
|
|
4803 |
$j_start = $j+1;
|
4804 |
}
|
4805 |
|
4806 |
if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
|
|
|
4807 |
break;
|
4808 |
}
|
4809 |
}
|
4810 |
}
|
4811 |
else {
|
|
|
4812 |
$v_found = true;
|
4813 |
}
|
4814 |
|
4815 |
// ----- Look for deletion
|
4816 |
if ($v_found)
|
4817 |
{
|
|
|
4818 |
unset($v_header_list[$v_nb_extracted]);
|
4819 |
}
|
4820 |
else
|
4821 |
{
|
|
|
4822 |
$v_nb_extracted++;
|
4823 |
}
|
4824 |
}
|
4833 |
$v_temp_zip = new PclZip($v_zip_temp_name);
|
4834 |
|
4835 |
// ----- Open the temporary zip file in write mode
|
|
|
4836 |
if (($v_result = $v_temp_zip->privOpenFd('wb')) != 1) {
|
4837 |
$this->privCloseFd();
|
4838 |
|
4839 |
// ----- Return
|
|
|
4840 |
return $v_result;
|
4841 |
}
|
4842 |
|
4843 |
// ----- Look which file need to be kept
|
4844 |
for ($i=0; $i<sizeof($v_header_list); $i++) {
|
|
|
4845 |
|
4846 |
// ----- Calculate the position of the header
|
|
|
|
|
4847 |
@rewind($this->zip_fd);
|
|
|
4848 |
if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) {
|
4849 |
// ----- Close the zip file
|
4850 |
$this->privCloseFd();
|
4855 |
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
|
4856 |
|
4857 |
// ----- Return
|
|
|
4858 |
return PclZip::errorCode();
|
4859 |
}
|
|
|
4860 |
|
4861 |
// ----- Read the file header
|
4862 |
$v_local_header = array();
|
4867 |
@unlink($v_zip_temp_name);
|
4868 |
|
4869 |
// ----- Return
|
|
|
4870 |
return $v_result;
|
4871 |
}
|
4872 |
|
4885 |
@unlink($v_zip_temp_name);
|
4886 |
|
4887 |
// ----- Return
|
|
|
4888 |
return $v_result;
|
4889 |
}
|
|
|
4890 |
|
4891 |
// ----- Read/write the data block
|
4892 |
if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) {
|
4896 |
@unlink($v_zip_temp_name);
|
4897 |
|
4898 |
// ----- Return
|
|
|
4899 |
return $v_result;
|
4900 |
}
|
4901 |
}
|
4902 |
|
4903 |
// ----- Store the offset of the central dir
|
4904 |
$v_offset = @ftell($v_temp_zip->zip_fd);
|
|
|
4905 |
|
4906 |
// ----- Re-Create the Central Dir files header
|
|
|
4907 |
for ($i=0; $i<sizeof($v_header_list); $i++) {
|
4908 |
// ----- Create the file header
|
|
|
4909 |
if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
|
4910 |
$v_temp_zip->privCloseFd();
|
4911 |
$this->privCloseFd();
|
4912 |
@unlink($v_zip_temp_name);
|
4913 |
|
4914 |
// ----- Return
|
|
|
4915 |
return $v_result;
|
4916 |
}
|
4917 |
|
4919 |
$v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
|
4920 |
}
|
4921 |
|
|
|
4922 |
|
4923 |
// ----- Zip file comment
|
4924 |
$v_comment = '';
|
4938 |
@unlink($v_zip_temp_name);
|
4939 |
|
4940 |
// ----- Return
|
|
|
4941 |
return $v_result;
|
4942 |
}
|
4943 |
|
4963 |
$this->privCloseFd();
|
4964 |
|
4965 |
if (($v_result = $this->privOpenFd('wb')) != 1) {
|
|
|
4966 |
return $v_result;
|
4967 |
}
|
4968 |
|
4969 |
if (($v_result = $this->privWriteCentralHeader(0, 0, 0, '')) != 1) {
|
|
|
4970 |
return $v_result;
|
4971 |
}
|
4972 |
|
4974 |
}
|
4975 |
|
4976 |
// ----- Return
|
|
|
4977 |
return $v_result;
|
4978 |
}
|
4979 |
// --------------------------------------------------------------------------------
|
4993 |
{
|
4994 |
$v_result = 1;
|
4995 |
|
|
|
4996 |
|
4997 |
// ----- Remove the final '/'
|
4998 |
if (($p_is_dir) && (substr($p_dir, -1)=='/'))
|
4999 |
{
|
5000 |
$p_dir = substr($p_dir, 0, strlen($p_dir)-1);
|
5001 |
}
|
|
|
5002 |
|
5003 |
// ----- Check the directory availability
|
5004 |
if ((is_dir($p_dir)) || ($p_dir == ""))
|
5005 |
{
|
|
|
5006 |
return 1;
|
5007 |
}
|
5008 |
|
5009 |
// ----- Extract parent directory
|
5010 |
$p_parent_dir = dirname($p_dir);
|
|
|
5011 |
|
5012 |
// ----- Just a check
|
5013 |
if ($p_parent_dir != $p_dir)
|
5017 |
{
|
5018 |
if (($v_result = $this->privDirCheck($p_parent_dir)) != 1)
|
5019 |
{
|
|
|
5020 |
return $v_result;
|
5021 |
}
|
5022 |
}
|
5023 |
}
|
5024 |
|
5025 |
// ----- Create the directory
|
|
|
5026 |
if (!@mkdir($p_dir, 0777))
|
5027 |
{
|
5028 |
// ----- Error log
|
5029 |
PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'");
|
5030 |
|
5031 |
// ----- Return
|
|
|
5032 |
return PclZip::errorCode();
|
5033 |
}
|
5034 |
|
5035 |
// ----- Return
|
|
|
5036 |
return $v_result;
|
5037 |
}
|
5038 |
// --------------------------------------------------------------------------------
|
5046 |
// --------------------------------------------------------------------------------
|
5047 |
function privMerge(&$p_archive_to_add)
|
5048 |
{
|
|
|
5049 |
$v_result=1;
|
5050 |
|
5051 |
// ----- Look if the archive_to_add exists
|
5052 |
if (!is_file($p_archive_to_add->zipname))
|
5053 |
{
|
|
|
5054 |
|
5055 |
// ----- Nothing to merge, so merge is a success
|
5056 |
$v_result = 1;
|
5057 |
|
5058 |
// ----- Return
|
|
|
5059 |
return $v_result;
|
5060 |
}
|
5061 |
|
5062 |
// ----- Look if the archive exists
|
5063 |
if (!is_file($this->zipname))
|
5064 |
{
|
|
|
5065 |
|
5066 |
// ----- Do a duplicate
|
5067 |
$v_result = $this->privDuplicate($p_archive_to_add->zipname);
|
5068 |
|
5069 |
// ----- Return
|
|
|
5070 |
return $v_result;
|
5071 |
}
|
5072 |
|
5073 |
// ----- Open the zip file
|
|
|
5074 |
if (($v_result=$this->privOpenFd('rb')) != 1)
|
5075 |
{
|
5076 |
// ----- Return
|
|
|
5077 |
return $v_result;
|
5078 |
}
|
5079 |
|
5082 |
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
|
5083 |
{
|
5084 |
$this->privCloseFd();
|
|
|
5085 |
return $v_result;
|
5086 |
}
|
5087 |
|
5088 |
// ----- Go to beginning of File
|
|
|
5089 |
@rewind($this->zip_fd);
|
|
|
5090 |
|
5091 |
// ----- Open the archive_to_add file
|
|
|
5092 |
if (($v_result=$p_archive_to_add->privOpenFd('rb')) != 1)
|
5093 |
{
|
5094 |
$this->privCloseFd();
|
5095 |
|
5096 |
// ----- Return
|
|
|
5097 |
return $v_result;
|
5098 |
}
|
5099 |
|
5104 |
$this->privCloseFd();
|
5105 |
$p_archive_to_add->privCloseFd();
|
5106 |
|
|
|
5107 |
return $v_result;
|
5108 |
}
|
5109 |
|
5110 |
// ----- Go to beginning of File
|
|
|
5111 |
@rewind($p_archive_to_add->zip_fd);
|
|
|
5112 |
|
5113 |
// ----- Creates a temporay file
|
5114 |
$v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
|
5115 |
|
5116 |
// ----- Open the temporary file in write mode
|
|
|
5117 |
if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
|
5118 |
{
|
5119 |
$this->privCloseFd();
|
5122 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');
|
5123 |
|
5124 |
// ----- Return
|
|
|
5125 |
return PclZip::errorCode();
|
5126 |
}
|
5127 |
|
5131 |
while ($v_size != 0)
|
5132 |
{
|
5133 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
|
|
5134 |
$v_buffer = fread($this->zip_fd, $v_read_size);
|
5135 |
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
|
5136 |
$v_size -= $v_read_size;
|
5141 |
while ($v_size != 0)
|
5142 |
{
|
5143 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
|
|
5144 |
$v_buffer = fread($p_archive_to_add->zip_fd, $v_read_size);
|
5145 |
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
|
5146 |
$v_size -= $v_read_size;
|
5148 |
|
5149 |
// ----- Store the offset of the central dir
|
5150 |
$v_offset = @ftell($v_zip_temp_fd);
|
|
|
5151 |
|
5152 |
// ----- Copy the block of file headers from the old archive
|
5153 |
$v_size = $v_central_dir['size'];
|
5154 |
while ($v_size != 0)
|
5155 |
{
|
5156 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
|
|
5157 |
$v_buffer = @fread($this->zip_fd, $v_read_size);
|
5158 |
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
|
5159 |
$v_size -= $v_read_size;
|
5164 |
while ($v_size != 0)
|
5165 |
{
|
5166 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
|
|
5167 |
$v_buffer = @fread($p_archive_to_add->zip_fd, $v_read_size);
|
5168 |
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
|
5169 |
$v_size -= $v_read_size;
|
5194 |
unset($v_header_list);
|
5195 |
|
5196 |
// ----- Return
|
|
|
5197 |
return $v_result;
|
5198 |
}
|
5199 |
|
5219 |
PclZipUtilRename($v_zip_temp_name, $this->zipname);
|
5220 |
|
5221 |
// ----- Return
|
|
|
5222 |
return $v_result;
|
5223 |
}
|
5224 |
// --------------------------------------------------------------------------------
|
5231 |
// --------------------------------------------------------------------------------
|
5232 |
function privDuplicate($p_archive_filename)
|
5233 |
{
|
|
|
5234 |
$v_result=1;
|
5235 |
|
5236 |
// ----- Look if the $p_archive_filename exists
|
5237 |
if (!is_file($p_archive_filename))
|
5238 |
{
|
|
|
5239 |
|
5240 |
// ----- Nothing to duplicate, so duplicate is a success.
|
5241 |
$v_result = 1;
|
5242 |
|
5243 |
// ----- Return
|
|
|
5244 |
return $v_result;
|
5245 |
}
|
5246 |
|
5247 |
// ----- Open the zip file
|
|
|
5248 |
if (($v_result=$this->privOpenFd('wb')) != 1)
|
5249 |
{
|
5250 |
// ----- Return
|
|
|
5251 |
return $v_result;
|
5252 |
}
|
5253 |
|
5254 |
// ----- Open the temporary file in write mode
|
|
|
5255 |
if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0)
|
5256 |
{
|
5257 |
$this->privCloseFd();
|
5259 |
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \''.$p_archive_filename.'\' in binary write mode');
|
5260 |
|
5261 |
// ----- Return
|
|
|
5262 |
return PclZip::errorCode();
|
5263 |
}
|
5264 |
|
5268 |
while ($v_size != 0)
|
5269 |
{
|
5270 |
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
|
|
5271 |
$v_buffer = fread($v_zip_temp_fd, $v_read_size);
|
5272 |
@fwrite($this->zip_fd, $v_buffer, $v_read_size);
|
5273 |
$v_size -= $v_read_size;
|
5280 |
@fclose($v_zip_temp_fd);
|
5281 |
|
5282 |
// ----- Return
|
|
|
5283 |
return $v_result;
|
5284 |
}
|
5285 |
// --------------------------------------------------------------------------------
|
5326 |
// --------------------------------------------------------------------------------
|
5327 |
function privDisableMagicQuotes()
|
5328 |
{
|
|
|
5329 |
$v_result=1;
|
5330 |
|
5331 |
// ----- Look if function exists
|
5332 |
if ( (!function_exists("get_magic_quotes_runtime"))
|
5333 |
|| (!function_exists("set_magic_quotes_runtime"))) {
|
|
|
|
|
5334 |
return $v_result;
|
5335 |
}
|
5336 |
|
5337 |
// ----- Look if already done
|
5338 |
if ($this->magic_quotes_status != -1) {
|
|
|
|
|
5339 |
return $v_result;
|
5340 |
}
|
5341 |
|
5342 |
// ----- Get and memorize the magic_quote value
|
5343 |
$this->magic_quotes_status = @get_magic_quotes_runtime();
|
|
|
5344 |
|
5345 |
// ----- Disable magic_quotes
|
5346 |
if ($this->magic_quotes_status == 1) {
|
|
|
5347 |
@set_magic_quotes_runtime(0);
|
5348 |
}
|
5349 |
|
5350 |
// ----- Return
|
|
|
5351 |
return $v_result;
|
5352 |
}
|
5353 |
// --------------------------------------------------------------------------------
|
5360 |
// --------------------------------------------------------------------------------
|
5361 |
function privSwapBackMagicQuotes()
|
5362 |
{
|
|
|
5363 |
$v_result=1;
|
5364 |
|
5365 |
// ----- Look if function exists
|
5366 |
if ( (!function_exists("get_magic_quotes_runtime"))
|
5367 |
|| (!function_exists("set_magic_quotes_runtime"))) {
|
|
|
|
|
5368 |
return $v_result;
|
5369 |
}
|
5370 |
|
5371 |
// ----- Look if something to do
|
5372 |
if ($this->magic_quotes_status != -1) {
|
|
|
|
|
5373 |
return $v_result;
|
5374 |
}
|
5375 |
|
5376 |
// ----- Swap back magic_quotes
|
5377 |
if ($this->magic_quotes_status == 1) {
|
|
|
5378 |
@set_magic_quotes_runtime($this->magic_quotes_status);
|
5379 |
}
|
5380 |
|
5381 |
// ----- Return
|
|
|
5382 |
return $v_result;
|
5383 |
}
|
5384 |
// --------------------------------------------------------------------------------
|
5395 |
// --------------------------------------------------------------------------------
|
5396 |
function PclZipUtilPathReduction($p_dir)
|
5397 |
{
|
|
|
5398 |
$v_result = "";
|
5399 |
|
5400 |
// ----- Look for not empty path
|
5421 |
// ----- It is an invalid path, so the path is not modified
|
5422 |
// TBC
|
5423 |
$v_result = $p_dir;
|
|
|
5424 |
$v_skip = 0;
|
5425 |
}
|
5426 |
}
|
5455 |
}
|
5456 |
|
5457 |
// ----- Return
|
|
|
5458 |
return $v_result;
|
5459 |
}
|
5460 |
// --------------------------------------------------------------------------------
|
5476 |
// --------------------------------------------------------------------------------
|
5477 |
function PclZipUtilPathInclusion($p_dir, $p_path)
|
5478 |
{
|
|
|
5479 |
$v_result = 1;
|
5480 |
|
5481 |
// ----- Look for path beginning by ./
|
5482 |
if ( ($p_dir == '.')
|
5483 |
|| ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) {
|
5484 |
$p_dir = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_dir, 1);
|
|
|
5485 |
}
|
5486 |
if ( ($p_path == '.')
|
5487 |
|| ((strlen($p_path) >=2) && (substr($p_path, 0, 2) == './'))) {
|
5488 |
$p_path = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_path, 1);
|
|
|
5489 |
}
|
5490 |
|
5491 |
// ----- Explode dir and path by directory separator
|
5498 |
$i = 0;
|
5499 |
$j = 0;
|
5500 |
while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && ($v_result)) {
|
|
|
5501 |
|
5502 |
// ----- Look for empty dir (path reduction)
|
5503 |
if ($v_list_dir[$i] == '') {
|
5511 |
|
5512 |
// ----- Compare the items
|
5513 |
if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ( $v_list_path[$j] != '')) {
|
|
|
5514 |
$v_result = 0;
|
5515 |
}
|
5516 |
|
5521 |
|
5522 |
// ----- Look if everything seems to be the same
|
5523 |
if ($v_result) {
|
|
|
5524 |
// ----- Skip all the empty items
|
5525 |
while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++;
|
5526 |
while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++;
|
|
|
5527 |
|
5528 |
if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) {
|
5529 |
// ----- There are exactly the same
|
5536 |
}
|
5537 |
|
5538 |
// ----- Return
|
|
|
5539 |
return $v_result;
|
5540 |
}
|
5541 |
// --------------------------------------------------------------------------------
|
5553 |
// --------------------------------------------------------------------------------
|
5554 |
function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0)
|
5555 |
{
|
|
|
5556 |
$v_result = 1;
|
5557 |
|
5558 |
if ($p_mode==0)
|
5559 |
{
|
|
|
|
|
5560 |
while ($p_size != 0)
|
5561 |
{
|
5562 |
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
|
|
|
5563 |
$v_buffer = @fread($p_src, $v_read_size);
|
5564 |
@fwrite($p_dest, $v_buffer, $v_read_size);
|
5565 |
$p_size -= $v_read_size;
|
5566 |
}
|
|
|
|
|
5567 |
}
|
5568 |
else if ($p_mode==1)
|
5569 |
{
|
5570 |
while ($p_size != 0)
|
5571 |
{
|
5572 |
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
|
|
|
5573 |
$v_buffer = @gzread($p_src, $v_read_size);
|
5574 |
@fwrite($p_dest, $v_buffer, $v_read_size);
|
5575 |
$p_size -= $v_read_size;
|
5580 |
while ($p_size != 0)
|
5581 |
{
|
5582 |
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
|
|
|
5583 |
$v_buffer = @fread($p_src, $v_read_size);
|
5584 |
@gzwrite($p_dest, $v_buffer, $v_read_size);
|
5585 |
$p_size -= $v_read_size;
|
5590 |
while ($p_size != 0)
|
5591 |
{
|
5592 |
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
|
|
|
5593 |
$v_buffer = @gzread($p_src, $v_read_size);
|
5594 |
@gzwrite($p_dest, $v_buffer, $v_read_size);
|
5595 |
$p_size -= $v_read_size;
|
5597 |
}
|
5598 |
|
5599 |
// ----- Return
|
|
|
5600 |
return $v_result;
|
5601 |
}
|
5602 |
// --------------------------------------------------------------------------------
|
5615 |
// --------------------------------------------------------------------------------
|
5616 |
function PclZipUtilRename($p_src, $p_dest)
|
5617 |
{
|
|
|
5618 |
$v_result = 1;
|
5619 |
|
5620 |
// ----- Try to rename the files
|
5621 |
if (!@rename($p_src, $p_dest)) {
|
|
|
5622 |
|
5623 |
// ----- Try to copy & unlink the src
|
5624 |
if (!@copy($p_src, $p_dest)) {
|
|
|
5625 |
$v_result = 0;
|
5626 |
}
|
5627 |
else if (!@unlink($p_src)) {
|
|
|
5628 |
$v_result = 0;
|
5629 |
}
|
5630 |
}
|
5631 |
|
5632 |
// ----- Return
|
|
|
5633 |
return $v_result;
|
5634 |
}
|
5635 |
// --------------------------------------------------------------------------------
|
5645 |
// --------------------------------------------------------------------------------
|
5646 |
function PclZipUtilOptionText($p_option)
|
5647 |
{
|
|
|
5648 |
|
5649 |
$v_list = get_defined_constants();
|
5650 |
for (reset($v_list); $v_key = key($v_list); next($v_list)) {
|
5653 |
|| ($v_prefix == 'PCLZIP_CB_')
|
5654 |
|| ($v_prefix == 'PCLZIP_ATT'))
|
5655 |
&& ($v_list[$v_key] == $p_option)) {
|
|
|
5656 |
return $v_key;
|
5657 |
}
|
5658 |
}
|
5659 |
|
5660 |
$v_result = 'Unknown';
|
5661 |
|
|
|
5662 |
return $v_result;
|
5663 |
}
|
5664 |
// --------------------------------------------------------------------------------
|
app/options-edit.php
DELETED
@@ -1,190 +0,0 @@
|
|
1 |
-
<div class="wrap">
|
2 |
-
<div id="icon-tools" class="icon32"><br /></div>
|
3 |
-
<h2><?php _e('Edit BackWPup Job', 'backwpup'); ?></h2>
|
4 |
-
|
5 |
-
<form method="post" action="">
|
6 |
-
<input type="hidden" name="action" value="saveeditjob" />
|
7 |
-
<input type="hidden" name="jobid" value="<?PHP echo $jobid;?>" />
|
8 |
-
<?php
|
9 |
-
wp_nonce_field('edit-job');
|
10 |
-
if (empty($jobs[$jobid]['type']))
|
11 |
-
$jobs[$jobid]['type']='DB+FILE';
|
12 |
-
|
13 |
-
|
14 |
-
if ($jobs[$jobid]['type']=='OPTIMIZE' or $jobs[$jobid]['type']=='CHECK') {
|
15 |
-
echo '<input type="hidden" name="backupdir" value="'.$jobs[$jobid]['backupdir'].'" />';
|
16 |
-
echo '<input type="hidden" name="maxbackups" value="'.$jobs[$jobid]['maxbackups'].'" />';
|
17 |
-
}
|
18 |
-
if ($jobs[$jobid]['type']=='DB' or $jobs[$jobid]['type']=='OPTIMIZE' or $jobs[$jobid]['type']=='CHECK') {
|
19 |
-
echo '<input type="hidden" name="fileexclude" value="'.$jobs[$jobid]['fileexclude'].'" />';
|
20 |
-
}
|
21 |
-
if ($jobs[$jobid]['type']=='FILE') {
|
22 |
-
if (is_array($jobs[$jobid]['dbexclude'])) {
|
23 |
-
foreach ($jobs[$jobid]['dbexclude'] as $table) {
|
24 |
-
echo '<input type="hidden" name="dbexclude[]" value="'.$table.'" />';
|
25 |
-
}
|
26 |
-
}
|
27 |
-
}
|
28 |
-
|
29 |
-
|
30 |
-
?>
|
31 |
-
|
32 |
-
<table class="form-table">
|
33 |
-
|
34 |
-
<tr valign="top">
|
35 |
-
<th scope="row"><label for="job_type"><?PHP _e('Job Type','backwpup'); ?></label></th>
|
36 |
-
<td>
|
37 |
-
<select name="type" id="job_type">
|
38 |
-
<?php
|
39 |
-
foreach (backwpup_backup_types() as $type) {
|
40 |
-
echo '<option value="'.$type.'"'.selected($type,$jobs[$jobid]['type'],false).'>'.backwpup_backup_types($type).'</option>';
|
41 |
-
}
|
42 |
-
?>
|
43 |
-
</select>
|
44 |
-
<input type="submit" name="change" class="button" value="<?php _e('Change', 'backwpup'); ?>" />
|
45 |
-
</td>
|
46 |
-
</tr>
|
47 |
-
|
48 |
-
<tr valign="top">
|
49 |
-
<th scope="row"><label for="jobname"><?PHP _e('Job Name','backwpup'); ?></label></th>
|
50 |
-
<td><input name="name" type="text" id="jobname" value="<?PHP echo $jobs[$jobid]['name'];?>" class="regular-text" /></td>
|
51 |
-
</tr>
|
52 |
-
|
53 |
-
<?PHP if ($jobs[$jobid]['type']=='DB' or $jobs[$jobid]['type']=='DB+FILE' or $jobs[$jobid]['type']=='OPTIMIZE' or $jobs[$jobid]['type']=='CHECK') {?>
|
54 |
-
<tr valign="top">
|
55 |
-
<th scope="row"><label for="dbexclude"><?PHP _e('Exclude Databas Tabels:','backwpup'); ?></label></th><td>
|
56 |
-
<?php
|
57 |
-
$tables=$wpdb->get_col('SHOW TABLES FROM `'.DB_NAME.'`');
|
58 |
-
if (!isset($jobs[$jobid]['dbexclude'])) { //def.
|
59 |
-
foreach ($tables as $table) {
|
60 |
-
if (substr($table,0,strlen($wpdb->prefix))!=$wpdb->prefix)
|
61 |
-
$jobs[$jobid]['dbexclude'][]=$table;
|
62 |
-
}
|
63 |
-
}
|
64 |
-
foreach ($tables as $table) {
|
65 |
-
if ($wpdb->backwpup_logs<>$table)
|
66 |
-
echo ' <input class="checkbox" type="checkbox"'.checked(in_array($table,(array)$jobs[$jobid]['dbexclude']),true,false).' name="dbexclude[]" value="'.$table.'"/> '.$table.'<br />';
|
67 |
-
}
|
68 |
-
|
69 |
-
?>
|
70 |
-
</td></tr>
|
71 |
-
<?PHP } ?>
|
72 |
-
<?PHP if ($jobs[$jobid]['type']=='FILE' or $jobs[$jobid]['type']=='DB+FILE') {?>
|
73 |
-
<?PHP if (!isset($jobs[$jobid]['backuproot'])) $jobs[$jobid]['backuproot']=true; if (!isset($jobs[$jobid]['backupcontent'])) $jobs[$jobid]['backupcontent']=true; if (!isset($jobs[$jobid]['backupplugins'])) $jobs[$jobid]['backupplugins']=true;?>
|
74 |
-
<tr valign="top">
|
75 |
-
<th scope="row"><label for="fileinclude"><?PHP _e('Backup Blog directorys','backwpup'); ?></label></th><td>
|
76 |
-
<input class="checkbox" type="checkbox"<?php checked($jobs[$jobid]['backuproot'],true,true);?> name="backuproot" value="1"/> <?php _e('Blog root and WP Files','backwpup');?><br />
|
77 |
-
<input class="checkbox" type="checkbox"<?php checked($jobs[$jobid]['backupcontent'],true,true);?> name="backupcontent" value="1"/> <?php _e('Blog Content','backwpup');?><br />
|
78 |
-
<input class="checkbox" type="checkbox"<?php checked($jobs[$jobid]['backupplugins'],true,true);?> name="backupplugins" value="1"/> <?php _e('Blog Plugins','backwpup');?>
|
79 |
-
</td></tr>
|
80 |
-
|
81 |
-
<tr valign="top">
|
82 |
-
<th scope="row"><label for="dirinclude"><?PHP _e('Include directorys','backwpup'); ?></label></th><td>
|
83 |
-
<input name="dirinclude" type="text" value="<?PHP echo $jobs[$jobid]['dirinclude'];?>" class="regular-text" /><span class="description"><?PHP echo __('Separate with ,. Full Path like:','backwpup').' '.str_replace('\\','/',ABSPATH); ?></span>
|
84 |
-
</td></tr>
|
85 |
-
|
86 |
-
<tr valign="top">
|
87 |
-
<th scope="row"><label for="fileexclude"><?PHP _e('Exclude files/directorys','backwpup'); ?></label></th><td>
|
88 |
-
<input name="fileexclude" type="text" value="<?PHP echo $jobs[$jobid]['fileexclude'];?>" class="regular-text" /><span class="description"><?PHP _e('Separate with ,','backwpup') ?></span>
|
89 |
-
</td></tr>
|
90 |
-
<?PHP } ?>
|
91 |
-
|
92 |
-
<tr valign="top">
|
93 |
-
<th scope="row"><label for="jobname"><?PHP _e('Schedule','backwpup'); ?></label></th>
|
94 |
-
<td>
|
95 |
-
<?php
|
96 |
-
_e('Run Every:', 'backwpup');
|
97 |
-
echo '<select name="scheduleintervalteimes">';
|
98 |
-
for ($i=1;$i<=60;$i++) {
|
99 |
-
echo '<option value="'.$i.'"'.selected($i,$jobs[$jobid]['scheduleintervalteimes'],false).'>'.$i.'</option>';
|
100 |
-
}
|
101 |
-
echo '</select>';
|
102 |
-
if (empty($jobs[$jobid]['scheduleintervaltype']))
|
103 |
-
$jobs[$jobid]['scheduleintervaltype']=3600;
|
104 |
-
echo '<select name="scheduleintervaltype">';
|
105 |
-
echo '<option value="60"'.selected('3600',$jobs[$jobid]['scheduleintervaltype'],false).'>'.__('Min(s)','backwpup').'</option>';
|
106 |
-
echo '<option value="3600"'.selected('3600',$jobs[$jobid]['scheduleintervaltype'],false).'>'.__('Houer(s)','backwpup').'</option>';
|
107 |
-
echo '<option value="86400"'.selected('86400',$jobs[$jobid]['scheduleintervaltype'],false).'>'.__('Day(s)','backwpup').'</option>';
|
108 |
-
echo '</select><br />';
|
109 |
-
|
110 |
-
_e('Start Time:', 'backwpup');
|
111 |
-
if (empty($jobs[$jobid]['scheduletime']))
|
112 |
-
$jobs[$jobid]['scheduletime']=time();
|
113 |
-
|
114 |
-
echo '<select name="schedulehour">';
|
115 |
-
for ($i=0;$i<=23;$i++) {
|
116 |
-
echo '<option value="'.$i.'"'.selected($i,date_i18n('G',$jobs[$jobid]['scheduletime']),false).'>'.$i.'</option>';
|
117 |
-
}
|
118 |
-
echo '</select>:';
|
119 |
-
echo '<select name="scheduleminute">';
|
120 |
-
for ($i=0;$i<=59;$i++) {
|
121 |
-
echo '<option value="'.$i.'"'.selected($i,date_i18n('i',$jobs[$jobid]['scheduletime']),false).'>'.$i.'</option>';
|
122 |
-
}
|
123 |
-
echo '</select><br />';
|
124 |
-
_e('Start Date:', 'backwpup');
|
125 |
-
echo '<select name="scheduleday">';
|
126 |
-
for ($i=1;$i<=31;$i++) {
|
127 |
-
echo '<option value="'.$i.'"'.selected($i,date_i18n('j',$jobs[$jobid]['scheduletime']),false).'>'.$i.'</option>';
|
128 |
-
}
|
129 |
-
echo '</select>.';
|
130 |
-
$month=array('1'=>__('January'),'2'=>__('February'),'3'=>__('March'),'4'=>__('April'),'5'=>__('May'),'6'=>__('June'),'7'=>__('July'),'8'=>__('August'),'9'=>__('September'),'10'=>__('October'),'11'=>__('November'),'12'=>__('December'));
|
131 |
-
echo '<select name="schedulemonth">';
|
132 |
-
for ($i=1;$i<=12;$i++) {
|
133 |
-
echo '<option value="'.$i.'"'.selected($i,date_i18n('n',$jobs[$jobid]['scheduletime']),false).'>'.$month[$i].'</option>';
|
134 |
-
}
|
135 |
-
echo '</select>.';
|
136 |
-
echo '<select name="scheduleyear">';
|
137 |
-
for ($i=date_i18n('Y')-1;$i<=date_i18n('Y')+3;$i++) {
|
138 |
-
echo '<option value="'.$i.'"'.selected($i,date_i18n('Y',$jobs[$jobid]['scheduletime']),false).'>'.$i.'</option>';
|
139 |
-
}
|
140 |
-
echo '</select><br />';
|
141 |
-
?>
|
142 |
-
<input class="checkbox" value="1" type="checkbox" <?php checked($jobs[$jobid]['activated'],true); ?> name="activated" /> <?PHP _e('Activate scheduleing', 'backwpup'); ?>
|
143 |
-
</td>
|
144 |
-
</tr>
|
145 |
-
|
146 |
-
<?PHP if ($jobs[$jobid]['type']=='FILE' or $jobs[$jobid]['type']=='DB' or $jobs[$jobid]['type']=='DB+FILE') {?>
|
147 |
-
<tr valign="top">
|
148 |
-
<?PHP if (empty($jobs[$jobid]['backupdir'])) $jobs[$jobid]['backupdir']=str_replace('\\','/',WP_CONTENT_DIR).'/backwpup/';?>
|
149 |
-
<th scope="row"><label for="backupdir"><?PHP _e('Save Backups to directory','backwpup'); ?></label></th>
|
150 |
-
<td><input name="backupdir" type="text" value="<?PHP echo $jobs[$jobid]['backupdir'];?>" class="regular-text" /><span class="description"><?PHP _e('Full Phath of Directory for Backup fiels','backwpup'); ?></span></td>
|
151 |
-
</tr>
|
152 |
-
<tr valign="top">
|
153 |
-
<th scope="row"><label for="maxbackups"><?PHP _e('Max. number of Backup Files','backwpup'); ?></label></th>
|
154 |
-
<td>
|
155 |
-
<input name="maxbackups" type="text" value="<?PHP echo $jobs[$jobid]['maxbackups'];?>" class="small-text" /><span class="description"><?PHP _e('0=off','backwpup');?> <?PHP _e('Oldest files will deletet first.','backwpup');?></span>
|
156 |
-
</td>
|
157 |
-
</tr>
|
158 |
-
|
159 |
-
|
160 |
-
<tr valign="top">
|
161 |
-
<th scope="row"><label for="ftptransfer"><?PHP _e('Copy Backup to FTP Server','backwpup'); ?></label></th>
|
162 |
-
<td>
|
163 |
-
<?PHP _e('Ftp Hostname:','backwpup'); ?><input name="ftphost" type="text" value="<?PHP echo $jobs[$jobid]['ftphost'];?>" class="regular-text" /><br />
|
164 |
-
<?PHP _e('Ftp Username:','backwpup'); ?><input name="ftpuser" type="text" value="<?PHP echo $jobs[$jobid]['ftpuser'];?>" class="user" /><br />
|
165 |
-
<?PHP _e('Ftp Password:','backwpup'); ?><input name="ftppass" type="password" value="<?PHP echo base64_decode($jobs[$jobid]['ftppass']);?>" class="password" /><br />
|
166 |
-
<?PHP _e('Ftp directory:','backwpup'); ?><input name="ftpdir" type="text" value="<?PHP echo $jobs[$jobid]['ftpdir'];?>" class="regular-text" /><br />
|
167 |
-
<?PHP _e('Max Backup fieles on ftp:','backwpup'); ?><input name="ftpmaxbackups" type="text" value="<?PHP echo $jobs[$jobid]['ftpmaxbackups'];?>" class="small-text" /><span class="description"><?PHP _e('0=off','backwpup');?></span><br />
|
168 |
-
</td>
|
169 |
-
</tr>
|
170 |
-
|
171 |
-
<?PHP } ?>
|
172 |
-
|
173 |
-
|
174 |
-
<tr valign="top">
|
175 |
-
<th scope="row"><label for="mailaddress"><?PHP _e('Send Mail to','backwpup'); ?></label></th>
|
176 |
-
<td><input name="mailaddress" type="text" value="<?PHP echo $jobs[$jobid]['mailaddress'];?>" class="regular-text" /><br />
|
177 |
-
<?PHP
|
178 |
-
if ($jobs[$jobid]['type']=='FILE' or $jobs[$jobid]['type']=='DB' or $jobs[$jobid]['type']=='DB+FILE') {
|
179 |
-
echo __('Max Filesize for Backups via mail:','backwpup').'<input name="mailefilesize" type="text" value="'.$jobs[$jobid]['mailefilesize'].'" class="small-text" />MB <span class="description">'.__('0=send log only.','backwpup').'</span><br />';
|
180 |
-
}
|
181 |
-
?>
|
182 |
-
<input class="checkbox" value="1" type="checkbox" <?php checked($jobs[$jobid]['mailerroronly'],true); ?> name="mailerroronly" /> <?PHP _e('Send only mail on errors.','backwpup'); ?>
|
183 |
-
</td>
|
184 |
-
</tr>
|
185 |
-
|
186 |
-
</table>
|
187 |
-
<p class="submit">
|
188 |
-
<input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes', 'backwpup'); ?>" />
|
189 |
-
</p>
|
190 |
-
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/options-jobs.php
CHANGED
@@ -5,196 +5,262 @@ if ( !defined('ABSPATH') )
|
|
5 |
?>
|
6 |
<div class="wrap">
|
7 |
<div id="icon-tools" class="icon32"><br /></div>
|
8 |
-
<h2><?php _e('
|
9 |
|
10 |
<form method="post" action="">
|
11 |
<input type="hidden" name="action" value="saveeditjob" />
|
12 |
<input type="hidden" name="jobid" value="<?PHP echo $jobid;?>" />
|
13 |
<?php
|
14 |
wp_nonce_field('edit-job');
|
15 |
-
if (
|
16 |
-
$jobs[$jobid]['type']='DB+FILE';
|
17 |
-
?>
|
18 |
-
|
19 |
-
<table class="form-table">
|
20 |
-
|
21 |
-
<tr valign="top">
|
22 |
-
<th scope="row"><label for="job_type"><?PHP _e('Job Type','backwpup'); ?></label></th>
|
23 |
-
<td>
|
24 |
-
<select name="type" id="job_type">
|
25 |
-
<?php
|
26 |
-
foreach (backwpup_backup_types() as $type) {
|
27 |
-
echo '<option value="'.$type.'"'.selected($type,$jobs[$jobid]['type'],false).'>'.backwpup_backup_types($type).'</option>';
|
28 |
-
}
|
29 |
-
?>
|
30 |
-
</select>
|
31 |
-
<input type="submit" name="change" class="button" value="<?php _e('Change', 'backwpup'); ?>" />
|
32 |
-
</td>
|
33 |
-
</tr>
|
34 |
-
|
35 |
-
<tr valign="top">
|
36 |
-
<th scope="row"><label for="jobname"><?PHP _e('Job Name','backwpup'); ?></label></th>
|
37 |
-
<td><input name="name" type="text" id="jobname" value="<?PHP echo $jobs[$jobid]['name'];?>" class="regular-text" /></td>
|
38 |
-
</tr>
|
39 |
-
|
40 |
-
<?PHP if ($jobs[$jobid]['type']=='DB' or $jobs[$jobid]['type']=='DB+FILE' or $jobs[$jobid]['type']=='OPTIMIZE' or $jobs[$jobid]['type']=='CHECK') {?>
|
41 |
-
<tr valign="top">
|
42 |
-
<th scope="row"><label for="dbexclude"><?PHP _e('Exclude Database Tables:','backwpup'); ?></label></th><td>
|
43 |
-
<?php
|
44 |
-
$tables=$wpdb->get_col('SHOW TABLES FROM `'.DB_NAME.'`');
|
45 |
-
if (!isset($jobs[$jobid]['dbexclude'])) { //def.
|
46 |
-
foreach ($tables as $table) {
|
47 |
-
if (substr($table,0,strlen($wpdb->prefix))!=$wpdb->prefix)
|
48 |
-
$jobs[$jobid]['dbexclude'][]=$table;
|
49 |
-
}
|
50 |
-
}
|
51 |
-
foreach ($tables as $table) {
|
52 |
-
if ($wpdb->backwpup_logs<>$table)
|
53 |
-
echo ' <input class="checkbox" type="checkbox"'.checked(in_array($table,(array)$jobs[$jobid]['dbexclude']),true,false).' name="dbexclude[]" value="'.$table.'"/> '.$table.'<br />';
|
54 |
-
}
|
55 |
|
|
|
56 |
?>
|
57 |
-
</td></tr>
|
58 |
-
<?PHP } ?>
|
59 |
-
<?PHP if ($jobs[$jobid]['type']=='FILE' or $jobs[$jobid]['type']=='DB+FILE') {?>
|
60 |
-
<?PHP if (!isset($jobs[$jobid]['backuproot'])) $jobs[$jobid]['backuproot']=true; if (!isset($jobs[$jobid]['backupcontent'])) $jobs[$jobid]['backupcontent']=true; if (!isset($jobs[$jobid]['backupplugins'])) $jobs[$jobid]['backupplugins']=true;?>
|
61 |
-
<tr valign="top">
|
62 |
-
<th scope="row"><label for="fileinclude"><?PHP _e('Backup Blog Folders','backwpup'); ?></label></th><td id="fileinclude">
|
63 |
-
<input class="checkbox" type="checkbox"<?php checked($jobs[$jobid]['backuproot'],true,true);?> name="backuproot" value="1"/> <?php _e('Blog root and WP Files','backwpup');?><br />
|
64 |
-
<input class="checkbox" type="checkbox"<?php checked($jobs[$jobid]['backupcontent'],true,true);?> name="backupcontent" value="1"/> <?php _e('Blog Content','backwpup');?><br />
|
65 |
-
<input class="checkbox" type="checkbox"<?php checked($jobs[$jobid]['backupplugins'],true,true);?> name="backupplugins" value="1"/> <?php _e('Blog Plugins','backwpup');?>
|
66 |
-
</td></tr>
|
67 |
-
|
68 |
-
<tr valign="top">
|
69 |
-
<th scope="row"><label for="dirinclude"><?PHP _e('Include Folders','backwpup'); ?></label></th><td>
|
70 |
-
<input name="dirinclude" id="dirinclude" type="text" value="<?PHP echo $jobs[$jobid]['dirinclude'];?>" class="regular-text" /><span class="description"><?PHP echo __('Separate with ,. Full Path like:','backwpup').' '.str_replace('\\','/',ABSPATH); ?></span>
|
71 |
-
</td></tr>
|
72 |
-
|
73 |
-
<tr valign="top">
|
74 |
-
<th scope="row"><label for="fileexclude"><?PHP _e('Exclude Files/Folders','backwpup'); ?></label></th><td>
|
75 |
-
<input name="fileexclude" id="fileexclude" type="text" value="<?PHP echo $jobs[$jobid]['fileexclude'];?>" class="regular-text" /><span class="description"><?PHP _e('Separate with ,','backwpup') ?></span>
|
76 |
-
</td></tr>
|
77 |
-
<?PHP } ?>
|
78 |
|
79 |
-
<
|
80 |
-
<
|
81 |
-
<
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
echo
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
echo '<option value="60"'.selected('3600',$jobs[$jobid]['scheduleintervaltype'],false).'>'.__('Min(s)','backwpup').'</option>';
|
93 |
-
echo '<option value="3600"'.selected('3600',$jobs[$jobid]['scheduleintervaltype'],false).'>'.__('Hour(s)','backwpup').'</option>';
|
94 |
-
echo '<option value="86400"'.selected('86400',$jobs[$jobid]['scheduleintervaltype'],false).'>'.__('Day(s)','backwpup').'</option>';
|
95 |
-
echo '</select><br />';
|
96 |
-
|
97 |
-
_e('Start Time:', 'backwpup');
|
98 |
-
if (empty($jobs[$jobid]['scheduletime']))
|
99 |
-
$jobs[$jobid]['scheduletime']=time();
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
}
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
echo '
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
echo '
|
128 |
-
|
129 |
-
<
|
130 |
-
</
|
131 |
-
</tr>
|
132 |
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
<
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
<?PHP _e('Ftp Hostname:','backwpup'); ?><input name="ftphost" type="text" value="<?PHP echo $jobs[$jobid]['ftphost'];?>" class="regular-text" /><br />
|
151 |
-
<?PHP _e('Ftp Username:','backwpup'); ?><input name="ftpuser" type="text" value="<?PHP echo $jobs[$jobid]['ftpuser'];?>" class="user" /><br />
|
152 |
-
<?PHP _e('Ftp Password:','backwpup'); ?><input name="ftppass" type="password" value="<?PHP echo base64_decode($jobs[$jobid]['ftppass']);?>" class="password" /><br />
|
153 |
-
<?PHP _e('Ftp directory:','backwpup'); ?><input name="ftpdir" type="text" value="<?PHP echo $jobs[$jobid]['ftpdir'];?>" class="regular-text" /><br />
|
154 |
-
<?PHP _e('Max Backup files on ftp:','backwpup'); ?><input name="ftpmaxbackups" type="text" value="<?PHP echo $jobs[$jobid]['ftpmaxbackups'];?>" class="small-text" /><span class="description"><?PHP _e('0=off','backwpup');?></span><br />
|
155 |
-
</td>
|
156 |
-
</tr>
|
157 |
|
158 |
-
<?PHP if (
|
159 |
-
<
|
160 |
-
<
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
|
|
|
|
|
|
171 |
|
172 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
|
174 |
-
<?PHP
|
175 |
-
|
176 |
-
|
177 |
-
<
|
178 |
-
<
|
179 |
-
<
|
180 |
-
<?PHP
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
<?PHP
|
|
|
|
|
|
|
186 |
|
187 |
-
<
|
188 |
-
<
|
189 |
-
<
|
190 |
-
<
|
191 |
-
|
192 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
|
195 |
-
</table>
|
196 |
-
<p class="submit">
|
197 |
-
<input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes', 'backwpup'); ?>" />
|
198 |
-
</p>
|
199 |
</form>
|
200 |
</div>
|
5 |
?>
|
6 |
<div class="wrap">
|
7 |
<div id="icon-tools" class="icon32"><br /></div>
|
8 |
+
<h2><?php _e('BackWPup Job Settings', 'backwpup'); ?></h2>
|
9 |
|
10 |
<form method="post" action="">
|
11 |
<input type="hidden" name="action" value="saveeditjob" />
|
12 |
<input type="hidden" name="jobid" value="<?PHP echo $jobid;?>" />
|
13 |
<?php
|
14 |
wp_nonce_field('edit-job');
|
15 |
+
if (!isset($jobs[$jobid]['type']))
|
16 |
+
$jobs[$jobid]['type']='DB+FILE';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
+
$todo=explode('+',$jobs[$jobid]['type']);
|
19 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
<div id="poststuff" class="metabox-holder has-right-sidebar">
|
22 |
+
<div class="inner-sidebar">
|
23 |
+
<div id="side-sortables" class="meta-box-sortables">
|
24 |
+
|
25 |
+
<div id="jobtype" class="postbox">
|
26 |
+
<h3 class="hndle"><span><?PHP _e('Job Type','backwpup'); ?></span></h3>
|
27 |
+
<div class="inside">
|
28 |
+
<?php
|
29 |
+
foreach (backwpup_backup_types() as $type) {
|
30 |
+
echo "<input class=\"jobtype-select checkbox\" id=\"jobtype-select-".$type."\" type=\"checkbox\"".checked(true,in_array($type,$todo),false)." name=\"type[]\" value=\"".$type."\"/> ".backwpup_backup_types($type);
|
31 |
+
}
|
32 |
+
?>
|
33 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
+
</div>
|
36 |
+
<div id="major-publishing-actions">
|
37 |
+
<div id="delete-action">
|
38 |
+
<a class="submitdelete deletion" style="color:red" href="<?PHP echo wp_nonce_url('admin.php?page=BackWPup&action=delete&jobid='.$jobid, 'delete-job_'.$jobid); ?>" onclick="if ( confirm('<?PHP echo esc_js(__("You are about to delete this Job. \n 'Cancel' to stop, 'OK' to delete.","backwpup")); ?>') ) { return true;}return false;"><?php _e('Delete', 'backwpup'); ?></a>
|
39 |
+
</div>
|
40 |
+
<div id="publishing-action">
|
41 |
+
<input type="submit" name="submit" class="button-primary right" accesskey="s" value="<?php _e('Save Changes', 'backwpup'); ?>" />
|
42 |
+
</div>
|
43 |
+
<div class="clear"></div>
|
44 |
+
</div>
|
45 |
+
</div>
|
46 |
+
|
47 |
+
<div id="jobschedule" class="postbox">
|
48 |
+
<h3 class="hndle"><span><?PHP _e('Job Schedule','backwpup'); ?></span></h3>
|
49 |
+
<div class="inside">
|
50 |
+
<input class="checkbox" value="1" type="checkbox" <?php checked($jobs[$jobid]['activated'],true); ?> name="activated" /> <?PHP _e('Activate scheduling', 'backwpup'); ?><br />
|
51 |
+
<?php
|
52 |
+
_e('Run Every:', 'backwpup');
|
53 |
+
echo '<select name="scheduleintervalteimes">';
|
54 |
+
for ($i=1;$i<=60;$i++) {
|
55 |
+
echo '<option value="'.$i.'"'.selected($i,$jobs[$jobid]['scheduleintervalteimes'],false).'>'.$i.'</option>';
|
56 |
+
}
|
57 |
+
echo '</select>';
|
58 |
+
if (empty($jobs[$jobid]['scheduleintervaltype']))
|
59 |
+
$jobs[$jobid]['scheduleintervaltype']=3600;
|
60 |
+
echo '<select name="scheduleintervaltype">';
|
61 |
+
echo '<option value="60"'.selected('3600',$jobs[$jobid]['scheduleintervaltype'],false).'>'.__('Min(s)','backwpup').'</option>';
|
62 |
+
echo '<option value="3600"'.selected('3600',$jobs[$jobid]['scheduleintervaltype'],false).'>'.__('Hour(s)','backwpup').'</option>';
|
63 |
+
echo '<option value="86400"'.selected('86400',$jobs[$jobid]['scheduleintervaltype'],false).'>'.__('Day(s)','backwpup').'</option>';
|
64 |
+
echo '</select><br />';
|
|
|
65 |
|
66 |
+
_e('Start Date/Time:', 'backwpup');echo "<br />";
|
67 |
+
if (empty($jobs[$jobid]['scheduletime']))
|
68 |
+
$jobs[$jobid]['scheduletime']=current_time('timestamp');
|
69 |
+
|
70 |
+
echo '<select name="scheduleday">';
|
71 |
+
for ($i=1;$i<=31;$i++) {
|
72 |
+
echo '<option value="'.$i.'"'.selected($i,date_i18n('j',$jobs[$jobid]['scheduletime']),false).'>'.$i.'</option>';
|
73 |
+
}
|
74 |
+
echo '</select>.';
|
75 |
+
$month=array('1'=>__('January'),'2'=>__('February'),'3'=>__('March'),'4'=>__('April'),'5'=>__('May'),'6'=>__('June'),'7'=>__('July'),'8'=>__('August'),'9'=>__('September'),'10'=>__('October'),'11'=>__('November'),'12'=>__('December'));
|
76 |
+
echo '<select name="schedulemonth">';
|
77 |
+
for ($i=1;$i<=12;$i++) {
|
78 |
+
echo '<option value="'.$i.'"'.selected($i,date_i18n('n',$jobs[$jobid]['scheduletime']),false).'>'.esc_html($month[$i]).'</option>';
|
79 |
+
}
|
80 |
+
echo '</select>.';
|
81 |
+
echo '<select name="scheduleyear">';
|
82 |
+
for ($i=date_i18n('Y')-1;$i<=date_i18n('Y')+3;$i++) {
|
83 |
+
echo '<option value="'.$i.'"'.selected($i,date_i18n('Y',$jobs[$jobid]['scheduletime']),false).'>'.$i.'</option>';
|
84 |
+
}
|
85 |
+
echo '</select><br />';
|
86 |
|
87 |
+
echo '<select name="schedulehour">';
|
88 |
+
for ($i=0;$i<=23;$i++) {
|
89 |
+
echo '<option value="'.$i.'"'.selected($i,date_i18n('G',$jobs[$jobid]['scheduletime']),false).'>'.$i.'</option>';
|
90 |
+
}
|
91 |
+
echo '</select>:';
|
92 |
+
echo '<select name="scheduleminute">';
|
93 |
+
for ($i=0;$i<=59;$i++) {
|
94 |
+
$minute=$i;
|
95 |
+
if (strlen($minute)<2)
|
96 |
+
$minute='0'.$minute;
|
97 |
+
echo '<option value="'.$i.'"'.selected($minute,date_i18n('i',$jobs[$jobid]['scheduletime']),false).'>'.$i.'</option>';
|
98 |
+
}
|
99 |
+
echo '</select>';
|
100 |
|
101 |
+
?>
|
102 |
+
</div>
|
103 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
|
105 |
+
<div id="fileformart" class="postbox" <?PHP if (!in_array("FILE",$todo) and !in_array("DB",$todo) and !in_array("WPEXP",$todo)) echo 'style="display:none;"';?>>
|
106 |
+
<h3 class="hndle"><span><?PHP _e('Backup File Format','backwpup'); ?></span></h3>
|
107 |
+
<div class="inside">
|
108 |
+
<?PHP
|
109 |
+
if (!isset($jobs[$jobid]['fileformart']))
|
110 |
+
$jobs[$jobid]['fileformart']='.zip';
|
111 |
+
if (function_exists('gzopen') or class_exists('ZipArchive'))
|
112 |
+
echo '<input class="radio" type="radio"'.checked('.zip',$jobs[$jobid]['fileformart'],false).' name="fileformart" value=".zip" />'.__('ZIP (.zip)','backwpup').'<br />';
|
113 |
+
echo '<input class="radio" type="radio"'.checked('.tar',$jobs[$jobid]['fileformart'],false).' name="fileformart" value=".tar" />'.__('TAR (.tar)','backwpup').'<br />';
|
114 |
+
if (function_exists('gzopen'))
|
115 |
+
echo '<input class="radio" type="radio"'.checked('.tar.gz',$jobs[$jobid]['fileformart'],false).' name="fileformart" value=".tar.gz"/>'.__('TAR GZIP (.tar.gz)','backwpup').'<br />';
|
116 |
+
if (function_exists('bzopen'))
|
117 |
+
echo '<input class="radio" type="radio"'.checked('.tar.bz2',$jobs[$jobid]['fileformart'],false).' name="fileformart" value=".tar.bz2"/>'.__('TAR BZIP2 (.tar.bz2)','backwpup').'<br />';
|
118 |
+
?>
|
119 |
+
</div>
|
120 |
+
</div>
|
121 |
|
122 |
+
<div id="logmail" class="postbox">
|
123 |
+
<h3 class="hndle"><span><?PHP _e('Send log','backwpup'); ?></span></h3>
|
124 |
+
<div class="inside">
|
125 |
+
<?PHP _e('E-Mail-Adress:','backwpup');
|
126 |
+
if (!isset($jobs[$jobid]['mailaddresslog']))
|
127 |
+
$jobs[$jobid]['mailaddresslog']=get_option('admin_email');
|
128 |
+
if (!isset($jobs[$jobid]['mailerroronly']))
|
129 |
+
$jobs[$jobid]['mailerroronly']=true;
|
130 |
+
?>
|
131 |
+
<input name="mailaddresslog" id="mailaddresslog" type="text" value="<?PHP echo $jobs[$jobid]['mailaddresslog'];?>" class="large-text" /><br />
|
132 |
+
<input class="checkbox" value="1" type="checkbox" <?php checked($jobs[$jobid]['mailerroronly'],true); ?> name="mailerroronly" /> <?PHP _e('Send only E-Mail on errors.','backwpup'); ?>
|
133 |
+
</div>
|
134 |
+
</div>
|
135 |
+
|
136 |
+
|
137 |
+
</div>
|
138 |
+
</div>
|
139 |
+
<div class="has-sidebar" >
|
140 |
+
<div id="post-body-content" class="has-sidebar-content">
|
141 |
+
|
142 |
+
<div id="titlediv">
|
143 |
+
<div id="titlewrap">
|
144 |
+
<label class="hide-if-no-js" style="visibility:hidden" id="title-prompt-text" for="title"><?PHP _e('Enter Job name here','backwpup'); ?></label>
|
145 |
+
<input type="text" name="name" size="30" tabindex="1" placeholder="<?PHP _e('Enter Job name here','backwpup'); ?>" value="<?PHP echo $jobs[$jobid]['name'];?>" id="title" autocomplete="off" />
|
146 |
+
</div>
|
147 |
+
</div>
|
148 |
+
|
149 |
+
<div id="databasejos" class="postbox" <?PHP if (!in_array("CHECK",$todo) and !in_array("DB",$todo) and !in_array("OPTIMIZE",$todo)) echo 'style="display:none;"';?>>
|
150 |
+
<h3 class="hndle"><span><?PHP _e('Database Jobs','backwpup'); ?></span></h3>
|
151 |
+
<div class="inside">
|
152 |
+
|
153 |
+
<b><?PHP _e('Database Tabels to Exclude:','backwpup'); ?></b>
|
154 |
+
<div id="dbexclude-pop" style="border-color:#CEE1EF; border-style:solid; border-width:2px; height:10em; width:50%; margin:5px 0px 5px 40px; overflow:auto; padding:0.5em 0.5em;">
|
155 |
+
<?php
|
156 |
+
$tables=$wpdb->get_col('SHOW TABLES FROM `'.DB_NAME.'`');
|
157 |
+
if (!isset($jobs[$jobid]['dbexclude'])) { //def.
|
158 |
+
foreach ($tables as $table) {
|
159 |
+
if (substr($table,0,strlen($wpdb->prefix))!=$wpdb->prefix)
|
160 |
+
$jobs[$jobid]['dbexclude'][]=$table;
|
161 |
+
}
|
162 |
+
}
|
163 |
+
foreach ($tables as $table) {
|
164 |
+
if ($wpdb->backwpup_logs<>$table) {
|
165 |
+
echo ' <input class="checkbox" type="checkbox"'.checked(in_array($table,(array)$jobs[$jobid]['dbexclude']),true,false).' name="dbexclude[]" value="'.$table.'"/> '.$table.'<br />';
|
166 |
+
}
|
167 |
+
}
|
168 |
+
?>
|
169 |
+
</div><br />
|
170 |
+
|
171 |
+
<input class="checkbox" type="checkbox"<?php checked($jobs[$jobid]['maintenance'],true,true);?> name="maintenance" value="1"/> <?php _e('Set Blog Maintenance Mode on Database Operations','backwpup');?><br />
|
172 |
+
</div>
|
173 |
+
</div>
|
174 |
+
|
175 |
+
<div id="filebackup" class="postbox" <?PHP if (!in_array("FILE",$todo)) echo 'style="display:none;"';?>>
|
176 |
+
<h3 class="hndle"><span><?PHP _e('File Backup','backwpup'); ?></span></h3>
|
177 |
+
<div class="inside">
|
178 |
+
<b><?PHP _e('Blog Folders to Backup:','backwpup'); ?></b>
|
179 |
+
<div style="width:50%; margin:5px 0px 5px 40px; overflow:auto; padding:0.5em 0.5em;">
|
180 |
+
<?PHP
|
181 |
+
if (!isset($jobs[$jobid]['backuproot']))
|
182 |
+
$jobs[$jobid]['backuproot']=true;
|
183 |
+
if (!isset($jobs[$jobid]['backupcontent']))
|
184 |
+
$jobs[$jobid]['backupcontent']=true;
|
185 |
+
if (!isset($jobs[$jobid]['backupplugins']))
|
186 |
+
$jobs[$jobid]['backupplugins']=true;
|
187 |
+
?>
|
188 |
+
<input class="checkbox" type="checkbox"<?php checked($jobs[$jobid]['backuproot'],true,true);?> name="backuproot" value="1"/> <?php _e('Blog root and WP Files','backwpup');?><br />
|
189 |
+
<input class="checkbox" type="checkbox"<?php checked($jobs[$jobid]['backupcontent'],true,true);?> name="backupcontent" value="1"/> <?php _e('Blog Content','backwpup');?><br />
|
190 |
+
<input class="checkbox" type="checkbox"<?php checked($jobs[$jobid]['backupplugins'],true,true);?> name="backupplugins" value="1"/> <?php _e('Blog Plugins','backwpup');?>
|
191 |
+
</div><br />
|
192 |
+
<b><?PHP _e('Include Folders to Backup:','backwpup'); ?></b><br />
|
193 |
+
<?PHP _e('Example:','backwpup'); ?> <?PHP echo str_replace('\\','/',ABSPATH); ?>,...<br />
|
194 |
+
<input name="dirinclude" id="dirinclude" type="text" value="<?PHP echo $jobs[$jobid]['dirinclude'];?>" class="large-text" /><br />
|
195 |
+
<br />
|
196 |
+
<b><?PHP _e('Exclude Files/Folders from Backup:','backwpup'); ?></b><br />
|
197 |
+
<?PHP _e('Example:','backwpup'); ?> /logs/,.log,.tmp,/temp/,....<br />
|
198 |
+
<input name="fileexclude" id="fileexclude" type="text" value="<?PHP echo $jobs[$jobid]['fileexclude'];?>" class="large-text" /><br />
|
199 |
+
</div>
|
200 |
+
</div>
|
201 |
+
|
202 |
+
<div id="todir" class="postbox" <?PHP if (!in_array("FILE",$todo) and !in_array("DB",$todo) and !in_array("WPEXP",$todo)) echo 'style="display:none;"';?>>
|
203 |
+
<h3 class="hndle"><span><?PHP _e('Backup to Directory','backwpup'); ?></span></h3>
|
204 |
+
<div class="inside">
|
205 |
+
<?PHP
|
206 |
+
if (empty($jobs[$jobid]['backupdir'])) {
|
207 |
+
$rand = substr( md5( md5( SECURE_AUTH_KEY ) ), -5 );
|
208 |
+
$jobs[$jobid]['backupdir']=str_replace('\\','/',WP_CONTENT_DIR).'/backwpup-'.$rand;
|
209 |
+
}
|
210 |
+
if (!is_numeric($jobs[$jobid]['maxbackups']))
|
211 |
+
$jobs[$jobid]['maxbackups']=0;
|
212 |
+
?>
|
213 |
+
<b><?PHP _e('Full Path to Folder for Backup Files:','backwpup'); ?></b><br />
|
214 |
+
<input name="backupdir" id="backupdir" type="text" value="<?PHP echo $jobs[$jobid]['backupdir'];?>" class="large-text" /><br />
|
215 |
+
<?PHP _e('Max. Backup Files in Folder:','backwpup'); ?> <input name="maxbackups" id="maxbackups" type="text" size="3" value="<?PHP echo $jobs[$jobid]['maxbackups'];?>" class="small-text" /><span class="description"><?PHP _e('(Oldest files will deleted first.)','backwpup');?></span>
|
216 |
+
</div>
|
217 |
+
</div>
|
218 |
|
219 |
+
<div id="toftp" class="postbox" <?PHP if (!in_array("FILE",$todo) and !in_array("DB",$todo) and !in_array("WPEXP",$todo)) echo 'style="display:none;"';?>>
|
220 |
+
<h3 class="hndle"><span><?PHP _e('Backup to FTP Server','backwpup'); ?></span></h3>
|
221 |
+
<div class="inside">
|
222 |
+
<b><?PHP _e('Hostname:','backwpup'); ?></b><br />
|
223 |
+
<input name="ftphost" type="text" value="<?PHP echo $jobs[$jobid]['ftphost'];?>" class="large-text" /><br />
|
224 |
+
<b><?PHP _e('Username:','backwpup'); ?></b><br />
|
225 |
+
<input name="ftpuser" type="text" value="<?PHP echo $jobs[$jobid]['ftpuser'];?>" class="user large-text" /><br />
|
226 |
+
<b><?PHP _e('Password:','backwpup'); ?></b><br />
|
227 |
+
<input name="ftppass" type="password" value="<?PHP echo base64_decode($jobs[$jobid]['ftppass']);?>" class="password large-text" /><br />
|
228 |
+
<b><?PHP _e('Directory on Server:','backwpup'); ?></b><br />
|
229 |
+
<input name="ftpdir" type="text" value="<?PHP echo $jobs[$jobid]['ftpdir'];?>" class="large-text" /><br />
|
230 |
+
<?PHP if (!is_numeric($jobs[$jobid]['ftpmaxbackups'])) $jobs[$jobid]['ftpmaxbackups']=0; ?>
|
231 |
+
<?PHP _e('Max. Backup Files in FTP Folder:','backwpup'); ?> <input name="ftpmaxbackups" type="text" size="3" value="<?PHP echo $jobs[$jobid]['ftpmaxbackups'];?>" class="small-text" /><span class="description"><?PHP _e('(Oldest files will deleted first.)','backwpup');?></span><br />
|
232 |
+
</div>
|
233 |
+
</div>
|
234 |
|
235 |
+
<div id="toamazon" class="postbox" <?PHP if (!in_array("FILE",$todo) and !in_array("DB",$todo) and !in_array("WPEXP",$todo)) echo 'style="display:none;"';?>>
|
236 |
+
<h3 class="hndle"><span><?PHP _e('Backup to Amazon S3','backwpup'); ?></span></h3>
|
237 |
+
<div class="inside">
|
238 |
+
<b><?PHP _e('Access Key ID:','backwpup'); ?></b><br />
|
239 |
+
<input name="awsAccessKey" type="text" value="<?PHP echo $jobs[$jobid]['awsAccessKey'];?>" class="large-text" /><br />
|
240 |
+
<b><?PHP _e('Secret Access Key:','backwpup'); ?></b><br />
|
241 |
+
<input name="awsSecretKey" type="text" value="<?PHP echo $jobs[$jobid]['awsSecretKey'];?>" class="large-text" /><br />
|
242 |
+
<b><?PHP _e('Bucket:','backwpup'); ?></b><br />
|
243 |
+
<input name="awsBucket" type="text" value="<?PHP echo $jobs[$jobid]['awsBucket'];?>" class="large-text" /><br />
|
244 |
+
<b><?PHP _e('Directory in Bucket:','backwpup'); ?></b><br />
|
245 |
+
<input name="awsdir" type="text" value="<?PHP echo $jobs[$jobid]['awsdir'];?>" class="large-text" /><br />
|
246 |
+
<?PHP if (!is_numeric($jobs[$jobid]['awsmaxbackups'])) $jobs[$jobid]['awsmaxbackups']=0; ?>
|
247 |
+
<?PHP _e('Max. Backup Files inn Bucket Folder:','backwpup'); ?><input name="awsmaxbackups" type="text" size="3" value="<?PHP echo $jobs[$jobid]['awsmaxbackups'];?>" class="small-text" /><span class="description"><?PHP _e('(Oldest files will deleted first.)','backwpup');?></span><br />
|
248 |
+
<input class="checkbox" value="1" type="checkbox" <?php checked($jobs[$jobid]['awsSSL'],true); ?> name="awsSSL" /> <?PHP _e('Use SSL connection.','backwpup'); ?><br />
|
249 |
+
</div>
|
250 |
+
</div>
|
251 |
|
252 |
+
<div id="tomail" class="postbox" <?PHP if (!in_array("FILE",$todo) and !in_array("DB",$todo) and !in_array("WPEXP",$todo)) echo 'style="display:none;"';?>>
|
253 |
+
<h3 class="hndle"><span><?PHP _e('Backup to E-Mail','backwpup'); ?></span></h3>
|
254 |
+
<div class="inside">
|
255 |
+
<b><?PHP _e('E-Mail-Adress:','backwpup'); ?></b><br />
|
256 |
+
<input name="mailaddress" id="mailaddress" type="text" value="<?PHP echo $jobs[$jobid]['mailaddress'];?>" class="large-text" /><br />
|
257 |
+
<?PHP if (!is_numeric($jobs[$jobid]['mailefilesize'])) $jobs[$jobid]['mailefilesize']=0; ?>
|
258 |
+
<?PHP echo __('Max. File Size for sending Backups with mail:','backwpup').'<input name="mailefilesize" type="text" value="'.$jobs[$jobid]['mailefilesize'].'" class="small-text" />MB<br />';?>
|
259 |
+
</div>
|
260 |
+
</div>
|
261 |
+
</div>
|
262 |
+
</div>
|
263 |
+
</div>
|
264 |
|
|
|
|
|
|
|
|
|
265 |
</form>
|
266 |
</div>
|
app/options-logs.php
CHANGED
@@ -34,21 +34,21 @@ if ( !defined('ABSPATH') )
|
|
34 |
<table class="widefat" cellspacing="0">
|
35 |
<thead>
|
36 |
<tr>
|
37 |
-
<?php print_column_headers(
|
38 |
</tr>
|
39 |
</thead>
|
40 |
|
41 |
<tfoot>
|
42 |
<tr>
|
43 |
-
<?php print_column_headers(
|
44 |
</tr>
|
45 |
</tfoot>
|
46 |
|
47 |
<tbody id="the-list" class="list:post">
|
48 |
|
49 |
<?php
|
50 |
-
$item_columns = get_column_headers(
|
51 |
-
$hidden = get_hidden_columns(
|
52 |
|
53 |
//get log files
|
54 |
$logfiles=array();
|
@@ -79,19 +79,19 @@ if ( !defined('ABSPATH') )
|
|
79 |
echo '<th scope="row" class="check-column"><input type="checkbox" name="logfiles[]" value="'. esc_attr($logfile) .'" /></th>';
|
80 |
break;
|
81 |
case 'id':
|
82 |
-
echo
|
83 |
break;
|
84 |
case 'type':
|
85 |
-
echo
|
86 |
-
echo $logdata['type'];
|
87 |
-
echo
|
88 |
break;
|
89 |
case 'log':
|
90 |
$name='';
|
91 |
if (is_file($logvalue['backupfile']))
|
92 |
$name=basename($logvalue['backupfile']);
|
93 |
|
94 |
-
echo
|
95 |
$actions = array();
|
96 |
$actions['view'] = "<a href=\"" . wp_nonce_url('admin.php?page=BackWPup&action=view_log&logfile='.$cfg['dirlogs'].'/'.$logfile, 'view-log_'.$logfile) . "\">" . __('View','backwpup') . "</a>";
|
97 |
$actions['delete'] = "<a class=\"submitdelete\" href=\"" . wp_nonce_url('admin.php?page=BackWPup&action=delete-logs&logfile='.$logfile, 'delete-log_'.$logfile) . "\" onclick=\"if ( confirm('" . esc_js(__("You are about to delete this Job. \n 'Cancel' to stop, 'OK' to delete.","backwpup")) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
|
@@ -107,10 +107,10 @@ if ( !defined('ABSPATH') )
|
|
107 |
echo "<span class='$action'>$linkaction$sep</span>";
|
108 |
}
|
109 |
echo '</div>';
|
110 |
-
echo
|
111 |
break;
|
112 |
case 'status':
|
113 |
-
echo
|
114 |
if($logdata['errors']>0 or $logdata['warnings']>0) {
|
115 |
if ($logdata['errors']>0)
|
116 |
echo '<span style="color:red;">'.$logdata['errors'].' '.__('ERROR(S)','backwpup').'</span><br />';
|
@@ -119,10 +119,10 @@ if ( !defined('ABSPATH') )
|
|
119 |
} else {
|
120 |
echo '<span style="color:green;">'.__('OK','backwpup').'</span>';
|
121 |
}
|
122 |
-
echo
|
123 |
break;
|
124 |
case 'size':
|
125 |
-
echo
|
126 |
if (!empty($logdata['backupfile']) and is_file($logdata['backupfile'])) {
|
127 |
echo backwpup_formatBytes(filesize($logdata['backupfile']));
|
128 |
} elseif (!empty($logdata['backupfile'])) {
|
@@ -130,12 +130,12 @@ if ( !defined('ABSPATH') )
|
|
130 |
} else {
|
131 |
_e('only Log','backwpup');
|
132 |
}
|
133 |
-
echo
|
134 |
break;
|
135 |
case 'runtime':
|
136 |
-
echo
|
137 |
echo $logdata['runtime'].' '.__('sec.','backwpup');
|
138 |
-
echo
|
139 |
break;
|
140 |
}
|
141 |
}
|
34 |
<table class="widefat" cellspacing="0">
|
35 |
<thead>
|
36 |
<tr>
|
37 |
+
<?php print_column_headers($page_hook); ?>
|
38 |
</tr>
|
39 |
</thead>
|
40 |
|
41 |
<tfoot>
|
42 |
<tr>
|
43 |
+
<?php print_column_headers($page_hook, false); ?>
|
44 |
</tr>
|
45 |
</tfoot>
|
46 |
|
47 |
<tbody id="the-list" class="list:post">
|
48 |
|
49 |
<?php
|
50 |
+
$item_columns = get_column_headers($page_hook);
|
51 |
+
$hidden = get_hidden_columns($page_hook);
|
52 |
|
53 |
//get log files
|
54 |
$logfiles=array();
|
79 |
echo '<th scope="row" class="check-column"><input type="checkbox" name="logfiles[]" value="'. esc_attr($logfile) .'" /></th>';
|
80 |
break;
|
81 |
case 'id':
|
82 |
+
echo "<td $attributes>".$logdata['jobid']."</td>";
|
83 |
break;
|
84 |
case 'type':
|
85 |
+
echo "<td $attributes>";
|
86 |
+
echo backwpup_backup_types($logdata['type'],true);
|
87 |
+
echo "</td>";
|
88 |
break;
|
89 |
case 'log':
|
90 |
$name='';
|
91 |
if (is_file($logvalue['backupfile']))
|
92 |
$name=basename($logvalue['backupfile']);
|
93 |
|
94 |
+
echo "<td $attributes><strong><a href=\"".wp_nonce_url('admin.php?page=BackWPup&action=view_log&logfile='.$cfg['dirlogs'].'/'.$logfile, 'view-log_'.$logfile)."\" title=\"".__('View log','backwpup')."\">".date_i18n(get_option('date_format'),$logdata['logtime'])." ".date_i18n(get_option('time_format'),$logdata['logtime']).": <i>".$logdata['name']."</i></a></strong>";
|
95 |
$actions = array();
|
96 |
$actions['view'] = "<a href=\"" . wp_nonce_url('admin.php?page=BackWPup&action=view_log&logfile='.$cfg['dirlogs'].'/'.$logfile, 'view-log_'.$logfile) . "\">" . __('View','backwpup') . "</a>";
|
97 |
$actions['delete'] = "<a class=\"submitdelete\" href=\"" . wp_nonce_url('admin.php?page=BackWPup&action=delete-logs&logfile='.$logfile, 'delete-log_'.$logfile) . "\" onclick=\"if ( confirm('" . esc_js(__("You are about to delete this Job. \n 'Cancel' to stop, 'OK' to delete.","backwpup")) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
|
107 |
echo "<span class='$action'>$linkaction$sep</span>";
|
108 |
}
|
109 |
echo '</div>';
|
110 |
+
echo "</td>";
|
111 |
break;
|
112 |
case 'status':
|
113 |
+
echo "<td $attributes>";
|
114 |
if($logdata['errors']>0 or $logdata['warnings']>0) {
|
115 |
if ($logdata['errors']>0)
|
116 |
echo '<span style="color:red;">'.$logdata['errors'].' '.__('ERROR(S)','backwpup').'</span><br />';
|
119 |
} else {
|
120 |
echo '<span style="color:green;">'.__('OK','backwpup').'</span>';
|
121 |
}
|
122 |
+
echo "</td>";
|
123 |
break;
|
124 |
case 'size':
|
125 |
+
echo "<td $attributes>";
|
126 |
if (!empty($logdata['backupfile']) and is_file($logdata['backupfile'])) {
|
127 |
echo backwpup_formatBytes(filesize($logdata['backupfile']));
|
128 |
} elseif (!empty($logdata['backupfile'])) {
|
130 |
} else {
|
131 |
_e('only Log','backwpup');
|
132 |
}
|
133 |
+
echo "</td>";
|
134 |
break;
|
135 |
case 'runtime':
|
136 |
+
echo "<td $attributes>";
|
137 |
echo $logdata['runtime'].' '.__('sec.','backwpup');
|
138 |
+
echo "</td>";
|
139 |
break;
|
140 |
}
|
141 |
}
|
app/options-runnow-iframe.php
CHANGED
@@ -1,16 +1,14 @@
|
|
1 |
<?PHP
|
2 |
-
if (
|
3 |
-
/** Setup WordPress environment */
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
flush();
|
13 |
-
}
|
14 |
?>
|
15 |
<html>
|
16 |
<head>
|
@@ -22,4 +20,9 @@ flush();
|
|
22 |
backwpup_dojob($_GET['jobid']);
|
23 |
?>
|
24 |
</body>
|
25 |
-
</html>
|
|
|
|
|
|
|
|
|
|
1 |
<?PHP
|
2 |
+
if (is_dir($_GET['ABSPATH'])) {
|
3 |
+
require_once($_GET['ABSPATH'].'/wp-load.php'); /** Setup WordPress environment */
|
4 |
+
check_admin_referer('dojob-now_' . (int)$_GET['jobid']);
|
5 |
+
ignore_user_abort(true);
|
6 |
+
// flush any buffers and send the headers
|
7 |
+
@apache_setenv('no-gzip', 1);
|
8 |
+
@ini_set('zlib.output_compression', 0);
|
9 |
+
@ini_set('implicit_flush', 1);
|
10 |
+
@flush();
|
11 |
+
@ob_flush();
|
|
|
|
|
12 |
?>
|
13 |
<html>
|
14 |
<head>
|
20 |
backwpup_dojob($_GET['jobid']);
|
21 |
?>
|
22 |
</body>
|
23 |
+
</html>
|
24 |
+
<?PHP
|
25 |
+
} else {
|
26 |
+
header("HTTP/1.0 404 Not Found");
|
27 |
+
}
|
28 |
+
?>
|
app/options-save.php
CHANGED
@@ -65,7 +65,6 @@ case 'savecfg': //Save config form Setings page
|
|
65 |
$cfg['maxlogs']=abs((int)$_POST['maxlogs']);
|
66 |
$cfg['dirlogs']=untrailingslashit(str_replace('\\','/',stripslashes($_POST['dirlogs'])));
|
67 |
$cfg['dirtemp']=untrailingslashit(str_replace('\\','/',stripslashes($_POST['dirtemp'])));
|
68 |
-
$cfg['pcl_log_level']=$_POST['pcl_log_level'];
|
69 |
if (update_option('backwpup',$cfg))
|
70 |
$backwpup_message=__('Settings saved', 'backwpup');
|
71 |
$_REQUEST['action']='settings';
|
@@ -122,12 +121,12 @@ case 'saveeditjob': //Save Job settings
|
|
122 |
}
|
123 |
|
124 |
if ($jobs[$jobid]['type']!=$_POST['type']) // set type to save
|
125 |
-
$savetype
|
126 |
else
|
127 |
$savetype=$_POST['type'];
|
128 |
|
129 |
-
|
130 |
-
$jobs[$jobid]['type']= $_POST['type'];
|
131 |
$jobs[$jobid]['name']= esc_html($_POST['name']);
|
132 |
$jobs[$jobid]['activated']= $_POST['activated']==1 ? true : false;
|
133 |
$jobs[$jobid]['scheduletime']=mktime($_POST['schedulehour'],$_POST['scheduleminute'],0,$_POST['schedulemonth'],$_POST['scheduleday'],$_POST['scheduleyear']);
|
@@ -136,55 +135,48 @@ case 'saveeditjob': //Save Job settings
|
|
136 |
$jobs[$jobid]['scheduleinterval']=$_POST['scheduleintervaltype']*$_POST['scheduleintervalteimes'];
|
137 |
$jobs[$jobid]['mailaddresslog']=sanitize_email($_POST['mailaddresslog']);
|
138 |
$jobs[$jobid]['mailerroronly']= $_POST['mailerroronly']==1 ? true : false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
|
140 |
-
|
141 |
-
$jobs[$jobid]['dbexclude']=$_POST['dbexclude'];
|
142 |
-
}
|
143 |
-
if ($savetype=='DB' or $savetype=='DB+FILE') {
|
144 |
-
$jobs[$jobid]['dbexclude']=$_POST['dbexclude'];
|
145 |
-
}
|
146 |
-
if ($savetype=='FILE' or $savetype=='DB+FILE') {
|
147 |
-
$jobs[$jobid]['fileexclude']=str_replace('\\','/',stripslashes($_POST['fileexclude']));
|
148 |
-
$jobs[$jobid]['dirinclude']=str_replace('\\','/',stripslashes($_POST['dirinclude']));
|
149 |
-
$jobs[$jobid]['backuproot']= $_POST['backuproot']==1 ? true : false;
|
150 |
-
$jobs[$jobid]['backupcontent']= $_POST['backupcontent']==1 ? true : false;
|
151 |
-
$jobs[$jobid]['backupplugins']= $_POST['backupplugins']==1 ? true : false;
|
152 |
-
}
|
153 |
-
if ($savetype=='DB' or $savetype=='DB+FILE' or $savetype=='FILE') {
|
154 |
-
$jobs[$jobid]['mailefilesize']=(float)$_POST['mailefilesize'];
|
155 |
-
$jobs[$jobid]['backupdir']= untrailingslashit(str_replace('\\','/',stripslashes($_POST['backupdir'])));
|
156 |
-
$jobs[$jobid]['maxbackups']=abs((int)$_POST['maxbackups']);
|
157 |
-
$jobs[$jobid]['ftphost']=$_POST['ftphost'];
|
158 |
-
$jobs[$jobid]['ftpuser']=$_POST['ftpuser'];
|
159 |
-
$jobs[$jobid]['ftppass']=base64_encode($_POST['ftppass']);
|
160 |
-
$jobs[$jobid]['ftpdir']=str_replace('\\','/',stripslashes(trim($_POST['ftpdir'])));
|
161 |
-
$jobs[$jobid]['ftpmaxbackups']=abs((int)$_POST['ftpmaxbackups']);
|
162 |
-
$jobs[$jobid]['awsAccessKey']=$_POST['awsAccessKey'];
|
163 |
-
$jobs[$jobid]['awsSecretKey']=$_POST['awsSecretKey'];
|
164 |
-
$jobs[$jobid]['awsSSL']= $_POST['awsSSL']==1 ? true : false;
|
165 |
-
$jobs[$jobid]['awsBucket']=$_POST['awsBucket'];
|
166 |
-
$jobs[$jobid]['awsdir']=str_replace('\\','/',stripslashes(trim($_POST['awsdir'])));
|
167 |
-
if (substr($jobs[$jobid]['awsdir'],0,1)=='/')
|
168 |
-
$jobs[$jobid]['awsdir']=substr($jobs[$jobid]['awsdir'],1);
|
169 |
-
$jobs[$jobid]['mailaddress']=sanitize_email($_POST['mailaddress']);
|
170 |
-
$jobs[$jobid]['awsmaxbackups']=abs((int)$_POST['awsmaxbackups']);
|
171 |
-
}
|
172 |
-
|
173 |
-
if (update_option('backwpup_jobs',$jobs))
|
174 |
-
$backwpup_message=str_replace('%1',$jobid,__('Job %1 settings saved', 'backwpup'));
|
175 |
-
|
176 |
if ($time=wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid))) {
|
177 |
wp_unschedule_event($time,'backwpup_cron',array('jobid'=>$jobid));
|
178 |
}
|
179 |
if ($jobs[$jobid]['activated']) {
|
180 |
wp_schedule_event($jobs[$jobid]['scheduletime'], 'backwpup_int_'.$jobid, 'backwpup_cron',array('jobid'=>$jobid));
|
181 |
}
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
break;
|
189 |
}
|
190 |
?>
|
65 |
$cfg['maxlogs']=abs((int)$_POST['maxlogs']);
|
66 |
$cfg['dirlogs']=untrailingslashit(str_replace('\\','/',stripslashes($_POST['dirlogs'])));
|
67 |
$cfg['dirtemp']=untrailingslashit(str_replace('\\','/',stripslashes($_POST['dirtemp'])));
|
|
|
68 |
if (update_option('backwpup',$cfg))
|
69 |
$backwpup_message=__('Settings saved', 'backwpup');
|
70 |
$_REQUEST['action']='settings';
|
121 |
}
|
122 |
|
123 |
if ($jobs[$jobid]['type']!=$_POST['type']) // set type to save
|
124 |
+
$savetype=explode('+',$jobs[$jobid]['type']);
|
125 |
else
|
126 |
$savetype=$_POST['type'];
|
127 |
|
128 |
+
|
129 |
+
$jobs[$jobid]['type']= implode('+',(array)$_POST['type']);
|
130 |
$jobs[$jobid]['name']= esc_html($_POST['name']);
|
131 |
$jobs[$jobid]['activated']= $_POST['activated']==1 ? true : false;
|
132 |
$jobs[$jobid]['scheduletime']=mktime($_POST['schedulehour'],$_POST['scheduleminute'],0,$_POST['schedulemonth'],$_POST['scheduleday'],$_POST['scheduleyear']);
|
135 |
$jobs[$jobid]['scheduleinterval']=$_POST['scheduleintervaltype']*$_POST['scheduleintervalteimes'];
|
136 |
$jobs[$jobid]['mailaddresslog']=sanitize_email($_POST['mailaddresslog']);
|
137 |
$jobs[$jobid]['mailerroronly']= $_POST['mailerroronly']==1 ? true : false;
|
138 |
+
$jobs[$jobid]['dbexclude']=$_POST['dbexclude'];
|
139 |
+
$jobs[$jobid]['maintenance']= $_POST['maintenance']==1 ? true : false;
|
140 |
+
$jobs[$jobid]['fileexclude']=str_replace('//','/',str_replace('\\','/',stripslashes($_POST['fileexclude'])));
|
141 |
+
$jobs[$jobid]['dirinclude']=str_replace('//','/',str_replace('\\','/',stripslashes($_POST['dirinclude'])));
|
142 |
+
$jobs[$jobid]['backuproot']= $_POST['backuproot']==1 ? true : false;
|
143 |
+
$jobs[$jobid]['backupcontent']= $_POST['backupcontent']==1 ? true : false;
|
144 |
+
$jobs[$jobid]['backupplugins']= $_POST['backupplugins']==1 ? true : false;
|
145 |
+
$jobs[$jobid]['fileformart']=$_POST['fileformart'];
|
146 |
+
$jobs[$jobid]['mailefilesize']=(float)$_POST['mailefilesize'];
|
147 |
+
$jobs[$jobid]['backupdir']=trailingslashit(str_replace('//','/',str_replace('\\','/',stripslashes($_POST['backupdir']))));
|
148 |
+
$jobs[$jobid]['maxbackups']=abs((int)$_POST['maxbackups']);
|
149 |
+
$jobs[$jobid]['ftphost']=$_POST['ftphost'];
|
150 |
+
$jobs[$jobid]['ftpuser']=$_POST['ftpuser'];
|
151 |
+
$jobs[$jobid]['ftppass']=base64_encode($_POST['ftppass']);
|
152 |
+
$jobs[$jobid]['ftpdir']=trailingslashit(str_replace('//','/',str_replace('\\','/',stripslashes(trim($_POST['ftpdir'])))));
|
153 |
+
$jobs[$jobid]['ftpmaxbackups']=abs((int)$_POST['ftpmaxbackups']);
|
154 |
+
$jobs[$jobid]['awsAccessKey']=$_POST['awsAccessKey'];
|
155 |
+
$jobs[$jobid]['awsSecretKey']=$_POST['awsSecretKey'];
|
156 |
+
$jobs[$jobid]['awsSSL']= $_POST['awsSSL']==1 ? true : false;
|
157 |
+
$jobs[$jobid]['awsBucket']=$_POST['awsBucket'];
|
158 |
+
$jobs[$jobid]['awsdir']=trailingslashit(str_replace('//','/',str_replace('\\','/',stripslashes(trim($_POST['awsdir'])))));
|
159 |
+
if (substr($jobs[$jobid]['awsdir'],0,1)=='/')
|
160 |
+
$jobs[$jobid]['awsdir']=substr($jobs[$jobid]['awsdir'],1);
|
161 |
+
$jobs[$jobid]['mailaddress']=sanitize_email($_POST['mailaddress']);
|
162 |
+
$jobs[$jobid]['awsmaxbackups']=abs((int)$_POST['awsmaxbackups']);
|
163 |
+
|
164 |
+
//save chages
|
165 |
+
update_option('backwpup_jobs',$jobs);
|
166 |
|
167 |
+
//update schedule
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
if ($time=wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid))) {
|
169 |
wp_unschedule_event($time,'backwpup_cron',array('jobid'=>$jobid));
|
170 |
}
|
171 |
if ($jobs[$jobid]['activated']) {
|
172 |
wp_schedule_event($jobs[$jobid]['scheduletime'], 'backwpup_int_'.$jobid, 'backwpup_cron',array('jobid'=>$jobid));
|
173 |
}
|
174 |
+
|
175 |
+
$backwpup_message=str_replace('%1',$jobs[$jobid]['name'],__('Job \'%1\' changes saved.', 'backwpup')).' <a href="admin.php?page=BackWPup">'.__('Jobs overview.', 'backwpup').'</a>';
|
176 |
+
//go to job page
|
177 |
+
$_REQUEST['action']='edit';
|
178 |
+
$_REQUEST['jobid']=$jobid;
|
179 |
+
|
180 |
break;
|
181 |
}
|
182 |
?>
|
app/options-settings.php
CHANGED
@@ -13,110 +13,99 @@ if ( !defined('ABSPATH') )
|
|
13 |
<li><a href="admin.php?page=BackWPup&action=settings" class="current"><?PHP _e('Settings','backwpup'); ?></a></li>
|
14 |
</ul>
|
15 |
|
|
|
|
|
16 |
<form method="post" action="">
|
17 |
<input type="hidden" name="action" value="savecfg" />
|
18 |
<?php wp_nonce_field('backwpup-cfg'); ?>
|
19 |
|
20 |
-
<
|
21 |
-
|
22 |
-
|
23 |
-
<
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
<tr valign="top">
|
44 |
-
<th scope="row"><label for="mailtype"><?PHP _e('Mail Send:','backwpup'); ?></label></th>
|
45 |
-
<td id="mailtype">
|
46 |
-
<?PHP _e('Sender Email:','backwpup'); ?><input name="mailsndemail" type="text" value="<?PHP echo $cfg['mailsndemail'];?>" class="user" /><br />
|
47 |
-
<?PHP _e('Sender Name:','backwpup'); ?><input name="mailsndname" type="text" value="<?PHP echo $cfg['mailsndname'];?>" class="user" /><br />
|
48 |
-
<?PHP _e('Send mail method:','backwpup');
|
49 |
-
echo '<select name="mailmethod">';
|
50 |
-
echo '<option value="mail"'.selected('mail',$cfg['mailmethod'],false).'>'.__('PHP: mail()','backwpup').'</option>';
|
51 |
-
echo '<option value="Sendmail"'.selected('Sendmail',$cfg['mailmethod'],false).'>'.__('Sendmail','backwpup').'</option>';
|
52 |
-
echo '<option value="SMTP"'.selected('SMTP',$cfg['mailmethod'],false).'>'.__('SMTP','backwpup').'</option>';
|
53 |
-
echo '</select>';
|
54 |
-
?><br />
|
55 |
-
<?PHP _e('Sendmail Path:','backwpup'); ?><input name="mailhost" type="text" value="<?PHP echo $cfg['mailsendmail'];?>" class="regular-text" /><br />
|
56 |
-
<?PHP _e('SMTP Hostname:','backwpup'); ?><input name="mailhost" type="text" value="<?PHP echo $cfg['mailhost'];?>" class="regular-text" /><br />
|
57 |
-
<?PHP _e('SMTP Secure Connection:','backwpup');
|
58 |
-
echo '<select name="mailsecure">';
|
59 |
-
echo '<option value=""'.selected('',$cfg['mailsecure'],false).'>'.__('none','backwpup').'</option>';
|
60 |
-
echo '<option value="ssl"'.selected('ssl',$cfg['mailsecure'],false).'>SSL</option>';
|
61 |
-
echo '<option value="tls"'.selected('tls',$cfg['mailsecure'],false).'>TLS</option>';
|
62 |
-
echo '</select>';
|
63 |
-
?><br />
|
64 |
-
<?PHP _e('SMTP Username:','backwpup'); ?><input name="mailuser" type="text" value="<?PHP echo $cfg['mailuser'];?>" class="user" /><br />
|
65 |
-
<?PHP _e('SMTP Password:','backwpup'); ?><input name="mailpass" type="password" value="<?PHP echo base64_decode($cfg['mailpass']);?>" class="password" /><br />
|
66 |
-
</td>
|
67 |
-
</tr>
|
68 |
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
<
|
77 |
-
<
|
78 |
-
<
|
79 |
-
|
80 |
-
|
81 |
-
</
|
82 |
-
|
83 |
-
<
|
84 |
-
|
85 |
-
|
86 |
-
<
|
87 |
-
<?PHP
|
88 |
-
|
89 |
-
<
|
90 |
-
|
91 |
-
|
92 |
-
</
|
93 |
-
|
94 |
-
|
95 |
-
<
|
96 |
-
<
|
97 |
-
|
98 |
-
</
|
99 |
-
</
|
100 |
-
|
101 |
-
<
|
102 |
-
<
|
103 |
-
<
|
104 |
-
|
105 |
-
echo '
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
<p class="submit">
|
119 |
-
|
120 |
</p>
|
121 |
</form>
|
122 |
</div>
|
13 |
<li><a href="admin.php?page=BackWPup&action=settings" class="current"><?PHP _e('Settings','backwpup'); ?></a></li>
|
14 |
</ul>
|
15 |
|
16 |
+
<div class="clear"></div>
|
17 |
+
|
18 |
<form method="post" action="">
|
19 |
<input type="hidden" name="action" value="savecfg" />
|
20 |
<?php wp_nonce_field('backwpup-cfg'); ?>
|
21 |
|
22 |
+
<div id="poststuff" class="metabox-holder has-right-sidebar">
|
23 |
+
<div class="inner-sidebar">
|
24 |
+
<div id="side-sortables" class="meta-box-sortables">
|
25 |
+
<input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes', 'backwpup'); ?>" />
|
26 |
+
</div>
|
27 |
+
</div>
|
28 |
+
<div class="has-sidebar" >
|
29 |
+
<div id="post-body-content" class="has-sidebar-content">
|
30 |
+
|
31 |
+
<div id="memory" class="postbox">
|
32 |
+
<h3 class="hndle"><span><?PHP _e('Max Memory Usage','backwpup'); ?></span></h3>
|
33 |
+
<div class="inside">
|
34 |
+
<?php
|
35 |
+
echo __('PHP.ini Memory Limit:','backwpup').' '.ini_get('memory_limit').'<br />';
|
36 |
+
|
37 |
+
if (empty($cfg['memorylimit']))
|
38 |
+
$cfg['memorylimit']='128M';
|
39 |
+
|
40 |
+
if (!function_exists('memory_get_usage'))
|
41 |
+
echo __('Set Memory limit:','backwpup').'<input name="memorylimit" type="text" value="'.$cfg['memorylimit'].'" class="small-text" />';
|
42 |
+
else
|
43 |
+
echo '<span class="description">'.__('Memory will be automatically increased!!!','backwpup').'</span><input name="memorylimit" type="hidden" value="'.$cfg['memorylimit'].'" />';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
+
?>
|
46 |
+
</div>
|
47 |
+
</div>
|
48 |
+
|
49 |
+
<div id="mailtype" class="postbox">
|
50 |
+
<h3 class="hndle"><span><?PHP _e('Send Mail','backwpup'); ?></span></h3>
|
51 |
+
<div class="inside">
|
52 |
+
<b><?PHP _e('Sender Email:','backwpup'); ?></b><br /><input name="mailsndemail" type="text" value="<?PHP echo $cfg['mailsndemail'];?>" class="large-text" /><br />
|
53 |
+
<b><?PHP _e('Sender Name:','backwpup'); ?></b><br /><input name="mailsndname" type="text" value="<?PHP echo $cfg['mailsndname'];?>" class="large-text" /><br />
|
54 |
+
<b><?PHP _e('Send mail method:','backwpup'); ?></b><br />
|
55 |
+
<?PHP
|
56 |
+
echo '<select id="mailmethod" name="mailmethod">';
|
57 |
+
echo '<option value="mail"'.selected('mail',$cfg['mailmethod'],false).'>'.__('PHP: mail()','backwpup').'</option>';
|
58 |
+
echo '<option value="Sendmail"'.selected('Sendmail',$cfg['mailmethod'],false).'>'.__('Sendmail','backwpup').'</option>';
|
59 |
+
echo '<option value="SMTP"'.selected('SMTP',$cfg['mailmethod'],false).'>'.__('SMTP','backwpup').'</option>';
|
60 |
+
echo '</select>';
|
61 |
+
?><br />
|
62 |
+
<label id="mailsendmail" <?PHP if ($cfg['mailmethod']!='Sendmail') echo 'style="display:none;"';?>><b><?PHP _e('Sendmail Path:','backwpup'); ?></b><br /><input name="mailsendmail" type="text" value="<?PHP echo $cfg['mailsendmail'];?>" class="large-text" /><br /></label>
|
63 |
+
<label id="mailsmtp" <?PHP if ($cfg['mailmethod']!='SMTP') echo 'style="display:none;"';?>>
|
64 |
+
<b><?PHP _e('SMTP Hostname:','backwpup'); ?></b><br /><input name="mailhost" type="text" value="<?PHP echo $cfg['mailhost'];?>" class="large-text" /><br />
|
65 |
+
<b><?PHP _e('SMTP Secure Connection:','backwpup'); ?></b><br />
|
66 |
+
<select name="mailsecure">
|
67 |
+
<option value=""<?PHP selected('',$cfg['mailsecure'],true); ?>><?PHP _e('none','backwpup'); ?></option>
|
68 |
+
<option value="ssl"<?PHP selected('ssl',$cfg['mailsecure'],true); ?>>SSL</option>
|
69 |
+
<option value="tls"<?PHP selected('tls',$cfg['mailsecure'],true); ?>>TLS</option>
|
70 |
+
</select><br />
|
71 |
+
<b><?PHP _e('SMTP Username:','backwpup'); ?></b><br /><input name="mailuser" type="text" value="<?PHP echo $cfg['mailuser'];?>" class="user large-text" /><br />
|
72 |
+
<b><?PHP _e('SMTP Password:','backwpup'); ?></b><br /><input name="mailpass" type="password" value="<?PHP echo base64_decode($cfg['mailpass']);?>" class="password large-text" /><br />
|
73 |
+
</label>
|
74 |
+
</div>
|
75 |
+
</div>
|
76 |
+
|
77 |
+
<div id="logs" class="postbox">
|
78 |
+
<h3 class="hndle"><span><?PHP _e('Logs','backwpup'); ?></span></h3>
|
79 |
+
<div class="inside">
|
80 |
+
<b><?PHP _e('Log file Folder:','backwpup'); ?></b><br />
|
81 |
+
<input name="dirlogs" type="text" value="<?PHP echo $cfg['dirlogs'];?>" class="large-text" /><br />
|
82 |
+
<b><?PHP _e('Max. Log Files in Folder:','backwpup'); ?></b><br />
|
83 |
+
<input name="maxlogs" id="maxlogs" size="3" type="text" value="<?PHP echo $cfg['maxlogs'];?>" class="small-text" /><span class="description"><?PHP _e('(Oldest files will deleted first.)','backwpup');?></span>
|
84 |
+
</div>
|
85 |
+
</div>
|
86 |
+
|
87 |
+
<div id="disablewpcron" class="postbox">
|
88 |
+
<h3 class="hndle"><span><?PHP _e('Disable WP-Cron','backwpup'); ?></span></h3>
|
89 |
+
<div class="inside">
|
90 |
+
<input class="checkbox" id="disablewpcron" type="checkbox"<?php checked($cfg['disablewpcron'],true,true);?> name="disablewpcron" value="1"/> <?PHP _e('Use Cron job of Hoster and disable WP_Cron','backwpup'); ?><br />
|
91 |
+
<?PHP _e('You must set up a cron job that calls:','backwpup'); ?><br />
|
92 |
+
<i> php -q <?PHP echo ABSPATH.'wp-cron.php'; ?></i><br />
|
93 |
+
<?PHP _e('or URL:','backwpup'); ?> <i><?PHP echo trailingslashit(get_option('siteurl')).'wp-cron.php'; ?></i><br />
|
94 |
+
</div>
|
95 |
+
</div>
|
96 |
+
|
97 |
+
<div id="dirtemp" class="postbox">
|
98 |
+
<h3 class="hndle"><span><?PHP _e('Temp Folder','backwpup'); ?></span></h3>
|
99 |
+
<div class="inside">
|
100 |
+
<input name="dirtemp" type="text" value="<?PHP echo $cfg['dirtemp'];?>" class="large-text" /><br />
|
101 |
+
</div>
|
102 |
+
</div>
|
103 |
+
<input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes', 'backwpup'); ?>" />
|
104 |
+
</div>
|
105 |
+
</div>
|
106 |
+
</div>
|
107 |
<p class="submit">
|
108 |
+
|
109 |
</p>
|
110 |
</form>
|
111 |
</div>
|
app/options-tools.php
CHANGED
@@ -5,7 +5,8 @@ if ( !defined('ABSPATH') )
|
|
5 |
?>
|
6 |
<div class="wrap">
|
7 |
<div id="icon-tools" class="icon32"><br /></div>
|
8 |
-
<h2><?php _e("BackWPup
|
|
|
9 |
<ul class="subsubsub">
|
10 |
<li><a href="admin.php?page=BackWPup"><?PHP _e('Jobs','backwpup'); ?></a> |</li>
|
11 |
<li><a href="admin.php?page=BackWPup&action=logs"><?PHP _e('Logs','backwpup'); ?></a> |</li>
|
@@ -13,67 +14,77 @@ if ( !defined('ABSPATH') )
|
|
13 |
<li><a href="admin.php?page=BackWPup&action=settings"><?PHP _e('Settings','backwpup'); ?></a></li>
|
14 |
</ul>
|
15 |
|
|
|
|
|
16 |
<form method="post" action="">
|
17 |
<input type="hidden" name="action" value="tools" />
|
18 |
<input type="hidden" name="page" value="BackWPup" />
|
19 |
<?php wp_nonce_field('backwpup-tools'); ?>
|
20 |
-
<table class="form-table">
|
21 |
-
<tr valign="top">
|
22 |
-
<th scope="row"><label for="sqlfile"><?PHP _e('Database restore','backwpup'); ?></label></th>
|
23 |
-
<td>
|
24 |
-
|
25 |
-
<?PHP
|
26 |
-
if ($_POST['dbrestore']==__('Restore', 'backwpup') and is_file($_POST['sqlfile'])) {
|
27 |
-
$sqlfile=$_POST['sqlfile'];
|
28 |
-
require('tools/db_restore.php');
|
29 |
-
} else {
|
30 |
-
if ( $dir = @opendir(ABSPATH)) {
|
31 |
-
$sqlfile="";
|
32 |
-
while (($file = readdir( $dir ) ) !== false ) {
|
33 |
-
if (strtolower(substr($file,-4))==".sql") {
|
34 |
-
$sqlfile=$file;
|
35 |
-
break;
|
36 |
-
}
|
37 |
-
}
|
38 |
-
@closedir( $dir );
|
39 |
-
}
|
40 |
-
if (!empty($sqlfile)) {
|
41 |
-
echo __('SQL File to restore:','backwpup').' '.trailingslashit(ABSPATH).$sqlfile."<br />";
|
42 |
-
?>
|
43 |
-
<input type="hidden" name="sqlfile" id="sqlfile" value="<?PHP echo trailingslashit(ABSPATH).$sqlfile;?>" class="regular-text" />
|
44 |
-
<input type="submit" name="dbrestore" class="button" value="<?php _e('Restore', 'backwpup'); ?>" />
|
45 |
-
<?PHP
|
46 |
-
} else {
|
47 |
-
echo __('Copy SQL file to restore in the Blog root dir to use restore.', 'backwpup')."<br />";
|
48 |
-
}
|
49 |
-
}
|
50 |
-
?>
|
51 |
-
</td>
|
52 |
-
</tr>
|
53 |
|
54 |
-
<
|
55 |
-
<
|
56 |
-
<
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
</form>
|
79 |
</div>
|
5 |
?>
|
6 |
<div class="wrap">
|
7 |
<div id="icon-tools" class="icon32"><br /></div>
|
8 |
+
<h2><?php _e("BackWPup Tools", "backwpup"); ?></h2>
|
9 |
+
|
10 |
<ul class="subsubsub">
|
11 |
<li><a href="admin.php?page=BackWPup"><?PHP _e('Jobs','backwpup'); ?></a> |</li>
|
12 |
<li><a href="admin.php?page=BackWPup&action=logs"><?PHP _e('Logs','backwpup'); ?></a> |</li>
|
14 |
<li><a href="admin.php?page=BackWPup&action=settings"><?PHP _e('Settings','backwpup'); ?></a></li>
|
15 |
</ul>
|
16 |
|
17 |
+
<div class="clear"></div>
|
18 |
+
|
19 |
<form method="post" action="">
|
20 |
<input type="hidden" name="action" value="tools" />
|
21 |
<input type="hidden" name="page" value="BackWPup" />
|
22 |
<?php wp_nonce_field('backwpup-tools'); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
+
<div id="poststuff" class="metabox-holder has-right-sidebar">
|
25 |
+
<div class="inner-sidebar">
|
26 |
+
<div id="side-sortables" class="meta-box-sortables">
|
27 |
+
|
28 |
+
</div>
|
29 |
+
</div>
|
30 |
+
<div class="has-sidebar" >
|
31 |
+
<div id="post-body-content" class="has-sidebar-content">
|
32 |
+
|
33 |
+
<div id="dbrestore" class="postbox">
|
34 |
+
<h3 class="hndle"><span><?PHP _e('Database restore','backwpup'); ?></span></h3>
|
35 |
+
<div class="inside">
|
36 |
+
<?PHP
|
37 |
+
if ($_POST['dbrestore']==__('Restore', 'backwpup') and is_file($_POST['sqlfile'])) {
|
38 |
+
$sqlfile=$_POST['sqlfile'];
|
39 |
+
require('tools/db_restore.php');
|
40 |
+
} else {
|
41 |
+
if ( $dir = @opendir(ABSPATH)) {
|
42 |
+
$sqlfile="";
|
43 |
+
while (($file = readdir( $dir ) ) !== false ) {
|
44 |
+
if (strtolower(substr($file,-4))==".sql") {
|
45 |
+
$sqlfile=$file;
|
46 |
+
break;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
@closedir( $dir );
|
50 |
+
}
|
51 |
+
if (!empty($sqlfile)) {
|
52 |
+
echo __('SQL File to restore:','backwpup').' '.trailingslashit(ABSPATH).$sqlfile."<br />";
|
53 |
+
?>
|
54 |
+
<input type="hidden" name="sqlfile" id="sqlfile" value="<?PHP echo trailingslashit(ABSPATH).$sqlfile;?>" />
|
55 |
+
<input type="submit" name="dbrestore" class="button-primary" value="<?php _e('Restore', 'backwpup'); ?>" />
|
56 |
+
<?PHP
|
57 |
+
} else {
|
58 |
+
echo __('Copy SQL file to Blog root folder to use restore.', 'backwpup')."<br />";
|
59 |
+
}
|
60 |
+
}
|
61 |
+
?>
|
62 |
+
</div>
|
63 |
+
</div>
|
64 |
+
|
65 |
+
<div id="createbucket" class="postbox">
|
66 |
+
<h3 class="hndle"><span><?PHP _e('Create Amazon S3 Bucket','backwpup'); ?></span></h3>
|
67 |
+
<div class="inside">
|
68 |
+
<?PHP
|
69 |
+
if ($_POST['awsbucketcreate']==__('Create', 'backwpup') and !empty($_POST['awsAccessKey']) and !empty($_POST['awsSecretKey']) and !empty($_POST['awsBucket'])) {
|
70 |
+
if (!class_exists('S3')) require_once 'libs/S3.php';
|
71 |
+
$s3 = new S3($_POST['awsAccessKey'], $_POST['awsSecretKey'], false);
|
72 |
+
if ($s3->putBucket($_POST['awsBucket'], S3::ACL_PRIVATE, $_POST['awsRegion']))
|
73 |
+
echo __('Amazone S3 Bucket created.', 'backwpup')."<br />";
|
74 |
+
else
|
75 |
+
echo __('Can not create Amazon S3 Bucket.', 'backwpup')."<br />";
|
76 |
+
|
77 |
+
}
|
78 |
+
?>
|
79 |
+
<b><?php _e('Access Key ID:', 'backwpup'); ?></b><br /><input type="text" name="awsAccessKey" id="awsAccessKey" value="<?PHP echo $_POST['awsAccessKey'];?>" class="large-text" /><br />
|
80 |
+
<b><?php _e('Secret Access Key:', 'backwpup'); ?></b><br /><input type="text" name="awsSecretKey" id="awsSecretKey" value="<?PHP echo $_POST['awsSecretKey'];?>" class="large-text" /><br />
|
81 |
+
<b><?php _e('Bucket Name:', 'backwpup'); ?></b><br /><input type="text" name="awsBucket" id="awsBucket" value="<?PHP echo $_POST['awsBucket'];?>" class="large-text" /><br />
|
82 |
+
<b><?php _e('Bucket Region:', 'backwpup'); ?></b><br /><select name="awsRegion"><option value=""><?php _e('US', 'backwpup'); ?></option><option value="EU"><?php _e('Europe', 'backwpup'); ?></option></select><br />
|
83 |
+
<input type="submit" name="awsbucketcreate" class="button-primary" value="<?php _e('Create', 'backwpup'); ?>" />
|
84 |
+
</div>
|
85 |
+
</div>
|
86 |
+
</div>
|
87 |
+
</div>
|
88 |
+
</div>
|
89 |
</form>
|
90 |
</div>
|
app/options-view_log-iframe.php
CHANGED
@@ -1,8 +1,9 @@
|
|
1 |
<?PHP
|
2 |
-
if (
|
3 |
-
/** Setup WordPress environment */
|
4 |
-
|
|
|
|
|
|
|
5 |
}
|
6 |
-
check_admin_referer('viewlognow_'.basename($_GET['logfile']));
|
7 |
-
readfile($_GET['logfile']);
|
8 |
?>
|
1 |
<?PHP
|
2 |
+
if (is_dir($_GET['ABSPATH'])) {
|
3 |
+
require_once($_GET['ABSPATH'].'/wp-load.php'); /** Setup WordPress environment */
|
4 |
+
check_admin_referer('viewlognow_'.basename($_GET['logfile']));
|
5 |
+
readfile($_GET['logfile']);
|
6 |
+
} else {
|
7 |
+
header("HTTP/1.0 404 Not Found");
|
8 |
}
|
|
|
|
|
9 |
?>
|
app/options.php
CHANGED
@@ -34,20 +34,20 @@ if ( !defined('ABSPATH') )
|
|
34 |
<table class="widefat" cellspacing="0">
|
35 |
<thead>
|
36 |
<tr>
|
37 |
-
<?php print_column_headers(
|
38 |
</tr>
|
39 |
</thead>
|
40 |
|
41 |
<tfoot>
|
42 |
<tr>
|
43 |
-
<?php print_column_headers(
|
44 |
</tr>
|
45 |
</tfoot>
|
46 |
|
47 |
<tbody id="the-list" class="list:post">
|
48 |
<?php
|
49 |
-
$item_columns = get_column_headers(
|
50 |
-
$hidden = get_hidden_columns(
|
51 |
|
52 |
if (is_array($jobs)) {
|
53 |
foreach ($jobs as $jobid => $jobvalue) {
|
@@ -66,10 +66,10 @@ if ( !defined('ABSPATH') )
|
|
66 |
echo '<th scope="row" class="check-column"><input type="checkbox" name="jobs[]" value="'. esc_attr($jobid) .'" /></th>';
|
67 |
break;
|
68 |
case 'id':
|
69 |
-
echo
|
70 |
break;
|
71 |
-
case '
|
72 |
-
echo
|
73 |
$actions = array();
|
74 |
$actions['edit'] = "<a href=\"" . wp_nonce_url('admin.php?page=BackWPup&action=edit&jobid='.$jobid, 'edit-job') . "\">" . __('Edit') . "</a>";
|
75 |
$actions['copy'] = "<a href=\"" . wp_nonce_url('admin.php?page=BackWPup&action=copy&jobid='.$jobid, 'copy-job_'.$jobid) . "\">" . __('Copy','backwpup') . "</a>";
|
@@ -94,7 +94,7 @@ if ( !defined('ABSPATH') )
|
|
94 |
case 'next':
|
95 |
echo "<td $attributes>";
|
96 |
if ($jobvalue['starttime']>0 and empty($jobvalue['stoptime'])) {
|
97 |
-
$runtime=
|
98 |
echo __('Running since:','backwpup').' '.$runtime.' '.__('sec.','backwpup');
|
99 |
} elseif ($time=wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid))) {
|
100 |
echo date_i18n(get_option('date_format'),$time); ?><br /><?PHP echo date_i18n(get_option('time_format'),$time);
|
34 |
<table class="widefat" cellspacing="0">
|
35 |
<thead>
|
36 |
<tr>
|
37 |
+
<?php print_column_headers($page_hook); ?>
|
38 |
</tr>
|
39 |
</thead>
|
40 |
|
41 |
<tfoot>
|
42 |
<tr>
|
43 |
+
<?php print_column_headers($page_hook, false); ?>
|
44 |
</tr>
|
45 |
</tfoot>
|
46 |
|
47 |
<tbody id="the-list" class="list:post">
|
48 |
<?php
|
49 |
+
$item_columns = get_column_headers($page_hook);
|
50 |
+
$hidden = get_hidden_columns($page_hook);
|
51 |
|
52 |
if (is_array($jobs)) {
|
53 |
foreach ($jobs as $jobid => $jobvalue) {
|
66 |
echo '<th scope="row" class="check-column"><input type="checkbox" name="jobs[]" value="'. esc_attr($jobid) .'" /></th>';
|
67 |
break;
|
68 |
case 'id':
|
69 |
+
echo "<td $attributes>".$jobid."</td>";
|
70 |
break;
|
71 |
+
case 'jobname':
|
72 |
+
echo "<td $attributes><strong><a href=\"".wp_nonce_url('admin.php?page=BackWPup&action=edit&jobid='.$jobid, 'edit-job')."\" title=\"".__('Edit:','backwpup').$jobvalue['name']."\">".esc_html($jobvalue['name'])."</a></strong>";
|
73 |
$actions = array();
|
74 |
$actions['edit'] = "<a href=\"" . wp_nonce_url('admin.php?page=BackWPup&action=edit&jobid='.$jobid, 'edit-job') . "\">" . __('Edit') . "</a>";
|
75 |
$actions['copy'] = "<a href=\"" . wp_nonce_url('admin.php?page=BackWPup&action=copy&jobid='.$jobid, 'copy-job_'.$jobid) . "\">" . __('Copy','backwpup') . "</a>";
|
94 |
case 'next':
|
95 |
echo "<td $attributes>";
|
96 |
if ($jobvalue['starttime']>0 and empty($jobvalue['stoptime'])) {
|
97 |
+
$runtime=current_time('timestamp')-$jobvalue['starttime'];
|
98 |
echo __('Running since:','backwpup').' '.$runtime.' '.__('sec.','backwpup');
|
99 |
} elseif ($time=wp_next_scheduled('backwpup_cron',array('jobid'=>$jobid))) {
|
100 |
echo date_i18n(get_option('date_format'),$time); ?><br /><?PHP echo date_i18n(get_option('time_format'),$time);
|
app/wp_xml_export.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?PHP
|
2 |
+
if (is_dir($_GET['ABSPATH'])) {
|
3 |
+
require_once($_GET['ABSPATH'].'/wp-load.php'); /** Setup WordPress environment */
|
4 |
+
} else {
|
5 |
+
header("HTTP/1.0 404 Not Found");
|
6 |
+
}
|
7 |
+
if ($_GET['_nonce']==substr(md5(md5(SECURE_AUTH_KEY)),10,10)) {
|
8 |
+
require_once($_GET['ABSPATH'].'/wp-admin/includes/export.php');
|
9 |
+
export_wp();
|
10 |
+
} else {
|
11 |
+
header("HTTP/1.0 404 Not Found");
|
12 |
+
}
|
13 |
+
?>
|
backwpup.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: BackWPup
|
|
4 |
Plugin URI: http://danielhuesken.de/portfolio/backwpup/
|
5 |
Description: Backup and more of your WordPress Blog Database and Files.
|
6 |
Author: Daniel Hüsken
|
7 |
-
Version: 0.
|
8 |
Author URI: http://danielhuesken.de
|
9 |
Text Domain: backwpup
|
10 |
Domain Path: /lang/
|
@@ -35,7 +35,7 @@ if ( !defined('ABSPATH') )
|
|
35 |
//Set plugin dirname
|
36 |
define('BACKWPUP_PLUGIN_DIR', dirname(plugin_basename(__FILE__)));
|
37 |
//Set Plugin Version
|
38 |
-
define('BACKWPUP_VERSION', '0.
|
39 |
|
40 |
//load Text Domain
|
41 |
load_plugin_textdomain('backwpup', false, BACKWPUP_PLUGIN_DIR.'/lang');
|
4 |
Plugin URI: http://danielhuesken.de/portfolio/backwpup/
|
5 |
Description: Backup and more of your WordPress Blog Database and Files.
|
6 |
Author: Daniel Hüsken
|
7 |
+
Version: 1.0.0
|
8 |
Author URI: http://danielhuesken.de
|
9 |
Text Domain: backwpup
|
10 |
Domain Path: /lang/
|
35 |
//Set plugin dirname
|
36 |
define('BACKWPUP_PLUGIN_DIR', dirname(plugin_basename(__FILE__)));
|
37 |
//Set Plugin Version
|
38 |
+
define('BACKWPUP_VERSION', '1.0.0');
|
39 |
|
40 |
//load Text Domain
|
41 |
load_plugin_textdomain('backwpup', false, BACKWPUP_PLUGIN_DIR.'/lang');
|
lang/backwpup.pot
CHANGED
@@ -1,763 +1,896 @@
|
|
1 |
-
#
|
2 |
-
# Copyright (C)
|
3 |
-
# This file is distributed under the same license as the
|
4 |
-
# FIRST AUTHOR <EMAIL@ADDRESS>,
|
5 |
#
|
6 |
#, fuzzy
|
7 |
msgid ""
|
8 |
msgstr ""
|
9 |
-
"Project-Id-Version:
|
10 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/backwpup\n"
|
11 |
-
"POT-Creation-Date:
|
12 |
-
"PO-Revision-Date:
|
13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
15 |
"MIME-Version: 1.0\n"
|
16 |
-
"Content-Type: text/plain; charset=
|
17 |
"Content-Transfer-Encoding: 8bit\n"
|
18 |
|
19 |
-
#: app/
|
20 |
-
msgid "
|
21 |
msgstr ""
|
22 |
|
23 |
-
#: app/
|
24 |
-
msgid "
|
25 |
msgstr ""
|
26 |
|
27 |
-
#: app/
|
28 |
-
|
29 |
-
msgid "Backup ZIP File size is %1s"
|
30 |
msgstr ""
|
31 |
|
32 |
-
#: app/
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
35 |
msgstr ""
|
36 |
|
37 |
-
#: app/
|
38 |
-
|
39 |
-
#: app/dojob/file.php:44 app/functions.php:239 app/functions.php:261
|
40 |
-
msgid "WARNING:"
|
41 |
msgstr ""
|
42 |
|
43 |
-
#: app/
|
44 |
#, php-format
|
45 |
-
msgid "
|
46 |
msgstr ""
|
47 |
|
48 |
-
#: app/
|
|
|
|
|
|
|
|
|
|
|
49 |
#, php-format
|
50 |
msgid ""
|
51 |
"Memory limit set to %1$s ,because can not use PHP: memory_get_usage() "
|
52 |
-
"function
|
53 |
msgstr ""
|
54 |
|
55 |
-
#: app/
|
56 |
#, php-format
|
57 |
-
msgid "
|
58 |
-
msgstr ""
|
59 |
-
|
60 |
-
#: app/dojob/bevore.php:49 app/dojob/bevore.php:55 app/dojob/bevore.php:77
|
61 |
-
#: app/dojob/bevore.php:83 app/dojob/check.php:23 app/dojob/check.php:28
|
62 |
-
#: app/dojob/check.php:35 app/dojob/db.php:23 app/dojob/db.php:33
|
63 |
-
#: app/dojob/db.php:80 app/dojob/db.php:128 app/dojob/db.php:131
|
64 |
-
#: app/dojob/db.php:143 app/dojob/destination-ftp.php:27
|
65 |
-
#: app/dojob/destination-ftp.php:78 app/dojob/destination-ftp.php:94
|
66 |
-
#: app/dojob/destination-ftp.php:104 app/dojob/destination-mail.php:23
|
67 |
-
#: app/dojob/destination-mail.php:30 app/dojob/destination-mail.php:38
|
68 |
-
#: app/dojob/file.php:86 app/dojob/file.php:98 app/dojob/file.php:105
|
69 |
-
#: app/dojob/optimize.php:23 app/dojob/optimize.php:29 app/functions.php:246
|
70 |
-
#: app/functions.php:257
|
71 |
-
msgid "ERROR:"
|
72 |
msgstr ""
|
73 |
|
74 |
-
#: app/
|
75 |
-
|
|
|
76 |
msgstr ""
|
77 |
|
78 |
-
#: app/
|
79 |
-
|
|
|
80 |
msgstr ""
|
81 |
|
82 |
-
#: app/
|
83 |
-
|
|
|
84 |
msgstr ""
|
85 |
|
86 |
-
#: app/
|
87 |
-
|
|
|
88 |
msgstr ""
|
89 |
|
90 |
-
#: app/
|
91 |
-
msgid "
|
92 |
msgstr ""
|
93 |
|
94 |
-
#: app/
|
95 |
-
msgid "
|
96 |
msgstr ""
|
97 |
|
98 |
-
#: app/
|
99 |
-
msgid "
|
100 |
msgstr ""
|
101 |
|
102 |
-
#: app/
|
|
|
103 |
#, php-format
|
104 |
msgid "Result of table check for %1$s is: %2$s"
|
105 |
msgstr ""
|
106 |
|
107 |
-
#: app/
|
108 |
-
#: app/
|
|
|
|
|
109 |
#, php-format
|
110 |
msgid "BackWPup database error %1$s for query %2$s"
|
111 |
msgstr ""
|
112 |
|
113 |
-
#: app/
|
|
|
114 |
#, php-format
|
115 |
-
msgid "Result of table repair for %1$s is: %2$s
|
116 |
msgstr ""
|
117 |
|
118 |
-
#: app/
|
119 |
msgid "Database check done!"
|
120 |
msgstr ""
|
121 |
|
122 |
-
#: app/
|
123 |
msgid "No Tables to check"
|
124 |
msgstr ""
|
125 |
|
126 |
-
#: app/
|
127 |
-
msgid "Run Database
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
msgstr ""
|
129 |
|
130 |
-
#: app/
|
131 |
-
msgid "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
msgstr ""
|
133 |
|
134 |
-
#: app/
|
135 |
-
msgid "
|
136 |
msgstr ""
|
137 |
|
138 |
-
#: app/
|
139 |
-
msgid "
|
140 |
msgstr ""
|
141 |
|
142 |
-
#: app/
|
143 |
-
msgid "
|
144 |
msgstr ""
|
145 |
|
146 |
-
#: app/
|
147 |
-
msgid "
|
148 |
msgstr ""
|
149 |
|
150 |
-
#: app/
|
151 |
-
msgid "Create Zip file
|
152 |
msgstr ""
|
153 |
|
154 |
-
#: app/
|
155 |
-
msgid "
|
156 |
msgstr ""
|
157 |
|
158 |
-
#: app/
|
159 |
-
msgid "
|
160 |
msgstr ""
|
161 |
|
162 |
-
#: app/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
msgid "FTP Client command:"
|
164 |
msgstr ""
|
165 |
|
166 |
-
#: app/
|
167 |
msgid "FTP Server Preliminary reply:"
|
168 |
msgstr ""
|
169 |
|
170 |
-
#: app/
|
171 |
msgid "FTP Server Completion reply:"
|
172 |
msgstr ""
|
173 |
|
174 |
-
#: app/
|
175 |
msgid "FTP Server Intermediate reply:"
|
176 |
msgstr ""
|
177 |
|
178 |
-
#: app/
|
|
|
179 |
msgid "FTP Server reply:"
|
180 |
msgstr ""
|
181 |
|
182 |
-
#: app/
|
183 |
-
msgid "FTP Server answer:"
|
184 |
-
msgstr ""
|
185 |
-
|
186 |
-
#: app/dojob/destination-ftp.php:45
|
187 |
msgid "Connected by SSL to FTP server:"
|
188 |
msgstr ""
|
189 |
|
190 |
-
#: app/
|
191 |
msgid "Connected insecure to FTP server:"
|
192 |
msgstr ""
|
193 |
|
194 |
-
#: app/
|
195 |
-
msgid "FTP server
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
msgstr ""
|
197 |
|
198 |
-
#: app/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
msgid "Backup File transferred to FTP Server:"
|
200 |
msgstr ""
|
201 |
|
202 |
-
#: app/
|
203 |
msgid "Can not transfer backup to FTP server."
|
204 |
msgstr ""
|
205 |
|
206 |
-
#: app/
|
207 |
msgid "Can not delete file on FTP Server:"
|
208 |
msgstr ""
|
209 |
|
210 |
-
#: app/
|
211 |
msgid "files deleted on FTP Server:"
|
212 |
msgstr ""
|
213 |
|
214 |
-
#: app/
|
215 |
-
msgid "
|
216 |
msgstr ""
|
217 |
|
218 |
-
#: app/
|
219 |
-
msgid "
|
220 |
msgstr ""
|
221 |
|
222 |
-
#: app/
|
223 |
-
msgid "
|
224 |
msgstr ""
|
225 |
|
226 |
-
#: app/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
msgid "Backup Archive too big for sending by mail"
|
228 |
msgstr ""
|
229 |
|
230 |
-
#: app/
|
231 |
-
msgid "
|
|
|
|
|
|
|
|
|
232 |
msgstr ""
|
233 |
|
234 |
-
#: app/
|
235 |
msgid "Mail send!!!"
|
236 |
msgstr ""
|
237 |
|
238 |
-
#: app/
|
239 |
msgid "Can not send mail:"
|
240 |
msgstr ""
|
241 |
|
242 |
-
#: app/
|
243 |
-
msgid "
|
244 |
msgstr ""
|
245 |
|
246 |
-
#: app/
|
247 |
-
msgid "
|
248 |
msgstr ""
|
249 |
|
250 |
-
#: app/
|
251 |
-
msgid "File to
|
252 |
msgstr ""
|
253 |
|
254 |
-
#: app/
|
255 |
-
msgid "Can not
|
256 |
msgstr ""
|
257 |
|
258 |
-
#: app/
|
259 |
-
msgid "
|
260 |
msgstr ""
|
261 |
|
262 |
-
#: app/
|
263 |
-
msgid "
|
264 |
msgstr ""
|
265 |
|
266 |
-
#: app/
|
267 |
-
msgid "
|
268 |
msgstr ""
|
269 |
|
270 |
-
#: app/
|
271 |
-
msgid "
|
272 |
msgstr ""
|
273 |
|
274 |
-
#: app/
|
275 |
-
|
|
|
276 |
msgstr ""
|
277 |
|
278 |
-
#: app/
|
279 |
-
msgid "
|
280 |
msgstr ""
|
281 |
|
282 |
-
#: app/
|
283 |
-
|
|
|
284 |
msgstr ""
|
285 |
|
286 |
-
#: app/
|
287 |
-
msgid "
|
288 |
msgstr ""
|
289 |
|
290 |
-
#: app/
|
291 |
-
msgid "
|
292 |
msgstr ""
|
293 |
|
294 |
-
#: app/
|
295 |
-
|
296 |
-
msgid "Result of table optimize for %1$s is: %2$s"
|
297 |
msgstr ""
|
298 |
|
299 |
-
#: app/
|
300 |
-
msgid "
|
301 |
msgstr ""
|
302 |
|
303 |
-
#: app/
|
304 |
-
msgid "
|
305 |
msgstr ""
|
306 |
|
307 |
-
#. #-#-#-#-# plugin.pot (
|
308 |
-
#. Plugin Name of
|
309 |
#: app/functions.php:8 app/options.php:8
|
310 |
msgid "BackWPup"
|
311 |
msgstr ""
|
312 |
|
313 |
-
#: app/functions.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
msgid "Support"
|
315 |
msgstr ""
|
316 |
|
317 |
-
#: app/functions.php:
|
318 |
msgid "FAQ"
|
319 |
msgstr ""
|
320 |
|
321 |
-
#: app/functions.php:
|
322 |
msgid "Plugin Homepage"
|
323 |
msgstr ""
|
324 |
|
325 |
-
#: app/functions.php:
|
326 |
msgid "Plugin Home on WordPress.org"
|
327 |
msgstr ""
|
328 |
|
329 |
-
#: app/functions.php:
|
330 |
msgid "Donate"
|
331 |
msgstr ""
|
332 |
|
333 |
-
#: app/functions.php:
|
334 |
msgid "Version:"
|
335 |
msgstr ""
|
336 |
|
337 |
-
#: app/functions.php:
|
338 |
msgid "Author:"
|
339 |
msgstr ""
|
340 |
|
341 |
-
#: app/functions.php:
|
342 |
msgid "Go to Settings Page"
|
343 |
msgstr ""
|
344 |
|
345 |
-
#: app/functions.php:
|
346 |
-
#: app/options-settings.php:13 app/options-tools.php:
|
347 |
#: app/options-view_log.php:13 app/options.php:13
|
348 |
msgid "Settings"
|
349 |
msgstr ""
|
350 |
|
351 |
-
#: app/functions.php:
|
352 |
msgid "BackWPup Job "
|
353 |
msgstr ""
|
354 |
|
355 |
-
#: app/functions.php:
|
356 |
-
|
357 |
-
msgid "PHP Safe Mode is on!!! Can not increase Memory Limit is %1$s"
|
358 |
msgstr ""
|
359 |
|
360 |
-
#: app/functions.php:
|
361 |
-
#, php-format
|
362 |
-
msgid "Memory increased from %1$s to %2$s"
|
363 |
-
msgstr ""
|
364 |
-
|
365 |
-
#: app/functions.php:246
|
366 |
-
#, php-format
|
367 |
-
msgid "Can not increase Memory Limit is %1$s"
|
368 |
-
msgstr ""
|
369 |
-
|
370 |
-
#: app/functions.php:286
|
371 |
-
msgid "Database & File Backup"
|
372 |
-
msgstr ""
|
373 |
-
|
374 |
-
#: app/functions.php:289
|
375 |
msgid "Database Backup"
|
376 |
msgstr ""
|
377 |
|
378 |
-
#: app/functions.php:
|
379 |
msgid "File Backup"
|
380 |
msgstr ""
|
381 |
|
382 |
-
#: app/functions.php:
|
383 |
msgid "Optimize Database Tables"
|
384 |
msgstr ""
|
385 |
|
386 |
-
#: app/functions.php:
|
387 |
msgid "Check Database Tables"
|
388 |
msgstr ""
|
389 |
|
390 |
-
#: app/functions.php:
|
391 |
msgid "Logs:"
|
392 |
msgstr ""
|
393 |
|
394 |
-
#: app/functions.php:
|
395 |
msgid "View Log"
|
396 |
msgstr ""
|
397 |
|
398 |
-
#: app/functions.php:
|
399 |
msgid "ERROR(S)"
|
400 |
msgstr ""
|
401 |
|
402 |
-
#: app/functions.php:
|
403 |
msgid "WARNING(S)"
|
404 |
msgstr ""
|
405 |
|
406 |
-
#: app/functions.php:
|
407 |
msgid "OK"
|
408 |
msgstr ""
|
409 |
|
410 |
-
#: app/functions.php:
|
411 |
msgid "none"
|
412 |
msgstr ""
|
413 |
|
414 |
-
#: app/functions.php:
|
415 |
msgid "Scheduled Jobs:"
|
416 |
msgstr ""
|
417 |
|
418 |
-
#: app/functions.php:
|
419 |
msgid "Edit Job"
|
420 |
msgstr ""
|
421 |
|
422 |
-
#: app/functions.php:
|
423 |
msgid "Running since:"
|
424 |
msgstr ""
|
425 |
|
426 |
-
#: app/functions.php:
|
427 |
-
#: app/options
|
428 |
msgid "sec."
|
429 |
msgstr ""
|
430 |
|
431 |
-
#: app/options-
|
432 |
-
msgid "
|
433 |
msgstr ""
|
434 |
|
435 |
-
#: app/options-
|
436 |
msgid "Job Type"
|
437 |
msgstr ""
|
438 |
|
439 |
-
#: app/options-
|
440 |
-
msgid "
|
441 |
-
|
442 |
-
|
443 |
-
#: app/options-edit.php:49 app/options-jobs.php:36
|
444 |
-
msgid "Job Name"
|
445 |
-
msgstr ""
|
446 |
-
|
447 |
-
#: app/options-edit.php:55
|
448 |
-
msgid "Exclude Databas Tabels:"
|
449 |
-
msgstr ""
|
450 |
-
|
451 |
-
#: app/options-edit.php:75
|
452 |
-
msgid "Backup Blog directorys"
|
453 |
-
msgstr ""
|
454 |
-
|
455 |
-
#: app/options-edit.php:76 app/options-jobs.php:63
|
456 |
-
msgid "Blog root and WP Files"
|
457 |
-
msgstr ""
|
458 |
-
|
459 |
-
#: app/options-edit.php:77 app/options-jobs.php:64
|
460 |
-
msgid "Blog Content"
|
461 |
-
msgstr ""
|
462 |
-
|
463 |
-
#: app/options-edit.php:78 app/options-jobs.php:65
|
464 |
-
msgid "Blog Plugins"
|
465 |
-
msgstr ""
|
466 |
-
|
467 |
-
#: app/options-edit.php:82
|
468 |
-
msgid "Include directorys"
|
469 |
msgstr ""
|
470 |
|
471 |
-
#: app/options-
|
472 |
-
|
|
|
|
|
473 |
msgstr ""
|
474 |
|
475 |
-
#: app/options-
|
476 |
-
|
|
|
477 |
msgstr ""
|
478 |
|
479 |
-
#: app/options-
|
480 |
-
msgid "
|
481 |
msgstr ""
|
482 |
|
483 |
-
#: app/options-
|
484 |
-
msgid "
|
485 |
msgstr ""
|
486 |
|
487 |
-
#: app/options-
|
488 |
msgid "Run Every:"
|
489 |
msgstr ""
|
490 |
|
491 |
-
#: app/options-
|
492 |
msgid "Min(s)"
|
493 |
msgstr ""
|
494 |
|
495 |
-
#: app/options-
|
496 |
-
msgid "
|
497 |
msgstr ""
|
498 |
|
499 |
-
#: app/options-
|
500 |
msgid "Day(s)"
|
501 |
msgstr ""
|
502 |
|
503 |
-
#: app/options-
|
504 |
-
msgid "Start Time:"
|
505 |
msgstr ""
|
506 |
|
507 |
-
#: app/options-
|
508 |
-
msgid "Start Date:"
|
509 |
-
msgstr ""
|
510 |
-
|
511 |
-
#: app/options-edit.php:130 app/options-jobs.php:117
|
512 |
msgid "January"
|
513 |
msgstr ""
|
514 |
|
515 |
-
#: app/options-
|
516 |
msgid "February"
|
517 |
msgstr ""
|
518 |
|
519 |
-
#: app/options-
|
520 |
msgid "March"
|
521 |
msgstr ""
|
522 |
|
523 |
-
#: app/options-
|
524 |
msgid "April"
|
525 |
msgstr ""
|
526 |
|
527 |
-
#: app/options-
|
528 |
msgid "May"
|
529 |
msgstr ""
|
530 |
|
531 |
-
#: app/options-
|
532 |
msgid "June"
|
533 |
msgstr ""
|
534 |
|
535 |
-
#: app/options-
|
536 |
msgid "July"
|
537 |
msgstr ""
|
538 |
|
539 |
-
#: app/options-
|
540 |
msgid "August"
|
541 |
msgstr ""
|
542 |
|
543 |
-
#: app/options-
|
544 |
msgid "September"
|
545 |
msgstr ""
|
546 |
|
547 |
-
#: app/options-
|
548 |
msgid "October"
|
549 |
msgstr ""
|
550 |
|
551 |
-
#: app/options-
|
552 |
msgid "November"
|
553 |
msgstr ""
|
554 |
|
555 |
-
#: app/options-
|
556 |
msgid "December"
|
557 |
msgstr ""
|
558 |
|
559 |
-
#: app/options-
|
560 |
-
msgid "
|
561 |
msgstr ""
|
562 |
|
563 |
-
#: app/options-
|
564 |
-
msgid "
|
565 |
msgstr ""
|
566 |
|
567 |
-
#: app/options-
|
568 |
-
msgid "
|
569 |
msgstr ""
|
570 |
|
571 |
-
#: app/options-
|
572 |
-
msgid "
|
573 |
msgstr ""
|
574 |
|
575 |
-
#: app/options-
|
576 |
-
|
577 |
-
msgid "0=off"
|
578 |
msgstr ""
|
579 |
|
580 |
-
#: app/options-
|
581 |
-
msgid "
|
582 |
msgstr ""
|
583 |
|
584 |
-
#: app/options-
|
585 |
-
msgid "
|
586 |
msgstr ""
|
587 |
|
588 |
-
#: app/options-
|
589 |
-
msgid "
|
590 |
msgstr ""
|
591 |
|
592 |
-
#: app/options-
|
593 |
-
msgid "
|
594 |
msgstr ""
|
595 |
|
596 |
-
#: app/options-
|
597 |
-
msgid "
|
598 |
msgstr ""
|
599 |
|
600 |
-
#: app/options-
|
601 |
-
msgid "
|
602 |
msgstr ""
|
603 |
|
604 |
-
#: app/options-
|
605 |
-
msgid "
|
606 |
msgstr ""
|
607 |
|
608 |
-
#: app/options-
|
609 |
-
msgid "
|
610 |
msgstr ""
|
611 |
|
612 |
-
#: app/options-
|
613 |
-
msgid "
|
614 |
msgstr ""
|
615 |
|
616 |
-
#: app/options-
|
617 |
-
msgid "
|
618 |
msgstr ""
|
619 |
|
620 |
-
#: app/options-
|
621 |
-
msgid "
|
622 |
msgstr ""
|
623 |
|
624 |
-
#: app/options-
|
625 |
-
|
626 |
-
msgid "Save Changes"
|
627 |
msgstr ""
|
628 |
|
629 |
-
#: app/options-jobs.php:
|
630 |
-
msgid "
|
631 |
msgstr ""
|
632 |
|
633 |
-
#: app/options-jobs.php:
|
634 |
-
msgid "
|
635 |
msgstr ""
|
636 |
|
637 |
-
#: app/options-jobs.php:
|
638 |
-
msgid "
|
639 |
msgstr ""
|
640 |
|
641 |
-
#: app/options-jobs.php:
|
642 |
-
msgid "
|
643 |
msgstr ""
|
644 |
|
645 |
-
#: app/options-jobs.php:
|
646 |
-
msgid "
|
647 |
msgstr ""
|
648 |
|
649 |
-
#: app/options-jobs.php:
|
650 |
-
|
|
|
651 |
msgstr ""
|
652 |
|
653 |
-
#: app/options-jobs.php:
|
654 |
-
msgid "
|
655 |
msgstr ""
|
656 |
|
657 |
-
#: app/options-jobs.php:
|
658 |
-
msgid "
|
659 |
msgstr ""
|
660 |
|
661 |
-
#: app/options-jobs.php:
|
662 |
-
msgid "
|
663 |
msgstr ""
|
664 |
|
665 |
-
#: app/options-jobs.php:
|
666 |
-
msgid "
|
667 |
msgstr ""
|
668 |
|
669 |
-
#: app/options-jobs.php:
|
670 |
-
msgid "
|
671 |
msgstr ""
|
672 |
|
673 |
-
#: app/options-
|
674 |
-
msgid "
|
675 |
msgstr ""
|
676 |
|
677 |
-
#: app/options-
|
678 |
-
|
679 |
-
#: app/options-view_log.php:10 app/options.php:10
|
680 |
-
msgid "Jobs"
|
681 |
msgstr ""
|
682 |
|
683 |
-
#: app/options-
|
684 |
-
|
685 |
-
#: app/options-view_log.php:11 app/options.php:11
|
686 |
-
msgid "Logs"
|
687 |
msgstr ""
|
688 |
|
689 |
-
#: app/options-
|
690 |
-
|
691 |
-
#: app/options-view_log.php:12 app/options.php:12
|
692 |
-
msgid "Tools"
|
693 |
msgstr ""
|
694 |
|
695 |
-
#: app/options-
|
696 |
-
|
697 |
-
msgid "Bulk Actions"
|
698 |
msgstr ""
|
699 |
|
700 |
-
#: app/options-
|
701 |
-
|
702 |
-
msgid "Delete"
|
703 |
msgstr ""
|
704 |
|
705 |
-
#: app/options-
|
706 |
-
|
707 |
-
msgid "Apply"
|
708 |
msgstr ""
|
709 |
|
710 |
-
#: app/options-
|
711 |
-
msgid "
|
712 |
msgstr ""
|
713 |
|
714 |
-
#: app/options-
|
715 |
-
|
716 |
-
msgid "Type"
|
717 |
msgstr ""
|
718 |
|
719 |
-
#: app/options-
|
720 |
-
msgid "
|
721 |
msgstr ""
|
722 |
|
723 |
-
#: app/options-logs.php:
|
724 |
-
msgid "
|
725 |
msgstr ""
|
726 |
|
727 |
-
#: app/options-logs.php:
|
728 |
-
|
|
|
|
|
729 |
msgstr ""
|
730 |
|
731 |
-
#: app/options-logs.php:
|
732 |
-
|
|
|
|
|
733 |
msgstr ""
|
734 |
|
735 |
-
#: app/options-logs.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
736 |
msgid "View log"
|
737 |
msgstr ""
|
738 |
|
739 |
-
#: app/options-logs.php:
|
740 |
msgid "View"
|
741 |
msgstr ""
|
742 |
|
743 |
-
#: app/options-logs.php:
|
744 |
-
msgid ""
|
745 |
-
"You are about to delete this Log and Backupfile. \n"
|
746 |
-
" 'Cancel' to stop, 'OK' to delete."
|
747 |
msgstr ""
|
748 |
|
749 |
-
#: app/options-logs.php:
|
750 |
-
msgid "Download"
|
751 |
msgstr ""
|
752 |
|
753 |
-
#: app/options-logs.php:
|
754 |
msgid "File not exists"
|
755 |
msgstr ""
|
756 |
|
757 |
-
#: app/options-logs.php:
|
758 |
msgid "only Log"
|
759 |
msgstr ""
|
760 |
|
|
|
|
|
|
|
|
|
761 |
#: app/options-runnow.php:8
|
762 |
msgid "BackWPup Job Running"
|
763 |
msgstr ""
|
@@ -774,212 +907,262 @@ msgstr ""
|
|
774 |
msgid "Job %1 deleted"
|
775 |
msgstr ""
|
776 |
|
777 |
-
#: app/options-save.php:
|
778 |
msgid "Logs deleted"
|
779 |
msgstr ""
|
780 |
|
781 |
-
#: app/options-save.php:
|
782 |
msgid "Log deleted"
|
783 |
msgstr ""
|
784 |
|
785 |
-
#: app/options-save.php:
|
786 |
msgid "Settings saved"
|
787 |
msgstr ""
|
788 |
|
789 |
-
#: app/options-save.php:
|
790 |
msgid "Copy of"
|
791 |
msgstr ""
|
792 |
|
793 |
-
#: app/options-save.php:
|
794 |
msgid "Job copied"
|
795 |
msgstr ""
|
796 |
|
797 |
-
#: app/options-save.php:
|
798 |
msgid "File does not exist."
|
799 |
msgstr ""
|
800 |
|
801 |
-
#: app/options-save.php:
|
802 |
-
msgid "Job %1
|
803 |
msgstr ""
|
804 |
|
805 |
#: app/options-settings.php:8
|
806 |
msgid "BackWPup Settings"
|
807 |
msgstr ""
|
808 |
|
809 |
-
#: app/options-settings.php:
|
810 |
-
msgid "
|
811 |
-
msgstr ""
|
812 |
-
|
813 |
-
#: app/options-settings.php:25
|
814 |
-
msgid "PHP.ini execution time:"
|
815 |
msgstr ""
|
816 |
|
817 |
-
#: app/options-settings.php:
|
818 |
-
msgid "
|
819 |
msgstr ""
|
820 |
|
821 |
-
#: app/options-settings.php:
|
822 |
-
msgid "
|
823 |
msgstr ""
|
824 |
|
825 |
#: app/options-settings.php:43
|
826 |
-
msgid "
|
827 |
msgstr ""
|
828 |
|
829 |
-
#: app/options-settings.php:
|
830 |
-
msgid "
|
831 |
msgstr ""
|
832 |
|
833 |
-
#: app/options-settings.php:
|
834 |
-
msgid "
|
835 |
msgstr ""
|
836 |
|
837 |
-
#: app/options-settings.php:
|
838 |
-
msgid "
|
839 |
msgstr ""
|
840 |
|
841 |
-
#: app/options-settings.php:
|
842 |
msgid "Send mail method:"
|
843 |
msgstr ""
|
844 |
|
845 |
-
#: app/options-settings.php:
|
846 |
msgid "PHP: mail()"
|
847 |
msgstr ""
|
848 |
|
849 |
-
#: app/options-settings.php:
|
850 |
msgid "Sendmail"
|
851 |
msgstr ""
|
852 |
|
853 |
-
#: app/options-settings.php:
|
854 |
msgid "SMTP"
|
855 |
msgstr ""
|
856 |
|
857 |
-
#: app/options-settings.php:
|
858 |
msgid "Sendmail Path:"
|
859 |
msgstr ""
|
860 |
|
861 |
-
#: app/options-settings.php:
|
862 |
msgid "SMTP Hostname:"
|
863 |
msgstr ""
|
864 |
|
865 |
-
#: app/options-settings.php:
|
866 |
msgid "SMTP Secure Connection:"
|
867 |
msgstr ""
|
868 |
|
869 |
-
#: app/options-settings.php:
|
870 |
msgid "SMTP Username:"
|
871 |
msgstr ""
|
872 |
|
873 |
-
#: app/options-settings.php:
|
874 |
msgid "SMTP Password:"
|
875 |
msgstr ""
|
876 |
|
877 |
-
#: app/options-settings.php:
|
878 |
-
msgid "
|
879 |
msgstr ""
|
880 |
|
881 |
-
#: app/options-settings.php:
|
882 |
-
msgid "
|
883 |
msgstr ""
|
884 |
|
885 |
-
#: app/options-settings.php:
|
886 |
-
msgid "Disable WP-Cron
|
887 |
msgstr ""
|
888 |
|
889 |
-
#: app/options-settings.php:
|
890 |
msgid "Use Cron job of Hoster and disable WP_Cron"
|
891 |
msgstr ""
|
892 |
|
893 |
-
#: app/options-settings.php:
|
894 |
msgid "You must set up a cron job that calls:"
|
895 |
msgstr ""
|
896 |
|
897 |
-
#: app/options-settings.php:
|
898 |
msgid "or URL:"
|
899 |
msgstr ""
|
900 |
|
|
|
|
|
|
|
|
|
901 |
#: app/options-tools.php:8
|
902 |
-
msgid "BackWPup
|
903 |
msgstr ""
|
904 |
|
905 |
-
#: app/options-tools.php:
|
906 |
-
msgid "
|
907 |
msgstr ""
|
908 |
|
909 |
-
#: app/options-
|
910 |
-
msgid "
|
911 |
msgstr ""
|
912 |
|
913 |
-
#: app/options.php:
|
914 |
-
msgid "
|
915 |
msgstr ""
|
916 |
|
917 |
-
#: app/options.php:
|
918 |
-
msgid "
|
919 |
msgstr ""
|
920 |
|
921 |
-
#: app/options.php:
|
922 |
-
msgid "
|
923 |
msgstr ""
|
924 |
|
925 |
-
#: app/options.php:
|
926 |
-
msgid "
|
927 |
msgstr ""
|
928 |
|
929 |
-
#: app/options.php:
|
930 |
-
msgid "
|
931 |
msgstr ""
|
932 |
|
933 |
-
#: app/options.php:
|
934 |
-
msgid "
|
935 |
msgstr ""
|
936 |
|
937 |
-
#: app/options.php:
|
938 |
-
msgid "
|
939 |
msgstr ""
|
940 |
|
941 |
-
#: app/options.php:
|
942 |
-
msgid ""
|
943 |
-
|
944 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
945 |
msgstr ""
|
946 |
|
947 |
-
#: app/options.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
948 |
msgid "Copy"
|
949 |
msgstr ""
|
950 |
|
951 |
-
#: app/options.php:
|
952 |
msgid "Run Now"
|
953 |
msgstr ""
|
954 |
|
955 |
-
#: app/options.php:
|
956 |
msgid "Inactive"
|
957 |
msgstr ""
|
958 |
|
959 |
-
#: app/options.php:
|
960 |
msgid "Runtime:"
|
961 |
msgstr ""
|
962 |
|
963 |
-
#: app/options.php:
|
964 |
msgid "None"
|
965 |
msgstr ""
|
966 |
|
967 |
-
#:
|
968 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
969 |
msgstr ""
|
970 |
|
971 |
-
#. Plugin URI of
|
972 |
msgid "http://danielhuesken.de/portfolio/backwpup/"
|
973 |
msgstr ""
|
974 |
|
975 |
-
#. Description of
|
976 |
msgid "Backup and more of your WordPress Blog Database and Files."
|
977 |
msgstr ""
|
978 |
|
979 |
-
#. Author of
|
980 |
msgid "Daniel Hüsken"
|
981 |
msgstr ""
|
982 |
|
983 |
-
#. Author URI of
|
984 |
msgid "http://danielhuesken.de"
|
985 |
msgstr ""
|
1 |
+
# Translation of the WordPress plugin BackWPup 1.0.0 by Daniel Hüsken.
|
2 |
+
# Copyright (C) 2010 Daniel Hüsken
|
3 |
+
# This file is distributed under the same license as the BackWPup package.
|
4 |
+
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
|
5 |
#
|
6 |
#, fuzzy
|
7 |
msgid ""
|
8 |
msgstr ""
|
9 |
+
"Project-Id-Version: BackWPup 1.0.0\n"
|
10 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/backwpup\n"
|
11 |
+
"POT-Creation-Date: 2010-06-23 17:08+0000\n"
|
12 |
+
"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
|
13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
15 |
"MIME-Version: 1.0\n"
|
16 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
17 |
"Content-Transfer-Encoding: 8bit\n"
|
18 |
|
19 |
+
#: app/backwpup_dojob.php:21
|
20 |
+
msgid "[WARNING]"
|
21 |
msgstr ""
|
22 |
|
23 |
+
#: app/backwpup_dojob.php:30
|
24 |
+
msgid "[ERROR]"
|
25 |
msgstr ""
|
26 |
|
27 |
+
#: app/backwpup_dojob.php:37
|
28 |
+
msgid "[DEPRECATED]"
|
|
|
29 |
msgstr ""
|
30 |
|
31 |
+
#: app/backwpup_dojob.php:41
|
32 |
+
msgid "[PARSING ERROR]"
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
#: app/backwpup_dojob.php:45
|
36 |
+
msgid "[STRICT NOTICE]"
|
37 |
msgstr ""
|
38 |
|
39 |
+
#: app/backwpup_dojob.php:49
|
40 |
+
msgid "[RECOVERABLE ERROR]"
|
|
|
|
|
41 |
msgstr ""
|
42 |
|
43 |
+
#: app/backwpup_dojob.php:172
|
44 |
#, php-format
|
45 |
+
msgid "BackWPup Log for %1$s from %2$s at %3$s"
|
46 |
msgstr ""
|
47 |
|
48 |
+
#: app/backwpup_dojob.php:185
|
49 |
+
#, php-format
|
50 |
+
msgid "PHP Safe Mode is on!!! Max exec time is %1$d sec."
|
51 |
+
msgstr ""
|
52 |
+
|
53 |
+
#: app/backwpup_dojob.php:192
|
54 |
#, php-format
|
55 |
msgid ""
|
56 |
"Memory limit set to %1$s ,because can not use PHP: memory_get_usage() "
|
57 |
+
"function to dynamicli increase the Memeory!"
|
58 |
msgstr ""
|
59 |
|
60 |
+
#: app/backwpup_dojob.php:241
|
61 |
#, php-format
|
62 |
+
msgid "Can not create Folder: %1$s"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
msgstr ""
|
64 |
|
65 |
+
#: app/backwpup_dojob.php:246
|
66 |
+
#, php-format
|
67 |
+
msgid "Can not write to Folder: %1$s"
|
68 |
msgstr ""
|
69 |
|
70 |
+
#: app/backwpup_dojob.php:286
|
71 |
+
#, php-format
|
72 |
+
msgid "PHP Safe Mode is on!!! Can not increase Memory Limit is %1$s"
|
73 |
msgstr ""
|
74 |
|
75 |
+
#: app/backwpup_dojob.php:291
|
76 |
+
#, php-format
|
77 |
+
msgid "Memory increased from %1$s to %2$s"
|
78 |
msgstr ""
|
79 |
|
80 |
+
#: app/backwpup_dojob.php:293
|
81 |
+
#, php-format
|
82 |
+
msgid "Can not increase Memory Limit is %1$s"
|
83 |
msgstr ""
|
84 |
|
85 |
+
#: app/backwpup_dojob.php:303
|
86 |
+
msgid "Set Blog to Maintenance Mode"
|
87 |
msgstr ""
|
88 |
|
89 |
+
#: app/backwpup_dojob.php:319
|
90 |
+
msgid "Set Blog to normal Mode"
|
91 |
msgstr ""
|
92 |
|
93 |
+
#: app/backwpup_dojob.php:335
|
94 |
+
msgid "Run Database check..."
|
95 |
msgstr ""
|
96 |
|
97 |
+
#: app/backwpup_dojob.php:354 app/backwpup_dojob.php:356
|
98 |
+
#: app/backwpup_dojob.php:358
|
99 |
#, php-format
|
100 |
msgid "Result of table check for %1$s is: %2$s"
|
101 |
msgstr ""
|
102 |
|
103 |
+
#: app/backwpup_dojob.php:361 app/backwpup_dojob.php:373
|
104 |
+
#: app/backwpup_dojob.php:397 app/backwpup_dojob.php:407
|
105 |
+
#: app/backwpup_dojob.php:448 app/backwpup_dojob.php:460
|
106 |
+
#: app/backwpup_dojob.php:564 app/tools/db_restore.php:63
|
107 |
#, php-format
|
108 |
msgid "BackWPup database error %1$s for query %2$s"
|
109 |
msgstr ""
|
110 |
|
111 |
+
#: app/backwpup_dojob.php:366 app/backwpup_dojob.php:368
|
112 |
+
#: app/backwpup_dojob.php:370
|
113 |
#, php-format
|
114 |
+
msgid "Result of table repair for %1$s is: %2$s"
|
115 |
msgstr ""
|
116 |
|
117 |
+
#: app/backwpup_dojob.php:378
|
118 |
msgid "Database check done!"
|
119 |
msgstr ""
|
120 |
|
121 |
+
#: app/backwpup_dojob.php:380
|
122 |
msgid "No Tables to check"
|
123 |
msgstr ""
|
124 |
|
125 |
+
#: app/backwpup_dojob.php:442
|
126 |
+
msgid "Run Database Dump to file..."
|
127 |
+
msgstr ""
|
128 |
+
|
129 |
+
#: app/backwpup_dojob.php:493
|
130 |
+
msgid "Dump Database table: "
|
131 |
+
msgstr ""
|
132 |
+
|
133 |
+
#: app/backwpup_dojob.php:509
|
134 |
+
msgid "Can not create Database Dump file"
|
135 |
+
msgstr ""
|
136 |
+
|
137 |
+
#: app/backwpup_dojob.php:512
|
138 |
+
msgid "No Tables to Dump"
|
139 |
+
msgstr ""
|
140 |
+
|
141 |
+
#: app/backwpup_dojob.php:515
|
142 |
+
msgid "Database Dump done!"
|
143 |
+
msgstr ""
|
144 |
+
|
145 |
+
#: app/backwpup_dojob.php:517
|
146 |
+
msgid "Add Database Dump to Backup:"
|
147 |
+
msgstr ""
|
148 |
+
|
149 |
+
#: app/backwpup_dojob.php:525
|
150 |
+
msgid "Run Wordpress Export to XML file..."
|
151 |
+
msgstr ""
|
152 |
+
|
153 |
+
#: app/backwpup_dojob.php:527
|
154 |
+
msgid "Export to XML done!"
|
155 |
+
msgstr ""
|
156 |
+
|
157 |
+
#: app/backwpup_dojob.php:529
|
158 |
+
msgid "Add XML Export to Backup:"
|
159 |
+
msgstr ""
|
160 |
+
|
161 |
+
#: app/backwpup_dojob.php:533
|
162 |
+
msgid "Can not Export to XML!"
|
163 |
+
msgstr ""
|
164 |
+
|
165 |
+
#: app/backwpup_dojob.php:540
|
166 |
+
msgid "Run Database optimize..."
|
167 |
+
msgstr ""
|
168 |
+
|
169 |
+
#: app/backwpup_dojob.php:557 app/backwpup_dojob.php:559
|
170 |
+
#: app/backwpup_dojob.php:561
|
171 |
+
#, php-format
|
172 |
+
msgid "Result of table optimize for %1$s is: %2$s"
|
173 |
+
msgstr ""
|
174 |
+
|
175 |
+
#: app/backwpup_dojob.php:567
|
176 |
+
msgid "Database optimize done!"
|
177 |
+
msgstr ""
|
178 |
+
|
179 |
+
#: app/backwpup_dojob.php:570
|
180 |
+
msgid "No Tables to optimize"
|
181 |
+
msgstr ""
|
182 |
+
|
183 |
+
#: app/backwpup_dojob.php:600
|
184 |
+
msgid "Can not read file:"
|
185 |
+
msgstr ""
|
186 |
+
|
187 |
+
#: app/backwpup_dojob.php:603
|
188 |
+
msgid "Is not a file or directory:"
|
189 |
+
msgstr ""
|
190 |
+
|
191 |
+
#: app/backwpup_dojob.php:612
|
192 |
+
msgid "Make a list of files to Backup ...."
|
193 |
msgstr ""
|
194 |
|
195 |
+
#: app/backwpup_dojob.php:647
|
196 |
+
msgid "No files to Backup"
|
197 |
+
msgstr ""
|
198 |
+
|
199 |
+
#: app/backwpup_dojob.php:649
|
200 |
+
msgid "Size off all files:"
|
201 |
+
msgstr ""
|
202 |
+
|
203 |
+
#: app/backwpup_dojob.php:657
|
204 |
+
msgid "Create Backup Zip file..."
|
205 |
msgstr ""
|
206 |
|
207 |
+
#: app/backwpup_dojob.php:662 app/backwpup_dojob.php:682
|
208 |
+
msgid "Add File to ZIP file:"
|
209 |
msgstr ""
|
210 |
|
211 |
+
#: app/backwpup_dojob.php:664
|
212 |
+
msgid "Can not add File to ZIP file:"
|
213 |
msgstr ""
|
214 |
|
215 |
+
#: app/backwpup_dojob.php:668 app/backwpup_dojob.php:688
|
216 |
+
msgid "Backup Zip file create done!"
|
217 |
msgstr ""
|
218 |
|
219 |
+
#: app/backwpup_dojob.php:670
|
220 |
+
msgid "Can not create Backup ZIP file:"
|
221 |
msgstr ""
|
222 |
|
223 |
+
#: app/backwpup_dojob.php:680
|
224 |
+
msgid "Create Backup Zip (PclZip) file..."
|
225 |
msgstr ""
|
226 |
|
227 |
+
#: app/backwpup_dojob.php:686
|
228 |
+
msgid "Zip file create:"
|
229 |
msgstr ""
|
230 |
|
231 |
+
#: app/backwpup_dojob.php:705
|
232 |
+
msgid "Can not create TAR Backup file"
|
233 |
msgstr ""
|
234 |
|
235 |
+
#: app/backwpup_dojob.php:708
|
236 |
+
msgid "Create Backup Archive file..."
|
237 |
+
msgstr ""
|
238 |
+
|
239 |
+
#: app/backwpup_dojob.php:714
|
240 |
+
msgid "Add File to Backup Archive:"
|
241 |
+
msgstr ""
|
242 |
+
|
243 |
+
#: app/backwpup_dojob.php:783
|
244 |
+
msgid "Backup Archive file create done!"
|
245 |
+
msgstr ""
|
246 |
+
|
247 |
+
#: app/backwpup_dojob.php:790 app/backwpup_dojob.php:792
|
248 |
+
#: app/backwpup_dojob.php:868 app/backwpup_dojob.php:874
|
249 |
msgid "FTP Client command:"
|
250 |
msgstr ""
|
251 |
|
252 |
+
#: app/backwpup_dojob.php:797
|
253 |
msgid "FTP Server Preliminary reply:"
|
254 |
msgstr ""
|
255 |
|
256 |
+
#: app/backwpup_dojob.php:800 app/backwpup_dojob.php:851
|
257 |
msgid "FTP Server Completion reply:"
|
258 |
msgstr ""
|
259 |
|
260 |
+
#: app/backwpup_dojob.php:803
|
261 |
msgid "FTP Server Intermediate reply:"
|
262 |
msgstr ""
|
263 |
|
264 |
+
#: app/backwpup_dojob.php:806 app/backwpup_dojob.php:809
|
265 |
+
#: app/backwpup_dojob.php:872 app/backwpup_dojob.php:876
|
266 |
msgid "FTP Server reply:"
|
267 |
msgstr ""
|
268 |
|
269 |
+
#: app/backwpup_dojob.php:833
|
|
|
|
|
|
|
|
|
270 |
msgid "Connected by SSL to FTP server:"
|
271 |
msgstr ""
|
272 |
|
273 |
+
#: app/backwpup_dojob.php:839
|
274 |
msgid "Connected insecure to FTP server:"
|
275 |
msgstr ""
|
276 |
|
277 |
+
#: app/backwpup_dojob.php:844
|
278 |
+
msgid "Can not connect to FTP server:"
|
279 |
+
msgstr ""
|
280 |
+
|
281 |
+
#: app/backwpup_dojob.php:870
|
282 |
+
msgid "Server Completion reply: 227 Entering Passive Mode"
|
283 |
+
msgstr ""
|
284 |
+
|
285 |
+
#: app/backwpup_dojob.php:872
|
286 |
+
msgid "Can not Entering Passive Mode"
|
287 |
+
msgstr ""
|
288 |
+
|
289 |
+
#: app/backwpup_dojob.php:884
|
290 |
+
msgid "FTP Dir on Server not exists!"
|
291 |
msgstr ""
|
292 |
|
293 |
+
#: app/backwpup_dojob.php:886
|
294 |
+
msgid "FTP Dir created!"
|
295 |
+
msgstr ""
|
296 |
+
|
297 |
+
#: app/backwpup_dojob.php:889
|
298 |
+
msgid "FTP Dir on Server can not created!"
|
299 |
+
msgstr ""
|
300 |
+
|
301 |
+
#: app/backwpup_dojob.php:895
|
302 |
msgid "Backup File transferred to FTP Server:"
|
303 |
msgstr ""
|
304 |
|
305 |
+
#: app/backwpup_dojob.php:897
|
306 |
msgid "Can not transfer backup to FTP server."
|
307 |
msgstr ""
|
308 |
|
309 |
+
#: app/backwpup_dojob.php:913
|
310 |
msgid "Can not delete file on FTP Server:"
|
311 |
msgstr ""
|
312 |
|
313 |
+
#: app/backwpup_dojob.php:916
|
314 |
msgid "files deleted on FTP Server:"
|
315 |
msgstr ""
|
316 |
|
317 |
+
#: app/backwpup_dojob.php:928
|
318 |
+
msgid "Prepare Sending backupfile with mail..."
|
319 |
msgstr ""
|
320 |
|
321 |
+
#: app/backwpup_dojob.php:931
|
322 |
+
msgid "No file to send!"
|
323 |
msgstr ""
|
324 |
|
325 |
+
#: app/backwpup_dojob.php:953
|
326 |
+
msgid "Send mail with SMTP"
|
327 |
msgstr ""
|
328 |
|
329 |
+
#: app/backwpup_dojob.php:957
|
330 |
+
msgid "Send mail with Sendmail"
|
331 |
+
msgstr ""
|
332 |
+
|
333 |
+
#: app/backwpup_dojob.php:960
|
334 |
+
msgid "Send mail with PHP mail"
|
335 |
+
msgstr ""
|
336 |
+
|
337 |
+
#: app/backwpup_dojob.php:964
|
338 |
+
msgid "Creating mail"
|
339 |
+
msgstr ""
|
340 |
+
|
341 |
+
#: app/backwpup_dojob.php:968
|
342 |
+
msgid "BackWPup File from"
|
343 |
+
msgstr ""
|
344 |
+
|
345 |
+
#: app/backwpup_dojob.php:976
|
346 |
msgid "Backup Archive too big for sending by mail"
|
347 |
msgstr ""
|
348 |
|
349 |
+
#: app/backwpup_dojob.php:981
|
350 |
+
msgid "Adding Attachment to mail"
|
351 |
+
msgstr ""
|
352 |
+
|
353 |
+
#: app/backwpup_dojob.php:985
|
354 |
+
msgid "Send mail...."
|
355 |
msgstr ""
|
356 |
|
357 |
+
#: app/backwpup_dojob.php:987
|
358 |
msgid "Mail send!!!"
|
359 |
msgstr ""
|
360 |
|
361 |
+
#: app/backwpup_dojob.php:989
|
362 |
msgid "Can not send mail:"
|
363 |
msgstr ""
|
364 |
|
365 |
+
#: app/backwpup_dojob.php:1003
|
366 |
+
msgid "Can not load curl extension is needed for S3!"
|
367 |
msgstr ""
|
368 |
|
369 |
+
#: app/backwpup_dojob.php:1012
|
370 |
+
msgid "Connected to S3 Bucket:"
|
371 |
msgstr ""
|
372 |
|
373 |
+
#: app/backwpup_dojob.php:1015
|
374 |
+
msgid "Backup File transferred to S3://"
|
375 |
msgstr ""
|
376 |
|
377 |
+
#: app/backwpup_dojob.php:1017
|
378 |
+
msgid "Can not transfer backup to S3."
|
379 |
msgstr ""
|
380 |
|
381 |
+
#: app/backwpup_dojob.php:1037
|
382 |
+
msgid "Can not delete file on S3//:"
|
383 |
msgstr ""
|
384 |
|
385 |
+
#: app/backwpup_dojob.php:1039
|
386 |
+
msgid "files deleted on S3 Bucket!"
|
387 |
msgstr ""
|
388 |
|
389 |
+
#: app/backwpup_dojob.php:1044
|
390 |
+
msgid "S3 Bucket not exists:"
|
391 |
msgstr ""
|
392 |
|
393 |
+
#: app/backwpup_dojob.php:1067
|
394 |
+
msgid "old backup files deleted!!!"
|
395 |
msgstr ""
|
396 |
|
397 |
+
#: app/backwpup_dojob.php:1076
|
398 |
+
#, php-format
|
399 |
+
msgid "Backup Archive File size is %1s"
|
400 |
msgstr ""
|
401 |
|
402 |
+
#: app/backwpup_dojob.php:1108
|
403 |
+
msgid "old Log files deleted!!!"
|
404 |
msgstr ""
|
405 |
|
406 |
+
#: app/backwpup_dojob.php:1117
|
407 |
+
#, php-format
|
408 |
+
msgid "Job done in %1s sec."
|
409 |
msgstr ""
|
410 |
|
411 |
+
#: app/backwpup_dojob.php:1144
|
412 |
+
msgid "Jobname:"
|
413 |
msgstr ""
|
414 |
|
415 |
+
#: app/backwpup_dojob.php:1145
|
416 |
+
msgid "Jobtype:"
|
417 |
msgstr ""
|
418 |
|
419 |
+
#: app/backwpup_dojob.php:1147
|
420 |
+
msgid "Errors:"
|
|
|
421 |
msgstr ""
|
422 |
|
423 |
+
#: app/backwpup_dojob.php:1149
|
424 |
+
msgid "Warnings:"
|
425 |
msgstr ""
|
426 |
|
427 |
+
#: app/backwpup_dojob.php:1150
|
428 |
+
msgid "BackWPup Log File from"
|
429 |
msgstr ""
|
430 |
|
431 |
+
#. #-#-#-#-# plugin.pot (BackWPup 1.0.0) #-#-#-#-#
|
432 |
+
#. Plugin Name of the plugin/theme
|
433 |
#: app/functions.php:8 app/options.php:8
|
434 |
msgid "BackWPup"
|
435 |
msgstr ""
|
436 |
|
437 |
+
#: app/functions.php:13
|
438 |
+
msgid "Job"
|
439 |
+
msgstr ""
|
440 |
+
|
441 |
+
#: app/functions.php:13 app/functions.php:26
|
442 |
+
msgid "Type"
|
443 |
+
msgstr ""
|
444 |
+
|
445 |
+
#: app/functions.php:13
|
446 |
+
msgid "Backup/Log Date/Time"
|
447 |
+
msgstr ""
|
448 |
+
|
449 |
+
#: app/functions.php:13
|
450 |
+
msgid "Status"
|
451 |
+
msgstr ""
|
452 |
+
|
453 |
+
#: app/functions.php:13
|
454 |
+
msgid "Size"
|
455 |
+
msgstr ""
|
456 |
+
|
457 |
+
#: app/functions.php:13
|
458 |
+
msgid "Runtime"
|
459 |
+
msgstr ""
|
460 |
+
|
461 |
+
#: app/functions.php:26
|
462 |
+
msgid "ID"
|
463 |
+
msgstr ""
|
464 |
+
|
465 |
+
#: app/functions.php:26
|
466 |
+
msgid "Job Name"
|
467 |
+
msgstr ""
|
468 |
+
|
469 |
+
#: app/functions.php:26
|
470 |
+
msgid "Next Run"
|
471 |
+
msgstr ""
|
472 |
+
|
473 |
+
#: app/functions.php:26
|
474 |
+
msgid "Last Run"
|
475 |
+
msgstr ""
|
476 |
+
|
477 |
+
#: app/functions.php:34 app/functions.php:165
|
478 |
msgid "Support"
|
479 |
msgstr ""
|
480 |
|
481 |
+
#: app/functions.php:35 app/functions.php:164
|
482 |
msgid "FAQ"
|
483 |
msgstr ""
|
484 |
|
485 |
+
#: app/functions.php:36
|
486 |
msgid "Plugin Homepage"
|
487 |
msgstr ""
|
488 |
|
489 |
+
#: app/functions.php:37
|
490 |
msgid "Plugin Home on WordPress.org"
|
491 |
msgstr ""
|
492 |
|
493 |
+
#: app/functions.php:38 app/functions.php:166
|
494 |
msgid "Donate"
|
495 |
msgstr ""
|
496 |
|
497 |
+
#: app/functions.php:41
|
498 |
msgid "Version:"
|
499 |
msgstr ""
|
500 |
|
501 |
+
#: app/functions.php:42
|
502 |
msgid "Author:"
|
503 |
msgstr ""
|
504 |
|
505 |
+
#: app/functions.php:156
|
506 |
msgid "Go to Settings Page"
|
507 |
msgstr ""
|
508 |
|
509 |
+
#: app/functions.php:156 app/options-logs.php:13 app/options-runnow.php:13
|
510 |
+
#: app/options-settings.php:13 app/options-tools.php:14
|
511 |
#: app/options-view_log.php:13 app/options.php:13
|
512 |
msgid "Settings"
|
513 |
msgstr ""
|
514 |
|
515 |
+
#: app/functions.php:177
|
516 |
msgid "BackWPup Job "
|
517 |
msgstr ""
|
518 |
|
519 |
+
#: app/functions.php:219
|
520 |
+
msgid "WP XML Export"
|
|
|
521 |
msgstr ""
|
522 |
|
523 |
+
#: app/functions.php:222
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
524 |
msgid "Database Backup"
|
525 |
msgstr ""
|
526 |
|
527 |
+
#: app/functions.php:225 app/options-jobs.php:176
|
528 |
msgid "File Backup"
|
529 |
msgstr ""
|
530 |
|
531 |
+
#: app/functions.php:228
|
532 |
msgid "Optimize Database Tables"
|
533 |
msgstr ""
|
534 |
|
535 |
+
#: app/functions.php:231
|
536 |
msgid "Check Database Tables"
|
537 |
msgstr ""
|
538 |
|
539 |
+
#: app/functions.php:275
|
540 |
msgid "Logs:"
|
541 |
msgstr ""
|
542 |
|
543 |
+
#: app/functions.php:291 app/options-view_log.php:17
|
544 |
msgid "View Log"
|
545 |
msgstr ""
|
546 |
|
547 |
+
#: app/functions.php:299 app/options-logs.php:116
|
548 |
msgid "ERROR(S)"
|
549 |
msgstr ""
|
550 |
|
551 |
+
#: app/functions.php:301 app/options-logs.php:118
|
552 |
msgid "WARNING(S)"
|
553 |
msgstr ""
|
554 |
|
555 |
+
#: app/functions.php:303 app/options-logs.php:120
|
556 |
msgid "OK"
|
557 |
msgstr ""
|
558 |
|
559 |
+
#: app/functions.php:311 app/functions.php:329 app/options-settings.php:67
|
560 |
msgid "none"
|
561 |
msgstr ""
|
562 |
|
563 |
+
#: app/functions.php:314
|
564 |
msgid "Scheduled Jobs:"
|
565 |
msgstr ""
|
566 |
|
567 |
+
#: app/functions.php:318
|
568 |
msgid "Edit Job"
|
569 |
msgstr ""
|
570 |
|
571 |
+
#: app/functions.php:321 app/options.php:98
|
572 |
msgid "Running since:"
|
573 |
msgstr ""
|
574 |
|
575 |
+
#: app/functions.php:321 app/options-logs.php:137 app/options.php:98
|
576 |
+
#: app/options.php:111
|
577 |
msgid "sec."
|
578 |
msgstr ""
|
579 |
|
580 |
+
#: app/options-jobs.php:8
|
581 |
+
msgid "BackWPup Job Settings"
|
582 |
msgstr ""
|
583 |
|
584 |
+
#: app/options-jobs.php:26
|
585 |
msgid "Job Type"
|
586 |
msgstr ""
|
587 |
|
588 |
+
#: app/options-jobs.php:38 app/options-logs.php:97 app/options.php:76
|
589 |
+
msgid ""
|
590 |
+
"You are about to delete this Job. \n"
|
591 |
+
" 'Cancel' to stop, 'OK' to delete."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
592 |
msgstr ""
|
593 |
|
594 |
+
#: app/options-jobs.php:38 app/options-logs.php:24 app/options-logs.php:97
|
595 |
+
#: app/options-logs.php:151 app/options.php:24 app/options.php:76
|
596 |
+
#: app/options.php:129
|
597 |
+
msgid "Delete"
|
598 |
msgstr ""
|
599 |
|
600 |
+
#: app/options-jobs.php:41 app/options-settings.php:25
|
601 |
+
#: app/options-settings.php:103
|
602 |
+
msgid "Save Changes"
|
603 |
msgstr ""
|
604 |
|
605 |
+
#: app/options-jobs.php:48
|
606 |
+
msgid "Job Schedule"
|
607 |
msgstr ""
|
608 |
|
609 |
+
#: app/options-jobs.php:50
|
610 |
+
msgid "Activate scheduling"
|
611 |
msgstr ""
|
612 |
|
613 |
+
#: app/options-jobs.php:52
|
614 |
msgid "Run Every:"
|
615 |
msgstr ""
|
616 |
|
617 |
+
#: app/options-jobs.php:61
|
618 |
msgid "Min(s)"
|
619 |
msgstr ""
|
620 |
|
621 |
+
#: app/options-jobs.php:62
|
622 |
+
msgid "Hour(s)"
|
623 |
msgstr ""
|
624 |
|
625 |
+
#: app/options-jobs.php:63
|
626 |
msgid "Day(s)"
|
627 |
msgstr ""
|
628 |
|
629 |
+
#: app/options-jobs.php:66
|
630 |
+
msgid "Start Date/Time:"
|
631 |
msgstr ""
|
632 |
|
633 |
+
#: app/options-jobs.php:75
|
|
|
|
|
|
|
|
|
634 |
msgid "January"
|
635 |
msgstr ""
|
636 |
|
637 |
+
#: app/options-jobs.php:75
|
638 |
msgid "February"
|
639 |
msgstr ""
|
640 |
|
641 |
+
#: app/options-jobs.php:75
|
642 |
msgid "March"
|
643 |
msgstr ""
|
644 |
|
645 |
+
#: app/options-jobs.php:75
|
646 |
msgid "April"
|
647 |
msgstr ""
|
648 |
|
649 |
+
#: app/options-jobs.php:75
|
650 |
msgid "May"
|
651 |
msgstr ""
|
652 |
|
653 |
+
#: app/options-jobs.php:75
|
654 |
msgid "June"
|
655 |
msgstr ""
|
656 |
|
657 |
+
#: app/options-jobs.php:75
|
658 |
msgid "July"
|
659 |
msgstr ""
|
660 |
|
661 |
+
#: app/options-jobs.php:75
|
662 |
msgid "August"
|
663 |
msgstr ""
|
664 |
|
665 |
+
#: app/options-jobs.php:75
|
666 |
msgid "September"
|
667 |
msgstr ""
|
668 |
|
669 |
+
#: app/options-jobs.php:75
|
670 |
msgid "October"
|
671 |
msgstr ""
|
672 |
|
673 |
+
#: app/options-jobs.php:75
|
674 |
msgid "November"
|
675 |
msgstr ""
|
676 |
|
677 |
+
#: app/options-jobs.php:75
|
678 |
msgid "December"
|
679 |
msgstr ""
|
680 |
|
681 |
+
#: app/options-jobs.php:106
|
682 |
+
msgid "Backup File Format"
|
683 |
msgstr ""
|
684 |
|
685 |
+
#: app/options-jobs.php:112
|
686 |
+
msgid "ZIP (.zip)"
|
687 |
msgstr ""
|
688 |
|
689 |
+
#: app/options-jobs.php:113
|
690 |
+
msgid "TAR (.tar)"
|
691 |
msgstr ""
|
692 |
|
693 |
+
#: app/options-jobs.php:115
|
694 |
+
msgid "TAR GZIP (.tar.gz)"
|
695 |
msgstr ""
|
696 |
|
697 |
+
#: app/options-jobs.php:117
|
698 |
+
msgid "TAR BZIP2 (.tar.bz2)"
|
|
|
699 |
msgstr ""
|
700 |
|
701 |
+
#: app/options-jobs.php:123
|
702 |
+
msgid "Send log"
|
703 |
msgstr ""
|
704 |
|
705 |
+
#: app/options-jobs.php:125 app/options-jobs.php:255
|
706 |
+
msgid "E-Mail-Adress:"
|
707 |
msgstr ""
|
708 |
|
709 |
+
#: app/options-jobs.php:132
|
710 |
+
msgid "Send only E-Mail on errors."
|
711 |
msgstr ""
|
712 |
|
713 |
+
#: app/options-jobs.php:144 app/options-jobs.php:145
|
714 |
+
msgid "Enter Job name here"
|
715 |
msgstr ""
|
716 |
|
717 |
+
#: app/options-jobs.php:150
|
718 |
+
msgid "Database Jobs"
|
719 |
msgstr ""
|
720 |
|
721 |
+
#: app/options-jobs.php:153
|
722 |
+
msgid "Database Tabels to Exclude:"
|
723 |
msgstr ""
|
724 |
|
725 |
+
#: app/options-jobs.php:171
|
726 |
+
msgid "Set Blog Maintenance Mode on Database Operations"
|
727 |
msgstr ""
|
728 |
|
729 |
+
#: app/options-jobs.php:178
|
730 |
+
msgid "Blog Folders to Backup:"
|
731 |
msgstr ""
|
732 |
|
733 |
+
#: app/options-jobs.php:188
|
734 |
+
msgid "Blog root and WP Files"
|
735 |
msgstr ""
|
736 |
|
737 |
+
#: app/options-jobs.php:189
|
738 |
+
msgid "Blog Content"
|
739 |
msgstr ""
|
740 |
|
741 |
+
#: app/options-jobs.php:190
|
742 |
+
msgid "Blog Plugins"
|
743 |
msgstr ""
|
744 |
|
745 |
+
#: app/options-jobs.php:192
|
746 |
+
msgid "Include Folders to Backup:"
|
|
|
747 |
msgstr ""
|
748 |
|
749 |
+
#: app/options-jobs.php:193 app/options-jobs.php:197
|
750 |
+
msgid "Example:"
|
751 |
msgstr ""
|
752 |
|
753 |
+
#: app/options-jobs.php:196
|
754 |
+
msgid "Exclude Files/Folders from Backup:"
|
755 |
msgstr ""
|
756 |
|
757 |
+
#: app/options-jobs.php:203
|
758 |
+
msgid "Backup to Directory"
|
759 |
msgstr ""
|
760 |
|
761 |
+
#: app/options-jobs.php:213
|
762 |
+
msgid "Full Path to Folder for Backup Files:"
|
763 |
msgstr ""
|
764 |
|
765 |
+
#: app/options-jobs.php:215
|
766 |
+
msgid "Max. Backup Files in Folder:"
|
767 |
msgstr ""
|
768 |
|
769 |
+
#: app/options-jobs.php:215 app/options-jobs.php:231 app/options-jobs.php:247
|
770 |
+
#: app/options-settings.php:83
|
771 |
+
msgid "(Oldest files will deleted first.)"
|
772 |
msgstr ""
|
773 |
|
774 |
+
#: app/options-jobs.php:220
|
775 |
+
msgid "Backup to FTP Server"
|
776 |
msgstr ""
|
777 |
|
778 |
+
#: app/options-jobs.php:222
|
779 |
+
msgid "Hostname:"
|
780 |
msgstr ""
|
781 |
|
782 |
+
#: app/options-jobs.php:224
|
783 |
+
msgid "Username:"
|
784 |
msgstr ""
|
785 |
|
786 |
+
#: app/options-jobs.php:226
|
787 |
+
msgid "Password:"
|
788 |
msgstr ""
|
789 |
|
790 |
+
#: app/options-jobs.php:228
|
791 |
+
msgid "Directory on Server:"
|
792 |
msgstr ""
|
793 |
|
794 |
+
#: app/options-jobs.php:231
|
795 |
+
msgid "Max. Backup Files in FTP Folder:"
|
796 |
msgstr ""
|
797 |
|
798 |
+
#: app/options-jobs.php:236
|
799 |
+
msgid "Backup to Amazon S3"
|
|
|
|
|
800 |
msgstr ""
|
801 |
|
802 |
+
#: app/options-jobs.php:238 app/options-tools.php:79
|
803 |
+
msgid "Access Key ID:"
|
|
|
|
|
804 |
msgstr ""
|
805 |
|
806 |
+
#: app/options-jobs.php:240 app/options-tools.php:80
|
807 |
+
msgid "Secret Access Key:"
|
|
|
|
|
808 |
msgstr ""
|
809 |
|
810 |
+
#: app/options-jobs.php:242
|
811 |
+
msgid "Bucket:"
|
|
|
812 |
msgstr ""
|
813 |
|
814 |
+
#: app/options-jobs.php:244
|
815 |
+
msgid "Directory in Bucket:"
|
|
|
816 |
msgstr ""
|
817 |
|
818 |
+
#: app/options-jobs.php:247
|
819 |
+
msgid "Max. Backup Files inn Bucket Folder:"
|
|
|
820 |
msgstr ""
|
821 |
|
822 |
+
#: app/options-jobs.php:248
|
823 |
+
msgid "Use SSL connection."
|
824 |
msgstr ""
|
825 |
|
826 |
+
#: app/options-jobs.php:253
|
827 |
+
msgid "Backup to E-Mail"
|
|
|
828 |
msgstr ""
|
829 |
|
830 |
+
#: app/options-jobs.php:258
|
831 |
+
msgid "Max. File Size for sending Backups with mail:"
|
832 |
msgstr ""
|
833 |
|
834 |
+
#: app/options-logs.php:8
|
835 |
+
msgid "BackWPup Logs"
|
836 |
msgstr ""
|
837 |
|
838 |
+
#: app/options-logs.php:10 app/options-runnow.php:10
|
839 |
+
#: app/options-settings.php:10 app/options-tools.php:11
|
840 |
+
#: app/options-view_log.php:10 app/options.php:10
|
841 |
+
msgid "Jobs"
|
842 |
msgstr ""
|
843 |
|
844 |
+
#: app/options-logs.php:11 app/options-runnow.php:11
|
845 |
+
#: app/options-settings.php:11 app/options-settings.php:78
|
846 |
+
#: app/options-tools.php:12 app/options-view_log.php:11 app/options.php:11
|
847 |
+
msgid "Logs"
|
848 |
msgstr ""
|
849 |
|
850 |
+
#: app/options-logs.php:12 app/options-runnow.php:12
|
851 |
+
#: app/options-settings.php:12 app/options-tools.php:13
|
852 |
+
#: app/options-view_log.php:12 app/options.php:12
|
853 |
+
msgid "Tools"
|
854 |
+
msgstr ""
|
855 |
+
|
856 |
+
#: app/options-logs.php:23 app/options-logs.php:150 app/options.php:23
|
857 |
+
#: app/options.php:128
|
858 |
+
msgid "Bulk Actions"
|
859 |
+
msgstr ""
|
860 |
+
|
861 |
+
#: app/options-logs.php:26 app/options-logs.php:153 app/options.php:26
|
862 |
+
#: app/options.php:131
|
863 |
+
msgid "Apply"
|
864 |
+
msgstr ""
|
865 |
+
|
866 |
+
#: app/options-logs.php:94
|
867 |
msgid "View log"
|
868 |
msgstr ""
|
869 |
|
870 |
+
#: app/options-logs.php:96
|
871 |
msgid "View"
|
872 |
msgstr ""
|
873 |
|
874 |
+
#: app/options-logs.php:98
|
875 |
+
msgid "Download Log"
|
|
|
|
|
876 |
msgstr ""
|
877 |
|
878 |
+
#: app/options-logs.php:100
|
879 |
+
msgid "Download Backup"
|
880 |
msgstr ""
|
881 |
|
882 |
+
#: app/options-logs.php:129
|
883 |
msgid "File not exists"
|
884 |
msgstr ""
|
885 |
|
886 |
+
#: app/options-logs.php:131
|
887 |
msgid "only Log"
|
888 |
msgstr ""
|
889 |
|
890 |
+
#: app/options-runnow-iframe.php:16
|
891 |
+
msgid "Do Job"
|
892 |
+
msgstr ""
|
893 |
+
|
894 |
#: app/options-runnow.php:8
|
895 |
msgid "BackWPup Job Running"
|
896 |
msgstr ""
|
907 |
msgid "Job %1 deleted"
|
908 |
msgstr ""
|
909 |
|
910 |
+
#: app/options-save.php:43
|
911 |
msgid "Logs deleted"
|
912 |
msgstr ""
|
913 |
|
914 |
+
#: app/options-save.php:48
|
915 |
msgid "Log deleted"
|
916 |
msgstr ""
|
917 |
|
918 |
+
#: app/options-save.php:69
|
919 |
msgid "Settings saved"
|
920 |
msgstr ""
|
921 |
|
922 |
+
#: app/options-save.php:82
|
923 |
msgid "Copy of"
|
924 |
msgstr ""
|
925 |
|
926 |
+
#: app/options-save.php:85
|
927 |
msgid "Job copied"
|
928 |
msgstr ""
|
929 |
|
930 |
+
#: app/options-save.php:103
|
931 |
msgid "File does not exist."
|
932 |
msgstr ""
|
933 |
|
934 |
+
#: app/options-save.php:166
|
935 |
+
msgid "Job '%1' changes saved"
|
936 |
msgstr ""
|
937 |
|
938 |
#: app/options-settings.php:8
|
939 |
msgid "BackWPup Settings"
|
940 |
msgstr ""
|
941 |
|
942 |
+
#: app/options-settings.php:32
|
943 |
+
msgid "Max Memory Usage"
|
|
|
|
|
|
|
|
|
944 |
msgstr ""
|
945 |
|
946 |
+
#: app/options-settings.php:35
|
947 |
+
msgid "PHP.ini Memory Limit:"
|
948 |
msgstr ""
|
949 |
|
950 |
+
#: app/options-settings.php:41
|
951 |
+
msgid "Set Memory limit:"
|
952 |
msgstr ""
|
953 |
|
954 |
#: app/options-settings.php:43
|
955 |
+
msgid "Memory will be automatically increased!!!"
|
956 |
msgstr ""
|
957 |
|
958 |
+
#: app/options-settings.php:50
|
959 |
+
msgid "Send Mail"
|
960 |
msgstr ""
|
961 |
|
962 |
+
#: app/options-settings.php:52
|
963 |
+
msgid "Sender Email:"
|
964 |
msgstr ""
|
965 |
|
966 |
+
#: app/options-settings.php:53
|
967 |
+
msgid "Sender Name:"
|
968 |
msgstr ""
|
969 |
|
970 |
+
#: app/options-settings.php:54
|
971 |
msgid "Send mail method:"
|
972 |
msgstr ""
|
973 |
|
974 |
+
#: app/options-settings.php:57
|
975 |
msgid "PHP: mail()"
|
976 |
msgstr ""
|
977 |
|
978 |
+
#: app/options-settings.php:58
|
979 |
msgid "Sendmail"
|
980 |
msgstr ""
|
981 |
|
982 |
+
#: app/options-settings.php:59
|
983 |
msgid "SMTP"
|
984 |
msgstr ""
|
985 |
|
986 |
+
#: app/options-settings.php:62
|
987 |
msgid "Sendmail Path:"
|
988 |
msgstr ""
|
989 |
|
990 |
+
#: app/options-settings.php:64
|
991 |
msgid "SMTP Hostname:"
|
992 |
msgstr ""
|
993 |
|
994 |
+
#: app/options-settings.php:65
|
995 |
msgid "SMTP Secure Connection:"
|
996 |
msgstr ""
|
997 |
|
998 |
+
#: app/options-settings.php:71
|
999 |
msgid "SMTP Username:"
|
1000 |
msgstr ""
|
1001 |
|
1002 |
+
#: app/options-settings.php:72
|
1003 |
msgid "SMTP Password:"
|
1004 |
msgstr ""
|
1005 |
|
1006 |
+
#: app/options-settings.php:80
|
1007 |
+
msgid "Log file Folder:"
|
1008 |
msgstr ""
|
1009 |
|
1010 |
+
#: app/options-settings.php:82
|
1011 |
+
msgid "Max. Log Files in Folder:"
|
1012 |
msgstr ""
|
1013 |
|
1014 |
+
#: app/options-settings.php:88
|
1015 |
+
msgid "Disable WP-Cron"
|
1016 |
msgstr ""
|
1017 |
|
1018 |
+
#: app/options-settings.php:90
|
1019 |
msgid "Use Cron job of Hoster and disable WP_Cron"
|
1020 |
msgstr ""
|
1021 |
|
1022 |
+
#: app/options-settings.php:91
|
1023 |
msgid "You must set up a cron job that calls:"
|
1024 |
msgstr ""
|
1025 |
|
1026 |
+
#: app/options-settings.php:93
|
1027 |
msgid "or URL:"
|
1028 |
msgstr ""
|
1029 |
|
1030 |
+
#: app/options-settings.php:98
|
1031 |
+
msgid "Temp Folder"
|
1032 |
+
msgstr ""
|
1033 |
+
|
1034 |
#: app/options-tools.php:8
|
1035 |
+
msgid "BackWPup Tools"
|
1036 |
msgstr ""
|
1037 |
|
1038 |
+
#: app/options-tools.php:34
|
1039 |
+
msgid "Database restore"
|
1040 |
msgstr ""
|
1041 |
|
1042 |
+
#: app/options-tools.php:37 app/options-tools.php:55
|
1043 |
+
msgid "Restore"
|
1044 |
msgstr ""
|
1045 |
|
1046 |
+
#: app/options-tools.php:52
|
1047 |
+
msgid "SQL File to restore:"
|
1048 |
msgstr ""
|
1049 |
|
1050 |
+
#: app/options-tools.php:58
|
1051 |
+
msgid "Copy SQL file to Blog root folder to use restore."
|
1052 |
msgstr ""
|
1053 |
|
1054 |
+
#: app/options-tools.php:66
|
1055 |
+
msgid "Create Amazon S3 Bucket"
|
1056 |
msgstr ""
|
1057 |
|
1058 |
+
#: app/options-tools.php:69 app/options-tools.php:83
|
1059 |
+
msgid "Create"
|
1060 |
msgstr ""
|
1061 |
|
1062 |
+
#: app/options-tools.php:73
|
1063 |
+
msgid "Amazone S3 Bucket created."
|
1064 |
msgstr ""
|
1065 |
|
1066 |
+
#: app/options-tools.php:75
|
1067 |
+
msgid "Can not create Amazon S3 Bucket."
|
1068 |
msgstr ""
|
1069 |
|
1070 |
+
#: app/options-tools.php:81
|
1071 |
+
msgid "Bucket Name:"
|
1072 |
msgstr ""
|
1073 |
|
1074 |
+
#: app/options-tools.php:82
|
1075 |
+
msgid "Bucket Region:"
|
1076 |
+
msgstr ""
|
1077 |
+
|
1078 |
+
#: app/options-tools.php:82
|
1079 |
+
msgid "US"
|
1080 |
+
msgstr ""
|
1081 |
+
|
1082 |
+
#: app/options-tools.php:82
|
1083 |
+
msgid "Europe"
|
1084 |
+
msgstr ""
|
1085 |
+
|
1086 |
+
#: app/options-view_log.php:8
|
1087 |
+
msgid "BackWPup View Log"
|
1088 |
msgstr ""
|
1089 |
|
1090 |
+
#: app/options.php:8
|
1091 |
+
msgid "Add New"
|
1092 |
+
msgstr ""
|
1093 |
+
|
1094 |
+
#: app/options.php:72
|
1095 |
+
msgid "Edit:"
|
1096 |
+
msgstr ""
|
1097 |
+
|
1098 |
+
#: app/options.php:74
|
1099 |
+
msgid "Edit"
|
1100 |
+
msgstr ""
|
1101 |
+
|
1102 |
+
#: app/options.php:75
|
1103 |
msgid "Copy"
|
1104 |
msgstr ""
|
1105 |
|
1106 |
+
#: app/options.php:77
|
1107 |
msgid "Run Now"
|
1108 |
msgstr ""
|
1109 |
|
1110 |
+
#: app/options.php:102
|
1111 |
msgid "Inactive"
|
1112 |
msgstr ""
|
1113 |
|
1114 |
+
#: app/options.php:111
|
1115 |
msgid "Runtime:"
|
1116 |
msgstr ""
|
1117 |
|
1118 |
+
#: app/options.php:113
|
1119 |
msgid "None"
|
1120 |
msgstr ""
|
1121 |
|
1122 |
+
#: app/tools/db_restore.php:29 app/tools/db_restore.php:48
|
1123 |
+
#: app/tools/db_restore.php:63
|
1124 |
+
msgid "ERROR:"
|
1125 |
+
msgstr ""
|
1126 |
+
|
1127 |
+
#: app/tools/db_restore.php:29
|
1128 |
+
#, php-format
|
1129 |
+
msgid "Pleace set <i>$table_prefix = '%1$s';</i> in wp-config.php"
|
1130 |
+
msgstr ""
|
1131 |
+
|
1132 |
+
#: app/tools/db_restore.php:48
|
1133 |
+
#, php-format
|
1134 |
+
msgid "Pleace set <i>define('DB_CHARSET', '%1$s');</i> in wp-config.php"
|
1135 |
+
msgstr ""
|
1136 |
+
|
1137 |
+
#: app/tools/db_restore.php:69
|
1138 |
+
#, php-format
|
1139 |
+
msgid "%1$s Database Querys done."
|
1140 |
+
msgstr ""
|
1141 |
+
|
1142 |
+
#: app/tools/db_restore.php:70
|
1143 |
+
msgid "Make changes for Blogurl and ABSPATH if needed."
|
1144 |
+
msgstr ""
|
1145 |
+
|
1146 |
+
#: app/tools/db_restore.php:79
|
1147 |
+
msgid "Restore Done. Please delete the SQL file after Restore."
|
1148 |
+
msgstr ""
|
1149 |
+
|
1150 |
+
#: backwpup.php:53
|
1151 |
+
msgid "Sorry, BackWPup works only with WordPress 2.8 and PHP 5 or heigher!!!"
|
1152 |
msgstr ""
|
1153 |
|
1154 |
+
#. Plugin URI of the plugin/theme
|
1155 |
msgid "http://danielhuesken.de/portfolio/backwpup/"
|
1156 |
msgstr ""
|
1157 |
|
1158 |
+
#. Description of the plugin/theme
|
1159 |
msgid "Backup and more of your WordPress Blog Database and Files."
|
1160 |
msgstr ""
|
1161 |
|
1162 |
+
#. Author of the plugin/theme
|
1163 |
msgid "Daniel Hüsken"
|
1164 |
msgstr ""
|
1165 |
|
1166 |
+
#. Author URI of the plugin/theme
|
1167 |
msgid "http://danielhuesken.de"
|
1168 |
msgstr ""
|
readme.txt
CHANGED
@@ -1,25 +1,23 @@
|
|
1 |
=== BackWPup ===
|
2 |
Contributors: danielhuesken
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=daniel%40huesken-net%2ede&item_name=Daniel%20Huesken%20Plugin%20Donation&item_number=BackWPup&no_shipping=0&no_note=1&tax=0¤cy_code=EUR&lc=DE&bn=PP%2dDonationsBF&charset=UTF%2d8
|
4 |
-
Tags: backup, admin, file, Database, mysql, cron, ftp, S3
|
5 |
Requires at least: 2.8
|
6 |
Tested up to: 3.0.0
|
7 |
-
Stable tag: 0.
|
8 |
|
9 |
Backup and more of your WordPress Blog Database and Files
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
This Plugin is under heavy Development. Please test it and give feedback!!!.
|
14 |
-
Plugin Requires PHP 5.
|
15 |
-
|
16 |
Backup and more your Blog.
|
17 |
|
18 |
* Database Backup
|
|
|
19 |
* Optimize Database
|
20 |
* Check\Repair Database
|
21 |
* File Backup
|
22 |
-
*
|
23 |
* Store backup to Folder
|
24 |
* Store backup to FTP Server
|
25 |
* Store backup to Amazon S3
|
@@ -28,6 +26,7 @@ Backup and more your Blog.
|
|
28 |
|
29 |
I can give no WARRANTY to any backups...
|
30 |
|
|
|
31 |
== Installation ==
|
32 |
|
33 |
1. Download BackWPup Plugin.
|
@@ -35,17 +34,64 @@ I can give no WARRANTY to any backups...
|
|
35 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
36 |
|
37 |
== Frequently Asked Questions ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
-
=
|
|
|
|
|
|
|
|
|
40 |
|
41 |
-
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
== Screenshots ==
|
45 |
|
46 |
1. Job Page
|
47 |
|
48 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
= 0.8.1 =
|
50 |
* use global var instat of constant for log file
|
51 |
* PCL Zip Trace included with setting for log Level
|
1 |
=== BackWPup ===
|
2 |
Contributors: danielhuesken
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=daniel%40huesken-net%2ede&item_name=Daniel%20Huesken%20Plugin%20Donation&item_number=BackWPup&no_shipping=0&no_note=1&tax=0¤cy_code=EUR&lc=DE&bn=PP%2dDonationsBF&charset=UTF%2d8
|
4 |
+
Tags: backup, admin, file, Database, mysql, cron, ftp, S3, export
|
5 |
Requires at least: 2.8
|
6 |
Tested up to: 3.0.0
|
7 |
+
Stable tag: 1.0.0
|
8 |
|
9 |
Backup and more of your WordPress Blog Database and Files
|
10 |
|
11 |
== Description ==
|
12 |
|
|
|
|
|
|
|
13 |
Backup and more your Blog.
|
14 |
|
15 |
* Database Backup
|
16 |
+
* Wordpress XML Export
|
17 |
* Optimize Database
|
18 |
* Check\Repair Database
|
19 |
* File Backup
|
20 |
+
* Backups in zip,tar,tar.gz,tar.bz2 formart
|
21 |
* Store backup to Folder
|
22 |
* Store backup to FTP Server
|
23 |
* Store backup to Amazon S3
|
26 |
|
27 |
I can give no WARRANTY to any backups...
|
28 |
|
29 |
+
|
30 |
== Installation ==
|
31 |
|
32 |
1. Download BackWPup Plugin.
|
34 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
35 |
|
36 |
== Frequently Asked Questions ==
|
37 |
+
= Requires =
|
38 |
+
* PHP 5
|
39 |
+
* Wordpress 2.8
|
40 |
+
* curl (for Amazon S3 Support)
|
41 |
+
* gzip (for PCLZIP and gzip archives)
|
42 |
+
* bzip2 (for bzip2 archives)
|
43 |
+
|
44 |
+
= Where is the Database dump File =
|
45 |
+
in the root folder of the Archive. <i>DBName</i>.sql
|
46 |
+
|
47 |
+
= Where is the Wordpress Export File =
|
48 |
+
in the root folder of the Archive. wordpress.<i>jjjj-mm-dd</i>.xml
|
49 |
+
|
50 |
+
= Zip File Support =
|
51 |
+
Plugin use PCLZIP lib if not php uses zip extension
|
52 |
|
53 |
+
= Mantinance Mode =
|
54 |
+
Supported Plugins
|
55 |
+
* maintenance-mode
|
56 |
+
* wp-maintenance-mode
|
57 |
+
* Wordpress .mantinance file
|
58 |
|
59 |
+
if your blog do not come back from Mantinace Mode switsh back from Mantinace Mode by changing the Plugin options or delete the <i>.mantinance</i> file in blog root folder.
|
60 |
|
61 |
+
= Retore a Blog DataBase =
|
62 |
+
Copy the <i>DBName</i>.sql in the root folder of the blog and go to the tools tab in the plugin.
|
63 |
+
You kann use PHPMyAdmin also.
|
64 |
+
|
65 |
+
= Abnormal Script aborts =
|
66 |
+
Webserver normaly abort Scrips that works longer then 300s.
|
67 |
+
PHP normaly abort Script that works langen then 30s but the plugin try too switch off the arbotion.
|
68 |
+
|
69 |
+
= Memory usage =
|
70 |
+
* The Plugin is coded to use low memory
|
71 |
+
* The Plugin will try to increase Memory automaticly if needed
|
72 |
+
* PCLZIP lib need 8MB free Memeory for ziping
|
73 |
+
* Mail a archive need many Memory
|
74 |
+
|
75 |
+
= Mail achives =
|
76 |
+
I have build in many options to Optimize the Mailing but the mailing lib uses high Memory.
|
77 |
+
Pleace mail only littele archives
|
78 |
|
79 |
== Screenshots ==
|
80 |
|
81 |
1. Job Page
|
82 |
|
83 |
== Changelog ==
|
84 |
+
= 1.0.0 =
|
85 |
+
* now Worpress Exports to XML can made
|
86 |
+
* new backup files formats tar, tar.gz, tar.bz2
|
87 |
+
* all job types can made in one job
|
88 |
+
* added php zip extension support (use pclzip only if not supported)
|
89 |
+
* removed PclZip trace code
|
90 |
+
* fixed time display and schedule bugs
|
91 |
+
* added some security
|
92 |
+
* Mantinance Mode on MySQL Operations
|
93 |
+
* new Design on some Pages
|
94 |
+
|
95 |
= 0.8.1 =
|
96 |
* use global var instat of constant for log file
|
97 |
* PCL Zip Trace included with setting for log Level
|