Completed
Push — master ( 99eb82...6dab8b )
by Michael
19s
created
xoops_trust_path/libs/altsys/include/formcheckboxgroup.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/include/adminmenu_functions.php 1 patch
Spacing   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/system/admin.php?fct=preferences&amp;op=showmod&amp;mod='.$mid.'\'' ;
52
-    $replace = $anchor.'<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mypreferences\'' ;
51
+    $search  = '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/system/admin.php?fct=preferences&amp;op=showmod&amp;mod='.$mid.'\'';
52
+    $replace = $anchor.'<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&amp;lib=altsys&amp;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=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&amp;lib=altsys&amp;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=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&amp;lib=altsys&amp;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=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&amp;lib=altsys&amp;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=\'\' />&nbsp;<a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&amp;lib=altsys&amp;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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/include/gtickets.php 1 patch
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -2,149 +2,149 @@  discard block
 block discarded – undo
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 ? '' : '&amp;') . 'XOOPS_G_TICKET=' . $this->issue($salt, $timeout, $area) ;
65
+        return ($noamp ? '' : '&amp;').'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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/include/tpls_functions.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -1,41 +1,41 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/include/mygrouppermform.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
  * @author       XOOPS Development Team, Kazumi Ono (AKA onokazu)
18 18
  */
19 19
 
20
-if (! defined('XOOPS_ROOT_PATH')) {
21
-    exit ;
20
+if (!defined('XOOPS_ROOT_PATH')) {
21
+    exit;
22 22
 }
23 23
 
24 24
 require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelement.php';
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      * Tree structure of items
49 49
      * @var array
50 50
      */
51
-    public $_itemTree = array() ;
51
+    public $_itemTree = array();
52 52
     /**
53 53
      * Name of permission
54 54
      * @var string
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      * Appendix
64 64
      * @var array ('permname'=>,'itemid'=>,'itemname'=>,'selected'=>)
65 65
      */
66
-    public $_appendix = array() ;
66
+    public $_appendix = array();
67 67
 
68 68
     /**
69 69
      * Constructor
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public function addAppendix($permName, $itemId, $itemName)
105 105
     {
106
-        $this->_appendix[] = array('permname'=>$permName,'itemid'=>$itemId,'itemname'=>$itemName,'selected'=>false);
106
+        $this->_appendix[] = array('permname'=>$permName, 'itemid'=>$itemId, 'itemname'=>$itemName, 'selected'=>false);
107 107
     }
108 108
 
109 109
     /**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public function render()
139 139
     {
140
-        global $xoopsGTicket ;
140
+        global $xoopsGTicket;
141 141
 
142 142
         // load all child ids for javascript codes
143 143
         foreach (array_keys($this->_itemTree) as $item_id) {
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
             $ele->setOptionTree($this->_itemTree);
155 155
 
156 156
             // GIJ start
157
-            $ele->setDescription('<input type="checkbox" onclick="with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].name.match(/^perms\[(module_admin|module_read|block_read)\]\[groups\]\['.$i.'\]/)){elements[i].checked=this.checked;}}};">') ;
157
+            $ele->setDescription('<input type="checkbox" onclick="with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].name.match(/^perms\[(module_admin|module_read|block_read)\]\[groups\]\['.$i.'\]/)){elements[i].checked=this.checked;}}};">');
158 158
             // GIJ_end
159 159
 
160 160
             foreach ($this->_appendix as $key => $append) {
161
-                $this->_appendix[$key]['selected'] = $gperm_handler->checkRight($append['permname'], $append['itemid'], $i, $this->_modid) ;
161
+                $this->_appendix[$key]['selected'] = $gperm_handler->checkRight($append['permname'], $append['itemid'], $i, $this->_modid);
162 162
             }
163 163
             $ele->setAppendix($this->_appendix);
164 164
             $this->addElement($ele);
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
         // GIJ start
169 169
         $jstray = new XoopsFormElementTray(' &nbsp; ');
170 170
         $jsuncheckbutton = new XoopsFormButton('', 'none', _NONE, 'button');
171
-        $jsuncheckbutton->setExtra("onclick=\"with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].type=='checkbox'){elements[i].checked=false;}}}\"") ;
171
+        $jsuncheckbutton->setExtra("onclick=\"with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].type=='checkbox'){elements[i].checked=false;}}}\"");
172 172
         $jscheckbutton = new XoopsFormButton('', 'all', _ALL, 'button');
173
-        $jscheckbutton->setExtra("onclick=\"with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].type=='checkbox' && (elements[i].name.indexOf('module_admin')<0 || elements[i].name.indexOf('[groups][1]')>=0)){elements[i].checked=true;}}}\"") ;
174
-        $jstray->addElement($jsuncheckbutton) ;
175
-        $jstray->addElement($jscheckbutton) ;
173
+        $jscheckbutton->setExtra("onclick=\"with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].type=='checkbox' && (elements[i].name.indexOf('module_admin')<0 || elements[i].name.indexOf('[groups][1]')>=0)){elements[i].checked=true;}}}\"");
174
+        $jstray->addElement($jsuncheckbutton);
175
+        $jstray->addElement($jscheckbutton);
176 176
         $this->addElement($jstray);
177 177
         // GIJ end
178 178
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
         $ret = '<h4>'.$this->getTitle().'</h4>'.$this->_permDesc.'<br />';
185 185
         $ret .= "<form name='".$this->getName()."' id='".$this->getName()."' action='".$this->getAction()."' method='".$this->getMethod()."'".$this->getExtra().">\n<table width='100%' class='outer' cellspacing='1'>\n";
186
-        $elements =& $this->getElements();
186
+        $elements = & $this->getElements();
187 187
         foreach (array_keys($elements) as $i) {
188 188
             if (!is_object($elements[$i])) {
189 189
                 $ret .= $elements[$i];
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
                 $ret .= $elements[$i]->render();
200 200
             }
201 201
         }
202
-        $ret .= '</table>' . $xoopsGTicket->getTicketHtml(__LINE__, 1800, 'myblocksadmin') . '</form>';
202
+        $ret .= '</table>'.$xoopsGTicket->getTicketHtml(__LINE__, 1800, 'myblocksadmin').'</form>';
203 203
         return $ret;
204 204
     }
205 205
 }
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      * Appendix
236 236
      * @var array ('permname'=>,'itemid'=>,'itemname'=>,'selected'=>)
237 237
      */
238
-    public $_appendix = array() ;
238
+    public $_appendix = array();
239 239
 
240 240
     /**
241 241
      * Constructor
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
      */
286 286
     public function setAppendix($appendix)
287 287
     {
288
-        $this->_appendix = $appendix ;
288
+        $this->_appendix = $appendix;
289 289
     }
290 290
 
291 291
     /**
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
      */
297 297
     public function render()
298 298
     {
299
-        $ret = '' ;
299
+        $ret = '';
300 300
 
301 301
         if (count($this->_appendix) > 0) {
302 302
             $ret .= '<table class="outer"><tr>';
@@ -306,11 +306,11 @@  discard block
 block discarded – undo
306 306
                     $ret .= '</tr><tr>';
307 307
                     $cols = 1;
308 308
                 }
309
-                $checked = $append['selected'] ? 'checked="checked"' : '' ;
310
-                $name = 'perms['.$append['permname'].']' ;
311
-                $itemid = $append['itemid'] ;
312
-                $itemid = $append['itemid'] ;
313
-                $ret .= "<td class=\"odd\"><input type=\"checkbox\" name=\"{$name}[groups][$this->_groupId][$itemid]\" id=\"{$name}[groups][$this->_groupId][$itemid]\" value=\"1\" $checked />{$append['itemname']}<input type=\"hidden\" name=\"{$name}[parents][$itemid]\" value=\"\" /><input type=\"hidden\" name=\"{$name}[itemname][$itemid]\" value=\"{$append['itemname']}\" /><br /></td>" ;
309
+                $checked = $append['selected'] ? 'checked="checked"' : '';
310
+                $name = 'perms['.$append['permname'].']';
311
+                $itemid = $append['itemid'];
312
+                $itemid = $append['itemid'];
313
+                $ret .= "<td class=\"odd\"><input type=\"checkbox\" name=\"{$name}[groups][$this->_groupId][$itemid]\" id=\"{$name}[groups][$this->_groupId][$itemid]\" value=\"1\" $checked />{$append['itemname']}<input type=\"hidden\" name=\"{$name}[parents][$itemid]\" value=\"\" /><input type=\"hidden\" name=\"{$name}[itemname][$itemid]\" value=\"{$append['itemname']}\" /><br /></td>";
314 314
                 $cols++;
315 315
             }
316 316
             $ret .= '</tr></table>';
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 
319 319
         $ret .= '<table class="outer"><tr>';
320 320
         $cols = 1;
321
-        if (! empty($this->_optionTree[0]['children'])) {
321
+        if (!empty($this->_optionTree[0]['children'])) {
322 322
             foreach ($this->_optionTree[0]['children'] as $topitem) {
323 323
                 if ($cols > 4) {
324 324
                     $ret .= '</tr><tr>';
@@ -346,8 +346,8 @@  discard block
 block discarded – undo
346 346
      */
347 347
     public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = array())
348 348
     {
349
-        $tree .= $prefix."<input type=\"checkbox\" name=\"".$this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . "]\" id=\"" . $this->getName() . '[groups][' . $this->_groupId . ']['
350
-                 . $option['id'] . "]\" onclick=\"";
349
+        $tree .= $prefix."<input type=\"checkbox\" name=\"".$this->getName().'[groups]['.$this->_groupId.']['.$option['id']."]\" id=\"".$this->getName().'[groups]['.$this->_groupId.']['
350
+                 . $option['id']."]\" onclick=\"";
351 351
         // If there are parent elements, add javascript that will
352 352
         // make them selecteded when this element is checked to make
353 353
         // sure permissions to parent items are added as well.
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
         if (isset($this->_value) && in_array($option['id'], $this->_value)) {
368 368
             $tree .= ' checked="checked"';
369 369
         }
370
-        $tree .= ' />' . $option['name'] . "<input type=\"hidden\" name=\"" . $this->getName() . '[parents][' . $option['id'] . "]\" value=\"" . implode(':', $parentIds) . "\" /><input type=\"hidden\" name=\"" . $this->getName() . '[itemname]['
371
-                 . $option['id'] . "]\" value=\"" . htmlspecialchars($option['name']) . "\" /><br />\n";
370
+        $tree .= ' />'.$option['name']."<input type=\"hidden\" name=\"".$this->getName().'[parents]['.$option['id']."]\" value=\"".implode(':', $parentIds)."\" /><input type=\"hidden\" name=\"".$this->getName().'[itemname]['
371
+                 . $option['id']."]\" value=\"".htmlspecialchars($option['name'])."\" /><br />\n";
372 372
         if (isset($option['children'])) {
373 373
             foreach ($option['children'] as $child) {
374 374
                 array_push($parentIds, $option['id']);
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/include/altsys_functions.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -1,46 +1,46 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/include/admin_in_theme_header.inc.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/myblocksadmin.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -5,56 +5,56 @@  discard block
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/index.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,51 +1,51 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (! defined('XOOPS_MODULE_PATH')) {
4
-    define('XOOPS_MODULE_PATH', XOOPS_ROOT_PATH . '/modules');
3
+if (!defined('XOOPS_MODULE_PATH')) {
4
+    define('XOOPS_MODULE_PATH', XOOPS_ROOT_PATH.'/modules');
5 5
 }
6
-if (! defined('XOOPS_MODULE_URL')) {
7
-    define('XOOPS_MODULE_URL', XOOPS_URL . '/modules');
6
+if (!defined('XOOPS_MODULE_URL')) {
7
+    define('XOOPS_MODULE_URL', XOOPS_URL.'/modules');
8 8
 }
9 9
 
10 10
  
11
-require_once __DIR__.'/class/AltsysBreadcrumbs.class.php' ;
12
-require_once __DIR__.'/include/altsys_functions.php' ;
11
+require_once __DIR__.'/class/AltsysBreadcrumbs.class.php';
12
+require_once __DIR__.'/include/altsys_functions.php';
13 13
 
14 14
 
15 15
 if (empty($xoopsModule)) {
16
-    $moduleperm_handler = xoops_getHandler('module') ;
17
-    $xoopsModule = $moduleperm_handler->getByDirname('altsys') ;
16
+    $moduleperm_handler = xoops_getHandler('module');
17
+    $xoopsModule = $moduleperm_handler->getByDirname('altsys');
18 18
 }
19 19
 
20
-require XOOPS_ROOT_PATH.'/include/cp_functions.php' ;
20
+require XOOPS_ROOT_PATH.'/include/cp_functions.php';
21 21
 
22 22
 // breadcrumbs
23
-$breadcrumbsObj = AltsysBreadcrumbs::getInstance() ;
24
-$breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php', $GLOBALS['xoopsModule']->getVar('name')) ;
23
+$breadcrumbsObj = AltsysBreadcrumbs::getInstance();
24
+$breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php', $GLOBALS['xoopsModule']->getVar('name'));
25 25
 
26 26
 // get page
27
-$page = preg_replace('/[^a-zA-Z0-9_-]/', '', @$_GET['page']) ;
28
-require __DIR__.'/controllers.php' ;
29
-if (! in_array($page, $controllers)) {
30
-    $_GET['page'] = $page = 'myblocksadmin' ;
31
-    $_SERVER['REQUEST_URI'] = '/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin' ;
27
+$page = preg_replace('/[^a-zA-Z0-9_-]/', '', @$_GET['page']);
28
+require __DIR__.'/controllers.php';
29
+if (!in_array($page, $controllers)) {
30
+    $_GET['page'] = $page = 'myblocksadmin';
31
+    $_SERVER['REQUEST_URI'] = '/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin';
32 32
 }
33 33
 
34 34
 
35 35
 // half measure ... (TODO)
36 36
 if (empty($_GET['dirname'])) {
37
-    $module_handler = xoops_getHandler('module') ;
38
-    list($top_module) = $module_handler->getObjects(new Criteria('isactive', 1)) ;
39
-    $_GET['dirname'] = $top_module->getVar('dirname') ;
37
+    $module_handler = xoops_getHandler('module');
38
+    list($top_module) = $module_handler->getObjects(new Criteria('isactive', 1));
39
+    $_GET['dirname'] = $top_module->getVar('dirname');
40 40
 }
41 41
 
42 42
 // language file
43
-altsys_include_language_file($page) ;
43
+altsys_include_language_file($page);
44 44
 
45 45
 // branch to each pages
46
-$mytrustdirpath = __DIR__ ;
46
+$mytrustdirpath = __DIR__;
47 47
 if (file_exists(XOOPS_TRUST_PATH.'/libs/altsys/'.$page.'.php')) {
48
-    include XOOPS_TRUST_PATH.'/libs/altsys/'.$page.'.php' ;
48
+    include XOOPS_TRUST_PATH.'/libs/altsys/'.$page.'.php';
49 49
 } else {
50
-    die('wrong request') ;
50
+    die('wrong request');
51 51
 }
Please login to merge, or discard this patch.