Esempio n. 1
0
 function confirmRequest($handle, $password, $name)
 {
     $sql = 'SELECT handle FROM users WHERE handle = ?';
     if ($handle == $this->dbh->getOne($sql, array($handle))) {
         $id = $this->dbh->nextId("karma");
         $query = 'INSERT INTO karma VALUES (?, ?, ?, ?, NOW())';
         $sth = $this->dbh->query($query, 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;
     }
     $sql = 'SELECT handle from bug_account_request WHERE salt = ?';
     $temphandle = $this->dbh->getOne($sql, array($this->salt));
     // update all relevant records to the new handle
     $this->dbh->query('UPDATE bugdb_comments set reporter_name = ? WHERE handle = ?', array($name, $temphandle));
     $this->dbh->query('UPDATE bugdb set reporter_name = ? WHERE handle = ?', array($name, $temphandle));
     $this->dbh->query('UPDATE users set handle = ? WHERE handle = ?', array($handle, $temphandle));
     $this->dbh->query('UPDATE bugdb set registered = 1, handle = ? WHERE handle = ?', array($handle, $temphandle));
     $this->dbh->query('UPDATE bugdb_comments set handle = ? WHERE handle = ?', array($handle, $temphandle));
     $this->dbh->query('UPDATE bugdb_patchtracker set developer = ? WHERE developer = ?', 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($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');
     $data['createBy'] = SITE . 'web';
     $data['handle'] = $handle;
     user::update($data, true);
     $query = 'INSERT INTO karma VALUES (?, ?, ?, ?, NOW())';
     $id = $this->dbh->nextId('karma');
     $sth = $this->dbh->query($query, array($id, $this->handle, 'pear.bug', SITE . 'web'));
     $id = $this->dbh->nextId('karma');
     $sth = $this->dbh->query($query, array($id, $this->handle, 'pear.voter', SITE . 'web'));
     if (!DB::isError($sth)) {
         require_once 'bugs/pear-bugs-utils.php';
         $pbu = new PEAR_Bugs_Utils();
         note::add($this->handle, 'Account opened', SITE . 'web');
         $bugs = $this->dbh->getAll('SELECT * FROM bugdb WHERE handle = ?', array($this->handle), DB_FETCHMODE_ASSOC);
         foreach ($bugs as $bug) {
             $this->sendBugEmail($bug);
         }
         $patches = $this->dbh->getAll('SELECT bugdb.package_name, bugdb_patchtracker.*
             FROM bugdb_patchtracker, bugdb
             WHERE bugdb_patchtracker.developer = ?
                 AND bugdb.id = bugdb_patchtracker.bugdb_id', array($this->handle), DB_FETCHMODE_ASSOC);
         foreach ($patches as $patch) {
             $pbu->sendPatchEmail($patch);
         }
         $bugs = $this->dbh->getAll('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 = ?', array($this->handle), DB_FETCHMODE_ASSOC);
         foreach ($bugs as $bug) {
             $this->sendBugCommentEmail($bug);
         }
         $msg = "Your PEAR 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: " . PEAR_WEBMASTER_EMAIL;
         if (!DEVBOX) {
             mail($user['email'], "Your PEAR Bug Tracker Account Request", $msg, $xhdr, "-f " . PEAR_BOUNCE_EMAIL);
         }
         $this->deleteRequest();
         return true;
     }
     return false;
 }
Esempio n. 2
0
            $type = @$types[$_POST['in']['bug_type']];
            if (!DEVBOX) {
                // mail to package developers
                @mail($mailto, "[" . SITE_BIG . "-BUG] {$type} #{$cid} [NEW]: {$sdesc}", $ascii_report . "1\n-- \n{$dev_extra}", $extra_headers, '-f ' . PEAR_BOUNCE_EMAIL);
                // mail to reporter, only if the reporter is also not the package maintainer
                if (strpos($mailto, $email) !== false) {
                    @mail($email, "[" . SITE_BIG . "-BUG] {$type} #{$cid}: {$sdesc}", $ascii_report . "2\n", "From: " . SITE_BIG . " Bug Database <{$mailfrom}>\n" . "X-PHP-Bug: {$cid}\n" . "Message-ID: <bug-{$cid}@" . PEAR_CHANNELNAME . ">", '-f ' . PEAR_BOUNCE_EMAIL);
                }
            }
            if (!empty($_POST['in']['addpatch'])) {
                // Add patch page
                localRedirect('bug.php?id=' . $cid . '&email=' . $_POST['in']['email'] . '&edit=13');
            } elseif (!isset($buggie) && !empty($_POST['in']['addpatch'])) {
                //FIXME This is possible not needed anymore, look into it
                require_once 'bugs/pear-bugs-utils.php';
                PEAR_Bugs_Utils::sendPatchEmail($cid, $patchrevision, $_POST['in']['package_name'], $auth_user->handle);
            }
            localRedirect('bug.php?id=' . $cid . '&thanks=4');
            exit;
        } while (false);
    } else {
        // had errors...
        response_header('Report - Problems');
    }
}
// end of if input
if (empty($_REQUEST['package']) || !is_string($_REQUEST['package'])) {
    response_header('Report');
    $errors[] = 'The package name in the URL is not proper, please fix it and try again.';
    $errors[] = 'It should look like this: report.php?package=PackageName';
    report_error($errors);
Esempio n. 3
0
    $errors = array($e->getMessage(), 'Could not attach patch "' . htmlspecialchars($patchname) . '" to Bug #' . $id);
    $captcha = $numeralCaptcha->getOperation();
    $_SESSION['answer'] = $numeralCaptcha->getAnswer();
    return;
}
// {{{ Email after the patch is added and add a comment to the bug report.
if (!isset($buggie)) {
    $patchname = $_POST['patchname'];
    $url = "bug.php?id={$id}&edit=12&patch={$patchname}&revision={$e}";
    $bugurl = 'http://' . PEAR_CHANNELNAME . '/bugs/' . $url;
    // Add a comment about this in the bug report
    $text = <<<TXT
Added #patch bug:{$id};patch:{$patchname};revision:{$e};.
TXT;
    $query = 'INSERT INTO bugdb_comments' . ' (bug, email, ts, comment, reporter_name, handle) VALUES (?, ?, NOW(), ?, ?, ?)';
    $dbh->query($query, array($id, $auth_user->email, $text, $auth_user->name, $auth_user->handle));
    /**
     * Email the package maintainers/leaders about
     * the new patch added to their bug request.
     */
    require_once 'bugs/pear-bugs-utils.php';
    $patch = array('patch' => $patchname, 'bug_id' => $id, 'revision' => $e, 'package_name' => $buginfo['package_name']);
    $res = PEAR_Bugs_Utils::sendPatchEmail($patch);
    if (PEAR::isError($res)) {
        // Patch not sent. Let's handle it here but not now..
    }
}
// }}}
localRedirect('/bugs/bug.php' . '?id=' . $id . '&edit=12' . '&patch=' . urlencode($_POST['patchname']) . '&revision=' . $e . '&thanks=13');
//don't execute rest of script
exit;