Completed
Push — 1.10.x ( 81fffe...f2089c )
by Angel Fernando Quiroz
44:59 queued 06:02
created
main/social/group_waiting_list.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 require_once '../inc/global.inc.php';
12 12
 
13 13
 api_block_anonymous_users();
14
-if (api_get_setting('allow_social_tool') !='true') {
14
+if (api_get_setting('allow_social_tool') != 'true') {
15 15
     api_not_allowed();
16 16
 }
17 17
 
18 18
 $this_section = SECTION_SOCIAL;
19 19
 
20
-$group_id= intval($_GET['id']);
20
+$group_id = intval($_GET['id']);
21 21
 $usergroup = new UserGroup();
22 22
 
23 23
 //todo @this validation could be in a function in group_portal_manager
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
     }
36 36
 }
37 37
 
38
-$interbreadcrumb[]= array ('url' =>'groups.php','name' => get_lang('Groups'));
38
+$interbreadcrumb[] = array('url' =>'groups.php', 'name' => get_lang('Groups'));
39 39
 $interbreadcrumb[] = array('url' => 'group_view.php?id='.$group_id, 'name' => $group_info['name']);
40
-$interbreadcrumb[]= array ('url' =>'#','name' => get_lang('WaitingList'));
40
+$interbreadcrumb[] = array('url' =>'#', 'name' => get_lang('WaitingList'));
41 41
 
42 42
 // Group information
43 43
 $admins = $usergroup->get_users_by_group(
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 );
50 50
 $show_message = '';
51 51
 
52
-if (isset($_GET['action']) && $_GET['action']=='accept') {
52
+if (isset($_GET['action']) && $_GET['action'] == 'accept') {
53 53
     // we add a user only if is a open group
54 54
     $user_join = intval($_GET['u']);
55 55
     //if i'm a moderator
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     }
60 60
 }
61 61
 
62
-if (isset($_GET['action']) && $_GET['action']=='deny') {
62
+if (isset($_GET['action']) && $_GET['action'] == 'deny') {
63 63
     // we add a user only if is a open group
64 64
     $user_join = intval($_GET['u']);
65 65
     //if i'm a moderator
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
     }
70 70
 }
71 71
 
72
-if (isset($_GET['action']) && $_GET['action']=='set_moderator') {
72
+if (isset($_GET['action']) && $_GET['action'] == 'set_moderator') {
73 73
     // we add a user only if is a open group
74
-    $user_moderator= intval($_GET['u']);
74
+    $user_moderator = intval($_GET['u']);
75 75
     //if i'm the admin
76 76
     if ($usergroup->is_group_admin($group_id)) {
77 77
         $usergroup->update_user_role($user_moderator, $group_id, GROUP_USER_PERMISSION_MODERATOR);
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 $social_left_content = SocialManager::show_social_menu('waiting_list', $group_id);
92 92
 
93 93
 // Display form
94
-foreach($users as $user) {
94
+foreach ($users as $user) {
95 95
     switch ($user['relation_type']) {
96 96
         case GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER:
97 97
             $user['link']  = '<a href="group_waiting_list.php?id='.$group_id.'&u='.$user['user_id'].'&action=accept">'.
Please login to merge, or discard this patch.
main/social/friends.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -132,15 +132,15 @@
 block discarded – undo
132 132
 
133 133
                 $friend_html .= '
134 134
                     <div class="col-md-3">
135
-                        <div class="thumbnail text-center" id="div_' . $friends[$j]['friend_user_id'] . '">
136
-                            <img src="' . $userPicture . '" class="img-responsive" id="imgfriend_' . $friend['friend_user_id'] . '" title="'.$user_name.'">
135
+                        <div class="thumbnail text-center" id="div_' . $friends[$j]['friend_user_id'].'">
136
+                            <img src="' . $userPicture.'" class="img-responsive" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$user_name.'">
137 137
                             <div class="caption">
138 138
                                 <h3>
139
-                                    <a href="profile.php?u=' . $friend['friend_user_id'] . '">' . $user_name . '</a>
139
+                                    <a href="profile.php?u=' . $friend['friend_user_id'].'">'.$user_name.'</a>
140 140
                                 </h3>
141 141
                                 <p>
142
-                                    <button class="btn btn-danger" onclick="delete_friend(this)" id=img_' . $friend['friend_user_id'] . '>
143
-                                        ' . get_lang('Delete') . '
142
+                                    <button class="btn btn-danger" onclick="delete_friend(this)" id=img_' . $friend['friend_user_id'].'>
143
+                                        ' . get_lang('Delete').'
144 144
                                     </button>
145 145
                                 </p>
146 146
                             </div>
Please login to merge, or discard this patch.
main/permissions/group_permissions.inc.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@  discard block
 block discarded – undo
13 13
 // ---------------------------------------------------
14 14
 // 			ACTIONS
15 15
 // ---------------------------------------------------
16
-if ($_POST['StoreGroupPermissions'] and $setting_visualisation=='checkbox')
16
+if ($_POST['StoreGroupPermissions'] and $setting_visualisation == 'checkbox')
17 17
 {
18
-	$result_message=store_permissions('group', $group_id);
18
+	$result_message = store_permissions('group', $group_id);
19 19
 	if ($result_message)
20 20
 	{
21 21
 		Display::display_normal_message($result_message);
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
 }
24 24
 if (isset($_GET['action']))
25 25
 {
26
-	if (($_GET['action']=='grant' OR $_GET['action']=='revoke')  AND isset($_GET['permission']) AND isset($_GET['tool']))
26
+	if (($_GET['action'] == 'grant' OR $_GET['action'] == 'revoke') AND isset($_GET['permission']) AND isset($_GET['tool']))
27 27
 	{
28
-		$result_message=store_one_permission('group', $_GET['action'], $group_id, $_GET['tool'], $_GET['permission']);
28
+		$result_message = store_one_permission('group', $_GET['action'], $group_id, $_GET['tool'], $_GET['permission']);
29 29
 	}
30
-	if (isset($_GET['role']) AND ($_GET['action']=='grant' OR $_GET['action']=='revoke'))
30
+	if (isset($_GET['role']) AND ($_GET['action'] == 'grant' OR $_GET['action'] == 'revoke'))
31 31
 	{
32
-		$result_message=assign_role('group', $_GET['action'], $group_id, $_GET['role'], $_GET['scope']);
32
+		$result_message = assign_role('group', $_GET['action'], $group_id, $_GET['role'], $_GET['scope']);
33 33
 		echo 'hier';
34 34
 	}
35 35
 }
@@ -41,41 +41,41 @@  discard block
 block discarded – undo
41 41
 // ---------------------------------------------------
42 42
 // 			RETRIEVING THE PERMISSIONS
43 43
 // ---------------------------------------------------
44
-$current_group_permissions=array();
45
-$current_group_permissions=get_permissions('group',$group_id);
44
+$current_group_permissions = array();
45
+$current_group_permissions = get_permissions('group', $group_id);
46 46
 // @todo current group permissions and current role permissions
47 47
 
48 48
 // ---------------------------------------------------
49 49
 //   INHERITED PERMISSIONS (group roles)
50 50
 // ---------------------------------------------------
51
-$group_course_roles_permissions=get_roles_permissions('group',$group_id, 'course');
52
-$group_platform_roles_permissions=get_roles_permissions('group',$group_id, 'platform');
53
-$inherited_permissions=permission_array_merge($group_course_roles_permissions,$group_platform_roles_permissions);
51
+$group_course_roles_permissions = get_roles_permissions('group', $group_id, 'course');
52
+$group_platform_roles_permissions = get_roles_permissions('group', $group_id, 'platform');
53
+$inherited_permissions = permission_array_merge($group_course_roles_permissions, $group_platform_roles_permissions);
54 54
 
55 55
 // ---------------------------------------------------
56 56
 // 			LIMITED OR FULL
57 57
 // ---------------------------------------------------
58
-$current_group_permissions=limited_or_full($current_group_permissions);
59
-$inherited_permissions=limited_or_full($inherited_permissions);
60
-if (api_get_setting('permissions')=='limited')
58
+$current_group_permissions = limited_or_full($current_group_permissions);
59
+$inherited_permissions = limited_or_full($inherited_permissions);
60
+if (api_get_setting('permissions') == 'limited')
61 61
 {
62
-	$header_array=$rights_limited;
62
+	$header_array = $rights_limited;
63 63
 }
64
-if (api_get_setting('permissions')=='full')
64
+if (api_get_setting('permissions') == 'full')
65 65
 {
66
-	$header_array=$rights_full;
66
+	$header_array = $rights_full;
67 67
 }
68 68
 
69 69
 echo "<form method=\"post\" action=\"".str_replace('&', '&amp;', $_SERVER['REQUEST_URI'])."\">";
70 70
 // ---------------------------------------------------
71 71
 // 		DISPLAYING THE ROLES LIST
72 72
 // ---------------------------------------------------
73
-if (api_get_setting('group_roles')=='true')
73
+if (api_get_setting('group_roles') == 'true')
74 74
 {
75 75
 	// the list of the roles for the user
76 76
 	echo '<strong>'.get_lang('GroupRoles').'</strong><br />';
77
-	$current_group_course_roles=get_roles('group',$group_id);
78
-	$current_group_platform_roles=get_roles('group',$group_id, 'platform');
77
+	$current_group_course_roles = get_roles('group', $group_id);
78
+	$current_group_platform_roles = get_roles('group', $group_id, 'platform');
79 79
 	display_role_list($current_group_course_roles, $current_group_platform_roles);
80 80
 	echo '<br />';
81 81
 }
@@ -107,17 +107,17 @@  discard block
 block discarded – undo
107 107
 	foreach ($header_array as $key=>$value)
108 108
 	{
109 109
 		echo "\t\t<td align='center'>\n";
110
-		if (in_array($value,$rights))
110
+		if (in_array($value, $rights))
111 111
 		{
112
-			if ($setting_visualisation=='checkbox')
112
+			if ($setting_visualisation == 'checkbox')
113 113
 			{
114 114
 				//display_checkbox_matrix($current_group_permissions, $tool, $value);
115
-				display_checkbox_matrix($current_group_permissions, $tool, $value, $inherited_permissions,$course_admin);
115
+				display_checkbox_matrix($current_group_permissions, $tool, $value, $inherited_permissions, $course_admin);
116 116
 			}
117
-			if ($setting_visualisation=='image')
117
+			if ($setting_visualisation == 'image')
118 118
 			{
119 119
 				//display_image_matrix($current_group_permissions, $tool, $value);
120
-				display_image_matrix($current_group_permissions, $tool, $value,$inherited_permissions, $course_admin);
120
+				display_image_matrix($current_group_permissions, $tool, $value, $inherited_permissions, $course_admin);
121 121
 			}
122 122
 		}
123 123
 		// note: in a later stage this part will be replaced by a function
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 }
131 131
 
132 132
 echo "</table>\n";
133
-if ($setting_visualisation=='checkbox')
133
+if ($setting_visualisation == 'checkbox')
134 134
 {
135 135
 	echo "<input type=\"Submit\" name=\"StoreGroupPermissions\" value=\"".get_lang('StorePermissions')."\">";
136 136
 }
Please login to merge, or discard this patch.
main/permissions/all_permissions.inc.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,15 +10,15 @@  discard block
 block discarded – undo
10 10
  * Code
11 11
  */
12 12
 // possible permissions
13
-$rights_full=array("View","Add","Edit","Delete","Visibility","Move");
14
-$rights_limited=array("Add","Edit","Delete");
13
+$rights_full = array("View", "Add", "Edit", "Delete", "Visibility", "Move");
14
+$rights_limited = array("Add", "Edit", "Delete");
15 15
 
16 16
 
17 17
 // first we determine what can be done in each tool. We do this for each tool.
18
-$tool_rights[TOOL_LINK]=array("View","Add","Edit","Delete","Visibility", "Move");
19
-$tool_rights[TOOL_DOCUMENT]=array("View","Add","Edit","Delete","Visibility","Move");
18
+$tool_rights[TOOL_LINK] = array("View", "Add", "Edit", "Delete", "Visibility", "Move");
19
+$tool_rights[TOOL_DOCUMENT] = array("View", "Add", "Edit", "Delete", "Visibility", "Move");
20 20
 //$tool_rights[TOOL_CALENDAR_EVENT]=array("View","Add","Edit","Delete","Visibility");
21
-$tool_rights[TOOL_ANNOUNCEMENT]=array("View","Add","Edit","Delete","Visibility", "Move");
21
+$tool_rights[TOOL_ANNOUNCEMENT] = array("View", "Add", "Edit", "Delete", "Visibility", "Move");
22 22
 //$tool_rights[TOOL_STUDENTPUBLICATION]=array("View","Edit","Delete","Visibility");
23 23
 //$tool_rights[TOOL_COURSE_DESCRIPTION]=array("View","Add","Edit","Delete","Visibility");
24 24
 //$tool_rights[TOOL_LEARNPATH]=array("View","Add","Edit","Delete","Visibility");
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
 //$tool_rights[TOOL_BB_POST]=array("View","Add","Edit","Delete");
27 27
 //$tool_rights[TOOL_DROPBOX]=array("View","Add","Delete");
28 28
 //$tool_rights[TOOL_QUIZ]=array("View","Add","Edit","Delete","Visibility");
29
-$tool_rights[TOOL_USER]=array("View","Add","Edit","Delete");
29
+$tool_rights[TOOL_USER] = array("View", "Add", "Edit", "Delete");
30 30
 //$tool_rights[TOOL_GROUP]=array("View","Add","Edit","Delete");
31 31
 //$tool_rights[TOOL_CHAT]=array("View","Delete");
32 32
 //$tool_rights[TOOL_CONFERENCE]=array("View","Add","Edit","Delete");
33 33
 //$tool_rights[TOOL_STUDENTPUBLICATION]=array("View","Add","Edit","Delete");
34 34
 
35 35
 // this value can be checkbox or image
36
-$setting_visualisation='image';
36
+$setting_visualisation = 'image';
37 37
 
38 38
 ?>
Please login to merge, or discard this patch.
main/permissions/blog_permissions.inc.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
 // Remove the blog creater because he has all the rights automatically
45 45
 // and we want to keep it that way.
46
-$tbl_course_rel_user = $table=Database::get_main_table(TABLE_MAIN_COURSE_USER);
46
+$tbl_course_rel_user = $table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
47 47
 $sql = "SELECT user_id
48 48
 		FROM $tbl_course_rel_user
49 49
 		WHERE status = '1' AND c_id = '".api_get_course_int_id()."'";
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
 // ------------------------------------------------------------------
84 84
 // 			RETRIEVING THE PERMISSIONS OF THE ROLES OF THE USER
85 85
 // ------------------------------------------------------------------
86
-if (api_get_setting('user_roles')=='true') {
86
+if (api_get_setting('user_roles') == 'true') {
87 87
 	// course roles that are assigned to the user
88
-	$current_user_role_permissions_of_user=get_roles_permissions('user',$user_id);
89
-	$inherited_permissions=permission_array_merge($inherited_permissions,$current_user_role_permissions_of_user);
88
+	$current_user_role_permissions_of_user = get_roles_permissions('user', $user_id);
89
+	$inherited_permissions = permission_array_merge($inherited_permissions, $current_user_role_permissions_of_user);
90 90
 	// NOTE: deze array moet nog gemerged worden met de $inherited_permissions array
91 91
 	// (heet momenteel nog $current_group_permissions_of_user omdat voorlopig enkel de
92 92
 	// groepsge�rfde permissions in beschouwing worden genomen
@@ -96,16 +96,16 @@  discard block
 block discarded – undo
96 96
 	// NOTE: checken als de rollen brol wel degelijk geactiveerd is voordat we dit allemaal
97 97
 	// ophalen.
98 98
 	// platform roles that are assigned to the user
99
-	$current_user_role_permissions_of_user=get_roles_permissions('user',$user_id, 'platform');
100
-	$inherited_permissions=permission_array_merge($inherited_permissions,$current_user_role_permissions_of_user);
99
+	$current_user_role_permissions_of_user = get_roles_permissions('user', $user_id, 'platform');
100
+	$inherited_permissions = permission_array_merge($inherited_permissions, $current_user_role_permissions_of_user);
101 101
 }
102 102
 // ------------------------------------------------------------------
103 103
 //	RETRIEVING THE PERMISSIONS OF THE ROLES OF THE GROUPS OF THE USER
104 104
 // ------------------------------------------------------------------
105
-if (api_get_setting('group_roles')=='true') {
105
+if (api_get_setting('group_roles') == 'true') {
106 106
 	// NOTE: DIT MOET NOG VERDER UITGEWERKT WORDEN
107 107
 	foreach ($groups_of_user as $group) {
108
-		$this_current_group_role_permissions_of_user=get_roles_permissions('user',$user_id);
108
+		$this_current_group_role_permissions_of_user = get_roles_permissions('user', $user_id);
109 109
 		//$inherited_permissions[$tool][]=$permission;
110 110
 	}
111 111
 }
@@ -116,12 +116,12 @@  discard block
 block discarded – undo
116 116
 // 		DISPLAYING THE ROLES LIST
117 117
 // ---------------------------------------------------
118 118
 
119
-if (api_get_setting('user_roles')=='true')
119
+if (api_get_setting('user_roles') == 'true')
120 120
 {
121 121
 	// the list of the roles for the user
122 122
 	echo '<strong>'.get_lang('UserRoles').'</strong><br />';
123
-	$current_user_course_roles=get_roles('user',$user_id);
124
-	$current_user_platform_roles=get_roles('user',$user_id, 'platform');
123
+	$current_user_course_roles = get_roles('user', $user_id);
124
+	$current_user_platform_roles = get_roles('user', $user_id, 'platform');
125 125
 	display_role_list($current_user_course_roles, $current_user_platform_roles);
126 126
 	echo '<br />';
127 127
 }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	foreach ($rights_full as $key => $value) {
170 170
 
171 171
 		echo "\t\t<td align='center'>\n";
172
-		if (in_array($value,$rights_blog)) {
172
+		if (in_array($value, $rights_blog)) {
173 173
 			display_image_matrix_for_blogs(
174 174
 				$current_user_permissions,
175 175
 				$user_id,
Please login to merge, or discard this patch.
main/permissions/user_permissions.inc.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -5,10 +5,10 @@  discard block
 block discarded – undo
5 5
 /**
6 6
  * Code
7 7
  */
8
-$user_id=$userIdViewed;
9
-if ($mainUserInfo['status']==1)
8
+$user_id = $userIdViewed;
9
+if ($mainUserInfo['status'] == 1)
10 10
 {
11
-	$course_admin=1;
11
+	$course_admin = 1;
12 12
 }
13 13
 include_once('permissions_functions.inc.php');
14 14
 include_once('all_permissions.inc.php');
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 // ---------------------------------------------------
18 18
 // 			ACTIONS
19 19
 // ---------------------------------------------------
20
-if ($_POST['StoreUserPermissions'] and $setting_visualisation=='checkbox')
20
+if ($_POST['StoreUserPermissions'] and $setting_visualisation == 'checkbox')
21 21
 {
22
-	$result_message=store_permissions('user', $user_id);
22
+	$result_message = store_permissions('user', $user_id);
23 23
 	if ($result_message)
24 24
 	{
25 25
 		Display::display_normal_message($result_message);
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
 }
28 28
 if (isset($_GET['action']))
29 29
 {
30
-	if ( isset($_GET['permission']) AND isset($_GET['tool']) AND ($_GET['action']=='grant' OR $_GET['action']=='revoke'))
30
+	if (isset($_GET['permission']) AND isset($_GET['tool']) AND ($_GET['action'] == 'grant' OR $_GET['action'] == 'revoke'))
31 31
 	{
32
-		$result_message=store_one_permission('user', $_GET['action'], $user_id, $_GET['tool'], $_GET['permission']);
32
+		$result_message = store_one_permission('user', $_GET['action'], $user_id, $_GET['tool'], $_GET['permission']);
33 33
 	}
34
-	if (isset($_GET['role']) AND ($_GET['action']=='grant' OR $_GET['action']=='revoke'))
34
+	if (isset($_GET['role']) AND ($_GET['action'] == 'grant' OR $_GET['action'] == 'revoke'))
35 35
 	{
36
-		$result_message=assign_role('user', $_GET['action'], $user_id, $_GET['role'], $_GET['scope']);
36
+		$result_message = assign_role('user', $_GET['action'], $user_id, $_GET['role'], $_GET['scope']);
37 37
 	}
38 38
 }
39 39
 if (isset($result_message))
@@ -44,33 +44,33 @@  discard block
 block discarded – undo
44 44
 // ---------------------------------------------------
45 45
 // 			RETRIEVING THE PERMISSIONS OF THE USER
46 46
 // ---------------------------------------------------
47
-$current_user_permissions=array();
48
-$current_user_permissions=get_permissions('user',$user_id);
47
+$current_user_permissions = array();
48
+$current_user_permissions = get_permissions('user', $user_id);
49 49
 
50 50
 
51 51
 //   INHERITED PERMISSIONS (group permissions, user roles, group roles)
52 52
 
53 53
 // 			RETRIEVING THE PERMISSIONS OF THE GROUPS OF THE USER
54
-$groups_of_user=array();
55
-$groups_of_user=GroupManager::get_group_ids($_course['real_id'],$user_id);
54
+$groups_of_user = array();
55
+$groups_of_user = GroupManager::get_group_ids($_course['real_id'], $user_id);
56 56
 foreach ($groups_of_user as $group)
57 57
 {
58
-	$this_group_permissions=get_permissions('group',$group);
58
+	$this_group_permissions = get_permissions('group', $group);
59 59
 	foreach ($this_group_permissions as $tool=>$permissions)
60 60
 	{
61 61
 		foreach ($permissions as $permission)
62 62
 		{
63
-			$inherited_group_permissions[$tool][]=$permission;
63
+			$inherited_group_permissions[$tool][] = $permission;
64 64
 		}
65 65
 	}
66 66
 }
67
-$inherited_permissions=$inherited_group_permissions;
67
+$inherited_permissions = $inherited_group_permissions;
68 68
 
69 69
 // 			RETRIEVING THE PERMISSIONS OF THE ROLES OF THE USER
70
-if (api_get_setting('user_roles')=='true') {
70
+if (api_get_setting('user_roles') == 'true') {
71 71
 	// course roles that are assigned to the user
72
-	$current_user_role_permissions_of_user=get_roles_permissions('user',$user_id);
73
-	$inherited_permissions=permission_array_merge($inherited_permissions,$current_user_role_permissions_of_user);
72
+	$current_user_role_permissions_of_user = get_roles_permissions('user', $user_id);
73
+	$inherited_permissions = permission_array_merge($inherited_permissions, $current_user_role_permissions_of_user);
74 74
 	// NOTE: deze array moet nog gemerged worden met de $inherited_permissions array
75 75
 	// (heet momenteel nog $current_group_permissions_of_user omdat voorlopig enkel de
76 76
 	// groepsge�rfde permissions in beschouwing worden genomen
@@ -80,16 +80,16 @@  discard block
 block discarded – undo
80 80
 	// NOTE: checken als de rollen brol wel degelijk geactiveerd is voordat we dit allemaal
81 81
 	// ophalen.
82 82
 	// platform roles that are assigned to the user
83
-	$current_user_role_permissions_of_user=get_roles_permissions('user',$user_id, 'platform');
84
-	$inherited_permissions=permission_array_merge($inherited_permissions,$current_user_role_permissions_of_user);
83
+	$current_user_role_permissions_of_user = get_roles_permissions('user', $user_id, 'platform');
84
+	$inherited_permissions = permission_array_merge($inherited_permissions, $current_user_role_permissions_of_user);
85 85
 }
86 86
 //	RETRIEVING THE PERMISSIONS OF THE ROLES OF THE GROUPS OF THE USER
87
-if (api_get_setting('group_roles')=='true')
87
+if (api_get_setting('group_roles') == 'true')
88 88
 {
89 89
 	// NOTE: DIT MOET NOG VERDER UITGEWERKT WORDEN
90 90
 	foreach ($groups_of_user as $group)
91 91
 	{
92
-		$this_current_group_role_permissions_of_user=get_roles_permissions('user',$user_id);
92
+		$this_current_group_role_permissions_of_user = get_roles_permissions('user', $user_id);
93 93
 		//$inherited_permissions[$tool][]=$permission;
94 94
 	}
95 95
 }
@@ -97,15 +97,15 @@  discard block
 block discarded – undo
97 97
 // ---------------------------------------------------
98 98
 // 			LIMITED OR FULL
99 99
 // ---------------------------------------------------
100
-$current_user_permissions=limited_or_full($current_user_permissions);
101
-$inherited_permissions=limited_or_full($inherited_permissions);
102
-if (api_get_setting('permissions')=='limited')
100
+$current_user_permissions = limited_or_full($current_user_permissions);
101
+$inherited_permissions = limited_or_full($inherited_permissions);
102
+if (api_get_setting('permissions') == 'limited')
103 103
 {
104
-	$header_array=$rights_limited;
104
+	$header_array = $rights_limited;
105 105
 }
106
-if (api_get_setting('permissions')=='full')
106
+if (api_get_setting('permissions') == 'full')
107 107
 {
108
-	$header_array=$rights_full;
108
+	$header_array = $rights_full;
109 109
 }
110 110
 
111 111
 
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
 // ---------------------------------------------------
115 115
 // 		DISPLAYING THE ROLES LIST
116 116
 // ---------------------------------------------------
117
-if (api_get_setting('user_roles')=='true')
117
+if (api_get_setting('user_roles') == 'true')
118 118
 {
119 119
 	// the list of the roles for the user
120 120
 	echo '<strong>'.get_lang('UserRoles').'</strong><br />';
121
-	$current_user_course_roles=get_roles('user',$user_id);
122
-	$current_user_platform_roles=get_roles('user',$user_id, 'platform');
121
+	$current_user_course_roles = get_roles('user', $user_id);
122
+	$current_user_platform_roles = get_roles('user', $user_id, 'platform');
123 123
 	display_role_list($current_user_course_roles, $current_user_platform_roles);
124 124
 	echo '<br />';
125 125
 }
@@ -144,12 +144,12 @@  discard block
 block discarded – undo
144 144
 {
145 145
 	echo "\t<tr>\n";
146 146
 	echo "\t\t<td>\n";
147
-	if (strstr($tool,'BLOG'))
147
+	if (strstr($tool, 'BLOG'))
148 148
 	{
149 149
 		// Not dealing with a real tool here, get name of this blog
150 150
 		// Strip blog id
151
-		$tmp = strpos($tool,'_')+1;
152
-		$blog_id = substr($tool,$tmp,strlen($tool));
151
+		$tmp = strpos($tool, '_') + 1;
152
+		$blog_id = substr($tool, $tmp, strlen($tool));
153 153
 		// Get title
154 154
 		echo get_lang('Blog').": ".Blog::get_blog_title($blog_id);
155 155
 	}
@@ -164,15 +164,15 @@  discard block
 block discarded – undo
164 164
 	{
165 165
 
166 166
 		echo "\t\t<td align='center'>\n";
167
-		if (in_array($value,$rights))
167
+		if (in_array($value, $rights))
168 168
 		{
169
-			if ($setting_visualisation=='checkbox')
169
+			if ($setting_visualisation == 'checkbox')
170 170
 			{
171
-				display_checkbox_matrix($current_user_permissions, $tool, $value, $inherited_permissions,$course_admin);
171
+				display_checkbox_matrix($current_user_permissions, $tool, $value, $inherited_permissions, $course_admin);
172 172
 			}
173
-			if ($setting_visualisation=='image')
173
+			if ($setting_visualisation == 'image')
174 174
 			{
175
-				display_image_matrix($current_user_permissions, $tool, $value,$inherited_permissions, $course_admin);
175
+				display_image_matrix($current_user_permissions, $tool, $value, $inherited_permissions, $course_admin);
176 176
 			}
177 177
 		}
178 178
 		// note: in a later stage this part will be replaced by a function
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 }
186 186
 
187 187
 echo "</table>\n";
188
-if ($setting_visualisation=='checkbox')
188
+if ($setting_visualisation == 'checkbox')
189 189
 {
190 190
 	echo "<input type=\"Submit\" name=\"StoreUserPermissions\" value=\"".get_lang('StorePermissions')."\">";
191 191
 }
Please login to merge, or discard this patch.
main/permissions/roles.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -20,49 +20,49 @@  discard block
 block discarded – undo
20 20
 {
21 21
 	if (!empty($_POST['role_name']))
22 22
 	{
23
-		$table_role=Database::get_course_table(TABLE_ROLE);
24
-		$sql="INSERT INTO $table_role (role_name, role_comment, default_role)
23
+		$table_role = Database::get_course_table(TABLE_ROLE);
24
+		$sql = "INSERT INTO $table_role (role_name, role_comment, default_role)
25 25
 					VALUES ('".Database::escape_string($_POST['role_name'])."','".Database::escape_string($_POST['role_comment'])."','".Database::escape_string($_POST['default_role'])."')";
26
-		$result=Database::query($sql);
27
-		$role_id=Database::insert_id();
28
-		$result_message=store_permissions('role', $role_id);
26
+		$result = Database::query($sql);
27
+		$role_id = Database::insert_id();
28
+		$result_message = store_permissions('role', $role_id);
29 29
 	}
30 30
 	else
31 31
 	{
32
-		$result_message=get_lang('ErrorPleaseGiveRoleName');
32
+		$result_message = get_lang('ErrorPleaseGiveRoleName');
33 33
 	}
34 34
 }
35 35
 // storing a permission for a given role when the image approach is used
36 36
 if (isset($_GET['action']) AND isset($_GET['permission']) AND isset($_GET['tool']))
37 37
 {
38
-	if ($_GET['action']=='grant' OR $_GET['action']=='revoke')
38
+	if ($_GET['action'] == 'grant' OR $_GET['action'] == 'revoke')
39 39
 	{
40
-		$result_message=store_one_permission('role', $_GET['action'], $role_id, $_GET['tool'], $_GET['permission']);
40
+		$result_message = store_one_permission('role', $_GET['action'], $role_id, $_GET['tool'], $_GET['permission']);
41 41
 	}
42 42
 }
43 43
 
44 44
 // deleting a role
45
-if (isset($_GET['action']) AND isset($_GET['role_id']) AND $_GET['action']=='delete') {
45
+if (isset($_GET['action']) AND isset($_GET['role_id']) AND $_GET['action'] == 'delete') {
46 46
 	//deleting the assignments fo this role: users
47
-	$table=Database::get_course_table(TABLE_ROLE_USER);
48
-	$sql="DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'";
49
-	$result=Database::query($sql);
47
+	$table = Database::get_course_table(TABLE_ROLE_USER);
48
+	$sql = "DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'";
49
+	$result = Database::query($sql);
50 50
 
51 51
 	// deleting the assignments of this role: groups
52
-	$table=Database::get_course_table(TABLE_ROLE_GROUP);
53
-	$sql="DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'";
54
-	$result=Database::query($sql);
52
+	$table = Database::get_course_table(TABLE_ROLE_GROUP);
53
+	$sql = "DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'";
54
+	$result = Database::query($sql);
55 55
 
56 56
 	// deleting the permissions of this role
57
-	$table=Database::get_course_table(TABLE_ROLE_PERMISSION);
58
-	$sql="DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'";
59
-	$result=Database::query($sql);
57
+	$table = Database::get_course_table(TABLE_ROLE_PERMISSION);
58
+	$sql = "DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'";
59
+	$result = Database::query($sql);
60 60
 
61 61
 	// deleting the role
62
-	$table_role=Database::get_course_table(TABLE_ROLE);
63
-	$sql="DELETE FROM $table_role WHERE role_id='".intval($_GET['role_id'])."'";
64
-	$result=Database::query($sql);
65
-	$result_message=get_lang('RoleDeleted');
62
+	$table_role = Database::get_course_table(TABLE_ROLE);
63
+	$sql = "DELETE FROM $table_role WHERE role_id='".intval($_GET['role_id'])."'";
64
+	$result = Database::query($sql);
65
+	$result_message = get_lang('RoleDeleted');
66 66
 }
67 67
 
68 68
 // displaying the return message of the actions
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 // 		ADDING A NEW ROLE (FORM AND LINK)
74 74
 echo '<img src="../img/add.png" /> <a href="roles.php?action=add">'.get_lang('AddRole').'</a>';
75 75
 
76
-if ($_GET['action']=='add')
76
+if ($_GET['action'] == 'add')
77 77
 {
78 78
 	echo "<form method=\"post\" action=\"".api_get_self()."\">";
79 79
 	echo "\n<table>";
@@ -105,13 +105,13 @@  discard block
 block discarded – undo
105 105
 	echo "<table class=\"data_table\">\n";
106 106
 
107 107
 	// the header
108
-	if (api_get_setting('permissions')=='limited')
108
+	if (api_get_setting('permissions') == 'limited')
109 109
 	{
110
-		$header_array=$rights_limited;
110
+		$header_array = $rights_limited;
111 111
 	}
112
-	if (api_get_setting('permissions')=='full')
112
+	if (api_get_setting('permissions') == 'full')
113 113
 	{
114
-		$header_array=$rights_full;
114
+		$header_array = $rights_full;
115 115
 	}
116 116
 	echo "\t<tr>\n";
117 117
 	echo "\t\t<th>".get_lang('Module')."</th>\n";
@@ -151,25 +151,25 @@  discard block
 block discarded – undo
151 151
 // 		DISPLAYING THE EXISTING ROLES
152 152
 // ===================================================
153 153
 // platform roles
154
-$all_roles=get_all_roles('platform');
154
+$all_roles = get_all_roles('platform');
155 155
 foreach ($all_roles as $role)
156 156
 {
157 157
 	echo '<div><a href="roles.php?action=view&amp;role_id='.$role['role_id'].'&amp;scope=platform">'.$role['role_name'].'</a></div>';
158 158
 	echo '<div>'.$role['role_comment'].'</div><br />';
159
-	if ($role['role_id']==$_GET['role_id'])
159
+	if ($role['role_id'] == $_GET['role_id'])
160 160
 	{
161
-		$current_role_info=$role;
161
+		$current_role_info = $role;
162 162
 	}
163 163
 }
164 164
 // course roles
165
-$all_roles=get_all_roles();
165
+$all_roles = get_all_roles();
166 166
 foreach ($all_roles as $role)
167 167
 {
168 168
 	echo '<div><a href="roles.php?action=view&amp;role_id='.$role['role_id'].'">'.$role['role_name'].'</a><a href="roles.php?action=delete&amp;role_id='.$role['role_id'].'"><img src="../img/delete.gif" /></a></div>';
169 169
 	echo '<div>'.$role['role_comment'].'</div><br />';
170
-	if ($role['role_id']==$_GET['role_id'])
170
+	if ($role['role_id'] == $_GET['role_id'])
171 171
 	{
172
-		$current_role_info=$role;
172
+		$current_role_info = $role;
173 173
 	}
174 174
 }
175 175
 
@@ -178,19 +178,19 @@  discard block
 block discarded – undo
178 178
 // ===================================================
179 179
 if ($_GET['role_id'])
180 180
 {
181
-	$current_role_permissions=get_permissions('role',$_GET['role_id']);
181
+	$current_role_permissions = get_permissions('role', $_GET['role_id']);
182 182
 
183 183
 	// ---------------------------------------------------
184 184
 	// 			LIMITED OR FULL
185 185
 	// ---------------------------------------------------
186
-	$current_role_permissions=limited_or_full($current_role_permissions);
187
-	if (api_get_setting('permissions')=='limited')
186
+	$current_role_permissions = limited_or_full($current_role_permissions);
187
+	if (api_get_setting('permissions') == 'limited')
188 188
 	{
189
-		$header_array=$rights_limited;
189
+		$header_array = $rights_limited;
190 190
 	}
191
-	if (api_get_setting('permissions')=='full')
191
+	if (api_get_setting('permissions') == 'full')
192 192
 	{
193
-		$header_array=$rights_full;
193
+		$header_array = $rights_full;
194 194
 	}
195 195
 	// ---------------------------------------------------
196 196
 	// 			DISPLAYING THE MATRIX
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 
200 200
 	// the list of the roles for the user
201 201
 	echo get_lang('PermissionsOfRole').':'.$current_role_info['role_name'].'<br />';
202
-	if ($_GET['scope']=='platform')
202
+	if ($_GET['scope'] == 'platform')
203 203
 	{
204 204
 		echo get_lang('IsPlatformRoleNotEditable').'<br />';
205 205
 	}
@@ -226,23 +226,23 @@  discard block
 block discarded – undo
226 226
 		foreach ($header_array as $key=>$value)
227 227
 		{
228 228
 			echo "\t\t<td align='center'>\n";
229
-			if (in_array($value,$rights))
229
+			if (in_array($value, $rights))
230 230
 			{
231
-				if ($setting_visualisation=='checkbox')
231
+				if ($setting_visualisation == 'checkbox')
232 232
 				{
233 233
 					display_checkbox_matrix($current_role_permissions, $tool, $value);
234 234
 				}
235
-				if ($setting_visualisation=='image')
235
+				if ($setting_visualisation == 'image')
236 236
 				{
237
-					if ($_GET['scope']=='platform')
237
+					if ($_GET['scope'] == 'platform')
238 238
 					{
239
-						$roles_editable=false;
239
+						$roles_editable = false;
240 240
 					}
241 241
 					else
242 242
 					{
243
-						$roles_editable=true;
243
+						$roles_editable = true;
244 244
 					}
245
-					display_image_matrix($current_role_permissions, $tool, $value, '','',$roles_editable);
245
+					display_image_matrix($current_role_permissions, $tool, $value, '', '', $roles_editable);
246 246
 				}
247 247
 			}
248 248
 			echo "\t\t</td>\n";
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	}
252 252
 
253 253
 	echo "</table>\n";
254
-	if ($setting_visualisation=='checkbox')
254
+	if ($setting_visualisation == 'checkbox')
255 255
 	{
256 256
 		echo "<input type=\"Submit\" name=\"StoreRolePermissions\" value=\"".get_lang('StorePermissions')."\">";
257 257
 	}
Please login to merge, or discard this patch.
main/webservices/webservice_course.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	protected function deleteCourseHelper($course_id_field_name, $course_id_value) {
23 23
 		$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
24
-		if($course_id instanceof WSError) {
24
+		if ($course_id instanceof WSError) {
25 25
 			return $course_id;
26 26
 		} else {
27 27
 			$course_code = CourseManager::get_course_code_from_course_id($course_id);
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function DeleteCourse($secret_key, $course_id_field_name, $course_id_value) {
41 41
 		$verifKey = $this->verifyKey($secret_key);
42
-		if($verifKey instanceof WSError) {
42
+		if ($verifKey instanceof WSError) {
43 43
 			$this->handleError($verifKey);
44 44
 		} else {
45 45
 			$result = $this->deleteCourseHelper($course_id_field_name, $course_id_value);
46
-			if($result instanceof WSError) {
46
+			if ($result instanceof WSError) {
47 47
 				$this->handleError($result);
48 48
 			}
49 49
 		}
@@ -59,15 +59,15 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public function DeleteCourses($secret_key, $courses) {
61 61
 		$verifKey = $this->verifyKey($secret_key);
62
-		if($verifKey instanceof WSError) {
62
+		if ($verifKey instanceof WSError) {
63 63
 			$this->handleError($verifKey);
64 64
 		} else {
65 65
 			$results = array();
66
-			foreach($courses as $course) {
66
+			foreach ($courses as $course) {
67 67
 				$result_tmp = array();
68 68
 				$result_op = $this->deleteCourseHelper($course['course_id_field_name'], $course['course_id_value']);
69 69
 				$result_tmp['course_id_value'] = $course['course_id_value'];
70
-				if($result_op instanceof WSError) {
70
+				if ($result_op instanceof WSError) {
71 71
 					// Return the error in the results
72 72
 					$result_tmp['result'] = $result_op->toArray();
73 73
 				} else {
@@ -97,17 +97,17 @@  discard block
 block discarded – undo
97 97
 	protected function createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras) {
98 98
 		// Add the original course id field name and value to the extra fields if needed
99 99
 		$extras_associative = array();
100
-		if($course_id_field_name != "chamilo_course_id") {
100
+		if ($course_id_field_name != "chamilo_course_id") {
101 101
 			$extras_associative[$course_id_field_name] = $course_id_value;
102 102
 		}
103
-		foreach($extras as $extra) {
103
+		foreach ($extras as $extra) {
104 104
 			$extras_associative[$extra['field_name']] = $extra['field_value'];
105 105
 		}
106 106
 		$course_admin_id = $this->getUserId($course_admin_user_id_field_name, $course_admin_user_id_value);
107
-		if($course_admin_id instanceof WSError) {
107
+		if ($course_admin_id instanceof WSError) {
108 108
 			return $course_admin_id;
109 109
 		}
110
-		if($wanted_code == '') {
110
+		if ($wanted_code == '') {
111 111
 			$wanted_code = CourseManager::generate_course_code($title);
112 112
 		}
113 113
 		$result = create_course($wanted_code, $title, $tutor_name, $category_code, $language, $course_admin_id, $this->_configuration['db_prefix'], 0);
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 			return new WSError(202, 'There was an error creating the course');
116 116
 		} else {
117 117
 			// Update extra fields
118
-			foreach($extras_associative as $fname => $fvalue) {
118
+			foreach ($extras_associative as $fname => $fvalue) {
119 119
 				CourseManager::update_course_extra_field_value($result, $fname, $fvalue);
120 120
 			}
121 121
 			// Get course id
@@ -143,11 +143,11 @@  discard block
 block discarded – undo
143 143
 	public function CreateCourse($secret_key, $title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras) {
144 144
 		// First, verify the secret key
145 145
 		$verifKey = $this->verifyKey($secret_key);
146
-		if($verifKey instanceof WSError) {
146
+		if ($verifKey instanceof WSError) {
147 147
 			$this->handleError($verifKey);
148 148
 		} else {
149 149
 			$result = $this->createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras);
150
-			if($result instanceof WSError) {
150
+			if ($result instanceof WSError) {
151 151
 				$this->handleError($result);
152 152
 			} else {
153 153
 				return $result;
@@ -165,17 +165,17 @@  discard block
 block discarded – undo
165 165
 	public function CreateCourses($secret_key, $courses) {
166 166
 		// First, verify the secret key
167 167
 		$verifKey = $this->verifyKey($secret_key);
168
-		if($verifKey instanceof WSError) {
168
+		if ($verifKey instanceof WSError) {
169 169
 			$this->handleError($verifKey);
170 170
 		} else {
171 171
 			$results = array();
172
-			foreach($courses as $course) {
172
+			foreach ($courses as $course) {
173 173
 				$result_tmp = array();
174 174
                 // re-initialize variables just in case
175 175
                 $title = $category_code = $wanted_code = $tutor_name = $course_admin_user_id_field_name = $course_admin_user_id_value = $language = $course_id_field_name = $course_id_value = $extras = 0;
176 176
 				extract($course);
177 177
 				$result = $this->createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras);
178
-				if($result instanceof WSError) {
178
+				if ($result instanceof WSError) {
179 179
 					$result_tmp['result'] = $result->toArray();
180 180
 					$result_tmp['course_id_value'] = $course_id_value;
181 181
 					$result_tmp['course_id_generated'] = 0;
@@ -209,47 +209,47 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	protected function editCourseHelper($course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras) {
211 211
 		$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
212
-		if($course_id instanceof WSError) {
212
+		if ($course_id instanceof WSError) {
213 213
 			return $course_id;
214 214
 		} else {
215 215
 			$attributes = array();
216
-			if(!is_empty($title)) {
216
+			if (!is_empty($title)) {
217 217
 				$attributes['title'] = $title;
218 218
 			}
219
-			if(!is_empty($category_code)) {
219
+			if (!is_empty($category_code)) {
220 220
 				$attributes['category_code'] = $category_code;
221 221
 			}
222
-			if(!is_empty($department_name)) {
222
+			if (!is_empty($department_name)) {
223 223
 				$attributes['department_name'] = $department_name;
224 224
 			}
225
-			if(!is_empty($department_url)) {
225
+			if (!is_empty($department_url)) {
226 226
 				$attributes['department_url'] = $department_url;
227 227
 			}
228
-			if(!is_empty($language)) {
228
+			if (!is_empty($language)) {
229 229
 				$attributes['course_language'] = $language;
230 230
 			}
231
-			if($visibility != '') {
232
-				$attributes['visibility'] = (int)$visibility;
231
+			if ($visibility != '') {
232
+				$attributes['visibility'] = (int) $visibility;
233 233
 			}
234
-			if($subscribe != '') {
235
-				$attributes['subscribe'] = (int)$subscribe;
234
+			if ($subscribe != '') {
235
+				$attributes['subscribe'] = (int) $subscribe;
236 236
 			}
237
-			if($unsubscribe != '') {
238
-				$attributes['unsubscribe'] = (int)$unsubscribe;
237
+			if ($unsubscribe != '') {
238
+				$attributes['unsubscribe'] = (int) $unsubscribe;
239 239
 			}
240
-			if(!is_empty($visual_code)) {
240
+			if (!is_empty($visual_code)) {
241 241
 				$attributes['visual_code'] = $visual_code;
242 242
 			}
243
-			if(!is_empty($attributes)) {
243
+			if (!is_empty($attributes)) {
244 244
 				CourseManager::update_attributes($course_id, $attributes);
245 245
 			}
246
-			if(!empty($extras)) {
246
+			if (!empty($extras)) {
247 247
 				$course_code = CourseManager::get_course_code_from_course_id($course_id);
248 248
 				$extras_associative = array();
249
-				foreach($extras as $extra) {
249
+				foreach ($extras as $extra) {
250 250
 					$extras_associative[$extra['field_name']] = $extra['field_value'];
251 251
 				}
252
-				foreach($extras_associative as $fname => $fvalue) {
252
+				foreach ($extras_associative as $fname => $fvalue) {
253 253
 					CourseManager::update_extra_field_value($course_code, $fname, $fvalue);
254 254
 				}
255 255
 			}
@@ -276,11 +276,11 @@  discard block
 block discarded – undo
276 276
 	 */
277 277
 	public function EditCourse($secret_key, $course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras) {
278 278
 		$verifKey = $this->verifyKey($secret_key);
279
-		if($verifKey instanceof WSError) {
279
+		if ($verifKey instanceof WSError) {
280 280
 			$this->handleError($verifKey);
281 281
 		} else {
282 282
 			$result = $this->editCourseHelper($course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras);
283
-			if($result instanceof WSError) {
283
+			if ($result instanceof WSError) {
284 284
 				$this->handleError($result);
285 285
 			}
286 286
 		}
@@ -296,10 +296,10 @@  discard block
 block discarded – undo
296 296
 	 */
297 297
 	public function ListCourses($secret_key, $visibility = 'public,public-registered,private,closed') {
298 298
 		$verifKey = $this->verifyKey($secret_key);
299
-		if($verifKey instanceof WSError) {
299
+		if ($verifKey instanceof WSError) {
300 300
 			$this->handleError($verifKey);
301 301
 		} else {
302
-            $visibilities = split(',',$visibility);
302
+            $visibilities = split(',', $visibility);
303 303
             $vis = array('public' => '3', 'public-registered' => '2', 'private' => '1', 'closed' => '0');
304 304
             foreach ($visibilities as $p => $visibility) {
305 305
                 $visibilities[$p] = $vis[$visibility];
@@ -308,9 +308,9 @@  discard block
 block discarded – undo
308 308
 			$category_names = array();
309 309
 
310 310
 			$courses = CourseManager::get_courses_list();
311
-			foreach($courses as $course) {
311
+			foreach ($courses as $course) {
312 312
                 //skip elements that do not match required visibility
313
-                if (!in_array($course['visibility'],$visibilities)) { continue; }
313
+                if (!in_array($course['visibility'], $visibilities)) { continue; }
314 314
 				$course_tmp = array();
315 315
 				$course_tmp['id'] = $course['id'];
316 316
 				$course_tmp['code'] = $course['code'];
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 				$course_tmp['visibility'] = $course['visibility'];
320 320
 
321 321
 				// Determining category name
322
-				if($category_names[$course['category_code']]) {
322
+				if ($category_names[$course['category_code']]) {
323 323
 					$course_tmp['category_name'] = $category_names[$course['category_code']];
324 324
 				} else {
325 325
 					$category = CourseManager::get_course_category($course['category_code']);
@@ -355,21 +355,21 @@  discard block
 block discarded – undo
355 355
 	 */
356 356
 	protected function changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, $state, $status = STUDENT) {
357 357
 		$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
358
-		if($course_id instanceof WSError) {
358
+		if ($course_id instanceof WSError) {
359 359
 			return $course_id;
360 360
 		} else {
361 361
 			$user_id = $this->getUserId($user_id_field_name, $user_id_value);
362
-			if($user_id instanceof WSError) {
362
+			if ($user_id instanceof WSError) {
363 363
 				return $user_id;
364 364
 			} else {
365 365
 				$course_code = CourseManager::get_course_code_from_course_id($course_id);
366
-				if($state == 0) {
366
+				if ($state == 0) {
367 367
 					// Unsubscribe user
368 368
 					CourseManager::unsubscribe_user($user_id, $course_code);
369 369
 					return true;
370 370
 				} else {
371 371
 					// Subscribe user
372
-					if(CourseManager::subscribe_user($user_id, $course_code, $status)) {
372
+					if (CourseManager::subscribe_user($user_id, $course_code, $status)) {
373 373
 						return true;
374 374
 					} else {
375 375
 						return new WSError(203, 'An error occured subscribing to this course');
@@ -391,11 +391,11 @@  discard block
 block discarded – undo
391 391
 	 */
392 392
 	public function SubscribeUserToCourse($secret_key, $course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, $status) {
393 393
 		$verifKey = $this->verifyKey($secret_key);
394
-		if($verifKey instanceof WSError) {
394
+		if ($verifKey instanceof WSError) {
395 395
 			$this->handleError($verifKey);
396 396
 		} else {
397 397
 			$result = $this->changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, 1, $status);
398
-			if($result instanceof WSError) {
398
+			if ($result instanceof WSError) {
399 399
 				$this->handleError($result);
400 400
 			}
401 401
 		}
@@ -412,11 +412,11 @@  discard block
 block discarded – undo
412 412
 	 */
413 413
 	public function UnsubscribeUserFromCourse($secret_key, $course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value) {
414 414
 		$verifKey = $this->verifyKey($secret_key);
415
-		if($verifKey instanceof WSError) {
415
+		if ($verifKey instanceof WSError) {
416 416
 			$this->handleError($verifKey);
417 417
 		} else {
418 418
 			$result = $this->changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, 0);
419
-			if($result instanceof WSError) {
419
+			if ($result instanceof WSError) {
420 420
 				$this->handleError($result);
421 421
 			}
422 422
 		}
@@ -432,17 +432,17 @@  discard block
 block discarded – undo
432 432
 	 */
433 433
 	public function GetCourseDescriptions($secret_key, $course_id_field_name, $course_id_value) {
434 434
 		$verifKey = $this->verifyKey($secret_key);
435
-		if($verifKey instanceof WSError) {
435
+		if ($verifKey instanceof WSError) {
436 436
 			$this->handleError($verifKey);
437 437
 		} else {
438 438
 			$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
439
-			if($course_id instanceof WSError) {
439
+			if ($course_id instanceof WSError) {
440 440
 				return $course_id;
441 441
 			} else {
442 442
 				// Course exists, get its descriptions
443 443
 				$descriptions = CourseDescription::get_descriptions($course_id);
444 444
 				$results = array();
445
-				foreach($descriptions as $description) {
445
+				foreach ($descriptions as $description) {
446 446
 					$results[] = array('course_desc_id' => $description->get_description_type(),
447 447
 										'course_desc_title' => $description->get_title(),
448 448
 										'course_desc_content' => $description->get_content());
@@ -465,11 +465,11 @@  discard block
 block discarded – undo
465 465
 	 */
466 466
 	public function EditCourseDescription($secret_key, $course_id_field_name, $course_id_value, $course_desc_id, $course_desc_title, $course_desc_content) {
467 467
 		$verifKey = $this->verifyKey($secret_key);
468
-		if($verifKey instanceof WSError) {
468
+		if ($verifKey instanceof WSError) {
469 469
 			$this->handleError($verifKey);
470 470
 		} else {
471 471
 			$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
472
-			if($course_id instanceof WSError) {
472
+			if ($course_id instanceof WSError) {
473 473
 				return $course_id;
474 474
 			} else {
475 475
 				// Create the new course description
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
 				// Check if this course description exists
485 485
 				$descriptions = CourseDescription::get_descriptions($course_id);
486 486
 				$exists = false;
487
-				foreach($descriptions as $description) {
488
-					if($description->get_description_type() == $course_desc_id) {
487
+				foreach ($descriptions as $description) {
488
+					if ($description->get_description_type() == $course_desc_id) {
489 489
 						$exists = true;
490 490
 					}
491 491
 				}
Please login to merge, or discard this patch.
main/webservices/additional_webservices.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
 {
20 20
     $fileData = $pptData['file_data'];
21 21
     $dataInfo = pathinfo($pptData['file_name']);
22
-    $fileName =  basename($pptData['file_name'], '.' . $dataInfo['extension']);
22
+    $fileName = basename($pptData['file_name'], '.'.$dataInfo['extension']);
23 23
     $fullFileName = $pptData['file_name'];
24 24
 
25 25
     $tempArchivePath = api_get_path(SYS_ARCHIVE_PATH);
26
-    $tempPath = $tempArchivePath . 'wsConvert/' . $fileName . '/';
27
-    $tempPathNewFiles = $tempArchivePath . 'wsConvert/' . $fileName . '-n/';
26
+    $tempPath = $tempArchivePath.'wsConvert/'.$fileName.'/';
27
+    $tempPathNewFiles = $tempArchivePath.'wsConvert/'.$fileName.'-n/';
28 28
 
29 29
     $perms = api_get_permissions_for_new_directories();
30 30
     if (!is_dir($tempPath)) {
@@ -33,28 +33,28 @@  discard block
 block discarded – undo
33 33
     if (!is_dir($tempPathNewFiles)) {
34 34
         mkdir($tempPathNewFiles, $perms, true);
35 35
     }
36
-    if (!is_dir($tempPathNewFiles . $fileName)) {
37
-        mkdir($tempPathNewFiles . $fileName, $perms, true);
36
+    if (!is_dir($tempPathNewFiles.$fileName)) {
37
+        mkdir($tempPathNewFiles.$fileName, $perms, true);
38 38
     }
39 39
 
40 40
     $file = base64_decode($fileData);
41
-    file_put_contents($tempPath . $fullFileName, $file);
41
+    file_put_contents($tempPath.$fullFileName, $file);
42 42
 
43 43
     if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php
44
-        $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png');
45
-        $classPath = $converterPath . ';' . $converterPath . '/jodconverter-2.2.2.jar;' . $converterPath . '/jodconverter-cli-2.2.2.jar';
46
-        $cmd = 'java -Dfile.encoding=UTF-8 -cp "' . $classPath . '" DokeosConverter';
44
+        $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH).'main/inc/lib/ppt2png');
45
+        $classPath = $converterPath.';'.$converterPath.'/jodconverter-2.2.2.jar;'.$converterPath.'/jodconverter-cli-2.2.2.jar';
46
+        $cmd = 'java -Dfile.encoding=UTF-8 -cp "'.$classPath.'" DokeosConverter';
47 47
     } else {
48
-        $converterPath = api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png';
48
+        $converterPath = api_get_path(SYS_PATH).'main/inc/lib/ppt2png';
49 49
         $classPath = ' -Dfile.encoding=UTF-8 -cp .:jodconverter-2.2.2.jar:jodconverter-cli-2.2.2.jar';
50
-        $cmd = 'cd ' . $converterPath . ' && java ' . $classPath . ' DokeosConverter';
50
+        $cmd = 'cd '.$converterPath.' && java '.$classPath.' DokeosConverter';
51 51
     }
52 52
 
53
-    $cmd .= ' -p ' . api_get_setting('service_ppt2lp', 'port');
54
-    $cmd .= ' -w 720 -h 540 -d oogie "' . $tempPath . $fullFileName.'"  "' . $tempPathNewFiles . $fileName . '.html"';
53
+    $cmd .= ' -p '.api_get_setting('service_ppt2lp', 'port');
54
+    $cmd .= ' -w 720 -h 540 -d oogie "'.$tempPath.$fullFileName.'"  "'.$tempPathNewFiles.$fileName.'.html"';
55 55
 
56 56
     $perms = api_get_permissions_for_new_files();
57
-    chmod($tempPathNewFiles . $fileName, $perms, true);
57
+    chmod($tempPathNewFiles.$fileName, $perms, true);
58 58
 
59 59
     $files = array();
60 60
     $return = 0;
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         $images = array();
65 65
         foreach ($files as $file) {
66 66
             $imageData = explode('||', $file);
67
-            $images[$imageData[1]] = base64_encode(file_get_contents($tempPathNewFiles . $fileName . '/' . $imageData[1]));
67
+            $images[$imageData[1]] = base64_encode(file_get_contents($tempPathNewFiles.$fileName.'/'.$imageData[1]));
68 68
         }
69 69
         $data = array(
70 70
             'files' => $files,
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
  */
90 90
 function deleteDirectory($directoryPath)
91 91
 {
92
-    $files = array_diff(scandir($directoryPath), array('.','..'));
92
+    $files = array_diff(scandir($directoryPath), array('.', '..'));
93 93
     foreach ($files as $file) {
94 94
         if (is_dir("$directoryPath/$file")) {
95 95
             deleteDirectory("$directoryPath/$file");
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 $webCodePath = api_get_path(WEB_CODE_PATH);
107 107
 $options = array(
108 108
     'uri' => $webPath,
109
-    'location' => $webCodePath . 'webservices/additional_webservices.php'
109
+    'location' => $webCodePath.'webservices/additional_webservices.php'
110 110
 );
111 111
 
112 112
 $soapServer = new SoapServer(NULL, $options);
Please login to merge, or discard this patch.