Changeset 1042

Show
Ignore:
Timestamp:
05/20/06 16:28:27 (7 years ago)
Author:
benoitg
Message:

* page.php: Fix bugs in various files preventing the system from
working from the command line.

Location:
trunk/wifidog-auth
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/CHANGELOG

    r1039 r1042  
     12006-05-20 Benoit Grégoire  <bock@step.polymtl.ca> 
     2        * page.php:  Fix bugs in various files preventing the system from working from the command line. 
     3 
    142006-05-20 Benoit Grégoire  <bock@step.polymtl.ca> 
    25        * More install script fixes:  Phlickr wouldn't install, and the permissions of wifidog/tmp/smarty/cache weren't checked. 
  • trunk/wifidog-auth/wifidog/classes/GenericObject.php

    r1031 r1042  
    4545 * Load content classes 
    4646 */ 
    47 require_once('classes/Content.php'); 
    4847 
    4948/** 
  • trunk/wifidog-auth/wifidog/classes/Server.php

    r1013 r1042  
    4646 */ 
    4747require_once('classes/GenericObject.php'); 
    48 require_once('classes/User.php'); 
    4948 
    5049/** 
     
    208207        public static function getCurrentServer($siltent = false) 
    209208        { 
     209        if(empty($_SERVER['SERVER_NAME'])) 
     210        { 
     211            return null; //We were probably called from the command line 
     212        } 
    210213            // Define globals 
    211214                global $db; 
     
    390393        public static function processCreateNewObjectUI() 
    391394        { 
     395        require_once('classes/User.php'); 
    392396            // Init values 
    393397                $_retVal = null; 
     
    775779        public function processAdminUI() 
    776780        { 
     781        require_once('classes/User.php'); 
    777782                if (!User::getCurrentUser()->isSuperAdmin()) { 
    778783                        throw new Exception(_('Access denied!')); 
     
    823828        public function delete(&$errmsg) 
    824829        { 
    825             // Define globals 
     830            require_once('classes/User.php'); 
     831        // Define globals 
    826832                global $db; 
    827833 
  • trunk/wifidog-auth/wifidog/cron/page.php

    r947 r1042  
    4545 * Load required files 
    4646 */ 
     47 
    4748require_once(dirname(__FILE__) . '/../include/common.php'); 
    4849 
  • trunk/wifidog-auth/wifidog/include/common.php

    r1031 r1042  
    5050 * Include configuration file 
    5151 */ 
     52 /** search parent directory hierarchy for a file */ 
     53function cmnSearchParentDirectories($dirname, $searchfor) { 
     54    $pieces = explode(DIRECTORY_SEPARATOR, $dirname); 
     55    $is_absolute = substr($dirname, 0, 1) === DIRECTORY_SEPARATOR ? 1 : 0; 
     56 
     57    for ($i = count($pieces); $i > $is_absolute; $i --) { 
     58        $filename = implode(DIRECTORY_SEPARATOR, array_merge(array_slice($pieces, 0, $i), array ($searchfor))); 
     59        if (file_exists($filename)) 
     60            return $filename; 
     61    } 
     62 
     63    return false; 
     64} 
     65 function cmnRequireConfig($config_file = 'config.php') { 
     66    global $AVAIL_LOCALE_ARRAY; // so that nobody has to change their custom config.php 
     67    $config_path = cmnSearchParentDirectories(dirname(__FILE__), $config_file); 
     68    if (!empty ($config_path)) 
     69        require_once ($config_path); 
     70} 
    5271cmnRequireConfig(); 
    5372 
     
    82101require_once('classes/Dependencies.php'); 
    83102require_once('classes/Server.php'); 
    84  
     103 echo "test\n"; 
    85104global $db; 
    86105 
     
    108127 
    109128/** 
    110  * Set paths 
    111  */ 
     129 * Set the URL paths, but only if we are NOT called from the command line 
     130 */ 
     131if (defined('SYSTEM_PATH')) 
     132{ 
    112133require_once('path_defines_url_content.php'); 
     134} 
    113135 
    114136/* Constant shared with the gateway 
     
    210232} 
    211233 
    212 /** search parent directory hierarchy for a file */ 
    213 function cmnSearchParentDirectories($dirname, $searchfor) { 
    214     $pieces = explode(DIRECTORY_SEPARATOR, $dirname); 
    215     $is_absolute = substr($dirname, 0, 1) === DIRECTORY_SEPARATOR ? 1 : 0; 
    216  
    217     for ($i = count($pieces); $i > $is_absolute; $i --) { 
    218         $filename = implode(DIRECTORY_SEPARATOR, array_merge(array_slice($pieces, 0, $i), array ($searchfor))); 
    219         if (file_exists($filename)) 
    220             return $filename; 
    221     } 
    222  
    223     return false; 
    224 } 
     234 
    225235 
    226236/** join file path pieces together */ 
     
    310320 
    311321    return false; // package was not found 
    312 } 
    313  
    314 function cmnRequireConfig($config_file = 'config.php') { 
    315     global $AVAIL_LOCALE_ARRAY; // so that nobody has to change their custom config.php 
    316     $config_path = cmnSearchParentDirectories(dirname(__FILE__), $config_file); 
    317     if (!empty ($config_path)) 
    318         require_once ($config_path); 
    319322} 
    320323 
  • trunk/wifidog-auth/wifidog/include/path_defines_base.php

    r1035 r1042  
    6868 */ 
    6969 
     70 
    7071/* 
    7172 * Tests ... 
    7273 * 
    73  
    7474echo '$_SERVER[\'DOCUMENT_ROOT\']: ' . $_SERVER['DOCUMENT_ROOT'] . '<br/>'; 
    7575// Not always available on Windows 
     
    9393echo "<br/>"; 
    9494 
    95  * 
    96  * 
    97  * 
    98  
    9995// This will never work for subdirectories 
    10096$path_tmp = strstr($_SERVER['SCRIPT_FILENAME'], $_SERVER['PHP_SELF']); 
     
    107103 */ 
    108104 
    109 if (!defined('SYSTEM_PATH') || !defined('WIFIDOG_ABS_FILE_PATH')) { 
    110   /** 
    111    * Detect wifidog-auth directory base 
    112    */ 
    113  
     105if (!defined('WIFIDOG_ABS_FILE_PATH')) { 
    114106  // the name of this file's parent directory is the wifidog root. 
    115107  // that's a constant, ok, unless this file moves up or down in the hierarchy. 
    116108  $wifidog_base = dirname(dirname(__FILE__)); 
    117  
     109  define('WIFIDOG_ABS_FILE_PATH', $wifidog_base . "/"); 
     110} 
     111if (!defined('SYSTEM_PATH') && isset($_SERVER['REQUEST_URI'])) { 
     112  /** 
     113   * Detect wifidog-auth directory base, but only if we are NOT called from the 
     114   * command line 
     115   */ 
    118116  $browser_url = $_SERVER['SCRIPT_NAME']; // browser url to the script 
    119117  $apache_path = $_SERVER['SCRIPT_FILENAME']; // system path to the very same script 
    120   while ($browser_url != "" && $browser_url != "/" && $apache_path != $wifidog_base) { 
     118  while ($browser_url != "" && $browser_url != "/" && $apache_path != WIFIDOG_ABS_FILE_PATH) { 
    121119    // find the URI that maps to the wifidog base. 
    122     // figure out the difference between the browser's url, the file system path, and $wifidog_base, 
     120    // figure out the difference between the browser's url, the file system path, and WIFIDOG_ABS_FILE_PATH, 
    123121    // piece by piece, starting on the right. 
    124122    // The point at which they diverge defines our DOCUMENT_ROOT and SYSTEM_PATH 
     
    139137  if ($browser_url == "" || substr($browser_url,-1,1) != '/') $browser_url .= '/'; 
    140138  if (!defined('SYSTEM_PATH')) define('SYSTEM_PATH', $browser_url); 
     139} 
    141140 
    142   //if (!defined('WIFIDOG_ABS_FILE_PATH')) define('WIFIDOG_ABS_FILE_PATH', $apache_path . "/"); 
    143   if (!defined('WIFIDOG_ABS_FILE_PATH')) define('WIFIDOG_ABS_FILE_PATH', $wifidog_base . "/"); 
    144 } 
    145141 
    146142/* 
    147143 * Debug output 
    148144 * 
    149  
    150145echo "SYSTEM_PATH: " . SYSTEM_PATH . "<br/>"; 
    151146echo "WIFIDOG_ABS_FILE_PATH: " . WIFIDOG_ABS_FILE_PATH . "<br/>"; 
    152147exit; 
    153  
    154148 * 
    155149 * End of debug output 
  • trunk/wifidog-auth/wifidog/media/base_theme/stylesheet.css

    r1037 r1042  
    55    margin: 0px; 
    66    padding: 0px; 
    7     font-family: arial, sans-serif; 
     7    font-family:  sans-serif;; 
    88    color: black; 
    99    font-size: 0.8em; 
     
    152152} 
    153153 
    154 /* NOT GOOT ENOUGH, doesn't work with explorer.  Best solution is to override in description and sponsor */ 
    155 #main_area_middle>.user_ui_main_outer { 
    156                 background: #E9F6FF; 
    157         margin: 1em 0em 1em 0em; 
    158         padding: 1em; 
    159         border: 1px solid #B4DFFF; 
    160         color: #3D586B; 
    161         } 
    162154#main_area_bottom { 
    163155                margin: 1em; 
     
    464456.user_ui_container { 
    465457    display: block; 
     458        background: #E9F6FF; 
     459        color: #3D586B; 
    466460} 
    467461.user_ui_title { 
    468462    display: block; 
    469     font-size: medium; 
    470     font-weight: bold; 
    471  
    472     color: #46a43a; 
    473     border : 1px solid #46a43a; 
    474     background-color : #daedd8; 
     463    font-size: 1em; 
     464    font-weight: bold; 
     465} 
     466#main_area_middle .user_ui_container { 
     467 
    475468} 
    476469.user_ui_title a {