Completed
Push — 1.10.x ( f409b5...1f80a0 )
by Julito
112:29 queued 56:28
created
main/inc/ajax/social.ajax.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
         }
22 22
 
23 23
         if (isset($_GET['friend_id'])) {
24
-            $my_current_friend  = $_GET['friend_id'];
24
+            $my_current_friend = $_GET['friend_id'];
25 25
             UserManager::relate_users($current_user_id, $my_current_friend, $relation_type);
26 26
             UserManager::relate_users($my_current_friend, $current_user_id, $relation_type);
27 27
             SocialManager::invitation_accepted($my_current_friend, $current_user_id);
28 28
             Display::display_normal_message(api_xml_http_response_encode(get_lang('AddedContactToList')));
29 29
 
30
-            header('Location: ' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php');
30
+            header('Location: '.api_get_path(WEB_CODE_PATH).'social/invitations.php');
31 31
         }
32 32
         break;
33 33
     case 'deny_friend':
@@ -37,15 +37,15 @@  discard block
 block discarded – undo
37 37
         }
38 38
 
39 39
         if (isset($_GET['is_my_friend'])) {
40
-            $relation_type = USER_RELATION_TYPE_FRIEND;//my friend
40
+            $relation_type = USER_RELATION_TYPE_FRIEND; //my friend
41 41
         } else {
42
-            $relation_type = USER_RELATION_TYPE_UNKNOW;//Contact unknown
42
+            $relation_type = USER_RELATION_TYPE_UNKNOW; //Contact unknown
43 43
         }
44 44
         if (isset($_GET['denied_friend_id'])) {
45 45
             SocialManager::invitation_denied($_GET['denied_friend_id'], $current_user_id);
46 46
             Display::display_confirmation_message(api_xml_http_response_encode(get_lang('InvitationDenied')));
47 47
             
48
-            header('Location: ' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php');
48
+            header('Location: '.api_get_path(WEB_CODE_PATH).'social/invitations.php');
49 49
         }
50 50
         break;
51 51
     case 'delete_friend':
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
             echo '';
64 64
             break;
65 65
         }
66
-        $user_id	= api_get_user_id();
67
-        $name_search= Security::remove_XSS($_POST['search_name_q']);
66
+        $user_id = api_get_user_id();
67
+        $name_search = Security::remove_XSS($_POST['search_name_q']);
68 68
         $number_friends = 0;
69 69
 
70 70
         if (isset($name_search) && $name_search != 'undefined') {
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
 
79 79
         $number_friends = count($friends);
80 80
         if ($number_friends != 0) {
81
-            $number_loop   = ($number_friends/$number_of_images);
81
+            $number_loop   = ($number_friends / $number_of_images);
82 82
             $loop_friends  = ceil($number_loop);
83
-            $j=0;
84
-            for ($k=0; $k<$loop_friends; $k++) {
85
-                if ($j==$number_of_images) {
86
-                    $number_of_images=$number_of_images*2;
83
+            $j = 0;
84
+            for ($k = 0; $k < $loop_friends; $k++) {
85
+                if ($j == $number_of_images) {
86
+                    $number_of_images = $number_of_images * 2;
87 87
                 }
88
-                while ($j<$number_of_images) {
88
+                while ($j < $number_of_images) {
89 89
                     if (isset($friends[$j])) {
90 90
                         $friend = $friends[$j];
91 91
                         $user_name = api_xml_http_response_encode($friend['firstName'].' '.$friend['lastName']);
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
 
94 94
                         $friend_html .= '
95 95
                             <div class="col-md-3">
96
-                                <div class="thumbnail text-center" id="div_' . $friends[$j]['friend_user_id'] . '">
97
-                                    <img src="' . $userPicture . '" class="img-responsive" id="imgfriend_' . $friend['friend_user_id'] . '" title="$user_name">
96
+                                <div class="thumbnail text-center" id="div_' . $friends[$j]['friend_user_id'].'">
97
+                                    <img src="' . $userPicture.'" class="img-responsive" id="imgfriend_'.$friend['friend_user_id'].'" title="$user_name">
98 98
                                     <div class="caption">
99 99
                                         <h3>
100
-                                            <a href="profile.php?u=' . $friend['friend_user_id'] . '">' . $user_name . '</a>
100
+                                            <a href="profile.php?u=' . $friend['friend_user_id'].'">'.$user_name.'</a>
101 101
                                         </h3>
102 102
                                         <p>
103
-                                            <button class="btn btn-danger" onclick="delete_friend(this)" id=img_' . $friend['friend_user_id'] . '>
104
-                                                ' . get_lang('Delete') . '
103
+                                            <button class="btn btn-danger" onclick="delete_friend(this)" id=img_' . $friend['friend_user_id'].'>
104
+                                                ' . get_lang('Delete').'
105 105
                                             </button>
106 106
                                         </p>
107 107
                                     </div>
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
         switch ($action) {
132 132
             case 'load_course':
133
-                $course_id =  intval($_POST['course_code']); // the int course id
133
+                $course_id = intval($_POST['course_code']); // the int course id
134 134
                 $course_info = api_get_course_info_by_id($course_id);
135 135
                 $course_code = $course_info['code'];
136 136
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
                     //------Forum messages
139 139
                     $forum_result = get_all_post_from_user($user_id, $course_code);
140 140
                     $all_result_data = 0;
141
-                    if ($forum_result !='') {
141
+                    if ($forum_result != '') {
142 142
                         echo '<div id="social-forum-main-title">';
143 143
                         echo api_xml_http_response_encode(get_lang('Forum'));
144 144
                         echo '</div>';
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         if (!empty($array)) {
202 202
             ksort($array);
203 203
             $html = '';
204
-            for($i = 0; $i < count($array); $i++) {
204
+            for ($i = 0; $i < count($array); $i++) {
205 205
                 $post = $array[$i]['html'];
206 206
                 $comment = SocialManager::getWallMessagesHTML($userId, $friendId, $array[$i]['id']);
207 207
                 $html .= '<div class="panel panel-info"><div class="panel-body">'.$post.$comment.'</div></div>';
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
             $html .= Display::div(
210 210
                 Display::url(
211 211
                     get_lang('SeeMore'),
212
-                    api_get_self() . '?u=' . $userId . '&a=listWallMessage&start=' .
213
-                    ($start + $length + 1) . '&length=' . $length,
212
+                    api_get_self().'?u='.$userId.'&a=listWallMessage&start='.
213
+                    ($start + $length + 1).'&length='.$length,
214 214
                     array(
215 215
                         'class' => 'nextPage',
216 216
                     )
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     case 'readUrlWithOpenGraph':
227 227
         $url = isset($_POST['social_wall_new_msg_main']) ? $_POST['social_wall_new_msg_main'] : '';
228 228
         $html = '';
229
-        if (SocialManager::verifyUrl($url) == true){
229
+        if (SocialManager::verifyUrl($url) == true) {
230 230
             $html = Security::remove_XSS(
231 231
                 SocialManager::readContentWithOpenGraph($url)
232 232
             );
Please login to merge, or discard this patch.
main/inc/ajax/skill.ajax.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         $return_skills = array();
40 40
         foreach ($skills as $skill) {
41 41
             $skill['caption'] = $skill['name'];
42
-            $skill['value'] =  $skill['id'];
42
+            $skill['value'] = $skill['id'];
43 43
             $return_skills[] = $skill;
44 44
         }
45 45
         echo json_encode($return_skills);
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         if (!empty($gradebooks)) {
52 52
             foreach ($gradebooks as $gradebook) {
53 53
                 if ($gradebook['parent_id'] == 0 && !empty($gradebook['certif_min_score']) && !empty($gradebook['document_id'])) {
54
-                    $gradebook_list[]  = $gradebook;
54
+                    $gradebook_list[] = $gradebook;
55 55
                     //$gradebook['name'] = $gradebook['name'];
56 56
                     //$gradebook_list[]  = $gradebook;
57 57
                 } else {
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         $return = array();
68 68
         foreach ($gradebooks as $item) {
69 69
             $item['caption'] = $item['name'];
70
-            $item['value'] =  $item['id'];
70
+            $item['value'] = $item['id'];
71 71
             $return[] = $item;
72 72
         }
73 73
         echo json_encode($return);
@@ -92,13 +92,13 @@  discard block
 block discarded – undo
92 92
         }
93 93
         break;
94 94
     case 'get_skills_by_profile':
95
-        $skill_rel_profile   = new SkillRelProfile();
95
+        $skill_rel_profile = new SkillRelProfile();
96 96
         $profile_id = isset($_REQUEST['profile_id']) ? $_REQUEST['profile_id'] : null;
97 97
         $skills = $skill_rel_profile->get_skills_by_profile($profile_id);
98 98
         echo json_encode($skills);
99 99
         break;
100 100
     case 'get_saved_profiles':
101
-        $skill_profile   = new SkillProfile();
101
+        $skill_profile = new SkillProfile();
102 102
         $profiles = $skill_profile->get_all();
103 103
         Display::display_no_header();
104 104
         Display::$global_template->assign('profiles', $profiles);
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
             $success = false;
188 188
         }
189 189
 
190
-        $result = array (
190
+        $result = array(
191 191
             'success' => $success,
192 192
             'data' => $return
193 193
         );
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         $skills = $skill->get_direct_parents($id);
199 199
         $return = array();
200 200
         foreach ($skills as $skill) {
201
-            $return [$skill['data']['id']] = array (
201
+            $return [$skill['data']['id']] = array(
202 202
                 'id'        => $skill['data']['id'],
203 203
                 'parent_id' => $skill['data']['parent_id'],
204 204
                 'name'      => $skill['data']['name']
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
         echo json_encode($return);
208 208
         break;
209 209
     case 'profile_matches':
210
-        $skill_rel_user  = new SkillRelUser();
211
-        $skills = (!empty($_REQUEST['skill_id'])?$_REQUEST['skill_id']:array());
210
+        $skill_rel_user = new SkillRelUser();
211
+        $skills = (!empty($_REQUEST['skill_id']) ? $_REQUEST['skill_id'] : array());
212 212
 
213 213
         $total_skills_to_search = $skills;
214 214
         $users  = $skill_rel_user->get_user_by_skills($skills);
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
                     //$gradebook['name'] = $gradebook['name'];
56 56
                     //$gradebook_list[]  = $gradebook;
57 57
                 } else {
58
-                  //  $gradebook['name'] = $gradebook_list[$gradebook['parent_id']]['name'].' > '.$gradebook['name'];
58
+                    //  $gradebook['name'] = $gradebook_list[$gradebook['parent_id']]['name'].' > '.$gradebook['name'];
59 59
                     //$gradebook_list[]  = $gradebook;
60 60
                 }
61 61
             }
Please login to merge, or discard this patch.
main/inc/ajax/forum.ajax.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 require_once '../global.inc.php';
11
-require_once api_get_path(SYS_CODE_PATH) . 'forum/forumfunction.inc.php';
11
+require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
12 12
 
13 13
 // First, protect this script
14 14
 api_protect_course_script(false);
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
                     break;
64 64
                 }
65 65
                 // If pass all previous control, user can edit post
66
-                $courseId = isset($_REQUEST['c_id'])? intval($_REQUEST['c_id']) : api_get_course_int_id();
66
+                $courseId = isset($_REQUEST['c_id']) ? intval($_REQUEST['c_id']) : api_get_course_int_id();
67 67
                 $json['courseId'] = $courseId;
68
-                $forumId = isset($_REQUEST['forum'])? intval($_REQUEST['forum']) : null;
68
+                $forumId = isset($_REQUEST['forum']) ? intval($_REQUEST['forum']) : null;
69 69
                 $json['forum'] = $forumId;
70
-                $threadId = isset($_REQUEST['thread'])? intval($_REQUEST['thread']) : null;
70
+                $threadId = isset($_REQUEST['thread']) ? intval($_REQUEST['thread']) : null;
71 71
                 $json['thread'] = $threadId;
72
-                $postId = isset($_REQUEST['postId'])? intval($_REQUEST['postId']) : null;
72
+                $postId = isset($_REQUEST['postId']) ? intval($_REQUEST['postId']) : null;
73 73
                 $json['postId'] = $postId;
74 74
 
75 75
                 if (!empty($courseId) &&
Please login to merge, or discard this patch.
main/inc/ajax/link.ajax.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
             // set URL and other appropriate options
24 24
             $defaults = array(
25 25
                 CURLOPT_URL => $url,
26
-                CURLOPT_FOLLOWLOCATION => true,         // follow redirects accept youtube.com
26
+                CURLOPT_FOLLOWLOCATION => true, // follow redirects accept youtube.com
27 27
                 CURLOPT_HEADER => 0,
28 28
                 CURLOPT_RETURNTRANSFER => true,
29 29
                 CURLOPT_TIMEOUT => 4
Please login to merge, or discard this patch.
main/inc/ajax/session.ajax.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
             $list_sessions = SessionManager::get_sessions_by_user($user_id, true);
16 16
             if (!empty($list_sessions)) {
17 17
                 foreach ($list_sessions as $session_item) {
18
-                    echo $session_item['session_name'] . '<br />';
18
+                    echo $session_item['session_name'].'<br />';
19 19
                 }
20 20
             } else {
21 21
                 echo get_lang('NoSessionsForThisUser');
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
                 [
30 30
                     's.name' => [
31 31
                         'operator' => 'LIKE',
32
-                        'value' => "%" . $_REQUEST['q'] . "%"
32
+                        'value' => "%".$_REQUEST['q']."%"
33 33
                     ]
34 34
                 ]
35 35
             );
Please login to merge, or discard this patch.
main/inc/ajax/nanogong.ajax.php 3 patches
Switch Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -30,44 +30,44 @@
 block discarded – undo
30 30
 }
31 31
 
32 32
 switch ($action) {
33
-	case 'get_file':
34
-		if ($nano->get_param_value('user_id') == api_get_user_id() || api_is_allowed_to_edit()) {
35
-			$file_path = $nano->load_filename_if_exists();
36
-			//$file_path = '/var/www/rocio/courses/GREAT123/exercises/0/2/5/1/1-0-1-2-5-38.mp3';
37
-			if ($file_path) {
38
-				$info = pathinfo($file_path);
39
-				$user_info = api_get_user_info($nano->params['user_id']);
40
-				$name = get_lang('Quiz').'-'.$user_info['firstname'].'-'.$user_info['lastname'].'.'.$info['extension'];
41
-				$download = true;
42
-				if (isset($_REQUEST['download'])  && $_REQUEST['download'] == 0) {
43
-					$download = false;
44
-				}
45
-				DocumentManager::file_send_for_download($file_path, $download);
46
-				exit;
47
-			}
48
-		}
49
-		break;
50
-	case 'show_audio':
51
-		if (!$is_nano) {
52
-			echo $nano->return_js($_REQUEST);
53
-		}
54
-		echo $nano->show_audio_file($is_nano);
55
-		break;
56
-	case 'delete':
57
-		$return = $nano->delete_files();
58
-		if ($return == 1) {
59
-			//cant' do this because the post that nano send doesnt take into account the session
60
-			Display::display_confirmation_message(get_lang('FileDeleted'));
61
-		} else {
62
-			Display::display_confirmation_message(get_lang('FileNotFound'));
63
-		}
64
-		break;
65
-	case 'show_form':
66
-		api_protect_course_script(true);
67
-		Display::display_reduced_header();
68
-		echo $nano->return_js($_REQUEST);
69
-		echo $nano->return_form();
70
-		break;
33
+	    case 'get_file':
34
+		    if ($nano->get_param_value('user_id') == api_get_user_id() || api_is_allowed_to_edit()) {
35
+			    $file_path = $nano->load_filename_if_exists();
36
+			    //$file_path = '/var/www/rocio/courses/GREAT123/exercises/0/2/5/1/1-0-1-2-5-38.mp3';
37
+			    if ($file_path) {
38
+				    $info = pathinfo($file_path);
39
+				    $user_info = api_get_user_info($nano->params['user_id']);
40
+				    $name = get_lang('Quiz').'-'.$user_info['firstname'].'-'.$user_info['lastname'].'.'.$info['extension'];
41
+				    $download = true;
42
+				    if (isset($_REQUEST['download'])  && $_REQUEST['download'] == 0) {
43
+					    $download = false;
44
+				    }
45
+				    DocumentManager::file_send_for_download($file_path, $download);
46
+				    exit;
47
+			    }
48
+		    }
49
+		    break;
50
+	    case 'show_audio':
51
+		    if (!$is_nano) {
52
+			    echo $nano->return_js($_REQUEST);
53
+		    }
54
+		    echo $nano->show_audio_file($is_nano);
55
+		    break;
56
+	    case 'delete':
57
+		    $return = $nano->delete_files();
58
+		    if ($return == 1) {
59
+			    //cant' do this because the post that nano send doesnt take into account the session
60
+			    Display::display_confirmation_message(get_lang('FileDeleted'));
61
+		    } else {
62
+			    Display::display_confirmation_message(get_lang('FileNotFound'));
63
+		    }
64
+		    break;
65
+	    case 'show_form':
66
+		    api_protect_course_script(true);
67
+		    Display::display_reduced_header();
68
+		    echo $nano->return_js($_REQUEST);
69
+		    echo $nano->return_form();
70
+		    break;
71 71
     case 'save_file':
72 72
     	//User access same as upload.php
73 73
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 $action = $_REQUEST['a'];
12 12
 
13 13
 unset($_REQUEST['a']);
14
-$js_path 		= api_get_path(WEB_LIBRARY_PATH).'javascript/';
14
+$js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/';
15 15
 
16 16
 //Fix in order to add the exe_id
17 17
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 				$user_info = api_get_user_info($nano->params['user_id']);
40 40
 				$name = get_lang('Quiz').'-'.$user_info['firstname'].'-'.$user_info['lastname'].'.'.$info['extension'];
41 41
 				$download = true;
42
-				if (isset($_REQUEST['download'])  && $_REQUEST['download'] == 0) {
42
+				if (isset($_REQUEST['download']) && $_REQUEST['download'] == 0) {
43 43
 					$download = false;
44 44
 				}
45 45
 				DocumentManager::file_send_for_download($file_path, $download);
Please login to merge, or discard this patch.
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -16,84 +16,84 @@
 block discarded – undo
16 16
 //Fix in order to add the exe_id
17 17
 
18 18
 if (isset($_REQUEST['from_htaccess'])) {
19
-	if (isset($_REQUEST['file'])) {
20
-		$fileinfo = pathinfo($_REQUEST['file']);
21
-		$items = explode('-', $fileinfo['filename']);
22
-		$_REQUEST['exe_id'] = $items[5];
23
-	}
19
+    if (isset($_REQUEST['file'])) {
20
+        $fileinfo = pathinfo($_REQUEST['file']);
21
+        $items = explode('-', $fileinfo['filename']);
22
+        $_REQUEST['exe_id'] = $items[5];
23
+    }
24 24
 }
25 25
 $nano = new Nanogong($_REQUEST);
26 26
 $is_nano = false;
27 27
 
28 28
 if (isset($_REQUEST['is_nano'])) {
29
-	$is_nano = true;
29
+    $is_nano = true;
30 30
 }
31 31
 
32 32
 switch ($action) {
33
-	case 'get_file':
34
-		if ($nano->get_param_value('user_id') == api_get_user_id() || api_is_allowed_to_edit()) {
35
-			$file_path = $nano->load_filename_if_exists();
36
-			//$file_path = '/var/www/rocio/courses/GREAT123/exercises/0/2/5/1/1-0-1-2-5-38.mp3';
37
-			if ($file_path) {
38
-				$info = pathinfo($file_path);
39
-				$user_info = api_get_user_info($nano->params['user_id']);
40
-				$name = get_lang('Quiz').'-'.$user_info['firstname'].'-'.$user_info['lastname'].'.'.$info['extension'];
41
-				$download = true;
42
-				if (isset($_REQUEST['download'])  && $_REQUEST['download'] == 0) {
43
-					$download = false;
44
-				}
45
-				DocumentManager::file_send_for_download($file_path, $download);
46
-				exit;
47
-			}
48
-		}
49
-		break;
50
-	case 'show_audio':
51
-		if (!$is_nano) {
52
-			echo $nano->return_js($_REQUEST);
53
-		}
54
-		echo $nano->show_audio_file($is_nano);
55
-		break;
56
-	case 'delete':
57
-		$return = $nano->delete_files();
58
-		if ($return == 1) {
59
-			//cant' do this because the post that nano send doesnt take into account the session
60
-			Display::display_confirmation_message(get_lang('FileDeleted'));
61
-		} else {
62
-			Display::display_confirmation_message(get_lang('FileNotFound'));
63
-		}
64
-		break;
65
-	case 'show_form':
66
-		api_protect_course_script(true);
67
-		Display::display_reduced_header();
68
-		echo $nano->return_js($_REQUEST);
69
-		echo $nano->return_form();
70
-		break;
33
+    case 'get_file':
34
+        if ($nano->get_param_value('user_id') == api_get_user_id() || api_is_allowed_to_edit()) {
35
+            $file_path = $nano->load_filename_if_exists();
36
+            //$file_path = '/var/www/rocio/courses/GREAT123/exercises/0/2/5/1/1-0-1-2-5-38.mp3';
37
+            if ($file_path) {
38
+                $info = pathinfo($file_path);
39
+                $user_info = api_get_user_info($nano->params['user_id']);
40
+                $name = get_lang('Quiz').'-'.$user_info['firstname'].'-'.$user_info['lastname'].'.'.$info['extension'];
41
+                $download = true;
42
+                if (isset($_REQUEST['download'])  && $_REQUEST['download'] == 0) {
43
+                    $download = false;
44
+                }
45
+                DocumentManager::file_send_for_download($file_path, $download);
46
+                exit;
47
+            }
48
+        }
49
+        break;
50
+    case 'show_audio':
51
+        if (!$is_nano) {
52
+            echo $nano->return_js($_REQUEST);
53
+        }
54
+        echo $nano->show_audio_file($is_nano);
55
+        break;
56
+    case 'delete':
57
+        $return = $nano->delete_files();
58
+        if ($return == 1) {
59
+            //cant' do this because the post that nano send doesnt take into account the session
60
+            Display::display_confirmation_message(get_lang('FileDeleted'));
61
+        } else {
62
+            Display::display_confirmation_message(get_lang('FileNotFound'));
63
+        }
64
+        break;
65
+    case 'show_form':
66
+        api_protect_course_script(true);
67
+        Display::display_reduced_header();
68
+        echo $nano->return_js($_REQUEST);
69
+        echo $nano->return_form();
70
+        break;
71 71
     case 'save_file':
72
-    	//User access same as upload.php
72
+        //User access same as upload.php
73 73
 
74
-    	$return = $nano->upload_file($is_nano);
74
+        $return = $nano->upload_file($is_nano);
75 75
 
76
-    	if ($is_nano) {
77
-    		//nano looks for numbers
78
-	    	if ($return == 1) {
79
-	    		//cant' do this because the post that nano send doesnt take into account the session
80
-	    		echo 1; //Display::display_confirmation_message(get_lang('UplUploadSucceeded'));
81
-	    	} else {
82
-	    		echo 0;
83
-	    		//Display::display_warning_message(get_lang('UplUnableToSaveFileFilteredExtension'));
84
-	    	}
85
-    	} else {
86
-    		Display::display_reduced_header();
87
-    		echo $nano->return_js($_REQUEST);
88
-    		//normal form
89
-    		if ($return == 1) {
90
-    			//cant' do this because the post that nano send doesnt take into account the session
91
-    			$message = Display::return_message(get_lang('UplUploadSucceeded'), 'confirm');
92
-    		} else {
93
-    			$message = Display::return_message(get_lang('UplUnableToSaveFileFilteredExtension'), 'warning');
94
-    		}
95
-    		echo $nano->return_form($message);
96
-    	}
76
+        if ($is_nano) {
77
+            //nano looks for numbers
78
+            if ($return == 1) {
79
+                //cant' do this because the post that nano send doesnt take into account the session
80
+                echo 1; //Display::display_confirmation_message(get_lang('UplUploadSucceeded'));
81
+            } else {
82
+                echo 0;
83
+                //Display::display_warning_message(get_lang('UplUnableToSaveFileFilteredExtension'));
84
+            }
85
+        } else {
86
+            Display::display_reduced_header();
87
+            echo $nano->return_js($_REQUEST);
88
+            //normal form
89
+            if ($return == 1) {
90
+                //cant' do this because the post that nano send doesnt take into account the session
91
+                $message = Display::return_message(get_lang('UplUploadSucceeded'), 'confirm');
92
+            } else {
93
+                $message = Display::return_message(get_lang('UplUnableToSaveFileFilteredExtension'), 'warning');
94
+            }
95
+            echo $nano->return_form($message);
96
+        }
97 97
         break;
98 98
     default:
99 99
         echo '';
Please login to merge, or discard this patch.
main/inc/ajax/message.ajax.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
             break;
38 38
         }
39 39
         $track_online_table      = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
40
-        $tbl_my_user		     = Database::get_main_table(TABLE_MAIN_USER);
40
+        $tbl_my_user = Database::get_main_table(TABLE_MAIN_USER);
41 41
         $tbl_my_user_friend      = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
42
-        $tbl_user 			     = Database::get_main_table(TABLE_MAIN_USER);
42
+        $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
43 43
         $tbl_access_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
44
-        $search				     = Database::escape_string($_REQUEST['q']);
44
+        $search = Database::escape_string($_REQUEST['q']);
45 45
 
46 46
         $access_url_id           = api_get_multiple_access_url() == 'true' ? api_get_current_access_url_id() : 1;
47 47
         $user_id                 = api_get_user_id();
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 
50 50
         $likeCondition = " AND (firstname LIKE '%$search%' OR lastname LIKE '%$search%' OR email LIKE '%$search%') ";
51 51
 
52
-        if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool') == 'true') {
52
+        if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') {
53 53
             // All users
54
-            if (api_get_setting('allow_send_message_to_all_platform_users') == 'true' || api_is_platform_admin() ) {
54
+            if (api_get_setting('allow_send_message_to_all_platform_users') == 'true' || api_is_platform_admin()) {
55 55
                 if ($access_url_id != 0) {
56 56
                     $sql = "SELECT DISTINCT u.user_id as id, u.firstname, u.lastname, u.email
57 57
                             FROM $tbl_user u LEFT JOIN $tbl_access_url_rel_user r ON u.user_id = r.user_id
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
                                 $likeCondition";
98 98
                 }
99 99
             }
100
-        } elseif (api_get_setting('allow_social_tool')=='false' && api_get_setting('allow_message_tool')=='true') {
100
+        } elseif (api_get_setting('allow_social_tool') == 'false' && api_get_setting('allow_message_tool') == 'true') {
101 101
             if (api_get_setting('allow_send_message_to_all_platform_users') == 'true') {
102 102
                 $sql = "SELECT DISTINCT u.user_id as id, u.firstname, u.lastname, u.email
103 103
                         FROM $tbl_user u LEFT JOIN $tbl_access_url_rel_user r ON u.user_id = r.user_id
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
                             $likeCondition ";
109 109
             } else {
110 110
                 $time_limit = api_get_setting('time_limit_whosonline');
111
-                $online_time = time() - $time_limit*60;
111
+                $online_time = time() - $time_limit * 60;
112 112
                 $limit_date	 = api_get_utc_datetime($online_time);
113 113
                 $sql = "SELECT SELECT DISTINCT u.user_id as id, u.firstname, u.lastname, u.email
114 114
                         FROM $tbl_my_user u INNER JOIN $track_online_table t
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                         $likeCondition";
118 118
             }
119 119
         }
120
-        $sql .=' LIMIT 20';
120
+        $sql .= ' LIMIT 20';
121 121
         $result = Database::query($sql);
122 122
 
123 123
         $showEmail = api_get_setting('show_email_addresses');
Please login to merge, or discard this patch.
main/inc/ajax/admin.ajax.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
             $url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $urlInfo['url']));
51 51
             $cleanUrl = str_replace('/', '-', $url);
52 52
 
53
-            $newUrlDir = api_get_path(SYS_APP_PATH) . "home/$cleanUrl/admin/";
53
+            $newUrlDir = api_get_path(SYS_APP_PATH)."home/$cleanUrl/admin/";
54 54
         } else {
55
-            $newUrlDir = api_get_path(SYS_APP_PATH) . "home/admin/";
55
+            $newUrlDir = api_get_path(SYS_APP_PATH)."home/admin/";
56 56
         }
57 57
 
58 58
         if (!file_exists($newUrlDir)) {
@@ -166,15 +166,15 @@  discard block
 block discarded – undo
166 166
             }
167 167
 
168 168
             if ($system_version != $version_info) {
169
-                $output = '<br /><span style="color:red">' . get_lang('YourVersionNotUpToDate') . '. '.get_lang('LatestVersionIs').' <b>Chamilo '.$version_info.'</b>. '.get_lang('YourVersionIs').' <b>Chamilo '.$system_version. '</b>. '.str_replace('http://www.chamilo.org', '<a href="http://www.chamilo.org">http://www.chamilo.org</a>', get_lang('PleaseVisitOurWebsite')).'</span>';
169
+                $output = '<br /><span style="color:red">'.get_lang('YourVersionNotUpToDate').'. '.get_lang('LatestVersionIs').' <b>Chamilo '.$version_info.'</b>. '.get_lang('YourVersionIs').' <b>Chamilo '.$system_version.'</b>. '.str_replace('http://www.chamilo.org', '<a href="http://www.chamilo.org">http://www.chamilo.org</a>', get_lang('PleaseVisitOurWebsite')).'</span>';
170 170
             } else {
171 171
                 $output = '<br /><span style="color:green">'.get_lang('VersionUpToDate').': Chamilo '.$version_info.'</span>';
172 172
             }
173 173
         } else {
174
-            $output = '<span style="color:red">' . get_lang('ImpossibleToContactVersionServerPleaseTryAgain') . '</span>';
174
+            $output = '<span style="color:red">'.get_lang('ImpossibleToContactVersionServerPleaseTryAgain').'</span>';
175 175
         }
176 176
     } else {
177
-        $output = '<span style="color:red">' . get_lang('AllowurlfopenIsSetToOff') . '</span>';
177
+        $output = '<span style="color:red">'.get_lang('AllowurlfopenIsSetToOff').'</span>';
178 178
     }
179 179
     return $output;
180 180
 }
@@ -197,17 +197,17 @@  discard block
 block discarded – undo
197 197
     $getdata_str = count($getdata) ? '?' : '';
198 198
 
199 199
     foreach ($getdata as $k => $v) {
200
-                $getdata_str .= urlencode($k) .'='. urlencode($v) . '&';
200
+                $getdata_str .= urlencode($k).'='.urlencode($v).'&';
201 201
     }
202 202
 
203 203
     $crlf = "\r\n";
204
-    $req = $verb .' '. $uri . $getdata_str .' HTTP/1.1' . $crlf;
205
-    $req .= 'Host: '. $ip . $crlf;
206
-    $req .= 'User-Agent: Mozilla/5.0 Firefox/3.6.12' . $crlf;
207
-    $req .= 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' . $crlf;
208
-    $req .= 'Accept-Language: en-us,en;q=0.5' . $crlf;
209
-    $req .= 'Accept-Encoding: deflate' . $crlf;
210
-    $req .= 'Accept-Charset: utf-8;q=0.7,*;q=0.7' . $crlf;
204
+    $req = $verb.' '.$uri.$getdata_str.' HTTP/1.1'.$crlf;
205
+    $req .= 'Host: '.$ip.$crlf;
206
+    $req .= 'User-Agent: Mozilla/5.0 Firefox/3.6.12'.$crlf;
207
+    $req .= 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'.$crlf;
208
+    $req .= 'Accept-Language: en-us,en;q=0.5'.$crlf;
209
+    $req .= 'Accept-Encoding: deflate'.$crlf;
210
+    $req .= 'Accept-Charset: utf-8;q=0.7,*;q=0.7'.$crlf;
211 211
 
212 212
     $req .= $crlf;
213 213
 
Please login to merge, or discard this patch.
main/inc/ajax/exercise.ajax.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -488,7 +488,7 @@
 block discarded – undo
488 488
                     $remind_list
489 489
                 );
490 490
 
491
-                 // Destruction of the Question object
491
+                    // Destruction of the Question object
492 492
                 unset($objQuestionTmp);
493 493
                 if ($debug) {
494 494
                     error_log(" -- end question -- ");
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
         $exercise_id = intval($_GET['exercise_id']);
31 31
         $page = intval($_REQUEST['page']); //page
32 32
         $limit = intval($_REQUEST['rows']); //quantity of rows
33
-        $sidx = $_REQUEST['sidx'];         //index to filter
34
-        $sord = $_REQUEST['sord'];         //asc or desc
33
+        $sidx = $_REQUEST['sidx']; //index to filter
34
+        $sord = $_REQUEST['sord']; //asc or desc
35 35
 
36
-        if (!in_array($sord, array('asc','desc'))) {
36
+        if (!in_array($sord, array('asc', 'desc'))) {
37 37
             $sord = 'desc';
38 38
         }
39 39
         // get index row - i.e. user click to sort $sord = $_GET['sord'];
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         $total_pages = 0;
63 63
         if ($count > 0) {
64 64
             if (!empty($limit)) {
65
-                $total_pages = ceil($count/$limit);
65
+                $total_pages = ceil($count / $limit);
66 66
             }
67 67
         }
68 68
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         $response->page = $page;
125 125
         $response->total = $total_pages;
126 126
         $response->records = $count;
127
-        $i=0;
127
+        $i = 0;
128 128
 
129 129
         if (!empty($results)) {
130 130
             foreach ($results as $row) {
@@ -138,22 +138,22 @@  discard block
 block discarded – undo
138 138
                             GROUP by question_id
139 139
                         ) as count_table";
140 140
                 $result_count = Database::query($sql);
141
-                $count_questions = Database::fetch_array($result_count,'ASSOC');
141
+                $count_questions = Database::fetch_array($result_count, 'ASSOC');
142 142
                 $count_questions = $count_questions['count_question_id'];
143 143
 
144 144
                 $row['count_questions'] = $count_questions;
145 145
 
146 146
                 $response->rows[$i]['id'] = $row['exe_id'];
147
-                $remaining = strtotime($row['start_date'])+($oExe->expired_time*60) - strtotime(api_get_utc_datetime(time()));
148
-                $h = floor($remaining/3600);
149
-                $m = floor(($remaining - ($h*3600))/60);
150
-                $s = ($remaining - ($h*3600) - ($m*60));
147
+                $remaining = strtotime($row['start_date']) + ($oExe->expired_time * 60) - strtotime(api_get_utc_datetime(time()));
148
+                $h = floor($remaining / 3600);
149
+                $m = floor(($remaining - ($h * 3600)) / 60);
150
+                $s = ($remaining - ($h * 3600) - ($m * 60));
151 151
                 $array = array(
152 152
                     $row['firstname'],
153 153
                     $row['lastname'],
154
-                    api_format_date($row['start_date'], DATE_TIME_FORMAT_LONG).' ['.($h>0?$h.':':'').sprintf("%02d",$m).':'.sprintf("%02d",$s).']',
154
+                    api_format_date($row['start_date'], DATE_TIME_FORMAT_LONG).' ['.($h > 0 ? $h.':' : '').sprintf("%02d", $m).':'.sprintf("%02d", $s).']',
155 155
                     $row['count_questions'],
156
-                    round($row['score']*100).'%'
156
+                    round($row['score'] * 100).'%'
157 157
                 );
158 158
                 $response->rows[$i]['cell'] = $array;
159 159
                 $i++;
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
         break;
210 210
     case 'add_question_to_reminder':
211 211
         /** @var Exercise $objExercise */
212
-        $objExercise  = $_SESSION['objExercise'];
212
+        $objExercise = $_SESSION['objExercise'];
213 213
         if (empty($objExercise)) {
214 214
             echo 0;
215 215
             exit;
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
                 $objQuestionTmp = Question::read($my_question_id, $course_id);
361 361
 
362 362
                 // Getting free choice data.
363
-                if ($objQuestionTmp->type  == FREE_ANSWER && $type == 'all') {
364
-                    $my_choice = isset($_REQUEST['free_choice'][$my_question_id]) && !empty($_REQUEST['free_choice'][$my_question_id]) ? $_REQUEST['free_choice'][$my_question_id]: null;
363
+                if ($objQuestionTmp->type == FREE_ANSWER && $type == 'all') {
364
+                    $my_choice = isset($_REQUEST['free_choice'][$my_question_id]) && !empty($_REQUEST['free_choice'][$my_question_id]) ? $_REQUEST['free_choice'][$my_question_id] : null;
365 365
                 }
366 366
 
367 367
                 if ($type == 'all') {
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
                         $session_id,
406 406
                         $my_question_id
407 407
                     );
408
-                    if ($objQuestionTmp->type  == HOT_SPOT) {
408
+                    if ($objQuestionTmp->type == HOT_SPOT) {
409 409
                         Event::delete_attempt_hotspot(
410 410
                             $exe_id,
411 411
                             api_get_user_id(),
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
         $objQuestion = Question::read($questionId);
518 518
         $objQuestion->get_question_type_name();
519 519
 
520
-        echo '<p class="lead">' . $objQuestion->get_question_type_name() . '</p>';
520
+        echo '<p class="lead">'.$objQuestion->get_question_type_name().'</p>';
521 521
         //echo get_lang('Level').': '.$objQuestionTmp->selectLevel();
522 522
         ExerciseLib::showQuestion(
523 523
             $questionId,
Please login to merge, or discard this patch.