@@ -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 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
| 30 | 30 | // ------------------------------------------------------------------------ // |
| 31 | 31 | |
| 32 | -require_once dirname(__DIR__).'/class/AltsysBreadcrumbs.class.php' ; |
|
| 32 | +require_once dirname(__DIR__).'/class/AltsysBreadcrumbs.class.php'; |
|
| 33 | 33 | include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php'; |
| 34 | 34 | |
| 35 | 35 | $xoopsOption['theme_use_smarty'] = 1; |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | $xoopsTpl->assign(array('xoops_theme' => $xoopsConfig['theme_set'], 'xoops_imageurl' => XOOPS_THEME_URL.'/'.$xoopsConfig['theme_set'].'/', 'xoops_themecss'=> xoops_getcss($xoopsConfig['theme_set']), 'xoops_requesturi' => htmlspecialchars($GLOBALS['xoopsRequestUri'], ENT_QUOTES), 'xoops_sitename' => htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES), 'xoops_slogan' => htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES))); |
| 44 | 44 | // Meta tags |
| 45 | - $config_handler =& xoops_gethandler('config'); |
|
| 45 | + $config_handler = & xoops_gethandler('config'); |
|
| 46 | 46 | $criteria = new CriteriaCompo(new Criteria('conf_modid', 0)); |
| 47 | 47 | $criteria->add(new Criteria('conf_catid', XOOPS_CONF_METAFOOTER)); |
| 48 | 48 | $config = $config_handler->getConfigs($criteria, true); |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | //HACK by domifara |
| 59 | 59 | if (defined('XOOPS_CUBE_LEGACY')) { |
| 60 | - $handler =& xoops_gethandler('block'); |
|
| 61 | - $xoopsblock =& $handler->create(false) ; |
|
| 60 | + $handler = & xoops_gethandler('block'); |
|
| 61 | + $xoopsblock = & $handler->create(false); |
|
| 62 | 62 | } else { |
| 63 | 63 | $xoopsblock = new XoopsBlock(); |
| 64 | 64 | } |
@@ -68,9 +68,9 @@ discard block |
||
| 68 | 68 | if (is_object($xoopsUser)) { |
| 69 | 69 | $xoopsTpl->assign(array('xoops_isuser' => true, 'xoops_userid' => $xoopsUser->getVar('uid'), 'xoops_uname' => $xoopsUser->getVar('uname'), 'xoops_isadmin' => $xoopsUserIsAdmin)); |
| 70 | 70 | if (is_object(@$xoopsModule)) { |
| 71 | - if ($xoopsModule->getVar('mid') == 1 && @$_GET['fct'] == 'preferences' && @$_GET['op'] == 'showmod' && ! empty($_GET['mod'])) { |
|
| 72 | - $module_handler =& xoops_gethandler('module') ; |
|
| 73 | -<<<<<<< HEAD |
|
| 71 | + if ($xoopsModule->getVar('mid') == 1 && @$_GET['fct'] == 'preferences' && @$_GET['op'] == 'showmod' && !empty($_GET['mod'])) { |
|
| 72 | + $module_handler = & xoops_gethandler('module'); |
|
| 73 | +<< << <<< HEAD |
|
| 74 | 74 | $target_module = $module_handler->get(intval($_GET['mod'])) ; |
| 75 | 75 | ======= |
| 76 | 76 | $target_module = $module_handler->get((int)$_GET['mod']) ; |
@@ -268,4 +268,4 @@ discard block |
||
| 268 | 268 | $xoopsTpl->assign('xoops_showcblock', 0); |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - $xoopsTpl->xoops_setCaching(0); |
|
| 271 | + $xoopsTpl->xoops_setCaching |
|
| 272 | 272 | \ No newline at end of file |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (! defined('XOOPS_ROOT_PATH')) { |
|
| 4 | - exit ; |
|
| 3 | +if (!defined('XOOPS_ROOT_PATH')) { |
|
| 4 | + exit; |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | function myDeleteByModule($DB, $gperm_modid, $gperm_name = null, $gperm_itemid = null) |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | $criteria->add(new Criteria('gperm_itemid', (int)$gperm_itemid)); |
| 14 | 14 | } |
| 15 | 15 | } |
| 16 | - $sql = 'DELETE FROM ' . $DB->prefix('group_permission') . ' ' . $criteria->renderWhere(); |
|
| 16 | + $sql = 'DELETE FROM '.$DB->prefix('group_permission').' '.$criteria->renderWhere(); |
|
| 17 | 17 | if (!$result = $DB->query($sql)) { |
| 18 | 18 | return false; |
| 19 | 19 | } |
@@ -27,47 +27,47 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | if ($modid == 1) { |
| 29 | 29 | // check by the permission of eather 'altsys' or 'system' |
| 30 | - $module_handler =& xoops_gethandler('module') ; |
|
| 31 | - $module =& $module_handler->getByDirname('altsys') ; |
|
| 32 | - if (! is_object($module)) { |
|
| 33 | - $module =& $module_handler->getByDirname('system') ; |
|
| 34 | - if (! is_object($module)) { |
|
| 35 | - die('there is no altsys nor system.') ; |
|
| 30 | + $module_handler = & xoops_gethandler('module'); |
|
| 31 | + $module = & $module_handler->getByDirname('altsys'); |
|
| 32 | + if (!is_object($module)) { |
|
| 33 | + $module = & $module_handler->getByDirname('system'); |
|
| 34 | + if (!is_object($module)) { |
|
| 35 | + die('there is no altsys nor system.'); |
|
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | - $moduleperm_handler =& xoops_gethandler('groupperm') ; |
|
| 39 | - if (! is_object(@$GLOBALS['xoopsUser']) || ! $moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $GLOBALS['xoopsUser']->getGroups())) { |
|
| 40 | - die('only admin of altsys can access this area') ; |
|
| 38 | + $moduleperm_handler = & xoops_gethandler('groupperm'); |
|
| 39 | + if (!is_object(@$GLOBALS['xoopsUser']) || !$moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $GLOBALS['xoopsUser']->getGroups())) { |
|
| 40 | + die('only admin of altsys can access this area'); |
|
| 41 | 41 | } |
| 42 | 42 | } else { |
| 43 | 43 | // check the permission of 'module_admin' of the module |
| 44 | 44 | if ($modid <= 0 || !is_object($GLOBALS['xoopsUser']) || !$GLOBALS['xoopsUser']->isAdmin($modid)) { |
| 45 | - die(_NOPERM) ; |
|
| 45 | + die(_NOPERM); |
|
| 46 | 46 | } |
| 47 | - $module_handler =& xoops_gethandler('module'); |
|
| 48 | - $module =& $module_handler->get($modid); |
|
| 47 | + $module_handler = & xoops_gethandler('module'); |
|
| 48 | + $module = & $module_handler->get($modid); |
|
| 49 | 49 | if (!is_object($module) || !$module->getVar('isactive')) { |
| 50 | - die(_MODULENOEXIST) ; |
|
| 50 | + die(_MODULENOEXIST); |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | -$member_handler =& xoops_gethandler('member'); |
|
| 54 | +$member_handler = & xoops_gethandler('member'); |
|
| 55 | 55 | $group_list = $member_handler->getGroupList(); |
| 56 | 56 | if (!empty($_POST['perms']) && is_array($_POST['perms'])) { |
| 57 | - $gperm_handler =& xoops_gethandler('groupperm'); |
|
| 57 | + $gperm_handler = & xoops_gethandler('groupperm'); |
|
| 58 | 58 | foreach ($_POST['perms'] as $perm_name => $perm_data) { |
| 59 | - foreach ($perm_data['itemname' ] as $item_id => $item_name) { |
|
| 59 | + foreach ($perm_data['itemname'] as $item_id => $item_name) { |
|
| 60 | 60 | // checking code |
| 61 | 61 | // echo "<pre>" ; |
| 62 | 62 | // var_dump( $_POST['perms'] ) ; |
| 63 | 63 | // exit ; |
| 64 | 64 | if (false != myDeleteByModule($gperm_handler->db, $modid, $perm_name, $item_id)) { |
| 65 | 65 | if (empty($perm_data['groups'])) { |
| 66 | - continue ; |
|
| 66 | + continue; |
|
| 67 | 67 | } |
| 68 | 68 | foreach ($perm_data['groups'] as $group_id => $item_ids) { |
| 69 | 69 | // foreach ($item_ids as $item_id => $selected) { |
| 70 | - $selected = isset($item_ids[ $item_id ]) ? $item_ids[ $item_id ] : 0 ; |
|
| 70 | + $selected = isset($item_ids[$item_id]) ? $item_ids[$item_id] : 0; |
|
| 71 | 71 | if ($selected == 1) { |
| 72 | 72 | // make sure that all parent ids are selected as well |
| 73 | 73 | if ($perm_data['parents'][$item_id] != '') { |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | - $gperm =& $gperm_handler->create(); |
|
| 83 | + $gperm = & $gperm_handler->create(); |
|
| 84 | 84 | $gperm->setVar('gperm_groupid', $group_id); |
| 85 | 85 | $gperm->setVar('gperm_name', $perm_name); |
| 86 | 86 | $gperm->setVar('gperm_modid', $modid); |
@@ -1,26 +1,26 @@ discard block |
||
| 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_dirnames)) { |
|
| 11 | - return ; |
|
| 10 | +if (!is_array(@$tplsadmin_autoupdate_dirnames)) { |
|
| 11 | + return; |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | foreach ($tplsadmin_autoupdate_dirnames as $dirname) { |
| 15 | - $dirname = preg_replace('/[^a-zA-Z0-9_-]/', '', $dirname) ; |
|
| 16 | - $tplsadmin_autoupdate_path = XOOPS_ROOT_PATH . '/modules/' . $dirname . '/templates' ; |
|
| 15 | + $dirname = preg_replace('/[^a-zA-Z0-9_-]/', '', $dirname); |
|
| 16 | + $tplsadmin_autoupdate_path = XOOPS_ROOT_PATH.'/modules/'.$dirname.'/templates'; |
|
| 17 | 17 | |
| 18 | 18 | // modules |
| 19 | - if ($handler = @opendir($tplsadmin_autoupdate_path . '/')) { |
|
| 19 | + if ($handler = @opendir($tplsadmin_autoupdate_path.'/')) { |
|
| 20 | 20 | while (($file = readdir($handler)) !== false) { |
| 21 | - $file_path = $tplsadmin_autoupdate_path . '/' . $file ; |
|
| 21 | + $file_path = $tplsadmin_autoupdate_path.'/'.$file; |
|
| 22 | 22 | if (is_file($file_path) && substr($file, -5) == '.html') { |
| 23 | -<<<<<<< HEAD |
|
| 23 | +<< << <<< HEAD |
|
| 24 | 24 | $mtime = intval(@filemtime($file_path)) ; |
| 25 | 25 | list($count) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($xoopsConfig['template_set']) . "' AND tpl_file='" . addslashes($file) . "' AND tpl_lastmodified >= $mtime")) ; |
| 26 | 26 | ======= |
@@ -49,9 +49,4 @@ discard block |
||
| 49 | 49 | >>>>>>> feature/intval |
| 50 | 50 | if ($count <= 0) { |
| 51 | 51 | include_once XOOPS_TRUST_PATH.'/libs/altsys/include/tpls_functions.php' ; |
| 52 | - tplsadmin_import_data($xoopsConfig['template_set'], $file, implode('', file($file_path)), $mtime) ; |
|
| 53 | - } |
|
| 54 | - } |
|
| 55 | - } |
|
| 56 | - } |
|
| 57 | -} |
|
| 52 | + tplsadmin_import_data($xoopsConfig['template_set'], $file, implode('', file($file_path)), $mtime |
|
| 58 | 53 | \ No newline at end of file |
@@ -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,46 +1,46 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -altsys_set_module_config() ; |
|
| 3 | +altsys_set_module_config(); |
|
| 4 | 4 | |
| 5 | 5 | function altsys_set_module_config() |
| 6 | 6 | { |
| 7 | - global $altsysModuleConfig , $altsysModuleId ; |
|
| 7 | + global $altsysModuleConfig, $altsysModuleId; |
|
| 8 | 8 | |
| 9 | - $module_handler =& xoops_gethandler('module') ; |
|
| 10 | - $module =& $module_handler->getByDirname('altsys') ; |
|
| 9 | + $module_handler = & xoops_gethandler('module'); |
|
| 10 | + $module = & $module_handler->getByDirname('altsys'); |
|
| 11 | 11 | if (is_object($module)) { |
| 12 | - $config_handler =& xoops_gethandler('config') ; |
|
| 13 | - $altsysModuleConfig = $config_handler->getConfigList($module->getVar('mid')) ; |
|
| 14 | - $altsysModuleId = $module->getVar('mid') ; |
|
| 12 | + $config_handler = & xoops_gethandler('config'); |
|
| 13 | + $altsysModuleConfig = $config_handler->getConfigList($module->getVar('mid')); |
|
| 14 | + $altsysModuleId = $module->getVar('mid'); |
|
| 15 | 15 | } else { |
| 16 | - $altsysModuleConfig = array() ; |
|
| 17 | - $altsysModuleId = 0 ; |
|
| 16 | + $altsysModuleConfig = array(); |
|
| 17 | + $altsysModuleId = 0; |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | // for RTL users |
| 21 | - @define('_GLOBAL_LEFT', @_ADM_USE_RTL == 1 ? 'right' : 'left') ; |
|
| 22 | - @define('_GLOBAL_RIGHT', @_ADM_USE_RTL == 1 ? 'left' : 'right') ; |
|
| 21 | + @define('_GLOBAL_LEFT', @_ADM_USE_RTL == 1 ? 'right' : 'left'); |
|
| 22 | + @define('_GLOBAL_RIGHT', @_ADM_USE_RTL == 1 ? 'left' : 'right'); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | function altsys_include_mymenu() |
| 27 | 27 | { |
| 28 | - global $xoopsModule , $xoopsConfig , $mydirname , $mydirpath , $mytrustdirname , $mytrustdirpath , $mymenu_fake_uri ; |
|
| 28 | + global $xoopsModule, $xoopsConfig, $mydirname, $mydirpath, $mytrustdirname, $mytrustdirpath, $mymenu_fake_uri; |
|
| 29 | 29 | |
| 30 | 30 | $mymenu_find_paths = array( |
| 31 | - $mydirpath.'/admin/mymenu.php' , |
|
| 32 | - $mydirpath.'/mymenu.php' , |
|
| 33 | - $mytrustdirpath.'/admin/mymenu.php' , |
|
| 31 | + $mydirpath.'/admin/mymenu.php', |
|
| 32 | + $mydirpath.'/mymenu.php', |
|
| 33 | + $mytrustdirpath.'/admin/mymenu.php', |
|
| 34 | 34 | $mytrustdirpath.'/mymenu.php' |
| 35 | - ) ; |
|
| 35 | + ); |
|
| 36 | 36 | |
| 37 | 37 | foreach ($mymenu_find_paths as $mymenu_find_path) { |
| 38 | 38 | if (file_exists($mymenu_find_path)) { |
| 39 | - include $mymenu_find_path ; |
|
| 40 | - include_once __DIR__.'/adminmenu_functions.php' ; |
|
| 41 | - altsys_adminmenu_insert_mymenu($xoopsModule) ; |
|
| 42 | - altsys_adminmenu_hack_ft() ; |
|
| 43 | - break ; |
|
| 39 | + include $mymenu_find_path; |
|
| 40 | + include_once __DIR__.'/adminmenu_functions.php'; |
|
| 41 | + altsys_adminmenu_insert_mymenu($xoopsModule); |
|
| 42 | + altsys_adminmenu_hack_ft(); |
|
| 43 | + break; |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -48,58 +48,58 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | function altsys_include_language_file($type) |
| 50 | 50 | { |
| 51 | - $mylang = $GLOBALS['xoopsConfig']['language'] ; |
|
| 51 | + $mylang = $GLOBALS['xoopsConfig']['language']; |
|
| 52 | 52 | |
| 53 | 53 | if (file_exists(XOOPS_ROOT_PATH.'/modules/altsys/language/'.$mylang.'/'.$type.'.php')) { |
| 54 | - include_once XOOPS_ROOT_PATH.'/modules/altsys/language/'.$mylang.'/'.$type.'.php' ; |
|
| 54 | + include_once XOOPS_ROOT_PATH.'/modules/altsys/language/'.$mylang.'/'.$type.'.php'; |
|
| 55 | 55 | } elseif (file_exists(XOOPS_TRUST_PATH.'/libs/altsys/language/'.$mylang.'/'.$type.'.php')) { |
| 56 | - include_once XOOPS_TRUST_PATH.'/libs/altsys/language/'.$mylang.'/'.$type.'.php' ; |
|
| 56 | + include_once XOOPS_TRUST_PATH.'/libs/altsys/language/'.$mylang.'/'.$type.'.php'; |
|
| 57 | 57 | } elseif (file_exists(XOOPS_ROOT_PATH.'/modules/altsys/language/english/'.$type.'.php')) { |
| 58 | - include_once XOOPS_ROOT_PATH.'/modules/altsys/language/english/'.$type.'.php' ; |
|
| 58 | + include_once XOOPS_ROOT_PATH.'/modules/altsys/language/english/'.$type.'.php'; |
|
| 59 | 59 | } elseif (file_exists(XOOPS_TRUST_PATH.'/libs/altsys/language/english/'.$type.'.php')) { |
| 60 | - include_once XOOPS_TRUST_PATH.'/libs/altsys/language/english/'.$type.'.php' ; |
|
| 60 | + include_once XOOPS_TRUST_PATH.'/libs/altsys/language/english/'.$type.'.php'; |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | |
| 65 | -define('ALTSYS_CORE_TYPE_X20', 1) ; // 2.0.0-2.0.13 and 2.0.x-JP |
|
| 66 | -define('ALTSYS_CORE_TYPE_X20S', 2) ; // 2.0.14- from xoops.org (Skalpa's S) |
|
| 67 | -define('ALTSYS_CORE_TYPE_ORE', 4) ; // ORETEKI by marijuana |
|
| 68 | -define('ALTSYS_CORE_TYPE_X22', 8) ; // 2.2 from xoops.org |
|
| 69 | -define('ALTSYS_CORE_TYPE_X23P', 10) ; // 2.3 from xoops.org (phppp's P) |
|
| 70 | -define('ALTSYS_CORE_TYPE_X25', 11) ; // 2.5 from xoops.org |
|
| 71 | -define('ALTSYS_CORE_TYPE_ICMS', 12) ; // ImpressCMS |
|
| 72 | -define('ALTSYS_CORE_TYPE_XCL21', 16) ; // XOOPS Cube 2.1 Legacy |
|
| 65 | +define('ALTSYS_CORE_TYPE_X20', 1); // 2.0.0-2.0.13 and 2.0.x-JP |
|
| 66 | +define('ALTSYS_CORE_TYPE_X20S', 2); // 2.0.14- from xoops.org (Skalpa's S) |
|
| 67 | +define('ALTSYS_CORE_TYPE_ORE', 4); // ORETEKI by marijuana |
|
| 68 | +define('ALTSYS_CORE_TYPE_X22', 8); // 2.2 from xoops.org |
|
| 69 | +define('ALTSYS_CORE_TYPE_X23P', 10); // 2.3 from xoops.org (phppp's P) |
|
| 70 | +define('ALTSYS_CORE_TYPE_X25', 11); // 2.5 from xoops.org |
|
| 71 | +define('ALTSYS_CORE_TYPE_ICMS', 12); // ImpressCMS |
|
| 72 | +define('ALTSYS_CORE_TYPE_XCL21', 16); // XOOPS Cube 2.1 Legacy |
|
| 73 | 73 | |
| 74 | 74 | function altsys_get_core_type() |
| 75 | 75 | { |
| 76 | - static $result = null ; |
|
| 76 | + static $result = null; |
|
| 77 | 77 | |
| 78 | 78 | if (empty($result)) { |
| 79 | 79 | if (defined('XOOPS_ORETEKI')) { |
| 80 | - $result = ALTSYS_CORE_TYPE_ORE ; |
|
| 80 | + $result = ALTSYS_CORE_TYPE_ORE; |
|
| 81 | 81 | } elseif (defined('XOOPS_CUBE_LEGACY')) { |
| 82 | - $result = ALTSYS_CORE_TYPE_XCL21 ; |
|
| 82 | + $result = ALTSYS_CORE_TYPE_XCL21; |
|
| 83 | 83 | } elseif (defined('ICMS_VERSION_NAME')) { |
| 84 | - $result = ALTSYS_CORE_TYPE_ICMS ; |
|
| 84 | + $result = ALTSYS_CORE_TYPE_ICMS; |
|
| 85 | 85 | } elseif (strstr(XOOPS_VERSION, 'JP')) { |
| 86 | - $result = ALTSYS_CORE_TYPE_X20 ; |
|
| 86 | + $result = ALTSYS_CORE_TYPE_X20; |
|
| 87 | 87 | } else { |
| 88 | - $versions = array_map('intval', explode('.', preg_replace('/[^0-9.]/', '', XOOPS_VERSION))) ; |
|
| 88 | + $versions = array_map('intval', explode('.', preg_replace('/[^0-9.]/', '', XOOPS_VERSION))); |
|
| 89 | 89 | if ($versions[0] == 2 && $versions[1] == 2) { |
| 90 | - $result = ALTSYS_CORE_TYPE_X22 ; |
|
| 90 | + $result = ALTSYS_CORE_TYPE_X22; |
|
| 91 | 91 | } elseif ($versions[0] == 2 && $versions[1] == 0 && $versions[2] > 13) { |
| 92 | - $result = ALTSYS_CORE_TYPE_X20S ; |
|
| 92 | + $result = ALTSYS_CORE_TYPE_X20S; |
|
| 93 | 93 | } elseif ($versions[0] == 2 && $versions[1] >= 5) { |
| 94 | - $result = ALTSYS_CORE_TYPE_X25 ; |
|
| 94 | + $result = ALTSYS_CORE_TYPE_X25; |
|
| 95 | 95 | } elseif ($versions[0] == 2 && $versions[1] > 2) { |
| 96 | - $result = ALTSYS_CORE_TYPE_X23P ; |
|
| 96 | + $result = ALTSYS_CORE_TYPE_X23P; |
|
| 97 | 97 | } else { |
| 98 | - $result = ALTSYS_CORE_TYPE_X20 ; |
|
| 98 | + $result = ALTSYS_CORE_TYPE_X20; |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | - return $result ; |
|
| 102 | + return $result; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
@@ -113,36 +113,36 @@ discard block |
||
| 113 | 113 | case ALTSYS_CORE_TYPE_X23P : |
| 114 | 114 | case ALTSYS_CORE_TYPE_ICMS : |
| 115 | 115 | default : |
| 116 | - return XOOPS_URL.'/modules/system/admin.php?fct=preferences&op=showmod&mod='.$mid ; |
|
| 116 | + return XOOPS_URL.'/modules/system/admin.php?fct=preferences&op=showmod&mod='.$mid; |
|
| 117 | 117 | case ALTSYS_CORE_TYPE_XCL21 : |
| 118 | - return XOOPS_URL.'/modules/legacy/admin/index.php?action=PreferenceEdit&confmod_id='.$mid ; |
|
| 118 | + return XOOPS_URL.'/modules/legacy/admin/index.php?action=PreferenceEdit&confmod_id='.$mid; |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | |
| 123 | 123 | function altsys_template_touch($tpl_id) |
| 124 | 124 | { |
| 125 | - if (in_array(altsys_get_core_type(), array( ALTSYS_CORE_TYPE_X20S, ALTSYS_CORE_TYPE_X23P, ALTSYS_CORE_TYPE_X25 ))) { |
|
| 125 | + if (in_array(altsys_get_core_type(), array(ALTSYS_CORE_TYPE_X20S, ALTSYS_CORE_TYPE_X23P, ALTSYS_CORE_TYPE_X25))) { |
|
| 126 | 126 | // need to delete all files under templates_c/ |
| 127 | - altsys_clear_templates_c() ; |
|
| 127 | + altsys_clear_templates_c(); |
|
| 128 | 128 | } else { |
| 129 | 129 | // just touch the template |
| 130 | - xoops_template_touch($tpl_id) ; |
|
| 130 | + xoops_template_touch($tpl_id); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | |
| 135 | 135 | function altsys_clear_templates_c() |
| 136 | 136 | { |
| 137 | - $dh = opendir(XOOPS_COMPILE_PATH) ; |
|
| 137 | + $dh = opendir(XOOPS_COMPILE_PATH); |
|
| 138 | 138 | while ($file = readdir($dh)) { |
| 139 | 139 | if (substr($file, 0, 1) == '.') { |
| 140 | - continue ; |
|
| 140 | + continue; |
|
| 141 | 141 | } |
| 142 | 142 | if (substr($file, -4) != '.php') { |
| 143 | - continue ; |
|
| 143 | + continue; |
|
| 144 | 144 | } |
| 145 | - @unlink(XOOPS_COMPILE_PATH.'/'.$file) ; |
|
| 145 | + @unlink(XOOPS_COMPILE_PATH.'/'.$file); |
|
| 146 | 146 | } |
| 147 | - closedir($dh) ; |
|
| 147 | + closedir($dh); |
|
| 148 | 148 | } |
@@ -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 | } |