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 14840 2020-01-07 07:42:38Z pdontthink $
  9.  * @author Philippe Mingo
  10.  * @copyright (c) 1999-2020 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 $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 (!defined('PAGE_NAME') || strpos(PAGE_NAME, 'options') === FALSE) {
  35.     if (!defined('PAGE_NAME'
  36.      || (PAGE_NAME != 'administrator_options' && PAGE_NAME != 'options')) {
  37.         $auth FALSE;
  38.     else if (file_exists(SM_PATH 'plugins/administrator/admins')) {
  39.         $auths file(SM_PATH 'plugins/administrator/admins');
  40.         array_walk($auths'adm_array_trim');
  41.         $auth in_array($username$auths);
  42.     else if (file_exists(SM_PATH 'config/admins')) {
  43.         $auths file(SM_PATH 'config/admins');
  44.         array_walk($auths'adm_array_trim');
  45.         $auth in_array($username$auths);
  46.     else if (($adm_id fileowner(SM_PATH 'config/config.php')) &&
  47.                function_exists('posix_getpwuid')) {
  48.         $adm posix_getpwuid$adm_id );
  49.         $auth ($username == $adm['name']);
  50.     else {
  51.         $auth FALSE;
  52.     }
  53.  
  54.     return ($auth);
  55. }
  56.  
  57. /**
  58.  * Removes whitespace from array values
  59.  * @param string $value array value that has to be trimmed
  60.  * @param string $key array key
  61.  * @since 1.5.1 and 1.4.5
  62.  * @access private
  63.  */
  64. function adm_array_trim(&$value,$key{
  65.     $value=trim($value);
  66. }

Documentation generated on Mon, 13 Jan 2020 04:24:14 +0100 by phpDocumentor 1.4.3