/contrib/webpipe/main.php

https://github.com/dme/newspipe · PHP · 53 lines · 27 code · 2 blank · 24 comment · 5 complexity · d09597becc5e55aafb14b1b571d73d30 MD5 · raw file

  1. <script language="php">
  2. // ======================================================================
  3. // $Id: main.php,v 1.4 2005/12/01 18:47:43 rcarmo Exp $
  4. //
  5. // WebPipe main handler
  6. //
  7. // Copyright (C) 2005 Rui Carmo, http://the.taoofmac.com
  8. //
  9. // This program is free software; you can redistribute it and/or modify
  10. // it under the terms of the GNU General Public License as published by
  11. // the Free Software Foundation; either version 2 of the License, or
  12. // (at your option) any later version.
  13. //
  14. // This program is distributed in the hope that it will be useful,
  15. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. // GNU General Public License for more details.
  18. //
  19. // You should have received a copy of the GNU General Public License
  20. // along with this program; if not, write to the Free Software
  21. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22. // ======================================================================
  23. session_start();
  24. ini_set( "display_errors", "off" );
  25. require( "config.php" );
  26. require( "lib.php" );
  27. $goIMAP = new CIMAPWrapper( MAILBOX, MAIL_USERNAME, MAIL_PASSWORD );
  28. // Disable warnings for next assignment, since there may not be a PATH_INFO
  29. // at all, there may be more (or less) than two parameters, etc.
  30. //@list( $gszScript, $gszUid, $gszAction, $gszParam ) = split( "/", $_SERVER["PATH_INFO"] );
  31. @$gszScript = basename($_SERVER['PHP_SELF']);
  32. @$gszUid = $_GET["uid"];
  33. @$gszAction = $_GET["action"];
  34. @$gszParam = $_GET["param"];
  35. $gaValues = array();
  36. $gaValues["url"] = assembleUrl();
  37. $goAuthenticator = new CAuthenticator( "WebPipe", $gaUsers, $gaACL );
  38. if( isset( $_GET["action"] ) )
  39. if( $_GET["action"] == "logout" )
  40. $goAuthenticator->logout();
  41. @audit( E_DEBUG, "Session variables: " . serialize( $_SESSION ));
  42. @audit( E_DEBUG, "Checking Privileges in $gszScript (" . serialize($gaPrivileges) . ")" );
  43. $gaPrivileges = $goAuthenticator->checkPrivileges();
  44. if( !isset($gaPrivileges["view"]) ) {
  45. if(!$goAuthenticator->login()) {
  46. @audit( "E_WARNING", "Invalid Authentication" );
  47. }
  48. $goAuthenticator->deny();
  49. exit;
  50. }
  51. </script>