Preparing administrator for alternate autentication methods.
authorphilippe_mingo <philippe_mingo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 31 Jan 2002 10:46:16 +0000 (10:46 +0000)
committerphilippe_mingo <philippe_mingo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 31 Jan 2002 10:46:16 +0000 (10:46 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2309 7612ce4b-ef26-0410-bec9-ea0150e637f0

plugins/administrator/auth.php [new file with mode: 0644]
plugins/administrator/options.php
plugins/administrator/setup.php

diff --git a/plugins/administrator/auth.php b/plugins/administrator/auth.php
new file mode 100644 (file)
index 0000000..eb6bd74
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+
+function adm_check_user() {
+
+    GLOBAL $username;
+
+    $auth = FALSE;
+    if ( $adm_id = fileowner('../config/config.php') ) {
+        $adm = posix_getpwuid( $adm_id );
+        if ( $username == $adm['name'] ) {
+            $auth = TRUE;
+        } 
+    }
+
+    return( $auth );
+
+}
+
+?>
\ No newline at end of file
index 55e5da0..3d045be 100644 (file)
@@ -136,18 +136,11 @@ require_once('../functions/page_header.php');
 require_once('../functions/imap.php');
 require_once('../src/load_prefs.php');
 require_once('../plugins/administrator/defines.php');
+require_once('../plugins/administrator/auth.php');
 
 GLOBAL $data_dir, $username;
 
-$auth = FALSE;
-if ( $adm_id = fileowner('../config/config.php') ) {
-    $adm = posix_getpwuid( $adm_id );
-    if ( $username == $adm['name'] ) {
-        $auth = TRUE;
-    }
-}
-
-if ( !auth ) {
+if ( !adm_check_user() ) {
     header("Location: ../../src/options.php") ;
     exit;
 }
index a90859a..45b0c87 100644 (file)
  * $Id$
  */
 
+require_once('../plugins/administrator/auth.php');
+
 function squirrelmail_plugin_init_administrator() {
     global $squirrelmail_plugin_hooks, $username;
 
-    if ( $adm_id = fileowner('../config/config.php') ) {
-        $adm = posix_getpwuid( $adm_id );
-        if ( $username == $adm['name'] ) {
-            $squirrelmail_plugin_hooks['optpage_register_block']['administrator'] =
-                                      'squirrelmail_administrator_optpage_register_block';
-        }
+    if ( adm_check_user() ) {        
+        $squirrelmail_plugin_hooks['optpage_register_block']['administrator'] =
+                                  'squirrelmail_administrator_optpage_register_block';
     }
 }