From a685593466fa051f4892fc0e3fab75cf283eecbc Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Sat, 16 Jan 2010 15:39:56 +0000 Subject: [PATCH] MDL-21233 moodle_url improvemewnts, code simplification, more diagnostics; fixed several regressions --- admin/dbperformance.php | 4 +- admin/generator.php | 2 +- admin/index.php | 2 +- admin/mnet/access_control.php | 2 +- admin/mnet/delete.php | 6 +- admin/mnet/mnet_review.html | 2 +- admin/mnet/mnet_review_allhosts.html | 2 +- admin/mnet/mnet_services.html | 2 +- admin/mnet/mnet_themes.html | 2 +- admin/report/courseoverview/reportsgraph.php | 2 +- admin/roles/assign.php | 4 +- admin/roles/check.php | 4 +- admin/roles/explain.php | 2 +- admin/roles/override.php | 4 +- admin/roles/tabs.php | 6 +- admin/roles/usersroles.php | 2 +- admin/settings.php | 2 +- admin/timezone.php | 2 +- admin/webservice/protocols.php | 2 +- admin/webservice/service.php | 8 +- admin/webservice/service_functions.php | 2 +- admin/webservice/service_users.php | 2 +- admin/webservice/tokens.php | 2 +- auth/ldap/ntlmsso_attempt.php | 2 +- auth/ldap/ntlmsso_finish.php | 2 +- auth/mnet/jump.php | 2 +- auth/mnet/land.php | 2 +- auth/shibboleth/index.php | 2 +- auth/shibboleth/login.php | 2 +- backup/backup.php | 10 +- backup/restore.php | 8 +- blocks/blog_menu/block_blog_menu.php | 4 +- blocks/blog_recent/block_blog_recent.php | 2 +- blocks/blog_tags/block_blog_tags.php | 2 +- .../block_global_navigation_tree.php | 2 +- blocks/rss_client/editfeed.php | 6 +- blocks/rss_client/managefeeds.php | 6 +- blocks/rss_client/viewfeed.php | 6 +- blog/edit.php | 4 +- blog/external_blog_edit.php | 6 +- blog/external_blogs.php | 10 +- blog/index.php | 2 +- blog/lib.php | 4 +- blog/locallib.php | 12 +- blog/preferences.php | 4 +- blog/simpletest/testbloglib.php | 2 +- calendar/delete.php | 4 +- calendar/event.php | 4 +- calendar/export.php | 4 +- calendar/index.php | 2 +- calendar/preferences.php | 6 +- calendar/set.php | 2 +- calendar/view.php | 2 +- course/category.php | 6 +- course/delete.php | 8 +- course/edit.php | 6 +- course/editcategory.php | 8 +- course/editsection.php | 2 +- course/enrol.php | 2 +- course/import.php | 2 +- course/import/activities/index.php | 6 +- course/import/groups/index.php | 6 +- course/importstudents.php | 2 +- course/index.php | 2 +- course/info.php | 2 +- course/jumpto.php | 2 +- course/lib.php | 4 +- course/loginas.php | 2 +- course/mod.php | 2 +- course/modedit.php | 2 +- course/recent.php | 4 +- course/report.php | 2 +- course/report/log/graph.php | 2 +- course/report/log/index.php | 6 +- course/report/log/indexlive.php | 2 +- course/report/log/lib.php | 2 +- course/report/log/live.php | 2 +- course/report/outline/index.php | 4 +- course/report/outline/lib.php | 2 +- course/report/participation/index.php | 4 +- course/report/participation/lib.php | 2 +- course/report/progress/index.php | 4 +- course/report/progress/lib.php | 2 +- course/report/stats/graph.php | 2 +- course/report/stats/index.php | 2 +- course/report/stats/lib.php | 2 +- course/request.php | 2 +- course/reset.php | 2 +- course/resources.php | 2 +- course/rest.php | 2 +- course/scales.php | 2 +- course/search.php | 10 +- course/switchrole.php | 2 +- course/togglecompletion.php | 2 +- course/unenrol.php | 2 +- course/user.php | 4 +- course/view.php | 4 +- enrol/authorize/enrol.php | 2 +- enrol/authorize/index.php | 2 +- enrol/authorize/locallib.php | 4 +- enrol/authorize/uploadcsv.php | 2 +- enrol/imsenterprise/importnow.php | 4 +- enrol/paypal/enrol.php | 2 +- error/index.php | 2 +- files/index.php | 2 +- grade/edit/letter/edit.php | 2 +- grade/edit/letter/index.php | 2 +- grade/edit/outcome/course.php | 2 +- grade/edit/outcome/edit.php | 2 +- grade/edit/outcome/import.php | 6 +- grade/edit/outcome/index.php | 4 +- grade/edit/scale/edit.php | 2 +- grade/edit/scale/index.php | 2 +- grade/edit/settings/index.php | 2 +- grade/edit/tree/action.php | 2 +- grade/edit/tree/calculation.php | 2 +- grade/edit/tree/category.php | 2 +- grade/edit/tree/grade.php | 2 +- grade/edit/tree/index.php | 2 +- grade/edit/tree/item.php | 2 +- grade/edit/tree/outcomeitem.php | 2 +- grade/export/key.php | 6 +- grade/export/keymanager.php | 2 +- grade/export/lib.php | 2 +- grade/export/ods/index.php | 2 +- grade/export/txt/index.php | 2 +- grade/export/xls/index.php | 2 +- grade/export/xml/index.php | 2 +- grade/import/csv/index.php | 2 +- grade/import/key.php | 6 +- grade/import/keymanager.php | 2 +- grade/import/xml/import.php | 2 +- grade/import/xml/index.php | 2 +- grade/lib.php | 22 +-- grade/report/grader/index.php | 2 +- grade/report/grader/lib.php | 6 +- grade/report/grader/preferences.php | 2 +- grade/report/grader/quickedit_item.php | 2 +- grade/report/index.php | 2 +- grade/report/outcomes/index.php | 2 +- grade/report/overview/index.php | 2 +- grade/report/user/index.php | 2 +- group/assign.php | 6 +- group/autogroup.php | 4 +- group/delete.php | 2 +- group/group.php | 8 +- group/grouping.php | 6 +- group/groupings.php | 4 +- group/index.php | 4 +- group/members.php | 6 +- group/overview.php | 4 +- help.php | 4 +- index.php | 2 +- iplookup/index.php | 2 +- lib/adminlib.php | 3 +- lib/ajax/ajaxlib.php | 2 +- lib/ajax/simpletest/testajaxlib.php | 8 +- lib/deprecatedlib.php | 6 +- lib/form/editorhelp.php | 2 +- lib/listlib.php | 4 +- lib/navigationlib.php | 144 +++++++++--------- lib/outputcomponents.php | 2 +- lib/outputrenderers.php | 16 +- lib/pagelib.php | 27 ++-- lib/session-test.php | 2 +- .../filtersettingsperformancetester.php | 2 +- lib/simpletest/getstringperformancetester.php | 2 +- lib/simpletest/pdflibtestpage.php | 2 +- lib/simpletest/testdeprecatedlib.php | 2 +- lib/simpletest/testoutputlib.php | 9 +- lib/simpletest/testpagelib_moodlepage.php | 4 +- lib/simpletest/todochecker.php | 2 +- lib/weblib.php | 117 +++++++++----- lib/womenslib.php | 2 +- login/change_password.php | 6 +- login/confirm.php | 2 +- login/forgot_password.php | 2 +- login/logout.php | 2 +- login/mnet_email.php | 2 +- login/signup.php | 2 +- message/discussion.php | 2 +- message/edit.php | 6 +- message/history.php | 2 +- message/index.php | 2 +- message/messages.php | 2 +- message/refresh.php | 2 +- message/send.php | 4 +- message/user.php | 2 +- mod/assignment/delete.php | 2 +- mod/assignment/grade.php | 2 +- mod/assignment/index.php | 2 +- mod/assignment/lib.php | 2 +- mod/assignment/submissions.php | 2 +- mod/assignment/type/online/all.php | 4 +- .../type/online/assignment.class.php | 4 +- mod/assignment/type/online/file.php | 2 +- .../type/upload/assignment.class.php | 4 +- mod/assignment/type/upload/notes.php | 2 +- .../type/uploadsingle/assignment.class.php | 2 +- mod/assignment/upload.php | 2 +- mod/assignment/view.php | 2 +- mod/chat/chat_ajax.php | 2 +- mod/chat/gui_ajax/index.php | 2 +- mod/chat/gui_basic/index.php | 2 +- mod/chat/gui_header_js/chatinput.php | 2 +- mod/chat/gui_header_js/index.php | 2 +- mod/chat/gui_header_js/insert.php | 2 +- mod/chat/gui_header_js/jsupdate.php | 2 +- mod/chat/gui_header_js/jsupdated.php | 2 +- mod/chat/gui_header_js/users.php | 2 +- mod/chat/gui_sockets/chatinput.php | 2 +- mod/chat/gui_sockets/index.php | 2 +- mod/chat/index.php | 2 +- mod/chat/lib.php | 8 +- mod/chat/report.php | 2 +- mod/chat/view.php | 2 +- mod/choice/index.php | 2 +- mod/choice/lib.php | 4 +- mod/choice/report.php | 2 +- mod/choice/view.php | 4 +- mod/data/css.php | 2 +- mod/data/edit.php | 2 +- mod/data/export.php | 2 +- mod/data/field.php | 2 +- mod/data/field/latlong/kml.php | 2 +- mod/data/import.php | 2 +- mod/data/index.php | 4 +- mod/data/js.php | 2 +- mod/data/lib.php | 20 +-- mod/data/preset.php | 2 +- mod/data/rate.php | 2 +- mod/data/report.php | 2 +- mod/data/templates.php | 2 +- mod/data/view.php | 2 +- mod/feedback/analysis.php | 2 +- mod/feedback/analysis_course.php | 4 +- mod/feedback/analysis_to_excel.php | 2 +- mod/feedback/complete.php | 4 +- mod/feedback/complete_guest.php | 6 +- mod/feedback/delete_completed.php | 4 +- mod/feedback/delete_item.php | 4 +- mod/feedback/delete_template.php | 8 +- mod/feedback/edit.php | 32 ++-- mod/feedback/edit_item.php | 6 +- mod/feedback/export.php | 2 +- mod/feedback/import.php | 4 +- mod/feedback/index.php | 4 +- mod/feedback/item/captcha/print_captcha.php | 2 +- mod/feedback/lib.php | 16 +- mod/feedback/mapcourse.php | 4 +- mod/feedback/print.php | 4 +- mod/feedback/show_entries.php | 4 +- mod/feedback/show_entries_anonym.php | 4 +- mod/feedback/unmapcourse.php | 2 +- mod/feedback/use_templ.php | 4 +- mod/feedback/view.php | 2 +- mod/folder/index.php | 2 +- mod/folder/lib.php | 2 +- mod/folder/view.php | 2 +- mod/forum/discuss.php | 4 +- mod/forum/index.php | 6 +- mod/forum/lib.php | 20 +-- mod/forum/markposts.php | 2 +- mod/forum/post.php | 2 +- mod/forum/rate.php | 2 +- mod/forum/rate_ajax.php | 2 +- mod/forum/report.php | 2 +- mod/forum/search.php | 4 +- mod/forum/settracking.php | 2 +- mod/forum/subscribe.php | 12 +- mod/forum/subscribers.php | 2 +- mod/forum/unsubscribeall.php | 2 +- mod/forum/user.php | 4 +- mod/forum/view.php | 2 +- mod/glossary/approve.php | 2 +- mod/glossary/deleteentry.php | 2 +- mod/glossary/edit.php | 2 +- mod/glossary/editcategories.php | 6 +- mod/glossary/export.php | 4 +- mod/glossary/exportentry.php | 2 +- mod/glossary/exportfile.php | 2 +- mod/glossary/formats.php | 2 +- mod/glossary/import.php | 4 +- mod/glossary/index.php | 2 +- mod/glossary/lib.php | 18 +-- mod/glossary/print.php | 2 +- mod/glossary/rate.php | 2 +- mod/glossary/report.php | 2 +- mod/glossary/showentry.php | 2 +- mod/glossary/view.php | 2 +- mod/hotpot/attempt.php | 2 +- mod/hotpot/grade.php | 2 +- mod/hotpot/index.php | 8 +- mod/hotpot/lib.php | 2 +- mod/hotpot/report.php | 4 +- mod/hotpot/review.php | 4 +- mod/hotpot/show.php | 2 +- mod/hotpot/view.php | 4 +- mod/imscp/index.php | 2 +- mod/imscp/view.php | 2 +- mod/label/index.php | 2 +- mod/label/view.php | 4 +- mod/lesson/continue.php | 10 +- mod/lesson/edit.php | 2 +- mod/lesson/editpage.php | 6 +- mod/lesson/essay.php | 12 +- mod/lesson/grade.php | 2 +- mod/lesson/highscores.php | 8 +- mod/lesson/import.php | 2 +- mod/lesson/importppt.php | 2 +- mod/lesson/index.php | 2 +- mod/lesson/lesson.php | 2 +- mod/lesson/lib.php | 16 +- mod/lesson/locallib.php | 2 +- mod/lesson/mediafile.php | 2 +- mod/lesson/pagetypes/branchtable.php | 6 +- mod/lesson/pagetypes/cluster.php | 2 +- mod/lesson/pagetypes/endofbranch.php | 4 +- mod/lesson/pagetypes/endofcluster.php | 4 +- mod/lesson/pagetypes/essay.php | 2 +- mod/lesson/pagetypes/matching.php | 2 +- mod/lesson/pagetypes/multichoice.php | 2 +- mod/lesson/renderer.php | 24 +-- mod/lesson/report.php | 6 +- mod/lesson/view.php | 26 ++-- mod/page/index.php | 2 +- mod/page/lib.php | 2 +- mod/page/view.php | 2 +- mod/quiz/addrandom.php | 2 +- mod/quiz/attempt.php | 2 +- mod/quiz/comment.php | 2 +- mod/quiz/edit.php | 2 +- mod/quiz/index.php | 2 +- mod/quiz/lib.php | 12 +- mod/quiz/report.php | 2 +- mod/quiz/report/grading/report.php | 2 +- mod/quiz/report/overview/report.php | 3 +- mod/quiz/report/responses/report.php | 2 +- mod/quiz/report/statistics/report.php | 2 +- mod/quiz/review.php | 2 +- mod/quiz/reviewquestion.php | 2 +- mod/quiz/summary.php | 2 +- mod/quiz/view.php | 2 +- mod/resource/index.php | 2 +- mod/resource/view.php | 2 +- mod/scorm/aicc.php | 2 +- mod/scorm/datamodel.php | 2 +- mod/scorm/index.php | 2 +- mod/scorm/lib.php | 2 +- mod/scorm/loadSCO.php | 2 +- mod/scorm/loaddatamodel.php | 2 +- mod/scorm/player.php | 6 +- mod/scorm/report.php | 6 +- mod/scorm/view.php | 2 +- mod/survey/download.php | 2 +- mod/survey/graph.php | 2 +- mod/survey/index.php | 2 +- mod/survey/lib.php | 12 +- mod/survey/report.php | 2 +- mod/survey/save.php | 2 +- mod/survey/view.php | 2 +- mod/url/index.php | 2 +- mod/url/lib.php | 2 +- mod/url/view.php | 2 +- mod/wiki/admin.php | 2 +- mod/wiki/confirmlock.php | 2 +- mod/wiki/index.php | 2 +- mod/wiki/overridelock.php | 2 +- mod/wiki/view.php | 2 +- mod/workshop/aggregate.php | 2 +- mod/workshop/allocation.php | 2 +- mod/workshop/excompare.php | 2 +- mod/workshop/exsubmission.php | 2 +- mod/workshop/index.php | 4 +- mod/workshop/lib.php | 8 +- mod/workshop/locallib.php | 26 ++-- mod/workshop/renderer.php | 14 +- mod/workshop/submission.php | 2 +- mod/workshop/switchphase.php | 2 +- mod/workshop/view.php | 4 +- my/index.php | 2 +- notes/delete.php | 8 +- notes/edit.php | 8 +- notes/index.php | 4 +- portfolio/add.php | 6 +- question/addquestion.php | 2 +- question/category.php | 2 +- question/contextmoveq.php | 2 +- question/edit.php | 2 +- question/editlib.php | 10 +- question/preview.php | 4 +- question/question.php | 8 +- repository/manage_instances.php | 4 +- search/indexersplash.php | 6 +- search/query.php | 6 +- search/stats.php | 6 +- sso/hive/expired.php | 2 +- tag/coursetags_edit.php | 2 +- tag/coursetags_more.php | 4 +- tag/edit.php | 4 +- tag/index.php | 8 +- tag/manage.php | 4 +- tag/search.php | 4 +- user/action_redir.php | 2 +- user/addnote.php | 2 +- user/edit.php | 2 +- user/editadvanced.php | 6 +- user/emailupdate.php | 2 +- user/extendenrol.php | 2 +- user/groupaddnote.php | 2 +- user/groupextendenrol.php | 2 +- user/index.php | 20 +-- user/managetoken.php | 4 +- user/messageselect.php | 4 +- user/policy.php | 2 +- user/portfolio.php | 2 +- user/portfoliologs.php | 4 +- user/repository.php | 4 +- user/selector/search.php | 2 +- user/view.php | 4 +- userpix/index.php | 2 +- userpix/upgrade.php | 2 +- webservice/renderer.php | 4 +- webservice/testclient.php | 2 +- 424 files changed, 950 insertions(+), 901 deletions(-) diff --git a/admin/dbperformance.php b/admin/dbperformance.php index fb32a6557d263..d48b29a56de62 100644 --- a/admin/dbperformance.php +++ b/admin/dbperformance.php @@ -22,8 +22,8 @@ $site = get_site(); if (!empty($topframe)) { - $PAGE->set_url(new moodle_url($CFG->wwwroot.'/admin/dbperformance.php')); - $PAGE->navbar->add($stradministration, new moodle_url($CFG->wwwroot.'/admin/index.php')); + $PAGE->set_url('/admin/dbperformance.php'); + $PAGE->navbar->add($stradministration, new moodle_url('/admin/index.php')); $PAGE->navbar->add($strdatabaseperformance); $PAGE->set_title("$site->shortname: $strdatabaseperformance"); $PAGE->set_heading($site->fullname); diff --git a/admin/generator.php b/admin/generator.php index 931868b48ebaa..499afa3f2224d 100755 --- a/admin/generator.php +++ b/admin/generator.php @@ -1333,7 +1333,7 @@ function definition_after_data() { $systemcontext = get_context_instance(CONTEXT_SYSTEM); require_capability('moodle/site:config', $systemcontext); - $PAGE->set_url($CFG->wwwroot.'/admin/generator.php'); + $PAGE->set_url('/admin/generator.php'); $PAGE->set_pagelayout('base'); $generator = new generator_web(); $generator->setup(); diff --git a/admin/index.php b/admin/index.php index 8d2e0d30ea9bf..f4728c7f98eea 100644 --- a/admin/index.php +++ b/admin/index.php @@ -54,7 +54,7 @@ // Check some PHP server settings -$PAGE->set_url($CFG->admin . '/index.php'); +$PAGE->set_url('/admin/index.php'); $documentationlink = 'Installation docs'; diff --git a/admin/mnet/access_control.php b/admin/mnet/access_control.php index 6008680d0ddb1..17a769f1da0dd 100644 --- a/admin/mnet/access_control.php +++ b/admin/mnet/access_control.php @@ -186,7 +186,7 @@ if (!empty($table)) { echo $OUTPUT->table($table); echo '

 

'; - $baseurl = new moodle_url(null, array('sort' => $sort, 'dir' => $dir, 'perpage' => $perpage)); + $baseurl = new moodle_url('/admin/mnet/access_control.php', array('sort' => $sort, 'dir' => $dir, 'perpage' => $perpage)); $pagingbar = moodle_paging_bar::make($aclcount, $page, $perpage, $baseurl); echo $OUTPUT->paging_bar($pagingbar); } diff --git a/admin/mnet/delete.php b/admin/mnet/delete.php index c9333873ff580..9704a7c5e394c 100644 --- a/admin/mnet/delete.php +++ b/admin/mnet/delete.php @@ -38,9 +38,9 @@ if ($live_users > 0) { $warn[] = get_string('usersareonline', 'mnet', $live_users); } - $PAGE->set_url(new moodle_url($CFG->wwwroot.'/admin/mnet/delete.php')); - $PAGE->navbar->add($stradministration, new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/index.php')); - $PAGE->navbar->add(get_string('mnetsettings', 'mnet'), new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/mnet/index.php')); + $PAGE->set_url('/admin/mnet/delete.php'); + $PAGE->navbar->add($stradministration, new moodle_url('/admin/index.php')); + $PAGE->navbar->add(get_string('mnetsettings', 'mnet'), new moodle_url('/admin/mnet/index.php')); $PAGE->navbar->add(get_string('deletehost', 'mnet')); $PAGE->set_title("$site->shortname: $strmnetsettings"); diff --git a/admin/mnet/mnet_review.html b/admin/mnet/mnet_review.html index 0ca46e3c0a41b..d4915d75266fc 100644 --- a/admin/mnet/mnet_review.html +++ b/admin/mnet/mnet_review.html @@ -3,7 +3,7 @@ admin_externalpage_print_header(); $currenttab = 'mnetdetails'; -require_once($CFG->dirroot .'/admin/mnet/tabs.php'); +require_once($CFG->dirroot .'/'.$CFG->admin.'/mnet/tabs.php'); echo $OUTPUT->box_start(); ?> diff --git a/admin/mnet/mnet_review_allhosts.html b/admin/mnet/mnet_review_allhosts.html index 74e5eb393c8d8..85fd7f08fd6d4 100644 --- a/admin/mnet/mnet_review_allhosts.html +++ b/admin/mnet/mnet_review_allhosts.html @@ -1,7 +1,7 @@ dirroot .'/admin/mnet/tabs.php'); +require_once($CFG->dirroot .'/'.$CFG->admin.'/mnet/tabs.php'); echo $OUTPUT->box_start(); ?> diff --git a/admin/mnet/mnet_services.html b/admin/mnet/mnet_services.html index b91ed36a71650..7df1593baa77d 100644 --- a/admin/mnet/mnet_services.html +++ b/admin/mnet/mnet_services.html @@ -2,7 +2,7 @@ admin_externalpage_print_header(); $currenttab = 'mnetservices'; -require_once($CFG->dirroot .'/admin/mnet/tabs.php'); +require_once($CFG->dirroot .'/'.$CFG->admin.'/mnet/tabs.php'); echo $OUTPUT->box_start(); ?> diff --git a/admin/mnet/mnet_themes.html b/admin/mnet/mnet_themes.html index d105458a2af5f..64ecee5b24e73 100644 --- a/admin/mnet/mnet_themes.html +++ b/admin/mnet/mnet_themes.html @@ -6,7 +6,7 @@ echo $OUTPUT->heading(get_string('themes')); $original_theme = fullclone($THEME); $currenttab = 'mnetthemes'; - require_once($CFG->dirroot .'/admin/mnet/tabs.php'); + require_once($CFG->dirroot .'/'.$CFG->admin.'/mnet/tabs.php'); $themes = get_list_of_plugins("theme"); $sesskey = sesskey(); diff --git a/admin/report/courseoverview/reportsgraph.php b/admin/report/courseoverview/reportsgraph.php index 7a148d7cd3ef5..471ffc0d9ab1b 100644 --- a/admin/report/courseoverview/reportsgraph.php +++ b/admin/report/courseoverview/reportsgraph.php @@ -30,7 +30,7 @@ $courses = $DB->get_records_sql($sql, $param->$params, 0, $numcourses); if (empty($courses)) { - $PAGE->set_url(new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/report/courseoverview/index.php')); + $PAGE->set_url('/admin/report/courseoverview/index.php'); print_error('statsnodata', 'error', $PAGE->url->out()); } diff --git a/admin/roles/assign.php b/admin/roles/assign.php index 33e65f7f85b86..b3e11a9af6265 100755 --- a/admin/roles/assign.php +++ b/admin/roles/assign.php @@ -54,7 +54,7 @@ if ($returnurl) { $urlparams['returnurl'] = $returnurl; } - $PAGE->set_url($CFG->admin . '/roles/assign.php', $urlparams); + $PAGE->set_url('/admin/roles/assign.php', $urlparams); $baseurl = $PAGE->url->out(); if (! $context = get_context_instance_by_id($contextid)) { @@ -266,7 +266,7 @@ $PAGE->set_title($title); if ($courseid != SITEID) { if (has_capability('moodle/course:viewparticipants', get_context_instance(CONTEXT_COURSE, $courseid))) { - $PAGE->navbar->add(get_string('participants'), new moodle_url($CFG->wwwroot.'/user/index.php', array('id'=>$courseid))); + $PAGE->navbar->add(get_string('participants'), new moodle_url('/user/index.php', array('id'=>$courseid))); } $PAGE->set_heading($fullname); } else { diff --git a/admin/roles/check.php b/admin/roles/check.php index 34a0849e4accd..89ae5ae6c20dd 100755 --- a/admin/roles/check.php +++ b/admin/roles/check.php @@ -48,7 +48,7 @@ if ($returnurl) { $urlparams['returnurl'] = $returnurl; } - $PAGE->set_url($CFG->admin . '/roles/check.php', $urlparams); + $PAGE->set_url('/admin/roles/check.php', $urlparams); if (! $context = get_context_instance_by_id($contextid)) { print_error('wrongcontextid', 'error'); @@ -108,7 +108,7 @@ $PAGE->set_title($title); if ($courseid != SITEID) { if (has_capability('moodle/course:viewparticipants', get_context_instance(CONTEXT_COURSE, $courseid))) { - $PAGE->navbar->add(get_string('participants'), new moodle_url($CFG->wwwroot.'/user/index.php', array('id'=>$courseid))); + $PAGE->navbar->add(get_string('participants'), new moodle_url('/user/index.php', array('id'=>$courseid))); } $PAGE->set_heading($fullname); } else { diff --git a/admin/roles/explain.php b/admin/roles/explain.php index edcf5c75b895f..15642ba743dd6 100755 --- a/admin/roles/explain.php +++ b/admin/roles/explain.php @@ -37,7 +37,7 @@ $contextid = required_param('contextid', PARAM_INTEGER); $capability = required_param('capability', PARAM_CAPABILITY); -$PAGE->set_url(new moodle_url($CFG->wwwroot.'/admin/roles/explain.php', array('user'=>$userid, 'contextid'=>$contextid, 'capability'=>$capability))); +$PAGE->set_url('/admin/roles/explain.php', array('user'=>$userid, 'contextid'=>$contextid, 'capability'=>$capability)); // Get the context and its parents. $context = get_context_instance_by_id($contextid); diff --git a/admin/roles/override.php b/admin/roles/override.php index 65612c238ad5b..90ed07b937fb0 100755 --- a/admin/roles/override.php +++ b/admin/roles/override.php @@ -50,7 +50,7 @@ if ($returnurl) { $urlparams['returnurl'] = $returnurl; } - $PAGE->set_url($CFG->admin . '/roles/override.php', $urlparams); + $PAGE->set_url('/admin/roles/override.php', $urlparams); $baseurl = $PAGE->url->out(); /// Validate the contextid parameter. @@ -151,7 +151,7 @@ $PAGE->set_title($title); if ($courseid != SITEID) { if (has_capability('moodle/course:viewparticipants', get_context_instance(CONTEXT_COURSE, $course->id))) { - $PAGE->navbar->add(get_string('participants'), new moodle_url($CFG->wwwroot.'/user/index.php', array('id'=>$course->id))); + $PAGE->navbar->add(get_string('participants'), new moodle_url('/user/index.php', array('id'=>$course->id))); } $PAGE->set_heading($fullname); } else { diff --git a/admin/roles/tabs.php b/admin/roles/tabs.php index d97d39a455ecb..3578b7b353ab3 100755 --- a/admin/roles/tabs.php +++ b/admin/roles/tabs.php @@ -52,7 +52,7 @@ if (empty($title)) { $title = $SITE->fullname; } - $PAGE->navbar->add($stradministration, new moodle_url($CFG->wwwroot.'/admin/'), navigation_node::TYPE_SETTING); + $PAGE->navbar->add($stradministration, new moodle_url('/admin/'), navigation_node::TYPE_SETTING); $PAGE->navbar->add($straction); $PAGE->set_title($title); $PAGE->set_heading($SITE->fullname); @@ -73,8 +73,8 @@ $title = "$SITE->shortname: $category->name"; } - $PAGE->navbar->add($strcategories, new moodle_url($CFG->wwwroot.'/course/index.php'), navigation_node::TYPE_SETTING); - $PAGE->navbar->add($category->name, new moodle_url($CFG->wwwroot.'/course/category.php', array('id'=>$category->id)), navigation_node::TYPE_SETTING); + $PAGE->navbar->add($strcategories, new moodle_url('/course/index.php'), navigation_node::TYPE_SETTING); + $PAGE->navbar->add($category->name, new moodle_url('/course/category.php', array('id'=>$category->id)), navigation_node::TYPE_SETTING); $PAGE->navbar->add(get_string("roles")); $PAGE->set_title($title); $PAGE->set_heading("$SITE->fullname: $strcourses"); diff --git a/admin/roles/usersroles.php b/admin/roles/usersroles.php index 0fddff7a90940..04c7d2280f354 100644 --- a/admin/roles/usersroles.php +++ b/admin/roles/usersroles.php @@ -126,7 +126,7 @@ if ($courseid != SITEID) { $PAGE->set_heading($fullname); if (has_capability('moodle/course:viewparticipants', $coursecontext)) { - $PAGE->navbar->add(get_string('participants'),new moodle_url($CFG->wwwroot.'/user/index.php', array('id'=>$courseid))); + $PAGE->navbar->add(get_string('participants'),new moodle_url('/user/index.php', array('id'=>$courseid))); } } else { $PAGE->set_heading($course->fullname); diff --git a/admin/settings.php b/admin/settings.php index c8a4bd6aea8a9..fa554812c4c8a 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -10,7 +10,7 @@ /// no guest autologin require_login(0, false); $PAGE->set_context(get_context_instance(CONTEXT_SYSTEM)); -$PAGE->set_url($CFG->admin . '/settings.php', array('section' => $section)); +$PAGE->set_url('/admin/settings.php', array('section' => $section)); $PAGE->set_pagetype('admin-setting-' . $section); $PAGE->set_pagelayout('admin'); $PAGE->navigation->clear_cache(); diff --git a/admin/timezone.php b/admin/timezone.php index 7068d57d3dd03..bff4d6b049a33 100644 --- a/admin/timezone.php +++ b/admin/timezone.php @@ -18,7 +18,7 @@ $strusers = get_string("users"); $strall = get_string("all"); - $PAGE->set_url(new moodle_url($CFG->wwwroot.'/admin/timezone.php')); + $PAGE->set_url('/admin/timezone.php'); $PAGE->set_title($strtimezone); $PAGE->set_heading($strtimezone); $PAGE->navbar->add($strtimezone); diff --git a/admin/webservice/protocols.php b/admin/webservice/protocols.php index 5f296b69e8e81..3d5ece12119e8 100644 --- a/admin/webservice/protocols.php +++ b/admin/webservice/protocols.php @@ -27,7 +27,7 @@ require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->libdir.'/tablelib.php'); -$PAGE->set_url('/admin/webservice/protocols.php', array()); +$PAGE->set_url('/admin/webservice/protocols.php'); //TODO: disable the blocks here or better make the page layout default to no blocks! require_login(); diff --git a/admin/webservice/service.php b/admin/webservice/service.php index 8abde5c75f00b..f0af359434121 100644 --- a/admin/webservice/service.php +++ b/admin/webservice/service.php @@ -31,7 +31,7 @@ $action = optional_param('action', '', PARAM_ACTION); $confirm = optional_param('confirm', 0, PARAM_BOOL); -$PAGE->set_url('admin/external_service.php', array('id'=>$id)); +$PAGE->set_url('/admin/external_service.php', array('id'=>$id)); admin_externalpage_setup('externalservice'); @@ -57,7 +57,7 @@ $DB->delete_records('external_services_users', array('externalserviceid'=>$service->id)); $DB->delete_records('external_services_functions', array('externalserviceid'=>$service->id)); $DB->delete_records('external_services', array('id'=>$service->id)); - add_to_log(1, 'webservice', 'delete', $CFG->wwwroot."/admin/settings.php?section=externalservices", get_string('deleteservice', 'webservice', $service)); + add_to_log(1, 'webservice', 'delete', $CFG->wwwroot."/$CFG->admin/settings.php?section=externalservices", get_string('deleteservice', 'webservice', $service)); redirect($returnurl); } @@ -76,11 +76,11 @@ if (empty($data->id)) { $data->timecreated = mktime(); $data->id = $DB->insert_record('external_services', $data); - add_to_log(1, 'webservice', 'add', $CFG->wwwroot."/admin/settings.php?section=externalservices", get_string('addservice', 'webservice', $data)); + add_to_log(1, 'webservice', 'add', $CFG->wwwroot."/$CFG->admin/settings.php?section=externalservices", get_string('addservice', 'webservice', $data)); } else { $data->timemodified = mktime(); $DB->update_record('external_services', $data); - add_to_log(1, 'webservice', 'edit', $CFG->wwwroot."/admin/settings.php?section=externalservices", get_string('editservice', 'webservice', $data)); + add_to_log(1, 'webservice', 'edit', $CFG->wwwroot."/$CFG->admin/settings.php?section=externalservices", get_string('editservice', 'webservice', $data)); } redirect($returnurl); diff --git a/admin/webservice/service_functions.php b/admin/webservice/service_functions.php index 9c20ee309d203..49e9a93bfc549 100644 --- a/admin/webservice/service_functions.php +++ b/admin/webservice/service_functions.php @@ -33,7 +33,7 @@ $action = optional_param('action', '', PARAM_ACTION); $confirm = optional_param('confirm', 0, PARAM_BOOL); -$PAGE->set_url('admin/websevice/service_functions.php', array('id'=>$id)); +$PAGE->set_url('/admin/websevice/service_functions.php', array('id'=>$id)); admin_externalpage_setup('externalservicefunctions'); diff --git a/admin/webservice/service_users.php b/admin/webservice/service_users.php index 939c44c629466..f6c754dc6cfe3 100644 --- a/admin/webservice/service_users.php +++ b/admin/webservice/service_users.php @@ -29,7 +29,7 @@ $id = required_param('id', PARAM_INT); -$PAGE->set_url('admin/webservice/service_users.php', array('id'=>$id)); +$PAGE->set_url('/admin/webservice/service_users.php', array('id'=>$id)); $PAGE->requires->js($CFG->admin.'/webservice/script.js'); admin_externalpage_setup('externalserviceusers'); diff --git a/admin/webservice/tokens.php b/admin/webservice/tokens.php index d0ceb0bc02f75..144ec84e2d4ef 100644 --- a/admin/webservice/tokens.php +++ b/admin/webservice/tokens.php @@ -28,7 +28,7 @@ require_once($CFG->libdir.'/adminlib.php'); require_once('forms.php'); -$PAGE->set_url('/admin/webservice/tokens.php', array()); +$PAGE->set_url('/admin/webservice/tokens.php'); admin_externalpage_setup('addwebservicetoken'); diff --git a/auth/ldap/ntlmsso_attempt.php b/auth/ldap/ntlmsso_attempt.php index eb268bb0f29df..b31d196d32374 100644 --- a/auth/ldap/ntlmsso_attempt.php +++ b/auth/ldap/ntlmsso_attempt.php @@ -5,7 +5,7 @@ //HTTPS is potentially required in this page httpsrequired(); -$PAGE->set_url(new moodle_url($CFG->wwwroot.'/auth/ldap/ntlmsso_attempt.php')); +$PAGE->set_url('/auth/ldap/ntlmsso_attempt.php'); /// Define variables used in page $site = get_site(); diff --git a/auth/ldap/ntlmsso_finish.php b/auth/ldap/ntlmsso_finish.php index 5e26b76c889c2..725b2f0eda72a 100644 --- a/auth/ldap/ntlmsso_finish.php +++ b/auth/ldap/ntlmsso_finish.php @@ -5,7 +5,7 @@ //HTTPS is potentially required in this page httpsrequired(); -$PAGE->set_url(new moodle_url($CFG->wwwroot.'/auth/ldap/ntlmsso_finish.php')); +$PAGE->set_url('/auth/ldap/ntlmsso_finish.php'); /// Define variables used in page $site = get_site(); diff --git a/auth/mnet/jump.php b/auth/mnet/jump.php index f65a25c9385bb..b729a7b6a03d6 100644 --- a/auth/mnet/jump.php +++ b/auth/mnet/jump.php @@ -20,7 +20,7 @@ $hostwwwroot = optional_param('hostwwwroot', '', PARAM_URL); $wantsurl = optional_param('wantsurl', '', PARAM_RAW); -$url = new moodle_url($CFG->wwwroot.'/auth/mnet/jump.php'); +$url = new moodle_url('/auth/mnet/jump.php'); if ($hostid !== '0') $url->param('hostid', $hostid); if ($hostwwwroot !== '') $url->param('hostwwwroot', $hostwwwroot); if ($wantsurl !== '') $url->param('wantsurl', $wantsurl); diff --git a/auth/mnet/land.php b/auth/mnet/land.php index e3ae0fe4c571e..184d3fe9a7925 100644 --- a/auth/mnet/land.php +++ b/auth/mnet/land.php @@ -21,7 +21,7 @@ $wantsurl = required_param('wantsurl', PARAM_LOCALURL); $wantsremoteurl = optional_param('remoteurl', false, PARAM_BOOL); -$url = new moodle_url($CFG->wwwroot.'/auth/mnet/jump.php', array('token'=>$token, 'idp'=>$remotewwwroot, 'wantsurl'=>$wantsurl)); +$url = new moodle_url('/auth/mnet/jump.php', array('token'=>$token, 'idp'=>$remotewwwroot, 'wantsurl'=>$wantsurl)); if ($wantsremoteurl !== false) $url->param('remoteurl', $wantsremoteurl); $PAGE->set_url($url); diff --git a/auth/shibboleth/index.php b/auth/shibboleth/index.php index b8925a18e4db5..2babbfe20ca79 100644 --- a/auth/shibboleth/index.php +++ b/auth/shibboleth/index.php @@ -4,7 +4,7 @@ require('../../config.php'); - $PAGE->set_url(new moodle_url($CFG->wwwroot.'/auth/shibboleth/index.php')); + $PAGE->set_url('/auth/shibboleth/index.php'); if (isloggedin() && $USER->username != 'guest') { // Nothing to do if (isset($SESSION->wantsurl) and (strpos($SESSION->wantsurl, $CFG->wwwroot) === 0)) { diff --git a/auth/shibboleth/login.php b/auth/shibboleth/login.php index b77f45b2150a3..d3b56aad06d5a 100644 --- a/auth/shibboleth/login.php +++ b/auth/shibboleth/login.php @@ -66,7 +66,7 @@ $loginsite = get_string("loginsite"); - $PAGE->set_url(new moodle_url($CFG->wwwroot.'/auth/shibboleth/login.php')); + $PAGE->set_url('/auth/shibboleth/login.php'); $PAGE->navbar->add($loginsite); $PAGE->set_title("$site->fullname: $loginsite"); $PAGE->set_heading($site->fullname); diff --git a/backup/backup.php b/backup/backup.php index 1ee0ed3b5f33d..45862cc35dc31 100644 --- a/backup/backup.php +++ b/backup/backup.php @@ -13,7 +13,7 @@ $cancel = optional_param('cancel', '', PARAM_RAW); $launch = optional_param('launch', '', PARAM_ACTION); - $url = new moodle_url(); + $url = new moodle_url('/backup/backup.php'); if ($id !== 0) { $url->param('id', $id); } @@ -75,7 +75,7 @@ $PAGE->set_title("$site->shortname: $strcoursebackup"); $PAGE->set_heading($site->fullname); if (!$id) { - $PAGE->navbar->add($stradministration, new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/index.php')); + $PAGE->navbar->add($stradministration, new moodle_url('/admin/index.php')); $PAGE->navbar->add($strcoursebackup); echo $OUTPUT->header(); if ($courses = get_courses('all','c.shortname','c.id,c.shortname,c.fullname')) { @@ -100,12 +100,12 @@ //Print header if (has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) { - $PAGE->navbar->add($stradministration, new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/index.php')); - $PAGE->navbar->add($strcoursebackup, new moodle_url($CFG->wwwroot.'/backup/backup.php')); + $PAGE->navbar->add($stradministration, new moodle_url('/admin/index.php')); + $PAGE->navbar->add($strcoursebackup, new moodle_url('/backup/backup.php')); $PAGE->navbar->add("$course->fullname ($course->shortname)"); echo $OUTPUT->header(); } else { - $PAGE->navbar->add($course->fullname, new moodle_url($CFG->wwwroot.'/course/view.php', array('id'=>$course->id))); + $PAGE->navbar->add($course->fullname, new moodle_url('/course/view.php', array('id'=>$course->id))); $PAGE->navbar->add($strcoursebackup); echo $OUTPUT->header(); } diff --git a/backup/restore.php b/backup/restore.php index bbc424f548b2a..7528d0fcf701c 100644 --- a/backup/restore.php +++ b/backup/restore.php @@ -22,7 +22,7 @@ $method = optional_param('method', '', PARAM_ACTION); $backup_unique_code = optional_param('backup_unique_code',0,PARAM_INT); - $url = new moodle_url($CFG->wwwroot.'/backup/restore.php'); + $url = new moodle_url('/backup/restore.php'); if ($id !== 0) { $url->param('id', $id); } @@ -109,7 +109,7 @@ $PAGE->set_title("$site->shortname: $strcourserestore"); $PAGE->set_heading($site->fullname); if (!$file) { - $PAGE->navbar->add($stradministration, new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/index.php')); + $PAGE->navbar->add($stradministration, new moodle_url('/admin/index.php')); $PAGE->navbar->add($strcourserestore); echo $OUTPUT->header(); echo $OUTPUT->heading(get_string("nofilesselected")); @@ -120,7 +120,7 @@ //If cancel has been selected, inform and end if ($cancel) { - $PAGE->navbar->add($stradministration, new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/index.php')); + $PAGE->navbar->add($stradministration, new moodle_url('/admin/index.php')); $PAGE->navbar->add($strcourserestore); echo $OUTPUT->header(); echo $OUTPUT->heading(get_string("restorecancelled")); @@ -141,7 +141,7 @@ $PAGE->navbar->add(basename($file)); echo $OUTPUT->header(); } else { - $PAGE->navbar->add($course->shortname, new moodle_url($CFG->wwwroot.'/course/view.php', array('id'=>$course->id))); + $PAGE->navbar->add($course->shortname, new moodle_url('/course/view.php', array('id'=>$course->id))); $PAGE->navbar->add($strcourserestore); echo $OUTPUT->header(); } diff --git a/blocks/blog_menu/block_blog_menu.php b/blocks/blog_menu/block_blog_menu.php index a51ed350693f6..3937eb7354b1f 100755 --- a/blocks/blog_menu/block_blog_menu.php +++ b/blocks/blog_menu/block_blog_menu.php @@ -100,7 +100,7 @@ function get_content() { $output .= ''; // show View my entries link - $myentrieslink = html_link::make(new moodle_url($CFG->wwwroot .'/blog/index.php', array('userid' => $USER->id)), get_string('viewmyentries', 'blog')); + $myentrieslink = html_link::make(new moodle_url('/blog/index.php', array('userid' => $USER->id)), get_string('viewmyentries', 'blog')); $myentrieslink->url->params($blogheaders['url']->params()); $myentrieslink->url->param('userid', $USER->id); $pageuserid = $PAGE->url->param('userid'); @@ -113,7 +113,7 @@ function get_content() { // show "Add entry" or "Blog about this" link $sitecontext = get_context_instance(CONTEXT_SYSTEM); if (has_capability('moodle/blog:create', $sitecontext)) { - $addentrylink = html_link::make(new moodle_url($CFG->wwwroot .'/blog/edit.php', array('action' => 'add')), $blogheaders['stradd']); + $addentrylink = html_link::make(new moodle_url('/blog/edit.php', array('action' => 'add')), $blogheaders['stradd']); $addentrylink->url->params($blogheaders['url']->params()); $addentrylink->disableifcurrent = true; $menulist->add_item($OUTPUT->link($addentrylink)); diff --git a/blocks/blog_recent/block_blog_recent.php b/blocks/blog_recent/block_blog_recent.php index b1eb7394e29a8..61f3ac924e349 100644 --- a/blocks/blog_recent/block_blog_recent.php +++ b/blocks/blog_recent/block_blog_recent.php @@ -92,7 +92,7 @@ function get_content() { if (!empty($entries)) { $entrieslist = new html_list(); $entrieslist->add_class('list'); - $viewblogurl = new moodle_url($CFG->wwwroot . '/blog/index.php'); + $viewblogurl = new moodle_url('/blog/index.php'); foreach ($entries as $entryid => $entry) { $viewblogurl->param('entryid', $entryid); diff --git a/blocks/blog_tags/block_blog_tags.php b/blocks/blog_tags/block_blog_tags.php index 4627265b052f3..424db0dfca974 100644 --- a/blocks/blog_tags/block_blog_tags.php +++ b/blocks/blog_tags/block_blog_tags.php @@ -136,7 +136,7 @@ function get_content() { /// Accessibility: markup as a list. $this->content->text .= "\n