@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | } |
466 | 466 | |
467 | 467 | $this->lcs = 0; |
468 | - $this->seq[0]= $yoff - 1; |
|
468 | + $this->seq[0] = $yoff - 1; |
|
469 | 469 | $this->in_seq = array(); |
470 | 470 | $ymids[0] = array(); |
471 | 471 | |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | } |
479 | 479 | } |
480 | 480 | |
481 | - $x1 = $xoff + (int)(($numer + ($xlim-$xoff)*$chunk) / $nchunks); |
|
481 | + $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $chunk) / $nchunks); |
|
482 | 482 | for (; $x < $x1; $x++) { |
483 | 483 | $line = $flip ? $this->yv[$x] : $this->xv[$x]; |
484 | 484 | if (empty($ymatches[$line])) { |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | $j++; |
647 | 647 | } |
648 | 648 | |
649 | - while ($i < $len && ! $changed[$i]) { |
|
649 | + while ($i < $len && !$changed[$i]) { |
|
650 | 650 | assert('$j < $other_len && ! $other_changed[$j]'); |
651 | 651 | $i++; |
652 | 652 | $j++; |
@@ -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) |
@@ -27,47 +27,47 @@ discard block |
||
27 | 27 | |
28 | 28 | if ($modid == 1) { |
29 | 29 | // check by the permission of eather 'altsys' or 'system' |
30 | - $module_handler =& xoops_gethandler('module') ; |
|
31 | - $module =& $module_handler->getByDirname('altsys') ; |
|
32 | - if (! is_object($module)) { |
|
33 | - $module =& $module_handler->getByDirname('system') ; |
|
34 | - if (! is_object($module)) { |
|
35 | - die('there is no altsys nor system.') ; |
|
30 | + $module_handler = & xoops_gethandler('module'); |
|
31 | + $module = & $module_handler->getByDirname('altsys'); |
|
32 | + if (!is_object($module)) { |
|
33 | + $module = & $module_handler->getByDirname('system'); |
|
34 | + if (!is_object($module)) { |
|
35 | + die('there is no altsys nor system.'); |
|
36 | 36 | } |
37 | 37 | } |
38 | - $moduleperm_handler =& xoops_gethandler('groupperm') ; |
|
39 | - if (! is_object(@$GLOBALS['xoopsUser']) || ! $moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $GLOBALS['xoopsUser']->getGroups())) { |
|
40 | - die('only admin of altsys can access this area') ; |
|
38 | + $moduleperm_handler = & xoops_gethandler('groupperm'); |
|
39 | + if (!is_object(@$GLOBALS['xoopsUser']) || !$moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $GLOBALS['xoopsUser']->getGroups())) { |
|
40 | + die('only admin of altsys can access this area'); |
|
41 | 41 | } |
42 | 42 | } else { |
43 | 43 | // check the permission of 'module_admin' of the module |
44 | 44 | if ($modid <= 0 || !is_object($GLOBALS['xoopsUser']) || !$GLOBALS['xoopsUser']->isAdmin($modid)) { |
45 | - die(_NOPERM) ; |
|
45 | + die(_NOPERM); |
|
46 | 46 | } |
47 | - $module_handler =& xoops_gethandler('module'); |
|
48 | - $module =& $module_handler->get($modid); |
|
47 | + $module_handler = & xoops_gethandler('module'); |
|
48 | + $module = & $module_handler->get($modid); |
|
49 | 49 | if (!is_object($module) || !$module->getVar('isactive')) { |
50 | - die(_MODULENOEXIST) ; |
|
50 | + die(_MODULENOEXIST); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | -$member_handler =& xoops_gethandler('member'); |
|
54 | +$member_handler = & xoops_gethandler('member'); |
|
55 | 55 | $group_list = $member_handler->getGroupList(); |
56 | 56 | if (!empty($_POST['perms']) && is_array($_POST['perms'])) { |
57 | 57 | $gperm_handler = xoops_gethandler('groupperm'); |
58 | 58 | foreach ($_POST['perms'] as $perm_name => $perm_data) { |
59 | - foreach ($perm_data['itemname' ] as $item_id => $item_name) { |
|
59 | + foreach ($perm_data['itemname'] as $item_id => $item_name) { |
|
60 | 60 | // checking code |
61 | 61 | // echo "<pre>" ; |
62 | 62 | // var_dump( $_POST['perms'] ) ; |
63 | 63 | // exit ; |
64 | 64 | if (false != myDeleteByModule($gperm_handler->db, $modid, $perm_name, $item_id)) { |
65 | 65 | if (empty($perm_data['groups'])) { |
66 | - continue ; |
|
66 | + continue; |
|
67 | 67 | } |
68 | 68 | foreach ($perm_data['groups'] as $group_id => $item_ids) { |
69 | 69 | // foreach ($item_ids as $item_id => $selected) { |
70 | - $selected = isset($item_ids[ $item_id ]) ? $item_ids[ $item_id ] : 0 ; |
|
70 | + $selected = isset($item_ids[$item_id]) ? $item_ids[$item_id] : 0; |
|
71 | 71 | if ($selected == 1) { |
72 | 72 | // make sure that all parent ids are selected as well |
73 | 73 | if ($perm_data['parents'][$item_id] != '') { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | } |
82 | 82 | } |
83 | - $gperm =& $gperm_handler->create(); |
|
83 | + $gperm = & $gperm_handler->create(); |
|
84 | 84 | $gperm->setVar('gperm_groupid', $group_id); |
85 | 85 | $gperm->setVar('gperm_name', $perm_name); |
86 | 86 | $gperm->setVar('gperm_modid', $modid); |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once dirname(dirname(__FILE__)).'/class/altsysUtils.class.php' ; |
|
2 | +require_once dirname(dirname(__FILE__)).'/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 | - $popup_no = intval($regs[1]) ; |
|
48 | + $popup_no = intval($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' => intval(@$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' => intval(@$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[ sizeof($mids) - 1 ] ; |
|
139 | + $is_left = true; |
|
140 | + $module_handler = & xoops_gethandler('module'); |
|
141 | + $mids = array_keys($xoops_admin_menu_ft); |
|
142 | + $last_mid = $mids[sizeof($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 | } |
@@ -1,33 +1,33 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! $xoopsConfig['theme_fromfile']) { |
|
4 | - return ; |
|
3 | +if (!$xoopsConfig['theme_fromfile']) { |
|
4 | + return; |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | // templates/ under modules |
8 | 8 | // $tplsadmin_autoupdate_path = XOOPS_THEME_PATH . '/' . $xoopsConfig['theme_set'] . '/templates' ; |
9 | 9 | |
10 | -if (! is_array(@$tplsadmin_autoupdate_mydirnames)) { |
|
11 | - return ; |
|
10 | +if (!is_array(@$tplsadmin_autoupdate_mydirnames)) { |
|
11 | + return; |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | foreach ($tplsadmin_autoupdate_mydirnames as $tplsadmin_mydirname) { |
15 | - $tplsadmin_mydirname = preg_replace('/[^a-zA-Z0-9_-]/', '', $tplsadmin_mydirname) ; |
|
16 | - require XOOPS_ROOT_PATH . '/modules/' . $tplsadmin_mydirname . '/mytrustdirname.php' ; |
|
17 | - $altsys_mid_path = $mytrustdirname == 'altsys' ? '/libs/' : '/modules/' ; |
|
18 | - $tplsadmin_autoupdate_path = XOOPS_TRUST_PATH . $altsys_mid_path . $mytrustdirname . '/templates' ; |
|
15 | + $tplsadmin_mydirname = preg_replace('/[^a-zA-Z0-9_-]/', '', $tplsadmin_mydirname); |
|
16 | + require XOOPS_ROOT_PATH.'/modules/'.$tplsadmin_mydirname.'/mytrustdirname.php'; |
|
17 | + $altsys_mid_path = $mytrustdirname == 'altsys' ? '/libs/' : '/modules/'; |
|
18 | + $tplsadmin_autoupdate_path = XOOPS_TRUST_PATH.$altsys_mid_path.$mytrustdirname.'/templates'; |
|
19 | 19 | |
20 | 20 | // modules |
21 | - if ($handler = @opendir($tplsadmin_autoupdate_path . '/')) { |
|
21 | + if ($handler = @opendir($tplsadmin_autoupdate_path.'/')) { |
|
22 | 22 | while (($file = readdir($handler)) !== false) { |
23 | - $file_path = $tplsadmin_autoupdate_path . '/' . $file ; |
|
23 | + $file_path = $tplsadmin_autoupdate_path.'/'.$file; |
|
24 | 24 | if (is_file($file_path)) { |
25 | - $mtime = intval(@filemtime($file_path)) ; |
|
26 | - $tpl_file = $tplsadmin_mydirname . '_' . $file ; |
|
27 | - list($count) = $xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("tplfile")." WHERE tpl_tplset='".addslashes($xoopsConfig['template_set'])."' AND tpl_file='".addslashes($tpl_file)."' AND tpl_lastmodified >= $mtime")) ; |
|
25 | + $mtime = intval(@filemtime($file_path)); |
|
26 | + $tpl_file = $tplsadmin_mydirname.'_'.$file; |
|
27 | + list($count) = $xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("tplfile")." WHERE tpl_tplset='".addslashes($xoopsConfig['template_set'])."' AND tpl_file='".addslashes($tpl_file)."' AND tpl_lastmodified >= $mtime")); |
|
28 | 28 | if ($count <= 0) { |
29 | - include_once XOOPS_TRUST_PATH.'/libs/altsys/include/tpls_functions.php' ; |
|
30 | - tplsadmin_import_data($xoopsConfig['template_set'], $tpl_file, implode('', file($file_path)), $mtime) ; |
|
29 | + include_once XOOPS_TRUST_PATH.'/libs/altsys/include/tpls_functions.php'; |
|
30 | + tplsadmin_import_data($xoopsConfig['template_set'], $tpl_file, implode('', file($file_path)), $mtime); |
|
31 | 31 | } |
32 | 32 | } |
33 | 33 | } |
@@ -2,147 +2,147 @@ discard block |
||
2 | 2 | // GIJOE's Ticket Class (based on Marijuana's Oreteki XOOPS) |
3 | 3 | // nobunobu's suggestions are applied |
4 | 4 | |
5 | -if (! class_exists('XoopsGTicket')) { |
|
5 | +if (!class_exists('XoopsGTicket')) { |
|
6 | 6 | class XoopsGTicket |
7 | 7 | { |
8 | 8 | |
9 | - public $_errors = array() ; |
|
10 | - public $_latest_token = '' ; |
|
11 | - public $messages = array() ; |
|
9 | + public $_errors = array(); |
|
10 | + public $_latest_token = ''; |
|
11 | + public $messages = array(); |
|
12 | 12 | |
13 | 13 | public function __construct() |
14 | 14 | { |
15 | - global $xoopsConfig ; |
|
15 | + global $xoopsConfig; |
|
16 | 16 | |
17 | 17 | // language file |
18 | - if (defined('XOOPS_ROOT_PATH') && ! empty($xoopsConfig['language']) && ! strstr($xoopsConfig['language'], '/')) { |
|
19 | - if (file_exists(dirname(dirname(__FILE__)) . '/language/' . $xoopsConfig['language'] . '/gticket_messages.phtml')) { |
|
20 | - include dirname(dirname(__FILE__)) . '/language/' . $xoopsConfig['language'] . '/gticket_messages.phtml' ; |
|
18 | + if (defined('XOOPS_ROOT_PATH') && !empty($xoopsConfig['language']) && !strstr($xoopsConfig['language'], '/')) { |
|
19 | + if (file_exists(dirname(dirname(__FILE__)).'/language/'.$xoopsConfig['language'].'/gticket_messages.phtml')) { |
|
20 | + include dirname(dirname(__FILE__)).'/language/'.$xoopsConfig['language'].'/gticket_messages.phtml'; |
|
21 | 21 | } |
22 | 22 | } |
23 | 23 | |
24 | 24 | // default messages |
25 | 25 | if (empty($this->messages)) { |
26 | 26 | $this->messages = array( |
27 | - 'err_general' => 'GTicket Error' , |
|
28 | - 'err_nostubs' => 'No stubs found' , |
|
29 | - 'err_noticket' => 'No ticket found' , |
|
30 | - 'err_nopair' => 'No valid ticket-stub pair found' , |
|
31 | - 'err_timeout' => 'Time out' , |
|
32 | - 'err_areaorref' => 'Invalid area or referer' , |
|
33 | - 'fmt_prompt4repost' => 'error(s) found:<br /><span style="background-color:red;font-weight:bold;color:white;">%s</span><br />Confirm it.<br />And do you want to post again?' , |
|
34 | - 'btn_repost' => 'repost' , |
|
35 | - ) ; |
|
27 | + 'err_general' => 'GTicket Error', |
|
28 | + 'err_nostubs' => 'No stubs found', |
|
29 | + 'err_noticket' => 'No ticket found', |
|
30 | + 'err_nopair' => 'No valid ticket-stub pair found', |
|
31 | + 'err_timeout' => 'Time out', |
|
32 | + 'err_areaorref' => 'Invalid area or referer', |
|
33 | + 'fmt_prompt4repost' => 'error(s) found:<br /><span style="background-color:red;font-weight:bold;color:white;">%s</span><br />Confirm it.<br />And do you want to post again?', |
|
34 | + 'btn_repost' => 'repost', |
|
35 | + ); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | 39 | // render form as plain html |
40 | 40 | public function getTicketHtml($salt = '', $timeout = 1800, $area = '') |
41 | 41 | { |
42 | - return '<input type="hidden" name="XOOPS_G_TICKET" value="'.$this->issue($salt, $timeout, $area).'" />' ; |
|
42 | + return '<input type="hidden" name="XOOPS_G_TICKET" value="'.$this->issue($salt, $timeout, $area).'" />'; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | // returns an object of XoopsFormHidden including theh ticket |
46 | 46 | public function getTicketXoopsForm($salt = '', $timeout = 1800, $area = '') |
47 | 47 | { |
48 | - return new XoopsFormHidden('XOOPS_G_TICKET', $this->issue($salt, $timeout, $area)) ; |
|
48 | + return new XoopsFormHidden('XOOPS_G_TICKET', $this->issue($salt, $timeout, $area)); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | // add a ticket as Hidden Element into XoopsForm |
52 | 52 | public function addTicketXoopsFormElement(&$form, $salt = '', $timeout = 1800, $area = '') |
53 | 53 | { |
54 | - $form->addElement(new XoopsFormHidden('XOOPS_G_TICKET', $this->issue($salt, $timeout, $area))) ; |
|
54 | + $form->addElement(new XoopsFormHidden('XOOPS_G_TICKET', $this->issue($salt, $timeout, $area))); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | // returns an array for xoops_confirm() ; |
58 | 58 | public function getTicketArray($salt = '', $timeout = 1800, $area = '') |
59 | 59 | { |
60 | - return array( 'XOOPS_G_TICKET' => $this->issue($salt, $timeout, $area) ) ; |
|
60 | + return array('XOOPS_G_TICKET' => $this->issue($salt, $timeout, $area)); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | // return GET parameter string. |
64 | - public function getTicketParamString($salt = '', $noamp = false, $timeout=1800, $area = '') |
|
64 | + public function getTicketParamString($salt = '', $noamp = false, $timeout = 1800, $area = '') |
|
65 | 65 | { |
66 | - return ($noamp ? '' : '&') . 'XOOPS_G_TICKET=' . $this->issue($salt, $timeout, $area) ; |
|
66 | + return ($noamp ? '' : '&').'XOOPS_G_TICKET='.$this->issue($salt, $timeout, $area); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | // issue a ticket |
70 | 70 | public function issue($salt = '', $timeout = 1800, $area = '') |
71 | 71 | { |
72 | - global $xoopsModule ; |
|
72 | + global $xoopsModule; |
|
73 | 73 | |
74 | 74 | // create a token |
75 | - list($usec, $sec) = explode(" ", microtime()) ; |
|
76 | - $appendix_salt = empty($_SERVER['PATH']) ? XOOPS_DB_NAME : $_SERVER['PATH'] ; |
|
77 | - $token = crypt($salt . $usec . $appendix_salt . $sec, XOOPS_DB_PREFIX) ; |
|
78 | - $this->_latest_token = $token ; |
|
75 | + list($usec, $sec) = explode(" ", microtime()); |
|
76 | + $appendix_salt = empty($_SERVER['PATH']) ? XOOPS_DB_NAME : $_SERVER['PATH']; |
|
77 | + $token = crypt($salt.$usec.$appendix_salt.$sec, XOOPS_DB_PREFIX); |
|
78 | + $this->_latest_token = $token; |
|
79 | 79 | |
80 | 80 | if (empty($_SESSION['XOOPS_G_STUBS'])) { |
81 | - $_SESSION['XOOPS_G_STUBS'] = array() ; |
|
81 | + $_SESSION['XOOPS_G_STUBS'] = array(); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | // limit max stubs 10 |
85 | 85 | if (sizeof($_SESSION['XOOPS_G_STUBS']) > 10) { |
86 | - $_SESSION['XOOPS_G_STUBS'] = array_slice($_SESSION['XOOPS_G_STUBS'], -10) ; |
|
86 | + $_SESSION['XOOPS_G_STUBS'] = array_slice($_SESSION['XOOPS_G_STUBS'], -10); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | // record referer if browser send it |
90 | - $referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['REQUEST_URI'] ; |
|
90 | + $referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['REQUEST_URI']; |
|
91 | 91 | |
92 | 92 | // area as module's dirname |
93 | - if (! $area && is_object(@$xoopsModule)) { |
|
94 | - $area = $xoopsModule->getVar('dirname') ; |
|
93 | + if (!$area && is_object(@$xoopsModule)) { |
|
94 | + $area = $xoopsModule->getVar('dirname'); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | // store stub |
98 | 98 | $_SESSION['XOOPS_G_STUBS'][] = array( |
99 | - 'expire' => time() + $timeout , |
|
100 | - 'referer' => $referer , |
|
101 | - 'area' => $area , |
|
99 | + 'expire' => time() + $timeout, |
|
100 | + 'referer' => $referer, |
|
101 | + 'area' => $area, |
|
102 | 102 | 'token' => $token |
103 | - ) ; |
|
103 | + ); |
|
104 | 104 | |
105 | 105 | // paid md5ed token as a ticket |
106 | - return md5($token . XOOPS_DB_PREFIX) ; |
|
106 | + return md5($token.XOOPS_DB_PREFIX); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | // check a ticket |
110 | 110 | public function check($post = true, $area = '', $allow_repost = true) |
111 | 111 | { |
112 | - global $xoopsModule ; |
|
112 | + global $xoopsModule; |
|
113 | 113 | |
114 | - $this->_errors = array() ; |
|
114 | + $this->_errors = array(); |
|
115 | 115 | |
116 | 116 | // CHECK: stubs are not stored in session |
117 | - if (! is_array(@$_SESSION['XOOPS_G_STUBS'])) { |
|
118 | - $this->_errors[] = $this->messages['err_nostubs'] ; |
|
119 | - $_SESSION['XOOPS_G_STUBS'] = array() ; |
|
117 | + if (!is_array(@$_SESSION['XOOPS_G_STUBS'])) { |
|
118 | + $this->_errors[] = $this->messages['err_nostubs']; |
|
119 | + $_SESSION['XOOPS_G_STUBS'] = array(); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | // get key&val of the ticket from a user's query |
123 | - $ticket = $post ? @$_POST['XOOPS_G_TICKET'] : @$_GET['XOOPS_G_TICKET'] ; |
|
123 | + $ticket = $post ? @$_POST['XOOPS_G_TICKET'] : @$_GET['XOOPS_G_TICKET']; |
|
124 | 124 | |
125 | 125 | // CHECK: no tickets found |
126 | 126 | if (empty($ticket)) { |
127 | - $this->_errors[] = $this->messages['err_noticket'] ; |
|
127 | + $this->_errors[] = $this->messages['err_noticket']; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | // gargage collection & find a right stub |
131 | - $stubs_tmp = $_SESSION['XOOPS_G_STUBS'] ; |
|
132 | - $_SESSION['XOOPS_G_STUBS'] = array() ; |
|
131 | + $stubs_tmp = $_SESSION['XOOPS_G_STUBS']; |
|
132 | + $_SESSION['XOOPS_G_STUBS'] = array(); |
|
133 | 133 | foreach ($stubs_tmp as $stub) { |
134 | 134 | // default lifetime 30min |
135 | 135 | if ($stub['expire'] >= time()) { |
136 | - if (md5($stub['token'] . XOOPS_DB_PREFIX) === $ticket) { |
|
137 | - $found_stub = $stub ; |
|
136 | + if (md5($stub['token'].XOOPS_DB_PREFIX) === $ticket) { |
|
137 | + $found_stub = $stub; |
|
138 | 138 | } else { |
139 | 139 | // store the other valid stubs into session |
140 | - $_SESSION['XOOPS_G_STUBS'][] = $stub ; |
|
140 | + $_SESSION['XOOPS_G_STUBS'][] = $stub; |
|
141 | 141 | } |
142 | 142 | } else { |
143 | - if (md5($stub['token'] . XOOPS_DB_PREFIX) === $ticket) { |
|
143 | + if (md5($stub['token'].XOOPS_DB_PREFIX) === $ticket) { |
|
144 | 144 | // not CSRF but Time-Out |
145 | - $timeout_flag = true ; |
|
145 | + $timeout_flag = true; |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | } |
@@ -150,40 +150,40 @@ discard block |
||
150 | 150 | // CHECK: the right stub found or not |
151 | 151 | if (empty($found_stub)) { |
152 | 152 | if (empty($timeout_flag)) { |
153 | - $this->_errors[] = $this->messages['err_nopair'] ; |
|
153 | + $this->_errors[] = $this->messages['err_nopair']; |
|
154 | 154 | } else { |
155 | - $this->_errors[] = $this->messages['err_timeout'] ; |
|
155 | + $this->_errors[] = $this->messages['err_timeout']; |
|
156 | 156 | } |
157 | 157 | } else { |
158 | 158 | |
159 | 159 | // set area if necessary |
160 | 160 | // area as module's dirname |
161 | - if (! $area && is_object(@$xoopsModule)) { |
|
162 | - $area = $xoopsModule->getVar('dirname') ; |
|
161 | + if (!$area && is_object(@$xoopsModule)) { |
|
162 | + $area = $xoopsModule->getVar('dirname'); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | // check area or referer |
166 | 166 | if (@$found_stub['area'] == $area) { |
167 | - $area_check = true ; |
|
167 | + $area_check = true; |
|
168 | 168 | } |
169 | - if (! empty($found_stub['referer']) && strstr(@$_SERVER['HTTP_REFERER'], $found_stub['referer'])) { |
|
170 | - $referer_check = true ; |
|
169 | + if (!empty($found_stub['referer']) && strstr(@$_SERVER['HTTP_REFERER'], $found_stub['referer'])) { |
|
170 | + $referer_check = true; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | if (empty($area_check) && empty($referer_check)) { // loose |
174 | - $this->_errors[] = $this->messages['err_areaorref'] ; |
|
174 | + $this->_errors[] = $this->messages['err_areaorref']; |
|
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
178 | - if (! empty($this->_errors)) { |
|
178 | + if (!empty($this->_errors)) { |
|
179 | 179 | if ($allow_repost) { |
180 | 180 | // repost form |
181 | - $this->draw_repost_form($area) ; |
|
182 | - exit ; |
|
181 | + $this->draw_repost_form($area); |
|
182 | + exit; |
|
183 | 183 | } else { |
184 | 184 | // failed |
185 | - $this->clear() ; |
|
186 | - return false ; |
|
185 | + $this->clear(); |
|
186 | + return false; |
|
187 | 187 | } |
188 | 188 | } else { |
189 | 189 | // all green |
@@ -196,78 +196,78 @@ discard block |
||
196 | 196 | { |
197 | 197 | // Notify which file is broken |
198 | 198 | if (headers_sent()) { |
199 | - restore_error_handler() ; |
|
200 | - set_error_handler(array( &$this, 'errorHandler4FindOutput' )) ; |
|
201 | - header('Dummy: for warning') ; |
|
202 | - restore_error_handler() ; |
|
203 | - exit ; |
|
199 | + restore_error_handler(); |
|
200 | + set_error_handler(array(&$this, 'errorHandler4FindOutput')); |
|
201 | + header('Dummy: for warning'); |
|
202 | + restore_error_handler(); |
|
203 | + exit; |
|
204 | 204 | } |
205 | 205 | |
206 | - $table = '<table>' ; |
|
207 | - $form = '<form action="?'.htmlspecialchars(@$_SERVER['QUERY_STRING'], ENT_QUOTES).'" method="post" >' ; |
|
206 | + $table = '<table>'; |
|
207 | + $form = '<form action="?'.htmlspecialchars(@$_SERVER['QUERY_STRING'], ENT_QUOTES).'" method="post" >'; |
|
208 | 208 | foreach ($_POST as $key => $val) { |
209 | 209 | if ($key == 'XOOPS_G_TICKET') { |
210 | - continue ; |
|
210 | + continue; |
|
211 | 211 | } |
212 | 212 | if (get_magic_quotes_gpc()) { |
213 | - $key = stripslashes($key) ; |
|
213 | + $key = stripslashes($key); |
|
214 | 214 | } |
215 | 215 | if (is_array($val)) { |
216 | - list($tmp_table, $tmp_form) = $this->extract_post_recursive(htmlspecialchars($key, ENT_QUOTES), $val) ; |
|
217 | - $table .= $tmp_table ; |
|
218 | - $form .= $tmp_form ; |
|
216 | + list($tmp_table, $tmp_form) = $this->extract_post_recursive(htmlspecialchars($key, ENT_QUOTES), $val); |
|
217 | + $table .= $tmp_table; |
|
218 | + $form .= $tmp_form; |
|
219 | 219 | } else { |
220 | 220 | if (get_magic_quotes_gpc()) { |
221 | - $val = stripslashes($val) ; |
|
221 | + $val = stripslashes($val); |
|
222 | 222 | } |
223 | - $table .= '<tr><th>'.htmlspecialchars($key, ENT_QUOTES).'</th><td>'.htmlspecialchars($val, ENT_QUOTES).'</td></tr>'."\n" ; |
|
224 | - $form .= '<input type="hidden" name="'.htmlspecialchars($key, ENT_QUOTES).'" value="'.htmlspecialchars($val, ENT_QUOTES).'" />'."\n" ; |
|
223 | + $table .= '<tr><th>'.htmlspecialchars($key, ENT_QUOTES).'</th><td>'.htmlspecialchars($val, ENT_QUOTES).'</td></tr>'."\n"; |
|
224 | + $form .= '<input type="hidden" name="'.htmlspecialchars($key, ENT_QUOTES).'" value="'.htmlspecialchars($val, ENT_QUOTES).'" />'."\n"; |
|
225 | 225 | } |
226 | 226 | } |
227 | - $table .= '</table>' ; |
|
228 | - $form .= $this->getTicketHtml(__LINE__, 300, $area).'<input type="submit" value="'.$this->messages['btn_repost'].'" /></form>' ; |
|
227 | + $table .= '</table>'; |
|
228 | + $form .= $this->getTicketHtml(__LINE__, 300, $area).'<input type="submit" value="'.$this->messages['btn_repost'].'" /></form>'; |
|
229 | 229 | |
230 | - error_reporting(0) ; |
|
230 | + error_reporting(0); |
|
231 | 231 | while (@ob_get_level() && @ob_end_clean()); |
232 | 232 | |
233 | - echo '<html><head><title>'.$this->messages['err_general'].'</title><style>table,td,th {border:solid black 1px; border-collapse:collapse;}</style></head><body>' . sprintf($this->messages['fmt_prompt4repost'], $this->getErrors()) . $table . $form . '</body></html>' ; |
|
233 | + echo '<html><head><title>'.$this->messages['err_general'].'</title><style>table,td,th {border:solid black 1px; border-collapse:collapse;}</style></head><body>'.sprintf($this->messages['fmt_prompt4repost'], $this->getErrors()).$table.$form.'</body></html>'; |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | public function extract_post_recursive($key_name, $tmp_array) |
237 | 237 | { |
238 | - $table = '' ; |
|
239 | - $form = '' ; |
|
238 | + $table = ''; |
|
239 | + $form = ''; |
|
240 | 240 | foreach ($tmp_array as $key => $val) { |
241 | 241 | if (get_magic_quotes_gpc()) { |
242 | - $key = stripslashes($key) ; |
|
242 | + $key = stripslashes($key); |
|
243 | 243 | } |
244 | 244 | if (is_array($val)) { |
245 | - list($tmp_table, $tmp_form) = $this->extract_post_recursive($key_name.'['.htmlspecialchars($key, ENT_QUOTES).']', $val) ; |
|
246 | - $table .= $tmp_table ; |
|
247 | - $form .= $tmp_form ; |
|
245 | + list($tmp_table, $tmp_form) = $this->extract_post_recursive($key_name.'['.htmlspecialchars($key, ENT_QUOTES).']', $val); |
|
246 | + $table .= $tmp_table; |
|
247 | + $form .= $tmp_form; |
|
248 | 248 | } else { |
249 | 249 | if (get_magic_quotes_gpc()) { |
250 | - $val = stripslashes($val) ; |
|
250 | + $val = stripslashes($val); |
|
251 | 251 | } |
252 | - $table .= '<tr><th>'.$key_name.'['.htmlspecialchars($key, ENT_QUOTES).']</th><td>'.htmlspecialchars($val, ENT_QUOTES).'</td></tr>'."\n" ; |
|
253 | - $form .= '<input type="hidden" name="'.$key_name.'['.htmlspecialchars($key, ENT_QUOTES).']" value="'.htmlspecialchars($val, ENT_QUOTES).'" />'."\n" ; |
|
252 | + $table .= '<tr><th>'.$key_name.'['.htmlspecialchars($key, ENT_QUOTES).']</th><td>'.htmlspecialchars($val, ENT_QUOTES).'</td></tr>'."\n"; |
|
253 | + $form .= '<input type="hidden" name="'.$key_name.'['.htmlspecialchars($key, ENT_QUOTES).']" value="'.htmlspecialchars($val, ENT_QUOTES).'" />'."\n"; |
|
254 | 254 | } |
255 | 255 | } |
256 | - return array( $table , $form ) ; |
|
256 | + return array($table, $form); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | |
260 | 260 | // clear all stubs |
261 | 261 | public function clear() |
262 | 262 | { |
263 | - $_SESSION['XOOPS_G_STUBS'] = array() ; |
|
263 | + $_SESSION['XOOPS_G_STUBS'] = array(); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | |
267 | 267 | // Ticket Using |
268 | 268 | public function using() |
269 | 269 | { |
270 | - if (! empty($_SESSION['XOOPS_G_STUBS'])) { |
|
270 | + if (!empty($_SESSION['XOOPS_G_STUBS'])) { |
|
271 | 271 | return true; |
272 | 272 | } else { |
273 | 273 | return false; |
@@ -279,39 +279,39 @@ discard block |
||
279 | 279 | public function getErrors($ashtml = true) |
280 | 280 | { |
281 | 281 | if ($ashtml) { |
282 | - $ret = '' ; |
|
282 | + $ret = ''; |
|
283 | 283 | foreach ($this->_errors as $msg) { |
284 | - $ret .= "$msg<br />\n" ; |
|
284 | + $ret .= "$msg<br />\n"; |
|
285 | 285 | } |
286 | 286 | } else { |
287 | - $ret = $this->_errors ; |
|
287 | + $ret = $this->_errors; |
|
288 | 288 | } |
289 | - return $ret ; |
|
289 | + return $ret; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | public function errorHandler4FindOutput($errNo, $errStr, $errFile, $errLine) |
293 | 293 | { |
294 | 294 | if (preg_match('?'.preg_quote(XOOPS_ROOT_PATH).'([^:]+)\:(\d+)?', $errStr, $regs)) { |
295 | - echo "Irregular output! check the file ".htmlspecialchars($regs[1])." line ".htmlspecialchars($regs[2]) ; |
|
295 | + echo "Irregular output! check the file ".htmlspecialchars($regs[1])." line ".htmlspecialchars($regs[2]); |
|
296 | 296 | } else { |
297 | - echo "Irregular output! check language files etc." ; |
|
297 | + echo "Irregular output! check language files etc."; |
|
298 | 298 | } |
299 | - return ; |
|
299 | + return; |
|
300 | 300 | } |
301 | 301 | // end of class |
302 | 302 | } |
303 | 303 | |
304 | 304 | // create a instance in global scope |
305 | -$GLOBALS['xoopsGTicket'] = new XoopsGTicket() ; |
|
305 | +$GLOBALS['xoopsGTicket'] = new XoopsGTicket(); |
|
306 | 306 | } |
307 | 307 | |
308 | -if (! function_exists('admin_refcheck')) { |
|
308 | +if (!function_exists('admin_refcheck')) { |
|
309 | 309 | |
310 | 310 | //Admin Referer Check By Marijuana(Rev.011) |
311 | 311 | function admin_refcheck($chkref = "") |
312 | 312 | { |
313 | 313 | if (empty($_SERVER['HTTP_REFERER'])) { |
314 | - return true ; |
|
314 | + return true; |
|
315 | 315 | } else { |
316 | 316 | $ref = $_SERVER['HTTP_REFERER']; |
317 | 317 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | global $xoopsDB; |
6 | 6 | $query = "SELECT mid FROM ".$xoopsDB->prefix('modules')." WHERE dirname='".$modversion['dirname']."' "; |
7 | 7 | $result = $xoopsDB->query($query); |
8 | -$record= $xoopsDB->fetcharray($result); |
|
8 | +$record = $xoopsDB->fetcharray($result); |
|
9 | 9 | if ($record) { |
10 | 10 | $mid = $record['mid']; |
11 | 11 | $count = count($modversion['blocks']); |
@@ -61,18 +61,18 @@ discard block |
||
61 | 61 | $iret = $xoopsDB->query($sql); |
62 | 62 | } |
63 | 63 | |
64 | - for ($i = 1 ; $i <= $count ; $i++) { |
|
64 | + for ($i = 1; $i <= $count; $i++) { |
|
65 | 65 | $sql = "SELECT name,options FROM ".$xoopsDB->prefix('newblocks')." WHERE mid=".$mid." AND func_num=".$i." AND show_func='".addslashes($modversion['blocks'][$i]['show_func'])."' AND func_file='".addslashes($modversion['blocks'][$i]['file'])."'"; |
66 | 66 | $fresult = $xoopsDB->query($sql); |
67 | 67 | $fblock = $xoopsDB->fetchArray($fresult); |
68 | 68 | if (isset($fblock['options'])) { |
69 | - $old_vals=explode("|", $fblock['options']); |
|
70 | - $def_vals=explode("|", $modversion['blocks'][$i]['options']); |
|
69 | + $old_vals = explode("|", $fblock['options']); |
|
70 | + $def_vals = explode("|", $modversion['blocks'][$i]['options']); |
|
71 | 71 | if (count($old_vals) == count($def_vals)) { |
72 | 72 | $modversion['blocks'][$i]['options'] = $fblock['options']; |
73 | 73 | $local_msgs[] = "Option's values of the block <b>".$fblock['name']."</b> will be kept. (value = <b>".$fblock['options']."</b>)"; |
74 | 74 | } elseif (count($old_vals) < count($def_vals)) { |
75 | - for ($j=0; $j < count($old_vals); $j++) { |
|
75 | + for ($j = 0; $j < count($old_vals); $j++) { |
|
76 | 76 | $def_vals[$j] = $old_vals[$j]; |
77 | 77 | } |
78 | 78 | $modversion['blocks'][$i]['options'] = implode("|", $def_vals); |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | -global $msgs , $myblocksadmin_parsed_updateblock ; |
|
88 | -if (! empty($msgs) && ! empty($local_msgs) && empty($myblocksadmin_parsed_updateblock)) { |
|
89 | - $msgs = array_merge($msgs, $local_msgs) ; |
|
90 | - $myblocksadmin_parsed_updateblock = true ; |
|
87 | +global $msgs, $myblocksadmin_parsed_updateblock; |
|
88 | +if (!empty($msgs) && !empty($local_msgs) && empty($myblocksadmin_parsed_updateblock)) { |
|
89 | + $msgs = array_merge($msgs, $local_msgs); |
|
90 | + $myblocksadmin_parsed_updateblock = true; |
|
91 | 91 | } |
@@ -1,41 +1,41 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | include_once XOOPS_ROOT_PATH.'/class/template.php'; |
4 | -include_once dirname(__FILE__).'/altsys_functions.php' ; |
|
4 | +include_once dirname(__FILE__).'/altsys_functions.php'; |
|
5 | 5 | |
6 | 6 | function tplsadmin_import_data($tplset, $tpl_file, $tpl_source, $lastmodified = 0) |
7 | 7 | { |
8 | - $db =& Database::getInstance() ; |
|
8 | + $db = & Database::getInstance(); |
|
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,45 +43,45 @@ 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 ".$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 ".$db->prefix("tplsource")." WHERE tpl_tplset='".addslashes($tplset_from)."' AND ($whr_append)"); |
|
63 | 63 | |
64 | 64 | while ($row = $db->fetchArray($result)) { |
65 | - $tpl_source = array_pop($row) ; |
|
65 | + $tpl_source = array_pop($row); |
|
66 | 66 | |
67 | - $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'])."'") ; |
|
67 | + $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 | 68 | |
69 | - if (! $db->getRowsNum($drs)) { |
|
69 | + if (!$db->getRowsNum($drs)) { |
|
70 | 70 | // INSERT mode |
71 | - $sql = "INSERT INTO ".$db->prefix("tplfile")." (tpl_refid,tpl_module,tpl_tplset,tpl_file,tpl_desc,tpl_lastmodified,tpl_lastimported,tpl_type) VALUES (" ; |
|
71 | + $sql = "INSERT INTO ".$db->prefix("tplfile")." (tpl_refid,tpl_module,tpl_tplset,tpl_file,tpl_desc,tpl_lastmodified,tpl_lastimported,tpl_type) VALUES ("; |
|
72 | 72 | foreach ($row as $colval) { |
73 | - $sql .= "'".addslashes($colval)."'," ; |
|
73 | + $sql .= "'".addslashes($colval)."',"; |
|
74 | 74 | } |
75 | - $db->query(substr($sql, 0, -1) . ')') ; |
|
76 | - $tpl_id = $db->getInsertId() ; |
|
77 | - $db->query("INSERT INTO ".$db->prefix("tplsource")." SET tpl_id='$tpl_id', tpl_source='".addslashes($tpl_source)."'") ; |
|
78 | - altsys_template_touch($tpl_id) ; |
|
75 | + $db->query(substr($sql, 0, -1).')'); |
|
76 | + $tpl_id = $db->getInsertId(); |
|
77 | + $db->query("INSERT INTO ".$db->prefix("tplsource")." SET tpl_id='$tpl_id', tpl_source='".addslashes($tpl_source)."'"); |
|
78 | + altsys_template_touch($tpl_id); |
|
79 | 79 | } else { |
80 | 80 | while (list($tpl_id) = $db->fetchRow($drs)) { |
81 | 81 | // UPDATE mode |
82 | - $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'") ; |
|
83 | - $db->query("UPDATE ".$db->prefix("tplsource")." SET tpl_source='".addslashes($tpl_source)."' WHERE tpl_id='$tpl_id'") ; |
|
84 | - altsys_template_touch($tpl_id) ; |
|
82 | + $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'"); |
|
83 | + $db->query("UPDATE ".$db->prefix("tplsource")." SET tpl_source='".addslashes($tpl_source)."' WHERE tpl_id='$tpl_id'"); |
|
84 | + altsys_template_touch($tpl_id); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -91,31 +91,31 @@ discard block |
||
91 | 91 | |
92 | 92 | function tplsadmin_copy_templates_f2db($tplset_to, $whr_append = '1') |
93 | 93 | { |
94 | - global $db ; |
|
94 | + global $db; |
|
95 | 95 | |
96 | 96 | // get tplsource |
97 | - $result = $db->query("SELECT * FROM ".$db->prefix("tplfile")." WHERE tpl_tplset='default' AND ($whr_append)") ; |
|
97 | + $result = $db->query("SELECT * FROM ".$db->prefix("tplfile")." WHERE tpl_tplset='default' AND ($whr_append)"); |
|
98 | 98 | |
99 | 99 | while ($row = $db->fetchArray($result)) { |
100 | - $basefilepath = tplsadmin_get_basefilepath($row['tpl_module'], $row['tpl_type'], $row['tpl_file']) ; |
|
101 | - $tpl_source = rtrim(implode("", file($basefilepath))) ; |
|
102 | - $lastmodified = filemtime($basefilepath) ; |
|
100 | + $basefilepath = tplsadmin_get_basefilepath($row['tpl_module'], $row['tpl_type'], $row['tpl_file']); |
|
101 | + $tpl_source = rtrim(implode("", file($basefilepath))); |
|
102 | + $lastmodified = filemtime($basefilepath); |
|
103 | 103 | |
104 | - $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'])."'") ; |
|
104 | + $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 | 105 | |
106 | - if (! $db->getRowsNum($drs)) { |
|
106 | + if (!$db->getRowsNum($drs)) { |
|
107 | 107 | // INSERT mode |
108 | - $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'])."'" ; |
|
109 | - $db->query($sql) ; |
|
110 | - $tpl_id = $db->getInsertId() ; |
|
111 | - $db->query("INSERT INTO ".$db->prefix("tplsource")." SET tpl_id='$tpl_id', tpl_source='".addslashes($tpl_source)."'") ; |
|
112 | - altsys_template_touch($tpl_id) ; |
|
108 | + $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'])."'"; |
|
109 | + $db->query($sql); |
|
110 | + $tpl_id = $db->getInsertId(); |
|
111 | + $db->query("INSERT INTO ".$db->prefix("tplsource")." SET tpl_id='$tpl_id', tpl_source='".addslashes($tpl_source)."'"); |
|
112 | + altsys_template_touch($tpl_id); |
|
113 | 113 | } else { |
114 | 114 | while (list($tpl_id) = $db->fetchRow($drs)) { |
115 | 115 | // UPDATE mode |
116 | - $db->query("UPDATE ".$db->prefix("tplfile")." SET tpl_lastmodified='".addslashes($lastmodified)."' WHERE tpl_id='$tpl_id'") ; |
|
117 | - $db->query("UPDATE ".$db->prefix("tplsource")." SET tpl_source='".addslashes($tpl_source)."' WHERE tpl_id='$tpl_id'") ; |
|
118 | - altsys_template_touch($tpl_id) ; |
|
116 | + $db->query("UPDATE ".$db->prefix("tplfile")." SET tpl_lastmodified='".addslashes($lastmodified)."' WHERE tpl_id='$tpl_id'"); |
|
117 | + $db->query("UPDATE ".$db->prefix("tplsource")." SET tpl_source='".addslashes($tpl_source)."' WHERE tpl_id='$tpl_id'"); |
|
118 | + altsys_template_touch($tpl_id); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | function tplsadmin_get_basefilepath($dirname, $type, $tpl_file) |
127 | 127 | { |
128 | 128 | // module instance |
129 | - $path = $basefilepath = XOOPS_ROOT_PATH.'/modules/'.$dirname.'/templates/'.($type=='block'?'blocks/':'').$tpl_file ; |
|
129 | + $path = $basefilepath = XOOPS_ROOT_PATH.'/modules/'.$dirname.'/templates/'.($type == 'block' ? 'blocks/' : '').$tpl_file; |
|
130 | 130 | |
131 | 131 | if (is_callable('Legacy_Utils::getTrustDirnameByDirname')) { |
132 | 132 | $mytrustdirname = Legacy_Utils::getTrustDirnameByDirname($dirname); |
@@ -134,33 +134,33 @@ discard block |
||
134 | 134 | |
135 | 135 | if (defined('ALTSYS_TPLSADMIN_BASEPATH')) { |
136 | 136 | // Special hook |
137 | - $path = ALTSYS_TPLSADMIN_BASEPATH.'/'.substr($tpl_file, strlen($dirname) + 1) ; |
|
137 | + $path = ALTSYS_TPLSADMIN_BASEPATH.'/'.substr($tpl_file, strlen($dirname) + 1); |
|
138 | 138 | } elseif ($mytrustdirname || @include(XOOPS_ROOT_PATH.'/modules/'.$dirname.'/mytrustdirname.php')) { |
139 | 139 | // D3 module base |
140 | - if (! empty($mytrustdirname)) { |
|
141 | - $mid_path = $mytrustdirname == 'altsys' ? '/libs/' : '/modules/' ; |
|
140 | + if (!empty($mytrustdirname)) { |
|
141 | + $mid_path = $mytrustdirname == 'altsys' ? '/libs/' : '/modules/'; |
|
142 | 142 | |
143 | - $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type=='block'?'blocks/':'').substr($tpl_file, strlen($dirname) + 1) ; |
|
143 | + $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type == 'block' ? 'blocks/' : '').substr($tpl_file, strlen($dirname) + 1); |
|
144 | 144 | //new for xcck etc.other trust_module |
145 | - if (! file_exists($path)) { |
|
146 | - $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type=='block'?'blocks/':'').$tpl_file ; |
|
147 | - if (! file_exists($path)) { |
|
145 | + if (!file_exists($path)) { |
|
146 | + $path = XOOPS_TRUST_PATH.$mid_path.$mytrustdirname.'/templates/'.($type == 'block' ? 'blocks/' : '').$tpl_file; |
|
147 | + if (!file_exists($path)) { |
|
148 | 148 | $path = $basefilepath; |
149 | 149 | } |
150 | 150 | } |
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | - return $path ; |
|
154 | + return $path; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | |
158 | 158 | function tplsadmin_die($msg, $target_dirname = '', $wait = 2) |
159 | 159 | { |
160 | 160 | if (strtolower($_SERVER['REQUEST_METHOD']) === 'post') { |
161 | - redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, $wait, $msg) ; |
|
162 | - exit ; |
|
161 | + redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$target_dirname, $wait, $msg); |
|
162 | + exit; |
|
163 | 163 | } else { |
164 | - die($msg) ; |
|
164 | + die($msg); |
|
165 | 165 | } |
166 | 166 | } |
@@ -5,20 +5,20 @@ |
||
5 | 5 | // save assigned variables for the template |
6 | 6 | function tplsadmin_save_tplsvars($file, $smarty) |
7 | 7 | { |
8 | - $tplsvars_file = 'tplsvars_' ; |
|
9 | - $tplsvars_file .= substr(md5(substr(XOOPS_DB_PASS, 0, 4)), 0, 4) . '_' ; |
|
8 | + $tplsvars_file = 'tplsvars_'; |
|
9 | + $tplsvars_file .= substr(md5(substr(XOOPS_DB_PASS, 0, 4)), 0, 4).'_'; |
|
10 | 10 | if (strncmp($file, 'db:', 3) === 0) { |
11 | - $tplsvars_file .= substr($file, 3) ; |
|
11 | + $tplsvars_file .= substr($file, 3); |
|
12 | 12 | } elseif (strncmp($file, 'file:', 5) === 0) { |
13 | - $tplsvars_file .= strtr(substr($file, 5), '/', '%') ; |
|
13 | + $tplsvars_file .= strtr(substr($file, 5), '/', '%'); |
|
14 | 14 | } else { |
15 | - $tplsvars_file .= strtr($file, '/', '%') ; |
|
15 | + $tplsvars_file .= strtr($file, '/', '%'); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | if ($fw = @fopen(XOOPS_COMPILE_PATH.'/'.$tplsvars_file, 'x')) { |
19 | - fwrite($fw, serialize($smarty->_tpl_vars)) ; |
|
20 | - fclose($fw) ; |
|
21 | - return true ; |
|
19 | + fwrite($fw, serialize($smarty->_tpl_vars)); |
|
20 | + fclose($fw); |
|
21 | + return true; |
|
22 | 22 | } |
23 | - return false ; |
|
23 | + return false; |
|
24 | 24 | } |
@@ -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()) ; |
|
17 | - $reqonce_ret = require_once($langfile_unique_path) ; |
|
18 | - $langfile_names = array_diff(array_keys(get_defined_constants()), $system_constants) ; |
|
15 | + if (!defined($langfile_fingerprint)) { |
|
16 | + $system_constants = array_keys(get_defined_constants()); |
|
17 | + $reqonce_ret = require_once($langfile_unique_path); |
|
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 | } |