@@ -5,16 +5,16 @@ discard block |
||
| 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 |
||
| 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&lib=altsys&page=mytplsform&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&lib=altsys&page=mytplsform&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 |
||
| 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 |
||
| 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 |
||
| 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&lib=altsys&page=compilehookadmin', _MI_ALTSYS_MENU_COMPILEHOOKADMIN) ; |
|
| 227 | +$breadcrumbsObj = AltsysBreadcrumbs::getInstance(); |
|
| 228 | +$breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=compilehookadmin', _MI_ALTSYS_MENU_COMPILEHOOKADMIN); |
|
| 229 | 229 | |
| 230 | 230 | echo " |
| 231 | 231 | <style> |
@@ -250,7 +250,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 319 | 319 | \n" ; |
| 320 | 320 | |
| 321 | 321 | |
| 322 | -xoops_cp_footer() ; |
|
| 322 | +xoops_cp_footer(); |
|
@@ -1,15 +1,15 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (! defined('XOOPS_ROOT_PATH')) { |
|
| 4 | - exit ; |
|
| 3 | +if (!defined('XOOPS_ROOT_PATH')) { |
|
| 4 | + exit; |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -$core_type = altsys_get_core_type() ; |
|
| 8 | -$db = XoopsDatabaseFactory::getDatabaseConnection() ; |
|
| 7 | +$core_type = altsys_get_core_type(); |
|
| 8 | +$db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 9 | 9 | |
| 10 | -$current_dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['dirname']) ; |
|
| 10 | +$current_dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['dirname']); |
|
| 11 | 11 | if ($current_dirname == '__CustomBlocks__') { |
| 12 | - return ; |
|
| 12 | + return; |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | $module_handler4menu = xoops_getHandler('module'); |
@@ -17,45 +17,45 @@ discard block |
||
| 17 | 17 | //$criteria4menu->add(new Criteria('hasmain', 1)); |
| 18 | 18 | $criteria4menu->add(new Criteria('mid', '1', '>')); |
| 19 | 19 | $modules4menu = $module_handler4menu->getObjects($criteria4menu, true); |
| 20 | - $system_module = $module_handler4menu->get(1) ; |
|
| 20 | + $system_module = $module_handler4menu->get(1); |
|
| 21 | 21 | if (is_object($system_module)) { |
| 22 | - array_unshift($modules4menu, $system_module) ; |
|
| 22 | + array_unshift($modules4menu, $system_module); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | -$adminmenu = array() ; |
|
| 25 | +$adminmenu = array(); |
|
| 26 | 26 | foreach ($modules4menu as $m4menu) { |
| 27 | 27 | // get block info |
| 28 | 28 | if ($core_type != ALTSYS_CORE_TYPE_X22) { |
| 29 | - list($block_count_all) = $db->fetchRow($db->query('SELECT COUNT(*) FROM ' . $db->prefix('newblocks') . ' WHERE mid=' . $m4menu->getVar('mid'))) ; |
|
| 30 | - list($block_count_visible) = $db->fetchRow($db->query('SELECT COUNT(*) FROM ' . $db->prefix('newblocks') . ' WHERE mid=' . $m4menu->getVar('mid') . ' AND visible>0')) ; |
|
| 29 | + list($block_count_all) = $db->fetchRow($db->query('SELECT COUNT(*) FROM '.$db->prefix('newblocks').' WHERE mid='.$m4menu->getVar('mid'))); |
|
| 30 | + list($block_count_visible) = $db->fetchRow($db->query('SELECT COUNT(*) FROM '.$db->prefix('newblocks').' WHERE mid='.$m4menu->getVar('mid').' AND visible>0')); |
|
| 31 | 31 | // $block_desc = " $block_count_all($block_count_visible)" ; |
| 32 | - $block_desc = " ($block_count_visible/$block_count_all)" ; |
|
| 32 | + $block_desc = " ($block_count_visible/$block_count_all)"; |
|
| 33 | 33 | } else { |
| 34 | - $block_desc = '' ; |
|
| 34 | + $block_desc = ''; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | if ($m4menu->getVar('dirname') == $current_dirname) { |
| 38 | 38 | $adminmenu[] = array( |
| 39 | - 'selected' => true , |
|
| 40 | - 'title' => $m4menu->getVar('name', 'n') . $block_desc , |
|
| 39 | + 'selected' => true, |
|
| 40 | + 'title' => $m4menu->getVar('name', 'n').$block_desc, |
|
| 41 | 41 | 'link' => '?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$m4menu->getVar('dirname', 'n') |
| 42 | - ) ; |
|
| 42 | + ); |
|
| 43 | 43 | //$GLOBALS['altsysXoopsBreadcrumbs'][] = array( 'name' => $m4menu->getVar('name') ) ; |
| 44 | 44 | } else { |
| 45 | 45 | $adminmenu[] = array( |
| 46 | - 'selected' => false , |
|
| 47 | - 'title' => $m4menu->getVar('name', 'n') . $block_desc , |
|
| 46 | + 'selected' => false, |
|
| 47 | + 'title' => $m4menu->getVar('name', 'n').$block_desc, |
|
| 48 | 48 | 'link' => '?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$m4menu->getVar('dirname', 'n') |
| 49 | - ) ; |
|
| 49 | + ); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | // display |
| 55 | -require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ; |
|
| 56 | -$tpl = new D3Tpl() ; |
|
| 55 | +require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php'; |
|
| 56 | +$tpl = new D3Tpl(); |
|
| 57 | 57 | $tpl->assign(array( |
| 58 | 58 | 'adminmenu' => $adminmenu, |
| 59 | 59 | 'mypage' => 'myblocksadmin' |
| 60 | -)) ; |
|
| 61 | -$tpl->display('db:altsys_inc_mymenusub.html') ; |
|
| 60 | +)); |
|
| 61 | +$tpl->display('db:altsys_inc_mymenusub.html'); |
|
@@ -6,9 +6,9 @@ |
||
| 6 | 6 | //admin page |
| 7 | 7 | if ($root->mController->_mStrategy) { |
| 8 | 8 | if (strtolower(get_class($root->mController->_mStrategy)) == strtolower('Legacy_AdminControllerStrategy')) { |
| 9 | - include_once __DIR__.'/include/altsys_functions.php' ; |
|
| 9 | + include_once __DIR__.'/include/altsys_functions.php'; |
|
| 10 | 10 | // language file (modinfo.php) |
| 11 | - altsys_include_language_file('modinfo') ; |
|
| 11 | + altsys_include_language_file('modinfo'); |
|
| 12 | 12 | } |
| 13 | 13 | } |
| 14 | 14 | // load altsys newly gticket class for other modules |
@@ -1,75 +1,75 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -eval(' function xoops_module_update_'.$mydirname.'( $module ) { return altsys_onupdate_base( $module , "'.$mydirname.'" ) ; } ') ; |
|
| 3 | +eval(' function xoops_module_update_'.$mydirname.'( $module ) { return altsys_onupdate_base( $module , "'.$mydirname.'" ) ; } '); |
|
| 4 | 4 | |
| 5 | 5 | |
| 6 | -if (! function_exists('altsys_onupdate_base')) { |
|
| 6 | +if (!function_exists('altsys_onupdate_base')) { |
|
| 7 | 7 | function altsys_onupdate_base($module, $mydirname) |
| 8 | 8 | { |
| 9 | 9 | // transations on module update |
| 10 | 10 | |
| 11 | - global $msgs ; // TODO :-D |
|
| 11 | + global $msgs; // TODO :-D |
|
| 12 | 12 | |
| 13 | 13 | // for Cube 2.1 |
| 14 | 14 | if (defined('XOOPS_CUBE_LEGACY')) { |
| 15 | 15 | $root = XCube_Root::getSingleton(); |
| 16 | - $root->mDelegateManager->add('Legacy.Admin.Event.ModuleUpdate.' . ucfirst($mydirname) . '.Success', 'altsys_message_append_onupdate') ; |
|
| 17 | - $msgs = array() ; |
|
| 16 | + $root->mDelegateManager->add('Legacy.Admin.Event.ModuleUpdate.'.ucfirst($mydirname).'.Success', 'altsys_message_append_onupdate'); |
|
| 17 | + $msgs = array(); |
|
| 18 | 18 | } else { |
| 19 | - if (! is_array($msgs)) { |
|
| 20 | - $msgs = array() ; |
|
| 19 | + if (!is_array($msgs)) { |
|
| 20 | + $msgs = array(); |
|
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - $db = XoopsDatabaseFactory::getDatabaseConnection() ; |
|
| 25 | - $mid = $module->getVar('mid') ; |
|
| 24 | + $db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 25 | + $mid = $module->getVar('mid'); |
|
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | // TABLES (write here ALTER TABLE etc. if necessary) |
| 30 | 30 | |
| 31 | 31 | // configs (Though I know it is not a recommended way...) |
| 32 | - $check_sql = 'SHOW COLUMNS FROM ' . $db->prefix('config') . " LIKE 'conf_title'" ; |
|
| 32 | + $check_sql = 'SHOW COLUMNS FROM '.$db->prefix('config')." LIKE 'conf_title'"; |
|
| 33 | 33 | if (($result = $db->query($check_sql)) && ($myrow = $db->fetchArray($result)) && @$myrow['Type'] == 'varchar(30)') { |
| 34 | - $db->queryF('ALTER TABLE ' . $db->prefix('config') . " MODIFY `conf_title` varchar(255) NOT NULL default '', MODIFY `conf_desc` varchar(255) NOT NULL default ''") ; |
|
| 34 | + $db->queryF('ALTER TABLE '.$db->prefix('config')." MODIFY `conf_title` varchar(255) NOT NULL default '', MODIFY `conf_desc` varchar(255) NOT NULL default ''"); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | // 0.4 -> 0.5 |
| 38 | - $check_sql = 'SELECT COUNT(*) FROM ' . $db->prefix($mydirname . '_language_constants') ; |
|
| 39 | - if (! $db->query($check_sql)) { |
|
| 40 | - $db->queryF('CREATE TABLE ' . $db->prefix($mydirname . '_language_constants') . " (mid smallint(5) unsigned NOT NULL default 0,language varchar(32) NOT NULL default '',name varchar(255) NOT NULL default '',value text,PRIMARY KEY (mid,language,name)) ENGINE=MyISAM") ; |
|
| 38 | + $check_sql = 'SELECT COUNT(*) FROM '.$db->prefix($mydirname.'_language_constants'); |
|
| 39 | + if (!$db->query($check_sql)) { |
|
| 40 | + $db->queryF('CREATE TABLE '.$db->prefix($mydirname.'_language_constants')." (mid smallint(5) unsigned NOT NULL default 0,language varchar(32) NOT NULL default '',name varchar(255) NOT NULL default '',value text,PRIMARY KEY (mid,language,name)) ENGINE=MyISAM"); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | // TEMPLATES (all templates have been already removed by modulesadmin) |
| 45 | - $tplfile_handler = xoops_getHandler('tplfile') ; |
|
| 46 | - $tpl_path = __DIR__.'/templates' ; |
|
| 47 | - if ($handler = @opendir($tpl_path . '/')) { |
|
| 45 | + $tplfile_handler = xoops_getHandler('tplfile'); |
|
| 46 | + $tpl_path = __DIR__.'/templates'; |
|
| 47 | + if ($handler = @opendir($tpl_path.'/')) { |
|
| 48 | 48 | while (($file = readdir($handler)) !== false) { |
| 49 | 49 | if (substr($file, 0, 1) == '.') { |
| 50 | - continue ; |
|
| 50 | + continue; |
|
| 51 | 51 | } |
| 52 | - $file_path = $tpl_path . '/' . $file ; |
|
| 52 | + $file_path = $tpl_path.'/'.$file; |
|
| 53 | 53 | if (is_file($file_path)) { |
| 54 | 54 | $mtime = (int)(@filemtime($file_path)); |
| 55 | - $tplfile = $tplfile_handler->create() ; |
|
| 56 | - $tplfile->setVar('tpl_source', file_get_contents($file_path), true) ; |
|
| 57 | - $tplfile->setVar('tpl_refid', $mid) ; |
|
| 58 | - $tplfile->setVar('tpl_tplset', 'default') ; |
|
| 59 | - $tplfile->setVar('tpl_file', $mydirname . '_' . $file) ; |
|
| 60 | - $tplfile->setVar('tpl_desc', '', true) ; |
|
| 61 | - $tplfile->setVar('tpl_module', $mydirname) ; |
|
| 62 | - $tplfile->setVar('tpl_lastmodified', $mtime) ; |
|
| 63 | - $tplfile->setVar('tpl_lastimported', 0) ; |
|
| 64 | - $tplfile->setVar('tpl_type', 'module') ; |
|
| 65 | - if (! $tplfile_handler->insert($tplfile)) { |
|
| 55 | + $tplfile = $tplfile_handler->create(); |
|
| 56 | + $tplfile->setVar('tpl_source', file_get_contents($file_path), true); |
|
| 57 | + $tplfile->setVar('tpl_refid', $mid); |
|
| 58 | + $tplfile->setVar('tpl_tplset', 'default'); |
|
| 59 | + $tplfile->setVar('tpl_file', $mydirname.'_'.$file); |
|
| 60 | + $tplfile->setVar('tpl_desc', '', true); |
|
| 61 | + $tplfile->setVar('tpl_module', $mydirname); |
|
| 62 | + $tplfile->setVar('tpl_lastmodified', $mtime); |
|
| 63 | + $tplfile->setVar('tpl_lastimported', 0); |
|
| 64 | + $tplfile->setVar('tpl_type', 'module'); |
|
| 65 | + if (!$tplfile_handler->insert($tplfile)) { |
|
| 66 | 66 | $msgs[] = '<span style="color:#ff0000;">ERROR: Could not insert template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> to the database.</span>'; |
| 67 | 67 | } else { |
| 68 | - $tplid = $tplfile->getVar('tpl_id') ; |
|
| 68 | + $tplid = $tplfile->getVar('tpl_id'); |
|
| 69 | 69 | $msgs[] = 'Template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> added to the database. (ID: <b>'.$tplid.'</b>)'; |
| 70 | 70 | // generate compiled file |
| 71 | - require_once XOOPS_TRUST_PATH.'/libs/altsys/include/altsys_functions.php' ; |
|
| 72 | - altsys_clear_templates_c() ; |
|
| 71 | + require_once XOOPS_TRUST_PATH.'/libs/altsys/include/altsys_functions.php'; |
|
| 72 | + altsys_clear_templates_c(); |
|
| 73 | 73 | /*include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; |
| 74 | 74 | if( ! xoops_template_touch( $tplid ) ) { |
| 75 | 75 | $msgs[] = '<span style="color:#ff0000;">ERROR: Failed compiling template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b>.</span>'; |
@@ -79,20 +79,20 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | - closedir($handler) ; |
|
| 82 | + closedir($handler); |
|
| 83 | 83 | } |
| 84 | - include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; |
|
| 85 | - include_once XOOPS_ROOT_PATH.'/class/template.php' ; |
|
| 86 | - xoops_template_clear_module_cache($mid) ; |
|
| 84 | + include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php'; |
|
| 85 | + include_once XOOPS_ROOT_PATH.'/class/template.php'; |
|
| 86 | + xoops_template_clear_module_cache($mid); |
|
| 87 | 87 | |
| 88 | - return true ; |
|
| 88 | + return true; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | function altsys_message_append_onupdate(&$module_obj, &$log) |
| 92 | 92 | { |
| 93 | 93 | if (is_array(@$GLOBALS['msgs'])) { |
| 94 | 94 | foreach ($GLOBALS['msgs'] as $message) { |
| 95 | - $log->add(strip_tags($message)) ; |
|
| 95 | + $log->add(strip_tags($message)); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
@@ -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 | /** |
@@ -144,7 +144,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -1238,7 +1238,7 @@ discard block |
||
| 1238 | 1238 | */ |
| 1239 | 1239 | public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_params) |
| 1240 | 1240 | { |
| 1241 | - $v_result=1; |
|
| 1241 | + $v_result = 1; |
|
| 1242 | 1242 | |
| 1243 | 1243 | if ($p_filename == '') { |
| 1244 | 1244 | // ----- Error log |
@@ -1263,7 +1263,7 @@ discard block |
||
| 1263 | 1263 | |
| 1264 | 1264 | if ((substr($p_filename, 0, 2) == './') || (substr($p_remove_dir, 0, 2) == './')) { |
| 1265 | 1265 | if ((substr($p_filename, 0, 2) == './') && (substr($p_remove_dir, 0, 2) != './')) { |
| 1266 | - $p_remove_dir = './' . $p_remove_dir; |
|
| 1266 | + $p_remove_dir = './'.$p_remove_dir; |
|
| 1267 | 1267 | } |
| 1268 | 1268 | if ((substr($p_filename, 0, 2) != './') && (substr($p_remove_dir, 0, 2) == './')) { |
| 1269 | 1269 | $p_remove_dir = substr($p_remove_dir, 2); |
@@ -1287,7 +1287,7 @@ discard block |
||
| 1287 | 1287 | if (substr($p_add_dir, -1) == '/') { |
| 1288 | 1288 | $v_stored_filename = $p_add_dir.$v_stored_filename; |
| 1289 | 1289 | } else { |
| 1290 | - $v_stored_filename = $p_add_dir . '/' . $v_stored_filename; |
|
| 1290 | + $v_stored_filename = $p_add_dir.'/'.$v_stored_filename; |
|
| 1291 | 1291 | } |
| 1292 | 1292 | } |
| 1293 | 1293 | |
@@ -1322,7 +1322,7 @@ discard block |
||
| 1322 | 1322 | $p_header['comment_len'] = 0; |
| 1323 | 1323 | $p_header['disk'] = 0; |
| 1324 | 1324 | $p_header['internal'] = 0; |
| 1325 | - $p_header['external'] = (is_file($p_filename)?0xFE49FFE0:0x41FF0010); |
|
| 1325 | + $p_header['external'] = (is_file($p_filename) ? 0xFE49FFE0 : 0x41FF0010); |
|
| 1326 | 1326 | $p_header['offset'] = 0; |
| 1327 | 1327 | $p_header['filename'] = $p_filename; |
| 1328 | 1328 | $p_header['stored_filename'] = $v_stored_filename; |
@@ -1418,7 +1418,7 @@ discard block |
||
| 1418 | 1418 | $p_header['filename'] .= '/'; |
| 1419 | 1419 | $p_header['filename_len']++; |
| 1420 | 1420 | $p_header['size'] = 0; |
| 1421 | - $p_header['external'] = 0x41FF0010; // Value for a folder : to be checked |
|
| 1421 | + $p_header['external'] = 0x41FF0010; // Value for a folder : to be checked |
|
| 1422 | 1422 | |
| 1423 | 1423 | // ----- Call the header generation |
| 1424 | 1424 | if (($v_result = $this->_writeFileHeader($p_header)) != 1) { |
@@ -1467,7 +1467,7 @@ discard block |
||
| 1467 | 1467 | */ |
| 1468 | 1468 | public function _writeFileHeader(&$p_header) |
| 1469 | 1469 | { |
| 1470 | - $v_result=1; |
|
| 1470 | + $v_result = 1; |
|
| 1471 | 1471 | |
| 1472 | 1472 | // TBC |
| 1473 | 1473 | //for(reset($p_header); $key = key($p_header); next($p_header)) { |
@@ -1478,8 +1478,8 @@ discard block |
||
| 1478 | 1478 | |
| 1479 | 1479 | // ----- Transform UNIX mtime to DOS format mdate/mtime |
| 1480 | 1480 | $v_date = getdate($p_header['mtime']); |
| 1481 | - $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; |
|
| 1482 | - $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; |
|
| 1481 | + $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2; |
|
| 1482 | + $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday']; |
|
| 1483 | 1483 | |
| 1484 | 1484 | // ----- Packed data |
| 1485 | 1485 | $v_binary_data = pack('VvvvvvVVVvv', 0x04034b50, $p_header['version'], $p_header['flag'], |
@@ -1517,7 +1517,7 @@ discard block |
||
| 1517 | 1517 | */ |
| 1518 | 1518 | public function _writeCentralFileHeader(&$p_header) |
| 1519 | 1519 | { |
| 1520 | - $v_result=1; |
|
| 1520 | + $v_result = 1; |
|
| 1521 | 1521 | |
| 1522 | 1522 | // TBC |
| 1523 | 1523 | //for(reset($p_header); $key = key($p_header); next($p_header)) { |
@@ -1525,8 +1525,8 @@ discard block |
||
| 1525 | 1525 | |
| 1526 | 1526 | // ----- Transform UNIX mtime to DOS format mdate/mtime |
| 1527 | 1527 | $v_date = getdate($p_header['mtime']); |
| 1528 | - $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; |
|
| 1529 | - $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; |
|
| 1528 | + $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2; |
|
| 1529 | + $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday']; |
|
| 1530 | 1530 | |
| 1531 | 1531 | // ----- Packed data |
| 1532 | 1532 | $v_binary_data = pack('VvvvvvvVVVvvvvvVV', 0x02014b50, $p_header['version'], $p_header['version_extracted'], |
@@ -1568,7 +1568,7 @@ discard block |
||
| 1568 | 1568 | */ |
| 1569 | 1569 | public function _writeCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment) |
| 1570 | 1570 | { |
| 1571 | - $v_result=1; |
|
| 1571 | + $v_result = 1; |
|
| 1572 | 1572 | |
| 1573 | 1573 | // ----- Packed data |
| 1574 | 1574 | $v_binary_data = pack('VvvvvVVv', 0x06054b50, 0, 0, $p_nb_entries, $p_nb_entries, $p_size, $p_offset, strlen($p_comment)); |
@@ -1600,7 +1600,7 @@ discard block |
||
| 1600 | 1600 | */ |
| 1601 | 1601 | public function _list(&$p_list) |
| 1602 | 1602 | { |
| 1603 | - $v_result=1; |
|
| 1603 | + $v_result = 1; |
|
| 1604 | 1604 | |
| 1605 | 1605 | // ----- Open the zip file |
| 1606 | 1606 | if (($this->_zip_fd = @fopen($this->_zipname, 'rb')) == 0) { |
@@ -1628,7 +1628,7 @@ discard block |
||
| 1628 | 1628 | } |
| 1629 | 1629 | |
| 1630 | 1630 | // ----- Read each entry |
| 1631 | - for ($i=0; $i<$v_central_dir['entries']; $i++) { |
|
| 1631 | + for ($i = 0; $i < $v_central_dir['entries']; $i++) { |
|
| 1632 | 1632 | // ----- Read the file header |
| 1633 | 1633 | if (($v_result = $this->_readCentralFileHeader($v_header)) != 1) { |
| 1634 | 1634 | return $v_result; |
@@ -1674,7 +1674,7 @@ discard block |
||
| 1674 | 1674 | */ |
| 1675 | 1675 | public function _convertHeader2FileInfo($p_header, &$p_info) |
| 1676 | 1676 | { |
| 1677 | - $v_result=1; |
|
| 1677 | + $v_result = 1; |
|
| 1678 | 1678 | |
| 1679 | 1679 | // ----- Get the interesting attributes |
| 1680 | 1680 | $p_info['filename'] = $p_header['filename']; |
@@ -1683,7 +1683,7 @@ discard block |
||
| 1683 | 1683 | $p_info['compressed_size'] = $p_header['compressed_size']; |
| 1684 | 1684 | $p_info['mtime'] = $p_header['mtime']; |
| 1685 | 1685 | $p_info['comment'] = $p_header['comment']; |
| 1686 | - $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010); |
|
| 1686 | + $p_info['folder'] = (($p_header['external'] & 0x00000010) == 0x00000010); |
|
| 1687 | 1687 | $p_info['index'] = $p_header['index']; |
| 1688 | 1688 | $p_info['status'] = $p_header['status']; |
| 1689 | 1689 | |
@@ -1716,7 +1716,7 @@ discard block |
||
| 1716 | 1716 | */ |
| 1717 | 1717 | public function _extractByRule(&$p_file_list, &$p_params) |
| 1718 | 1718 | { |
| 1719 | - $v_result=1; |
|
| 1719 | + $v_result = 1; |
|
| 1720 | 1720 | |
| 1721 | 1721 | $p_path = $p_params['add_path']; |
| 1722 | 1722 | $p_remove_path = $p_params['remove_path']; |
@@ -1726,14 +1726,14 @@ discard block |
||
| 1726 | 1726 | if (($p_path == '') |
| 1727 | 1727 | || ((substr($p_path, 0, 1) != '/') |
| 1728 | 1728 | && (substr($p_path, 0, 3) != '../') && (substr($p_path, 1, 2) != ':/'))) { |
| 1729 | - $p_path = './' . $p_path; |
|
| 1729 | + $p_path = './'.$p_path; |
|
| 1730 | 1730 | } |
| 1731 | 1731 | |
| 1732 | 1732 | // ----- Reduce the path last (and duplicated) '/' |
| 1733 | 1733 | if (($p_path != './') && ($p_path != '/')) { |
| 1734 | 1734 | // ----- Look for the path end '/' |
| 1735 | 1735 | while (substr($p_path, -1) == '/') { |
| 1736 | - $p_path = substr($p_path, 0, strlen($p_path)-1); |
|
| 1736 | + $p_path = substr($p_path, 0, strlen($p_path) - 1); |
|
| 1737 | 1737 | } |
| 1738 | 1738 | } |
| 1739 | 1739 | |
@@ -1762,7 +1762,7 @@ discard block |
||
| 1762 | 1762 | |
| 1763 | 1763 | // ----- Read each entry |
| 1764 | 1764 | $j_start = 0; |
| 1765 | - for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) { |
|
| 1765 | + for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++) { |
|
| 1766 | 1766 | // ----- Read next Central dir entry |
| 1767 | 1767 | @rewind($this->_zip_fd); |
| 1768 | 1768 | if (@fseek($this->_zip_fd, $v_pos_entry)) { |
@@ -1796,7 +1796,7 @@ discard block |
||
| 1796 | 1796 | && ($p_params[ARCHIVE_ZIP_PARAM_BY_NAME] != 0)) { |
| 1797 | 1797 | |
| 1798 | 1798 | // ----- Look if the filename is in the list |
| 1799 | - for ($j=0; |
|
| 1799 | + for ($j = 0; |
|
| 1800 | 1800 | ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_NAME])) |
| 1801 | 1801 | && (!$v_extract); |
| 1802 | 1802 | $j++) { |
@@ -1838,15 +1838,15 @@ discard block |
||
| 1838 | 1838 | && ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX] != 0)) { |
| 1839 | 1839 | |
| 1840 | 1840 | // ----- Look if the index is in the list |
| 1841 | - for ($j=$j_start; ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) && (!$v_extract); $j++) { |
|
| 1842 | - if (($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']) && ($i<=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) { |
|
| 1841 | + for ($j = $j_start; ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) && (!$v_extract); $j++) { |
|
| 1842 | + if (($i >= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']) && ($i <= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) { |
|
| 1843 | 1843 | $v_extract = true; |
| 1844 | 1844 | } |
| 1845 | - if ($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) { |
|
| 1846 | - $j_start = $j+1; |
|
| 1845 | + if ($i >= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) { |
|
| 1846 | + $j_start = $j + 1; |
|
| 1847 | 1847 | } |
| 1848 | 1848 | |
| 1849 | - if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']>$i) { |
|
| 1849 | + if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start'] > $i) { |
|
| 1850 | 1850 | break; |
| 1851 | 1851 | } |
| 1852 | 1852 | } |
@@ -1940,7 +1940,7 @@ discard block |
||
| 1940 | 1940 | */ |
| 1941 | 1941 | public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_params) |
| 1942 | 1942 | { |
| 1943 | - $v_result=1; |
|
| 1943 | + $v_result = 1; |
|
| 1944 | 1944 | |
| 1945 | 1945 | // ----- Read the file header |
| 1946 | 1946 | if (($v_result = $this->_readFileHeader($v_header)) != 1) { |
@@ -1980,7 +1980,7 @@ discard block |
||
| 1980 | 1980 | |
| 1981 | 1981 | // ----- Add the path |
| 1982 | 1982 | if ($p_path != '') { |
| 1983 | - $p_entry['filename'] = $p_path . '/' . $p_entry['filename']; |
|
| 1983 | + $p_entry['filename'] = $p_path.'/'.$p_entry['filename']; |
|
| 1984 | 1984 | } |
| 1985 | 1985 | |
| 1986 | 1986 | // ----- Look for pre-extract callback |
@@ -2046,7 +2046,7 @@ discard block |
||
| 2046 | 2046 | |
| 2047 | 2047 | // ----- Check the directory availability and create it if necessary |
| 2048 | 2048 | else { |
| 2049 | - if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/')) { |
|
| 2049 | + if ((($p_entry['external'] & 0x00000010) == 0x00000010) || (substr($p_entry['filename'], -1) == '/')) { |
|
| 2050 | 2050 | $v_dir_to_check = $p_entry['filename']; |
| 2051 | 2051 | } elseif (!strstr($p_entry['filename'], '/')) { |
| 2052 | 2052 | $v_dir_to_check = ''; |
@@ -2070,7 +2070,7 @@ discard block |
||
| 2070 | 2070 | if ($p_entry['status'] == 'ok') { |
| 2071 | 2071 | |
| 2072 | 2072 | // ----- Do the extraction (if not a folder) |
| 2073 | - if (!(($p_entry['external']&0x00000010)==0x00000010)) { |
|
| 2073 | + if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) { |
|
| 2074 | 2074 | |
| 2075 | 2075 | // ----- Look for not compressed file |
| 2076 | 2076 | if ($p_entry['compressed_size'] == $p_entry['size']) { |
@@ -2175,7 +2175,7 @@ discard block |
||
| 2175 | 2175 | */ |
| 2176 | 2176 | public function _extractFileAsString(&$p_entry, &$p_string) |
| 2177 | 2177 | { |
| 2178 | - $v_result=1; |
|
| 2178 | + $v_result = 1; |
|
| 2179 | 2179 | |
| 2180 | 2180 | // ----- Read the file header |
| 2181 | 2181 | $v_header = array(); |
@@ -2191,7 +2191,7 @@ discard block |
||
| 2191 | 2191 | // ----- Trace |
| 2192 | 2192 | |
| 2193 | 2193 | // ----- Do the extraction (if not a folder) |
| 2194 | - if (!(($p_entry['external']&0x00000010)==0x00000010)) { |
|
| 2194 | + if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) { |
|
| 2195 | 2195 | // ----- Look for not compressed file |
| 2196 | 2196 | if ($p_entry['compressed_size'] == $p_entry['size']) { |
| 2197 | 2197 | // ----- Trace |
@@ -2232,7 +2232,7 @@ discard block |
||
| 2232 | 2232 | */ |
| 2233 | 2233 | public function _readFileHeader(&$p_header) |
| 2234 | 2234 | { |
| 2235 | - $v_result=1; |
|
| 2235 | + $v_result = 1; |
|
| 2236 | 2236 | |
| 2237 | 2237 | // ----- Read the 4 bytes signature |
| 2238 | 2238 | $v_binary_data = @fread($this->_zip_fd, 4); |
@@ -2257,7 +2257,7 @@ discard block |
||
| 2257 | 2257 | $p_header['status'] = 'invalid_header'; |
| 2258 | 2258 | |
| 2259 | 2259 | // ----- Error log |
| 2260 | - $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : ' . strlen($v_binary_data)); |
|
| 2260 | + $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : '.strlen($v_binary_data)); |
|
| 2261 | 2261 | |
| 2262 | 2262 | // ----- Return |
| 2263 | 2263 | return Archive_Zip::errorCode(); |
@@ -2290,7 +2290,7 @@ discard block |
||
| 2290 | 2290 | // ----- Extract time |
| 2291 | 2291 | $v_hour = ($p_header['mtime'] & 0xF800) >> 11; |
| 2292 | 2292 | $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; |
| 2293 | - $v_seconde = ($p_header['mtime'] & 0x001F)*2; |
|
| 2293 | + $v_seconde = ($p_header['mtime'] & 0x001F) * 2; |
|
| 2294 | 2294 | |
| 2295 | 2295 | // ----- Extract date |
| 2296 | 2296 | $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; |
@@ -2334,7 +2334,7 @@ discard block |
||
| 2334 | 2334 | */ |
| 2335 | 2335 | public function _readCentralFileHeader(&$p_header) |
| 2336 | 2336 | { |
| 2337 | - $v_result=1; |
|
| 2337 | + $v_result = 1; |
|
| 2338 | 2338 | |
| 2339 | 2339 | // ----- Read the 4 bytes signature |
| 2340 | 2340 | $v_binary_data = @fread($this->_zip_fd, 4); |
@@ -2359,7 +2359,7 @@ discard block |
||
| 2359 | 2359 | $p_header['status'] = 'invalid_header'; |
| 2360 | 2360 | |
| 2361 | 2361 | // ----- Error log |
| 2362 | - $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : ' . strlen($v_binary_data)); |
|
| 2362 | + $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : '.strlen($v_binary_data)); |
|
| 2363 | 2363 | |
| 2364 | 2364 | // ----- Return |
| 2365 | 2365 | return Archive_Zip::errorCode(); |
@@ -2396,7 +2396,7 @@ discard block |
||
| 2396 | 2396 | // ----- Extract time |
| 2397 | 2397 | $v_hour = ($p_header['mtime'] & 0xF800) >> 11; |
| 2398 | 2398 | $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; |
| 2399 | - $v_seconde = ($p_header['mtime'] & 0x001F)*2; |
|
| 2399 | + $v_seconde = ($p_header['mtime'] & 0x001F) * 2; |
|
| 2400 | 2400 | |
| 2401 | 2401 | // ----- Extract date |
| 2402 | 2402 | $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; |
@@ -2440,7 +2440,7 @@ discard block |
||
| 2440 | 2440 | */ |
| 2441 | 2441 | public function _readEndCentralDir(&$p_central_dir) |
| 2442 | 2442 | { |
| 2443 | - $v_result=1; |
|
| 2443 | + $v_result = 1; |
|
| 2444 | 2444 | |
| 2445 | 2445 | // ----- Go to the end of the zip file |
| 2446 | 2446 | $v_size = filesize($this->_zipname); |
@@ -2457,8 +2457,8 @@ discard block |
||
| 2457 | 2457 | // in this case the end of central dir is at 22 bytes of the file end |
| 2458 | 2458 | $v_found = 0; |
| 2459 | 2459 | if ($v_size > 26) { |
| 2460 | - @fseek($this->_zip_fd, $v_size-22); |
|
| 2461 | - if (($v_pos = @ftell($this->_zip_fd)) != ($v_size-22)) { |
|
| 2460 | + @fseek($this->_zip_fd, $v_size - 22); |
|
| 2461 | + if (($v_pos = @ftell($this->_zip_fd)) != ($v_size - 22)) { |
|
| 2462 | 2462 | $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, |
| 2463 | 2463 | 'Unable to seek back to the middle of the archive \'' |
| 2464 | 2464 | .$this->_zipname.'\''); |
@@ -2483,8 +2483,8 @@ discard block |
||
| 2483 | 2483 | if ($v_maximum_size > $v_size) { |
| 2484 | 2484 | $v_maximum_size = $v_size; |
| 2485 | 2485 | } |
| 2486 | - @fseek($this->_zip_fd, $v_size-$v_maximum_size); |
|
| 2487 | - if (@ftell($this->_zip_fd) != ($v_size-$v_maximum_size)) { |
|
| 2486 | + @fseek($this->_zip_fd, $v_size - $v_maximum_size); |
|
| 2487 | + if (@ftell($this->_zip_fd) != ($v_size - $v_maximum_size)) { |
|
| 2488 | 2488 | $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, |
| 2489 | 2489 | 'Unable to seek back to the middle of the archive \'' |
| 2490 | 2490 | .$this->_zipname.'\''); |
@@ -2570,11 +2570,11 @@ discard block |
||
| 2570 | 2570 | */ |
| 2571 | 2571 | public function _deleteByRule(&$p_result_list, &$p_params) |
| 2572 | 2572 | { |
| 2573 | - $v_result=1; |
|
| 2573 | + $v_result = 1; |
|
| 2574 | 2574 | $v_list_detail = array(); |
| 2575 | 2575 | |
| 2576 | 2576 | // ----- Open the zip file |
| 2577 | - if (($v_result=$this->_openFd('rb')) != 1) { |
|
| 2577 | + if (($v_result = $this->_openFd('rb')) != 1) { |
|
| 2578 | 2578 | // ----- Return |
| 2579 | 2579 | return $v_result; |
| 2580 | 2580 | } |
@@ -2605,7 +2605,7 @@ discard block |
||
| 2605 | 2605 | // ----- Read each entry |
| 2606 | 2606 | $v_header_list = array(); |
| 2607 | 2607 | $j_start = 0; |
| 2608 | - for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) { |
|
| 2608 | + for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++) { |
|
| 2609 | 2609 | |
| 2610 | 2610 | // ----- Read the file header |
| 2611 | 2611 | $v_header_list[$v_nb_extracted] = array(); |
@@ -2629,7 +2629,7 @@ discard block |
||
| 2629 | 2629 | && ($p_params[ARCHIVE_ZIP_PARAM_BY_NAME] != 0)) { |
| 2630 | 2630 | |
| 2631 | 2631 | // ----- Look if the filename is in the list |
| 2632 | - for ($j=0; |
|
| 2632 | + for ($j = 0; |
|
| 2633 | 2633 | ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_NAME])) |
| 2634 | 2634 | && (!$v_found); |
| 2635 | 2635 | $j++) { |
@@ -2641,7 +2641,7 @@ discard block |
||
| 2641 | 2641 | if ((strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) |
| 2642 | 2642 | && (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])) { |
| 2643 | 2643 | $v_found = true; |
| 2644 | - } elseif ((($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */ |
|
| 2644 | + } elseif ((($v_header_list[$v_nb_extracted]['external'] & 0x00000010) == 0x00000010) /* Indicates a folder */ |
|
| 2645 | 2645 | && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) { |
| 2646 | 2646 | $v_found = true; |
| 2647 | 2647 | } |
@@ -2677,19 +2677,19 @@ discard block |
||
| 2677 | 2677 | && ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX] != 0)) { |
| 2678 | 2678 | |
| 2679 | 2679 | // ----- Look if the index is in the list |
| 2680 | - for ($j=$j_start; |
|
| 2680 | + for ($j = $j_start; |
|
| 2681 | 2681 | ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) |
| 2682 | 2682 | && (!$v_found); |
| 2683 | 2683 | $j++) { |
| 2684 | - if (($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']) |
|
| 2685 | - && ($i<=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) { |
|
| 2684 | + if (($i >= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']) |
|
| 2685 | + && ($i <= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) { |
|
| 2686 | 2686 | $v_found = true; |
| 2687 | 2687 | } |
| 2688 | - if ($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) { |
|
| 2689 | - $j_start = $j+1; |
|
| 2688 | + if ($i >= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) { |
|
| 2689 | + $j_start = $j + 1; |
|
| 2690 | 2690 | } |
| 2691 | 2691 | |
| 2692 | - if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']>$i) { |
|
| 2692 | + if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start'] > $i) { |
|
| 2693 | 2693 | break; |
| 2694 | 2694 | } |
| 2695 | 2695 | } |
@@ -2722,7 +2722,7 @@ discard block |
||
| 2722 | 2722 | } |
| 2723 | 2723 | |
| 2724 | 2724 | // ----- Look which file need to be kept |
| 2725 | - for ($i=0; $i < count($v_header_list); $i++) { |
|
| 2725 | + for ($i = 0; $i < count($v_header_list); $i++) { |
|
| 2726 | 2726 | |
| 2727 | 2727 | // ----- Calculate the position of the header |
| 2728 | 2728 | @rewind($this->_zip_fd); |
@@ -2776,9 +2776,9 @@ discard block |
||
| 2776 | 2776 | $v_offset = @ftell($v_temp_zip->_zip_fd); |
| 2777 | 2777 | |
| 2778 | 2778 | // ----- Re-Create the Central Dir files header |
| 2779 | - for ($i=0; $i < count($v_header_list); $i++) { |
|
| 2779 | + for ($i = 0; $i < count($v_header_list); $i++) { |
|
| 2780 | 2780 | // ----- Create the file header |
| 2781 | - $v_result=$v_temp_zip->_writeCentralFileHeader($v_header_list[$i]); |
|
| 2781 | + $v_result = $v_temp_zip->_writeCentralFileHeader($v_header_list[$i]); |
|
| 2782 | 2782 | if ($v_result != 1) { |
| 2783 | 2783 | // ----- Clean |
| 2784 | 2784 | $v_temp_zip->_closeFd(); |
@@ -2798,7 +2798,7 @@ discard block |
||
| 2798 | 2798 | $v_comment = ''; |
| 2799 | 2799 | |
| 2800 | 2800 | // ----- Calculate the size of the central header |
| 2801 | - $v_size = @ftell($v_temp_zip->_zip_fd)-$v_offset; |
|
| 2801 | + $v_size = @ftell($v_temp_zip->_zip_fd) - $v_offset; |
|
| 2802 | 2802 | |
| 2803 | 2803 | // ----- Create the central dir footer |
| 2804 | 2804 | $v_result = $v_temp_zip->_writeCentralHeader(count($v_header_list), |
@@ -2854,13 +2854,13 @@ discard block |
||
| 2854 | 2854 | * |
| 2855 | 2855 | * @param [type] $p_is_dir |
| 2856 | 2856 | */ |
| 2857 | - public function _dirCheck($p_dir, $p_is_dir=false) |
|
| 2857 | + public function _dirCheck($p_dir, $p_is_dir = false) |
|
| 2858 | 2858 | { |
| 2859 | 2859 | $v_result = 1; |
| 2860 | 2860 | |
| 2861 | 2861 | // ----- Remove the final '/' |
| 2862 | 2862 | if ($p_is_dir && (substr($p_dir, -1) == '/')) { |
| 2863 | - $p_dir = substr($p_dir, 0, strlen($p_dir)-1); |
|
| 2863 | + $p_dir = substr($p_dir, 0, strlen($p_dir) - 1); |
|
| 2864 | 2864 | } |
| 2865 | 2865 | |
| 2866 | 2866 | // ----- Check the directory availability |
@@ -2908,7 +2908,7 @@ discard block |
||
| 2908 | 2908 | */ |
| 2909 | 2909 | public function _merge(&$p_archive_to_add) |
| 2910 | 2910 | { |
| 2911 | - $v_result=1; |
|
| 2911 | + $v_result = 1; |
|
| 2912 | 2912 | |
| 2913 | 2913 | // ----- Look if the archive_to_add exists |
| 2914 | 2914 | if (!is_file($p_archive_to_add->_zipname)) { |
@@ -2925,7 +2925,7 @@ discard block |
||
| 2925 | 2925 | } |
| 2926 | 2926 | |
| 2927 | 2927 | // ----- Open the zip file |
| 2928 | - if (($v_result=$this->_openFd('rb')) != 1) { |
|
| 2928 | + if (($v_result = $this->_openFd('rb')) != 1) { |
|
| 2929 | 2929 | return $v_result; |
| 2930 | 2930 | } |
| 2931 | 2931 | |
@@ -2940,7 +2940,7 @@ discard block |
||
| 2940 | 2940 | @rewind($this->_zip_fd); |
| 2941 | 2941 | |
| 2942 | 2942 | // ----- Open the archive_to_add file |
| 2943 | - if (($v_result=$p_archive_to_add->_openFd('rb')) != 1) { |
|
| 2943 | + if (($v_result = $p_archive_to_add->_openFd('rb')) != 1) { |
|
| 2944 | 2944 | $this->_closeFd(); |
| 2945 | 2945 | return $v_result; |
| 2946 | 2946 | } |
@@ -3020,7 +3020,7 @@ discard block |
||
| 3020 | 3020 | $v_comment = ''; |
| 3021 | 3021 | |
| 3022 | 3022 | // ----- Calculate the size of the (new) central header |
| 3023 | - $v_size = @ftell($v_zip_temp_fd)-$v_offset; |
|
| 3023 | + $v_size = @ftell($v_zip_temp_fd) - $v_offset; |
|
| 3024 | 3024 | |
| 3025 | 3025 | // ----- Swap the file descriptor |
| 3026 | 3026 | // Here is a trick : I swap the temporary fd with the zip fd, in order to use |
@@ -3086,7 +3086,7 @@ discard block |
||
| 3086 | 3086 | */ |
| 3087 | 3087 | public function _duplicate($p_archive_filename) |
| 3088 | 3088 | { |
| 3089 | - $v_result=1; |
|
| 3089 | + $v_result = 1; |
|
| 3090 | 3090 | |
| 3091 | 3091 | // ----- Look if the $p_archive_filename exists |
| 3092 | 3092 | if (!is_file($p_archive_filename)) { |
@@ -3099,7 +3099,7 @@ discard block |
||
| 3099 | 3099 | } |
| 3100 | 3100 | |
| 3101 | 3101 | // ----- Open the zip file |
| 3102 | - if (($v_result=$this->_openFd('wb')) != 1) { |
|
| 3102 | + if (($v_result = $this->_openFd('wb')) != 1) { |
|
| 3103 | 3103 | // ----- Return |
| 3104 | 3104 | return $v_result; |
| 3105 | 3105 | } |
@@ -3173,8 +3173,8 @@ discard block |
||
| 3173 | 3173 | // ----- Check specific parameters |
| 3174 | 3174 | $v_callback_list = array('callback_pre_add', 'callback_post_add', |
| 3175 | 3175 | 'callback_pre_extract', 'callback_post_extract'); |
| 3176 | - for ($i=0; $i < count($v_callback_list); $i++) { |
|
| 3177 | - $v_key=$v_callback_list[$i]; |
|
| 3176 | + for ($i = 0; $i < count($v_callback_list); $i++) { |
|
| 3177 | + $v_key = $v_callback_list[$i]; |
|
| 3178 | 3178 | if (isset($p_params[$v_key]) && ($p_params[$v_key] != '')) { |
| 3179 | 3179 | if (!function_exists($p_params[$v_key])) { |
| 3180 | 3180 | $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAM_VALUE, |
@@ -3203,7 +3203,7 @@ discard block |
||
| 3203 | 3203 | * @param integer $p_error_code |
| 3204 | 3204 | * @param string $p_error_string |
| 3205 | 3205 | */ |
| 3206 | - public function _errorLog($p_error_code=0, $p_error_string='') |
|
| 3206 | + public function _errorLog($p_error_code = 0, $p_error_string = '') |
|
| 3207 | 3207 | { |
| 3208 | 3208 | $this->_error_code = $p_error_code; |
| 3209 | 3209 | $this->_error_string = $p_error_string; |
@@ -3250,7 +3250,7 @@ discard block |
||
| 3250 | 3250 | $v_list = explode('/', $p_dir); |
| 3251 | 3251 | |
| 3252 | 3252 | // ----- Study directories from last to first |
| 3253 | - for ($i= count($v_list) - 1; $i >= 0; $i--) { |
|
| 3253 | + for ($i = count($v_list) - 1; $i >= 0; $i--) { |
|
| 3254 | 3254 | // ----- Look for current path |
| 3255 | 3255 | if ($v_list[$i] == '.') { |
| 3256 | 3256 | // ----- Ignore this directory |
@@ -3262,7 +3262,7 @@ discard block |
||
| 3262 | 3262 | // ----- Ignore only the double '//' in path, |
| 3263 | 3263 | // but not the first and last '/' |
| 3264 | 3264 | } else { |
| 3265 | - $v_result = $v_list[$i].($i!=(count($v_list) - 1)? '/' . $v_result: ''); |
|
| 3265 | + $v_result = $v_list[$i].($i != (count($v_list) - 1) ? '/'.$v_result : ''); |
|
| 3266 | 3266 | } |
| 3267 | 3267 | } |
| 3268 | 3268 | } |
@@ -3372,11 +3372,11 @@ discard block |
||
| 3372 | 3372 | * |
| 3373 | 3373 | * @param integer $p_mode |
| 3374 | 3374 | */ |
| 3375 | - public function _tool_CopyBlock($p_src, $p_dest, $p_size, $p_mode=0) |
|
| 3375 | + public function _tool_CopyBlock($p_src, $p_dest, $p_size, $p_mode = 0) |
|
| 3376 | 3376 | { |
| 3377 | 3377 | $v_result = 1; |
| 3378 | 3378 | |
| 3379 | - if ($p_mode==0) { |
|
| 3379 | + if ($p_mode == 0) { |
|
| 3380 | 3380 | while ($p_size != 0) { |
| 3381 | 3381 | $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE |
| 3382 | 3382 | ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE); |
@@ -3384,7 +3384,7 @@ discard block |
||
| 3384 | 3384 | @fwrite($p_dest, $v_buffer, $v_read_size); |
| 3385 | 3385 | $p_size -= $v_read_size; |
| 3386 | 3386 | } |
| 3387 | - } elseif ($p_mode==1) { |
|
| 3387 | + } elseif ($p_mode == 1) { |
|
| 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==2) { |
|
| 3395 | + } elseif ($p_mode == 2) { |
|
| 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 | @gzwrite($p_dest, $v_buffer, $v_read_size); |
| 3401 | 3401 | $p_size -= $v_read_size; |
| 3402 | 3402 | } |
| 3403 | - } elseif ($p_mode==3) { |
|
| 3403 | + } elseif ($p_mode == 3) { |
|
| 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); |
@@ -3471,13 +3471,13 @@ discard block |
||
| 3471 | 3471 | * |
| 3472 | 3472 | * @param [type] $p_remove_disk_letter |
| 3473 | 3473 | */ |
| 3474 | - public function _tool_TranslateWinPath($p_path, $p_remove_disk_letter=true) |
|
| 3474 | + public function _tool_TranslateWinPath($p_path, $p_remove_disk_letter = true) |
|
| 3475 | 3475 | { |
| 3476 | 3476 | if (stristr(php_uname(), 'windows')) { |
| 3477 | 3477 | // ----- Look for potential disk letter |
| 3478 | 3478 | if ($p_remove_disk_letter |
| 3479 | 3479 | && (($v_position = strpos($p_path, ':')) != false)) { |
| 3480 | - $p_path = substr($p_path, $v_position+1); |
|
| 3480 | + $p_path = substr($p_path, $v_position + 1); |
|
| 3481 | 3481 | } |
| 3482 | 3482 | // ----- Change potential windows directory separator |
| 3483 | 3483 | if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0, 1) == '\\')) { |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (! defined('XOOPS_ROOT_PATH')) { |
|
| 4 | - exit ; |
|
| 3 | +if (!defined('XOOPS_ROOT_PATH')) { |
|
| 4 | + exit; |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | function myDeleteByModule($DB, $gperm_modid, $gperm_name = null, $gperm_itemid = null) |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | $criteria->add(new Criteria('gperm_itemid', (int)$gperm_itemid)); |
| 14 | 14 | } |
| 15 | 15 | } |
| 16 | - $sql = 'DELETE FROM ' . $DB->prefix('group_permission') . ' ' . $criteria->renderWhere(); |
|
| 16 | + $sql = 'DELETE FROM '.$DB->prefix('group_permission').' '.$criteria->renderWhere(); |
|
| 17 | 17 | if (!$result = $DB->query($sql)) { |
| 18 | 18 | return false; |
| 19 | 19 | } |
@@ -27,27 +27,27 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | if ($modid == 1) { |
| 29 | 29 | // check by the permission of eather 'altsys' or 'system' |
| 30 | - $module_handler = xoops_getHandler('module') ; |
|
| 31 | - $module = $module_handler->getByDirname('altsys') ; |
|
| 32 | - if (! is_object($module)) { |
|
| 33 | - $module = $module_handler->getByDirname('system') ; |
|
| 34 | - if (! is_object($module)) { |
|
| 35 | - die('there is no altsys nor system.') ; |
|
| 30 | + $module_handler = xoops_getHandler('module'); |
|
| 31 | + $module = $module_handler->getByDirname('altsys'); |
|
| 32 | + if (!is_object($module)) { |
|
| 33 | + $module = $module_handler->getByDirname('system'); |
|
| 34 | + if (!is_object($module)) { |
|
| 35 | + die('there is no altsys nor system.'); |
|
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | - $moduleperm_handler = xoops_getHandler('groupperm') ; |
|
| 39 | - if (! is_object(@$GLOBALS['xoopsUser']) || ! $moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $GLOBALS['xoopsUser']->getGroups())) { |
|
| 40 | - die('only admin of altsys can access this area') ; |
|
| 38 | + $moduleperm_handler = xoops_getHandler('groupperm'); |
|
| 39 | + if (!is_object(@$GLOBALS['xoopsUser']) || !$moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $GLOBALS['xoopsUser']->getGroups())) { |
|
| 40 | + die('only admin of altsys can access this area'); |
|
| 41 | 41 | } |
| 42 | 42 | } else { |
| 43 | 43 | // check the permission of 'module_admin' of the module |
| 44 | 44 | if ($modid <= 0 || !is_object($GLOBALS['xoopsUser']) || !$GLOBALS['xoopsUser']->isAdmin($modid)) { |
| 45 | - die(_NOPERM) ; |
|
| 45 | + die(_NOPERM); |
|
| 46 | 46 | } |
| 47 | 47 | $module_handler = xoops_getHandler('module'); |
| 48 | 48 | $module = $module_handler->get($modid); |
| 49 | 49 | if (!is_object($module) || !$module->getVar('isactive')) { |
| 50 | - die(_MODULENOEXIST) ; |
|
| 50 | + die(_MODULENOEXIST); |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
@@ -56,18 +56,18 @@ discard block |
||
| 56 | 56 | if (!empty($_POST['perms']) && is_array($_POST['perms'])) { |
| 57 | 57 | $gperm_handler = xoops_getHandler('groupperm'); |
| 58 | 58 | foreach ($_POST['perms'] as $perm_name => $perm_data) { |
| 59 | - foreach ($perm_data['itemname' ] as $item_id => $item_name) { |
|
| 59 | + foreach ($perm_data['itemname'] as $item_id => $item_name) { |
|
| 60 | 60 | // checking code |
| 61 | 61 | // echo "<pre>" ; |
| 62 | 62 | // var_dump( $_POST['perms'] ) ; |
| 63 | 63 | // exit ; |
| 64 | 64 | if (false != myDeleteByModule($gperm_handler->db, $modid, $perm_name, $item_id)) { |
| 65 | 65 | if (empty($perm_data['groups'])) { |
| 66 | - continue ; |
|
| 66 | + continue; |
|
| 67 | 67 | } |
| 68 | 68 | foreach ($perm_data['groups'] as $group_id => $item_ids) { |
| 69 | 69 | // foreach ($item_ids as $item_id => $selected) { |
| 70 | - $selected = isset($item_ids[ $item_id ]) ? $item_ids[ $item_id ] : 0 ; |
|
| 70 | + $selected = isset($item_ids[$item_id]) ? $item_ids[$item_id] : 0; |
|
| 71 | 71 | if ($selected == 1) { |
| 72 | 72 | // make sure that all parent ids are selected as well |
| 73 | 73 | if ($perm_data['parents'][$item_id] != '') { |
@@ -2,91 +2,91 @@ |
||
| 2 | 2 | |
| 3 | 3 | function altsys_mylangadmin_get_constant_names($langfile_unique_path, $mydirname) |
| 4 | 4 | { |
| 5 | - $constpref = '' ; |
|
| 6 | - $langfile_names = array() ; |
|
| 7 | - $reqonce_ret = 0 ; |
|
| 8 | - $already_read = false ; |
|
| 9 | - $langfile_fingerprint = '_MYLANGADMIN_'.md5($langfile_unique_path) ; |
|
| 5 | + $constpref = ''; |
|
| 6 | + $langfile_names = array(); |
|
| 7 | + $reqonce_ret = 0; |
|
| 8 | + $already_read = false; |
|
| 9 | + $langfile_fingerprint = '_MYLANGADMIN_'.md5($langfile_unique_path); |
|
| 10 | 10 | |
| 11 | 11 | // for debug |
| 12 | 12 | //require_once XOOPS_TRUST_PATH.'/modules/pico/language/japanese/modinfo.php' ; |
| 13 | 13 | |
| 14 | 14 | // get constant_names by "require" |
| 15 | - if (! defined($langfile_fingerprint)) { |
|
| 16 | - $system_constants = array_keys(get_defined_constants()) ; |
|
| 15 | + if (!defined($langfile_fingerprint)) { |
|
| 16 | + $system_constants = array_keys(get_defined_constants()); |
|
| 17 | 17 | $reqonce_ret = require_once $langfile_unique_path; |
| 18 | - $langfile_names = array_diff(array_keys(get_defined_constants()), $system_constants) ; |
|
| 18 | + $langfile_names = array_diff(array_keys(get_defined_constants()), $system_constants); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | // We have to parse the file if it has been already included ... |
| 22 | 22 | if (empty($langfile_names) && ($reqonce_ret === true || defined($langfile_fingerprint))) { |
| 23 | - $already_read = true ; |
|
| 24 | - $langfile_names = altsys_mylangadmin_get_constant_names_by_pcre($langfile_unique_path) ; |
|
| 23 | + $already_read = true; |
|
| 24 | + $langfile_names = altsys_mylangadmin_get_constant_names_by_pcre($langfile_unique_path); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | // modinfo.php of D3 module |
| 28 | 28 | if (empty($langfile_names) && file_exists(XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/mytrustdirname.php') /* && substr( $langfile_unique_path , -11 ) == 'modinfo.php' */) { |
| 29 | 29 | // get $constpref |
| 30 | - $constpref = '' ; |
|
| 31 | - require $langfile_unique_path ; |
|
| 32 | - $langfile_names = array() ; |
|
| 30 | + $constpref = ''; |
|
| 31 | + require $langfile_unique_path; |
|
| 32 | + $langfile_names = array(); |
|
| 33 | 33 | if ($constpref) { |
| 34 | 34 | foreach (array_keys(get_defined_constants()) as $name) { |
| 35 | 35 | if (strncmp($name, $constpref, strlen($constpref)) == 0) { |
| 36 | - $langfile_names[] = $name ; |
|
| 36 | + $langfile_names[] = $name; |
|
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |
| 43 | - return array( $langfile_names , $constpref , $already_read ) ; |
|
| 43 | + return array($langfile_names, $constpref, $already_read); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
| 47 | 47 | function altsys_mylangadmin_get_constant_names_by_pcre($langfile_path) |
| 48 | 48 | { |
| 49 | - if (! file_exists($langfile_path)) { |
|
| 50 | - return array() ; |
|
| 49 | + if (!file_exists($langfile_path)) { |
|
| 50 | + return array(); |
|
| 51 | 51 | } |
| 52 | - $file_contents = file_get_contents($langfile_path) ; |
|
| 53 | - preg_match_all('/\n\s*define\(\s*(["\'])([0-9a-zA-Z_]+)\\1/iU', $file_contents, $matches) ; |
|
| 54 | - $langfile_names = array() ; |
|
| 52 | + $file_contents = file_get_contents($langfile_path); |
|
| 53 | + preg_match_all('/\n\s*define\(\s*(["\'])([0-9a-zA-Z_]+)\\1/iU', $file_contents, $matches); |
|
| 54 | + $langfile_names = array(); |
|
| 55 | 55 | foreach ($matches[2] as $name) { |
| 56 | 56 | // if( defined( $name ) ) |
| 57 | - $langfile_names[] = $name ; |
|
| 57 | + $langfile_names[] = $name; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - return $langfile_names ; |
|
| 60 | + return $langfile_names; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | function altsys_mylangadmin_get_constants_by_pcre($langfile_path) |
| 65 | 65 | { |
| 66 | - if (! file_exists($langfile_path)) { |
|
| 67 | - return array() ; |
|
| 66 | + if (!file_exists($langfile_path)) { |
|
| 67 | + return array(); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - $file_contents = file_get_contents($langfile_path) ; |
|
| 71 | - preg_match_all('/\n\s*define\(\s*(["\'])([0-9a-zA-Z_]+)\\1\s*\,\s*(["\'])([^\\3]+)\\3/iU', $file_contents, $matches) ; |
|
| 72 | - $constants = array() ; |
|
| 70 | + $file_contents = file_get_contents($langfile_path); |
|
| 71 | + preg_match_all('/\n\s*define\(\s*(["\'])([0-9a-zA-Z_]+)\\1\s*\,\s*(["\'])([^\\3]+)\\3/iU', $file_contents, $matches); |
|
| 72 | + $constants = array(); |
|
| 73 | 73 | foreach ($matches[2] as $i => $name) { |
| 74 | - $constants[ $name ] = $matches[4][$i] ; |
|
| 74 | + $constants[$name] = $matches[4][$i]; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - return $constants ; |
|
| 77 | + return $constants; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | function altsys_mylangadmin_errordie($target_mname, $message4disp) |
| 82 | 82 | { |
| 83 | - xoops_cp_header() ; |
|
| 84 | - altsys_include_mymenu() ; |
|
| 85 | - $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ; |
|
| 86 | - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mylangadmin', _MI_ALTSYS_MENU_MYLANGADMIN) ; |
|
| 87 | - $breadcrumbsObj->appendPath('', $target_mname) ; |
|
| 88 | - echo '<h3>' . _MYLANGADMIN_H3_MODULE . ' : ' . $target_mname . '</h3>' ; |
|
| 89 | - echo '<p>'.$message4disp.'</p>' ; |
|
| 90 | - xoops_cp_footer() ; |
|
| 91 | - exit ; |
|
| 83 | + xoops_cp_header(); |
|
| 84 | + altsys_include_mymenu(); |
|
| 85 | + $breadcrumbsObj = AltsysBreadcrumbs::getInstance(); |
|
| 86 | + $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mylangadmin', _MI_ALTSYS_MENU_MYLANGADMIN); |
|
| 87 | + $breadcrumbsObj->appendPath('', $target_mname); |
|
| 88 | + echo '<h3>'._MYLANGADMIN_H3_MODULE.' : '.$target_mname.'</h3>'; |
|
| 89 | + echo '<p>'.$message4disp.'</p>'; |
|
| 90 | + xoops_cp_footer(); |
|
| 91 | + exit; |
|
| 92 | 92 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * Parent |
| 34 | 34 | */ |
| 35 | -include_once XOOPS_ROOT_PATH . '/class/xoopsform/formcheckbox.php'; |
|
| 35 | +include_once XOOPS_ROOT_PATH.'/class/xoopsform/formcheckbox.php'; |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * A checkbox field with a choice of available groups |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * @param bool $include_anon Include group "anonymous"? |
| 54 | 54 | * @param mixed $value Pre-selected value (or array of them). |
| 55 | 55 | */ |
| 56 | - public function __construct($caption, $name, $include_anon=false, $value=null) |
|
| 56 | + public function __construct($caption, $name, $include_anon = false, $value = null) |
|
| 57 | 57 | { |
| 58 | 58 | parent::__construct($caption, $name, $value); |
| 59 | 59 | $member_handler = xoops_getHandler('member'); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $options = $member_handler->getGroupList(); |
| 64 | 64 | } |
| 65 | 65 | foreach ($options as $k => $v) { |
| 66 | - $options[$k] = $v . '<br />'; |
|
| 66 | + $options[$k] = $v.'<br />'; |
|
| 67 | 67 | } |
| 68 | 68 | $this->addOptionArray($options); |
| 69 | 69 | } |
@@ -1,11 +1,11 @@ discard block |
||
| 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 |
||
| 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=\'\' /> <a href=\''.XOOPS_URL.'/modules/system/admin.php?fct=preferences&op=showmod&mod='.$mid.'\'' ; |
|
| 52 | - $replace = $anchor.'<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' /> <a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&lib=altsys&page=mypreferences\'' ; |
|
| 51 | + $search = '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' /> <a href=\''.XOOPS_URL.'/modules/system/admin.php?fct=preferences&op=showmod&mod='.$mid.'\''; |
|
| 52 | + $replace = $anchor.'<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' /> <a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&lib=altsys&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=\'\' /> <a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&lib=altsys&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=\'\' /> <a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&lib=altsys&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=\'\' /> <a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&lib=altsys&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=\'\' /> <a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&lib=altsys&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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |