auth.php 823 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /*
  3. * This function tell other modules what users have access
  4. * to the plugin.
  5. *
  6. * Philippe Mingo
  7. *
  8. * $Id$
  9. */
  10. function adm_check_user() {
  11. GLOBAL $username, $PHP_SELF;
  12. if ( strpos( 'options.php', $PHP_SELF ) ) {
  13. $auth = FALSE;
  14. } else if ( file_exists( '../plugins/administrator/admins' ) ) {
  15. $auths = file( '../plugins/administrator/admins' );
  16. $auth = in_array( "$username\n", $auths );
  17. } else if ( file_exists( '../config/admins' ) ) {
  18. $auths = file( '../config/admins' );
  19. $auth = in_array( "$username\n", $auths );
  20. } else if ( $adm_id = fileowner('../config/config.php') ) {
  21. $adm = posix_getpwuid( $adm_id );
  22. $auth = ( $username == $adm['name'] );
  23. }
  24. else {
  25. $auth = FALSE;
  26. }
  27. return( $auth );
  28. }
  29. ?>