@@ -19,12 +19,10 @@ discard block |
||
| 19 | 19 | } |
| 20 | 20 | } |
| 21 | 21 | if (isset($_GET['action'])) { |
| 22 | - if (isset($_GET['permission']) AND isset($_GET['tool']) AND ($_GET['action'] == 'grant' OR $_GET['action'] == 'revoke')) |
|
| 23 | - { |
|
| 22 | + if (isset($_GET['permission']) AND isset($_GET['tool']) AND ($_GET['action'] == 'grant' OR $_GET['action'] == 'revoke')) { |
|
| 24 | 23 | $result_message = store_one_permission('user', $_GET['action'], $user_id, $_GET['tool'], $_GET['permission']); |
| 25 | 24 | } |
| 26 | - if (isset($_GET['role']) AND ($_GET['action'] == 'grant' OR $_GET['action'] == 'revoke')) |
|
| 27 | - { |
|
| 25 | + if (isset($_GET['role']) AND ($_GET['action'] == 'grant' OR $_GET['action'] == 'revoke')) { |
|
| 28 | 26 | $result_message = assign_role('user', $_GET['action'], $user_id, $_GET['role'], $_GET['scope']); |
| 29 | 27 | } |
| 30 | 28 | } |
@@ -45,13 +43,10 @@ discard block |
||
| 45 | 43 | // RETRIEVING THE PERMISSIONS OF THE GROUPS OF THE USER |
| 46 | 44 | $groups_of_user = array(); |
| 47 | 45 | $groups_of_user = GroupManager::get_group_ids($_course['real_id'], $user_id); |
| 48 | -foreach ($groups_of_user as $group) |
|
| 49 | -{ |
|
| 46 | +foreach ($groups_of_user as $group) { |
|
| 50 | 47 | $this_group_permissions = get_permissions('group', $group); |
| 51 | - foreach ($this_group_permissions as $tool=>$permissions) |
|
| 52 | - { |
|
| 53 | - foreach ($permissions as $permission) |
|
| 54 | - { |
|
| 48 | + foreach ($this_group_permissions as $tool=>$permissions) { |
|
| 49 | + foreach ($permissions as $permission) { |
|
| 55 | 50 | $inherited_group_permissions[$tool][] = $permission; |
| 56 | 51 | } |
| 57 | 52 | } |
@@ -76,11 +71,9 @@ discard block |
||
| 76 | 71 | $inherited_permissions = permission_array_merge($inherited_permissions, $current_user_role_permissions_of_user); |
| 77 | 72 | } |
| 78 | 73 | // RETRIEVING THE PERMISSIONS OF THE ROLES OF THE GROUPS OF THE USER |
| 79 | -if (api_get_setting('group_roles') == 'true') |
|
| 80 | -{ |
|
| 74 | +if (api_get_setting('group_roles') == 'true') { |
|
| 81 | 75 | // NOTE: DIT MOET NOG VERDER UITGEWERKT WORDEN |
| 82 | - foreach ($groups_of_user as $group) |
|
| 83 | - { |
|
| 76 | + foreach ($groups_of_user as $group) { |
|
| 84 | 77 | $this_current_group_role_permissions_of_user = get_roles_permissions('user', $user_id); |
| 85 | 78 | //$inherited_permissions[$tool][]=$permission; |
| 86 | 79 | } |
@@ -89,20 +82,17 @@ discard block |
||
| 89 | 82 | // LIMITED OR FULL |
| 90 | 83 | $current_user_permissions = limited_or_full($current_user_permissions); |
| 91 | 84 | $inherited_permissions = limited_or_full($inherited_permissions); |
| 92 | -if (api_get_setting('permissions') == 'limited') |
|
| 93 | -{ |
|
| 85 | +if (api_get_setting('permissions') == 'limited') { |
|
| 94 | 86 | $header_array = $rights_limited; |
| 95 | 87 | } |
| 96 | -if (api_get_setting('permissions') == 'full') |
|
| 97 | -{ |
|
| 88 | +if (api_get_setting('permissions') == 'full') { |
|
| 98 | 89 | $header_array = $rights_full; |
| 99 | 90 | } |
| 100 | 91 | |
| 101 | 92 | echo "<form method=\"post\" action=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."\">"; |
| 102 | 93 | // DISPLAYING THE ROLES LIST |
| 103 | 94 | |
| 104 | -if (api_get_setting('user_roles') == 'true') |
|
| 105 | -{ |
|
| 95 | +if (api_get_setting('user_roles') == 'true') { |
|
| 106 | 96 | // the list of the roles for the user |
| 107 | 97 | echo '<strong>'.get_lang('UserRoles').'</strong><br />'; |
| 108 | 98 | $current_user_course_roles = get_roles('user', $user_id); |
@@ -120,8 +110,7 @@ discard block |
||
| 120 | 110 | // the header |
| 121 | 111 | echo "\t<tr>\n"; |
| 122 | 112 | echo "\t\t<th>".get_lang('Module')."</th>\n"; |
| 123 | -foreach ($header_array as $header_key=>$header_value) |
|
| 124 | -{ |
|
| 113 | +foreach ($header_array as $header_key=>$header_value) { |
|
| 125 | 114 | echo "\t\t<th>".get_lang($header_value)."</th>\n"; |
| 126 | 115 | } |
| 127 | 116 | echo "\t</tr>\n"; |
@@ -51,8 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | // form1 annee = 0; composante= 0 etape = 0 |
| 53 | 53 | //if ($annee == "" && $composante == "" && $etape == "") { |
| 54 | -if (empty($annee) && empty($id_session)) |
|
| 55 | -{ |
|
| 54 | +if (empty($annee) && empty($id_session)) { |
|
| 56 | 55 | Display::display_header($tool_name); |
| 57 | 56 | echo '<div style="align:center">'; |
| 58 | 57 | echo Display::return_icon('group.gif', get_lang('LDAPSelectFilterOnUsersOU')).' '.get_lang('LDAPSelectFilterOnUsersOU'); |
@@ -63,9 +62,7 @@ discard block |
||
| 63 | 62 | echo '</form>'; |
| 64 | 63 | echo '</div>'; |
| 65 | 64 | |
| 66 | -} |
|
| 67 | -elseif (!empty($annee) && empty($id_session)) |
|
| 68 | -{ |
|
| 65 | +} elseif (!empty($annee) && empty($id_session)) { |
|
| 69 | 66 | Display::display_header($tool_name); |
| 70 | 67 | echo '<div style="align:center">'; |
| 71 | 68 | echo Display::return_icon( |
@@ -92,8 +89,7 @@ discard block |
||
| 92 | 89 | } |
| 93 | 90 | // form4 annee != 0; composante != 0 etape != 0 |
| 94 | 91 | //elseif ($annee <> "" && $composante <> "" && $etape <> "" && $listeok != 'yes') { |
| 95 | -elseif (!empty($annee) && !empty($id_session) && empty($_POST['confirmed'])) |
|
| 96 | -{ |
|
| 92 | +elseif (!empty($annee) && !empty($id_session) && empty($_POST['confirmed'])) { |
|
| 97 | 93 | Display::display_header($tool_name); |
| 98 | 94 | echo '<div style="align: center;">'; |
| 99 | 95 | echo '<br />'; |
@@ -144,16 +140,12 @@ discard block |
||
| 144 | 140 | echo '<br /><br />'; |
| 145 | 141 | echo '</div>'; |
| 146 | 142 | |
| 147 | -} |
|
| 148 | -elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed'] == 'yes')) |
|
| 149 | -{ |
|
| 143 | +} elseif (!empty($annee) && !empty($id_session) && ($_POST['confirmed'] == 'yes')) { |
|
| 150 | 144 | $id = $_POST['username_form']; |
| 151 | 145 | $UserList = array(); |
| 152 | 146 | $userid_match_login = array(); |
| 153 | - foreach ($id as $form_index=>$user_id) |
|
| 154 | - { |
|
| 155 | - if (is_array($_POST['checkboxes']) && in_array($form_index, array_values($_POST['checkboxes']))) |
|
| 156 | - { |
|
| 147 | + foreach ($id as $form_index=>$user_id) { |
|
| 148 | + if (is_array($_POST['checkboxes']) && in_array($form_index, array_values($_POST['checkboxes']))) { |
|
| 157 | 149 | $tmp = ldap_add_user($user_id); |
| 158 | 150 | $UserList[] = $tmp; |
| 159 | 151 | $userid_match_login[$tmp] = $user_id; |
@@ -202,8 +194,7 @@ discard block |
||
| 202 | 194 | Display::addFlash(Display::return_message($message, 'normal', false)); |
| 203 | 195 | } |
| 204 | 196 | */ |
| 205 | - else |
|
| 206 | - { |
|
| 197 | + else { |
|
| 207 | 198 | $message = get_lang('NoUserAdded'); |
| 208 | 199 | Display::addFlash(Display::return_message($message, 'normal', false)); |
| 209 | 200 | Display::display_header($tool_name); |
@@ -7,7 +7,8 @@ discard block |
||
| 7 | 7 | * @param string $plugin |
| 8 | 8 | * @return mixed |
| 9 | 9 | */ |
| 10 | -function vchamilo_parse_csv_nodelist($nodelistlocation = '', $plugin = null) { |
|
| 10 | +function vchamilo_parse_csv_nodelist($nodelistlocation = '', $plugin = null) |
|
| 11 | +{ |
|
| 11 | 12 | global $_configuration; |
| 12 | 13 | |
| 13 | 14 | $vnodes = array(); |
@@ -102,7 +103,8 @@ discard block |
||
| 102 | 103 | |
| 103 | 104 | // Check for required fields. |
| 104 | 105 | foreach ($required as $key => $value) { |
| 105 | - if ($value) { // Required field missing. |
|
| 106 | + if ($value) { |
|
| 107 | +// Required field missing. |
|
| 106 | 108 | cli_error("fieldrequired $key"); |
| 107 | 109 | return; |
| 108 | 110 | } |
@@ -136,7 +138,9 @@ discard block |
||
| 136 | 138 | $key = $headers[$f]; |
| 137 | 139 | if (preg_match('/\|/', $key)) { |
| 138 | 140 | list($plugin, $variable) = explode('|', str_replace('plugin_', '', $key)); |
| 139 | - if (empty($variable)) die("Key error in CSV : $key "); |
|
| 141 | + if (empty($variable)) { |
|
| 142 | + die("Key error in CSV : $key "); |
|
| 143 | + } |
|
| 140 | 144 | if (!isset($vnode->$plugin)) { |
| 141 | 145 | $vnode->$plugin = new StdClass(); |
| 142 | 146 | } |
@@ -169,15 +173,21 @@ discard block |
||
| 169 | 173 | * @param bool $resetfirst |
| 170 | 174 | * @return bool |
| 171 | 175 | */ |
| 172 | -function vchamilo_is_empty_line_or_format(&$text, $resetfirst = false) { |
|
| 176 | +function vchamilo_is_empty_line_or_format(&$text, $resetfirst = false) |
|
| 177 | +{ |
|
| 173 | 178 | global $CFG; |
| 174 | 179 | |
| 175 | 180 | static $textlib; |
| 176 | 181 | static $first = true; |
| 177 | 182 | |
| 178 | 183 | // We may have a risk the BOM is present on first line |
| 179 | - if ($resetfirst) $first = true; |
|
| 180 | - if (!isset($textlib)) $textlib = new textlib(); // Singleton |
|
| 184 | + if ($resetfirst) { |
|
| 185 | + $first = true; |
|
| 186 | + } |
|
| 187 | + if (!isset($textlib)) { |
|
| 188 | + $textlib = new textlib(); |
|
| 189 | + } |
|
| 190 | + // Singleton |
|
| 181 | 191 | $text = $textlib->trim_utf8_bom($text); |
| 182 | 192 | $first = false; |
| 183 | 193 | |
@@ -200,7 +210,8 @@ discard block |
||
| 200 | 210 | * @param bool $casesensitiveoptions true if options are case sensitive |
| 201 | 211 | * @return string entered text |
| 202 | 212 | */ |
| 203 | -function cli_input($prompt, $default = '', array $options = null, $casesensitiveoptions = false) { |
|
| 213 | +function cli_input($prompt, $default = '', array $options = null, $casesensitiveoptions = false) |
|
| 214 | +{ |
|
| 204 | 215 | echo $prompt; |
| 205 | 216 | echo "\n: "; |
| 206 | 217 | $input = fread(STDIN, 2048); |
@@ -226,7 +237,8 @@ discard block |
||
| 226 | 237 | * @param array $shortmapping array describing mapping of short to long style options ex:('h'=>'help', 'v'=>'verbose') |
| 227 | 238 | * @return array array of arrays, options, unrecognised as optionlongname=>value |
| 228 | 239 | */ |
| 229 | -function cli_get_params(array $longoptions, array $shortmapping = null) { |
|
| 240 | +function cli_get_params(array $longoptions, array $shortmapping = null) |
|
| 241 | +{ |
|
| 230 | 242 | $shortmapping = (array) $shortmapping; |
| 231 | 243 | $options = array(); |
| 232 | 244 | $unrecognized = array(); |
@@ -296,7 +308,8 @@ discard block |
||
| 296 | 308 | * @param bool $return false means print, true return as string |
| 297 | 309 | * @return mixed void or string |
| 298 | 310 | */ |
| 299 | -function cli_separator($return = false) { |
|
| 311 | +function cli_separator($return = false) |
|
| 312 | +{ |
|
| 300 | 313 | $separator = str_repeat('-', 79)."\n"; |
| 301 | 314 | if ($return) { |
| 302 | 315 | return $separator; |
@@ -311,7 +324,8 @@ discard block |
||
| 311 | 324 | * @param bool $return false means print, true return as string |
| 312 | 325 | * @return mixed void or string |
| 313 | 326 | */ |
| 314 | -function cli_heading($string, $return = false) { |
|
| 327 | +function cli_heading($string, $return = false) |
|
| 328 | +{ |
|
| 315 | 329 | $string = "== $string ==\n"; |
| 316 | 330 | if ($return) { |
| 317 | 331 | return $string; |
@@ -325,7 +339,8 @@ discard block |
||
| 325 | 339 | * @param $text |
| 326 | 340 | * @return void |
| 327 | 341 | */ |
| 328 | -function cli_problem($text) { |
|
| 342 | +function cli_problem($text) |
|
| 343 | +{ |
|
| 329 | 344 | fwrite(STDERR, $text."\n"); |
| 330 | 345 | } |
| 331 | 346 | |
@@ -336,7 +351,8 @@ discard block |
||
| 336 | 351 | * @param int $errorCode |
| 337 | 352 | * @return void (does not return) |
| 338 | 353 | */ |
| 339 | -function cli_error($text, $errorCode = 1) { |
|
| 354 | +function cli_error($text, $errorCode = 1) |
|
| 355 | +{ |
|
| 340 | 356 | fwrite(STDERR, $text); |
| 341 | 357 | fwrite(STDERR, "\n"); |
| 342 | 358 | die($errorCode); |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | require_once __DIR__.'/../inc/global.inc.php'; |
| 15 | 15 | require_once api_get_path(SYS_PATH).'main/auth/cas/authcas.php'; |
| 16 | 16 | $msg = null; |
| 17 | -if (isset($_GET['firstpage'])) {
|
|
| 17 | +if (isset($_GET['firstpage'])) { |
|
| 18 | 18 | $firstpage = $_GET['firstpage']; |
| 19 | 19 | |
| 20 | 20 | // if course is public, go to course without auth |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | ); |
| 42 | 42 | $form->addButtonNext(get_lang('LoginEnter'), 'submitAuth');
|
| 43 | 43 | // see same text in main_api.lib.php function api_not_allowed |
| 44 | - if (api_is_cas_activated()) {
|
|
| 44 | + if (api_is_cas_activated()) { |
|
| 45 | 45 | $msg .= Display::return_message(sprintf(get_lang('YouHaveAnInstitutionalAccount'), api_get_setting("Institution")), '', false);
|
| 46 | 46 | $msg .= Display::div("<br/><a href='".get_cas_direct_URL(api_get_course_id())."'>".getCASLogoHTML()." ".sprintf(get_lang('LoginWithYourAccount'), api_get_setting("Institution"))."</a><br/><br/>", array('align'=>'center'));
|
| 47 | 47 | $msg .= Display::return_message(get_lang('YouDontHaveAnInstitutionAccount'));
|
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $msg .= '<div class="well_login">'; |
| 53 | 53 | $msg .= $form->returnForm(); |
| 54 | 54 | $msg .= '</div>'; |
| 55 | - if (api_is_cas_activated()) {
|
|
| 55 | + if (api_is_cas_activated()) { |
|
| 56 | 56 | $msg .= "</div>"; |
| 57 | 57 | } |
| 58 | 58 | $msg .= '<hr/><p style="text-align:center"><a href="'.api_get_path(WEB_PATH).'">'.get_lang('ReturnToCourseHomepage').'</a></p>';
|
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $tpl->assign('content', '<h4>'.get_lang('LoginToGoToThisCourse').'</h4>'.$msg);
|
| 61 | 61 | $tpl->display_one_col_template(); |
| 62 | 62 | |
| 63 | -} else {
|
|
| 63 | +} else { |
|
| 64 | 64 | api_delete_firstpage_parameter(); |
| 65 | 65 | header('Location: '.api_get_path(WEB_PATH).'index.php');
|
| 66 | 66 | exit; |
@@ -15,8 +15,7 @@ discard block |
||
| 15 | 15 | $login_as_user_id = @$_GET["user_id"] ?: null; |
| 16 | 16 | |
| 17 | 17 | // Login as ... |
| 18 | -if ($action == "login_as" && !empty ($login_as_user_id)) |
|
| 19 | -{ |
|
| 18 | +if ($action == "login_as" && !empty ($login_as_user_id)) { |
|
| 20 | 19 | login_user($login_as_user_id); |
| 21 | 20 | } |
| 22 | 21 | |
@@ -32,8 +31,7 @@ discard block |
||
| 32 | 31 | //Display::display_header($tool_name); //cannot display now as we need to redirect |
| 33 | 32 | //api_display_tool_title($tool_name); |
| 34 | 33 | |
| 35 | -if (isset ($_GET['action'])) |
|
| 36 | -{ |
|
| 34 | +if (isset ($_GET['action'])) { |
|
| 37 | 35 | $check = Security::check_token('get'); |
| 38 | 36 | if ($check) { |
| 39 | 37 | switch ($_GET['action']) { |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | $plugin = BuyCoursesPlugin::create(); |
| 11 | 11 | $paypalEnabled = $plugin->get('paypal_enable') === 'true';
|
| 12 | 12 | |
| 13 | -if (!$paypalEnabled) {
|
|
| 13 | +if (!$paypalEnabled) { |
|
| 14 | 14 | api_not_allowed(true); |
| 15 | 15 | } |
| 16 | 16 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | $serviceSale = $plugin->getServiceSale($serviceSaleId); |
| 19 | 19 | $itemPrice = $serviceSale['price']; |
| 20 | 20 | |
| 21 | -if (empty($serviceSale)) {
|
|
| 21 | +if (empty($serviceSale)) { |
|
| 22 | 22 | api_not_allowed(true); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -49,9 +49,9 @@ discard block |
||
| 49 | 49 | ); |
| 50 | 50 | $form->addButtonCancel($plugin->get_lang('CancelOrder'), 'cancel');
|
| 51 | 51 | |
| 52 | -if ($form->validate()) {
|
|
| 52 | +if ($form->validate()) { |
|
| 53 | 53 | $formValues = $form->getSubmitValues(); |
| 54 | - if (isset($formValues['cancel'])) {
|
|
| 54 | + if (isset($formValues['cancel'])) { |
|
| 55 | 55 | $plugin->cancelServiceSale($serviceSale['id']); |
| 56 | 56 | |
| 57 | 57 | unset($_SESSION['bc_service_sale_id']); |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $confirmPayments = ConfirmPayment($itemPrice); |
| 68 | - if ($confirmPayments['ACK'] !== 'Success') {
|
|
| 68 | + if ($confirmPayments['ACK'] !== 'Success') { |
|
| 69 | 69 | $erroMessage = vsprintf( |
| 70 | 70 | $plugin->get_lang('ErrorOccurred'),
|
| 71 | 71 | [$expressCheckout['L_ERRORCODE0'], $confirmPayments['L_LONGMESSAGE0']] |
@@ -78,11 +78,11 @@ discard block |
||
| 78 | 78 | exit; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - switch ($confirmPayments["PAYMENTINFO_0_PAYMENTSTATUS"]) {
|
|
| 81 | + switch ($confirmPayments["PAYMENTINFO_0_PAYMENTSTATUS"]) { |
|
| 82 | 82 | case 'Completed': |
| 83 | 83 | $serviceSaleIsCompleted = $plugin->completeServiceSale($serviceSale['id']); |
| 84 | 84 | |
| 85 | - if ($serviceSaleIsCompleted) {
|
|
| 85 | + if ($serviceSaleIsCompleted) { |
|
| 86 | 86 | Display::addFlash( |
| 87 | 87 | Display::return_message( |
| 88 | 88 | sprintf($plugin->get_lang('SubscriptionToServiceXSuccessful'), $serviceSale['service']['name']),
|
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | ); |
| 99 | 99 | break; |
| 100 | 100 | case 'Pending': |
| 101 | - switch ($confirmPayments["PAYMENTINFO_0_PENDINGREASON"]) {
|
|
| 101 | + switch ($confirmPayments["PAYMENTINFO_0_PENDINGREASON"]) { |
|
| 102 | 102 | case 'address': |
| 103 | 103 | $purchaseStatus = $plugin->get_lang('PendingReasonByAddress');
|
| 104 | 104 | break; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | $token = isset($_GET['token']) ? Security::remove_XSS($_GET['token']) : null; |
| 167 | -if (empty($token)) {
|
|
| 167 | +if (empty($token)) { |
|
| 168 | 168 | api_not_allowed(true); |
| 169 | 169 | } |
| 170 | 170 | |
@@ -2099,7 +2099,8 @@ |
||
| 2099 | 2099 | |
| 2100 | 2100 | // Remind unanswered is a special version of remind all reminder |
| 2101 | 2101 | $exclude_users = array(); |
| 2102 | - if ($remindUnAnswered == 1) { // Remind only unanswered users |
|
| 2102 | + if ($remindUnAnswered == 1) { |
|
| 2103 | +// Remind only unanswered users |
|
| 2103 | 2104 | $reminder = 1; |
| 2104 | 2105 | $exclude_users = SurveyManager::get_people_who_filled_survey($_GET['survey_id']); |
| 2105 | 2106 | } |
@@ -675,7 +675,8 @@ discard block |
||
| 675 | 675 | $actionIcon2 = "delete"; |
| 676 | 676 | // We are in the course, question title can be a link to the question edit page |
| 677 | 677 | $questionTagA = 1; |
| 678 | - } else { // NOT IN A TEST - NOT IN THE COURSE |
|
| 678 | + } else { |
|
| 679 | +// NOT IN A TEST - NOT IN THE COURSE |
|
| 679 | 680 | $actionLabel = get_lang('Reuse'); |
| 680 | 681 | $actionIcon1 = get_lang('MustBeInATest'); |
| 681 | 682 | $actionIcon2 = ""; |
@@ -828,7 +829,8 @@ discard block |
||
| 828 | 829 | $in_questiontype, |
| 829 | 830 | $in_questionname, |
| 830 | 831 | $sessionId |
| 831 | -) { |
|
| 832 | +) |
|
| 833 | +{ |
|
| 832 | 834 | $res = $in_questionname; |
| 833 | 835 | $sessionIcon = null; |
| 834 | 836 | if ($in_addA) { |
@@ -868,7 +870,8 @@ discard block |
||
| 868 | 870 | $in_answerType, |
| 869 | 871 | $in_session_id, |
| 870 | 872 | $in_exercise_id |
| 871 | -) { |
|
| 873 | +) |
|
| 874 | +{ |
|
| 872 | 875 | $res = ""; |
| 873 | 876 | $getParams = "&selected_course=$in_selected_course&courseCategoryId=$in_courseCategoryId&exerciseId=$in_exercise_id&exerciseLevel=$in_exerciseLevel&answerType=$in_answerType&session_id=$in_session_id"; |
| 874 | 877 | switch ($in_action) { |
@@ -223,7 +223,8 @@ discard block |
||
| 223 | 223 | $comment = null, |
| 224 | 224 | $sessionId = null, |
| 225 | 225 | $treat_spaces_as_hyphens = true |
| 226 | -) { |
|
| 226 | +) |
|
| 227 | +{ |
|
| 227 | 228 | if (!$userId) { |
| 228 | 229 | return false; |
| 229 | 230 | } |
@@ -985,7 +986,8 @@ discard block |
||
| 985 | 986 | - add it to the database |
| 986 | 987 | - parse & change relative html links |
| 987 | 988 | */ |
| 988 | - if (PHP_OS == 'Linux' && !get_cfg_var('safe_mode') && false) { // *** UGent, changed by OC *** |
|
| 989 | + if (PHP_OS == 'Linux' && !get_cfg_var('safe_mode') && false) { |
|
| 990 | +// *** UGent, changed by OC *** |
|
| 989 | 991 | // Shell Method - if this is possible, it gains some speed |
| 990 | 992 | exec("unzip -d \"".$base_work_dir.$upload_path."/\"".$uploaded_file['name']." ".$uploaded_file['tmp_name']); |
| 991 | 993 | } else { |
@@ -1004,7 +1006,9 @@ discard block |
||
| 1004 | 1006 | if ($file != '.' && $file != '..') { |
| 1005 | 1007 | |
| 1006 | 1008 | $filetype = 'file'; |
| 1007 | - if (is_dir($base_work_dir.$upload_path.'/'.$file)) $filetype = 'folder'; |
|
| 1009 | + if (is_dir($base_work_dir.$upload_path.'/'.$file)) { |
|
| 1010 | + $filetype = 'folder'; |
|
| 1011 | + } |
|
| 1008 | 1012 | |
| 1009 | 1013 | $safe_file = api_replace_dangerous_char($file); |
| 1010 | 1014 | @rename($base_work_dir.$upload_path.'/'.$file, $base_work_dir.$upload_path.'/'.$safe_file); |
@@ -1056,7 +1060,8 @@ discard block |
||
| 1056 | 1060 | $groupId = 0, |
| 1057 | 1061 | $output = true, |
| 1058 | 1062 | $onlyUploadFile = false |
| 1059 | -) { |
|
| 1063 | +) |
|
| 1064 | +{ |
|
| 1060 | 1065 | $zip = new PclZip($uploaded_file['tmp_name']); |
| 1061 | 1066 | |
| 1062 | 1067 | // Check the zip content (real size and file extension) |
@@ -1170,7 +1175,8 @@ discard block |
||
| 1170 | 1175 | return 1; // Authorize directories |
| 1171 | 1176 | } |
| 1172 | 1177 | $blacklist = api_get_setting('upload_extensions_list_type'); |
| 1173 | - if ($blacklist != 'whitelist') { // if = blacklist |
|
| 1178 | + if ($blacklist != 'whitelist') { |
|
| 1179 | +// if = blacklist |
|
| 1174 | 1180 | $extensions = explode(';', strtolower(api_get_setting('upload_extensions_blacklist'))); |
| 1175 | 1181 | |
| 1176 | 1182 | $skip = api_get_setting('upload_extensions_skip'); |
@@ -1241,7 +1247,8 @@ discard block |
||
| 1241 | 1247 | $group_id = null, |
| 1242 | 1248 | $session_id = 0, |
| 1243 | 1249 | $userId = 0 |
| 1244 | -) { |
|
| 1250 | +) |
|
| 1251 | +{ |
|
| 1245 | 1252 | $session_id = empty($session_id) ? api_get_session_id() : $session_id; |
| 1246 | 1253 | $userId = empty($userId) ? api_get_user_id() : $userId; |
| 1247 | 1254 | |
@@ -1509,7 +1516,8 @@ discard block |
||
| 1509 | 1516 | $title = null, |
| 1510 | 1517 | $visibility = null, |
| 1511 | 1518 | $generateNewNameIfExists = false |
| 1512 | -) { |
|
| 1519 | +) |
|
| 1520 | +{ |
|
| 1513 | 1521 | $course_id = $_course['real_id']; |
| 1514 | 1522 | $session_id = intval($session_id); |
| 1515 | 1523 | |
@@ -1683,7 +1691,8 @@ discard block |
||
| 1683 | 1691 | $to_group_id, |
| 1684 | 1692 | $to_user_id, |
| 1685 | 1693 | $max_filled_space |
| 1686 | -) { |
|
| 1694 | +) |
|
| 1695 | +{ |
|
| 1687 | 1696 | $number_of_uploaded_images = count($uploaded_file_collection['name']); |
| 1688 | 1697 | $new_file_list = array(); |
| 1689 | 1698 | for ($i = 0; $i < $number_of_uploaded_images; $i++) { |
@@ -1856,7 +1865,8 @@ discard block |
||
| 1856 | 1865 | $groupId = 0, |
| 1857 | 1866 | $output = false, |
| 1858 | 1867 | $parent = array() |
| 1859 | -) { |
|
| 1868 | +) |
|
| 1869 | +{ |
|
| 1860 | 1870 | if (empty($userInfo) || empty($courseInfo)) { |
| 1861 | 1871 | |
| 1862 | 1872 | return false; |