Source for file auth.php

Documentation is available at auth.php

  1. <?php
  2. /**
  3.  * Administrator plugin - Authentication routines
  4.  *
  5.  * This function tell other modules what users have access
  6.  * to the plugin.
  7.  *
  8.  * @version $Id: auth.php,v 1.10.2.9 2006/02/03 22:27:51 jervfors Exp $
  9.  * @author Philippe Mingo
  10.  * @copyright (c) 1999-2006 The SquirrelMail Project Team
  11.  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  12.  * @package plugins
  13.  * @subpackage administrator
  14.  */
  15.  
  16. /**
  17.  * Check if user has access to administrative functions
  18.  *
  19.  * @return boolean 
  20.  */
  21. function adm_check_user({
  22.     global $PHP_SELF$plugins;
  23.     require_once(SM_PATH 'functions/global.php');
  24.     
  25.     if !in_array('administrator'$plugins) ) {
  26.         return FALSE;
  27.     }
  28.     
  29.     if !sqgetGlobalVar('username',$username,SQ_SESSION) ) {
  30.         $username '';
  31.     }
  32.  
  33.     /* This needs to be first, for all non_options pages */
  34.     if (strpos('options.php'$PHP_SELF)) {
  35.         $auth FALSE;
  36.     else if (file_exists(SM_PATH 'plugins/administrator/admins')) {
  37.         $auths file(SM_PATH 'plugins/administrator/admins');
  38.         array_walk($auths'adm_array_trim');
  39.         $auth in_array($username$auths);
  40.     else if (file_exists(SM_PATH 'config/admins')) {
  41.         $auths file(SM_PATH 'config/admins');
  42.         array_walk($auths'adm_array_trim');
  43.         $auth in_array($username$auths);
  44.     else if (($adm_id fileowner(SM_PATH 'config/config.php')) &&
  45.                function_exists('posix_getpwuid')) {
  46.         $adm posix_getpwuid$adm_id );
  47.         $auth ($username == $adm['name']);
  48.     else {
  49.         $auth FALSE;
  50.     }
  51.  
  52.     return ($auth);
  53. }
  54.  
  55. /**
  56.  * Removes whitespace from array values
  57.  * @param string $value array value that has to be trimmed
  58.  * @param string $key array key
  59.  * @since 1.5.1 and 1.4.5
  60.  * @access private
  61.  */
  62. function adm_array_trim(&$value,$key{
  63.     $value=trim($value);
  64. }
  65. ?>

Documentation generated on Sat, 07 Oct 2006 16:29:55 +0300 by phpDocumentor 1.3.0RC6