Completed
Push — 1.11.x ( 772bf4...b5113d )
by José
28:31
created
main/inc/lib/search/ChamiloQuery.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
  * @param   array     extra           Extra queries to join with. Optional
19 19
  * @return  array
20 20
  */
21
-function chamilo_query_query($query_string, $offset=0, $length=10, $extra=NULL) {
21
+function chamilo_query_query($query_string, $offset = 0, $length = 10, $extra = NULL) {
22 22
     list($count, $results) = xapian_query($query_string, NULL, $offset, $length, $extra);
23 23
     return chamilo_preprocess_results($results);
24 24
 }
25 25
 
26
-function chamilo_query_simple_query($query_string, $offset=0, $length=10, $extra=NULL) {
26
+function chamilo_query_simple_query($query_string, $offset = 0, $length = 10, $extra = NULL) {
27 27
     return xapian_query($query_string, NULL, $offset, $length, $extra);
28 28
 }
29 29
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 function chamilo_preprocess_results($results) {
43 43
     // group by toolid
44 44
     $results_by_tool = array();
45
-    if (count($results)>0) {
45
+    if (count($results) > 0) {
46 46
 
47 47
 	    foreach ($results as $key => $row) {
48 48
 	        $results_by_tool[$row['toolid']][] = $row;
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 
51 51
 	    $processed_results = array();
52 52
 	    foreach ($results_by_tool as $toolid => $rows) {
53
-	        $tool_processor_class = $toolid .'_processor';
54
-	        $tool_processor_path = api_get_path(LIBRARY_PATH) .'search/tool_processors/'. $tool_processor_class .'.class.php';
53
+	        $tool_processor_class = $toolid.'_processor';
54
+	        $tool_processor_path = api_get_path(LIBRARY_PATH).'search/tool_processors/'.$tool_processor_class.'.class.php';
55 55
 	        if (file_exists($tool_processor_path)) {
56 56
 	            require_once($tool_processor_path);
57 57
 	            $tool_processor = new $tool_processor_class($rows);
@@ -71,6 +71,6 @@  discard block
 block discarded – undo
71 71
  * @param string $op
72 72
  * @return XapianQuery query joined
73 73
  */
74
-function chamilo_join_queries($query1, $query2=NULL, $op='or') {
74
+function chamilo_join_queries($query1, $query2 = NULL, $op = 'or') {
75 75
 	return xapian_join_queries($query1, $query2, $op);
76 76
 }
Please login to merge, or discard this patch.
main/inc/lib/baker.lib.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
             foreach (array_keys($this->_chunks[$type]) as $typekey) {
52 52
                 list($key, $data) = explode("\0", $this->_chunks[$type][$typekey]);
53 53
                 if (strcmp($key, $check) == 0) {
54
-                    echo 'Key "' . $check . '" already exists in "' . $type . '" chunk.';
54
+                    echo 'Key "'.$check.'" already exists in "'.$type.'" chunk.';
55 55
                     return false;
56 56
                 }
57 57
             }
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function addChunk($chunkType, $key, $value) {
72 72
         
73
-        $chunkData = $key . "\0" . $value;
74
-        $crc = pack("N", crc32($chunkType . $chunkData));
73
+        $chunkData = $key."\0".$value;
74
+        $crc = pack("N", crc32($chunkType.$chunkData));
75 75
         $len = pack("N", strlen($chunkData));
76 76
         
77
-        $newChunk = $len . $chunkType . $chunkData . $crc;
77
+        $newChunk = $len.$chunkType.$chunkData.$crc;
78 78
         $result = substr($this->_contents, 0, $this->_size - 12)
79 79
                 . $newChunk
80 80
                 . substr($this->_contents, $this->_size - 12, 12);
@@ -92,30 +92,30 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function removeChunks($chunkType, $key, $png) {
94 94
         // Read the magic bytes and verify
95
-        $retval = substr($png,0,8);
95
+        $retval = substr($png, 0, 8);
96 96
         $ipos = 8;
97 97
         if ($retval != "\x89PNG\x0d\x0a\x1a\x0a")
98 98
             throw new Exception('Is not a valid PNG image');
99 99
         // Loop through the chunks. Byte 0-3 is length, Byte 4-7 is type
100
-        $chunkHeader = substr($png,$ipos,8);
100
+        $chunkHeader = substr($png, $ipos, 8);
101 101
         $ipos = $ipos + 8;
102 102
         while ($chunkHeader) {
103 103
             // Extract length and type from binary data
104 104
             $chunk = @unpack('Nsize/a4type', $chunkHeader);
105 105
             $skip = false;
106
-            if ( $chunk['type'] == $chunkType ) {
107
-                $data = substr($png,$ipos,$chunk['size']);
106
+            if ($chunk['type'] == $chunkType) {
107
+                $data = substr($png, $ipos, $chunk['size']);
108 108
                 $sections = explode("\0", $data);
109 109
                 print_r($sections);
110
-                if ( $sections[0] == $key ) $skip = true;
110
+                if ($sections[0] == $key) $skip = true;
111 111
             }
112 112
             // Extract the data and the CRC
113
-            $data = substr($png,$ipos,$chunk['size']+4);
113
+            $data = substr($png, $ipos, $chunk['size'] + 4);
114 114
             $ipos = $ipos + $chunk['size'] + 4;
115 115
             // Add in the header, data, and CRC
116
-            if ( ! $skip ) $retval = $retval . $chunkHeader . $data;
116
+            if (!$skip) $retval = $retval.$chunkHeader.$data;
117 117
             // Read next chunk header
118
-            $chunkHeader = substr($png,$ipos,8);
118
+            $chunkHeader = substr($png, $ipos, 8);
119 119
             $ipos = $ipos + 8;
120 120
         }
121 121
         return $retval;
@@ -131,34 +131,34 @@  discard block
 block discarded – undo
131 131
      * If there is PNG information that matches the key an array is returned
132 132
      * 
133 133
      */
134
-    public function extractBadgeInfo($png, $key='openbadges') {
134
+    public function extractBadgeInfo($png, $key = 'openbadges') {
135 135
         // Read the magic bytes and verify
136
-        $retval = substr($png,0,8);
136
+        $retval = substr($png, 0, 8);
137 137
         $ipos = 8;
138 138
         if ($retval != "\x89PNG\x0d\x0a\x1a\x0a") {
139 139
             return false;
140 140
         }
141 141
 
142 142
         // Loop through the chunks. Byte 0-3 is length, Byte 4-7 is type
143
-        $chunkHeader = substr($png,$ipos,8);
143
+        $chunkHeader = substr($png, $ipos, 8);
144 144
         $ipos = $ipos + 8;
145 145
         while ($chunkHeader) {
146 146
             // Extract length and type from binary data
147 147
             $chunk = @unpack('Nsize/a4type', $chunkHeader);
148 148
             $skip = false;
149 149
             if ($chunk['type'] == 'tEXt') {
150
-                $data = substr($png,$ipos,$chunk['size']);
150
+                $data = substr($png, $ipos, $chunk['size']);
151 151
                 $sections = explode("\0", $data);
152 152
                 if ($sections[0] == $key) {
153 153
                    return $sections;
154 154
                 }
155 155
             }
156 156
             // Extract the data and the CRC
157
-            $data = substr($png,$ipos,$chunk['size']+4);
157
+            $data = substr($png, $ipos, $chunk['size'] + 4);
158 158
             $ipos = $ipos + $chunk['size'] + 4;
159 159
 
160 160
             // Read next chunk header
161
-            $chunkHeader = substr($png,$ipos,8);
161
+            $chunkHeader = substr($png, $ipos, 8);
162 162
             $ipos = $ipos + 8;
163 163
         }
164 164
     }
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Element/receivers.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,9 +41,9 @@
 block discarded – undo
41 41
 	 */
42 42
 	function _createElements()
43 43
 	{
44
-		$this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('Everybody'), '0', array ('onclick' => 'javascript:receivers_hide(\'receivers_to\')'));
44
+		$this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('Everybody'), '0', array('onclick' => 'javascript:receivers_hide(\'receivers_to\')'));
45 45
 		$this->_elements[0]->setChecked(true);
46
-		$this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('SelectGroupsUsers'), '1', array ('onclick' => 'javascript:receivers_show(\'receivers_to\')'));
46
+		$this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('SelectGroupsUsers'), '1', array('onclick' => 'javascript:receivers_show(\'receivers_to\')'));
47 47
 		$this->_elements[] = new HTML_QuickForm_advmultiselect('to', '', $this->receivers);
48 48
 		$this->_elements[2]->setSelected($this->receivers_selected);
49 49
 	}
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Element/DateRangePicker.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@
 block discarded – undo
88 88
         }
89 89
 
90 90
         $timePicker = 'true';
91
-        $timePickerValue =  $this->getAttribute('timePicker');
91
+        $timePickerValue = $this->getAttribute('timePicker');
92 92
         if (!empty($timePickerValue)) {
93 93
             $timePicker = $timePickerValue;
94 94
         }
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Rule/CompareDateTimeText.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
                 return true;
22 22
             }
23 23
         }
24
-		$result =  parent::validate(array($datetime1, $datetime2), $operator);
24
+		$result = parent::validate(array($datetime1, $datetime2), $operator);
25 25
         return $result;
26 26
     }
27 27
 }
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Rule/HTML.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
      */
17 17
     function validate($html, $mode = NO_HTML)
18 18
     {
19
-        $allowed_tags = self::get_allowed_tags ($mode, $fullpage);
19
+        $allowed_tags = self::get_allowed_tags($mode, $fullpage);
20 20
         $cleaned_html = kses($html, $allowed_tags);
21 21
         return $html == $cleaned_html;
22 22
     }
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         // Include the allowed tags.
34 34
         //include(dirname(__FILE__).'/allowed_tags.inc.php');
35 35
         global $allowed_tags_student, $allowed_tags_student_full_page, $allowed_tags_teacher, $allowed_tags_teacher_full_page;
36
-        switch($mode)
36
+        switch ($mode)
37 37
         {
38 38
             case NO_HTML:
39 39
                 return array();
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Rule/MultipleRequired.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@
 block discarded – undo
27 27
      */
28 28
     function validate($value, $options = null)
29 29
     {
30
-    	if(is_array($value))
30
+    	if (is_array($value))
31 31
     	{
32
-    		$value = implode(null,$value);
32
+    		$value = implode(null, $value);
33 33
     	}
34
-        if ((string)$value == '') {
34
+        if ((string) $value == '') {
35 35
             return false;
36 36
         }
37 37
         return true;
Please login to merge, or discard this patch.
main/inc/lib/events_email.class.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
                 // If the mail only need to be send once (we know that thanks to the events.conf), we log it in the table
126 126
                 if ($event_config[$event_name]["sending_mail_once"]) {
127
-                    $sql = 'INSERT INTO ' . Database::get_main_table(TABLE_EVENT_SENT) . ' (user_from, user_to, event_type_name)
127
+                    $sql = 'INSERT INTO '.Database::get_main_table(TABLE_EVENT_SENT).' (user_from, user_to, event_type_name)
128 128
                             VALUES ('.$event_data["user_id"].', '.$id.' ,"'.Database::escape_string($event_name).'")
129 129
                     ';
130 130
                     Database::query($sql);
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
         // Second, we send to people linked to the event
136 136
         // So, we get everyone
137 137
         $sql = 'SELECT u.user_id, u.language, u.email, u.firstname, u.lastname
138
-                FROM ' . Database::get_main_table(TABLE_EVENT_TYPE_REL_USER) . ' ue
138
+                FROM ' . Database::get_main_table(TABLE_EVENT_TYPE_REL_USER).' ue
139 139
                 INNER JOIN '.Database::get_main_table(TABLE_MAIN_USER).' u ON u.user_id = ue.user_id
140
-                WHERE event_type_name = "' . $event_name . '"';
140
+                WHERE event_type_name = "' . $event_name.'"';
141 141
         $result = Database::store_result(Database::query($sql), 'ASSOC');
142 142
         // for each of the linked users
143 143
         foreach ($result as $key => $value) {
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 
178 178
             // If the mail only need to be send once (we know that thanks to the events.conf, we log it in the table
179 179
             if ($event_config[$event_name]["sending_mail_once"]) {
180
-                $sql = 'INSERT INTO ' . Database::get_main_table(TABLE_EVENT_SENT) . '
180
+                $sql = 'INSERT INTO '.Database::get_main_table(TABLE_EVENT_SENT).'
181 181
                     (user_from, user_to, event_type_name)
182 182
                     VALUES ('.$event_data["user_id"].', '.$value["user_id"].' , "'.Database::escape_string($event_name).'");
183 183
                     ';
@@ -202,16 +202,16 @@  discard block
 block discarded – undo
202 202
         $current_language = api_get_interface_language();
203 203
 
204 204
         $sql = 'SELECT COUNT(*) as total
205
-                FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE) . ' em
206
-                INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE) . ' l
205
+                FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE).' em
206
+                INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE).' l
207 207
                 ON em.language_id = l.id
208 208
                 WHERE
209
-                    em.event_type_name = "' . $event_name . '" and
209
+                    em.event_type_name = "' . $event_name.'" and
210 210
                     l.dokeos_folder = "'.$current_language.'" and
211 211
                     em.activated = 1';
212 212
 
213 213
         $exists = Database::store_result(Database::query($sql), 'ASSOC');
214
-        if ($exists[0]["total"])  {
214
+        if ($exists[0]["total"]) {
215 215
             return true;
216 216
         } else {
217 217
             return false;
@@ -228,12 +228,12 @@  discard block
 block discarded – undo
228 228
     private static function getMessage($event_name, $language)
229 229
     {
230 230
         $sql = 'SELECT message, subject, l.dokeos_folder
231
-                FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE) . ' em
232
-                INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE) . ' l
231
+                FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE).' em
232
+                INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE).' l
233 233
                 ON em.language_id = l.id
234 234
                 WHERE
235
-                    em.event_type_name = "' . $event_name . '" AND
236
-                    (l.dokeos_folder = "' . $language . '" OR l.dokeos_folder = "english") AND
235
+                    em.event_type_name = "' . $event_name.'" AND
236
+                    (l.dokeos_folder = "' . $language.'" OR l.dokeos_folder = "english") AND
237 237
                     em.message <> ""
238 238
                 ';
239 239
         return Database::store_result(Database::query($sql), 'ASSOC');
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
     private static function formatMessage(&$message, &$subject, $event_config, $event_name, &$event_data)
275 275
     {
276 276
         foreach ($event_config[$event_name]["available_keyvars"] as $key => $word) {
277
-            $message = str_replace('((' . $key . '))', $event_data[$word], $message);
278
-            $subject = str_replace('((' . $key . '))', $event_data[$word], $subject);
277
+            $message = str_replace('(('.$key.'))', $event_data[$word], $message);
278
+            $subject = str_replace('(('.$key.'))', $event_data[$word], $subject);
279 279
         }
280 280
     }
281 281
 }
Please login to merge, or discard this patch.
main/inc/lib/security.lib.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             $rel_path = '/'.$rel_path;
92 92
         }
93 93
         $abs_path = $current_path.$rel_path;
94
-        $true_path=str_replace("\\", '/', realpath($abs_path));
94
+        $true_path = str_replace("\\", '/', realpath($abs_path));
95 95
         $found = strpos($true_path.'/', $checker_path);
96 96
         if ($found === 0) {
97 97
             return true;
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
         }
322 322
 
323 323
         if ($user_status == COURSEMANAGERLOWSECURITY) {
324
-            return $var;  // No filtering.
324
+            return $var; // No filtering.
325 325
         }
326 326
 
327 327
         static $purifier = array();
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
             }
345 345
 
346 346
             // Shows _target attribute in anchors
347
-            $config->set('Attr.AllowedFrameTargets', array('_blank','_top','_self', '_parent'));
347
+            $config->set('Attr.AllowedFrameTargets', array('_blank', '_top', '_self', '_parent'));
348 348
 
349 349
             if ($user_status == STUDENT) {
350 350
                 global $allowed_html_student;
Please login to merge, or discard this patch.