]> git.mjollnir.org Git - moodle.git/commitdiff
Just some tidy-ups
authormoodler <moodler>
Wed, 26 Apr 2006 16:03:16 +0000 (16:03 +0000)
committermoodler <moodler>
Wed, 26 Apr 2006 16:03:16 +0000 (16:03 +0000)
enrol/authorize/index.php
enrol/authorize/locallib.php

index 0ce5f0ae7d2c00f7cfae718d321ab27741e4a376..53f9f5d07199bbb25902d28d867aff0d354162ca 100644 (file)
@@ -1,17 +1,17 @@
 <?PHP // $Id$
 
 /// Load libraries
-    require_once '../../config.php';
-    define('USE_AN_LOCALLIB', true);
-    require_once 'locallib.php';
+    require_once('../../config.php');
+    require_once('locallib.php');
 
-/// Get site
-    if (! $site = get_site()) {
-        error("Could not find a site!");
-    }
+/// Parameters
+    $orderid  = optional_param('order', 0, PARAM_INT);
+    $courseid = optional_param('course', SITEID, PARAM_INT);
+    $userid   = optional_param('user', 0, PARAM_INT);
 
 /// Only site users can access to this page
-    require_login();
+    require_login($courseid);
+
     if (isguest()) {
         error("Guests cannot use this page.");
     }
                 'howmuch','captureyes','unenrolstudent'), 'enrol_authorize');
 
 /// Print header
-    print_header("$site->shortname: $authstrs->paymentmanagement",
-                 "$site->fullname",
-                 "<a href=\"index.php\">$authstrs->paymentmanagement</a>", "");
+    if (!$course = get_record('course', 'id', $courseid)) {
+        error('Could not find that course');
+    }
+    print_header_simple("$course->shortname: $authstrs->paymentmanagement", $course->fullname,
+                        "<a href=\"index.php\">$authstrs->paymentmanagement</a>", "");
 
-/// Get order id
-    $orderid = optional_param('order', 0, PARAM_INT);
 
 /// If orderid is empty, user wants to see all orders
     if (empty($orderid)) {
         authorize_print_orders();
-    }
-    else {
+    } else {
         authorize_print_order_details($orderid);
     }
 
index 163850042e29170901bee963e990f972b6f0c276..c71e8a4045ae03e88e5ea5d02cff8f3066fc2b6b 100644 (file)
@@ -1,10 +1,11 @@
 <?PHP // $Id$
 
-defined('USE_AN_LOCALLIB') or die('Locallib.php can be only used by index.php');
+if (!defined('MOODLE_INTERNAL')) {
+    die('Direct access to this script is forbidden.');    ///  It must be included from a Moodle page
+}
 
-require_once '../../config.php';
-require_once $CFG->dirroot.'/enrol/authorize/const.php';
-require_once $CFG->dirroot.'/enrol/authorize/action.php';
+require_once('const.php');
+require_once('action.php');
 
 define('ORDER_CAPTURE', 'capture');
 define('ORDER_DELETE',  'delete');