From a8e174ccd81f69e508102b327035455cd74a9f85 Mon Sep 17 00:00:00 2001 From: jerome mouneyrac Date: Fri, 24 Sep 2010 05:12:44 +0000 Subject: [PATCH] community block/registration/publication MDL-24230 change /admin/ for $CFG->admin and /lib/ for $CFG->libdir --- admin/registration/confirmregistration.php | 2 +- admin/registration/forms.php | 4 ++-- admin/registration/hubselector.php | 4 ++-- admin/registration/index.php | 6 +++--- admin/registration/register.php | 4 ++-- admin/registration/renderer.php | 8 +++++--- blocks/community/communitycourse.php | 4 ++-- blocks/community/forms.php | 6 +++--- blocks/community/locallib.php | 2 +- blocks/community/renderer.php | 2 +- course/publish/backup.php | 6 +++--- course/publish/forms.php | 6 +++--- course/publish/hubselector.php | 2 +- course/publish/index.php | 6 +++--- course/publish/metadata.php | 7 +++---- 15 files changed, 35 insertions(+), 34 deletions(-) diff --git a/admin/registration/confirmregistration.php b/admin/registration/confirmregistration.php index ca0d2a5940e68..586c6b09c1c4b 100644 --- a/admin/registration/confirmregistration.php +++ b/admin/registration/confirmregistration.php @@ -72,7 +72,7 @@ if (!extension_loaded('xmlrpc')) { //display notice about xmlrpc - $xmlrpcnotification = $OUTPUT->doc_link('admin/environment/php_extension/xmlrpc', ''); + $xmlrpcnotification = $OUTPUT->doc_link($CFG->admin . '/environment/php_extension/xmlrpc', ''); $xmlrpcnotification .= get_string('xmlrpcdisabledregistration', 'hub'); echo $OUTPUT->notification($xmlrpcnotification); } diff --git a/admin/registration/forms.php b/admin/registration/forms.php index 8686cf6937a76..bf7b7b13bfb12 100644 --- a/admin/registration/forms.php +++ b/admin/registration/forms.php @@ -31,8 +31,8 @@ */ -require_once($CFG->dirroot . '/lib/formslib.php'); -require_once($CFG->dirroot . '/admin/registration/lib.php'); +require_once($CFG->libdir . '/formslib.php'); +require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php'); /** * This form display a unregistration form. diff --git a/admin/registration/hubselector.php b/admin/registration/hubselector.php index 11fe1ab8586a5..6bb215f080fcd 100644 --- a/admin/registration/hubselector.php +++ b/admin/registration/hubselector.php @@ -28,7 +28,7 @@ require('../../config.php'); require_once($CFG->libdir.'/adminlib.php'); -require_once($CFG->dirroot.'/admin/registration/forms.php'); +require_once($CFG->dirroot.'/' . $CFG->admin . '/registration/forms.php'); admin_externalpage_setup('registrationselector'); @@ -55,7 +55,7 @@ $hubname = optional_param(clean_param($huburl, PARAM_ALPHANUMEXT), '', PARAM_TEXT); $params = array('sesskey' => sesskey(), 'huburl' => $huburl, 'password' => $password, 'hubname' => $hubname); - redirect(new moodle_url($CFG->wwwroot."/admin/registration/register.php", + redirect(new moodle_url($CFG->wwwroot."/" . $CFG->admin . "/registration/register.php", $params)); } diff --git a/admin/registration/index.php b/admin/registration/index.php index 7578642c22000..72469190c25aa 100644 --- a/admin/registration/index.php +++ b/admin/registration/index.php @@ -29,8 +29,8 @@ require('../../config.php'); require_once($CFG->libdir . '/adminlib.php'); -require_once($CFG->dirroot . '/admin/registration/lib.php'); -require_once($CFG->dirroot . '/admin/registration/forms.php'); +require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php'); +require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/forms.php'); require_once($CFG->dirroot . '/course/publish/lib.php'); require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php"); @@ -155,7 +155,7 @@ echo $renderer->registeredonhublisting($hubs); } } else { //display notice about xmlrpc - $xmlrpcnotification = $OUTPUT->doc_link('admin/environment/php_extension/xmlrpc', ''); + $xmlrpcnotification = $OUTPUT->doc_link($CFG->admin . '/environment/php_extension/xmlrpc', ''); $xmlrpcnotification .= get_string('xmlrpcdisabledregistration', 'hub'); echo $OUTPUT->notification($xmlrpcnotification); } diff --git a/admin/registration/register.php b/admin/registration/register.php index 36e9d3e019f61..49d0351f0e9ab 100644 --- a/admin/registration/register.php +++ b/admin/registration/register.php @@ -35,9 +35,9 @@ require_once('../../config.php'); require_once($CFG->libdir . '/adminlib.php'); -require_once($CFG->dirroot . '/admin/registration/forms.php'); +require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/forms.php'); require_once($CFG->dirroot . '/webservice/lib.php'); -require_once($CFG->dirroot . '/admin/registration/lib.php'); +require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php'); admin_externalpage_setup('registrationindex'); diff --git a/admin/registration/renderer.php b/admin/registration/renderer.php index 45022905d4678..3d0be2bd7ae47 100644 --- a/admin/registration/renderer.php +++ b/admin/registration/renderer.php @@ -46,6 +46,7 @@ public function registration_confirmation($confirmationmessage) { * Display the page to register on Moodle.org or on a specific hub */ public function registrationselector() { + global $CFG; $table = new html_table(); $table->head = array(get_string('moodleorg', 'hub'), get_string('specifichub', 'hub')); $table->size = array('50%', '50%'); @@ -66,7 +67,7 @@ public function registrationselector() { $table->data[] = $row; //Moodle.org button cell - $registeronmoodleorgurl = new moodle_url("/admin/registration/register.php", + $registeronmoodleorgurl = new moodle_url("/" . $CFG->admin . "/registration/register.php", array('sesskey' => sesskey(), 'huburl' => HUB_MOODLEORGHUBURL , 'hubname' => 'Moodle.org')); $registeronmoodleorgbutton = new single_button($registeronmoodleorgurl, @@ -76,7 +77,7 @@ public function registrationselector() { $moodleorgcell = $registeronmoodleorgbuttonhtml; //Specific hub button cell - $registeronspecifichuburl = new moodle_url("/admin/registration/hubselector.php", + $registeronspecifichuburl = new moodle_url("/" . $CFG->admin . "/registration/hubselector.php", array('sesskey' => sesskey())); $registeronspecifichubbutton = new single_button($registeronspecifichuburl, get_string('registeronspecifichub', 'hub')); @@ -96,6 +97,7 @@ public function registrationselector() { * Display the listing of registered on hub */ public function registeredonhublisting($hubs) { + global $CFG; $table = new html_table(); $table->head = array(get_string('hub', 'hub'), get_string('operation', 'hub')); $table->size = array('80%', '20%'); @@ -104,7 +106,7 @@ public function registeredonhublisting($hubs) { $hublink = html_writer::tag('a', $hub->hubname, array('href' => $hub->huburl)); $hublinkcell = html_writer::tag('div', $hublink, array('class' => 'registeredhubrow')); - $unregisterhuburl = new moodle_url("/admin/registration/index.php", + $unregisterhuburl = new moodle_url("/" . $CFG->admin . "/registration/index.php", array('sesskey' => sesskey(), 'huburl' => $hub->huburl, 'unregistration' => 1)); $unregisterbutton = new single_button($unregisterhuburl, diff --git a/blocks/community/communitycourse.php b/blocks/community/communitycourse.php index c82f11c44110d..645c233c5e5a1 100644 --- a/blocks/community/communitycourse.php +++ b/blocks/community/communitycourse.php @@ -30,7 +30,7 @@ require('../../config.php'); require_once($CFG->dirroot . '/blocks/community/locallib.php'); require_once($CFG->dirroot . '/blocks/community/forms.php'); -require_once($CFG->dirroot . '/admin/registration/lib.php'); +require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php'); require_login(); @@ -53,7 +53,7 @@ if (empty($usercansearch)) { $notificationerror = get_string('cannotsearchcommunity', 'hub'); } else if (!extension_loaded('xmlrpc')) { - $notificationerror = $OUTPUT->doc_link('admin/environment/php_extension/xmlrpc', ''); + $notificationerror = $OUTPUT->doc_link($CFG->admin . '/environment/php_extension/xmlrpc', ''); $notificationerror .= get_string('xmlrpcdisabledcommunity', 'hub'); } if (!empty($notificationerror)) { diff --git a/blocks/community/forms.php b/blocks/community/forms.php index d315fc16ffa12..a06651c735d6a 100644 --- a/blocks/community/forms.php +++ b/blocks/community/forms.php @@ -30,9 +30,9 @@ * Form for community search */ -require_once($CFG->dirroot . '/lib/formslib.php'); +require_once($CFG->libdir . '/formslib.php'); require_once($CFG->dirroot . '/course/publish/lib.php'); -require_once($CFG->dirroot . '/admin/registration/lib.php'); +require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php'); class community_hub_search_form extends moodleform { @@ -242,7 +242,7 @@ public function definition() { $this->init_javascript_enhancement('subject', 'smartselect', array('selectablecategories' => true, 'mode' => 'compact')); - require_once($CFG->dirroot . "/lib/licenselib.php"); + require_once($CFG->libdir . "/licenselib.php"); $licensemanager = new license_manager(); $licences = $licensemanager->get_licenses(); $options = array(); diff --git a/blocks/community/locallib.php b/blocks/community/locallib.php index 726a11e533138..5120c4308160c 100644 --- a/blocks/community/locallib.php +++ b/blocks/community/locallib.php @@ -80,7 +80,7 @@ public function block_community_get_course($courseurl, $userid) { */ public function block_community_download_course_backup($course) { global $CFG, $USER; - require_once($CFG->dirroot. "/lib/filelib.php"); + require_once($CFG->libdir . "/filelib.php"); require_once($CFG->dirroot. "/course/publish/lib.php"); $params['courseid'] = $course->id; diff --git a/blocks/community/renderer.php b/blocks/community/renderer.php index 72b6a722cf954..e5e054205e736 100644 --- a/blocks/community/renderer.php +++ b/blocks/community/renderer.php @@ -159,7 +159,7 @@ public function course_list($courses, $huburl, $contextcourseid) { $course->lang = ''; } //licence - require_once($CFG->dirroot . "/lib/licenselib.php"); + require_once($CFG->libdir . "/licenselib.php"); $licensemanager = new license_manager(); $licenses = $licensemanager->get_licenses(); foreach ($licenses as $license) { diff --git a/course/publish/backup.php b/course/publish/backup.php index 0847572d4ff6d..6adc222029dad 100644 --- a/course/publish/backup.php +++ b/course/publish/backup.php @@ -33,9 +33,9 @@ require_once('../../config.php'); require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php'); require_once($CFG->dirroot . '/backup/moodle2/backup_plan_builder.class.php'); -require_once($CFG->dirroot.'/admin/registration/lib.php'); -require_once($CFG->dirroot.'/course/publish/lib.php'); -require_once($CFG->dirroot.'/lib/filelib.php'); +require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php'); +require_once($CFG->dirroot . '/course/publish/lib.php'); +require_once($CFG->libdir . '/filelib.php'); //retrieve initial page parameters diff --git a/course/publish/forms.php b/course/publish/forms.php index ec8faf35cea38..91b7ee66a57a6 100644 --- a/course/publish/forms.php +++ b/course/publish/forms.php @@ -31,8 +31,8 @@ */ -require_once($CFG->dirroot . '/lib/formslib.php'); -require_once($CFG->dirroot . "/admin/registration/lib.php"); +require_once($CFG->libdir . '/formslib.php'); +require_once($CFG->dirroot . "/" . $CFG->admin . "/registration/lib.php"); require_once($CFG->dirroot . "/course/publish/lib.php"); /* @@ -261,7 +261,7 @@ public function definition() { - require_once($CFG->dirroot . "/lib/licenselib.php"); + require_once($CFG->libdir . "/licenselib.php"); $licensemanager = new license_manager(); $licences = $licensemanager->get_licenses(); $options = array(); diff --git a/course/publish/hubselector.php b/course/publish/hubselector.php index a86390099b3f0..3d982ef3908ca 100644 --- a/course/publish/hubselector.php +++ b/course/publish/hubselector.php @@ -26,7 +26,7 @@ require('../../config.php'); -require_once($CFG->dirroot.'/admin/registration/lib.php'); +require_once($CFG->dirroot.'/' . $CFG->admin . '/registration/lib.php'); require_once($CFG->dirroot.'/course/publish/forms.php'); $id = optional_param('id', 0, PARAM_INT); diff --git a/course/publish/index.php b/course/publish/index.php index ca59debf99e2d..d681bf4da1269 100644 --- a/course/publish/index.php +++ b/course/publish/index.php @@ -27,8 +27,8 @@ */ require('../../config.php'); -require_once($CFG->dirroot.'/admin/registration/lib.php'); -require_once($CFG->dirroot.'/course/publish/lib.php'); +require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php'); +require_once($CFG->dirroot . '/course/publish/lib.php'); $id = optional_param('id', 0, PARAM_INT); $hubname = optional_param('hubname', 0, PARAM_TEXT); @@ -45,7 +45,7 @@ //check that the PHP xmlrpc extension is enabled if (!extension_loaded('xmlrpc')) { - $notificationerror = $OUTPUT->doc_link('admin/environment/php_extension/xmlrpc', ''); + $notificationerror = $OUTPUT->doc_link($CFG->admin . '/environment/php_extension/xmlrpc', ''); $notificationerror .= get_string('xmlrpcdisabledpublish', 'hub'); echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('publishcourse', 'hub', $course->shortname), 3, 'main'); diff --git a/course/publish/metadata.php b/course/publish/metadata.php index 3aca75b55580a..b0866071a8a8e 100644 --- a/course/publish/metadata.php +++ b/course/publish/metadata.php @@ -32,9 +32,9 @@ require_once('../../config.php'); require_once($CFG->dirroot . '/course/publish/forms.php'); -require_once($CFG->dirroot . '/admin/registration/lib.php'); +require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php'); require_once($CFG->dirroot . '/course/publish/lib.php'); -require_once($CFG->dirroot . '/lib/filelib.php'); +require_once($CFG->libdir . '/filelib.php'); //check user access capability to this page @@ -55,7 +55,7 @@ //check that the PHP xmlrpc extension is enabled if (!extension_loaded('xmlrpc')) { - $errornotification = $OUTPUT->doc_link('admin/environment/php_extension/xmlrpc', ''); + $errornotification = $OUTPUT->doc_link($CFG->admin . '/environment/php_extension/xmlrpc', ''); $errornotification .= get_string('xmlrpcdisabledpublish', 'hub'); echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('publishcourse', 'hub', $course->shortname), 3, 'main'); @@ -213,7 +213,6 @@ // send screenshots if (!empty($fromform->screenshots)) { - require_once($CFG->dirroot . "/lib/filelib.php"); if (!empty($fromform->deletescreenshots)) { $screenshotnumber = 0;