@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! defined('XOOPS_ROOT_PATH')) { |
|
4 | - exit ; |
|
3 | +if (!defined('XOOPS_ROOT_PATH')) { |
|
4 | + exit; |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | function myDeleteByModule($DB, $gperm_modid, $gperm_name = null, $gperm_itemid = null) |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | $criteria->add(new Criteria('gperm_itemid', (int)$gperm_itemid)); |
14 | 14 | } |
15 | 15 | } |
16 | - $sql = 'DELETE FROM ' . $DB->prefix('group_permission') . ' ' . $criteria->renderWhere(); |
|
16 | + $sql = 'DELETE FROM '.$DB->prefix('group_permission').' '.$criteria->renderWhere(); |
|
17 | 17 | if (!$result = $DB->query($sql)) { |
18 | 18 | return false; |
19 | 19 | } |
@@ -27,27 +27,27 @@ discard block |
||
27 | 27 | |
28 | 28 | if ($modid == 1) { |
29 | 29 | // check by the permission of eather 'altsys' or 'system' |
30 | - $module_handler = xoops_getHandler('module') ; |
|
31 | - $module = $module_handler->getByDirname('altsys') ; |
|
32 | - if (! is_object($module)) { |
|
33 | - $module = $module_handler->getByDirname('system') ; |
|
34 | - if (! is_object($module)) { |
|
35 | - die('there is no altsys nor system.') ; |
|
30 | + $module_handler = xoops_getHandler('module'); |
|
31 | + $module = $module_handler->getByDirname('altsys'); |
|
32 | + if (!is_object($module)) { |
|
33 | + $module = $module_handler->getByDirname('system'); |
|
34 | + if (!is_object($module)) { |
|
35 | + die('there is no altsys nor system.'); |
|
36 | 36 | } |
37 | 37 | } |
38 | - $moduleperm_handler = xoops_getHandler('groupperm') ; |
|
39 | - if (! is_object(@$GLOBALS['xoopsUser']) || ! $moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $GLOBALS['xoopsUser']->getGroups())) { |
|
40 | - die('only admin of altsys can access this area') ; |
|
38 | + $moduleperm_handler = xoops_getHandler('groupperm'); |
|
39 | + if (!is_object(@$GLOBALS['xoopsUser']) || !$moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $GLOBALS['xoopsUser']->getGroups())) { |
|
40 | + die('only admin of altsys can access this area'); |
|
41 | 41 | } |
42 | 42 | } else { |
43 | 43 | // check the permission of 'module_admin' of the module |
44 | 44 | if ($modid <= 0 || !is_object($GLOBALS['xoopsUser']) || !$GLOBALS['xoopsUser']->isAdmin($modid)) { |
45 | - die(_NOPERM) ; |
|
45 | + die(_NOPERM); |
|
46 | 46 | } |
47 | 47 | $module_handler = xoops_getHandler('module'); |
48 | 48 | $module = $module_handler->get($modid); |
49 | 49 | if (!is_object($module) || !$module->getVar('isactive')) { |
50 | - die(_MODULENOEXIST) ; |
|
50 | + die(_MODULENOEXIST); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
@@ -56,18 +56,18 @@ discard block |
||
56 | 56 | if (!empty($_POST['perms']) && is_array($_POST['perms'])) { |
57 | 57 | $gperm_handler = xoops_getHandler('groupperm'); |
58 | 58 | foreach ($_POST['perms'] as $perm_name => $perm_data) { |
59 | - foreach ($perm_data['itemname' ] as $item_id => $item_name) { |
|
59 | + foreach ($perm_data['itemname'] as $item_id => $item_name) { |
|
60 | 60 | // checking code |
61 | 61 | // echo "<pre>" ; |
62 | 62 | // var_dump( $_POST['perms'] ) ; |
63 | 63 | // exit ; |
64 | 64 | if (false != myDeleteByModule($gperm_handler->db, $modid, $perm_name, $item_id)) { |
65 | 65 | if (empty($perm_data['groups'])) { |
66 | - continue ; |
|
66 | + continue; |
|
67 | 67 | } |
68 | 68 | foreach ($perm_data['groups'] as $group_id => $item_ids) { |
69 | 69 | // foreach ($item_ids as $item_id => $selected) { |
70 | - $selected = isset($item_ids[ $item_id ]) ? $item_ids[ $item_id ] : 0 ; |
|
70 | + $selected = isset($item_ids[$item_id]) ? $item_ids[$item_id] : 0; |
|
71 | 71 | if ($selected == 1) { |
72 | 72 | // make sure that all parent ids are selected as well |
73 | 73 | if ($perm_data['parents'][$item_id] != '') { |
@@ -2,91 +2,91 @@ |
||
2 | 2 | |
3 | 3 | function altsys_mylangadmin_get_constant_names($langfile_unique_path, $mydirname) |
4 | 4 | { |
5 | - $constpref = '' ; |
|
6 | - $langfile_names = array() ; |
|
7 | - $reqonce_ret = 0 ; |
|
8 | - $already_read = false ; |
|
9 | - $langfile_fingerprint = '_MYLANGADMIN_'.md5($langfile_unique_path) ; |
|
5 | + $constpref = ''; |
|
6 | + $langfile_names = array(); |
|
7 | + $reqonce_ret = 0; |
|
8 | + $already_read = false; |
|
9 | + $langfile_fingerprint = '_MYLANGADMIN_'.md5($langfile_unique_path); |
|
10 | 10 | |
11 | 11 | // for debug |
12 | 12 | //require_once XOOPS_TRUST_PATH.'/modules/pico/language/japanese/modinfo.php' ; |
13 | 13 | |
14 | 14 | // get constant_names by "require" |
15 | - if (! defined($langfile_fingerprint)) { |
|
16 | - $system_constants = array_keys(get_defined_constants()) ; |
|
15 | + if (!defined($langfile_fingerprint)) { |
|
16 | + $system_constants = array_keys(get_defined_constants()); |
|
17 | 17 | $reqonce_ret = require_once $langfile_unique_path; |
18 | - $langfile_names = array_diff(array_keys(get_defined_constants()), $system_constants) ; |
|
18 | + $langfile_names = array_diff(array_keys(get_defined_constants()), $system_constants); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | // We have to parse the file if it has been already included ... |
22 | 22 | if (empty($langfile_names) && ($reqonce_ret === true || defined($langfile_fingerprint))) { |
23 | - $already_read = true ; |
|
24 | - $langfile_names = altsys_mylangadmin_get_constant_names_by_pcre($langfile_unique_path) ; |
|
23 | + $already_read = true; |
|
24 | + $langfile_names = altsys_mylangadmin_get_constant_names_by_pcre($langfile_unique_path); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | // modinfo.php of D3 module |
28 | 28 | if (empty($langfile_names) && file_exists(XOOPS_ROOT_PATH.'/modules/'.$mydirname.'/mytrustdirname.php') /* && substr( $langfile_unique_path , -11 ) == 'modinfo.php' */) { |
29 | 29 | // get $constpref |
30 | - $constpref = '' ; |
|
31 | - require $langfile_unique_path ; |
|
32 | - $langfile_names = array() ; |
|
30 | + $constpref = ''; |
|
31 | + require $langfile_unique_path; |
|
32 | + $langfile_names = array(); |
|
33 | 33 | if ($constpref) { |
34 | 34 | foreach (array_keys(get_defined_constants()) as $name) { |
35 | 35 | if (strncmp($name, $constpref, strlen($constpref)) == 0) { |
36 | - $langfile_names[] = $name ; |
|
36 | + $langfile_names[] = $name; |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | 42 | |
43 | - return array( $langfile_names , $constpref , $already_read ) ; |
|
43 | + return array($langfile_names, $constpref, $already_read); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
47 | 47 | function altsys_mylangadmin_get_constant_names_by_pcre($langfile_path) |
48 | 48 | { |
49 | - if (! file_exists($langfile_path)) { |
|
50 | - return array() ; |
|
49 | + if (!file_exists($langfile_path)) { |
|
50 | + return array(); |
|
51 | 51 | } |
52 | - $file_contents = file_get_contents($langfile_path) ; |
|
53 | - preg_match_all('/\n\s*define\(\s*(["\'])([0-9a-zA-Z_]+)\\1/iU', $file_contents, $matches) ; |
|
54 | - $langfile_names = array() ; |
|
52 | + $file_contents = file_get_contents($langfile_path); |
|
53 | + preg_match_all('/\n\s*define\(\s*(["\'])([0-9a-zA-Z_]+)\\1/iU', $file_contents, $matches); |
|
54 | + $langfile_names = array(); |
|
55 | 55 | foreach ($matches[2] as $name) { |
56 | 56 | // if( defined( $name ) ) |
57 | - $langfile_names[] = $name ; |
|
57 | + $langfile_names[] = $name; |
|
58 | 58 | } |
59 | 59 | |
60 | - return $langfile_names ; |
|
60 | + return $langfile_names; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | 64 | function altsys_mylangadmin_get_constants_by_pcre($langfile_path) |
65 | 65 | { |
66 | - if (! file_exists($langfile_path)) { |
|
67 | - return array() ; |
|
66 | + if (!file_exists($langfile_path)) { |
|
67 | + return array(); |
|
68 | 68 | } |
69 | 69 | |
70 | - $file_contents = file_get_contents($langfile_path) ; |
|
71 | - preg_match_all('/\n\s*define\(\s*(["\'])([0-9a-zA-Z_]+)\\1\s*\,\s*(["\'])([^\\3]+)\\3/iU', $file_contents, $matches) ; |
|
72 | - $constants = array() ; |
|
70 | + $file_contents = file_get_contents($langfile_path); |
|
71 | + preg_match_all('/\n\s*define\(\s*(["\'])([0-9a-zA-Z_]+)\\1\s*\,\s*(["\'])([^\\3]+)\\3/iU', $file_contents, $matches); |
|
72 | + $constants = array(); |
|
73 | 73 | foreach ($matches[2] as $i => $name) { |
74 | - $constants[ $name ] = $matches[4][$i] ; |
|
74 | + $constants[$name] = $matches[4][$i]; |
|
75 | 75 | } |
76 | 76 | |
77 | - return $constants ; |
|
77 | + return $constants; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | |
81 | 81 | function altsys_mylangadmin_errordie($target_mname, $message4disp) |
82 | 82 | { |
83 | - xoops_cp_header() ; |
|
84 | - altsys_include_mymenu() ; |
|
85 | - $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ; |
|
86 | - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mylangadmin', _MI_ALTSYS_MENU_MYLANGADMIN) ; |
|
87 | - $breadcrumbsObj->appendPath('', $target_mname) ; |
|
88 | - echo '<h3>' . _MYLANGADMIN_H3_MODULE . ' : ' . $target_mname . '</h3>' ; |
|
89 | - echo '<p>'.$message4disp.'</p>' ; |
|
90 | - xoops_cp_footer() ; |
|
91 | - exit ; |
|
83 | + xoops_cp_header(); |
|
84 | + altsys_include_mymenu(); |
|
85 | + $breadcrumbsObj = AltsysBreadcrumbs::getInstance(); |
|
86 | + $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mylangadmin', _MI_ALTSYS_MENU_MYLANGADMIN); |
|
87 | + $breadcrumbsObj->appendPath('', $target_mname); |
|
88 | + echo '<h3>'._MYLANGADMIN_H3_MODULE.' : '.$target_mname.'</h3>'; |
|
89 | + echo '<p>'.$message4disp.'</p>'; |
|
90 | + xoops_cp_footer(); |
|
91 | + exit; |
|
92 | 92 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * Parent |
34 | 34 | */ |
35 | -include_once XOOPS_ROOT_PATH . '/class/xoopsform/formcheckbox.php'; |
|
35 | +include_once XOOPS_ROOT_PATH.'/class/xoopsform/formcheckbox.php'; |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * A checkbox field with a choice of available groups |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param bool $include_anon Include group "anonymous"? |
54 | 54 | * @param mixed $value Pre-selected value (or array of them). |
55 | 55 | */ |
56 | - public function __construct($caption, $name, $include_anon=false, $value=null) |
|
56 | + public function __construct($caption, $name, $include_anon = false, $value = null) |
|
57 | 57 | { |
58 | 58 | parent::__construct($caption, $name, $value); |
59 | 59 | $member_handler = xoops_getHandler('member'); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $options = $member_handler->getGroupList(); |
64 | 64 | } |
65 | 65 | foreach ($options as $k => $v) { |
66 | - $options[$k] = $v . '<br />'; |
|
66 | + $options[$k] = $v.'<br />'; |
|
67 | 67 | } |
68 | 68 | $this->addOptionArray($options); |
69 | 69 | } |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once dirname(__DIR__).'/class/altsysUtils.class.php' ; |
|
2 | +require_once dirname(__DIR__).'/class/altsysUtils.class.php'; |
|
3 | 3 | |
4 | -define('ALTSYS_ADMINMENU_FILE', XOOPS_CACHE_PATH.'/adminmenu.php') ; |
|
5 | -define('ALTSYS_ADMINMENU_HACK_NONE', 0) ; |
|
6 | -define('ALTSYS_ADMINMENU_HACK_2COL', 1) ; |
|
7 | -define('ALTSYS_ADMINMENU_HACK_NOIMG', 2) ; |
|
8 | -define('ALTSYS_ADMINMENU_HACK_XCSTY', 3) ; |
|
4 | +define('ALTSYS_ADMINMENU_FILE', XOOPS_CACHE_PATH.'/adminmenu.php'); |
|
5 | +define('ALTSYS_ADMINMENU_HACK_NONE', 0); |
|
6 | +define('ALTSYS_ADMINMENU_HACK_2COL', 1); |
|
7 | +define('ALTSYS_ADMINMENU_HACK_NOIMG', 2); |
|
8 | +define('ALTSYS_ADMINMENU_HACK_XCSTY', 3); |
|
9 | 9 | |
10 | 10 | |
11 | 11 | // |
@@ -13,73 +13,73 @@ discard block |
||
13 | 13 | // |
14 | 14 | function altsys_adminmenu_insert_mymenu(&$module) |
15 | 15 | { |
16 | - global $altsysModuleConfig ; |
|
16 | + global $altsysModuleConfig; |
|
17 | 17 | |
18 | 18 | if (empty($altsysModuleConfig['adminmenu_insert_mymenu'])) { |
19 | - return ; |
|
19 | + return; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | if (altsys_get_core_type() < ALTSYS_CORE_TYPE_ORE) { |
23 | - altsys_adminmenu_insert_mymenu_x20($module) ; |
|
23 | + altsys_adminmenu_insert_mymenu_x20($module); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | |
27 | 27 | function altsys_adminmenu_insert_mymenu_x20(&$module) |
28 | 28 | { |
29 | 29 | // read |
30 | - if (! file_exists(ALTSYS_ADMINMENU_FILE)) { |
|
31 | - redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu') ; |
|
32 | - exit ; |
|
30 | + if (!file_exists(ALTSYS_ADMINMENU_FILE)) { |
|
31 | + redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu'); |
|
32 | + exit; |
|
33 | 33 | } |
34 | - $not_inside_cp_functions = true ; |
|
35 | - include ALTSYS_ADMINMENU_FILE ; |
|
34 | + $not_inside_cp_functions = true; |
|
35 | + include ALTSYS_ADMINMENU_FILE; |
|
36 | 36 | |
37 | - $dirname = $module->getVar('dirname') ; |
|
38 | - $mid = $module->getVar('mid') ; |
|
39 | - $anchor = '<!-- ALTSYS ANCHOR '.$dirname.' -->' ; |
|
37 | + $dirname = $module->getVar('dirname'); |
|
38 | + $mid = $module->getVar('mid'); |
|
39 | + $anchor = '<!-- ALTSYS ANCHOR '.$dirname.' -->'; |
|
40 | 40 | |
41 | 41 | // fetch popup_no |
42 | 42 | if (empty($xoops_admin_menu_ft[$mid])) { |
43 | - return ; |
|
43 | + return; |
|
44 | 44 | } |
45 | - if (! preg_match('/popUpL(\d+)/', $xoops_admin_menu_ft[$mid], $regs)) { |
|
46 | - return ; |
|
45 | + if (!preg_match('/popUpL(\d+)/', $xoops_admin_menu_ft[$mid], $regs)) { |
|
46 | + return; |
|
47 | 47 | } |
48 | 48 | $popup_no = (int)$regs[1]; |
49 | 49 | |
50 | 50 | // replace |
51 | - $search = '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' /> <a href=\''.XOOPS_URL.'/modules/system/admin.php?fct=preferences&op=showmod&mod='.$mid.'\'' ; |
|
52 | - $replace = $anchor.'<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' /> <a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&lib=altsys&page=mypreferences\'' ; |
|
51 | + $search = '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' /> <a href=\''.XOOPS_URL.'/modules/system/admin.php?fct=preferences&op=showmod&mod='.$mid.'\''; |
|
52 | + $replace = $anchor.'<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' /> <a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&lib=altsys&page=mypreferences\''; |
|
53 | 53 | |
54 | 54 | // do replacement |
55 | - $new_xoops_admin_menu_dv = preg_replace('#'.preg_quote($search).'#', $replace, $xoops_admin_menu_dv) ; |
|
55 | + $new_xoops_admin_menu_dv = preg_replace('#'.preg_quote($search).'#', $replace, $xoops_admin_menu_dv); |
|
56 | 56 | |
57 | 57 | if ($xoops_admin_menu_dv == $new_xoops_admin_menu_dv) { |
58 | - return ; |
|
58 | + return; |
|
59 | 59 | } |
60 | - $xoops_admin_menu_dv = $new_xoops_admin_menu_dv ; |
|
60 | + $xoops_admin_menu_dv = $new_xoops_admin_menu_dv; |
|
61 | 61 | |
62 | - $insert = '' ; |
|
62 | + $insert = ''; |
|
63 | 63 | |
64 | 64 | // insert blocksadmin |
65 | 65 | if ($dirname != 'altsys') { |
66 | - $blocksadmin_title = defined('_MD_A_MYMENU_MYBLOCKSADMIN') ? _MD_A_MYMENU_MYBLOCKSADMIN : 'blocksadmin' ; |
|
67 | - $insert .= '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' /> <a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin\'>'.$blocksadmin_title.'</a><br />'."\n" ; |
|
66 | + $blocksadmin_title = defined('_MD_A_MYMENU_MYBLOCKSADMIN') ? _MD_A_MYMENU_MYBLOCKSADMIN : 'blocksadmin'; |
|
67 | + $insert .= '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' /> <a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin\'>'.$blocksadmin_title.'</a><br />'."\n"; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // insert tplsadmin |
71 | - $db = XoopsDatabaseFactory::getDatabaseConnection() ; |
|
72 | - list($count) = $db->fetchRow($db->query('SELECT COUNT(*) FROM ' . $db->prefix('tplfile') . " WHERE tpl_module='$dirname'")) ; |
|
71 | + $db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
72 | + list($count) = $db->fetchRow($db->query('SELECT COUNT(*) FROM '.$db->prefix('tplfile')." WHERE tpl_module='$dirname'")); |
|
73 | 73 | if ($count > 0) { |
74 | - $tplsadmin_title = defined('_MD_A_MYMENU_MYTPLSADMIN') ? _MD_A_MYMENU_MYTPLSADMIN : 'tplsadmin' ; |
|
75 | - $insert = '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' /> <a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin\'>'.$tplsadmin_title.'</a><br />'."\n".$insert ; |
|
74 | + $tplsadmin_title = defined('_MD_A_MYMENU_MYTPLSADMIN') ? _MD_A_MYMENU_MYTPLSADMIN : 'tplsadmin'; |
|
75 | + $insert = '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' /> <a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin\'>'.$tplsadmin_title.'</a><br />'."\n".$insert; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | // do insertion |
79 | - $xoops_admin_menu_dv = preg_replace('#'.preg_quote($anchor).'#', $anchor.$insert, $xoops_admin_menu_dv) ; |
|
79 | + $xoops_admin_menu_dv = preg_replace('#'.preg_quote($anchor).'#', $anchor.$insert, $xoops_admin_menu_dv); |
|
80 | 80 | |
81 | 81 | // write back |
82 | - altsys_adminmenu_save_x20(array( 'xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => (int)(@$altsys_adminmenu_ft_hacked), 'altsys_adminmenu_dv_updated' => true )) ; |
|
82 | + altsys_adminmenu_save_x20(array('xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => (int)(@$altsys_adminmenu_ft_hacked), 'altsys_adminmenu_dv_updated' => true)); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | // |
@@ -87,184 +87,184 @@ discard block |
||
87 | 87 | // |
88 | 88 | function altsys_adminmenu_hack_ft() |
89 | 89 | { |
90 | - global $altsysModuleConfig ; |
|
90 | + global $altsysModuleConfig; |
|
91 | 91 | |
92 | 92 | if (altsys_get_core_type() >= ALTSYS_CORE_TYPE_ORE) { |
93 | - return ; |
|
93 | + return; |
|
94 | 94 | } |
95 | 95 | if (empty($altsysModuleConfig['adminmenu_hack_ft'])) { |
96 | - return ; |
|
96 | + return; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | if ($altsysModuleConfig['adminmenu_hack_ft'] == ALTSYS_ADMINMENU_HACK_2COL) { |
100 | - altsys_adminmenu_hack_ft_2col_x20() ; |
|
100 | + altsys_adminmenu_hack_ft_2col_x20(); |
|
101 | 101 | } elseif ($altsysModuleConfig['adminmenu_hack_ft'] == ALTSYS_ADMINMENU_HACK_NOIMG) { |
102 | - altsys_adminmenu_hack_ft_noimg_x20() ; |
|
102 | + altsys_adminmenu_hack_ft_noimg_x20(); |
|
103 | 103 | } elseif ($altsysModuleConfig['adminmenu_hack_ft'] == ALTSYS_ADMINMENU_HACK_XCSTY) { |
104 | - altsys_adminmenu_hack_ft_xcsty_x20() ; |
|
104 | + altsys_adminmenu_hack_ft_xcsty_x20(); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | 108 | function altsys_adminmenu_hack_ft_2col_x20() |
109 | 109 | { |
110 | 110 | // read |
111 | - if (! file_exists(ALTSYS_ADMINMENU_FILE)) { |
|
112 | - redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu') ; |
|
113 | - exit ; |
|
111 | + if (!file_exists(ALTSYS_ADMINMENU_FILE)) { |
|
112 | + redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu'); |
|
113 | + exit; |
|
114 | 114 | } |
115 | - $not_inside_cp_functions = true ; |
|
116 | - include ALTSYS_ADMINMENU_FILE ; |
|
115 | + $not_inside_cp_functions = true; |
|
116 | + include ALTSYS_ADMINMENU_FILE; |
|
117 | 117 | |
118 | 118 | // check previous hack |
119 | - if (! empty($altsys_adminmenu_ft_hacked)) { |
|
119 | + if (!empty($altsys_adminmenu_ft_hacked)) { |
|
120 | 120 | if ($altsys_adminmenu_ft_hacked == ALTSYS_ADMINMENU_HACK_2COL) { |
121 | 121 | // skip |
122 | - return ; |
|
122 | + return; |
|
123 | 123 | } else { |
124 | 124 | // rebuild adminmenu |
125 | - require_once XOOPS_ROOT_PATH.'/include/cp_functions.php' ; |
|
126 | - xoops_module_write_admin_menu(xoops_module_get_admin_menu()) ; |
|
125 | + require_once XOOPS_ROOT_PATH.'/include/cp_functions.php'; |
|
126 | + xoops_module_write_admin_menu(xoops_module_get_admin_menu()); |
|
127 | 127 | // backup $xoops_admin_menu_dv |
128 | - $backup_admin_menu_dv = $xoops_admin_menu_dv ; |
|
128 | + $backup_admin_menu_dv = $xoops_admin_menu_dv; |
|
129 | 129 | // include new adminmenu |
130 | - include ALTSYS_ADMINMENU_FILE ; |
|
130 | + include ALTSYS_ADMINMENU_FILE; |
|
131 | 131 | // restore $xoops_admin_menu_dv |
132 | - $xoops_admin_menu_dv = $backup_admin_menu_dv ; |
|
132 | + $xoops_admin_menu_dv = $backup_admin_menu_dv; |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | - $search = ' alt=\'\' /></a><br />' ; |
|
137 | - $replace_fmt = ' alt="%s" /></a>' ; |
|
136 | + $search = ' alt=\'\' /></a><br />'; |
|
137 | + $replace_fmt = ' alt="%s" /></a>'; |
|
138 | 138 | |
139 | - $is_left = true ; |
|
140 | - $module_handler = xoops_getHandler('module') ; |
|
141 | - $mids = array_keys($xoops_admin_menu_ft) ; |
|
142 | - $last_mid = $mids[count($mids) - 1 ] ; |
|
139 | + $is_left = true; |
|
140 | + $module_handler = xoops_getHandler('module'); |
|
141 | + $mids = array_keys($xoops_admin_menu_ft); |
|
142 | + $last_mid = $mids[count($mids) - 1]; |
|
143 | 143 | foreach ($mids as $mid) { |
144 | - $module = $module_handler->get($mid) ; |
|
145 | - $new_menu_ft = preg_replace('#'.preg_quote($search).'#', sprintf($replace_fmt, $module->getVar('name')), $xoops_admin_menu_ft[$mid]) ; |
|
144 | + $module = $module_handler->get($mid); |
|
145 | + $new_menu_ft = preg_replace('#'.preg_quote($search).'#', sprintf($replace_fmt, $module->getVar('name')), $xoops_admin_menu_ft[$mid]); |
|
146 | 146 | if ($is_left) { |
147 | 147 | if ($mid == $last_mid) { |
148 | - $xoops_admin_menu_ft[$mid] = $new_menu_ft . '</td><td>' ; |
|
148 | + $xoops_admin_menu_ft[$mid] = $new_menu_ft.'</td><td>'; |
|
149 | 149 | } else { |
150 | - $left_body = $new_menu_ft ; |
|
151 | - $left_key = $mid ; |
|
152 | - $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',85);', $xoops_admin_menu_ml[$mid]) ; |
|
150 | + $left_body = $new_menu_ft; |
|
151 | + $left_key = $mid; |
|
152 | + $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',85);', $xoops_admin_menu_ml[$mid]); |
|
153 | 153 | } |
154 | 154 | } else { |
155 | - $xoops_admin_menu_ft[$mid] = $left_body . '</td><td>' . $new_menu_ft ; |
|
156 | - unset($xoops_admin_menu_ft[$left_key]) ; |
|
157 | - $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',185);', $xoops_admin_menu_ml[$mid]) ; |
|
155 | + $xoops_admin_menu_ft[$mid] = $left_body.'</td><td>'.$new_menu_ft; |
|
156 | + unset($xoops_admin_menu_ft[$left_key]); |
|
157 | + $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',185);', $xoops_admin_menu_ml[$mid]); |
|
158 | 158 | } |
159 | - $is_left = ! $is_left ; |
|
159 | + $is_left = !$is_left; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | // write back |
163 | - altsys_adminmenu_save_x20(array( 'xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_2COL )) ; |
|
163 | + altsys_adminmenu_save_x20(array('xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_2COL)); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
167 | 167 | function altsys_adminmenu_hack_ft_noimg_x20() |
168 | 168 | { |
169 | 169 | // read |
170 | - if (! file_exists(ALTSYS_ADMINMENU_FILE)) { |
|
171 | - redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu') ; |
|
172 | - exit ; |
|
170 | + if (!file_exists(ALTSYS_ADMINMENU_FILE)) { |
|
171 | + redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu'); |
|
172 | + exit; |
|
173 | 173 | } |
174 | - $not_inside_cp_functions = true ; |
|
175 | - include ALTSYS_ADMINMENU_FILE ; |
|
174 | + $not_inside_cp_functions = true; |
|
175 | + include ALTSYS_ADMINMENU_FILE; |
|
176 | 176 | |
177 | 177 | // check previous hack |
178 | - if (! empty($altsys_adminmenu_ft_hacked)) { |
|
178 | + if (!empty($altsys_adminmenu_ft_hacked)) { |
|
179 | 179 | if ($altsys_adminmenu_ft_hacked == ALTSYS_ADMINMENU_HACK_NOIMG) { |
180 | 180 | // skip |
181 | - return ; |
|
181 | + return; |
|
182 | 182 | } else { |
183 | 183 | // rebuild adminmenu |
184 | - require_once XOOPS_ROOT_PATH.'/include/cp_functions.php' ; |
|
185 | - xoops_module_write_admin_menu(xoops_module_get_admin_menu()) ; |
|
184 | + require_once XOOPS_ROOT_PATH.'/include/cp_functions.php'; |
|
185 | + xoops_module_write_admin_menu(xoops_module_get_admin_menu()); |
|
186 | 186 | // backup $xoops_admin_menu_dv |
187 | - $backup_admin_menu_dv = $xoops_admin_menu_dv ; |
|
187 | + $backup_admin_menu_dv = $xoops_admin_menu_dv; |
|
188 | 188 | // include new adminmenu |
189 | - include ALTSYS_ADMINMENU_FILE ; |
|
189 | + include ALTSYS_ADMINMENU_FILE; |
|
190 | 190 | // restore $xoops_admin_menu_dv |
191 | - $xoops_admin_menu_dv = $backup_admin_menu_dv ; |
|
191 | + $xoops_admin_menu_dv = $backup_admin_menu_dv; |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
195 | - $module_handler = xoops_getHandler('module') ; |
|
196 | - $mids = array_keys($xoops_admin_menu_ft) ; |
|
195 | + $module_handler = xoops_getHandler('module'); |
|
196 | + $mids = array_keys($xoops_admin_menu_ft); |
|
197 | 197 | foreach ($mids as $mid) { |
198 | - $module = $module_handler->get($mid) ; |
|
199 | - $xoops_admin_menu_ft[$mid] = preg_replace('/\<img src\=.*$/', $module->getVar('name').'</a>', $xoops_admin_menu_ft[$mid]) ; |
|
200 | - $xoops_admin_menu_ft[$mid] = '<div style="text-align:'._GLOBAL_LEFT.';background-color:#CCC;" title="'.$module->getVar('dirname').'">'.$xoops_admin_menu_ft[$mid].'</div>' ; |
|
201 | - $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',45);', $xoops_admin_menu_ml[$mid]) ; |
|
198 | + $module = $module_handler->get($mid); |
|
199 | + $xoops_admin_menu_ft[$mid] = preg_replace('/\<img src\=.*$/', $module->getVar('name').'</a>', $xoops_admin_menu_ft[$mid]); |
|
200 | + $xoops_admin_menu_ft[$mid] = '<div style="text-align:'._GLOBAL_LEFT.';background-color:#CCC;" title="'.$module->getVar('dirname').'">'.$xoops_admin_menu_ft[$mid].'</div>'; |
|
201 | + $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',45);', $xoops_admin_menu_ml[$mid]); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | // write back |
205 | - altsys_adminmenu_save_x20(array( 'xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_NOIMG )) ; |
|
205 | + altsys_adminmenu_save_x20(array('xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_NOIMG)); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
209 | 209 | function altsys_adminmenu_hack_ft_xcsty_x20() |
210 | 210 | { |
211 | 211 | // read |
212 | - if (! file_exists(ALTSYS_ADMINMENU_FILE)) { |
|
213 | - redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu') ; |
|
214 | - exit ; |
|
212 | + if (!file_exists(ALTSYS_ADMINMENU_FILE)) { |
|
213 | + redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu'); |
|
214 | + exit; |
|
215 | 215 | } |
216 | - $not_inside_cp_functions = true ; |
|
217 | - include ALTSYS_ADMINMENU_FILE ; |
|
216 | + $not_inside_cp_functions = true; |
|
217 | + include ALTSYS_ADMINMENU_FILE; |
|
218 | 218 | |
219 | 219 | // check previous hack |
220 | - if (! empty($altsys_adminmenu_ft_hacked)) { |
|
220 | + if (!empty($altsys_adminmenu_ft_hacked)) { |
|
221 | 221 | if ($altsys_adminmenu_ft_hacked == ALTSYS_ADMINMENU_HACK_XCSTY && empty($altsys_adminmenu_dv_updated)) { |
222 | 222 | // skip |
223 | - return ; |
|
223 | + return; |
|
224 | 224 | } else { |
225 | 225 | // rebuild adminmenu |
226 | - require_once XOOPS_ROOT_PATH.'/include/cp_functions.php' ; |
|
227 | - $fp = fopen(ALTSYS_ADMINMENU_FILE, 'wb') ; |
|
228 | - fwrite($fp, xoops_module_get_admin_menu()) ; |
|
229 | - fclose($fp) ; |
|
226 | + require_once XOOPS_ROOT_PATH.'/include/cp_functions.php'; |
|
227 | + $fp = fopen(ALTSYS_ADMINMENU_FILE, 'wb'); |
|
228 | + fwrite($fp, xoops_module_get_admin_menu()); |
|
229 | + fclose($fp); |
|
230 | 230 | // backup $xoops_admin_menu_dv |
231 | - $backup_admin_menu_dv = $xoops_admin_menu_dv ; |
|
231 | + $backup_admin_menu_dv = $xoops_admin_menu_dv; |
|
232 | 232 | // include new adminmenu |
233 | - include ALTSYS_ADMINMENU_FILE ; |
|
233 | + include ALTSYS_ADMINMENU_FILE; |
|
234 | 234 | // restore $xoops_admin_menu_dv |
235 | - $xoops_admin_menu_dv = $backup_admin_menu_dv ; |
|
235 | + $xoops_admin_menu_dv = $backup_admin_menu_dv; |
|
236 | 236 | } |
237 | 237 | } |
238 | 238 | |
239 | - $module_handler = xoops_getHandler('module') ; |
|
240 | - $mids = array_keys($xoops_admin_menu_ft) ; |
|
239 | + $module_handler = xoops_getHandler('module'); |
|
240 | + $mids = array_keys($xoops_admin_menu_ft); |
|
241 | 241 | foreach ($mids as $mid) { |
242 | - $module = $module_handler->get($mid) ; |
|
243 | - $submenuitems = array() ; |
|
242 | + $module = $module_handler->get($mid); |
|
243 | + $submenuitems = array(); |
|
244 | 244 | if (preg_match('/popUpL\d+/', $xoops_admin_menu_ft[$mid], $regs)) { |
245 | - $popup = $regs[0] ; |
|
246 | - preg_match_all('#\<a href.*'.$popup.'\(\).*\</a>#U', $xoops_admin_menu_dv, $regs) ; |
|
245 | + $popup = $regs[0]; |
|
246 | + preg_match_all('#\<a href.*'.$popup.'\(\).*\</a>#U', $xoops_admin_menu_dv, $regs); |
|
247 | 247 | foreach ($regs[0] as $submenuitem) { |
248 | - $submenuitems[] = str_replace($popup.'();', '', $submenuitem) ; |
|
248 | + $submenuitems[] = str_replace($popup.'();', '', $submenuitem); |
|
249 | 249 | } |
250 | 250 | } else { |
251 | - return ; |
|
251 | + return; |
|
252 | 252 | } |
253 | 253 | // module icon |
254 | 254 | if (preg_match('#\<img .*/\>#U', $xoops_admin_menu_ft[$mid], $regs)) { |
255 | - $icon_img = str_replace("alt=''", 'alt="'.$module->getVar('name').'"', $regs[0]) ; |
|
255 | + $icon_img = str_replace("alt=''", 'alt="'.$module->getVar('name').'"', $regs[0]); |
|
256 | 256 | } else { |
257 | - $icon_img = '' ; |
|
257 | + $icon_img = ''; |
|
258 | 258 | } |
259 | 259 | // version number |
260 | - $icon_img .= '<span class="version" style="">' . sprintf('%.2f', $module->getVar('version') / 100.0) . '</span>' ; |
|
261 | - $newline = preg_replace('/ onmouseover.*$/', '', $xoops_admin_menu_ft[$mid]) ; |
|
262 | - $newline = "\n".'<!-- '.$popup.' --><div id="adminmenu_ft'.$mid.'" style="text-align:'._GLOBAL_LEFT.';background-color:#CCC;" title="'.$module->getVar('dirname').'"><a id="adminmenu_ftpoint'.$mid.'" href="javascript:void(0);" onclick="submenuToggle('.$mid.');">+</a> '.$newline.'>'.$module->getVar('name').'</a></div><div id="adminmenu_ftsub'.$mid.'" style="display:none;"><ul>' ; |
|
260 | + $icon_img .= '<span class="version" style="">'.sprintf('%.2f', $module->getVar('version') / 100.0).'</span>'; |
|
261 | + $newline = preg_replace('/ onmouseover.*$/', '', $xoops_admin_menu_ft[$mid]); |
|
262 | + $newline = "\n".'<!-- '.$popup.' --><div id="adminmenu_ft'.$mid.'" style="text-align:'._GLOBAL_LEFT.';background-color:#CCC;" title="'.$module->getVar('dirname').'"><a id="adminmenu_ftpoint'.$mid.'" href="javascript:void(0);" onclick="submenuToggle('.$mid.');">+</a> '.$newline.'>'.$module->getVar('name').'</a></div><div id="adminmenu_ftsub'.$mid.'" style="display:none;"><ul>'; |
|
263 | 263 | foreach ($submenuitems as $submenuitem) { |
264 | - $newline .= '<li>'.$submenuitem.'</li>' ; |
|
264 | + $newline .= '<li>'.$submenuitem.'</li>'; |
|
265 | 265 | } |
266 | - $newline .= '</ul>'.$icon_img.'</div>' ; |
|
267 | - $xoops_admin_menu_ft[$mid] = $newline ; |
|
266 | + $newline .= '</ul>'.$icon_img.'</div>'; |
|
267 | + $xoops_admin_menu_ft[$mid] = $newline; |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | $xoops_admin_menu_js = " |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | }" ; |
281 | 281 | |
282 | 282 | // write back |
283 | - altsys_adminmenu_save_x20(array( 'xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => array(), 'xoops_admin_menu_sd' => array(), 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_XCSTY )) ; |
|
283 | + altsys_adminmenu_save_x20(array('xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => array(), 'xoops_admin_menu_sd' => array(), 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_XCSTY)); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | |
@@ -291,18 +291,18 @@ discard block |
||
291 | 291 | function altsys_adminmenu_save_x20($xoops_admin_vars) |
292 | 292 | { |
293 | 293 | // variable definitions |
294 | - ob_start() ; |
|
295 | - echo "<?php\n// modified by altsys\nif( ! defined('XOOPS_ROOT_PATH') ) exit ;\n" ; |
|
294 | + ob_start(); |
|
295 | + echo "<?php\n// modified by altsys\nif( ! defined('XOOPS_ROOT_PATH') ) exit ;\n"; |
|
296 | 296 | foreach ($xoops_admin_vars as $key => $val) { |
297 | - echo '$' . $key . " = \n" ; |
|
298 | - @var_export($val) ; |
|
299 | - echo " ;\n" ; |
|
297 | + echo '$'.$key." = \n"; |
|
298 | + @var_export($val); |
|
299 | + echo " ;\n"; |
|
300 | 300 | } |
301 | - $output = ob_get_contents() ; |
|
302 | - ob_end_clean() ; |
|
301 | + $output = ob_get_contents(); |
|
302 | + ob_end_clean(); |
|
303 | 303 | |
304 | 304 | // embedding logics |
305 | - if (in_array(@$xoops_admin_vars['altsys_adminmenu_ft_hacked'], array( ALTSYS_ADMINMENU_HACK_NOIMG, ALTSYS_ADMINMENU_HACK_XCSTY ))) { |
|
305 | + if (in_array(@$xoops_admin_vars['altsys_adminmenu_ft_hacked'], array(ALTSYS_ADMINMENU_HACK_NOIMG, ALTSYS_ADMINMENU_HACK_XCSTY))) { |
|
306 | 306 | $output .= ' |
307 | 307 | |
308 | 308 | if( is_object( @$GLOBALS["xoopsModule"] ) && empty( $not_inside_cp_functions ) ) { |
@@ -317,13 +317,13 @@ discard block |
||
317 | 317 | } |
318 | 318 | |
319 | 319 | // termination |
320 | - $output .= "\n\n?>" ; |
|
320 | + $output .= "\n\n?>"; |
|
321 | 321 | |
322 | 322 | // replace into XOOPS_URL |
323 | - $output = str_replace(XOOPS_URL, "'.XOOPS_URL.'", $output) ; |
|
323 | + $output = str_replace(XOOPS_URL, "'.XOOPS_URL.'", $output); |
|
324 | 324 | |
325 | 325 | // output |
326 | - $fp = fopen(ALTSYS_ADMINMENU_FILE, 'wb') ; |
|
327 | - fwrite($fp, $output) ; |
|
328 | - fclose($fp) ; |
|
326 | + $fp = fopen(ALTSYS_ADMINMENU_FILE, 'wb'); |
|
327 | + fwrite($fp, $output); |
|
328 | + fclose($fp); |
|
329 | 329 | } |
@@ -2,149 +2,149 @@ 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 | - public $_errors = array() ; |
|
9 | - public $_latest_token = '' ; |
|
10 | - public $messages = array() ; |
|
8 | + public $_errors = array(); |
|
9 | + public $_latest_token = ''; |
|
10 | + public $messages = array(); |
|
11 | 11 | |
12 | 12 | public function __construct() |
13 | 13 | { |
14 | - global $xoopsConfig ; |
|
14 | + global $xoopsConfig; |
|
15 | 15 | |
16 | 16 | // language file |
17 | - if (defined('XOOPS_ROOT_PATH') && ! empty($xoopsConfig['language']) && ! strstr($xoopsConfig['language'], '/')) { |
|
18 | - if (file_exists(dirname(__DIR__) . '/language/' . $xoopsConfig['language'] . '/gticket_messages.phtml')) { |
|
19 | - include dirname(__DIR__) . '/language/' . $xoopsConfig['language'] . '/gticket_messages.phtml' ; |
|
17 | + if (defined('XOOPS_ROOT_PATH') && !empty($xoopsConfig['language']) && !strstr($xoopsConfig['language'], '/')) { |
|
18 | + if (file_exists(dirname(__DIR__).'/language/'.$xoopsConfig['language'].'/gticket_messages.phtml')) { |
|
19 | + include dirname(__DIR__).'/language/'.$xoopsConfig['language'].'/gticket_messages.phtml'; |
|
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
23 | 23 | // default messages |
24 | 24 | if (empty($this->messages)) { |
25 | 25 | $this->messages = array( |
26 | - 'err_general' => 'GTicket Error' , |
|
27 | - 'err_nostubs' => 'No stubs found' , |
|
28 | - 'err_noticket' => 'No ticket found' , |
|
29 | - 'err_nopair' => 'No valid ticket-stub pair found' , |
|
30 | - 'err_timeout' => 'Time out' , |
|
31 | - 'err_areaorref' => 'Invalid area or referer' , |
|
32 | - '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?' , |
|
26 | + 'err_general' => 'GTicket Error', |
|
27 | + 'err_nostubs' => 'No stubs found', |
|
28 | + 'err_noticket' => 'No ticket found', |
|
29 | + 'err_nopair' => 'No valid ticket-stub pair found', |
|
30 | + 'err_timeout' => 'Time out', |
|
31 | + 'err_areaorref' => 'Invalid area or referer', |
|
32 | + '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?', |
|
33 | 33 | 'btn_repost' => 'repost' |
34 | - ) ; |
|
34 | + ); |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
38 | 38 | // render form as plain html |
39 | 39 | public function getTicketHtml($salt = '', $timeout = 1800, $area = '') |
40 | 40 | { |
41 | - return '<input type="hidden" name="XOOPS_G_TICKET" value="'.$this->issue($salt, $timeout, $area).'" />' ; |
|
41 | + return '<input type="hidden" name="XOOPS_G_TICKET" value="'.$this->issue($salt, $timeout, $area).'" />'; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | // returns an object of XoopsFormHidden including theh ticket |
45 | 45 | public function getTicketXoopsForm($salt = '', $timeout = 1800, $area = '') |
46 | 46 | { |
47 | - return new XoopsFormHidden('XOOPS_G_TICKET', $this->issue($salt, $timeout, $area)) ; |
|
47 | + return new XoopsFormHidden('XOOPS_G_TICKET', $this->issue($salt, $timeout, $area)); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | // add a ticket as Hidden Element into XoopsForm |
51 | 51 | public function addTicketXoopsFormElement(&$form, $salt = '', $timeout = 1800, $area = '') |
52 | 52 | { |
53 | - $form->addElement(new XoopsFormHidden('XOOPS_G_TICKET', $this->issue($salt, $timeout, $area))) ; |
|
53 | + $form->addElement(new XoopsFormHidden('XOOPS_G_TICKET', $this->issue($salt, $timeout, $area))); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | // returns an array for xoops_confirm() ; |
57 | 57 | public function getTicketArray($salt = '', $timeout = 1800, $area = '') |
58 | 58 | { |
59 | - return array( 'XOOPS_G_TICKET' => $this->issue($salt, $timeout, $area) ) ; |
|
59 | + return array('XOOPS_G_TICKET' => $this->issue($salt, $timeout, $area)); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | // return GET parameter string. |
63 | - public function getTicketParamString($salt = '', $noamp = false, $timeout=1800, $area = '') |
|
63 | + public function getTicketParamString($salt = '', $noamp = false, $timeout = 1800, $area = '') |
|
64 | 64 | { |
65 | - return ($noamp ? '' : '&') . 'XOOPS_G_TICKET=' . $this->issue($salt, $timeout, $area) ; |
|
65 | + return ($noamp ? '' : '&').'XOOPS_G_TICKET='.$this->issue($salt, $timeout, $area); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // issue a ticket |
69 | 69 | public function issue($salt = '', $timeout = 1800, $area = '') |
70 | 70 | { |
71 | - global $xoopsModule ; |
|
71 | + global $xoopsModule; |
|
72 | 72 | if ('' === $salt) { |
73 | 73 | // $salt = '$2y$07$' . strtr(base64_encode(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM)), '+', '.'); |
74 | - $salt= '$2y$07$' . str_replace('+', '.', base64_encode(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM))); |
|
74 | + $salt = '$2y$07$'.str_replace('+', '.', base64_encode(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM))); |
|
75 | 75 | } |
76 | 76 | // create a token |
77 | - list($usec, $sec) = explode(' ', microtime()) ; |
|
78 | - $appendix_salt = empty($_SERVER['PATH']) ? XOOPS_DB_NAME : $_SERVER['PATH'] ; |
|
79 | - $token = crypt($salt . $usec . $appendix_salt . $sec, $salt) ; |
|
80 | - $this->_latest_token = $token ; |
|
77 | + list($usec, $sec) = explode(' ', microtime()); |
|
78 | + $appendix_salt = empty($_SERVER['PATH']) ? XOOPS_DB_NAME : $_SERVER['PATH']; |
|
79 | + $token = crypt($salt.$usec.$appendix_salt.$sec, $salt); |
|
80 | + $this->_latest_token = $token; |
|
81 | 81 | |
82 | 82 | if (empty($_SESSION['XOOPS_G_STUBS'])) { |
83 | - $_SESSION['XOOPS_G_STUBS'] = array() ; |
|
83 | + $_SESSION['XOOPS_G_STUBS'] = array(); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | // limit max stubs 10 |
87 | 87 | if (count($_SESSION['XOOPS_G_STUBS']) > 10) { |
88 | - $_SESSION['XOOPS_G_STUBS'] = array_slice($_SESSION['XOOPS_G_STUBS'], -10) ; |
|
88 | + $_SESSION['XOOPS_G_STUBS'] = array_slice($_SESSION['XOOPS_G_STUBS'], -10); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | // record referer if browser send it |
92 | - $referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['REQUEST_URI'] ; |
|
92 | + $referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['REQUEST_URI']; |
|
93 | 93 | |
94 | 94 | // area as module's dirname |
95 | - if (! $area && is_object(@$xoopsModule)) { |
|
96 | - $area = $xoopsModule->getVar('dirname') ; |
|
95 | + if (!$area && is_object(@$xoopsModule)) { |
|
96 | + $area = $xoopsModule->getVar('dirname'); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | // store stub |
100 | 100 | $_SESSION['XOOPS_G_STUBS'][] = array( |
101 | - 'expire' => time() + $timeout , |
|
102 | - 'referer' => $referer , |
|
103 | - 'area' => $area , |
|
101 | + 'expire' => time() + $timeout, |
|
102 | + 'referer' => $referer, |
|
103 | + 'area' => $area, |
|
104 | 104 | 'token' => $token |
105 | - ) ; |
|
105 | + ); |
|
106 | 106 | |
107 | 107 | // paid md5ed token as a ticket |
108 | - return md5($token . XOOPS_DB_PREFIX) ; |
|
108 | + return md5($token.XOOPS_DB_PREFIX); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | // check a ticket |
112 | 112 | public function check($post = true, $area = '', $allow_repost = true) |
113 | 113 | { |
114 | - global $xoopsModule ; |
|
114 | + global $xoopsModule; |
|
115 | 115 | |
116 | - $this->_errors = array() ; |
|
116 | + $this->_errors = array(); |
|
117 | 117 | |
118 | 118 | // CHECK: stubs are not stored in session |
119 | - if (! is_array(@$_SESSION['XOOPS_G_STUBS'])) { |
|
120 | - $this->_errors[] = $this->messages['err_nostubs'] ; |
|
121 | - $_SESSION['XOOPS_G_STUBS'] = array() ; |
|
119 | + if (!is_array(@$_SESSION['XOOPS_G_STUBS'])) { |
|
120 | + $this->_errors[] = $this->messages['err_nostubs']; |
|
121 | + $_SESSION['XOOPS_G_STUBS'] = array(); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | // get key&val of the ticket from a user's query |
125 | - $ticket = $post ? @$_POST['XOOPS_G_TICKET'] : @$_GET['XOOPS_G_TICKET'] ; |
|
125 | + $ticket = $post ? @$_POST['XOOPS_G_TICKET'] : @$_GET['XOOPS_G_TICKET']; |
|
126 | 126 | |
127 | 127 | // CHECK: no tickets found |
128 | 128 | if (empty($ticket)) { |
129 | - $this->_errors[] = $this->messages['err_noticket'] ; |
|
129 | + $this->_errors[] = $this->messages['err_noticket']; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | // gargage collection & find a right stub |
133 | - $stubs_tmp = $_SESSION['XOOPS_G_STUBS'] ; |
|
134 | - $_SESSION['XOOPS_G_STUBS'] = array() ; |
|
133 | + $stubs_tmp = $_SESSION['XOOPS_G_STUBS']; |
|
134 | + $_SESSION['XOOPS_G_STUBS'] = array(); |
|
135 | 135 | foreach ($stubs_tmp as $stub) { |
136 | 136 | // default lifetime 30min |
137 | 137 | if ($stub['expire'] >= time()) { |
138 | - if (md5($stub['token'] . XOOPS_DB_PREFIX) === $ticket) { |
|
139 | - $found_stub = $stub ; |
|
138 | + if (md5($stub['token'].XOOPS_DB_PREFIX) === $ticket) { |
|
139 | + $found_stub = $stub; |
|
140 | 140 | } else { |
141 | 141 | // store the other valid stubs into session |
142 | - $_SESSION['XOOPS_G_STUBS'][] = $stub ; |
|
142 | + $_SESSION['XOOPS_G_STUBS'][] = $stub; |
|
143 | 143 | } |
144 | 144 | } else { |
145 | - if (md5($stub['token'] . XOOPS_DB_PREFIX) === $ticket) { |
|
145 | + if (md5($stub['token'].XOOPS_DB_PREFIX) === $ticket) { |
|
146 | 146 | // not CSRF but Time-Out |
147 | - $timeout_flag = true ; |
|
147 | + $timeout_flag = true; |
|
148 | 148 | } |
149 | 149 | } |
150 | 150 | } |
@@ -152,40 +152,40 @@ discard block |
||
152 | 152 | // CHECK: the right stub found or not |
153 | 153 | if (empty($found_stub)) { |
154 | 154 | if (empty($timeout_flag)) { |
155 | - $this->_errors[] = $this->messages['err_nopair'] ; |
|
155 | + $this->_errors[] = $this->messages['err_nopair']; |
|
156 | 156 | } else { |
157 | - $this->_errors[] = $this->messages['err_timeout'] ; |
|
157 | + $this->_errors[] = $this->messages['err_timeout']; |
|
158 | 158 | } |
159 | 159 | } else { |
160 | 160 | |
161 | 161 | // set area if necessary |
162 | 162 | // area as module's dirname |
163 | - if (! $area && is_object(@$xoopsModule)) { |
|
164 | - $area = $xoopsModule->getVar('dirname') ; |
|
163 | + if (!$area && is_object(@$xoopsModule)) { |
|
164 | + $area = $xoopsModule->getVar('dirname'); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | // check area or referer |
168 | 168 | if (@$found_stub['area'] == $area) { |
169 | - $area_check = true ; |
|
169 | + $area_check = true; |
|
170 | 170 | } |
171 | - if (! empty($found_stub['referer']) && strstr(@$_SERVER['HTTP_REFERER'], $found_stub['referer'])) { |
|
172 | - $referer_check = true ; |
|
171 | + if (!empty($found_stub['referer']) && strstr(@$_SERVER['HTTP_REFERER'], $found_stub['referer'])) { |
|
172 | + $referer_check = true; |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | if (empty($area_check) && empty($referer_check)) { // loose |
176 | - $this->_errors[] = $this->messages['err_areaorref'] ; |
|
176 | + $this->_errors[] = $this->messages['err_areaorref']; |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
180 | - if (! empty($this->_errors)) { |
|
180 | + if (!empty($this->_errors)) { |
|
181 | 181 | if ($allow_repost) { |
182 | 182 | // repost form |
183 | - $this->draw_repost_form($area) ; |
|
184 | - exit ; |
|
183 | + $this->draw_repost_form($area); |
|
184 | + exit; |
|
185 | 185 | } else { |
186 | 186 | // failed |
187 | - $this->clear() ; |
|
188 | - return false ; |
|
187 | + $this->clear(); |
|
188 | + return false; |
|
189 | 189 | } |
190 | 190 | } else { |
191 | 191 | // all green |
@@ -198,78 +198,78 @@ discard block |
||
198 | 198 | { |
199 | 199 | // Notify which file is broken |
200 | 200 | if (headers_sent()) { |
201 | - restore_error_handler() ; |
|
202 | - set_error_handler(array( &$this, 'errorHandler4FindOutput' )) ; |
|
203 | - header('Dummy: for warning') ; |
|
204 | - restore_error_handler() ; |
|
205 | - exit ; |
|
201 | + restore_error_handler(); |
|
202 | + set_error_handler(array(&$this, 'errorHandler4FindOutput')); |
|
203 | + header('Dummy: for warning'); |
|
204 | + restore_error_handler(); |
|
205 | + exit; |
|
206 | 206 | } |
207 | 207 | |
208 | - $table = '<table>' ; |
|
209 | - $form = '<form action="?'.htmlspecialchars(@$_SERVER['QUERY_STRING'], ENT_QUOTES).'" method="post" >' ; |
|
208 | + $table = '<table>'; |
|
209 | + $form = '<form action="?'.htmlspecialchars(@$_SERVER['QUERY_STRING'], ENT_QUOTES).'" method="post" >'; |
|
210 | 210 | foreach ($_POST as $key => $val) { |
211 | 211 | if ($key == 'XOOPS_G_TICKET') { |
212 | - continue ; |
|
212 | + continue; |
|
213 | 213 | } |
214 | 214 | if (get_magic_quotes_gpc()) { |
215 | - $key = stripslashes($key) ; |
|
215 | + $key = stripslashes($key); |
|
216 | 216 | } |
217 | 217 | if (is_array($val)) { |
218 | - list($tmp_table, $tmp_form) = $this->extract_post_recursive(htmlspecialchars($key, ENT_QUOTES), $val) ; |
|
219 | - $table .= $tmp_table ; |
|
220 | - $form .= $tmp_form ; |
|
218 | + list($tmp_table, $tmp_form) = $this->extract_post_recursive(htmlspecialchars($key, ENT_QUOTES), $val); |
|
219 | + $table .= $tmp_table; |
|
220 | + $form .= $tmp_form; |
|
221 | 221 | } else { |
222 | 222 | if (get_magic_quotes_gpc()) { |
223 | - $val = stripslashes($val) ; |
|
223 | + $val = stripslashes($val); |
|
224 | 224 | } |
225 | - $table .= '<tr><th>'.htmlspecialchars($key, ENT_QUOTES).'</th><td>'.htmlspecialchars($val, ENT_QUOTES).'</td></tr>'."\n" ; |
|
226 | - $form .= '<input type="hidden" name="'.htmlspecialchars($key, ENT_QUOTES).'" value="'.htmlspecialchars($val, ENT_QUOTES).'" />'."\n" ; |
|
225 | + $table .= '<tr><th>'.htmlspecialchars($key, ENT_QUOTES).'</th><td>'.htmlspecialchars($val, ENT_QUOTES).'</td></tr>'."\n"; |
|
226 | + $form .= '<input type="hidden" name="'.htmlspecialchars($key, ENT_QUOTES).'" value="'.htmlspecialchars($val, ENT_QUOTES).'" />'."\n"; |
|
227 | 227 | } |
228 | 228 | } |
229 | - $table .= '</table>' ; |
|
230 | - $form .= $this->getTicketHtml(__LINE__, 300, $area).'<input type="submit" value="'.$this->messages['btn_repost'].'" /></form>' ; |
|
229 | + $table .= '</table>'; |
|
230 | + $form .= $this->getTicketHtml(__LINE__, 300, $area).'<input type="submit" value="'.$this->messages['btn_repost'].'" /></form>'; |
|
231 | 231 | |
232 | - error_reporting(0) ; |
|
232 | + error_reporting(0); |
|
233 | 233 | while (@ob_get_level() && @ob_end_clean()); |
234 | 234 | |
235 | - 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>' ; |
|
235 | + 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>'; |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | public function extract_post_recursive($key_name, $tmp_array) |
239 | 239 | { |
240 | - $table = '' ; |
|
241 | - $form = '' ; |
|
240 | + $table = ''; |
|
241 | + $form = ''; |
|
242 | 242 | foreach ($tmp_array as $key => $val) { |
243 | 243 | if (get_magic_quotes_gpc()) { |
244 | - $key = stripslashes($key) ; |
|
244 | + $key = stripslashes($key); |
|
245 | 245 | } |
246 | 246 | if (is_array($val)) { |
247 | - list($tmp_table, $tmp_form) = $this->extract_post_recursive($key_name.'['.htmlspecialchars($key, ENT_QUOTES).']', $val) ; |
|
248 | - $table .= $tmp_table ; |
|
249 | - $form .= $tmp_form ; |
|
247 | + list($tmp_table, $tmp_form) = $this->extract_post_recursive($key_name.'['.htmlspecialchars($key, ENT_QUOTES).']', $val); |
|
248 | + $table .= $tmp_table; |
|
249 | + $form .= $tmp_form; |
|
250 | 250 | } else { |
251 | 251 | if (get_magic_quotes_gpc()) { |
252 | - $val = stripslashes($val) ; |
|
252 | + $val = stripslashes($val); |
|
253 | 253 | } |
254 | - $table .= '<tr><th>'.$key_name.'['.htmlspecialchars($key, ENT_QUOTES).']</th><td>'.htmlspecialchars($val, ENT_QUOTES).'</td></tr>'."\n" ; |
|
255 | - $form .= '<input type="hidden" name="'.$key_name.'['.htmlspecialchars($key, ENT_QUOTES).']" value="'.htmlspecialchars($val, ENT_QUOTES).'" />'."\n" ; |
|
254 | + $table .= '<tr><th>'.$key_name.'['.htmlspecialchars($key, ENT_QUOTES).']</th><td>'.htmlspecialchars($val, ENT_QUOTES).'</td></tr>'."\n"; |
|
255 | + $form .= '<input type="hidden" name="'.$key_name.'['.htmlspecialchars($key, ENT_QUOTES).']" value="'.htmlspecialchars($val, ENT_QUOTES).'" />'."\n"; |
|
256 | 256 | } |
257 | 257 | } |
258 | - return array( $table , $form ) ; |
|
258 | + return array($table, $form); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | |
262 | 262 | // clear all stubs |
263 | 263 | public function clear() |
264 | 264 | { |
265 | - $_SESSION['XOOPS_G_STUBS'] = array() ; |
|
265 | + $_SESSION['XOOPS_G_STUBS'] = array(); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
269 | 269 | // Ticket Using |
270 | 270 | public function using() |
271 | 271 | { |
272 | - if (! empty($_SESSION['XOOPS_G_STUBS'])) { |
|
272 | + if (!empty($_SESSION['XOOPS_G_STUBS'])) { |
|
273 | 273 | return true; |
274 | 274 | } else { |
275 | 275 | return false; |
@@ -281,39 +281,39 @@ discard block |
||
281 | 281 | public function getErrors($ashtml = true) |
282 | 282 | { |
283 | 283 | if ($ashtml) { |
284 | - $ret = '' ; |
|
284 | + $ret = ''; |
|
285 | 285 | foreach ($this->_errors as $msg) { |
286 | - $ret .= "$msg<br />\n" ; |
|
286 | + $ret .= "$msg<br />\n"; |
|
287 | 287 | } |
288 | 288 | } else { |
289 | - $ret = $this->_errors ; |
|
289 | + $ret = $this->_errors; |
|
290 | 290 | } |
291 | - return $ret ; |
|
291 | + return $ret; |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | public function errorHandler4FindOutput($errNo, $errStr, $errFile, $errLine) |
295 | 295 | { |
296 | 296 | if (preg_match('?'.preg_quote(XOOPS_ROOT_PATH).'([^:]+)\:(\d+)?', $errStr, $regs)) { |
297 | - echo 'Irregular output! check the file ' . htmlspecialchars($regs[1]) . ' line ' . htmlspecialchars($regs[2]) ; |
|
297 | + echo 'Irregular output! check the file '.htmlspecialchars($regs[1]).' line '.htmlspecialchars($regs[2]); |
|
298 | 298 | } else { |
299 | 299 | echo 'Irregular output! check language files etc.'; |
300 | 300 | } |
301 | - return ; |
|
301 | + return; |
|
302 | 302 | } |
303 | 303 | // end of class |
304 | 304 | } |
305 | 305 | |
306 | 306 | // create a instance in global scope |
307 | -$GLOBALS['xoopsGTicket'] = new XoopsGTicket() ; |
|
307 | +$GLOBALS['xoopsGTicket'] = new XoopsGTicket(); |
|
308 | 308 | } |
309 | 309 | |
310 | -if (! function_exists('admin_refcheck')) { |
|
310 | +if (!function_exists('admin_refcheck')) { |
|
311 | 311 | |
312 | 312 | //Admin Referer Check By Marijuana(Rev.011) |
313 | 313 | function admin_refcheck($chkref = '') |
314 | 314 | { |
315 | 315 | if (empty($_SERVER['HTTP_REFERER'])) { |
316 | - return true ; |
|
316 | + return true; |
|
317 | 317 | } else { |
318 | 318 | $ref = $_SERVER['HTTP_REFERER']; |
319 | 319 | } |
@@ -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); |
@@ -137,33 +137,33 @@ discard block |
||
137 | 137 | |
138 | 138 | if (defined('ALTSYS_TPLSADMIN_BASEPATH')) { |
139 | 139 | // Special hook |
140 | - $path = ALTSYS_TPLSADMIN_BASEPATH.'/'.substr($tpl_file, strlen($dirname) + 1) ; |
|
141 | - } elseif ($mytrustdirname || @include XOOPS_ROOT_PATH . '/modules/' . $dirname . '/mytrustdirname.php') { |
|
140 | + $path = ALTSYS_TPLSADMIN_BASEPATH.'/'.substr($tpl_file, strlen($dirname) + 1); |
|
141 | + } elseif ($mytrustdirname || @include XOOPS_ROOT_PATH.'/modules/'.$dirname.'/mytrustdirname.php') { |
|
142 | 142 | // D3 module base |
143 | - if (! empty($mytrustdirname)) { |
|
144 | - $mid_path = $mytrustdirname == 'altsys' ? '/libs/' : '/modules/' ; |
|
143 | + if (!empty($mytrustdirname)) { |
|
144 | + $mid_path = $mytrustdirname == 'altsys' ? '/libs/' : '/modules/'; |
|
145 | 145 | |
146 | - $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type=='block'?'blocks/':'').substr($tpl_file, strlen($dirname) + 1) ; |
|
146 | + $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type == 'block' ? 'blocks/' : '').substr($tpl_file, strlen($dirname) + 1); |
|
147 | 147 | //new for xcck etc.other trust_module |
148 | - if (! file_exists($path)) { |
|
149 | - $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type=='block'?'blocks/':'').$tpl_file ; |
|
150 | - if (! file_exists($path)) { |
|
148 | + if (!file_exists($path)) { |
|
149 | + $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type == 'block' ? 'blocks/' : '').$tpl_file; |
|
150 | + if (!file_exists($path)) { |
|
151 | 151 | $path = $basefilepath; |
152 | 152 | } |
153 | 153 | } |
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
157 | - return $path ; |
|
157 | + return $path; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
161 | 161 | function tplsadmin_die($msg, $target_dirname = '', $wait = 2) |
162 | 162 | { |
163 | 163 | if (strtolower($_SERVER['REQUEST_METHOD']) === 'post') { |
164 | - redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, $wait, $msg) ; |
|
165 | - exit ; |
|
164 | + redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, $wait, $msg); |
|
165 | + exit; |
|
166 | 166 | } else { |
167 | - die($msg) ; |
|
167 | + die($msg); |
|
168 | 168 | } |
169 | 169 | } |
@@ -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 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | // This is a mimic file from header.php of 2.0.16-JP |
21 | 21 | |
22 | -require_once dirname(__DIR__).'/class/AltsysBreadcrumbs.class.php' ; |
|
22 | +require_once dirname(__DIR__).'/class/AltsysBreadcrumbs.class.php'; |
|
23 | 23 | include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php'; |
24 | 24 | |
25 | 25 | $xoopsOption['theme_use_smarty'] = 1; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | //HACK by domifara |
49 | 49 | if (defined('XOOPS_CUBE_LEGACY')) { |
50 | 50 | $handler = xoops_getHandler('block'); |
51 | - $xoopsblock = $handler->create(false) ; |
|
51 | + $xoopsblock = $handler->create(false); |
|
52 | 52 | } else { |
53 | 53 | $xoopsblock = new XoopsBlock(); |
54 | 54 | } |
@@ -58,46 +58,46 @@ discard block |
||
58 | 58 | if (is_object($xoopsUser)) { |
59 | 59 | $xoopsTpl->assign(array('xoops_isuser' => true, 'xoops_userid' => $xoopsUser->getVar('uid'), 'xoops_uname' => $xoopsUser->getVar('uname'), 'xoops_isadmin' => $xoopsUserIsAdmin)); |
60 | 60 | if (is_object(@$xoopsModule)) { |
61 | - if ($xoopsModule->getVar('mid') == 1 && @$_GET['fct'] == 'preferences' && @$_GET['op'] == 'showmod' && ! empty($_GET['mod'])) { |
|
62 | - $module_handler = xoops_getHandler('module') ; |
|
63 | - $target_module = $module_handler->get((int)$_GET['mod']) ; |
|
61 | + if ($xoopsModule->getVar('mid') == 1 && @$_GET['fct'] == 'preferences' && @$_GET['op'] == 'showmod' && !empty($_GET['mod'])) { |
|
62 | + $module_handler = xoops_getHandler('module'); |
|
63 | + $target_module = $module_handler->get((int)$_GET['mod']); |
|
64 | 64 | } else { |
65 | - $target_module = $xoopsModule ; |
|
65 | + $target_module = $xoopsModule; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // set page title |
69 | 69 | $xoopsTpl->assign(array('xoops_pagetitle' => $target_module->getVar('name'), 'xoops_modulename' => $target_module->getVar('name'), 'xoops_dirname' => $target_module->getVar('dirname'))); |
70 | 70 | |
71 | 71 | // xoops_breadcrumbs |
72 | - $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ; |
|
72 | + $breadcrumbsObj = AltsysBreadcrumbs::getInstance(); |
|
73 | 73 | if ($breadcrumbsObj->hasPaths()) { |
74 | - $xoops_breadcrumbs = $breadcrumbsObj->getXoopsBreadcrumbs() ; |
|
74 | + $xoops_breadcrumbs = $breadcrumbsObj->getXoopsBreadcrumbs(); |
|
75 | 75 | } else { |
76 | - $mod_url = XOOPS_URL.'/modules/'.$target_module->getVar('dirname') ; |
|
77 | - $mod_path = XOOPS_ROOT_PATH.'/modules/'.$target_module->getVar('dirname') ; |
|
78 | - $modinfo =& $target_module->getInfo() ; |
|
79 | - $xoops_breadcrumbs = array() ; |
|
80 | - if (! empty($modinfo['hasMain'])) { |
|
76 | + $mod_url = XOOPS_URL.'/modules/'.$target_module->getVar('dirname'); |
|
77 | + $mod_path = XOOPS_ROOT_PATH.'/modules/'.$target_module->getVar('dirname'); |
|
78 | + $modinfo = & $target_module->getInfo(); |
|
79 | + $xoops_breadcrumbs = array(); |
|
80 | + if (!empty($modinfo['hasMain'])) { |
|
81 | 81 | $xoops_breadcrumbs[] = array( |
82 | - 'url' => $mod_url.'/' , |
|
82 | + 'url' => $mod_url.'/', |
|
83 | 83 | 'name' => sprintf(_MD_A_AINTHEME_FMT_PUBLICTOP, $target_module->getVar('name')) |
84 | - ) ; |
|
84 | + ); |
|
85 | 85 | } |
86 | - if (! empty($modinfo['adminindex'])) { |
|
86 | + if (!empty($modinfo['adminindex'])) { |
|
87 | 87 | $xoops_breadcrumbs[] = array( |
88 | - 'url' => $mod_url.'/'.$modinfo['adminindex'] , |
|
88 | + 'url' => $mod_url.'/'.$modinfo['adminindex'], |
|
89 | 89 | 'name' => sprintf(_MD_A_AINTHEME_FMT_ADMINTOP, $target_module->getVar('name')) |
90 | - ) ; |
|
90 | + ); |
|
91 | 91 | } |
92 | - if (! empty($GLOBALS['altsysAdminPageTitle'])) { |
|
93 | - $xoops_breadcrumbs[] = array( 'name' => htmlspecialchars($GLOBALS['altsysAdminPageTitle'], ENT_QUOTES) ) ; |
|
94 | - } elseif (! empty($modinfo['adminmenu'])) { |
|
95 | - @include $mod_path.'/'.$modinfo['adminmenu'] ; |
|
92 | + if (!empty($GLOBALS['altsysAdminPageTitle'])) { |
|
93 | + $xoops_breadcrumbs[] = array('name' => htmlspecialchars($GLOBALS['altsysAdminPageTitle'], ENT_QUOTES)); |
|
94 | + } elseif (!empty($modinfo['adminmenu'])) { |
|
95 | + @include $mod_path.'/'.$modinfo['adminmenu']; |
|
96 | 96 | if (is_array(@$adminmenu)) { |
97 | 97 | foreach ($adminmenu as $eachmenu) { |
98 | 98 | if (strstr($_SERVER['REQUEST_URI'], $eachmenu['link'])) { |
99 | - $xoops_breadcrumbs[] = array( 'name' => $eachmenu['title'] ) ; |
|
100 | - break ; |
|
99 | + $xoops_breadcrumbs[] = array('name' => $eachmenu['title']); |
|
100 | + break; |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | } |
@@ -106,21 +106,21 @@ discard block |
||
106 | 106 | |
107 | 107 | //$block_arr =& $xoopsblock->getAllByGroupModule($xoopsUser->getGroups(), $target_module->getVar('mid'), false, XOOPS_BLOCK_VISIBLE); |
108 | 108 | } else { |
109 | - $xoopsTpl->assign(array( 'xoops_pagetitle' => _CPHOME )) ; |
|
109 | + $xoopsTpl->assign(array('xoops_pagetitle' => _CPHOME)); |
|
110 | 110 | $xoops_breadcrumbs = array( |
111 | 111 | array( |
112 | - 'url' => XOOPS_URL.'/admin.php' , |
|
112 | + 'url' => XOOPS_URL.'/admin.php', |
|
113 | 113 | 'name' => _CPHOME |
114 | 114 | ) |
115 | - ) ; |
|
115 | + ); |
|
116 | 116 | } |
117 | 117 | } else { |
118 | - exit ; |
|
118 | + exit; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | // get block_arr |
122 | - $db = XoopsDatabaseFactory::getDatabaseConnection() ; |
|
123 | - $sql = 'SELECT DISTINCT gperm_itemid FROM ' . $db->prefix('group_permission') . " WHERE gperm_name = 'block_read' AND gperm_modid = 1 AND gperm_groupid IN (" . implode(',', $xoopsUser->getGroups()) . ')'; |
|
122 | + $db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
123 | + $sql = 'SELECT DISTINCT gperm_itemid FROM '.$db->prefix('group_permission')." WHERE gperm_name = 'block_read' AND gperm_modid = 1 AND gperm_groupid IN (".implode(',', $xoopsUser->getGroups()).')'; |
|
124 | 124 | $result = $db->query($sql); |
125 | 125 | |
126 | 126 | $blockids = array(); |
@@ -128,30 +128,30 @@ discard block |
||
128 | 128 | $blockids[] = (int)$blockid; |
129 | 129 | } |
130 | 130 | |
131 | - global $block_arr , $i ; // for piCal :-) |
|
132 | - $block_arr = array() ; |
|
131 | + global $block_arr, $i; // for piCal :-) |
|
132 | + $block_arr = array(); |
|
133 | 133 | if (!empty($blockids)) { |
134 | - $sql = 'SELECT b.* FROM '.$db->prefix('newblocks').' b, '.$db->prefix('block_module_link').' m WHERE m.block_id=b.bid AND b.isactive=1 AND b.visible=1 AND m.module_id=' . (int)$altsysModuleId |
|
135 | - . ' AND b.bid IN (' . implode(',', $blockids) . ') ORDER BY b.weight,b.bid' ; |
|
134 | + $sql = 'SELECT b.* FROM '.$db->prefix('newblocks').' b, '.$db->prefix('block_module_link').' m WHERE m.block_id=b.bid AND b.isactive=1 AND b.visible=1 AND m.module_id='.(int)$altsysModuleId |
|
135 | + . ' AND b.bid IN ('.implode(',', $blockids).') ORDER BY b.weight,b.bid'; |
|
136 | 136 | $result = $db->query($sql); |
137 | 137 | while ($myrow = $db->fetchArray($result)) { |
138 | 138 | |
139 | 139 | //HACK by domifara |
140 | 140 | if (defined('XOOPS_CUBE_LEGACY')) { |
141 | - $block = $handler->create(false) ; |
|
141 | + $block = $handler->create(false); |
|
142 | 142 | $block->assignVars($myrow); |
143 | 143 | } else { |
144 | - $block = new XoopsBlock($myrow) ; |
|
144 | + $block = new XoopsBlock($myrow); |
|
145 | 145 | } |
146 | 146 | |
147 | - $block_arr[ $myrow['bid'] ] = $block ; |
|
147 | + $block_arr[$myrow['bid']] = $block; |
|
148 | 148 | } |
149 | 149 | } |
150 | 150 | |
151 | - $adminmenublock_exists = false ; |
|
151 | + $adminmenublock_exists = false; |
|
152 | 152 | foreach (array_keys($block_arr) as $i) { |
153 | 153 | if ($block_arr[$i]->getVar('show_func') == 'b_altsys_admin_menu_show') { |
154 | - $adminmenublock_exists = true ; |
|
154 | + $adminmenublock_exists = true; |
|
155 | 155 | } |
156 | 156 | $bcachetime = $block_arr[$i]->getVar('bcachetime'); |
157 | 157 | if (empty($bcachetime)) { |
@@ -232,15 +232,15 @@ discard block |
||
232 | 232 | } |
233 | 233 | |
234 | 234 | // FALLBACK inserting admin_menu_block in admin side |
235 | - if (! $adminmenublock_exists) { |
|
236 | - require_once XOOPS_ROOT_PATH.'/modules/altsys/blocks/blocks.php' ; |
|
237 | - $admin_menu_block = array( b_altsys_admin_menu_show(array( 'altsys' )) ) ; |
|
238 | - $admin_menu_block[0]['title'] = 'Admin Menu' ; |
|
239 | - $lblocks =& $xoopsTpl->get_template_vars('xoops_lblocks') ; |
|
240 | - if (! is_array($lblocks)) { |
|
241 | - $lblocks = array() ; |
|
235 | + if (!$adminmenublock_exists) { |
|
236 | + require_once XOOPS_ROOT_PATH.'/modules/altsys/blocks/blocks.php'; |
|
237 | + $admin_menu_block = array(b_altsys_admin_menu_show(array('altsys'))); |
|
238 | + $admin_menu_block[0]['title'] = 'Admin Menu'; |
|
239 | + $lblocks = & $xoopsTpl->get_template_vars('xoops_lblocks'); |
|
240 | + if (!is_array($lblocks)) { |
|
241 | + $lblocks = array(); |
|
242 | 242 | } |
243 | - $xoopsTpl->assign('xoops_lblocks', array_merge($admin_menu_block, $lblocks)) ; |
|
243 | + $xoopsTpl->assign('xoops_lblocks', array_merge($admin_menu_block, $lblocks)); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | //unset($block_arr); |
@@ -5,56 +5,56 @@ discard block |
||
5 | 5 | // GIJOE <http://www.peak.ne.jp/> // |
6 | 6 | // ------------------------------------------------------------------------- // |
7 | 7 | |
8 | -require_once __DIR__.'/class/AltsysBreadcrumbs.class.php' ; |
|
9 | -require_once __DIR__.'/include/gtickets.php' ; |
|
10 | -include_once __DIR__.'/include/altsys_functions.php' ; |
|
11 | -include_once __DIR__.'/include/mygrouppermform.php' ; |
|
12 | -include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; |
|
8 | +require_once __DIR__.'/class/AltsysBreadcrumbs.class.php'; |
|
9 | +require_once __DIR__.'/include/gtickets.php'; |
|
10 | +include_once __DIR__.'/include/altsys_functions.php'; |
|
11 | +include_once __DIR__.'/include/mygrouppermform.php'; |
|
12 | +include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php'; |
|
13 | 13 | |
14 | 14 | // language file |
15 | -altsys_include_language_file('myblocksadmin') ; |
|
15 | +altsys_include_language_file('myblocksadmin'); |
|
16 | 16 | |
17 | 17 | // fork by core types |
18 | 18 | switch (altsys_get_core_type()) { |
19 | 19 | case ALTSYS_CORE_TYPE_X22: |
20 | - include_once __DIR__.'/class/MyBlocksAdminForX22.class.php' ; |
|
21 | - $myba = MyBlocksAdminForX22::getInstance() ; |
|
22 | - break ; |
|
20 | + include_once __DIR__.'/class/MyBlocksAdminForX22.class.php'; |
|
21 | + $myba = MyBlocksAdminForX22::getInstance(); |
|
22 | + break; |
|
23 | 23 | case ALTSYS_CORE_TYPE_X25: |
24 | - include_once __DIR__.'/class/MyBlocksAdminForX25.class.php' ; |
|
25 | - $myba = MyBlocksAdminForX25::getInstance() ; |
|
26 | - break ; |
|
24 | + include_once __DIR__.'/class/MyBlocksAdminForX25.class.php'; |
|
25 | + $myba = MyBlocksAdminForX25::getInstance(); |
|
26 | + break; |
|
27 | 27 | case ALTSYS_CORE_TYPE_XCL21: |
28 | - include_once __DIR__.'/class/MyBlocksAdminForXCL21.class.php' ; |
|
29 | - $myba = MyBlocksAdminForXCL21::getInstance() ; |
|
30 | - break ; |
|
28 | + include_once __DIR__.'/class/MyBlocksAdminForXCL21.class.php'; |
|
29 | + $myba = MyBlocksAdminForXCL21::getInstance(); |
|
30 | + break; |
|
31 | 31 | case ALTSYS_CORE_TYPE_ICMS: |
32 | - include_once __DIR__.'/class/MyBlocksAdminForICMS.class.php' ; |
|
33 | - $myba = MyBlocksAdminForICMS::getInstance() ; |
|
34 | - break ; |
|
32 | + include_once __DIR__.'/class/MyBlocksAdminForICMS.class.php'; |
|
33 | + $myba = MyBlocksAdminForICMS::getInstance(); |
|
34 | + break; |
|
35 | 35 | case ALTSYS_CORE_TYPE_X20S: |
36 | 36 | case ALTSYS_CORE_TYPE_X23P: |
37 | - include_once __DIR__.'/class/MyBlocksAdminForX20S.class.php' ; |
|
38 | - $myba = MyBlocksAdminForX20S::getInstance() ; |
|
39 | - break ; |
|
37 | + include_once __DIR__.'/class/MyBlocksAdminForX20S.class.php'; |
|
38 | + $myba = MyBlocksAdminForX20S::getInstance(); |
|
39 | + break; |
|
40 | 40 | default: |
41 | - include_once __DIR__.'/class/MyBlocksAdmin.class.php' ; |
|
42 | - $myba = MyBlocksAdmin::getInstance() ; |
|
43 | - break ; |
|
41 | + include_once __DIR__.'/class/MyBlocksAdmin.class.php'; |
|
42 | + $myba = MyBlocksAdmin::getInstance(); |
|
43 | + break; |
|
44 | 44 | } |
45 | 45 | // permission |
46 | -$myba->checkPermission() ; |
|
46 | +$myba->checkPermission(); |
|
47 | 47 | |
48 | 48 | // set parameters target_mid , target_dirname etc. |
49 | -$myba->init($xoopsModule) ; |
|
49 | +$myba->init($xoopsModule); |
|
50 | 50 | |
51 | 51 | |
52 | 52 | // |
53 | 53 | // transaction stage |
54 | 54 | // |
55 | 55 | |
56 | -if (! empty($_POST)) { |
|
57 | - $myba->processPost() ; |
|
56 | +if (!empty($_POST)) { |
|
57 | + $myba->processPost(); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | // |
@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | // |
63 | 63 | |
64 | 64 | // header |
65 | -xoops_cp_header() ; |
|
65 | +xoops_cp_header(); |
|
66 | 66 | |
67 | 67 | // mymenu |
68 | -altsys_include_mymenu() ; |
|
68 | +altsys_include_mymenu(); |
|
69 | 69 | |
70 | -$myba->processGet() ; |
|
70 | +$myba->processGet(); |
|
71 | 71 | |
72 | 72 | // footer |
73 | -xoops_cp_footer() ; |
|
73 | +xoops_cp_footer(); |