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.     
  23.     
  24. //---------------------------------------------------------------------    
  25.     
  26.     /** The path for browsing to the root of the Sloodle folder. */
  27.     define('SLOODLE_WWWROOT'$CFG->wwwroot.'/mod/sloodle');
  28.     /** The data path for the root of the Sloodle folder. */
  29.     define('SLOODLE_DIRROOT'$CFG->dirroot.'/mod/sloodle');
  30.     /** The data path for the root of the Sloodle library folder. */
  31.     define('SLOODLE_LIBROOT'$CFG->dirroot.'/mod/sloodle/lib');
  32.     /** The Sloodle version number. */
  33.     define('SLOODLE_VERSION'0.3)// This is the release version, not the module version (which is in version.php)
  34.     
  35. //---------------------------------------------------------------------
  36.  
  37.     /** The name of the HTTP parameter which can be used to activate Sloodle debug mode. */
  38.     define('SLOODLE_DEBUG_MODE_PARAM_NAME''sloodledebug');
  39.     
  40.     // Check if debug mode is active
  41.     $sloodle_debug 'false';
  42.     if (isset($_REQUEST[SLOODLE_DEBUG_MODE_PARAM_NAME])) $sloodle_debug $_REQUEST[SLOODLE_DEBUG_MODE_PARAM_NAME];
  43.     if (strcasecmp($sloodle_debug'true'== || $sloodle_debug == '1'{
  44.         define('SLOODLE_DEBUG'true);
  45.     else {
  46.         define('SLOODLE_DEBUG'false);
  47.     }
  48.     
  49.     // Apply the effects of debug mode
  50.     if (SLOODLE_DEBUG{
  51.         // Report all errors and warnings
  52.         @ini_set('display_errors''1');
  53.         @error_reporting(2047);
  54.     else {
  55.         // Debug mode is NOT active. Are we in a linker script?
  56.         if (defined('SLOODLE_LINKER_SCRIPT'&& SLOODLE_LINKER_SCRIPT == true{
  57.             // Yes - suppress the display of messages
  58.             @ini_set('display_errors''0');
  59.             //@error_reporting(0); // Possibly don't do this - it may interfere with log files?
  60.         }
  61.     }
  62.     
  63.     /**
  64.     * Outputs messages if in debug mode.
  65.     * @uses SLOODLE_DEBUG
  66.     * @param string $msg The debug message to output
  67.     * @return void 
  68.     */
  69.     function sloodle_debug($msg)
  70.     {
  71.          if (SLOODLE_DEBUGecho $msg;
  72.     }
  73.     
  74. //---------------------------------------------------------------------
  75.     // Types of Sloodle module
  76.     // These correspond to the "type" field in the "Sloodle" DB table
  77.     // Each name should be lower-case letters only (max 50)
  78.     // The full name should be specified in the appropriate language file, as "moduletype:type".
  79.     
  80.     // Each course needs to have at least one Sloodle Access Controller before it can be accessed from in-world.
  81.     // This is what grants access to the course as a whole, and sets prim passwords.
  82.     define('SLOODLE_TYPE_CTRL''controller');
  83.     
  84.     // These are the regular module types
  85.     define('SLOODLE_TYPE_DISTRIB''distributor');
  86.     
  87.     // Store the types in an array (used in lists)
  88.     global $SLOODLE_TYPES;
  89.     $SLOODLE_TYPES array();
  90.     $SLOODLE_TYPES[SLOODLE_TYPE_CTRL;
  91.     $SLOODLE_TYPES[SLOODLE_TYPE_DISTRIB;
  92.     
  93. //---------------------------------------------------------------------
  94.  
  95.     // Access level constants
  96.     
  97.     /** Indicates that anybody may access an object in-world. */
  98.     define('SLOODLE_OBJECT_ACCESS_LEVEL_PUBLIC'0);
  99.     /** Indicates that only the owner may access an object in-world. */
  100.     define('SLOODLE_OBJECT_ACCESS_LEVEL_OWNER'1);
  101.     /** Indicates that only in-world group-members may access an object in-world. */
  102.     define('SLOODLE_OBJECT_ACCESS_LEVEL_GROUP'2);
  103.     
  104.     /** Indicates that anybody may access a server resource (still requires an authenticated request). */
  105.     define('SLOODLE_SERVER_ACCESS_LEVEL_PUBLIC'0);
  106.     /** Indicates that only those registered and enrolled in a specific course may access a server resource. */
  107.     define('SLOODLE_SERVER_ACCESS_LEVEL_COURSE'1);
  108.     /** Indicates that only those registered on the site may access a server resource. */
  109.     define('SLOODLE_SERVER_ACCESS_LEVEL_SITE'2);
  110.     /** Indicates that only those with Sloodle staff status on a course may access a server resource. */
  111.     define('SLOODLE_SERVER_ACCESS_LEVEL_STAFF'3);    
  112.     
  113.  
  114. //---------------------------------------------------------------------
  115. ?>

Documentation generated on Mon, 16 Jun 2008 15:57:01 +0100 by phpDocumentor 1.4.0