Completed
Push — master ( 99eb82...6dab8b )
by Michael
19s
created
xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php 1 patch
Spacing   +353 added lines, -353 removed lines patch added patch discarded remove patch
@@ -3,16 +3,16 @@  discard block
 block discarded – undo
3 3
 
4 4
 class MyBlocksAdmin
5 5
 {
6
-    public $db ;
7
-    public $lang ;
8
-    public $cachetime_options = array() ;
9
-    public $ctype_options = array() ;
10
-    public $type_options = array() ;
11
-    public $target_mid = 0 ;
12
-    public $target_dirname = '' ;
13
-    public $target_mname = '' ;
14
-    public $block_configs = array() ;
15
-    public $preview_request = array() ;
6
+    public $db;
7
+    public $lang;
8
+    public $cachetime_options = array();
9
+    public $ctype_options = array();
10
+    public $type_options = array();
11
+    public $target_mid = 0;
12
+    public $target_dirname = '';
13
+    public $target_mname = '';
14
+    public $block_configs = array();
15
+    public $preview_request = array();
16 16
 
17 17
     public function MyBlocksAadmin()
18 18
     {
@@ -21,37 +21,37 @@  discard block
 block discarded – undo
21 21
 
22 22
     public function construct()
23 23
     {
24
-        $this->db = XoopsDatabaseFactory::getDatabaseConnection() ;
25
-        $this->lang = @$GLOBALS['xoopsConfig']['language'] ;
24
+        $this->db = XoopsDatabaseFactory::getDatabaseConnection();
25
+        $this->lang = @$GLOBALS['xoopsConfig']['language'];
26 26
 
27 27
         $this->cachetime_options = array(
28
-        0 => _NOCACHE ,
29
-        30 => sprintf(_SECONDS, 30) ,
30
-        60 => _MINUTE ,
31
-        300 => sprintf(_MINUTES, 5) ,
32
-        1800 => sprintf(_MINUTES, 30) ,
33
-        3600 => _HOUR ,
34
-        18000 => sprintf(_HOURS, 5) ,
35
-        86400 => _DAY ,
36
-        259200 => sprintf(_DAYS, 3) ,
37
-        604800 => _WEEK ,
28
+        0 => _NOCACHE,
29
+        30 => sprintf(_SECONDS, 30),
30
+        60 => _MINUTE,
31
+        300 => sprintf(_MINUTES, 5),
32
+        1800 => sprintf(_MINUTES, 30),
33
+        3600 => _HOUR,
34
+        18000 => sprintf(_HOURS, 5),
35
+        86400 => _DAY,
36
+        259200 => sprintf(_DAYS, 3),
37
+        604800 => _WEEK,
38 38
         2592000 => _MONTH
39 39
     );
40 40
 
41 41
         $this->ctype_options = array(
42
-        'H' => _MD_A_MYBLOCKSADMIN_CTYPE_HTML ,
43
-        'T' => _MD_A_MYBLOCKSADMIN_CTYPE_NOSMILE ,
44
-        'S' => _MD_A_MYBLOCKSADMIN_CTYPE_SMILE ,
42
+        'H' => _MD_A_MYBLOCKSADMIN_CTYPE_HTML,
43
+        'T' => _MD_A_MYBLOCKSADMIN_CTYPE_NOSMILE,
44
+        'S' => _MD_A_MYBLOCKSADMIN_CTYPE_SMILE,
45 45
         'P' => _MD_A_MYBLOCKSADMIN_CTYPE_PHP
46
-    ) ;
46
+    );
47 47
 
48 48
         $this->type_options = array(
49
-        'C' => 'custom block' ,
50
-        'E' => 'cloned custom block' ,
51
-        'M' => 'module\'s block' ,
52
-        'D' => 'cloned module\'s block' ,
49
+        'C' => 'custom block',
50
+        'E' => 'cloned custom block',
51
+        'M' => 'module\'s block',
52
+        'D' => 'cloned module\'s block',
53 53
         'S' => 'system block'
54
-    ) ;
54
+    );
55 55
     }
56 56
 
57 57
 //HACK by domifara for php5.3+
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 {
61 61
     static $instance;
62 62
     if (!isset($instance)) {
63
-        $instance = new MyBlocksAdmin() ;
64
-        $instance->construct() ;
63
+        $instance = new MyBlocksAdmin();
64
+        $instance->construct();
65 65
     }
66 66
     return $instance;
67 67
 }
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
 public function checkPermission()
72 72
 {
73 73
     // only groups have 'module_admin' of 'altsys' can do that.
74
-    $module_handler = xoops_getHandler('module') ;
75
-    $module = $module_handler->getByDirname('altsys') ;
76
-    $moduleperm_handler = xoops_getHandler('groupperm') ;
77
-    if (! is_object(@$GLOBALS['xoopsUser']) || ! $moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $GLOBALS['xoopsUser']->getGroups())) {
78
-        die('only admin of altsys can access this area') ;
74
+    $module_handler = xoops_getHandler('module');
75
+    $module = $module_handler->getByDirname('altsys');
76
+    $moduleperm_handler = xoops_getHandler('groupperm');
77
+    if (!is_object(@$GLOBALS['xoopsUser']) || !$moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $GLOBALS['xoopsUser']->getGroups())) {
78
+        die('only admin of altsys can access this area');
79 79
     }
80 80
 }
81 81
 
@@ -86,52 +86,52 @@  discard block
 block discarded – undo
86 86
     if ($xoopsModule->getVar('dirname') == 'altsys') {
87 87
         // set target_module if specified by $_GET['dirname']
88 88
         $module_handler = xoops_getHandler('module');
89
-        if (! empty($_GET['dirname'])) {
90
-            $dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', $_GET['dirname']) ;
91
-            $target_module = $module_handler->getByDirname($dirname) ;
89
+        if (!empty($_GET['dirname'])) {
90
+            $dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', $_GET['dirname']);
91
+            $target_module = $module_handler->getByDirname($dirname);
92 92
         }
93 93
 
94 94
         if (is_object(@$target_module)) {
95 95
             // module's blocks
96
-            $this->target_mid = $target_module->getVar('mid') ;
97
-            $this->target_mname = $target_module->getVar('name') . ' ' . sprintf('(%2.2f)', $target_module->getVar('version') / 100.0) ;
98
-            $this->target_dirname = $target_module->getVar('dirname') ;
99
-            $modinfo = $target_module->getInfo() ;
96
+            $this->target_mid = $target_module->getVar('mid');
97
+            $this->target_mname = $target_module->getVar('name').' '.sprintf('(%2.2f)', $target_module->getVar('version') / 100.0);
98
+            $this->target_dirname = $target_module->getVar('dirname');
99
+            $modinfo = $target_module->getInfo();
100 100
             // breadcrumbs
101
-            $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ;
102
-            $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin', '_MI_ALTSYS_MENU_MYBLOCKSADMIN') ;
103
-            $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$this->target_dirname, $this->target_mname) ;
101
+            $breadcrumbsObj = AltsysBreadcrumbs::getInstance();
102
+            $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin', '_MI_ALTSYS_MENU_MYBLOCKSADMIN');
103
+            $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$this->target_dirname, $this->target_mname);
104 104
         } else {
105 105
             // custom blocks
106
-            $this->target_mid = 0 ;
107
-            $this->target_mname = _MI_ALTSYS_MENU_CUSTOMBLOCKS ;
108
-            $this->target_dirname = '__CustomBlocks__' ;
106
+            $this->target_mid = 0;
107
+            $this->target_mname = _MI_ALTSYS_MENU_CUSTOMBLOCKS;
108
+            $this->target_dirname = '__CustomBlocks__';
109 109
             // breadcrumbs
110
-            $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ;
111
-            $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin', '_MI_ALTSYS_MENU_MYBLOCKSADMIN') ;
112
-            $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$this->target_dirname, '_MI_ALTSYS_MENU_CUSTOMBLOCKS') ;
110
+            $breadcrumbsObj = AltsysBreadcrumbs::getInstance();
111
+            $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin', '_MI_ALTSYS_MENU_MYBLOCKSADMIN');
112
+            $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$this->target_dirname, '_MI_ALTSYS_MENU_CUSTOMBLOCKS');
113 113
         }
114 114
     } else {
115 115
         // myblocksadmin as a library
116
-        $this->target_mid = $xoopsModule->getVar('mid') ;
117
-        $this->target_mname = $xoopsModule->getVar('name') . ' ' . sprintf('(%2.2f)', $xoopsModule->getVar('version') / 100.0) ;
118
-        $this->target_dirname = $xoopsModule->getVar('dirname') ;
119
-        $mod_url = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname') ;
120
-        $modinfo = $xoopsModule->getInfo() ;
121
-        $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ;
122
-        $breadcrumbsObj->appendPath($mod_url.'/'.@$modinfo['adminindex'], $this->target_mname) ;
123
-        $breadcrumbsObj->appendPath($mod_url.'/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin', _MD_A_MYBLOCKSADMIN_BLOCKADMIN) ;
116
+        $this->target_mid = $xoopsModule->getVar('mid');
117
+        $this->target_mname = $xoopsModule->getVar('name').' '.sprintf('(%2.2f)', $xoopsModule->getVar('version') / 100.0);
118
+        $this->target_dirname = $xoopsModule->getVar('dirname');
119
+        $mod_url = XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname');
120
+        $modinfo = $xoopsModule->getInfo();
121
+        $breadcrumbsObj = AltsysBreadcrumbs::getInstance();
122
+        $breadcrumbsObj->appendPath($mod_url.'/'.@$modinfo['adminindex'], $this->target_mname);
123
+        $breadcrumbsObj->appendPath($mod_url.'/admin/index.php?mode=admin&lib=altsys&page=myblocksadmin', _MD_A_MYBLOCKSADMIN_BLOCKADMIN);
124 124
     }
125 125
 
126 126
     // read xoops_version.php of the target
127
-    $this->block_configs = $this->get_block_configs() ;
127
+    $this->block_configs = $this->get_block_configs();
128 128
     }
129 129
 
130 130
 
131 131
 // virtual
132 132
 public function canEdit($block)
133 133
 {
134
-    return true ;
134
+    return true;
135 135
 }
136 136
 
137 137
 
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
 {
141 141
     // can delete if it is a cloned block
142 142
     if ($block->getVar('block_type') == 'D' || $block->getVar('block_type') == 'C') {
143
-        return true ;
143
+        return true;
144 144
     } else {
145
-        return false ;
145
+        return false;
146 146
     }
147 147
 }
148 148
 
@@ -155,23 +155,23 @@  discard block
 block discarded – undo
155 155
 {
156 156
     // can clone link if it is marked as cloneable block
157 157
     if ($block->getVar('block_type') == 'D' || $block->getVar('block_type') == 'C') {
158
-        return 2 ;
158
+        return 2;
159 159
     } else {
160 160
         // $modversion['blocks'][n]['can_clone']
161 161
         foreach ($this->block_configs as $bconf) {
162 162
             if ($block->getVar('show_func') == @$bconf['show_func'] && $block->getVar('func_file') == @$bconf['file'] && (empty($bconf['template']) || $block->getVar('template') == @$bconf['template'])) {
163
-                if (! empty($bconf['can_clone'])) {
164
-                    return 2 ;
163
+                if (!empty($bconf['can_clone'])) {
164
+                    return 2;
165 165
                 }
166 166
             }
167 167
         }
168 168
     }
169 169
 
170
-    if (! empty($GLOBALS['altsysModuleConfig']['enable_force_clone'])) {
171
-        return 1 ;
170
+    if (!empty($GLOBALS['altsysModuleConfig']['enable_force_clone'])) {
171
+        return 1;
172 172
     }
173 173
 
174
-    return 0 ;
174
+    return 0;
175 175
 }
176 176
 
177 177
 
@@ -184,12 +184,12 @@  discard block
 block discarded – undo
184 184
 //HACK by domifara
185 185
     if (defined('XOOPS_CUBE_LEGACY')) {
186 186
         $handler = xoops_getHandler('block');
187
-        $block = $handler->create(false) ;
188
-        $block->load($bid) ;
187
+        $block = $handler->create(false);
188
+        $block->load($bid);
189 189
     } else {
190
-        $block = new XoopsBlock($bid) ;
190
+        $block = new XoopsBlock($bid);
191 191
     }
192
-    return $block->getOptions() ;
192
+    return $block->getOptions();
193 193
 }
194 194
 
195 195
 
@@ -202,16 +202,16 @@  discard block
 block discarded – undo
202 202
     // get selected targets
203 203
     if (is_array(@$block_data['bmodule'])) {
204 204
         // bmodule origined from request (preview etc.)
205
-        $selected_mids = $block_data['bmodule'] ;
205
+        $selected_mids = $block_data['bmodule'];
206 206
     } else {
207 207
         // origined from the table of `block_module_link`
208
-        $result = $this->db->query('SELECT module_id FROM ' . $this->db->prefix('block_module_link') . " WHERE block_id='$bid'") ;
208
+        $result = $this->db->query('SELECT module_id FROM '.$this->db->prefix('block_module_link')." WHERE block_id='$bid'");
209 209
         $selected_mids = array();
210 210
         while (list($selected_mid) = $this->db->fetchRow($result)) {
211 211
             $selected_mids[] = (int)$selected_mid;
212 212
         }
213 213
         if (empty($selected_mids)) {
214
-            $selected_mids = array( 0 ) ;
214
+            $selected_mids = array(0);
215 215
         } // all pages
216 216
     }
217 217
 
@@ -220,25 +220,25 @@  discard block
 block discarded – undo
220 220
     $criteria = new CriteriaCompo(new Criteria('hasmain', 1));
221 221
     $criteria->add(new Criteria('isactive', 1));
222 222
     $module_list = $module_handler->getList($criteria);
223
-    $module_list= array( -1 => _MD_A_MYBLOCKSADMIN_TOPPAGE , 0 => _MD_A_MYBLOCKSADMIN_ALLPAGES ) + $module_list ;
223
+    $module_list = array( -1 => _MD_A_MYBLOCKSADMIN_TOPPAGE, 0 => _MD_A_MYBLOCKSADMIN_ALLPAGES ) + $module_list;
224 224
 
225 225
     // build options
226
-    $module_options = '' ;
226
+    $module_options = '';
227 227
     foreach ($module_list as $mid => $mname) {
228
-        $mname = htmlspecialchars($mname) ;
228
+        $mname = htmlspecialchars($mname);
229 229
         if (in_array($mid, $selected_mids)) {
230
-            $module_options .= "<option value='$mid' selected='selected'>$mname</option>\n" ;
230
+            $module_options .= "<option value='$mid' selected='selected'>$mname</option>\n";
231 231
         } else {
232
-            $module_options .= "<option value='$mid'>$mname</option>\n" ;
232
+            $module_options .= "<option value='$mid'>$mname</option>\n";
233 233
         }
234 234
     }
235 235
 
236 236
     $ret = "
237 237
 				<select name='bmodules[$bid][]' size='5' multiple='multiple'>
238 238
 					$module_options
239
-				</select>" ;
239
+				</select>";
240 240
 
241
-    return $ret ;
241
+    return $ret;
242 242
 }
243 243
 
244 244
 
@@ -251,41 +251,41 @@  discard block
 block discarded – undo
251 251
     // get selected targets
252 252
     if (is_array(@$block_data['bgroup'])) {
253 253
         // bgroup origined from request (preview etc.)
254
-        $selected_gids = $block_data['bgroup'] ;
254
+        $selected_gids = $block_data['bgroup'];
255 255
     } else {
256 256
         // origined from the table of `group_perm`
257
-        $result = $this->db->query('SELECT gperm_groupid FROM ' . $this->db->prefix('group_permission') . " WHERE gperm_itemid='$bid' AND gperm_name='block_read'") ;
257
+        $result = $this->db->query('SELECT gperm_groupid FROM '.$this->db->prefix('group_permission')." WHERE gperm_itemid='$bid' AND gperm_name='block_read'");
258 258
         $selected_gids = array();
259 259
         while (list($selected_gid) = $this->db->fetchRow($result)) {
260 260
             $selected_gids[] = (int)$selected_gid;
261 261
         }
262 262
         if ($bid == 0 && empty($selected_gids)) {
263
-            $selected_gids = $GLOBALS['xoopsUser']->getGroups() ;
263
+            $selected_gids = $GLOBALS['xoopsUser']->getGroups();
264 264
         }
265 265
     }
266 266
 
267 267
     // get all targets
268 268
     $group_handler = xoops_getHandler('group');
269
-    $groups = $group_handler->getObjects() ;
269
+    $groups = $group_handler->getObjects();
270 270
 
271 271
     // build options
272
-    $group_options = '' ;
272
+    $group_options = '';
273 273
     foreach ($groups as $group) {
274
-        $gid = $group->getVar('groupid') ;
275
-        $gname = $group->getVar('name', 's') ;
274
+        $gid = $group->getVar('groupid');
275
+        $gname = $group->getVar('name', 's');
276 276
         if (in_array($gid, $selected_gids)) {
277
-            $group_options .= "<option value='$gid' selected='selected'>$gname</option>\n" ;
277
+            $group_options .= "<option value='$gid' selected='selected'>$gname</option>\n";
278 278
         } else {
279
-            $group_options .= "<option value='$gid'>$gname</option>\n" ;
279
+            $group_options .= "<option value='$gid'>$gname</option>\n";
280 280
         }
281 281
     }
282 282
 
283 283
     $ret = "
284 284
 				<select name='bgroups[$bid][]' size='5' multiple='multiple'>
285 285
 					$group_options
286
-				</select>" ;
286
+				</select>";
287 287
 
288
-    return $ret ;
288
+    return $ret;
289 289
 }
290 290
 
291 291
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
     $sseln = $ssel0 = $ssel1 = $ssel2 = $ssel3 = $ssel4 = '';
301 301
     $scoln = $scol0 = $scol1 = $scol2 = $scol3 = $scol4 = 'unselected';
302 302
     $stextbox = 'unselected';
303
-    $value4extra_side = '' ;
303
+    $value4extra_side = '';
304 304
 
305 305
     if ($visible != 1) {
306 306
         $sseln = " checked='checked'";
@@ -310,27 +310,27 @@  discard block
 block discarded – undo
310 310
         case XOOPS_SIDEBLOCK_LEFT:
311 311
             $ssel0 = " checked='checked'";
312 312
             $scol0 = 'selected';
313
-            break ;
313
+            break;
314 314
         case XOOPS_SIDEBLOCK_RIGHT:
315 315
             $ssel1 = " checked='checked'";
316 316
             $scol1 = 'selected';
317
-            break ;
317
+            break;
318 318
         case XOOPS_CENTERBLOCK_LEFT:
319 319
             $ssel2 = " checked='checked'";
320 320
             $scol2 = 'selected';
321
-            break ;
321
+            break;
322 322
         case XOOPS_CENTERBLOCK_RIGHT:
323 323
             $ssel4 = " checked='checked'";
324 324
             $scol4 = 'selected';
325
-            break ;
325
+            break;
326 326
         case XOOPS_CENTERBLOCK_CENTER:
327 327
             $ssel3 = " checked='checked'";
328 328
             $scol3 = 'selected';
329
-            break ;
329
+            break;
330 330
         default:
331
-            $value4extra_side = $side ;
331
+            $value4extra_side = $side;
332 332
             $stextbox = 'selected';
333
-            break ;
333
+            break;
334 334
     }
335 335
     }
336 336
 
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 				<div class='blockposition $scoln'>
361 361
 					<input type='radio' name='sides[$bid]' value='-1' class='blockposition' $sseln onclick='document.getElementById(\"extra_side_$bid\").value=-1;' />
362 362
 				</div>
363
-                <div style='float:"._GLOBAL_LEFT.";'>"._NONE . '</div>
363
+                <div style='float:"._GLOBAL_LEFT.";'>"._NONE.'</div>
364 364
     ';
365 365
 }
366 366
 
@@ -368,58 +368,58 @@  discard block
 block discarded – undo
368 368
 // public
369 369
 public function list_blocks()
370 370
 {
371
-    global $xoopsGTicket ;
371
+    global $xoopsGTicket;
372 372
 
373 373
     // main query
374
-    $sql = 'SELECT * FROM ' . $this->db->prefix('newblocks') . " WHERE mid='$this->target_mid' ORDER BY visible DESC,side,weight" ;
375
-    $result = $this->db->query($sql) ;
376
-    $block_arr = array() ;
374
+    $sql = 'SELECT * FROM '.$this->db->prefix('newblocks')." WHERE mid='$this->target_mid' ORDER BY visible DESC,side,weight";
375
+    $result = $this->db->query($sql);
376
+    $block_arr = array();
377 377
 //HACK by domifara
378 378
     if (defined('XOOPS_CUBE_LEGACY')) {
379
-        $handler = xoops_getHandler('block');//add
379
+        $handler = xoops_getHandler('block'); //add
380 380
     }
381 381
     while ($myrow = $this->db->fetchArray($result)) {
382 382
 
383 383
 //HACK by domifara
384 384
         if (defined('XOOPS_CUBE_LEGACY')) {
385
-            $block_one = $handler->create(false) ;
385
+            $block_one = $handler->create(false);
386 386
             $block_one->assignVars($myrow);
387
-            $block_arr[] =& $block_one ;
387
+            $block_arr[] = & $block_one;
388 388
         } else {
389
-            $block_arr[] = new XoopsBlock($myrow) ;
389
+            $block_arr[] = new XoopsBlock($myrow);
390 390
         }
391 391
     }
392 392
     if (empty($block_arr)) {
393
-        return ;
393
+        return;
394 394
     }
395 395
 
396 396
     // blocks rendering loop
397
-    $blocks4assign = array() ;
397
+    $blocks4assign = array();
398 398
     foreach ($block_arr as $i => $block) {
399 399
         $block_data = array(
400 400
             'bid' => (int)$block->getVar('bid'),
401
-            'name' => $block->getVar('name', 'n') ,
402
-            'title' => $block->getVar('title', 'n') ,
401
+            'name' => $block->getVar('name', 'n'),
402
+            'title' => $block->getVar('title', 'n'),
403 403
             'weight' => (int)$block->getVar('weight'),
404 404
             'bcachetime' => (int)$block->getVar('bcachetime'),
405 405
             'side' => (int)$block->getVar('side'),
406 406
             'visible' => (int)$block->getVar('visible'),
407
-            'can_edit' => $this->canEdit($block) ,
408
-            'can_delete' => $this->canDelete($block) ,
407
+            'can_edit' => $this->canEdit($block),
408
+            'can_delete' => $this->canDelete($block),
409 409
             'can_clone' => $this->canClone($block)
410
-        ) ;
410
+        );
411 411
         $blocks4assign[] = array(
412
-            'name_raw' => $block_data['name'] ,
413
-            'title_raw' => $block_data['title'] ,
414
-            'cell_position' => $this->renderCell4BlockPosition($block_data) ,
415
-            'cell_module_link' =>  $this->renderCell4BlockModuleLink($block_data) ,
412
+            'name_raw' => $block_data['name'],
413
+            'title_raw' => $block_data['title'],
414
+            'cell_position' => $this->renderCell4BlockPosition($block_data),
415
+            'cell_module_link' =>  $this->renderCell4BlockModuleLink($block_data),
416 416
             'cell_group_perm' =>  $this->renderCell4BlockReadGroupPerm($block_data)
417
-        ) + $block_data ;
417
+        ) + $block_data;
418 418
     }
419 419
 
420 420
     // display
421
-    require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ;
422
-    $tpl = new D3Tpl() ;
421
+    require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php';
422
+    $tpl = new D3Tpl();
423 423
     $tpl->assign(array(
424 424
         'target_mid' => $this->target_mid,
425 425
         'target_dirname' => $this->target_dirname,
@@ -428,22 +428,22 @@  discard block
 block discarded – undo
428 428
         'cachetime_options' => $this->cachetime_options,
429 429
         'blocks' => $blocks4assign,
430 430
         'gticket_hidden' => $xoopsGTicket->getTicketHtml(__LINE__, 1800, 'myblocksadmin')
431
-    )) ;
432
-    $tpl->display('db:altsys_main_myblocksadmin_list.html') ;
431
+    ));
432
+    $tpl->display('db:altsys_main_myblocksadmin_list.html');
433 433
 }
434 434
 
435 435
 
436 436
     public function get_block_configs()
437 437
     {
438 438
         if ($this->target_mid <= 0) {
439
-            return array() ;
439
+            return array();
440 440
         }
441
-        include XOOPS_ROOT_PATH.'/modules/'.$this->target_dirname.'/xoops_version.php' ;
441
+        include XOOPS_ROOT_PATH.'/modules/'.$this->target_dirname.'/xoops_version.php';
442 442
 
443 443
         if (empty($modversion['blocks'])) {
444
-            return array() ;
444
+            return array();
445 445
         } else {
446
-            return $modversion['blocks'] ;
446
+            return $modversion['blocks'];
447 447
         }
448 448
     }
449 449
 
@@ -451,51 +451,51 @@  discard block
 block discarded – undo
451 451
     public function list_groups()
452 452
     {
453 453
         // query for getting blocks
454
-    $sql = 'SELECT * FROM ' . $this->db->prefix('newblocks') . " WHERE mid='$this->target_mid' ORDER BY visible DESC,side,weight" ;
455
-        $result = $this->db->query($sql) ;
456
-        $block_arr = array() ;
454
+    $sql = 'SELECT * FROM '.$this->db->prefix('newblocks')." WHERE mid='$this->target_mid' ORDER BY visible DESC,side,weight";
455
+        $result = $this->db->query($sql);
456
+        $block_arr = array();
457 457
 //HACK by domifara
458 458
     if (defined('XOOPS_CUBE_LEGACY')) {
459
-        $handler = xoops_getHandler('block');//add
459
+        $handler = xoops_getHandler('block'); //add
460 460
     }
461 461
         while ($myrow = $this->db->fetchArray($result)) {
462 462
             //HACK by domifara
463 463
         if (defined('XOOPS_CUBE_LEGACY')) {
464
-            $block_one = $handler->create(false) ;
464
+            $block_one = $handler->create(false);
465 465
             $block_one->assignVars($myrow);
466
-            $block_arr[] =& $block_one ;
466
+            $block_arr[] = & $block_one;
467 467
         } else {
468
-            $block_arr[] = new XoopsBlock($myrow) ;
468
+            $block_arr[] = new XoopsBlock($myrow);
469 469
         }
470 470
         }
471 471
 
472
-        $item_list = array() ;
472
+        $item_list = array();
473 473
         foreach (array_keys($block_arr) as $i) {
474
-            $item_list[ $block_arr[$i]->getVar('bid') ] = $block_arr[$i]->getVar('title') ;
474
+            $item_list[$block_arr[$i]->getVar('bid')] = $block_arr[$i]->getVar('title');
475 475
         }
476 476
 
477
-        $form = new MyXoopsGroupPermForm(_MD_A_MYBLOCKSADMIN_PERMFORM, 1, 'block_read', '') ;
477
+        $form = new MyXoopsGroupPermForm(_MD_A_MYBLOCKSADMIN_PERMFORM, 1, 'block_read', '');
478 478
     // skip system (TODO)
479 479
     if ($this->target_mid > 1) {
480
-        $form->addAppendix('module_admin', $this->target_mid, $this->target_mname . ' ' . _MD_A_MYBLOCKSADMIN_PERM_MADMIN) ;
481
-        $form->addAppendix('module_read', $this->target_mid, $this->target_mname .' ' . _MD_A_MYBLOCKSADMIN_PERM_MREAD) ;
480
+        $form->addAppendix('module_admin', $this->target_mid, $this->target_mname.' '._MD_A_MYBLOCKSADMIN_PERM_MADMIN);
481
+        $form->addAppendix('module_read', $this->target_mid, $this->target_mname.' '._MD_A_MYBLOCKSADMIN_PERM_MREAD);
482 482
     }
483 483
         foreach ($item_list as $item_id => $item_name) {
484
-            $form->addItem($item_id, $item_name) ;
484
+            $form->addItem($item_id, $item_name);
485 485
         }
486
-        echo $form->render() ;
486
+        echo $form->render();
487 487
     }
488 488
 
489 489
 
490
-    public function update_block($bid, $bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bcachetime, $options=array())
490
+    public function update_block($bid, $bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bcachetime, $options = array())
491 491
     {
492 492
         global $xoopsConfig;
493 493
 
494 494
 //HACK by domifara
495 495
     if (defined('XOOPS_CUBE_LEGACY')) {
496 496
         $handler = xoops_getHandler('block');
497
-        $block = $handler->create(false) ;
498
-        $block->load($bid) ;
497
+        $block = $handler->create(false);
498
+        $block->load($bid);
499 499
     } else {
500 500
         $block = new XoopsBlock($bid);
501 501
     }
@@ -514,10 +514,10 @@  discard block
 block discarded – undo
514 514
         }
515 515
         $block->setVar('bcachetime', $bcachetime);
516 516
         if (is_array($options) && count($options) > 0) {
517
-            $block->setVar('options', implode('|', $options)) ;
517
+            $block->setVar('options', implode('|', $options));
518 518
         }
519 519
         if ($block->getVar('block_type') == 'C') {
520
-            $name = $this->get_blockname_from_ctype($block->getVar('c_type')) ;
520
+            $name = $this->get_blockname_from_ctype($block->getVar('c_type'));
521 521
             $block->setVar('name', $name);
522 522
         }
523 523
         $msg = _MD_A_MYBLOCKSADMIN_DBUPDATED;
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
         } else {
542 542
             $msg = 'Failed update of block. ID:'.$bid;
543 543
         }
544
-        return $msg ;
544
+        return $msg;
545 545
     }
546 546
 
547 547
 
@@ -549,14 +549,14 @@  discard block
 block discarded – undo
549 549
 public function updateBlockModuleLink($bid, $bmodules)
550 550
 {
551 551
     $bid = (int)$bid;
552
-    $table = $this->db->prefix('block_module_link') ;
552
+    $table = $this->db->prefix('block_module_link');
553 553
 
554
-    $sql = "DELETE FROM `$table` WHERE `block_id`=$bid" ;
555
-    $this->db->query($sql) ;
554
+    $sql = "DELETE FROM `$table` WHERE `block_id`=$bid";
555
+    $this->db->query($sql);
556 556
     foreach ($bmodules as $mid) {
557 557
         $mid = (int)$mid;
558
-        $sql = "INSERT INTO `$table` (`block_id`,`module_id`) VALUES ($bid,$mid)" ;
559
-        $this->db->query($sql) ;
558
+        $sql = "INSERT INTO `$table` (`block_id`,`module_id`) VALUES ($bid,$mid)";
559
+        $this->db->query($sql);
560 560
     }
561 561
 }
562 562
 
@@ -565,83 +565,83 @@  discard block
 block discarded – undo
565 565
 public function updateBlockReadGroupPerm($bid, $req_gids)
566 566
 {
567 567
     $bid = (int)$bid;
568
-    $table = $this->db->prefix('group_permission') ;
569
-    $req_gids = array_map('intval', $req_gids) ;
570
-    sort($req_gids) ;
568
+    $table = $this->db->prefix('group_permission');
569
+    $req_gids = array_map('intval', $req_gids);
570
+    sort($req_gids);
571 571
 
572 572
     // compare group ids from request and the records.
573
-    $sql = "SELECT `gperm_groupid` FROM `$table` WHERE gperm_name='block_read' AND `gperm_itemid`=$bid" ;
574
-    $result = $this->db->query($sql) ;
575
-    $db_gids = array() ;
573
+    $sql = "SELECT `gperm_groupid` FROM `$table` WHERE gperm_name='block_read' AND `gperm_itemid`=$bid";
574
+    $result = $this->db->query($sql);
575
+    $db_gids = array();
576 576
     while (list($gid) = $this->db->fetchRow($result)) {
577
-        $db_gids[] = $gid ;
577
+        $db_gids[] = $gid;
578 578
     }
579
-    $db_gids = array_map('intval', $db_gids) ;
580
-    sort($db_gids) ;
579
+    $db_gids = array_map('intval', $db_gids);
580
+    sort($db_gids);
581 581
 
582 582
     // if they are identical, just return (prevent increase of gperm_id)
583 583
     if (serialize($req_gids) == serialize($db_gids)) {
584
-        return ;
584
+        return;
585 585
     }
586 586
 
587
-    $sql = "DELETE FROM `$table` WHERE gperm_name='block_read' AND `gperm_itemid`=$bid" ;
588
-    $this->db->query($sql) ;
587
+    $sql = "DELETE FROM `$table` WHERE gperm_name='block_read' AND `gperm_itemid`=$bid";
588
+    $this->db->query($sql);
589 589
     foreach ($req_gids as $gid) {
590 590
         $gid = (int)$gid;
591
-        $sql = "INSERT INTO `$table` (`gperm_groupid`,`gperm_itemid`,`gperm_modid`,`gperm_name`) VALUES ($gid,$bid,1,'block_read')" ;
592
-        $this->db->query($sql) ;
591
+        $sql = "INSERT INTO `$table` (`gperm_groupid`,`gperm_itemid`,`gperm_modid`,`gperm_name`) VALUES ($gid,$bid,1,'block_read')";
592
+        $this->db->query($sql);
593 593
     }
594 594
 }
595 595
 
596 596
 
597 597
     public function do_order()
598 598
     {
599
-        $sides = is_array(@$_POST['sides']) ? $_POST['sides'] : array() ;
599
+        $sides = is_array(@$_POST['sides']) ? $_POST['sides'] : array();
600 600
         foreach (array_keys($sides) as $bid) {
601
-            $request = $this->fetchRequest4Block($bid) ;
601
+            $request = $this->fetchRequest4Block($bid);
602 602
 
603 603
         // update the block
604
-        $this->update_block($request['bid'], $request['side'], $request['weight'], $request['visible'], $request['title'], null, null, $request['bcachetime'], array()) ;
604
+        $this->update_block($request['bid'], $request['side'], $request['weight'], $request['visible'], $request['title'], null, null, $request['bcachetime'], array());
605 605
 
606 606
         // block_module_link update
607
-        $this->updateBlockModuleLink($bid, $request['bmodule']) ;
607
+        $this->updateBlockModuleLink($bid, $request['bmodule']);
608 608
 
609 609
         // group_permission update
610
-        $this->updateBlockReadGroupPerm($bid, $request['bgroup']) ;
610
+        $this->updateBlockReadGroupPerm($bid, $request['bgroup']);
611 611
         }
612
-        return _MD_A_MYBLOCKSADMIN_DBUPDATED ;
612
+        return _MD_A_MYBLOCKSADMIN_DBUPDATED;
613 613
     }
614 614
 
615 615
 
616 616
     public function fetchRequest4Block($bid)
617 617
     {
618 618
         $bid = (int)$bid;
619
-        (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance() ;
619
+        (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance();
620 620
 
621 621
         if (@$_POST['extra_sides'][$bid] > 0) {
622 622
             $_POST['sides'][$bid] = (int)$_POST['extra_sides'][$bid];
623 623
         }
624 624
 
625 625
         if (@$_POST['sides'][$bid] < 0) {
626
-            $visible = 0 ;
627
-            $_POST['sides'][$bid] = -1 ;
626
+            $visible = 0;
627
+            $_POST['sides'][$bid] = -1;
628 628
         } else {
629
-            $visible = 1 ;
629
+            $visible = 1;
630 630
         }
631 631
 
632 632
         return array(
633
-        'bid' => $bid ,
633
+        'bid' => $bid,
634 634
             'side' => (int)(@$_POST['sides'][$bid]),
635 635
             'weight' => (int)(@$_POST['weights'][$bid]),
636
-        'visible' => $visible ,
637
-        'title' => $myts->stripSlashesGPC(@$_POST['titles'][$bid]) ,
638
-        'content' => $myts->stripSlashesGPC(@$_POST['contents'][$bid]) ,
639
-        'ctype' => preg_replace('/[^A-Z]/', '', @$_POST['ctypes'][$bid]) ,
636
+        'visible' => $visible,
637
+        'title' => $myts->stripSlashesGPC(@$_POST['titles'][$bid]),
638
+        'content' => $myts->stripSlashesGPC(@$_POST['contents'][$bid]),
639
+        'ctype' => preg_replace('/[^A-Z]/', '', @$_POST['ctypes'][$bid]),
640 640
             'bcachetime' => (int)(@$_POST['bcachetimes'][$bid]),
641
-        'bmodule' => is_array(@$_POST['bmodules'][$bid]) ? $_POST['bmodules'][$bid] : array( 0 ) ,
642
-        'bgroup' => is_array(@$_POST['bgroups'][$bid]) ? $_POST['bgroups'][$bid] : array() ,
641
+        'bmodule' => is_array(@$_POST['bmodules'][$bid]) ? $_POST['bmodules'][$bid] : array(0),
642
+        'bgroup' => is_array(@$_POST['bgroups'][$bid]) ? $_POST['bgroups'][$bid] : array(),
643 643
         'options' => is_array(@$_POST['options'][$bid]) ? $_POST['options'][$bid] : array()
644
-    ) ;
644
+    );
645 645
     }
646 646
 
647 647
 
@@ -652,30 +652,30 @@  discard block
 block discarded – undo
652 652
 //HACK by domifara
653 653
     if (defined('XOOPS_CUBE_LEGACY')) {
654 654
         $handler = xoops_getHandler('block');
655
-        $block = $handler->create(false) ;
656
-        $block->load($bid) ;
655
+        $block = $handler->create(false);
656
+        $block->load($bid);
657 657
     } else {
658
-        $block = new XoopsBlock($bid) ;
658
+        $block = new XoopsBlock($bid);
659 659
     }
660 660
 
661
-        if (! is_object($block)) {
662
-            die('Invalid bid') ;
661
+        if (!is_object($block)) {
662
+            die('Invalid bid');
663 663
         }
664
-        if (! $this->canDelete($block)) {
665
-            die('Cannot delete this block') ;
664
+        if (!$this->canDelete($block)) {
665
+            die('Cannot delete this block');
666 666
         }
667 667
         $this->do_deleteBlockReadGroupPerm($bid); //HACK add by domifara
668
-    $block->delete() ;
669
-        return _MD_A_MYBLOCKSADMIN_DBUPDATED ;
668
+    $block->delete();
669
+        return _MD_A_MYBLOCKSADMIN_DBUPDATED;
670 670
     }
671 671
 
672 672
 //HACK add by domifara
673 673
 public function do_deleteBlockReadGroupPerm($bid)
674 674
 {
675 675
     $bid = (int)$bid;
676
-    $table = $this->db->prefix('group_permission') ;
677
-    $sql = "DELETE FROM `$table` WHERE gperm_name='block_read' AND `gperm_itemid`=$bid" ;
678
-    $this->db->query($sql) ;
676
+    $table = $this->db->prefix('group_permission');
677
+    $sql = "DELETE FROM `$table` WHERE gperm_name='block_read' AND `gperm_itemid`=$bid";
678
+    $this->db->query($sql);
679 679
 }
680 680
 
681 681
     public function form_delete($bid)
@@ -686,24 +686,24 @@  discard block
 block discarded – undo
686 686
 //HACK by domifara
687 687
     if (defined('XOOPS_CUBE_LEGACY')) {
688 688
         $handler = xoops_getHandler('block');
689
-        $block = $handler->create(false) ;
690
-        $block->load($bid) ;
689
+        $block = $handler->create(false);
690
+        $block->load($bid);
691 691
     } else {
692
-        $block = new XoopsBlock($bid) ;
692
+        $block = new XoopsBlock($bid);
693 693
     }
694 694
 
695
-        if (! is_object($block)) {
696
-            die('Invalid bid') ;
695
+        if (!is_object($block)) {
696
+            die('Invalid bid');
697 697
         }
698
-        if (! $this->canDelete($block)) {
699
-            die('Cannot delete this block') ;
698
+        if (!$this->canDelete($block)) {
699
+            die('Cannot delete this block');
700 700
         }
701 701
 
702 702
     // breadcrumbs
703
-    $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ;
704
-        $breadcrumbsObj->appendPath('', _DELETE) ;
703
+    $breadcrumbsObj = AltsysBreadcrumbs::getInstance();
704
+        $breadcrumbsObj->appendPath('', _DELETE);
705 705
 
706
-        xoops_confirm(array( 'op' => 'delete_ok' ) + $GLOBALS['xoopsGTicket']->getTicketArray(__LINE__, 1800, 'myblocksadmin'), "?mode=admin&amp;lib=altsys&amp;page=myblocksadmin&amp;dirname=$this->target_dirname&amp;bid=$bid", sprintf(_MD_A_MYBLOCKSADMIN_FMT_REMOVEBLOCK, $block->getVar('title'))) ;
706
+        xoops_confirm(array('op' => 'delete_ok') + $GLOBALS['xoopsGTicket']->getTicketArray(__LINE__, 1800, 'myblocksadmin'), "?mode=admin&amp;lib=altsys&amp;page=myblocksadmin&amp;dirname=$this->target_dirname&amp;bid=$bid", sprintf(_MD_A_MYBLOCKSADMIN_FMT_REMOVEBLOCK, $block->getVar('title')));
707 707
     }
708 708
 
709 709
 
@@ -711,30 +711,30 @@  discard block
 block discarded – undo
711 711
     {
712 712
         $bid = (int)$bid;
713 713
 
714
-        $request = $this->fetchRequest4Block($bid) ;
714
+        $request = $this->fetchRequest4Block($bid);
715 715
 
716 716
 //HACK by domifara
717 717
     if (defined('XOOPS_CUBE_LEGACY')) {
718 718
         $handler = xoops_getHandler('block');
719
-        $block = $handler->create(false) ;
720
-        $block->load($bid) ;
719
+        $block = $handler->create(false);
720
+        $block->load($bid);
721 721
     } else {
722
-        $block = new XoopsBlock($bid) ;
722
+        $block = new XoopsBlock($bid);
723 723
     }
724 724
 
725
-        if (! $block->getVar('bid')) {
726
-            die('Invalid bid') ;
725
+        if (!$block->getVar('bid')) {
726
+            die('Invalid bid');
727 727
         }
728
-        if (! $this->canClone($block)) {
729
-            die('Invalid block_type') ;
728
+        if (!$this->canClone($block)) {
729
+            die('Invalid block_type');
730 730
         }
731 731
 
732 732
         if (empty($_POST['options'])) {
733
-            $options = array() ;
733
+            $options = array();
734 734
         } elseif (is_array($_POST['options'])) {
735
-            $options = $_POST['options'] ;
735
+            $options = $_POST['options'];
736 736
         } else {
737
-            $options = explode('|', $_POST['options']) ;
737
+            $options = explode('|', $_POST['options']);
738 738
         }
739 739
 
740 740
     // for backward compatibility
@@ -742,46 +742,46 @@  discard block
 block discarded – undo
742 742
 
743 743
 //HACK by domifara
744 744
     if (defined('XOOPS_CUBE_LEGACY')) {
745
-        $cblock = $handler->create(false) ;
745
+        $cblock = $handler->create(false);
746 746
     } else {
747
-        $cblock = new XoopsBlock() ;
747
+        $cblock = new XoopsBlock();
748 748
     }
749 749
 
750 750
         foreach ($block->vars as $k => $v) {
751
-            $cblock->assignVar($k, $v['value']) ;
751
+            $cblock->assignVar($k, $v['value']);
752 752
         }
753 753
         $cblock->setNew();
754 754
         $cblock->setVar('bid', 0);
755 755
         $cblock->setVar('block_type', $block->getVar('block_type') == 'C' ? 'C' : 'D');
756
-        $cblock->setVar('func_num', $this->find_func_num_vacancy($block->getVar('mid'))) ;
756
+        $cblock->setVar('func_num', $this->find_func_num_vacancy($block->getVar('mid')));
757 757
     // store the block into DB as a new one
758
-    $newbid = $cblock->store() ;
759
-        if (! $newbid) {
760
-            return $cblock->getHtmlErrors() ;
758
+    $newbid = $cblock->store();
759
+        if (!$newbid) {
760
+            return $cblock->getHtmlErrors();
761 761
         }
762 762
 
763 763
     // update the block by the request
764
-    $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()) ;
764
+    $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 765
 
766 766
     // block_module_link update
767
-    $this->updateBlockModuleLink($newbid, $request['bmodule']) ;
767
+    $this->updateBlockModuleLink($newbid, $request['bmodule']);
768 768
 
769 769
     // group_permission update
770
-    $this->updateBlockReadGroupPerm($newbid, $request['bgroup']) ;
770
+    $this->updateBlockReadGroupPerm($newbid, $request['bgroup']);
771 771
 
772
-        return _MD_A_MYBLOCKSADMIN_DBUPDATED ;
772
+        return _MD_A_MYBLOCKSADMIN_DBUPDATED;
773 773
     }
774 774
 
775 775
 
776 776
     public function find_func_num_vacancy($mid)
777 777
     {
778
-        $func_num = 256 ;
778
+        $func_num = 256;
779 779
         do {
780
-            $func_num -- ;
781
-            list($count) = $this->db->fetchRow($this->db->query('SELECT COUNT(*) FROM ' . $this->db->prefix('newblocks') . ' WHERE mid=' . (int)$mid . ' AND func_num=' . $func_num)) ;
782
-        } while ($count > 0) ;
780
+            $func_num--;
781
+            list($count) = $this->db->fetchRow($this->db->query('SELECT COUNT(*) FROM '.$this->db->prefix('newblocks').' WHERE mid='.(int)$mid.' AND func_num='.$func_num));
782
+        } while ($count > 0);
783 783
 
784
-        return $func_num > 128 ? $func_num : 255 ;
784
+        return $func_num > 128 ? $func_num : 255;
785 785
     }
786 786
 
787 787
 
@@ -795,36 +795,36 @@  discard block
 block discarded – undo
795 795
 //HACK by domifara
796 796
     if (defined('XOOPS_CUBE_LEGACY')) {
797 797
         $handler = xoops_getHandler('block');
798
-        $new_block = $handler->create(false) ;
798
+        $new_block = $handler->create(false);
799 799
     } else {
800
-        $new_block = new XoopsBlock() ;
800
+        $new_block = new XoopsBlock();
801 801
     }
802 802
 
803
-            $new_block->setNew() ;
804
-            $new_block->setVar('name', $this->get_blockname_from_ctype('C')) ;
805
-            $new_block->setVar('block_type', 'C') ;
806
-            $new_block->setVar('func_num', 0) ;
807
-            $bid = $new_block->store() ;
808
-            $request = $this->fetchRequest4Block(0) ;
803
+            $new_block->setNew();
804
+            $new_block->setVar('name', $this->get_blockname_from_ctype('C'));
805
+            $new_block->setVar('block_type', 'C');
806
+            $new_block->setVar('func_num', 0);
807
+            $bid = $new_block->store();
808
+            $request = $this->fetchRequest4Block(0);
809 809
         // permission copy
810 810
         foreach ($GLOBALS['xoopsUser']->getGroups() as $gid) {
811
-            $sql = 'INSERT INTO ' . $this->db->prefix('group_permission') . " (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES ($gid, $bid, 1, 'block_read')";
811
+            $sql = 'INSERT INTO '.$this->db->prefix('group_permission')." (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES ($gid, $bid, 1, 'block_read')";
812 812
             $this->db->query($sql);
813 813
         }
814 814
         } else {
815
-            $request = $this->fetchRequest4Block($bid) ;
815
+            $request = $this->fetchRequest4Block($bid);
816 816
         }
817 817
 
818 818
     // update the block by the request
819
-    $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()) ;
819
+    $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 820
 
821 821
     // block_module_link update
822
-    $this->updateBlockModuleLink($bid, $request['bmodule']) ;
822
+    $this->updateBlockModuleLink($bid, $request['bmodule']);
823 823
 
824 824
     // group_permission update
825
-    $this->updateBlockReadGroupPerm($bid, $request['bgroup']) ;
825
+    $this->updateBlockReadGroupPerm($bid, $request['bgroup']);
826 826
 
827
-        return $msg ;
827
+        return $msg;
828 828
     }
829 829
 
830 830
 
@@ -835,57 +835,57 @@  discard block
 block discarded – undo
835 835
 //HACK by domifara
836 836
     if (defined('XOOPS_CUBE_LEGACY')) {
837 837
         $handler = xoops_getHandler('block');
838
-        $block = $handler->create(false) ;
839
-        $block->load($bid) ;
838
+        $block = $handler->create(false);
839
+        $block->load($bid);
840 840
     } else {
841
-        $block = new XoopsBlock($bid) ;
841
+        $block = new XoopsBlock($bid);
842 842
     }
843 843
 
844
-        if (! $block->getVar('bid')) {
844
+        if (!$block->getVar('bid')) {
845 845
             // new defaults
846
-        $bid = 0 ;
847
-            $mode = 'new' ;
848
-            $block->setVar('mid', 0) ;
849
-            $block->setVar('block_type', 'C') ;
846
+        $bid = 0;
847
+            $mode = 'new';
848
+            $block->setVar('mid', 0);
849
+            $block->setVar('block_type', 'C');
850 850
         }
851 851
 
852 852
         switch ($mode) {
853 853
         case 'clone':
854
-            $form_title = _MD_A_MYBLOCKSADMIN_CLONEFORM ;
855
-            $button_value = _MD_A_MYBLOCKSADMIN_BTN_CLONE ;
856
-            $next_op = 'clone_ok' ;
854
+            $form_title = _MD_A_MYBLOCKSADMIN_CLONEFORM;
855
+            $button_value = _MD_A_MYBLOCKSADMIN_BTN_CLONE;
856
+            $next_op = 'clone_ok';
857 857
             // breadcrumbs
858
-            $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ;
859
-            $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_CLONEFORM) ;
860
-            break ;
858
+            $breadcrumbsObj = AltsysBreadcrumbs::getInstance();
859
+            $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_CLONEFORM);
860
+            break;
861 861
         case 'new':
862
-            $form_title = _MD_A_MYBLOCKSADMIN_NEWFORM ;
863
-            $button_value = _MD_A_MYBLOCKSADMIN_BTN_NEW ;
864
-            $next_op = 'new_ok' ;
862
+            $form_title = _MD_A_MYBLOCKSADMIN_NEWFORM;
863
+            $button_value = _MD_A_MYBLOCKSADMIN_BTN_NEW;
864
+            $next_op = 'new_ok';
865 865
             // breadcrumbs
866
-            $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ;
867
-            $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_NEWFORM) ;
868
-            break ;
866
+            $breadcrumbsObj = AltsysBreadcrumbs::getInstance();
867
+            $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_NEWFORM);
868
+            break;
869 869
         case 'edit':
870 870
         default:
871
-            $form_title = _MD_A_MYBLOCKSADMIN_EDITFORM ;
872
-            $button_value = _MD_A_MYBLOCKSADMIN_BTN_EDIT ;
873
-            $next_op = 'edit_ok' ;
871
+            $form_title = _MD_A_MYBLOCKSADMIN_EDITFORM;
872
+            $button_value = _MD_A_MYBLOCKSADMIN_BTN_EDIT;
873
+            $next_op = 'edit_ok';
874 874
             // breadcrumbs
875
-            $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ;
876
-            $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_EDITFORM) ;
877
-            break ;
875
+            $breadcrumbsObj = AltsysBreadcrumbs::getInstance();
876
+            $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_EDITFORM);
877
+            break;
878 878
     }
879 879
 
880
-        $is_custom = in_array($block->getVar('block_type'), array( 'C', 'E' )) ? true : false ;
881
-        $block_template =& $block->getVar('template', 'n') ;
882
-        $block_template_tplset = '' ;
880
+        $is_custom = in_array($block->getVar('block_type'), array('C', 'E')) ? true : false;
881
+        $block_template = & $block->getVar('template', 'n');
882
+        $block_template_tplset = '';
883 883
 
884
-        if (! $is_custom && $block_template) {
884
+        if (!$is_custom && $block_template) {
885 885
             // find template of the block
886 886
         $tplfile_handler = xoops_getHandler('tplfile');
887
-            $found_templates = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', null, null, $block_template) ;
888
-            $block_template_tplset = count($found_templates) > 0 ? $GLOBALS['xoopsConfig']['template_set'] : 'default' ;
887
+            $found_templates = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', null, null, $block_template);
888
+            $block_template_tplset = count($found_templates) > 0 ? $GLOBALS['xoopsConfig']['template_set'] : 'default';
889 889
         }
890 890
 //HACK by domifara
891 891
 /*
@@ -894,43 +894,43 @@  discard block
 block discarded – undo
894 894
     }
895 895
 */
896 896
     $block_data = $this->preview_request + array(
897
-        'bid' => $bid ,
898
-        'name' => $block->getVar('name', 'n') ,
899
-        'title' => $block->getVar('title', 'n') ,
897
+        'bid' => $bid,
898
+        'name' => $block->getVar('name', 'n'),
899
+        'title' => $block->getVar('title', 'n'),
900 900
             'weight' => (int)$block->getVar('weight'),
901 901
             'bcachetime' => (int)$block->getVar('bcachetime'),
902 902
             'side' => (int)$block->getVar('side'),
903 903
             'visible' => (int)$block->getVar('visible'),
904
-        'template' => $block_template ,
905
-        'template_tplset' => $block_template_tplset ,
906
-        'options' => $block->getVar('options') ,
907
-        'content' => $block->getVar('content', 'n') ,
908
-        'is_custom' => $is_custom ,
909
-        'type' => $block->getVar('block_type') ,
904
+        'template' => $block_template,
905
+        'template_tplset' => $block_template_tplset,
906
+        'options' => $block->getVar('options'),
907
+        'content' => $block->getVar('content', 'n'),
908
+        'is_custom' => $is_custom,
909
+        'type' => $block->getVar('block_type'),
910 910
         'ctype' => $block->getVar('c_type')
911
-    ) ;
911
+    );
912 912
 
913 913
         $block4assign = array(
914
-        'name_raw' => $block_data['name'] ,
915
-        'title_raw' => $block_data['title'] ,
916
-        'content_raw' => $block_data['content'] ,
917
-        'cell_position' => $this->renderCell4BlockPosition($block_data) ,
918
-        'cell_module_link' => $this->renderCell4BlockModuleLink($block_data) ,
919
-        'cell_group_perm' =>  $this->renderCell4BlockReadGroupPerm($block_data) ,
920
-        'cell_options' => $this->renderCell4BlockOptions($block_data) ,
914
+        'name_raw' => $block_data['name'],
915
+        'title_raw' => $block_data['title'],
916
+        'content_raw' => $block_data['content'],
917
+        'cell_position' => $this->renderCell4BlockPosition($block_data),
918
+        'cell_module_link' => $this->renderCell4BlockModuleLink($block_data),
919
+        'cell_group_perm' =>  $this->renderCell4BlockReadGroupPerm($block_data),
920
+        'cell_options' => $this->renderCell4BlockOptions($block_data),
921 921
         'content_preview' => $this->previewContent($block_data)
922
-    ) + $block_data ;
922
+    ) + $block_data;
923 923
 
924 924
     // display
925
-    require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ;
926
-        $tpl = new D3Tpl() ;
925
+    require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php';
926
+        $tpl = new D3Tpl();
927 927
 
928 928
     //HACK by domifara
929 929
     if (defined('XOOPS_CUBE_LEGACY')) {
930
-        $tpl->assign('xoops_cube_legacy', true) ;
930
+        $tpl->assign('xoops_cube_legacy', true);
931 931
         include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
932 932
     } else {
933
-        $tpl->assign('xoops_cube_legacy', false) ;
933
+        $tpl->assign('xoops_cube_legacy', false);
934 934
     }
935 935
 
936 936
         $tpl->assign(array(
@@ -945,14 +945,14 @@  discard block
 block discarded – undo
945 945
         'submit_button' => $button_value,
946 946
         'common_fck_installed' => $this->checkFck(),
947 947
         'gticket_hidden' => $GLOBALS['xoopsGTicket']->getTicketHtml(__LINE__, 1800, 'myblocksadmin')
948
-    )) ;
948
+    ));
949 949
 
950 950
         if (defined('XOOPS_CUBE_LEGACY')) {
951
-            $tpl->display('db:altsys_main_myblocksadmin_edit_4legacy.html') ;
951
+            $tpl->display('db:altsys_main_myblocksadmin_edit_4legacy.html');
952 952
         } else {
953
-            $tpl->display('db:altsys_main_myblocksadmin_edit.html') ;
953
+            $tpl->display('db:altsys_main_myblocksadmin_edit.html');
954 954
         }
955
-        return ;
955
+        return;
956 956
     }
957 957
 
958 958
     public function checkFck()
@@ -964,16 +964,16 @@  discard block
 block discarded – undo
964 964
     {
965 965
         $bid = (int)$block_data['bid'];
966 966
 
967
-        if (! $block_data['is_custom']) {
968
-            return '' ;
967
+        if (!$block_data['is_custom']) {
968
+            return '';
969 969
         }
970 970
         if (empty($this->preview_request)) {
971
-            return '' ;
971
+            return '';
972 972
         }
973 973
 
974 974
 //HACK by domifara
975 975
 //TODO : need no hook block at this
976
-    $block = new XoopsBlock($bid) ;
976
+    $block = new XoopsBlock($bid);
977 977
 /*
978 978
     $handler = xoops_gethandler('block');
979 979
     $block =& $handler->create(false) ;
@@ -981,68 +981,68 @@  discard block
 block discarded – undo
981 981
 */
982 982
 
983 983
     if ($block->getVar('mid')) {
984
-        return '' ;
984
+        return '';
985 985
     }
986 986
 
987
-        $block->setVar('title', $block_data['title']) ;
988
-        $block->setVar('content', $block_data['content']) ;
987
+        $block->setVar('title', $block_data['title']);
988
+        $block->setVar('content', $block_data['content']);
989 989
 
990
-        restore_error_handler() ;
991
-        $original_level = error_reporting(E_ALL) ;
992
-        $ret =& $block->getContent('S', $block_data['ctype']) ;
993
-        error_reporting($original_level) ;
990
+        restore_error_handler();
991
+        $original_level = error_reporting(E_ALL);
992
+        $ret = & $block->getContent('S', $block_data['ctype']);
993
+        error_reporting($original_level);
994 994
 
995
-        return $ret ;
995
+        return $ret;
996 996
     }
997 997
 
998 998
 
999 999
     public function get_blockname_from_ctype($bctype)
1000 1000
     {
1001 1001
         $ctypes = array(
1002
-        'H' => _MD_A_MYBLOCKSADMIN_CTYPE_HTML ,
1003
-        'S' => _MD_A_MYBLOCKSADMIN_CTYPE_SMILE ,
1004
-        'N' => _MD_A_MYBLOCKSADMIN_CTYPE_NOSMILE ,
1002
+        'H' => _MD_A_MYBLOCKSADMIN_CTYPE_HTML,
1003
+        'S' => _MD_A_MYBLOCKSADMIN_CTYPE_SMILE,
1004
+        'N' => _MD_A_MYBLOCKSADMIN_CTYPE_NOSMILE,
1005 1005
         'P' => _MD_A_MYBLOCKSADMIN_CTYPE_PHP
1006
-    ) ;
1006
+    );
1007 1007
 
1008
-        return isset($ctypes[$bctype]) ? $ctypes[$bctype] : _MD_A_MYBLOCKSADMIN_CTYPE_SMILE ;
1008
+        return isset($ctypes[$bctype]) ? $ctypes[$bctype] : _MD_A_MYBLOCKSADMIN_CTYPE_SMILE;
1009 1009
     }
1010 1010
 
1011 1011
 
1012 1012
     public function processPost()
1013 1013
     {
1014 1014
         // Ticket Check
1015
-    if (! $GLOBALS['xoopsGTicket']->check(true, 'myblocksadmin')) {
1015
+    if (!$GLOBALS['xoopsGTicket']->check(true, 'myblocksadmin')) {
1016 1016
         redirect_header(XOOPS_URL.'/', 3, $GLOBALS['xoopsGTicket']->getErrors());
1017 1017
     }
1018 1018
 
1019
-        $msg = '' ;
1019
+        $msg = '';
1020 1020
         $bid = (int)(@$_GET['bid']);
1021
-        if (! empty($_POST['preview'])) {
1021
+        if (!empty($_POST['preview'])) {
1022 1022
             // preview
1023
-        $this->preview_request = $this->fetchRequest4Block($bid) ;
1024
-            $_GET['op'] = str_replace('_ok', '', @$_POST['op']) ;
1025
-            return ; // continue ;
1023
+        $this->preview_request = $this->fetchRequest4Block($bid);
1024
+            $_GET['op'] = str_replace('_ok', '', @$_POST['op']);
1025
+            return; // continue ;
1026 1026
         } elseif (@$_POST['op'] == 'order') {
1027 1027
             // order ok
1028
-        $msg = $this->do_order() ;
1028
+        $msg = $this->do_order();
1029 1029
         } elseif (@$_POST['op'] == 'delete_ok') {
1030 1030
             // delete ok
1031
-        $msg = $this->do_delete($bid) ;
1031
+        $msg = $this->do_delete($bid);
1032 1032
         } elseif (@$_POST['op'] == 'clone_ok') {
1033 1033
             // clone ok
1034
-        $msg = $this->do_clone($bid) ;
1034
+        $msg = $this->do_clone($bid);
1035 1035
         } elseif (@$_POST['op'] == 'edit_ok' || @$_POST['op'] == 'new_ok') {
1036 1036
             // edit ok
1037
-        $msg = $this->do_edit($bid) ;
1038
-        } elseif (! empty($_POST['submit'])) {
1037
+        $msg = $this->do_edit($bid);
1038
+        } elseif (!empty($_POST['submit'])) {
1039 1039
             // update module_admin,module_read,block_read
1040
-        include dirname(__DIR__).'/include/mygroupperm.php' ;
1041
-            $msg = _MD_A_MYBLOCKSADMIN_PERMUPDATED ;
1040
+        include dirname(__DIR__).'/include/mygroupperm.php';
1041
+            $msg = _MD_A_MYBLOCKSADMIN_PERMUPDATED;
1042 1042
         }
1043 1043
 
1044
-        redirect_header('?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$this->target_dirname, 1, $msg) ;
1045
-        exit ;
1044
+        redirect_header('?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$this->target_dirname, 1, $msg);
1045
+        exit;
1046 1046
     }
1047 1047
 
1048 1048
 
@@ -1051,22 +1051,22 @@  discard block
 block discarded – undo
1051 1051
         $bid = (int)(@$_GET['bid']);
1052 1052
         switch (@$_GET['op']) {
1053 1053
         case 'clone':
1054
-            $this->form_edit($bid, 'clone') ;
1055
-            break ;
1054
+            $this->form_edit($bid, 'clone');
1055
+            break;
1056 1056
         case 'new':
1057 1057
         case 'edit':
1058
-            $this->form_edit($bid, 'edit') ;
1059
-            break ;
1058
+            $this->form_edit($bid, 'edit');
1059
+            break;
1060 1060
         case 'delete':
1061
-            $this->form_delete($bid) ;
1062
-            break ;
1061
+            $this->form_delete($bid);
1062
+            break;
1063 1063
         case 'list':
1064 1064
         default:
1065 1065
             // the first form (blocks)
1066
-            $this->list_blocks() ;
1066
+            $this->list_blocks();
1067 1067
             // the second form (groups)
1068
-            $this->list_groups() ;
1069
-            break ;
1068
+            $this->list_groups();
1069
+            break;
1070 1070
     }
1071 1071
     }
1072 1072
 }
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/class/AltsysBreadcrumbs.class.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 // singleton for xoops_breadcrumbs
4 4
 class AltsysBreadcrumbs
5 5
 {
6
-    public $paths = array() ;
6
+    public $paths = array();
7 7
 
8 8
     public function __construct()
9 9
     {
@@ -12,29 +12,29 @@  discard block
 block discarded – undo
12 12
 //function &getInstance()
13 13
 public static function &getInstance()
14 14
 {
15
-    static $instance ;
16
-    if (! isset($instance)) {
17
-        $instance = new AltsysBreadcrumbs() ;
15
+    static $instance;
16
+    if (!isset($instance)) {
17
+        $instance = new AltsysBreadcrumbs();
18 18
     }
19
-    return $instance ;
19
+    return $instance;
20 20
 }
21 21
 
22 22
     public function getXoopsBreadcrumbs()
23 23
     {
24
-        $ret = array() ;
24
+        $ret = array();
25 25
         foreach ($this->paths as $val) {
26 26
             // delayed language constant
27 27
         if (substr($val['name'], 0, 1) == '_' && defined($val['name'])) {
28 28
             $ret[] = array(
29
-                'url' => $val['url'] ,
29
+                'url' => $val['url'],
30 30
                 'name' => constant($val['name'])
31
-            ) ;
31
+            );
32 32
         } else {
33
-            $ret[] = $val ;
33
+            $ret[] = $val;
34 34
         }
35 35
         }
36
-        unset($ret[count($ret) - 1 ]['url']) ;
37
-        return $ret ;
36
+        unset($ret[count($ret) - 1]['url']);
37
+        return $ret;
38 38
     }
39 39
 
40 40
 // all data should be escaped
@@ -43,19 +43,19 @@  discard block
 block discarded – undo
43 43
     if (is_array($url_or_path)) {
44 44
         if (empty($url_or_path['name'])) {
45 45
             // multiple paths
46
-            $this->paths = array_merge($this->paths, $url_or_path) ;
46
+            $this->paths = array_merge($this->paths, $url_or_path);
47 47
         } else {
48 48
             // array format (just a path)
49
-            $this->paths[] = $url_or_path ;
49
+            $this->paths[] = $url_or_path;
50 50
         }
51 51
     } else {
52 52
         // separate format
53
-        $this->paths[] = array( 'url' => $url_or_path , 'name' => $name ) ;
53
+        $this->paths[] = array('url' => $url_or_path, 'name' => $name);
54 54
     }
55 55
 }
56 56
 
57 57
     public function hasPaths()
58 58
     {
59
-        return ! empty($this->paths) ;
59
+        return !empty($this->paths);
60 60
     }
61 61
 }
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/class/d3utilities.php 1 patch
Spacing   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -2,40 +2,40 @@  discard block
 block discarded – undo
2 2
 
3 3
 class d3utilities
4 4
 {
5
-    public $dirname = '' ; // directory name under xoops_trust_path
6
-    public $mydirname = '' ; // each directory name under xoops_root_path
7
-    public $mid = 0 ; // id of each module instance
8
-    public $table = '' ; // table with prefix and dirname
9
-    public $primary_key = '' ; // column for primary_key
10
-    public $cols = array() ; // settings of each columns
11
-    public $form_mode = 'new' ; // 'new','edit' are available
12
-    public $page_name = '' ; // controller's name  eg) page=(controller) in URI
13
-    public $action_base_hiddens = array() ;
5
+    public $dirname = ''; // directory name under xoops_trust_path
6
+    public $mydirname = ''; // each directory name under xoops_root_path
7
+    public $mid = 0; // id of each module instance
8
+    public $table = ''; // table with prefix and dirname
9
+    public $primary_key = ''; // column for primary_key
10
+    public $cols = array(); // settings of each columns
11
+    public $form_mode = 'new'; // 'new','edit' are available
12
+    public $page_name = ''; // controller's name  eg) page=(controller) in URI
13
+    public $action_base_hiddens = array();
14 14
 
15 15
 //HACK by domifara
16 16
 //	public function D3Utilities( $mydirname , $table_body , $primary_key , $cols , $page_name , $action_base_hiddens )
17 17
     public function __construct($mydirname, $table_body, $primary_key, $cols, $page_name, $action_base_hiddens)
18 18
     {
19
-        $db = XoopsDatabaseFactory::getDatabaseConnection() ;
20
-
21
-        $this->dirname = basename(dirname(__DIR__)) ;
22
-        $this->mydirname = $mydirname ;
23
-        $this->table = $db->prefix($mydirname ? $mydirname . '_' . $table_body : $table_body) ;
24
-        $this->primary_key = $primary_key ;
25
-        $this->cols = $cols ;
26
-        $module_handler = xoops_getHandler('module') ;
27
-        $module = $module_handler->getByDirname($this->mydirname) ;
28
-        if (! empty($module)) {
19
+        $db = XoopsDatabaseFactory::getDatabaseConnection();
20
+
21
+        $this->dirname = basename(dirname(__DIR__));
22
+        $this->mydirname = $mydirname;
23
+        $this->table = $db->prefix($mydirname ? $mydirname.'_'.$table_body : $table_body);
24
+        $this->primary_key = $primary_key;
25
+        $this->cols = $cols;
26
+        $module_handler = xoops_getHandler('module');
27
+        $module = $module_handler->getByDirname($this->mydirname);
28
+        if (!empty($module)) {
29 29
             $this->mid = (int)$module->getVar('mid');
30 30
         }
31
-        $this->page_name = $page_name ;
32
-        $this->action_base_hiddens = $action_base_hiddens ;
31
+        $this->page_name = $page_name;
32
+        $this->action_base_hiddens = $action_base_hiddens;
33 33
     }
34 34
 
35 35
 
36 36
     public function get_language_constant($name)
37 37
     {
38
-        return constant(strtoupper('_MD_A_' . $this->dirname . '_' . $this->page_name . '_' . $name)) ;
38
+        return constant(strtoupper('_MD_A_'.$this->dirname.'_'.$this->page_name.'_'.$name));
39 39
     }
40 40
 
41 41
 
@@ -45,22 +45,22 @@  discard block
 block discarded – undo
45 45
             case 'text':
46 46
             case 'blob':
47 47
                 $length = empty($col['length']) ? 65535 : (int)$col['length'];
48
-                return "`{$col['name']}`='".addslashes(xoops_substr($value, 0, $length))."'" ;
48
+                return "`{$col['name']}`='".addslashes(xoops_substr($value, 0, $length))."'";
49 49
             case 'char':
50 50
             case 'varchar':
51 51
             case 'string':
52 52
                 $length = empty($col['length']) ? 255 : (int)$col['length'];
53
-                return "`{$col['name']}`='".addslashes(xoops_substr($value, 0, $length))."'" ;
53
+                return "`{$col['name']}`='".addslashes(xoops_substr($value, 0, $length))."'";
54 54
             case 'int':
55 55
             case 'integer':
56 56
                 $value = (int)$value;
57
-                if (! empty($col['max'])) {
58
-                    $value = min($value, (int)$col['max']) ;
57
+                if (!empty($col['max'])) {
58
+                    $value = min($value, (int)$col['max']);
59 59
                 }
60
-                if (! empty($col['min'])) {
61
-                    $value = max($value, (int)$col['min']) ;
60
+                if (!empty($col['min'])) {
61
+                    $value = max($value, (int)$col['min']);
62 62
                 }
63
-                return "`{$col['name']}`=$value" ;
63
+                return "`{$col['name']}`=$value";
64 64
         }
65 65
     }
66 66
 
@@ -68,29 +68,29 @@  discard block
 block discarded – undo
68 68
     // single update or insert
69 69
     public function insert()
70 70
     {
71
-        $db = XoopsDatabaseFactory::getDatabaseConnection() ;
71
+        $db = XoopsDatabaseFactory::getDatabaseConnection();
72 72
 
73
-        $id = $this->init_default_values() ;
73
+        $id = $this->init_default_values();
74 74
 
75
-        $set4sql = '' ;
75
+        $set4sql = '';
76 76
         foreach ($this->cols as $col) {
77 77
             if (empty($col['edit_edit'])) {
78
-                continue ;
78
+                continue;
79 79
             }
80 80
             if ($col['name'] == $this->primary_key) {
81
-                continue ;
81
+                continue;
82 82
             }
83
-            $set4sql .= $this->get_set4sql(@$_POST[ $col['name'] ], $col) . ',' ;
83
+            $set4sql .= $this->get_set4sql(@$_POST[$col['name']], $col).',';
84 84
         }
85
-        if (! empty($set4sql)) {
85
+        if (!empty($set4sql)) {
86 86
             if ($id > 0) {
87 87
                 // UPDATE
88
-                $db->queryF("UPDATE $this->table SET ".substr($set4sql, 0, -1)." WHERE $this->primary_key='".addslashes($id)."'") ;
89
-                return array( $id , 'update' ) ;
88
+                $db->queryF("UPDATE $this->table SET ".substr($set4sql, 0, -1)." WHERE $this->primary_key='".addslashes($id)."'");
89
+                return array($id, 'update');
90 90
             } else {
91 91
                 // INSERT
92
-                $db->queryF("INSERT INTO $this->table SET ".substr($set4sql, 0, -1)) ;
93
-                return array( $db->getInsertId() , 'insert' ) ;
92
+                $db->queryF("INSERT INTO $this->table SET ".substr($set4sql, 0, -1));
93
+                return array($db->getInsertId(), 'insert');
94 94
             }
95 95
         }
96 96
     }
@@ -99,156 +99,156 @@  discard block
 block discarded – undo
99 99
     // multiple update
100 100
     public function update()
101 101
     {
102
-        $db = XoopsDatabaseFactory::getDatabaseConnection() ;
102
+        $db = XoopsDatabaseFactory::getDatabaseConnection();
103 103
 
104 104
         // search appropriate column for getting primary_key
105 105
         foreach ($this->cols as $col) {
106
-            if (in_array(@$col['list_edit'], array( 'text', 'textarea', 'hidden' ))) {
107
-                $column4key = $col['name'] ;
108
-                break ;
106
+            if (in_array(@$col['list_edit'], array('text', 'textarea', 'hidden'))) {
107
+                $column4key = $col['name'];
108
+                break;
109 109
             }
110 110
         }
111 111
         if (empty($column4key)) {
112
-            $column4key = $this->cols[0]['name'] ;
112
+            $column4key = $this->cols[0]['name'];
113 113
         }
114 114
 
115
-        $ret = array() ;
115
+        $ret = array();
116 116
         foreach (array_keys($_POST[$column4key]) as $id) {
117
-            $id = (int)$id;    // primary_key should be 'integer'
118
-            $set4sql = '' ;
117
+            $id = (int)$id; // primary_key should be 'integer'
118
+            $set4sql = '';
119 119
             foreach ($this->cols as $col) {
120 120
                 if (empty($col['list_edit'])) {
121
-                    continue ;
121
+                    continue;
122 122
                 }
123 123
                 if ($col['name'] == $this->primary_key) {
124
-                    continue ;
124
+                    continue;
125 125
                 }
126
-                $set4sql .= $this->get_set4sql(@$_POST[ $col['name'] ][$id], $col) . ',' ;
126
+                $set4sql .= $this->get_set4sql(@$_POST[$col['name']][$id], $col).',';
127 127
             }
128
-            if (! empty($set4sql)) {
129
-                $result = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id") ;
128
+            if (!empty($set4sql)) {
129
+                $result = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id");
130 130
                 if ($db->getRowsNum($result) == 1) {
131
-                    $db->queryF("UPDATE $this->table SET ".substr($set4sql, 0, -1)." WHERE $this->primary_key=$id") ;
131
+                    $db->queryF("UPDATE $this->table SET ".substr($set4sql, 0, -1)." WHERE $this->primary_key=$id");
132 132
                     if ($db->getAffectedRows() == 1) {
133
-                        $ret[ $id ] = $db->fetchArray($result) ;
133
+                        $ret[$id] = $db->fetchArray($result);
134 134
                     }
135 135
                 }
136 136
             }
137 137
         }
138 138
 
139
-        return $ret ;
139
+        return $ret;
140 140
     }
141 141
 
142 142
 
143 143
     public function delete($delete_comments = false, $delete_notifications = false)
144 144
     {
145
-        $db = XoopsDatabaseFactory::getDatabaseConnection() ;
145
+        $db = XoopsDatabaseFactory::getDatabaseConnection();
146 146
 
147
-        $ret = array() ;
147
+        $ret = array();
148 148
         foreach (array_keys($_POST['admin_main_checkboxes']) as $id) {
149
-            $id = (int)$id;    // primary_key should be 'integer'
150
-            $result = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id") ;
149
+            $id = (int)$id; // primary_key should be 'integer'
150
+            $result = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id");
151 151
             if ($db->getRowsNum($result) == 1) {
152
-                $ret[ $id ] = $db->fetchArray($result) ;
152
+                $ret[$id] = $db->fetchArray($result);
153 153
 
154
-                $db->queryF("DELETE FROM $this->table WHERE $this->primary_key=$id") ;
154
+                $db->queryF("DELETE FROM $this->table WHERE $this->primary_key=$id");
155 155
                 if ($delete_comments) {
156 156
                     // remove comments
157
-                    $db->queryF('DELETE FROM ' . $db->prefix('xoopscomments') . " WHERE com_modid=$this->mid AND com_itemid=$id") ;
157
+                    $db->queryF('DELETE FROM '.$db->prefix('xoopscomments')." WHERE com_modid=$this->mid AND com_itemid=$id");
158 158
                 }
159 159
 
160 160
                 if ($delete_notifications) {
161 161
                     // remove notifications
162
-                    $db->queryF('DELETE FROM ' . $db->prefix('xoopsnotifications') . " WHERE not_modid=$this->mid AND not_itemid=$id") ;
162
+                    $db->queryF('DELETE FROM '.$db->prefix('xoopsnotifications')." WHERE not_modid=$this->mid AND not_itemid=$id");
163 163
                 }
164 164
             }
165 165
         }
166 166
 
167
-        return $ret ;
167
+        return $ret;
168 168
     }
169 169
 
170 170
 
171 171
     public function init_default_values()
172 172
     {
173
-        $db = XoopsDatabaseFactory::getDatabaseConnection() ;
173
+        $db = XoopsDatabaseFactory::getDatabaseConnection();
174 174
 
175 175
         if (@$_GET['id']) {
176 176
             $id = (int)$_GET['id'];
177
-            $rs = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id") ;
177
+            $rs = $db->query("SELECT * FROM $this->table WHERE $this->primary_key=$id");
178 178
             if ($db->getRowsNum($rs) == 1) {
179
-                $row = $db->fetchArray($rs) ;
179
+                $row = $db->fetchArray($rs);
180 180
                 foreach (array_keys($this->cols) as $key) {
181 181
                     if (empty($this->cols[$key]['edit_show'])) {
182
-                        continue ;
182
+                        continue;
183 183
                     }
184
-                    $this->cols[$key]['default_value'] = $row[ $this->cols[$key]['name'] ] ;
184
+                    $this->cols[$key]['default_value'] = $row[$this->cols[$key]['name']];
185 185
                 }
186
-                $this->form_mode = 'edit' ;
187
-                return $id ;
186
+                $this->form_mode = 'edit';
187
+                return $id;
188 188
             }
189 189
         }
190 190
 
191
-        $this->form_mode = 'new' ;
192
-        return 0 ;
191
+        $this->form_mode = 'new';
192
+        return 0;
193 193
     }
194 194
 
195 195
 
196 196
     public function get_view_edit()
197 197
     {
198
-        $id = $this->init_default_values() ;
198
+        $id = $this->init_default_values();
199 199
 
200
-        $lines = array() ;
200
+        $lines = array();
201 201
         foreach ($this->cols as $col) {
202 202
             if (empty($col['edit_show'])) {
203
-                continue ;
203
+                continue;
204 204
             }
205
-            if (! isset($col['default_value'])) {
205
+            if (!isset($col['default_value'])) {
206 206
                 switch ($col['type']) {
207 207
                     case 'int':
208 208
                     case 'integer':
209
-                        $col['default_value'] = 0 ;
210
-                        break ;
209
+                        $col['default_value'] = 0;
210
+                        break;
211 211
                     default:
212
-                        $col['default_value'] = '' ;
213
-                        break ;
212
+                        $col['default_value'] = '';
213
+                        break;
214 214
                 }
215 215
             }
216 216
             switch ($col['edit_edit']) {
217 217
                 case 'checkbox':
218
-                    $checked = empty($col['default_value']) ? '' : "checked='checked'" ;
219
-                    $value = empty($col['checkbox_value']) ? 1 : htmlspecialchars($col['checkbox_value'], ENT_QUOTES) ;
218
+                    $checked = empty($col['default_value']) ? '' : "checked='checked'";
219
+                    $value = empty($col['checkbox_value']) ? 1 : htmlspecialchars($col['checkbox_value'], ENT_QUOTES);
220 220
 
221
-                    $lines[ $col['name'] ] = "<input type='checkbox' name='{$col['name']}' value='$value' $checked />" ;
222
-                    break ;
221
+                    $lines[$col['name']] = "<input type='checkbox' name='{$col['name']}' value='$value' $checked />";
222
+                    break;
223 223
                 case 'text':
224 224
                 default:
225 225
                     $size = empty($col['edit_size']) ? 32 : (int)$col['edit_size'];
226 226
                     $length = empty($col['length']) ? 255 : (int)$col['length'];
227
-                    $lines[ $col['name'] ] = "<input type='text' name='{$col['name']}' size='$size' maxlength='$length' value='".htmlspecialchars($col['default_value'], ENT_QUOTES)."' />" ;
228
-                    break ;
227
+                    $lines[$col['name']] = "<input type='text' name='{$col['name']}' size='$size' maxlength='$length' value='".htmlspecialchars($col['default_value'], ENT_QUOTES)."' />";
228
+                    break;
229 229
                 case false:
230
-                    $lines[ $col['name'] ] = htmlspecialchars($col['default_value'], ENT_QUOTES) ;
231
-                    break ;
230
+                    $lines[$col['name']] = htmlspecialchars($col['default_value'], ENT_QUOTES);
231
+                    break;
232 232
             }
233 233
         }
234 234
 
235
-        return array( $id , $lines ) ;
235
+        return array($id, $lines);
236 236
     }
237 237
 
238 238
 
239 239
     public function get_control_form($controllers)
240 240
     {
241
-        $hiddens = '' ;
241
+        $hiddens = '';
242 242
         foreach ($this->action_base_hiddens as $key => $val) {
243
-            $key4disp = htmlspecialchars($key, ENT_QUOTES) ;
244
-            $val4disp = htmlspecialchars($val, ENT_QUOTES) ;
245
-            $hiddens .= "<input type='hidden' name='$key4disp' value='$val4disp' />\n" ;
243
+            $key4disp = htmlspecialchars($key, ENT_QUOTES);
244
+            $val4disp = htmlspecialchars($val, ENT_QUOTES);
245
+            $hiddens .= "<input type='hidden' name='$key4disp' value='$val4disp' />\n";
246 246
         }
247 247
 
248
-        $controllers_html = '' ;
248
+        $controllers_html = '';
249 249
         foreach ($controllers as $type => $body) {
250 250
             if ($type == 'num') {
251
-                $controllers_html .= $this->get_select('num', $body, $GLOBALS['num']) ;
251
+                $controllers_html .= $this->get_select('num', $body, $GLOBALS['num']);
252 252
             }
253 253
         }
254 254
 
@@ -262,13 +262,13 @@  discard block
 block discarded – undo
262 262
 
263 263
     public function get_select($name, $options, $current_value)
264 264
     {
265
-        $ret = "<select name='".htmlspecialchars($name, ENT_QUOTES)."'>\n" ;
265
+        $ret = "<select name='".htmlspecialchars($name, ENT_QUOTES)."'>\n";
266 266
         foreach ($options as $key => $val) {
267 267
             $selected = $val == $current_value ? "selected='selected'" : '';
268
-            $ret .= "<option value='".htmlspecialchars($key, ENT_QUOTES)."' $selected>".htmlspecialchars($val, ENT_QUOTES)."</option>\n" ;
268
+            $ret .= "<option value='".htmlspecialchars($key, ENT_QUOTES)."' $selected>".htmlspecialchars($val, ENT_QUOTES)."</option>\n";
269 269
         }
270
-        $ret .= "</select>\n" ;
270
+        $ret .= "</select>\n";
271 271
 
272
-        return $ret ;
272
+        return $ret;
273 273
     }
274 274
 }
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/class/MyBlocksAdminForICMS.class.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
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
-    public $block_positions = array() ;
7
+    public $block_positions = array();
8 8
 
9 9
     public function MyBlocksAadminForICMS()
10 10
     {
@@ -13,14 +13,14 @@  discard block
 block discarded – undo
13 13
 
14 14
     public function construct()
15 15
     {
16
-        parent::construct() ;
16
+        parent::construct();
17 17
 
18
-        @include_once XOOPS_ROOT_PATH.'/modules/system/language/'.$this->lang.'/admin/blocksadmin.php' ;
19
-        $result = $this->db->query('SELECT id,pname,title FROM ' . $this->db->prefix('block_positions')) ;
18
+        @include_once XOOPS_ROOT_PATH.'/modules/system/language/'.$this->lang.'/admin/blocksadmin.php';
19
+        $result = $this->db->query('SELECT id,pname,title FROM '.$this->db->prefix('block_positions'));
20 20
         while (list($id, $pname, $title) = $this->db->fetchRow($result)) {
21
-            $this->block_positions[ $id ] = defined($title) ? constant($title) : $title ;
21
+            $this->block_positions[$id] = defined($title) ? constant($title) : $title;
22 22
         }
23
-        $this->block_positions[ -1 ] = _NONE ;
23
+        $this->block_positions[ -1] = _NONE;
24 24
     }
25 25
 
26 26
 //HACK by domifara for php5.3+
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     static $instance;
31 31
     if (!isset($instance)) {
32 32
         $instance = new MyBlocksAdminForICMS();
33
-        $instance->construct() ;
33
+        $instance->construct();
34 34
     }
35 35
     return $instance;
36 36
 }
@@ -45,23 +45,23 @@  discard block
 block discarded – undo
45 45
     // get selected targets
46 46
     if (is_array(@$block_data['bmodule'])) {
47 47
         // bmodule origined from request (preview etc.)
48
-        $selected_pages = $block_data['bmodule'] ;
48
+        $selected_pages = $block_data['bmodule'];
49 49
     } else {
50 50
         // origined from the table of `block_module_link`
51
-        $result = $this->db->query('SELECT module_id,page_id FROM ' . $this->db->prefix('block_module_link') . " WHERE block_id='$bid'") ;
51
+        $result = $this->db->query('SELECT module_id,page_id FROM '.$this->db->prefix('block_module_link')." WHERE block_id='$bid'");
52 52
         $selected_pages = array();
53 53
         while (list($mid, $pid) = $this->db->fetchRow($result)) {
54
-            $selected_pages[] = (int)$mid . '-' . (int)$pid;
54
+            $selected_pages[] = (int)$mid.'-'.(int)$pid;
55 55
         }
56 56
     }
57 57
 
58 58
     $page_handler = xoops_getHandler('page');
59 59
     $ret = "
60 60
 				<select name='bmodules[$bid][]' size='5' multiple='multiple'>
61
-					".$page_handler->getPageSelOptions($selected_pages) . '
61
+					".$page_handler->getPageSelOptions($selected_pages).'
62 62
 				</select>';
63 63
 
64
-    return $ret ;
64
+    return $ret;
65 65
 }
66 66
 
67 67
 
@@ -72,19 +72,19 @@  discard block
 block discarded – undo
72 72
     return "
73 73
 	<table>
74 74
 		<tr>
75
-			<td rowspan='2'>".$this->renderRadio4BlockPosition(1, $block_data) . '</td>
76
-			<td>' . $this->renderRadio4BlockPosition(3, $block_data) . '</td>
77
-			<td>' . $this->renderRadio4BlockPosition(4, $block_data) . '</td>
78
-			<td>' . $this->renderRadio4BlockPosition(5, $block_data) . "</td>
79
-			<td rowspan='2'>".$this->renderRadio4BlockPosition(2, $block_data) . '</td>
75
+			<td rowspan='2'>".$this->renderRadio4BlockPosition(1, $block_data).'</td>
76
+			<td>' . $this->renderRadio4BlockPosition(3, $block_data).'</td>
77
+			<td>' . $this->renderRadio4BlockPosition(4, $block_data).'</td>
78
+			<td>' . $this->renderRadio4BlockPosition(5, $block_data)."</td>
79
+			<td rowspan='2'>".$this->renderRadio4BlockPosition(2, $block_data).'</td>
80 80
 		</tr>
81 81
 		<tr>
82
-			<td>' . $this->renderRadio4BlockPosition(6, $block_data) . '</td>
83
-			<td>' . $this->renderRadio4BlockPosition(7, $block_data) . '</td>
84
-			<td>' . $this->renderRadio4BlockPosition(8, $block_data) . "</td>
82
+			<td>' . $this->renderRadio4BlockPosition(6, $block_data).'</td>
83
+			<td>' . $this->renderRadio4BlockPosition(7, $block_data).'</td>
84
+			<td>' . $this->renderRadio4BlockPosition(8, $block_data)."</td>
85 85
 		</tr>
86 86
 		<tr>
87
-			<td colspan='5'>".$this->renderRadio4BlockPositions($block_data, array(1, 2, 3, 4, 5, 6, 7, 8)) . '</td>
87
+			<td colspan='5'>".$this->renderRadio4BlockPositions($block_data, array(1, 2, 3, 4, 5, 6, 7, 8)).'</td>
88 88
 		</tr>
89 89
 	</table>';
90 90
 }
@@ -95,19 +95,19 @@  discard block
 block discarded – undo
95 95
 {
96 96
     $bid = (int)$block_data['bid'];
97 97
     $visible = (int)$block_data['visible'];
98
-    $current_side = $visible ? (int)$block_data['side'] : -1 ;
98
+    $current_side = $visible ? (int)$block_data['side'] : -1;
99 99
 
100
-    $label4disp = htmlspecialchars($this->block_positions[ $target_side ], ENT_QUOTES) ;
100
+    $label4disp = htmlspecialchars($this->block_positions[$target_side], ENT_QUOTES);
101 101
 
102 102
     if ($current_side == $target_side) {
103
-        $checked = "checked='checked'" ;
103
+        $checked = "checked='checked'";
104 104
         $divstyle = $target_side == -1 ? 'disabled' : 'selected';
105 105
     } else {
106 106
         $checked = '';
107 107
         $divstyle = 'unselected';
108 108
     }
109 109
 
110
-    return "<div class='blockposition $divstyle' title='$label4disp'><input type='radio' name='sides[$bid]' value='$target_side' class='blockposition' $checked /></div>" ;
110
+    return "<div class='blockposition $divstyle' title='$label4disp'><input type='radio' name='sides[$bid]' value='$target_side' class='blockposition' $checked /></div>";
111 111
 }
112 112
 
113 113
 
@@ -116,28 +116,28 @@  discard block
 block discarded – undo
116 116
 {
117 117
     $bid = (int)$block_data['bid'];
118 118
     $visible = (int)$block_data['visible'];
119
-    $current_side = $visible ? (int)$block_data['side'] : -1 ;
119
+    $current_side = $visible ? (int)$block_data['side'] : -1;
120 120
 
121
-    $ret = '' ;
121
+    $ret = '';
122 122
     foreach ($this->block_positions as $target_side => $label) {
123 123
         if (in_array($target_side, $skip_sides)) {
124
-            continue ;
124
+            continue;
125 125
         }
126 126
 
127
-        $label4disp = htmlspecialchars($label, ENT_QUOTES) ;
127
+        $label4disp = htmlspecialchars($label, ENT_QUOTES);
128 128
 
129 129
         if ($current_side == $target_side) {
130
-            $checked = "checked='checked'" ;
130
+            $checked = "checked='checked'";
131 131
             $divstyle = $target_side == -1 ? 'disabled' : 'selected';
132 132
         } else {
133 133
             $checked = '';
134 134
             $divstyle = 'unselected';
135 135
         }
136 136
 
137
-        $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>" ;
137
+        $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 138
     }
139 139
 
140
-    return $ret ;
140
+    return $ret;
141 141
 }
142 142
 
143 143
 
@@ -145,16 +145,16 @@  discard block
 block discarded – undo
145 145
 public function updateBlockModuleLink($bid, $bmodules)
146 146
 {
147 147
     $bid = (int)$bid;
148
-    $table = $this->db->prefix('block_module_link') ;
148
+    $table = $this->db->prefix('block_module_link');
149 149
 
150
-    $sql = "DELETE FROM `$table` WHERE `block_id`=$bid" ;
151
-    $this->db->query($sql) ;
150
+    $sql = "DELETE FROM `$table` WHERE `block_id`=$bid";
151
+    $this->db->query($sql);
152 152
     foreach ($bmodules as $mid) {
153
-        $regs = explode('-', $mid) ;
153
+        $regs = explode('-', $mid);
154 154
         $module_id = (int)(@$regs[0]);
155 155
         $page_id = (int)(@$regs[1]);
156
-        $sql = "INSERT INTO `$table` (`block_id`,`module_id`,`page_id`) VALUES ($bid,$module_id,$page_id)" ;
157
-        $this->db->query($sql) ;
156
+        $sql = "INSERT INTO `$table` (`block_id`,`module_id`,`page_id`) VALUES ($bid,$module_id,$page_id)";
157
+        $this->db->query($sql);
158 158
     }
159 159
 }
160 160
 }
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/class/MyBlocksAdminForX25.class.php 1 patch
Spacing   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
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
 {
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
 
12 12
     public function construct()
13 13
     {
14
-        parent::construct() ;
14
+        parent::construct();
15 15
 
16
-        @include_once XOOPS_ROOT_PATH.'/modules/system/language/'.$this->lang.'/admin/blocksadmin.php' ;
16
+        @include_once XOOPS_ROOT_PATH.'/modules/system/language/'.$this->lang.'/admin/blocksadmin.php';
17 17
     }
18 18
 
19 19
 //HACK by domifara for php5.3+
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     static $instance;
24 24
     if (!isset($instance)) {
25 25
         $instance = new MyBlocksAdminForX25();
26
-        $instance->construct() ;
26
+        $instance->construct();
27 27
     }
28 28
     return $instance;
29 29
 }
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     $sseln = $ssel0 = $ssel1 = $ssel3 = $ssel4 = $ssel5 = $ssel7 = $ssel8 = $ssel9 = '';
40 40
     $scoln = $scol0 = $scol1 = $scol3 = $scol4 = $scol5 = $scol7 = $scol8 = $scol9 = 'unselected';
41 41
     $stextbox = 'unselected';
42
-    $value4extra_side = '' ;
42
+    $value4extra_side = '';
43 43
 
44 44
     if ($visible != 1) {
45 45
         $sseln = " checked='checked'";
@@ -49,39 +49,39 @@  discard block
 block discarded – undo
49 49
         case XOOPS_SIDEBLOCK_LEFT:
50 50
             $ssel0 = " checked='checked'";
51 51
             $scol0 = 'selected';
52
-            break ;
52
+            break;
53 53
         case XOOPS_SIDEBLOCK_RIGHT:
54 54
             $ssel1 = " checked='checked'";
55 55
             $scol1 = 'selected';
56
-            break ;
56
+            break;
57 57
         case XOOPS_CENTERBLOCK_LEFT:
58 58
             $ssel3 = " checked='checked'";
59 59
             $scol3 = 'selected';
60
-            break ;
60
+            break;
61 61
         case XOOPS_CENTERBLOCK_RIGHT:
62 62
             $ssel4 = " checked='checked'";
63 63
             $scol4 = 'selected';
64
-            break ;
64
+            break;
65 65
         case XOOPS_CENTERBLOCK_CENTER:
66 66
             $ssel5 = " checked='checked'";
67 67
             $scol5 = 'selected';
68
-            break ;
68
+            break;
69 69
         case XOOPS_CENTERBLOCK_BOTTOMLEFT:
70 70
             $ssel7 = " checked='checked'";
71 71
             $scol7 = 'selected';
72
-            break ;
72
+            break;
73 73
         case XOOPS_CENTERBLOCK_BOTTOMRIGHT:
74 74
             $ssel8 = " checked='checked'";
75 75
             $scol8 = 'selected';
76
-            break ;
76
+            break;
77 77
         case XOOPS_CENTERBLOCK_BOTTOM:
78 78
             $ssel9 = " checked='checked'";
79 79
             $scol9 = 'selected';
80
-            break ;
80
+            break;
81 81
         default:
82
-            $value4extra_side = $side ;
82
+            $value4extra_side = $side;
83 83
             $stextbox = 'selected';
84
-            break ;
84
+            break;
85 85
     }
86 86
     }
87 87
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 				<div class='blockposition $scoln'>
143 143
 					<input type='radio' name='sides[$bid]' value='-1' class='blockposition' $sseln onclick='document.getElementById(\"extra_side_$bid\").value=-1;' />
144 144
 				</div>
145
-                <div style='float:"._GLOBAL_LEFT.";'>"._NONE . '</div>
145
+                <div style='float:"._GLOBAL_LEFT.";'>"._NONE.'</div>
146 146
 			</td>
147 147
 		</tr>
148 148
 	</table>
@@ -154,53 +154,53 @@  discard block
 block discarded – undo
154 154
         $bid = (int)$bid;
155 155
 
156 156
 //HACK by domifara
157
-    $block = new XoopsBlock($bid) ;
157
+    $block = new XoopsBlock($bid);
158 158
 
159
-        if (! $block->getVar('bid')) {
159
+        if (!$block->getVar('bid')) {
160 160
             // new defaults
161
-        $bid = 0 ;
162
-            $mode = 'new' ;
163
-            $block->setVar('mid', 0) ;
164
-            $block->setVar('block_type', 'C') ;
161
+        $bid = 0;
162
+            $mode = 'new';
163
+            $block->setVar('mid', 0);
164
+            $block->setVar('block_type', 'C');
165 165
         }
166 166
 
167 167
         switch ($mode) {
168 168
         case 'clone':
169
-            $form_title = _MD_A_MYBLOCKSADMIN_CLONEFORM ;
170
-            $button_value = _MD_A_MYBLOCKSADMIN_BTN_CLONE ;
171
-            $next_op = 'clone_ok' ;
169
+            $form_title = _MD_A_MYBLOCKSADMIN_CLONEFORM;
170
+            $button_value = _MD_A_MYBLOCKSADMIN_BTN_CLONE;
171
+            $next_op = 'clone_ok';
172 172
             // breadcrumbs
173
-            $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ;
174
-            $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_CLONEFORM) ;
175
-            break ;
173
+            $breadcrumbsObj = AltsysBreadcrumbs::getInstance();
174
+            $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_CLONEFORM);
175
+            break;
176 176
         case 'new':
177
-            $form_title = _MD_A_MYBLOCKSADMIN_NEWFORM ;
178
-            $button_value = _MD_A_MYBLOCKSADMIN_BTN_NEW ;
179
-            $next_op = 'new_ok' ;
177
+            $form_title = _MD_A_MYBLOCKSADMIN_NEWFORM;
178
+            $button_value = _MD_A_MYBLOCKSADMIN_BTN_NEW;
179
+            $next_op = 'new_ok';
180 180
             // breadcrumbs
181
-            $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ;
182
-            $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_NEWFORM) ;
183
-            break ;
181
+            $breadcrumbsObj = AltsysBreadcrumbs::getInstance();
182
+            $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_NEWFORM);
183
+            break;
184 184
         case 'edit':
185 185
         default:
186
-            $form_title = _MD_A_MYBLOCKSADMIN_EDITFORM ;
187
-            $button_value = _MD_A_MYBLOCKSADMIN_BTN_EDIT ;
188
-            $next_op = 'edit_ok' ;
186
+            $form_title = _MD_A_MYBLOCKSADMIN_EDITFORM;
187
+            $button_value = _MD_A_MYBLOCKSADMIN_BTN_EDIT;
188
+            $next_op = 'edit_ok';
189 189
             // breadcrumbs
190
-            $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ;
191
-            $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_EDITFORM) ;
192
-            break ;
190
+            $breadcrumbsObj = AltsysBreadcrumbs::getInstance();
191
+            $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_EDITFORM);
192
+            break;
193 193
     }
194 194
 
195
-        $is_custom = in_array($block->getVar('block_type'), array( 'C', 'E' )) ? true : false ;
196
-        $block_template =& $block->getVar('template', 'n') ;
197
-        $block_template_tplset = '' ;
195
+        $is_custom = in_array($block->getVar('block_type'), array('C', 'E')) ? true : false;
196
+        $block_template = & $block->getVar('template', 'n');
197
+        $block_template_tplset = '';
198 198
 
199
-        if (! $is_custom && $block_template) {
199
+        if (!$is_custom && $block_template) {
200 200
             // find template of the block
201 201
         $tplfile_handler = xoops_getHandler('tplfile');
202
-            $found_templates = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', null, null, $block_template) ;
203
-            $block_template_tplset = count($found_templates) > 0 ? $GLOBALS['xoopsConfig']['template_set'] : 'default' ;
202
+            $found_templates = $tplfile_handler->find($GLOBALS['xoopsConfig']['template_set'], 'block', null, null, $block_template);
203
+            $block_template_tplset = count($found_templates) > 0 ? $GLOBALS['xoopsConfig']['template_set'] : 'default';
204 204
         }
205 205
 //HACK by domifara
206 206
 /*
@@ -209,41 +209,41 @@  discard block
 block discarded – undo
209 209
     }
210 210
 */
211 211
     $block_data = $this->preview_request + array(
212
-        'bid' => $bid ,
213
-        'name' => $block->getVar('name', 'n') ,
214
-        'title' => $block->getVar('title', 'n') ,
212
+        'bid' => $bid,
213
+        'name' => $block->getVar('name', 'n'),
214
+        'title' => $block->getVar('title', 'n'),
215 215
             'weight' => (int)$block->getVar('weight'),
216 216
             'bcachetime' => (int)$block->getVar('bcachetime'),
217 217
             'side' => (int)$block->getVar('side'),
218 218
             'visible' => (int)$block->getVar('visible'),
219
-        'template' => $block_template ,
220
-        'template_tplset' => $block_template_tplset ,
221
-        'options' => $block->getVar('options') ,
222
-        'content' => $block->getVar('content', 'n') ,
223
-        'is_custom' => $is_custom ,
224
-        'type' => $block->getVar('block_type') ,
219
+        'template' => $block_template,
220
+        'template_tplset' => $block_template_tplset,
221
+        'options' => $block->getVar('options'),
222
+        'content' => $block->getVar('content', 'n'),
223
+        'is_custom' => $is_custom,
224
+        'type' => $block->getVar('block_type'),
225 225
         'ctype' => $block->getVar('c_type')
226
-    ) ;
226
+    );
227 227
 
228 228
         $block4assign = array(
229
-        'name_raw' => $block_data['name'] ,
230
-        'title_raw' => $block_data['title'] ,
231
-        'content_raw' => $block_data['content'] ,
232
-        'cell_position' => $this->renderCell4BlockPosition($block_data) ,
233
-        'cell_module_link' => $this->renderCell4BlockModuleLink($block_data) ,
234
-        'cell_group_perm' =>  $this->renderCell4BlockReadGroupPerm($block_data) ,
235
-        'cell_options' => $this->renderCell4BlockOptions($block_data) ,
229
+        'name_raw' => $block_data['name'],
230
+        'title_raw' => $block_data['title'],
231
+        'content_raw' => $block_data['content'],
232
+        'cell_position' => $this->renderCell4BlockPosition($block_data),
233
+        'cell_module_link' => $this->renderCell4BlockModuleLink($block_data),
234
+        'cell_group_perm' =>  $this->renderCell4BlockReadGroupPerm($block_data),
235
+        'cell_options' => $this->renderCell4BlockOptions($block_data),
236 236
         'content_preview' => $this->previewContent($block_data)
237
-    ) + $block_data ;
237
+    ) + $block_data;
238 238
 
239 239
     // display
240
-    require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ;
241
-        $tpl = new D3Tpl() ;
240
+    require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php';
241
+        $tpl = new D3Tpl();
242 242
 //dhtml
243 243
     include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
244 244
 
245
-        if ($block_data['ctype']=='H' || empty($block_data['ctype'])) {
246
-            $editor_configs=array();
245
+        if ($block_data['ctype'] == 'H' || empty($block_data['ctype'])) {
246
+            $editor_configs = array();
247 247
             $editor_configs['name']   = 'content_block';
248 248
             $editor_configs['value']  = $block_data['content'];
249 249
             $editor_configs['rows']   = 20;
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
             $editor_configs['editor'] = xoops_getModuleOption('blocks_editor', 'system');
254 254
             $form                     = new XoopsFormEditor('', 'textarea_content', $editor_configs);
255 255
             $rendered = $form->render();
256
-            $tpl->assign('altsys_x25_dhtmltextarea', $rendered) ;
256
+            $tpl->assign('altsys_x25_dhtmltextarea', $rendered);
257 257
         } else {
258 258
             $form = new XoopsFormDhtmlTextArea('', 'textarea_content', $block_data['content'], 80, 20);
259 259
             $rendered = $form->render();
260
-            $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>' ;
261
-            $tpl->assign('altsys_x25_dhtmltextarea', $rendered) ;
260
+            $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>';
261
+            $tpl->assign('altsys_x25_dhtmltextarea', $rendered);
262 262
         }
263 263
 
264 264
         $tpl->assign(array(
@@ -273,91 +273,91 @@  discard block
 block discarded – undo
273 273
         'submit_button' => $button_value,
274 274
         'common_fck_installed' => file_exists(XOOPS_ROOT_PATH.'/common/fckeditor/fckeditor.js'),
275 275
         'gticket_hidden' => $GLOBALS['xoopsGTicket']->getTicketHtml(__LINE__, 1800, 'myblocksadmin')
276
-    )) ;
276
+    ));
277 277
 //HACK by domifara
278
-    $tpl->display('db:altsys_main_myblocksadmin_edit_4x25.html') ;
278
+    $tpl->display('db:altsys_main_myblocksadmin_edit_4x25.html');
279 279
 
280
-        return ;
280
+        return;
281 281
     }
282 282
     public function fetchRequest4Block($bid)
283 283
     {
284 284
         $bid = (int)$bid;
285
-        (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance() ;
285
+        (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance();
286 286
 
287 287
         if (@$_POST['extra_sides'][$bid] > 0) {
288 288
             $_POST['sides'][$bid] = (int)$_POST['extra_sides'][$bid];
289 289
         }
290 290
 
291 291
         if (@$_POST['sides'][$bid] < 0) {
292
-            $visible = 0 ;
293
-            $_POST['sides'][$bid] = -1 ;
292
+            $visible = 0;
293
+            $_POST['sides'][$bid] = -1;
294 294
         } else {
295
-            $visible = 1 ;
295
+            $visible = 1;
296 296
         }
297 297
 
298 298
         return array(
299
-        'bid' => $bid ,
299
+        'bid' => $bid,
300 300
             'side' => (int)(@$_POST['sides'][$bid]),
301 301
             'weight' => (int)(@$_POST['weights'][$bid]),
302
-        'visible' => $visible ,
303
-        'title' => $myts->stripSlashesGPC(@$_POST['titles'][$bid]) ,
304
-        'content' => $myts->stripSlashesGPC(@$_POST['textarea_content']) ,
305
-        'ctype' => preg_replace('/[^A-Z]/', '', @$_POST['ctypes'][$bid]) ,
302
+        'visible' => $visible,
303
+        'title' => $myts->stripSlashesGPC(@$_POST['titles'][$bid]),
304
+        'content' => $myts->stripSlashesGPC(@$_POST['textarea_content']),
305
+        'ctype' => preg_replace('/[^A-Z]/', '', @$_POST['ctypes'][$bid]),
306 306
             'bcachetime' => (int)(@$_POST['bcachetimes'][$bid]),
307
-        'bmodule' => is_array(@$_POST['bmodules'][$bid]) ? $_POST['bmodules'][$bid] : array( 0 ) ,
308
-        'bgroup' => is_array(@$_POST['bgroups'][$bid]) ? $_POST['bgroups'][$bid] : array() ,
307
+        'bmodule' => is_array(@$_POST['bmodules'][$bid]) ? $_POST['bmodules'][$bid] : array(0),
308
+        'bgroup' => is_array(@$_POST['bgroups'][$bid]) ? $_POST['bgroups'][$bid] : array(),
309 309
         'options' => is_array(@$_POST['options'][$bid]) ? $_POST['options'][$bid] : array()
310
-    ) ;
310
+    );
311 311
     }
312 312
 
313 313
     public function previewContent($block_data)
314 314
     {
315 315
         $bid = (int)$block_data['bid'];
316 316
 
317
-        if (! $block_data['is_custom']) {
318
-            return '' ;
317
+        if (!$block_data['is_custom']) {
318
+            return '';
319 319
         }
320 320
         if (empty($this->preview_request)) {
321
-            return '' ;
321
+            return '';
322 322
         }
323 323
 
324 324
 //HACK by domifara
325 325
 //TODO : need no hook block at this
326
-    $block = new XoopsBlock($bid) ;
326
+    $block = new XoopsBlock($bid);
327 327
 
328 328
         if ($block->getVar('mid')) {
329
-            return '' ;
329
+            return '';
330 330
         }
331 331
 
332
-        $block->setVar('title', $block_data['title']) ;
333
-        $block->setVar('content', $block_data['content']) ;
332
+        $block->setVar('title', $block_data['title']);
333
+        $block->setVar('content', $block_data['content']);
334 334
 
335
-        restore_error_handler() ;
336
-        $original_level = error_reporting(E_ALL) ;
335
+        restore_error_handler();
336
+        $original_level = error_reporting(E_ALL);
337 337
 
338 338
 //	$ret = $block->getContent( 'S' , $block_data['ctype'] ) ;
339 339
 
340 340
     $c_type = $block_data['ctype'];
341 341
         if ($c_type == 'H') {
342
-            $ret = str_replace('{X_SITEURL}', XOOPS_URL . '/', $block->getVar('content', 'N'));
342
+            $ret = str_replace('{X_SITEURL}', XOOPS_URL.'/', $block->getVar('content', 'N'));
343 343
         } elseif ($c_type == 'P') {
344 344
             ob_start();
345 345
             echo eval($block->getVar('content', 'N'));
346 346
             $content = ob_get_contents();
347 347
             ob_end_clean();
348
-            $ret = str_replace('{X_SITEURL}', XOOPS_URL . '/', $content);
348
+            $ret = str_replace('{X_SITEURL}', XOOPS_URL.'/', $content);
349 349
         } elseif ($c_type == 'S') {
350 350
             (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance();
351
-            $content = str_replace('{X_SITEURL}', XOOPS_URL . '/', $block->getVar('content', 'N'));
351
+            $content = str_replace('{X_SITEURL}', XOOPS_URL.'/', $block->getVar('content', 'N'));
352 352
             $ret = $myts->displayTarea($content, 1, 1);
353 353
         } else {
354 354
             (method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance();
355
-            $content = str_replace('{X_SITEURL}', XOOPS_URL . '/', $block->getVar('content', 'N'));
355
+            $content = str_replace('{X_SITEURL}', XOOPS_URL.'/', $block->getVar('content', 'N'));
356 356
             $ret = $myts->displayTarea($content, 1, 0);
357 357
         }
358 358
 
359
-        error_reporting($original_level) ;
359
+        error_reporting($original_level);
360 360
 
361
-        return $ret ;
361
+        return $ret;
362 362
     }
363 363
 }
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/mytplsform.php 1 patch
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -5,36 +5,36 @@  discard block
 block discarded – undo
5 5
 //                       GIJOE <http://www.peak.ne.jp/>                      //
6 6
 // ------------------------------------------------------------------------- //
7 7
 
8
-require_once __DIR__.'/class/AltsysBreadcrumbs.class.php' ;
9
-include_once __DIR__ . '/include/gtickets.php';
10
-include_once __DIR__.'/include/altsys_functions.php' ;
11
-include_once __DIR__ . '/include/tpls_functions.php';
12
-include_once __DIR__.'/include/Text_Diff.php' ;
13
-include_once __DIR__.'/include/Text_Diff_Renderer.php' ;
14
-include_once __DIR__.'/include/Text_Diff_Renderer_unified.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/tpls_functions.php';
12
+include_once __DIR__.'/include/Text_Diff.php';
13
+include_once __DIR__.'/include/Text_Diff_Renderer.php';
14
+include_once __DIR__.'/include/Text_Diff_Renderer_unified.php';
15 15
 
16 16
 
17 17
 // only groups have 'module_admin' of 'altsys' can do that.
18
-$module_handler = xoops_getHandler('module') ;
19
-$module = $module_handler->getByDirname('altsys') ;
20
-$moduleperm_handler = xoops_getHandler('groupperm') ;
21
-if (! is_object(@$xoopsUser) || ! $moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $xoopsUser->getGroups())) {
22
-    die('only admin of altsys can access this area') ;
18
+$module_handler = xoops_getHandler('module');
19
+$module = $module_handler->getByDirname('altsys');
20
+$moduleperm_handler = xoops_getHandler('groupperm');
21
+if (!is_object(@$xoopsUser) || !$moduleperm_handler->checkRight('module_admin', $module->getVar('mid'), $xoopsUser->getGroups())) {
22
+    die('only admin of altsys can access this area');
23 23
 }
24 24
 
25 25
 //$xoops_system_path = XOOPS_ROOT_PATH . '/modules/system' ;
26 26
 
27 27
 // initials
28 28
 $db = XoopsDatabaseFactory::getDatabaseConnection();
29
-(method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance() ;
29
+(method_exists('MyTextSanitizer', 'sGetInstance') and $myts = MyTextSanitizer::sGetInstance()) || $myts = MyTextSanitizer::getInstance();
30 30
 
31 31
 // language file
32
-altsys_include_language_file('mytplsform') ;
33
-altsys_include_language_file('mytplsadmin') ;
32
+altsys_include_language_file('mytplsform');
33
+altsys_include_language_file('mytplsadmin');
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
 // check access right (needs system_admin of tplset)
@@ -42,128 +42,128 @@  discard block
 block discarded – undo
42 42
 //if (!$sysperm_handler->checkRight('system_admin', XOOPS_SYSTEM_TPLSET, $xoopsUser->getGroups())) redirect_header( XOOPS_URL.'/user.php' , 1 , _NOPERM ) ;
43 43
 
44 44
 // tpl_file from $_GET
45
-$tpl_tplset = $myts->stripSlashesGPC(@$_GET['tpl_tplset']) ;
46
-if (! $tpl_tplset) {
47
-    $tpl_tplset = $xoopsConfig['template_set'] ;
45
+$tpl_tplset = $myts->stripSlashesGPC(@$_GET['tpl_tplset']);
46
+if (!$tpl_tplset) {
47
+    $tpl_tplset = $xoopsConfig['template_set'];
48 48
 }
49
-$tpl_tplset4sql = addslashes($tpl_tplset) ;
49
+$tpl_tplset4sql = addslashes($tpl_tplset);
50 50
 
51 51
 if (empty($_GET['tpl_file']) || $_GET['tpl_file'] == '_custom') {
52
-    $edit_mode = 'create' ;
53
-    $tpl_file = '_custom' ;
52
+    $edit_mode = 'create';
53
+    $tpl_file = '_custom';
54 54
     $tpl = array(
55
-        'tpl_id' => 0 ,
56
-        'tpl_refid' => 0 ,
57
-        'tpl_module' => '_custom' ,
58
-        'tpl_tplset' => $tpl_tplset ,
59
-        'tpl_file' => '_custom_'.substr(date('YmdHis'), 2, -2).'.html' ,
60
-        'tpl_desc' => '' ,
61
-        'tpl_lastmodified' => 0 ,
62
-        'tpl_lastimported' => 0 ,
63
-        'tpl_type' => 'custom' ,
55
+        'tpl_id' => 0,
56
+        'tpl_refid' => 0,
57
+        'tpl_module' => '_custom',
58
+        'tpl_tplset' => $tpl_tplset,
59
+        'tpl_file' => '_custom_'.substr(date('YmdHis'), 2, -2).'.html',
60
+        'tpl_desc' => '',
61
+        'tpl_lastmodified' => 0,
62
+        'tpl_lastimported' => 0,
63
+        'tpl_type' => 'custom',
64 64
         'tpl_source' => ''
65
-    ) ;
65
+    );
66 66
 
67 67
     // breadcrumbs
68
-    $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ;
69
-    $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin', '_MI_ALTSYS_MENU_MYTPLSADMIN') ;
70
-    $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin&amp;dirname=_custom', _MYTPLSADMIN_CUSTOMTEMPLATE) ;
71
-    $breadcrumbsObj->appendPath('', '_MYTPLSADMIN_CREATENEWCUSTOMTEMPLATE') ;
68
+    $breadcrumbsObj = AltsysBreadcrumbs::getInstance();
69
+    $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin', '_MI_ALTSYS_MENU_MYTPLSADMIN');
70
+    $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin&amp;dirname=_custom', _MYTPLSADMIN_CUSTOMTEMPLATE);
71
+    $breadcrumbsObj->appendPath('', '_MYTPLSADMIN_CREATENEWCUSTOMTEMPLATE');
72 72
     $target_mname = _MYTPLSADMIN_CUSTOMTEMPLATE;
73 73
 } else {
74 74
     // tpl_file from $_GET
75
-    $edit_mode = 'modify' ;
76
-    $tpl_file = $myts->stripSlashesGPC(@$_GET['tpl_file']) ;
77
-    $tpl_file = str_replace('db:', '', $tpl_file) ;
78
-    $tpl_file4sql = addslashes($tpl_file) ;
75
+    $edit_mode = 'modify';
76
+    $tpl_file = $myts->stripSlashesGPC(@$_GET['tpl_file']);
77
+    $tpl_file = str_replace('db:', '', $tpl_file);
78
+    $tpl_file4sql = addslashes($tpl_file);
79 79
 
80 80
     // get information from tplfile table
81
-    $sql = 'SELECT * FROM ' . $db->prefix('tplfile') . ' f NATURAL LEFT JOIN ' . $db->prefix('tplsource') . " s WHERE f.tpl_file='$tpl_file4sql' ORDER BY f.tpl_tplset='$tpl_tplset4sql' DESC,f.tpl_tplset='default' DESC" ;
82
-    $tpl = $db->fetchArray($db->query($sql)) ;
81
+    $sql = 'SELECT * FROM '.$db->prefix('tplfile').' f NATURAL LEFT JOIN '.$db->prefix('tplsource')." s WHERE f.tpl_file='$tpl_file4sql' ORDER BY f.tpl_tplset='$tpl_tplset4sql' DESC,f.tpl_tplset='default' DESC";
82
+    $tpl = $db->fetchArray($db->query($sql));
83 83
 
84 84
     // get module info
85 85
     if ($tpl['tpl_module'] == '_custom') {
86
-        $target_module = null ;
87
-        $target_mname = _MYTPLSADMIN_CUSTOMTEMPLATE ;
86
+        $target_module = null;
87
+        $target_mname = _MYTPLSADMIN_CUSTOMTEMPLATE;
88 88
     } else {
89
-        $module_handler = xoops_getHandler('module') ;
90
-        $target_module = $module_handler->getByDirname($tpl['tpl_module']) ;
91
-        $target_mname = is_object($target_module) ? $target_module->getVar('name') : '' ;
89
+        $module_handler = xoops_getHandler('module');
90
+        $target_module = $module_handler->getByDirname($tpl['tpl_module']);
91
+        $target_mname = is_object($target_module) ? $target_module->getVar('name') : '';
92 92
     }
93 93
 
94 94
     // breadcrumbs
95
-    $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ;
95
+    $breadcrumbsObj = AltsysBreadcrumbs::getInstance();
96 96
     if ($mydirname != 'altsys' && is_object($target_module)) {
97 97
         // mytplsform in each modules
98
-        $mod_url = XOOPS_URL.'/modules/'.$target_module->getVar('dirname') ;
99
-        $modinfo = $target_module->getInfo() ;
100
-        $breadcrumbsObj->appendPath($mod_url.'/'.@$modinfo['adminindex'], $target_mname) ;
101
-        $breadcrumbsObj->appendPath($mod_url.'/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin', _MD_A_MYTPLSFORM_TPLSADMIN) ;
98
+        $mod_url = XOOPS_URL.'/modules/'.$target_module->getVar('dirname');
99
+        $modinfo = $target_module->getInfo();
100
+        $breadcrumbsObj->appendPath($mod_url.'/'.@$modinfo['adminindex'], $target_mname);
101
+        $breadcrumbsObj->appendPath($mod_url.'/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin', _MD_A_MYTPLSFORM_TPLSADMIN);
102 102
     } else {
103 103
         // mytplsform in altsys
104
-        $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin', '_MI_ALTSYS_MENU_MYTPLSADMIN') ;
105
-        $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin&amp;dirname='.htmlspecialchars($tpl['tpl_module']), $target_mname) ;
104
+        $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin', '_MI_ALTSYS_MENU_MYTPLSADMIN');
105
+        $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsadmin&amp;dirname='.htmlspecialchars($tpl['tpl_module']), $target_mname);
106 106
     }
107
-    $breadcrumbsObj->appendPath('', _MD_A_MYTPLSFORM_EDIT) ;
107
+    $breadcrumbsObj->appendPath('', _MD_A_MYTPLSFORM_EDIT);
108 108
 }
109 109
 
110 110
 // error in specifying tpl_file
111 111
 if (empty($tpl)) {
112 112
     if (strncmp($tpl_file, 'file:', 5) === 0) {
113
-        die('Not DB template') ;
113
+        die('Not DB template');
114 114
     } else {
115
-        die('Invalid tpl_file.') ;
115
+        die('Invalid tpl_file.');
116 116
     }
117 117
 }
118 118
 
119 119
 //****************//
120 120
 // TRANSACT stage //
121 121
 //****************//
122
-if (! empty($_POST['do_modifycont']) || ! empty($_POST['do_modify'])) {
122
+if (!empty($_POST['do_modifycont']) || !empty($_POST['do_modify'])) {
123 123
     // Ticket Check
124
-    if (! $xoopsGTicket->check(true, 'altsys_tplsform')) {
124
+    if (!$xoopsGTicket->check(true, 'altsys_tplsform')) {
125 125
         redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors());
126 126
     }
127 127
 
128
-    $result = $db->query('SELECT tpl_id FROM ' . $db->prefix('tplfile') . " WHERE tpl_file='$tpl_file4sql' AND tpl_tplset='" . addslashes($tpl['tpl_tplset']) . "'") ;
128
+    $result = $db->query('SELECT tpl_id FROM '.$db->prefix('tplfile')." WHERE tpl_file='$tpl_file4sql' AND tpl_tplset='".addslashes($tpl['tpl_tplset'])."'");
129 129
     while (list($tpl_id) = $db->fetchRow($result)) {
130
-        $sql = 'UPDATE ' . $db->prefix('tplsource') . " SET tpl_source='" . addslashes($myts->stripSlashesGPC($_POST['tpl_source'])) . "' WHERE tpl_id=$tpl_id" ;
131
-        if (! $db->query($sql)) {
132
-            die('SQL Error') ;
130
+        $sql = 'UPDATE '.$db->prefix('tplsource')." SET tpl_source='".addslashes($myts->stripSlashesGPC($_POST['tpl_source']))."' WHERE tpl_id=$tpl_id";
131
+        if (!$db->query($sql)) {
132
+            die('SQL Error');
133 133
         }
134
-        $db->query('UPDATE ' . $db->prefix('tplfile') . " SET tpl_lastmodified=UNIX_TIMESTAMP() WHERE tpl_id=$tpl_id") ;
135
-        altsys_template_touch($tpl_id) ;
134
+        $db->query('UPDATE '.$db->prefix('tplfile')." SET tpl_lastmodified=UNIX_TIMESTAMP() WHERE tpl_id=$tpl_id");
135
+        altsys_template_touch($tpl_id);
136 136
     }
137 137
 
138 138
     // continue or end ?
139
-    if (! empty($_POST['do_modifycont'])) {
140
-        redirect_header('index.php?mode=admin&lib=altsys&page=mytplsform&tpl_file='.$tpl_file.'&tpl_tplset='.$tpl_tplset.'&dirname='.$tpl['tpl_module'].'#altsys_tplsform_top', 1, _MD_A_MYTPLSFORM_UPDATED) ;
139
+    if (!empty($_POST['do_modifycont'])) {
140
+        redirect_header('index.php?mode=admin&lib=altsys&page=mytplsform&tpl_file='.$tpl_file.'&tpl_tplset='.$tpl_tplset.'&dirname='.$tpl['tpl_module'].'#altsys_tplsform_top', 1, _MD_A_MYTPLSFORM_UPDATED);
141 141
     } else {
142
-        redirect_header('index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$tpl['tpl_module'], 1, _MD_A_MYTPLSFORM_UPDATED) ;
142
+        redirect_header('index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$tpl['tpl_module'], 1, _MD_A_MYTPLSFORM_UPDATED);
143 143
     }
144
-    exit ;
144
+    exit;
145 145
 }
146 146
 
147
-if (! empty($_POST['do_create'])) {
147
+if (!empty($_POST['do_create'])) {
148 148
     // Ticket Check
149
-    if (! $xoopsGTicket->check(true, 'altsys_tplsform')) {
149
+    if (!$xoopsGTicket->check(true, 'altsys_tplsform')) {
150 150
         redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors());
151 151
     }
152 152
 
153
-    $sql = 'INSERT INTO ' . $db->prefix('tplfile') . " SET tpl_file='" . addslashes($myts->stripSlashesGPC($_POST['tpl_file'])) . "',tpl_refid=0,tpl_module='" . addslashes($tpl['tpl_module']) . "',tpl_tplset='" . addslashes($tpl['tpl_tplset']) . "',tpl_lastmodified=UNIX_TIMESTAMP(),tpl_type='" . addslashes($tpl['tpl_type']) . "'" ;
154
-    if (! $db->query($sql)) {
155
-        die('SQL Error'.__LINE__) ;
153
+    $sql = 'INSERT INTO '.$db->prefix('tplfile')." SET tpl_file='".addslashes($myts->stripSlashesGPC($_POST['tpl_file']))."',tpl_refid=0,tpl_module='".addslashes($tpl['tpl_module'])."',tpl_tplset='".addslashes($tpl['tpl_tplset'])."',tpl_lastmodified=UNIX_TIMESTAMP(),tpl_type='".addslashes($tpl['tpl_type'])."'";
154
+    if (!$db->query($sql)) {
155
+        die('SQL Error'.__LINE__);
156 156
     }
157 157
     $tpl_id = (int)$db->getInsertId();
158
-    $sql = 'INSERT INTO ' . $db->prefix('tplsource') . " SET tpl_id=$tpl_id,tpl_source='" . addslashes($myts->stripSlashesGPC($_POST['tpl_source'])) . "'" ;
159
-    if (! $db->query($sql)) {
160
-        die('SQL Error'.__LINE__) ;
158
+    $sql = 'INSERT INTO '.$db->prefix('tplsource')." SET tpl_id=$tpl_id,tpl_source='".addslashes($myts->stripSlashesGPC($_POST['tpl_source']))."'";
159
+    if (!$db->query($sql)) {
160
+        die('SQL Error'.__LINE__);
161 161
     }
162
-    altsys_template_touch($tpl_id) ;
162
+    altsys_template_touch($tpl_id);
163 163
 
164 164
     // continue or end ?
165
-    redirect_header('index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$tpl['tpl_module'], 1, _MD_A_MYTPLSFORM_CREATED) ;
166
-    exit ;
165
+    redirect_header('index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$tpl['tpl_module'], 1, _MD_A_MYTPLSFORM_CREATED);
166
+    exit;
167 167
 }
168 168
 
169 169
 
@@ -171,56 +171,56 @@  discard block
 block discarded – undo
171 171
 //****************//
172 172
 //   FORM stage   //
173 173
 //****************//
174
-xoops_cp_header() ;
175
-$mymenu_fake_uri = 'index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$mydirname ;
174
+xoops_cp_header();
175
+$mymenu_fake_uri = 'index.php?mode=admin&lib=altsys&page=mytplsadmin&dirname='.$mydirname;
176 176
 
177 177
 // mymenu
178
-altsys_include_mymenu() ;
178
+altsys_include_mymenu();
179 179
 
180
-echo "<h3 style='text-align:"._GLOBAL_LEFT.";'>"._MD_A_MYTPLSFORM_EDIT . ' : ' . htmlspecialchars($tpl['tpl_type'], ENT_QUOTES) . ' : ' . htmlspecialchars($tpl['tpl_file'], ENT_QUOTES) . ' ('
181
-     . htmlspecialchars($tpl['tpl_tplset'], ENT_QUOTES) . ")</h3>\n" ;
180
+echo "<h3 style='text-align:"._GLOBAL_LEFT.";'>"._MD_A_MYTPLSFORM_EDIT.' : '.htmlspecialchars($tpl['tpl_type'], ENT_QUOTES).' : '.htmlspecialchars($tpl['tpl_file'], ENT_QUOTES).' ('
181
+     . htmlspecialchars($tpl['tpl_tplset'], ENT_QUOTES).")</h3>\n";
182 182
 
183 183
 
184 184
 // diff from file to selected DB template
185
-$basefilepath = tplsadmin_get_basefilepath($tpl['tpl_module'], $tpl['tpl_type'], $tpl['tpl_file']) ;
186
-$diff_from_file4disp = '' ;
185
+$basefilepath = tplsadmin_get_basefilepath($tpl['tpl_module'], $tpl['tpl_type'], $tpl['tpl_file']);
186
+$diff_from_file4disp = '';
187 187
 if (file_exists($basefilepath)) {
188
-    $original_error_level = error_reporting() ;
189
-    error_reporting($original_error_level & ~ E_NOTICE & ~ E_WARNING) ;
190
-    $diff = new Text_Diff(file($basefilepath), explode("\n", $tpl['tpl_source'])) ;
188
+    $original_error_level = error_reporting();
189
+    error_reporting($original_error_level & ~ E_NOTICE & ~ E_WARNING);
190
+    $diff = new Text_Diff(file($basefilepath), explode("\n", $tpl['tpl_source']));
191 191
     $renderer = new Text_Diff_Renderer_unified();
192
-    $diff_str = htmlspecialchars($renderer->render($diff), ENT_QUOTES) ;
192
+    $diff_str = htmlspecialchars($renderer->render($diff), ENT_QUOTES);
193 193
     foreach (explode("\n", $diff_str) as $line) {
194 194
         if (ord($line) == 0x2d) {
195
-            $diff_from_file4disp .= "<span style='color:red;'>".$line."</span>\n" ;
195
+            $diff_from_file4disp .= "<span style='color:red;'>".$line."</span>\n";
196 196
         } elseif (ord($line) == 0x2b) {
197
-            $diff_from_file4disp .= "<span style='color:blue;'>".$line."</span>\n" ;
197
+            $diff_from_file4disp .= "<span style='color:blue;'>".$line."</span>\n";
198 198
         } else {
199
-            $diff_from_file4disp .= $line."\n" ;
199
+            $diff_from_file4disp .= $line."\n";
200 200
         }
201 201
     }
202
-    error_reporting($original_error_level) ;
202
+    error_reporting($original_error_level);
203 203
 }
204 204
 
205 205
 // diff from DB-default to selected DB template
206
-$diff_from_default4disp = '' ;
206
+$diff_from_default4disp = '';
207 207
 if ($tpl['tpl_tplset'] != 'default') {
208
-    $original_error_level = error_reporting() ;
209
-    error_reporting($original_error_level & ~ E_NOTICE & ~ E_WARNING) ;
210
-    list($default_source) = $db->fetchRow($db->query('SELECT tpl_source FROM ' . $db->prefix('tplfile') . ' NATURAL LEFT JOIN ' . $db->prefix('tplsource') . " WHERE tpl_tplset='default' AND tpl_file='" . addslashes($tpl['tpl_file']) . "' AND tpl_module='" . addslashes($tpl['tpl_module']) . "'")) ;
211
-    $diff = new Text_Diff(explode("\n", $default_source), explode("\n", $tpl['tpl_source'])) ;
208
+    $original_error_level = error_reporting();
209
+    error_reporting($original_error_level & ~ E_NOTICE & ~ E_WARNING);
210
+    list($default_source) = $db->fetchRow($db->query('SELECT tpl_source FROM '.$db->prefix('tplfile').' NATURAL LEFT JOIN '.$db->prefix('tplsource')." WHERE tpl_tplset='default' AND tpl_file='".addslashes($tpl['tpl_file'])."' AND tpl_module='".addslashes($tpl['tpl_module'])."'"));
211
+    $diff = new Text_Diff(explode("\n", $default_source), explode("\n", $tpl['tpl_source']));
212 212
     $renderer = new Text_Diff_Renderer_unified();
213
-    $diff_str = htmlspecialchars($renderer->render($diff), ENT_QUOTES) ;
213
+    $diff_str = htmlspecialchars($renderer->render($diff), ENT_QUOTES);
214 214
     foreach (explode("\n", $diff_str) as $line) {
215 215
         if (ord($line) == 0x2d) {
216
-            $diff_from_default4disp .= "<span style='color:red;'>".$line."</span>\n" ;
216
+            $diff_from_default4disp .= "<span style='color:red;'>".$line."</span>\n";
217 217
         } elseif (ord($line) == 0x2b) {
218
-            $diff_from_default4disp .= "<span style='color:blue;'>".$line."</span>\n" ;
218
+            $diff_from_default4disp .= "<span style='color:blue;'>".$line."</span>\n";
219 219
         } else {
220
-            $diff_from_default4disp .= $line."\n" ;
220
+            $diff_from_default4disp .= $line."\n";
221 221
         }
222 222
     }
223
-    error_reporting($original_error_level) ;
223
+    error_reporting($original_error_level);
224 224
 }
225 225
 
226 226
 
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
 	<form name='diff_form' id='diff_form' action='' method='get'>\n" ;
229 229
 if ($diff_from_file4disp) {
230 230
     echo "<input type='checkbox' name='display_diff2file' value='1' onClick=\"if(this.checked){document.getElementById('diff2file').style.display='block'}else{document.getElementById('diff2file').style.display='none'};\" id='display_diff2file' checked='checked' />&nbsp;<label for='display_diff2file'>diff from file</label>
231
-	<pre id='diff2file' style='display:block;border:1px solid black;'>$diff_from_file4disp</pre>\n" ;
231
+	<pre id='diff2file' style='display:block;border:1px solid black;'>$diff_from_file4disp</pre>\n";
232 232
 }
233 233
 if ($diff_from_default4disp) {
234 234
     echo "<input type='checkbox' name='display_diff2default' value='1' onClick=\"if(this.checked){document.getElementById('diff2default').style.display='block'}else{document.getElementById('diff2default').style.display='none'};\" id='display_diff2default' />&nbsp;<label for='display_diff2default'>diff from default</label>
235
-	<pre id='diff2default' style='display:none;border:1px solid black;'>$diff_from_default4disp</pre>\n" ;
235
+	<pre id='diff2default' style='display:none;border:1px solid black;'>$diff_from_default4disp</pre>\n";
236 236
 }
237 237
 echo "
238 238
 	</form>\n" ;
@@ -240,10 +240,10 @@  discard block
 block discarded – undo
240 240
 
241 241
 echo "
242 242
 <a name='altsys_tplsform_top' id='altsys_tplsform_top'></a>
243
-<form name='MainForm' id='altsys_tplsform' action='?mode=admin&amp;lib=altsys&amp;page=mytplsform&amp;tpl_file=".htmlspecialchars($tpl_file, ENT_QUOTES) . '&amp;tpl_tplset='
244
-     . htmlspecialchars($tpl['tpl_tplset'], ENT_QUOTES) . '&amp;dirname=' . $target_mname . "' method='post'>
243
+<form name='MainForm' id='altsys_tplsform' action='?mode=admin&amp;lib=altsys&amp;page=mytplsform&amp;tpl_file=".htmlspecialchars($tpl_file, ENT_QUOTES).'&amp;tpl_tplset='
244
+     . htmlspecialchars($tpl['tpl_tplset'], ENT_QUOTES).'&amp;dirname='.$target_mname."' method='post'>
245 245
 	".$xoopsGTicket->getTicketHtml(__LINE__, 1800, 'altsys_tplsform')."
246
-    <textarea name='tpl_source' id='altsys_tpl_source' wrap='off' style='width:600px;height:400px;'>".htmlspecialchars($tpl['tpl_source'], ENT_QUOTES) . '</textarea>
246
+    <textarea name='tpl_source' id='altsys_tpl_source' wrap='off' style='width:600px;height:400px;'>".htmlspecialchars($tpl['tpl_source'], ENT_QUOTES).'</textarea>
247 247
 	<br />
248 248
 ';
249 249
 if ($edit_mode == 'create') {
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
     echo "
252 252
 	<label for='tpl_file'>"._MD_A_MYTPLSFORM_LABEL_TPLFILE."</label>
253 253
 	<input type='text' name='tpl_file' id='tpl_file' value='".htmlspecialchars($tpl['tpl_file'], ENT_QUOTES)."' size='64' /><br />
254
-	<input type='submit' name='do_create' id='do_create' value='"._MD_A_MYTPLSFORM_BTN_CREATE."' />\n" ;
254
+	<input type='submit' name='do_create' id='do_create' value='"._MD_A_MYTPLSFORM_BTN_CREATE."' />\n";
255 255
 } else {
256 256
     // modify form
257 257
     echo "
@@ -261,4 +261,4 @@  discard block
 block discarded – undo
261 261
 </form>\n" ;
262 262
 }
263 263
 
264
-xoops_cp_footer() ;
264
+xoops_cp_footer();
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/onuninstall.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,35 +1,35 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-eval(' function xoops_module_uninstall_'.$mydirname.'( $module ) { return altsys_onuninstall_base( $module , "'.$mydirname.'" ) ; } ') ;
3
+eval(' function xoops_module_uninstall_'.$mydirname.'( $module ) { return altsys_onuninstall_base( $module , "'.$mydirname.'" ) ; } ');
4 4
 
5 5
 
6
-if (! function_exists('altsys_onuninstall_base')) {
6
+if (!function_exists('altsys_onuninstall_base')) {
7 7
     function altsys_onuninstall_base($module, $mydirname)
8 8
     {
9 9
         // transations on module uninstall
10 10
 
11
-    global $ret ; // TODO :-D
11
+    global $ret; // TODO :-D
12 12
 
13 13
     // for Cube 2.1
14 14
     if (defined('XOOPS_CUBE_LEGACY')) {
15 15
         $root = XCube_Root::getSingleton();
16
-        $root->mDelegateManager->add('Legacy.Admin.Event.ModuleUninstall.' . ucfirst($mydirname) . '.Success', 'altsys_message_append_onuninstall') ;
17
-        $ret = array() ;
16
+        $root->mDelegateManager->add('Legacy.Admin.Event.ModuleUninstall.'.ucfirst($mydirname).'.Success', 'altsys_message_append_onuninstall');
17
+        $ret = array();
18 18
     } else {
19
-        if (! is_array($ret)) {
20
-            $ret = array() ;
19
+        if (!is_array($ret)) {
20
+            $ret = array();
21 21
         }
22 22
     }
23 23
 
24
-        $db = XoopsDatabaseFactory::getDatabaseConnection() ;
25
-        $mid = $module->getVar('mid') ;
24
+        $db = XoopsDatabaseFactory::getDatabaseConnection();
25
+        $mid = $module->getVar('mid');
26 26
 
27 27
     // TABLES (loading mysql.sql)
28
-    $sql_file_path = __DIR__.'/sql/mysql.sql' ;
29
-        $prefix_mod = $db->prefix() . '_' . $mydirname ;
28
+    $sql_file_path = __DIR__.'/sql/mysql.sql';
29
+        $prefix_mod = $db->prefix().'_'.$mydirname;
30 30
         if (file_exists($sql_file_path)) {
31
-            $ret[] = 'SQL file found at <b>' . htmlspecialchars($sql_file_path) . '</b>.<br  /> Deleting tables...<br />';
32
-            $sql_lines = file($sql_file_path) ;
31
+            $ret[] = 'SQL file found at <b>'.htmlspecialchars($sql_file_path).'</b>.<br  /> Deleting tables...<br />';
32
+            $sql_lines = file($sql_file_path);
33 33
             foreach ($sql_lines as $sql_line) {
34 34
                 if (preg_match('/^CREATE TABLE \`?([a-zA-Z0-9_-]+)\`? /i', $sql_line, $regs)) {
35 35
                     $sql = 'DROP TABLE '.addslashes($prefix_mod.'_'.$regs[1]);
@@ -59,14 +59,14 @@  discard block
 block discarded – undo
59 59
     unset($templates); */
60 60
 
61 61
 
62
-    return true ;
62
+    return true;
63 63
     }
64 64
 
65 65
     function altsys_message_append_onuninstall(&$module_obj, &$log)
66 66
     {
67 67
         if (is_array(@$GLOBALS['ret'])) {
68 68
             foreach ($GLOBALS['ret'] as $message) {
69
-                $log->add(strip_tags($message)) ;
69
+                $log->add(strip_tags($message));
70 70
             }
71 71
         }
72 72
 
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/oninstall.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -1,63 +1,63 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-eval(' function xoops_module_install_'.$mydirname.'( $module ) { return altsys_oninstall_base( $module , "'.$mydirname.'" ) ; } ') ;
3
+eval(' function xoops_module_install_'.$mydirname.'( $module ) { return altsys_oninstall_base( $module , "'.$mydirname.'" ) ; } ');
4 4
 
5 5
 
6
-if (! function_exists('altsys_oninstall_base')) {
6
+if (!function_exists('altsys_oninstall_base')) {
7 7
     function altsys_oninstall_base($module, $mydirname)
8 8
     {
9 9
         // transations on module install
10 10
 
11
-    global $ret ; // TODO :-D
11
+    global $ret; // TODO :-D
12 12
 
13 13
     // for Cube 2.1
14 14
     if (defined('XOOPS_CUBE_LEGACY')) {
15 15
         $root = XCube_Root::getSingleton();
16
-        $root->mDelegateManager->add('Legacy.Admin.Event.ModuleInstall.' . ucfirst($mydirname) . '.Success', 'altsys_message_append_oninstall') ;
17
-        $ret = array() ;
16
+        $root->mDelegateManager->add('Legacy.Admin.Event.ModuleInstall.'.ucfirst($mydirname).'.Success', 'altsys_message_append_oninstall');
17
+        $ret = array();
18 18
     } else {
19
-        if (! is_array($ret)) {
20
-            $ret = array() ;
19
+        if (!is_array($ret)) {
20
+            $ret = array();
21 21
         }
22 22
     }
23 23
 
24
-        $db = XoopsDatabaseFactory::getDatabaseConnection() ;
25
-        $mid = $module->getVar('mid') ;
24
+        $db = XoopsDatabaseFactory::getDatabaseConnection();
25
+        $mid = $module->getVar('mid');
26 26
 
27 27
     /*************** BEGIN ALTSYS SPECIFIC PART ******************/
28 28
     // set weight=0
29
-    $db->queryF('UPDATE ' . $db->prefix('modules') . " SET weight=0 WHERE mid=$mid") ;
29
+    $db->queryF('UPDATE '.$db->prefix('modules')." SET weight=0 WHERE mid=$mid");
30 30
     /*************** END ALTSYS SPECIFIC PART ******************/
31 31
 
32 32
     // TABLES (loading mysql.sql)
33
-    $sql_file_path = __DIR__.'/sql/mysql.sql' ;
34
-        $prefix_mod = $db->prefix() . '_' . $mydirname ;
33
+    $sql_file_path = __DIR__.'/sql/mysql.sql';
34
+        $prefix_mod = $db->prefix().'_'.$mydirname;
35 35
         if (file_exists($sql_file_path)) {
36
-            $ret[] = 'SQL file found at <b>' . htmlspecialchars($sql_file_path) . '</b>.<br /> Creating tables...';
36
+            $ret[] = 'SQL file found at <b>'.htmlspecialchars($sql_file_path).'</b>.<br /> Creating tables...';
37 37
 
38 38
             if (file_exists(XOOPS_ROOT_PATH.'/class/database/oldsqlutility.php')) {
39
-                include_once XOOPS_ROOT_PATH.'/class/database/oldsqlutility.php' ;
40
-                $sqlutil = new OldSqlUtility ;
39
+                include_once XOOPS_ROOT_PATH.'/class/database/oldsqlutility.php';
40
+                $sqlutil = new OldSqlUtility;
41 41
             } else {
42
-                include_once XOOPS_ROOT_PATH.'/class/database/sqlutility.php' ;
43
-                $sqlutil = new SqlUtility ;
42
+                include_once XOOPS_ROOT_PATH.'/class/database/sqlutility.php';
43
+                $sqlutil = new SqlUtility;
44 44
             }
45 45
 
46
-            $sql_query = trim(file_get_contents($sql_file_path)) ;
47
-            $sqlutil->splitMySqlFile($pieces, $sql_query) ;
48
-            $created_tables = array() ;
46
+            $sql_query = trim(file_get_contents($sql_file_path));
47
+            $sqlutil->splitMySqlFile($pieces, $sql_query);
48
+            $created_tables = array();
49 49
             foreach ($pieces as $piece) {
50
-                $prefixed_query = $sqlutil->prefixQuery($piece, $prefix_mod) ;
51
-                if (! $prefixed_query) {
52
-                    $ret[] = 'Invalid SQL <b>' . htmlspecialchars($piece) . '</b><br />';
53
-                    return false ;
50
+                $prefixed_query = $sqlutil->prefixQuery($piece, $prefix_mod);
51
+                if (!$prefixed_query) {
52
+                    $ret[] = 'Invalid SQL <b>'.htmlspecialchars($piece).'</b><br />';
53
+                    return false;
54 54
                 }
55
-                if (! $db->query($prefixed_query[0])) {
56
-                    $ret[] = '<b>'.htmlspecialchars($db->error()).'</b><br />' ;
55
+                if (!$db->query($prefixed_query[0])) {
56
+                    $ret[] = '<b>'.htmlspecialchars($db->error()).'</b><br />';
57 57
                 //var_dump( $db->error() ) ;
58
-                return false ;
58
+                return false;
59 59
                 } else {
60
-                    if (! in_array($prefixed_query[4], $created_tables)) {
60
+                    if (!in_array($prefixed_query[4], $created_tables)) {
61 61
                         $ret[] = 'Table <b>'.htmlspecialchars($prefix_mod.'_'.$prefixed_query[4]).'</b> created.<br />';
62 62
                         $created_tables[] = $prefixed_query[4];
63 63
                     } else {
@@ -68,33 +68,33 @@  discard block
 block discarded – undo
68 68
         }
69 69
 
70 70
     // TEMPLATES
71
-    $tplfile_handler = xoops_getHandler('tplfile') ;
72
-        $tpl_path = __DIR__.'/templates' ;
73
-        if ($handler = @opendir($tpl_path . '/')) {
71
+    $tplfile_handler = xoops_getHandler('tplfile');
72
+        $tpl_path = __DIR__.'/templates';
73
+        if ($handler = @opendir($tpl_path.'/')) {
74 74
             while (($file = readdir($handler)) !== false) {
75 75
                 if (substr($file, 0, 1) == '.') {
76
-                    continue ;
76
+                    continue;
77 77
                 }
78
-                $file_path = $tpl_path . '/' . $file ;
78
+                $file_path = $tpl_path.'/'.$file;
79 79
                 if (is_file($file_path)) {
80 80
                     $mtime = (int)(@filemtime($file_path));
81
-                    $tplfile = $tplfile_handler->create() ;
82
-                    $tplfile->setVar('tpl_source', file_get_contents($file_path), true) ;
83
-                    $tplfile->setVar('tpl_refid', $mid) ;
84
-                    $tplfile->setVar('tpl_tplset', 'default') ;
85
-                    $tplfile->setVar('tpl_file', $mydirname . '_' . $file) ;
86
-                    $tplfile->setVar('tpl_desc', '', true) ;
87
-                    $tplfile->setVar('tpl_module', $mydirname) ;
88
-                    $tplfile->setVar('tpl_lastmodified', $mtime) ;
89
-                    $tplfile->setVar('tpl_lastimported', 0) ;
90
-                    $tplfile->setVar('tpl_type', 'module') ;
91
-                    if (! $tplfile_handler->insert($tplfile)) {
81
+                    $tplfile = $tplfile_handler->create();
82
+                    $tplfile->setVar('tpl_source', file_get_contents($file_path), true);
83
+                    $tplfile->setVar('tpl_refid', $mid);
84
+                    $tplfile->setVar('tpl_tplset', 'default');
85
+                    $tplfile->setVar('tpl_file', $mydirname.'_'.$file);
86
+                    $tplfile->setVar('tpl_desc', '', true);
87
+                    $tplfile->setVar('tpl_module', $mydirname);
88
+                    $tplfile->setVar('tpl_lastmodified', $mtime);
89
+                    $tplfile->setVar('tpl_lastimported', 0);
90
+                    $tplfile->setVar('tpl_type', 'module');
91
+                    if (!$tplfile_handler->insert($tplfile)) {
92 92
                         $ret[] = '<span style="color:#ff0000;">ERROR: Could not insert template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> to the database.</span><br />';
93 93
                     } else {
94
-                        $tplid = $tplfile->getVar('tpl_id') ;
94
+                        $tplid = $tplfile->getVar('tpl_id');
95 95
                         $ret[] = 'Template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> added to the database. (ID: <b>'.$tplid.'</b>)<br />';
96
-                        require_once XOOPS_TRUST_PATH.'/libs/altsys/include/altsys_functions.php' ;
97
-                        altsys_clear_templates_c() ;
96
+                        require_once XOOPS_TRUST_PATH.'/libs/altsys/include/altsys_functions.php';
97
+                        altsys_clear_templates_c();
98 98
                     // generate compiled file
99 99
                     /*include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ;
100 100
                     include_once XOOPS_ROOT_PATH.'/class/template.php' ;
@@ -106,20 +106,20 @@  discard block
 block discarded – undo
106 106
                     }
107 107
                 }
108 108
             }
109
-            closedir($handler) ;
109
+            closedir($handler);
110 110
         }
111
-        include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ;
112
-        include_once XOOPS_ROOT_PATH.'/class/template.php' ;
113
-        xoops_template_clear_module_cache($mid) ;
111
+        include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php';
112
+        include_once XOOPS_ROOT_PATH.'/class/template.php';
113
+        xoops_template_clear_module_cache($mid);
114 114
 
115
-        return true ;
115
+        return true;
116 116
     }
117 117
 
118 118
     function altsys_message_append_oninstall(&$module_obj, &$log)
119 119
     {
120 120
         if (is_array(@$GLOBALS['ret'])) {
121 121
             foreach ($GLOBALS['ret'] as $message) {
122
-                $log->add(strip_tags($message)) ;
122
+                $log->add(strip_tags($message));
123 123
             }
124 124
         }
125 125
 
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/blocks/block_functions.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -1,33 +1,33 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once dirname(__DIR__).'/include/altsys_functions.php' ;
3
+require_once dirname(__DIR__).'/include/altsys_functions.php';
4 4
 
5 5
 function b_altsys_admin_menu_show($options)
6 6
 {
7
-    global $xoopsUser ;
7
+    global $xoopsUser;
8 8
 
9
-    $mydirname = empty($options[0]) ? 'altsys' : $options[0] ;
10
-    $this_template = empty($options[1]) ? 'db:'.$mydirname.'_block_admin_menu.html' : trim($options[1]) ;
9
+    $mydirname = empty($options[0]) ? 'altsys' : $options[0];
10
+    $this_template = empty($options[1]) ? 'db:'.$mydirname.'_block_admin_menu.html' : trim($options[1]);
11 11
 
12 12
     if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
13
-        die('Invalid mydirname') ;
13
+        die('Invalid mydirname');
14 14
     }
15
-    if (! is_object(@$xoopsUser)) {
16
-        return array() ;
15
+    if (!is_object(@$xoopsUser)) {
16
+        return array();
17 17
     }
18 18
 
19 19
     // coretype
20
-    $coretype = altsys_get_core_type() ;
20
+    $coretype = altsys_get_core_type();
21 21
 
22 22
     // mid_selected
23 23
     if (is_object(@$GLOBALS['xoopsModule'])) {
24
-        $mid_selected = $GLOBALS['xoopsModule']->getVar('mid') ;
24
+        $mid_selected = $GLOBALS['xoopsModule']->getVar('mid');
25 25
         // for system->preferences
26
-        if ($mid_selected == 1 && @$_GET['fct'] == 'preferences' && @$_GET['op'] == 'showmod' && ! empty($_GET['mod'])) {
26
+        if ($mid_selected == 1 && @$_GET['fct'] == 'preferences' && @$_GET['op'] == 'showmod' && !empty($_GET['mod'])) {
27 27
             $mid_selected = (int)$_GET['mod'];
28 28
         }
29 29
     } else {
30
-        $mid_selected = 0 ;
30
+        $mid_selected = 0;
31 31
     }
32 32
 
33 33
     $db = XoopsDatabaseFactory::getDatabaseConnection();
@@ -36,72 +36,72 @@  discard block
 block discarded – undo
36 36
     $module_handler = xoops_getHandler('module');
37 37
     $current_module = $module_handler->getByDirname($mydirname);
38 38
     $config_handler = xoops_getHandler('config');
39
-    $current_configs = $config_handler->getConfigList($current_module->mid()) ;
39
+    $current_configs = $config_handler->getConfigList($current_module->mid());
40 40
     $moduleperm_handler = xoops_getHandler('groupperm');
41 41
     $admin_mids = $moduleperm_handler->getItemIds('module_admin', $xoopsUser->getGroups());
42
-    $modules = $module_handler->getObjects(new Criteria('mid', '('.implode(',', $admin_mids) . ')', 'IN'), true) ;
42
+    $modules = $module_handler->getObjects(new Criteria('mid', '('.implode(',', $admin_mids).')', 'IN'), true);
43 43
 
44 44
     $block = array(
45
-        'mydirname' => $mydirname ,
46
-        'mod_url' => XOOPS_URL.'/modules/'.$mydirname ,
47
-        'mod_imageurl' => XOOPS_URL.'/modules/'.$mydirname.'/'.$current_configs['images_dir'] ,
45
+        'mydirname' => $mydirname,
46
+        'mod_url' => XOOPS_URL.'/modules/'.$mydirname,
47
+        'mod_imageurl' => XOOPS_URL.'/modules/'.$mydirname.'/'.$current_configs['images_dir'],
48 48
         'mod_config' => $current_configs
49
-    ) ;
49
+    );
50 50
 
51 51
     foreach ($modules as $mod) {
52 52
         $mid = (int)$mod->getVar('mid');
53
-        $dirname = $mod->getVar('dirname') ;
54
-        $modinfo = $mod->getInfo() ;
55
-        $submenus4assign = array() ;
56
-        $adminmenu = array() ;
57
-        $adminmenu4altsys = array() ;
58
-        unset($adminmenu_use_altsys) ;
59
-        @include XOOPS_ROOT_PATH.'/modules/'.$dirname.'/'.@$modinfo['adminmenu'] ;
53
+        $dirname = $mod->getVar('dirname');
54
+        $modinfo = $mod->getInfo();
55
+        $submenus4assign = array();
56
+        $adminmenu = array();
57
+        $adminmenu4altsys = array();
58
+        unset($adminmenu_use_altsys);
59
+        @include XOOPS_ROOT_PATH.'/modules/'.$dirname.'/'.@$modinfo['adminmenu'];
60 60
         // from admin_menu.php etc.
61
-        $adminmenu = array_merge($adminmenu, $adminmenu4altsys) ;
61
+        $adminmenu = array_merge($adminmenu, $adminmenu4altsys);
62 62
         foreach ($adminmenu as $sub) {
63
-            $link = empty($sub['altsys_link']) ? $sub['link'] : $sub['altsys_link'] ;
63
+            $link = empty($sub['altsys_link']) ? $sub['link'] : $sub['altsys_link'];
64 64
             if (isset($sub['show']) && $sub['show'] === false) {
65
-                continue ;
65
+                continue;
66 66
             }
67 67
             $submenus4assign[] = array(
68
-                'title' => $myts->makeTboxData4Show($sub['title']) ,
68
+                'title' => $myts->makeTboxData4Show($sub['title']),
69 69
                 'url' => XOOPS_URL.'/modules/'.$dirname.'/'.htmlspecialchars($link, ENT_QUOTES)
70
-            ) ;
70
+            );
71 71
         }
72 72
 
73 73
         // for modules overriding Module.class.php (eg. Analyzer for XC)
74
-        if (empty($submenus4assign) && defined('XOOPS_CUBE_LEGACY') && ! empty($modinfo['cube_style'])) {
74
+        if (empty($submenus4assign) && defined('XOOPS_CUBE_LEGACY') && !empty($modinfo['cube_style'])) {
75 75
             $module_handler = xoops_getHandler('module');
76 76
             $module = $module_handler->get($mid);
77 77
             $moduleObj = Legacy_Utils::createModule($module);
78
-            $modinfo['adminindex'] = $moduleObj->getAdminIndex() ;
79
-            $modinfo['adminindex_absolute'] = true ;
78
+            $modinfo['adminindex'] = $moduleObj->getAdminIndex();
79
+            $modinfo['adminindex_absolute'] = true;
80 80
             foreach ($moduleObj->getAdminMenu() as $sub) {
81 81
                 if (@$sub['show'] === false) {
82
-                    continue ;
82
+                    continue;
83 83
                 }
84 84
                 $submenus4assign[] = array(
85
-                    'title' => $myts->makeTboxData4Show($sub['title']) ,
85
+                    'title' => $myts->makeTboxData4Show($sub['title']),
86 86
                     'url' => strncmp($sub['link'], 'http', 4) === 0 ? htmlspecialchars($sub['link'], ENT_QUOTES) : XOOPS_URL.'/modules/'.$dirname.'/'.htmlspecialchars($sub['link'], ENT_QUOTES)
87
-                ) ;
87
+                );
88 88
             }
89 89
         } elseif (empty($adminmenu4altsys)) {
90 90
 
91 91
             // add preferences
92
-            if ($mod->getVar('hasconfig') && ! in_array($mod->getVar('dirname'), array( 'system', 'legacy' ))) {
92
+            if ($mod->getVar('hasconfig') && !in_array($mod->getVar('dirname'), array('system', 'legacy'))) {
93 93
                 $submenus4assign[] = array(
94
-                    'title' => _PREFERENCES ,
94
+                    'title' => _PREFERENCES,
95 95
                     'url' => htmlspecialchars(altsys_get_link2modpreferences($mid, $coretype), ENT_QUOTES)
96
-                ) ;
96
+                );
97 97
             }
98 98
 
99 99
             // add help
100
-            if (defined('XOOPS_CUBE_LEGACY') && ! empty($modinfo['help'])) {
100
+            if (defined('XOOPS_CUBE_LEGACY') && !empty($modinfo['help'])) {
101 101
                 $submenus4assign[] = array(
102
-                    'title' => _HELP ,
102
+                    'title' => _HELP,
103 103
                     'url' => XOOPS_URL.'/modules/legacy/admin/index.php?action=Help&amp;dirname='.$dirname
104
-                ) ;
104
+                );
105 105
             }
106 106
         }
107 107
 
@@ -123,25 +123,25 @@  discard block
 block discarded – undo
123 123
             'submenu' => $submenus4assign,
124 124
             'selected' => $mid == $mid_selected,
125 125
             'dot_suffix' => $mid == $mid_selected ? 'selected_opened' : 'closed'
126
-        ) ;
127
-        $block['modules'][] = $module4assign ;
126
+        );
127
+        $block['modules'][] = $module4assign;
128 128
     }
129 129
 
130
-    require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ;
131
-    $tpl = new D3Tpl() ;
132
-    $tpl->assign('block', $block) ;
133
-    $ret['content'] = $tpl->fetch($this_template) ;
134
-    return $ret ;
130
+    require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php';
131
+    $tpl = new D3Tpl();
132
+    $tpl->assign('block', $block);
133
+    $ret['content'] = $tpl->fetch($this_template);
134
+    return $ret;
135 135
 }
136 136
 
137 137
 
138 138
 function b_altsys_admin_menu_edit($options)
139 139
 {
140
-    $mydirname = empty($options[0]) ? 'd3forum' : $options[0] ;
141
-    $this_template = empty($options[1]) ? 'db:'.$mydirname.'_block_admin_menu.html' : trim($options[1]) ;
140
+    $mydirname = empty($options[0]) ? 'd3forum' : $options[0];
141
+    $this_template = empty($options[1]) ? 'db:'.$mydirname.'_block_admin_menu.html' : trim($options[1]);
142 142
 
143 143
     if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
144
-        die('Invalid mydirname') ;
144
+        die('Invalid mydirname');
145 145
     }
146 146
 
147 147
     $form = "
Please login to merge, or discard this patch.