]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-20700 coding style cleanup - cvs keywords removed, closign php tag removed, trail...
authorPetr Skoda <skodak@moodle.org>
Sun, 1 Nov 2009 11:31:16 +0000 (11:31 +0000)
committerPetr Skoda <skodak@moodle.org>
Sun, 1 Nov 2009 11:31:16 +0000 (11:31 +0000)
70 files changed:
lib/accesslib.php
lib/ajax/ajaxlib.php
lib/ajax/getnavbranch.php
lib/ajax/setuserpref.php
lib/ajax/simpletest/testajaxlib.php
lib/authlib.php
lib/base32.php
lib/boxlib.php
lib/completionlib.php
lib/componentlib.class.php
lib/conditionlib.php
lib/csvlib.class.php
lib/customcheckslib.php
lib/datalib.php
lib/db/access.php
lib/db/events.php
lib/db/install.php
lib/db/messages.php
lib/db/upgrade.php
lib/db/upgradelib.php
lib/ddl/database_manager.php
lib/ddl/mssql_sql_generator.php
lib/ddl/mysql_sql_generator.php
lib/ddl/oracle_sql_generator.php
lib/ddl/postgres_sql_generator.php
lib/ddl/simpletest/testddl.php
lib/ddl/sql_generator.php
lib/ddl/sqlite_sql_generator.php
lib/dml/pgsql_native_moodle_database.php
lib/dmllib.php
lib/environmentlib.php
lib/eventslib.php
lib/excellib.class.php
lib/filelib.php
lib/filterlib.php
lib/formslib.php
lib/gdlib.php
lib/googleapi.php
lib/gradelib.php
lib/graphlib.php
lib/grouplib.php
lib/html2text.php
lib/javascript-mod.php
lib/languages.php
lib/listlib.php
lib/mathslib.php
lib/memcached.class.php
lib/messagelib.php
lib/moodlelib.php
lib/navigationlib.php
lib/odslib.class.php
lib/olson.php
lib/outputactions.php
lib/pagelib.php
lib/portfoliolib.php
lib/profilerlib.php
lib/questionlib.php
lib/rsslib.php
lib/searchlib.php
lib/session-test.php
lib/simpletestcoveragelib.php
lib/simpletestlib.php
lib/soaplib.php
lib/statslib.php
lib/tablelib.php
lib/textlib.class.php
lib/tokeniserlib.php
lib/uploadlib.php
lib/validateurlsyntax.php
lib/wiki_to_markdown.php

index 83833b7e47e7846fc2cbb6289194f796c0a43529..5e6a45a6e58b3dfc1630b3af46db654a4aa6ab0b 100755 (executable)
@@ -1,7 +1,7 @@
 <?php
 
-// This file is part of Moodle - http://moodle.org/ 
-// 
+// This file is part of Moodle - http://moodle.org/
+//
 // Moodle is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 3 of the License, or
@@ -11,7 +11,7 @@
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
@@ -78,7 +78,7 @@
  * $accessdata[ra][$contextpath]= array($roleid)
  *                [$contextpath]= array($roleid)
  *                [$contextpath]= array($roleid)
- * </code> 
+ * </code>
  *
  * Role definitions are stored like this
  * (no cap merge is done - so it's compact)
@@ -170,15 +170,15 @@ define('ROLENAME_ORIGINALANDSHORT', 3);
 define('ROLENAME_ALIAS_RAW', 4);
 
 /** size limit for context cache */
-if (!defined('MAX_CONTEXT_CACHE_SIZE')) { 
+if (!defined('MAX_CONTEXT_CACHE_SIZE')) {
     define('MAX_CONTEXT_CACHE_SIZE', 5000);
 }
 
 /**
- * Although this looks like a global variable, it isn't really. 
+ * Although this looks like a global variable, it isn't really.
  *
- * It is just a private implementation detail to accesslib that MUST NOT be used elsewhere. 
- * It is used to cache various bits of data between function calls for performance reasons. 
+ * It is just a private implementation detail to accesslib that MUST NOT be used elsewhere.
+ * It is used to cache various bits of data between function calls for performance reasons.
  * Sadly, a PHP global variale is the only way to impleemnt this, withough rewriting everything
  * as methods of a class, instead of functions.
  *
@@ -198,7 +198,7 @@ $ACCESSLIB_PRIVATE->capabilitynames = null; // Used in is_valid_capability (only
 
 /**
  * Clears accesslib's private caches. ONLY BE USED BY UNIT TESTS
- * 
+ *
  * This method should ONLY BE USED BY UNIT TESTS. It clears all of
  * accesslib's private caches. You need to do this before setting up test data,
  * and also at the end fo the tests.
@@ -405,7 +405,7 @@ function get_default_frontpage_role_access($roleid, $accessdata=NULL) {
 
 /**
  * Get the default guest role
- * 
+ *
  * @global object
  * @global object
  * @return object role
@@ -443,7 +443,7 @@ function get_guest_role() {
  * By default checks the capabilties of the current user, but you can pass a
  * different userid. By default will return true for admin-like users who have the
  * moodle/site:doanything capability, but you can override that with the fourth argument.
- * 
+ *
  * @param string $capability the name of the capability to check. For example mod/forum:view
  * @param object $context the context to check the capability in. You normally get this with {@link get_context_instance}.
  * @param integer $userid A user id. By default (null) checks the permissions of the current user.
@@ -1284,7 +1284,7 @@ function get_user_courses_bycap($userid, $cap, $accessdata, $doanything, $sort='
                 if ($limit > 0 && $cc >= $limit) {
                     break;
                 }
-                
+
                 $courses[] = $c;
                 $cc++;
             }
@@ -1731,7 +1731,7 @@ function compact_rdefs(&$rdefs) {
  * for example. Call it only _after_ you've setup $USER and called
  * check_enrolment_plugins();
  * @see check_enrolment_plugins()
- * 
+ *
  * @global object
  * @global object
  * @global object
@@ -2808,7 +2808,7 @@ function assign_capability($capability, $permission, $roleid, $contextid, $overw
 
 /**
  * Unassign a capability from a role.
- * 
+ *
  * @global object
  * @param int $roleid the role id
  * @param string $capability the name of the capability
@@ -2880,7 +2880,7 @@ function get_roles_with_capability($capability, $permission=NULL, $context='') {
 
 /**
  * This function makes a role-assignment (a role for a user or group in a particular context)
- * 
+ *
  * @global object
  * @global object
  * @global object
@@ -3505,11 +3505,11 @@ function print_context_name($context, $withprefix = true, $short = false) {
 }
 
 /**
- * Get a URL for a context, if there is a natural one. For example, for 
+ * Get a URL for a context, if there is a natural one. For example, for
  * CONTEXT_COURSE, this is the course page. For CONTEXT_USER it is the
  * user profile page.
  *
- * First three parameters as for 
+ * First three parameters as for
  *
  * @global object
  * @global object
@@ -3559,10 +3559,10 @@ function get_context_url($context) {
 
 /**
  * Returns an array of all the known types of risk
- * The array keys can be used, for example as CSS class names, or in calls to 
+ * The array keys can be used, for example as CSS class names, or in calls to
  * print_risk_icon. The values are the corresponding RISK_ constants.
  *
- * @return array all the known types of risk. 
+ * @return array all the known types of risk.
  */
 function get_all_risks() {
     return array(
@@ -3649,7 +3649,7 @@ function fetch_context_capabilities($context) {
                 include_once($modfile);
                 $modfunction = $module->name.'_get_extra_capabilities';
                 if (function_exists($modfunction)) {
-                    $extracaps = $modfunction();        
+                    $extracaps = $modfunction();
                 }
             }
             if(empty($extracaps)) {
@@ -3797,7 +3797,7 @@ function get_parent_contextid($context) {
  * otherwise false.
  *
  * @param object $context a context object.
- * @return bool 
+ * @return bool
  */
 function is_inside_frontpage($context) {
     $frontpagecontext = get_context_instance(CONTEXT_COURSE, SITEID);
@@ -4057,7 +4057,7 @@ function get_capability_string($capabilityname) {
         case 'webservice':
             $string = get_string($stringname, 'webservice_'.$componentname);
         break;
-        
+
         default:
             $string = get_string($stringname);
         break;
@@ -4442,7 +4442,7 @@ function get_assignable_roles($context, $rolenamedisplay = ROLENAME_ALIAS, $with
     if (has_capability('moodle/site:doanything', get_context_instance(CONTEXT_SYSTEM))) {
         // show all roles allowed in this context to admins
         $raafrom  = "";
-        $raawhere = "";        
+        $raawhere = "";
     }
 
     $params['userid'] = $USER->id;
@@ -4620,7 +4620,7 @@ function get_overridable_roles($context, $rolenamedisplay = ROLENAME_ALIAS, $wit
             SELECT ro.id, ro.name$extrafields
               FROM {role} ro
           ORDER BY ro.sortorder ASC", $params);
-        
+
     } else {
         $roles = $DB->get_records_sql("
             SELECT ro.id, ro.name$extrafields
@@ -5504,7 +5504,7 @@ function get_role_users($roleid, $context, $parent=false, $fields='',
 
 /**
  * Counts all the users assigned this role in this context or higher
- * 
+ *
  * @global object
  * @param mixed $roleid either int or an array of ints
  * @param object $context
@@ -5766,7 +5766,7 @@ function get_users_from_role_on_context($role, $context) {
 
 /**
  * Simple function returning a boolean true if roles exist, otherwise false
- * 
+ *
  * @global object
  * @param int $userid
  * @param int $roleid
@@ -5879,7 +5879,7 @@ function role_fix_names($roleoptions, $context, $rolenamedisplay=ROLENAME_ALIAS)
  *
  * @param string $cap component string a
  * @param string $comp component string b
- * @param mixed $contextlevel 
+ * @param mixed $contextlevel
  * @return bool whether 2 component are in different "sections"
  */
 function component_level_changed($cap, $comp, $contextlevel) {
@@ -5966,7 +5966,7 @@ function build_context_path($force=false) {
      *
      * Different code for each database - mostly for performance reasons
      */
-    $dbfamily = $DB->get_dbfamily(); 
+    $dbfamily = $DB->get_dbfamily();
     if ($dbfamily == 'mysql') {
         $updatesql = "UPDATE {context} ct, {context_temp} temp
                          SET ct.path  = temp.path,
@@ -6169,7 +6169,7 @@ function make_context_subobj($rec) {
 /**
  * Do some basic, quick checks to see whether $rec->context looks like a valid context object.
  *
- * @param object $rec a think that has a context, for example a course, 
+ * @param object $rec a think that has a context, for example a course,
  *      course category, course modules, etc.
  * @param int $contextlevel the type of thing $rec is, one of the CONTEXT_... constants.
  * @return bool whether $rec->context looks like the correct context object
@@ -6316,5 +6316,3 @@ function role_cap_duplicate($sourcerole, $targetrole) {
         $DB->insert_record('role_capabilities', $cap);
     }
 }
-
-?>
index f53f0cc65a92f54f776e5ef62fc969720123fda5..b4fe79c5ecdada0c71158773c2d65f69dd38b191 100644 (file)
@@ -54,7 +54,7 @@ function setup_core_javascript(page_requirements_manager $requires) {
 
     $requires->skip_link_to('maincontent', get_string('tocontent', 'access'));
 
-    // Note that, as a short-cut, the code 
+    // Note that, as a short-cut, the code
     // $js = "document.body.className += ' jsenabled';\n";
     // is hard-coded in {@link page_requirements_manager::get_top_of_body_code)
     $requires->yui_lib('container');
@@ -62,7 +62,7 @@ function setup_core_javascript(page_requirements_manager $requires) {
     $requires->string_for_js('confirmation', 'admin');
     $requires->string_for_js('cancel', 'moodle');
     $requires->string_for_js('yes', 'moodle');
-    $requires->js_function_call('init_help_icons'); 
+    $requires->js_function_call('init_help_icons');
 }
 
 
@@ -258,7 +258,7 @@ class page_requirements_manager {
 
     /**
      * Make a language string available to JavaScript.
-     * 
+     *
      * All the strings will be available in a mstr object in the global namespace.
      * So, for example, after a call to $PAGE->requires->string_for_js('course', 'moodle');
      * then the JavaScript variable mstr.moodle.course will be 'Course', or the
@@ -327,7 +327,7 @@ class page_requirements_manager {
 
     /**
      * Make some data from PHP available to JavaScript code.
-     * 
+     *
      * For example, if you call
      * <pre>
      *      $PAGE->requires->data_for_js('mydata', array('name' => 'Moodle'));
@@ -360,7 +360,7 @@ class page_requirements_manager {
         $this->variablesinitialised[$variable] = 1;
         return $requirement;
     }
-    
+
     /**
      * Creates a YUI event handler.
      *
@@ -1090,9 +1090,9 @@ class required_data_for_js extends required_js_code {
 }
 
 /**
- * This class represents a Javascript event handler, listening for a 
+ * This class represents a Javascript event handler, listening for a
  * specific Event to occur on a DOM element identified by a given id.
- * By default the data will be output at the end of the page, but you 
+ * By default the data will be output at the end of the page, but you
  * can change that using the {@link asap()}, {@link in_head()}, etc. methods.
  *
  * @copyright 2009 Nicolas Connault
@@ -1445,5 +1445,3 @@ class jsportal {
     }
 
 }
-
-?>
index dd57c0f6ae82042bdfe703388c46aa3c55d3ee9f..524f7a664809da2bdd73cc20c132ce7caa8b8062 100644 (file)
@@ -94,4 +94,4 @@ $converter->set_expandable($expandable);
 header('Content-type: text/xml');
 echo '<?xml version="1.0" encoding="utf-8"?>';
 // Convert and output the branch as XML
-echo $converter->convert($branch);
\ No newline at end of file
+echo $converter->convert($branch);
index 28c8b52742fa20dfc33341c41adb33215ef574fe..ca94ccbd20072758e7655a90e294b97f6eeb2c83 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 
 ///////////////////////////////////////////////////////////////////////////
 //                                                                       //
@@ -54,4 +54,3 @@ if (!set_user_preference($name, $value)) {
 }
 
 echo 'OK';
-?>
\ No newline at end of file
index fdca24f687faecf194d3808e7efaa894fcd418e4..d235f5a5c39ac3752d892401820ad6835df0a484 100644 (file)
@@ -503,5 +503,3 @@ class ajax_test extends ajaxlib_unit_test_base {
         $this->assertTrue(ajaxenabled($tested_browsers));
     }
 }
-
-?>
index 77a74f834308089e7f4f3bd428b82c0aa25050c0..b89aa0160f3357705fcfc4862b72cf64002248b2 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
-// This file is part of Moodle - http://moodle.org/ 
-// 
+// This file is part of Moodle - http://moodle.org/
+//
 // Moodle is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 3 of the License, or
@@ -11,7 +11,7 @@
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
@@ -19,7 +19,7 @@
  * Multiple plugin authentication Support library
  *
  * 2006-08-28  File created, AUTH return values defined.
- * 
+ *
  * @package   moodlecore
  * @copyright 1999 onwards Martin Dougiamas  http://dougiamas.com
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -101,7 +101,7 @@ class auth_plugin_base {
     /**
 
      * This is the primary method that is used by the authenticate_user_login()
-     * function in moodlelib.php. 
+     * function in moodlelib.php.
      *
      * This method should return a boolean indicating
      * whether or not the username and password authenticate successfully.
@@ -131,7 +131,7 @@ class auth_plugin_base {
 
     /**
      * Returns the URL for changing the users' passwords, or empty if the default
-     * URL can be used. 
+     * URL can be used.
      *
      * This method is used if can_change_password() returns true.
      * This method is called only when user is logged in, it may use global $USER.
@@ -156,7 +156,7 @@ class auth_plugin_base {
     }
 
     /**
-     * Updates the user's password. 
+     * Updates the user's password.
      *
      * In previous versions of Moodle, the function
      * auth_user_update_password accepted a username as the first parameter. The
@@ -420,7 +420,7 @@ class auth_plugin_base {
         }
         return $authdescription;
     }
-    
+
     /**
      * Returns whether or not the captcha element is enabled, and the admin settings fulfil its requirements.
      *
@@ -433,5 +433,3 @@ class auth_plugin_base {
 
 
 }
-
-?>
index f888abdd51bfb22e62c70567ea3bde4b4fcc2fd3..48c3dece0f3cf50d583c0e1f51ddc2a614e55d26 100644 (file)
@@ -194,5 +194,3 @@ function Base32_decode($inString) {
     \r
     return $outString;\r
 }\r
-\r
-?>
\ No newline at end of file
index 325a0a0d3e5261a7dd2845c50b88e2073b2741e5..a412cbb26ec0234426c5531aa3cd014ce470968b 100755 (executable)
@@ -642,4 +642,3 @@ class boxclient {
     }
 
 }
-?>
index 715dce44b5548da06efdb6f3c9e78f988f0ed538..7b429a12ffaf24d5996eab998fffb72b56f2430c 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
-// This file is part of Moodle - http://moodle.org/ 
-// 
+// This file is part of Moodle - http://moodle.org/
+//
 // Moodle is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 3 of the License, or
@@ -11,7 +11,7 @@
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
@@ -20,7 +20,7 @@
  * by students ('completion')
  *
  * Completion top-level options (admin setting enablecompletion)
- * 
+ *
  * @package   moodlecore
  * @copyright 1999 onwards Martin Dougiamas   {@link http://moodle.com}
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -113,8 +113,8 @@ class completion_info {
 
     /**
      * Determines whether completion is enabled across entire site.
-     * 
-     * Static function. 
+     *
+     * Static function.
      *
      * @global object
      * @return int COMPLETION_ENABLED (true) if completion is enabled for the site,
@@ -396,7 +396,7 @@ class completion_info {
 
     /**
      * Deletes completion state related to an activity for all users.
-     * 
+     *
      * Intended for use only when the activity itself is deleted.
      *
      * @global object
@@ -420,12 +420,12 @@ class completion_info {
 
     /**
      * Recalculates completion state related to an activity for all users.
-     * 
+     *
      * Intended for use if completion conditions change. (This should be avoided
      * as it may cause some things to become incomplete when they were previously
      * complete, with the effect - for example - of hiding a later activity that
      * was previously available.)
-     * 
+     *
      * Resetting state of manual tickbox has same result as deleting state for
      * it.
      *
@@ -479,8 +479,8 @@ class completion_info {
      *   fill the cache, retrieves information from the entire course not just for
      *   this one activity
      * @param int $userid User ID or 0 (default) for current user
-     * @param array $modinfo Supply the value here - this is used for unit 
-     *   testing and so that it can be called recursively from within 
+     * @param array $modinfo Supply the value here - this is used for unit
+     *   testing and so that it can be called recursively from within
      *   get_fast_modinfo. (Needs only list of all CMs with IDs.)
      *   Otherwise the method calls get_fast_modinfo itself.
      * @return object Completion data (record from course_modules_completion)
@@ -593,7 +593,7 @@ class completion_info {
     /**
      * Updates completion data for a particular coursemodule and user (user is
      * determined from $data).
-     * 
+     *
      * (Internal function. Not private, so we can unit-test it.)
      *
      * @global object
@@ -687,10 +687,10 @@ class completion_info {
     /**
      * Obtains progress information across a course for all users on that course, or
      * for all users in a specific group. Intended for use when displaying progress.
-     * 
+     *
      * This includes only users who, in course context, have one of the roles for
      * which progress is tracked (the progresstrackedroles admin option).
-     * 
+     *
      * Users are included (in the first array) even if they do not have
      * completion progress for any course-module.
      *
@@ -788,7 +788,7 @@ WHERE
      * Calculates the completion state that would result from a graded item
      * (where grade-based completion is turned on) based on the actual grade
      * and settings.
-     * 
+     *
      * Internal function. Not private, so we can unit-test it.
      *
      * @uses COMPLETION_INCOMPLETE
@@ -837,8 +837,8 @@ WHERE
             $CFG->wwwroot.'/course/view.php?id='.$this->course->id,null,$error);
     }
 
-    /** 
-     * For testing only. Wipes information cached in user session. 
+    /**
+     * For testing only. Wipes information cached in user session.
      *
      * @global object
      */
@@ -848,6 +848,3 @@ WHERE
         unset($SESSION->completioncacheuserid);
     }
 }
-
-
-?>
index 51a1d767ccfa49ef9f60c3a3f97929636f1c8bb3..43a4be3427266198efe0d92ae0c70a5f35bfcb21 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
-// This file is part of Moodle - http://moodle.org/ 
-// 
+// This file is part of Moodle - http://moodle.org/
+//
 // Moodle is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 3 of the License, or
@@ -11,7 +11,7 @@
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
  * @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com}
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
+
  /**
   * @global object $CFG
   * @name $CFG
@@ -140,7 +140,7 @@ define('COMPONENT_INSTALLED',       3);
 
 /**
  * This class is used to check, download and install items from
- * download.moodle.org to the moodledata directory. 
+ * download.moodle.org to the moodledata directory.
  *
  * It always return true/false in all their public methods to say if
  * execution has ended succesfuly or not. If there is any problem
@@ -545,5 +545,3 @@ class component_installer {
     }
 
 } /// End of component_installer class
-
-?>
index b9f2e663aaf19649b27e30a5301bea56f259e6cb..b9af5f21a67031d4df32969ab19af71c626b3105 100644 (file)
@@ -1,6 +1,6 @@
 <?php
-// This file is part of Moodle - http://moodle.org/ 
-// 
+// This file is part of Moodle - http://moodle.org/
+//
 // Moodle is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 3 of the License, or
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
  * Used for tracking conditions that apply before activities are displayed
  * to students ('conditional availability').
- * 
+ *
  * @package   moodlecore
  * @copyright 1999 onwards Martin Dougiamas  http://dougiamas.com
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -31,7 +31,7 @@ define('CONDITION_STUDENTVIEW_SHOW',1);
 
 /** The $cm variable is expected to contain all completion-related data */
 define('CONDITION_MISSING_NOTHING',0);
-/** The $cm variable is expected to contain the fields from course_modules but 
+/** The $cm variable is expected to contain the fields from course_modules but
     not the course_modules_availability data */
 define('CONDITION_MISSING_EXTRATABLE',1);
 /** The $cm variable is expected to contain nothing except the ID */
@@ -66,12 +66,12 @@ class condition_info {
      * @uses DEBUG_DEVELOPER
      * @uses CONDITION_MISSING_EXTRATABLE
      * @param object $cm Moodle course-module object. May have extra fields
-     *   ->conditionsgrade, ->conditionscompletion which should come from 
-     *   get_fast_modinfo. Should have ->availablefrom, ->availableuntil, 
+     *   ->conditionsgrade, ->conditionscompletion which should come from
+     *   get_fast_modinfo. Should have ->availablefrom, ->availableuntil,
      *   and ->showavailability, ->course; but the only required thing is ->id.
      * @param int $expectingmissing Used to control whether or not a developer
-     *   debugging message (performance warning) will be displayed if some of 
-     *   the above data is missing and needs to be retrieved; a 
+     *   debugging message (performance warning) will be displayed if some of
+     *   the above data is missing and needs to be retrieved; a
      *   CONDITION_MISSING_xx constant
      * @param bool $loaddata If you need a 'write-only' object, set this value
      *   to false to prevent database access from constructor
@@ -95,12 +95,12 @@ class condition_info {
         }
 
         // Missing basic data from course_modules
-        if (!isset($cm->availablefrom) || !isset($cm->availableuntil) || 
+        if (!isset($cm->availablefrom) || !isset($cm->availableuntil) ||
             !isset($cm->showavailability) || !isset($cm->course)) {
             if ($expectingmissing<CONDITION_MISSING_EVERYTHING) {
-                debugging('Performance warning: condition_info constructor is 
-                    faster if you pass in $cm with at least basic fields 
-                    (availablefrom,availableuntil,showavailability,course). 
+                debugging('Performance warning: condition_info constructor is
+                    faster if you pass in $cm with at least basic fields
+                    (availablefrom,availableuntil,showavailability,course).
                     [This warning can be disabled, see phpdoc.]',
                     DEBUG_DEVELOPER);
             }
@@ -114,7 +114,7 @@ class condition_info {
         // Missing extra data
         if (!isset($cm->conditionsgrade) || !isset($cm->conditionscompletion)) {
             if ($expectingmissing<CONDITION_MISSING_EXTRATABLE) {
-                debugging('Performance warning: condition_info constructor is 
+                debugging('Performance warning: condition_info constructor is
                     faster if you pass in a $cm from get_fast_modinfo.
                     [This warning can be disabled, see phpdoc.]',
                     DEBUG_DEVELOPER);
@@ -125,7 +125,7 @@ class condition_info {
     }
 
     /**
-     * Adds the extra availability conditions (if any) into the given 
+     * Adds the extra availability conditions (if any) into the given
      * course-module object.
      *
      * @global object
@@ -145,7 +145,7 @@ class condition_info {
 
             global $DB, $CFG;
             $conditions = $DB->get_records_sql($sql="
-SELECT 
+SELECT
     cma.id as cmaid, gi.*,cma.sourcecmid,cma.requiredcompletion,cma.gradeitemid,
     cma.grademin as conditiongrademin, cma.grademax as conditiongrademax
 FROM
@@ -181,7 +181,7 @@ WHERE
         if (isset($gradeitemobj->id)) {
             require_once($CFG->libdir.'/gradelib.php');
             $item = new grade_item;
-            grade_object::set_properties($item, $gradeitemobj);    
+            grade_object::set_properties($item, $gradeitemobj);
             return $item->get_name();
         } else {
             return '!missing'; // Ooops, missing grade
@@ -276,9 +276,9 @@ WHERE
      * @global object
      * @global object
      * @param object $modinfo Usually leave as null for default. Specify when
-     *   calling recursively from inside get_fast_modinfo. The value supplied 
+     *   calling recursively from inside get_fast_modinfo. The value supplied
      *   here must include list of all CMs with 'id' and 'name'
-     * @return string Information string (for admin) about all restrictions on 
+     * @return string Information string (for admin) about all restrictions on
      *   this item
      */
     public function get_full_information($modinfo=null) {
@@ -343,9 +343,9 @@ WHERE
 
     /**
      * Determines whether this particular course-module is currently available
-     * according to these criteria. 
-     * 
-     * - This does not include the 'visible' setting (i.e. this might return 
+     * according to these criteria.
+     *
+     * - This does not include the 'visible' setting (i.e. this might return
      *   true even if visible is false); visible is handled independently.
      * - This does not take account of the viewhiddenactivities capability.
      *   That should apply later.
@@ -356,14 +356,14 @@ WHERE
      * @uses COMPLETION_COMPLETE_FAIL
      * @uses COMPLETION_COMPLETE_PASS
      * @param string $information If the item has availability restrictions,
-     *   a string that describes the conditions will be stored in this variable; 
+     *   a string that describes the conditions will be stored in this variable;
      *   if this variable is set blank, that means don't display anything
-     * @param bool $grabthelot Performance hint: if true, caches information 
+     * @param bool $grabthelot Performance hint: if true, caches information
      *   required for all course-modules, to make the front page and similar
      *   pages work more quickly (works only for current user)
      * @param int $userid If set, specifies a different user ID to check availability for
      * @param object $modinfo Usually leave as null for default. Specify when
-     *   calling recursively from inside get_fast_modinfo. The value supplied 
+     *   calling recursively from inside get_fast_modinfo. The value supplied
      *   here must include list of all CMs with 'id' and 'name'
      * @return bool True if this item is available to the user, false otherwise
      */
@@ -422,7 +422,7 @@ WHERE
             foreach ($this->cm->conditionsgrade as $gradeitemid=>$minmax) {
                 $score = $this->get_cached_grade_score($gradeitemid, $grabthelot, $userid);
                 if ($score===false ||
-                    (!is_null($minmax->min) && $score<$minmax->min) || 
+                    (!is_null($minmax->min) && $score<$minmax->min) ||
                     (!is_null($minmax->max) && $score>=$minmax->max)) {
                     // Grade fail
                     $available = false;
@@ -473,7 +473,7 @@ WHERE
     }
 
     /**
-     * Shows a time either as a date (if it falls exactly on the day) or 
+     * Shows a time either as a date (if it falls exactly on the day) or
      * a full date and time, according to user's timezone.
      *
      * @param int $time Time
@@ -508,7 +508,7 @@ WHERE
         $this->require_data();
         return $this->cm->showavailability;
     }
-    
+
     /**
      * Internal function cheks that data was loaded.
      *
@@ -522,19 +522,19 @@ WHERE
     }
 
     /**
-     * Obtains a grade score. Note that this score should not be displayed to 
-     * the user, because gradebook rules might prohibit that. It may be a 
+     * Obtains a grade score. Note that this score should not be displayed to
+     * the user, because gradebook rules might prohibit that. It may be a
      * non-final score subject to adjustment later.
      *
      * @global object
      * @global object
      * @global object
      * @param int $gradeitemid Grade item ID we're interested in
-     * @param bool $grabthelot If true, grabs all scores for current user on 
+     * @param bool $grabthelot If true, grabs all scores for current user on
      *   this course, so that later ones come from cache
-     * @param int $userid Set if requesting grade for a different user (does 
+     * @param int $userid Set if requesting grade for a different user (does
      *   not use cache)
-     * @return float Grade score as a percentage in range 0-100 (e.g. 100.0 
+     * @return float Grade score as a percentage in range 0-100 (e.g. 100.0
      *   or 37.21), or false if user does not have a grade yet
      */
     private function get_cached_grade_score($gradeitemid, $grabthelot=false, $userid=0) {
@@ -544,14 +544,14 @@ WHERE
             if (empty($SESSION->gradescorecache) || $SESSION->gradescorecacheuserid!=$USER->id) {
                 $SESSION->gradescorecache = array();
                 $SESSION->gradescorecacheuserid = $USER->id;
-            } 
+            }
             if (!array_key_exists($gradeitemid, $SESSION->gradescorecache)) {
                 if ($grabthelot) {
                     // Get all grades for the current course
                     $rs = $DB->get_recordset_sql("
 SELECT
-    gi.id,gg.finalgrade,gg.rawgrademin,gg.rawgrademax 
-FROM 
+    gi.id,gg.finalgrade,gg.rawgrademin,gg.rawgrademax
+FROM
     {grade_items} gi
     LEFT JOIN {grade_grades} gg ON gi.id=gg.itemid AND gg.userid=?
 WHERE
@@ -560,7 +560,7 @@ WHERE
                         $SESSION->gradescorecache[$record->id] =
                             is_null($record->finalgrade)
                                 // No grade = false
-                                ? false 
+                                ? false
                                 // Otherwise convert grade to percentage
                                 : (($record->finalgrade - $record->rawgrademin) * 100) /
                                     ($record->rawgrademax - $record->rawgrademin);
@@ -605,8 +605,8 @@ WHERE
         }
     }
 
-    /** 
-     * For testing only. Wipes information cached in user session. 
+    /**
+     * For testing only. Wipes information cached in user session.
      *
      * @global object
      */
@@ -617,7 +617,7 @@ WHERE
     }
 
     /**
-     * Utility function called by modedit.php; updates the 
+     * Utility function called by modedit.php; updates the
      * course_modules_availability table based on the module form data.
      *
      * @param object $cm Course-module with as much data as necessary, min id
@@ -671,4 +671,3 @@ WHERE
         return array_key_exists($cm->id, $CONDITIONLIB_PRIVATE->usedincondition[$course->id]);
     }
 }
-?>
index cebe02e5894fd838f5736ea937bc3cd624a0f81b..8ef0878395ff2ac1c6b24b8202572512ca29ad65 100644 (file)
@@ -318,4 +318,3 @@ class csv_import_reader {
         return $iiid;
     }
 }
-?>
index 80597459ab947216cc80b87f834f990be7786fde..5d860b27e7f97102e48e39aa3e78ff00f0c85d54 100644 (file)
@@ -51,5 +51,3 @@ function php_check_register_globals($result) {
 
     return $result;
 }
-
-?>
index ab0281194cea17deff90396ff6c79507d474e465..6a5b1ca00c32dcf97928db98c254e16980cb8caa 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
-// This file is part of Moodle - http://moodle.org/ 
-// 
+// This file is part of Moodle - http://moodle.org/
+//
 // Moodle is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 3 of the License, or
@@ -11,7 +11,7 @@
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
- /** 
+ /**
   * The maximum courses in a category
-  * MAX_COURSES_IN_CATEGORY * MAX_COURSE_CATEGORIES must not be more than max integer! 
+  * MAX_COURSES_IN_CATEGORY * MAX_COURSE_CATEGORIES must not be more than max integer!
   */
 define('MAX_COURSES_IN_CATEGORY', 10000);
-/** 
+/**
   * The maximum number of course categories
-  * MAX_COURSES_IN_CATEGORY * MAX_COURSE_CATEGORIES must not be more than max integer! 
+  * MAX_COURSES_IN_CATEGORY * MAX_COURSE_CATEGORIES must not be more than max integer!
   */
 define('MAX_COURSE_CATEGORIES', 10000);
 
- /** 
+ /**
   * Number of seconds to wait before updating lastaccess information in DB.
   */
- define('LASTACCESS_UPDATE_SECS', 60); 
+ define('LASTACCESS_UPDATE_SECS', 60);
 
 /**
  * Returns $user object of the main admin user
@@ -265,7 +265,7 @@ function search_users($courseid, $groupid, $searchtext, $sort='', array $excepti
  * @param string $page The page or records to return
  * @param string $recordsperpage The number of records to return per page
  * @param string $fields A comma separated list of fields to be returned from the chosen table.
- * @return array|int|bool  {@link $USER} records unless get is false in which case the integer count of the records found is returned. 
+ * @return array|int|bool  {@link $USER} records unless get is false in which case the integer count of the records found is returned.
   *                        False is returned if an error is encountered.
  */
 function get_users($get=true, $search='', $confirmed=false, array $exceptions=null, $sort='firstname ASC',
@@ -508,7 +508,7 @@ function get_courses($categoryid="all", $sort="c.sortorder ASC", $fields="c.*")
  * @param int $totalcount Reference for the number of courses
  * @param string $limitfrom The course to start from
  * @param string $limitnum The number of courses to limit to
- * @return array Array of courses 
+ * @return array Array of courses
  */
 function get_courses_page($categoryid="all", $sort="c.sortorder ASC", $fields="c.*",
                           &$totalcount, $limitfrom="", $limitnum="") {
@@ -929,7 +929,7 @@ function get_my_courses($userid, $sort='visible DESC,sortorder ASC', $fields=NUL
                 if ($limit > 0 && $cc >= $limit) {
                     break;
                 }
-                
+
                 $courses[$c->id] = $c;
                 $cc++;
             }
@@ -1287,7 +1287,7 @@ function get_all_subcategories($catid) {
 
 /**
  * Return specified category, default if given does not exist
- * 
+ *
  * @global object
  * @uses MAX_COURSES_IN_CATEGORY
  * @uses CONTEXT_COURSECAT
@@ -1947,7 +1947,7 @@ function get_all_instances_in_course($modulename, $course, $userid=NULL, $includ
  * is visible or not, groupmembersonly visibility not tested
  *
  * @global object
+
  * @param $moduletype Name of the module eg 'forum'
  * @param $module Object which is the instance of the module
  * @return bool Success
@@ -2001,8 +2001,8 @@ function coursemodule_visible_for_user($cm, $userid=0) {
     if ($CFG->enableavailability) {
         require_once($CFG->libdir.'/conditionlib.php');
         $ci=new condition_info($cm,CONDITION_MISSING_EXTRATABLE);
-        if(!$ci->is_available($cm->availableinfo,false,$userid) and 
-            !has_capability('moodle/course:viewhiddenactivities', 
+        if(!$ci->is_available($cm->availableinfo,false,$userid) and
+            !has_capability('moodle/course:viewhiddenactivities',
                 get_context_instance(CONTEXT_MODULE, $cm->id), $userid)) {
             return false;
         }
@@ -2440,5 +2440,3 @@ function user_can_create_courses() {
     $catsrs->close();
     return false;
 }
-
-?>
index 69009a61dd3df0fd57d3370048f11945a915ca71..eddbdd51f7ccf701f2754a0d49f160e660f1da9d 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 //
 // Capability definitions for Moodle core.
 //
@@ -1481,6 +1481,3 @@ $moodle_capabilities = array(
         )
     )
 );
-
-
-?>
index 1caad0df040ac2d3b61ba37aad81f4d5c708fcf1..b7751cb173aa6bb492395fd197f341eeab0d0ce8 100644 (file)
@@ -1,4 +1,4 @@
-<?php // $Id$
+<?php
 
 ///////////////////////////////////////////////////////////////////////////
 // Defines core event handlers                                           //
 $handlers = array (
 
 /* Messaging required parameters (object):
- *  modulename     - 
+ *  modulename     -
  *  userfrom
  *  userto
  *  subject
  *  fullmessage - the full message in a given format
  *  fullmessageformat  - the format if the full message (FORMAT_MOODLE, FORMAT_HTML, ..)
- *  fullmessagehtml  - the full version (the message processor will choose with one to use) 
+ *  fullmessagehtml  - the full version (the message processor will choose with one to use)
  *  smallmessage - the small version of the message
  */
 
     'message_send' => array (
          'handlerfile'      => '/lib/messagelib.php',
-         'handlerfunction'  => 'message_send_handler', 
+         'handlerfunction'  => 'message_send_handler',
          'schedule'         => 'instant'
      ),
 
@@ -106,5 +106,3 @@ role_assigned         - object role_assignments table record
 role_unassigned       - object role_assignments table record
 
 */
-
-?>
index 949a44131a20fd75e712bf199edaec579a524a27..2f210f0c9d023e8d31e0326dbcdd8d5b6d71dc6d 100644 (file)
@@ -1,4 +1,4 @@
-<?php  //$Id$
+<?php
 
 // This file is executed right after the install.xml
 //
@@ -216,4 +216,4 @@ function xmldb_main_install() {
     set_role_contextlevels($guestrole,          get_default_contextlevels('guest'));
     set_role_contextlevels($userrole,           get_default_contextlevels('user'));
 
-}
\ No newline at end of file
+}
index 44fd8f89a40a06d5a9eb9e989a0e5816307b8b6a..2a4f2d6b164b49f63a1a197cba4f863b30a84a22 100644 (file)
@@ -1,4 +1,4 @@
-<?php // $Id$
+<?php
 
 ///////////////////////////////////////////////////////////////////////////
 // Defines message providers (types of messages being sent)              //
index 083f8466b52137a0148267896e0cfca9f344b673..1d500961dd5e1d6e6f4e332999968d0717a7b626 100644 (file)
@@ -1,4 +1,4 @@
-<?PHP  //$Id$
+<?PHP
 
 // This file keeps track of upgrades to Moodle.
 //
@@ -2705,7 +2705,7 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
     /// Main savepoint reached
         upgrade_main_savepoint($result, 2009103000);
     }
-    
+
     return $result;
 }
 
index 9429123d494edd5594f6f2ab737315131d8f06e9..fe915a4792a8dd787762cc2516caabf423dcb0a0 100644 (file)
@@ -1,4 +1,4 @@
-<?php  //$Id$
+<?php
 
 /*
  * This file is used for special upgrade functions - for example groups and gradebook.
@@ -342,7 +342,7 @@ function upgrade_fix_incorrect_mnethostids() {
  * before doing this I checked that the blocks did not override the
  * {@link block_base::instance_delete()} method. Should this function ever
  * be repeated check this again
- * 
+ *
  * @link lib/db/upgrade.php
  *
  * @since navigation upgrade 20090828
@@ -379,5 +379,3 @@ function upgrade_cleanup_unwanted_block_contexts($contextidarray) {
 
     return ($outcome1 && $outcome2 && $outcome4 && $outcome4);
 }
-
-?>
index 6411b87814a3e79786343d1817c5977593426554..bbf30554a7cbd910f9147276dfaa589751380185 100644 (file)
@@ -429,7 +429,7 @@ class database_manager {
     }
 
     /**
-     * This function will generate all the needed SQL statements, specific for each 
+     * This function will generate all the needed SQL statements, specific for each
      * RDBMS type and, finally, it will execute all those statements against the DB.
      *
      * @param object $structure xmldb_structure object
@@ -965,11 +965,11 @@ class database_manager {
         }
         return $schema;
     }
-    
+
     /**
      * Checks the database schema against a schema specified by an xmldb_structure object
      * @param xmldb_structure $schema export schema describing all known tables
-     * @return array keyed by table name with array of difference messages as values 
+     * @return array keyed by table name with array of difference messages as values
      */
     public function check_database_schema(xmldb_structure $schema) {
         $errors = array();
@@ -1036,6 +1036,3 @@ class database_manager {
         return $errors;
     }
 }
-
-
-?>
index 9392aed3abf64f496549d4f444917af253643e7c..e5dbcfcc936f705586aaf434133dce75aced3cde 100644 (file)
@@ -641,5 +641,3 @@ class mssql_sql_generator extends sql_generator {
         return $reserved_words;
     }
 }
-
-?>
index 74b092f3215bc85f49b9c7400e3670b7d2972938..56911c9217bb16cb91ea48bd081f0d5db4d819b3 100644 (file)
@@ -426,5 +426,3 @@ class mysql_sql_generator extends sql_generator {
         return $reserved_words;
     }
 }
-
-?>
index f28530851754ab7fd95c70290cb42f95cb09cadd..c37b5eea70075b5b2f77448a10b4598f66e57c92 100644 (file)
@@ -692,5 +692,3 @@ class oracle_sql_generator extends sql_generator {
         return $reserved_words;
     }
 }
-
-?>
index 9d78fbcc61e9093cfb161db5353ded80003755ca..468d4bf4f1783709700abd992281b90fbb4dc7f6 100644 (file)
@@ -473,5 +473,3 @@ function getSequenceFromDB($xmldb_table) {
         return $reserved_words;
     }
 }
-
-?>
index a267004322934b3dad4b8f906b2fe3791ca57ebf..529c7c5c763a206481ab8c0d225ab57e679ab70d 100755 (executable)
@@ -1402,4 +1402,3 @@ class ddl_test extends UnitTestCase {
 */
 
 }
-?>
index d5ca19eeac65ee2fc321cd4736b3f4a1ff4da9a4..f9d3763dc9e47ca0b7dbe235ac45a96d70c599f3 100644 (file)
@@ -31,7 +31,7 @@
  */
 
 /**
- * Abstract sql generator class, base for all bd specific implementations. 
+ * Abstract sql generator class, base for all bd specific implementations.
  */
 abstract class sql_generator {
 
@@ -1237,5 +1237,3 @@ abstract class sql_generator {
         return $s;
     }
 }
-
-?>
index 31b0eb7969ccb2b24c951c86ea9fd37b1396befe..56bb04a0339e96add2ea55ce78915d357c243321 100644 (file)
@@ -263,14 +263,14 @@ class sqlite_sql_generator extends sql_generator {
         $results[] = 'COMMIT';
         return $results;
     }
-    
+
     /**
      * Given one xmldb_table and one xmldb_field, return the SQL statements needded to alter the field in the table
      */
     public function getAlterFieldSQL($xmldb_table, $xmldb_field, $skip_type_clause = NULL, $skip_default_clause = NULL, $skip_notnull_clause = NULL) {
         return $this->getAlterTableSchema($xmldb_table, $xmldb_field, $xmldb_field);
     }
-    
+
     /**
      * Given one xmldb_table and one xmldb_key, return the SQL statements needded to add the key to the table
      * note that undelying indexes will be added as parametrised by $xxxx_keys and $xxxx_index parameters
@@ -360,7 +360,7 @@ class sqlite_sql_generator extends sql_generator {
         $xmldb_table->deleteKey($xmldb_key->getName());
         return $this->getAlterTableSchema($xmldb_table);
     }
-    
+
     /**
      * Given one xmldb_table and one xmldb_field, return the SQL statements needded to drop its default
      * (usually invoked from getModifyDefaultSQL()
index be39cf93cd0c2d1baf08aa680d34f75f017b4281..efdfff3776a21bda6bc84c487b1eeecca000c4f1 100644 (file)
@@ -156,7 +156,7 @@ class pgsql_native_moodle_database extends moodle_database {
         }
         $dberr = ob_get_contents();
         ob_end_clean();
-        
+
         $status = pg_connection_status($this->pgsql);
 
         if ($status === false or $status === PGSQL_CONNECTION_BAD) {
index 18a82457fecefeee8076d964fc6fb6ed2c89be6e..a4a2fbc99a000d8611cfbd5f5a95fd7399947823 100644 (file)
@@ -86,7 +86,7 @@ class dml_read_exception extends dml_exception {
     public $sql;
     /** @var array */
     public $params;
-    
+
     /**
      * Constructor
      * @param string $error
@@ -110,7 +110,7 @@ class dml_multiple_records_exception extends dml_exception {
     public $sql;
     /** @var array */
     public $params;
-    
+
     /**
      * Constructor
      * @param string $table table name if known, '' if unknown
@@ -133,7 +133,7 @@ class dml_missing_record_exception extends dml_exception {
     public $sql;
     /** @var array */
     public $params;
-    
+
     /**
      * Constructor
      * @param string $table table name if known, '' if unknown
@@ -147,7 +147,7 @@ class dml_missing_record_exception extends dml_exception {
         $this->tablename = $tablename;
         $this->sql       = $sql;
         $this->params    = $params;
-        
+
         switch ($tablename) {
             case null:
                 $errcode = 'invalidrecordunknown';
index df4df27cb5d57a2f3b2ca06ba6a2ad6256242a6b..3c8e7c59c0560f59d0077e3fd3aba76ee246b0b8 100644 (file)
@@ -1578,4 +1578,3 @@ function process_environment_result($element, &$result) {
 /// Process restrict, modifying $result if needed.
     process_environment_restrict($element, $result);
 }
-?>
index faba2a34c45263c1bf1735edba79ea093aa83853..c36c42b899ccf82a520abf57bc6e94f969081755 100755 (executable)
@@ -1,7 +1,7 @@
 <?php
 
-// This file is part of Moodle - http://moodle.org/ 
-// 
+// This file is part of Moodle - http://moodle.org/
+//
 // Moodle is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 3 of the License, or
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
  * Library of functions for events manipulation.
- * 
+ *
  * The public API is all at the end of this file.
  *
  * @copyright 1999 onwards Martin Dougiamas  {@link http://moodle.com}
@@ -532,4 +532,3 @@ function events_pending_count($eventname) {
              WHERE qh.handlerid = h.id AND h.eventname=?";
     return $DB->count_records_sql($sql, array($eventname));
 }
-?>
index bbdc93879b8927610dcc16e99cb96f0948bfd398..03c5cfdbf4775470736386842f911a6701643c4a 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
-// This file is part of Moodle - http://moodle.org/ 
-// 
+// This file is part of Moodle - http://moodle.org/
+//
 // Moodle is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 3 of the License, or
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
  * excellib.class.php
- * 
+ *
  * @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com}
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  * @package   moodlecore
@@ -135,10 +135,10 @@ class MoodleExcelWorksheet {
      */
     function MoodleExcelWorksheet($name, &$workbook, $latin_output=false) {
 
-    /// Internally, add one sheet to the workbook    
+    /// Internally, add one sheet to the workbook
         $this->pear_excel_worksheet =& $workbook->addWorksheet($name);
         $this->latin_output = $latin_output;
-    /// Set encoding to UTF-16LE 
+    /// Set encoding to UTF-16LE
         if (!$this->latin_output) { /// Only if don't want to use latin (win1252) stronger output
             $this->pear_excel_worksheet->setInputEncoding('UTF-16LE');
         }
@@ -316,7 +316,7 @@ class MoodleExcelWorksheet {
     function hide_screen_gridlines() {
         $this->pear_excel_worksheet->hideScreenGridlines();
     }
-    
+
     /**
     * Insert a 24bit bitmap image in a worksheet.
     *
@@ -388,7 +388,7 @@ class MoodleExcelFormat {
      * @param array $properties
      */
     function MoodleExcelFormat(&$workbook, $properties = array()) {
-    /// Internally, add one sheet to the workbook    
+    /// Internally, add one sheet to the workbook
         $this->pear_excel_format =& $workbook->addFormat();
     /// If we have something in the array of properties, compute them
         foreach($properties as $property => $value) {
@@ -623,5 +623,3 @@ class MoodleExcelFormat {
     }
 
 }
-
-?>
index 1cac02d0fedf12d553ed8806b17edce8671fa9a7..b9cc2ed3d223f12cf09551bf3c06208f2925f508 100644 (file)
@@ -1885,7 +1885,7 @@ function get_records_csv($file, $table) {
 }
 
 /**
- * 
+ *
  * @global object
  * @global object
  * @param string $file The file to put the CSV content into
@@ -2143,7 +2143,7 @@ class curl {
     /** @var string */
     public  $info;
     public  $error;
-    
+
     /** @var array */
     private $options;
     /** @var string */
@@ -2493,7 +2493,7 @@ class curl {
     /**
      * HTTP HEAD method
      *
-     * @see request() 
+     * @see request()
      *
      * @param string $url
      * @param array $options
@@ -2510,7 +2510,7 @@ class curl {
      * HTTP POST method
      *
      * @param string $url
-     * @param array|string $params 
+     * @param array|string $params
      * @param array $options
      * @return bool
      */
@@ -2538,7 +2538,7 @@ class curl {
      * HTTP GET method
      *
      * @param string $url
-     * @param array $params 
+     * @param array $params
      * @param array $options
      * @return bool
      */
@@ -2556,7 +2556,7 @@ class curl {
      * HTTP PUT method
      *
      * @param string $url
-     * @param array $params 
+     * @param array $params
      * @param array $options
      * @return bool
      */
@@ -2582,7 +2582,7 @@ class curl {
      * HTTP DELETE method
      *
      * @param string $url
-     * @param array $params 
+     * @param array $params
      * @param array $options
      * @return bool
      */
index 50a0dfc248d202d6b9919873154477eff6778270..ebc7f917b0ac83dc0030a8c3596cb30dca30108f 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
-// This file is part of Moodle - http://moodle.org/ 
-// 
+// This file is part of Moodle - http://moodle.org/
+//
 // Moodle is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 3 of the License, or
@@ -11,7 +11,7 @@
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
@@ -44,15 +44,15 @@ define('TEXTFILTER_DISABLED', -9999);
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 class filter_manager {
-    /** 
+    /**
      * @var array This list of active filters, by context, for filtering content.
-     * An array contextid => array of filter objects. 
+     * An array contextid => array of filter objects.
      */
     protected $textfilters = array();
 
     /**
      * @var array This list of active filters, by context, for filtering strings.
-     * An array contextid => array of filter objects. 
+     * An array contextid => array of filter objects.
      */
     protected $stringfilters = array();
 
@@ -82,8 +82,8 @@ class filter_manager {
         return self::$singletoninstance;
     }
 
-    /** 
-     * Load all the filters required by this context. 
+    /**
+     * Load all the filters required by this context.
      *
      * @param object $context
      * @param int $courseid
@@ -137,7 +137,7 @@ class filter_manager {
     }
 
     /**
-     * @todo Document this function 
+     * @todo Document this function
      * @param string $text
      * @param array $filterchain
      * @return string $text
@@ -150,7 +150,7 @@ class filter_manager {
     }
 
     /**
-     * @todo Document this function 
+     * @todo Document this function
      * @param object $context
      * @param int $courseid
      * @return object A text filter
@@ -163,7 +163,7 @@ class filter_manager {
     }
 
     /**
-     * @todo Document this function 
+     * @todo Document this function
      * @param object $context
      * @param int $courseid
      * @return object A string filter
@@ -203,7 +203,7 @@ class filter_manager {
     }
 
     /**
-     * @todo Document this function 
+     * @todo Document this function
      * @param object $context
      * @param int $courseid
      * @return object A string filter
@@ -404,8 +404,8 @@ class legacy_filter extends moodle_text_filter {
 define('EXCL_SEPARATOR', '-%-');
 
 /**
- * This is just a little object to define a phrase and some instructions 
- * for how to process it.  Filters can create an array of these to pass 
+ * This is just a little object to define a phrase and some instructions
+ * for how to process it.  Filters can create an array of these to pass
  * to the filter_phrases function below.
  *
  * @package   moodlecore
@@ -441,9 +441,9 @@ class filterobject {
      * @param bool $fullmatch
      * @param mixed $replacementphrase
      */
-    function filterobject($phrase, $hreftagbegin='<span class="highlight">', 
-                                   $hreftagend='</span>', 
-                                   $casesensitive=false, 
+    function filterobject($phrase, $hreftagbegin='<span class="highlight">',
+                                   $hreftagend='</span>',
+                                   $casesensitive=false,
                                    $fullmatch=false,
                                    $replacementphrase=NULL) {
 
@@ -1005,7 +1005,7 @@ function filter_phrases($text, &$link_array, $ignoretagsopen=NULL, $ignoretagscl
         $ignoretagsopen  = array('<a\s[^>]+?>');
         $ignoretagsclose = array('</a>');
     }
-    
+
     if ( is_array($ignoretagsopen) ) {
         foreach ($ignoretagsopen as $open) $filterignoretagsopen[] = $open;
         foreach ($ignoretagsclose as $close) $filterignoretagsclose[] = $close;
@@ -1015,7 +1015,7 @@ function filter_phrases($text, &$link_array, $ignoretagsopen=NULL, $ignoretagscl
     $text = preg_replace('/([#*%])/','\1\1',$text);
 
 
-////Remove everything enclosed by the ignore tags from $text    
+////Remove everything enclosed by the ignore tags from $text
     filter_save_ignore_tags($text,$filterignoretagsopen,$filterignoretagsclose,$ignoretags);
 
 /// Remove tags from $text
@@ -1083,7 +1083,7 @@ function filter_phrases($text, &$link_array, $ignoretagsopen=NULL, $ignoretagscl
 
         /// Work calculated
             $linkobject->work_calculated = true;
-    
+
         }
 
     /// If $CFG->filtermatchoneperpage, avoid previously (request) linked phrases
@@ -1116,12 +1116,12 @@ function filter_phrases($text, &$link_array, $ignoretagsopen=NULL, $ignoretagscl
 
     /// Finally we do our highlighting
         if (!empty($CFG->filtermatchonepertext) || !empty($CFG->filtermatchoneperpage)) {
-            $resulttext = preg_replace('/('.$linkobject->work_phrase.')/'.$modifiers, 
+            $resulttext = preg_replace('/('.$linkobject->work_phrase.')/'.$modifiers,
                                       $linkobject->work_hreftagbegin.
                                       $linkobject->work_replacementphrase.
                                       $linkobject->work_hreftagend, $text, 1);
         } else {
-            $resulttext = preg_replace('/('.$linkobject->work_phrase.')/'.$modifiers, 
+            $resulttext = preg_replace('/('.$linkobject->work_phrase.')/'.$modifiers,
                                       $linkobject->work_hreftagbegin.
                                       $linkobject->work_replacementphrase.
                                       $linkobject->work_hreftagend, $text);
@@ -1132,7 +1132,7 @@ function filter_phrases($text, &$link_array, $ignoretagsopen=NULL, $ignoretagscl
         if ($resulttext != $text) {
         /// Set $text to $resulttext
             $text = $resulttext;
-        /// Remove everything enclosed by the ignore tags from $text    
+        /// Remove everything enclosed by the ignore tags from $text
             filter_save_ignore_tags($text,$filterignoretagsopen,$filterignoretagsclose,$ignoretags);
         /// Remove tags from $text
             filter_save_tags($text,$tags);
@@ -1161,7 +1161,7 @@ function filter_phrases($text, &$link_array, $ignoretagsopen=NULL, $ignoretagscl
         $text = str_replace(array_keys($ignoretags),$ignoretags,$text);
     }
 
-    //// Remove the protective doubleups 
+    //// Remove the protective doubleups
     $text =  preg_replace('/([#*%])(\1)/','\1',$text);
 
 /// Add missing javascript for popus
@@ -1182,14 +1182,14 @@ function filter_remove_duplicates($linkarray) {
     $lconcepts = array(); // a lower case version for case insensitive
 
     $cleanlinks = array();
-    
+
     foreach ($linkarray as $key=>$filterobject) {
         if ($filterobject->casesensitive) {
             $exists = in_array($filterobject->phrase, $concepts);
         } else {
             $exists = in_array(moodle_strtolower($filterobject->phrase), $lconcepts);
         }
-        
+
         if (!$exists) {
             $cleanlinks[] = $filterobject;
             $concepts[] = $filterobject->phrase;
@@ -1208,7 +1208,7 @@ function filter_remove_duplicates($linkarray) {
  *
  * @param string $text                  the text that we are filtering (in/out)
  * @param array $filterignoretagsopen  an array of open tags to start searching
- * @param array $filterignoretagsclose an array of close tags to end searching 
+ * @param array $filterignoretagsclose an array of close tags to end searching
  * @param array $ignoretags            an array of saved strings useful to rebuild the original text (in/out)
  **/
 function filter_save_ignore_tags(&$text,$filterignoretagsopen,$filterignoretagsclose,&$ignoretags) {
@@ -1220,7 +1220,7 @@ function filter_save_ignore_tags(&$text,$filterignoretagsopen,$filterignoretagsc
         $opentag  = str_replace('/','\/',$opentag); // delimit forward slashes
         $closetag = str_replace('/','\/',$closetag); // delimit forward slashes
         $pregexp = '/'.$opentag.'(.*?)'.$closetag.'/is';
-        
+
         preg_match_all($pregexp, $text, $list_of_ignores);
         foreach (array_unique($list_of_ignores[0]) as $key=>$value) {
             $prefix = (string)(count($ignoretags) + 1);
@@ -1236,7 +1236,7 @@ function filter_save_ignore_tags(&$text,$filterignoretagsopen,$filterignoretagsc
  * Extract tags (any text enclosed by < and > to avoid being processed by filters.
  * It returns the text converted with some <%xEXCL_SEPARATORx%> codes replacing the extracted text. Such extracted
  * texts are returned in the tags array (as values), with codes as keys.
- *      
+ *
  * @param string $text   the text that we are filtering (in/out)
  * @param array $tags   an array of saved strings useful to rebuild the original text (in/out)
  **/
@@ -1268,7 +1268,7 @@ function filter_add_javascript($text) {
     if (strpos($text, 'onclick="return openpopup') === FALSE) {
         return $text; // no popup - no need to add javascript
     }
-    $js =" 
+    $js ="
     <script type=\"text/javascript\">
     <!--
         function openpopup(url,name,options,fullscreen) {
@@ -1292,4 +1292,3 @@ function filter_add_javascript($text) {
     //last chance - try adding head element
     return preg_replace("/<html.*?>/is", "\\0<head>".$js.'</head>', $text);
 }
-?>
index 47854c39f2e9b86a38a785d94608ca79a92a7f90..b7b38cf9cc90e9ee20b1102a63741b51db3e7528 100644 (file)
@@ -1,6 +1,6 @@
 <?php
-// This file is part of Moodle - http://moodle.org/ 
-// 
+// This file is part of Moodle - http://moodle.org/
+//
 // Moodle is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 3 of the License, or
@@ -10,7 +10,7 @@
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
@@ -62,7 +62,7 @@ if (!empty($CFG->debug) and $CFG->debug >= DEBUG_ALL){
 }
 
 /**
- * 
+ *
  * @staticvar bool $done
  */
 function form_init_date_js() {
@@ -231,7 +231,7 @@ abstract class moodleform {
 
     /**
      * Internal method. Validates all old-style uploaded files.
-     * 
+     *
      * @global object
      * @global object
      * @param array $files
@@ -1288,7 +1288,7 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless {
     function getReqHTML(){
         return $this->_reqHTML;
     }
-    
+
     /**
      * @return string
      */
@@ -1995,7 +1995,7 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
 
 
     }
-    
+
     /**
      * @param object $group Passed by reference
      * @param mixed $required
@@ -2167,7 +2167,7 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
             $PAGE->requires->string_for_js('showadvanced', 'form');
             $PAGE->requires->string_for_js('hideadvanced', 'form');
             $PAGE->requires->js_function_call('showAdvancedInit', Array($elementName.(string)$advformcount, $elementName, $buttonlabel));
-            
+
             $advformcount++;
             $header_html = str_replace('{button}', $button_nojs, $header_html);
         } else {
@@ -2243,4 +2243,3 @@ MoodleQuickForm::registerElementType('text', "$CFG->libdir/form/text.php", 'Mood
 MoodleQuickForm::registerElementType('textarea', "$CFG->libdir/form/textarea.php", 'MoodleQuickForm_textarea');
 MoodleQuickForm::registerElementType('url', "$CFG->libdir/form/url.php", 'MoodleQuickForm_url');
 MoodleQuickForm::registerElementType('warning', "$CFG->libdir/form/warning.php", 'MoodleQuickForm_warning');
-?>
index e749a03a211c26cab0f2ab45363bb1e7d1f8af74..26a2cceb3d021d59c4ed4560a1996d4194867019 100644 (file)
@@ -337,4 +337,3 @@ function upgrade_profile_image($id, $dir='users') {
     }
     return 0;
 }
-?>
index 8b89abaec1c93327296b8829768ea8ab509fe6a3..31f2b27a1e7977f650c2f5fbc3ed57899f7ae78c 100644 (file)
@@ -29,9 +29,9 @@
 require_once($CFG->libdir.'/filelib.php');
 
 /**
- * Base class for google authenticated http requests 
- * 
- * Most Google API Calls required that requests are sent with an 
+ * Base class for google authenticated http requests
+ *
+ * Most Google API Calls required that requests are sent with an
  * Authorization header + token. This class extends the curl class
  * to aid this
  *
@@ -76,7 +76,7 @@ abstract class google_auth_request extends curl{
 }
 
 /*******
- * The following two classes are usd to implement AuthSub google 
+ * The following two classes are usd to implement AuthSub google
  * authtentication, as documented here:
  * http://code.google.com/apis/accounts/docs/AuthSub.html
  *******/
@@ -94,7 +94,7 @@ class google_authsub_request extends google_auth_request {
     const AUTHSESSION_URL = 'https://www.google.com/accounts/AuthSubSessionToken';
 
     /**
-     * Constructor. Calls constructor of its parents 
+     * Constructor. Calls constructor of its parents
      *
      * @param string $authtoken The token to upgrade to a session token
      */
@@ -104,9 +104,9 @@ class google_authsub_request extends google_auth_request {
     }
 
     /**
-     * Requests a long-term session token from google based on the 
+     * Requests a long-term session token from google based on the
      *
-     * @return string Sub-Auth token 
+     * @return string Sub-Auth token
      */
     public function get_session_token(){
         $content = $this->get(google_authsub_request::AUTHSESSION_URL);
@@ -137,7 +137,7 @@ class google_authsub extends google_auth_request {
     const REVOKE_TOKEN_URL = 'https://www.google.com/accounts/AuthSubRevokeToken';
 
     /**
-     * Constructor, allows subauth requests using the response from an initial 
+     * Constructor, allows subauth requests using the response from an initial
      * AuthSubRequest or with the subauth long-term token. Note that constructing
      * this object without a valid token will cause an exception to be thrown.
      *
@@ -194,7 +194,7 @@ class google_authsub extends google_auth_request {
      * Creates a login url for subauth request
      *
      * @param string $returnaddr The address which the user should be redirected to recieve the token
-     * @param string $realm The google realm which is access is being requested 
+     * @param string $realm The google realm which is access is being requested
      * @return string URL to bounce the user to
      */
     public static function login_url($returnaddr, $realm){
@@ -278,16 +278,16 @@ class google_docs {
         $files = array();
         foreach($xml->entry as $gdoc){
 
-            // there doesn't seem to to be cleaner way of getting the id/type 
+            // there doesn't seem to to be cleaner way of getting the id/type
             // than spliting this..
             if (preg_match('/^http:\/\/docs.google.com\/feeds\/documents\/private\/full\/([^%]*)%3A(.*)$/', $gdoc->id, $matches)){
                 $docid = $matches[2];
 
-                // FIXME: We're making hard-coded choices about format here. 
-                // If the repo api can support it, we could let the user 
+                // FIXME: We're making hard-coded choices about format here.
+                // If the repo api can support it, we could let the user
                 // chose.
                 switch($matches[1]){
-                case 'document': 
+                case 'document':
                     $title = $gdoc->title.'.rtf';
                     $source = 'http://docs.google.com/feeds/download/documents/Export?docID='.$docid.'&exportFormat=rtf';
                     break;
@@ -301,9 +301,9 @@ class google_docs {
                     break;
                 }
 
-                $files[] =  array( 'title' => $title, 
+                $files[] =  array( 'title' => $title,
                     'url' => "{$gdoc->link[0]->attributes()->href}",
-                    'source' => $source, 
+                    'source' => $source,
                     'date'   => usertime(strtotime($gdoc->updated)),
                     'thumbnail' => $CFG->wwwroot.'/pix/f/'.mimeinfo('icon32', $title)
                 );
@@ -432,7 +432,7 @@ class google_picasa {
     }
 
     /**
-     * Does text search on the users photos and returns 
+     * Does text search on the users photos and returns
      * matches in format for picasa api
      *
      * @param string $query Search terms
@@ -526,11 +526,11 @@ class google_picasa {
 }
 
 /**
- * Beginings of an implementation of Clientogin authenticaton for google 
+ * Beginings of an implementation of Clientogin authenticaton for google
  * accounts as documented here:
  * {@link http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html#ClientLogin}
  *
- * With this authentication we have to accept a username and password and to post 
+ * With this authentication we have to accept a username and password and to post
  * it to google. Retrieving a token for use afterwards.
  *
  * @package    moodlecore
@@ -573,5 +573,3 @@ class google_authclient extends google_auth_request {
         return 'GoogleLogin auth=';
     }
 }
-
-?>
index 75a7439d6dfc06dbe97d34677d16a266a7a02645..ed75412ca769308432d6485d5fbb4cbf5a9ee280 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
-// This file is part of Moodle - http://moodle.org/ 
-// 
+// This file is part of Moodle - http://moodle.org/
+//
 // Moodle is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 // the Free Software Foundation, either version 3 of the License, or
@@ -11,7 +11,7 @@
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
@@ -709,7 +709,7 @@ function grade_format_gradevalue($value, &$grade_item, $localized=true, $display
 }
 
 /**
- * @todo Document this function 
+ * @todo Document this function
  */
 function grade_format_gradevalue_real($value, $grade_item, $decimals, $localized) {
     if ($grade_item->gradetype == GRADE_TYPE_SCALE) {
@@ -725,7 +725,7 @@ function grade_format_gradevalue_real($value, $grade_item, $decimals, $localized
     }
 }
 /**
- * @todo Document this function 
+ * @todo Document this function
  */
 function grade_format_gradevalue_percentage($value, $grade_item, $decimals, $localized) {
     $min = $grade_item->grademin;
@@ -738,7 +738,7 @@ function grade_format_gradevalue_percentage($value, $grade_item, $decimals, $loc
     return format_float($percentage, $decimals, $localized).' %';
 }
 /**
- * @todo Document this function 
+ * @todo Document this function
  */
 function grade_format_gradevalue_letter($value, $grade_item) {
     $context = get_context_instance(CONTEXT_COURSE, $grade_item->courseid);
index f98136b8d4e341fc3ba1bf66e31871eff3c24126..d289e1ee3bb5ffbc48163d389b6112e6e514ea91 100644 (file)
@@ -1769,6 +1769,3 @@ class graph {
     }
 
 } // class graph
-
-
-?>
index 6738c299ac7bb2dd20d64aec37b74010d1ab5f16..3ac97fef8d4c553d03f5b174a1f6d2bb2fa9b4c1 100644 (file)
@@ -208,7 +208,7 @@ function groups_get_user_groups($courseid, $userid=0) {
 
     $result    = array();
     $allgroups = array();
-    
+
     foreach ($rs as $group) {
         $allgroups[$group->id] = $group->id;
         if (is_null($group->groupingid)) {
@@ -228,7 +228,7 @@ function groups_get_user_groups($courseid, $userid=0) {
 
 /**
  * Gets array of all groupings in a specified course.
- * 
+ *
  * @global object
  * @global object
  * @param int $courseid return only groupings in this with this courseid
@@ -364,7 +364,7 @@ function groups_get_grouping_members($groupingid, $fields='u.*', $sort='lastname
 
 /**
  * Returns effective groupmode used in course
- * 
+ *
  * @return integer group mode
  */
 function groups_get_course_groupmode($course) {
@@ -480,7 +480,7 @@ function groups_print_course_menu($course, $urlroot, $return=false) {
         $select = html_select::make_popup_form($urlroot, 'group', $groupsmenu, 'selectgroup', $activegroup);
         $select->nothinglabel = false;
         $select->set_label($grouplabel);
-        $output = $OUTPUT->select($select); 
+        $output = $OUTPUT->select($select);
     }
 
     $output = '<div class="groupselector">'.$output.'</div>';
@@ -588,7 +588,7 @@ function groups_print_activity_menu($cm, $urlroot, $return=false, $hideallpartic
         $select = html_select::make_popup_form($urlroot, 'group', $groupsmenu, 'selectgroup', $activegroup);
         $select->nothinglabel = false;
         $select->set_label($grouplabel);
-        $output = $OUTPUT->select($select); 
+        $output = $OUTPUT->select($select);
     }
 
     $output = '<div class="groupselector">'.$output.'</div>';
@@ -811,5 +811,3 @@ function groups_course_module_visible($cm, $userid=null) {
     }
     return false;
 }
-
-?>
index ca8017182218d194ae7083363951849bb0791413..56112ea86fb417ec2d628e93c4e6978e3991a488 100644 (file)
@@ -583,5 +583,3 @@ class html2text
             return strtoupper($str);
     }
 }
-
-?>
index a53179ffe63b2d5bcadb03f277c0e99817e7e0c1..4d28909eacae72d80e2df3cdbb4f9ac5a6502fbe 100644 (file)
@@ -44,8 +44,8 @@
 
     $lifetime = '86400';
 
-    @header('Content-type: text/javascript'); 
-    @header('Content-length: '.strlen($output)); 
+    @header('Content-type: text/javascript');
+    @header('Content-length: '.strlen($output));
     @header('Last-Modified: '. gmdate('D, d M Y H:i:s', time()) .' GMT');
     @header('Cache-control: max-age='.$lifetime);
     @header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .'GMT');
index 83b09676413e79e5233a065b69939df7c1237314..bf6b091ebb93fbf851d954a0badc77e316d6bb62 100644 (file)
@@ -354,7 +354,3 @@ $LANGUAGES = array (
 "zh" => "Chinese",
 
 "zu" => "Zulu");
-
-
-
-?>
\ No newline at end of file
index bf2558a6bb876fa1db34ae9fcfce0f6a81037ffe..3e2cfd84b0d414d474b21e6ca2af3f655cf1e3a5 100644 (file)
@@ -635,4 +635,3 @@ class list_item {
         $this->parentlist =& $parent;
     }
 }
-?>
index 0d377f46184d315cec58340eb6f1eff0aa95f4e6..817535b0e92e1d26856765d33bb55a45bba636c2 100644 (file)
@@ -122,7 +122,7 @@ class calc_formula {
     /**
      * Similar to unformat_float, converts floats and lists to PHP standards.
      * @param string $formula localised formula
-     * @return string 
+     * @return string
      */
     function unlocalize($formula) {
         $formula = str_replace(get_string('decsep'), '$', $formula);
@@ -131,5 +131,3 @@ class calc_formula {
         return $formula;
     }
 }
-
-?>
\ No newline at end of file
index 15197d07d2c9115d1a7e2a15d82ef16442b01ba5..ea7bc7c890955c6b0f0e9517b85a805fdbcd49b4 100644 (file)
@@ -24,7 +24,7 @@
 /**
  * This class abstracts PHP's PECL memcached
  * API to provide
- * 
+ *
  * - get()
  * - set()
  * - delete()
@@ -33,7 +33,7 @@
  *
  * Author: Martin Langhoff <martin@catalyst.net.nz>
  *
- * Note: do NOT store booleans here. With memcached, a false value 
+ * Note: do NOT store booleans here. With memcached, a false value
  * is indistinguisable from a "not found in cache" response.
  *
  * @package   moodlecore
@@ -55,7 +55,7 @@ class memcached {
         if (count($hosts) === 1 && !empty($CFG->memcachedpconn)) {
             // the faster pconnect is only available
             // for single-server setups
-            // NOTE: PHP-PECL client is buggy and pconnect() 
+            // NOTE: PHP-PECL client is buggy and pconnect()
             // will segfault if the server is unavailable
             $this->_cache->pconnect($hosts[0]);
         } else {
@@ -88,31 +88,31 @@ class memcached {
     function get($key) {
         $rec = $this->_cache->get($this->prefix . $key);
         return $rec;
-    } 
-        
+    }
+
     function delete($key) {
         return $this->_cache->delete($this->prefix . $key);
     }
 
     /**
-     * In the simple case, this function will 
+     * In the simple case, this function will
      * get the cached value if available. If the entry
      * is not cached, it will try to get an exclusive
      * lock that announces that this process will
      * populate the cache.
      *
      * If we fail to get the lock -- this means another
-     * process is doing it. 
+     * process is doing it.
      * so we wait (block) for a few microseconds while we wait for
      * the cache to be filled or the lock to timeout.
-     * 
+     *
      * If you get a false from this call, you _must_
      * populate the cache ASAP or indicate that
      * you won't by calling releaseforfill().
      *
-     * This technique forces serialisation and so helps deal 
-     * with thundering herd scenarios where a lot of clients 
-     * ask the for the same idempotent (and costly) operation. 
+     * This technique forces serialisation and so helps deal
+     * with thundering herd scenarios where a lot of clients
+     * ask the for the same idempotent (and costly) operation.
      * The implementation is based on suggestions in this message
      * http://marc.theaimsgroup.com/?l=git&m=116562052506776&w=2
      *
@@ -120,7 +120,7 @@ class memcached {
      * @return mixed on cache hit, NULL otherwise
      */
     function getforfill ($key) {
-        
+
         $rec = $this->_cache->get($this->prefix . $key);
         if ($rec) {
             return $rec;
@@ -144,7 +144,7 @@ class memcached {
     }
 
     /**
-     * Release the exclusive lock obtained by 
+     * Release the exclusive lock obtained by
      * getforfill(). See getforfill()
      * for more details.
      *
@@ -155,5 +155,3 @@ class memcached {
         return $this->_cache->delete($this->prefix . $key . '_forfill');
     }
 }
-
-?>
\ No newline at end of file
index 00838a4e5b527261c60a1d3e6d52925e89794f93..58a5d23c111c1b1d30cdcc5c8ea7956fcb9fca3f 100644 (file)
@@ -25,7 +25,7 @@
 
 /** TIMETOSHOWUSERS = 300 */
 define('TIMETOSHOWUSERS', 300);
+
 /**
  * Triggered when a message provider wants to send a message.
  * This functions checks the user's processor configuration to send the given type of message,
@@ -48,7 +48,7 @@ function message_send_handler($eventdata){
     } else {
         $userstate = 'loggedin';
     }
-    
+
 /// Create the message object
     $savemessage = new object();
     $savemessage->useridfrom        = $eventdata->userfrom->id;
@@ -61,10 +61,10 @@ function message_send_handler($eventdata){
     $savemessage->timecreated       = time();
 
 /// Find out what processors are defined currently
-/// When a user doesn't have settings none gets return, if he doesn't want contact "" gets returned    
+/// When a user doesn't have settings none gets return, if he doesn't want contact "" gets returned
     $processor = get_user_preferences('message_provider_'.$eventdata->component.'_'.$eventdata->name.'_'.$userstate, NULL, $eventdata->userto->id);
-    
-    if ($processor == NULL){ //this user never had a preference, save default        
+
+    if ($processor == NULL){ //this user never had a preference, save default
         if (!message_set_default_message_preferences( $eventdata->userto )){
             print_error('cannotsavemessageprefs', 'message');
         }
@@ -79,31 +79,31 @@ function message_send_handler($eventdata){
     //if we are suposed to do something with this message
     // No processor for this message, mark it as read
     if ($processor == "") {  //this user cleared all the preferences
-        $savemessage->timeread = time();        
+        $savemessage->timeread = time();
         $messageid = $message->id;
         unset($message->id);
         $DB->insert_record('message_read', $savemessage);
 
     } else {                        // Process the message
     /// Store unread message just in case we can not send it
-        $savemessage->id = $DB->insert_record('message', $savemessage);        
-        
+        $savemessage->id = $DB->insert_record('message', $savemessage);
+
     /// Try to deliver the message to each processor
         $processorlist = explode(',', $processor);
         foreach ($processorlist as $procname) {
             $processorfile = $CFG->dirroot. '/message/output/'.$procname.'/message_output_'.$procname.'.php';
 
-            if (is_readable($processorfile)) {        
+            if (is_readable($processorfile)) {
                 include_once( $processorfile );  // defines $module with version etc
                 $processclass = 'message_output_' . $procname;
-                
-                if (class_exists($processclass)) {                    
+
+                if (class_exists($processclass)) {
                     $pclass = new $processclass();
 
                     if (! $pclass->send_message($savemessage)) {
                         debugging('Error calling message processor '.$procname);
                         return false;
-                    }                    
+                    }
                 }
             } else {
                 debugging('Error calling message processor '.$procname);
@@ -133,7 +133,7 @@ function message_update_providers($component='moodle') {
     foreach ($fileproviders as $messagename => $fileprovider) {
 
         if (!empty($dbproviders[$messagename])) {   // Already exists in the database
-            
+
             if ($dbproviders[$messagename]->capability == $fileprovider['capability']) {  // Same, so ignore
                 // exact same message provider already present in db, ignore this entry
                 unset($dbproviders[$messagename]);
@@ -199,7 +199,7 @@ function message_get_my_providers() {
 function message_get_providers_from_db($component) {
     global $DB;
 
-    if ($dbproviders = $DB->get_records('message_providers', array('component'=>$component), '', 
+    if ($dbproviders = $DB->get_records('message_providers', array('component'=>$component), '',
                                         'name, id, component, capability')) {  // Name is unique per component
         return $dbproviders;
     }
@@ -234,7 +234,7 @@ function message_get_providers_from_file($component) {
 }
 
 /**
- * Remove all message providers 
+ * Remove all message providers
  * @param $component - examples: 'moodle', 'mod/forum', 'block/quiz_results'
  */
 function message_uninstall($component) {
@@ -247,14 +247,12 @@ function message_uninstall($component) {
  */
 function message_set_default_message_preferences( $user ) {
     global $DB;
-    
+
     $providers = $DB->get_records('message_providers');
     $preferences = array();
     foreach ( $providers as $providerid => $provider){
         $preferences[ 'message_provider_'.$provider->component.'_'.$provider->name.'_loggedin'  ] = 'popup';
         $preferences[ 'message_provider_'.$provider->component.'_'.$provider->name.'_loggedoff'  ] = 'email';
-    }    
+    }
     return set_user_preferences( $preferences, $user->id );
 }
-
-?>
index 78f70fc8f915bbda65bde365346e8a0fe0926532..17ce57b53dcfde5042863fa9b9b82326f136e33c 100644 (file)
@@ -4196,7 +4196,7 @@ function reset_course_userdata($data) {
         note_delete_all($data->courseid);
         $status[] = array('component'=>$componentstr, 'item'=>get_string('deletenotes', 'notes'), 'error'=>false);
     }
-    
+
     if (!empty($data->delete_blog_associations)) {
         require_once($CFG->dirroot.'/blog/lib.php');
         blog_remove_associations_for_course($data->courseid);
@@ -7747,7 +7747,7 @@ function shorten_text($text, $ideal=30, $exact = false, $ending='...') {
 
     // This array stores information about open and close tags and their position
     // in the truncated string. Each item in the array is an object with fields
-    // ->open (true if open), ->tag (tag name in lower case), and ->pos 
+    // ->open (true if open), ->tag (tag name in lower case), and ->pos
     // (byte position in truncated text)
     $tagdetails = array();
 
@@ -7760,12 +7760,12 @@ function shorten_text($text, $ideal=30, $exact = false, $ending='...') {
             // if tag is a closing tag (f.e. </b>)
             } else if (preg_match('/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings)) {
                 // record closing tag
-                $tagdetails[] = (object)array('open'=>false, 
+                $tagdetails[] = (object)array('open'=>false,
                     'tag'=>strtolower($tag_matchings[1]), 'pos'=>strlen($truncate));
             // if tag is an opening tag (f.e. <b>)
             } else if (preg_match('/^<\s*([^\s>!]+).*?>$/s', $line_matchings[1], $tag_matchings)) {
                 // record opening tag
-                $tagdetails[] = (object)array('open'=>true, 
+                $tagdetails[] = (object)array('open'=>true,
                     'tag'=>strtolower($tag_matchings[1]), 'pos'=>strlen($truncate));
             }
             // add html-tag to $truncate'd text
index 6d0dfa91f38b1cbc79961df5698a667499b6d964..86e07f416daa6e05944742fbb9656829d5caaef8 100644 (file)
@@ -198,7 +198,7 @@ class navigation_node {
     /**
      * This function overrides the active URL that is used to compare new nodes
      * to find out if they are active.
-     * 
+     *
      * If null is passed then $fullmeurl will be regenerated when the next node
      * is created/added
      */
@@ -318,7 +318,7 @@ class navigation_node {
 
     /**
      * Add a css class to this particular node
-     * 
+     *
      * @param string $class The css class to add
      * @return bool Returns true
      */
@@ -452,10 +452,10 @@ class navigation_node {
         }
         return $content;
     }
-    
+
     /**
      * Get the CSS type for this node
-     * 
+     *
      * @return string
      */
     public function get_css_type() {
@@ -883,7 +883,7 @@ class global_navigation extends navigation_node {
         }
         return parent::content();
     }
-    
+
     /**
      * Initialise the navigation object, calling it to auto generate
      *
@@ -913,17 +913,17 @@ class global_navigation extends navigation_node {
                 $this->cache->volatile();
                 $depth = $this->load_for_category(false);
                 break;
-            case CONTEXT_COURSECAT: 
+            case CONTEXT_COURSECAT:
                 $depth = $this->load_for_category();
                 break;
             case CONTEXT_BLOCK:
-            case CONTEXT_COURSE: 
+            case CONTEXT_COURSE:
                 $depth = $this->load_for_course();
                 break;
             case CONTEXT_MODULE:
                 $depth = $this->load_for_activity();
                 break;
-            case CONTEXT_USER: 
+            case CONTEXT_USER:
                 $depth = $this->load_for_user();
                 break;
         }
@@ -1014,8 +1014,8 @@ class global_navigation extends navigation_node {
      */
     protected function format_display_course_content($format, $default=true) {
         global $CFG;
-        // 
-        // 
+        //
+        //
         $formatlib = $CFG->dirroot.'/course/format/'.$format.'/lib.php';
         if (file_exists($formatlib)) {
             require_once($formatlib);
@@ -1050,7 +1050,7 @@ class global_navigation extends navigation_node {
             $this->cache->canviewhiddenactivities = has_capability('moodle/course:viewhiddenactivities', $this->context);
         }
         $viewhiddenactivities = $this->cache->canviewhiddenactivities;
-        
+
         foreach ($modinfo->cms as $module) {
             if ($module->sectionnum!='0' || (!$viewhiddenactivities && !$module->visible)) {
                 continue;
@@ -1087,7 +1087,7 @@ class global_navigation extends navigation_node {
     }
     /**
      * Internal function to load the activities within sections
-     * 
+     *
      * @param array $keys By reference
      */
     protected function load_section_activities(&$keys, $singlesectionid=false, $course=null) {
@@ -1224,7 +1224,7 @@ class global_navigation extends navigation_node {
         }
 
         $module = $DB->get_record('modules', array('id'=>$PAGE->cm->module));
-        
+
         if (!$module) {
             debugging('Invalid Module ID picked up while attempting to load the activity for the navigation', DEBUG_DEVELOPER);
             return;
@@ -1238,7 +1238,7 @@ class global_navigation extends navigation_node {
             $function = $module->name.'_extend_navigation';
             if (file_exists($file)) {
                 require_once($file);
-                if (function_exists($function)) {    
+                if (function_exists($function)) {
                     $function($node, $PAGE->course, $module, $PAGE->cm);
                 }
             }
@@ -1268,7 +1268,7 @@ class global_navigation extends navigation_node {
 
     /**
      * This function adds a category to the nav tree based on the categories path
-     * 
+     *
      * @param stdClass $category
      */
     protected function add_category_by_path($category) {
@@ -1381,7 +1381,7 @@ class global_navigation extends navigation_node {
                             $blogsurls = new moodle_url($CFG->wwwroot.'/blog/index.php', array('courseid' => $filterselect));
                             $participants->add(get_string('blogs','blog'), $blogsurls->out());
                         }
-                        
+
                         if (!empty($CFG->enablenotes) && (has_capability('moodle/notes:manage', $this->context) || has_capability('moodle/notes:view', $this->context))) {
                             $participants->add(get_string('notes','notes'), new moodle_url($CFG->wwwroot.'/notes/index.php', array('filtertype'=>'course', 'filterselect'=>$filterselect)));
                         }
@@ -1466,7 +1466,7 @@ class global_navigation extends navigation_node {
         } else {
             $sections = $this->cache->$coursesecstr;
         }
-        
+
         if (!$this->cache->compare('modinfo'.$course->id, $course->modinfo, false)) {
             $this->cache->{'modinfo'.$course->id} = get_fast_modinfo($course);
         }
@@ -1655,10 +1655,10 @@ class global_navigation extends navigation_node {
                         $this->add_category_by_path($category);
                     }
                 }
-            }   
+            }
             $categories = $DB->get_records('course_categories', array('parent' => $categoryid), 'sortorder ASC');
             $this->add_categories($keys, $categories);
-            #$courses = $DB->get_records('course', array('category' => $categoryid), 'sortorder ASC', 'id,fullname,shortname,visible,category'); 
+            #$courses = $DB->get_records('course', array('category' => $categoryid), 'sortorder ASC', 'id,fullname,shortname,visible,category');
             $this->add_courses($courses, $categoryid);
         }
         return 0;
@@ -1745,16 +1745,16 @@ class limited_global_navigation extends global_navigation {
         }
         $depth = 0;
         switch ($type) {
-            case self::TYPE_CATEGORY: 
+            case self::TYPE_CATEGORY:
                 $depth = $this->load_category($instanceid);
                 break;
-            case self::TYPE_COURSE: 
+            case self::TYPE_COURSE:
                 $depth = $this->load_course($instanceid);
                 break;
-            case self::TYPE_SECTION: 
+            case self::TYPE_SECTION:
                 $depth = $this->load_section($instanceid);
                 break;
-            case self::TYPE_ACTIVITY: 
+            case self::TYPE_ACTIVITY:
                 $depth = $this->load_activity($instanceid);
                 break;
         }
@@ -1782,7 +1782,7 @@ class limited_global_navigation extends global_navigation {
 
     /**
      * Use the instance id to load a course
-     * 
+     *
      * {@link global_navigation::load_course()}
      * @param int $instanceid
      */
@@ -1831,7 +1831,7 @@ class limited_global_navigation extends global_navigation {
     protected function load_section($instanceid=0) {
         global $DB, $PAGE, $CFG;
         $section = $DB->get_record('course_sections', array('id'=>$instanceid));
-        
+
         if (!$section) {
             echo "Invalid Course Section ID";
         }
@@ -1939,14 +1939,14 @@ class limited_global_navigation extends global_navigation {
         }
 
         $modinfo = get_fast_modinfo($course);
-        
+
         $resources = array('resource', 'label');
 
         if (!$this->cache->cached('canviewhiddenactivities')) {
             $this->cache->canviewhiddenactivities = has_capability('moodle/course:viewhiddenactivities', $this->context);
         }
         $viewhiddenactivities = $this->cache->canviewhiddenactivities;
-        
+
         foreach ($modinfo->cms as $module) {
             if ((!$viewhiddenactivities && !$module->visible) || $module->sectionnum != $section->section) {
                 continue;
@@ -2122,7 +2122,7 @@ class navbar extends navigation_node {
 
         // For screen readers
         $output = get_accesshide(get_string('youarehere','access'), 'h2')."<ul>\n";
-        
+
         $customchildren = (count($this->children) > 0);
         // Check if navigation contains the active node
         if (!$this->ignoreactive) {
@@ -2368,7 +2368,7 @@ class settings_navigation extends navigation_node {
      * root node class against all first level element
      *
      * It does this by first calling the parent's add method {@link navigation_node::add()}
-     * and then proceeds to use the key to set class and hr 
+     * and then proceeds to use the key to set class and hr
      *
      * @param string $text
      * @param sting|moodle_url $url
@@ -2568,10 +2568,10 @@ class settings_navigation extends navigation_node {
         }
 
         $coursenode = $this->page->navigation->find_child($course->id, global_navigation::TYPE_COURSE);
-        
+
         $coursenodekey = $this->add(get_string('courseadministration'), null, $coursenode->type, null, 'courseadmin');
         $coursenode = $this->get($coursenodekey);
-        
+
         if (has_capability('moodle/course:update', $course->context)) {
             // Add the turn on/off settings
             $url = new moodle_url($CFG->wwwroot.'/course/view.php', array('id'=>$course->id, 'sesskey'=>sesskey()));
@@ -2599,7 +2599,7 @@ class settings_navigation extends navigation_node {
                     $this->cache->{'coursesections'.$course->id} = get_all_sections($course->id);
                 }
                 $sections = $this->cache->{'coursesections'.$course->id};
-                
+
                 $addresource = $this->get($this->add(get_string('addresource')));
                 $addactivity = $this->get($this->add(get_string('addactivity')));
                 if ($formatidentifier!==0) {
@@ -2612,7 +2612,7 @@ class settings_navigation extends navigation_node {
                 }
                 $resources = $this->cache->{'course'.$course->id.'resources'};
                 $activities = $this->cache->{'course'.$course->id.'activities'};
-                
+
                 foreach ($sections as $section) {
                     if ($formatidentifier !== 0 && $section->section != $formatidentifier) {
                         continue;
@@ -2667,7 +2667,7 @@ class settings_navigation extends navigation_node {
             $url = new moodle_url($CFG->wwwroot.'/course/edit.php', array('id'=>$course->id));
             $coursenode->add(get_string('settings'), $url, self::TYPE_SETTING, null, null, $OUTPUT->old_icon_url('i/settings'));
         }
-        
+
         // Add assign or override roles if allowed
         if (has_capability('moodle/role:assign', $course->context)) {
             $url = new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php', array('contextid'=>$course->context->id));
@@ -2881,7 +2881,7 @@ class settings_navigation extends navigation_node {
 
         $file = $CFG->dirroot.'/mod/'.$module->name.'/lib.php';
         $function = $module->name.'_extend_settings_navigation';
-        
+
         if (file_exists($file)) {
             require_once($file);
         }
@@ -2893,11 +2893,11 @@ class settings_navigation extends navigation_node {
 
     /**
      * Loads the user settings block of the settings nav
-     * 
+     *
      * This function is simply works out the userid and whether we need to load
-     * just the current users profile settings, or the current user and the user the 
+     * just the current users profile settings, or the current user and the user the
      * current user is viewing.
-     * 
+     *
      * This function has some very ugly code to work out the user, if anyone has
      * any bright ideas please feel free to intervene.
      *
@@ -3334,7 +3334,7 @@ class navigation_cache {
     const CACHEVALUE = 2;
     /** @var null|array An array of navigation cache areas to expire on shutdown */
     public static $volatilecaches;
-    
+
     /**
      * Contructor for the cache. Requires two arguments
      *
@@ -3487,4 +3487,4 @@ class navigation_cache {
             }
         }
     }
-}
\ No newline at end of file
+}
index e9c5036d02163401cf8024839d45a70a92ecf214..99d33c3af50b81613802632bb94cb519d2de7318 100644 (file)
@@ -19,7 +19,7 @@
  * Major Contributors:
  *     - Eloy Lafuente (stronk7) {@link  http://contiento.com}
  *     - Petr Skoda (skodak)
- * 
+ *
  * @package   moodlecore
  * @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com}
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -311,7 +311,7 @@ class MoodleODSWorksheet {
     function hide_screen_gridlines() {
         // not implement
     }
-    
+
     /**
     * Insert a 24bit bitmap image in a worksheet.
     *
@@ -864,4 +864,3 @@ function get_ods_manifest() {
  <manifest:file-entry manifest:media-type="text/xml" manifest:full-path="meta.xml"/>
 </manifest:manifest>';
 }
-?>
index eda467c8c7b3eab5ef08d37fe6739a63047094ca..e3fc84eb9d3b13cba5d3fa94a0f4a6d95e830a41 100644 (file)
@@ -42,13 +42,13 @@ function olson_to_timezones ($filename) {
      *** To translate the combined Zone & Rule changes
      *** in the Olson files to the Moodle single ruleset
      *** format, we need to trasverse every year and see
-     *** if either the Zone or the relevant Rule has a 
+     *** if either the Zone or the relevant Rule has a
      *** change. It's yuck but it yields a rationalized
      *** set of data, which is arguably simpler.
      ***
      *** Also note that I am starting at the epoch (1970)
      *** because I don't think we'll see many events scheduled
-     *** before that, anyway. 
+     *** before that, anyway.
      ***
      **/
     $maxyear = localtime(time(), true);
@@ -59,13 +59,13 @@ function olson_to_timezones ($filename) {
          *** Loop over years, only adding a rule when zone or rule
          *** have changed. All loops preserver the last seen vars
          *** until there's an explicit decision to delete them
-         *** 
-         **/ 
+         ***
+         **/
 
         // clean the slate for a new zone
         $zone = NULL;
         $rule = NULL;
-        
+
         //
         // Find the pre 1970 zone rule entries
         //
@@ -79,16 +79,16 @@ function olson_to_timezones ($filename) {
         if (!empty($zone['rule']) && array_key_exists($zone['rule'], $rules)) {
             $rule = NULL;
             for ($y = 1970 ; $y > 0 ; $y--) {
-                if (array_key_exists((string)$y, $rules[$zone['rule']] )) { // we have a rule entry for the year                    
+                if (array_key_exists((string)$y, $rules[$zone['rule']] )) { // we have a rule entry for the year
                     $rule  =  $rules[$zone['rule']][$y];
                     //print_object("Rule $rule[name] pre1970 is $y\n");
                     break; // Perl's last -- get outta here
                 }
-                
-            }  
+
+            }
             if (empty($rule)) {
-                // Colombia and a few others refer to rules before they exist 
-                // Perhaps we should comment out this warning... 
+                // Colombia and a few others refer to rules before they exist
+                // Perhaps we should comment out this warning...
                 // trigger_error("Cannot find rule in $zone[rule] <= 1970");
                 $rule  = array();
             }
@@ -96,11 +96,11 @@ function olson_to_timezones ($filename) {
             // no DST this year!
             $rule  = array();
         }
-        
-        // Prepare to insert the base 1970 zone+rule        
+
+        // Prepare to insert the base 1970 zone+rule
         if (!empty($rule) && array_key_exists($zone['rule'], $rules)) {
             // merge the two arrays into the moodle rule
-            unset($rule['name']); // warning: $rule must NOT be a reference! 
+            unset($rule['name']); // warning: $rule must NOT be a reference!
             unset($rule['year']);
             $mdl_tz = array_merge($zone, $rule);
 
@@ -112,7 +112,7 @@ function olson_to_timezones ($filename) {
             $mdl_tz = $zone;
             // TODO: Add other default values here!
             $mdl_tz['dstoff'] = 0;
-        }        
+        }
 
         // Fix the from year to 1970
         $mdl_tz['year'] = 1970;
@@ -125,7 +125,7 @@ function olson_to_timezones ($filename) {
 
         ///
         /// 1971 onwards
-        /// 
+        ///
         for ($y = 1971; $y < $maxyear ; $y++) {
             $changed = false;
             ///
@@ -138,7 +138,7 @@ function olson_to_timezones ($filename) {
                 $changed = true;
                 $zone    = $zbyyear[(string)$y];
             }
-            if (!empty($zone['rule']) && array_key_exists($zone['rule'], $rules)) {                
+            if (!empty($zone['rule']) && array_key_exists($zone['rule'], $rules)) {
                 if (array_key_exists((string)$y, $rules[$zone['rule']])) {
                     $changed = true;
                     $rule    = $rules[$zone['rule']][(string)$y];
@@ -151,7 +151,7 @@ function olson_to_timezones ($filename) {
                 //print_object("CHANGE YEAR $y Zone $zone[name] Rule $zone[rule]\n");
                 if (!empty($rule)) {
                     // merge the two arrays into the moodle rule
-                    unset($rule['name']); 
+                    unset($rule['name']);
                     unset($rule['year']);
                     $mdl_tz = array_merge($zone, $rule);
 
@@ -164,7 +164,7 @@ function olson_to_timezones ($filename) {
                 } else {
                     // just a simple zone
                     $mdl_tz = $zone;
-                } 
+                }
 
 /*
 if(isset($mdl_tz['dst_time']) && !strpos($mdl_tz['dst_time'], ':') || isset($mdl_tz['std_time']) &&  !strpos($mdl_tz['std_time'], ':')) {
@@ -180,11 +180,11 @@ if(isset($mdl_tz['dst_time']) && !strpos($mdl_tz['dst_time'], ':') || isset($mdl
                     $mdl_zones[] = $lasttimezone = $mdl_tz;
                 }
             }
-        } 
-        
+        }
+
     }
 
-    /* 
+    /*
     if (function_exists('memory_get_usage')) {
         trigger_error("We are consuming this much memory: " . get_memory_usage());
     }
@@ -193,13 +193,13 @@ if(isset($mdl_tz['dst_time']) && !strpos($mdl_tz['dst_time'], ':') || isset($mdl
 /// Since Moodle 1.7, rule is tzrule in DB (reserved words problem), so change it here
 /// after everything is calculated to be properly loaded to the timezone table.
 /// Pre 1.7 users won't have the old rule if updating this from moodle.org but it
-/// seems that such field isn't used at all by the rest of Moodle (at least I haven't 
+/// seems that such field isn't used at all by the rest of Moodle (at least I haven't
 /// found any use when looking for it).
 
     foreach($mdl_zones as $key=>$mdl_zone) {
         $mdl_zones[$key]['tzrule'] = $mdl_zones[$key]['rule'];
     }
-    
+
     return $mdl_zones;
 }
 
@@ -215,15 +215,15 @@ if(isset($mdl_tz['dst_time']) && !strpos($mdl_tz['dst_time'], ':') || isset($mdl
  */
 function olson_simple_rule_parser ($filename) {
 
-    $file = fopen($filename, 'r', 0); 
+    $file = fopen($filename, 'r', 0);
 
     if (empty($file)) {
         return false;
     }
-    
+
     // determine the maximum year for this zone
     $maxyear = array();
-    
+
     while ($line = fgets($file)) {
         // only pay attention to rules lines
         if(!preg_match('/^Rule\s/', $line)){
@@ -248,11 +248,11 @@ function olson_simple_rule_parser ($filename) {
         } else {
             $maxyear[$name] = $from;
         }
-        
+
     }
-    
+
     fseek($file, 0);
-    
+
     $rules = array();
     while ($line = fgets($file)) {
         // only pay attention to rules lines
@@ -289,11 +289,11 @@ function olson_simple_rule_parser ($filename) {
 
     fclose($file);
 
-    $months = array('jan' =>  1, 'feb' =>  2, 
-                    'mar' =>  3, 'apr' =>  4, 
+    $months = array('jan' =>  1, 'feb' =>  2,
+                    'mar' =>  3, 'apr' =>  4,
                     'may' =>  5, 'jun' =>  6,
-                    'jul' =>  7, 'aug' =>  8, 
-                    'sep' =>  9, 'oct' => 10, 
+                    'jul' =>  7, 'aug' =>  8,
+                    'sep' =>  9, 'oct' => 10,
                     'nov' => 11, 'dec' => 12);
 
 
@@ -335,24 +335,24 @@ function olson_simple_rule_parser ($filename) {
                  $at,
                  $save,
                  $letter) = $rulesthisyear['set'];
-    
+
             $moodle_rule = array();
-    
+
             // $save is sometimes just minutes
             // and othertimes HH:MM -- only
             // parse if relevant
-            if (!preg_match('/^\d+$/', $save)) {                 
+            if (!preg_match('/^\d+$/', $save)) {
                 list($hours, $mins) = explode(':', $save);
                 $save = $hours * 60 + $mins;
             }
 
             // we'll parse $at later
-            // $at = olson_parse_at($at); 
+            // $at = olson_parse_at($at);
             $in = strtolower($in);
             if(!isset($months[$in])) {
                 trigger_error('Unknown month: '.$in);
             }
-    
+
             $moodle_rule['name']   = $name;
             $moodle_rule['year']   = $year;
             $moodle_rule['dstoff'] = $save; // time offset
@@ -365,7 +365,7 @@ function olson_simple_rule_parser ($filename) {
             $moodle_rule['dst_startday']  = $on['startday'];
             $moodle_rule['dst_weekday']   = $on['weekday'];
             $moodle_rule['dst_skipweeks'] = $on['skipweeks'];
-            
+
             // and now the "deactivate" data
             list($discard,
                  $name,
@@ -377,7 +377,7 @@ function olson_simple_rule_parser ($filename) {
                  $at,
                  $save,
                  $letter) = $rulesthisyear['reset'];
-    
+
             // we'll parse $at later
             // $at = olson_parse_at($at);
             $in = strtolower($in);
@@ -387,13 +387,13 @@ function olson_simple_rule_parser ($filename) {
 
             $moodle_rule['std_month'] = $months[$in]; // the month
             $moodle_rule['std_time']  = $at; // the time
-    
+
             // Encode index and day as per Moodle's specs
             $on = olson_parse_on($on);
             $moodle_rule['std_startday']  = $on['startday'];
             $moodle_rule['std_weekday']   = $on['weekday'];
             $moodle_rule['std_skipweeks'] = $on['skipweeks'];
-                
+
             $moodle_rules[$moodle_rule['name']][$moodle_rule['year']] = $moodle_rule;
             //print_object($moodle_rule);
 
@@ -404,7 +404,7 @@ function olson_simple_rule_parser ($filename) {
         // then we have to deal with closing the last rule
         //trigger_error("Rule $name ending to $to");
         if (!empty($to) && $to !== 'max') {
-            // We can handle two cases for TO: 
+            // We can handle two cases for TO:
             // a year, or "only"
             $reset_rule = $moodle_rule;
             $reset_rule['dstoff'] = '00';
@@ -435,12 +435,12 @@ function olson_simple_rule_parser ($filename) {
  */
 function olson_simple_zone_parser ($filename) {
 
-    $file = fopen($filename, 'r', 0); 
+    $file = fopen($filename, 'r', 0);
 
     if (empty($file)) {
         return false;
     }
-    
+
     $zones = array();
     $lastzone = NULL;
 
@@ -471,7 +471,7 @@ function olson_simple_zone_parser ($filename) {
          ***
          *** We are transforming "until" fields into "from" fields
          *** which make more sense from the Moodle perspective, so
-         *** each initial Zone entry is "from" the year 0, and for the 
+         *** each initial Zone entry is "from" the year 0, and for the
          *** continuation lines, we shift the "until" from the previous field
          *** into this line's "from".
          ***
@@ -479,7 +479,7 @@ function olson_simple_zone_parser ($filename) {
          *** I have no idea of how to create a DST rule out of that
          *** (what are the start/end times?)
          ***
-         *** We remove "until" from the data we keep, but preserve 
+         *** We remove "until" from the data we keep, but preserve
          *** it in $lastzone.
          */
         if (preg_match('/^Zone/', $line)) { // a new zone
@@ -493,15 +493,15 @@ function olson_simple_zone_parser ($filename) {
                   $discard // format
                   ) = $line;
             // the things we do to avoid warnings
-            if (!empty($line[5])) { 
+            if (!empty($line[5])) {
                 $zone['until'] = $line[5];
             }
             $zone['year'] = '0';
-            
+
             $zones[$zone['name']] = array();
 
-        } else if (!empty($lastzone) && preg_match('/^\s+/', $line)){ 
-            // looks like a credible continuation line  
+        } else if (!empty($lastzone) && preg_match('/^\s+/', $line)){
+            // looks like a credible continuation line
             $line = trim($line);
             $line = preg_split('/\s+/', $line);
             if (count($line) < 3) {
@@ -518,7 +518,7 @@ function olson_simple_zone_parser ($filename) {
                   $discard // format
                   ) = $line;
             // the things we do to avoid warnings
-            if (!empty($line[3])) { 
+            if (!empty($line[3])) {
                 $zone['until'] = $line[3];
             }
 
@@ -527,7 +527,7 @@ function olson_simple_zone_parser ($filename) {
             continue;
         }
 
-        // tidy up, we're done 
+        // tidy up, we're done
         // perhaps we should insert in the DB at this stage?
         $lastzone = $zone;
         unset($zone['until']);
@@ -535,12 +535,12 @@ function olson_simple_zone_parser ($filename) {
         if ($zone['rule'] === '-') { // cleanup empty rules
             $zone['rule'] = '';
         }
-        if (preg_match('/:/',$zone['rule'])) { 
+        if (preg_match('/:/',$zone['rule'])) {
             // we are not handling direct SAVE rules here
             // discard it
             $zone['rule'] = '';
         }
-        
+
         $zones[$zone['name']][(string)$zone['year']] = $zone;
     }
 
@@ -557,12 +557,12 @@ function olson_simple_zone_parser ($filename) {
  */
 function olson_parse_offset ($offset) {
     $offset = trim($offset);
-    
+
     // perhaps it's just minutes
     if (preg_match('/^(-?)(\d*)$/', $offset)) {
         return intval($offset);
     }
-    // (-)hours:minutes(:seconds) 
+    // (-)hours:minutes(:seconds)
     if (preg_match('/^(-?)(\d*):(\d+)/', $offset, $matches)) {
         // we are happy to discard the seconds
         $sign    = $matches[1];
@@ -570,7 +570,7 @@ function olson_parse_offset ($offset) {
         $seconds = intval($matches[3]);
         $offset  = $sign . ($hours*60 + $seconds);
         return intval($offset);
-    } 
+    }
 
     trigger_error('Strange time format in olson_parse_offset() ' .$offset);
     return 0;
@@ -581,7 +581,7 @@ function olson_parse_offset ($offset) {
 /**
  * olson_parse_on_($on)
  *
- * see `man zic`. This function translates the following formats 
+ * see `man zic`. This function translates the following formats
  * 5        the fifth of the month
  * lastSun  the last Sunday in the month
  * lastMon  the last Monday in the month
@@ -606,9 +606,9 @@ function olson_parse_offset ($offset) {
 function olson_parse_on ($on) {
 
     $rule = array();
-    $days = array('sun' => 0, 'mon' => 1, 
-                  'tue' => 2, 'wed' => 3, 
-                  'thu' => 4, 'fri' => 5, 
+    $days = array('sun' => 0, 'mon' => 1,
+                  'tue' => 2, 'wed' => 3,
+                  'thu' => 4, 'fri' => 5,
                   'sat' => 6);
 
     if(is_numeric($on)) {
@@ -654,7 +654,7 @@ function olson_parse_on ($on) {
         else {
             trigger_error('unknown on '.$on);
         }
-    }    
+    }
     return $rule;
 }
 
@@ -677,7 +677,7 @@ function olson_parse_on ($on) {
  *
  * @return string a moodle friendly $at, in GMT, which is what Moodle wants
  *
- * 
+ *
  */
 function olson_parse_at ($at, $set = 'set', $gmtoffset) {
 
@@ -698,10 +698,10 @@ function olson_parse_at ($at, $set = 'set', $gmtoffset) {
     }
 
     // Wall clock
-    if (empty($sig) || $sig === 'w') { 
+    if (empty($sig) || $sig === 'w') {
         if ($set !== 'set'){ // wall clock is on DST, assume by 1hr
             $hours = $hours-1;
-        } 
+        }
         $sig = 's';
     }
 
@@ -716,6 +716,3 @@ function olson_parse_at ($at, $set = 'set', $gmtoffset) {
 
     trigger_error('unhandled case - AT flag is ' . $matches[0]);
 }
-
-
-?>
index d4a3ad6f3ceaf9f5e9af326b0b51abb6062e1737..a6b44a91cf578e71c2103edd005e0d9673343b83 100644 (file)
@@ -174,4 +174,4 @@ class breakout_of_frame_action extends component_action {
         global $CFG;
         parent::__construct('click', 'frame_breakout', array('framename'=>$CFG->framename));
     }
-}
\ No newline at end of file
+}
index 1ccde5adcd25f57efcd58f1a66d21b940f1f8ee9..4cba5a38e1dda72aae844927acb9a14ae18337c1 100644 (file)
@@ -808,7 +808,7 @@ class moodle_page {
      * has been guessed, it will contain dangerous block-related actions.
      * Therefore, the blocks code calls this function to clean up such parameters
      * before doing any redirect.
-     * 
+     *
      * @param string $param the name of the parameter to make sure is not in the
      * page URL.
      */
@@ -1639,5 +1639,3 @@ class page_generic_activity extends page_base {
         echo $OUTPUT->header();
     }
 }
-
-?>
index 0288fb47e014b5facdd2c223a54da299bf3f880a..dcd0db2b27e106bbdfbcda349b7bb346c9414f0e 100644 (file)
@@ -997,5 +997,3 @@ function portfolio_insane_notify_admins($insane, $instances=false) {
         events_trigger('message_send', $eventdata);
     }
 }
-
-?>
index cb1e0acd90a50224fdf4c3d2c260a1c41a2ec28f..43d26e2e93fde4f14a12dbe20ea9858109378347 100755 (executable)
@@ -43,15 +43,15 @@ class Profiler
     var $c_stimes;
     var $c_utimes;
     var $mem;
-   
+
     /**
      * Concatenates all the pprof files generated by apd_set_pprof_trace()
-     * and returns the resulting string, which can then be processed by 
+     * and returns the resulting string, which can then be processed by
      * get_profiling();
      * It also deletes these files once finished, in order to limit
      * cluttering of the filesystem. This can be switched off by
      * providing "false" as the only argument to this function.
-     * 
+     *
      * WARNING: If you switch cleanup off, profiling data will
      * accumulate from one pageload to the next.
      *
@@ -64,19 +64,19 @@ class Profiler
     {
         global $CFG, $USER;
         // List all files under our temporary directory
-        $tempdir = $CFG->dataroot . '/temp/profile/' . $USER->id; 
+        $tempdir = $CFG->dataroot . '/temp/profile/' . $USER->id;
         if ($files = scandir($tempdir)) {
             // Concatenate the files
-            print_r($files); 
+            print_r($files);
         } else {
             print "Error: Profiler could not read the directory $tempdir.";
             return false;
         }
-        
+
 
         // Return a handle to the resulting file
-        
-        
+
+
         if(($DATA = fopen($dataFile, "r")) == FALSE) {
             return "Failed to open $dataFile for reading\n";
         }
@@ -87,7 +87,7 @@ class Profiler
     /**
      * Returns profiling information gathered using APD functions.
      * Accepts a numerical array of command-line arguments.
-     * 
+     *
      * Profiler::get_profiling($args)
      *  Sort options
      *  -a          Sort by alphabetic names of subroutines.
@@ -110,26 +110,26 @@ class Profiler
      *  -T          Display uncompressed call tree.
      *
      *  Example array: array('-a', '-l');
-     *   
+     *
      * @param Array $args
      * @return String Profiling info
      */
     function get_profiling($args)
-    { 
+    {
         $con = new Console_Getopt;
         array_shift($args);
-        
+
         $shortoptions = 'acg:hiIlmMrRsStTuUO:vzZ';
         $retval = $con->getopt( $args, $shortoptions);
         if(is_object($retval)) {
             usage();
         }
-        
+
         $opt['O'] = 20;
         foreach ($retval[0] as $kv_array) {
             $opt[$kv_array[0]] = $kv_array[1];
         }
-        
+
         $DATA = Profiler::_get_pprofp();
 
         $cfg = array();
@@ -270,7 +270,7 @@ class Profiler
         Total System Time  = %4.2f
         Total User Time    = %4.2f
         ", $cfg['caller'], $rtotal/1000000, $stotal/1000000, $utotal/1000000);
-        
+
         $retstring .= "\n
                  Real         User        System             secs/    cumm
         %Time (excl/cumm)  (excl/cumm)  (excl/cumm) Calls    call    s/call  Memory Usage Name
@@ -340,7 +340,7 @@ class Profiler
                     $cpercall = ($c_usecs)/$ncalls;
                         if($utotal) {
                     $pcnt = 100*$this->utimes[$j]/$utotal;
-                        } 
+                        }
                         else {
                             $pcnt = 100;
                         }
@@ -378,7 +378,7 @@ class Profiler
         //        $cpercall = ($c_usecs + $c_ssecs)/$ncalls;
                 $mem_usage = $this->mem[$j];
                 $name = $symbol_hash[$j];
-                $retstring .=  sprintf("%3.01f %2.02f %2.02f  %2.02f %2.02f  %2.02f %2.02f  %4d  %2.04f   %2.04f %12d %s\n", 
+                $retstring .=  sprintf("%3.01f %2.02f %2.02f  %2.02f %2.02f  %2.02f %2.02f  %4d  %2.04f   %2.04f %12d %s\n",
                                 $pcnt, $rsecs, $c_rsecs, $usecs, $c_usecs, $ssecs, $c_ssecs, $ncalls, $percall, $cpercall, $mem_usage, $name);
                 return $retstring;
             }
@@ -446,33 +446,32 @@ EOD;
     function by_calls($a, $b) {
         return $this->num_cmp($this->calls[$b], $this->calls[$a]);
     }
-    
-    function by_rtime($a,$b) { 
+
+    function by_rtime($a,$b) {
         return $this->num_cmp($this->rtimes[$b], $this->rtimes[$a]);
     }
-    
-    function by_c_rtime($a,$b) { 
-        return $this->num_cmp($this->c_rtimes[$b], $this->c_rtimes[$a]); 
+
+    function by_c_rtime($a,$b) {
+        return $this->num_cmp($this->c_rtimes[$b], $this->c_rtimes[$a]);
+    }
+
+    function by_stime($a,$b) {
+        return $this->num_cmp($this->stimes[$b], $this->stimes[$a]);
     }
-    
-    function by_stime($a,$b) { 
-        return $this->num_cmp($this->stimes[$b], $this->stimes[$a]); 
+
+    function by_c_stime($a,$b) {
+        return $this->num_cmp($this->c_stimes[$b], $this->c_stimes[$a]);
     }
-    
-    function by_c_stime($a,$b) { 
-        return $this->num_cmp($this->c_stimes[$b], $this->c_stimes[$a]); 
+
+    function by_utime($a,$b) {
+        return $this->num_cmp($this->utimes[$b], $this->utimes[$a]);
     }
-    
-    function by_utime($a,$b) { 
-        return $this->num_cmp($this->utimes[$b], $this->utimes[$a]); 
+
+    function by_c_utime($a,$b) {
+        return $this->num_cmp($this->c_utimes[$b], $this->c_utimes[$a]);
     }
-    
-    function by_c_utime($a,$b) { 
-        return $this->num_cmp($this->c_utimes[$b], $this->c_utimes[$a]); 
+
+    function by_mem($a, $b) {
+        return $this->num_cmp($this->mem[$b], $this->mem[$a]);
     }
-    
-    function by_mem($a, $b) { 
-        return $this->num_cmp($this->mem[$b], $this->mem[$a]); 
-    } 
 }
-?>
index b666ac71cc35e83976c9cf443dea99ab8bcaef9a..60d3734b422ccc6d7fb95e5cfe23d81192ceec4a 100644 (file)
@@ -242,7 +242,7 @@ function question_sort_qtype_array($inarray, $config = null) {
 /**
  * Move one question type in a list of question types. If you try to move one element
  * off of the end, nothing will change.
- * 
+ *
  * @param array $sortedqtypes An array $qtype => anything.
  * @param string $tomove one of the keys from $sortedqtypes
  * @param integer $direction +1 or -1
@@ -1017,13 +1017,13 @@ function get_question_options(&$questions, $loadtags = false) {
 }
 
 /**
- * Load the basic state information for 
+ * Load the basic state information for
  *
  * @global object
  * @param integer $attemptid the attempt id to load the states for.
  * @return array an array of state data from the database, you will subsequently
  *      need to call question_load_states to get fully loaded states that can be
- *      used by the question types. The states here should be sufficient for 
+ *      used by the question types. The states here should be sufficient for
  *      basic tasks like rendering navigation.
  */
 function question_preload_states($attemptid) {
@@ -1552,7 +1552,7 @@ function regrade_question_in_attempt($question, $attempt, $cmoptions, $verbose=f
                 } else if ($states[$j]->grade > $question->maxgrade) {
                     $states[$j]->grade = $question->maxgrade;
                     $changed = true;
-                    
+
                 }
                 if (!$dryrun){
                     $error = question_process_comment($question, $replaystate, $attempt,
@@ -1876,7 +1876,7 @@ function get_question_image($question) {
         } else {
             require_once($CFG->libdir .'/filelib.php');
             $img = get_file_url("$coursefilesdir/{$question->image}");
-        }      
+        }
     }
     return $img;
 }
@@ -2227,7 +2227,7 @@ function get_question_fraction_grade($question, $state) {
 // ULPGc ecastro
 function question_get_random_guess_score($question) {
     global $QTYPES;
-    
+
     $r = $QTYPES[$question->qtype]->get_random_guess_score($question);
     return $r;
 }
@@ -2404,7 +2404,7 @@ function question_edit_url($context) {
         case CONTEXT_MODULE:
             return $baseurl . 'cmid=' . $context->instanceid;
     }
-    
+
 }
 
 /**
index e3f57e6064f5abdcbbc6c557d42dd24310a0e846..ea9e6ab0a9fcc3778278f4fa9374d87116fc8b08 100644 (file)
@@ -443,4 +443,3 @@ function rss_add_enclosures($item){
 
     return $returnstring;
 }
-?>
index de0cf18b7d9263e7e62a0fc5ae8196bf54d5d1f4..c7fc78aa35981719a43cd2abe41d8fc6bd82d9a3 100644 (file)
@@ -50,16 +50,16 @@ class search_token {
   function search_token($type,$value){
     $this->type = $type;
     $this->value = $this->sanitize($value);
-  
+
   }
 
   // Try to clean up user input to avoid potential security issues.
-  // Need to think about this some more. 
+  // Need to think about this some more.
 
   function sanitize($userstring){
     return htmlspecialchars($userstring);
   }
-  function getValue(){  
+  function getValue(){
     return $this->value;
   }
   function getType(){
@@ -70,7 +70,7 @@ class search_token {
 
 /**
  * This class does the heavy lifting of lexing the search string into tokens.
- * Using a full-blown lexer is probably overkill for this application, but 
+ * Using a full-blown lexer is probably overkill for this application, but
  * might be useful for other tasks.
  *
  * @package   moodlecore
@@ -142,7 +142,7 @@ class search_lexer extends Lexer{
 
 
     // Patterns to handle strings  of the form meta:foo
+
    // If we see the string meta: while in the base accept state, start
     // parsing a username and go to the inmeta state.
     $this->addEntryPattern("subject:\S+","accept","inmeta");
@@ -151,7 +151,7 @@ class search_lexer extends Lexer{
     // back to the base accept state.
     $this->addExitPattern("\s","inmeta");
 
-   
+
     // Patterns to handle required exact match strings (+foo) .
 
     // If we see a + sign  while in the base accept state, start
@@ -174,23 +174,23 @@ class search_lexer extends Lexer{
     // If we see a quote  while in the base accept state, start
     // parsing a quoted string and enter the inquotedstring state.
     // Grab everything until we see the closing quote.
-  
+
     $this->addEntryPattern("\"[^\"]+","accept","inquotedstring");
 
     // When we see a closing quote, reenter the base accept state.
     $this->addExitPattern("\"","inquotedstring");
+
     // Patterns to handle ordinary, nonquoted words.
-  
+
     // When we see non-whitespace, snarf everything into the nonquoted word
     // until we see whitespace again.
     $this->addEntryPattern("\S+","accept","plainstring");
 
     // Once we see whitespace, reenter the base accept state.
     $this->addExitPattern("\s","plainstring");
-  
+
   }
-} 
+}
 
 
 
@@ -281,7 +281,7 @@ class search_parser {
 
 
     // State for handling meta:foo constructs. Potentially emits a token.
-    function inmeta($content){   
+    function inmeta($content){
         if (strlen($content) < 9) { // Missing parameter.
             return true;
         }
@@ -301,9 +301,9 @@ class search_parser {
         // Strip off the + sign and add the reminder to the parsed token array.
         $this->tokens[] = new search_token(TOKEN_EXACT,substr($content,1));
         return true;
-    } 
+    }
 
-    // State entered when we've seen an excluded string (-foo). Potentially 
+    // State entered when we've seen an excluded string (-foo). Potentially
     // emits a token.
     function inexcluded($content){
         if (strlen($content) < 2) { // State exit or missing parameter.
@@ -312,7 +312,7 @@ class search_parser {
         // Strip off the -sign and add the reminder to the parsed token array.
         $this->tokens[] = new search_token(TOKEN_NEGATE,substr($content,1));
         return true;
-    } 
+    }
 
 
     // State entered when we've seen a quoted string. Potentially emits a token.
@@ -323,7 +323,7 @@ class search_parser {
         // Strip off the opening quote and add the reminder to the parsed token array.
         $this->tokens[] = new search_token(TOKEN_STRING,substr($content,1));
         return true;
-    } 
+    }
 
     // State entered when we've seen an ordinary, non-quoted word. Potentially
     // emits a token.
@@ -334,16 +334,16 @@ class search_parser {
         // Add the string to the parsed token array.
         $this->tokens[] = new search_token(TOKEN_STRING,$content);
         return true;
-    } 
+    }
 }
 
 /**
  * Primitive function to generate a SQL string from a parse tree
  * using TEXT indexes. If searches aren't suitable to use TEXT
  * this function calls the default search_generate_SQL() one.
- *      
- * $parsetree should be a parse tree generated by a 
- * search_lexer/search_parser combination. 
+ *
+ * $parsetree should be a parse tree generated by a
+ * search_lexer/search_parser combination.
  * Other fields are database table names to search.
  *
  * @global object
@@ -481,11 +481,11 @@ function search_generate_text_SQL($parsetree, $datafield, $metafield, $mainidfie
 }
 
 /**
- * Primitive function to generate a SQL string from a parse tree. 
- * Parameters: 
+ * Primitive function to generate a SQL string from a parse tree.
+ * Parameters:
  *
- * $parsetree should be a parse tree generated by a 
- * search_lexer/search_parser combination. 
+ * $parsetree should be a parse tree generated by a
+ * search_lexer/search_parser combination.
  * Other fields are database table names to search.
  *
  * @global object
@@ -532,55 +532,52 @@ function search_generate_SQL($parsetree, $datafield, $metafield, $mainidfield, $
         $name2 = 'sq'.$p++;
 
         switch($type){
-            case TOKEN_STRING: 
+            case TOKEN_STRING:
                 $SQLString .= "(($datafield $LIKE :$name1) OR ($metafield $LIKE :$name2))";
                 $params[$name1] =  "%$value%";
                 $params[$name2] =  "%$value%";
                 break;
-            case TOKEN_EXACT: 
+            case TOKEN_EXACT:
                 $SQLString .= "(($datafield $REGEXP :$name1) OR ($metafield $REGEXP :$name2))";
                 $params[$name1] =  "[[:<:]]".$value."[[:>:]]";
                 $params[$name2] =  "[[:<:]]".$value."[[:>:]]";
-                break; 
-            case TOKEN_META: 
+                break;
+            case TOKEN_META:
                 if ($metafield != '') {
                     $SQLString .= "($metafield $LIKE :$name1)";
                     $params[$name1] =  "%$value%";
                 }
                 break;
-            case TOKEN_USER: 
+            case TOKEN_USER:
                 $SQLString .= "(($mainidfield = $useridfield) AND (($userfirstnamefield $LIKE :$name1) OR ($userlastnamefield $LIKE :$name2)))";
                 $params[$name1] =  "%$value%";
                 $params[$name2] =  "%$value%";
-                break; 
-            case TOKEN_USERID: 
+                break;
+            case TOKEN_USERID:
                 $SQLString .= "($useridfield = :$name1)";
                 $params[$name1] =  $value;
-                break; 
-            case TOKEN_INSTANCE: 
+                break;
+            case TOKEN_INSTANCE:
                 $SQLString .= "($instancefield = :$name1)";
                 $params[$name1] =  $value;
-                break; 
-            case TOKEN_DATETO: 
+                break;
+            case TOKEN_DATETO:
                 $SQLString .= "($timefield <= :$name1)";
                 $params[$name1] =  $value;
-                break; 
-            case TOKEN_DATEFROM: 
+                break;
+            case TOKEN_DATEFROM:
                 $SQLString .= "($timefield >= :$name1)";
                 $params[$name1] =  $value;
-                break; 
-            case TOKEN_NEGATE: 
+                break;
+            case TOKEN_NEGATE:
                 $SQLString .= "(NOT (($datafield  $LIKE :$name1) OR ($metafield  $LIKE :$name2)))";
                 $params[$name1] =  "%$value%";
                 $params[$name2] =  "%$value%";
-                break; 
+                break;
             default:
                 return '';
 
-        } 
-    } 
+        }
+    }
     return array($SQLString, $params);
 }
-
-
-?>
index b7dbe0ee87fc904699387efe59f0d80a6d348343..3b6a008be7572905f7253bc3112e13bfa1aee5e7 100644 (file)
@@ -37,4 +37,4 @@ $PAGE->set_generaltype('form');
 
 error('session test not reimplemented yet'); //DO NOT localize or use print_error()!
 //
-//TODO: add code that actually tests moodle sessions, the old one only tested PHP sessions used from installer, not the real moodle sessions 
+//TODO: add code that actually tests moodle sessions, the old one only tested PHP sessions used from installer, not the real moodle sessions
index 80af5da4c7ba99bdcbd2989568a86cd48e8734fb..db9e9b589b48d96ca8c434b2e5acba53b38c5c8d 100644 (file)
@@ -603,5 +603,3 @@ function moodle_reflect_file($file) {
 
     return (object)array('classes' => $classes, 'functions' => $functions);
 }
-
-?>
index 72d75f35559fbb6e6483eb8b96c78c3cf01cc014..b14513e9d1a518cc8a426b48e4ac9970e499aa75 100644 (file)
@@ -225,7 +225,7 @@ class ContainsTagWithAttribute extends XMLStructureExpectation {
     function test($html) {
         $parser = $this->load_xml($html);
         $list = $parser->getElementsByTagName($this->tag);
-        
+
         foreach ($list as $node) {
             if ($node->attributes->getNamedItem($this->attribute)->nodeValue == $this->value) {
                 return true;
@@ -360,7 +360,7 @@ class ContainsTagWithContents extends XMLStructureExpectation {
                 return true;
             }
         }
-        
+
         return false;
     }
 
@@ -393,7 +393,7 @@ class ContainsEmptyTag extends XMLStructureExpectation {
                 return true;
             }
         }
-        
+
         return false;
     }
 
@@ -944,7 +944,7 @@ class UnitTestDB {
     /**
      * Overriding update_record: If we are updating a record that was NOT inserted by unit tests,
      * throw an exception and cancel update.
-     * 
+     *
      * throws moodle_exception If trying to update a record not inserted by unit tests.
      */
     public function update_record($table, $dataobject, $bulk=false) {
@@ -1059,4 +1059,3 @@ class UnitTestDB {
         return UnitTestDB::$DB->get_field($table, $return, $conditions);
     }
 }
-?>
index 7ddfd2273cef52b68a7001744eb4dd3158cc0a15..79f20741363151764844ef22e5219491a61684ca 100644 (file)
@@ -131,5 +131,3 @@ function handle_soap_wsdl_request($wsdlfile, $address=false) {
     echo $wsdl;
     exit;
 }
-
-?>
index 4b16a314843dabe69603325c4c033c8ea96f7c68..e175e7087b4515606483da1f19e38f7a70e39239 100644 (file)
@@ -70,7 +70,7 @@
 
 /**
  * Print daily cron progress
- * @param string $ident 
+ * @param string $ident
  */
 function stats_daily_progress($ident) {
     static $start = 0;
@@ -1198,9 +1198,9 @@ function stats_get_parameters($time,$report,$courseid,$mode,$roleid=0) {
                        ) activity
                        INNER JOIN
                             (
-                            SELECT courseid, max(stat1) AS highest_enrolments 
+                            SELECT courseid, max(stat1) AS highest_enrolments
                               FROM {stats_'.$param->table.'}
-                             WHERE stattype=\'enrolments\' AND timeend >= '.$param->timeafter.' AND stat1 > '.$threshold.' 
+                             WHERE stattype=\'enrolments\' AND timeend >= '.$param->timeafter.' AND stat1 > '.$threshold.'
                           GROUP BY courseid
                       ) enrolments
                       ON (activity.courseid = enrolments.courseid)
@@ -1504,5 +1504,3 @@ function stats_check_uptodate($courseid=0) {
     //return error as string
     return get_string('statscatchupmode','error',$a);
 }
-
-?>
index ef916e89f9eb18b347d190d0657240f3cc2cd678..3956e6eeadc826e20796922cd2cef4fbe82862a2 100644 (file)
@@ -149,7 +149,7 @@ class flexible_table {
         }
         return $this->download;
     }
-    
+
     function export_class_instance(&$exportclass=null){
         if (!is_null($exportclass)){
             $this->started_output = true;
@@ -164,8 +164,8 @@ class flexible_table {
         }
         return $this->exportclass;
     }
-    
-    
+
+
     /**
      * Probably don't need to call this directly. Calling is_downloading with a
      * param automatically sets table as downloadable.
@@ -821,7 +821,7 @@ class flexible_table {
      * This function is not part of the public api.
      */
     function print_initials_bar(){
-        if ((!empty($this->sess->i_last) || !empty($this->sess->i_first) || $this->use_initials) 
+        if ((!empty($this->sess->i_last) || !empty($this->sess->i_first) || $this->use_initials)
                     && isset($this->columns['fullname'])) {
 
             $strall = get_string('all');
@@ -1338,7 +1338,7 @@ class table_default_export_format_parent{
      * object from which to export data.
      */
     var $table;
-    
+
     /**
      * @var boolean output started. Keeps track of whether any output has been
      * started yet.
@@ -1347,7 +1347,7 @@ class table_default_export_format_parent{
     function table_default_export_format_parent(&$table){
         $this->table =& $table;
     }
-    
+
     function set_table(&$table){
         $this->table =& $table;
     }
@@ -1618,7 +1618,7 @@ EOF;
         $this->table->start_html();
     }
 
-    
+
     function output_headers($headers){
         $this->table->print_headers();
     }
@@ -1657,4 +1657,3 @@ EOF;
         return format_text($text, $format, $options);
     }
 }
-?>
index c6a2326a5a77d2c0900f8d7d9832013e0d74acae..efa066aea3aafb560388bec7eb33e2f91a4c185a 100644 (file)
@@ -457,4 +457,3 @@ class textlib {
         return implode(' ', $words);
     }
 }
-?>
index 32c5a6aa4be897a905927187181dfcdbd9003b08..a903cfe5179a4d26b10efe232ad56578bae3d507 100644 (file)
@@ -1,20 +1,20 @@
 <?php
 
-//                                                                       
-// NOTICE OF COPYRIGHT                                                   
-//                                                                       
-// Original code:                                                        
-//                                                                       
-// Drupal - The copyright of both the Drupal software and the            
-//          "Druplicon" logo belongs to all the original authors,        
-//          though both are licensed under the GPL.                      
-//          http://drupal.org                                            
-//                                                                       
-// Modifications:                                                        
-//                                                                       
-// Moodle - Modular Object-Oriented Dynamic Learning Environment         
-//          http://moodle.com                                                
-//                                                                       
+//
+// NOTICE OF COPYRIGHT
+//
+// Original code:
+//
+// Drupal - The copyright of both the Drupal software and the
+//          "Druplicon" logo belongs to all the original authors,
+//          though both are licensed under the GPL.
+//          http://drupal.org
+//
+// Modifications:
+//
+// Moodle - Modular Object-Oriented Dynamic Learning Environment
+//          http://moodle.com
+//
 // This file is part of Moodle - http://moodle.org/
 //
 // Moodle is free software: you can redistribute it and/or modify
@@ -29,7 +29,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-//                                                                       
+//
 
 /**
  * Based on Drupal's search.module version 1.224
@@ -149,9 +149,9 @@ define('PREG_CLASS_CJK', '\x{3041}-\x{30ff}\x{31f0}-\x{31ff}\x{3400}-\x{4db5}'.
  * This function process the text passed at input, extracting all the tokens
  * and scoring each one based in their number of ocurrences and relation with
  * some well-known html tags
- * 
+ *
  * @param string  $text the text to be tokenised.
- * @param array   $stop_words array of utf-8 words than can be ignored in 
+ * @param array   $stop_words array of utf-8 words than can be ignored in
  *                the text being processed. There are some cool lists of
  *                stop words at http://snowball.tartarus.org/
  * @param boolean $overlap_cjk option to split CJK text into some overlapping
@@ -411,5 +411,3 @@ function tokenise_truncate_word(&$text) {
     $textlib = textlib_get_instance();
     $text = $textlib->substr($text, 0, MAXIMUM_WORD_SIZE);
 }
-
-?>
index 644b7dc7862bd188a9a7a311a2699165b5db35df..91f36ca8547c4c15b78c1986a1865d3c38060761 100644 (file)
@@ -38,12 +38,12 @@ class upload_manager {
 
    /**
     * Array to hold local copies of stuff in $_FILES
-    * @var array $files 
+    * @var array $files
     */
     var $files;
    /**
     * Holds all configuration stuff
-    * @var array $config 
+    * @var array $config
     */
     var $config;
    /**
@@ -55,19 +55,19 @@ class upload_manager {
    /**
     * The course this file has been uploaded for. {@link $COURSE}
     * (for logging and virus notifications)
-    * @var course $course 
+    * @var course $course
     */
     var $course;
    /**
     * If we're only getting one file.
     * (for logging and virus notifications)
-    * @var string $inputname 
+    * @var string $inputname
     */
     var $inputname;
    /**
-    * If we're given silent=true in the constructor, this gets built 
+    * If we're given silent=true in the constructor, this gets built
     * up to hold info about the process.
-    * @var string $notify 
+    * @var string $notify
     */
     var $notify;
 
@@ -88,13 +88,13 @@ class upload_manager {
      * @param boolean $allownullmultiple Whether we care if there's no files AT ALL  when we've got multiples. This won't complain if we have file 1 and file 3 but not file 2, only for NO FILES AT ALL.
      */
     function upload_manager($inputname='', $deleteothers=false, $handlecollisions=false, $course=null, $recoverifmultiple=false, $modbytes=0, $silent=false, $allownull=false, $allownullmultiple=true) {
-        
+
         global $CFG, $SITE;
 
         if (empty($course->id)) {
             $course = $SITE;
         }
-        
+
         $this->config->deleteothers = $deleteothers;
         $this->config->handlecollisions = $handlecollisions;
         $this->config->recoverifmultiple = $recoverifmultiple;
@@ -102,17 +102,17 @@ class upload_manager {
         $this->config->silent = $silent;
         $this->config->allownull = $allownull;
         $this->files = array();
-        $this->status = false; 
+        $this->status = false;
         $this->course = $course;
         $this->inputname = $inputname;
         if (empty($this->inputname)) {
             $this->config->allownull = $allownullmultiple;
         }
     }
-    
-    /** 
+
+    /**
      * Gets all entries out of $_FILES and stores them locally in $files and then
-     * checks each one against {@link get_max_upload_file_size()} and calls {@link cleanfilename()} 
+     * checks each one against {@link get_max_upload_file_size()} and calls {@link cleanfilename()}
      * and scans them for viruses etc.
      * @uses $CFG
      * @uses $_FILES
@@ -130,7 +130,7 @@ class upload_manager {
                 $this->status = $this->validate_file($this->files[$name]); // default to only allowing empty on multiple uploads.
                 if (!$this->status && ($this->files[$name]['error'] == 0 || $this->files[$name]['error'] == 4) && ($this->config->allownull || empty($this->inputname))) {
                     // this shouldn't cause everything to stop.. modules should be responsible for knowing which if any are compulsory.
-                    continue; 
+                    continue;
                 }
                 if ($this->status && !empty($CFG->runclamonupload)) {
                     $this->status = clam_scan_moodle_file($this->files[$name],$this->course);
@@ -202,7 +202,7 @@ class upload_manager {
         return true;
     }
 
-    /** 
+    /**
      * Moves all the files to the destination directory.
      *
      * @uses $CFG
@@ -212,7 +212,7 @@ class upload_manager {
      */
     function save_files($destination) {
         global $CFG, $USER, $OUTPUT;
-        
+
         if (!$this->status) { // preprocess_files hasn't been run
             $this->preprocess_files();
         }
@@ -238,7 +238,7 @@ class upload_manager {
                 $this->status = false;
                 return false;
             }
-            
+
             $destination = $CFG->dataroot .'/'. $destination; // now add it back in so we have a full path
 
             $exceptions = array(); //need this later if we're deleting other files.
@@ -277,13 +277,13 @@ class upload_manager {
         }
         return $this->status;
     }
-    
+
     /**
      * Wrapper function that calls {@link preprocess_files()} and {@link viruscheck_files()} and then {@link save_files()}
      * Modules that require the insert id in the filepath should not use this and call these functions seperately in the required order.
      * @parameter string $destination Where to save the uploaded files to.
      * @return boolean
-     */ 
+     */
     function process_file_uploads($destination) {
         if ($this->preprocess_files()) {
             return $this->save_files($destination);
@@ -291,7 +291,7 @@ class upload_manager {
         return false;
     }
 
-    /** 
+    /**
      * Deletes all the files in a given directory except for the files in $exceptions (full paths)
      *
      * @param string $destination The directory to clean up.
@@ -317,7 +317,7 @@ class upload_manager {
             }
         }
     }
-    
+
     /**
      * Handles filename collisions - if the desired filename exists it will rename it according to the pattern in $format
      * @param string $destination Destination directory (to check existing files against)
@@ -354,7 +354,7 @@ class upload_manager {
         $a->newname = $file['name'];
         $file['uploadlog'] .= "\n". get_string('uploadrenamedcollision','moodle', $a);
     }
-    
+
     /**
      * This function checks a potential filename against what's on the filesystem already and what's been saved already.
      * @param string $destination Destination directory (to check existing files against)
@@ -388,7 +388,7 @@ class upload_manager {
      * @todo Finish documenting this function
      */
     function get_file_upload_error(&$file) {
-        
+
         switch ($file['error']) {
         case 0: // UPLOAD_ERR_OK
             if ($file['size'] > 0) {
@@ -397,23 +397,23 @@ class upload_manager {
                 $errmessage = get_string('uploadnofilefound'); /// probably a dud file name
             }
             break;
-            
+
         case 1: // UPLOAD_ERR_INI_SIZE
             $errmessage = get_string('uploadserverlimit');
             break;
-            
+
         case 2: // UPLOAD_ERR_FORM_SIZE
             $errmessage = get_string('uploadformlimit');
             break;
-            
+
         case 3: // UPLOAD_ERR_PARTIAL
             $errmessage = get_string('uploadpartialfile');
             break;
-            
+
         case 4: // UPLOAD_ERR_NO_FILE
             $errmessage = get_string('uploadnofilefound');
             break;
-            
+
         // Note: there is no error with a value of 5
 
         case 6: // UPLOAD_ERR_NO_TMP_DIR
@@ -433,7 +433,7 @@ class upload_manager {
         }
         return $errmessage;
     }
-    
+
     /**
      * prints a log of everything that happened (of interest) to each file in _FILES
      * @param $return - optional, defaults to false (log is echoed)
@@ -465,7 +465,7 @@ class upload_manager {
         return false;
     }
 
-    /** 
+    /**
      * If we're only handling one file (if input name was given in the constructor) this will return the full path to the saved file.
      * @return boolean
      */
@@ -476,7 +476,7 @@ class upload_manager {
         return false;
     }
 
-    /** 
+    /**
      * If we're only handling one file (if inputname was given in the constructor) this will return the ORIGINAL filename of the file.
      * @return boolean
      */
@@ -487,7 +487,7 @@ class upload_manager {
         return false;
     }
 
-    /** 
+    /**
      * This function returns any errors wrapped up in red.
      * @return string
      */
@@ -520,7 +520,7 @@ UPLOAD_PRINT_FORM_FRAGMENT DOESN'T REALLY BELONG IN THE CLASS BUT CERTAINLY IN T
  * @param int $modbytes $coursebytes and $maxbytes are used to calculate upload max size ( using {@link get_max_upload_file_size})
  * @param boolean $return -Whether to return the string (defaults to false - string is echoed)
  * @return string Form returned as string if $return is true
- */ 
+ */
 function upload_print_form_fragment($numfiles=1, $names=null, $descriptions=null, $uselabels=false, $labelnames=null, $coursebytes=0, $modbytes=0, $return=false) {
     global $CFG;
     $maxbytes = get_max_upload_file_size($CFG->maxbytes, $coursebytes, $modbytes);
@@ -547,7 +547,7 @@ function upload_print_form_fragment($numfiles=1, $names=null, $descriptions=null
 
 
 /**
- * Deals with an infected file - either moves it to a quarantinedir 
+ * Deals with an infected file - either moves it to a quarantinedir
  * (specified in CFG->quarantinedir) or deletes it.
  *
  * If moving it fails, it deletes it.
@@ -560,7 +560,7 @@ function upload_print_form_fragment($numfiles=1, $names=null, $descriptions=null
  * @return string Details of what the function did.
  */
 function clam_handle_infected_file($file, $userid=0, $basiconly=false) {
-    
+
     global $CFG, $USER;
     if ($USER && !$userid) {
         $userid = $USER->id;
@@ -568,7 +568,7 @@ function clam_handle_infected_file($file, $userid=0, $basiconly=false) {
     $delete = true;
     if (file_exists($CFG->quarantinedir) && is_dir($CFG->quarantinedir) && is_writable($CFG->quarantinedir)) {
         $now = date('YmdHis');
-        if (rename($file, $CFG->quarantinedir .'/'. $now .'-user-'. $userid .'-infected')) { 
+        if (rename($file, $CFG->quarantinedir .'/'. $now .'-user-'. $userid .'-infected')) {
             $delete = false;
             clam_log_infected($file, $CFG->quarantinedir.'/'. $now .'-user-'. $userid .'-infected', $userid);
             if ($basiconly) {
@@ -618,7 +618,7 @@ function clam_handle_infected_file($file, $userid=0, $basiconly=false) {
  *
  * The replacement string is used to notify that the original file had a virus
  * This is to avoid missing files but could result in the wrong content-type.
- * 
+ *
  * @param string $file Full path to the file.
  * @return boolean
  */
@@ -644,12 +644,12 @@ function clam_replace_infected_file($file) {
  * @param mixed $file The file to scan from $files. or an absolute path to a file.
  * @param course $course {@link $COURSE}
  * @return int 1 if good, 0 if something goes wrong (opposite from actual error code from clam)
- */ 
+ */
 function clam_scan_moodle_file(&$file, $course) {
     global $CFG, $USER;
 
     if (is_array($file) && is_uploaded_file($file['tmp_name'])) { // it's from $_FILES
-        $appendlog = true; 
+        $appendlog = true;
         $fullpath = $file['tmp_name'];
     }
     else if (file_exists($file)) { // it's a path to somewhere on the filesystem!
@@ -667,7 +667,7 @@ function clam_scan_moodle_file(&$file, $course) {
         if ($CFG->clamfailureonupload == 'actlikevirus') {
             $notice .= "\n". get_string('clamlostandactinglikevirus');
             $notice .= "\n". clam_handle_infected_file($fullpath);
-            $newreturn = false; 
+            $newreturn = false;
         }
         clam_message_admins($notice);
         if ($appendlog) {
@@ -676,15 +676,15 @@ function clam_scan_moodle_file(&$file, $course) {
         }
         return $newreturn; // return 1 if we're allowing clam failures
     }
-    
+
     $cmd = $CFG->pathtoclam .' '. $fullpath ." 2>&1";
-    
+
     // before we do anything we need to change perms so that clamscan can read the file (clamdscan won't work otherwise)
     chmod($fullpath,0644);
-    
+
     exec($cmd, $output, $return);
-    
-    
+
+
     switch ($return) {
     case 0: // glee! we're ok.
         return 1; // translate clam return code into reasonable return code consistent with everything else.
@@ -699,7 +699,7 @@ function clam_scan_moodle_file(&$file, $course) {
         $info->user = fullname($USER);
         $notice = get_string('virusfound', 'moodle', $info);
         $notice .= "\n\n". implode("\n", $output);
-        $notice .= "\n\n". clam_handle_infected_file($fullpath); 
+        $notice .= "\n\n". clam_handle_infected_file($fullpath);
         clam_message_admins($notice);
         if ($appendlog) {
             $info->filename = $file['originalname'];
@@ -707,7 +707,7 @@ function clam_scan_moodle_file(&$file, $course) {
             $file['virus'] = 1;
         }
         return false; // in this case, 0 means bad.
-    default: 
+    default:
         // error - clam failed to run or something went wrong
         $notice .= get_string('clamfailed', 'moodle', get_clam_error_code($return));
         $notice .= "\n\n". implode("\n", $output);
@@ -731,9 +731,9 @@ function clam_scan_moodle_file(&$file, $course) {
  * @param string $notice The body of the email to be sent.
  */
 function clam_message_admins($notice) {
-    
+
     $site = get_site();
-        
+
     $subject = get_string('clamemailsubject', 'moodle', format_string($site->fullname));
     $admins = get_admins();
     foreach ($admins as $admin) {
@@ -774,7 +774,7 @@ function get_clam_error_code($returncode) {
     $returncodes[58] = 'I/O error, please check your filesystem.';
     $returncodes[59] = 'Can\'t get information about current user from /etc/passwd.';
     $returncodes[60] = 'Can\'t get information about user \'clamav\' (default name) from /etc/passwd.';
-    $returncodes[61] = 'Can\'t fork.'; 
+    $returncodes[61] = 'Can\'t fork.';
     $returncodes[63] = 'Can\'t create temporary files/directories (check permissions).';
     $returncodes[64] = 'Can\'t write to temporary directory (please specify another one).';
     $returncodes[70] = 'Can\'t allocate and clear memory (calloc).';
@@ -821,12 +821,12 @@ function clam_log_infected($oldfilepath='', $newfilepath='', $userid=0) {
     global $DB;
 
     add_to_log(0, 'upload', 'infected', $_SERVER['HTTP_REFERER'], $oldfilepath, 0, $userid);
-    
+
     $user = $DB->get_record('user', array('id'=>$userid));
-    
+
     $errorstr = 'Clam AV has found a file that is infected with a virus. It was uploaded by '
         . ((empty($user)) ? ' an unknown user ' : fullname($user))
-        . ((empty($oldfilepath)) ? '. The infected file was caught on upload ('.$oldfilepath.')' 
+        . ((empty($oldfilepath)) ? '. The infected file was caught on upload ('.$oldfilepath.')'
            : '. The original file path of the infected file was '. $oldfilepath)
         . ((empty($newfilepath)) ? '. The file has been deleted ' : '. The file has been moved to a quarantine directory and the new path is '. $newfilepath);
 
@@ -839,12 +839,12 @@ function clam_log_infected($oldfilepath='', $newfilepath='', $userid=0) {
  *
  * @global object
  * @param string $oldpath The old path to the file (should be in the log)
- * @param string $newpath The new path to the file 
+ * @param string $newpath The new path to the file
  * @param boolean $update If true this function will overwrite old record (used for forum moving etc).
  */
 function clam_change_log($oldpath, $newpath, $update=true) {
     global $DB;
-    
+
     if (!$record = $DB->get_record('log', array('info'=>$oldpath, 'module'=>'upload'))) {
         return false;
     }
@@ -856,4 +856,3 @@ function clam_change_log($oldpath, $newpath, $update=true) {
         $DB->insert_record('log', $record);
     }
 }
-?>
index da201d4f0930014cd1e91288255c2ec508e047ec..5c48e6ff4151009f22b9b9a506145259d80dda00 100755 (executable)
  *
  * I used rfc #2396 URI: Generic Syntax as my guide when creating the
  * regular expression. For all the details see the comments below.
- * 
+ *
  * Usage:
  *     validateUrlSyntax( url_to_check[, options])
- * 
+ *
  *     url_to_check - string - The url to check
  *
  *     options - string - A optional string of options to set which parts of
@@ -233,7 +233,7 @@ function validateUrlSyntax( $urladdr, $options="" ){
             $aOptions[$key] = '';
         }
     }
-    
+
     // DEBUGGING - Unescape following line to display to screen current option values
     // echo '<pre>'; print_r($aOptions); echo '</pre>';
 
@@ -243,7 +243,7 @@ function validateUrlSyntax( $urladdr, $options="" ){
     $unreserved  = '[a-zA-Z0-9_.!~*' . '\'' . '()-]';
     $escaped     = '(%[0-9a-fA-F]{2})'; // Escape sequence - In Hex - %6d would be a 'm'
     $reserved    = '[;/?:@&=+$,]'; // Special characters in the URI
-    
+
     // Beginning Regular Expression
                        // Scheme - Allows for 'http://', 'https://', 'mailto:', or 'ftp://'
     $scheme            = '(';
@@ -261,14 +261,14 @@ function validateUrlSyntax( $urladdr, $options="" ){
     }
     $scheme            .= ')' . $aOptions['s'];
     // End setting scheme
-    
+
                        // User Info - Allows for 'username@' or 'username:password@'. Note: contrary to rfc, I removed ':' from username section, allowing it only in password.
                        //   /---------------- Username -----------------------\  /-------------------------------- Password ------------------------------\
     $userinfo          = '((' . $unreserved . '|' . $escaped . '|[;&=+$,]' . ')+(:(' . $unreserved . '|' . $escaped . '|[;:&=+$,]' . ')+)' . $aOptions['P'] . '@)' . $aOptions['u'];
-    
+
                        // IP ADDRESS - Allows 0.0.0.0 to 255.255.255.255
     $ipaddress         = '((((2(([0-4][0-9])|(5[0-5])))|([01]?[0-9]?[0-9]))\.){3}((2(([0-4][0-9])|(5[0-5])))|([01]?[0-9]?[0-9])))';
-    
+
                        // Tertiary Domain(s) - Optional - Multi - Although some sites may use other characters, the RFC says tertiary domains have the same naming restrictions as second level domains
     $domain_tertiary   = '(' . $alphanum . '(([a-zA-Z0-9-]{0,62})' . $alphanum . ')?\.)*';
 
@@ -282,7 +282,7 @@ function validateUrlSyntax( $urladdr, $options="" ){
     $domain_toplevel   = '([a-zA-Z](([a-zA-Z0-9-]*)[a-zA-Z0-9])?)';
 /*                       // Top Level Domain - Required - Domain List Current As Of December 2004. Use above escaped line to be forgiving of possible future TLD's
     $domain_toplevel   = '(aero|biz|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|post|pro|travel|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|az|ax|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)';
-*/  
+*/
 
                        // Address can be IP address or Domain
     if ($aOptions['I'] === '{0}') {       // IP Address Not Allowed
@@ -293,24 +293,24 @@ function validateUrlSyntax( $urladdr, $options="" ){
         $address       = '((' . $ipaddress . ')|(' . $domain_tertiary . /* MDL-9295 $domain_secondary . */ $domain_toplevel . '))';
     }
     $address = $address . $aOptions['a'];
-    
+
                        // Port Number - :80 or :8080 or :65534 Allows range of :0 to :65535
                        //    (0-59999)         |(60000-64999)   |(65000-65499)    |(65500-65529)  |(65530-65535)
     $port_number       = '(:(([0-5]?[0-9]{1,4})|(6[0-4][0-9]{3})|(65[0-4][0-9]{2})|(655[0-2][0-9])|(6553[0-5])))' . $aOptions['p'];
-    
+
                        // Path - Can be as simple as '/' or have multiple folders and filenames
     $path              = '(/((;)?(' . $unreserved . '|' . $escaped . '|' . '[:@&=+$,]' . ')+(/)?)*)' . $aOptions['f'];
-    
+
                        // Query Section - Accepts ?var1=value1&var2=value2 or ?2393,1221 and much more
     $querystring       = '(\?(' . $reserved . '|' . $unreserved . '|' . $escaped . ')*)' . $aOptions['q'];
-    
+
                        // Fragment Section - Accepts anchors such as #top
     $fragment          = '(#(' . $reserved . '|' . $unreserved . '|' . $escaped . ')*)' . $aOptions['r'];
-    
-    
+
+
     // Building Regular Expression
     $regexp = '^' . $scheme . $userinfo . $address . $port_number . $path . $querystring . $fragment . '$';
-    
+
     // DEBUGGING - Uncomment Line Below To Display The Regular Expression Built
     // echo '<pre>' . htmlentities(wordwrap($regexp,70,"\n",1)) . '</pre>';
 
@@ -545,5 +545,3 @@ function validateFtpSyntax( $ftpaddr, $options="" ){
     return validateUrlSyntax( $ftpaddr, $newoptions);
 
 } // END Function validateFtpSyntax()
-
-?>
index 40a0061de52c1b723d08acb579d302e799be5ccc..a40002c2a6ace4bf0ab14496bde35834a3657dd3 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 /**#@+
- *  state defines 
+ *  state defines
  */
 define( "STATE_NONE",1 ); // blank line has been detected, so looking for first line on next para
 define( "STATE_PARAGRAPH",2 ); // currently processing vanilla paragraph
@@ -57,7 +57,7 @@ class WikiToMarkdown {
 
   function close_block( $state ) {
     // provide appropriate closure for block according to state
-    
+
     // if in list close this first
     $lclose = "";
     if ($this->list_state != LIST_NONE) {
@@ -77,7 +77,7 @@ class WikiToMarkdown {
         break;
       case STATE_NOTIKI:
         $sclose =  "\n";
-        break;  
+        break;
     }
 
     return $lclose . $sclose;
@@ -137,7 +137,7 @@ class WikiToMarkdown {
   function do_list( $line, $blank=false ) {
     // handle line with list character on it
     // if blank line implies drop to level 0
-    
+
     // get magic character and then delete it from the line if not blank
     if ($blank) {
       $listchar="";
@@ -148,7 +148,7 @@ class WikiToMarkdown {
       $count = strspn( $line, $listchar );
       $line = eregi_replace( "^[".$listchar."]+ ", "", $line );
     }
-    
+
     // find what sort of list this character represents
     $list_tag = "";
     $list_close_tag = "";
@@ -183,8 +183,8 @@ class WikiToMarkdown {
         $item_tag = "<dt>";
         $item_close_tag = "</dt>";
         $list_style = LIST_DEFINITION;
-        break;  
-      }  
+        break;
+      }
 
     // tag opening/closing regime now - fun bit :-)
     $tags = "";
@@ -207,31 +207,31 @@ class WikiToMarkdown {
 
     // get indent
     $indent = substr( "                      ",1,$count-1 );
+
     if ($blank) {
       $newline = $tags;
     }
-    else {  
+    else {
       $newline = $tags . $indent . "$item_tag " . $line . "$item_close_tag";
     }
 
     return $newline;
-  } 
+  }
 
 
   function line_replace( $line ) {
     // return line after various formatting replacements
     // have been made - order is vital to stop them interfering with each other
-  
+
     global $CFG;
+
     // ---- (at least) means a <hr />
     // MARKDOWN: no change so leave
 
-    // is this a list line (starts with * # ; :)    
+    // is this a list line (starts with * # ; :)
     if (eregi( "^([*]+|[#]+|[;]+|[:]+) ", $line )) {
-      $line = $this->do_list( $line );        
-    } 
+      $line = $this->do_list( $line );
+    }
 
    // typographic conventions
    // MARKDOWN: no equiv. so convert to entity as before
@@ -246,9 +246,9 @@ class WikiToMarkdown {
     $line = str_replace( "1/4", "&#188;", $line );
     $line = str_replace( "1/2", "&#189;", $line );
     $line = str_replace( "3/4", "&#190;", $line );
-    $line = eregi_replace( "([[:digit:]]+[[:space:]]*)x([[:space:]]*[[:digit:]]+)", "\\1&#215;\\2", $line ); // (digits) x (digits) - multiply    
+    $line = eregi_replace( "([[:digit:]]+[[:space:]]*)x([[:space:]]*[[:digit:]]+)", "\\1&#215;\\2", $line ); // (digits) x (digits) - multiply
     // do formatting tags
-    // NOTE: The / replacement  *has* to be first, or it will screw the 
+    // NOTE: The / replacement  *has* to be first, or it will screw the
     //    HTML tags that are added by the other ones
     // MARKDOWN: only bold and italic change, rest are just HTML
     $line = $this->do_replace_markdown( $line, "\*", "**" );
@@ -259,18 +259,18 @@ class WikiToMarkdown {
     $line = $this->do_replace_sub( $line, "\^", "sup" );
     $line = $this->do_replace( $line, "%", "code" );
     $line = $this->do_replace( $line, "@", "cite" );
-    
+
     // convert urls into proper link with optional link text URL(text)
     // MARDOWN: HTML conversion should work fine
     $line = eregi_replace("([[:space:]]|^)([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])\(([^)]+)\)",
       "\\1[\\5](\\2://\\3\\4)", $line);
-    $line = eregi_replace("([[:space:]])www\.([^[:space:]]*)([[:alnum:]#?/&=])\(([^)]+)\)", 
+    $line = eregi_replace("([[:space:]])www\.([^[:space:]]*)([[:alnum:]#?/&=])\(([^)]+)\)",
       "\\1[\\5](http://www.\\2\\3)", $line);
 
     // make urls (with and without httpd) into proper links
     $line = eregi_replace("([[:space:]]|^)([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])",
       "\\1<\\2://\\3\\4>", $line);
-    $line = eregi_replace("([[:space:]])www\.([^[:space:]]*)([[:alnum:]#?/&=])", 
+    $line = eregi_replace("([[:space:]])www\.([^[:space:]]*)([[:alnum:]#?/&=])",
       "\\1<http://www.\\2\\3\>", $line);
 
     // make email addresses into mailtos....
@@ -298,7 +298,7 @@ class WikiToMarkdown {
     require_once($CFG->libdir.'/filelib.php');
     $coursefileurl = get_file_url($this->courseid);
 
-    // Replace picture resource link 
+    // Replace picture resource link
     $line = eregi_replace( "/([a-zA-Z0-9./_-]+)(png|gif|jpg)\(([^)]+)\)",
             "![\\3](".$coursefileurl."/\\1\\2)", $line );
 
@@ -355,7 +355,7 @@ class WikiToMarkdown {
           $buffer = $buffer . $this->line_replace($line) . "\n";
           $this->block_state = STATE_PREFORM;
         }
-        else 
+        else
         if (eregi("^\% ",$line) ) {
                 // preformatted text - no processing
                 // MARKDOWN: this is MD code form of a paragraph
@@ -365,7 +365,7 @@ class WikiToMarkdown {
         else {
           // ordinary paragraph
           $buffer = $buffer . $this->line_replace($line) . "\n";
-          $this->block_state = STATE_PARAGRAPH; 
+          $this->block_state = STATE_PARAGRAPH;
         }
         continue;
       }
@@ -384,8 +384,7 @@ class WikiToMarkdown {
     // close off any block level tags
     $buffer = $buffer . $this->close_block( $this->block_state );
 
-    //return $buffer;    
+    //return $buffer;
     return $buffer;
   }
 }
-?>