@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | public function _blockHeader($xbeg, $xlen, $ybeg, $ylen) |
| 25 | 25 | { |
| 26 | 26 | if ($xlen != 1) { |
| 27 | - $xbeg .= ',' . $xlen; |
|
| 27 | + $xbeg .= ','.$xlen; |
|
| 28 | 28 | } |
| 29 | 29 | if ($ylen != 1) { |
| 30 | - $ybeg .= ',' . $ylen; |
|
| 30 | + $ybeg .= ','.$ylen; |
|
| 31 | 31 | } |
| 32 | 32 | return "@@ -$xbeg +$ybeg @@"; |
| 33 | 33 | } |
@@ -44,6 +44,6 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | public function _changed($orig, $final) |
| 46 | 46 | { |
| 47 | - return $this->_deleted($orig) . $this->_added($final); |
|
| 47 | + return $this->_deleted($orig).$this->_added($final); |
|
| 48 | 48 | } |
| 49 | 49 | } |
@@ -65,17 +65,17 @@ |
||
| 65 | 65 | * @param bool $include_anon Include group "anonymous"? |
| 66 | 66 | * @param mixed $value Pre-selected value (or array of them). |
| 67 | 67 | */ |
| 68 | - public function AltsysFormCheckboxGroup($caption, $name, $include_anon=false, $value=null) |
|
| 68 | + public function AltsysFormCheckboxGroup($caption, $name, $include_anon = false, $value = null) |
|
| 69 | 69 | { |
| 70 | 70 | $this->XoopsFormCheckbox($caption, $name, $value); |
| 71 | - $member_handler =& xoops_gethandler('member'); |
|
| 71 | + $member_handler = & xoops_gethandler('member'); |
|
| 72 | 72 | if (!$include_anon) { |
| 73 | 73 | $options = $member_handler->getGroupList(new Criteria('groupid', XOOPS_GROUP_ANONYMOUS, '!=')); |
| 74 | 74 | } else { |
| 75 | 75 | $options = $member_handler->getGroupList(); |
| 76 | 76 | } |
| 77 | 77 | foreach ($options as $k => $v) { |
| 78 | - $options[$k] = $v . '<br />'; |
|
| 78 | + $options[$k] = $v.'<br />'; |
|
| 79 | 79 | } |
| 80 | 80 | $this->addOptionArray($options); |
| 81 | 81 | } |
@@ -1,21 +1,21 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once XOOPS_ROOT_PATH.'/modules/legacyRender/kernel/Legacy_AdminRenderSystem.class.php' ; |
|
| 4 | -require_once XOOPS_TRUST_PATH.'/libs/altsys/include/altsys_functions.php' ; |
|
| 5 | -require_once XOOPS_TRUST_PATH.'/libs/altsys/include/admin_in_theme_functions.php' ; |
|
| 3 | +require_once XOOPS_ROOT_PATH.'/modules/legacyRender/kernel/Legacy_AdminRenderSystem.class.php'; |
|
| 4 | +require_once XOOPS_TRUST_PATH.'/libs/altsys/include/altsys_functions.php'; |
|
| 5 | +require_once XOOPS_TRUST_PATH.'/libs/altsys/include/admin_in_theme_functions.php'; |
|
| 6 | 6 | |
| 7 | 7 | class Legacy_AltsysAdminRenderSystem extends Legacy_AdminRenderSystem |
| 8 | 8 | { |
| 9 | 9 | public function renderTheme(&$target) |
| 10 | 10 | { |
| 11 | - global $altsysModuleConfig ; |
|
| 11 | + global $altsysModuleConfig; |
|
| 12 | 12 | |
| 13 | 13 | if (empty($altsysModuleConfig['admin_in_theme'])) { |
| 14 | - parent::renderTheme($target) ; |
|
| 14 | + parent::renderTheme($target); |
|
| 15 | 15 | } else { |
| 16 | - $attributes = $target->getAttributes() ; |
|
| 17 | - altsys_admin_in_theme_in_last($attributes['xoops_contents']) ; |
|
| 18 | - exit ; |
|
| 16 | + $attributes = $target->getAttributes(); |
|
| 17 | + altsys_admin_in_theme_in_last($attributes['xoops_contents']); |
|
| 18 | + exit; |
|
| 19 | 19 | } |
| 20 | 20 | } |
| 21 | 21 | } |
@@ -1,21 +1,21 @@ |
||
| 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 the theme |
| 8 | -$tplsadmin_autoupdate_path = XOOPS_THEME_PATH . '/' . $xoopsConfig['theme_set'] . '/templates' ; |
|
| 8 | +$tplsadmin_autoupdate_path = XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/templates'; |
|
| 9 | 9 | |
| 10 | -if ($handler = @opendir($tplsadmin_autoupdate_path . '/')) { |
|
| 10 | +if ($handler = @opendir($tplsadmin_autoupdate_path.'/')) { |
|
| 11 | 11 | while (($file = readdir($handler)) !== false) { |
| 12 | - $file_path = $tplsadmin_autoupdate_path . '/' . $file ; |
|
| 12 | + $file_path = $tplsadmin_autoupdate_path.'/'.$file; |
|
| 13 | 13 | if (is_file($file_path) && substr($file, -5) == '.html') { |
| 14 | - $mtime = intval(@filemtime($file_path)) ; |
|
| 15 | - list($count) = $xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("tplfile")." WHERE tpl_tplset='".addslashes($xoopsConfig['template_set'])."' AND tpl_file='".addslashes($file)."' AND tpl_lastmodified >= $mtime")) ; |
|
| 14 | + $mtime = intval(@filemtime($file_path)); |
|
| 15 | + list($count) = $xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("tplfile")." WHERE tpl_tplset='".addslashes($xoopsConfig['template_set'])."' AND tpl_file='".addslashes($file)."' AND tpl_lastmodified >= $mtime")); |
|
| 16 | 16 | if ($count <= 0) { |
| 17 | - include_once XOOPS_TRUST_PATH.'/libs/altsys/include/tpls_functions.php' ; |
|
| 18 | - tplsadmin_import_data($xoopsConfig['template_set'], $file, implode('', file($file_path)), $mtime) ; |
|
| 17 | + include_once XOOPS_TRUST_PATH.'/libs/altsys/include/tpls_functions.php'; |
|
| 18 | + tplsadmin_import_data($xoopsConfig['template_set'], $file, implode('', file($file_path)), $mtime); |
|
| 19 | 19 | } |
| 20 | 20 | } |
| 21 | 21 | } |
@@ -72,14 +72,14 @@ discard block |
||
| 72 | 72 | if ($this->_split_level == 'words') { |
| 73 | 73 | return implode('', $lines); |
| 74 | 74 | } else { |
| 75 | - return implode("\n", $lines) . "\n"; |
|
| 75 | + return implode("\n", $lines)."\n"; |
|
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | public function _added($lines) |
| 80 | 80 | { |
| 81 | 81 | array_walk($lines, array(&$this, '_encode')); |
| 82 | - $lines[0] = $this->_ins_prefix . $lines[0]; |
|
| 82 | + $lines[0] = $this->_ins_prefix.$lines[0]; |
|
| 83 | 83 | $lines[count($lines) - 1] .= $this->_ins_suffix; |
| 84 | 84 | return $this->_lines($lines, ' ', false); |
| 85 | 85 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | public function _deleted($lines, $words = false) |
| 88 | 88 | { |
| 89 | 89 | array_walk($lines, array(&$this, '_encode')); |
| 90 | - $lines[0] = $this->_del_prefix . $lines[0]; |
|
| 90 | + $lines[0] = $this->_del_prefix.$lines[0]; |
|
| 91 | 91 | $lines[count($lines) - 1] .= $this->_del_suffix; |
| 92 | 92 | return $this->_lines($lines, ' ', false); |
| 93 | 93 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | $orig[0] = substr($orig[0], 1); |
| 106 | 106 | $final[0] = substr($final[0], 1); |
| 107 | 107 | } |
| 108 | - return $prefix . $this->_deleted($orig) . $this->_added($final); |
|
| 108 | + return $prefix.$this->_deleted($orig).$this->_added($final); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | $text1 = implode("\n", $orig); |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | array('split_level' => 'words'))); |
| 126 | 126 | |
| 127 | 127 | /* Run the diff and get the output. */ |
| 128 | - return str_replace($nl, "\n", $renderer->render($diff)) . "\n"; |
|
| 128 | + return str_replace($nl, "\n", $renderer->render($diff))."\n"; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | public function _splitOnWords($string, $newlineEscape = "\n") |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | public function __construct($params = array()) |
| 37 | 37 | { |
| 38 | 38 | foreach ($params as $param => $value) { |
| 39 | - $v = '_' . $param; |
|
| 39 | + $v = '_'.$param; |
|
| 40 | 40 | if (isset($this->$v)) { |
| 41 | 41 | $this->$v = $value; |
| 42 | 42 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $block); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - return $output . $this->_endDiff(); |
|
| 125 | + return $output.$this->_endDiff(); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | public function _block($xbeg, $xlen, $ybeg, $ylen, &$edits) |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - return $output . $this->_endBlock(); |
|
| 152 | + return $output.$this->_endBlock(); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | public function _startDiff() |
@@ -165,18 +165,18 @@ discard block |
||
| 165 | 165 | public function _blockHeader($xbeg, $xlen, $ybeg, $ylen) |
| 166 | 166 | { |
| 167 | 167 | if ($xlen > 1) { |
| 168 | - $xbeg .= ',' . ($xbeg + $xlen - 1); |
|
| 168 | + $xbeg .= ','.($xbeg + $xlen - 1); |
|
| 169 | 169 | } |
| 170 | 170 | if ($ylen > 1) { |
| 171 | - $ybeg .= ',' . ($ybeg + $ylen - 1); |
|
| 171 | + $ybeg .= ','.($ybeg + $ylen - 1); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - return $xbeg . ($xlen ? ($ylen ? 'c' : 'd') : 'a') . $ybeg; |
|
| 174 | + return $xbeg.($xlen ? ($ylen ? 'c' : 'd') : 'a').$ybeg; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | public function _startBlock($header) |
| 178 | 178 | { |
| 179 | - return $header . "\n"; |
|
| 179 | + return $header."\n"; |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | public function _endBlock() |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | public function _lines($lines, $prefix = ' ') |
| 188 | 188 | { |
| 189 | - return $prefix . implode("\n$prefix", $lines) . "\n"; |
|
| 189 | + return $prefix.implode("\n$prefix", $lines)."\n"; |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | public function _context($lines) |
@@ -206,6 +206,6 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | public function _changed($orig, $final) |
| 208 | 208 | { |
| 209 | - return $this->_deleted($orig) . "---\n" . $this->_added($final); |
|
| 209 | + return $this->_deleted($orig)."---\n".$this->_added($final); |
|
| 210 | 210 | } |
| 211 | 211 | } |
@@ -2,94 +2,94 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | function altsys_admin_in_theme($s) |
| 4 | 4 | { |
| 5 | - global $xoops_admin_contents ; |
|
| 5 | + global $xoops_admin_contents; |
|
| 6 | 6 | |
| 7 | - $xoops_admin_contents = '' ; |
|
| 7 | + $xoops_admin_contents = ''; |
|
| 8 | 8 | |
| 9 | 9 | if (defined('ALTSYS_DONT_USE_ADMIN_IN_THEME')) { |
| 10 | - return $s ; |
|
| 10 | + return $s; |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | // check whether cp_functions.php is loaded |
| 14 | - if (! defined('XOOPS_CPFUNC_LOADED')) { |
|
| 15 | - define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1) ; |
|
| 16 | - return $s ; |
|
| 14 | + if (!defined('XOOPS_CPFUNC_LOADED')) { |
|
| 15 | + define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1); |
|
| 16 | + return $s; |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | // redirect |
| 20 | 20 | if (strstr($s, '<meta http-equiv="Refresh" ')) { |
| 21 | - define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1) ; |
|
| 22 | - return $s ; |
|
| 21 | + define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1); |
|
| 22 | + return $s; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | // outputs before cp_header() |
| 26 | - @list($former_outputs, $tmp_s) = explode("<!DOCTYPE", $s, 2) ; |
|
| 26 | + @list($former_outputs, $tmp_s) = explode("<!DOCTYPE", $s, 2); |
|
| 27 | 27 | if (empty($tmp_s)) { |
| 28 | - $tmp_s = $s ; |
|
| 28 | + $tmp_s = $s; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - @list(, $tmp_s) = explode("<div class='content'>", $tmp_s, 2) ; |
|
| 31 | + @list(, $tmp_s) = explode("<div class='content'>", $tmp_s, 2); |
|
| 32 | 32 | if (empty($tmp_s)) { |
| 33 | - define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1) ; |
|
| 34 | - return $s ; |
|
| 33 | + define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1); |
|
| 34 | + return $s; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - list($tmp_s, $tmp_after) = explode("<td width='1%' background='".XOOPS_URL."/modules/system/images/bg_content.gif'>", $tmp_s) ; |
|
| 37 | + list($tmp_s, $tmp_after) = explode("<td width='1%' background='".XOOPS_URL."/modules/system/images/bg_content.gif'>", $tmp_s); |
|
| 38 | 38 | if (empty($tmp_after)) { |
| 39 | - define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1) ; |
|
| 40 | - return $s ; |
|
| 39 | + define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1); |
|
| 40 | + return $s; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - $xoops_admin_contents = $former_outputs . substr(strrev(strstr(strrev($tmp_s), strrev('</div>'))), 0, -6) ; |
|
| 43 | + $xoops_admin_contents = $former_outputs.substr(strrev(strstr(strrev($tmp_s), strrev('</div>'))), 0, -6); |
|
| 44 | 44 | |
| 45 | - return '' ; |
|
| 45 | + return ''; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | function altsys_admin_in_theme_in_last($contents = null) |
| 50 | 50 | { |
| 51 | - global $xoops_admin_contents , $xoopsConfig , $xoopsModule , $xoopsUser , $xoopsUserIsAdmin , $xoopsLogger , $altsysModuleConfig , $altsysModuleId ; |
|
| 51 | + global $xoops_admin_contents, $xoopsConfig, $xoopsModule, $xoopsUser, $xoopsUserIsAdmin, $xoopsLogger, $altsysModuleConfig, $altsysModuleId; |
|
| 52 | 52 | |
| 53 | - if (! isset($contents)) { |
|
| 53 | + if (!isset($contents)) { |
|
| 54 | 54 | while (ob_get_level()) { |
| 55 | - ob_end_flush() ; |
|
| 55 | + ob_end_flush(); |
|
| 56 | 56 | } |
| 57 | 57 | } else { |
| 58 | - $xoops_admin_contents = $contents ; |
|
| 58 | + $xoops_admin_contents = $contents; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - if (! isset($xoops_admin_contents)) { |
|
| 62 | - return ; |
|
| 61 | + if (!isset($xoops_admin_contents)) { |
|
| 62 | + return; |
|
| 63 | 63 | } |
| 64 | 64 | if (defined('ALTSYS_DONT_USE_ADMIN_IN_THEME')) { |
| 65 | - return ; |
|
| 65 | + return; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - if (! is_object($xoopsUser)) { |
|
| 69 | - exit ; |
|
| 68 | + if (!is_object($xoopsUser)) { |
|
| 69 | + exit; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // language files |
| 73 | 73 | if (file_exists(dirname(dirname(__FILE__)).'/language/'.$xoopsConfig['language'].'/admin_in_theme.php')) { |
| 74 | - include_once dirname(dirname(__FILE__)).'/language/'.$xoopsConfig['language'].'/admin_in_theme.php' ; |
|
| 74 | + include_once dirname(dirname(__FILE__)).'/language/'.$xoopsConfig['language'].'/admin_in_theme.php'; |
|
| 75 | 75 | } else { |
| 76 | - include_once dirname(dirname(__FILE__)).'/language/english/admin_in_theme.php' ; |
|
| 76 | + include_once dirname(dirname(__FILE__)).'/language/english/admin_in_theme.php'; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | // set the theme |
| 80 | - $xoopsConfig['theme_set'] = $altsysModuleConfig['admin_in_theme'] ; |
|
| 80 | + $xoopsConfig['theme_set'] = $altsysModuleConfig['admin_in_theme']; |
|
| 81 | 81 | |
| 82 | 82 | // language files under the theme |
| 83 | - $original_error_level = error_reporting() ; |
|
| 84 | - error_reporting($original_error_level & ~ E_NOTICE) ; |
|
| 83 | + $original_error_level = error_reporting(); |
|
| 84 | + error_reporting($original_error_level & ~ E_NOTICE); |
|
| 85 | 85 | if (file_exists(XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/'.$xoopsConfig['language'].'.php')) { |
| 86 | - include_once XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/'.$xoopsConfig['language'].'.php' ; |
|
| 86 | + include_once XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/'.$xoopsConfig['language'].'.php'; |
|
| 87 | 87 | } elseif (file_exists(XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/english.php')) { |
| 88 | - include_once XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/english.php' ; |
|
| 88 | + include_once XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/english.php'; |
|
| 89 | 89 | } |
| 90 | - error_reporting($original_error_level) ; |
|
| 90 | + error_reporting($original_error_level); |
|
| 91 | 91 | |
| 92 | - include dirname(__FILE__).'/admin_in_theme_header.inc.php' ; |
|
| 92 | + include dirname(__FILE__).'/admin_in_theme_header.inc.php'; |
|
| 93 | 93 | |
| 94 | 94 | /* // include adminmenu |
| 95 | 95 | include XOOPS_CACHE_PATH.'/adminmenu.php' ; |
@@ -125,11 +125,11 @@ discard block |
||
| 125 | 125 | function shutdown() {'.implode("\n",$xoops_admin_menu_sd).'}' ; */ |
| 126 | 126 | |
| 127 | 127 | // appendix (core specific css etc) |
| 128 | - $xoops_module_header = '' ; |
|
| 128 | + $xoops_module_header = ''; |
|
| 129 | 129 | if (altsys_get_core_type() == ALTSYS_CORE_TYPE_XCL21) { |
| 130 | - $xoops_module_header .= '<link rel="stylesheet" type="text/css" media="all" href="'.XOOPS_URL.'/modules/legacyRender/admin/css.php?file=style.css" />'."\n" ; |
|
| 130 | + $xoops_module_header .= '<link rel="stylesheet" type="text/css" media="all" href="'.XOOPS_URL.'/modules/legacyRender/admin/css.php?file=style.css" />'."\n"; |
|
| 131 | 131 | if (is_object(@$xoopsModule)) { |
| 132 | - $xoops_module_header .= '<link rel="stylesheet" type="text/css" media="all" href="'.XOOPS_URL.'/modules/legacyRender/admin/css.php?file=module.css&dirname='.$xoopsModule->getVar('dirname').'" />'."\n" ; |
|
| 132 | + $xoops_module_header .= '<link rel="stylesheet" type="text/css" media="all" href="'.XOOPS_URL.'/modules/legacyRender/admin/css.php?file=module.css&dirname='.$xoopsModule->getVar('dirname').'" />'."\n"; |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
@@ -148,14 +148,14 @@ discard block |
||
| 148 | 148 | 'xoops_slogan' => htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES), |
| 149 | 149 | 'xoops_contents' => $xoops_admin_contents, //. '<div id="adminmenu_layers">' . $xoops_admin_menu_dv . '</div>' , |
| 150 | 150 | 'xoops_module_header' => $xoops_module_header, |
| 151 | - )) ; |
|
| 151 | + )); |
|
| 152 | 152 | |
| 153 | 153 | // rendering |
| 154 | - $xoopsTpl->display($xoopsConfig['theme_set'].'/theme.html') ; |
|
| 154 | + $xoopsTpl->display($xoopsConfig['theme_set'].'/theme.html'); |
|
| 155 | 155 | |
| 156 | 156 | // for XOOPS 2.0.14/15/16 from xoops.org |
| 157 | - if (is_object(@$xoopsLogger) && method_exists($xoopsLogger, 'render') && in_array($xoopsConfig['debug_mode'], array( 1, 2 ))) { |
|
| 158 | - $xoopsLogger->activated = true ; |
|
| 159 | - echo $xoopsLogger->render('') ; |
|
| 157 | + if (is_object(@$xoopsLogger) && method_exists($xoopsLogger, 'render') && in_array($xoopsConfig['debug_mode'], array(1, 2))) { |
|
| 158 | + $xoopsLogger->activated = true; |
|
| 159 | + echo $xoopsLogger->render(''); |
|
| 160 | 160 | } |
| 161 | 161 | } |
@@ -106,24 +106,24 @@ discard block |
||
| 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 | /** |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | * @return mixed An array of file description on success, |
| 182 | 182 | * an error code on error |
| 183 | 183 | */ |
| 184 | - public function create($p_filelist, $p_params=0) |
|
| 184 | + public function create($p_filelist, $p_params = 0) |
|
| 185 | 185 | { |
| 186 | 186 | $this->_errorReset(); |
| 187 | 187 | |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | * @return mixed An array of file description on success, |
| 253 | 253 | * 0 on an unrecoverable failure, an error code is logged. |
| 254 | 254 | */ |
| 255 | - public function add($p_filelist, $p_params=0) |
|
| 255 | + public function add($p_filelist, $p_params = 0) |
|
| 256 | 256 | { |
| 257 | 257 | $this->_errorReset(); |
| 258 | 258 | |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | * @return mixed An array of file description on success, |
| 404 | 404 | * 0 on an unrecoverable failure, an error code is logged. |
| 405 | 405 | */ |
| 406 | - public function extract($p_params=0) |
|
| 406 | + public function extract($p_params = 0) |
|
| 407 | 407 | { |
| 408 | 408 | $this->_errorReset(); |
| 409 | 409 | |
@@ -675,7 +675,7 @@ discard block |
||
| 675 | 675 | * @param boolean $p_with_code If true, gives the name and the int value. |
| 676 | 676 | * @return string The error name. |
| 677 | 677 | */ |
| 678 | - public function errorName($p_with_code=false) |
|
| 678 | + public function errorName($p_with_code = false) |
|
| 679 | 679 | { |
| 680 | 680 | $v_const_list = get_defined_constants(); |
| 681 | 681 | |
@@ -689,8 +689,8 @@ discard block |
||
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | // ----- Search the name form the code value |
| 692 | - $v_key=array_search($this->_error_code, $v_error_list, true); |
|
| 693 | - if ($v_key!=false) { |
|
| 692 | + $v_key = array_search($this->_error_code, $v_error_list, true); |
|
| 693 | + if ($v_key != false) { |
|
| 694 | 694 | $v_value = $v_key; |
| 695 | 695 | } else { |
| 696 | 696 | $v_value = 'NoName'; |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | * and the error code. |
| 716 | 716 | * @return string The error description. |
| 717 | 717 | */ |
| 718 | - public function errorInfo($p_full=false) |
|
| 718 | + public function errorInfo($p_full = false) |
|
| 719 | 719 | { |
| 720 | 720 | if ($p_full) { |
| 721 | 721 | return($this->errorName(true)." : ".$this->_error_string); |
@@ -753,7 +753,7 @@ discard block |
||
| 753 | 753 | * |
| 754 | 754 | * @param integer $p_level |
| 755 | 755 | */ |
| 756 | - public function _checkFormat($p_level=0) |
|
| 756 | + public function _checkFormat($p_level = 0) |
|
| 757 | 757 | { |
| 758 | 758 | $v_result = true; |
| 759 | 759 | |
@@ -804,7 +804,7 @@ discard block |
||
| 804 | 804 | */ |
| 805 | 805 | public function _create($p_list, &$p_result_list, &$p_params) |
| 806 | 806 | { |
| 807 | - $v_result=1; |
|
| 807 | + $v_result = 1; |
|
| 808 | 808 | $v_list_detail = array(); |
| 809 | 809 | |
| 810 | 810 | $p_add_dir = $p_params['add_path']; |
@@ -842,7 +842,7 @@ discard block |
||
| 842 | 842 | */ |
| 843 | 843 | public function _add($p_list, &$p_result_list, &$p_params) |
| 844 | 844 | { |
| 845 | - $v_result=1; |
|
| 845 | + $v_result = 1; |
|
| 846 | 846 | $v_list_detail = array(); |
| 847 | 847 | |
| 848 | 848 | $p_add_dir = $p_params['add_path']; |
@@ -856,7 +856,7 @@ discard block |
||
| 856 | 856 | } |
| 857 | 857 | |
| 858 | 858 | // ----- Open the zip file |
| 859 | - if (($v_result=$this->_openFd('rb')) != 1) { |
|
| 859 | + if (($v_result = $this->_openFd('rb')) != 1) { |
|
| 860 | 860 | return $v_result; |
| 861 | 861 | } |
| 862 | 862 | |
@@ -929,10 +929,10 @@ discard block |
||
| 929 | 929 | } |
| 930 | 930 | |
| 931 | 931 | // ----- Create the Central Dir files header |
| 932 | - for ($i=0, $v_count=0; $i<sizeof($v_header_list); $i++) { |
|
| 932 | + for ($i = 0, $v_count = 0; $i < sizeof($v_header_list); $i++) { |
|
| 933 | 933 | // ----- Create the file header |
| 934 | 934 | if ($v_header_list[$i]['status'] == 'ok') { |
| 935 | - if (($v_result=$this->_writeCentralFileHeader($v_header_list[$i]))!=1) { |
|
| 935 | + if (($v_result = $this->_writeCentralFileHeader($v_header_list[$i])) != 1) { |
|
| 936 | 936 | fclose($v_zip_temp_fd); |
| 937 | 937 | $this->_closeFd(); |
| 938 | 938 | @unlink($v_zip_temp_name); |
@@ -951,7 +951,7 @@ discard block |
||
| 951 | 951 | $v_comment = ''; |
| 952 | 952 | |
| 953 | 953 | // ----- Calculate the size of the central header |
| 954 | - $v_size = @ftell($this->_zip_fd)-$v_offset; |
|
| 954 | + $v_size = @ftell($this->_zip_fd) - $v_offset; |
|
| 955 | 955 | |
| 956 | 956 | // ----- Create the central dir footer |
| 957 | 957 | if (($v_result = $this->_writeCentralHeader($v_count |
@@ -1003,7 +1003,7 @@ discard block |
||
| 1003 | 1003 | */ |
| 1004 | 1004 | public function _openFd($p_mode) |
| 1005 | 1005 | { |
| 1006 | - $v_result=1; |
|
| 1006 | + $v_result = 1; |
|
| 1007 | 1007 | |
| 1008 | 1008 | // ----- Look if already open |
| 1009 | 1009 | if ($this->_zip_fd != 0) { |
@@ -1038,7 +1038,7 @@ discard block |
||
| 1038 | 1038 | */ |
| 1039 | 1039 | public function _closeFd() |
| 1040 | 1040 | { |
| 1041 | - $v_result=1; |
|
| 1041 | + $v_result = 1; |
|
| 1042 | 1042 | |
| 1043 | 1043 | if ($this->_zip_fd != 0) { |
| 1044 | 1044 | @fclose($this->_zip_fd); |
@@ -1072,7 +1072,7 @@ discard block |
||
| 1072 | 1072 | public function _addList($p_list, &$p_result_list, |
| 1073 | 1073 | $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_params) |
| 1074 | 1074 | { |
| 1075 | - $v_result=1; |
|
| 1075 | + $v_result = 1; |
|
| 1076 | 1076 | |
| 1077 | 1077 | // ----- Add the files |
| 1078 | 1078 | $v_header_list = array(); |
@@ -1086,7 +1086,7 @@ discard block |
||
| 1086 | 1086 | $v_offset = @ftell($this->_zip_fd); |
| 1087 | 1087 | |
| 1088 | 1088 | // ----- Create the Central Dir files header |
| 1089 | - for ($i=0, $v_count=0; $i<sizeof($v_header_list); $i++) { |
|
| 1089 | + for ($i = 0, $v_count = 0; $i < sizeof($v_header_list); $i++) { |
|
| 1090 | 1090 | // ----- Create the file header |
| 1091 | 1091 | if ($v_header_list[$i]['status'] == 'ok') { |
| 1092 | 1092 | if (($v_result = $this->_writeCentralFileHeader($v_header_list[$i])) != 1) { |
@@ -1103,7 +1103,7 @@ discard block |
||
| 1103 | 1103 | $v_comment = ''; |
| 1104 | 1104 | |
| 1105 | 1105 | // ----- Calculate the size of the central header |
| 1106 | - $v_size = @ftell($this->_zip_fd)-$v_offset; |
|
| 1106 | + $v_size = @ftell($this->_zip_fd) - $v_offset; |
|
| 1107 | 1107 | |
| 1108 | 1108 | // ----- Create the central dir footer |
| 1109 | 1109 | if (($v_result = $this->_writeCentralHeader($v_count, $v_size, $v_offset, |
@@ -1143,14 +1143,14 @@ discard block |
||
| 1143 | 1143 | $p_add_dir, $p_remove_dir, $p_remove_all_dir, |
| 1144 | 1144 | &$p_params) |
| 1145 | 1145 | { |
| 1146 | - $v_result=1; |
|
| 1146 | + $v_result = 1; |
|
| 1147 | 1147 | $v_header = array(); |
| 1148 | 1148 | |
| 1149 | 1149 | // ----- Recuperate the current number of elt in list |
| 1150 | 1150 | $v_nb = sizeof($p_result_list); |
| 1151 | 1151 | |
| 1152 | 1152 | // ----- Loop on the files |
| 1153 | - for ($j=0; ($j<count($p_list)) && ($v_result==1); $j++) { |
|
| 1153 | + for ($j = 0; ($j < count($p_list)) && ($v_result == 1); $j++) { |
|
| 1154 | 1154 | // ----- Recuperate the filename |
| 1155 | 1155 | $p_filename = $this->_tool_TranslateWinPath($p_list[$j], false); |
| 1156 | 1156 | |
@@ -1244,7 +1244,7 @@ discard block |
||
| 1244 | 1244 | */ |
| 1245 | 1245 | public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_params) |
| 1246 | 1246 | { |
| 1247 | - $v_result=1; |
|
| 1247 | + $v_result = 1; |
|
| 1248 | 1248 | |
| 1249 | 1249 | if ($p_filename == "") { |
| 1250 | 1250 | // ----- Error log |
@@ -1328,7 +1328,7 @@ discard block |
||
| 1328 | 1328 | $p_header['comment_len'] = 0; |
| 1329 | 1329 | $p_header['disk'] = 0; |
| 1330 | 1330 | $p_header['internal'] = 0; |
| 1331 | - $p_header['external'] = (is_file($p_filename)?0xFE49FFE0:0x41FF0010); |
|
| 1331 | + $p_header['external'] = (is_file($p_filename) ? 0xFE49FFE0 : 0x41FF0010); |
|
| 1332 | 1332 | $p_header['offset'] = 0; |
| 1333 | 1333 | $p_header['filename'] = $p_filename; |
| 1334 | 1334 | $p_header['stored_filename'] = $v_stored_filename; |
@@ -1424,7 +1424,7 @@ discard block |
||
| 1424 | 1424 | $p_header['filename'] .= '/'; |
| 1425 | 1425 | $p_header['filename_len']++; |
| 1426 | 1426 | $p_header['size'] = 0; |
| 1427 | - $p_header['external'] = 0x41FF0010; // Value for a folder : to be checked |
|
| 1427 | + $p_header['external'] = 0x41FF0010; // Value for a folder : to be checked |
|
| 1428 | 1428 | |
| 1429 | 1429 | // ----- Call the header generation |
| 1430 | 1430 | if (($v_result = $this->_writeFileHeader($p_header)) != 1) { |
@@ -1473,7 +1473,7 @@ discard block |
||
| 1473 | 1473 | */ |
| 1474 | 1474 | public function _writeFileHeader(&$p_header) |
| 1475 | 1475 | { |
| 1476 | - $v_result=1; |
|
| 1476 | + $v_result = 1; |
|
| 1477 | 1477 | |
| 1478 | 1478 | // TBC |
| 1479 | 1479 | //for(reset($p_header); $key = key($p_header); next($p_header)) { |
@@ -1484,8 +1484,8 @@ discard block |
||
| 1484 | 1484 | |
| 1485 | 1485 | // ----- Transform UNIX mtime to DOS format mdate/mtime |
| 1486 | 1486 | $v_date = getdate($p_header['mtime']); |
| 1487 | - $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; |
|
| 1488 | - $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; |
|
| 1487 | + $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2; |
|
| 1488 | + $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday']; |
|
| 1489 | 1489 | |
| 1490 | 1490 | // ----- Packed data |
| 1491 | 1491 | $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50, $p_header['version'], $p_header['flag'], |
@@ -1523,7 +1523,7 @@ discard block |
||
| 1523 | 1523 | */ |
| 1524 | 1524 | public function _writeCentralFileHeader(&$p_header) |
| 1525 | 1525 | { |
| 1526 | - $v_result=1; |
|
| 1526 | + $v_result = 1; |
|
| 1527 | 1527 | |
| 1528 | 1528 | // TBC |
| 1529 | 1529 | //for(reset($p_header); $key = key($p_header); next($p_header)) { |
@@ -1531,8 +1531,8 @@ discard block |
||
| 1531 | 1531 | |
| 1532 | 1532 | // ----- Transform UNIX mtime to DOS format mdate/mtime |
| 1533 | 1533 | $v_date = getdate($p_header['mtime']); |
| 1534 | - $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; |
|
| 1535 | - $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; |
|
| 1534 | + $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2; |
|
| 1535 | + $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday']; |
|
| 1536 | 1536 | |
| 1537 | 1537 | // ----- Packed data |
| 1538 | 1538 | $v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50, $p_header['version'], $p_header['version_extracted'], |
@@ -1574,7 +1574,7 @@ discard block |
||
| 1574 | 1574 | */ |
| 1575 | 1575 | public function _writeCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment) |
| 1576 | 1576 | { |
| 1577 | - $v_result=1; |
|
| 1577 | + $v_result = 1; |
|
| 1578 | 1578 | |
| 1579 | 1579 | // ----- Packed data |
| 1580 | 1580 | $v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries, $p_nb_entries, $p_size, $p_offset, strlen($p_comment)); |
@@ -1606,7 +1606,7 @@ discard block |
||
| 1606 | 1606 | */ |
| 1607 | 1607 | public function _list(&$p_list) |
| 1608 | 1608 | { |
| 1609 | - $v_result=1; |
|
| 1609 | + $v_result = 1; |
|
| 1610 | 1610 | |
| 1611 | 1611 | // ----- Open the zip file |
| 1612 | 1612 | if (($this->_zip_fd = @fopen($this->_zipname, 'rb')) == 0) { |
@@ -1634,7 +1634,7 @@ discard block |
||
| 1634 | 1634 | } |
| 1635 | 1635 | |
| 1636 | 1636 | // ----- Read each entry |
| 1637 | - for ($i=0; $i<$v_central_dir['entries']; $i++) { |
|
| 1637 | + for ($i = 0; $i < $v_central_dir['entries']; $i++) { |
|
| 1638 | 1638 | // ----- Read the file header |
| 1639 | 1639 | if (($v_result = $this->_readCentralFileHeader($v_header)) != 1) { |
| 1640 | 1640 | return $v_result; |
@@ -1680,7 +1680,7 @@ discard block |
||
| 1680 | 1680 | */ |
| 1681 | 1681 | public function _convertHeader2FileInfo($p_header, &$p_info) |
| 1682 | 1682 | { |
| 1683 | - $v_result=1; |
|
| 1683 | + $v_result = 1; |
|
| 1684 | 1684 | |
| 1685 | 1685 | // ----- Get the interesting attributes |
| 1686 | 1686 | $p_info['filename'] = $p_header['filename']; |
@@ -1689,7 +1689,7 @@ discard block |
||
| 1689 | 1689 | $p_info['compressed_size'] = $p_header['compressed_size']; |
| 1690 | 1690 | $p_info['mtime'] = $p_header['mtime']; |
| 1691 | 1691 | $p_info['comment'] = $p_header['comment']; |
| 1692 | - $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010); |
|
| 1692 | + $p_info['folder'] = (($p_header['external'] & 0x00000010) == 0x00000010); |
|
| 1693 | 1693 | $p_info['index'] = $p_header['index']; |
| 1694 | 1694 | $p_info['status'] = $p_header['status']; |
| 1695 | 1695 | |
@@ -1722,7 +1722,7 @@ discard block |
||
| 1722 | 1722 | */ |
| 1723 | 1723 | public function _extractByRule(&$p_file_list, &$p_params) |
| 1724 | 1724 | { |
| 1725 | - $v_result=1; |
|
| 1725 | + $v_result = 1; |
|
| 1726 | 1726 | |
| 1727 | 1727 | $p_path = $p_params['add_path']; |
| 1728 | 1728 | $p_remove_path = $p_params['remove_path']; |
@@ -1731,7 +1731,7 @@ discard block |
||
| 1731 | 1731 | // ----- Check the path |
| 1732 | 1732 | if (($p_path == "") |
| 1733 | 1733 | || ((substr($p_path, 0, 1) != "/") |
| 1734 | - && (substr($p_path, 0, 3) != "../") && (substr($p_path, 1, 2)!=":/"))) { |
|
| 1734 | + && (substr($p_path, 0, 3) != "../") && (substr($p_path, 1, 2) != ":/"))) { |
|
| 1735 | 1735 | $p_path = "./".$p_path; |
| 1736 | 1736 | } |
| 1737 | 1737 | |
@@ -1739,7 +1739,7 @@ discard block |
||
| 1739 | 1739 | if (($p_path != "./") && ($p_path != "/")) { |
| 1740 | 1740 | // ----- Look for the path end '/' |
| 1741 | 1741 | while (substr($p_path, -1) == "/") { |
| 1742 | - $p_path = substr($p_path, 0, strlen($p_path)-1); |
|
| 1742 | + $p_path = substr($p_path, 0, strlen($p_path) - 1); |
|
| 1743 | 1743 | } |
| 1744 | 1744 | } |
| 1745 | 1745 | |
@@ -1768,7 +1768,7 @@ discard block |
||
| 1768 | 1768 | |
| 1769 | 1769 | // ----- Read each entry |
| 1770 | 1770 | $j_start = 0; |
| 1771 | - for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) { |
|
| 1771 | + for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++) { |
|
| 1772 | 1772 | // ----- Read next Central dir entry |
| 1773 | 1773 | @rewind($this->_zip_fd); |
| 1774 | 1774 | if (@fseek($this->_zip_fd, $v_pos_entry)) { |
@@ -1802,8 +1802,8 @@ discard block |
||
| 1802 | 1802 | && ($p_params[ARCHIVE_ZIP_PARAM_BY_NAME] != 0)) { |
| 1803 | 1803 | |
| 1804 | 1804 | // ----- Look if the filename is in the list |
| 1805 | - for ($j=0; |
|
| 1806 | - ($j<sizeof($p_params[ARCHIVE_ZIP_PARAM_BY_NAME])) |
|
| 1805 | + for ($j = 0; |
|
| 1806 | + ($j < sizeof($p_params[ARCHIVE_ZIP_PARAM_BY_NAME])) |
|
| 1807 | 1807 | && (!$v_extract); |
| 1808 | 1808 | $j++) { |
| 1809 | 1809 | |
@@ -1844,15 +1844,15 @@ discard block |
||
| 1844 | 1844 | && ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX] != 0)) { |
| 1845 | 1845 | |
| 1846 | 1846 | // ----- Look if the index is in the list |
| 1847 | - for ($j=$j_start; ($j<sizeof($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) && (!$v_extract); $j++) { |
|
| 1848 | - if (($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']) && ($i<=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) { |
|
| 1847 | + for ($j = $j_start; ($j < sizeof($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) && (!$v_extract); $j++) { |
|
| 1848 | + if (($i >= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']) && ($i <= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) { |
|
| 1849 | 1849 | $v_extract = true; |
| 1850 | 1850 | } |
| 1851 | - if ($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) { |
|
| 1852 | - $j_start = $j+1; |
|
| 1851 | + if ($i >= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) { |
|
| 1852 | + $j_start = $j + 1; |
|
| 1853 | 1853 | } |
| 1854 | 1854 | |
| 1855 | - if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']>$i) { |
|
| 1855 | + if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start'] > $i) { |
|
| 1856 | 1856 | break; |
| 1857 | 1857 | } |
| 1858 | 1858 | } |
@@ -1946,7 +1946,7 @@ discard block |
||
| 1946 | 1946 | */ |
| 1947 | 1947 | public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_params) |
| 1948 | 1948 | { |
| 1949 | - $v_result=1; |
|
| 1949 | + $v_result = 1; |
|
| 1950 | 1950 | |
| 1951 | 1951 | // ----- Read the file header |
| 1952 | 1952 | if (($v_result = $this->_readFileHeader($v_header)) != 1) { |
@@ -2052,7 +2052,7 @@ discard block |
||
| 2052 | 2052 | |
| 2053 | 2053 | // ----- Check the directory availability and create it if necessary |
| 2054 | 2054 | else { |
| 2055 | - if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/')) { |
|
| 2055 | + if ((($p_entry['external'] & 0x00000010) == 0x00000010) || (substr($p_entry['filename'], -1) == '/')) { |
|
| 2056 | 2056 | $v_dir_to_check = $p_entry['filename']; |
| 2057 | 2057 | } elseif (!strstr($p_entry['filename'], "/")) { |
| 2058 | 2058 | $v_dir_to_check = ""; |
@@ -2060,7 +2060,7 @@ discard block |
||
| 2060 | 2060 | $v_dir_to_check = dirname($p_entry['filename']); |
| 2061 | 2061 | } |
| 2062 | 2062 | |
| 2063 | - if (($v_result = $this->_dirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) { |
|
| 2063 | + if (($v_result = $this->_dirCheck($v_dir_to_check, (($p_entry['external'] & 0x00000010) == 0x00000010))) != 1) { |
|
| 2064 | 2064 | |
| 2065 | 2065 | // ----- Change the file status |
| 2066 | 2066 | $p_entry['status'] = "path_creation_fail"; |
@@ -2076,7 +2076,7 @@ discard block |
||
| 2076 | 2076 | if ($p_entry['status'] == 'ok') { |
| 2077 | 2077 | |
| 2078 | 2078 | // ----- Do the extraction (if not a folder) |
| 2079 | - if (!(($p_entry['external']&0x00000010)==0x00000010)) { |
|
| 2079 | + if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) { |
|
| 2080 | 2080 | |
| 2081 | 2081 | // ----- Look for not compressed file |
| 2082 | 2082 | if ($p_entry['compressed_size'] == $p_entry['size']) { |
@@ -2181,7 +2181,7 @@ discard block |
||
| 2181 | 2181 | */ |
| 2182 | 2182 | public function _extractFileAsString(&$p_entry, &$p_string) |
| 2183 | 2183 | { |
| 2184 | - $v_result=1; |
|
| 2184 | + $v_result = 1; |
|
| 2185 | 2185 | |
| 2186 | 2186 | // ----- Read the file header |
| 2187 | 2187 | $v_header = array(); |
@@ -2197,7 +2197,7 @@ discard block |
||
| 2197 | 2197 | // ----- Trace |
| 2198 | 2198 | |
| 2199 | 2199 | // ----- Do the extraction (if not a folder) |
| 2200 | - if (!(($p_entry['external']&0x00000010)==0x00000010)) { |
|
| 2200 | + if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) { |
|
| 2201 | 2201 | // ----- Look for not compressed file |
| 2202 | 2202 | if ($p_entry['compressed_size'] == $p_entry['size']) { |
| 2203 | 2203 | // ----- Trace |
@@ -2238,7 +2238,7 @@ discard block |
||
| 2238 | 2238 | */ |
| 2239 | 2239 | public function _readFileHeader(&$p_header) |
| 2240 | 2240 | { |
| 2241 | - $v_result=1; |
|
| 2241 | + $v_result = 1; |
|
| 2242 | 2242 | |
| 2243 | 2243 | // ----- Read the 4 bytes signature |
| 2244 | 2244 | $v_binary_data = @fread($this->_zip_fd, 4); |
@@ -2296,7 +2296,7 @@ discard block |
||
| 2296 | 2296 | // ----- Extract time |
| 2297 | 2297 | $v_hour = ($p_header['mtime'] & 0xF800) >> 11; |
| 2298 | 2298 | $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; |
| 2299 | - $v_seconde = ($p_header['mtime'] & 0x001F)*2; |
|
| 2299 | + $v_seconde = ($p_header['mtime'] & 0x001F) * 2; |
|
| 2300 | 2300 | |
| 2301 | 2301 | // ----- Extract date |
| 2302 | 2302 | $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; |
@@ -2340,7 +2340,7 @@ discard block |
||
| 2340 | 2340 | */ |
| 2341 | 2341 | public function _readCentralFileHeader(&$p_header) |
| 2342 | 2342 | { |
| 2343 | - $v_result=1; |
|
| 2343 | + $v_result = 1; |
|
| 2344 | 2344 | |
| 2345 | 2345 | // ----- Read the 4 bytes signature |
| 2346 | 2346 | $v_binary_data = @fread($this->_zip_fd, 4); |
@@ -2402,7 +2402,7 @@ discard block |
||
| 2402 | 2402 | // ----- Extract time |
| 2403 | 2403 | $v_hour = ($p_header['mtime'] & 0xF800) >> 11; |
| 2404 | 2404 | $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; |
| 2405 | - $v_seconde = ($p_header['mtime'] & 0x001F)*2; |
|
| 2405 | + $v_seconde = ($p_header['mtime'] & 0x001F) * 2; |
|
| 2406 | 2406 | |
| 2407 | 2407 | // ----- Extract date |
| 2408 | 2408 | $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; |
@@ -2446,7 +2446,7 @@ discard block |
||
| 2446 | 2446 | */ |
| 2447 | 2447 | public function _readEndCentralDir(&$p_central_dir) |
| 2448 | 2448 | { |
| 2449 | - $v_result=1; |
|
| 2449 | + $v_result = 1; |
|
| 2450 | 2450 | |
| 2451 | 2451 | // ----- Go to the end of the zip file |
| 2452 | 2452 | $v_size = filesize($this->_zipname); |
@@ -2463,8 +2463,8 @@ discard block |
||
| 2463 | 2463 | // in this case the end of central dir is at 22 bytes of the file end |
| 2464 | 2464 | $v_found = 0; |
| 2465 | 2465 | if ($v_size > 26) { |
| 2466 | - @fseek($this->_zip_fd, $v_size-22); |
|
| 2467 | - if (($v_pos = @ftell($this->_zip_fd)) != ($v_size-22)) { |
|
| 2466 | + @fseek($this->_zip_fd, $v_size - 22); |
|
| 2467 | + if (($v_pos = @ftell($this->_zip_fd)) != ($v_size - 22)) { |
|
| 2468 | 2468 | $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, |
| 2469 | 2469 | 'Unable to seek back to the middle of the archive \'' |
| 2470 | 2470 | .$this->_zipname.'\''); |
@@ -2489,8 +2489,8 @@ discard block |
||
| 2489 | 2489 | if ($v_maximum_size > $v_size) { |
| 2490 | 2490 | $v_maximum_size = $v_size; |
| 2491 | 2491 | } |
| 2492 | - @fseek($this->_zip_fd, $v_size-$v_maximum_size); |
|
| 2493 | - if (@ftell($this->_zip_fd) != ($v_size-$v_maximum_size)) { |
|
| 2492 | + @fseek($this->_zip_fd, $v_size - $v_maximum_size); |
|
| 2493 | + if (@ftell($this->_zip_fd) != ($v_size - $v_maximum_size)) { |
|
| 2494 | 2494 | $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, |
| 2495 | 2495 | 'Unable to seek back to the middle of the archive \'' |
| 2496 | 2496 | .$this->_zipname.'\''); |
@@ -2578,11 +2578,11 @@ discard block |
||
| 2578 | 2578 | */ |
| 2579 | 2579 | public function _deleteByRule(&$p_result_list, &$p_params) |
| 2580 | 2580 | { |
| 2581 | - $v_result=1; |
|
| 2581 | + $v_result = 1; |
|
| 2582 | 2582 | $v_list_detail = array(); |
| 2583 | 2583 | |
| 2584 | 2584 | // ----- Open the zip file |
| 2585 | - if (($v_result=$this->_openFd('rb')) != 1) { |
|
| 2585 | + if (($v_result = $this->_openFd('rb')) != 1) { |
|
| 2586 | 2586 | // ----- Return |
| 2587 | 2587 | return $v_result; |
| 2588 | 2588 | } |
@@ -2613,7 +2613,7 @@ discard block |
||
| 2613 | 2613 | // ----- Read each entry |
| 2614 | 2614 | $v_header_list = array(); |
| 2615 | 2615 | $j_start = 0; |
| 2616 | - for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) { |
|
| 2616 | + for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++) { |
|
| 2617 | 2617 | |
| 2618 | 2618 | // ----- Read the file header |
| 2619 | 2619 | $v_header_list[$v_nb_extracted] = array(); |
@@ -2637,8 +2637,8 @@ discard block |
||
| 2637 | 2637 | && ($p_params[ARCHIVE_ZIP_PARAM_BY_NAME] != 0)) { |
| 2638 | 2638 | |
| 2639 | 2639 | // ----- Look if the filename is in the list |
| 2640 | - for ($j=0; |
|
| 2641 | - ($j<sizeof($p_params[ARCHIVE_ZIP_PARAM_BY_NAME])) |
|
| 2640 | + for ($j = 0; |
|
| 2641 | + ($j < sizeof($p_params[ARCHIVE_ZIP_PARAM_BY_NAME])) |
|
| 2642 | 2642 | && (!$v_found); |
| 2643 | 2643 | $j++) { |
| 2644 | 2644 | |
@@ -2649,7 +2649,7 @@ discard block |
||
| 2649 | 2649 | if ((strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) |
| 2650 | 2650 | && (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])) { |
| 2651 | 2651 | $v_found = true; |
| 2652 | - } elseif ((($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */ |
|
| 2652 | + } elseif ((($v_header_list[$v_nb_extracted]['external'] & 0x00000010) == 0x00000010) /* Indicates a folder */ |
|
| 2653 | 2653 | && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) { |
| 2654 | 2654 | $v_found = true; |
| 2655 | 2655 | } |
@@ -2685,19 +2685,19 @@ discard block |
||
| 2685 | 2685 | && ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX] != 0)) { |
| 2686 | 2686 | |
| 2687 | 2687 | // ----- Look if the index is in the list |
| 2688 | - for ($j=$j_start; |
|
| 2689 | - ($j<sizeof($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) |
|
| 2688 | + for ($j = $j_start; |
|
| 2689 | + ($j < sizeof($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) |
|
| 2690 | 2690 | && (!$v_found); |
| 2691 | 2691 | $j++) { |
| 2692 | - if (($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']) |
|
| 2693 | - && ($i<=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) { |
|
| 2692 | + if (($i >= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']) |
|
| 2693 | + && ($i <= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) { |
|
| 2694 | 2694 | $v_found = true; |
| 2695 | 2695 | } |
| 2696 | - if ($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) { |
|
| 2697 | - $j_start = $j+1; |
|
| 2696 | + if ($i >= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) { |
|
| 2697 | + $j_start = $j + 1; |
|
| 2698 | 2698 | } |
| 2699 | 2699 | |
| 2700 | - if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']>$i) { |
|
| 2700 | + if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start'] > $i) { |
|
| 2701 | 2701 | break; |
| 2702 | 2702 | } |
| 2703 | 2703 | } |
@@ -2730,11 +2730,11 @@ discard block |
||
| 2730 | 2730 | } |
| 2731 | 2731 | |
| 2732 | 2732 | // ----- Look which file need to be kept |
| 2733 | - for ($i=0; $i<sizeof($v_header_list); $i++) { |
|
| 2733 | + for ($i = 0; $i < sizeof($v_header_list); $i++) { |
|
| 2734 | 2734 | |
| 2735 | 2735 | // ----- Calculate the position of the header |
| 2736 | 2736 | @rewind($this->_zip_fd); |
| 2737 | - if (@fseek($this->_zip_fd, $v_header_list[$i]['offset'])) { |
|
| 2737 | + if (@fseek($this->_zip_fd, $v_header_list[$i]['offset'])) { |
|
| 2738 | 2738 | // ----- Clean |
| 2739 | 2739 | $this->_closeFd(); |
| 2740 | 2740 | $v_temp_zip->_closeFd(); |
@@ -2784,9 +2784,9 @@ discard block |
||
| 2784 | 2784 | $v_offset = @ftell($v_temp_zip->_zip_fd); |
| 2785 | 2785 | |
| 2786 | 2786 | // ----- Re-Create the Central Dir files header |
| 2787 | - for ($i=0; $i<sizeof($v_header_list); $i++) { |
|
| 2787 | + for ($i = 0; $i < sizeof($v_header_list); $i++) { |
|
| 2788 | 2788 | // ----- Create the file header |
| 2789 | - $v_result=$v_temp_zip->_writeCentralFileHeader($v_header_list[$i]); |
|
| 2789 | + $v_result = $v_temp_zip->_writeCentralFileHeader($v_header_list[$i]); |
|
| 2790 | 2790 | if ($v_result != 1) { |
| 2791 | 2791 | // ----- Clean |
| 2792 | 2792 | $v_temp_zip->_closeFd(); |
@@ -2806,7 +2806,7 @@ discard block |
||
| 2806 | 2806 | $v_comment = ''; |
| 2807 | 2807 | |
| 2808 | 2808 | // ----- Calculate the size of the central header |
| 2809 | - $v_size = @ftell($v_temp_zip->_zip_fd)-$v_offset; |
|
| 2809 | + $v_size = @ftell($v_temp_zip->_zip_fd) - $v_offset; |
|
| 2810 | 2810 | |
| 2811 | 2811 | // ----- Create the central dir footer |
| 2812 | 2812 | $v_result = $v_temp_zip->_writeCentralHeader(sizeof($v_header_list), |
@@ -2862,13 +2862,13 @@ discard block |
||
| 2862 | 2862 | * |
| 2863 | 2863 | * @param [type] $p_is_dir |
| 2864 | 2864 | */ |
| 2865 | - public function _dirCheck($p_dir, $p_is_dir=false) |
|
| 2865 | + public function _dirCheck($p_dir, $p_is_dir = false) |
|
| 2866 | 2866 | { |
| 2867 | 2867 | $v_result = 1; |
| 2868 | 2868 | |
| 2869 | 2869 | // ----- Remove the final '/' |
| 2870 | - if (($p_is_dir) && (substr($p_dir, -1)=='/')) { |
|
| 2871 | - $p_dir = substr($p_dir, 0, strlen($p_dir)-1); |
|
| 2870 | + if (($p_is_dir) && (substr($p_dir, -1) == '/')) { |
|
| 2871 | + $p_dir = substr($p_dir, 0, strlen($p_dir) - 1); |
|
| 2872 | 2872 | } |
| 2873 | 2873 | |
| 2874 | 2874 | // ----- Check the directory availability |
@@ -2916,7 +2916,7 @@ discard block |
||
| 2916 | 2916 | */ |
| 2917 | 2917 | public function _merge(&$p_archive_to_add) |
| 2918 | 2918 | { |
| 2919 | - $v_result=1; |
|
| 2919 | + $v_result = 1; |
|
| 2920 | 2920 | |
| 2921 | 2921 | // ----- Look if the archive_to_add exists |
| 2922 | 2922 | if (!is_file($p_archive_to_add->_zipname)) { |
@@ -2933,7 +2933,7 @@ discard block |
||
| 2933 | 2933 | } |
| 2934 | 2934 | |
| 2935 | 2935 | // ----- Open the zip file |
| 2936 | - if (($v_result=$this->_openFd('rb')) != 1) { |
|
| 2936 | + if (($v_result = $this->_openFd('rb')) != 1) { |
|
| 2937 | 2937 | return $v_result; |
| 2938 | 2938 | } |
| 2939 | 2939 | |
@@ -2948,7 +2948,7 @@ discard block |
||
| 2948 | 2948 | @rewind($this->_zip_fd); |
| 2949 | 2949 | |
| 2950 | 2950 | // ----- Open the archive_to_add file |
| 2951 | - if (($v_result=$p_archive_to_add->_openFd('rb')) != 1) { |
|
| 2951 | + if (($v_result = $p_archive_to_add->_openFd('rb')) != 1) { |
|
| 2952 | 2952 | $this->_closeFd(); |
| 2953 | 2953 | return $v_result; |
| 2954 | 2954 | } |
@@ -3028,7 +3028,7 @@ discard block |
||
| 3028 | 3028 | $v_comment = ''; |
| 3029 | 3029 | |
| 3030 | 3030 | // ----- Calculate the size of the (new) central header |
| 3031 | - $v_size = @ftell($v_zip_temp_fd)-$v_offset; |
|
| 3031 | + $v_size = @ftell($v_zip_temp_fd) - $v_offset; |
|
| 3032 | 3032 | |
| 3033 | 3033 | // ----- Swap the file descriptor |
| 3034 | 3034 | // Here is a trick : I swap the temporary fd with the zip fd, in order to use |
@@ -3094,7 +3094,7 @@ discard block |
||
| 3094 | 3094 | */ |
| 3095 | 3095 | public function _duplicate($p_archive_filename) |
| 3096 | 3096 | { |
| 3097 | - $v_result=1; |
|
| 3097 | + $v_result = 1; |
|
| 3098 | 3098 | |
| 3099 | 3099 | // ----- Look if the $p_archive_filename exists |
| 3100 | 3100 | if (!is_file($p_archive_filename)) { |
@@ -3107,7 +3107,7 @@ discard block |
||
| 3107 | 3107 | } |
| 3108 | 3108 | |
| 3109 | 3109 | // ----- Open the zip file |
| 3110 | - if (($v_result=$this->_openFd('wb')) != 1) { |
|
| 3110 | + if (($v_result = $this->_openFd('wb')) != 1) { |
|
| 3111 | 3111 | // ----- Return |
| 3112 | 3112 | return $v_result; |
| 3113 | 3113 | } |
@@ -3181,8 +3181,8 @@ discard block |
||
| 3181 | 3181 | // ----- Check specific parameters |
| 3182 | 3182 | $v_callback_list = array('callback_pre_add', 'callback_post_add', |
| 3183 | 3183 | 'callback_pre_extract', 'callback_post_extract'); |
| 3184 | - for ($i=0; $i<sizeof($v_callback_list); $i++) { |
|
| 3185 | - $v_key=$v_callback_list[$i]; |
|
| 3184 | + for ($i = 0; $i < sizeof($v_callback_list); $i++) { |
|
| 3185 | + $v_key = $v_callback_list[$i]; |
|
| 3186 | 3186 | if ((isset($p_params[$v_key])) && ($p_params[$v_key] != '')) { |
| 3187 | 3187 | if (!function_exists($p_params[$v_key])) { |
| 3188 | 3188 | $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAM_VALUE, |
@@ -3211,7 +3211,7 @@ discard block |
||
| 3211 | 3211 | * @param integer $p_error_code |
| 3212 | 3212 | * @param string $p_error_string |
| 3213 | 3213 | */ |
| 3214 | - public function _errorLog($p_error_code=0, $p_error_string='') |
|
| 3214 | + public function _errorLog($p_error_code = 0, $p_error_string = '') |
|
| 3215 | 3215 | { |
| 3216 | 3216 | $this->_error_code = $p_error_code; |
| 3217 | 3217 | $this->_error_string = $p_error_string; |
@@ -3258,7 +3258,7 @@ discard block |
||
| 3258 | 3258 | $v_list = explode("/", $p_dir); |
| 3259 | 3259 | |
| 3260 | 3260 | // ----- Study directories from last to first |
| 3261 | - for ($i=sizeof($v_list)-1; $i>=0; $i--) { |
|
| 3261 | + for ($i = sizeof($v_list) - 1; $i >= 0; $i--) { |
|
| 3262 | 3262 | // ----- Look for current path |
| 3263 | 3263 | if ($v_list[$i] == ".") { |
| 3264 | 3264 | // ----- Ignore this directory |
@@ -3266,11 +3266,11 @@ discard block |
||
| 3266 | 3266 | } elseif ($v_list[$i] == "..") { |
| 3267 | 3267 | // ----- Ignore it and ignore the $i-1 |
| 3268 | 3268 | $i--; |
| 3269 | - } elseif (($v_list[$i] == "") && ($i!=(sizeof($v_list)-1)) && ($i!=0)) { |
|
| 3269 | + } elseif (($v_list[$i] == "") && ($i != (sizeof($v_list) - 1)) && ($i != 0)) { |
|
| 3270 | 3270 | // ----- Ignore only the double '//' in path, |
| 3271 | 3271 | // but not the first and last '/' |
| 3272 | 3272 | } else { |
| 3273 | - $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:""); |
|
| 3273 | + $v_result = $v_list[$i].($i != (sizeof($v_list) - 1) ? "/".$v_result : ""); |
|
| 3274 | 3274 | } |
| 3275 | 3275 | } |
| 3276 | 3276 | } |
@@ -3380,11 +3380,11 @@ discard block |
||
| 3380 | 3380 | * |
| 3381 | 3381 | * @param integer $p_mode |
| 3382 | 3382 | */ |
| 3383 | - public function _tool_CopyBlock($p_src, $p_dest, $p_size, $p_mode=0) |
|
| 3383 | + public function _tool_CopyBlock($p_src, $p_dest, $p_size, $p_mode = 0) |
|
| 3384 | 3384 | { |
| 3385 | 3385 | $v_result = 1; |
| 3386 | 3386 | |
| 3387 | - if ($p_mode==0) { |
|
| 3387 | + if ($p_mode == 0) { |
|
| 3388 | 3388 | while ($p_size != 0) { |
| 3389 | 3389 | $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE |
| 3390 | 3390 | ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE); |
@@ -3392,7 +3392,7 @@ discard block |
||
| 3392 | 3392 | @fwrite($p_dest, $v_buffer, $v_read_size); |
| 3393 | 3393 | $p_size -= $v_read_size; |
| 3394 | 3394 | } |
| 3395 | - } elseif ($p_mode==1) { |
|
| 3395 | + } elseif ($p_mode == 1) { |
|
| 3396 | 3396 | while ($p_size != 0) { |
| 3397 | 3397 | $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE |
| 3398 | 3398 | ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE); |
@@ -3400,7 +3400,7 @@ discard block |
||
| 3400 | 3400 | @fwrite($p_dest, $v_buffer, $v_read_size); |
| 3401 | 3401 | $p_size -= $v_read_size; |
| 3402 | 3402 | } |
| 3403 | - } elseif ($p_mode==2) { |
|
| 3403 | + } elseif ($p_mode == 2) { |
|
| 3404 | 3404 | while ($p_size != 0) { |
| 3405 | 3405 | $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE |
| 3406 | 3406 | ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE); |
@@ -3408,7 +3408,7 @@ discard block |
||
| 3408 | 3408 | @gzwrite($p_dest, $v_buffer, $v_read_size); |
| 3409 | 3409 | $p_size -= $v_read_size; |
| 3410 | 3410 | } |
| 3411 | - } elseif ($p_mode==3) { |
|
| 3411 | + } elseif ($p_mode == 3) { |
|
| 3412 | 3412 | while ($p_size != 0) { |
| 3413 | 3413 | $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE |
| 3414 | 3414 | ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE); |
@@ -3479,13 +3479,13 @@ discard block |
||
| 3479 | 3479 | * |
| 3480 | 3480 | * @param [type] $p_remove_disk_letter |
| 3481 | 3481 | */ |
| 3482 | - public function _tool_TranslateWinPath($p_path, $p_remove_disk_letter=true) |
|
| 3482 | + public function _tool_TranslateWinPath($p_path, $p_remove_disk_letter = true) |
|
| 3483 | 3483 | { |
| 3484 | 3484 | if (stristr(php_uname(), 'windows')) { |
| 3485 | 3485 | // ----- Look for potential disk letter |
| 3486 | 3486 | if (($p_remove_disk_letter) |
| 3487 | 3487 | && (($v_position = strpos($p_path, ':')) != false)) { |
| 3488 | - $p_path = substr($p_path, $v_position+1); |
|
| 3488 | + $p_path = substr($p_path, $v_position + 1); |
|
| 3489 | 3489 | } |
| 3490 | 3490 | // ----- Change potential windows directory separator |
| 3491 | 3491 | if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0, 1) == '\\')) { |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | // Project: The XOOPS Project // |
| 30 | 30 | // ------------------------------------------------------------------------- // |
| 31 | 31 | |
| 32 | -if (! defined('XOOPS_ROOT_PATH')) { |
|
| 33 | - exit ; |
|
| 32 | +if (!defined('XOOPS_ROOT_PATH')) { |
|
| 33 | + exit; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelement.php'; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * Tree structure of items |
| 61 | 61 | * @var array |
| 62 | 62 | */ |
| 63 | - public $_itemTree = array() ; |
|
| 63 | + public $_itemTree = array(); |
|
| 64 | 64 | /** |
| 65 | 65 | * Name of permission |
| 66 | 66 | * @var string |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * Appendix |
| 76 | 76 | * @var array ('permname'=>,'itemid'=>,'itemname'=>,'selected'=>) |
| 77 | 77 | */ |
| 78 | - public $_appendix = array() ; |
|
| 78 | + public $_appendix = array(); |
|
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * Constructor |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | public function addAppendix($permName, $itemId, $itemName) |
| 117 | 117 | { |
| 118 | - $this->_appendix[] = array('permname'=>$permName,'itemid'=>$itemId,'itemname'=>$itemName,'selected'=>false); |
|
| 118 | + $this->_appendix[] = array('permname'=>$permName, 'itemid'=>$itemId, 'itemname'=>$itemName, 'selected'=>false); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -149,15 +149,15 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public function render() |
| 151 | 151 | { |
| 152 | - global $xoopsGTicket ; |
|
| 152 | + global $xoopsGTicket; |
|
| 153 | 153 | |
| 154 | 154 | // load all child ids for javascript codes |
| 155 | 155 | foreach (array_keys($this->_itemTree) as $item_id) { |
| 156 | 156 | $this->_itemTree[$item_id]['allchild'] = array(); |
| 157 | 157 | $this->_loadAllChildItemIds($item_id, $this->_itemTree[$item_id]['allchild']); |
| 158 | 158 | } |
| 159 | - $gperm_handler =& xoops_gethandler('groupperm'); |
|
| 160 | - $member_handler =& xoops_gethandler('member'); |
|
| 159 | + $gperm_handler = & xoops_gethandler('groupperm'); |
|
| 160 | + $member_handler = & xoops_gethandler('member'); |
|
| 161 | 161 | $glist = $member_handler->getGroupList(); |
| 162 | 162 | foreach (array_keys($glist) as $i) { |
| 163 | 163 | // get selected item id(s) for each group |
@@ -166,11 +166,11 @@ discard block |
||
| 166 | 166 | $ele->setOptionTree($this->_itemTree); |
| 167 | 167 | |
| 168 | 168 | // GIJ start |
| 169 | - $ele->setDescription('<input type="checkbox" onclick="with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].name.match(/^perms\[(module_admin|module_read|block_read)\]\[groups\]\['.$i.'\]/)){elements[i].checked=this.checked;}}};">') ; |
|
| 169 | + $ele->setDescription('<input type="checkbox" onclick="with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].name.match(/^perms\[(module_admin|module_read|block_read)\]\[groups\]\['.$i.'\]/)){elements[i].checked=this.checked;}}};">'); |
|
| 170 | 170 | // GIJ_end |
| 171 | 171 | |
| 172 | 172 | foreach ($this->_appendix as $key => $append) { |
| 173 | - $this->_appendix[$key]['selected'] = $gperm_handler->checkRight($append['permname'], $append['itemid'], $i, $this->_modid) ; |
|
| 173 | + $this->_appendix[$key]['selected'] = $gperm_handler->checkRight($append['permname'], $append['itemid'], $i, $this->_modid); |
|
| 174 | 174 | } |
| 175 | 175 | $ele->setAppendix($this->_appendix); |
| 176 | 176 | $this->addElement($ele); |
@@ -180,11 +180,11 @@ discard block |
||
| 180 | 180 | // GIJ start |
| 181 | 181 | $jstray = new XoopsFormElementTray(' '); |
| 182 | 182 | $jsuncheckbutton = new XoopsFormButton('', 'none', _NONE, 'button'); |
| 183 | - $jsuncheckbutton->setExtra("onclick=\"with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].type=='checkbox'){elements[i].checked=false;}}}\"") ; |
|
| 183 | + $jsuncheckbutton->setExtra("onclick=\"with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].type=='checkbox'){elements[i].checked=false;}}}\""); |
|
| 184 | 184 | $jscheckbutton = new XoopsFormButton('', 'all', _ALL, 'button'); |
| 185 | - $jscheckbutton->setExtra("onclick=\"with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].type=='checkbox' && (elements[i].name.indexOf('module_admin')<0 || elements[i].name.indexOf('[groups][1]')>=0)){elements[i].checked=true;}}}\"") ; |
|
| 186 | - $jstray->addElement($jsuncheckbutton) ; |
|
| 187 | - $jstray->addElement($jscheckbutton) ; |
|
| 185 | + $jscheckbutton->setExtra("onclick=\"with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].type=='checkbox' && (elements[i].name.indexOf('module_admin')<0 || elements[i].name.indexOf('[groups][1]')>=0)){elements[i].checked=true;}}}\""); |
|
| 186 | + $jstray->addElement($jsuncheckbutton); |
|
| 187 | + $jstray->addElement($jscheckbutton); |
|
| 188 | 188 | $this->addElement($jstray); |
| 189 | 189 | // GIJ end |
| 190 | 190 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | |
| 196 | 196 | $ret = '<h4>'.$this->getTitle().'</h4>'.$this->_permDesc.'<br />'; |
| 197 | 197 | $ret .= "<form name='".$this->getName()."' id='".$this->getName()."' action='".$this->getAction()."' method='".$this->getMethod()."'".$this->getExtra().">\n<table width='100%' class='outer' cellspacing='1'>\n"; |
| 198 | - $elements =& $this->getElements(); |
|
| 198 | + $elements = & $this->getElements(); |
|
| 199 | 199 | foreach (array_keys($elements) as $i) { |
| 200 | 200 | if (!is_object($elements[$i])) { |
| 201 | 201 | $ret .= $elements[$i]; |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | * Appendix |
| 248 | 248 | * @var array ('permname'=>,'itemid'=>,'itemname'=>,'selected'=>) |
| 249 | 249 | */ |
| 250 | - public $_appendix = array() ; |
|
| 250 | + public $_appendix = array(); |
|
| 251 | 251 | |
| 252 | 252 | /** |
| 253 | 253 | * Constructor |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | */ |
| 288 | 288 | public function setOptionTree(&$optionTree) |
| 289 | 289 | { |
| 290 | - $this->_optionTree =& $optionTree; |
|
| 290 | + $this->_optionTree = & $optionTree; |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | */ |
| 298 | 298 | public function setAppendix($appendix) |
| 299 | 299 | { |
| 300 | - $this->_appendix = $appendix ; |
|
| 300 | + $this->_appendix = $appendix; |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | /** |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | */ |
| 309 | 309 | public function render() |
| 310 | 310 | { |
| 311 | - $ret = '' ; |
|
| 311 | + $ret = ''; |
|
| 312 | 312 | |
| 313 | 313 | if (sizeof($this->_appendix) > 0) { |
| 314 | 314 | $ret .= '<table class="outer"><tr>'; |
@@ -318,11 +318,11 @@ discard block |
||
| 318 | 318 | $ret .= '</tr><tr>'; |
| 319 | 319 | $cols = 1; |
| 320 | 320 | } |
| 321 | - $checked = $append['selected'] ? 'checked="checked"' : '' ; |
|
| 322 | - $name = 'perms['.$append['permname'].']' ; |
|
| 323 | - $itemid = $append['itemid'] ; |
|
| 324 | - $itemid = $append['itemid'] ; |
|
| 325 | - $ret .= "<td class=\"odd\"><input type=\"checkbox\" name=\"{$name}[groups][$this->_groupId][$itemid]\" id=\"{$name}[groups][$this->_groupId][$itemid]\" value=\"1\" $checked />{$append['itemname']}<input type=\"hidden\" name=\"{$name}[parents][$itemid]\" value=\"\" /><input type=\"hidden\" name=\"{$name}[itemname][$itemid]\" value=\"{$append['itemname']}\" /><br /></td>" ; |
|
| 321 | + $checked = $append['selected'] ? 'checked="checked"' : ''; |
|
| 322 | + $name = 'perms['.$append['permname'].']'; |
|
| 323 | + $itemid = $append['itemid']; |
|
| 324 | + $itemid = $append['itemid']; |
|
| 325 | + $ret .= "<td class=\"odd\"><input type=\"checkbox\" name=\"{$name}[groups][$this->_groupId][$itemid]\" id=\"{$name}[groups][$this->_groupId][$itemid]\" value=\"1\" $checked />{$append['itemname']}<input type=\"hidden\" name=\"{$name}[parents][$itemid]\" value=\"\" /><input type=\"hidden\" name=\"{$name}[itemname][$itemid]\" value=\"{$append['itemname']}\" /><br /></td>"; |
|
| 326 | 326 | $cols++; |
| 327 | 327 | } |
| 328 | 328 | $ret .= '</tr></table>'; |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | |
| 331 | 331 | $ret .= '<table class="outer"><tr>'; |
| 332 | 332 | $cols = 1; |
| 333 | - if (! empty($this->_optionTree[0]['children'])) { |
|
| 333 | + if (!empty($this->_optionTree[0]['children'])) { |
|
| 334 | 334 | foreach ($this->_optionTree[0]['children'] as $topitem) { |
| 335 | 335 | if ($cols > 4) { |
| 336 | 336 | $ret .= '</tr><tr>'; |