Completed
Push — 1.10.x ( 4c5f4c...61bcd5 )
by Yannick
419:40 queued 371:43
created
main/inc/lib/notebook.lib.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         return "<script>
30 30
 				function confirmation (name)
31 31
 				{
32
-					if (confirm(\" " . get_lang("NoteConfirmDelete") . " \"+ name + \" ?\"))
32
+					if (confirm(\" " . get_lang("NoteConfirmDelete")." \"+ name + \" ?\"))
33 33
 						{return true;}
34 34
 					else
35 35
 						{return false;}
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
                 description 		AS note_comment,
108 108
                 session_id			AS session_id
109 109
                FROM $t_notebook
110
-               WHERE c_id = $course_id AND notebook_id = '" . intval($notebook_id) . "' ";
110
+               WHERE c_id = $course_id AND notebook_id = '".intval($notebook_id)."' ";
111 111
         $result = Database::query($sql);
112 112
         if (Database::num_rows($result) != 1) {
113 113
             return array();
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
         $sql = "DELETE FROM $t_notebook
182 182
                 WHERE
183 183
                     c_id = $course_id AND
184
-                    notebook_id='" . intval($notebook_id) . "' AND
185
-                    user_id = '" . api_get_user_id() . "'";
184
+                    notebook_id='".intval($notebook_id)."' AND
185
+                    user_id = '" . api_get_user_id()."'";
186 186
         $result = Database::query($sql);
187 187
         $affected_rows = Database::affected_rows($result);
188 188
         if ($affected_rows != 1) {
@@ -220,22 +220,22 @@  discard block
 block discarded – undo
220 220
         echo '<div class="actions">';
221 221
         if (!api_is_anonymous()) {
222 222
             if (api_get_session_id() == 0)
223
-                echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' .
224
-                    Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
223
+                echo '<a href="index.php?'.api_get_cidreq().'&action=addnote">'.
224
+                    Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32').'</a>';
225 225
             elseif (api_is_allowed_to_session_edit(false, true)) {
226
-                echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' .
227
-                    Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
226
+                echo '<a href="index.php?'.api_get_cidreq().'&action=addnote">'.
227
+                    Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32').'</a>';
228 228
             }
229 229
         } else {
230
-            echo '<a href="javascript:void(0)">' . Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
230
+            echo '<a href="javascript:void(0)">'.Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32').'</a>';
231 231
         }
232 232
 
233
-        echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=creation_date&direction=' . $link_sort_direction . '">' .
234
-            Display::return_icon('notes_order_by_date_new.png', get_lang('OrderByCreationDate'), '', '32') . '</a>';
235
-        echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=update_date&direction=' . $link_sort_direction . '">' .
236
-            Display::return_icon('notes_order_by_date_mod.png', get_lang('OrderByModificationDate'), '', '32') . '</a>';
237
-        echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=title&direction=' . $link_sort_direction . '">' .
238
-            Display::return_icon('notes_order_by_title.png', get_lang('OrderByTitle'), '', '32') . '</a>';
233
+        echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=creation_date&direction='.$link_sort_direction.'">'.
234
+            Display::return_icon('notes_order_by_date_new.png', get_lang('OrderByCreationDate'), '', '32').'</a>';
235
+        echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=update_date&direction='.$link_sort_direction.'">'.
236
+            Display::return_icon('notes_order_by_date_mod.png', get_lang('OrderByModificationDate'), '', '32').'</a>';
237
+        echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=title&direction='.$link_sort_direction.'">'.
238
+            Display::return_icon('notes_order_by_title.png', get_lang('OrderByTitle'), '', '32').'</a>';
239 239
         echo '</div>';
240 240
 
241 241
         if (!isset($_SESSION['notebook_view']) || !in_array($_SESSION['notebook_view'], array('creation_date', 'update_date', 'title'))) {
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
         $t_notebook = Database :: get_course_table(TABLE_NOTEBOOK);
247 247
         $order_by = "";
248 248
         if ($_SESSION['notebook_view'] == 'creation_date' || $_SESSION['notebook_view'] == 'update_date') {
249
-            $order_by = " ORDER BY " . $_SESSION['notebook_view'] . " $sort_direction ";
249
+            $order_by = " ORDER BY ".$_SESSION['notebook_view']." $sort_direction ";
250 250
         } else {
251
-            $order_by = " ORDER BY " . $_SESSION['notebook_view'] . " $sort_direction ";
251
+            $order_by = " ORDER BY ".$_SESSION['notebook_view']." $sort_direction ";
252 252
         }
253 253
 
254 254
         //condition for the session
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         $sql = "SELECT * FROM $t_notebook
262 262
                 WHERE
263 263
                     c_id = $course_id AND
264
-                    user_id = '" . api_get_user_id() . "'
264
+                    user_id = '".api_get_user_id()."'
265 265
                     $condition_session
266 266
                     $cond_extra $order_by
267 267
                 ";
@@ -274,18 +274,18 @@  discard block
 block discarded – undo
274 274
 
275 275
             $updateValue = '';
276 276
             if ($row['update_date'] <> $row['creation_date']) {
277
-                $updateValue = ', ' . get_lang('UpdateDate') . ': ' . date_to_str_ago($update_date) . '&nbsp;&nbsp;<span class="dropbox_date">' . $update_date . '</span>';
277
+                $updateValue = ', '.get_lang('UpdateDate').': '.date_to_str_ago($update_date).'&nbsp;&nbsp;<span class="dropbox_date">'.$update_date.'</span>';
278 278
             }
279 279
 
280
-            $actions = '<a href="' . api_get_self() . '?action=editnote&notebook_id=' . $row['notebook_id'] . '">' .
281
-                Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>';
282
-            $actions .= '<a href="' . api_get_self() . '?action=deletenote&notebook_id=' . $row['notebook_id'] . '" onclick="return confirmation(\'' . $row['title'] . '\');">' .
283
-                Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
280
+            $actions = '<a href="'.api_get_self().'?action=editnote&notebook_id='.$row['notebook_id'].'">'.
281
+                Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
282
+            $actions .= '<a href="'.api_get_self().'?action=deletenote&notebook_id='.$row['notebook_id'].'" onclick="return confirmation(\''.$row['title'].'\');">'.
283
+                Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
284 284
 
285 285
             echo Display::panel(
286 286
                 $row['description'],
287
-                $row['title'] . $session_img.' <div class="pull-right">'.$actions.'</div>',
288
-                get_lang('CreationDate') . ': ' . date_to_str_ago($creation_date) . '&nbsp;&nbsp;<span class="dropbox_date">' . $creation_date . $updateValue."</span>"
287
+                $row['title'].$session_img.' <div class="pull-right">'.$actions.'</div>',
288
+                get_lang('CreationDate').': '.date_to_str_ago($creation_date).'&nbsp;&nbsp;<span class="dropbox_date">'.$creation_date.$updateValue."</span>"
289 289
             );
290 290
         }
291 291
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -219,10 +219,10 @@
 block discarded – undo
219 219
         // action links
220 220
         echo '<div class="actions">';
221 221
         if (!api_is_anonymous()) {
222
-            if (api_get_session_id() == 0)
223
-                echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' .
222
+            if (api_get_session_id() == 0) {
223
+                            echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' .
224 224
                     Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
225
-            elseif (api_is_allowed_to_session_edit(false, true)) {
225
+            } elseif (api_is_allowed_to_session_edit(false, true)) {
226 226
                 echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' .
227 227
                     Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
228 228
             }
Please login to merge, or discard this patch.
main/inc/lib/legal.lib.php 3 patches
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -15,15 +15,15 @@  discard block
 block discarded – undo
15 15
     {
16 16
     }
17 17
 
18
-	/**
19
-	 * Add a new Term and Condition
20
-	 * @param int $language language id
21
-	 * @param string $content content
22
-	 * @param int $type term and condition type (0 or 1)
23
-	 * @param string $changes explain changes
24
-	 * @return boolean success
25
-	 */
26
-	public static function add($language, $content, $type, $changes)
18
+    /**
19
+     * Add a new Term and Condition
20
+     * @param int $language language id
21
+     * @param string $content content
22
+     * @param int $type term and condition type (0 or 1)
23
+     * @param string $changes explain changes
24
+     * @return boolean success
25
+     */
26
+    public static function add($language, $content, $type, $changes)
27 27
     {
28 28
         $legal_table = Database::get_main_table(TABLE_MAIN_LEGAL);
29 29
         $last = self::get_last_condition($language);
@@ -60,62 +60,62 @@  discard block
 block discarded – undo
60 60
         }
61 61
     }
62 62
 
63
-	public static function delete($id)
63
+    public static function delete($id)
64 64
     {
65
-		/*
65
+        /*
66 66
 		$legal_table = Database::get_main_table(TABLE_MAIN_LEGAL);
67 67
 		$id = intval($id);
68 68
 		$sql = "DELETE FROM $legal_table WHERE legal_id = '".$id."'";
69 69
 		*/
70
-	}
71
-
72
-	/**
73
-	 * Gets the last version of a Term and condition by language
74
-	 * @param int $language language id
75
-	 * @return array all the info of a Term and condition
76
-	 */
77
-	public static function get_last_condition_version($language)
70
+    }
71
+
72
+    /**
73
+     * Gets the last version of a Term and condition by language
74
+     * @param int $language language id
75
+     * @return array all the info of a Term and condition
76
+     */
77
+    public static function get_last_condition_version($language)
78 78
     {
79
-		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
80
-		$language= Database::escape_string($language);
81
-		$sql = "SELECT version FROM $legal_conditions_table
79
+        $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
80
+        $language= Database::escape_string($language);
81
+        $sql = "SELECT version FROM $legal_conditions_table
82 82
 		        WHERE language_id = '".$language."'
83 83
 		        ORDER BY legal_id DESC LIMIT 1 ";
84
-		$result = Database::query($sql);
85
-		$row = Database::fetch_array($result);
84
+        $result = Database::query($sql);
85
+        $row = Database::fetch_array($result);
86 86
         if (Database::num_rows($result) > 0) {
87 87
 
88
-			return $row['version'];
89
-		} else {
88
+            return $row['version'];
89
+        } else {
90 90
 
91
-			return 0;
92
-		}
93
-	}
91
+            return 0;
92
+        }
93
+    }
94 94
 
95
-	/**
96
-	 * Gets the data of a Term and condition by language
97
-	 * @param int $language language id
98
-	 * @return array all the info of a Term and condition
99
-	 */
100
-	public static function get_last_condition ($language)
95
+    /**
96
+     * Gets the data of a Term and condition by language
97
+     * @param int $language language id
98
+     * @return array all the info of a Term and condition
99
+     */
100
+    public static function get_last_condition ($language)
101 101
     {
102
-		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
103
-		$language= Database::escape_string($language);
104
-		$sql = "SELECT * FROM $legal_conditions_table
102
+        $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
103
+        $language= Database::escape_string($language);
104
+        $sql = "SELECT * FROM $legal_conditions_table
105 105
                 WHERE language_id = '".$language."'
106 106
                 ORDER BY version DESC
107 107
                 LIMIT 1 ";
108
-		$result = Database::query($sql);
108
+        $result = Database::query($sql);
109 109
 
110
-		return Database::fetch_array($result);
111
-	}
110
+        return Database::fetch_array($result);
111
+    }
112 112
 
113
-	/**
114
-	 * Gets the last version of a Term and condition by language
115
-	 * @param int $language language id
116
-	 * @return boolean | int the version or false if does not exist
117
-	 */
118
-	public static function get_last_version($language)
113
+    /**
114
+     * Gets the last version of a Term and condition by language
115
+     * @param int $language language id
116
+     * @return boolean | int the version or false if does not exist
117
+     */
118
+    public static function get_last_version($language)
119 119
     {
120 120
         $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
121 121
         $language = intval($language);
@@ -133,15 +133,15 @@  discard block
 block discarded – undo
133 133
 
134 134
             return false;
135 135
         }
136
-	}
136
+    }
137 137
 
138
-	/**
139
-	 * Show the last condition
140
-	 * @param array with type and content i.e array('type'=>'1', 'content'=>'hola');
138
+    /**
139
+     * Show the last condition
140
+     * @param array with type and content i.e array('type'=>'1', 'content'=>'hola');
141 141
      *
142
-	 * @return string html preview
143
-	 */
144
-	public static function show_last_condition($term_preview)
142
+     * @return string html preview
143
+     */
144
+    public static function show_last_condition($term_preview)
145 145
     {
146 146
         $preview = '';
147 147
         switch ($term_preview['type']) {
@@ -167,80 +167,80 @@  discard block
 block discarded – undo
167 167
             default:
168 168
                 break;
169 169
         }
170
-		return 	$preview;
171
-	}
172
-
173
-	/**
174
-	 * Get the terms and condition table (only for maintenance)
175
-	 * @param int offset
176
-	 * @param int number of items
177
-	 * @param int column
178
-	 * @return array
179
-	 */
180
-	public static function get_legal_data($from, $number_of_items, $column)
170
+        return 	$preview;
171
+    }
172
+
173
+    /**
174
+     * Get the terms and condition table (only for maintenance)
175
+     * @param int offset
176
+     * @param int number of items
177
+     * @param int column
178
+     * @return array
179
+     */
180
+    public static function get_legal_data($from, $number_of_items, $column)
181 181
     {
182
-		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
183
-		$lang_table = Database::get_main_table(TABLE_MAIN_LANGUAGE);
184
-		$from = intval($from);
185
-		$number_of_items = intval($number_of_items);
186
-		$column = intval($column);
182
+        $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
183
+        $lang_table = Database::get_main_table(TABLE_MAIN_LANGUAGE);
184
+        $from = intval($from);
185
+        $number_of_items = intval($number_of_items);
186
+        $column = intval($column);
187 187
 
188
- 		$sql  = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date)
188
+            $sql  = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date)
189 189
 				FROM $legal_conditions_table inner join $lang_table l on(language_id = l.id) ";
190
-		$sql .= "ORDER BY language, version ASC ";
191
-		$sql .= "LIMIT $from, $number_of_items ";
192
-
193
-		$result = Database::query($sql);
194
-		$legals = array ();
195
-		$versions = array ();
196
-		while ($legal = Database::fetch_array($result)) {
197
-			// max 2000 chars
198
-			//echo strlen($legal[1]); echo '<br>';
199
-			$versions[]=$legal[0];
200
-			$languages[]=$legal[1];
201
-			if (strlen($legal[2])>2000)
202
-				$legal[2]= substr($legal[2],0,2000).' ... ';
203
-			if ($legal[4]==0)
204
-				$legal[4]= get_lang('HTMLText');
205
-			elseif($legal[4]==1)
206
-				$legal[4]=get_lang('PageLink');
207
-			$legals[] = $legal;
208
-		}
209
-		return $legals;
210
-	}
211
-
212
-	/**
213
-	 * Gets the number of terms and conditions available
214
-	 * @return int
215
-	 */
216
-	public static function count()
190
+        $sql .= "ORDER BY language, version ASC ";
191
+        $sql .= "LIMIT $from, $number_of_items ";
192
+
193
+        $result = Database::query($sql);
194
+        $legals = array ();
195
+        $versions = array ();
196
+        while ($legal = Database::fetch_array($result)) {
197
+            // max 2000 chars
198
+            //echo strlen($legal[1]); echo '<br>';
199
+            $versions[]=$legal[0];
200
+            $languages[]=$legal[1];
201
+            if (strlen($legal[2])>2000)
202
+                $legal[2]= substr($legal[2],0,2000).' ... ';
203
+            if ($legal[4]==0)
204
+                $legal[4]= get_lang('HTMLText');
205
+            elseif($legal[4]==1)
206
+                $legal[4]=get_lang('PageLink');
207
+            $legals[] = $legal;
208
+        }
209
+        return $legals;
210
+    }
211
+
212
+    /**
213
+     * Gets the number of terms and conditions available
214
+     * @return int
215
+     */
216
+    public static function count()
217 217
     {
218
-		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
219
-		$sql = "SELECT count(*) as count_result
218
+        $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
219
+        $sql = "SELECT count(*) as count_result
220 220
 		        FROM $legal_conditions_table
221 221
 		        ORDER BY legal_id DESC ";
222
-		$result = Database::query($sql);
223
-		$url = Database::fetch_array($result,'ASSOC');
224
-		$result = $url['count_result'];
225
-
226
-		return $result;
227
-	}
228
-
229
-	/**
230
-	 * Get type of terms and conditions
231
-	 * @param int The legal id
232
-	 * @param int The language id
233
-	 * @return int The current type of terms and conditions
234
-	 */
235
-	public static function get_type_of_terms_and_conditions($legal_id, $language_id)
222
+        $result = Database::query($sql);
223
+        $url = Database::fetch_array($result,'ASSOC');
224
+        $result = $url['count_result'];
225
+
226
+        return $result;
227
+    }
228
+
229
+    /**
230
+     * Get type of terms and conditions
231
+     * @param int The legal id
232
+     * @param int The language id
233
+     * @return int The current type of terms and conditions
234
+     */
235
+    public static function get_type_of_terms_and_conditions($legal_id, $language_id)
236 236
     {
237
-		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
238
-		$legal_id = intval($legal_id);
239
-		$language_id = intval($language_id);
240
-		$sql = 'SELECT type FROM '.$legal_conditions_table.'
237
+        $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
238
+        $legal_id = intval($legal_id);
239
+        $language_id = intval($language_id);
240
+        $sql = 'SELECT type FROM '.$legal_conditions_table.'
241 241
 		        WHERE legal_id="'.$legal_id.'" AND language_id="'.$language_id.'"';
242
-		$rs = Database::query($sql);
242
+        $rs = Database::query($sql);
243 243
 
244
-		return Database::result($rs,0,'type');
245
-	}
244
+        return Database::result($rs,0,'type');
245
+    }
246 246
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             Database::insert($legal_table, $params);
45 45
 
46 46
             return true;
47
-        } elseif($last['type'] != $type && $language==$last['language_id']) {
47
+        } elseif ($last['type'] != $type && $language == $last['language_id']) {
48 48
             //update
49 49
             $id = $last['legal_id'];
50 50
             $params = [
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	public static function get_last_condition_version($language)
78 78
     {
79 79
 		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
80
-		$language= Database::escape_string($language);
80
+		$language = Database::escape_string($language);
81 81
 		$sql = "SELECT version FROM $legal_conditions_table
82 82
 		        WHERE language_id = '".$language."'
83 83
 		        ORDER BY legal_id DESC LIMIT 1 ";
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
 	 * @param int $language language id
98 98
 	 * @return array all the info of a Term and condition
99 99
 	 */
100
-	public static function get_last_condition ($language)
100
+	public static function get_last_condition($language)
101 101
     {
102 102
 		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
103
-		$language= Database::escape_string($language);
103
+		$language = Database::escape_string($language);
104 104
 		$sql = "SELECT * FROM $legal_conditions_table
105 105
                 WHERE language_id = '".$language."'
106 106
                 ORDER BY version DESC
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
                 ORDER BY version DESC
125 125
                 LIMIT 1 ";
126 126
         $result = Database::query($sql);
127
-        if (Database::num_rows($result)>0){
127
+        if (Database::num_rows($result) > 0) {
128 128
             $version = Database::fetch_array($result);
129
-            $version = explode(':',$version[0]);
129
+            $version = explode(':', $version[0]);
130 130
 
131 131
             return $version[0];
132 132
         } else {
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
                 break;
154 154
                 // Page link
155 155
             case 1:
156
-                $preview ='<fieldset>
156
+                $preview = '<fieldset>
157 157
                              <legend>'.get_lang('TermsAndConditions').'</legend>';
158 158
                 $preview .= '<div id="legal-accept-wrapper" class="form-item">
159 159
                 <label class="option" for="legal-accept">
@@ -185,25 +185,25 @@  discard block
 block discarded – undo
185 185
 		$number_of_items = intval($number_of_items);
186 186
 		$column = intval($column);
187 187
 
188
- 		$sql  = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date)
188
+ 		$sql = "SELECT version, original_name as language, content, changes, type, FROM_UNIXTIME(date)
189 189
 				FROM $legal_conditions_table inner join $lang_table l on(language_id = l.id) ";
190 190
 		$sql .= "ORDER BY language, version ASC ";
191 191
 		$sql .= "LIMIT $from, $number_of_items ";
192 192
 
193 193
 		$result = Database::query($sql);
194
-		$legals = array ();
195
-		$versions = array ();
194
+		$legals = array();
195
+		$versions = array();
196 196
 		while ($legal = Database::fetch_array($result)) {
197 197
 			// max 2000 chars
198 198
 			//echo strlen($legal[1]); echo '<br>';
199
-			$versions[]=$legal[0];
200
-			$languages[]=$legal[1];
201
-			if (strlen($legal[2])>2000)
202
-				$legal[2]= substr($legal[2],0,2000).' ... ';
203
-			if ($legal[4]==0)
204
-				$legal[4]= get_lang('HTMLText');
205
-			elseif($legal[4]==1)
206
-				$legal[4]=get_lang('PageLink');
199
+			$versions[] = $legal[0];
200
+			$languages[] = $legal[1];
201
+			if (strlen($legal[2]) > 2000)
202
+				$legal[2] = substr($legal[2], 0, 2000).' ... ';
203
+			if ($legal[4] == 0)
204
+				$legal[4] = get_lang('HTMLText');
205
+			elseif ($legal[4] == 1)
206
+				$legal[4] = get_lang('PageLink');
207 207
 			$legals[] = $legal;
208 208
 		}
209 209
 		return $legals;
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 		        FROM $legal_conditions_table
221 221
 		        ORDER BY legal_id DESC ";
222 222
 		$result = Database::query($sql);
223
-		$url = Database::fetch_array($result,'ASSOC');
223
+		$url = Database::fetch_array($result, 'ASSOC');
224 224
 		$result = $url['count_result'];
225 225
 
226 226
 		return $result;
@@ -241,6 +241,6 @@  discard block
 block discarded – undo
241 241
 		        WHERE legal_id="'.$legal_id.'" AND language_id="'.$language_id.'"';
242 242
 		$rs = Database::query($sql);
243 243
 
244
-		return Database::result($rs,0,'type');
244
+		return Database::result($rs, 0, 'type');
245 245
 	}
246 246
 }
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -198,12 +198,14 @@
 block discarded – undo
198 198
 			//echo strlen($legal[1]); echo '<br>';
199 199
 			$versions[]=$legal[0];
200 200
 			$languages[]=$legal[1];
201
-			if (strlen($legal[2])>2000)
202
-				$legal[2]= substr($legal[2],0,2000).' ... ';
203
-			if ($legal[4]==0)
204
-				$legal[4]= get_lang('HTMLText');
205
-			elseif($legal[4]==1)
206
-				$legal[4]=get_lang('PageLink');
201
+			if (strlen($legal[2])>2000) {
202
+							$legal[2]= substr($legal[2],0,2000).' ... ';
203
+			}
204
+			if ($legal[4]==0) {
205
+							$legal[4]= get_lang('HTMLText');
206
+			} elseif($legal[4]==1) {
207
+							$legal[4]=get_lang('PageLink');
208
+			}
207 209
 			$legals[] = $legal;
208 210
 		}
209 211
 		return $legals;
Please login to merge, or discard this patch.
main/inc/lib/message.lib.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1532,7 +1532,7 @@
 block discarded – undo
1532 1532
 
1533 1533
         if (isset($_REQUEST['action'])) {
1534 1534
             switch ($_REQUEST['action']) {
1535
-                 case 'mark_as_unread' :
1535
+                    case 'mark_as_unread' :
1536 1536
                     $number_of_selected_messages = count($_POST['id']);
1537 1537
                     if (is_array($_POST['id'])) {
1538 1538
                         foreach ($_POST['id'] as $index => $message_id) {
Please login to merge, or discard this patch.
Braces   +24 added lines, -16 removed lines patch added patch discarded remove patch
@@ -131,8 +131,9 @@  discard block
 block discarded – undo
131 131
             $direction = 'DESC';
132 132
         } else {
133 133
             $column = intval($column);
134
-            if (!in_array($direction, array('ASC', 'DESC')))
135
-                $direction = 'ASC';
134
+            if (!in_array($direction, array('ASC', 'DESC'))) {
135
+                            $direction = 'ASC';
136
+            }
136 137
         }
137 138
         $table_message = Database::get_main_table(TABLE_MESSAGE);
138 139
 
@@ -488,8 +489,9 @@  discard block
 block discarded – undo
488 489
     public static function delete_message_by_user_receiver($user_receiver_id, $id)
489 490
     {
490 491
         $table_message = Database::get_main_table(TABLE_MESSAGE);
491
-        if ($id != strval(intval($id)))
492
-            return false;
492
+        if ($id != strval(intval($id))) {
493
+                    return false;
494
+        }
493 495
         $user_receiver_id = intval($user_receiver_id);
494 496
         $id = intval($id);
495 497
         $sql = "SELECT * FROM $table_message
@@ -664,8 +666,9 @@  discard block
 block discarded – undo
664 666
      */
665 667
     public static function update_message($user_id, $message_id)
666 668
     {
667
-        if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id)))
668
-            return false;
669
+        if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id))) {
670
+                    return false;
671
+        }
669 672
 
670 673
         $table_message = Database::get_main_table(TABLE_MESSAGE);
671 674
         $sql = "UPDATE $table_message SET msg_status = '0'
@@ -705,8 +708,9 @@  discard block
 block discarded – undo
705 708
      */
706 709
     public static function get_message_by_user($user_id, $message_id)
707 710
     {
708
-        if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id)))
709
-            return false;
711
+        if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id))) {
712
+                    return false;
713
+        }
710 714
         $table_message = Database::get_main_table(TABLE_MESSAGE);
711 715
         $query = "SELECT * FROM $table_message
712 716
                   WHERE user_receiver_id=".intval($user_id)." AND id='".intval($message_id)."'";
@@ -721,8 +725,9 @@  discard block
 block discarded – undo
721 725
      */
722 726
     public static function get_messages_by_group($group_id)
723 727
     {
724
-        if ($group_id != strval(intval($group_id)))
725
-            return false;
728
+        if ($group_id != strval(intval($group_id))) {
729
+                    return false;
730
+        }
726 731
 
727 732
         $table_message = Database::get_main_table(TABLE_MESSAGE);
728 733
         $group_id = intval($group_id);
@@ -749,8 +754,9 @@  discard block
 block discarded – undo
749 754
      */
750 755
     public static function get_messages_by_group_by_message($group_id, $message_id)
751 756
     {
752
-        if ($group_id != strval(intval($group_id)))
753
-            return false;
757
+        if ($group_id != strval(intval($group_id))) {
758
+                    return false;
759
+        }
754 760
         $table_message = Database::get_main_table(TABLE_MESSAGE);
755 761
         $group_id = intval($group_id);
756 762
         $sql = "SELECT * FROM $table_message
@@ -828,8 +834,9 @@  discard block
 block discarded – undo
828 834
      */
829 835
     public static function exist_message($user_id, $id)
830 836
     {
831
-        if ($id != strval(intval($id)) || $user_id != strval(intval($user_id)))
832
-            return false;
837
+        if ($id != strval(intval($id)) || $user_id != strval(intval($user_id))) {
838
+                    return false;
839
+        }
833 840
         $table_message = Database::get_main_table(TABLE_MESSAGE);
834 841
         $query = "SELECT id FROM $table_message
835 842
                   WHERE
@@ -860,8 +867,9 @@  discard block
 block discarded – undo
860 867
             $direction = 'DESC';
861 868
         } else {
862 869
             $column = intval($column);
863
-            if (!in_array($direction, array('ASC', 'DESC')))
864
-                $direction = 'ASC';
870
+            if (!in_array($direction, array('ASC', 'DESC'))) {
871
+                            $direction = 'ASC';
872
+            }
865 873
         }
866 874
         $table_message = Database::get_main_table(TABLE_MESSAGE);
867 875
         $request = api_is_xml_http_request();
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
      * @param string $type
683 683
      * @return bool
684 684
      */
685
-    public static function update_message_status($user_id, $message_id,$type)
685
+    public static function update_message_status($user_id, $message_id, $type)
686 686
     {
687 687
         $type = intval($type);
688 688
         if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id))) {
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
 
997 997
         $receiverUserInfo = api_get_user_info($row['user_receiver_id']);
998 998
 
999
-        $message_content .='<tr>';
999
+        $message_content .= '<tr>';
1000 1000
         if (api_get_setting('allow_social_tool') == 'true') {
1001 1001
             if ($source == 'outbox') {
1002 1002
                 $message_content .= get_lang('From').': <a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_sender_id.'">'.$name.'</a> '.
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
                 $message_content .= get_lang('From').':&nbsp;'.$name.'</b> '.api_strtolower(get_lang('To')).' <b>'.get_lang('Me').'</b>';
1013 1013
             }
1014 1014
         }
1015
-        $message_content .=' '.get_lang('Date').':  '.api_get_local_time($row['send_date']).'
1015
+        $message_content .= ' '.get_lang('Date').':  '.api_get_local_time($row['send_date']).'
1016 1016
 		        <br />
1017 1017
 		        <hr style="color:#ddd" />
1018 1018
 		        <table height="209px" width="100%">
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
         $message_content .= '<a href="inbox.php?action=deleteone&id='.$message_id.'&'.$social_link.'" >'.
1039 1039
             Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>&nbsp';
1040 1040
 
1041
-        $message_content .='</div></td>
1041
+        $message_content .= '</div></td>
1042 1042
 		      <td width=10></td>
1043 1043
 		    </tr>
1044 1044
 		</table>';
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 
1116 1116
                 $items = $topic['count'];
1117 1117
                 $reply_label = ($items == 1) ? get_lang('GroupReply') : get_lang('GroupReplies');
1118
-                $label =  Display::label($items.' '.$reply_label);
1118
+                $label = Display::label($items.' '.$reply_label);
1119 1119
                 $topic['title'] = trim($topic['title']);
1120 1120
 
1121 1121
                 if (empty($topic['title'])) {
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
         $name = $user_sender_info['complete_name'];
1226 1226
 
1227 1227
         $topic_page_nr = isset($_GET['topics_page_nr']) ? intval($_GET['topics_page_nr']) : null;
1228
-        $links.= '<div id="message-reply-link">';
1228
+        $links .= '<div id="message-reply-link">';
1229 1229
         if (($my_group_role == GROUP_USER_PERMISSION_ADMIN ||
1230 1230
             $my_group_role == GROUP_USER_PERMISSION_MODERATOR) ||
1231 1231
             $main_message['user_sender_id'] == $current_user_id
@@ -1237,7 +1237,7 @@  discard block
 block discarded – undo
1237 1237
                 'group_id' => $group_id,
1238 1238
                 'message_id' => $main_message['id'],
1239 1239
                 'action' => 'edit_message_group',
1240
-                'anchor_topic' => 'topic_' . $main_message['id'],
1240
+                'anchor_topic' => 'topic_'.$main_message['id'],
1241 1241
                 'topics_page_nr' => $topic_page_nr,
1242 1242
                 'items_page_nr' => $items_page_nr,
1243 1243
                 'topic_id' => $main_message['id']
@@ -1267,7 +1267,7 @@  discard block
 block discarded – undo
1267 1267
             'group_id' => $group_id,
1268 1268
             'message_id' => $main_message['id'],
1269 1269
             'action' => 'reply_message_group',
1270
-            'anchor_topic' => 'topic_' . $main_message['id'],
1270
+            'anchor_topic' => 'topic_'.$main_message['id'],
1271 1271
             'topics_page_nr' => $topic_page_nr,
1272 1272
             'topic_id' => $main_message['id']
1273 1273
         ]);
@@ -1283,10 +1283,10 @@  discard block
 block discarded – undo
1283 1283
             ]
1284 1284
         );
1285 1285
 
1286
-        $links.= '</div>';
1286
+        $links .= '</div>';
1287 1287
 
1288 1288
         $userPicture = $user_sender_info['avatar'];
1289
-        $main_content.= '<div class="message-group-author">
1289
+        $main_content .= '<div class="message-group-author">
1290 1290
                          <img src="'.$userPicture.'" alt="'.$name.'"  width="32" height="32" title="'.$name.'" /></div>';
1291 1291
         $user_link = '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$main_message['user_sender_id'].'">'.$name.'&nbsp;</a>';
1292 1292
 
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
             $date = '<div class="message-group-date"> '.get_lang('Created').' '.date_to_str_ago($main_message['send_date']).'</div>';
1300 1300
         }
1301 1301
         $attachment = '<div class="message-attach">'.(!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>';
1302
-        $main_content.= '<div class="message-group-content">'.$links.$user_link.' '.$date.$main_message['content'].$attachment.'</div>';
1302
+        $main_content .= '<div class="message-group-content">'.$links.$user_link.' '.$date.$main_message['content'].$attachment.'</div>';
1303 1303
         $main_content = Security::remove_XSS($main_content, STUDENT, true);
1304 1304
 
1305 1305
         $html .= Display::div(Display::div(Display::div($main_content, array('class' => 'group_social_sub_item', 'style' => 'background-color:#fff;')), array('class' => 'group_social_item')), array('class' => 'group_social_grid'));
@@ -1320,18 +1320,18 @@  discard block
 block discarded – undo
1320 1320
                 $files_attachments = self::get_links_message_attachment_files($topic['id']);
1321 1321
                 $name = $user_sender_info['complete_name'];
1322 1322
 
1323
-                $links.= '<div id="message-reply-link">';
1323
+                $links .= '<div id="message-reply-link">';
1324 1324
                 if (($my_group_role == GROUP_USER_PERMISSION_ADMIN || $my_group_role == GROUP_USER_PERMISSION_MODERATOR) || $topic['user_sender_id'] == $current_user_id) {
1325
-                    $links.= '<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?height=400&width=800&&user_friend='.$current_user_id.'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=edit_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="ajax btn" data-size="lg" data-title="'.get_lang('Edit').'" title="'.get_lang('Edit').'">'.
1325
+                    $links .= '<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?height=400&width=800&&user_friend='.$current_user_id.'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=edit_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="ajax btn" data-size="lg" data-title="'.get_lang('Edit').'" title="'.get_lang('Edit').'">'.
1326 1326
                         Display :: return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
1327 1327
                 }
1328
-                $links.= '&nbsp;&nbsp;<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?height=400&width=800&&user_friend='.api_get_user_id().'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=reply_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="ajax btn" data-size="lg" data-title="'.get_lang('Reply').'" title="'.get_lang('Reply').'">';
1329
-                $links.= Display :: return_icon('talk.png', get_lang('Reply')).'</a>';
1330
-                $links.= '</div>';
1328
+                $links .= '&nbsp;&nbsp;<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?height=400&width=800&&user_friend='.api_get_user_id().'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=reply_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="ajax btn" data-size="lg" data-title="'.get_lang('Reply').'" title="'.get_lang('Reply').'">';
1329
+                $links .= Display :: return_icon('talk.png', get_lang('Reply')).'</a>';
1330
+                $links .= '</div>';
1331 1331
 
1332 1332
                 $userPicture = $user_sender_info['avatar'];
1333 1333
 
1334
-                $html_items.= '<div class="message-group-author"><img src="'.$userPicture.'" alt="'.$name.'"  width="32" height="32" title="'.$name.'" /></div>';
1334
+                $html_items .= '<div class="message-group-author"><img src="'.$userPicture.'" alt="'.$name.'"  width="32" height="32" title="'.$name.'" /></div>';
1335 1335
                 $user_link = '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$topic['user_sender_id'].'">'.$name.'&nbsp;</a>';
1336 1336
 
1337 1337
                 $date = '';
@@ -1343,7 +1343,7 @@  discard block
 block discarded – undo
1343 1343
                     $date = '<div class="message-group-date"> '.get_lang('Created').' '.date_to_str_ago($topic['send_date']).'</div>';
1344 1344
                 }
1345 1345
                 $attachment = '<div class="message-attach">'.(!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>';
1346
-                $html_items.= '<div class="message-group-content">'.$links.$user_link.' '.$date.Security::remove_XSS($topic['content'], STUDENT, true).$attachment.'</div>';
1346
+                $html_items .= '<div class="message-group-content">'.$links.$user_link.' '.$date.Security::remove_XSS($topic['content'], STUDENT, true).$attachment.'</div>';
1347 1347
 
1348 1348
                 $base_padding = 20;
1349 1349
 
@@ -1618,7 +1618,7 @@  discard block
 block discarded – undo
1618 1618
                     break;
1619 1619
                 case 'deleteone' :
1620 1620
                     MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_GET['id']);
1621
-                    $html .=Display::return_message(api_xml_http_response_encode($success), 'normal', false);
1621
+                    $html .= Display::return_message(api_xml_http_response_encode($success), 'normal', false);
1622 1622
                     $html .= '<br/>';
1623 1623
                     break;
1624 1624
             }
@@ -1710,7 +1710,7 @@  discard block
 block discarded – undo
1710 1710
                 ON m.user_sender_id = u.user_id
1711 1711
                 WHERE
1712 1712
                     m.user_receiver_id = $userId AND
1713
-                    m.msg_status = " . MESSAGE_STATUS_UNREAD . "
1713
+                    m.msg_status = ".MESSAGE_STATUS_UNREAD."
1714 1714
                     AND m.id > $lastId
1715 1715
                 ORDER BY m.send_date DESC";
1716 1716
 
Please login to merge, or discard this patch.
Doc Comments   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -639,6 +639,8 @@  discard block
 block discarded – undo
639 639
      * @param  int	message id
640 640
      * @param  int	message user id (receiver user id or sender user id)
641 641
      * @param  int	group id (optional)
642
+     * @param integer $message_id
643
+     * @param integer $message_uid
642 644
      * @return void
643 645
      */
644 646
     public static function delete_message_attachment_file($message_id, $message_uid, $group_id = 0)
@@ -683,7 +685,7 @@  discard block
 block discarded – undo
683 685
      * update messages by user id and message id
684 686
      * @param  int		$user_id
685 687
      * @param  int		$message_id
686
-     * @return resource
688
+     * @return false|null
687 689
      */
688 690
     public static function update_message($user_id, $message_id)
689 691
     {
@@ -703,7 +705,7 @@  discard block
 block discarded – undo
703 705
      * @param int $user_id
704 706
      * @param int $message_id
705 707
      * @param string $type
706
-     * @return bool
708
+     * @return false|null
707 709
      */
708 710
     public static function update_message_status($user_id, $message_id,$type)
709 711
     {
@@ -740,6 +742,7 @@  discard block
 block discarded – undo
740 742
     /**
741 743
      * get messages by group id
742 744
      * @param  int		group id
745
+     * @param integer $group_id
743 746
      * @return array
744 747
      */
745 748
     public static function get_messages_by_group($group_id)
@@ -1477,7 +1480,7 @@  discard block
 block discarded – undo
1477 1480
      * Sort date by desc from a multi-dimensional array
1478 1481
      * @param array $array1  first array to compare
1479 1482
      * @param array $array2  second array to compare
1480
-     * @return bool
1483
+     * @return integer
1481 1484
      */
1482 1485
     public function order_desc_date($array1, $array2)
1483 1486
     {
@@ -1555,7 +1558,6 @@  discard block
 block discarded – undo
1555 1558
     /**
1556 1559
      * @param $id
1557 1560
      * @param array $params
1558
-     * @param string $display
1559 1561
      * @return string
1560 1562
      */
1561 1563
     public static function generate_invitation_form($id, $params = array())
@@ -1644,7 +1646,7 @@  discard block
 block discarded – undo
1644 1646
 
1645 1647
     /**
1646 1648
      * @param string $keyword
1647
-     * @return null|string
1649
+     * @return string
1648 1650
      */
1649 1651
     public static function outbox_display($keyword = '')
1650 1652
     {
Please login to merge, or discard this patch.
main/inc/lib/search/xapian/XapianQuery.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@  discard block
 block discarded – undo
8 8
  * Code
9 9
  */
10 10
 require_once 'xapian.php';
11
-require_once dirname(__FILE__) . '/../IndexableChunk.class.php';
11
+require_once dirname(__FILE__).'/../IndexableChunk.class.php';
12 12
 //TODO: think another way without including specific fields here
13
-require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
13
+require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
14 14
 
15
-define('XAPIAN_DB', api_get_path(SYS_UPLOAD_PATH) . 'plugins/xapian/searchdb/');
15
+define('XAPIAN_DB', api_get_path(SYS_UPLOAD_PATH).'plugins/xapian/searchdb/');
16 16
 
17 17
 /**
18 18
  * Queries the database.
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
                 // process each specific field prefix
97 97
                 foreach ($specific_fields as $specific_field) {
98
-                    $results[$count]['sf-' . $specific_field['code']] = xapian_get_doc_terms($document, $specific_field['code']);
98
+                    $results[$count]['sf-'.$specific_field['code']] = xapian_get_doc_terms($document, $specific_field['code']);
99 99
                 }
100 100
 
101 101
                 // rest of data
@@ -261,6 +261,6 @@  discard block
 block discarded – undo
261 261
     } else {
262 262
         $message_error = get_lang('SearchOtherXapianError');
263 263
     }
264
-    $display_message = get_lang('Error') . ' : ' . $message_error;
264
+    $display_message = get_lang('Error').' : '.$message_error;
265 265
     Display::display_error_message($display_message);
266 266
 }
Please login to merge, or discard this patch.
main/inc/lib/search/get_terms.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
     return;
18 18
 }
19 19
 
20
-require_once dirname(__FILE__) . '../../../global.inc.php';
21
-require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloQuery.php';
20
+require_once dirname(__FILE__).'../../../global.inc.php';
21
+require_once api_get_path(LIBRARY_PATH).'search/ChamiloQuery.php';
22 22
 
23 23
 /**
24 24
  * search with filter and build base array avoding repeated terms
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     if (is_array($dkterms) && is_array($dkterms[1])) {
34 34
         foreach ($specific_fields as $specific_field) {
35 35
             foreach ($dkterms[1] as $obj) {
36
-                foreach ($obj['sf-' . $specific_field['code']] as $raw_term) {
36
+                foreach ($obj['sf-'.$specific_field['code']] as $raw_term) {
37 37
                     if (count($raw_term['name']) > 1) {
38 38
                         $normal_term = substr($raw_term['name'], 1);
39 39
                         $sf_terms[$specific_field['code']][$normal_term] = $normal_term;
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
 
55 55
 if (($cid = api_get_course_id()) != -1) { // with cid
56 56
     // course filter
57
-    $filter[] = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID . $cid);
57
+    $filter[] = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID.$cid);
58 58
     // term filter
59 59
     if ($term != '__all__') {
60
-        $filter[] = chamilo_get_boolean_query($prefix . $term);
60
+        $filter[] = chamilo_get_boolean_query($prefix.$term);
61 61
         // always and between term and courseid
62 62
         $filter = chamilo_join_queries($filter, null, 'and');
63 63
     }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     $sf_terms = get_usual_sf_terms($filter, $specific_fields);
66 66
 } else { // without cid
67 67
     if ($term != '__all__') {
68
-        $filter[] = chamilo_get_boolean_query($prefix . $term);
68
+        $filter[] = chamilo_get_boolean_query($prefix.$term);
69 69
 
70 70
         $sf_terms = get_usual_sf_terms($filter, $specific_fields);
71 71
     } else { // no cid and all/any terms
Please login to merge, or discard this patch.
main/inc/lib/search/tool_processors/learnpath_processor.class.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,9 +8,9 @@  discard block
 block discarded – undo
8 8
 /**
9 9
  * Code
10 10
  */
11
-include_once dirname(__FILE__) . '/../../../global.inc.php';
12
-require_once dirname(__FILE__) . '/search_processor.class.php';
13
-require_once dirname(__FILE__) . '/../IndexableChunk.class.php';
11
+include_once dirname(__FILE__).'/../../../global.inc.php';
12
+require_once dirname(__FILE__).'/search_processor.class.php';
13
+require_once dirname(__FILE__).'/../IndexableChunk.class.php';
14 14
 
15 15
 /**
16 16
  * Process learning paths before pass it to search listing scripts
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
                     $visibility = api_get_item_visibility(api_get_course_info($courseid), TOOL_LEARNPATH, $lp_id);
53 53
                     if ($visibility) {
54 54
                         list($thumbnail, $image, $name, $author) = $this->get_information($courseid, $lp_id, $lp['has_document_id']);
55
-                        $url = api_get_path(WEB_PATH) . 'main/newscorm/lp_controller.php?cidReq=%s&action=view&lp_id=%s';
55
+                        $url = api_get_path(WEB_PATH).'main/newscorm/lp_controller.php?cidReq=%s&action=view&lp_id=%s';
56 56
                         $url = sprintf($url, $courseid, $lp_id);
57 57
                         $result = array(
58 58
                             'toolid' => TOOL_LEARNPATH,
@@ -128,16 +128,16 @@  discard block
 block discarded – undo
128 128
             $name = '';
129 129
             if ($row = Database::fetch_array($dk_result)) {
130 130
                 // Get the image path
131
-                $img_location = api_get_path(WEB_COURSE_PATH) . $course_path . "/document/";
131
+                $img_location = api_get_path(WEB_COURSE_PATH).$course_path."/document/";
132 132
                 $thumbnail_path = str_replace('.png.html', '_thumb.png', $row['path']);
133 133
                 $big_img_path = str_replace('.png.html', '.png', $row['path']);
134 134
                 $thumbnail = '';
135 135
                 if (!empty($thumbnail_path)) {
136
-                    $thumbnail = $img_location . $thumbnail_path;
136
+                    $thumbnail = $img_location.$thumbnail_path;
137 137
                 }
138 138
                 $image = '';
139 139
                 if (!empty($big_img_path)) {
140
-                    $image = $img_location . $big_img_path;
140
+                    $image = $img_location.$big_img_path;
141 141
                 }
142 142
                 $name = $row['name'];
143 143
             }
Please login to merge, or discard this patch.
main/inc/lib/baker.lib.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@
 block discarded – undo
150 150
                 $data = substr($png,$ipos,$chunk['size']);
151 151
                 $sections = explode("\0", $data);
152 152
                 if ($sections[0] == $key) {
153
-                   return $sections;
153
+                    return $sections;
154 154
                 }
155 155
             }
156 156
             // Extract the data and the CRC
Please login to merge, or discard this 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.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -94,8 +94,9 @@  discard block
 block discarded – undo
94 94
         // Read the magic bytes and verify
95 95
         $retval = substr($png,0,8);
96 96
         $ipos = 8;
97
-        if ($retval != "\x89PNG\x0d\x0a\x1a\x0a")
98
-            throw new Exception('Is not a valid PNG image');
97
+        if ($retval != "\x89PNG\x0d\x0a\x1a\x0a") {
98
+                    throw new Exception('Is not a valid PNG image');
99
+        }
99 100
         // Loop through the chunks. Byte 0-3 is length, Byte 4-7 is type
100 101
         $chunkHeader = substr($png,$ipos,8);
101 102
         $ipos = $ipos + 8;
@@ -107,13 +108,17 @@  discard block
 block discarded – undo
107 108
                 $data = substr($png,$ipos,$chunk['size']);
108 109
                 $sections = explode("\0", $data);
109 110
                 print_r($sections);
110
-                if ( $sections[0] == $key ) $skip = true;
111
+                if ( $sections[0] == $key ) {
112
+                    $skip = true;
113
+                }
111 114
             }
112 115
             // Extract the data and the CRC
113 116
             $data = substr($png,$ipos,$chunk['size']+4);
114 117
             $ipos = $ipos + $chunk['size'] + 4;
115 118
             // Add in the header, data, and CRC
116
-            if ( ! $skip ) $retval = $retval . $chunkHeader . $data;
119
+            if ( ! $skip ) {
120
+                $retval = $retval . $chunkHeader . $data;
121
+            }
117 122
             // Read next chunk header
118 123
             $chunkHeader = substr($png,$ipos,8);
119 124
             $ipos = $ipos + 8;
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Element/receivers.php 2 patches
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.
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -10,65 +10,65 @@  discard block
 block discarded – undo
10 10
  */
11 11
 class HTML_QuickForm_receivers extends HTML_QuickForm_group
12 12
 {
13
-	/**
14
-	 * Array of all receivers
15
-	 */
16
-	var $receivers;
17
-	/**
18
-	 * Array of selected receivers
19
-	 */
20
-	var $receivers_selected;
21
-	/**
22
-	 * Constructor
23
-	 * @param string $elementName
24
-	 * @param string $elementLabel
25
-	 * @param array $attributes This should contain the keys 'receivers' and
26
-	 * 'receivers_selected'
27
-	 */
28
-	public function __construct($elementName = null, $elementLabel = null, $attributes = null)
29
-	{
30
-		$this->receivers = $attributes['receivers'];
31
-		$this->receivers_selected = $attributes['receivers_selected'];
32
-		unset($attributes['receivers']);
33
-		unset($attributes['receivers_selected']);
34
-		parent::__construct($elementName, $elementLabel, $attributes);
35
-		$this->_persistantFreeze = true;
36
-		$this->_appendName = true;
37
-		$this->_type = 'receivers';
38
-	}
39
-	/**
40
-	 * Create the form elements to build this element group
41
-	 */
42
-	function _createElements()
43
-	{
44
-		$this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('Everybody'), '0', array ('onclick' => 'javascript:receivers_hide(\'receivers_to\')'));
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\')'));
47
-		$this->_elements[] = new HTML_QuickForm_advmultiselect('to', '', $this->receivers);
48
-		$this->_elements[2]->setSelected($this->receivers_selected);
49
-	}
50
-	/**
51
-	 * HTML representation
52
-	 */
53
-	public function toHtml()
54
-	{
55
-		include_once ('HTML/QuickForm/Renderer/Default.php');
56
-		$this->_separator = '<br/>';
57
-		$renderer = & new HTML_QuickForm_Renderer_Default();
58
-		$renderer->setElementTemplate('{element}');
59
-		$select_boxes = $this->_elements[2];
60
-		$select_boxes->setElementTemplate('<div style="margin-left:20px;display:block;" id="receivers_'.$select_boxes->getName().'">'.$select_boxes->_elementTemplate.'</div>');
61
-		parent :: accept($renderer);
62
-		$js = $this->getElementJS();
63
-		return $renderer->toHtml().$js;
64
-	}
13
+    /**
14
+     * Array of all receivers
15
+     */
16
+    var $receivers;
17
+    /**
18
+     * Array of selected receivers
19
+     */
20
+    var $receivers_selected;
21
+    /**
22
+     * Constructor
23
+     * @param string $elementName
24
+     * @param string $elementLabel
25
+     * @param array $attributes This should contain the keys 'receivers' and
26
+     * 'receivers_selected'
27
+     */
28
+    public function __construct($elementName = null, $elementLabel = null, $attributes = null)
29
+    {
30
+        $this->receivers = $attributes['receivers'];
31
+        $this->receivers_selected = $attributes['receivers_selected'];
32
+        unset($attributes['receivers']);
33
+        unset($attributes['receivers_selected']);
34
+        parent::__construct($elementName, $elementLabel, $attributes);
35
+        $this->_persistantFreeze = true;
36
+        $this->_appendName = true;
37
+        $this->_type = 'receivers';
38
+    }
39
+    /**
40
+     * Create the form elements to build this element group
41
+     */
42
+    function _createElements()
43
+    {
44
+        $this->_elements[] = new HTML_QuickForm_Radio('receivers', '', get_lang('Everybody'), '0', array ('onclick' => 'javascript:receivers_hide(\'receivers_to\')'));
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\')'));
47
+        $this->_elements[] = new HTML_QuickForm_advmultiselect('to', '', $this->receivers);
48
+        $this->_elements[2]->setSelected($this->receivers_selected);
49
+    }
50
+    /**
51
+     * HTML representation
52
+     */
53
+    public function toHtml()
54
+    {
55
+        include_once ('HTML/QuickForm/Renderer/Default.php');
56
+        $this->_separator = '<br/>';
57
+        $renderer = & new HTML_QuickForm_Renderer_Default();
58
+        $renderer->setElementTemplate('{element}');
59
+        $select_boxes = $this->_elements[2];
60
+        $select_boxes->setElementTemplate('<div style="margin-left:20px;display:block;" id="receivers_'.$select_boxes->getName().'">'.$select_boxes->_elementTemplate.'</div>');
61
+        parent :: accept($renderer);
62
+        $js = $this->getElementJS();
63
+        return $renderer->toHtml().$js;
64
+    }
65 65
 
66
-	/**
67
-	 * Get the necessary javascript
68
-	 */
66
+    /**
67
+     * Get the necessary javascript
68
+     */
69 69
     public function getElementJS()
70
-	{
71
-		$js = "<script type=\"text/javascript\">
70
+    {
71
+        $js = "<script type=\"text/javascript\">
72 72
 					/* <![CDATA[ */
73 73
 					receivers_hide('receivers_to');
74 74
 					function receivers_show(item) {
@@ -81,14 +81,14 @@  discard block
 block discarded – undo
81 81
 					}
82 82
 					/* ]]> */
83 83
 					</script>\n";
84
-		return $js;
85
-	}
86
-	/**
87
-	 * accept renderer
88
-	 */
89
-	function accept(& $renderer, $required = false, $error = null)
90
-	{
91
-		$renderer->renderElement($this, $required, $error);
92
-	}
84
+        return $js;
85
+    }
86
+    /**
87
+     * accept renderer
88
+     */
89
+    function accept(& $renderer, $required = false, $error = null)
90
+    {
91
+        $renderer->renderElement($this, $required, $error);
92
+    }
93 93
 }
94 94
 ?>
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Element/HtmlEditor.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,9 +74,9 @@
 block discarded – undo
74 74
             $styleCss = $this->editor->getConfigAttribute('style');
75 75
 
76 76
             if ($styleCss) {
77
-               $style = true;
77
+                $style = true;
78 78
             } else {
79
-               $style = false;
79
+                $style = false;
80 80
             }
81 81
 
82 82
             return $this->buildEditor($style);
Please login to merge, or discard this patch.