svn: /pear/packages/Bugtracker/trunk/include/classes/ bug_accountrequest.php

From: Date: Sun, 02 Aug 2009 21:07:07 +0000
Subject: svn: /pear/packages/Bugtracker/trunk/include/classes/ bug_accountrequest.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-56853@lists.php.net to get a copy of this message
felipernb Sun, 02 Aug 2009 21:07:07 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=286698 Log: Removing confirmRequest, a function that isn't called from anywhere Changed paths: U pear/packages/Bugtracker/trunk/include/classes/bug_accountrequest.php Modified: pear/packages/Bugtracker/trunk/include/classes/bug_accountrequest.php =================================================================== --- pear/packages/Bugtracker/trunk/include/classes/bug_accountrequest.php 2009-08-02 20:49:20 UTC (rev 286697) +++ pear/packages/Bugtracker/trunk/include/classes/bug_accountrequest.php 2009-08-02 21:07:07 UTC (rev 286698) @@ -134,8 +134,12 @@ if (PEAR::isError($res)) { return $res; } - - $this->handle = $this->dbh->prepare('SELECT handle FROM bug_account_request WHERE salt=?')->execute(array($salt))->fetchOne(); + $stmt = $this->dbh->prepare('SELECT handle FROM bug_account_request WHERE salt=?'); + $res = $stmt->execute(array($salt)); + + if(!PEAR::isError($res)) + $this->handle = $stmt->fetchOne(); + return $salt; } @@ -193,121 +197,7 @@ return $errors; } - function confirmRequest($handle, $password, $name) - { - global $siteBig, $bugEmail; - - if ($handle == $this->dbh->prepare('SELECT handle FROM users WHERE - handle=?')->execute(array($handle))->fetchOne()) { - $id = $this->dbh->nextId("karma"); - - $query = "INSERT INTO karma VALUES (?, ?, ?, ?, NOW())"; - $sth = $this->dbh->prepare($query)->execute(array($id, $this->handle, 'pear.bug', 'pearweb')); - return true; - } - - list($firstname, $lastname) = explode(' ', $name, 2); - $data = array( - 'handle' => $handle, - 'firstname' => $firstname, - 'lastname' => $lastname, - 'email' => $this->email, - 'purpose' => 'bug tracker', - 'password' => $password, - 'password2' => $password, - 'purpose' => 'Open/Comment on bugs', - 'moreinfo' => 'Automatic Account Request', - 'homepage' => '', - ); - - include_once 'pear-database-user.php'; - $useradd = user::add($data, true, true); - if ($useradd !== true) { - return $useradd; - } - - $temphandle = $this->dbh->prepare('SELECT handle from bug_account_request WHERE salt=?')->execute(array($this->salt))->fetchOne(); - // update all relevant records to the new handle - $this->dbh->prepare('UPDATE bugdb_comments set reporter_name=? WHERE handle=?')->execute(array($name, $temphandle)); - $this->dbh->prepare('UPDATE bugdb set reporter_name=? WHERE handle=?')->execute(array($name, $temphandle)); - $this->dbh->prepare('UPDATE users set handle=? WHERE handle=?')->execute(array($handle, $temphandle)); - $this->dbh->prepare('UPDATE bugdb set registered=1, handle=? WHERE handle=?')->execute(array($handle, $temphandle)); - $this->dbh->prepare('UPDATE bugdb_comments set handle=? WHERE handle=?')->execute(array($handle, $temphandle)); - $this->dbh->prepare('UPDATE bugdb_patchtracker set developer=? WHERE developer=?')->execute(array($handle, $temphandle)); - $this->handle = $handle; - // activate the handle and grant karma - // implicitly without human intervention - // copied from the user class and Damblan_Karma - - include_once 'pear-database-user.php'; - $user = user::info($handle, null, 0); - if (!isset($user['registered'])) { - return false; - } - @$arr = unserialize($user['userinfo']); - - include_once 'pear-database-note.php'; - note::removeAll("uid", $handle); - - $data = array(); - $data['registered'] = 1; - $data['password'] = $password; - $data['name'] = $name; - if (is_array($arr)) { - $data['userinfo'] = $arr[1]; - } - $data['create'] = gmdate('Y-m-d H:i'); - $data['createBy'] = 'pearweb'; - $data['handle'] = $handle; - - user::update($data, true); - - $id = $this->dbh->nextId("karma"); - - $query = "INSERT INTO karma VALUES (?, ?, ?, ?, NOW())"; - $sth = $this->dbh->prepare($query)->execute(array($id, $this->handle, 'pear.bug', 'pearweb')); - - $id = $this->dbh->nextId("karma"); - $sth = $this->dbh->prepare($query)->execute(array($id, $this->handle, 'pear.voter', 'pearweb')); - - if (!PEAR::isError($sth)) { - note::add("uid", $this->handle, "Account opened", 'pearweb'); - $bugs = $this->dbh->prepare('SELECT * FROM bugdb WHERE handle=?')->execute(array($this->handle))->fetchAll(MDB2_FETCHMODE_ASSOC); - //FIXME check! - foreach ($bugs as $bug) { - $this->sendBugEmail($bug); - } - $patches = $this->dbh->prepare('SELECT bugdb.package_name,bugdb_patchtracker.* - FROM bugdb_patchtracker, bugdb - WHERE bugdb_patchtracker.developer=? - AND bugdb.id=bugdb_patchtracker.bugdb_id')->execute(array($this->handle))->fetchAll( - MDB2_FETCHMODE_ASSOC); - foreach ($patches as $patch) { - $this->sendPatchEmail($patch); - } - $bugs = $this->dbh->prepare('SELECT bugdb_comments.email,bugdb_comments.comment, - bugdb_comments.reporter_name, bugdb.id, - bugdb.bug_type,bugdb.package_name,bugdb.sdesc, - bugdb.ldesc,bugdb.php_version, bugdb.php_os,bugdb.status, - bugdb.assign,bugdb.package_version - FROM bugdb_comments,bugdb WHERE bugdb.id=bugdb_comments.bug AND - bugdb_comments.handle=?')->execute(array($this->handle))->fetchAll(MDB2_FETCHMODE_ASSOC); - foreach ($bugs as $bug) { - $this->sendBugCommentEmail($bug); - } - $msg = "Your {$siteBig} bug tracker account has been opened.\n" - . "Bugs you have opened will now be displayed, and you can\n" - . "add new comments to existing bugs"; - $xhdr = "From: [$bugEmail}"; - if (!DEVBOX) { - mail($user['email'], "Your {$siteBig} Bug Tracker Account Request", $msg, $xhdr, "-f bounce-no-user@php.net"); - } - $this->deleteRequest(); - return true; - } - return false; - } - + /** * Produces an array of email addresses the report should go to *

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