svn: /pear/packages/Bugtracker/trunk/include/ functions.inc master-auth.inc

From: Date: Thu, 13 Aug 2009 13:52:59 +0000
Subject: svn: /pear/packages/Bugtracker/trunk/include/ functions.inc master-auth.inc
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-57118@lists.php.net to get a copy of this message
jani Thu, 13 Aug 2009 13:52:59 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=287233 Log: - Nuke one more unnecessary include() Changed paths: U pear/packages/Bugtracker/trunk/include/functions.inc D pear/packages/Bugtracker/trunk/include/master-auth.inc Modified: pear/packages/Bugtracker/trunk/include/functions.inc =================================================================== --- pear/packages/Bugtracker/trunk/include/functions.inc 2009-08-13 13:49:33 UTC (rev 287232) +++ pear/packages/Bugtracker/trunk/include/functions.inc 2009-08-13 13:52:59 UTC (rev 287233) @@ -61,9 +61,46 @@ * DEFINE FUNCTIONS ============================ */ + /** * Authentication */ + +function verify_password($user, $pass) +{ + global $errors; + + $post = http_build_query( + array( + "token" => getenv("TOKEN"), + "username" => $user, + "password" => $pass, + ) + ); + + $opts = array( + "method" => "POST", + "header" => "Content-type: application/x-www-form-urlencoded", + "content" => $post, + ); + + $ctx = stream_context_create(array("http" => $opts)); + + $s = file_get_contents("https://master.php.net/fetch/cvsauth.php", false, $ctx); + + $a = @unserialize($s); + if (!is_array($a)) { + $errors[] = "Unknown authentication error\n"; + exit; + } + if (isset($a["errno"])) { + $errors[] = "Authentication failed: {$a['errstr']}\n"; + return false; + } + + return true; +} + function bugs_authenticate (&$user, &$pw, &$logged_in, &$is_trusted_developer) { global $auth_user, $ROOT_DIR; @@ -104,7 +141,6 @@ // Authentication and user level check // User levels are: reader (0), commenter/patcher/etc. (edit = 3), submitter (edit = 2), developer (edit = 1) - require_once "{$ROOT_DIR}/include/master-auth.inc"; if ($user != '' && $pw != '' && verify_password($user, $pw)) { $logged_in = 'developer'; $auth_user->handle = $user; Deleted: pear/packages/Bugtracker/trunk/include/master-auth.inc =================================================================== --- pear/packages/Bugtracker/trunk/include/master-auth.inc 2009-08-13 13:49:33 UTC (rev 287232) +++ pear/packages/Bugtracker/trunk/include/master-auth.inc 2009-08-13 13:52:59 UTC (rev 287233) @@ -1,40 +0,0 @@ -<?php - -/** - * Contains functions to handle authentication using master.php.net - */ - -function verify_password($user, $pass) -{ - global $errors; - - $post = http_build_query( - array( - "token" => getenv("TOKEN"), - "username" => $user, - "password" => $pass, - ) - ); - - $opts = array( - "method" => "POST", - "header" => "Content-type: application/x-www-form-urlencoded", - "content" => $post, - ); - - $ctx = stream_context_create(array("http" => $opts)); - - $s = file_get_contents("https://master.php.net/fetch/cvsauth.php", false, $ctx); - - $a = @unserialize($s); - if (!is_array($a)) { - $errors[] = "Unknown authentication error\n"; - exit; - } - if (isset($a["errno"])) { - $errors[] = "Authentication failed: {$a['errstr']}\n"; - return false; - } - - return true; -}

« previous php.pear.cvs (#57118) next »