static function isQA($handle) { require_once 'Damblan/Karma.php'; global $dbh; $karma = new Damblan_Karma($dbh); return $karma->has($handle, 'pear.qa'); }
require_once 'Text/CAPTCHA/Numeral.php'; require_once 'services/HoneyPot.php'; $errors = array(); $ok_to_submit_report = false; // Instantiate the numeral captcha object. $numeralCaptcha = new Text_CAPTCHA_Numeral(); if (isset($_POST['save']) && isset($_POST['pw'])) { // non-developers don't have $user set setcookie('MAGIC_COOKIE', base64_encode(':' . $_POST['pw']), time() + 3600 * 24 * 12, '/', '.php.net'); } // captcha is not necessary if the user is logged in if (isset($auth_user) && $auth_user->registered) { if (auth_check('pear.voter') && !auth_check('pear.dev') && !auth_check('pear.bug')) { // auto-grant bug tracker karma if it isn't present require_once 'Damblan/Karma.php'; $karma = new Damblan_Karma($dbh); $karma->grant($auth_user->user, 'pear.bug'); } if (isset($_SESSION['answer'])) { unset($_SESSION['answer']); } if (isset($_POST['in'])) { $_POST['in']['email'] = $auth_user->email; } } if (isset($_POST['in'])) { $errors = incoming_details_are_valid($_POST['in'], 1, isset($auth_user) && $auth_user->registered); /** * Check if session answer is set, then compare * it with the post captcha value. If it's not * the same, then it's an incorrect password.
| obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Martin Jansen <*****@*****.**> | +----------------------------------------------------------------------+ $Id$ */ redirect_to_https(); @session_start(); $csrf_token_name = 'pear_csrf_token_' . basename(__FILE__, '.php'); include_once 'HTML/QuickForm2.php'; include_once 'HTML/Table.php'; require_once 'Damblan/Karma.php'; require_once 'Damblan/Mailer.php'; auth_require('global.karma.manager'); $karma = new Damblan_Karma($dbh); response_header("PEAR Administration :: Karma Management"); echo "<h1>Karma Management</h1>\n"; $handle = null; if (!empty($_REQUEST['handle'])) { $handle = trim($_REQUEST['handle']); if (!preg_match(PEAR_COMMON_USER_NAME_REGEX, $handle)) { $handle = null; } } if ($handle === null || empty($handle)) { $form = new HTML_QuickForm2('karma_edit', 'post'); $form->removeAttribute('name'); include_once 'pear-database-user.php'; $list = user::listAll(true); $users = array();
function sendActionEmail($event, $userType, $user_handle = null, $comment = '') { global $dbh, $karma, $auth_user; if (empty($karma)) { $karma = new Damblan_Karma($dbh); } require 'pepr/pepr-emails.php'; $email = $proposalEmailTexts[$event]; if (empty($email)) { return PEAR::raiseError("Email template for {$event} not found"); } switch ($userType) { case 'admin': $prefix = "[ADMIN]"; break; case 'mixed': if ($karma->has($user_handle, "pear.pepr.admin") && $this->user_handle != $user_handle) { $prefix = "[ADMIN]"; } else { $prefix = ""; } break; default: $prefix = ""; } $prefix = PROPOSAL_EMAIL_PREFIX . $prefix . " "; include_once 'pear-database-user.php'; $actorinfo = user::info($user_handle); $ownerinfo = user::info($this->user_handle); $this->getVotes($dbh); $vote = @$this->votes[$user_handle]; if (isset($vote)) { $vote->value = $vote->value > 0 ? "+" . $vote->value : $vote->value; if ($vote->is_conditional) { $vote_conditional = "\n\nThis vote is conditional. The condition is:\n\n" . $vote->comment; } elseif ($vote->comment) { $comment = "\n\nComment:\n\n" . $vote->comment; } $vote_url = "http://" . PEAR_CHANNELNAME . "/pepr/pepr-vote-show.php?id=" . $this->id . "&handle=" . $user_handle; } if ($event == 'change_status_finished') { $proposalVotesSum = ppVote::getSum($dbh, $this->id); $vote_result = 'Sum of Votes: ' . $proposalVotesSum['all']; $vote_result .= ' (' . $proposalVotesSum['conditional'] . ' conditional)'; if ($proposalVotesSum['all'] >= 5) { $vote_result .= "\nResult: This proposal was accepted"; } else { $vote_result .= "\nResult: This proposal was rejected"; } } $proposal_url = "http://" . PEAR_CHANNELNAME . "/pepr/pepr-proposal-show.php?id=" . $this->id; $end_voting_time = @$this->longened_date > 0 ? $this->longened_date + PROPOSAL_STATUS_VOTE_TIMELINE : @$this->vote_date + PROPOSAL_STATUS_VOTE_TIMELINE; if ($event == 'proposal_comment' && $user_handle == $this->user_handle) { $email['to'] = $email['to']['owner']; } else { if (!isset($user_handle)) { $email['to'] = $email['to']['pearweb']; } else { if ($karma->has($user_handle, "pear.pepr.admin")) { $email['to'] = $email['to']['admin']; } else { $email['to'] = $email['to']['user']; } } } $email['subject'] = $prefix . $email['subject']; $replace = array("/\\{pkg_category\\}/", "/\\{pkg_name\\}/", "/\\{owner_name\\}/", "/\\{owner_email\\}/", "/\\{owner_link\\}/", "/\\{actor_name\\}/", "/\\{actor_email\\}/", "/\\{actor_link\\}/", "/\\{proposal_url\\}/", "/\\{end_voting_time\\}/", "/\\{vote_value\\}/", "/\\{vote_url\\}/", "/\\{email_pear_dev\\}/", "/\\{email_pear_group\\}/", "/\\{comment\\}/", "/\\{vote_result\\}/", "/\\{vote_conditional\\}/"); $replacements = array($this->pkg_category, $this->pkg_name, isset($ownerinfo['name']) ? $ownerinfo['name'] : "", isset($ownerinfo['email']) ? "<{$ownerinfo['email']}>" : '', isset($ownerinfo['handle']) ? user_link($ownerinfo['handle'], true) : "", isset($actorinfo['name']) ? $actorinfo['name'] : "", isset($actorinfo['email']) ? $actorinfo['email'] : "", isset($actorinfo['handle']) ? "http://" . PEAR_CHANNELNAME . "/user/" . $actorinfo['handle'] : "", $proposal_url, format_date($end_voting_time), isset($vote) ? $vote->value : 0, isset($vote) ? $vote_url : "", PROPOSAL_MAIL_PEAR_DEV, PROPOSAL_MAIL_PEAR_GROUP, isset($comment) ? wordwrap($comment) : '', isset($vote_result) ? $vote_result : '', isset($vote_conditional) ? $vote_conditional : ""); $email = preg_replace($replace, $replacements, $email); $email['text'] .= PROPOSAL_EMAIL_POSTFIX; if (is_object($auth_user)) { $from = '"' . $auth_user->name . '" <' . $auth_user->email . '>'; } else { $from = PROPOSAL_MAIL_FROM; } $to = explode(", ", $email['to']); $email['to'] = array_shift($to); $headers = "CC: " . implode(", ", $to) . "\n"; $headers .= "From: " . $from . "\n"; $headers .= "X-Mailer: " . "PEPr, PEAR Proposal System" . "\n"; $headers .= "X-PEAR-Category: " . $this->pkg_category . "\n"; $headers .= "X-PEAR-Package: " . $this->pkg_name . "\n"; $headers .= "X-PEPr-Status: " . $this->getStatus() . "\n"; if ($event == "change_status_proposal") { $headers .= "Message-ID: <proposal-" . $this->id . "@" . PEAR_CHANNELNAME . ">\n"; } else { $headers .= "In-Reply-To: <proposal-" . $this->id . "@" . PEAR_CHANNELNAME . ">\n"; } if (!DEVBOX) { $res = mail($email['to'], $email['subject'], $email['text'], $headers, '-f ' . PEAR_BOUNCE_EMAIL); } else { $res = true; } if (!$res) { return PEAR::raiseError('Could not send notification email.'); } return true; }
function auth_check($atom) { global $dbh; static $karma; require_once "Damblan/Karma.php"; global $auth_user; if (!isset($auth_user)) { return false; } // Check for backwards compatibility if (is_bool($atom)) { $atom = $atom === true ? 'pear.admin' : 'pear.dev'; } if (!isset($karma)) { $karma = new Damblan_Karma($dbh); } return $karma->has($auth_user->handle, $atom); }
| obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | +----------------------------------------------------------------------+ $Id$ */ // Details about PEAR accounts require_once 'Damblan/Karma.php'; require_once 'Damblan/URL.php'; require_once 'HTTP.php'; require 'bugs/pear-bugs.php'; include_once 'pear-database-user.php'; $bugs = new PEAR_Bugs(); $site = new Damblan_URL(); $karma = new Damblan_Karma($dbh); $params = array('handle' => '', 'action' => ''); $site->getElements($params); $handle = htmlspecialchars(strtolower($params['handle'])); // Redirect to the accounts list if no handle was specified if (empty($handle)) { localRedirect('/accounts.php'); } $dbh->setFetchmode(DB_FETCHMODE_ASSOC); $permissions = $karma->get($handle); $row = user::info($handle); if ($row === null) { error_handler($handle . ' is not a valid account name.', 'Invalid Account'); } switch ($params['action']) { case 'wishlist':
<?php set_include_path(dirname(__FILE__) . '/include' . PATH_SEPARATOR . get_include_path()); // Get common settings. require_once 'pear-prepend.php'; // Get the database class. require_once 'DB.php'; $options = array('persistent' => false, 'portability' => DB_PORTABILITY_ALL); $dbh =& DB::connect(PEAR_DATABASE_DSN, $options); if (DB::isError($dbh)) { die("Failed to connect: {$dsn}\n"); } require_once 'pear-database-maintainer.php'; require_once 'pear-database-note.php'; require_once 'Damblan/Karma.php'; $karma = new Damblan_Karma($dbh); $karma_level = 'pecl.dev'; $sql = "SELECT p.name, p.id\n FROM packages p\n WHERE p.package_type = 'pecl'\n ORDER BY p.name"; $packages = $dbh->getAssoc($sql, false, null, DB_FETCHMODE_ASSOC); foreach ($packages as $n => $id) { $m = maintainer::get((int) $id); if (!empty($m)) { echo "\nAltering karma for maintainers of {$n} package id {$id}\n"; foreach ($m as $handle => $m_data) { if (!$karma->has($handle, $karma_level)) { echo "Giving {$handle} {$karma_level} karma\n"; // Bypassing damblan karma because it needs a logged in user $id = $dbh->nextId('karma'); if (DB::isError($id)) { echo "Couldn't get a new id from the karma table\n"; exit;
?> <h1>The PEAR Quality Assurance Initiative</h1> <p>The PEAR Quality Assurance Initiative is designed to promote quality within PEAR. You can find out more about how the <abbr title="Quality Assurance">QA</abbr> team works in the <a href="/pepr/pepr-proposal-show.php?id=60">appendant RFC</a>, and the <a href="http://wiki.php.net/pear/qa">wiki</a>. </p> <p>The current members of the <abbr title="Quality Assurance">QA</abbr> Team are: </p> <ul> <?php $karma = new Damblan_Karma($dbh); foreach ($karma->getUsers('pear.qa') as $user) { echo ' <li>' . user_link(htmlspecialchars($user['user']), true) . "</li>\n"; } ?> </ul> <p>If you are interested in helping out, or if you have questions concerning the <abbr title="Quality Assurance">QA</abbr> initiative, you can contact the team using the mailing list <a href="mailto:<?php echo PEAR_QA_EMAIL; ?> "><?php echo PEAR_QA_EMAIL; ?>
function auth_check($atom) { global $dbh; static $karma; require_once "Damblan/Karma.php"; global $auth_user; // admins are almighty if (user::isAdmin($auth_user->handle)) { return true; } // Check for backwards compatibility if (is_bool($atom)) { if ($atom == true) { $atom = "pear.admin"; } else { $atom = "pear.dev"; } } // every authenticated user has the pear.user and pear.dev karma if (in_array($atom, array("pear.user", "pear.dev"))) { return true; } if (!isset($karma)) { $karma = new Damblan_Karma($dbh); } $a = $karma->has($auth_user->handle, $atom); if (PEAR::isError($a)) { return false; } return $a; }
if (empty($_GET['id'])) { response_header('PEPr :: Delete :: Invalid Request'); echo "<h1>Delete Proposal</h1>\n"; report_error('The requested proposal does not exist.'); response_footer(); exit; } $proposal = proposal::get($dbh, $_GET['id']); if (!$proposal) { response_header('PEPr :: Delete :: Invalid Request'); echo "<h1>Delete Proposal</h1>\n"; report_error('The requested proposal does not exist.'); response_footer(); exit; } $karma = new Damblan_Karma($dbh); $form = new HTML_QuickForm2('delete-proposal', 'post', array('action' => 'pepr-proposal-delete.php?id=' . $proposal->id)); ob_start(); response_header('PEPr :: Delete :: ' . htmlspecialchars($proposal->pkg_name)); echo '<h1>Delete Proposal "' . htmlspecialchars($proposal->pkg_name) . ""</h1>\n"; if (!$proposal->mayEdit($auth_user->handle)) { report_error('You are not allowed to delete this proposal,' . ' probably due to it having reached the "' . $proposal->getStatus(true) . '" phase.' . ' If this MUST be deleted, contact someone ELSE' . ' who has pear.pepr.admin karma.'); response_footer(); exit; } if ($proposal->compareStatus('>', 'proposal')) { if ($karma->has($auth_user->handle, 'pear.pepr.admin')) { report_error('This proposal has reached the "' . $proposal->getStatus(true) . '" phase.' . ' Are you SURE you want to delete it?', 'warnings', 'WARNING:'); } } $form->removeAttribute('name');