Completed
Push — master ( 4d9699...f6489b )
by Michael
03:33
created
xoops_trust_path/libs/altsys/class/altsysUtils.class.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -1,6 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 class altsysUtils
3 3
 {
4
+    /**
5
+     * @param string $name
6
+     */
4 7
     public static function getDelegateCallbackClassNames($name, $doRegist = true)
5 8
     {
6 9
         $names = array();
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php 3 patches
Doc Comments   +24 added lines patch added patch discarded remove patch
@@ -487,6 +487,12 @@  discard block
 block discarded – undo
487 487
     }
488 488
 
489 489
 
490
+    /**
491
+     * @param integer $bside
492
+     * @param integer $bweight
493
+     * @param integer $bvisible
494
+     * @param integer $bcachetime
495
+     */
490 496
     public function update_block($bid, $bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bcachetime, $options=array())
491 497
     {
492 498
         global $xoopsConfig;
@@ -645,6 +651,9 @@  discard block
 block discarded – undo
645 651
     }
646 652
 
647 653
 
654
+    /**
655
+     * @param integer $bid
656
+     */
648 657
     public function do_delete($bid)
649 658
     {
650 659
         $bid = (int)$bid;
@@ -670,6 +679,9 @@  discard block
 block discarded – undo
670 679
     }
671 680
 
672 681
 //HACK add by domifara
682
+/**
683
+ * @param integer $bid
684
+ */
673 685
 public function do_deleteBlockReadGroupPerm($bid)
674 686
 {
675 687
     $bid = (int)$bid;
@@ -678,6 +690,9 @@  discard block
 block discarded – undo
678 690
     $this->db->query($sql) ;
679 691
 }
680 692
 
693
+    /**
694
+     * @param integer $bid
695
+     */
681 696
     public function form_delete($bid)
682 697
     {
683 698
         $bid = (int)$bid;
@@ -707,6 +722,9 @@  discard block
 block discarded – undo
707 722
     }
708 723
 
709 724
 
725
+    /**
726
+     * @param integer $bid
727
+     */
710 728
     public function do_clone($bid)
711 729
     {
712 730
         $bid = (int)$bid;
@@ -785,6 +803,9 @@  discard block
 block discarded – undo
785 803
     }
786 804
 
787 805
 
806
+    /**
807
+     * @param integer $bid
808
+     */
788 809
     public function do_edit($bid)
789 810
     {
790 811
         $bid = (int)$bid;
@@ -828,6 +849,9 @@  discard block
 block discarded – undo
828 849
     }
829 850
 
830 851
 
852
+    /**
853
+     * @param integer $bid
854
+     */
831 855
     public function form_edit($bid, $mode = 'edit')
832 856
     {
833 857
         $bid = (int)$bid;
Please login to merge, or discard this patch.
Switch Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -307,30 +307,30 @@  discard block
 block discarded – undo
307 307
         $scoln = 'disabled';
308 308
     } else {
309 309
         switch ($side) {
310
-        case XOOPS_SIDEBLOCK_LEFT:
311
-            $ssel0 = " checked='checked'";
312
-            $scol0 = 'selected';
313
-            break ;
314
-        case XOOPS_SIDEBLOCK_RIGHT:
315
-            $ssel1 = " checked='checked'";
316
-            $scol1 = 'selected';
317
-            break ;
318
-        case XOOPS_CENTERBLOCK_LEFT:
319
-            $ssel2 = " checked='checked'";
320
-            $scol2 = 'selected';
321
-            break ;
322
-        case XOOPS_CENTERBLOCK_RIGHT:
323
-            $ssel4 = " checked='checked'";
324
-            $scol4 = 'selected';
325
-            break ;
326
-        case XOOPS_CENTERBLOCK_CENTER:
327
-            $ssel3 = " checked='checked'";
328
-            $scol3 = 'selected';
329
-            break ;
330
-        default:
331
-            $value4extra_side = $side ;
332
-            $stextbox = 'selected';
333
-            break ;
310
+            case XOOPS_SIDEBLOCK_LEFT:
311
+                $ssel0 = " checked='checked'";
312
+                $scol0 = 'selected';
313
+                break ;
314
+            case XOOPS_SIDEBLOCK_RIGHT:
315
+                $ssel1 = " checked='checked'";
316
+                $scol1 = 'selected';
317
+                break ;
318
+            case XOOPS_CENTERBLOCK_LEFT:
319
+                $ssel2 = " checked='checked'";
320
+                $scol2 = 'selected';
321
+                break ;
322
+            case XOOPS_CENTERBLOCK_RIGHT:
323
+                $ssel4 = " checked='checked'";
324
+                $scol4 = 'selected';
325
+                break ;
326
+            case XOOPS_CENTERBLOCK_CENTER:
327
+                $ssel3 = " checked='checked'";
328
+                $scol3 = 'selected';
329
+                break ;
330
+            default:
331
+                $value4extra_side = $side ;
332
+                $stextbox = 'selected';
333
+                break ;
334 334
     }
335 335
     }
336 336
 
@@ -850,31 +850,31 @@  discard block
 block discarded – undo
850 850
         }
851 851
 
852 852
         switch ($mode) {
853
-        case 'clone':
854
-            $form_title = _MD_A_MYBLOCKSADMIN_CLONEFORM ;
855
-            $button_value = _MD_A_MYBLOCKSADMIN_BTN_CLONE ;
856
-            $next_op = 'clone_ok' ;
857
-            // breadcrumbs
858
-            $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ;
859
-            $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_CLONEFORM) ;
860
-            break ;
861
-        case 'new':
862
-            $form_title = _MD_A_MYBLOCKSADMIN_NEWFORM ;
863
-            $button_value = _MD_A_MYBLOCKSADMIN_BTN_NEW ;
864
-            $next_op = 'new_ok' ;
865
-            // breadcrumbs
866
-            $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ;
867
-            $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_NEWFORM) ;
868
-            break ;
869
-        case 'edit':
870
-        default:
871
-            $form_title = _MD_A_MYBLOCKSADMIN_EDITFORM ;
872
-            $button_value = _MD_A_MYBLOCKSADMIN_BTN_EDIT ;
873
-            $next_op = 'edit_ok' ;
874
-            // breadcrumbs
875
-            $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ;
876
-            $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_EDITFORM) ;
877
-            break ;
853
+            case 'clone':
854
+                $form_title = _MD_A_MYBLOCKSADMIN_CLONEFORM ;
855
+                $button_value = _MD_A_MYBLOCKSADMIN_BTN_CLONE ;
856
+                $next_op = 'clone_ok' ;
857
+                // breadcrumbs
858
+                $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ;
859
+                $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_CLONEFORM) ;
860
+                break ;
861
+            case 'new':
862
+                $form_title = _MD_A_MYBLOCKSADMIN_NEWFORM ;
863
+                $button_value = _MD_A_MYBLOCKSADMIN_BTN_NEW ;
864
+                $next_op = 'new_ok' ;
865
+                // breadcrumbs
866
+                $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ;
867
+                $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_NEWFORM) ;
868
+                break ;
869
+            case 'edit':
870
+            default:
871
+                $form_title = _MD_A_MYBLOCKSADMIN_EDITFORM ;
872
+                $button_value = _MD_A_MYBLOCKSADMIN_BTN_EDIT ;
873
+                $next_op = 'edit_ok' ;
874
+                // breadcrumbs
875
+                $breadcrumbsObj = AltsysBreadcrumbs::getInstance() ;
876
+                $breadcrumbsObj->appendPath('', _MD_A_MYBLOCKSADMIN_EDITFORM) ;
877
+                break ;
878 878
     }
879 879
 
880 880
         $is_custom = in_array($block->getVar('block_type'), array( 'C', 'E' )) ? true : false ;
@@ -1050,23 +1050,23 @@  discard block
 block discarded – undo
1050 1050
     {
1051 1051
         $bid = (int)(@$_GET['bid']);
1052 1052
         switch (@$_GET['op']) {
1053
-        case 'clone':
1054
-            $this->form_edit($bid, 'clone') ;
1055
-            break ;
1056
-        case 'new':
1057
-        case 'edit':
1058
-            $this->form_edit($bid, 'edit') ;
1059
-            break ;
1060
-        case 'delete':
1061
-            $this->form_delete($bid) ;
1062
-            break ;
1063
-        case 'list':
1064
-        default:
1065
-            // the first form (blocks)
1066
-            $this->list_blocks() ;
1067
-            // the second form (groups)
1068
-            $this->list_groups() ;
1069
-            break ;
1053
+            case 'clone':
1054
+                $this->form_edit($bid, 'clone') ;
1055
+                break ;
1056
+            case 'new':
1057
+            case 'edit':
1058
+                $this->form_edit($bid, 'edit') ;
1059
+                break ;
1060
+            case 'delete':
1061
+                $this->form_delete($bid) ;
1062
+                break ;
1063
+            case 'list':
1064
+            default:
1065
+                // the first form (blocks)
1066
+                $this->list_blocks() ;
1067
+                // the second form (groups)
1068
+                $this->list_groups() ;
1069
+                break ;
1070 1070
     }
1071 1071
     }
1072 1072
 }
Please login to merge, or discard this 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') . '&nbsp;' . 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').'&nbsp;'.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&amp;lib=altsys&amp;page=myblocksadmin', '_MI_ALTSYS_MENU_MYBLOCKSADMIN') ;
103
-            $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=myblocksadmin&amp;dirname='.$this->target_dirname, $this->target_mname) ;
101
+            $breadcrumbsObj = AltsysBreadcrumbs::getInstance();
102
+            $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=myblocksadmin', '_MI_ALTSYS_MENU_MYBLOCKSADMIN');
103
+            $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=myblocksadmin&amp;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&amp;lib=altsys&amp;page=myblocksadmin', '_MI_ALTSYS_MENU_MYBLOCKSADMIN') ;
112
-            $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=myblocksadmin&amp;dirname='.$this->target_dirname, '_MI_ALTSYS_MENU_CUSTOMBLOCKS') ;
110
+            $breadcrumbsObj = AltsysBreadcrumbs::getInstance();
111
+            $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=myblocksadmin', '_MI_ALTSYS_MENU_MYBLOCKSADMIN');
112
+            $breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=myblocksadmin&amp;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') . '&nbsp;' . 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&amp;lib=altsys&amp;page=myblocksadmin', _MD_A_MYBLOCKSADMIN_BLOCKADMIN) ;
116
+        $this->target_mid = $xoopsModule->getVar('mid');
117
+        $this->target_mname = $xoopsModule->getVar('name').'&nbsp;'.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&amp;lib=altsys&amp;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/MyBlocksAdminForICMS.class.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -91,6 +91,9 @@
 block discarded – undo
91 91
 
92 92
 
93 93
 // private
94
+/**
95
+ * @param integer $target_side
96
+ */
94 97
 public function renderRadio4BlockPosition($target_side, $block_data)
95 98
 {
96 99
     $bid = (int)$block_data['bid'];
Please login to merge, or discard this 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/MyBlocksAdminForX20S.class.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -68,6 +68,9 @@
 block discarded – undo
68 68
 
69 69
 
70 70
 // private
71
+/**
72
+ * @param integer $target_side
73
+ */
71 74
 public function renderRadio4BlockPosition($target_side, $block_data)
72 75
 {
73 76
     $bid = (int)$block_data['bid'];
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/include/Archive_Zip.php 2 patches
Doc Comments   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -136,6 +136,9 @@  discard block
 block discarded – undo
136 136
     */
137 137
 //HACK by domifara
138 138
 //  function Archive_Zip($p_zipname)
139
+    /**
140
+     * @param string $p_zipname
141
+     */
139 142
     public function __construct($p_zipname)
140 143
     {
141 144
 
@@ -176,7 +179,7 @@  discard block
 block discarded – undo
176 179
     * @param  mixed  $p_filelist  The list of the files or folders to add.
177 180
     *                             It can be a string with filenames separated
178 181
     *                             by a comma, or an array of filenames.
179
-    * @param  mixed  $p_params  An array of variable parameters and values.
182
+    * @param  integer  $p_params  An array of variable parameters and values.
180 183
     * @return mixed An array of file description on success,
181 184
     *               an error code on error
182 185
     */
@@ -247,7 +250,7 @@  discard block
 block discarded – undo
247 250
     * @param    mixed  $p_filelist  The list of the files or folders to add.
248 251
     *                               It can be a string with filenames separated
249 252
     *                               by a comma, or an array of filenames.
250
-    * @param    mixed  $p_params  An array of variable parameters and values.
253
+    * @param    integer  $p_params  An array of variable parameters and values.
251 254
     * @return mixed An array of file description on success,
252 255
     *               0 on an unrecoverable failure, an error code is logged.
253 256
     */
@@ -397,7 +400,7 @@  discard block
 block discarded – undo
397 400
     *                            each entry extraction.
398 401
     *
399 402
     * @access public
400
-    * @param    mixed  $p_params  An array of variable parameters and values.
403
+    * @param    integer  $p_params  An array of variable parameters and values.
401 404
     * @return mixed An array of file description on success,
402 405
     *               0 on an unrecoverable failure, an error code is logged.
403 406
     */
@@ -512,7 +515,6 @@  discard block
 block discarded – undo
512 515
     *    status : not_exist, ok
513 516
     *
514 517
     * @access public
515
-    * @param    mixed  $p_params  {Description}
516 518
     * @return mixed An array with the global properties or 0 on error.
517 519
     */
518 520
     public function properties()
@@ -996,6 +998,7 @@  discard block
 block discarded – undo
996 998
   *
997 999
   * { Description }
998 1000
   *
1001
+  * @param string $p_mode
999 1002
   */
1000 1003
   public function _openFd($p_mode)
1001 1004
   {
@@ -1565,6 +1568,7 @@  discard block
 block discarded – undo
1565 1568
   *
1566 1569
   * { Description }
1567 1570
   *
1571
+  * @param string $p_comment
1568 1572
   */
1569 1573
   public function _writeCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment)
1570 1574
   {
@@ -3140,8 +3144,6 @@  discard block
 block discarded – undo
3140 3144
   *
3141 3145
   * { Description }
3142 3146
   *
3143
-  * @param integer $p_error_code
3144
-  * @param string $p_error_string
3145 3147
   */
3146 3148
   public function _check_parameters(&$p_params, $p_default)
3147 3149
   {
@@ -3371,6 +3373,8 @@  discard block
 block discarded – undo
3371 3373
   * { Description }
3372 3374
   *
3373 3375
   * @param integer $p_mode
3376
+  * @param integer $p_src
3377
+  * @param integer $p_dest
3374 3378
   */
3375 3379
   public function _tool_CopyBlock($p_src, $p_dest, $p_size, $p_mode=0)
3376 3380
   {
@@ -3432,6 +3436,8 @@  discard block
 block discarded – undo
3432 3436
   *
3433 3437
   * { Description }
3434 3438
   *
3439
+  * @param string $p_src
3440
+  * @param string $p_dest
3435 3441
   */
3436 3442
   public function _tool_Rename($p_src, $p_dest)
3437 3443
   {
Please login to merge, or discard this patch.
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -106,24 +106,24 @@  discard block
 block discarded – undo
106 106
     *
107 107
     * @var string Name of the Zip file
108 108
     */
109
-    public $_zipname='';
109
+    public $_zipname = '';
110 110
 
111 111
     /**
112 112
     * File descriptor of the opened Zip file.
113 113
     *
114 114
     * @var int Internal zip file descriptor
115 115
     */
116
-    public $_zip_fd=0;
116
+    public $_zip_fd = 0;
117 117
 
118 118
     /**
119 119
     * @var int last error code
120 120
     */
121
-    public $_error_code=1;
121
+    public $_error_code = 1;
122 122
 
123 123
     /**
124 124
     * @var string Last error description
125 125
     */
126
-    public $_error_string='';
126
+    public $_error_string = '';
127 127
 
128 128
     // {{{ constructor
129 129
     /**
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
           PEAR::loadExtension('zlib');
145 145
       }*/ // GIJ
146 146
       if (!extension_loaded('zlib')) {
147
-          die("The extension 'zlib' couldn't be found.\n". 'Please make sure your version of PHP was built ' .
147
+          die("The extension 'zlib' couldn't be found.\n".'Please make sure your version of PHP was built '.
148 148
               "with 'zlib' support.\n");
149 149
           return false;
150 150
       }
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     * @return mixed An array of file description on success,
181 181
     *               an error code on error
182 182
     */
183
-    public function create($p_filelist, $p_params=0)
183
+    public function create($p_filelist, $p_params = 0)
184 184
     {
185 185
         $this->_errorReset();
186 186
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
     * @return mixed An array of file description on success,
252 252
     *               0 on an unrecoverable failure, an error code is logged.
253 253
     */
254
-    public function add($p_filelist, $p_params=0)
254
+    public function add($p_filelist, $p_params = 0)
255 255
     {
256 256
         $this->_errorReset();
257 257
 
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
     * @return mixed An array of file description on success,
402 402
     *               0 on an unrecoverable failure, an error code is logged.
403 403
     */
404
-    public function extract($p_params=0)
404
+    public function extract($p_params = 0)
405 405
     {
406 406
         $this->_errorReset();
407 407
 
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
     * @param  boolean $p_with_code  If true, gives the name and the int value.
672 672
     * @return string The error name.
673 673
     */
674
-    public function errorName($p_with_code=false)
674
+    public function errorName($p_with_code = false)
675 675
     {
676 676
         $v_const_list = get_defined_constants();
677 677
 
@@ -685,8 +685,8 @@  discard block
 block discarded – undo
685 685
         }
686 686
 
687 687
         // ----- Search the name form the code value
688
-        $v_key=array_search($this->_error_code, $v_error_list, true);
689
-        if ($v_key!=false) {
688
+        $v_key = array_search($this->_error_code, $v_error_list, true);
689
+        if ($v_key != false) {
690 690
             $v_value = $v_key;
691 691
         } else {
692 692
             $v_value = 'NoName';
@@ -711,12 +711,12 @@  discard block
 block discarded – undo
711 711
     *                         and the error code.
712 712
     * @return string The error description.
713 713
     */
714
-    public function errorInfo($p_full=false)
714
+    public function errorInfo($p_full = false)
715 715
     {
716 716
         if ($p_full) {
717
-            return($this->errorName(true) . ' : ' . $this->_error_string);
717
+            return($this->errorName(true).' : '.$this->_error_string);
718 718
         } else {
719
-            return($this->_error_string . ' [code ' . $this->_error_code . ']');
719
+            return($this->_error_string.' [code '.$this->_error_code.']');
720 720
         }
721 721
     }
722 722
     // }}}
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
   *
750 750
   * @param integer $p_level
751 751
   */
752
-  public function _checkFormat($p_level=0)
752
+  public function _checkFormat($p_level = 0)
753 753
   {
754 754
       $v_result = true;
755 755
 
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
   */
801 801
   public function _create($p_list, &$p_result_list, &$p_params)
802 802
   {
803
-      $v_result=1;
803
+      $v_result = 1;
804 804
       $v_list_detail = array();
805 805
 
806 806
       $p_add_dir = $p_params['add_path'];
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
   */
839 839
   public function _add($p_list, &$p_result_list, &$p_params)
840 840
   {
841
-      $v_result=1;
841
+      $v_result = 1;
842 842
       $v_list_detail = array();
843 843
 
844 844
       $p_add_dir = $p_params['add_path'];
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
     }
853 853
 
854 854
     // ----- Open the zip file
855
-    if (($v_result=$this->_openFd('rb')) != 1) {
855
+    if (($v_result = $this->_openFd('rb')) != 1) {
856 856
         return $v_result;
857 857
     }
858 858
 
@@ -925,10 +925,10 @@  discard block
 block discarded – undo
925 925
       }
926 926
 
927 927
     // ----- Create the Central Dir files header
928
-    for ($i=0, $v_count=0; $i < count($v_header_list); $i++) {
928
+    for ($i = 0, $v_count = 0; $i < count($v_header_list); $i++) {
929 929
         // ----- Create the file header
930 930
       if ($v_header_list[$i]['status'] == 'ok') {
931
-          if (($v_result=$this->_writeCentralFileHeader($v_header_list[$i]))!=1) {
931
+          if (($v_result = $this->_writeCentralFileHeader($v_header_list[$i])) != 1) {
932 932
               fclose($v_zip_temp_fd);
933 933
               $this->_closeFd();
934 934
               @unlink($v_zip_temp_name);
@@ -947,7 +947,7 @@  discard block
 block discarded – undo
947 947
     $v_comment = '';
948 948
 
949 949
     // ----- Calculate the size of the central header
950
-    $v_size = @ftell($this->_zip_fd)-$v_offset;
950
+    $v_size = @ftell($this->_zip_fd) - $v_offset;
951 951
 
952 952
     // ----- Create the central dir footer
953 953
     if (($v_result = $this->_writeCentralHeader($v_count
@@ -999,7 +999,7 @@  discard block
 block discarded – undo
999 999
   */
1000 1000
   public function _openFd($p_mode)
1001 1001
   {
1002
-      $v_result=1;
1002
+      $v_result = 1;
1003 1003
 
1004 1004
     // ----- Look if already open
1005 1005
     if ($this->_zip_fd != 0) {
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
   */
1035 1035
   public function _closeFd()
1036 1036
   {
1037
-      $v_result=1;
1037
+      $v_result = 1;
1038 1038
 
1039 1039
       if ($this->_zip_fd != 0) {
1040 1040
           @fclose($this->_zip_fd);
@@ -1068,7 +1068,7 @@  discard block
 block discarded – undo
1068 1068
   public function _addList($p_list, &$p_result_list,
1069 1069
                     $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_params)
1070 1070
   {
1071
-      $v_result=1;
1071
+      $v_result = 1;
1072 1072
 
1073 1073
     // ----- Add the files
1074 1074
     $v_header_list = array();
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
     $v_offset = @ftell($this->_zip_fd);
1083 1083
 
1084 1084
     // ----- Create the Central Dir files header
1085
-    for ($i=0, $v_count=0; $i < count($v_header_list); $i++) {
1085
+    for ($i = 0, $v_count = 0; $i < count($v_header_list); $i++) {
1086 1086
         // ----- Create the file header
1087 1087
       if ($v_header_list[$i]['status'] == 'ok') {
1088 1088
           if (($v_result = $this->_writeCentralFileHeader($v_header_list[$i])) != 1) {
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
     $v_comment = '';
1100 1100
 
1101 1101
     // ----- Calculate the size of the central header
1102
-    $v_size = @ftell($this->_zip_fd)-$v_offset;
1102
+    $v_size = @ftell($this->_zip_fd) - $v_offset;
1103 1103
 
1104 1104
     // ----- Create the central dir footer
1105 1105
     if (($v_result = $this->_writeCentralHeader($v_count, $v_size, $v_offset,
@@ -1139,14 +1139,14 @@  discard block
 block discarded – undo
1139 1139
                         $p_add_dir, $p_remove_dir, $p_remove_all_dir,
1140 1140
                         &$p_params)
1141 1141
   {
1142
-      $v_result=1;
1142
+      $v_result = 1;
1143 1143
       $v_header = array();
1144 1144
 
1145 1145
     // ----- Recuperate the current number of elt in list
1146 1146
     $v_nb = count($p_result_list);
1147 1147
 
1148 1148
     // ----- Loop on the files
1149
-    for ($j=0; ($j<count($p_list)) && ($v_result==1); $j++) {
1149
+    for ($j = 0; ($j < count($p_list)) && ($v_result == 1); $j++) {
1150 1150
         // ----- Recuperate the filename
1151 1151
       $p_filename = $this->_tool_TranslateWinPath($p_list[$j], false);
1152 1152
 
@@ -1179,7 +1179,7 @@  discard block
 block discarded – undo
1179 1179
 
1180 1180
         // ----- Look for path
1181 1181
         if ($p_filename != '.') {
1182
-            $v_path = $p_filename . '/';
1182
+            $v_path = $p_filename.'/';
1183 1183
         } else {
1184 1184
             $v_path = '';
1185 1185
         }
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
   */
1239 1239
   public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_params)
1240 1240
   {
1241
-      $v_result=1;
1241
+      $v_result = 1;
1242 1242
 
1243 1243
       if ($p_filename == '') {
1244 1244
           // ----- Error log
@@ -1263,7 +1263,7 @@  discard block
 block discarded – undo
1263 1263
 
1264 1264
         if ((substr($p_filename, 0, 2) == './') || (substr($p_remove_dir, 0, 2) == './')) {
1265 1265
             if ((substr($p_filename, 0, 2) == './') && (substr($p_remove_dir, 0, 2) != './')) {
1266
-                $p_remove_dir = './' . $p_remove_dir;
1266
+                $p_remove_dir = './'.$p_remove_dir;
1267 1267
             }
1268 1268
             if ((substr($p_filename, 0, 2) != './') && (substr($p_remove_dir, 0, 2) == './')) {
1269 1269
                 $p_remove_dir = substr($p_remove_dir, 2);
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
         if (substr($p_add_dir, -1) == '/') {
1288 1288
             $v_stored_filename = $p_add_dir.$v_stored_filename;
1289 1289
         } else {
1290
-            $v_stored_filename = $p_add_dir . '/' . $v_stored_filename;
1290
+            $v_stored_filename = $p_add_dir.'/'.$v_stored_filename;
1291 1291
         }
1292 1292
     }
1293 1293
 
@@ -1322,7 +1322,7 @@  discard block
 block discarded – undo
1322 1322
       $p_header['comment_len'] = 0;
1323 1323
       $p_header['disk'] = 0;
1324 1324
       $p_header['internal'] = 0;
1325
-      $p_header['external'] = (is_file($p_filename)?0xFE49FFE0:0x41FF0010);
1325
+      $p_header['external'] = (is_file($p_filename) ? 0xFE49FFE0 : 0x41FF0010);
1326 1326
       $p_header['offset'] = 0;
1327 1327
       $p_header['filename'] = $p_filename;
1328 1328
       $p_header['stored_filename'] = $v_stored_filename;
@@ -1418,7 +1418,7 @@  discard block
 block discarded – undo
1418 1418
         $p_header['filename'] .= '/';
1419 1419
           $p_header['filename_len']++;
1420 1420
           $p_header['size'] = 0;
1421
-          $p_header['external'] = 0x41FF0010;   // Value for a folder : to be checked
1421
+          $p_header['external'] = 0x41FF0010; // Value for a folder : to be checked
1422 1422
 
1423 1423
         // ----- Call the header generation
1424 1424
         if (($v_result = $this->_writeFileHeader($p_header)) != 1) {
@@ -1467,7 +1467,7 @@  discard block
 block discarded – undo
1467 1467
   */
1468 1468
   public function _writeFileHeader(&$p_header)
1469 1469
   {
1470
-      $v_result=1;
1470
+      $v_result = 1;
1471 1471
 
1472 1472
     // TBC
1473 1473
     //for(reset($p_header); $key = key($p_header); next($p_header)) {
@@ -1478,8 +1478,8 @@  discard block
 block discarded – undo
1478 1478
 
1479 1479
     // ----- Transform UNIX mtime to DOS format mdate/mtime
1480 1480
     $v_date = getdate($p_header['mtime']);
1481
-      $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
1482
-      $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
1481
+      $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2;
1482
+      $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday'];
1483 1483
 
1484 1484
     // ----- Packed data
1485 1485
     $v_binary_data = pack('VvvvvvVVVvv', 0x04034b50, $p_header['version'], $p_header['flag'],
@@ -1517,7 +1517,7 @@  discard block
 block discarded – undo
1517 1517
   */
1518 1518
   public function _writeCentralFileHeader(&$p_header)
1519 1519
   {
1520
-      $v_result=1;
1520
+      $v_result = 1;
1521 1521
 
1522 1522
     // TBC
1523 1523
     //for(reset($p_header); $key = key($p_header); next($p_header)) {
@@ -1525,8 +1525,8 @@  discard block
 block discarded – undo
1525 1525
 
1526 1526
     // ----- Transform UNIX mtime to DOS format mdate/mtime
1527 1527
     $v_date = getdate($p_header['mtime']);
1528
-      $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
1529
-      $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
1528
+      $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2;
1529
+      $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday'];
1530 1530
 
1531 1531
     // ----- Packed data
1532 1532
     $v_binary_data = pack('VvvvvvvVVVvvvvvVV', 0x02014b50, $p_header['version'], $p_header['version_extracted'],
@@ -1568,7 +1568,7 @@  discard block
 block discarded – undo
1568 1568
   */
1569 1569
   public function _writeCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment)
1570 1570
   {
1571
-      $v_result=1;
1571
+      $v_result = 1;
1572 1572
 
1573 1573
     // ----- Packed data
1574 1574
     $v_binary_data = pack('VvvvvVVv', 0x06054b50, 0, 0, $p_nb_entries, $p_nb_entries, $p_size, $p_offset, strlen($p_comment));
@@ -1600,7 +1600,7 @@  discard block
 block discarded – undo
1600 1600
   */
1601 1601
   public function _list(&$p_list)
1602 1602
   {
1603
-      $v_result=1;
1603
+      $v_result = 1;
1604 1604
 
1605 1605
     // ----- Open the zip file
1606 1606
     if (($this->_zip_fd = @fopen($this->_zipname, 'rb')) == 0) {
@@ -1628,7 +1628,7 @@  discard block
 block discarded – undo
1628 1628
       }
1629 1629
 
1630 1630
     // ----- Read each entry
1631
-    for ($i=0; $i<$v_central_dir['entries']; $i++) {
1631
+    for ($i = 0; $i < $v_central_dir['entries']; $i++) {
1632 1632
         // ----- Read the file header
1633 1633
       if (($v_result = $this->_readCentralFileHeader($v_header)) != 1) {
1634 1634
           return $v_result;
@@ -1674,7 +1674,7 @@  discard block
 block discarded – undo
1674 1674
   */
1675 1675
   public function _convertHeader2FileInfo($p_header, &$p_info)
1676 1676
   {
1677
-      $v_result=1;
1677
+      $v_result = 1;
1678 1678
 
1679 1679
     // ----- Get the interesting attributes
1680 1680
     $p_info['filename'] = $p_header['filename'];
@@ -1683,7 +1683,7 @@  discard block
 block discarded – undo
1683 1683
       $p_info['compressed_size'] = $p_header['compressed_size'];
1684 1684
       $p_info['mtime'] = $p_header['mtime'];
1685 1685
       $p_info['comment'] = $p_header['comment'];
1686
-      $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010);
1686
+      $p_info['folder'] = (($p_header['external'] & 0x00000010) == 0x00000010);
1687 1687
       $p_info['index'] = $p_header['index'];
1688 1688
       $p_info['status'] = $p_header['status'];
1689 1689
 
@@ -1716,7 +1716,7 @@  discard block
 block discarded – undo
1716 1716
   */
1717 1717
   public function _extractByRule(&$p_file_list, &$p_params)
1718 1718
   {
1719
-      $v_result=1;
1719
+      $v_result = 1;
1720 1720
 
1721 1721
       $p_path = $p_params['add_path'];
1722 1722
       $p_remove_path = $p_params['remove_path'];
@@ -1726,14 +1726,14 @@  discard block
 block discarded – undo
1726 1726
     if (($p_path == '')
1727 1727
         || ((substr($p_path, 0, 1) != '/')
1728 1728
         && (substr($p_path, 0, 3) != '../') && (substr($p_path, 1, 2) != ':/'))) {
1729
-        $p_path = './' . $p_path;
1729
+        $p_path = './'.$p_path;
1730 1730
     }
1731 1731
 
1732 1732
     // ----- Reduce the path last (and duplicated) '/'
1733 1733
     if (($p_path != './') && ($p_path != '/')) {
1734 1734
         // ----- Look for the path end '/'
1735 1735
       while (substr($p_path, -1) == '/') {
1736
-          $p_path = substr($p_path, 0, strlen($p_path)-1);
1736
+          $p_path = substr($p_path, 0, strlen($p_path) - 1);
1737 1737
       }
1738 1738
     }
1739 1739
 
@@ -1762,7 +1762,7 @@  discard block
 block discarded – undo
1762 1762
 
1763 1763
     // ----- Read each entry
1764 1764
     $j_start = 0;
1765
-      for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) {
1765
+      for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++) {
1766 1766
           // ----- Read next Central dir entry
1767 1767
       @rewind($this->_zip_fd);
1768 1768
           if (@fseek($this->_zip_fd, $v_pos_entry)) {
@@ -1796,7 +1796,7 @@  discard block
 block discarded – undo
1796 1796
           && ($p_params[ARCHIVE_ZIP_PARAM_BY_NAME] != 0)) {
1797 1797
 
1798 1798
           // ----- Look if the filename is in the list
1799
-          for ($j=0;
1799
+          for ($j = 0;
1800 1800
                   ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_NAME]))
1801 1801
                && (!$v_extract);
1802 1802
                $j++) {
@@ -1838,15 +1838,15 @@  discard block
 block discarded – undo
1838 1838
               && ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX] != 0)) {
1839 1839
 
1840 1840
           // ----- Look if the index is in the list
1841
-          for ($j=$j_start; ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) && (!$v_extract); $j++) {
1842
-              if (($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']) && ($i<=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) {
1841
+          for ($j = $j_start; ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX])) && (!$v_extract); $j++) {
1842
+              if (($i >= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']) && ($i <= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) {
1843 1843
                   $v_extract = true;
1844 1844
               }
1845
-              if ($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) {
1846
-                  $j_start = $j+1;
1845
+              if ($i >= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) {
1846
+                  $j_start = $j + 1;
1847 1847
               }
1848 1848
 
1849
-              if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']>$i) {
1849
+              if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start'] > $i) {
1850 1850
                   break;
1851 1851
               }
1852 1852
           }
@@ -1940,7 +1940,7 @@  discard block
 block discarded – undo
1940 1940
   */
1941 1941
   public function _extractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_params)
1942 1942
   {
1943
-      $v_result=1;
1943
+      $v_result = 1;
1944 1944
 
1945 1945
     // ----- Read the file header
1946 1946
     if (($v_result = $this->_readFileHeader($v_header)) != 1) {
@@ -1980,7 +1980,7 @@  discard block
 block discarded – undo
1980 1980
 
1981 1981
     // ----- Add the path
1982 1982
     if ($p_path != '') {
1983
-        $p_entry['filename'] = $p_path . '/' . $p_entry['filename'];
1983
+        $p_entry['filename'] = $p_path.'/'.$p_entry['filename'];
1984 1984
     }
1985 1985
 
1986 1986
     // ----- Look for pre-extract callback
@@ -2046,7 +2046,7 @@  discard block
 block discarded – undo
2046 2046
 
2047 2047
     // ----- Check the directory availability and create it if necessary
2048 2048
     else {
2049
-        if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/')) {
2049
+        if ((($p_entry['external'] & 0x00000010) == 0x00000010) || (substr($p_entry['filename'], -1) == '/')) {
2050 2050
             $v_dir_to_check = $p_entry['filename'];
2051 2051
         } elseif (!strstr($p_entry['filename'], '/')) {
2052 2052
             $v_dir_to_check = '';
@@ -2070,7 +2070,7 @@  discard block
 block discarded – undo
2070 2070
     if ($p_entry['status'] == 'ok') {
2071 2071
 
2072 2072
       // ----- Do the extraction (if not a folder)
2073
-      if (!(($p_entry['external']&0x00000010)==0x00000010)) {
2073
+      if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) {
2074 2074
 
2075 2075
         // ----- Look for not compressed file
2076 2076
         if ($p_entry['compressed_size'] == $p_entry['size']) {
@@ -2175,7 +2175,7 @@  discard block
 block discarded – undo
2175 2175
   */
2176 2176
   public function _extractFileAsString(&$p_entry, &$p_string)
2177 2177
   {
2178
-      $v_result=1;
2178
+      $v_result = 1;
2179 2179
 
2180 2180
     // ----- Read the file header
2181 2181
     $v_header = array();
@@ -2191,7 +2191,7 @@  discard block
 block discarded – undo
2191 2191
     // ----- Trace
2192 2192
 
2193 2193
     // ----- Do the extraction (if not a folder)
2194
-    if (!(($p_entry['external']&0x00000010)==0x00000010)) {
2194
+    if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) {
2195 2195
         // ----- Look for not compressed file
2196 2196
       if ($p_entry['compressed_size'] == $p_entry['size']) {
2197 2197
           // ----- Trace
@@ -2232,7 +2232,7 @@  discard block
 block discarded – undo
2232 2232
   */
2233 2233
   public function _readFileHeader(&$p_header)
2234 2234
   {
2235
-      $v_result=1;
2235
+      $v_result = 1;
2236 2236
 
2237 2237
     // ----- Read the 4 bytes signature
2238 2238
     $v_binary_data = @fread($this->_zip_fd, 4);
@@ -2257,7 +2257,7 @@  discard block
 block discarded – undo
2257 2257
         $p_header['status'] = 'invalid_header';
2258 2258
 
2259 2259
       // ----- Error log
2260
-      $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : ' . strlen($v_binary_data));
2260
+      $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : '.strlen($v_binary_data));
2261 2261
 
2262 2262
       // ----- Return
2263 2263
       return Archive_Zip::errorCode();
@@ -2290,7 +2290,7 @@  discard block
 block discarded – undo
2290 2290
           // ----- Extract time
2291 2291
       $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
2292 2292
           $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
2293
-          $v_seconde = ($p_header['mtime'] & 0x001F)*2;
2293
+          $v_seconde = ($p_header['mtime'] & 0x001F) * 2;
2294 2294
 
2295 2295
       // ----- Extract date
2296 2296
       $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
@@ -2334,7 +2334,7 @@  discard block
 block discarded – undo
2334 2334
   */
2335 2335
   public function _readCentralFileHeader(&$p_header)
2336 2336
   {
2337
-      $v_result=1;
2337
+      $v_result = 1;
2338 2338
 
2339 2339
     // ----- Read the 4 bytes signature
2340 2340
     $v_binary_data = @fread($this->_zip_fd, 4);
@@ -2359,7 +2359,7 @@  discard block
 block discarded – undo
2359 2359
         $p_header['status'] = 'invalid_header';
2360 2360
 
2361 2361
       // ----- Error log
2362
-      $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : ' . strlen($v_binary_data));
2362
+      $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT, 'Invalid block size : '.strlen($v_binary_data));
2363 2363
 
2364 2364
       // ----- Return
2365 2365
       return Archive_Zip::errorCode();
@@ -2396,7 +2396,7 @@  discard block
 block discarded – undo
2396 2396
         // ----- Extract time
2397 2397
       $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
2398 2398
         $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
2399
-        $v_seconde = ($p_header['mtime'] & 0x001F)*2;
2399
+        $v_seconde = ($p_header['mtime'] & 0x001F) * 2;
2400 2400
 
2401 2401
       // ----- Extract date
2402 2402
       $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
@@ -2440,7 +2440,7 @@  discard block
 block discarded – undo
2440 2440
   */
2441 2441
   public function _readEndCentralDir(&$p_central_dir)
2442 2442
   {
2443
-      $v_result=1;
2443
+      $v_result = 1;
2444 2444
 
2445 2445
     // ----- Go to the end of the zip file
2446 2446
     $v_size = filesize($this->_zipname);
@@ -2457,8 +2457,8 @@  discard block
 block discarded – undo
2457 2457
     // in this case the end of central dir is at 22 bytes of the file end
2458 2458
     $v_found = 0;
2459 2459
       if ($v_size > 26) {
2460
-          @fseek($this->_zip_fd, $v_size-22);
2461
-          if (($v_pos = @ftell($this->_zip_fd)) != ($v_size-22)) {
2460
+          @fseek($this->_zip_fd, $v_size - 22);
2461
+          if (($v_pos = @ftell($this->_zip_fd)) != ($v_size - 22)) {
2462 2462
               $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT,
2463 2463
                          'Unable to seek back to the middle of the archive \''
2464 2464
                          .$this->_zipname.'\'');
@@ -2483,8 +2483,8 @@  discard block
 block discarded – undo
2483 2483
       if ($v_maximum_size > $v_size) {
2484 2484
           $v_maximum_size = $v_size;
2485 2485
       }
2486
-        @fseek($this->_zip_fd, $v_size-$v_maximum_size);
2487
-        if (@ftell($this->_zip_fd) != ($v_size-$v_maximum_size)) {
2486
+        @fseek($this->_zip_fd, $v_size - $v_maximum_size);
2487
+        if (@ftell($this->_zip_fd) != ($v_size - $v_maximum_size)) {
2488 2488
             $this->_errorLog(ARCHIVE_ZIP_ERR_BAD_FORMAT,
2489 2489
                          'Unable to seek back to the middle of the archive \''
2490 2490
                          .$this->_zipname.'\'');
@@ -2570,11 +2570,11 @@  discard block
 block discarded – undo
2570 2570
   */
2571 2571
   public function _deleteByRule(&$p_result_list, &$p_params)
2572 2572
   {
2573
-      $v_result=1;
2573
+      $v_result = 1;
2574 2574
       $v_list_detail = array();
2575 2575
 
2576 2576
     // ----- Open the zip file
2577
-    if (($v_result=$this->_openFd('rb')) != 1) {
2577
+    if (($v_result = $this->_openFd('rb')) != 1) {
2578 2578
         // ----- Return
2579 2579
       return $v_result;
2580 2580
     }
@@ -2605,7 +2605,7 @@  discard block
 block discarded – undo
2605 2605
     // ----- Read each entry
2606 2606
     $v_header_list = array();
2607 2607
       $j_start = 0;
2608
-      for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) {
2608
+      for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++) {
2609 2609
 
2610 2610
       // ----- Read the file header
2611 2611
       $v_header_list[$v_nb_extracted] = array();
@@ -2629,7 +2629,7 @@  discard block
 block discarded – undo
2629 2629
           && ($p_params[ARCHIVE_ZIP_PARAM_BY_NAME] != 0)) {
2630 2630
 
2631 2631
           // ----- Look if the filename is in the list
2632
-          for ($j=0;
2632
+          for ($j = 0;
2633 2633
                ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_NAME]))
2634 2634
                  && (!$v_found);
2635 2635
                $j++) {
@@ -2641,7 +2641,7 @@  discard block
 block discarded – undo
2641 2641
                   if ((strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j]))
2642 2642
                       && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) == $p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) {
2643 2643
                       $v_found = true;
2644
-                  } elseif ((($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */
2644
+                  } elseif ((($v_header_list[$v_nb_extracted]['external'] & 0x00000010) == 0x00000010) /* Indicates a folder */
2645 2645
                           && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_params[ARCHIVE_ZIP_PARAM_BY_NAME][$j])) {
2646 2646
                       $v_found = true;
2647 2647
                   }
@@ -2677,19 +2677,19 @@  discard block
 block discarded – undo
2677 2677
               && ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX] != 0)) {
2678 2678
 
2679 2679
           // ----- Look if the index is in the list
2680
-          for ($j=$j_start;
2680
+          for ($j = $j_start;
2681 2681
                ($j < count($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX]))
2682 2682
                  && (!$v_found);
2683 2683
                $j++) {
2684
-              if (($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start'])
2685
-                  && ($i<=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) {
2684
+              if (($i >= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start'])
2685
+                  && ($i <= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end'])) {
2686 2686
                   $v_found = true;
2687 2687
               }
2688
-              if ($i>=$p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) {
2689
-                  $j_start = $j+1;
2688
+              if ($i >= $p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['end']) {
2689
+                  $j_start = $j + 1;
2690 2690
               }
2691 2691
 
2692
-              if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start']>$i) {
2692
+              if ($p_params[ARCHIVE_ZIP_PARAM_BY_INDEX][$j]['start'] > $i) {
2693 2693
                   break;
2694 2694
               }
2695 2695
           }
@@ -2722,7 +2722,7 @@  discard block
 block discarded – undo
2722 2722
         }
2723 2723
 
2724 2724
         // ----- Look which file need to be kept
2725
-        for ($i=0; $i < count($v_header_list); $i++) {
2725
+        for ($i = 0; $i < count($v_header_list); $i++) {
2726 2726
 
2727 2727
             // ----- Calculate the position of the header
2728 2728
             @rewind($this->_zip_fd);
@@ -2776,9 +2776,9 @@  discard block
 block discarded – undo
2776 2776
         $v_offset = @ftell($v_temp_zip->_zip_fd);
2777 2777
 
2778 2778
         // ----- Re-Create the Central Dir files header
2779
-        for ($i=0; $i < count($v_header_list); $i++) {
2779
+        for ($i = 0; $i < count($v_header_list); $i++) {
2780 2780
             // ----- Create the file header
2781
-            $v_result=$v_temp_zip->_writeCentralFileHeader($v_header_list[$i]);
2781
+            $v_result = $v_temp_zip->_writeCentralFileHeader($v_header_list[$i]);
2782 2782
             if ($v_result != 1) {
2783 2783
                 // ----- Clean
2784 2784
                 $v_temp_zip->_closeFd();
@@ -2798,7 +2798,7 @@  discard block
 block discarded – undo
2798 2798
         $v_comment = '';
2799 2799
 
2800 2800
         // ----- Calculate the size of the central header
2801
-        $v_size = @ftell($v_temp_zip->_zip_fd)-$v_offset;
2801
+        $v_size = @ftell($v_temp_zip->_zip_fd) - $v_offset;
2802 2802
 
2803 2803
         // ----- Create the central dir footer
2804 2804
         $v_result = $v_temp_zip->_writeCentralHeader(count($v_header_list),
@@ -2854,13 +2854,13 @@  discard block
 block discarded – undo
2854 2854
   *
2855 2855
   * @param [type] $p_is_dir
2856 2856
   */
2857
-  public function _dirCheck($p_dir, $p_is_dir=false)
2857
+  public function _dirCheck($p_dir, $p_is_dir = false)
2858 2858
   {
2859 2859
       $v_result = 1;
2860 2860
 
2861 2861
     // ----- Remove the final '/'
2862 2862
     if ($p_is_dir && (substr($p_dir, -1) == '/')) {
2863
-        $p_dir = substr($p_dir, 0, strlen($p_dir)-1);
2863
+        $p_dir = substr($p_dir, 0, strlen($p_dir) - 1);
2864 2864
     }
2865 2865
 
2866 2866
     // ----- Check the directory availability
@@ -2908,7 +2908,7 @@  discard block
 block discarded – undo
2908 2908
   */
2909 2909
   public function _merge(&$p_archive_to_add)
2910 2910
   {
2911
-      $v_result=1;
2911
+      $v_result = 1;
2912 2912
 
2913 2913
     // ----- Look if the archive_to_add exists
2914 2914
     if (!is_file($p_archive_to_add->_zipname)) {
@@ -2925,7 +2925,7 @@  discard block
 block discarded – undo
2925 2925
     }
2926 2926
 
2927 2927
     // ----- Open the zip file
2928
-    if (($v_result=$this->_openFd('rb')) != 1) {
2928
+    if (($v_result = $this->_openFd('rb')) != 1) {
2929 2929
         return $v_result;
2930 2930
     }
2931 2931
 
@@ -2940,7 +2940,7 @@  discard block
 block discarded – undo
2940 2940
     @rewind($this->_zip_fd);
2941 2941
 
2942 2942
     // ----- Open the archive_to_add file
2943
-    if (($v_result=$p_archive_to_add->_openFd('rb')) != 1) {
2943
+    if (($v_result = $p_archive_to_add->_openFd('rb')) != 1) {
2944 2944
         $this->_closeFd();
2945 2945
         return $v_result;
2946 2946
     }
@@ -3020,7 +3020,7 @@  discard block
 block discarded – undo
3020 3020
     $v_comment = '';
3021 3021
 
3022 3022
     // ----- Calculate the size of the (new) central header
3023
-    $v_size = @ftell($v_zip_temp_fd)-$v_offset;
3023
+    $v_size = @ftell($v_zip_temp_fd) - $v_offset;
3024 3024
 
3025 3025
     // ----- Swap the file descriptor
3026 3026
     // Here is a trick : I swap the temporary fd with the zip fd, in order to use
@@ -3086,7 +3086,7 @@  discard block
 block discarded – undo
3086 3086
   */
3087 3087
   public function _duplicate($p_archive_filename)
3088 3088
   {
3089
-      $v_result=1;
3089
+      $v_result = 1;
3090 3090
 
3091 3091
     // ----- Look if the $p_archive_filename exists
3092 3092
     if (!is_file($p_archive_filename)) {
@@ -3099,7 +3099,7 @@  discard block
 block discarded – undo
3099 3099
     }
3100 3100
 
3101 3101
     // ----- Open the zip file
3102
-    if (($v_result=$this->_openFd('wb')) != 1) {
3102
+    if (($v_result = $this->_openFd('wb')) != 1) {
3103 3103
         // ----- Return
3104 3104
       return $v_result;
3105 3105
     }
@@ -3173,8 +3173,8 @@  discard block
 block discarded – undo
3173 3173
     // ----- Check specific parameters
3174 3174
     $v_callback_list = array('callback_pre_add', 'callback_post_add',
3175 3175
                               'callback_pre_extract', 'callback_post_extract');
3176
-      for ($i=0; $i < count($v_callback_list); $i++) {
3177
-          $v_key=$v_callback_list[$i];
3176
+      for ($i = 0; $i < count($v_callback_list); $i++) {
3177
+          $v_key = $v_callback_list[$i];
3178 3178
           if (isset($p_params[$v_key]) && ($p_params[$v_key] != '')) {
3179 3179
               if (!function_exists($p_params[$v_key])) {
3180 3180
                   $this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAM_VALUE,
@@ -3203,7 +3203,7 @@  discard block
 block discarded – undo
3203 3203
   * @param integer $p_error_code
3204 3204
   * @param string $p_error_string
3205 3205
   */
3206
-  public function _errorLog($p_error_code=0, $p_error_string='')
3206
+  public function _errorLog($p_error_code = 0, $p_error_string = '')
3207 3207
   {
3208 3208
       $this->_error_code = $p_error_code;
3209 3209
       $this->_error_string = $p_error_string;
@@ -3250,7 +3250,7 @@  discard block
 block discarded – undo
3250 3250
       $v_list = explode('/', $p_dir);
3251 3251
 
3252 3252
       // ----- Study directories from last to first
3253
-      for ($i= count($v_list) - 1; $i >= 0; $i--) {
3253
+      for ($i = count($v_list) - 1; $i >= 0; $i--) {
3254 3254
           // ----- Look for current path
3255 3255
         if ($v_list[$i] == '.') {
3256 3256
             // ----- Ignore this directory
@@ -3262,7 +3262,7 @@  discard block
 block discarded – undo
3262 3262
             // ----- Ignore only the double '//' in path,
3263 3263
           // but not the first and last '/'
3264 3264
         } else {
3265
-            $v_result = $v_list[$i].($i!=(count($v_list) - 1)? '/' . $v_result: '');
3265
+            $v_result = $v_list[$i].($i != (count($v_list) - 1) ? '/'.$v_result : '');
3266 3266
         }
3267 3267
       }
3268 3268
     }
@@ -3372,11 +3372,11 @@  discard block
 block discarded – undo
3372 3372
   *
3373 3373
   * @param integer $p_mode
3374 3374
   */
3375
-  public function _tool_CopyBlock($p_src, $p_dest, $p_size, $p_mode=0)
3375
+  public function _tool_CopyBlock($p_src, $p_dest, $p_size, $p_mode = 0)
3376 3376
   {
3377 3377
       $v_result = 1;
3378 3378
 
3379
-      if ($p_mode==0) {
3379
+      if ($p_mode == 0) {
3380 3380
           while ($p_size != 0) {
3381 3381
               $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
3382 3382
                         ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE);
@@ -3384,7 +3384,7 @@  discard block
 block discarded – undo
3384 3384
               @fwrite($p_dest, $v_buffer, $v_read_size);
3385 3385
               $p_size -= $v_read_size;
3386 3386
           }
3387
-      } elseif ($p_mode==1) {
3387
+      } elseif ($p_mode == 1) {
3388 3388
           while ($p_size != 0) {
3389 3389
               $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
3390 3390
                         ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE);
@@ -3392,7 +3392,7 @@  discard block
 block discarded – undo
3392 3392
               @fwrite($p_dest, $v_buffer, $v_read_size);
3393 3393
               $p_size -= $v_read_size;
3394 3394
           }
3395
-      } elseif ($p_mode==2) {
3395
+      } elseif ($p_mode == 2) {
3396 3396
           while ($p_size != 0) {
3397 3397
               $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
3398 3398
                         ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE);
@@ -3400,7 +3400,7 @@  discard block
 block discarded – undo
3400 3400
               @gzwrite($p_dest, $v_buffer, $v_read_size);
3401 3401
               $p_size -= $v_read_size;
3402 3402
           }
3403
-      } elseif ($p_mode==3) {
3403
+      } elseif ($p_mode == 3) {
3404 3404
           while ($p_size != 0) {
3405 3405
               $v_read_size = ($p_size < ARCHIVE_ZIP_READ_BLOCK_SIZE
3406 3406
                         ? $p_size : ARCHIVE_ZIP_READ_BLOCK_SIZE);
@@ -3471,13 +3471,13 @@  discard block
 block discarded – undo
3471 3471
   *
3472 3472
   * @param [type] $p_remove_disk_letter
3473 3473
   */
3474
-  public function _tool_TranslateWinPath($p_path, $p_remove_disk_letter=true)
3474
+  public function _tool_TranslateWinPath($p_path, $p_remove_disk_letter = true)
3475 3475
   {
3476 3476
       if (stristr(php_uname(), 'windows')) {
3477 3477
           // ----- Look for potential disk letter
3478 3478
       if ($p_remove_disk_letter
3479 3479
           && (($v_position = strpos($p_path, ':')) != false)) {
3480
-          $p_path = substr($p_path, $v_position+1);
3480
+          $p_path = substr($p_path, $v_position + 1);
3481 3481
       }
3482 3482
       // ----- Change potential windows directory separator
3483 3483
       if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0, 1) == '\\')) {
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/include/mygrouppermform.php 2 patches
Doc Comments   +10 added lines patch added patch discarded remove patch
@@ -70,6 +70,12 @@  discard block
 block discarded – undo
70 70
      */
71 71
 //HACK by domifara
72 72
 //  public function MyXoopsGroupPermForm($title, $modid, $permname, $permdesc)
73
+    /**
74
+     * @param string $title
75
+     * @param integer $modid
76
+     * @param string $permname
77
+     * @param string $permdesc
78
+     */
73 79
     public function __construct($title, $modid, $permname, $permdesc)
74 80
     {
75 81
         //      $this->XoopsForm($title, 'groupperm_form', XOOPS_URL.'/modules/system/admin/groupperm.php', 'post'); GIJ
@@ -100,6 +106,9 @@  discard block
 block discarded – undo
100 106
      * Add appendix
101 107
      *
102 108
      * @access public
109
+     * @param string $permName
110
+     * @param integer $itemId
111
+     * @param string $itemName
103 112
      */
104 113
     public function addAppendix($permName, $itemId, $itemName)
105 114
     {
@@ -239,6 +248,7 @@  discard block
 block discarded – undo
239 248
 
240 249
     /**
241 250
      * Constructor
251
+     * @param string $name
242 252
      */
243 253
     public function __construct($caption, $name, $groupId, $values = null)
244 254
     {
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
  * @author       XOOPS Development Team, Kazumi Ono (AKA onokazu)
18 18
  */
19 19
 
20
-if (! defined('XOOPS_ROOT_PATH')) {
21
-    exit ;
20
+if (!defined('XOOPS_ROOT_PATH')) {
21
+    exit;
22 22
 }
23 23
 
24 24
 require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelement.php';
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      * Tree structure of items
49 49
      * @var array
50 50
      */
51
-    public $_itemTree = array() ;
51
+    public $_itemTree = array();
52 52
     /**
53 53
      * Name of permission
54 54
      * @var string
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      * Appendix
64 64
      * @var array ('permname'=>,'itemid'=>,'itemname'=>,'selected'=>)
65 65
      */
66
-    public $_appendix = array() ;
66
+    public $_appendix = array();
67 67
 
68 68
     /**
69 69
      * Constructor
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public function addAppendix($permName, $itemId, $itemName)
105 105
     {
106
-        $this->_appendix[] = array('permname'=>$permName,'itemid'=>$itemId,'itemname'=>$itemName,'selected'=>false);
106
+        $this->_appendix[] = array('permname'=>$permName, 'itemid'=>$itemId, 'itemname'=>$itemName, 'selected'=>false);
107 107
     }
108 108
 
109 109
     /**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public function render()
139 139
     {
140
-        global $xoopsGTicket ;
140
+        global $xoopsGTicket;
141 141
 
142 142
         // load all child ids for javascript codes
143 143
         foreach (array_keys($this->_itemTree) as $item_id) {
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
             $ele->setOptionTree($this->_itemTree);
155 155
 
156 156
             // GIJ start
157
-            $ele->setDescription('<input type="checkbox" onclick="with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].name.match(/^perms\[(module_admin|module_read|block_read)\]\[groups\]\['.$i.'\]/)){elements[i].checked=this.checked;}}};">') ;
157
+            $ele->setDescription('<input type="checkbox" onclick="with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].name.match(/^perms\[(module_admin|module_read|block_read)\]\[groups\]\['.$i.'\]/)){elements[i].checked=this.checked;}}};">');
158 158
             // GIJ_end
159 159
 
160 160
             foreach ($this->_appendix as $key => $append) {
161
-                $this->_appendix[$key]['selected'] = $gperm_handler->checkRight($append['permname'], $append['itemid'], $i, $this->_modid) ;
161
+                $this->_appendix[$key]['selected'] = $gperm_handler->checkRight($append['permname'], $append['itemid'], $i, $this->_modid);
162 162
             }
163 163
             $ele->setAppendix($this->_appendix);
164 164
             $this->addElement($ele);
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
         // GIJ start
169 169
         $jstray = new XoopsFormElementTray(' &nbsp; ');
170 170
         $jsuncheckbutton = new XoopsFormButton('', 'none', _NONE, 'button');
171
-        $jsuncheckbutton->setExtra("onclick=\"with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].type=='checkbox'){elements[i].checked=false;}}}\"") ;
171
+        $jsuncheckbutton->setExtra("onclick=\"with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].type=='checkbox'){elements[i].checked=false;}}}\"");
172 172
         $jscheckbutton = new XoopsFormButton('', 'all', _ALL, 'button');
173
-        $jscheckbutton->setExtra("onclick=\"with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].type=='checkbox' && (elements[i].name.indexOf('module_admin')<0 || elements[i].name.indexOf('[groups][1]')>=0)){elements[i].checked=true;}}}\"") ;
174
-        $jstray->addElement($jsuncheckbutton) ;
175
-        $jstray->addElement($jscheckbutton) ;
173
+        $jscheckbutton->setExtra("onclick=\"with(document.groupperm_form){for(i=0;i<length;i++){if(elements[i].type=='checkbox' && (elements[i].name.indexOf('module_admin')<0 || elements[i].name.indexOf('[groups][1]')>=0)){elements[i].checked=true;}}}\"");
174
+        $jstray->addElement($jsuncheckbutton);
175
+        $jstray->addElement($jscheckbutton);
176 176
         $this->addElement($jstray);
177 177
         // GIJ end
178 178
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
         $ret = '<h4>'.$this->getTitle().'</h4>'.$this->_permDesc.'<br />';
185 185
         $ret .= "<form name='".$this->getName()."' id='".$this->getName()."' action='".$this->getAction()."' method='".$this->getMethod()."'".$this->getExtra().">\n<table width='100%' class='outer' cellspacing='1'>\n";
186
-        $elements =& $this->getElements();
186
+        $elements = & $this->getElements();
187 187
         foreach (array_keys($elements) as $i) {
188 188
             if (!is_object($elements[$i])) {
189 189
                 $ret .= $elements[$i];
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
                 $ret .= $elements[$i]->render();
200 200
             }
201 201
         }
202
-        $ret .= '</table>' . $xoopsGTicket->getTicketHtml(__LINE__, 1800, 'myblocksadmin') . '</form>';
202
+        $ret .= '</table>'.$xoopsGTicket->getTicketHtml(__LINE__, 1800, 'myblocksadmin').'</form>';
203 203
         return $ret;
204 204
     }
205 205
 }
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      * Appendix
236 236
      * @var array ('permname'=>,'itemid'=>,'itemname'=>,'selected'=>)
237 237
      */
238
-    public $_appendix = array() ;
238
+    public $_appendix = array();
239 239
 
240 240
     /**
241 241
      * Constructor
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
      */
286 286
     public function setAppendix($appendix)
287 287
     {
288
-        $this->_appendix = $appendix ;
288
+        $this->_appendix = $appendix;
289 289
     }
290 290
 
291 291
     /**
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
      */
297 297
     public function render()
298 298
     {
299
-        $ret = '' ;
299
+        $ret = '';
300 300
 
301 301
         if (count($this->_appendix) > 0) {
302 302
             $ret .= '<table class="outer"><tr>';
@@ -306,11 +306,11 @@  discard block
 block discarded – undo
306 306
                     $ret .= '</tr><tr>';
307 307
                     $cols = 1;
308 308
                 }
309
-                $checked = $append['selected'] ? 'checked="checked"' : '' ;
310
-                $name = 'perms['.$append['permname'].']' ;
311
-                $itemid = $append['itemid'] ;
312
-                $itemid = $append['itemid'] ;
313
-                $ret .= "<td class=\"odd\"><input type=\"checkbox\" name=\"{$name}[groups][$this->_groupId][$itemid]\" id=\"{$name}[groups][$this->_groupId][$itemid]\" value=\"1\" $checked />{$append['itemname']}<input type=\"hidden\" name=\"{$name}[parents][$itemid]\" value=\"\" /><input type=\"hidden\" name=\"{$name}[itemname][$itemid]\" value=\"{$append['itemname']}\" /><br /></td>" ;
309
+                $checked = $append['selected'] ? 'checked="checked"' : '';
310
+                $name = 'perms['.$append['permname'].']';
311
+                $itemid = $append['itemid'];
312
+                $itemid = $append['itemid'];
313
+                $ret .= "<td class=\"odd\"><input type=\"checkbox\" name=\"{$name}[groups][$this->_groupId][$itemid]\" id=\"{$name}[groups][$this->_groupId][$itemid]\" value=\"1\" $checked />{$append['itemname']}<input type=\"hidden\" name=\"{$name}[parents][$itemid]\" value=\"\" /><input type=\"hidden\" name=\"{$name}[itemname][$itemid]\" value=\"{$append['itemname']}\" /><br /></td>";
314 314
                 $cols++;
315 315
             }
316 316
             $ret .= '</tr></table>';
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 
319 319
         $ret .= '<table class="outer"><tr>';
320 320
         $cols = 1;
321
-        if (! empty($this->_optionTree[0]['children'])) {
321
+        if (!empty($this->_optionTree[0]['children'])) {
322 322
             foreach ($this->_optionTree[0]['children'] as $topitem) {
323 323
                 if ($cols > 4) {
324 324
                     $ret .= '</tr><tr>';
@@ -346,8 +346,8 @@  discard block
 block discarded – undo
346 346
      */
347 347
     public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = array())
348 348
     {
349
-        $tree .= $prefix."<input type=\"checkbox\" name=\"".$this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . "]\" id=\"" . $this->getName() . '[groups][' . $this->_groupId . ']['
350
-                 . $option['id'] . "]\" onclick=\"";
349
+        $tree .= $prefix."<input type=\"checkbox\" name=\"".$this->getName().'[groups]['.$this->_groupId.']['.$option['id']."]\" id=\"".$this->getName().'[groups]['.$this->_groupId.']['
350
+                 . $option['id']."]\" onclick=\"";
351 351
         // If there are parent elements, add javascript that will
352 352
         // make them selecteded when this element is checked to make
353 353
         // sure permissions to parent items are added as well.
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
         if (isset($this->_value) && in_array($option['id'], $this->_value)) {
368 368
             $tree .= ' checked="checked"';
369 369
         }
370
-        $tree .= ' />' . $option['name'] . "<input type=\"hidden\" name=\"" . $this->getName() . '[parents][' . $option['id'] . "]\" value=\"" . implode(':', $parentIds) . "\" /><input type=\"hidden\" name=\"" . $this->getName() . '[itemname]['
371
-                 . $option['id'] . "]\" value=\"" . htmlspecialchars($option['name']) . "\" /><br />\n";
370
+        $tree .= ' />'.$option['name']."<input type=\"hidden\" name=\"".$this->getName().'[parents]['.$option['id']."]\" value=\"".implode(':', $parentIds)."\" /><input type=\"hidden\" name=\"".$this->getName().'[itemname]['
371
+                 . $option['id']."]\" value=\"".htmlspecialchars($option['name'])."\" /><br />\n";
372 372
         if (isset($option['children'])) {
373 373
             foreach ($option['children'] as $child) {
374 374
                 array_push($parentIds, $option['id']);
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/compilehookadmin.php 1 patch
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -5,16 +5,16 @@  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' ;
8
+require_once __DIR__.'/class/AltsysBreadcrumbs.class.php';
9
+include_once __DIR__.'/include/gtickets.php';
10
+include_once __DIR__.'/include/altsys_functions.php';
11 11
 
12 12
 
13 13
 // this page can be called only from altsys
14 14
 // if( $xoopsModule->getVar('dirname') != 'altsys' ) die( 'this page can be called only from altsys' ) ;
15 15
 
16 16
 // language file
17
-altsys_include_language_file('compilehookadmin') ;
17
+altsys_include_language_file('compilehookadmin');
18 18
 
19 19
 //
20 20
 // DEFINITIONS
@@ -23,46 +23,46 @@  discard block
 block discarded – undo
23 23
 $compile_hooks = array(
24 24
 
25 25
     'enclosebycomment' => array(
26
-        'pre' => '<!-- begin altsys_tplsadmin %s -->' ,
27
-        'post' => '<!-- end altsys_tplsadmin %s -->' ,
28
-        'success_msg' => _TPLSADMIN_FMT_MSG_ENCLOSEBYCOMMENT ,
29
-        'dt' => _TPLSADMIN_DT_ENCLOSEBYCOMMENT ,
30
-        'dd' => _TPLSADMIN_DD_ENCLOSEBYCOMMENT ,
31
-        'conf_msg' => _TPLSADMIN_CNF_ENCLOSEBYCOMMENT ,
26
+        'pre' => '<!-- begin altsys_tplsadmin %s -->',
27
+        'post' => '<!-- end altsys_tplsadmin %s -->',
28
+        'success_msg' => _TPLSADMIN_FMT_MSG_ENCLOSEBYCOMMENT,
29
+        'dt' => _TPLSADMIN_DT_ENCLOSEBYCOMMENT,
30
+        'dd' => _TPLSADMIN_DD_ENCLOSEBYCOMMENT,
31
+        'conf_msg' => _TPLSADMIN_CNF_ENCLOSEBYCOMMENT,
32 32
         'skip_theme' => true
33
-    ) ,
33
+    ),
34 34
 
35 35
     'enclosebybordereddiv' => array(
36
-        'pre' => '<div class="altsys_tplsadmin_frame" style="border:1px solid black;word-wrap:break-word;">' ,
37
-        'post' => '<br /><a href="'.XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsform&amp;tpl_file=%1$s" style="color:red;">Edit:<br />%1$s</a></div>' ,
38
-        'success_msg' => _TPLSADMIN_FMT_MSG_ENCLOSEBYBORDEREDDIV ,
39
-        'dt' => _TPLSADMIN_DT_ENCLOSEBYBORDEREDDIV ,
40
-        'dd' => _TPLSADMIN_DD_ENCLOSEBYBORDEREDDIV ,
41
-        'conf_msg' => _TPLSADMIN_CNF_ENCLOSEBYBORDEREDDIV ,
36
+        'pre' => '<div class="altsys_tplsadmin_frame" style="border:1px solid black;word-wrap:break-word;">',
37
+        'post' => '<br /><a href="'.XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=mytplsform&amp;tpl_file=%1$s" style="color:red;">Edit:<br />%1$s</a></div>',
38
+        'success_msg' => _TPLSADMIN_FMT_MSG_ENCLOSEBYBORDEREDDIV,
39
+        'dt' => _TPLSADMIN_DT_ENCLOSEBYBORDEREDDIV,
40
+        'dd' => _TPLSADMIN_DD_ENCLOSEBYBORDEREDDIV,
41
+        'conf_msg' => _TPLSADMIN_CNF_ENCLOSEBYBORDEREDDIV,
42 42
         'skip_theme' => true
43
-    ) ,
43
+    ),
44 44
 
45 45
     'hooksavevars' => array(
46
-        'pre' => '<?php include_once "'.XOOPS_TRUST_PATH.'/libs/altsys/include/compilehook.inc.php" ; tplsadmin_save_tplsvars(\'%s\',$this) ; ?>' ,
47
-        'post' => '' ,
48
-        'success_msg' => _TPLSADMIN_FMT_MSG_HOOKSAVEVARS ,
49
-        'dt' => _TPLSADMIN_DT_HOOKSAVEVARS ,
50
-        'dd' => _TPLSADMIN_DD_HOOKSAVEVARS ,
51
-        'conf_msg' => _TPLSADMIN_CNF_HOOKSAVEVARS ,
46
+        'pre' => '<?php include_once "'.XOOPS_TRUST_PATH.'/libs/altsys/include/compilehook.inc.php" ; tplsadmin_save_tplsvars(\'%s\',$this) ; ?>',
47
+        'post' => '',
48
+        'success_msg' => _TPLSADMIN_FMT_MSG_HOOKSAVEVARS,
49
+        'dt' => _TPLSADMIN_DT_HOOKSAVEVARS,
50
+        'dd' => _TPLSADMIN_DD_HOOKSAVEVARS,
51
+        'conf_msg' => _TPLSADMIN_CNF_HOOKSAVEVARS,
52 52
         'skip_theme' => false
53
-    ) ,
53
+    ),
54 54
 
55 55
     'removehooks' => array(
56
-        'pre' => '' ,
57
-        'post' => '' ,
58
-        'success_msg' => _TPLSADMIN_FMT_MSG_REMOVEHOOKS ,
59
-        'dt' => _TPLSADMIN_DT_REMOVEHOOKS ,
60
-        'dd' => _TPLSADMIN_DD_REMOVEHOOKS ,
61
-        'conf_msg' => _TPLSADMIN_CNF_REMOVEHOOKS ,
56
+        'pre' => '',
57
+        'post' => '',
58
+        'success_msg' => _TPLSADMIN_FMT_MSG_REMOVEHOOKS,
59
+        'dt' => _TPLSADMIN_DT_REMOVEHOOKS,
60
+        'dd' => _TPLSADMIN_DD_REMOVEHOOKS,
61
+        'conf_msg' => _TPLSADMIN_CNF_REMOVEHOOKS,
62 62
         'skip_theme' => false
63 63
     )
64 64
 
65
-) ;
65
+);
66 66
 
67 67
 
68 68
 //
@@ -70,115 +70,115 @@  discard block
 block discarded – undo
70 70
 //
71 71
 
72 72
 // clearing files in templates_c/
73
-if (! empty($_POST['clearcache']) || ! empty($_POST['cleartplsvars'])) {
73
+if (!empty($_POST['clearcache']) || !empty($_POST['cleartplsvars'])) {
74 74
     // Ticket Check
75
-    if (! $xoopsGTicket->check()) {
75
+    if (!$xoopsGTicket->check()) {
76 76
         redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors());
77 77
     }
78 78
 
79
-    if ($handler = opendir(XOOPS_COMPILE_PATH . '/')) {
79
+    if ($handler = opendir(XOOPS_COMPILE_PATH.'/')) {
80 80
         while (($file = readdir($handler)) !== false) {
81
-            if (! empty($_POST['clearcache'])) {
81
+            if (!empty($_POST['clearcache'])) {
82 82
                 // judging template cache '*.php'
83 83
                 if (substr($file, -4) !== '.php') {
84
-                    continue ;
84
+                    continue;
85 85
                 }
86 86
             } else {
87 87
                 // judging tplsvars cache 'tplsvars_*'
88 88
                 if (substr($file, 0, 9) !== 'tplsvars_') {
89
-                    continue ;
89
+                    continue;
90 90
                 }
91 91
             }
92 92
 
93
-            $file_path = XOOPS_COMPILE_PATH . '/' . $file ;
94
-            @unlink($file_path) ;
93
+            $file_path = XOOPS_COMPILE_PATH.'/'.$file;
94
+            @unlink($file_path);
95 95
         }
96
-        redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 1, _TPLSADMIN_MSG_CLEARCACHE) ;
97
-        exit ;
96
+        redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 1, _TPLSADMIN_MSG_CLEARCACHE);
97
+        exit;
98 98
     } else {
99
-        die('XOOPS_COMPILE_PATH cannot be opened') ;
99
+        die('XOOPS_COMPILE_PATH cannot be opened');
100 100
     }
101 101
 }
102 102
 
103 103
 // append hooking commands
104 104
 foreach ($compile_hooks as $command => $compile_hook) {
105
-    if (! empty($_POST[$command])) {
105
+    if (!empty($_POST[$command])) {
106 106
         // Ticket Check
107
-        if (! $xoopsGTicket->check()) {
107
+        if (!$xoopsGTicket->check()) {
108 108
             redirect_header(XOOPS_URL.'/', 3, $xoopsGTicket->getErrors());
109 109
         }
110 110
 
111
-        if ($handler = opendir(XOOPS_COMPILE_PATH . '/')) {
112
-            $file_count = 0 ;
111
+        if ($handler = opendir(XOOPS_COMPILE_PATH.'/')) {
112
+            $file_count = 0;
113 113
             while (($file = readdir($handler)) !== false) {
114 114
 
115 115
                 // skip /. /.. and hidden files
116 116
                 if ($file{0} == '.') {
117
-                    continue ;
117
+                    continue;
118 118
                 }
119 119
 
120 120
                 // skip if the extension is not .html.php
121 121
                 if (substr($file, -9) != '.html.php') {
122
-                    continue ;
122
+                    continue;
123 123
                 }
124 124
 
125 125
                 // skip theme.html when comment-mode or div-mode
126 126
                 if ($compile_hook['skip_theme'] && substr($file, -15) == '%theme.html.php') {
127
-                    $skip_mode = true ;
127
+                    $skip_mode = true;
128 128
                 } else {
129
-                    $skip_mode = false ;
129
+                    $skip_mode = false;
130 130
                 }
131 131
 
132
-                $file_path = XOOPS_COMPILE_PATH . '/' . $file ;
133
-                $file_bodies = file($file_path) ;
132
+                $file_path = XOOPS_COMPILE_PATH.'/'.$file;
133
+                $file_bodies = file($file_path);
134 134
 
135 135
                 // remove lines inserted by compilehookadmin
136 136
                 if (strstr($file_bodies[0], 'altsys')) {
137
-                    array_shift($file_bodies) ;
137
+                    array_shift($file_bodies);
138 138
                 }
139
-                if (strstr($file_bodies[count($file_bodies)-1], 'altsys')) {
140
-                    array_pop($file_bodies) ;
141
-                    $file_bodies[count($file_bodies)-1] = rtrim($file_bodies[count($file_bodies)-1]) ;
139
+                if (strstr($file_bodies[count($file_bodies) - 1], 'altsys')) {
140
+                    array_pop($file_bodies);
141
+                    $file_bodies[count($file_bodies) - 1] = rtrim($file_bodies[count($file_bodies) - 1]);
142 142
                 }
143 143
 
144 144
                 // get the name of the source template from Smarty's comment
145 145
                 if (preg_match('/compiled from (\S+)/', $file_bodies[1], $regs)) {
146
-                    $tpl_name = $regs[1] ;
146
+                    $tpl_name = $regs[1];
147 147
                 } else {
148
-                    $tpl_name = '__FILE__' ;
148
+                    $tpl_name = '__FILE__';
149 149
                 }
150 150
 
151
-                $fw = fopen($file_path, 'w') ;
151
+                $fw = fopen($file_path, 'w');
152 152
 
153 153
                 // insert "pre" command before the compiled cache
154
-                if ($compile_hook['pre'] && ! $skip_mode) {
155
-                    fwrite($fw, sprintf($compile_hook['pre'], htmlspecialchars($tpl_name, ENT_QUOTES)) . "\r\n") ;
154
+                if ($compile_hook['pre'] && !$skip_mode) {
155
+                    fwrite($fw, sprintf($compile_hook['pre'], htmlspecialchars($tpl_name, ENT_QUOTES))."\r\n");
156 156
                 }
157 157
 
158 158
                 // rest of template cache
159 159
                 foreach ($file_bodies as $line) {
160
-                    fwrite($fw, $line) ;
160
+                    fwrite($fw, $line);
161 161
                 }
162 162
 
163 163
                 // insert "post" command after the compiled cache
164
-                if ($compile_hook['post'] && ! $skip_mode) {
165
-                    fwrite($fw, "\r\n" . sprintf($compile_hook['post'], htmlspecialchars($tpl_name, ENT_QUOTES))) ;
164
+                if ($compile_hook['post'] && !$skip_mode) {
165
+                    fwrite($fw, "\r\n".sprintf($compile_hook['post'], htmlspecialchars($tpl_name, ENT_QUOTES)));
166 166
                 }
167 167
 
168
-                fclose($fw) ;
168
+                fclose($fw);
169 169
 
170
-                $file_count ++ ;
170
+                $file_count++;
171 171
             }
172 172
 
173 173
             if ($file_count > 0) {
174
-                redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 3, sprintf($compile_hook['success_msg'], $file_count)) ;
175
-                exit ;
174
+                redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 3, sprintf($compile_hook['success_msg'], $file_count));
175
+                exit;
176 176
             } else {
177
-                redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 3, _TPLSADMIN_MSG_CREATECOMPILECACHEFIRST) ;
178
-                exit ;
177
+                redirect_header('?mode=admin&lib=altsys&page=compilehookadmin', 3, _TPLSADMIN_MSG_CREATECOMPILECACHEFIRST);
178
+                exit;
179 179
             }
180 180
         } else {
181
-            die('XOOPS_COMPILE_PATH cannot be opened') ;
181
+            die('XOOPS_COMPILE_PATH cannot be opened');
182 182
         }
183 183
     }
184 184
 }
@@ -190,25 +190,25 @@  discard block
 block discarded – undo
190 190
 //
191 191
 
192 192
 // count template vars & compiled caches
193
-$compiledcache_num = 0 ;
194
-$tplsvars_num = 0 ;
195
-if ($handler = opendir(XOOPS_COMPILE_PATH . '/')) {
193
+$compiledcache_num = 0;
194
+$tplsvars_num = 0;
195
+if ($handler = opendir(XOOPS_COMPILE_PATH.'/')) {
196 196
     while (($file = readdir($handler)) !== false) {
197 197
         if (strncmp($file, 'tplsvars_', 9) === 0) {
198
-            $tplsvars_num ++ ;
198
+            $tplsvars_num++;
199 199
         } elseif (substr($file, -4) === '.php') {
200
-            $compiledcache_num ++ ;
200
+            $compiledcache_num++;
201 201
         }
202 202
     }
203 203
 }
204 204
 
205 205
 // get tplsets
206
-$sql = 'SELECT tplset_name,COUNT(distinct tpl_file) FROM ' . $xoopsDB->prefix('tplset') . ' LEFT JOIN ' . $xoopsDB->prefix('tplfile') . " ON tplset_name=tpl_tplset GROUP BY tpl_tplset ORDER BY tpl_tplset='default' DESC,tpl_tplset" ;
206
+$sql = 'SELECT tplset_name,COUNT(distinct tpl_file) FROM '.$xoopsDB->prefix('tplset').' LEFT JOIN '.$xoopsDB->prefix('tplfile')." ON tplset_name=tpl_tplset GROUP BY tpl_tplset ORDER BY tpl_tplset='default' DESC,tpl_tplset";
207 207
 $srs = $xoopsDB->query($sql);
208
-$tplset_options = "<option value=''>----</option>\n" ;
208
+$tplset_options = "<option value=''>----</option>\n";
209 209
 while (list($tplset, $tpl_count) = $xoopsDB->fetchRow($srs)) {
210
-    $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES) ;
211
-    $tplset_options .= "<option value='$tplset4disp'>$tplset4disp ($tpl_count)</option>\n" ;
210
+    $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES);
211
+    $tplset_options .= "<option value='$tplset4disp'>$tplset4disp ($tpl_count)</option>\n";
212 212
 }
213 213
 
214 214
 
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
 // FORM STAGE
219 219
 //
220 220
 
221
-xoops_cp_header() ;
221
+xoops_cp_header();
222 222
 
223 223
 // mymenu
224
-altsys_include_mymenu() ;
224
+altsys_include_mymenu();
225 225
 
226 226
 // breadcrumbs
227
-$breadcrumbsObj = AltsysBreadcrumbs::getInstance() ;
228
-$breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=compilehookadmin', _MI_ALTSYS_MENU_COMPILEHOOKADMIN) ;
227
+$breadcrumbsObj = AltsysBreadcrumbs::getInstance();
228
+$breadcrumbsObj->appendPath(XOOPS_URL.'/modules/altsys/admin/index.php?mode=admin&amp;lib=altsys&amp;page=compilehookadmin', _MI_ALTSYS_MENU_COMPILEHOOKADMIN);
229 229
 
230 230
 echo "
231 231
 	<style>
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 				</dd>
251 251
 			</dl>
252 252
 		</p>
253
-	\n" ;
253
+	\n";
254 254
 }
255 255
 
256 256
 echo "
@@ -271,10 +271,10 @@  discard block
 block discarded – undo
271 271
 		<p>
272 272
 			<dl>
273 273
 				<dt>
274
-                    "._TPLSADMIN_DT_GETTPLSVARSINFO_DW . '
274
+                    "._TPLSADMIN_DT_GETTPLSVARSINFO_DW.'
275 275
 				</dt>
276 276
 				<dd>
277
-                    ' . _TPLSADMIN_DD_GETTPLSVARSINFO_DW . "
277
+                    ' . _TPLSADMIN_DD_GETTPLSVARSINFO_DW."
278 278
 					<br />
279 279
 					<input type='submit' name='as_dw_extension_zip' value='zip' />
280 280
 					<input type='submit' name='as_dw_extension_tgz' value='tar.gz' />
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 		<p>
288 288
 			<dl>
289 289
 				<dt>
290
-                    "._TPLSADMIN_DT_GETTEMPLATES . '
290
+                    "._TPLSADMIN_DT_GETTEMPLATES.'
291 291
 				</dt>
292 292
 				<dd>
293
-                    ' . _TPLSADMIN_DD_GETTEMPLATES . "
293
+                    ' . _TPLSADMIN_DD_GETTEMPLATES."
294 294
 					<br />
295 295
 					<select name='tplset'>$tplset_options</select>
296 296
 					<input type='submit' name='download_zip' value='zip' />
@@ -304,10 +304,10 @@  discard block
 block discarded – undo
304 304
 		<p>
305 305
 			<dl>
306 306
 				<dt>
307
-                    "._TPLSADMIN_DT_PUTTEMPLATES . '
307
+                    "._TPLSADMIN_DT_PUTTEMPLATES.'
308 308
 				</dt>
309 309
 				<dd>
310
-                    ' . _TPLSADMIN_DD_PUTTEMPLATES . "
310
+                    ' . _TPLSADMIN_DD_PUTTEMPLATES."
311 311
 					<br />
312 312
 					<select name='tplset'>$tplset_options</select>
313 313
 					<input type='file' name='tplset_archive' size='60' />
@@ -319,4 +319,4 @@  discard block
 block discarded – undo
319 319
 \n" ;
320 320
 
321 321
 
322
-xoops_cp_footer() ;
322
+xoops_cp_footer();
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/mymenusub/myblocksadmin.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (! defined('XOOPS_ROOT_PATH')) {
4
-    exit ;
3
+if (!defined('XOOPS_ROOT_PATH')) {
4
+    exit;
5 5
 }
6 6
 
7
-$core_type = altsys_get_core_type() ;
8
-$db = XoopsDatabaseFactory::getDatabaseConnection() ;
7
+$core_type = altsys_get_core_type();
8
+$db = XoopsDatabaseFactory::getDatabaseConnection();
9 9
 
10
-$current_dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['dirname']) ;
10
+$current_dirname = preg_replace('/[^0-9a-zA-Z_-]/', '', @$_GET['dirname']);
11 11
 if ($current_dirname == '__CustomBlocks__') {
12
-    return ;
12
+    return;
13 13
 }
14 14
 
15 15
     $module_handler4menu = xoops_getHandler('module');
@@ -17,45 +17,45 @@  discard block
 block discarded – undo
17 17
     //$criteria4menu->add(new Criteria('hasmain', 1));
18 18
     $criteria4menu->add(new Criteria('mid', '1', '>'));
19 19
     $modules4menu = $module_handler4menu->getObjects($criteria4menu, true);
20
-    $system_module = $module_handler4menu->get(1) ;
20
+    $system_module = $module_handler4menu->get(1);
21 21
     if (is_object($system_module)) {
22
-        array_unshift($modules4menu, $system_module) ;
22
+        array_unshift($modules4menu, $system_module);
23 23
     }
24 24
 
25
-$adminmenu = array() ;
25
+$adminmenu = array();
26 26
 foreach ($modules4menu as $m4menu) {
27 27
     // get block info
28 28
     if ($core_type != ALTSYS_CORE_TYPE_X22) {
29
-        list($block_count_all) = $db->fetchRow($db->query('SELECT COUNT(*) FROM ' . $db->prefix('newblocks') . ' WHERE mid=' . $m4menu->getVar('mid'))) ;
30
-        list($block_count_visible) = $db->fetchRow($db->query('SELECT COUNT(*) FROM ' . $db->prefix('newblocks') . ' WHERE mid=' . $m4menu->getVar('mid') . ' AND visible>0')) ;
29
+        list($block_count_all) = $db->fetchRow($db->query('SELECT COUNT(*) FROM '.$db->prefix('newblocks').' WHERE mid='.$m4menu->getVar('mid')));
30
+        list($block_count_visible) = $db->fetchRow($db->query('SELECT COUNT(*) FROM '.$db->prefix('newblocks').' WHERE mid='.$m4menu->getVar('mid').' AND visible>0'));
31 31
         // $block_desc = " $block_count_all($block_count_visible)" ;
32
-        $block_desc = " ($block_count_visible/$block_count_all)" ;
32
+        $block_desc = " ($block_count_visible/$block_count_all)";
33 33
     } else {
34
-        $block_desc = '' ;
34
+        $block_desc = '';
35 35
     }
36 36
 
37 37
     if ($m4menu->getVar('dirname') == $current_dirname) {
38 38
         $adminmenu[] = array(
39
-            'selected' => true ,
40
-            'title' => $m4menu->getVar('name', 'n') . $block_desc ,
39
+            'selected' => true,
40
+            'title' => $m4menu->getVar('name', 'n').$block_desc,
41 41
             'link' => '?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$m4menu->getVar('dirname', 'n')
42
-        ) ;
42
+        );
43 43
         //$GLOBALS['altsysXoopsBreadcrumbs'][] = array( 'name' => $m4menu->getVar('name') ) ;
44 44
     } else {
45 45
         $adminmenu[] = array(
46
-            'selected' => false ,
47
-            'title' => $m4menu->getVar('name', 'n') . $block_desc ,
46
+            'selected' => false,
47
+            'title' => $m4menu->getVar('name', 'n').$block_desc,
48 48
             'link' => '?mode=admin&lib=altsys&page=myblocksadmin&dirname='.$m4menu->getVar('dirname', 'n')
49
-        ) ;
49
+        );
50 50
     }
51 51
 }
52 52
 
53 53
 
54 54
 // display
55
-require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php' ;
56
-$tpl = new D3Tpl() ;
55
+require_once XOOPS_TRUST_PATH.'/libs/altsys/class/D3Tpl.class.php';
56
+$tpl = new D3Tpl();
57 57
 $tpl->assign(array(
58 58
     'adminmenu' => $adminmenu,
59 59
     'mypage' => 'myblocksadmin'
60
-)) ;
61
-$tpl->display('db:altsys_inc_mymenusub.html') ;
60
+));
61
+$tpl->display('db:altsys_inc_mymenusub.html');
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/preload.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@
 block discarded – undo
6 6
 //admin page
7 7
 if ($root->mController->_mStrategy) {
8 8
     if (strtolower(get_class($root->mController->_mStrategy)) == strtolower('Legacy_AdminControllerStrategy')) {
9
-        include_once __DIR__.'/include/altsys_functions.php' ;
9
+        include_once __DIR__.'/include/altsys_functions.php';
10 10
         // language file (modinfo.php)
11
-        altsys_include_language_file('modinfo') ;
11
+        altsys_include_language_file('modinfo');
12 12
     }
13 13
 }
14 14
 // load altsys newly gticket class for other modules
Please login to merge, or discard this patch.