Compare commits
372 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d3b57e5566 | |||
| c70adc397a | |||
| a46a937d3e | |||
| c48083bc2d | |||
| 9d0466e2a6 | |||
| 938122d7d2 | |||
| 95f1ffc594 | |||
| 271013af0f | |||
| 9bfb07349b | |||
| c6982f0c26 | |||
| 0989530df9 | |||
| e32f1a5b98 | |||
| e23ec822d1 | |||
| cbc29c7237 | |||
| 3098552240 | |||
| 92addc1b42 | |||
| 2dc95960f4 | |||
| 146b674a33 | |||
| f7cc90e58c | |||
| a41779208c | |||
| c9b9c609ba | |||
| 9b602f0d3d | |||
| f4b35f935c | |||
| 667e06ed11 | |||
| 0628867164 | |||
| 39954f4087 | |||
| fdd3ed4939 | |||
| 951fd7910a | |||
| b6c96ce21d | |||
| ed0d8418ae | |||
| 2e83e24b6d | |||
| 87f156a9da | |||
| a2aa951267 | |||
| 21fa5360fc | |||
| f3d264801f | |||
| 5a0558be90 | |||
| 0f8a2e49ce | |||
| c36701675e | |||
| f87414c0bb | |||
| 92b7f24d0d | |||
| e8cd2b38cc | |||
| b42cae480f | |||
| 58c70cace9 | |||
| aa38cccbdf | |||
| c417f26c85 | |||
| f676fab333 | |||
| 286914ebf9 | |||
| 8a12b18716 | |||
| 6ffa6bf848 | |||
| 36be12128c | |||
| 16ba21692e | |||
| a335226982 | |||
| eb813e917e | |||
| 7c527b3b9d | |||
| f9d81b4e36 | |||
| 6f7cb89d17 | |||
| 19ac11bd63 | |||
| be61c13c00 | |||
| 5f7519cd0f | |||
| 46b515a48c | |||
| 6f304b3251 | |||
| 3aa003edc4 | |||
| 59cbc3ac9d | |||
| b72135d360 | |||
| 844aed0573 | |||
| e882741ec2 | |||
| 8dd34ce9bc | |||
| a6989f9cbd | |||
| dda9800184 | |||
| d03d9d7a5a | |||
| fb3557d4d9 | |||
| f895a66e50 | |||
| ff04b09e91 | |||
| d10e19dca1 | |||
| 3449775fb9 | |||
| 3ba9c859b6 | |||
| 54617ab56b | |||
| 77b81a215d | |||
| 722c4a9109 | |||
| c54f92b59c | |||
| 4b4a3f4d40 | |||
| ddb5da6113 | |||
| 6e04be55d7 | |||
| 09048346de | |||
| 9b7b42cc07 | |||
| 4cfaa3c85e | |||
| e722d7ab26 | |||
| ad2c6a55d1 | |||
| bf92014116 | |||
| 7bda2db46d | |||
| 1422989b6a | |||
| 27cde347a0 | |||
| 321097aa82 | |||
| 190437b919 | |||
| 7ce2b7d43e | |||
| 52abd5d7c4 | |||
| 0d3703f0e8 | |||
| 439aad511a | |||
| 62d35d727c | |||
| 7ce5c00bf1 | |||
| 850ca88325 | |||
| dd9312b2c7 | |||
| 2dfa65ae3e | |||
| 339bb9b746 | |||
| 63336df702 | |||
| f7d5bed2d2 | |||
| f073013d11 | |||
| d376f25fd2 | |||
| 8aa656699c | |||
| da6677db3e | |||
| 1e53ed8af3 | |||
| 2b241253e4 | |||
| 8e4b3a8cd8 | |||
| f8895a0de5 | |||
| 5aeb342d09 | |||
| 3a13ab606b | |||
| b68ae6fca7 | |||
| d09a98edf8 | |||
| 48cc1a0e6a | |||
| d27de862a6 | |||
| 0b9a7f7bc6 | |||
| ebd87f75a9 | |||
| 2966e43548 | |||
| 9c85777a62 | |||
| a7e4899de4 | |||
| c9dc3ac1a5 | |||
| 6f45d0516c | |||
| fc711515be | |||
| 37c2fe3e1a | |||
| 0bf78b45f3 | |||
| 53f2fb98ac | |||
| df9134b4e0 | |||
| df01c2f983 | |||
| f08efe8517 | |||
| dcf93f8107 | |||
| b5f523ab6e | |||
| a728edc61f | |||
| 309bb4021d | |||
| f98c2af902 | |||
| ea5aabd1da | |||
| de0489fd9f | |||
| 9caa000b8b | |||
| 1a4a3b3380 | |||
| 56fc04e3af | |||
| 5ceb953522 | |||
| eedcf27a55 | |||
| fc56e73e49 | |||
| 7a543c5cfb | |||
| 3cb6bd2c35 | |||
| 66eefc5b26 | |||
| 616f3a0584 | |||
| df3311ee1e | |||
| 7d4ed65730 | |||
| 09eb1ec39c | |||
| d11ec62bd3 | |||
| 3ac3641547 | |||
| 0b1d21c0c3 | |||
| 597cd7728e | |||
| 791fbc5687 | |||
| ea714cfdbd | |||
| 4e0d03df62 | |||
| 6172153106 | |||
| be1aef7fc4 | |||
| 45541efc8e | |||
| 26f421782d | |||
| e7bbf42c5a | |||
| 122722c7aa | |||
| e27f1fc122 | |||
| 4ca7cf3473 | |||
| b961b2249f | |||
| 1bb8b3818f | |||
| 146bc3bcf1 | |||
| d74e64100c | |||
| c2baadf060 | |||
| f9b27a7f86 | |||
| d42dbcc1e7 | |||
| 7cc37fafdc | |||
| f98049b035 | |||
| 443768b8aa | |||
| 9cb2c25061 | |||
| 1a5e5787aa | |||
| e1397186a9 | |||
| 326129c87f | |||
| 0a45ab2fb2 | |||
| c5e4aebf29 | |||
| b74504fff3 | |||
| 1e825b9dc1 | |||
| 7211a3733a | |||
| cb7c915b10 | |||
| e9b9c28e44 | |||
| d09757da3f | |||
| 67ca52345c | |||
| 3e7759c3b6 | |||
| 43c99d82f1 | |||
| f18e948bda | |||
| e3eff7bf1c | |||
| e98649d7f1 | |||
| c30e73badc | |||
| 181190d81b | |||
| 8f290d7868 | |||
| c9bbb97a8d | |||
| 0bb51a9c00 | |||
| 0145441c4d | |||
| 3cd4774c59 | |||
| 7badfb42c7 | |||
| 2ba01076aa | |||
| 13e0414d47 | |||
| 72a5176d95 | |||
| fb68fa74e3 | |||
| d696377711 | |||
| 0adcc16ccf | |||
| 945bd325c4 | |||
| de06df20a4 | |||
| f35c9f6f19 | |||
| f15eba9879 | |||
| ef7c98d04e | |||
| f68ff717aa | |||
| 356e897da9 | |||
| 1729e73566 | |||
| a352220a48 | |||
| 5ad59d2b07 | |||
| fb733f80e3 | |||
| c6d8a02649 | |||
| 28701c2fef | |||
| 0038bff79e | |||
| 78a40f0c7f | |||
| 650d657bb0 | |||
| 396d2eefe7 | |||
| 8c961e6c84 | |||
| c9f6285685 | |||
| dbf8cae35e | |||
| fc9d151810 | |||
| ceb6ed3ab2 | |||
| d5a23c5f04 | |||
| 1027fcce3b | |||
| e48c333640 | |||
| 346a83d25f | |||
| e904a8315b | |||
| a0eb0c7b14 | |||
| b43c3213ab | |||
| 8632e95b13 | |||
| 20414f20ff | |||
| 65c78f2904 | |||
| fdaeef002a | |||
| 3cba887fca | |||
| 0ece80c088 | |||
| e3494d2af5 | |||
| 5aeaecaa1e | |||
| 379447d88f | |||
| 54b6d16e8c | |||
| bfeb2678df | |||
| 4c5b0669a0 | |||
| 312191a8e9 | |||
| ade44744d7 | |||
| 7ae190c397 | |||
| b9a7a37ec0 | |||
| f52c8e3912 | |||
| ef52b6a434 | |||
| 34177c462c | |||
| 77d5965638 | |||
| 8a4f91b671 | |||
| b930d5a83b | |||
| 92b904642a | |||
| 724dbf2d0c | |||
| 7ed1828798 | |||
| 12ff34e245 | |||
| a26c09be05 | |||
| f2c2aeff2d | |||
| 3f833b914c | |||
| 75b5701ae7 | |||
| 146b8728c7 | |||
| f032cd818e | |||
| 9244a6be27 | |||
| 4d69204037 | |||
| 479206f6ff | |||
| d4c97b77a5 | |||
| 6b68f4e53b | |||
| 7ec5b06656 | |||
| 445cebbdaa | |||
| ac326d2f3b | |||
| cf4a318f80 | |||
| d4c1b75664 | |||
| 9076a56953 | |||
| 315184aeee | |||
| d76f66dde9 | |||
| 4f3f057884 | |||
| c020af7119 | |||
| 8a2366b231 | |||
| 298f767799 | |||
| c711a66af2 | |||
| 4abc65705c | |||
| 69a30a1c2f | |||
| 0d4f86ce4b | |||
| da586c3430 | |||
| 1c70d75ec0 | |||
| 326d894b83 | |||
| f16220e6a9 | |||
| b60f49c799 | |||
| 70c64c1a46 | |||
| 9b27aac9ba | |||
| 14bc58d411 | |||
| 3ebaafd6e5 | |||
| 215692747d | |||
| d8feb56f5d | |||
| f4d8da26f5 | |||
| 51c761454a | |||
| 3836cfd7e6 | |||
| 89d6849793 | |||
| c4269c100d | |||
| b2e3ce3b2b | |||
| 9a14f39663 | |||
| b41ee5a874 | |||
| 79c8c1dba4 | |||
| 6907f59129 | |||
| 2413b939a7 | |||
| e2dd0ea71e | |||
| 8ef0022d29 | |||
| 8fe9be5d8c | |||
| 9f64c0e6b7 | |||
| 1859dfe70d | |||
| 78fdca9618 | |||
| db9b5fc35c | |||
| 62c50f8579 | |||
| bb576411ca | |||
| be5ceecd4d | |||
| a7ad3d051a | |||
| b847c863d9 | |||
| d857dbc1c3 | |||
| 0e62d79714 | |||
| 86b331477a | |||
| 1cad7ef6fe | |||
| f4493074ae | |||
| a204aa1838 | |||
| b3a55ad382 | |||
| 74edbb3c5f | |||
| 381070ab03 | |||
| a2e32e1603 | |||
| 4d5dd30513 | |||
| 380a4235ff | |||
| 0efd6699e2 | |||
| e8a2e5e491 | |||
| 89a4886523 | |||
| 2f48f37d29 | |||
| 372bd6bd34 | |||
| 28f2414b0d | |||
| 9b3939b8f5 | |||
| ecb80afb03 | |||
| f0a346c4ff | |||
| 823ea10f96 | |||
| c57aac2fb1 | |||
| a57365af9c | |||
| 8a5ebf7f29 | |||
| f1a1f86ede | |||
| 31c6df4382 | |||
| 69beb9a8af | |||
| d66683e160 | |||
| e4335c36db | |||
| 66c8048d55 | |||
| db0f3b9159 | |||
| 4a4d9b02df | |||
| 86d1a59ede | |||
| 4dbb62e0c0 | |||
| 05ffd0842e | |||
| 345b5ba60d | |||
| 9be1b6a45e | |||
| aecd299b7a | |||
| f02d236f78 | |||
| 731fa029cd | |||
| cc1eb9113b | |||
| e3a3eacf9e | |||
| 15152a0a44 | |||
| 0681430f0f |
@@ -63,6 +63,7 @@ admin_externalpage_print_header($adminroot);
|
||||
|
||||
// choose an authentication method
|
||||
echo "<form $CFG->frametarget id=\"authmenu\" method=\"post\" action=\"auth_config.php\">\n";
|
||||
echo "<div>\n";
|
||||
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\" />\n";
|
||||
echo "<input type=\"hidden\" name=\"auth\" value=\"".$auth."\" />\n";
|
||||
|
||||
@@ -75,7 +76,8 @@ print_simple_box_end();
|
||||
echo "<hr />\n";
|
||||
$authplugin->config_form($frm, $err, $user_fields);
|
||||
print_simple_box_end();
|
||||
echo '<center><p><input type="submit" value="' . get_string("savechanges") . "\" /></p></center>\n";
|
||||
echo '<p style="text-align: center"><input type="submit" value="' . get_string("savechanges") . "\" /></p>\n";
|
||||
echo "</div>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
@@ -146,7 +148,7 @@ function print_auth_lock_options ($auth, $user_fields, $helptext, $retrieveopts,
|
||||
echo '</td><td>';
|
||||
|
||||
echo "<input id=\"lockconfig_{$varname}\" name=\"lockconfig_{$varname}\" type=\"text\" size=\"30\" value=\"{$pluginconfig->$varname}\" />";
|
||||
echo '<div align="right">';
|
||||
echo '<div style="text-align: right">';
|
||||
echo '<label for="menulockconfig_field_updatelocal_'.$field.'">'.get_string('auth_updatelocal', 'auth') . '</label> ';
|
||||
choose_from_menu($updatelocaloptions, "lockconfig_field_updatelocal_{$field}", $pluginconfig->{"field_updatelocal_$field"}, "");
|
||||
echo '<br />';
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@
|
||||
|
||||
print_heading($strblockname);
|
||||
|
||||
print_simple_box('<center>'.get_string('configwarning', 'admin').'</center>', 'center', '50%');
|
||||
print_simple_box(get_string('configwarning', 'admin'), 'center', '50%');
|
||||
echo '<br />';
|
||||
|
||||
echo '<form method="post" action="block.php">';
|
||||
|
||||
+1
-1
@@ -137,7 +137,7 @@
|
||||
|
||||
if (!empty($CFG->langcache)) {
|
||||
mtrace('Updating languages cache');
|
||||
get_list_of_languages();
|
||||
get_list_of_languages(true);
|
||||
}
|
||||
|
||||
mtrace('Removing expired enrolments ...', ''); // See MDL-8785
|
||||
|
||||
+3
-3
@@ -74,21 +74,21 @@
|
||||
admin_externalpage_print_header($adminroot);
|
||||
print_heading( $filtername );
|
||||
|
||||
print_simple_box("<center>".get_string("configwarning", "admin")."</center>", "center", "50%");
|
||||
print_simple_box(get_string("configwarning", "admin"), "center", "50%");
|
||||
echo "<br />";
|
||||
|
||||
print_simple_box_start("center",'');
|
||||
|
||||
?>
|
||||
<form action="filter.php?filter=<?php echo urlencode($param->filter); ?>" method="post">
|
||||
<div style="text-align: center">
|
||||
<input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />
|
||||
|
||||
<?php include "$CFG->dirroot/$param->filter/filterconfig.html"; ?>
|
||||
|
||||
<center>
|
||||
<input type="submit" name="submit" value="<?php print_string('savechanges'); ?>" />
|
||||
<input type="submit" name="reset" value="<?php echo print_string('resettodefaults'); ?>" />
|
||||
</center>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
+14
-5
@@ -189,10 +189,15 @@
|
||||
/// Continue with the instalation
|
||||
$db->debug = false;
|
||||
if ($status) {
|
||||
//ugly hack - install new groups: MDL-9217
|
||||
require_once("$CFG->dirroot/group/db/upgrade.php");
|
||||
install_group_db();
|
||||
|
||||
// Install the roles system.
|
||||
moodle_install_roles();
|
||||
set_config('statsrolesupgraded',time());
|
||||
|
||||
|
||||
// Write default settings unconditionally (i.e. even if a setting is already set, overwrite it)
|
||||
// (this should only have any effect during initial install).
|
||||
$adminroot = admin_get_root();
|
||||
@@ -285,7 +290,7 @@
|
||||
echo '<input type="hidden" name="confirmupgrade" value="1" />';
|
||||
echo '<input type="hidden" name="confirmrelease" value="1" />';
|
||||
echo '</div>';
|
||||
echo '<div class="continuebutton"><input name="autopilot" id="autopilot" type="checkbox" value="0" /><label for="autopilot">'.get_string('unattendedoperation', 'admin').'</label>';
|
||||
echo '<div class="continuebutton"><input name="autopilot" id="autopilot" type="checkbox" value="1" /><label for="autopilot">'.get_string('unattendedoperation', 'admin').'</label>';
|
||||
echo '<br /><br /><input type="submit" value="'.get_string('continue').'" /></div>';
|
||||
echo '</form>';
|
||||
}
|
||||
@@ -320,6 +325,9 @@
|
||||
/// If successful, continue upgrading roles and setting everything properly
|
||||
if ($status) {
|
||||
if (empty($CFG->rolesactive)) {
|
||||
//ugly hack - upgrade to new groups (from 1.6) : MDL-9217
|
||||
require_once("$CFG->dirroot/group/db/upgrade.php");
|
||||
install_group_db();
|
||||
// Upgrade to the roles system.
|
||||
moodle_install_roles();
|
||||
set_config('rolesactive', 1);
|
||||
@@ -367,6 +375,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
/// ugly hack - convert to new groups if upgrading from 1.7; must be reworked
|
||||
require_once("$CFG->dirroot/group/db/upgrade.php");
|
||||
upgrade_group_db("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
|
||||
|
||||
/// Find and check all main modules and load them up or upgrade them if necessary
|
||||
/// first old *.php update and then the new upgrade.php script
|
||||
upgrade_activity_modules("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
@@ -402,10 +415,6 @@
|
||||
require_once("$CFG->dirroot/lib/locallib.php");
|
||||
upgrade_local_db("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
|
||||
/// Check for new groups and upgrade if necessary. TODO:
|
||||
require_once("$CFG->dirroot/group/db/upgrade.php");
|
||||
upgrade_group_db("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
|
||||
/// Check for changes to RPC functions
|
||||
require_once($CFG->dirroot.'/admin/mnet/adminlib.php');
|
||||
upgrade_RPC_functions("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
|
||||
|
||||
+12
-7
@@ -82,7 +82,7 @@
|
||||
if (!$mode) {
|
||||
print_box_start();
|
||||
$currlang = current_language();
|
||||
$langs = get_list_of_languages();
|
||||
$langs = get_list_of_languages(false, true);
|
||||
popup_form ("$CFG->wwwroot/$CFG->admin/lang.php?lang=", $langs, "chooselang", $currlang, "", "", "", false, 'self', $strcurrentlanguage.':');
|
||||
print_heading("<a href=\"lang.php?mode=missing\">$strmissingstrings</a>");
|
||||
print_heading("<a href=\"lang.php?mode=compare\">$streditstrings</a>");
|
||||
@@ -455,7 +455,7 @@
|
||||
echo $missingnext . '</td>';
|
||||
|
||||
} else {
|
||||
echo '<td bgcolor="'.$cellcolour.'" valign="top">'.$value.'</td>';
|
||||
echo '<td '.$cellcolour.' valign="top">'.$value.'</td>';
|
||||
}
|
||||
echo '</tr>'."\n";
|
||||
}
|
||||
@@ -468,8 +468,10 @@
|
||||
echo '</td></tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
if ($editable) {
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
} else {
|
||||
// no $currentfile specified
|
||||
@@ -526,10 +528,12 @@ function lang_save_file($path, $file, $strings, $local, $packstrings) {
|
||||
$value = lang_fix_value_before_save($value);
|
||||
if ($id == "string" and $value != ""){
|
||||
if ((!$local) || (lang_fix_value_from_file($packstrings[$stringname]) <> lang_fix_value_from_file($value))) {
|
||||
// Either we are saving the master language pack
|
||||
// or we are saving local language pack and the strings differ.
|
||||
fwrite($f,"\$string['$stringname'] = '$value';\n");
|
||||
if (LANG_KEEP_ORPHANS && isset($orphans[$stringname])) {
|
||||
unset($orphans[$stringname]);
|
||||
}
|
||||
}
|
||||
if (LANG_KEEP_ORPHANS && isset($orphans[$stringname])) {
|
||||
unset($orphans[$stringname]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -560,6 +564,7 @@ function lang_fix_value_from_file($value='') {
|
||||
$value = trim($value); // Delete leading/trailing white space
|
||||
$value = str_replace("\\","",$value); // Delete all slashes
|
||||
$value = str_replace("%%","%",$value);
|
||||
$value = str_replace("&","&",$value); // Fixes MDL-9248
|
||||
$value = str_replace("<","<",$value);
|
||||
$value = str_replace(">",">",$value);
|
||||
$value = str_replace('"',""",$value);
|
||||
|
||||
+11
-7
@@ -29,6 +29,12 @@
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
//reset and diagnose lang cache permissions
|
||||
@unlink($CFG->dataroot.'/cache/languages');
|
||||
if (file_exists($CFG->dataroot.'/cache/languages')) {
|
||||
notify('Language cache can not be deleted, please check permissions in dataroot.');
|
||||
}
|
||||
get_list_of_languages(true); //refresh lang cache
|
||||
|
||||
switch ($mode){
|
||||
|
||||
@@ -56,7 +62,7 @@
|
||||
break;
|
||||
|
||||
case INSTALLED:
|
||||
@unlink($CFG->dataroot.'/cache/languages');
|
||||
get_list_of_languages(true); //refresh lang cache
|
||||
redirect('langimport.php', get_string('langpackupdated','admin',$pack), -1, $adminroot);
|
||||
break;
|
||||
|
||||
@@ -103,14 +109,14 @@
|
||||
if (file_exists($dest2)){
|
||||
$rm2 = remove_dir($dest2);
|
||||
}
|
||||
get_list_of_languages(true); //refresh lang cache
|
||||
//delete the direcotries
|
||||
if ($rm1 or $rm2) {
|
||||
redirect('langimport.php', get_string('langpackremoved','admin'));
|
||||
redirect('langimport.php', get_string('langpackremoved','admin'), 3, $adminroot);
|
||||
} else { //nothing deleted, possibly due to permission error
|
||||
error('An error has occurred, language pack is not completely uninstalled, please check file permissions');
|
||||
}
|
||||
}
|
||||
@unlink($CFG->dataroot.'/cache/languages');
|
||||
break;
|
||||
|
||||
case UPDATE_ALL_LANG: //1 click update for all updatable language packs
|
||||
@@ -120,8 +126,7 @@
|
||||
$source = 'http://download.moodle.org/lang16/languages.md5';
|
||||
$md5array = array();
|
||||
$updated = 0; //any packs updated?
|
||||
unset($CFG->langlist); // ignore admin's langlist
|
||||
$alllangs = array_keys(get_list_of_languages());
|
||||
$alllangs = array_keys(get_list_of_languages(false, true)); //get all available langs
|
||||
$lang16 = array(); //all the Moodle 1.6 unicode lang packs (updated and not updated)
|
||||
$packs = array(); //all the packs that needs updating
|
||||
|
||||
@@ -247,8 +252,7 @@
|
||||
echo '<form id="uninstallform" action="langimport.php?mode=4" method="post">';
|
||||
echo '<fieldset class="invisiblefieldset">';
|
||||
echo '<input name="sesskey" type="hidden" value="'.sesskey().'" />';
|
||||
unset($CFG->langlist); // ignore admin's langlist
|
||||
$installedlangs = get_list_of_languages();
|
||||
$installedlangs = get_list_of_languages(false, true);
|
||||
|
||||
/// display installed langs here
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ print_header("$site->shortname: $strmnetsettings", "$site->fullname",
|
||||
|
||||
print_heading(get_string('mnetsettings', 'mnet'));
|
||||
?>
|
||||
<center>
|
||||
<table align="center" class="generalbox" border="0" cellpadding="5" cellspacing="0">
|
||||
<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->
|
||||
<table class="generalbox standard" border="0" cellpadding="5" cellspacing="0">
|
||||
<tr>
|
||||
<td class="generalboxcontent">
|
||||
<table cellpadding="9" cellspacing="0" >
|
||||
@@ -14,7 +14,7 @@ print_heading(get_string('mnetsettings', 'mnet'));
|
||||
<td colspan="2" class="header" cellpadding="0"><span><?php print_string('deleteaserver', 'mnet'); ?>Deleting a Server</span></td>
|
||||
</tr>
|
||||
<?php
|
||||
if (count($warn) > 0):
|
||||
if (count($warn) > 0){
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td align="right" colspan="2"><?php print_string('receivedwarnings','mnet'); ?>:<br />
|
||||
@@ -22,7 +22,7 @@ print_heading(get_string('mnetsettings', 'mnet'));
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
?>
|
||||
<tr valign="top">
|
||||
<td colspan="2"><?php print_string('reallydeleteserver','mnet'); ?>: "<?php echo $mnet_peer->name; ?>"?</td>
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
|
||||
<form id="assignform" method="post" action="">
|
||||
<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->
|
||||
<input type="hidden" name="previoussearch" value="<?php p($previoussearch) ?>" />
|
||||
<input type="hidden" name="courseid" value="<?php p($courseid) ?>" />
|
||||
<input type="hidden" name="host" value="<?php p($mnet_peer->id) ?>" />
|
||||
<input type="hidden" name="sesskey" value="<?php p(sesskey()) ?>" />
|
||||
<table align="center" border="0" cellpadding="5" cellspacing="0">
|
||||
<table class="generaltable" border="0" cellpadding="5" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<?php print_string('existingusers', 'role', count($mnetenrolledusers)); ?>
|
||||
@@ -99,4 +100,5 @@
|
||||
<td valign="top"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -29,9 +29,10 @@
|
||||
print_box('<strong>' . s($host->name) . ' </strong><br />'
|
||||
. get_string("enrolcourses_desc", "mnet"));
|
||||
|
||||
echo "<hr />";
|
||||
echo '<hr />';
|
||||
|
||||
print ('<table align="center" >');
|
||||
echo '<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->'
|
||||
. '<table class="generaltable">';
|
||||
|
||||
$icon = "<img src=\"$CFG->pixpath/i/course.gif\"".
|
||||
" class=\"icon\" alt=\"".get_string("course")."\" />";
|
||||
@@ -39,7 +40,7 @@
|
||||
foreach ($courses as $course) {
|
||||
$link = $CFG->wwwroot . '/admin/mnet/enr_course_enrol.php?'
|
||||
. "host={$mnethost}&courseid={$course->id}&sesskey={$USER->sesskey}";
|
||||
print ('<tr>'
|
||||
echo '<tr>'
|
||||
. "<td>$icon</td>"
|
||||
. "<td><a href=\"$link\">".format_string($course->fullname). "</a></td>"
|
||||
. '</tr><tr>'
|
||||
@@ -48,9 +49,9 @@
|
||||
. '</tr><tr>'
|
||||
. '<td></td>'
|
||||
. "<td align=\"left\" >{$course->summary}</td>"
|
||||
. '</tr>');
|
||||
. '</tr>';
|
||||
}
|
||||
print ('</table>');
|
||||
echo '</table></div>';
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
|
||||
@@ -22,19 +22,20 @@
|
||||
|
||||
print_box(get_string("remoteenrolhosts_desc", "mnet"));
|
||||
|
||||
echo "<hr />";
|
||||
echo '<hr />';
|
||||
|
||||
if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict') {
|
||||
print_box(get_string('mnetdisabled','mnet'));
|
||||
}
|
||||
|
||||
print ('<table align="center" cellspacing="0" cellpadding="5" width="500" id="hosts" class="generaltable generalbox" >'
|
||||
echo '<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->'
|
||||
. '<table cellspacing="0" cellpadding="5" id="hosts" class="generaltable generalbox" >'
|
||||
. '<tr>'
|
||||
. '<th class="header c0"> '.get_string('host', 'mnet').' </th>'
|
||||
. '<th class="header c1"> '.get_string('enrolments', 'mnet').' </th>'
|
||||
. '<th class="header c2"> '.get_string('courses', 'mnet').' </th>'
|
||||
// . '<th class="header c3"> </th>'
|
||||
. '</tr>');
|
||||
. '</tr>';
|
||||
$hosts = $enrolment->list_remote_servers();
|
||||
foreach ($hosts as $host) {
|
||||
$coursesurl = "{$CFG->wwwroot}/admin/mnet/enr_courses.php?host={$host->id}&sesskey={$USER->sesskey}";
|
||||
@@ -44,16 +45,17 @@
|
||||
}
|
||||
$enrolcount = get_field_sql("SELECT count(id) FROM {$CFG->prefix}mnet_enrol_assignments WHERE hostid={$host->id}");
|
||||
|
||||
print ('<tr>'
|
||||
echo '<tr>'
|
||||
. "<td><a href=\"{$coursesurl}\">{$host->name}</a></td>"
|
||||
. "<td align=\"center\" >$enrolcount</td>"
|
||||
. "<td align=\"center\" >$coursecount - <a href=\"{$coursesurl}\">".get_string('editenrolments', 'mnet')."</a></td>"
|
||||
// TODO: teach report/log/index.php to show per-host-logs
|
||||
// . '<td align="center" ><a href="{$CFG->wwwroot}/admin/report/log/index.php?course_host={$host->id}">'
|
||||
// . get_string('logs', 'mnet').'</a> </td>'
|
||||
. '</tr>');
|
||||
. '</tr>';
|
||||
}
|
||||
print ('</table>');
|
||||
echo '</table>'
|
||||
. '</div>';
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
|
||||
@@ -112,8 +112,8 @@
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('net', 'mnet'); ?>:</td>
|
||||
<td><input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
<input type="radio" name="mode" value="off" <?php echo ("off" == $CFG->mnet_dispatcher_mode)? 'checked="true"' : '' ?> /> <?php print_string('off', 'mnet'); ?> <br />
|
||||
<input type="radio" name="mode" value="strict" <?php echo ("strict" == $CFG->mnet_dispatcher_mode)? 'checked="true"' : '' ?> /> <?php print_string('on', 'mnet'); ?><br />
|
||||
<input type="radio" name="mode" value="off" <?php echo ("off" == $CFG->mnet_dispatcher_mode)? 'checked="checked"' : '' ?> /> <?php print_string('off', 'mnet'); ?> <br />
|
||||
<input type="radio" name="mode" value="strict" <?php echo ("strict" == $CFG->mnet_dispatcher_mode)? 'checked="checked"' : '' ?> /> <?php print_string('on', 'mnet'); ?><br />
|
||||
<input type="submit" name="submit" value="<?php print_string('savechanges'); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -19,6 +19,7 @@ print_tabs(array($tabs), 'mnetdetails');
|
||||
print_simple_box_start("center", "");
|
||||
?>
|
||||
<form method="post" action="peers.php">
|
||||
<div>
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
<input type="hidden" name="step" value="commit" />
|
||||
<input type="hidden" name="last_connect_time" value="<?php echo $mnet_peer->last_connect_time; ?>" />
|
||||
@@ -74,7 +75,7 @@ if (isset($mnet_peer->deleted) && $mnet_peer->deleted > 0) {
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
if(!empty($currentkey)):
|
||||
if(!empty($currentkey)) {
|
||||
?>
|
||||
<tr>
|
||||
<td align="right" valign="top"></td>
|
||||
@@ -85,30 +86,30 @@ if(!empty($currentkey)):
|
||||
<td valign="top"><pre style="font-size: 8px;"><?php echo $currentkey;?></pre></td>
|
||||
</tr>
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
|
||||
if (isset($mnet_peer->id) && $mnet_peer->id > 0):
|
||||
if (isset($mnet_peer->id) && $mnet_peer->id > 0) {
|
||||
?>
|
||||
<tr>
|
||||
<td align="right" valign="top"><?php print_string('last_connect_time', 'mnet'); ?>:</td>
|
||||
<td valign="top"><?php echo ($mnet_peer->last_connect_time == 0)? get_string('never','mnet') : date('H:i:s d/m/Y',$mnet_peer->last_connect_time);?></td>
|
||||
</tr>
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
|
||||
if (isset($mnet_peer->deleted) && $mnet_peer->deleted > 0):
|
||||
if (isset($mnet_peer->deleted) && $mnet_peer->deleted > 0){
|
||||
?>
|
||||
<tr>
|
||||
<td align="right" valign="top"><?php print_string('deleted'); ?>:</td>
|
||||
<td valign="top">
|
||||
<input type="radio" name="deleted" value="0" checked="true" /> <?php print_string('reenableserver','mnet'); ?><br />
|
||||
<input type="radio" name="deleted" value="0" checked="checked" /> <?php print_string('reenableserver','mnet'); ?><br />
|
||||
<input type="radio" name="deleted" value="1" /> <?php print_string('yes'); ?><br />
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
|
||||
if (isset($mnet_peer->ip_address) && '' != $mnet_peer->ip_address):
|
||||
if (isset($mnet_peer->ip_address) && '' != $mnet_peer->ip_address){
|
||||
?>
|
||||
<tr>
|
||||
<td align="right" valign="top"><?php print_string('ipaddress', 'mnet');
|
||||
@@ -119,13 +120,14 @@ if (isset($mnet_peer->ip_address) && '' != $mnet_peer->ip_address):
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><input type="submit" value="<?php print_string("savechanges"); ?>" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
print_simple_box_end();
|
||||
|
||||
@@ -16,21 +16,22 @@ print_simple_box_start("center", "");
|
||||
?>
|
||||
|
||||
<form method="post" action="mnet_services.php">
|
||||
<div>
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
<input type="hidden" name="step" value="<?php echo $mnet_peer->nextstep; ?>" />
|
||||
<input type="hidden" name="hostid" value="<?php echo ($mnet_peer->id)? $mnet_peer->id : '0' ; ?>" />
|
||||
<table cellpadding="9" cellspacing="0" >
|
||||
<?php
|
||||
foreach($myservices as $name => $versions):
|
||||
foreach($myservices as $name => $versions) {
|
||||
$version = current($versions);
|
||||
?>
|
||||
<tr>
|
||||
<td align="left" valign="top" colspan="2">
|
||||
<h3><?php echo get_string($name.'_name', $version['parent_type'].'_'.$version['parent'] , $mnet_peer->name); ?></h3>
|
||||
<p><?php echo get_string($name.'_description', $version['parent_type'].'_'.$version['parent'], $mnet_peer->name); ?></p>
|
||||
<?php echo get_string($name.'_description', $version['parent_type'].'_'.$version['parent'], $mnet_peer->name); ?>
|
||||
<?php
|
||||
$breakstring = '';
|
||||
foreach($versions as $version):
|
||||
foreach($versions as $version){
|
||||
if (count($versions) > 1) {
|
||||
$versionstring = '('.get_string('version','mnet') .' '.$version['apiversion'].')';
|
||||
} else {
|
||||
@@ -40,16 +41,37 @@ print_simple_box_start("center", "");
|
||||
echo $breakstring;
|
||||
?>
|
||||
<input type="hidden" name="exists[<?php echo $version['serviceid']; ?>]" value="1" />
|
||||
<input type="checkbox" name="publish[<?php echo $version['serviceid']; ?>]" <?php echo (!empty($version['I_publish']))? 'checked="checked" ': '' ; ?>/><?php print_string('publish','mnet'); ?><?php echo $versionstring; if (!empty($version['hostsubscribes'])) echo '<a href="#" title="'.get_string('issubscribed','mnet', $mnet_peer->name).'">√</a> '; if (!empty($version['allhosts_publish'])) print_string("enabled_for_all",'mnet',!empty($version['I_publish'])); ?><br />
|
||||
<input type="checkbox" name="subscribe[<?php echo $version['serviceid']; ?>]" <?php echo (!empty($version['I_subscribe']))? 'checked="checked" ': '' ; ?>/><?php print_string('subscribe','mnet'); ?><?php echo $versionstring; if (!empty($version['hostpublishes'])) echo '<a href="#" title="'.get_string('ispublished','mnet', $mnet_peer->name).'">√</a> '; if (!empty($version['allhosts_subscribe'])) print_string("enabled_for_all",'mnet',!empty($version['I_subscribe'])); ?><br />
|
||||
<?php
|
||||
<input type="checkbox" name="publish[<?php echo $version['serviceid']; ?>]" <?php echo (!empty($version['I_publish']))? 'checked="checked" ': '' ; ?>/>
|
||||
<?php
|
||||
print_string('publish','mnet');
|
||||
echo $versionstring;
|
||||
if (!empty($version['hostsubscribes'])) {
|
||||
echo '<a href="#" title="'.get_string('issubscribed','mnet', $mnet_peer->name).'">√</a> ';
|
||||
}
|
||||
if (!empty($version['allhosts_publish'])) {
|
||||
print_string("enabled_for_all",'mnet',!empty($version['I_publish']));
|
||||
}
|
||||
echo '<br />';
|
||||
?>
|
||||
<input type="checkbox" name="subscribe[<?php echo $version['serviceid']; ?>]" <?php echo (!empty($version['I_subscribe']))? 'checked="checked" ': '' ; ?>/>
|
||||
<?php
|
||||
print_string('subscribe','mnet');
|
||||
echo $versionstring;
|
||||
if (!empty($version['hostpublishes'])) {
|
||||
echo '<a href="#" title="'.get_string('ispublished','mnet', $mnet_peer->name).'">√</a> ';
|
||||
}
|
||||
if (!empty($version['allhosts_subscribe'])) {
|
||||
print_string("enabled_for_all",'mnet',!empty($version['I_subscribe']));
|
||||
}
|
||||
|
||||
echo '<br />';
|
||||
$breakstring = '. . . . . . . . . . . . . . . . . . . . . . . . <br>';
|
||||
endforeach;
|
||||
} // end foreach
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
endforeach;
|
||||
} // end foreach
|
||||
?>
|
||||
<tr>
|
||||
<td align="left" valign="top" colspan="2">
|
||||
@@ -70,6 +92,7 @@ print_simple_box_start("center", "");
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
print_simple_box_end();
|
||||
|
||||
+59
-54
@@ -5,36 +5,38 @@ if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict'
|
||||
print_box(get_string('mnetdisabled','mnet'));
|
||||
}
|
||||
?>
|
||||
<center>
|
||||
<form method="post" action="peers.php">
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
<input type="hidden" name="updateregisterall" value="1" />
|
||||
<table cellspacing="0" cellpadding="5" width="500" id="hosts" class="generaltable generalbox" >
|
||||
<tr>
|
||||
<th class="header c0" nowrap="nowrap" colspan="2"><?php print_string('registerallhosts', 'mnet'); ?></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell c1" colspan="2"><?php print_string('registerallhostsexplain', 'mnet'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell c1"><input type="checkbox" name="registerallhosts" <?php if (!empty($CFG->mnet_register_allhosts)) echo 'checked="checked" '; ?>/></td>
|
||||
<td class="cell c1"> <?php print_string('registerallhosts', 'mnet'); ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" colspan="2"><input type="submit" name="submit" value="<?php print_string('savechanges'); ?>" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<table cellspacing="0" cellpadding="5" id="hosts" class="generaltable generalbox" >
|
||||
<tr>
|
||||
<th class="header c0" nowrap="nowrap"><?php print_string('site'); ?></th>
|
||||
<th class="header c1" nowrap="nowrap"><?php print_string('system','mnet'); ?></th>
|
||||
<th class="header c2" nowrap="nowrap"><?php print_string('last_connect_time', 'mnet'); ?></th>
|
||||
<th class="header c3" nowrap="nowrap"></th>
|
||||
</tr>
|
||||
<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->
|
||||
<form method="post" action="peers.php">
|
||||
<div>
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
<input type="hidden" name="updateregisterall" value="1" />
|
||||
<table cellspacing="0" cellpadding="5" class="generaltable generalbox" >
|
||||
<tr>
|
||||
<th class="header c0" colspan="2"><?php print_string('registerallhosts', 'mnet'); ?></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell c1" colspan="2"><?php print_string('registerallhostsexplain', 'mnet'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell c1"><input type="checkbox" name="registerallhosts" <?php if (!empty($CFG->mnet_register_allhosts)) echo 'checked="checked" '; ?>/></td>
|
||||
<td class="cell c1"> <?php print_string('registerallhosts', 'mnet'); ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" colspan="2"><input type="submit" name="submit" value="<?php print_string('savechanges'); ?>" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
<table cellspacing="0" cellpadding="5" class="generaltable generalbox standard" >
|
||||
<tr>
|
||||
<th class="header c0"><?php print_string('site'); ?></th>
|
||||
<th class="header c1"><?php print_string('system','mnet'); ?></th>
|
||||
<th class="header c2"><?php print_string('last_connect_time', 'mnet'); ?></th>
|
||||
<th class="header c3"></th>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
foreach($hosts as $host):
|
||||
foreach($hosts as $host) {
|
||||
|
||||
if ($host->last_connect_time == 0) {
|
||||
$last_connect = get_string('never');
|
||||
@@ -46,43 +48,46 @@ if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict'
|
||||
<tr>
|
||||
<td class="cell c0"><a href="peers.php?step=update&hostid=<?php echo $host->id; ?>"><?php echo $host->name; ?></a></td>
|
||||
<td class="cell c1"><a href="peers.php?step=update&hostid=<?php echo $host->id; ?>"><?php echo $host->wwwroot; ?></a></td>
|
||||
<td class="cell c2" nowrap="nowrap"><?php if ($host->id != $CFG->mnet_all_hosts_id) echo $last_connect; ?></td>
|
||||
<td class="cell c2"><?php if ($host->id != $CFG->mnet_all_hosts_id) echo $last_connect; ?></td>
|
||||
<td class="cell c3">
|
||||
<?php if ($host->id != $CFG->mnet_all_hosts_id): ?>
|
||||
<?php if ($host->id != $CFG->mnet_all_hosts_id){ ?>
|
||||
<form method="post" action="delete.php">
|
||||
<div>
|
||||
<input type="hidden" name="hostid" value="<?php echo $host->id; ?>" />
|
||||
<input type="hidden" name="step" value="verify" />
|
||||
<input type="submit" name="submit" value="<?php print_string('delete'); ?>"/>
|
||||
</div>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
endforeach;
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td class="cell c4" colspan="4"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<form method="post" action="peers.php">
|
||||
<tr>
|
||||
<th class="header c4" nowrap="nowrap" colspan="4">
|
||||
<?php print_string('addnewhost', 'mnet'); ?>
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
<input type="hidden" name="step" value="input" />
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell c0"></td>
|
||||
<td class="cell c1"><input type="text" name="wwwroot" value="" /></td>
|
||||
<td class="cell c2"></td>
|
||||
<td class="cell c3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell c4" align="right" colspan="4"><input type="submit" value="<?php print_string('addhost','mnet'); ?>" /></td>
|
||||
</tr>
|
||||
<table cellspacing="0" cellpadding="5" class="generaltable generalbox standard" >
|
||||
|
||||
<tr>
|
||||
<th class="header c4" colspan="4">
|
||||
<?php print_string('addnewhost', 'mnet'); ?>
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
<input type="hidden" name="step" value="input" />
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell c0"></td>
|
||||
<td class="cell c1"><input type="text" name="wwwroot" value="" /></td>
|
||||
<td class="cell c2"></td>
|
||||
<td class="cell c3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell c4" align="right" colspan="4"><input type="submit" value="<?php print_string('addhost','mnet'); ?>" /></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
</table>
|
||||
</center>
|
||||
</div>
|
||||
<?php
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -1,36 +1,39 @@
|
||||
<?php
|
||||
admin_externalpage_print_header($adminroot);
|
||||
?>
|
||||
<center>
|
||||
<table cellspacing="0" cellpadding="5" width="500" id="hosts" class="generaltable generalbox" >
|
||||
<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->
|
||||
<table cellspacing="0" cellpadding="5" class="generaltable generalbox" >
|
||||
<tr>
|
||||
<th class="header c0" nowrap="nowrap" colspan="2"><?php print_string('trustedhosts', 'mnet'); ?></th>
|
||||
<th class="header c0" colspan="2"><?php print_string('trustedhosts', 'mnet'); ?></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell c1" colspan="2"><?php print_string('trustedhostsexplain', 'mnet'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cell c1" colspan="2"><form method="post" action="trustedhosts.php">
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
<textarea name="hostlist" cols="40" rows="20"><?php echo $trusted_hosts; ?></textarea><br />
|
||||
<input type="submit" value="<?php print_string('savechanges'); ?>" />
|
||||
<td class="cell c1" colspan="2">
|
||||
<form method="post" action="trustedhosts.php">
|
||||
<div>
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
<textarea name="hostlist" cols="40" rows="20"><?php echo $trusted_hosts; ?></textarea><br />
|
||||
<input type="submit" value="<?php print_string('savechanges'); ?>" />
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table cellspacing="0" cellpadding="5" width="500" id="hosts" class="generaltable generalbox" >
|
||||
<table cellspacing="0" cellpadding="5" class="generaltable generalbox" >
|
||||
<tr>
|
||||
<th class="header c0" nowrap="nowrap" colspan="2"><?php print_string('testtrustedhosts', 'mnet'); ?></th>
|
||||
<th class="header c0" colspan="2"><?php print_string('testtrustedhosts', 'mnet'); ?></th>
|
||||
</tr>
|
||||
<?php
|
||||
if (!empty($test_ip_address)):
|
||||
if (!empty($test_ip_address)){
|
||||
?>
|
||||
<tr>
|
||||
<td class="cell c1" colspan="2">
|
||||
<?php
|
||||
if ($in_range) {
|
||||
print_string('is_in_range', 'mnet', $test_ip_address);
|
||||
echo '<br>';
|
||||
echo '<br />';
|
||||
print_string('validated_by', 'mnet', $validated_by);
|
||||
} else {
|
||||
print_string('not_in_range', 'mnet', $test_ip_address);
|
||||
@@ -39,24 +42,27 @@ admin_externalpage_print_header($adminroot);
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
else:
|
||||
} else {
|
||||
?>
|
||||
<tr>
|
||||
<td class="cell c1" colspan="2"><?php print_string('testtrustedhostsexplain', 'mnet'); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td class="cell c1" colspan="2"><form method="get" action="trustedhosts.php">
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
<input type="text" name="testipaddress" value="<?php echo $test_ip_address; ?>" />
|
||||
<input type="submit" value="<?php print_string('go'); ?>" />
|
||||
<td class="cell c1" colspan="2">
|
||||
<form method="get" action="trustedhosts.php">
|
||||
<div>
|
||||
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />
|
||||
<input type="text" name="testipaddress" value="<?php echo $test_ip_address; ?>" />
|
||||
<input type="submit" value="<?php print_string('go'); ?>" />
|
||||
</div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
</div>
|
||||
<?php
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
|
||||
/// If data submitted, process and store
|
||||
if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
echo 'a';
|
||||
$hostlist = preg_split("/[\s,]+/", $form->hostlist);
|
||||
foreach($hostlist as $host) {
|
||||
list($address, $mask) = explode('/', $host.'/');
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@
|
||||
|
||||
print_heading($strmodulename);
|
||||
|
||||
print_simple_box("<center>".get_string("configwarning", 'admin')."</center>", "center", "60%");
|
||||
print_simple_box(get_string("configwarning", 'admin'), "center", "60%");
|
||||
echo "<br />";
|
||||
|
||||
print_simple_box_start("center", "");
|
||||
|
||||
@@ -45,8 +45,7 @@ class ExHtmlReporter extends HtmlReporter {
|
||||
|
||||
$this->strrunonlyfolder = $this->get_string('runonlyfolder');
|
||||
$this->strrunonlyfile = $this->get_string('runonlyfile');
|
||||
check_theme_arrows();
|
||||
$this->strseparator = ' <span class="sep">'.$THEME->rarrow.'</span> ';
|
||||
$this->strseparator = get_separator();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -80,9 +80,9 @@
|
||||
|
||||
echo '<form action="allowassign.php" method="post">';
|
||||
print_table($table);
|
||||
echo '<div class="buttons"><input type="submit" value="'.get_string('savechanges').'"/></div>';
|
||||
echo '<div class="buttons"><input type="submit" value="'.get_string('savechanges').'"/>';
|
||||
echo '<input type="hidden" name="dummy" value="1" />'; // this is needed otherwise we do not know a form has been submitted
|
||||
echo '</form>';
|
||||
echo '</div></form>';
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
|
||||
@@ -78,9 +78,9 @@
|
||||
|
||||
echo '<form action="allowoverride.php" method="post">';
|
||||
print_table($table);
|
||||
echo '<div class="buttons"><input type="submit" value="'.get_string('savechanges').'"/></div>';
|
||||
echo '<div class="buttons"><input type="submit" value="'.get_string('savechanges').'"/>';
|
||||
echo '<input type="hidden" name="dummy" value="1" />'; // this is needed otherwise we do not know a form has been submitted
|
||||
echo '</form>';
|
||||
echo '</div></form>';
|
||||
|
||||
admin_externalpage_print_footer($adminroot);
|
||||
|
||||
|
||||
@@ -38,9 +38,8 @@
|
||||
<br />
|
||||
<label title="<?php print_string('hiddenassign') ?>">
|
||||
<input type="checkbox" name="hidden" value="1" />
|
||||
<img src="<?php echo $CFG->pixpath; ?>/t/hide.gif" alt="<?php print_string('hiddenassign') ?>" class="hide-show-image" /> <?
|
||||
helpbutton ('hiddenassign', get_string('hiddenassign'));
|
||||
?>
|
||||
<img src="<?php echo $CFG->pixpath; ?>/t/hide.gif" alt="<?php print_string('hiddenassign') ?>" class="hide-show-image" />
|
||||
<?php helpbutton('hiddenassign', get_string('hiddenassign')); ?>
|
||||
</label>
|
||||
<?php check_theme_arrows(); ?>
|
||||
<p class="arrow_button">
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
<?php
|
||||
print_heading_with_help(get_string('permissions','role'), 'permissions');
|
||||
|
||||
$strinherit = get_string('inherit','role');
|
||||
$strinherit = get_string('notset','role');
|
||||
$strallow = get_string('allow','role');
|
||||
$strprevent = get_string('prevent','role');
|
||||
$strprohibit = get_string('prohibit','role');
|
||||
|
||||
@@ -162,6 +162,25 @@ if ($context->contextlevel != CONTEXT_SYSTEM) { // Print tabs for anything ex
|
||||
$activetwo = array();
|
||||
}
|
||||
|
||||
/// Here other core tabs should go (always calling tabs.php files)
|
||||
/// All the logic to decide what to show must be self-cointained in the tabs file
|
||||
/// ej.:
|
||||
/// include_once($CFG->dirroot . '/grades/tabs.php');
|
||||
|
||||
/// Finally, we support adding some 'on-the-fly' tabs here
|
||||
/// All the logic to decide what to show must be self-cointained in the tabs file
|
||||
if (isset($CFG->extratabs) && !empty($CFG->extratabs)) {
|
||||
if ($extratabs = explode(',', $CFG->extratabs)) {
|
||||
asort($extratabs);
|
||||
foreach($extratabs as $extratab) {
|
||||
/// Each extra tab mus be one $CFG->dirroot relative file
|
||||
if (file_exists($CFG->dirroot . '/' . $extratab)) {
|
||||
include_once($CFG->dirroot . '/' . $extratab);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($secondrow)) {
|
||||
$tabs = array($toprow, $secondrow);
|
||||
} else {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
$temp = new admin_settingpage('langsettings', get_string('languagesettings', 'admin'));
|
||||
$temp->add(new admin_setting_configselect('lang', get_string('lang', 'admin'), get_string('configlang', 'admin'), current_language(), get_list_of_languages())); // $CFG->lang might be set in installer already, default en or en_utf8 is in setup.php
|
||||
$temp->add(new admin_setting_configcheckbox('langmenu', get_string('langmenu', 'admin'), get_string('configlangmenu', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configtext('langlist', get_string('langlist', 'admin'), get_string('configlanglist', 'admin'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_langlist());
|
||||
$temp->add(new admin_setting_configcheckbox('langcache', get_string('langcache', 'admin'), get_string('configlangcache', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configtext('locale', get_string('localetext', 'admin'), get_string('configlocale', 'admin'), '', PARAM_FILE));
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ $temp->add(new admin_setting_configselect('fullnamedisplay', get_string('fullnam
|
||||
'lastname firstname' => get_string('lastname') . ' + ' . get_string('firstname'),
|
||||
'firstname' => get_string('firstname'))));
|
||||
$temp->add(new admin_setting_configcheckbox('extendedusernamechars', get_string('extendedusernamechars', 'admin'), get_string('configextendedusernamechars', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configtext('sitepolicy', get_string('sitepolicy', 'admin'), get_string('configsitepolicy', 'admin'), '', PARAM_URL));
|
||||
$temp->add(new admin_setting_configtext('sitepolicy', get_string('sitepolicy', 'admin'), get_string('configsitepolicy', 'admin'), '', PARAM_RAW));
|
||||
$temp->add(new admin_setting_configselect('bloglevel', get_string('bloglevel', 'admin'), get_string('configbloglevel', 'admin'), 4, array(5 => get_string('worldblogs','blog'),
|
||||
4 => get_string('siteblogs','blog'),
|
||||
3 => get_string('courseblogs','blog'),
|
||||
|
||||
@@ -67,8 +67,11 @@ if ($um->preprocess_files() && confirm_sesskey()) {
|
||||
@apache_child_terminate();
|
||||
}
|
||||
|
||||
//Fix mac/dos newlines
|
||||
$text = my_file_get_contents($filename);
|
||||
//trim utf-8 bom
|
||||
$textlib = new textlib();
|
||||
$text = $textlib->trim_utf8_bom($text);
|
||||
//Fix mac/dos newlines
|
||||
$text = preg_replace('!\r\n?!',"\n",$text);
|
||||
$fp = fopen($filename, "w");
|
||||
fwrite($fp,$text);
|
||||
@@ -265,7 +268,6 @@ if ($um->preprocess_files() && confirm_sesskey()) {
|
||||
//This can be used to obtain a list of userids for existing users
|
||||
notify("$olduser->id ".get_string('usernotaddedregistered', 'error', $username));
|
||||
$userserrors++;
|
||||
continue;
|
||||
}
|
||||
|
||||
} else { // new user
|
||||
@@ -299,8 +301,8 @@ if ($um->preprocess_files() && confirm_sesskey()) {
|
||||
if (!$course[$i]) {
|
||||
notify(get_string('coursegroupunknown','error',$addgroup[$i]));
|
||||
} else {
|
||||
if ($groupid = groups_get_group_by_name($course[$i]->id, $addgroup[$i])) { //TODO:check.
|
||||
$groupid[$i] = $groupid;
|
||||
if ($gid = groups_get_group_by_name($course[$i]->id, $addgroup[$i])) {
|
||||
$groupid[$i] = $gid;
|
||||
} else {
|
||||
notify(get_string('groupunknown','error',$addgroup[$i]));
|
||||
}
|
||||
|
||||
+18
-18
@@ -63,19 +63,24 @@
|
||||
$strsearch = get_string('search');
|
||||
$strshowallusers = get_string('showallusers');
|
||||
|
||||
if (empty($CFG->loginhttps)) {
|
||||
$securewwwroot = $CFG->wwwroot;
|
||||
} else {
|
||||
$securewwwroot = str_replace('http:','https:',$CFG->wwwroot);
|
||||
}
|
||||
|
||||
admin_externalpage_print_header($adminroot);
|
||||
|
||||
if ($confirmuser and confirm_sesskey()) {
|
||||
if (!$user = get_record('user', 'id', $confirmuser)) {
|
||||
error("No such user!");
|
||||
error("No such user!", '', true);
|
||||
}
|
||||
|
||||
$confirmeduser = new object();
|
||||
$confirmeduser->id = $confirmuser;
|
||||
$confirmeduser->confirmed = 1;
|
||||
$confirmeduser->timemodified = time();
|
||||
$auth = get_auth_plugin($user->auth);
|
||||
|
||||
if (update_record('user', $confirmeduser)) {
|
||||
$result = $auth->user_confirm(addslashes($user->username), addslashes($user->secret));
|
||||
|
||||
if ($result == AUTH_CONFIRM_OK or $result == AUTH_CONFIRM_ALREADY) {
|
||||
notify(get_string('userconfirmed', '', fullname($user, true)) );
|
||||
} else {
|
||||
notify(get_string('usernotconfirmed', '', fullname($user, true)));
|
||||
@@ -88,12 +93,12 @@
|
||||
}
|
||||
|
||||
if (!$user = get_record('user', 'id', $delete)) {
|
||||
error("No such user!");
|
||||
error("No such user!", '', true);
|
||||
}
|
||||
|
||||
$primaryadmin = get_admin();
|
||||
if ($user->id == $primaryadmin->id) {
|
||||
error("You are not allowed to delete the primary admin user!");
|
||||
error("You are not allowed to delete the primary admin user!", '', true);
|
||||
}
|
||||
|
||||
if ($confirm != md5($delete)) {
|
||||
@@ -127,7 +132,7 @@
|
||||
error('You are not permitted to modify the MNET access control list.');
|
||||
}
|
||||
if (!$user = get_record('user', 'id', $acl)) {
|
||||
error("No such user.");
|
||||
error("No such user.", '', true);
|
||||
}
|
||||
if (!is_mnet_remote_user($user)) {
|
||||
error('Users in the MNET access control list must be remote MNET users.');
|
||||
@@ -143,12 +148,12 @@
|
||||
$aclrecord->username = $user->username;
|
||||
$aclrecord->accessctrl = $accessctrl;
|
||||
if (!insert_record('mnet_sso_access_control', $aclrecord)) {
|
||||
error("Database error - Couldn't modify the MNET access control list.");
|
||||
error("Database error - Couldn't modify the MNET access control list.", '', true);
|
||||
}
|
||||
} else {
|
||||
$aclrecord->accessctrl = $accessctrl;
|
||||
if (!update_record('mnet_sso_access_control', $aclrecord)) {
|
||||
error("Database error - Couldn't modify the MNET access control list.");
|
||||
error("Database error - Couldn't modify the MNET access control list.", '', true);
|
||||
}
|
||||
}
|
||||
$mnethosts = get_records('mnet_host', '', '', 'id', 'id,wwwroot,name');
|
||||
@@ -297,11 +302,6 @@
|
||||
}
|
||||
|
||||
$mainadmin = get_admin();
|
||||
if(empty($CFG->loginhttps)) {
|
||||
$securewwwroot = $CFG->wwwroot;
|
||||
} else {
|
||||
$securewwwroot = str_replace('http:','https:',$CFG->wwwroot);
|
||||
}
|
||||
|
||||
$table->head = array ("$firstname / $lastname", $email, $city, $country, $lastaccess, "", "", "");
|
||||
$table->align = array ("left", "left", "left", "left", "left", "center", "center", "center");
|
||||
@@ -408,7 +408,7 @@
|
||||
echo "</td></tr></table>";
|
||||
|
||||
if (has_capability('moodle/user:create', $sitecontext)) {
|
||||
print_heading('<a href="../user/editadvanced.php?id=-1">'.get_string('addnewuser').'</a>');
|
||||
print_heading('<a href="'.$securewwwroot.'/user/editadvanced.php?id=-1">'.get_string('addnewuser').'</a>');
|
||||
}
|
||||
if (!empty($table)) {
|
||||
print_table($table);
|
||||
@@ -416,7 +416,7 @@
|
||||
"user.php?sort=$sort&dir=$dir&perpage=$perpage".
|
||||
"&firstinitial=$firstinitial&lastinitial=$lastinitial&search=".urlencode(stripslashes($search))."&");
|
||||
if (has_capability('moodle/user:create', $sitecontext)) {
|
||||
print_heading('<a href="../user/editadvanced.php?id=-1">'.get_string('addnewuser').'</a>');
|
||||
print_heading('<a href="'.$securewwwroot.'/user/editadvanced.php?id=-1">'.get_string('addnewuser').'</a>');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ class edit_field extends XMLDBAction {
|
||||
$o.= ' </table>';
|
||||
$o.= '</div></form>';
|
||||
/// Calculate the buttons
|
||||
$b = ' <p class="buttons">';
|
||||
$b = ' <p class="centerpara buttons">';
|
||||
/// The view original XML button
|
||||
if ($table->getField($fieldparam)) {
|
||||
$b .= ' <a href="index.php?action=view_field_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=original&table=' . $tableparam . '&field=' . $fieldparam . '">[' . $this->str['vieworiginal'] . ']</a>';
|
||||
|
||||
@@ -128,7 +128,7 @@ class edit_index extends XMLDBAction {
|
||||
$o.= ' </table>';
|
||||
$o.= '</div></form>';
|
||||
/// Calculate the buttons
|
||||
$b = ' <p class="buttons">';
|
||||
$b = ' <p class="centerpara buttons">';
|
||||
/// The view original XML button
|
||||
if ($table->getIndex($indexparam)) {
|
||||
$b .= ' <a href="index.php?action=view_index_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=original&table=' . $tableparam . '&index=' . $indexparam . '">[' . $this->str['vieworiginal'] . ']</a>';
|
||||
|
||||
@@ -140,7 +140,7 @@ class edit_key extends XMLDBAction {
|
||||
$o.= ' </table>';
|
||||
$o.= '</div></form>';
|
||||
/// Calculate the buttons
|
||||
$b = ' <p class="buttons">';
|
||||
$b = ' <p class="centerpara buttons">';
|
||||
/// The view original XML button
|
||||
if ($table->getKey($keyparam)) {
|
||||
$b .= ' <a href="index.php?action=view_key_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=original&table=' . $tableparam . '&key=' . $keyparam . '">[' . $this->str['vieworiginal'] . ']</a>';
|
||||
|
||||
@@ -133,7 +133,7 @@ class edit_sentence extends XMLDBAction {
|
||||
$o.= ' </table>';
|
||||
$o.= '</div></form>';
|
||||
/// Calculate the buttons
|
||||
$b = ' <p class="buttons">';
|
||||
$b = ' <p class="centerpara buttons">';
|
||||
/// The back to edit statement button
|
||||
$b .= ' <a href="index.php?action=edit_statement&statement=' . urlencode($statementparam) . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['back'] . ']</a>';
|
||||
$b .= '</p>';
|
||||
|
||||
@@ -115,7 +115,7 @@ class edit_statement extends XMLDBAction {
|
||||
$o.= ' </table>';
|
||||
$o.= '</div></form>';
|
||||
/// Calculate the buttons
|
||||
$b = ' <p class="buttons">';
|
||||
$b = ' <p class="centerpara buttons">';
|
||||
/// The view original XML button
|
||||
if ($origstructure->getStatement($statementparam)) {
|
||||
$b .= ' <a href="index.php?action=view_statement_xml&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '&select=original&statement=' . $statementparam . '">[' . $this->str['vieworiginal'] . ']</a>';
|
||||
|
||||
@@ -107,7 +107,7 @@ class edit_table_save extends XMLDBAction {
|
||||
"<a href=\"../index.php\">" . $this->str['administration'] . "</a> -> <a href=\"index.php\">XMLDB</a>");
|
||||
notice ('<p>' .implode(', ', $errors) . '</p>
|
||||
<p>' . $temptable->readableInfo(),
|
||||
'index.php?action=edit_table&table=' . $tableparam . '&dir=' . str_replace($CFG->dirroot, '', urlencode($dirpath)));
|
||||
'index.php?action=edit_table&table=' . $tableparam . '&dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)));
|
||||
die; /// re-die :-P
|
||||
}
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ class main_view extends XMLDBAction {
|
||||
/// The save button
|
||||
if ($dbdir->path_exists &&
|
||||
file_exists($key . '/install.xml') &&
|
||||
is_readable($key . '/install.xml') &&
|
||||
is_writeable($key . '/install.xml') &&
|
||||
is_writeable($key) &&
|
||||
!empty($dbdir->xml_loaded) &&
|
||||
!empty($dbdir->xml_changed)) {
|
||||
|
||||
+1284
-1182
File diff suppressed because it is too large
Load Diff
@@ -1,190 +1,190 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file CAS/PGTStorage/pgt-db.php
|
||||
* Basic class for PGT database storage
|
||||
*/
|
||||
|
||||
// include phpDB library (the test was introduced in release 0.4.8 for
|
||||
// the integration into Tikiwiki).
|
||||
if (!class_exists('DB')) {
|
||||
include_once('DB.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* @class PGTStorageDB
|
||||
* The PGTStorageDB class is a class for PGT database storage. An instance of
|
||||
* this class is returned by CASClient::SetPGTStorageDB().
|
||||
*
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
*
|
||||
* @ingroup internalPGTStorageDB
|
||||
*/
|
||||
|
||||
class PGTStorageDB extends PGTStorage
|
||||
{
|
||||
/**
|
||||
* @addtogroup internalPGTStorageDB
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* a string representing a PEAR DB URL to connect to the database. Written by
|
||||
* PGTStorageDB::PGTStorageDB(), read by getURL().
|
||||
*
|
||||
* @hideinitializer
|
||||
* @private
|
||||
*/
|
||||
var $_url='';
|
||||
|
||||
/**
|
||||
* This method returns the PEAR DB URL to use to connect to the database.
|
||||
*
|
||||
* @return a PEAR DB URL
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function getURL()
|
||||
{
|
||||
return $this->_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* The handle of the connection to the database where PGT's are stored. Written by
|
||||
* PGTStorageDB::init(), read by getLink().
|
||||
*
|
||||
* @hideinitializer
|
||||
* @private
|
||||
*/
|
||||
var $_link = null;
|
||||
|
||||
/**
|
||||
* This method returns the handle of the connection to the database where PGT's are
|
||||
* stored.
|
||||
*
|
||||
* @return a handle of connection.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function getLink()
|
||||
{
|
||||
return $this->_link;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the table where PGT's are stored. Written by
|
||||
* PGTStorageDB::PGTStorageDB(), read by getTable().
|
||||
*
|
||||
* @hideinitializer
|
||||
* @private
|
||||
*/
|
||||
var $_table = '';
|
||||
|
||||
/**
|
||||
* This method returns the name of the table where PGT's are stored.
|
||||
*
|
||||
* @return the name of a table.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function getTable()
|
||||
{
|
||||
return $this->_table;
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// DEBUGGING
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This method returns an informational string giving the type of storage
|
||||
* used by the object (used for debugging purposes).
|
||||
*
|
||||
* @return an informational string.
|
||||
* @public
|
||||
*/
|
||||
function getStorageType()
|
||||
{
|
||||
return "database";
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns an informational string giving informations on the
|
||||
* parameters of the storage.(used for debugging purposes).
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function getStorageInfo()
|
||||
{
|
||||
return 'url=`'.$this->getURL().'\', table=`'.$this->getTable().'\'';
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// CONSTRUCTOR
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* The class constructor, called by CASClient::SetPGTStorageDB().
|
||||
*
|
||||
* @param $cas_parent the CASClient instance that creates the object.
|
||||
* @param $user the user to access the data with
|
||||
* @param $password the user's password
|
||||
* @param $database_type the type of the database hosting the data
|
||||
* @param $hostname the server hosting the database
|
||||
* @param $port the port the server is listening on
|
||||
* @param $database the name of the database
|
||||
* @param $table the name of the table storing the data
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function PGTStorageDB($cas_parent,$user,$password,$database_type,$hostname,$port,$database,$table)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
|
||||
// call the ancestor's constructor
|
||||
$this->PGTStorage($cas_parent);
|
||||
|
||||
if ( empty($database_type) ) $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE;
|
||||
if ( empty($hostname) ) $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME;
|
||||
if ( $port==0 ) $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT;
|
||||
if ( empty($database) ) $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE;
|
||||
if ( empty($table) ) $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE;
|
||||
|
||||
// build and store the PEAR DB URL
|
||||
$this->_url = $database_type.':'.'//'.$user.':'.$password.'@'.$server.':'.$port.'/'.$database;
|
||||
|
||||
// XXX should use setURL and setTable
|
||||
phpCAS::traceEnd();
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// INITIALIZATION
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This method is used to initialize the storage. Halts on error.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
// if the storage has already been initialized, return immediatly
|
||||
if ( $this->isInitialized() )
|
||||
return;
|
||||
// call the ancestor's method (mark as initialized)
|
||||
parent::init();
|
||||
|
||||
// try to connect to the database
|
||||
$this->_link = DB::connect($this->getURL());
|
||||
if ( DB::isError($this->_link) ) {
|
||||
phpCAS::error('could not connect to database ('.DB::errorMessage($this->_link).')');
|
||||
}
|
||||
var_dump($this->_link);
|
||||
phpCAS::traceBEnd();
|
||||
}
|
||||
|
||||
/** @} */
|
||||
}
|
||||
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file CAS/PGTStorage/pgt-db.php
|
||||
* Basic class for PGT database storage
|
||||
*/
|
||||
|
||||
// include phpDB library (the test was introduced in release 0.4.8 for
|
||||
// the integration into Tikiwiki).
|
||||
if (!class_exists('DB')) {
|
||||
@include_once('DB.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* @class PGTStorageDB
|
||||
* The PGTStorageDB class is a class for PGT database storage. An instance of
|
||||
* this class is returned by CASClient::SetPGTStorageDB().
|
||||
*
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
*
|
||||
* @ingroup internalPGTStorageDB
|
||||
*/
|
||||
|
||||
class PGTStorageDB extends PGTStorage
|
||||
{
|
||||
/**
|
||||
* @addtogroup internalPGTStorageDB
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* a string representing a PEAR DB URL to connect to the database. Written by
|
||||
* PGTStorageDB::PGTStorageDB(), read by getURL().
|
||||
*
|
||||
* @hideinitializer
|
||||
* @private
|
||||
*/
|
||||
var $_url='';
|
||||
|
||||
/**
|
||||
* This method returns the PEAR DB URL to use to connect to the database.
|
||||
*
|
||||
* @return a PEAR DB URL
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function getURL()
|
||||
{
|
||||
return $this->_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* The handle of the connection to the database where PGT's are stored. Written by
|
||||
* PGTStorageDB::init(), read by getLink().
|
||||
*
|
||||
* @hideinitializer
|
||||
* @private
|
||||
*/
|
||||
var $_link = null;
|
||||
|
||||
/**
|
||||
* This method returns the handle of the connection to the database where PGT's are
|
||||
* stored.
|
||||
*
|
||||
* @return a handle of connection.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function getLink()
|
||||
{
|
||||
return $this->_link;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the table where PGT's are stored. Written by
|
||||
* PGTStorageDB::PGTStorageDB(), read by getTable().
|
||||
*
|
||||
* @hideinitializer
|
||||
* @private
|
||||
*/
|
||||
var $_table = '';
|
||||
|
||||
/**
|
||||
* This method returns the name of the table where PGT's are stored.
|
||||
*
|
||||
* @return the name of a table.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function getTable()
|
||||
{
|
||||
return $this->_table;
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// DEBUGGING
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This method returns an informational string giving the type of storage
|
||||
* used by the object (used for debugging purposes).
|
||||
*
|
||||
* @return an informational string.
|
||||
* @public
|
||||
*/
|
||||
function getStorageType()
|
||||
{
|
||||
return "database";
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns an informational string giving informations on the
|
||||
* parameters of the storage.(used for debugging purposes).
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function getStorageInfo()
|
||||
{
|
||||
return 'url=`'.$this->getURL().'\', table=`'.$this->getTable().'\'';
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// CONSTRUCTOR
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* The class constructor, called by CASClient::SetPGTStorageDB().
|
||||
*
|
||||
* @param $cas_parent the CASClient instance that creates the object.
|
||||
* @param $user the user to access the data with
|
||||
* @param $password the user's password
|
||||
* @param $database_type the type of the database hosting the data
|
||||
* @param $hostname the server hosting the database
|
||||
* @param $port the port the server is listening on
|
||||
* @param $database the name of the database
|
||||
* @param $table the name of the table storing the data
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function PGTStorageDB($cas_parent,$user,$password,$database_type,$hostname,$port,$database,$table)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
|
||||
// call the ancestor's constructor
|
||||
$this->PGTStorage($cas_parent);
|
||||
|
||||
if ( empty($database_type) ) $database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE;
|
||||
if ( empty($hostname) ) $hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME;
|
||||
if ( $port==0 ) $port = CAS_PGT_STORAGE_DB_DEFAULT_PORT;
|
||||
if ( empty($database) ) $database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE;
|
||||
if ( empty($table) ) $table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE;
|
||||
|
||||
// build and store the PEAR DB URL
|
||||
$this->_url = $database_type.':'.'//'.$user.':'.$password.'@'.$hostname.':'.$port.'/'.$database;
|
||||
|
||||
// XXX should use setURL and setTable
|
||||
phpCAS::traceEnd();
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// INITIALIZATION
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This method is used to initialize the storage. Halts on error.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
// if the storage has already been initialized, return immediatly
|
||||
if ( $this->isInitialized() )
|
||||
return;
|
||||
// call the ancestor's method (mark as initialized)
|
||||
parent::init();
|
||||
|
||||
// try to connect to the database
|
||||
$this->_link = DB::connect($this->getURL());
|
||||
if ( DB::isError($this->_link) ) {
|
||||
phpCAS::error('could not connect to database ('.DB::errorMessage($this->_link).')');
|
||||
}
|
||||
var_dump($this->_link);
|
||||
phpCAS::traceBEnd();
|
||||
}
|
||||
|
||||
/** @} */
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,237 +1,240 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file CAS/PGTStorage/pgt-file.php
|
||||
* Basic class for PGT file storage
|
||||
*/
|
||||
|
||||
/**
|
||||
* @class PGTStorageFile
|
||||
* The PGTStorageFile class is a class for PGT file storage. An instance of
|
||||
* this class is returned by CASClient::SetPGTStorageFile().
|
||||
*
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
*
|
||||
* @ingroup internalPGTStorageFile
|
||||
*/
|
||||
|
||||
class PGTStorageFile extends PGTStorage
|
||||
{
|
||||
/**
|
||||
* @addtogroup internalPGTStorageFile
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* a string telling where PGT's should be stored on the filesystem. Written by
|
||||
* PGTStorageFile::PGTStorageFile(), read by getPath().
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
var $_path;
|
||||
|
||||
/**
|
||||
* This method returns the name of the directory where PGT's should be stored
|
||||
* on the filesystem.
|
||||
*
|
||||
* @return the name of a directory (with leading and trailing '/')
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function getPath()
|
||||
{
|
||||
return $this->_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* a string telling the format to use to store PGT's (plain or xml). Written by
|
||||
* PGTStorageFile::PGTStorageFile(), read by getFormat().
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
var $_format;
|
||||
|
||||
/**
|
||||
* This method returns the format to use when storing PGT's on the filesystem.
|
||||
*
|
||||
* @return a string corresponding to the format used (plain or xml).
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function getFormat()
|
||||
{
|
||||
return $this->_format;
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// DEBUGGING
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This method returns an informational string giving the type of storage
|
||||
* used by the object (used for debugging purposes).
|
||||
*
|
||||
* @return an informational string.
|
||||
* @public
|
||||
*/
|
||||
function getStorageType()
|
||||
{
|
||||
return "file";
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns an informational string giving informations on the
|
||||
* parameters of the storage.(used for debugging purposes).
|
||||
*
|
||||
* @return an informational string.
|
||||
* @public
|
||||
*/
|
||||
function getStorageInfo()
|
||||
{
|
||||
return 'path=`'.$this->getPath().'\', format=`'.$this->getFormat().'\'';
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// CONSTRUCTOR
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* The class constructor, called by CASClient::SetPGTStorageFile().
|
||||
*
|
||||
* @param $cas_parent the CASClient instance that creates the object.
|
||||
* @param $format the format used to store the PGT's (`plain' and `xml' allowed).
|
||||
* @param $path the path where the PGT's should be stored
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function PGTStorageFile($cas_parent,$format,$path)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
// call the ancestor's constructor
|
||||
$this->PGTStorage($cas_parent);
|
||||
|
||||
if (empty($format) ) $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT;
|
||||
if (empty($path) ) $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH;
|
||||
|
||||
// check that the path is an absolute path
|
||||
if ( $path[0] != '/' ) {
|
||||
phpCAS::error('an absolute path is needed for PGT storage to file');
|
||||
}
|
||||
|
||||
// store the path (with a leading and trailing '/')
|
||||
$path = preg_replace('|[/]*$|','/',$path);
|
||||
$path = preg_replace('|^[/]*|','/',$path);
|
||||
$this->_path = $path;
|
||||
|
||||
// check the format and store it
|
||||
switch ($format) {
|
||||
case CAS_PGT_STORAGE_FILE_FORMAT_PLAIN:
|
||||
case CAS_PGT_STORAGE_FILE_FORMAT_XML:
|
||||
$this->_format = $format;
|
||||
break;
|
||||
default:
|
||||
phpCAS::error('unknown PGT file storage format (`'.CAS_PGT_STORAGE_FILE_FORMAT_PLAIN.'\' and `'.CAS_PGT_STORAGE_FILE_FORMAT_XML.'\' allowed)');
|
||||
}
|
||||
phpCAS::traceEnd();
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// INITIALIZATION
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This method is used to initialize the storage. Halts on error.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
// if the storage has already been initialized, return immediatly
|
||||
if ( $this->isInitialized() )
|
||||
return;
|
||||
// call the ancestor's method (mark as initialized)
|
||||
parent::init();
|
||||
phpCAS::traceEnd();
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// PGT I/O
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This method returns the filename corresponding to a PGT Iou.
|
||||
*
|
||||
* @param $pgt_iou the PGT iou.
|
||||
*
|
||||
* @return a filename
|
||||
* @private
|
||||
*/
|
||||
function getPGTIouFilename($pgt_iou)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
return $this->getPath().$pgt_iou.'.'.$this->getFormat();
|
||||
phpCAS::traceEnd();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method stores a PGT and its corresponding PGT Iou into a file. Echoes a
|
||||
* warning on error.
|
||||
*
|
||||
* @param $pgt the PGT
|
||||
* @param $pgt_iou the PGT iou
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function write($pgt,$pgt_iou)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
$fname = $this->getPGTIouFilename($pgt_iou);
|
||||
if ( $f=fopen($fname,"w") ) {
|
||||
if ( fputs($f,$pgt) === FALSE ) {
|
||||
phpCAS::error('could not write PGT to `'.$fname.'\'');
|
||||
}
|
||||
fclose($f);
|
||||
} else {
|
||||
phpCAS::error('could not open `'.$fname.'\'');
|
||||
}
|
||||
phpCAS::traceEnd();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method reads a PGT corresponding to a PGT Iou and deletes the
|
||||
* corresponding file.
|
||||
*
|
||||
* @param $pgt_iou the PGT iou
|
||||
*
|
||||
* @return the corresponding PGT, or FALSE on error
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function read($pgt_iou)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
$pgt = FALSE;
|
||||
$fname = $this->getPGTIouFilename($pgt_iou);
|
||||
if ( !($f=fopen($fname,"r")) ) {
|
||||
phpCAS::trace('could not open `'.$fname.'\'');
|
||||
} else {
|
||||
if ( ($pgt=fgets($f)) === FALSE ) {
|
||||
phpCAS::trace('could not read PGT from `'.$fname.'\'');
|
||||
}
|
||||
fclose($f);
|
||||
}
|
||||
|
||||
// delete the PGT file
|
||||
@unlink($fname);
|
||||
|
||||
phpCAS::traceEnd($pgt);
|
||||
return $pgt;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file CAS/PGTStorage/pgt-file.php
|
||||
* Basic class for PGT file storage
|
||||
*/
|
||||
|
||||
/**
|
||||
* @class PGTStorageFile
|
||||
* The PGTStorageFile class is a class for PGT file storage. An instance of
|
||||
* this class is returned by CASClient::SetPGTStorageFile().
|
||||
*
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
*
|
||||
* @ingroup internalPGTStorageFile
|
||||
*/
|
||||
|
||||
class PGTStorageFile extends PGTStorage
|
||||
{
|
||||
/**
|
||||
* @addtogroup internalPGTStorageFile
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* a string telling where PGT's should be stored on the filesystem. Written by
|
||||
* PGTStorageFile::PGTStorageFile(), read by getPath().
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
var $_path;
|
||||
|
||||
/**
|
||||
* This method returns the name of the directory where PGT's should be stored
|
||||
* on the filesystem.
|
||||
*
|
||||
* @return the name of a directory (with leading and trailing '/')
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function getPath()
|
||||
{
|
||||
return $this->_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* a string telling the format to use to store PGT's (plain or xml). Written by
|
||||
* PGTStorageFile::PGTStorageFile(), read by getFormat().
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
var $_format;
|
||||
|
||||
/**
|
||||
* This method returns the format to use when storing PGT's on the filesystem.
|
||||
*
|
||||
* @return a string corresponding to the format used (plain or xml).
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function getFormat()
|
||||
{
|
||||
return $this->_format;
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// DEBUGGING
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This method returns an informational string giving the type of storage
|
||||
* used by the object (used for debugging purposes).
|
||||
*
|
||||
* @return an informational string.
|
||||
* @public
|
||||
*/
|
||||
function getStorageType()
|
||||
{
|
||||
return "file";
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns an informational string giving informations on the
|
||||
* parameters of the storage.(used for debugging purposes).
|
||||
*
|
||||
* @return an informational string.
|
||||
* @public
|
||||
*/
|
||||
function getStorageInfo()
|
||||
{
|
||||
return 'path=`'.$this->getPath().'\', format=`'.$this->getFormat().'\'';
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// CONSTRUCTOR
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* The class constructor, called by CASClient::SetPGTStorageFile().
|
||||
*
|
||||
* @param $cas_parent the CASClient instance that creates the object.
|
||||
* @param $format the format used to store the PGT's (`plain' and `xml' allowed).
|
||||
* @param $path the path where the PGT's should be stored
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function PGTStorageFile($cas_parent,$format,$path)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
// call the ancestor's constructor
|
||||
$this->PGTStorage($cas_parent);
|
||||
|
||||
if (empty($format) ) $format = CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT;
|
||||
if (empty($path) ) $path = CAS_PGT_STORAGE_FILE_DEFAULT_PATH;
|
||||
|
||||
// check that the path is an absolute path
|
||||
if ( $path[0] != '/' ) {
|
||||
phpCAS::error('an absolute path is needed for PGT storage to file');
|
||||
}
|
||||
|
||||
// store the path (with a leading and trailing '/')
|
||||
$path = preg_replace('|[/]*$|','/',$path);
|
||||
$path = preg_replace('|^[/]*|','/',$path);
|
||||
$this->_path = $path;
|
||||
|
||||
// check the format and store it
|
||||
switch ($format) {
|
||||
case CAS_PGT_STORAGE_FILE_FORMAT_PLAIN:
|
||||
case CAS_PGT_STORAGE_FILE_FORMAT_XML:
|
||||
$this->_format = $format;
|
||||
break;
|
||||
default:
|
||||
phpCAS::error('unknown PGT file storage format (`'.CAS_PGT_STORAGE_FILE_FORMAT_PLAIN.'\' and `'.CAS_PGT_STORAGE_FILE_FORMAT_XML.'\' allowed)');
|
||||
}
|
||||
phpCAS::traceEnd();
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// INITIALIZATION
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This method is used to initialize the storage. Halts on error.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
// if the storage has already been initialized, return immediatly
|
||||
if ( $this->isInitialized() )
|
||||
return;
|
||||
// call the ancestor's method (mark as initialized)
|
||||
parent::init();
|
||||
phpCAS::traceEnd();
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// PGT I/O
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This method returns the filename corresponding to a PGT Iou.
|
||||
*
|
||||
* @param $pgt_iou the PGT iou.
|
||||
*
|
||||
* @return a filename
|
||||
* @private
|
||||
*/
|
||||
function getPGTIouFilename($pgt_iou)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
$filename = $this->getPath().$pgt_iou.'.'.$this->getFormat();
|
||||
|
||||
phpCAS::traceEnd($filename);
|
||||
return $filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method stores a PGT and its corresponding PGT Iou into a file. Echoes a
|
||||
* warning on error.
|
||||
*
|
||||
* @param $pgt the PGT
|
||||
* @param $pgt_iou the PGT iou
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function write($pgt,$pgt_iou)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
$fname = $this->getPGTIouFilename($pgt_iou);
|
||||
if ( $f=fopen($fname,"w") ) {
|
||||
if ( fputs($f,$pgt) === FALSE ) {
|
||||
phpCAS::error('could not write PGT to `'.$fname.'\'');
|
||||
}
|
||||
fclose($f);
|
||||
} else {
|
||||
phpCAS::error('could not open `'.$fname.'\'');
|
||||
}
|
||||
phpCAS::traceEnd();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method reads a PGT corresponding to a PGT Iou and deletes the
|
||||
* corresponding file.
|
||||
*
|
||||
* @param $pgt_iou the PGT iou
|
||||
*
|
||||
* @return the corresponding PGT, or FALSE on error
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function read($pgt_iou)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
$pgt = FALSE;
|
||||
$fname = $this->getPGTIouFilename($pgt_iou);
|
||||
|
||||
if ( !($f=fopen($fname,"r")) ) {
|
||||
phpCAS::trace('could not open `'.$fname.'\'');
|
||||
} else {
|
||||
if ( ($pgt=fgets($f)) === FALSE ) {
|
||||
phpCAS::trace('could not read PGT from `'.$fname.'\'');
|
||||
}
|
||||
fclose($f);
|
||||
}
|
||||
|
||||
// delete the PGT file
|
||||
@unlink($fname);
|
||||
|
||||
phpCAS::traceEnd($pgt);
|
||||
return $pgt;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,188 +1,188 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file CAS/PGTStorage/pgt-main.php
|
||||
* Basic class for PGT storage
|
||||
*/
|
||||
|
||||
/**
|
||||
* @class PGTStorage
|
||||
* The PGTStorage class is a generic class for PGT storage. This class should
|
||||
* not be instanciated itself but inherited by specific PGT storage classes.
|
||||
*
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
*
|
||||
* @ingroup internalPGTStorage
|
||||
*/
|
||||
|
||||
class PGTStorage
|
||||
{
|
||||
/**
|
||||
* @addtogroup internalPGTStorage
|
||||
* @{
|
||||
*/
|
||||
|
||||
// ########################################################################
|
||||
// CONSTRUCTOR
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* The constructor of the class, should be called only by inherited classes.
|
||||
*
|
||||
* @param $cas_parent the CASclient instance that creates the current object.
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
function PGTStorage($cas_parent)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
if ( !$cas_parent->isProxy() ) {
|
||||
phpCAS::error('defining PGT storage makes no sense when not using a CAS proxy');
|
||||
}
|
||||
phpCAS::traceEnd();
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// DEBUGGING
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This virtual method returns an informational string giving the type of storage
|
||||
* used by the object (used for debugging purposes).
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function getStorageType()
|
||||
{
|
||||
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
|
||||
}
|
||||
|
||||
/**
|
||||
* This virtual method returns an informational string giving informations on the
|
||||
* parameters of the storage.(used for debugging purposes).
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function getStorageInfo()
|
||||
{
|
||||
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// ERROR HANDLING
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* string used to store an error message. Written by PGTStorage::setErrorMessage(),
|
||||
* read by PGTStorage::getErrorMessage().
|
||||
*
|
||||
* @hideinitializer
|
||||
* @private
|
||||
* @deprecated not used.
|
||||
*/
|
||||
var $_error_message=FALSE;
|
||||
|
||||
/**
|
||||
* This method sets en error message, which can be read later by
|
||||
* PGTStorage::getErrorMessage().
|
||||
*
|
||||
* @param $error_message an error message
|
||||
*
|
||||
* @protected
|
||||
* @deprecated not used.
|
||||
*/
|
||||
function setErrorMessage($error_message)
|
||||
{
|
||||
$this->_error_message = $error_message;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns an error message set by PGTStorage::setErrorMessage().
|
||||
*
|
||||
* @return an error message when set by PGTStorage::setErrorMessage(), FALSE
|
||||
* otherwise.
|
||||
*
|
||||
* @public
|
||||
* @deprecated not used.
|
||||
*/
|
||||
function getErrorMessage()
|
||||
{
|
||||
return $this->_error_message;
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// INITIALIZATION
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* a boolean telling if the storage has already been initialized. Written by
|
||||
* PGTStorage::init(), read by PGTStorage::isInitialized().
|
||||
*
|
||||
* @hideinitializer
|
||||
* @private
|
||||
*/
|
||||
var $_initialized = FALSE;
|
||||
|
||||
/**
|
||||
* This method tells if the storage has already been intialized.
|
||||
*
|
||||
* @return a boolean
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
function isInitialized()
|
||||
{
|
||||
return $this->_initialized;
|
||||
}
|
||||
|
||||
/**
|
||||
* This virtual method initializes the object.
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
$this->_initialized = TRUE;
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// PGT I/O
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This virtual method stores a PGT and its corresponding PGT Iuo.
|
||||
* @note Should never be called.
|
||||
*
|
||||
* @param $pgt the PGT
|
||||
* @param $pgt_iou the PGT iou
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
function write($pgt,$pgt_iou)
|
||||
{
|
||||
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
|
||||
}
|
||||
|
||||
/**
|
||||
* This virtual method reads a PGT corresponding to a PGT Iou and deletes
|
||||
* the corresponding storage entry.
|
||||
* @note Should never be called.
|
||||
*
|
||||
* @param $pgt_iou the PGT iou
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
function read($pgt_iou)
|
||||
{
|
||||
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
}
|
||||
|
||||
// include specific PGT storage classes
|
||||
include_once(dirname(__FILE__).'/pgt-file.php');
|
||||
include_once(dirname(__FILE__).'/pgt-db.php');
|
||||
|
||||
?>
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file CAS/PGTStorage/pgt-main.php
|
||||
* Basic class for PGT storage
|
||||
*/
|
||||
|
||||
/**
|
||||
* @class PGTStorage
|
||||
* The PGTStorage class is a generic class for PGT storage. This class should
|
||||
* not be instanciated itself but inherited by specific PGT storage classes.
|
||||
*
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
*
|
||||
* @ingroup internalPGTStorage
|
||||
*/
|
||||
|
||||
class PGTStorage
|
||||
{
|
||||
/**
|
||||
* @addtogroup internalPGTStorage
|
||||
* @{
|
||||
*/
|
||||
|
||||
// ########################################################################
|
||||
// CONSTRUCTOR
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* The constructor of the class, should be called only by inherited classes.
|
||||
*
|
||||
* @param $cas_parent the CASclient instance that creates the current object.
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
function PGTStorage($cas_parent)
|
||||
{
|
||||
phpCAS::traceBegin();
|
||||
if ( !$cas_parent->isProxy() ) {
|
||||
phpCAS::error('defining PGT storage makes no sense when not using a CAS proxy');
|
||||
}
|
||||
phpCAS::traceEnd();
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// DEBUGGING
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This virtual method returns an informational string giving the type of storage
|
||||
* used by the object (used for debugging purposes).
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function getStorageType()
|
||||
{
|
||||
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
|
||||
}
|
||||
|
||||
/**
|
||||
* This virtual method returns an informational string giving informations on the
|
||||
* parameters of the storage.(used for debugging purposes).
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function getStorageInfo()
|
||||
{
|
||||
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// ERROR HANDLING
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* string used to store an error message. Written by PGTStorage::setErrorMessage(),
|
||||
* read by PGTStorage::getErrorMessage().
|
||||
*
|
||||
* @hideinitializer
|
||||
* @private
|
||||
* @deprecated not used.
|
||||
*/
|
||||
var $_error_message=FALSE;
|
||||
|
||||
/**
|
||||
* This method sets en error message, which can be read later by
|
||||
* PGTStorage::getErrorMessage().
|
||||
*
|
||||
* @param $error_message an error message
|
||||
*
|
||||
* @protected
|
||||
* @deprecated not used.
|
||||
*/
|
||||
function setErrorMessage($error_message)
|
||||
{
|
||||
$this->_error_message = $error_message;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns an error message set by PGTStorage::setErrorMessage().
|
||||
*
|
||||
* @return an error message when set by PGTStorage::setErrorMessage(), FALSE
|
||||
* otherwise.
|
||||
*
|
||||
* @public
|
||||
* @deprecated not used.
|
||||
*/
|
||||
function getErrorMessage()
|
||||
{
|
||||
return $this->_error_message;
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// INITIALIZATION
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* a boolean telling if the storage has already been initialized. Written by
|
||||
* PGTStorage::init(), read by PGTStorage::isInitialized().
|
||||
*
|
||||
* @hideinitializer
|
||||
* @private
|
||||
*/
|
||||
var $_initialized = FALSE;
|
||||
|
||||
/**
|
||||
* This method tells if the storage has already been intialized.
|
||||
*
|
||||
* @return a boolean
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
function isInitialized()
|
||||
{
|
||||
return $this->_initialized;
|
||||
}
|
||||
|
||||
/**
|
||||
* This virtual method initializes the object.
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
$this->_initialized = TRUE;
|
||||
}
|
||||
|
||||
// ########################################################################
|
||||
// PGT I/O
|
||||
// ########################################################################
|
||||
|
||||
/**
|
||||
* This virtual method stores a PGT and its corresponding PGT Iuo.
|
||||
* @note Should never be called.
|
||||
*
|
||||
* @param $pgt the PGT
|
||||
* @param $pgt_iou the PGT iou
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
function write($pgt,$pgt_iou)
|
||||
{
|
||||
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
|
||||
}
|
||||
|
||||
/**
|
||||
* This virtual method reads a PGT corresponding to a PGT Iou and deletes
|
||||
* the corresponding storage entry.
|
||||
* @note Should never be called.
|
||||
*
|
||||
* @param $pgt_iou the PGT iou
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
function read($pgt_iou)
|
||||
{
|
||||
phpCAS::error(__CLASS__.'::'.__FUNCTION__.'() should never be called');
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
}
|
||||
|
||||
// include specific PGT storage classes
|
||||
include_once(dirname(__FILE__).'/pgt-file.php');
|
||||
include_once(dirname(__FILE__).'/pgt-db.php');
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,277 +1,277 @@
|
||||
<?php
|
||||
/**
|
||||
* @file domxml-php4-php5.php
|
||||
* Require PHP5, uses built-in DOM extension.
|
||||
* To be used in PHP4 scripts using DOMXML extension.
|
||||
* Allows PHP4/DOMXML scripts to run on PHP5/DOM.
|
||||
* (Requires PHP5/XSL extension for domxml_xslt functions)
|
||||
*
|
||||
* Typical use:
|
||||
* <pre>
|
||||
* {
|
||||
* if (version_compare(PHP_VERSION,'5','>='))
|
||||
* require_once('domxml-php4-to-php5.php');
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* Version 1.5.5, 2005-01-18, http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/
|
||||
*
|
||||
* ------------------------------------------------------------------<br>
|
||||
* Written by Alexandre Alapetite, http://alexandre.alapetite.net/cv/
|
||||
*
|
||||
* Copyright 2004, Licence: Creative Commons "Attribution-ShareAlike 2.0 France" BY-SA (FR),
|
||||
* http://creativecommons.org/licenses/by-sa/2.0/fr/
|
||||
* http://alexandre.alapetite.net/divers/apropos/#by-sa
|
||||
* - Attribution. You must give the original author credit
|
||||
* - Share Alike. If you alter, transform, or build upon this work,
|
||||
* you may distribute the resulting work only under a license identical to this one
|
||||
* - The French law is authoritative
|
||||
* - Any of these conditions can be waived if you get permission from Alexandre Alapetite
|
||||
* - Please send to Alexandre Alapetite the modifications you make,
|
||||
* in order to improve this file for the benefit of everybody
|
||||
*
|
||||
* If you want to distribute this code, please do it as a link to:
|
||||
* http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/
|
||||
*/
|
||||
|
||||
function domxml_new_doc($version) {return new php4DOMDocument('');}
|
||||
function domxml_open_file($filename) {return new php4DOMDocument($filename);}
|
||||
function domxml_open_mem($str)
|
||||
{
|
||||
$dom=new php4DOMDocument('');
|
||||
$dom->myDOMNode->loadXML($str);
|
||||
return $dom;
|
||||
}
|
||||
function xpath_eval($xpath_context,$eval_str,$contextnode=null) {return $xpath_context->query($eval_str,$contextnode);}
|
||||
function xpath_new_context($dom_document) {return new php4DOMXPath($dom_document);}
|
||||
|
||||
class php4DOMAttr extends php4DOMNode
|
||||
{
|
||||
function php4DOMAttr($aDOMAttr) {$this->myDOMNode=$aDOMAttr;}
|
||||
function Name() {return $this->myDOMNode->name;}
|
||||
function Specified() {return $this->myDOMNode->specified;}
|
||||
function Value() {return $this->myDOMNode->value;}
|
||||
}
|
||||
|
||||
class php4DOMDocument extends php4DOMNode
|
||||
{
|
||||
function php4DOMDocument($filename='')
|
||||
{
|
||||
$this->myDOMNode=new DOMDocument();
|
||||
if ($filename!='') $this->myDOMNode->load($filename);
|
||||
}
|
||||
function create_attribute($name,$value)
|
||||
{
|
||||
$myAttr=$this->myDOMNode->createAttribute($name);
|
||||
$myAttr->value=$value;
|
||||
return new php4DOMAttr($myAttr,$this);
|
||||
}
|
||||
function create_cdata_section($content) {return new php4DOMNode($this->myDOMNode->createCDATASection($content),$this);}
|
||||
function create_comment($data) {return new php4DOMNode($this->myDOMNode->createComment($data),$this);}
|
||||
function create_element($name) {return new php4DOMElement($this->myDOMNode->createElement($name),$this);}
|
||||
function create_text_node($content) {return new php4DOMNode($this->myDOMNode->createTextNode($content),$this);}
|
||||
function document_element() {return new php4DOMElement($this->myDOMNode->documentElement,$this);}
|
||||
function dump_file($filename,$compressionmode=false,$format=false) {return $this->myDOMNode->save($filename);}
|
||||
function dump_mem($format=false,$encoding=false) {return $this->myDOMNode->saveXML();}
|
||||
function get_element_by_id($id) {return new php4DOMElement($this->myDOMNode->getElementById($id),$this);}
|
||||
function get_elements_by_tagname($name)
|
||||
{
|
||||
$myDOMNodeList=$this->myDOMNode->getElementsByTagName($name);
|
||||
$nodeSet=array();
|
||||
$i=0;
|
||||
if (isset($myDOMNodeList))
|
||||
while ($node=$myDOMNodeList->item($i))
|
||||
{
|
||||
$nodeSet[]=new php4DOMElement($node,$this);
|
||||
$i++;
|
||||
}
|
||||
return $nodeSet;
|
||||
}
|
||||
function html_dump_mem() {return $this->myDOMNode->saveHTML();}
|
||||
function root() {return new php4DOMElement($this->myDOMNode->documentElement,$this);}
|
||||
}
|
||||
|
||||
class php4DOMElement extends php4DOMNode
|
||||
{
|
||||
function get_attribute($name) {return $this->myDOMNode->getAttribute($name);}
|
||||
function get_elements_by_tagname($name)
|
||||
{
|
||||
$myDOMNodeList=$this->myDOMNode->getElementsByTagName($name);
|
||||
$nodeSet=array();
|
||||
$i=0;
|
||||
if (isset($myDOMNodeList))
|
||||
while ($node=$myDOMNodeList->item($i))
|
||||
{
|
||||
$nodeSet[]=new php4DOMElement($node,$this->myOwnerDocument);
|
||||
$i++;
|
||||
}
|
||||
return $nodeSet;
|
||||
}
|
||||
function has_attribute($name) {return $this->myDOMNode->hasAttribute($name);}
|
||||
function remove_attribute($name) {return $this->myDOMNode->removeAttribute($name);}
|
||||
function set_attribute($name,$value) {return $this->myDOMNode->setAttribute($name,$value);}
|
||||
function tagname() {return $this->myDOMNode->tagName;}
|
||||
}
|
||||
|
||||
class php4DOMNode
|
||||
{
|
||||
var $myDOMNode;
|
||||
var $myOwnerDocument;
|
||||
function php4DOMNode($aDomNode,$aOwnerDocument)
|
||||
{
|
||||
$this->myDOMNode=$aDomNode;
|
||||
$this->myOwnerDocument=$aOwnerDocument;
|
||||
}
|
||||
function __get($name)
|
||||
{
|
||||
if ($name=='type') return $this->myDOMNode->nodeType;
|
||||
elseif ($name=='tagname') return $this->myDOMNode->tagName;
|
||||
elseif ($name=='content') return $this->myDOMNode->textContent;
|
||||
else
|
||||
{
|
||||
$myErrors=debug_backtrace();
|
||||
trigger_error('Undefined property: '.get_class($this).'::$'.$name.' ['.$myErrors[0]['file'].':'.$myErrors[0]['line'].']',E_USER_NOTICE);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function append_child($newnode) {return new php4DOMElement($this->myDOMNode->appendChild($newnode->myDOMNode),$this->myOwnerDocument);}
|
||||
function append_sibling($newnode) {return new php4DOMElement($this->myDOMNode->parentNode->appendChild($newnode->myDOMNode),$this->myOwnerDocument);}
|
||||
function attributes()
|
||||
{
|
||||
$myDOMNodeList=$this->myDOMNode->attributes;
|
||||
$nodeSet=array();
|
||||
$i=0;
|
||||
if (isset($myDOMNodeList))
|
||||
while ($node=$myDOMNodeList->item($i))
|
||||
{
|
||||
$nodeSet[]=new php4DOMAttr($node,$this->myOwnerDocument);
|
||||
$i++;
|
||||
}
|
||||
return $nodeSet;
|
||||
}
|
||||
function child_nodes()
|
||||
{
|
||||
$myDOMNodeList=$this->myDOMNode->childNodes;
|
||||
$nodeSet=array();
|
||||
$i=0;
|
||||
if (isset($myDOMNodeList))
|
||||
while ($node=$myDOMNodeList->item($i))
|
||||
{
|
||||
$nodeSet[]=new php4DOMElement($node,$this->myOwnerDocument);
|
||||
$i++;
|
||||
}
|
||||
return $nodeSet;
|
||||
}
|
||||
function children() {return $this->child_nodes();}
|
||||
function clone_node($deep=false) {return new php4DOMElement($this->myDOMNode->cloneNode($deep),$this->myOwnerDocument);}
|
||||
function first_child() {return new php4DOMElement($this->myDOMNode->firstChild,$this->myOwnerDocument);}
|
||||
function get_content() {return $this->myDOMNode->textContent;}
|
||||
function has_attributes() {return $this->myDOMNode->hasAttributes();}
|
||||
function has_child_nodes() {return $this->myDOMNode->hasChildNodes();}
|
||||
function insert_before($newnode,$refnode) {return new php4DOMElement($this->myDOMNode->insertBefore($newnode->myDOMNode,$refnode->myDOMNode),$this->myOwnerDocument);}
|
||||
function is_blank_node()
|
||||
{
|
||||
$myDOMNodeList=$this->myDOMNode->childNodes;
|
||||
$i=0;
|
||||
if (isset($myDOMNodeList))
|
||||
while ($node=$myDOMNodeList->item($i))
|
||||
{
|
||||
if (($node->nodeType==XML_ELEMENT_NODE)||
|
||||
(($node->nodeType==XML_TEXT_NODE)&&!ereg('^([[:cntrl:]]|[[:space:]])*$',$node->nodeValue)))
|
||||
return false;
|
||||
$i++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function last_child() {return new php4DOMElement($this->myDOMNode->lastChild,$this->myOwnerDocument);}
|
||||
function new_child($name,$content)
|
||||
{
|
||||
$mySubNode=$this->myDOMNode->ownerDocument->createElement($name);
|
||||
$mySubNode->appendChild($this->myDOMNode->ownerDocument->createTextNode($content));
|
||||
$this->myDOMNode->appendChild($mySubNode);
|
||||
return new php4DOMElement($mySubNode,$this->myOwnerDocument);
|
||||
}
|
||||
function next_sibling() {return new php4DOMElement($this->myDOMNode->nextSibling,$this->myOwnerDocument);}
|
||||
function node_name() {return $this->myDOMNode->localName;}
|
||||
function node_type() {return $this->myDOMNode->nodeType;}
|
||||
function node_value() {return $this->myDOMNode->nodeValue;}
|
||||
function owner_document() {return $this->myOwnerDocument;}
|
||||
function parent_node() {return new php4DOMElement($this->myDOMNode->parentNode,$this->myOwnerDocument);}
|
||||
function prefix() {return $this->myDOMNode->prefix;}
|
||||
function previous_sibling() {return new php4DOMElement($this->myDOMNode->previousSibling,$this->myOwnerDocument);}
|
||||
function remove_child($oldchild) {return new php4DOMElement($this->myDOMNode->removeChild($oldchild->myDOMNode),$this->myOwnerDocument);}
|
||||
function replace_child($oldnode,$newnode) {return new php4DOMElement($this->myDOMNode->replaceChild($oldnode->myDOMNode,$newnode->myDOMNode),$this->myOwnerDocument);}
|
||||
function set_content($text)
|
||||
{
|
||||
if (($this->myDOMNode->hasChildNodes())&&($this->myDOMNode->firstChild->nodeType==XML_TEXT_NODE))
|
||||
$this->myDOMNode->removeChild($this->myDOMNode->firstChild);
|
||||
return $this->myDOMNode->appendChild($this->myDOMNode->ownerDocument->createTextNode($text));
|
||||
}
|
||||
}
|
||||
|
||||
class php4DOMNodelist
|
||||
{
|
||||
var $myDOMNodelist;
|
||||
var $nodeset;
|
||||
function php4DOMNodelist($aDOMNodelist,$aOwnerDocument)
|
||||
{
|
||||
$this->myDOMNodelist=$aDOMNodelist;
|
||||
$this->nodeset=array();
|
||||
$i=0;
|
||||
if (isset($this->myDOMNodelist))
|
||||
while ($node=$this->myDOMNodelist->item($i))
|
||||
{
|
||||
$this->nodeset[]=new php4DOMElement($node,$aOwnerDocument);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class php4DOMXPath
|
||||
{
|
||||
var $myDOMXPath;
|
||||
var $myOwnerDocument;
|
||||
function php4DOMXPath($dom_document)
|
||||
{
|
||||
$this->myOwnerDocument=$dom_document;
|
||||
$this->myDOMXPath=new DOMXPath($dom_document->myDOMNode);
|
||||
}
|
||||
function query($eval_str,$contextnode)
|
||||
{
|
||||
if (isset($contextnode)) return new php4DOMNodelist($this->myDOMXPath->query($eval_str,$contextnode->myDOMNode),$this->myOwnerDocument);
|
||||
else return new php4DOMNodelist($this->myDOMXPath->query($eval_str),$this->myOwnerDocument);
|
||||
}
|
||||
function xpath_register_ns($prefix,$namespaceURI) {return $this->myDOMXPath->registerNamespace($prefix,$namespaceURI);}
|
||||
}
|
||||
|
||||
if (extension_loaded('xsl'))
|
||||
{//See also: http://alexandre.alapetite.net/doc-alex/xslt-php4-php5/
|
||||
function domxml_xslt_stylesheet($xslstring) {return new php4DomXsltStylesheet(DOMDocument::loadXML($xslstring));}
|
||||
function domxml_xslt_stylesheet_doc($dom_document) {return new php4DomXsltStylesheet($dom_document);}
|
||||
function domxml_xslt_stylesheet_file($xslfile) {return new php4DomXsltStylesheet(DOMDocument::load($xslfile));}
|
||||
class php4DomXsltStylesheet
|
||||
{
|
||||
var $myxsltProcessor;
|
||||
function php4DomXsltStylesheet($dom_document)
|
||||
{
|
||||
$this->myxsltProcessor=new xsltProcessor();
|
||||
$this->myxsltProcessor->importStyleSheet($dom_document);
|
||||
}
|
||||
function process($dom_document,$xslt_parameters=array(),$param_is_xpath=false)
|
||||
{
|
||||
foreach ($xslt_parameters as $param=>$value)
|
||||
$this->myxsltProcessor->setParameter('',$param,$value);
|
||||
$myphp4DOMDocument=new php4DOMDocument();
|
||||
$myphp4DOMDocument->myDOMNode=$this->myxsltProcessor->transformToDoc($dom_document->myDOMNode);
|
||||
return $myphp4DOMDocument;
|
||||
}
|
||||
function result_dump_file($dom_document,$filename)
|
||||
{
|
||||
$html=$dom_document->myDOMNode->saveHTML();
|
||||
file_put_contents($filename,$html);
|
||||
return $html;
|
||||
}
|
||||
function result_dump_mem($dom_document) {return $dom_document->myDOMNode->saveHTML();}
|
||||
}
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* @file domxml-php4-php5.php
|
||||
* Require PHP5, uses built-in DOM extension.
|
||||
* To be used in PHP4 scripts using DOMXML extension.
|
||||
* Allows PHP4/DOMXML scripts to run on PHP5/DOM.
|
||||
* (Requires PHP5/XSL extension for domxml_xslt functions)
|
||||
*
|
||||
* Typical use:
|
||||
* <pre>
|
||||
* {
|
||||
* if (version_compare(PHP_VERSION,'5','>='))
|
||||
* require_once('domxml-php4-to-php5.php');
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* Version 1.5.5, 2005-01-18, http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/
|
||||
*
|
||||
* ------------------------------------------------------------------<br>
|
||||
* Written by Alexandre Alapetite, http://alexandre.alapetite.net/cv/
|
||||
*
|
||||
* Copyright 2004, Licence: Creative Commons "Attribution-ShareAlike 2.0 France" BY-SA (FR),
|
||||
* http://creativecommons.org/licenses/by-sa/2.0/fr/
|
||||
* http://alexandre.alapetite.net/divers/apropos/#by-sa
|
||||
* - Attribution. You must give the original author credit
|
||||
* - Share Alike. If you alter, transform, or build upon this work,
|
||||
* you may distribute the resulting work only under a license identical to this one
|
||||
* - The French law is authoritative
|
||||
* - Any of these conditions can be waived if you get permission from Alexandre Alapetite
|
||||
* - Please send to Alexandre Alapetite the modifications you make,
|
||||
* in order to improve this file for the benefit of everybody
|
||||
*
|
||||
* If you want to distribute this code, please do it as a link to:
|
||||
* http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/
|
||||
*/
|
||||
|
||||
function domxml_new_doc($version) {return new php4DOMDocument('');}
|
||||
function domxml_open_file($filename) {return new php4DOMDocument($filename);}
|
||||
function domxml_open_mem($str)
|
||||
{
|
||||
$dom=new php4DOMDocument('');
|
||||
$dom->myDOMNode->loadXML($str);
|
||||
return $dom;
|
||||
}
|
||||
function xpath_eval($xpath_context,$eval_str,$contextnode=null) {return $xpath_context->query($eval_str,$contextnode);}
|
||||
function xpath_new_context($dom_document) {return new php4DOMXPath($dom_document);}
|
||||
|
||||
class php4DOMAttr extends php4DOMNode
|
||||
{
|
||||
function php4DOMAttr($aDOMAttr) {$this->myDOMNode=$aDOMAttr;}
|
||||
function Name() {return $this->myDOMNode->name;}
|
||||
function Specified() {return $this->myDOMNode->specified;}
|
||||
function Value() {return $this->myDOMNode->value;}
|
||||
}
|
||||
|
||||
class php4DOMDocument extends php4DOMNode
|
||||
{
|
||||
function php4DOMDocument($filename='')
|
||||
{
|
||||
$this->myDOMNode=new DOMDocument();
|
||||
if ($filename!='') $this->myDOMNode->load($filename);
|
||||
}
|
||||
function create_attribute($name,$value)
|
||||
{
|
||||
$myAttr=$this->myDOMNode->createAttribute($name);
|
||||
$myAttr->value=$value;
|
||||
return new php4DOMAttr($myAttr,$this);
|
||||
}
|
||||
function create_cdata_section($content) {return new php4DOMNode($this->myDOMNode->createCDATASection($content),$this);}
|
||||
function create_comment($data) {return new php4DOMNode($this->myDOMNode->createComment($data),$this);}
|
||||
function create_element($name) {return new php4DOMElement($this->myDOMNode->createElement($name),$this);}
|
||||
function create_text_node($content) {return new php4DOMNode($this->myDOMNode->createTextNode($content),$this);}
|
||||
function document_element() {return new php4DOMElement($this->myDOMNode->documentElement,$this);}
|
||||
function dump_file($filename,$compressionmode=false,$format=false) {return $this->myDOMNode->save($filename);}
|
||||
function dump_mem($format=false,$encoding=false) {return $this->myDOMNode->saveXML();}
|
||||
function get_element_by_id($id) {return new php4DOMElement($this->myDOMNode->getElementById($id),$this);}
|
||||
function get_elements_by_tagname($name)
|
||||
{
|
||||
$myDOMNodeList=$this->myDOMNode->getElementsByTagName($name);
|
||||
$nodeSet=array();
|
||||
$i=0;
|
||||
if (isset($myDOMNodeList))
|
||||
while ($node=$myDOMNodeList->item($i))
|
||||
{
|
||||
$nodeSet[]=new php4DOMElement($node,$this);
|
||||
$i++;
|
||||
}
|
||||
return $nodeSet;
|
||||
}
|
||||
function html_dump_mem() {return $this->myDOMNode->saveHTML();}
|
||||
function root() {return new php4DOMElement($this->myDOMNode->documentElement,$this);}
|
||||
}
|
||||
|
||||
class php4DOMElement extends php4DOMNode
|
||||
{
|
||||
function get_attribute($name) {return $this->myDOMNode->getAttribute($name);}
|
||||
function get_elements_by_tagname($name)
|
||||
{
|
||||
$myDOMNodeList=$this->myDOMNode->getElementsByTagName($name);
|
||||
$nodeSet=array();
|
||||
$i=0;
|
||||
if (isset($myDOMNodeList))
|
||||
while ($node=$myDOMNodeList->item($i))
|
||||
{
|
||||
$nodeSet[]=new php4DOMElement($node,$this->myOwnerDocument);
|
||||
$i++;
|
||||
}
|
||||
return $nodeSet;
|
||||
}
|
||||
function has_attribute($name) {return $this->myDOMNode->hasAttribute($name);}
|
||||
function remove_attribute($name) {return $this->myDOMNode->removeAttribute($name);}
|
||||
function set_attribute($name,$value) {return $this->myDOMNode->setAttribute($name,$value);}
|
||||
function tagname() {return $this->myDOMNode->tagName;}
|
||||
}
|
||||
|
||||
class php4DOMNode
|
||||
{
|
||||
var $myDOMNode;
|
||||
var $myOwnerDocument;
|
||||
function php4DOMNode($aDomNode,$aOwnerDocument)
|
||||
{
|
||||
$this->myDOMNode=$aDomNode;
|
||||
$this->myOwnerDocument=$aOwnerDocument;
|
||||
}
|
||||
function __get($name)
|
||||
{
|
||||
if ($name=='type') return $this->myDOMNode->nodeType;
|
||||
elseif ($name=='tagname') return $this->myDOMNode->tagName;
|
||||
elseif ($name=='content') return $this->myDOMNode->textContent;
|
||||
else
|
||||
{
|
||||
$myErrors=debug_backtrace();
|
||||
trigger_error('Undefined property: '.get_class($this).'::$'.$name.' ['.$myErrors[0]['file'].':'.$myErrors[0]['line'].']',E_USER_NOTICE);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function append_child($newnode) {return new php4DOMElement($this->myDOMNode->appendChild($newnode->myDOMNode),$this->myOwnerDocument);}
|
||||
function append_sibling($newnode) {return new php4DOMElement($this->myDOMNode->parentNode->appendChild($newnode->myDOMNode),$this->myOwnerDocument);}
|
||||
function attributes()
|
||||
{
|
||||
$myDOMNodeList=$this->myDOMNode->attributes;
|
||||
$nodeSet=array();
|
||||
$i=0;
|
||||
if (isset($myDOMNodeList))
|
||||
while ($node=$myDOMNodeList->item($i))
|
||||
{
|
||||
$nodeSet[]=new php4DOMAttr($node,$this->myOwnerDocument);
|
||||
$i++;
|
||||
}
|
||||
return $nodeSet;
|
||||
}
|
||||
function child_nodes()
|
||||
{
|
||||
$myDOMNodeList=$this->myDOMNode->childNodes;
|
||||
$nodeSet=array();
|
||||
$i=0;
|
||||
if (isset($myDOMNodeList))
|
||||
while ($node=$myDOMNodeList->item($i))
|
||||
{
|
||||
$nodeSet[]=new php4DOMElement($node,$this->myOwnerDocument);
|
||||
$i++;
|
||||
}
|
||||
return $nodeSet;
|
||||
}
|
||||
function children() {return $this->child_nodes();}
|
||||
function clone_node($deep=false) {return new php4DOMElement($this->myDOMNode->cloneNode($deep),$this->myOwnerDocument);}
|
||||
function first_child() {return new php4DOMElement($this->myDOMNode->firstChild,$this->myOwnerDocument);}
|
||||
function get_content() {return $this->myDOMNode->textContent;}
|
||||
function has_attributes() {return $this->myDOMNode->hasAttributes();}
|
||||
function has_child_nodes() {return $this->myDOMNode->hasChildNodes();}
|
||||
function insert_before($newnode,$refnode) {return new php4DOMElement($this->myDOMNode->insertBefore($newnode->myDOMNode,$refnode->myDOMNode),$this->myOwnerDocument);}
|
||||
function is_blank_node()
|
||||
{
|
||||
$myDOMNodeList=$this->myDOMNode->childNodes;
|
||||
$i=0;
|
||||
if (isset($myDOMNodeList))
|
||||
while ($node=$myDOMNodeList->item($i))
|
||||
{
|
||||
if (($node->nodeType==XML_ELEMENT_NODE)||
|
||||
(($node->nodeType==XML_TEXT_NODE)&&!ereg('^([[:cntrl:]]|[[:space:]])*$',$node->nodeValue)))
|
||||
return false;
|
||||
$i++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function last_child() {return new php4DOMElement($this->myDOMNode->lastChild,$this->myOwnerDocument);}
|
||||
function new_child($name,$content)
|
||||
{
|
||||
$mySubNode=$this->myDOMNode->ownerDocument->createElement($name);
|
||||
$mySubNode->appendChild($this->myDOMNode->ownerDocument->createTextNode($content));
|
||||
$this->myDOMNode->appendChild($mySubNode);
|
||||
return new php4DOMElement($mySubNode,$this->myOwnerDocument);
|
||||
}
|
||||
function next_sibling() {return new php4DOMElement($this->myDOMNode->nextSibling,$this->myOwnerDocument);}
|
||||
function node_name() {return $this->myDOMNode->localName;}
|
||||
function node_type() {return $this->myDOMNode->nodeType;}
|
||||
function node_value() {return $this->myDOMNode->nodeValue;}
|
||||
function owner_document() {return $this->myOwnerDocument;}
|
||||
function parent_node() {return new php4DOMElement($this->myDOMNode->parentNode,$this->myOwnerDocument);}
|
||||
function prefix() {return $this->myDOMNode->prefix;}
|
||||
function previous_sibling() {return new php4DOMElement($this->myDOMNode->previousSibling,$this->myOwnerDocument);}
|
||||
function remove_child($oldchild) {return new php4DOMElement($this->myDOMNode->removeChild($oldchild->myDOMNode),$this->myOwnerDocument);}
|
||||
function replace_child($oldnode,$newnode) {return new php4DOMElement($this->myDOMNode->replaceChild($oldnode->myDOMNode,$newnode->myDOMNode),$this->myOwnerDocument);}
|
||||
function set_content($text)
|
||||
{
|
||||
if (($this->myDOMNode->hasChildNodes())&&($this->myDOMNode->firstChild->nodeType==XML_TEXT_NODE))
|
||||
$this->myDOMNode->removeChild($this->myDOMNode->firstChild);
|
||||
return $this->myDOMNode->appendChild($this->myDOMNode->ownerDocument->createTextNode($text));
|
||||
}
|
||||
}
|
||||
|
||||
class php4DOMNodelist
|
||||
{
|
||||
var $myDOMNodelist;
|
||||
var $nodeset;
|
||||
function php4DOMNodelist($aDOMNodelist,$aOwnerDocument)
|
||||
{
|
||||
$this->myDOMNodelist=$aDOMNodelist;
|
||||
$this->nodeset=array();
|
||||
$i=0;
|
||||
if (isset($this->myDOMNodelist))
|
||||
while ($node=$this->myDOMNodelist->item($i))
|
||||
{
|
||||
$this->nodeset[]=new php4DOMElement($node,$aOwnerDocument);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class php4DOMXPath
|
||||
{
|
||||
var $myDOMXPath;
|
||||
var $myOwnerDocument;
|
||||
function php4DOMXPath($dom_document)
|
||||
{
|
||||
$this->myOwnerDocument=$dom_document;
|
||||
$this->myDOMXPath=new DOMXPath($dom_document->myDOMNode);
|
||||
}
|
||||
function query($eval_str,$contextnode)
|
||||
{
|
||||
if (isset($contextnode)) return new php4DOMNodelist($this->myDOMXPath->query($eval_str,$contextnode->myDOMNode),$this->myOwnerDocument);
|
||||
else return new php4DOMNodelist($this->myDOMXPath->query($eval_str),$this->myOwnerDocument);
|
||||
}
|
||||
function xpath_register_ns($prefix,$namespaceURI) {return $this->myDOMXPath->registerNamespace($prefix,$namespaceURI);}
|
||||
}
|
||||
|
||||
if (extension_loaded('xsl'))
|
||||
{//See also: http://alexandre.alapetite.net/doc-alex/xslt-php4-php5/
|
||||
function domxml_xslt_stylesheet($xslstring) {return new php4DomXsltStylesheet(DOMDocument::loadXML($xslstring));}
|
||||
function domxml_xslt_stylesheet_doc($dom_document) {return new php4DomXsltStylesheet($dom_document);}
|
||||
function domxml_xslt_stylesheet_file($xslfile) {return new php4DomXsltStylesheet(DOMDocument::load($xslfile));}
|
||||
class php4DomXsltStylesheet
|
||||
{
|
||||
var $myxsltProcessor;
|
||||
function php4DomXsltStylesheet($dom_document)
|
||||
{
|
||||
$this->myxsltProcessor=new xsltProcessor();
|
||||
$this->myxsltProcessor->importStyleSheet($dom_document);
|
||||
}
|
||||
function process($dom_document,$xslt_parameters=array(),$param_is_xpath=false)
|
||||
{
|
||||
foreach ($xslt_parameters as $param=>$value)
|
||||
$this->myxsltProcessor->setParameter('',$param,$value);
|
||||
$myphp4DOMDocument=new php4DOMDocument();
|
||||
$myphp4DOMDocument->myDOMNode=$this->myxsltProcessor->transformToDoc($dom_document->myDOMNode);
|
||||
return $myphp4DOMDocument;
|
||||
}
|
||||
function result_dump_file($dom_document,$filename)
|
||||
{
|
||||
$html=$dom_document->myDOMNode->saveHTML();
|
||||
file_put_contents($filename,$html);
|
||||
return $html;
|
||||
}
|
||||
function result_dump_mem($dom_document) {return $dom_document->myDOMNode->saveHTML();}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,27 +1,27 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file languages/english.php
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
* @ingroup internalLang
|
||||
*/
|
||||
|
||||
$this->_strings = array(
|
||||
CAS_STR_USING_SERVER
|
||||
=> 'using server',
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
=> 'CAS Authentication wanted!',
|
||||
CAS_STR_LOGOUT
|
||||
=> 'CAS logout wanted!',
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
=> 'You should already have been redirected to the CAS server. Click <a href="%s">here</a> to continue.',
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
=> 'CAS Authentication failed!',
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
=> '<p>You were not authenticated.</p><p>You may submit your request again by clicking <a href="%s">here</a>.</p><p>If the problem persists, you may contact <a href="mailto:%s">the administrator of this site</a>.</p>',
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
=> 'The service `<b>%s</b>\' is not available (<b>%s</b>).'
|
||||
);
|
||||
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file languages/english.php
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
* @ingroup internalLang
|
||||
*/
|
||||
|
||||
$this->_strings = array(
|
||||
CAS_STR_USING_SERVER
|
||||
=> 'using server',
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
=> 'CAS Authentication wanted!',
|
||||
CAS_STR_LOGOUT
|
||||
=> 'CAS logout wanted!',
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
=> 'You should already have been redirected to the CAS server. Click <a href="%s">here</a> to continue.',
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
=> 'CAS Authentication failed!',
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
=> '<p>You were not authenticated.</p><p>You may submit your request again by clicking <a href="%s">here</a>.</p><p>If the problem persists, you may contact <a href="mailto:%s">the administrator of this site</a>.</p>',
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
=> 'The service `<b>%s</b>\' is not available (<b>%s</b>).'
|
||||
);
|
||||
|
||||
?>
|
||||
@@ -1,28 +1,28 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file languages/english.php
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
* @ingroup internalLang
|
||||
*/
|
||||
|
||||
$this->_strings = array(
|
||||
CAS_STR_USING_SERVER
|
||||
=> 'utilisant le serveur',
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
=> 'Authentication CAS nécessaire !',
|
||||
CAS_STR_LOGOUT
|
||||
=> 'Déconnexion demandée !',
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
=> 'Vous auriez du etre redirigé(e) vers le serveur CAS. Cliquez <a href="%s">ici</a> pour continuer.',
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
=> 'Authentification CAS infructueuse !',
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
=> '<p>Vous n\'avez pas été authentifié(e).</p><p>Vous pouvez soumettre votre requete à nouveau en cliquant <a href="%s">ici</a>.</p><p>Si le problème persiste, vous pouvez contacter <a href="mailto:%s">l\'administrateur de ce site</a>.</p>',
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
=> 'Le service `<b>%s</b>\' est indisponible (<b>%s</b>)'
|
||||
|
||||
);
|
||||
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file languages/english.php
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
* @ingroup internalLang
|
||||
*/
|
||||
|
||||
$this->_strings = array(
|
||||
CAS_STR_USING_SERVER
|
||||
=> 'utilisant le serveur',
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
=> 'Authentication CAS nécessaire !',
|
||||
CAS_STR_LOGOUT
|
||||
=> 'Déconnexion demandée !',
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
=> 'Vous auriez du etre redirigé(e) vers le serveur CAS. Cliquez <a href="%s">ici</a> pour continuer.',
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
=> 'Authentification CAS infructueuse !',
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
=> '<p>Vous n\'avez pas été authentifié(e).</p><p>Vous pouvez soumettre votre requete à nouveau en cliquant <a href="%s">ici</a>.</p><p>Si le problème persiste, vous pouvez contacter <a href="mailto:%s">l\'administrateur de ce site</a>.</p>',
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
=> 'Le service `<b>%s</b>\' est indisponible (<b>%s</b>)'
|
||||
|
||||
);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file languages/german.php
|
||||
* @author Henrik Genssen <hg at mediafactory.de>
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
* @ingroup internalLang
|
||||
*/
|
||||
|
||||
$this->_strings = array(
|
||||
CAS_STR_USING_SERVER
|
||||
=> 'via Server',
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
=> 'CAS Authentifizierung erforderlich!',
|
||||
CAS_STR_LOGOUT
|
||||
=> 'CAS Abmeldung!',
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
=> 'eigentlich häten Sie zum CAS Server weitergeleitet werden sollen. Drücken Sie <a href="%s">hier</a> um fortzufahren.',
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
=> 'CAS Anmeldung fehlgeschlagen!',
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
=> '<p>Sie wurden nicht angemeldet.</p><p>Um es erneut zu versuchen klicken Sie <a href="%s">hier</a>.</p><p>Wenn das Problem bestehen bleibt, kontkatieren Sie den <a href="mailto:%s">Administrator</a> dieser Seite.</p>',
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
=> 'Der Dienst `<b>%s</b>\' ist nicht verfügbar (<b>%s</b>).'
|
||||
);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file languages/japanese.php
|
||||
* @author fnorif (fnorif@yahoo.co.jp)
|
||||
*
|
||||
* Now Encoding is EUC-JP and LF
|
||||
**/
|
||||
|
||||
$this->_strings = array(
|
||||
CAS_STR_USING_SERVER
|
||||
=> 'using server',
|
||||
CAS_STR_AUTHENTICATION_WANTED
|
||||
=> 'CASによる認証を行います',
|
||||
CAS_STR_LOGOUT
|
||||
=> 'CASからログアウトします!',
|
||||
CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED
|
||||
=> 'CASサーバに行く必要があります。自動的に転送されない場合は <a href="%s">こちら</a> をクリックして続行します。',
|
||||
CAS_STR_AUTHENTICATION_FAILED
|
||||
=> 'CASによる認証に失敗しました',
|
||||
CAS_STR_YOU_WERE_NOT_AUTHENTICATED
|
||||
=> '<p>認証できませんでした.</p><p>もう一度リクエストを送信する場合は<a href="%s">こちら</a>をクリック.</p><p>問題が解決しない場合は <a href="mailto:%s">このサイトの管理者</a>に問い合わせてください.</p>',
|
||||
CAS_STR_SERVICE_UNAVAILABLE
|
||||
=> 'サービス `<b>%s</b>\' は利用できません (<b>%s</b>).'
|
||||
);
|
||||
|
||||
?>
|
||||
@@ -1,24 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file languages/languages.php
|
||||
* Internationalization constants
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
* @ingroup internalLang
|
||||
*/
|
||||
|
||||
//@{
|
||||
/**
|
||||
* a phpCAS string index
|
||||
*/
|
||||
define("CAS_STR_USING_SERVER", 1);
|
||||
define("CAS_STR_AUTHENTICATION_WANTED", 2);
|
||||
define("CAS_STR_LOGOUT", 3);
|
||||
define("CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED", 4);
|
||||
define("CAS_STR_AUTHENTICATION_FAILED", 5);
|
||||
define("CAS_STR_YOU_WERE_NOT_AUTHENTICATED", 6);
|
||||
define("CAS_STR_SERVICE_UNAVAILABLE", 7);
|
||||
//@}
|
||||
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file languages/languages.php
|
||||
* Internationalization constants
|
||||
* @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
|
||||
* @sa @link internalLang Internationalization @endlink
|
||||
* @ingroup internalLang
|
||||
*/
|
||||
|
||||
//@{
|
||||
/**
|
||||
* a phpCAS string index
|
||||
*/
|
||||
define("CAS_STR_USING_SERVER", 1);
|
||||
define("CAS_STR_AUTHENTICATION_WANTED", 2);
|
||||
define("CAS_STR_LOGOUT", 3);
|
||||
define("CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED", 4);
|
||||
define("CAS_STR_AUTHENTICATION_FAILED", 5);
|
||||
define("CAS_STR_YOU_WERE_NOT_AUTHENTICATED", 6);
|
||||
define("CAS_STR_SERVICE_UNAVAILABLE", 7);
|
||||
//@}
|
||||
|
||||
?>
|
||||
+4
-7
@@ -1,7 +1,4 @@
|
||||
CAS-module README
|
||||
|
||||
Please read comments from lib.php for auth/cas module
|
||||
The auth/cas module is using part of the /auth/ldap module. The /auth/ldap directory should exist.
|
||||
The auth/cas use the PHPCAS project from http://esup-phpcas.sourceforge.net
|
||||
|
||||
|
||||
CAS-module README
|
||||
|
||||
|
||||
|
||||
|
||||
+1258
-315
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
||||
|
||||
<div class="loginbox clearfix">
|
||||
<div class="loginpanel">
|
||||
<div>
|
||||
<a href="<?php echo $CFG->wwwroot.'/login/index.php?authCAS=CAS';?>"><?php print_string("accesCAS","auth");?></a>
|
||||
</div>
|
||||
<br/>
|
||||
<div>
|
||||
<a href="<?php echo $CFG->wwwroot.'/login/index.php?authCAS=NOCAS';?>"><?php print_string("accesNOCAS","auth");?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
+434
-187
@@ -1,187 +1,434 @@
|
||||
<?php
|
||||
|
||||
global $CFG;
|
||||
require_once 'languages.php';
|
||||
|
||||
$createoptions[0] = get_string("no");
|
||||
$createoptions[1] = get_string("yes");
|
||||
|
||||
// set to defaults if undefined
|
||||
if (!isset ($config->hostname)) {
|
||||
$config->hostname = '';
|
||||
}
|
||||
if (!isset ($config->port)) {
|
||||
$config->port = '';
|
||||
}
|
||||
if (!isset ($config->casversion)) {
|
||||
$config->casversion = '';
|
||||
}
|
||||
if (!isset ($config->baseuri)) {
|
||||
$config->baseuri = '';
|
||||
}
|
||||
if (!isset ($config->language)) {
|
||||
$config->language = '';
|
||||
}
|
||||
if (!isset ($config->use_cas)) {
|
||||
$config->use_cas = '';
|
||||
}
|
||||
if (!isset ($config->auth_user_create)) {
|
||||
$config->auth_user_create = '0';
|
||||
}
|
||||
if (!isset ($config->create_user)) {
|
||||
$config->create_user = '0';
|
||||
}
|
||||
if (!isset($config->changepasswordurl)) {
|
||||
$config->changepasswordurl = '';
|
||||
}
|
||||
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="5" border="0" align="center">
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<h4><?php print_string('auth_cas_server_settings', 'auth') ?> </h4>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_cas_use_cas', 'auth') ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
unset($options);
|
||||
$options[1] = get_string('yes');
|
||||
choose_from_menu ($options, 'use_cas', $config->use_cas, get_string('no'), '', '');
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td><?php print_string('auth_cas_enabled', 'auth') ?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_cas_hostname_key', 'auth') ?>:</td>
|
||||
<td>
|
||||
<input name="hostname" type="text" size="30" value="<?php echo $config->hostname ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['hostname'])) {
|
||||
formerr($err['hostname']);
|
||||
}
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td><?php print_string('auth_cas_hostname', 'auth') ?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_cas_baseuri_key', 'auth') ?>:</td>
|
||||
<td>
|
||||
<input name="baseuri" type="text" size="30" value="<?php echo $config->baseuri ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['baseuri'])) {
|
||||
formerr($err['baseuri']);
|
||||
}
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td><?php print_string('auth_cas_baseuri', 'auth') ?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_cas_port_key', 'auth') ?>:</td>
|
||||
<td>
|
||||
<input name="port" type="text" size="30" value="<?php echo $config->port ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['port'])) {
|
||||
formerr($err['port']);
|
||||
}
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td><?php print_string('auth_cas_port', 'auth') ?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_cas_casversion', 'auth') ?>:</td>
|
||||
<td>
|
||||
<input name="casversion" type="text" size="30" value="<?php echo $config->casversion ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['casversion'])) {
|
||||
formerr($err['casversion']);
|
||||
}
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td><?php print_string('auth_cas_version', 'auth') ?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_cas_language_key', 'auth') ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
choose_from_menu($CASLANGUAGES, 'language', $config->language, '');
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td><?php print_string('auth_cas_language', 'auth') ?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('auth_cas_auth_user_create', 'auth') ?>: </td>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
choose_from_menu($createoptions, 'auth_user_create', $config->auth_user_create, '');
|
||||
if (isset($err['auth_user_create'])) {
|
||||
formerr($err['auth_user_create']);
|
||||
}
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string("auth_user_creation","auth"); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_cas_create_user_key', 'auth') ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
unset($options);
|
||||
$options[0] = get_string('no');
|
||||
$options[1] = get_string('yes');
|
||||
choose_from_menu($options, 'create_user', $config->create_user, '');
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td><?php print_string('auth_cas_create_user', 'auth') ?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('auth_cas_changepasswordurl', 'auth') ?>: </td>
|
||||
<td>
|
||||
<input name="changepasswordurl" type="text" value="<?php echo $config->changepasswordurl ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['changepasswordurl'])) {
|
||||
formerr($err['changepasswordurl']);
|
||||
}
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td><?php print_string('changepasswordhelp', 'auth') ?></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<?php
|
||||
|
||||
$ldapplugin = get_auth_plugin('ldap');
|
||||
$ldapplugin->config_form(get_config('auth/ldap'), $err);
|
||||
|
||||
?>
|
||||
<?php
|
||||
|
||||
global $CFG;
|
||||
require_once 'languages.php';
|
||||
|
||||
$createoptions[0] = get_string("no");
|
||||
$createoptions[1] = get_string("yes");
|
||||
|
||||
// set to defaults if undefined (CAS)
|
||||
if (!isset ($config->hostname))
|
||||
$config->hostname = '';
|
||||
if (!isset ($config->port))
|
||||
$config->port = '';
|
||||
if (!isset ($config->casversion))
|
||||
$config->casversion = '';
|
||||
if (!isset ($config->baseuri))
|
||||
$config->baseuri = '';
|
||||
if (!isset ($config->language))
|
||||
$config->language = '';
|
||||
if (!isset ($config->use_cas))
|
||||
$config->use_cas = '';
|
||||
if (!isset ($config->proxycas))
|
||||
$config->proxycas = '';
|
||||
if (!isset ($config->logoutcas))
|
||||
$config->logoutcas = '';
|
||||
if (!isset ($config->multiauth))
|
||||
$config->multiauth = '';
|
||||
// set to defaults if undefined (LDAP)
|
||||
if (!isset($config->host_url))
|
||||
{ $config->host_url = ''; }
|
||||
if (empty($config->ldapencoding))
|
||||
{ $config->ldapencoding = 'utf-8'; }
|
||||
if (!isset($config->contexts))
|
||||
{ $config->contexts = ''; }
|
||||
if (!isset($config->user_type))
|
||||
{ $config->user_type = 'default'; }
|
||||
if (!isset($config->user_attribute))
|
||||
{ $config->user_attribute = ''; }
|
||||
if (!isset($config->search_sub))
|
||||
{ $config->search_sub = ''; }
|
||||
if (!isset($config->opt_deref))
|
||||
{ $config->opt_deref = LDAP_DEREF_NEVER; }
|
||||
if (!isset($config->bind_dn))
|
||||
{$config->bind_dn = ''; }
|
||||
if (!isset($config->bind_pw))
|
||||
{$config->bind_pw = ''; }
|
||||
if (!isset($config->version))
|
||||
{$config->version = '2'; }
|
||||
if (!isset($config->objectclass))
|
||||
{$config->objectclass = ''; }
|
||||
if (!isset($config->memberattribute))
|
||||
{$config->memberattribute = ''; }
|
||||
if (!isset($config->memberattribute_isdn))
|
||||
{$config->memberattribute_isdn = ''; }
|
||||
if (!isset($config->groupecreators))
|
||||
{$config->groupecreators = ''; }
|
||||
if (!isset($config->attrcreators))
|
||||
{$config->attrcreators = ''; }
|
||||
if (!isset($config->removeuser))
|
||||
{$config->removeuser = 0; }
|
||||
|
||||
$yesno = array( get_string('no'), get_string('yes') );
|
||||
|
||||
if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
|
||||
notify(get_string('auth_ldap_noextension','auth'));
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<table cellspacing="0" cellpadding="5" border="0" align="center">
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<h4><?php print_string('auth_cas_server_settings', 'auth') ?> </h4>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_cas_use_cas', 'auth') ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
unset($options);
|
||||
$options[1] = get_string('yes');
|
||||
choose_from_menu ($options, 'use_cas', $config->use_cas, get_string('no'), '', '');
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td><?php print_string('auth_cas_enabled', 'auth') ?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_cas_hostname_key', 'auth') ?>:</td>
|
||||
<td>
|
||||
<input name="hostname" type="text" size="30" value="<?php echo $config->hostname ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['hostname'])) {
|
||||
formerr($err['hostname']);
|
||||
}
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td><?php print_string('auth_cas_hostname', 'auth') ?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_cas_baseuri_key', 'auth') ?>:</td>
|
||||
<td>
|
||||
<input name="baseuri" type="text" size="30" value="<?php echo $config->baseuri ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['baseuri'])) {
|
||||
formerr($err['baseuri']);
|
||||
}
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td><?php print_string('auth_cas_baseuri', 'auth') ?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_cas_port_key', 'auth') ?>:</td>
|
||||
<td>
|
||||
<input name="port" type="text" size="30" value="<?php echo $config->port ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['port'])) {
|
||||
formerr($err['port']);
|
||||
}
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td><?php print_string('auth_cas_port', 'auth') ?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_cas_casversion', 'auth') ?>:</td>
|
||||
<td>
|
||||
<input name="casversion" type="text" size="30" value="<?php echo $config->casversion ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['casversion'])) {
|
||||
formerr($err['casversion']);
|
||||
}
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td><?php print_string('auth_cas_version', 'auth') ?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_cas_language_key', 'auth') ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
choose_from_menu($CASLANGUAGES, 'language', $config->language, '');
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td><?php print_string('auth_cas_language', 'auth') ?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_cas_proxycas_key', 'auth') ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
unset($options);
|
||||
$options[1] = get_string('yes');
|
||||
choose_from_menu ($options, 'proxycas', $config->proxycas, get_string('no'), '', '');
|
||||
?>
|
||||
</td>
|
||||
<td><?php print_string('auth_cas_proxycas', 'auth') ?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_cas_logoutcas_key', 'auth') ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
unset($options);
|
||||
$options[1] = get_string('yes');
|
||||
choose_from_menu ($options, 'logoutcas', $config->logoutcas, get_string('no'), '', '');
|
||||
?>
|
||||
</td>
|
||||
<td><?php print_string('auth_cas_logoutcas', 'auth') ?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_cas_multiauth_key', 'auth') ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
unset($options);
|
||||
$options[1] = get_string('yes');
|
||||
choose_from_menu ($options, 'multiauth', $config->multiauth, get_string('no'), '', '');
|
||||
?>
|
||||
</td>
|
||||
<td><?php print_string('auth_cas_multiauth', 'auth') ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<h4><?php print_string('auth_ldap_server_settings', 'auth') ?> </h4>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><label for="host_url"><?php print_string('auth_ldap_host_url_key','auth') ?></label></td>
|
||||
<td>
|
||||
<input name="host_url" id="host_url" type="text" size="30" value="<?php echo $config->host_url?>" />
|
||||
<?php if (isset($err['host_url'])) formerr($err['host_url']); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string('auth_ldap_host_url','auth') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><label for="menuversion"><?php print_string('auth_ldap_version_key','auth') ?></label></td>
|
||||
<td>
|
||||
<?php
|
||||
$versions = array();
|
||||
$versions[2] = '2';
|
||||
$versions[3] = '3';
|
||||
choose_from_menu($versions, 'version', $config->version, '');
|
||||
if (isset($err['version'])) formerr($err['version']);
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string('auth_ldap_version','auth') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><label for="ldapencoding"><?php print_string("auth_ldap_ldap_encoding_key", "auth") ?></label></td>
|
||||
<td>
|
||||
<input id="ldapencoding" name="ldapencoding" type="text" value="<?php echo $config->ldapencoding ?>" />
|
||||
<?php
|
||||
|
||||
if (isset($err['ldapencoding'])) {
|
||||
formerr($err['ldapencoding']);
|
||||
}
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td><?php print_string('auth_ldap_ldap_encoding', 'auth') ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<h4><?php print_string('auth_ldap_bind_settings', 'auth') ?> </h4>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><label for="bind_dn"><?php print_string('auth_ldap_bind_dn_key','auth') ?></label></td>
|
||||
<td>
|
||||
<input name="bind_dn" id="bind_dn" type="text" size="30" value="<?php echo $config->bind_dn?>" />
|
||||
<?php if (isset($err['bind_dn'])) formerr($err['bind_dn']); ?>
|
||||
</td><td>
|
||||
<?php print_string('auth_ldap_bind_dn','auth') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><label for="bind_pw"><?php print_string('auth_ldap_bind_pw_key','auth') ?></label></td>
|
||||
<td>
|
||||
<input name="bind_pw" id="bind_pw" type="password" size="30" value="<?php echo $config->bind_pw?>" />
|
||||
<?php if (isset($err['bind_pw'])) formerr($err['bind_pw']); ?>
|
||||
</td><td>
|
||||
<?php print_string('auth_ldap_bind_pw','auth') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<h4><?php print_string('auth_ldap_user_settings', 'auth') ?> </h4>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><label for="menuuser_type"><?php print_string('auth_ldap_user_type_key','auth') ?></label></td>
|
||||
<td>
|
||||
<?php choose_from_menu($this->ldap_suppported_usertypes(), 'user_type', $config->user_type, ''); ?>
|
||||
<?php if (isset($err['user_type'])) formerr($err['user_type']); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string('auth_ldap_user_type', 'auth') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><label for="contexts"><?php print_string('auth_ldap_contexts_key','auth') ?></label></td>
|
||||
<td>
|
||||
<input name="contexts" id="contexts" type="text" size="30" value="<?php echo $config->contexts?>" />
|
||||
<?php if (isset($err['contexts'])) formerr($err['contexts']); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string('auth_ldap_contexts', 'auth') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><label for="menusearch_sub"><?php print_string('auth_ldap_search_sub_key','auth') ?></label></td>
|
||||
<td>
|
||||
<?php choose_from_menu($yesno, 'search_sub', $config->search_sub, ''); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string('auth_ldap_search_sub','auth') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><label for="menuopt_deref"><?php print_string('auth_ldap_opt_deref_key','auth') ?></label></td>
|
||||
<td>
|
||||
<?php
|
||||
$opt_deref = array();
|
||||
$opt_deref[LDAP_DEREF_NEVER] = get_string('no');
|
||||
$opt_deref[LDAP_DEREF_ALWAYS] = get_string('yes');
|
||||
choose_from_menu($opt_deref, 'opt_deref', $config->opt_deref, LDAP_DEREF_NEVER, '');
|
||||
if (isset($err['opt_deref'])) formerr($err['opt_deref']);
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string('auth_ldap_opt_deref','auth') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><label for="user_attribute"><?php print_string('auth_ldap_user_attribute_key','auth') ?></label></td>
|
||||
<td>
|
||||
<input name="user_attribute" id="user_attribute" type="text" size="30" value="<?php echo $config->user_attribute?>" />
|
||||
<?php if (isset($err['user_attribute'])) formerr($err['user_attribute']); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string('auth_ldap_user_attribute','auth') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><label for="memberattribute"><?php print_string('auth_ldap_memberattribute_key','auth') ?></label></td>
|
||||
<td>
|
||||
<input name="memberattribute" id="memberattribute" type="text" size="30" value="<?php echo $config->memberattribute?>" />
|
||||
<?php if (isset($err['memberattribute'])) formerr($err['memberattribute']); ?>
|
||||
</td><td>
|
||||
<?php print_string('auth_ldap_memberattribute','auth') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><label for="memberattribute_isdn"><?php print_string('auth_ldap_memberattribute_isdn_key','auth') ?></label></td>
|
||||
<td>
|
||||
<input name="memberattribute_isdn" id="memberattribute_isdn" type="text" size="30" value="<?php echo $config->memberattribute_isdn?>" />
|
||||
<?php if (isset($err['memberattribute_isdn'])) formerr($err['memberattribute_isdn']); ?>
|
||||
</td><td>
|
||||
<?php print_string('auth_ldap_memberattribute_isdn','auth') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><label for="objectclass"><?php print_string('auth_ldap_objectclass_key','auth') ?></label></td>
|
||||
<td>
|
||||
<input name="objectclass" id="objectclass" type="text" size="30" value="<?php echo $config->objectclass?>" />
|
||||
<?php if (isset($err['objectclass'])) formerr($err['objectclass']); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string('auth_ldap_objectclass','auth') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<h4><?php print_string('coursecreators') ?> </h4>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><label for="attrcreators_key"><?php print_string('auth_ldap_attrcreators_key','auth') ?></label></td>
|
||||
<td>
|
||||
<input name="attrcreators" id="attrcreators" type="text" size="30" value="<?php echo $config->attrcreators?>" />
|
||||
<?php if (isset($err['attrcreators'])) formerr($err['attrcreators']); ?>
|
||||
</td><td>
|
||||
<?php print_string('auth_ldap_attrcreators','auth') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><label for="groupecreators_key"><?php print_string('auth_ldap_groupecreators_key','auth') ?></label></td>
|
||||
<td>
|
||||
<input name="groupecreators" id="groupecreators" type="text" size="30" value="<?php echo $config->groupecreators?>" />
|
||||
<?php if (isset($err['groupecreators'])) formerr($err['groupecreators']); ?>
|
||||
</td><td>
|
||||
<?php print_string('auth_ldap_groupecreators','auth') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<h4><?php print_string('auth_sync_script', 'auth') ?> </h4>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><label for="menuremoveuser"><?php print_string('auth_remove_user_key','auth') ?></label></td>
|
||||
<td>
|
||||
<?php
|
||||
$deleteopt = array();
|
||||
$deleteopt['0'] = get_string('auth_remove_keep','auth');
|
||||
$deleteopt['1'] = get_string('auth_remove_suspend','auth');
|
||||
$deleteopt['2'] = get_string('auth_remove_delete','auth');
|
||||
choose_from_menu($deleteopt, 'removeuser', $config->removeuser, '');
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php print_string('auth_remove_user','auth') ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<?php
|
||||
|
||||
$help = get_string('auth_ldapextrafields','auth');
|
||||
$help .= get_string('auth_updatelocal_expl','auth');
|
||||
$help .= get_string('auth_fieldlock_expl','auth');
|
||||
$help .= get_string('auth_updateremote_expl','auth');
|
||||
$help .= '<hr />';
|
||||
$help .= get_string('auth_updateremote_ldap','auth');
|
||||
|
||||
print_auth_lock_options('cas', $user_fields, $help, true, true);
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<table width="90%" border="0" cellspacing="10" cellpadding="5" align="center" style="font-size: small">
|
||||
<tr>
|
||||
<td width="50%" class="required" class="headingblock">
|
||||
<p align="center"><b><font size="3"><?php formerr($errormsg) ?></font></b></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
// version $Id$
|
||||
// Page for forbidden access from CAS
|
||||
require("../../config.php");
|
||||
|
||||
if (!$site = get_site()) {
|
||||
print_error('nosite', '', '', NULL, true);
|
||||
}
|
||||
|
||||
$loginsite = get_string("loginsite");
|
||||
$errormsg = get_string("auth_cas_invalidcaslogin", "auth");
|
||||
|
||||
print_header("$site->fullname: $loginsite", $site->fullname, $loginsite);
|
||||
include("forbidden.html");
|
||||
print_footer();
|
||||
exit;
|
||||
?>
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
<table width="90%" border="0" cellspacing="10" cellpadding="5" align="center">
|
||||
<tr>
|
||||
<?php if ($show_instructions) { ?>
|
||||
<td width="50%" class="headingblock">
|
||||
<p align="center"><b><font size="3"><?php print_string("returningtosite") ?></font></b></p>
|
||||
</td>
|
||||
<td width="50%" class="headingblock">
|
||||
<p align="center"><b><font size="3"><?php print_string("firsttime") ?></font></b></p>
|
||||
</td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="50%" align="center" valign="top" class="generalbox">
|
||||
<p><?php print_string("loginusing") ?>:<br />
|
||||
(<?php print_string("cookiesenabled");?>)
|
||||
<?php helpbutton("cookies", get_string("cookiesenabled"))?><br /><?php formerr($errormsg) ?>
|
||||
</p>
|
||||
<form action="index.php" method="post" id="login">
|
||||
<table border="0" align="center" style="font-size: small">
|
||||
<tr>
|
||||
<td width="100%">
|
||||
<input type="hidden" name="username" id="username" value="cas" />
|
||||
<input type="hidden" name="password" id="password" value="cas" />
|
||||
<input type="submit" value="<?php print_string("auth_cas_logincas", "auth") ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<?php if ($CFG->guestloginbutton) { ?>
|
||||
<hr width="80%" />
|
||||
<p><?php print_string("someallowguest") ?>:</p>
|
||||
<form action="index.php" method="post" id="guestlogin">
|
||||
<input type="hidden" name="username" value="guest" />
|
||||
<input type="hidden" name="password" value="guest" />
|
||||
<input type="submit" value="<?php print_string("loginguest") ?>" />
|
||||
</form>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (is_internal_auth() ) {
|
||||
$changepassword = "forgot_password.php";
|
||||
$changebuttonname = get_string("senddetails");
|
||||
?>
|
||||
<hr width="80%" />
|
||||
<p><?php print_string("forgotten") ?></p>
|
||||
<form action="<?php p($changepassword) ?>" method="get" id="changepassword">
|
||||
<input type="submit" value="<?php p($changebuttonname) ?>" />
|
||||
</form>
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
|
||||
<?php if ($show_instructions) { ?>
|
||||
<td width="50%" valign="top" class="generalbox">
|
||||
<?php switch ($CFG->auth) {
|
||||
case "email":
|
||||
print_string("loginsteps", "", "signup.php");
|
||||
?>
|
||||
<div align="center">
|
||||
<form action="signup.php" method="get" id="signup">
|
||||
<input type="submit" value="<?php print_string("startsignup") ?>" />
|
||||
</form>
|
||||
</div>
|
||||
<?php break;
|
||||
case "none":
|
||||
print_string("loginstepsnone");
|
||||
break;
|
||||
default:
|
||||
$authplugin = get_auth_plugin($CFG->auth);
|
||||
echo format_text($CFG->auth_instructions);
|
||||
if (!empty($authplugin->config->user_create) and method_exists($authplugin, 'user_create')) {
|
||||
?>
|
||||
|
||||
<div align="center">
|
||||
<form action="signup.php" method="get" id="signup">
|
||||
<input type="submit" value="<?php print_string("startsignup") ?>" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php }
|
||||
}
|
||||
?>
|
||||
</td></tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
|
||||
+9
-10
@@ -1,10 +1,9 @@
|
||||
<?PHP
|
||||
// version $Id$
|
||||
// List of CAS langages.
|
||||
// You can add langages in /CAS/langage.
|
||||
// Please send them to http://esup-phpcas.sourceforge.net
|
||||
$CASLANGUAGES = array (
|
||||
"greek" => "Modern Greek",
|
||||
"english" => "English",
|
||||
"french" => "French");
|
||||
?>
|
||||
<?PHP
|
||||
// version $Id$
|
||||
// List of CAS langages.
|
||||
// You can add langages in /CAS/langage.
|
||||
// Please send them to http://esup-phpcas.sourceforge.net
|
||||
$CASLANGUAGES = array (
|
||||
"english" => "English",
|
||||
"french" => "French");
|
||||
?>
|
||||
|
||||
@@ -1,313 +0,0 @@
|
||||
<?php
|
||||
// $Id$
|
||||
// author: romualdLorthioir $
|
||||
//CHANGELOG:
|
||||
//05.03.2005 replace /login/index.php
|
||||
defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
|
||||
//Define variables used in page
|
||||
if (!$site = get_site()) {
|
||||
print_error('nosite', '', '', NULL, true);
|
||||
}
|
||||
|
||||
if (empty($CFG->langmenu)) {
|
||||
$langmenu = "";
|
||||
} else {
|
||||
$currlang = current_language();
|
||||
$langs = get_list_of_languages();
|
||||
if (empty($CFG->loginhttps)) {
|
||||
$wwwroot = $CFG->wwwroot;
|
||||
} else {
|
||||
$wwwroot = str_replace('http:','https:',$CFG->wwwroot);
|
||||
}
|
||||
$langmenu = popup_form ("$wwwroot/login/index.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
|
||||
}
|
||||
|
||||
$loginsite = get_string("loginsite");
|
||||
$casauth = get_auth_plugin('cas');
|
||||
$ldapauth = get_auth_plugin('ldap');
|
||||
|
||||
|
||||
$frm = false;
|
||||
$user = false;
|
||||
if ((!empty($SESSION->wantsurl) and strstr($SESSION->wantsurl,'username=guest')) or $loginguest) {
|
||||
/// Log in as guest automatically (idea from Zbigniew Fiedorowicz)
|
||||
$frm->username = 'guest';
|
||||
$frm->password = 'guest';
|
||||
} else if (!empty($SESSION->wantsurl) && file_exists($CFG->dirroot.'/login/weblinkauth.php')) {
|
||||
// Handles the case of another Moodle site linking into a page on this site
|
||||
include($CFG->dirroot.'/login/weblinkauth.php');
|
||||
if (function_exists(weblink_auth)) {
|
||||
$user = weblink_auth($SESSION->wantsurl);
|
||||
}
|
||||
if ($user) {
|
||||
$frm->username = $user->username;
|
||||
} else {
|
||||
$frm = data_submitted();
|
||||
}
|
||||
} else {
|
||||
$frm = data_submitted();
|
||||
}
|
||||
|
||||
if ($frm and (get_moodle_cookie() == '')) { // Login without cookie
|
||||
|
||||
$errormsg = get_string("cookiesnotenabled");
|
||||
|
||||
} else if ($frm) { // Login WITH cookies
|
||||
|
||||
$frm->username = trim(moodle_strtolower($frm->username));
|
||||
|
||||
if (($frm->username == 'guest') and empty($CFG->guestloginbutton)) {
|
||||
$user = false; /// Can't log in as guest if guest button is disabled
|
||||
$frm = false;
|
||||
} else if (!$user) {
|
||||
if ($CFG->auth == "cas" && $frm->username != 'guest') { /// Cas SSO case
|
||||
$user = $casauth->authenticate_user_login($frm->username, $frm->password);
|
||||
}else{
|
||||
$user = authenticate_user_login($frm->username, $frm->password);
|
||||
}
|
||||
}
|
||||
update_login_count();
|
||||
|
||||
if ($user) {
|
||||
if (! $user->confirmed ) { // they never confirmed via email
|
||||
print_header(get_string("mustconfirm"), get_string("mustconfirm") );
|
||||
print_heading(get_string("mustconfirm"));
|
||||
print_simple_box(get_string("emailconfirmsent", "", $user->email), "center");
|
||||
print_footer();
|
||||
die;
|
||||
}
|
||||
|
||||
$USER = $user;
|
||||
if (!empty($USER->description)) {
|
||||
$USER->description = true; // No need to cart all of it around
|
||||
}
|
||||
$USER->loggedin = true;
|
||||
$USER->site = $CFG->wwwroot; // for added security, store the site in the session
|
||||
sesskey(); // for added security, used to check script parameters
|
||||
|
||||
if ($USER->username == "guest") {
|
||||
$USER->lang = $CFG->lang; // Guest language always same as site
|
||||
$USER->firstname = get_string("guestuser"); // Name always in current language
|
||||
$USER->lastname = " ";
|
||||
}
|
||||
|
||||
if (!update_user_login_times()) {
|
||||
error("Wierd error: could not update login records");
|
||||
}
|
||||
|
||||
set_moodle_cookie($USER->username);
|
||||
|
||||
unset($SESSION->lang);
|
||||
$SESSION->justloggedin = true;
|
||||
|
||||
// Restore the calendar filters, if saved
|
||||
if (intval(get_user_preferences('calendar_persistflt', 0))) {
|
||||
include_once($CFG->dirroot.'/calendar/lib.php');
|
||||
calendar_set_filters_status(get_user_preferences('calendar_savedflt', 0xff));
|
||||
}
|
||||
|
||||
//Select password change url
|
||||
$userauth = get_auth_plugin($USER->auth);
|
||||
if (method_exists($userauth, 'can_change_password') and $userauth->can_change_password()) {
|
||||
$passwordchangeurl=$CFG->wwwroot.'/login/change_password.php';
|
||||
}
|
||||
|
||||
// check whether the user should be changing password
|
||||
if (get_user_preferences('auth_forcepasswordchange', false)) {
|
||||
if (isset($passwordchangeurl)) {
|
||||
redirect($passwordchangeurl);
|
||||
} else {
|
||||
print_error('auth_cas_broken_password','auth');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
add_to_log(SITEID, "user", "login", "view.php?id=$user->id&course=".SITEID, $user->id, 0, $user->id);
|
||||
|
||||
if (user_not_fully_set_up($USER)) {
|
||||
$urltogo = $CFG->wwwroot.'/user/edit.php?id='.$USER->id.'&course='.SITEID;
|
||||
// We don't delete $SESSION->wantsurl yet, so we get there later
|
||||
|
||||
} else if (isset($SESSION->wantsurl) and (strpos($SESSION->wantsurl, $CFG->wwwroot) === 0)) {
|
||||
$urltogo = $SESSION->wantsurl; /// Because it's an address in this site
|
||||
unset($SESSION->wantsurl);
|
||||
|
||||
} else {
|
||||
$urltogo = $CFG->wwwroot.'/'; /// Go to the standard home page
|
||||
unset($SESSION->wantsurl); /// Just in case
|
||||
}
|
||||
|
||||
// check if user password has expired
|
||||
// Currently supported only for ldap-authentication module
|
||||
if ($ldapauth->config->expiration == 1) {
|
||||
$days2expire = $ldapauth->password_expire($USER->username);
|
||||
if (intval($days2expire) > 0 && intval($days2expire) < intval($CFG->{$USER->auth.'_expiration_warning'})) {
|
||||
print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "<div align=\"right\">$langmenu</div>");
|
||||
notice_yesno(get_string('auth_passwordwillexpire', 'auth', $days2expire), $passwordchangeurl, $urltogo);
|
||||
print_footer();
|
||||
exit;
|
||||
} elseif (intval($days2expire) < 0 ) {
|
||||
print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "<div align=\"right\">$langmenu</div>");
|
||||
notice_yesno(get_string('auth_passwordisexpired', 'auth'), $passwordchangeurl, $urltogo);
|
||||
print_footer();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
reset_login_count();
|
||||
|
||||
load_all_capabilities(); /// This is what lets the user do anything on the site :-)
|
||||
|
||||
redirect($urltogo);
|
||||
|
||||
exit;
|
||||
|
||||
} else {
|
||||
if ($CFG->auth == "cas" ) { /// CAS error login
|
||||
$errormsg = get_string("invalidcaslogin");
|
||||
phpCAS::logout("$CFG->wwwroot/auth/cas/forbidden.php");
|
||||
}else{
|
||||
$errormsg = get_string("invalidlogin");
|
||||
}
|
||||
}
|
||||
}
|
||||
$user = $casauth->automatic_authenticate($user);
|
||||
if ($user) {
|
||||
if (! $user->confirmed ) { // they never confirmed via email
|
||||
print_header(get_string("mustconfirm"), get_string("mustconfirm") );
|
||||
print_heading(get_string("mustconfirm"));
|
||||
print_simple_box(get_string("emailconfirmsent", "", $user->email), "center");
|
||||
print_footer();
|
||||
die;
|
||||
}
|
||||
|
||||
$USER = $user;
|
||||
if (!empty($USER->description)) {
|
||||
$USER->description = true; // No need to cart all of it around
|
||||
}
|
||||
$USER->loggedin = true;
|
||||
$USER->site = $CFG->wwwroot; // for added security, store the site in the session
|
||||
sesskey(); // for added security, used to check script parameters
|
||||
|
||||
if ($USER->username == "guest") {
|
||||
$USER->lang = $CFG->lang; // Guest language always same as site
|
||||
$USER->firstname = get_string("guestuser"); // Name always in current language
|
||||
$USER->lastname = " ";
|
||||
}
|
||||
|
||||
if (!update_user_login_times()) {
|
||||
error("Wierd error: could not update login records");
|
||||
}
|
||||
|
||||
set_moodle_cookie($USER->username);
|
||||
|
||||
unset($SESSION->lang);
|
||||
$SESSION->justloggedin = true;
|
||||
|
||||
// Restore the calendar filters, if saved
|
||||
if (intval(get_user_preferences('calendar_persistflt', 0))) {
|
||||
include_once($CFG->dirroot.'/calendar/lib.php');
|
||||
calendar_set_filters_status(get_user_preferences('calendar_savedflt', 0xff));
|
||||
}
|
||||
|
||||
//Select password change url
|
||||
$userauth = get_auth_plugin($USER->auth);
|
||||
if (method_exists($userauth, 'can_change_password') and $userauth->can_change_password()) {
|
||||
$passwordchangeurl=$CFG->wwwroot.'/login/change_password.php';
|
||||
}
|
||||
|
||||
// check whether the user should be changing password
|
||||
if (get_user_preferences('auth_forcepasswordchange', false)) {
|
||||
if (isset($passwordchangeurl)) {
|
||||
redirect($passwordchangeurl);
|
||||
} else {
|
||||
print_error('auth_cas_broken_password','auth');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
add_to_log(SITEID, "user", "login", "view.php?id=$user->id&course=".SITEID, $user->id, 0, $user->id);
|
||||
|
||||
if (user_not_fully_set_up($USER)) {
|
||||
$urltogo = $CFG->wwwroot.'/user/edit.php?id='.$USER->id.'&course='.SITEID;
|
||||
// We don't delete $SESSION->wantsurl yet, so we get there later
|
||||
|
||||
} else if (isset($SESSION->wantsurl) and (strpos($SESSION->wantsurl, $CFG->wwwroot) === 0)) {
|
||||
$urltogo = $SESSION->wantsurl; /// Because it's an address in this site
|
||||
unset($SESSION->wantsurl);
|
||||
|
||||
} else {
|
||||
$urltogo = $CFG->wwwroot.'/'; /// Go to the standard home page
|
||||
unset($SESSION->wantsurl); /// Just in case
|
||||
}
|
||||
|
||||
// check if user password has expired
|
||||
// Currently supported only for ldap-authentication module
|
||||
if ($ldapauth->config->expiration == 1) {
|
||||
$days2expire = $ldapauth->password_expire($USER->username);
|
||||
if (intval($days2expire) > 0 && intval($days2expire) < intval($CFG->{$USER->auth.'_expiration_warning'})) {
|
||||
print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "<div class=\"langmenu\">$langmenu</div>");
|
||||
notice_yesno(get_string('auth_passwordwillexpire', 'auth', $days2expire), $passwordchangeurl, $urltogo);
|
||||
print_footer();
|
||||
exit;
|
||||
} elseif (intval($days2expire) < 0 ) {
|
||||
print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "<div class=\"langmenu\">$langmenu</div>");
|
||||
notice_yesno(get_string('auth_passwordisexpired', 'auth'), $passwordchangeurl, $urltogo);
|
||||
print_footer();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
reset_login_count();
|
||||
|
||||
load_all_capabilities(); /// This is what lets the user do anything on the site :-)
|
||||
|
||||
redirect($urltogo);
|
||||
|
||||
exit;
|
||||
} else {
|
||||
if (!$CFG->guestloginbutton) {
|
||||
$errormsg = get_string("invalidcaslogin");
|
||||
phpCAS::logout("$CFG->wwwroot/auth/cas/forbidden.php");
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($errormsg)) {
|
||||
$errormsg = "";
|
||||
}
|
||||
|
||||
if (empty($SESSION->wantsurl)) {
|
||||
$SESSION->wantsurl = array_key_exists('HTTP_REFERER',$_SERVER) ? $_SERVER["HTTP_REFERER"] : $CFG->wwwroot.'/';
|
||||
}
|
||||
|
||||
if (get_moodle_cookie() == '') {
|
||||
set_moodle_cookie('nobody'); // To help search for cookies
|
||||
}
|
||||
|
||||
if (empty($frm->username)) {
|
||||
$frm->username = get_moodle_cookie() === 'nobody' ? '' : get_moodle_cookie();
|
||||
$frm->password = "";
|
||||
}
|
||||
|
||||
if (!empty($frm->username)) {
|
||||
$focus = "login.password";
|
||||
} else {
|
||||
$focus = "login.username";
|
||||
}
|
||||
|
||||
if ($CFG->auth == "email" or $CFG->auth == "none" or chop($CFG->auth_instructions) <> "" ) {
|
||||
$show_instructions = true;
|
||||
} else {
|
||||
$show_instructions = false;
|
||||
}
|
||||
|
||||
print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "<div align=\"right\">$langmenu</div>");
|
||||
include($CFG->dirroot.'/auth/cas/index_form.html');
|
||||
print_footer();
|
||||
|
||||
exit;
|
||||
|
||||
// No footer on this page
|
||||
|
||||
?>
|
||||
@@ -1,15 +0,0 @@
|
||||
<?php
|
||||
// $Id$
|
||||
// logout the user from CAS server (destroy the ticket)
|
||||
defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||
|
||||
global $CFG;
|
||||
if ($CFG->cas_logout) {
|
||||
require_once($CFG->dirroot.'/config.php');
|
||||
include_once($CFG->dirroot.'/lib/cas/CAS.php');
|
||||
phpCAS::client($CFG->cas_version,$CFG->cas_hostname,(int)$CFG->cas_port,$CFG->cas_baseuri);
|
||||
$backurl = $CFG->wwwroot;
|
||||
phpCAS::logout($backurl);
|
||||
}
|
||||
|
||||
?>
|
||||
+29
-22
@@ -182,6 +182,7 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
}
|
||||
$authdb->Close();
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -197,7 +198,7 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
|
||||
global $CFG;
|
||||
if ($this->config->passtype === 'internal') {
|
||||
update_internal_user_password($user, $newpassword);
|
||||
return update_internal_user_password($user, $newpassword);
|
||||
} else {
|
||||
// we should have never been called!
|
||||
return false;
|
||||
@@ -390,6 +391,9 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
|
||||
function user_exists($username) {
|
||||
|
||||
/// Init result value
|
||||
$result = false;
|
||||
|
||||
$textlib = textlib_get_instance();
|
||||
$extusername = $textlib->convert(stripslashes($username), 'utf-8', $this->config->extencoding);
|
||||
|
||||
@@ -397,46 +401,40 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
|
||||
$rs = $authdb->Execute("SELECT * FROM {$this->config->table}
|
||||
WHERE {$this->config->fielduser} = '".$this->ext_addslashes($extusername)."' ");
|
||||
$authdb->Close();
|
||||
|
||||
if (!$rs) {
|
||||
print_error('auth_dbcantconnect','auth');
|
||||
return false;
|
||||
} else if ( $rs->RecordCount() ) {
|
||||
// user exists exterally
|
||||
$result = $rs->RecordCount();
|
||||
}
|
||||
|
||||
if ( $rs->RecordCount() ) {
|
||||
// user exists exterally
|
||||
return $rs->RecordCount();
|
||||
} else {
|
||||
// user does not exist externally
|
||||
return false;
|
||||
}
|
||||
$authdb->Close();
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
function get_userlist() {
|
||||
|
||||
/// Init result value
|
||||
$result = array();
|
||||
|
||||
$authdb = $this->db_init();
|
||||
|
||||
// fetch userlist
|
||||
$rs = $authdb->Execute("SELECT {$this->config->fielduser} AS username
|
||||
FROM {$this->config->table} ");
|
||||
$authdb->Close();
|
||||
|
||||
if (!$rs) {
|
||||
print_error('auth_dbcantconnect','auth');
|
||||
return false;
|
||||
} else if ( $rs->RecordCount() ) {
|
||||
while ($rec = rs_fetch_next_record($rs)) {
|
||||
array_push($result, $rec->username);
|
||||
}
|
||||
}
|
||||
|
||||
if ( $rs->RecordCount() ) {
|
||||
$userlist = array();
|
||||
while ($rec = rs_fetch_next_record($rs)) {
|
||||
array_push($userlist, $rec->username);
|
||||
}
|
||||
return $userlist;
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
$authdb->Close();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -578,7 +576,7 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
* @return bool
|
||||
*/
|
||||
function is_internal() {
|
||||
return false;
|
||||
return ($this->config->passtype == 'internal');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -607,6 +605,15 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if plugin allows resetting of internal password.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function can_reset_password() {
|
||||
return ($this->config->passtype == 'internal');
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints a form for configuring this authentication plugin.
|
||||
*
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@
|
||||
$yesno = array( get_string('no'), get_string('yes') );
|
||||
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="5" border="0" align="center">
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><label for="host"><?php print_string("auth_dbhost_key", "auth") ?></label></td>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!-- No config needed -->
|
||||
<div align="center"><?php print_string('none'); ?></div>
|
||||
<div style="text-align: center"><?php print_string('none'); ?></div>
|
||||
|
||||
<table cellspacing="0" cellpadding="5" border="0" align="center">
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
<?php
|
||||
|
||||
print_auth_lock_options('email', $user_fields, get_string('auth_fieldlocks_help', 'auth'), false, false);
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
}
|
||||
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="5" border="0" align="center">
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string("auth_fchost_key", "auth") ?>:</td>
|
||||
|
||||
@@ -15,7 +15,7 @@ if (!isset($config->changepasswordurl)) {
|
||||
}
|
||||
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="5" border="0" align="center">
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_imaphost_key', 'auth') ?>: </td>
|
||||
|
||||
+178
-16
@@ -275,12 +275,16 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
default:
|
||||
print_error('auth_ldap_unsupportedusertype','auth',$this->config->user_type);
|
||||
}
|
||||
$uadd = $this->ldap_add($ldapconnection, $this->config->user_attribute.'="'.$this->ldap_addslashes($userobject->username).','.$this->config->create_context.'"', $newuser);
|
||||
$uadd = ldap_add($ldapconnection, $this->config->user_attribute.'="'.$this->ldap_addslashes($userobject->username).','.$this->config->create_context.'"', $newuser);
|
||||
ldap_close($ldapconnection);
|
||||
return $uadd;
|
||||
|
||||
}
|
||||
|
||||
function can_reset_password() {
|
||||
return !empty($this->config->stdchangepassword);
|
||||
}
|
||||
|
||||
/**
|
||||
* return number of days to user password expires
|
||||
*
|
||||
@@ -291,7 +295,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
* @return integer
|
||||
*/
|
||||
function password_expire($username) {
|
||||
$result = false;
|
||||
$result = 0;
|
||||
|
||||
$textlib = textlib_get_instance();
|
||||
$extusername = $textlib->convert(stripslashes($username), 'utf-8', $this->config->ldapencoding);
|
||||
@@ -302,19 +306,16 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$sr = ldap_read($ldapconnection, $user_dn, 'objectclass=*', $search_attribs);
|
||||
if ($sr) {
|
||||
$info = $this->ldap_get_entries($ldapconnection, $sr);
|
||||
if (empty ($info) or empty($info[0][$this->config->expireattr][0])) {
|
||||
//error_log("ldap: no expiration value".$info[0][$this->config->expireattr]);
|
||||
// no expiration attribute, password does not expire
|
||||
$result = 0;
|
||||
}
|
||||
else {
|
||||
$now = time();
|
||||
$expiretime = $this->ldap_expirationtime2unix($info[0][$this->config->expireattr][0]);
|
||||
if ($expiretime > $now) {
|
||||
$result = ceil(($expiretime - $now) / DAYSECS);
|
||||
}
|
||||
else {
|
||||
$result = floor(($expiretime - $now) / DAYSECS);
|
||||
if (!empty ($info) and !empty($info[0][$this->config->expireattr][0])) {
|
||||
$expiretime = $this->ldap_expirationtime2unix($info[0][$this->config->expireattr][0], $ldapconnection, $user_dn);
|
||||
if ($expiretime != 0) {
|
||||
$now = time();
|
||||
if ($expiretime > $now) {
|
||||
$result = ceil(($expiretime - $now) / DAYSECS);
|
||||
}
|
||||
else {
|
||||
$result = floor(($expiretime - $now) / DAYSECS);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -1051,6 +1052,23 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
}
|
||||
break;
|
||||
|
||||
case 'ad':
|
||||
// Passwords in Active Directory must be encoded as Unicode
|
||||
// strings (UCS-2 Little Endian format) and surrounded with
|
||||
// double quotes. See http://support.microsoft.com/?kbid=269190
|
||||
if (!function_exists('mb_convert_encoding')) {
|
||||
error_log ('You need the mbstring extension to change passwords in Active Directory');
|
||||
return false;
|
||||
}
|
||||
$extpassword = mb_convert_encoding('"'.$extpassword.'"', "UCS-2LE", $this->config->ldapencoding);
|
||||
$result = ldap_modify($ldapconnection, $user_dn, array('unicodePwd' => $extpassword));
|
||||
if (!$result) {
|
||||
error_log('LDAP Error in user_update_password(). Error code: '
|
||||
. ldap_errno($ldapconnection) . '; Error string : '
|
||||
. ldap_err2str(ldap_errno($ldapconnection)));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$usedconnection = &$ldapconnection;
|
||||
// send ldap the password in cleartext, it will md5 it itself
|
||||
@@ -1182,9 +1200,11 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
* depends on $this->config->user_type variable
|
||||
*
|
||||
* @param mixed time Time stamp readed from ldap as it is.
|
||||
* @param string $ldapconnection Just needed for Active Directory.
|
||||
* @param string $user_dn User distinguished name for the user we are checking password expiration (just needed for Active Directory).
|
||||
* @return timestamp
|
||||
*/
|
||||
function ldap_expirationtime2unix ($time) {
|
||||
function ldap_expirationtime2unix ($time, $ldapconnection, $user_dn) {
|
||||
$result = false;
|
||||
switch ($this->config->user_type) {
|
||||
case 'edir':
|
||||
@@ -1199,6 +1219,9 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
case 'posix':
|
||||
$result = $time * DAYSECS; //The shadowExpire contains the number of DAYS between 01/01/1970 and the actual expiration date
|
||||
break;
|
||||
case 'ad':
|
||||
$result = $this->ldap_get_ad_pwdexpire($time, $ldapconnection, $user_dn);
|
||||
break;
|
||||
default:
|
||||
print_error('auth_ldap_usertypeundefined', 'auth');
|
||||
}
|
||||
@@ -1684,6 +1707,145 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
array('\\"', '\\00'), $text);
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get password expiration time for a given user from Active Directory
|
||||
*
|
||||
* @param string $pwdlastset The time last time we changed the password.
|
||||
* @param resource $lcapconn The open LDAP connection.
|
||||
* @param string $user_dn The distinguished name of the user we are checking.
|
||||
*
|
||||
* @return string $unixtime
|
||||
*/
|
||||
function ldap_get_ad_pwdexpire($pwdlastset, $ldapconn, $user_dn){
|
||||
define ('ROOTDSE', '');
|
||||
// UF_DONT_EXPIRE_PASSWD value taken from MSDN directly
|
||||
define ('UF_DONT_EXPIRE_PASSWD', 0x00010000);
|
||||
|
||||
global $CFG;
|
||||
|
||||
if (!function_exists('bcsub')) {
|
||||
error_log ('You need the BCMath extension to use grace logins with Active Directory');
|
||||
return 0;
|
||||
}
|
||||
|
||||
// If UF_DONT_EXPIRE_PASSWD flag is set in user's
|
||||
// userAccountControl attribute, the password doesn't expire.
|
||||
$sr = ldap_read($ldapconn, $user_dn, 'objectclass=*',
|
||||
array('userAccountControl'));
|
||||
if (!$sr) {
|
||||
error_log("ldap: error getting userAccountControl for $user_dn");
|
||||
// don't expire password, as we are not sure it has to be
|
||||
// expired or not.
|
||||
return 0;
|
||||
}
|
||||
|
||||
$info = $this->ldap_get_entries($ldapconn, $sr);
|
||||
$useraccountcontrol = $info[0]['userAccountControl'][0];
|
||||
if ($useraccountcontrol & UF_DONT_EXPIRE_PASSWD) {
|
||||
// password doesn't expire.
|
||||
return 0;
|
||||
}
|
||||
|
||||
// If pwdLastSet is zero, the user must change his/her password now
|
||||
// (unless UF_DONT_EXPIRE_PASSWD flag is set, but we already
|
||||
// tested this above)
|
||||
if ($pwdlastset === '0') {
|
||||
// password has expired
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// Password expiration time in Active Directory is the composition of
|
||||
// two values:
|
||||
//
|
||||
// - User's pwdLastSet attribute, that stores the last time
|
||||
// the password was changed.
|
||||
//
|
||||
// - Domain's maxPwdAge attribute, that sets how long
|
||||
// passwords last in this domain.
|
||||
//
|
||||
// We already have the first value (passed in as a parameter). We
|
||||
// need to get the second one. As we don't know the domain DN, we
|
||||
// have to query rootDSE's defaultNamingContext attribute to get
|
||||
// it. Then we have to query that DN's maxPwdAge attribute to get
|
||||
// the real value.
|
||||
//
|
||||
// Once we have both values, we just need to combine them. But MS
|
||||
// chose to use a different base and unit for time measurements.
|
||||
// So we need to convert the values to Unix timestamps (see
|
||||
// details below).
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
$sr = ldap_read($ldapconn, ROOTDSE, 'objectclass=*',
|
||||
array('defaultNamingContext'));
|
||||
if (!$sr) {
|
||||
error_log("ldap: error querying rootDSE for Active Directory");
|
||||
return 0;
|
||||
}
|
||||
|
||||
$info = $this->ldap_get_entries($ldapconn, $sr);
|
||||
$domaindn = $info[0]['defaultNamingContext'][0];
|
||||
|
||||
$sr = ldap_read ($ldapconn, $domaindn, 'objectclass=*',
|
||||
array('maxPwdAge'));
|
||||
$info = $this->ldap_get_entries($ldapconn, $sr);
|
||||
$maxpwdage = $info[0]['maxPwdAge'][0];
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// MSDN says that "pwdLastSet contains the number of 100 nanosecond
|
||||
// intervals since January 1, 1601 (UTC), stored in a 64 bit integer".
|
||||
//
|
||||
// According to Perl's Date::Manip, the number of seconds between
|
||||
// this date and Unix epoch is 11644473600. So we have to
|
||||
// substract this value to calculate a Unix time, once we have
|
||||
// scaled pwdLastSet to seconds. This is the script used to
|
||||
// calculate the value shown above:
|
||||
//
|
||||
// #!/usr/bin/perl -w
|
||||
//
|
||||
// use Date::Manip;
|
||||
//
|
||||
// $date1 = ParseDate ("160101010000 UTC");
|
||||
// $date2 = ParseDate ("197001010000 UTC");
|
||||
// $delta = DateCalc($date1, $date2, \$err);
|
||||
// $secs = Delta_Format($delta, 0, "%st");
|
||||
// print "$secs \n";
|
||||
//
|
||||
// MSDN also says that "maxPwdAge is stored as a large integer that
|
||||
// represents the number of 100 nanosecond intervals from the time
|
||||
// the password was set before the password expires." We also need
|
||||
// to scale this to seconds. Bear in mind that this value is stored
|
||||
// as a _negative_ quantity (at least in my AD domain).
|
||||
//
|
||||
// As a last remark, if the low 32 bits of maxPwdAge are equal to 0,
|
||||
// the maximum password age in the domain is set to 0, which means
|
||||
// passwords do not expire (see
|
||||
// http://msdn2.microsoft.com/en-us/library/ms974598.aspx)
|
||||
//
|
||||
// As the quantities involved are too big for PHP integers, we
|
||||
// need to use BCMath functions to work with arbitrary precision
|
||||
// numbers.
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
|
||||
// If the low order 32 bits are 0, then passwords do not expire in
|
||||
// the domain. Just do '$maxpwdage mod 2^32' and check the result
|
||||
// (2^32 = 4294967296)
|
||||
if (bcmod ($maxpwdage, 4294967296) === '0') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Add up pwdLastSet and maxPwdAge to get password expiration
|
||||
// time, in MS time units. Remember maxPwdAge is stored as a
|
||||
// _negative_ quantity, so we need to substract it in fact.
|
||||
$pwdexpire = bcsub ($pwdlastset, $maxpwdage);
|
||||
|
||||
// Scale the result to convert it to Unix time units and return
|
||||
// that value.
|
||||
return bcsub( bcdiv($pwdexpire, '10000000'), '11644473600');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -63,7 +63,7 @@ if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
|
||||
}
|
||||
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="5" border="0" align="center">
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
@@ -228,7 +228,7 @@ if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><label for="memberattribute_isdn"><?php print_string('auth_ldap_memberattribute_isdn_key','auth') ?></label></td>
|
||||
<td>
|
||||
<input name="memberattribute" id="memberattribute_isdn" type="text" size="30" value="<?php echo $config->memberattribute_isdn?>" />
|
||||
<input name="memberattribute_isdn" id="memberattribute_isdn" type="text" size="30" value="<?php echo $config->memberattribute_isdn?>" />
|
||||
<?php if (isset($err['memberattribute_isdn'])) formerr($err['memberattribute_isdn']); ?>
|
||||
</td><td>
|
||||
<?php print_string('auth_ldap_memberattribute_isdn','auth') ?>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!-- No config needed -->
|
||||
<div align="center"><?php print_string('none'); ?></div>
|
||||
<div style="text-align:center"><?php print_string('none'); ?></div>
|
||||
|
||||
<table cellspacing="0" cellpadding="5" border="0" align="center">
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
<?php
|
||||
|
||||
print_auth_lock_options('manual', $user_fields, get_string('auth_fieldlocks_help', 'auth'), false, false);
|
||||
|
||||
+29
-28
@@ -208,7 +208,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
$mnet_session->confirm_timeout = time() + $this->config->rpc_negotiation_timeout;
|
||||
$mnet_session->expires = time() + (integer)ini_get('session.gc_maxlifetime');
|
||||
$mnet_session->session_id = session_id();
|
||||
if (! $mnet_session->id = insert_record('mnet_session', $mnet_session)) {
|
||||
if (! $mnet_session->id = insert_record('mnet_session', addslashes_object($mnet_session))) {
|
||||
error(get_string('databaseerror', 'mnet'));
|
||||
}
|
||||
} else {
|
||||
@@ -217,7 +217,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
$mnet_session->confirm_timeout = time() + $this->config->rpc_negotiation_timeout;
|
||||
$mnet_session->expires = time() + (integer)ini_get('session.gc_maxlifetime');
|
||||
$mnet_session->session_id = session_id();
|
||||
if (false == update_record('mnet_session', $mnet_session)) {
|
||||
if (false == update_record('mnet_session', addslashes_object($mnet_session))) {
|
||||
error(get_string('databaseerror', 'mnet'));
|
||||
}
|
||||
}
|
||||
@@ -294,11 +294,11 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
error(get_string('nolocaluser', 'mnet'));
|
||||
}
|
||||
$remoteuser->mnethostid = $remotehost->id;
|
||||
if (! insert_record('user', $remoteuser)) {
|
||||
if (! insert_record('user', addslashes_object($remoteuser))) {
|
||||
error(get_string('databaseerror', 'mnet'));
|
||||
}
|
||||
$firsttime = true;
|
||||
if (! $localuser = get_record('user', 'username', $remoteuser->username, 'mnethostid', $remotehost->id)) {
|
||||
if (! $localuser = get_record('user', 'username', addslashes($remoteuser->username), 'mnethostid', $remotehost->id)) {
|
||||
error(get_string('nolocaluser', 'mnet'));
|
||||
}
|
||||
}
|
||||
@@ -367,7 +367,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
|
||||
$localuser->mnethostid = $remotepeer->id;
|
||||
|
||||
$bool = update_record('user', $localuser);
|
||||
$bool = update_record('user', addslashes_object($localuser));
|
||||
if (!$bool) {
|
||||
// TODO: Jonathan to clean up mess
|
||||
// Actually, this should never happen (modulo race conditions) - ML
|
||||
@@ -390,12 +390,12 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
$mnet_session->confirm_timeout = time();
|
||||
$mnet_session->expires = time() + (integer)$session_gc_maxlifetime;
|
||||
$mnet_session->session_id = session_id();
|
||||
if (! $mnet_session->id = insert_record('mnet_session', $mnet_session)) {
|
||||
if (! $mnet_session->id = insert_record('mnet_session', addslashes_object($mnet_session))) {
|
||||
error(get_string('databaseerror', 'mnet'));
|
||||
}
|
||||
} else {
|
||||
$mnet_session->expires = time() + (integer)$session_gc_maxlifetime;
|
||||
update_record('mnet_session', $mnet_session);
|
||||
update_record('mnet_session', addslashes_object($mnet_session));
|
||||
}
|
||||
|
||||
if (!$firsttime) {
|
||||
@@ -539,7 +539,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
// First up - do we have a record for this course?
|
||||
if (!array_key_exists($course['remoteid'], $currentcourses)) {
|
||||
// No record - we must create it
|
||||
$course['id'] = insert_record('mnet_enrol_course', (object)$course);
|
||||
$course['id'] = insert_record('mnet_enrol_course', addslashes_object((object)$course));
|
||||
$currentcourse = (object)$course;
|
||||
} else {
|
||||
// Pointer to current course:
|
||||
@@ -557,7 +557,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
}
|
||||
|
||||
if ($saveflag) {
|
||||
update_record('mnet_enrol_course', $currentcourse);
|
||||
update_record('mnet_enrol_course', addslashes_object($currentcourse));
|
||||
}
|
||||
|
||||
if (isset($currentcourse->assignmentid) && is_numeric($currentcourse->assignmentid)) {
|
||||
@@ -580,7 +580,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
$assignObj->hostid = (int)$MNET_REMOTE_CLIENT->id;
|
||||
$assignObj->courseid = $course['id'];
|
||||
$assignObj->rolename = $course['defaultrolename'];
|
||||
$assignObj->id = insert_record('mnet_enrol_assignments', $assignObj);
|
||||
$assignObj->id = insert_record('mnet_enrol_assignments', addslashes_object($assignObj));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -673,15 +673,16 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
ORDER BY
|
||||
h.name ASC";
|
||||
|
||||
$resultset = get_records_sql($query);
|
||||
$id_providers = array();
|
||||
$service_providers = array();
|
||||
foreach($resultset as $hostservice) {
|
||||
if(!empty($hostservice->idppublish) && !empty($hostservice->spsubscribe)) {
|
||||
$service_providers[]= array('id' => $hostservice->id, 'name' => $hostservice->hostname, 'wwwroot' => $hostservice->wwwroot);
|
||||
}
|
||||
if(!empty($hostservice->idpsubscribe) && !empty($hostservice->sppublish)) {
|
||||
$id_providers[]= array('id' => $hostservice->id, 'name' => $hostservice->hostname, 'wwwroot' => $hostservice->wwwroot);
|
||||
if ($resultset = get_records_sql($query)) {
|
||||
foreach($resultset as $hostservice) {
|
||||
if(!empty($hostservice->idppublish) && !empty($hostservice->spsubscribe)) {
|
||||
$service_providers[]= array('id' => $hostservice->id, 'name' => $hostservice->hostname, 'wwwroot' => $hostservice->wwwroot);
|
||||
}
|
||||
if(!empty($hostservice->idpsubscribe) && !empty($hostservice->sppublish)) {
|
||||
$id_providers[]= array('id' => $hostservice->id, 'name' => $hostservice->hostname, 'wwwroot' => $hostservice->wwwroot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -694,7 +695,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
function process_config($config) {
|
||||
// set to defaults if undefined
|
||||
if (!isset ($config->rpc_negotiation_timeout)) {
|
||||
$config->host = '30';
|
||||
$config->rpc_negotiation_timeout = '30';
|
||||
}
|
||||
if (!isset ($config->auto_add_remote_users)) {
|
||||
$config->auto_add_remote_users = '0';
|
||||
@@ -884,7 +885,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
|
||||
unset($logEntryObj->username);
|
||||
|
||||
$insertok = insert_record('mnet_log', $logEntryObj, false);
|
||||
$insertok = insert_record('mnet_log', addslashes_object($logEntryObj), false);
|
||||
|
||||
if ($insertok) {
|
||||
$MNET_REMOTE_CLIENT->last_log_id = $logEntryObj->remoteid;
|
||||
@@ -991,8 +992,8 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
$random100 = rand(0,100);
|
||||
if ($random100 < 10) { // Approximately 10% of the time.
|
||||
// nuke olden sessions
|
||||
$longtime = $timenow - (1 * 3600 * 24);
|
||||
delete_records_select('mnet_session', "expires < $timenow");
|
||||
$longtime = time() - (1 * 3600 * 24);
|
||||
delete_records_select('mnet_session', "expires < $longtime");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1005,7 +1006,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
*/
|
||||
function prelogout_hook() {
|
||||
global $MNET, $CFG, $USER;
|
||||
if ($USER->auth != 'mnet') {
|
||||
if (!is_enabled_auth('mnet')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1038,14 +1039,14 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
from
|
||||
{$CFG->prefix}mnet_session s
|
||||
where
|
||||
s.username = '$username' AND
|
||||
s.username = '".addslashes($username)."' AND
|
||||
s.useragent = '$useragent' AND
|
||||
s.mnethostid = '{$USER->mnethostid}'";
|
||||
|
||||
$mnetsessions = get_records_sql($sql);
|
||||
|
||||
$ignore = delete_records('mnet_session',
|
||||
'username', $username,
|
||||
'username', addslashes($username),
|
||||
'useragent', $useragent,
|
||||
'mnethostid', $USER->mnethostid);
|
||||
|
||||
@@ -1080,7 +1081,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
global $CFG, $USER, $MNET_REMOTE_CLIENT;
|
||||
require_once $CFG->dirroot.'/mnet/xmlrpc/client.php';
|
||||
|
||||
$userid = get_field('user', 'id', 'mnethostid', $CFG->mnet_localhost_id, 'username', $username);
|
||||
$userid = get_field('user', 'id', 'mnethostid', $CFG->mnet_localhost_id, 'username', addslashes($username));
|
||||
|
||||
$returnstring = '';
|
||||
$sql = "
|
||||
@@ -1176,7 +1177,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
*/
|
||||
function kill_child($username, $useragent) {
|
||||
global $CFG, $MNET_REMOTE_CLIENT;
|
||||
$session = get_record('mnet_session', 'username', $username, 'mnethostid', $MNET_REMOTE_CLIENT->id, 'useragent', $useragent);
|
||||
$session = get_record('mnet_session', 'username', addslashes($username), 'mnethostid', $MNET_REMOTE_CLIENT->id, 'useragent', $useragent);
|
||||
if (false != $session) {
|
||||
$start = ob_start();
|
||||
|
||||
@@ -1260,7 +1261,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
function fetch_user_image($username) {
|
||||
global $CFG;
|
||||
|
||||
if ($user = get_record('user', 'username', $username, 'mnethostid', $CFG->mnet_localhost_id)) {
|
||||
if ($user = get_record('user', 'username', addslashes($username), 'mnethostid', $CFG->mnet_localhost_id)) {
|
||||
$filename1 = "{$CFG->dataroot}/users/{$user->id}/f1.jpg";
|
||||
$filename2 = "{$CFG->dataroot}/users/{$user->id}/f2.jpg";
|
||||
$return = array();
|
||||
@@ -1331,7 +1332,7 @@ class auth_plugin_mnet extends auth_plugin_base {
|
||||
*/
|
||||
function can_login_remotely($username, $mnethostid) {
|
||||
$accessctrl = 'allow';
|
||||
$aclrecord = get_record('mnet_sso_access_control', 'username', $username, 'mnet_host_id', $mnethostid);
|
||||
$aclrecord = get_record('mnet_sso_access_control', 'username', addslashes($username), 'mnet_host_id', $mnethostid);
|
||||
if (!empty($aclrecord)) {
|
||||
$accessctrl = $aclrecord->accessctrl;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// set to defaults if undefined
|
||||
if (!isset($config->rpc_negotiation_timeout)) {
|
||||
$config->host = '30';
|
||||
$config->rpc_negotiation_timeout = '30';
|
||||
}
|
||||
if (!isset ($config->auto_add_remote_users)) {
|
||||
$config->auto_add_remote_users = '0';
|
||||
@@ -15,7 +15,8 @@ if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict'
|
||||
}
|
||||
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="5" border="0" align="center">
|
||||
<div id="mnetconfig">
|
||||
<table cellspacing="0" cellpadding="5">
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('rpc_negotiation_timeout', 'auth'); ?>: </td>
|
||||
@@ -59,29 +60,30 @@ if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict'
|
||||
<td colspan="3"><?php print_string('auth_mnet_roamin', 'auth'); ?>: </td>
|
||||
</tr>
|
||||
<?php
|
||||
foreach($id_providers as $host):
|
||||
foreach($id_providers as $host) {
|
||||
?>
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php echo $host['name']; ?>: </td>
|
||||
<td colspan="2"><?php echo $host['wwwroot']; ?> </td>
|
||||
</tr>
|
||||
<?php
|
||||
endforeach;
|
||||
}
|
||||
?>
|
||||
<tr valign="top" class="required">
|
||||
<td colspan="3"><?php print_string('auth_mnet_roamout', 'auth'); ?>: </td>
|
||||
</tr>
|
||||
<?php
|
||||
foreach($service_providers as $host):
|
||||
foreach($service_providers as $host) {
|
||||
?>
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php echo $host['name']; ?>: </td>
|
||||
<td colspan="2"><?php echo $host['wwwroot']; ?> </td>
|
||||
</tr>
|
||||
<?php
|
||||
endforeach;
|
||||
}
|
||||
|
||||
// print_auth_lock_options('mnet', $user_fields, get_string('auth_fieldlocks_help', 'auth'), false, false);
|
||||
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -12,7 +12,7 @@ if (!isset($config->changepasswordurl)) {
|
||||
}
|
||||
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="5" border="0" align="center">
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_nntphost_key', 'auth') ?>: </td>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!-- No config needed -->
|
||||
<div align="center"><?php print_string('none'); ?></div>
|
||||
<div style="text-align: center"><?php print_string('none'); ?></div>
|
||||
|
||||
<table cellspacing="0" cellpadding="5" border="0" align="center">
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
<?php
|
||||
|
||||
print_auth_lock_options('none', $user_fields, get_string('auth_fieldlocks_help', 'auth'), false, false);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!-- No config needed -->
|
||||
<div align="center"><?php print_string('none'); ?></div>
|
||||
<div style="text-align: center"><?php print_string('none'); ?></div>
|
||||
|
||||
<table cellspacing="0" cellpadding="5" border="0" align="center">
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
<?php
|
||||
|
||||
print_auth_lock_options('pam', $user_fields, get_string('auth_fieldlocks_help', 'auth'), false, false);
|
||||
|
||||
@@ -18,7 +18,7 @@ if (!isset($config->changepasswordurl)) {
|
||||
}
|
||||
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="5" border="0" align="center">
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string('auth_pop3host_key', 'auth') ?>: </td>
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
// TODO: this generates broken file errors, needs safer test -JH
|
||||
|
||||
// Is Auth/RADIUS really there?
|
||||
if ((!include_once('Auth/RADIUS.php')) or (!class_exists(Auth_RADIUS_PAP))) {
|
||||
print '<p align="center"><font color="red"><strong>Warning: The Auth_RADIUS module does not seem to be present. Please ensure it is installed and enabled.</strong></font></p>';
|
||||
if (!defined('Auth_RADIUS_PAP') or !class_exists(Auth_RADIUS_PAP) or !include_once('Auth/RADIUS.php')) {
|
||||
print '<p style="text-align:center; color: red"><strong>Warning: The Auth_RADIUS module does not seem to be present. Please ensure it is installed and enabled.</strong></p>';
|
||||
}
|
||||
|
||||
// set to defaults if undefined
|
||||
@@ -22,7 +22,7 @@ if (!isset($config->changepasswordurl)) {
|
||||
}
|
||||
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="5" border="0" align="center">
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('auth_radiushost_key', 'auth') ?>: </td>
|
||||
|
||||
@@ -144,24 +144,27 @@ Example file:
|
||||
<?PHP
|
||||
|
||||
// Set the zip code and the adress
|
||||
if ($_SERVER[$pluginconfig->field_map_address] != '')
|
||||
if ($_SERVER[$this->config->field_map_address] != '')
|
||||
{
|
||||
// $address contains something like 'SWITCH$Limmatquai 138$CH-8021 Zurich'
|
||||
// We want to split this up to get:
|
||||
// We want to split this up to get:
|
||||
// institution, street, zipcode, city and country
|
||||
$address = $_SERVER[$pluginconfig->field_map_address];
|
||||
$address = $_SERVER[$this->config->field_map_address];
|
||||
list($institution, $street, $zip_city) = split('\$', $address);
|
||||
ereg(' (.+)',$zip_city, $regs);
|
||||
$city = $regs[1];
|
||||
|
||||
|
||||
ereg('(.+)-',$zip_city, $regs);
|
||||
$country = $regs[1];
|
||||
|
||||
|
||||
$result["address"] = $street;
|
||||
$result["city"] = $city;
|
||||
$result["country"] = $country;
|
||||
$result["department"] = $institution;
|
||||
$result["description"] = "I am a Shibboleth user";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
--
|
||||
|
||||
|
||||
@@ -148,18 +148,11 @@ class auth_plugin_shibboleth extends auth_plugin_base {
|
||||
|
||||
function loginpage_hook() {
|
||||
global $SESSION, $CFG;
|
||||
|
||||
// Prevent username from being shown on login page after logout
|
||||
$CFG->nolastloggedin = true;
|
||||
|
||||
//TODO: fix the code
|
||||
return;
|
||||
|
||||
// See http://moodle.org/mod/forum/discuss.php?d=39918#187611
|
||||
// if ($CFG->auth == 'shibboleth') {
|
||||
// if (!empty($SESSION->shibboleth_checked) ) { // Just come from there
|
||||
// unset($SESSION->shibboleth_checked);
|
||||
// } else if (empty($_POST)) { // No incoming data, so redirect
|
||||
// redirect($CFG->wwwroot.'/auth/shibboleth/index.php');
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,6 +174,8 @@ class auth_plugin_shibboleth extends auth_plugin_base {
|
||||
* @param object $config Configuration object
|
||||
*/
|
||||
function process_config($config) {
|
||||
global $CFG;
|
||||
|
||||
// set to defaults if undefined
|
||||
if (!isset($config->auth_instructions) or empty($config->user_attribute)) {
|
||||
$config->auth_instructions = get_string('shibboleth_instructions', 'auth', $CFG->wwwroot.'/auth/shibboleth/index.php');
|
||||
@@ -202,7 +197,8 @@ class auth_plugin_shibboleth extends auth_plugin_base {
|
||||
set_config('changepasswordurl', $config->changepasswordurl, 'auth/shibboleth');
|
||||
|
||||
// Check values and return false if something is wrong
|
||||
if (!file_exists($config->convert_data) || !is_readable($config->convert_data)){
|
||||
// Patch Anyware Technologies (14/05/07)
|
||||
if (($config->convert_data != '')&&(!file_exists($config->convert_data) || !is_readable($config->convert_data))){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
}
|
||||
|
||||
?>
|
||||
<table cellspacing="0" cellpadding="5" border="0" align="center">
|
||||
<table cellspacing="0" cellpadding="5" border="0">
|
||||
|
||||
<tr valign="top" class="required">
|
||||
<td align="right"><?php print_string("username") ?>:</td>
|
||||
|
||||
@@ -41,7 +41,10 @@
|
||||
$USER->site = $CFG->wwwroot; // for added security, store the site in the
|
||||
|
||||
update_user_login_times();
|
||||
set_moodle_cookie($USER->username);
|
||||
|
||||
// Don't show username on login page
|
||||
set_moodle_cookie('nobody');
|
||||
|
||||
set_login_session_preferences();
|
||||
|
||||
unset($SESSION->lang);
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
#
|
||||
# Table structure for table `prefix_backup_files`
|
||||
#
|
||||
|
||||
CREATE TABLE `prefix_backup_files` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`backup_code` int(10) unsigned NOT NULL default '0',
|
||||
`file_type` varchar(10) NOT NULL default '',
|
||||
`path` varchar(255) NOT NULL default '',
|
||||
`old_id` int(10) unsigned NOT NULL default '0',
|
||||
`new_id` int(10) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `backup_files_uk` (`backup_code`,`file_type`,`path`)
|
||||
) TYPE=MyISAM COMMENT='To store and recode ids to user and course files.';
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `prefix_backup_ids`
|
||||
#
|
||||
|
||||
CREATE TABLE `prefix_backup_ids` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`backup_code` int(12) unsigned NOT NULL default '0',
|
||||
`table_name` varchar(30) NOT NULL default '',
|
||||
`old_id` int(10) unsigned NOT NULL default '0',
|
||||
`new_id` int(10) unsigned NOT NULL default '0',
|
||||
`info` mediumtext NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `backup_ids_uk` (`backup_code` ,`table_name`,`old_id`)
|
||||
) TYPE=MyISAM COMMENT='To store and convert ids in backup/restore';
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `prefix_backup_config`
|
||||
#
|
||||
|
||||
CREATE TABLE `prefix_backup_config` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(255) NOT NULL default '',
|
||||
`value` varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `name` (`name`)
|
||||
) TYPE=MyISAM COMMENT='To store backup configuration variables';
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `prefix_backup_courses`
|
||||
#
|
||||
|
||||
CREATE TABLE `prefix_backup_courses` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`courseid` int(10) unsigned NOT NULL default '0',
|
||||
`laststarttime` int(10) unsigned NOT NULL default '0',
|
||||
`lastendtime` int(10) unsigned NOT NULL default '0',
|
||||
`laststatus` varchar(1) NOT NULL default '0',
|
||||
`nextstarttime` int(10) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `courseid` (`courseid`)
|
||||
) TYPE=MyISAM COMMENT='To store every course backup status';
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `prefix_backup_log`
|
||||
#
|
||||
|
||||
CREATE TABLE `prefix_backup_log` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`courseid` int(10) unsigned NOT NULL default '0',
|
||||
`time` int(10) unsigned NOT NULL default '0',
|
||||
`laststarttime` int(10) unsigned NOT NULL default '0',
|
||||
`info` varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (`id`)
|
||||
) TYPE=MyISAM COMMENT='To store every course backup log info';
|
||||
# --------------------------------------------------------
|
||||
@@ -1,67 +0,0 @@
|
||||
#
|
||||
# Table structure for table prefix_backup_files
|
||||
#
|
||||
|
||||
CREATE TABLE prefix_backup_files (
|
||||
id SERIAL PRIMARY KEY,
|
||||
backup_code integer NOT NULL default '0',
|
||||
file_type varchar(10) NOT NULL default '',
|
||||
path varchar(255) NOT NULL default '',
|
||||
old_id integer default NULL,
|
||||
new_id integer default NULL,
|
||||
CONSTRAINT prefix_backup_files_uk UNIQUE (backup_code, file_type, path)
|
||||
);
|
||||
|
||||
|
||||
#
|
||||
# Table structure for table prefix_backup_ids
|
||||
#
|
||||
|
||||
CREATE TABLE prefix_backup_ids (
|
||||
id SERIAL PRIMARY KEY,
|
||||
backup_code integer NOT NULL default '0',
|
||||
table_name varchar(30) NOT NULL default '',
|
||||
old_id integer NOT NULL default '0',
|
||||
new_id integer default NULL,
|
||||
info text,
|
||||
CONSTRAINT prefix_backup_ids_uk UNIQUE (backup_code, table_name, old_id)
|
||||
);
|
||||
|
||||
|
||||
#
|
||||
# Table structure for table prefix_backup_config
|
||||
#
|
||||
|
||||
CREATE TABLE prefix_backup_config (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name varchar(255) UNIQUE NOT NULL default '',
|
||||
value varchar(255) NOT NULL default ''
|
||||
);
|
||||
|
||||
|
||||
#
|
||||
# Table structure for table prefix_backup_courses
|
||||
#
|
||||
|
||||
CREATE TABLE prefix_backup_courses (
|
||||
id SERIAL PRIMARY KEY,
|
||||
courseid integer UNIQUE NOT NULL default '0',
|
||||
laststarttime integer NOT NULL default '0',
|
||||
lastendtime integer NOT NULL default '0',
|
||||
laststatus varchar(1) NOT NULL default '0',
|
||||
nextstarttime integer NOT NULL default '0'
|
||||
);
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Table structure for table prefix_backup_log
|
||||
#
|
||||
|
||||
CREATE TABLE prefix_backup_log (
|
||||
id SERIAL PRIMARY KEY,
|
||||
courseid integer NOT NULL default '0',
|
||||
time integer NOT NULL default '0',
|
||||
laststarttime integer NOT NULL default '0',
|
||||
info varchar(255) NOT NULL default ''
|
||||
);
|
||||
+25
-8
@@ -70,6 +70,8 @@
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo "<ul>";
|
||||
}
|
||||
|
||||
// Restore links in modules.
|
||||
foreach ($restore->mods as $name => $info) {
|
||||
//If the module is being restored
|
||||
if (isset($info->restore) && $info->restore == 1) {
|
||||
@@ -87,12 +89,23 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: process all html text also in blocks too
|
||||
|
||||
// Restore links in questions.
|
||||
require_once("$CFG->dirroot/question/restorelib.php");
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '<li>' . get_string('from') . ' ' . get_string('questions', 'quiz');
|
||||
}
|
||||
$status = question_decode_content_links_caller($restore);
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo '</li>';
|
||||
}
|
||||
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo "</ul>";
|
||||
}
|
||||
|
||||
// TODO: process all html text also in blocks too
|
||||
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
@@ -2448,9 +2461,10 @@
|
||||
$eve->visible = backup_todb($info['EVENT']['#']['VISIBLE']['0']['#']);
|
||||
$eve->timemodified = backup_todb($info['EVENT']['#']['TIMEMODIFIED']['0']['#']);
|
||||
|
||||
//Now search if that event exists (by description and timestart field) in
|
||||
//restore->course_id course
|
||||
$eve_db = get_record("event","courseid",$eve->courseid,"description",$eve->description,"timestart",$eve->timestart);
|
||||
//Now search if that event exists (by name, description, timestart fields) in
|
||||
//restore->course_id course
|
||||
$eve_db = get_record_select("event",
|
||||
"courseid={$eve->courseid} AND name='{$eve->name}' AND description='{$eve->description}' AND timestart=$eve->timestart");
|
||||
//If it doesn't exist, create
|
||||
if (!$eve_db) {
|
||||
$create_event = true;
|
||||
@@ -4684,6 +4698,9 @@
|
||||
case "TRACKFORUMS":
|
||||
$this->info->tempuser->trackforums = $this->getContents();
|
||||
break;
|
||||
case "MNETHOSTURL":
|
||||
$this->info->tempuser->mnethosturl = $this->getContents();
|
||||
break;
|
||||
case "TIMEMODIFIED":
|
||||
$this->info->tempuser->timemodified = $this->getContents();
|
||||
break;
|
||||
@@ -6241,9 +6258,9 @@
|
||||
}
|
||||
if (!$status = restore_decode_content_links($restore)) {
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
notify("Could not refresh events for activities!");
|
||||
notify("Could not decode content links!");
|
||||
} else {
|
||||
$errorstr = "Could not refresh events for activities!";
|
||||
$errorstr = "Could not decode content links!";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,6 +7,6 @@
|
||||
/// be performed (see db/backup_*.php)
|
||||
|
||||
$backup_version = 2007022100; // The current version is a date (YYYYMMDDXX)
|
||||
$backup_release = "1.8Beta"; // User-friendly version number
|
||||
$backup_release = "1.8+"; // User-friendly version number
|
||||
|
||||
?>
|
||||
|
||||
@@ -15,7 +15,7 @@ class block_admin_bookmarks extends block_base {
|
||||
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
return array('all' => true);
|
||||
} else {
|
||||
return array('all' => false);
|
||||
return array('site' => true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class block_admin_tree extends block_base {
|
||||
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
return array('site' => true, 'admin' => true);
|
||||
} else {
|
||||
return array('all' => false);
|
||||
return array('site' => true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ class block_blog_tags extends block_base {
|
||||
|
||||
case BLOG_GROUP_LEVEL:
|
||||
$filtertype = 'group';
|
||||
$filterselect = get_current_group($this->instance->pageid);
|
||||
$filterselect = get_and_set_current_group($COURSE, groupmode($COURSE));
|
||||
break;
|
||||
|
||||
case BLOG_COURSE_LEVEL:
|
||||
|
||||
@@ -13,30 +13,30 @@
|
||||
}
|
||||
?>
|
||||
|
||||
<table cellpadding="9" cellspacing="0">
|
||||
<table cellpadding="9" cellspacing="0" class="blockconfigtable">
|
||||
|
||||
<tr valign=top>
|
||||
<td align=right><?php print_string("blocktitle","blog") ?>:</td>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string("blocktitle","blog") ?>:</td>
|
||||
<td><input type="text" name="title" size="50" value="<?php p($this->config->title) ?>" /></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=top>
|
||||
<td align=right><?php print_string("numberoftags","blog") ?>:</td>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string("numberoftags","blog") ?>:</td>
|
||||
<td><?php choose_from_menu($numberoftags,"numberoftags",$this->config->numberoftags) ?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=top>
|
||||
<td align=right><?php print_string("timewithin","blog") ?>:</td>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string("timewithin","blog") ?>:</td>
|
||||
<td><?php choose_from_menu($timewithin,"timewithin",$this->config->timewithin) ?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=top>
|
||||
<td align=right><?php print_string("tagsort","blog") ?>:</td>
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string("tagsort","blog") ?>:</td>
|
||||
<td><?php choose_from_menu($sort,"sort",$this->config->sort) ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2" align="center"><input type="submit" value="<?php print_string("savechanges") ?>"></td>
|
||||
<td colspan="2" align="center"><input type="submit" value="<?php print_string("savechanges") ?>" /></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
@@ -20,7 +20,9 @@ class block_calendar_month extends block_base {
|
||||
if ($this->content !== NULL) {
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
// Initialize the session variables
|
||||
calendar_session_vars();
|
||||
|
||||
$this->content = new stdClass;
|
||||
$this->content->text = '';
|
||||
$this->content->footer = '';
|
||||
|
||||
@@ -16,7 +16,8 @@ class block_calendar_upcoming extends block_base {
|
||||
if ($this->content !== NULL) {
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
// Initialize the session variables
|
||||
calendar_session_vars();
|
||||
$this->content = new stdClass;
|
||||
$this->content->text = '';
|
||||
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
# $Id$
|
||||
#
|
||||
# Table structure for table `blocks`
|
||||
#
|
||||
|
||||
CREATE TABLE `prefix_block` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(40) NOT NULL default '',
|
||||
`version` int(10) NOT NULL default '0',
|
||||
`cron` int(10) unsigned NOT NULL default '0',
|
||||
`lastcron` int(10) unsigned NOT NULL default '0',
|
||||
`visible` tinyint(1) NOT NULL default '1',
|
||||
`multiple` tinyint(1) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
CREATE TABLE `prefix_block_instance` (
|
||||
`id` int(10) not null auto_increment,
|
||||
`blockid` int(10) not null default '0',
|
||||
`pageid` int(10) not null default '0',
|
||||
`pagetype` varchar(20) not null default '',
|
||||
`position` varchar(10) not null default '',
|
||||
`weight` tinyint(3) not null default '0',
|
||||
`visible` tinyint(1) not null default '0',
|
||||
`configdata` text not null default '',
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX pageid(`pageid`),
|
||||
INDEX pagetype(`pagetype`)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
CREATE TABLE `prefix_block_pinned` (
|
||||
`id` int(10) not null auto_increment,
|
||||
`blockid` int(10) not null default '0',
|
||||
`pagetype` varchar(20) not null default '',
|
||||
`position` varchar(10) not null default '',
|
||||
`weight` tinyint(3) not null default '0',
|
||||
`visible` tinyint(1) not null default '0',
|
||||
`configdata` text not null default '',
|
||||
PRIMARY KEY(`id`),
|
||||
INDEX pagetype(`pagetype`)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
|
||||
|
||||
# --------------------------------------------------------
|
||||
@@ -1,41 +0,0 @@
|
||||
# $Id$
|
||||
#
|
||||
# Table structure for table blocks
|
||||
#
|
||||
|
||||
CREATE TABLE prefix_block (
|
||||
id SERIAL8 PRIMARY KEY,
|
||||
name varchar(40) NOT NULL default '',
|
||||
version INT8 NOT NULL default '0',
|
||||
cron INT8 NOT NULL default '0',
|
||||
lastcron INT8 NOT NULL default '0',
|
||||
visible int NOT NULL default '1',
|
||||
multiple int NOT NULL default '0'
|
||||
) ;
|
||||
|
||||
CREATE TABLE prefix_block_instance (
|
||||
id SERIAL8 PRIMARY KEY,
|
||||
blockid INT8 not null default '0',
|
||||
pageid INT8 not null default '0',
|
||||
pagetype varchar(20) not null default '',
|
||||
position varchar(10) not null default '',
|
||||
weight int not null default '0',
|
||||
visible int not null default '0',
|
||||
configdata text not null default ''
|
||||
) ;
|
||||
CREATE INDEX prefix_block_instance_pageid_idx ON prefix_block_instance (pageid);
|
||||
CREATE INDEX prefix_block_instance_pagetype_idx ON prefix_block_instance (pagetype);
|
||||
|
||||
CREATE TABLE prefix_block_pinned (
|
||||
id SERIAL8 PRIMARY KEY,
|
||||
blockid INT8 NOT NULL default 0,
|
||||
pagetype varchar(20) NOT NULL default '',
|
||||
position varchar(10) NOT NULL default '',
|
||||
weight INT NOT NULL default 0,
|
||||
visible INT NOT NULL default 0,
|
||||
configdata text NOT NULL default 0
|
||||
) ;
|
||||
|
||||
CREATE INDEX prefix_block_pinned_pagetype_idx ON prefix_block_pinned (pagetype);
|
||||
|
||||
# --------------------------------------------------------
|
||||
@@ -27,6 +27,7 @@
|
||||
<td><?php
|
||||
choose_from_menu($type, "type", $this->config->type, "");
|
||||
helpbutton("",get_string("type","block_glossary_random"),"moodle",true,false,get_string("typehelp","block_glossary_random"));
|
||||
// helpbutton("type_help", get_string("type_help", "block_glossary_random"), "block/glossary_random");
|
||||
?></td>
|
||||
</tr>
|
||||
|
||||
|
||||
@@ -14,8 +14,9 @@
|
||||
.block_login .loginform .c1 {
|
||||
margin:0.3em 0.8em;
|
||||
text-align:right;
|
||||
display:block;
|
||||
}
|
||||
|
||||
.block_login .loginform div.btn {
|
||||
.block_login .loginform div.c1.btn {
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<table cellpadding="9" cellspacing="0">
|
||||
<table cellpadding="9" cellspacing="0" class="blockconfigtable">
|
||||
<tr valign="top">
|
||||
<td align="right"><?php print_string('configtitle', 'block_mentees'); ?>:</td>
|
||||
<td><input type="text" name="title" size="30" value="<?php echo isset($this->config->title)?p($this->config->title):''; ?>" /> (<?php print_string('leaveblanktohide', 'block_mentees'); ?>)</td>
|
||||
|
||||
@@ -14,7 +14,7 @@ class block_mnet_hosts extends block_list {
|
||||
if (has_capability('moodle/site:mnetlogintoremote', get_context_instance(CONTEXT_SYSTEM), NULL, false)) {
|
||||
return array('all' => true, 'mod' => false);
|
||||
} else {
|
||||
return array('all' => false);
|
||||
return array('site' => true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,50 +25,33 @@ class block_news_items extends block_base {
|
||||
if ($COURSE->newsitems) { // Create a nice listing of recent postings
|
||||
|
||||
require_once($CFG->dirroot.'/mod/forum/lib.php'); // We'll need this
|
||||
|
||||
|
||||
$text = '';
|
||||
|
||||
if (!$forum = forum_get_course_forum($COURSE->id, 'news')) {
|
||||
return $this->content;
|
||||
return '';
|
||||
}
|
||||
|
||||
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $COURSE->id)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
/// First work out whether we can post to this group and if so, include a link
|
||||
$groupmode = groupmode($COURSE, $cm);
|
||||
$currentgroup = get_and_set_current_group($COURSE, $groupmode);
|
||||
|
||||
|
||||
if (has_capability('moodle/site:accessallgroups', get_context_instance(CONTEXT_COURSE, $COURSE->id))) { /// Teachers can always post
|
||||
$visiblegroups = -1;
|
||||
|
||||
if (forum_user_can_post_discussion($forum, $currentgroup, $groupmode, $cm, $context)) {
|
||||
$text .= '<div class="newlink"><a href="'.$CFG->wwwroot.'/mod/forum/post.php?forum='.$forum->id.'">'.
|
||||
get_string('addanewtopic', 'forum').'</a>...</div>';
|
||||
|
||||
} else { /// Check the group situation
|
||||
$currentgroup = get_current_group($COURSE->id);
|
||||
|
||||
if (forum_user_can_post_discussion($forum, $currentgroup)) {
|
||||
$text .= '<div align="center" class="newlink"><a href="'.$CFG->wwwroot.'/mod/forum/post.php?forum='.$forum->id.'">'.
|
||||
get_string('addanewtopic', 'forum').'</a>...</div>';
|
||||
}
|
||||
|
||||
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $COURSE->id)) {
|
||||
$this->content->text = $text;
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
$groupmode = groupmode($COURSE, $cm);
|
||||
|
||||
/// Decides if current user is allowed to see ALL the current discussions or not
|
||||
|
||||
if (!$currentgroup and ($groupmode != SEPARATEGROUPS) ) {
|
||||
$visiblegroups = -1;
|
||||
} else {
|
||||
$visiblegroups = $currentgroup;
|
||||
}
|
||||
}
|
||||
|
||||
/// Get all the recent discussions we're allowed to see
|
||||
|
||||
if (! $discussions = forum_get_discussions($forum->id, 'p.modified DESC', 0, false,
|
||||
$visiblegroups, $COURSE->newsitems) ) {
|
||||
$currentgroup, $COURSE->newsitems) ) {
|
||||
$text .= '('.get_string('nonews', 'forum').')';
|
||||
$this->content->text = $text;
|
||||
return $this->content;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?PHP //$Id$
|
||||
<?php //$Id$
|
||||
|
||||
/**
|
||||
* This block needs to be reworked.
|
||||
@@ -32,7 +32,7 @@ class block_online_users extends block_base {
|
||||
if (isset($CFG->block_online_users_timetosee)) {
|
||||
$timetoshowusers = $CFG->block_online_users_timetosee * 60;
|
||||
}
|
||||
$timefrom = time()-$timetoshowusers;
|
||||
$timefrom = 100 * floor((time()-$timetoshowusers) / 100); // Round to nearest 100 seconds for better query cache
|
||||
|
||||
// Get context so we can check capabilities.
|
||||
$context = get_context_instance(CONTEXT_COURSE, $COURSE->id);
|
||||
@@ -43,7 +43,7 @@ class block_online_users extends block_base {
|
||||
&& !has_capability('moodle/site:accessallgroups', $context));
|
||||
|
||||
//Get the user current group
|
||||
$currentgroup = $isseparategroups ? get_current_group($COURSE->id) : NULL;
|
||||
$currentgroup = $isseparategroups ? get_and_set_current_group($COURSE, groupmode($COURSE)) : NULL;
|
||||
|
||||
$groupmembers = "";
|
||||
$groupselect = "";
|
||||
@@ -51,7 +51,7 @@ class block_online_users extends block_base {
|
||||
//Add this to the SQL to show only group users
|
||||
if ($currentgroup !== NULL) {
|
||||
$groupmembers = ', '.groups_members_from_sql(); //TODO: ", {$CFG->prefix}groups_members gm ";
|
||||
$groupselect .= groups_members_where_sql($currentgroup, 'u.id'); //" AND u.id = gm.userid AND gm.groupid = '$currentgroup'";
|
||||
$groupselect = ' AND '.groups_members_where_sql($currentgroup, 'u.id'); //" AND u.id = gm.userid AND gm.groupid = '$currentgroup'";
|
||||
}
|
||||
|
||||
if ($COURSE->id == SITEID) { // Site-level
|
||||
@@ -72,10 +72,32 @@ class block_online_users extends block_base {
|
||||
ul.userid = u.id
|
||||
$courseselect
|
||||
$timeselect
|
||||
$groupselect ";
|
||||
$groupselect
|
||||
GROUP BY u.id
|
||||
ORDER BY ul.timeaccess DESC";
|
||||
|
||||
if ($pusers = get_records_sql($SQL, 0, 20)) {
|
||||
|
||||
|
||||
$pcontext = get_related_contexts_string($context);
|
||||
|
||||
if ($pusers = get_records_sql($SQL, 0, 50)) { // We'll just take the most recent 50 maximum
|
||||
foreach ($pusers as $puser) {
|
||||
|
||||
// if current user can't view hidden role assignment in this context and
|
||||
// user has a hidden role assigned at this context or any parent contexts,
|
||||
// ignore this user
|
||||
|
||||
$SQL = "SELECT id,id FROM {$CFG->prefix}role_assignments
|
||||
WHERE userid = $puser->id
|
||||
AND contextid $pcontext
|
||||
AND hidden = 1";
|
||||
|
||||
if (!has_capability('moodle/role:viewhiddenassigns', $context) && record_exists_sql($SQL)) {
|
||||
// can't see this user as the current user has no capability
|
||||
// and this user has a hidden assignment at this context or higher
|
||||
continue;
|
||||
}
|
||||
|
||||
$puser->fullname = fullname($puser);
|
||||
$users[$puser->id] = $puser;
|
||||
}
|
||||
|
||||
@@ -273,8 +273,12 @@ if ($act == 'updfeed') {
|
||||
if (file_exists($CFG->dirroot .'/blog/lib.php')) {
|
||||
//Blog module is installed - provide "blog this" link
|
||||
print '<td align="right">'."\n";
|
||||
print '<img src="'. $CFG->pixpath .'/blog/blog.gif" alt="'. get_string('blogthis', 'blog').'" title="'. get_string('blogthis', 'blog') .'" border="0" align="middle" />'."\n";
|
||||
print '<a href="'. $CFG->wwwroot .'/blog/blogthis.php?userid='. $userid .'&act=use&item='. $y .'&rssid='. $rssid .'"><small><strong>'. get_string('blogthis', 'blog') .'</strong></small></a>'."\n";
|
||||
|
||||
/// MDL-9291, blog this feature needs further discussion/implementation
|
||||
/// temporarily disabling for now.
|
||||
|
||||
// print '<img src="'. $CFG->pixpath .'/blog/blog.gif" alt="'. get_string('blogthis', 'blog').'" title="'. get_string('blogthis', 'blog') .'" border="0" align="middle" />'."\n";
|
||||
//print '<a href="'. $CFG->wwwroot .'/blog/blogthis.php?userid='. $USER->id .'&act=use&item='. $y .'&rssid='. $rssid .'"><small><strong>'. get_string('blogthis', 'blog') .'</strong></small></a>'."\n";
|
||||
} else {
|
||||
print '<td> ';
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
# $Id$
|
||||
# This file contains a complete database schema for all the
|
||||
# tables used by this module, written in SQL
|
||||
|
||||
# It may also contain INSERT statements for particular data
|
||||
# that may be used, especially new entries in the table log_display
|
||||
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `prefix_block_rss_client`
|
||||
#
|
||||
|
||||
CREATE TABLE prefix_block_rss_client (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`userid` int(11) NOT NULL default '0',
|
||||
`title` text NOT NULL default '',
|
||||
`preferredtitle` varchar(64) NOT NULL default '',
|
||||
`description` text NOT NULL default '',
|
||||
`shared` int(2) NOT NULL default '0',
|
||||
`url` varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (`id`)
|
||||
) TYPE=MyISAM COMMENT='Remote news feed information. Contains the news feed id, the userid of the user who added the feed, the title of the feed itself and a description of the feed contents along with the url used to access the remote feed. Preferredtitle is a field for future use - intended to allow for custom titles rather than those found in the feed.';
|
||||
@@ -1,20 +0,0 @@
|
||||
# $Id$
|
||||
# This file contains a complete database schema for all the
|
||||
# tables used by this module, written in SQL
|
||||
|
||||
# It may also contain INSERT statements for particular data
|
||||
# that may be used, especially new entries in the table log_display
|
||||
|
||||
#
|
||||
# Table structure for table `block_rss_client`
|
||||
#
|
||||
|
||||
CREATE TABLE prefix_block_rss_client (
|
||||
id SERIAL PRIMARY KEY,
|
||||
userid INTEGER NOT NULL default '0',
|
||||
title text NOT NULL default '',
|
||||
preferredtitle varchar(64) NOT NULL default '',
|
||||
description text NOT NULL default '',
|
||||
shared INTEGER NOT NULL default '0',
|
||||
url varchar(255) NOT NULL default ''
|
||||
);
|
||||
@@ -1,6 +1,6 @@
|
||||
<div style="text-align:center;">
|
||||
<label for="block_search_text">Search label</label>
|
||||
<input type="text" name="block_search_text" value="<?php
|
||||
<input id="block_search_text" type="text" name="block_search_text" value="<?php
|
||||
if(isset($CFG->block_search_text)) {
|
||||
p($CFG->block_search_text);
|
||||
} else {
|
||||
@@ -8,7 +8,7 @@
|
||||
} ?>"/><br/>
|
||||
|
||||
<label for="block_search_button">Button label</label>
|
||||
<input type="text" name="block_search_button" value="<?php
|
||||
<input id="block_search_button" type="text" name="block_search_button" value="<?php
|
||||
if(isset($CFG->block_search_button)) {
|
||||
p($CFG->block_search_button);
|
||||
} else {
|
||||
@@ -16,4 +16,4 @@
|
||||
} ?>"/><br/><br/>
|
||||
|
||||
<input type="submit" value="<?php print_string('savechanges'); ?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -29,8 +29,7 @@ class block_search_forums extends block_base {
|
||||
$search = get_string('search');
|
||||
|
||||
//Accessibility: replaced <input value=" />" type="submit"> with configurable text/'silent' character.
|
||||
check_theme_arrows();
|
||||
// Theme config, $CFG->block_search_button = $THEME->rarrow .'<span class="accesshide">'.get_string('search').'</span>';
|
||||
// Theme config, $CFG->block_search_button = link_arrow_right(get_string('search'), $url='', $accesshide=true);
|
||||
$button = (isset($CFG->block_search_button)) ? $CFG->block_search_button : get_string('go');
|
||||
|
||||
$this->content->text = '<div class="searchform">';
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user