Completed
Push — 1.11.x ( 6904fa...6a92e6 )
by José
525:44 queued 484:20
created
main/upload/upload.document.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
  * @author Yannick Warnier <[email protected]>
10 10
  */
11 11
 
12
-$courseDir = $_course['path'] . "/document";
12
+$courseDir = $_course['path']."/document";
13 13
 $sys_course_path = api_get_path(SYS_COURSE_PATH);
14
-$base_work_dir = $sys_course_path . $courseDir;
14
+$base_work_dir = $sys_course_path.$courseDir;
15 15
 $noPHP_SELF = true;
16 16
 $max_filled_space = DocumentManager::get_course_quota();
17 17
 
@@ -34,14 +34,14 @@  discard block
 block discarded – undo
34 34
 
35 35
 $nameTools = get_lang('UplUploadDocument');
36 36
 $interbreadcrumb[] = array(
37
-    "url" => "./document.php?curdirpath=" . urlencode(
37
+    "url" => "./document.php?curdirpath=".urlencode(
38 38
             $path
39
-        ) . $req_gid,
39
+        ).$req_gid,
40 40
     "name" => $langDocuments
41 41
 );
42 42
 Display::display_header($nameTools, "Doc");
43 43
 //show the title
44
-api_display_tool_title($nameTools . $add_group_to_title);
44
+api_display_tool_title($nameTools.$add_group_to_title);
45 45
 
46 46
 /**
47 47
  * Process
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
         	$ct = '';
72 72
         	if ($new_comment) $ct .= ", comment='$new_comment'";
73 73
         	if ($new_title)   $ct .= ", title='$new_title'";
74
-        	Database::query("UPDATE $table_document SET" . substr($ct, 1) ." WHERE id = '$docid'");
74
+        	Database::query("UPDATE $table_document SET".substr($ct, 1)." WHERE id = '$docid'");
75 75
     	}
76 76
         //check for missing images in html files
77 77
         $missing_files = check_for_missing_files($base_work_dir.$_POST['curdirpath'].$new_path);
78
-        if ($missing_files)  {
78
+        if ($missing_files) {
79 79
             //show a form to upload the missing files
80 80
             Display::display_normal_message(
81 81
                 build_missing_files_form(
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     if ($number_of_uploaded_images > 0) {
95 95
         //we could also create a function for this, I'm not sure...
96 96
         //create a directory for the missing files
97
-        $img_directory = str_replace('.','_',$_POST['related_file']."_files");
97
+        $img_directory = str_replace('.', '_', $_POST['related_file']."_files");
98 98
         $folderData = create_unexisting_directory(
99 99
             $_course,
100 100
             $_user['user_id'],
@@ -120,15 +120,15 @@  discard block
 block discarded – undo
120 120
         replace_img_path_in_html_file(
121 121
             $_POST['img_file_path'],
122 122
             $paths_to_replace_in_file,
123
-            $base_work_dir . $_POST['related_file']
123
+            $base_work_dir.$_POST['related_file']
124 124
         );
125 125
         //update parent folders
126
-        item_property_update_on_folder($_course,$_POST['curdirpath'],$_user['user_id']);
126
+        item_property_update_on_folder($_course, $_POST['curdirpath'], $_user['user_id']);
127 127
     }
128 128
 }
129 129
 //they want to create a directory
130
-if (isset($_POST['create_dir']) && $_POST['dirname']!='') {
131
-	$added_slash = ($path=='/')?'':'/';
130
+if (isset($_POST['create_dir']) && $_POST['dirname'] != '') {
131
+	$added_slash = ($path == '/') ? '' : '/';
132 132
 	$dir_name = $path.$added_slash.api_replace_dangerous_char($_POST['dirname']);
133 133
     $created_dir = create_unexisting_directory(
134 134
         $_course,
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	//create the form that asks for the directory name
153 153
 	$new_folder_text = '<form action="'.api_get_self().'" method="POST">';
154 154
 	$new_folder_text .= '<input type="hidden" name="curdirpath" value="'.$path.'"/>';
155
-	$new_folder_text .= get_lang('NewDir') .' ';
155
+	$new_folder_text .= get_lang('NewDir').' ';
156 156
 	$new_folder_text .= '<input type="text" name="dirname"/>';
157 157
 	$new_folder_text .= '<input type="submit" name="create_dir" value="'.get_lang('Ok').'"/>';
158 158
 	$new_folder_text .= '</form>';
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	<p>
164 164
         <a href="<?php echo api_get_self(); ?>?path=<?php echo $path; ?>&amp;createdir=1">
165 165
             <?php echo Display::return_icon('new_folder.gif'); ?>
166
-            <?php echo(get_lang('CreateDir'));?>
166
+            <?php echo(get_lang('CreateDir')); ?>
167 167
         </a>
168 168
     </p>
169 169
 <?php
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
 </td>
187 187
 </tr>
188 188
 <tr>
189
-<td><?php echo get_lang('Title');?></td>
189
+<td><?php echo get_lang('Title'); ?></td>
190 190
 <td><input type="text" size="20" name="title" style="width:300px;"></td>
191 191
 </tr>
192 192
 <tr>
193
-<td valign="top"><?php echo get_lang('Comment');?></td>
193
+<td valign="top"><?php echo get_lang('Comment'); ?></td>
194 194
 <td><textarea rows="3" cols="20" name="comment" wrap="virtual" style="width:300px;"></textarea></td>
195 195
 </tr>
196 196
 <tr>
@@ -198,22 +198,22 @@  discard block
 block discarded – undo
198 198
 <?php echo get_lang('Options'); ?>
199 199
 </td>
200 200
 <td>
201
-- <input type="checkbox" name="unzip" value="1" onclick="check_unzip()"/> <?php echo(get_lang('Uncompress'));?><br/>
202
-- <?php echo (get_lang('UplWhatIfFileExists'));?><br/>
203
-&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="nothing" title="<?php echo (get_lang('UplDoNothingLong'));?>" checked="checked"/>  <?php echo (get_lang('UplDoNothing'));?><br/>
204
-&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="overwrite" title="<?php echo (get_lang('UplOverwriteLong'));?>"/> <?php echo (get_lang('UplOverwrite'));?><br/>
205
-&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="rename" title="<?php echo (get_lang('UplRenameLong'));?>"/> <?php echo (get_lang('UplRename'));?>
201
+- <input type="checkbox" name="unzip" value="1" onclick="check_unzip()"/> <?php echo(get_lang('Uncompress')); ?><br/>
202
+- <?php echo (get_lang('UplWhatIfFileExists')); ?><br/>
203
+&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="nothing" title="<?php echo (get_lang('UplDoNothingLong')); ?>" checked="checked"/>  <?php echo (get_lang('UplDoNothing')); ?><br/>
204
+&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="overwrite" title="<?php echo (get_lang('UplOverwriteLong')); ?>"/> <?php echo (get_lang('UplOverwrite')); ?><br/>
205
+&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="rename" title="<?php echo (get_lang('UplRenameLong')); ?>"/> <?php echo (get_lang('UplRename')); ?>
206 206
 
207 207
 </td>
208 208
 </tr>
209 209
 </table>
210 210
 
211
-<input type="submit" value="<?php echo(get_lang('Ok'));?>">
211
+<input type="submit" value="<?php echo(get_lang('Ok')); ?>">
212 212
 </form>
213 213
 <!-- end upload form -->
214 214
 
215 215
  <!-- so they can get back to the documents   -->
216
- <p><?php echo (get_lang('Back'));?> <?php echo (get_lang('To'));?> <a href="document.php?curdirpath=<?php echo $path; ?>"><?php echo (get_lang('DocumentsOverview'));?></a></p>
216
+ <p><?php echo (get_lang('Back')); ?> <?php echo (get_lang('To')); ?> <a href="document.php?curdirpath=<?php echo $path; ?>"><?php echo (get_lang('DocumentsOverview')); ?></a></p>
217 217
 <?php
218 218
 
219 219
 Display::display_footer();
Please login to merge, or discard this patch.
main/social/search.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
 $tool_name = get_lang('Search');
21 21
 $interbreadcrumb[] = array('url' => 'profile.php', 'name' => get_lang('SocialNetwork'));
22 22
 
23
-$query = isset($_GET['q']) ? Security::remove_XSS($_GET['q']): null;
24
-$query_search_type = isset($_GET['search_type']) && in_array($_GET['search_type'], array('0','1','2')) ? $_GET['search_type'] : null;
23
+$query = isset($_GET['q']) ? Security::remove_XSS($_GET['q']) : null;
24
+$query_search_type = isset($_GET['search_type']) && in_array($_GET['search_type'], array('0', '1', '2')) ? $_GET['search_type'] : null;
25 25
 $extra_fields = UserManager::get_extra_filtrable_fields();
26 26
 $query_vars = array('q' => $query, 'search_type' => $query_search_type);
27 27
 if (!empty($extra_fields)) {
28 28
     foreach ($extra_fields as $extra_field) {
29
-        $field_name = 'field_' . $extra_field['variable'];
29
+        $field_name = 'field_'.$extra_field['variable'];
30 30
         if (isset($_GET[$field_name]) && $_GET[$field_name] != '0') {
31 31
             $query_vars[$field_name] = $_GET[$field_name];
32 32
         }
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 $usergroup = new UserGroup();
47 47
 
48 48
 // I'm searching something
49
-if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2) ) {
49
+if ($query != '' || ($query_vars['search_type'] == '1' && count($query_vars) > 2)) {
50 50
     $itemPerPage = 8;
51 51
 
52
-    if ($_GET['search_type']=='0' || $_GET['search_type']=='1') {
52
+    if ($_GET['search_type'] == '0' || $_GET['search_type'] == '1') {
53 53
         $page = isset($_GET['users_page_nr']) ? intval($_GET['users_page_nr']) : 1;
54 54
         $totalUsers = UserManager::get_all_user_tags($_GET['q'], 0, 0, $itemPerPage, true);
55 55
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         $users = UserManager::get_all_user_tags($_GET['q'], 0, $from, $itemPerPage);
59 59
     }
60 60
 
61
-    if ($_GET['search_type']=='0' || $_GET['search_type']=='2') {
61
+    if ($_GET['search_type'] == '0' || $_GET['search_type'] == '2') {
62 62
         $pageGroup = isset($_GET['groups_page_nr']) ? intval($_GET['groups_page_nr']) : 1;
63 63
         // Groups
64 64
         $fromGroups = intval(($pageGroup - 1) * $itemPerPage);
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
             // Show send invitation icon if they are not friends yet
86 86
             if ($relation_type != 3 && $relation_type != 4 && $user_info['user_id'] != api_get_user_id()) {
87
-                $send_inv = '<a href="#" class="'.$buttonClass.' btn-to-send-invitation" data-send-to="' . $user_info['user_id'] . '">
87
+                $send_inv = '<a href="#" class="'.$buttonClass.' btn-to-send-invitation" data-send-to="'.$user_info['user_id'].'">
88 88
                              <em class="fa fa-user"></em> '.get_lang('SendInvitation').'</a>';
89 89
             }
90 90
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
                                 </div>
131 131
                                 <div class="user-info">
132 132
                                    <p>'.$user_info['complete_name'].'</p>
133
-                                   <div class="items-user-status">' . $status_icon . $user_icon . '</div>
133
+                                   <div class="items-user-status">' . $status_icon.$user_icon.'</div>
134 134
                                    <div class="toolbar">
135 135
                                     '.$invitations.'
136 136
                                    </div>
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
             $tags = null;
188 188
             $group['picture'] = '<img class="img-responsive img-circle" src="'.$picture['file'].'" />';
189 189
 
190
-            $members = Display::returnFontAwesomeIcon('user') . '( ' .$count_users_group . ' )';
190
+            $members = Display::returnFontAwesomeIcon('user').'( '.$count_users_group.' )';
191 191
             $item_1  = Display::tag('p', $url_open.$name.$url_close);
192 192
 
193 193
             $block_groups .= '
@@ -198,10 +198,10 @@  discard block
 block discarded – undo
198 198
                         </div>
199 199
                         <div class="user-info">
200 200
                             '.$item_1.'
201
-                            <p>' . $members . '</p>    
202
-                            <p>' . $group['description'] . '</p>
203
-                            <p>' . $tags . '</p>
204
-                            <p>' . $url_open.get_lang('SeeMore') . $url_close . '</p>
201
+                            <p>' . $members.'</p>    
202
+                            <p>' . $group['description'].'</p>
203
+                            <p>' . $tags.'</p>
204
+                            <p>' . $url_open.get_lang('SeeMore').$url_close.'</p>
205 205
                         </div>
206 206
                     </div>
207 207
                 </div>';
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 $tpl->assign('social_search', $block_search);
242 242
 $tpl->assign('search_form', $searchForm);
243 243
 
244
-$formModalTpl =  new Template();
244
+$formModalTpl = new Template();
245 245
 $formModalTpl->assign('invitation_form', MessageManager::generate_invitation_form('send_invitation'));
246 246
 $formModals = $formModalTpl->fetch('default/social/form_modals.tpl');
247 247
 
Please login to merge, or discard this patch.
main/inc/lib/search/tool_processors/link_processor.class.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  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';
11
+include_once dirname(__FILE__).'/../../../global.inc.php';
12
+require_once dirname(__FILE__).'/search_processor.class.php';
13 13
 
14 14
 /**
15 15
  * Process links before pass it to search listing scripts
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 
105 105
             $link_id = intval($link_id);
106 106
             $sql = "SELECT insert_user_id FROM $item_property_table
107
-              		WHERE ref = $link_id AND tool = '" . TOOL_LINK . "' AND c_id = $course_id
107
+              		WHERE ref = $link_id AND tool = '".TOOL_LINK."' AND c_id = $course_id
108 108
               		LIMIT 1";
109 109
 
110 110
             $name = get_lang('Links');
111
-            $url = api_get_path(WEB_PATH) . 'main/link/link.php?cidReq=%s';
111
+            $url = api_get_path(WEB_PATH).'main/link/link.php?cidReq=%s';
112 112
             $url = sprintf($url, $course_id_alpha);
113 113
             // Get the image path
114 114
             $thumbnail = Display::returnIconPath('link.png');
Please login to merge, or discard this patch.
main/inc/lib/search/tool_processors/document_processor.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  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';
11
+include_once dirname(__FILE__).'/../../../global.inc.php';
12
+require_once dirname(__FILE__).'/search_processor.class.php';
13 13
 
14 14
 /**
15 15
  * Process documents before pass it to search listing scripts
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             $dk_result = Database::query($sql);
83 83
 
84 84
             $sql = "SELECT insert_user_id FROM       $item_property_table
85
-                    WHERE   ref = $doc_id AND tool = '" . TOOL_DOCUMENT . "' AND c_id = $course_id
85
+                    WHERE   ref = $doc_id AND tool = '".TOOL_DOCUMENT."' AND c_id = $course_id
86 86
                     LIMIT 1";
87 87
             $name = '';
88 88
             if ($row = Database::fetch_array($dk_result)) {
Please login to merge, or discard this patch.
main/inc/lib/agenda.lib.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -1499,12 +1499,12 @@  discard block
 block discarded – undo
1499 1499
             }
1500 1500
 
1501 1501
             if (empty($session_id)) {
1502
-                $sessionCondition =  "
1502
+                $sessionCondition = "
1503 1503
                 (
1504 1504
                     agenda.session_id = 0 AND (ip.session_id IS NULL OR ip.session_id = 0)
1505 1505
                 ) ";
1506 1506
             } else {
1507
-                $sessionCondition =  "
1507
+                $sessionCondition = "
1508 1508
                 (
1509 1509
                     agenda.session_id = $session_id AND
1510 1510
                     ip.session_id = $session_id
@@ -1543,13 +1543,13 @@  discard block
 block discarded – undo
1543 1543
             }
1544 1544
 
1545 1545
             if (empty($session_id)) {
1546
-                $sessionCondition =  "
1546
+                $sessionCondition = "
1547 1547
                 (
1548 1548
                     agenda.session_id = 0 AND
1549 1549
                     (ip.session_id IS NULL OR ip.session_id = 0)
1550 1550
                 ) ";
1551 1551
             } else {
1552
-                $sessionCondition =  "
1552
+                $sessionCondition = "
1553 1553
                 (
1554 1554
                     agenda.session_id = $session_id AND
1555 1555
                     ip.session_id = $session_id
@@ -1601,7 +1601,7 @@  discard block
 block discarded – undo
1601 1601
             while ($row = Database::fetch_array($result, 'ASSOC')) {
1602 1602
                 $event = array();
1603 1603
                 $event['id'] = 'course_'.$row['id'];
1604
-                $event['unique_id']  = $row['iid'];
1604
+                $event['unique_id'] = $row['iid'];
1605 1605
                 // To avoid doubles
1606 1606
                 if (in_array($event['unique_id'], $eventsAdded)) {
1607 1607
                     continue;
@@ -2151,7 +2151,7 @@  discard block
 block discarded – undo
2151 2151
             );
2152 2152
 
2153 2153
             $form->addLabel('',
2154
-                '<span id="link-more-attach"><a href="javascript://" onclick="return add_image_form()">'.get_lang('AddOneMoreFile').'</a></span>&nbsp;('.sprintf(get_lang('MaximunFileSizeX'),format_file_size(api_get_setting('message_max_upload_filesize'))).')');
2154
+                '<span id="link-more-attach"><a href="javascript://" onclick="return add_image_form()">'.get_lang('AddOneMoreFile').'</a></span>&nbsp;('.sprintf(get_lang('MaximunFileSizeX'), format_file_size(api_get_setting('message_max_upload_filesize'))).')');
2155 2155
 
2156 2156
 
2157 2157
             //if ($showAttachmentForm) {
@@ -2729,8 +2729,8 @@  discard block
 block discarded – undo
2729 2729
 
2730 2730
                 $startDateTime = api_get_local_time($start->format('Y-m-d H:i:s'), $currentTimeZone, $start->format('e'));
2731 2731
                 $endDateTime = api_get_local_time($end->format('Y-m-d H:i'), $currentTimeZone, $end->format('e'));
2732
-                $title = api_convert_encoding((string)$event->summary, $charset, 'UTF-8');
2733
-                $description = api_convert_encoding((string)$event->description, $charset, 'UTF-8');
2732
+                $title = api_convert_encoding((string) $event->summary, $charset, 'UTF-8');
2733
+                $description = api_convert_encoding((string) $event->description, $charset, 'UTF-8');
2734 2734
 
2735 2735
                 $id = $this->addEvent(
2736 2736
                     $startDateTime,
@@ -2872,7 +2872,7 @@  discard block
 block discarded – undo
2872 2872
 							ORDER BY start_date ";
2873 2873
             } else {
2874 2874
                 // if the user is not an administrator of that course
2875
-                if (is_array($group_memberships) && count($group_memberships)>0) {
2875
+                if (is_array($group_memberships) && count($group_memberships) > 0) {
2876 2876
                     $sqlquery = "SELECT	agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref
2877 2877
 								FROM ".$TABLEAGENDA." agenda,
2878 2878
 									".$TABLE_ITEMPROPERTY." ip
@@ -2902,14 +2902,14 @@  discard block
 block discarded – undo
2902 2902
                 $agendaday = -1;
2903 2903
                 if ($item['start_date'] != '0000-00-00 00:00:00') {
2904 2904
                     $item['start_date'] = api_get_local_time($item['start_date']);
2905
-                    $item['start_date_tms']  = api_strtotime($item['start_date']);
2905
+                    $item['start_date_tms'] = api_strtotime($item['start_date']);
2906 2906
                     $agendaday = date("j", $item['start_date_tms']);
2907 2907
                 }
2908 2908
                 if ($item['end_date'] != '0000-00-00 00:00:00') {
2909 2909
                     $item['end_date'] = api_get_local_time($item['end_date']);
2910 2910
                 }
2911 2911
 
2912
-                $url  = api_get_path(WEB_CODE_PATH)."calendar/agenda.php?cidReq=".urlencode($array_course_info["code"])."&day=$agendaday&month=$month&year=$year#$agendaday";
2912
+                $url = api_get_path(WEB_CODE_PATH)."calendar/agenda.php?cidReq=".urlencode($array_course_info["code"])."&day=$agendaday&month=$month&year=$year#$agendaday";
2913 2913
 
2914 2914
                 $item['url'] = $url;
2915 2915
                 $item['course_name'] = $array_course_info['title'];
@@ -2921,9 +2921,9 @@  discard block
 block discarded – undo
2921 2921
         }
2922 2922
 
2923 2923
         // sorting by hour for every day
2924
-        $agendaitems = array ();
2924
+        $agendaitems = array();
2925 2925
         while (list ($agendaday, $tmpitems) = each($items)) {
2926
-            if(!isset($agendaitems[$agendaday])) {
2926
+            if (!isset($agendaitems[$agendaday])) {
2927 2927
                 $agendaitems[$agendaday] = '';
2928 2928
             }
2929 2929
             sort($tmpitems);
@@ -3097,9 +3097,9 @@  discard block
 block discarded – undo
3097 3097
             $end_year = $start_end_day_of_week['end']['year'];
3098 3098
             // in sql statements you have to use year-month-day for date calculations
3099 3099
             $start_filter = $start_year."-".$start_month."-".$start_day." 00:00:00";
3100
-            $start_filter  = api_get_utc_datetime($start_filter);
3100
+            $start_filter = api_get_utc_datetime($start_filter);
3101 3101
             $end_filter = $end_year."-".$end_month."-".$end_day." 23:59:59";
3102
-            $end_filter  = api_get_utc_datetime($end_filter);
3102
+            $end_filter = api_get_utc_datetime($end_filter);
3103 3103
             $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$user_id."' AND date>='".$start_filter."' AND date<='".$end_filter."'";
3104 3104
         }
3105 3105
         // 3. creating the SQL statement for getting the personal agenda items in DAY view
@@ -3107,18 +3107,18 @@  discard block
 block discarded – undo
3107 3107
             // we are in day view
3108 3108
             // we could use mysql date() function but this is only available from 4.1 and higher
3109 3109
             $start_filter = $year."-".$month."-".$day." 00:00:00";
3110
-            $start_filter  = api_get_utc_datetime($start_filter);
3110
+            $start_filter = api_get_utc_datetime($start_filter);
3111 3111
             $end_filter = $year."-".$month."-".$day." 23:59:59";
3112
-            $end_filter  = api_get_utc_datetime($end_filter);
3112
+            $end_filter = api_get_utc_datetime($end_filter);
3113 3113
             $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$user_id."' AND date>='".$start_filter."' AND date<='".$end_filter."'";
3114 3114
         }
3115 3115
 
3116 3116
         $result = Database::query($sql);
3117 3117
         while ($item = Database::fetch_array($result, 'ASSOC')) {
3118 3118
 
3119
-            $time_minute 	= api_convert_and_format_date($item['date'], TIME_NO_SEC_FORMAT);
3120
-            $item['date']   = api_get_local_time($item['date']);
3121
-            $item['start_date_tms']  = api_strtotime($item['date']);
3119
+            $time_minute = api_convert_and_format_date($item['date'], TIME_NO_SEC_FORMAT);
3120
+            $item['date'] = api_get_local_time($item['date']);
3121
+            $item['start_date_tms'] = api_strtotime($item['date']);
3122 3122
             $item['content'] = $item['text'];
3123 3123
 
3124 3124
             // we break the date field in the database into a date and a time part
@@ -3138,7 +3138,7 @@  discard block
 block discarded – undo
3138 3138
             $second = $agendatime[2];
3139 3139
 
3140 3140
             if ($type == 'month_view') {
3141
-                $item['calendar_type']  = 'personal';
3141
+                $item['calendar_type'] = 'personal';
3142 3142
                 $item['start_date']  	= $item['date'];
3143 3143
                 $agendaitems[$day][] 	= $item;
3144 3144
                 continue;
@@ -3163,7 +3163,7 @@  discard block
 block discarded – undo
3163 3163
                 // this is the array construction for the DAY view
3164 3164
                 $halfhour = 2 * $agendatime['0'];
3165 3165
                 if ($agendatime['1'] >= '30') {
3166
-                    $halfhour = $halfhour +1;
3166
+                    $halfhour = $halfhour + 1;
3167 3167
                 }
3168 3168
 
3169 3169
                 //Display events by list
@@ -3187,22 +3187,22 @@  discard block
 block discarded – undo
3187 3187
     {
3188 3188
         global $DaysShort, $course_path;
3189 3189
         //Handle leap year
3190
-        $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
3190
+        $numberofdays = array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
3191 3191
         if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0))
3192 3192
             $numberofdays[2] = 29;
3193 3193
         //Get the first day of the month
3194 3194
         $dayone = getdate(mktime(0, 0, 0, $month, 1, $year));
3195 3195
         //Start the week on monday
3196 3196
         $startdayofweek = $dayone['wday'] <> 0 ? ($dayone['wday'] - 1) : 6;
3197
-        $g_cc = (isset($_GET['courseCode'])?$_GET['courseCode']:'');
3197
+        $g_cc = (isset($_GET['courseCode']) ? $_GET['courseCode'] : '');
3198 3198
 
3199
-        $next_month = ($month == 1 ? 12 : $month -1);
3200
-        $prev_month = ($month == 12 ? 1 : $month +1);
3199
+        $next_month = ($month == 1 ? 12 : $month - 1);
3200
+        $prev_month = ($month == 12 ? 1 : $month + 1);
3201 3201
 
3202
-        $next_year = ($month == 1 ? $year -1 : $year);
3203
-        $prev_year = ($month == 12 ? $year +1 : $year);
3202
+        $next_year = ($month == 1 ? $year - 1 : $year);
3203
+        $prev_year = ($month == 12 ? $year + 1 : $year);
3204 3204
 
3205
-        if ($show_content)  {
3205
+        if ($show_content) {
3206 3206
             $back_url = Display::url(get_lang('Previous'), api_get_self()."?coursePath=".urlencode($course_path)."&courseCode=".Security::remove_XSS($g_cc)."&action=view&view=month&month=".$next_month."&year=".$next_year);
3207 3207
             $next_url = Display::url(get_lang('Next'), api_get_self()."?coursePath=".urlencode($course_path)."&courseCode=".Security::remove_XSS($g_cc)."&action=view&view=month&month=".$prev_month."&year=".$prev_year);
3208 3208
         } else {
@@ -3219,7 +3219,7 @@  discard block
 block discarded – undo
3219 3219
         $html .= '</div>';
3220 3220
         $html .= '<table id="agenda_list2" class="table table-bordered">';
3221 3221
         $html .= '<tr>';
3222
-        for ($ii = 1; $ii < 8; $ii ++) {
3222
+        for ($ii = 1; $ii < 8; $ii++) {
3223 3223
             $html .= '<td class="weekdays">'.$DaysShort[$ii % 7].'</td>';
3224 3224
         }
3225 3225
         $html .= '</tr>';
@@ -3228,7 +3228,7 @@  discard block
 block discarded – undo
3228 3228
         $today = getdate();
3229 3229
         while ($curday <= $numberofdays[$month]) {
3230 3230
             $html .= "<tr>";
3231
-            for ($ii = 0; $ii < 7; $ii ++) {
3231
+            for ($ii = 0; $ii < 7; $ii++) {
3232 3232
                 if (($curday == -1) && ($ii == $startdayofweek)) {
3233 3233
                     $curday = 1;
3234 3234
                 }
@@ -3242,21 +3242,21 @@  discard block
 block discarded – undo
3242 3242
                     $html .= "<td ".$class.">".$dayheader;
3243 3243
 
3244 3244
                     if (!empty($agendaitems[$curday])) {
3245
-                        $items =  $agendaitems[$curday];
3246
-                        $items =  msort($items, 'start_date_tms');
3245
+                        $items = $agendaitems[$curday];
3246
+                        $items = msort($items, 'start_date_tms');
3247 3247
 
3248
-                        foreach($items  as $value) {
3248
+                        foreach ($items  as $value) {
3249 3249
                             $value['title'] = Security::remove_XSS($value['title']);
3250 3250
                             $start_time = api_format_date($value['start_date'], TIME_NO_SEC_FORMAT);
3251 3251
                             $end_time = '';
3252 3252
 
3253 3253
                             if (!empty($value['end_date']) && $value['end_date'] != '0000-00-00 00:00:00') {
3254
-                                $end_time    = '-&nbsp;<i>'.api_format_date($value['end_date'], DATE_TIME_FORMAT_LONG).'</i>';
3254
+                                $end_time = '-&nbsp;<i>'.api_format_date($value['end_date'], DATE_TIME_FORMAT_LONG).'</i>';
3255 3255
                             }
3256 3256
                             $complete_time = '<i>'.api_format_date($value['start_date'], DATE_TIME_FORMAT_LONG).'</i>&nbsp;'.$end_time;
3257 3257
                             $time = '<i>'.$start_time.'</i>';
3258 3258
 
3259
-                            switch($value['calendar_type']) {
3259
+                            switch ($value['calendar_type']) {
3260 3260
                                 case 'personal':
3261 3261
                                     $bg_color = '#D0E7F4';
3262 3262
                                     $icon = Display::return_icon('user.png', get_lang('MyAgenda'), array(), ICON_SIZE_SMALL);
@@ -3308,7 +3308,7 @@  discard block
 block discarded – undo
3308 3308
                         }
3309 3309
                     }
3310 3310
                     $html .= "</td>";
3311
-                    $curday ++;
3311
+                    $curday++;
3312 3312
                 } else {
3313 3313
                     $html .= "<td></td>";
3314 3314
                 }
@@ -3329,18 +3329,18 @@  discard block
 block discarded – undo
3329 3329
      * where datestart and dateend are in yyyyMMddhhmmss format.
3330 3330
      * @TODO Implement really personal events (from user DB) and global events (from main DB)
3331 3331
      */
3332
-    public static function get_personal_agenda_items_between_dates($user_id, $date_start='', $date_end='')
3332
+    public static function get_personal_agenda_items_between_dates($user_id, $date_start = '', $date_end = '')
3333 3333
     {
3334
-        $items = array ();
3334
+        $items = array();
3335 3335
         if ($user_id != strval(intval($user_id))) { return $items; }
3336
-        if (empty($date_start)) { $date_start = date('Y-m-d H:i:s');}
3337
-        if (empty($date_end))   { $date_end = date('Y-m-d H:i:s',mktime(0, 0, 0, date("m"),   date("d"),   date("Y")+1));}
3336
+        if (empty($date_start)) { $date_start = date('Y-m-d H:i:s'); }
3337
+        if (empty($date_end)) { $date_end = date('Y-m-d H:i:s', mktime(0, 0, 0, date("m"), date("d"), date("Y") + 1)); }
3338 3338
         $expr = '/\d{4}-\d{2}-\d{2}\ \d{2}:\d{2}:\d{2}/';
3339
-        if(!preg_match($expr,$date_start)) { return $items; }
3340
-        if(!preg_match($expr,$date_end)) { return $items; }
3339
+        if (!preg_match($expr, $date_start)) { return $items; }
3340
+        if (!preg_match($expr, $date_end)) { return $items; }
3341 3341
 
3342 3342
         // get agenda-items for every course
3343
-        $courses = api_get_user_courses($user_id,false);
3343
+        $courses = api_get_user_courses($user_id, false);
3344 3344
         foreach ($courses as $id => $course) {
3345 3345
             $c = api_get_course_info_by_id($course['real_id']);
3346 3346
             //databases of the courses
@@ -3364,9 +3364,9 @@  discard block
 block discarded – undo
3364 3364
                     " ORDER BY start_date ";
3365 3365
             } else {
3366 3366
                 // if the user is not an administrator of that course, then...
3367
-                if (is_array($group_memberships) && count($group_memberships)>0)
3367
+                if (is_array($group_memberships) && count($group_memberships) > 0)
3368 3368
                 {
3369
-                    $sqlquery = "SELECT " .
3369
+                    $sqlquery = "SELECT ".
3370 3370
                         "DISTINCT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref ".
3371 3371
                         " FROM ".$t_a." agenda, ".
3372 3372
                         $t_ip." ip ".
@@ -3394,13 +3394,13 @@  discard block
 block discarded – undo
3394 3394
 
3395 3395
             $result = Database::query($sqlquery);
3396 3396
             while ($item = Database::fetch_array($result)) {
3397
-                $agendaday = date("j",strtotime($item['start_date']));
3398
-                $month = date("n",strtotime($item['start_date']));
3399
-                $year = date("Y",strtotime($item['start_date']));
3397
+                $agendaday = date("j", strtotime($item['start_date']));
3398
+                $month = date("n", strtotime($item['start_date']));
3399
+                $year = date("Y", strtotime($item['start_date']));
3400 3400
                 $URL = api_get_path(WEB_PATH)."main/calendar/agenda.php?cidReq=".urlencode($course["code"])."&day=$agendaday&month=$month&year=$year#$agendaday";
3401
-                list($year,$month,$day,$hour,$min,$sec) = split('[-: ]',$item['start_date']);
3401
+                list($year, $month, $day, $hour, $min, $sec) = split('[-: ]', $item['start_date']);
3402 3402
                 $start_date = $year.$month.$day.$hour.$min;
3403
-                list($year,$month,$day,$hour,$min,$sec) = split('[-: ]',$item['end_date']);
3403
+                list($year, $month, $day, $hour, $min, $sec) = split('[-: ]', $item['end_date']);
3404 3404
                 $end_date = $year.$month.$day.$hour.$min;
3405 3405
 
3406 3406
                 $items[] = array(
@@ -3429,7 +3429,7 @@  discard block
 block discarded – undo
3429 3429
         $user = api_get_user_id();
3430 3430
         $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE id=".$id." AND user = ".$user;
3431 3431
         $result = Database::query($sql);
3432
-        if(Database::num_rows($result)==1) {
3432
+        if (Database::num_rows($result) == 1) {
3433 3433
             $item = Database::fetch_array($result);
3434 3434
         } else {
3435 3435
             $item = null;
@@ -3451,9 +3451,9 @@  discard block
 block discarded – undo
3451 3451
         // step 2: we which day this is (0=sunday, 1=monday, ...)
3452 3452
         $number_day_in_week = date('w', $random_day_in_week);
3453 3453
         // step 3: we calculate the timestamp of the monday of the week we are in
3454
-        $start_timestamp = $random_day_in_week - (($number_day_in_week -1) * 24 * 60 * 60);
3454
+        $start_timestamp = $random_day_in_week - (($number_day_in_week - 1) * 24 * 60 * 60);
3455 3455
         // step 4: we calculate the timestamp of the sunday of the week we are in
3456
-        $end_timestamp = $random_day_in_week + ((7 - $number_day_in_week +1) * 24 * 60 * 60) - 3600;
3456
+        $end_timestamp = $random_day_in_week + ((7 - $number_day_in_week + 1) * 24 * 60 * 60) - 3600;
3457 3457
         // step 5: calculating the start_day, end_day, start_month, end_month, start_year, end_year
3458 3458
         $start_day = date('j', $start_timestamp);
3459 3459
         $start_month = date('n', $start_timestamp);
Please login to merge, or discard this patch.
main/admin/specific_fields.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -15,36 +15,36 @@  discard block
 block discarded – undo
15 15
 api_protect_admin_script();
16 16
 
17 17
 // Breadcrumb
18
-$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
19
-$interbreadcrumb[] = array ('url' => 'settings.php?category=Search', 'name' => get_lang('PlatformConfigSettings'));
18
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
19
+$interbreadcrumb[] = array('url' => 'settings.php?category=Search', 'name' => get_lang('PlatformConfigSettings'));
20 20
 
21 21
 $libpath = api_get_path(LIBRARY_PATH);
22 22
 
23 23
 include_once $libpath.'specific_fields_manager.lib.php';
24 24
 
25 25
 // Create an add-field box
26
-$form = new FormValidator('add_field','post','','',null,false);
27
-$renderer =& $form->defaultRenderer();
26
+$form = new FormValidator('add_field', 'post', '', '', null, false);
27
+$renderer = & $form->defaultRenderer();
28 28
 $renderer->setCustomElementTemplate('<span>{element}</span> ');
29
-$form->addElement('static','search_advanced_link',null,'<a href="specific_fields_add.php">'.Display::return_icon('fieldadd.gif').get_lang('AddSpecificSearchField').'</a>');
29
+$form->addElement('static', 'search_advanced_link', null, '<a href="specific_fields_add.php">'.Display::return_icon('fieldadd.gif').get_lang('AddSpecificSearchField').'</a>');
30 30
 
31 31
 // Create a sortable table with specific fields data
32
-$column_show = array(1,1,1);
33
-$column_order = array(3,2,1);
32
+$column_show = array(1, 1, 1);
33
+$column_order = array(3, 2, 1);
34 34
 $extra_fields = get_specific_field_list();
35 35
 $number_of_extra_fields = count($extra_fields);
36 36
 
37
-$table = new SortableTableFromArrayConfig($extra_fields,2,50,'',$column_show,$column_order);
38
-$table->set_header(0, '&nbsp;', false,null,'width="2%"', 'style="display:none"');
37
+$table = new SortableTableFromArrayConfig($extra_fields, 2, 50, '', $column_show, $column_order);
38
+$table->set_header(0, '&nbsp;', false, null, 'width="2%"', 'style="display:none"');
39 39
 $table->set_header(1, get_lang('Code'), TRUE, 'width="10%"');
40 40
 $table->set_header(2, get_lang('Name'));
41
-$table->set_header(3, get_lang('Modify'),false,'width="10%"');
41
+$table->set_header(3, get_lang('Modify'), false, 'width="10%"');
42 42
 $table->set_column_filter(3, 'edit_filter');
43 43
 
44
-function edit_filter($id,$url_params,$row) {
44
+function edit_filter($id, $url_params, $row) {
45 45
 	global $charset;
46
-	$return = '<a href="specific_fields_add.php?action=edit&field_id='.$row[0].'">'.Display::return_icon('edit.gif',get_lang('Edit')).'</a>';
47
-	$return .= ' <a href="'.api_get_self().'?action=delete&field_id='.$row[0].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.Display::return_icon('delete.gif',get_lang('Delete')).'</a>';
46
+	$return = '<a href="specific_fields_add.php?action=edit&field_id='.$row[0].'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
47
+	$return .= ' <a href="'.api_get_self().'?action=delete&field_id='.$row[0].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset))."'".')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
48 48
 	return $return;
49 49
 }
50 50
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 Display::display_header(get_lang('SpecificSearchFields'));
61 61
 echo Display::display_normal_message(get_lang('SpecificSearchFieldsIntro'));
62 62
 
63
-if(!empty($_GET['message'])) {
63
+if (!empty($_GET['message'])) {
64 64
   Display::display_confirmation_message($_GET['message']);
65 65
 }
66 66
 
Please login to merge, or discard this patch.
main/admin/specific_fields_add.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,18 +32,18 @@  discard block
 block discarded – undo
32 32
 // Create the form
33 33
 $form = new FormValidator('specific_fields_add');
34 34
 // Field variable name
35
-$form->addElement('hidden','field_id', $fieldId);
36
-$form->addElement('text','field_name',get_lang('FieldName'));
37
-$form->applyFilter('field_name','html_filter');
38
-$form->applyFilter('field_name','trim');
35
+$form->addElement('hidden', 'field_id', $fieldId);
36
+$form->addElement('text', 'field_name', get_lang('FieldName'));
37
+$form->applyFilter('field_name', 'html_filter');
38
+$form->applyFilter('field_name', 'trim');
39 39
 $form->addRule('field_name', get_lang('ThisFieldIsRequired'), 'required');
40 40
 $form->addRule('field_name', get_lang('OnlyLettersAndNumbersAllowed'), 'username');
41
-$form->addRule('field_name', '', 'maxlength',20);
41
+$form->addRule('field_name', '', 'maxlength', 20);
42 42
 
43 43
 // Set default values (only not empty when editing)
44 44
 $defaults = array();
45 45
 if ($fieldId) {
46
-    $form_information = get_specific_field_list(array( 'id' => $fieldId ));
46
+    $form_information = get_specific_field_list(array('id' => $fieldId));
47 47
     $defaults['field_name'] = $form_information[0]['name'];
48 48
 }
49 49
 $form->setDefaults($defaults);
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 if ($form->validate()) {
55 55
     $field = $form->exportValues();
56 56
     $field_name = $field['field_name'];
57
-    if (is_numeric($field['field_id']) && $field['field_id']<>0 && !empty($field['field_id'])) {
57
+    if (is_numeric($field['field_id']) && $field['field_id'] <> 0 && !empty($field['field_id'])) {
58 58
         edit_specific_field($field['field_id'], $field['field_name']);
59 59
         $message = get_lang('FieldEdited');
60 60
     } else {
Please login to merge, or discard this patch.
main/inc/lib/search/search_widget.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 /**
8 8
  * Code
9 9
  */
10
-require_once dirname(__FILE__) . '/IndexableChunk.class.php';
10
+require_once dirname(__FILE__).'/IndexableChunk.class.php';
11 11
 require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
12 12
 
13 13
 /**
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
 /**
30 30
  * Get one term html select
31 31
  */
32
-function format_one_specific_field_select($prefix, $sf_term_array, $op, $extra_select_attr='size="7" class="sf-select-multiple"') {
32
+function format_one_specific_field_select($prefix, $sf_term_array, $op, $extra_select_attr = 'size="7" class="sf-select-multiple"') {
33 33
 	global $charset;
34
-    $multiple_select = '<select '. $extra_select_attr .' title="'. $prefix .'" id="sf-'. $prefix .'" name="sf_'. $prefix .'[]">';
34
+    $multiple_select = '<select '.$extra_select_attr.' title="'.$prefix.'" id="sf-'.$prefix.'" name="sf_'.$prefix.'[]">';
35 35
 
36 36
     $all_selected = '';
37
-    if (!empty($_REQUEST['sf_'. $prefix]) ) {
38
-        if (in_array('__all__', $_REQUEST['sf_'. $prefix])) {
37
+    if (!empty($_REQUEST['sf_'.$prefix])) {
38
+        if (in_array('__all__', $_REQUEST['sf_'.$prefix])) {
39 39
             $all_selected = 'selected="selected"';
40 40
         }
41 41
     }
@@ -44,17 +44,17 @@  discard block
 block discarded – undo
44 44
     } else if ($op == 'or') {
45 45
         $all_selected_name = get_lang('Any');
46 46
     }
47
-    $multiple_select .= '<option value="__all__" '. $all_selected .' >-- '. $all_selected_name .' --</option>';
47
+    $multiple_select .= '<option value="__all__" '.$all_selected.' >-- '.$all_selected_name.' --</option>';
48 48
 
49 49
     foreach ($sf_term_array as $raw_term) {
50 50
         $term = substr($raw_term, 1);
51 51
         if (empty($term)) continue;
52 52
         $html_term = htmlspecialchars($term, ENT_QUOTES, $charset);
53 53
         $selected = '';
54
-        if (!empty($_REQUEST['sf_'.$prefix]) && is_array($_REQUEST['sf_'.$prefix]) && in_array($term,$_REQUEST['sf_'.$prefix])) {
54
+        if (!empty($_REQUEST['sf_'.$prefix]) && is_array($_REQUEST['sf_'.$prefix]) && in_array($term, $_REQUEST['sf_'.$prefix])) {
55 55
             $selected = 'selected="selected"';
56 56
         }
57
-        $multiple_select .= '<option value="'. $html_term .'" '.$selected.'>'. $html_term .'</option>';
57
+        $multiple_select .= '<option value="'.$html_term.'" '.$selected.'>'.$html_term.'</option>';
58 58
     }
59 59
     $multiple_select .= '</select>';
60 60
     return $multiple_select;
@@ -63,15 +63,15 @@  discard block
 block discarded – undo
63 63
 /**
64 64
  * Get terms html selects
65 65
  */
66
-function format_specific_fields_selects($sf_terms, $op, $prefilter_prefix='') {
66
+function format_specific_fields_selects($sf_terms, $op, $prefilter_prefix = '') {
67 67
     // Process each prefix type term
68 68
     $i = 0;
69 69
     $max = count($sf_terms);
70
-    $multiple_selects ='';
70
+    $multiple_selects = '';
71 71
     foreach ($sf_terms as $prefix => $sf_term_array) {
72 72
         if ($prefix == $prefilter_prefix) continue;
73 73
         $multiple_select = '';
74
-        if ($i>0) {
74
+        if ($i > 0) {
75 75
             //print "+" image
76 76
             $multiple_select .= '<td><img class="sf-select-splitter" src="../img/search-big-plus.gif" alt="plus-sign-decoration"/></td>';
77 77
         }
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 
90 90
         $sf_copy = $sf_term_array;
91 91
         // get specific field name
92
-        $sf_value = get_specific_field_list(array( 'code' => "'$prefix'" ));
92
+        $sf_value = get_specific_field_list(array('code' => "'$prefix'"));
93 93
         $sf_value = array_shift($sf_value);
94
-        $multiple_select .= '<td><label class="sf-select-multiple-title" for="sf_'. $prefix .'[]">' . $sf_value['name'].'</label><br />';
94
+        $multiple_select .= '<td><label class="sf-select-multiple-title" for="sf_'.$prefix.'[]">'.$sf_value['name'].'</label><br />';
95 95
         $multiple_select .= format_one_specific_field_select($prefix, $sf_term_array, $op, 'multiple="multiple" size="7" class="sf-select-multiple"');
96 96
         $multiple_select .= '</td>';
97 97
         $multiple_selects .= $multiple_select;
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
  */
108 108
 function search_widget_normal_form($action, $show_thesaurus, $sf_terms, $op) {
109 109
     $thesaurus_icon = Display::return_icon('thesaurus.gif', get_lang('SearchAdvancedOptions'), array('id'=>'thesaurus-icon'));
110
-    $advanced_options = '<a id="tags-toggle" href="#">'.  get_lang('SearchAdvancedOptions') .'</a>';
111
-    $display_thesaurus = ($show_thesaurus==true? 'block': 'none');
112
-    $help = '<h3>'. get_lang('SearchKeywordsHelpTitle') .'</h3>'. get_lang('SearchKeywordsHelpComment');
113
-    $mode = (!empty($_REQUEST['mode'])? htmlentities($_REQUEST['mode']): 'gallery');
114
-    $type = (!empty($_REQUEST['type'])? htmlentities($_REQUEST['type']): 'normal');
110
+    $advanced_options = '<a id="tags-toggle" href="#">'.get_lang('SearchAdvancedOptions').'</a>';
111
+    $display_thesaurus = ($show_thesaurus == true ? 'block' : 'none');
112
+    $help = '<h3>'.get_lang('SearchKeywordsHelpTitle').'</h3>'.get_lang('SearchKeywordsHelpComment');
113
+    $mode = (!empty($_REQUEST['mode']) ? htmlentities($_REQUEST['mode']) : 'gallery');
114
+    $type = (!empty($_REQUEST['type']) ? htmlentities($_REQUEST['type']) : 'normal');
115 115
 
116 116
     /**
117 117
      * POST avoid long urls, but we are using GET because
@@ -119,36 +119,36 @@  discard block
 block discarded – undo
119 119
      * could not send a form in pagination
120 120
      */
121 121
 
122
-	if (isset($_GET['action']) && strcmp(trim($_GET['action']),'search')===0) {
123
-		$action='index.php';
122
+	if (isset($_GET['action']) && strcmp(trim($_GET['action']), 'search') === 0) {
123
+		$action = 'index.php';
124 124
 	}
125 125
 	$navigator_info = api_get_navigator();
126 126
 
127
-	if ($navigator_info['name']=='Internet Explorer' &&  $navigator_info['version']=='6') {
128
-		$submit_button1	= '<input type="submit" id="submit" value="'. get_lang('Search') .'" />';
129
-		$submit_button2 = '<input class="lower-submit" type="submit" value="'. get_lang('Search') .'" />';
130
-        $reset_button 	= '<input type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords') .'" />';
127
+	if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
128
+		$submit_button1	= '<input type="submit" id="submit" value="'.get_lang('Search').'" />';
129
+		$submit_button2 = '<input class="lower-submit" type="submit" value="'.get_lang('Search').'" />';
130
+        $reset_button = '<input type="submit" id="tags-clean" value="'.get_lang('SearchResetKeywords').'" />';
131 131
 	} else {
132
-		$submit_button1 = '<button class="search" type="submit" id="submit" value="'. get_lang("Search") .'" /> '. get_lang('Search') .'</button>';
133
-		$submit_button2 = '<button class="search" type="submit" value="'. get_lang('Search') .'" />'. get_lang('Search') .'</button>';
134
-        $reset_button 	= '<button class="save"   type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords') .'" />'. get_lang('SearchResetKeywords') .'</button> ';
132
+		$submit_button1 = '<button class="search" type="submit" id="submit" value="'.get_lang("Search").'" /> '.get_lang('Search').'</button>';
133
+		$submit_button2 = '<button class="search" type="submit" value="'.get_lang('Search').'" />'.get_lang('Search').'</button>';
134
+        $reset_button = '<button class="save"   type="submit" id="tags-clean" value="'.get_lang('SearchResetKeywords').'" />'.get_lang('SearchResetKeywords').'</button> ';
135 135
 	}
136 136
 
137 137
     $query = isset($_REQUEST['query']) ? Security::remove_XSS($_REQUEST['query']) : null;
138 138
 
139
-    $form = '<form id="chamilo_search" action="'. $action .'" method="GET">
140
-            <input type="text" id="query" name="query" size="40" value="' . $query . '" />
141
-            <input type="hidden" name="mode" value="'. $mode .'"/>
142
-            <input type="hidden" name="type" value="'. $type .'"/>
139
+    $form = '<form id="chamilo_search" action="'.$action.'" method="GET">
140
+            <input type="text" id="query" name="query" size="40" value="' . $query.'" />
141
+            <input type="hidden" name="mode" value="'. $mode.'"/>
142
+            <input type="hidden" name="type" value="'. $type.'"/>
143 143
             <input type="hidden" name="tablename_page_nr" value="1" />
144 144
           	'.$submit_button1.'
145 145
             <br /><br />';
146 146
     $list = get_specific_field_list();
147 147
 
148
-    if(!empty($list)) {
149
-        $form .= '<span class="search-links-box">'. $advanced_options .'&nbsp;</span>
150
-            <div id="tags" class="tags" style="display:'. $display_thesaurus .';">
151
-                <div class="search-help-box">'. $help .'</div>
148
+    if (!empty($list)) {
149
+        $form .= '<span class="search-links-box">'.$advanced_options.'&nbsp;</span>
150
+            <div id="tags" class="tags" style="display:'. $display_thesaurus.';">
151
+                <div class="search-help-box">'. $help.'</div>
152 152
                 <table>
153 153
                 <tr>';
154 154
         $form .= format_specific_fields_selects($sf_terms, $op);
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
         $form .= '</tr>
163 163
                     <tr>
164 164
                         <td id="operator-select">
165
-                            '. get_lang('SearchCombineSearchWith') .':<br />
166
-                            <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked .'>'. api_strtoupper(get_lang('Or')) .'</input>
167
-                            <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked .'>'. api_strtoupper(get_lang('And')) .'</input>
165
+                            '. get_lang('SearchCombineSearchWith').':<br />
166
+                            <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked.'>'.api_strtoupper(get_lang('Or')).'</input>
167
+                            <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked.'>'.api_strtoupper(get_lang('And')).'</input>
168 168
                         </td>
169 169
                         <td></td>
170 170
                         <td>
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
                     </table>
177 177
                 </div>';
178 178
     }
179
-    $form .='</form>
179
+    $form .= '</form>
180 180
     <br style="clear: both;"/>';
181 181
     return $form;
182 182
 }
@@ -186,36 +186,36 @@  discard block
 block discarded – undo
186 186
  *
187 187
  * This type allow filter all other multiple select terms by one term in a dinamic way
188 188
  */
189
-function search_widget_prefilter_form($action, $show_thesaurus, $sf_terms, $op, $prefilter_prefix=NULL) {
189
+function search_widget_prefilter_form($action, $show_thesaurus, $sf_terms, $op, $prefilter_prefix = NULL) {
190 190
     $thesaurus_icon = Display::return_icon('thesaurus.gif', get_lang('SearchAdvancedOptions'), array('id'=>'thesaurus-icon'));
191
-    $advanced_options = '<a id="tags-toggle" href="#">'.  get_lang('SearchAdvancedOptions') .'</a>';
192
-    $display_thesaurus = ($show_thesaurus==true? 'block': 'none');
193
-    $help = '<h3>'. get_lang('SearchKeywordsHelpTitle') .'</h3>'. get_lang('SearchKeywordsHelpComment');
194
-    $mode = (!empty($_REQUEST['mode'])? htmlentities($_REQUEST['mode']): 'gallery');
195
-    $type = (!empty($_REQUEST['type'])? htmlentities($_REQUEST['type']): 'normal');
191
+    $advanced_options = '<a id="tags-toggle" href="#">'.get_lang('SearchAdvancedOptions').'</a>';
192
+    $display_thesaurus = ($show_thesaurus == true ? 'block' : 'none');
193
+    $help = '<h3>'.get_lang('SearchKeywordsHelpTitle').'</h3>'.get_lang('SearchKeywordsHelpComment');
194
+    $mode = (!empty($_REQUEST['mode']) ? htmlentities($_REQUEST['mode']) : 'gallery');
195
+    $type = (!empty($_REQUEST['type']) ? htmlentities($_REQUEST['type']) : 'normal');
196 196
 
197 197
     /**
198 198
      * POST avoid long urls, but we are using GET because
199 199
      * SortableTableFromArray pagination is done with simple links, so now we
200 200
      * could not send a form in pagination
201 201
      */
202
-	if (isset($_GET['action']) && strcmp(trim($_GET['action']),'search')===0) {
203
-		$action='index.php';
202
+	if (isset($_GET['action']) && strcmp(trim($_GET['action']), 'search') === 0) {
203
+		$action = 'index.php';
204 204
 	}
205 205
 
206 206
     $form = '
207
-        <form id="chamilo_search" action="'. $action .'" method="GET">
207
+        <form id="chamilo_search" action="'. $action.'" method="GET">
208 208
             <input type="text" id="query" name="query" size="40" />
209
-            <input type="hidden" name="mode" value="'. $mode .'"/>
210
-            <input type="hidden" name="type" value="'. $type .'"/>
209
+            <input type="hidden" name="mode" value="'. $mode.'"/>
210
+            <input type="hidden" name="type" value="'. $type.'"/>
211 211
             <input type="hidden" name="tablename_page_nr" value="1" />
212
-            <input type="submit" id="submit" value="'. get_lang("Search") .'" />
212
+            <input type="submit" id="submit" value="'. get_lang("Search").'" />
213 213
             <br /><br />';
214 214
         $list = get_specific_field_list();
215
-        if(!empty($list)) {
216
-            $form .=' <span class="search-links-box">'. $thesaurus_icon . $advanced_options .'&nbsp;</span>
217
-                    <div id="tags" class="tags" style="display:'. $display_thesaurus .';">
218
-                        <div class="search-help-box">'. $help .'</div>
215
+        if (!empty($list)) {
216
+            $form .= ' <span class="search-links-box">'.$thesaurus_icon.$advanced_options.'&nbsp;</span>
217
+                    <div id="tags" class="tags" style="display:'. $display_thesaurus.';">
218
+                        <div class="search-help-box">'. $help.'</div>
219 219
                         <table>
220 220
                         <tr>';
221 221
             if (!is_null($prefilter_prefix)) {
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
230 230
                 $sf_term_array = $temp;
231 231
 
232 232
                 // get specific field name
233
-                $sf_value = get_specific_field_list(array( 'code' => "'$prefilter_prefix'" ));
233
+                $sf_value = get_specific_field_list(array('code' => "'$prefilter_prefix'"));
234 234
                 $sf_value = array_shift($sf_value);
235
-                $form .= '<label class="sf-select-multiple-title" for="sf_'. $prefix .'[]">'.$icons_for_search_terms[$prefix].' '.$sf_value['name'].'</label><br />';
235
+                $form .= '<label class="sf-select-multiple-title" for="sf_'.$prefix.'[]">'.$icons_for_search_terms[$prefix].' '.$sf_value['name'].'</label><br />';
236 236
 
237 237
                 $form .= format_one_specific_field_select($prefilter_prefix, $sf_term_array, $op, 'id="prefilter"');
238 238
                 $form .= format_specific_fields_selects($sf_terms, $op, $prefilter_prefix);
@@ -252,15 +252,15 @@  discard block
 block discarded – undo
252 252
                         </tr>
253 253
                         <tr>
254 254
                             <td id="operator-select">
255
-                                '. get_lang('SearchCombineSearchWith') .':<br />
256
-                                <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked .'>'. api_strtoupper(get_lang('Or')) .'</input>
257
-                                <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked .'>'. api_strtoupper(get_lang('And')) .'</input>
255
+                                '. get_lang('SearchCombineSearchWith').':<br />
256
+                                <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked.'>'.api_strtoupper(get_lang('Or')).'</input>
257
+                                <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked.'>'.api_strtoupper(get_lang('And')).'</input>
258 258
                             </td>
259 259
                             <td></td>
260 260
                             <td>
261 261
                                 <br />
262
-                                <input class="lower-submit" type="submit" value="'. get_lang('Search') .'" />
263
-                                <input type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords') .'" />
262
+                                <input class="lower-submit" type="submit" value="'. get_lang('Search').'" />
263
+                                <input type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords').'" />
264 264
                             </td>
265 265
                         </tr>
266 266
                         </table>
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
  * Show search form
278 278
  */
279 279
 function display_search_form($action, $show_thesaurus, $sf_terms, $op) {
280
-    $type = (!empty($_REQUEST['type'])? htmlentities($_REQUEST['type']): 'normal');
280
+    $type = (!empty($_REQUEST['type']) ? htmlentities($_REQUEST['type']) : 'normal');
281 281
 
282 282
     switch ($type) {
283 283
         case 'prefilter':
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
  * @param   string $action     Just in case your action is not
305 305
  * index.php
306 306
  */
307
-function search_widget_show($action='index.php')
307
+function search_widget_show($action = 'index.php')
308 308
 {
309 309
     require_once api_get_path(LIBRARY_PATH).'search/ChamiloQuery.php';
310 310
     // TODO: load images dinamically when they're avalaible from specific field ui to add
@@ -317,14 +317,14 @@  discard block
 block discarded – undo
317 317
     if (($cid = api_get_course_id()) != -1) { // with cid
318 318
 
319 319
         // get search engine terms
320
-        $course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID . $cid);
320
+        $course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID.$cid);
321 321
         $dkterms = chamilo_query_simple_query('', 0, 1000, array($course_filter));
322 322
 
323 323
         //prepare specific fields names (and also get possible URL param names)
324 324
         foreach ($specific_fields as $specific_field) {
325 325
             $temp = array();
326
-            if (is_array($dkterms) && count($dkterms)>0) {
327
-            	foreach($dkterms[1] as $obj) {
326
+            if (is_array($dkterms) && count($dkterms) > 0) {
327
+            	foreach ($dkterms[1] as $obj) {
328 328
                 	$temp = array_merge($obj['sf-'.$specific_field['code']], $temp);
329 329
             	}
330 330
         	}
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
     }
353 353
 
354 354
     $op = 'or';
355
-    if (!empty($_REQUEST['operator']) && in_array($op,array('or','and'))) {
355
+    if (!empty($_REQUEST['operator']) && in_array($op, array('or', 'and'))) {
356 356
         $op = $_REQUEST['operator'];
357 357
     }
358 358
 
Please login to merge, or discard this patch.
main/document/upload.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 }
69 69
 
70 70
 if (empty($document_data)) {
71
-    $document_id  = $parent_id =  0;
71
+    $document_id = $parent_id = 0;
72 72
     $path = '/';
73 73
 } else {
74 74
     $document_id = $document_data['id'];
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
 
202 202
 // Link back to the documents overview
203 203
 if ($is_certificate_mode) {
204
-    $actions = '<a href="document.php?id='.$document_id.'&selectcat=' . $selectcat.'&'.api_get_cidreq().'">'.
205
-        Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('CertificateOverview'),'',ICON_SIZE_MEDIUM).'</a>';
204
+    $actions = '<a href="document.php?id='.$document_id.'&selectcat='.$selectcat.'&'.api_get_cidreq().'">'.
205
+        Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('CertificateOverview'), '', ICON_SIZE_MEDIUM).'</a>';
206 206
 } else {
207 207
     $actions = '<a href="document.php?id='.$document_id.'&'.api_get_cidreq().'">'.
208
-        Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
208
+        Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).'</a>';
209 209
 }
210 210
 
211 211
 // Link to create a folder
Please login to merge, or discard this patch.