@@ -121,6 +121,9 @@ |
||
121 | 121 | return $form->isSubmitted() == false || $form->validate(); |
122 | 122 | } |
123 | 123 | |
124 | + /** |
|
125 | + * @param string $format |
|
126 | + */ |
|
124 | 127 | function get_ceiling($format = null) |
125 | 128 | { |
126 | 129 | $result = Request::get('ceiling'); |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | } |
168 | 168 | |
169 | 169 | $action = $this->get_action(); |
170 | - $f = array($this, 'action_' . $action); |
|
170 | + $f = array($this, 'action_'.$action); |
|
171 | 171 | if (is_callable($f)) { |
172 | 172 | return call_user_func($f, $ids); |
173 | 173 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $text = get_lang('No'); |
293 | 293 | } |
294 | 294 | |
295 | - $result = Display::return_icon($image . '.png', $text); |
|
295 | + $result = Display::return_icon($image.'.png', $text); |
|
296 | 296 | return $result; |
297 | 297 | } |
298 | 298 |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * This function return the value of a php.ini setting if not "" or if exists, |
98 | 98 | * otherwise return false |
99 | 99 | * @param string $phpSetting The name of a PHP setting |
100 | - * @return mixed The value of the setting, or false if not found |
|
100 | + * @return string|false The value of the setting, or false if not found |
|
101 | 101 | */ |
102 | 102 | function checkPhpSettingExists($phpSetting) |
103 | 103 | { |
@@ -1268,6 +1268,10 @@ discard block |
||
1268 | 1268 | * @param string Extra notice (to show on the right side) |
1269 | 1269 | * @param boolean Whether to display in update mode |
1270 | 1270 | * @param string Additional attribute for the <tr> element |
1271 | + * @param string $installType |
|
1272 | + * @param string $parameterName |
|
1273 | + * @param string $formFieldName |
|
1274 | + * @param string $extra_notice |
|
1271 | 1275 | * @return void Direct output |
1272 | 1276 | */ |
1273 | 1277 | function displayDatabaseParameter( |
@@ -1481,6 +1485,11 @@ discard block |
||
1481 | 1485 | |
1482 | 1486 | <?php |
1483 | 1487 | } |
1488 | +/** |
|
1489 | + * @param string $content |
|
1490 | + * @param string $title |
|
1491 | + * @param string $id |
|
1492 | + */ |
|
1484 | 1493 | function panel($content = null, $title = null, $id = null, $style = null) { |
1485 | 1494 | $html = ''; |
1486 | 1495 | if (empty($style)) { |
@@ -1837,8 +1846,8 @@ discard block |
||
1837 | 1846 | } |
1838 | 1847 | |
1839 | 1848 | /** |
1840 | - * @param $current_value |
|
1841 | - * @param $wanted_value |
|
1849 | + * @param string $current_value |
|
1850 | + * @param string $wanted_value |
|
1842 | 1851 | * @return string |
1843 | 1852 | */ |
1844 | 1853 | function compare_setting_values($current_value, $wanted_value) |
@@ -1855,8 +1864,8 @@ discard block |
||
1855 | 1864 | } |
1856 | 1865 | |
1857 | 1866 | /** |
1858 | - * @param $course_dir |
|
1859 | - * @param $course_attempt_name |
|
1867 | + * @param string $course_dir |
|
1868 | + * @param string $course_attempt_name |
|
1860 | 1869 | * @param string $file |
1861 | 1870 | * @return bool |
1862 | 1871 | */ |
@@ -972,8 +972,7 @@ discard block |
||
972 | 972 | <?php echo get_lang('Error'); ?>!<br /> |
973 | 973 | Chamilo <?php echo implode('|', $update_from_version_8).' '.get_lang('HasNotBeenFoundInThatDir'); ?>. |
974 | 974 | </div> |
975 | - <?php } |
|
976 | - else { |
|
975 | + <?php } else { |
|
977 | 976 | echo '<br />'; |
978 | 977 | } |
979 | 978 | ?> |
@@ -1088,7 +1087,10 @@ discard block |
||
1088 | 1087 | <button type="submit" name="step1" class="btn btn-default" onclick="javascript: window.location='index.php'; return false;" value="<?php echo get_lang('Previous'); ?>" > |
1089 | 1088 | <em class="fa fa-backward"> </em> <?php echo get_lang('Previous'); ?> |
1090 | 1089 | </button> |
1091 | - <button type="submit" name="step2_install" class="btn btn-success" value="<?php echo get_lang("NewInstallation"); ?>" <?php if ($error) echo 'disabled="disabled"'; ?> > |
|
1090 | + <button type="submit" name="step2_install" class="btn btn-success" value="<?php echo get_lang("NewInstallation"); ?>" <?php if ($error) { |
|
1091 | + echo 'disabled="disabled"'; |
|
1092 | +} |
|
1093 | +?> > |
|
1092 | 1094 | <em class="fa fa-forward"> </em> <?php echo get_lang('NewInstallation'); ?> |
1093 | 1095 | </button> |
1094 | 1096 | <input type="hidden" name="is_executable" id="is_executable" value="-" /> |
@@ -1374,7 +1376,7 @@ discard block |
||
1374 | 1376 | <input type="hidden" name="dbHostForm" value="<?php echo htmlentities($dbHostForm); ?>" /><?php echo $dbHostForm; ?> |
1375 | 1377 | </div> |
1376 | 1378 | <div class="col-sm-3"></div> |
1377 | - <?php }else{ ?> |
|
1379 | + <?php } else{ ?> |
|
1378 | 1380 | <div class="col-sm-5"> |
1379 | 1381 | <input type="text" class="form-control" size="25" maxlength="50" name="dbHostForm" value="<?php echo htmlentities($dbHostForm); ?>" /> |
1380 | 1382 | </div> |
@@ -1388,7 +1390,7 @@ discard block |
||
1388 | 1390 | <input type="hidden" name="dbPortForm" value="<?php echo htmlentities($dbPortForm); ?>" /><?php echo $dbPortForm; ?> |
1389 | 1391 | </div> |
1390 | 1392 | <div class="col-sm-3"></div> |
1391 | - <?php }else{ ?> |
|
1393 | + <?php } else{ ?> |
|
1392 | 1394 | <div class="col-sm-5"> |
1393 | 1395 | <input type="text" class="form-control" size="25" maxlength="50" name="dbPortForm" value="<?php echo htmlentities($dbPortForm); ?>" /> |
1394 | 1396 | </div> |
@@ -1470,9 +1472,12 @@ discard block |
||
1470 | 1472 | Database port: <strong><?php echo $manager->getConnection()->getPort(); ?></strong><br/> |
1471 | 1473 | Database driver: <strong><?php echo $manager->getConnection()->getDriver()->getName(); ?></strong><br/> |
1472 | 1474 | </div> |
1473 | - <?php else: ?> |
|
1475 | + <?php else { |
|
1476 | + : ?> |
|
1474 | 1477 | <div id="db_status" class="alert alert-danger"> |
1475 | - <p><?php echo get_lang('FailedConectionDatabase'); ?></strong></p> |
|
1478 | + <p><?php echo get_lang('FailedConectionDatabase'); |
|
1479 | +} |
|
1480 | +?></strong></p> |
|
1476 | 1481 | <code><?php echo $database_exists_text ?></code> |
1477 | 1482 | </div> |
1478 | 1483 | <?php endif; ?> |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | if (!is_array($result)) { |
379 | 379 | $result = array(); |
380 | 380 | $exceptions = array('.', '..', 'CVS', '.svn'); |
381 | - $search = array('_latin', '_unicode', '_corporate', '_org' , '_KM', '_'); |
|
381 | + $search = array('_latin', '_unicode', '_corporate', '_org', '_KM', '_'); |
|
382 | 382 | $replace_with = array(' (Latin)', ' (unicode)', ' (corporate)', ' (org)', ' (KM)', ' '); |
383 | 383 | $dirname = api_get_path(SYS_LANG_PATH); |
384 | 384 | $handle = opendir($dirname); |
@@ -413,9 +413,9 @@ discard block |
||
413 | 413 | if ($handle = opendir($directory)) { |
414 | 414 | while (false !== ($file = readdir($handle))) { |
415 | 415 | if ($file != "." && $file != "..") { |
416 | - if (is_dir($directory. "/" . $file)) { |
|
417 | - $array_items = array_merge($array_items, my_directory_to_array($directory. '/' . $file)); |
|
418 | - $file = $directory . "/" . $file; |
|
416 | + if (is_dir($directory."/".$file)) { |
|
417 | + $array_items = array_merge($array_items, my_directory_to_array($directory.'/'.$file)); |
|
418 | + $file = $directory."/".$file; |
|
419 | 419 | $array_items[] = preg_replace("/\/\//si", '/', $file); |
420 | 420 | } |
421 | 421 | } |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | // try to recover config file from Chamilo 1.9.x |
461 | 461 | if (file_exists($updatePath.'main/inc/conf/configuration.php')) { |
462 | 462 | $updateFromConfigFile = 'main/inc/conf/configuration.php'; |
463 | - } elseif (file_exists($updatePath . 'app/config/configuration.php')) { |
|
463 | + } elseif (file_exists($updatePath.'app/config/configuration.php')) { |
|
464 | 464 | $updateFromConfigFile = 'app/config/configuration.php'; |
465 | 465 | } else { |
466 | 466 | // Give up recovering. |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | <h2><?php get_lang('WelcomeToTheChamiloInstaller'); ?></h2> |
622 | 622 | <div class="RequirementHeading"> |
623 | 623 | <h2><?php echo display_step_sequence(); ?> |
624 | - <?php echo get_lang('InstallationLanguage');?> |
|
624 | + <?php echo get_lang('InstallationLanguage'); ?> |
|
625 | 625 | </h2> |
626 | 626 | <p><?php echo get_lang('PleaseSelectInstallationProcessLanguage'); ?>:</p> |
627 | 627 | <form id="lang_form" method="post" action="<?php echo api_get_self(); ?>"> |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | if (phpversion() < REQUIRED_PHP_VERSION) { |
695 | 695 | echo '<strong><font color="red">'.get_lang('PHPVersionError').'</font></strong>'; |
696 | 696 | } else { |
697 | - echo '<strong><font color="green">'.get_lang('PHPVersionOK'). ' '.phpversion().'</font></strong>'; |
|
697 | + echo '<strong><font color="green">'.get_lang('PHPVersionOK').' '.phpversion().'</font></strong>'; |
|
698 | 698 | } |
699 | 699 | echo '</td> |
700 | 700 | </tr> |
@@ -1046,9 +1046,9 @@ discard block |
||
1046 | 1046 | } |
1047 | 1047 | |
1048 | 1048 | $deprecated = [ |
1049 | - api_get_path(SYS_CODE_PATH) . 'exercice/', |
|
1050 | - api_get_path(SYS_CODE_PATH) . 'newscorm/', |
|
1051 | - api_get_path(SYS_PLUGIN_PATH) . 'ticket/' |
|
1049 | + api_get_path(SYS_CODE_PATH).'exercice/', |
|
1050 | + api_get_path(SYS_CODE_PATH).'newscorm/', |
|
1051 | + api_get_path(SYS_PLUGIN_PATH).'ticket/' |
|
1052 | 1052 | ]; |
1053 | 1053 | $deprecatedToRemove = []; |
1054 | 1054 | |
@@ -1153,7 +1153,7 @@ discard block |
||
1153 | 1153 | function get_contact_registration_form() |
1154 | 1154 | { |
1155 | 1155 | |
1156 | - $html =' |
|
1156 | + $html = ' |
|
1157 | 1157 | <form class="form-horizontal"> |
1158 | 1158 | <div class="panel panel-default"> |
1159 | 1159 | <div class="panel-body"> |
@@ -1250,7 +1250,7 @@ discard block |
||
1250 | 1250 | <div class="col-sm-9"> |
1251 | 1251 | <div class="radio"> |
1252 | 1252 | <label> |
1253 | - <input type="radio" name="financial_decision" id="financial_decision1" value="1" checked /> ' . get_lang('Yes') . ' |
|
1253 | + <input type="radio" name="financial_decision" id="financial_decision1" value="1" checked /> ' . get_lang('Yes').' |
|
1254 | 1254 | </label> |
1255 | 1255 | </div> |
1256 | 1256 | <div class="radio"> |
@@ -1309,8 +1309,8 @@ discard block |
||
1309 | 1309 | echo '<input type="hidden" name="'.$formFieldName.'" id="'.$formFieldName.'" value="'.api_htmlentities($parameterValue).'" />'; |
1310 | 1310 | echo api_htmlentities($parameterValue); |
1311 | 1311 | } else { |
1312 | - echo '<div class="col-sm-5"><input type="' . $inputType . '" class="form-control" size="' . DATABASE_FORM_FIELD_DISPLAY_LENGTH . '" maxlength="' . $maxLength . '" name="' . $formFieldName . '" id="' . $formFieldName . '" value="' . api_htmlentities($parameterValue) . '" />' . "</div>"; |
|
1313 | - echo '<div class="col-sm-3">' . $extra_notice . '</div>'; |
|
1312 | + echo '<div class="col-sm-5"><input type="'.$inputType.'" class="form-control" size="'.DATABASE_FORM_FIELD_DISPLAY_LENGTH.'" maxlength="'.$maxLength.'" name="'.$formFieldName.'" id="'.$formFieldName.'" value="'.api_htmlentities($parameterValue).'" />'."</div>"; |
|
1313 | + echo '<div class="col-sm-3">'.$extra_notice.'</div>'; |
|
1314 | 1314 | } |
1315 | 1315 | } |
1316 | 1316 | } |
@@ -1344,12 +1344,12 @@ discard block |
||
1344 | 1344 | $dbNameForm = $_configuration['main_database']; |
1345 | 1345 | $dbPortForm = isset($_configuration['db_port']) ? $_configuration['db_port'] : ''; |
1346 | 1346 | |
1347 | - echo '<div class="RequirementHeading"><h2>' . display_step_sequence() .get_lang('DBSetting') . '</h2></div>'; |
|
1347 | + echo '<div class="RequirementHeading"><h2>'.display_step_sequence().get_lang('DBSetting').'</h2></div>'; |
|
1348 | 1348 | echo '<div class="RequirementContent">'; |
1349 | 1349 | echo get_lang('DBSettingUpgradeIntro'); |
1350 | 1350 | echo '</div>'; |
1351 | 1351 | } else { |
1352 | - echo '<div class="RequirementHeading"><h2>' . display_step_sequence() .get_lang('DBSetting') . '</h2></div>'; |
|
1352 | + echo '<div class="RequirementHeading"><h2>'.display_step_sequence().get_lang('DBSetting').'</h2></div>'; |
|
1353 | 1353 | echo '<div class="RequirementContent">'; |
1354 | 1354 | echo get_lang('DBSettingIntro'); |
1355 | 1355 | echo '</div>'; |
@@ -1359,12 +1359,12 @@ discard block |
||
1359 | 1359 | <div class="panel-body"> |
1360 | 1360 | <div class="form-group"> |
1361 | 1361 | <label class="col-sm-4"><?php echo get_lang('DBHost'); ?> </label> |
1362 | - <?php if ($installType == 'update'){ ?> |
|
1362 | + <?php if ($installType == 'update') { ?> |
|
1363 | 1363 | <div class="col-sm-5"> |
1364 | 1364 | <input type="hidden" name="dbHostForm" value="<?php echo htmlentities($dbHostForm); ?>" /><?php echo $dbHostForm; ?> |
1365 | 1365 | </div> |
1366 | 1366 | <div class="col-sm-3"></div> |
1367 | - <?php }else{ ?> |
|
1367 | + <?php } else { ?> |
|
1368 | 1368 | <div class="col-sm-5"> |
1369 | 1369 | <input type="text" class="form-control" size="25" maxlength="50" name="dbHostForm" value="<?php echo htmlentities($dbHostForm); ?>" /> |
1370 | 1370 | </div> |
@@ -1373,12 +1373,12 @@ discard block |
||
1373 | 1373 | </div> |
1374 | 1374 | <div class="form-group"> |
1375 | 1375 | <label class="col-sm-4"><?php echo get_lang('DBPort'); ?> </label> |
1376 | - <?php if ($installType == 'update'){ ?> |
|
1376 | + <?php if ($installType == 'update') { ?> |
|
1377 | 1377 | <div class="col-sm-5"> |
1378 | 1378 | <input type="hidden" name="dbPortForm" value="<?php echo htmlentities($dbPortForm); ?>" /><?php echo $dbPortForm; ?> |
1379 | 1379 | </div> |
1380 | 1380 | <div class="col-sm-3"></div> |
1381 | - <?php }else{ ?> |
|
1381 | + <?php } else { ?> |
|
1382 | 1382 | <div class="col-sm-5"> |
1383 | 1383 | <input type="text" class="form-control" size="25" maxlength="50" name="dbPortForm" value="<?php echo htmlentities($dbPortForm); ?>" /> |
1384 | 1384 | </div> |
@@ -1404,7 +1404,7 @@ discard block |
||
1404 | 1404 | <?php |
1405 | 1405 | //Database Name fix replace weird chars |
1406 | 1406 | if ($installType != INSTALL_TYPE_UPDATE) { |
1407 | - $dbNameForm = str_replace(array('-','*', '$', ' ', '.'), '', $dbNameForm); |
|
1407 | + $dbNameForm = str_replace(array('-', '*', '$', ' ', '.'), '', $dbNameForm); |
|
1408 | 1408 | } |
1409 | 1409 | |
1410 | 1410 | displayDatabaseParameter( |
@@ -1497,7 +1497,7 @@ discard block |
||
1497 | 1497 | if (!empty($title)) { |
1498 | 1498 | $panelTitle = Display::div($title, array('class' => 'panel-heading')); |
1499 | 1499 | $panelBody = Display::div($content, array('class' => 'panel-body')); |
1500 | - $panelParent = Display::div($panelTitle . $panelBody, array('id' => $id, 'class' => 'panel panel-'.$style)); |
|
1500 | + $panelParent = Display::div($panelTitle.$panelBody, array('id' => $id, 'class' => 'panel panel-'.$style)); |
|
1501 | 1501 | } else { |
1502 | 1502 | $panelBody = Display::div($html, array('class' => 'panel-body')); |
1503 | 1503 | $panelParent = Display::div($panelBody, array('id' => $id, 'class' => 'panel panel-'.$style)); |
@@ -1523,9 +1523,9 @@ discard block |
||
1523 | 1523 | $displayWhenUpdate = 'true' |
1524 | 1524 | ) { |
1525 | 1525 | $html = '<div class="form-group">'; |
1526 | - $html .= '<label class="col-sm-6 control-label">' . $parameterName . '</label>'; |
|
1526 | + $html .= '<label class="col-sm-6 control-label">'.$parameterName.'</label>'; |
|
1527 | 1527 | if ($installType == INSTALL_TYPE_UPDATE && $displayWhenUpdate) { |
1528 | - $html .= '<input type="hidden" name="' . $formFieldName . '" value="'. api_htmlentities($parameterValue, ENT_QUOTES). '" />' . $parameterValue; |
|
1528 | + $html .= '<input type="hidden" name="'.$formFieldName.'" value="'.api_htmlentities($parameterValue, ENT_QUOTES).'" />'.$parameterValue; |
|
1529 | 1529 | } else { |
1530 | 1530 | $html .= '<div class="col-sm-6"><input class="form-control" type="text" size="'.FORM_FIELD_DISPLAY_LENGTH.'" maxlength="'.MAX_FORM_FIELD_LENGTH.'" name="'.$formFieldName.'" value="'.api_htmlentities($parameterValue, ENT_QUOTES).'" />'."</div>"; |
1531 | 1531 | } |
@@ -1573,7 +1573,7 @@ discard block |
||
1573 | 1573 | $languageForm = $_SESSION['install_language']; |
1574 | 1574 | } |
1575 | 1575 | echo '<div class="RequirementHeading">'; |
1576 | - echo "<h2>" . display_step_sequence() . get_lang("CfgSetting") . "</h2>"; |
|
1576 | + echo "<h2>".display_step_sequence().get_lang("CfgSetting")."</h2>"; |
|
1577 | 1577 | echo '</div>'; |
1578 | 1578 | |
1579 | 1579 | echo '<p>'.get_lang('ConfigSettingsInfo').' <strong>app/config/configuration.php</strong></p>'; |
@@ -1591,14 +1591,14 @@ discard block |
||
1591 | 1591 | |
1592 | 1592 | // Parameters 3 and 4: administrator's names |
1593 | 1593 | |
1594 | - $html .= display_configuration_parameter($installType, get_lang('AdminFirstName'), 'adminFirstName', $adminFirstName); |
|
1595 | - $html .= display_configuration_parameter($installType, get_lang('AdminLastName'), 'adminLastName', $adminLastName); |
|
1594 | + $html .= display_configuration_parameter($installType, get_lang('AdminFirstName'), 'adminFirstName', $adminFirstName); |
|
1595 | + $html .= display_configuration_parameter($installType, get_lang('AdminLastName'), 'adminLastName', $adminLastName); |
|
1596 | 1596 | |
1597 | 1597 | //Parameter 3: administrator's email |
1598 | - $html .= display_configuration_parameter($installType, get_lang('AdminEmail'), 'emailForm', $emailForm); |
|
1598 | + $html .= display_configuration_parameter($installType, get_lang('AdminEmail'), 'emailForm', $emailForm); |
|
1599 | 1599 | |
1600 | 1600 | //Parameter 6: administrator's telephone |
1601 | - $html .= display_configuration_parameter($installType, get_lang('AdminPhone'), 'adminPhoneForm', $adminPhoneForm); |
|
1601 | + $html .= display_configuration_parameter($installType, get_lang('AdminPhone'), 'adminPhoneForm', $adminPhoneForm); |
|
1602 | 1602 | |
1603 | 1603 | |
1604 | 1604 | echo panel($html, get_lang('Administrator'), 'administrator'); |
@@ -1617,12 +1617,12 @@ discard block |
||
1617 | 1617 | $html .= display_language_selection_box('languageForm', $languageForm); |
1618 | 1618 | $html .= '</div>'; |
1619 | 1619 | } |
1620 | - $html.= "</div>"; |
|
1620 | + $html .= "</div>"; |
|
1621 | 1621 | |
1622 | 1622 | |
1623 | 1623 | //Second parameter: Chamilo URL |
1624 | 1624 | $html .= '<div class="form-group">'; |
1625 | - $html .= '<label class="col-sm-6 control-label">'.get_lang('ChamiloURL') .get_lang('ThisFieldIsRequired').'</label>'; |
|
1625 | + $html .= '<label class="col-sm-6 control-label">'.get_lang('ChamiloURL').get_lang('ThisFieldIsRequired').'</label>'; |
|
1626 | 1626 | |
1627 | 1627 | |
1628 | 1628 | |
@@ -1646,34 +1646,34 @@ discard block |
||
1646 | 1646 | |
1647 | 1647 | |
1648 | 1648 | $html .= '<div class="form-group"> |
1649 | - <label class="col-sm-6 control-label">' . get_lang("EncryptMethodUserPass") . '</label> |
|
1649 | + <label class="col-sm-6 control-label">' . get_lang("EncryptMethodUserPass").'</label> |
|
1650 | 1650 | <div class="col-sm-6">'; |
1651 | 1651 | if ($installType == 'update') { |
1652 | - $html .= '<input type="hidden" name="encryptPassForm" value="'. $encryptPassForm .'" />'. $encryptPassForm; |
|
1652 | + $html .= '<input type="hidden" name="encryptPassForm" value="'.$encryptPassForm.'" />'.$encryptPassForm; |
|
1653 | 1653 | } else { |
1654 | 1654 | |
1655 | 1655 | $html .= '<div class="checkbox"> |
1656 | 1656 | <label> |
1657 | - <input type="radio" name="encryptPassForm" value="bcrypt" id="encryptPass1" '. ($encryptPassForm == 'bcrypt' ? 'checked="checked" ':'') .'/> bcrypt |
|
1657 | + <input type="radio" name="encryptPassForm" value="bcrypt" id="encryptPass1" '. ($encryptPassForm == 'bcrypt' ? 'checked="checked" ' : '').'/> bcrypt |
|
1658 | 1658 | </label>'; |
1659 | 1659 | |
1660 | 1660 | $html .= '<label> |
1661 | - <input type="radio" name="encryptPassForm" value="sha1" id="encryptPass1" '. ($encryptPassForm == 'sha1' ? 'checked="checked" ':'') .'/> sha1 |
|
1661 | + <input type="radio" name="encryptPassForm" value="sha1" id="encryptPass1" '. ($encryptPassForm == 'sha1' ? 'checked="checked" ' : '').'/> sha1 |
|
1662 | 1662 | </label>'; |
1663 | 1663 | |
1664 | 1664 | $html .= '<label> |
1665 | - <input type="radio" name="encryptPassForm" value="md5" id="encryptPass0" '. ($encryptPassForm == 'md5' ? 'checked="checked" ':'') .'/> md5 |
|
1665 | + <input type="radio" name="encryptPassForm" value="md5" id="encryptPass0" '. ($encryptPassForm == 'md5' ? 'checked="checked" ' : '').'/> md5 |
|
1666 | 1666 | </label>'; |
1667 | 1667 | |
1668 | 1668 | $html .= '<label> |
1669 | - <input type="radio" name="encryptPassForm" value="none" id="encryptPass2" '. ($encryptPassForm == 'none' ? 'checked="checked" ':'') .'/>'. get_lang('None').' |
|
1669 | + <input type="radio" name="encryptPassForm" value="none" id="encryptPass2" '. ($encryptPassForm == 'none' ? 'checked="checked" ' : '').'/>'.get_lang('None').' |
|
1670 | 1670 | </label>'; |
1671 | 1671 | $html .= '</div>'; |
1672 | 1672 | } |
1673 | 1673 | $html .= '</div></div>'; |
1674 | 1674 | |
1675 | 1675 | $html .= '<div class="form-group"> |
1676 | - <label class="col-sm-6 control-label">' . get_lang('AllowSelfReg') . '</label> |
|
1676 | + <label class="col-sm-6 control-label">' . get_lang('AllowSelfReg').'</label> |
|
1677 | 1677 | <div class="col-sm-6">'; |
1678 | 1678 | if ($installType == 'update') { |
1679 | 1679 | if ($allowSelfReg == 'true') { |
@@ -1683,17 +1683,17 @@ discard block |
||
1683 | 1683 | } else { |
1684 | 1684 | $label = get_lang('AfterApproval'); |
1685 | 1685 | } |
1686 | - $html .= '<input type="hidden" name="allowSelfReg" value="'. $allowSelfReg .'" />'. $label; |
|
1686 | + $html .= '<input type="hidden" name="allowSelfReg" value="'.$allowSelfReg.'" />'.$label; |
|
1687 | 1687 | } else { |
1688 | 1688 | $html .= '<div class="control-group">'; |
1689 | 1689 | $html .= '<label class="checkbox-inline"> |
1690 | - <input type="radio" name="allowSelfReg" value="true" id="allowSelfReg1" '. ($allowSelfReg == 'true' ? 'checked="checked" ' : '') . ' /> '. get_lang('Yes') .' |
|
1690 | + <input type="radio" name="allowSelfReg" value="true" id="allowSelfReg1" '. ($allowSelfReg == 'true' ? 'checked="checked" ' : '').' /> '.get_lang('Yes').' |
|
1691 | 1691 | </label>'; |
1692 | 1692 | $html .= '<label class="checkbox-inline"> |
1693 | - <input type="radio" name="allowSelfReg" value="false" id="allowSelfReg0" '. ($allowSelfReg == 'false' ? '' : 'checked="checked" ') .' /> '. get_lang('No') .' |
|
1693 | + <input type="radio" name="allowSelfReg" value="false" id="allowSelfReg0" '. ($allowSelfReg == 'false' ? '' : 'checked="checked" ').' /> '.get_lang('No').' |
|
1694 | 1694 | </label>'; |
1695 | 1695 | $html .= '<label class="checkbox-inline"> |
1696 | - <input type="radio" name="allowSelfReg" value="approval" id="allowSelfReg2" '. ($allowSelfReg == 'approval' ? '' : 'checked="checked" ') .' /> '. get_lang('AfterApproval') .' |
|
1696 | + <input type="radio" name="allowSelfReg" value="approval" id="allowSelfReg2" '. ($allowSelfReg == 'approval' ? '' : 'checked="checked" ').' /> '.get_lang('AfterApproval').' |
|
1697 | 1697 | </label>'; |
1698 | 1698 | $html .= '</div>'; |
1699 | 1699 | } |
@@ -1701,7 +1701,7 @@ discard block |
||
1701 | 1701 | $html .= '</div>'; |
1702 | 1702 | |
1703 | 1703 | $html .= '<div class="form-group">'; |
1704 | - $html .= '<label class="col-sm-6 control-label">'. get_lang('AllowSelfRegProf') .'</label> |
|
1704 | + $html .= '<label class="col-sm-6 control-label">'.get_lang('AllowSelfRegProf').'</label> |
|
1705 | 1705 | <div class="col-sm-6">'; |
1706 | 1706 | if ($installType == 'update') { |
1707 | 1707 | if ($allowSelfRegProf == 'true') { |
@@ -1709,16 +1709,16 @@ discard block |
||
1709 | 1709 | } else { |
1710 | 1710 | $label = get_lang('No'); |
1711 | 1711 | } |
1712 | - $html .= '<input type="hidden" name="allowSelfRegProf" value="'. $allowSelfRegProf.'" />'. $label; |
|
1712 | + $html .= '<input type="hidden" name="allowSelfRegProf" value="'.$allowSelfRegProf.'" />'.$label; |
|
1713 | 1713 | } else { |
1714 | 1714 | $html .= '<div class="control-group"> |
1715 | 1715 | <label class="checkbox-inline"> |
1716 | - <input type="radio" name="allowSelfRegProf" value="1" id="allowSelfRegProf1" '. ($allowSelfRegProf ? 'checked="checked" ' : '') .'/> |
|
1717 | - ' . get_lang('Yes') .' |
|
1716 | + <input type="radio" name="allowSelfRegProf" value="1" id="allowSelfRegProf1" '. ($allowSelfRegProf ? 'checked="checked" ' : '').'/> |
|
1717 | + ' . get_lang('Yes').' |
|
1718 | 1718 | </label>'; |
1719 | 1719 | $html .= '<label class="checkbox-inline"> |
1720 | - <input type="radio" name="allowSelfRegProf" value="0" id="allowSelfRegProf0" '. ($allowSelfRegProf ? '' : 'checked="checked" ') .' /> |
|
1721 | - '. get_lang('No') .' |
|
1720 | + <input type="radio" name="allowSelfRegProf" value="0" id="allowSelfRegProf0" '. ($allowSelfRegProf ? '' : 'checked="checked" ').' /> |
|
1721 | + '. get_lang('No').' |
|
1722 | 1722 | </label>'; |
1723 | 1723 | $html .= '</div>'; |
1724 | 1724 | } |
@@ -1783,7 +1783,7 @@ discard block |
||
1783 | 1783 | "Macedonia", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Mauritania", "Mauritius", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Morocco", "Mozambique", "Myanmar", |
1784 | 1784 | "Namibia", "Nauru", "Nepa", "Netherlands", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Norway", |
1785 | 1785 | "Oman", |
1786 | - "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland","Portugal", |
|
1786 | + "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland", "Portugal", |
|
1787 | 1787 | "Qatar", |
1788 | 1788 | "Romania", "Russia", "Rwanda", |
1789 | 1789 | "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia and Montenegro", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "Spain", "Sri Lanka", "Sudan", "Suriname", "Swaziland", "Sweden", "Switzerland", "Syria", |
@@ -1830,11 +1830,11 @@ discard block |
||
1830 | 1830 | $permissions_for_new_directories = isset($_SESSION['permissions_for_new_directories']) ? $_SESSION['permissions_for_new_directories'] : 0770; |
1831 | 1831 | $permissions_for_new_files = isset($_SESSION['permissions_for_new_files']) ? $_SESSION['permissions_for_new_files'] : 0660; |
1832 | 1832 | // use decoct() to store as string |
1833 | - $sql = "UPDATE $table SET selected_value = '0" . decoct($permissions_for_new_directories) . "' |
|
1833 | + $sql = "UPDATE $table SET selected_value = '0".decoct($permissions_for_new_directories)."' |
|
1834 | 1834 | WHERE variable = 'permissions_for_new_directories'"; |
1835 | 1835 | Database::query($sql); |
1836 | 1836 | |
1837 | - $sql = "UPDATE $table SET selected_value = '0" . decoct($permissions_for_new_files) . "' WHERE variable = 'permissions_for_new_files'"; |
|
1837 | + $sql = "UPDATE $table SET selected_value = '0".decoct($permissions_for_new_files)."' WHERE variable = 'permissions_for_new_files'"; |
|
1838 | 1838 | Database::query($sql); |
1839 | 1839 | |
1840 | 1840 | if (isset($_SESSION['permissions_for_new_directories'])) { |
@@ -1854,8 +1854,8 @@ discard block |
||
1854 | 1854 | function compare_setting_values($current_value, $wanted_value) |
1855 | 1855 | { |
1856 | 1856 | $current_value_string = $current_value; |
1857 | - $current_value = (float)$current_value; |
|
1858 | - $wanted_value = (float)$wanted_value; |
|
1857 | + $current_value = (float) $current_value; |
|
1858 | + $wanted_value = (float) $wanted_value; |
|
1859 | 1859 | |
1860 | 1860 | if ($current_value >= $wanted_value) { |
1861 | 1861 | return Display::label($current_value_string, 'success'); |
@@ -1918,7 +1918,7 @@ discard block |
||
1918 | 1918 | |
1919 | 1919 | fwrite($fp, $out); |
1920 | 1920 | while (!feof($fp)) { |
1921 | - $result = str_replace("\r\n", '',fgets($fp, 128)); |
|
1921 | + $result = str_replace("\r\n", '', fgets($fp, 128)); |
|
1922 | 1922 | if (!empty($result) && $result == '123') { |
1923 | 1923 | $output = true; |
1924 | 1924 | } |
@@ -1941,7 +1941,7 @@ discard block |
||
1941 | 1941 | curl_setopt($ch, CURLOPT_URL, $url); |
1942 | 1942 | //curl_setopt($ch, CURLOPT_TIMEOUT, 30); |
1943 | 1943 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
1944 | - $result = curl_exec ($ch); |
|
1944 | + $result = curl_exec($ch); |
|
1945 | 1945 | if (!empty($result) && $result == '123') { |
1946 | 1946 | $output = true; |
1947 | 1947 | } |
@@ -2714,12 +2714,12 @@ discard block |
||
2714 | 2714 | $adminPhoneForm, |
2715 | 2715 | '', //$picture_uri = '', |
2716 | 2716 | PLATFORM_AUTH_SOURCE, |
2717 | - '',//$expirationDate, |
|
2717 | + '', //$expirationDate, |
|
2718 | 2718 | 1, |
2719 | 2719 | 0, |
2720 | 2720 | null, |
2721 | 2721 | '', |
2722 | - false, //$send_mail = false, |
|
2722 | + false, //$send_mail = false, |
|
2723 | 2723 | true //$isAdmin = false |
2724 | 2724 | ); |
2725 | 2725 | |
@@ -2741,7 +2741,7 @@ discard block |
||
2741 | 2741 | 0, |
2742 | 2742 | null, |
2743 | 2743 | '', |
2744 | - false, //$send_mail = false, |
|
2744 | + false, //$send_mail = false, |
|
2745 | 2745 | false //$isAdmin = false |
2746 | 2746 | ); |
2747 | 2747 | |
@@ -2771,7 +2771,7 @@ discard block |
||
2771 | 2771 | $finder = new \Symfony\Component\Finder\Finder(); |
2772 | 2772 | $files = $finder->files()->in($path); |
2773 | 2773 | foreach ($files as $version) { |
2774 | - $version = str_replace(['Version', '.php' ], '', $version->getFilename()); |
|
2774 | + $version = str_replace(['Version', '.php'], '', $version->getFilename()); |
|
2775 | 2775 | $sql = "INSERT INTO version (version) VALUES ('$version')"; |
2776 | 2776 | Database::query($sql); |
2777 | 2777 | } |
@@ -2817,7 +2817,7 @@ discard block |
||
2817 | 2817 | SET selected_value = '".$param->selected_value."' |
2818 | 2818 | WHERE variable = '".$param->variable."'"; |
2819 | 2819 | if (!empty($param->subkey)) { |
2820 | - $sql .= " AND subkey='" . $param->subkey . "'"; |
|
2820 | + $sql .= " AND subkey='".$param->subkey."'"; |
|
2821 | 2821 | } |
2822 | 2822 | Database::query($sql); |
2823 | 2823 | } |
@@ -1713,7 +1713,7 @@ discard block |
||
1713 | 1713 | $html .= '<label class="checkbox-inline"> |
1714 | 1714 | <input type="radio" name="allowSelfReg" value="false" id="allowSelfReg0" '. ($allowSelfReg == 'false' ? '' : 'checked="checked" ') .' /> '. get_lang('No') .' |
1715 | 1715 | </label>'; |
1716 | - $html .= '<label class="checkbox-inline"> |
|
1716 | + $html .= '<label class="checkbox-inline"> |
|
1717 | 1717 | <input type="radio" name="allowSelfReg" value="approval" id="allowSelfReg2" '. ($allowSelfReg == 'approval' ? '' : 'checked="checked" ') .' /> '. get_lang('AfterApproval') .' |
1718 | 1718 | </label>'; |
1719 | 1719 | $html .= '</div>'; |
@@ -1747,7 +1747,7 @@ discard block |
||
1747 | 1747 | </div>'; |
1748 | 1748 | |
1749 | 1749 | echo panel($html, get_lang('Platform'), 'platform'); |
1750 | - ?> |
|
1750 | + ?> |
|
1751 | 1751 | <div class='form-group'> |
1752 | 1752 | <div class="col-sm-6"> |
1753 | 1753 | <button type="submit" class="btn btn-default pull-right" name="step3" value="< <?php echo get_lang('Previous'); ?>" ><em class="fa fa-backward"> </em> <?php echo get_lang('Previous'); ?></button> |
@@ -3068,10 +3068,10 @@ discard block |
||
3068 | 3068 | $sessionId = $row['session_id']; |
3069 | 3069 | $workId = $row['id']; |
3070 | 3070 | $itemInfo = api_get_item_property_info( |
3071 | - $courseId, |
|
3072 | - 'work', |
|
3073 | - $workId, |
|
3074 | - $sessionId |
|
3071 | + $courseId, |
|
3072 | + 'work', |
|
3073 | + $workId, |
|
3074 | + $sessionId |
|
3075 | 3075 | ); |
3076 | 3076 | $courseInfo = api_get_course_info_by_id($courseId); |
3077 | 3077 | if (empty($item_info)) { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | /** |
120 | 120 | * This function retrieves the existing permissions of a user, group or role. |
121 | -* @param $content are we retrieving the rights of a user, a group or a role (the database depends on it) |
|
121 | +* @param string $content are we retrieving the rights of a user, a group or a role (the database depends on it) |
|
122 | 122 | * @param $id the id of the user, group or role |
123 | 123 | * @author Patrick Cool <[email protected]>, Ghent University |
124 | 124 | * @version 1.0 |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | |
527 | 527 | /** |
528 | 528 | * This function gets all the roles that are defined |
529 | -* @param $content are we finding the roles for a user or a group (the database depends on it) |
|
529 | +* @param string $content are we finding the roles for a user or a group (the database depends on it) |
|
530 | 530 | * @param $id the id of the user or group |
531 | 531 | * @param string Deprecated parameter allowing use of 'platform' scope - the corresponding tables don't exist anymore so the scope is always set to 'course' |
532 | 532 | * @return array that contains the name of the roles the user has |
@@ -132,24 +132,20 @@ discard block |
||
132 | 132 | { |
133 | 133 | $table=Database::get_course_table(TABLE_PERMISSION_USER); |
134 | 134 | $id_field = 'user_id'; |
135 | - } |
|
136 | - elseif ($content == 'group') |
|
135 | + } elseif ($content == 'group') |
|
137 | 136 | { |
138 | 137 | $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
139 | 138 | $id_field = 'group_id'; |
140 | - } |
|
141 | - elseif ($content == 'role') |
|
139 | + } elseif ($content == 'role') |
|
142 | 140 | { |
143 | 141 | $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
144 | 142 | $id_field = 'role_id'; |
145 | - } |
|
146 | - elseif ($content == 'platform_role') |
|
143 | + } elseif ($content == 'platform_role') |
|
147 | 144 | { |
148 | 145 | $table=Database::get_main_table(TABLE_ROLE_PERMISSION); |
149 | 146 | $id_field = 'role_id'; |
150 | 147 | $course_id_condition = ''; |
151 | - } |
|
152 | - elseif ($content == 'task') |
|
148 | + } elseif ($content == 'task') |
|
153 | 149 | { |
154 | 150 | $table=Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
155 | 151 | $id_field = 'task_id'; |
@@ -162,8 +158,9 @@ discard block |
||
162 | 158 | WHERE $course_id_condition " . $id_field . "='" . Database::escape_string($id) . "'"; |
163 | 159 | $result = Database::query($sql); |
164 | 160 | |
165 | - while($row = Database::fetch_array($result)) |
|
166 | - $currentpermissions[$row['tool']][] = $row['action']; |
|
161 | + while($row = Database::fetch_array($result)) { |
|
162 | + $currentpermissions[$row['tool']][] = $row['action']; |
|
163 | + } |
|
167 | 164 | |
168 | 165 | return $currentpermissions; |
169 | 166 | } |
@@ -321,14 +318,12 @@ discard block |
||
321 | 318 | if ($course_admin) |
322 | 319 | { |
323 | 320 | echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
324 | - } |
|
325 | - else |
|
321 | + } else |
|
326 | 322 | { |
327 | 323 | if (!empty($inherited_permissions) and in_array($permission,$inherited_permissions[$tool])) |
328 | 324 | { |
329 | 325 | echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
330 | - } |
|
331 | - else |
|
326 | + } else |
|
332 | 327 | { |
333 | 328 | if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
334 | 329 | { |
@@ -439,8 +434,7 @@ discard block |
||
439 | 434 | $checked='checked'; |
440 | 435 | $image='checkbox_on2.gif'; |
441 | 436 | $action='revoke'; |
442 | - } |
|
443 | - else |
|
437 | + } else |
|
444 | 438 | { |
445 | 439 | $checked=''; |
446 | 440 | $image='wrong.gif'; |
@@ -25,38 +25,38 @@ discard block |
||
25 | 25 | function store_permissions($content, $id) { |
26 | 26 | $course_id = api_get_course_int_id(); |
27 | 27 | |
28 | - // Which database are we using (depending on the $content parameter) |
|
29 | - if ($content=='user') |
|
30 | - { |
|
31 | - $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
32 | - $id_field = user_id; |
|
33 | - } |
|
34 | - if ($content=='group') |
|
35 | - { |
|
36 | - $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
37 | - $id_field = group_id; |
|
38 | - } |
|
39 | - if ($content=='role') |
|
40 | - { |
|
41 | - $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
42 | - $id_field = role_id; |
|
43 | - } |
|
44 | - |
|
45 | - // We first delete all the existing permissions for that user/group/role |
|
46 | - $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."'"; |
|
47 | - $result=Database::query($sql); |
|
48 | - |
|
49 | - // looping through the post values to find the permission (containing the string permission* ) |
|
50 | - foreach ($_POST as $key => $value) |
|
51 | - { |
|
52 | - if (strstr($key,"permission*")) |
|
53 | - { |
|
54 | - list($brol,$tool,$action)=explode("*",$key); |
|
55 | - $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($action)."')"; |
|
56 | - $result=Database::query($sql); |
|
57 | - } |
|
58 | - } |
|
59 | - return get_lang('PermissionsStored'); |
|
28 | + // Which database are we using (depending on the $content parameter) |
|
29 | + if ($content=='user') |
|
30 | + { |
|
31 | + $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
32 | + $id_field = user_id; |
|
33 | + } |
|
34 | + if ($content=='group') |
|
35 | + { |
|
36 | + $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
37 | + $id_field = group_id; |
|
38 | + } |
|
39 | + if ($content=='role') |
|
40 | + { |
|
41 | + $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
42 | + $id_field = role_id; |
|
43 | + } |
|
44 | + |
|
45 | + // We first delete all the existing permissions for that user/group/role |
|
46 | + $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."'"; |
|
47 | + $result=Database::query($sql); |
|
48 | + |
|
49 | + // looping through the post values to find the permission (containing the string permission* ) |
|
50 | + foreach ($_POST as $key => $value) |
|
51 | + { |
|
52 | + if (strstr($key,"permission*")) |
|
53 | + { |
|
54 | + list($brol,$tool,$action)=explode("*",$key); |
|
55 | + $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($action)."')"; |
|
56 | + $result=Database::query($sql); |
|
57 | + } |
|
58 | + } |
|
59 | + return get_lang('PermissionsStored'); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -70,50 +70,50 @@ discard block |
||
70 | 70 | * @version 1.0 |
71 | 71 | */ |
72 | 72 | function store_one_permission($content, $action, $id, $tool,$permission) { |
73 | - global $rights_full; |
|
73 | + global $rights_full; |
|
74 | 74 | $course_id = api_get_course_int_id(); |
75 | - // for some reason I don't know, he can't get to the $rights_full array, so commented the following lines out. |
|
75 | + // for some reason I don't know, he can't get to the $rights_full array, so commented the following lines out. |
|
76 | 76 | |
77 | - // check |
|
78 | - //if(!in_array($permission, $rights_full)) |
|
79 | - //{ |
|
80 | - // return get_lang('Error'); |
|
81 | - //} |
|
77 | + // check |
|
78 | + //if(!in_array($permission, $rights_full)) |
|
79 | + //{ |
|
80 | + // return get_lang('Error'); |
|
81 | + //} |
|
82 | 82 | |
83 | - // Which database are we using (depending on the $content parameter) |
|
83 | + // Which database are we using (depending on the $content parameter) |
|
84 | 84 | |
85 | - if ($content=='user') { |
|
86 | - $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
87 | - $id_field = user_id; |
|
88 | - } |
|
89 | - if ($content=='group') |
|
90 | - { |
|
91 | - $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
92 | - $id_field = group_id; |
|
93 | - } |
|
94 | - if ($content=='role') |
|
95 | - { |
|
96 | - $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
97 | - $id_field = role_id; |
|
98 | - } |
|
99 | - |
|
100 | - // grating a right |
|
101 | - if ($action=='grant') { |
|
102 | - $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($permission)."')"; |
|
103 | - $result=Database::query($sql); |
|
104 | - if($result) { |
|
105 | - $result_message=get_lang('PermissionGranted'); |
|
106 | - } |
|
107 | - } |
|
108 | - if ($action=='revoke') |
|
109 | - { |
|
110 | - $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND tool='".Database::escape_string($tool)."' AND action='".Database::escape_string($permission)."'"; |
|
111 | - $result=Database::query($sql); |
|
112 | - if($result) { |
|
113 | - $result_message=get_lang('PermissionRevoked'); |
|
114 | - } |
|
115 | - } |
|
116 | - return $result_message; |
|
85 | + if ($content=='user') { |
|
86 | + $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
87 | + $id_field = user_id; |
|
88 | + } |
|
89 | + if ($content=='group') |
|
90 | + { |
|
91 | + $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
92 | + $id_field = group_id; |
|
93 | + } |
|
94 | + if ($content=='role') |
|
95 | + { |
|
96 | + $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
97 | + $id_field = role_id; |
|
98 | + } |
|
99 | + |
|
100 | + // grating a right |
|
101 | + if ($action=='grant') { |
|
102 | + $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($permission)."')"; |
|
103 | + $result=Database::query($sql); |
|
104 | + if($result) { |
|
105 | + $result_message=get_lang('PermissionGranted'); |
|
106 | + } |
|
107 | + } |
|
108 | + if ($action=='revoke') |
|
109 | + { |
|
110 | + $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND tool='".Database::escape_string($tool)."' AND action='".Database::escape_string($permission)."'"; |
|
111 | + $result=Database::query($sql); |
|
112 | + if($result) { |
|
113 | + $result_message=get_lang('PermissionRevoked'); |
|
114 | + } |
|
115 | + } |
|
116 | + return $result_message; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -125,47 +125,47 @@ discard block |
||
125 | 125 | */ |
126 | 126 | function get_permissions($content, $id) { |
127 | 127 | $course_id = api_get_course_int_id(); |
128 | - $currentpermissions=array(); |
|
129 | - // Which database are we using (depending on the $content parameter) |
|
128 | + $currentpermissions=array(); |
|
129 | + // Which database are we using (depending on the $content parameter) |
|
130 | 130 | $course_id_condition = " c_id = $course_id AND "; |
131 | - if ($content == 'user') |
|
132 | - { |
|
133 | - $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
134 | - $id_field = 'user_id'; |
|
135 | - } |
|
136 | - elseif ($content == 'group') |
|
137 | - { |
|
138 | - $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
139 | - $id_field = 'group_id'; |
|
140 | - } |
|
141 | - elseif ($content == 'role') |
|
142 | - { |
|
143 | - $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
144 | - $id_field = 'role_id'; |
|
145 | - } |
|
146 | - elseif ($content == 'platform_role') |
|
147 | - { |
|
148 | - $table=Database::get_main_table(TABLE_ROLE_PERMISSION); |
|
149 | - $id_field = 'role_id'; |
|
131 | + if ($content == 'user') |
|
132 | + { |
|
133 | + $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
134 | + $id_field = 'user_id'; |
|
135 | + } |
|
136 | + elseif ($content == 'group') |
|
137 | + { |
|
138 | + $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
139 | + $id_field = 'group_id'; |
|
140 | + } |
|
141 | + elseif ($content == 'role') |
|
142 | + { |
|
143 | + $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
144 | + $id_field = 'role_id'; |
|
145 | + } |
|
146 | + elseif ($content == 'platform_role') |
|
147 | + { |
|
148 | + $table=Database::get_main_table(TABLE_ROLE_PERMISSION); |
|
149 | + $id_field = 'role_id'; |
|
150 | 150 | $course_id_condition = ''; |
151 | - } |
|
152 | - elseif ($content == 'task') |
|
153 | - { |
|
154 | - $table=Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
|
155 | - $id_field = 'task_id'; |
|
156 | - } |
|
157 | - |
|
158 | - // finding all the permissions. We store this in a multidimensional array |
|
159 | - // where the first dimension is the tool. |
|
160 | - $sql=" |
|
151 | + } |
|
152 | + elseif ($content == 'task') |
|
153 | + { |
|
154 | + $table=Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
|
155 | + $id_field = 'task_id'; |
|
156 | + } |
|
157 | + |
|
158 | + // finding all the permissions. We store this in a multidimensional array |
|
159 | + // where the first dimension is the tool. |
|
160 | + $sql=" |
|
161 | 161 | SELECT * FROM " . $table . " |
162 | 162 | WHERE $course_id_condition " . $id_field . "='" . Database::escape_string($id) . "'"; |
163 | - $result = Database::query($sql); |
|
163 | + $result = Database::query($sql); |
|
164 | 164 | |
165 | - while($row = Database::fetch_array($result)) |
|
166 | - $currentpermissions[$row['tool']][] = $row['action']; |
|
165 | + while($row = Database::fetch_array($result)) |
|
166 | + $currentpermissions[$row['tool']][] = $row['action']; |
|
167 | 167 | |
168 | - return $currentpermissions; |
|
168 | + return $currentpermissions; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -179,38 +179,38 @@ discard block |
||
179 | 179 | */ |
180 | 180 | function limited_or_full($current_permissions) |
181 | 181 | { |
182 | - if (api_get_setting('permissions')=='limited') |
|
183 | - { |
|
184 | - foreach ($current_permissions as $tool=>$tool_rights) |
|
185 | - { |
|
186 | - // we loop through the possible permissions of a tool and unset the entry if it is view |
|
187 | - // if it is visibility or move we have to grant the edit right |
|
188 | - foreach ($tool_rights as $key=>$value) |
|
189 | - { |
|
190 | - if ($value=='View') |
|
191 | - { |
|
192 | - unset($current_permissions[$tool][$key]); |
|
193 | - } |
|
194 | - if ($value=='Visibility' OR $value=='Move') |
|
195 | - { |
|
196 | - if (!in_array('Edit',$current_permissions[$tool])) |
|
197 | - { |
|
198 | - $current_permissions[$tool][]='Edit'; |
|
199 | - } |
|
200 | - unset($current_permissions[$tool][$key]); |
|
201 | - } |
|
202 | - //else |
|
203 | - //{ |
|
204 | - // $current_permissions[$tool][]=$value; |
|
205 | - //} |
|
206 | - } |
|
207 | - } |
|
208 | - return $current_permissions; |
|
209 | - } |
|
210 | - if (api_get_setting('permissions')=='full') |
|
211 | - { |
|
212 | - return $current_permissions; |
|
213 | - } |
|
182 | + if (api_get_setting('permissions')=='limited') |
|
183 | + { |
|
184 | + foreach ($current_permissions as $tool=>$tool_rights) |
|
185 | + { |
|
186 | + // we loop through the possible permissions of a tool and unset the entry if it is view |
|
187 | + // if it is visibility or move we have to grant the edit right |
|
188 | + foreach ($tool_rights as $key=>$value) |
|
189 | + { |
|
190 | + if ($value=='View') |
|
191 | + { |
|
192 | + unset($current_permissions[$tool][$key]); |
|
193 | + } |
|
194 | + if ($value=='Visibility' OR $value=='Move') |
|
195 | + { |
|
196 | + if (!in_array('Edit',$current_permissions[$tool])) |
|
197 | + { |
|
198 | + $current_permissions[$tool][]='Edit'; |
|
199 | + } |
|
200 | + unset($current_permissions[$tool][$key]); |
|
201 | + } |
|
202 | + //else |
|
203 | + //{ |
|
204 | + // $current_permissions[$tool][]=$value; |
|
205 | + //} |
|
206 | + } |
|
207 | + } |
|
208 | + return $current_permissions; |
|
209 | + } |
|
210 | + if (api_get_setting('permissions')=='full') |
|
211 | + { |
|
212 | + return $current_permissions; |
|
213 | + } |
|
214 | 214 | } |
215 | 215 | /** |
216 | 216 | * This function displays a checked or unchecked checkbox. The checkbox will be checked if the |
@@ -224,12 +224,12 @@ discard block |
||
224 | 224 | */ |
225 | 225 | function display_checkbox_matrix($permission_array, $tool, $permission, $inherited_permissions=array()) |
226 | 226 | { |
227 | - $checked=""; |
|
228 | - if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
|
229 | - { |
|
230 | - $checked="checked"; |
|
231 | - } |
|
232 | - echo "\t\t\t<input type=\"checkbox\" name=\"permission*$tool*$permission\" $checked>\n"; |
|
227 | + $checked=""; |
|
228 | + if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
|
229 | + { |
|
230 | + $checked="checked"; |
|
231 | + } |
|
232 | + echo "\t\t\t<input type=\"checkbox\" name=\"permission*$tool*$permission\" $checked>\n"; |
|
233 | 233 | |
234 | 234 | } |
235 | 235 | |
@@ -245,62 +245,62 @@ discard block |
||
245 | 245 | */ |
246 | 246 | function display_image_matrix($permission_array, $tool, $permission,$inherited_permissions=array(), $course_admin=false, $editable=true) |
247 | 247 | { |
248 | - if ($course_admin) { |
|
249 | - echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
250 | - } else { |
|
251 | - if (in_array($permission,$inherited_permissions[$tool])) { |
|
252 | - echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
253 | - } else { |
|
254 | - if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) { |
|
255 | - if ($editable) { |
|
256 | - $url=api_get_self(); |
|
257 | - $urlparameters = ''; |
|
258 | - foreach($_GET as $key=>$value) { |
|
259 | - $parameter[$key]=$value; |
|
260 | - } |
|
261 | - $parameter['action']='revoke'; |
|
262 | - $parameter['permission']=$permission; |
|
263 | - $parameter['tool']=$tool; |
|
264 | - foreach ($parameter as $key=>$value) { |
|
265 | - $urlparameters.=$key.'='.$value.'&'; |
|
266 | - } |
|
267 | - $url=$url.'?'.$urlparameters; |
|
268 | - |
|
269 | - echo "\t\t\t <a href=\"".$url."\">"; |
|
270 | - } |
|
271 | - echo "<img src=\"../img/checkbox_on2.gif\" border=\"0\"/>"; |
|
272 | - if ($editable) { |
|
273 | - echo "</a>"; |
|
274 | - } |
|
275 | - } else { |
|
276 | - if ($editable) |
|
277 | - { |
|
278 | - $url=api_get_self(); |
|
279 | - $urlparameters = ''; |
|
280 | - foreach ($_GET as $key=>$value) |
|
281 | - { |
|
282 | - $parameter[$key]=$value; |
|
283 | - } |
|
284 | - $parameter['action']='grant'; |
|
285 | - $parameter['permission']=$permission; |
|
286 | - $parameter['tool']=$tool; |
|
287 | - foreach ($parameter as $key=>$value) |
|
288 | - { |
|
289 | - $urlparameters.=$key.'='.$value.'&'; |
|
290 | - } |
|
291 | - $url=$url.'?'.$urlparameters; |
|
292 | - |
|
293 | - //echo "\t\t\t <a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=grant&permission=$permission&tool=$tool\">"; |
|
294 | - echo "\t\t\t <a href=\"".$url."\">"; |
|
295 | - } |
|
296 | - echo "<img src=\"../img/wrong.gif\" border=\"0\"/>"; |
|
297 | - if ($editable) |
|
298 | - { |
|
299 | - echo "</a>"; |
|
300 | - } |
|
301 | - } |
|
302 | - } |
|
303 | - } |
|
248 | + if ($course_admin) { |
|
249 | + echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
250 | + } else { |
|
251 | + if (in_array($permission,$inherited_permissions[$tool])) { |
|
252 | + echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
253 | + } else { |
|
254 | + if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) { |
|
255 | + if ($editable) { |
|
256 | + $url=api_get_self(); |
|
257 | + $urlparameters = ''; |
|
258 | + foreach($_GET as $key=>$value) { |
|
259 | + $parameter[$key]=$value; |
|
260 | + } |
|
261 | + $parameter['action']='revoke'; |
|
262 | + $parameter['permission']=$permission; |
|
263 | + $parameter['tool']=$tool; |
|
264 | + foreach ($parameter as $key=>$value) { |
|
265 | + $urlparameters.=$key.'='.$value.'&'; |
|
266 | + } |
|
267 | + $url=$url.'?'.$urlparameters; |
|
268 | + |
|
269 | + echo "\t\t\t <a href=\"".$url."\">"; |
|
270 | + } |
|
271 | + echo "<img src=\"../img/checkbox_on2.gif\" border=\"0\"/>"; |
|
272 | + if ($editable) { |
|
273 | + echo "</a>"; |
|
274 | + } |
|
275 | + } else { |
|
276 | + if ($editable) |
|
277 | + { |
|
278 | + $url=api_get_self(); |
|
279 | + $urlparameters = ''; |
|
280 | + foreach ($_GET as $key=>$value) |
|
281 | + { |
|
282 | + $parameter[$key]=$value; |
|
283 | + } |
|
284 | + $parameter['action']='grant'; |
|
285 | + $parameter['permission']=$permission; |
|
286 | + $parameter['tool']=$tool; |
|
287 | + foreach ($parameter as $key=>$value) |
|
288 | + { |
|
289 | + $urlparameters.=$key.'='.$value.'&'; |
|
290 | + } |
|
291 | + $url=$url.'?'.$urlparameters; |
|
292 | + |
|
293 | + //echo "\t\t\t <a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=grant&permission=$permission&tool=$tool\">"; |
|
294 | + echo "\t\t\t <a href=\"".$url."\">"; |
|
295 | + } |
|
296 | + echo "<img src=\"../img/wrong.gif\" border=\"0\"/>"; |
|
297 | + if ($editable) |
|
298 | + { |
|
299 | + echo "</a>"; |
|
300 | + } |
|
301 | + } |
|
302 | + } |
|
303 | + } |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | |
@@ -318,72 +318,72 @@ discard block |
||
318 | 318 | function display_image_matrix_for_blogs($permission_array, $user_id, $tool, $permission,$inherited_permissions=array(), $course_admin=false, $editable=true) |
319 | 319 | { |
320 | 320 | |
321 | - if ($course_admin) |
|
322 | - { |
|
323 | - echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
324 | - } |
|
325 | - else |
|
326 | - { |
|
327 | - if (!empty($inherited_permissions) and in_array($permission,$inherited_permissions[$tool])) |
|
328 | - { |
|
329 | - echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
330 | - } |
|
331 | - else |
|
332 | - { |
|
333 | - if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
|
334 | - { |
|
335 | - if ($editable) |
|
336 | - { |
|
337 | - $url = api_get_self(); |
|
338 | - $urlparameters = ''; |
|
339 | - foreach($_GET as $key => $value) |
|
340 | - { |
|
341 | - $parameter[$key] = $value; |
|
342 | - } |
|
343 | - $parameter['action']='manage_rights'; |
|
344 | - $parameter['do']='revoke'; |
|
345 | - $parameter['permission']=$permission; |
|
346 | - $parameter['tool']=$tool; |
|
347 | - $parameter['user_id']=$user_id; |
|
348 | - foreach ($parameter as $key=>$value) |
|
349 | - { |
|
350 | - $urlparameters .= $key . '=' . $value . '&'; |
|
351 | - } |
|
352 | - $url = $url . '?' . $urlparameters; |
|
353 | - |
|
354 | - echo "\t\t\t <a href=\"".$url."\">"; |
|
355 | - } |
|
356 | - echo "<img src=\"../img/checkbox_on2.gif\" border=\"0\"/ title=\"".get_lang('UserHasPermission')."\">"; |
|
357 | - if ($editable) { |
|
358 | - echo "</a>"; |
|
359 | - } |
|
360 | - } else { |
|
361 | - if ($editable) { |
|
362 | - $url = api_get_self(); |
|
363 | - $urlparameters = ''; |
|
364 | - foreach ($_GET as $key=>$value) { |
|
365 | - $parameter[$key]=$value; |
|
366 | - } |
|
367 | - $parameter['action']='manage_rights'; |
|
368 | - $parameter['do']='grant'; |
|
369 | - $parameter['permission']=$permission; |
|
370 | - $parameter['tool']=$tool; |
|
371 | - $parameter['user_id']=$user_id; |
|
372 | - foreach ($parameter as $key=>$value) { |
|
373 | - $urlparameters .= $key . '=' . $value . '&'; |
|
374 | - } |
|
375 | - $url=$url.'?'.$urlparameters; |
|
376 | - |
|
377 | - //echo "\t\t\t <a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=grant&permission=$permission&tool=$tool\">"; |
|
378 | - echo "\t\t\t <a href=\"".$url."\">"; |
|
379 | - } |
|
380 | - echo "<img src=\"../img/wrong.gif\" border=\"0\"/ title=\"".get_lang('UserHasPermissionNot')."\">"; |
|
381 | - if ($editable) { |
|
382 | - echo "</a>"; |
|
383 | - } |
|
384 | - } |
|
385 | - } |
|
386 | - } |
|
321 | + if ($course_admin) |
|
322 | + { |
|
323 | + echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
324 | + } |
|
325 | + else |
|
326 | + { |
|
327 | + if (!empty($inherited_permissions) and in_array($permission,$inherited_permissions[$tool])) |
|
328 | + { |
|
329 | + echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
330 | + } |
|
331 | + else |
|
332 | + { |
|
333 | + if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
|
334 | + { |
|
335 | + if ($editable) |
|
336 | + { |
|
337 | + $url = api_get_self(); |
|
338 | + $urlparameters = ''; |
|
339 | + foreach($_GET as $key => $value) |
|
340 | + { |
|
341 | + $parameter[$key] = $value; |
|
342 | + } |
|
343 | + $parameter['action']='manage_rights'; |
|
344 | + $parameter['do']='revoke'; |
|
345 | + $parameter['permission']=$permission; |
|
346 | + $parameter['tool']=$tool; |
|
347 | + $parameter['user_id']=$user_id; |
|
348 | + foreach ($parameter as $key=>$value) |
|
349 | + { |
|
350 | + $urlparameters .= $key . '=' . $value . '&'; |
|
351 | + } |
|
352 | + $url = $url . '?' . $urlparameters; |
|
353 | + |
|
354 | + echo "\t\t\t <a href=\"".$url."\">"; |
|
355 | + } |
|
356 | + echo "<img src=\"../img/checkbox_on2.gif\" border=\"0\"/ title=\"".get_lang('UserHasPermission')."\">"; |
|
357 | + if ($editable) { |
|
358 | + echo "</a>"; |
|
359 | + } |
|
360 | + } else { |
|
361 | + if ($editable) { |
|
362 | + $url = api_get_self(); |
|
363 | + $urlparameters = ''; |
|
364 | + foreach ($_GET as $key=>$value) { |
|
365 | + $parameter[$key]=$value; |
|
366 | + } |
|
367 | + $parameter['action']='manage_rights'; |
|
368 | + $parameter['do']='grant'; |
|
369 | + $parameter['permission']=$permission; |
|
370 | + $parameter['tool']=$tool; |
|
371 | + $parameter['user_id']=$user_id; |
|
372 | + foreach ($parameter as $key=>$value) { |
|
373 | + $urlparameters .= $key . '=' . $value . '&'; |
|
374 | + } |
|
375 | + $url=$url.'?'.$urlparameters; |
|
376 | + |
|
377 | + //echo "\t\t\t <a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=grant&permission=$permission&tool=$tool\">"; |
|
378 | + echo "\t\t\t <a href=\"".$url."\">"; |
|
379 | + } |
|
380 | + echo "<img src=\"../img/wrong.gif\" border=\"0\"/ title=\"".get_lang('UserHasPermissionNot')."\">"; |
|
381 | + if ($editable) { |
|
382 | + echo "</a>"; |
|
383 | + } |
|
384 | + } |
|
385 | + } |
|
386 | + } |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | |
@@ -394,41 +394,41 @@ discard block |
||
394 | 394 | */ |
395 | 395 | function display_role_list($current_course_roles, $current_platform_roles) |
396 | 396 | { |
397 | - global $setting_visualisation; |
|
397 | + global $setting_visualisation; |
|
398 | 398 | $course_id = api_get_course_int_id(); |
399 | 399 | |
400 | - $coures_roles_table=Database::get_course_table(TABLE_ROLE); |
|
401 | - |
|
402 | - // course roles |
|
403 | - $sql="SELECT * FROM $coures_roles_table WHERE c_id = $course_id "; |
|
404 | - $result=Database::query($sql); |
|
405 | - while ($row=Database::fetch_array($result)) |
|
406 | - { |
|
407 | - if (in_array($row['role_id'], $current_course_roles)) |
|
408 | - { |
|
409 | - $checked='checked'; |
|
410 | - $image='checkbox_on2.gif'; |
|
411 | - $action='revoke'; |
|
412 | - } |
|
413 | - else |
|
414 | - { |
|
415 | - $checked=''; |
|
416 | - $image='wrong.gif'; |
|
417 | - $action='grant'; |
|
418 | - } |
|
419 | - if ($setting_visualisation=='checkbox') |
|
420 | - { |
|
421 | - echo "<input type=\"checkbox\" name=\"role*course*".$row['role_id']."\" $checked>"; |
|
422 | - } |
|
423 | - if ($setting_visualisation=='image') |
|
424 | - { |
|
425 | - echo "<a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=$action&role=".$row['role_id']."&scope=course\"><img src=\"../img/".$image."\" border=\"0\"/></a>"; |
|
426 | - } |
|
427 | - |
|
428 | - |
|
429 | - echo $row['role_name']." <a href=\"../permissions/roles.php?role_id=".$row['role_id']."&scope=course\"><img src=\"../img/edit.gif\" /></a><br />\n"; |
|
430 | - echo $row['role_comment']."<br />\n"; |
|
431 | - } |
|
400 | + $coures_roles_table=Database::get_course_table(TABLE_ROLE); |
|
401 | + |
|
402 | + // course roles |
|
403 | + $sql="SELECT * FROM $coures_roles_table WHERE c_id = $course_id "; |
|
404 | + $result=Database::query($sql); |
|
405 | + while ($row=Database::fetch_array($result)) |
|
406 | + { |
|
407 | + if (in_array($row['role_id'], $current_course_roles)) |
|
408 | + { |
|
409 | + $checked='checked'; |
|
410 | + $image='checkbox_on2.gif'; |
|
411 | + $action='revoke'; |
|
412 | + } |
|
413 | + else |
|
414 | + { |
|
415 | + $checked=''; |
|
416 | + $image='wrong.gif'; |
|
417 | + $action='grant'; |
|
418 | + } |
|
419 | + if ($setting_visualisation=='checkbox') |
|
420 | + { |
|
421 | + echo "<input type=\"checkbox\" name=\"role*course*".$row['role_id']."\" $checked>"; |
|
422 | + } |
|
423 | + if ($setting_visualisation=='image') |
|
424 | + { |
|
425 | + echo "<a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=$action&role=".$row['role_id']."&scope=course\"><img src=\"../img/".$image."\" border=\"0\"/></a>"; |
|
426 | + } |
|
427 | + |
|
428 | + |
|
429 | + echo $row['role_name']." <a href=\"../permissions/roles.php?role_id=".$row['role_id']."&scope=course\"><img src=\"../img/edit.gif\" /></a><br />\n"; |
|
430 | + echo $row['role_comment']."<br />\n"; |
|
431 | + } |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | /** |
@@ -442,24 +442,24 @@ discard block |
||
442 | 442 | */ |
443 | 443 | function get_roles($content,$id, $scope='course') { |
444 | 444 | $course_id = api_get_course_int_id(); |
445 | - if ($content=='user') { |
|
446 | - $table=Database::get_course_table(TABLE_ROLE_USER); |
|
447 | - $id_field = user_id; |
|
448 | - } |
|
449 | - if ($content=='group') { |
|
450 | - $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
451 | - $id_field = 'group_id'; |
|
452 | - } |
|
453 | - $table_role=Database::get_course_table(TABLE_ROLE); |
|
454 | - |
|
455 | - $current_roles=array(); |
|
456 | - //$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'";$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'"; |
|
457 | - $sql="SELECT role_id FROM $table WHERE c_id = $course_id AND $id_field = '$id' AND scope='".$scope."'"; |
|
458 | - $result=Database::query($sql); |
|
459 | - while ($row=Database::fetch_array($result)) { |
|
460 | - $current_roles[]=$row['role_id']; |
|
461 | - } |
|
462 | - return $current_roles; |
|
445 | + if ($content=='user') { |
|
446 | + $table=Database::get_course_table(TABLE_ROLE_USER); |
|
447 | + $id_field = user_id; |
|
448 | + } |
|
449 | + if ($content=='group') { |
|
450 | + $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
451 | + $id_field = 'group_id'; |
|
452 | + } |
|
453 | + $table_role=Database::get_course_table(TABLE_ROLE); |
|
454 | + |
|
455 | + $current_roles=array(); |
|
456 | + //$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'";$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'"; |
|
457 | + $sql="SELECT role_id FROM $table WHERE c_id = $course_id AND $id_field = '$id' AND scope='".$scope."'"; |
|
458 | + $result=Database::query($sql); |
|
459 | + while ($row=Database::fetch_array($result)) { |
|
460 | + $current_roles[]=$row['role_id']; |
|
461 | + } |
|
462 | + return $current_roles; |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | /** |
@@ -472,25 +472,25 @@ discard block |
||
472 | 472 | $course_id = api_get_course_int_id(); |
473 | 473 | $course_id_condition = " WHERE c_id = $course_id "; |
474 | 474 | |
475 | - if ($content=='course') |
|
476 | - { |
|
477 | - $table_role=Database::get_course_table(TABLE_ROLE); |
|
478 | - } |
|
479 | - if ($content=='platform') |
|
480 | - { |
|
481 | - $table_role=Database::get_main_table(TABLE_ROLE); |
|
482 | - $course_id_condition = ''; |
|
483 | - } |
|
484 | - |
|
485 | - $current_roles=array(); |
|
486 | - $sql="SELECT * FROM $table_role $course_id_condition "; |
|
487 | - $result=Database::query($sql); |
|
488 | - while ($row=Database::fetch_array($result)) |
|
489 | - { |
|
490 | - $roles[]=$row; |
|
491 | - } |
|
492 | - |
|
493 | - return $roles; |
|
475 | + if ($content=='course') |
|
476 | + { |
|
477 | + $table_role=Database::get_course_table(TABLE_ROLE); |
|
478 | + } |
|
479 | + if ($content=='platform') |
|
480 | + { |
|
481 | + $table_role=Database::get_main_table(TABLE_ROLE); |
|
482 | + $course_id_condition = ''; |
|
483 | + } |
|
484 | + |
|
485 | + $current_roles=array(); |
|
486 | + $sql="SELECT * FROM $table_role $course_id_condition "; |
|
487 | + $result=Database::query($sql); |
|
488 | + while ($row=Database::fetch_array($result)) |
|
489 | + { |
|
490 | + $roles[]=$row; |
|
491 | + } |
|
492 | + |
|
493 | + return $roles; |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | |
@@ -506,34 +506,34 @@ discard block |
||
506 | 506 | */ |
507 | 507 | function get_roles_permissions($content,$id, $scope='course') { |
508 | 508 | $course_id = api_get_course_int_id(); |
509 | - if ($content == 'user') { |
|
510 | - $table=Database::get_course_table(TABLE_ROLE_USER); |
|
511 | - $id_field = 'user_id'; |
|
512 | - } |
|
513 | - |
|
514 | - if ($content == 'group') { |
|
515 | - $table = Database::get_course_table(TABLE_ROLE_GROUP); |
|
516 | - $id_field = 'group_id'; |
|
517 | - } |
|
518 | - |
|
519 | - // course roles or platform roles |
|
520 | - $scope = 'course'; |
|
521 | - if ($scope == 'course') { |
|
522 | - $table_role = Database::get_course_table(TABLE_ROLE); |
|
523 | - $table_role_permissions = Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
509 | + if ($content == 'user') { |
|
510 | + $table=Database::get_course_table(TABLE_ROLE_USER); |
|
511 | + $id_field = 'user_id'; |
|
512 | + } |
|
513 | + |
|
514 | + if ($content == 'group') { |
|
515 | + $table = Database::get_course_table(TABLE_ROLE_GROUP); |
|
516 | + $id_field = 'group_id'; |
|
517 | + } |
|
518 | + |
|
519 | + // course roles or platform roles |
|
520 | + $scope = 'course'; |
|
521 | + if ($scope == 'course') { |
|
522 | + $table_role = Database::get_course_table(TABLE_ROLE); |
|
523 | + $table_role_permissions = Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
524 | 524 | |
525 | 525 | $role_condition = " role.c_id = $course_id AND role_permissions.c_id = $course_id AND "; |
526 | - } |
|
526 | + } |
|
527 | 527 | |
528 | - if ($scope == 'platform') { |
|
529 | - $table_role = Database::get_main_table(TABLE_ROLE); |
|
530 | - $table_role_permissions = Database::get_main_table(TABLE_ROLE_PERMISSION); |
|
528 | + if ($scope == 'platform') { |
|
529 | + $table_role = Database::get_main_table(TABLE_ROLE); |
|
530 | + $table_role_permissions = Database::get_main_table(TABLE_ROLE_PERMISSION); |
|
531 | 531 | $role_condition = ''; |
532 | - } |
|
532 | + } |
|
533 | 533 | |
534 | - $current_roles = array(); |
|
534 | + $current_roles = array(); |
|
535 | 535 | |
536 | - $sql = " |
|
536 | + $sql = " |
|
537 | 537 | SELECT * |
538 | 538 | FROM |
539 | 539 | " . $table . " role_group_user, |
@@ -547,12 +547,12 @@ discard block |
||
547 | 547 | role_group_user.role_id = role.role_id AND |
548 | 548 | role.role_id = role_permissions.role_id"; |
549 | 549 | |
550 | - $result = Database::query($sql); |
|
550 | + $result = Database::query($sql); |
|
551 | 551 | $current_role_permissions = array(); |
552 | - while ($row=Database::fetch_array($result)) { |
|
553 | - $current_role_permissions[$row['tool']][]=$row['action']; |
|
552 | + while ($row=Database::fetch_array($result)) { |
|
553 | + $current_role_permissions[$row['tool']][]=$row['action']; |
|
554 | 554 | } |
555 | - return $current_role_permissions; |
|
555 | + return $current_role_permissions; |
|
556 | 556 | } |
557 | 557 | |
558 | 558 | /** |
@@ -566,34 +566,34 @@ discard block |
||
566 | 566 | |
567 | 567 | function assign_role($content, $action, $id, $role_id, $scope='course') { |
568 | 568 | $course_id = api_get_course_int_id(); |
569 | - // Which database are we using (depending on the $content parameter) |
|
570 | - if ($content=='user') { |
|
571 | - $table=Database::get_course_table(TABLE_ROLE_USER); |
|
572 | - $id_field = 'user_id'; |
|
573 | - } elseif($content=='group') { |
|
574 | - $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
575 | - $id_field = 'group_id'; |
|
576 | - } else { |
|
577 | - return get_lang('Error'); |
|
578 | - } |
|
579 | - |
|
580 | - // grating a right |
|
581 | - if ($action=='grant') { |
|
582 | - $sql="INSERT INTO $table (c_id, role_id, scope, $id_field) VALUES ($course_id, '".Database::escape_string($role_id)."','".Database::escape_string($scope)."','".Database::escape_string($id)."')"; |
|
583 | - $result=Database::query($sql); |
|
584 | - if ($result) { |
|
585 | - $result_message=get_lang('RoleGranted'); |
|
586 | - } |
|
587 | - } |
|
569 | + // Which database are we using (depending on the $content parameter) |
|
570 | + if ($content=='user') { |
|
571 | + $table=Database::get_course_table(TABLE_ROLE_USER); |
|
572 | + $id_field = 'user_id'; |
|
573 | + } elseif($content=='group') { |
|
574 | + $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
575 | + $id_field = 'group_id'; |
|
576 | + } else { |
|
577 | + return get_lang('Error'); |
|
578 | + } |
|
579 | + |
|
580 | + // grating a right |
|
581 | + if ($action=='grant') { |
|
582 | + $sql="INSERT INTO $table (c_id, role_id, scope, $id_field) VALUES ($course_id, '".Database::escape_string($role_id)."','".Database::escape_string($scope)."','".Database::escape_string($id)."')"; |
|
583 | + $result=Database::query($sql); |
|
584 | + if ($result) { |
|
585 | + $result_message=get_lang('RoleGranted'); |
|
586 | + } |
|
587 | + } |
|
588 | 588 | |
589 | - if ($action=='revoke') { |
|
590 | - $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND role_id='".Database::escape_string($role_id)."'"; |
|
591 | - $result=Database::query($sql); |
|
592 | - if ($result) { |
|
593 | - $result_message=get_lang('RoleRevoked'); |
|
594 | - } |
|
595 | - } |
|
596 | - return $result_message; |
|
589 | + if ($action=='revoke') { |
|
590 | + $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND role_id='".Database::escape_string($role_id)."'"; |
|
591 | + $result=Database::query($sql); |
|
592 | + if ($result) { |
|
593 | + $result_message=get_lang('RoleRevoked'); |
|
594 | + } |
|
595 | + } |
|
596 | + return $result_message; |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | |
@@ -603,21 +603,21 @@ discard block |
||
603 | 603 | */ |
604 | 604 | function permission_array_merge($array1, $array2) |
605 | 605 | { |
606 | - foreach ($array2 as $tool=>$permissions) |
|
607 | - { |
|
608 | - foreach ($permissions as $permissionkey=>$permissionvalue) |
|
609 | - { |
|
610 | - $array1[$tool][]=$permissionvalue; |
|
611 | - } |
|
612 | - } |
|
613 | - return $array1; |
|
606 | + foreach ($array2 as $tool=>$permissions) |
|
607 | + { |
|
608 | + foreach ($permissions as $permissionkey=>$permissionvalue) |
|
609 | + { |
|
610 | + $array1[$tool][]=$permissionvalue; |
|
611 | + } |
|
612 | + } |
|
613 | + return $array1; |
|
614 | 614 | } |
615 | 615 | |
616 | 616 | |
617 | 617 | function my_print_r($array) |
618 | 618 | { |
619 | - echo '<pre>'; |
|
620 | - print_r($array); |
|
621 | - echo '</pre>'; |
|
619 | + echo '<pre>'; |
|
620 | + print_r($array); |
|
621 | + echo '</pre>'; |
|
622 | 622 | } |
623 | 623 | ?> |
@@ -26,34 +26,34 @@ discard block |
||
26 | 26 | $course_id = api_get_course_int_id(); |
27 | 27 | |
28 | 28 | // Which database are we using (depending on the $content parameter) |
29 | - if ($content=='user') |
|
29 | + if ($content == 'user') |
|
30 | 30 | { |
31 | - $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
31 | + $table = Database::get_course_table(TABLE_PERMISSION_USER); |
|
32 | 32 | $id_field = user_id; |
33 | 33 | } |
34 | - if ($content=='group') |
|
34 | + if ($content == 'group') |
|
35 | 35 | { |
36 | - $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
36 | + $table = Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
37 | 37 | $id_field = group_id; |
38 | 38 | } |
39 | - if ($content=='role') |
|
39 | + if ($content == 'role') |
|
40 | 40 | { |
41 | - $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
41 | + $table = Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
42 | 42 | $id_field = role_id; |
43 | 43 | } |
44 | 44 | |
45 | 45 | // We first delete all the existing permissions for that user/group/role |
46 | - $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."'"; |
|
47 | - $result=Database::query($sql); |
|
46 | + $sql = "DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."'"; |
|
47 | + $result = Database::query($sql); |
|
48 | 48 | |
49 | 49 | // looping through the post values to find the permission (containing the string permission* ) |
50 | 50 | foreach ($_POST as $key => $value) |
51 | 51 | { |
52 | - if (strstr($key,"permission*")) |
|
52 | + if (strstr($key, "permission*")) |
|
53 | 53 | { |
54 | - list($brol,$tool,$action)=explode("*",$key); |
|
55 | - $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($action)."')"; |
|
56 | - $result=Database::query($sql); |
|
54 | + list($brol, $tool, $action) = explode("*", $key); |
|
55 | + $sql = "INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($action)."')"; |
|
56 | + $result = Database::query($sql); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | return get_lang('PermissionsStored'); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @author Patrick Cool <[email protected]>, Ghent University |
70 | 70 | * @version 1.0 |
71 | 71 | */ |
72 | -function store_one_permission($content, $action, $id, $tool,$permission) { |
|
72 | +function store_one_permission($content, $action, $id, $tool, $permission) { |
|
73 | 73 | global $rights_full; |
74 | 74 | $course_id = api_get_course_int_id(); |
75 | 75 | // for some reason I don't know, he can't get to the $rights_full array, so commented the following lines out. |
@@ -82,35 +82,35 @@ discard block |
||
82 | 82 | |
83 | 83 | // Which database are we using (depending on the $content parameter) |
84 | 84 | |
85 | - if ($content=='user') { |
|
86 | - $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
85 | + if ($content == 'user') { |
|
86 | + $table = Database::get_course_table(TABLE_PERMISSION_USER); |
|
87 | 87 | $id_field = user_id; |
88 | 88 | } |
89 | - if ($content=='group') |
|
89 | + if ($content == 'group') |
|
90 | 90 | { |
91 | - $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
91 | + $table = Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
92 | 92 | $id_field = group_id; |
93 | 93 | } |
94 | - if ($content=='role') |
|
94 | + if ($content == 'role') |
|
95 | 95 | { |
96 | - $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
96 | + $table = Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
97 | 97 | $id_field = role_id; |
98 | 98 | } |
99 | 99 | |
100 | 100 | // grating a right |
101 | - if ($action=='grant') { |
|
102 | - $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($permission)."')"; |
|
103 | - $result=Database::query($sql); |
|
104 | - if($result) { |
|
105 | - $result_message=get_lang('PermissionGranted'); |
|
101 | + if ($action == 'grant') { |
|
102 | + $sql = "INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($permission)."')"; |
|
103 | + $result = Database::query($sql); |
|
104 | + if ($result) { |
|
105 | + $result_message = get_lang('PermissionGranted'); |
|
106 | 106 | } |
107 | 107 | } |
108 | - if ($action=='revoke') |
|
108 | + if ($action == 'revoke') |
|
109 | 109 | { |
110 | - $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND tool='".Database::escape_string($tool)."' AND action='".Database::escape_string($permission)."'"; |
|
111 | - $result=Database::query($sql); |
|
112 | - if($result) { |
|
113 | - $result_message=get_lang('PermissionRevoked'); |
|
110 | + $sql = "DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND tool='".Database::escape_string($tool)."' AND action='".Database::escape_string($permission)."'"; |
|
111 | + $result = Database::query($sql); |
|
112 | + if ($result) { |
|
113 | + $result_message = get_lang('PermissionRevoked'); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | return $result_message; |
@@ -125,44 +125,44 @@ discard block |
||
125 | 125 | */ |
126 | 126 | function get_permissions($content, $id) { |
127 | 127 | $course_id = api_get_course_int_id(); |
128 | - $currentpermissions=array(); |
|
128 | + $currentpermissions = array(); |
|
129 | 129 | // Which database are we using (depending on the $content parameter) |
130 | 130 | $course_id_condition = " c_id = $course_id AND "; |
131 | 131 | if ($content == 'user') |
132 | 132 | { |
133 | - $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
133 | + $table = Database::get_course_table(TABLE_PERMISSION_USER); |
|
134 | 134 | $id_field = 'user_id'; |
135 | 135 | } |
136 | 136 | elseif ($content == 'group') |
137 | 137 | { |
138 | - $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
138 | + $table = Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
139 | 139 | $id_field = 'group_id'; |
140 | 140 | } |
141 | 141 | elseif ($content == 'role') |
142 | 142 | { |
143 | - $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
143 | + $table = Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
144 | 144 | $id_field = 'role_id'; |
145 | 145 | } |
146 | 146 | elseif ($content == 'platform_role') |
147 | 147 | { |
148 | - $table=Database::get_main_table(TABLE_ROLE_PERMISSION); |
|
148 | + $table = Database::get_main_table(TABLE_ROLE_PERMISSION); |
|
149 | 149 | $id_field = 'role_id'; |
150 | 150 | $course_id_condition = ''; |
151 | 151 | } |
152 | 152 | elseif ($content == 'task') |
153 | 153 | { |
154 | - $table=Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
|
154 | + $table = Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
|
155 | 155 | $id_field = 'task_id'; |
156 | 156 | } |
157 | 157 | |
158 | 158 | // finding all the permissions. We store this in a multidimensional array |
159 | 159 | // where the first dimension is the tool. |
160 | - $sql=" |
|
161 | - SELECT * FROM " . $table . " |
|
162 | - WHERE $course_id_condition " . $id_field . "='" . Database::escape_string($id) . "'"; |
|
160 | + $sql = " |
|
161 | + SELECT * FROM " . $table." |
|
162 | + WHERE $course_id_condition ".$id_field."='".Database::escape_string($id)."'"; |
|
163 | 163 | $result = Database::query($sql); |
164 | 164 | |
165 | - while($row = Database::fetch_array($result)) |
|
165 | + while ($row = Database::fetch_array($result)) |
|
166 | 166 | $currentpermissions[$row['tool']][] = $row['action']; |
167 | 167 | |
168 | 168 | return $currentpermissions; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | function limited_or_full($current_permissions) |
181 | 181 | { |
182 | - if (api_get_setting('permissions')=='limited') |
|
182 | + if (api_get_setting('permissions') == 'limited') |
|
183 | 183 | { |
184 | 184 | foreach ($current_permissions as $tool=>$tool_rights) |
185 | 185 | { |
@@ -187,15 +187,15 @@ discard block |
||
187 | 187 | // if it is visibility or move we have to grant the edit right |
188 | 188 | foreach ($tool_rights as $key=>$value) |
189 | 189 | { |
190 | - if ($value=='View') |
|
190 | + if ($value == 'View') |
|
191 | 191 | { |
192 | 192 | unset($current_permissions[$tool][$key]); |
193 | 193 | } |
194 | - if ($value=='Visibility' OR $value=='Move') |
|
194 | + if ($value == 'Visibility' OR $value == 'Move') |
|
195 | 195 | { |
196 | - if (!in_array('Edit',$current_permissions[$tool])) |
|
196 | + if (!in_array('Edit', $current_permissions[$tool])) |
|
197 | 197 | { |
198 | - $current_permissions[$tool][]='Edit'; |
|
198 | + $current_permissions[$tool][] = 'Edit'; |
|
199 | 199 | } |
200 | 200 | unset($current_permissions[$tool][$key]); |
201 | 201 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | } |
208 | 208 | return $current_permissions; |
209 | 209 | } |
210 | - if (api_get_setting('permissions')=='full') |
|
210 | + if (api_get_setting('permissions') == 'full') |
|
211 | 211 | { |
212 | 212 | return $current_permissions; |
213 | 213 | } |
@@ -222,12 +222,12 @@ discard block |
||
222 | 222 | * @author Patrick Cool <[email protected]>, Ghent University |
223 | 223 | * @version 1.0 |
224 | 224 | */ |
225 | -function display_checkbox_matrix($permission_array, $tool, $permission, $inherited_permissions=array()) |
|
225 | +function display_checkbox_matrix($permission_array, $tool, $permission, $inherited_permissions = array()) |
|
226 | 226 | { |
227 | - $checked=""; |
|
228 | - if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
|
227 | + $checked = ""; |
|
228 | + if (is_array($permission_array[$tool]) AND in_array($permission, $permission_array[$tool])) |
|
229 | 229 | { |
230 | - $checked="checked"; |
|
230 | + $checked = "checked"; |
|
231 | 231 | } |
232 | 232 | echo "\t\t\t<input type=\"checkbox\" name=\"permission*$tool*$permission\" $checked>\n"; |
233 | 233 | |
@@ -243,28 +243,28 @@ discard block |
||
243 | 243 | * @author Patrick Cool <[email protected]>, Ghent University |
244 | 244 | * @version 1.0 |
245 | 245 | */ |
246 | -function display_image_matrix($permission_array, $tool, $permission,$inherited_permissions=array(), $course_admin=false, $editable=true) |
|
246 | +function display_image_matrix($permission_array, $tool, $permission, $inherited_permissions = array(), $course_admin = false, $editable = true) |
|
247 | 247 | { |
248 | 248 | if ($course_admin) { |
249 | 249 | echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
250 | 250 | } else { |
251 | - if (in_array($permission,$inherited_permissions[$tool])) { |
|
251 | + if (in_array($permission, $inherited_permissions[$tool])) { |
|
252 | 252 | echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
253 | 253 | } else { |
254 | - if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) { |
|
254 | + if (is_array($permission_array[$tool]) AND in_array($permission, $permission_array[$tool])) { |
|
255 | 255 | if ($editable) { |
256 | - $url=api_get_self(); |
|
256 | + $url = api_get_self(); |
|
257 | 257 | $urlparameters = ''; |
258 | - foreach($_GET as $key=>$value) { |
|
259 | - $parameter[$key]=$value; |
|
258 | + foreach ($_GET as $key=>$value) { |
|
259 | + $parameter[$key] = $value; |
|
260 | 260 | } |
261 | - $parameter['action']='revoke'; |
|
262 | - $parameter['permission']=$permission; |
|
263 | - $parameter['tool']=$tool; |
|
261 | + $parameter['action'] = 'revoke'; |
|
262 | + $parameter['permission'] = $permission; |
|
263 | + $parameter['tool'] = $tool; |
|
264 | 264 | foreach ($parameter as $key=>$value) { |
265 | - $urlparameters.=$key.'='.$value.'&'; |
|
265 | + $urlparameters .= $key.'='.$value.'&'; |
|
266 | 266 | } |
267 | - $url=$url.'?'.$urlparameters; |
|
267 | + $url = $url.'?'.$urlparameters; |
|
268 | 268 | |
269 | 269 | echo "\t\t\t <a href=\"".$url."\">"; |
270 | 270 | } |
@@ -275,20 +275,20 @@ discard block |
||
275 | 275 | } else { |
276 | 276 | if ($editable) |
277 | 277 | { |
278 | - $url=api_get_self(); |
|
278 | + $url = api_get_self(); |
|
279 | 279 | $urlparameters = ''; |
280 | 280 | foreach ($_GET as $key=>$value) |
281 | 281 | { |
282 | - $parameter[$key]=$value; |
|
282 | + $parameter[$key] = $value; |
|
283 | 283 | } |
284 | - $parameter['action']='grant'; |
|
285 | - $parameter['permission']=$permission; |
|
286 | - $parameter['tool']=$tool; |
|
284 | + $parameter['action'] = 'grant'; |
|
285 | + $parameter['permission'] = $permission; |
|
286 | + $parameter['tool'] = $tool; |
|
287 | 287 | foreach ($parameter as $key=>$value) |
288 | 288 | { |
289 | - $urlparameters.=$key.'='.$value.'&'; |
|
289 | + $urlparameters .= $key.'='.$value.'&'; |
|
290 | 290 | } |
291 | - $url=$url.'?'.$urlparameters; |
|
291 | + $url = $url.'?'.$urlparameters; |
|
292 | 292 | |
293 | 293 | //echo "\t\t\t <a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=grant&permission=$permission&tool=$tool\">"; |
294 | 294 | echo "\t\t\t <a href=\"".$url."\">"; |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | * @author Patrick Cool <[email protected]>, Ghent University |
316 | 316 | * @version 1.0 |
317 | 317 | */ |
318 | -function display_image_matrix_for_blogs($permission_array, $user_id, $tool, $permission,$inherited_permissions=array(), $course_admin=false, $editable=true) |
|
318 | +function display_image_matrix_for_blogs($permission_array, $user_id, $tool, $permission, $inherited_permissions = array(), $course_admin = false, $editable = true) |
|
319 | 319 | { |
320 | 320 | |
321 | 321 | if ($course_admin) |
@@ -324,32 +324,32 @@ discard block |
||
324 | 324 | } |
325 | 325 | else |
326 | 326 | { |
327 | - if (!empty($inherited_permissions) and in_array($permission,$inherited_permissions[$tool])) |
|
327 | + if (!empty($inherited_permissions) and in_array($permission, $inherited_permissions[$tool])) |
|
328 | 328 | { |
329 | 329 | echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
330 | 330 | } |
331 | 331 | else |
332 | 332 | { |
333 | - if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
|
333 | + if (is_array($permission_array[$tool]) AND in_array($permission, $permission_array[$tool])) |
|
334 | 334 | { |
335 | 335 | if ($editable) |
336 | 336 | { |
337 | 337 | $url = api_get_self(); |
338 | 338 | $urlparameters = ''; |
339 | - foreach($_GET as $key => $value) |
|
339 | + foreach ($_GET as $key => $value) |
|
340 | 340 | { |
341 | 341 | $parameter[$key] = $value; |
342 | 342 | } |
343 | - $parameter['action']='manage_rights'; |
|
344 | - $parameter['do']='revoke'; |
|
345 | - $parameter['permission']=$permission; |
|
346 | - $parameter['tool']=$tool; |
|
347 | - $parameter['user_id']=$user_id; |
|
343 | + $parameter['action'] = 'manage_rights'; |
|
344 | + $parameter['do'] = 'revoke'; |
|
345 | + $parameter['permission'] = $permission; |
|
346 | + $parameter['tool'] = $tool; |
|
347 | + $parameter['user_id'] = $user_id; |
|
348 | 348 | foreach ($parameter as $key=>$value) |
349 | 349 | { |
350 | - $urlparameters .= $key . '=' . $value . '&'; |
|
350 | + $urlparameters .= $key.'='.$value.'&'; |
|
351 | 351 | } |
352 | - $url = $url . '?' . $urlparameters; |
|
352 | + $url = $url.'?'.$urlparameters; |
|
353 | 353 | |
354 | 354 | echo "\t\t\t <a href=\"".$url."\">"; |
355 | 355 | } |
@@ -362,17 +362,17 @@ discard block |
||
362 | 362 | $url = api_get_self(); |
363 | 363 | $urlparameters = ''; |
364 | 364 | foreach ($_GET as $key=>$value) { |
365 | - $parameter[$key]=$value; |
|
365 | + $parameter[$key] = $value; |
|
366 | 366 | } |
367 | - $parameter['action']='manage_rights'; |
|
368 | - $parameter['do']='grant'; |
|
369 | - $parameter['permission']=$permission; |
|
370 | - $parameter['tool']=$tool; |
|
371 | - $parameter['user_id']=$user_id; |
|
367 | + $parameter['action'] = 'manage_rights'; |
|
368 | + $parameter['do'] = 'grant'; |
|
369 | + $parameter['permission'] = $permission; |
|
370 | + $parameter['tool'] = $tool; |
|
371 | + $parameter['user_id'] = $user_id; |
|
372 | 372 | foreach ($parameter as $key=>$value) { |
373 | - $urlparameters .= $key . '=' . $value . '&'; |
|
373 | + $urlparameters .= $key.'='.$value.'&'; |
|
374 | 374 | } |
375 | - $url=$url.'?'.$urlparameters; |
|
375 | + $url = $url.'?'.$urlparameters; |
|
376 | 376 | |
377 | 377 | //echo "\t\t\t <a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=grant&permission=$permission&tool=$tool\">"; |
378 | 378 | echo "\t\t\t <a href=\"".$url."\">"; |
@@ -397,30 +397,30 @@ discard block |
||
397 | 397 | global $setting_visualisation; |
398 | 398 | $course_id = api_get_course_int_id(); |
399 | 399 | |
400 | - $coures_roles_table=Database::get_course_table(TABLE_ROLE); |
|
400 | + $coures_roles_table = Database::get_course_table(TABLE_ROLE); |
|
401 | 401 | |
402 | 402 | // course roles |
403 | - $sql="SELECT * FROM $coures_roles_table WHERE c_id = $course_id "; |
|
404 | - $result=Database::query($sql); |
|
405 | - while ($row=Database::fetch_array($result)) |
|
403 | + $sql = "SELECT * FROM $coures_roles_table WHERE c_id = $course_id "; |
|
404 | + $result = Database::query($sql); |
|
405 | + while ($row = Database::fetch_array($result)) |
|
406 | 406 | { |
407 | 407 | if (in_array($row['role_id'], $current_course_roles)) |
408 | 408 | { |
409 | - $checked='checked'; |
|
410 | - $image='checkbox_on2.gif'; |
|
411 | - $action='revoke'; |
|
409 | + $checked = 'checked'; |
|
410 | + $image = 'checkbox_on2.gif'; |
|
411 | + $action = 'revoke'; |
|
412 | 412 | } |
413 | 413 | else |
414 | 414 | { |
415 | - $checked=''; |
|
416 | - $image='wrong.gif'; |
|
417 | - $action='grant'; |
|
415 | + $checked = ''; |
|
416 | + $image = 'wrong.gif'; |
|
417 | + $action = 'grant'; |
|
418 | 418 | } |
419 | - if ($setting_visualisation=='checkbox') |
|
419 | + if ($setting_visualisation == 'checkbox') |
|
420 | 420 | { |
421 | 421 | echo "<input type=\"checkbox\" name=\"role*course*".$row['role_id']."\" $checked>"; |
422 | 422 | } |
423 | - if ($setting_visualisation=='image') |
|
423 | + if ($setting_visualisation == 'image') |
|
424 | 424 | { |
425 | 425 | echo "<a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=$action&role=".$row['role_id']."&scope=course\"><img src=\"../img/".$image."\" border=\"0\"/></a>"; |
426 | 426 | } |
@@ -440,24 +440,24 @@ discard block |
||
440 | 440 | * @author Patrick Cool <[email protected]>, Ghent University |
441 | 441 | * @version 1.0 |
442 | 442 | */ |
443 | -function get_roles($content,$id, $scope='course') { |
|
444 | - $course_id = api_get_course_int_id(); |
|
445 | - if ($content=='user') { |
|
446 | - $table=Database::get_course_table(TABLE_ROLE_USER); |
|
443 | +function get_roles($content, $id, $scope = 'course') { |
|
444 | + $course_id = api_get_course_int_id(); |
|
445 | + if ($content == 'user') { |
|
446 | + $table = Database::get_course_table(TABLE_ROLE_USER); |
|
447 | 447 | $id_field = user_id; |
448 | 448 | } |
449 | - if ($content=='group') { |
|
450 | - $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
449 | + if ($content == 'group') { |
|
450 | + $table = Database::get_course_table(TABLE_ROLE_GROUP); |
|
451 | 451 | $id_field = 'group_id'; |
452 | 452 | } |
453 | - $table_role=Database::get_course_table(TABLE_ROLE); |
|
453 | + $table_role = Database::get_course_table(TABLE_ROLE); |
|
454 | 454 | |
455 | - $current_roles=array(); |
|
455 | + $current_roles = array(); |
|
456 | 456 | //$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'";$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'"; |
457 | - $sql="SELECT role_id FROM $table WHERE c_id = $course_id AND $id_field = '$id' AND scope='".$scope."'"; |
|
458 | - $result=Database::query($sql); |
|
459 | - while ($row=Database::fetch_array($result)) { |
|
460 | - $current_roles[]=$row['role_id']; |
|
457 | + $sql = "SELECT role_id FROM $table WHERE c_id = $course_id AND $id_field = '$id' AND scope='".$scope."'"; |
|
458 | + $result = Database::query($sql); |
|
459 | + while ($row = Database::fetch_array($result)) { |
|
460 | + $current_roles[] = $row['role_id']; |
|
461 | 461 | } |
462 | 462 | return $current_roles; |
463 | 463 | } |
@@ -468,26 +468,26 @@ discard block |
||
468 | 468 | * @author Patrick Cool <[email protected]>, Ghent University |
469 | 469 | * @version 1.0 |
470 | 470 | */ |
471 | -function get_all_roles($content='course') { |
|
471 | +function get_all_roles($content = 'course') { |
|
472 | 472 | $course_id = api_get_course_int_id(); |
473 | 473 | $course_id_condition = " WHERE c_id = $course_id "; |
474 | 474 | |
475 | - if ($content=='course') |
|
475 | + if ($content == 'course') |
|
476 | 476 | { |
477 | - $table_role=Database::get_course_table(TABLE_ROLE); |
|
477 | + $table_role = Database::get_course_table(TABLE_ROLE); |
|
478 | 478 | } |
479 | - if ($content=='platform') |
|
479 | + if ($content == 'platform') |
|
480 | 480 | { |
481 | - $table_role=Database::get_main_table(TABLE_ROLE); |
|
481 | + $table_role = Database::get_main_table(TABLE_ROLE); |
|
482 | 482 | $course_id_condition = ''; |
483 | 483 | } |
484 | 484 | |
485 | - $current_roles=array(); |
|
486 | - $sql="SELECT * FROM $table_role $course_id_condition "; |
|
487 | - $result=Database::query($sql); |
|
488 | - while ($row=Database::fetch_array($result)) |
|
485 | + $current_roles = array(); |
|
486 | + $sql = "SELECT * FROM $table_role $course_id_condition "; |
|
487 | + $result = Database::query($sql); |
|
488 | + while ($row = Database::fetch_array($result)) |
|
489 | 489 | { |
490 | - $roles[]=$row; |
|
490 | + $roles[] = $row; |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | return $roles; |
@@ -504,10 +504,10 @@ discard block |
||
504 | 504 | * @author Patrick Cool <[email protected]>, Ghent University |
505 | 505 | * @version 1.0 |
506 | 506 | */ |
507 | -function get_roles_permissions($content,$id, $scope='course') { |
|
507 | +function get_roles_permissions($content, $id, $scope = 'course') { |
|
508 | 508 | $course_id = api_get_course_int_id(); |
509 | 509 | if ($content == 'user') { |
510 | - $table=Database::get_course_table(TABLE_ROLE_USER); |
|
510 | + $table = Database::get_course_table(TABLE_ROLE_USER); |
|
511 | 511 | $id_field = 'user_id'; |
512 | 512 | } |
513 | 513 | |
@@ -536,21 +536,21 @@ discard block |
||
536 | 536 | $sql = " |
537 | 537 | SELECT * |
538 | 538 | FROM |
539 | - " . $table . " role_group_user, |
|
540 | - " . $table_role . " role, |
|
541 | - " . $table_role_permissions . " role_permissions |
|
539 | + " . $table." role_group_user, |
|
540 | + " . $table_role." role, |
|
541 | + " . $table_role_permissions." role_permissions |
|
542 | 542 | WHERE |
543 | 543 | role_group_user.c_id = $course_id AND |
544 | 544 | $role_condition |
545 | - role_group_user.scope = '" . $scope . "' AND |
|
546 | - role_group_user." . $id_field . " = '" . $id . "' AND |
|
545 | + role_group_user.scope = '".$scope."' AND |
|
546 | + role_group_user." . $id_field." = '".$id."' AND |
|
547 | 547 | role_group_user.role_id = role.role_id AND |
548 | 548 | role.role_id = role_permissions.role_id"; |
549 | 549 | |
550 | 550 | $result = Database::query($sql); |
551 | 551 | $current_role_permissions = array(); |
552 | - while ($row=Database::fetch_array($result)) { |
|
553 | - $current_role_permissions[$row['tool']][]=$row['action']; |
|
552 | + while ($row = Database::fetch_array($result)) { |
|
553 | + $current_role_permissions[$row['tool']][] = $row['action']; |
|
554 | 554 | } |
555 | 555 | return $current_role_permissions; |
556 | 556 | } |
@@ -564,33 +564,33 @@ discard block |
||
564 | 564 | * @author Patrick Cool <[email protected]>, Ghent University |
565 | 565 | */ |
566 | 566 | |
567 | -function assign_role($content, $action, $id, $role_id, $scope='course') { |
|
567 | +function assign_role($content, $action, $id, $role_id, $scope = 'course') { |
|
568 | 568 | $course_id = api_get_course_int_id(); |
569 | 569 | // Which database are we using (depending on the $content parameter) |
570 | - if ($content=='user') { |
|
571 | - $table=Database::get_course_table(TABLE_ROLE_USER); |
|
570 | + if ($content == 'user') { |
|
571 | + $table = Database::get_course_table(TABLE_ROLE_USER); |
|
572 | 572 | $id_field = 'user_id'; |
573 | - } elseif($content=='group') { |
|
574 | - $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
573 | + } elseif ($content == 'group') { |
|
574 | + $table = Database::get_course_table(TABLE_ROLE_GROUP); |
|
575 | 575 | $id_field = 'group_id'; |
576 | 576 | } else { |
577 | 577 | return get_lang('Error'); |
578 | 578 | } |
579 | 579 | |
580 | 580 | // grating a right |
581 | - if ($action=='grant') { |
|
582 | - $sql="INSERT INTO $table (c_id, role_id, scope, $id_field) VALUES ($course_id, '".Database::escape_string($role_id)."','".Database::escape_string($scope)."','".Database::escape_string($id)."')"; |
|
583 | - $result=Database::query($sql); |
|
581 | + if ($action == 'grant') { |
|
582 | + $sql = "INSERT INTO $table (c_id, role_id, scope, $id_field) VALUES ($course_id, '".Database::escape_string($role_id)."','".Database::escape_string($scope)."','".Database::escape_string($id)."')"; |
|
583 | + $result = Database::query($sql); |
|
584 | 584 | if ($result) { |
585 | - $result_message=get_lang('RoleGranted'); |
|
585 | + $result_message = get_lang('RoleGranted'); |
|
586 | 586 | } |
587 | 587 | } |
588 | 588 | |
589 | - if ($action=='revoke') { |
|
590 | - $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND role_id='".Database::escape_string($role_id)."'"; |
|
591 | - $result=Database::query($sql); |
|
589 | + if ($action == 'revoke') { |
|
590 | + $sql = "DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND role_id='".Database::escape_string($role_id)."'"; |
|
591 | + $result = Database::query($sql); |
|
592 | 592 | if ($result) { |
593 | - $result_message=get_lang('RoleRevoked'); |
|
593 | + $result_message = get_lang('RoleRevoked'); |
|
594 | 594 | } |
595 | 595 | } |
596 | 596 | return $result_message; |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | { |
608 | 608 | foreach ($permissions as $permissionkey=>$permissionvalue) |
609 | 609 | { |
610 | - $array1[$tool][]=$permissionvalue; |
|
610 | + $array1[$tool][] = $permissionvalue; |
|
611 | 611 | } |
612 | 612 | } |
613 | 613 | return $array1; |
@@ -735,7 +735,6 @@ |
||
735 | 735 | * lock = the user can no longer use this account |
736 | 736 | * @author Patrick Cool <[email protected]>, Ghent University |
737 | 737 | * @param int $active the current state of the account |
738 | - * @param int $user_id The user id |
|
739 | 738 | * @param string $urlParams |
740 | 739 | * |
741 | 740 | * @return string Some HTML-code with the lock/unlock button |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | $use_anonymous = true; |
15 | 15 | require_once '../inc/global.inc.php'; |
16 | -$current_course_tool = TOOL_USER; |
|
16 | +$current_course_tool = TOOL_USER; |
|
17 | 17 | $this_section = SECTION_COURSES; |
18 | 18 | |
19 | 19 | // notice for unauthorized people. |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | //Can't auto unregister from a session |
43 | 43 | if (!empty($sessionId)) { |
44 | - $course_info['unsubscribe'] = 0; |
|
44 | + $course_info['unsubscribe'] = 0; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /* Unregistering a user section */ |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | '#', |
174 | 174 | get_lang('UserPicture'), |
175 | 175 | get_lang('OfficialCode'), |
176 | - get_lang('FirstName') . ', ' . get_lang('LastName'), |
|
176 | + get_lang('FirstName').', '.get_lang('LastName'), |
|
177 | 177 | get_lang('Email'), |
178 | 178 | get_lang('Phone') |
179 | 179 | ); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | '#', |
183 | 183 | get_lang('UserPicture'), |
184 | 184 | get_lang('OfficialCode'), |
185 | - get_lang('LastName') . ', ' . get_lang('FirstName'), |
|
185 | + get_lang('LastName').', '.get_lang('FirstName'), |
|
186 | 186 | get_lang('Email'), |
187 | 187 | get_lang('Phone') |
188 | 188 | ); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | if (api_is_multiple_url_enabled()) { |
208 | 208 | $sql .= ' , '.Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER).' au '; |
209 | 209 | } |
210 | - $sql .=" WHERE c_id = '$courseId' AND session_course_user.user_id = user.user_id "; |
|
210 | + $sql .= " WHERE c_id = '$courseId' AND session_course_user.user_id = user.user_id "; |
|
211 | 211 | $sql .= ' AND session_id = '.$sessionId; |
212 | 212 | |
213 | 213 | if (api_is_multiple_url_enabled()) { |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $counter, |
256 | 256 | $user_image, |
257 | 257 | $user['official_code'], |
258 | - $user['firstname'] . ', ' . $user['lastname'], |
|
258 | + $user['firstname'].', '.$user['lastname'], |
|
259 | 259 | $user['email'], |
260 | 260 | $user['phone'] |
261 | 261 | ); |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | $counter, |
265 | 265 | $user_image, |
266 | 266 | $user['official_code'], |
267 | - $user['lastname'] . ', ' . $user['firstname'], |
|
267 | + $user['lastname'].', '.$user['firstname'], |
|
268 | 268 | $user['email'], |
269 | 269 | $user['phone'] |
270 | 270 | ); |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | $counter, |
344 | 344 | $user_image, |
345 | 345 | $user['official_code'], |
346 | - $user['firstname'] . ', ' . $user['lastname'], |
|
346 | + $user['firstname'].', '.$user['lastname'], |
|
347 | 347 | $user['email'], |
348 | 348 | $user['phone'] |
349 | 349 | ); |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | $counter, |
353 | 353 | $user_image, |
354 | 354 | $user['official_code'], |
355 | - $user['lastname'] . ', ' . $user['firstname'], |
|
355 | + $user['lastname'].', '.$user['firstname'], |
|
356 | 356 | $user['email'], |
357 | 357 | $user['phone'] |
358 | 358 | ); |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | $userInfo = api_get_user_info($user_id); |
702 | 702 | $userPicture = $userInfo['avatar']; |
703 | 703 | |
704 | - $photo= '<img src="'.$userPicture.'" alt="'.$userInfo['complete_name'].'" width="22" height="22" title="'.$userInfo['complete_name'].'" />'; |
|
704 | + $photo = '<img src="'.$userPicture.'" alt="'.$userInfo['complete_name'].'" width="22" height="22" title="'.$userInfo['complete_name'].'" />'; |
|
705 | 705 | |
706 | 706 | $temp[] = $user_id; |
707 | 707 | $temp[] = $photo; |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | if (api_get_setting('allow_user_course_subscription_by_course_admin') === 'true' or api_is_platform_admin()) { |
825 | 825 | // unregister |
826 | 826 | if ($user_id != $current_user_id || api_is_platform_admin()) { |
827 | - $result .= '<a class="btn btn-small btn-danger" href="'.api_get_self().'?'.api_get_cidreq().'&type='.$type.'&unregister=yes&user_id='.$user_id.'" title="'.get_lang('Unreg').' " onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;">'. |
|
827 | + $result .= '<a class="btn btn-small btn-danger" href="'.api_get_self().'?'.api_get_cidreq().'&type='.$type.'&unregister=yes&user_id='.$user_id.'" title="'.get_lang('Unreg').' " onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)).'\')) return false;">'. |
|
828 | 828 | get_lang('Unreg').'</a> '; |
829 | 829 | } else { |
830 | 830 | //$result .= Display::return_icon('unsubscribe_course_na.png', get_lang('Unreg'),'',ICON_SIZE_SMALL).'</a> '; |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | // Show buttons for unsubscribe |
835 | 835 | if ($course_info['unsubscribe'] == 1) { |
836 | 836 | if ($user_id == $current_user_id) { |
837 | - $result .= '<a class="btn btn-small btn-danger" href="'.api_get_self().'?'.api_get_cidreq().'&type='.$type.'&unregister=yes&user_id='.$user_id.'" title="'.get_lang('Unreg').' " onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;">'. |
|
837 | + $result .= '<a class="btn btn-small btn-danger" href="'.api_get_self().'?'.api_get_cidreq().'&type='.$type.'&unregister=yes&user_id='.$user_id.'" title="'.get_lang('Unreg').' " onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)).'\')) return false;">'. |
|
838 | 838 | get_lang('Unreg').'</a> '; |
839 | 839 | } |
840 | 840 | } |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | |
915 | 915 | // Actions column |
916 | 916 | $table->set_header($header_nr++, get_lang('Action'), false); |
917 | - $table->set_column_filter($header_nr-1, 'modify_filter'); |
|
917 | + $table->set_column_filter($header_nr - 1, 'modify_filter'); |
|
918 | 918 | |
919 | 919 | if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true') { |
920 | 920 | $table->set_form_actions(array('unsubscribe' => get_lang('Unreg')), 'user'); |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | } else { |
923 | 923 | if ($course_info['unsubscribe'] == 1) { |
924 | 924 | $table->set_header($header_nr++, get_lang('Action'), false); |
925 | - $table->set_column_filter($header_nr-1, 'modify_filter'); |
|
925 | + $table->set_column_filter($header_nr - 1, 'modify_filter'); |
|
926 | 926 | } |
927 | 927 | } |
928 | 928 | |
@@ -978,19 +978,19 @@ discard block |
||
978 | 978 | echo '<div class="col-md-6">'; |
979 | 979 | echo $icon; |
980 | 980 | $actions .= '<a href="user.php?'.api_get_cidreq().'&action=export&format=csv&type='.$type.'">'. |
981 | - Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a> '; |
|
981 | + Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a> '; |
|
982 | 982 | $actions .= '<a href="user.php?'.api_get_cidreq().'&action=export&format=xls&type='.$type.'">'. |
983 | - Display::return_icon('export_excel.png', get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).'</a> '; |
|
983 | + Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a> '; |
|
984 | 984 | |
985 | 985 | if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true' || |
986 | 986 | api_is_platform_admin() |
987 | 987 | ) { |
988 | 988 | $actions .= '<a href="user_import.php?'.api_get_cidreq().'&action=import">'. |
989 | - Display::return_icon('import_csv.png', get_lang('ImportUsersToACourse'),'',ICON_SIZE_MEDIUM).'</a> '; |
|
989 | + Display::return_icon('import_csv.png', get_lang('ImportUsersToACourse'), '', ICON_SIZE_MEDIUM).'</a> '; |
|
990 | 990 | } |
991 | 991 | |
992 | 992 | $actions .= '<a href="user.php?'.api_get_cidreq().'&action=export&format=pdf&type='.$type.'">'. |
993 | - Display::return_icon('pdf.png', get_lang('ExportToPDF'),'',ICON_SIZE_MEDIUM).'</a> '; |
|
993 | + Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a> '; |
|
994 | 994 | echo $actions; |
995 | 995 | |
996 | 996 | echo '</div>'; |
@@ -84,7 +84,7 @@ |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
87 | - * @param $directoryPath |
|
87 | + * @param string $directoryPath |
|
88 | 88 | * @return bool |
89 | 89 | */ |
90 | 90 | function deleteDirectory($directoryPath) |
@@ -19,7 +19,7 @@ discard block |
||
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 | $size = $pptData['service_ppt2lp_size']; |
25 | 25 | $w = '800'; |
@@ -29,20 +29,20 @@ discard block |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | $tempArchivePath = api_get_path(SYS_ARCHIVE_PATH); |
32 | - $tempPath = $tempArchivePath . 'wsConvert/' . $fileName . '/'; |
|
33 | - $tempPathNewFiles = $tempArchivePath . 'wsConvert/' . $fileName . '-n/'; |
|
32 | + $tempPath = $tempArchivePath.'wsConvert/'.$fileName.'/'; |
|
33 | + $tempPathNewFiles = $tempArchivePath.'wsConvert/'.$fileName.'-n/'; |
|
34 | 34 | |
35 | 35 | $oldumask = umask(0); |
36 | 36 | $perms = api_get_permissions_for_new_directories(); |
37 | 37 | pptConverterDirectoriesCreate($tempPath, $tempPathNewFiles, $fileName, $perms); |
38 | 38 | |
39 | 39 | $file = base64_decode($fileData); |
40 | - file_put_contents($tempPath . $fullFileName, $file); |
|
40 | + file_put_contents($tempPath.$fullFileName, $file); |
|
41 | 41 | |
42 | 42 | $cmd = pptConverterGetCommandBaseParams(); |
43 | - $cmd .= ' -w ' . $w . ' -h ' . $h . ' -d oogie "' . $tempPath . $fullFileName.'" "' . $tempPathNewFiles . $fileName . '.html"'; |
|
43 | + $cmd .= ' -w '.$w.' -h '.$h.' -d oogie "'.$tempPath.$fullFileName.'" "'.$tempPathNewFiles.$fileName.'.html"'; |
|
44 | 44 | |
45 | - chmod($tempPathNewFiles . $fileName, $perms); |
|
45 | + chmod($tempPathNewFiles.$fileName, $perms); |
|
46 | 46 | |
47 | 47 | $files = array(); |
48 | 48 | $return = 0; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | if (is_array($files) && !empty($files)) { |
55 | 55 | foreach ($files as $file) { |
56 | 56 | $imageData = explode('||', $file); |
57 | - $images[$imageData[1]] = base64_encode(file_get_contents($tempPathNewFiles . $fileName . '/' . $imageData[1])); |
|
57 | + $images[$imageData[1]] = base64_encode(file_get_contents($tempPathNewFiles.$fileName.'/'.$imageData[1])); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | $data = array( |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | function deleteDirectory($directoryPath) |
82 | 82 | { |
83 | - $files = array_diff(scandir($directoryPath), array('.','..')); |
|
83 | + $files = array_diff(scandir($directoryPath), array('.', '..')); |
|
84 | 84 | foreach ($files as $file) { |
85 | 85 | if (is_dir("$directoryPath/$file")) { |
86 | 86 | deleteDirectory("$directoryPath/$file"); |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | if (!is_dir($tempPathNewFiles)) { |
109 | 109 | mkdir($tempPathNewFiles, $perms, true); |
110 | 110 | } |
111 | - if (!is_dir($tempPathNewFiles . $fileName)) { |
|
112 | - mkdir($tempPathNewFiles . $fileName, $perms, true); |
|
111 | + if (!is_dir($tempPathNewFiles.$fileName)) { |
|
112 | + mkdir($tempPathNewFiles.$fileName, $perms, true); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
@@ -120,16 +120,16 @@ discard block |
||
120 | 120 | function pptConverterGetCommandBaseParams() |
121 | 121 | { |
122 | 122 | if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php |
123 | - $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png'); |
|
124 | - $classPath = $converterPath . ';' . $converterPath . '/jodconverter-2.2.2.jar;' . $converterPath . '/jodconverter-cli-2.2.2.jar'; |
|
125 | - $cmd = 'java -Dfile.encoding=UTF-8 -cp "' . $classPath . '" DokeosConverter'; |
|
123 | + $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH).'main/inc/lib/ppt2png'); |
|
124 | + $classPath = $converterPath.';'.$converterPath.'/jodconverter-2.2.2.jar;'.$converterPath.'/jodconverter-cli-2.2.2.jar'; |
|
125 | + $cmd = 'java -Dfile.encoding=UTF-8 -cp "'.$classPath.'" DokeosConverter'; |
|
126 | 126 | } else { |
127 | - $converterPath = api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png'; |
|
127 | + $converterPath = api_get_path(SYS_PATH).'main/inc/lib/ppt2png'; |
|
128 | 128 | $classPath = ' -Dfile.encoding=UTF-8 -cp .:jodconverter-2.2.2.jar:jodconverter-cli-2.2.2.jar'; |
129 | - $cmd = 'cd ' . $converterPath . ' && java ' . $classPath . ' DokeosConverter'; |
|
129 | + $cmd = 'cd '.$converterPath.' && java '.$classPath.' DokeosConverter'; |
|
130 | 130 | } |
131 | 131 | |
132 | - $cmd .= ' -p ' . api_get_setting('service_ppt2lp', 'port'); |
|
132 | + $cmd .= ' -p '.api_get_setting('service_ppt2lp', 'port'); |
|
133 | 133 | return $cmd; |
134 | 134 | } |
135 | 135 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $webCodePath = api_get_path(WEB_CODE_PATH); |
139 | 139 | $options = array( |
140 | 140 | 'uri' => $webPath, |
141 | - 'location' => $webCodePath . 'webservices/additional_webservices.php' |
|
141 | + 'location' => $webCodePath.'webservices/additional_webservices.php' |
|
142 | 142 | ); |
143 | 143 | |
144 | 144 | $soapServer = new SoapServer(NULL, $options); |
@@ -204,6 +204,9 @@ |
||
204 | 204 | |
205 | 205 | } |
206 | 206 | |
207 | + /** |
|
208 | + * @param integer $user_id |
|
209 | + */ |
|
207 | 210 | protected function set_message_as_read($user_id, $message_id){ |
208 | 211 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
209 | 212 | $query = "UPDATE $table_message SET msg_status = '".MESSAGE_STATUS_NEW."' WHERE user_receiver_id=".$user_id." AND id='".$message_id."';"; |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
38 | 38 | |
39 | 39 | $sql_query = "SELECT id FROM $table_message " . |
40 | - " WHERE user_receiver_id=".$user_id." AND msg_status IN (0,1)" . |
|
41 | - " ORDER BY send_date LIMIT $from,$number_of_items"; |
|
40 | + " WHERE user_receiver_id=".$user_id." AND msg_status IN (0,1)" . |
|
41 | + " ORDER BY send_date LIMIT $from,$number_of_items"; |
|
42 | 42 | |
43 | 43 | $sql_result = Database::query($sql_query); |
44 | 44 | $message = "#"; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
87 | 87 | |
88 | 88 | $sql_query = "SELECT ".$field_table." FROM $table_message " . |
89 | - " WHERE user_receiver_id=".$user_id." AND id=".$message_id; |
|
89 | + " WHERE user_receiver_id=".$user_id." AND id=".$message_id; |
|
90 | 90 | |
91 | 91 | $sql_result = Database::query($sql_query); |
92 | 92 | $result = Database::fetch_row($sql_result); |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
108 | 108 | |
109 | 109 | $sql_query = "SELECT id FROM $table_message " . |
110 | - "WHERE user_sender_id=".$user_id." AND msg_status=".MESSAGE_STATUS_OUTBOX." " . |
|
111 | - "ORDER BY send_date LIMIT $from,$number_of_items"; |
|
110 | + "WHERE user_sender_id=".$user_id." AND msg_status=".MESSAGE_STATUS_OUTBOX." " . |
|
111 | + "ORDER BY send_date LIMIT $from,$number_of_items"; |
|
112 | 112 | |
113 | 113 | $sql_result = Database::query($sql_query); |
114 | 114 | $message = "#"; |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
158 | 158 | |
159 | 159 | $sql_query = "SELECT ".$field_table." FROM $table_message " . |
160 | - " WHERE user_sender_id=".$user_id." AND id=".$id; |
|
160 | + " WHERE user_sender_id=".$user_id." AND id=".$id; |
|
161 | 161 | |
162 | 162 | $sql_result = Database::query($sql_query); |
163 | 163 | $result = Database::fetch_row($sql_result); |
@@ -188,11 +188,11 @@ discard block |
||
188 | 188 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
189 | 189 | |
190 | 190 | $query = "INSERT INTO $table_message(user_sender_id, user_receiver_id, msg_status, send_date, title, content, group_id, parent_id, update_date ) ". |
191 | - " VALUES ('$user_sender_id', '$receiver_user_id', '1', '".api_get_utc_datetime()."','$subject','$content','$group_id','$parent_id', '".api_get_utc_datetime()."')"; |
|
191 | + " VALUES ('$user_sender_id', '$receiver_user_id', '1', '".api_get_utc_datetime()."','$subject','$content','$group_id','$parent_id', '".api_get_utc_datetime()."')"; |
|
192 | 192 | $result = Database::query($query); |
193 | 193 | |
194 | 194 | $query = "INSERT INTO $table_message(user_sender_id, user_receiver_id, msg_status, send_date, title, content, group_id, parent_id, update_date ) ". |
195 | - " VALUES ('$user_sender_id', '$receiver_user_id', '4', '".api_get_utc_datetime()."','$subject','$content','$group_id','$parent_id', '".api_get_utc_datetime()."')"; |
|
195 | + " VALUES ('$user_sender_id', '$receiver_user_id', '4', '".api_get_utc_datetime()."','$subject','$content','$group_id','$parent_id', '".api_get_utc_datetime()."')"; |
|
196 | 196 | $result = Database::query($query); |
197 | 197 | |
198 | 198 | $inbox_last_id = Database::insert_id(); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | { |
13 | 13 | public function unreadMessage($username, $password) |
14 | 14 | { |
15 | - if($this->verifyUserPass($username, $password) == "valid") |
|
15 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
16 | 16 | { |
17 | 17 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
18 | 18 | $user_id = UserManager::get_user_id_from_username($username); |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | |
31 | 31 | public function get_message_id($username, $password, $from, $number_of_items) |
32 | 32 | { |
33 | - if($this->verifyUserPass($username, $password) == "valid") |
|
33 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
34 | 34 | { |
35 | 35 | $user_id = UserManager::get_user_id_from_username($username); |
36 | 36 | |
37 | 37 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
38 | 38 | |
39 | - $sql_query = "SELECT id FROM $table_message " . |
|
40 | - " WHERE user_receiver_id=".$user_id." AND msg_status IN (0,1)" . |
|
39 | + $sql_query = "SELECT id FROM $table_message ". |
|
40 | + " WHERE user_receiver_id=".$user_id." AND msg_status IN (0,1)". |
|
41 | 41 | " ORDER BY send_date LIMIT $from,$number_of_items"; |
42 | 42 | |
43 | 43 | $sql_result = Database::query($sql_query); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | public function get_message_data($username, $password, $message_id, $field) |
57 | 57 | { |
58 | - if($this->verifyUserPass($username, $password) == "valid") |
|
58 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
59 | 59 | { |
60 | 60 | $htmlcode = false; |
61 | 61 | $user_id = UserManager::get_user_id_from_username($username); |
@@ -85,14 +85,14 @@ discard block |
||
85 | 85 | |
86 | 86 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
87 | 87 | |
88 | - $sql_query = "SELECT ".$field_table." FROM $table_message " . |
|
88 | + $sql_query = "SELECT ".$field_table." FROM $table_message ". |
|
89 | 89 | " WHERE user_receiver_id=".$user_id." AND id=".$message_id; |
90 | 90 | |
91 | 91 | $sql_result = Database::query($sql_query); |
92 | 92 | $result = Database::fetch_row($sql_result); |
93 | 93 | return (htmlcode) ? html_entity_decode($result[0]) : $result[0]; |
94 | 94 | |
95 | - }else |
|
95 | + } else |
|
96 | 96 | return get_lang('InvalidId'); |
97 | 97 | |
98 | 98 | |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | |
101 | 101 | public function get_message_id_sent($username, $password, $from, $number_of_items) |
102 | 102 | { |
103 | - if($this->verifyUserPass($username, $password) == "valid") |
|
103 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
104 | 104 | { |
105 | 105 | $user_id = UserManager::get_user_id_from_username($username); |
106 | 106 | |
107 | 107 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
108 | 108 | |
109 | - $sql_query = "SELECT id FROM $table_message " . |
|
110 | - "WHERE user_sender_id=".$user_id." AND msg_status=".MESSAGE_STATUS_OUTBOX." " . |
|
109 | + $sql_query = "SELECT id FROM $table_message ". |
|
110 | + "WHERE user_sender_id=".$user_id." AND msg_status=".MESSAGE_STATUS_OUTBOX." ". |
|
111 | 111 | "ORDER BY send_date LIMIT $from,$number_of_items"; |
112 | 112 | |
113 | 113 | $sql_result = Database::query($sql_query); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | public function get_message_data_sent($username, $password, $id, $field) |
128 | 128 | { |
129 | - if($this->verifyUserPass($username, $password) == "valid") |
|
129 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
130 | 130 | { |
131 | 131 | $htmlcode = false; |
132 | 132 | switch ($field) |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
158 | 158 | |
159 | - $sql_query = "SELECT ".$field_table." FROM $table_message " . |
|
159 | + $sql_query = "SELECT ".$field_table." FROM $table_message ". |
|
160 | 160 | " WHERE user_sender_id=".$user_id." AND id=".$id; |
161 | 161 | |
162 | 162 | $sql_result = Database::query($sql_query); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | |
165 | 165 | return (htmlcode) ? html_entity_decode($result[0]) : $result[0]; |
166 | 166 | |
167 | - }else |
|
167 | + } else |
|
168 | 168 | return get_lang('InvalidId'); |
169 | 169 | |
170 | 170 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | public function message_send($username, $password, $receiver_user_id, $subject, $content) |
174 | 174 | { |
175 | 175 | //TODO: verificar data de envio. Esta divergindo de data! |
176 | - if($this->verifyUserPass($username, $password) == "valid") |
|
176 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
177 | 177 | { |
178 | 178 | $group_id = intval(0); |
179 | 179 | $parent_id = intval(0); |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | |
205 | 205 | } |
206 | 206 | |
207 | - protected function set_message_as_read($user_id, $message_id){ |
|
207 | + protected function set_message_as_read($user_id, $message_id) { |
|
208 | 208 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
209 | 209 | $query = "UPDATE $table_message SET msg_status = '".MESSAGE_STATUS_NEW."' WHERE user_receiver_id=".$user_id." AND id='".$message_id."';"; |
210 | 210 | $result = Database::query($query); |
@@ -48,8 +48,9 @@ discard block |
||
48 | 48 | |
49 | 49 | return $message; |
50 | 50 | |
51 | - } else |
|
52 | - return get_lang('InvalidId'); |
|
51 | + } else { |
|
52 | + return get_lang('InvalidId'); |
|
53 | + } |
|
53 | 54 | |
54 | 55 | } |
55 | 56 | |
@@ -92,8 +93,9 @@ discard block |
||
92 | 93 | $result = Database::fetch_row($sql_result); |
93 | 94 | return (htmlcode) ? html_entity_decode($result[0]) : $result[0]; |
94 | 95 | |
95 | - }else |
|
96 | - return get_lang('InvalidId'); |
|
96 | + } else { |
|
97 | + return get_lang('InvalidId'); |
|
98 | + } |
|
97 | 99 | |
98 | 100 | |
99 | 101 | } |
@@ -118,8 +120,9 @@ discard block |
||
118 | 120 | |
119 | 121 | return $message; |
120 | 122 | |
121 | - } else |
|
122 | - return get_lang('InvalidId'); |
|
123 | + } else { |
|
124 | + return get_lang('InvalidId'); |
|
125 | + } |
|
123 | 126 | |
124 | 127 | } |
125 | 128 | |
@@ -164,8 +167,9 @@ discard block |
||
164 | 167 | |
165 | 168 | return (htmlcode) ? html_entity_decode($result[0]) : $result[0]; |
166 | 169 | |
167 | - }else |
|
168 | - return get_lang('InvalidId'); |
|
170 | + } else { |
|
171 | + return get_lang('InvalidId'); |
|
172 | + } |
|
169 | 173 | |
170 | 174 | |
171 | 175 | } |
@@ -199,8 +203,9 @@ discard block |
||
199 | 203 | |
200 | 204 | return $inbox_last_id; |
201 | 205 | |
202 | - } else |
|
203 | - return get_lang('InvalidId'); |
|
206 | + } else { |
|
207 | + return get_lang('InvalidId'); |
|
208 | + } |
|
204 | 209 | |
205 | 210 | } |
206 | 211 |
@@ -137,7 +137,7 @@ |
||
137 | 137 | /** |
138 | 138 | * Get a list of users of which the given conditions match with a LIKE '%cond%' |
139 | 139 | * @param array $conditions a list of condition (exemple : status=>STUDENT) |
140 | - * @param array $order_by a list of fields on which sort |
|
140 | + * @param string[] $order_by a list of fields on which sort |
|
141 | 141 | * @return array An array with all users of the platform. |
142 | 142 | * @todo optional course code parameter, optional sorting parameters... |
143 | 143 | *@todo Use the UserManager class |
@@ -13,21 +13,21 @@ discard block |
||
13 | 13 | |
14 | 14 | public function find_id_user($username, $password, $name) |
15 | 15 | { |
16 | - if ($this->verifyUserPass($username, $password) == "valid") { |
|
16 | + if ($this->verifyUserPass($username, $password) == "valid") { |
|
17 | 17 | $listResult = "#"; |
18 | 18 | |
19 | 19 | $listArrayResult = Array(); |
20 | 20 | $listArray = Array(); |
21 | 21 | |
22 | 22 | $list = $this->get_user_list_like_start(array('firstname'=>$name), array('firstname')); |
23 | - foreach ($list as $userData) { |
|
24 | - $listArray[] = $userData['user_id']; |
|
25 | - } |
|
23 | + foreach ($list as $userData) { |
|
24 | + $listArray[] = $userData['user_id']; |
|
25 | + } |
|
26 | 26 | |
27 | 27 | $list = $this->get_user_list_like_start(array('lastname'=>$name), array('firstname')); |
28 | - foreach ($list as $userData) { |
|
29 | - $listArray[] = $userData['user_id']; |
|
30 | - } |
|
28 | + foreach ($list as $userData) { |
|
29 | + $listArray[] = $userData['user_id']; |
|
30 | + } |
|
31 | 31 | |
32 | 32 | $list = $this->get_user_list_like_start(array('email'=>$name), array('firstname')); |
33 | 33 | foreach ($list as $userData) { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | { |
90 | 90 | global $charset; |
91 | 91 | if ($this->verifyUserPass($username, $password) == "valid") { |
92 | - $user_id = UserManager::get_user_id_from_username($username); |
|
92 | + $user_id = UserManager::get_user_id_from_username($username); |
|
93 | 93 | $message_title = get_lang('Invitation'); |
94 | 94 | $count_is_true = SocialManager::send_invitation_friend($user_id,$userfriend_id, $message_title, $content_message); |
95 | 95 | |
@@ -129,14 +129,14 @@ discard block |
||
129 | 129 | |
130 | 130 | |
131 | 131 | /** |
132 | - * Get a list of users of which the given conditions match with a LIKE '%cond%' |
|
133 | - * @param array $conditions a list of condition (exemple : status=>STUDENT) |
|
134 | - * @param array $order_by a list of fields on which sort |
|
135 | - * @return array An array with all users of the platform. |
|
136 | - * @todo optional course code parameter, optional sorting parameters... |
|
132 | + * Get a list of users of which the given conditions match with a LIKE '%cond%' |
|
133 | + * @param array $conditions a list of condition (exemple : status=>STUDENT) |
|
134 | + * @param array $order_by a list of fields on which sort |
|
135 | + * @return array An array with all users of the platform. |
|
136 | + * @todo optional course code parameter, optional sorting parameters... |
|
137 | 137 | *@todo Use the UserManager class |
138 | 138 | * @todo security filter order by |
139 | - */ |
|
139 | + */ |
|
140 | 140 | private static function get_user_list_like_start($conditions = array(), $order_by = array()) |
141 | 141 | { |
142 | 142 | $user_table = Database :: get_main_table(TABLE_MAIN_USER); |
@@ -91,12 +91,12 @@ |
||
91 | 91 | if ($this->verifyUserPass($username, $password) == "valid") { |
92 | 92 | $user_id = UserManager::get_user_id_from_username($username); |
93 | 93 | $message_title = get_lang('Invitation'); |
94 | - $count_is_true = SocialManager::send_invitation_friend($user_id,$userfriend_id, $message_title, $content_message); |
|
94 | + $count_is_true = SocialManager::send_invitation_friend($user_id, $userfriend_id, $message_title, $content_message); |
|
95 | 95 | |
96 | 96 | if ($count_is_true) { |
97 | - return Display::display_normal_message(api_htmlentities(get_lang('InvitationHasBeenSent'), ENT_QUOTES,$charset),false); |
|
97 | + return Display::display_normal_message(api_htmlentities(get_lang('InvitationHasBeenSent'), ENT_QUOTES, $charset), false); |
|
98 | 98 | } else { |
99 | - return Display::display_error_message(api_htmlentities(get_lang('YouAlreadySentAnInvitation'), ENT_QUOTES,$charset),false); |
|
99 | + return Display::display_error_message(api_htmlentities(get_lang('YouAlreadySentAnInvitation'), ENT_QUOTES, $charset), false); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | return get_lang('InvalidId'); |
@@ -20,6 +20,9 @@ |
||
20 | 20 | |
21 | 21 | define('WS_ERROR_SECRET_KEY', 1); |
22 | 22 | |
23 | +/** |
|
24 | + * @param integer $code |
|
25 | + */ |
|
23 | 26 | function return_error($code) { |
24 | 27 | $fault = null; |
25 | 28 | switch ($code) { |
@@ -581,7 +581,7 @@ |
||
581 | 581 | /*$sessionIdName = isset($params['session_id_name']) ? $params['session_id_name'] : null; |
582 | 582 | $sessionIdValue = isset($params['session_id_value']) ? $params['session_id_value'] : null;*/ |
583 | 583 | |
584 | - $courseInfo = CourseManager::getCourseInfoFromOriginalId( |
|
584 | + $courseInfo = CourseManager::getCourseInfoFromOriginalId( |
|
585 | 585 | $courseIdValue, |
586 | 586 | $courseIdName |
587 | 587 | ); |
@@ -48,19 +48,22 @@ discard block |
||
48 | 48 | list($ip1, $ip2) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); |
49 | 49 | $ip = trim($ip1); |
50 | 50 | } |
51 | - if ($debug) |
|
52 | - error_log("ip: $ip"); |
|
51 | + if ($debug) { |
|
52 | + error_log("ip: $ip"); |
|
53 | + } |
|
53 | 54 | // Check if a file that limits access from webservices exists and contains |
54 | 55 | // the restraining check |
55 | 56 | if (is_file('webservice-auth-ip.conf.php')) { |
56 | 57 | include 'webservice-auth-ip.conf.php'; |
57 | - if ($debug) |
|
58 | - error_log("webservice-auth-ip.conf.php file included"); |
|
58 | + if ($debug) { |
|
59 | + error_log("webservice-auth-ip.conf.php file included"); |
|
60 | + } |
|
59 | 61 | if (!empty($ws_auth_ip)) { |
60 | 62 | $check_ip = true; |
61 | 63 | $ip_matches = api_check_ip_in_range($ip, $ws_auth_ip); |
62 | - if ($debug) |
|
63 | - error_log("ip_matches: $ip_matches"); |
|
64 | + if ($debug) { |
|
65 | + error_log("ip_matches: $ip_matches"); |
|
66 | + } |
|
64 | 67 | } |
65 | 68 | } |
66 | 69 | |
@@ -76,8 +79,9 @@ discard block |
||
76 | 79 | } |
77 | 80 | $result = api_is_valid_secret_key($secret_key, $security_key); |
78 | 81 | //error_log($secret_key.'-'.$security_key); |
79 | - if ($debug) |
|
80 | - error_log('WSHelperVerifyKey result: '.intval($result)); |
|
82 | + if ($debug) { |
|
83 | + error_log('WSHelperVerifyKey result: '.intval($result)); |
|
84 | + } |
|
81 | 85 | return $result; |
82 | 86 | } |
83 | 87 | |
@@ -140,7 +144,9 @@ discard block |
||
140 | 144 | if (!WSHelperVerifyKey($params)) { |
141 | 145 | return return_error(WS_ERROR_SECRET_KEY); |
142 | 146 | } |
143 | - if ($debug) error_log('WSImportLP'); |
|
147 | + if ($debug) { |
|
148 | + error_log('WSImportLP'); |
|
149 | + } |
|
144 | 150 | |
145 | 151 | $courseIdName = $params['course_id_name']; |
146 | 152 | $courseIdValue = $params['course_id_value']; |
@@ -156,7 +162,9 @@ discard block |
||
156 | 162 | $courseId = $courseInfo['real_id']; |
157 | 163 | |
158 | 164 | if (empty($courseInfo)) { |
159 | - if ($debug) error_log('Course not found'); |
|
165 | + if ($debug) { |
|
166 | + error_log('Course not found'); |
|
167 | + } |
|
160 | 168 | return 'Course not found'; |
161 | 169 | } |
162 | 170 | |
@@ -169,7 +177,9 @@ discard block |
||
169 | 177 | |
170 | 178 | if (empty($sessionId)) { |
171 | 179 | |
172 | - if ($debug) error_log('Session not found'); |
|
180 | + if ($debug) { |
|
181 | + error_log('Session not found'); |
|
182 | + } |
|
173 | 183 | return 'Session not found'; |
174 | 184 | } |
175 | 185 | } |
@@ -196,7 +206,9 @@ discard block |
||
196 | 206 | $manifest = $oScorm->import_package($fileInfo, '', $courseInfo); |
197 | 207 | |
198 | 208 | if (!$manifest) { |
199 | - if ($debug) error_log('manifest.xml file not found'); |
|
209 | + if ($debug) { |
|
210 | + error_log('manifest.xml file not found'); |
|
211 | + } |
|
200 | 212 | //if api_set_failure |
201 | 213 | return 'manifest.xml file not found'; |
202 | 214 | } |
@@ -215,10 +227,14 @@ discard block |
||
215 | 227 | $oScorm->set_maker($maker, $courseId); |
216 | 228 | //$oScorm->set_jslib('scorm_api.php'); |
217 | 229 | |
218 | - if ($debug) error_log('scorm was added'); |
|
230 | + if ($debug) { |
|
231 | + error_log('scorm was added'); |
|
232 | + } |
|
219 | 233 | return 1; |
220 | 234 | } else { |
221 | - if ($debug) error_log('manifest data empty'); |
|
235 | + if ($debug) { |
|
236 | + error_log('manifest data empty'); |
|
237 | + } |
|
222 | 238 | return 'manifest data empty'; |
223 | 239 | } |
224 | 240 | } |
@@ -311,7 +327,9 @@ discard block |
||
311 | 327 | ); |
312 | 328 | |
313 | 329 | if (empty($courseInfo)) { |
314 | - if ($debug) error_log("Course not found: $courseIdName : $courseIdValue"); |
|
330 | + if ($debug) { |
|
331 | + error_log("Course not found: $courseIdName : $courseIdValue"); |
|
332 | + } |
|
315 | 333 | return 'Course not found'; |
316 | 334 | } |
317 | 335 | |
@@ -326,7 +344,9 @@ discard block |
||
326 | 344 | |
327 | 345 | if (empty($sessionId)) { |
328 | 346 | |
329 | - if ($debug) error_log('Session not found'); |
|
347 | + if ($debug) { |
|
348 | + error_log('Session not found'); |
|
349 | + } |
|
330 | 350 | return 'Session not found'; |
331 | 351 | } |
332 | 352 | } |
@@ -407,7 +427,9 @@ discard block |
||
407 | 427 | ); |
408 | 428 | |
409 | 429 | if (empty($courseInfo)) { |
410 | - if ($debug) error_log("Course not found: $courseIdName : $courseIdValue"); |
|
430 | + if ($debug) { |
|
431 | + error_log("Course not found: $courseIdName : $courseIdValue"); |
|
432 | + } |
|
411 | 433 | return 'Course not found'; |
412 | 434 | } |
413 | 435 | $courseId = $courseInfo['real_id']; |
@@ -432,7 +454,9 @@ discard block |
||
432 | 454 | |
433 | 455 | $lp = new learnpath($courseCode, $lpId, null); |
434 | 456 | if ($lp) { |
435 | - if ($debug) error_log("LP deleted $lpId"); |
|
457 | + if ($debug) { |
|
458 | + error_log("LP deleted $lpId"); |
|
459 | + } |
|
436 | 460 | |
437 | 461 | $course_dir = $courseInfo['directory'] . '/document'; |
438 | 462 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
@@ -448,7 +472,9 @@ discard block |
||
448 | 472 | if ($item) { |
449 | 473 | $documentId = $item->get_path(); |
450 | 474 | |
451 | - if ($debug) error_log("lp item id found #$itemId"); |
|
475 | + if ($debug) { |
|
476 | + error_log("lp item id found #$itemId"); |
|
477 | + } |
|
452 | 478 | |
453 | 479 | $documentInfo = DocumentManager::get_document_data_by_id( |
454 | 480 | $documentId, |
@@ -474,7 +500,9 @@ discard block |
||
474 | 500 | } |
475 | 501 | } |
476 | 502 | } else { |
477 | - if ($debug) error_log("Document not found #$itemId"); |
|
503 | + if ($debug) { |
|
504 | + error_log("Document not found #$itemId"); |
|
505 | + } |
|
478 | 506 | } |
479 | 507 | } |
480 | 508 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | if ($debug) { |
68 | - error_log("checkip " . intval($check_ip)); |
|
68 | + error_log("checkip ".intval($check_ip)); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | if ($check_ip) { |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | ); |
121 | 121 | |
122 | 122 | // Register the method to expose |
123 | -$server->register('WSImportLP', // method name |
|
124 | - array('params' => 'tns:params'), // input parameters |
|
125 | - array('return' => 'xsd:string'), // output parameters |
|
126 | - 'urn:WSLP', // namespace |
|
127 | - 'urn:WSLP#WSImportLP', // soapaction |
|
128 | - 'rpc', // style |
|
129 | - 'encoded', // use |
|
123 | +$server->register('WSImportLP', // method name |
|
124 | + array('params' => 'tns:params'), // input parameters |
|
125 | + array('return' => 'xsd:string'), // output parameters |
|
126 | + 'urn:WSLP', // namespace |
|
127 | + 'urn:WSLP#WSImportLP', // soapaction |
|
128 | + 'rpc', // style |
|
129 | + 'encoded', // use |
|
130 | 130 | 'This service adds users' // documentation |
131 | 131 | ); |
132 | 132 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | $uniqueFile = uniqid(); |
185 | 185 | $userId = 1; // admin |
186 | - $filePath = api_get_path(SYS_ARCHIVE_PATH) . $uniqueFile; |
|
186 | + $filePath = api_get_path(SYS_ARCHIVE_PATH).$uniqueFile; |
|
187 | 187 | file_put_contents($filePath, $fileData); |
188 | 188 | |
189 | 189 | $fileName = $params['filename']; |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | 'all', |
258 | 258 | '', |
259 | 259 | array( |
260 | - 'id' => array('name' => 'id', 'type' => 'xsd:string'), |
|
261 | - 'name' => array('name' => 'name', 'type' => 'xsd:string'), |
|
260 | + 'id' => array('name' => 'id', 'type' => 'xsd:string'), |
|
261 | + 'name' => array('name' => 'name', 'type' => 'xsd:string'), |
|
262 | 262 | ) |
263 | 263 | ); |
264 | 264 | |
@@ -274,13 +274,13 @@ discard block |
||
274 | 274 | ); |
275 | 275 | |
276 | 276 | // Register the method to expose |
277 | -$server->register('WSGetLpList', // method name |
|
278 | - array('params' => 'tns:paramsGetLpList'), // input parameters |
|
279 | - array('return' => 'tns:lpList'), // output parameters |
|
280 | - 'urn:WSLP', // namespace |
|
281 | - 'urn:WSLP#WSGetLpList', // soapaction |
|
282 | - 'rpc', // style |
|
283 | - 'encoded', // use |
|
277 | +$server->register('WSGetLpList', // method name |
|
278 | + array('params' => 'tns:paramsGetLpList'), // input parameters |
|
279 | + array('return' => 'tns:lpList'), // output parameters |
|
280 | + 'urn:WSLP', // namespace |
|
281 | + 'urn:WSLP#WSGetLpList', // soapaction |
|
282 | + 'rpc', // style |
|
283 | + 'encoded', // use |
|
284 | 284 | 'This service adds users' // documentation |
285 | 285 | ); |
286 | 286 | |
@@ -295,9 +295,9 @@ discard block |
||
295 | 295 | return return_error(WS_ERROR_SECRET_KEY); |
296 | 296 | } |
297 | 297 | |
298 | - require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpathList.class.php'; |
|
299 | - require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpath.class.php'; |
|
300 | - require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpathItem.class.php'; |
|
298 | + require_once api_get_path(SYS_CODE_PATH).'lp/learnpathList.class.php'; |
|
299 | + require_once api_get_path(SYS_CODE_PATH).'lp/learnpath.class.php'; |
|
300 | + require_once api_get_path(SYS_CODE_PATH).'lp/learnpathItem.class.php'; |
|
301 | 301 | |
302 | 302 | $courseIdName = $params['course_id_name']; |
303 | 303 | $courseIdValue = $params['course_id_value']; |
@@ -369,13 +369,13 @@ discard block |
||
369 | 369 | ); |
370 | 370 | |
371 | 371 | // Register the method to expose |
372 | -$server->register('WSDeleteLp', // method name |
|
373 | - array('params' => 'tns:paramsDeleteLp'), // input parameters |
|
374 | - array('return' => 'xsd:string'), // output parameters |
|
375 | - 'urn:WSLP', // namespace |
|
376 | - 'urn:WSLP#WSDeleteLp', // soapaction |
|
377 | - 'rpc', // style |
|
378 | - 'encoded', // use |
|
372 | +$server->register('WSDeleteLp', // method name |
|
373 | + array('params' => 'tns:paramsDeleteLp'), // input parameters |
|
374 | + array('return' => 'xsd:string'), // output parameters |
|
375 | + 'urn:WSLP', // namespace |
|
376 | + 'urn:WSLP#WSDeleteLp', // soapaction |
|
377 | + 'rpc', // style |
|
378 | + 'encoded', // use |
|
379 | 379 | 'This service deletes a LP' // documentation |
380 | 380 | ); |
381 | 381 | |
@@ -390,9 +390,9 @@ discard block |
||
390 | 390 | return return_error(WS_ERROR_SECRET_KEY); |
391 | 391 | } |
392 | 392 | |
393 | - require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpathList.class.php'; |
|
394 | - require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpath.class.php'; |
|
395 | - require_once api_get_path(SYS_CODE_PATH) . 'lp/learnpathItem.class.php'; |
|
393 | + require_once api_get_path(SYS_CODE_PATH).'lp/learnpathList.class.php'; |
|
394 | + require_once api_get_path(SYS_CODE_PATH).'lp/learnpath.class.php'; |
|
395 | + require_once api_get_path(SYS_CODE_PATH).'lp/learnpathItem.class.php'; |
|
396 | 396 | |
397 | 397 | $courseIdName = $params['course_id_name']; |
398 | 398 | $courseIdValue = $params['course_id_value']; |
@@ -434,9 +434,9 @@ discard block |
||
434 | 434 | if ($lp) { |
435 | 435 | if ($debug) error_log("LP deleted $lpId"); |
436 | 436 | |
437 | - $course_dir = $courseInfo['directory'] . '/document'; |
|
437 | + $course_dir = $courseInfo['directory'].'/document'; |
|
438 | 438 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
439 | - $base_work_dir = $sys_course_path . $course_dir; |
|
439 | + $base_work_dir = $sys_course_path.$course_dir; |
|
440 | 440 | |
441 | 441 | $items = $lp->get_flat_ordered_items_list($lpId, 0, $courseId); |
442 | 442 | |
@@ -495,9 +495,9 @@ discard block |
||
495 | 495 | 'all', |
496 | 496 | '', |
497 | 497 | array( |
498 | - 'data' => array('name' => 'data', 'type' => 'xsd:string'), |
|
499 | - 'title' => array('name' => 'title', 'type' => 'xsd:string'), |
|
500 | - 'filename' => array('name' => 'filename', 'type' => 'xsd:string'), |
|
498 | + 'data' => array('name' => 'data', 'type' => 'xsd:string'), |
|
499 | + 'title' => array('name' => 'title', 'type' => 'xsd:string'), |
|
500 | + 'filename' => array('name' => 'filename', 'type' => 'xsd:string'), |
|
501 | 501 | ) |
502 | 502 | ); |
503 | 503 | |
@@ -548,13 +548,13 @@ discard block |
||
548 | 548 | ); |
549 | 549 | |
550 | 550 | // Register the method to expose |
551 | -$server->register('WSCreateLp', // method name |
|
552 | - array('params' => 'tns:paramsCreateLp'), // input parameters |
|
553 | - array('return' => 'xsd:string'), // output parameters |
|
554 | - 'urn:WSLP', // namespace |
|
555 | - 'urn:WSLP#WSCreateLp', // soapaction |
|
556 | - 'rpc', // style |
|
557 | - 'encoded', // use |
|
551 | +$server->register('WSCreateLp', // method name |
|
552 | + array('params' => 'tns:paramsCreateLp'), // input parameters |
|
553 | + array('return' => 'xsd:string'), // output parameters |
|
554 | + 'urn:WSLP', // namespace |
|
555 | + 'urn:WSLP#WSCreateLp', // soapaction |
|
556 | + 'rpc', // style |
|
557 | + 'encoded', // use |
|
558 | 558 | 'This service creates a LP' // documentation |
559 | 559 | ); |
560 | 560 |
@@ -2617,6 +2617,9 @@ |
||
2617 | 2617 | ) |
2618 | 2618 | ); |
2619 | 2619 | |
2620 | +/** |
|
2621 | + * @param string $type |
|
2622 | + */ |
|
2620 | 2623 | function WSHelperActionOnUsers($params, $type) { |
2621 | 2624 | if(!WSHelperVerifyKey($params)) { |
2622 | 2625 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | if ($debug) { |
84 | - error_log("checkip " . intval($check_ip)); |
|
84 | + error_log("checkip ".intval($check_ip)); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | if ($check_ip) { |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | '', |
141 | 141 | 'SOAP-ENC:Array', |
142 | 142 | array(), |
143 | - array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType' => 'tns:extras[]')), |
|
143 | + array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:extras[]')), |
|
144 | 144 | 'tns:extras' |
145 | 145 | ); |
146 | 146 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | '', |
174 | 174 | 'SOAP-ENC:Array', |
175 | 175 | array(), |
176 | - array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType' => 'tns:usersParams[]')), |
|
176 | + array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:usersParams[]')), |
|
177 | 177 | 'tns:usersParams' |
178 | 178 | ); |
179 | 179 | |
@@ -219,13 +219,13 @@ discard block |
||
219 | 219 | ); |
220 | 220 | |
221 | 221 | // Register the method to expose |
222 | -$server->register('WSCreateUsers', // method name |
|
223 | - array('createUsers' => 'tns:createUsers'), // input parameters |
|
224 | - array('return' => 'tns:results_createUsers'), // output parameters |
|
225 | - 'urn:WSRegistration', // namespace |
|
226 | - 'urn:WSRegistration#WSCreateUsers', // soapaction |
|
227 | - 'rpc', // style |
|
228 | - 'encoded', // use |
|
222 | +$server->register('WSCreateUsers', // method name |
|
223 | + array('createUsers' => 'tns:createUsers'), // input parameters |
|
224 | + array('return' => 'tns:results_createUsers'), // output parameters |
|
225 | + 'urn:WSRegistration', // namespace |
|
226 | + 'urn:WSRegistration#WSCreateUsers', // soapaction |
|
227 | + 'rpc', // style |
|
228 | + 'encoded', // use |
|
229 | 229 | 'This service adds a user' // documentation |
230 | 230 | ); |
231 | 231 | |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | continue; |
407 | 407 | } |
408 | 408 | |
409 | - $results[] = $userId; |
|
409 | + $results[] = $userId; |
|
410 | 410 | |
411 | 411 | } // end principal foreach |
412 | 412 | |
@@ -452,13 +452,13 @@ discard block |
||
452 | 452 | |
453 | 453 | |
454 | 454 | // Register the method to expose |
455 | -$server->register('WSCreateUser', // method name |
|
456 | - array('createUser' => 'tns:createUser'), // input parameters |
|
457 | - array('return' => 'xsd:string'), // output parameters |
|
458 | - 'urn:WSRegistration', // namespace |
|
459 | - 'urn:WSRegistration#WSCreateUser', // soapaction |
|
460 | - 'rpc', // style |
|
461 | - 'encoded', // use |
|
455 | +$server->register('WSCreateUser', // method name |
|
456 | + array('createUser' => 'tns:createUser'), // input parameters |
|
457 | + array('return' => 'xsd:string'), // output parameters |
|
458 | + 'urn:WSRegistration', // namespace |
|
459 | + 'urn:WSRegistration#WSCreateUser', // soapaction |
|
460 | + 'rpc', // style |
|
461 | + 'encoded', // use |
|
462 | 462 | 'This service adds a user' // documentation |
463 | 463 | ); |
464 | 464 | |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | } |
562 | 562 | |
563 | 563 | if (isset($original_user_id_name) && isset($original_user_id_value)) { |
564 | - $_SESSION['ws_' . $original_user_id_name] = $original_user_id_value; |
|
564 | + $_SESSION['ws_'.$original_user_id_name] = $original_user_id_value; |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | /** @var User $user */ |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | ); |
610 | 610 | |
611 | 611 | if (isset($original_user_id_name) && isset($original_user_id_value)) { |
612 | - unset($_SESSION['ws_' . $original_user_id_name]); |
|
612 | + unset($_SESSION['ws_'.$original_user_id_name]); |
|
613 | 613 | } |
614 | 614 | |
615 | 615 | if (is_array($extra_list) && count($extra_list) > 0) { |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | 'language' => array('name' => 'language', 'type' => 'xsd:string'), |
662 | 662 | 'phone' => array('name' => 'phone', 'type' => 'xsd:string'), |
663 | 663 | 'expiration_date' => array('name' => 'expiration_date', 'type' => 'xsd:string'), |
664 | - 'official_code' => array('name' => 'official_code', 'type' => 'xsd:string'), |
|
664 | + 'official_code' => array('name' => 'official_code', 'type' => 'xsd:string'), |
|
665 | 665 | 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
666 | 666 | 'original_user_id_value'=> array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
667 | 667 | 'extra' => array('name' => 'extra', 'type' => 'tns:extrasList') |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | 'all', |
690 | 690 | '', |
691 | 691 | array( |
692 | - 'users' => array('name' => 'users', 'type' => 'tns:createUsersPassEncryptParamsList'), |
|
692 | + 'users' => array('name' => 'users', 'type' => 'tns:createUsersPassEncryptParamsList'), |
|
693 | 693 | 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
694 | 694 | ) |
695 | 695 | ); |
@@ -719,13 +719,13 @@ discard block |
||
719 | 719 | ); |
720 | 720 | |
721 | 721 | // Register the method to expose |
722 | -$server->register('WSCreateUsersPasswordCrypted', // method name |
|
722 | +$server->register('WSCreateUsersPasswordCrypted', // method name |
|
723 | 723 | array('createUsersPasswordCrypted' => 'tns:createUsersPasswordCrypted'), // input parameters |
724 | - array('return' => 'tns:results_createUsersPassEncrypt'), // output parameters |
|
725 | - 'urn:WSRegistration', // namespace |
|
726 | - 'urn:WSRegistration#WSCreateUsersPasswordCrypted', // soapaction |
|
727 | - 'rpc', // style |
|
728 | - 'encoded', // use |
|
724 | + array('return' => 'tns:results_createUsersPassEncrypt'), // output parameters |
|
725 | + 'urn:WSRegistration', // namespace |
|
726 | + 'urn:WSRegistration#WSCreateUsersPasswordCrypted', // soapaction |
|
727 | + 'rpc', // style |
|
728 | + 'encoded', // use |
|
729 | 729 | 'This service adds users to the system' // documentation |
730 | 730 | ); |
731 | 731 | |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | |
796 | 796 | if (is_array($extra_list) && count($extra_list) > 0) { |
797 | 797 | foreach ($extra_list as $extra) { |
798 | - if($extra['field_name'] == 'salt') { |
|
798 | + if ($extra['field_name'] == 'salt') { |
|
799 | 799 | $salt = $extra['field_value']; |
800 | 800 | break; |
801 | 801 | } |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | active='1', |
851 | 851 | hr_dept_id=".intval($hr_dept_id); |
852 | 852 | |
853 | - $sql .= " WHERE user_id='".$r_check_user[0]."'"; |
|
853 | + $sql .= " WHERE user_id='".$r_check_user[0]."'"; |
|
854 | 854 | Database::query($sql); |
855 | 855 | |
856 | 856 | if (is_array($extra_list) && count($extra_list) > 0) { |
@@ -989,9 +989,9 @@ discard block |
||
989 | 989 | 'all', |
990 | 990 | '', |
991 | 991 | array( |
992 | - 'user_id' => array('name' => 'course', 'type' => 'xsd:string'), // Chamilo user Id |
|
993 | - 'session_id' => array('name' => 'user_id', 'type' => 'xsd:string'), // Current Session course ID |
|
994 | - 'course_id' =>array('name' => 'courseId', 'type' => 'xsd:string'), // Course Real Id |
|
992 | + 'user_id' => array('name' => 'course', 'type' => 'xsd:string'), // Chamilo user Id |
|
993 | + 'session_id' => array('name' => 'user_id', 'type' => 'xsd:string'), // Current Session course ID |
|
994 | + 'course_id' =>array('name' => 'courseId', 'type' => 'xsd:string'), // Course Real Id |
|
995 | 995 | 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string'), |
996 | 996 | |
997 | 997 | // optional |
@@ -1049,9 +1049,9 @@ discard block |
||
1049 | 1049 | ); |
1050 | 1050 | } |
1051 | 1051 | |
1052 | - if ($debug) error_log('$userId found: '. $userId); |
|
1053 | - if ($debug) error_log('$courseId found: '. $courseId); |
|
1054 | - if ($debug) error_log('$sessionId found: '. $sessionId); |
|
1052 | + if ($debug) error_log('$userId found: '.$userId); |
|
1053 | + if ($debug) error_log('$courseId found: '.$courseId); |
|
1054 | + if ($debug) error_log('$sessionId found: '.$sessionId); |
|
1055 | 1055 | |
1056 | 1056 | return [ |
1057 | 1057 | 'user_id' => $userId, |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | return returnError(WS_ERROR_SECRET_KEY); |
1088 | 1088 | } |
1089 | 1089 | |
1090 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
1090 | + if ($debug) error_log('Params '.print_r($params, 1)); |
|
1091 | 1091 | |
1092 | 1092 | $params = parseCourseSessionUserParams($params); |
1093 | 1093 | |
@@ -1100,13 +1100,13 @@ discard block |
||
1100 | 1100 | $result = 0; |
1101 | 1101 | |
1102 | 1102 | if (!empty($coaches)) { |
1103 | - if ($debug) error_log('Coaches: '. print_r($coaches, 1)); |
|
1103 | + if ($debug) error_log('Coaches: '.print_r($coaches, 1)); |
|
1104 | 1104 | if (in_array($userId, $coaches)) { |
1105 | 1105 | $result = 1; |
1106 | 1106 | } |
1107 | 1107 | } |
1108 | 1108 | |
1109 | - if ($debug) error_log('Result: '. $result); |
|
1109 | + if ($debug) error_log('Result: '.$result); |
|
1110 | 1110 | |
1111 | 1111 | return $result; |
1112 | 1112 | } |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | return returnError(WS_ERROR_SECRET_KEY); |
1139 | 1139 | } |
1140 | 1140 | |
1141 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
1141 | + if ($debug) error_log('Params '.print_r($params, 1)); |
|
1142 | 1142 | |
1143 | 1143 | $params = parseCourseSessionUserParams($params); |
1144 | 1144 | |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | $result = 0; |
1153 | 1153 | |
1154 | 1154 | if (!empty($coaches)) { |
1155 | - if ($debug) error_log('Coaches: ' . print_r($coaches, 1)); |
|
1155 | + if ($debug) error_log('Coaches: '.print_r($coaches, 1)); |
|
1156 | 1156 | if (!in_array($userId, $coaches)) { |
1157 | 1157 | $result = 1; |
1158 | 1158 | } |
@@ -1160,7 +1160,7 @@ discard block |
||
1160 | 1160 | $result = 1; |
1161 | 1161 | } |
1162 | 1162 | |
1163 | - if ($debug) error_log('Final Result: '. $result); |
|
1163 | + if ($debug) error_log('Final Result: '.$result); |
|
1164 | 1164 | |
1165 | 1165 | return $result; |
1166 | 1166 | } |
@@ -1178,32 +1178,32 @@ discard block |
||
1178 | 1178 | 'all', |
1179 | 1179 | '', |
1180 | 1180 | array( |
1181 | - 'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), |
|
1182 | - 'lastname' => array('name' => 'lastname', 'type' => 'xsd:string'), |
|
1183 | - 'status' => array('name' => 'status', 'type' => 'xsd:string'), |
|
1184 | - 'email' => array('name' => 'email', 'type' => 'xsd:string'), |
|
1185 | - 'loginname' => array('name' => 'loginname', 'type' => 'xsd:string'), |
|
1186 | - 'password' => array('name' => 'password', 'type' => 'xsd:string'), //encripted password using the encrypt_method |
|
1187 | - 'encrypt_method' => array('name' => 'encrypt_method', 'type' => 'xsd:string'), |
|
1188 | - 'language' => array('name' => 'language', 'type' => 'xsd:string'), |
|
1189 | - 'phone' => array('name' => 'phone', 'type' => 'xsd:string'), |
|
1190 | - 'expiration_date' => array('name' => 'expiration_date', 'type' => 'xsd:string'), |
|
1191 | - 'official_code' => array('name' => 'official_code', 'type' => 'xsd:string'), |
|
1192 | - 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
1193 | - 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
1194 | - 'extra' => array('name' => 'extra', 'type' => 'tns:extrasList'), |
|
1195 | - 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
1181 | + 'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), |
|
1182 | + 'lastname' => array('name' => 'lastname', 'type' => 'xsd:string'), |
|
1183 | + 'status' => array('name' => 'status', 'type' => 'xsd:string'), |
|
1184 | + 'email' => array('name' => 'email', 'type' => 'xsd:string'), |
|
1185 | + 'loginname' => array('name' => 'loginname', 'type' => 'xsd:string'), |
|
1186 | + 'password' => array('name' => 'password', 'type' => 'xsd:string'), //encripted password using the encrypt_method |
|
1187 | + 'encrypt_method' => array('name' => 'encrypt_method', 'type' => 'xsd:string'), |
|
1188 | + 'language' => array('name' => 'language', 'type' => 'xsd:string'), |
|
1189 | + 'phone' => array('name' => 'phone', 'type' => 'xsd:string'), |
|
1190 | + 'expiration_date' => array('name' => 'expiration_date', 'type' => 'xsd:string'), |
|
1191 | + 'official_code' => array('name' => 'official_code', 'type' => 'xsd:string'), |
|
1192 | + 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
1193 | + 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
1194 | + 'extra' => array('name' => 'extra', 'type' => 'tns:extrasList'), |
|
1195 | + 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
1196 | 1196 | ) |
1197 | 1197 | ); |
1198 | 1198 | |
1199 | 1199 | // Register the method to expose |
1200 | -$server->register('WSCreateUserPasswordCrypted', // method name |
|
1201 | - array('createUserPasswordCrypted' => 'tns:createUserPasswordCrypted'), // input parameters |
|
1202 | - array('return' => 'xsd:string'), // output parameters |
|
1203 | - 'urn:WSRegistration', // namespace |
|
1204 | - 'urn:WSRegistration#WSCreateUserPasswordCrypted', // soapaction |
|
1205 | - 'rpc', // style |
|
1206 | - 'encoded', // use |
|
1200 | +$server->register('WSCreateUserPasswordCrypted', // method name |
|
1201 | + array('createUserPasswordCrypted' => 'tns:createUserPasswordCrypted'), // input parameters |
|
1202 | + array('return' => 'xsd:string'), // output parameters |
|
1203 | + 'urn:WSRegistration', // namespace |
|
1204 | + 'urn:WSRegistration#WSCreateUserPasswordCrypted', // soapaction |
|
1205 | + 'rpc', // style |
|
1206 | + 'encoded', // use |
|
1207 | 1207 | 'This service adds users' // documentation |
1208 | 1208 | ); |
1209 | 1209 | |
@@ -1213,7 +1213,7 @@ discard block |
||
1213 | 1213 | global $_user, $_configuration, $debug; |
1214 | 1214 | $debug = 1; |
1215 | 1215 | if ($debug) error_log('WSCreateUserPasswordCrypted'); |
1216 | - if ($debug) error_log(print_r($params,1)); |
|
1216 | + if ($debug) error_log(print_r($params, 1)); |
|
1217 | 1217 | |
1218 | 1218 | if (!WSHelperVerifyKey($params)) { |
1219 | 1219 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -1242,7 +1242,7 @@ discard block |
||
1242 | 1242 | $extra_list = isset($params['extra']) ? $params['extra'] : ''; |
1243 | 1243 | |
1244 | 1244 | if (!empty($_configuration['password_encryption'])) { |
1245 | - if ($_configuration['password_encryption'] === $encrypt_method ) { |
|
1245 | + if ($_configuration['password_encryption'] === $encrypt_method) { |
|
1246 | 1246 | if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) { |
1247 | 1247 | $msg = "Encryption $encrypt_method is invalid"; |
1248 | 1248 | if ($debug) error_log($msg); |
@@ -1304,7 +1304,7 @@ discard block |
||
1304 | 1304 | if (!is_null($auth_source)) { |
1305 | 1305 | $sql .= " auth_source='".Database::escape_string($auth_source)."',"; |
1306 | 1306 | } |
1307 | - $sql .= " |
|
1307 | + $sql .= " |
|
1308 | 1308 | password='".Database::escape_string($password)."', |
1309 | 1309 | email='".Database::escape_string($email)."', |
1310 | 1310 | status='".Database::escape_string($status)."', |
@@ -1495,13 +1495,13 @@ discard block |
||
1495 | 1495 | ); |
1496 | 1496 | |
1497 | 1497 | // Register the method to expose |
1498 | -$server->register('WSEditUserCredentials', // method name |
|
1499 | - array('editUserCredentials' => 'tns:editUserCredentials'), // input parameters |
|
1500 | - array('return' => 'xsd:string'), // output parameters |
|
1501 | - 'urn:WSRegistration', // namespace |
|
1502 | - 'urn:WSRegistration#WSEditUserCredentials', // soapaction |
|
1503 | - 'rpc', // style |
|
1504 | - 'encoded', // use |
|
1498 | +$server->register('WSEditUserCredentials', // method name |
|
1499 | + array('editUserCredentials' => 'tns:editUserCredentials'), // input parameters |
|
1500 | + array('return' => 'xsd:string'), // output parameters |
|
1501 | + 'urn:WSRegistration', // namespace |
|
1502 | + 'urn:WSRegistration#WSEditUserCredentials', // soapaction |
|
1503 | + 'rpc', // style |
|
1504 | + 'encoded', // use |
|
1505 | 1505 | 'This service edits the username and password of a user' // documentation |
1506 | 1506 | ); |
1507 | 1507 | |
@@ -1600,13 +1600,13 @@ discard block |
||
1600 | 1600 | ); |
1601 | 1601 | |
1602 | 1602 | // Register the method to expose |
1603 | -$server->register('WSEditUsers', // method name |
|
1604 | - array('editUsers' => 'tns:editUsers'), // input parameters |
|
1603 | +$server->register('WSEditUsers', // method name |
|
1604 | + array('editUsers' => 'tns:editUsers'), // input parameters |
|
1605 | 1605 | array('return' => 'tns:results_editUsers'), // output parameters |
1606 | - 'urn:WSRegistration', // namespace |
|
1607 | - 'urn:WSRegistration#WSEditUsers', // soapaction |
|
1608 | - 'rpc', // style |
|
1609 | - 'encoded', // use |
|
1606 | + 'urn:WSRegistration', // namespace |
|
1607 | + 'urn:WSRegistration#WSEditUsers', // soapaction |
|
1608 | + 'rpc', // style |
|
1609 | + 'encoded', // use |
|
1610 | 1610 | 'This service edits a user from wiener' // documentation |
1611 | 1611 | ); |
1612 | 1612 | |
@@ -1791,13 +1791,13 @@ discard block |
||
1791 | 1791 | ); |
1792 | 1792 | |
1793 | 1793 | // Register the method to expose |
1794 | -$server->register('WSEditUser', // method name |
|
1795 | - array('editUser' => 'tns:editUser'), // input parameters |
|
1796 | - array('return' => 'xsd:string'), // output parameters |
|
1797 | - 'urn:WSRegistration', // namespace |
|
1798 | - 'urn:WSRegistration#WSEditUser', // soapaction |
|
1799 | - 'rpc', // style |
|
1800 | - 'encoded', // use |
|
1794 | +$server->register('WSEditUser', // method name |
|
1795 | + array('editUser' => 'tns:editUser'), // input parameters |
|
1796 | + array('return' => 'xsd:string'), // output parameters |
|
1797 | + 'urn:WSRegistration', // namespace |
|
1798 | + 'urn:WSRegistration#WSEditUser', // soapaction |
|
1799 | + 'rpc', // style |
|
1800 | + 'encoded', // use |
|
1801 | 1801 | 'This service edits a user from wiener' // documentation |
1802 | 1802 | ); |
1803 | 1803 | |
@@ -1964,13 +1964,13 @@ discard block |
||
1964 | 1964 | ); |
1965 | 1965 | |
1966 | 1966 | // Register the method to expose |
1967 | -$server->register('WSEditUserWithPicture', // method name |
|
1968 | - array('editUserWithPicture' => 'tns:editUserWithPicture'), // input parameters |
|
1969 | - array('return' => 'xsd:string'), // output parameters |
|
1970 | - 'urn:WSRegistration', // namespace |
|
1971 | - 'urn:WSRegistration#WSEditUserWithPicture', // soapaction |
|
1972 | - 'rpc', // style |
|
1973 | - 'encoded', // use |
|
1967 | +$server->register('WSEditUserWithPicture', // method name |
|
1968 | + array('editUserWithPicture' => 'tns:editUserWithPicture'), // input parameters |
|
1969 | + array('return' => 'xsd:string'), // output parameters |
|
1970 | + 'urn:WSRegistration', // namespace |
|
1971 | + 'urn:WSRegistration#WSEditUserWithPicture', // soapaction |
|
1972 | + 'rpc', // style |
|
1973 | + 'encoded', // use |
|
1974 | 1974 | 'This service edits a user from wiener' // documentation |
1975 | 1975 | ); |
1976 | 1976 | |
@@ -2024,8 +2024,8 @@ discard block |
||
2024 | 2024 | $tempDir = api_get_path(SYS_ARCHIVE_PATH); |
2025 | 2025 | // Make sure the file download was OK by checking the HTTP headers for OK |
2026 | 2026 | if (strpos(get_headers($picture_url)[0], "OK")) { |
2027 | - file_put_contents($tempDir . $filename, file_get_contents($picture_url)); |
|
2028 | - $pictureUri = UserManager::update_user_picture($user_id, $filename, $tempDir . $filename); |
|
2027 | + file_put_contents($tempDir.$filename, file_get_contents($picture_url)); |
|
2028 | + $pictureUri = UserManager::update_user_picture($user_id, $filename, $tempDir.$filename); |
|
2029 | 2029 | } |
2030 | 2030 | |
2031 | 2031 | if ($user_id == 0) { |
@@ -2187,13 +2187,13 @@ discard block |
||
2187 | 2187 | ); |
2188 | 2188 | |
2189 | 2189 | // Register the method to expose |
2190 | -$server->register('WSEditUsersPasswordCrypted', // method name |
|
2191 | - array('editUsersPasswordCrypted' => 'tns:editUsersPasswordCrypted'), // input parameters |
|
2192 | - array('return' => 'tns:results_editUsersPasswordCrypted'), // output parameters |
|
2193 | - 'urn:WSRegistration', // namespace |
|
2194 | - 'urn:WSRegistration#WSEditUsersPasswordCrypted', // soapaction |
|
2195 | - 'rpc', // style |
|
2196 | - 'encoded', // use |
|
2190 | +$server->register('WSEditUsersPasswordCrypted', // method name |
|
2191 | + array('editUsersPasswordCrypted' => 'tns:editUsersPasswordCrypted'), // input parameters |
|
2192 | + array('return' => 'tns:results_editUsersPasswordCrypted'), // output parameters |
|
2193 | + 'urn:WSRegistration', // namespace |
|
2194 | + 'urn:WSRegistration#WSEditUsersPasswordCrypted', // soapaction |
|
2195 | + 'rpc', // style |
|
2196 | + 'encoded', // use |
|
2197 | 2197 | 'This service edits a user' // documentation |
2198 | 2198 | ); |
2199 | 2199 | |
@@ -2237,7 +2237,7 @@ discard block |
||
2237 | 2237 | |
2238 | 2238 | $password = $user_param['password']; |
2239 | 2239 | $encrypt_method = $user_param['encrypt_method']; |
2240 | - if ($_configuration['password_encryption'] === $encrypt_method ) { |
|
2240 | + if ($_configuration['password_encryption'] === $encrypt_method) { |
|
2241 | 2241 | if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) { |
2242 | 2242 | $msg = "Encryption $encrypt_method is invalid"; |
2243 | 2243 | $results[] = $msg; |
@@ -2252,11 +2252,11 @@ discard block |
||
2252 | 2252 | $results[] = $msg; |
2253 | 2253 | continue; |
2254 | 2254 | } |
2255 | - } elseif (!empty($user_param['password']) && empty($user_param['encrypt_method'])){ |
|
2255 | + } elseif (!empty($user_param['password']) && empty($user_param['encrypt_method'])) { |
|
2256 | 2256 | $msg = "If password is not empty the encrypt_method param is required "; |
2257 | 2257 | $results[] = $msg; |
2258 | 2258 | continue; |
2259 | - } elseif (empty($user_param['password']) && !empty($user_param['encrypt_method'])){ |
|
2259 | + } elseif (empty($user_param['password']) && !empty($user_param['encrypt_method'])) { |
|
2260 | 2260 | $msg = "If encrypt_method is not empty the password param is required "; |
2261 | 2261 | $results[] = $msg; |
2262 | 2262 | continue; |
@@ -2392,13 +2392,13 @@ discard block |
||
2392 | 2392 | ); |
2393 | 2393 | |
2394 | 2394 | // Register the method to expose |
2395 | -$server->register('WSEditUserPasswordCrypted', // method name |
|
2395 | +$server->register('WSEditUserPasswordCrypted', // method name |
|
2396 | 2396 | array('editUserPasswordCrypted' => 'tns:editUserPasswordCrypted'), // input parameters |
2397 | - array('return' => 'xsd:string'), // output parameters |
|
2398 | - 'urn:WSRegistration', // namespace |
|
2399 | - 'urn:WSRegistration#WSEditUserPasswordCrypted', // soapaction |
|
2400 | - 'rpc', // style |
|
2401 | - 'encoded', // use |
|
2397 | + array('return' => 'xsd:string'), // output parameters |
|
2398 | + 'urn:WSRegistration', // namespace |
|
2399 | + 'urn:WSRegistration#WSEditUserPasswordCrypted', // soapaction |
|
2400 | + 'rpc', // style |
|
2401 | + 'encoded', // use |
|
2402 | 2402 | 'This service edits a user' // documentation |
2403 | 2403 | ); |
2404 | 2404 | |
@@ -2442,7 +2442,7 @@ discard block |
||
2442 | 2442 | if (!empty($params['password']) && !empty($params['encrypt_method'])) { |
2443 | 2443 | $password = $params['password']; |
2444 | 2444 | $encrypt_method = $params['encrypt_method']; |
2445 | - if ($_configuration['password_encryption'] === $encrypt_method ) { |
|
2445 | + if ($_configuration['password_encryption'] === $encrypt_method) { |
|
2446 | 2446 | if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) { |
2447 | 2447 | $msg = "Encryption $encrypt_method is invalid"; |
2448 | 2448 | return $msg; |
@@ -2612,7 +2612,7 @@ discard block |
||
2612 | 2612 | '', |
2613 | 2613 | 'SOAP-ENC:Array', |
2614 | 2614 | array(), |
2615 | - array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType' => 'tns:user_id[]')),'tns:user_id' |
|
2615 | + array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:user_id[]')), 'tns:user_id' |
|
2616 | 2616 | ); |
2617 | 2617 | |
2618 | 2618 | $server->wsdl->addComplexType( |
@@ -2636,7 +2636,7 @@ discard block |
||
2636 | 2636 | $orig_user_id_value = array(); |
2637 | 2637 | |
2638 | 2638 | $original_user_ids = $params['ids']; |
2639 | - foreach($original_user_ids as $original_user_id) { |
|
2639 | + foreach ($original_user_ids as $original_user_id) { |
|
2640 | 2640 | $result = false; |
2641 | 2641 | $orig_user_id_value[] = $original_user_id['original_user_id_value']; |
2642 | 2642 | $user_id = UserManager::get_user_id_from_original_id( |
@@ -2646,13 +2646,13 @@ discard block |
||
2646 | 2646 | if ($user_id > 0) { |
2647 | 2647 | if ($type == "delete") { |
2648 | 2648 | $result = UserManager::delete_user($user_id); |
2649 | - } else if($type == "disable") { |
|
2649 | + } else if ($type == "disable") { |
|
2650 | 2650 | $result = UserManager::disable($user_id); |
2651 | - } else if($type == "enable") { |
|
2651 | + } else if ($type == "enable") { |
|
2652 | 2652 | $result = UserManager::enable($user_id); |
2653 | 2653 | } |
2654 | 2654 | } |
2655 | - $results[] = $result?1:0; |
|
2655 | + $results[] = $result ? 1 : 0; |
|
2656 | 2656 | } |
2657 | 2657 | |
2658 | 2658 | |
@@ -2668,13 +2668,13 @@ discard block |
||
2668 | 2668 | return $output; |
2669 | 2669 | } |
2670 | 2670 | |
2671 | -$server->register('WSDeleteUsers', // method name |
|
2672 | - array('user_ids' => 'tns:user_ids'), // input parameters |
|
2673 | - array('return' => 'tns:results_actionUsers'), // output parameters |
|
2674 | - 'urn:WSRegistration', // namespace |
|
2675 | - 'urn:WSRegistration#WSDeleteUsers', // soapaction |
|
2676 | - 'rpc', // style |
|
2677 | - 'encoded', // use |
|
2671 | +$server->register('WSDeleteUsers', // method name |
|
2672 | + array('user_ids' => 'tns:user_ids'), // input parameters |
|
2673 | + array('return' => 'tns:results_actionUsers'), // output parameters |
|
2674 | + 'urn:WSRegistration', // namespace |
|
2675 | + 'urn:WSRegistration#WSDeleteUsers', // soapaction |
|
2676 | + 'rpc', // style |
|
2677 | + 'encoded', // use |
|
2678 | 2678 | 'Deletes users provided as parameters from the system' // documentation |
2679 | 2679 | ); |
2680 | 2680 | |
@@ -2683,13 +2683,13 @@ discard block |
||
2683 | 2683 | } |
2684 | 2684 | |
2685 | 2685 | /** WSDisableUsers **/ |
2686 | -$server->register('WSDisableUsers', // method name |
|
2687 | - array('user_ids' => 'tns:user_ids'), // input parameters |
|
2688 | - array('return' => 'tns:results_actionUsers'), // output parameters |
|
2689 | - 'urn:WSRegistration', // namespace |
|
2690 | - 'urn:WSRegistration#WSDisableUsers', // soapaction |
|
2691 | - 'rpc', // style |
|
2692 | - 'encoded', // use |
|
2686 | +$server->register('WSDisableUsers', // method name |
|
2687 | + array('user_ids' => 'tns:user_ids'), // input parameters |
|
2688 | + array('return' => 'tns:results_actionUsers'), // output parameters |
|
2689 | + 'urn:WSRegistration', // namespace |
|
2690 | + 'urn:WSRegistration#WSDisableUsers', // soapaction |
|
2691 | + 'rpc', // style |
|
2692 | + 'encoded', // use |
|
2693 | 2693 | 'Disables users provided as parameters from the system' // documentation |
2694 | 2694 | ); |
2695 | 2695 | |
@@ -2698,13 +2698,13 @@ discard block |
||
2698 | 2698 | } |
2699 | 2699 | |
2700 | 2700 | /** WSEnableUsers **/ |
2701 | -$server->register('WSEnableUsers', // method name |
|
2702 | - array('user_ids' => 'tns:user_ids'), // input parameters |
|
2703 | - array('return' => 'tns:results_actionUsers'), // output parameters |
|
2704 | - 'urn:WSRegistration', // namespace |
|
2705 | - 'urn:WSRegistration#WSEnableUsers', // soapaction |
|
2706 | - 'rpc', // style |
|
2707 | - 'encoded', // use |
|
2701 | +$server->register('WSEnableUsers', // method name |
|
2702 | + array('user_ids' => 'tns:user_ids'), // input parameters |
|
2703 | + array('return' => 'tns:results_actionUsers'), // output parameters |
|
2704 | + 'urn:WSRegistration', // namespace |
|
2705 | + 'urn:WSRegistration#WSEnableUsers', // soapaction |
|
2706 | + 'rpc', // style |
|
2707 | + 'encoded', // use |
|
2708 | 2708 | 'Enables users provided as parameters' // documentation |
2709 | 2709 | ); |
2710 | 2710 | |
@@ -2757,7 +2757,7 @@ discard block |
||
2757 | 2757 | '', |
2758 | 2758 | 'SOAP-ENC:Array', |
2759 | 2759 | array(), |
2760 | - array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType' => 'tns:createCourseParams[]')),'tns:createCourseParams' |
|
2760 | + array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:createCourseParams[]')), 'tns:createCourseParams' |
|
2761 | 2761 | ); |
2762 | 2762 | |
2763 | 2763 | // Register the data structures used by the service |
@@ -2798,13 +2798,13 @@ discard block |
||
2798 | 2798 | ); |
2799 | 2799 | |
2800 | 2800 | // Register the method to expose |
2801 | -$server->register('WSCreateCourse', // method name |
|
2802 | - array('createCourse' => 'tns:createCourse'), // input parameters |
|
2801 | +$server->register('WSCreateCourse', // method name |
|
2802 | + array('createCourse' => 'tns:createCourse'), // input parameters |
|
2803 | 2803 | array('return' => 'tns:results_createCourse'), // output parameters |
2804 | - 'urn:WSRegistration', // namespace |
|
2805 | - 'urn:WSRegistration#WSCreateCourse', // soapaction |
|
2806 | - 'rpc', // style |
|
2807 | - 'encoded', // use |
|
2804 | + 'urn:WSRegistration', // namespace |
|
2805 | + 'urn:WSRegistration#WSCreateCourse', // soapaction |
|
2806 | + 'rpc', // style |
|
2807 | + 'encoded', // use |
|
2808 | 2808 | 'This service adds a course' // documentation |
2809 | 2809 | ); |
2810 | 2810 | |
@@ -2862,7 +2862,7 @@ discard block |
||
2862 | 2862 | category_code='".Database::escape_string($category_code)."', |
2863 | 2863 | tutor_name='".Database::escape_string($tutor_name)."', |
2864 | 2864 | visual_code='".Database::escape_string($wanted_code)."'"; |
2865 | - if($visibility !== null) { |
|
2865 | + if ($visibility !== null) { |
|
2866 | 2866 | $sql .= ", visibility = '$visibility' "; |
2867 | 2867 | } |
2868 | 2868 | $sql .= " WHERE id='".$courseInfo['real_id']."'"; |
@@ -2895,7 +2895,7 @@ discard block |
||
2895 | 2895 | $params['title'] = $title; |
2896 | 2896 | $params['wanted_code'] = $wanted_code; |
2897 | 2897 | $params['category_code'] = $category_code; |
2898 | - $params['course_category'] = $category_code; |
|
2898 | + $params['course_category'] = $category_code; |
|
2899 | 2899 | $params['tutor_name'] = $tutor_name; |
2900 | 2900 | $params['course_language'] = $course_language; |
2901 | 2901 | $params['user_id'] = api_get_user_id(); |
@@ -3033,13 +3033,13 @@ discard block |
||
3033 | 3033 | |
3034 | 3034 | |
3035 | 3035 | // Register the method to expose |
3036 | -$server->register('WSCreateCourseByTitle', // method name |
|
3036 | +$server->register('WSCreateCourseByTitle', // method name |
|
3037 | 3037 | array('createCourseByTitle' => 'tns:createCourseByTitle'), // input parameters |
3038 | - array('return' => 'tns:results_createCourseByTitle'), // output parameters |
|
3039 | - 'urn:WSRegistration', // namespace |
|
3040 | - 'urn:WSRegistration#WSCreateCourseByTitle', // soapaction |
|
3041 | - 'rpc', // style |
|
3042 | - 'encoded', // use |
|
3038 | + array('return' => 'tns:results_createCourseByTitle'), // output parameters |
|
3039 | + 'urn:WSRegistration', // namespace |
|
3040 | + 'urn:WSRegistration#WSCreateCourseByTitle', // soapaction |
|
3041 | + 'rpc', // style |
|
3042 | + 'encoded', // use |
|
3043 | 3043 | 'This service adds a course by title' // documentation |
3044 | 3044 | ); |
3045 | 3045 | |
@@ -3270,18 +3270,18 @@ discard block |
||
3270 | 3270 | ); |
3271 | 3271 | |
3272 | 3272 | // Register the method to expose |
3273 | -$server->register('WSEditCourse', // method name |
|
3274 | - array('editCourse' => 'tns:editCourse'), // input parameters |
|
3273 | +$server->register('WSEditCourse', // method name |
|
3274 | + array('editCourse' => 'tns:editCourse'), // input parameters |
|
3275 | 3275 | array('return' => 'tns:results_editCourse'), // output parameters |
3276 | - 'urn:WSRegistration', // namespace |
|
3277 | - 'urn:WSRegistration#WSEditCourse', // soapaction |
|
3278 | - 'rpc', // style |
|
3279 | - 'encoded', // use |
|
3276 | + 'urn:WSRegistration', // namespace |
|
3277 | + 'urn:WSRegistration#WSEditCourse', // soapaction |
|
3278 | + 'rpc', // style |
|
3279 | + 'encoded', // use |
|
3280 | 3280 | 'This service edits a course' // documentation |
3281 | 3281 | ); |
3282 | 3282 | |
3283 | 3283 | // Define the method WSEditCourse |
3284 | -function WSEditCourse($params){ |
|
3284 | +function WSEditCourse($params) { |
|
3285 | 3285 | |
3286 | 3286 | global $_configuration; |
3287 | 3287 | if (!WSHelperVerifyKey($params)) { |
@@ -3436,13 +3436,13 @@ discard block |
||
3436 | 3436 | |
3437 | 3437 | |
3438 | 3438 | // Register the method to expose |
3439 | -$server->register('WSCourseDescription', // method name |
|
3440 | - array('courseDescription' => 'tns:courseDescription'), // input parameters |
|
3441 | - array('return' => 'tns:fields_course_desc_list'), // output parameters |
|
3442 | - 'urn:WSRegistration', // namespace |
|
3443 | - 'urn:WSRegistration#WSCourseDescription', // soapaction |
|
3444 | - 'rpc', // style |
|
3445 | - 'encoded', // use |
|
3439 | +$server->register('WSCourseDescription', // method name |
|
3440 | + array('courseDescription' => 'tns:courseDescription'), // input parameters |
|
3441 | + array('return' => 'tns:fields_course_desc_list'), // output parameters |
|
3442 | + 'urn:WSRegistration', // namespace |
|
3443 | + 'urn:WSRegistration#WSCourseDescription', // soapaction |
|
3444 | + 'rpc', // style |
|
3445 | + 'encoded', // use |
|
3446 | 3446 | 'This service edits a course description' // documentation |
3447 | 3447 | ); |
3448 | 3448 | |
@@ -3492,7 +3492,7 @@ discard block |
||
3492 | 3492 | } |
3493 | 3493 | |
3494 | 3494 | while ($row = Database::fetch_array($result)) { |
3495 | - $ind = (int)$row['id']; |
|
3495 | + $ind = (int) $row['id']; |
|
3496 | 3496 | $array_course_desc_title[$ind] = $row['title']; |
3497 | 3497 | $array_course_desc_content[$ind] = $row['content']; |
3498 | 3498 | } |
@@ -3579,13 +3579,13 @@ discard block |
||
3579 | 3579 | |
3580 | 3580 | |
3581 | 3581 | // Register the method to expose |
3582 | -$server->register('WSEditCourseDescription', // method name |
|
3582 | +$server->register('WSEditCourseDescription', // method name |
|
3583 | 3583 | array('editCourseDescription' => 'tns:editCourseDescription'), // input parameters |
3584 | - array('return' => 'tns:results_editCourseDescription'), // output parameters |
|
3585 | - 'urn:WSRegistration', // namespace |
|
3586 | - 'urn:WSRegistration#WSEditCourseDescription', // soapaction |
|
3587 | - 'rpc', // style |
|
3588 | - 'encoded', // use |
|
3584 | + array('return' => 'tns:results_editCourseDescription'), // output parameters |
|
3585 | + 'urn:WSRegistration', // namespace |
|
3586 | + 'urn:WSRegistration#WSEditCourseDescription', // soapaction |
|
3587 | + 'rpc', // style |
|
3588 | + 'encoded', // use |
|
3589 | 3589 | 'This service edits a course description' // documentation |
3590 | 3590 | ); |
3591 | 3591 | |
@@ -3627,7 +3627,7 @@ discard block |
||
3627 | 3627 | $course_desc_title = Database::escape_string($course_desc_title); |
3628 | 3628 | $course_desc_content = Database::escape_string($course_desc_content); |
3629 | 3629 | |
3630 | - $course_desc_id = (int)$course_desc_id; |
|
3630 | + $course_desc_id = (int) $course_desc_id; |
|
3631 | 3631 | if ($course_desc_id > 8 && $course_desc_id < 1) { |
3632 | 3632 | $results[] = 0; // course_desc_id invalid. |
3633 | 3633 | continue; |
@@ -3656,7 +3656,7 @@ discard block |
||
3656 | 3656 | $result = $courseDescription->insert(); |
3657 | 3657 | } |
3658 | 3658 | |
3659 | - $results[] = $result?1:0; |
|
3659 | + $results[] = $result ? 1 : 0; |
|
3660 | 3660 | } // end principal foreach |
3661 | 3661 | |
3662 | 3662 | $count_results = count($results); |
@@ -3734,13 +3734,13 @@ discard block |
||
3734 | 3734 | 'tns:result_deleteCourse' |
3735 | 3735 | ); |
3736 | 3736 | |
3737 | -$server->register('WSDeleteCourse', // method name |
|
3738 | - array('deleteCourse' => 'tns:deleteCourse'), // input parameters |
|
3737 | +$server->register('WSDeleteCourse', // method name |
|
3738 | + array('deleteCourse' => 'tns:deleteCourse'), // input parameters |
|
3739 | 3739 | array('return' => 'tns:results_deleteCourse'), // output parameters |
3740 | - 'urn:WSRegistration', // namespace |
|
3741 | - 'urn:WSRegistration#WSDeleteCourse', // soapaction |
|
3742 | - 'rpc', // style |
|
3743 | - 'encoded', // use |
|
3740 | + 'urn:WSRegistration', // namespace |
|
3741 | + 'urn:WSRegistration#WSDeleteCourse', // soapaction |
|
3742 | + 'rpc', // style |
|
3743 | + 'encoded', // use |
|
3744 | 3744 | 'This service deletes a course ' // documentation |
3745 | 3745 | ); |
3746 | 3746 | |
@@ -3867,13 +3867,13 @@ discard block |
||
3867 | 3867 | ); |
3868 | 3868 | |
3869 | 3869 | // Register the method to expose |
3870 | -$server->register('WSCreateSession', // method name |
|
3871 | - array('createSession' => 'tns:createSession'), // input parameters |
|
3870 | +$server->register('WSCreateSession', // method name |
|
3871 | + array('createSession' => 'tns:createSession'), // input parameters |
|
3872 | 3872 | array('return' => 'tns:results_createSession'), // output parameters |
3873 | - 'urn:WSRegistration', // namespace |
|
3874 | - 'urn:WSRegistration#WSCreateSession', // soapaction |
|
3875 | - 'rpc', // style |
|
3876 | - 'encoded', // use |
|
3873 | + 'urn:WSRegistration', // namespace |
|
3874 | + 'urn:WSRegistration#WSCreateSession', // soapaction |
|
3875 | + 'rpc', // style |
|
3876 | + 'encoded', // use |
|
3877 | 3877 | 'This service edits a session' // documentation |
3878 | 3878 | ); |
3879 | 3879 | |
@@ -3927,8 +3927,8 @@ discard block |
||
3927 | 3927 | } |
3928 | 3928 | |
3929 | 3929 | if (empty($nolimit)) { |
3930 | - $date_start = "$year_start-".(($month_start < 10)?"0$month_start":$month_start)."-".(($day_start < 10)?"0$day_start":$day_start) . ' 00:00:00'; |
|
3931 | - $date_end = "$year_end-".(($month_end < 10)?"0$month_end":$month_end)."-".(($day_end < 10)?"0$day_end":$day_end) . ' 23:59:59'; |
|
3930 | + $date_start = "$year_start-".(($month_start < 10) ? "0$month_start" : $month_start)."-".(($day_start < 10) ? "0$day_start" : $day_start).' 00:00:00'; |
|
3931 | + $date_end = "$year_end-".(($month_end < 10) ? "0$month_end" : $month_end)."-".(($day_end < 10) ? "0$day_end" : $day_end).' 23:59:59'; |
|
3932 | 3932 | } else { |
3933 | 3933 | $date_start = ""; |
3934 | 3934 | $date_end = ""; |
@@ -3952,7 +3952,7 @@ discard block |
||
3952 | 3952 | } |
3953 | 3953 | $results[] = 0; |
3954 | 3954 | continue; |
3955 | - } elseif (empty($nolimit) && (!$month_end || !$day_end || !$year_end || !checkdate($month_end, $day_end, $year_end))) { |
|
3955 | + } elseif (empty($nolimit) && (!$month_end || !$day_end || !$year_end || !checkdate($month_end, $day_end, $year_end))) { |
|
3956 | 3956 | $results[] = 0; |
3957 | 3957 | if ($debug) { |
3958 | 3958 | error_log("There's an error with the end date: $month_end - $day_end - $year_end"); |
@@ -4141,13 +4141,13 @@ discard block |
||
4141 | 4141 | |
4142 | 4142 | |
4143 | 4143 | // Register the method to expose |
4144 | -$server->register('WSEditSession', // method name |
|
4145 | - array('editSession' => 'tns:editSession'), // input parameters |
|
4144 | +$server->register('WSEditSession', // method name |
|
4145 | + array('editSession' => 'tns:editSession'), // input parameters |
|
4146 | 4146 | array('return' => 'tns:results_editSession'), // output parameters |
4147 | - 'urn:WSRegistration', // namespace |
|
4148 | - 'urn:WSRegistration#WSEditSession', // soapaction |
|
4149 | - 'rpc', // style |
|
4150 | - 'encoded', // use |
|
4147 | + 'urn:WSRegistration', // namespace |
|
4148 | + 'urn:WSRegistration#WSEditSession', // soapaction |
|
4149 | + 'rpc', // style |
|
4150 | + 'encoded', // use |
|
4151 | 4151 | 'This service edits a session' // documentation |
4152 | 4152 | ); |
4153 | 4153 | |
@@ -4267,7 +4267,7 @@ discard block |
||
4267 | 4267 | } |
4268 | 4268 | } |
4269 | 4269 | |
4270 | - $results[] = $editResult?1:0; |
|
4270 | + $results[] = $editResult ? 1 : 0; |
|
4271 | 4271 | continue; |
4272 | 4272 | } |
4273 | 4273 | |
@@ -4346,13 +4346,13 @@ discard block |
||
4346 | 4346 | 'tns:result_deleteSession' |
4347 | 4347 | ); |
4348 | 4348 | |
4349 | -$server->register('WSDeleteSession', // method name |
|
4350 | - array('deleteSession' => 'tns:deleteSession'), // input parameters |
|
4349 | +$server->register('WSDeleteSession', // method name |
|
4350 | + array('deleteSession' => 'tns:deleteSession'), // input parameters |
|
4351 | 4351 | array('return' => 'tns:results_deleteSession'), // output parameters |
4352 | - 'urn:WSRegistration', // namespace |
|
4353 | - 'urn:WSRegistration#WSDeleteSession', // soapaction |
|
4354 | - 'rpc', // style |
|
4355 | - 'encoded', // use |
|
4352 | + 'urn:WSRegistration', // namespace |
|
4353 | + 'urn:WSRegistration#WSDeleteSession', // soapaction |
|
4354 | + 'rpc', // style |
|
4355 | + 'encoded', // use |
|
4356 | 4356 | 'This service deletes a session ' // documentation |
4357 | 4357 | ); |
4358 | 4358 | |
@@ -4433,10 +4433,10 @@ discard block |
||
4433 | 4433 | 'struct', |
4434 | 4434 | 'all', |
4435 | 4435 | '', |
4436 | - array ( |
|
4436 | + array( |
|
4437 | 4437 | 'course_id' => array('name' => 'course_id', 'type' => 'tns:course_id'), |
4438 | - 'user_id' => array('name' => 'user_id', 'type' => 'tns:user_id'), |
|
4439 | - 'status' => array('name' => 'status', 'type' => 'xsd:int') |
|
4438 | + 'user_id' => array('name' => 'user_id', 'type' => 'tns:user_id'), |
|
4439 | + 'status' => array('name' => 'status', 'type' => 'xsd:int') |
|
4440 | 4440 | ) |
4441 | 4441 | ); |
4442 | 4442 | |
@@ -4446,9 +4446,9 @@ discard block |
||
4446 | 4446 | 'struct', |
4447 | 4447 | 'all', |
4448 | 4448 | '', |
4449 | - array ( |
|
4450 | - 'userscourses' => array('name' => 'userscourses', 'type' => 'tns:user_course_status_array'), //removed [] |
|
4451 | - 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
4449 | + array( |
|
4450 | + 'userscourses' => array('name' => 'userscourses', 'type' => 'tns:user_course_status_array'), //removed [] |
|
4451 | + 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
4452 | 4452 | ) |
4453 | 4453 | ); |
4454 | 4454 | |
@@ -4473,9 +4473,9 @@ discard block |
||
4473 | 4473 | 'all', |
4474 | 4474 | '', |
4475 | 4475 | array( |
4476 | - 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
4477 | - 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), |
|
4478 | - 'result' => array('name' => 'result', 'type' => 'xsd:int') |
|
4476 | + 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
4477 | + 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), |
|
4478 | + 'result' => array('name' => 'result', 'type' => 'xsd:int') |
|
4479 | 4479 | ) |
4480 | 4480 | ); |
4481 | 4481 | |
@@ -4491,13 +4491,13 @@ discard block |
||
4491 | 4491 | ); |
4492 | 4492 | |
4493 | 4493 | // Register the method to expose |
4494 | -$server->register('WSSubscribeUserToCourse', // method name |
|
4495 | - array('subscribeUserToCourse' => 'tns:subscribeUserToCourse_arg'), // input parameters |
|
4494 | +$server->register('WSSubscribeUserToCourse', // method name |
|
4495 | + array('subscribeUserToCourse' => 'tns:subscribeUserToCourse_arg'), // input parameters |
|
4496 | 4496 | array('return' => 'tns:subscribeUserToCourse_return_global'), |
4497 | - 'urn:WSRegistration', // namespace |
|
4498 | - 'urn:WSRegistration#WSSubscribeUserToCourse', // soapaction |
|
4499 | - 'rpc', // style |
|
4500 | - 'encoded', // use |
|
4497 | + 'urn:WSRegistration', // namespace |
|
4498 | + 'urn:WSRegistration#WSSubscribeUserToCourse', // soapaction |
|
4499 | + 'rpc', // style |
|
4500 | + 'encoded', // use |
|
4501 | 4501 | 'This service subscribes a user to a course' // documentation |
4502 | 4502 | ); |
4503 | 4503 | |
@@ -4507,7 +4507,7 @@ discard block |
||
4507 | 4507 | if (!WSHelperVerifyKey($params)) { |
4508 | 4508 | return returnError(WS_ERROR_SECRET_KEY); |
4509 | 4509 | } |
4510 | - if ($debug) error_log('WSSubscribeUserToCourse params: '.print_r($params,1)); |
|
4510 | + if ($debug) error_log('WSSubscribeUserToCourse params: '.print_r($params, 1)); |
|
4511 | 4511 | |
4512 | 4512 | $results = array(); |
4513 | 4513 | $userscourses = $params['userscourses']; |
@@ -4575,9 +4575,9 @@ discard block |
||
4575 | 4575 | 'all', |
4576 | 4576 | '', |
4577 | 4577 | array( |
4578 | - 'course' => array('name' => 'course', 'type' => 'xsd:string'), //Course string code |
|
4579 | - 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), //Chamilo user_id |
|
4580 | - 'status' => array('name' => 'status', 'type' => 'xsd:int'), |
|
4578 | + 'course' => array('name' => 'course', 'type' => 'xsd:string'), //Course string code |
|
4579 | + 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), //Chamilo user_id |
|
4580 | + 'status' => array('name' => 'status', 'type' => 'xsd:int'), |
|
4581 | 4581 | 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
4582 | 4582 | ) |
4583 | 4583 | ); |
@@ -4590,18 +4590,18 @@ discard block |
||
4590 | 4590 | 'struct', |
4591 | 4591 | 'all', |
4592 | 4592 | '', |
4593 | - array('message' => array('name' => 'message', 'type' => 'xsd:string')) |
|
4593 | + array('message' => array('name' => 'message', 'type' => 'xsd:string')) |
|
4594 | 4594 | ); |
4595 | 4595 | |
4596 | 4596 | |
4597 | 4597 | // Register the method to expose |
4598 | -$server->register('WSSubscribeUserToCourseSimple', // method name |
|
4598 | +$server->register('WSSubscribeUserToCourseSimple', // method name |
|
4599 | 4599 | array('subscribeUserToCourseSimple' => 'tns:subscribeUserToCourseSimple_arg'), // input parameters |
4600 | - array('return' => 'xsd:string'), // output parameters |
|
4601 | - 'urn:WSRegistration', // namespace |
|
4602 | - 'urn:WSRegistration#WSSubscribeUserToCourseSimple', // soapaction |
|
4603 | - 'rpc', // style |
|
4604 | - 'encoded', // use |
|
4600 | + array('return' => 'xsd:string'), // output parameters |
|
4601 | + 'urn:WSRegistration', // namespace |
|
4602 | + 'urn:WSRegistration#WSSubscribeUserToCourseSimple', // soapaction |
|
4603 | + 'rpc', // style |
|
4604 | + 'encoded', // use |
|
4605 | 4605 | 'This service subscribes a user to a course in a simple way' // documentation |
4606 | 4606 | ); |
4607 | 4607 | |
@@ -4610,7 +4610,7 @@ discard block |
||
4610 | 4610 | global $debug; |
4611 | 4611 | |
4612 | 4612 | if ($debug) error_log('WSSubscribeUserToCourseSimple'); |
4613 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
4613 | + if ($debug) error_log('Params '.print_r($params, 1)); |
|
4614 | 4614 | if (!WSHelperVerifyKey($params)) { |
4615 | 4615 | return returnError(WS_ERROR_SECRET_KEY); |
4616 | 4616 | } |
@@ -4661,9 +4661,9 @@ discard block |
||
4661 | 4661 | 'all', |
4662 | 4662 | '', |
4663 | 4663 | array( |
4664 | - 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
4665 | - 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
4666 | - 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
4664 | + 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
4665 | + 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
4666 | + 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
4667 | 4667 | ) |
4668 | 4668 | ); |
4669 | 4669 | |
@@ -4674,21 +4674,21 @@ discard block |
||
4674 | 4674 | 'struct', |
4675 | 4675 | 'all', |
4676 | 4676 | '', |
4677 | - array ( |
|
4678 | - 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), |
|
4679 | - 'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), |
|
4680 | - 'lastname' => array('name' => 'lastname', 'type' => 'xsd:string'), |
|
4677 | + array( |
|
4678 | + 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), |
|
4679 | + 'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), |
|
4680 | + 'lastname' => array('name' => 'lastname', 'type' => 'xsd:string'), |
|
4681 | 4681 | ) |
4682 | 4682 | ); |
4683 | 4683 | |
4684 | 4684 | // Register the method to expose |
4685 | -$server->register('WSGetUser', // method name |
|
4686 | - array('GetUser' => 'tns:GetUserArg'), // input parameters |
|
4687 | - array('return' => 'tns:User'), // output parameters |
|
4688 | - 'urn:WSRegistration', // namespace |
|
4689 | - 'urn:WSRegistration#WSGetUser', // soapaction |
|
4690 | - 'rpc', // style |
|
4691 | - 'encoded', // use |
|
4685 | +$server->register('WSGetUser', // method name |
|
4686 | + array('GetUser' => 'tns:GetUserArg'), // input parameters |
|
4687 | + array('return' => 'tns:User'), // output parameters |
|
4688 | + 'urn:WSRegistration', // namespace |
|
4689 | + 'urn:WSRegistration#WSGetUser', // soapaction |
|
4690 | + 'rpc', // style |
|
4691 | + 'encoded', // use |
|
4692 | 4692 | 'This service get user information by id' // documentation |
4693 | 4693 | ); |
4694 | 4694 | |
@@ -4733,17 +4733,17 @@ discard block |
||
4733 | 4733 | '', |
4734 | 4734 | array( |
4735 | 4735 | 'username' => array('name' => 'username', 'type' => 'xsd:string'), |
4736 | - 'secret_key' => array('name' => 'secret_key','type' => 'xsd:string') |
|
4736 | + 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
4737 | 4737 | ) |
4738 | 4738 | ); |
4739 | 4739 | // Register the method to expose |
4740 | -$server->register('WSGetUserFromUsername', // method name |
|
4741 | - array('GetUserFromUsername' => 'tns:GetUserArgUsername'), // input params |
|
4742 | - array('return' => 'tns:User'), // output parameters |
|
4743 | - 'urn:WSRegistration', // namespace |
|
4744 | - 'urn:WSRegistration#WSGetUserFromUsername', // soapaction |
|
4745 | - 'rpc', // style |
|
4746 | - 'encoded', // use |
|
4740 | +$server->register('WSGetUserFromUsername', // method name |
|
4741 | + array('GetUserFromUsername' => 'tns:GetUserArgUsername'), // input params |
|
4742 | + array('return' => 'tns:User'), // output parameters |
|
4743 | + 'urn:WSRegistration', // namespace |
|
4744 | + 'urn:WSRegistration#WSGetUserFromUsername', // soapaction |
|
4745 | + 'rpc', // style |
|
4746 | + 'encoded', // use |
|
4747 | 4747 | 'This service get user information by username' // documentation |
4748 | 4748 | ); |
4749 | 4749 | |
@@ -4785,10 +4785,10 @@ discard block |
||
4785 | 4785 | 'all', |
4786 | 4786 | '', |
4787 | 4787 | array( |
4788 | - 'original_user_id_values' => array('name' => 'original_user_id_values', 'type' => 'tns:originalUsersList'), |
|
4789 | - 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
4790 | - 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), |
|
4791 | - 'original_course_id_name' => array('name' => 'original_course_id_name', 'type' => 'xsd:string'), |
|
4788 | + 'original_user_id_values' => array('name' => 'original_user_id_values', 'type' => 'tns:originalUsersList'), |
|
4789 | + 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
4790 | + 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), |
|
4791 | + 'original_course_id_name' => array('name' => 'original_course_id_name', 'type' => 'xsd:string'), |
|
4792 | 4792 | ) |
4793 | 4793 | ); |
4794 | 4794 | |
@@ -4841,13 +4841,13 @@ discard block |
||
4841 | 4841 | ); |
4842 | 4842 | |
4843 | 4843 | // Register the method to expose |
4844 | -$server->register('WSUnsubscribeUserFromCourse', // method name |
|
4844 | +$server->register('WSUnsubscribeUserFromCourse', // method name |
|
4845 | 4845 | array('unsuscribeUserFromCourse' => 'tns:unsuscribeUserFromCourse'), // input parameters |
4846 | - array('return' => 'tns:results_unsuscribeUserFromCourse'), // output parameters |
|
4847 | - 'urn:WSRegistration', // namespace |
|
4848 | - 'urn:WSRegistration#WSUnsubscribeUserFromCourse', // soapaction |
|
4849 | - 'rpc', // style |
|
4850 | - 'encoded', // use |
|
4846 | + array('return' => 'tns:results_unsuscribeUserFromCourse'), // output parameters |
|
4847 | + 'urn:WSRegistration', // namespace |
|
4848 | + 'urn:WSRegistration#WSUnsubscribeUserFromCourse', // soapaction |
|
4849 | + 'rpc', // style |
|
4850 | + 'encoded', // use |
|
4851 | 4851 | 'This service unsubscribes a user from a course' // documentation |
4852 | 4852 | ); |
4853 | 4853 | |
@@ -4893,7 +4893,7 @@ discard block |
||
4893 | 4893 | $usersList[] = $user_id; |
4894 | 4894 | } |
4895 | 4895 | |
4896 | - $orig_user_id_value[] = implode(',',$usersList); |
|
4896 | + $orig_user_id_value[] = implode(',', $usersList); |
|
4897 | 4897 | |
4898 | 4898 | $courseInfo = CourseManager::getCourseInfoFromOriginalId( |
4899 | 4899 | $original_course_id_value, |
@@ -4960,20 +4960,20 @@ discard block |
||
4960 | 4960 | 'all', |
4961 | 4961 | '', |
4962 | 4962 | array( |
4963 | - 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
4964 | - 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), |
|
4965 | - 'result' => array('name' => 'result', 'type' => 'xsd:int') |
|
4963 | + 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
4964 | + 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), |
|
4965 | + 'result' => array('name' => 'result', 'type' => 'xsd:int') |
|
4966 | 4966 | ) |
4967 | 4967 | ); |
4968 | 4968 | |
4969 | 4969 | // Register the method to expose |
4970 | -$server->register('WSUnSubscribeUserFromCourseSimple', // method name |
|
4970 | +$server->register('WSUnSubscribeUserFromCourseSimple', // method name |
|
4971 | 4971 | array('unSubscribeUserFromCourseSimple' => 'tns:unSubscribeUserFromCourseSimple'), // input parameters |
4972 | - array('return' => 'tns:unSubscribeUserToCourseSimple_return'), // output parameters |
|
4973 | - 'urn:WSRegistration', // namespace |
|
4974 | - 'urn:WSRegistration#WSUnSubscribeUserFromCourseSimple', // soapaction |
|
4975 | - 'rpc', // style |
|
4976 | - 'encoded', // use |
|
4972 | + array('return' => 'tns:unSubscribeUserToCourseSimple_return'), // output parameters |
|
4973 | + 'urn:WSRegistration', // namespace |
|
4974 | + 'urn:WSRegistration#WSUnSubscribeUserFromCourseSimple', // soapaction |
|
4975 | + 'rpc', // style |
|
4976 | + 'encoded', // use |
|
4977 | 4977 | 'This service unsubscribe a user from a course' // documentation |
4978 | 4978 | ); |
4979 | 4979 | /** |
@@ -5044,10 +5044,10 @@ discard block |
||
5044 | 5044 | 'all', |
5045 | 5045 | '', |
5046 | 5046 | array( |
5047 | - 'original_user_id_values' => array('name' => 'original_user_id_values', 'type' => 'tns:originalUsersList'), |
|
5048 | - 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
5049 | - 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), |
|
5050 | - 'original_course_id_name' => array('name' => 'original_course_id_value', 'type' => 'xsd:string') |
|
5047 | + 'original_user_id_values' => array('name' => 'original_user_id_values', 'type' => 'tns:originalUsersList'), |
|
5048 | + 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
5049 | + 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), |
|
5050 | + 'original_course_id_name' => array('name' => 'original_course_id_value', 'type' => 'xsd:string') |
|
5051 | 5051 | ) |
5052 | 5052 | ); |
5053 | 5053 | |
@@ -5140,13 +5140,13 @@ discard block |
||
5140 | 5140 | ); |
5141 | 5141 | |
5142 | 5142 | // Register the method to expose |
5143 | -$server->register('WSSuscribeUsersToSession', // method name |
|
5143 | +$server->register('WSSuscribeUsersToSession', // method name |
|
5144 | 5144 | array('subscribeUsersToSession' => 'tns:subscribeUsersToSession'), // input parameters |
5145 | - array('return' => 'tns:results_subscribeUsersToSession'), // output parameters |
|
5146 | - 'urn:WSRegistration', // namespace |
|
5147 | - 'urn:WSRegistration#WSSuscribeUsersToSession', // soapaction |
|
5148 | - 'rpc', // style |
|
5149 | - 'encoded', // use |
|
5145 | + array('return' => 'tns:results_subscribeUsersToSession'), // output parameters |
|
5146 | + 'urn:WSRegistration', // namespace |
|
5147 | + 'urn:WSRegistration#WSSuscribeUsersToSession', // soapaction |
|
5148 | + 'rpc', // style |
|
5149 | + 'encoded', // use |
|
5150 | 5150 | 'This service subscribes a user to a session' // documentation |
5151 | 5151 | ); |
5152 | 5152 | |
@@ -5246,25 +5246,25 @@ discard block |
||
5246 | 5246 | 'all', |
5247 | 5247 | '', |
5248 | 5248 | array( |
5249 | - 'session' => array('name' => 'session', 'type' => 'xsd:string'), // Session ID |
|
5250 | - 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), // Chamilo user_id |
|
5249 | + 'session' => array('name' => 'session', 'type' => 'xsd:string'), // Session ID |
|
5250 | + 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), // Chamilo user_id |
|
5251 | 5251 | 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
5252 | 5252 | ) |
5253 | 5253 | ); |
5254 | -$server->register('WSSubscribeUserToSessionSimple', // method name |
|
5255 | - array('subscribeUserToSessionSimple' => 'tns:subscribeUserToSessionSimple_arg'), // input parameters |
|
5256 | - array('return' => 'xsd:string'), // output parameters |
|
5257 | - 'urn:WSRegistration', // namespace |
|
5258 | - 'urn:WSRegistration#WSSubscribeUserToSessionSimple', // soapaction |
|
5259 | - 'rpc', // style |
|
5260 | - 'encoded', // use |
|
5254 | +$server->register('WSSubscribeUserToSessionSimple', // method name |
|
5255 | + array('subscribeUserToSessionSimple' => 'tns:subscribeUserToSessionSimple_arg'), // input parameters |
|
5256 | + array('return' => 'xsd:string'), // output parameters |
|
5257 | + 'urn:WSRegistration', // namespace |
|
5258 | + 'urn:WSRegistration#WSSubscribeUserToSessionSimple', // soapaction |
|
5259 | + 'rpc', // style |
|
5260 | + 'encoded', // use |
|
5261 | 5261 | 'This service subscribes a user to a session in a simple way' // documentation |
5262 | 5262 | ); |
5263 | 5263 | function WSSubscribeUserToSessionSimple($params) { |
5264 | 5264 | global $debug; |
5265 | 5265 | |
5266 | 5266 | if ($debug) { |
5267 | - error_log('WSSubscribeUserToSessionSimple with params=[' . serialize($params). ']'); |
|
5267 | + error_log('WSSubscribeUserToSessionSimple with params=['.serialize($params).']'); |
|
5268 | 5268 | } |
5269 | 5269 | |
5270 | 5270 | // Check security key |
@@ -5273,8 +5273,8 @@ discard block |
||
5273 | 5273 | } |
5274 | 5274 | |
5275 | 5275 | // Get input parameters |
5276 | - $session_id = intval($params['session']); // Session ID |
|
5277 | - $user_id = intval($params['user_id']); // Chamilo user id |
|
5276 | + $session_id = intval($params['session']); // Session ID |
|
5277 | + $user_id = intval($params['user_id']); // Chamilo user id |
|
5278 | 5278 | |
5279 | 5279 | // Get user id |
5280 | 5280 | $user_data = api_get_user_info($user_id); |
@@ -5375,13 +5375,13 @@ discard block |
||
5375 | 5375 | ); |
5376 | 5376 | |
5377 | 5377 | // Register the method to expose |
5378 | -$server->register('WSUnsuscribeUsersFromSession', // method name |
|
5378 | +$server->register('WSUnsuscribeUsersFromSession', // method name |
|
5379 | 5379 | array('unsubscribeUsersFromSession' => 'tns:unsubscribeUsersFromSession'), // input parameters |
5380 | - array('return' => 'tns:results_unsubscribeUsersFromSession'), // output parameters |
|
5381 | - 'urn:WSRegistration', // namespace |
|
5382 | - 'urn:WSRegistration#WSUnsuscribeUsersFromSession', // soapaction |
|
5383 | - 'rpc', // style |
|
5384 | - 'encoded', // use |
|
5380 | + array('return' => 'tns:results_unsubscribeUsersFromSession'), // output parameters |
|
5381 | + 'urn:WSRegistration', // namespace |
|
5382 | + 'urn:WSRegistration#WSUnsuscribeUsersFromSession', // soapaction |
|
5383 | + 'rpc', // style |
|
5384 | + 'encoded', // use |
|
5385 | 5385 | 'This service unsubscribes a user to a session' // documentation |
5386 | 5386 | ); |
5387 | 5387 | |
@@ -5395,7 +5395,7 @@ discard block |
||
5395 | 5395 | global $debug; |
5396 | 5396 | |
5397 | 5397 | if ($debug) { |
5398 | - error_log('WSUnsuscribeUsersFromSession with params=[' . serialize($params). ']'); |
|
5398 | + error_log('WSUnsuscribeUsersFromSession with params=['.serialize($params).']'); |
|
5399 | 5399 | } |
5400 | 5400 | |
5401 | 5401 | $user_table = Database::get_main_table(TABLE_MAIN_USER); |
@@ -5489,7 +5489,7 @@ discard block |
||
5489 | 5489 | 'all', |
5490 | 5490 | '', |
5491 | 5491 | array( |
5492 | - 'course_code' => array('name' => 'course_code', 'type' => 'xsd:string'), |
|
5492 | + 'course_code' => array('name' => 'course_code', 'type' => 'xsd:string'), |
|
5493 | 5493 | ) |
5494 | 5494 | ); |
5495 | 5495 | |
@@ -5524,9 +5524,9 @@ discard block |
||
5524 | 5524 | '', |
5525 | 5525 | array( |
5526 | 5526 | 'original_course_id_values' => array('name' => 'original_course_id_values', 'type' => 'tns:originalCoursesList'), |
5527 | - 'original_course_id_name' => array('name' => 'original_course_id_name', 'type' => 'xsd:string'), |
|
5527 | + 'original_course_id_name' => array('name' => 'original_course_id_name', 'type' => 'xsd:string'), |
|
5528 | 5528 | 'original_session_id_value' => array('name' => 'original_session_id_value', 'type' => 'xsd:string'), |
5529 | - 'original_session_id_name' => array('name' => 'original_session_id_name', 'type' => 'xsd:string') |
|
5529 | + 'original_session_id_name' => array('name' => 'original_session_id_name', 'type' => 'xsd:string') |
|
5530 | 5530 | ) |
5531 | 5531 | ); |
5532 | 5532 | |
@@ -5579,13 +5579,13 @@ discard block |
||
5579 | 5579 | ); |
5580 | 5580 | |
5581 | 5581 | // Register the method to expose |
5582 | -$server->register('WSSuscribeCoursesToSession', // method name |
|
5582 | +$server->register('WSSuscribeCoursesToSession', // method name |
|
5583 | 5583 | array('subscribeCoursesToSession' => 'tns:subscribeCoursesToSession'), // input parameters |
5584 | - array('return' => 'tns:results_subscribeCoursesToSession'), // output parameters |
|
5585 | - 'urn:WSRegistration', // namespace |
|
5586 | - 'urn:WSRegistration#WSSuscribeCoursesToSession', // soapaction |
|
5587 | - 'rpc', // style |
|
5588 | - 'encoded', // use |
|
5584 | + array('return' => 'tns:results_subscribeCoursesToSession'), // output parameters |
|
5585 | + 'urn:WSRegistration', // namespace |
|
5586 | + 'urn:WSRegistration#WSSuscribeCoursesToSession', // soapaction |
|
5587 | + 'rpc', // style |
|
5588 | + 'encoded', // use |
|
5589 | 5589 | 'This service subscribes a course to a session' // documentation |
5590 | 5590 | ); |
5591 | 5591 | |
@@ -5730,13 +5730,13 @@ discard block |
||
5730 | 5730 | |
5731 | 5731 | |
5732 | 5732 | // Register the method to expose |
5733 | -$server->register('WSUnsuscribeCoursesFromSession', // method name |
|
5733 | +$server->register('WSUnsuscribeCoursesFromSession', // method name |
|
5734 | 5734 | array('unsubscribeCoursesFromSession' => 'tns:unsubscribeCoursesFromSession'), // input parameters |
5735 | - array('return' => 'tns:results_unsubscribeCoursesFromSession'), // output parameters |
|
5736 | - 'urn:WSRegistration', // namespace |
|
5737 | - 'urn:WSRegistration#WSUnsuscribeCoursesFromSession', // soapaction |
|
5738 | - 'rpc', // style |
|
5739 | - 'encoded', // use |
|
5735 | + array('return' => 'tns:results_unsubscribeCoursesFromSession'), // output parameters |
|
5736 | + 'urn:WSRegistration', // namespace |
|
5737 | + 'urn:WSRegistration#WSUnsuscribeCoursesFromSession', // soapaction |
|
5738 | + 'rpc', // style |
|
5739 | + 'encoded', // use |
|
5740 | 5740 | 'This service subscribes a course to a session' // documentation |
5741 | 5741 | ); |
5742 | 5742 | |
@@ -5900,13 +5900,13 @@ discard block |
||
5900 | 5900 | |
5901 | 5901 | |
5902 | 5902 | // Register the method to expose |
5903 | -$server->register('WSListCourses', // method name |
|
5903 | +$server->register('WSListCourses', // method name |
|
5904 | 5904 | array('listCourseInput' => 'tns:listCourseInput'), // input parameters |
5905 | - array('return' => 'tns:courses'), // output parameters |
|
5906 | - 'urn:WSRegistration', // namespace |
|
5907 | - 'urn:WSRegistration#WSListCourses', // soapaction |
|
5908 | - 'rpc', // style |
|
5909 | - 'encoded', // use |
|
5905 | + array('return' => 'tns:courses'), // output parameters |
|
5906 | + 'urn:WSRegistration', // namespace |
|
5907 | + 'urn:WSRegistration#WSListCourses', // soapaction |
|
5908 | + 'rpc', // style |
|
5909 | + 'encoded', // use |
|
5910 | 5910 | 'This service list courses available on the system' // documentation |
5911 | 5911 | ); |
5912 | 5912 | |
@@ -5986,21 +5986,21 @@ discard block |
||
5986 | 5986 | 'all', |
5987 | 5987 | '', |
5988 | 5988 | array( |
5989 | - 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
5990 | - 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
5991 | - 'chamilo_username' => array('name' => 'chamilo_username', 'type' => 'xsd:string'), |
|
5992 | - 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
5989 | + 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
5990 | + 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
5991 | + 'chamilo_username' => array('name' => 'chamilo_username', 'type' => 'xsd:string'), |
|
5992 | + 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
5993 | 5993 | ) |
5994 | 5994 | ); |
5995 | 5995 | |
5996 | 5996 | // Register the method to expose |
5997 | -$server->register('WSUpdateUserApiKey', // method name |
|
5997 | +$server->register('WSUpdateUserApiKey', // method name |
|
5998 | 5998 | array('userApiKey' => 'tns:userApiKey'), // input parameters |
5999 | - array('return' => 'xsd:string'), // output parameters |
|
6000 | - 'urn:WSRegistration', // namespace |
|
6001 | - 'urn:WSRegistration#WSListCourses', // soapaction |
|
6002 | - 'rpc', // style |
|
6003 | - 'encoded', // use |
|
5999 | + array('return' => 'xsd:string'), // output parameters |
|
6000 | + 'urn:WSRegistration', // namespace |
|
6001 | + 'urn:WSRegistration#WSListCourses', // soapaction |
|
6002 | + 'rpc', // style |
|
6003 | + 'encoded', // use |
|
6004 | 6004 | 'This service return user api key' // documentation |
6005 | 6005 | ); |
6006 | 6006 | |
@@ -6056,11 +6056,11 @@ discard block |
||
6056 | 6056 | 'all', |
6057 | 6057 | '', |
6058 | 6058 | array( |
6059 | - 'from' => array('name' => 'from', 'type' => 'xsd:int'), |
|
6060 | - 'to' => array('name' => 'to', 'type' => 'xsd:int'), |
|
6061 | - 'date_start' => array('name' => 'date_start', 'type' => 'xsd:string'), |
|
6062 | - 'date_end' => array('name' => 'date_end', 'type' => 'xsd:string'), |
|
6063 | - 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
6059 | + 'from' => array('name' => 'from', 'type' => 'xsd:int'), |
|
6060 | + 'to' => array('name' => 'to', 'type' => 'xsd:int'), |
|
6061 | + 'date_start' => array('name' => 'date_start', 'type' => 'xsd:string'), |
|
6062 | + 'date_end' => array('name' => 'date_end', 'type' => 'xsd:string'), |
|
6063 | + 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
6064 | 6064 | ) |
6065 | 6065 | ); |
6066 | 6066 | |
@@ -6071,11 +6071,11 @@ discard block |
||
6071 | 6071 | 'all', |
6072 | 6072 | '', |
6073 | 6073 | array( |
6074 | - 'id' => array ('name' => 'id' , 'type' => 'xsd:int'), |
|
6075 | - 'title' => array ('name' => 'title', 'type' => 'xsd:string'), |
|
6076 | - 'url' => array ('name' => 'url', 'type' => 'xsd:string'), |
|
6077 | - 'date_start' => array ('name' => 'date_start', 'type' => 'xsd:string'), |
|
6078 | - 'date_end' => array ('name' => 'date_end', 'type' => 'xsd:string'), |
|
6074 | + 'id' => array('name' => 'id', 'type' => 'xsd:int'), |
|
6075 | + 'title' => array('name' => 'title', 'type' => 'xsd:string'), |
|
6076 | + 'url' => array('name' => 'url', 'type' => 'xsd:string'), |
|
6077 | + 'date_start' => array('name' => 'date_start', 'type' => 'xsd:string'), |
|
6078 | + 'date_end' => array('name' => 'date_end', 'type' => 'xsd:string'), |
|
6079 | 6079 | ) |
6080 | 6080 | ); |
6081 | 6081 | |
@@ -6094,13 +6094,13 @@ discard block |
||
6094 | 6094 | ); |
6095 | 6095 | |
6096 | 6096 | // Register the method to expose |
6097 | -$server->register('WSListSessions', // method name |
|
6098 | - array('input' => 'tns:session_arg'), // input parameters |
|
6099 | - array('return' => 'tns:sessions'), // output parameters |
|
6100 | - 'urn:WSRegistration', // namespace |
|
6101 | - 'urn:WSRegistration#WSListSessions', // soapaction |
|
6102 | - 'rpc', // style |
|
6103 | - 'encoded', // use |
|
6097 | +$server->register('WSListSessions', // method name |
|
6098 | + array('input' => 'tns:session_arg'), // input parameters |
|
6099 | + array('return' => 'tns:sessions'), // output parameters |
|
6100 | + 'urn:WSRegistration', // namespace |
|
6101 | + 'urn:WSRegistration#WSListSessions', // soapaction |
|
6102 | + 'rpc', // style |
|
6103 | + 'encoded', // use |
|
6104 | 6104 | 'This service returns a list of sessions' // documentation |
6105 | 6105 | ); |
6106 | 6106 | |
@@ -6158,20 +6158,20 @@ discard block |
||
6158 | 6158 | 'all', |
6159 | 6159 | '', |
6160 | 6160 | array( |
6161 | - 'course' => array('name' => 'course', 'type' => 'xsd:string'), //Course string code |
|
6162 | - 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), //Chamilo user_id |
|
6161 | + 'course' => array('name' => 'course', 'type' => 'xsd:string'), //Course string code |
|
6162 | + 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), //Chamilo user_id |
|
6163 | 6163 | 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
6164 | 6164 | ) |
6165 | 6165 | ); |
6166 | 6166 | |
6167 | 6167 | // Register the method to expose |
6168 | -$server->register('WSUserSubscribedInCourse', // method name |
|
6169 | - array('UserSubscribedInCourse' => 'tns:UserSubscribedInCourse'), // input parameters |
|
6170 | - array('return' => 'xsd:string'), // output parameters |
|
6171 | - 'urn:WSRegistration', // namespace |
|
6172 | - 'urn:WSRegistration#WSUserSubscribedInCourse', // soapaction |
|
6173 | - 'rpc', // style |
|
6174 | - 'encoded', // use |
|
6168 | +$server->register('WSUserSubscribedInCourse', // method name |
|
6169 | + array('UserSubscribedInCourse' => 'tns:UserSubscribedInCourse'), // input parameters |
|
6170 | + array('return' => 'xsd:string'), // output parameters |
|
6171 | + 'urn:WSRegistration', // namespace |
|
6172 | + 'urn:WSRegistration#WSUserSubscribedInCourse', // soapaction |
|
6173 | + 'rpc', // style |
|
6174 | + 'encoded', // use |
|
6175 | 6175 | 'This service checks if user assigned to course' // documentation |
6176 | 6176 | ); |
6177 | 6177 | |
@@ -6197,7 +6197,7 @@ discard block |
||
6197 | 6197 | $courseCode = $params['course']; //Course code |
6198 | 6198 | $userId = $params['user_id']; //chamilo user id |
6199 | 6199 | |
6200 | - return CourseManager::is_user_subscribed_in_course($userId,$courseCode); |
|
6200 | + return CourseManager::is_user_subscribed_in_course($userId, $courseCode); |
|
6201 | 6201 | } |
6202 | 6202 | |
6203 | 6203 | |
@@ -6225,8 +6225,8 @@ discard block |
||
6225 | 6225 | 'all', |
6226 | 6226 | '', |
6227 | 6227 | array( |
6228 | - 'variable' => array('name'=>'variable','type'=>'xsd:string'), |
|
6229 | - 'value' => array('name'=>'value','type'=>'xsd:string') |
|
6228 | + 'variable' => array('name'=>'variable', 'type'=>'xsd:string'), |
|
6229 | + 'value' => array('name'=>'value', 'type'=>'xsd:string') |
|
6230 | 6230 | ) |
6231 | 6231 | ); |
6232 | 6232 | |
@@ -6288,12 +6288,12 @@ discard block |
||
6288 | 6288 | //Reister WSSearchSession |
6289 | 6289 | $server->register( |
6290 | 6290 | 'WSSearchSession', |
6291 | - array('SearchSession' => 'tns:SearchSession'), // input parameters |
|
6292 | - array('return' => 'tns:searchedSessionList'), // output parameters |
|
6293 | - 'urn:WSRegistration', // namespace |
|
6294 | - 'urn:WSRegistration#WSSearchSession', // soapaction |
|
6295 | - 'rpc', // style |
|
6296 | - 'encoded', // use |
|
6291 | + array('SearchSession' => 'tns:SearchSession'), // input parameters |
|
6292 | + array('return' => 'tns:searchedSessionList'), // output parameters |
|
6293 | + 'urn:WSRegistration', // namespace |
|
6294 | + 'urn:WSRegistration#WSSearchSession', // soapaction |
|
6295 | + 'rpc', // style |
|
6296 | + 'encoded', // use |
|
6297 | 6297 | 'This service to get a session list filtered by name, description or short description extra field' // documentation |
6298 | 6298 | ); |
6299 | 6299 | |
@@ -6348,12 +6348,12 @@ discard block |
||
6348 | 6348 | //Reister WSFetchSession |
6349 | 6349 | $server->register( |
6350 | 6350 | 'WSFetchSession', |
6351 | - array('SearchSession' => 'tns:FetchSession'), // input parameters |
|
6352 | - array('return' => 'tns:searchedSessionList'), // output parameters |
|
6353 | - 'urn:WSRegistration', // namespace |
|
6354 | - 'urn:WSRegistration#WSFetchSession', // soapaction |
|
6355 | - 'rpc', // style |
|
6356 | - 'encoded', // use |
|
6351 | + array('SearchSession' => 'tns:FetchSession'), // input parameters |
|
6352 | + array('return' => 'tns:searchedSessionList'), // output parameters |
|
6353 | + 'urn:WSRegistration', // namespace |
|
6354 | + 'urn:WSRegistration#WSFetchSession', // soapaction |
|
6355 | + 'rpc', // style |
|
6356 | + 'encoded', // use |
|
6357 | 6357 | 'This service get a session by its id. Optionally can get its extra fields values' // documentation |
6358 | 6358 | ); |
6359 | 6359 | |
@@ -6430,16 +6430,16 @@ discard block |
||
6430 | 6430 | ); |
6431 | 6431 | // Register the method to expose |
6432 | 6432 | $server->register( |
6433 | - 'WSCertificatesList', // method name |
|
6433 | + 'WSCertificatesList', // method name |
|
6434 | 6434 | array( |
6435 | - 'startingDate' => 'xsd:string', // input parameters |
|
6435 | + 'startingDate' => 'xsd:string', // input parameters |
|
6436 | 6436 | 'endingDate' => 'xsd:string' |
6437 | 6437 | ), |
6438 | - array('return' => 'tns:certificatesList'), // output parameters |
|
6439 | - 'urn:WSRegistration', // namespace |
|
6440 | - 'urn:WSRegistration#WSCertificatesList', // soapaction |
|
6441 | - 'rpc', // style |
|
6442 | - 'encoded', // use |
|
6438 | + array('return' => 'tns:certificatesList'), // output parameters |
|
6439 | + 'urn:WSRegistration', // namespace |
|
6440 | + 'urn:WSRegistration#WSCertificatesList', // soapaction |
|
6441 | + 'rpc', // style |
|
6442 | + 'encoded', // use |
|
6443 | 6443 | 'This service returns a list of certificates' // documentation |
6444 | 6444 | ); |
6445 | 6445 | |
@@ -6505,13 +6505,13 @@ discard block |
||
6505 | 6505 | ); |
6506 | 6506 | |
6507 | 6507 | // Register the method to expose |
6508 | -$server->register('WSCreateGroup', // method name |
|
6509 | - array('createGroup' => 'tns:createGroup'), // input parameters |
|
6510 | - array('return' => 'xsd:string'), // output parameters |
|
6511 | - 'urn:WSRegistration', // namespace |
|
6512 | - 'urn:WSRegistration#WSCreateGroup', // soapaction |
|
6513 | - 'rpc', // style |
|
6514 | - 'encoded', // use |
|
6508 | +$server->register('WSCreateGroup', // method name |
|
6509 | + array('createGroup' => 'tns:createGroup'), // input parameters |
|
6510 | + array('return' => 'xsd:string'), // output parameters |
|
6511 | + 'urn:WSRegistration', // namespace |
|
6512 | + 'urn:WSRegistration#WSCreateGroup', // soapaction |
|
6513 | + 'rpc', // style |
|
6514 | + 'encoded', // use |
|
6515 | 6515 | 'This service adds a group' // documentation |
6516 | 6516 | ); |
6517 | 6517 | |
@@ -6553,13 +6553,13 @@ discard block |
||
6553 | 6553 | ); |
6554 | 6554 | |
6555 | 6555 | // Register the method to expose |
6556 | -$server->register('WSUpdateGroup', // method name |
|
6557 | - array('updateGroup' => 'tns:updateGroup'), // input parameters |
|
6558 | - array('return' => 'xsd:string'), // output parameters |
|
6559 | - 'urn:WSRegistration', // namespace |
|
6560 | - 'urn:WSRegistration#WSUpdateGroup', // soapaction |
|
6561 | - 'rpc', // style |
|
6562 | - 'encoded', // use |
|
6556 | +$server->register('WSUpdateGroup', // method name |
|
6557 | + array('updateGroup' => 'tns:updateGroup'), // input parameters |
|
6558 | + array('return' => 'xsd:string'), // output parameters |
|
6559 | + 'urn:WSRegistration', // namespace |
|
6560 | + 'urn:WSRegistration#WSUpdateGroup', // soapaction |
|
6561 | + 'rpc', // style |
|
6562 | + 'encoded', // use |
|
6563 | 6563 | 'This service updates a group' // documentation |
6564 | 6564 | ); |
6565 | 6565 | |
@@ -6594,13 +6594,13 @@ discard block |
||
6594 | 6594 | ); |
6595 | 6595 | |
6596 | 6596 | // Register the method to expose |
6597 | -$server->register('WSDeleteGroup', // method name |
|
6598 | - array('deleteGroup' => 'tns:deleteGroup'), // input parameters |
|
6599 | - array('return' => 'xsd:string'), // output parameters |
|
6600 | - 'urn:WSRegistration', // namespace |
|
6601 | - 'urn:WSRegistration#WSDeleteGroup', // soapaction |
|
6602 | - 'rpc', // style |
|
6603 | - 'encoded', // use |
|
6597 | +$server->register('WSDeleteGroup', // method name |
|
6598 | + array('deleteGroup' => 'tns:deleteGroup'), // input parameters |
|
6599 | + array('return' => 'xsd:string'), // output parameters |
|
6600 | + 'urn:WSRegistration', // namespace |
|
6601 | + 'urn:WSRegistration#WSDeleteGroup', // soapaction |
|
6602 | + 'rpc', // style |
|
6603 | + 'encoded', // use |
|
6604 | 6604 | 'This service deletes a group' // documentation |
6605 | 6605 | ); |
6606 | 6606 | |
@@ -6635,13 +6635,13 @@ discard block |
||
6635 | 6635 | ); |
6636 | 6636 | |
6637 | 6637 | // Register the method to expose |
6638 | -$server->register('GroupBindToParent', // method name |
|
6639 | - array('groupBindToParent' => 'tns:groupBindToParent'), // input parameters |
|
6640 | - array('return' => 'xsd:string'), // output parameters |
|
6641 | - 'urn:WSRegistration', // namespace |
|
6642 | - 'urn:WSRegistration#GroupBindToParent', // soapaction |
|
6643 | - 'rpc', // style |
|
6644 | - 'encoded', // use |
|
6638 | +$server->register('GroupBindToParent', // method name |
|
6639 | + array('groupBindToParent' => 'tns:groupBindToParent'), // input parameters |
|
6640 | + array('return' => 'xsd:string'), // output parameters |
|
6641 | + 'urn:WSRegistration', // namespace |
|
6642 | + 'urn:WSRegistration#GroupBindToParent', // soapaction |
|
6643 | + 'rpc', // style |
|
6644 | + 'encoded', // use |
|
6645 | 6645 | 'This service binds a group to a parent' // documentation |
6646 | 6646 | ); |
6647 | 6647 | |
@@ -6675,13 +6675,13 @@ discard block |
||
6675 | 6675 | ); |
6676 | 6676 | |
6677 | 6677 | // Register the method to expose |
6678 | -$server->register('GroupUnbindFromParent', // method name |
|
6679 | - array('groupUnbindFromParent' => 'tns:groupUnbindFromParent'), // input parameters |
|
6680 | - array('return' => 'xsd:string'), // output parameters |
|
6681 | - 'urn:WSRegistration', // namespace |
|
6682 | - 'urn:WSRegistration#GroupUnbindFromParent', // soapaction |
|
6683 | - 'rpc', // style |
|
6684 | - 'encoded', // use |
|
6678 | +$server->register('GroupUnbindFromParent', // method name |
|
6679 | + array('groupUnbindFromParent' => 'tns:groupUnbindFromParent'), // input parameters |
|
6680 | + array('return' => 'xsd:string'), // output parameters |
|
6681 | + 'urn:WSRegistration', // namespace |
|
6682 | + 'urn:WSRegistration#GroupUnbindFromParent', // soapaction |
|
6683 | + 'rpc', // style |
|
6684 | + 'encoded', // use |
|
6685 | 6685 | 'This service unbinds a group from its parent' // documentation |
6686 | 6686 | ); |
6687 | 6687 | |
@@ -6715,13 +6715,13 @@ discard block |
||
6715 | 6715 | ); |
6716 | 6716 | |
6717 | 6717 | // Register the method to expose |
6718 | -$server->register('WSAddUserToGroup', // method name |
|
6719 | - array('addUserToGroup' => 'tns:addUserToGroup'), // input parameters |
|
6720 | - array('return' => 'xsd:string'), // output parameters |
|
6721 | - 'urn:WSRegistration', // namespace |
|
6722 | - 'urn:WSRegistration#WSAddUserToGroup', // soapaction |
|
6723 | - 'rpc', // style |
|
6724 | - 'encoded', // use |
|
6718 | +$server->register('WSAddUserToGroup', // method name |
|
6719 | + array('addUserToGroup' => 'tns:addUserToGroup'), // input parameters |
|
6720 | + array('return' => 'xsd:string'), // output parameters |
|
6721 | + 'urn:WSRegistration', // namespace |
|
6722 | + 'urn:WSRegistration#WSAddUserToGroup', // soapaction |
|
6723 | + 'rpc', // style |
|
6724 | + 'encoded', // use |
|
6725 | 6725 | 'This service adds a user to a group' // documentation |
6726 | 6726 | ); |
6727 | 6727 | |
@@ -6758,13 +6758,13 @@ discard block |
||
6758 | 6758 | ); |
6759 | 6759 | |
6760 | 6760 | // Register the method to expose |
6761 | -$server->register('WSUpdateUserRoleInGroup', // method name |
|
6762 | - array('updateUserRoleInGroup' => 'tns:updateUserRoleInGroup'), // input parameters |
|
6763 | - array('return' => 'xsd:string'), // output parameters |
|
6764 | - 'urn:WSRegistration', // namespace |
|
6765 | - 'urn:WSRegistration#WSUpdateUserRoleInGroup', // soapaction |
|
6766 | - 'rpc', // style |
|
6767 | - 'encoded', // use |
|
6761 | +$server->register('WSUpdateUserRoleInGroup', // method name |
|
6762 | + array('updateUserRoleInGroup' => 'tns:updateUserRoleInGroup'), // input parameters |
|
6763 | + array('return' => 'xsd:string'), // output parameters |
|
6764 | + 'urn:WSRegistration', // namespace |
|
6765 | + 'urn:WSRegistration#WSUpdateUserRoleInGroup', // soapaction |
|
6766 | + 'rpc', // style |
|
6767 | + 'encoded', // use |
|
6768 | 6768 | 'This service updates a user role in group' // documentation |
6769 | 6769 | ); |
6770 | 6770 | |
@@ -6803,13 +6803,13 @@ discard block |
||
6803 | 6803 | ); |
6804 | 6804 | |
6805 | 6805 | // Register the method to expose |
6806 | -$server->register('WSDeleteUserFromGroup', // method name |
|
6807 | - array('deleteUserFromGroup' => 'tns:deleteUserFromGroup'), // input parameters |
|
6808 | - array('return' => 'xsd:string'), // output parameters |
|
6809 | - 'urn:WSRegistration', // namespace |
|
6810 | - 'urn:WSRegistration#WSDeleteUserFromGroup', // soapaction |
|
6811 | - 'rpc', // style |
|
6812 | - 'encoded', // use |
|
6806 | +$server->register('WSDeleteUserFromGroup', // method name |
|
6807 | + array('deleteUserFromGroup' => 'tns:deleteUserFromGroup'), // input parameters |
|
6808 | + array('return' => 'xsd:string'), // output parameters |
|
6809 | + 'urn:WSRegistration', // namespace |
|
6810 | + 'urn:WSRegistration#WSDeleteUserFromGroup', // soapaction |
|
6811 | + 'rpc', // style |
|
6812 | + 'encoded', // use |
|
6813 | 6813 | 'This service deletes a user from a group' // documentation |
6814 | 6814 | ); |
6815 | 6815 | |
@@ -6842,10 +6842,10 @@ discard block |
||
6842 | 6842 | 'struct', |
6843 | 6843 | 'all', |
6844 | 6844 | '', |
6845 | - array ( |
|
6845 | + array( |
|
6846 | 6846 | 'course_id' => array('name' => 'course_id', 'type' => 'tns:course_id'), |
6847 | - 'user_id' => array('name' => 'user_id', 'type' => 'tns:user_id'), |
|
6848 | - 'visible' => array('name' => 'status', 'type' => 'xsd:int') |
|
6847 | + 'user_id' => array('name' => 'user_id', 'type' => 'tns:user_id'), |
|
6848 | + 'visible' => array('name' => 'status', 'type' => 'xsd:int') |
|
6849 | 6849 | ) |
6850 | 6850 | ); |
6851 | 6851 | |
@@ -6868,9 +6868,9 @@ discard block |
||
6868 | 6868 | 'struct', |
6869 | 6869 | 'all', |
6870 | 6870 | '', |
6871 | - array ( |
|
6872 | - 'userscourses' => array('name' => 'userscourses', 'type' => 'tns:user_course_visibility_array'), |
|
6873 | - 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
6871 | + array( |
|
6872 | + 'userscourses' => array('name' => 'userscourses', 'type' => 'tns:user_course_visibility_array'), |
|
6873 | + 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
6874 | 6874 | ) |
6875 | 6875 | ); |
6876 | 6876 | |
@@ -6882,10 +6882,10 @@ discard block |
||
6882 | 6882 | 'all', |
6883 | 6883 | '', |
6884 | 6884 | array( |
6885 | - 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
6886 | - 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), |
|
6887 | - 'visible' => array('name' => 'visible', 'type' => 'xsd:int'), |
|
6888 | - 'result' => array('name' => 'result', 'type' => 'xsd:int') |
|
6885 | + 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
6886 | + 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), |
|
6887 | + 'visible' => array('name' => 'visible', 'type' => 'xsd:int'), |
|
6888 | + 'result' => array('name' => 'result', 'type' => 'xsd:int') |
|
6889 | 6889 | ) |
6890 | 6890 | ); |
6891 | 6891 | |
@@ -6901,13 +6901,13 @@ discard block |
||
6901 | 6901 | ); |
6902 | 6902 | |
6903 | 6903 | // Register the method to expose |
6904 | -$server->register('WSAddUserVisibilityToCourseInCatalogue', // method name |
|
6905 | - array('registerUserToCourseCatalogue' => 'tns:registerUserToCourseCatalogue_arg'), // input parameters |
|
6904 | +$server->register('WSAddUserVisibilityToCourseInCatalogue', // method name |
|
6905 | + array('registerUserToCourseCatalogue' => 'tns:registerUserToCourseCatalogue_arg'), // input parameters |
|
6906 | 6906 | array('return' => 'tns:registerUserToCourseCatalogue_return_global'), |
6907 | - 'urn:WSRegistration', // namespace |
|
6908 | - 'urn:WSRegistration#WSRegisterUserVisibilityToCourseCatalogue', // soapaction |
|
6909 | - 'rpc', // style |
|
6910 | - 'encoded', // use |
|
6907 | + 'urn:WSRegistration', // namespace |
|
6908 | + 'urn:WSRegistration#WSRegisterUserVisibilityToCourseCatalogue', // soapaction |
|
6909 | + 'rpc', // style |
|
6910 | + 'encoded', // use |
|
6911 | 6911 | 'This service registers the visibility of users to course in catalogue' // documentation |
6912 | 6912 | ); |
6913 | 6913 | |
@@ -6973,13 +6973,13 @@ discard block |
||
6973 | 6973 | } |
6974 | 6974 | |
6975 | 6975 | // Register the method to expose |
6976 | -$server->register('WSRemoveUserVisibilityToCourseInCatalogue', // method name |
|
6977 | - array('registerUserToCourseCatalogue' => 'tns:registerUserToCourseCatalogue_arg'), // input parameters |
|
6976 | +$server->register('WSRemoveUserVisibilityToCourseInCatalogue', // method name |
|
6977 | + array('registerUserToCourseCatalogue' => 'tns:registerUserToCourseCatalogue_arg'), // input parameters |
|
6978 | 6978 | array('return' => 'tns:registerUserToCourseCatalogue_return_global'), |
6979 | - 'urn:WSRegistration', // namespace |
|
6980 | - 'urn:WSRegistration#WSRegisterUserVisibilityToCourseCatalogue', // soapaction |
|
6981 | - 'rpc', // style |
|
6982 | - 'encoded', // use |
|
6979 | + 'urn:WSRegistration', // namespace |
|
6980 | + 'urn:WSRegistration#WSRegisterUserVisibilityToCourseCatalogue', // soapaction |
|
6981 | + 'rpc', // style |
|
6982 | + 'encoded', // use |
|
6983 | 6983 | 'This service removes the visibility of users to course in catalogue' // documentation |
6984 | 6984 | ); |
6985 | 6985 |
@@ -63,14 +63,16 @@ discard block |
||
63 | 63 | list($ip1) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); |
64 | 64 | $ip = trim($ip1); |
65 | 65 | } |
66 | - if ($debug) |
|
67 | - error_log("ip: $ip"); |
|
66 | + if ($debug) { |
|
67 | + error_log("ip: $ip"); |
|
68 | + } |
|
68 | 69 | // Check if a file that limits access from webservices exists and contains |
69 | 70 | // the restraining check |
70 | 71 | if (is_file('webservice-auth-ip.conf.php')) { |
71 | 72 | include 'webservice-auth-ip.conf.php'; |
72 | - if ($debug) |
|
73 | - error_log("webservice-auth-ip.conf.php file included"); |
|
73 | + if ($debug) { |
|
74 | + error_log("webservice-auth-ip.conf.php file included"); |
|
75 | + } |
|
74 | 76 | if (!empty($ws_auth_ip)) { |
75 | 77 | $check_ip = true; |
76 | 78 | $ip_matches = api_check_ip_in_range($ip, $ws_auth_ip); |
@@ -554,7 +556,9 @@ discard block |
||
554 | 556 | |
555 | 557 | // First check wether the login already exists |
556 | 558 | if (!UserManager::is_username_available($loginName)) { |
557 | - if ($debug) error_log("Username $loginName is not available"); |
|
559 | + if ($debug) { |
|
560 | + error_log("Username $loginName is not available"); |
|
561 | + } |
|
558 | 562 | return 0; |
559 | 563 | } |
560 | 564 | |
@@ -1045,9 +1049,15 @@ discard block |
||
1045 | 1049 | ); |
1046 | 1050 | } |
1047 | 1051 | |
1048 | - if ($debug) error_log('$userId found: '. $userId); |
|
1049 | - if ($debug) error_log('$courseId found: '. $courseId); |
|
1050 | - if ($debug) error_log('$sessionId found: '. $sessionId); |
|
1052 | + if ($debug) { |
|
1053 | + error_log('$userId found: '. $userId); |
|
1054 | + } |
|
1055 | + if ($debug) { |
|
1056 | + error_log('$courseId found: '. $courseId); |
|
1057 | + } |
|
1058 | + if ($debug) { |
|
1059 | + error_log('$sessionId found: '. $sessionId); |
|
1060 | + } |
|
1051 | 1061 | |
1052 | 1062 | return [ |
1053 | 1063 | 'user_id' => $userId, |
@@ -1077,13 +1087,17 @@ discard block |
||
1077 | 1087 | { |
1078 | 1088 | global $debug; |
1079 | 1089 | |
1080 | - if ($debug) error_log('WSSubscribeTeacherToSessionCourse'); |
|
1090 | + if ($debug) { |
|
1091 | + error_log('WSSubscribeTeacherToSessionCourse'); |
|
1092 | + } |
|
1081 | 1093 | |
1082 | 1094 | if (!WSHelperVerifyKey($params)) { |
1083 | 1095 | return returnError(WS_ERROR_SECRET_KEY); |
1084 | 1096 | } |
1085 | 1097 | |
1086 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
1098 | + if ($debug) { |
|
1099 | + error_log('Params '. print_r($params, 1)); |
|
1100 | + } |
|
1087 | 1101 | |
1088 | 1102 | $params = parseCourseSessionUserParams($params); |
1089 | 1103 | |
@@ -1096,13 +1110,17 @@ discard block |
||
1096 | 1110 | $result = 0; |
1097 | 1111 | |
1098 | 1112 | if (!empty($coaches)) { |
1099 | - if ($debug) error_log('Coaches: '. print_r($coaches, 1)); |
|
1113 | + if ($debug) { |
|
1114 | + error_log('Coaches: '. print_r($coaches, 1)); |
|
1115 | + } |
|
1100 | 1116 | if (in_array($userId, $coaches)) { |
1101 | 1117 | $result = 1; |
1102 | 1118 | } |
1103 | 1119 | } |
1104 | 1120 | |
1105 | - if ($debug) error_log('Result: '. $result); |
|
1121 | + if ($debug) { |
|
1122 | + error_log('Result: '. $result); |
|
1123 | + } |
|
1106 | 1124 | |
1107 | 1125 | return $result; |
1108 | 1126 | } |
@@ -1128,13 +1146,17 @@ discard block |
||
1128 | 1146 | { |
1129 | 1147 | global $debug; |
1130 | 1148 | |
1131 | - if ($debug) error_log('WSSubscribeTeacherToSessionCourse'); |
|
1149 | + if ($debug) { |
|
1150 | + error_log('WSSubscribeTeacherToSessionCourse'); |
|
1151 | + } |
|
1132 | 1152 | |
1133 | 1153 | if (!WSHelperVerifyKey($params)) { |
1134 | 1154 | return returnError(WS_ERROR_SECRET_KEY); |
1135 | 1155 | } |
1136 | 1156 | |
1137 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
1157 | + if ($debug) { |
|
1158 | + error_log('Params '. print_r($params, 1)); |
|
1159 | + } |
|
1138 | 1160 | |
1139 | 1161 | $params = parseCourseSessionUserParams($params); |
1140 | 1162 | |
@@ -1148,7 +1170,9 @@ discard block |
||
1148 | 1170 | $result = 0; |
1149 | 1171 | |
1150 | 1172 | if (!empty($coaches)) { |
1151 | - if ($debug) error_log('Coaches: ' . print_r($coaches, 1)); |
|
1173 | + if ($debug) { |
|
1174 | + error_log('Coaches: ' . print_r($coaches, 1)); |
|
1175 | + } |
|
1152 | 1176 | if (!in_array($userId, $coaches)) { |
1153 | 1177 | $result = 1; |
1154 | 1178 | } |
@@ -1156,7 +1180,9 @@ discard block |
||
1156 | 1180 | $result = 1; |
1157 | 1181 | } |
1158 | 1182 | |
1159 | - if ($debug) error_log('Final Result: '. $result); |
|
1183 | + if ($debug) { |
|
1184 | + error_log('Final Result: '. $result); |
|
1185 | + } |
|
1160 | 1186 | |
1161 | 1187 | return $result; |
1162 | 1188 | } |
@@ -1208,8 +1234,12 @@ discard block |
||
1208 | 1234 | { |
1209 | 1235 | global $_user, $_configuration, $debug; |
1210 | 1236 | $debug = 1; |
1211 | - if ($debug) error_log('WSCreateUserPasswordCrypted'); |
|
1212 | - if ($debug) error_log(print_r($params,1)); |
|
1237 | + if ($debug) { |
|
1238 | + error_log('WSCreateUserPasswordCrypted'); |
|
1239 | + } |
|
1240 | + if ($debug) { |
|
1241 | + error_log(print_r($params,1)); |
|
1242 | + } |
|
1213 | 1243 | |
1214 | 1244 | if (!WSHelperVerifyKey($params)) { |
1215 | 1245 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -1241,22 +1271,30 @@ discard block |
||
1241 | 1271 | if ($_configuration['password_encryption'] === $encrypt_method ) { |
1242 | 1272 | if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) { |
1243 | 1273 | $msg = "Encryption $encrypt_method is invalid"; |
1244 | - if ($debug) error_log($msg); |
|
1274 | + if ($debug) { |
|
1275 | + error_log($msg); |
|
1276 | + } |
|
1245 | 1277 | return $msg; |
1246 | 1278 | |
1247 | 1279 | } else if ($encrypt_method == 'sha1' && !preg_match('/^[A-Fa-f0-9]{40}$/', $password)) { |
1248 | 1280 | $msg = "Encryption $encrypt_method is invalid"; |
1249 | - if ($debug) error_log($msg); |
|
1281 | + if ($debug) { |
|
1282 | + error_log($msg); |
|
1283 | + } |
|
1250 | 1284 | return $msg; |
1251 | 1285 | } |
1252 | 1286 | } else { |
1253 | 1287 | $msg = "This encryption $encrypt_method is not configured"; |
1254 | - if ($debug) error_log($msg); |
|
1288 | + if ($debug) { |
|
1289 | + error_log($msg); |
|
1290 | + } |
|
1255 | 1291 | return $msg; |
1256 | 1292 | } |
1257 | 1293 | } else { |
1258 | 1294 | $msg = 'The chamilo setting $_configuration["password_encryption"] is not configured'; |
1259 | - if ($debug) error_log($msg); |
|
1295 | + if ($debug) { |
|
1296 | + error_log($msg); |
|
1297 | + } |
|
1260 | 1298 | return $msg; |
1261 | 1299 | } |
1262 | 1300 | |
@@ -1276,10 +1314,14 @@ discard block |
||
1276 | 1314 | $original_user_id_name |
1277 | 1315 | ); |
1278 | 1316 | |
1279 | - if ($debug) error_log('Ready to create user'); |
|
1317 | + if ($debug) { |
|
1318 | + error_log('Ready to create user'); |
|
1319 | + } |
|
1280 | 1320 | |
1281 | 1321 | if ($user_id > 0) { |
1282 | - if ($debug) error_log('User found with id: '.$user_id); |
|
1322 | + if ($debug) { |
|
1323 | + error_log('User found with id: '.$user_id); |
|
1324 | + } |
|
1283 | 1325 | |
1284 | 1326 | // Check whether user is not active |
1285 | 1327 | //@todo why this condition exists?? |
@@ -1290,7 +1332,9 @@ discard block |
||
1290 | 1332 | $count_check_user = Database::num_rows($resu); |
1291 | 1333 | if ($count_check_user > 0) { |
1292 | 1334 | |
1293 | - if ($debug) error_log('User id: '.$user_id.' exists and is NOT active. Updating user and setting setting active = 1'); |
|
1335 | + if ($debug) { |
|
1336 | + error_log('User id: '.$user_id.' exists and is NOT active. Updating user and setting setting active = 1'); |
|
1337 | + } |
|
1294 | 1338 | |
1295 | 1339 | $sql = "UPDATE $table_user SET |
1296 | 1340 | lastname='".Database::escape_string($lastName)."', |
@@ -1311,7 +1355,9 @@ discard block |
||
1311 | 1355 | hr_dept_id=".intval($hr_dept_id)." |
1312 | 1356 | WHERE user_id='".$r_check_user[0]."'"; |
1313 | 1357 | |
1314 | - if ($debug) error_log($sql); |
|
1358 | + if ($debug) { |
|
1359 | + error_log($sql); |
|
1360 | + } |
|
1315 | 1361 | Database::query($sql); |
1316 | 1362 | |
1317 | 1363 | if (is_array($extra_list) && count($extra_list) > 0) { |
@@ -1328,11 +1374,15 @@ discard block |
||
1328 | 1374 | } |
1329 | 1375 | return $r_check_user[0]; |
1330 | 1376 | } else { |
1331 | - if ($debug) error_log('User exists but is active. Cant be updated'); |
|
1377 | + if ($debug) { |
|
1378 | + error_log('User exists but is active. Cant be updated'); |
|
1379 | + } |
|
1332 | 1380 | return 0; |
1333 | 1381 | } |
1334 | 1382 | } else { |
1335 | - if ($debug) error_log("User not found with original_id = $original_user_id_value and original_name = $original_user_id_name"); |
|
1383 | + if ($debug) { |
|
1384 | + error_log("User not found with original_id = $original_user_id_value and original_name = $original_user_id_name"); |
|
1385 | + } |
|
1336 | 1386 | } |
1337 | 1387 | |
1338 | 1388 | // Default language. |
@@ -1348,12 +1398,16 @@ discard block |
||
1348 | 1398 | |
1349 | 1399 | // First check wether the login already exists |
1350 | 1400 | if (!UserManager::is_username_available($loginName)) { |
1351 | - if ($debug) error_log("Username $loginName is not available"); |
|
1401 | + if ($debug) { |
|
1402 | + error_log("Username $loginName is not available"); |
|
1403 | + } |
|
1352 | 1404 | return 0; |
1353 | 1405 | } |
1354 | 1406 | |
1355 | 1407 | $queryExpirationDate = ''; |
1356 | - if (!empty($params['expiration_date'])) $queryExpirationDate = "expiration_date = '".Database::escape_string($expiration_date)."', "; |
|
1408 | + if (!empty($params['expiration_date'])) { |
|
1409 | + $queryExpirationDate = "expiration_date = '".Database::escape_string($expiration_date)."', "; |
|
1410 | + } |
|
1357 | 1411 | |
1358 | 1412 | $sql = "INSERT INTO $table_user SET |
1359 | 1413 | lastname = '".Database::escape_string(trim($lastName))."', |
@@ -1373,7 +1427,9 @@ discard block |
||
1373 | 1427 | ".$queryExpirationDate." |
1374 | 1428 | hr_dept_id = '".Database::escape_string($hr_dept_id)."', |
1375 | 1429 | active = '".Database::escape_string($active)."'"; |
1376 | - if ($debug) error_log($sql); |
|
1430 | + if ($debug) { |
|
1431 | + error_log($sql); |
|
1432 | + } |
|
1377 | 1433 | |
1378 | 1434 | Database::query($sql); |
1379 | 1435 | $return = Database::insert_id(); |
@@ -1385,7 +1441,9 @@ discard block |
||
1385 | 1441 | |
1386 | 1442 | $url_id = api_get_current_access_url_id(); |
1387 | 1443 | UrlManager::add_user_to_url($return, $url_id); |
1388 | - if ($debug) error_log("Adding user_id = $return to URL id $url_id "); |
|
1444 | + if ($debug) { |
|
1445 | + error_log("Adding user_id = $return to URL id $url_id "); |
|
1446 | + } |
|
1389 | 1447 | |
1390 | 1448 | // Create extra field for the original_user_id_name |
1391 | 1449 | UserManager::create_extra_field( |
@@ -1422,7 +1480,9 @@ discard block |
||
1422 | 1480 | } |
1423 | 1481 | } |
1424 | 1482 | } else { |
1425 | - if ($debug) error_log('Error while inserting a user'); |
|
1483 | + if ($debug) { |
|
1484 | + error_log('Error while inserting a user'); |
|
1485 | + } |
|
1426 | 1486 | |
1427 | 1487 | return 0; |
1428 | 1488 | } |
@@ -4504,7 +4564,9 @@ discard block |
||
4504 | 4564 | if (!WSHelperVerifyKey($params)) { |
4505 | 4565 | return returnError(WS_ERROR_SECRET_KEY); |
4506 | 4566 | } |
4507 | - if ($debug) error_log('WSSubscribeUserToCourse params: '.print_r($params,1)); |
|
4567 | + if ($debug) { |
|
4568 | + error_log('WSSubscribeUserToCourse params: '.print_r($params,1)); |
|
4569 | + } |
|
4508 | 4570 | |
4509 | 4571 | $results = array(); |
4510 | 4572 | $userscourses = $params['userscourses']; |
@@ -4523,7 +4585,9 @@ discard block |
||
4523 | 4585 | $original_user_id['original_user_id_value'], |
4524 | 4586 | $original_user_id['original_user_id_name'] |
4525 | 4587 | ); |
4526 | - if ($debug) error_log('WSSubscribeUserToCourse user_id: '.$user_id); |
|
4588 | + if ($debug) { |
|
4589 | + error_log('WSSubscribeUserToCourse user_id: '.$user_id); |
|
4590 | + } |
|
4527 | 4591 | |
4528 | 4592 | if ($user_id == 0) { |
4529 | 4593 | // If user was not found, there was a problem |
@@ -4541,13 +4605,19 @@ discard block |
||
4541 | 4605 | // Course was not found |
4542 | 4606 | $resultValue = 0; |
4543 | 4607 | } else { |
4544 | - if ($debug) error_log('WSSubscribeUserToCourse courseCode: '.$courseCode); |
|
4608 | + if ($debug) { |
|
4609 | + error_log('WSSubscribeUserToCourse courseCode: '.$courseCode); |
|
4610 | + } |
|
4545 | 4611 | $result = CourseManager::add_user_to_course($user_id, $courseCode, $status, false); |
4546 | 4612 | if ($result) { |
4547 | 4613 | $resultValue = 1; |
4548 | - if ($debug) error_log('WSSubscribeUserToCourse subscribed'); |
|
4614 | + if ($debug) { |
|
4615 | + error_log('WSSubscribeUserToCourse subscribed'); |
|
4616 | + } |
|
4549 | 4617 | } else { |
4550 | - if ($debug) error_log('WSSubscribeUserToCourse NOT subscribed: '); |
|
4618 | + if ($debug) { |
|
4619 | + error_log('WSSubscribeUserToCourse NOT subscribed: '); |
|
4620 | + } |
|
4551 | 4621 | } |
4552 | 4622 | } |
4553 | 4623 | } |
@@ -4606,8 +4676,12 @@ discard block |
||
4606 | 4676 | function WSSubscribeUserToCourseSimple($params) { |
4607 | 4677 | global $debug; |
4608 | 4678 | |
4609 | - if ($debug) error_log('WSSubscribeUserToCourseSimple'); |
|
4610 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
4679 | + if ($debug) { |
|
4680 | + error_log('WSSubscribeUserToCourseSimple'); |
|
4681 | + } |
|
4682 | + if ($debug) { |
|
4683 | + error_log('Params '. print_r($params, 1)); |
|
4684 | + } |
|
4611 | 4685 | if (!WSHelperVerifyKey($params)) { |
4612 | 4686 | return returnError(WS_ERROR_SECRET_KEY); |
4613 | 4687 | } |
@@ -4625,7 +4699,9 @@ discard block |
||
4625 | 4699 | if (empty($user_data)) { |
4626 | 4700 | // If user was not found, there was a problem |
4627 | 4701 | $result = "User $user_id does not exist"; |
4628 | - if ($debug) error_log($result); |
|
4702 | + if ($debug) { |
|
4703 | + error_log($result); |
|
4704 | + } |
|
4629 | 4705 | return $result; |
4630 | 4706 | } |
4631 | 4707 | if (!empty($course_code)) { |
@@ -4633,14 +4709,22 @@ discard block |
||
4633 | 4709 | if (empty($course_data)) { |
4634 | 4710 | // Course was not found |
4635 | 4711 | $result = "Course $course_code does not exist in the platform "; |
4636 | - if ($debug) error_log($result); |
|
4712 | + if ($debug) { |
|
4713 | + error_log($result); |
|
4714 | + } |
|
4637 | 4715 | } else { |
4638 | - if ($debug) error_log('Try to register: user_id= '.$user_id.' to course: '.$course_data['code']); |
|
4716 | + if ($debug) { |
|
4717 | + error_log('Try to register: user_id= '.$user_id.' to course: '.$course_data['code']); |
|
4718 | + } |
|
4639 | 4719 | if (!CourseManager::add_user_to_course($user_id, $course_data['code'], $status)) { |
4640 | 4720 | $result = 'User was not registered possible reasons: User already registered to the course, Course visibility doesnt allow user subscriptions '; |
4641 | - if ($debug) error_log($result); |
|
4721 | + if ($debug) { |
|
4722 | + error_log($result); |
|
4723 | + } |
|
4642 | 4724 | } else { |
4643 | - if ($debug) error_log('User registered to the course: '.$course_data['code']); |
|
4725 | + if ($debug) { |
|
4726 | + error_log('User registered to the course: '.$course_data['code']); |
|
4727 | + } |
|
4644 | 4728 | $result = 1; |
4645 | 4729 | } |
4646 | 4730 | } |
@@ -4693,8 +4777,12 @@ discard block |
||
4693 | 4777 | function WSGetUser($params) |
4694 | 4778 | { |
4695 | 4779 | global $debug; |
4696 | - if ($debug) error_log('WSGetUser'); |
|
4697 | - if ($debug) error_log('$params: '.print_r($params, 1)); |
|
4780 | + if ($debug) { |
|
4781 | + error_log('WSGetUser'); |
|
4782 | + } |
|
4783 | + if ($debug) { |
|
4784 | + error_log('$params: '.print_r($params, 1)); |
|
4785 | + } |
|
4698 | 4786 | |
4699 | 4787 | if (!WSHelperVerifyKey($params)) { |
4700 | 4788 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -4748,8 +4836,12 @@ discard block |
||
4748 | 4836 | function WSGetUserFromUsername($params) |
4749 | 4837 | { |
4750 | 4838 | global $debug; |
4751 | - if ($debug) error_log('WSGetUserFromUsername'); |
|
4752 | - if ($debug) error_log('$params: '.print_r($params, 1)); |
|
4839 | + if ($debug) { |
|
4840 | + error_log('WSGetUserFromUsername'); |
|
4841 | + } |
|
4842 | + if ($debug) { |
|
4843 | + error_log('$params: '.print_r($params, 1)); |
|
4844 | + } |
|
4753 | 4845 | |
4754 | 4846 | if (!WSHelperVerifyKey($params)) { |
4755 | 4847 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -5216,7 +5308,9 @@ discard block |
||
5216 | 5308 | SessionManager::suscribe_users_to_session($sessionId, array($user_id), SESSION_VISIBLE_READ_ONLY, false); |
5217 | 5309 | $results[] = 1; |
5218 | 5310 | |
5219 | - if ($debug) error_log("subscribe user:$user_id to session $sessionId"); |
|
5311 | + if ($debug) { |
|
5312 | + error_log("subscribe user:$user_id to session $sessionId"); |
|
5313 | + } |
|
5220 | 5314 | } |
5221 | 5315 | } |
5222 | 5316 | } // end principal foreach |
@@ -5300,7 +5394,9 @@ discard block |
||
5300 | 5394 | SESSION_VISIBLE_READ_ONLY, |
5301 | 5395 | false |
5302 | 5396 | ); |
5303 | - if ($debug) error_log('User registered to the course: '.$session_id); |
|
5397 | + if ($debug) { |
|
5398 | + error_log('User registered to the course: '.$session_id); |
|
5399 | + } |
|
5304 | 5400 | $result = 1; |
5305 | 5401 | } |
5306 | 5402 | } |
@@ -5448,7 +5544,9 @@ discard block |
||
5448 | 5544 | |
5449 | 5545 | $results[] = 1; |
5450 | 5546 | |
5451 | - if ($debug) error_log("Unsubscribe user:$user_id to session:$id_session"); |
|
5547 | + if ($debug) { |
|
5548 | + error_log("Unsubscribe user:$user_id to session:$id_session"); |
|
5549 | + } |
|
5452 | 5550 | } |
5453 | 5551 | } |
5454 | 5552 | } // end principal foreach |
@@ -5595,7 +5693,9 @@ discard block |
||
5595 | 5693 | return returnError(WS_ERROR_SECRET_KEY); |
5596 | 5694 | } |
5597 | 5695 | |
5598 | - if ($debug) error_log('WSSuscribeCoursesToSession: '.print_r($params, 1)); |
|
5696 | + if ($debug) { |
|
5697 | + error_log('WSSuscribeCoursesToSession: '.print_r($params, 1)); |
|
5698 | + } |
|
5599 | 5699 | |
5600 | 5700 | $coursessessions_params = $params['coursessessions']; |
5601 | 5701 | $results = array(); |
@@ -5641,7 +5741,9 @@ discard block |
||
5641 | 5741 | array($courseInfo['real_id']), |
5642 | 5742 | false |
5643 | 5743 | ); |
5644 | - if ($debug) error_log("add_courses_to_session: course:$courseCode to session:$sessionId"); |
|
5744 | + if ($debug) { |
|
5745 | + error_log("add_courses_to_session: course:$courseCode to session:$sessionId"); |
|
5746 | + } |
|
5645 | 5747 | |
5646 | 5748 | $results[] = 1; |
5647 | 5749 | } |
@@ -6914,7 +7016,9 @@ discard block |
||
6914 | 7016 | if (!WSHelperVerifyKey($params)) { |
6915 | 7017 | return returnError(WS_ERROR_SECRET_KEY); |
6916 | 7018 | } |
6917 | - if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue params: '.print_r($params, 1)); |
|
7019 | + if ($debug) { |
|
7020 | + error_log('WSAddUserVisibilityToCourseCatalogue params: '.print_r($params, 1)); |
|
7021 | + } |
|
6918 | 7022 | |
6919 | 7023 | $results = array(); |
6920 | 7024 | $userscourses = $params['userscourses']; |
@@ -6930,7 +7034,9 @@ discard block |
||
6930 | 7034 | $original_user_id['original_user_id_value'], |
6931 | 7035 | $original_user_id['original_user_id_name'] |
6932 | 7036 | ); |
6933 | - if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue userId: '.$userId); |
|
7037 | + if ($debug) { |
|
7038 | + error_log('WSAddUserVisibilityToCourseCatalogue userId: '.$userId); |
|
7039 | + } |
|
6934 | 7040 | |
6935 | 7041 | if ($userId == 0) { |
6936 | 7042 | // If user was not found, there was a problem |
@@ -6947,13 +7053,19 @@ discard block |
||
6947 | 7053 | // Course was not found |
6948 | 7054 | $resultValue = 0; |
6949 | 7055 | } else { |
6950 | - if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue courseCode: '.$courseCode); |
|
7056 | + if ($debug) { |
|
7057 | + error_log('WSAddUserVisibilityToCourseCatalogue courseCode: '.$courseCode); |
|
7058 | + } |
|
6951 | 7059 | $result = CourseManager::addUserVisibilityToCourseInCatalogue($userId, $courseCode, $visible); |
6952 | 7060 | if ($result) { |
6953 | 7061 | $resultValue = 1; |
6954 | - if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue registered'); |
|
7062 | + if ($debug) { |
|
7063 | + error_log('WSAddUserVisibilityToCourseCatalogue registered'); |
|
7064 | + } |
|
6955 | 7065 | } else { |
6956 | - if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue NOT registered: '); |
|
7066 | + if ($debug) { |
|
7067 | + error_log('WSAddUserVisibilityToCourseCatalogue NOT registered: '); |
|
7068 | + } |
|
6957 | 7069 | } |
6958 | 7070 | } |
6959 | 7071 | } |
@@ -6986,7 +7098,9 @@ discard block |
||
6986 | 7098 | if (!WSHelperVerifyKey($params)) { |
6987 | 7099 | return returnError(WS_ERROR_SECRET_KEY); |
6988 | 7100 | } |
6989 | - if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue params: '.print_r($params, 1)); |
|
7101 | + if ($debug) { |
|
7102 | + error_log('WSRemoveUserVisibilityToCourseInCatalogue params: '.print_r($params, 1)); |
|
7103 | + } |
|
6990 | 7104 | |
6991 | 7105 | $results = array(); |
6992 | 7106 | $userscourses = $params['userscourses']; |
@@ -7002,7 +7116,9 @@ discard block |
||
7002 | 7116 | $original_user_id['original_user_id_value'], |
7003 | 7117 | $original_user_id['original_user_id_name'] |
7004 | 7118 | ); |
7005 | - if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue user_id: '.$userId); |
|
7119 | + if ($debug) { |
|
7120 | + error_log('WSRemoveUserVisibilityToCourseInCatalogue user_id: '.$userId); |
|
7121 | + } |
|
7006 | 7122 | |
7007 | 7123 | if ($userId == 0) { |
7008 | 7124 | // If user was not found, there was a problem |
@@ -7020,13 +7136,19 @@ discard block |
||
7020 | 7136 | // Course was not found |
7021 | 7137 | $resultValue = 0; |
7022 | 7138 | } else { |
7023 | - if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue courseCode: '.$courseCode); |
|
7139 | + if ($debug) { |
|
7140 | + error_log('WSRemoveUserVisibilityToCourseInCatalogue courseCode: '.$courseCode); |
|
7141 | + } |
|
7024 | 7142 | $result = CourseManager::removeUserVisibilityToCourseInCatalogue($userId, $courseCode, $visible); |
7025 | 7143 | if ($result) { |
7026 | 7144 | $resultValue = 1; |
7027 | - if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue removed'); |
|
7145 | + if ($debug) { |
|
7146 | + error_log('WSRemoveUserVisibilityToCourseInCatalogue removed'); |
|
7147 | + } |
|
7028 | 7148 | } else { |
7029 | - if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue NOT removed: '); |
|
7149 | + if ($debug) { |
|
7150 | + error_log('WSRemoveUserVisibilityToCourseInCatalogue NOT removed: '); |
|
7151 | + } |
|
7030 | 7152 | } |
7031 | 7153 | } |
7032 | 7154 | } |