Completed
Push — master ( 0881bb...3a6ebc )
by Michael
04:47
created
xoops_trust_path/libs/altsys/include/autoupdate_from_d3module.inc.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,33 +1,33 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (! $xoopsConfig['theme_fromfile']) {
4
-    return ;
3
+if (!$xoopsConfig['theme_fromfile']) {
4
+    return;
5 5
 }
6 6
 
7 7
 // templates/ under modules
8 8
 // $tplsadmin_autoupdate_path = XOOPS_THEME_PATH . '/' . $xoopsConfig['theme_set'] . '/templates' ;
9 9
 
10
-if (! is_array(@$tplsadmin_autoupdate_mydirnames)) {
11
-    return ;
10
+if (!is_array(@$tplsadmin_autoupdate_mydirnames)) {
11
+    return;
12 12
 }
13 13
 
14 14
 foreach ($tplsadmin_autoupdate_mydirnames as $tplsadmin_mydirname) {
15
-    $tplsadmin_mydirname = preg_replace('/[^a-zA-Z0-9_-]/', '', $tplsadmin_mydirname) ;
16
-    require XOOPS_ROOT_PATH . '/modules/' . $tplsadmin_mydirname . '/mytrustdirname.php' ;
17
-    $altsys_mid_path = $mytrustdirname == 'altsys' ? '/libs/' : '/modules/' ;
18
-    $tplsadmin_autoupdate_path = XOOPS_TRUST_PATH . $altsys_mid_path . $mytrustdirname . '/templates' ;
15
+    $tplsadmin_mydirname = preg_replace('/[^a-zA-Z0-9_-]/', '', $tplsadmin_mydirname);
16
+    require XOOPS_ROOT_PATH.'/modules/'.$tplsadmin_mydirname.'/mytrustdirname.php';
17
+    $altsys_mid_path = $mytrustdirname == 'altsys' ? '/libs/' : '/modules/';
18
+    $tplsadmin_autoupdate_path = XOOPS_TRUST_PATH.$altsys_mid_path.$mytrustdirname.'/templates';
19 19
 
20 20
     // modules
21
-    if ($handler = @opendir($tplsadmin_autoupdate_path . '/')) {
21
+    if ($handler = @opendir($tplsadmin_autoupdate_path.'/')) {
22 22
         while (($file = readdir($handler)) !== false) {
23
-            $file_path = $tplsadmin_autoupdate_path . '/' . $file ;
23
+            $file_path = $tplsadmin_autoupdate_path.'/'.$file;
24 24
             if (is_file($file_path)) {
25 25
                 $mtime = (int)(@filemtime($file_path));
26
-                $tpl_file = $tplsadmin_mydirname . '_' . $file ;
27
-                list($count) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($xoopsConfig['template_set']) . "' AND tpl_file='" . addslashes($tpl_file) . "' AND tpl_lastmodified >= $mtime")) ;
26
+                $tpl_file = $tplsadmin_mydirname.'_'.$file;
27
+                list($count) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM '.$xoopsDB->prefix('tplfile')." WHERE tpl_tplset='".addslashes($xoopsConfig['template_set'])."' AND tpl_file='".addslashes($tpl_file)."' AND tpl_lastmodified >= $mtime"));
28 28
                 if ($count <= 0) {
29
-                    include_once XOOPS_TRUST_PATH.'/libs/altsys/include/tpls_functions.php' ;
30
-                    tplsadmin_import_data($xoopsConfig['template_set'], $tpl_file, implode('', file($file_path)), $mtime) ;
29
+                    include_once XOOPS_TRUST_PATH.'/libs/altsys/include/tpls_functions.php';
30
+                    tplsadmin_import_data($xoopsConfig['template_set'], $tpl_file, implode('', file($file_path)), $mtime);
31 31
                 }
32 32
             }
33 33
         }
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/include/gtickets.php 1 patch
Spacing   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -2,147 +2,147 @@  discard block
 block discarded – undo
2 2
 // GIJOE's Ticket Class (based on Marijuana's Oreteki XOOPS)
3 3
 // nobunobu's suggestions are applied
4 4
 
5
-if (! class_exists('XoopsGTicket')) {
5
+if (!class_exists('XoopsGTicket')) {
6 6
     class XoopsGTicket
7 7
     {
8 8
 
9
-        public $_errors = array() ;
10
-        public $_latest_token = '' ;
11
-        public $messages = array() ;
9
+        public $_errors = array();
10
+        public $_latest_token = '';
11
+        public $messages = array();
12 12
 
13 13
         public function __construct()
14 14
         {
15
-            global $xoopsConfig ;
15
+            global $xoopsConfig;
16 16
 
17 17
         // language file
18
-        if (defined('XOOPS_ROOT_PATH') && ! empty($xoopsConfig['language']) && ! strstr($xoopsConfig['language'], '/')) {
19
-            if (file_exists(dirname(__DIR__) . '/language/' . $xoopsConfig['language'] . '/gticket_messages.phtml')) {
20
-                include dirname(__DIR__) . '/language/' . $xoopsConfig['language'] . '/gticket_messages.phtml' ;
18
+        if (defined('XOOPS_ROOT_PATH') && !empty($xoopsConfig['language']) && !strstr($xoopsConfig['language'], '/')) {
19
+            if (file_exists(dirname(__DIR__).'/language/'.$xoopsConfig['language'].'/gticket_messages.phtml')) {
20
+                include dirname(__DIR__).'/language/'.$xoopsConfig['language'].'/gticket_messages.phtml';
21 21
             }
22 22
         }
23 23
 
24 24
         // default messages
25 25
         if (empty($this->messages)) {
26 26
             $this->messages = array(
27
-            'err_general' => 'GTicket Error' ,
28
-            'err_nostubs' => 'No stubs found' ,
29
-            'err_noticket' => 'No ticket found' ,
30
-            'err_nopair' => 'No valid ticket-stub pair found' ,
31
-            'err_timeout' => 'Time out' ,
32
-            'err_areaorref' => 'Invalid area or referer' ,
33
-            'fmt_prompt4repost' => 'error(s) found:<br /><span style="background-color:red;font-weight:bold;color:white;">%s</span><br />Confirm it.<br />And do you want to post again?' ,
27
+            'err_general' => 'GTicket Error',
28
+            'err_nostubs' => 'No stubs found',
29
+            'err_noticket' => 'No ticket found',
30
+            'err_nopair' => 'No valid ticket-stub pair found',
31
+            'err_timeout' => 'Time out',
32
+            'err_areaorref' => 'Invalid area or referer',
33
+            'fmt_prompt4repost' => 'error(s) found:<br /><span style="background-color:red;font-weight:bold;color:white;">%s</span><br />Confirm it.<br />And do you want to post again?',
34 34
             'btn_repost' => 'repost'
35
-        ) ;
35
+        );
36 36
         }
37 37
         }
38 38
 
39 39
     // render form as plain html
40 40
     public function getTicketHtml($salt = '', $timeout = 1800, $area = '')
41 41
     {
42
-        return '<input type="hidden" name="XOOPS_G_TICKET" value="'.$this->issue($salt, $timeout, $area).'" />' ;
42
+        return '<input type="hidden" name="XOOPS_G_TICKET" value="'.$this->issue($salt, $timeout, $area).'" />';
43 43
     }
44 44
 
45 45
     // returns an object of XoopsFormHidden including theh ticket
46 46
     public function getTicketXoopsForm($salt = '', $timeout = 1800, $area = '')
47 47
     {
48
-        return new XoopsFormHidden('XOOPS_G_TICKET', $this->issue($salt, $timeout, $area)) ;
48
+        return new XoopsFormHidden('XOOPS_G_TICKET', $this->issue($salt, $timeout, $area));
49 49
     }
50 50
 
51 51
     // add a ticket as Hidden Element into XoopsForm
52 52
     public function addTicketXoopsFormElement(&$form, $salt = '', $timeout = 1800, $area = '')
53 53
     {
54
-        $form->addElement(new XoopsFormHidden('XOOPS_G_TICKET', $this->issue($salt, $timeout, $area))) ;
54
+        $form->addElement(new XoopsFormHidden('XOOPS_G_TICKET', $this->issue($salt, $timeout, $area)));
55 55
     }
56 56
 
57 57
     // returns an array for xoops_confirm() ;
58 58
     public function getTicketArray($salt = '', $timeout = 1800, $area = '')
59 59
     {
60
-        return array( 'XOOPS_G_TICKET' => $this->issue($salt, $timeout, $area) ) ;
60
+        return array('XOOPS_G_TICKET' => $this->issue($salt, $timeout, $area));
61 61
     }
62 62
 
63 63
     // return GET parameter string.
64
-    public function getTicketParamString($salt = '', $noamp = false, $timeout=1800, $area = '')
64
+    public function getTicketParamString($salt = '', $noamp = false, $timeout = 1800, $area = '')
65 65
     {
66
-        return ($noamp ? '' : '&amp;') . 'XOOPS_G_TICKET=' . $this->issue($salt, $timeout, $area) ;
66
+        return ($noamp ? '' : '&amp;').'XOOPS_G_TICKET='.$this->issue($salt, $timeout, $area);
67 67
     }
68 68
 
69 69
     // issue a ticket
70 70
     public function issue($salt = '', $timeout = 1800, $area = '')
71 71
     {
72
-        global $xoopsModule ;
72
+        global $xoopsModule;
73 73
 
74 74
         // create a token
75
-        list($usec, $sec) = explode(' ', microtime()) ;
76
-        $appendix_salt = empty($_SERVER['PATH']) ? XOOPS_DB_NAME : $_SERVER['PATH'] ;
77
-        $token = crypt($salt . $usec . $appendix_salt . $sec, XOOPS_DB_PREFIX) ;
78
-        $this->_latest_token = $token ;
75
+        list($usec, $sec) = explode(' ', microtime());
76
+        $appendix_salt = empty($_SERVER['PATH']) ? XOOPS_DB_NAME : $_SERVER['PATH'];
77
+        $token = crypt($salt.$usec.$appendix_salt.$sec, XOOPS_DB_PREFIX);
78
+        $this->_latest_token = $token;
79 79
 
80 80
         if (empty($_SESSION['XOOPS_G_STUBS'])) {
81
-            $_SESSION['XOOPS_G_STUBS'] = array() ;
81
+            $_SESSION['XOOPS_G_STUBS'] = array();
82 82
         }
83 83
 
84 84
         // limit max stubs 10
85 85
         if (count($_SESSION['XOOPS_G_STUBS']) > 10) {
86
-            $_SESSION['XOOPS_G_STUBS'] = array_slice($_SESSION['XOOPS_G_STUBS'], -10) ;
86
+            $_SESSION['XOOPS_G_STUBS'] = array_slice($_SESSION['XOOPS_G_STUBS'], -10);
87 87
         }
88 88
 
89 89
         // record referer if browser send it
90
-        $referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['REQUEST_URI'] ;
90
+        $referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['REQUEST_URI'];
91 91
 
92 92
         // area as module's dirname
93
-        if (! $area && is_object(@$xoopsModule)) {
94
-            $area = $xoopsModule->getVar('dirname') ;
93
+        if (!$area && is_object(@$xoopsModule)) {
94
+            $area = $xoopsModule->getVar('dirname');
95 95
         }
96 96
 
97 97
         // store stub
98 98
         $_SESSION['XOOPS_G_STUBS'][] = array(
99
-            'expire' => time() + $timeout ,
100
-            'referer' => $referer ,
101
-            'area' => $area ,
99
+            'expire' => time() + $timeout,
100
+            'referer' => $referer,
101
+            'area' => $area,
102 102
             'token' => $token
103
-        ) ;
103
+        );
104 104
 
105 105
         // paid md5ed token as a ticket
106
-        return md5($token . XOOPS_DB_PREFIX) ;
106
+        return md5($token.XOOPS_DB_PREFIX);
107 107
     }
108 108
 
109 109
     // check a ticket
110 110
     public function check($post = true, $area = '', $allow_repost = true)
111 111
     {
112
-        global $xoopsModule ;
112
+        global $xoopsModule;
113 113
 
114
-        $this->_errors = array() ;
114
+        $this->_errors = array();
115 115
 
116 116
         // CHECK: stubs are not stored in session
117
-        if (! is_array(@$_SESSION['XOOPS_G_STUBS'])) {
118
-            $this->_errors[] = $this->messages['err_nostubs'] ;
119
-            $_SESSION['XOOPS_G_STUBS'] = array() ;
117
+        if (!is_array(@$_SESSION['XOOPS_G_STUBS'])) {
118
+            $this->_errors[] = $this->messages['err_nostubs'];
119
+            $_SESSION['XOOPS_G_STUBS'] = array();
120 120
         }
121 121
 
122 122
         // get key&val of the ticket from a user's query
123
-        $ticket = $post ? @$_POST['XOOPS_G_TICKET'] : @$_GET['XOOPS_G_TICKET'] ;
123
+        $ticket = $post ? @$_POST['XOOPS_G_TICKET'] : @$_GET['XOOPS_G_TICKET'];
124 124
 
125 125
         // CHECK: no tickets found
126 126
         if (empty($ticket)) {
127
-            $this->_errors[] = $this->messages['err_noticket'] ;
127
+            $this->_errors[] = $this->messages['err_noticket'];
128 128
         }
129 129
 
130 130
         // gargage collection & find a right stub
131
-        $stubs_tmp = $_SESSION['XOOPS_G_STUBS'] ;
132
-        $_SESSION['XOOPS_G_STUBS'] = array() ;
131
+        $stubs_tmp = $_SESSION['XOOPS_G_STUBS'];
132
+        $_SESSION['XOOPS_G_STUBS'] = array();
133 133
         foreach ($stubs_tmp as $stub) {
134 134
             // default lifetime 30min
135 135
             if ($stub['expire'] >= time()) {
136
-                if (md5($stub['token'] . XOOPS_DB_PREFIX) === $ticket) {
137
-                    $found_stub = $stub ;
136
+                if (md5($stub['token'].XOOPS_DB_PREFIX) === $ticket) {
137
+                    $found_stub = $stub;
138 138
                 } else {
139 139
                     // store the other valid stubs into session
140
-                    $_SESSION['XOOPS_G_STUBS'][] = $stub ;
140
+                    $_SESSION['XOOPS_G_STUBS'][] = $stub;
141 141
                 }
142 142
             } else {
143
-                if (md5($stub['token'] . XOOPS_DB_PREFIX) === $ticket) {
143
+                if (md5($stub['token'].XOOPS_DB_PREFIX) === $ticket) {
144 144
                     // not CSRF but Time-Out
145
-                    $timeout_flag = true ;
145
+                    $timeout_flag = true;
146 146
                 }
147 147
             }
148 148
         }
@@ -150,40 +150,40 @@  discard block
 block discarded – undo
150 150
         // CHECK: the right stub found or not
151 151
         if (empty($found_stub)) {
152 152
             if (empty($timeout_flag)) {
153
-                $this->_errors[] = $this->messages['err_nopair'] ;
153
+                $this->_errors[] = $this->messages['err_nopair'];
154 154
             } else {
155
-                $this->_errors[] = $this->messages['err_timeout'] ;
155
+                $this->_errors[] = $this->messages['err_timeout'];
156 156
             }
157 157
         } else {
158 158
 
159 159
             // set area if necessary
160 160
             // area as module's dirname
161
-            if (! $area && is_object(@$xoopsModule)) {
162
-                $area = $xoopsModule->getVar('dirname') ;
161
+            if (!$area && is_object(@$xoopsModule)) {
162
+                $area = $xoopsModule->getVar('dirname');
163 163
             }
164 164
 
165 165
             // check area or referer
166 166
             if (@$found_stub['area'] == $area) {
167
-                $area_check = true ;
167
+                $area_check = true;
168 168
             }
169
-            if (! empty($found_stub['referer']) && strstr(@$_SERVER['HTTP_REFERER'], $found_stub['referer'])) {
170
-                $referer_check = true ;
169
+            if (!empty($found_stub['referer']) && strstr(@$_SERVER['HTTP_REFERER'], $found_stub['referer'])) {
170
+                $referer_check = true;
171 171
             }
172 172
 
173 173
             if (empty($area_check) && empty($referer_check)) { // loose
174
-                $this->_errors[] = $this->messages['err_areaorref'] ;
174
+                $this->_errors[] = $this->messages['err_areaorref'];
175 175
             }
176 176
         }
177 177
 
178
-        if (! empty($this->_errors)) {
178
+        if (!empty($this->_errors)) {
179 179
             if ($allow_repost) {
180 180
                 // repost form
181
-                $this->draw_repost_form($area) ;
182
-                exit ;
181
+                $this->draw_repost_form($area);
182
+                exit;
183 183
             } else {
184 184
                 // failed
185
-                $this->clear() ;
186
-                return false ;
185
+                $this->clear();
186
+                return false;
187 187
             }
188 188
         } else {
189 189
             // all green
@@ -196,78 +196,78 @@  discard block
 block discarded – undo
196 196
     {
197 197
         // Notify which file is broken
198 198
         if (headers_sent()) {
199
-            restore_error_handler() ;
200
-            set_error_handler(array( &$this, 'errorHandler4FindOutput' )) ;
201
-            header('Dummy: for warning') ;
202
-            restore_error_handler() ;
203
-            exit ;
199
+            restore_error_handler();
200
+            set_error_handler(array(&$this, 'errorHandler4FindOutput'));
201
+            header('Dummy: for warning');
202
+            restore_error_handler();
203
+            exit;
204 204
         }
205 205
 
206
-        $table = '<table>' ;
207
-        $form = '<form action="?'.htmlspecialchars(@$_SERVER['QUERY_STRING'], ENT_QUOTES).'" method="post" >' ;
206
+        $table = '<table>';
207
+        $form = '<form action="?'.htmlspecialchars(@$_SERVER['QUERY_STRING'], ENT_QUOTES).'" method="post" >';
208 208
         foreach ($_POST as $key => $val) {
209 209
             if ($key == 'XOOPS_G_TICKET') {
210
-                continue ;
210
+                continue;
211 211
             }
212 212
             if (get_magic_quotes_gpc()) {
213
-                $key = stripslashes($key) ;
213
+                $key = stripslashes($key);
214 214
             }
215 215
             if (is_array($val)) {
216
-                list($tmp_table, $tmp_form) = $this->extract_post_recursive(htmlspecialchars($key, ENT_QUOTES), $val) ;
217
-                $table .= $tmp_table ;
218
-                $form .= $tmp_form ;
216
+                list($tmp_table, $tmp_form) = $this->extract_post_recursive(htmlspecialchars($key, ENT_QUOTES), $val);
217
+                $table .= $tmp_table;
218
+                $form .= $tmp_form;
219 219
             } else {
220 220
                 if (get_magic_quotes_gpc()) {
221
-                    $val = stripslashes($val) ;
221
+                    $val = stripslashes($val);
222 222
                 }
223
-                $table .= '<tr><th>'.htmlspecialchars($key, ENT_QUOTES).'</th><td>'.htmlspecialchars($val, ENT_QUOTES).'</td></tr>'."\n" ;
224
-                $form .= '<input type="hidden" name="'.htmlspecialchars($key, ENT_QUOTES).'" value="'.htmlspecialchars($val, ENT_QUOTES).'" />'."\n" ;
223
+                $table .= '<tr><th>'.htmlspecialchars($key, ENT_QUOTES).'</th><td>'.htmlspecialchars($val, ENT_QUOTES).'</td></tr>'."\n";
224
+                $form .= '<input type="hidden" name="'.htmlspecialchars($key, ENT_QUOTES).'" value="'.htmlspecialchars($val, ENT_QUOTES).'" />'."\n";
225 225
             }
226 226
         }
227
-        $table .= '</table>' ;
228
-        $form .= $this->getTicketHtml(__LINE__, 300, $area).'<input type="submit" value="'.$this->messages['btn_repost'].'" /></form>' ;
227
+        $table .= '</table>';
228
+        $form .= $this->getTicketHtml(__LINE__, 300, $area).'<input type="submit" value="'.$this->messages['btn_repost'].'" /></form>';
229 229
 
230
-        error_reporting(0) ;
230
+        error_reporting(0);
231 231
         while (@ob_get_level() && @ob_end_clean());
232 232
 
233
-        echo '<html><head><title>'.$this->messages['err_general'].'</title><style>table,td,th {border:solid black 1px; border-collapse:collapse;}</style></head><body>' . sprintf($this->messages['fmt_prompt4repost'], $this->getErrors()) . $table . $form . '</body></html>' ;
233
+        echo '<html><head><title>'.$this->messages['err_general'].'</title><style>table,td,th {border:solid black 1px; border-collapse:collapse;}</style></head><body>'.sprintf($this->messages['fmt_prompt4repost'], $this->getErrors()).$table.$form.'</body></html>';
234 234
     }
235 235
 
236 236
         public function extract_post_recursive($key_name, $tmp_array)
237 237
         {
238
-            $table = '' ;
239
-            $form = '' ;
238
+            $table = '';
239
+            $form = '';
240 240
             foreach ($tmp_array as $key => $val) {
241 241
                 if (get_magic_quotes_gpc()) {
242
-                    $key = stripslashes($key) ;
242
+                    $key = stripslashes($key);
243 243
                 }
244 244
                 if (is_array($val)) {
245
-                    list($tmp_table, $tmp_form) = $this->extract_post_recursive($key_name.'['.htmlspecialchars($key, ENT_QUOTES).']', $val) ;
246
-                    $table .= $tmp_table ;
247
-                    $form .= $tmp_form ;
245
+                    list($tmp_table, $tmp_form) = $this->extract_post_recursive($key_name.'['.htmlspecialchars($key, ENT_QUOTES).']', $val);
246
+                    $table .= $tmp_table;
247
+                    $form .= $tmp_form;
248 248
                 } else {
249 249
                     if (get_magic_quotes_gpc()) {
250
-                        $val = stripslashes($val) ;
250
+                        $val = stripslashes($val);
251 251
                     }
252
-                    $table .= '<tr><th>'.$key_name.'['.htmlspecialchars($key, ENT_QUOTES).']</th><td>'.htmlspecialchars($val, ENT_QUOTES).'</td></tr>'."\n" ;
253
-                    $form .= '<input type="hidden" name="'.$key_name.'['.htmlspecialchars($key, ENT_QUOTES).']" value="'.htmlspecialchars($val, ENT_QUOTES).'" />'."\n" ;
252
+                    $table .= '<tr><th>'.$key_name.'['.htmlspecialchars($key, ENT_QUOTES).']</th><td>'.htmlspecialchars($val, ENT_QUOTES).'</td></tr>'."\n";
253
+                    $form .= '<input type="hidden" name="'.$key_name.'['.htmlspecialchars($key, ENT_QUOTES).']" value="'.htmlspecialchars($val, ENT_QUOTES).'" />'."\n";
254 254
                 }
255 255
             }
256
-            return array( $table , $form ) ;
256
+            return array($table, $form);
257 257
         }
258 258
 
259 259
 
260 260
     // clear all stubs
261 261
     public function clear()
262 262
     {
263
-        $_SESSION['XOOPS_G_STUBS'] = array() ;
263
+        $_SESSION['XOOPS_G_STUBS'] = array();
264 264
     }
265 265
 
266 266
 
267 267
     // Ticket Using
268 268
     public function using()
269 269
     {
270
-        if (! empty($_SESSION['XOOPS_G_STUBS'])) {
270
+        if (!empty($_SESSION['XOOPS_G_STUBS'])) {
271 271
             return true;
272 272
         } else {
273 273
             return false;
@@ -279,39 +279,39 @@  discard block
 block discarded – undo
279 279
     public function getErrors($ashtml = true)
280 280
     {
281 281
         if ($ashtml) {
282
-            $ret = '' ;
282
+            $ret = '';
283 283
             foreach ($this->_errors as $msg) {
284
-                $ret .= "$msg<br />\n" ;
284
+                $ret .= "$msg<br />\n";
285 285
             }
286 286
         } else {
287
-            $ret = $this->_errors ;
287
+            $ret = $this->_errors;
288 288
         }
289
-        return $ret ;
289
+        return $ret;
290 290
     }
291 291
 
292 292
         public function errorHandler4FindOutput($errNo, $errStr, $errFile, $errLine)
293 293
         {
294 294
             if (preg_match('?'.preg_quote(XOOPS_ROOT_PATH).'([^:]+)\:(\d+)?', $errStr, $regs)) {
295
-                echo 'Irregular output! check the file ' . htmlspecialchars($regs[1]) . ' line ' . htmlspecialchars($regs[2]) ;
295
+                echo 'Irregular output! check the file '.htmlspecialchars($regs[1]).' line '.htmlspecialchars($regs[2]);
296 296
             } else {
297 297
                 echo 'Irregular output! check language files etc.';
298 298
             }
299
-            return ;
299
+            return;
300 300
         }
301 301
 // end of class
302 302
     }
303 303
 
304 304
 // create a instance in global scope
305
-$GLOBALS['xoopsGTicket'] = new XoopsGTicket() ;
305
+$GLOBALS['xoopsGTicket'] = new XoopsGTicket();
306 306
 }
307 307
 
308
-if (! function_exists('admin_refcheck')) {
308
+if (!function_exists('admin_refcheck')) {
309 309
 
310 310
 //Admin Referer Check By Marijuana(Rev.011)
311 311
 function admin_refcheck($chkref = '')
312 312
 {
313 313
     if (empty($_SERVER['HTTP_REFERER'])) {
314
-        return true ;
314
+        return true;
315 315
     } else {
316 316
         $ref = $_SERVER['HTTP_REFERER'];
317 317
     }
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/include/Archive_Zip.php 2 patches
Indentation   +1707 added lines, -1707 removed lines patch added patch discarded remove patch
@@ -27,63 +27,63 @@  discard block
 block discarded – undo
27 27
 
28 28
 //  require_once 'PEAR.php'; // GIJ
29 29
 
30
-  // ----- Constants
31
-  define('ARCHIVE_ZIP_READ_BLOCK_SIZE', 2048);
32
-
33
-  // ----- File list separator
34
-  define('ARCHIVE_ZIP_SEPARATOR', ',');
35
-
36
-  // ----- Optional static temporary directory
37
-  //       By default temporary files are generated in the script current
38
-  //       path.
39
-  //       If defined :
40
-  //       - MUST BE terminated by a '/'.
41
-  //       - MUST be a valid, already created directory
42
-  //       Samples :
43
-  // define( 'ARCHIVE_ZIP_TEMPORARY_DIR', '/temp/' );
44
-  // define( 'ARCHIVE_ZIP_TEMPORARY_DIR', 'C:/Temp/' );
45
-  define('ARCHIVE_ZIP_TEMPORARY_DIR', '');
46
-
47
-  // ----- Error codes
48
-  define('ARCHIVE_ZIP_ERR_NO_ERROR', 0);
49
-  define('ARCHIVE_ZIP_ERR_WRITE_OPEN_FAIL', -1);
50
-  define('ARCHIVE_ZIP_ERR_READ_OPEN_FAIL', -2);
51
-  define('ARCHIVE_ZIP_ERR_INVALID_PARAMETER', -3);
52
-  define('ARCHIVE_ZIP_ERR_MISSING_FILE', -4);
53
-  define('ARCHIVE_ZIP_ERR_FILENAME_TOO_LONG', -5);
54
-  define('ARCHIVE_ZIP_ERR_INVALID_ZIP', -6);
55
-  define('ARCHIVE_ZIP_ERR_BAD_EXTRACTED_FILE', -7);
56
-  define('ARCHIVE_ZIP_ERR_DIR_CREATE_FAIL', -8);
57
-  define('ARCHIVE_ZIP_ERR_BAD_EXTENSION', -9);
58
-  define('ARCHIVE_ZIP_ERR_BAD_FORMAT', -10);
59
-  define('ARCHIVE_ZIP_ERR_DELETE_FILE_FAIL', -11);
60
-  define('ARCHIVE_ZIP_ERR_RENAME_FILE_FAIL', -12);
61
-  define('ARCHIVE_ZIP_ERR_BAD_CHECKSUM', -13);
62
-  define('ARCHIVE_ZIP_ERR_INVALID_ARCHIVE_ZIP', -14);
63
-  define('ARCHIVE_ZIP_ERR_MISSING_OPTION_VALUE', -15);
64
-  define('ARCHIVE_ZIP_ERR_INVALID_PARAM_VALUE', -16);
65
-
66
-  // ----- Warning codes
67
-  define('ARCHIVE_ZIP_WARN_NO_WARNING', 0);
68
-  define('ARCHIVE_ZIP_WARN_FILE_EXIST', 1);
69
-
70
-  // ----- Methods parameters
71
-  define('ARCHIVE_ZIP_PARAM_PATH', 'path');
72
-  define('ARCHIVE_ZIP_PARAM_ADD_PATH', 'add_path');
73
-  define('ARCHIVE_ZIP_PARAM_REMOVE_PATH', 'remove_path');
74
-  define('ARCHIVE_ZIP_PARAM_REMOVE_ALL_PATH', 'remove_all_path');
75
-  define('ARCHIVE_ZIP_PARAM_SET_CHMOD', 'set_chmod');
76
-  define('ARCHIVE_ZIP_PARAM_EXTRACT_AS_STRING', 'extract_as_string');
77
-  define('ARCHIVE_ZIP_PARAM_NO_COMPRESSION', 'no_compression');
78
-  define('ARCHIVE_ZIP_PARAM_BY_NAME', 'by_name');
79
-  define('ARCHIVE_ZIP_PARAM_BY_INDEX', 'by_index');
80
-  define('ARCHIVE_ZIP_PARAM_BY_EREG', 'by_ereg');
81
-  define('ARCHIVE_ZIP_PARAM_BY_PREG', 'by_preg');
82
-
83
-  define('ARCHIVE_ZIP_PARAM_PRE_EXTRACT', 'callback_pre_extract');
84
-  define('ARCHIVE_ZIP_PARAM_POST_EXTRACT', 'callback_post_extract');
85
-  define('ARCHIVE_ZIP_PARAM_PRE_ADD', 'callback_pre_add');
86
-  define('ARCHIVE_ZIP_PARAM_POST_ADD', 'callback_post_add');
30
+    // ----- Constants
31
+    define('ARCHIVE_ZIP_READ_BLOCK_SIZE', 2048);
32
+
33
+    // ----- File list separator
34
+    define('ARCHIVE_ZIP_SEPARATOR', ',');
35
+
36
+    // ----- Optional static temporary directory
37
+    //       By default temporary files are generated in the script current
38
+    //       path.
39
+    //       If defined :
40
+    //       - MUST BE terminated by a '/'.
41
+    //       - MUST be a valid, already created directory
42
+    //       Samples :
43
+    // define( 'ARCHIVE_ZIP_TEMPORARY_DIR', '/temp/' );
44
+    // define( 'ARCHIVE_ZIP_TEMPORARY_DIR', 'C:/Temp/' );
45
+    define('ARCHIVE_ZIP_TEMPORARY_DIR', '');
46
+
47
+    // ----- Error codes
48
+    define('ARCHIVE_ZIP_ERR_NO_ERROR', 0);
49
+    define('ARCHIVE_ZIP_ERR_WRITE_OPEN_FAIL', -1);
50
+    define('ARCHIVE_ZIP_ERR_READ_OPEN_FAIL', -2);
51
+    define('ARCHIVE_ZIP_ERR_INVALID_PARAMETER', -3);
52
+    define('ARCHIVE_ZIP_ERR_MISSING_FILE', -4);
53
+    define('ARCHIVE_ZIP_ERR_FILENAME_TOO_LONG', -5);
54
+    define('ARCHIVE_ZIP_ERR_INVALID_ZIP', -6);
55
+    define('ARCHIVE_ZIP_ERR_BAD_EXTRACTED_FILE', -7);
56
+    define('ARCHIVE_ZIP_ERR_DIR_CREATE_FAIL', -8);
57
+    define('ARCHIVE_ZIP_ERR_BAD_EXTENSION', -9);
58
+    define('ARCHIVE_ZIP_ERR_BAD_FORMAT', -10);
59
+    define('ARCHIVE_ZIP_ERR_DELETE_FILE_FAIL', -11);
60
+    define('ARCHIVE_ZIP_ERR_RENAME_FILE_FAIL', -12);
61
+    define('ARCHIVE_ZIP_ERR_BAD_CHECKSUM', -13);
62
+    define('ARCHIVE_ZIP_ERR_INVALID_ARCHIVE_ZIP', -14);
63
+    define('ARCHIVE_ZIP_ERR_MISSING_OPTION_VALUE', -15);
64
+    define('ARCHIVE_ZIP_ERR_INVALID_PARAM_VALUE', -16);
65
+
66
+    // ----- Warning codes
67
+    define('ARCHIVE_ZIP_WARN_NO_WARNING', 0);
68
+    define('ARCHIVE_ZIP_WARN_FILE_EXIST', 1);
69
+
70
+    // ----- Methods parameters
71
+    define('ARCHIVE_ZIP_PARAM_PATH', 'path');
72
+    define('ARCHIVE_ZIP_PARAM_ADD_PATH', 'add_path');
73
+    define('ARCHIVE_ZIP_PARAM_REMOVE_PATH', 'remove_path');
74
+    define('ARCHIVE_ZIP_PARAM_REMOVE_ALL_PATH', 'remove_all_path');
75
+    define('ARCHIVE_ZIP_PARAM_SET_CHMOD', 'set_chmod');
76
+    define('ARCHIVE_ZIP_PARAM_EXTRACT_AS_STRING', 'extract_as_string');
77
+    define('ARCHIVE_ZIP_PARAM_NO_COMPRESSION', 'no_compression');
78
+    define('ARCHIVE_ZIP_PARAM_BY_NAME', 'by_name');
79
+    define('ARCHIVE_ZIP_PARAM_BY_INDEX', 'by_index');
80
+    define('ARCHIVE_ZIP_PARAM_BY_EREG', 'by_ereg');
81
+    define('ARCHIVE_ZIP_PARAM_BY_PREG', 'by_preg');
82
+
83
+    define('ARCHIVE_ZIP_PARAM_PRE_EXTRACT', 'callback_pre_extract');
84
+    define('ARCHIVE_ZIP_PARAM_POST_EXTRACT', 'callback_post_extract');
85
+    define('ARCHIVE_ZIP_PARAM_PRE_ADD', 'callback_pre_add');
86
+    define('ARCHIVE_ZIP_PARAM_POST_ADD', 'callback_post_add');
87 87
 
88 88
 
89 89
 
@@ -102,55 +102,55 @@  discard block
 block discarded – undo
102 102
 class Archive_Zip
103 103
 {
104 104
     /**
105
-    * The filename of the zip archive.
106
-    *
107
-    * @var string Name of the Zip file
108
-    */
105
+     * The filename of the zip archive.
106
+     *
107
+     * @var string Name of the Zip file
108
+     */
109 109
     public $_zipname='';
110 110
 
111 111
     /**
112
-    * File descriptor of the opened Zip file.
113
-    *
114
-    * @var int Internal zip file descriptor
115
-    */
112
+     * File descriptor of the opened Zip file.
113
+     *
114
+     * @var int Internal zip file descriptor
115
+     */
116 116
     public $_zip_fd=0;
117 117
 
118 118
     /**
119
-    * @var int last error code
120
-    */
119
+     * @var int last error code
120
+     */
121 121
     public $_error_code=1;
122 122
 
123 123
     /**
124
-    * @var string Last error description
125
-    */
124
+     * @var string Last error description
125
+     */
126 126
     public $_error_string='';
127 127
 
128 128
     // {{{ constructor
129 129
     /**
130
-    * Archive_Zip Class constructor. This flavour of the constructor only
131
-    * declare a new Archive_Zip object, identifying it by the name of the
132
-    * zip file.
133
-    *
134
-    * @param    string  $p_zipname  The name of the zip archive to create
135
-    * @access public
136
-    */
130
+     * Archive_Zip Class constructor. This flavour of the constructor only
131
+     * declare a new Archive_Zip object, identifying it by the name of the
132
+     * zip file.
133
+     *
134
+     * @param    string  $p_zipname  The name of the zip archive to create
135
+     * @access public
136
+     */
137 137
 //HACK by domifara
138 138
 //	function Archive_Zip($p_zipname)
139 139
     public function __construct($p_zipname)
140 140
     {
141 141
 
142
-      // ----- Check the zlib
142
+        // ----- Check the zlib
143 143
 /*      if (!extension_loaded('zlib')) {
144 144
           PEAR::loadExtension('zlib');
145 145
       }*/ // GIJ
146
-      if (!extension_loaded('zlib')) {
147
-          die("The extension 'zlib' couldn't be found.\n". 'Please make sure your version of PHP was built ' .
148
-              "with 'zlib' support.\n");
149
-          return false;
150
-      }
151
-
152
-      // ----- Set the attributes
153
-      $this->_zipname = $p_zipname;
146
+        if (!extension_loaded('zlib')) {
147
+            die("The extension 'zlib' couldn't be found.\n". 'Please make sure your version of PHP was built ' .
148
+                "with 'zlib' support.\n");
149
+            return false;
150
+        }
151
+
152
+        // ----- Set the attributes
153
+        $this->_zipname = $p_zipname;
154 154
         $this->_zip_fd = 0;
155 155
 
156 156
         return;
@@ -159,27 +159,27 @@  discard block
 block discarded – undo
159 159
 
160 160
     // {{{ create()
161 161
     /**
162
-    * This method creates a Zip Archive with the filename set with
163
-    * the constructor.
164
-    * The files and directories indicated in $p_filelist
165
-    * are added in the archive.
166
-    * When a directory is in the list, the directory and its content is added
167
-    * in the archive.
168
-    * The methods takes a variable list of parameters in $p_params.
169
-    * The supported parameters for this method are :
170
-    *   'add_path' : Add a path to the archived files.
171
-    *   'remove_path' : Remove the specified 'root' path of the archived files.
172
-    *   'remove_all_path' : Remove all the path of the archived files.
173
-    *   'no_compression' : The archived files will not be compressed.
174
-    *
175
-    * @access public
176
-    * @param  mixed  $p_filelist  The list of the files or folders to add.
177
-    *                             It can be a string with filenames separated
178
-    *                             by a comma, or an array of filenames.
179
-    * @param  mixed  $p_params  An array of variable parameters and values.
180
-    * @return mixed An array of file description on success,
181
-    *               an error code on error
182
-    */
162
+     * This method creates a Zip Archive with the filename set with
163
+     * the constructor.
164
+     * The files and directories indicated in $p_filelist
165
+     * are added in the archive.
166
+     * When a directory is in the list, the directory and its content is added
167
+     * in the archive.
168
+     * The methods takes a variable list of parameters in $p_params.
169
+     * The supported parameters for this method are :
170
+     *   'add_path' : Add a path to the archived files.
171
+     *   'remove_path' : Remove the specified 'root' path of the archived files.
172
+     *   'remove_all_path' : Remove all the path of the archived files.
173
+     *   'no_compression' : The archived files will not be compressed.
174
+     *
175
+     * @access public
176
+     * @param  mixed  $p_filelist  The list of the files or folders to add.
177
+     *                             It can be a string with filenames separated
178
+     *                             by a comma, or an array of filenames.
179
+     * @param  mixed  $p_params  An array of variable parameters and values.
180
+     * @return mixed An array of file description on success,
181
+     *               an error code on error
182
+     */
183 183
     public function create($p_filelist, $p_params=0)
184 184
     {
185 185
         $this->_errorReset();
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
             $p_params = array();
190 190
         }
191 191
         if ($this->_check_parameters($p_params,
192
-                                     array('no_compression' => false,
193
-                                           'add_path' => '',
194
-                                           'remove_path' => '',
195
-                                           'remove_all_path' => false)) != 1) {
192
+                                        array('no_compression' => false,
193
+                                            'add_path' => '',
194
+                                            'remove_path' => '',
195
+                                            'remove_all_path' => false)) != 1) {
196 196
             return 0;
197 197
         }
198 198
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
         // ----- Invalid variable
214 214
         else {
215 215
             $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAMETER,
216
-                             'Invalid variable type p_filelist');
216
+                                'Invalid variable type p_filelist');
217 217
             $v_result = ARCHIVE_ZIP_ERR_INVALID_PARAMETER;
218 218
         }
219 219
 
@@ -227,30 +227,30 @@  discard block
 block discarded – undo
227 227
 
228 228
     // {{{ add()
229 229
     /**
230
-    * This method add files or directory in an existing Zip Archive.
231
-    * If the Zip Archive does not exist it is created.
232
-    * The files and directories to add are indicated in $p_filelist.
233
-    * When a directory is in the list, the directory and its content is added
234
-    * in the archive.
235
-    * The methods takes a variable list of parameters in $p_params.
236
-    * The supported parameters for this method are :
237
-    *   'add_path' : Add a path to the archived files.
238
-    *   'remove_path' : Remove the specified 'root' path of the archived files.
239
-    *   'remove_all_path' : Remove all the path of the archived files.
240
-    *   'no_compression' : The archived files will not be compressed.
241
-    *   'callback_pre_add' : A callback function that will be called before
242
-    *                        each entry archiving.
243
-    *   'callback_post_add' : A callback function that will be called after
244
-    *                         each entry archiving.
245
-    *
246
-    * @access public
247
-    * @param    mixed  $p_filelist  The list of the files or folders to add.
248
-    *                               It can be a string with filenames separated
249
-    *                               by a comma, or an array of filenames.
250
-    * @param    mixed  $p_params  An array of variable parameters and values.
251
-    * @return mixed An array of file description on success,
252
-    *               0 on an unrecoverable failure, an error code is logged.
253
-    */
230
+     * This method add files or directory in an existing Zip Archive.
231
+     * If the Zip Archive does not exist it is created.
232
+     * The files and directories to add are indicated in $p_filelist.
233
+     * When a directory is in the list, the directory and its content is added
234
+     * in the archive.
235
+     * The methods takes a variable list of parameters in $p_params.
236
+     * The supported parameters for this method are :
237
+     *   'add_path' : Add a path to the archived files.
238
+     *   'remove_path' : Remove the specified 'root' path of the archived files.
239
+     *   'remove_all_path' : Remove all the path of the archived files.
240
+     *   'no_compression' : The archived files will not be compressed.
241
+     *   'callback_pre_add' : A callback function that will be called before
242
+     *                        each entry archiving.
243
+     *   'callback_post_add' : A callback function that will be called after
244
+     *                         each entry archiving.
245
+     *
246
+     * @access public
247
+     * @param    mixed  $p_filelist  The list of the files or folders to add.
248
+     *                               It can be a string with filenames separated
249
+     *                               by a comma, or an array of filenames.
250
+     * @param    mixed  $p_params  An array of variable parameters and values.
251
+     * @return mixed An array of file description on success,
252
+     *               0 on an unrecoverable failure, an error code is logged.
253
+     */
254 254
     public function add($p_filelist, $p_params=0)
255 255
     {
256 256
         $this->_errorReset();
@@ -260,11 +260,11 @@  discard block
 block discarded – undo
260 260
             $p_params = array();
261 261
         }
262 262
         if ($this->_check_parameters($p_params,
263
-                                     array('no_compression' => false,
263
+                                        array('no_compression' => false,
264 264
                                             'add_path' => '',
265 265
                                             'remove_path' => '',
266 266
                                             'remove_all_path' => false,
267
-                                             'callback_pre_add' => '',
267
+                                                'callback_pre_add' => '',
268 268
                                             'callback_post_add' => '')) != 1) {
269 269
             return 0;
270 270
         }
@@ -302,48 +302,48 @@  discard block
 block discarded – undo
302 302
 
303 303
     // {{{ listContent()
304 304
     /**
305
-    * This method gives the names and properties of the files and directories
306
-    * which are present in the zip archive.
307
-    * The properties of each entries in the list are :
308
-    *   filename : Name of the file.
309
-    *              For create() or add() it's the filename given by the user.
310
-    *              For an extract() it's the filename of the extracted file.
311
-    *   stored_filename : Name of the file / directory stored in the archive.
312
-    *   size : Size of the stored file.
313
-    *   compressed_size : Size of the file's data compressed in the archive
314
-    *                     (without the zip headers overhead)
315
-    *   mtime : Last known modification date of the file (UNIX timestamp)
316
-    *   comment : Comment associated with the file
317
-    *   folder : true | false (indicates if the entry is a folder)
318
-    *   index : index of the file in the archive (-1 when not available)
319
-    *   status : status of the action on the entry (depending of the action) :
320
-    *            Values are :
321
-    *              ok : OK !
322
-    *              filtered : the file/dir was not extracted (filtered by user)
323
-    *              already_a_directory : the file can't be extracted because a
324
-    *                                    directory with the same name already
325
-    *                                    exists
326
-    *              write_protected : the file can't be extracted because a file
327
-    *                                with the same name already exists and is
328
-    *                                write protected
329
-    *              newer_exist : the file was not extracted because a newer
330
-    *                            file already exists
331
-    *              path_creation_fail : the file is not extracted because the
332
-    *                                   folder does not exists and can't be
333
-    *                                   created
334
-    *              write_error : the file was not extracted because there was a
335
-    *                            error while writing the file
336
-    *              read_error : the file was not extracted because there was a
337
-    *                           error while reading the file
338
-    *              invalid_header : the file was not extracted because of an
339
-    *                               archive format error (bad file header)
340
-    * Note that each time a method can continue operating when there
341
-    * is an error on a single file, the error is only logged in the file status.
342
-    *
343
-    * @access public
344
-    * @return mixed An array of file description on success,
345
-    *               0 on an unrecoverable failure, an error code is logged.
346
-    */
305
+     * This method gives the names and properties of the files and directories
306
+     * which are present in the zip archive.
307
+     * The properties of each entries in the list are :
308
+     *   filename : Name of the file.
309
+     *              For create() or add() it's the filename given by the user.
310
+     *              For an extract() it's the filename of the extracted file.
311
+     *   stored_filename : Name of the file / directory stored in the archive.
312
+     *   size : Size of the stored file.
313
+     *   compressed_size : Size of the file's data compressed in the archive
314
+     *                     (without the zip headers overhead)
315
+     *   mtime : Last known modification date of the file (UNIX timestamp)
316
+     *   comment : Comment associated with the file
317
+     *   folder : true | false (indicates if the entry is a folder)
318
+     *   index : index of the file in the archive (-1 when not available)
319
+     *   status : status of the action on the entry (depending of the action) :
320
+     *            Values are :
321
+     *              ok : OK !
322
+     *              filtered : the file/dir was not extracted (filtered by user)
323
+     *              already_a_directory : the file can't be extracted because a
324
+     *                                    directory with the same name already
325
+     *                                    exists
326
+     *              write_protected : the file can't be extracted because a file
327
+     *                                with the same name already exists and is
328
+     *                                write protected
329
+     *              newer_exist : the file was not extracted because a newer
330
+     *                            file already exists
331
+     *              path_creation_fail : the file is not extracted because the
332
+     *                                   folder does not exists and can't be
333
+     *                                   created
334
+     *              write_error : the file was not extracted because there was a
335
+     *                            error while writing the file
336
+     *              read_error : the file was not extracted because there was a
337
+     *                           error while reading the file
338
+     *              invalid_header : the file was not extracted because of an
339
+     *                               archive format error (bad file header)
340
+     * Note that each time a method can continue operating when there
341
+     * is an error on a single file, the error is only logged in the file status.
342
+     *
343
+     * @access public
344
+     * @return mixed An array of file description on success,
345
+     *               0 on an unrecoverable failure, an error code is logged.
346
+     */
347 347
     public function listContent()
348 348
     {
349 349
         $this->_errorReset();
@@ -365,42 +365,42 @@  discard block
 block discarded – undo
365 365
 
366 366
     // {{{ extract()
367 367
     /**
368
-    * This method extract the files and folders which are in the zip archive.
369
-    * It can extract all the archive or a part of the archive by using filter
370
-    * feature (extract by name, by index, by ereg, by preg). The extraction
371
-    * can occur in the current path or an other path.
372
-    * All the advanced features are activated by the use of variable
373
-    * parameters.
374
-    * The return value is an array of entry descriptions which gives
375
-    * information on extracted files (See listContent()).
376
-    * The method may return a success value (an array) even if some files
377
-    * are not correctly extracted (see the file status in listContent()).
378
-    * The supported variable parameters for this method are :
379
-    *   'add_path' : Path where the files and directories are to be extracted
380
-    *   'remove_path' : First part ('root' part) of the memorized path
381
-    *                   (if similar) to remove while extracting.
382
-    *   'remove_all_path' : Remove all the memorized path while extracting.
383
-    *   'extract_as_string' :
384
-    *   'set_chmod' : After the extraction of the file the indicated mode
385
-    *                 will be set.
386
-    *   'by_name' : It can be a string with file/dir names separated by ',',
387
-    *               or an array of file/dir names to extract from the archive.
388
-    *   'by_index' : A string with range of indexes separated by ',',
389
-    *                (sample "1,3-5,12").
390
-    *   'by_ereg' : A regular expression (ereg) that must match the extracted
391
-    *               filename.
392
-    *   'by_preg' : A regular expression (preg) that must match the extracted
393
-    *               filename.
394
-    *   'callback_pre_extract' : A callback function that will be called before
395
-    *                            each entry extraction.
396
-    *   'callback_post_extract' : A callback function that will be called after
397
-    *                            each entry extraction.
398
-    *
399
-    * @access public
400
-    * @param    mixed  $p_params  An array of variable parameters and values.
401
-    * @return mixed An array of file description on success,
402
-    *               0 on an unrecoverable failure, an error code is logged.
403
-    */
368
+     * This method extract the files and folders which are in the zip archive.
369
+     * It can extract all the archive or a part of the archive by using filter
370
+     * feature (extract by name, by index, by ereg, by preg). The extraction
371
+     * can occur in the current path or an other path.
372
+     * All the advanced features are activated by the use of variable
373
+     * parameters.
374
+     * The return value is an array of entry descriptions which gives
375
+     * information on extracted files (See listContent()).
376
+     * The method may return a success value (an array) even if some files
377
+     * are not correctly extracted (see the file status in listContent()).
378
+     * The supported variable parameters for this method are :
379
+     *   'add_path' : Path where the files and directories are to be extracted
380
+     *   'remove_path' : First part ('root' part) of the memorized path
381
+     *                   (if similar) to remove while extracting.
382
+     *   'remove_all_path' : Remove all the memorized path while extracting.
383
+     *   'extract_as_string' :
384
+     *   'set_chmod' : After the extraction of the file the indicated mode
385
+     *                 will be set.
386
+     *   'by_name' : It can be a string with file/dir names separated by ',',
387
+     *               or an array of file/dir names to extract from the archive.
388
+     *   'by_index' : A string with range of indexes separated by ',',
389
+     *                (sample "1,3-5,12").
390
+     *   'by_ereg' : A regular expression (ereg) that must match the extracted
391
+     *               filename.
392
+     *   'by_preg' : A regular expression (preg) that must match the extracted
393
+     *               filename.
394
+     *   'callback_pre_extract' : A callback function that will be called before
395
+     *                            each entry extraction.
396
+     *   'callback_post_extract' : A callback function that will be called after
397
+     *                            each entry extraction.
398
+     *
399
+     * @access public
400
+     * @param    mixed  $p_params  An array of variable parameters and values.
401
+     * @return mixed An array of file description on success,
402
+     *               0 on an unrecoverable failure, an error code is logged.
403
+     */
404 404
     public function extract($p_params=0)
405 405
     {
406 406
         $this->_errorReset();
@@ -415,11 +415,11 @@  discard block
 block discarded – undo
415 415
             $p_params = array();
416 416
         }
417 417
         if ($this->_check_parameters($p_params,
418
-                                     array('extract_as_string' => false,
418
+                                        array('extract_as_string' => false,
419 419
                                             'add_path' => '',
420 420
                                             'remove_path' => '',
421 421
                                             'remove_all_path' => false,
422
-                                             'callback_pre_extract' => '',
422
+                                                'callback_pre_extract' => '',
423 423
                                             'callback_post_extract' => '',
424 424
                                             'set_chmod' => 0,
425 425
                                             'by_name' => '',
@@ -443,26 +443,26 @@  discard block
 block discarded – undo
443 443
 
444 444
     // {{{ delete()
445 445
     /**
446
-    * This methods delete archive entries in the zip archive.
447
-    * Notice that at least one filtering rule (set by the variable parameter
448
-    * list) must be set.
449
-    * Also notice that if you delete a folder entry, only the folder entry
450
-    * is deleted, not all the files bellonging to this folder.
451
-    * The supported variable parameters for this method are :
452
-    *   'by_name' : It can be a string with file/dir names separated by ',',
453
-    *               or an array of file/dir names to delete from the archive.
454
-    *   'by_index' : A string with range of indexes separated by ',',
455
-    *                (sample "1,3-5,12").
456
-    *   'by_ereg' : A regular expression (ereg) that must match the extracted
457
-    *               filename.
458
-    *   'by_preg' : A regular expression (preg) that must match the extracted
459
-    *               filename.
460
-    *
461
-    * @access public
462
-    * @param    mixed  $p_params  An array of variable parameters and values.
463
-    * @return mixed An array of file description on success,
464
-    *               0 on an unrecoverable failure, an error code is logged.
465
-    */
446
+     * This methods delete archive entries in the zip archive.
447
+     * Notice that at least one filtering rule (set by the variable parameter
448
+     * list) must be set.
449
+     * Also notice that if you delete a folder entry, only the folder entry
450
+     * is deleted, not all the files bellonging to this folder.
451
+     * The supported variable parameters for this method are :
452
+     *   'by_name' : It can be a string with file/dir names separated by ',',
453
+     *               or an array of file/dir names to delete from the archive.
454
+     *   'by_index' : A string with range of indexes separated by ',',
455
+     *                (sample "1,3-5,12").
456
+     *   'by_ereg' : A regular expression (ereg) that must match the extracted
457
+     *               filename.
458
+     *   'by_preg' : A regular expression (preg) that must match the extracted
459
+     *               filename.
460
+     *
461
+     * @access public
462
+     * @param    mixed  $p_params  An array of variable parameters and values.
463
+     * @return mixed An array of file description on success,
464
+     *               0 on an unrecoverable failure, an error code is logged.
465
+     */
466 466
     public function delete($p_params)
467 467
     {
468 468
         $this->_errorReset();
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 
475 475
         // ----- Set default values
476 476
         if ($this->_check_parameters($p_params,
477
-                                     array('by_name' => '',
477
+                                        array('by_name' => '',
478 478
                                             'by_index' => '',
479 479
                                             'by_ereg' => '',
480 480
                                             'by_preg' => '')) != 1) {
@@ -487,8 +487,8 @@  discard block
 block discarded – undo
487 487
             && ($p_params['by_ereg'] == '')
488 488
             && ($p_params['by_preg'] == '')) {
489 489
             $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAMETER,
490
-                             'At least one filtering rule must'
491
-                             .' be set as parameter');
490
+                                'At least one filtering rule must'
491
+                                .' be set as parameter');
492 492
             return 0;
493 493
         }
494 494
 
@@ -505,16 +505,16 @@  discard block
 block discarded – undo
505 505
 
506 506
     // {{{ properties()
507 507
     /**
508
-    * This method gives the global properties of the archive.
509
-    *  The properties are :
510
-    *    nb : Number of files in the archive
511
-    *    comment : Comment associated with the archive file
512
-    *    status : not_exist, ok
513
-    *
514
-    * @access public
515
-    * @param    mixed  $p_params  {Description}
516
-    * @return mixed An array with the global properties or 0 on error.
517
-    */
508
+     * This method gives the global properties of the archive.
509
+     *  The properties are :
510
+     *    nb : Number of files in the archive
511
+     *    comment : Comment associated with the archive file
512
+     *    status : not_exist, ok
513
+     *
514
+     * @access public
515
+     * @param    mixed  $p_params  {Description}
516
+     * @return mixed An array with the global properties or 0 on error.
517
+     */
518 518
     public function properties()
519 519
     {
520 520
         $this->_errorReset();
@@ -535,8 +535,8 @@  discard block
 block discarded – undo
535 535
             // ----- Open the zip file
536 536
             if (($this->_zip_fd = @fopen($this->_zipname, 'rb')) == 0) {
537 537
                 $this->_errorLog(ARCHIVE_ZIP_ERR_READ_OPEN_FAIL,
538
-                                 'Unable to open archive \''.$this->_zipname
539
-                                 .'\' in binary read mode');
538
+                                    'Unable to open archive \''.$this->_zipname
539
+                                    .'\' in binary read mode');
540 540
                 return 0;
541 541
             }
542 542
 
@@ -561,15 +561,15 @@  discard block
 block discarded – undo
561 561
 
562 562
     // {{{ duplicate()
563 563
     /**
564
-    * This method creates an archive by copying the content of an other one.
565
-    * If the archive already exist, it is replaced by the new one without
566
-    * any warning.
567
-    *
568
-    * @access public
569
-    * @param  mixed  $p_archive  It can be a valid Archive_Zip object or
570
-    *                            the filename of a valid zip archive.
571
-    * @return integer 1 on success, 0 on failure.
572
-    */
564
+     * This method creates an archive by copying the content of an other one.
565
+     * If the archive already exist, it is replaced by the new one without
566
+     * any warning.
567
+     *
568
+     * @access public
569
+     * @param  mixed  $p_archive  It can be a valid Archive_Zip object or
570
+     *                            the filename of a valid zip archive.
571
+     * @return integer 1 on success, 0 on failure.
572
+     */
573 573
     public function duplicate($p_archive)
574 574
     {
575 575
         $this->_errorReset();
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
             // TBC : Should also check the archive format
587 587
             if (!is_file($p_archive)) {
588 588
                 $this->_errorLog(ARCHIVE_ZIP_ERR_MISSING_FILE,
589
-                                 "No file with filename '".$p_archive."'");
589
+                                    "No file with filename '".$p_archive."'");
590 590
                 $v_result = ARCHIVE_ZIP_ERR_MISSING_FILE;
591 591
             } else {
592 592
                 $v_result = $this->_duplicate($p_archive);
@@ -605,16 +605,16 @@  discard block
 block discarded – undo
605 605
 
606 606
     // {{{ merge()
607 607
     /**
608
-    *  This method merge a valid zip archive at the end of the
609
-    *  archive identified by the Archive_Zip object.
610
-    *  If the archive ($this) does not exist, the merge becomes a duplicate.
611
-    *  If the archive to add does not exist, the merge is a success.
612
-    *
613
-    * @access public
614
-    * @param mixed $p_archive_to_add  It can be a valid Archive_Zip object or
615
-    *                                 the filename of a valid zip archive.
616
-    * @return integer 1 on success, 0 on failure.
617
-    */
608
+     *  This method merge a valid zip archive at the end of the
609
+     *  archive identified by the Archive_Zip object.
610
+     *  If the archive ($this) does not exist, the merge becomes a duplicate.
611
+     *  If the archive to add does not exist, the merge is a success.
612
+     *
613
+     * @access public
614
+     * @param mixed $p_archive_to_add  It can be a valid Archive_Zip object or
615
+     *                                 the filename of a valid zip archive.
616
+     * @return integer 1 on success, 0 on failure.
617
+     */
618 618
     public function merge($p_archive_to_add)
619 619
     {
620 620
         $v_result = 1;
@@ -652,11 +652,11 @@  discard block
 block discarded – undo
652 652
 
653 653
     // {{{ errorCode()
654 654
     /**
655
-    * Method that gives the lastest error code.
656
-    *
657
-    * @access public
658
-    * @return integer The error code value.
659
-    */
655
+     * Method that gives the lastest error code.
656
+     *
657
+     * @access public
658
+     * @return integer The error code value.
659
+     */
660 660
     public function errorCode()
661 661
     {
662 662
         return $this->_error_code;
@@ -665,19 +665,19 @@  discard block
 block discarded – undo
665 665
 
666 666
     // {{{ errorName()
667 667
     /**
668
-    * This method gives the latest error code name.
669
-    *
670
-    * @access public
671
-    * @param  boolean $p_with_code  If true, gives the name and the int value.
672
-    * @return string The error name.
673
-    */
668
+     * This method gives the latest error code name.
669
+     *
670
+     * @access public
671
+     * @param  boolean $p_with_code  If true, gives the name and the int value.
672
+     * @return string The error name.
673
+     */
674 674
     public function errorName($p_with_code=false)
675 675
     {
676 676
         $v_const_list = get_defined_constants();
677 677
 
678
-          // ----- Extract error constants from all const.
678
+            // ----- Extract error constants from all const.
679 679
         for (reset($v_const_list);
680
-             list($v_key, $v_value) = each($v_const_list);) {
680
+                list($v_key, $v_value) = each($v_const_list);) {
681 681
             if (substr($v_key, 0, strlen('ARCHIVE_ZIP_ERR_'))
682 682
                 =='ARCHIVE_ZIP_ERR_') {
683 683
                 $v_error_list[$v_key] = $v_value;
@@ -702,15 +702,15 @@  discard block
 block discarded – undo
702 702
 
703 703
     // {{{ errorInfo()
704 704
     /**
705
-    * This method returns the description associated with the latest error.
706
-    *
707
-    * @access public
708
-    * @param  boolean $p_full If set to true gives the description with the
709
-    *                         error code, the name and the description.
710
-    *                         If set to false gives only the description
711
-    *                         and the error code.
712
-    * @return string The error description.
713
-    */
705
+     * This method returns the description associated with the latest error.
706
+     *
707
+     * @access public
708
+     * @param  boolean $p_full If set to true gives the description with the
709
+     *                         error code, the name and the description.
710
+     *                         If set to false gives only the description
711
+     *                         and the error code.
712
+     * @return string The error description.
713
+     */
714 714
     public function errorInfo($p_full=false)
715 715
     {
716 716
         if ($p_full) {
@@ -728,30 +728,30 @@  discard block
 block discarded – undo
728 728
 // *****       THESES FUNCTIONS MUST NOT BE USED DIRECTLY       *****
729 729
 // -----------------------------------------------------------------------------
730 730
 
731
-  // ---------------------------------------------------------------------------
732
-  // Function : _checkFormat()
733
-  // Description :
734
-  //   This method check that the archive exists and is a valid zip archive.
735
-  //   Several level of check exists. (futur)
736
-  // Parameters :
737
-  //   $p_level : Level of check. Default 0.
738
-  //              0 : Check the first bytes (magic codes) (default value))
739
-  //              1 : 0 + Check the central directory (futur)
740
-  //              2 : 1 + Check each file header (futur)
741
-  // Return Values :
742
-  //   true on success,
743
-  //   false on error, the error code is set.
744
-  // ---------------------------------------------------------------------------
745
-  /**
746
-  * Archive_Zip::_checkFormat()
747
-  *
748
-  * { Description }
749
-  *
750
-  * @param integer $p_level
751
-  */
752
-  public function _checkFormat($p_level=0)
753
-  {
754
-      $v_result = true;
731
+    // ---------------------------------------------------------------------------
732
+    // Function : _checkFormat()
733
+    // Description :
734
+    //   This method check that the archive exists and is a valid zip archive.
735
+    //   Several level of check exists. (futur)
736
+    // Parameters :
737
+    //   $p_level : Level of check. Default 0.
738
+    //              0 : Check the first bytes (magic codes) (default value))
739
+    //              1 : 0 + Check the central directory (futur)
740
+    //              2 : 1 + Check each file header (futur)
741
+    // Return Values :
742
+    //   true on success,
743
+    //   false on error, the error code is set.
744
+    // ---------------------------------------------------------------------------
745
+    /**
746
+     * Archive_Zip::_checkFormat()
747
+     *
748
+     * { Description }
749
+     *
750
+     * @param integer $p_level
751
+     */
752
+    public function _checkFormat($p_level=0)
753
+    {
754
+        $v_result = true;
755 755
 
756 756
     // ----- Reset the error handler
757 757
     $this->_errorReset();
@@ -759,16 +759,16 @@  discard block
 block discarded – undo
759 759
     // ----- Look if the file exits
760 760
     if (!is_file($this->_zipname)) {
761 761
         // ----- Error log
762
-      $this->_errorLog(ARCHIVE_ZIP_ERR_MISSING_FILE,
763
-                       "Missing archive file '".$this->_zipname."'");
762
+        $this->_errorLog(ARCHIVE_ZIP_ERR_MISSING_FILE,
763
+                        "Missing archive file '".$this->_zipname."'");
764 764
         return false;
765 765
     }
766 766
 
767 767
     // ----- Check that the file is readeable
768 768
     if (!is_readable($this->_zipname)) {
769 769
         // ----- Error log
770
-      $this->_errorLog(ARCHIVE_ZIP_ERR_READ_OPEN_FAIL,
771
-                       "Unable to read archive '".$this->_zipname."'");
770
+        $this->_errorLog(ARCHIVE_ZIP_ERR_READ_OPEN_FAIL,
771
+                        "Unable to read archive '".$this->_zipname."'");
772 772
         return false;
773 773
     }
774 774
 
@@ -783,34 +783,34 @@  discard block
 block discarded – undo
783 783
 
784 784
     // ----- Return
785 785
     return $v_result;
786
-  }
787
-  // ---------------------------------------------------------------------------
788
-
789
-  // ---------------------------------------------------------------------------
790
-  // Function : _create()
791
-  // Description :
792
-  // Parameters :
793
-  // Return Values :
794
-  // ---------------------------------------------------------------------------
795
-  /**
796
-  * Archive_Zip::_create()
797
-  *
798
-  * { Description }
799
-  *
800
-  */
801
-  public function _create($p_list, &$p_result_list, &$p_params)
802
-  {
803
-      $v_result=1;
804
-      $v_list_detail = array();
805
-
806
-      $p_add_dir = $p_params['add_path'];
807
-      $p_remove_dir = $p_params['remove_path'];
808
-      $p_remove_all_dir = $p_params['remove_all_path'];
786
+    }
787
+    // ---------------------------------------------------------------------------
788
+
789
+    // ---------------------------------------------------------------------------
790
+    // Function : _create()
791
+    // Description :
792
+    // Parameters :
793
+    // Return Values :
794
+    // ---------------------------------------------------------------------------
795
+    /**
796
+     * Archive_Zip::_create()
797
+     *
798
+     * { Description }
799
+     *
800
+     */
801
+    public function _create($p_list, &$p_result_list, &$p_params)
802
+    {
803
+        $v_result=1;
804
+        $v_list_detail = array();
805
+
806
+        $p_add_dir = $p_params['add_path'];
807
+        $p_remove_dir = $p_params['remove_path'];
808
+        $p_remove_all_dir = $p_params['remove_all_path'];
809 809
 
810 810
     // ----- Open the file in write mode
811 811
     if (($v_result = $this->_openFd('wb')) != 1) {
812 812
         // ----- Return
813
-      return $v_result;
813
+        return $v_result;
814 814
     }
815 815
 
816 816
     // ----- Add the list of files
@@ -821,29 +821,29 @@  discard block
 block discarded – undo
821 821
 
822 822
     // ----- Return
823 823
     return $v_result;
824
-  }
825
-  // ---------------------------------------------------------------------------
826
-
827
-  // ---------------------------------------------------------------------------
828
-  // Function : _add()
829
-  // Description :
830
-  // Parameters :
831
-  // Return Values :
832
-  // ---------------------------------------------------------------------------
833
-  /**
834
-  * Archive_Zip::_add()
835
-  *
836
-  * { Description }
837
-  *
838
-  */
839
-  public function _add($p_list, &$p_result_list, &$p_params)
840
-  {
841
-      $v_result=1;
842
-      $v_list_detail = array();
843
-
844
-      $p_add_dir = $p_params['add_path'];
845
-      $p_remove_dir = $p_params['remove_path'];
846
-      $p_remove_all_dir = $p_params['remove_all_path'];
824
+    }
825
+    // ---------------------------------------------------------------------------
826
+
827
+    // ---------------------------------------------------------------------------
828
+    // Function : _add()
829
+    // Description :
830
+    // Parameters :
831
+    // Return Values :
832
+    // ---------------------------------------------------------------------------
833
+    /**
834
+     * Archive_Zip::_add()
835
+     *
836
+     * { Description }
837
+     *
838
+     */
839
+    public function _add($p_list, &$p_result_list, &$p_params)
840
+    {
841
+        $v_result=1;
842
+        $v_list_detail = array();
843
+
844
+        $p_add_dir = $p_params['add_path'];
845
+        $p_remove_dir = $p_params['remove_path'];
846
+        $p_remove_all_dir = $p_params['remove_all_path'];
847 847
 
848 848
     // ----- Look if the archive exists or is empty and need to be created
849 849
     if ((!is_file($this->_zipname)) || (filesize($this->_zipname) == 0)) {
@@ -858,10 +858,10 @@  discard block
 block discarded – undo
858 858
 
859 859
     // ----- Read the central directory informations
860 860
     $v_central_dir = array();
861
-      if (($v_result = $this->_readEndCentralDir($v_central_dir)) != 1) {
862
-          $this->_closeFd();
863
-          return $v_result;
864
-      }
861
+        if (($v_result = $this->_readEndCentralDir($v_central_dir)) != 1) {
862
+            $this->_closeFd();
863
+            return $v_result;
864
+        }
865 865
 
866 866
     // ----- Go to beginning of File
867 867
     @rewind($this->_zip_fd);
@@ -874,8 +874,8 @@  discard block
 block discarded – undo
874 874
         $this->_closeFd();
875 875
 
876 876
         $this->_errorLog(ARCHIVE_ZIP_ERR_READ_OPEN_FAIL,
877
-                       'Unable to open temporary file \''
878
-                       .$v_zip_temp_name.'\' in binary write mode');
877
+                        'Unable to open temporary file \''
878
+                        .$v_zip_temp_name.'\' in binary write mode');
879 879
         return Archive_Zip::errorCode();
880 880
     }
881 881
 
@@ -883,64 +883,64 @@  discard block
 block discarded – undo
883 883
     // TBC : Here I should better append the file and go back to erase the
884 884
     // central dir
885 885
     $v_size = $v_central_dir['offset'];
886
-      while ($v_size != 0) {
887
-          $v_read_size = ($v_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
886
+        while ($v_size != 0) {
887
+            $v_read_size = ($v_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
888 888
                       ? $v_size : ARCHIVE_ZIP_READ_BLOCK_SIZE);
889
-          $v_buffer = fread($this->_zip_fd, $v_read_size);
890
-          @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
891
-          $v_size -= $v_read_size;
892
-      }
889
+            $v_buffer = fread($this->_zip_fd, $v_read_size);
890
+            @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
891
+            $v_size -= $v_read_size;
892
+        }
893 893
 
894 894
     // ----- Swap the file descriptor
895 895
     // Here is a trick : I swap the temporary fd with the zip fd, in order to
896 896
     // use the following methods on the temporary fil and not the real archive
897 897
     $v_swap = $this->_zip_fd;
898
-      $this->_zip_fd = $v_zip_temp_fd;
899
-      $v_zip_temp_fd = $v_swap;
898
+        $this->_zip_fd = $v_zip_temp_fd;
899
+        $v_zip_temp_fd = $v_swap;
900 900
 
901 901
     // ----- Add the files
902 902
     $v_header_list = array();
903
-      if (($v_result = $this->_addFileList($p_list, $v_header_list,
904
-                                         $p_add_dir, $p_remove_dir,
905
-                                         $p_remove_all_dir, $p_params)) != 1) {
906
-          fclose($v_zip_temp_fd);
907
-          $this->_closeFd();
908
-          @unlink($v_zip_temp_name);
903
+        if (($v_result = $this->_addFileList($p_list, $v_header_list,
904
+                                            $p_add_dir, $p_remove_dir,
905
+                                            $p_remove_all_dir, $p_params)) != 1) {
906
+            fclose($v_zip_temp_fd);
907
+            $this->_closeFd();
908
+            @unlink($v_zip_temp_name);
909 909
 
910
-      // ----- Return
911
-      return $v_result;
912
-      }
910
+        // ----- Return
911
+        return $v_result;
912
+        }
913 913
 
914 914
     // ----- Store the offset of the central dir
915 915
     $v_offset = @ftell($this->_zip_fd);
916 916
 
917 917
     // ----- Copy the block of file headers from the old archive
918 918
     $v_size = $v_central_dir['size'];
919
-      while ($v_size != 0) {
920
-          $v_read_size = ($v_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
919
+        while ($v_size != 0) {
920
+            $v_read_size = ($v_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
921 921
                       ? $v_size : ARCHIVE_ZIP_READ_BLOCK_SIZE);
922
-          $v_buffer = @fread($v_zip_temp_fd, $v_read_size);
923
-          @fwrite($this->_zip_fd, $v_buffer, $v_read_size);
924
-          $v_size -= $v_read_size;
925
-      }
922
+            $v_buffer = @fread($v_zip_temp_fd, $v_read_size);
923
+            @fwrite($this->_zip_fd, $v_buffer, $v_read_size);
924
+            $v_size -= $v_read_size;
925
+        }
926 926
 
927 927
     // ----- Create the Central Dir files header
928 928
     for ($i=0, $v_count=0; $i < count($v_header_list); $i++) {
929 929
         // ----- Create the file header
930
-      if ($v_header_list[$i]['status'] == 'ok') {
931
-          if (($v_result=$this->_writeCentralFileHeader($v_header_list[$i]))!=1) {
932
-              fclose($v_zip_temp_fd);
933
-              $this->_closeFd();
934
-              @unlink($v_zip_temp_name);
930
+        if ($v_header_list[$i]['status'] == 'ok') {
931
+            if (($v_result=$this->_writeCentralFileHeader($v_header_list[$i]))!=1) {
932
+                fclose($v_zip_temp_fd);
933
+                $this->_closeFd();
934
+                @unlink($v_zip_temp_name);
935 935
 
936
-          // ----- Return
937
-          return $v_result;
938
-          }
939
-          $v_count++;
940
-      }
936
+            // ----- Return
937
+            return $v_result;
938
+            }
939
+            $v_count++;
940
+        }
941 941
 
942
-      // ----- Transform the header to a 'usable' info
943
-      $this->_convertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
942
+        // ----- Transform the header to a 'usable' info
943
+        $this->_convertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
944 944
     }
945 945
 
946 946
     // ----- Zip file comment
@@ -955,16 +955,16 @@  discard block
 block discarded – undo
955 955
                                                 $v_size, $v_offset,
956 956
                                                 $v_comment)) != 1) {
957 957
         // ----- Reset the file list
958
-      unset($v_header_list);
958
+        unset($v_header_list);
959 959
 
960
-      // ----- Return
961
-      return $v_result;
960
+        // ----- Return
961
+        return $v_result;
962 962
     }
963 963
 
964 964
     // ----- Swap back the file descriptor
965 965
     $v_swap = $this->_zip_fd;
966
-      $this->_zip_fd = $v_zip_temp_fd;
967
-      $v_zip_temp_fd = $v_swap;
966
+        $this->_zip_fd = $v_zip_temp_fd;
967
+        $v_zip_temp_fd = $v_swap;
968 968
 
969 969
     // ----- Close
970 970
     $this->_closeFd();
@@ -983,100 +983,100 @@  discard block
 block discarded – undo
983 983
 
984 984
     // ----- Return
985 985
     return $v_result;
986
-  }
987
-  // ---------------------------------------------------------------------------
988
-
989
-  // ---------------------------------------------------------------------------
990
-  // Function : _openFd()
991
-  // Description :
992
-  // Parameters :
993
-  // ---------------------------------------------------------------------------
994
-  /**
995
-  * Archive_Zip::_openFd()
996
-  *
997
-  * { Description }
998
-  *
999
-  */
1000
-  public function _openFd($p_mode)
1001
-  {
1002
-      $v_result=1;
986
+    }
987
+    // ---------------------------------------------------------------------------
988
+
989
+    // ---------------------------------------------------------------------------
990
+    // Function : _openFd()
991
+    // Description :
992
+    // Parameters :
993
+    // ---------------------------------------------------------------------------
994
+    /**
995
+     * Archive_Zip::_openFd()
996
+     *
997
+     * { Description }
998
+     *
999
+     */
1000
+    public function _openFd($p_mode)
1001
+    {
1002
+        $v_result=1;
1003 1003
 
1004 1004
     // ----- Look if already open
1005 1005
     if ($this->_zip_fd != 0) {
1006 1006
         $this->_errorLog(ARCHIVE_ZIP_ERR_READ_OPEN_FAIL,
1007
-                       'Zip file \''.$this->_zipname.'\' already open');
1007
+                        'Zip file \''.$this->_zipname.'\' already open');
1008 1008
         return Archive_Zip::errorCode();
1009 1009
     }
1010 1010
 
1011 1011
     // ----- Open the zip file
1012 1012
     if (($this->_zip_fd = @fopen($this->_zipname, $p_mode)) == 0) {
1013 1013
         $this->_errorLog(ARCHIVE_ZIP_ERR_READ_OPEN_FAIL,
1014
-                       'Unable to open archive \''.$this->_zipname
1015
-                       .'\' in '.$p_mode.' mode');
1014
+                        'Unable to open archive \''.$this->_zipname
1015
+                        .'\' in '.$p_mode.' mode');
1016 1016
         return Archive_Zip::errorCode();
1017 1017
     }
1018 1018
 
1019 1019
     // ----- Return
1020 1020
     return $v_result;
1021
-  }
1022
-  // ---------------------------------------------------------------------------
1023
-
1024
-  // ---------------------------------------------------------------------------
1025
-  // Function : _closeFd()
1026
-  // Description :
1027
-  // Parameters :
1028
-  // ---------------------------------------------------------------------------
1029
-  /**
1030
-  * Archive_Zip::_closeFd()
1031
-  *
1032
-  * { Description }
1033
-  *
1034
-  */
1035
-  public function _closeFd()
1036
-  {
1037
-      $v_result=1;
1038
-
1039
-      if ($this->_zip_fd != 0) {
1040
-          @fclose($this->_zip_fd);
1041
-      }
1042
-      $this->_zip_fd = 0;
1021
+    }
1022
+    // ---------------------------------------------------------------------------
1023
+
1024
+    // ---------------------------------------------------------------------------
1025
+    // Function : _closeFd()
1026
+    // Description :
1027
+    // Parameters :
1028
+    // ---------------------------------------------------------------------------
1029
+    /**
1030
+     * Archive_Zip::_closeFd()
1031
+     *
1032
+     * { Description }
1033
+     *
1034
+     */
1035
+    public function _closeFd()
1036
+    {
1037
+        $v_result=1;
1038
+
1039
+        if ($this->_zip_fd != 0) {
1040
+            @fclose($this->_zip_fd);
1041
+        }
1042
+        $this->_zip_fd = 0;
1043 1043
 
1044 1044
     // ----- Return
1045 1045
     return $v_result;
1046
-  }
1047
-  // ---------------------------------------------------------------------------
1048
-
1049
-  // ---------------------------------------------------------------------------
1050
-  // Function : _addList()
1051
-  // Description :
1052
-  //   $p_add_dir and $p_remove_dir will give the ability to memorize a path which is
1053
-  //   different from the real path of the file. This is usefull if you want to have PclTar
1054
-  //   running in any directory, and memorize relative path from an other directory.
1055
-  // Parameters :
1056
-  //   $p_list : An array containing the file or directory names to add in the tar
1057
-  //   $p_result_list : list of added files with their properties (specially the status field)
1058
-  //   $p_add_dir : Path to add in the filename path archived
1059
-  //   $p_remove_dir : Path to remove in the filename path archived
1060
-  // Return Values :
1061
-  // ---------------------------------------------------------------------------
1062
-  /**
1063
-  * Archive_Zip::_addList()
1064
-  *
1065
-  * { Description }
1066
-  *
1067
-  */
1068
-  public function _addList($p_list, &$p_result_list,
1046
+    }
1047
+    // ---------------------------------------------------------------------------
1048
+
1049
+    // ---------------------------------------------------------------------------
1050
+    // Function : _addList()
1051
+    // Description :
1052
+    //   $p_add_dir and $p_remove_dir will give the ability to memorize a path which is
1053
+    //   different from the real path of the file. This is usefull if you want to have PclTar
1054
+    //   running in any directory, and memorize relative path from an other directory.
1055
+    // Parameters :
1056
+    //   $p_list : An array containing the file or directory names to add in the tar
1057
+    //   $p_result_list : list of added files with their properties (specially the status field)
1058
+    //   $p_add_dir : Path to add in the filename path archived
1059
+    //   $p_remove_dir : Path to remove in the filename path archived
1060
+    // Return Values :
1061
+    // ---------------------------------------------------------------------------
1062
+    /**
1063
+     * Archive_Zip::_addList()
1064
+     *
1065
+     * { Description }
1066
+     *
1067
+     */
1068
+    public function _addList($p_list, &$p_result_list,
1069 1069
                     $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_params)
1070
-  {
1071
-      $v_result=1;
1070
+    {
1071
+        $v_result=1;
1072 1072
 
1073 1073
     // ----- Add the files
1074 1074
     $v_header_list = array();
1075
-      if (($v_result = $this->_addFileList($p_list, $v_header_list,
1076
-                                         $p_add_dir, $p_remove_dir,
1077
-                                         $p_remove_all_dir, $p_params)) != 1) {
1078
-          return $v_result;
1079
-      }
1075
+        if (($v_result = $this->_addFileList($p_list, $v_header_list,
1076
+                                            $p_add_dir, $p_remove_dir,
1077
+                                            $p_remove_all_dir, $p_params)) != 1) {
1078
+            return $v_result;
1079
+        }
1080 1080
 
1081 1081
     // ----- Store the offset of the central dir
1082 1082
     $v_offset = @ftell($this->_zip_fd);
@@ -1084,15 +1084,15 @@  discard block
 block discarded – undo
1084 1084
     // ----- Create the Central Dir files header
1085 1085
     for ($i=0, $v_count=0; $i < count($v_header_list); $i++) {
1086 1086
         // ----- Create the file header
1087
-      if ($v_header_list[$i]['status'] == 'ok') {
1088
-          if (($v_result = $this->_writeCentralFileHeader($v_header_list[$i])) != 1) {
1089
-              return $v_result;
1090
-          }
1091
-          $v_count++;
1092
-      }
1087
+        if ($v_header_list[$i]['status'] == 'ok') {
1088
+            if (($v_result = $this->_writeCentralFileHeader($v_header_list[$i])) != 1) {
1089
+                return $v_result;
1090
+            }
1091
+            $v_count++;
1092
+        }
1093 1093
 
1094
-      // ----- Transform the header to a 'usable' info
1095
-      $this->_convertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
1094
+        // ----- Transform the header to a 'usable' info
1095
+        $this->_convertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
1096 1096
     }
1097 1097
 
1098 1098
     // ----- Zip file comment
@@ -1105,42 +1105,42 @@  discard block
 block discarded – undo
1105 1105
     if (($v_result = $this->_writeCentralHeader($v_count, $v_size, $v_offset,
1106 1106
                                                 $v_comment)) != 1) {
1107 1107
         // ----- Reset the file list
1108
-      unset($v_header_list);
1108
+        unset($v_header_list);
1109 1109
 
1110
-      // ----- Return
1111
-      return $v_result;
1110
+        // ----- Return
1111
+        return $v_result;
1112 1112
     }
1113 1113
 
1114 1114
     // ----- Return
1115 1115
     return $v_result;
1116
-  }
1117
-  // ---------------------------------------------------------------------------
1118
-
1119
-  // ---------------------------------------------------------------------------
1120
-  // Function : _addFileList()
1121
-  // Description :
1122
-  //   $p_add_dir and $p_remove_dir will give the ability to memorize a path which is
1123
-  //   different from the real path of the file. This is usefull if you want to
1124
-  //   run the lib in any directory, and memorize relative path from an other directory.
1125
-  // Parameters :
1126
-  //   $p_list : An array containing the file or directory names to add in the tar
1127
-  //   $p_result_list : list of added files with their properties (specially the status field)
1128
-  //   $p_add_dir : Path to add in the filename path archived
1129
-  //   $p_remove_dir : Path to remove in the filename path archived
1130
-  // Return Values :
1131
-  // ---------------------------------------------------------------------------
1132
-  /**
1133
-  * Archive_Zip::_addFileList()
1134
-  *
1135
-  * { Description }
1136
-  *
1137
-  */
1138
-  public function _addFileList($p_list, &$p_result_list,
1116
+    }
1117
+    // ---------------------------------------------------------------------------
1118
+
1119
+    // ---------------------------------------------------------------------------
1120
+    // Function : _addFileList()
1121
+    // Description :
1122
+    //   $p_add_dir and $p_remove_dir will give the ability to memorize a path which is
1123
+    //   different from the real path of the file. This is usefull if you want to
1124
+    //   run the lib in any directory, and memorize relative path from an other directory.
1125
+    // Parameters :
1126
+    //   $p_list : An array containing the file or directory names to add in the tar
1127
+    //   $p_result_list : list of added files with their properties (specially the status field)
1128
+    //   $p_add_dir : Path to add in the filename path archived
1129
+    //   $p_remove_dir : Path to remove in the filename path archived
1130
+    // Return Values :
1131
+    // ---------------------------------------------------------------------------
1132
+    /**
1133
+     * Archive_Zip::_addFileList()
1134
+     *
1135
+     * { Description }
1136
+     *
1137
+     */
1138
+    public function _addFileList($p_list, &$p_result_list,
1139 1139
                         $p_add_dir, $p_remove_dir, $p_remove_all_dir,
1140 1140
                         &$p_params)
1141
-  {
1142
-      $v_result=1;
1143
-      $v_header = array();
1141
+    {
1142
+        $v_result=1;
1143
+        $v_header = array();
1144 1144
 
1145 1145
     // ----- Recuperate the current number of elt in list
1146 1146
     $v_nb = count($p_result_list);
@@ -1148,34 +1148,34 @@  discard block
 block discarded – undo
1148 1148
     // ----- Loop on the files
1149 1149
     for ($j=0; ($j<count($p_list)) && ($v_result==1); $j++) {
1150 1150
         // ----- Recuperate the filename
1151
-      $p_filename = $this->_tool_TranslateWinPath($p_list[$j], false);
1152
-
1153
-      // ----- Skip empty file names
1154
-      if ($p_filename == '') {
1155
-          continue;
1156
-      }
1157
-
1158
-      // ----- Check the filename
1159
-      if (!file_exists($p_filename)) {
1160
-          $this->_errorLog(ARCHIVE_ZIP_ERR_MISSING_FILE,
1161
-                         "File '$p_filename' does not exists");
1162
-          return Archive_Zip::errorCode();
1163
-      }
1164
-
1165
-      // ----- Look if it is a file or a dir with no all pathnre move
1166
-      if (is_file($p_filename) || (is_dir($p_filename) && !$p_remove_all_dir)) {
1167
-          // ----- Add the file
1151
+        $p_filename = $this->_tool_TranslateWinPath($p_list[$j], false);
1152
+
1153
+        // ----- Skip empty file names
1154
+        if ($p_filename == '') {
1155
+            continue;
1156
+        }
1157
+
1158
+        // ----- Check the filename
1159
+        if (!file_exists($p_filename)) {
1160
+            $this->_errorLog(ARCHIVE_ZIP_ERR_MISSING_FILE,
1161
+                            "File '$p_filename' does not exists");
1162
+            return Archive_Zip::errorCode();
1163
+        }
1164
+
1165
+        // ----- Look if it is a file or a dir with no all pathnre move
1166
+        if (is_file($p_filename) || (is_dir($p_filename) && !$p_remove_all_dir)) {
1167
+            // ----- Add the file
1168 1168
         if (($v_result = $this->_addFile($p_filename, $v_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_params)) != 1) {
1169 1169
             // ----- Return status
1170
-          return $v_result;
1170
+            return $v_result;
1171 1171
         }
1172 1172
 
1173 1173
         // ----- Store the file infos
1174 1174
         $p_result_list[$v_nb++] = $v_header;
1175
-      }
1175
+        }
1176 1176
 
1177
-      // ----- Look for directory
1178
-      if (is_dir($p_filename)) {
1177
+        // ----- Look for directory
1178
+        if (is_dir($p_filename)) {
1179 1179
 
1180 1180
         // ----- Look for path
1181 1181
         if ($p_filename != '.') {
@@ -1186,69 +1186,69 @@  discard block
 block discarded – undo
1186 1186
 
1187 1187
         // ----- Read the directory for files and sub-directories
1188 1188
         $p_hdir = opendir($p_filename);
1189
-          $p_hitem = readdir($p_hdir); // '.' directory
1189
+            $p_hitem = readdir($p_hdir); // '.' directory
1190 1190
         $p_hitem = readdir($p_hdir); // '..' directory
1191 1191
         while ($p_hitem = readdir($p_hdir)) {
1192 1192
 
1193
-          // ----- Look for a file
1194
-          if (is_file($v_path.$p_hitem)) {
1193
+            // ----- Look for a file
1194
+            if (is_file($v_path.$p_hitem)) {
1195 1195
 
1196 1196
             // ----- Add the file
1197 1197
             if (($v_result = $this->_addFile($v_path.$p_hitem, $v_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_params)) != 1) {
1198 1198
                 // ----- Return status
1199
-              return $v_result;
1199
+                return $v_result;
1200 1200
             }
1201 1201
 
1202 1202
             // ----- Store the file infos
1203 1203
             $p_result_list[$v_nb++] = $v_header;
1204
-          }
1204
+            }
1205 1205
 
1206
-          // ----- Recursive call to _addFileList()
1207
-          else {
1206
+            // ----- Recursive call to _addFileList()
1207
+            else {
1208 1208
 
1209 1209
             // ----- Need an array as parameter
1210 1210
             $p_temp_list[0] = $v_path.$p_hitem;
1211
-              $v_result = $this->_addFileList($p_temp_list, $p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_params);
1211
+                $v_result = $this->_addFileList($p_temp_list, $p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_params);
1212 1212
 
1213 1213
             // ----- Update the number of elements of the list
1214 1214
             $v_nb = count($p_result_list);
1215
-          }
1215
+            }
1216 1216
         }
1217 1217
 
1218 1218
         // ----- Free memory for the recursive loop
1219 1219
         unset($p_temp_list);
1220
-          unset($p_hdir);
1221
-          unset($p_hitem);
1222
-      }
1223
-    }
1224
-
1225
-      return $v_result;
1226
-  }
1227
-  // ---------------------------------------------------------------------------
1228
-
1229
-  // ---------------------------------------------------------------------------
1230
-  // Function : _addFile()
1231
-  // Description :
1232
-  // Parameters :
1233
-  // Return Values :
1234
-  // ---------------------------------------------------------------------------
1235
-  /**
1236
-  * Archive_Zip::_addFile()
1237
-  *
1238
-  * { Description }
1239
-  *
1240
-  */
1241
-  public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_params)
1242
-  {
1243
-      $v_result=1;
1244
-
1245
-      if ($p_filename == '') {
1246
-          // ----- Error log
1247
-      $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAMETER, 'Invalid file list parameter (invalid or empty list)');
1220
+            unset($p_hdir);
1221
+            unset($p_hitem);
1222
+        }
1223
+    }
1248 1224
 
1249
-      // ----- Return
1250
-      return Archive_Zip::errorCode();
1251
-      }
1225
+        return $v_result;
1226
+    }
1227
+    // ---------------------------------------------------------------------------
1228
+
1229
+    // ---------------------------------------------------------------------------
1230
+    // Function : _addFile()
1231
+    // Description :
1232
+    // Parameters :
1233
+    // Return Values :
1234
+    // ---------------------------------------------------------------------------
1235
+    /**
1236
+     * Archive_Zip::_addFile()
1237
+     *
1238
+     * { Description }
1239
+     *
1240
+     */
1241
+    public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_params)
1242
+    {
1243
+        $v_result=1;
1244
+
1245
+        if ($p_filename == '') {
1246
+            // ----- Error log
1247
+        $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAMETER, 'Invalid file list parameter (invalid or empty list)');
1248
+
1249
+        // ----- Return
1250
+        return Archive_Zip::errorCode();
1251
+        }
1252 1252
 
1253 1253
     // ----- Calculate the stored filename
1254 1254
     $v_stored_filename = $p_filename;
@@ -1311,51 +1311,51 @@  discard block
 block discarded – undo
1311 1311
 
1312 1312
     // ----- Set the file properties
1313 1313
     clearstatcache();
1314
-      $p_header['version'] = 20;
1315
-      $p_header['version_extracted'] = 10;
1316
-      $p_header['flag'] = 0;
1317
-      $p_header['compression'] = 0;
1318
-      $p_header['mtime'] = filemtime($p_filename);
1319
-      $p_header['crc'] = 0;
1320
-      $p_header['compressed_size'] = 0;
1321
-      $p_header['size'] = filesize($p_filename);
1322
-      $p_header['filename_len'] = strlen($p_filename);
1323
-      $p_header['extra_len'] = 0;
1324
-      $p_header['comment_len'] = 0;
1325
-      $p_header['disk'] = 0;
1326
-      $p_header['internal'] = 0;
1327
-      $p_header['external'] = (is_file($p_filename)?0xFE49FFE0:0x41FF0010);
1328
-      $p_header['offset'] = 0;
1329
-      $p_header['filename'] = $p_filename;
1330
-      $p_header['stored_filename'] = $v_stored_filename;
1331
-      $p_header['extra'] = '';
1332
-      $p_header['comment'] = '';
1333
-      $p_header['status'] = 'ok';
1334
-      $p_header['index'] = -1;
1314
+        $p_header['version'] = 20;
1315
+        $p_header['version_extracted'] = 10;
1316
+        $p_header['flag'] = 0;
1317
+        $p_header['compression'] = 0;
1318
+        $p_header['mtime'] = filemtime($p_filename);
1319
+        $p_header['crc'] = 0;
1320
+        $p_header['compressed_size'] = 0;
1321
+        $p_header['size'] = filesize($p_filename);
1322
+        $p_header['filename_len'] = strlen($p_filename);
1323
+        $p_header['extra_len'] = 0;
1324
+        $p_header['comment_len'] = 0;
1325
+        $p_header['disk'] = 0;
1326
+        $p_header['internal'] = 0;
1327
+        $p_header['external'] = (is_file($p_filename)?0xFE49FFE0:0x41FF0010);
1328
+        $p_header['offset'] = 0;
1329
+        $p_header['filename'] = $p_filename;
1330
+        $p_header['stored_filename'] = $v_stored_filename;
1331
+        $p_header['extra'] = '';
1332
+        $p_header['comment'] = '';
1333
+        $p_header['status'] = 'ok';
1334
+        $p_header['index'] = -1;
1335 1335
 
1336 1336
     // ----- Look for pre-add callback
1337 1337
     if (isset($p_params[ARCHIVE_ZIP_PARAM_PRE_ADD])
1338 1338
         && ($p_params[ARCHIVE_ZIP_PARAM_PRE_ADD] != '')) {
1339 1339
 
1340
-      // ----- Generate a local information
1341
-      $v_local_header = array();
1340
+        // ----- Generate a local information
1341
+        $v_local_header = array();
1342 1342
         $this->_convertHeader2FileInfo($p_header, $v_local_header);
1343 1343
 
1344
-      // ----- Call the callback
1345
-      // Here I do not use call_user_func() because I need to send a reference to the
1346
-      // header.
1347
-      eval('$v_result = '.$p_params[ARCHIVE_ZIP_PARAM_PRE_ADD].'(ARCHIVE_ZIP_PARAM_PRE_ADD, $v_local_header);');
1344
+        // ----- Call the callback
1345
+        // Here I do not use call_user_func() because I need to send a reference to the
1346
+        // header.
1347
+        eval('$v_result = '.$p_params[ARCHIVE_ZIP_PARAM_PRE_ADD].'(ARCHIVE_ZIP_PARAM_PRE_ADD, $v_local_header);');
1348 1348
         if ($v_result == 0) {
1349 1349
             // ----- Change the file status
1350 1350
         $p_header['status'] = 'skipped';
1351 1351
             $v_result = 1;
1352 1352
         }
1353 1353
 
1354
-      // ----- Update the informations
1355
-      // Only some fields can be modified
1356
-      if ($p_header['stored_filename'] != $v_local_header['stored_filename']) {
1357
-          $p_header['stored_filename'] = $this->_tool_PathReduction($v_local_header['stored_filename']);
1358
-      }
1354
+        // ----- Update the informations
1355
+        // Only some fields can be modified
1356
+        if ($p_header['stored_filename'] != $v_local_header['stored_filename']) {
1357
+            $p_header['stored_filename'] = $this->_tool_PathReduction($v_local_header['stored_filename']);
1358
+        }
1359 1359
     }
1360 1360
 
1361 1361
     // ----- Look for empty stored filename
@@ -1371,34 +1371,34 @@  discard block
 block discarded – undo
1371 1371
     // ----- Look if no error, or file not skipped
1372 1372
     if ($p_header['status'] == 'ok') {
1373 1373
 
1374
-      // ----- Look for a file
1375
-      if (is_file($p_filename)) {
1376
-          // ----- Open the source file
1374
+        // ----- Look for a file
1375
+        if (is_file($p_filename)) {
1376
+            // ----- Open the source file
1377 1377
         if (($v_file = @fopen($p_filename, 'rb')) == 0) {
1378 1378
             $this->_errorLog(ARCHIVE_ZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
1379 1379
             return Archive_Zip::errorCode();
1380 1380
         }
1381 1381
 
1382
-          if ($p_params['no_compression']) {
1383
-              // ----- Read the file content
1384
-          $v_content_compressed = @fread($v_file, $p_header['size']);
1382
+            if ($p_params['no_compression']) {
1383
+                // ----- Read the file content
1384
+            $v_content_compressed = @fread($v_file, $p_header['size']);
1385 1385
 
1386
-          // ----- Calculate the CRC
1387
-          $p_header['crc'] = crc32($v_content_compressed);
1388
-          } else {
1389
-              // ----- Read the file content
1390
-          $v_content = @fread($v_file, $p_header['size']);
1386
+            // ----- Calculate the CRC
1387
+            $p_header['crc'] = crc32($v_content_compressed);
1388
+            } else {
1389
+                // ----- Read the file content
1390
+            $v_content = @fread($v_file, $p_header['size']);
1391 1391
 
1392
-          // ----- Calculate the CRC
1393
-          $p_header['crc'] = crc32($v_content);
1392
+            // ----- Calculate the CRC
1393
+            $p_header['crc'] = crc32($v_content);
1394 1394
 
1395
-          // ----- Compress the file
1396
-          $v_content_compressed = gzdeflate($v_content);
1397
-          }
1395
+            // ----- Compress the file
1396
+            $v_content_compressed = gzdeflate($v_content);
1397
+            }
1398 1398
 
1399 1399
         // ----- Set header parameters
1400 1400
         $p_header['compressed_size'] = strlen($v_content_compressed);
1401
-          $p_header['compression'] = 8;
1401
+            $p_header['compression'] = 8;
1402 1402
 
1403 1403
         // ----- Call the header generation
1404 1404
         if (($v_result = $this->_writeFileHeader($p_header)) != 1) {
@@ -1408,68 +1408,68 @@  discard block
 block discarded – undo
1408 1408
 
1409 1409
         // ----- Write the compressed content
1410 1410
         $v_binary_data = pack('a'.$p_header['compressed_size'], $v_content_compressed);
1411
-          @fwrite($this->_zip_fd, $v_binary_data, $p_header['compressed_size']);
1411
+            @fwrite($this->_zip_fd, $v_binary_data, $p_header['compressed_size']);
1412 1412
 
1413 1413
         // ----- Close the file
1414 1414
         @fclose($v_file);
1415
-      }
1415
+        }
1416 1416
 
1417
-      // ----- Look for a directory
1418
-      else {
1419
-          // ----- Set the file properties
1417
+        // ----- Look for a directory
1418
+        else {
1419
+            // ----- Set the file properties
1420 1420
         $p_header['filename'] .= '/';
1421
-          $p_header['filename_len']++;
1422
-          $p_header['size'] = 0;
1423
-          $p_header['external'] = 0x41FF0010;   // Value for a folder : to be checked
1421
+            $p_header['filename_len']++;
1422
+            $p_header['size'] = 0;
1423
+            $p_header['external'] = 0x41FF0010;   // Value for a folder : to be checked
1424 1424
 
1425 1425
         // ----- Call the header generation
1426 1426
         if (($v_result = $this->_writeFileHeader($p_header)) != 1) {
1427 1427
             return $v_result;
1428 1428
         }
1429
-      }
1429
+        }
1430 1430
     }
1431 1431
 
1432 1432
     // ----- Look for pre-add callback
1433 1433
     if (isset($p_params[ARCHIVE_ZIP_PARAM_POST_ADD])
1434 1434
         && ($p_params[ARCHIVE_ZIP_PARAM_POST_ADD] != '')) {
1435 1435
 
1436
-      // ----- Generate a local information
1437
-      $v_local_header = array();
1436
+        // ----- Generate a local information
1437
+        $v_local_header = array();
1438 1438
         $this->_convertHeader2FileInfo($p_header, $v_local_header);
1439 1439
 
1440
-      // ----- Call the callback
1441
-      // Here I do not use call_user_func() because I need to send a reference to the
1442
-      // header.
1443
-      eval('$v_result = '.$p_params[ARCHIVE_ZIP_PARAM_POST_ADD].'(ARCHIVE_ZIP_PARAM_POST_ADD, $v_local_header);');
1440
+        // ----- Call the callback
1441
+        // Here I do not use call_user_func() because I need to send a reference to the
1442
+        // header.
1443
+        eval('$v_result = '.$p_params[ARCHIVE_ZIP_PARAM_POST_ADD].'(ARCHIVE_ZIP_PARAM_POST_ADD, $v_local_header);');
1444 1444
         if ($v_result == 0) {
1445 1445
             // ----- Ignored
1446 1446
         $v_result = 1;
1447 1447
         }
1448 1448
 
1449
-      // ----- Update the informations
1450
-      // Nothing can be modified
1449
+        // ----- Update the informations
1450
+        // Nothing can be modified
1451 1451
     }
1452 1452
 
1453 1453
     // ----- Return
1454 1454
     return $v_result;
1455
-  }
1456
-  // ---------------------------------------------------------------------------
1457
-
1458
-  // ---------------------------------------------------------------------------
1459
-  // Function : _writeFileHeader()
1460
-  // Description :
1461
-  // Parameters :
1462
-  // Return Values :
1463
-  // ---------------------------------------------------------------------------
1464
-  /**
1465
-  * Archive_Zip::_writeFileHeader()
1466
-  *
1467
-  * { Description }
1468
-  *
1469
-  */
1470
-  public function _writeFileHeader(&$p_header)
1471
-  {
1472
-      $v_result=1;
1455
+    }
1456
+    // ---------------------------------------------------------------------------
1457
+
1458
+    // ---------------------------------------------------------------------------
1459
+    // Function : _writeFileHeader()
1460
+    // Description :
1461
+    // Parameters :
1462
+    // Return Values :
1463
+    // ---------------------------------------------------------------------------
1464
+    /**
1465
+     * Archive_Zip::_writeFileHeader()
1466
+     *
1467
+     * { Description }
1468
+     *
1469
+     */
1470
+    public function _writeFileHeader(&$p_header)
1471
+    {
1472
+        $v_result=1;
1473 1473
 
1474 1474
     // TBC
1475 1475
     //for(reset($p_header); $key = key($p_header); next($p_header)) {
@@ -1480,14 +1480,14 @@  discard block
 block discarded – undo
1480 1480
 
1481 1481
     // ----- Transform UNIX mtime to DOS format mdate/mtime
1482 1482
     $v_date = getdate($p_header['mtime']);
1483
-      $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
1484
-      $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
1483
+        $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
1484
+        $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
1485 1485
 
1486 1486
     // ----- Packed data
1487 1487
     $v_binary_data = pack('VvvvvvVVVvv', 0x04034b50, $p_header['version'], $p_header['flag'],
1488
-                          $p_header['compression'], $v_mtime, $v_mdate,
1489
-                          $p_header['crc'], $p_header['compressed_size'], $p_header['size'],
1490
-                          strlen($p_header['stored_filename']), $p_header['extra_len']);
1488
+                            $p_header['compression'], $v_mtime, $v_mdate,
1489
+                            $p_header['crc'], $p_header['compressed_size'], $p_header['size'],
1490
+                            strlen($p_header['stored_filename']), $p_header['extra_len']);
1491 1491
 
1492 1492
     // ----- Write the first 148 bytes of the header in the archive
1493 1493
     fwrite($this->_zip_fd, $v_binary_data, 30);
@@ -1496,30 +1496,30 @@  discard block
 block discarded – undo
1496 1496
     if (strlen($p_header['stored_filename']) != 0) {
1497 1497
         fwrite($this->_zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename']));
1498 1498
     }
1499
-      if ($p_header['extra_len'] != 0) {
1500
-          fwrite($this->_zip_fd, $p_header['extra'], $p_header['extra_len']);
1501
-      }
1499
+        if ($p_header['extra_len'] != 0) {
1500
+            fwrite($this->_zip_fd, $p_header['extra'], $p_header['extra_len']);
1501
+        }
1502 1502
 
1503 1503
     // ----- Return
1504 1504
     return $v_result;
1505
-  }
1506
-  // ---------------------------------------------------------------------------
1507
-
1508
-  // ---------------------------------------------------------------------------
1509
-  // Function : _writeCentralFileHeader()
1510
-  // Description :
1511
-  // Parameters :
1512
-  // Return Values :
1513
-  // ---------------------------------------------------------------------------
1514
-  /**
1515
-  * Archive_Zip::_writeCentralFileHeader()
1516
-  *
1517
-  * { Description }
1518
-  *
1519
-  */
1520
-  public function _writeCentralFileHeader(&$p_header)
1521
-  {
1522
-      $v_result=1;
1505
+    }
1506
+    // ---------------------------------------------------------------------------
1507
+
1508
+    // ---------------------------------------------------------------------------
1509
+    // Function : _writeCentralFileHeader()
1510
+    // Description :
1511
+    // Parameters :
1512
+    // Return Values :
1513
+    // ---------------------------------------------------------------------------
1514
+    /**
1515
+     * Archive_Zip::_writeCentralFileHeader()
1516
+     *
1517
+     * { Description }
1518
+     *
1519
+     */
1520
+    public function _writeCentralFileHeader(&$p_header)
1521
+    {
1522
+        $v_result=1;
1523 1523
 
1524 1524
     // TBC
1525 1525
     //for(reset($p_header); $key = key($p_header); next($p_header)) {
@@ -1527,15 +1527,15 @@  discard block
 block discarded – undo
1527 1527
 
1528 1528
     // ----- Transform UNIX mtime to DOS format mdate/mtime
1529 1529
     $v_date = getdate($p_header['mtime']);
1530
-      $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
1531
-      $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
1530
+        $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
1531
+        $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
1532 1532
 
1533 1533
     // ----- Packed data
1534 1534
     $v_binary_data = pack('VvvvvvvVVVvvvvvVV', 0x02014b50, $p_header['version'], $p_header['version_extracted'],
1535
-                          $p_header['flag'], $p_header['compression'], $v_mtime, $v_mdate, $p_header['crc'],
1536
-                          $p_header['compressed_size'], $p_header['size'],
1537
-                          strlen($p_header['stored_filename']), $p_header['extra_len'], $p_header['comment_len'],
1538
-                          $p_header['disk'], $p_header['internal'], $p_header['external'], $p_header['offset']);
1535
+                            $p_header['flag'], $p_header['compression'], $v_mtime, $v_mdate, $p_header['crc'],
1536
+                            $p_header['compressed_size'], $p_header['size'],
1537
+                            strlen($p_header['stored_filename']), $p_header['extra_len'], $p_header['comment_len'],
1538
+                            $p_header['disk'], $p_header['internal'], $p_header['external'], $p_header['offset']);
1539 1539
 
1540 1540
     // ----- Write the 42 bytes of the header in the zip file
1541 1541
     fwrite($this->_zip_fd, $v_binary_data, 46);
@@ -1544,33 +1544,33 @@  discard block
 block discarded – undo
1544 1544
     if (strlen($p_header['stored_filename']) != 0) {
1545 1545
         fwrite($this->_zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename']));
1546 1546
     }
1547
-      if ($p_header['extra_len'] != 0) {
1548
-          fwrite($this->_zip_fd, $p_header['extra'], $p_header['extra_len']);
1549
-      }
1550
-      if ($p_header['comment_len'] != 0) {
1551
-          fwrite($this->_zip_fd, $p_header['comment'], $p_header['comment_len']);
1552
-      }
1547
+        if ($p_header['extra_len'] != 0) {
1548
+            fwrite($this->_zip_fd, $p_header['extra'], $p_header['extra_len']);
1549
+        }
1550
+        if ($p_header['comment_len'] != 0) {
1551
+            fwrite($this->_zip_fd, $p_header['comment'], $p_header['comment_len']);
1552
+        }
1553 1553
 
1554 1554
     // ----- Return
1555 1555
     return $v_result;
1556
-  }
1557
-  // ---------------------------------------------------------------------------
1558
-
1559
-  // ---------------------------------------------------------------------------
1560
-  // Function : _writeCentralHeader()
1561
-  // Description :
1562
-  // Parameters :
1563
-  // Return Values :
1564
-  // ---------------------------------------------------------------------------
1565
-  /**
1566
-  * Archive_Zip::_writeCentralHeader()
1567
-  *
1568
-  * { Description }
1569
-  *
1570
-  */
1571
-  public function _writeCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment)
1572
-  {
1573
-      $v_result=1;
1556
+    }
1557
+    // ---------------------------------------------------------------------------
1558
+
1559
+    // ---------------------------------------------------------------------------
1560
+    // Function : _writeCentralHeader()
1561
+    // Description :
1562
+    // Parameters :
1563
+    // Return Values :
1564
+    // ---------------------------------------------------------------------------
1565
+    /**
1566
+     * Archive_Zip::_writeCentralHeader()
1567
+     *
1568
+     * { Description }
1569
+     *
1570
+     */
1571
+    public function _writeCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment)
1572
+    {
1573
+        $v_result=1;
1574 1574
 
1575 1575
     // ----- Packed data
1576 1576
     $v_binary_data = pack('VvvvvVVv', 0x06054b50, 0, 0, $p_nb_entries, $p_nb_entries, $p_size, $p_offset, strlen($p_comment));
@@ -1585,60 +1585,60 @@  discard block
 block discarded – undo
1585 1585
 
1586 1586
     // ----- Return
1587 1587
     return $v_result;
1588
-  }
1589
-  // ---------------------------------------------------------------------------
1590
-
1591
-  // ---------------------------------------------------------------------------
1592
-  // Function : _list()
1593
-  // Description :
1594
-  // Parameters :
1595
-  // Return Values :
1596
-  // ---------------------------------------------------------------------------
1597
-  /**
1598
-  * Archive_Zip::_list()
1599
-  *
1600
-  * { Description }
1601
-  *
1602
-  */
1603
-  public function _list(&$p_list)
1604
-  {
1605
-      $v_result=1;
1588
+    }
1589
+    // ---------------------------------------------------------------------------
1590
+
1591
+    // ---------------------------------------------------------------------------
1592
+    // Function : _list()
1593
+    // Description :
1594
+    // Parameters :
1595
+    // Return Values :
1596
+    // ---------------------------------------------------------------------------
1597
+    /**
1598
+     * Archive_Zip::_list()
1599
+     *
1600
+     * { Description }
1601
+     *
1602
+     */
1603
+    public function _list(&$p_list)
1604
+    {
1605
+        $v_result=1;
1606 1606
 
1607 1607
     // ----- Open the zip file
1608 1608
     if (($this->_zip_fd = @fopen($this->_zipname, 'rb')) == 0) {
1609 1609
         // ----- Error log
1610
-      $this->_errorLog(ARCHIVE_ZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->_zipname.'\' in binary read mode');
1610
+        $this->_errorLog(ARCHIVE_ZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->_zipname.'\' in binary read mode');
1611 1611
 
1612
-      // ----- Return
1613
-      return Archive_Zip::errorCode();
1612
+        // ----- Return
1613
+        return Archive_Zip::errorCode();
1614 1614
     }
1615 1615
 
1616 1616
     // ----- Read the central directory informations
1617 1617
     $v_central_dir = array();
1618
-      if (($v_result = $this->_readEndCentralDir($v_central_dir)) != 1) {
1619
-          return $v_result;
1620
-      }
1618
+        if (($v_result = $this->_readEndCentralDir($v_central_dir)) != 1) {
1619
+            return $v_result;
1620
+        }
1621 1621
 
1622 1622
     // ----- Go to beginning of Central Dir
1623 1623
     @rewind($this->_zip_fd);
1624
-      if (@fseek($this->_zip_fd, $v_central_dir['offset'])) {
1625
-          // ----- Error log
1626
-      $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
1624
+        if (@fseek($this->_zip_fd, $v_central_dir['offset'])) {
1625
+            // ----- Error log
1626
+        $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
1627 1627
 
1628
-      // ----- Return
1629
-      return Archive_Zip::errorCode();
1630
-      }
1628
+        // ----- Return
1629
+        return Archive_Zip::errorCode();
1630
+        }
1631 1631
 
1632 1632
     // ----- Read each entry
1633 1633
     for ($i=0; $i<$v_central_dir['entries']; $i++) {
1634 1634
         // ----- Read the file header
1635
-      if (($v_result = $this->_readCentralFileHeader($v_header)) != 1) {
1636
-          return $v_result;
1637
-      }
1635
+        if (($v_result = $this->_readCentralFileHeader($v_header)) != 1) {
1636
+            return $v_result;
1637
+        }
1638 1638
         $v_header['index'] = $i;
1639 1639
 
1640
-      // ----- Get the only interesting attributes
1641
-      $this->_convertHeader2FileInfo($v_header, $p_list[$i]);
1640
+        // ----- Get the only interesting attributes
1641
+        $this->_convertHeader2FileInfo($v_header, $p_list[$i]);
1642 1642
         unset($v_header);
1643 1643
     }
1644 1644
 
@@ -1647,82 +1647,82 @@  discard block
 block discarded – undo
1647 1647
 
1648 1648
     // ----- Return
1649 1649
     return $v_result;
1650
-  }
1651
-  // ---------------------------------------------------------------------------
1652
-
1653
-  // ---------------------------------------------------------------------------
1654
-  // Function : _convertHeader2FileInfo()
1655
-  // Description :
1656
-  //   This function takes the file informations from the central directory
1657
-  //   entries and extract the interesting parameters that will be given back.
1658
-  //   The resulting file infos are set in the array $p_info
1659
-  //     $p_info['filename'] : Filename with full path. Given by user (add),
1660
-  //                           extracted in the filesystem (extract).
1661
-  //     $p_info['stored_filename'] : Stored filename in the archive.
1662
-  //     $p_info['size'] = Size of the file.
1663
-  //     $p_info['compressed_size'] = Compressed size of the file.
1664
-  //     $p_info['mtime'] = Last modification date of the file.
1665
-  //     $p_info['comment'] = Comment associated with the file.
1666
-  //     $p_info['folder'] = true/false : indicates if the entry is a folder or not.
1667
-  //     $p_info['status'] = status of the action on the file.
1668
-  // Parameters :
1669
-  // Return Values :
1670
-  // ---------------------------------------------------------------------------
1671
-  /**
1672
-  * Archive_Zip::_convertHeader2FileInfo()
1673
-  *
1674
-  * { Description }
1675
-  *
1676
-  */
1677
-  public function _convertHeader2FileInfo($p_header, &$p_info)
1678
-  {
1679
-      $v_result=1;
1650
+    }
1651
+    // ---------------------------------------------------------------------------
1652
+
1653
+    // ---------------------------------------------------------------------------
1654
+    // Function : _convertHeader2FileInfo()
1655
+    // Description :
1656
+    //   This function takes the file informations from the central directory
1657
+    //   entries and extract the interesting parameters that will be given back.
1658
+    //   The resulting file infos are set in the array $p_info
1659
+    //     $p_info['filename'] : Filename with full path. Given by user (add),
1660
+    //                           extracted in the filesystem (extract).
1661
+    //     $p_info['stored_filename'] : Stored filename in the archive.
1662
+    //     $p_info['size'] = Size of the file.
1663
+    //     $p_info['compressed_size'] = Compressed size of the file.
1664
+    //     $p_info['mtime'] = Last modification date of the file.
1665
+    //     $p_info['comment'] = Comment associated with the file.
1666
+    //     $p_info['folder'] = true/false : indicates if the entry is a folder or not.
1667
+    //     $p_info['status'] = status of the action on the file.
1668
+    // Parameters :
1669
+    // Return Values :
1670
+    // ---------------------------------------------------------------------------
1671
+    /**
1672
+     * Archive_Zip::_convertHeader2FileInfo()
1673
+     *
1674
+     * { Description }
1675
+     *
1676
+     */
1677
+    public function _convertHeader2FileInfo($p_header, &$p_info)
1678
+    {
1679
+        $v_result=1;
1680 1680
 
1681 1681
     // ----- Get the interesting attributes
1682 1682
     $p_info['filename'] = $p_header['filename'];
1683
-      $p_info['stored_filename'] = $p_header['stored_filename'];
1684
-      $p_info['size'] = $p_header['size'];
1685
-      $p_info['compressed_size'] = $p_header['compressed_size'];
1686
-      $p_info['mtime'] = $p_header['mtime'];
1687
-      $p_info['comment'] = $p_header['comment'];
1688
-      $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010);
1689
-      $p_info['index'] = $p_header['index'];
1690
-      $p_info['status'] = $p_header['status'];
1683
+        $p_info['stored_filename'] = $p_header['stored_filename'];
1684
+        $p_info['size'] = $p_header['size'];
1685
+        $p_info['compressed_size'] = $p_header['compressed_size'];
1686
+        $p_info['mtime'] = $p_header['mtime'];
1687
+        $p_info['comment'] = $p_header['comment'];
1688
+        $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010);
1689
+        $p_info['index'] = $p_header['index'];
1690
+        $p_info['status'] = $p_header['status'];
1691 1691
 
1692 1692
     // ----- Return
1693 1693
     return $v_result;
1694
-  }
1695
-  // ---------------------------------------------------------------------------
1696
-
1697
-  // ---------------------------------------------------------------------------
1698
-  // Function : _extractByRule()
1699
-  // Description :
1700
-  //   Extract a file or directory depending of rules (by index, by name, ...)
1701
-  // Parameters :
1702
-  //   $p_file_list : An array where will be placed the properties of each
1703
-  //                  extracted file
1704
-  //   $p_path : Path to add while writing the extracted files
1705
-  //   $p_remove_path : Path to remove (from the file memorized path) while writing the
1706
-  //                    extracted files. If the path does not match the file path,
1707
-  //                    the file is extracted with its memorized path.
1708
-  //                    $p_remove_path does not apply to 'list' mode.
1709
-  //                    $p_path and $p_remove_path are commulative.
1710
-  // Return Values :
1711
-  //   1 on success,0 or less on error (see error code list)
1712
-  // ---------------------------------------------------------------------------
1713
-  /**
1714
-  * Archive_Zip::_extractByRule()
1715
-  *
1716
-  * { Description }
1717
-  *
1718
-  */
1719
-  public function _extractByRule(&$p_file_list, &$p_params)
1720
-  {
1721
-      $v_result=1;
1722
-
1723
-      $p_path = $p_params['add_path'];
1724
-      $p_remove_path = $p_params['remove_path'];
1725
-      $p_remove_all_path = $p_params['remove_all_path'];
1694
+    }
1695
+    // ---------------------------------------------------------------------------
1696
+
1697
+    // ---------------------------------------------------------------------------
1698
+    // Function : _extractByRule()
1699
+    // Description :
1700
+    //   Extract a file or directory depending of rules (by index, by name, ...)
1701
+    // Parameters :
1702
+    //   $p_file_list : An array where will be placed the properties of each
1703
+    //                  extracted file
1704
+    //   $p_path : Path to add while writing the extracted files
1705
+    //   $p_remove_path : Path to remove (from the file memorized path) while writing the
1706
+    //                    extracted files. If the path does not match the file path,
1707
+    //                    the file is extracted with its memorized path.
1708
+    //                    $p_remove_path does not apply to 'list' mode.
1709
+    //                    $p_path and $p_remove_path are commulative.
1710
+    // Return Values :
1711
+    //   1 on success,0 or less on error (see error code list)
1712
+    // ---------------------------------------------------------------------------
1713
+    /**
1714
+     * Archive_Zip::_extractByRule()
1715
+     *
1716
+     * { Description }
1717
+     *
1718
+     */
1719
+    public function _extractByRule(&$p_file_list, &$p_params)
1720
+    {
1721
+        $v_result=1;
1722
+
1723
+        $p_path = $p_params['add_path'];
1724
+        $p_remove_path = $p_params['remove_path'];
1725
+        $p_remove_all_path = $p_params['remove_all_path'];
1726 1726
 
1727 1727
     // ----- Check the path
1728 1728
     if (($p_path == '')
@@ -1734,16 +1734,16 @@  discard block
 block discarded – undo
1734 1734
     // ----- Reduce the path last (and duplicated) '/'
1735 1735
     if (($p_path != './') && ($p_path != '/')) {
1736 1736
         // ----- Look for the path end '/'
1737
-      while (substr($p_path, -1) == '/') {
1738
-          $p_path = substr($p_path, 0, strlen($p_path)-1);
1739
-      }
1737
+        while (substr($p_path, -1) == '/') {
1738
+            $p_path = substr($p_path, 0, strlen($p_path)-1);
1739
+        }
1740 1740
     }
1741 1741
 
1742 1742
     // ----- Look for path to remove format (should end by /)
1743 1743
     if (($p_remove_path != '') && (substr($p_remove_path, -1) != '/')) {
1744 1744
         $p_remove_path .= '/';
1745 1745
     }
1746
-      $p_remove_path_size = strlen($p_remove_path);
1746
+        $p_remove_path_size = strlen($p_remove_path);
1747 1747
 
1748 1748
     // ----- Open the zip file
1749 1749
     if (($v_result = $this->_openFd('rb')) != 1) {
@@ -1752,202 +1752,202 @@  discard block
 block discarded – undo
1752 1752
 
1753 1753
     // ----- Read the central directory informations
1754 1754
     $v_central_dir = array();
1755
-      if (($v_result = $this->_readEndCentralDir($v_central_dir)) != 1) {
1756
-          // ----- Close the zip file
1757
-      $this->_closeFd();
1755
+        if (($v_result = $this->_readEndCentralDir($v_central_dir)) != 1) {
1756
+            // ----- Close the zip file
1757
+        $this->_closeFd();
1758 1758
 
1759
-          return $v_result;
1760
-      }
1759
+            return $v_result;
1760
+        }
1761 1761
 
1762 1762
     // ----- Start at beginning of Central Dir
1763 1763
     $v_pos_entry = $v_central_dir['offset'];
1764 1764
 
1765 1765
     // ----- Read each entry
1766 1766
     $j_start = 0;
1767
-      for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) {
1768
-          // ----- Read next Central dir entry
1769
-      @rewind($this->_zip_fd);
1770
-          if (@fseek($this->_zip_fd, $v_pos_entry)) {
1771
-              $this->_closeFd();
1767
+        for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) {
1768
+            // ----- Read next Central dir entry
1769
+        @rewind($this->_zip_fd);
1770
+            if (@fseek($this->_zip_fd, $v_pos_entry)) {
1771
+                $this->_closeFd();
1772 1772
 
1773
-              $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_ARCHIVE_ZIP,
1774
-                         'Invalid archive size');
1773
+                $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_ARCHIVE_ZIP,
1774
+                            'Invalid archive size');
1775 1775
 
1776
-              return Archive_Zip::errorCode();
1777
-          }
1776
+                return Archive_Zip::errorCode();
1777
+            }
1778 1778
 
1779
-      // ----- Read the file header
1780
-      $v_header = array();
1781
-          if (($v_result = $this->_readCentralFileHeader($v_header)) != 1) {
1782
-              $this->_closeFd();
1779
+        // ----- Read the file header
1780
+        $v_header = array();
1781
+            if (($v_result = $this->_readCentralFileHeader($v_header)) != 1) {
1782
+                $this->_closeFd();
1783 1783
 
1784
-              return $v_result;
1785
-          }
1784
+                return $v_result;
1785
+            }
1786 1786
 
1787
-      // ----- Store the index
1788
-      $v_header['index'] = $i;
1787
+        // ----- Store the index
1788
+        $v_header['index'] = $i;
1789 1789
 
1790
-      // ----- Store the file position
1791
-      $v_pos_entry = ftell($this->_zip_fd);
1790
+        // ----- Store the file position
1791
+        $v_pos_entry = ftell($this->_zip_fd);
1792 1792
 
1793
-      // ----- Look for the specific extract rules
1794
-      $v_extract = false;
1793
+        // ----- Look for the specific extract rules
1794
+        $v_extract = false;
1795 1795
 
1796
-      // ----- Look for extract by name rule
1797
-      if (isset($p_params[ARCHIVE_ZIP_PARAM_BY_NAME])
1796
+        // ----- Look for extract by name rule
1797
+        if (isset($p_params[ARCHIVE_ZIP_PARAM_BY_NAME])
1798 1798
           && ($p_params[ARCHIVE_ZIP_PARAM_BY_NAME] != 0)) {
1799 1799
 
1800
-          // ----- Look if the filename is in the list
1801
-          for ($j=0;
1802
-                  ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_NAME]))
1800
+            // ----- Look if the filename is in the list
1801
+            for ($j=0;
1802
+                    ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_NAME]))
1803 1803
                && (!$v_extract);
1804
-               $j++) {
1804
+                $j++) {
1805 1805
 
1806
-              // ----- Look for a directory
1807
-              if (substr($p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j], -1) == '/') {
1806
+                // ----- Look for a directory
1807
+                if (substr($p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j], -1) == '/') {
1808 1808
 
1809
-                  // ----- Look if the directory is in the filename path
1810
-                  if ((strlen($v_header['stored_filename']) > strlen($p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j]))
1809
+                    // ----- Look if the directory is in the filename path
1810
+                    if ((strlen($v_header['stored_filename']) > strlen($p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j]))
1811 1811
                       && (substr($v_header['stored_filename'], 0, strlen($p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) == $p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) {
1812
-                      $v_extract = true;
1813
-                  }
1814
-              }
1815
-              // ----- Look for a filename
1816
-              elseif ($v_header['stored_filename'] == $p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j]) {
1817
-                  $v_extract = true;
1818
-              }
1819
-          }
1820
-      }
1821
-
1822
-      // ----- Look for extract by ereg rule
1823
-      elseif (isset($p_params[ARCHIVE_ZIP_PARAM_BY_EREG])
1812
+                        $v_extract = true;
1813
+                    }
1814
+                }
1815
+                // ----- Look for a filename
1816
+                elseif ($v_header['stored_filename'] == $p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j]) {
1817
+                    $v_extract = true;
1818
+                }
1819
+            }
1820
+        }
1821
+
1822
+        // ----- Look for extract by ereg rule
1823
+        elseif (isset($p_params[ARCHIVE_ZIP_PARAM_BY_EREG])
1824 1824
               && ($p_params[ARCHIVE_ZIP_PARAM_BY_EREG] != '')) {
1825
-          if (ereg($p_params[ARCHIVE_ZIP_PARAM_BY_EREG], $v_header['stored_filename'])) {
1826
-              $v_extract = true;
1827
-          }
1828
-      }
1825
+            if (ereg($p_params[ARCHIVE_ZIP_PARAM_BY_EREG], $v_header['stored_filename'])) {
1826
+                $v_extract = true;
1827
+            }
1828
+        }
1829 1829
 
1830
-      // ----- Look for extract by preg rule
1831
-      elseif (isset($p_params[ARCHIVE_ZIP_PARAM_BY_PREG])
1830
+        // ----- Look for extract by preg rule
1831
+        elseif (isset($p_params[ARCHIVE_ZIP_PARAM_BY_PREG])
1832 1832
               && ($p_params[ARCHIVE_ZIP_PARAM_BY_PREG] != '')) {
1833
-          if (preg_match($p_params[ARCHIVE_ZIP_PARAM_BY_PREG], $v_header['stored_filename'])) {
1834
-              $v_extract = true;
1835
-          }
1836
-      }
1833
+            if (preg_match($p_params[ARCHIVE_ZIP_PARAM_BY_PREG], $v_header['stored_filename'])) {
1834
+                $v_extract = true;
1835
+            }
1836
+        }
1837 1837
 
1838
-      // ----- Look for extract by index rule
1839
-      elseif (isset($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])
1838
+        // ----- Look for extract by index rule
1839
+        elseif (isset($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])
1840 1840
                && ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX] != 0)) {
1841 1841
 
1842
-          // ----- Look if the index is in the list
1843
-          for ($j=$j_start; ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) && (!$v_extract); $j++) {
1844
-              if (($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']) && ($i<=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) {
1845
-                  $v_extract = true;
1846
-              }
1847
-              if ($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) {
1848
-                  $j_start = $j+1;
1849
-              }
1850
-
1851
-              if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']>$i) {
1852
-                  break;
1853
-              }
1854
-          }
1855
-      }
1842
+            // ----- Look if the index is in the list
1843
+            for ($j=$j_start; ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) && (!$v_extract); $j++) {
1844
+                if (($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']) && ($i<=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) {
1845
+                    $v_extract = true;
1846
+                }
1847
+                if ($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) {
1848
+                    $j_start = $j+1;
1849
+                }
1850
+
1851
+                if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']>$i) {
1852
+                    break;
1853
+                }
1854
+            }
1855
+        }
1856 1856
 
1857
-      // ----- Look for no rule, which means extract all the archive
1858
-      else {
1859
-          $v_extract = true;
1860
-      }
1857
+        // ----- Look for no rule, which means extract all the archive
1858
+        else {
1859
+            $v_extract = true;
1860
+        }
1861 1861
 
1862 1862
 
1863
-      // ----- Look for real extraction
1864
-      if ($v_extract) {
1863
+        // ----- Look for real extraction
1864
+        if ($v_extract) {
1865 1865
 
1866 1866
         // ----- Go to the file position
1867 1867
         @rewind($this->_zip_fd);
1868
-          if (@fseek($this->_zip_fd, $v_header['offset'])) {
1869
-              // ----- Close the zip file
1870
-          $this->_closeFd();
1868
+            if (@fseek($this->_zip_fd, $v_header['offset'])) {
1869
+                // ----- Close the zip file
1870
+            $this->_closeFd();
1871 1871
 
1872
-          // ----- Error log
1873
-          $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
1872
+            // ----- Error log
1873
+            $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
1874 1874
 
1875
-          // ----- Return
1876
-          return Archive_Zip::errorCode();
1877
-          }
1875
+            // ----- Return
1876
+            return Archive_Zip::errorCode();
1877
+            }
1878 1878
 
1879 1879
         // ----- Look for extraction as string
1880 1880
         if ($p_params[ARCHIVE_ZIP_PARAM_EXTRACT_AS_STRING]) {
1881 1881
 
1882
-          // ----- Extracting the file
1883
-          if (($v_result = $this->_extractFileAsString($v_header, $v_string)) != 1) {
1884
-              // ----- Close the zip file
1882
+            // ----- Extracting the file
1883
+            if (($v_result = $this->_extractFileAsString($v_header, $v_string)) != 1) {
1884
+                // ----- Close the zip file
1885 1885
             $this->_closeFd();
1886 1886
 
1887
-              return $v_result;
1888
-          }
1887
+                return $v_result;
1888
+            }
1889 1889
 
1890
-          // ----- Get the only interesting attributes
1891
-          if (($v_result = $this->_convertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted])) != 1) {
1892
-              // ----- Close the zip file
1890
+            // ----- Get the only interesting attributes
1891
+            if (($v_result = $this->_convertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted])) != 1) {
1892
+                // ----- Close the zip file
1893 1893
             $this->_closeFd();
1894 1894
 
1895
-              return $v_result;
1896
-          }
1895
+                return $v_result;
1896
+            }
1897 1897
 
1898
-          // ----- Set the file content
1899
-          $p_file_list[$v_nb_extracted]['content'] = $v_string;
1898
+            // ----- Set the file content
1899
+            $p_file_list[$v_nb_extracted]['content'] = $v_string;
1900 1900
 
1901
-          // ----- Next extracted file
1902
-          $v_nb_extracted++;
1901
+            // ----- Next extracted file
1902
+            $v_nb_extracted++;
1903 1903
         } else {
1904 1904
             // ----- Extracting the file
1905
-          if (($v_result = $this->_extractFile($v_header, $p_path, $p_remove_path, $p_remove_all_path, $p_params)) != 1) {
1906
-              // ----- Close the zip file
1905
+            if (($v_result = $this->_extractFile($v_header, $p_path, $p_remove_path, $p_remove_all_path, $p_params)) != 1) {
1906
+                // ----- Close the zip file
1907 1907
             $this->_closeFd();
1908 1908
 
1909
-              return $v_result;
1910
-          }
1909
+                return $v_result;
1910
+            }
1911 1911
 
1912
-          // ----- Get the only interesting attributes
1913
-          if (($v_result = $this->_convertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) {
1914
-              // ----- Close the zip file
1912
+            // ----- Get the only interesting attributes
1913
+            if (($v_result = $this->_convertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) {
1914
+                // ----- Close the zip file
1915 1915
             $this->_closeFd();
1916 1916
 
1917
-              return $v_result;
1918
-          }
1917
+                return $v_result;
1918
+            }
1919
+        }
1920
+        }
1919 1921
         }
1920
-      }
1921
-      }
1922 1922
 
1923 1923
     // ----- Close the zip file
1924 1924
     $this->_closeFd();
1925 1925
 
1926 1926
     // ----- Return
1927 1927
     return $v_result;
1928
-  }
1929
-  // ---------------------------------------------------------------------------
1930
-
1931
-  // ---------------------------------------------------------------------------
1932
-  // Function : _extractFile()
1933
-  // Description :
1934
-  // Parameters :
1935
-  // Return Values :
1936
-  // ---------------------------------------------------------------------------
1937
-  /**
1938
-  * Archive_Zip::_extractFile()
1939
-  *
1940
-  * { Description }
1941
-  *
1942
-  */
1943
-  public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_params)
1944
-  {
1945
-      $v_result=1;
1928
+    }
1929
+    // ---------------------------------------------------------------------------
1930
+
1931
+    // ---------------------------------------------------------------------------
1932
+    // Function : _extractFile()
1933
+    // Description :
1934
+    // Parameters :
1935
+    // Return Values :
1936
+    // ---------------------------------------------------------------------------
1937
+    /**
1938
+     * Archive_Zip::_extractFile()
1939
+     *
1940
+     * { Description }
1941
+     *
1942
+     */
1943
+    public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_params)
1944
+    {
1945
+        $v_result=1;
1946 1946
 
1947 1947
     // ----- Read the file header
1948 1948
     if (($v_result = $this->_readFileHeader($v_header)) != 1) {
1949 1949
         // ----- Return
1950
-      return $v_result;
1950
+        return $v_result;
1951 1951
     }
1952 1952
 
1953 1953
 
@@ -1963,14 +1963,14 @@  discard block
 block discarded – undo
1963 1963
     // ----- Look for path to remove
1964 1964
     elseif ($p_remove_path != '') {
1965 1965
         //if (strcmp($p_remove_path, $p_entry['filename'])==0)
1966
-      if ($this->_tool_PathInclusion($p_remove_path, $p_entry['filename']) == 2) {
1966
+        if ($this->_tool_PathInclusion($p_remove_path, $p_entry['filename']) == 2) {
1967 1967
 
1968 1968
         // ----- Change the file status
1969 1969
         $p_entry['status'] = 'filtered';
1970 1970
 
1971 1971
         // ----- Return
1972 1972
         return $v_result;
1973
-      }
1973
+        }
1974 1974
 
1975 1975
         $p_remove_path_size = strlen($p_remove_path);
1976 1976
         if (substr($p_entry['filename'], 0, $p_remove_path_size) == $p_remove_path) {
@@ -1989,23 +1989,23 @@  discard block
 block discarded – undo
1989 1989
     if (isset($p_params[ARCHIVE_ZIP_PARAM_PRE_EXTRACT])
1990 1990
         && ($p_params[ARCHIVE_ZIP_PARAM_PRE_EXTRACT] != '')) {
1991 1991
 
1992
-      // ----- Generate a local information
1993
-      $v_local_header = array();
1992
+        // ----- Generate a local information
1993
+        $v_local_header = array();
1994 1994
         $this->_convertHeader2FileInfo($p_entry, $v_local_header);
1995 1995
 
1996
-      // ----- Call the callback
1997
-      // Here I do not use call_user_func() because I need to send a reference to the
1998
-      // header.
1999
-      eval('$v_result = '.$p_params[ARCHIVE_ZIP_PARAM_PRE_EXTRACT].'(ARCHIVE_ZIP_PARAM_PRE_EXTRACT, $v_local_header);');
1996
+        // ----- Call the callback
1997
+        // Here I do not use call_user_func() because I need to send a reference to the
1998
+        // header.
1999
+        eval('$v_result = '.$p_params[ARCHIVE_ZIP_PARAM_PRE_EXTRACT].'(ARCHIVE_ZIP_PARAM_PRE_EXTRACT, $v_local_header);');
2000 2000
         if ($v_result == 0) {
2001 2001
             // ----- Change the file status
2002 2002
         $p_entry['status'] = 'skipped';
2003 2003
             $v_result = 1;
2004 2004
         }
2005 2005
 
2006
-      // ----- Update the informations
2007
-      // Only some fields can be modified
2008
-      $p_entry['filename'] = $v_local_header['filename'];
2006
+        // ----- Update the informations
2007
+        // Only some fields can be modified
2008
+        $p_entry['filename'] = $v_local_header['filename'];
2009 2009
     }
2010 2010
 
2011 2011
     // ----- Trace
@@ -2016,34 +2016,34 @@  discard block
 block discarded – undo
2016 2016
     // ----- Look for specific actions while the file exist
2017 2017
     if (file_exists($p_entry['filename'])) {
2018 2018
 
2019
-      // ----- Look if file is a directory
2020
-      if (is_dir($p_entry['filename'])) {
2019
+        // ----- Look if file is a directory
2020
+        if (is_dir($p_entry['filename'])) {
2021 2021
 
2022 2022
         // ----- Change the file status
2023 2023
         $p_entry['status'] = 'already_a_directory';
2024 2024
 
2025 2025
         // ----- Return
2026 2026
         //return $v_result;
2027
-      }
2028
-      // ----- Look if file is write protected
2029
-      elseif (!is_writable($p_entry['filename'])) {
2027
+        }
2028
+        // ----- Look if file is write protected
2029
+        elseif (!is_writable($p_entry['filename'])) {
2030 2030
 
2031 2031
         // ----- Change the file status
2032 2032
         $p_entry['status'] = 'write_protected';
2033 2033
 
2034 2034
         // ----- Return
2035 2035
         //return $v_result;
2036
-      }
2036
+        }
2037 2037
 
2038
-      // ----- Look if the extracted file is older
2039
-      elseif (filemtime($p_entry['filename']) > $p_entry['mtime']) {
2038
+        // ----- Look if the extracted file is older
2039
+        elseif (filemtime($p_entry['filename']) > $p_entry['mtime']) {
2040 2040
 
2041 2041
         // ----- Change the file status
2042 2042
         $p_entry['status'] = 'newer_exist';
2043 2043
 
2044 2044
         // ----- Return
2045 2045
         //return $v_result;
2046
-      }
2046
+        }
2047 2047
     }
2048 2048
 
2049 2049
     // ----- Check the directory availability and create it if necessary
@@ -2071,25 +2071,25 @@  discard block
 block discarded – undo
2071 2071
     // ----- Look if extraction should be done
2072 2072
     if ($p_entry['status'] == 'ok') {
2073 2073
 
2074
-      // ----- Do the extraction (if not a folder)
2075
-      if (!(($p_entry['external']&0x00000010)==0x00000010)) {
2074
+        // ----- Do the extraction (if not a folder)
2075
+        if (!(($p_entry['external']&0x00000010)==0x00000010)) {
2076 2076
 
2077 2077
         // ----- Look for not compressed file
2078 2078
         if ($p_entry['compressed_size'] == $p_entry['size']) {
2079 2079
 
2080
-          // ----- Opening destination file
2081
-          if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
2080
+            // ----- Opening destination file
2081
+            if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
2082 2082
 
2083 2083
             // ----- Change the file status
2084 2084
             $p_entry['status'] = 'write_error';
2085 2085
 
2086 2086
             // ----- Return
2087 2087
             return $v_result;
2088
-          }
2088
+            }
2089 2089
 
2090 2090
 
2091
-          // ----- Read the file by ARCHIVE_ZIP_READ_BLOCK_SIZE octets blocks
2092
-          $v_size = $p_entry['compressed_size'];
2091
+            // ----- Read the file by ARCHIVE_ZIP_READ_BLOCK_SIZE octets blocks
2092
+            $v_size = $p_entry['compressed_size'];
2093 2093
             while ($v_size != 0) {
2094 2094
                 $v_read_size = ($v_size < ARCHIVE_ZIP_READ_BLOCK_SIZE ? $v_size : ARCHIVE_ZIP_READ_BLOCK_SIZE);
2095 2095
                 $v_buffer = fread($this->_zip_fd, $v_read_size);
@@ -2098,93 +2098,93 @@  discard block
 block discarded – undo
2098 2098
                 $v_size -= $v_read_size;
2099 2099
             }
2100 2100
 
2101
-          // ----- Closing the destination file
2102
-          fclose($v_dest_file);
2101
+            // ----- Closing the destination file
2102
+            fclose($v_dest_file);
2103 2103
 
2104
-          // ----- Change the file mtime
2105
-          touch($p_entry['filename'], $p_entry['mtime']);
2104
+            // ----- Change the file mtime
2105
+            touch($p_entry['filename'], $p_entry['mtime']);
2106 2106
         } else {
2107 2107
             // ----- Trace
2108 2108
 
2109
-          // ----- Opening destination file
2110
-          if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
2109
+            // ----- Opening destination file
2110
+            if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
2111 2111
 
2112 2112
             // ----- Change the file status
2113 2113
             $p_entry['status'] = 'write_error';
2114 2114
 
2115
-              return $v_result;
2116
-          }
2115
+                return $v_result;
2116
+            }
2117 2117
 
2118 2118
 
2119
-          // ----- Read the compressed file in a buffer (one shot)
2120
-          $v_buffer = @fread($this->_zip_fd, $p_entry['compressed_size']);
2119
+            // ----- Read the compressed file in a buffer (one shot)
2120
+            $v_buffer = @fread($this->_zip_fd, $p_entry['compressed_size']);
2121 2121
 
2122
-          // ----- Decompress the file
2123
-          $v_file_content = gzinflate($v_buffer);
2122
+            // ----- Decompress the file
2123
+            $v_file_content = gzinflate($v_buffer);
2124 2124
             unset($v_buffer);
2125 2125
 
2126
-          // ----- Write the uncompressed data
2127
-          @fwrite($v_dest_file, $v_file_content, $p_entry['size']);
2126
+            // ----- Write the uncompressed data
2127
+            @fwrite($v_dest_file, $v_file_content, $p_entry['size']);
2128 2128
             unset($v_file_content);
2129 2129
 
2130
-          // ----- Closing the destination file
2131
-          @fclose($v_dest_file);
2130
+            // ----- Closing the destination file
2131
+            @fclose($v_dest_file);
2132 2132
 
2133
-          // ----- Change the file mtime
2134
-          touch($p_entry['filename'], $p_entry['mtime']);
2133
+            // ----- Change the file mtime
2134
+            touch($p_entry['filename'], $p_entry['mtime']);
2135 2135
         }
2136 2136
 
2137 2137
         // ----- Look for chmod option
2138 2138
         if (isset($p_params[ARCHIVE_ZIP_PARAM_SET_CHMOD])
2139 2139
             && ($p_params[ARCHIVE_ZIP_PARAM_SET_CHMOD] != 0)) {
2140 2140
 
2141
-          // ----- Change the mode of the file
2142
-          chmod($p_entry['filename'], $p_params[ARCHIVE_ZIP_PARAM_SET_CHMOD]);
2141
+            // ----- Change the mode of the file
2142
+            chmod($p_entry['filename'], $p_params[ARCHIVE_ZIP_PARAM_SET_CHMOD]);
2143
+        }
2143 2144
         }
2144
-      }
2145 2145
     }
2146 2146
 
2147 2147
     // ----- Look for post-extract callback
2148 2148
     if (isset($p_params[ARCHIVE_ZIP_PARAM_POST_EXTRACT])
2149 2149
         && ($p_params[ARCHIVE_ZIP_PARAM_POST_EXTRACT] != '')) {
2150 2150
 
2151
-      // ----- Generate a local information
2152
-      $v_local_header = array();
2151
+        // ----- Generate a local information
2152
+        $v_local_header = array();
2153 2153
         $this->_convertHeader2FileInfo($p_entry, $v_local_header);
2154 2154
 
2155
-      // ----- Call the callback
2156
-      // Here I do not use call_user_func() because I need to send a reference to the
2157
-      // header.
2158
-      eval('$v_result = '.$p_params[ARCHIVE_ZIP_PARAM_POST_EXTRACT].'(ARCHIVE_ZIP_PARAM_POST_EXTRACT, $v_local_header);');
2155
+        // ----- Call the callback
2156
+        // Here I do not use call_user_func() because I need to send a reference to the
2157
+        // header.
2158
+        eval('$v_result = '.$p_params[ARCHIVE_ZIP_PARAM_POST_EXTRACT].'(ARCHIVE_ZIP_PARAM_POST_EXTRACT, $v_local_header);');
2159 2159
     }
2160 2160
 
2161 2161
     // ----- Return
2162 2162
     return $v_result;
2163
-  }
2164
-  // ---------------------------------------------------------------------------
2165
-
2166
-  // ---------------------------------------------------------------------------
2167
-  // Function : _extractFileAsString()
2168
-  // Description :
2169
-  // Parameters :
2170
-  // Return Values :
2171
-  // ---------------------------------------------------------------------------
2172
-  /**
2173
-  * Archive_Zip::_extractFileAsString()
2174
-  *
2175
-  * { Description }
2176
-  *
2177
-  */
2178
-  public function _extractFileAsString(&$p_entry, &$p_string)
2179
-  {
2180
-      $v_result=1;
2163
+    }
2164
+    // ---------------------------------------------------------------------------
2165
+
2166
+    // ---------------------------------------------------------------------------
2167
+    // Function : _extractFileAsString()
2168
+    // Description :
2169
+    // Parameters :
2170
+    // Return Values :
2171
+    // ---------------------------------------------------------------------------
2172
+    /**
2173
+     * Archive_Zip::_extractFileAsString()
2174
+     *
2175
+     * { Description }
2176
+     *
2177
+     */
2178
+    public function _extractFileAsString(&$p_entry, &$p_string)
2179
+    {
2180
+        $v_result=1;
2181 2181
 
2182 2182
     // ----- Read the file header
2183 2183
     $v_header = array();
2184
-      if (($v_result = $this->_readFileHeader($v_header)) != 1) {
2185
-          // ----- Return
2186
-      return $v_result;
2187
-      }
2184
+        if (($v_result = $this->_readFileHeader($v_header)) != 1) {
2185
+            // ----- Return
2186
+        return $v_result;
2187
+        }
2188 2188
 
2189 2189
 
2190 2190
     // ----- Check that the file header is coherent with $p_entry info
@@ -2195,59 +2195,59 @@  discard block
 block discarded – undo
2195 2195
     // ----- Do the extraction (if not a folder)
2196 2196
     if (!(($p_entry['external']&0x00000010)==0x00000010)) {
2197 2197
         // ----- Look for not compressed file
2198
-      if ($p_entry['compressed_size'] == $p_entry['size']) {
2199
-          // ----- Trace
2198
+        if ($p_entry['compressed_size'] == $p_entry['size']) {
2199
+            // ----- Trace
2200 2200
 
2201 2201
         // ----- Reading the file
2202 2202
         $p_string = fread($this->_zip_fd, $p_entry['compressed_size']);
2203
-      } else {
2204
-          // ----- Trace
2203
+        } else {
2204
+            // ----- Trace
2205 2205
 
2206 2206
         // ----- Reading the file
2207 2207
         $v_data = fread($this->_zip_fd, $p_entry['compressed_size']);
2208 2208
 
2209 2209
         // ----- Decompress the file
2210 2210
         $p_string = gzinflate($v_data);
2211
-      }
2211
+        }
2212 2212
 
2213
-      // ----- Trace
2213
+        // ----- Trace
2214 2214
     } else {
2215 2215
         // TBC : error : can not extract a folder in a string
2216 2216
     }
2217 2217
 
2218 2218
     // ----- Return
2219 2219
     return $v_result;
2220
-  }
2221
-  // ---------------------------------------------------------------------------
2222
-
2223
-  // ---------------------------------------------------------------------------
2224
-  // Function : _readFileHeader()
2225
-  // Description :
2226
-  // Parameters :
2227
-  // Return Values :
2228
-  // ---------------------------------------------------------------------------
2229
-  /**
2230
-  * Archive_Zip::_readFileHeader()
2231
-  *
2232
-  * { Description }
2233
-  *
2234
-  */
2235
-  public function _readFileHeader(&$p_header)
2236
-  {
2237
-      $v_result=1;
2220
+    }
2221
+    // ---------------------------------------------------------------------------
2222
+
2223
+    // ---------------------------------------------------------------------------
2224
+    // Function : _readFileHeader()
2225
+    // Description :
2226
+    // Parameters :
2227
+    // Return Values :
2228
+    // ---------------------------------------------------------------------------
2229
+    /**
2230
+     * Archive_Zip::_readFileHeader()
2231
+     *
2232
+     * { Description }
2233
+     *
2234
+     */
2235
+    public function _readFileHeader(&$p_header)
2236
+    {
2237
+        $v_result=1;
2238 2238
 
2239 2239
     // ----- Read the 4 bytes signature
2240 2240
     $v_binary_data = @fread($this->_zip_fd, 4);
2241
-      $v_data = unpack('Vid', $v_binary_data);
2241
+        $v_data = unpack('Vid', $v_binary_data);
2242 2242
 
2243 2243
     // ----- Check signature
2244 2244
     if ($v_data['id'] != 0x04034b50) {
2245 2245
 
2246
-      // ----- Error log
2247
-      $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
2246
+        // ----- Error log
2247
+        $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
2248 2248
 
2249
-      // ----- Return
2250
-      return Archive_Zip::errorCode();
2249
+        // ----- Return
2250
+        return Archive_Zip::errorCode();
2251 2251
     }
2252 2252
 
2253 2253
     // ----- Read the first 42 bytes of the header
@@ -2258,11 +2258,11 @@  discard block
 block discarded – undo
2258 2258
         $p_header['filename'] = '';
2259 2259
         $p_header['status'] = 'invalid_header';
2260 2260
 
2261
-      // ----- Error log
2262
-      $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : ' . strlen($v_binary_data));
2261
+        // ----- Error log
2262
+        $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : ' . strlen($v_binary_data));
2263 2263
 
2264
-      // ----- Return
2265
-      return Archive_Zip::errorCode();
2264
+        // ----- Return
2265
+        return Archive_Zip::errorCode();
2266 2266
     }
2267 2267
 
2268 2268
     // ----- Extract the values
@@ -2280,30 +2280,30 @@  discard block
 block discarded – undo
2280 2280
 
2281 2281
     // ----- Extract properties
2282 2282
     $p_header['compression'] = $v_data['compression'];
2283
-      $p_header['size'] = $v_data['size'];
2284
-      $p_header['compressed_size'] = $v_data['compressed_size'];
2285
-      $p_header['crc'] = $v_data['crc'];
2286
-      $p_header['flag'] = $v_data['flag'];
2283
+        $p_header['size'] = $v_data['size'];
2284
+        $p_header['compressed_size'] = $v_data['compressed_size'];
2285
+        $p_header['crc'] = $v_data['crc'];
2286
+        $p_header['flag'] = $v_data['flag'];
2287 2287
 
2288 2288
     // ----- Recuperate date in UNIX format
2289 2289
     $p_header['mdate'] = $v_data['mdate'];
2290
-      $p_header['mtime'] = $v_data['mtime'];
2291
-      if ($p_header['mdate'] && $p_header['mtime']) {
2292
-          // ----- Extract time
2293
-      $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
2294
-          $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
2295
-          $v_seconde = ($p_header['mtime'] & 0x001F)*2;
2296
-
2297
-      // ----- Extract date
2298
-      $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
2299
-          $v_month = ($p_header['mdate'] & 0x01E0) >> 5;
2300
-          $v_day = $p_header['mdate'] & 0x001F;
2301
-
2302
-      // ----- Get UNIX date format
2303
-      $p_header['mtime'] = mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
2304
-      } else {
2305
-          $p_header['mtime'] = time();
2306
-      }
2290
+        $p_header['mtime'] = $v_data['mtime'];
2291
+        if ($p_header['mdate'] && $p_header['mtime']) {
2292
+            // ----- Extract time
2293
+        $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
2294
+            $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
2295
+            $v_seconde = ($p_header['mtime'] & 0x001F)*2;
2296
+
2297
+        // ----- Extract date
2298
+        $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
2299
+            $v_month = ($p_header['mdate'] & 0x01E0) >> 5;
2300
+            $v_day = $p_header['mdate'] & 0x001F;
2301
+
2302
+        // ----- Get UNIX date format
2303
+        $p_header['mtime'] = mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
2304
+        } else {
2305
+            $p_header['mtime'] = time();
2306
+        }
2307 2307
 
2308 2308
     // ----- Other informations
2309 2309
 
@@ -2319,37 +2319,37 @@  discard block
 block discarded – undo
2319 2319
 
2320 2320
     // ----- Return
2321 2321
     return $v_result;
2322
-  }
2323
-  // ---------------------------------------------------------------------------
2324
-
2325
-  // ---------------------------------------------------------------------------
2326
-  // Function : _readCentralFileHeader()
2327
-  // Description :
2328
-  // Parameters :
2329
-  // Return Values :
2330
-  // ---------------------------------------------------------------------------
2331
-  /**
2332
-  * Archive_Zip::_readCentralFileHeader()
2333
-  *
2334
-  * { Description }
2335
-  *
2336
-  */
2337
-  public function _readCentralFileHeader(&$p_header)
2338
-  {
2339
-      $v_result=1;
2322
+    }
2323
+    // ---------------------------------------------------------------------------
2324
+
2325
+    // ---------------------------------------------------------------------------
2326
+    // Function : _readCentralFileHeader()
2327
+    // Description :
2328
+    // Parameters :
2329
+    // Return Values :
2330
+    // ---------------------------------------------------------------------------
2331
+    /**
2332
+     * Archive_Zip::_readCentralFileHeader()
2333
+     *
2334
+     * { Description }
2335
+     *
2336
+     */
2337
+    public function _readCentralFileHeader(&$p_header)
2338
+    {
2339
+        $v_result=1;
2340 2340
 
2341 2341
     // ----- Read the 4 bytes signature
2342 2342
     $v_binary_data = @fread($this->_zip_fd, 4);
2343
-      $v_data = unpack('Vid', $v_binary_data);
2343
+        $v_data = unpack('Vid', $v_binary_data);
2344 2344
 
2345 2345
     // ----- Check signature
2346 2346
     if ($v_data['id'] != 0x02014b50) {
2347 2347
 
2348
-      // ----- Error log
2349
-      $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
2348
+        // ----- Error log
2349
+        $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
2350 2350
 
2351
-      // ----- Return
2352
-      return Archive_Zip::errorCode();
2351
+        // ----- Return
2352
+        return Archive_Zip::errorCode();
2353 2353
     }
2354 2354
 
2355 2355
     // ----- Read the first 42 bytes of the header
@@ -2360,11 +2360,11 @@  discard block
 block discarded – undo
2360 2360
         $p_header['filename'] = '';
2361 2361
         $p_header['status'] = 'invalid_header';
2362 2362
 
2363
-      // ----- Error log
2364
-      $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : ' . strlen($v_binary_data));
2363
+        // ----- Error log
2364
+        $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : ' . strlen($v_binary_data));
2365 2365
 
2366
-      // ----- Return
2367
-      return Archive_Zip::errorCode();
2366
+        // ----- Return
2367
+        return Archive_Zip::errorCode();
2368 2368
     }
2369 2369
 
2370 2370
     // ----- Extract the values
@@ -2396,17 +2396,17 @@  discard block
 block discarded – undo
2396 2396
     // ----- Recuperate date in UNIX format
2397 2397
     if ($p_header['mdate'] && $p_header['mtime']) {
2398 2398
         // ----- Extract time
2399
-      $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
2399
+        $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
2400 2400
         $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
2401 2401
         $v_seconde = ($p_header['mtime'] & 0x001F)*2;
2402 2402
 
2403
-      // ----- Extract date
2404
-      $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
2403
+        // ----- Extract date
2404
+        $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
2405 2405
         $v_month = ($p_header['mdate'] & 0x01E0) >> 5;
2406 2406
         $v_day = $p_header['mdate'] & 0x001F;
2407 2407
 
2408
-      // ----- Get UNIX date format
2409
-      $p_header['mtime'] = mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
2408
+        // ----- Get UNIX date format
2409
+        $p_header['mtime'] = mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
2410 2410
     } else {
2411 2411
         $p_header['mtime'] = time();
2412 2412
     }
@@ -2425,76 +2425,76 @@  discard block
 block discarded – undo
2425 2425
 
2426 2426
     // ----- Return
2427 2427
     return $v_result;
2428
-  }
2429
-  // ---------------------------------------------------------------------------
2430
-
2431
-  // ---------------------------------------------------------------------------
2432
-  // Function : _readEndCentralDir()
2433
-  // Description :
2434
-  // Parameters :
2435
-  // Return Values :
2436
-  // ---------------------------------------------------------------------------
2437
-  /**
2438
-  * Archive_Zip::_readEndCentralDir()
2439
-  *
2440
-  * { Description }
2441
-  *
2442
-  */
2443
-  public function _readEndCentralDir(&$p_central_dir)
2444
-  {
2445
-      $v_result=1;
2428
+    }
2429
+    // ---------------------------------------------------------------------------
2430
+
2431
+    // ---------------------------------------------------------------------------
2432
+    // Function : _readEndCentralDir()
2433
+    // Description :
2434
+    // Parameters :
2435
+    // Return Values :
2436
+    // ---------------------------------------------------------------------------
2437
+    /**
2438
+     * Archive_Zip::_readEndCentralDir()
2439
+     *
2440
+     * { Description }
2441
+     *
2442
+     */
2443
+    public function _readEndCentralDir(&$p_central_dir)
2444
+    {
2445
+        $v_result=1;
2446 2446
 
2447 2447
     // ----- Go to the end of the zip file
2448 2448
     $v_size = filesize($this->_zipname);
2449
-      @fseek($this->_zip_fd, $v_size);
2450
-      if (@ftell($this->_zip_fd) != $v_size) {
2451
-          $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT,
2452
-                       'Unable to go to the end of the archive \''
2453
-                       .$this->_zipname.'\'');
2454
-          return Archive_Zip::errorCode();
2455
-      }
2449
+        @fseek($this->_zip_fd, $v_size);
2450
+        if (@ftell($this->_zip_fd) != $v_size) {
2451
+            $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT,
2452
+                        'Unable to go to the end of the archive \''
2453
+                        .$this->_zipname.'\'');
2454
+            return Archive_Zip::errorCode();
2455
+        }
2456 2456
 
2457 2457
     // ----- First try : look if this is an archive with no commentaries
2458 2458
     // (most of the time)
2459 2459
     // in this case the end of central dir is at 22 bytes of the file end
2460 2460
     $v_found = 0;
2461
-      if ($v_size > 26) {
2462
-          @fseek($this->_zip_fd, $v_size-22);
2463
-          if (($v_pos = @ftell($this->_zip_fd)) != ($v_size-22)) {
2464
-              $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT,
2465
-                         'Unable to seek back to the middle of the archive \''
2466
-                         .$this->_zipname.'\'');
2467
-              return Archive_Zip::errorCode();
2468
-          }
2469
-
2470
-      // ----- Read for bytes
2471
-      $v_binary_data = @fread($this->_zip_fd, 4);
2472
-          $v_data = unpack('Vid', $v_binary_data);
2473
-
2474
-      // ----- Check signature
2475
-      if ($v_data['id'] == 0x06054b50) {
2476
-          $v_found = 1;
2477
-      }
2478
-
2479
-          $v_pos = ftell($this->_zip_fd);
2480
-      }
2461
+        if ($v_size > 26) {
2462
+            @fseek($this->_zip_fd, $v_size-22);
2463
+            if (($v_pos = @ftell($this->_zip_fd)) != ($v_size-22)) {
2464
+                $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT,
2465
+                            'Unable to seek back to the middle of the archive \''
2466
+                            .$this->_zipname.'\'');
2467
+                return Archive_Zip::errorCode();
2468
+            }
2469
+
2470
+        // ----- Read for bytes
2471
+        $v_binary_data = @fread($this->_zip_fd, 4);
2472
+            $v_data = unpack('Vid', $v_binary_data);
2473
+
2474
+        // ----- Check signature
2475
+        if ($v_data['id'] == 0x06054b50) {
2476
+            $v_found = 1;
2477
+        }
2478
+
2479
+            $v_pos = ftell($this->_zip_fd);
2480
+        }
2481 2481
 
2482 2482
     // ----- Go back to the maximum possible size of the Central Dir End Record
2483 2483
     if (!$v_found) {
2484 2484
         $v_maximum_size = 65557; // 0xFFFF + 22;
2485
-      if ($v_maximum_size > $v_size) {
2486
-          $v_maximum_size = $v_size;
2487
-      }
2485
+        if ($v_maximum_size > $v_size) {
2486
+            $v_maximum_size = $v_size;
2487
+        }
2488 2488
         @fseek($this->_zip_fd, $v_size-$v_maximum_size);
2489 2489
         if (@ftell($this->_zip_fd) != ($v_size-$v_maximum_size)) {
2490 2490
             $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT,
2491
-                         'Unable to seek back to the middle of the archive \''
2492
-                         .$this->_zipname.'\'');
2491
+                            'Unable to seek back to the middle of the archive \''
2492
+                            .$this->_zipname.'\'');
2493 2493
             return Archive_Zip::errorCode();
2494 2494
         }
2495 2495
 
2496
-      // ----- Read byte per byte in order to find the signature
2497
-      $v_pos = ftell($this->_zip_fd);
2496
+        // ----- Read byte per byte in order to find the signature
2497
+        $v_pos = ftell($this->_zip_fd);
2498 2498
         $v_bytes = 0x00000000;
2499 2499
         while ($v_pos < $v_size) {
2500 2500
             // ----- Read a byte
@@ -2512,11 +2512,11 @@  discard block
 block discarded – undo
2512 2512
             $v_pos++;
2513 2513
         }
2514 2514
 
2515
-      // ----- Look if not found end of central dir
2516
-      if ($v_pos == $v_size) {
2517
-          $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Unable to find End of Central Dir Record signature');
2518
-          return Archive_Zip::errorCode();
2519
-      }
2515
+        // ----- Look if not found end of central dir
2516
+        if ($v_pos == $v_size) {
2517
+            $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Unable to find End of Central Dir Record signature');
2518
+            return Archive_Zip::errorCode();
2519
+        }
2520 2520
     }
2521 2521
 
2522 2522
     // ----- Read the first 18 bytes of the header
@@ -2525,8 +2525,8 @@  discard block
 block discarded – undo
2525 2525
     // ----- Look for invalid block size
2526 2526
     if (strlen($v_binary_data) != 18) {
2527 2527
         $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT,
2528
-                         'Invalid End of Central Dir Record size : '
2529
-                       .strlen($v_binary_data));
2528
+                            'Invalid End of Central Dir Record size : '
2529
+                        .strlen($v_binary_data));
2530 2530
         return Archive_Zip::errorCode();
2531 2531
     }
2532 2532
 
@@ -2546,47 +2546,47 @@  discard block
 block discarded – undo
2546 2546
         $p_central_dir['comment'] = '';
2547 2547
     }
2548 2548
 
2549
-      $p_central_dir['entries'] = $v_data['entries'];
2550
-      $p_central_dir['disk_entries'] = $v_data['disk_entries'];
2551
-      $p_central_dir['offset'] = $v_data['offset'];
2552
-      $p_central_dir['size'] = $v_data['size'];
2553
-      $p_central_dir['disk'] = $v_data['disk'];
2554
-      $p_central_dir['disk_start'] = $v_data['disk_start'];
2549
+        $p_central_dir['entries'] = $v_data['entries'];
2550
+        $p_central_dir['disk_entries'] = $v_data['disk_entries'];
2551
+        $p_central_dir['offset'] = $v_data['offset'];
2552
+        $p_central_dir['size'] = $v_data['size'];
2553
+        $p_central_dir['disk'] = $v_data['disk'];
2554
+        $p_central_dir['disk_start'] = $v_data['disk_start'];
2555 2555
 
2556 2556
     // ----- Return
2557 2557
     return $v_result;
2558
-  }
2559
-  // ---------------------------------------------------------------------------
2560
-
2561
-  // ---------------------------------------------------------------------------
2562
-  // Function : _deleteByRule()
2563
-  // Description :
2564
-  // Parameters :
2565
-  // Return Values :
2566
-  // ---------------------------------------------------------------------------
2567
-  /**
2568
-  * Archive_Zip::_deleteByRule()
2569
-  *
2570
-  * { Description }
2571
-  *
2572
-  */
2573
-  public function _deleteByRule(&$p_result_list, &$p_params)
2574
-  {
2575
-      $v_result=1;
2576
-      $v_list_detail = array();
2558
+    }
2559
+    // ---------------------------------------------------------------------------
2560
+
2561
+    // ---------------------------------------------------------------------------
2562
+    // Function : _deleteByRule()
2563
+    // Description :
2564
+    // Parameters :
2565
+    // Return Values :
2566
+    // ---------------------------------------------------------------------------
2567
+    /**
2568
+     * Archive_Zip::_deleteByRule()
2569
+     *
2570
+     * { Description }
2571
+     *
2572
+     */
2573
+    public function _deleteByRule(&$p_result_list, &$p_params)
2574
+    {
2575
+        $v_result=1;
2576
+        $v_list_detail = array();
2577 2577
 
2578 2578
     // ----- Open the zip file
2579 2579
     if (($v_result=$this->_openFd('rb')) != 1) {
2580 2580
         // ----- Return
2581
-      return $v_result;
2581
+        return $v_result;
2582 2582
     }
2583 2583
 
2584 2584
     // ----- Read the central directory informations
2585 2585
     $v_central_dir = array();
2586
-      if (($v_result = $this->_readEndCentralDir($v_central_dir)) != 1) {
2587
-          $this->_closeFd();
2588
-          return $v_result;
2589
-      }
2586
+        if (($v_result = $this->_readEndCentralDir($v_central_dir)) != 1) {
2587
+            $this->_closeFd();
2588
+            return $v_result;
2589
+        }
2590 2590
 
2591 2591
     // ----- Go to beginning of File
2592 2592
     @rewind($this->_zip_fd);
@@ -2594,123 +2594,123 @@  discard block
 block discarded – undo
2594 2594
     // ----- Scan all the files
2595 2595
     // ----- Start at beginning of Central Dir
2596 2596
     $v_pos_entry = $v_central_dir['offset'];
2597
-      @rewind($this->_zip_fd);
2598
-      if (@fseek($this->_zip_fd, $v_pos_entry)) {
2599
-          // ----- Clean
2600
-      $this->_closeFd();
2597
+        @rewind($this->_zip_fd);
2598
+        if (@fseek($this->_zip_fd, $v_pos_entry)) {
2599
+            // ----- Clean
2600
+        $this->_closeFd();
2601 2601
 
2602
-          $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_ARCHIVE_ZIP,
2603
-                       'Invalid archive size');
2604
-          return Archive_Zip::errorCode();
2605
-      }
2602
+            $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_ARCHIVE_ZIP,
2603
+                        'Invalid archive size');
2604
+            return Archive_Zip::errorCode();
2605
+        }
2606 2606
 
2607 2607
     // ----- Read each entry
2608 2608
     $v_header_list = array();
2609
-      $j_start = 0;
2610
-      for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) {
2609
+        $j_start = 0;
2610
+        for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) {
2611 2611
 
2612
-      // ----- Read the file header
2613
-      $v_header_list[$v_nb_extracted] = array();
2614
-          $v_result
2612
+        // ----- Read the file header
2613
+        $v_header_list[$v_nb_extracted] = array();
2614
+            $v_result
2615 2615
         = $this->_readCentralFileHeader($v_header_list[$v_nb_extracted]);
2616
-          if ($v_result != 1) {
2617
-              // ----- Clean
2616
+            if ($v_result != 1) {
2617
+                // ----- Clean
2618 2618
         $this->_closeFd();
2619 2619
 
2620
-              return $v_result;
2621
-          }
2620
+                return $v_result;
2621
+            }
2622 2622
 
2623
-      // ----- Store the index
2624
-      $v_header_list[$v_nb_extracted]['index'] = $i;
2623
+        // ----- Store the index
2624
+        $v_header_list[$v_nb_extracted]['index'] = $i;
2625 2625
 
2626
-      // ----- Look for the specific extract rules
2627
-      $v_found = false;
2626
+        // ----- Look for the specific extract rules
2627
+        $v_found = false;
2628 2628
 
2629
-      // ----- Look for extract by name rule
2630
-      if (isset($p_params[ARCHIVE_ZIP_PARAM_BY_NAME])
2629
+        // ----- Look for extract by name rule
2630
+        if (isset($p_params[ARCHIVE_ZIP_PARAM_BY_NAME])
2631 2631
           && ($p_params[ARCHIVE_ZIP_PARAM_BY_NAME] != 0)) {
2632 2632
 
2633
-          // ----- Look if the filename is in the list
2634
-          for ($j=0;
2635
-               ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_NAME]))
2633
+            // ----- Look if the filename is in the list
2634
+            for ($j=0;
2635
+                ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_NAME]))
2636 2636
                  && (!$v_found);
2637
-               $j++) {
2637
+                $j++) {
2638 2638
 
2639
-              // ----- Look for a directory
2640
-              if (substr($p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j], -1) == '/') {
2639
+                // ----- Look for a directory
2640
+                if (substr($p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j], -1) == '/') {
2641 2641
 
2642
-                  // ----- Look if the directory is in the filename path
2643
-                  if ((strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j]))
2642
+                    // ----- Look if the directory is in the filename path
2643
+                    if ((strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j]))
2644 2644
                       && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) == $p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) {
2645
-                      $v_found = true;
2646
-                  } elseif ((($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */
2645
+                        $v_found = true;
2646
+                    } elseif ((($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */
2647 2647
                           && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) {
2648
-                      $v_found = true;
2649
-                  }
2650
-              }
2651
-              // ----- Look for a filename
2652
-              elseif ($v_header_list[$v_nb_extracted]['stored_filename']
2653
-                      == $p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j]) {
2654
-                  $v_found = true;
2655
-              }
2656
-          }
2657
-      }
2658
-
2659
-      // ----- Look for extract by ereg rule
2660
-      elseif (isset($p_params[ARCHIVE_ZIP_PARAM_BY_EREG])
2648
+                        $v_found = true;
2649
+                    }
2650
+                }
2651
+                // ----- Look for a filename
2652
+                elseif ($v_header_list[$v_nb_extracted]['stored_filename']
2653
+                        == $p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j]) {
2654
+                    $v_found = true;
2655
+                }
2656
+            }
2657
+        }
2658
+
2659
+        // ----- Look for extract by ereg rule
2660
+        elseif (isset($p_params[ARCHIVE_ZIP_PARAM_BY_EREG])
2661 2661
               && ($p_params[ARCHIVE_ZIP_PARAM_BY_EREG] != '')) {
2662
-          if (ereg($p_params[ARCHIVE_ZIP_PARAM_BY_EREG],
2663
-                   $v_header_list[$v_nb_extracted]['stored_filename'])) {
2664
-              $v_found = true;
2665
-          }
2666
-      }
2667
-
2668
-      // ----- Look for extract by preg rule
2669
-      elseif (isset($p_params[ARCHIVE_ZIP_PARAM_BY_PREG])
2662
+            if (ereg($p_params[ARCHIVE_ZIP_PARAM_BY_EREG],
2663
+                    $v_header_list[$v_nb_extracted]['stored_filename'])) {
2664
+                $v_found = true;
2665
+            }
2666
+        }
2667
+
2668
+        // ----- Look for extract by preg rule
2669
+        elseif (isset($p_params[ARCHIVE_ZIP_PARAM_BY_PREG])
2670 2670
               && ($p_params[ARCHIVE_ZIP_PARAM_BY_PREG] != '')) {
2671
-          if (preg_match($p_params[ARCHIVE_ZIP_PARAM_BY_PREG],
2672
-                         $v_header_list[$v_nb_extracted]['stored_filename'])) {
2673
-              $v_found = true;
2674
-          }
2675
-      }
2676
-
2677
-      // ----- Look for extract by index rule
2678
-      elseif (isset($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])
2671
+            if (preg_match($p_params[ARCHIVE_ZIP_PARAM_BY_PREG],
2672
+                            $v_header_list[$v_nb_extracted]['stored_filename'])) {
2673
+                $v_found = true;
2674
+            }
2675
+        }
2676
+
2677
+        // ----- Look for extract by index rule
2678
+        elseif (isset($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])
2679 2679
                && ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX] != 0)) {
2680 2680
 
2681
-          // ----- Look if the index is in the list
2682
-          for ($j=$j_start;
2683
-               ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX]))
2681
+            // ----- Look if the index is in the list
2682
+            for ($j=$j_start;
2683
+                ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX]))
2684 2684
                  && (!$v_found);
2685
-               $j++) {
2686
-              if (($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start'])
2685
+                $j++) {
2686
+                if (($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start'])
2687 2687
                   && ($i<=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) {
2688
-                  $v_found = true;
2689
-              }
2690
-              if ($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) {
2691
-                  $j_start = $j+1;
2692
-              }
2693
-
2694
-              if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']>$i) {
2695
-                  break;
2696
-              }
2697
-          }
2698
-      }
2699
-
2700
-      // ----- Look for deletion
2701
-      if ($v_found) {
2702
-          unset($v_header_list[$v_nb_extracted]);
2703
-      } else {
2704
-          $v_nb_extracted++;
2705
-      }
2706
-      }
2688
+                    $v_found = true;
2689
+                }
2690
+                if ($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) {
2691
+                    $j_start = $j+1;
2692
+                }
2693
+
2694
+                if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']>$i) {
2695
+                    break;
2696
+                }
2697
+            }
2698
+        }
2699
+
2700
+        // ----- Look for deletion
2701
+        if ($v_found) {
2702
+            unset($v_header_list[$v_nb_extracted]);
2703
+        } else {
2704
+            $v_nb_extracted++;
2705
+        }
2706
+        }
2707 2707
 
2708 2708
     // ----- Look if something need to be deleted
2709 2709
     if ($v_nb_extracted > 0) {
2710 2710
 
2711 2711
         // ----- Creates a temporay file
2712 2712
         $v_zip_temp_name = ARCHIVE_ZIP_TEMPORARY_DIR.uniqid('archive_zip-')
2713
-                           .'.tmp';
2713
+                            .'.tmp';
2714 2714
 
2715 2715
         // ----- Creates a temporary zip archive
2716 2716
         $v_temp_zip = new Archive_Zip($v_zip_temp_name);
@@ -2735,7 +2735,7 @@  discard block
 block discarded – undo
2735 2735
                 @unlink($v_zip_temp_name);
2736 2736
 
2737 2737
                 $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_ARCHIVE_ZIP,
2738
-                                 'Invalid archive size');
2738
+                                    'Invalid archive size');
2739 2739
                 return Archive_Zip::errorCode();
2740 2740
             }
2741 2741
 
@@ -2762,8 +2762,8 @@  discard block
 block discarded – undo
2762 2762
 
2763 2763
             // ----- Read/write the data block
2764 2764
             $v_result = $this->_tool_CopyBlock($this->_zip_fd,
2765
-                                               $v_temp_zip->_zip_fd,
2766
-                                       $v_header_list[$i]['compressed_size']);
2765
+                                                $v_temp_zip->_zip_fd,
2766
+                                        $v_header_list[$i]['compressed_size']);
2767 2767
             if ($v_result != 1) {
2768 2768
                 // ----- Clean
2769 2769
                 $this->_closeFd();
@@ -2792,7 +2792,7 @@  discard block
 block discarded – undo
2792 2792
 
2793 2793
             // ----- Transform the header to a 'usable' info
2794 2794
             $v_temp_zip->_convertHeader2FileInfo($v_header_list[$i],
2795
-                                                 $p_result_list[$i]);
2795
+                                                    $p_result_list[$i]);
2796 2796
         }
2797 2797
 
2798 2798
 
@@ -2804,8 +2804,8 @@  discard block
 block discarded – undo
2804 2804
 
2805 2805
         // ----- Create the central dir footer
2806 2806
         $v_result = $v_temp_zip->_writeCentralHeader(count($v_header_list),
2807
-                                                     $v_size, $v_offset,
2808
-                                                     $v_comment);
2807
+                                                        $v_size, $v_offset,
2808
+                                                        $v_comment);
2809 2809
         if ($v_result != 1) {
2810 2810
             // ----- Clean
2811 2811
             unset($v_header_list);
@@ -2835,30 +2835,30 @@  discard block
 block discarded – undo
2835 2835
 
2836 2836
     // ----- Return
2837 2837
     return $v_result;
2838
-  }
2839
-  // ---------------------------------------------------------------------------
2840
-
2841
-  // ---------------------------------------------------------------------------
2842
-  // Function : _dirCheck()
2843
-  // Description :
2844
-  //   Check if a directory exists, if not it creates it and all the parents directory
2845
-  //   which may be useful.
2846
-  // Parameters :
2847
-  //   $p_dir : Directory path to check.
2848
-  // Return Values :
2849
-  //    1 : OK
2850
-  //   -1 : Unable to create directory
2851
-  // ---------------------------------------------------------------------------
2852
-  /**
2853
-  * Archive_Zip::_dirCheck()
2854
-  *
2855
-  * { Description }
2856
-  *
2857
-  * @param [type] $p_is_dir
2858
-  */
2859
-  public function _dirCheck($p_dir, $p_is_dir=false)
2860
-  {
2861
-      $v_result = 1;
2838
+    }
2839
+    // ---------------------------------------------------------------------------
2840
+
2841
+    // ---------------------------------------------------------------------------
2842
+    // Function : _dirCheck()
2843
+    // Description :
2844
+    //   Check if a directory exists, if not it creates it and all the parents directory
2845
+    //   which may be useful.
2846
+    // Parameters :
2847
+    //   $p_dir : Directory path to check.
2848
+    // Return Values :
2849
+    //    1 : OK
2850
+    //   -1 : Unable to create directory
2851
+    // ---------------------------------------------------------------------------
2852
+    /**
2853
+     * Archive_Zip::_dirCheck()
2854
+     *
2855
+     * { Description }
2856
+     *
2857
+     * @param [type] $p_is_dir
2858
+     */
2859
+    public function _dirCheck($p_dir, $p_is_dir=false)
2860
+    {
2861
+        $v_result = 1;
2862 2862
 
2863 2863
     // ----- Remove the final '/'
2864 2864
     if ($p_is_dir && (substr($p_dir, -1) == '/')) {
@@ -2876,52 +2876,52 @@  discard block
 block discarded – undo
2876 2876
     // ----- Just a check
2877 2877
     if ($p_parent_dir != $p_dir) {
2878 2878
         // ----- Look for parent directory
2879
-      if ($p_parent_dir != '') {
2880
-          if (($v_result = $this->_dirCheck($p_parent_dir)) != 1) {
2881
-              return $v_result;
2882
-          }
2883
-      }
2879
+        if ($p_parent_dir != '') {
2880
+            if (($v_result = $this->_dirCheck($p_parent_dir)) != 1) {
2881
+                return $v_result;
2882
+            }
2883
+        }
2884 2884
     }
2885 2885
 
2886 2886
     // ----- Create the directory
2887 2887
     if (!@mkdir($p_dir, 0777)) {
2888 2888
         $this->_errorLog(ARCHIVE_ZIP_ERR_DIR_CREATE_FAIL,
2889
-                       "Unable to create directory '$p_dir'");
2889
+                        "Unable to create directory '$p_dir'");
2890 2890
         return Archive_Zip::errorCode();
2891 2891
     }
2892 2892
 
2893 2893
     // ----- Return
2894 2894
     return $v_result;
2895
-  }
2896
-  // ---------------------------------------------------------------------------
2897
-
2898
-  // ---------------------------------------------------------------------------
2899
-  // Function : _merge()
2900
-  // Description :
2901
-  //   If $p_archive_to_add does not exist, the function exit with a success result.
2902
-  // Parameters :
2903
-  // Return Values :
2904
-  // ---------------------------------------------------------------------------
2905
-  /**
2906
-  * Archive_Zip::_merge()
2907
-  *
2908
-  * { Description }
2909
-  *
2910
-  */
2911
-  public function _merge(&$p_archive_to_add)
2912
-  {
2913
-      $v_result=1;
2895
+    }
2896
+    // ---------------------------------------------------------------------------
2897
+
2898
+    // ---------------------------------------------------------------------------
2899
+    // Function : _merge()
2900
+    // Description :
2901
+    //   If $p_archive_to_add does not exist, the function exit with a success result.
2902
+    // Parameters :
2903
+    // Return Values :
2904
+    // ---------------------------------------------------------------------------
2905
+    /**
2906
+     * Archive_Zip::_merge()
2907
+     *
2908
+     * { Description }
2909
+     *
2910
+     */
2911
+    public function _merge(&$p_archive_to_add)
2912
+    {
2913
+        $v_result=1;
2914 2914
 
2915 2915
     // ----- Look if the archive_to_add exists
2916 2916
     if (!is_file($p_archive_to_add->_zipname)) {
2917 2917
         // ----- Nothing to merge, so merge is a success
2918
-      return 1;
2918
+        return 1;
2919 2919
     }
2920 2920
 
2921 2921
     // ----- Look if the archive exists
2922 2922
     if (!is_file($this->_zipname)) {
2923 2923
         // ----- Do a duplicate
2924
-      $v_result = $this->_duplicate($p_archive_to_add->_zipname);
2924
+        $v_result = $this->_duplicate($p_archive_to_add->_zipname);
2925 2925
 
2926 2926
         return $v_result;
2927 2927
     }
@@ -2933,10 +2933,10 @@  discard block
 block discarded – undo
2933 2933
 
2934 2934
     // ----- Read the central directory informations
2935 2935
     $v_central_dir = array();
2936
-      if (($v_result = $this->_readEndCentralDir($v_central_dir)) != 1) {
2937
-          $this->_closeFd();
2938
-          return $v_result;
2939
-      }
2936
+        if (($v_result = $this->_readEndCentralDir($v_central_dir)) != 1) {
2937
+            $this->_closeFd();
2938
+            return $v_result;
2939
+        }
2940 2940
 
2941 2941
     // ----- Go to beginning of File
2942 2942
     @rewind($this->_zip_fd);
@@ -2949,12 +2949,12 @@  discard block
 block discarded – undo
2949 2949
 
2950 2950
     // ----- Read the central directory informations
2951 2951
     $v_central_dir_to_add = array();
2952
-      $v_result = $p_archive_to_add->_readEndCentralDir($v_central_dir_to_add);
2953
-      if ($v_result != 1) {
2954
-          $this->_closeFd();
2955
-          $p_archive_to_add->_closeFd();
2956
-          return $v_result;
2957
-      }
2952
+        $v_result = $p_archive_to_add->_readEndCentralDir($v_central_dir_to_add);
2953
+        if ($v_result != 1) {
2954
+            $this->_closeFd();
2955
+            $p_archive_to_add->_closeFd();
2956
+            return $v_result;
2957
+        }
2958 2958
 
2959 2959
     // ----- Go to beginning of File
2960 2960
     @rewind($p_archive_to_add->_zip_fd);
@@ -2967,8 +2967,8 @@  discard block
 block discarded – undo
2967 2967
         $this->_closeFd();
2968 2968
         $p_archive_to_add->_closeFd();
2969 2969
         $this->_errorLog(ARCHIVE_ZIP_ERR_READ_OPEN_FAIL,
2970
-                       'Unable to open temporary file \''
2971
-                       .$v_zip_temp_name.'\' in binary write mode');
2970
+                        'Unable to open temporary file \''
2971
+                        .$v_zip_temp_name.'\' in binary write mode');
2972 2972
         return Archive_Zip::errorCode();
2973 2973
     }
2974 2974
 
@@ -2976,46 +2976,46 @@  discard block
 block discarded – undo
2976 2976
     // TBC : Here I should better append the file and go back to erase the
2977 2977
     // central dir
2978 2978
     $v_size = $v_central_dir['offset'];
2979
-      while ($v_size != 0) {
2980
-          $v_read_size = ($v_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
2979
+        while ($v_size != 0) {
2980
+            $v_read_size = ($v_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
2981 2981
                       ? $v_size : ARCHIVE_ZIP_READ_BLOCK_SIZE);
2982
-          $v_buffer = fread($this->_zip_fd, $v_read_size);
2983
-          @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
2984
-          $v_size -= $v_read_size;
2985
-      }
2982
+            $v_buffer = fread($this->_zip_fd, $v_read_size);
2983
+            @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
2984
+            $v_size -= $v_read_size;
2985
+        }
2986 2986
 
2987 2987
     // ----- Copy the files from the archive_to_add into the temporary file
2988 2988
     $v_size = $v_central_dir_to_add['offset'];
2989
-      while ($v_size != 0) {
2990
-          $v_read_size = ($v_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
2989
+        while ($v_size != 0) {
2990
+            $v_read_size = ($v_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
2991 2991
                       ? $v_size : ARCHIVE_ZIP_READ_BLOCK_SIZE);
2992
-          $v_buffer = fread($p_archive_to_add->_zip_fd, $v_read_size);
2993
-          @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
2994
-          $v_size -= $v_read_size;
2995
-      }
2992
+            $v_buffer = fread($p_archive_to_add->_zip_fd, $v_read_size);
2993
+            @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
2994
+            $v_size -= $v_read_size;
2995
+        }
2996 2996
 
2997 2997
     // ----- Store the offset of the central dir
2998 2998
     $v_offset = @ftell($v_zip_temp_fd);
2999 2999
 
3000 3000
     // ----- Copy the block of file headers from the old archive
3001 3001
     $v_size = $v_central_dir['size'];
3002
-      while ($v_size != 0) {
3003
-          $v_read_size = ($v_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
3002
+        while ($v_size != 0) {
3003
+            $v_read_size = ($v_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
3004 3004
                       ? $v_size : ARCHIVE_ZIP_READ_BLOCK_SIZE);
3005
-          $v_buffer = @fread($this->_zip_fd, $v_read_size);
3006
-          @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
3007
-          $v_size -= $v_read_size;
3008
-      }
3005
+            $v_buffer = @fread($this->_zip_fd, $v_read_size);
3006
+            @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
3007
+            $v_size -= $v_read_size;
3008
+        }
3009 3009
 
3010 3010
     // ----- Copy the block of file headers from the archive_to_add
3011 3011
     $v_size = $v_central_dir_to_add['size'];
3012
-      while ($v_size != 0) {
3013
-          $v_read_size = ($v_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
3012
+        while ($v_size != 0) {
3013
+            $v_read_size = ($v_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
3014 3014
                       ? $v_size : ARCHIVE_ZIP_READ_BLOCK_SIZE);
3015
-          $v_buffer = @fread($p_archive_to_add->_zip_fd, $v_read_size);
3016
-          @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
3017
-          $v_size -= $v_read_size;
3018
-      }
3015
+            $v_buffer = @fread($p_archive_to_add->_zip_fd, $v_read_size);
3016
+            @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
3017
+            $v_size -= $v_read_size;
3018
+        }
3019 3019
 
3020 3020
     // ----- Zip file comment
3021 3021
     // TBC : I should merge the two comments
@@ -3028,8 +3028,8 @@  discard block
 block discarded – undo
3028 3028
     // Here is a trick : I swap the temporary fd with the zip fd, in order to use
3029 3029
     // the following methods on the temporary fil and not the real archive fd
3030 3030
     $v_swap = $this->_zip_fd;
3031
-      $this->_zip_fd = $v_zip_temp_fd;
3032
-      $v_zip_temp_fd = $v_swap;
3031
+        $this->_zip_fd = $v_zip_temp_fd;
3032
+        $v_zip_temp_fd = $v_swap;
3033 3033
 
3034 3034
     // ----- Create the central dir footer
3035 3035
     if (($v_result = $this->_writeCentralHeader($v_central_dir['entries']
@@ -3041,21 +3041,21 @@  discard block
 block discarded – undo
3041 3041
         @fclose($v_zip_temp_fd);
3042 3042
         $this->_zip_fd = null;
3043 3043
 
3044
-      // ----- Reset the file list
3045
-      unset($v_header_list);
3044
+        // ----- Reset the file list
3045
+        unset($v_header_list);
3046 3046
 
3047
-      // ----- Return
3048
-      return $v_result;
3047
+        // ----- Return
3048
+        return $v_result;
3049 3049
     }
3050 3050
 
3051 3051
     // ----- Swap back the file descriptor
3052 3052
     $v_swap = $this->_zip_fd;
3053
-      $this->_zip_fd = $v_zip_temp_fd;
3054
-      $v_zip_temp_fd = $v_swap;
3053
+        $this->_zip_fd = $v_zip_temp_fd;
3054
+        $v_zip_temp_fd = $v_swap;
3055 3055
 
3056 3056
     // ----- Close
3057 3057
     $this->_closeFd();
3058
-      $p_archive_to_add->_closeFd();
3058
+        $p_archive_to_add->_closeFd();
3059 3059
 
3060 3060
     // ----- Close the temporary file
3061 3061
     @fclose($v_zip_temp_fd);
@@ -3071,47 +3071,47 @@  discard block
 block discarded – undo
3071 3071
 
3072 3072
     // ----- Return
3073 3073
     return $v_result;
3074
-  }
3075
-  // ---------------------------------------------------------------------------
3076
-
3077
-  // ---------------------------------------------------------------------------
3078
-  // Function : _duplicate()
3079
-  // Description :
3080
-  // Parameters :
3081
-  // Return Values :
3082
-  // ---------------------------------------------------------------------------
3083
-  /**
3084
-  * Archive_Zip::_duplicate()
3085
-  *
3086
-  * { Description }
3087
-  *
3088
-  */
3089
-  public function _duplicate($p_archive_filename)
3090
-  {
3091
-      $v_result=1;
3074
+    }
3075
+    // ---------------------------------------------------------------------------
3076
+
3077
+    // ---------------------------------------------------------------------------
3078
+    // Function : _duplicate()
3079
+    // Description :
3080
+    // Parameters :
3081
+    // Return Values :
3082
+    // ---------------------------------------------------------------------------
3083
+    /**
3084
+     * Archive_Zip::_duplicate()
3085
+     *
3086
+     * { Description }
3087
+     *
3088
+     */
3089
+    public function _duplicate($p_archive_filename)
3090
+    {
3091
+        $v_result=1;
3092 3092
 
3093 3093
     // ----- Look if the $p_archive_filename exists
3094 3094
     if (!is_file($p_archive_filename)) {
3095 3095
 
3096
-      // ----- Nothing to duplicate, so duplicate is a success.
3097
-      $v_result = 1;
3096
+        // ----- Nothing to duplicate, so duplicate is a success.
3097
+        $v_result = 1;
3098 3098
 
3099
-      // ----- Return
3100
-      return $v_result;
3099
+        // ----- Return
3100
+        return $v_result;
3101 3101
     }
3102 3102
 
3103 3103
     // ----- Open the zip file
3104 3104
     if (($v_result=$this->_openFd('wb')) != 1) {
3105 3105
         // ----- Return
3106
-      return $v_result;
3106
+        return $v_result;
3107 3107
     }
3108 3108
 
3109 3109
     // ----- Open the temporary file in write mode
3110 3110
     if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0) {
3111 3111
         $this->_closeFd();
3112 3112
         $this->_errorLog(ARCHIVE_ZIP_ERR_READ_OPEN_FAIL,
3113
-                       'Unable to open archive file \''
3114
-                       .$p_archive_filename.'\' in binary write mode');
3113
+                        'Unable to open archive file \''
3114
+                        .$p_archive_filename.'\' in binary write mode');
3115 3115
         return Archive_Zip::errorCode();
3116 3116
     }
3117 3117
 
@@ -3119,13 +3119,13 @@  discard block
 block discarded – undo
3119 3119
     // TBC : Here I should better append the file and go back to erase the
3120 3120
     // central dir
3121 3121
     $v_size = filesize($p_archive_filename);
3122
-      while ($v_size != 0) {
3123
-          $v_read_size = ($v_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
3122
+        while ($v_size != 0) {
3123
+            $v_read_size = ($v_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
3124 3124
                       ? $v_size : ARCHIVE_ZIP_READ_BLOCK_SIZE);
3125
-          $v_buffer = fread($v_zip_temp_fd, $v_read_size);
3126
-          @fwrite($this->_zip_fd, $v_buffer, $v_read_size);
3127
-          $v_size -= $v_read_size;
3128
-      }
3125
+            $v_buffer = fread($v_zip_temp_fd, $v_read_size);
3126
+            @fwrite($this->_zip_fd, $v_buffer, $v_read_size);
3127
+            $v_size -= $v_read_size;
3128
+        }
3129 3129
 
3130 3130
     // ----- Close
3131 3131
     $this->_closeFd();
@@ -3133,25 +3133,25 @@  discard block
 block discarded – undo
3133 3133
     // ----- Close the temporary file
3134 3134
     @fclose($v_zip_temp_fd);
3135 3135
 
3136
-      return $v_result;
3137
-  }
3138
-  // ---------------------------------------------------------------------------
3139
-
3140
-  /**
3141
-  * Archive_Zip::_check_parameters()
3142
-  *
3143
-  * { Description }
3144
-  *
3145
-  * @param integer $p_error_code
3146
-  * @param string $p_error_string
3147
-  */
3148
-  public function _check_parameters(&$p_params, $p_default)
3149
-  {
3136
+        return $v_result;
3137
+    }
3138
+    // ---------------------------------------------------------------------------
3139
+
3140
+    /**
3141
+     * Archive_Zip::_check_parameters()
3142
+     *
3143
+     * { Description }
3144
+     *
3145
+     * @param integer $p_error_code
3146
+     * @param string $p_error_string
3147
+     */
3148
+    public function _check_parameters(&$p_params, $p_default)
3149
+    {
3150 3150
 
3151 3151
     // ----- Check that param is an array
3152 3152
     if (!is_array($p_params)) {
3153 3153
         $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAMETER,
3154
-                         'Unsupported parameter, waiting for an array');
3154
+                            'Unsupported parameter, waiting for an array');
3155 3155
         return Archive_Zip::errorCode();
3156 3156
     }
3157 3157
 
@@ -3159,7 +3159,7 @@  discard block
 block discarded – undo
3159 3159
     for (reset($p_params); list($v_key, $v_value) = each($p_params);) {
3160 3160
         if (!isset($p_default[$v_key])) {
3161 3161
             $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAMETER,
3162
-                             'Unsupported parameter with key \''.$v_key.'\'');
3162
+                                'Unsupported parameter with key \''.$v_key.'\'');
3163 3163
 
3164 3164
             return Archive_Zip::errorCode();
3165 3165
         }
@@ -3174,170 +3174,170 @@  discard block
 block discarded – undo
3174 3174
 
3175 3175
     // ----- Check specific parameters
3176 3176
     $v_callback_list = array('callback_pre_add', 'callback_post_add',
3177
-                              'callback_pre_extract', 'callback_post_extract');
3178
-      for ($i=0; $i < count($v_callback_list); $i++) {
3179
-          $v_key=$v_callback_list[$i];
3180
-          if (isset($p_params[$v_key]) && ($p_params[$v_key] != '')) {
3181
-              if (!function_exists($p_params[$v_key])) {
3182
-                  $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAM_VALUE,
3183
-                                 "Callback '".$p_params[$v_key]
3184
-                                 ."()' is not an existing function for "
3185
-                                 ."parameter '".$v_key."'");
3186
-                  return Archive_Zip::errorCode();
3187
-              }
3188
-          }
3189
-      }
3190
-
3191
-      return 1;
3192
-  }
3193
-  // ---------------------------------------------------------------------------
3194
-
3195
-  // ---------------------------------------------------------------------------
3196
-  // Function : _errorLog()
3197
-  // Description :
3198
-  // Parameters :
3199
-  // ---------------------------------------------------------------------------
3200
-  /**
3201
-  * Archive_Zip::_errorLog()
3202
-  *
3203
-  * { Description }
3204
-  *
3205
-  * @param integer $p_error_code
3206
-  * @param string $p_error_string
3207
-  */
3208
-  public function _errorLog($p_error_code=0, $p_error_string='')
3209
-  {
3210
-      $this->_error_code = $p_error_code;
3211
-      $this->_error_string = $p_error_string;
3212
-  }
3213
-  // ---------------------------------------------------------------------------
3214
-
3215
-  // ---------------------------------------------------------------------------
3216
-  // Function : _errorReset()
3217
-  // Description :
3218
-  // Parameters :
3219
-  // ---------------------------------------------------------------------------
3220
-  /**
3221
-  * Archive_Zip::_errorReset()
3222
-  *
3223
-  * { Description }
3224
-  *
3225
-  */
3226
-  public function _errorReset()
3227
-  {
3228
-      $this->_error_code = 1;
3229
-      $this->_error_string = '';
3230
-  }
3231
-  // ---------------------------------------------------------------------------
3232
-
3233
-  // ---------------------------------------------------------------------------
3234
-  // Function : $this->_tool_PathReduction()
3235
-  // Description :
3236
-  // Parameters :
3237
-  // Return Values :
3238
-  // ---------------------------------------------------------------------------
3239
-  /**
3240
-  * _tool_PathReduction()
3241
-  *
3242
-  * { Description }
3243
-  *
3244
-  */
3245
-  public function _tool_PathReduction($p_dir)
3246
-  {
3247
-      $v_result = '';
3177
+                                'callback_pre_extract', 'callback_post_extract');
3178
+        for ($i=0; $i < count($v_callback_list); $i++) {
3179
+            $v_key=$v_callback_list[$i];
3180
+            if (isset($p_params[$v_key]) && ($p_params[$v_key] != '')) {
3181
+                if (!function_exists($p_params[$v_key])) {
3182
+                    $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAM_VALUE,
3183
+                                    "Callback '".$p_params[$v_key]
3184
+                                    ."()' is not an existing function for "
3185
+                                    ."parameter '".$v_key."'");
3186
+                    return Archive_Zip::errorCode();
3187
+                }
3188
+            }
3189
+        }
3190
+
3191
+        return 1;
3192
+    }
3193
+    // ---------------------------------------------------------------------------
3194
+
3195
+    // ---------------------------------------------------------------------------
3196
+    // Function : _errorLog()
3197
+    // Description :
3198
+    // Parameters :
3199
+    // ---------------------------------------------------------------------------
3200
+    /**
3201
+     * Archive_Zip::_errorLog()
3202
+     *
3203
+     * { Description }
3204
+     *
3205
+     * @param integer $p_error_code
3206
+     * @param string $p_error_string
3207
+     */
3208
+    public function _errorLog($p_error_code=0, $p_error_string='')
3209
+    {
3210
+        $this->_error_code = $p_error_code;
3211
+        $this->_error_string = $p_error_string;
3212
+    }
3213
+    // ---------------------------------------------------------------------------
3214
+
3215
+    // ---------------------------------------------------------------------------
3216
+    // Function : _errorReset()
3217
+    // Description :
3218
+    // Parameters :
3219
+    // ---------------------------------------------------------------------------
3220
+    /**
3221
+     * Archive_Zip::_errorReset()
3222
+     *
3223
+     * { Description }
3224
+     *
3225
+     */
3226
+    public function _errorReset()
3227
+    {
3228
+        $this->_error_code = 1;
3229
+        $this->_error_string = '';
3230
+    }
3231
+    // ---------------------------------------------------------------------------
3232
+
3233
+    // ---------------------------------------------------------------------------
3234
+    // Function : $this->_tool_PathReduction()
3235
+    // Description :
3236
+    // Parameters :
3237
+    // Return Values :
3238
+    // ---------------------------------------------------------------------------
3239
+    /**
3240
+     * _tool_PathReduction()
3241
+     *
3242
+     * { Description }
3243
+     *
3244
+     */
3245
+    public function _tool_PathReduction($p_dir)
3246
+    {
3247
+        $v_result = '';
3248 3248
 
3249 3249
     // ----- Look for not empty path
3250 3250
     if ($p_dir != '') {
3251 3251
         // ----- Explode path by directory names
3252
-      $v_list = explode('/', $p_dir);
3252
+        $v_list = explode('/', $p_dir);
3253 3253
 
3254
-      // ----- Study directories from last to first
3255
-      for ($i= count($v_list) - 1; $i >= 0; $i--) {
3256
-          // ----- Look for current path
3254
+        // ----- Study directories from last to first
3255
+        for ($i= count($v_list) - 1; $i >= 0; $i--) {
3256
+            // ----- Look for current path
3257 3257
         if ($v_list[$i] == '.') {
3258 3258
             // ----- Ignore this directory
3259
-          // Should be the first $i=0, but no check is done
3259
+            // Should be the first $i=0, but no check is done
3260 3260
         } elseif ($v_list[$i] == '..') {
3261 3261
             // ----- Ignore it and ignore the $i-1
3262
-          $i--;
3262
+            $i--;
3263 3263
         } elseif (($v_list[$i] == '') && ($i != (count($v_list) - 1)) && ($i != 0)) {
3264 3264
             // ----- Ignore only the double '//' in path,
3265
-          // but not the first and last '/'
3265
+            // but not the first and last '/'
3266 3266
         } else {
3267 3267
             $v_result = $v_list[$i].($i!=(count($v_list) - 1)? '/' . $v_result: '');
3268 3268
         }
3269
-      }
3269
+        }
3270 3270
     }
3271 3271
 
3272 3272
     // ----- Return
3273 3273
     return $v_result;
3274
-  }
3275
-  // ---------------------------------------------------------------------------
3276
-
3277
-  // ---------------------------------------------------------------------------
3278
-  // Function : $this->_tool_PathInclusion()
3279
-  // Description :
3280
-  //   This function indicates if the path $p_path is under the $p_dir tree. Or,
3281
-  //   said in an other way, if the file or sub-dir $p_path is inside the dir
3282
-  //   $p_dir.
3283
-  //   The function indicates also if the path is exactly the same as the dir.
3284
-  //   This function supports path with duplicated '/' like '//', but does not
3285
-  //   support '.' or '..' statements.
3286
-  // Parameters :
3287
-  // Return Values :
3288
-  //   0 if $p_path is not inside directory $p_dir
3289
-  //   1 if $p_path is inside directory $p_dir
3290
-  //   2 if $p_path is exactly the same as $p_dir
3291
-  // ---------------------------------------------------------------------------
3292
-  /**
3293
-  * _tool_PathInclusion()
3294
-  *
3295
-  * { Description }
3296
-  *
3297
-  */
3298
-  public function _tool_PathInclusion($p_dir, $p_path)
3299
-  {
3300
-      $v_result = 1;
3274
+    }
3275
+    // ---------------------------------------------------------------------------
3276
+
3277
+    // ---------------------------------------------------------------------------
3278
+    // Function : $this->_tool_PathInclusion()
3279
+    // Description :
3280
+    //   This function indicates if the path $p_path is under the $p_dir tree. Or,
3281
+    //   said in an other way, if the file or sub-dir $p_path is inside the dir
3282
+    //   $p_dir.
3283
+    //   The function indicates also if the path is exactly the same as the dir.
3284
+    //   This function supports path with duplicated '/' like '//', but does not
3285
+    //   support '.' or '..' statements.
3286
+    // Parameters :
3287
+    // Return Values :
3288
+    //   0 if $p_path is not inside directory $p_dir
3289
+    //   1 if $p_path is inside directory $p_dir
3290
+    //   2 if $p_path is exactly the same as $p_dir
3291
+    // ---------------------------------------------------------------------------
3292
+    /**
3293
+     * _tool_PathInclusion()
3294
+     *
3295
+     * { Description }
3296
+     *
3297
+     */
3298
+    public function _tool_PathInclusion($p_dir, $p_path)
3299
+    {
3300
+        $v_result = 1;
3301 3301
 
3302 3302
     // ----- Explode dir and path by directory separator
3303 3303
     $v_list_dir = explode('/', $p_dir);
3304
-      $v_list_dir_size = count($v_list_dir);
3305
-      $v_list_path = explode('/', $p_path);
3306
-      $v_list_path_size = count($v_list_path);
3304
+        $v_list_dir_size = count($v_list_dir);
3305
+        $v_list_path = explode('/', $p_path);
3306
+        $v_list_path_size = count($v_list_path);
3307 3307
 
3308 3308
     // ----- Study directories paths
3309 3309
     $i = 0;
3310
-      $j = 0;
3311
-      while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && $v_result) {
3312
-
3313
-      // ----- Look for empty dir (path reduction)
3314
-      if ($v_list_dir[$i] == '') {
3315
-          $i++;
3316
-          continue;
3317
-      }
3318
-          if ($v_list_path[$j] == '') {
3319
-              $j++;
3320
-              continue;
3321
-          }
3322
-
3323
-      // ----- Compare the items
3324
-      if (($v_list_dir[$i] != $v_list_path[$j])
3310
+        $j = 0;
3311
+        while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && $v_result) {
3312
+
3313
+        // ----- Look for empty dir (path reduction)
3314
+        if ($v_list_dir[$i] == '') {
3315
+            $i++;
3316
+            continue;
3317
+        }
3318
+            if ($v_list_path[$j] == '') {
3319
+                $j++;
3320
+                continue;
3321
+            }
3322
+
3323
+        // ----- Compare the items
3324
+        if (($v_list_dir[$i] != $v_list_path[$j])
3325 3325
           && ($v_list_dir[$i] != '')
3326 3326
           && ($v_list_path[$j] != '')) {
3327
-          $v_result = 0;
3328
-      }
3327
+            $v_result = 0;
3328
+        }
3329 3329
 
3330
-      // ----- Next items
3331
-      $i++;
3332
-          $j++;
3333
-      }
3330
+        // ----- Next items
3331
+        $i++;
3332
+            $j++;
3333
+        }
3334 3334
 
3335 3335
     // ----- Look if everything seems to be the same
3336 3336
     if ($v_result) {
3337 3337
         // ----- Skip all the empty items
3338
-      while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) {
3339
-          $j++;
3340
-      }
3338
+        while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) {
3339
+            $j++;
3340
+        }
3341 3341
         while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) {
3342 3342
             $i++;
3343 3343
         }
@@ -3353,142 +3353,142 @@  discard block
 block discarded – undo
3353 3353
 
3354 3354
     // ----- Return
3355 3355
     return $v_result;
3356
-  }
3357
-  // ---------------------------------------------------------------------------
3358
-
3359
-  // ---------------------------------------------------------------------------
3360
-  // Function : $this->_tool_CopyBlock()
3361
-  // Description :
3362
-  // Parameters :
3363
-  //   $p_mode : read/write compression mode
3364
-  //             0 : src & dest normal
3365
-  //             1 : src gzip, dest normal
3366
-  //             2 : src normal, dest gzip
3367
-  //             3 : src & dest gzip
3368
-  // Return Values :
3369
-  // ---------------------------------------------------------------------------
3370
-  /**
3371
-  * _tool_CopyBlock()
3372
-  *
3373
-  * { Description }
3374
-  *
3375
-  * @param integer $p_mode
3376
-  */
3377
-  public function _tool_CopyBlock($p_src, $p_dest, $p_size, $p_mode=0)
3378
-  {
3379
-      $v_result = 1;
3380
-
3381
-      if ($p_mode==0) {
3382
-          while ($p_size != 0) {
3383
-              $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
3356
+    }
3357
+    // ---------------------------------------------------------------------------
3358
+
3359
+    // ---------------------------------------------------------------------------
3360
+    // Function : $this->_tool_CopyBlock()
3361
+    // Description :
3362
+    // Parameters :
3363
+    //   $p_mode : read/write compression mode
3364
+    //             0 : src & dest normal
3365
+    //             1 : src gzip, dest normal
3366
+    //             2 : src normal, dest gzip
3367
+    //             3 : src & dest gzip
3368
+    // Return Values :
3369
+    // ---------------------------------------------------------------------------
3370
+    /**
3371
+     * _tool_CopyBlock()
3372
+     *
3373
+     * { Description }
3374
+     *
3375
+     * @param integer $p_mode
3376
+     */
3377
+    public function _tool_CopyBlock($p_src, $p_dest, $p_size, $p_mode=0)
3378
+    {
3379
+        $v_result = 1;
3380
+
3381
+        if ($p_mode==0) {
3382
+            while ($p_size != 0) {
3383
+                $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
3384 3384
                         ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE);
3385
-              $v_buffer = @fread($p_src, $v_read_size);
3386
-              @fwrite($p_dest, $v_buffer, $v_read_size);
3387
-              $p_size -= $v_read_size;
3388
-          }
3389
-      } elseif ($p_mode==1) {
3390
-          while ($p_size != 0) {
3391
-              $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
3385
+                $v_buffer = @fread($p_src, $v_read_size);
3386
+                @fwrite($p_dest, $v_buffer, $v_read_size);
3387
+                $p_size -= $v_read_size;
3388
+            }
3389
+        } elseif ($p_mode==1) {
3390
+            while ($p_size != 0) {
3391
+                $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
3392 3392
                         ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE);
3393
-              $v_buffer = @gzread($p_src, $v_read_size);
3394
-              @fwrite($p_dest, $v_buffer, $v_read_size);
3395
-              $p_size -= $v_read_size;
3396
-          }
3397
-      } elseif ($p_mode==2) {
3398
-          while ($p_size != 0) {
3399
-              $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
3393
+                $v_buffer = @gzread($p_src, $v_read_size);
3394
+                @fwrite($p_dest, $v_buffer, $v_read_size);
3395
+                $p_size -= $v_read_size;
3396
+            }
3397
+        } elseif ($p_mode==2) {
3398
+            while ($p_size != 0) {
3399
+                $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
3400 3400
                         ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE);
3401
-              $v_buffer = @fread($p_src, $v_read_size);
3402
-              @gzwrite($p_dest, $v_buffer, $v_read_size);
3403
-              $p_size -= $v_read_size;
3404
-          }
3405
-      } elseif ($p_mode==3) {
3406
-          while ($p_size != 0) {
3407
-              $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
3401
+                $v_buffer = @fread($p_src, $v_read_size);
3402
+                @gzwrite($p_dest, $v_buffer, $v_read_size);
3403
+                $p_size -= $v_read_size;
3404
+            }
3405
+        } elseif ($p_mode==3) {
3406
+            while ($p_size != 0) {
3407
+                $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
3408 3408
                         ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE);
3409
-              $v_buffer = @gzread($p_src, $v_read_size);
3410
-              @gzwrite($p_dest, $v_buffer, $v_read_size);
3411
-              $p_size -= $v_read_size;
3412
-          }
3413
-      }
3409
+                $v_buffer = @gzread($p_src, $v_read_size);
3410
+                @gzwrite($p_dest, $v_buffer, $v_read_size);
3411
+                $p_size -= $v_read_size;
3412
+            }
3413
+        }
3414 3414
 
3415 3415
     // ----- Return
3416 3416
     return $v_result;
3417
-  }
3418
-  // ---------------------------------------------------------------------------
3419
-
3420
-  // ---------------------------------------------------------------------------
3421
-  // Function : $this->_tool_Rename()
3422
-  // Description :
3423
-  //   This function tries to do a simple rename() function. If it fails, it
3424
-  //   tries to copy the $p_src file in a new $p_dest file and then unlink the
3425
-  //   first one.
3426
-  // Parameters :
3427
-  //   $p_src : Old filename
3428
-  //   $p_dest : New filename
3429
-  // Return Values :
3430
-  //   1 on success, 0 on failure.
3431
-  // ---------------------------------------------------------------------------
3432
-  /**
3433
-  * _tool_Rename()
3434
-  *
3435
-  * { Description }
3436
-  *
3437
-  */
3438
-  public function _tool_Rename($p_src, $p_dest)
3439
-  {
3440
-      $v_result = 1;
3417
+    }
3418
+    // ---------------------------------------------------------------------------
3419
+
3420
+    // ---------------------------------------------------------------------------
3421
+    // Function : $this->_tool_Rename()
3422
+    // Description :
3423
+    //   This function tries to do a simple rename() function. If it fails, it
3424
+    //   tries to copy the $p_src file in a new $p_dest file and then unlink the
3425
+    //   first one.
3426
+    // Parameters :
3427
+    //   $p_src : Old filename
3428
+    //   $p_dest : New filename
3429
+    // Return Values :
3430
+    //   1 on success, 0 on failure.
3431
+    // ---------------------------------------------------------------------------
3432
+    /**
3433
+     * _tool_Rename()
3434
+     *
3435
+     * { Description }
3436
+     *
3437
+     */
3438
+    public function _tool_Rename($p_src, $p_dest)
3439
+    {
3440
+        $v_result = 1;
3441 3441
 
3442 3442
     // ----- Try to rename the files
3443 3443
     if (!@rename($p_src, $p_dest)) {
3444 3444
 
3445
-      // ----- Try to copy & unlink the src
3446
-      if (!@copy($p_src, $p_dest)) {
3447
-          $v_result = 0;
3448
-      } elseif (!@unlink($p_src)) {
3449
-          $v_result = 0;
3450
-      }
3445
+        // ----- Try to copy & unlink the src
3446
+        if (!@copy($p_src, $p_dest)) {
3447
+            $v_result = 0;
3448
+        } elseif (!@unlink($p_src)) {
3449
+            $v_result = 0;
3450
+        }
3451 3451
     }
3452 3452
 
3453 3453
     // ----- Return
3454 3454
     return $v_result;
3455
-  }
3456
-  // ---------------------------------------------------------------------------
3457
-
3458
-  // ---------------------------------------------------------------------------
3459
-  // Function : $this->_tool_TranslateWinPath()
3460
-  // Description :
3461
-  //   Translate windows path by replacing '\' by '/' and optionally removing
3462
-  //   drive letter.
3463
-  // Parameters :
3464
-  //   $p_path : path to translate.
3465
-  //   $p_remove_disk_letter : true | false
3466
-  // Return Values :
3467
-  //   The path translated.
3468
-  // ---------------------------------------------------------------------------
3469
-  /**
3470
-  * _tool_TranslateWinPath()
3471
-  *
3472
-  * { Description }
3473
-  *
3474
-  * @param [type] $p_remove_disk_letter
3475
-  */
3476
-  public function _tool_TranslateWinPath($p_path, $p_remove_disk_letter=true)
3477
-  {
3478
-      if (stristr(php_uname(), 'windows')) {
3479
-          // ----- Look for potential disk letter
3480
-      if ($p_remove_disk_letter
3455
+    }
3456
+    // ---------------------------------------------------------------------------
3457
+
3458
+    // ---------------------------------------------------------------------------
3459
+    // Function : $this->_tool_TranslateWinPath()
3460
+    // Description :
3461
+    //   Translate windows path by replacing '\' by '/' and optionally removing
3462
+    //   drive letter.
3463
+    // Parameters :
3464
+    //   $p_path : path to translate.
3465
+    //   $p_remove_disk_letter : true | false
3466
+    // Return Values :
3467
+    //   The path translated.
3468
+    // ---------------------------------------------------------------------------
3469
+    /**
3470
+     * _tool_TranslateWinPath()
3471
+     *
3472
+     * { Description }
3473
+     *
3474
+     * @param [type] $p_remove_disk_letter
3475
+     */
3476
+    public function _tool_TranslateWinPath($p_path, $p_remove_disk_letter=true)
3477
+    {
3478
+        if (stristr(php_uname(), 'windows')) {
3479
+            // ----- Look for potential disk letter
3480
+        if ($p_remove_disk_letter
3481 3481
           && (($v_position = strpos($p_path, ':')) != false)) {
3482
-          $p_path = substr($p_path, $v_position+1);
3483
-      }
3484
-      // ----- Change potential windows directory separator
3485
-      if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0, 1) == '\\')) {
3486
-          $p_path = strtr($p_path, '\\', '/');
3487
-      }
3488
-      }
3489
-      return $p_path;
3490
-  }
3491
-  // ---------------------------------------------------------------------------
3482
+            $p_path = substr($p_path, $v_position+1);
3483
+        }
3484
+        // ----- Change potential windows directory separator
3485
+        if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0, 1) == '\\')) {
3486
+            $p_path = strtr($p_path, '\\', '/');
3487
+        }
3488
+        }
3489
+        return $p_path;
3490
+    }
3491
+    // ---------------------------------------------------------------------------
3492 3492
 }
3493
-  // End of class
3493
+    // End of class
3494 3494
 
Please login to merge, or discard this patch.
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -106,24 +106,24 @@  discard block
 block discarded – undo
106 106
     *
107 107
     * @var string Name of the Zip file
108 108
     */
109
-    public $_zipname='';
109
+    public $_zipname = '';
110 110
 
111 111
     /**
112 112
     * File descriptor of the opened Zip file.
113 113
     *
114 114
     * @var int Internal zip file descriptor
115 115
     */
116
-    public $_zip_fd=0;
116
+    public $_zip_fd = 0;
117 117
 
118 118
     /**
119 119
     * @var int last error code
120 120
     */
121
-    public $_error_code=1;
121
+    public $_error_code = 1;
122 122
 
123 123
     /**
124 124
     * @var string Last error description
125 125
     */
126
-    public $_error_string='';
126
+    public $_error_string = '';
127 127
 
128 128
     // {{{ constructor
129 129
     /**
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
           PEAR::loadExtension('zlib');
145 145
       }*/ // GIJ
146 146
       if (!extension_loaded('zlib')) {
147
-          die("The extension 'zlib' couldn't be found.\n". 'Please make sure your version of PHP was built ' .
147
+          die("The extension 'zlib' couldn't be found.\n".'Please make sure your version of PHP was built '.
148 148
               "with 'zlib' support.\n");
149 149
           return false;
150 150
       }
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     * @return mixed An array of file description on success,
181 181
     *               an error code on error
182 182
     */
183
-    public function create($p_filelist, $p_params=0)
183
+    public function create($p_filelist, $p_params = 0)
184 184
     {
185 185
         $this->_errorReset();
186 186
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
     * @return mixed An array of file description on success,
252 252
     *               0 on an unrecoverable failure, an error code is logged.
253 253
     */
254
-    public function add($p_filelist, $p_params=0)
254
+    public function add($p_filelist, $p_params = 0)
255 255
     {
256 256
         $this->_errorReset();
257 257
 
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
     * @return mixed An array of file description on success,
402 402
     *               0 on an unrecoverable failure, an error code is logged.
403 403
     */
404
-    public function extract($p_params=0)
404
+    public function extract($p_params = 0)
405 405
     {
406 406
         $this->_errorReset();
407 407
 
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
     * @param  boolean $p_with_code  If true, gives the name and the int value.
672 672
     * @return string The error name.
673 673
     */
674
-    public function errorName($p_with_code=false)
674
+    public function errorName($p_with_code = false)
675 675
     {
676 676
         $v_const_list = get_defined_constants();
677 677
 
@@ -685,8 +685,8 @@  discard block
 block discarded – undo
685 685
         }
686 686
 
687 687
         // ----- Search the name form the code value
688
-        $v_key=array_search($this->_error_code, $v_error_list, true);
689
-        if ($v_key!=false) {
688
+        $v_key = array_search($this->_error_code, $v_error_list, true);
689
+        if ($v_key != false) {
690 690
             $v_value = $v_key;
691 691
         } else {
692 692
             $v_value = 'NoName';
@@ -711,12 +711,12 @@  discard block
 block discarded – undo
711 711
     *                         and the error code.
712 712
     * @return string The error description.
713 713
     */
714
-    public function errorInfo($p_full=false)
714
+    public function errorInfo($p_full = false)
715 715
     {
716 716
         if ($p_full) {
717
-            return($this->errorName(true) . ' : ' . $this->_error_string);
717
+            return($this->errorName(true).' : '.$this->_error_string);
718 718
         } else {
719
-            return($this->_error_string . ' [code ' . $this->_error_code . ']');
719
+            return($this->_error_string.' [code '.$this->_error_code.']');
720 720
         }
721 721
     }
722 722
     // }}}
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
   *
750 750
   * @param integer $p_level
751 751
   */
752
-  public function _checkFormat($p_level=0)
752
+  public function _checkFormat($p_level = 0)
753 753
   {
754 754
       $v_result = true;
755 755
 
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
   */
801 801
   public function _create($p_list, &$p_result_list, &$p_params)
802 802
   {
803
-      $v_result=1;
803
+      $v_result = 1;
804 804
       $v_list_detail = array();
805 805
 
806 806
       $p_add_dir = $p_params['add_path'];
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
   */
839 839
   public function _add($p_list, &$p_result_list, &$p_params)
840 840
   {
841
-      $v_result=1;
841
+      $v_result = 1;
842 842
       $v_list_detail = array();
843 843
 
844 844
       $p_add_dir = $p_params['add_path'];
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
     }
853 853
 
854 854
     // ----- Open the zip file
855
-    if (($v_result=$this->_openFd('rb')) != 1) {
855
+    if (($v_result = $this->_openFd('rb')) != 1) {
856 856
         return $v_result;
857 857
     }
858 858
 
@@ -925,10 +925,10 @@  discard block
 block discarded – undo
925 925
       }
926 926
 
927 927
     // ----- Create the Central Dir files header
928
-    for ($i=0, $v_count=0; $i < count($v_header_list); $i++) {
928
+    for ($i = 0, $v_count = 0; $i < count($v_header_list); $i++) {
929 929
         // ----- Create the file header
930 930
       if ($v_header_list[$i]['status'] == 'ok') {
931
-          if (($v_result=$this->_writeCentralFileHeader($v_header_list[$i]))!=1) {
931
+          if (($v_result = $this->_writeCentralFileHeader($v_header_list[$i])) != 1) {
932 932
               fclose($v_zip_temp_fd);
933 933
               $this->_closeFd();
934 934
               @unlink($v_zip_temp_name);
@@ -947,7 +947,7 @@  discard block
 block discarded – undo
947 947
     $v_comment = '';
948 948
 
949 949
     // ----- Calculate the size of the central header
950
-    $v_size = @ftell($this->_zip_fd)-$v_offset;
950
+    $v_size = @ftell($this->_zip_fd) - $v_offset;
951 951
 
952 952
     // ----- Create the central dir footer
953 953
     if (($v_result = $this->_writeCentralHeader($v_count
@@ -999,7 +999,7 @@  discard block
 block discarded – undo
999 999
   */
1000 1000
   public function _openFd($p_mode)
1001 1001
   {
1002
-      $v_result=1;
1002
+      $v_result = 1;
1003 1003
 
1004 1004
     // ----- Look if already open
1005 1005
     if ($this->_zip_fd != 0) {
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
   */
1035 1035
   public function _closeFd()
1036 1036
   {
1037
-      $v_result=1;
1037
+      $v_result = 1;
1038 1038
 
1039 1039
       if ($this->_zip_fd != 0) {
1040 1040
           @fclose($this->_zip_fd);
@@ -1068,7 +1068,7 @@  discard block
 block discarded – undo
1068 1068
   public function _addList($p_list, &$p_result_list,
1069 1069
                     $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_params)
1070 1070
   {
1071
-      $v_result=1;
1071
+      $v_result = 1;
1072 1072
 
1073 1073
     // ----- Add the files
1074 1074
     $v_header_list = array();
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
     $v_offset = @ftell($this->_zip_fd);
1083 1083
 
1084 1084
     // ----- Create the Central Dir files header
1085
-    for ($i=0, $v_count=0; $i < count($v_header_list); $i++) {
1085
+    for ($i = 0, $v_count = 0; $i < count($v_header_list); $i++) {
1086 1086
         // ----- Create the file header
1087 1087
       if ($v_header_list[$i]['status'] == 'ok') {
1088 1088
           if (($v_result = $this->_writeCentralFileHeader($v_header_list[$i])) != 1) {
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
     $v_comment = '';
1100 1100
 
1101 1101
     // ----- Calculate the size of the central header
1102
-    $v_size = @ftell($this->_zip_fd)-$v_offset;
1102
+    $v_size = @ftell($this->_zip_fd) - $v_offset;
1103 1103
 
1104 1104
     // ----- Create the central dir footer
1105 1105
     if (($v_result = $this->_writeCentralHeader($v_count, $v_size, $v_offset,
@@ -1139,14 +1139,14 @@  discard block
 block discarded – undo
1139 1139
                         $p_add_dir, $p_remove_dir, $p_remove_all_dir,
1140 1140
                         &$p_params)
1141 1141
   {
1142
-      $v_result=1;
1142
+      $v_result = 1;
1143 1143
       $v_header = array();
1144 1144
 
1145 1145
     // ----- Recuperate the current number of elt in list
1146 1146
     $v_nb = count($p_result_list);
1147 1147
 
1148 1148
     // ----- Loop on the files
1149
-    for ($j=0; ($j<count($p_list)) && ($v_result==1); $j++) {
1149
+    for ($j = 0; ($j < count($p_list)) && ($v_result == 1); $j++) {
1150 1150
         // ----- Recuperate the filename
1151 1151
       $p_filename = $this->_tool_TranslateWinPath($p_list[$j], false);
1152 1152
 
@@ -1179,7 +1179,7 @@  discard block
 block discarded – undo
1179 1179
 
1180 1180
         // ----- Look for path
1181 1181
         if ($p_filename != '.') {
1182
-            $v_path = $p_filename . '/';
1182
+            $v_path = $p_filename.'/';
1183 1183
         } else {
1184 1184
             $v_path = '';
1185 1185
         }
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
   */
1241 1241
   public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_params)
1242 1242
   {
1243
-      $v_result=1;
1243
+      $v_result = 1;
1244 1244
 
1245 1245
       if ($p_filename == '') {
1246 1246
           // ----- Error log
@@ -1265,7 +1265,7 @@  discard block
 block discarded – undo
1265 1265
 
1266 1266
         if ((substr($p_filename, 0, 2) == './') || (substr($p_remove_dir, 0, 2) == './')) {
1267 1267
             if ((substr($p_filename, 0, 2) == './') && (substr($p_remove_dir, 0, 2) != './')) {
1268
-                $p_remove_dir = './' . $p_remove_dir;
1268
+                $p_remove_dir = './'.$p_remove_dir;
1269 1269
             }
1270 1270
             if ((substr($p_filename, 0, 2) != './') && (substr($p_remove_dir, 0, 2) == './')) {
1271 1271
                 $p_remove_dir = substr($p_remove_dir, 2);
@@ -1289,7 +1289,7 @@  discard block
 block discarded – undo
1289 1289
         if (substr($p_add_dir, -1) == '/') {
1290 1290
             $v_stored_filename = $p_add_dir.$v_stored_filename;
1291 1291
         } else {
1292
-            $v_stored_filename = $p_add_dir . '/' . $v_stored_filename;
1292
+            $v_stored_filename = $p_add_dir.'/'.$v_stored_filename;
1293 1293
         }
1294 1294
     }
1295 1295
 
@@ -1324,7 +1324,7 @@  discard block
 block discarded – undo
1324 1324
       $p_header['comment_len'] = 0;
1325 1325
       $p_header['disk'] = 0;
1326 1326
       $p_header['internal'] = 0;
1327
-      $p_header['external'] = (is_file($p_filename)?0xFE49FFE0:0x41FF0010);
1327
+      $p_header['external'] = (is_file($p_filename) ? 0xFE49FFE0 : 0x41FF0010);
1328 1328
       $p_header['offset'] = 0;
1329 1329
       $p_header['filename'] = $p_filename;
1330 1330
       $p_header['stored_filename'] = $v_stored_filename;
@@ -1420,7 +1420,7 @@  discard block
 block discarded – undo
1420 1420
         $p_header['filename'] .= '/';
1421 1421
           $p_header['filename_len']++;
1422 1422
           $p_header['size'] = 0;
1423
-          $p_header['external'] = 0x41FF0010;   // Value for a folder : to be checked
1423
+          $p_header['external'] = 0x41FF0010; // Value for a folder : to be checked
1424 1424
 
1425 1425
         // ----- Call the header generation
1426 1426
         if (($v_result = $this->_writeFileHeader($p_header)) != 1) {
@@ -1469,7 +1469,7 @@  discard block
 block discarded – undo
1469 1469
   */
1470 1470
   public function _writeFileHeader(&$p_header)
1471 1471
   {
1472
-      $v_result=1;
1472
+      $v_result = 1;
1473 1473
 
1474 1474
     // TBC
1475 1475
     //for(reset($p_header); $key = key($p_header); next($p_header)) {
@@ -1480,8 +1480,8 @@  discard block
 block discarded – undo
1480 1480
 
1481 1481
     // ----- Transform UNIX mtime to DOS format mdate/mtime
1482 1482
     $v_date = getdate($p_header['mtime']);
1483
-      $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
1484
-      $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
1483
+      $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2;
1484
+      $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday'];
1485 1485
 
1486 1486
     // ----- Packed data
1487 1487
     $v_binary_data = pack('VvvvvvVVVvv', 0x04034b50, $p_header['version'], $p_header['flag'],
@@ -1519,7 +1519,7 @@  discard block
 block discarded – undo
1519 1519
   */
1520 1520
   public function _writeCentralFileHeader(&$p_header)
1521 1521
   {
1522
-      $v_result=1;
1522
+      $v_result = 1;
1523 1523
 
1524 1524
     // TBC
1525 1525
     //for(reset($p_header); $key = key($p_header); next($p_header)) {
@@ -1527,8 +1527,8 @@  discard block
 block discarded – undo
1527 1527
 
1528 1528
     // ----- Transform UNIX mtime to DOS format mdate/mtime
1529 1529
     $v_date = getdate($p_header['mtime']);
1530
-      $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
1531
-      $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
1530
+      $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2;
1531
+      $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday'];
1532 1532
 
1533 1533
     // ----- Packed data
1534 1534
     $v_binary_data = pack('VvvvvvvVVVvvvvvVV', 0x02014b50, $p_header['version'], $p_header['version_extracted'],
@@ -1570,7 +1570,7 @@  discard block
 block discarded – undo
1570 1570
   */
1571 1571
   public function _writeCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment)
1572 1572
   {
1573
-      $v_result=1;
1573
+      $v_result = 1;
1574 1574
 
1575 1575
     // ----- Packed data
1576 1576
     $v_binary_data = pack('VvvvvVVv', 0x06054b50, 0, 0, $p_nb_entries, $p_nb_entries, $p_size, $p_offset, strlen($p_comment));
@@ -1602,7 +1602,7 @@  discard block
 block discarded – undo
1602 1602
   */
1603 1603
   public function _list(&$p_list)
1604 1604
   {
1605
-      $v_result=1;
1605
+      $v_result = 1;
1606 1606
 
1607 1607
     // ----- Open the zip file
1608 1608
     if (($this->_zip_fd = @fopen($this->_zipname, 'rb')) == 0) {
@@ -1630,7 +1630,7 @@  discard block
 block discarded – undo
1630 1630
       }
1631 1631
 
1632 1632
     // ----- Read each entry
1633
-    for ($i=0; $i<$v_central_dir['entries']; $i++) {
1633
+    for ($i = 0; $i < $v_central_dir['entries']; $i++) {
1634 1634
         // ----- Read the file header
1635 1635
       if (($v_result = $this->_readCentralFileHeader($v_header)) != 1) {
1636 1636
           return $v_result;
@@ -1676,7 +1676,7 @@  discard block
 block discarded – undo
1676 1676
   */
1677 1677
   public function _convertHeader2FileInfo($p_header, &$p_info)
1678 1678
   {
1679
-      $v_result=1;
1679
+      $v_result = 1;
1680 1680
 
1681 1681
     // ----- Get the interesting attributes
1682 1682
     $p_info['filename'] = $p_header['filename'];
@@ -1685,7 +1685,7 @@  discard block
 block discarded – undo
1685 1685
       $p_info['compressed_size'] = $p_header['compressed_size'];
1686 1686
       $p_info['mtime'] = $p_header['mtime'];
1687 1687
       $p_info['comment'] = $p_header['comment'];
1688
-      $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010);
1688
+      $p_info['folder'] = (($p_header['external'] & 0x00000010) == 0x00000010);
1689 1689
       $p_info['index'] = $p_header['index'];
1690 1690
       $p_info['status'] = $p_header['status'];
1691 1691
 
@@ -1718,7 +1718,7 @@  discard block
 block discarded – undo
1718 1718
   */
1719 1719
   public function _extractByRule(&$p_file_list, &$p_params)
1720 1720
   {
1721
-      $v_result=1;
1721
+      $v_result = 1;
1722 1722
 
1723 1723
       $p_path = $p_params['add_path'];
1724 1724
       $p_remove_path = $p_params['remove_path'];
@@ -1728,14 +1728,14 @@  discard block
 block discarded – undo
1728 1728
     if (($p_path == '')
1729 1729
         || ((substr($p_path, 0, 1) != '/')
1730 1730
         && (substr($p_path, 0, 3) != '../') && (substr($p_path, 1, 2) != ':/'))) {
1731
-        $p_path = './' . $p_path;
1731
+        $p_path = './'.$p_path;
1732 1732
     }
1733 1733
 
1734 1734
     // ----- Reduce the path last (and duplicated) '/'
1735 1735
     if (($p_path != './') && ($p_path != '/')) {
1736 1736
         // ----- Look for the path end '/'
1737 1737
       while (substr($p_path, -1) == '/') {
1738
-          $p_path = substr($p_path, 0, strlen($p_path)-1);
1738
+          $p_path = substr($p_path, 0, strlen($p_path) - 1);
1739 1739
       }
1740 1740
     }
1741 1741
 
@@ -1764,7 +1764,7 @@  discard block
 block discarded – undo
1764 1764
 
1765 1765
     // ----- Read each entry
1766 1766
     $j_start = 0;
1767
-      for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) {
1767
+      for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++) {
1768 1768
           // ----- Read next Central dir entry
1769 1769
       @rewind($this->_zip_fd);
1770 1770
           if (@fseek($this->_zip_fd, $v_pos_entry)) {
@@ -1798,7 +1798,7 @@  discard block
 block discarded – undo
1798 1798
           && ($p_params[ARCHIVE_ZIP_PARAM_BY_NAME] != 0)) {
1799 1799
 
1800 1800
           // ----- Look if the filename is in the list
1801
-          for ($j=0;
1801
+          for ($j = 0;
1802 1802
                   ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_NAME]))
1803 1803
                && (!$v_extract);
1804 1804
                $j++) {
@@ -1840,15 +1840,15 @@  discard block
 block discarded – undo
1840 1840
                && ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX] != 0)) {
1841 1841
 
1842 1842
           // ----- Look if the index is in the list
1843
-          for ($j=$j_start; ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) && (!$v_extract); $j++) {
1844
-              if (($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']) && ($i<=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) {
1843
+          for ($j = $j_start; ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) && (!$v_extract); $j++) {
1844
+              if (($i >= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']) && ($i <= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) {
1845 1845
                   $v_extract = true;
1846 1846
               }
1847
-              if ($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) {
1848
-                  $j_start = $j+1;
1847
+              if ($i >= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) {
1848
+                  $j_start = $j + 1;
1849 1849
               }
1850 1850
 
1851
-              if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']>$i) {
1851
+              if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start'] > $i) {
1852 1852
                   break;
1853 1853
               }
1854 1854
           }
@@ -1942,7 +1942,7 @@  discard block
 block discarded – undo
1942 1942
   */
1943 1943
   public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_params)
1944 1944
   {
1945
-      $v_result=1;
1945
+      $v_result = 1;
1946 1946
 
1947 1947
     // ----- Read the file header
1948 1948
     if (($v_result = $this->_readFileHeader($v_header)) != 1) {
@@ -1982,7 +1982,7 @@  discard block
 block discarded – undo
1982 1982
 
1983 1983
     // ----- Add the path
1984 1984
     if ($p_path != '') {
1985
-        $p_entry['filename'] = $p_path . '/' . $p_entry['filename'];
1985
+        $p_entry['filename'] = $p_path.'/'.$p_entry['filename'];
1986 1986
     }
1987 1987
 
1988 1988
     // ----- Look for pre-extract callback
@@ -2048,7 +2048,7 @@  discard block
 block discarded – undo
2048 2048
 
2049 2049
     // ----- Check the directory availability and create it if necessary
2050 2050
     else {
2051
-        if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/')) {
2051
+        if ((($p_entry['external'] & 0x00000010) == 0x00000010) || (substr($p_entry['filename'], -1) == '/')) {
2052 2052
             $v_dir_to_check = $p_entry['filename'];
2053 2053
         } elseif (!strstr($p_entry['filename'], '/')) {
2054 2054
             $v_dir_to_check = '';
@@ -2072,7 +2072,7 @@  discard block
 block discarded – undo
2072 2072
     if ($p_entry['status'] == 'ok') {
2073 2073
 
2074 2074
       // ----- Do the extraction (if not a folder)
2075
-      if (!(($p_entry['external']&0x00000010)==0x00000010)) {
2075
+      if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) {
2076 2076
 
2077 2077
         // ----- Look for not compressed file
2078 2078
         if ($p_entry['compressed_size'] == $p_entry['size']) {
@@ -2177,7 +2177,7 @@  discard block
 block discarded – undo
2177 2177
   */
2178 2178
   public function _extractFileAsString(&$p_entry, &$p_string)
2179 2179
   {
2180
-      $v_result=1;
2180
+      $v_result = 1;
2181 2181
 
2182 2182
     // ----- Read the file header
2183 2183
     $v_header = array();
@@ -2193,7 +2193,7 @@  discard block
 block discarded – undo
2193 2193
     // ----- Trace
2194 2194
 
2195 2195
     // ----- Do the extraction (if not a folder)
2196
-    if (!(($p_entry['external']&0x00000010)==0x00000010)) {
2196
+    if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) {
2197 2197
         // ----- Look for not compressed file
2198 2198
       if ($p_entry['compressed_size'] == $p_entry['size']) {
2199 2199
           // ----- Trace
@@ -2234,7 +2234,7 @@  discard block
 block discarded – undo
2234 2234
   */
2235 2235
   public function _readFileHeader(&$p_header)
2236 2236
   {
2237
-      $v_result=1;
2237
+      $v_result = 1;
2238 2238
 
2239 2239
     // ----- Read the 4 bytes signature
2240 2240
     $v_binary_data = @fread($this->_zip_fd, 4);
@@ -2259,7 +2259,7 @@  discard block
 block discarded – undo
2259 2259
         $p_header['status'] = 'invalid_header';
2260 2260
 
2261 2261
       // ----- Error log
2262
-      $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : ' . strlen($v_binary_data));
2262
+      $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : '.strlen($v_binary_data));
2263 2263
 
2264 2264
       // ----- Return
2265 2265
       return Archive_Zip::errorCode();
@@ -2292,7 +2292,7 @@  discard block
 block discarded – undo
2292 2292
           // ----- Extract time
2293 2293
       $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
2294 2294
           $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
2295
-          $v_seconde = ($p_header['mtime'] & 0x001F)*2;
2295
+          $v_seconde = ($p_header['mtime'] & 0x001F) * 2;
2296 2296
 
2297 2297
       // ----- Extract date
2298 2298
       $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
@@ -2336,7 +2336,7 @@  discard block
 block discarded – undo
2336 2336
   */
2337 2337
   public function _readCentralFileHeader(&$p_header)
2338 2338
   {
2339
-      $v_result=1;
2339
+      $v_result = 1;
2340 2340
 
2341 2341
     // ----- Read the 4 bytes signature
2342 2342
     $v_binary_data = @fread($this->_zip_fd, 4);
@@ -2361,7 +2361,7 @@  discard block
 block discarded – undo
2361 2361
         $p_header['status'] = 'invalid_header';
2362 2362
 
2363 2363
       // ----- Error log
2364
-      $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : ' . strlen($v_binary_data));
2364
+      $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : '.strlen($v_binary_data));
2365 2365
 
2366 2366
       // ----- Return
2367 2367
       return Archive_Zip::errorCode();
@@ -2398,7 +2398,7 @@  discard block
 block discarded – undo
2398 2398
         // ----- Extract time
2399 2399
       $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
2400 2400
         $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
2401
-        $v_seconde = ($p_header['mtime'] & 0x001F)*2;
2401
+        $v_seconde = ($p_header['mtime'] & 0x001F) * 2;
2402 2402
 
2403 2403
       // ----- Extract date
2404 2404
       $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
@@ -2442,7 +2442,7 @@  discard block
 block discarded – undo
2442 2442
   */
2443 2443
   public function _readEndCentralDir(&$p_central_dir)
2444 2444
   {
2445
-      $v_result=1;
2445
+      $v_result = 1;
2446 2446
 
2447 2447
     // ----- Go to the end of the zip file
2448 2448
     $v_size = filesize($this->_zipname);
@@ -2459,8 +2459,8 @@  discard block
 block discarded – undo
2459 2459
     // in this case the end of central dir is at 22 bytes of the file end
2460 2460
     $v_found = 0;
2461 2461
       if ($v_size > 26) {
2462
-          @fseek($this->_zip_fd, $v_size-22);
2463
-          if (($v_pos = @ftell($this->_zip_fd)) != ($v_size-22)) {
2462
+          @fseek($this->_zip_fd, $v_size - 22);
2463
+          if (($v_pos = @ftell($this->_zip_fd)) != ($v_size - 22)) {
2464 2464
               $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT,
2465 2465
                          'Unable to seek back to the middle of the archive \''
2466 2466
                          .$this->_zipname.'\'');
@@ -2485,8 +2485,8 @@  discard block
 block discarded – undo
2485 2485
       if ($v_maximum_size > $v_size) {
2486 2486
           $v_maximum_size = $v_size;
2487 2487
       }
2488
-        @fseek($this->_zip_fd, $v_size-$v_maximum_size);
2489
-        if (@ftell($this->_zip_fd) != ($v_size-$v_maximum_size)) {
2488
+        @fseek($this->_zip_fd, $v_size - $v_maximum_size);
2489
+        if (@ftell($this->_zip_fd) != ($v_size - $v_maximum_size)) {
2490 2490
             $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT,
2491 2491
                          'Unable to seek back to the middle of the archive \''
2492 2492
                          .$this->_zipname.'\'');
@@ -2572,11 +2572,11 @@  discard block
 block discarded – undo
2572 2572
   */
2573 2573
   public function _deleteByRule(&$p_result_list, &$p_params)
2574 2574
   {
2575
-      $v_result=1;
2575
+      $v_result = 1;
2576 2576
       $v_list_detail = array();
2577 2577
 
2578 2578
     // ----- Open the zip file
2579
-    if (($v_result=$this->_openFd('rb')) != 1) {
2579
+    if (($v_result = $this->_openFd('rb')) != 1) {
2580 2580
         // ----- Return
2581 2581
       return $v_result;
2582 2582
     }
@@ -2607,7 +2607,7 @@  discard block
 block discarded – undo
2607 2607
     // ----- Read each entry
2608 2608
     $v_header_list = array();
2609 2609
       $j_start = 0;
2610
-      for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) {
2610
+      for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++) {
2611 2611
 
2612 2612
       // ----- Read the file header
2613 2613
       $v_header_list[$v_nb_extracted] = array();
@@ -2631,7 +2631,7 @@  discard block
 block discarded – undo
2631 2631
           && ($p_params[ARCHIVE_ZIP_PARAM_BY_NAME] != 0)) {
2632 2632
 
2633 2633
           // ----- Look if the filename is in the list
2634
-          for ($j=0;
2634
+          for ($j = 0;
2635 2635
                ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_NAME]))
2636 2636
                  && (!$v_found);
2637 2637
                $j++) {
@@ -2643,7 +2643,7 @@  discard block
 block discarded – undo
2643 2643
                   if ((strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j]))
2644 2644
                       && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) == $p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) {
2645 2645
                       $v_found = true;
2646
-                  } elseif ((($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */
2646
+                  } elseif ((($v_header_list[$v_nb_extracted]['external'] & 0x00000010) == 0x00000010) /* Indicates a folder */
2647 2647
                           && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) {
2648 2648
                       $v_found = true;
2649 2649
                   }
@@ -2679,19 +2679,19 @@  discard block
 block discarded – undo
2679 2679
                && ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX] != 0)) {
2680 2680
 
2681 2681
           // ----- Look if the index is in the list
2682
-          for ($j=$j_start;
2682
+          for ($j = $j_start;
2683 2683
                ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX]))
2684 2684
                  && (!$v_found);
2685 2685
                $j++) {
2686
-              if (($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start'])
2687
-                  && ($i<=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) {
2686
+              if (($i >= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start'])
2687
+                  && ($i <= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) {
2688 2688
                   $v_found = true;
2689 2689
               }
2690
-              if ($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) {
2691
-                  $j_start = $j+1;
2690
+              if ($i >= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) {
2691
+                  $j_start = $j + 1;
2692 2692
               }
2693 2693
 
2694
-              if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']>$i) {
2694
+              if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start'] > $i) {
2695 2695
                   break;
2696 2696
               }
2697 2697
           }
@@ -2724,11 +2724,11 @@  discard block
 block discarded – undo
2724 2724
         }
2725 2725
 
2726 2726
         // ----- Look which file need to be kept
2727
-        for ($i=0; $i < count($v_header_list); $i++) {
2727
+        for ($i = 0; $i < count($v_header_list); $i++) {
2728 2728
 
2729 2729
             // ----- Calculate the position of the header
2730 2730
             @rewind($this->_zip_fd);
2731
-            if (@fseek($this->_zip_fd,  $v_header_list[$i]['offset'])) {
2731
+            if (@fseek($this->_zip_fd, $v_header_list[$i]['offset'])) {
2732 2732
                 // ----- Clean
2733 2733
                 $this->_closeFd();
2734 2734
                 $v_temp_zip->_closeFd();
@@ -2778,9 +2778,9 @@  discard block
 block discarded – undo
2778 2778
         $v_offset = @ftell($v_temp_zip->_zip_fd);
2779 2779
 
2780 2780
         // ----- Re-Create the Central Dir files header
2781
-        for ($i=0; $i < count($v_header_list); $i++) {
2781
+        for ($i = 0; $i < count($v_header_list); $i++) {
2782 2782
             // ----- Create the file header
2783
-            $v_result=$v_temp_zip->_writeCentralFileHeader($v_header_list[$i]);
2783
+            $v_result = $v_temp_zip->_writeCentralFileHeader($v_header_list[$i]);
2784 2784
             if ($v_result != 1) {
2785 2785
                 // ----- Clean
2786 2786
                 $v_temp_zip->_closeFd();
@@ -2800,7 +2800,7 @@  discard block
 block discarded – undo
2800 2800
         $v_comment = '';
2801 2801
 
2802 2802
         // ----- Calculate the size of the central header
2803
-        $v_size = @ftell($v_temp_zip->_zip_fd)-$v_offset;
2803
+        $v_size = @ftell($v_temp_zip->_zip_fd) - $v_offset;
2804 2804
 
2805 2805
         // ----- Create the central dir footer
2806 2806
         $v_result = $v_temp_zip->_writeCentralHeader(count($v_header_list),
@@ -2856,13 +2856,13 @@  discard block
 block discarded – undo
2856 2856
   *
2857 2857
   * @param [type] $p_is_dir
2858 2858
   */
2859
-  public function _dirCheck($p_dir, $p_is_dir=false)
2859
+  public function _dirCheck($p_dir, $p_is_dir = false)
2860 2860
   {
2861 2861
       $v_result = 1;
2862 2862
 
2863 2863
     // ----- Remove the final '/'
2864 2864
     if ($p_is_dir && (substr($p_dir, -1) == '/')) {
2865
-        $p_dir = substr($p_dir, 0, strlen($p_dir)-1);
2865
+        $p_dir = substr($p_dir, 0, strlen($p_dir) - 1);
2866 2866
     }
2867 2867
 
2868 2868
     // ----- Check the directory availability
@@ -2910,7 +2910,7 @@  discard block
 block discarded – undo
2910 2910
   */
2911 2911
   public function _merge(&$p_archive_to_add)
2912 2912
   {
2913
-      $v_result=1;
2913
+      $v_result = 1;
2914 2914
 
2915 2915
     // ----- Look if the archive_to_add exists
2916 2916
     if (!is_file($p_archive_to_add->_zipname)) {
@@ -2927,7 +2927,7 @@  discard block
 block discarded – undo
2927 2927
     }
2928 2928
 
2929 2929
     // ----- Open the zip file
2930
-    if (($v_result=$this->_openFd('rb')) != 1) {
2930
+    if (($v_result = $this->_openFd('rb')) != 1) {
2931 2931
         return $v_result;
2932 2932
     }
2933 2933
 
@@ -2942,7 +2942,7 @@  discard block
 block discarded – undo
2942 2942
     @rewind($this->_zip_fd);
2943 2943
 
2944 2944
     // ----- Open the archive_to_add file
2945
-    if (($v_result=$p_archive_to_add->_openFd('rb')) != 1) {
2945
+    if (($v_result = $p_archive_to_add->_openFd('rb')) != 1) {
2946 2946
         $this->_closeFd();
2947 2947
         return $v_result;
2948 2948
     }
@@ -3022,7 +3022,7 @@  discard block
 block discarded – undo
3022 3022
     $v_comment = '';
3023 3023
 
3024 3024
     // ----- Calculate the size of the (new) central header
3025
-    $v_size = @ftell($v_zip_temp_fd)-$v_offset;
3025
+    $v_size = @ftell($v_zip_temp_fd) - $v_offset;
3026 3026
 
3027 3027
     // ----- Swap the file descriptor
3028 3028
     // Here is a trick : I swap the temporary fd with the zip fd, in order to use
@@ -3088,7 +3088,7 @@  discard block
 block discarded – undo
3088 3088
   */
3089 3089
   public function _duplicate($p_archive_filename)
3090 3090
   {
3091
-      $v_result=1;
3091
+      $v_result = 1;
3092 3092
 
3093 3093
     // ----- Look if the $p_archive_filename exists
3094 3094
     if (!is_file($p_archive_filename)) {
@@ -3101,7 +3101,7 @@  discard block
 block discarded – undo
3101 3101
     }
3102 3102
 
3103 3103
     // ----- Open the zip file
3104
-    if (($v_result=$this->_openFd('wb')) != 1) {
3104
+    if (($v_result = $this->_openFd('wb')) != 1) {
3105 3105
         // ----- Return
3106 3106
       return $v_result;
3107 3107
     }
@@ -3175,8 +3175,8 @@  discard block
 block discarded – undo
3175 3175
     // ----- Check specific parameters
3176 3176
     $v_callback_list = array('callback_pre_add', 'callback_post_add',
3177 3177
                               'callback_pre_extract', 'callback_post_extract');
3178
-      for ($i=0; $i < count($v_callback_list); $i++) {
3179
-          $v_key=$v_callback_list[$i];
3178
+      for ($i = 0; $i < count($v_callback_list); $i++) {
3179
+          $v_key = $v_callback_list[$i];
3180 3180
           if (isset($p_params[$v_key]) && ($p_params[$v_key] != '')) {
3181 3181
               if (!function_exists($p_params[$v_key])) {
3182 3182
                   $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAM_VALUE,
@@ -3205,7 +3205,7 @@  discard block
 block discarded – undo
3205 3205
   * @param integer $p_error_code
3206 3206
   * @param string $p_error_string
3207 3207
   */
3208
-  public function _errorLog($p_error_code=0, $p_error_string='')
3208
+  public function _errorLog($p_error_code = 0, $p_error_string = '')
3209 3209
   {
3210 3210
       $this->_error_code = $p_error_code;
3211 3211
       $this->_error_string = $p_error_string;
@@ -3252,7 +3252,7 @@  discard block
 block discarded – undo
3252 3252
       $v_list = explode('/', $p_dir);
3253 3253
 
3254 3254
       // ----- Study directories from last to first
3255
-      for ($i= count($v_list) - 1; $i >= 0; $i--) {
3255
+      for ($i = count($v_list) - 1; $i >= 0; $i--) {
3256 3256
           // ----- Look for current path
3257 3257
         if ($v_list[$i] == '.') {
3258 3258
             // ----- Ignore this directory
@@ -3264,7 +3264,7 @@  discard block
 block discarded – undo
3264 3264
             // ----- Ignore only the double '//' in path,
3265 3265
           // but not the first and last '/'
3266 3266
         } else {
3267
-            $v_result = $v_list[$i].($i!=(count($v_list) - 1)? '/' . $v_result: '');
3267
+            $v_result = $v_list[$i].($i != (count($v_list) - 1) ? '/'.$v_result : '');
3268 3268
         }
3269 3269
       }
3270 3270
     }
@@ -3374,11 +3374,11 @@  discard block
 block discarded – undo
3374 3374
   *
3375 3375
   * @param integer $p_mode
3376 3376
   */
3377
-  public function _tool_CopyBlock($p_src, $p_dest, $p_size, $p_mode=0)
3377
+  public function _tool_CopyBlock($p_src, $p_dest, $p_size, $p_mode = 0)
3378 3378
   {
3379 3379
       $v_result = 1;
3380 3380
 
3381
-      if ($p_mode==0) {
3381
+      if ($p_mode == 0) {
3382 3382
           while ($p_size != 0) {
3383 3383
               $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
3384 3384
                         ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE);
@@ -3386,7 +3386,7 @@  discard block
 block discarded – undo
3386 3386
               @fwrite($p_dest, $v_buffer, $v_read_size);
3387 3387
               $p_size -= $v_read_size;
3388 3388
           }
3389
-      } elseif ($p_mode==1) {
3389
+      } elseif ($p_mode == 1) {
3390 3390
           while ($p_size != 0) {
3391 3391
               $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
3392 3392
                         ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE);
@@ -3394,7 +3394,7 @@  discard block
 block discarded – undo
3394 3394
               @fwrite($p_dest, $v_buffer, $v_read_size);
3395 3395
               $p_size -= $v_read_size;
3396 3396
           }
3397
-      } elseif ($p_mode==2) {
3397
+      } elseif ($p_mode == 2) {
3398 3398
           while ($p_size != 0) {
3399 3399
               $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
3400 3400
                         ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE);
@@ -3402,7 +3402,7 @@  discard block
 block discarded – undo
3402 3402
               @gzwrite($p_dest, $v_buffer, $v_read_size);
3403 3403
               $p_size -= $v_read_size;
3404 3404
           }
3405
-      } elseif ($p_mode==3) {
3405
+      } elseif ($p_mode == 3) {
3406 3406
           while ($p_size != 0) {
3407 3407
               $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
3408 3408
                         ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE);
@@ -3473,13 +3473,13 @@  discard block
 block discarded – undo
3473 3473
   *
3474 3474
   * @param [type] $p_remove_disk_letter
3475 3475
   */
3476
-  public function _tool_TranslateWinPath($p_path, $p_remove_disk_letter=true)
3476
+  public function _tool_TranslateWinPath($p_path, $p_remove_disk_letter = true)
3477 3477
   {
3478 3478
       if (stristr(php_uname(), 'windows')) {
3479 3479
           // ----- Look for potential disk letter
3480 3480
       if ($p_remove_disk_letter
3481 3481
           && (($v_position = strpos($p_path, ':')) != false)) {
3482
-          $p_path = substr($p_path, $v_position+1);
3482
+          $p_path = substr($p_path, $v_position + 1);
3483 3483
       }
3484 3484
       // ----- Change potential windows directory separator
3485 3485
       if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0, 1) == '\\')) {
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/include/adminmenu_functions.php 1 patch
Spacing   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once dirname(__DIR__).'/class/altsysUtils.class.php' ;
2
+require_once dirname(__DIR__).'/class/altsysUtils.class.php';
3 3
 
4
-define('ALTSYS_ADMINMENU_FILE', XOOPS_CACHE_PATH.'/adminmenu.php') ;
5
-define('ALTSYS_ADMINMENU_HACK_NONE', 0) ;
6
-define('ALTSYS_ADMINMENU_HACK_2COL', 1) ;
7
-define('ALTSYS_ADMINMENU_HACK_NOIMG', 2) ;
8
-define('ALTSYS_ADMINMENU_HACK_XCSTY', 3) ;
4
+define('ALTSYS_ADMINMENU_FILE', XOOPS_CACHE_PATH.'/adminmenu.php');
5
+define('ALTSYS_ADMINMENU_HACK_NONE', 0);
6
+define('ALTSYS_ADMINMENU_HACK_2COL', 1);
7
+define('ALTSYS_ADMINMENU_HACK_NOIMG', 2);
8
+define('ALTSYS_ADMINMENU_HACK_XCSTY', 3);
9 9
 
10 10
 
11 11
 //
@@ -13,73 +13,73 @@  discard block
 block discarded – undo
13 13
 //
14 14
 function altsys_adminmenu_insert_mymenu(&$module)
15 15
 {
16
-    global $altsysModuleConfig ;
16
+    global $altsysModuleConfig;
17 17
 
18 18
     if (empty($altsysModuleConfig['adminmenu_insert_mymenu'])) {
19
-        return ;
19
+        return;
20 20
     }
21 21
 
22 22
     if (altsys_get_core_type() < ALTSYS_CORE_TYPE_ORE) {
23
-        altsys_adminmenu_insert_mymenu_x20($module) ;
23
+        altsys_adminmenu_insert_mymenu_x20($module);
24 24
     }
25 25
 }
26 26
 
27 27
 function altsys_adminmenu_insert_mymenu_x20(&$module)
28 28
 {
29 29
     // read
30
-    if (! file_exists(ALTSYS_ADMINMENU_FILE)) {
31
-        redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu') ;
32
-        exit ;
30
+    if (!file_exists(ALTSYS_ADMINMENU_FILE)) {
31
+        redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu');
32
+        exit;
33 33
     }
34
-    $not_inside_cp_functions = true ;
35
-    include ALTSYS_ADMINMENU_FILE ;
34
+    $not_inside_cp_functions = true;
35
+    include ALTSYS_ADMINMENU_FILE;
36 36
 
37
-    $dirname = $module->getVar('dirname') ;
38
-    $mid = $module->getVar('mid') ;
39
-    $anchor = '<!-- ALTSYS ANCHOR '.$dirname.' -->' ;
37
+    $dirname = $module->getVar('dirname');
38
+    $mid = $module->getVar('mid');
39
+    $anchor = '<!-- ALTSYS ANCHOR '.$dirname.' -->';
40 40
 
41 41
     // fetch popup_no
42 42
     if (empty($xoops_admin_menu_ft[$mid])) {
43
-        return ;
43
+        return;
44 44
     }
45
-    if (! preg_match('/popUpL(\d+)/', $xoops_admin_menu_ft[$mid], $regs)) {
46
-        return ;
45
+    if (!preg_match('/popUpL(\d+)/', $xoops_admin_menu_ft[$mid], $regs)) {
46
+        return;
47 47
     }
48 48
     $popup_no = (int)$regs[1];
49 49
 
50 50
     // replace
51
-    $search  = '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/system/admin.php?fct=preferences&amp;op=showmod&amp;mod='.$mid.'\'' ;
52
-    $replace = $anchor.'<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mypreferences\'' ;
51
+    $search  = '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/system/admin.php?fct=preferences&amp;op=showmod&amp;mod='.$mid.'\'';
52
+    $replace = $anchor.'<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mypreferences\'';
53 53
 
54 54
     // do replacement
55
-    $new_xoops_admin_menu_dv = preg_replace('#'.preg_quote($search).'#', $replace, $xoops_admin_menu_dv) ;
55
+    $new_xoops_admin_menu_dv = preg_replace('#'.preg_quote($search).'#', $replace, $xoops_admin_menu_dv);
56 56
 
57 57
     if ($xoops_admin_menu_dv == $new_xoops_admin_menu_dv) {
58
-        return ;
58
+        return;
59 59
     }
60
-    $xoops_admin_menu_dv = $new_xoops_admin_menu_dv ;
60
+    $xoops_admin_menu_dv = $new_xoops_admin_menu_dv;
61 61
 
62
-    $insert = '' ;
62
+    $insert = '';
63 63
 
64 64
     // insert blocksadmin
65 65
     if ($dirname != 'altsys') {
66
-        $blocksadmin_title = defined('_MD_A_MYMENU_MYBLOCKSADMIN') ? _MD_A_MYMENU_MYBLOCKSADMIN : 'blocksadmin' ;
67
-        $insert .= '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&amp;lib=altsys&amp;page=myblocksadmin\'>'.$blocksadmin_title.'</a><br />'."\n" ;
66
+        $blocksadmin_title = defined('_MD_A_MYMENU_MYBLOCKSADMIN') ? _MD_A_MYMENU_MYBLOCKSADMIN : 'blocksadmin';
67
+        $insert .= '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&amp;lib=altsys&amp;page=myblocksadmin\'>'.$blocksadmin_title.'</a><br />'."\n";
68 68
     }
69 69
 
70 70
     // insert tplsadmin
71
-    $db =& XoopsDatabaseFactory::getDatabaseConnection() ;
72
-    list($count) = $db->fetchRow($db->query('SELECT COUNT(*) FROM ' . $db->prefix('tplfile') . " WHERE tpl_module='$dirname'")) ;
71
+    $db = & XoopsDatabaseFactory::getDatabaseConnection();
72
+    list($count) = $db->fetchRow($db->query('SELECT COUNT(*) FROM '.$db->prefix('tplfile')." WHERE tpl_module='$dirname'"));
73 73
     if ($count > 0) {
74
-        $tplsadmin_title = defined('_MD_A_MYMENU_MYTPLSADMIN') ? _MD_A_MYMENU_MYTPLSADMIN : 'tplsadmin' ;
75
-        $insert = '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin\'>'.$tplsadmin_title.'</a><br />'."\n".$insert ;
74
+        $tplsadmin_title = defined('_MD_A_MYMENU_MYTPLSADMIN') ? _MD_A_MYMENU_MYTPLSADMIN : 'tplsadmin';
75
+        $insert = '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin\'>'.$tplsadmin_title.'</a><br />'."\n".$insert;
76 76
     }
77 77
 
78 78
     // do insertion
79
-    $xoops_admin_menu_dv = preg_replace('#'.preg_quote($anchor).'#', $anchor.$insert, $xoops_admin_menu_dv) ;
79
+    $xoops_admin_menu_dv = preg_replace('#'.preg_quote($anchor).'#', $anchor.$insert, $xoops_admin_menu_dv);
80 80
 
81 81
     // write back
82
-    altsys_adminmenu_save_x20(array( 'xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => (int)(@$altsys_adminmenu_ft_hacked), 'altsys_adminmenu_dv_updated' => true )) ;
82
+    altsys_adminmenu_save_x20(array('xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => (int)(@$altsys_adminmenu_ft_hacked), 'altsys_adminmenu_dv_updated' => true));
83 83
 }
84 84
 
85 85
 //
@@ -87,184 +87,184 @@  discard block
 block discarded – undo
87 87
 //
88 88
 function altsys_adminmenu_hack_ft()
89 89
 {
90
-    global $altsysModuleConfig ;
90
+    global $altsysModuleConfig;
91 91
 
92 92
     if (altsys_get_core_type() >= ALTSYS_CORE_TYPE_ORE) {
93
-        return ;
93
+        return;
94 94
     }
95 95
     if (empty($altsysModuleConfig['adminmenu_hack_ft'])) {
96
-        return ;
96
+        return;
97 97
     }
98 98
 
99 99
     if ($altsysModuleConfig['adminmenu_hack_ft'] == ALTSYS_ADMINMENU_HACK_2COL) {
100
-        altsys_adminmenu_hack_ft_2col_x20() ;
100
+        altsys_adminmenu_hack_ft_2col_x20();
101 101
     } elseif ($altsysModuleConfig['adminmenu_hack_ft'] == ALTSYS_ADMINMENU_HACK_NOIMG) {
102
-        altsys_adminmenu_hack_ft_noimg_x20() ;
102
+        altsys_adminmenu_hack_ft_noimg_x20();
103 103
     } elseif ($altsysModuleConfig['adminmenu_hack_ft'] == ALTSYS_ADMINMENU_HACK_XCSTY) {
104
-        altsys_adminmenu_hack_ft_xcsty_x20() ;
104
+        altsys_adminmenu_hack_ft_xcsty_x20();
105 105
     }
106 106
 }
107 107
 
108 108
 function altsys_adminmenu_hack_ft_2col_x20()
109 109
 {
110 110
     // read
111
-    if (! file_exists(ALTSYS_ADMINMENU_FILE)) {
112
-        redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu') ;
113
-        exit ;
111
+    if (!file_exists(ALTSYS_ADMINMENU_FILE)) {
112
+        redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu');
113
+        exit;
114 114
     }
115
-    $not_inside_cp_functions = true ;
116
-    include ALTSYS_ADMINMENU_FILE ;
115
+    $not_inside_cp_functions = true;
116
+    include ALTSYS_ADMINMENU_FILE;
117 117
 
118 118
     // check previous hack
119
-    if (! empty($altsys_adminmenu_ft_hacked)) {
119
+    if (!empty($altsys_adminmenu_ft_hacked)) {
120 120
         if ($altsys_adminmenu_ft_hacked == ALTSYS_ADMINMENU_HACK_2COL) {
121 121
             // skip
122
-            return ;
122
+            return;
123 123
         } else {
124 124
             // rebuild adminmenu
125
-            require_once XOOPS_ROOT_PATH.'/include/cp_functions.php' ;
126
-            xoops_module_write_admin_menu(xoops_module_get_admin_menu()) ;
125
+            require_once XOOPS_ROOT_PATH.'/include/cp_functions.php';
126
+            xoops_module_write_admin_menu(xoops_module_get_admin_menu());
127 127
             // backup $xoops_admin_menu_dv
128
-            $backup_admin_menu_dv = $xoops_admin_menu_dv ;
128
+            $backup_admin_menu_dv = $xoops_admin_menu_dv;
129 129
             // include new adminmenu
130
-            include ALTSYS_ADMINMENU_FILE ;
130
+            include ALTSYS_ADMINMENU_FILE;
131 131
             // restore $xoops_admin_menu_dv
132
-            $xoops_admin_menu_dv = $backup_admin_menu_dv ;
132
+            $xoops_admin_menu_dv = $backup_admin_menu_dv;
133 133
         }
134 134
     }
135 135
 
136
-    $search  = ' alt=\'\' /></a><br />' ;
137
-    $replace_fmt = ' alt="%s" /></a>' ;
136
+    $search  = ' alt=\'\' /></a><br />';
137
+    $replace_fmt = ' alt="%s" /></a>';
138 138
 
139
-    $is_left = true ;
140
-    $module_handler =& xoops_gethandler('module') ;
141
-    $mids = array_keys($xoops_admin_menu_ft) ;
142
-    $last_mid = $mids[count($mids) - 1 ] ;
139
+    $is_left = true;
140
+    $module_handler = & xoops_gethandler('module');
141
+    $mids = array_keys($xoops_admin_menu_ft);
142
+    $last_mid = $mids[count($mids) - 1];
143 143
     foreach ($mids as $mid) {
144
-        $module =& $module_handler->get($mid) ;
145
-        $new_menu_ft = preg_replace('#'.preg_quote($search).'#', sprintf($replace_fmt, $module->getVar('name')), $xoops_admin_menu_ft[$mid]) ;
144
+        $module = & $module_handler->get($mid);
145
+        $new_menu_ft = preg_replace('#'.preg_quote($search).'#', sprintf($replace_fmt, $module->getVar('name')), $xoops_admin_menu_ft[$mid]);
146 146
         if ($is_left) {
147 147
             if ($mid == $last_mid) {
148
-                $xoops_admin_menu_ft[$mid] = $new_menu_ft . '</td><td>' ;
148
+                $xoops_admin_menu_ft[$mid] = $new_menu_ft.'</td><td>';
149 149
             } else {
150
-                $left_body = $new_menu_ft ;
151
-                $left_key = $mid ;
152
-                $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',85);', $xoops_admin_menu_ml[$mid]) ;
150
+                $left_body = $new_menu_ft;
151
+                $left_key = $mid;
152
+                $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',85);', $xoops_admin_menu_ml[$mid]);
153 153
             }
154 154
         } else {
155
-            $xoops_admin_menu_ft[$mid] = $left_body . '</td><td>' . $new_menu_ft ;
156
-            unset($xoops_admin_menu_ft[$left_key]) ;
157
-            $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',185);', $xoops_admin_menu_ml[$mid]) ;
155
+            $xoops_admin_menu_ft[$mid] = $left_body.'</td><td>'.$new_menu_ft;
156
+            unset($xoops_admin_menu_ft[$left_key]);
157
+            $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',185);', $xoops_admin_menu_ml[$mid]);
158 158
         }
159
-        $is_left = ! $is_left ;
159
+        $is_left = !$is_left;
160 160
     }
161 161
 
162 162
     // write back
163
-    altsys_adminmenu_save_x20(array( 'xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_2COL )) ;
163
+    altsys_adminmenu_save_x20(array('xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_2COL));
164 164
 }
165 165
 
166 166
 
167 167
 function altsys_adminmenu_hack_ft_noimg_x20()
168 168
 {
169 169
     // read
170
-    if (! file_exists(ALTSYS_ADMINMENU_FILE)) {
171
-        redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu') ;
172
-        exit ;
170
+    if (!file_exists(ALTSYS_ADMINMENU_FILE)) {
171
+        redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu');
172
+        exit;
173 173
     }
174
-    $not_inside_cp_functions = true ;
175
-    include ALTSYS_ADMINMENU_FILE ;
174
+    $not_inside_cp_functions = true;
175
+    include ALTSYS_ADMINMENU_FILE;
176 176
 
177 177
     // check previous hack
178
-    if (! empty($altsys_adminmenu_ft_hacked)) {
178
+    if (!empty($altsys_adminmenu_ft_hacked)) {
179 179
         if ($altsys_adminmenu_ft_hacked == ALTSYS_ADMINMENU_HACK_NOIMG) {
180 180
             // skip
181
-            return ;
181
+            return;
182 182
         } else {
183 183
             // rebuild adminmenu
184
-            require_once XOOPS_ROOT_PATH.'/include/cp_functions.php' ;
185
-            xoops_module_write_admin_menu(xoops_module_get_admin_menu()) ;
184
+            require_once XOOPS_ROOT_PATH.'/include/cp_functions.php';
185
+            xoops_module_write_admin_menu(xoops_module_get_admin_menu());
186 186
             // backup $xoops_admin_menu_dv
187
-            $backup_admin_menu_dv = $xoops_admin_menu_dv ;
187
+            $backup_admin_menu_dv = $xoops_admin_menu_dv;
188 188
             // include new adminmenu
189
-            include ALTSYS_ADMINMENU_FILE ;
189
+            include ALTSYS_ADMINMENU_FILE;
190 190
             // restore $xoops_admin_menu_dv
191
-            $xoops_admin_menu_dv = $backup_admin_menu_dv ;
191
+            $xoops_admin_menu_dv = $backup_admin_menu_dv;
192 192
         }
193 193
     }
194 194
 
195
-    $module_handler =& xoops_gethandler('module') ;
196
-    $mids = array_keys($xoops_admin_menu_ft) ;
195
+    $module_handler = & xoops_gethandler('module');
196
+    $mids = array_keys($xoops_admin_menu_ft);
197 197
     foreach ($mids as $mid) {
198
-        $module =& $module_handler->get($mid) ;
199
-        $xoops_admin_menu_ft[$mid] = preg_replace('/\<img src\=.*$/', $module->getVar('name').'</a>', $xoops_admin_menu_ft[$mid]) ;
200
-        $xoops_admin_menu_ft[$mid] = '<div style="text-align:'._GLOBAL_LEFT.';background-color:#CCC;" title="'.$module->getVar('dirname').'">'.$xoops_admin_menu_ft[$mid].'</div>' ;
201
-        $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',45);', $xoops_admin_menu_ml[$mid]) ;
198
+        $module = & $module_handler->get($mid);
199
+        $xoops_admin_menu_ft[$mid] = preg_replace('/\<img src\=.*$/', $module->getVar('name').'</a>', $xoops_admin_menu_ft[$mid]);
200
+        $xoops_admin_menu_ft[$mid] = '<div style="text-align:'._GLOBAL_LEFT.';background-color:#CCC;" title="'.$module->getVar('dirname').'">'.$xoops_admin_menu_ft[$mid].'</div>';
201
+        $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',45);', $xoops_admin_menu_ml[$mid]);
202 202
     }
203 203
 
204 204
     // write back
205
-    altsys_adminmenu_save_x20(array( 'xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_NOIMG )) ;
205
+    altsys_adminmenu_save_x20(array('xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_NOIMG));
206 206
 }
207 207
 
208 208
 
209 209
 function altsys_adminmenu_hack_ft_xcsty_x20()
210 210
 {
211 211
     // read
212
-    if (! file_exists(ALTSYS_ADMINMENU_FILE)) {
213
-        redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu') ;
214
-        exit ;
212
+    if (!file_exists(ALTSYS_ADMINMENU_FILE)) {
213
+        redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu');
214
+        exit;
215 215
     }
216
-    $not_inside_cp_functions = true ;
217
-    include ALTSYS_ADMINMENU_FILE ;
216
+    $not_inside_cp_functions = true;
217
+    include ALTSYS_ADMINMENU_FILE;
218 218
 
219 219
     // check previous hack
220
-    if (! empty($altsys_adminmenu_ft_hacked)) {
220
+    if (!empty($altsys_adminmenu_ft_hacked)) {
221 221
         if ($altsys_adminmenu_ft_hacked == ALTSYS_ADMINMENU_HACK_XCSTY && empty($altsys_adminmenu_dv_updated)) {
222 222
             // skip
223
-            return ;
223
+            return;
224 224
         } else {
225 225
             // rebuild adminmenu
226
-            require_once XOOPS_ROOT_PATH.'/include/cp_functions.php' ;
227
-            $fp = fopen(ALTSYS_ADMINMENU_FILE, 'wb') ;
228
-            fwrite($fp, xoops_module_get_admin_menu()) ;
229
-            fclose($fp) ;
226
+            require_once XOOPS_ROOT_PATH.'/include/cp_functions.php';
227
+            $fp = fopen(ALTSYS_ADMINMENU_FILE, 'wb');
228
+            fwrite($fp, xoops_module_get_admin_menu());
229
+            fclose($fp);
230 230
             // backup $xoops_admin_menu_dv
231
-            $backup_admin_menu_dv = $xoops_admin_menu_dv ;
231
+            $backup_admin_menu_dv = $xoops_admin_menu_dv;
232 232
             // include new adminmenu
233
-            include ALTSYS_ADMINMENU_FILE ;
233
+            include ALTSYS_ADMINMENU_FILE;
234 234
             // restore $xoops_admin_menu_dv
235
-            $xoops_admin_menu_dv = $backup_admin_menu_dv ;
235
+            $xoops_admin_menu_dv = $backup_admin_menu_dv;
236 236
         }
237 237
     }
238 238
 
239
-    $module_handler =& xoops_gethandler('module') ;
240
-    $mids = array_keys($xoops_admin_menu_ft) ;
239
+    $module_handler = & xoops_gethandler('module');
240
+    $mids = array_keys($xoops_admin_menu_ft);
241 241
     foreach ($mids as $mid) {
242
-        $module =& $module_handler->get($mid) ;
243
-        $submenuitems = array() ;
242
+        $module = & $module_handler->get($mid);
243
+        $submenuitems = array();
244 244
         if (preg_match('/popUpL\d+/', $xoops_admin_menu_ft[$mid], $regs)) {
245
-            $popup = $regs[0] ;
246
-            preg_match_all('#\<a href.*'.$popup.'\(\).*\</a>#U', $xoops_admin_menu_dv, $regs) ;
245
+            $popup = $regs[0];
246
+            preg_match_all('#\<a href.*'.$popup.'\(\).*\</a>#U', $xoops_admin_menu_dv, $regs);
247 247
             foreach ($regs[0] as $submenuitem) {
248
-                $submenuitems[] = str_replace($popup.'();', '', $submenuitem) ;
248
+                $submenuitems[] = str_replace($popup.'();', '', $submenuitem);
249 249
             }
250 250
         } else {
251
-            return ;
251
+            return;
252 252
         }
253 253
         // module icon
254 254
         if (preg_match('#\<img .*/\>#U', $xoops_admin_menu_ft[$mid], $regs)) {
255
-            $icon_img = str_replace("alt=''", 'alt="'.$module->getVar('name').'"', $regs[0]) ;
255
+            $icon_img = str_replace("alt=''", 'alt="'.$module->getVar('name').'"', $regs[0]);
256 256
         } else {
257
-            $icon_img = '' ;
257
+            $icon_img = '';
258 258
         }
259 259
         // version number
260
-        $icon_img .= '<span class="version" style="">' . sprintf('%.2f', $module->getVar('version') / 100.0) . '</span>' ;
261
-        $newline = preg_replace('/ onmouseover.*$/', '', $xoops_admin_menu_ft[$mid]) ;
262
-        $newline = "\n".'<!-- '.$popup.' --><div id="adminmenu_ft'.$mid.'" style="text-align:'._GLOBAL_LEFT.';background-color:#CCC;" title="'.$module->getVar('dirname').'"><a id="adminmenu_ftpoint'.$mid.'" href="javascript:void(0);" onclick="submenuToggle('.$mid.');">+</a> '.$newline.'>'.$module->getVar('name').'</a></div><div id="adminmenu_ftsub'.$mid.'" style="display:none;"><ul>' ;
260
+        $icon_img .= '<span class="version" style="">'.sprintf('%.2f', $module->getVar('version') / 100.0).'</span>';
261
+        $newline = preg_replace('/ onmouseover.*$/', '', $xoops_admin_menu_ft[$mid]);
262
+        $newline = "\n".'<!-- '.$popup.' --><div id="adminmenu_ft'.$mid.'" style="text-align:'._GLOBAL_LEFT.';background-color:#CCC;" title="'.$module->getVar('dirname').'"><a id="adminmenu_ftpoint'.$mid.'" href="javascript:void(0);" onclick="submenuToggle('.$mid.');">+</a> '.$newline.'>'.$module->getVar('name').'</a></div><div id="adminmenu_ftsub'.$mid.'" style="display:none;"><ul>';
263 263
         foreach ($submenuitems as $submenuitem) {
264
-            $newline .= '<li>'.$submenuitem.'</li>' ;
264
+            $newline .= '<li>'.$submenuitem.'</li>';
265 265
         }
266
-        $newline .= '</ul>'.$icon_img.'</div>' ;
267
-        $xoops_admin_menu_ft[$mid] = $newline ;
266
+        $newline .= '</ul>'.$icon_img.'</div>';
267
+        $xoops_admin_menu_ft[$mid] = $newline;
268 268
     }
269 269
 
270 270
     $xoops_admin_menu_js = "
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	}" ;
281 281
 
282 282
     // write back
283
-    altsys_adminmenu_save_x20(array( 'xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => array(), 'xoops_admin_menu_sd' => array(), 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_XCSTY )) ;
283
+    altsys_adminmenu_save_x20(array('xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => array(), 'xoops_admin_menu_sd' => array(), 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_XCSTY));
284 284
 }
285 285
 
286 286
 
@@ -291,18 +291,18 @@  discard block
 block discarded – undo
291 291
 function altsys_adminmenu_save_x20($xoops_admin_vars)
292 292
 {
293 293
     // variable definitions
294
-    ob_start() ;
295
-    echo "<?php\n// modified by altsys\nif( ! defined('XOOPS_ROOT_PATH') ) exit ;\n" ;
294
+    ob_start();
295
+    echo "<?php\n// modified by altsys\nif( ! defined('XOOPS_ROOT_PATH') ) exit ;\n";
296 296
     foreach ($xoops_admin_vars as $key => $val) {
297
-        echo '$' . $key . " = \n" ;
298
-        @var_export($val) ;
299
-        echo " ;\n" ;
297
+        echo '$'.$key." = \n";
298
+        @var_export($val);
299
+        echo " ;\n";
300 300
     }
301
-    $output = ob_get_contents() ;
302
-    ob_end_clean() ;
301
+    $output = ob_get_contents();
302
+    ob_end_clean();
303 303
 
304 304
     // embedding logics
305
-    if (in_array(@$xoops_admin_vars['altsys_adminmenu_ft_hacked'], array( ALTSYS_ADMINMENU_HACK_NOIMG, ALTSYS_ADMINMENU_HACK_XCSTY ))) {
305
+    if (in_array(@$xoops_admin_vars['altsys_adminmenu_ft_hacked'], array(ALTSYS_ADMINMENU_HACK_NOIMG, ALTSYS_ADMINMENU_HACK_XCSTY))) {
306 306
         $output .= '
307 307
 
308 308
 if( is_object( @$GLOBALS["xoopsModule"] ) && empty( $not_inside_cp_functions ) ) {
@@ -317,13 +317,13 @@  discard block
 block discarded – undo
317 317
     }
318 318
 
319 319
     // termination
320
-    $output .= "\n\n?>" ;
320
+    $output .= "\n\n?>";
321 321
 
322 322
     // replace into XOOPS_URL
323
-    $output = str_replace(XOOPS_URL, "'.XOOPS_URL.'", $output) ;
323
+    $output = str_replace(XOOPS_URL, "'.XOOPS_URL.'", $output);
324 324
 
325 325
     // output
326
-    $fp = fopen(ALTSYS_ADMINMENU_FILE, 'wb') ;
327
-    fwrite($fp, $output) ;
328
-    fclose($fp) ;
326
+    $fp = fopen(ALTSYS_ADMINMENU_FILE, 'wb');
327
+    fwrite($fp, $output);
328
+    fclose($fp);
329 329
 }
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/blocks.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-$mytrustdirname = basename(__DIR__) ;
4
-$mytrustdirpath = __DIR__ ;
3
+$mytrustdirname = basename(__DIR__);
4
+$mytrustdirpath = __DIR__;
5 5
 
6 6
 // language files
7
-$language = empty($GLOBALS['xoopsConfig']['language']) ? 'english' : $GLOBALS['xoopsConfig']['language'] ;
7
+$language = empty($GLOBALS['xoopsConfig']['language']) ? 'english' : $GLOBALS['xoopsConfig']['language'];
8 8
 if (file_exists("$mydirpath/language/$language/blocks.php")) {
9 9
     // user customized language file (already read by class/xoopsblock.php etc)
10 10
     // include_once "$mydirpath/language/$language/blocks.php" ;
11 11
 } elseif (file_exists("$mytrustdirpath/language/$language/blocks_common.php")) {
12 12
     // default language file
13
-    include_once "$mytrustdirpath/language/$language/blocks_common.php" ;
14
-    include "$mytrustdirpath/language/$language/blocks_each.php" ;
13
+    include_once "$mytrustdirpath/language/$language/blocks_common.php";
14
+    include "$mytrustdirpath/language/$language/blocks_each.php";
15 15
 } else {
16 16
     // fallback english
17
-    include_once "$mytrustdirpath/language/english/blocks_common.php" ;
18
-    include "$mytrustdirpath/language/english/blocks_each.php" ;
17
+    include_once "$mytrustdirpath/language/english/blocks_common.php";
18
+    include "$mytrustdirpath/language/english/blocks_each.php";
19 19
 }
20 20
 
21
-require_once "$mytrustdirpath/blocks/block_functions.php" ;
21
+require_once "$mytrustdirpath/blocks/block_functions.php";
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/compilehookadmin.php 1 patch
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -5,16 +5,16 @@  discard block
 block discarded – undo
5 5
 //                       GIJOE <http://www.peak.ne.jp/>                      //
6 6
 // ------------------------------------------------------------------------- //
7 7
 
8
-require_once __DIR__.'/class/AltsysBreadcrumbs.class.php' ;
9
-include_once __DIR__.'/include/gtickets.php' ;
10
-include_once __DIR__.'/include/altsys_functions.php' ;
8
+require_once __DIR__.'/class/AltsysBreadcrumbs.class.php';
9
+include_once __DIR__.'/include/gtickets.php';
10
+include_once __DIR__.'/include/altsys_functions.php';
11 11
 
12 12
 
13 13
 // this page can be called only from altsys
14 14
 // if( $xoopsModule->getVar('dirname') != 'altsys' ) die( 'this page can be called only from altsys' ) ;
15 15
 
16 16
 // language file
17
-altsys_include_language_file('compilehookadmin') ;
17
+altsys_include_language_file('compilehookadmin');
18 18
 
19 19
 //
20 20
 // DEFINITIONS
@@ -23,46 +23,46 @@  discard block
 block discarded – undo
23 23
 $compile_hooks = array(
24 24
 
25 25
     'enclosebycomment' => array(
26
-        'pre' => '<!-- begin altsys_tplsadmin %s -->' ,
27
-        'post' => '<!-- end altsys_tplsadmin %s -->' ,
28
-        'success_msg' => _TPLSADMIN_FMT_MSG_ENCLOSEBYCOMMENT ,
29
-        'dt' => _TPLSADMIN_DT_ENCLOSEBYCOMMENT ,
30
-        'dd' => _TPLSADMIN_DD_ENCLOSEBYCOMMENT ,
31
-        'conf_msg' => _TPLSADMIN_CNF_ENCLOSEBYCOMMENT ,
26
+        'pre' => '<!-- begin altsys_tplsadmin %s -->',
27
+        'post' => '<!-- end altsys_tplsadmin %s -->',
28
+        'success_msg' => _TPLSADMIN_FMT_MSG_ENCLOSEBYCOMMENT,
29
+        'dt' => _TPLSADMIN_DT_ENCLOSEBYCOMMENT,
30
+        'dd' => _TPLSADMIN_DD_ENCLOSEBYCOMMENT,
31
+        'conf_msg' => _TPLSADMIN_CNF_ENCLOSEBYCOMMENT,
32 32
         'skip_theme' => true
33
-    ) ,
33
+    ),
34 34
 
35 35
     'enclosebybordereddiv' => array(
36
-        'pre' => '<div class="altsys_tplsadmin_frame" style="border:1px solid black;word-wrap:break-word;">' ,
37
-        'post' => '<br /><a href="'.XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsform&amp;tpl_file=%1$s" style="color:red;">Edit:<br />%1$s</a></div>' ,
38
-        'success_msg' => _TPLSADMIN_FMT_MSG_ENCLOSEBYBORDEREDDIV ,
39
-        'dt' => _TPLSADMIN_DT_ENCLOSEBYBORDEREDDIV ,
40
-        'dd' => _TPLSADMIN_DD_ENCLOSEBYBORDEREDDIV ,
41
-        'conf_msg' => _TPLSADMIN_CNF_ENCLOSEBYBORDEREDDIV ,
36
+        'pre' => '<div class="altsys_tplsadmin_frame" style="border:1px solid black;word-wrap:break-word;">',
37
+        'post' => '<br /><a href="'.XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsform&amp;tpl_file=%1$s" style="color:red;">Edit:<br />%1$s</a></div>',
38
+        'success_msg' => _TPLSADMIN_FMT_MSG_ENCLOSEBYBORDEREDDIV,
39
+        'dt' => _TPLSADMIN_DT_ENCLOSEBYBORDEREDDIV,
40
+        'dd' => _TPLSADMIN_DD_ENCLOSEBYBORDEREDDIV,
41
+        'conf_msg' => _TPLSADMIN_CNF_ENCLOSEBYBORDEREDDIV,
42 42
         'skip_theme' => true
43
-    ) ,
43
+    ),
44 44
 
45 45
     'hooksavevars' => array(
46
-        'pre' => '<?php include_once "'.XOOPS_TRUST_PATH.'/libs/altsys/include/compilehook.inc.php" ; tplsadmin_save_tplsvars(\'%s\',$this) ; ?>' ,
47
-        'post' => '' ,
48
-        'success_msg' => _TPLSADMIN_FMT_MSG_HOOKSAVEVARS ,
49
-        'dt' => _TPLSADMIN_DT_HOOKSAVEVARS ,
50
-        'dd' => _TPLSADMIN_DD_HOOKSAVEVARS ,
51
-        'conf_msg' => _TPLSADMIN_CNF_HOOKSAVEVARS ,
46
+        'pre' => '<?php include_once "'.XOOPS_TRUST_PATH.'/libs/altsys/include/compilehook.inc.php" ; tplsadmin_save_tplsvars(\'%s\',$this) ; ?>',
47
+        'post' => '',
48
+        'success_msg' => _TPLSADMIN_FMT_MSG_HOOKSAVEVARS,
49
+        'dt' => _TPLSADMIN_DT_HOOKSAVEVARS,
50
+        'dd' => _TPLSADMIN_DD_HOOKSAVEVARS,
51
+        'conf_msg' => _TPLSADMIN_CNF_HOOKSAVEVARS,
52 52
         'skip_theme' => false
53
-    ) ,
53
+    ),
54 54
 
55 55
     'removehooks' => array(
56
-        'pre' => '' ,
57
-        'post' => '' ,
58
-        'success_msg' => _TPLSADMIN_FMT_MSG_REMOVEHOOKS ,
59
-        'dt' => _TPLSADMIN_DT_REMOVEHOOKS ,
60
-        'dd' => _TPLSADMIN_DD_REMOVEHOOKS ,
61
-        'conf_msg' => _TPLSADMIN_CNF_REMOVEHOOKS ,
56
+        'pre' => '',
57
+        'post' => '',
58
+        'success_msg' => _TPLSADMIN_FMT_MSG_REMOVEHOOKS,
59
+        'dt' => _TPLSADMIN_DT_REMOVEHOOKS,
60
+        'dd' => _TPLSADMIN_DD_REMOVEHOOKS,
61
+        'conf_msg' => _TPLSADMIN_CNF_REMOVEHOOKS,
62 62
         'skip_theme' => false
63 63
     )
64 64
 
65
-) ;
65
+);
66 66
 
67 67
 
68 68
 //
@@ -70,115 +70,115 @@  discard block
 block discarded – undo
70 70
 //
71 71
 
72 72
 // clearing files in templates_c/
73
-if (! empty($_POST['clearcache']) || ! empty($_POST['cleartplsvars'])) {
73
+if (!empty($_POST['clearcache']) || !empty($_POST['cleartplsvars'])) {
74 74
     // Ticket Check
75
-    if (! $xoopsGTicket->check()) {
75
+    if (!$xoopsGTicket->check()) {
76 76
         redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors());
77 77
     }
78 78
 
79
-    if ($handler = opendir(XOOPS_COMPILE_PATH . '/')) {
79
+    if ($handler = opendir(XOOPS_COMPILE_PATH.'/')) {
80 80
         while (($file = readdir($handler)) !== false) {
81
-            if (! empty($_POST['clearcache'])) {
81
+            if (!empty($_POST['clearcache'])) {
82 82
                 // judging template cache '*.php'
83 83
                 if (substr($file, -4) !== '.php') {
84
-                    continue ;
84
+                    continue;
85 85
                 }
86 86
             } else {
87 87
                 // judging tplsvars cache 'tplsvars_*'
88 88
                 if (substr($file, 0, 9) !== 'tplsvars_') {
89
-                    continue ;
89
+                    continue;
90 90
                 }
91 91
             }
92 92
 
93
-            $file_path = XOOPS_COMPILE_PATH . '/' . $file ;
94
-            @unlink($file_path) ;
93
+            $file_path = XOOPS_COMPILE_PATH.'/'.$file;
94
+            @unlink($file_path);
95 95
         }
96
-        redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 1, _TPLSADMIN_MSG_CLEARCACHE) ;
97
-        exit ;
96
+        redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 1, _TPLSADMIN_MSG_CLEARCACHE);
97
+        exit;
98 98
     } else {
99
-        die('XOOPS_COMPILE_PATH cannot be opened') ;
99
+        die('XOOPS_COMPILE_PATH cannot be opened');
100 100
     }
101 101
 }
102 102
 
103 103
 // append hooking commands
104 104
 foreach ($compile_hooks as $command => $compile_hook) {
105
-    if (! empty($_POST[$command])) {
105
+    if (!empty($_POST[$command])) {
106 106
         // Ticket Check
107
-        if (! $xoopsGTicket->check()) {
107
+        if (!$xoopsGTicket->check()) {
108 108
             redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors());
109 109
         }
110 110
 
111
-        if ($handler = opendir(XOOPS_COMPILE_PATH . '/')) {
112
-            $file_count = 0 ;
111
+        if ($handler = opendir(XOOPS_COMPILE_PATH.'/')) {
112
+            $file_count = 0;
113 113
             while (($file = readdir($handler)) !== false) {
114 114
 
115 115
                 // skip /. /.. and hidden files
116 116
                 if ($file{0} == '.') {
117
-                    continue ;
117
+                    continue;
118 118
                 }
119 119
 
120 120
                 // skip if the extension is not .html.php
121 121
                 if (substr($file, -9) != '.html.php') {
122
-                    continue ;
122
+                    continue;
123 123
                 }
124 124
 
125 125
                 // skip theme.html when comment-mode or div-mode
126 126
                 if ($compile_hook['skip_theme'] && substr($file, -15) == '%theme.html.php') {
127
-                    $skip_mode = true ;
127
+                    $skip_mode = true;
128 128
                 } else {
129
-                    $skip_mode = false ;
129
+                    $skip_mode = false;
130 130
                 }
131 131
 
132
-                $file_path = XOOPS_COMPILE_PATH . '/' . $file ;
133
-                $file_bodies = file($file_path) ;
132
+                $file_path = XOOPS_COMPILE_PATH.'/'.$file;
133
+                $file_bodies = file($file_path);
134 134
 
135 135
                 // remove lines inserted by compilehookadmin
136 136
                 if (strstr($file_bodies[0], 'altsys')) {
137
-                    array_shift($file_bodies) ;
137
+                    array_shift($file_bodies);
138 138
                 }
139
-                if (strstr($file_bodies[count($file_bodies)-1], 'altsys')) {
140
-                    array_pop($file_bodies) ;
141
-                    $file_bodies[count($file_bodies)-1] = rtrim($file_bodies[count($file_bodies)-1]) ;
139
+                if (strstr($file_bodies[count($file_bodies) - 1], 'altsys')) {
140
+                    array_pop($file_bodies);
141
+                    $file_bodies[count($file_bodies) - 1] = rtrim($file_bodies[count($file_bodies) - 1]);
142 142
                 }
143 143
 
144 144
                 // get the name of the source template from Smarty's comment
145 145
                 if (preg_match('/compiled from (\S+)/', $file_bodies[1], $regs)) {
146
-                    $tpl_name = $regs[1] ;
146
+                    $tpl_name = $regs[1];
147 147
                 } else {
148
-                    $tpl_name = '__FILE__' ;
148
+                    $tpl_name = '__FILE__';
149 149
                 }
150 150
 
151
-                $fw = fopen($file_path, 'w') ;
151
+                $fw = fopen($file_path, 'w');
152 152
 
153 153
                 // insert "pre" command before the compiled cache
154
-                if ($compile_hook['pre'] && ! $skip_mode) {
155
-                    fwrite($fw, sprintf($compile_hook['pre'], htmlspecialchars($tpl_name, ENT_QUOTES)) . "\r\n") ;
154
+                if ($compile_hook['pre'] && !$skip_mode) {
155
+                    fwrite($fw, sprintf($compile_hook['pre'], htmlspecialchars($tpl_name, ENT_QUOTES))."\r\n");
156 156
                 }
157 157
 
158 158
                 // rest of template cache
159 159
                 foreach ($file_bodies as $line) {
160
-                    fwrite($fw, $line) ;
160
+                    fwrite($fw, $line);
161 161
                 }
162 162
 
163 163
                 // insert "post" command after the compiled cache
164
-                if ($compile_hook['post'] && ! $skip_mode) {
165
-                    fwrite($fw, "\r\n" . sprintf($compile_hook['post'], htmlspecialchars($tpl_name, ENT_QUOTES))) ;
164
+                if ($compile_hook['post'] && !$skip_mode) {
165
+                    fwrite($fw, "\r\n".sprintf($compile_hook['post'], htmlspecialchars($tpl_name, ENT_QUOTES)));
166 166
                 }
167 167
 
168
-                fclose($fw) ;
168
+                fclose($fw);
169 169
 
170
-                $file_count ++ ;
170
+                $file_count++;
171 171
             }
172 172
 
173 173
             if ($file_count > 0) {
174
-                redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 3, sprintf($compile_hook['success_msg'], $file_count)) ;
175
-                exit ;
174
+                redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 3, sprintf($compile_hook['success_msg'], $file_count));
175
+                exit;
176 176
             } else {
177
-                redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 3, _TPLSADMIN_MSG_CREATECOMPILECACHEFIRST) ;
178
-                exit ;
177
+                redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 3, _TPLSADMIN_MSG_CREATECOMPILECACHEFIRST);
178
+                exit;
179 179
             }
180 180
         } else {
181
-            die('XOOPS_COMPILE_PATH cannot be opened') ;
181
+            die('XOOPS_COMPILE_PATH cannot be opened');
182 182
         }
183 183
     }
184 184
 }
@@ -190,25 +190,25 @@  discard block
 block discarded – undo
190 190
 //
191 191
 
192 192
 // count template vars & compiled caches
193
-$compiledcache_num = 0 ;
194
-$tplsvars_num = 0 ;
195
-if ($handler = opendir(XOOPS_COMPILE_PATH . '/')) {
193
+$compiledcache_num = 0;
194
+$tplsvars_num = 0;
195
+if ($handler = opendir(XOOPS_COMPILE_PATH.'/')) {
196 196
     while (($file = readdir($handler)) !== false) {
197 197
         if (strncmp($file, 'tplsvars_', 9) === 0) {
198
-            $tplsvars_num ++ ;
198
+            $tplsvars_num++;
199 199
         } elseif (substr($file, -4) === '.php') {
200
-            $compiledcache_num ++ ;
200
+            $compiledcache_num++;
201 201
         }
202 202
     }
203 203
 }
204 204
 
205 205
 // get tplsets
206
-$sql = 'SELECT tplset_name,COUNT(distinct tpl_file) FROM ' . $xoopsDB->prefix('tplset') . ' LEFT JOIN ' . $xoopsDB->prefix('tplfile') . " ON tplset_name=tpl_tplset GROUP BY tpl_tplset ORDER BY tpl_tplset='default' DESC,tpl_tplset" ;
206
+$sql = 'SELECT tplset_name,COUNT(distinct tpl_file) FROM '.$xoopsDB->prefix('tplset').' LEFT JOIN '.$xoopsDB->prefix('tplfile')." ON tplset_name=tpl_tplset GROUP BY tpl_tplset ORDER BY tpl_tplset='default' DESC,tpl_tplset";
207 207
 $srs = $xoopsDB->query($sql);
208
-$tplset_options = "<option value=''>----</option>\n" ;
208
+$tplset_options = "<option value=''>----</option>\n";
209 209
 while (list($tplset, $tpl_count) = $xoopsDB->fetchRow($srs)) {
210
-    $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES) ;
211
-    $tplset_options .= "<option value='$tplset4disp'>$tplset4disp ($tpl_count)</option>\n" ;
210
+    $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES);
211
+    $tplset_options .= "<option value='$tplset4disp'>$tplset4disp ($tpl_count)</option>\n";
212 212
 }
213 213
 
214 214
 
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
 // FORM STAGE
219 219
 //
220 220
 
221
-xoops_cp_header() ;
221
+xoops_cp_header();
222 222
 
223 223
 // mymenu
224
-altsys_include_mymenu() ;
224
+altsys_include_mymenu();
225 225
 
226 226
 // breadcrumbs
227
-$breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ;
228
-$breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=compilehookadmin', _MI_ALTSYS_MENU_COMPILEHOOKADMIN) ;
227
+$breadcrumbsObj = & AltsysBreadcrumbs::getInstance();
228
+$breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=compilehookadmin', _MI_ALTSYS_MENU_COMPILEHOOKADMIN);
229 229
 
230 230
 echo "
231 231
 	<style>
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 				</dd>
251 251
 			</dl>
252 252
 		</p>
253
-	\n" ;
253
+	\n";
254 254
 }
255 255
 
256 256
 echo "
@@ -271,10 +271,10 @@  discard block
 block discarded – undo
271 271
 		<p>
272 272
 			<dl>
273 273
 				<dt>
274
-                    "._TPLSADMIN_DT_GETTPLSVARSINFO_DW . '
274
+                    "._TPLSADMIN_DT_GETTPLSVARSINFO_DW.'
275 275
 				</dt>
276 276
 				<dd>
277
-                    ' . _TPLSADMIN_DD_GETTPLSVARSINFO_DW . "
277
+                    ' . _TPLSADMIN_DD_GETTPLSVARSINFO_DW."
278 278
 					<br />
279 279
 					<input type='submit' name='as_dw_extension_zip' value='zip' />
280 280
 					<input type='submit' name='as_dw_extension_tgz' value='tar.gz' />
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 		<p>
288 288
 			<dl>
289 289
 				<dt>
290
-                    "._TPLSADMIN_DT_GETTEMPLATES . '
290
+                    "._TPLSADMIN_DT_GETTEMPLATES.'
291 291
 				</dt>
292 292
 				<dd>
293
-                    ' . _TPLSADMIN_DD_GETTEMPLATES . "
293
+                    ' . _TPLSADMIN_DD_GETTEMPLATES."
294 294
 					<br />
295 295
 					<select name='tplset'>$tplset_options</select>
296 296
 					<input type='submit' name='download_zip' value='zip' />
@@ -304,10 +304,10 @@  discard block
 block discarded – undo
304 304
 		<p>
305 305
 			<dl>
306 306
 				<dt>
307
-                    "._TPLSADMIN_DT_PUTTEMPLATES . '
307
+                    "._TPLSADMIN_DT_PUTTEMPLATES.'
308 308
 				</dt>
309 309
 				<dd>
310
-                    ' . _TPLSADMIN_DD_PUTTEMPLATES . "
310
+                    ' . _TPLSADMIN_DD_PUTTEMPLATES."
311 311
 					<br />
312 312
 					<select name='tplset'>$tplset_options</select>
313 313
 					<input type='file' name='tplset_archive' size='60' />
@@ -319,4 +319,4 @@  discard block
 block discarded – undo
319 319
 \n" ;
320 320
 
321 321
 
322
-xoops_cp_footer() ;
322
+xoops_cp_footer();
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/get_templates.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -5,37 +5,37 @@  discard block
 block discarded – undo
5 5
 //                       GIJOE <http://www.peak.ne.jp/>                      //
6 6
 // ------------------------------------------------------------------------- //
7 7
 
8
-error_reporting(0) ;
8
+error_reporting(0);
9 9
 
10
-include_once __DIR__.'/include/gtickets.php' ;
11
-include_once __DIR__.'/include/altsys_functions.php' ;
10
+include_once __DIR__.'/include/gtickets.php';
11
+include_once __DIR__.'/include/altsys_functions.php';
12 12
 
13 13
 
14 14
 // this page can be called only from altsys
15 15
 if ($xoopsModule->getVar('dirname') != 'altsys') {
16
-    die('this page can be called only from altsys') ;
16
+    die('this page can be called only from altsys');
17 17
 }
18 18
 
19 19
 
20 20
 // language file
21
-altsys_include_language_file('compilehookadmin') ;
21
+altsys_include_language_file('compilehookadmin');
22 22
 
23
-if (! empty($_POST['download_zip'])) {
24
-    require_once XOOPS_ROOT_PATH.'/class/zipdownloader.php' ;
23
+if (!empty($_POST['download_zip'])) {
24
+    require_once XOOPS_ROOT_PATH.'/class/zipdownloader.php';
25 25
     $downloader = new XoopsZipDownloader();
26
-    $do_download = true ;
27
-} elseif (! empty($_POST['download_tgz'])) {
28
-    require_once XOOPS_ROOT_PATH.'/class/tardownloader.php' ;
26
+    $do_download = true;
27
+} elseif (!empty($_POST['download_tgz'])) {
28
+    require_once XOOPS_ROOT_PATH.'/class/tardownloader.php';
29 29
     $downloader = new XoopsTarDownloader();
30
-    $do_download = true ;
30
+    $do_download = true;
31 31
 }
32 32
 if (empty($do_download)) {
33
-    exit ;
33
+    exit;
34 34
 }
35 35
 
36
-$tplset = @$_POST['tplset'] ;
37
-if (! preg_match('/^[0-9A-Za-z_-]{1,16}$/', $tplset)) {
38
-    die(_TPLSADMIN_ERR_INVALIDTPLSET) ;
36
+$tplset = @$_POST['tplset'];
37
+if (!preg_match('/^[0-9A-Za-z_-]{1,16}$/', $tplset)) {
38
+    die(_TPLSADMIN_ERR_INVALIDTPLSET);
39 39
 }
40 40
 
41 41
 //fix for mb_http_output setting and for add any browsers
@@ -45,17 +45,17 @@  discard block
 block discarded – undo
45 45
 //ob_buffer over flow
46 46
 //HACK by suin & nao-pon 2012/01/06
47 47
     while (ob_get_level() > 0) {
48
-        if (! ob_end_clean()) {
48
+        if (!ob_end_clean()) {
49 49
             break;
50 50
         }
51 51
     }
52
-$trs = $xoopsDB->query('SELECT distinct tpl_file,tpl_source,tpl_lastmodified FROM ' . $xoopsDB->prefix('tplfile') . ' NATURAL LEFT JOIN ' . $xoopsDB->prefix('tplsource') . " WHERE tpl_tplset='" . addslashes($tplset) . "' ORDER BY tpl_file") ;
52
+$trs = $xoopsDB->query('SELECT distinct tpl_file,tpl_source,tpl_lastmodified FROM '.$xoopsDB->prefix('tplfile').' NATURAL LEFT JOIN '.$xoopsDB->prefix('tplsource')." WHERE tpl_tplset='".addslashes($tplset)."' ORDER BY tpl_file");
53 53
 if ($xoopsDB->getRowsNum($trs) <= 0) {
54
-    die(_TPLSADMIN_ERR_INVALIDTPLSET) ;
54
+    die(_TPLSADMIN_ERR_INVALIDTPLSET);
55 55
 }
56 56
 
57 57
 while (list($tpl_file, $tpl_source, $tpl_lastmodified) = $xoopsDB->fetchRow($trs)) {
58
-    $downloader->addFileData($tpl_source, $tplset.'/'.$tpl_file, $tpl_lastmodified) ;
58
+    $downloader->addFileData($tpl_source, $tplset.'/'.$tpl_file, $tpl_lastmodified);
59 59
 }
60 60
 //bugfix by nao-pon ,echo is not necessary for downloader
61
-$downloader->download('template_'.$tplset, true) ;
61
+$downloader->download('template_'.$tplset, true);
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/get_tplsvarsinfo.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -5,26 +5,26 @@  discard block
 block discarded – undo
5 5
 //                        GIJOE <http://www.peak.ne.jp/>                     //
6 6
 // ------------------------------------------------------------------------- //
7 7
 
8
-error_reporting(0) ;
8
+error_reporting(0);
9 9
 
10
-include_once __DIR__.'/include/gtickets.php' ;
11
-include_once __DIR__.'/include/altsys_functions.php' ;
10
+include_once __DIR__.'/include/gtickets.php';
11
+include_once __DIR__.'/include/altsys_functions.php';
12 12
 
13 13
 
14 14
 // this page can be called only from altsys
15 15
 if ($xoopsModule->getVar('dirname') != 'altsys') {
16
-    die('this page can be called only from altsys') ;
16
+    die('this page can be called only from altsys');
17 17
 }
18 18
 
19 19
 
20 20
 // language file
21
-altsys_include_language_file('compilehookadmin') ;
21
+altsys_include_language_file('compilehookadmin');
22 22
 
23 23
 
24
-$dw_snippets_dirname = 'files' ;
25
-$site_name = @$_SERVER['HTTP_HOST'] ;
26
-if (! preg_match('/^[0-9A-Za-z._-]+$/', $site_name)) {
27
-    $site_name = 'xoops_site' ;
24
+$dw_snippets_dirname = 'files';
25
+$site_name = @$_SERVER['HTTP_HOST'];
26
+if (!preg_match('/^[0-9A-Za-z._-]+$/', $site_name)) {
27
+    $site_name = 'xoops_site';
28 28
 }
29 29
 
30 30
 
@@ -38,36 +38,36 @@  discard block
 block discarded – undo
38 38
         case 'array' :
39 39
             foreach ($var_value as $key => $val) {
40 40
                 if (gettype($key) == 'integer') {
41
-                    $GLOBALS[ $sum_array_name ][ $var_name ] = '(array)' ;
42
-                    continue ;
41
+                    $GLOBALS[$sum_array_name][$var_name] = '(array)';
42
+                    continue;
43 43
                 }
44
-                convert_array2info_recursive($var_name.'.'.$key, $val, $sum_array_name) ;
44
+                convert_array2info_recursive($var_name.'.'.$key, $val, $sum_array_name);
45 45
             }
46
-            return ;
46
+            return;
47 47
         case 'string' :
48
-            $GLOBALS[ $sum_array_name ][ $var_name ] = $var_value ;
49
-            return ;
48
+            $GLOBALS[$sum_array_name][$var_name] = $var_value;
49
+            return;
50 50
         case 'boolean' :
51 51
         case 'integer' :
52 52
         case 'float' :
53 53
         case 'double' :
54
-            $GLOBALS[ $sum_array_name ][ $var_name ] = (string)$var_value ;
55
-            return ;
54
+            $GLOBALS[$sum_array_name][$var_name] = (string)$var_value;
55
+            return;
56 56
         case 'null' :
57
-            $GLOBALS[ $sum_array_name ][ $var_name ] = '(null)' ;
58
-            return ;
57
+            $GLOBALS[$sum_array_name][$var_name] = '(null)';
58
+            return;
59 59
         case 'object' :
60
-            $GLOBALS[ $sum_array_name ][ $var_name ] = '(object)' ;
61
-            return ;
60
+            $GLOBALS[$sum_array_name][$var_name] = '(object)';
61
+            return;
62 62
         default :
63
-            return ;
63
+            return;
64 64
     }
65 65
 }
66 66
 
67 67
 
68 68
 function get_mxi_body($mxi_name, $file_entries)
69 69
 {
70
-    global $site_name ;
70
+    global $site_name;
71 71
 
72 72
     return '<macromedia-extension name="XOOPS-'.$site_name.' '.$mxi_name.'" version="1.0" type="Suite" requires-restart="true">
73 73
 	<products>
@@ -108,44 +108,44 @@  discard block
 block discarded – undo
108 108
 // TOTAL STAGE
109 109
 //
110 110
 
111
-$tplsvarsinfo_mod_tpl = array() ;
112
-$tplsvarsinfo_total = array() ;
111
+$tplsvarsinfo_mod_tpl = array();
112
+$tplsvarsinfo_total = array();
113 113
 
114
-if ($handler = opendir(XOOPS_COMPILE_PATH . '/')) {
114
+if ($handler = opendir(XOOPS_COMPILE_PATH.'/')) {
115 115
     while (($file = readdir($handler)) !== false) {
116 116
 
117 117
         // skip files other than tplsvars_* files
118 118
         if (substr($file, 0, 9) !== 'tplsvars_') {
119
-            continue ;
119
+            continue;
120 120
         }
121 121
 
122 122
         // 'tplsvars_'.(randomized 4byte).'_'.(tpl_file)
123
-        $tpl_name = substr($file, 14) ;
124
-        if (! preg_match('/^[%0-9A-Za-z._-]+$/', $tpl_name)) {
125
-            continue ;
123
+        $tpl_name = substr($file, 14);
124
+        if (!preg_match('/^[%0-9A-Za-z._-]+$/', $tpl_name)) {
125
+            continue;
126 126
         }
127
-        $file_path = XOOPS_COMPILE_PATH . '/' . $file ;
128
-        $file_body = implode('', file($file_path)) ;
129
-        $tplsvars = @unserialize($file_body) ;
130
-        if (! is_array($tplsvars)) {
131
-            $tplsvars = array() ;
127
+        $file_path = XOOPS_COMPILE_PATH.'/'.$file;
128
+        $file_body = implode('', file($file_path));
129
+        $tplsvars = @unserialize($file_body);
130
+        if (!is_array($tplsvars)) {
131
+            $tplsvars = array();
132 132
         }
133
-        $GLOBALS['tplsvarsinfo'] = array() ;
134
-        convert_array2info_recursive('', $tplsvars, 'tplsvarsinfo') ;
133
+        $GLOBALS['tplsvarsinfo'] = array();
134
+        convert_array2info_recursive('', $tplsvars, 'tplsvarsinfo');
135 135
         if (strstr($tpl_name, '%')) {
136
-            $mod_name = 'theme_etc' ;
136
+            $mod_name = 'theme_etc';
137 137
         } else {
138
-            list($mod_name) = explode('_', $tpl_name) ;
138
+            list($mod_name) = explode('_', $tpl_name);
139 139
         }
140
-        $tplsvarsinfo_mod_tpl[$mod_name][$tpl_name] = $tplsvarsinfo ;
141
-        $tplsvarsinfo_total = array_merge($tplsvarsinfo_total, $tplsvarsinfo) ;
140
+        $tplsvarsinfo_mod_tpl[$mod_name][$tpl_name] = $tplsvarsinfo;
141
+        $tplsvarsinfo_total = array_merge($tplsvarsinfo_total, $tplsvarsinfo);
142 142
     }
143 143
 } else {
144
-    die('XOOPS_COMPILE_PATH cannot be opened') ;
144
+    die('XOOPS_COMPILE_PATH cannot be opened');
145 145
 }
146 146
 
147 147
 if (empty($tplsvarsinfo_total)) {
148
-    die(_TPLSADMIN_ERR_NOTPLSVARSINFO) ;
148
+    die(_TPLSADMIN_ERR_NOTPLSVARSINFO);
149 149
 }
150 150
 
151 151
 //
@@ -162,17 +162,17 @@  discard block
 block discarded – undo
162 162
 </snippet>' ;
163 163
 
164 164
 
165
-if (! empty($_POST['as_dw_extension_zip'])) {
166
-    require_once XOOPS_ROOT_PATH.'/class/zipdownloader.php' ;
165
+if (!empty($_POST['as_dw_extension_zip'])) {
166
+    require_once XOOPS_ROOT_PATH.'/class/zipdownloader.php';
167 167
     $downloader = new XoopsZipDownloader();
168
-    $do_download = true ;
169
-} elseif (! empty($_POST['as_dw_extension_tgz'])) {
170
-    require_once XOOPS_ROOT_PATH.'/class/tardownloader.php' ;
168
+    $do_download = true;
169
+} elseif (!empty($_POST['as_dw_extension_tgz'])) {
170
+    require_once XOOPS_ROOT_PATH.'/class/tardownloader.php';
171 171
     $downloader = new XoopsTarDownloader();
172
-    $do_download = true ;
172
+    $do_download = true;
173 173
 }
174 174
 
175
-if (! empty($do_download)) {
175
+if (!empty($do_download)) {
176 176
     //fix for mb_http_output setting and for add any browsers
177 177
     if (function_exists('mb_http_output')) {
178 178
         mb_http_output('pass');
@@ -180,33 +180,33 @@  discard block
 block discarded – undo
180 180
     //ob_buffer over flow
181 181
 //HACK by suin & nao-pon 2012/01/06
182 182
     while (ob_get_level() > 0) {
183
-        if (! ob_end_clean()) {
183
+        if (!ob_end_clean()) {
184 184
             break;
185 185
         }
186 186
     }
187 187
     // make files for each tplsvars
188 188
     foreach ($tplsvarsinfo_total as $key => $val) {
189
-        $name = substr($key, 1) ;
190
-        $description = htmlspecialchars(xoops_utf8_encode(xoops_substr($val, 0, 256)), ENT_QUOTES) ;
191
-        $snippet_body = sprintf($snippet_format, $name, $description) ;
189
+        $name = substr($key, 1);
190
+        $description = htmlspecialchars(xoops_utf8_encode(xoops_substr($val, 0, 256)), ENT_QUOTES);
191
+        $snippet_body = sprintf($snippet_format, $name, $description);
192 192
 
193
-        $file_name = strtr($key, '.', '_') . '.csn' ;
194
-        $downloader->addFileData($snippet_body, $dw_snippets_dirname.'/'.$file_name) ;
193
+        $file_name = strtr($key, '.', '_').'.csn';
194
+        $downloader->addFileData($snippet_body, $dw_snippets_dirname.'/'.$file_name);
195 195
     }
196 196
 
197 197
     // make a mxi file per module
198 198
     foreach ($tplsvarsinfo_mod_tpl as $mod_name => $tplsvarsinfo_tpl) {
199
-        $file_entries = '' ;
199
+        $file_entries = '';
200 200
         foreach ($tplsvarsinfo_tpl as $tpl_name => $tplsvarsinfo) {
201 201
             foreach ($tplsvarsinfo as $key => $val) {
202
-                $name = substr($key, 1) ;
203
-                $file_name = strtr($key, '.', '_') . '.csn' ;
204
-                $file_entries .= "\t\t".'<file name="'.$dw_snippets_dirname.'/'.$file_name.'" destination="$Dreamweaver/Configuration/Snippets/XOOPS-'.$site_name.'/'.$tpl_name.'" />'."\n" ;
202
+                $name = substr($key, 1);
203
+                $file_name = strtr($key, '.', '_').'.csn';
204
+                $file_entries .= "\t\t".'<file name="'.$dw_snippets_dirname.'/'.$file_name.'" destination="$Dreamweaver/Configuration/Snippets/XOOPS-'.$site_name.'/'.$tpl_name.'" />'."\n";
205 205
             }
206 206
         }
207
-        $mxi_body = get_mxi_body($mod_name, $file_entries) ;
208
-        $downloader->addFileData($mxi_body, $mod_name.'.mxi') ;
207
+        $mxi_body = get_mxi_body($mod_name, $file_entries);
208
+        $downloader->addFileData($mxi_body, $mod_name.'.mxi');
209 209
     }
210 210
 //bugfix by nao-pon ,echo is not necessary for downloader
211
-    $downloader->download('tplsvarsinfo', true) ;
211
+    $downloader->download('tplsvarsinfo', true);
212 212
 }
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/language/persian/mytplsadmin.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -14,25 +14,25 @@
 block discarded – undo
14 14
 define('_MYTPLSADMIN_CUSTOMTEMPLATE', 'الگوی شخصی');
15 15
 define('_MYTPLSADMIN_CREATENEWCUSTOMTEMPLATE', 'یک الگوی شخصی بسازید');
16 16
 
17
-define('_MYTPLSADMIN_CREATE_NEW_TPLSET', 'ساخت مجموعه‌ی جدید') ;
18
-define('_MYTPLSADMIN_CAPTION_BASE', 'پایگاه') ;
19
-define('_MYTPLSADMIN_CAPTION_SETNAME', 'نام') ;
20
-define('_MYTPLSADMIN_OPT_BLANKSET', '(فاصله)') ;
21
-define('_MYTPLSADMIN_CAPTION_COPYTO', 'بسوی') ;
22
-define('_MYTPLSADMIN_BTN_COPY', 'کپی') ;
23
-define('_MYTPLSADMIN_TITLE_CHECKALL', 'خاموش /روشن کردن تمام چک باکس‌ها در این خط') ;
24
-define('_MYTPLSADMIN_CNF_DELETE_SELECTED_TEMPLATES', 'تمام الگو‌های انتخاب شده در این دسته پاک خواهند شد. آیا شما موافقید؟') ;
25
-define('_MYTPLSADMIN_CNF_COPY_SELECTED_TEMPLATES', 'تمام الگو‌های انتخاب شده در این دسته در  در دسته ی انتخاب شده کپی/بازچسبانی میشوند. آیا شما موافقید؟') ;
26
-define('_MYTPLSADMIN_TH_NAME', 'نام الگو') ;
27
-define('_MYTPLSADMIN_TH_TYPE', 'نوع') ;
28
-define('_MYTPLSADMIN_TH_FILE', 'پرونده‌ی پایگاه') ;
29
-define('_MYTPLSADMIN_ERR_NOTPLFILE', 'هیچ الگوی چک نشده') ;
30
-define('_MYTPLSADMIN_ERR_INVALIDTPLSET', 'جایگاه مقصد باید دقیقا مانند جایگاه پرونده درون بسته باشد در غیر این صورت هیچ الگویی مجاز شناخته نخواهد شد') ;
31
-define('_MYTPLSADMIN_ERR_CANTREMOVEDEFAULT', 'شما میتوانید الگو پیش فرض را پاک کنید.') ;
32
-define('_MYTPLSADMIN_ERR_DUPLICATEDSETNAME', 'نام مجموعه قبلا وجود داشته.') ;
33
-define('_MYTPLSADMIN_ERR_INVALIDSETNAME', 'خطا: نام مجموعه پیشتر تعیین شده است.') ;
17
+define('_MYTPLSADMIN_CREATE_NEW_TPLSET', 'ساخت مجموعه‌ی جدید');
18
+define('_MYTPLSADMIN_CAPTION_BASE', 'پایگاه');
19
+define('_MYTPLSADMIN_CAPTION_SETNAME', 'نام');
20
+define('_MYTPLSADMIN_OPT_BLANKSET', '(فاصله)');
21
+define('_MYTPLSADMIN_CAPTION_COPYTO', 'بسوی');
22
+define('_MYTPLSADMIN_BTN_COPY', 'کپی');
23
+define('_MYTPLSADMIN_TITLE_CHECKALL', 'خاموش /روشن کردن تمام چک باکس‌ها در این خط');
24
+define('_MYTPLSADMIN_CNF_DELETE_SELECTED_TEMPLATES', 'تمام الگو‌های انتخاب شده در این دسته پاک خواهند شد. آیا شما موافقید؟');
25
+define('_MYTPLSADMIN_CNF_COPY_SELECTED_TEMPLATES', 'تمام الگو‌های انتخاب شده در این دسته در  در دسته ی انتخاب شده کپی/بازچسبانی میشوند. آیا شما موافقید؟');
26
+define('_MYTPLSADMIN_TH_NAME', 'نام الگو');
27
+define('_MYTPLSADMIN_TH_TYPE', 'نوع');
28
+define('_MYTPLSADMIN_TH_FILE', 'پرونده‌ی پایگاه');
29
+define('_MYTPLSADMIN_ERR_NOTPLFILE', 'هیچ الگوی چک نشده');
30
+define('_MYTPLSADMIN_ERR_INVALIDTPLSET', 'جایگاه مقصد باید دقیقا مانند جایگاه پرونده درون بسته باشد در غیر این صورت هیچ الگویی مجاز شناخته نخواهد شد');
31
+define('_MYTPLSADMIN_ERR_CANTREMOVEDEFAULT', 'شما میتوانید الگو پیش فرض را پاک کنید.');
32
+define('_MYTPLSADMIN_ERR_DUPLICATEDSETNAME', 'نام مجموعه قبلا وجود داشته.');
33
+define('_MYTPLSADMIN_ERR_INVALIDSETNAME', 'خطا: نام مجموعه پیشتر تعیین شده است.');
34 34
 
35
-define('_MYTPLSADMIN_H3_MODULE', 'ماژول') ;
36
-define('_MYTPLSADMIN_BTN_NEWTPLSET', 'ساختن') ;
35
+define('_MYTPLSADMIN_H3_MODULE', 'ماژول');
36
+define('_MYTPLSADMIN_BTN_NEWTPLSET', 'ساختن');
37 37
 
38
-define('_MYTPLSADMIN_DBUPDATED', 'الگو‌ها با موفقیت به روز شدند') ;
38
+define('_MYTPLSADMIN_DBUPDATED', 'الگو‌ها با موفقیت به روز شدند');
Please login to merge, or discard this patch.