@@ -48,7 +48,8 @@ discard block |
||
48 | 48 | 0 |
49 | 49 | ); |
50 | 50 | } |
51 | - } else { // height > $width |
|
51 | + } else { |
|
52 | +// height > $width |
|
52 | 53 | if ($height >= $max_size_for_picture) { |
53 | 54 | // scale width |
54 | 55 | $new_width = round($width * ($max_size_for_picture / $height)); |
@@ -193,7 +194,9 @@ discard block |
||
193 | 194 | */ |
194 | 195 | public function set_image_wrapper() |
195 | 196 | { |
196 | - if ($this->debug) error_log('Image::set_image_wrapper loaded'); |
|
197 | + if ($this->debug) { |
|
198 | + error_log('Image::set_image_wrapper loaded'); |
|
199 | + } |
|
197 | 200 | try { |
198 | 201 | if (file_exists($this->path)) { |
199 | 202 | $this->image = new Imagick($this->path); |
@@ -202,10 +205,14 @@ discard block |
||
202 | 205 | $this->fill_image_info(); //Fills height, width and type |
203 | 206 | } |
204 | 207 | } else { |
205 | - if ($this->debug) error_log('Image::image does not exist'); |
|
208 | + if ($this->debug) { |
|
209 | + error_log('Image::image does not exist'); |
|
210 | + } |
|
206 | 211 | } |
207 | 212 | } catch (ImagickException $e) { |
208 | - if ($this->debug) error_log($e->getMessage()); |
|
213 | + if ($this->debug) { |
|
214 | + error_log($e->getMessage()); |
|
215 | + } |
|
209 | 216 | } |
210 | 217 | } |
211 | 218 | |
@@ -218,7 +225,9 @@ discard block |
||
218 | 225 | |
219 | 226 | if (in_array($this->type, $this->allowed_extensions)) { |
220 | 227 | $this->image_validated = true; |
221 | - if ($this->debug) error_log('image_validated true'); |
|
228 | + if ($this->debug) { |
|
229 | + error_log('image_validated true'); |
|
230 | + } |
|
222 | 231 | } |
223 | 232 | } |
224 | 233 | |
@@ -234,7 +243,9 @@ discard block |
||
234 | 243 | //@todo implement border logic case for Imagick |
235 | 244 | public function resize($thumbw, $thumbh, $border, $specific_size = false) |
236 | 245 | { |
237 | - if (!$this->image_validated) return false; |
|
246 | + if (!$this->image_validated) { |
|
247 | + return false; |
|
248 | + } |
|
238 | 249 | |
239 | 250 | if ($specific_size) { |
240 | 251 | $width = $thumbw; |
@@ -64,9 +64,10 @@ |
||
64 | 64 | $new_comment = isset($_POST['comment']) ? Database::escape_string(trim($_POST['comment'])) : ''; |
65 | 65 | $new_title = isset($_POST['title']) ? Database::escape_string(trim($_POST['title'])) : ''; |
66 | 66 | |
67 | - if ($new_path && ($new_comment || $new_title)) |
|
68 | - if (($docid = DocumentManager::get_document_id($_course, $new_path))) { |
|
67 | + if ($new_path && ($new_comment || $new_title)) { |
|
68 | + if (($docid = DocumentManager::get_document_id($_course, $new_path))) { |
|
69 | 69 | $table_document = Database::get_course_table(TABLE_DOCUMENT); |
70 | + } |
|
70 | 71 | $ct = ''; |
71 | 72 | if ($new_comment) { |
72 | 73 | $ct .= ", comment='$new_comment'"; |
@@ -70,7 +70,8 @@ discard block |
||
70 | 70 | $returnFailure = 'No', |
71 | 71 | $optional = false, |
72 | 72 | $enabledTerm = '' |
73 | -) { |
|
73 | +) |
|
74 | +{ |
|
74 | 75 | if (extension_loaded($extensionName)) { |
75 | 76 | if (!empty($enabledTerm)) { |
76 | 77 | $isEnabled = ini_get($enabledTerm); |
@@ -109,7 +110,8 @@ discard block |
||
109 | 110 | $recommendedValue, |
110 | 111 | $returnSuccess = false, |
111 | 112 | $returnFailure = false |
112 | -) { |
|
113 | +) |
|
114 | +{ |
|
113 | 115 | $currentPhpValue = getPhpSetting($phpSetting); |
114 | 116 | if ($currentPhpValue == $recommendedValue) { |
115 | 117 | return Display::label($currentPhpValue.' '.$returnSuccess, 'success'); |
@@ -563,7 +565,8 @@ discard block |
||
563 | 565 | $dbPassForm, |
564 | 566 | $dbNameForm, |
565 | 567 | $dbPortForm = 3306 |
566 | -) { |
|
568 | +) |
|
569 | +{ |
|
567 | 570 | $dbParams = array( |
568 | 571 | 'driver' => 'pdo_mysql', |
569 | 572 | 'host' => $dbHostForm, |
@@ -610,7 +613,8 @@ discard block |
||
610 | 613 | function display_language_selection_box( |
611 | 614 | $name = 'language_list', |
612 | 615 | $default_language = 'english' |
613 | -) { |
|
616 | +) |
|
617 | +{ |
|
614 | 618 | // Reading language list. |
615 | 619 | $language_list = get_language_folder_list(); |
616 | 620 | |
@@ -712,7 +716,8 @@ discard block |
||
712 | 716 | $badUpdatePath, |
713 | 717 | $updatePath = '', |
714 | 718 | $update_from_version_8 = array() |
715 | -) { |
|
719 | +) |
|
720 | +{ |
|
716 | 721 | global $_setting; |
717 | 722 | echo '<div class="RequirementHeading"><h2>'.display_step_sequence().get_lang('Requirements')."</h2></div>"; |
718 | 723 | echo '<div class="RequirementText">'; |
@@ -1032,8 +1037,7 @@ discard block |
||
1032 | 1037 | <?php echo get_lang('Error'); ?>!<br /> |
1033 | 1038 | Chamilo <?php echo implode('|', $update_from_version_8).' '.get_lang('HasNotBeenFoundInThatDir'); ?>. |
1034 | 1039 | </div> |
1035 | - <?php } |
|
1036 | - else { |
|
1040 | + <?php } else { |
|
1037 | 1041 | echo '<br />'; |
1038 | 1042 | } |
1039 | 1043 | ?> |
@@ -1153,7 +1157,10 @@ discard block |
||
1153 | 1157 | <button type="submit" name="step1" class="btn btn-default" onclick="javascript: window.location='index.php'; return false;" value="<?php echo get_lang('Previous'); ?>" > |
1154 | 1158 | <em class="fa fa-backward"> </em> <?php echo get_lang('Previous'); ?> |
1155 | 1159 | </button> |
1156 | - <button type="submit" name="step2_install" class="btn btn-success" value="<?php echo get_lang("NewInstallation"); ?>" <?php if ($error) echo 'disabled="disabled"'; ?> > |
|
1160 | + <button type="submit" name="step2_install" class="btn btn-success" value="<?php echo get_lang("NewInstallation"); ?>" <?php if ($error) { |
|
1161 | + echo 'disabled="disabled"'; |
|
1162 | +} |
|
1163 | +?> > |
|
1157 | 1164 | <em class="fa fa-forward"> </em> <?php echo get_lang('NewInstallation'); ?> |
1158 | 1165 | </button> |
1159 | 1166 | <input type="hidden" name="is_executable" id="is_executable" value="-" /> |
@@ -1368,7 +1375,8 @@ discard block |
||
1368 | 1375 | $extra_notice, |
1369 | 1376 | $displayWhenUpdate = true, |
1370 | 1377 | $tr_attribute = '' |
1371 | -) { |
|
1378 | +) |
|
1379 | +{ |
|
1372 | 1380 | //echo "<tr ".$tr_attribute.">"; |
1373 | 1381 | echo "<label class='col-sm-4'>$parameterName</label>"; |
1374 | 1382 | |
@@ -1409,7 +1417,8 @@ discard block |
||
1409 | 1417 | $dbNameForm, |
1410 | 1418 | $dbPortForm = 3306, |
1411 | 1419 | $installationProfile = '' |
1412 | -) { |
|
1420 | +) |
|
1421 | +{ |
|
1413 | 1422 | if ($installType == 'update') { |
1414 | 1423 | global $_configuration; |
1415 | 1424 | $dbHostForm = $_configuration['db_host']; |
@@ -1532,9 +1541,12 @@ discard block |
||
1532 | 1541 | Database port: <strong><?php echo $manager->getConnection()->getPort(); ?></strong><br/> |
1533 | 1542 | Database driver: <strong><?php echo $manager->getConnection()->getDriver()->getName(); ?></strong><br/> |
1534 | 1543 | </div> |
1535 | - <?php else: ?> |
|
1544 | + <?php else { |
|
1545 | + : ?> |
|
1536 | 1546 | <div id="db_status" class="alert alert-danger"> |
1537 | - <p><?php echo get_lang('FailedConectionDatabase'); ?></strong></p> |
|
1547 | + <p><?php echo get_lang('FailedConectionDatabase'); |
|
1548 | +} |
|
1549 | +?></strong></p> |
|
1538 | 1550 | <code><?php echo $database_exists_text ?></code> |
1539 | 1551 | </div> |
1540 | 1552 | <?php endif; ?> |
@@ -1594,7 +1606,8 @@ discard block |
||
1594 | 1606 | $formFieldName, |
1595 | 1607 | $parameterValue, |
1596 | 1608 | $displayWhenUpdate = 'true' |
1597 | -) { |
|
1609 | +) |
|
1610 | +{ |
|
1598 | 1611 | $html = '<div class="form-group">'; |
1599 | 1612 | $html .= '<label class="col-sm-6 control-label">'.$parameterName.'</label>'; |
1600 | 1613 | if ($installType == INSTALL_TYPE_UPDATE && $displayWhenUpdate) { |
@@ -1641,7 +1654,8 @@ discard block |
||
1641 | 1654 | $allowSelfRegProf, |
1642 | 1655 | $loginForm, |
1643 | 1656 | $passForm |
1644 | -) { |
|
1657 | +) |
|
1658 | +{ |
|
1645 | 1659 | if ($installType != 'update' && empty($languageForm)) { |
1646 | 1660 | $languageForm = $_SESSION['install_language']; |
1647 | 1661 | } |
@@ -1678,7 +1692,8 @@ discard block |
||
1678 | 1692 | if ($installType == 'update') { |
1679 | 1693 | $html .= '<input type="hidden" name="languageForm" value="'.api_htmlentities($languageForm, ENT_QUOTES).'" />'.$languageForm; |
1680 | 1694 | |
1681 | - } else { // new installation |
|
1695 | + } else { |
|
1696 | +// new installation |
|
1682 | 1697 | $html .= '<div class="col-sm-6">'; |
1683 | 1698 | $html .= display_language_selection_box('languageForm', $languageForm); |
1684 | 1699 | $html .= '</div>'; |
@@ -1951,7 +1966,8 @@ discard block |
||
1951 | 1966 | $course_dir, |
1952 | 1967 | $course_attempt_name, |
1953 | 1968 | $file = 'test.php' |
1954 | -) { |
|
1969 | +) |
|
1970 | +{ |
|
1955 | 1971 | $output = false; |
1956 | 1972 | //Write in file |
1957 | 1973 | $file_name = $course_dir.'/'.$file; |
@@ -2061,7 +2077,8 @@ discard block |
||
2061 | 2077 | $allowRegistration, |
2062 | 2078 | $allowTeacherSelfRegistration, |
2063 | 2079 | $installationProfile = '' |
2064 | -) { |
|
2080 | +) |
|
2081 | +{ |
|
2065 | 2082 | $allowTeacherSelfRegistration = $allowTeacherSelfRegistration ? 'true' : 'false'; |
2066 | 2083 | |
2067 | 2084 | // Use PHP 5.3 to avoid issue with weird peripherical auto-installers like travis-ci |
@@ -2759,7 +2776,8 @@ discard block |
||
2759 | 2776 | $allowSelfReg, |
2760 | 2777 | $allowSelfRegProf, |
2761 | 2778 | $installationProfile = '' |
2762 | -) { |
|
2779 | +) |
|
2780 | +{ |
|
2763 | 2781 | $sysPath = !empty($sysPath) ? $sysPath : api_get_path(SYS_PATH); |
2764 | 2782 | |
2765 | 2783 | $connection = $manager->getConnection(); |
@@ -80,7 +80,8 @@ discard block |
||
80 | 80 | { |
81 | 81 | $email_subject = "[".api_get_setting('siteName')."] ".get_lang('LoginRequest'); // SUBJECT |
82 | 82 | |
83 | - if ($by_username) { // Show only for lost password |
|
83 | + if ($by_username) { |
|
84 | +// Show only for lost password |
|
84 | 85 | $user_account_list = self::get_user_account_list($user, false, $by_username); // BODY |
85 | 86 | $email_to = $user['email']; |
86 | 87 | } else { |
@@ -284,7 +285,8 @@ discard block |
||
284 | 285 | global $is_allowedCreateCourse; |
285 | 286 | global $_user; |
286 | 287 | |
287 | - if (isset($reset) && $reset) { // session data refresh requested |
|
288 | + if (isset($reset) && $reset) { |
|
289 | +// session data refresh requested |
|
288 | 290 | unset($_SESSION['_user']['uidReset']); |
289 | 291 | $is_platformAdmin = false; |
290 | 292 | $is_allowedCreateCourse = false; |
@@ -335,14 +337,16 @@ discard block |
||
335 | 337 | header('location:'.api_get_path(WEB_PATH)); |
336 | 338 | //exit("WARNING UNDEFINED UID !! "); |
337 | 339 | } |
338 | - } else { // no uid => logout or Anonymous |
|
340 | + } else { |
|
341 | +// no uid => logout or Anonymous |
|
339 | 342 | Session::erase('_user'); |
340 | 343 | Session::erase('_uid'); |
341 | 344 | } |
342 | 345 | |
343 | 346 | Session::write('is_platformAdmin', $is_platformAdmin); |
344 | 347 | Session::write('is_allowedCreateCourse', $is_allowedCreateCourse); |
345 | - } else { // continue with the previous values |
|
348 | + } else { |
|
349 | +// continue with the previous values |
|
346 | 350 | $_user = $_SESSION['_user']; |
347 | 351 | $is_platformAdmin = $_SESSION['is_platformAdmin']; |
348 | 352 | $is_allowedCreateCourse = $_SESSION['is_allowedCreateCourse']; |
@@ -481,7 +485,8 @@ discard block |
||
481 | 485 | } |
482 | 486 | } else { |
483 | 487 | // Continue with the previous values |
484 | - if (empty($_SESSION['_course']) or empty($_SESSION['_cid'])) { //no previous values... |
|
488 | + if (empty($_SESSION['_course']) or empty($_SESSION['_cid'])) { |
|
489 | +//no previous values... |
|
485 | 490 | $_cid = -1; //set default values that will be caracteristic of being unset |
486 | 491 | $_course = -1; |
487 | 492 | } else { |
@@ -654,7 +659,8 @@ discard block |
||
654 | 659 | $is_courseAdmin = true; |
655 | 660 | } |
656 | 661 | } |
657 | - } else { // keys missing => not anymore in the course - user relation |
|
662 | + } else { |
|
663 | +// keys missing => not anymore in the course - user relation |
|
658 | 664 | // course |
659 | 665 | $is_courseMember = false; |
660 | 666 | $is_courseAdmin = false; |
@@ -746,12 +752,15 @@ discard block |
||
746 | 752 | global $_course; |
747 | 753 | global $_gid; |
748 | 754 | |
749 | - if ($reset) { // session data refresh requested |
|
750 | - if ($group_id && $_cid && !empty($_course['real_id'])) { // have keys to search data |
|
755 | + if ($reset) { |
|
756 | +// session data refresh requested |
|
757 | + if ($group_id && $_cid && !empty($_course['real_id'])) { |
|
758 | +// have keys to search data |
|
751 | 759 | $group_table = Database::get_course_table(TABLE_GROUP); |
752 | 760 | $sql = "SELECT * FROM $group_table WHERE c_id = ".$_course['real_id']." AND id = '$group_id'"; |
753 | 761 | $result = Database::query($sql); |
754 | - if (Database::num_rows($result) > 0) { // This group has recorded status related to this course |
|
762 | + if (Database::num_rows($result) > 0) { |
|
763 | +// This group has recorded status related to this course |
|
755 | 764 | $gpData = Database::fetch_array($result); |
756 | 765 | $_gid = $gpData ['id']; |
757 | 766 | Session::write('_gid', $_gid); |
@@ -762,9 +771,11 @@ discard block |
||
762 | 771 | // Keys missing => not anymore in the group - course relation |
763 | 772 | Session::erase('_gid'); |
764 | 773 | } |
765 | - } elseif (isset($_SESSION['_gid'])) { // continue with the previous values |
|
774 | + } elseif (isset($_SESSION['_gid'])) { |
|
775 | +// continue with the previous values |
|
766 | 776 | $_gid = $_SESSION ['_gid']; |
767 | - } else { //if no previous value, assign caracteristic undefined value |
|
777 | + } else { |
|
778 | +//if no previous value, assign caracteristic undefined value |
|
768 | 779 | $_gid = -1; |
769 | 780 | } |
770 | 781 |
@@ -97,8 +97,9 @@ discard block |
||
97 | 97 | // Read the magic bytes and verify |
98 | 98 | $retval = substr($png, 0, 8); |
99 | 99 | $ipos = 8; |
100 | - if ($retval != "\x89PNG\x0d\x0a\x1a\x0a") |
|
101 | - throw new Exception('Is not a valid PNG image'); |
|
100 | + if ($retval != "\x89PNG\x0d\x0a\x1a\x0a") { |
|
101 | + throw new Exception('Is not a valid PNG image'); |
|
102 | + } |
|
102 | 103 | // Loop through the chunks. Byte 0-3 is length, Byte 4-7 is type |
103 | 104 | $chunkHeader = substr($png, $ipos, 8); |
104 | 105 | $ipos = $ipos + 8; |
@@ -110,13 +111,17 @@ discard block |
||
110 | 111 | $data = substr($png, $ipos, $chunk['size']); |
111 | 112 | $sections = explode("\0", $data); |
112 | 113 | print_r($sections); |
113 | - if ($sections[0] == $key) $skip = true; |
|
114 | + if ($sections[0] == $key) { |
|
115 | + $skip = true; |
|
116 | + } |
|
114 | 117 | } |
115 | 118 | // Extract the data and the CRC |
116 | 119 | $data = substr($png, $ipos, $chunk['size'] + 4); |
117 | 120 | $ipos = $ipos + $chunk['size'] + 4; |
118 | 121 | // Add in the header, data, and CRC |
119 | - if (!$skip) $retval = $retval.$chunkHeader.$data; |
|
122 | + if (!$skip) { |
|
123 | + $retval = $retval.$chunkHeader.$data; |
|
124 | + } |
|
120 | 125 | // Read next chunk header |
121 | 126 | $chunkHeader = substr($png, $ipos, 8); |
122 | 127 | $ipos = $ipos + 8; |
@@ -189,12 +189,18 @@ |
||
189 | 189 | <?php echo api_ucfirst(get_lang('SessionVisibility')) ?> : |
190 | 190 | </td> |
191 | 191 | <td> |
192 | - <?php if ($session['visibility'] == 1) echo get_lang('ReadOnly'); elseif ($session['visibility'] == 2) echo get_lang('Visible'); elseif ($session['visibility'] == 3) echo api_ucfirst(get_lang('Invisible')) ?> |
|
192 | + <?php if ($session['visibility'] == 1) { |
|
193 | + echo get_lang('ReadOnly'); |
|
194 | +} elseif ($session['visibility'] == 2) { |
|
195 | + echo get_lang('Visible'); |
|
196 | +} elseif ($session['visibility'] == 3) { |
|
197 | + echo api_ucfirst(get_lang('Invisible')) ?> |
|
193 | 198 | </td> |
194 | 199 | </tr> |
195 | 200 | <?php |
196 | 201 | |
197 | 202 | $multiple_url_is_on = api_get_multiple_access_url(); |
203 | +} |
|
198 | 204 | if ($multiple_url_is_on) { |
199 | 205 | echo '<tr><td>'; |
200 | 206 | echo 'URL'; |
@@ -214,7 +214,8 @@ discard block |
||
214 | 214 | $direction = null, |
215 | 215 | $time_limit = null, |
216 | 216 | $friends = false |
217 | -) { |
|
217 | +) |
|
218 | +{ |
|
218 | 219 | // Time limit in seconds? |
219 | 220 | if (empty($time_limit)) { |
220 | 221 | $time_limit = api_get_setting('time_limit_whosonline'); |
@@ -442,7 +443,8 @@ discard block |
||
442 | 443 | $uid, |
443 | 444 | $time_limit, |
444 | 445 | $coursecode = null |
445 | -) { |
|
446 | +) |
|
447 | +{ |
|
446 | 448 | if (empty($coursecode)) { |
447 | 449 | return false; |
448 | 450 | } |
@@ -538,7 +538,8 @@ |
||
538 | 538 | $i = 1; |
539 | 539 | |
540 | 540 | foreach ($list as $key => $value) { |
541 | - if (empty($value[2])) { //if out of any session |
|
541 | + if (empty($value[2])) { |
|
542 | +//if out of any session |
|
542 | 543 | $my_courses .= $value[1]; |
543 | 544 | $i++; |
544 | 545 | } |
@@ -1153,7 +1153,8 @@ discard block |
||
1153 | 1153 | var_Dump($questions); |
1154 | 1154 | } |
1155 | 1155 | } |
1156 | - } else { // In case it's another type than 0 or 1 |
|
1156 | + } else { |
|
1157 | +// In case it's another type than 0 or 1 |
|
1157 | 1158 | echo get_lang('ErrorSurveyTypeUnknown'); |
1158 | 1159 | } |
1159 | 1160 | } |
@@ -1247,7 +1248,8 @@ discard block |
||
1247 | 1248 | // The normal survey as always but with the form profile |
1248 | 1249 | if (isset($_GET['show'])) { |
1249 | 1250 | $numberofpages = count($paged_questions); |
1250 | - if (($show < $numberofpages) || !$_GET['show']) { //$show = $_GET['show'] + 1 |
|
1251 | + if (($show < $numberofpages) || !$_GET['show']) { |
|
1252 | +//$show = $_GET['show'] + 1 |
|
1251 | 1253 | if ($show == 0) { |
1252 | 1254 | $form->addButton( |
1253 | 1255 | 'next_survey_page', |
@@ -1275,7 +1277,8 @@ discard block |
||
1275 | 1277 | } |
1276 | 1278 | } |
1277 | 1279 | } |
1278 | -} elseif ($survey_data['survey_type'] === '1') { //conditional/personality-test type survey |
|
1280 | +} elseif ($survey_data['survey_type'] === '1') { |
|
1281 | +//conditional/personality-test type survey |
|
1279 | 1282 | if (isset($_GET['show']) || isset($_POST['personality'])) { |
1280 | 1283 | $numberofpages = count($paged_questions); |
1281 | 1284 | if (!empty($paged_questions_sec) && count($paged_questions_sec) > 0) { |