@@ -3,40 +3,40 @@ discard block |
||
3 | 3 | class d3utilities |
4 | 4 | { |
5 | 5 | |
6 | - public $dirname = '' ; // directory name under xoops_trust_path |
|
7 | - public $mydirname = '' ; // each directory name under xoops_root_path |
|
8 | - public $mid = 0 ; // id of each module instance |
|
9 | - public $table = '' ; // table with prefix and dirname |
|
10 | - public $primary_key = '' ; // column for primary_key |
|
11 | - public $cols = array() ; // settings of each columns |
|
12 | - public $form_mode = 'new' ; // 'new','edit' are available |
|
13 | - public $page_name = '' ; // controller's name eg) page=(controller) in URI |
|
14 | - public $action_base_hiddens = array() ; |
|
6 | + public $dirname = ''; // directory name under xoops_trust_path |
|
7 | + public $mydirname = ''; // each directory name under xoops_root_path |
|
8 | + public $mid = 0; // id of each module instance |
|
9 | + public $table = ''; // table with prefix and dirname |
|
10 | + public $primary_key = ''; // column for primary_key |
|
11 | + public $cols = array(); // settings of each columns |
|
12 | + public $form_mode = 'new'; // 'new','edit' are available |
|
13 | + public $page_name = ''; // controller's name eg) page=(controller) in URI |
|
14 | + public $action_base_hiddens = array(); |
|
15 | 15 | |
16 | 16 | //HACK by domifara |
17 | 17 | // public function D3Utilities( $mydirname , $table_body , $primary_key , $cols , $page_name , $action_base_hiddens ) |
18 | 18 | public function __construct($mydirname, $table_body, $primary_key, $cols, $page_name, $action_base_hiddens) |
19 | 19 | { |
20 | - $db =& XoopsDatabaseFactory::getDatabaseConnection() ; |
|
21 | - |
|
22 | - $this->dirname = basename(dirname(__DIR__)) ; |
|
23 | - $this->mydirname = $mydirname ; |
|
24 | - $this->table = $db->prefix($mydirname ? $mydirname . '_' . $table_body : $table_body) ; |
|
25 | - $this->primary_key = $primary_key ; |
|
26 | - $this->cols = $cols ; |
|
27 | - $module_handler =& xoops_gethandler('module') ; |
|
28 | - $module =& $module_handler->getByDirname($this->mydirname) ; |
|
29 | - if (! empty($module)) { |
|
20 | + $db = & XoopsDatabaseFactory::getDatabaseConnection(); |
|
21 | + |
|
22 | + $this->dirname = basename(dirname(__DIR__)); |
|
23 | + $this->mydirname = $mydirname; |
|
24 | + $this->table = $db->prefix($mydirname ? $mydirname.'_'.$table_body : $table_body); |
|
25 | + $this->primary_key = $primary_key; |
|
26 | + $this->cols = $cols; |
|
27 | + $module_handler = & xoops_gethandler('module'); |
|
28 | + $module = & $module_handler->getByDirname($this->mydirname); |
|
29 | + if (!empty($module)) { |
|
30 | 30 | $this->mid = (int)$module->getVar('mid'); |
31 | 31 | } |
32 | - $this->page_name = $page_name ; |
|
33 | - $this->action_base_hiddens = $action_base_hiddens ; |
|
32 | + $this->page_name = $page_name; |
|
33 | + $this->action_base_hiddens = $action_base_hiddens; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
37 | 37 | public function get_language_constant($name) |
38 | 38 | { |
39 | - return constant(strtoupper('_MD_A_' . $this->dirname . '_' . $this->page_name . '_' . $name)) ; |
|
39 | + return constant(strtoupper('_MD_A_'.$this->dirname.'_'.$this->page_name.'_'.$name)); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -46,22 +46,22 @@ discard block |
||
46 | 46 | case 'text' : |
47 | 47 | case 'blob' : |
48 | 48 | $length = empty($col['length']) ? 65535 : (int)$col['length']; |
49 | - return "`{$col['name']}`='".addslashes(xoops_substr($value, 0, $length))."'" ; |
|
49 | + return "`{$col['name']}`='".addslashes(xoops_substr($value, 0, $length))."'"; |
|
50 | 50 | case 'char' : |
51 | 51 | case 'varchar' : |
52 | 52 | case 'string' : |
53 | 53 | $length = empty($col['length']) ? 255 : (int)$col['length']; |
54 | - return "`{$col['name']}`='".addslashes(xoops_substr($value, 0, $length))."'" ; |
|
54 | + return "`{$col['name']}`='".addslashes(xoops_substr($value, 0, $length))."'"; |
|
55 | 55 | case 'int' : |
56 | 56 | case 'integer' : |
57 | 57 | $value = (int)$value; |
58 | - if (! empty($col['max'])) { |
|
59 | - $value = min($value, (int)$col['max']) ; |
|
58 | + if (!empty($col['max'])) { |
|
59 | + $value = min($value, (int)$col['max']); |
|
60 | 60 | } |
61 | - if (! empty($col['min'])) { |
|
62 | - $value = max($value, (int)$col['min']) ; |
|
61 | + if (!empty($col['min'])) { |
|
62 | + $value = max($value, (int)$col['min']); |
|
63 | 63 | } |
64 | - return "`{$col['name']}`=$value" ; |
|
64 | + return "`{$col['name']}`=$value"; |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
@@ -69,29 +69,29 @@ discard block |
||
69 | 69 | // single update or insert |
70 | 70 | public function insert() |
71 | 71 | { |
72 | - $db =& XoopsDatabaseFactory::getDatabaseConnection() ; |
|
72 | + $db = & XoopsDatabaseFactory::getDatabaseConnection(); |
|
73 | 73 | |
74 | - $id = $this->init_default_values() ; |
|
74 | + $id = $this->init_default_values(); |
|
75 | 75 | |
76 | - $set4sql = '' ; |
|
76 | + $set4sql = ''; |
|
77 | 77 | foreach ($this->cols as $col) { |
78 | 78 | if (empty($col['edit_edit'])) { |
79 | - continue ; |
|
79 | + continue; |
|
80 | 80 | } |
81 | 81 | if ($col['name'] == $this->primary_key) { |
82 | - continue ; |
|
82 | + continue; |
|
83 | 83 | } |
84 | - $set4sql .= $this->get_set4sql(@$_POST[ $col['name'] ], $col) . ',' ; |
|
84 | + $set4sql .= $this->get_set4sql(@$_POST[$col['name']], $col).','; |
|
85 | 85 | } |
86 | - if (! empty($set4sql)) { |
|
86 | + if (!empty($set4sql)) { |
|
87 | 87 | if ($id > 0) { |
88 | 88 | // UPDATE |
89 | - $db->queryF("UPDATE $this->table SET ".substr($set4sql, 0, -1)." WHERE $this->primary_key='".addslashes($id)."'") ; |
|
90 | - return array( $id , 'update' ) ; |
|
89 | + $db->queryF("UPDATE $this->table SET ".substr($set4sql, 0, -1)." WHERE $this->primary_key='".addslashes($id)."'"); |
|
90 | + return array($id, 'update'); |
|
91 | 91 | } else { |
92 | 92 | // INSERT |
93 | - $db->queryF("INSERT INTO $this->table SET ".substr($set4sql, 0, -1)) ; |
|
94 | - return array( $db->getInsertId() , 'insert' ) ; |
|
93 | + $db->queryF("INSERT INTO $this->table SET ".substr($set4sql, 0, -1)); |
|
94 | + return array($db->getInsertId(), 'insert'); |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | } |
@@ -100,156 +100,156 @@ discard block |
||
100 | 100 | // multiple update |
101 | 101 | public function update() |
102 | 102 | { |
103 | - $db =& XoopsDatabaseFactory::getDatabaseConnection() ; |
|
103 | + $db = & XoopsDatabaseFactory::getDatabaseConnection(); |
|
104 | 104 | |
105 | 105 | // search appropriate column for getting primary_key |
106 | 106 | foreach ($this->cols as $col) { |
107 | - if (in_array(@$col['list_edit'], array( 'text', 'textarea', 'hidden' ))) { |
|
108 | - $column4key = $col['name'] ; |
|
109 | - break ; |
|
107 | + if (in_array(@$col['list_edit'], array('text', 'textarea', 'hidden'))) { |
|
108 | + $column4key = $col['name']; |
|
109 | + break; |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | if (empty($column4key)) { |
113 | - $column4key = $this->cols[0]['name'] ; |
|
113 | + $column4key = $this->cols[0]['name']; |
|
114 | 114 | } |
115 | 115 | |
116 | - $ret = array() ; |
|
116 | + $ret = array(); |
|
117 | 117 | foreach (array_keys($_POST[$column4key]) as $id) { |
118 | - $id = (int)$id; // primary_key should be 'integer' |
|
119 | - $set4sql = '' ; |
|
118 | + $id = (int)$id; // primary_key should be 'integer' |
|
119 | + $set4sql = ''; |
|
120 | 120 | foreach ($this->cols as $col) { |
121 | 121 | if (empty($col['list_edit'])) { |
122 | - continue ; |
|
122 | + continue; |
|
123 | 123 | } |
124 | 124 | if ($col['name'] == $this->primary_key) { |
125 | - continue ; |
|
125 | + continue; |
|
126 | 126 | } |
127 | - $set4sql .= $this->get_set4sql(@$_POST[ $col['name'] ][$id], $col) . ',' ; |
|
127 | + $set4sql .= $this->get_set4sql(@$_POST[$col['name']][$id], $col).','; |
|
128 | 128 | } |
129 | - if (! empty($set4sql)) { |
|
130 | - $result = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id") ; |
|
129 | + if (!empty($set4sql)) { |
|
130 | + $result = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id"); |
|
131 | 131 | if ($db->getRowsNum($result) == 1) { |
132 | - $db->queryF("UPDATE $this->table SET ".substr($set4sql, 0, -1)." WHERE $this->primary_key=$id") ; |
|
132 | + $db->queryF("UPDATE $this->table SET ".substr($set4sql, 0, -1)." WHERE $this->primary_key=$id"); |
|
133 | 133 | if ($db->getAffectedRows() == 1) { |
134 | - $ret[ $id ] = $db->fetchArray($result) ; |
|
134 | + $ret[$id] = $db->fetchArray($result); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | - return $ret ; |
|
140 | + return $ret; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
144 | 144 | public function delete($delete_comments = false, $delete_notifications = false) |
145 | 145 | { |
146 | - $db =& XoopsDatabaseFactory::getDatabaseConnection() ; |
|
146 | + $db = & XoopsDatabaseFactory::getDatabaseConnection(); |
|
147 | 147 | |
148 | - $ret = array() ; |
|
148 | + $ret = array(); |
|
149 | 149 | foreach (array_keys($_POST['admin_main_checkboxes']) as $id) { |
150 | - $id = (int)$id; // primary_key should be 'integer' |
|
151 | - $result = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id") ; |
|
150 | + $id = (int)$id; // primary_key should be 'integer' |
|
151 | + $result = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id"); |
|
152 | 152 | if ($db->getRowsNum($result) == 1) { |
153 | - $ret[ $id ] = $db->fetchArray($result) ; |
|
153 | + $ret[$id] = $db->fetchArray($result); |
|
154 | 154 | |
155 | - $db->queryF("DELETE FROM $this->table WHERE $this->primary_key=$id") ; |
|
155 | + $db->queryF("DELETE FROM $this->table WHERE $this->primary_key=$id"); |
|
156 | 156 | if ($delete_comments) { |
157 | 157 | // remove comments |
158 | - $db->queryF('DELETE FROM ' . $db->prefix('xoopscomments') . " WHERE com_modid=$this->mid AND com_itemid=$id") ; |
|
158 | + $db->queryF('DELETE FROM '.$db->prefix('xoopscomments')." WHERE com_modid=$this->mid AND com_itemid=$id"); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | if ($delete_notifications) { |
162 | 162 | // remove notifications |
163 | - $db->queryF('DELETE FROM ' . $db->prefix('xoopsnotifications') . " WHERE not_modid=$this->mid AND not_itemid=$id") ; |
|
163 | + $db->queryF('DELETE FROM '.$db->prefix('xoopsnotifications')." WHERE not_modid=$this->mid AND not_itemid=$id"); |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
168 | - return $ret ; |
|
168 | + return $ret; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | |
172 | 172 | public function init_default_values() |
173 | 173 | { |
174 | - $db =& XoopsDatabaseFactory::getDatabaseConnection() ; |
|
174 | + $db = & XoopsDatabaseFactory::getDatabaseConnection(); |
|
175 | 175 | |
176 | 176 | if (@$_GET['id']) { |
177 | 177 | $id = (int)$_GET['id']; |
178 | - $rs = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id") ; |
|
178 | + $rs = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id"); |
|
179 | 179 | if ($db->getRowsNum($rs) == 1) { |
180 | - $row = $db->fetchArray($rs) ; |
|
180 | + $row = $db->fetchArray($rs); |
|
181 | 181 | foreach (array_keys($this->cols) as $key) { |
182 | 182 | if (empty($this->cols[$key]['edit_show'])) { |
183 | - continue ; |
|
183 | + continue; |
|
184 | 184 | } |
185 | - $this->cols[$key]['default_value'] = $row[ $this->cols[$key]['name'] ] ; |
|
185 | + $this->cols[$key]['default_value'] = $row[$this->cols[$key]['name']]; |
|
186 | 186 | } |
187 | - $this->form_mode = 'edit' ; |
|
188 | - return $id ; |
|
187 | + $this->form_mode = 'edit'; |
|
188 | + return $id; |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | - $this->form_mode = 'new' ; |
|
193 | - return 0 ; |
|
192 | + $this->form_mode = 'new'; |
|
193 | + return 0; |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
197 | 197 | public function get_view_edit() |
198 | 198 | { |
199 | - $id = $this->init_default_values() ; |
|
199 | + $id = $this->init_default_values(); |
|
200 | 200 | |
201 | - $lines = array() ; |
|
201 | + $lines = array(); |
|
202 | 202 | foreach ($this->cols as $col) { |
203 | 203 | if (empty($col['edit_show'])) { |
204 | - continue ; |
|
204 | + continue; |
|
205 | 205 | } |
206 | - if (! isset($col['default_value'])) { |
|
206 | + if (!isset($col['default_value'])) { |
|
207 | 207 | switch ($col['type']) { |
208 | 208 | case 'int' : |
209 | 209 | case 'integer' : |
210 | - $col['default_value'] = 0 ; |
|
211 | - break ; |
|
210 | + $col['default_value'] = 0; |
|
211 | + break; |
|
212 | 212 | default : |
213 | - $col['default_value'] = '' ; |
|
214 | - break ; |
|
213 | + $col['default_value'] = ''; |
|
214 | + break; |
|
215 | 215 | } |
216 | 216 | } |
217 | 217 | switch ($col['edit_edit']) { |
218 | 218 | case 'checkbox' : |
219 | - $checked = empty($col['default_value']) ? '' : "checked='checked'" ; |
|
220 | - $value = empty($col['checkbox_value']) ? 1 : htmlspecialchars($col['checkbox_value'], ENT_QUOTES) ; |
|
219 | + $checked = empty($col['default_value']) ? '' : "checked='checked'"; |
|
220 | + $value = empty($col['checkbox_value']) ? 1 : htmlspecialchars($col['checkbox_value'], ENT_QUOTES); |
|
221 | 221 | |
222 | - $lines[ $col['name'] ] = "<input type='checkbox' name='{$col['name']}' value='$value' $checked />" ; |
|
223 | - break ; |
|
222 | + $lines[$col['name']] = "<input type='checkbox' name='{$col['name']}' value='$value' $checked />"; |
|
223 | + break; |
|
224 | 224 | case 'text' : |
225 | 225 | default : |
226 | 226 | $size = empty($col['edit_size']) ? 32 : (int)$col['edit_size']; |
227 | 227 | $length = empty($col['length']) ? 255 : (int)$col['length']; |
228 | - $lines[ $col['name'] ] = "<input type='text' name='{$col['name']}' size='$size' maxlength='$length' value='".htmlspecialchars($col['default_value'], ENT_QUOTES)."' />" ; |
|
229 | - break ; |
|
228 | + $lines[$col['name']] = "<input type='text' name='{$col['name']}' size='$size' maxlength='$length' value='".htmlspecialchars($col['default_value'], ENT_QUOTES)."' />"; |
|
229 | + break; |
|
230 | 230 | case false : |
231 | - $lines[ $col['name'] ] = htmlspecialchars($col['default_value'], ENT_QUOTES) ; |
|
232 | - break ; |
|
231 | + $lines[$col['name']] = htmlspecialchars($col['default_value'], ENT_QUOTES); |
|
232 | + break; |
|
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
236 | - return array( $id , $lines ) ; |
|
236 | + return array($id, $lines); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | |
240 | 240 | public function get_control_form($controllers) |
241 | 241 | { |
242 | - $hiddens = '' ; |
|
242 | + $hiddens = ''; |
|
243 | 243 | foreach ($this->action_base_hiddens as $key => $val) { |
244 | - $key4disp = htmlspecialchars($key, ENT_QUOTES) ; |
|
245 | - $val4disp = htmlspecialchars($val, ENT_QUOTES) ; |
|
246 | - $hiddens .= "<input type='hidden' name='$key4disp' value='$val4disp' />\n" ; |
|
244 | + $key4disp = htmlspecialchars($key, ENT_QUOTES); |
|
245 | + $val4disp = htmlspecialchars($val, ENT_QUOTES); |
|
246 | + $hiddens .= "<input type='hidden' name='$key4disp' value='$val4disp' />\n"; |
|
247 | 247 | } |
248 | 248 | |
249 | - $controllers_html = '' ; |
|
249 | + $controllers_html = ''; |
|
250 | 250 | foreach ($controllers as $type => $body) { |
251 | 251 | if ($type == 'num') { |
252 | - $controllers_html .= $this->get_select('num', $body, $GLOBALS['num']) ; |
|
252 | + $controllers_html .= $this->get_select('num', $body, $GLOBALS['num']); |
|
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
@@ -263,13 +263,13 @@ discard block |
||
263 | 263 | |
264 | 264 | public function get_select($name, $options, $current_value) |
265 | 265 | { |
266 | - $ret = "<select name='".htmlspecialchars($name, ENT_QUOTES)."'>\n" ; |
|
266 | + $ret = "<select name='".htmlspecialchars($name, ENT_QUOTES)."'>\n"; |
|
267 | 267 | foreach ($options as $key => $val) { |
268 | 268 | $selected = $val == $current_value ? "selected='selected'" : ''; |
269 | - $ret .= "<option value='".htmlspecialchars($key, ENT_QUOTES)."' $selected>".htmlspecialchars($val, ENT_QUOTES)."</option>\n" ; |
|
269 | + $ret .= "<option value='".htmlspecialchars($key, ENT_QUOTES)."' $selected>".htmlspecialchars($val, ENT_QUOTES)."</option>\n"; |
|
270 | 270 | } |
271 | - $ret .= "</select>\n" ; |
|
271 | + $ret .= "</select>\n"; |
|
272 | 272 | |
273 | - return $ret ; |
|
273 | + return $ret; |
|
274 | 274 | } |
275 | 275 | } |
@@ -4,16 +4,16 @@ discard block |
||
4 | 4 | class MyBlocksAdmin |
5 | 5 | { |
6 | 6 | |
7 | - public $db ; |
|
8 | - public $lang ; |
|
9 | - public $cachetime_options = array() ; |
|
10 | - public $ctype_options = array() ; |
|
11 | - public $type_options = array() ; |
|
12 | - public $target_mid = 0 ; |
|
13 | - public $target_dirname = '' ; |
|
14 | - public $target_mname = '' ; |
|
15 | - public $block_configs = array() ; |
|
16 | - public $preview_request = array() ; |
|
7 | + public $db; |
|
8 | + public $lang; |
|
9 | + public $cachetime_options = array(); |
|
10 | + public $ctype_options = array(); |
|
11 | + public $type_options = array(); |
|
12 | + public $target_mid = 0; |
|
13 | + public $target_dirname = ''; |
|
14 | + public $target_mname = ''; |
|
15 | + public $block_configs = array(); |
|
16 | + public $preview_request = array(); |
|
17 | 17 | |
18 | 18 | public function MyBlocksAadmin() |
19 | 19 | { |
@@ -22,37 +22,37 @@ discard block |
||
22 | 22 | |
23 | 23 | public function construct() |
24 | 24 | { |
25 | - $this->db =& XoopsDatabaseFactory::getDatabaseConnection() ; |
|
26 | - $this->lang = @$GLOBALS['xoopsConfig']['language'] ; |
|
25 | + $this->db = & XoopsDatabaseFactory::getDatabaseConnection(); |
|
26 | + $this->lang = @$GLOBALS['xoopsConfig']['language']; |
|
27 | 27 | |
28 | 28 | $this->cachetime_options = array( |
29 | - 0 => _NOCACHE , |
|
30 | - 30 => sprintf(_SECONDS, 30) , |
|
31 | - 60 => _MINUTE , |
|
32 | - 300 => sprintf(_MINUTES, 5) , |
|
33 | - 1800 => sprintf(_MINUTES, 30) , |
|
34 | - 3600 => _HOUR , |
|
35 | - 18000 => sprintf(_HOURS, 5) , |
|
36 | - 86400 => _DAY , |
|
37 | - 259200 => sprintf(_DAYS, 3) , |
|
38 | - 604800 => _WEEK , |
|
29 | + 0 => _NOCACHE, |
|
30 | + 30 => sprintf(_SECONDS, 30), |
|
31 | + 60 => _MINUTE, |
|
32 | + 300 => sprintf(_MINUTES, 5), |
|
33 | + 1800 => sprintf(_MINUTES, 30), |
|
34 | + 3600 => _HOUR, |
|
35 | + 18000 => sprintf(_HOURS, 5), |
|
36 | + 86400 => _DAY, |
|
37 | + 259200 => sprintf(_DAYS, 3), |
|
38 | + 604800 => _WEEK, |
|
39 | 39 | 2592000 => _MONTH |
40 | 40 | ); |
41 | 41 | |
42 | 42 | $this->ctype_options = array( |
43 | - 'H' => _MD_A_MYBLOCKSADMIN_CTYPE_HTML , |
|
44 | - 'T' => _MD_A_MYBLOCKSADMIN_CTYPE_NOSMILE , |
|
45 | - 'S' => _MD_A_MYBLOCKSADMIN_CTYPE_SMILE , |
|
43 | + 'H' => _MD_A_MYBLOCKSADMIN_CTYPE_HTML, |
|
44 | + 'T' => _MD_A_MYBLOCKSADMIN_CTYPE_NOSMILE, |
|
45 | + 'S' => _MD_A_MYBLOCKSADMIN_CTYPE_SMILE, |
|
46 | 46 | 'P' => _MD_A_MYBLOCKSADMIN_CTYPE_PHP |
47 | - ) ; |
|
47 | + ); |
|
48 | 48 | |
49 | 49 | $this->type_options = array( |
50 | - 'C' => 'custom block' , |
|
51 | - 'E' => 'cloned custom block' , |
|
52 | - 'M' => 'module\'s block' , |
|
53 | - 'D' => 'cloned module\'s block' , |
|
50 | + 'C' => 'custom block', |
|
51 | + 'E' => 'cloned custom block', |
|
52 | + 'M' => 'module\'s block', |
|
53 | + 'D' => 'cloned module\'s block', |
|
54 | 54 | 'S' => 'system block' |
55 | - ) ; |
|
55 | + ); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | //HACK by domifara for php5.3+ |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | { |
62 | 62 | static $instance; |
63 | 63 | if (!isset($instance)) { |
64 | - $instance = new MyBlocksAdmin() ; |
|
65 | - $instance->construct() ; |
|
64 | + $instance = new MyBlocksAdmin(); |
|
65 | + $instance->construct(); |
|
66 | 66 | } |
67 | 67 | return $instance; |
68 | 68 | } |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | public function checkPermission() |
73 | 73 | { |
74 | 74 | // only groups have 'module_admin' of 'altsys' can do that. |
75 | - $module_handler =& xoops_gethandler('module') ; |
|
76 | - $module =& $module_handler->getByDirname('altsys') ; |
|
77 | - $moduleperm_handler =& xoops_gethandler('groupperm') ; |
|
78 | - if (! is_object(@$GLOBALS['xoopsUser']) || ! $moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $GLOBALS['xoopsUser']->getGroups())) { |
|
79 | - die('only admin of altsys can access this area') ; |
|
75 | + $module_handler = & xoops_gethandler('module'); |
|
76 | + $module = & $module_handler->getByDirname('altsys'); |
|
77 | + $moduleperm_handler = & xoops_gethandler('groupperm'); |
|
78 | + if (!is_object(@$GLOBALS['xoopsUser']) || !$moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $GLOBALS['xoopsUser']->getGroups())) { |
|
79 | + die('only admin of altsys can access this area'); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
@@ -86,53 +86,53 @@ discard block |
||
86 | 86 | // altsys "module" MODE |
87 | 87 | if ($xoopsModule->getVar('dirname') == 'altsys') { |
88 | 88 | // set target_module if specified by $_GET['dirname'] |
89 | - $module_handler =& xoops_gethandler('module'); |
|
90 | - if (! empty($_GET['dirname'])) { |
|
91 | - $dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', $_GET['dirname']) ; |
|
92 | - $target_module =& $module_handler->getByDirname($dirname) ; |
|
89 | + $module_handler = & xoops_gethandler('module'); |
|
90 | + if (!empty($_GET['dirname'])) { |
|
91 | + $dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', $_GET['dirname']); |
|
92 | + $target_module = & $module_handler->getByDirname($dirname); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | if (is_object(@$target_module)) { |
96 | 96 | // module's blocks |
97 | - $this->target_mid = $target_module->getVar('mid') ; |
|
98 | - $this->target_mname = $target_module->getVar('name') . ' ' . sprintf('(%2.2f)', $target_module->getVar('version') / 100.0) ; |
|
99 | - $this->target_dirname = $target_module->getVar('dirname') ; |
|
100 | - $modinfo = $target_module->getInfo() ; |
|
97 | + $this->target_mid = $target_module->getVar('mid'); |
|
98 | + $this->target_mname = $target_module->getVar('name').' '.sprintf('(%2.2f)', $target_module->getVar('version') / 100.0); |
|
99 | + $this->target_dirname = $target_module->getVar('dirname'); |
|
100 | + $modinfo = $target_module->getInfo(); |
|
101 | 101 | // breadcrumbs |
102 | - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; |
|
103 | - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin', '_MI_ALTSYS_MENU_MYBLOCKSADMIN') ; |
|
104 | - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$this->target_dirname, $this->target_mname) ; |
|
102 | + $breadcrumbsObj = & AltsysBreadcrumbs::getInstance(); |
|
103 | + $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin', '_MI_ALTSYS_MENU_MYBLOCKSADMIN'); |
|
104 | + $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$this->target_dirname, $this->target_mname); |
|
105 | 105 | } else { |
106 | 106 | // custom blocks |
107 | - $this->target_mid = 0 ; |
|
108 | - $this->target_mname = _MI_ALTSYS_MENU_CUSTOMBLOCKS ; |
|
109 | - $this->target_dirname = '__CustomBlocks__' ; |
|
107 | + $this->target_mid = 0; |
|
108 | + $this->target_mname = _MI_ALTSYS_MENU_CUSTOMBLOCKS; |
|
109 | + $this->target_dirname = '__CustomBlocks__'; |
|
110 | 110 | // breadcrumbs |
111 | - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; |
|
112 | - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin', '_MI_ALTSYS_MENU_MYBLOCKSADMIN') ; |
|
113 | - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$this->target_dirname, '_MI_ALTSYS_MENU_CUSTOMBLOCKS') ; |
|
111 | + $breadcrumbsObj = & AltsysBreadcrumbs::getInstance(); |
|
112 | + $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin', '_MI_ALTSYS_MENU_MYBLOCKSADMIN'); |
|
113 | + $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$this->target_dirname, '_MI_ALTSYS_MENU_CUSTOMBLOCKS'); |
|
114 | 114 | } |
115 | 115 | } else { |
116 | 116 | // myblocksadmin as a library |
117 | - $this->target_mid = $xoopsModule->getVar('mid') ; |
|
118 | - $this->target_mname = $xoopsModule->getVar('name') . ' ' . sprintf('(%2.2f)', $xoopsModule->getVar('version') / 100.0) ; |
|
119 | - $this->target_dirname = $xoopsModule->getVar('dirname') ; |
|
120 | - $mod_url = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname') ; |
|
121 | - $modinfo = $xoopsModule->getInfo() ; |
|
122 | - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; |
|
123 | - $breadcrumbsObj->appendPath($mod_url.'/'.@$modinfo['adminindex'], $this->target_mname) ; |
|
124 | - $breadcrumbsObj->appendPath($mod_url.'/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin', _MD_A_MYBLOCKSADMIN_BLOCKADMIN) ; |
|
117 | + $this->target_mid = $xoopsModule->getVar('mid'); |
|
118 | + $this->target_mname = $xoopsModule->getVar('name').' '.sprintf('(%2.2f)', $xoopsModule->getVar('version') / 100.0); |
|
119 | + $this->target_dirname = $xoopsModule->getVar('dirname'); |
|
120 | + $mod_url = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname'); |
|
121 | + $modinfo = $xoopsModule->getInfo(); |
|
122 | + $breadcrumbsObj = & AltsysBreadcrumbs::getInstance(); |
|
123 | + $breadcrumbsObj->appendPath($mod_url.'/'.@$modinfo['adminindex'], $this->target_mname); |
|
124 | + $breadcrumbsObj->appendPath($mod_url.'/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin', _MD_A_MYBLOCKSADMIN_BLOCKADMIN); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | // read xoops_version.php of the target |
128 | - $this->block_configs = $this->get_block_configs() ; |
|
128 | + $this->block_configs = $this->get_block_configs(); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | |
132 | 132 | // virtual |
133 | 133 | public function canEdit($block) |
134 | 134 | { |
135 | - return true ; |
|
135 | + return true; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | { |
142 | 142 | // can delete if it is a cloned block |
143 | 143 | if ($block->getVar('block_type') == 'D' || $block->getVar('block_type') == 'C') { |
144 | - return true ; |
|
144 | + return true; |
|
145 | 145 | } else { |
146 | - return false ; |
|
146 | + return false; |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
@@ -156,23 +156,23 @@ discard block |
||
156 | 156 | { |
157 | 157 | // can clone link if it is marked as cloneable block |
158 | 158 | if ($block->getVar('block_type') == 'D' || $block->getVar('block_type') == 'C') { |
159 | - return 2 ; |
|
159 | + return 2; |
|
160 | 160 | } else { |
161 | 161 | // $modversion['blocks'][n]['can_clone'] |
162 | 162 | foreach ($this->block_configs as $bconf) { |
163 | 163 | if ($block->getVar('show_func') == @$bconf['show_func'] && $block->getVar('func_file') == @$bconf['file'] && (empty($bconf['template']) || $block->getVar('template') == @$bconf['template'])) { |
164 | - if (! empty($bconf['can_clone'])) { |
|
165 | - return 2 ; |
|
164 | + if (!empty($bconf['can_clone'])) { |
|
165 | + return 2; |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
171 | - if (! empty($GLOBALS['altsysModuleConfig']['enable_force_clone'])) { |
|
172 | - return 1 ; |
|
171 | + if (!empty($GLOBALS['altsysModuleConfig']['enable_force_clone'])) { |
|
172 | + return 1; |
|
173 | 173 | } |
174 | 174 | |
175 | - return 0 ; |
|
175 | + return 0; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | |
@@ -184,13 +184,13 @@ discard block |
||
184 | 184 | |
185 | 185 | //HACK by domifara |
186 | 186 | if (defined('XOOPS_CUBE_LEGACY')) { |
187 | - $handler =& xoops_gethandler('block'); |
|
188 | - $block =& $handler->create(false) ; |
|
189 | - $block->load($bid) ; |
|
187 | + $handler = & xoops_gethandler('block'); |
|
188 | + $block = & $handler->create(false); |
|
189 | + $block->load($bid); |
|
190 | 190 | } else { |
191 | - $block = new XoopsBlock($bid) ; |
|
191 | + $block = new XoopsBlock($bid); |
|
192 | 192 | } |
193 | - return $block->getOptions() ; |
|
193 | + return $block->getOptions(); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -203,43 +203,43 @@ discard block |
||
203 | 203 | // get selected targets |
204 | 204 | if (is_array(@$block_data['bmodule'])) { |
205 | 205 | // bmodule origined from request (preview etc.) |
206 | - $selected_mids = $block_data['bmodule'] ; |
|
206 | + $selected_mids = $block_data['bmodule']; |
|
207 | 207 | } else { |
208 | 208 | // origined from the table of `block_module_link` |
209 | - $result = $this->db->query('SELECT module_id FROM ' . $this->db->prefix('block_module_link') . " WHERE block_id='$bid'") ; |
|
209 | + $result = $this->db->query('SELECT module_id FROM '.$this->db->prefix('block_module_link')." WHERE block_id='$bid'"); |
|
210 | 210 | $selected_mids = array(); |
211 | 211 | while (list($selected_mid) = $this->db->fetchRow($result)) { |
212 | 212 | $selected_mids[] = (int)$selected_mid; |
213 | 213 | } |
214 | 214 | if (empty($selected_mids)) { |
215 | - $selected_mids = array( 0 ) ; |
|
215 | + $selected_mids = array(0); |
|
216 | 216 | } // all pages |
217 | 217 | } |
218 | 218 | |
219 | 219 | // get all targets |
220 | - $module_handler =& xoops_gethandler('module'); |
|
220 | + $module_handler = & xoops_gethandler('module'); |
|
221 | 221 | $criteria = new CriteriaCompo(new Criteria('hasmain', 1)); |
222 | 222 | $criteria->add(new Criteria('isactive', 1)); |
223 | 223 | $module_list = $module_handler->getList($criteria); |
224 | - $module_list= array( -1 => _MD_A_MYBLOCKSADMIN_TOPPAGE , 0 => _MD_A_MYBLOCKSADMIN_ALLPAGES ) + $module_list ; |
|
224 | + $module_list = array( -1 => _MD_A_MYBLOCKSADMIN_TOPPAGE, 0 => _MD_A_MYBLOCKSADMIN_ALLPAGES ) + $module_list; |
|
225 | 225 | |
226 | 226 | // build options |
227 | - $module_options = '' ; |
|
227 | + $module_options = ''; |
|
228 | 228 | foreach ($module_list as $mid => $mname) { |
229 | - $mname = htmlspecialchars($mname) ; |
|
229 | + $mname = htmlspecialchars($mname); |
|
230 | 230 | if (in_array($mid, $selected_mids)) { |
231 | - $module_options .= "<option value='$mid' selected='selected'>$mname</option>\n" ; |
|
231 | + $module_options .= "<option value='$mid' selected='selected'>$mname</option>\n"; |
|
232 | 232 | } else { |
233 | - $module_options .= "<option value='$mid'>$mname</option>\n" ; |
|
233 | + $module_options .= "<option value='$mid'>$mname</option>\n"; |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | |
237 | 237 | $ret = " |
238 | 238 | <select name='bmodules[$bid][]' size='5' multiple='multiple'> |
239 | 239 | $module_options |
240 | - </select>" ; |
|
240 | + </select>"; |
|
241 | 241 | |
242 | - return $ret ; |
|
242 | + return $ret; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | |
@@ -252,41 +252,41 @@ discard block |
||
252 | 252 | // get selected targets |
253 | 253 | if (is_array(@$block_data['bgroup'])) { |
254 | 254 | // bgroup origined from request (preview etc.) |
255 | - $selected_gids = $block_data['bgroup'] ; |
|
255 | + $selected_gids = $block_data['bgroup']; |
|
256 | 256 | } else { |
257 | 257 | // origined from the table of `group_perm` |
258 | - $result = $this->db->query('SELECT gperm_groupid FROM ' . $this->db->prefix('group_permission') . " WHERE gperm_itemid='$bid' AND gperm_name='block_read'") ; |
|
258 | + $result = $this->db->query('SELECT gperm_groupid FROM '.$this->db->prefix('group_permission')." WHERE gperm_itemid='$bid' AND gperm_name='block_read'"); |
|
259 | 259 | $selected_gids = array(); |
260 | 260 | while (list($selected_gid) = $this->db->fetchRow($result)) { |
261 | 261 | $selected_gids[] = (int)$selected_gid; |
262 | 262 | } |
263 | 263 | if ($bid == 0 && empty($selected_gids)) { |
264 | - $selected_gids = $GLOBALS['xoopsUser']->getGroups() ; |
|
264 | + $selected_gids = $GLOBALS['xoopsUser']->getGroups(); |
|
265 | 265 | } |
266 | 266 | } |
267 | 267 | |
268 | 268 | // get all targets |
269 | - $group_handler =& xoops_gethandler('group'); |
|
270 | - $groups = $group_handler->getObjects() ; |
|
269 | + $group_handler = & xoops_gethandler('group'); |
|
270 | + $groups = $group_handler->getObjects(); |
|
271 | 271 | |
272 | 272 | // build options |
273 | - $group_options = '' ; |
|
273 | + $group_options = ''; |
|
274 | 274 | foreach ($groups as $group) { |
275 | - $gid = $group->getVar('groupid') ; |
|
276 | - $gname = $group->getVar('name', 's') ; |
|
275 | + $gid = $group->getVar('groupid'); |
|
276 | + $gname = $group->getVar('name', 's'); |
|
277 | 277 | if (in_array($gid, $selected_gids)) { |
278 | - $group_options .= "<option value='$gid' selected='selected'>$gname</option>\n" ; |
|
278 | + $group_options .= "<option value='$gid' selected='selected'>$gname</option>\n"; |
|
279 | 279 | } else { |
280 | - $group_options .= "<option value='$gid'>$gname</option>\n" ; |
|
280 | + $group_options .= "<option value='$gid'>$gname</option>\n"; |
|
281 | 281 | } |
282 | 282 | } |
283 | 283 | |
284 | 284 | $ret = " |
285 | 285 | <select name='bgroups[$bid][]' size='5' multiple='multiple'> |
286 | 286 | $group_options |
287 | - </select>" ; |
|
287 | + </select>"; |
|
288 | 288 | |
289 | - return $ret ; |
|
289 | + return $ret; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | $sseln = $ssel0 = $ssel1 = $ssel2 = $ssel3 = $ssel4 = ''; |
302 | 302 | $scoln = $scol0 = $scol1 = $scol2 = $scol3 = $scol4 = 'unselected'; |
303 | 303 | $stextbox = 'unselected'; |
304 | - $value4extra_side = '' ; |
|
304 | + $value4extra_side = ''; |
|
305 | 305 | |
306 | 306 | if ($visible != 1) { |
307 | 307 | $sseln = " checked='checked'"; |
@@ -311,27 +311,27 @@ discard block |
||
311 | 311 | case XOOPS_SIDEBLOCK_LEFT : |
312 | 312 | $ssel0 = " checked='checked'"; |
313 | 313 | $scol0 = 'selected'; |
314 | - break ; |
|
314 | + break; |
|
315 | 315 | case XOOPS_SIDEBLOCK_RIGHT : |
316 | 316 | $ssel1 = " checked='checked'"; |
317 | 317 | $scol1 = 'selected'; |
318 | - break ; |
|
318 | + break; |
|
319 | 319 | case XOOPS_CENTERBLOCK_LEFT : |
320 | 320 | $ssel2 = " checked='checked'"; |
321 | 321 | $scol2 = 'selected'; |
322 | - break ; |
|
322 | + break; |
|
323 | 323 | case XOOPS_CENTERBLOCK_RIGHT : |
324 | 324 | $ssel4 = " checked='checked'"; |
325 | 325 | $scol4 = 'selected'; |
326 | - break ; |
|
326 | + break; |
|
327 | 327 | case XOOPS_CENTERBLOCK_CENTER : |
328 | 328 | $ssel3 = " checked='checked'"; |
329 | 329 | $scol3 = 'selected'; |
330 | - break ; |
|
330 | + break; |
|
331 | 331 | default : |
332 | - $value4extra_side = $side ; |
|
332 | + $value4extra_side = $side; |
|
333 | 333 | $stextbox = 'selected'; |
334 | - break ; |
|
334 | + break; |
|
335 | 335 | } |
336 | 336 | } |
337 | 337 | |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | <div class='blockposition $scoln'> |
362 | 362 | <input type='radio' name='sides[$bid]' value='-1' class='blockposition' $sseln onclick='document.getElementById(\"extra_side_$bid\").value=-1;' /> |
363 | 363 | </div> |
364 | - <div style='float:"._GLOBAL_LEFT.";'>"._NONE . '</div> |
|
364 | + <div style='float:"._GLOBAL_LEFT.";'>"._NONE.'</div> |
|
365 | 365 | '; |
366 | 366 | } |
367 | 367 | |
@@ -369,58 +369,58 @@ discard block |
||
369 | 369 | // public |
370 | 370 | public function list_blocks() |
371 | 371 | { |
372 | - global $xoopsGTicket ; |
|
372 | + global $xoopsGTicket; |
|
373 | 373 | |
374 | 374 | // main query |
375 | - $sql = 'SELECT * FROM ' . $this->db->prefix('newblocks') . " WHERE mid='$this->target_mid' ORDER BY visible DESC,side,weight" ; |
|
376 | - $result = $this->db->query($sql) ; |
|
377 | - $block_arr = array() ; |
|
375 | + $sql = 'SELECT * FROM '.$this->db->prefix('newblocks')." WHERE mid='$this->target_mid' ORDER BY visible DESC,side,weight"; |
|
376 | + $result = $this->db->query($sql); |
|
377 | + $block_arr = array(); |
|
378 | 378 | //HACK by domifara |
379 | 379 | if (defined('XOOPS_CUBE_LEGACY')) { |
380 | - $handler =& xoops_gethandler('block');//add |
|
380 | + $handler = & xoops_gethandler('block'); //add |
|
381 | 381 | } |
382 | 382 | while ($myrow = $this->db->fetchArray($result)) { |
383 | 383 | |
384 | 384 | //HACK by domifara |
385 | 385 | if (defined('XOOPS_CUBE_LEGACY')) { |
386 | - $block_one =& $handler->create(false) ; |
|
386 | + $block_one = & $handler->create(false); |
|
387 | 387 | $block_one->assignVars($myrow); |
388 | - $block_arr[] =& $block_one ; |
|
388 | + $block_arr[] = & $block_one; |
|
389 | 389 | } else { |
390 | - $block_arr[] = new XoopsBlock($myrow) ; |
|
390 | + $block_arr[] = new XoopsBlock($myrow); |
|
391 | 391 | } |
392 | 392 | } |
393 | 393 | if (empty($block_arr)) { |
394 | - return ; |
|
394 | + return; |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | // blocks rendering loop |
398 | - $blocks4assign = array() ; |
|
398 | + $blocks4assign = array(); |
|
399 | 399 | foreach ($block_arr as $i => $block) { |
400 | 400 | $block_data = array( |
401 | 401 | 'bid' => (int)$block->getVar('bid'), |
402 | - 'name' => $block->getVar('name', 'n') , |
|
403 | - 'title' => $block->getVar('title', 'n') , |
|
402 | + 'name' => $block->getVar('name', 'n'), |
|
403 | + 'title' => $block->getVar('title', 'n'), |
|
404 | 404 | 'weight' => (int)$block->getVar('weight'), |
405 | 405 | 'bcachetime' => (int)$block->getVar('bcachetime'), |
406 | 406 | 'side' => (int)$block->getVar('side'), |
407 | 407 | 'visible' => (int)$block->getVar('visible'), |
408 | - 'can_edit' => $this->canEdit($block) , |
|
409 | - 'can_delete' => $this->canDelete($block) , |
|
408 | + 'can_edit' => $this->canEdit($block), |
|
409 | + 'can_delete' => $this->canDelete($block), |
|
410 | 410 | 'can_clone' => $this->canClone($block) |
411 | - ) ; |
|
411 | + ); |
|
412 | 412 | $blocks4assign[] = array( |
413 | - 'name_raw' => $block_data['name'] , |
|
414 | - 'title_raw' => $block_data['title'] , |
|
415 | - 'cell_position' => $this->renderCell4BlockPosition($block_data) , |
|
416 | - 'cell_module_link' => $this->renderCell4BlockModuleLink($block_data) , |
|
413 | + 'name_raw' => $block_data['name'], |
|
414 | + 'title_raw' => $block_data['title'], |
|
415 | + 'cell_position' => $this->renderCell4BlockPosition($block_data), |
|
416 | + 'cell_module_link' => $this->renderCell4BlockModuleLink($block_data), |
|
417 | 417 | 'cell_group_perm' => $this->renderCell4BlockReadGroupPerm($block_data) |
418 | - ) + $block_data ; |
|
418 | + ) + $block_data; |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | // display |
422 | - require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ; |
|
423 | - $tpl = new D3Tpl() ; |
|
422 | + require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php'; |
|
423 | + $tpl = new D3Tpl(); |
|
424 | 424 | $tpl->assign(array( |
425 | 425 | 'target_mid' => $this->target_mid, |
426 | 426 | 'target_dirname' => $this->target_dirname, |
@@ -429,22 +429,22 @@ discard block |
||
429 | 429 | 'cachetime_options' => $this->cachetime_options, |
430 | 430 | 'blocks' => $blocks4assign, |
431 | 431 | 'gticket_hidden' => $xoopsGTicket->getTicketHtml(__LINE__, 1800, 'myblocksadmin') |
432 | - )) ; |
|
433 | - $tpl->display('db:altsys_main_myblocksadmin_list.html') ; |
|
432 | + )); |
|
433 | + $tpl->display('db:altsys_main_myblocksadmin_list.html'); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | |
437 | 437 | public function get_block_configs() |
438 | 438 | { |
439 | 439 | if ($this->target_mid <= 0) { |
440 | - return array() ; |
|
440 | + return array(); |
|
441 | 441 | } |
442 | - include XOOPS_ROOT_PATH.'/modules/'.$this->target_dirname.'/xoops_version.php' ; |
|
442 | + include XOOPS_ROOT_PATH.'/modules/'.$this->target_dirname.'/xoops_version.php'; |
|
443 | 443 | |
444 | 444 | if (empty($modversion['blocks'])) { |
445 | - return array() ; |
|
445 | + return array(); |
|
446 | 446 | } else { |
447 | - return $modversion['blocks'] ; |
|
447 | + return $modversion['blocks']; |
|
448 | 448 | } |
449 | 449 | } |
450 | 450 | |
@@ -452,51 +452,51 @@ discard block |
||
452 | 452 | public function list_groups() |
453 | 453 | { |
454 | 454 | // query for getting blocks |
455 | - $sql = 'SELECT * FROM ' . $this->db->prefix('newblocks') . " WHERE mid='$this->target_mid' ORDER BY visible DESC,side,weight" ; |
|
456 | - $result = $this->db->query($sql) ; |
|
457 | - $block_arr = array() ; |
|
455 | + $sql = 'SELECT * FROM '.$this->db->prefix('newblocks')." WHERE mid='$this->target_mid' ORDER BY visible DESC,side,weight"; |
|
456 | + $result = $this->db->query($sql); |
|
457 | + $block_arr = array(); |
|
458 | 458 | //HACK by domifara |
459 | 459 | if (defined('XOOPS_CUBE_LEGACY')) { |
460 | - $handler =& xoops_gethandler('block');//add |
|
460 | + $handler = & xoops_gethandler('block'); //add |
|
461 | 461 | } |
462 | 462 | while ($myrow = $this->db->fetchArray($result)) { |
463 | 463 | //HACK by domifara |
464 | 464 | if (defined('XOOPS_CUBE_LEGACY')) { |
465 | - $block_one =& $handler->create(false) ; |
|
465 | + $block_one = & $handler->create(false); |
|
466 | 466 | $block_one->assignVars($myrow); |
467 | - $block_arr[] =& $block_one ; |
|
467 | + $block_arr[] = & $block_one; |
|
468 | 468 | } else { |
469 | - $block_arr[] = new XoopsBlock($myrow) ; |
|
469 | + $block_arr[] = new XoopsBlock($myrow); |
|
470 | 470 | } |
471 | 471 | } |
472 | 472 | |
473 | - $item_list = array() ; |
|
473 | + $item_list = array(); |
|
474 | 474 | foreach (array_keys($block_arr) as $i) { |
475 | - $item_list[ $block_arr[$i]->getVar('bid') ] = $block_arr[$i]->getVar('title') ; |
|
475 | + $item_list[$block_arr[$i]->getVar('bid')] = $block_arr[$i]->getVar('title'); |
|
476 | 476 | } |
477 | 477 | |
478 | - $form = new MyXoopsGroupPermForm(_MD_A_MYBLOCKSADMIN_PERMFORM, 1, 'block_read', '') ; |
|
478 | + $form = new MyXoopsGroupPermForm(_MD_A_MYBLOCKSADMIN_PERMFORM, 1, 'block_read', ''); |
|
479 | 479 | // skip system (TODO) |
480 | 480 | if ($this->target_mid > 1) { |
481 | - $form->addAppendix('module_admin', $this->target_mid, $this->target_mname . ' ' . _MD_A_MYBLOCKSADMIN_PERM_MADMIN) ; |
|
482 | - $form->addAppendix('module_read', $this->target_mid, $this->target_mname .' ' . _MD_A_MYBLOCKSADMIN_PERM_MREAD) ; |
|
481 | + $form->addAppendix('module_admin', $this->target_mid, $this->target_mname.' '._MD_A_MYBLOCKSADMIN_PERM_MADMIN); |
|
482 | + $form->addAppendix('module_read', $this->target_mid, $this->target_mname.' '._MD_A_MYBLOCKSADMIN_PERM_MREAD); |
|
483 | 483 | } |
484 | 484 | foreach ($item_list as $item_id => $item_name) { |
485 | - $form->addItem($item_id, $item_name) ; |
|
485 | + $form->addItem($item_id, $item_name); |
|
486 | 486 | } |
487 | - echo $form->render() ; |
|
487 | + echo $form->render(); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | |
491 | - public function update_block($bid, $bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bcachetime, $options=array()) |
|
491 | + public function update_block($bid, $bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bcachetime, $options = array()) |
|
492 | 492 | { |
493 | 493 | global $xoopsConfig; |
494 | 494 | |
495 | 495 | //HACK by domifara |
496 | 496 | if (defined('XOOPS_CUBE_LEGACY')) { |
497 | - $handler =& xoops_gethandler('block'); |
|
498 | - $block =& $handler->create(false) ; |
|
499 | - $block->load($bid) ; |
|
497 | + $handler = & xoops_gethandler('block'); |
|
498 | + $block = & $handler->create(false); |
|
499 | + $block->load($bid); |
|
500 | 500 | } else { |
501 | 501 | $block = new XoopsBlock($bid); |
502 | 502 | } |
@@ -515,10 +515,10 @@ discard block |
||
515 | 515 | } |
516 | 516 | $block->setVar('bcachetime', $bcachetime); |
517 | 517 | if (is_array($options) && count($options) > 0) { |
518 | - $block->setVar('options', implode('|', $options)) ; |
|
518 | + $block->setVar('options', implode('|', $options)); |
|
519 | 519 | } |
520 | 520 | if ($block->getVar('block_type') == 'C') { |
521 | - $name = $this->get_blockname_from_ctype($block->getVar('c_type')) ; |
|
521 | + $name = $this->get_blockname_from_ctype($block->getVar('c_type')); |
|
522 | 522 | $block->setVar('name', $name); |
523 | 523 | } |
524 | 524 | $msg = _MD_A_MYBLOCKSADMIN_DBUPDATED; |
@@ -542,14 +542,14 @@ discard block |
||
542 | 542 | } else { |
543 | 543 | $msg = 'Failed update of block. ID:'.$bid; |
544 | 544 | } |
545 | - return $msg ; |
|
545 | + return $msg; |
|
546 | 546 | } |
547 | 547 | |
548 | 548 | |
549 | 549 | // virtual |
550 | 550 | public function updateBlockModuleLink($bid, $bmodules) |
551 | 551 | { |
552 | -<<<<<<< HEAD |
|
552 | +<< << <<< HEAD |
|
553 | 553 | $bid = intval($bid) ; |
554 | 554 | $table = $this->db->prefix('block_module_link') ; |
555 | 555 | ======= |
@@ -1085,8 +1085,4 @@ discard block |
||
1085 | 1085 | // the first form (blocks) |
1086 | 1086 | $this->list_blocks() ; |
1087 | 1087 | // the second form (groups) |
1088 | - $this->list_groups() ; |
|
1089 | - break ; |
|
1090 | - } |
|
1091 | - } |
|
1092 | -} |
|
1088 | + $this->list_groups |
|
1093 | 1089 | \ No newline at end of file |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // $Id: MyBlocksAdminForXCL21.class.php ,ver 0.0.7.1 2011/01/27 16:10:00 domifara Exp $ |
3 | 3 | |
4 | -require_once __DIR__.'/MyBlocksAdmin.class.php' ; |
|
4 | +require_once __DIR__.'/MyBlocksAdmin.class.php'; |
|
5 | 5 | |
6 | 6 | class MyBlocksAdminForXCL21 extends MyBlocksAdmin |
7 | 7 | { |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | static $instance; |
19 | 19 | if (!isset($instance)) { |
20 | 20 | $instance = new MyBlocksAdminForXCL21(); |
21 | - $instance->construct() ; |
|
21 | + $instance->construct(); |
|
22 | 22 | } |
23 | 23 | return $instance; |
24 | 24 | } |
@@ -29,24 +29,24 @@ discard block |
||
29 | 29 | public function renderCell4BlockOptions($block_data) |
30 | 30 | { |
31 | 31 | if ($this->target_dirname && substr($this->target_dirname, 0, 1) != '_') { |
32 | - $langman =& D3LanguageManager::getInstance() ; |
|
33 | - $langman->read('admin.php', $this->target_dirname) ; |
|
32 | + $langman = & D3LanguageManager::getInstance(); |
|
33 | + $langman->read('admin.php', $this->target_dirname); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | $bid = (int)$block_data['bid']; |
37 | 37 | |
38 | 38 | //HACK by domifara |
39 | 39 | // $block = new XoopsBlock( $bid ) ; |
40 | - $handler =& xoops_gethandler('block'); |
|
41 | - $block =& $handler->create(false) ; |
|
42 | - $block->load($bid) ; |
|
40 | + $handler = & xoops_gethandler('block'); |
|
41 | + $block = & $handler->create(false); |
|
42 | + $block->load($bid); |
|
43 | 43 | |
44 | - $legacy_block =& Legacy_Utils::createBlockProcedure($block) ; |
|
45 | - return $legacy_block->getOptionForm() ; |
|
44 | + $legacy_block = & Legacy_Utils::createBlockProcedure($block); |
|
45 | + return $legacy_block->getOptionForm(); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | public function checkFck() |
49 | 49 | { |
50 | - return (! altsysUtils::isInstalledXclHtmleditor() && file_exists(XOOPS_ROOT_PATH.'/common/fckeditor/fckeditor.js')); |
|
50 | + return (!altsysUtils::isInstalledXclHtmleditor() && file_exists(XOOPS_ROOT_PATH.'/common/fckeditor/fckeditor.js')); |
|
51 | 51 | } |
52 | 52 | } |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! defined('XOOPS_ROOT_PATH')) { |
|
4 | - exit ; |
|
3 | +if (!defined('XOOPS_ROOT_PATH')) { |
|
4 | + exit; |
|
5 | 5 | } |
6 | 6 | |
7 | -if (! defined('XOOPS_TRUST_PATH') || XOOPS_TRUST_PATH == '') { |
|
8 | - header('Location: '.XOOPS_URL.'/modules/altsys/setup_xoops_trust_path.php') ; |
|
9 | - exit ; |
|
7 | +if (!defined('XOOPS_TRUST_PATH') || XOOPS_TRUST_PATH == '') { |
|
8 | + header('Location: '.XOOPS_URL.'/modules/altsys/setup_xoops_trust_path.php'); |
|
9 | + exit; |
|
10 | 10 | } |
11 | 11 | |
12 | -define('ALTSYS_MYLANGUAGE_ROOT_PATH', XOOPS_ROOT_PATH . '/my_language'); |
|
12 | +define('ALTSYS_MYLANGUAGE_ROOT_PATH', XOOPS_ROOT_PATH.'/my_language'); |
|
13 | 13 | |
14 | 14 | |
15 | 15 | class SetupAltsysLangMgr extends XCube_ActionFilter |
@@ -26,23 +26,23 @@ discard block |
||
26 | 26 | } |
27 | 27 | |
28 | 28 | |
29 | -require_once XOOPS_ROOT_PATH . '/core/XCube_LanguageManager.class.php'; |
|
30 | -require_once XOOPS_ROOT_PATH . '/modules/legacy/kernel/Legacy_LanguageManager.class.php'; |
|
29 | +require_once XOOPS_ROOT_PATH.'/core/XCube_LanguageManager.class.php'; |
|
30 | +require_once XOOPS_ROOT_PATH.'/modules/legacy/kernel/Legacy_LanguageManager.class.php'; |
|
31 | 31 | |
32 | 32 | class AltsysLangMgr_LanguageManager extends Legacy_LanguageManager |
33 | 33 | { |
34 | - public $langman = null ; |
|
35 | - public $theme_lang_checked = false ; |
|
34 | + public $langman = null; |
|
35 | + public $theme_lang_checked = false; |
|
36 | 36 | |
37 | 37 | public function prepare() |
38 | 38 | { |
39 | - $langmanpath = XOOPS_TRUST_PATH.'/libs/altsys/class/D3LanguageManager.class.php' ; |
|
40 | - if (! file_exists($langmanpath)) { |
|
41 | - die('install the latest altsys') ; |
|
39 | + $langmanpath = XOOPS_TRUST_PATH.'/libs/altsys/class/D3LanguageManager.class.php'; |
|
40 | + if (!file_exists($langmanpath)) { |
|
41 | + die('install the latest altsys'); |
|
42 | 42 | } |
43 | - require_once($langmanpath) ; |
|
44 | - $this->langman =& D3LanguageManager::getInstance() ; |
|
45 | - $this->langman->language = $this->mLanguageName ; |
|
43 | + require_once($langmanpath); |
|
44 | + $this->langman = & D3LanguageManager::getInstance(); |
|
45 | + $this->langman->language = $this->mLanguageName; |
|
46 | 46 | |
47 | 47 | parent::prepare(); |
48 | 48 | } |
@@ -50,40 +50,40 @@ discard block |
||
50 | 50 | public function _loadLanguage($dirname, $fileBodyName) |
51 | 51 | { |
52 | 52 | // read/check once (selected_theme)/language/(lang).php |
53 | - if (! $this->theme_lang_checked) { |
|
54 | - $root =& XCube_Root::getSingleton() ; |
|
55 | - if (! empty($root->mContext->mXoopsConfig['theme_set'])) { |
|
56 | - $langdir = XOOPS_THEME_PATH.'/'.$root->mContext->mXoopsConfig['theme_set'].'/language' ; |
|
53 | + if (!$this->theme_lang_checked) { |
|
54 | + $root = & XCube_Root::getSingleton(); |
|
55 | + if (!empty($root->mContext->mXoopsConfig['theme_set'])) { |
|
56 | + $langdir = XOOPS_THEME_PATH.'/'.$root->mContext->mXoopsConfig['theme_set'].'/language'; |
|
57 | 57 | if (file_exists($langdir)) { |
58 | - $langfile = $langdir.'/'.$this->mLanguageName.'.php' ; |
|
59 | - $engfile = $langdir.'/english.php' ; |
|
58 | + $langfile = $langdir.'/'.$this->mLanguageName.'.php'; |
|
59 | + $engfile = $langdir.'/english.php'; |
|
60 | 60 | if (file_exists($langfile)) { |
61 | - require_once $langfile ; |
|
61 | + require_once $langfile; |
|
62 | 62 | } elseif (file_exists($engfile)) { |
63 | - require_once $engfile ; |
|
63 | + require_once $engfile; |
|
64 | 64 | } |
65 | 65 | } |
66 | - $this->theme_lang_checked = true ; |
|
66 | + $this->theme_lang_checked = true; |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | 70 | // read normal |
71 | - $this->langman->read($fileBodyName.'.php', $dirname) ; |
|
71 | + $this->langman->read($fileBodyName.'.php', $dirname); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | public function loadPageTypeMessageCatalog($type) |
75 | 75 | { |
76 | 76 | // I dare not to use langman... |
77 | 77 | if (strpos($type, '.') === false && $this->langman->my_language) { |
78 | - $mylang_file = $this->langman->my_language.'/'.$this->mLanguageName.'/'.$type.'.php' ; |
|
78 | + $mylang_file = $this->langman->my_language.'/'.$this->mLanguageName.'/'.$type.'.php'; |
|
79 | 79 | if (file_exists($mylang_file)) { |
80 | - require_once $mylang_file ; |
|
80 | + require_once $mylang_file; |
|
81 | 81 | } |
82 | 82 | } |
83 | - $original_error_level = error_reporting() ; |
|
84 | - error_reporting($original_error_level & ~ E_NOTICE) ; |
|
83 | + $original_error_level = error_reporting(); |
|
84 | + error_reporting($original_error_level & ~ E_NOTICE); |
|
85 | 85 | parent::loadPageTypeMessageCatalog($type); |
86 | - error_reporting($original_error_level) ; |
|
86 | + error_reporting($original_error_level); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | public function loadGlobalMessageCatalog() |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | /* if (!$this->_loadFile(XOOPS_ROOT_PATH . "/modules/legacy/language/" . $this->mLanguageName . "/global.php")) { |
92 | 92 | $this->_loadFile(XOOPS_ROOT_PATH . "/modules/legacy/language/english/global.php"); |
93 | 93 | } */ |
94 | - $this->_loadLanguage('legacy', 'global') ; |
|
94 | + $this->_loadLanguage('legacy', 'global'); |
|
95 | 95 | |
96 | 96 | // |
97 | 97 | // Now, if XOOPS_USE_MULTIBYTES isn't defined, set zero to it. |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once __DIR__.'/MyBlocksAdmin.class.php' ; |
|
3 | +require_once __DIR__.'/MyBlocksAdmin.class.php'; |
|
4 | 4 | |
5 | 5 | class MyBlocksAdminForX22 extends MyBlocksAdmin |
6 | 6 | { |
@@ -12,9 +12,9 @@ discard block |
||
12 | 12 | |
13 | 13 | public function construct() |
14 | 14 | { |
15 | - parent::construct() ; |
|
15 | + parent::construct(); |
|
16 | 16 | |
17 | - @include_once XOOPS_ROOT_PATH.'/modules/system/language/'.$this->lang.'/admin/blocksadmin.php' ; |
|
17 | + @include_once XOOPS_ROOT_PATH.'/modules/system/language/'.$this->lang.'/admin/blocksadmin.php'; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | //HACK by domifara for php5.3+ |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | static $instance; |
25 | 25 | if (!isset($instance)) { |
26 | 26 | $instance = new MyBlocksAdminForX22(); |
27 | - $instance->construct() ; |
|
27 | + $instance->construct(); |
|
28 | 28 | } |
29 | 29 | return $instance; |
30 | 30 | } |
@@ -1,63 +1,63 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -eval(' function xoops_module_install_'.$mydirname.'( $module ) { return altsys_oninstall_base( $module , "'.$mydirname.'" ) ; } ') ; |
|
3 | +eval(' function xoops_module_install_'.$mydirname.'( $module ) { return altsys_oninstall_base( $module , "'.$mydirname.'" ) ; } '); |
|
4 | 4 | |
5 | 5 | |
6 | -if (! function_exists('altsys_oninstall_base')) { |
|
6 | +if (!function_exists('altsys_oninstall_base')) { |
|
7 | 7 | function altsys_oninstall_base($module, $mydirname) |
8 | 8 | { |
9 | 9 | // transations on module install |
10 | 10 | |
11 | - global $ret ; // TODO :-D |
|
11 | + global $ret; // TODO :-D |
|
12 | 12 | |
13 | 13 | // for Cube 2.1 |
14 | 14 | if (defined('XOOPS_CUBE_LEGACY')) { |
15 | - $root =& XCube_Root::getSingleton(); |
|
16 | - $root->mDelegateManager->add('Legacy.Admin.Event.ModuleInstall.' . ucfirst($mydirname) . '.Success', 'altsys_message_append_oninstall') ; |
|
17 | - $ret = array() ; |
|
15 | + $root = & XCube_Root::getSingleton(); |
|
16 | + $root->mDelegateManager->add('Legacy.Admin.Event.ModuleInstall.'.ucfirst($mydirname).'.Success', 'altsys_message_append_oninstall'); |
|
17 | + $ret = array(); |
|
18 | 18 | } else { |
19 | - if (! is_array($ret)) { |
|
20 | - $ret = array() ; |
|
19 | + if (!is_array($ret)) { |
|
20 | + $ret = array(); |
|
21 | 21 | } |
22 | 22 | } |
23 | 23 | |
24 | - $db =& XoopsDatabaseFactory::getDatabaseConnection() ; |
|
25 | - $mid = $module->getVar('mid') ; |
|
24 | + $db = & XoopsDatabaseFactory::getDatabaseConnection(); |
|
25 | + $mid = $module->getVar('mid'); |
|
26 | 26 | |
27 | 27 | /*************** BEGIN ALTSYS SPECIFIC PART ******************/ |
28 | 28 | // set weight=0 |
29 | - $db->queryF('UPDATE ' . $db->prefix('modules') . " SET weight=0 WHERE mid=$mid") ; |
|
29 | + $db->queryF('UPDATE '.$db->prefix('modules')." SET weight=0 WHERE mid=$mid"); |
|
30 | 30 | /*************** END ALTSYS SPECIFIC PART ******************/ |
31 | 31 | |
32 | 32 | // TABLES (loading mysql.sql) |
33 | - $sql_file_path = __DIR__.'/sql/mysql.sql' ; |
|
34 | - $prefix_mod = $db->prefix() . '_' . $mydirname ; |
|
33 | + $sql_file_path = __DIR__.'/sql/mysql.sql'; |
|
34 | + $prefix_mod = $db->prefix().'_'.$mydirname; |
|
35 | 35 | if (file_exists($sql_file_path)) { |
36 | - $ret[] = 'SQL file found at <b>' . htmlspecialchars($sql_file_path) . '</b>.<br /> Creating tables...'; |
|
36 | + $ret[] = 'SQL file found at <b>'.htmlspecialchars($sql_file_path).'</b>.<br /> Creating tables...'; |
|
37 | 37 | |
38 | 38 | if (file_exists(XOOPS_ROOT_PATH.'/class/database/oldsqlutility.php')) { |
39 | - include_once XOOPS_ROOT_PATH.'/class/database/oldsqlutility.php' ; |
|
40 | - $sqlutil = new OldSqlUtility ; |
|
39 | + include_once XOOPS_ROOT_PATH.'/class/database/oldsqlutility.php'; |
|
40 | + $sqlutil = new OldSqlUtility; |
|
41 | 41 | } else { |
42 | - include_once XOOPS_ROOT_PATH.'/class/database/sqlutility.php' ; |
|
43 | - $sqlutil = new SqlUtility ; |
|
42 | + include_once XOOPS_ROOT_PATH.'/class/database/sqlutility.php'; |
|
43 | + $sqlutil = new SqlUtility; |
|
44 | 44 | } |
45 | 45 | |
46 | - $sql_query = trim(file_get_contents($sql_file_path)) ; |
|
47 | - $sqlutil->splitMySqlFile($pieces, $sql_query) ; |
|
48 | - $created_tables = array() ; |
|
46 | + $sql_query = trim(file_get_contents($sql_file_path)); |
|
47 | + $sqlutil->splitMySqlFile($pieces, $sql_query); |
|
48 | + $created_tables = array(); |
|
49 | 49 | foreach ($pieces as $piece) { |
50 | - $prefixed_query = $sqlutil->prefixQuery($piece, $prefix_mod) ; |
|
51 | - if (! $prefixed_query) { |
|
52 | - $ret[] = 'Invalid SQL <b>' . htmlspecialchars($piece) . '</b><br />'; |
|
53 | - return false ; |
|
50 | + $prefixed_query = $sqlutil->prefixQuery($piece, $prefix_mod); |
|
51 | + if (!$prefixed_query) { |
|
52 | + $ret[] = 'Invalid SQL <b>'.htmlspecialchars($piece).'</b><br />'; |
|
53 | + return false; |
|
54 | 54 | } |
55 | - if (! $db->query($prefixed_query[0])) { |
|
56 | - $ret[] = '<b>'.htmlspecialchars($db->error()).'</b><br />' ; |
|
55 | + if (!$db->query($prefixed_query[0])) { |
|
56 | + $ret[] = '<b>'.htmlspecialchars($db->error()).'</b><br />'; |
|
57 | 57 | //var_dump( $db->error() ) ; |
58 | - return false ; |
|
58 | + return false; |
|
59 | 59 | } else { |
60 | - if (! in_array($prefixed_query[4], $created_tables)) { |
|
60 | + if (!in_array($prefixed_query[4], $created_tables)) { |
|
61 | 61 | $ret[] = 'Table <b>'.htmlspecialchars($prefix_mod.'_'.$prefixed_query[4]).'</b> created.<br />'; |
62 | 62 | $created_tables[] = $prefixed_query[4]; |
63 | 63 | } else { |
@@ -68,33 +68,33 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | // TEMPLATES |
71 | - $tplfile_handler =& xoops_gethandler('tplfile') ; |
|
72 | - $tpl_path = __DIR__.'/templates' ; |
|
73 | - if ($handler = @opendir($tpl_path . '/')) { |
|
71 | + $tplfile_handler = & xoops_gethandler('tplfile'); |
|
72 | + $tpl_path = __DIR__.'/templates'; |
|
73 | + if ($handler = @opendir($tpl_path.'/')) { |
|
74 | 74 | while (($file = readdir($handler)) !== false) { |
75 | 75 | if (substr($file, 0, 1) == '.') { |
76 | - continue ; |
|
76 | + continue; |
|
77 | 77 | } |
78 | - $file_path = $tpl_path . '/' . $file ; |
|
78 | + $file_path = $tpl_path.'/'.$file; |
|
79 | 79 | if (is_file($file_path)) { |
80 | 80 | $mtime = (int)(@filemtime($file_path)); |
81 | - $tplfile =& $tplfile_handler->create() ; |
|
82 | - $tplfile->setVar('tpl_source', file_get_contents($file_path), true) ; |
|
83 | - $tplfile->setVar('tpl_refid', $mid) ; |
|
84 | - $tplfile->setVar('tpl_tplset', 'default') ; |
|
85 | - $tplfile->setVar('tpl_file', $mydirname . '_' . $file) ; |
|
86 | - $tplfile->setVar('tpl_desc', '', true) ; |
|
87 | - $tplfile->setVar('tpl_module', $mydirname) ; |
|
88 | - $tplfile->setVar('tpl_lastmodified', $mtime) ; |
|
89 | - $tplfile->setVar('tpl_lastimported', 0) ; |
|
90 | - $tplfile->setVar('tpl_type', 'module') ; |
|
91 | - if (! $tplfile_handler->insert($tplfile)) { |
|
81 | + $tplfile = & $tplfile_handler->create(); |
|
82 | + $tplfile->setVar('tpl_source', file_get_contents($file_path), true); |
|
83 | + $tplfile->setVar('tpl_refid', $mid); |
|
84 | + $tplfile->setVar('tpl_tplset', 'default'); |
|
85 | + $tplfile->setVar('tpl_file', $mydirname.'_'.$file); |
|
86 | + $tplfile->setVar('tpl_desc', '', true); |
|
87 | + $tplfile->setVar('tpl_module', $mydirname); |
|
88 | + $tplfile->setVar('tpl_lastmodified', $mtime); |
|
89 | + $tplfile->setVar('tpl_lastimported', 0); |
|
90 | + $tplfile->setVar('tpl_type', 'module'); |
|
91 | + if (!$tplfile_handler->insert($tplfile)) { |
|
92 | 92 | $ret[] = '<span style="color:#ff0000;">ERROR: Could not insert template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> to the database.</span><br />'; |
93 | 93 | } else { |
94 | - $tplid = $tplfile->getVar('tpl_id') ; |
|
94 | + $tplid = $tplfile->getVar('tpl_id'); |
|
95 | 95 | $ret[] = 'Template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> added to the database. (ID: <b>'.$tplid.'</b>)<br />'; |
96 | - require_once XOOPS_TRUST_PATH.'/libs/altsys/include/altsys_functions.php' ; |
|
97 | - altsys_clear_templates_c() ; |
|
96 | + require_once XOOPS_TRUST_PATH.'/libs/altsys/include/altsys_functions.php'; |
|
97 | + altsys_clear_templates_c(); |
|
98 | 98 | // generate compiled file |
99 | 99 | /*include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; |
100 | 100 | include_once XOOPS_ROOT_PATH.'/class/template.php' ; |
@@ -106,20 +106,20 @@ discard block |
||
106 | 106 | } |
107 | 107 | } |
108 | 108 | } |
109 | - closedir($handler) ; |
|
109 | + closedir($handler); |
|
110 | 110 | } |
111 | - include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; |
|
112 | - include_once XOOPS_ROOT_PATH.'/class/template.php' ; |
|
113 | - xoops_template_clear_module_cache($mid) ; |
|
111 | + include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php'; |
|
112 | + include_once XOOPS_ROOT_PATH.'/class/template.php'; |
|
113 | + xoops_template_clear_module_cache($mid); |
|
114 | 114 | |
115 | - return true ; |
|
115 | + return true; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | function altsys_message_append_oninstall(&$module_obj, &$log) |
119 | 119 | { |
120 | 120 | if (is_array(@$GLOBALS['ret'])) { |
121 | 121 | foreach ($GLOBALS['ret'] as $message) { |
122 | - $log->add(strip_tags($message)) ; |
|
122 | + $log->add(strip_tags($message)); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 |
@@ -1,61 +1,61 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! defined('XOOPS_ROOT_PATH')) { |
|
4 | - exit ; |
|
3 | +if (!defined('XOOPS_ROOT_PATH')) { |
|
4 | + exit; |
|
5 | 5 | } |
6 | 6 | |
7 | -$core_type = altsys_get_core_type() ; |
|
8 | -$db =& XoopsDatabaseFactory::getDatabaseConnection() ; |
|
7 | +$core_type = altsys_get_core_type(); |
|
8 | +$db = & XoopsDatabaseFactory::getDatabaseConnection(); |
|
9 | 9 | |
10 | -$current_dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['dirname']) ; |
|
10 | +$current_dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['dirname']); |
|
11 | 11 | if ($current_dirname == '__CustomBlocks__') { |
12 | - return ; |
|
12 | + return; |
|
13 | 13 | } |
14 | 14 | |
15 | - $module_handler4menu =& xoops_gethandler('module'); |
|
15 | + $module_handler4menu = & xoops_gethandler('module'); |
|
16 | 16 | $criteria4menu = new CriteriaCompo(new Criteria('isactive', 1)); |
17 | 17 | //$criteria4menu->add(new Criteria('hasmain', 1)); |
18 | 18 | $criteria4menu->add(new Criteria('mid', '1', '>')); |
19 | - $modules4menu =& $module_handler4menu->getObjects($criteria4menu, true); |
|
20 | - $system_module =& $module_handler4menu->get(1) ; |
|
19 | + $modules4menu = & $module_handler4menu->getObjects($criteria4menu, true); |
|
20 | + $system_module = & $module_handler4menu->get(1); |
|
21 | 21 | if (is_object($system_module)) { |
22 | - array_unshift($modules4menu, $system_module) ; |
|
22 | + array_unshift($modules4menu, $system_module); |
|
23 | 23 | } |
24 | 24 | |
25 | -$adminmenu = array() ; |
|
25 | +$adminmenu = array(); |
|
26 | 26 | foreach ($modules4menu as $m4menu) { |
27 | 27 | // get block info |
28 | 28 | if ($core_type != ALTSYS_CORE_TYPE_X22) { |
29 | - list($block_count_all) = $db->fetchRow($db->query('SELECT COUNT(*) FROM ' . $db->prefix('newblocks') . ' WHERE mid=' . $m4menu->getVar('mid'))) ; |
|
30 | - list($block_count_visible) = $db->fetchRow($db->query('SELECT COUNT(*) FROM ' . $db->prefix('newblocks') . ' WHERE mid=' . $m4menu->getVar('mid') . ' AND visible>0')) ; |
|
29 | + list($block_count_all) = $db->fetchRow($db->query('SELECT COUNT(*) FROM '.$db->prefix('newblocks').' WHERE mid='.$m4menu->getVar('mid'))); |
|
30 | + list($block_count_visible) = $db->fetchRow($db->query('SELECT COUNT(*) FROM '.$db->prefix('newblocks').' WHERE mid='.$m4menu->getVar('mid').' AND visible>0')); |
|
31 | 31 | // $block_desc = " $block_count_all($block_count_visible)" ; |
32 | - $block_desc = " ($block_count_visible/$block_count_all)" ; |
|
32 | + $block_desc = " ($block_count_visible/$block_count_all)"; |
|
33 | 33 | } else { |
34 | - $block_desc = '' ; |
|
34 | + $block_desc = ''; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | if ($m4menu->getVar('dirname') == $current_dirname) { |
38 | 38 | $adminmenu[] = array( |
39 | - 'selected' => true , |
|
40 | - 'title' => $m4menu->getVar('name', 'n') . $block_desc , |
|
39 | + 'selected' => true, |
|
40 | + 'title' => $m4menu->getVar('name', 'n').$block_desc, |
|
41 | 41 | 'link' => '?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$m4menu->getVar('dirname', 'n') |
42 | - ) ; |
|
42 | + ); |
|
43 | 43 | //$GLOBALS['altsysXoopsBreadcrumbs'][] = array( 'name' => $m4menu->getVar('name') ) ; |
44 | 44 | } else { |
45 | 45 | $adminmenu[] = array( |
46 | - 'selected' => false , |
|
47 | - 'title' => $m4menu->getVar('name', 'n') . $block_desc , |
|
46 | + 'selected' => false, |
|
47 | + 'title' => $m4menu->getVar('name', 'n').$block_desc, |
|
48 | 48 | 'link' => '?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$m4menu->getVar('dirname', 'n') |
49 | - ) ; |
|
49 | + ); |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | 53 | |
54 | 54 | // display |
55 | -require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ; |
|
56 | -$tpl = new D3Tpl() ; |
|
55 | +require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php'; |
|
56 | +$tpl = new D3Tpl(); |
|
57 | 57 | $tpl->assign(array( |
58 | 58 | 'adminmenu' => $adminmenu, |
59 | 59 | 'mypage' => 'myblocksadmin' |
60 | -)) ; |
|
61 | -$tpl->display('db:altsys_inc_mymenusub.html') ; |
|
60 | +)); |
|
61 | +$tpl->display('db:altsys_inc_mymenusub.html'); |
@@ -1,37 +1,37 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! defined('XOOPS_ROOT_PATH')) { |
|
4 | - exit ; |
|
3 | +if (!defined('XOOPS_ROOT_PATH')) { |
|
4 | + exit; |
|
5 | 5 | } |
6 | 6 | |
7 | -$current_dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['dirname']) ; |
|
7 | +$current_dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['dirname']); |
|
8 | 8 | |
9 | -$db =& XoopsDatabaseFactory::getDatabaseConnection() ; |
|
10 | -$mrs = $db->query('SELECT m.name,m.dirname,COUNT(l.mid) FROM ' . $db->prefix('modules') . ' m LEFT JOIN ' . $db->prefix('altsys_language_constants') . ' l ON m.mid=l.mid WHERE m.isactive GROUP BY m.mid ORDER BY m.weight,m.mid') ; |
|
9 | +$db = & XoopsDatabaseFactory::getDatabaseConnection(); |
|
10 | +$mrs = $db->query('SELECT m.name,m.dirname,COUNT(l.mid) FROM '.$db->prefix('modules').' m LEFT JOIN '.$db->prefix('altsys_language_constants').' l ON m.mid=l.mid WHERE m.isactive GROUP BY m.mid ORDER BY m.weight,m.mid'); |
|
11 | 11 | |
12 | -$adminmenu = array() ; |
|
12 | +$adminmenu = array(); |
|
13 | 13 | while (list($name, $dirname, $count) = $db->fetchRow($mrs)) { |
14 | 14 | if ($dirname == $current_dirname) { |
15 | 15 | $adminmenu[] = array( |
16 | - 'selected' => true , |
|
17 | - 'title' => $name . " ($count)" , |
|
16 | + 'selected' => true, |
|
17 | + 'title' => $name." ($count)", |
|
18 | 18 | 'link' => '?mode=admin&lib=altsys&page=mylangadmin&dirname='.$dirname |
19 | - ) ; |
|
19 | + ); |
|
20 | 20 | //$GLOBALS['altsysXoopsBreadcrumbs'][] = array( 'name' => htmlspecialchars( $name , ENT_QUOTES ) ) ; |
21 | 21 | } else { |
22 | 22 | $adminmenu[] = array( |
23 | - 'selected' => false , |
|
24 | - 'title' => $name . " ($count)" , |
|
23 | + 'selected' => false, |
|
24 | + 'title' => $name." ($count)", |
|
25 | 25 | 'link' => '?mode=admin&lib=altsys&page=mylangadmin&dirname='.$dirname |
26 | - ) ; |
|
26 | + ); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 | |
30 | 30 | // display |
31 | -require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ; |
|
32 | -$tpl = new D3Tpl() ; |
|
31 | +require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php'; |
|
32 | +$tpl = new D3Tpl(); |
|
33 | 33 | $tpl->assign(array( |
34 | 34 | 'adminmenu' => $adminmenu, |
35 | 35 | 'mypage' => 'mylangadmin' |
36 | -)) ; |
|
37 | -$tpl->display('db:altsys_inc_mymenusub.html') ; |
|
36 | +)); |
|
37 | +$tpl->display('db:altsys_inc_mymenusub.html'); |
@@ -1,56 +1,56 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! defined('XOOPS_ROOT_PATH')) { |
|
4 | - exit ; |
|
3 | +if (!defined('XOOPS_ROOT_PATH')) { |
|
4 | + exit; |
|
5 | 5 | } |
6 | 6 | |
7 | -$current_dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['dirname']) ; |
|
7 | +$current_dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['dirname']); |
|
8 | 8 | |
9 | -$db =& XoopsDatabaseFactory::getDatabaseConnection() ; |
|
9 | +$db = & XoopsDatabaseFactory::getDatabaseConnection(); |
|
10 | 10 | |
11 | 11 | // get custom templates |
12 | -list($count) = $db->fetchRow($db->query('SELECT COUNT(t.tpl_module) AS tpl_count FROM ' . $db->prefix('tplfile') . " t WHERE t.tpl_type='custom'")) ; |
|
12 | +list($count) = $db->fetchRow($db->query('SELECT COUNT(t.tpl_module) AS tpl_count FROM '.$db->prefix('tplfile')." t WHERE t.tpl_type='custom'")); |
|
13 | 13 | if ($current_dirname == '_custom') { |
14 | 14 | // $GLOBALS['altsysXoopsBreadcrumbs'][] = array( 'name' => _MYTPLSADMIN_CUSTOMTEMPLATE ) ; |
15 | - $custom_selected = true ; |
|
15 | + $custom_selected = true; |
|
16 | 16 | } else { |
17 | - $custom_selected = false ; |
|
17 | + $custom_selected = false; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | $adminmenu = array( |
21 | 21 | array( |
22 | - 'selected' => $custom_selected , |
|
23 | - 'title' => _MYTPLSADMIN_CUSTOMTEMPLATE . " ($count)" , |
|
22 | + 'selected' => $custom_selected, |
|
23 | + 'title' => _MYTPLSADMIN_CUSTOMTEMPLATE." ($count)", |
|
24 | 24 | 'link' => '?mode=admin&lib=altsys&page=mytplsadmin&dirname=_custom' |
25 | 25 | ) |
26 | -) ; |
|
26 | +); |
|
27 | 27 | |
28 | 28 | // get modules/templates |
29 | -$mrs = $db->query('SELECT m.name,m.dirname,COUNT(t.tpl_module) AS tpl_count FROM ' . $db->prefix('modules') . ' m LEFT JOIN ' . $db->prefix('tplfile') . ' t ON m.dirname=t.tpl_module WHERE m.isactive GROUP BY m.mid HAVING tpl_count>0 ORDER BY m.weight,m.mid') ; |
|
29 | +$mrs = $db->query('SELECT m.name,m.dirname,COUNT(t.tpl_module) AS tpl_count FROM '.$db->prefix('modules').' m LEFT JOIN '.$db->prefix('tplfile').' t ON m.dirname=t.tpl_module WHERE m.isactive GROUP BY m.mid HAVING tpl_count>0 ORDER BY m.weight,m.mid'); |
|
30 | 30 | |
31 | 31 | // module loop |
32 | 32 | while (list($name, $dirname, $count) = $db->fetchRow($mrs)) { |
33 | 33 | if ($dirname == $current_dirname) { |
34 | 34 | $adminmenu[] = array( |
35 | - 'selected' => true , |
|
36 | - 'title' => $name . " ($count)" , |
|
35 | + 'selected' => true, |
|
36 | + 'title' => $name." ($count)", |
|
37 | 37 | 'link' => '?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$dirname |
38 | - ) ; |
|
38 | + ); |
|
39 | 39 | //$GLOBALS['altsysXoopsBreadcrumbs'][] = array( 'name' => htmlspecialchars( $name , ENT_QUOTES ) ) ; |
40 | 40 | } else { |
41 | 41 | $adminmenu[] = array( |
42 | - 'selected' => false , |
|
43 | - 'title' => $name . " ($count)" , |
|
42 | + 'selected' => false, |
|
43 | + 'title' => $name." ($count)", |
|
44 | 44 | 'link' => '?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$dirname |
45 | - ) ; |
|
45 | + ); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | 49 | // display |
50 | -require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ; |
|
51 | -$tpl = new D3Tpl() ; |
|
50 | +require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php'; |
|
51 | +$tpl = new D3Tpl(); |
|
52 | 52 | $tpl->assign(array( |
53 | 53 | 'adminmenu' => $adminmenu, |
54 | 54 | 'mypage' => 'mytplsadmin' |
55 | -)) ; |
|
56 | -$tpl->display('db:altsys_inc_mymenusub.html') ; |
|
55 | +)); |
|
56 | +$tpl->display('db:altsys_inc_mymenusub.html'); |