@@ -1,11 +1,11 @@ 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 MyBlocksAdminForICMS extends MyBlocksAdmin |
6 | 6 | { |
7 | 7 | |
8 | - public $block_positions = array() ; |
|
8 | + public $block_positions = array(); |
|
9 | 9 | |
10 | 10 | public function MyBlocksAadminForICMS() |
11 | 11 | { |
@@ -14,14 +14,14 @@ discard block |
||
14 | 14 | |
15 | 15 | public function construct() |
16 | 16 | { |
17 | - parent::construct() ; |
|
17 | + parent::construct(); |
|
18 | 18 | |
19 | - @include_once XOOPS_ROOT_PATH.'/modules/system/language/'.$this->lang.'/admin/blocksadmin.php' ; |
|
20 | - $result = $this->db->query('SELECT id,pname,title FROM ' . $this->db->prefix('block_positions')) ; |
|
19 | + @include_once XOOPS_ROOT_PATH.'/modules/system/language/'.$this->lang.'/admin/blocksadmin.php'; |
|
20 | + $result = $this->db->query('SELECT id,pname,title FROM '.$this->db->prefix('block_positions')); |
|
21 | 21 | while (list($id, $pname, $title) = $this->db->fetchRow($result)) { |
22 | - $this->block_positions[ $id ] = defined($title) ? constant($title) : $title ; |
|
22 | + $this->block_positions[$id] = defined($title) ? constant($title) : $title; |
|
23 | 23 | } |
24 | - $this->block_positions[ -1 ] = _NONE ; |
|
24 | + $this->block_positions[ -1] = _NONE; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | //HACK by domifara for php5.3+ |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | static $instance; |
32 | 32 | if (!isset($instance)) { |
33 | 33 | $instance = new MyBlocksAdminForICMS(); |
34 | - $instance->construct() ; |
|
34 | + $instance->construct(); |
|
35 | 35 | } |
36 | 36 | return $instance; |
37 | 37 | } |
@@ -46,23 +46,23 @@ discard block |
||
46 | 46 | // get selected targets |
47 | 47 | if (is_array(@$block_data['bmodule'])) { |
48 | 48 | // bmodule origined from request (preview etc.) |
49 | - $selected_pages = $block_data['bmodule'] ; |
|
49 | + $selected_pages = $block_data['bmodule']; |
|
50 | 50 | } else { |
51 | 51 | // origined from the table of `block_module_link` |
52 | - $result = $this->db->query('SELECT module_id,page_id FROM ' . $this->db->prefix('block_module_link') . " WHERE block_id='$bid'") ; |
|
52 | + $result = $this->db->query('SELECT module_id,page_id FROM '.$this->db->prefix('block_module_link')." WHERE block_id='$bid'"); |
|
53 | 53 | $selected_pages = array(); |
54 | 54 | while (list($mid, $pid) = $this->db->fetchRow($result)) { |
55 | - $selected_pages[] = (int)$mid . '-' . (int)$pid; |
|
55 | + $selected_pages[] = (int)$mid.'-'.(int)$pid; |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | 59 | $page_handler = xoops_gethandler('page'); |
60 | 60 | $ret = " |
61 | 61 | <select name='bmodules[$bid][]' size='5' multiple='multiple'> |
62 | - ".$page_handler->getPageSelOptions($selected_pages) . ' |
|
62 | + ".$page_handler->getPageSelOptions($selected_pages).' |
|
63 | 63 | </select>'; |
64 | 64 | |
65 | - return $ret ; |
|
65 | + return $ret; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -73,19 +73,19 @@ discard block |
||
73 | 73 | return " |
74 | 74 | <table> |
75 | 75 | <tr> |
76 | - <td rowspan='2'>".$this->renderRadio4BlockPosition(1, $block_data) . '</td> |
|
77 | - <td>' . $this->renderRadio4BlockPosition(3, $block_data) . '</td> |
|
78 | - <td>' . $this->renderRadio4BlockPosition(4, $block_data) . '</td> |
|
79 | - <td>' . $this->renderRadio4BlockPosition(5, $block_data) . "</td> |
|
80 | - <td rowspan='2'>".$this->renderRadio4BlockPosition(2, $block_data) . '</td> |
|
76 | + <td rowspan='2'>".$this->renderRadio4BlockPosition(1, $block_data).'</td> |
|
77 | + <td>' . $this->renderRadio4BlockPosition(3, $block_data).'</td> |
|
78 | + <td>' . $this->renderRadio4BlockPosition(4, $block_data).'</td> |
|
79 | + <td>' . $this->renderRadio4BlockPosition(5, $block_data)."</td> |
|
80 | + <td rowspan='2'>".$this->renderRadio4BlockPosition(2, $block_data).'</td> |
|
81 | 81 | </tr> |
82 | 82 | <tr> |
83 | - <td>' . $this->renderRadio4BlockPosition(6, $block_data) . '</td> |
|
84 | - <td>' . $this->renderRadio4BlockPosition(7, $block_data) . '</td> |
|
85 | - <td>' . $this->renderRadio4BlockPosition(8, $block_data) . "</td> |
|
83 | + <td>' . $this->renderRadio4BlockPosition(6, $block_data).'</td> |
|
84 | + <td>' . $this->renderRadio4BlockPosition(7, $block_data).'</td> |
|
85 | + <td>' . $this->renderRadio4BlockPosition(8, $block_data)."</td> |
|
86 | 86 | </tr> |
87 | 87 | <tr> |
88 | - <td colspan='5'>".$this->renderRadio4BlockPositions($block_data, array(1, 2, 3, 4, 5, 6, 7, 8)) . '</td> |
|
88 | + <td colspan='5'>".$this->renderRadio4BlockPositions($block_data, array(1, 2, 3, 4, 5, 6, 7, 8)).'</td> |
|
89 | 89 | </tr> |
90 | 90 | </table>'; |
91 | 91 | } |
@@ -96,19 +96,19 @@ discard block |
||
96 | 96 | { |
97 | 97 | $bid = (int)$block_data['bid']; |
98 | 98 | $visible = (int)$block_data['visible']; |
99 | - $current_side = $visible ? (int)$block_data['side'] : -1 ; |
|
99 | + $current_side = $visible ? (int)$block_data['side'] : -1; |
|
100 | 100 | |
101 | - $label4disp = htmlspecialchars($this->block_positions[ $target_side ], ENT_QUOTES) ; |
|
101 | + $label4disp = htmlspecialchars($this->block_positions[$target_side], ENT_QUOTES); |
|
102 | 102 | |
103 | 103 | if ($current_side == $target_side) { |
104 | - $checked = "checked='checked'" ; |
|
104 | + $checked = "checked='checked'"; |
|
105 | 105 | $divstyle = $target_side == -1 ? 'disabled' : 'selected'; |
106 | 106 | } else { |
107 | 107 | $checked = ''; |
108 | 108 | $divstyle = 'unselected'; |
109 | 109 | } |
110 | 110 | |
111 | - return "<div class='blockposition $divstyle' title='$label4disp'><input type='radio' name='sides[$bid]' value='$target_side' class='blockposition' $checked /></div>" ; |
|
111 | + return "<div class='blockposition $divstyle' title='$label4disp'><input type='radio' name='sides[$bid]' value='$target_side' class='blockposition' $checked /></div>"; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
@@ -117,28 +117,28 @@ discard block |
||
117 | 117 | { |
118 | 118 | $bid = (int)$block_data['bid']; |
119 | 119 | $visible = (int)$block_data['visible']; |
120 | - $current_side = $visible ? (int)$block_data['side'] : -1 ; |
|
120 | + $current_side = $visible ? (int)$block_data['side'] : -1; |
|
121 | 121 | |
122 | - $ret = '' ; |
|
122 | + $ret = ''; |
|
123 | 123 | foreach ($this->block_positions as $target_side => $label) { |
124 | 124 | if (in_array($target_side, $skip_sides)) { |
125 | - continue ; |
|
125 | + continue; |
|
126 | 126 | } |
127 | 127 | |
128 | - $label4disp = htmlspecialchars($label, ENT_QUOTES) ; |
|
128 | + $label4disp = htmlspecialchars($label, ENT_QUOTES); |
|
129 | 129 | |
130 | 130 | if ($current_side == $target_side) { |
131 | - $checked = "checked='checked'" ; |
|
131 | + $checked = "checked='checked'"; |
|
132 | 132 | $divstyle = $target_side == -1 ? 'disabled' : 'selected'; |
133 | 133 | } else { |
134 | 134 | $checked = ''; |
135 | 135 | $divstyle = 'unselected'; |
136 | 136 | } |
137 | 137 | |
138 | - $ret .= "<div style='clear:both;'><div class='blockposition $divstyle' title='$label4disp'><input type='radio' name='sides[$bid]' id='sides_{$bid}_{$target_side}' value='$target_side' class='blockposition' $checked /></div><label for='sides_{$bid}_{$target_side}'>$label4disp</label></label></div>" ; |
|
138 | + $ret .= "<div style='clear:both;'><div class='blockposition $divstyle' title='$label4disp'><input type='radio' name='sides[$bid]' id='sides_{$bid}_{$target_side}' value='$target_side' class='blockposition' $checked /></div><label for='sides_{$bid}_{$target_side}'>$label4disp</label></label></div>"; |
|
139 | 139 | } |
140 | 140 | |
141 | - return $ret ; |
|
141 | + return $ret; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | |
@@ -146,16 +146,16 @@ discard block |
||
146 | 146 | public function updateBlockModuleLink($bid, $bmodules) |
147 | 147 | { |
148 | 148 | $bid = (int)$bid; |
149 | - $table = $this->db->prefix('block_module_link') ; |
|
149 | + $table = $this->db->prefix('block_module_link'); |
|
150 | 150 | |
151 | - $sql = "DELETE FROM `$table` WHERE `block_id`=$bid" ; |
|
152 | - $this->db->query($sql) ; |
|
151 | + $sql = "DELETE FROM `$table` WHERE `block_id`=$bid"; |
|
152 | + $this->db->query($sql); |
|
153 | 153 | foreach ($bmodules as $mid) { |
154 | - $regs = explode('-', $mid) ; |
|
154 | + $regs = explode('-', $mid); |
|
155 | 155 | $module_id = (int)(@$regs[0]); |
156 | 156 | $page_id = (int)(@$regs[1]); |
157 | - $sql = "INSERT INTO `$table` (`block_id`,`module_id`,`page_id`) VALUES ($bid,$module_id,$page_id)" ; |
|
158 | - $this->db->query($sql) ; |
|
157 | + $sql = "INSERT INTO `$table` (`block_id`,`module_id`,`page_id`) VALUES ($bid,$module_id,$page_id)"; |
|
158 | + $this->db->query($sql); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | } |
@@ -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 MyBlocksAdminForX25 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 MyBlocksAdminForX25(); |
27 | - $instance->construct() ; |
|
27 | + $instance->construct(); |
|
28 | 28 | } |
29 | 29 | return $instance; |
30 | 30 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $sseln = $ssel0 = $ssel1 = $ssel3 = $ssel4 = $ssel5 = $ssel7 = $ssel8 = $ssel9 = ''; |
41 | 41 | $scoln = $scol0 = $scol1 = $scol3 = $scol4 = $scol5 = $scol7 = $scol8 = $scol9 = 'unselected'; |
42 | 42 | $stextbox = 'unselected'; |
43 | - $value4extra_side = '' ; |
|
43 | + $value4extra_side = ''; |
|
44 | 44 | |
45 | 45 | if ($visible != 1) { |
46 | 46 | $sseln = " checked='checked'"; |
@@ -50,39 +50,39 @@ discard block |
||
50 | 50 | case XOOPS_SIDEBLOCK_LEFT : |
51 | 51 | $ssel0 = " checked='checked'"; |
52 | 52 | $scol0 = 'selected'; |
53 | - break ; |
|
53 | + break; |
|
54 | 54 | case XOOPS_SIDEBLOCK_RIGHT : |
55 | 55 | $ssel1 = " checked='checked'"; |
56 | 56 | $scol1 = 'selected'; |
57 | - break ; |
|
57 | + break; |
|
58 | 58 | case XOOPS_CENTERBLOCK_LEFT : |
59 | 59 | $ssel3 = " checked='checked'"; |
60 | 60 | $scol3 = 'selected'; |
61 | - break ; |
|
61 | + break; |
|
62 | 62 | case XOOPS_CENTERBLOCK_RIGHT : |
63 | 63 | $ssel4 = " checked='checked'"; |
64 | 64 | $scol4 = 'selected'; |
65 | - break ; |
|
65 | + break; |
|
66 | 66 | case XOOPS_CENTERBLOCK_CENTER : |
67 | 67 | $ssel5 = " checked='checked'"; |
68 | 68 | $scol5 = 'selected'; |
69 | - break ; |
|
69 | + break; |
|
70 | 70 | case XOOPS_CENTERBLOCK_BOTTOMLEFT : |
71 | 71 | $ssel7 = " checked='checked'"; |
72 | 72 | $scol7 = 'selected'; |
73 | - break ; |
|
73 | + break; |
|
74 | 74 | case XOOPS_CENTERBLOCK_BOTTOMRIGHT : |
75 | 75 | $ssel8 = " checked='checked'"; |
76 | 76 | $scol8 = 'selected'; |
77 | - break ; |
|
77 | + break; |
|
78 | 78 | case XOOPS_CENTERBLOCK_BOTTOM : |
79 | 79 | $ssel9 = " checked='checked'"; |
80 | 80 | $scol9 = 'selected'; |
81 | - break ; |
|
81 | + break; |
|
82 | 82 | default : |
83 | - $value4extra_side = $side ; |
|
83 | + $value4extra_side = $side; |
|
84 | 84 | $stextbox = 'selected'; |
85 | - break ; |
|
85 | + break; |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | <div class='blockposition $scoln'> |
144 | 144 | <input type='radio' name='sides[$bid]' value='-1' class='blockposition' $sseln onclick='document.getElementById(\"extra_side_$bid\").value=-1;' /> |
145 | 145 | </div> |
146 | - <div style='float:"._GLOBAL_LEFT.";'>"._NONE . '</div> |
|
146 | + <div style='float:"._GLOBAL_LEFT.";'>"._NONE.'</div> |
|
147 | 147 | </td> |
148 | 148 | </tr> |
149 | 149 | </table> |
@@ -155,53 +155,53 @@ discard block |
||
155 | 155 | $bid = (int)$bid; |
156 | 156 | |
157 | 157 | //HACK by domifara |
158 | - $block = new XoopsBlock($bid) ; |
|
158 | + $block = new XoopsBlock($bid); |
|
159 | 159 | |
160 | - if (! $block->getVar('bid')) { |
|
160 | + if (!$block->getVar('bid')) { |
|
161 | 161 | // new defaults |
162 | - $bid = 0 ; |
|
163 | - $mode = 'new' ; |
|
164 | - $block->setVar('mid', 0) ; |
|
165 | - $block->setVar('block_type', 'C') ; |
|
162 | + $bid = 0; |
|
163 | + $mode = 'new'; |
|
164 | + $block->setVar('mid', 0); |
|
165 | + $block->setVar('block_type', 'C'); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | switch ($mode) { |
169 | 169 | case 'clone' : |
170 | - $form_title = _MD_A_MYBLOCKSADMIN_CLONEFORM ; |
|
171 | - $button_value = _MD_A_MYBLOCKSADMIN_BTN_CLONE ; |
|
172 | - $next_op = 'clone_ok' ; |
|
170 | + $form_title = _MD_A_MYBLOCKSADMIN_CLONEFORM; |
|
171 | + $button_value = _MD_A_MYBLOCKSADMIN_BTN_CLONE; |
|
172 | + $next_op = 'clone_ok'; |
|
173 | 173 | // breadcrumbs |
174 | - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; |
|
175 | - $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_CLONEFORM) ; |
|
176 | - break ; |
|
174 | + $breadcrumbsObj = & AltsysBreadcrumbs::getInstance(); |
|
175 | + $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_CLONEFORM); |
|
176 | + break; |
|
177 | 177 | case 'new' : |
178 | - $form_title = _MD_A_MYBLOCKSADMIN_NEWFORM ; |
|
179 | - $button_value = _MD_A_MYBLOCKSADMIN_BTN_NEW ; |
|
180 | - $next_op = 'new_ok' ; |
|
178 | + $form_title = _MD_A_MYBLOCKSADMIN_NEWFORM; |
|
179 | + $button_value = _MD_A_MYBLOCKSADMIN_BTN_NEW; |
|
180 | + $next_op = 'new_ok'; |
|
181 | 181 | // breadcrumbs |
182 | - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; |
|
183 | - $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_NEWFORM) ; |
|
184 | - break ; |
|
182 | + $breadcrumbsObj = & AltsysBreadcrumbs::getInstance(); |
|
183 | + $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_NEWFORM); |
|
184 | + break; |
|
185 | 185 | case 'edit' : |
186 | 186 | default : |
187 | - $form_title = _MD_A_MYBLOCKSADMIN_EDITFORM ; |
|
188 | - $button_value = _MD_A_MYBLOCKSADMIN_BTN_EDIT ; |
|
189 | - $next_op = 'edit_ok' ; |
|
187 | + $form_title = _MD_A_MYBLOCKSADMIN_EDITFORM; |
|
188 | + $button_value = _MD_A_MYBLOCKSADMIN_BTN_EDIT; |
|
189 | + $next_op = 'edit_ok'; |
|
190 | 190 | // breadcrumbs |
191 | - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; |
|
192 | - $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_EDITFORM) ; |
|
193 | - break ; |
|
191 | + $breadcrumbsObj = & AltsysBreadcrumbs::getInstance(); |
|
192 | + $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_EDITFORM); |
|
193 | + break; |
|
194 | 194 | } |
195 | 195 | |
196 | - $is_custom = in_array($block->getVar('block_type'), array( 'C', 'E' )) ? true : false ; |
|
197 | - $block_template =& $block->getVar('template', 'n') ; |
|
198 | - $block_template_tplset = '' ; |
|
196 | + $is_custom = in_array($block->getVar('block_type'), array('C', 'E')) ? true : false; |
|
197 | + $block_template = & $block->getVar('template', 'n'); |
|
198 | + $block_template_tplset = ''; |
|
199 | 199 | |
200 | - if (! $is_custom && $block_template) { |
|
200 | + if (!$is_custom && $block_template) { |
|
201 | 201 | // find template of the block |
202 | 202 | $tplfile_handler = xoops_gethandler('tplfile'); |
203 | - $found_templates = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', null, null, $block_template) ; |
|
204 | - $block_template_tplset = count($found_templates) > 0 ? $GLOBALS['xoopsConfig']['template_set'] : 'default' ; |
|
203 | + $found_templates = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', null, null, $block_template); |
|
204 | + $block_template_tplset = count($found_templates) > 0 ? $GLOBALS['xoopsConfig']['template_set'] : 'default'; |
|
205 | 205 | } |
206 | 206 | //HACK by domifara |
207 | 207 | /* |
@@ -210,41 +210,41 @@ discard block |
||
210 | 210 | } |
211 | 211 | */ |
212 | 212 | $block_data = $this->preview_request + array( |
213 | - 'bid' => $bid , |
|
214 | - 'name' => $block->getVar('name', 'n') , |
|
215 | - 'title' => $block->getVar('title', 'n') , |
|
213 | + 'bid' => $bid, |
|
214 | + 'name' => $block->getVar('name', 'n'), |
|
215 | + 'title' => $block->getVar('title', 'n'), |
|
216 | 216 | 'weight' => (int)$block->getVar('weight'), |
217 | 217 | 'bcachetime' => (int)$block->getVar('bcachetime'), |
218 | 218 | 'side' => (int)$block->getVar('side'), |
219 | 219 | 'visible' => (int)$block->getVar('visible'), |
220 | - 'template' => $block_template , |
|
221 | - 'template_tplset' => $block_template_tplset , |
|
222 | - 'options' => $block->getVar('options') , |
|
223 | - 'content' => $block->getVar('content', 'n') , |
|
224 | - 'is_custom' => $is_custom , |
|
225 | - 'type' => $block->getVar('block_type') , |
|
220 | + 'template' => $block_template, |
|
221 | + 'template_tplset' => $block_template_tplset, |
|
222 | + 'options' => $block->getVar('options'), |
|
223 | + 'content' => $block->getVar('content', 'n'), |
|
224 | + 'is_custom' => $is_custom, |
|
225 | + 'type' => $block->getVar('block_type'), |
|
226 | 226 | 'ctype' => $block->getVar('c_type') |
227 | - ) ; |
|
227 | + ); |
|
228 | 228 | |
229 | 229 | $block4assign = array( |
230 | - 'name_raw' => $block_data['name'] , |
|
231 | - 'title_raw' => $block_data['title'] , |
|
232 | - 'content_raw' => $block_data['content'] , |
|
233 | - 'cell_position' => $this->renderCell4BlockPosition($block_data) , |
|
234 | - 'cell_module_link' => $this->renderCell4BlockModuleLink($block_data) , |
|
235 | - 'cell_group_perm' => $this->renderCell4BlockReadGroupPerm($block_data) , |
|
236 | - 'cell_options' => $this->renderCell4BlockOptions($block_data) , |
|
230 | + 'name_raw' => $block_data['name'], |
|
231 | + 'title_raw' => $block_data['title'], |
|
232 | + 'content_raw' => $block_data['content'], |
|
233 | + 'cell_position' => $this->renderCell4BlockPosition($block_data), |
|
234 | + 'cell_module_link' => $this->renderCell4BlockModuleLink($block_data), |
|
235 | + 'cell_group_perm' => $this->renderCell4BlockReadGroupPerm($block_data), |
|
236 | + 'cell_options' => $this->renderCell4BlockOptions($block_data), |
|
237 | 237 | 'content_preview' => $this->previewContent($block_data) |
238 | - ) + $block_data ; |
|
238 | + ) + $block_data; |
|
239 | 239 | |
240 | 240 | // display |
241 | - require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ; |
|
242 | - $tpl = new D3Tpl() ; |
|
241 | + require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php'; |
|
242 | + $tpl = new D3Tpl(); |
|
243 | 243 | //dhtml |
244 | 244 | include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
245 | 245 | |
246 | - if ($block_data['ctype']=='H' || empty($block_data['ctype'])) { |
|
247 | - $editor_configs=array(); |
|
246 | + if ($block_data['ctype'] == 'H' || empty($block_data['ctype'])) { |
|
247 | + $editor_configs = array(); |
|
248 | 248 | $editor_configs['name'] = 'content_block'; |
249 | 249 | $editor_configs['value'] = $block_data['content']; |
250 | 250 | $editor_configs['rows'] = 20; |
@@ -254,12 +254,12 @@ discard block |
||
254 | 254 | $editor_configs['editor'] = xoops_getModuleOption('blocks_editor', 'system'); |
255 | 255 | $form = new XoopsFormEditor('', 'textarea_content', $editor_configs); |
256 | 256 | $rendered = $form->render(); |
257 | - $tpl->assign('altsys_x25_dhtmltextarea', $rendered) ; |
|
257 | + $tpl->assign('altsys_x25_dhtmltextarea', $rendered); |
|
258 | 258 | } else { |
259 | 259 | $form = new XoopsFormDhtmlTextArea('', 'textarea_content', $block_data['content'], 80, 20); |
260 | 260 | $rendered = $form->render(); |
261 | - $rendered = '<div id="textarea_content_bbcode_buttons_pre" style="display:block;">'.str_replace(array( '<textarea', '</textarea><br />' ), array( '</div><textarea', '</textarea><div id="textarea_content_bbcode_buttons_post" style="display:block;">' ), $rendered) . '</div>' ; |
|
262 | - $tpl->assign('altsys_x25_dhtmltextarea', $rendered) ; |
|
261 | + $rendered = '<div id="textarea_content_bbcode_buttons_pre" style="display:block;">'.str_replace(array('<textarea', '</textarea><br />'), array('</div><textarea', '</textarea><div id="textarea_content_bbcode_buttons_post" style="display:block;">'), $rendered).'</div>'; |
|
262 | + $tpl->assign('altsys_x25_dhtmltextarea', $rendered); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | $tpl->assign(array( |
@@ -274,91 +274,91 @@ discard block |
||
274 | 274 | 'submit_button' => $button_value, |
275 | 275 | 'common_fck_installed' => file_exists(XOOPS_ROOT_PATH.'/common/fckeditor/fckeditor.js'), |
276 | 276 | 'gticket_hidden' => $GLOBALS['xoopsGTicket']->getTicketHtml(__LINE__, 1800, 'myblocksadmin') |
277 | - )) ; |
|
277 | + )); |
|
278 | 278 | //HACK by domifara |
279 | - $tpl->display('db:altsys_main_myblocksadmin_edit_4x25.html') ; |
|
279 | + $tpl->display('db:altsys_main_myblocksadmin_edit_4x25.html'); |
|
280 | 280 | |
281 | - return ; |
|
281 | + return; |
|
282 | 282 | } |
283 | 283 | public function fetchRequest4Block($bid) |
284 | 284 | { |
285 | 285 | $bid = (int)$bid; |
286 | - (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance() ; |
|
286 | + (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = & MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance(); |
|
287 | 287 | |
288 | 288 | if (@$_POST['extra_sides'][$bid] > 0) { |
289 | 289 | $_POST['sides'][$bid] = (int)$_POST['extra_sides'][$bid]; |
290 | 290 | } |
291 | 291 | |
292 | 292 | if (@$_POST['sides'][$bid] < 0) { |
293 | - $visible = 0 ; |
|
294 | - $_POST['sides'][$bid] = -1 ; |
|
293 | + $visible = 0; |
|
294 | + $_POST['sides'][$bid] = -1; |
|
295 | 295 | } else { |
296 | - $visible = 1 ; |
|
296 | + $visible = 1; |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | return array( |
300 | - 'bid' => $bid , |
|
300 | + 'bid' => $bid, |
|
301 | 301 | 'side' => (int)(@$_POST['sides'][$bid]), |
302 | 302 | 'weight' => (int)(@$_POST['weights'][$bid]), |
303 | - 'visible' => $visible , |
|
304 | - 'title' => $myts->stripSlashesGPC(@$_POST['titles'][$bid]) , |
|
305 | - 'content' => $myts->stripSlashesGPC(@$_POST['textarea_content']) , |
|
306 | - 'ctype' => preg_replace('/[^A-Z]/', '', @$_POST['ctypes'][$bid]) , |
|
303 | + 'visible' => $visible, |
|
304 | + 'title' => $myts->stripSlashesGPC(@$_POST['titles'][$bid]), |
|
305 | + 'content' => $myts->stripSlashesGPC(@$_POST['textarea_content']), |
|
306 | + 'ctype' => preg_replace('/[^A-Z]/', '', @$_POST['ctypes'][$bid]), |
|
307 | 307 | 'bcachetime' => (int)(@$_POST['bcachetimes'][$bid]), |
308 | - 'bmodule' => is_array(@$_POST['bmodules'][$bid]) ? $_POST['bmodules'][$bid] : array( 0 ) , |
|
309 | - 'bgroup' => is_array(@$_POST['bgroups'][$bid]) ? $_POST['bgroups'][$bid] : array() , |
|
308 | + 'bmodule' => is_array(@$_POST['bmodules'][$bid]) ? $_POST['bmodules'][$bid] : array(0), |
|
309 | + 'bgroup' => is_array(@$_POST['bgroups'][$bid]) ? $_POST['bgroups'][$bid] : array(), |
|
310 | 310 | 'options' => is_array(@$_POST['options'][$bid]) ? $_POST['options'][$bid] : array() |
311 | - ) ; |
|
311 | + ); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | public function previewContent($block_data) |
315 | 315 | { |
316 | 316 | $bid = (int)$block_data['bid']; |
317 | 317 | |
318 | - if (! $block_data['is_custom']) { |
|
319 | - return '' ; |
|
318 | + if (!$block_data['is_custom']) { |
|
319 | + return ''; |
|
320 | 320 | } |
321 | 321 | if (empty($this->preview_request)) { |
322 | - return '' ; |
|
322 | + return ''; |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | //HACK by domifara |
326 | 326 | //TODO : need no hook block at this |
327 | - $block = new XoopsBlock($bid) ; |
|
327 | + $block = new XoopsBlock($bid); |
|
328 | 328 | |
329 | 329 | if ($block->getVar('mid')) { |
330 | - return '' ; |
|
330 | + return ''; |
|
331 | 331 | } |
332 | 332 | |
333 | - $block->setVar('title', $block_data['title']) ; |
|
334 | - $block->setVar('content', $block_data['content']) ; |
|
333 | + $block->setVar('title', $block_data['title']); |
|
334 | + $block->setVar('content', $block_data['content']); |
|
335 | 335 | |
336 | - restore_error_handler() ; |
|
337 | - $original_level = error_reporting(E_ALL) ; |
|
336 | + restore_error_handler(); |
|
337 | + $original_level = error_reporting(E_ALL); |
|
338 | 338 | |
339 | 339 | // $ret = $block->getContent( 'S' , $block_data['ctype'] ) ; |
340 | 340 | |
341 | 341 | $c_type = $block_data['ctype']; |
342 | 342 | if ($c_type == 'H') { |
343 | - $ret = str_replace('{X_SITEURL}', XOOPS_URL . '/', $block->getVar('content', 'N')); |
|
343 | + $ret = str_replace('{X_SITEURL}', XOOPS_URL.'/', $block->getVar('content', 'N')); |
|
344 | 344 | } elseif ($c_type == 'P') { |
345 | 345 | ob_start(); |
346 | 346 | echo eval($block->getVar('content', 'N')); |
347 | 347 | $content = ob_get_contents(); |
348 | 348 | ob_end_clean(); |
349 | - $ret = str_replace('{X_SITEURL}', XOOPS_URL . '/', $content); |
|
349 | + $ret = str_replace('{X_SITEURL}', XOOPS_URL.'/', $content); |
|
350 | 350 | } elseif ($c_type == 'S') { |
351 | - (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance(); |
|
352 | - $content = str_replace('{X_SITEURL}', XOOPS_URL . '/', $block->getVar('content', 'N')); |
|
351 | + (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = & MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance(); |
|
352 | + $content = str_replace('{X_SITEURL}', XOOPS_URL.'/', $block->getVar('content', 'N')); |
|
353 | 353 | $ret = $myts->displayTarea($content, 1, 1); |
354 | 354 | } else { |
355 | - (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance(); |
|
356 | - $content = str_replace('{X_SITEURL}', XOOPS_URL . '/', $block->getVar('content', 'N')); |
|
355 | + (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = & MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance(); |
|
356 | + $content = str_replace('{X_SITEURL}', XOOPS_URL.'/', $block->getVar('content', 'N')); |
|
357 | 357 | $ret = $myts->displayTarea($content, 1, 0); |
358 | 358 | } |
359 | 359 | |
360 | - error_reporting($original_level) ; |
|
360 | + error_reporting($original_level); |
|
361 | 361 | |
362 | - return $ret ; |
|
362 | + return $ret; |
|
363 | 363 | } |
364 | 364 | } |
@@ -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 | |
@@ -87,52 +87,52 @@ discard block |
||
87 | 87 | if ($xoopsModule->getVar('dirname') == 'altsys') { |
88 | 88 | // set target_module if specified by $_GET['dirname'] |
89 | 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) ; |
|
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 | |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | //HACK by domifara |
186 | 186 | if (defined('XOOPS_CUBE_LEGACY')) { |
187 | 187 | $handler = xoops_gethandler('block'); |
188 | - $block =& $handler->create(false) ; |
|
189 | - $block->load($bid) ; |
|
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,16 +203,16 @@ 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 | |
@@ -221,25 +221,25 @@ discard block |
||
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 | 269 | $group_handler = xoops_gethandler('group'); |
270 | - $groups = $group_handler->getObjects() ; |
|
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 | 497 | $handler = xoops_gethandler('block'); |
498 | - $block =& $handler->create(false) ; |
|
499 | - $block->load($bid) ; |
|
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,7 +542,7 @@ 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 | |
@@ -550,14 +550,14 @@ discard block |
||
550 | 550 | public function updateBlockModuleLink($bid, $bmodules) |
551 | 551 | { |
552 | 552 | $bid = (int)$bid; |
553 | - $table = $this->db->prefix('block_module_link') ; |
|
553 | + $table = $this->db->prefix('block_module_link'); |
|
554 | 554 | |
555 | - $sql = "DELETE FROM `$table` WHERE `block_id`=$bid" ; |
|
556 | - $this->db->query($sql) ; |
|
555 | + $sql = "DELETE FROM `$table` WHERE `block_id`=$bid"; |
|
556 | + $this->db->query($sql); |
|
557 | 557 | foreach ($bmodules as $mid) { |
558 | 558 | $mid = (int)$mid; |
559 | - $sql = "INSERT INTO `$table` (`block_id`,`module_id`) VALUES ($bid,$mid)" ; |
|
560 | - $this->db->query($sql) ; |
|
559 | + $sql = "INSERT INTO `$table` (`block_id`,`module_id`) VALUES ($bid,$mid)"; |
|
560 | + $this->db->query($sql); |
|
561 | 561 | } |
562 | 562 | } |
563 | 563 | |
@@ -566,83 +566,83 @@ discard block |
||
566 | 566 | public function updateBlockReadGroupPerm($bid, $req_gids) |
567 | 567 | { |
568 | 568 | $bid = (int)$bid; |
569 | - $table = $this->db->prefix('group_permission') ; |
|
570 | - $req_gids = array_map('intval', $req_gids) ; |
|
571 | - sort($req_gids) ; |
|
569 | + $table = $this->db->prefix('group_permission'); |
|
570 | + $req_gids = array_map('intval', $req_gids); |
|
571 | + sort($req_gids); |
|
572 | 572 | |
573 | 573 | // compare group ids from request and the records. |
574 | - $sql = "SELECT `gperm_groupid` FROM `$table` WHERE gperm_name='block_read' AND `gperm_itemid`=$bid" ; |
|
575 | - $result = $this->db->query($sql) ; |
|
576 | - $db_gids = array() ; |
|
574 | + $sql = "SELECT `gperm_groupid` FROM `$table` WHERE gperm_name='block_read' AND `gperm_itemid`=$bid"; |
|
575 | + $result = $this->db->query($sql); |
|
576 | + $db_gids = array(); |
|
577 | 577 | while (list($gid) = $this->db->fetchRow($result)) { |
578 | - $db_gids[] = $gid ; |
|
578 | + $db_gids[] = $gid; |
|
579 | 579 | } |
580 | - $db_gids = array_map('intval', $db_gids) ; |
|
581 | - sort($db_gids) ; |
|
580 | + $db_gids = array_map('intval', $db_gids); |
|
581 | + sort($db_gids); |
|
582 | 582 | |
583 | 583 | // if they are identical, just return (prevent increase of gperm_id) |
584 | 584 | if (serialize($req_gids) == serialize($db_gids)) { |
585 | - return ; |
|
585 | + return; |
|
586 | 586 | } |
587 | 587 | |
588 | - $sql = "DELETE FROM `$table` WHERE gperm_name='block_read' AND `gperm_itemid`=$bid" ; |
|
589 | - $this->db->query($sql) ; |
|
588 | + $sql = "DELETE FROM `$table` WHERE gperm_name='block_read' AND `gperm_itemid`=$bid"; |
|
589 | + $this->db->query($sql); |
|
590 | 590 | foreach ($req_gids as $gid) { |
591 | 591 | $gid = (int)$gid; |
592 | - $sql = "INSERT INTO `$table` (`gperm_groupid`,`gperm_itemid`,`gperm_modid`,`gperm_name`) VALUES ($gid,$bid,1,'block_read')" ; |
|
593 | - $this->db->query($sql) ; |
|
592 | + $sql = "INSERT INTO `$table` (`gperm_groupid`,`gperm_itemid`,`gperm_modid`,`gperm_name`) VALUES ($gid,$bid,1,'block_read')"; |
|
593 | + $this->db->query($sql); |
|
594 | 594 | } |
595 | 595 | } |
596 | 596 | |
597 | 597 | |
598 | 598 | public function do_order() |
599 | 599 | { |
600 | - $sides = is_array(@$_POST['sides']) ? $_POST['sides'] : array() ; |
|
600 | + $sides = is_array(@$_POST['sides']) ? $_POST['sides'] : array(); |
|
601 | 601 | foreach (array_keys($sides) as $bid) { |
602 | - $request = $this->fetchRequest4Block($bid) ; |
|
602 | + $request = $this->fetchRequest4Block($bid); |
|
603 | 603 | |
604 | 604 | // update the block |
605 | - $this->update_block($request['bid'], $request['side'], $request['weight'], $request['visible'], $request['title'], null, null, $request['bcachetime'], array()) ; |
|
605 | + $this->update_block($request['bid'], $request['side'], $request['weight'], $request['visible'], $request['title'], null, null, $request['bcachetime'], array()); |
|
606 | 606 | |
607 | 607 | // block_module_link update |
608 | - $this->updateBlockModuleLink($bid, $request['bmodule']) ; |
|
608 | + $this->updateBlockModuleLink($bid, $request['bmodule']); |
|
609 | 609 | |
610 | 610 | // group_permission update |
611 | - $this->updateBlockReadGroupPerm($bid, $request['bgroup']) ; |
|
611 | + $this->updateBlockReadGroupPerm($bid, $request['bgroup']); |
|
612 | 612 | } |
613 | - return _MD_A_MYBLOCKSADMIN_DBUPDATED ; |
|
613 | + return _MD_A_MYBLOCKSADMIN_DBUPDATED; |
|
614 | 614 | } |
615 | 615 | |
616 | 616 | |
617 | 617 | public function fetchRequest4Block($bid) |
618 | 618 | { |
619 | 619 | $bid = (int)$bid; |
620 | - (method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance() ; |
|
620 | + (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = & MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance(); |
|
621 | 621 | |
622 | 622 | if (@$_POST['extra_sides'][$bid] > 0) { |
623 | 623 | $_POST['sides'][$bid] = (int)$_POST['extra_sides'][$bid]; |
624 | 624 | } |
625 | 625 | |
626 | 626 | if (@$_POST['sides'][$bid] < 0) { |
627 | - $visible = 0 ; |
|
628 | - $_POST['sides'][$bid] = -1 ; |
|
627 | + $visible = 0; |
|
628 | + $_POST['sides'][$bid] = -1; |
|
629 | 629 | } else { |
630 | - $visible = 1 ; |
|
630 | + $visible = 1; |
|
631 | 631 | } |
632 | 632 | |
633 | 633 | return array( |
634 | - 'bid' => $bid , |
|
634 | + 'bid' => $bid, |
|
635 | 635 | 'side' => (int)(@$_POST['sides'][$bid]), |
636 | 636 | 'weight' => (int)(@$_POST['weights'][$bid]), |
637 | - 'visible' => $visible , |
|
638 | - 'title' => $myts->stripSlashesGPC(@$_POST['titles'][$bid]) , |
|
639 | - 'content' => $myts->stripSlashesGPC(@$_POST['contents'][$bid]) , |
|
640 | - 'ctype' => preg_replace('/[^A-Z]/', '', @$_POST['ctypes'][$bid]) , |
|
637 | + 'visible' => $visible, |
|
638 | + 'title' => $myts->stripSlashesGPC(@$_POST['titles'][$bid]), |
|
639 | + 'content' => $myts->stripSlashesGPC(@$_POST['contents'][$bid]), |
|
640 | + 'ctype' => preg_replace('/[^A-Z]/', '', @$_POST['ctypes'][$bid]), |
|
641 | 641 | 'bcachetime' => (int)(@$_POST['bcachetimes'][$bid]), |
642 | - 'bmodule' => is_array(@$_POST['bmodules'][$bid]) ? $_POST['bmodules'][$bid] : array( 0 ) , |
|
643 | - 'bgroup' => is_array(@$_POST['bgroups'][$bid]) ? $_POST['bgroups'][$bid] : array() , |
|
642 | + 'bmodule' => is_array(@$_POST['bmodules'][$bid]) ? $_POST['bmodules'][$bid] : array(0), |
|
643 | + 'bgroup' => is_array(@$_POST['bgroups'][$bid]) ? $_POST['bgroups'][$bid] : array(), |
|
644 | 644 | 'options' => is_array(@$_POST['options'][$bid]) ? $_POST['options'][$bid] : array() |
645 | - ) ; |
|
645 | + ); |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | |
@@ -653,30 +653,30 @@ discard block |
||
653 | 653 | //HACK by domifara |
654 | 654 | if (defined('XOOPS_CUBE_LEGACY')) { |
655 | 655 | $handler = xoops_gethandler('block'); |
656 | - $block =& $handler->create(false) ; |
|
657 | - $block->load($bid) ; |
|
656 | + $block = & $handler->create(false); |
|
657 | + $block->load($bid); |
|
658 | 658 | } else { |
659 | - $block = new XoopsBlock($bid) ; |
|
659 | + $block = new XoopsBlock($bid); |
|
660 | 660 | } |
661 | 661 | |
662 | - if (! is_object($block)) { |
|
663 | - die('Invalid bid') ; |
|
662 | + if (!is_object($block)) { |
|
663 | + die('Invalid bid'); |
|
664 | 664 | } |
665 | - if (! $this->canDelete($block)) { |
|
666 | - die('Cannot delete this block') ; |
|
665 | + if (!$this->canDelete($block)) { |
|
666 | + die('Cannot delete this block'); |
|
667 | 667 | } |
668 | 668 | $this->do_deleteBlockReadGroupPerm($bid); //HACK add by domifara |
669 | - $block->delete() ; |
|
670 | - return _MD_A_MYBLOCKSADMIN_DBUPDATED ; |
|
669 | + $block->delete(); |
|
670 | + return _MD_A_MYBLOCKSADMIN_DBUPDATED; |
|
671 | 671 | } |
672 | 672 | |
673 | 673 | //HACK add by domifara |
674 | 674 | public function do_deleteBlockReadGroupPerm($bid) |
675 | 675 | { |
676 | 676 | $bid = (int)$bid; |
677 | - $table = $this->db->prefix('group_permission') ; |
|
678 | - $sql = "DELETE FROM `$table` WHERE gperm_name='block_read' AND `gperm_itemid`=$bid" ; |
|
679 | - $this->db->query($sql) ; |
|
677 | + $table = $this->db->prefix('group_permission'); |
|
678 | + $sql = "DELETE FROM `$table` WHERE gperm_name='block_read' AND `gperm_itemid`=$bid"; |
|
679 | + $this->db->query($sql); |
|
680 | 680 | } |
681 | 681 | |
682 | 682 | public function form_delete($bid) |
@@ -687,24 +687,24 @@ discard block |
||
687 | 687 | //HACK by domifara |
688 | 688 | if (defined('XOOPS_CUBE_LEGACY')) { |
689 | 689 | $handler = xoops_gethandler('block'); |
690 | - $block =& $handler->create(false) ; |
|
691 | - $block->load($bid) ; |
|
690 | + $block = & $handler->create(false); |
|
691 | + $block->load($bid); |
|
692 | 692 | } else { |
693 | - $block = new XoopsBlock($bid) ; |
|
693 | + $block = new XoopsBlock($bid); |
|
694 | 694 | } |
695 | 695 | |
696 | - if (! is_object($block)) { |
|
697 | - die('Invalid bid') ; |
|
696 | + if (!is_object($block)) { |
|
697 | + die('Invalid bid'); |
|
698 | 698 | } |
699 | - if (! $this->canDelete($block)) { |
|
700 | - die('Cannot delete this block') ; |
|
699 | + if (!$this->canDelete($block)) { |
|
700 | + die('Cannot delete this block'); |
|
701 | 701 | } |
702 | 702 | |
703 | 703 | // breadcrumbs |
704 | - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; |
|
705 | - $breadcrumbsObj->appendPath('', _DELETE) ; |
|
704 | + $breadcrumbsObj = & AltsysBreadcrumbs::getInstance(); |
|
705 | + $breadcrumbsObj->appendPath('', _DELETE); |
|
706 | 706 | |
707 | - xoops_confirm(array( 'op' => 'delete_ok' ) + $GLOBALS['xoopsGTicket']->getTicketArray(__LINE__, 1800, 'myblocksadmin'), "?mode=admin&lib=altsys&page=myblocksadmin&dirname=$this->target_dirname&bid=$bid", sprintf(_MD_A_MYBLOCKSADMIN_FMT_REMOVEBLOCK, $block->getVar('title'))) ; |
|
707 | + xoops_confirm(array('op' => 'delete_ok') + $GLOBALS['xoopsGTicket']->getTicketArray(__LINE__, 1800, 'myblocksadmin'), "?mode=admin&lib=altsys&page=myblocksadmin&dirname=$this->target_dirname&bid=$bid", sprintf(_MD_A_MYBLOCKSADMIN_FMT_REMOVEBLOCK, $block->getVar('title'))); |
|
708 | 708 | } |
709 | 709 | |
710 | 710 | |
@@ -712,30 +712,30 @@ discard block |
||
712 | 712 | { |
713 | 713 | $bid = (int)$bid; |
714 | 714 | |
715 | - $request = $this->fetchRequest4Block($bid) ; |
|
715 | + $request = $this->fetchRequest4Block($bid); |
|
716 | 716 | |
717 | 717 | //HACK by domifara |
718 | 718 | if (defined('XOOPS_CUBE_LEGACY')) { |
719 | 719 | $handler = xoops_gethandler('block'); |
720 | - $block =& $handler->create(false) ; |
|
721 | - $block->load($bid) ; |
|
720 | + $block = & $handler->create(false); |
|
721 | + $block->load($bid); |
|
722 | 722 | } else { |
723 | - $block = new XoopsBlock($bid) ; |
|
723 | + $block = new XoopsBlock($bid); |
|
724 | 724 | } |
725 | 725 | |
726 | - if (! $block->getVar('bid')) { |
|
727 | - die('Invalid bid') ; |
|
726 | + if (!$block->getVar('bid')) { |
|
727 | + die('Invalid bid'); |
|
728 | 728 | } |
729 | - if (! $this->canClone($block)) { |
|
730 | - die('Invalid block_type') ; |
|
729 | + if (!$this->canClone($block)) { |
|
730 | + die('Invalid block_type'); |
|
731 | 731 | } |
732 | 732 | |
733 | 733 | if (empty($_POST['options'])) { |
734 | - $options = array() ; |
|
734 | + $options = array(); |
|
735 | 735 | } elseif (is_array($_POST['options'])) { |
736 | - $options = $_POST['options'] ; |
|
736 | + $options = $_POST['options']; |
|
737 | 737 | } else { |
738 | - $options = explode('|', $_POST['options']) ; |
|
738 | + $options = explode('|', $_POST['options']); |
|
739 | 739 | } |
740 | 740 | |
741 | 741 | // for backward compatibility |
@@ -743,46 +743,46 @@ discard block |
||
743 | 743 | |
744 | 744 | //HACK by domifara |
745 | 745 | if (defined('XOOPS_CUBE_LEGACY')) { |
746 | - $cblock =& $handler->create(false) ; |
|
746 | + $cblock = & $handler->create(false); |
|
747 | 747 | } else { |
748 | - $cblock = new XoopsBlock() ; |
|
748 | + $cblock = new XoopsBlock(); |
|
749 | 749 | } |
750 | 750 | |
751 | 751 | foreach ($block->vars as $k => $v) { |
752 | - $cblock->assignVar($k, $v['value']) ; |
|
752 | + $cblock->assignVar($k, $v['value']); |
|
753 | 753 | } |
754 | 754 | $cblock->setNew(); |
755 | 755 | $cblock->setVar('bid', 0); |
756 | 756 | $cblock->setVar('block_type', $block->getVar('block_type') == 'C' ? 'C' : 'D'); |
757 | - $cblock->setVar('func_num', $this->find_func_num_vacancy($block->getVar('mid'))) ; |
|
757 | + $cblock->setVar('func_num', $this->find_func_num_vacancy($block->getVar('mid'))); |
|
758 | 758 | // store the block into DB as a new one |
759 | - $newbid = $cblock->store() ; |
|
760 | - if (! $newbid) { |
|
761 | - return $cblock->getHtmlErrors() ; |
|
759 | + $newbid = $cblock->store(); |
|
760 | + if (!$newbid) { |
|
761 | + return $cblock->getHtmlErrors(); |
|
762 | 762 | } |
763 | 763 | |
764 | 764 | // update the block by the request |
765 | - $this->update_block($newbid, $request['side'], $request['weight'], $request['visible'], $request['title'], $request['content'], $request['ctype'], $request['bcachetime'], is_array(@$_POST['options']) ? $_POST['options'] : array()) ; |
|
765 | + $this->update_block($newbid, $request['side'], $request['weight'], $request['visible'], $request['title'], $request['content'], $request['ctype'], $request['bcachetime'], is_array(@$_POST['options']) ? $_POST['options'] : array()); |
|
766 | 766 | |
767 | 767 | // block_module_link update |
768 | - $this->updateBlockModuleLink($newbid, $request['bmodule']) ; |
|
768 | + $this->updateBlockModuleLink($newbid, $request['bmodule']); |
|
769 | 769 | |
770 | 770 | // group_permission update |
771 | - $this->updateBlockReadGroupPerm($newbid, $request['bgroup']) ; |
|
771 | + $this->updateBlockReadGroupPerm($newbid, $request['bgroup']); |
|
772 | 772 | |
773 | - return _MD_A_MYBLOCKSADMIN_DBUPDATED ; |
|
773 | + return _MD_A_MYBLOCKSADMIN_DBUPDATED; |
|
774 | 774 | } |
775 | 775 | |
776 | 776 | |
777 | 777 | public function find_func_num_vacancy($mid) |
778 | 778 | { |
779 | - $func_num = 256 ; |
|
779 | + $func_num = 256; |
|
780 | 780 | do { |
781 | - $func_num -- ; |
|
782 | - list($count) = $this->db->fetchRow($this->db->query('SELECT COUNT(*) FROM ' . $this->db->prefix('newblocks') . ' WHERE mid=' . (int)$mid . ' AND func_num=' . $func_num)) ; |
|
783 | - } while ($count > 0) ; |
|
781 | + $func_num--; |
|
782 | + list($count) = $this->db->fetchRow($this->db->query('SELECT COUNT(*) FROM '.$this->db->prefix('newblocks').' WHERE mid='.(int)$mid.' AND func_num='.$func_num)); |
|
783 | + } while ($count > 0); |
|
784 | 784 | |
785 | - return $func_num > 128 ? $func_num : 255 ; |
|
785 | + return $func_num > 128 ? $func_num : 255; |
|
786 | 786 | } |
787 | 787 | |
788 | 788 | |
@@ -796,36 +796,36 @@ discard block |
||
796 | 796 | //HACK by domifara |
797 | 797 | if (defined('XOOPS_CUBE_LEGACY')) { |
798 | 798 | $handler = xoops_gethandler('block'); |
799 | - $new_block =& $handler->create(false) ; |
|
799 | + $new_block = & $handler->create(false); |
|
800 | 800 | } else { |
801 | - $new_block = new XoopsBlock() ; |
|
801 | + $new_block = new XoopsBlock(); |
|
802 | 802 | } |
803 | 803 | |
804 | - $new_block->setNew() ; |
|
805 | - $new_block->setVar('name', $this->get_blockname_from_ctype('C')) ; |
|
806 | - $new_block->setVar('block_type', 'C') ; |
|
807 | - $new_block->setVar('func_num', 0) ; |
|
808 | - $bid = $new_block->store() ; |
|
809 | - $request = $this->fetchRequest4Block(0) ; |
|
804 | + $new_block->setNew(); |
|
805 | + $new_block->setVar('name', $this->get_blockname_from_ctype('C')); |
|
806 | + $new_block->setVar('block_type', 'C'); |
|
807 | + $new_block->setVar('func_num', 0); |
|
808 | + $bid = $new_block->store(); |
|
809 | + $request = $this->fetchRequest4Block(0); |
|
810 | 810 | // permission copy |
811 | 811 | foreach ($GLOBALS['xoopsUser']->getGroups() as $gid) { |
812 | - $sql = 'INSERT INTO ' . $this->db->prefix('group_permission') . " (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES ($gid, $bid, 1, 'block_read')"; |
|
812 | + $sql = 'INSERT INTO '.$this->db->prefix('group_permission')." (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES ($gid, $bid, 1, 'block_read')"; |
|
813 | 813 | $this->db->query($sql); |
814 | 814 | } |
815 | 815 | } else { |
816 | - $request = $this->fetchRequest4Block($bid) ; |
|
816 | + $request = $this->fetchRequest4Block($bid); |
|
817 | 817 | } |
818 | 818 | |
819 | 819 | // update the block by the request |
820 | - $msg = $this->update_block($bid, $request['side'], $request['weight'], $request['visible'], $request['title'], $request['content'], $request['ctype'], $request['bcachetime'], is_array(@$_POST['options']) ? $_POST['options'] : array()) ; |
|
820 | + $msg = $this->update_block($bid, $request['side'], $request['weight'], $request['visible'], $request['title'], $request['content'], $request['ctype'], $request['bcachetime'], is_array(@$_POST['options']) ? $_POST['options'] : array()); |
|
821 | 821 | |
822 | 822 | // block_module_link update |
823 | - $this->updateBlockModuleLink($bid, $request['bmodule']) ; |
|
823 | + $this->updateBlockModuleLink($bid, $request['bmodule']); |
|
824 | 824 | |
825 | 825 | // group_permission update |
826 | - $this->updateBlockReadGroupPerm($bid, $request['bgroup']) ; |
|
826 | + $this->updateBlockReadGroupPerm($bid, $request['bgroup']); |
|
827 | 827 | |
828 | - return $msg ; |
|
828 | + return $msg; |
|
829 | 829 | } |
830 | 830 | |
831 | 831 | |
@@ -836,57 +836,57 @@ discard block |
||
836 | 836 | //HACK by domifara |
837 | 837 | if (defined('XOOPS_CUBE_LEGACY')) { |
838 | 838 | $handler = xoops_gethandler('block'); |
839 | - $block =& $handler->create(false) ; |
|
840 | - $block->load($bid) ; |
|
839 | + $block = & $handler->create(false); |
|
840 | + $block->load($bid); |
|
841 | 841 | } else { |
842 | - $block = new XoopsBlock($bid) ; |
|
842 | + $block = new XoopsBlock($bid); |
|
843 | 843 | } |
844 | 844 | |
845 | - if (! $block->getVar('bid')) { |
|
845 | + if (!$block->getVar('bid')) { |
|
846 | 846 | // new defaults |
847 | - $bid = 0 ; |
|
848 | - $mode = 'new' ; |
|
849 | - $block->setVar('mid', 0) ; |
|
850 | - $block->setVar('block_type', 'C') ; |
|
847 | + $bid = 0; |
|
848 | + $mode = 'new'; |
|
849 | + $block->setVar('mid', 0); |
|
850 | + $block->setVar('block_type', 'C'); |
|
851 | 851 | } |
852 | 852 | |
853 | 853 | switch ($mode) { |
854 | 854 | case 'clone' : |
855 | - $form_title = _MD_A_MYBLOCKSADMIN_CLONEFORM ; |
|
856 | - $button_value = _MD_A_MYBLOCKSADMIN_BTN_CLONE ; |
|
857 | - $next_op = 'clone_ok' ; |
|
855 | + $form_title = _MD_A_MYBLOCKSADMIN_CLONEFORM; |
|
856 | + $button_value = _MD_A_MYBLOCKSADMIN_BTN_CLONE; |
|
857 | + $next_op = 'clone_ok'; |
|
858 | 858 | // breadcrumbs |
859 | - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; |
|
860 | - $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_CLONEFORM) ; |
|
861 | - break ; |
|
859 | + $breadcrumbsObj = & AltsysBreadcrumbs::getInstance(); |
|
860 | + $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_CLONEFORM); |
|
861 | + break; |
|
862 | 862 | case 'new' : |
863 | - $form_title = _MD_A_MYBLOCKSADMIN_NEWFORM ; |
|
864 | - $button_value = _MD_A_MYBLOCKSADMIN_BTN_NEW ; |
|
865 | - $next_op = 'new_ok' ; |
|
863 | + $form_title = _MD_A_MYBLOCKSADMIN_NEWFORM; |
|
864 | + $button_value = _MD_A_MYBLOCKSADMIN_BTN_NEW; |
|
865 | + $next_op = 'new_ok'; |
|
866 | 866 | // breadcrumbs |
867 | - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; |
|
868 | - $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_NEWFORM) ; |
|
869 | - break ; |
|
867 | + $breadcrumbsObj = & AltsysBreadcrumbs::getInstance(); |
|
868 | + $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_NEWFORM); |
|
869 | + break; |
|
870 | 870 | case 'edit' : |
871 | 871 | default : |
872 | - $form_title = _MD_A_MYBLOCKSADMIN_EDITFORM ; |
|
873 | - $button_value = _MD_A_MYBLOCKSADMIN_BTN_EDIT ; |
|
874 | - $next_op = 'edit_ok' ; |
|
872 | + $form_title = _MD_A_MYBLOCKSADMIN_EDITFORM; |
|
873 | + $button_value = _MD_A_MYBLOCKSADMIN_BTN_EDIT; |
|
874 | + $next_op = 'edit_ok'; |
|
875 | 875 | // breadcrumbs |
876 | - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; |
|
877 | - $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_EDITFORM) ; |
|
878 | - break ; |
|
876 | + $breadcrumbsObj = & AltsysBreadcrumbs::getInstance(); |
|
877 | + $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_EDITFORM); |
|
878 | + break; |
|
879 | 879 | } |
880 | 880 | |
881 | - $is_custom = in_array($block->getVar('block_type'), array( 'C', 'E' )) ? true : false ; |
|
882 | - $block_template =& $block->getVar('template', 'n') ; |
|
883 | - $block_template_tplset = '' ; |
|
881 | + $is_custom = in_array($block->getVar('block_type'), array('C', 'E')) ? true : false; |
|
882 | + $block_template = & $block->getVar('template', 'n'); |
|
883 | + $block_template_tplset = ''; |
|
884 | 884 | |
885 | - if (! $is_custom && $block_template) { |
|
885 | + if (!$is_custom && $block_template) { |
|
886 | 886 | // find template of the block |
887 | 887 | $tplfile_handler = xoops_gethandler('tplfile'); |
888 | - $found_templates = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', null, null, $block_template) ; |
|
889 | - $block_template_tplset = count($found_templates) > 0 ? $GLOBALS['xoopsConfig']['template_set'] : 'default' ; |
|
888 | + $found_templates = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', null, null, $block_template); |
|
889 | + $block_template_tplset = count($found_templates) > 0 ? $GLOBALS['xoopsConfig']['template_set'] : 'default'; |
|
890 | 890 | } |
891 | 891 | //HACK by domifara |
892 | 892 | /* |
@@ -895,43 +895,43 @@ discard block |
||
895 | 895 | } |
896 | 896 | */ |
897 | 897 | $block_data = $this->preview_request + array( |
898 | - 'bid' => $bid , |
|
899 | - 'name' => $block->getVar('name', 'n') , |
|
900 | - 'title' => $block->getVar('title', 'n') , |
|
898 | + 'bid' => $bid, |
|
899 | + 'name' => $block->getVar('name', 'n'), |
|
900 | + 'title' => $block->getVar('title', 'n'), |
|
901 | 901 | 'weight' => (int)$block->getVar('weight'), |
902 | 902 | 'bcachetime' => (int)$block->getVar('bcachetime'), |
903 | 903 | 'side' => (int)$block->getVar('side'), |
904 | 904 | 'visible' => (int)$block->getVar('visible'), |
905 | - 'template' => $block_template , |
|
906 | - 'template_tplset' => $block_template_tplset , |
|
907 | - 'options' => $block->getVar('options') , |
|
908 | - 'content' => $block->getVar('content', 'n') , |
|
909 | - 'is_custom' => $is_custom , |
|
910 | - 'type' => $block->getVar('block_type') , |
|
905 | + 'template' => $block_template, |
|
906 | + 'template_tplset' => $block_template_tplset, |
|
907 | + 'options' => $block->getVar('options'), |
|
908 | + 'content' => $block->getVar('content', 'n'), |
|
909 | + 'is_custom' => $is_custom, |
|
910 | + 'type' => $block->getVar('block_type'), |
|
911 | 911 | 'ctype' => $block->getVar('c_type') |
912 | - ) ; |
|
912 | + ); |
|
913 | 913 | |
914 | 914 | $block4assign = array( |
915 | - 'name_raw' => $block_data['name'] , |
|
916 | - 'title_raw' => $block_data['title'] , |
|
917 | - 'content_raw' => $block_data['content'] , |
|
918 | - 'cell_position' => $this->renderCell4BlockPosition($block_data) , |
|
919 | - 'cell_module_link' => $this->renderCell4BlockModuleLink($block_data) , |
|
920 | - 'cell_group_perm' => $this->renderCell4BlockReadGroupPerm($block_data) , |
|
921 | - 'cell_options' => $this->renderCell4BlockOptions($block_data) , |
|
915 | + 'name_raw' => $block_data['name'], |
|
916 | + 'title_raw' => $block_data['title'], |
|
917 | + 'content_raw' => $block_data['content'], |
|
918 | + 'cell_position' => $this->renderCell4BlockPosition($block_data), |
|
919 | + 'cell_module_link' => $this->renderCell4BlockModuleLink($block_data), |
|
920 | + 'cell_group_perm' => $this->renderCell4BlockReadGroupPerm($block_data), |
|
921 | + 'cell_options' => $this->renderCell4BlockOptions($block_data), |
|
922 | 922 | 'content_preview' => $this->previewContent($block_data) |
923 | - ) + $block_data ; |
|
923 | + ) + $block_data; |
|
924 | 924 | |
925 | 925 | // display |
926 | - require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ; |
|
927 | - $tpl = new D3Tpl() ; |
|
926 | + require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php'; |
|
927 | + $tpl = new D3Tpl(); |
|
928 | 928 | |
929 | 929 | //HACK by domifara |
930 | 930 | if (defined('XOOPS_CUBE_LEGACY')) { |
931 | - $tpl->assign('xoops_cube_legacy', true) ; |
|
931 | + $tpl->assign('xoops_cube_legacy', true); |
|
932 | 932 | include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
933 | 933 | } else { |
934 | - $tpl->assign('xoops_cube_legacy', false) ; |
|
934 | + $tpl->assign('xoops_cube_legacy', false); |
|
935 | 935 | } |
936 | 936 | |
937 | 937 | $tpl->assign(array( |
@@ -946,14 +946,14 @@ discard block |
||
946 | 946 | 'submit_button' => $button_value, |
947 | 947 | 'common_fck_installed' => $this->checkFck(), |
948 | 948 | 'gticket_hidden' => $GLOBALS['xoopsGTicket']->getTicketHtml(__LINE__, 1800, 'myblocksadmin') |
949 | - )) ; |
|
949 | + )); |
|
950 | 950 | |
951 | 951 | if (defined('XOOPS_CUBE_LEGACY')) { |
952 | - $tpl->display('db:altsys_main_myblocksadmin_edit_4legacy.html') ; |
|
952 | + $tpl->display('db:altsys_main_myblocksadmin_edit_4legacy.html'); |
|
953 | 953 | } else { |
954 | - $tpl->display('db:altsys_main_myblocksadmin_edit.html') ; |
|
954 | + $tpl->display('db:altsys_main_myblocksadmin_edit.html'); |
|
955 | 955 | } |
956 | - return ; |
|
956 | + return; |
|
957 | 957 | } |
958 | 958 | |
959 | 959 | public function checkFck() |
@@ -965,16 +965,16 @@ discard block |
||
965 | 965 | { |
966 | 966 | $bid = (int)$block_data['bid']; |
967 | 967 | |
968 | - if (! $block_data['is_custom']) { |
|
969 | - return '' ; |
|
968 | + if (!$block_data['is_custom']) { |
|
969 | + return ''; |
|
970 | 970 | } |
971 | 971 | if (empty($this->preview_request)) { |
972 | - return '' ; |
|
972 | + return ''; |
|
973 | 973 | } |
974 | 974 | |
975 | 975 | //HACK by domifara |
976 | 976 | //TODO : need no hook block at this |
977 | - $block = new XoopsBlock($bid) ; |
|
977 | + $block = new XoopsBlock($bid); |
|
978 | 978 | /* |
979 | 979 | $handler = xoops_gethandler('block'); |
980 | 980 | $block =& $handler->create(false) ; |
@@ -982,68 +982,68 @@ discard block |
||
982 | 982 | */ |
983 | 983 | |
984 | 984 | if ($block->getVar('mid')) { |
985 | - return '' ; |
|
985 | + return ''; |
|
986 | 986 | } |
987 | 987 | |
988 | - $block->setVar('title', $block_data['title']) ; |
|
989 | - $block->setVar('content', $block_data['content']) ; |
|
988 | + $block->setVar('title', $block_data['title']); |
|
989 | + $block->setVar('content', $block_data['content']); |
|
990 | 990 | |
991 | - restore_error_handler() ; |
|
992 | - $original_level = error_reporting(E_ALL) ; |
|
993 | - $ret =& $block->getContent('S', $block_data['ctype']) ; |
|
994 | - error_reporting($original_level) ; |
|
991 | + restore_error_handler(); |
|
992 | + $original_level = error_reporting(E_ALL); |
|
993 | + $ret = & $block->getContent('S', $block_data['ctype']); |
|
994 | + error_reporting($original_level); |
|
995 | 995 | |
996 | - return $ret ; |
|
996 | + return $ret; |
|
997 | 997 | } |
998 | 998 | |
999 | 999 | |
1000 | 1000 | public function get_blockname_from_ctype($bctype) |
1001 | 1001 | { |
1002 | 1002 | $ctypes = array( |
1003 | - 'H' => _MD_A_MYBLOCKSADMIN_CTYPE_HTML , |
|
1004 | - 'S' => _MD_A_MYBLOCKSADMIN_CTYPE_SMILE , |
|
1005 | - 'N' => _MD_A_MYBLOCKSADMIN_CTYPE_NOSMILE , |
|
1003 | + 'H' => _MD_A_MYBLOCKSADMIN_CTYPE_HTML, |
|
1004 | + 'S' => _MD_A_MYBLOCKSADMIN_CTYPE_SMILE, |
|
1005 | + 'N' => _MD_A_MYBLOCKSADMIN_CTYPE_NOSMILE, |
|
1006 | 1006 | 'P' => _MD_A_MYBLOCKSADMIN_CTYPE_PHP |
1007 | - ) ; |
|
1007 | + ); |
|
1008 | 1008 | |
1009 | - return isset($ctypes[$bctype]) ? $ctypes[$bctype] : _MD_A_MYBLOCKSADMIN_CTYPE_SMILE ; |
|
1009 | + return isset($ctypes[$bctype]) ? $ctypes[$bctype] : _MD_A_MYBLOCKSADMIN_CTYPE_SMILE; |
|
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | |
1013 | 1013 | public function processPost() |
1014 | 1014 | { |
1015 | 1015 | // Ticket Check |
1016 | - if (! $GLOBALS['xoopsGTicket']->check(true, 'myblocksadmin')) { |
|
1016 | + if (!$GLOBALS['xoopsGTicket']->check(true, 'myblocksadmin')) { |
|
1017 | 1017 | redirect_header(XOOPS_URL.'/', 3, $GLOBALS['xoopsGTicket']->getErrors()); |
1018 | 1018 | } |
1019 | 1019 | |
1020 | - $msg = '' ; |
|
1020 | + $msg = ''; |
|
1021 | 1021 | $bid = (int)(@$_GET['bid']); |
1022 | - if (! empty($_POST['preview'])) { |
|
1022 | + if (!empty($_POST['preview'])) { |
|
1023 | 1023 | // preview |
1024 | - $this->preview_request = $this->fetchRequest4Block($bid) ; |
|
1025 | - $_GET['op'] = str_replace('_ok', '', @$_POST['op']) ; |
|
1026 | - return ; // continue ; |
|
1024 | + $this->preview_request = $this->fetchRequest4Block($bid); |
|
1025 | + $_GET['op'] = str_replace('_ok', '', @$_POST['op']); |
|
1026 | + return; // continue ; |
|
1027 | 1027 | } elseif (@$_POST['op'] == 'order') { |
1028 | 1028 | // order ok |
1029 | - $msg = $this->do_order() ; |
|
1029 | + $msg = $this->do_order(); |
|
1030 | 1030 | } elseif (@$_POST['op'] == 'delete_ok') { |
1031 | 1031 | // delete ok |
1032 | - $msg = $this->do_delete($bid) ; |
|
1032 | + $msg = $this->do_delete($bid); |
|
1033 | 1033 | } elseif (@$_POST['op'] == 'clone_ok') { |
1034 | 1034 | // clone ok |
1035 | - $msg = $this->do_clone($bid) ; |
|
1035 | + $msg = $this->do_clone($bid); |
|
1036 | 1036 | } elseif (@$_POST['op'] == 'edit_ok' || @$_POST['op'] == 'new_ok') { |
1037 | 1037 | // edit ok |
1038 | - $msg = $this->do_edit($bid) ; |
|
1039 | - } elseif (! empty($_POST['submit'])) { |
|
1038 | + $msg = $this->do_edit($bid); |
|
1039 | + } elseif (!empty($_POST['submit'])) { |
|
1040 | 1040 | // update module_admin,module_read,block_read |
1041 | - include dirname(__DIR__).'/include/mygroupperm.php' ; |
|
1042 | - $msg = _MD_A_MYBLOCKSADMIN_PERMUPDATED ; |
|
1041 | + include dirname(__DIR__).'/include/mygroupperm.php'; |
|
1042 | + $msg = _MD_A_MYBLOCKSADMIN_PERMUPDATED; |
|
1043 | 1043 | } |
1044 | 1044 | |
1045 | - redirect_header('?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$this->target_dirname, 1, $msg) ; |
|
1046 | - exit ; |
|
1045 | + redirect_header('?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$this->target_dirname, 1, $msg); |
|
1046 | + exit; |
|
1047 | 1047 | } |
1048 | 1048 | |
1049 | 1049 | |
@@ -1052,22 +1052,22 @@ discard block |
||
1052 | 1052 | $bid = (int)(@$_GET['bid']); |
1053 | 1053 | switch (@$_GET['op']) { |
1054 | 1054 | case 'clone' : |
1055 | - $this->form_edit($bid, 'clone') ; |
|
1056 | - break ; |
|
1055 | + $this->form_edit($bid, 'clone'); |
|
1056 | + break; |
|
1057 | 1057 | case 'new' : |
1058 | 1058 | case 'edit' : |
1059 | - $this->form_edit($bid, 'edit') ; |
|
1060 | - break ; |
|
1059 | + $this->form_edit($bid, 'edit'); |
|
1060 | + break; |
|
1061 | 1061 | case 'delete' : |
1062 | - $this->form_delete($bid) ; |
|
1063 | - break ; |
|
1062 | + $this->form_delete($bid); |
|
1063 | + break; |
|
1064 | 1064 | case 'list' : |
1065 | 1065 | default : |
1066 | 1066 | // the first form (blocks) |
1067 | - $this->list_blocks() ; |
|
1067 | + $this->list_blocks(); |
|
1068 | 1068 | // the second form (groups) |
1069 | - $this->list_groups() ; |
|
1070 | - break ; |
|
1069 | + $this->list_groups(); |
|
1070 | + break; |
|
1071 | 1071 | } |
1072 | 1072 | } |
1073 | 1073 | } |
@@ -5,170 +5,170 @@ discard block |
||
5 | 5 | // GIJOE <http://www.peak.ne.jp/> // |
6 | 6 | // ------------------------------------------------------------------------- // |
7 | 7 | |
8 | -require_once __DIR__.'/class/AltsysBreadcrumbs.class.php' ; |
|
9 | -include_once __DIR__ . '/include/gtickets.php'; |
|
10 | -include_once __DIR__.'/include/altsys_functions.php' ; |
|
11 | -include_once __DIR__.'/include/lang_functions.php' ; |
|
12 | -include_once __DIR__.'/class/D3LanguageManager.class.php' ; |
|
8 | +require_once __DIR__.'/class/AltsysBreadcrumbs.class.php'; |
|
9 | +include_once __DIR__.'/include/gtickets.php'; |
|
10 | +include_once __DIR__.'/include/altsys_functions.php'; |
|
11 | +include_once __DIR__.'/include/lang_functions.php'; |
|
12 | +include_once __DIR__.'/class/D3LanguageManager.class.php'; |
|
13 | 13 | |
14 | 14 | |
15 | 15 | // only groups have 'module_admin' of 'altsys' can do that. |
16 | -$module_handler = xoops_gethandler('module') ; |
|
17 | -$module =& $module_handler->getByDirname('altsys') ; |
|
18 | -if (! is_object($module)) { |
|
19 | - die('install altsys') ; |
|
16 | +$module_handler = xoops_gethandler('module'); |
|
17 | +$module = & $module_handler->getByDirname('altsys'); |
|
18 | +if (!is_object($module)) { |
|
19 | + die('install altsys'); |
|
20 | 20 | } |
21 | -$moduleperm_handler = xoops_gethandler('groupperm') ; |
|
22 | -if (! is_object(@$xoopsUser) || ! $moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $xoopsUser->getGroups())) { |
|
23 | - die('only admin of altsys can access this area') ; |
|
21 | +$moduleperm_handler = xoops_gethandler('groupperm'); |
|
22 | +if (!is_object(@$xoopsUser) || !$moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $xoopsUser->getGroups())) { |
|
23 | + die('only admin of altsys can access this area'); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
27 | 27 | // initials |
28 | 28 | $db = XoopsDatabaseFactory::getDatabaseConnection(); |
29 | -(method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance() ; |
|
30 | -$langman =& D3LanguageManager::getInstance() ; |
|
29 | +(method_exists('MyTextSanitizer', 'sGetInstance') and $myts = & MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance(); |
|
30 | +$langman = & D3LanguageManager::getInstance(); |
|
31 | 31 | |
32 | 32 | // language file of this controller |
33 | -altsys_include_language_file('mylangadmin') ; |
|
33 | +altsys_include_language_file('mylangadmin'); |
|
34 | 34 | |
35 | 35 | // check $xoopsModule |
36 | -if (! is_object($xoopsModule)) { |
|
37 | - redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM) ; |
|
36 | +if (!is_object($xoopsModule)) { |
|
37 | + redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | // set target_module if specified by $_GET['dirname'] |
41 | 41 | $module_handler = xoops_gethandler('module'); |
42 | -if (! empty($_GET['dirname'])) { |
|
43 | - $dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', $_GET['dirname']) ; |
|
44 | - $target_module =& $module_handler->getByDirname($dirname) ; |
|
42 | +if (!empty($_GET['dirname'])) { |
|
43 | + $dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', $_GET['dirname']); |
|
44 | + $target_module = & $module_handler->getByDirname($dirname); |
|
45 | 45 | } |
46 | 46 | |
47 | -if (! empty($target_module) && is_object($target_module)) { |
|
47 | +if (!empty($target_module) && is_object($target_module)) { |
|
48 | 48 | // specified by dirname (for langadmin as an independent module) |
49 | - $target_mid = $target_module->getVar('mid') ; |
|
50 | - $target_dirname = $target_module->getVar('dirname') ; |
|
51 | - $target_dirname4sql = addslashes($target_dirname) ; |
|
52 | - $target_mname = $target_module->getVar('name') . ' ' . sprintf('(%2.2f)', $target_module->getVar('version') / 100.0) ; |
|
49 | + $target_mid = $target_module->getVar('mid'); |
|
50 | + $target_dirname = $target_module->getVar('dirname'); |
|
51 | + $target_dirname4sql = addslashes($target_dirname); |
|
52 | + $target_mname = $target_module->getVar('name').' '.sprintf('(%2.2f)', $target_module->getVar('version') / 100.0); |
|
53 | 53 | //$query4redirect = '?dirname='.urlencode(strip_tags($_GET['dirname'])) ; |
54 | 54 | } else { |
55 | 55 | // not specified by dirname (for 3rd party modules as mylangadmin) |
56 | - $target_mid = $xoopsModule->getVar('mid') ; |
|
57 | - $target_dirname = $xoopsModule->getVar('dirname') ; |
|
58 | - $target_dirname4sql = addslashes($target_dirname) ; |
|
59 | - $target_mname = $xoopsModule->getVar('name') ; |
|
56 | + $target_mid = $xoopsModule->getVar('mid'); |
|
57 | + $target_dirname = $xoopsModule->getVar('dirname'); |
|
58 | + $target_dirname4sql = addslashes($target_dirname); |
|
59 | + $target_mname = $xoopsModule->getVar('name'); |
|
60 | 60 | //$query4redirect = '' ; |
61 | 61 | } |
62 | 62 | |
63 | 63 | // basic GET variables |
64 | -$target_lang = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['target_lang']) ; |
|
64 | +$target_lang = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['target_lang']); |
|
65 | 65 | if (empty($target_lang)) { |
66 | - $target_lang = $GLOBALS['xoopsConfig']['language'] ; |
|
66 | + $target_lang = $GLOBALS['xoopsConfig']['language']; |
|
67 | 67 | } |
68 | -$target_lang4sql = addslashes($target_lang) ; |
|
69 | -$target_file = preg_replace('/[^0-9a-zA-Z_.-]/', '', @$_GET['target_file']) ; |
|
68 | +$target_lang4sql = addslashes($target_lang); |
|
69 | +$target_file = preg_replace('/[^0-9a-zA-Z_.-]/', '', @$_GET['target_file']); |
|
70 | 70 | if (empty($target_file)) { |
71 | - $target_file = 'main.php' ; |
|
71 | + $target_file = 'main.php'; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | // get $target_trustdirname |
75 | -$mytrustdirname = '' ; |
|
75 | +$mytrustdirname = ''; |
|
76 | 76 | if (file_exists(XOOPS_ROOT_PATH.'/modules/'.$target_dirname.'/mytrustdirname.php')) { |
77 | - require XOOPS_ROOT_PATH.'/modules/'.$target_dirname.'/mytrustdirname.php' ; |
|
77 | + require XOOPS_ROOT_PATH.'/modules/'.$target_dirname.'/mytrustdirname.php'; |
|
78 | 78 | } |
79 | -$target_trustdirname = $mytrustdirname ; |
|
79 | +$target_trustdirname = $mytrustdirname; |
|
80 | 80 | |
81 | 81 | // get base directory |
82 | 82 | if (empty($target_trustdirname)) { |
83 | 83 | // conventinal module |
84 | - $base_dir = XOOPS_ROOT_PATH.'/modules/'.$target_dirname.'/language' ; |
|
84 | + $base_dir = XOOPS_ROOT_PATH.'/modules/'.$target_dirname.'/language'; |
|
85 | 85 | } else { |
86 | 86 | // D3 module |
87 | - $base_dir = XOOPS_TRUST_PATH.'/modules/'.$target_trustdirname.'/language' ; |
|
87 | + $base_dir = XOOPS_TRUST_PATH.'/modules/'.$target_trustdirname.'/language'; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | // make list of language and check $target_lang |
91 | -$languages = array() ; |
|
92 | -$languages4disp = array() ; |
|
93 | -if (! is_dir($base_dir)) { |
|
94 | - altsys_mylangadmin_errordie($target_mname, _MYLANGADMIN_ERR_MODNOLANGUAGE) ; |
|
91 | +$languages = array(); |
|
92 | +$languages4disp = array(); |
|
93 | +if (!is_dir($base_dir)) { |
|
94 | + altsys_mylangadmin_errordie($target_mname, _MYLANGADMIN_ERR_MODNOLANGUAGE); |
|
95 | 95 | } |
96 | -$dh = opendir($base_dir) ; |
|
96 | +$dh = opendir($base_dir); |
|
97 | 97 | if ($dh) { |
98 | 98 | while ($file = readdir($dh)) { |
99 | 99 | if (substr($file, 0, 1) == '.') { |
100 | - continue ; |
|
100 | + continue; |
|
101 | 101 | } |
102 | 102 | if (is_dir("$base_dir/$file")) { |
103 | - list($count) = $db->fetchRow($db->query('SELECT COUNT(*) FROM ' . $db->prefix('altsys_language_constants') . " WHERE mid=$target_mid AND language='" . addslashes($file) . "'")) ; |
|
104 | - $languages[] = $file ; |
|
105 | - $languages4disp[] = $file . " ($count)" ; |
|
103 | + list($count) = $db->fetchRow($db->query('SELECT COUNT(*) FROM '.$db->prefix('altsys_language_constants')." WHERE mid=$target_mid AND language='".addslashes($file)."'")); |
|
104 | + $languages[] = $file; |
|
105 | + $languages4disp[] = $file." ($count)"; |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | } |
109 | -closedir($dh) ; |
|
110 | -if (! in_array($target_lang, $languages)) { |
|
111 | - $target_lang = $languages[0] ; |
|
109 | +closedir($dh); |
|
110 | +if (!in_array($target_lang, $languages)) { |
|
111 | + $target_lang = $languages[0]; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | // get base directory seleced language |
115 | -$lang_base_dir = $base_dir.'/'.$target_lang ; |
|
116 | -if (! is_dir($lang_base_dir)) { |
|
117 | - altsys_mylangadmin_errordie($target_mname, _MYLANGADMIN_ERR_MODLANGINCOMPATIBLE) ; |
|
115 | +$lang_base_dir = $base_dir.'/'.$target_lang; |
|
116 | +if (!is_dir($lang_base_dir)) { |
|
117 | + altsys_mylangadmin_errordie($target_mname, _MYLANGADMIN_ERR_MODLANGINCOMPATIBLE); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | // make list of files and check $target_file |
121 | -$lang_files = array() ; |
|
122 | -$dh = opendir($lang_base_dir) ; |
|
121 | +$lang_files = array(); |
|
122 | +$dh = opendir($lang_base_dir); |
|
123 | 123 | if ($dh) { |
124 | 124 | while ($file = readdir($dh)) { |
125 | 125 | if (substr($file, 0, 1) == '.') { |
126 | - continue ; |
|
126 | + continue; |
|
127 | 127 | } |
128 | 128 | if ($file == 'index.html') { |
129 | - continue ; |
|
129 | + continue; |
|
130 | 130 | } |
131 | 131 | //if( $file == 'modinfo.php' ) continue ; // TODO(?) |
132 | 132 | //if( $file == 'global.php' ) continue ; // TODO(?) |
133 | 133 | if (is_file("$lang_base_dir/$file")) { |
134 | - $lang_files[] = $file ; |
|
134 | + $lang_files[] = $file; |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | } |
138 | -closedir($dh) ; |
|
138 | +closedir($dh); |
|
139 | 139 | if (empty($lang_files)) { |
140 | - altsys_mylangadmin_errordie($target_mname, _MYLANGADMIN_ERR_MODEMPTYLANGDIR) ; |
|
140 | + altsys_mylangadmin_errordie($target_mname, _MYLANGADMIN_ERR_MODEMPTYLANGDIR); |
|
141 | 141 | } |
142 | -if (! in_array($target_file, $lang_files)) { |
|
143 | - $target_file = $lang_files[0] ; |
|
142 | +if (!in_array($target_file, $lang_files)) { |
|
143 | + $target_file = $lang_files[0]; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | // get unique path of language_file |
147 | -$langfile_unique_path = "$lang_base_dir/$target_file" ; |
|
147 | +$langfile_unique_path = "$lang_base_dir/$target_file"; |
|
148 | 148 | |
149 | 149 | // get constants defined by the target_file |
150 | -list($langfile_names, $constpref, $already_read) = altsys_mylangadmin_get_constant_names($langfile_unique_path, $target_dirname) ; |
|
150 | +list($langfile_names, $constpref, $already_read) = altsys_mylangadmin_get_constant_names($langfile_unique_path, $target_dirname); |
|
151 | 151 | |
152 | 152 | // get user_values should be overridden |
153 | -$langfile_constants = array() ; |
|
153 | +$langfile_constants = array(); |
|
154 | 154 | foreach ($langfile_names as $name) { |
155 | - list($value) = $db->fetchRow($db->query('SELECT value FROM ' . $db->prefix('altsys_language_constants') . " WHERE mid=$target_mid AND language='$target_lang4sql' AND name='" . addslashes($name) . "'")) ; |
|
156 | - $langfile_constants[ $name ] = $value ; |
|
155 | + list($value) = $db->fetchRow($db->query('SELECT value FROM '.$db->prefix('altsys_language_constants')." WHERE mid=$target_mid AND language='$target_lang4sql' AND name='".addslashes($name)."'")); |
|
156 | + $langfile_constants[$name] = $value; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | // constants defined in XOOPS_ROOT_PATH/my_language/(dirname)/... |
160 | 160 | if ($langman->my_language) { |
161 | - $mylang_unique_path = $langman->my_language.'/modules/'.$target_dirname.'/'.$target_lang.'/'.$target_file ; |
|
162 | - $mylang_constants = array_map('htmlspecialchars', altsys_mylangadmin_get_constants_by_pcre($mylang_unique_path)) ; |
|
161 | + $mylang_unique_path = $langman->my_language.'/modules/'.$target_dirname.'/'.$target_lang.'/'.$target_file; |
|
162 | + $mylang_constants = array_map('htmlspecialchars', altsys_mylangadmin_get_constants_by_pcre($mylang_unique_path)); |
|
163 | 163 | foreach ($mylang_constants as $key => $val) { |
164 | - if (! in_array($key, array_keys($langfile_constants))) { |
|
165 | - $langfile_constants[ $key ] = null ; |
|
166 | - define($key, _MYLANGADMIN_NOTE_ADDEDBYMYLANG) ; |
|
164 | + if (!in_array($key, array_keys($langfile_constants))) { |
|
165 | + $langfile_constants[$key] = null; |
|
166 | + define($key, _MYLANGADMIN_NOTE_ADDEDBYMYLANG); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | } else { |
170 | - $mylang_unique_path = '' ; |
|
171 | - $mylang_constants = array() ; |
|
170 | + $mylang_unique_path = ''; |
|
171 | + $mylang_constants = array(); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | |
@@ -177,57 +177,57 @@ discard block |
||
177 | 177 | // |
178 | 178 | |
179 | 179 | // Update language table and cache file |
180 | -if (! empty($_POST['do_update'])) { |
|
180 | +if (!empty($_POST['do_update'])) { |
|
181 | 181 | // Ticket Check |
182 | - if (! $xoopsGTicket->check(true, 'altsys')) { |
|
182 | + if (!$xoopsGTicket->check(true, 'altsys')) { |
|
183 | 183 | redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors()); |
184 | 184 | } |
185 | 185 | |
186 | 186 | // read original file |
187 | - $file_contents = file_get_contents($langfile_unique_path) ; |
|
187 | + $file_contents = file_get_contents($langfile_unique_path); |
|
188 | 188 | |
189 | 189 | // insert fingerprint of langfile_unique_path |
190 | - $langfile_fingerprint = '_MYLANGADMIN_'.md5($langfile_unique_path) ; |
|
191 | - $file_contents = str_replace('<?php', "<?php\nif(!defined('$langfile_fingerprint'))define('$langfile_fingerprint',1);", $file_contents) ; |
|
190 | + $langfile_fingerprint = '_MYLANGADMIN_'.md5($langfile_unique_path); |
|
191 | + $file_contents = str_replace('<?php', "<?php\nif(!defined('$langfile_fingerprint'))define('$langfile_fingerprint',1);", $file_contents); |
|
192 | 192 | |
193 | 193 | // constants loop |
194 | - $overrides_counter = 0 ; |
|
194 | + $overrides_counter = 0; |
|
195 | 195 | foreach (array_reverse($langfile_names) as $name) { |
196 | - $user_value = $myts->stripSlashesGPC(@$_POST[$name]) ; |
|
197 | - $db->query('DELETE FROM ' . $db->prefix('altsys_language_constants') . " WHERE mid=$target_mid AND language='$target_lang4sql' AND name='" . addslashes($name) . "'") ; |
|
196 | + $user_value = $myts->stripSlashesGPC(@$_POST[$name]); |
|
197 | + $db->query('DELETE FROM '.$db->prefix('altsys_language_constants')." WHERE mid=$target_mid AND language='$target_lang4sql' AND name='".addslashes($name)."'"); |
|
198 | 198 | if ($user_value !== '') { |
199 | - $overrides_counter ++ ; |
|
199 | + $overrides_counter++; |
|
200 | 200 | // Update table |
201 | - $db->query('INSERT INTO ' . $db->prefix('altsys_language_constants') . " (mid,language,name,value) VALUES ($target_mid,'$target_lang4sql','" . addslashes($name) . "','" . addslashes($user_value) . "')") ; |
|
201 | + $db->query('INSERT INTO '.$db->prefix('altsys_language_constants')." (mid,language,name,value) VALUES ($target_mid,'$target_lang4sql','".addslashes($name)."','".addslashes($user_value)."')"); |
|
202 | 202 | // rewrite script for cache |
203 | 203 | // comment-out the line of define() |
204 | 204 | if (empty($constpref)) { |
205 | - $from = '/.*define\s?\(\s*(["\'])'.preg_quote($name).'(\\1).*\;.*/' ; |
|
205 | + $from = '/.*define\s?\(\s*(["\'])'.preg_quote($name).'(\\1).*\;.*/'; |
|
206 | 206 | } else { |
207 | - $from = '/.*define\s?\(\s*\$constpref\s*\.\s*(["\'])'.preg_quote(substr($name, strlen($constpref))).'(\\1).*\;.*/' ; |
|
207 | + $from = '/.*define\s?\(\s*\$constpref\s*\.\s*(["\'])'.preg_quote(substr($name, strlen($constpref))).'(\\1).*\;.*/'; |
|
208 | 208 | } |
209 | - $to = '//$0'."\ndefine('".addslashes($name)."','".addslashes($user_value)."');" ; |
|
210 | - $file_contents = preg_replace($from, $to, $file_contents) ; |
|
209 | + $to = '//$0'."\ndefine('".addslashes($name)."','".addslashes($user_value)."');"; |
|
210 | + $file_contents = preg_replace($from, $to, $file_contents); |
|
211 | 211 | } |
212 | 212 | } |
213 | 213 | |
214 | 214 | // get the file name for caching |
215 | - $cache_file_name = $langman->getCacheFileName($target_file, $target_dirname, $target_lang) ; |
|
215 | + $cache_file_name = $langman->getCacheFileName($target_file, $target_dirname, $target_lang); |
|
216 | 216 | |
217 | 217 | // Create language cache file |
218 | 218 | if ($overrides_counter > 0) { |
219 | - $fp = fopen($cache_file_name, 'wb') ; |
|
220 | - if (! $fp) { |
|
221 | - die('Invalid Cache Directory. (Set XOOPS_TRUST_PATH/cache writable)') ; |
|
219 | + $fp = fopen($cache_file_name, 'wb'); |
|
220 | + if (!$fp) { |
|
221 | + die('Invalid Cache Directory. (Set XOOPS_TRUST_PATH/cache writable)'); |
|
222 | 222 | } |
223 | - fwrite($fp, $file_contents) ; |
|
224 | - fclose($fp) ; |
|
223 | + fwrite($fp, $file_contents); |
|
224 | + fclose($fp); |
|
225 | 225 | } else { |
226 | - unlink($cache_file_name) ; |
|
226 | + unlink($cache_file_name); |
|
227 | 227 | } |
228 | 228 | |
229 | - redirect_header('?mode=admin&lib=altsys&page=mylangadmin&dirname='.$target_dirname.'&target_lang='.rawurlencode($target_lang).'&target_file='.rawurlencode($target_file), 1, _MYLANGADMIN_CACHEUPDATED) ; |
|
230 | - exit ; |
|
229 | + redirect_header('?mode=admin&lib=altsys&page=mylangadmin&dirname='.$target_dirname.'&target_lang='.rawurlencode($target_lang).'&target_file='.rawurlencode($target_file), 1, _MYLANGADMIN_CACHEUPDATED); |
|
230 | + exit; |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | |
@@ -236,22 +236,22 @@ discard block |
||
236 | 236 | // |
237 | 237 | |
238 | 238 | // check cache file |
239 | -$cache_file_name = $langman->getCacheFileName($target_file, $target_dirname, $target_lang) ; |
|
240 | -$cache_file_mtime = file_exists($cache_file_name) ? filemtime($cache_file_name) : 0 ; |
|
239 | +$cache_file_name = $langman->getCacheFileName($target_file, $target_dirname, $target_lang); |
|
240 | +$cache_file_mtime = file_exists($cache_file_name) ? filemtime($cache_file_name) : 0; |
|
241 | 241 | |
242 | 242 | // check core version and generate message to enable D3LanguageManager |
243 | 243 | if (altsys_get_core_type() == ALTSYS_CORE_TYPE_XCL21) { |
244 | 244 | // XoopsCube Legacy without preload |
245 | 245 | if (class_exists('AltsysLangMgr_LanguageManager')) { |
246 | 246 | // the preload enabled |
247 | - $notice4disp = _MYLANGADMIN_MSG_D3LANGMANENABLED ; |
|
247 | + $notice4disp = _MYLANGADMIN_MSG_D3LANGMANENABLED; |
|
248 | 248 | } else { |
249 | 249 | // the preload disabled |
250 | - $notice4disp = sprintf(_MYLANGADMIN_FMT_HOWTOENABLED3LANGMAN4XCL, 'SetupAltsysLangMgr.class.php', 'XOOPS_ROOT_PATH/preload') ; |
|
250 | + $notice4disp = sprintf(_MYLANGADMIN_FMT_HOWTOENABLED3LANGMAN4XCL, 'SetupAltsysLangMgr.class.php', 'XOOPS_ROOT_PATH/preload'); |
|
251 | 251 | } |
252 | 252 | } else { |
253 | 253 | // X2 core etc. |
254 | - $notice4disp = _MYLANGADMIN_MSG_HOWTOENABLED3LANGMAN4X2.'<br />' ; |
|
254 | + $notice4disp = _MYLANGADMIN_MSG_HOWTOENABLED3LANGMAN4X2.'<br />'; |
|
255 | 255 | $notice4disp .= ' |
256 | 256 | <h4>include/common.php</h4> |
257 | 257 | <pre> |
@@ -275,20 +275,20 @@ discard block |
||
275 | 275 | // |
276 | 276 | |
277 | 277 | |
278 | -xoops_cp_header() ; |
|
278 | +xoops_cp_header(); |
|
279 | 279 | |
280 | 280 | // mymenu |
281 | -altsys_include_mymenu() ; |
|
281 | +altsys_include_mymenu(); |
|
282 | 282 | |
283 | 283 | // breadcrumbs |
284 | -$breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; |
|
284 | +$breadcrumbsObj = & AltsysBreadcrumbs::getInstance(); |
|
285 | 285 | if ($breadcrumbsObj->hasPaths()) { |
286 | - $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mylangadmin', _MI_ALTSYS_MENU_MYLANGADMIN) ; |
|
287 | - $breadcrumbsObj->appendPath('', $target_mname) ; |
|
286 | + $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=mylangadmin', _MI_ALTSYS_MENU_MYLANGADMIN); |
|
287 | + $breadcrumbsObj->appendPath('', $target_mname); |
|
288 | 288 | } |
289 | 289 | |
290 | -require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ; |
|
291 | -$tpl = new D3Tpl() ; |
|
290 | +require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php'; |
|
291 | +$tpl = new D3Tpl(); |
|
292 | 292 | $tpl->assign(array( |
293 | 293 | 'target_dirname' => $target_dirname, |
294 | 294 | 'target_mname' => $target_mname, |
@@ -307,8 +307,8 @@ discard block |
||
307 | 307 | 'notice' => $notice4disp, |
308 | 308 | 'already_read' => $already_read, |
309 | 309 | 'gticket_hidden' => $xoopsGTicket->getTicketHtml(__LINE__, 1800, 'altsys') |
310 | -)) ; |
|
311 | -$tpl->display('db:altsys_main_mylangadmin.html') ; |
|
310 | +)); |
|
311 | +$tpl->display('db:altsys_main_mylangadmin.html'); |
|
312 | 312 | |
313 | -xoops_cp_footer() ; |
|
314 | -exit ; |
|
313 | +xoops_cp_footer(); |
|
314 | +exit; |
@@ -1,45 +1,45 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! $xoopsConfig['theme_fromfile']) { |
|
4 | - return ; |
|
3 | +if (!$xoopsConfig['theme_fromfile']) { |
|
4 | + return; |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | // templates/ under modules |
8 | 8 | // $tplsadmin_autoupdate_path = XOOPS_THEME_PATH . '/' . $xoopsConfig['theme_set'] . '/templates' ; |
9 | 9 | |
10 | -if (! is_array(@$tplsadmin_autoupdate_dirnames)) { |
|
11 | - return ; |
|
10 | +if (!is_array(@$tplsadmin_autoupdate_dirnames)) { |
|
11 | + return; |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | foreach ($tplsadmin_autoupdate_dirnames as $dirname) { |
15 | - $dirname = preg_replace('/[^a-zA-Z0-9_-]/', '', $dirname) ; |
|
16 | - $tplsadmin_autoupdate_path = XOOPS_ROOT_PATH . '/modules/' . $dirname . '/templates' ; |
|
15 | + $dirname = preg_replace('/[^a-zA-Z0-9_-]/', '', $dirname); |
|
16 | + $tplsadmin_autoupdate_path = XOOPS_ROOT_PATH.'/modules/'.$dirname.'/templates'; |
|
17 | 17 | |
18 | 18 | // modules |
19 | - if ($handler = @opendir($tplsadmin_autoupdate_path . '/')) { |
|
19 | + if ($handler = @opendir($tplsadmin_autoupdate_path.'/')) { |
|
20 | 20 | while (($file = readdir($handler)) !== false) { |
21 | - $file_path = $tplsadmin_autoupdate_path . '/' . $file ; |
|
21 | + $file_path = $tplsadmin_autoupdate_path.'/'.$file; |
|
22 | 22 | if (is_file($file_path) && substr($file, -5) == '.html') { |
23 | 23 | $mtime = (int)(@filemtime($file_path)); |
24 | - list($count) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($xoopsConfig['template_set']) . "' AND tpl_file='" . addslashes($file) . "' AND tpl_lastmodified >= $mtime")) ; |
|
24 | + list($count) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM '.$xoopsDB->prefix('tplfile')." WHERE tpl_tplset='".addslashes($xoopsConfig['template_set'])."' AND tpl_file='".addslashes($file)."' AND tpl_lastmodified >= $mtime")); |
|
25 | 25 | if ($count <= 0) { |
26 | - include_once XOOPS_TRUST_PATH.'/libs/altsys/include/tpls_functions.php' ; |
|
27 | - tplsadmin_import_data($xoopsConfig['template_set'], $file, implode('', file($file_path)), $mtime) ; |
|
26 | + include_once XOOPS_TRUST_PATH.'/libs/altsys/include/tpls_functions.php'; |
|
27 | + tplsadmin_import_data($xoopsConfig['template_set'], $file, implode('', file($file_path)), $mtime); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | 33 | // blocks |
34 | - if ($handler = @opendir($tplsadmin_autoupdate_path . '/blocks/')) { |
|
34 | + if ($handler = @opendir($tplsadmin_autoupdate_path.'/blocks/')) { |
|
35 | 35 | while (($file = readdir($handler)) !== false) { |
36 | - $file_path = $tplsadmin_autoupdate_path . '/blocks/' . $file ; |
|
36 | + $file_path = $tplsadmin_autoupdate_path.'/blocks/'.$file; |
|
37 | 37 | if (is_file($file_path) && substr($file, -5) == '.html') { |
38 | 38 | $mtime = (int)(@filemtime($file_path)); |
39 | - list($count) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($xoopsConfig['template_set']) . "' AND tpl_file='" . addslashes($file) . "' AND tpl_lastmodified >= $mtime")) ; |
|
39 | + list($count) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM '.$xoopsDB->prefix('tplfile')." WHERE tpl_tplset='".addslashes($xoopsConfig['template_set'])."' AND tpl_file='".addslashes($file)."' AND tpl_lastmodified >= $mtime")); |
|
40 | 40 | if ($count <= 0) { |
41 | - include_once XOOPS_TRUST_PATH.'/libs/altsys/include/tpls_functions.php' ; |
|
42 | - tplsadmin_import_data($xoopsConfig['template_set'], $file, implode('', file($file_path)), $mtime) ; |
|
41 | + include_once XOOPS_TRUST_PATH.'/libs/altsys/include/tpls_functions.php'; |
|
42 | + tplsadmin_import_data($xoopsConfig['template_set'], $file, implode('', file($file_path)), $mtime); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
@@ -1,21 +1,21 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! $xoopsConfig['theme_fromfile']) { |
|
4 | - return ; |
|
3 | +if (!$xoopsConfig['theme_fromfile']) { |
|
4 | + return; |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | // templates/ under the theme |
8 | -$tplsadmin_autoupdate_path = XOOPS_THEME_PATH . '/' . $xoopsConfig['theme_set'] . '/templates' ; |
|
8 | +$tplsadmin_autoupdate_path = XOOPS_THEME_PATH.'/'.$xoopsConfig['theme_set'].'/templates'; |
|
9 | 9 | |
10 | -if ($handler = @opendir($tplsadmin_autoupdate_path . '/')) { |
|
10 | +if ($handler = @opendir($tplsadmin_autoupdate_path.'/')) { |
|
11 | 11 | while (($file = readdir($handler)) !== false) { |
12 | - $file_path = $tplsadmin_autoupdate_path . '/' . $file ; |
|
12 | + $file_path = $tplsadmin_autoupdate_path.'/'.$file; |
|
13 | 13 | if (is_file($file_path) && substr($file, -5) == '.html') { |
14 | 14 | $mtime = (int)(@filemtime($file_path)); |
15 | - list($count) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('tplfile') . " WHERE tpl_tplset='" . addslashes($xoopsConfig['template_set']) . "' AND tpl_file='" . addslashes($file) . "' AND tpl_lastmodified >= $mtime")) ; |
|
15 | + list($count) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM '.$xoopsDB->prefix('tplfile')." WHERE tpl_tplset='".addslashes($xoopsConfig['template_set'])."' AND tpl_file='".addslashes($file)."' AND tpl_lastmodified >= $mtime")); |
|
16 | 16 | if ($count <= 0) { |
17 | - include_once XOOPS_TRUST_PATH.'/libs/altsys/include/tpls_functions.php' ; |
|
18 | - tplsadmin_import_data($xoopsConfig['template_set'], $file, implode('', file($file_path)), $mtime) ; |
|
17 | + include_once XOOPS_TRUST_PATH.'/libs/altsys/include/tpls_functions.php'; |
|
18 | + tplsadmin_import_data($xoopsConfig['template_set'], $file, implode('', file($file_path)), $mtime); |
|
19 | 19 | } |
20 | 20 | } |
21 | 21 | } |
@@ -1,46 +1,46 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -altsys_set_module_config() ; |
|
3 | +altsys_set_module_config(); |
|
4 | 4 | |
5 | 5 | function altsys_set_module_config() |
6 | 6 | { |
7 | - global $altsysModuleConfig , $altsysModuleId ; |
|
7 | + global $altsysModuleConfig, $altsysModuleId; |
|
8 | 8 | |
9 | - $module_handler = xoops_gethandler('module') ; |
|
10 | - $module =& $module_handler->getByDirname('altsys') ; |
|
9 | + $module_handler = xoops_gethandler('module'); |
|
10 | + $module = & $module_handler->getByDirname('altsys'); |
|
11 | 11 | if (is_object($module)) { |
12 | - $config_handler = xoops_gethandler('config') ; |
|
13 | - $altsysModuleConfig = $config_handler->getConfigList($module->getVar('mid')) ; |
|
14 | - $altsysModuleId = $module->getVar('mid') ; |
|
12 | + $config_handler = xoops_gethandler('config'); |
|
13 | + $altsysModuleConfig = $config_handler->getConfigList($module->getVar('mid')); |
|
14 | + $altsysModuleId = $module->getVar('mid'); |
|
15 | 15 | } else { |
16 | - $altsysModuleConfig = array() ; |
|
17 | - $altsysModuleId = 0 ; |
|
16 | + $altsysModuleConfig = array(); |
|
17 | + $altsysModuleId = 0; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | // for RTL users |
21 | - @define('_GLOBAL_LEFT', @_ADM_USE_RTL == 1 ? 'right' : 'left') ; |
|
22 | - @define('_GLOBAL_RIGHT', @_ADM_USE_RTL == 1 ? 'left' : 'right') ; |
|
21 | + @define('_GLOBAL_LEFT', @_ADM_USE_RTL == 1 ? 'right' : 'left'); |
|
22 | + @define('_GLOBAL_RIGHT', @_ADM_USE_RTL == 1 ? 'left' : 'right'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | |
26 | 26 | function altsys_include_mymenu() |
27 | 27 | { |
28 | - global $xoopsModule , $xoopsConfig , $mydirname , $mydirpath , $mytrustdirname , $mytrustdirpath , $mymenu_fake_uri ; |
|
28 | + global $xoopsModule, $xoopsConfig, $mydirname, $mydirpath, $mytrustdirname, $mytrustdirpath, $mymenu_fake_uri; |
|
29 | 29 | |
30 | 30 | $mymenu_find_paths = array( |
31 | - $mydirpath.'/admin/mymenu.php' , |
|
32 | - $mydirpath.'/mymenu.php' , |
|
33 | - $mytrustdirpath.'/admin/mymenu.php' , |
|
31 | + $mydirpath.'/admin/mymenu.php', |
|
32 | + $mydirpath.'/mymenu.php', |
|
33 | + $mytrustdirpath.'/admin/mymenu.php', |
|
34 | 34 | $mytrustdirpath.'/mymenu.php' |
35 | - ) ; |
|
35 | + ); |
|
36 | 36 | |
37 | 37 | foreach ($mymenu_find_paths as $mymenu_find_path) { |
38 | 38 | if (file_exists($mymenu_find_path)) { |
39 | - include $mymenu_find_path ; |
|
40 | - include_once __DIR__.'/adminmenu_functions.php' ; |
|
41 | - altsys_adminmenu_insert_mymenu($xoopsModule) ; |
|
42 | - altsys_adminmenu_hack_ft() ; |
|
43 | - break ; |
|
39 | + include $mymenu_find_path; |
|
40 | + include_once __DIR__.'/adminmenu_functions.php'; |
|
41 | + altsys_adminmenu_insert_mymenu($xoopsModule); |
|
42 | + altsys_adminmenu_hack_ft(); |
|
43 | + break; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | } |
@@ -48,58 +48,58 @@ discard block |
||
48 | 48 | |
49 | 49 | function altsys_include_language_file($type) |
50 | 50 | { |
51 | - $mylang = $GLOBALS['xoopsConfig']['language'] ; |
|
51 | + $mylang = $GLOBALS['xoopsConfig']['language']; |
|
52 | 52 | |
53 | 53 | if (file_exists(XOOPS_ROOT_PATH.'/modules/altsys/language/'.$mylang.'/'.$type.'.php')) { |
54 | - include_once XOOPS_ROOT_PATH.'/modules/altsys/language/'.$mylang.'/'.$type.'.php' ; |
|
54 | + include_once XOOPS_ROOT_PATH.'/modules/altsys/language/'.$mylang.'/'.$type.'.php'; |
|
55 | 55 | } elseif (file_exists(XOOPS_TRUST_PATH.'/libs/altsys/language/'.$mylang.'/'.$type.'.php')) { |
56 | - include_once XOOPS_TRUST_PATH.'/libs/altsys/language/'.$mylang.'/'.$type.'.php' ; |
|
56 | + include_once XOOPS_TRUST_PATH.'/libs/altsys/language/'.$mylang.'/'.$type.'.php'; |
|
57 | 57 | } elseif (file_exists(XOOPS_ROOT_PATH.'/modules/altsys/language/english/'.$type.'.php')) { |
58 | - include_once XOOPS_ROOT_PATH.'/modules/altsys/language/english/'.$type.'.php' ; |
|
58 | + include_once XOOPS_ROOT_PATH.'/modules/altsys/language/english/'.$type.'.php'; |
|
59 | 59 | } elseif (file_exists(XOOPS_TRUST_PATH.'/libs/altsys/language/english/'.$type.'.php')) { |
60 | - include_once XOOPS_TRUST_PATH.'/libs/altsys/language/english/'.$type.'.php' ; |
|
60 | + include_once XOOPS_TRUST_PATH.'/libs/altsys/language/english/'.$type.'.php'; |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | 64 | |
65 | -define('ALTSYS_CORE_TYPE_X20', 1) ; // 2.0.0-2.0.13 and 2.0.x-JP |
|
66 | -define('ALTSYS_CORE_TYPE_X20S', 2) ; // 2.0.14- from xoops.org (Skalpa's S) |
|
67 | -define('ALTSYS_CORE_TYPE_ORE', 4) ; // ORETEKI by marijuana |
|
68 | -define('ALTSYS_CORE_TYPE_X22', 8) ; // 2.2 from xoops.org |
|
69 | -define('ALTSYS_CORE_TYPE_X23P', 10) ; // 2.3 from xoops.org (phppp's P) |
|
70 | -define('ALTSYS_CORE_TYPE_X25', 11) ; // 2.5 from xoops.org |
|
71 | -define('ALTSYS_CORE_TYPE_ICMS', 12) ; // ImpressCMS |
|
72 | -define('ALTSYS_CORE_TYPE_XCL21', 16) ; // XOOPS Cube 2.1 Legacy |
|
65 | +define('ALTSYS_CORE_TYPE_X20', 1); // 2.0.0-2.0.13 and 2.0.x-JP |
|
66 | +define('ALTSYS_CORE_TYPE_X20S', 2); // 2.0.14- from xoops.org (Skalpa's S) |
|
67 | +define('ALTSYS_CORE_TYPE_ORE', 4); // ORETEKI by marijuana |
|
68 | +define('ALTSYS_CORE_TYPE_X22', 8); // 2.2 from xoops.org |
|
69 | +define('ALTSYS_CORE_TYPE_X23P', 10); // 2.3 from xoops.org (phppp's P) |
|
70 | +define('ALTSYS_CORE_TYPE_X25', 11); // 2.5 from xoops.org |
|
71 | +define('ALTSYS_CORE_TYPE_ICMS', 12); // ImpressCMS |
|
72 | +define('ALTSYS_CORE_TYPE_XCL21', 16); // XOOPS Cube 2.1 Legacy |
|
73 | 73 | |
74 | 74 | function altsys_get_core_type() |
75 | 75 | { |
76 | - static $result = null ; |
|
76 | + static $result = null; |
|
77 | 77 | |
78 | 78 | if (empty($result)) { |
79 | 79 | if (defined('XOOPS_ORETEKI')) { |
80 | - $result = ALTSYS_CORE_TYPE_ORE ; |
|
80 | + $result = ALTSYS_CORE_TYPE_ORE; |
|
81 | 81 | } elseif (defined('XOOPS_CUBE_LEGACY')) { |
82 | - $result = ALTSYS_CORE_TYPE_XCL21 ; |
|
82 | + $result = ALTSYS_CORE_TYPE_XCL21; |
|
83 | 83 | } elseif (defined('ICMS_VERSION_NAME')) { |
84 | - $result = ALTSYS_CORE_TYPE_ICMS ; |
|
84 | + $result = ALTSYS_CORE_TYPE_ICMS; |
|
85 | 85 | } elseif (strstr(XOOPS_VERSION, 'JP')) { |
86 | - $result = ALTSYS_CORE_TYPE_X20 ; |
|
86 | + $result = ALTSYS_CORE_TYPE_X20; |
|
87 | 87 | } else { |
88 | - $versions = array_map('intval', explode('.', preg_replace('/[^0-9.]/', '', XOOPS_VERSION))) ; |
|
88 | + $versions = array_map('intval', explode('.', preg_replace('/[^0-9.]/', '', XOOPS_VERSION))); |
|
89 | 89 | if ($versions[0] == 2 && $versions[1] == 2) { |
90 | - $result = ALTSYS_CORE_TYPE_X22 ; |
|
90 | + $result = ALTSYS_CORE_TYPE_X22; |
|
91 | 91 | } elseif ($versions[0] == 2 && $versions[1] == 0 && $versions[2] > 13) { |
92 | - $result = ALTSYS_CORE_TYPE_X20S ; |
|
92 | + $result = ALTSYS_CORE_TYPE_X20S; |
|
93 | 93 | } elseif ($versions[0] == 2 && $versions[1] >= 5) { |
94 | - $result = ALTSYS_CORE_TYPE_X25 ; |
|
94 | + $result = ALTSYS_CORE_TYPE_X25; |
|
95 | 95 | } elseif ($versions[0] == 2 && $versions[1] > 2) { |
96 | - $result = ALTSYS_CORE_TYPE_X23P ; |
|
96 | + $result = ALTSYS_CORE_TYPE_X23P; |
|
97 | 97 | } else { |
98 | - $result = ALTSYS_CORE_TYPE_X20 ; |
|
98 | + $result = ALTSYS_CORE_TYPE_X20; |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
102 | - return $result ; |
|
102 | + return $result; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -113,36 +113,36 @@ discard block |
||
113 | 113 | case ALTSYS_CORE_TYPE_X23P : |
114 | 114 | case ALTSYS_CORE_TYPE_ICMS : |
115 | 115 | default : |
116 | - return XOOPS_URL.'/modules/system/admin.php?fct=preferences&op=showmod&mod='.$mid ; |
|
116 | + return XOOPS_URL.'/modules/system/admin.php?fct=preferences&op=showmod&mod='.$mid; |
|
117 | 117 | case ALTSYS_CORE_TYPE_XCL21 : |
118 | - return XOOPS_URL.'/modules/legacy/admin/index.php?action=PreferenceEdit&confmod_id='.$mid ; |
|
118 | + return XOOPS_URL.'/modules/legacy/admin/index.php?action=PreferenceEdit&confmod_id='.$mid; |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
122 | 122 | |
123 | 123 | function altsys_template_touch($tpl_id) |
124 | 124 | { |
125 | - if (in_array(altsys_get_core_type(), array( ALTSYS_CORE_TYPE_X20S, ALTSYS_CORE_TYPE_X23P, ALTSYS_CORE_TYPE_X25 ))) { |
|
125 | + if (in_array(altsys_get_core_type(), array(ALTSYS_CORE_TYPE_X20S, ALTSYS_CORE_TYPE_X23P, ALTSYS_CORE_TYPE_X25))) { |
|
126 | 126 | // need to delete all files under templates_c/ |
127 | - altsys_clear_templates_c() ; |
|
127 | + altsys_clear_templates_c(); |
|
128 | 128 | } else { |
129 | 129 | // just touch the template |
130 | - xoops_template_touch($tpl_id) ; |
|
130 | + xoops_template_touch($tpl_id); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | 134 | |
135 | 135 | function altsys_clear_templates_c() |
136 | 136 | { |
137 | - $dh = opendir(XOOPS_COMPILE_PATH) ; |
|
137 | + $dh = opendir(XOOPS_COMPILE_PATH); |
|
138 | 138 | while ($file = readdir($dh)) { |
139 | 139 | if (substr($file, 0, 1) == '.') { |
140 | - continue ; |
|
140 | + continue; |
|
141 | 141 | } |
142 | 142 | if (substr($file, -4) != '.php') { |
143 | - continue ; |
|
143 | + continue; |
|
144 | 144 | } |
145 | - @unlink(XOOPS_COMPILE_PATH.'/'.$file) ; |
|
145 | + @unlink(XOOPS_COMPILE_PATH.'/'.$file); |
|
146 | 146 | } |
147 | - closedir($dh) ; |
|
147 | + closedir($dh); |
|
148 | 148 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
30 | 30 | // ------------------------------------------------------------------------ // |
31 | 31 | |
32 | -require_once dirname(__DIR__).'/class/AltsysBreadcrumbs.class.php' ; |
|
32 | +require_once dirname(__DIR__).'/class/AltsysBreadcrumbs.class.php'; |
|
33 | 33 | include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php'; |
34 | 34 | |
35 | 35 | $xoopsOption['theme_use_smarty'] = 1; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | //HACK by domifara |
59 | 59 | if (defined('XOOPS_CUBE_LEGACY')) { |
60 | 60 | $handler = xoops_gethandler('block'); |
61 | - $xoopsblock =& $handler->create(false) ; |
|
61 | + $xoopsblock = & $handler->create(false); |
|
62 | 62 | } else { |
63 | 63 | $xoopsblock = new XoopsBlock(); |
64 | 64 | } |
@@ -68,46 +68,46 @@ discard block |
||
68 | 68 | if (is_object($xoopsUser)) { |
69 | 69 | $xoopsTpl->assign(array('xoops_isuser' => true, 'xoops_userid' => $xoopsUser->getVar('uid'), 'xoops_uname' => $xoopsUser->getVar('uname'), 'xoops_isadmin' => $xoopsUserIsAdmin)); |
70 | 70 | if (is_object(@$xoopsModule)) { |
71 | - if ($xoopsModule->getVar('mid') == 1 && @$_GET['fct'] == 'preferences' && @$_GET['op'] == 'showmod' && ! empty($_GET['mod'])) { |
|
72 | - $module_handler = xoops_gethandler('module') ; |
|
73 | - $target_module = $module_handler->get((int)$_GET['mod']) ; |
|
71 | + if ($xoopsModule->getVar('mid') == 1 && @$_GET['fct'] == 'preferences' && @$_GET['op'] == 'showmod' && !empty($_GET['mod'])) { |
|
72 | + $module_handler = xoops_gethandler('module'); |
|
73 | + $target_module = $module_handler->get((int)$_GET['mod']); |
|
74 | 74 | } else { |
75 | - $target_module =& $xoopsModule ; |
|
75 | + $target_module = & $xoopsModule; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | // set page title |
79 | 79 | $xoopsTpl->assign(array('xoops_pagetitle' => $target_module->getVar('name'), 'xoops_modulename' => $target_module->getVar('name'), 'xoops_dirname' => $target_module->getVar('dirname'))); |
80 | 80 | |
81 | 81 | // xoops_breadcrumbs |
82 | - $breadcrumbsObj =& AltsysBreadcrumbs::getInstance() ; |
|
82 | + $breadcrumbsObj = & AltsysBreadcrumbs::getInstance(); |
|
83 | 83 | if ($breadcrumbsObj->hasPaths()) { |
84 | - $xoops_breadcrumbs = $breadcrumbsObj->getXoopsBreadcrumbs() ; |
|
84 | + $xoops_breadcrumbs = $breadcrumbsObj->getXoopsBreadcrumbs(); |
|
85 | 85 | } else { |
86 | - $mod_url = XOOPS_URL.'/modules/'.$target_module->getVar('dirname') ; |
|
87 | - $mod_path = XOOPS_ROOT_PATH.'/modules/'.$target_module->getVar('dirname') ; |
|
88 | - $modinfo = $target_module->getInfo() ; |
|
89 | - $xoops_breadcrumbs = array() ; |
|
90 | - if (! empty($modinfo['hasMain'])) { |
|
86 | + $mod_url = XOOPS_URL.'/modules/'.$target_module->getVar('dirname'); |
|
87 | + $mod_path = XOOPS_ROOT_PATH.'/modules/'.$target_module->getVar('dirname'); |
|
88 | + $modinfo = $target_module->getInfo(); |
|
89 | + $xoops_breadcrumbs = array(); |
|
90 | + if (!empty($modinfo['hasMain'])) { |
|
91 | 91 | $xoops_breadcrumbs[] = array( |
92 | - 'url' => $mod_url.'/' , |
|
92 | + 'url' => $mod_url.'/', |
|
93 | 93 | 'name' => sprintf(_MD_A_AINTHEME_FMT_PUBLICTOP, $target_module->getVar('name')) |
94 | - ) ; |
|
94 | + ); |
|
95 | 95 | } |
96 | - if (! empty($modinfo['adminindex'])) { |
|
96 | + if (!empty($modinfo['adminindex'])) { |
|
97 | 97 | $xoops_breadcrumbs[] = array( |
98 | - 'url' => $mod_url.'/'.$modinfo['adminindex'] , |
|
98 | + 'url' => $mod_url.'/'.$modinfo['adminindex'], |
|
99 | 99 | 'name' => sprintf(_MD_A_AINTHEME_FMT_ADMINTOP, $target_module->getVar('name')) |
100 | - ) ; |
|
100 | + ); |
|
101 | 101 | } |
102 | - if (! empty($GLOBALS['altsysAdminPageTitle'])) { |
|
103 | - $xoops_breadcrumbs[] = array( 'name' => htmlspecialchars($GLOBALS['altsysAdminPageTitle'], ENT_QUOTES) ) ; |
|
104 | - } elseif (! empty($modinfo['adminmenu'])) { |
|
105 | - @include $mod_path.'/'.$modinfo['adminmenu'] ; |
|
102 | + if (!empty($GLOBALS['altsysAdminPageTitle'])) { |
|
103 | + $xoops_breadcrumbs[] = array('name' => htmlspecialchars($GLOBALS['altsysAdminPageTitle'], ENT_QUOTES)); |
|
104 | + } elseif (!empty($modinfo['adminmenu'])) { |
|
105 | + @include $mod_path.'/'.$modinfo['adminmenu']; |
|
106 | 106 | if (is_array(@$adminmenu)) { |
107 | 107 | foreach ($adminmenu as $eachmenu) { |
108 | 108 | if (strstr($_SERVER['REQUEST_URI'], $eachmenu['link'])) { |
109 | - $xoops_breadcrumbs[] = array( 'name' => $eachmenu['title'] ) ; |
|
110 | - break ; |
|
109 | + $xoops_breadcrumbs[] = array('name' => $eachmenu['title']); |
|
110 | + break; |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | } |
@@ -116,21 +116,21 @@ discard block |
||
116 | 116 | |
117 | 117 | //$block_arr =& $xoopsblock->getAllByGroupModule($xoopsUser->getGroups(), $target_module->getVar('mid'), false, XOOPS_BLOCK_VISIBLE); |
118 | 118 | } else { |
119 | - $xoopsTpl->assign(array( 'xoops_pagetitle' => _CPHOME )) ; |
|
119 | + $xoopsTpl->assign(array('xoops_pagetitle' => _CPHOME)); |
|
120 | 120 | $xoops_breadcrumbs = array( |
121 | 121 | array( |
122 | - 'url' => XOOPS_URL.'/admin.php' , |
|
122 | + 'url' => XOOPS_URL.'/admin.php', |
|
123 | 123 | 'name' => _CPHOME |
124 | 124 | ) |
125 | - ) ; |
|
125 | + ); |
|
126 | 126 | } |
127 | 127 | } else { |
128 | - exit ; |
|
128 | + exit; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | // get block_arr |
132 | - $db = XoopsDatabaseFactory::getDatabaseConnection() ; |
|
133 | - $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()) . ')'; |
|
132 | + $db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
133 | + $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()).')'; |
|
134 | 134 | $result = $db->query($sql); |
135 | 135 | |
136 | 136 | $blockids = array(); |
@@ -138,30 +138,30 @@ discard block |
||
138 | 138 | $blockids[] = (int)$blockid; |
139 | 139 | } |
140 | 140 | |
141 | - global $block_arr , $i ; // for piCal :-) |
|
142 | - $block_arr = array() ; |
|
141 | + global $block_arr, $i; // for piCal :-) |
|
142 | + $block_arr = array(); |
|
143 | 143 | if (!empty($blockids)) { |
144 | - $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 |
|
145 | - . ' AND b.bid IN (' . implode(',', $blockids) . ') ORDER BY b.weight,b.bid' ; |
|
144 | + $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 |
|
145 | + . ' AND b.bid IN ('.implode(',', $blockids).') ORDER BY b.weight,b.bid'; |
|
146 | 146 | $result = $db->query($sql); |
147 | 147 | while ($myrow = $db->fetchArray($result)) { |
148 | 148 | |
149 | 149 | //HACK by domifara |
150 | 150 | if (defined('XOOPS_CUBE_LEGACY')) { |
151 | - $block =& $handler->create(false) ; |
|
151 | + $block = & $handler->create(false); |
|
152 | 152 | $block->assignVars($myrow); |
153 | 153 | } else { |
154 | - $block = new XoopsBlock($myrow) ; |
|
154 | + $block = new XoopsBlock($myrow); |
|
155 | 155 | } |
156 | 156 | |
157 | - $block_arr[ $myrow['bid'] ] = $block ; |
|
157 | + $block_arr[$myrow['bid']] = $block; |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
161 | - $adminmenublock_exists = false ; |
|
161 | + $adminmenublock_exists = false; |
|
162 | 162 | foreach (array_keys($block_arr) as $i) { |
163 | 163 | if ($block_arr[$i]->getVar('show_func') == 'b_altsys_admin_menu_show') { |
164 | - $adminmenublock_exists = true ; |
|
164 | + $adminmenublock_exists = true; |
|
165 | 165 | } |
166 | 166 | $bcachetime = $block_arr[$i]->getVar('bcachetime'); |
167 | 167 | if (empty($bcachetime)) { |
@@ -242,15 +242,15 @@ discard block |
||
242 | 242 | } |
243 | 243 | |
244 | 244 | // FALLBACK inserting admin_menu_block in admin side |
245 | - if (! $adminmenublock_exists) { |
|
246 | - require_once XOOPS_ROOT_PATH.'/modules/altsys/blocks/blocks.php' ; |
|
247 | - $admin_menu_block = array( b_altsys_admin_menu_show(array( 'altsys' )) ) ; |
|
248 | - $admin_menu_block[0]['title'] = 'Admin Menu' ; |
|
249 | - $lblocks =& $xoopsTpl->get_template_vars('xoops_lblocks') ; |
|
250 | - if (! is_array($lblocks)) { |
|
251 | - $lblocks = array() ; |
|
245 | + if (!$adminmenublock_exists) { |
|
246 | + require_once XOOPS_ROOT_PATH.'/modules/altsys/blocks/blocks.php'; |
|
247 | + $admin_menu_block = array(b_altsys_admin_menu_show(array('altsys'))); |
|
248 | + $admin_menu_block[0]['title'] = 'Admin Menu'; |
|
249 | + $lblocks = & $xoopsTpl->get_template_vars('xoops_lblocks'); |
|
250 | + if (!is_array($lblocks)) { |
|
251 | + $lblocks = array(); |
|
252 | 252 | } |
253 | - $xoopsTpl->assign('xoops_lblocks', array_merge($admin_menu_block, $lblocks)) ; |
|
253 | + $xoopsTpl->assign('xoops_lblocks', array_merge($admin_menu_block, $lblocks)); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | //unset($block_arr); |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once dirname(__DIR__).'/class/altsysUtils.class.php' ; |
|
2 | +require_once dirname(__DIR__).'/class/altsysUtils.class.php'; |
|
3 | 3 | |
4 | -define('ALTSYS_ADMINMENU_FILE', XOOPS_CACHE_PATH.'/adminmenu.php') ; |
|
5 | -define('ALTSYS_ADMINMENU_HACK_NONE', 0) ; |
|
6 | -define('ALTSYS_ADMINMENU_HACK_2COL', 1) ; |
|
7 | -define('ALTSYS_ADMINMENU_HACK_NOIMG', 2) ; |
|
8 | -define('ALTSYS_ADMINMENU_HACK_XCSTY', 3) ; |
|
4 | +define('ALTSYS_ADMINMENU_FILE', XOOPS_CACHE_PATH.'/adminmenu.php'); |
|
5 | +define('ALTSYS_ADMINMENU_HACK_NONE', 0); |
|
6 | +define('ALTSYS_ADMINMENU_HACK_2COL', 1); |
|
7 | +define('ALTSYS_ADMINMENU_HACK_NOIMG', 2); |
|
8 | +define('ALTSYS_ADMINMENU_HACK_XCSTY', 3); |
|
9 | 9 | |
10 | 10 | |
11 | 11 | // |
@@ -13,73 +13,73 @@ discard block |
||
13 | 13 | // |
14 | 14 | function altsys_adminmenu_insert_mymenu(&$module) |
15 | 15 | { |
16 | - global $altsysModuleConfig ; |
|
16 | + global $altsysModuleConfig; |
|
17 | 17 | |
18 | 18 | if (empty($altsysModuleConfig['adminmenu_insert_mymenu'])) { |
19 | - return ; |
|
19 | + return; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | if (altsys_get_core_type() < ALTSYS_CORE_TYPE_ORE) { |
23 | - altsys_adminmenu_insert_mymenu_x20($module) ; |
|
23 | + altsys_adminmenu_insert_mymenu_x20($module); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | |
27 | 27 | function altsys_adminmenu_insert_mymenu_x20(&$module) |
28 | 28 | { |
29 | 29 | // read |
30 | - if (! file_exists(ALTSYS_ADMINMENU_FILE)) { |
|
31 | - redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu') ; |
|
32 | - exit ; |
|
30 | + if (!file_exists(ALTSYS_ADMINMENU_FILE)) { |
|
31 | + redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu'); |
|
32 | + exit; |
|
33 | 33 | } |
34 | - $not_inside_cp_functions = true ; |
|
35 | - include ALTSYS_ADMINMENU_FILE ; |
|
34 | + $not_inside_cp_functions = true; |
|
35 | + include ALTSYS_ADMINMENU_FILE; |
|
36 | 36 | |
37 | - $dirname = $module->getVar('dirname') ; |
|
38 | - $mid = $module->getVar('mid') ; |
|
39 | - $anchor = '<!-- ALTSYS ANCHOR '.$dirname.' -->' ; |
|
37 | + $dirname = $module->getVar('dirname'); |
|
38 | + $mid = $module->getVar('mid'); |
|
39 | + $anchor = '<!-- ALTSYS ANCHOR '.$dirname.' -->'; |
|
40 | 40 | |
41 | 41 | // fetch popup_no |
42 | 42 | if (empty($xoops_admin_menu_ft[$mid])) { |
43 | - return ; |
|
43 | + return; |
|
44 | 44 | } |
45 | - if (! preg_match('/popUpL(\d+)/', $xoops_admin_menu_ft[$mid], $regs)) { |
|
46 | - return ; |
|
45 | + if (!preg_match('/popUpL(\d+)/', $xoops_admin_menu_ft[$mid], $regs)) { |
|
46 | + return; |
|
47 | 47 | } |
48 | 48 | $popup_no = (int)$regs[1]; |
49 | 49 | |
50 | 50 | // replace |
51 | - $search = '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' /> <a href=\''.XOOPS_URL.'/modules/system/admin.php?fct=preferences&op=showmod&mod='.$mid.'\'' ; |
|
52 | - $replace = $anchor.'<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' /> <a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&lib=altsys&page=mypreferences\'' ; |
|
51 | + $search = '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' /> <a href=\''.XOOPS_URL.'/modules/system/admin.php?fct=preferences&op=showmod&mod='.$mid.'\''; |
|
52 | + $replace = $anchor.'<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' /> <a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&lib=altsys&page=mypreferences\''; |
|
53 | 53 | |
54 | 54 | // do replacement |
55 | - $new_xoops_admin_menu_dv = preg_replace('#'.preg_quote($search).'#', $replace, $xoops_admin_menu_dv) ; |
|
55 | + $new_xoops_admin_menu_dv = preg_replace('#'.preg_quote($search).'#', $replace, $xoops_admin_menu_dv); |
|
56 | 56 | |
57 | 57 | if ($xoops_admin_menu_dv == $new_xoops_admin_menu_dv) { |
58 | - return ; |
|
58 | + return; |
|
59 | 59 | } |
60 | - $xoops_admin_menu_dv = $new_xoops_admin_menu_dv ; |
|
60 | + $xoops_admin_menu_dv = $new_xoops_admin_menu_dv; |
|
61 | 61 | |
62 | - $insert = '' ; |
|
62 | + $insert = ''; |
|
63 | 63 | |
64 | 64 | // insert blocksadmin |
65 | 65 | if ($dirname != 'altsys') { |
66 | - $blocksadmin_title = defined('_MD_A_MYMENU_MYBLOCKSADMIN') ? _MD_A_MYMENU_MYBLOCKSADMIN : 'blocksadmin' ; |
|
67 | - $insert .= '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' /> <a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin\'>'.$blocksadmin_title.'</a><br />'."\n" ; |
|
66 | + $blocksadmin_title = defined('_MD_A_MYMENU_MYBLOCKSADMIN') ? _MD_A_MYMENU_MYBLOCKSADMIN : 'blocksadmin'; |
|
67 | + $insert .= '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' /> <a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin\'>'.$blocksadmin_title.'</a><br />'."\n"; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // insert tplsadmin |
71 | - $db = XoopsDatabaseFactory::getDatabaseConnection() ; |
|
72 | - list($count) = $db->fetchRow($db->query('SELECT COUNT(*) FROM ' . $db->prefix('tplfile') . " WHERE tpl_module='$dirname'")) ; |
|
71 | + $db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
72 | + list($count) = $db->fetchRow($db->query('SELECT COUNT(*) FROM '.$db->prefix('tplfile')." WHERE tpl_module='$dirname'")); |
|
73 | 73 | if ($count > 0) { |
74 | - $tplsadmin_title = defined('_MD_A_MYMENU_MYTPLSADMIN') ? _MD_A_MYMENU_MYTPLSADMIN : 'tplsadmin' ; |
|
75 | - $insert = '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' /> <a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin\'>'.$tplsadmin_title.'</a><br />'."\n".$insert ; |
|
74 | + $tplsadmin_title = defined('_MD_A_MYMENU_MYTPLSADMIN') ? _MD_A_MYMENU_MYTPLSADMIN : 'tplsadmin'; |
|
75 | + $insert = '<img src=\''.XOOPS_URL.'/images/pointer.gif\' width=\'8\' height=\'8\' alt=\'\' /> <a href=\''.XOOPS_URL.'/modules/'.$dirname.'/admin/index.php?mode=admin&lib=altsys&page=mytplsadmin\'>'.$tplsadmin_title.'</a><br />'."\n".$insert; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | // do insertion |
79 | - $xoops_admin_menu_dv = preg_replace('#'.preg_quote($anchor).'#', $anchor.$insert, $xoops_admin_menu_dv) ; |
|
79 | + $xoops_admin_menu_dv = preg_replace('#'.preg_quote($anchor).'#', $anchor.$insert, $xoops_admin_menu_dv); |
|
80 | 80 | |
81 | 81 | // write back |
82 | - altsys_adminmenu_save_x20(array( 'xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => (int)(@$altsys_adminmenu_ft_hacked), 'altsys_adminmenu_dv_updated' => true )) ; |
|
82 | + altsys_adminmenu_save_x20(array('xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => (int)(@$altsys_adminmenu_ft_hacked), 'altsys_adminmenu_dv_updated' => true)); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | // |
@@ -87,184 +87,184 @@ discard block |
||
87 | 87 | // |
88 | 88 | function altsys_adminmenu_hack_ft() |
89 | 89 | { |
90 | - global $altsysModuleConfig ; |
|
90 | + global $altsysModuleConfig; |
|
91 | 91 | |
92 | 92 | if (altsys_get_core_type() >= ALTSYS_CORE_TYPE_ORE) { |
93 | - return ; |
|
93 | + return; |
|
94 | 94 | } |
95 | 95 | if (empty($altsysModuleConfig['adminmenu_hack_ft'])) { |
96 | - return ; |
|
96 | + return; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | if ($altsysModuleConfig['adminmenu_hack_ft'] == ALTSYS_ADMINMENU_HACK_2COL) { |
100 | - altsys_adminmenu_hack_ft_2col_x20() ; |
|
100 | + altsys_adminmenu_hack_ft_2col_x20(); |
|
101 | 101 | } elseif ($altsysModuleConfig['adminmenu_hack_ft'] == ALTSYS_ADMINMENU_HACK_NOIMG) { |
102 | - altsys_adminmenu_hack_ft_noimg_x20() ; |
|
102 | + altsys_adminmenu_hack_ft_noimg_x20(); |
|
103 | 103 | } elseif ($altsysModuleConfig['adminmenu_hack_ft'] == ALTSYS_ADMINMENU_HACK_XCSTY) { |
104 | - altsys_adminmenu_hack_ft_xcsty_x20() ; |
|
104 | + altsys_adminmenu_hack_ft_xcsty_x20(); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | 108 | function altsys_adminmenu_hack_ft_2col_x20() |
109 | 109 | { |
110 | 110 | // read |
111 | - if (! file_exists(ALTSYS_ADMINMENU_FILE)) { |
|
112 | - redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu') ; |
|
113 | - exit ; |
|
111 | + if (!file_exists(ALTSYS_ADMINMENU_FILE)) { |
|
112 | + redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu'); |
|
113 | + exit; |
|
114 | 114 | } |
115 | - $not_inside_cp_functions = true ; |
|
116 | - include ALTSYS_ADMINMENU_FILE ; |
|
115 | + $not_inside_cp_functions = true; |
|
116 | + include ALTSYS_ADMINMENU_FILE; |
|
117 | 117 | |
118 | 118 | // check previous hack |
119 | - if (! empty($altsys_adminmenu_ft_hacked)) { |
|
119 | + if (!empty($altsys_adminmenu_ft_hacked)) { |
|
120 | 120 | if ($altsys_adminmenu_ft_hacked == ALTSYS_ADMINMENU_HACK_2COL) { |
121 | 121 | // skip |
122 | - return ; |
|
122 | + return; |
|
123 | 123 | } else { |
124 | 124 | // rebuild adminmenu |
125 | - require_once XOOPS_ROOT_PATH.'/include/cp_functions.php' ; |
|
126 | - xoops_module_write_admin_menu(xoops_module_get_admin_menu()) ; |
|
125 | + require_once XOOPS_ROOT_PATH.'/include/cp_functions.php'; |
|
126 | + xoops_module_write_admin_menu(xoops_module_get_admin_menu()); |
|
127 | 127 | // backup $xoops_admin_menu_dv |
128 | - $backup_admin_menu_dv = $xoops_admin_menu_dv ; |
|
128 | + $backup_admin_menu_dv = $xoops_admin_menu_dv; |
|
129 | 129 | // include new adminmenu |
130 | - include ALTSYS_ADMINMENU_FILE ; |
|
130 | + include ALTSYS_ADMINMENU_FILE; |
|
131 | 131 | // restore $xoops_admin_menu_dv |
132 | - $xoops_admin_menu_dv = $backup_admin_menu_dv ; |
|
132 | + $xoops_admin_menu_dv = $backup_admin_menu_dv; |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | - $search = ' alt=\'\' /></a><br />' ; |
|
137 | - $replace_fmt = ' alt="%s" /></a>' ; |
|
136 | + $search = ' alt=\'\' /></a><br />'; |
|
137 | + $replace_fmt = ' alt="%s" /></a>'; |
|
138 | 138 | |
139 | - $is_left = true ; |
|
140 | - $module_handler = xoops_gethandler('module') ; |
|
141 | - $mids = array_keys($xoops_admin_menu_ft) ; |
|
142 | - $last_mid = $mids[count($mids) - 1 ] ; |
|
139 | + $is_left = true; |
|
140 | + $module_handler = xoops_gethandler('module'); |
|
141 | + $mids = array_keys($xoops_admin_menu_ft); |
|
142 | + $last_mid = $mids[count($mids) - 1]; |
|
143 | 143 | foreach ($mids as $mid) { |
144 | - $module = $module_handler->get($mid) ; |
|
145 | - $new_menu_ft = preg_replace('#'.preg_quote($search).'#', sprintf($replace_fmt, $module->getVar('name')), $xoops_admin_menu_ft[$mid]) ; |
|
144 | + $module = $module_handler->get($mid); |
|
145 | + $new_menu_ft = preg_replace('#'.preg_quote($search).'#', sprintf($replace_fmt, $module->getVar('name')), $xoops_admin_menu_ft[$mid]); |
|
146 | 146 | if ($is_left) { |
147 | 147 | if ($mid == $last_mid) { |
148 | - $xoops_admin_menu_ft[$mid] = $new_menu_ft . '</td><td>' ; |
|
148 | + $xoops_admin_menu_ft[$mid] = $new_menu_ft.'</td><td>'; |
|
149 | 149 | } else { |
150 | - $left_body = $new_menu_ft ; |
|
151 | - $left_key = $mid ; |
|
152 | - $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',85);', $xoops_admin_menu_ml[$mid]) ; |
|
150 | + $left_body = $new_menu_ft; |
|
151 | + $left_key = $mid; |
|
152 | + $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',85);', $xoops_admin_menu_ml[$mid]); |
|
153 | 153 | } |
154 | 154 | } else { |
155 | - $xoops_admin_menu_ft[$mid] = $left_body . '</td><td>' . $new_menu_ft ; |
|
156 | - unset($xoops_admin_menu_ft[$left_key]) ; |
|
157 | - $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',185);', $xoops_admin_menu_ml[$mid]) ; |
|
155 | + $xoops_admin_menu_ft[$mid] = $left_body.'</td><td>'.$new_menu_ft; |
|
156 | + unset($xoops_admin_menu_ft[$left_key]); |
|
157 | + $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',185);', $xoops_admin_menu_ml[$mid]); |
|
158 | 158 | } |
159 | - $is_left = ! $is_left ; |
|
159 | + $is_left = !$is_left; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | // write back |
163 | - altsys_adminmenu_save_x20(array( 'xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_2COL )) ; |
|
163 | + altsys_adminmenu_save_x20(array('xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_2COL)); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
167 | 167 | function altsys_adminmenu_hack_ft_noimg_x20() |
168 | 168 | { |
169 | 169 | // read |
170 | - if (! file_exists(ALTSYS_ADMINMENU_FILE)) { |
|
171 | - redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu') ; |
|
172 | - exit ; |
|
170 | + if (!file_exists(ALTSYS_ADMINMENU_FILE)) { |
|
171 | + redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu'); |
|
172 | + exit; |
|
173 | 173 | } |
174 | - $not_inside_cp_functions = true ; |
|
175 | - include ALTSYS_ADMINMENU_FILE ; |
|
174 | + $not_inside_cp_functions = true; |
|
175 | + include ALTSYS_ADMINMENU_FILE; |
|
176 | 176 | |
177 | 177 | // check previous hack |
178 | - if (! empty($altsys_adminmenu_ft_hacked)) { |
|
178 | + if (!empty($altsys_adminmenu_ft_hacked)) { |
|
179 | 179 | if ($altsys_adminmenu_ft_hacked == ALTSYS_ADMINMENU_HACK_NOIMG) { |
180 | 180 | // skip |
181 | - return ; |
|
181 | + return; |
|
182 | 182 | } else { |
183 | 183 | // rebuild adminmenu |
184 | - require_once XOOPS_ROOT_PATH.'/include/cp_functions.php' ; |
|
185 | - xoops_module_write_admin_menu(xoops_module_get_admin_menu()) ; |
|
184 | + require_once XOOPS_ROOT_PATH.'/include/cp_functions.php'; |
|
185 | + xoops_module_write_admin_menu(xoops_module_get_admin_menu()); |
|
186 | 186 | // backup $xoops_admin_menu_dv |
187 | - $backup_admin_menu_dv = $xoops_admin_menu_dv ; |
|
187 | + $backup_admin_menu_dv = $xoops_admin_menu_dv; |
|
188 | 188 | // include new adminmenu |
189 | - include ALTSYS_ADMINMENU_FILE ; |
|
189 | + include ALTSYS_ADMINMENU_FILE; |
|
190 | 190 | // restore $xoops_admin_menu_dv |
191 | - $xoops_admin_menu_dv = $backup_admin_menu_dv ; |
|
191 | + $xoops_admin_menu_dv = $backup_admin_menu_dv; |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
195 | - $module_handler = xoops_gethandler('module') ; |
|
196 | - $mids = array_keys($xoops_admin_menu_ft) ; |
|
195 | + $module_handler = xoops_gethandler('module'); |
|
196 | + $mids = array_keys($xoops_admin_menu_ft); |
|
197 | 197 | foreach ($mids as $mid) { |
198 | - $module = $module_handler->get($mid) ; |
|
199 | - $xoops_admin_menu_ft[$mid] = preg_replace('/\<img src\=.*$/', $module->getVar('name').'</a>', $xoops_admin_menu_ft[$mid]) ; |
|
200 | - $xoops_admin_menu_ft[$mid] = '<div style="text-align:'._GLOBAL_LEFT.';background-color:#CCC;" title="'.$module->getVar('dirname').'">'.$xoops_admin_menu_ft[$mid].'</div>' ; |
|
201 | - $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',45);', $xoops_admin_menu_ml[$mid]) ; |
|
198 | + $module = $module_handler->get($mid); |
|
199 | + $xoops_admin_menu_ft[$mid] = preg_replace('/\<img src\=.*$/', $module->getVar('name').'</a>', $xoops_admin_menu_ft[$mid]); |
|
200 | + $xoops_admin_menu_ft[$mid] = '<div style="text-align:'._GLOBAL_LEFT.';background-color:#CCC;" title="'.$module->getVar('dirname').'">'.$xoops_admin_menu_ft[$mid].'</div>'; |
|
201 | + $xoops_admin_menu_ml[$mid] = str_replace(',105);', ',45);', $xoops_admin_menu_ml[$mid]); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | // write back |
205 | - altsys_adminmenu_save_x20(array( 'xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_NOIMG )) ; |
|
205 | + altsys_adminmenu_save_x20(array('xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => $xoops_admin_menu_ml, 'xoops_admin_menu_sd' => $xoops_admin_menu_sd, 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_NOIMG)); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
209 | 209 | function altsys_adminmenu_hack_ft_xcsty_x20() |
210 | 210 | { |
211 | 211 | // read |
212 | - if (! file_exists(ALTSYS_ADMINMENU_FILE)) { |
|
213 | - redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu') ; |
|
214 | - exit ; |
|
212 | + if (!file_exists(ALTSYS_ADMINMENU_FILE)) { |
|
213 | + redirect_header(XOOPS_URL.'/admin.php', 1, 'Rebuild adminmenu'); |
|
214 | + exit; |
|
215 | 215 | } |
216 | - $not_inside_cp_functions = true ; |
|
217 | - include ALTSYS_ADMINMENU_FILE ; |
|
216 | + $not_inside_cp_functions = true; |
|
217 | + include ALTSYS_ADMINMENU_FILE; |
|
218 | 218 | |
219 | 219 | // check previous hack |
220 | - if (! empty($altsys_adminmenu_ft_hacked)) { |
|
220 | + if (!empty($altsys_adminmenu_ft_hacked)) { |
|
221 | 221 | if ($altsys_adminmenu_ft_hacked == ALTSYS_ADMINMENU_HACK_XCSTY && empty($altsys_adminmenu_dv_updated)) { |
222 | 222 | // skip |
223 | - return ; |
|
223 | + return; |
|
224 | 224 | } else { |
225 | 225 | // rebuild adminmenu |
226 | - require_once XOOPS_ROOT_PATH.'/include/cp_functions.php' ; |
|
227 | - $fp = fopen(ALTSYS_ADMINMENU_FILE, 'wb') ; |
|
228 | - fwrite($fp, xoops_module_get_admin_menu()) ; |
|
229 | - fclose($fp) ; |
|
226 | + require_once XOOPS_ROOT_PATH.'/include/cp_functions.php'; |
|
227 | + $fp = fopen(ALTSYS_ADMINMENU_FILE, 'wb'); |
|
228 | + fwrite($fp, xoops_module_get_admin_menu()); |
|
229 | + fclose($fp); |
|
230 | 230 | // backup $xoops_admin_menu_dv |
231 | - $backup_admin_menu_dv = $xoops_admin_menu_dv ; |
|
231 | + $backup_admin_menu_dv = $xoops_admin_menu_dv; |
|
232 | 232 | // include new adminmenu |
233 | - include ALTSYS_ADMINMENU_FILE ; |
|
233 | + include ALTSYS_ADMINMENU_FILE; |
|
234 | 234 | // restore $xoops_admin_menu_dv |
235 | - $xoops_admin_menu_dv = $backup_admin_menu_dv ; |
|
235 | + $xoops_admin_menu_dv = $backup_admin_menu_dv; |
|
236 | 236 | } |
237 | 237 | } |
238 | 238 | |
239 | - $module_handler = xoops_gethandler('module') ; |
|
240 | - $mids = array_keys($xoops_admin_menu_ft) ; |
|
239 | + $module_handler = xoops_gethandler('module'); |
|
240 | + $mids = array_keys($xoops_admin_menu_ft); |
|
241 | 241 | foreach ($mids as $mid) { |
242 | - $module = $module_handler->get($mid) ; |
|
243 | - $submenuitems = array() ; |
|
242 | + $module = $module_handler->get($mid); |
|
243 | + $submenuitems = array(); |
|
244 | 244 | if (preg_match('/popUpL\d+/', $xoops_admin_menu_ft[$mid], $regs)) { |
245 | - $popup = $regs[0] ; |
|
246 | - preg_match_all('#\<a href.*'.$popup.'\(\).*\</a>#U', $xoops_admin_menu_dv, $regs) ; |
|
245 | + $popup = $regs[0]; |
|
246 | + preg_match_all('#\<a href.*'.$popup.'\(\).*\</a>#U', $xoops_admin_menu_dv, $regs); |
|
247 | 247 | foreach ($regs[0] as $submenuitem) { |
248 | - $submenuitems[] = str_replace($popup.'();', '', $submenuitem) ; |
|
248 | + $submenuitems[] = str_replace($popup.'();', '', $submenuitem); |
|
249 | 249 | } |
250 | 250 | } else { |
251 | - return ; |
|
251 | + return; |
|
252 | 252 | } |
253 | 253 | // module icon |
254 | 254 | if (preg_match('#\<img .*/\>#U', $xoops_admin_menu_ft[$mid], $regs)) { |
255 | - $icon_img = str_replace("alt=''", 'alt="'.$module->getVar('name').'"', $regs[0]) ; |
|
255 | + $icon_img = str_replace("alt=''", 'alt="'.$module->getVar('name').'"', $regs[0]); |
|
256 | 256 | } else { |
257 | - $icon_img = '' ; |
|
257 | + $icon_img = ''; |
|
258 | 258 | } |
259 | 259 | // version number |
260 | - $icon_img .= '<span class="version" style="">' . sprintf('%.2f', $module->getVar('version') / 100.0) . '</span>' ; |
|
261 | - $newline = preg_replace('/ onmouseover.*$/', '', $xoops_admin_menu_ft[$mid]) ; |
|
262 | - $newline = "\n".'<!-- '.$popup.' --><div id="adminmenu_ft'.$mid.'" style="text-align:'._GLOBAL_LEFT.';background-color:#CCC;" title="'.$module->getVar('dirname').'"><a id="adminmenu_ftpoint'.$mid.'" href="javascript:void(0);" onclick="submenuToggle('.$mid.');">+</a> '.$newline.'>'.$module->getVar('name').'</a></div><div id="adminmenu_ftsub'.$mid.'" style="display:none;"><ul>' ; |
|
260 | + $icon_img .= '<span class="version" style="">'.sprintf('%.2f', $module->getVar('version') / 100.0).'</span>'; |
|
261 | + $newline = preg_replace('/ onmouseover.*$/', '', $xoops_admin_menu_ft[$mid]); |
|
262 | + $newline = "\n".'<!-- '.$popup.' --><div id="adminmenu_ft'.$mid.'" style="text-align:'._GLOBAL_LEFT.';background-color:#CCC;" title="'.$module->getVar('dirname').'"><a id="adminmenu_ftpoint'.$mid.'" href="javascript:void(0);" onclick="submenuToggle('.$mid.');">+</a> '.$newline.'>'.$module->getVar('name').'</a></div><div id="adminmenu_ftsub'.$mid.'" style="display:none;"><ul>'; |
|
263 | 263 | foreach ($submenuitems as $submenuitem) { |
264 | - $newline .= '<li>'.$submenuitem.'</li>' ; |
|
264 | + $newline .= '<li>'.$submenuitem.'</li>'; |
|
265 | 265 | } |
266 | - $newline .= '</ul>'.$icon_img.'</div>' ; |
|
267 | - $xoops_admin_menu_ft[$mid] = $newline ; |
|
266 | + $newline .= '</ul>'.$icon_img.'</div>'; |
|
267 | + $xoops_admin_menu_ft[$mid] = $newline; |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | $xoops_admin_menu_js = " |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | }" ; |
281 | 281 | |
282 | 282 | // write back |
283 | - altsys_adminmenu_save_x20(array( 'xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => array(), 'xoops_admin_menu_sd' => array(), 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_XCSTY )) ; |
|
283 | + altsys_adminmenu_save_x20(array('xoops_admin_menu_js' => $xoops_admin_menu_js, 'xoops_admin_menu_ml' => array(), 'xoops_admin_menu_sd' => array(), 'xoops_admin_menu_ft' => $xoops_admin_menu_ft, 'xoops_admin_menu_dv' => $xoops_admin_menu_dv, 'altsys_adminmenu_ft_hacked' => ALTSYS_ADMINMENU_HACK_XCSTY)); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | |
@@ -291,18 +291,18 @@ discard block |
||
291 | 291 | function altsys_adminmenu_save_x20($xoops_admin_vars) |
292 | 292 | { |
293 | 293 | // variable definitions |
294 | - ob_start() ; |
|
295 | - echo "<?php\n// modified by altsys\nif( ! defined('XOOPS_ROOT_PATH') ) exit ;\n" ; |
|
294 | + ob_start(); |
|
295 | + echo "<?php\n// modified by altsys\nif( ! defined('XOOPS_ROOT_PATH') ) exit ;\n"; |
|
296 | 296 | foreach ($xoops_admin_vars as $key => $val) { |
297 | - echo '$' . $key . " = \n" ; |
|
298 | - @var_export($val) ; |
|
299 | - echo " ;\n" ; |
|
297 | + echo '$'.$key." = \n"; |
|
298 | + @var_export($val); |
|
299 | + echo " ;\n"; |
|
300 | 300 | } |
301 | - $output = ob_get_contents() ; |
|
302 | - ob_end_clean() ; |
|
301 | + $output = ob_get_contents(); |
|
302 | + ob_end_clean(); |
|
303 | 303 | |
304 | 304 | // embedding logics |
305 | - if (in_array(@$xoops_admin_vars['altsys_adminmenu_ft_hacked'], array( ALTSYS_ADMINMENU_HACK_NOIMG, ALTSYS_ADMINMENU_HACK_XCSTY ))) { |
|
305 | + if (in_array(@$xoops_admin_vars['altsys_adminmenu_ft_hacked'], array(ALTSYS_ADMINMENU_HACK_NOIMG, ALTSYS_ADMINMENU_HACK_XCSTY))) { |
|
306 | 306 | $output .= ' |
307 | 307 | |
308 | 308 | if( is_object( @$GLOBALS["xoopsModule"] ) && empty( $not_inside_cp_functions ) ) { |
@@ -317,13 +317,13 @@ discard block |
||
317 | 317 | } |
318 | 318 | |
319 | 319 | // termination |
320 | - $output .= "\n\n?>" ; |
|
320 | + $output .= "\n\n?>"; |
|
321 | 321 | |
322 | 322 | // replace into XOOPS_URL |
323 | - $output = str_replace(XOOPS_URL, "'.XOOPS_URL.'", $output) ; |
|
323 | + $output = str_replace(XOOPS_URL, "'.XOOPS_URL.'", $output); |
|
324 | 324 | |
325 | 325 | // output |
326 | - $fp = fopen(ALTSYS_ADMINMENU_FILE, 'wb') ; |
|
327 | - fwrite($fp, $output) ; |
|
328 | - fclose($fp) ; |
|
326 | + $fp = fopen(ALTSYS_ADMINMENU_FILE, 'wb'); |
|
327 | + fwrite($fp, $output); |
|
328 | + fclose($fp); |
|
329 | 329 | } |