Completed
Push — 1.10.x ( bba6d9...5329e3 )
by Julito
96:43 queued 40:39
created
main/inc/lib/pear/Text/Diff/Renderer/unified.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
     function _blockHeader($xbeg, $xlen, $ybeg, $ylen)
35 35
     {
36 36
         if ($xlen != 1) {
37
-            $xbeg .= ',' . $xlen;
37
+            $xbeg .= ','.$xlen;
38 38
         }
39 39
         if ($ylen != 1) {
40
-            $ybeg .= ',' . $ylen;
40
+            $ybeg .= ','.$ylen;
41 41
         }
42 42
         return "@@ -$xbeg +$ybeg @@";
43 43
     }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
     function _changed($orig, $final)
61 61
     {
62
-        return $this->_deleted($orig) . $this->_added($final);
62
+        return $this->_deleted($orig).$this->_added($final);
63 63
     }
64 64
 
65 65
 }
Please login to merge, or discard this patch.
main/inc/lib/pear/Text/Diff/Mapped.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
      *                                  of elements as $to_lines.
30 30
      */
31 31
     function Text_Diff_Mapped($from_lines, $to_lines,
32
-                              $mapped_from_lines, $mapped_to_lines)
32
+                                $mapped_from_lines, $mapped_to_lines)
33 33
     {
34 34
         assert(count($from_lines) == count($mapped_from_lines));
35 35
         assert(count($to_lines) == count($mapped_to_lines));
Please login to merge, or discard this patch.
main/inc/lib/pear/Text/Diff/Engine/xdiff.php 1 patch
Switch Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -46,17 +46,17 @@
 block discarded – undo
46 46
                 continue;
47 47
             }
48 48
             switch ($line[0]) {
49
-            case ' ':
50
-                $edits[] = &new Text_Diff_Op_copy(array(substr($line, 1)));
51
-                break;
49
+                case ' ':
50
+                    $edits[] = &new Text_Diff_Op_copy(array(substr($line, 1)));
51
+                    break;
52 52
 
53
-            case '+':
54
-                $edits[] = &new Text_Diff_Op_add(array(substr($line, 1)));
55
-                break;
53
+                case '+':
54
+                    $edits[] = &new Text_Diff_Op_add(array(substr($line, 1)));
55
+                    break;
56 56
 
57
-            case '-':
58
-                $edits[] = &new Text_Diff_Op_delete(array(substr($line, 1)));
59
-                break;
57
+                case '-':
58
+                    $edits[] = &new Text_Diff_Op_delete(array(substr($line, 1)));
59
+                    break;
60 60
             }
61 61
         }
62 62
 
Please login to merge, or discard this patch.
main/inc/lib/pear/Text/Diff/Engine/shell.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -124,9 +124,9 @@
 block discarded – undo
124 124
             array_push($edits,
125 125
                 new Text_Diff_Op_copy(
126 126
                     $this->_getLines($from_lines, $from_line_no,
127
-                                     $from_line_no + count($from_lines) - 1),
127
+                                        $from_line_no + count($from_lines) - 1),
128 128
                     $this->_getLines($to_lines, $to_line_no,
129
-                                     $to_line_no + count($to_lines) - 1)));
129
+                                        $to_line_no + count($to_lines) - 1)));
130 130
         }
131 131
 
132 132
         return $edits;
Please login to merge, or discard this patch.
Switch Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -93,29 +93,29 @@
 block discarded – undo
93 93
             }
94 94
 
95 95
             switch ($match[3]) {
96
-            case 'd':
97
-                // deleted lines
98
-                array_push($edits,
99
-                    new Text_Diff_Op_delete(
100
-                        $this->_getLines($from_lines, $from_line_no, $match[2])));
101
-                $to_line_no++;
102
-                break;
103
-
104
-            case 'c':
105
-                // changed lines
106
-                array_push($edits,
107
-                    new Text_Diff_Op_change(
108
-                        $this->_getLines($from_lines, $from_line_no, $match[2]),
109
-                        $this->_getLines($to_lines, $to_line_no, $match[5])));
110
-                break;
111
-
112
-            case 'a':
113
-                // added lines
114
-                array_push($edits,
115
-                    new Text_Diff_Op_add(
116
-                        $this->_getLines($to_lines, $to_line_no, $match[5])));
117
-                $from_line_no++;
118
-                break;
96
+                case 'd':
97
+                    // deleted lines
98
+                    array_push($edits,
99
+                        new Text_Diff_Op_delete(
100
+                            $this->_getLines($from_lines, $from_line_no, $match[2])));
101
+                    $to_line_no++;
102
+                    break;
103
+
104
+                case 'c':
105
+                    // changed lines
106
+                    array_push($edits,
107
+                        new Text_Diff_Op_change(
108
+                            $this->_getLines($from_lines, $from_line_no, $match[2]),
109
+                            $this->_getLines($to_lines, $to_line_no, $match[5])));
110
+                    break;
111
+
112
+                case 'a':
113
+                    // added lines
114
+                    array_push($edits,
115
+                        new Text_Diff_Op_add(
116
+                            $this->_getLines($to_lines, $to_line_no, $match[5])));
117
+                    $from_line_no++;
118
+                    break;
119 119
             }
120 120
         }
121 121
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
         $fp = fopen($to_file, 'w');
50 50
         fwrite($fp, implode("\n", $to_lines));
51 51
         fclose($fp);
52
-        $diff = shell_exec($this->_diffCommand . ' ' . $from_file . ' ' . $to_file);
52
+        $diff = shell_exec($this->_diffCommand.' '.$from_file.' '.$to_file);
53 53
         unlink($from_file);
54 54
         unlink($to_file);
55 55
 
Please login to merge, or discard this patch.
main/inc/lib/pear/PEAR5.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -6,17 +6,17 @@
 block discarded – undo
6 6
 class PEAR5
7 7
 {
8 8
     /**
9
-    * If you have a class that's mostly/entirely static, and you need static
10
-    * properties, you can use this method to simulate them. Eg. in your method(s)
11
-    * do this: $myVar = &PEAR5::getStaticProperty('myclass', 'myVar');
12
-    * You MUST use a reference, or they will not persist!
13
-    *
14
-    * @access public
15
-    * @param  string $class  The calling classname, to prevent clashes
16
-    * @param  string $var    The variable to retrieve.
17
-    * @return mixed   A reference to the variable. If not set it will be
18
-    *                 auto initialised to NULL.
19
-    */
9
+     * If you have a class that's mostly/entirely static, and you need static
10
+     * properties, you can use this method to simulate them. Eg. in your method(s)
11
+     * do this: $myVar = &PEAR5::getStaticProperty('myclass', 'myVar');
12
+     * You MUST use a reference, or they will not persist!
13
+     *
14
+     * @access public
15
+     * @param  string $class  The calling classname, to prevent clashes
16
+     * @param  string $var    The variable to retrieve.
17
+     * @return mixed   A reference to the variable. If not set it will be
18
+     *                 auto initialised to NULL.
19
+     */
20 20
     static function &getStaticProperty($class, $var)
21 21
     {
22 22
         static $properties;
Please login to merge, or discard this patch.
main/inc/lib/pear/PEAR.php 3 patches
Spacing   +13 added lines, -14 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 /**#@+
27 27
  * ERROR constants
28 28
  */
29
-define('PEAR_ERROR_RETURN',     1);
30
-define('PEAR_ERROR_PRINT',      2);
31
-define('PEAR_ERROR_TRIGGER',    4);
32
-define('PEAR_ERROR_DIE',        8);
33
-define('PEAR_ERROR_CALLBACK',  16);
29
+define('PEAR_ERROR_RETURN', 1);
30
+define('PEAR_ERROR_PRINT', 2);
31
+define('PEAR_ERROR_TRIGGER', 4);
32
+define('PEAR_ERROR_DIE', 8);
33
+define('PEAR_ERROR_CALLBACK', 16);
34 34
 /**
35 35
  * WARNING: obsolete
36 36
  * @deprecated
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
 
43 43
 if (substr(PHP_OS, 0, 3) == 'WIN') {
44 44
     define('OS_WINDOWS', true);
45
-    define('OS_UNIX',    false);
46
-    define('PEAR_OS',    'Windows');
45
+    define('OS_UNIX', false);
46
+    define('PEAR_OS', 'Windows');
47 47
 } else {
48 48
     define('OS_WINDOWS', false);
49
-    define('OS_UNIX',    true);
50
-    define('PEAR_OS',    'Unix'); // blatant assumption
49
+    define('OS_UNIX', true);
50
+    define('PEAR_OS', 'Unix'); // blatant assumption
51 51
 }
52 52
 
53 53
 $GLOBALS['_PEAR_default_error_mode']     = PEAR_ERROR_RETURN;
@@ -451,9 +451,9 @@  discard block
 block discarded – undo
451 451
             // $error_code is a non-empty array here;
452 452
             // we walk through it trying to unset all
453 453
             // values
454
-            foreach($error_code as $key => $error) {
454
+            foreach ($error_code as $key => $error) {
455 455
                 if ($this->_checkDelExpect($error)) {
456
-                    $deleted =  true;
456
+                    $deleted = true;
457 457
                 } else {
458 458
                     $deleted = false;
459 459
                 }
@@ -986,7 +986,7 @@  discard block
 block discarded – undo
986 986
      */
987 987
     function getMessage()
988 988
     {
989
-        return ($this->error_message_prefix . $this->message);
989
+        return ($this->error_message_prefix.$this->message);
990 990
     }
991 991
 
992 992
 
@@ -1103,8 +1103,7 @@  discard block
 block discarded – undo
1103 1103
         if ($this->mode & PEAR_ERROR_CALLBACK) {
1104 1104
             if (is_array($this->callback)) {
1105 1105
                 $callback = (is_object($this->callback[0]) ?
1106
-                    strtolower(get_class($this->callback[0])) :
1107
-                    $this->callback[0]) . '::' .
1106
+                    strtolower(get_class($this->callback[0])) : $this->callback[0]).'::'.
1108 1107
                     $this->callback[1];
1109 1108
             } else {
1110 1109
                 $callback = $this->callback;
Please login to merge, or discard this patch.
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -205,17 +205,17 @@  discard block
 block discarded – undo
205 205
     // {{{ getStaticProperty()
206 206
 
207 207
     /**
208
-    * If you have a class that's mostly/entirely static, and you need static
209
-    * properties, you can use this method to simulate them. Eg. in your method(s)
210
-    * do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar');
211
-    * You MUST use a reference, or they will not persist!
212
-    *
213
-    * @access public
214
-    * @param  string $class  The calling classname, to prevent clashes
215
-    * @param  string $var    The variable to retrieve.
216
-    * @return mixed   A reference to the variable. If not set it will be
217
-    *                 auto initialised to NULL.
218
-    */
208
+     * If you have a class that's mostly/entirely static, and you need static
209
+     * properties, you can use this method to simulate them. Eg. in your method(s)
210
+     * do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar');
211
+     * You MUST use a reference, or they will not persist!
212
+     *
213
+     * @access public
214
+     * @param  string $class  The calling classname, to prevent clashes
215
+     * @param  string $var    The variable to retrieve.
216
+     * @return mixed   A reference to the variable. If not set it will be
217
+     *                 auto initialised to NULL.
218
+     */
219 219
     function &getStaticProperty($class, $var)
220 220
     {
221 221
         static $properties;
@@ -234,14 +234,14 @@  discard block
 block discarded – undo
234 234
     // {{{ registerShutdownFunc()
235 235
 
236 236
     /**
237
-    * Use this function to register a shutdown method for static
238
-    * classes.
239
-    *
240
-    * @access public
241
-    * @param  mixed $func  The function name (or array of class/method) to call
242
-    * @param  mixed $args  The arguments to pass to the function
243
-    * @return void
244
-    */
237
+     * Use this function to register a shutdown method for static
238
+     * classes.
239
+     *
240
+     * @access public
241
+     * @param  mixed $func  The function name (or array of class/method) to call
242
+     * @param  mixed $args  The arguments to pass to the function
243
+     * @return void
244
+     */
245 245
     function registerShutdownFunc($func, $args = array())
246 246
     {
247 247
         // if we are called statically, there is a potential
@@ -513,12 +513,12 @@  discard block
 block discarded – undo
513 513
      * @since PHP 4.0.5
514 514
      */
515 515
     function &raiseError($message = null,
516
-                         $code = null,
517
-                         $mode = null,
518
-                         $options = null,
519
-                         $userinfo = null,
520
-                         $error_class = null,
521
-                         $skipmsg = false)
516
+                            $code = null,
517
+                            $mode = null,
518
+                            $options = null,
519
+                            $userinfo = null,
520
+                            $error_class = null,
521
+                            $skipmsg = false)
522 522
     {
523 523
         // The error is yet a PEAR error object
524 524
         if (is_object($message)) {
@@ -584,8 +584,8 @@  discard block
 block discarded – undo
584 584
      *
585 585
      */
586 586
     function &throwError($message = null,
587
-                         $code = null,
588
-                         $userinfo = null)
587
+                            $code = null,
588
+                            $userinfo = null)
589 589
     {
590 590
         if (isset($this) && is_a($this, 'PEAR')) {
591 591
             $a = &$this->raiseError($message, $code, null, null, $userinfo);
@@ -707,12 +707,12 @@  discard block
 block discarded – undo
707 707
     // {{{ popErrorHandling()
708 708
 
709 709
     /**
710
-    * Pop the last error handler used
711
-    *
712
-    * @return bool Always true
713
-    *
714
-    * @see PEAR::pushErrorHandling
715
-    */
710
+     * Pop the last error handler used
711
+     *
712
+     * @return bool Always true
713
+     *
714
+     * @see PEAR::pushErrorHandling
715
+     */
716 716
     function popErrorHandling()
717 717
     {
718 718
         $stack = &$GLOBALS['_PEAR_error_handler_stack'];
@@ -731,12 +731,12 @@  discard block
 block discarded – undo
731 731
     // {{{ loadExtension()
732 732
 
733 733
     /**
734
-    * OS independant PHP extension load. Remember to take care
735
-    * on the correct extension name for case sensitive OSes.
736
-    *
737
-    * @param string $ext The extension name
738
-    * @return bool Success or not on the dl() call
739
-    */
734
+     * OS independant PHP extension load. Remember to take care
735
+     * on the correct extension name for case sensitive OSes.
736
+     *
737
+     * @param string $ext The extension name
738
+     * @return bool Success or not on the dl() call
739
+     */
740 740
     function loadExtension($ext)
741 741
     {
742 742
         if (!extension_loaded($ext)) {
@@ -999,10 +999,10 @@  discard block
 block discarded – undo
999 999
      * @return int error code
1000 1000
      * @access public
1001 1001
      */
1002
-     function getCode()
1003
-     {
1002
+        function getCode()
1003
+        {
1004 1004
         return $this->code;
1005
-     }
1005
+        }
1006 1006
 
1007 1007
     // }}}
1008 1008
     // {{{ getType()
@@ -1110,10 +1110,10 @@  discard block
 block discarded – undo
1110 1110
                 $callback = $this->callback;
1111 1111
             }
1112 1112
             return sprintf('[%s: message="%s" code=%d mode=callback '.
1113
-                           'callback=%s prefix="%s" info="%s"]',
1114
-                           strtolower(get_class($this)), $this->message, $this->code,
1115
-                           $callback, $this->error_message_prefix,
1116
-                           $this->userinfo);
1113
+                            'callback=%s prefix="%s" info="%s"]',
1114
+                            strtolower(get_class($this)), $this->message, $this->code,
1115
+                            $callback, $this->error_message_prefix,
1116
+                            $this->userinfo);
1117 1117
         }
1118 1118
         if ($this->mode & PEAR_ERROR_PRINT) {
1119 1119
             $modes[] = 'print';
@@ -1128,11 +1128,11 @@  discard block
 block discarded – undo
1128 1128
             $modes[] = 'return';
1129 1129
         }
1130 1130
         return sprintf('[%s: message="%s" code=%d mode=%s level=%s '.
1131
-                       'prefix="%s" info="%s"]',
1132
-                       strtolower(get_class($this)), $this->message, $this->code,
1133
-                       implode("|", $modes), $levels[$this->level],
1134
-                       $this->error_message_prefix,
1135
-                       $this->userinfo);
1131
+                        'prefix="%s" info="%s"]',
1132
+                        strtolower(get_class($this)), $this->message, $this->code,
1133
+                        implode("|", $modes), $levels[$this->level],
1134
+                        $this->error_message_prefix,
1135
+                        $this->userinfo);
1136 1136
     }
1137 1137
 
1138 1138
     // }}}
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
      *                  PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE,
491 491
      *                  PEAR_ERROR_CALLBACK, PEAR_ERROR_EXCEPTION.
492 492
      *
493
-     * @param mixed $options If $mode is PEAR_ERROR_TRIGGER, this parameter
493
+     * @param integer|null $options If $mode is PEAR_ERROR_TRIGGER, this parameter
494 494
      *                  specifies the PHP-internal error level (one of
495 495
      *                  E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR).
496 496
      *                  If $mode is PEAR_ERROR_CALLBACK, this
@@ -581,6 +581,7 @@  discard block
 block discarded – undo
581 581
      * message, code and userinfo are enough.
582 582
      *
583 583
      * @param string $message
584
+     * @param integer $code
584 585
      *
585 586
      */
586 587
     function &throwError($message = null,
Please login to merge, or discard this patch.
main/inc/lib/pear/Pager/Jumping.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -250,7 +250,7 @@
 block discarded – undo
250 250
                 $links .= $this->_curPageSpanPre . $i . $this->_curPageSpanPost;
251 251
             }
252 252
             $links .= $this->_spacesBefore
253
-                   . (($i != $this->_totalPages) ? $this->_separator.$this->_spacesAfter : '');
253
+                    . (($i != $this->_totalPages) ? $this->_separator.$this->_spacesAfter : '');
254 254
         }
255 255
         return $links;
256 256
     }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         }
92 92
 
93 93
         if (($index % $this->_perPage) > 0) {
94
-            $pageID = ceil((float)$index / (float)$this->_perPage);
94
+            $pageID = ceil((float) $index / (float) $this->_perPage);
95 95
         } else {
96 96
             $pageID = $index / $this->_perPage;
97 97
         }
@@ -117,14 +117,14 @@  discard block
 block discarded – undo
117 117
      */
118 118
     function getPageRangeByPageId($pageid = null)
119 119
     {
120
-        $pageid = isset($pageid) ? (int)$pageid : $this->_currentPage;
120
+        $pageid = isset($pageid) ? (int) $pageid : $this->_currentPage;
121 121
         if (isset($this->_pageData[$pageid]) || is_null($this->_itemData)) {
122 122
             // I'm sure I'm missing something here, but this formula works
123 123
             // so I'm using it until I find something simpler.
124
-            $start = ((($pageid + (($this->_delta - ($pageid % $this->_delta))) % $this->_delta) / $this->_delta) - 1) * $this->_delta +1;
124
+            $start = ((($pageid + (($this->_delta - ($pageid % $this->_delta))) % $this->_delta) / $this->_delta) - 1) * $this->_delta + 1;
125 125
             return array(
126 126
                 max($start, 1),
127
-                min($start+$this->_delta-1, $this->_totalPages)
127
+                min($start + $this->_delta - 1, $this->_totalPages)
128 128
             );
129 129
         } else {
130 130
             return array(0, 0);
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
      *
154 154
      * @return array Back/pages/next links
155 155
      */
156
-    function getLinks($pageID=null, $next_html='')
156
+    function getLinks($pageID = null, $next_html = '')
157 157
     {
158 158
         //BC hack
159 159
         if (!empty($next_html)) {
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
         $links = '';
241 241
         $limits = $this->getPageRangeByPageId($this->_currentPage);
242 242
 
243
-        for ($i=$limits[0]; $i<=min($limits[1], $this->_totalPages); $i++) {
243
+        for ($i = $limits[0]; $i <= min($limits[1], $this->_totalPages); $i++) {
244 244
             if ($i != $this->_currentPage) {
245 245
                 $this->range[$i] = false;
246 246
                 $this->_linkData[$this->_urlVar] = $i;
247 247
                 $links .= $this->_renderLink(str_replace('%d', $i, $this->_altPage), $i);
248 248
             } else {
249 249
                 $this->range[$i] = true;
250
-                $links .= $this->_curPageSpanPre . $i . $this->_curPageSpanPost;
250
+                $links .= $this->_curPageSpanPre.$i.$this->_curPageSpanPost;
251 251
             }
252 252
             $links .= $this->_spacesBefore
253 253
                    . (($i != $this->_totalPages) ? $this->_separator.$this->_spacesAfter : '');
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@
 block discarded – undo
107 107
      *
108 108
      * @param integer $pageid PageID to get offsets for
109 109
      *
110
-     * @return array  First and last offsets
110
+     * @return integer[]  First and last offsets
111 111
      * @access public
112 112
      */
113 113
     function getPageRangeByPageId($pageid = null)
Please login to merge, or discard this patch.
main/inc/lib/pear/Pager/Pager.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -169,8 +169,8 @@
 block discarded – undo
169 169
     static function &factory($options = array())
170 170
     {
171 171
         $mode = (isset($options['mode']) ? ucfirst($options['mode']) : 'Jumping');
172
-        $classname = 'Pager_' . $mode;
173
-        $classfile = 'Pager' . DIRECTORY_SEPARATOR . $mode . '.php';
172
+        $classname = 'Pager_'.$mode;
173
+        $classfile = 'Pager'.DIRECTORY_SEPARATOR.$mode.'.php';
174 174
 
175 175
         // Attempt to include a custom version of the named class, but don't treat
176 176
         // a failure as fatal.  The caller may have already included their own
Please login to merge, or discard this patch.
main/inc/lib/dashboard.lib.php 3 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
                 echo '<tr>';
54 54
                 self::display_dashboard_plugin_checkboxes($testplugin);
55
-                for ($i = 0 ; $i < count($table_cols); $i++) {
55
+                for ($i = 0; $i < count($table_cols); $i++) {
56 56
                     if (isset($plugin_info[strtolower($table_cols[$i])])) {
57 57
                         echo '<td>';
58 58
                         echo $plugin_info[$table_cols[$i]];
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
                     echo Display::tag(
68 68
                         'tr',
69 69
                         Display::tag('td',
70
-                            get_lang('CheckFilePermissions') . ' ' . Security::remove_XSS($plugin_info_file),
70
+                            get_lang('CheckFilePermissions').' '.Security::remove_XSS($plugin_info_file),
71 71
                             array('colspan' => '3'))
72 72
                     );
73 73
                 }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             foreach ($disabled_blocks_data as $disabled_block) {
80 80
                 echo '<tr style="background-color:#eee">';
81 81
                 echo '<td><center><input type="checkbox" name="disabled_block" value="true" checked disabled /></center>';
82
-                for ($j = 0 ; $j < count($table_cols); $j++) {
82
+                for ($j = 0; $j < count($table_cols); $j++) {
83 83
                     if (isset($disabled_block[strtolower($table_cols[$j])])) {
84 84
                         if ($j == 2) {
85 85
                             echo '<td>';
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
             }
190 190
             // clean from block data
191 191
             if (!empty($not_selected_blocks_id)) {
192
-                $sql_check = "SELECT id FROM $tbl_block WHERE id IN(".implode(',',$not_selected_blocks_id).")";
192
+                $sql_check = "SELECT id FROM $tbl_block WHERE id IN(".implode(',', $not_selected_blocks_id).")";
193 193
                 $rs_check = Database::query($sql_check);
194 194
                 if (Database::num_rows($rs_check) > 0) {
195
-                    $del = "DELETE FROM $tbl_block WHERE id IN(".implode(',',$not_selected_blocks_id).")";
195
+                    $del = "DELETE FROM $tbl_block WHERE id IN(".implode(',', $not_selected_blocks_id).")";
196 196
                     Database::query($del);
197 197
                 }
198 198
             }
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
                         $affected_rows = Database::affected_rows($result);
213 213
                     } else {
214 214
                         // insert
215
-                        $plugin_info_file = $dashboard_pluginpath . $testplugin . "/$testplugin.info";
215
+                        $plugin_info_file = $dashboard_pluginpath.$testplugin."/$testplugin.info";
216 216
                         $plugin_info = array();
217 217
                         if (file_exists($plugin_info_file)) {
218 218
                             $plugin_info = parse_info_file($plugin_info_file);
@@ -282,10 +282,10 @@  discard block
 block discarded – undo
282 282
 		// We check if plugin exists inside directory for updating active field
283 283
 		$sql = "SELECT * FROM $tbl_block";
284 284
 		$rs = Database::query($sql);
285
-		if (Database::num_rows($rs) > 0){
285
+		if (Database::num_rows($rs) > 0) {
286 286
 			while ($row = Database::fetch_array($rs)) {
287 287
 				$path = $row['path'];
288
-				if (!in_array($row['path'],$possibleplugins)) {
288
+				if (!in_array($row['path'], $possibleplugins)) {
289 289
 					$active = 0;
290 290
 				} else {
291 291
 					$active = 1;
@@ -390,13 +390,13 @@  discard block
 block discarded – undo
390 390
 					echo '<td>'.$block['description'].'</td>';
391 391
 					echo '<td>
392 392
                             <select class="selectpicker show-tick form-control" name="columns['.$block['id'].']">
393
-                            <option value="1" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==1?'selected':'').' >1</option>
394
-                            <option value="2" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==2?'selected':'').' >2</option>
393
+                            <option value="1" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column'] == 1 ? 'selected' : '').' >1</option>
394
+                            <option value="2" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column'] == 2 ? 'selected' : '').' >2</option>
395 395
                             </select>
396 396
                           </td>';
397 397
 					echo '</tr>';
398 398
 				} else {
399
-					echo Display::tag('tr',  Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3')));
399
+					echo Display::tag('tr', Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3')));
400 400
 				}
401 401
 			}
402 402
 
@@ -475,10 +475,10 @@  discard block
 block discarded – undo
475 475
 		$user_id = intval($user_id);
476 476
 		$field_variable = 'dashboard';
477 477
 		$extra_user_data = UserManager::get_extra_user_data_by_field($user_id, $field_variable);
478
-		$extra_user_data = explode(';',$extra_user_data[$field_variable]);
478
+		$extra_user_data = explode(';', $extra_user_data[$field_variable]);
479 479
 		$data = array();
480 480
 		foreach ($extra_user_data as $extra) {
481
-			$split_extra = explode(':',$extra);
481
+			$split_extra = explode(':', $extra);
482 482
 			if (!empty($split_extra)) {
483 483
 				$block_id = $split_extra[0];
484 484
 				$column = isset($split_extra[1]) ? $split_extra[1] : null;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -380,7 +380,9 @@
 block discarded – undo
380 380
 					// check if user is allowed to see the block
381 381
 					if (method_exists($obj_block, 'is_block_visible_for_user')) {
382 382
 						$is_block_visible_for_user = $obj_block->is_block_visible_for_user($user_id);
383
-						if (!$is_block_visible_for_user) continue;
383
+						if (!$is_block_visible_for_user) {
384
+						    continue;
385
+						}
384 386
 					}
385 387
 
386 388
 					echo '<tr>';
Please login to merge, or discard this patch.
Indentation   +256 added lines, -256 removed lines patch added patch discarded remove patch
@@ -249,283 +249,283 @@
 block discarded – undo
249 249
         return $affected_rows;
250 250
     }
251 251
 
252
-	/**
253
-	 * Get all plugins path inside dashboard directory
254
-	 * @return array name plugins directories
255
-	 */
256
-	public static function getPossibleDashboardPluginsPath()
252
+    /**
253
+     * Get all plugins path inside dashboard directory
254
+     * @return array name plugins directories
255
+     */
256
+    public static function getPossibleDashboardPluginsPath()
257 257
     {
258
-		// get all plugins path inside plugin directory
259
-		/* We scan the plugin directory. Each folder is a potential plugin. */
260
-		$possiblePlugins = array();
261
-		$dashboard_pluginpath = api_get_path(SYS_PLUGIN_PATH).'dashboard/';
262
-		$handle = @opendir($dashboard_pluginpath);
263
-		while (false !== ($file = readdir($handle))) {
264
-			if ($file <> '.' AND $file <> '..' AND is_dir($dashboard_pluginpath.$file)) {
265
-				$possiblePlugins[] = $file;
266
-			}
267
-		}
268
-		@closedir($handle);
269
-
270
-		return $possiblePlugins;
271
-	}
272
-
273
-	/**
274
-	 * Get all blocks data without plugin directory
275
-	 * @return array Block data
276
-	 */
277
-	public static function get_block_data_without_plugin()
258
+        // get all plugins path inside plugin directory
259
+        /* We scan the plugin directory. Each folder is a potential plugin. */
260
+        $possiblePlugins = array();
261
+        $dashboard_pluginpath = api_get_path(SYS_PLUGIN_PATH).'dashboard/';
262
+        $handle = @opendir($dashboard_pluginpath);
263
+        while (false !== ($file = readdir($handle))) {
264
+            if ($file <> '.' AND $file <> '..' AND is_dir($dashboard_pluginpath.$file)) {
265
+                $possiblePlugins[] = $file;
266
+            }
267
+        }
268
+        @closedir($handle);
269
+
270
+        return $possiblePlugins;
271
+    }
272
+
273
+    /**
274
+     * Get all blocks data without plugin directory
275
+     * @return array Block data
276
+     */
277
+    public static function get_block_data_without_plugin()
278 278
     {
279
-		$tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK);
280
-		$possibleplugins = self::getPossibleDashboardPluginsPath();
281
-
282
-		// We check if plugin exists inside directory for updating active field
283
-		$sql = "SELECT * FROM $tbl_block";
284
-		$rs = Database::query($sql);
285
-		if (Database::num_rows($rs) > 0){
286
-			while ($row = Database::fetch_array($rs)) {
287
-				$path = $row['path'];
288
-				if (!in_array($row['path'],$possibleplugins)) {
289
-					$active = 0;
290
-				} else {
291
-					$active = 1;
292
-				}
293
-				// update active
294
-				$upd = "UPDATE $tbl_block SET active = '$active'
279
+        $tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK);
280
+        $possibleplugins = self::getPossibleDashboardPluginsPath();
281
+
282
+        // We check if plugin exists inside directory for updating active field
283
+        $sql = "SELECT * FROM $tbl_block";
284
+        $rs = Database::query($sql);
285
+        if (Database::num_rows($rs) > 0){
286
+            while ($row = Database::fetch_array($rs)) {
287
+                $path = $row['path'];
288
+                if (!in_array($row['path'],$possibleplugins)) {
289
+                    $active = 0;
290
+                } else {
291
+                    $active = 1;
292
+                }
293
+                // update active
294
+                $upd = "UPDATE $tbl_block SET active = '$active'
295 295
 				        WHERE path = '".$row['path']."'";
296
-				Database::query($upd);
297
-			}
298
-		}
299
-
300
-		// get disabled block data
301
-		$block_data = array();
302
-		$sql = "SELECT * FROM $tbl_block WHERE active = 0";
303
-		$rs_block = Database::query($sql);
304
-		if (Database::num_rows($rs_block) > 0) {
305
-			while ($row_block = Database::fetch_array($rs_block)) {
306
-				$block_data[] = $row_block;
307
-			}
308
-		}
309
-
310
-		return $block_data;
311
-
312
-	}
313
-
314
-	/**
315
-	 * get data about enabled dashboard block (stored insise block table)
316
-	 * @param  string	plugin path
317
-	 * @return array 	data
318
-	 */
319
-	public static function get_enabled_dashboard_blocks($path = '')
296
+                Database::query($upd);
297
+            }
298
+        }
299
+
300
+        // get disabled block data
301
+        $block_data = array();
302
+        $sql = "SELECT * FROM $tbl_block WHERE active = 0";
303
+        $rs_block = Database::query($sql);
304
+        if (Database::num_rows($rs_block) > 0) {
305
+            while ($row_block = Database::fetch_array($rs_block)) {
306
+                $block_data[] = $row_block;
307
+            }
308
+        }
309
+
310
+        return $block_data;
311
+
312
+    }
313
+
314
+    /**
315
+     * get data about enabled dashboard block (stored insise block table)
316
+     * @param  string	plugin path
317
+     * @return array 	data
318
+     */
319
+    public static function get_enabled_dashboard_blocks($path = '')
320 320
     {
321
-		$tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK);
322
-		$condition_path = '';
323
-		if (!empty($path)) {
324
-			$path = Database::escape_string($path);
325
-			$condition_path = ' AND path = "'.$path.'" ';
326
-		}
327
-
328
-		$sql = "SELECT * FROM $tbl_block WHERE active = 1 $condition_path ";
329
-		$rs  = Database::query($sql);
330
-		$block_data = array();
331
-		if (Database::num_rows($rs) > 0) {
332
-			while ($row = Database::fetch_array($rs)) {
333
-				$block_data[$row['path']] = $row;
334
-			}
335
-		}
336
-		return $block_data;
337
-	}
338
-
339
-	/**
340
-	 * display user dashboard list
341
-	 * @param int  User id
342
-	 * @return void
343
-	 */
344
-	public static function display_user_dashboard_list($user_id)
321
+        $tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK);
322
+        $condition_path = '';
323
+        if (!empty($path)) {
324
+            $path = Database::escape_string($path);
325
+            $condition_path = ' AND path = "'.$path.'" ';
326
+        }
327
+
328
+        $sql = "SELECT * FROM $tbl_block WHERE active = 1 $condition_path ";
329
+        $rs  = Database::query($sql);
330
+        $block_data = array();
331
+        if (Database::num_rows($rs) > 0) {
332
+            while ($row = Database::fetch_array($rs)) {
333
+                $block_data[$row['path']] = $row;
334
+            }
335
+        }
336
+        return $block_data;
337
+    }
338
+
339
+    /**
340
+     * display user dashboard list
341
+     * @param int  User id
342
+     * @return void
343
+     */
344
+    public static function display_user_dashboard_list($user_id)
345 345
     {
346
-		$enabled_dashboard_plugins = self::get_enabled_dashboard_blocks();
347
-		$user_block_data = self::get_user_block_data($user_id);
348
-
349
-		if (count($enabled_dashboard_plugins) > 0) {
350
-			echo '<div style="margin-top:20px">';
351
-			echo '<div><strong>'.get_lang('SelectBlockForDisplayingInsideBlocksDashboardView').'</strong></div><br />';
352
-			echo '<form name="dashboard_list" method="post" action="index.php?action=store_user_block">';
353
-			echo '<table class="data_table">';
354
-			echo '<tr>';
355
-			echo '<th width="5%">';
356
-			echo get_lang('Enabled');
357
-			echo '</th>';
358
-			echo '<th width="30%">';
359
-			echo get_lang('Name');
360
-			echo '</th>';
361
-			echo '<th width="40%">';
362
-			echo get_lang('Description');
363
-			echo '</th>';
364
-			echo '<th>';
365
-			echo get_lang('ColumnPosition');
366
-			echo '</th>';
367
-			echo '</tr>';
368
-
369
-			// We display all enabled plugins and the checkboxes
370
-			foreach ($enabled_dashboard_plugins as $block) {
371
-
372
-				$path = $block['path'];
373
-				$controller_class = $block['controller'];
374
-				$filename_controller = $path.'.class.php';
375
-				$dashboard_plugin_path = api_get_path(SYS_PLUGIN_PATH).'dashboard/'.$path.'/';
376
-				require_once $dashboard_plugin_path.$filename_controller;
377
-				if (class_exists($controller_class)) {
378
-					$obj_block = new $controller_class($user_id);
379
-
380
-					// check if user is allowed to see the block
381
-					if (method_exists($obj_block, 'is_block_visible_for_user')) {
382
-						$is_block_visible_for_user = $obj_block->is_block_visible_for_user($user_id);
383
-						if (!$is_block_visible_for_user) continue;
384
-					}
385
-
386
-					echo '<tr>';
387
-					// checkboxes
388
-					self::display_user_dashboard_list_checkboxes($user_id, $block['id']);
389
-					echo '<td>'.$block['name'].'</td>';
390
-					echo '<td>'.$block['description'].'</td>';
391
-					echo '<td>
346
+        $enabled_dashboard_plugins = self::get_enabled_dashboard_blocks();
347
+        $user_block_data = self::get_user_block_data($user_id);
348
+
349
+        if (count($enabled_dashboard_plugins) > 0) {
350
+            echo '<div style="margin-top:20px">';
351
+            echo '<div><strong>'.get_lang('SelectBlockForDisplayingInsideBlocksDashboardView').'</strong></div><br />';
352
+            echo '<form name="dashboard_list" method="post" action="index.php?action=store_user_block">';
353
+            echo '<table class="data_table">';
354
+            echo '<tr>';
355
+            echo '<th width="5%">';
356
+            echo get_lang('Enabled');
357
+            echo '</th>';
358
+            echo '<th width="30%">';
359
+            echo get_lang('Name');
360
+            echo '</th>';
361
+            echo '<th width="40%">';
362
+            echo get_lang('Description');
363
+            echo '</th>';
364
+            echo '<th>';
365
+            echo get_lang('ColumnPosition');
366
+            echo '</th>';
367
+            echo '</tr>';
368
+
369
+            // We display all enabled plugins and the checkboxes
370
+            foreach ($enabled_dashboard_plugins as $block) {
371
+
372
+                $path = $block['path'];
373
+                $controller_class = $block['controller'];
374
+                $filename_controller = $path.'.class.php';
375
+                $dashboard_plugin_path = api_get_path(SYS_PLUGIN_PATH).'dashboard/'.$path.'/';
376
+                require_once $dashboard_plugin_path.$filename_controller;
377
+                if (class_exists($controller_class)) {
378
+                    $obj_block = new $controller_class($user_id);
379
+
380
+                    // check if user is allowed to see the block
381
+                    if (method_exists($obj_block, 'is_block_visible_for_user')) {
382
+                        $is_block_visible_for_user = $obj_block->is_block_visible_for_user($user_id);
383
+                        if (!$is_block_visible_for_user) continue;
384
+                    }
385
+
386
+                    echo '<tr>';
387
+                    // checkboxes
388
+                    self::display_user_dashboard_list_checkboxes($user_id, $block['id']);
389
+                    echo '<td>'.$block['name'].'</td>';
390
+                    echo '<td>'.$block['description'].'</td>';
391
+                    echo '<td>
392 392
                             <select class="selectpicker show-tick form-control" name="columns['.$block['id'].']">
393 393
                             <option value="1" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==1?'selected':'').' >1</option>
394 394
                             <option value="2" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==2?'selected':'').' >2</option>
395 395
                             </select>
396 396
                           </td>';
397
-					echo '</tr>';
398
-				} else {
399
-					echo Display::tag('tr',  Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3')));
400
-				}
401
-			}
402
-
403
-			echo '</table>';
404
-			echo '<div class="row"><div class="col-md-12">';
405
-			echo '<button class="btn btn-default" type="submit" name="submit_dashboard_list" value="'.get_lang('EnableDashboardBlock').'"><em class="fa fa-check-square"></em> '.
397
+                    echo '</tr>';
398
+                } else {
399
+                    echo Display::tag('tr',  Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3')));
400
+                }
401
+            }
402
+
403
+            echo '</table>';
404
+            echo '<div class="row"><div class="col-md-12">';
405
+            echo '<button class="btn btn-default" type="submit" name="submit_dashboard_list" value="'.get_lang('EnableDashboardBlock').'"><em class="fa fa-check-square"></em> '.
406 406
                 get_lang('EnableDashboardBlock').'</button></form>';
407
-			echo '</div></div>';
408
-		} else {
409
-			echo '<div style="margin-top:20px">'.get_lang('ThereAreNoEnabledDashboardPlugins').'</div>';
410
-			if (api_is_platform_admin()) {
411
-				echo '<a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">'.
407
+            echo '</div></div>';
408
+        } else {
409
+            echo '<div style="margin-top:20px">'.get_lang('ThereAreNoEnabledDashboardPlugins').'</div>';
410
+            if (api_is_platform_admin()) {
411
+                echo '<a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">'.
412 412
                     get_lang('ConfigureDashboardPlugin').'</a>';
413
-			}
414
-		}
415
-	}
416
-
417
-	/**
418
-	 * display checkboxes for user dashboard list
419
-	 * @param int 	User id
420
-	 * @param int	Block id
421
-	 * @return void
422
-	 */
423
-	public static function display_user_dashboard_list_checkboxes($user_id, $block_id) {
424
-
425
-		$user_id = intval($user_id);
426
-		$user_block_data = self::get_user_block_data($user_id);
427
-		$enabled_blocks_id = array_keys($user_block_data);
428
-
429
-		$checked = '';
430
-		if (in_array($block_id, $enabled_blocks_id)) {
431
-			$checked = "checked";
432
-		}
433
-
434
-		echo "<td align=\"center\">";
435
-		echo '<input type="checkbox" name="enabled_blocks['.$block_id.']" value="true" '.$checked.'/>';
436
-		echo "</td>";
437
-	}
438
-
439
-	/**
440
-	 * This function store enabled blocks id with its column position (block_id1:colum;block_id2:colum; ...) inside extra user fields
441
-	 * @param int User id
442
-	 * @param array selected blocks
443
-	 * @param array columns position
444
-	 * @return bool
445
-	 */
446
-	public static function store_user_blocks($user_id, $enabled_blocks, $columns) {
447
-		$selected_blocks_id  = array();
448
-		if (is_array($enabled_blocks) && count($enabled_blocks) > 0) {
449
-			$selected_blocks_id = array_keys($enabled_blocks);
450
-		}
451
-
452
-		// build data for storing inside extra user field
453
-		$fname = 'dashboard';
454
-		$fvalue = array();
455
-		foreach ($selected_blocks_id as $block_id) {
456
-			$fvalue[] = $block_id.':'.$columns[$block_id];
457
-		}
413
+            }
414
+        }
415
+    }
416
+
417
+    /**
418
+     * display checkboxes for user dashboard list
419
+     * @param int 	User id
420
+     * @param int	Block id
421
+     * @return void
422
+     */
423
+    public static function display_user_dashboard_list_checkboxes($user_id, $block_id) {
424
+
425
+        $user_id = intval($user_id);
426
+        $user_block_data = self::get_user_block_data($user_id);
427
+        $enabled_blocks_id = array_keys($user_block_data);
428
+
429
+        $checked = '';
430
+        if (in_array($block_id, $enabled_blocks_id)) {
431
+            $checked = "checked";
432
+        }
433
+
434
+        echo "<td align=\"center\">";
435
+        echo '<input type="checkbox" name="enabled_blocks['.$block_id.']" value="true" '.$checked.'/>';
436
+        echo "</td>";
437
+    }
438
+
439
+    /**
440
+     * This function store enabled blocks id with its column position (block_id1:colum;block_id2:colum; ...) inside extra user fields
441
+     * @param int User id
442
+     * @param array selected blocks
443
+     * @param array columns position
444
+     * @return bool
445
+     */
446
+    public static function store_user_blocks($user_id, $enabled_blocks, $columns) {
447
+        $selected_blocks_id  = array();
448
+        if (is_array($enabled_blocks) && count($enabled_blocks) > 0) {
449
+            $selected_blocks_id = array_keys($enabled_blocks);
450
+        }
451
+
452
+        // build data for storing inside extra user field
453
+        $fname = 'dashboard';
454
+        $fvalue = array();
455
+        foreach ($selected_blocks_id as $block_id) {
456
+            $fvalue[] = $block_id.':'.$columns[$block_id];
457
+        }
458 458
         $upd_extra_field = UserManager::update_extra_field_value(
459 459
             $user_id,
460 460
             $fname,
461 461
             $fvalue
462 462
         );
463 463
 
464
-		return $upd_extra_field;
464
+        return $upd_extra_field;
465 465
 
466
-	}
466
+    }
467 467
 
468
-	/**
469
-	 * This function get user block data (block id with its number of column) from extra user data
470
-	 * @param int  		User id
471
-	 * @return array  	data (block_id,column)
472
-	 */
473
-	public static function get_user_block_data($user_id)
468
+    /**
469
+     * This function get user block data (block id with its number of column) from extra user data
470
+     * @param int  		User id
471
+     * @return array  	data (block_id,column)
472
+     */
473
+    public static function get_user_block_data($user_id)
474 474
     {
475
-		$user_id = intval($user_id);
476
-		$field_variable = 'dashboard';
477
-		$extra_user_data = UserManager::get_extra_user_data_by_field($user_id, $field_variable);
478
-		$extra_user_data = explode(';',$extra_user_data[$field_variable]);
479
-		$data = array();
480
-		foreach ($extra_user_data as $extra) {
481
-			$split_extra = explode(':',$extra);
482
-			if (!empty($split_extra)) {
483
-				$block_id = $split_extra[0];
484
-				$column = isset($split_extra[1]) ? $split_extra[1] : null;
485
-				$data[$block_id] = array('block_id' => $block_id, 'column' => $column);
486
-			}
487
-		}
488
-
489
-		return $data;
490
-	}
491
-
492
-	/**
493
-	 * This function update extra user blocks data after closing a dashboard block
494
-	 * @param int 		User id
495
-	 * @param string	plugin path
496
-	 * @param integer $user_id
497
-	 * @return bool
498
-	 */
499
-	public static function close_user_block($user_id, $path)
475
+        $user_id = intval($user_id);
476
+        $field_variable = 'dashboard';
477
+        $extra_user_data = UserManager::get_extra_user_data_by_field($user_id, $field_variable);
478
+        $extra_user_data = explode(';',$extra_user_data[$field_variable]);
479
+        $data = array();
480
+        foreach ($extra_user_data as $extra) {
481
+            $split_extra = explode(':',$extra);
482
+            if (!empty($split_extra)) {
483
+                $block_id = $split_extra[0];
484
+                $column = isset($split_extra[1]) ? $split_extra[1] : null;
485
+                $data[$block_id] = array('block_id' => $block_id, 'column' => $column);
486
+            }
487
+        }
488
+
489
+        return $data;
490
+    }
491
+
492
+    /**
493
+     * This function update extra user blocks data after closing a dashboard block
494
+     * @param int 		User id
495
+     * @param string	plugin path
496
+     * @param integer $user_id
497
+     * @return bool
498
+     */
499
+    public static function close_user_block($user_id, $path)
500 500
     {
501
-		$enabled_dashboard_blocks = self::get_enabled_dashboard_blocks($path);
502
-		$user_block_data = self::get_user_block_data($user_id);
503
-
504
-		foreach ($enabled_dashboard_blocks as $enabled_block) {
505
-			unset($user_block_data[$enabled_block['id']]);
506
-		}
507
-
508
-		// get columns and blocks id for updating extra user data
509
-		$columns = array();
510
-		$user_blocks_id = array();
511
-		foreach ($user_block_data as $data) {
512
-			$user_blocks_id[$data['block_id']] = true;
513
-			$columns[$data['block_id']] = $data['column'];
514
-		}
515
-
516
-		// update extra user blocks data
517
-		$upd_extra_field = self::store_user_blocks($user_id, $user_blocks_id, $columns);
518
-
519
-		return $upd_extra_field;
520
-	}
521
-
522
-	/**
523
-	 * get links for styles from dashboard plugins
524
-	 * @return string   links
525
-	 */
526
-	public static function get_links_for_styles_from_dashboard_plugins() {
527
-
528
-		return '<link rel="stylesheet" href="'.api_get_path(WEB_PLUGIN_PATH).'dashboard/css/default.css" type="text/css" />'.PHP_EOL;
529
-	}
501
+        $enabled_dashboard_blocks = self::get_enabled_dashboard_blocks($path);
502
+        $user_block_data = self::get_user_block_data($user_id);
503
+
504
+        foreach ($enabled_dashboard_blocks as $enabled_block) {
505
+            unset($user_block_data[$enabled_block['id']]);
506
+        }
507
+
508
+        // get columns and blocks id for updating extra user data
509
+        $columns = array();
510
+        $user_blocks_id = array();
511
+        foreach ($user_block_data as $data) {
512
+            $user_blocks_id[$data['block_id']] = true;
513
+            $columns[$data['block_id']] = $data['column'];
514
+        }
515
+
516
+        // update extra user blocks data
517
+        $upd_extra_field = self::store_user_blocks($user_id, $user_blocks_id, $columns);
518
+
519
+        return $upd_extra_field;
520
+    }
521
+
522
+    /**
523
+     * get links for styles from dashboard plugins
524
+     * @return string   links
525
+     */
526
+    public static function get_links_for_styles_from_dashboard_plugins() {
527
+
528
+        return '<link rel="stylesheet" href="'.api_get_path(WEB_PLUGIN_PATH).'dashboard/css/default.css" type="text/css" />'.PHP_EOL;
529
+    }
530 530
 
531 531
 }
Please login to merge, or discard this patch.