squirrelmail-webmail  1.4.22
About: SquirrelMail is a standards-based webmail package with strong MIME support, address books, and folder manipulation (written in PHP4).
  Fossies Dox: squirrelmail-webmail-1.4.22.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

auth.php
Go to the documentation of this file.
1 <?php
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 
64 function adm_array_trim(&$value,$key) {
65  $value=trim($value);
66 }
adm_check_user
adm_check_user()
Definition: auth.php:21
sqgetGlobalVar
sqgetGlobalVar($name, &$value, $search=SQ_INORDER)
Definition: global.php:344
PAGE_NAME
const PAGE_NAME
Definition: options.php:17
SQ_SESSION
const SQ_SESSION
Definition: global.php:18
$username
global $username
Definition: validate.php:55
$plugins
global $plugins
Definition: plugin.php:196
adm_array_trim
adm_array_trim(&$value, $key)
Definition: auth.php:64
SM_PATH
const SM_PATH
Definition: decrypt_headers.php:16