Completed
Pull Request — 1.11.x (#1262)
by José
41:21
created
main/inc/lib/formvalidator/Element/DatePicker.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
             $value = api_format_date($value, DATE_TIME_FORMAT_LONG_24H);
45 45
         }
46 46
 
47
-        return $this->getElementJS() . '
47
+        return $this->getElementJS().'
48 48
             <div class="input-group">
49 49
                 <span class="input-group-addon">
50
-                    <input ' . $this->_getAttrString($this->_attributes) . '>
50
+                    <input ' . $this->_getAttrString($this->_attributes).'>
51 51
                 </span>
52
-                <input class="form-control" type="text" readonly id="' . $id . '_alt" value="' . $value . '">
52
+                <input class="form-control" type="text" readonly id="' . $id.'_alt" value="'.$value.'">
53 53
             </div>
54 54
         ';
55 55
     }
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
         $js .= "<script>
80 80
             $(function() {
81 81
                 $('#$id').hide().datepicker({
82
-                    defaultDate: '" . $this->getValue() . "',
82
+                    defaultDate: '".$this->getValue()."',
83 83
                     dateFormat: 'yy-mm-dd',
84 84
                     altField: '#{$id}_alt',
85
-                    altFormat: \"" . get_lang('DateFormatLongNoDayJS') . "\",
85
+                    altFormat: \"".get_lang('DateFormatLongNoDayJS')."\",
86 86
                     showOn: 'both',
87
-                    buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true) . "',
87
+                    buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true)."',
88 88
                     buttonImageOnly: true,
89
-                    buttonText: '" . get_lang('SelectDate') . "',
89
+                    buttonText: '" . get_lang('SelectDate')."',
90 90
                     changeMonth: true,
91 91
                     changeYear: true,
92 92
                     yearRange: 'c-60y:c+5y'
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Element/DateTimePicker.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
             $value = api_format_date($value, DATE_TIME_FORMAT_LONG_24H);
39 39
         }
40 40
 
41
-        return $this->getElementJS() . '
41
+        return $this->getElementJS().'
42 42
             <div class="input-group">
43 43
                 <span class="input-group-addon">
44
-                    <input ' . $this->_getAttrString($this->_attributes) . '>
44
+                    <input ' . $this->_getAttrString($this->_attributes).'>
45 45
                 </span>
46
-                <input class="form-control" type="text" readonly id="' . $id . '_alt" value="' . $value . '">
46
+                <input class="form-control" type="text" readonly id="' . $id.'_alt" value="'.$value.'">
47 47
             </div>
48 48
         ';
49 49
     }
@@ -73,18 +73,18 @@  discard block
 block discarded – undo
73 73
         $js .= "<script>
74 74
             $(function() {
75 75
                 $('#$id').hide().datetimepicker({
76
-                    defaultDate: '" . $this->getValue() . "',
76
+                    defaultDate: '".$this->getValue()."',
77 77
                     dateFormat: 'yy-mm-dd',
78 78
                     timeFormat: 'HH:mm',
79 79
                     altField: '#{$id}_alt',
80
-                    altFormat: \"" . get_lang('DateFormatLongNoDayJS') . "\",
81
-                    altTimeFormat: \"" . get_lang('TimeFormatNoSecJS') . "\",
82
-                    altSeparator: \" " . get_lang('AtTime') . " \",
80
+                    altFormat: \"".get_lang('DateFormatLongNoDayJS')."\",
81
+                    altTimeFormat: \"" . get_lang('TimeFormatNoSecJS')."\",
82
+                    altSeparator: \" " . get_lang('AtTime')." \",
83 83
                     altFieldTimeOnly: false,
84 84
                     showOn: 'both',
85
-                    buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true) . "',
85
+                    buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true)."',
86 86
                     buttonImageOnly: true,
87
-                    buttonText: '" . get_lang('SelectDate') . "',
87
+                    buttonText: '" . get_lang('SelectDate')."',
88 88
                     changeMonth: true,
89 89
                     changeYear: true
90 90
                 });
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/chamilo_session.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@
 block discarded – undo
109 109
         }*/
110 110
         // If the session time has expired, refresh the starttime value,
111 111
         //  so we're starting to count down from a later time
112
-        if ( $session->has('starttime') && $session->is_expired()) {
112
+        if ($session->has('starttime') && $session->is_expired()) {
113 113
             $session->destroy();
114 114
         } else {
115 115
             //error_log('Time not expired, extend session for a bit more');
Please login to merge, or discard this patch.
main/inc/lib/system_announcements.lib.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -22,14 +22,14 @@  discard block
 block discarded – undo
22 22
         $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS);
23 23
 		$userGroup = new UserGroup();
24 24
 
25
-        $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(),0);
25
+        $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(), 0);
26 26
         $groups = array();
27 27
         foreach ($temp_user_groups as $user_group) {
28 28
             $groups = array_merge($groups, array($user_group['id']));
29 29
             $groups = array_merge($groups, $userGroup->get_parent_groups($user_group['id']));
30 30
         }
31 31
 
32
-        $groups_string = '('.implode($groups,',').')';
32
+        $groups_string = '('.implode($groups, ',').')';
33 33
         $now = api_get_utc_datetime();
34 34
         $sql = "SELECT *, DATE_FORMAT(date_start,'%d-%m-%Y %h:%i:%s') AS display_date
35 35
 				FROM  $db_table
@@ -104,13 +104,13 @@  discard block
 block discarded – undo
104 104
      * @param string $user_id
105 105
      * @return string
106 106
      */
107
-    public static function display_all_announcements($visible, $id = -1, $start = 0,$user_id='')
107
+    public static function display_all_announcements($visible, $id = -1, $start = 0, $user_id = '')
108 108
     {
109 109
 		$user_selected_language = api_get_interface_language();
110
-		$start	= intval($start);
110
+		$start = intval($start);
111 111
         $userGroup = new UserGroup();
112 112
 	    $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS);
113
-	    $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(),0);
113
+	    $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(), 0);
114 114
         $groups = array();
115 115
 	    foreach ($temp_user_groups as $user_group) {
116 116
 	        $groups = array_merge($groups, array($user_group['id']));
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
 	    }
119 119
 
120 120
 	    // Checks if tables exists to not break platform not updated
121
-	    $groups_string = '('.implode($groups,',').')';
121
+	    $groups_string = '('.implode($groups, ',').')';
122 122
 
123 123
 		$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
124
-		$now  = api_get_utc_datetime();
124
+		$now = api_get_utc_datetime();
125 125
 
126 126
 		$sql = "SELECT * FROM ".$db_table."
127 127
 				WHERE
@@ -152,10 +152,10 @@  discard block
 block discarded – undo
152 152
             $sql .= " AND access_url_id IN ('1', '$current_access_url_id')";
153 153
 		}
154 154
 
155
-		if(!isset($_GET['start']) || $_GET['start'] == 0) {
155
+		if (!isset($_GET['start']) || $_GET['start'] == 0) {
156 156
 			$sql .= " ORDER BY date_start DESC LIMIT ".$start.",20";
157 157
 		} else {
158
-			$sql .= " ORDER BY date_start DESC LIMIT ".($start+1).",20";
158
+			$sql .= " ORDER BY date_start DESC LIMIT ".($start + 1).",20";
159 159
 		}
160 160
 		$announcements = Database::query($sql);
161 161
 		$content = '';
@@ -207,13 +207,13 @@  discard block
 block discarded – undo
207 207
      */
208 208
     public static function display_arrow($user_id)
209 209
     {
210
-		$start = (int)$_GET['start'];
211
-		$nb_announcement = SystemAnnouncementManager :: count_nb_announcement($start,$user_id);
212
-		$next = ((int)$_GET['start']+19);
213
-		$prev = ((int)$_GET['start']-19);
210
+		$start = (int) $_GET['start'];
211
+		$nb_announcement = SystemAnnouncementManager :: count_nb_announcement($start, $user_id);
212
+		$next = ((int) $_GET['start'] + 19);
213
+		$prev = ((int) $_GET['start'] - 19);
214 214
 		$content = '';
215
-		if(!isset($_GET['start']) || $_GET['start'] == 0) {
216
-			if($nb_announcement > 20) {
215
+		if (!isset($_GET['start']) || $_GET['start'] == 0) {
216
+			if ($nb_announcement > 20) {
217 217
 				$content .= '<a href="news_list.php?start='.$next.'">'.get_lang('NextBis').' >> </a>';
218 218
 			}
219 219
 		} else {
@@ -322,15 +322,15 @@  discard block
 block discarded – undo
322 322
         $sendEmailTest = false
323 323
     ) {
324 324
 		$original_content = $content;
325
-		$a_dateS = explode(' ',$date_start);
326
-		$a_arraySD = explode('-',$a_dateS[0]);
327
-		$a_arraySH = explode(':',$a_dateS[1]);
328
-		$date_start_to_compare = array_merge($a_arraySD,$a_arraySH);
325
+		$a_dateS = explode(' ', $date_start);
326
+		$a_arraySD = explode('-', $a_dateS[0]);
327
+		$a_arraySH = explode(':', $a_dateS[1]);
328
+		$date_start_to_compare = array_merge($a_arraySD, $a_arraySH);
329 329
 
330
-		$a_dateE = explode(' ',$date_end);
331
-		$a_arrayED = explode('-',$a_dateE[0]);
332
-		$a_arrayEH = explode(':',$a_dateE[1]);
333
-		$date_end_to_compare = array_merge($a_arrayED,$a_arrayEH);
330
+		$a_dateE = explode(' ', $date_end);
331
+		$a_arrayED = explode('-', $a_dateE[0]);
332
+		$a_arrayEH = explode(':', $a_dateE[1]);
333
+		$date_end_to_compare = array_merge($a_arrayED, $a_arrayEH);
334 334
 
335 335
 		$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
336 336
 
@@ -504,15 +504,15 @@  discard block
 block discarded – undo
504 504
         $send_mail = 0,
505 505
         $sendEmailTest = false
506 506
     ) {
507
-		$a_dateS = explode(' ',$date_start);
508
-		$a_arraySD = explode('-',$a_dateS[0]);
509
-		$a_arraySH = explode(':',$a_dateS[1]);
510
-		$date_start_to_compare = array_merge($a_arraySD,$a_arraySH);
507
+		$a_dateS = explode(' ', $date_start);
508
+		$a_arraySD = explode('-', $a_dateS[0]);
509
+		$a_arraySH = explode(':', $a_dateS[1]);
510
+		$date_start_to_compare = array_merge($a_arraySD, $a_arraySH);
511 511
 
512
-		$a_dateE = explode(' ',$date_end);
513
-		$a_arrayED = explode('-',$a_dateE[0]);
514
-		$a_arrayEH = explode(':',$a_dateE[1]);
515
-		$date_end_to_compare = array_merge($a_arrayED,$a_arrayEH);
512
+		$a_dateE = explode(' ', $date_end);
513
+		$a_arrayED = explode('-', $a_dateE[0]);
514
+		$a_arrayEH = explode(':', $a_dateE[1]);
515
+		$date_end_to_compare = array_merge($a_arrayED, $a_arrayEH);
516 516
 
517 517
 		$langsql = is_null($lang) ? 'NULL' : "'".Database::escape_string($lang)."'";
518 518
 		$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
@@ -536,8 +536,8 @@  discard block
 block discarded – undo
536 536
 			return false;
537 537
 		}
538 538
 
539
-	    $start    = api_get_utc_datetime($date_start);
540
-        $end      = api_get_utc_datetime($date_end);
539
+	    $start = api_get_utc_datetime($date_start);
540
+        $end = api_get_utc_datetime($date_end);
541 541
 
542 542
 		$title = Database::escape_string($title);
543 543
 		$content = Database::escape_string($content);
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
                 $sendEmailTest
561 561
             );
562 562
         } else {
563
-            if ($send_mail==1) {
563
+            if ($send_mail == 1) {
564 564
                 SystemAnnouncementManager::send_system_announcement_by_email(
565 565
                     $title,
566 566
                     $content,
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 		global $charset;
656 656
 
657 657
         $title = api_html_entity_decode(stripslashes($title), ENT_QUOTES, $charset);
658
-        $content = api_html_entity_decode(stripslashes(str_replace(array('\r\n', '\n', '\r'),'', $content)), ENT_QUOTES, $charset);
658
+        $content = api_html_entity_decode(stripslashes(str_replace(array('\r\n', '\n', '\r'), '', $content)), ENT_QUOTES, $charset);
659 659
         $now = api_get_utc_datetime();
660 660
 
661 661
         if ($sendEmailTest) {
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 			$sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE status = '5' ";
679 679
 		}
680 680
 
681
-		if ($teacher<> 0 AND $student <> 0) {
681
+		if ($teacher <> 0 AND $student <> 0) {
682 682
 			$sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE 1 = 1 ";
683 683
 		}
684 684
 
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
         // Expiration date
697 697
         $sql .= " AND (expiration_date = '' OR expiration_date IS NULL OR expiration_date > '$now') ";
698 698
 
699
-		if ((empty($teacher) or $teacher == '0') AND  (empty($student) or $student == '0')) {
699
+		if ((empty($teacher) or $teacher == '0') AND (empty($student) or $student == '0')) {
700 700
 			return true;
701 701
 		}
702 702
 
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 
708 708
         $message_sent = false;
709 709
 
710
-		while ($row = Database::fetch_array($result,'ASSOC')) {
710
+		while ($row = Database::fetch_array($result, 'ASSOC')) {
711 711
             MessageManager::send_message_simple($row['user_id'], $title, $content);
712 712
             $message_sent = true;
713 713
 		}
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
         $cut_size = 500;
728 728
         $now = api_get_utc_datetime();
729 729
 
730
-        $sql = "SELECT * FROM " . $table . "
730
+        $sql = "SELECT * FROM ".$table."
731 731
 				WHERE
732 732
 				    (lang = '$user_selected_language' OR lang = '') AND
733 733
 				    ('$now' >= date_start AND '$now' <= date_end) ";
Please login to merge, or discard this patch.
main/inc/lib/dashboard.lib.php 1 patch
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.
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.