Tabs are out
authorstronk7 <stronk7>
Mon, 16 May 2005 22:22:31 +0000 (22:22 +0000)
committerstronk7 <stronk7>
Mon, 16 May 2005 22:22:31 +0000 (22:22 +0000)
38 files changed:
enrol/authorize/config.html
enrol/authorize/enrol.html
enrol/authorize/enrol.php
enrol/database/config.html
enrol/flatfile/config.html
enrol/ldap/config.html
enrol/paypal/config.html
filter/algebra/AlgParser.pm
filter/algebra/algebradebug.php
filter/algebra/filter.php
filter/tex/filter.php
filter/tex/texdebug.php
grade/exceptions.html
login/confirm.php
login/forgot_password.php
login/index_form.html
login/signup_form.html
mod/assignment/config.html
mod/assignment/details.php
mod/attendance/config.html
mod/attendance/db/mysql.php
mod/attendance/teacheredit.php
mod/chat/config.html
mod/dialogue/db/mysql.php
mod/exercise/db/mysql.php
mod/exercise/db/postgres7.php
mod/exercise/lib.php
mod/glossary/TODO.txt
mod/glossary/backuplib.php
mod/glossary/comment.html
mod/glossary/config.html
mod/glossary/db/mysql.php
mod/glossary/editcategories.html
mod/glossary/formats/fullwithauthor/fullwithauthor_format.php
mod/glossary/formats/fullwithoutauthor/fullwithoutauthor_format.php
mod/glossary/lib.php
mod/glossary/restorelib.php
mod/journal/lib.php

index 300db18..fca6cc3 100755 (executable)
@@ -1,9 +1,9 @@
 <table cellspacing="0" cellpadding="5" border="0" align="center">
 
 <tr valign="top">
-       <td align="right">enrol_cost:</td>
-       <td>
-        <input type="text" size="5" name="enrol_cost" value="<?php p($frm->enrol_cost) ?>" />
+    <td align="right">enrol_cost:</td>
+    <td>
+       <input type="text" size="5" name="enrol_cost" value="<?php p($frm->enrol_cost) ?>" />
     </td>
     <td>
     <?php  print_string("costdefault") ?>
@@ -11,8 +11,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">enrol_currency:</td>
-       <td>
+    <td align="right">enrol_currency:</td>
+    <td>
     <?php choose_from_menu ($ancurrencies, "enrol_currency", $frm->enrol_currency, "","", "") ?>
     </td>
     <td>
@@ -24,8 +24,8 @@
 
 
 <tr valign="top">
-       <td align="right">an_login:</td>
-       <td>
+    <td align="right">an_login:</td>
+    <td>
         <input type="text" name="an_login" value="<?php echo $frm->an_login ?>" />
     </td>
     <td>
@@ -34,8 +34,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">an_tran_key:</td>
-       <td>
+    <td align="right">an_tran_key:</td>
+    <td>
         <input type="text" name="an_tran_key" value="<?php echo $frm->an_tran_key ?>" />
     </td>
     <td>
@@ -44,8 +44,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">an_password:</td>
-       <td>
+    <td align="right">an_password:</td>
+    <td>
         <input type="text" name="an_password" value="<?php echo $frm->an_password ?>" />
     </td>
     <td>
@@ -54,8 +54,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">an_referer:</td>
-       <td>
+    <td align="right">an_referer:</td>
+    <td>
         <input type="text" name="an_referer" value="<?php echo $frm->an_referer ?>" />
     </td>
     <td>
@@ -64,8 +64,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">an_test:</td>
-       <td>
+    <td align="right">an_test:</td>
+    <td>
         <input type="checkbox" value=1 name="an_test" <?php if ($frm->an_test) echo "checked=\"true\"" ?> />
     </td>
     <td>
@@ -76,8 +76,8 @@
 <tr valign="top"><td colspan="3"><hr noshade size="1"></td></tr>
 
 <tr valign="top">
-       <td align="right">enrol_mailstudents:</td>
-       <td>
+    <td align="right">enrol_mailstudents:</td>
+    <td>
         <input type="checkbox" value=1 name="enrol_mailstudents" <?php if ($frm->enrol_mailstudents) echo "checked=\"true\"" ?> />
     </td>
     <td>
@@ -86,8 +86,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">enrol_mailteachers:</td>
-       <td>
+    <td align="right">enrol_mailteachers:</td>
+    <td>
         <input type="checkbox" value=1 name="enrol_mailteachers" <?php if ($frm->enrol_mailteachers) echo "checked=\"true\"" ?> />
     </td>
     <td>
@@ -96,8 +96,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">enrol_mailadmins:</td>
-       <td>
+    <td align="right">enrol_mailadmins:</td>
+    <td>
         <input type="checkbox" value=1 name="enrol_mailadmins" <?php if ($frm->enrol_mailadmins) echo "checked=\"true\"" ?> />
     </td>
     <td>
 </tr>
 
 <tr valign="top">
-       <td align="right">enrol_allowinternal:</td>
-       <td>
+    <td align="right">enrol_allowinternal:</td>
+    <td>
         <input type="checkbox" value="1" name="enrol_allowinternal" <?php if ($frm->enrol_allowinternal) echo "checked=\"true\"" ?> />
     </td>
     <td>
index 0116b99..4deda18 100755 (executable)
@@ -12,7 +12,7 @@
 <tr>
   <td align="right"><?php print_string("nameoncard", "enrol_authorize") ?>: </td>
   <td align="left"><input type="text" name="ccfirstname" size="16" value="<?php p($userfirstname) ?>"  />
-                  <input type="text" name="cclastname" size="16" value="<?php p($userlastname) ?>"  /></td>
+                   <input type="text" name="cclastname" size="16" value="<?php p($userlastname) ?>"  /></td>
 </tr>
 <tr>
   <td align="right"><?php print_string("ccno", "enrol_authorize") ?>: </td>
@@ -37,7 +37,7 @@
 <tr>
   <td align="right"><?php print_string("ccvv", "enrol_authorize") ?>: </td>
   <td align="left"><input type="text" name="cvv" size="4" maxlength="4" value="<?php p($form->cvv) ?>" />
-                  <font size=1><?php print_string("ccvvhelp", "enrol_authorize") ?></font></td>
+                   <font size=1><?php print_string("ccvvhelp", "enrol_authorize") ?></font></td>
 </tr>
 <tr>
   <td align="right"><?php print_string("zipcode", "enrol_authorize") ?>: </td>
index a27b5b1..23ba98e 100755 (executable)
@@ -16,437 +16,437 @@ class enrolment_plugin extends enrolment_base {
 
 /// Override: print_entry()
 function print_entry($course) {
-       global $CFG, $USER, $form;
-
-       $strloginto = get_string("loginto", "", $course->shortname);
-       $strcourses = get_string("courses");
-       $teacher = get_teacher($course->id);
-
-       if ($this->zero_cost($course)) {
-               parent::print_entry($course);
-       } else {
-               // check payment
-               $this->check_paid();
-
-               if ((!empty($CFG->loginhttps)) && (!isset($_SERVER['HTTPS']))) {
-                       $wwwsroot = str_replace('http://','https://', $CFG->wwwroot);
-                       $sdestination = "$wwwsroot/course/enrol.php?id=$course->id";
-                       redirect($sdestination);
-                       exit;
-               }
-
-               print_header($strloginto, $course->fullname, "<a href=\"$CFG->wwwroot/course/\">$strcourses</a> -> $strloginto");
-               print_course($course, "80%");
-               print_simple_box_start("center");
-
-               $coursefullname = $course->fullname;
-               $courseshortname= $course->shortname;
-               $userfirstname  = $USER->firstname;
-               $userlastname   = $USER->lastname;
-               $useraddress    = $USER->address;
-               $usercity               = $USER->city;
-               $cost                   = $this->get_cource_cost($course);
-
-               $CCTYPES = array(
-                       'mcd' => 'Master Card',
-                       'vis' => 'Visa',
-                       'amx' => 'American Express',
-                       'dsc' => 'Discover',
-                       'dnc' => 'Diners Club',
-                       'jcb' => 'JCB',
-                       'swi' => 'Switch',
-                       'dlt' => 'Delta',
-                       'enr' => 'EnRoute'
-               );
-
-               $formvars = array('ccfirstname','cclastname','cc','ccexpiremm','ccexpireyyyy','cctype','cvv','cczip');
-               foreach ($formvars as $var) {
-                       if (!isset($form->$var)) {
-                               $form->$var = '';
-                       
-               }
-
-               include($CFG->dirroot . '/enrol/authorize/enrol.html');
-               print_simple_box_end();
-               print_footer();
-       }
+    global $CFG, $USER, $form;
+
+    $strloginto = get_string("loginto", "", $course->shortname);
+    $strcourses = get_string("courses");
+    $teacher = get_teacher($course->id);
+
+    if ($this->zero_cost($course)) {
+        parent::print_entry($course);
+    } else {
+        // check payment
+        $this->check_paid();
+
+        if ((!empty($CFG->loginhttps)) && (!isset($_SERVER['HTTPS']))) {
+            $wwwsroot = str_replace('http://','https://', $CFG->wwwroot);
+            $sdestination = "$wwwsroot/course/enrol.php?id=$course->id";
+            redirect($sdestination);
+            exit;
+        }
+
+        print_header($strloginto, $course->fullname, "<a href=\"$CFG->wwwroot/course/\">$strcourses</a> -> $strloginto");
+        print_course($course, "80%");
+        print_simple_box_start("center");
+
+        $coursefullname        = $course->fullname;
+        $courseshortname= $course->shortname;
+        $userfirstname = $USER->firstname;
+        $userlastname  = $USER->lastname;
+        $useraddress   = $USER->address;
+        $usercity              = $USER->city;
+        $cost                  = $this->get_cource_cost($course);
+
+        $CCTYPES = array(
+            'mcd' => 'Master Card',
+            'vis' => 'Visa',
+            'amx' => 'American Express',
+            'dsc' => 'Discover',
+            'dnc' => 'Diners Club',
+            'jcb' => 'JCB',
+            'swi' => 'Switch',
+            'dlt' => 'Delta',
+            'enr' => 'EnRoute'
+        );
+
+        $formvars = array('ccfirstname','cclastname','cc','ccexpiremm','ccexpireyyyy','cctype','cvv','cczip');
+        foreach ($formvars as $var) {
+            if (!isset($form->$var)) {
+                       $form->$var = '';
+               } 
+       }
+
+       include($CFG->dirroot . '/enrol/authorize/enrol.html');
+       print_simple_box_end();
+       print_footer();
+    }
 }
 
 /// Override: check_entry()
 function check_entry($form, $course) {
-       if ($this->zero_cost($course)) {
-               parent::check_entry($form, $course);
-       } else {
-               $this->cc_submit($form, $course);
-       }
+    if ($this->zero_cost($course)) {
+       parent::check_entry($form, $course);
+    } else {
+       $this->cc_submit($form, $course);
+    }
 }
 
 function cc_submit($form, $course)
 {
-       global $CFG, $USER, $SESSION;
-       require_once($CFG->dirroot . '/enrol/authorize/ccval.php');
-
-       if (empty($form->ccfirstname) || empty($form->cclastname) ||
-               empty($form->cc) || empty($form->cvv) || empty($form->cctype) ||
-               empty($form->ccexpiremm) || empty($form->ccexpireyyyy)) {
-                       $this->errormsg = get_string("allfieldsrequired");
-                       return;
-               }
-
-       if (! CCVal($form->cc, $form->cctype)) {
-               $this->errormsg = get_string("ccinvalid", "enrol_authorize");
+    global $CFG, $USER, $SESSION;
+    require_once($CFG->dirroot . '/enrol/authorize/ccval.php');
+
+    if (empty($form->ccfirstname) || empty($form->cclastname) ||
+       empty($form->cc) || empty($form->cvv) || empty($form->cctype) ||
+       empty($form->ccexpiremm) || empty($form->ccexpireyyyy)) {
+               $this->errormsg = get_string("allfieldsrequired");
+               return;
+       }
+
+    if (! CCVal($form->cc, $form->cctype)) {
+       $this->errormsg = get_string("ccinvalid", "enrol_authorize");
        return;
-       }
-       
-       $this->check_paid();
-       $order_number = 0; // can be get from db
-       $formdata = array (
-               'x_version'                     => '3.1',
-               'x_delim_data'          => 'True',
-               'x_delim_char'          => AN_DELIM,
-               'x_encap_char'          => AN_ENCAP,
-               'x_relay_response'      => 'False',
-               'x_login'                       => $CFG->an_login,
-               'x_test_request'        => (!empty($CFG->an_test)) ? 'True' : 'False',
-               'x_type'                        => 'AUTH_CAPTURE',
-               'x_method'                      => 'CC',
-               // user
-               'x_first_name'          => (empty($form->ccfirstname) ? $USER->firstname : $form->ccfirstname),
-               'x_last_name'           => (empty($form->cclastname) ? $USER->lastname : $form->cclastname),
-               'x_address'                     => $USER->address,
-               'x_city'                        => $USER->city,
-               'x_state'                       => '',
-               'x_zip'                         => $form->cczip,
-               'x_country'                     => $USER->country,
-               'x_card_num'            => $form->cc,
-               'x_card_code'           => $form->cvv,
-               'x_currency_code'       => $CFG->enrol_currency,
-               'x_amount'                      => $this->get_cource_cost($course),
-               'x_exp_date'            => (($form->ccexpiremm<10) ? strval('0'.$form->ccexpiremm) : strval($form->ccexpiremm)) . ($form->ccexpireyyyy),
-               'x_email'                       => $USER->email,
-               'x_email_customer'      => 'False',
-               'x_cust_id'                     => $USER->id,
-               'x_customer_ip'         => $_SERVER["REMOTE_ADDR"],
-               'x_phone'                       => '',
-               'x_fax'                         => '',
-               'x_invoice_num'         => $order_number,
-               'x_description'         => $course->shortname
-       );
-
-       //build the post string
-       $poststring = '';
-       if (!empty($CFG->an_tran_key)) {
-               $poststring .= urlencode("x_tran_key") . "=" . urlencode($CFG->an_tran_key);
-       } else {
-               $an_pswd = (isset($CFG->an_password)) ? $CFG->an_password : '';
-               $poststring .= urlencode("x_password") . "=" . urlencode($an_pswd);
-       }
-       foreach($formdata as $key => $val) {
-               $poststring .= "&" . urlencode($key) . "=" . urlencode($val);
-       }
-       //built
-
-       $response = array();
-       $anrefererheader = "";          
-       if (isset($CFG->an_referer) && (!empty($CFG->an_referer)) &&
-       ($CFG->an_referer != "http://") && ($CFG->an_referer != "https://")) {
-               $anrefererheader = "Referer: " . $CFG->an_referer . "\r\n";
-       }
-       $fp = fsockopen("ssl://" . AN_HOST, AN_PORT, $errno, $errstr, 60);
-       if(!$fp) {
-               $this->errormsg =  "$errstr ($errno)";
-               return;
-       } else {
-               //send the server request
-               fputs($fp,
-                       "POST " . AN_PATH . " HTTP/1.1\r\n" .
-                       "Host: " . AN_HOST . "\r\n" . 
-                       $anrefererheader .
-                       "Content-type: application/x-www-form-urlencoded\r\n" .
-                       "Content-length: " . strlen($poststring) . "\r\n" .
-                       "Connection: close\r\n\r\n" .
-                       $poststring . "\r\n\r\n");
-
-               //Get the response header from the server
-               $str = '';
-               while(!feof($fp) && !stristr($str, 'content-length')) {
-                       $str = fgets($fp, 4096);
-               }
-               // If didnt get content-lenght, something is wrong.
-               if (!stristr($str, 'content-length')) {
-                       $this->errormsg =  "content-length error";
-                       return;
-               }
+    }
+    
+    $this->check_paid();
+    $order_number = 0; // can be get from db
+    $formdata = array (
+       'x_version'                     => '3.1',
+       'x_delim_data'          => 'True',
+       'x_delim_char'          => AN_DELIM,
+       'x_encap_char'          => AN_ENCAP,
+       'x_relay_response'      => 'False',
+       'x_login'                       => $CFG->an_login,
+       'x_test_request'        => (!empty($CFG->an_test)) ? 'True' : 'False',
+       'x_type'                        => 'AUTH_CAPTURE',
+       'x_method'                      => 'CC',
+       // user
+       'x_first_name'          => (empty($form->ccfirstname) ? $USER->firstname : $form->ccfirstname),
+       'x_last_name'           => (empty($form->cclastname) ? $USER->lastname : $form->cclastname),
+       'x_address'                     => $USER->address,
+       'x_city'                        => $USER->city,
+       'x_state'                       => '',
+       'x_zip'                         => $form->cczip,
+       'x_country'                     => $USER->country,
+       'x_card_num'            => $form->cc,
+       'x_card_code'           => $form->cvv,
+       'x_currency_code'       => $CFG->enrol_currency,
+       'x_amount'                      => $this->get_cource_cost($course),
+       'x_exp_date'            => (($form->ccexpiremm<10) ? strval('0'.$form->ccexpiremm) : strval($form->ccexpiremm)) . ($form->ccexpireyyyy),
+       'x_email'                       => $USER->email,
+       'x_email_customer'      => 'False',
+       'x_cust_id'                     => $USER->id,
+       'x_customer_ip'         => $_SERVER["REMOTE_ADDR"],
+       'x_phone'                       => '',
+       'x_fax'                         => '',
+       'x_invoice_num'         => $order_number,
+       'x_description'         => $course->shortname
+    );
+
+    //build the post string
+    $poststring = '';
+    if (!empty($CFG->an_tran_key)) {
+       $poststring .= urlencode("x_tran_key") . "=" . urlencode($CFG->an_tran_key);
+    } else {
+       $an_pswd = (isset($CFG->an_password)) ? $CFG->an_password : '';
+       $poststring .= urlencode("x_password") . "=" . urlencode($an_pswd);
+    }
+    foreach($formdata as $key => $val) {
+       $poststring .= "&" . urlencode($key) . "=" . urlencode($val);
+    }
+    //built
+
+    $response = array();
+    $anrefererheader = "";     
+    if (isset($CFG->an_referer) && (!empty($CFG->an_referer)) &&
+    ($CFG->an_referer != "http://") && ($CFG->an_referer != "https://")) {
+       $anrefererheader = "Referer: " . $CFG->an_referer . "\r\n";
+    }
+    $fp = fsockopen("ssl://" . AN_HOST, AN_PORT, $errno, $errstr, 60);
+    if(!$fp) {
+       $this->errormsg =  "$errstr ($errno)";
+       return;
+    } else {
+       //send the server request
+       fputs($fp,
+               "POST " . AN_PATH . " HTTP/1.1\r\n" .
+               "Host: " . AN_HOST . "\r\n" . 
+               $anrefererheader .
+               "Content-type: application/x-www-form-urlencoded\r\n" .
+               "Content-length: " . strlen($poststring) . "\r\n" .
+               "Connection: close\r\n\r\n" .
+               $poststring . "\r\n\r\n");
+
+       //Get the response header from the server
+       $str = '';
+       while(!feof($fp) && !stristr($str, 'content-length')) {
+               $str = fgets($fp, 4096);
+       }
+       // If didnt get content-lenght, something is wrong.
+       if (!stristr($str, 'content-length')) {
+               $this->errormsg =  "content-length error";
+               return;
+       }
        
-               // Get length of data to be received.
-               $length = trim(substr($str,strpos($str,'content-length') + 15));
-               // Get buffer (blank data before real data)
-               fgets($fp, 4096);
-               // Get real data
-               $data = fgets($fp, $length);
-               fclose($fp);
-               $response = explode(AN_ENCAP.AN_DELIM.AN_ENCAP, $data);
-               if ($response === false)
-               {
-                       $this->errormsg = "response error";
-                       return;
-               }
-               $rcount = count($response) - 1;
-               if ($response[0]{0} == AN_ENCAP) {
-                       $response[0] = substr($response[0], 1);
-               }
-               if (substr($response[$rcount], -1) == AN_ENCAP) {
-                       $response[$rcount] = substr($response[$rcount], 0, -1);
-               }
-       }
-
-       if ($response[0] != AN_APPROVED) {
-               $this->errormsg = isset($response[3]) ? $response[3] : 'unknown error';
-       } else {
-               $SESSION->ccpaid = 1; // security check: don't duplicate payment
-               if ($course->enrolperiod) {
-                       $timestart = time();
-                       $timeend   = $timestart + $course->enrolperiod;
-               } else {
-                       $timestart = $timeend = 0;
-               }
-
-               if (!enrol_student($USER->id, $course->id, $timestart, $timeend)) {
-                       $this->email_cc_error_to_admin("Error while trying to enrol ".fullname($USER)." in '$course->fullname'", $response);
-               } else {
-                       // begin: send email
-                       $teacher = get_teacher($course->id);
-                       if (!empty($CFG->enrol_mailstudents)) {
-                               $a->coursename = "$course->fullname";
-                               $a->profileurl = "$CFG->wwwroot/user/view.php?id=$user->id";
-                               email_to_user($USER, $teacher, get_string("enrolmentnew", '', $course->shortname),
-                               get_string('welcometocoursetext', '', $a));
-                       }
-                       if (!empty($CFG->enrol_mailteachers)) {
-                               $a->course = "$course->fullname";
-                               $a->user = fullname($USER);
-                               email_to_user($teacher, $USER, get_string("enrolmentnew", '', $course->shortname),
-                               get_string('enrolmentnewuser', '', $a));
-                       }
-                       if (!empty($CFG->enrol_mailadmins)) {
-                               $a->course = "$course->fullname";
-                               $a->user = fullname($USER);
-                               $admins = get_admins();
-                               foreach ($admins as $admin) {
-                                       email_to_user($admin, $USER, get_string("enrolmentnew", '', $course->shortname),
-                                       get_string('enrolmentnewuser', '', $a));
-                               }
-                       }
-                       // end: send email
-
-                       // begin: authorize_table
-                       $cclast4 = substr($form->cc, -4);
-                       $datax->cclastfour = ($cclast4 === false) ? '0000' : $cclast4;
-                       $datax->ccexp = $formdata['x_exp_date'];
-                       $datax->cvv = $form->cvv;
-                       $datax->ccname = $formdata['x_first_name'] . " " . $formdata['x_last_name'];
-                       $datax->courseid = $course->id;
-                       $datax->userid = $USER->id;
-                       $datax->avscode = strval($response[5]);
-                       $datax->transid = strval($response[6]);
-                       if (!insert_record("enrol_authorize", $datax)) {        // Insert a transaction record
-                               $this->email_cc_error_to_admin("Error while trying to insert valid transaction", $datax);
-                       }
-
-               } // end if (!enrol_student)
-
-               if ($SESSION->wantsurl) {
-                       $destination = $SESSION->wantsurl;
-                       unset($SESSION->wantsurl);
-               } else {
-                       $destination = "$CFG->wwwroot/course/view.php?id=$course->id";
-               }
-               redirect($destination);
-       }
+       // Get length of data to be received.
+       $length = trim(substr($str,strpos($str,'content-length') + 15));
+       // Get buffer (blank data before real data)
+       fgets($fp, 4096);
+       // Get real data
+       $data = fgets($fp, $length);
+       fclose($fp);
+       $response = explode(AN_ENCAP.AN_DELIM.AN_ENCAP, $data);
+       if ($response === false)
+       {
+               $this->errormsg = "response error";
+               return;
+       }
+       $rcount = count($response) - 1;
+       if ($response[0]{0} == AN_ENCAP) {
+               $response[0] = substr($response[0], 1);
+       }
+       if (substr($response[$rcount], -1) == AN_ENCAP) {
+               $response[$rcount] = substr($response[$rcount], 0, -1);
+       }
+    }
+
+    if ($response[0] != AN_APPROVED) {
+       $this->errormsg = isset($response[3]) ? $response[3] : 'unknown error';
+    } else {
+       $SESSION->ccpaid = 1; // security check: don't duplicate payment
+       if ($course->enrolperiod) {
+               $timestart = time();
+               $timeend   = $timestart + $course->enrolperiod;
+       } else {
+               $timestart = $timeend = 0;
+       }
+
+       if (!enrol_student($USER->id, $course->id, $timestart, $timeend)) {
+               $this->email_cc_error_to_admin("Error while trying to enrol ".fullname($USER)." in '$course->fullname'", $response);
+       } else {
+               // begin: send email
+               $teacher = get_teacher($course->id);
+               if (!empty($CFG->enrol_mailstudents)) {
+                       $a->coursename = "$course->fullname";
+                       $a->profileurl = "$CFG->wwwroot/user/view.php?id=$user->id";
+                       email_to_user($USER, $teacher, get_string("enrolmentnew", '', $course->shortname),
+                       get_string('welcometocoursetext', '', $a));
+               }
+               if (!empty($CFG->enrol_mailteachers)) {
+                       $a->course = "$course->fullname";
+                       $a->user = fullname($USER);
+                       email_to_user($teacher, $USER, get_string("enrolmentnew", '', $course->shortname),
+                       get_string('enrolmentnewuser', '', $a));
+               }
+               if (!empty($CFG->enrol_mailadmins)) {
+                       $a->course = "$course->fullname";
+                       $a->user = fullname($USER);
+                       $admins = get_admins();
+                       foreach ($admins as $admin) {
+                               email_to_user($admin, $USER, get_string("enrolmentnew", '', $course->shortname),
+                               get_string('enrolmentnewuser', '', $a));
+                       }
+               }
+               // end: send email
+
+               // begin: authorize_table
+               $cclast4 = substr($form->cc, -4);
+               $datax->cclastfour = ($cclast4 === false) ? '0000' : $cclast4;
+               $datax->ccexp = $formdata['x_exp_date'];
+               $datax->cvv = $form->cvv;
+               $datax->ccname = $formdata['x_first_name'] . " " . $formdata['x_last_name'];
+               $datax->courseid = $course->id;
+               $datax->userid = $USER->id;
+               $datax->avscode = strval($response[5]);
+               $datax->transid = strval($response[6]);
+               if (!insert_record("enrol_authorize", $datax)) {        // Insert a transaction record
+                       $this->email_cc_error_to_admin("Error while trying to insert valid transaction", $datax);
+               }
+
+       } // end if (!enrol_student)
+
+       if ($SESSION->wantsurl) {
+               $destination = $SESSION->wantsurl;
+               unset($SESSION->wantsurl);
+       } else {
+               $destination = "$CFG->wwwroot/course/view.php?id=$course->id";
+       }
+       redirect($destination);
+    }
 }
 
 function zero_cost($course) {
 
-       $cost = $this->get_cource_cost($course);
-       if (abs($cost) < 0.01) { // no cost
-               return true;
-       }
-       return false;
+    $cost = $this->get_cource_cost($course);
+    if (abs($cost) < 0.01) { // no cost
+       return true;
+    }
+    return false;
 }
 
 function get_cource_cost($course) {
-       global $CFG;
-       $cost = (float)0;
+    global $CFG;
+    $cost = (float)0;
 
-       if (isset($course->cost)) {
-               if (((float)$course->cost) < 0) {
-                       $cost = (float)$CFG->enrol_cost;
+    if (isset($course->cost)) {
+       if (((float)$course->cost) < 0) {
+               $cost = (float)$CFG->enrol_cost;
        } else {
-                       $cost = (float)$course->cost;
-               }       
-       }
-       $cost = format_float($cost, 2);
-       return $cost;
+               $cost = (float)$course->cost;
+       }       
+    }
+    $cost = format_float($cost, 2);
+    return $cost;
 }
 
 /// Override the get_access_icons() function
 function get_access_icons($course) {
-       global $CFG;
-
-       $str = '';
-       $cost = $this->get_cource_cost($course);
-
-       if (abs($cost) < 0.01) {
-               $str = parent::get_access_icons($course);
-       } else {
-               $strrequirespayment = get_string("requirespayment");
-               $strcost = get_string("cost");
-
-               if (empty($CFG->enrol_currency)) {
-                       set_config('enrol_currency', 'USD');
-               }
-
-               switch ($CFG->enrol_currency) {
-               case 'EUR':     $currency = '&euro;'; break;
-               case 'CAD':     $currency = '$'; break;
-               case 'GBP':     $currency = '&pound;'; break;
-               case 'JPY':     $currency = '&yen;'; break;
-               default:        $currency = '$'; break;
+    global $CFG;
+
+    $str = '';
+    $cost = $this->get_cource_cost($course);
+
+    if (abs($cost) < 0.01) {
+       $str = parent::get_access_icons($course);
+    } else {
+       $strrequirespayment = get_string("requirespayment");
+       $strcost = get_string("cost");
+
+       if (empty($CFG->enrol_currency)) {
+               set_config('enrol_currency', 'USD');
+       }
+
+       switch ($CFG->enrol_currency) {
+       case 'EUR':     $currency = '&euro;'; break;
+       case 'CAD':     $currency = '$'; break;
+       case 'GBP':     $currency = '&pound;'; break;
+       case 'JPY':     $currency = '&yen;'; break;
+       default:        $currency = '$'; break;
         }
 
         $str .= "<p class=\"coursecost\"><font size=-1>$strcost: " .
-                               "<a title=\"$strrequirespayment\" href=\"$CFG->wwwroot/course/view.php?id=$course->id\"></a>" .
-                               "$currency" . format_float($cost, 2) . '</a></p>';
-       }
-       return $str;
+                       "<a title=\"$strrequirespayment\" href=\"$CFG->wwwroot/course/view.php?id=$course->id\"></a>" .
+                       "$currency" . format_float($cost, 2) . '</a></p>';
+    }
+    return $str;
 }
 
 
 function config_form($frm) {
-       global $CFG;
-       $ancurrencies = array(
-               'USD' => 'US Dollars',
-               'EUR' => 'Euros',
-               'JPY' => 'Japanese Yen',
-               'GBP' => 'British Pounds',
-               'CAD' => 'Canadian Dollars'
-       );
-
-       $vars = array('enrol_cost', 'enrol_currency', 'an_login', 'an_tran_key', 'an_password', 'an_referer', 'an_test',
-                                 'enrol_mailstudents', 'enrol_mailteachers', 'enrol_mailadmins', 'enrol_allowinternal');
-       foreach ($vars as $var) {
-               if (!isset($frm->$var)) {
-                       $frm->$var = '';
-               }
-       }
-
-       $this->check_openssl_loaded(false);
-       include("$CFG->dirroot/enrol/authorize/config.html");
+    global $CFG;
+    $ancurrencies = array(
+       'USD' => 'US Dollars',
+       'EUR' => 'Euros',
+       'JPY' => 'Japanese Yen',
+       'GBP' => 'British Pounds',
+       'CAD' => 'Canadian Dollars'
+    );
+
+    $vars = array('enrol_cost', 'enrol_currency', 'an_login', 'an_tran_key', 'an_password', 'an_referer', 'an_test',
+                         'enrol_mailstudents', 'enrol_mailteachers', 'enrol_mailadmins', 'enrol_allowinternal');
+    foreach ($vars as $var) {
+       if (!isset($frm->$var)) {
+               $frm->$var = '';
+       }
+    }
+
+    $this->check_openssl_loaded(false);
+    include("$CFG->dirroot/enrol/authorize/config.html");
 }
 
 function check_openssl_loaded($die)
 {
-       if (!extension_loaded('openssl')) {
-               echo "<font color=red><center>PHP must be compiled --with-openssl</center></font>";
-               if ($die) {
-                       die;
-               }
-       }
+    if (!extension_loaded('openssl')) {
+       echo "<font color=red><center>PHP must be compiled --with-openssl</center></font>";
+       if ($die) {
+               die;
+       }
+    }
 }
 
 function process_config($config) {
 
-       $this->check_openssl_loaded(true);
-       if (!isset($config->an_login)) {
-               $config->an_login = '';
-       }
-       set_config('an_login', $config->an_login);
-
-       if (!isset($config->an_password)) {
-               $config->an_password = '';
-       }
-       set_config('an_password', $config->an_password);
-
-       if (!isset($config->an_tran_key)) {
-               $config->an_tran_key = '';
-       }
-       set_config('an_tran_key', $config->an_tran_key);
-
-       // Some required fields
-       if (empty($config->an_login)) {
-               echo "an_login required";
-               die;    
-       }
-       if (empty($config->an_tran_key) && empty($config->an_password)) {
-               echo "an_tran_key or an_password required";
-               die;    
-       }
-
-       if (empty($config->an_referer)) {
-               $config->an_referer = 'http://';
-       }
-       set_config('an_referer', $config->an_referer);
-
-       if (!isset($config->an_test)) {
-               $config->an_test = '';
-       }
-       set_config('an_test', $config->an_test);
-
-       // --------------------------------------
-       if (!isset($config->enrol_cost)) {
-               $config->enrol_cost = '0';
-       }
-       set_config('enrol_cost', $config->enrol_cost);
-
-       if (!isset($config->enrol_currency)) {
-               $config->enrol_currency = 'USD';
-       }
-       set_config('enrol_currency', $config->enrol_currency);
-
-       if (!isset($config->enrol_mailstudents)) {
-               $config->enrol_mailstudents = '';
-       }
-       set_config('enrol_mailstudents', $config->enrol_mailstudents);
-
-       if (!isset($config->enrol_mailteachers)) {
-               $config->enrol_mailteachers = '';
-       }
-       set_config('enrol_mailteachers', $config->enrol_mailteachers);
-
-       if (!isset($config->enrol_mailadmins)) {
-               $config->enrol_mailadmins = '';
-       }
-       set_config('enrol_mailadmins', $config->enrol_mailadmins);
-
-       if (!isset($config->enrol_allowinternal)) {
-               $config->enrol_allowinternal = '';
-       }
-       set_config('enrol_allowinternal', $config->enrol_allowinternal);
-
-       return true;
+    $this->check_openssl_loaded(true);
+    if (!isset($config->an_login)) {
+       $config->an_login = '';
+    }
+    set_config('an_login', $config->an_login);
+
+    if (!isset($config->an_password)) {
+       $config->an_password = '';
+    }
+    set_config('an_password', $config->an_password);
+
+    if (!isset($config->an_tran_key)) {
+       $config->an_tran_key = '';
+    }
+    set_config('an_tran_key', $config->an_tran_key);
+
+    // Some required fields
+    if (empty($config->an_login)) {
+       echo "an_login required";
+       die;    
+    }
+    if (empty($config->an_tran_key) && empty($config->an_password)) {
+       echo "an_tran_key or an_password required";
+       die;    
+    }
+
+    if (empty($config->an_referer)) {
+       $config->an_referer = 'http://';
+    }
+    set_config('an_referer', $config->an_referer);
+
+    if (!isset($config->an_test)) {
+       $config->an_test = '';
+    }
+    set_config('an_test', $config->an_test);
+
+    // --------------------------------------
+    if (!isset($config->enrol_cost)) {
+       $config->enrol_cost = '0';
+    }
+    set_config('enrol_cost', $config->enrol_cost);
+
+    if (!isset($config->enrol_currency)) {
+       $config->enrol_currency = 'USD';
+    }
+    set_config('enrol_currency', $config->enrol_currency);
+
+    if (!isset($config->enrol_mailstudents)) {
+       $config->enrol_mailstudents = '';
+    }
+    set_config('enrol_mailstudents', $config->enrol_mailstudents);
+
+    if (!isset($config->enrol_mailteachers)) {
+       $config->enrol_mailteachers = '';
+    }
+    set_config('enrol_mailteachers', $config->enrol_mailteachers);
+
+    if (!isset($config->enrol_mailadmins)) {
+       $config->enrol_mailadmins = '';
+    }
+    set_config('enrol_mailadmins', $config->enrol_mailadmins);
+
+    if (!isset($config->enrol_allowinternal)) {
+       $config->enrol_allowinternal = '';
+    }
+    set_config('enrol_allowinternal', $config->enrol_allowinternal);
+
+    return true;
 }
 
 function email_cc_error_to_admin($subject, $data) {
-       $admin = get_admin();
-       $site = get_admin();
-
-       $message = "$site->fullname:  Transaction failed.\n\n$subject\n\n";
-       foreach ($data as $key => $value) {
-               $message .= "$key => $value\n";
-       }
-       email_to_user($admin, $admin, "CC ERROR: ".$subject, $message);
+    $admin = get_admin();
+    $site = get_admin();
+
+    $message = "$site->fullname:  Transaction failed.\n\n$subject\n\n";
+    foreach ($data as $key => $value) {
+       $message .= "$key => $value\n";
+    }
+    email_to_user($admin, $admin, "CC ERROR: ".$subject, $message);
 }
 
 function check_paid() {
 
-       global $CFG, $SESSION;
+    global $CFG, $SESSION;
 
-       if (isset($SESSION->ccpaid)) {
-               unset($SESSION->ccpaid);
-               redirect($CFG->wwwroot . '/login/logout.php');
-               exit;           
-       }
+    if (isset($SESSION->ccpaid)) {
+       unset($SESSION->ccpaid);
+       redirect($CFG->wwwroot . '/login/logout.php');
+       exit;           
+    }
 }
 
 } // end of class definition
-?>
\ No newline at end of file
+?>
index 089eee6..9de07d3 100644 (file)
@@ -1,7 +1,7 @@
 <table cellspacing="0" cellpadding="5" border="0" align="center">
 <tr valign="top">
-       <td align="right">enrol_dbtype:</td>
-       <td>
+    <td align="right">enrol_dbtype:</td>
+    <td>
     <?php  
        $dbtypes = array("access","ado_access", "ado", "ado_mssql", "borland_ibase", "csv", "db2", "fbsql", "firebird", "ibase", "informix72", "informix", "mssql", "mysql", "mysqlt", "oci805", "oci8", "oci8po", "odbc", "odbc_mssql", "odbc_oracle", "oracle", "postgres64", "postgres7", "postgres", "proxy", "sqlanywhere", "sybase", "vfp");
        foreach ($dbtypes as $dbtype) {
@@ -20,8 +20,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">enrol_dbhost:</td>
-       <td>
+    <td align="right">enrol_dbhost:</td>
+    <td>
     <?php 
         if (!isset($frm->enrol_dbhost)) {
             $frm->enrol_dbhost = '';
@@ -35,8 +35,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">enrol_dbuser:</td>
-       <td>
+    <td align="right">enrol_dbuser:</td>
+    <td>
         <input size="15" type="text" name="enrol_dbuser" value="<?php echo $frm->enrol_dbuser ?>" />
     </td>
     <td>
@@ -45,8 +45,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">enrol_dbpass:</td>
-       <td>
+    <td align="right">enrol_dbpass:</td>
+    <td>
         <input size="15" type="text" name="enrol_dbpass" value="<?php echo $frm->enrol_dbpass ?>" />
     </td>
     <td>
@@ -55,8 +55,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">enrol_dbname:</td>
-       <td>
+    <td align="right">enrol_dbname:</td>
+    <td>
         <input size="15" type="text" name="enrol_dbname" value="<?php echo $frm->enrol_dbname ?>" />
     </td>
     <td>
@@ -65,8 +65,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">enrol_dbtable:</td>
-       <td>
+    <td align="right">enrol_dbtable:</td>
+    <td>
         <input size="15" type="text" name="enrol_dbtable" value="<?php echo $frm->enrol_dbtable ?>" />
     </td>
     <td>
@@ -75,8 +75,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">enrol_localcoursefield:</td>
-       <td>
+    <td align="right">enrol_localcoursefield:</td>
+    <td>
         <input size="15" type="text" name="enrol_localcoursefield" value="<?php echo $frm->enrol_localcoursefield ?>" />
     </td>
     <td>
@@ -85,8 +85,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">enrol_localuserfield:</td>
-       <td>
+    <td align="right">enrol_localuserfield:</td>
+    <td>
         <input size="15" type="text" name="enrol_localuserfield" value="<?php echo $frm->enrol_localuserfield ?>" />
     </td>
     <td>
@@ -95,8 +95,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">enrol_remotecoursefield:</td>
-       <td>
+    <td align="right">enrol_remotecoursefield:</td>
+    <td>
         <input size="15" type="text" name="enrol_remotecoursefield" value="<?php echo $frm->enrol_remotecoursefield ?>" />
     </td>
     <td>
 </tr>
 
 <tr valign="top">
-       <td align="right">enrol_remoteuserfield:</td>
-       <td>
+    <td align="right">enrol_remoteuserfield:</td>
+    <td>
         <input size="15" type="text" name="enrol_remoteuserfield" value="<?php echo $frm->enrol_remoteuserfield ?>" />
     </td>
     <td>
 </tr>
 
 <tr valign="top">
-       <td align="right">enrol_allowinternal:</td>
-       <td>
+    <td align="right">enrol_allowinternal:</td>
+    <td>
         <input type="checkbox" name="enrol_allowinternal" <?php if ($frm->enrol_allowinternal) echo "checked=\"true\"" ?> />
     </td>
     <td>
index 0cfed7b..19d3aa0 100644 (file)
@@ -1,8 +1,8 @@
 <table cellspacing="0" cellpadding="5" border="0" align="center">
 
 <tr valign="top">
-       <td align="right">enrol_flatfilelocation:</td>
-       <td>
+    <td align="right">enrol_flatfilelocation:</td>
+    <td>
         <input type="text" size="20" name="enrol_flatfilelocation" value="<?php echo $frm->enrol_flatfilelocation ?>" />
     </td>
     <td>
@@ -11,8 +11,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">enrol_mailstudents:</td>
-       <td>
+    <td align="right">enrol_mailstudents:</td>
+    <td>
         <input type="checkbox" value="1" name="enrol_mailstudents" <?php if ($frm->enrol_mailstudents) echo "checked=\"true\"" ?> />
     </td>
     <td>
@@ -21,8 +21,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">enrol_mailteachers:</td>
-       <td>
+    <td align="right">enrol_mailteachers:</td>
+    <td>
         <input type="checkbox" value="1" name="enrol_mailteachers" <?php if ($frm->enrol_mailteachers) echo "checked=\"true\"" ?> />
     </td>
     <td>
@@ -31,8 +31,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">enrol_mailadmins:</td>
-       <td>
+    <td align="right">enrol_mailadmins:</td>
+    <td>
         <input type="checkbox" value="1" name="enrol_mailadmins" <?php if ($frm->enrol_mailadmins) echo "checked=\"true\"" ?> />
     </td>
     <td>
@@ -41,8 +41,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">enrol_allowinternal:</td>
-       <td>
+    <td align="right">enrol_allowinternal:</td>
+    <td>
         <input type="checkbox" value="1" name="enrol_allowinternal" <?php if ($frm->enrol_allowinternal) echo "checked=\"true\"" ?> />
     </td>
     <td>
index 7b0b6ad..71140e8 100755 (executable)
@@ -39,25 +39,25 @@ optional_variable($frm->enrol_ldap_template, '');
    </td>
 </tr>
 <tr valign="top">
-       <td align="right">enrol_ldap_host_url:</td>
-       <td>
+    <td align="right">enrol_ldap_host_url:</td>
+    <td>
         <input name="enrol_ldap_host_url" TYPE="text" SIZE="30" value="<?php echo $frm->enrol_ldap_host_url?>">
-       <?php  if (isset($err["enrol_ldap_host_url"])) formerr($err["enrol_ldap_host_url"]); ?>
-       </td>
+    <?php  if (isset($err["enrol_ldap_host_url"])) formerr($err["enrol_ldap_host_url"]); ?>
+    </td>
     <td>
     <?php  print_string("enrol_ldap_host_url","enrol_ldap") ?>
     </td>
 </tr>
 <tr valign="top">
-       <td align="right">enrol_ldap_version:</td>
-       <td>
+    <td align="right">enrol_ldap_version:</td>
+    <td>
     <?php
        $versions[2] = "2";
        $versions[3] = "3";
        choose_from_menu($versions, "enrol_ldap_version", $frm->enrol_ldap_version, "");
-          if (isset($err["enrol_ldap_version"])) formerr($err["enrol_ldap_version"]); 
+        if (isset($err["enrol_ldap_version"])) formerr($err["enrol_ldap_version"]); 
     ?>
-       </td>
+    </td>
     <td>
     <?php  print_string("enrol_ldap_version","enrol_ldap") ?>
     </td>
@@ -89,8 +89,8 @@ optional_variable($frm->enrol_ldap_template, '');
    </td>
 </tr>
 <tr valign="top">
-       <td align="right">enrol_ldap_student_contexts:</td>
-       <td>
+    <td align="right">enrol_ldap_student_contexts:</td>
+    <td>
     <input name="enrol_ldap_student_contexts" TYPE="text" SIZE="30 "value="<?php echo $frm->enrol_ldap_student_contexts?>">
     <?php  if (isset($err["enrol_ldap_student_contexts"])) formerr($err["enrol_ldap_student_contexts"]); ?>
     </td>
@@ -114,8 +114,8 @@ optional_variable($frm->enrol_ldap_template, '');
    </td>
 </tr>
 <tr valign="top">
-       <td align="right">enrol_ldap_teacher_contexts:</td>
-       <td>
+    <td align="right">enrol_ldap_teacher_contexts:</td>
+    <td>
     <input name="enrol_ldap_teacher_contexts" TYPE="text" SIZE="30 "value="<?php echo $frm->enrol_ldap_teacher_contexts?>">
     <?php  if (isset($err["enrol_ldap_teacher_contexts"])) formerr($err["enrol_ldap_teacher_contexts"]); ?>
     </td>
@@ -253,13 +253,13 @@ optional_variable($frm->enrol_ldap_template, '');
    </td>
 </tr>
 <tr valign="top">
-       <td align="right">enrol_ldap_autocreate:</td>
-       <td>
+    <td align="right">enrol_ldap_autocreate:</td>
+    <td>
     <?php
        choose_from_menu(array('0'=>'no','1'=>'yes'), "enrol_ldap_autocreate", $frm->enrol_ldap_autocreate, "");
-          if (isset($err["enrol_ldap_autocreate"])) formerr($err["enrol_ldap_autocreate"]); 
+           if (isset($err["enrol_ldap_autocreate"])) formerr($err["enrol_ldap_autocreate"]); 
     ?>
-       </td>
+    </td>
     <td>
     <?php  print_string("enrol_ldap_autocreate","enrol_ldap") ?>
     </td>
index bf78a98..84f42d0 100644 (file)
@@ -1,8 +1,8 @@
 <table cellspacing="0" cellpadding="5" border="0" align="center">
 
 <tr valign="top">
-       <td align="right">enrol_cost:</td>
-       <td>
+    <td align="right">enrol_cost:</td>
+    <td>
         <input type="text" size="5" name="enrol_cost" value="<?php echo $frm->enrol_cost ?>" />
     </td>
     <td>
@@ -11,8 +11,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">enrol_currency:</td>
-       <td>
+    <td align="right">enrol_currency:</td>
+    <td>
     <?php choose_from_menu ($paypalcurrencies, "enrol_currency", $frm->enrol_currency, "","", "") ?>
     </td>
     <td>
@@ -21,8 +21,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">enrol_paypalbusiness:</td>
-       <td>
+    <td align="right">enrol_paypalbusiness:</td>
+    <td>
         <input type="text" name="enrol_paypalbusiness" value="<?php echo $frm->enrol_paypalbusiness ?>" />
     </td>
     <td>
@@ -31,8 +31,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">enrol_mailstudents:</td>
-       <td>
+    <td align="right">enrol_mailstudents:</td>
+    <td>
         <input type="checkbox" value="1" name="enrol_mailstudents" <?php if ($frm->enrol_mailstudents) echo "checked=\"true\"" ?> />
     </td>
     <td>
@@ -41,8 +41,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">enrol_mailteachers:</td>
-       <td>
+    <td align="right">enrol_mailteachers:</td>
+    <td>
         <input type="checkbox" value="1" name="enrol_mailteachers" <?php if ($frm->enrol_mailteachers) echo "checked=\"true\"" ?> />
     </td>
     <td>
@@ -51,8 +51,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">enrol_mailadmins:</td>
-       <td>
+    <td align="right">enrol_mailadmins:</td>
+    <td>
         <input type="checkbox" value="1" name="enrol_mailadmins" <?php if ($frm->enrol_mailadmins) echo "checked=\"true\"" ?> />
     </td>
     <td>
index 6ab1e79..804e832 100755 (executable)
@@ -69,16 +69,16 @@ sub nexttoken {
   my($p1) = pos($self->{string}) || 0;
   if(scalar($self->{string} =~ m/\G$tokenregexp/gc)) {
         push @{$self->{posarray}}, [$p1, pos($self->{string})];
-       if (defined($1)) {return ['binop3',  $1];}
-       if (defined($2)) {return ['binop2',  $2];}
-       if (defined($3)) {return ['binop1',  $3];}
-       if (defined($4)) {return ['openp',   $4];}
-       if (defined($5)) {return ['closep',  $5];}
-       if (defined($6)) {return ['func1',   $6];}
-       if (defined($7)) {return ['special', $7];}
-       if (defined($8)) {return ['varname', $8];}
-       if (defined($9)) {return ['numberE', $9];}
-       if (defined($10)) {return ['number', $10];}
+        if (defined($1)) {return ['binop3',  $1];}
+        if (defined($2)) {return ['binop2',  $2];}
+        if (defined($3)) {return ['binop1',  $3];}
+        if (defined($4)) {return ['openp',   $4];}
+        if (defined($5)) {return ['closep',  $5];}
+        if (defined($6)) {return ['func1',   $6];}
+        if (defined($7)) {return ['special', $7];}
+        if (defined($8)) {return ['varname', $8];}
+        if (defined($9)) {return ['numberE', $9];}
+        if (defined($10)) {return ['number', $10];}
   }
   else {
     push @{$self->{posarray}}, [$p1, undef];
@@ -120,7 +120,7 @@ sub parse {
         while (${$currentref}->[0] !~ /^(openp|top)/) {
           $currentref = pop @backtrace;
         }
-       my $index = ((${$currentref}->[0] eq 'top')?1:3);
+        my $index = ((${$currentref}->[0] eq 'top')?1:3);
         ${$currentref}->[$index] = ['binop1', $currenttok->[1],
                                     ${$currentref}->[$index], undef];
         push @backtrace, $currentref;
@@ -550,12 +550,12 @@ sub tolatex {
     if ($args[1]->[0] =~ /binop1|numberE/)
       {($p1,$p2)=qw{ \left( \right) };}
  #   if ($args[2]->[0] =~ /binop[12]|numberE/)
-       if ($args[2]->[0] =~ /binop[12]|numberE|unop1/)
+        if ($args[2]->[0] =~ /binop[12]|numberE|unop1/)
       {($p3,$p4)=qw{ \left( \right) };}
     if ($args[0] eq '/'){
 #      return('\frac{' . $p1 . $args[1]->tolatex() . $p2 . '}'.
 #               '{' . $p3 . $args[2]->tolatex() . $p4 . '}' );
-       return('\frac{' . $args[1]->tolatex() . '}'.
+        return('\frac{' . $args[1]->tolatex() . '}'.
                '{' . $args[2]->tolatex() . '}' ); 
     }
     else{
index 4883263..3077f51 100644 (file)
       $algebra = substr($query,8,$splitpos);
       $md5 = md5($algebra);
       if (strpos($query,'ShowDB') || strpos($query,'DeleteDB')) {
-       $texcache = get_record("cache_filters","filter","algebra", "md5key", $md5);
+        $texcache = get_record("cache_filters","filter","algebra", "md5key", $md5);
       }
       if (strpos($query,'ShowDB')) {
         if ($texcache) {
-         $output = "DB cache_filters entry for $algebra\n";
+          $output = "DB cache_filters entry for $algebra\n";
           $output .= "id = $texcache->id\n";
           $output .= "filter = $texcache->filter\n";
           $output .= "version = $texcache->version\n";
@@ -45,7 +45,7 @@
           $output = "Deleting DB cache_filters entry for $algebra\n";
           $result =  delete_records("cache_filters","id",$texcache->id);
           if ($result) {
-           $result = 1;
+            $result = 1;
           } else {
             $result = 0;
           }
         }
       }
       if (strpos($query,'TeXStage1')) {
-       $output = algebra2tex($algebra);
+        $output = algebra2tex($algebra);
       }
       if (strpos($query,'TeXStage2')) {
-       $output = algebra2tex($algebra);
+        $output = algebra2tex($algebra);
         $output = refineTeX($output);
       }
       if (strpos($query,'ShowImage')||strpos($query,'SlashArguments')) {
-       $output = algebra2tex($algebra);
+        $output = algebra2tex($algebra);
         $output = refineTeX($output);
         if (strpos($query,'ShowImage')) {
-         tex2image($output, $md5);
+          tex2image($output, $md5);
         } else {
           slasharguments($output, $md5);
         }
@@ -103,7 +103,7 @@ function algebra2tex($algebra) {
       echo "The shell command<br>$cmd<br>returned status = $status<br>\n";
       $commandpath = "$CFG->dirroot\\$CFG->algebrafilterdirwin\\algebra2tex.pl";
       if (file_exists($commandpath)) {
-       echo "The file permissions of algebra2tex.pl are: " . decoct(fileperms($commandpath)) . "<br>";
+        echo "The file permissions of algebra2tex.pl are: " . decoct(fileperms($commandpath)) . "<br>";
       }
       die;
     }
@@ -222,7 +222,7 @@ function tex2image($texexp, $md5, $return=false) {
        }
        $pathname = "$CFG->dataroot/$CFG->algebraimagedir/$image";
        if (file_exists($pathname)) {
-        unlink($pathname);
+         unlink($pathname);
        } 
        $commandpath = "";
        $cmd = "";
@@ -234,23 +234,23 @@ function tex2image($texexp, $md5, $return=false) {
        case "WINNT":
        case "WIN32":
        case "Windows":
-        $commandpath="$CFG->dirroot/$CFG->texfilterdir/mimetex.exe";
-        $texexp = str_replace('"','\"',$texexp);
-        $cmd = str_replace(' ','^ ',$commandpath);
-        $cmd .= " ++ -e  \"$pathname\" \"$texexp\"";
+         $commandpath="$CFG->dirroot/$CFG->texfilterdir/mimetex.exe";
+         $texexp = str_replace('"','\"',$texexp);
+         $cmd = str_replace(' ','^ ',$commandpath);
+         $cmd .= " ++ -e  \"$pathname\" \"$texexp\"";
        break;
        case "Darwin":
-        $commandpath="$CFG->dirroot/$CFG->texfilterdir/mimetex.darwin";
+         $commandpath="$CFG->dirroot/$CFG->texfilterdir/mimetex.darwin";
          $cmd = "\"$CFG->dirroot/$CFG->texfilterdir/mimetex.darwin\" -e \"$pathname\" ". escapeshellarg($texexp);
        break;
        }
        if (!$cmd) {
-        if (is_executable("$CFG->dirroot/$CFG->texfilterdir/mimetex")) {   /// Use the custom binary
+         if (is_executable("$CFG->dirroot/$CFG->texfilterdir/mimetex")) {   /// Use the custom binary
            $commandpath="$CFG->dirroot/$CFG->texfilterdir/mimetex";
-          $cmd = "$CFG->dirroot/$CFG->texfilterdir/mimetex -e $pathname ". escapeshellarg($texexp);
-        } else {
-          error($error_message1);
-        }
+           $cmd = "$CFG->dirroot/$CFG->texfilterdir/mimetex -e $pathname ". escapeshellarg($texexp);
+         } else {
+           error($error_message1);
+         }
        }
        system($cmd, $status);
   }
@@ -329,7 +329,7 @@ function slasharguments($texexp, $md5) {
            <ol>
            <li>First click on this button <input type="submit" name="ShowDB" value="Show DB Entry">
                to see the cache_filters database entry for this expression.</li>
-          <li>If the database entry looks corrupt, click on this button to delete it:
+           <li>If the database entry looks corrupt, click on this button to delete it:
                <input type="submit" name="DeleteDB" value="Delete DB Entry"></li>
            <li>Now click on this button <input type="submit" name="TeXStage1" value="First Stage Tex Translation">.
                A preliminary translation into TeX will appear in the box below.</li>
index d672da5..75e3578 100644 (file)
@@ -180,28 +180,28 @@ function algebra_filter ($courseid, $text) {
               $texexp = str_replace('\right}','}',$texexp);
               $texexp = str_replace('\fun',' ',$texexp);
               $texexp = str_replace('infty','\infty',$texexp);
-             $texexp = str_replace('alpha','\alpha',$texexp);  
-             $texexp = str_replace('gamma','\gamma',$texexp); 
-             $texexp = str_replace('iota','\iota',$texexp);
-             $texexp = str_replace('kappa','\kappa',$texexp);
-             $texexp = str_replace('lambda','\lambda',$texexp);
-             $texexp = str_replace('mu','\mu',$texexp);
-             $texexp = str_replace('nu','\nu',$texexp);
-             $texexp = str_replace('xi','\xi',$texexp);
-             $texexp = str_replace('rho','\rho',$texexp);
-             $texexp = str_replace('sigma','\sigma',$texexp);
-             $texexp = str_replace('tau','\tau',$texexp);
-             $texexp = str_replace('phi','\phi',$texexp);
-             $texexp = str_replace('chi','\chi',$texexp);
-             $texexp = str_replace('psi','\psi',$texexp);
-             $texexp = str_replace('omega','\omega',$texexp);
-             $texexp = str_replace('zdelta','\delta',$texexp);
-             $texexp = str_replace('bita','\beta',$texexp);
-             $texexp = str_replace('thita','\theta',$texexp);
-             $texexp = str_replace('zita','\zeta',$texexp);
-             $texexp = str_replace('xeta','\eta',$texexp);
-             $texexp = str_replace('zepslon','\epsilon',$texexp);
-             $texexp = str_replace('zupslon','\upsilon',$texexp);
+              $texexp = str_replace('alpha','\alpha',$texexp);  
+              $texexp = str_replace('gamma','\gamma',$texexp); 
+              $texexp = str_replace('iota','\iota',$texexp);
+              $texexp = str_replace('kappa','\kappa',$texexp);
+              $texexp = str_replace('lambda','\lambda',$texexp);
+              $texexp = str_replace('mu','\mu',$texexp);
+              $texexp = str_replace('nu','\nu',$texexp);
+              $texexp = str_replace('xi','\xi',$texexp);
+              $texexp = str_replace('rho','\rho',$texexp);
+              $texexp = str_replace('sigma','\sigma',$texexp);
+              $texexp = str_replace('tau','\tau',$texexp);
+              $texexp = str_replace('phi','\phi',$texexp);
+              $texexp = str_replace('chi','\chi',$texexp);
+              $texexp = str_replace('psi','\psi',$texexp);
+              $texexp = str_replace('omega','\omega',$texexp);
+              $texexp = str_replace('zdelta','\delta',$texexp);
+              $texexp = str_replace('bita','\beta',$texexp);
+              $texexp = str_replace('thita','\theta',$texexp);
+              $texexp = str_replace('zita','\zeta',$texexp);
+              $texexp = str_replace('xeta','\eta',$texexp);
+              $texexp = str_replace('zepslon','\epsilon',$texexp);
+              $texexp = str_replace('zupslon','\upsilon',$texexp);
               $texexp = str_replace('\mbox{logten}','\mbox{log}_{10}',$texexp);
               $texexp = str_replace('\mbox{acos}','\mbox{cos}^{-1}',$texexp);
               $texexp = str_replace('\mbox{asin}','\mbox{sin}^{-1}',$texexp);
@@ -216,26 +216,26 @@ function algebra_filter ($courseid, $text) {
               $texexp = str_replace('\mbox{acsch}','\mbox{csch}^{-1}',$texexp);
               $texexp = str_replace('\mbox{acoth}','\mbox{coth}^{-1}',$texexp);
               //$texexp = preg_replace('/\\\frac{(.+?)}{\\\left\((.+?)\\\right\)}/s','\frac{'."\$1}{\$2}",$texexp);
-             $texexp = preg_replace('/\\\sqrt{(.+?),(.+?)}/s','\sqrt['. "\$2]{\$1}",$texexp);
-             $texexp = preg_replace('/\\\mbox{abs}\\\left\((.+?)\\\right\)/s',"|\$1|",$texexp);
+              $texexp = preg_replace('/\\\sqrt{(.+?),(.+?)}/s','\sqrt['. "\$2]{\$1}",$texexp);
+              $texexp = preg_replace('/\\\mbox{abs}\\\left\((.+?)\\\right\)/s',"|\$1|",$texexp);
               $texexp = preg_replace('/\\\log\\\left\((.+?),(.+?)\\\right\)/s','\log_{'. "\$2}\\left(\$1\\right)",$texexp);
               $texexp = preg_replace('/(\\\cos|\\\sin|\\\tan|\\\sec|\\\csc|\\\cot)([h]*)\\\left\((.+?),(.+?)\\\right\)/s',"\$1\$2^{". "\$4}\\left(\$3\\right)",$texexp);
-             $texexp = preg_replace('/\\\int\\\left\((.+?),(.+?),(.+?)\\\right\)/s','\int_'. "{\$2}^{\$3}\$1 ",$texexp);
+              $texexp = preg_replace('/\\\int\\\left\((.+?),(.+?),(.+?)\\\right\)/s','\int_'. "{\$2}^{\$3}\$1 ",$texexp);
               $texexp = preg_replace('/\\\int\\\left\((.+?d[a-z])\\\right\)/s','\int '. "\$1 ",$texexp);
-             $texexp = preg_replace('/\\\lim\\\left\((.+?),(.+?),(.+?)\\\right\)/s','\lim_'. "{\$2\\to \$3}\$1 ",$texexp);
-            $texcache->filter = 'algebra';
-            $texcache->version = 1;
-            $texcache->md5key = $md5;
-            $texcache->rawtext = addslashes($texexp);
-            $texcache->timemodified = time();
-            insert_record("cache_filters",$texcache, false);
-             $text = str_replace( $matches[0][$i], string_file_picture_algebra($filename, $texexp, '', '', $align), $text);
-          } else {
-            $text = str_replace( $matches[0][$i],"<b>Undetermined error:</b> ",$text);
+              $texexp = preg_replace('/\\\lim\\\left\((.+?),(.+?),(.+?)\\\right\)/s','\lim_'. "{\$2\\to \$3}\$1 ",$texexp);
+              $texcache->filter = 'algebra';
+              $texcache->version = 1;
+              $texcache->md5key = $md5;
+              $texcache->rawtext = addslashes($texexp);
+              $texcache->timemodified = time();
+              insert_record("cache_filters",$texcache, false);
+              $text = str_replace( $matches[0][$i], string_file_picture_algebra($filename, $texexp, '', '', $align), $text);
+           } else {
+              $text = str_replace( $matches[0][$i],"<b>Undetermined error:</b> ",$text);
            }
-       } else {
-          $text = str_replace( $matches[0][$i], string_file_picture_algebra($filename, $texcache->rawtext), $text);
-       }
+        } else {
+           $text = str_replace( $matches[0][$i], string_file_picture_algebra($filename, $texcache->rawtext), $text);
+        }
     }
     return $text; 
 }
index 72f25d4..18df876 100644 (file)
@@ -61,14 +61,14 @@ function string_file_picture_tex($imagefile, $tex= "", $height="", $width="", $a
     }
     if ($imagefile) {
         if (!file_exists("$CFG->dataroot/$CFG->texfilterdir/$imagefile") && isadmin()) {
-         $output .= "<a href=\"$CFG->wwwroot/$CFG->texfilterdir/texdebug.php\">";
+          $output .= "<a href=\"$CFG->wwwroot/$CFG->texfilterdir/texdebug.php\">";
         } else {
           $output .= "<a target=\"popup\" title=\"TeX\" href=";
           $output .= "\"$CFG->wwwroot/$CFG->texfilterdir/displaytex.php?";
           $output .= urlencode($tex) . "\" onclick=\"return openpopup('/$CFG->texfilterdir/displaytex.php?";
           $output .= urlencode($tex) . "', 'popup', 'menubar=0,location=0,scrollbars,";
           $output .= "resizable,width=300,height=240', 0);\">";
-       }
+        }
         $output .= "<img border=\"0\" $title $height $width alt=\"\" src=\"";
         if ($CFG->slasharguments) {        // Use this method if possible for better caching
             $output .= "$CFG->wwwroot/$CFG->texfilterdir/pix.php/$imagefile";
index d08cdea..6c39736 100644 (file)
                 break;
             }
             if (!$cmd) {
-             if (is_executable("$CFG->dirroot/$CFG->texfilterdir/mimetex")) {   /// Use the custom binary
+              if (is_executable("$CFG->dirroot/$CFG->texfilterdir/mimetex")) {   /// Use the custom binary
                 $commandpath="$CFG->dirroot/$CFG->texfilterdir/mimetex";
                 $cmd = "$CFG->dirroot/$CFG->texfilterdir/mimetex -e $pathname ". escapeshellarg($texexp);
               } else {
                 error($error_message1);
-             }
+              }
             }
             system($cmd, $status);
         }
-       if ($return) {
-         return $image;
+        if ($return) {
+          return $image;
         }
         if ($texexp && file_exists($pathname)) {
             $lastmodified = filemtime($pathname);
index b585c57..cd0d736 100644 (file)
@@ -2,7 +2,7 @@
 <!-- Begin 
 
 <?php
-       // javascript objects for excluded students
+    // javascript objects for excluded students
     foreach ($listmembers as $grade_itemid => $listmember) {
         echo "grade_item$grade_itemid = new Object();\n";
         $useridstring = "grade_item$grade_itemid.userid = new Array(";
@@ -24,9 +24,9 @@
         echo $useridstring;
         echo $usernamestring;
     }
-       
-       // javascript objects for included students
-       foreach ($nonmembers as $grade_itemid => $listmember) {
+
+    // javascript objects for included students
+    foreach ($nonmembers as $grade_itemid => $listmember) {
         echo "grade_item_inc$grade_itemid = new Object();\n";
         $useridstring = "grade_item_inc$grade_itemid.userid = new Array(";
         $usernamestring = "grade_item_inc$grade_itemid.username = new Array(";
@@ -67,8 +67,8 @@ function updateMembers(selectgrade_item) {
         document.form3['members[]'].options[i].value = userid[i];
         document.form3['members[]'].options[i].text  = username[i];
     }
-       
-       eval('grade_item_inc=grade_item_inc'+selectgrade_item.value); 
+
+    eval('grade_item_inc=grade_item_inc'+selectgrade_item.value); 
 
     username = grade_item_inc.username;
     userid = grade_item_inc.userid;
@@ -79,7 +79,7 @@ function updateMembers(selectgrade_item) {
         document.form1['nonmembers[]'].options[i].value = userid[i];
         document.form1['nonmembers[]'].options[i].text  = username[i];
     }
-       
+
     updategrade_item();
 }
 
@@ -88,15 +88,15 @@ function updateMembers(selectgrade_item) {
 
 
 
-  <table border="0" cellspacing="2" cellpadding="5" align="center" class="generalbox">
-       <tr>
-               <th colspan=3>
-               <?php 
-                       print get_string('gradeexceptions','grades');
-                       helpbutton('exceptions',get_string('gradeexceptionshelp','grades'), 'grade');
-               ?>
-               </th>
-       </tr>
+<table border="0" cellspacing="2" cellpadding="5" align="center" class="generalbox">
+    <tr>
+        <th colspan=3>
+        <?php 
+            print get_string('gradeexceptions','grades');
+            helpbutton('exceptions',get_string('gradeexceptionshelp','grades'), 'grade');
+        ?>
+        </th>
+    </tr>
     <tr>
       <td width="33%" align="center" class="generaltableheader"><?php p($strgradeitemnonmembers) ?></td>
       <td width="33%" align="center" class="generaltableheader"><?php p($strgradeitems) ?></td>
@@ -107,8 +107,8 @@ function updateMembers(selectgrade_item) {
         <form name="form1" id="form1" method="post" action="exceptions.php">
           <input type="hidden" name="id" value="<?php p($course->id) ?>" />
           <input type="hidden" name="grade_itemid" value="<?php p($selectedgrade_item) ?>" />
-                 <input type="hidden" name="action" value="excepts" />
-                 <input type="hidden" name="sesskey" value="<?php p($USER->sesskey) ?>"/>
+          <input type="hidden" name="action" value="excepts" />
+          <input type="hidden" name="sesskey" value="<?php p($USER->sesskey) ?>"/>
           <select name="nonmembers[]" size="15" multiple="multiple">
             <?php 
                 if (!empty($nonmembers[$selectedgrade_item])) {
@@ -127,8 +127,8 @@ function updateMembers(selectgrade_item) {
       <td class="generalboxcontent">
         <form name="form2" id="form2" method="post" action="grade_items.php">
           <input type="hidden" name="id" value="<?php p($course->id) ?>" />
-                 <input type="hidden" name="action" value="excepts" />
-                 <input type="hidden" name="sesskey" value="<?php p($USER->sesskey) ?>"/>
+          <input type="hidden" name="action" value="excepts" />
+          <input type="hidden" name="sesskey" value="<?php p($USER->sesskey) ?>"/>
           <select name="grade_items" size="15" onchange="updateMembers(this)">
             <?php 
                 if (!empty($listgrade_items)) {
@@ -150,8 +150,8 @@ function updateMembers(selectgrade_item) {
         <form name="form3" id="form3" method="post" action="exceptions.php">
           <input type="hidden" name="id" value="<?php p($course->id) ?>" />
           <input type="hidden" name="grade_itemid" value="<?php p($selectedgrade_item) ?>" />
-                 <input type="hidden" name="sesskey" value="<?php p($USER->sesskey) ?>"/>
-                 <input type="hidden" name="action" value="excepts" />
+          <input type="hidden" name="sesskey" value="<?php p($USER->sesskey) ?>"/>
+          <input type="hidden" name="action" value="excepts" />
           <select name="members[]" size="15" multiple="multiple">
             <?php 
                 if (!empty($listmembers[$selectedgrade_item])) {
index e4d1057..0a1ed3a 100644 (file)
@@ -27,9 +27,9 @@
                     error("Could not set this user's first access date!");
                 }
                 if (isset($CFG->auth_user_create) and $CFG->auth_user_create==1 and function_exists('auth_user_activate') ) {
-                                   if (!auth_user_activate($user->username)) {
-                                         error("Could not activate this user!");
-                                       }
+                    if (!auth_user_activate($user->username)) {
+                         error("Could not activate this user!");
+                    }
                 }
 
                 // The user has confirmed successfully, let's log them in
index 1782080..0467dd7 100644 (file)
@@ -1,13 +1,13 @@
 <?php // $Id$
 
-       require_once("../config.php");
+    require_once("../config.php");
 
     optional_variable($p, "");
     optional_variable($s, "");
 
     if (!empty($p) and !empty($s)) {  // User trying to authenticate change password routine
 
-               update_login_count();
+        update_login_count();
 
         $user = get_complete_user_data("username", "$s");
 
 
                 $user->emailstop = 0;    // Send mail even if sending mail was forbidden
     
-                           if (! reset_password_and_mail($user)) {
+                if (! reset_password_and_mail($user)) {
                     error("Could not reset password and mail the new one to you");
                 }
     
-                           reset_login_count();
+                reset_login_count();
 
-                   print_header(get_string("passwordsent"), get_string("passwordsent"), get_string("passwordsent"));
+                print_header(get_string("passwordsent"), get_string("passwordsent"), get_string("passwordsent"));
 
                 $a->email = $user->email;
                 $a->link = "$CFG->wwwroot/login/change_password.php";
         error(get_string("error"));
     }
 
-       if ($frm = data_submitted()) {    // Initial request for new password
+    if ($frm = data_submitted()) {    // Initial request for new password
 
-               validate_form($frm, $err);
+        validate_form($frm, $err);
 
-               if (count((array)$err) == 0) {
+        if (count((array)$err) == 0) {
 
-                       if (!$user = get_complete_user_data("email", $frm->email)) {
+            if (!$user = get_complete_user_data("email", $frm->email)) {
                 error("No such user with this address:  $frm->email");
             }
 
@@ -52,7 +52,7 @@
             
             $user->secret = random_string(15);
             
-                       if (!set_field("user", "secret", $user->secret, "id", $user->id)) {
+            if (!set_field("user", "secret", $user->secret, "id", $user->id)) {
                 error("Could not set user secret string!");
             }
 
                 error("Could not send you an email to confirm the password change");
             }
 
-               print_header(get_string("passwordconfirmchange"), get_string("passwordconfirmchange"));
+            print_header(get_string("passwordconfirmchange"), get_string("passwordconfirmchange"));
             
             notice(get_string('emailpasswordconfirmsent', '', $user->email), "$CFG->wwwroot/");
         }
-       }
+    }
 
-       if (empty($frm->email)) {
-               if ($username = get_moodle_cookie() ) {
-                       $frm->email = get_field("user", "email", "username", "$username");
-               }
-       }
+    if (empty($frm->email)) {
+        if ($username = get_moodle_cookie() ) {
+            $frm->email = get_field("user", "email", "username", "$username");
+        }
+    }
 
-       print_header(get_string("senddetails"), get_string("senddetails"), 
+    print_header(get_string("senddetails"), get_string("senddetails"), 
                  "<a href=\"$CFG->wwwroot/login/index.php\">".get_string("login")."</a> -> ".get_string("senddetails"), 
                  "form.email");
-       include("forgot_password_form.html");
+    include("forgot_password_form.html");
     print_footer();
 
 
index 45bd557..cacbcb3 100644 (file)
@@ -96,7 +96,7 @@
                  if (!empty($CFG->auth_user_create) and function_exists('auth_user_create') ){\r
 ?>\r
                  <div align="center">\r
-                                   <form action="signup.php" method="get" name="signup">\r
+                    <form action="signup.php" method="get" name="signup">\r
                     <input type="submit" value="<?php print_string("startsignup") ?>" />\r
                     </form>\r
                  </div>\r
index 1f6ea61..cea92e1 100644 (file)
 <?php
-
    if (empty($user->username)) {
-
        $user->username = "";
-
    }
-
    if (empty($user->password)) {
-
        $user->password = "";
-
    }
-
    if (empty($user->email)) {
-
        $user->email = "";
-
    }
-
    if (empty($user->email2)) {
-
        $user->email2 = "";
-
    }
-
    if (empty($user->firstname)) {
-
        $user->firstname = "";
-
    }
-
    if (empty($user->lastname)) {
-
        $user->lastname = "";
-
    }
-
    if (empty($user->city)) {
-
        $user->city = "";
-
    }
-
    if (empty($user->country)) {
-
        $user->country = "";
-
    }
-
-
-
 ?>
-
 <table cellpadding="20" align="center"> <tr> <td class="generalbox">
-
-
-
 <form action="signup.php" method="post" name="form" id="form">
-
 <table>
-
 <tr valign="top">
-
-       <td colspan="2"><b><?php print_string("createuserandpass") ?>:</b></td>
-
+    <td colspan="2"><b><?php print_string("createuserandpass") ?>:</b></td>
 </tr>
-
-
 <tr valign="top">
-
-       <td align="right"><?php print_string("username") ?>:</td>
-
-       <td><input type="text" name="username" size="12" value="<?php p($user->username) ?>" alt="<?php print_string("username") ?>" />
-
-       <?php if (!empty($err->username)) { formerr($err->username); } ?>
-
-       </td>
-
+    <td align="right"><?php print_string("username") ?>:</td>
+    <td><input type="text" name="username" size="12" value="<?php p($user->username) ?>" alt="<?php print_string("username") ?>" />
+    <?php if (!empty($err->username)) { formerr($err->username); } ?>
+    </td>
 </tr>
-
 <tr valign="top">
-
-       <td align="right"><?php print_string("password") ?>:</td>
-
-       <td><input type="password" name="password" size="12" value="<?php p($user->password) ?>" alt="<?php print_string("password") ?>" />
-
-       <?php if (!empty($err->password)) { formerr($err->password); } ?>
-
-       </td>
-
+    <td align="right"><?php print_string("password") ?>:</td>
+    <td><input type="password" name="password" size="12" value="<?php p($user->password) ?>" alt="<?php print_string("password") ?>" />
+    <?php if (!empty($err->password)) { formerr($err->password); } ?>
+    </td>
 </tr>
-
 <tr valign="top">
-
-       <td colspan="2"><p><br />
-
+    <td colspan="2"><p><br />
                   <b><?php print_string("supplyinfo") ?>:</b><br />
-
                   (<?php print_string("emailmustbereal") ?>)</p>
-
               </td>
-
             </tr>
-
 <tr valign="top">
-
-       <td align="right"><?php print_string("email") ?>:</td>
-
-       <td><input type="text" name="email" size="25" value="<?php p($user->email) ?>" alt="<?php print_string("email") ?>" />
-
-       <?php if (!empty($err->email)) { formerr($err->email); } ?>
-
-       </td>
-
+    <td align="right"><?php print_string("email") ?>:</td>
+    <td><input type="text" name="email" size="25" value="<?php p($user->email) ?>" alt="<?php print_string("email") ?>" />
+    <?php if (!empty($err->email)) { formerr($err->email); } ?>
+    </td>
 </tr>
-
 <tr valign="top">
-
-       <td align="right"><?php print_string("emailagain") ?>:</td>
-
-       <td><input type="text" name="email2" size="25" value="<?php p($user->email2) ?>" alt="<?php print_string("emailagain") ?>" />
-
-       <?php if (!empty($err->email2)) { formerr($err->email2); } ?>
-
-       </td>
-
+    <td align="right"><?php print_string("emailagain") ?>:</td>
+    <td><input type="text" name="email2" size="25" value="<?php p($user->email2) ?>" alt="<?php print_string("emailagain") ?>" />
+    <?php if (!empty($err->email2)) { formerr($err->email2); } ?>
+    </td>
 </tr>
-
 <tr valign="top">
-
-       <td align="right"><?php print_string("firstname") ?>:</td>
-
-       <td><input type="text" name="firstname" size="25" value="<?php p($user->firstname) ?>" alt="<?php print_string("firstname") ?>" />
-
-       <?php if (!empty($err->firstname)) { formerr($err->firstname);} ?>
-
-       </td>
-
+    <td align="right"><?php print_string("firstname") ?>:</td>
+    <td><input type="text" name="firstname" size="25" value="<?php p($user->firstname) ?>" alt="<?php print_string("firstname") ?>" />
+    <?php if (!empty($err->firstname)) { formerr($err->firstname);} ?>
+    </td>
 </tr>
-
 <tr valign="top">
-
-       <td align="right"><?php print_string("lastname") ?>:</td>
-
-       <td><input type="text" name="lastname" size="25" value="<?php p($user->lastname) ?>" alt="<?php print_string("lastname") ?>" />
-
-       <?php if (!empty($err->lastname)) { formerr($err->lastname);} ?>
-
-       </td>
-
+    <td align="right"><?php print_string("lastname") ?>:</td>
+    <td><input type="text" name="lastname" size="25" value="<?php p($user->lastname) ?>" alt="<?php print_string("lastname") ?>" />
+    <?php if (!empty($err->lastname)) { formerr($err->lastname);} ?>
+    </td>
 </tr>
-
 <tr valign="top">
-
-       <td align="right"><?php print_string("city") ?>:</td>
-
-       <td><input type="text" name="city" size="25" value="<?php p($user->city) ?>" alt="<?php print_string("city") ?>" />
-
-       <?php if (!empty($err->city)) { formerr($err->city);} ?>
-
-       </td>
-
+    <td align="right"><?php print_string("city") ?>:</td>
+    <td><input type="text" name="city" size="25" value="<?php p($user->city) ?>" alt="<?php print_string("city") ?>" />
+    <?php if (!empty($err->city)) { formerr($err->city);} ?>
+    </td>
 </tr>
-
 <tr valign="top">
-
-       <td align="right"><?php print_string("country") ?>:</td>
-
-       <td><?php choose_from_menu (get_list_of_countries(), "country", $user->country, get_string("selectacountry"), "", "") ?>
-
-       <?php if (!empty($err->country)) { formerr($err->country);} ?>
-
-       </td>
-
+    <td align="right"><?php print_string("country") ?>:</td>
+    <td><?php choose_from_menu (get_list_of_countries(), "country", $user->country, get_string("selectacountry"), "", "") ?>
+    <?php if (!empty($err->country)) { formerr($err->country);} ?>
+    </td>
 </tr>
-
 <tr>
-
-       <td></td>
-
-       <td><input type="submit" value="<?php print_string("createaccount") ?>" /></td>
-
+    <td></td>
+    <td><input type="submit" value="<?php print_string("createaccount") ?>" /></td>
 </tr>
-
 </table>
-
 </form>
-
-
-
 </td></tr></table>
-
index 2624896..75e0faf 100644 (file)
@@ -2,7 +2,7 @@
 
 <table cellpadding=9 cellspacing=0 >
 <tr valign=top>
-       <td align=right><p>assignment_maxbytes:</td>
+    <td align=right><p>assignment_maxbytes:</td>
     <td><?php
     $choices = get_max_upload_sizes($CFG->maxbytes);
     choose_from_menu ($choices, "assignment_maxbytes", $CFG->assignment_maxbytes, "");
@@ -15,7 +15,7 @@
 
 <tr>
     <td colspan=3 align=center>
-       <input type="submit" value="<?php print_string("savechanges") ?>"></td>
+    <input type="submit" value="<?php print_string("savechanges") ?>"></td>
 </tr>
 </table>
 
index 54b7f73..ad67c41 100644 (file)
@@ -2,10 +2,10 @@
       // This script prints the setup screen for any assignment
       // It does this by calling the setup method in the appropriate class
 
-       require_once("../../config.php");
-       require_once("lib.php");
+    require_once("../../config.php");
+    require_once("lib.php");
 
-       if (!$form = data_submitted($CFG->wwwroot.'/course/mod.php')) {
+    if (!$form = data_submitted($CFG->wwwroot.'/course/mod.php')) {
         error("This script was called wrongly");
     }
 
     }
 
 
-       require_once("$CFG->dirroot/mod/assignment/type/$form->assignmenttype/assignment.class.php");
+    require_once("$CFG->dirroot/mod/assignment/type/$form->assignmenttype/assignment.class.php");
 
-       $assignmentclass = "assignment_$form->assignmenttype";
+    $assignmentclass = "assignment_$form->assignmenttype";
 
-       $assignmentinstance = new $assignmentclass();
+    $assignmentinstance = new $assignmentclass();
 
-       echo $assignmentinstance->setup($form);     /// The actual form is all printed here
+    echo $assignmentinstance->setup($form);     /// The actual form is all printed here
 
 
 ?>
index a906c99..e77f225 100644 (file)
 
 <table cellpadding=9 cellspacing=0 >
 <tr valign=top>
-       <td align=right>attendance_dynsection:</td>
-       <td>
-               <?php  $optds[0] = "No";$optds[1] = "Yes";
-               choose_from_menu($optds, "attendance_dynsection", $CFG->attendance_dynsection, ""); ?>
+  <td align=right>attendance_dynsection:</td>
+  <td>
+    <?php  $optds[0] = "No";$optds[1] = "Yes";
+      choose_from_menu($optds, "attendance_dynsection", $CFG->attendance_dynsection, ""); ?>
+  </td>
+  <td>
+    <?php  p(get_string("defaultdynamicsection","attendance")) ?>
   </td>
-    <td>
-               <?php  p(get_string("defaultdynamicsection","attendance")) ?>
-       </td>
 </tr>
 
 <tr valign=top>
-       <td align=right>attendance_default_hours:</td>
-       <td>
-               <?php  for ($i=1;$i<=24;$i++){ $opt[$i] = $i; }
-               choose_from_menu($opt, "attendance_default_hours", $CFG->attendance_default_hours, ""); ?>
-    </td>
-    <td>
-       <?php p(get_string("defaulthoursinclass","attendance")) ?>
-    </td>
+  <td align=right>attendance_default_hours:</td>
+  <td>
+    <?php  for ($i=1;$i<=24;$i++){ $opt[$i] = $i; }
+      choose_from_menu($opt, "attendance_default_hours", $CFG->attendance_default_hours, ""); ?>
+  </td>
+  <td>
+    <?php p(get_string("defaulthoursinclass","attendance")) ?>
+  </td>
 </tr>
 
 <tr valign=top>
-       <td align=right>attendance_tardies_per_absence:</td>
-       <td>
-               <?php  for ($i=1;$i<=24;$i++){ $opt2[$i] = $i; }
-               choose_from_menu($opt2, "attendance_tardies_per_absence", $CFG->attendance_tardies_per_absence, "none","","0"); ?>
+  <td align=right>attendance_tardies_per_absence:</td>
+  <td>
+    <?php  for ($i=1;$i<=24;$i++){ $opt2[$i] = $i; }
+      choose_from_menu($opt2, "attendance_tardies_per_absence", $CFG->attendance_tardies_per_absence, "none","","0"); ?>
     </td>
     <td>
-       <?php p(get_string("tardiesperabsence","attendance")) ?>
+      <?php p(get_string("tardiesperabsence","attendance")) ?>
     </td>
 </tr>
 
 <tr valign=top>
-       <td align=right>attendance_hours_in_full_report:</td>
-       <td>
-               <?php  for ($i=10;$i<=24;$i++){ $opt3[$i] = $i; }
-               choose_from_menu($opt3, "attendance_hours_in_full_report", $CFG->attendance_tardies_per_absence, ""); ?>
+  <td align=right>attendance_hours_in_full_report:</td>
+  <td>
+    <?php  for ($i=10;$i<=24;$i++){ $opt3[$i] = $i; }
+      choose_from_menu($opt3, "attendance_hours_in_full_report", $CFG->attendance_tardies_per_absence, ""); ?>
     </td>
     <td>
-       <?php p(get_string("hoursinfullreport","attendance")) ?>
+      <?php p(get_string("hoursinfullreport","attendance")) ?>
     </td>
 </tr>
 
 <tr valign=top>
-       <td align=right>attendance_default_student_status:</td>
-       <td>
-               <?php
+  <td align=right>attendance_default_student_status:</td>
+  <td>
+      <?php
       $A = get_string("absentlong","attendance");
       $T = get_string("tardylong","attendance");
       $P = get_string("presentlong","attendance");  
 
-                       $r1c=$r2c=$r3c=" ";
-           if ($CFG->attendance_default_student_status == 1) {$r2c="checked";}
-           elseif ($CFG->attendance_default_student_status == 2) {$r3c="checked";}
-           else {$r1c="checked";}
+      $r1c=$r2c=$r3c=" ";
+      if ($CFG->attendance_default_student_status == 1) {$r2c="checked";}
+      elseif ($CFG->attendance_default_student_status == 2) {$r3c="checked";}
+      else {$r1c="checked";}
       $radio1="<input type=\"radio\" name=\"attendance_default_student_status\" value=\"0\" ".$r1c." />";
-           $radio2="<input type=\"radio\" name=\"attendance_default_student_status\" value=\"1\" ".$r2c." />";
-      $radio3="<input type=\"radio\" name=\"attendance_default_student_status\" value=\"2\" ".$r3c." />";      
+      $radio2="<input type=\"radio\" name=\"attendance_default_student_status\" value=\"1\" ".$r2c." />";
+      $radio3="<input type=\"radio\" name=\"attendance_default_student_status\" value=\"2\" ".$r3c." />";
       echo "<table><tr><td align=\"left\" nowrap class=\"generaltablecell\">".
         $radio1.$P."</td>\n";
       echo "<td align=\"left\" nowrap class=\"generaltablecell\">".
 ?>
     </td>
     <td>
-       <?php p(get_string("defaultstudentstatus","attendance")) ?>
+      <?php p(get_string("defaultstudentstatus","attendance")) ?>
     </td>
 </tr>
 
 <tr valign=top>
-       <td align=right>attendance_autoattend:</td>
-       <td>
-               <?php  $optaa[0] = "No";$optaa[1] = "Yes";
-               choose_from_menu($optaa, "attendance_autoattend", $CFG->attendance_autoattend, ""); ?>
+  <td align=right>attendance_autoattend:</td>
+  <td>
+    <?php  $optaa[0] = "No";$optaa[1] = "Yes";
+      choose_from_menu($optaa, "attendance_autoattend", $CFG->attendance_autoattend, ""); ?>
     </td>
     <td>
-               <?php  p(get_string("defaultautoattend","attendance")) ?>
-       </td>
+      <?php  p(get_string("defaultautoattend","attendance")) ?>
+    </td>
 </tr>
 
 <tr valign=top>
-       <td align=right>attendance_grade:</td>
-       <td>
-               <?php  $optgr[0] = "No";$optgr[1] = "Yes";
-               choose_from_menu($optgr, "attendance_grade", $CFG->attendance_grade, ""); ?>
-    </td>
-    <td>
-               <?php  p(get_string("defaultgrade","attendance")) ?>
-       </td>
+  <td align=right>attendance_grade:</td>
+  <td>
+    <?php  $optgr[0] = "No";$optgr[1] = "Yes";
+      choose_from_menu($optgr, "attendance_grade", $CFG->attendance_grade, ""); ?>
+  </td>
+  <td>
+    <?php  p(get_string("defaultgrade","attendance")) ?>
+  </td>
 </tr>
 
 <tr valign=top>
-       <td align=right>attendance_maxgrade:</td>
-       <td>
-               <?php  for ($i=0;$i<=100;$i++){ $opt4[$i] = $i; }
-               choose_from_menu($opt4, "attendance_maxgrade", $CFG->attendance_maxgrade, ""); ?>
+  <td align=right>attendance_maxgrade:</td>
+  <td>
+    <?php  for ($i=0;$i<=100;$i++){ $opt4[$i] = $i; }
+      choose_from_menu($opt4, "attendance_maxgrade", $CFG->attendance_maxgrade, ""); ?>
     </td>
     <td>
-       <?php p(get_string("defaultmaxgrade","attendance")) ?>
+      <?php p(get_string("defaultmaxgrade","attendance")) ?>
     </td>
 </tr>
 
 
 <tr>
-    <td colspan=3 align=center>
-       <input type="submit" value="<?php print_string("savechanges") ?>" /></td>
+  <td colspan=3 align=center>
+    <input type="submit" value="<?php print_string("savechanges") ?>" /></td>
 </tr>
 </table>
 
index 2854951..98ade3f 100644 (file)
@@ -1,43 +1,24 @@
 <?php
 
-
-
 function attendance_upgrade($oldversion) {
-
 /// This function does anything necessary to upgrade 
-
 /// older versions to match current functionality 
 
-
-
     global $CFG;
 
-
-
     if ($oldversion < 2003091802) {
-
         execute_sql("ALTER TABLE `{$CFG->prefix}attendance` ADD `edited` TINYINT( 1 ) DEFAULT '0' NOT NULL;");
-
-               execute_sql("UPDATE `{$CFG->prefix}attendance` set `edited` = 1;");
-
+        execute_sql("UPDATE `{$CFG->prefix}attendance` set `edited` = 1;");
     }
 
     if ($oldversion < 2003092500) {
-
         execute_sql("ALTER TABLE `{$CFG->prefix}attendance` ADD `autoattend` TINYINT( 1 ) DEFAULT '0' NOT NULL;");
-
     }
 
-
-
     if ($oldversion < 2004050301) {
-
         modify_database("", "INSERT INTO {$CFG->prefix}log_display VALUES ('attendance', 'view', 'attendance', 'name');");
-
         modify_database("", "INSERT INTO {$CFG->prefix}log_display VALUES ('attendance', 'viewall', 'attendance', 'name');");
-
         modify_database("", "INSERT INTO {$CFG->prefix}log_display VALUES ('attendance', 'viewweek', 'attendance', 'name');");
-
     }
 
     if ($oldversion < 2004111200) {
@@ -51,9 +32,6 @@ function attendance_upgrade($oldversion) {
     }
 
     return true;
-
 }
 
-
-
 ?>
index 6f52fba..30f66e5 100755 (executable)
 // error_reporting(E_ALL);
  // if we're adding a new instance
 if (empty($form->id)) {
-       if (isset($CFG->attendance_dynsection) && ($CFG->attendance_dynsection == "1")) { $form->dynsection = 1; }
-       if (isset($CFG->attendance_autoattend) && ($CFG->attendance_autoattend == "1")) { $form->autoattend = 1; }
-       if (isset($CFG->attendance_grade) && ($CFG->attendance_grade == "1")) { $form->grade = 1; }
-       $form->maxgrade = isset($CFG->attendance_maxgrade)?$CFG->attendance_maxgrade:0;
-       $form->hours = isset($CFG->attendance_default_hours)?$CFG->attendance_default_hours:1;
-       $form->day = time();
-       $form->notes = "";
+    if (isset($CFG->attendance_dynsection) && ($CFG->attendance_dynsection == "1")) { $form->dynsection = 1; }
+    if (isset($CFG->attendance_autoattend) && ($CFG->attendance_autoattend == "1")) { $form->autoattend = 1; }
+    if (isset($CFG->attendance_grade) && ($CFG->attendance_grade == "1")) { $form->grade = 1; }
+    $form->maxgrade = isset($CFG->attendance_maxgrade)?$CFG->attendance_maxgrade:0;
+    $form->hours = isset($CFG->attendance_default_hours)?$CFG->attendance_default_hours:1;
+    $form->day = time();
+    $form->notes = "";
 }
     ?>
 <form name="form" method="post" action="<?php echo "$CFG->wwwroot/course/mod.php"; ?>">
@@ -124,7 +124,7 @@ if (empty($form->id)) {
      foreach ($rolls as $roll) {
        $sroll[$roll->userid][$roll->hour]->status=$roll->status;
        $sroll[$roll->userid][$roll->hour]->notes=$roll->notes;
-          }
+     }
    }
    // get the list of students along with student ID field
 // get back array of stdclass objects in sorted order, with members:
@@ -138,29 +138,29 @@ if (empty($form->id)) {
   // this is the main table
   echo "<table width=\"100%\" border=\"0\" valign=\"top\" align=\"center\" ".
          "cellpadding=\"5\" cellspacing=\"1\" class=\"generaltable\">";
-if ($form->hours >1) {
-       echo "<tr><th valign=\"top\" align=\"right\" colspan=\"3\" nowrap class=\"generaltableheader\">".
-              "Hours:</th>\n";
-       for($i=1;$i<=$form->hours;$i++) {
-               echo "<th valign=\"top\" align=\"center\" colspan=\"3\" nowrap class=\"generaltableheader\">".
-              "$i</th>\n";
-       }
-       echo "</tr>\n";
-} // if more than one hour for each day
-       echo "<tr><th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">Last Name</th>\n";
-       echo "<th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">First Name</th>\n";
-       echo "<th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">ID</th>\n";
-    $P=get_string("presentshort","attendance");
-    $T=get_string("tardyshort","attendance");
-    $A=get_string("absentshort","attendance");
-    // generate the headers for the attendance hours
-       for($i=1;$i<=$form->hours;$i++) {
-         echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">".$P."</th>\n";
-         echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">".$T."</th>\n";
-         echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">".$A."</th>\n";
-       }
-       echo "</tr>\n";
-  $table->head = array("Last Name","First Name","ID",
+  if ($form->hours >1) {
+    echo "<tr><th valign=\"top\" align=\"right\" colspan=\"3\" nowrap class=\"generaltableheader\">".
+         "Hours:</th>\n";
+    for($i=1;$i<=$form->hours;$i++) {
+      echo "<th valign=\"top\" align=\"center\" colspan=\"3\" nowrap class=\"generaltableheader\">".
+           "$i</th>\n";
+    }
+    echo "</tr>\n";
+  } // if more than one hour for each day
+  echo "<tr><th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">Last Name</th>\n";
+  echo "<th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">First Name</th>\n";
+  echo "<th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">ID</th>\n";
+  $P=get_string("presentshort","attendance");
+  $T=get_string("tardyshort","attendance");
+  $A=get_string("absentshort","attendance");
+  // generate the headers for the attendance hours
+    for($i=1;$i<=$form->hours;$i++) {
+      echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">".$P."</th>\n";
+      echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">".$T."</th>\n";
+      echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">".$A."</th>\n";
+    }
+    echo "</tr>\n";
+    $table->head = array("Last Name","First Name","ID",
     get_string("presentlong","attendance"),
     get_string("tardylong","attendance"),
     get_string("absentlong","attendance"));
@@ -174,27 +174,27 @@ if ($form->hours >1) {
     echo "<tr><td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-top: 1px solid;\">".$student->lastname."</td>\n";
     echo "<td align=\"left\" nowrap class=\"generaltablecell\"  style=\"border-top: 1px solid;\">".$student->firstname."</td>\n";
     echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-top: 1px solid;\">".$student->idnumber."</td>\n";
-       for($j=1;$j<=$form->hours;$j++) {
+      for($j=1;$j<=$form->hours;$j++) {
       // set the attendance defaults for each student
-         $r1c=$r2c=$r3c=" ";
+        $r1c=$r2c=$r3c=" ";
     $rollstatus = (($form->edited==0)?$CFG->attendance_default_student_status:
       ((isset($sroll[$student->id][$j]->status)?$sroll[$student->id][$j]->status:0)));
     if ($rollstatus==1) {$r2c="checked";}
     elseif ($rollstatus==2) {$r3c="checked";}
     else {$r1c="checked";}
     $radio1="<input type=\"radio\" name=\"student_".$student->id."_".$j."\" value=\"0\" ".$r1c." />";
-         $radio2="<input type=\"radio\" name=\"student_".$student->id."_".$j."\" value=\"1\" ".$r2c." />";
-    $radio3="<input type=\"radio\" name=\"student_".$student->id."_".$j."\" value=\"2\" ".$r3c." />";          
+    $radio2="<input type=\"radio\" name=\"student_".$student->id."_".$j."\" value=\"1\" ".$r2c." />";
+    $radio3="<input type=\"radio\" name=\"student_".$student->id."_".$j."\" value=\"2\" ".$r3c." />";
     echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-left: 1px dotted; border-top: 1px solid;\">".$radio1."</td>\n";
     echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-top: 1px solid;\">".$radio2."</td>\n";
     echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-top: 1px solid;\">".$radio3."</td>\n";
-       } // for loop
+  } // for loop
     echo "</tr>\n";
 //      $radio1="<input type=\"radio\" name=\"student_".$student->id."\" value=\"0\" checked>";
-//         $radio2="<input type=\"radio\" name=\"student_".$student->id."\" value=\"1\">";
+//      $radio2="<input type=\"radio\" name=\"student_".$student->id."\" value=\"1\">";
 //      $radio3="<input type=\"radio\" name=\"student_".$student->id."\" value=\"2\">";
 //      $table->data[$i]=array($student->lastname, $student->firstname,
-//           $student->idnumber, $radio1,$radio2,$radio3);
+//      $student->idnumber, $radio1,$radio2,$radio3);
 //      $i++;
   }
   // doing the table manually now
index 1fde636..8baa10b 100644 (file)
@@ -12,8 +12,8 @@
 
 
 <tr valign="top">
-       <td align="right">chat_method:</td>
-       <td>
+  <td align="right">chat_method:</td>
+  <td>
     <?php
        unset($options);
        $options['header_js']    = get_string('methodnormal', 'chat');
@@ -26,8 +26,8 @@
     </td>
 </tr>
 <tr valign="top">
-       <td align="right">chat_refresh_userlist:</td>
-       <td>
+  <td align="right">chat_refresh_userlist:</td>
+  <td>
     <input name="chat_refresh_userlist" type="text" size="5" value="<?php p($CFG->chat_refresh_userlist) ?>" />
     </td>
     <td>
@@ -35,8 +35,8 @@
     </td>
 </tr>
 <tr valign="top">
-       <td align="right">chat_old_ping:</td>
-       <td>
+  <td align="right">chat_old_ping:</td>
+  <td>
     <input name="chat_old_ping" type="text" size="5" value="<?php p($CFG->chat_old_ping) ?>" />
     </td>
     <td>
@@ -52,8 +52,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">chat_refresh_room:</td>
-       <td>
+  <td align="right">chat_refresh_room:</td>
+  <td>
     <input name="chat_refresh_room" type="text" size="5" value="<?php p($CFG->chat_refresh_room) ?>" />
     </td>
     <td>
@@ -69,8 +69,8 @@
 </tr>
 
 <tr valign="top">
-       <td align="right">chat_serverhost:</td>
-       <td>
+  <td align="right">chat_serverhost:</td>
+  <td>
     <input name="chat_serverhost" type="text" size="20" value="<?php p($CFG->chat_serverhost) ?>" />
     </td>
     <td>
@@ -78,8 +78,8 @@
     </td>
 </tr>
 <tr valign="top">
-       <td align="right">chat_serverip:</td>
-       <td>
+  <td align="right">chat_serverip:</td>
+  <td>
     <input name="chat_serverip" type="text" size="16" value="<?php p($CFG->chat_serverip) ?>" />
     </td>
     <td>
@@ -87,8 +87,8 @@
     </td>
 </tr>
 <tr valign="top">
-       <td align="right">chat_serverport:</td>
-       <td>
+  <td align="right">chat_serverport:</td>
+  <td>
     <input name="chat_serverport" type="text" size="5" value="<?php p($CFG->chat_serverport) ?>" />
     </td>
     <td>
@@ -96,8 +96,8 @@
     </td>
 </tr>
 <tr valign="top">
-       <td align="right">chat_servermax:</td>
-       <td>
+  <td align="right">chat_servermax:</td>
+  <td>
     <input name="chat_servermax" type="text" size="5" value="<?php p($CFG->chat_servermax) ?>" />
     </td>
     <td>
 </tr>
 
 <tr>
-    <td colspan="3" align="center">
-       <input type="submit" value="<?php print_string("savechanges") ?>" /></td>
+  <td colspan="3" align="center">
+     <input type="submit" value="<?php print_string("savechanges") ?>" /></td>
 </tr>
 </table>
 
index 6a34bef..d0ff7cd 100644 (file)
@@ -6,14 +6,14 @@ function dialogue_upgrade($oldversion) {
 
     global $CFG;
 
-       if ($oldversion < 2003100500) {
-               execute_sql(" ALTER TABLE `{$CFG->prefix}dialogue` ADD `multipleconversations` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `dialoguetype`");
-               execute_sql(" ALTER TABLE `{$CFG->prefix}dialogue_conversations` ADD `subject` VARCHAR(100) NOT NULL DEFAULT ''");
-               }
+    if ($oldversion < 2003100500) {
+        execute_sql(" ALTER TABLE `{$CFG->prefix}dialogue` ADD `multipleconversations` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `dialoguetype`");
+        execute_sql(" ALTER TABLE `{$CFG->prefix}dialogue_conversations` ADD `subject` VARCHAR(100) NOT NULL DEFAULT ''");
+    }
 
-       if ($oldversion < 2003101300) {
-               execute_sql(" ALTER TABLE `{$CFG->prefix}dialogue_conversations` ADD `seenon` INT(10) unsigned NOT NULL DEFAULT '0' AFTER `closed`");
-               }
+    if ($oldversion < 2003101300) {
+        execute_sql(" ALTER TABLE `{$CFG->prefix}dialogue_conversations` ADD `seenon` INT(10) unsigned NOT NULL DEFAULT '0' AFTER `closed`");
+    }
     
     if ($oldversion < 2004111000) {
         execute_sql("ALTER TABLE {$CFG->prefix}dialogue DROP KEY course;",false);
index 45c8210..20b7aed 100644 (file)
@@ -7,27 +7,27 @@ function exercise_upgrade($oldversion) {
     global $CFG;
 
     if ($oldversion < 2003111400) {
-               execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_submissions` ADD INDEX (`userid`)");
-               execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_submissions` DROP INDEX `title`");
-               execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_assessments` ADD INDEX (`submissionid`)");
-               execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_assessments` ADD INDEX (`userid`)");
-               execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_grades` ADD INDEX (`assessmentid`)");
-               }
+        execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_submissions` ADD INDEX (`userid`)");
+        execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_submissions` DROP INDEX `title`");
+        execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_assessments` ADD INDEX (`submissionid`)");
+        execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_assessments` ADD INDEX (`userid`)");
+        execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_grades` ADD INDEX (`assessmentid`)");
+    }
     
     if ($oldversion < 2003121000) {
-               execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_submissions` ADD `late` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0'");
-               }
+        execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_submissions` ADD `late` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0'");
+    }
 
     if ($oldversion < 2004062300) {
-               table_column("exercise", "", "gradinggrade", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "grade");
-               table_column("exercise", "", "assessmentcomps", "INTEGER", "4", "UNSIGNED", "2", "NOT NULL", "usemaximum");
+        table_column("exercise", "", "gradinggrade", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "grade");
+        table_column("exercise", "", "assessmentcomps", "INTEGER", "4", "UNSIGNED", "2", "NOT NULL", "usemaximum");
         execute_sql("ALTER TABLE `{$CFG->prefix}exercise` DROP COLUMN `teacherweight`");
         execute_sql("ALTER TABLE `{$CFG->prefix}exercise` DROP COLUMN `gradingweight`");
     }
 
     if ($oldversion < 2004090200) {
-               table_column("exercise", "", "usepassword", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL");
-               table_column("exercise", "", "password", "VARCHAR", "32", "", "", "NOT NULL");
+        table_column("exercise", "", "usepassword", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL");
+        table_column("exercise", "", "password", "VARCHAR", "32", "", "", "NOT NULL");
     }
 
     if ($oldversion < 2004091000) {
index b5ab4a7..adf6d95 100644 (file)
@@ -7,12 +7,12 @@ function exercise_upgrade($oldversion) {
     global $CFG;
 
     if ($oldversion < 2003121000) {
-               execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_submissions` ADD `late` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0'");
-               }
+        execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_submissions` ADD `late` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0'");
+    }
 
     if ($oldversion < 2004062300) {
-               table_column("exercise", "", "gradinggrade", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "grade");
-               table_column("exercise", "", "assessmentcomps", "INTEGER", "4", "UNSIGNED", "2", "NOT NULL", "usemaximum");
+        table_column("exercise", "", "gradinggrade", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "grade");
+        table_column("exercise", "", "assessmentcomps", "INTEGER", "4", "UNSIGNED", "2", "NOT NULL", "usemaximum");
     }
 
     if ($oldversion < 2004090200) {
index 6907e97..bd03d50 100644 (file)
@@ -62,10 +62,10 @@ function exercise_add_instance($exercise) {
 
     // encode password if necessary
     if (!empty($exercise->password)) {
-               $exercise->password = md5($exercise->password);
-       } else {
-               unset($exercise->password);
-       }
+        $exercise->password = md5($exercise->password);
+    } else {
+        unset($exercise->password);
+    }
 
     if ($returnid = insert_record("exercise", $exercise)) {
 
@@ -489,10 +489,10 @@ function exercise_update_instance($exercise) {
 
     // encode password if necessary
     if (!empty($exercise->password)) {
-               $exercise->password = md5($exercise->password);
-       } else {
-               unset($exercise->password);
-       }
+        $exercise->password = md5($exercise->password);
+    } else {
+        unset($exercise->password);
+    }
 
     $exercise->id = $exercise->instance;
 
index ae13293..9dac76d 100644 (file)
@@ -6,13 +6,13 @@ Things that are in the inkpot yet:
     * Co-evaluation?
 
 ********* IN BETA RIGHT NOW *********
-       
+
 - Adding a way to specify default values for display formats:
     * Default view
-       * Default Order
-       * Show (or do not) the group breaks.
+        * Default Order
+        * Show (or do not) the group breaks.
         * Default view for automatic links, entry view, etc.
-       * What else? Post in http://moodle.org/mod/forum/view.php?id=742
+        * What else? Post in http://moodle.org/mod/forum/view.php?id=742
 
 News about plugin-formats TODO (Updated: Jul 30, 2004 - Eloy)
 
index 195e988..c170c4f 100644 (file)
@@ -47,7 +47,7 @@
                 fwrite ($bf,full_tag("INTRO",4,false,$glossary->intro));
                 fwrite ($bf,full_tag("STUDENTCANPOST",4,false,$glossary->studentcanpost));
                 fwrite ($bf,full_tag("ALLOWDUPLICATEDENTRIES",4,false,$glossary->allowduplicatedentries));
-                fwrite ($bf,full_tag("DISPLAYFORMAT",4,false,$glossary->displayformat));       
+                fwrite ($bf,full_tag("DISPLAYFORMAT",4,false,$glossary->displayformat));
                 fwrite ($bf,full_tag("MAINGLOSSARY",4,false,$glossary->mainglossary));
                 fwrite ($bf,full_tag("SHOWSPECIAL",4,false,$glossary->showspecial));
                 fwrite ($bf,full_tag("SHOWALPHABET",4,false,$glossary->showalphabet));
             foreach ($glossary_entries as $glo_ent) {
                 //Start entry
                 //Print submission contents
-               if ($glo_ent->teacherentry or $userinfo) {
+               if ($glo_ent->teacherentry or $userinfo) {
                     $dumped_entries++;
                     if ($dumped_entries == 1) {
                         //Write start tag
                 }
             }
             if ( $dumped_entries > 0 ) {
-               //Write end tag
-               $status =fwrite ($bf,end_tag("ENTRIES",4,true));
+                //Write end tag
+                $status =fwrite ($bf,end_tag("ENTRIES",4,true));
             }
         }
         return $status;
index 0c77b84..66cdbcf 100644 (file)
 </tr>
 <tr>
 <td colspan="2">
-       <center>
-       <?php 
-           if (isset($comment->id)) {
-                   echo "<input type=\"hidden\" name=\"cid\" value=\"$comment->id\" />";
-           }
-       ?>
-       <input type="hidden" name="id" value="<?php p($cm->id) ?>" />
-       <input type="hidden" name="eid" value="<?php p($entry->id) ?>" />
-       <input type="hidden" name="action" value="<?php p($action) ?>" />
-       <input type="hidden" name="confirm" value="1" />
+    <center>
+    <?php 
+        if (isset($comment->id)) {
+            echo "<input type=\"hidden\" name=\"cid\" value=\"$comment->id\" />";
+        }
+    ?>
+    <input type="hidden" name="id" value="<?php p($cm->id) ?>" />
+    <input type="hidden" name="eid" value="<?php p($entry->id) ?>" />
+    <input type="hidden" name="action" value="<?php p($action) ?>" />
+    <input type="hidden" name="confirm" value="1" />
 
-       <input type="submit" value="<?php print_string("savechanges") ?>" />
-       <input type="reset" value="<?php print_string("revert") ?>" />
-       </center>
+    <input type="submit" value="<?php print_string("savechanges") ?>" />
+    <input type="reset" value="<?php print_string("revert") ?>" />
+    </center>
 </td>
 </tr>
 </table>
index e28eba3..52b4604 100644 (file)
 
 ?>
 
-       </td>
+    </td>
 </tr>
 <tr>
     <td colspan=3 align=center>
-       <input type="submit" value="<?php print_string("savechanges") ?>" /></td>
+        <input type="submit" value="<?php print_string("savechanges") ?>" /></td>
 </tr>
 </table>
 
index c197b45..436d5ba 100644 (file)
@@ -65,7 +65,7 @@ function glossary_upgrade($oldversion) {
                     "ADD `sourceglossaryid` INT(10) unsigned NOT NULL DEFAULT '0' AFTER `attachment` " );
 
     }
-       
+
     if ( $oldversion < 2003101500 ) {
         execute_sql( "ALTER TABLE `{$CFG->prefix}glossary` " .
                     "ADD `intro`  text NOT NULL DEFAULT '' AFTER `name` " );
@@ -94,7 +94,7 @@ function glossary_upgrade($oldversion) {
     if ( $oldversion < 2003101600 ) {
         execute_sql( "ALTER TABLE `{$CFG->prefix}glossary` " .
                     "ADD `usedynalink`  TINYINT(2) UNSIGNED NOT NULL DEFAULT '1' AFTER `allowcomments` " );
-                                       
+
         execute_sql( "ALTER TABLE `{$CFG->prefix}glossary_entries` " .
                     "ADD `usedynalink`  TINYINT(2) UNSIGNED NOT NULL DEFAULT '1' AFTER `sourceglossaryid`, ".
                     "ADD `casesensitive`  TINYINT(2) UNSIGNED NOT NULL DEFAULT '0' AFTER `usedynalink` ");
@@ -112,7 +112,7 @@ function glossary_upgrade($oldversion) {
     if ( $oldversion < 2003102000 ) {
         execute_sql( "ALTER TABLE `{$CFG->prefix}glossary`" .
                      " ADD `defaultapproval` TINYINT(2) UNSIGNED NOT NULL default '1' AFTER `usedynalink`");
-                                       
+
         execute_sql( "ALTER TABLE `{$CFG->prefix}glossary_entries`" .
                     " ADD `approved` TINYINT(2) UNSIGNED NOT NULL default '1' AFTER `fullmatch`");
 
index 2464104..60efd60 100644 (file)
@@ -1,5 +1,5 @@
 <?php  // $Id$
-       global $CFG;
+    global $CFG;
     require_once("../../config.php");
 ?>
 <center>
     </td>
 </tr>
 <td colspan="2">
-       <p align="center">
-       <input type="hidden" name="id" value="<?php p($cm->id) ?>" />
-       <input type="hidden" name="action" value="<?php p($action) ?>" />
-       <input type="hidden" name="confirm" value="1" />
-       <input type="hidden" name="mode" value='cat' />
-       <input type="hidden" name="hook" value="<?php p($hook) ?>" />
-       <input type="submit" value="<?php print_string("savechanges") ?>" />
-       <input type="reset" value="<?php print_string("back","glossary") ?>"  onclick="javascript:history.go(-1);" />
-       </p>
+    <p align="center">
+    <input type="hidden" name="id" value="<?php p($cm->id) ?>" />
+    <input type="hidden" name="action" value="<?php p($action) ?>" />
+    <input type="hidden" name="confirm" value="1" />
+    <input type="hidden" name="mode" value='cat' />
+    <input type="hidden" name="hook" value="<?php p($hook) ?>" />
+    <input type="submit" value="<?php print_string("savechanges") ?>" />
+    <input type="reset" value="<?php print_string("back","glossary") ?>"  onclick="javascript:history.go(-1);" />
+    </p>
 </td>
 </tr>
 </table>
index 79d14c8..c226a96 100644 (file)
@@ -20,7 +20,7 @@ function glossary_show_entry_fullwithauthor($course, $cm, $glossary, $entry, $mo
 
         echo '<span class="concept">';
         glossary_print_entry_concept($entry);
-               echo '</span><br />';
+        echo '</span><br />';
 
         echo '<span class="author">'.$strby.' '.fullname($user, isteacher($course->id));
         echo '&nbsp;&nbsp;('.get_string('lastedited').': '.
index 4b72331..6e124f4 100644 (file)
@@ -13,7 +13,7 @@ function glossary_show_entry_fullwithoutauthor($course, $cm, $glossary, $entry,
 
         echo '<span class="concept">';
         glossary_print_entry_concept($entry);
-               echo '</span><br />';
+        echo '</span><br />';
 
         echo '('.get_string('lastedited').': '.
              userdate($entry->timemodified).')';
index b489c49..568f7cf 100644 (file)
@@ -121,7 +121,7 @@ global $CFG;
     }
 
     $return = update_record("glossary", $glossary);
-       if ($return and $glossary->defaultapproval) {
+    if ($return and $glossary->defaultapproval) {
         execute_sql("update {$CFG->prefix}glossary_entries SET approved = 1 where approved != 1 and glossaryid = " . $glossary->id,false);
     }
 
@@ -858,7 +858,7 @@ function glossary_print_entry_attachment($entry,$format=NULL,$align="right",$ins
 ///                        text  : Return the HTML link for tha attachment as text
 ///                        blank : Print the output to the screen
     if ($entry->attachment) {
-          $glossary = get_record("glossary","id",$entry->glossaryid);            
+          $glossary = get_record("glossary","id",$entry->glossaryid);
           $entry->course = $glossary->course; //used inside print_attachment
           if ($insidetable) {
               echo "<table border=\"0\" width=\"100%\" align=\"$align\"><tr><td align=\"$align\" nowrap=\"nowrap\">\n";
@@ -1256,7 +1256,7 @@ function glossary_print_approval_menu($cm, $glossary,$mode, $hook, $sortkey = ''
     glossary_print_alphabet_links($cm, $glossary, $mode, $hook,$sortkey, $sortorder);
 
     glossary_print_all_links($cm, $glossary, $mode, $hook);
-        
+
     glossary_print_sorting_links($cm, $mode, 'CREATION', 'asc');
 }
 
@@ -1757,7 +1757,7 @@ require_once "../../lib/xmlize.php";
            $line .= $char;
         }
         fclose($h);
-       }
+    }
     return xmlize($line, 0);
 }
 //Close the file
index e5c802b..ca2fe08 100644 (file)
             //If it's a teacher entry or userinfo was selected, restore the entry
             if ($entry->teacherentry or $restore->mods['glossary']->userinfo) {
                 //The structure is equal to the db, so insert the glossary_entries
-               $newid = insert_record ("glossary_entries",$entry);
+                $newid = insert_record ("glossary_entries",$entry);
 
-               //Do some output
-               if (($i+1) % 50 == 0) {
-                   echo ".";
-                   if (($i+1) % 1000 == 0) {
+                //Do some output
+                if (($i+1) % 50 == 0) {
+                    echo ".";
+                    if (($i+1) % 1000 == 0) {
                         echo "<br />";
-                   }
-                   backup_flush(300);
+                    }
+                    backup_flush(300);
                 }
                 if ($newid) {
-                   //We have the newid, update backup_ids
+                    //We have the newid, update backup_ids
                     backup_putid($restore->backup_unique_code,"glossary_entries",$oldid,$newid);
                     //Restore glossary_alias
                     $status = glossary_alias_restore_mods($oldid,$newid,$ent_info,$restore);
                                                           $oldid, $newid, $restore);
                     }
                 } else {
-                   $status = false;
-               }
+                    $status = false;
+                }
             }
         }
 
index 8ea4875..d0f98a3 100644 (file)
@@ -150,7 +150,7 @@ function journal_cron () {
             $journalinfo->teacher = fullname($teacher);
             $journalinfo->journal = format_string($entry->name,true);
             $journalinfo->url = "$CFG->wwwroot/mod/journal/view.php?id=$mod->id";
-           $modnamepl = get_string( 'modulenameplural','journal' );
+            $modnamepl = get_string( 'modulenameplural','journal' );
             $msubject = get_string( 'mailsubject','journal' );
 
             $postsubject = "$course->shortname: $msubject: ".format_string($entry->name,true);