@@ -1,35 +1,35 @@ 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 | $adminmenu = array( |
| 8 | 8 | array( |
| 9 | - 'title' => _MI_ALTSYS_MENU_CUSTOMBLOCKS , |
|
| 9 | + 'title' => _MI_ALTSYS_MENU_CUSTOMBLOCKS, |
|
| 10 | 10 | 'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname=__CustomBlocks__' |
| 11 | - ) , |
|
| 11 | + ), |
|
| 12 | 12 | array( |
| 13 | - 'title' => _MI_ALTSYS_MENU_NEWCUSTOMBLOCK , |
|
| 14 | - 'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname=__CustomBlocks__&op=edit' , |
|
| 13 | + 'title' => _MI_ALTSYS_MENU_NEWCUSTOMBLOCK, |
|
| 14 | + 'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname=__CustomBlocks__&op=edit', |
|
| 15 | 15 | 'show' => false |
| 16 | - ) , |
|
| 16 | + ), |
|
| 17 | 17 | array( |
| 18 | - 'title' => _MI_ALTSYS_MENU_MYBLOCKSADMIN , |
|
| 18 | + 'title' => _MI_ALTSYS_MENU_MYBLOCKSADMIN, |
|
| 19 | 19 | 'link' => 'admin/index.php?mode=admin&lib=altsys&page=myblocksadmin' |
| 20 | - ) , |
|
| 20 | + ), |
|
| 21 | 21 | array( |
| 22 | - 'title' => _MI_ALTSYS_MENU_MYTPLSADMIN , |
|
| 22 | + 'title' => _MI_ALTSYS_MENU_MYTPLSADMIN, |
|
| 23 | 23 | 'link' => 'admin/index.php?mode=admin&lib=altsys&page=mytplsadmin' |
| 24 | - ) , |
|
| 24 | + ), |
|
| 25 | 25 | array( |
| 26 | - 'title' => _MI_ALTSYS_MENU_COMPILEHOOKADMIN , |
|
| 26 | + 'title' => _MI_ALTSYS_MENU_COMPILEHOOKADMIN, |
|
| 27 | 27 | 'link' => 'admin/index.php?mode=admin&lib=altsys&page=compilehookadmin' |
| 28 | - ) , |
|
| 28 | + ), |
|
| 29 | 29 | array( |
| 30 | - 'title' => _MI_ALTSYS_MENU_MYLANGADMIN , |
|
| 30 | + 'title' => _MI_ALTSYS_MENU_MYLANGADMIN, |
|
| 31 | 31 | 'link' => 'admin/index.php?mode=admin&lib=altsys&page=mylangadmin' |
| 32 | - ) , |
|
| 32 | + ), |
|
| 33 | 33 | /* array( |
| 34 | 34 | 'title' => _MI_ALTSYS_MENU_MYAVATAR , |
| 35 | 35 | 'link' => 'index.php?mode=admin&lib=altsys&page=myavatar' , |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | 'title' => _MI_ALTSYS_MENU_MYSMILEY , |
| 39 | 39 | 'link' => 'index.php?mode=admin&lib=altsys&page=mysmiley' , |
| 40 | 40 | ) ,*/ |
| 41 | -) ; |
|
| 41 | +); |
|
| 42 | 42 | |
| 43 | 43 | $adminmenu4altsys = array( |
| 44 | 44 | array( |
| 45 | - 'title' => 'ALTSYS '._PREFERENCES , |
|
| 45 | + 'title' => 'ALTSYS '._PREFERENCES, |
|
| 46 | 46 | 'link' => 'admin/index.php?mode=admin&lib=altsys&page=mypreferences' |
| 47 | 47 | ) |
| 48 | -) ; |
|
| 48 | +); |
|
@@ -2,30 +2,30 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | /********* mymenu only for ALTSYS ********/ |
| 4 | 4 | |
| 5 | -if (! defined('XOOPS_ROOT_PATH')) { |
|
| 6 | - exit ; |
|
| 5 | +if (!defined('XOOPS_ROOT_PATH')) { |
|
| 6 | + exit; |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | // Skip for ORETEKI XOOPS |
| 10 | 10 | if (defined('XOOPS_ORETEKI')) { |
| 11 | - return ; |
|
| 11 | + return; |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -if (! isset($module) || ! is_object($module)) { |
|
| 15 | - $module = $xoopsModule ; |
|
| 16 | -} elseif (! is_object($xoopsModule)) { |
|
| 17 | - die('$xoopsModule is not set') ; |
|
| 14 | +if (!isset($module) || !is_object($module)) { |
|
| 15 | + $module = $xoopsModule; |
|
| 16 | +} elseif (!is_object($xoopsModule)) { |
|
| 17 | + die('$xoopsModule is not set'); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | // language files (modinfo.php) |
| 21 | -altsys_include_language_file('modinfo') ; |
|
| 21 | +altsys_include_language_file('modinfo'); |
|
| 22 | 22 | |
| 23 | -include __DIR__.'/admin_menu.php' ; |
|
| 23 | +include __DIR__.'/admin_menu.php'; |
|
| 24 | 24 | |
| 25 | -$adminmenu = array_merge($adminmenu, $adminmenu4altsys) ; |
|
| 25 | +$adminmenu = array_merge($adminmenu, $adminmenu4altsys); |
|
| 26 | 26 | |
| 27 | -$mymenu_uri = empty($mymenu_fake_uri) ? $_SERVER['REQUEST_URI'] : $mymenu_fake_uri ; |
|
| 28 | -$mymenu_link = substr(strstr($mymenu_uri, '/admin/'), 1) ; |
|
| 27 | +$mymenu_uri = empty($mymenu_fake_uri) ? $_SERVER['REQUEST_URI'] : $mymenu_fake_uri; |
|
| 28 | +$mymenu_link = substr(strstr($mymenu_uri, '/admin/'), 1); |
|
| 29 | 29 | |
| 30 | 30 | // xoops_breadcrumbs |
| 31 | 31 | // $GLOBALS['altsysXoopsBreadcrumbs'] = array( array( 'url' => XOOPS_URL.'/modules/altsys/admin/index.php' , 'name' => $xoopsModule->getVar('name') ) ) ; |
@@ -33,19 +33,19 @@ discard block |
||
| 33 | 33 | // highlight |
| 34 | 34 | foreach (array_keys($adminmenu) as $i) { |
| 35 | 35 | if ($mymenu_link == $adminmenu[$i]['link']) { |
| 36 | - $adminmenu[$i]['selected'] = true ; |
|
| 37 | - $adminmenu_hilighted = true ; |
|
| 36 | + $adminmenu[$i]['selected'] = true; |
|
| 37 | + $adminmenu_hilighted = true; |
|
| 38 | 38 | // $GLOBALS['altsysXoopsBreadcrumbs'][] = array( 'url' => XOOPS_URL."/modules/altsys/".htmlspecialchars($adminmenu[$i]['link'],ENT_QUOTES) , 'name' => htmlspecialchars( $adminmenu[$i]['title'] , ENT_QUOTES ) ) ; |
| 39 | 39 | } else { |
| 40 | - $adminmenu[$i]['selected'] = false ; |
|
| 40 | + $adminmenu[$i]['selected'] = false; |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | if (empty($adminmenu_hilighted)) { |
| 44 | 44 | foreach (array_keys($adminmenu) as $i) { |
| 45 | 45 | if (stristr($mymenu_uri, $adminmenu[$i]['link'])) { |
| 46 | - $adminmenu[$i]['selected'] = true ; |
|
| 46 | + $adminmenu[$i]['selected'] = true; |
|
| 47 | 47 | // $GLOBALS['altsysXoopsBreadcrumbs'][] = array( 'url' => XOOPS_URL."/modules/altsys/".htmlspecialchars($adminmenu[$i]['link'],ENT_QUOTES) , 'name' => htmlspecialchars( $adminmenu[$i]['title'] , ENT_QUOTES ) ) ; |
| 48 | - break ; |
|
| 48 | + break; |
|
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -53,20 +53,20 @@ discard block |
||
| 53 | 53 | // link conversion from relative to absolute |
| 54 | 54 | foreach (array_keys($adminmenu) as $i) { |
| 55 | 55 | if (stristr($adminmenu[$i]['link'], XOOPS_URL) === false) { |
| 56 | - $adminmenu[$i]['link'] = XOOPS_URL."/modules/$mydirname/" . $adminmenu[$i]['link'] ; |
|
| 56 | + $adminmenu[$i]['link'] = XOOPS_URL."/modules/$mydirname/".$adminmenu[$i]['link']; |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | // display |
| 61 | -require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ; |
|
| 62 | -$tpl = new D3Tpl() ; |
|
| 61 | +require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php'; |
|
| 62 | +$tpl = new D3Tpl(); |
|
| 63 | 63 | $tpl->assign(array( |
| 64 | 64 | 'adminmenu' => $adminmenu |
| 65 | -)) ; |
|
| 66 | -$tpl->display('db:altsys_inc_mymenu.html') ; |
|
| 65 | +)); |
|
| 66 | +$tpl->display('db:altsys_inc_mymenu.html'); |
|
| 67 | 67 | |
| 68 | 68 | // submenu |
| 69 | -$page = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['page']) ; |
|
| 69 | +$page = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['page']); |
|
| 70 | 70 | if (file_exists(__DIR__.'/mymenusub/'.$page.'.php')) { |
| 71 | - include __DIR__.'/mymenusub/'.$page.'.php' ; |
|
| 71 | + include __DIR__.'/mymenusub/'.$page.'.php'; |
|
| 72 | 72 | } |
@@ -3,9 +3,9 @@ discard block |
||
| 3 | 3 | |
| 4 | 4 | // Keep Block option values when update (by nobunobu) for XOOPS 2.0.x |
| 5 | 5 | global $xoopsDB; |
| 6 | -$query = 'SELECT mid FROM ' . $xoopsDB->prefix('modules') . " WHERE dirname='" . $modversion['dirname'] . "' "; |
|
| 6 | +$query = 'SELECT mid FROM '.$xoopsDB->prefix('modules')." WHERE dirname='".$modversion['dirname']."' "; |
|
| 7 | 7 | $result = $xoopsDB->query($query); |
| 8 | -$record= $xoopsDB->fetcharray($result); |
|
| 8 | +$record = $xoopsDB->fetcharray($result); |
|
| 9 | 9 | if ($record) { |
| 10 | 10 | $mid = $record['mid']; |
| 11 | 11 | $count = count($modversion['blocks']); |
@@ -53,40 +53,40 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | } */ |
| 55 | 55 | |
| 56 | - $sql = 'SELECT * FROM ' . $xoopsDB->prefix('newblocks') . ' WHERE mid=' . $mid . " AND block_type <>'D' AND func_num > $count"; |
|
| 56 | + $sql = 'SELECT * FROM '.$xoopsDB->prefix('newblocks').' WHERE mid='.$mid." AND block_type <>'D' AND func_num > $count"; |
|
| 57 | 57 | $fresult = $xoopsDB->query($sql); |
| 58 | 58 | while ($fblock = $xoopsDB->fetchArray($fresult)) { |
| 59 | - $local_msgs[] = 'Non Defined Block <b>' . $fblock['name'] . '</b> will be deleted'; |
|
| 60 | - $sql = 'DELETE FROM ' . $xoopsDB->prefix('newblocks') . " WHERE bid='" . $fblock['bid'] . "'"; |
|
| 59 | + $local_msgs[] = 'Non Defined Block <b>'.$fblock['name'].'</b> will be deleted'; |
|
| 60 | + $sql = 'DELETE FROM '.$xoopsDB->prefix('newblocks')." WHERE bid='".$fblock['bid']."'"; |
|
| 61 | 61 | $iret = $xoopsDB->query($sql); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - for ($i = 1 ; $i <= $count ; $i++) { |
|
| 65 | - $sql = 'SELECT name,options FROM ' . $xoopsDB->prefix('newblocks') . ' WHERE mid=' . $mid . ' AND func_num=' . $i . " AND show_func='" . addslashes($modversion['blocks'][$i]['show_func']) . "' AND func_file='" . addslashes($modversion['blocks'][$i]['file']) . "'"; |
|
| 64 | + for ($i = 1; $i <= $count; $i++) { |
|
| 65 | + $sql = 'SELECT name,options FROM '.$xoopsDB->prefix('newblocks').' WHERE mid='.$mid.' AND func_num='.$i." AND show_func='".addslashes($modversion['blocks'][$i]['show_func'])."' AND func_file='".addslashes($modversion['blocks'][$i]['file'])."'"; |
|
| 66 | 66 | $fresult = $xoopsDB->query($sql); |
| 67 | 67 | $fblock = $xoopsDB->fetchArray($fresult); |
| 68 | 68 | if (isset($fblock['options'])) { |
| 69 | - $old_vals=explode('|', $fblock['options']); |
|
| 70 | - $def_vals=explode('|', $modversion['blocks'][$i]['options']); |
|
| 69 | + $old_vals = explode('|', $fblock['options']); |
|
| 70 | + $def_vals = explode('|', $modversion['blocks'][$i]['options']); |
|
| 71 | 71 | if (count($old_vals) == count($def_vals)) { |
| 72 | 72 | $modversion['blocks'][$i]['options'] = $fblock['options']; |
| 73 | - $local_msgs[] = "Option's values of the block <b>".$fblock['name'] . '</b> will be kept. (value = <b>' . $fblock['options'] . '</b>)'; |
|
| 73 | + $local_msgs[] = "Option's values of the block <b>".$fblock['name'].'</b> will be kept. (value = <b>'.$fblock['options'].'</b>)'; |
|
| 74 | 74 | } elseif (count($old_vals) < count($def_vals)) { |
| 75 | - for ($j=0; $j < count($old_vals); $j++) { |
|
| 75 | + for ($j = 0; $j < count($old_vals); $j++) { |
|
| 76 | 76 | $def_vals[$j] = $old_vals[$j]; |
| 77 | 77 | } |
| 78 | 78 | $modversion['blocks'][$i]['options'] = implode('|', $def_vals); |
| 79 | - $local_msgs[] = "Option's values of the block <b>".$fblock['name'] . '</b> will be kept and new option(s) are added. (value = <b>' . $modversion['blocks'][$i]['options'] . '</b>)'; |
|
| 79 | + $local_msgs[] = "Option's values of the block <b>".$fblock['name'].'</b> will be kept and new option(s) are added. (value = <b>'.$modversion['blocks'][$i]['options'].'</b>)'; |
|
| 80 | 80 | } else { |
| 81 | - $local_msgs[] = "Option's values of the block <b>".$fblock['name'] . '</b> will be reset to the default, because of some decrease of options. (value = <b>' |
|
| 82 | - . $modversion['blocks'][$i]['options'] . '</b>)'; |
|
| 81 | + $local_msgs[] = "Option's values of the block <b>".$fblock['name'].'</b> will be reset to the default, because of some decrease of options. (value = <b>' |
|
| 82 | + . $modversion['blocks'][$i]['options'].'</b>)'; |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | -global $msgs , $myblocksadmin_parsed_updateblock ; |
|
| 89 | -if (! empty($msgs) && ! empty($local_msgs) && empty($myblocksadmin_parsed_updateblock)) { |
|
| 90 | - $msgs = array_merge($msgs, $local_msgs) ; |
|
| 91 | - $myblocksadmin_parsed_updateblock = true ; |
|
| 88 | +global $msgs, $myblocksadmin_parsed_updateblock; |
|
| 89 | +if (!empty($msgs) && !empty($local_msgs) && empty($myblocksadmin_parsed_updateblock)) { |
|
| 90 | + $msgs = array_merge($msgs, $local_msgs); |
|
| 91 | + $myblocksadmin_parsed_updateblock = true; |
|
| 92 | 92 | } |
@@ -1,41 +1,41 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | include_once XOOPS_ROOT_PATH.'/class/template.php'; |
| 4 | -include_once __DIR__.'/altsys_functions.php' ; |
|
| 4 | +include_once __DIR__.'/altsys_functions.php'; |
|
| 5 | 5 | |
| 6 | 6 | function tplsadmin_import_data($tplset, $tpl_file, $tpl_source, $lastmodified = 0) |
| 7 | 7 | { |
| 8 | - $db = XoopsDatabaseFactory::getDatabaseConnection() ; |
|
| 8 | + $db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 9 | 9 | |
| 10 | 10 | // check the file is valid template |
| 11 | - list($count) = $db->fetchRow($db->query('SELECT COUNT(*) FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='default' AND tpl_file='" . addslashes($tpl_file) . "'")) ; |
|
| 12 | - if (! $count) { |
|
| 13 | - return false ; |
|
| 11 | + list($count) = $db->fetchRow($db->query('SELECT COUNT(*) FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='default' AND tpl_file='".addslashes($tpl_file)."'")); |
|
| 12 | + if (!$count) { |
|
| 13 | + return false; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | // check the template exists in the tplset |
| 17 | 17 | if ($tplset != 'default') { |
| 18 | - list($count) = $db->fetchRow($db->query('SELECT COUNT(*) FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($tplset) . "' AND tpl_file='" . addslashes($tpl_file) . "'")) ; |
|
| 18 | + list($count) = $db->fetchRow($db->query('SELECT COUNT(*) FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='".addslashes($tplset)."' AND tpl_file='".addslashes($tpl_file)."'")); |
|
| 19 | 19 | if ($count <= 0) { |
| 20 | 20 | // copy from 'default' to the tplset |
| 21 | - $result = $db->query('SELECT * FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='default' AND tpl_file='" . addslashes($tpl_file) . "'") ; |
|
| 21 | + $result = $db->query('SELECT * FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='default' AND tpl_file='".addslashes($tpl_file)."'"); |
|
| 22 | 22 | while ($row = $db->fetchArray($result)) { |
| 23 | - $db->queryF('INSERT INTO ' . $db->prefix('tplfile') . " SET tpl_refid='" . addslashes($row['tpl_refid']) . "',tpl_module='" . addslashes($row['tpl_module']) . "',tpl_tplset='" . addslashes($tplset) . "',tpl_file='" . addslashes($tpl_file) . "',tpl_desc='" . addslashes($row['tpl_desc']) . "',tpl_type='" . addslashes($row['tpl_type']) . "'") ; |
|
| 24 | - $tpl_id = $db->getInsertId() ; |
|
| 25 | - $db->queryF('INSERT INTO ' . $db->prefix('tplsource') . " SET tpl_id='$tpl_id', tpl_source=''") ; |
|
| 23 | + $db->queryF('INSERT INTO '.$db->prefix('tplfile')." SET tpl_refid='".addslashes($row['tpl_refid'])."',tpl_module='".addslashes($row['tpl_module'])."',tpl_tplset='".addslashes($tplset)."',tpl_file='".addslashes($tpl_file)."',tpl_desc='".addslashes($row['tpl_desc'])."',tpl_type='".addslashes($row['tpl_type'])."'"); |
|
| 24 | + $tpl_id = $db->getInsertId(); |
|
| 25 | + $db->queryF('INSERT INTO '.$db->prefix('tplsource')." SET tpl_id='$tpl_id', tpl_source=''"); |
|
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | // UPDATE just tpl_lastmodified and tpl_source |
| 31 | - $drs = $db->query('SELECT tpl_id FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($tplset) . "' AND tpl_file='" . addslashes($tpl_file) . "'") ; |
|
| 31 | + $drs = $db->query('SELECT tpl_id FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='".addslashes($tplset)."' AND tpl_file='".addslashes($tpl_file)."'"); |
|
| 32 | 32 | while (list($tpl_id) = $db->fetchRow($drs)) { |
| 33 | - $db->queryF('UPDATE ' . $db->prefix('tplfile') . " SET tpl_lastmodified='" . addslashes($lastmodified) . "',tpl_lastimported=UNIX_TIMESTAMP() WHERE tpl_id='$tpl_id'") ; |
|
| 34 | - $db->queryF('UPDATE ' . $db->prefix('tplsource') . " SET tpl_source='" . addslashes($tpl_source) . "' WHERE tpl_id='$tpl_id'") ; |
|
| 35 | - altsys_template_touch($tpl_id) ; |
|
| 33 | + $db->queryF('UPDATE '.$db->prefix('tplfile')." SET tpl_lastmodified='".addslashes($lastmodified)."',tpl_lastimported=UNIX_TIMESTAMP() WHERE tpl_id='$tpl_id'"); |
|
| 34 | + $db->queryF('UPDATE '.$db->prefix('tplsource')." SET tpl_source='".addslashes($tpl_source)."' WHERE tpl_id='$tpl_id'"); |
|
| 35 | + altsys_template_touch($tpl_id); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - return true ; |
|
| 38 | + return true; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | |
@@ -43,46 +43,46 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | function tplsadmin_get_fingerprint($lines) |
| 45 | 45 | { |
| 46 | - $str = '' ; |
|
| 46 | + $str = ''; |
|
| 47 | 47 | foreach ($lines as $line) { |
| 48 | 48 | if (trim($line)) { |
| 49 | - $str .= md5(trim($line)) ; |
|
| 49 | + $str .= md5(trim($line)); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | - return md5($str) ; |
|
| 52 | + return md5($str); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | |
| 57 | 57 | function tplsadmin_copy_templates_db2db($tplset_from, $tplset_to, $whr_append = '1') |
| 58 | 58 | { |
| 59 | - global $db ; |
|
| 59 | + global $db; |
|
| 60 | 60 | |
| 61 | 61 | // get tplfile and tplsource |
| 62 | - $result = $db->query("SELECT tpl_refid,tpl_module,'".addslashes($tplset_to)."',tpl_file,tpl_desc,tpl_lastmodified,tpl_lastimported,tpl_type,tpl_source FROM ".$db->prefix('tplfile') . ' NATURAL LEFT JOIN ' |
|
| 63 | - . $db->prefix('tplsource') . " WHERE tpl_tplset='" . addslashes($tplset_from) . "' AND ($whr_append)") ; |
|
| 62 | + $result = $db->query("SELECT tpl_refid,tpl_module,'".addslashes($tplset_to)."',tpl_file,tpl_desc,tpl_lastmodified,tpl_lastimported,tpl_type,tpl_source FROM ".$db->prefix('tplfile').' NATURAL LEFT JOIN ' |
|
| 63 | + . $db->prefix('tplsource')." WHERE tpl_tplset='".addslashes($tplset_from)."' AND ($whr_append)"); |
|
| 64 | 64 | |
| 65 | 65 | while ($row = $db->fetchArray($result)) { |
| 66 | - $tpl_source = array_pop($row) ; |
|
| 66 | + $tpl_source = array_pop($row); |
|
| 67 | 67 | |
| 68 | - $drs = $db->query('SELECT tpl_id FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($tplset_to) . "' AND ($whr_append) AND tpl_file='" . addslashes($row['tpl_file']) . "' AND tpl_refid='" . addslashes($row['tpl_refid']) . "'") ; |
|
| 68 | + $drs = $db->query('SELECT tpl_id FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='".addslashes($tplset_to)."' AND ($whr_append) AND tpl_file='".addslashes($row['tpl_file'])."' AND tpl_refid='".addslashes($row['tpl_refid'])."'"); |
|
| 69 | 69 | |
| 70 | - if (! $db->getRowsNum($drs)) { |
|
| 70 | + if (!$db->getRowsNum($drs)) { |
|
| 71 | 71 | // INSERT mode |
| 72 | - $sql = 'INSERT INTO ' . $db->prefix('tplfile') . ' (tpl_refid,tpl_module,tpl_tplset,tpl_file,tpl_desc,tpl_lastmodified,tpl_lastimported,tpl_type) VALUES ('; |
|
| 72 | + $sql = 'INSERT INTO '.$db->prefix('tplfile').' (tpl_refid,tpl_module,tpl_tplset,tpl_file,tpl_desc,tpl_lastmodified,tpl_lastimported,tpl_type) VALUES ('; |
|
| 73 | 73 | foreach ($row as $colval) { |
| 74 | - $sql .= "'".addslashes($colval)."'," ; |
|
| 74 | + $sql .= "'".addslashes($colval)."',"; |
|
| 75 | 75 | } |
| 76 | - $db->query(substr($sql, 0, -1) . ')') ; |
|
| 77 | - $tpl_id = $db->getInsertId() ; |
|
| 78 | - $db->query('INSERT INTO ' . $db->prefix('tplsource') . " SET tpl_id='$tpl_id', tpl_source='" . addslashes($tpl_source) . "'") ; |
|
| 79 | - altsys_template_touch($tpl_id) ; |
|
| 76 | + $db->query(substr($sql, 0, -1).')'); |
|
| 77 | + $tpl_id = $db->getInsertId(); |
|
| 78 | + $db->query('INSERT INTO '.$db->prefix('tplsource')." SET tpl_id='$tpl_id', tpl_source='".addslashes($tpl_source)."'"); |
|
| 79 | + altsys_template_touch($tpl_id); |
|
| 80 | 80 | } else { |
| 81 | 81 | while (list($tpl_id) = $db->fetchRow($drs)) { |
| 82 | 82 | // UPDATE mode |
| 83 | - $db->query('UPDATE ' . $db->prefix('tplfile') . " SET tpl_refid='" . addslashes($row['tpl_refid']) . "',tpl_desc='" . addslashes($row['tpl_desc']) . "',tpl_lastmodified='" . addslashes($row['tpl_lastmodified']) . "',tpl_lastimported='" . addslashes($row['tpl_lastimported']) . "',tpl_type='" . addslashes($row['tpl_type']) . "' WHERE tpl_id='$tpl_id'") ; |
|
| 84 | - $db->query('UPDATE ' . $db->prefix('tplsource') . " SET tpl_source='" . addslashes($tpl_source) . "' WHERE tpl_id='$tpl_id'") ; |
|
| 85 | - altsys_template_touch($tpl_id) ; |
|
| 83 | + $db->query('UPDATE '.$db->prefix('tplfile')." SET tpl_refid='".addslashes($row['tpl_refid'])."',tpl_desc='".addslashes($row['tpl_desc'])."',tpl_lastmodified='".addslashes($row['tpl_lastmodified'])."',tpl_lastimported='".addslashes($row['tpl_lastimported'])."',tpl_type='".addslashes($row['tpl_type'])."' WHERE tpl_id='$tpl_id'"); |
|
| 84 | + $db->query('UPDATE '.$db->prefix('tplsource')." SET tpl_source='".addslashes($tpl_source)."' WHERE tpl_id='$tpl_id'"); |
|
| 85 | + altsys_template_touch($tpl_id); |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -92,31 +92,31 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | function tplsadmin_copy_templates_f2db($tplset_to, $whr_append = '1') |
| 94 | 94 | { |
| 95 | - global $db ; |
|
| 95 | + global $db; |
|
| 96 | 96 | |
| 97 | 97 | // get tplsource |
| 98 | - $result = $db->query('SELECT * FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='default' AND ($whr_append)") ; |
|
| 98 | + $result = $db->query('SELECT * FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='default' AND ($whr_append)"); |
|
| 99 | 99 | |
| 100 | 100 | while ($row = $db->fetchArray($result)) { |
| 101 | - $basefilepath = tplsadmin_get_basefilepath($row['tpl_module'], $row['tpl_type'], $row['tpl_file']) ; |
|
| 102 | - $tpl_source = rtrim(implode('', file($basefilepath))) ; |
|
| 103 | - $lastmodified = filemtime($basefilepath) ; |
|
| 101 | + $basefilepath = tplsadmin_get_basefilepath($row['tpl_module'], $row['tpl_type'], $row['tpl_file']); |
|
| 102 | + $tpl_source = rtrim(implode('', file($basefilepath))); |
|
| 103 | + $lastmodified = filemtime($basefilepath); |
|
| 104 | 104 | |
| 105 | - $drs = $db->query('SELECT tpl_id FROM ' . $db->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($tplset_to) . "' AND ($whr_append) AND tpl_file='" . addslashes($row['tpl_file']) . "' AND tpl_refid='" . addslashes($row['tpl_refid']) . "'") ; |
|
| 105 | + $drs = $db->query('SELECT tpl_id FROM '.$db->prefix('tplfile')." WHERE tpl_tplset='".addslashes($tplset_to)."' AND ($whr_append) AND tpl_file='".addslashes($row['tpl_file'])."' AND tpl_refid='".addslashes($row['tpl_refid'])."'"); |
|
| 106 | 106 | |
| 107 | - if (! $db->getRowsNum($drs)) { |
|
| 107 | + if (!$db->getRowsNum($drs)) { |
|
| 108 | 108 | // INSERT mode |
| 109 | - $sql = 'INSERT INTO ' . $db->prefix('tplfile') . " SET tpl_refid='" . addslashes($row['tpl_refid']) . "',tpl_desc='" . addslashes($row['tpl_desc']) . "',tpl_lastmodified='" . addslashes($lastmodified) . "',tpl_type='" . addslashes($row['tpl_type']) . "',tpl_tplset='" . addslashes($tplset_to) . "',tpl_file='" . addslashes($row['tpl_file']) . "',tpl_module='" . addslashes($row['tpl_module']) . "'" ; |
|
| 110 | - $db->query($sql) ; |
|
| 111 | - $tpl_id = $db->getInsertId() ; |
|
| 112 | - $db->query('INSERT INTO ' . $db->prefix('tplsource') . " SET tpl_id='$tpl_id', tpl_source='" . addslashes($tpl_source) . "'") ; |
|
| 113 | - altsys_template_touch($tpl_id) ; |
|
| 109 | + $sql = 'INSERT INTO '.$db->prefix('tplfile')." SET tpl_refid='".addslashes($row['tpl_refid'])."',tpl_desc='".addslashes($row['tpl_desc'])."',tpl_lastmodified='".addslashes($lastmodified)."',tpl_type='".addslashes($row['tpl_type'])."',tpl_tplset='".addslashes($tplset_to)."',tpl_file='".addslashes($row['tpl_file'])."',tpl_module='".addslashes($row['tpl_module'])."'"; |
|
| 110 | + $db->query($sql); |
|
| 111 | + $tpl_id = $db->getInsertId(); |
|
| 112 | + $db->query('INSERT INTO '.$db->prefix('tplsource')." SET tpl_id='$tpl_id', tpl_source='".addslashes($tpl_source)."'"); |
|
| 113 | + altsys_template_touch($tpl_id); |
|
| 114 | 114 | } else { |
| 115 | 115 | while (list($tpl_id) = $db->fetchRow($drs)) { |
| 116 | 116 | // UPDATE mode |
| 117 | - $db->query('UPDATE ' . $db->prefix('tplfile') . " SET tpl_lastmodified='" . addslashes($lastmodified) . "' WHERE tpl_id='$tpl_id'") ; |
|
| 118 | - $db->query('UPDATE ' . $db->prefix('tplsource') . " SET tpl_source='" . addslashes($tpl_source) . "' WHERE tpl_id='$tpl_id'") ; |
|
| 119 | - altsys_template_touch($tpl_id) ; |
|
| 117 | + $db->query('UPDATE '.$db->prefix('tplfile')." SET tpl_lastmodified='".addslashes($lastmodified)."' WHERE tpl_id='$tpl_id'"); |
|
| 118 | + $db->query('UPDATE '.$db->prefix('tplsource')." SET tpl_source='".addslashes($tpl_source)."' WHERE tpl_id='$tpl_id'"); |
|
| 119 | + altsys_template_touch($tpl_id); |
|
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | function tplsadmin_get_basefilepath($dirname, $type, $tpl_file) |
| 128 | 128 | { |
| 129 | 129 | // module instance |
| 130 | - $path = $basefilepath = XOOPS_ROOT_PATH.'/modules/'.$dirname.'/templates/'.($type=='block'?'blocks/':'').$tpl_file ; |
|
| 130 | + $path = $basefilepath = XOOPS_ROOT_PATH.'/modules/'.$dirname.'/templates/'.($type == 'block' ? 'blocks/' : '').$tpl_file; |
|
| 131 | 131 | |
| 132 | 132 | if (is_callable('Legacy_Utils::getTrustDirnameByDirname')) { |
| 133 | 133 | $mytrustdirname = Legacy_Utils::getTrustDirnameByDirname($dirname); |
@@ -135,33 +135,33 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | if (defined('ALTSYS_TPLSADMIN_BASEPATH')) { |
| 137 | 137 | // Special hook |
| 138 | - $path = ALTSYS_TPLSADMIN_BASEPATH.'/'.substr($tpl_file, strlen($dirname) + 1) ; |
|
| 138 | + $path = ALTSYS_TPLSADMIN_BASEPATH.'/'.substr($tpl_file, strlen($dirname) + 1); |
|
| 139 | 139 | } elseif ($mytrustdirname || @include(XOOPS_ROOT_PATH.'/modules/'.$dirname.'/mytrustdirname.php')) { |
| 140 | 140 | // D3 module base |
| 141 | - if (! empty($mytrustdirname)) { |
|
| 142 | - $mid_path = $mytrustdirname == 'altsys' ? '/libs/' : '/modules/' ; |
|
| 141 | + if (!empty($mytrustdirname)) { |
|
| 142 | + $mid_path = $mytrustdirname == 'altsys' ? '/libs/' : '/modules/'; |
|
| 143 | 143 | |
| 144 | - $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type=='block'?'blocks/':'').substr($tpl_file, strlen($dirname) + 1) ; |
|
| 144 | + $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type == 'block' ? 'blocks/' : '').substr($tpl_file, strlen($dirname) + 1); |
|
| 145 | 145 | //new for xcck etc.other trust_module |
| 146 | - if (! file_exists($path)) { |
|
| 147 | - $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type=='block'?'blocks/':'').$tpl_file ; |
|
| 148 | - if (! file_exists($path)) { |
|
| 146 | + if (!file_exists($path)) { |
|
| 147 | + $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type == 'block' ? 'blocks/' : '').$tpl_file; |
|
| 148 | + if (!file_exists($path)) { |
|
| 149 | 149 | $path = $basefilepath; |
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - return $path ; |
|
| 155 | + return $path; |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | |
| 159 | 159 | function tplsadmin_die($msg, $target_dirname = '', $wait = 2) |
| 160 | 160 | { |
| 161 | 161 | if (strtolower($_SERVER['REQUEST_METHOD']) === 'post') { |
| 162 | - redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, $wait, $msg) ; |
|
| 163 | - exit ; |
|
| 162 | + redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, $wait, $msg); |
|
| 163 | + exit; |
|
| 164 | 164 | } else { |
| 165 | - die($msg) ; |
|
| 165 | + die($msg); |
|
| 166 | 166 | } |
| 167 | 167 | } |
@@ -2,29 +2,29 @@ |
||
| 2 | 2 | |
| 3 | 3 | // render admin in theme.html |
| 4 | 4 | if (is_object($xoopsUser)) { |
| 5 | - $xoops_subpath = substr($_SERVER['REQUEST_URI'], strpos(strrev(XOOPS_URL), strrev($_SERVER['HTTP_HOST']))) ; |
|
| 5 | + $xoops_subpath = substr($_SERVER['REQUEST_URI'], strpos(strrev(XOOPS_URL), strrev($_SERVER['HTTP_HOST']))); |
|
| 6 | 6 | if (preg_match('#(^/admin.php|^/modules/system/|^/modules/[a-zA-Z0-9_.-]+/admin/)#', $xoops_subpath)) { |
| 7 | 7 | // The request looks like admin |
| 8 | - require_once __DIR__.'/altsys_functions.php' ; |
|
| 9 | - if (! empty($GLOBALS['altsysModuleConfig']['admin_in_theme']) && file_exists(XOOPS_THEME_PATH.'/'.$GLOBALS['altsysModuleConfig']['admin_in_theme'].'/theme.html')) { |
|
| 8 | + require_once __DIR__.'/altsys_functions.php'; |
|
| 9 | + if (!empty($GLOBALS['altsysModuleConfig']['admin_in_theme']) && file_exists(XOOPS_THEME_PATH.'/'.$GLOBALS['altsysModuleConfig']['admin_in_theme'].'/theme.html')) { |
|
| 10 | 10 | // configs OK |
| 11 | - require_once __DIR__.'/admin_in_theme_functions.php' ; |
|
| 11 | + require_once __DIR__.'/admin_in_theme_functions.php'; |
|
| 12 | 12 | |
| 13 | 13 | // for security with register_globals=1 |
| 14 | - unset($GLOBALS['altsysAdminPageTitle'], /* $GLOBALS['altsysXoopsBreadcrumbs'] ,*/ $GLOBALS['xoops_admin_contents']) ; |
|
| 14 | + unset($GLOBALS['altsysAdminPageTitle'], /* $GLOBALS['altsysXoopsBreadcrumbs'] ,*/ $GLOBALS['xoops_admin_contents']); |
|
| 15 | 15 | |
| 16 | 16 | // disable error handler without XOOPS 2.0.14/15/16 |
| 17 | - if (! (is_object(@$xoopsLogger) && method_exists($xoopsLogger, 'render') && in_array($xoopsConfig['debug_mode'], array( 1, 2 )))) { |
|
| 18 | - restore_error_handler() ; |
|
| 17 | + if (!(is_object(@$xoopsLogger) && method_exists($xoopsLogger, 'render') && in_array($xoopsConfig['debug_mode'], array(1, 2)))) { |
|
| 18 | + restore_error_handler(); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | // to prepend Notice with 2.0.14/15/16 with PHP4 |
| 22 | - if (! defined('E_STRICT')) { |
|
| 23 | - define('E_STRICT', 2048) ; |
|
| 22 | + if (!defined('E_STRICT')) { |
|
| 23 | + define('E_STRICT', 2048); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - register_shutdown_function('altsys_admin_in_theme_in_last') ; |
|
| 27 | - ob_start('altsys_admin_in_theme') ; |
|
| 26 | + register_shutdown_function('altsys_admin_in_theme_in_last'); |
|
| 27 | + ob_start('altsys_admin_in_theme'); |
|
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -2,94 +2,94 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | function altsys_admin_in_theme($s) |
| 4 | 4 | { |
| 5 | - global $xoops_admin_contents ; |
|
| 5 | + global $xoops_admin_contents; |
|
| 6 | 6 | |
| 7 | - $xoops_admin_contents = '' ; |
|
| 7 | + $xoops_admin_contents = ''; |
|
| 8 | 8 | |
| 9 | 9 | if (defined('ALTSYS_DONT_USE_ADMIN_IN_THEME')) { |
| 10 | - return $s ; |
|
| 10 | + return $s; |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | // check whether cp_functions.php is loaded |
| 14 | - if (! defined('XOOPS_CPFUNC_LOADED')) { |
|
| 15 | - define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1) ; |
|
| 16 | - return $s ; |
|
| 14 | + if (!defined('XOOPS_CPFUNC_LOADED')) { |
|
| 15 | + define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1); |
|
| 16 | + return $s; |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | // redirect |
| 20 | 20 | if (strstr($s, '<meta http-equiv="Refresh" ')) { |
| 21 | - define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1) ; |
|
| 22 | - return $s ; |
|
| 21 | + define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1); |
|
| 22 | + return $s; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | // outputs before cp_header() |
| 26 | - @list($former_outputs, $tmp_s) = explode('<!DOCTYPE', $s, 2) ; |
|
| 26 | + @list($former_outputs, $tmp_s) = explode('<!DOCTYPE', $s, 2); |
|
| 27 | 27 | if (empty($tmp_s)) { |
| 28 | - $tmp_s = $s ; |
|
| 28 | + $tmp_s = $s; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - @list(, $tmp_s) = explode("<div class='content'>", $tmp_s, 2) ; |
|
| 31 | + @list(, $tmp_s) = explode("<div class='content'>", $tmp_s, 2); |
|
| 32 | 32 | if (empty($tmp_s)) { |
| 33 | - define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1) ; |
|
| 34 | - return $s ; |
|
| 33 | + define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1); |
|
| 34 | + return $s; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - list($tmp_s, $tmp_after) = explode("<td width='1%' background='".XOOPS_URL."/modules/system/images/bg_content.gif'>", $tmp_s) ; |
|
| 37 | + list($tmp_s, $tmp_after) = explode("<td width='1%' background='".XOOPS_URL."/modules/system/images/bg_content.gif'>", $tmp_s); |
|
| 38 | 38 | if (empty($tmp_after)) { |
| 39 | - define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1) ; |
|
| 40 | - return $s ; |
|
| 39 | + define('ALTSYS_DONT_USE_ADMIN_IN_THEME', 1); |
|
| 40 | + return $s; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - $xoops_admin_contents = $former_outputs . substr(strrev(strstr(strrev($tmp_s), strrev('</div>'))), 0, -6) ; |
|
| 43 | + $xoops_admin_contents = $former_outputs.substr(strrev(strstr(strrev($tmp_s), strrev('</div>'))), 0, -6); |
|
| 44 | 44 | |
| 45 | - return '' ; |
|
| 45 | + return ''; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | function altsys_admin_in_theme_in_last($contents = null) |
| 50 | 50 | { |
| 51 | - global $xoops_admin_contents , $xoopsConfig , $xoopsModule , $xoopsUser , $xoopsUserIsAdmin , $xoopsLogger , $altsysModuleConfig , $altsysModuleId ; |
|
| 51 | + global $xoops_admin_contents, $xoopsConfig, $xoopsModule, $xoopsUser, $xoopsUserIsAdmin, $xoopsLogger, $altsysModuleConfig, $altsysModuleId; |
|
| 52 | 52 | |
| 53 | - if (! isset($contents)) { |
|
| 53 | + if (!isset($contents)) { |
|
| 54 | 54 | while (ob_get_level()) { |
| 55 | - ob_end_flush() ; |
|
| 55 | + ob_end_flush(); |
|
| 56 | 56 | } |
| 57 | 57 | } else { |
| 58 | - $xoops_admin_contents = $contents ; |
|
| 58 | + $xoops_admin_contents = $contents; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - if (! isset($xoops_admin_contents)) { |
|
| 62 | - return ; |
|
| 61 | + if (!isset($xoops_admin_contents)) { |
|
| 62 | + return; |
|
| 63 | 63 | } |
| 64 | 64 | if (defined('ALTSYS_DONT_USE_ADMIN_IN_THEME')) { |
| 65 | - return ; |
|
| 65 | + return; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - if (! is_object($xoopsUser)) { |
|
| 69 | - exit ; |
|
| 68 | + if (!is_object($xoopsUser)) { |
|
| 69 | + exit; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // language files |
| 73 | 73 | if (file_exists(dirname(__DIR__).'/language/'.$xoopsConfig['language'].'/admin_in_theme.php')) { |
| 74 | - include_once dirname(__DIR__).'/language/'.$xoopsConfig['language'].'/admin_in_theme.php' ; |
|
| 74 | + include_once dirname(__DIR__).'/language/'.$xoopsConfig['language'].'/admin_in_theme.php'; |
|
| 75 | 75 | } else { |
| 76 | - include_once dirname(__DIR__).'/language/english/admin_in_theme.php' ; |
|
| 76 | + include_once dirname(__DIR__).'/language/english/admin_in_theme.php'; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | // set the theme |
| 80 | - $xoopsConfig['theme_set'] = $altsysModuleConfig['admin_in_theme'] ; |
|
| 80 | + $xoopsConfig['theme_set'] = $altsysModuleConfig['admin_in_theme']; |
|
| 81 | 81 | |
| 82 | 82 | // language files under the theme |
| 83 | - $original_error_level = error_reporting() ; |
|
| 84 | - error_reporting($original_error_level & ~ E_NOTICE) ; |
|
| 83 | + $original_error_level = error_reporting(); |
|
| 84 | + error_reporting($original_error_level & ~ E_NOTICE); |
|
| 85 | 85 | if (file_exists(XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/'.$xoopsConfig['language'].'.php')) { |
| 86 | - include_once XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/'.$xoopsConfig['language'].'.php' ; |
|
| 86 | + include_once XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/'.$xoopsConfig['language'].'.php'; |
|
| 87 | 87 | } elseif (file_exists(XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/english.php')) { |
| 88 | - include_once XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/english.php' ; |
|
| 88 | + include_once XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/language/english.php'; |
|
| 89 | 89 | } |
| 90 | - error_reporting($original_error_level) ; |
|
| 90 | + error_reporting($original_error_level); |
|
| 91 | 91 | |
| 92 | - include __DIR__.'/admin_in_theme_header.inc.php' ; |
|
| 92 | + include __DIR__.'/admin_in_theme_header.inc.php'; |
|
| 93 | 93 | |
| 94 | 94 | /* // include adminmenu |
| 95 | 95 | include XOOPS_CACHE_PATH.'/adminmenu.php' ; |
@@ -125,11 +125,11 @@ discard block |
||
| 125 | 125 | function shutdown() {'.implode("\n",$xoops_admin_menu_sd).'}' ; */ |
| 126 | 126 | |
| 127 | 127 | // appendix (core specific css etc) |
| 128 | - $xoops_module_header = '' ; |
|
| 128 | + $xoops_module_header = ''; |
|
| 129 | 129 | if (altsys_get_core_type() == ALTSYS_CORE_TYPE_XCL21) { |
| 130 | - $xoops_module_header .= '<link rel="stylesheet" type="text/css" media="all" href="'.XOOPS_URL.'/modules/legacyRender/admin/css.php?file=style.css" />'."\n" ; |
|
| 130 | + $xoops_module_header .= '<link rel="stylesheet" type="text/css" media="all" href="'.XOOPS_URL.'/modules/legacyRender/admin/css.php?file=style.css" />'."\n"; |
|
| 131 | 131 | if (is_object(@$xoopsModule)) { |
| 132 | - $xoops_module_header .= '<link rel="stylesheet" type="text/css" media="all" href="'.XOOPS_URL.'/modules/legacyRender/admin/css.php?file=module.css&dirname='.$xoopsModule->getVar('dirname').'" />'."\n" ; |
|
| 132 | + $xoops_module_header .= '<link rel="stylesheet" type="text/css" media="all" href="'.XOOPS_URL.'/modules/legacyRender/admin/css.php?file=module.css&dirname='.$xoopsModule->getVar('dirname').'" />'."\n"; |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
@@ -148,14 +148,14 @@ discard block |
||
| 148 | 148 | 'xoops_slogan' => htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES), |
| 149 | 149 | 'xoops_contents' => $xoops_admin_contents, //. '<div id="adminmenu_layers">' . $xoops_admin_menu_dv . '</div>' , |
| 150 | 150 | 'xoops_module_header' => $xoops_module_header |
| 151 | - )) ; |
|
| 151 | + )); |
|
| 152 | 152 | |
| 153 | 153 | // rendering |
| 154 | - $xoopsTpl->display($xoopsConfig['theme_set'].'/theme.html') ; |
|
| 154 | + $xoopsTpl->display($xoopsConfig['theme_set'].'/theme.html'); |
|
| 155 | 155 | |
| 156 | 156 | // for XOOPS 2.0.14/15/16 from xoops.org |
| 157 | - if (is_object(@$xoopsLogger) && method_exists($xoopsLogger, 'render') && in_array($xoopsConfig['debug_mode'], array( 1, 2 ))) { |
|
| 158 | - $xoopsLogger->activated = true ; |
|
| 159 | - echo $xoopsLogger->render('') ; |
|
| 157 | + if (is_object(@$xoopsLogger) && method_exists($xoopsLogger, 'render') && in_array($xoopsConfig['debug_mode'], array(1, 2))) { |
|
| 158 | + $xoopsLogger->activated = true; |
|
| 159 | + echo $xoopsLogger->render(''); |
|
| 160 | 160 | } |
| 161 | 161 | } |
@@ -1,33 +1,33 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (! $xoopsConfig['theme_fromfile']) { |
|
| 4 | - return ; |
|
| 3 | +if (!$xoopsConfig['theme_fromfile']) { |
|
| 4 | + return; |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | // templates/ under modules |
| 8 | 8 | // $tplsadmin_autoupdate_path = XOOPS_THEME_PATH . '/' . $xoopsConfig['theme_set'] . '/templates' ; |
| 9 | 9 | |
| 10 | -if (! is_array(@$tplsadmin_autoupdate_mydirnames)) { |
|
| 11 | - return ; |
|
| 10 | +if (!is_array(@$tplsadmin_autoupdate_mydirnames)) { |
|
| 11 | + return; |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | foreach ($tplsadmin_autoupdate_mydirnames as $tplsadmin_mydirname) { |
| 15 | - $tplsadmin_mydirname = preg_replace('/[^a-zA-Z0-9_-]/', '', $tplsadmin_mydirname) ; |
|
| 16 | - require XOOPS_ROOT_PATH . '/modules/' . $tplsadmin_mydirname . '/mytrustdirname.php' ; |
|
| 17 | - $altsys_mid_path = $mytrustdirname == 'altsys' ? '/libs/' : '/modules/' ; |
|
| 18 | - $tplsadmin_autoupdate_path = XOOPS_TRUST_PATH . $altsys_mid_path . $mytrustdirname . '/templates' ; |
|
| 15 | + $tplsadmin_mydirname = preg_replace('/[^a-zA-Z0-9_-]/', '', $tplsadmin_mydirname); |
|
| 16 | + require XOOPS_ROOT_PATH.'/modules/'.$tplsadmin_mydirname.'/mytrustdirname.php'; |
|
| 17 | + $altsys_mid_path = $mytrustdirname == 'altsys' ? '/libs/' : '/modules/'; |
|
| 18 | + $tplsadmin_autoupdate_path = XOOPS_TRUST_PATH.$altsys_mid_path.$mytrustdirname.'/templates'; |
|
| 19 | 19 | |
| 20 | 20 | // modules |
| 21 | - if ($handler = @opendir($tplsadmin_autoupdate_path . '/')) { |
|
| 21 | + if ($handler = @opendir($tplsadmin_autoupdate_path.'/')) { |
|
| 22 | 22 | while (($file = readdir($handler)) !== false) { |
| 23 | - $file_path = $tplsadmin_autoupdate_path . '/' . $file ; |
|
| 23 | + $file_path = $tplsadmin_autoupdate_path.'/'.$file; |
|
| 24 | 24 | if (is_file($file_path)) { |
| 25 | 25 | $mtime = (int)(@filemtime($file_path)); |
| 26 | - $tpl_file = $tplsadmin_mydirname . '_' . $file ; |
|
| 27 | - list($count) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($xoopsConfig['template_set']) . "' AND tpl_file='" . addslashes($tpl_file) . "' AND tpl_lastmodified >= $mtime")) ; |
|
| 26 | + $tpl_file = $tplsadmin_mydirname.'_'.$file; |
|
| 27 | + list($count) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM '.$xoopsDB->prefix('tplfile')." WHERE tpl_tplset='".addslashes($xoopsConfig['template_set'])."' AND tpl_file='".addslashes($tpl_file)."' AND tpl_lastmodified >= $mtime")); |
|
| 28 | 28 | if ($count <= 0) { |
| 29 | - include_once XOOPS_TRUST_PATH.'/libs/altsys/include/tpls_functions.php' ; |
|
| 30 | - tplsadmin_import_data($xoopsConfig['template_set'], $tpl_file, implode('', file($file_path)), $mtime) ; |
|
| 29 | + include_once XOOPS_TRUST_PATH.'/libs/altsys/include/tpls_functions.php'; |
|
| 30 | + tplsadmin_import_data($xoopsConfig['template_set'], $tpl_file, implode('', file($file_path)), $mtime); |
|
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | } |
@@ -2,147 +2,147 @@ discard block |
||
| 2 | 2 | // GIJOE's Ticket Class (based on Marijuana's Oreteki XOOPS) |
| 3 | 3 | // nobunobu's suggestions are applied |
| 4 | 4 | |
| 5 | -if (! class_exists('XoopsGTicket')) { |
|
| 5 | +if (!class_exists('XoopsGTicket')) { |
|
| 6 | 6 | class XoopsGTicket |
| 7 | 7 | { |
| 8 | 8 | |
| 9 | - public $_errors = array() ; |
|
| 10 | - public $_latest_token = '' ; |
|
| 11 | - public $messages = array() ; |
|
| 9 | + public $_errors = array(); |
|
| 10 | + public $_latest_token = ''; |
|
| 11 | + public $messages = array(); |
|
| 12 | 12 | |
| 13 | 13 | public function __construct() |
| 14 | 14 | { |
| 15 | - global $xoopsConfig ; |
|
| 15 | + global $xoopsConfig; |
|
| 16 | 16 | |
| 17 | 17 | // language file |
| 18 | - if (defined('XOOPS_ROOT_PATH') && ! empty($xoopsConfig['language']) && ! strstr($xoopsConfig['language'], '/')) { |
|
| 19 | - if (file_exists(dirname(__DIR__) . '/language/' . $xoopsConfig['language'] . '/gticket_messages.phtml')) { |
|
| 20 | - include dirname(__DIR__) . '/language/' . $xoopsConfig['language'] . '/gticket_messages.phtml' ; |
|
| 18 | + if (defined('XOOPS_ROOT_PATH') && !empty($xoopsConfig['language']) && !strstr($xoopsConfig['language'], '/')) { |
|
| 19 | + if (file_exists(dirname(__DIR__).'/language/'.$xoopsConfig['language'].'/gticket_messages.phtml')) { |
|
| 20 | + include dirname(__DIR__).'/language/'.$xoopsConfig['language'].'/gticket_messages.phtml'; |
|
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | // default messages |
| 25 | 25 | if (empty($this->messages)) { |
| 26 | 26 | $this->messages = array( |
| 27 | - 'err_general' => 'GTicket Error' , |
|
| 28 | - 'err_nostubs' => 'No stubs found' , |
|
| 29 | - 'err_noticket' => 'No ticket found' , |
|
| 30 | - 'err_nopair' => 'No valid ticket-stub pair found' , |
|
| 31 | - 'err_timeout' => 'Time out' , |
|
| 32 | - 'err_areaorref' => 'Invalid area or referer' , |
|
| 33 | - 'fmt_prompt4repost' => 'error(s) found:<br /><span style="background-color:red;font-weight:bold;color:white;">%s</span><br />Confirm it.<br />And do you want to post again?' , |
|
| 27 | + 'err_general' => 'GTicket Error', |
|
| 28 | + 'err_nostubs' => 'No stubs found', |
|
| 29 | + 'err_noticket' => 'No ticket found', |
|
| 30 | + 'err_nopair' => 'No valid ticket-stub pair found', |
|
| 31 | + 'err_timeout' => 'Time out', |
|
| 32 | + 'err_areaorref' => 'Invalid area or referer', |
|
| 33 | + 'fmt_prompt4repost' => 'error(s) found:<br /><span style="background-color:red;font-weight:bold;color:white;">%s</span><br />Confirm it.<br />And do you want to post again?', |
|
| 34 | 34 | 'btn_repost' => 'repost' |
| 35 | - ) ; |
|
| 35 | + ); |
|
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // render form as plain html |
| 40 | 40 | public function getTicketHtml($salt = '', $timeout = 1800, $area = '') |
| 41 | 41 | { |
| 42 | - return '<input type="hidden" name="XOOPS_G_TICKET" value="'.$this->issue($salt, $timeout, $area).'" />' ; |
|
| 42 | + return '<input type="hidden" name="XOOPS_G_TICKET" value="'.$this->issue($salt, $timeout, $area).'" />'; |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // returns an object of XoopsFormHidden including theh ticket |
| 46 | 46 | public function getTicketXoopsForm($salt = '', $timeout = 1800, $area = '') |
| 47 | 47 | { |
| 48 | - return new XoopsFormHidden('XOOPS_G_TICKET', $this->issue($salt, $timeout, $area)) ; |
|
| 48 | + return new XoopsFormHidden('XOOPS_G_TICKET', $this->issue($salt, $timeout, $area)); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | // add a ticket as Hidden Element into XoopsForm |
| 52 | 52 | public function addTicketXoopsFormElement(&$form, $salt = '', $timeout = 1800, $area = '') |
| 53 | 53 | { |
| 54 | - $form->addElement(new XoopsFormHidden('XOOPS_G_TICKET', $this->issue($salt, $timeout, $area))) ; |
|
| 54 | + $form->addElement(new XoopsFormHidden('XOOPS_G_TICKET', $this->issue($salt, $timeout, $area))); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | // returns an array for xoops_confirm() ; |
| 58 | 58 | public function getTicketArray($salt = '', $timeout = 1800, $area = '') |
| 59 | 59 | { |
| 60 | - return array( 'XOOPS_G_TICKET' => $this->issue($salt, $timeout, $area) ) ; |
|
| 60 | + return array('XOOPS_G_TICKET' => $this->issue($salt, $timeout, $area)); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // return GET parameter string. |
| 64 | - public function getTicketParamString($salt = '', $noamp = false, $timeout=1800, $area = '') |
|
| 64 | + public function getTicketParamString($salt = '', $noamp = false, $timeout = 1800, $area = '') |
|
| 65 | 65 | { |
| 66 | - return ($noamp ? '' : '&') . 'XOOPS_G_TICKET=' . $this->issue($salt, $timeout, $area) ; |
|
| 66 | + return ($noamp ? '' : '&').'XOOPS_G_TICKET='.$this->issue($salt, $timeout, $area); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | // issue a ticket |
| 70 | 70 | public function issue($salt = '', $timeout = 1800, $area = '') |
| 71 | 71 | { |
| 72 | - global $xoopsModule ; |
|
| 72 | + global $xoopsModule; |
|
| 73 | 73 | |
| 74 | 74 | // create a token |
| 75 | - list($usec, $sec) = explode(' ', microtime()) ; |
|
| 76 | - $appendix_salt = empty($_SERVER['PATH']) ? XOOPS_DB_NAME : $_SERVER['PATH'] ; |
|
| 77 | - $token = crypt($salt . $usec . $appendix_salt . $sec, XOOPS_DB_PREFIX) ; |
|
| 78 | - $this->_latest_token = $token ; |
|
| 75 | + list($usec, $sec) = explode(' ', microtime()); |
|
| 76 | + $appendix_salt = empty($_SERVER['PATH']) ? XOOPS_DB_NAME : $_SERVER['PATH']; |
|
| 77 | + $token = crypt($salt.$usec.$appendix_salt.$sec, XOOPS_DB_PREFIX); |
|
| 78 | + $this->_latest_token = $token; |
|
| 79 | 79 | |
| 80 | 80 | if (empty($_SESSION['XOOPS_G_STUBS'])) { |
| 81 | - $_SESSION['XOOPS_G_STUBS'] = array() ; |
|
| 81 | + $_SESSION['XOOPS_G_STUBS'] = array(); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | // limit max stubs 10 |
| 85 | 85 | if (count($_SESSION['XOOPS_G_STUBS']) > 10) { |
| 86 | - $_SESSION['XOOPS_G_STUBS'] = array_slice($_SESSION['XOOPS_G_STUBS'], -10) ; |
|
| 86 | + $_SESSION['XOOPS_G_STUBS'] = array_slice($_SESSION['XOOPS_G_STUBS'], -10); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | // record referer if browser send it |
| 90 | - $referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['REQUEST_URI'] ; |
|
| 90 | + $referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['REQUEST_URI']; |
|
| 91 | 91 | |
| 92 | 92 | // area as module's dirname |
| 93 | - if (! $area && is_object(@$xoopsModule)) { |
|
| 94 | - $area = $xoopsModule->getVar('dirname') ; |
|
| 93 | + if (!$area && is_object(@$xoopsModule)) { |
|
| 94 | + $area = $xoopsModule->getVar('dirname'); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | // store stub |
| 98 | 98 | $_SESSION['XOOPS_G_STUBS'][] = array( |
| 99 | - 'expire' => time() + $timeout , |
|
| 100 | - 'referer' => $referer , |
|
| 101 | - 'area' => $area , |
|
| 99 | + 'expire' => time() + $timeout, |
|
| 100 | + 'referer' => $referer, |
|
| 101 | + 'area' => $area, |
|
| 102 | 102 | 'token' => $token |
| 103 | - ) ; |
|
| 103 | + ); |
|
| 104 | 104 | |
| 105 | 105 | // paid md5ed token as a ticket |
| 106 | - return md5($token . XOOPS_DB_PREFIX) ; |
|
| 106 | + return md5($token.XOOPS_DB_PREFIX); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | // check a ticket |
| 110 | 110 | public function check($post = true, $area = '', $allow_repost = true) |
| 111 | 111 | { |
| 112 | - global $xoopsModule ; |
|
| 112 | + global $xoopsModule; |
|
| 113 | 113 | |
| 114 | - $this->_errors = array() ; |
|
| 114 | + $this->_errors = array(); |
|
| 115 | 115 | |
| 116 | 116 | // CHECK: stubs are not stored in session |
| 117 | - if (! is_array(@$_SESSION['XOOPS_G_STUBS'])) { |
|
| 118 | - $this->_errors[] = $this->messages['err_nostubs'] ; |
|
| 119 | - $_SESSION['XOOPS_G_STUBS'] = array() ; |
|
| 117 | + if (!is_array(@$_SESSION['XOOPS_G_STUBS'])) { |
|
| 118 | + $this->_errors[] = $this->messages['err_nostubs']; |
|
| 119 | + $_SESSION['XOOPS_G_STUBS'] = array(); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | // get key&val of the ticket from a user's query |
| 123 | - $ticket = $post ? @$_POST['XOOPS_G_TICKET'] : @$_GET['XOOPS_G_TICKET'] ; |
|
| 123 | + $ticket = $post ? @$_POST['XOOPS_G_TICKET'] : @$_GET['XOOPS_G_TICKET']; |
|
| 124 | 124 | |
| 125 | 125 | // CHECK: no tickets found |
| 126 | 126 | if (empty($ticket)) { |
| 127 | - $this->_errors[] = $this->messages['err_noticket'] ; |
|
| 127 | + $this->_errors[] = $this->messages['err_noticket']; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | // gargage collection & find a right stub |
| 131 | - $stubs_tmp = $_SESSION['XOOPS_G_STUBS'] ; |
|
| 132 | - $_SESSION['XOOPS_G_STUBS'] = array() ; |
|
| 131 | + $stubs_tmp = $_SESSION['XOOPS_G_STUBS']; |
|
| 132 | + $_SESSION['XOOPS_G_STUBS'] = array(); |
|
| 133 | 133 | foreach ($stubs_tmp as $stub) { |
| 134 | 134 | // default lifetime 30min |
| 135 | 135 | if ($stub['expire'] >= time()) { |
| 136 | - if (md5($stub['token'] . XOOPS_DB_PREFIX) === $ticket) { |
|
| 137 | - $found_stub = $stub ; |
|
| 136 | + if (md5($stub['token'].XOOPS_DB_PREFIX) === $ticket) { |
|
| 137 | + $found_stub = $stub; |
|
| 138 | 138 | } else { |
| 139 | 139 | // store the other valid stubs into session |
| 140 | - $_SESSION['XOOPS_G_STUBS'][] = $stub ; |
|
| 140 | + $_SESSION['XOOPS_G_STUBS'][] = $stub; |
|
| 141 | 141 | } |
| 142 | 142 | } else { |
| 143 | - if (md5($stub['token'] . XOOPS_DB_PREFIX) === $ticket) { |
|
| 143 | + if (md5($stub['token'].XOOPS_DB_PREFIX) === $ticket) { |
|
| 144 | 144 | // not CSRF but Time-Out |
| 145 | - $timeout_flag = true ; |
|
| 145 | + $timeout_flag = true; |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | } |
@@ -150,40 +150,40 @@ discard block |
||
| 150 | 150 | // CHECK: the right stub found or not |
| 151 | 151 | if (empty($found_stub)) { |
| 152 | 152 | if (empty($timeout_flag)) { |
| 153 | - $this->_errors[] = $this->messages['err_nopair'] ; |
|
| 153 | + $this->_errors[] = $this->messages['err_nopair']; |
|
| 154 | 154 | } else { |
| 155 | - $this->_errors[] = $this->messages['err_timeout'] ; |
|
| 155 | + $this->_errors[] = $this->messages['err_timeout']; |
|
| 156 | 156 | } |
| 157 | 157 | } else { |
| 158 | 158 | |
| 159 | 159 | // set area if necessary |
| 160 | 160 | // area as module's dirname |
| 161 | - if (! $area && is_object(@$xoopsModule)) { |
|
| 162 | - $area = $xoopsModule->getVar('dirname') ; |
|
| 161 | + if (!$area && is_object(@$xoopsModule)) { |
|
| 162 | + $area = $xoopsModule->getVar('dirname'); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // check area or referer |
| 166 | 166 | if (@$found_stub['area'] == $area) { |
| 167 | - $area_check = true ; |
|
| 167 | + $area_check = true; |
|
| 168 | 168 | } |
| 169 | - if (! empty($found_stub['referer']) && strstr(@$_SERVER['HTTP_REFERER'], $found_stub['referer'])) { |
|
| 170 | - $referer_check = true ; |
|
| 169 | + if (!empty($found_stub['referer']) && strstr(@$_SERVER['HTTP_REFERER'], $found_stub['referer'])) { |
|
| 170 | + $referer_check = true; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | if (empty($area_check) && empty($referer_check)) { // loose |
| 174 | - $this->_errors[] = $this->messages['err_areaorref'] ; |
|
| 174 | + $this->_errors[] = $this->messages['err_areaorref']; |
|
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - if (! empty($this->_errors)) { |
|
| 178 | + if (!empty($this->_errors)) { |
|
| 179 | 179 | if ($allow_repost) { |
| 180 | 180 | // repost form |
| 181 | - $this->draw_repost_form($area) ; |
|
| 182 | - exit ; |
|
| 181 | + $this->draw_repost_form($area); |
|
| 182 | + exit; |
|
| 183 | 183 | } else { |
| 184 | 184 | // failed |
| 185 | - $this->clear() ; |
|
| 186 | - return false ; |
|
| 185 | + $this->clear(); |
|
| 186 | + return false; |
|
| 187 | 187 | } |
| 188 | 188 | } else { |
| 189 | 189 | // all green |
@@ -196,78 +196,78 @@ discard block |
||
| 196 | 196 | { |
| 197 | 197 | // Notify which file is broken |
| 198 | 198 | if (headers_sent()) { |
| 199 | - restore_error_handler() ; |
|
| 200 | - set_error_handler(array( &$this, 'errorHandler4FindOutput' )) ; |
|
| 201 | - header('Dummy: for warning') ; |
|
| 202 | - restore_error_handler() ; |
|
| 203 | - exit ; |
|
| 199 | + restore_error_handler(); |
|
| 200 | + set_error_handler(array(&$this, 'errorHandler4FindOutput')); |
|
| 201 | + header('Dummy: for warning'); |
|
| 202 | + restore_error_handler(); |
|
| 203 | + exit; |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - $table = '<table>' ; |
|
| 207 | - $form = '<form action="?'.htmlspecialchars(@$_SERVER['QUERY_STRING'], ENT_QUOTES).'" method="post" >' ; |
|
| 206 | + $table = '<table>'; |
|
| 207 | + $form = '<form action="?'.htmlspecialchars(@$_SERVER['QUERY_STRING'], ENT_QUOTES).'" method="post" >'; |
|
| 208 | 208 | foreach ($_POST as $key => $val) { |
| 209 | 209 | if ($key == 'XOOPS_G_TICKET') { |
| 210 | - continue ; |
|
| 210 | + continue; |
|
| 211 | 211 | } |
| 212 | 212 | if (get_magic_quotes_gpc()) { |
| 213 | - $key = stripslashes($key) ; |
|
| 213 | + $key = stripslashes($key); |
|
| 214 | 214 | } |
| 215 | 215 | if (is_array($val)) { |
| 216 | - list($tmp_table, $tmp_form) = $this->extract_post_recursive(htmlspecialchars($key, ENT_QUOTES), $val) ; |
|
| 217 | - $table .= $tmp_table ; |
|
| 218 | - $form .= $tmp_form ; |
|
| 216 | + list($tmp_table, $tmp_form) = $this->extract_post_recursive(htmlspecialchars($key, ENT_QUOTES), $val); |
|
| 217 | + $table .= $tmp_table; |
|
| 218 | + $form .= $tmp_form; |
|
| 219 | 219 | } else { |
| 220 | 220 | if (get_magic_quotes_gpc()) { |
| 221 | - $val = stripslashes($val) ; |
|
| 221 | + $val = stripslashes($val); |
|
| 222 | 222 | } |
| 223 | - $table .= '<tr><th>'.htmlspecialchars($key, ENT_QUOTES).'</th><td>'.htmlspecialchars($val, ENT_QUOTES).'</td></tr>'."\n" ; |
|
| 224 | - $form .= '<input type="hidden" name="'.htmlspecialchars($key, ENT_QUOTES).'" value="'.htmlspecialchars($val, ENT_QUOTES).'" />'."\n" ; |
|
| 223 | + $table .= '<tr><th>'.htmlspecialchars($key, ENT_QUOTES).'</th><td>'.htmlspecialchars($val, ENT_QUOTES).'</td></tr>'."\n"; |
|
| 224 | + $form .= '<input type="hidden" name="'.htmlspecialchars($key, ENT_QUOTES).'" value="'.htmlspecialchars($val, ENT_QUOTES).'" />'."\n"; |
|
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | - $table .= '</table>' ; |
|
| 228 | - $form .= $this->getTicketHtml(__LINE__, 300, $area).'<input type="submit" value="'.$this->messages['btn_repost'].'" /></form>' ; |
|
| 227 | + $table .= '</table>'; |
|
| 228 | + $form .= $this->getTicketHtml(__LINE__, 300, $area).'<input type="submit" value="'.$this->messages['btn_repost'].'" /></form>'; |
|
| 229 | 229 | |
| 230 | - error_reporting(0) ; |
|
| 230 | + error_reporting(0); |
|
| 231 | 231 | while (@ob_get_level() && @ob_end_clean()); |
| 232 | 232 | |
| 233 | - echo '<html><head><title>'.$this->messages['err_general'].'</title><style>table,td,th {border:solid black 1px; border-collapse:collapse;}</style></head><body>' . sprintf($this->messages['fmt_prompt4repost'], $this->getErrors()) . $table . $form . '</body></html>' ; |
|
| 233 | + echo '<html><head><title>'.$this->messages['err_general'].'</title><style>table,td,th {border:solid black 1px; border-collapse:collapse;}</style></head><body>'.sprintf($this->messages['fmt_prompt4repost'], $this->getErrors()).$table.$form.'</body></html>'; |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | public function extract_post_recursive($key_name, $tmp_array) |
| 237 | 237 | { |
| 238 | - $table = '' ; |
|
| 239 | - $form = '' ; |
|
| 238 | + $table = ''; |
|
| 239 | + $form = ''; |
|
| 240 | 240 | foreach ($tmp_array as $key => $val) { |
| 241 | 241 | if (get_magic_quotes_gpc()) { |
| 242 | - $key = stripslashes($key) ; |
|
| 242 | + $key = stripslashes($key); |
|
| 243 | 243 | } |
| 244 | 244 | if (is_array($val)) { |
| 245 | - list($tmp_table, $tmp_form) = $this->extract_post_recursive($key_name.'['.htmlspecialchars($key, ENT_QUOTES).']', $val) ; |
|
| 246 | - $table .= $tmp_table ; |
|
| 247 | - $form .= $tmp_form ; |
|
| 245 | + list($tmp_table, $tmp_form) = $this->extract_post_recursive($key_name.'['.htmlspecialchars($key, ENT_QUOTES).']', $val); |
|
| 246 | + $table .= $tmp_table; |
|
| 247 | + $form .= $tmp_form; |
|
| 248 | 248 | } else { |
| 249 | 249 | if (get_magic_quotes_gpc()) { |
| 250 | - $val = stripslashes($val) ; |
|
| 250 | + $val = stripslashes($val); |
|
| 251 | 251 | } |
| 252 | - $table .= '<tr><th>'.$key_name.'['.htmlspecialchars($key, ENT_QUOTES).']</th><td>'.htmlspecialchars($val, ENT_QUOTES).'</td></tr>'."\n" ; |
|
| 253 | - $form .= '<input type="hidden" name="'.$key_name.'['.htmlspecialchars($key, ENT_QUOTES).']" value="'.htmlspecialchars($val, ENT_QUOTES).'" />'."\n" ; |
|
| 252 | + $table .= '<tr><th>'.$key_name.'['.htmlspecialchars($key, ENT_QUOTES).']</th><td>'.htmlspecialchars($val, ENT_QUOTES).'</td></tr>'."\n"; |
|
| 253 | + $form .= '<input type="hidden" name="'.$key_name.'['.htmlspecialchars($key, ENT_QUOTES).']" value="'.htmlspecialchars($val, ENT_QUOTES).'" />'."\n"; |
|
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | - return array( $table , $form ) ; |
|
| 256 | + return array($table, $form); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | |
| 260 | 260 | // clear all stubs |
| 261 | 261 | public function clear() |
| 262 | 262 | { |
| 263 | - $_SESSION['XOOPS_G_STUBS'] = array() ; |
|
| 263 | + $_SESSION['XOOPS_G_STUBS'] = array(); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | |
| 267 | 267 | // Ticket Using |
| 268 | 268 | public function using() |
| 269 | 269 | { |
| 270 | - if (! empty($_SESSION['XOOPS_G_STUBS'])) { |
|
| 270 | + if (!empty($_SESSION['XOOPS_G_STUBS'])) { |
|
| 271 | 271 | return true; |
| 272 | 272 | } else { |
| 273 | 273 | return false; |
@@ -279,39 +279,39 @@ discard block |
||
| 279 | 279 | public function getErrors($ashtml = true) |
| 280 | 280 | { |
| 281 | 281 | if ($ashtml) { |
| 282 | - $ret = '' ; |
|
| 282 | + $ret = ''; |
|
| 283 | 283 | foreach ($this->_errors as $msg) { |
| 284 | - $ret .= "$msg<br />\n" ; |
|
| 284 | + $ret .= "$msg<br />\n"; |
|
| 285 | 285 | } |
| 286 | 286 | } else { |
| 287 | - $ret = $this->_errors ; |
|
| 287 | + $ret = $this->_errors; |
|
| 288 | 288 | } |
| 289 | - return $ret ; |
|
| 289 | + return $ret; |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | public function errorHandler4FindOutput($errNo, $errStr, $errFile, $errLine) |
| 293 | 293 | { |
| 294 | 294 | if (preg_match('?'.preg_quote(XOOPS_ROOT_PATH).'([^:]+)\:(\d+)?', $errStr, $regs)) { |
| 295 | - echo 'Irregular output! check the file ' . htmlspecialchars($regs[1]) . ' line ' . htmlspecialchars($regs[2]) ; |
|
| 295 | + echo 'Irregular output! check the file '.htmlspecialchars($regs[1]).' line '.htmlspecialchars($regs[2]); |
|
| 296 | 296 | } else { |
| 297 | 297 | echo 'Irregular output! check language files etc.'; |
| 298 | 298 | } |
| 299 | - return ; |
|
| 299 | + return; |
|
| 300 | 300 | } |
| 301 | 301 | // end of class |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | // create a instance in global scope |
| 305 | -$GLOBALS['xoopsGTicket'] = new XoopsGTicket() ; |
|
| 305 | +$GLOBALS['xoopsGTicket'] = new XoopsGTicket(); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | -if (! function_exists('admin_refcheck')) { |
|
| 308 | +if (!function_exists('admin_refcheck')) { |
|
| 309 | 309 | |
| 310 | 310 | //Admin Referer Check By Marijuana(Rev.011) |
| 311 | 311 | function admin_refcheck($chkref = '') |
| 312 | 312 | { |
| 313 | 313 | if (empty($_SERVER['HTTP_REFERER'])) { |
| 314 | - return true ; |
|
| 314 | + return true; |
|
| 315 | 315 | } else { |
| 316 | 316 | $ref = $_SERVER['HTTP_REFERER']; |
| 317 | 317 | } |
@@ -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 | } |
@@ -1240,7 +1240,7 @@ discard block |
||
| 1240 | 1240 | */ |
| 1241 | 1241 | public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_params) |
| 1242 | 1242 | { |
| 1243 | - $v_result=1; |
|
| 1243 | + $v_result = 1; |
|
| 1244 | 1244 | |
| 1245 | 1245 | if ($p_filename == '') { |
| 1246 | 1246 | // ----- Error log |
@@ -1265,7 +1265,7 @@ discard block |
||
| 1265 | 1265 | |
| 1266 | 1266 | if ((substr($p_filename, 0, 2) == './') || (substr($p_remove_dir, 0, 2) == './')) { |
| 1267 | 1267 | if ((substr($p_filename, 0, 2) == './') && (substr($p_remove_dir, 0, 2) != './')) { |
| 1268 | - $p_remove_dir = './' . $p_remove_dir; |
|
| 1268 | + $p_remove_dir = './'.$p_remove_dir; |
|
| 1269 | 1269 | } |
| 1270 | 1270 | if ((substr($p_filename, 0, 2) != './') && (substr($p_remove_dir, 0, 2) == './')) { |
| 1271 | 1271 | $p_remove_dir = substr($p_remove_dir, 2); |
@@ -1289,7 +1289,7 @@ discard block |
||
| 1289 | 1289 | if (substr($p_add_dir, -1) == '/') { |
| 1290 | 1290 | $v_stored_filename = $p_add_dir.$v_stored_filename; |
| 1291 | 1291 | } else { |
| 1292 | - $v_stored_filename = $p_add_dir . '/' . $v_stored_filename; |
|
| 1292 | + $v_stored_filename = $p_add_dir.'/'.$v_stored_filename; |
|
| 1293 | 1293 | } |
| 1294 | 1294 | } |
| 1295 | 1295 | |
@@ -1324,7 +1324,7 @@ discard block |
||
| 1324 | 1324 | $p_header['comment_len'] = 0; |
| 1325 | 1325 | $p_header['disk'] = 0; |
| 1326 | 1326 | $p_header['internal'] = 0; |
| 1327 | - $p_header['external'] = (is_file($p_filename)?0xFE49FFE0:0x41FF0010); |
|
| 1327 | + $p_header['external'] = (is_file($p_filename) ? 0xFE49FFE0 : 0x41FF0010); |
|
| 1328 | 1328 | $p_header['offset'] = 0; |
| 1329 | 1329 | $p_header['filename'] = $p_filename; |
| 1330 | 1330 | $p_header['stored_filename'] = $v_stored_filename; |
@@ -1420,7 +1420,7 @@ discard block |
||
| 1420 | 1420 | $p_header['filename'] .= '/'; |
| 1421 | 1421 | $p_header['filename_len']++; |
| 1422 | 1422 | $p_header['size'] = 0; |
| 1423 | - $p_header['external'] = 0x41FF0010; // Value for a folder : to be checked |
|
| 1423 | + $p_header['external'] = 0x41FF0010; // Value for a folder : to be checked |
|
| 1424 | 1424 | |
| 1425 | 1425 | // ----- Call the header generation |
| 1426 | 1426 | if (($v_result = $this->_writeFileHeader($p_header)) != 1) { |
@@ -1469,7 +1469,7 @@ discard block |
||
| 1469 | 1469 | */ |
| 1470 | 1470 | public function _writeFileHeader(&$p_header) |
| 1471 | 1471 | { |
| 1472 | - $v_result=1; |
|
| 1472 | + $v_result = 1; |
|
| 1473 | 1473 | |
| 1474 | 1474 | // TBC |
| 1475 | 1475 | //for(reset($p_header); $key = key($p_header); next($p_header)) { |
@@ -1480,8 +1480,8 @@ discard block |
||
| 1480 | 1480 | |
| 1481 | 1481 | // ----- Transform UNIX mtime to DOS format mdate/mtime |
| 1482 | 1482 | $v_date = getdate($p_header['mtime']); |
| 1483 | - $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; |
|
| 1484 | - $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; |
|
| 1483 | + $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2; |
|
| 1484 | + $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday']; |
|
| 1485 | 1485 | |
| 1486 | 1486 | // ----- Packed data |
| 1487 | 1487 | $v_binary_data = pack('VvvvvvVVVvv', 0x04034b50, $p_header['version'], $p_header['flag'], |
@@ -1519,7 +1519,7 @@ discard block |
||
| 1519 | 1519 | */ |
| 1520 | 1520 | public function _writeCentralFileHeader(&$p_header) |
| 1521 | 1521 | { |
| 1522 | - $v_result=1; |
|
| 1522 | + $v_result = 1; |
|
| 1523 | 1523 | |
| 1524 | 1524 | // TBC |
| 1525 | 1525 | //for(reset($p_header); $key = key($p_header); next($p_header)) { |
@@ -1527,8 +1527,8 @@ discard block |
||
| 1527 | 1527 | |
| 1528 | 1528 | // ----- Transform UNIX mtime to DOS format mdate/mtime |
| 1529 | 1529 | $v_date = getdate($p_header['mtime']); |
| 1530 | - $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2; |
|
| 1531 | - $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday']; |
|
| 1530 | + $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2; |
|
| 1531 | + $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday']; |
|
| 1532 | 1532 | |
| 1533 | 1533 | // ----- Packed data |
| 1534 | 1534 | $v_binary_data = pack('VvvvvvvVVVvvvvvVV', 0x02014b50, $p_header['version'], $p_header['version_extracted'], |
@@ -1570,7 +1570,7 @@ discard block |
||
| 1570 | 1570 | */ |
| 1571 | 1571 | public function _writeCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment) |
| 1572 | 1572 | { |
| 1573 | - $v_result=1; |
|
| 1573 | + $v_result = 1; |
|
| 1574 | 1574 | |
| 1575 | 1575 | // ----- Packed data |
| 1576 | 1576 | $v_binary_data = pack('VvvvvVVv', 0x06054b50, 0, 0, $p_nb_entries, $p_nb_entries, $p_size, $p_offset, strlen($p_comment)); |
@@ -1602,7 +1602,7 @@ discard block |
||
| 1602 | 1602 | */ |
| 1603 | 1603 | public function _list(&$p_list) |
| 1604 | 1604 | { |
| 1605 | - $v_result=1; |
|
| 1605 | + $v_result = 1; |
|
| 1606 | 1606 | |
| 1607 | 1607 | // ----- Open the zip file |
| 1608 | 1608 | if (($this->_zip_fd = @fopen($this->_zipname, 'rb')) == 0) { |
@@ -1630,7 +1630,7 @@ discard block |
||
| 1630 | 1630 | } |
| 1631 | 1631 | |
| 1632 | 1632 | // ----- Read each entry |
| 1633 | - for ($i=0; $i<$v_central_dir['entries']; $i++) { |
|
| 1633 | + for ($i = 0; $i < $v_central_dir['entries']; $i++) { |
|
| 1634 | 1634 | // ----- Read the file header |
| 1635 | 1635 | if (($v_result = $this->_readCentralFileHeader($v_header)) != 1) { |
| 1636 | 1636 | return $v_result; |
@@ -1676,7 +1676,7 @@ discard block |
||
| 1676 | 1676 | */ |
| 1677 | 1677 | public function _convertHeader2FileInfo($p_header, &$p_info) |
| 1678 | 1678 | { |
| 1679 | - $v_result=1; |
|
| 1679 | + $v_result = 1; |
|
| 1680 | 1680 | |
| 1681 | 1681 | // ----- Get the interesting attributes |
| 1682 | 1682 | $p_info['filename'] = $p_header['filename']; |
@@ -1685,7 +1685,7 @@ discard block |
||
| 1685 | 1685 | $p_info['compressed_size'] = $p_header['compressed_size']; |
| 1686 | 1686 | $p_info['mtime'] = $p_header['mtime']; |
| 1687 | 1687 | $p_info['comment'] = $p_header['comment']; |
| 1688 | - $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010); |
|
| 1688 | + $p_info['folder'] = (($p_header['external'] & 0x00000010) == 0x00000010); |
|
| 1689 | 1689 | $p_info['index'] = $p_header['index']; |
| 1690 | 1690 | $p_info['status'] = $p_header['status']; |
| 1691 | 1691 | |
@@ -1718,7 +1718,7 @@ discard block |
||
| 1718 | 1718 | */ |
| 1719 | 1719 | public function _extractByRule(&$p_file_list, &$p_params) |
| 1720 | 1720 | { |
| 1721 | - $v_result=1; |
|
| 1721 | + $v_result = 1; |
|
| 1722 | 1722 | |
| 1723 | 1723 | $p_path = $p_params['add_path']; |
| 1724 | 1724 | $p_remove_path = $p_params['remove_path']; |
@@ -1728,14 +1728,14 @@ discard block |
||
| 1728 | 1728 | if (($p_path == '') |
| 1729 | 1729 | || ((substr($p_path, 0, 1) != '/') |
| 1730 | 1730 | && (substr($p_path, 0, 3) != '../') && (substr($p_path, 1, 2) != ':/'))) { |
| 1731 | - $p_path = './' . $p_path; |
|
| 1731 | + $p_path = './'.$p_path; |
|
| 1732 | 1732 | } |
| 1733 | 1733 | |
| 1734 | 1734 | // ----- Reduce the path last (and duplicated) '/' |
| 1735 | 1735 | if (($p_path != './') && ($p_path != '/')) { |
| 1736 | 1736 | // ----- Look for the path end '/' |
| 1737 | 1737 | while (substr($p_path, -1) == '/') { |
| 1738 | - $p_path = substr($p_path, 0, strlen($p_path)-1); |
|
| 1738 | + $p_path = substr($p_path, 0, strlen($p_path) - 1); |
|
| 1739 | 1739 | } |
| 1740 | 1740 | } |
| 1741 | 1741 | |
@@ -1764,7 +1764,7 @@ discard block |
||
| 1764 | 1764 | |
| 1765 | 1765 | // ----- Read each entry |
| 1766 | 1766 | $j_start = 0; |
| 1767 | - for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) { |
|
| 1767 | + for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++) { |
|
| 1768 | 1768 | // ----- Read next Central dir entry |
| 1769 | 1769 | @rewind($this->_zip_fd); |
| 1770 | 1770 | if (@fseek($this->_zip_fd, $v_pos_entry)) { |
@@ -1798,7 +1798,7 @@ discard block |
||
| 1798 | 1798 | && ($p_params[ARCHIVE_ZIP_PARAM_BY_NAME] != 0)) { |
| 1799 | 1799 | |
| 1800 | 1800 | // ----- Look if the filename is in the list |
| 1801 | - for ($j=0; |
|
| 1801 | + for ($j = 0; |
|
| 1802 | 1802 | ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_NAME])) |
| 1803 | 1803 | && (!$v_extract); |
| 1804 | 1804 | $j++) { |
@@ -1840,15 +1840,15 @@ discard block |
||
| 1840 | 1840 | && ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX] != 0)) { |
| 1841 | 1841 | |
| 1842 | 1842 | // ----- Look if the index is in the list |
| 1843 | - for ($j=$j_start; ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) && (!$v_extract); $j++) { |
|
| 1844 | - if (($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']) && ($i<=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) { |
|
| 1843 | + for ($j = $j_start; ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) && (!$v_extract); $j++) { |
|
| 1844 | + if (($i >= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']) && ($i <= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) { |
|
| 1845 | 1845 | $v_extract = true; |
| 1846 | 1846 | } |
| 1847 | - if ($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) { |
|
| 1848 | - $j_start = $j+1; |
|
| 1847 | + if ($i >= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) { |
|
| 1848 | + $j_start = $j + 1; |
|
| 1849 | 1849 | } |
| 1850 | 1850 | |
| 1851 | - if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']>$i) { |
|
| 1851 | + if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start'] > $i) { |
|
| 1852 | 1852 | break; |
| 1853 | 1853 | } |
| 1854 | 1854 | } |
@@ -1942,7 +1942,7 @@ discard block |
||
| 1942 | 1942 | */ |
| 1943 | 1943 | public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_params) |
| 1944 | 1944 | { |
| 1945 | - $v_result=1; |
|
| 1945 | + $v_result = 1; |
|
| 1946 | 1946 | |
| 1947 | 1947 | // ----- Read the file header |
| 1948 | 1948 | if (($v_result = $this->_readFileHeader($v_header)) != 1) { |
@@ -1982,7 +1982,7 @@ discard block |
||
| 1982 | 1982 | |
| 1983 | 1983 | // ----- Add the path |
| 1984 | 1984 | if ($p_path != '') { |
| 1985 | - $p_entry['filename'] = $p_path . '/' . $p_entry['filename']; |
|
| 1985 | + $p_entry['filename'] = $p_path.'/'.$p_entry['filename']; |
|
| 1986 | 1986 | } |
| 1987 | 1987 | |
| 1988 | 1988 | // ----- Look for pre-extract callback |
@@ -2048,7 +2048,7 @@ discard block |
||
| 2048 | 2048 | |
| 2049 | 2049 | // ----- Check the directory availability and create it if necessary |
| 2050 | 2050 | else { |
| 2051 | - if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/')) { |
|
| 2051 | + if ((($p_entry['external'] & 0x00000010) == 0x00000010) || (substr($p_entry['filename'], -1) == '/')) { |
|
| 2052 | 2052 | $v_dir_to_check = $p_entry['filename']; |
| 2053 | 2053 | } elseif (!strstr($p_entry['filename'], '/')) { |
| 2054 | 2054 | $v_dir_to_check = ''; |
@@ -2072,7 +2072,7 @@ discard block |
||
| 2072 | 2072 | if ($p_entry['status'] == 'ok') { |
| 2073 | 2073 | |
| 2074 | 2074 | // ----- Do the extraction (if not a folder) |
| 2075 | - if (!(($p_entry['external']&0x00000010)==0x00000010)) { |
|
| 2075 | + if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) { |
|
| 2076 | 2076 | |
| 2077 | 2077 | // ----- Look for not compressed file |
| 2078 | 2078 | if ($p_entry['compressed_size'] == $p_entry['size']) { |
@@ -2177,7 +2177,7 @@ discard block |
||
| 2177 | 2177 | */ |
| 2178 | 2178 | public function _extractFileAsString(&$p_entry, &$p_string) |
| 2179 | 2179 | { |
| 2180 | - $v_result=1; |
|
| 2180 | + $v_result = 1; |
|
| 2181 | 2181 | |
| 2182 | 2182 | // ----- Read the file header |
| 2183 | 2183 | $v_header = array(); |
@@ -2193,7 +2193,7 @@ discard block |
||
| 2193 | 2193 | // ----- Trace |
| 2194 | 2194 | |
| 2195 | 2195 | // ----- Do the extraction (if not a folder) |
| 2196 | - if (!(($p_entry['external']&0x00000010)==0x00000010)) { |
|
| 2196 | + if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) { |
|
| 2197 | 2197 | // ----- Look for not compressed file |
| 2198 | 2198 | if ($p_entry['compressed_size'] == $p_entry['size']) { |
| 2199 | 2199 | // ----- Trace |
@@ -2234,7 +2234,7 @@ discard block |
||
| 2234 | 2234 | */ |
| 2235 | 2235 | public function _readFileHeader(&$p_header) |
| 2236 | 2236 | { |
| 2237 | - $v_result=1; |
|
| 2237 | + $v_result = 1; |
|
| 2238 | 2238 | |
| 2239 | 2239 | // ----- Read the 4 bytes signature |
| 2240 | 2240 | $v_binary_data = @fread($this->_zip_fd, 4); |
@@ -2259,7 +2259,7 @@ discard block |
||
| 2259 | 2259 | $p_header['status'] = 'invalid_header'; |
| 2260 | 2260 | |
| 2261 | 2261 | // ----- Error log |
| 2262 | - $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : ' . strlen($v_binary_data)); |
|
| 2262 | + $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : '.strlen($v_binary_data)); |
|
| 2263 | 2263 | |
| 2264 | 2264 | // ----- Return |
| 2265 | 2265 | return Archive_Zip::errorCode(); |
@@ -2292,7 +2292,7 @@ discard block |
||
| 2292 | 2292 | // ----- Extract time |
| 2293 | 2293 | $v_hour = ($p_header['mtime'] & 0xF800) >> 11; |
| 2294 | 2294 | $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; |
| 2295 | - $v_seconde = ($p_header['mtime'] & 0x001F)*2; |
|
| 2295 | + $v_seconde = ($p_header['mtime'] & 0x001F) * 2; |
|
| 2296 | 2296 | |
| 2297 | 2297 | // ----- Extract date |
| 2298 | 2298 | $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; |
@@ -2336,7 +2336,7 @@ discard block |
||
| 2336 | 2336 | */ |
| 2337 | 2337 | public function _readCentralFileHeader(&$p_header) |
| 2338 | 2338 | { |
| 2339 | - $v_result=1; |
|
| 2339 | + $v_result = 1; |
|
| 2340 | 2340 | |
| 2341 | 2341 | // ----- Read the 4 bytes signature |
| 2342 | 2342 | $v_binary_data = @fread($this->_zip_fd, 4); |
@@ -2361,7 +2361,7 @@ discard block |
||
| 2361 | 2361 | $p_header['status'] = 'invalid_header'; |
| 2362 | 2362 | |
| 2363 | 2363 | // ----- Error log |
| 2364 | - $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : ' . strlen($v_binary_data)); |
|
| 2364 | + $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : '.strlen($v_binary_data)); |
|
| 2365 | 2365 | |
| 2366 | 2366 | // ----- Return |
| 2367 | 2367 | return Archive_Zip::errorCode(); |
@@ -2398,7 +2398,7 @@ discard block |
||
| 2398 | 2398 | // ----- Extract time |
| 2399 | 2399 | $v_hour = ($p_header['mtime'] & 0xF800) >> 11; |
| 2400 | 2400 | $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; |
| 2401 | - $v_seconde = ($p_header['mtime'] & 0x001F)*2; |
|
| 2401 | + $v_seconde = ($p_header['mtime'] & 0x001F) * 2; |
|
| 2402 | 2402 | |
| 2403 | 2403 | // ----- Extract date |
| 2404 | 2404 | $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; |
@@ -2442,7 +2442,7 @@ discard block |
||
| 2442 | 2442 | */ |
| 2443 | 2443 | public function _readEndCentralDir(&$p_central_dir) |
| 2444 | 2444 | { |
| 2445 | - $v_result=1; |
|
| 2445 | + $v_result = 1; |
|
| 2446 | 2446 | |
| 2447 | 2447 | // ----- Go to the end of the zip file |
| 2448 | 2448 | $v_size = filesize($this->_zipname); |
@@ -2459,8 +2459,8 @@ discard block |
||
| 2459 | 2459 | // in this case the end of central dir is at 22 bytes of the file end |
| 2460 | 2460 | $v_found = 0; |
| 2461 | 2461 | if ($v_size > 26) { |
| 2462 | - @fseek($this->_zip_fd, $v_size-22); |
|
| 2463 | - if (($v_pos = @ftell($this->_zip_fd)) != ($v_size-22)) { |
|
| 2462 | + @fseek($this->_zip_fd, $v_size - 22); |
|
| 2463 | + if (($v_pos = @ftell($this->_zip_fd)) != ($v_size - 22)) { |
|
| 2464 | 2464 | $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, |
| 2465 | 2465 | 'Unable to seek back to the middle of the archive \'' |
| 2466 | 2466 | .$this->_zipname.'\''); |
@@ -2485,8 +2485,8 @@ discard block |
||
| 2485 | 2485 | if ($v_maximum_size > $v_size) { |
| 2486 | 2486 | $v_maximum_size = $v_size; |
| 2487 | 2487 | } |
| 2488 | - @fseek($this->_zip_fd, $v_size-$v_maximum_size); |
|
| 2489 | - if (@ftell($this->_zip_fd) != ($v_size-$v_maximum_size)) { |
|
| 2488 | + @fseek($this->_zip_fd, $v_size - $v_maximum_size); |
|
| 2489 | + if (@ftell($this->_zip_fd) != ($v_size - $v_maximum_size)) { |
|
| 2490 | 2490 | $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, |
| 2491 | 2491 | 'Unable to seek back to the middle of the archive \'' |
| 2492 | 2492 | .$this->_zipname.'\''); |
@@ -2572,11 +2572,11 @@ discard block |
||
| 2572 | 2572 | */ |
| 2573 | 2573 | public function _deleteByRule(&$p_result_list, &$p_params) |
| 2574 | 2574 | { |
| 2575 | - $v_result=1; |
|
| 2575 | + $v_result = 1; |
|
| 2576 | 2576 | $v_list_detail = array(); |
| 2577 | 2577 | |
| 2578 | 2578 | // ----- Open the zip file |
| 2579 | - if (($v_result=$this->_openFd('rb')) != 1) { |
|
| 2579 | + if (($v_result = $this->_openFd('rb')) != 1) { |
|
| 2580 | 2580 | // ----- Return |
| 2581 | 2581 | return $v_result; |
| 2582 | 2582 | } |
@@ -2607,7 +2607,7 @@ discard block |
||
| 2607 | 2607 | // ----- Read each entry |
| 2608 | 2608 | $v_header_list = array(); |
| 2609 | 2609 | $j_start = 0; |
| 2610 | - for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) { |
|
| 2610 | + for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++) { |
|
| 2611 | 2611 | |
| 2612 | 2612 | // ----- Read the file header |
| 2613 | 2613 | $v_header_list[$v_nb_extracted] = array(); |
@@ -2631,7 +2631,7 @@ discard block |
||
| 2631 | 2631 | && ($p_params[ARCHIVE_ZIP_PARAM_BY_NAME] != 0)) { |
| 2632 | 2632 | |
| 2633 | 2633 | // ----- Look if the filename is in the list |
| 2634 | - for ($j=0; |
|
| 2634 | + for ($j = 0; |
|
| 2635 | 2635 | ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_NAME])) |
| 2636 | 2636 | && (!$v_found); |
| 2637 | 2637 | $j++) { |
@@ -2643,7 +2643,7 @@ discard block |
||
| 2643 | 2643 | if ((strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) |
| 2644 | 2644 | && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) == $p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) { |
| 2645 | 2645 | $v_found = true; |
| 2646 | - } elseif ((($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */ |
|
| 2646 | + } elseif ((($v_header_list[$v_nb_extracted]['external'] & 0x00000010) == 0x00000010) /* Indicates a folder */ |
|
| 2647 | 2647 | && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) { |
| 2648 | 2648 | $v_found = true; |
| 2649 | 2649 | } |
@@ -2679,19 +2679,19 @@ discard block |
||
| 2679 | 2679 | && ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX] != 0)) { |
| 2680 | 2680 | |
| 2681 | 2681 | // ----- Look if the index is in the list |
| 2682 | - for ($j=$j_start; |
|
| 2682 | + for ($j = $j_start; |
|
| 2683 | 2683 | ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) |
| 2684 | 2684 | && (!$v_found); |
| 2685 | 2685 | $j++) { |
| 2686 | - if (($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']) |
|
| 2687 | - && ($i<=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) { |
|
| 2686 | + if (($i >= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']) |
|
| 2687 | + && ($i <= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) { |
|
| 2688 | 2688 | $v_found = true; |
| 2689 | 2689 | } |
| 2690 | - if ($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) { |
|
| 2691 | - $j_start = $j+1; |
|
| 2690 | + if ($i >= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) { |
|
| 2691 | + $j_start = $j + 1; |
|
| 2692 | 2692 | } |
| 2693 | 2693 | |
| 2694 | - if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']>$i) { |
|
| 2694 | + if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start'] > $i) { |
|
| 2695 | 2695 | break; |
| 2696 | 2696 | } |
| 2697 | 2697 | } |
@@ -2724,11 +2724,11 @@ discard block |
||
| 2724 | 2724 | } |
| 2725 | 2725 | |
| 2726 | 2726 | // ----- Look which file need to be kept |
| 2727 | - for ($i=0; $i < count($v_header_list); $i++) { |
|
| 2727 | + for ($i = 0; $i < count($v_header_list); $i++) { |
|
| 2728 | 2728 | |
| 2729 | 2729 | // ----- Calculate the position of the header |
| 2730 | 2730 | @rewind($this->_zip_fd); |
| 2731 | - if (@fseek($this->_zip_fd, $v_header_list[$i]['offset'])) { |
|
| 2731 | + if (@fseek($this->_zip_fd, $v_header_list[$i]['offset'])) { |
|
| 2732 | 2732 | // ----- Clean |
| 2733 | 2733 | $this->_closeFd(); |
| 2734 | 2734 | $v_temp_zip->_closeFd(); |
@@ -2778,9 +2778,9 @@ discard block |
||
| 2778 | 2778 | $v_offset = @ftell($v_temp_zip->_zip_fd); |
| 2779 | 2779 | |
| 2780 | 2780 | // ----- Re-Create the Central Dir files header |
| 2781 | - for ($i=0; $i < count($v_header_list); $i++) { |
|
| 2781 | + for ($i = 0; $i < count($v_header_list); $i++) { |
|
| 2782 | 2782 | // ----- Create the file header |
| 2783 | - $v_result=$v_temp_zip->_writeCentralFileHeader($v_header_list[$i]); |
|
| 2783 | + $v_result = $v_temp_zip->_writeCentralFileHeader($v_header_list[$i]); |
|
| 2784 | 2784 | if ($v_result != 1) { |
| 2785 | 2785 | // ----- Clean |
| 2786 | 2786 | $v_temp_zip->_closeFd(); |
@@ -2800,7 +2800,7 @@ discard block |
||
| 2800 | 2800 | $v_comment = ''; |
| 2801 | 2801 | |
| 2802 | 2802 | // ----- Calculate the size of the central header |
| 2803 | - $v_size = @ftell($v_temp_zip->_zip_fd)-$v_offset; |
|
| 2803 | + $v_size = @ftell($v_temp_zip->_zip_fd) - $v_offset; |
|
| 2804 | 2804 | |
| 2805 | 2805 | // ----- Create the central dir footer |
| 2806 | 2806 | $v_result = $v_temp_zip->_writeCentralHeader(count($v_header_list), |
@@ -2856,13 +2856,13 @@ discard block |
||
| 2856 | 2856 | * |
| 2857 | 2857 | * @param [type] $p_is_dir |
| 2858 | 2858 | */ |
| 2859 | - public function _dirCheck($p_dir, $p_is_dir=false) |
|
| 2859 | + public function _dirCheck($p_dir, $p_is_dir = false) |
|
| 2860 | 2860 | { |
| 2861 | 2861 | $v_result = 1; |
| 2862 | 2862 | |
| 2863 | 2863 | // ----- Remove the final '/' |
| 2864 | 2864 | if ($p_is_dir && (substr($p_dir, -1) == '/')) { |
| 2865 | - $p_dir = substr($p_dir, 0, strlen($p_dir)-1); |
|
| 2865 | + $p_dir = substr($p_dir, 0, strlen($p_dir) - 1); |
|
| 2866 | 2866 | } |
| 2867 | 2867 | |
| 2868 | 2868 | // ----- Check the directory availability |
@@ -2910,7 +2910,7 @@ discard block |
||
| 2910 | 2910 | */ |
| 2911 | 2911 | public function _merge(&$p_archive_to_add) |
| 2912 | 2912 | { |
| 2913 | - $v_result=1; |
|
| 2913 | + $v_result = 1; |
|
| 2914 | 2914 | |
| 2915 | 2915 | // ----- Look if the archive_to_add exists |
| 2916 | 2916 | if (!is_file($p_archive_to_add->_zipname)) { |
@@ -2927,7 +2927,7 @@ discard block |
||
| 2927 | 2927 | } |
| 2928 | 2928 | |
| 2929 | 2929 | // ----- Open the zip file |
| 2930 | - if (($v_result=$this->_openFd('rb')) != 1) { |
|
| 2930 | + if (($v_result = $this->_openFd('rb')) != 1) { |
|
| 2931 | 2931 | return $v_result; |
| 2932 | 2932 | } |
| 2933 | 2933 | |
@@ -2942,7 +2942,7 @@ discard block |
||
| 2942 | 2942 | @rewind($this->_zip_fd); |
| 2943 | 2943 | |
| 2944 | 2944 | // ----- Open the archive_to_add file |
| 2945 | - if (($v_result=$p_archive_to_add->_openFd('rb')) != 1) { |
|
| 2945 | + if (($v_result = $p_archive_to_add->_openFd('rb')) != 1) { |
|
| 2946 | 2946 | $this->_closeFd(); |
| 2947 | 2947 | return $v_result; |
| 2948 | 2948 | } |
@@ -3022,7 +3022,7 @@ discard block |
||
| 3022 | 3022 | $v_comment = ''; |
| 3023 | 3023 | |
| 3024 | 3024 | // ----- Calculate the size of the (new) central header |
| 3025 | - $v_size = @ftell($v_zip_temp_fd)-$v_offset; |
|
| 3025 | + $v_size = @ftell($v_zip_temp_fd) - $v_offset; |
|
| 3026 | 3026 | |
| 3027 | 3027 | // ----- Swap the file descriptor |
| 3028 | 3028 | // Here is a trick : I swap the temporary fd with the zip fd, in order to use |
@@ -3088,7 +3088,7 @@ discard block |
||
| 3088 | 3088 | */ |
| 3089 | 3089 | public function _duplicate($p_archive_filename) |
| 3090 | 3090 | { |
| 3091 | - $v_result=1; |
|
| 3091 | + $v_result = 1; |
|
| 3092 | 3092 | |
| 3093 | 3093 | // ----- Look if the $p_archive_filename exists |
| 3094 | 3094 | if (!is_file($p_archive_filename)) { |
@@ -3101,7 +3101,7 @@ discard block |
||
| 3101 | 3101 | } |
| 3102 | 3102 | |
| 3103 | 3103 | // ----- Open the zip file |
| 3104 | - if (($v_result=$this->_openFd('wb')) != 1) { |
|
| 3104 | + if (($v_result = $this->_openFd('wb')) != 1) { |
|
| 3105 | 3105 | // ----- Return |
| 3106 | 3106 | return $v_result; |
| 3107 | 3107 | } |
@@ -3175,8 +3175,8 @@ discard block |
||
| 3175 | 3175 | // ----- Check specific parameters |
| 3176 | 3176 | $v_callback_list = array('callback_pre_add', 'callback_post_add', |
| 3177 | 3177 | 'callback_pre_extract', 'callback_post_extract'); |
| 3178 | - for ($i=0; $i < count($v_callback_list); $i++) { |
|
| 3179 | - $v_key=$v_callback_list[$i]; |
|
| 3178 | + for ($i = 0; $i < count($v_callback_list); $i++) { |
|
| 3179 | + $v_key = $v_callback_list[$i]; |
|
| 3180 | 3180 | if (isset($p_params[$v_key]) && ($p_params[$v_key] != '')) { |
| 3181 | 3181 | if (!function_exists($p_params[$v_key])) { |
| 3182 | 3182 | $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAM_VALUE, |
@@ -3205,7 +3205,7 @@ discard block |
||
| 3205 | 3205 | * @param integer $p_error_code |
| 3206 | 3206 | * @param string $p_error_string |
| 3207 | 3207 | */ |
| 3208 | - public function _errorLog($p_error_code=0, $p_error_string='') |
|
| 3208 | + public function _errorLog($p_error_code = 0, $p_error_string = '') |
|
| 3209 | 3209 | { |
| 3210 | 3210 | $this->_error_code = $p_error_code; |
| 3211 | 3211 | $this->_error_string = $p_error_string; |
@@ -3252,7 +3252,7 @@ discard block |
||
| 3252 | 3252 | $v_list = explode('/', $p_dir); |
| 3253 | 3253 | |
| 3254 | 3254 | // ----- Study directories from last to first |
| 3255 | - for ($i= count($v_list) - 1; $i >= 0; $i--) { |
|
| 3255 | + for ($i = count($v_list) - 1; $i >= 0; $i--) { |
|
| 3256 | 3256 | // ----- Look for current path |
| 3257 | 3257 | if ($v_list[$i] == '.') { |
| 3258 | 3258 | // ----- Ignore this directory |
@@ -3264,7 +3264,7 @@ discard block |
||
| 3264 | 3264 | // ----- Ignore only the double '//' in path, |
| 3265 | 3265 | // but not the first and last '/' |
| 3266 | 3266 | } else { |
| 3267 | - $v_result = $v_list[$i].($i!=(count($v_list) - 1)? '/' . $v_result: ''); |
|
| 3267 | + $v_result = $v_list[$i].($i != (count($v_list) - 1) ? '/'.$v_result : ''); |
|
| 3268 | 3268 | } |
| 3269 | 3269 | } |
| 3270 | 3270 | } |
@@ -3374,11 +3374,11 @@ discard block |
||
| 3374 | 3374 | * |
| 3375 | 3375 | * @param integer $p_mode |
| 3376 | 3376 | */ |
| 3377 | - public function _tool_CopyBlock($p_src, $p_dest, $p_size, $p_mode=0) |
|
| 3377 | + public function _tool_CopyBlock($p_src, $p_dest, $p_size, $p_mode = 0) |
|
| 3378 | 3378 | { |
| 3379 | 3379 | $v_result = 1; |
| 3380 | 3380 | |
| 3381 | - if ($p_mode==0) { |
|
| 3381 | + if ($p_mode == 0) { |
|
| 3382 | 3382 | while ($p_size != 0) { |
| 3383 | 3383 | $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE |
| 3384 | 3384 | ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE); |
@@ -3386,7 +3386,7 @@ discard block |
||
| 3386 | 3386 | @fwrite($p_dest, $v_buffer, $v_read_size); |
| 3387 | 3387 | $p_size -= $v_read_size; |
| 3388 | 3388 | } |
| 3389 | - } elseif ($p_mode==1) { |
|
| 3389 | + } elseif ($p_mode == 1) { |
|
| 3390 | 3390 | while ($p_size != 0) { |
| 3391 | 3391 | $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE |
| 3392 | 3392 | ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE); |
@@ -3394,7 +3394,7 @@ discard block |
||
| 3394 | 3394 | @fwrite($p_dest, $v_buffer, $v_read_size); |
| 3395 | 3395 | $p_size -= $v_read_size; |
| 3396 | 3396 | } |
| 3397 | - } elseif ($p_mode==2) { |
|
| 3397 | + } elseif ($p_mode == 2) { |
|
| 3398 | 3398 | while ($p_size != 0) { |
| 3399 | 3399 | $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE |
| 3400 | 3400 | ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE); |
@@ -3402,7 +3402,7 @@ discard block |
||
| 3402 | 3402 | @gzwrite($p_dest, $v_buffer, $v_read_size); |
| 3403 | 3403 | $p_size -= $v_read_size; |
| 3404 | 3404 | } |
| 3405 | - } elseif ($p_mode==3) { |
|
| 3405 | + } elseif ($p_mode == 3) { |
|
| 3406 | 3406 | while ($p_size != 0) { |
| 3407 | 3407 | $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE |
| 3408 | 3408 | ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE); |
@@ -3473,13 +3473,13 @@ discard block |
||
| 3473 | 3473 | * |
| 3474 | 3474 | * @param [type] $p_remove_disk_letter |
| 3475 | 3475 | */ |
| 3476 | - public function _tool_TranslateWinPath($p_path, $p_remove_disk_letter=true) |
|
| 3476 | + public function _tool_TranslateWinPath($p_path, $p_remove_disk_letter = true) |
|
| 3477 | 3477 | { |
| 3478 | 3478 | if (stristr(php_uname(), 'windows')) { |
| 3479 | 3479 | // ----- Look for potential disk letter |
| 3480 | 3480 | if ($p_remove_disk_letter |
| 3481 | 3481 | && (($v_position = strpos($p_path, ':')) != false)) { |
| 3482 | - $p_path = substr($p_path, $v_position+1); |
|
| 3482 | + $p_path = substr($p_path, $v_position + 1); |
|
| 3483 | 3483 | } |
| 3484 | 3484 | // ----- Change potential windows directory separator |
| 3485 | 3485 | if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0, 1) == '\\')) { |