MDL-24321 switching to stdClass in /e*/
authorPetr Skoda <skodak@moodle.org>
Tue, 21 Sep 2010 08:14:41 +0000 (08:14 +0000)
committerPetr Skoda <skodak@moodle.org>
Tue, 21 Sep 2010 08:14:41 +0000 (08:14 +0000)
12 files changed:
enrol/authorize/localfuncs.php
enrol/authorize/uploadcsv.php
enrol/database/lib.php
enrol/flatfile/lib.php
enrol/imsenterprise/lib.php
enrol/ldap/lib.php
enrol/manual/edit.php
enrol/paypal/edit.php
enrol/paypal/ipn.php
enrol/self/edit.php
enrol/self/lib.php
error/index.php

index cffe4a6..a1f946f 100644 (file)
@@ -163,7 +163,7 @@ function message_to_admin($subject, $data) {
 
     $emailmessage = "$SITE->fullname: Transaction failed.\n\n$subject\n\n";
     $emailmessage .= print_r($data, true);
-    $eventdata = new object();
+    $eventdata = new stdClass();
     $eventdata->modulename        = 'moodle';
     $eventdata->component         = 'enrol_authorize';
     $eventdata->name              = 'authorize_enrolment';
@@ -231,7 +231,7 @@ function send_welcome_messages($orderdata) {
                 $a->paymenturl = "$CFG->wwwroot/enrol/authorize/index.php?user=$lastuserid";
                 $emailmessage = get_string('welcometocoursesemail', 'enrol_authorize', $a);
 
-                $eventdata = new object();
+                $eventdata = new stdClass();
                 $eventdata->modulename        = 'moodle';
                 $eventdata->component         = 'enrol_authorize';
                 $eventdata->name              = 'authorize_enrolment';
index 5b0c79e..8e0fbec 100644 (file)
@@ -242,7 +242,7 @@ function authorize_process_csv($filename) {
     if (!empty($ignoredlines)) {
         $admin = get_admin();
 
-        $eventdata = new object();
+        $eventdata = new stdClass();
         $eventdata->modulename        = 'moodle';
         $eventdata->component         = 'enrol_authorize';
         $eventdata->name              = 'authorize_enrolment';
index 63aace9..185d5fc 100644 (file)
@@ -300,7 +300,7 @@ class enrol_database_plugin extends enrol_plugin {
                     if (!empty($mapping) and !isset($existing[$mapping])) {
                         $params['mapping'] = $mapping;
                         if ($course = $DB->get_record_sql($sql, $params, IGNORE_MULTIPLE)) {
-                            $new = new object();
+                            $new = new stdClass();
                             $new->id      = $course->id;
                             $new->visible = $course->visible;
                             $new->mapping = $mapping;
@@ -519,7 +519,7 @@ class enrol_database_plugin extends enrol_plugin {
                         // invalid category id, better to skip
                         continue;
                     }
-                    $course = new object();
+                    $course = new stdClass();
                     $course->fullname  = $fields[$fullname];
                     $course->shortname = $fields[$shortname];
                     $course->idnumber  = $idnumber ? $fields[$idnumber] : NULL;
@@ -546,10 +546,10 @@ class enrol_database_plugin extends enrol_plugin {
                     unset($template->shortname);
                     unset($template->idnumber);
                 } else {
-                    $template = new object();
+                    $template = new stdClass();
                 }
             } else {
-                $template = new object();
+                $template = new stdClass();
             }
             if (!$DB->record_exists('course_categories', array('id'=>$defaultcategory))) {
                 $categories = $DB->get_records('course_categories', array(), 'sortorder', 'id', 0, 1);
index 580a332..9831613 100644 (file)
@@ -149,7 +149,7 @@ class enrol_flatfile_plugin extends enrol_plugin {
             } // end of if(file_open)
 
             if(! @unlink($filename)) {
-                $eventdata = new object();
+                $eventdata = new stdClass();
                 $eventdata->modulename        = 'moodle';
                 $eventdata->component         = 'course';
                 $eventdata->name              = 'flatfile_enrolment';
@@ -167,7 +167,7 @@ class enrol_flatfile_plugin extends enrol_plugin {
             if (!empty($mailadmins)) {
 
                 // Send mail to admin
-                $eventdata = new object();
+                $eventdata = new stdClass();
                 $eventdata->modulename        = 'moodle';
                 $eventdata->component         = 'course';
                 $eventdata->name              = 'flatfile_enrolment';
@@ -213,7 +213,7 @@ class enrol_flatfile_plugin extends enrol_plugin {
         if ($timestart > time()) {
             if ($store_to_buffer) {
                 // populate into enrol_flatfile table as a future role to be assigned by cron.
-                $future_en = new object();
+                $future_en = new stdClass();
                 $future_en->action = $action;
                 $future_en->roleid = $roleid;
                 $future_en->userid = $user->id;
@@ -273,11 +273,11 @@ class enrol_flatfile_plugin extends enrol_plugin {
 
             if (!empty($mailstudents)) {
                 // Send mail to students
-                $a = new object();
+                $a = new stdClass();
                 $a->coursename = "$course->fullname";
                 $a->profileurl = "$CFG->wwwroot/user/view.php?id=$user->id&amp;course=$course->id";
 
-                $eventdata = new object();
+                $eventdata = new stdClass();
                 $eventdata->modulename        = 'moodle';
                 $eventdata->component         = 'course';
                 $eventdata->name              = 'flatfile_enrolment';
@@ -295,11 +295,11 @@ class enrol_flatfile_plugin extends enrol_plugin {
 
                 // Send mail to teachers
                 foreach($teachers as $teacher) {
-                    $a = new object();
+                    $a = new stdClass();
                     $a->course = "$course->fullname";
                     $a->user = fullname($user);
 
-                    $eventdata = new object();
+                    $eventdata = new stdClass();
                     $eventdata->modulename        = 'moodle';
                     $eventdata->component         = 'course';
                     $eventdata->name              = 'flatfile_enrolment';
index 1cdf2c2..9de740a 100644 (file)
@@ -231,7 +231,7 @@ function cron() {
             $msg .= "Logging is currently not active.";
         }
 
-        $eventdata = new object();
+        $eventdata = new stdClass();
         $eventdata->modulename        = 'moodle';
         $eventdata->component         = 'imsenterprise';
         $eventdata->name              = 'imsenterprise_enrolment';
@@ -311,7 +311,7 @@ function process_group_tag($tagcontents){
     $createnewcategories    = $this->get_config('createnewcategories');
 
     // Process tag contents
-    $group = new object();
+    $group = new stdClass();
     if(preg_match('{<sourcedid>.*?<id>(.+?)</id>.*?</sourcedid>}is', $tagcontents, $matches)){
         $group->coursecode = trim($matches[1]);
     }
@@ -356,7 +356,7 @@ function process_group_tag($tagcontents){
                   $this->log_line("Course $coursecode not found in Moodle's course idnumbers.");
               } else {
                 // Create the (hidden) course(s) if not found
-                $course = new object();
+                $course = new stdClass();
                 $course->fullname = $group->description;
                 $course->shortname = $coursecode;
                 $course->idnumber = $coursecode;
@@ -372,7 +372,7 @@ function process_group_tag($tagcontents){
                         $course->category = $catid;
                     } elseif($createnewcategories) {
                         // Else if we're allowed to create new categories, let's create this one
-                        $newcat = new object();
+                        $newcat = new stdClass();
                         $newcat->name = $group->category;
                         $newcat->visible = 0;
                         $catid = $DB->insert_record('course_categories', $newcat);
@@ -398,7 +398,7 @@ function process_group_tag($tagcontents){
                 $course = $DB->get_record('course', array('id' => $courseid));
                 blocks_add_default_course_blocks($course);
 
-                $section = new object();
+                $section = new stdClass();
                 $section->course = $course->id;   // Create a default section.
                 $section->section = 0;
                 $section->summaryformat = FORMAT_HTML;
@@ -430,7 +430,7 @@ function process_person_tag($tagcontents){
     $imsdeleteusers         = $this->get_config('imsdeleteusers');
     $createnewusers         = $this->get_config('createnewusers');
 
-    $person = new object();
+    $person = new stdClass();
     if(preg_match('{<sourcedid>.*?<id>(.+?)</id>.*?</sourcedid>}is', $tagcontents, $matches)){
         $person->idnumber = trim($matches[1]);
     }
index cc1e300..86be466 100644 (file)
@@ -193,7 +193,7 @@ class enrol_ldap_plugin extends enrol_plugin {
                          WHERE c.id = :courseid";
                 $params = array('courseid'=>$course->id);
                 if (!($course_instance = $DB->get_record_sql($sql, $params, IGNORE_MULTIPLE))) {
-                    $course_instance = new object();
+                    $course_instance = new stdClass();
                     $course_instance->id = $course->id;
                     $course_instance->visible = $course->visible;
                     $course_instance->enrolid = $this->add_instance($course_instance);
@@ -501,7 +501,7 @@ class enrol_ldap_plugin extends enrol_plugin {
                                  WHERE c.id = :courseid";
                         $params = array('courseid'=>$course_obj->id);
                         if (!($course_instance = $DB->get_record_sql($sql, $params, IGNORE_MULTIPLE))) {
-                            $course_instance = new object();
+                            $course_instance = new stdClass();
                             $course_instance->id = $course_obj->id;
                             $course_instance->visible = $course_obj->visible;
                             $course_instance->enrolid = $this->add_instance($course_instance);
@@ -875,7 +875,7 @@ class enrol_ldap_plugin extends enrol_plugin {
         require_once("$CFG->dirroot/course/lib.php");
 
         // Override defaults with template course
-        $course = new object();
+        $course = new stdClass();
         if ($this->get_config('template')) {
             if($template = $DB->get_record('course', array('shortname'=>$this->get_config('template')))) {
                 unset($template->id); // So we are clear to reinsert the record
index 5237721..aa2edd1 100644 (file)
@@ -58,7 +58,7 @@ if ($instances = $DB->get_records('enrol', array('courseid'=>$course->id, 'enrol
     require_capability('moodle/course:enrolconfig', $context);
     // no instance yet, we have to add new instance
     navigation_node::override_active_url(new moodle_url('/enrol/instances.php', array('id'=>$course->id)));
-    $instance = new object();
+    $instance = new stdClass();
     $instance->id       = null;
     $instance->courseid = $course->id;
 }
index bb8ff01..fdac861 100644 (file)
@@ -53,7 +53,7 @@ if ($instanceid) {
     require_capability('moodle/course:enrolconfig', $context);
     // no instance yet, we have to add new instance
     navigation_node::override_active_url(new moodle_url('/enrol/instances.php', array('id'=>$course->id)));
-    $instance = new object();
+    $instance = new stdClass();
     $instance->id       = null;
     $instance->courseid = $course->id;
 }
index 620672e..3d1b608 100644 (file)
@@ -48,7 +48,7 @@ if (empty($_POST) or !empty($_GET)) {
 
 $req = 'cmd=_notify-validate';
 
-$data = new object();
+$data = new stdClass();
 
 foreach ($_POST as $key => $value) {
     $req .= "&$key=".urlencode($value);
@@ -135,7 +135,7 @@ while (!feof($fp)) {
         // Email user to let them know. Email admin.
 
         if ($data->payment_status == "Pending" and $data->pending_reason != "echeck") {
-            $eventdata = new object();
+            $eventdata = new stdClass();
             $eventdata->modulename        = 'moodle';
             $eventdata->component         = 'enrol_paypal';
             $eventdata->name              = 'paypal_enrolment';
@@ -233,7 +233,7 @@ while (!feof($fp)) {
             $a->coursename = $course->fullname;
             $a->profileurl = "$CFG->wwwroot/user/view.php?id=$user->id";
 
-            $eventdata = new object();
+            $eventdata = new stdClass();
             $eventdata->modulename        = 'moodle';
             $eventdata->component         = 'enrol_paypal';
             $eventdata->name              = 'paypal_enrolment';
@@ -252,7 +252,7 @@ while (!feof($fp)) {
             $a->course = $course->fullname;
             $a->user = fullname($user);
 
-            $eventdata = new object();
+            $eventdata = new stdClass();
             $eventdata->modulename        = 'moodle';
             $eventdata->component         = 'enrol_paypal';
             $eventdata->name              = 'paypal_enrolment';
@@ -271,7 +271,7 @@ while (!feof($fp)) {
             $a->user = fullname($user);
             $admins = get_admins();
             foreach ($admins as $admin) {
-                $eventdata = new object();
+                $eventdata = new stdClass();
                 $eventdata->modulename        = 'moodle';
                 $eventdata->component         = 'enrol_paypal';
                 $eventdata->name              = 'paypal_enrolment';
@@ -310,7 +310,7 @@ function message_paypal_error_to_admin($subject, $data) {
         $message .= "$key => $value\n";
     }
 
-    $eventdata = new object();
+    $eventdata = new stdClass();
     $eventdata->modulename        = 'moodle';
     $eventdata->component         = 'enrol_paypal';
     $eventdata->name              = 'paypal_enrolment';
index b57aead..66d2212 100644 (file)
@@ -53,7 +53,7 @@ if ($instanceid) {
     require_capability('moodle/course:enrolconfig', $context);
     // no instance yet, we have to add new instance
     navigation_node::override_active_url(new moodle_url('/enrol/instances.php', array('id'=>$course->id)));
-    $instance = new object();
+    $instance = new stdClass();
     $instance->id       = null;
     $instance->courseid = $course->id;
 }
index cfe4678..e46eded 100644 (file)
@@ -277,7 +277,7 @@ class enrol_self_plugin extends enrol_plugin {
 
         $course = $DB->get_record('course', array('id'=>$instance->courseid), '*', MUST_EXIST);
 
-        $a = new object();
+        $a = new stdClass();
         $a->coursename = format_string($course->fullname);
         $a->profileurl = "$CFG->wwwroot/user/view.php?id=$user->id&course=$course->id";
 
index b70c5b5..0a7f423 100644 (file)
             print_error('cannotfindadmin', 'debug');
         }
 
-        $supportuser = new object;
+        $supportuser = new stdClass();
         $supportuser->email = $CFG->supportemail ? $CFG->supportemail : $admin->email;
         $supportuser->firstname = $CFG->supportname ? $CFG->supportname : $admin->firstname;
         $supportuser->lastname = $CFG->supportname ? '' : $admin->lastname;
         $supportuser->maildisplay = true;
 
     /// Send the message and redirect
-        $eventdata = new object();
+        $eventdata = new stdClass();
         $eventdata->modulename        = 'moodle';
         $eventdata->userfrom          = $USER;
         $eventdata->userto            = $supportuser;