Source for file sl_config.php

Documentation is available at sl_config.php

  1. <?php
  2.     /**
  3.     * Sloodle core script.
  4.     *
  5.     * Sets up the basic Sloodle information, and includes the necessary Moodle data/functionality.
  6.     *
  7.     * @package sloodle
  8.     *
  9.     */
  10.  
  11.     // Pull in the main moodle config
  12.     // NB the following is necessary for when we pull in this config.php from a module under sloodle/mod
  13.     require_once (realpath(dirname(__FILE__"/" "../../config.php"));
  14.     
  15.     // Is this a linker script?
  16.     if (defined('SLOODLE_LINKER_SCRIPT')) {
  17.         // If the site is in maintenance mode, then stop the script
  18.         if (file_exists($CFG->dataroot.'/'.SITEID.'/maintenance.html')) {
  19.             exit("-111|SYSTEM\nThe Moodle site is in maintenance mode. Please try again later.");
  20.         }
  21.         
  22.         // Use Unicode UTF-8 encoding to support non-English alphabets
  23.         if (!headers_sent()) header('Content-Type: text/plain; charset=UTF-8');
  24.     }
  25.     
  26.     
  27. //---------------------------------------------------------------------    
  28.     
  29.     /** The path for browsing to the root of the Sloodle folder. */
  30.     define('SLOODLE_WWWROOT'$CFG->wwwroot.'/mod/sloodle');
  31.     /** The data path for the root of the Sloodle folder. */
  32.     define('SLOODLE_DIRROOT'$CFG->dirroot.'/mod/sloodle');
  33.     /** The data path for the root of the Sloodle library folder. */
  34.     define('SLOODLE_LIBROOT'$CFG->dirroot.'/mod/sloodle/lib');
  35.     
  36.     /** The Sloodle version number. */
  37.     define('SLOODLE_VERSION'0.4)// This is the release version, not the module version (which is in version.php)
  38.     
  39. //---------------------------------------------------------------------
  40.  
  41.     /** The name of the HTTP parameter which can be used to activate Sloodle debug mode. */
  42.     define('SLOODLE_DEBUG_MODE_PARAM_NAME''sloodledebug');
  43.  
  44.     // Check if debug mode is active
  45.     $sloodle_debug 'false';
  46.     if (isset($_REQUEST[SLOODLE_DEBUG_MODE_PARAM_NAME])) $sloodle_debug $_REQUEST[SLOODLE_DEBUG_MODE_PARAM_NAME];
  47.     if (strcasecmp($sloodle_debug'true'== || $sloodle_debug == '1'{
  48.         define('SLOODLE_DEBUG'true);
  49.     else {
  50.         define('SLOODLE_DEBUG'false);
  51.     }
  52.     
  53.     // Apply the effects of debug mode
  54.     if (SLOODLE_DEBUG{
  55.         // Report all errors and warnings
  56.         @ini_set('display_errors''1');
  57.         @error_reporting(2047);
  58.         // Since we're in basic UTF8 text mode, disable the HTML in error codes
  59.         @ini_set('html_errors''0');
  60.     else {
  61.         // Debug mode is NOT active. Are we in a linker script?
  62.         if (defined('SLOODLE_LINKER_SCRIPT'&& SLOODLE_LINKER_SCRIPT == true{
  63.             // Yes - suppress the display of messages
  64.             @ini_set('display_errors''0');
  65.             //@error_reporting(0); // Possibly don't do this - it may interfere with log files?
  66.         }
  67.     }
  68.     
  69.     /**
  70.     * Outputs messages if in debug mode.
  71.     * @uses SLOODLE_DEBUG
  72.     * @param string $msg The debug message to output
  73.     * @return void 
  74.     */
  75.     function sloodle_debug($msg)
  76.     {
  77.          if (SLOODLE_DEBUGecho $msg;
  78.     }
  79.     
  80. //---------------------------------------------------------------------
  81.     // Types of Sloodle module
  82.     // These correspond to the "type" field in the "Sloodle" DB table
  83.     // Each name should be lower-case letters only (max 50)
  84.     // The full name should be specified in the appropriate language file, as "moduletype:type".
  85.     
  86.     // Each course needs to have at least one Sloodle Access Controller before it can be accessed from in-world.
  87.     // This is what grants access to the course as a whole, and sets prim passwords.
  88.     define('SLOODLE_TYPE_CTRL''controller');
  89.                                    
  90.     // These are the regular module types
  91.     define('SLOODLE_TYPE_DISTRIB''distributor');
  92.     define('SLOODLE_TYPE_PRESENTER''presenter');
  93.     define('SLOODLE_TYPE_MAP''map');
  94.     define('SLOODLE_TYPE_IBANK''ibank');
  95.     
  96.     // Store the types in an array (used in lists)
  97.     global $SLOODLE_TYPES;   
  98.     $SLOODLE_TYPES array();
  99.       
  100.     $SLOODLE_TYPES[SLOODLE_TYPE_CTRL;
  101.     $SLOODLE_TYPES[SLOODLE_TYPE_DISTRIB;
  102.     $SLOODLE_TYPES[SLOODLE_TYPE_PRESENTER;
  103.     $SLOODLE_TYPES[SLOODLE_TYPE_IBANK
  104.    // $SLOODLE_TYPES[] = SLOODLE_TYPE_MAP;
  105.     
  106.     
  107.     
  108. //---------------------------------------------------------------------
  109.  
  110.     // Access level constants
  111.     
  112.     /** Indicates that anybody may access an object in-world. */
  113.     define('SLOODLE_OBJECT_ACCESS_LEVEL_PUBLIC'0);
  114.     /** Indicates that only the owner may access an object in-world. */
  115.     define('SLOODLE_OBJECT_ACCESS_LEVEL_OWNER'1);
  116.     /** Indicates that only in-world group-members may access an object in-world. */
  117.     define('SLOODLE_OBJECT_ACCESS_LEVEL_GROUP'2);
  118.     
  119.     /** Indicates that anybody may access a server resource (still requires an authenticated request). */
  120.     define('SLOODLE_SERVER_ACCESS_LEVEL_PUBLIC'0);
  121.     /** Indicates that only those registered and enrolled in a specific course may access a server resource. */
  122.     define('SLOODLE_SERVER_ACCESS_LEVEL_COURSE'1);
  123.     /** Indicates that only those registered on the site may access a server resource. */
  124.     define('SLOODLE_SERVER_ACCESS_LEVEL_SITE'2);
  125.     /** Indicates that only those with Sloodle staff status on a course may access a server resource. */
  126.     define('SLOODLE_SERVER_ACCESS_LEVEL_STAFF'3);    
  127.     
  128.  
  129. //---------------------------------------------------------------------
  130. ?>

Documentation generated on Fri, 17 Jul 2009 11:02:31 +0100 by phpDocumentor 1.4.0