com web/doc: RFC stuff removed: include/rfc/HTML_BBCodeParser _Filter_Extended.php include/rfc/PACKAGES include/rfc /rfc-config.php
include/rfc/rfc-cron.php include/rfc/rf c-emails.php include/rfc/rfc.php scripts/setup_rfc_ database.php sql/rfc.sql www/rfc/index.php www/rfc/
rfc-bbcode-help.php www/rfc/rfc-comments-show.php www/r fc/rfc-overview.php www/rfc/rfc-proposal-delete.php www /rfc/rfc-proposal-edit.php
www/rfc/rfc-proposal-show.php www/rfc/rfc-

From: Date: Mon, 17 Mar 2014 19:42:22 +0000
Subject: com web/doc: RFC stuff removed: include/rfc/HTML_BBCodeParser _Filter_Extended.php include/rfc/PACKAGES include/rfc /rfc-config.php
include/rfc/rfc-cron.php include/rfc/rf c-emails.php include/rfc/rfc.php scripts/setup_rfc_ database.php sql/rfc.sql www/rfc/index.php www/rfc/
rfc-bbcode-help.php www/rfc/rfc-comments-show.php www/r fc/rfc-overview.php www/rfc/rfc-proposal-delete.php www /rfc/rfc-proposal-edit.php
www/rfc/rfc-proposal-show.php www/rfc/rfc-
Groups: php.doc.web 
Request: Send a blank email to doc-web+get-2309@lists.php.net to get a copy of this message
Commit: 592c601947b9664b4e2a9da6de510c7f28d4579d Author: Sobak <msobaczewski@gmail.com> Mon, 17 Mar 2014 20:42:22 +0100 Parents: a382deb92aef2706f0366c1110f76967a40789ca Branches: master Link: http://git.php.net/?p=web/doc.git;a=commitdiff;h=592c601947b9664b4e2a9da6de510c7f28d4579d Log: RFC stuff removed Changed paths: D include/rfc/HTML_BBCodeParser_Filter_Extended.php D include/rfc/PACKAGES D include/rfc/rfc-config.php D include/rfc/rfc-cron.php D include/rfc/rfc-emails.php D include/rfc/rfc.php D scripts/setup_rfc_database.php D sql/rfc.sql D www/rfc/index.php D www/rfc/rfc-bbcode-help.php D www/rfc/rfc-comments-show.php D www/rfc/rfc-overview.php D www/rfc/rfc-proposal-delete.php D www/rfc/rfc-proposal-edit.php D www/rfc/rfc-proposal-show.php D www/rfc/rfc-vote-show.php D www/rfc/rfc-votes-show.php

diff --git a/include/rfc/HTML_BBCodeParser_Filter_Extended.php b/include/rfc/HTML_BBCodeParser_Filter_Extended.php deleted file mode 100644 index 72fb378..0000000 --- a/include/rfc/HTML_BBCodeParser_Filter_Extended.php +++ /dev/null @@ -1,84 +0,0 @@ -<?php -/* vim: set expandtab tabstop=4 shiftwidth=4: */ -// +----------------------------------------------------------------------+ -// | PHP Version 4 | -// +----------------------------------------------------------------------+ -// | Copyright (c) 1997-2011 The PHP Group | -// +----------------------------------------------------------------------+ -// | This source file is subject to version 2.02 of the PHP license, | -// | that is bundled with this package in the file LICENSE, and is | -// | available at through the world-wide-web at | -// | http://www.php.net/license/2_02.txt. | -// | If you did not receive a copy of the PHP license and are unable to | -// | obtain it through the world-wide-web, please send a note to | -// | license@php.net so we can mail you a copy immediately. | -// +----------------------------------------------------------------------+ -// | Author: Tobias Schlitt <toby@php.net> | -// +----------------------------------------------------------------------+ -// -// $Id$ -// - -/** -* @package HTML_BBCodeParser -* @author Stijn de Reede <sjr@gmx.co.uk> -*/ - - -require_once('HTML/BBCodeParser.php'); - - - - -class HTML_BBCodeParser_Filter_Extended extends HTML_BBCodeParser -{ - - /** - * An array of tags parsed by the engine - * - * @access private - * @var array - */ - var $_definedTags = array( 'size' => array('htmlopen' => 'font', - 'htmlclose' => 'font', - 'allowed' => 'all', - 'attributes'=> array('size' =>'size=%2$s%1$s%2$s')), - 'color' => array('htmlopen' => 'font', - 'htmlclose' => 'font', - 'allowed' => 'all', - 'attributes'=> array('color' =>'color=%2$s%1$s%2$s')), - 'quote' => array('htmlopen' => 'q', - 'htmlclose' => 'q', - 'allowed' => 'all^img', - 'attributes'=> array('quote' =>'cite=%2$s%1$s%2$s')), - 'code' => array('htmlopen' => 'code', - 'htmlclose' => 'code', - 'allowed' => 'all^img'), - ); - - /** - * Executes statements before the actual array building starts - * - * This method should be overwritten in a filter if you want to do - * something before the parsing process starts. This can be useful to - * allow certain short alternative tags which then can be converted into - * proper tags with preg_replace() calls. - * The main class walks through all the filters and and calls this - * method if it exists. The filters should modify their private $_text - * variable. - * - * @return none - * @access private - * @see $_text - * @author Stijn de Reede <sjr@gmx.co.uk> - */ - - function _preparse() - { - $pattern = "/color=#([0-9a-fA-F])/i"; - $replace = "color=\\1"; - $this->_preparsed = preg_replace($pattern, $replace, $this->_text); - } -} - -?> \ No newline at end of file diff --git a/include/rfc/PACKAGES b/include/rfc/PACKAGES deleted file mode 100644 index 2da8698..0000000 --- a/include/rfc/PACKAGES +++ /dev/null @@ -1,24 +0,0 @@ -=== PEAR packages needed for the RFC system to work === - -DB -HTML_Common -HTML_QuickForm -Mail -HTML_BBCodeParser -Text_Wiki - -== Installation === - -pear install DB -pear install Mail -pear install HTML_Common -pear install HTML_QuickForm -pear install HTML_BBCodeParser -pear install -f Text_Wiki - -or all at ones (latest releases) - -pear install -f DB Mail HTML_Common HTML_QuickForm HTML_BBCodeParser Text_Wiki - - - diff --git a/include/rfc/rfc-config.php b/include/rfc/rfc-config.php deleted file mode 100644 index e872cf6..0000000 --- a/include/rfc/rfc-config.php +++ /dev/null @@ -1,94 +0,0 @@ -<?php -/* -+----------------------------------------------------------------------+ -| PHP Documentation Tools Site Source Code | -+----------------------------------------------------------------------+ -| Copyright (c) 1997-2011 The PHP Group | -+----------------------------------------------------------------------+ -| This source file is subject to version 3.0 of the PHP license, | -| that is bundled with this package in the file LICENSE, and is | -| available through the world-wide-web at the following url: | -| http://www.php.net/license/3_0.txt. | -| If you did not receive a copy of the PHP license and are unable to | -| obtain it through the world-wide-web, please send a note to | -| license@php.net so we can mail you a copy immediately. | -+----------------------------------------------------------------------+ -| Authors: Vincent Gevers <vincent@php.net> | -+----------------------------------------------------------------------+ -$Id$ -*/ - -/* - * This file contains the configuration - * for the RFC system - */ - -/** - * RFC: how long a proposal must be in the "proposal" phase before - * a "Call for Votes" can be called - */ -define('PROPOSAL_STATUS_PROPOSAL_TIMELINE', (60 * 60 * 24 * 4)); // 4 days - -/** - * RFC: how long the "Call for Votes" lasts - */ -define('PROPOSAL_STATUS_VOTE_TIMELINE', (60 * 60 * 24 * 4)); // 4 days - -if (isset($_SERVER['PROPOSAL_MAIL_DOC_DEV'])) { - /** - * @ignore - */ - define('PROPOSAL_MAIL_DOC_DEV', $_SERVER['PROPOSAL_MAIL_DOC_DEV']); -} else { - /** - * RFC: the address of the PEAR Developer email list - * - * Notices of changes will be sent to this address. - * - * To override default, set the value in $_SERVER['PROPOSAL_MAIL_PEAR_DEV'] - * before this file is included. - */ - define('PROPOSAL_MAIL_DOC_DEV', 'PHP Documentation <doc-web@lists.php.net>'); -} - -if (isset($_SERVER['PROPOSAL_MAIL_DOC_GROUP'])) { - /** - * @ignore - */ - define('PROPOSAL_MAIL_DOC_GROUP', $_SERVER['PROPOSAL_MAIL_DOC_GROUP']); -} else { - /** - * RFC: the address of the PEAR Group email list - * - * Notices of some changes get sent to this address. - * - * To override default, set the value in $_SERVER['PROPOSAL_MAIL_PEAR_GROUP'] - * before this file is included. - */ - define('PROPOSAL_MAIL_DOC_GROUP', 'Documentation Group <doc-web@lists.php.net>'); -} - -if (isset($_SERVER['PROPOSAL_MAIL_FROM'])) { - /** - * @ignore - */ - define('PROPOSAL_MAIL_FROM', $_SERVER['PROPOSAL_MAIL_FROM']); -} else { - /** - * RFC: the email address used as the From header - * - * To override default, set the value in $_SERVER['PROPOSAL_MAIL_FROM'] - * before this file is included. - */ - define('PROPOSAL_MAIL_FROM', 'RFC System <doc-web@lists.php.net>'); -} - -/** - * RFC: the string prepended to the subject lines of emails - */ -define('PROPOSAL_EMAIL_PREFIX', '[RFC]'); - -/** - * RFC: the string put on the end of each email - */ -define('PROPOSAL_EMAIL_POSTFIX', "\n\n-- \nSent by RFC, the automatic proposal system at https://doc.php.net"); diff --git a/include/rfc/rfc-cron.php b/include/rfc/rfc-cron.php deleted file mode 100644 index 76b1fe7..0000000 --- a/include/rfc/rfc-cron.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php - -/** - * Automated tasks for the package proposal system (PEPr). - * - * 1) Checks if a proposal should automatically be finished. - * - * NOTE: Proposal constants are defined in rfc-config.php. - * - * This source file is subject to version 3.0 of the PHP license, - * that is bundled with this package in the file LICENSE, and is - * available through the world-wide-web at the following URI: - * http://www.php.net/license/3_0.txt. - * If you did not receive a copy of the PHP license and are unable to - * obtain it through the world-wide-web, please send a note to - * license@php.net so we can mail you a copy immediately. - * - * @original PEPr pearweb - * @category docweb - * @package RFC - * @author Vincent Gevers <vincent@php.net> - * @author Tobias Schlitt <toby@php.net> - * @copyright Copyright (c) 1997-2011 The PHP Group - * @license http://www.php.net/license/3_0.txt PHP License - * @version $Id$ - */ - -/* - * This file needs to run every day - * the system expects it to run at 0 am - */ - -$inCli = true; -$path = realpath(dirname(__FILE__)); -require_once $path . '/../../include/rfc/rfc.php'; - -$proposals =& proposal::getAll($dbh, 'vote'); - - -// This checks if a proposal should automatically be finished - -foreach ($proposals AS $id => $proposal) { - if ($proposal->getStatus() == "vote") { - $lastVoteDate = ($proposal->longened_date > 0) ? $proposal->longened_date : $proposal->vote_date; - if (($lastVoteDate + PROPOSAL_STATUS_VOTE_TIMELINE) < time()) { - if (ppVote::getCount($dbh, $proposal->id) > 4) { - $proposals[$id]->status = 'finished'; - $proposal->sendActionEmail('change_status_finished', 'pearweb', null); - } else { - if ($proposal->longened_date > 0) { - $proposals[$id]->status = 'finished'; - $proposal->sendActionEmail('change_status_finished', 'pearweb', null); - } else { - $proposals[$id]->longened_date = time(); - $proposal->sendActionEmail('longened_timeline_sys', 'pearweb', null); - } - } - $proposals[$id]->getLinks($dbh); - $proposals[$id]->store($dbh); - } - } -} - -?> diff --git a/include/rfc/rfc-emails.php b/include/rfc/rfc-emails.php deleted file mode 100644 index d408b9f..0000000 --- a/include/rfc/rfc-emails.php +++ /dev/null @@ -1,114 +0,0 @@ -<?php - -/* - +----------------------------------------------------------------------+ - | PEAR Web site version 1.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 2001-2011 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Vincent Gevers <vincent@php.net> | - | Tobias Schlitt <toby@php.net> | - +----------------------------------------------------------------------+ - $Id$ -*/ - -$proposalEmailTexts = array( - - // $proposal->sendActionEmail("proposal_delete", $_COOKIE["PEAR_USER"], $proposal); - 'proposal_delete' => array( - 'to' => array ( - 'admin' => '{email_pear_dev}, {email_pear_group}, {owner_name} {owner_email}', - 'user' => '{email_pear_dev}, {owner_name} {owner_email}' - ), - 'subject' => '{pkg_category}::{pkg_name} deleted', - 'text' => "{actor_name} ({actor_link}) has deleted the proposal for {pkg_category}::{pkg_name}.\n\nThe reason for that is:\n\n{comment}" - ), - - // $proposal->sendActionEmail("change_status_proposal", $_COOKIE["PEAR_USER"], $proposal); - 'change_status_proposal' => array( - 'to' => array ( - 'admin' => '{email_pear_dev}, {email_pear_group}, {owner_name} {owner_email}', - 'user' => '{email_pear_dev}, {owner_name} {owner_email}' - ), - 'subject' => 'Proposal for {pkg_category}::{pkg_name}', - 'text' => "{actor_name} ({actor_link}) proposes {pkg_category}::{pkg_name}.\n\nYou can find more detailed information here:\n {proposal_url}" - ), - - // $proposal->sendActionEmail("change_status_vote", $_COOKIE["PEAR_USER"], $proposal); - 'change_status_vote' => array( - 'to' => array ( - 'admin' => '{email_pear_dev}, {email_pear_group}, {owner_name} {owner_email}', - 'user' => '{email_pear_dev}, {owner_name} {owner_email}' - ), - 'subject' => 'Call for votes on {pkg_category}::{pkg_name}', - 'text' => "{actor_name} ({actor_link}) has initiated the call for votes on {pkg_category}::{pkg_name}.\n\nPlease review the proposal and give your vote here:\n{proposal_url}" - ), - - // $proposal->sendActionEmail("longened_timeline_sys", $_COOKIE["PEAR_USER"], $proposal); - 'longened_timeline_sys' => array( - 'to' => array ( - 'pearweb' => '{email_pear_dev}, {email_pear_group}, {owner_name} {owner_email}' - ), - 'subject' => 'Extended call for votes on {pkg_category}::{pkg_name}', - 'text' => "RFC has automatically extended the voting time on {pkg_category}::{pkg_name} until {end_voting_time} because there were not enough votes, yet.\n\nPlease review the proposal and give your vote here:\n{proposal_url}\n\nVoting time is extended only once per proposal." - ), - - // $proposal->sendActionEmail("longened_timeline_admin", $_COOKIE["PEAR_USER"], $proposal); - 'longened_timeline_admin' => array( - 'to' => array ( - 'admin' => '{email_pear_dev}, {email_pear_group}, {owner_name} {owner_email}' - ), - 'subject' => 'Extended call for votes on {pkg_category}::{pkg_name}', - 'text' => "{actor_name} ({actor_link}) has extended the voting time on {pkg_category}::{pkg_name} until {end_voting_time}.\n\nPlease review the proposal and give your vote here:\n{proposal_url}" - ), - - // $proposal->sendActionEmail("change_status_finished", $_COOKIE["PEAR_USER"], $proposal); - 'change_status_finished' => array( - 'to' => array ( - 'pearweb' => '{email_pear_dev}, {email_pear_group}, {owner_name} {owner_email}', - 'user' => '{email_pear_dev}, {owner_name} {owner_email}' - ), - 'subject' => 'Proposal finished {pkg_category}::{pkg_name}', - 'text' => "RFC has automatically finished the proposal on {pkg_category}::{pkg_name}.\n\n{vote_result}\n\nFurther details on the status of the proposal and the votes can be found here:\n{proposal_url}" - ), - - // $proposal->sendActionEmail("edit_proposal", $_COOKIE["PEAR_USER"], $proposal); - 'edit_proposal' => array( - 'to' => array ( - 'admin' => '{email_pear_dev}, {email_pear_group}, {owner_name} {owner_email}', - 'user' => '{email_pear_dev}, {owner_name} {owner_email}' - ), - 'subject' => 'Changes in proposal for {pkg_category}::{pkg_name}', - 'text' => "{actor_name} ({actor_link}) has edited the proposal for {pkg_category}::{pkg_name}.\n\nChange comment:\n\n{comment}\n\nPlease review the proposal:\n{proposal_url}" - ), - - // $proposal->sendActionEmail("proposal_vote", $_COOKIE["PEAR_USER"], $proposal); - 'proposal_vote' => array( - 'to' => array ( - 'user' => '{email_pear_dev}, {actor_name} <{actor_email}>, {owner_name} {owner_email}', - 'admin' => '{email_pear_dev}, {actor_name} <{actor_email}>, {owner_name} {owner_email}' - ), - 'subject' => '{vote_value} for {pkg_category}::{pkg_name}', - 'text' => "{actor_name} ({actor_link}) has voted {vote_value} on the proposal for {pkg_category}::{pkg_name}.\n\nProposal information:\n{proposal_url}\nVote information:\n{vote_url}{vote_conditional}{comment}" - ), - - // $proposal->sendActionEmail("proposal_vote", $_COOKIE["PEAR_USER"], $proposal); - 'proposal_comment' => array( - 'to' => array ( - 'user' => '{email_pear_dev}, {actor_name} <{actor_email}>, {owner_name} {owner_email}', - 'admin' => '{email_pear_dev}, {actor_name} <{actor_email}>, {owner_name} {owner_email}' - ), - 'subject' => 'Comment on {pkg_category}::{pkg_name}', - 'text' => "{actor_name} ({actor_link}) has commented on the proposal for {pkg_category}::{pkg_name}.\n\nComment:\n\n{comment}\n\nProposal information:\n{proposal_url}" - ), -); - -?> diff --git a/include/rfc/rfc.php b/include/rfc/rfc.php deleted file mode 100644 index ca1e609..0000000 --- a/include/rfc/rfc.php +++ /dev/null @@ -1,1165 +0,0 @@ -<?php - -/** - * Establishes the procedures, objects and variables used throughout PEPr. - * - * The <var>$proposalStatiMap</var> and <var>$proposalTypeMap</var> arrays - * are also defined here. - * - * NOTE: Proposal constants are defined in rfc-config.php. - * - * This source file is subject to version 3.0 of the PHP license, - * that is bundled with this package in the file LICENSE, and is - * available through the world-wide-web at the following URI: - * http://www.php.net/license/3_0.txt. - * If you did not receive a copy of the PHP license and are unable to - * obtain it through the world-wide-web, please send a note to - * license@php.net so we can mail you a copy immediately. - * - * @original PEPr pearweb - * @category docweb - * @package RFC - * @author Vincent Gevers <vincent@php.net> - * @author Tobias Schlitt <toby@php.net> - * @author Daniel Convissor <danielc@php.net> - * @copyright Copyright (c) 1997-2011 The PHP Group - * @license http://www.php.net/license/3_0.txt PHP License - * @version $Id$ - */ - -$path = realpath(dirname(__FILE__)); - -require_once 'DB.php'; -require_once 'DB/storage.php'; -require_once $path . '/rfc-config.php'; -require_once $path . '/../init.inc.php'; - - -$docwebUser = $user; -if (!$docwebUser) { - unset($docwebUser); -} - -define('PEAR_DATABASE_DSN', 'sqlite:///'.$path.'/../../sqlite/rfc.sqlite'); - -if (isset($_SERVER['DEVBOX']) && $_SERVER['DEVBOX'] == true) { - define('DEVBOX', true); -} else { - define('DEVBOX', false); -} - -if (empty($dbh)) { - $options = array( - 'persistent' => false, - 'portability' => DB_PORTABILITY_ALL - ); - $dbh =& DB::connect(PEAR_DATABASE_DSN, $options); -} - - -PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'error_handler'); - - -// HACK(S) -// these can be added in lib_general.inc.php -// but they are only used here. replace the function with html -// can be always be done - -function make_utc_date($ts = null, $format = 'Y-m-d H:i \U\T\C') -{ - if (!$ts) { - $ts = time(); - } - - return gmdate($format, $ts); -} - - -/** - * Returns a hyperlink to something - */ -function make_link($url, $linktext = '', $target = '', $extras = '') -{ - - return sprintf('<a href="%s"%s%s>%s</a>', - $url, - ($target ? ' target="'.$target.'"' : ''), - ($extras ? ' '.$extras : ''), - ($linktext != '' ? $linktext : $url) - ); -} - -# print_link - -/** -* Echos a hyperlink to something -*/ - -function print_link($url, $linktext = '', $target = '', $extras = '') -{ -echo make_link($url, $linktext, $target, $extras); -} - -function make_mailto_link($email, $linktext = '', $extras = '') -{ - $tmp = ''; - for ($i = 0, $l = strlen($email); $i<$l; $i++) { - if ($i % 2) { - $tmp .= '&#' . ord($email[$i]) . ';'; - } else { - $tmp .= '&#x' . dechex(ord($email[$i])) . ';'; - } - } - - return '<a ' . $extras . ' href="&#x6d;&#97;&#x69;&#108;&#x74;&#111;&#x3a;' - . $tmp . '">' . ($linktext != '' ? $linktext : $tmp) . '</a>'; -} - - - - -/** - * Prints a tabbed navigation bar based on the parameter $items - */ -function print_tabbed_navigation($items, $no_active = false) -{ - $page = basename($_SERVER['PHP_SELF']); - - echo '<div id="nav">' . "\n"; - foreach ($items as $title => $item) { - echo '<a href="' . $item['url'] - . '" title="' . $item['title'] . '"'; - if (strpos($item['url'], $page) !== false && $no_active == false) { - echo ' class="active"'; - } - echo ' >' . $title . "</a>\n"; - } - echo '</div>'; -} - - -function report_success($in) -{ - echo '<div class="success">'; - echo htmlspecialchars($in); - echo "</div>\n"; -} - -/** - * Display errors or warnings as a <ul> inside a <div> - * - * Here's what happens depending on $in: - * + string: value is printed - * + array: looped through and each value is printed. - * If array is empty, nothing is displayed. - * If a value contains a PEAR_Error object, - * + PEAR_Error: prints the value of getMessage() and getUserInfo() - * if DEVBOX is true, otherwise prints data from getMessage(). - * - * @param string|array|PEAR_Error $in see long description - * @param string $class name of the HTML class for the <div> tag. - * ("errors", "warnings") - * @param string $head string to be put above the message - * - * @return bool true if errors were submitted, false if not - */ - -function report_error($in, $class = 'errors', $head = 'ERROR:') -{ - if (PEAR::isError($in)) { - if (DEVBOX == true) { - $in = array($in->getMessage() . '... ' . $in->getUserInfo()); - } else { - $in = array($in->getMessage()); - } - } elseif (!is_array($in)) { - $in = array($in); - } elseif (!count($in)) { - return false; - } - - echo '<div class="' . $class . '">' . $head . '<ul>'; - foreach ($in as $msg) { - if (PEAR::isError($msg)) { - if (DEVBOX == true) { - $msg = $msg->getMessage() . '... ' . $msg->getUserInfo(); - } else { - $msg = $msg->getMessage(); - } - } - echo '<li>' . htmlspecialchars($msg) . "</li>\n"; - } - - if (DEVBOX == true) { - var_dump($in); - } - - echo "</ul></div>\n"; - return true; -} - -/** - * Forwards warnings to report_error() - * - * For use with PEAR_ERROR_CALLBACK to get messages to be formatted - * as warnings rather than errors. - * - * @param string|array|PEAR_Error $in see report_error() for more info - * - * @return bool true if errors were submitted, false if not - * - * @see report_error() - */ -function report_warning($in) -{ - return report_error($in, 'warnings', 'WARNING:'); -} - -/** - * Generates a complete PEAR web page with an error message in it then - * calls exit - * - * For use with PEAR_ERROR_CALLBACK error handling mode to print fatal - * errors and die. - * - * @param string|array|PEAR_Error $in see report_error() for more info - * @param string $title string to be put above the message - * - * @return void - * - * @see report_error() - */ -function error_handler($errobj, $title = 'Error') -{ - if(!defined('IN_HEAD')) { - echo site_header($title); - } - report_error($errobj); - echo site_footer(); - exit; -} - - - - -/** - * Load necessary classes. - */ - -require_once 'HTML/QuickForm.php'; -require_once 'Mail.php'; - -/** - * Prints the navigation tabs - * - * @param object $proposal the current proposal object - * - * @return void - */ -function display_pepr_nav(&$proposal) -{ - global $docwebUser; - if ($proposal == null) { - $id = 0; - } else { - $id = $proposal->id; - } - - $items = array( - 'Main' => array('url' => 'rfc-proposal-show.php?id=' . $id, - 'title' => 'View proposal details' - ), - ); - - if ($proposal->status != 'draft') { - $items['Comments'] = array( - 'url' => 'rfc-comments-show.php?id=' . $id, - 'title' => 'View and/or enter comments' - ); - - if ($proposal->status != 'proposal') { - $items['Votes'] = array( - 'url' => 'rfc-votes-show.php?id=' . $id, - 'title' => 'View and/or enter votes' - ); - } - } - - if ($proposal != null && - isset($docwebUser) && - $proposal->mayEdit($docwebUser)) - { - $items['Edit'] = array( - 'url' => 'rfc-proposal-edit.php?id=' . $id, - 'title' => 'Edit this proposal' - ); - $items['Delete'] = array( - 'url' => 'rfc-proposal-delete.php?id=' . $id, - 'title' => 'Delete this proposal' - ); - } - - print_tabbed_navigation($items); -} - -function display_overview_nav () -{ - global $proposalStatiMap; - $items = array( - 'All' => array('url' => 'rfc-overview.php', - 'title' => 'All' - ) - ); - foreach ($proposalStatiMap as $status => $name) { - $items[$name] = array('url' => 'rfc-overview.php?filter='.$status, - 'title' => $name - ); - } - - print_tabbed_navigation($items, true); -} - -function shorten_string($string) -{ - if (strlen($string) < 80) { - return $string; - } - $string_new = substr($string, 0, 20); - $string_new .= "..." . substr($string, (strlen($string) - 60)); - return $string_new; -} - - -global $proposalStatiMap; -$proposalStatiMap = array( - 'draft' => 'Draft', - 'proposal' => 'Proposed', - 'vote' => 'Called for Votes', - 'finished' => 'Finished' - ); - - -class proposal { - - var $id; - - var $pkg_category; - - var $pkg_name; - - var $pkg_license; - - var $pkg_describtion; - - var $pkg_deps; - - var $draft_date; - - var $proposal_date; - - var $vote_date; - - var $longened_date; - - var $status = 'draft'; - - var $user_handle; - - var $links; - - var $votes; - - var $markup; - - function proposal($dbhResArr) - { - $this->fromArray($dbhResArr); - } - - function fromArray($dbhResArr) - { - if (!is_array($dbhResArr)) { - return false; - } - foreach ($dbhResArr as $name => $value) { - $this->$name = $value; - } - return true; - } - - /** - * Look up proposal information based on the proposal ID number - * - * @param object $dbh the current DB object - * @param int $id the ID number of the proposal being looked for - * - * @return object a new proposal object. false if the $id provided is - * not numeric. null if the $id doesn't refer to - * an actual proposal. - * - * @access public - */ - function &get(&$dbh, $id) - { - if (!is_numeric($id)) { - $res = false; - return $res; - } - $id = (int)$id; - $sql = "SELECT * FROM package_proposals WHERE id = ".$id; - $res =& $dbh->getRow($sql, null, DB_FETCHMODE_ASSOC); - - if (DB::isError($res)) { - return false; - } - if (!$res) { - return $res; - } - $t = new proposal($res); - return $t; - } - - function &getAll(&$dbh, $status = null, $limit = null, $order= null) - { - $sql = "SELECT * FROM package_proposals"; - if (!empty($status)) { - $sql .= " WHERE status = '".$status."'"; - } - if (!isset($order)) { - $sql .= " ORDER BY status ASC, draft_date DESC"; - } else { - $sql .= " ORDER BY ".$order; - } - if (!empty($limit)) { - $sql .= " LIMIT $limit"; - } - $res = $dbh->query($sql); - if (DB::isError($res)) { - return $res; - } - $result = array(); - while ($set = $res->fetchRow(DB_FETCHMODE_ASSOC)) { - $result[$set['id']] = new proposal($set); - } - return $result; - } - - function getLinks(&$dbh) - { - if (empty($this->id)) { - return PEAR::raiseError("Not initialized"); - } - $this->links = & ppLink::getAll($dbh, $this->id); - return true; - } - - function getVotes(&$dbh) - { - if (empty($this->id)) { - return PEAR::raiseError("Not initialized"); - } - $this->votes = & ppVote::getAll($dbh, $this->id); - return true; - } - - function store($dbh) - { - if (isset($this->id)) { - $sql = "UPDATE package_proposals SET - pkg_category = ".$dbh->quoteSmart($this->pkg_category).", - pkg_name = ".$dbh->quoteSmart($this->pkg_name).", - pkg_describtion = ".$dbh->quoteSmart($this->pkg_describtion).", - pkg_filehash = ".$dbh->quoteSmart($this->pkg_filehash).", - draft_date = ".$dbh->quoteSmart($this->draft_date).", - proposal_date = ".$dbh->quoteSmart($this->proposal_date).", - vote_date = ".$dbh->quotesmart($this->vote_date).", - longened_date = ".$dbh->quoteSmart($this->longened_date).", - status = ".$dbh->quoteSmart($this->status).", - user_handle = ".$dbh->quoteSmart($this->user_handle).", - markup = ".$dbh->quoteSmart($this->markup)." - WHERE id = ".$this->id; - $dbh->pushErrorHandling(PEAR_ERROR_RETURN); - $res =& $dbh->query($sql); - $dbh->popErrorHandling(); - if (DB::isError($res)) { - if ($res->getCode() == DB_ERROR_CONSTRAINT) { - return PEAR::raiseError('A proposal with that Catetory -' - . ' Name combination already exists.', - $res->getCode(), null, null, $res->getUserInfo()); - } else { - return PEAR::raiseError($res->getMessage(), - $res->getCode(), null, null, - $res->getUserInfo()); - } - } - } else { - - if (empty($this->pkg_filehash)) { - $this->pkg_filehash = ''; - } - - $sql = "INSERT INTO package_proposals ( pkg_category, pkg_name, pkg_describtion, - pkg_filehash, draft_date, status, user_handle, markup) VALUES ( - ".$dbh->quoteSmart($this->pkg_category).", - ".$dbh->quoteSmart($this->pkg_name).", - ".$dbh->quoteSmart($this->pkg_describtion).", - ".$dbh->quoteSmart($this->pkg_filehash).", - ".time().", - ".$dbh->quoteSmart($this->status).", - ".$dbh->quoteSmart($this->user_handle).", - ".$dbh->quoteSmart($this->markup).")"; - $dbh->pushErrorHandling(PEAR_ERROR_RETURN); - $res =& $dbh->query($sql); - $dbh->popErrorHandling(); - if (DB::isError($res)) { - if ($res->getCode() == DB_ERROR_CONSTRAINT) { - return PEAR::raiseError('A proposal with that Catetory -' - . ' Name combination already exists.', - $res->getCode(), null, null, $res->getUserInfo()); - } else { - return PEAR::raiseError($res->getMessage(), - $res->getCode(), null, null, - $res->getUserInfo()); - } - } - $this->id = sqlite_last_insert_rowid($dbh->connection); - } - - if(isset($this->links) && $this->links !== null) { - ppLink::deleteAll($dbh, $this->id); - foreach ($this->links as $link) { - if (!empty($link->url)) { - $res = $link->store($dbh, $this->id); - if (DB::isError($res)) { - return $res; - } - } - } - } - if (!empty($this->comment)) { - $this->comment->store($dbh, $this->id); - unset($this->comment); - } - return true; - } - - function addVote($dbh, $vote) - { - if (!empty($this->votes[$vote->user_handle])) { - return PEAR::raiseError("You already voted!"); - } - $vote->pkg_propop_id = $this->id; - $this->votes[$vote->user_handle] =& $vote; - $vote->store($dbh, $this->id); - return true; - } - - function addComment($comment, $table = 'package_proposal_changelog') - { - global $docwebUser; - $commentData = array("pkg_prop_id" => $this->id, - "user_handle" => $docwebUser, - "comment" => $comment); - $comment = new ppComment( $commentData, $table ); - $comment->store($this->id); - return true; - } - - function addLink($dbh, $link) - { - $link->pkg_prop_id = $this->id; - $this->links[] =& $link; - return true; - } - - function isOwner($handle) - { - if (strtolower($this->user_handle) != strtolower($handle)) { - return false; - } - return true; - } - - function mayEdit($handle = '') - { - - switch ($this->status) { - case 'draft': - case 'proposal': - if ($this->isOwner($handle) || is_admin()) { - return true; - } - break; - default: - if (!$this->isOwner($handle) && is_admin()) { - return true; - } - break; - } - return false; - } - - /** - * Determine if the current user can vote on the current proposal - * - * Rules: - * + Proposal must be in the "Called for Votes" phase. - * + User must be logged in. - * + User must be a full-featured PEAR developer. - * + Only one vote can be cast. - * + Proposers can't vote on their own package. - * - * @param object $dbh the current DB object - * @param string $userHandle the user's handle - * - * @return bool - * - * @access public - */ - function mayVote(&$dbh, $userHandle) - { - - if ($this->getStatus() == 'vote' && - !ppVote::hasVoted($dbh, $userHandle, $this->id) && - !$this->isOwner($userHandle)) - { - return true; - } else { - return false; - } - } - - function getStatus($humanReadable = false) - { - if ($humanReadable) { - return $GLOBALS['proposalStatiMap'][$this->status]; - } - return $this->status; - } - - /** - * Answers the question "Is this proposal $operator than $status?" - * - * @param string $operator the operator (<, <=, ==, >=, >, !=) - * @param string $status the status ('draft', 'vote', 'finished', etc) - * - * @return bool - */ - function compareStatus($operator, $status) - { - $num = array( - 'draft' => 1, - 'proposal' => 2, - 'vote' => 3, - 'finished' => 4, - ); - switch ($operator) { - case '<': - return ($num[$this->status] < $num[$status]); - case '<=': - return ($num[$this->status] <= $num[$status]); - case '==': - return ($num[$this->status] == $num[$status]); - case '>=': - return ($num[$this->status] >= $num[$status]); - case '>': - return ($num[$this->status] > $num[$status]); - case '!=': - return ($num[$this->status] != $num[$status]); - default: - PEAR::raiseError('Invalid $operator passed to compareStatus()'); - } - } - - function isEditable() - { - switch ($this->status) { - case 'draft': - case 'proposal': return true; - } - return false; - } - - function checkTimeline() - { - switch ($this->status) { - case 'draft': - return true; - - case 'proposal': - if (($this->proposal_date + PROPOSAL_STATUS_PROPOSAL_TIMELINE) < - time()) - { - return true; - } - return (int)($this->proposal_date + PROPOSAL_STATUS_PROPOSAL_TIMELINE); - - case 'vote': - if (!empty($this->longened_date)) { - if (($this->longened_date + PROPOSAL_STATUS_VOTE_TIMELINE) > - time()) - { - return (int)($this->longened_date + PROPOSAL_STATUS_VOTE_TIMELINE); - } - } else { - if (($this->vote_date + PROPOSAL_STATUS_VOTE_TIMELINE) > - time()) - { - return (int)($this->vote_date + PROPOSAL_STATUS_VOTE_TIMELINE); - } - } - return false; - } - } - - function delete(&$dbh) - { - if (empty($this->id)) { - return PEAR::raiseError("Proposal does not exist!"); - } - - $sql = "DELETE FROM package_proposals WHERE id = ".$this->id; - $res = $dbh->query($sql); - if (DB::isError($res)) { - return $res; - } - $sql = "DELETE FROM package_proposal_votes WHERE pkg_prop_id = ".$this->id; - $res = $dbh->query($sql); - if (DB::isError($res)) { - return $res; - } - $sql = "DELETE FROM package_proposal_links WHERE pkg_prop_id = ".$this->id; - $res = $dbh->query($sql); - if (DB::isError($res)) { - return $res; - } - $sql = "DELETE FROM package_proposal_changelog WHERE pkg_prop_id = ".$this->id; - $res = $dbh->query($sql); - if (DB::isError($res)) { - return $res; - } - $sql = "DELETE FROM package_proposal_comments WHERE pkg_prop_id = ".$this->id; - $res = $dbh->query($sql); - if (DB::isError($res)) { - return $res; - } - return true; - } - - function sendActionEmail($event, $userType, $user_handle = null, $comment = '') - { // !!! - global $dbh; - - $master_url = 'https://doc.php.net/'; - require dirname(__FILE__) . '/rfc-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 (is_admin() && ($this->user_handle != $user_handle)) { - $prefix = "[ADMIN]"; - } else { - $prefix = ""; - } - break; - default: - $prefix = ""; - } - $prefix = PROPOSAL_EMAIL_PREFIX . $prefix . " "; - $actorinfo = array('name' => user_name($user_handle), - 'email' => $user_handle.'@php.net', 'handle' => $user_handle); // !!! - $ownerinfo = array('name' => user_name($this->user_handle), - 'email' => $this->user_handle.'@php.net', 'handle' => $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 = $master_url . "rfc/rfc-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 = $master_url . "rfc/rfc-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 (!isset($user_handle)) { - $email['to'] = $email['to']['pearweb']; - } else if (is_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'])) ? make_link($ownerinfo['handle']) : "", - (isset($actorinfo['name'])) ? $actorinfo['name'] : "", - (isset($actorinfo['email'])) ? $actorinfo['email'] : "", - (isset($actorinfo['handle'])) ? $master_url . "user/".$actorinfo['handle'] : "", - $proposal_url, - make_utc_date($end_voting_time), - (isset($vote)) ? $vote->value : 0, - (isset($vote)) ? $vote_url : "", - PROPOSAL_MAIL_DOC_DEV, - PROPOSAL_MAIL_DOC_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)) { - // $from = '"' . $auth->name . '" <' . $auth->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: " . "RFC, Docweb Proposal System <https://doc.php.net/>" . "\n"; - $headers .= "X-RFC-Category: " . $this->pkg_category . "\n"; - $headers .= "X-RFC-Name: " . $this->pkg_name . "\n"; - $headers .= "X-RFC-Status: " . $this->getStatus() . "\n"; - - if ($event == "change_status_proposal") { - $headers .= "Message-ID: <proposal-" . $this->id . "@doc.php.net>\n"; - } else { - $headers .= "In-Reply-To: <proposal-" . $this->id . "@doc.php.net>\n"; - } - - if (DEVBOX == false) { - $res = mail($email['to'], $email['subject'], $email['text'], - $headers, '-f doc-web@lists.php.net'); // !!! - } else { - $res = true; // fake that everything is ok - } - - - - if (!$res) { - return PEAR::raiseError('Could not send notification email.'); - } - return true; - } -} - - - -class ppComment { - - var $pkg_prop_id; - - var $user_handle; - - var $timestamp; - - var $comment; - - var $table; - - function ppComment($dbhResArr, $table = 'package_proposal_changelog') - { - foreach ($dbhResArr as $name => $value) { - $this->$name = $value; - } - $this->table = $table; - } - - function get($proposalId, $handle, $timestamp, - $table = 'package_proposal_changelog') - { - global $dbh; - $sql = "SELECT *, timestamp FROM ".$table." WHERE pkg_prop_id = ".$proposalId." - AND user_handle='".$handle."' AND timestamp = ".$timestamp; - $res = $dbh->query($sql); - if (DB::isError($res)) { - return $res; - } - $set = $res->fetchRow(DB_FETCHMODE_ASSOC); - $comment = new ppComment($set); - return $comment; - } - - function &getAll($proposalId, $table = 'package_proposal_changelog') - { - global $dbh; - $sql = "SELECT *, timestamp FROM ".$table." WHERE pkg_prop_id = ".$proposalId." ORDER BY timestamp DESC"; - $res = $dbh->query($sql); - if (DB::isError($res)) { - return $res; - } - $comments = array(); - while ($set = $res->fetchRow(DB_FETCHMODE_ASSOC)) { - $comments[] = new ppVote($set); - } - return $comments; - } - - function store($proposalId) - { - global $dbh; - if (empty($this->user_handle)) { - return PEAR::raiseError("Not initialized"); - } - $sql = "INSERT INTO ".$this->table." (pkg_prop_id, user_handle, comment, timestamp) - VALUES (".$proposalId.", ".$dbh->quoteSmart($this->user_handle).", - ".$dbh->quoteSmart($this->comment).", ".time().")"; - $res = $dbh->query($sql); - return $res; - } - - function delete() - { - global $dbh; - if (empty($this->table) || empty($this->user_handle) || empty($this->pkg_prop_id) || empty($this->timestamp)) { - return PEAR::raiseError("Inconsistant comment data. Can not delete comment."); - } - $sql = "DELETE FROM ".$this->table." WHERE user_handle = '".$this->user_handle."' - AND pkg_prop_id = ".$this->pkg_prop_id." AND timestamp = ".$this->timestamp; - $res = $dbh->query($sql); - return true; - } -} // end class ppComment - -global $proposalReviewsMap; -$proposalReviewsMap = array( - 'cursory' => 'Cursory source review', - 'deep' => 'Deep source review', - 'test' => 'Tested'); - -class ppVote { - - var $pkg_prop_id; - - var $user_handle; - - var $value; - - var $reviews; - - var $is_conditional; - - var $comment; - - var $timestamp; - - function ppVote($dbhResArr) - { - foreach ($dbhResArr as $name => $value) { - $this->$name = $value; - } - } - - function get(&$dbh, $proposalId, $handle) - { - $sql = "SELECT *, timestamp FROM package_proposal_votes WHERE - pkg_prop_id = ".$proposalId." AND user_handle='".$handle."'"; - $res = $dbh->query($sql); - if (DB::isError($res)) { - return $res; - } - if (!$res->numRows()) { - return null; - } - $set = $res->fetchRow(DB_FETCHMODE_ASSOC); - $set['reviews'] = unserialize($set['reviews']); - $vote = new ppVote($set); - return $vote; - } - - function &getAll(&$dbh, $proposalId) - { - $sql = "SELECT *, timestamp FROM package_proposal_votes WHERE - pkg_prop_id = ".$proposalId." ORDER BY timestamp ASC"; - $res = $dbh->query($sql); - if (DB::isError($res)) { - return $res; - } - $votes = array(); - while ($set = $res->fetchRow(DB_FETCHMODE_ASSOC)) { - $set['reviews'] = unserialize($set['reviews']); - $votes[$set['user_handle']] = new ppVote($set); - } - return $votes; - } - - function store($dbh, $proposalId) - { - if (empty($this->user_handle)) { - return PEAR::raiseError("Not initialized"); - } - - if (empty($this->comment)) { - $this->comment = '-'; - } - - $sql = "INSERT INTO package_proposal_votes (pkg_prop_id, user_handle, value, is_conditional, comment, reviews, timestamp) - VALUES (".$proposalId.", - ".$dbh->quoteSmart($this->user_handle).", - ".$this->value.", ".(int)$this->is_conditional.", - ".$dbh->quoteSmart($this->comment).", - ".$dbh->quoteSmart(serialize($this->reviews)).", - ".time().")"; - $res = $dbh->query($sql); - return $res; - } - - function getReviews($humanReadable = false) - { - if ($humanReadable) { - foreach ($this->reviews as $review) { - $res[] = $GLOBALS['proposalReviewsMap'][$review]; - } - return $res; - } - return $this->reviews; - } - - function getSum($dbh, $proposalId) - { - $sql = "SELECT SUM(value) FROM package_proposal_votes WHERE - pkg_prop_id = ".$proposalId." GROUP BY pkg_prop_id"; - $result = $dbh->getOne($sql); - $res['all'] = (is_numeric($result)) ? $result : 0; - $sql = "SELECT SUM(value) FROM package_proposal_votes WHERE - pkg_prop_id = ".$proposalId." AND is_conditional = 1 GROUP BY pkg_prop_id"; - $result = $dbh->getOne($sql); - $res['conditional'] = (is_numeric($result)) ? $result : 0; - return $res; - } - - function getCount($dbh, $proposalId) - { - $sql = "SELECT COUNT(user_handle) FROM package_proposal_votes WHERE - pkg_prop_id = ".$proposalId." GROUP BY pkg_prop_id"; - $res = $dbh->getOne($sql); - return (!empty($res)) ? $res: " 0"; - } - - function hasVoted($dbh, $userHandle, $proposalId) - { - $sql = "SELECT count(pkg_prop_id) as votecount FROM package_proposal_votes - WHERE pkg_prop_id = ".$proposalId." AND user_handle = '".$userHandle."' - GROUP BY pkg_prop_id"; - $votes = $dbh->query($sql); - return (bool)($votes->numRows()); - } - -} - -global $proposalTypeMap; -$proposalTypeMap = array( - 'pkg_patch' => "Patch (.diff/.txt)", - 'pkg_source' => "Source file (.phps/.htm)", - 'pkg_example' => "Example (.php)", - 'pkg_example_source' => "Example source (.phps/.htm)", - 'pkg_doc' => "Documentation", - 'pkg_site' => "Website", - 'pkg_lists' => "Mailing list archive"); - -class ppLink { - - var $pkg_prop_id; - - var $type; - - var $url; - - function ppLink($dbhResArr) - { - foreach ($dbhResArr as $name => $value) { - $this->$name = $value; - } - } - - function &getAll(&$dbh, $proposalId) - { - $sql = "SELECT * FROM package_proposal_links WHERE pkg_prop_id = ".$proposalId." ORDER BY type"; - $res = $dbh->query($sql); - if (DB::isError($res)) { - return $res; - } - $links = array(); - while ($set = $res->fetchRow(DB_FETCHMODE_ASSOC)) { - $links[] = new ppLink($set); - } - return $links; - } - - function deleteAll($dbh, $proposalId) - { - $sql = "DELETE FROM package_proposal_links WHERE pkg_prop_id = ".$proposalId; - $res = $dbh->query($sql); - return $res; - } - - function store($dbh, $proposalId) - { - $sql = "INSERT INTO package_proposal_links (pkg_prop_id, type, url) - VALUES (".$proposalId.", ".$dbh->quoteSmart($this->type).", ".$dbh->quoteSmart($this->url).")"; - $res = $dbh->query($sql); - return $res; - } - - function getType($humanReadable = false) - { - if ($humanReadable) { - return $GLOBALS['proposalTypeMap'][$this->type]; - } - return $this->type; - } -} - - -?> diff --git a/scripts/setup_rfc_database.php b/scripts/setup_rfc_database.php deleted file mode 100755 index 36c3539..0000000 --- a/scripts/setup_rfc_database.php +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/local/bin/php -<?php -/** - * +----------------------------------------------------------------------+ - * | PHP Documentation Site Source Code | - * +----------------------------------------------------------------------+ - * | Copyright (c) 1997-2011 The PHP Group | - * +----------------------------------------------------------------------+ - * | This source file is subject to version 3.0 of the PHP license, | - * | that is bundled with this package in the file LICENSE, and is | - * | available at through the world-wide-web at | - * | http://www.php.net/license/3_0.txt. | - * | If you did not receive a copy of the PHP license and are unable to | - * | obtain it through the world-wide-web, please send a note to | - * | license@php.net so we can mail you a copy immediately. | - * +----------------------------------------------------------------------+ - * | Authors: Jacques Marneweck <jacques@php.net> | - * +----------------------------------------------------------------------+ - * - * $Id$ - */ - -$PWD = dirname(__FILE__) . "/"; -$idx = sqlite_open("$PWD../sqlite/rfc.sqlite", 0666); -if (!$idx) { - die("could not open $PWD../sqlite/rfc.sqlite"); -} -sqlite_query($idx, file_get_contents("$PWD../sql/rfc.sql")); -sqlite_close($idx); - -/* vim: set noet ts=4 sw=4 ft=php: : */ diff --git a/sql/rfc.sql b/sql/rfc.sql deleted file mode 100644 index c28fc89..0000000 --- a/sql/rfc.sql +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Tables for the RFC system - * Original PEPr sql can be found at pearweb/sql/pepr.sql - * - * This is for a SQLite database, only edit if you - * know what SQLite doesn't support - */ - -CREATE TABLE package_proposal_changelog ( - pkg_prop_id int(11) NOT NULL default '0', - timestamp int(14) NOT NULL default '0', - user_handle varchar(20) NOT NULL default '', - comment text, - PRIMARY KEY (pkg_prop_id,timestamp,user_handle) -); - -CREATE TABLE package_proposal_comments ( - user_handle varchar(20) NOT NULL default '', - pkg_prop_id int(11) NOT NULL default '0', - timestamp int(14) NOT NULL default '0', - comment text NOT NULL, - PRIMARY KEY (user_handle,pkg_prop_id,timestamp) -); - -CREATE TABLE package_proposal_links ( - pkg_prop_id int(11) NOT NULL default '0', - type varchar(225) NOT NULL default 'pkg_file', - url varchar(255) NOT NULL default '' -); - -CREATE TABLE package_proposal_votes ( - pkg_prop_id int(11) NOT NULL default '0', - user_handle varchar(255) NOT NULL default '', - value tinyint(1) NOT NULL default '1', - reviews text NOT NULL, - is_conditional tinyint(1) NOT NULL default '0', - comment text NOT NULL, - timestamp timestamp(14) NOT NULL, - PRIMARY KEY (pkg_prop_id,user_handle) -); - -CREATE TABLE package_proposals ( - id INTEGER PRIMARY KEY, - pkg_category varchar(80) NOT NULL default '', - pkg_name varchar(80) NOT NULL default '' UNIQUE, - pkg_describtion text NOT NULL, - pkg_filehash text NOT NULL default '0', - draft_date timestamp(14) NOT NULL default '0', - proposal_date timestamp(14) NOT NULL default '0', - vote_date timestamp(14) NOT NULL default '0', - longened_date timestamp(14) NOT NULL default '0', - status varchar(200) NOT NULL default 'draft', - user_handle varchar(255) NOT NULL default '', - markup varchar(20) NOT NULL default 'bbcode' -); diff --git a/www/rfc/index.php b/www/rfc/index.php deleted file mode 100644 index d9287fe..0000000 --- a/www/rfc/index.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -/** - * Redirects hits from /rfc/ to /rfc/rfc-overview.php. - * - * This source file is subject to version 3.0 of the PHP license, - * that is bundled with this package in the file LICENSE, and is - * available through the world-wide-web at the following URI: - * http://www.php.net/license/3_0.txt. - * If you did not receive a copy of the PHP license and are unable to - * obtain it through the world-wide-web, please send a note to - * license@php.net so we can mail you a copy immediately. - * - * @original PEPr pearweb - * @category docweb - * @package RFC - * @author Vincent Gevers <vincent@php.net> - * @author Tobias Schlitt <toby@php.net> - * @author Daniel Convissor <danielc@php.net> - * @copyright Copyright (c) 1997-2011 The PHP Group - * @license http://www.php.net/license/3_0.txt PHP License - * @version $Id$ - */ - -header('Location: rfc-overview.php'); -?> diff --git a/www/rfc/rfc-bbcode-help.php b/www/rfc/rfc-bbcode-help.php deleted file mode 100644 index 930dcf0..0000000 --- a/www/rfc/rfc-bbcode-help.php +++ /dev/null @@ -1,146 +0,0 @@ -<?php - -$path = realpath(dirname(__FILE__)); -require_once $path . '/../../include/rfc/rfc.php'; -echo site_header('RFC :: BBCode Help'); - -?> - -<table width="100%" cellspacing="0" cellpadding="2" border="0"> - <tr> - <td class="bodyline" bgcolor="white"> - - <table width="100%" cellspacing="0" cellpadding="10" border="0"> - <tr> - <td> - -<table class="forumline" width="75%" cellspacing="1" cellpadding="3" border="0" align="left"> - <tr> - <th class="thHead"><h1>BBCode Guide</h1></th> - </tr> - <tr> - <td class="row1"> - <a name="Top"></a> - <span class="gen"><b>Introduction</b></span><br /> - <span class="gen"><a href="#0" class="postlink">What is BBCode?</a></span><br /> - <br /> - <span class="gen"><b>Text Formatting</b></span><br /> - <span class="gen"><a href="#1" class="postlink">How to create bold, italic and underlined text</a></span><br /> - <span class="gen"><a href="#2" class="postlink">How to change the text colour or size</a></span><br /> - <span class="gen"><a href="#3" class="postlink">Can I combine formatting tags?</a></span><br /> - <br /> - <span class="gen"><b>Quoting and outputting fixed-width text</b></span><br /> - <span class="gen"><a href="#4" class="postlink">Quoting text in replies</a></span><br /> - <span class="gen"><a href="#5" class="postlink">Outputting code or fixed width data</a></span><br /> - <br /> - <span class="gen"><b>Generating lists</b></span><br /> - <span class="gen"><a href="#6" class="postlink">Creating an Un-ordered list</a></span><br /> - <span class="gen"><a href="#7" class="postlink">Creating an Ordered list</a></span><br /> - <br /> - <span class="gen"><b>Creating Links</b></span><br /> - <span class="gen"><a href="#8" class="postlink">Linking to another site</a></span><br /> - <br /> - <span class="gen"><b>Showing images in posts</b></span><br /> - <span class="gen"><a href="#9" class="postlink">Adding an image to a post</a></span><br /> - <br /> - </td> - </tr> - <tr> - <td class="catBottom" height="28">&nbsp;</td> - </tr> -</table> - -<br clear="all" /> - -<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0" align="center"> - <tr> - <td class="row1" align="left" valign="top"><span class="postbody"><a name="0"></a><b>What is BBCode?</b></span><br /><span class="postbody">BBCode is a special implementation of HTML. Whether you can actually use BBCode in your posts on the forum is determined by the administrator. In addition, you can disable BBCode on a per post basis via the posting form. BBCode itself is similar in style to HTML: tags are enclosed in square braces [ and ] rather than &lt; and &gt; and it offers greater control over what and how something is displayed. Depending on the template you are using you may find adding BBCode to your posts is made much easier through a clickable interface above the message area on the posting form. Even with this you may find the following guide useful.<br /><a class="postlink" href="#Top">Back to top</a></span></td> - </tr> -</table> - -<br clear="all" /> -<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0" align="center"> - <tr> - <td class="row1" align="left" valign="top"><span class="postbody"><a name="1"></a><b>How to create bold, italic and underlined text</b></span><br /><span class="postbody">BBCode includes tags to allow you to quickly change the basic style of your text. This is achieved in the following ways: <ul><li>To make a piece of text bold enclose it in <b>[b][/b]</b>, eg. <br /><br /><b>[b]</b>Hello<b>[/b]</b><br /><br />will become <b>Hello</b></li><li>For underlining use <b>[u][/u]</b>, for example:<br /><br /><b>[u]</b>Good Morning<b>[/u]</b><br /><br />becomes <u>Good Morning</u></li><li>To italicise text use <b>[i][/i]</b>, eg.<br /><br />This is <b>[i]</b>Great!<b>[/i]</b><br /><br />would give This is <i>Great!</i></li></ul><br /><a class="postlink" href="#Top">Back to top</a></span></td> - </tr> - <tr> - <td class="row2" align="left" valign="top"><span class="postbody"><a name="2"></a><b>How to change the text colour or size</b></span><br /><span class="postbody">To alter the color or size of your text the following tags can be used. Keep in mind that how the output appears will depend on the viewers browser and system: <ul><li>Changing the colour of text is achieved by wrapping it in <b>[color=][/color]</b>. You can specify either a recognised colour name (eg. red, blue, yellow, etc.) or the hexadecimal triplet alternative, eg. #FFFFFF, #000000. For example, to create red text you could use:<br /><br /><b>[color=red]</b>Hello!<b>[/color]</b><br /><br />or<br /><br /><b>[color=#FF0000]</b>Hello!<b>[/color]</b><br /><br />will both output <span style="color:red">Hello!</span></li><li>Changing the text size is achieved in a similar way using <b>[size=][/size]</b>. This tag is dependent on the template you are using but the recommended format is a numerical value representing the text size in pixels, starting at 1 (so tiny you will not see it) through to 29 (very large). For example:<br /><br /><b>[size=9]</b>SMALL<b>[/size]</b><br /><br />will generally be <span style="font-size:9px">SMALL</span><br /><br />whereas:<br /><br /><b>[size=24]</b>HUGE!<b>[/size]</b><br /><br />will be <span style="font-size:24px">HUGE!</span></li></ul><br /><a class="postlink" href="#Top">Back to top</a></span></td> - </tr> - <tr> - <td class="row1" align="left" valign="top"><span class="postbody"><a name="3"></a><b>Can I combine formatting tags?</b></span><br /><span class="postbody">Yes, of course you can; for example to get someones attention you may write:<br /><br /><b>[size=18][color=red][b]</b>LOOK AT ME!<b>[/b][/color][/size]</b><br /><br />this would output <span style="color:red;font-size:18px"><b>LOOK AT ME!</b></span><br /><br />We don't recommend you output lots of text that looks like this, though! Remember that it is up to you, the poster, to ensure that tags are closed correctly. For example, the following is incorrect:<br /><br /><b>[b][u]</b>This is wrong<b>[/b][/u]</b><br /><a class="postlink" href="#Top">Back to top</a></span></td> - </tr> -</table> - -<br clear="all" /> -<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0" align="center"> - <tr> - <td class="row1" align="left" valign="top"><span class="postbody"><a name="4"></a><b>Quoting text in replies</b></span><br /><span class="postbody">There are two ways you can quote text: with a reference or without.<ul><li>When you utilise the Quote function to reply to a post on the board you should notice that the post text is added to the message window enclosed in a <b>[quote=""][/quote]</b> block. This method allows you to quote with a reference to a person or whatever else you choose to put. For example, to quote a piece of text Mr. Blobby wrote, you would enter:<br /><br /><b>[quote="Mr. Blobby"]</b>The text Mr. Blobby wrote would go here<b>[/quote]</b><br /><br />The resulting output will automatically add: Mr. Blobby wrote: before the actual text. Remember that you <b>must</b> include the quotation marks "" around the name you are quoting -- they are not optional.</li><li>The second method allows you to blindly quote something. To utilise this enclose the text in <b>[quote][/quote]</b> tags. When you view the message it will simply show: Quote: before the text itself.</li></ul><br /><a class="postlink" href="#Top">Back to top</a></span></td> - </tr> - <tr> - <td class="row2" align="left" valign="top"><span class="postbody"><a name="5"></a><b>Outputting code or fixed width data</b></span><br /><span class="postbody">If you want to output a piece of code or in fact anything that requires a fixed width with a Courier-type font, you should enclose the text in <b>[code][/code]</b> tags, eg.<br /><br /><b>[code]</b>echo "This is some code";<b>[/code]</b><br /><br />All formatting used within <b>[code][/code]</b> tags is retained when you later view it.<br /><a class="postlink" href="#Top">Back to top</a></span></td> - </tr> -</table> - -<br clear="all" /> -<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0" align="center"> - <tr> - <td class="row1" align="left" valign="top"><span class="postbody"><a name="6"></a><b>Creating an Un-ordered list</b></span><br /><span class="postbody">BBCode supports two types of lists, unordered and ordered. They are essentially the same as their HTML equivalents. An unordered list ouputs each item in your list sequentially one after the other indenting each with a bullet character. To create an unordered list you use <b>[list][/list]</b> and define each item within the list using <b>[*]</b>. For example, to list your favorite colours you could use:<br /><br /><b>[list]</b><br /><b>[*]</b>Red<br /><b>[*]</b>Blue<br /><b>[*]</b>Yellow<br /><b>[/list]</b><br /><br />This would generate the following list:<ul><li>Red</li><li>Blue</li><li>Yellow</li></ul><br /><a class="postlink" href="#Top">Back to top</a></span></td> - </tr> - <tr> - <td class="row2" align="left" valign="top"><span class="postbody"><a name="7"></a><b>Creating an Ordered list</b></span><br /><span class="postbody">The second type of list, an ordered list gives you control over what is output before each item. To create an ordered list you use <b>[list=1][/list]</b> to create a numbered list or alternatively <b>[list=a][/list]</b> for an alphabetical list. As with the unordered list items are specified using <b>[*]</b>. For example:<br /><br /><b>[list=1]</b><br /><b>[*]</b>Go to the shops<br /><b>[*]</b>Buy a new computer<br /><b>[*]</b>Swear at computer when it crashes<br /><b>[/list]</b><br /><br />will generate the following:<ol type="1"><li>Go to the shops</li><li>Buy a new computer</li><li>Swear at computer when it crashes</li></ol>Whereas for an alphabetical list you would use:<br /><br /><b>[list=a]</b><br /><b>[*]</b>The first possible answer<br /><b>[*]</b>The second possible answer<br /><b>[*]</b>The third possible answer<br /><b>[/list]</b><br /><br />giving<ol type="a"><li>The first possible answer</li><li>The second possible answer</li><li>The third possible answer</li></ol><br /><a class="postlink" href="#Top">Back to top</a></span></td> - </tr> -</table> - -<br clear="all" /> -<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0" align="center"> - <tr> - <td class="row1" align="left" valign="top"><span class="postbody"><a name="8"></a><b>Linking to another site</b></span><br /><span class="postbody">phpBB BBCode supports a number of ways of creating URIs, Uniform Resource Indicators better known as URLs.<ul><li>The first of these uses the <b>[url=][/url]</b> tag; whatever you type after the = sign will cause the contents of that tag to act as a URL. For example, to link to phpBB.com you could use:<br /><br /><b>[url=http://www.phpbb.com/]</b>Visit phpBB!<b>[/url]</b><br /><br />This would generate the following link, <a href="http://www.phpbb.com/" target="_blank">Visit phpBB!</a> You will notice the link opens in a new window so the user can continue browsing the forums if they wish.</li><li>If you want the URL itself displayed as the link you can do this by simply using:<br /><br /><b>[url]</b>http://www.phpbb.com/<b>[/url]</b><br /><br />This would generate the following link: <a href="http://www.phpbb.com/" target="_blank">http://www.phpbb.com/</a></li><li>Additionally phpBB features something called <i>Magic Links</i>which will turn any syntatically correct URL into a link without you needing to specify any tags or even the leading http://. For example typing www.phpbb.com into your message will automatically lead to <a href="http://www.phpbb.com/" target="_blank">www.phpbb.com</a> being output when you view the message.</li><li>The same thing applies equally to email addresses; you can either specify an address explicitly, like:<br /><br /><b>[email]</b>no.one@domain.adr<b>[/email]</b><br /><br />which will output <a href="emailto:no.one@domain.adr">no.one@domain.adr</a> or you can just type no.one@domain.adr into your message and it will be automatically converted when you view.</li></ul>As with all the BBCode tags you can wrap URLs around any of the other tags such as <b>[img][/img]</b> (see next entry), <b>[b][/b]</b>, etc. As with the formatting tags it is up to you to ensure the correct open and close order is following. For example:<br /><br /><b>[url=https://doc.php.net/][img]</b>https://doc.php.net/images/php.gif<b>[/url][/img]</b><br /><br />is <u>not</u> correct which may lead to your post being deleted so take care.<br /><a class="postlink" href="#Top">Back to top</a></span></td> - </tr> -</table> - -<br clear="all" /> -<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0" align="center"> - <tr> - <td class="row1" align="left" valign="top"><span class="postbody"><a name="9"></a><b>Adding an image to a post</b></span><br /><span class="postbody">phpBB BBCode incorporates a tag for including images in your posts. Two very important things to remember when using this tag are: many users do not appreciate lots of images being shown in posts and second, the image you display must already be available on the Internet (it cannot exist only on your computer, for example, unless you run a webserver!). There is currently no way of storing images locally with phpBB (all these issues are expected to be addressed in the next release of phpBB). To display an image, you must surround the URL pointing to the image with <b>[img][/img]</b> tags. For example:<br /><br /><b>[img]</b>https://doc.php.net/images/php.gif<b>[/img]</b><br /><br />As noted in the URL section above you can wrap an image in a <b>[url][/url]</b> tag if you wish, eg.<br /><br /><b>[url=https://doc.php.net/][img]</b>https://doc.php.net/images/php.gif<b>[/img][/url]</b><br /><br />would generate:<br /><br /><a href="https://doc.php.net/" target="_blank"><img src="https://doc.php.net/images/php.gif" border="0" alt="" /></a><br /><br /><a class="postlink" href="#Top">Back to top</a></span></td> - </tr> - <tr> - <td class="spaceRow" height="1"></td> - </tr> -</table> - - - -<div align="center"><span class="copyright"><br /><br /> -<!-- - We request you retain the full copyright notice below including the link to www.phpbb.com. - This not only gives respect to the large amount of time given freely by the developers - but also helps build interest, traffic and use of phpBB 2.0. If you cannot (for good - reason) retain the full copyright we request you at least leave in place the - Powered by phpBB 2.0.6 line, with phpBB linked to www.phpbb.com. If you refuse - to include even this then support on our forums may be affected. - - The phpBB Group : 2002 -// --> - - </td> - </tr> - </table> - - - <table width="100%" border="0" cellspacing="0" cellpadding="0"> - <tr> - <td class="bgBottom" height="37" align="center"> - <p style="color: #444444; text-align: center; padding: 0; margin: 0; font-size: 10px; padding-top: 2px; ">Powered by <a href="http://www.phpbb.com" class="copyright">phpBB</a> &copy; 2001, 2003 <a href="http://www.phpbb.com/about.php" class="copyright">phpBB Group</a></td> - </tr> - </table> - </td> - </tr> -</table> -</body> -</html> - -<?php - -echo site_footer(); - -?> diff --git a/www/rfc/rfc-comments-show.php b/www/rfc/rfc-comments-show.php deleted file mode 100644 index 41eee48..0000000 --- a/www/rfc/rfc-comments-show.php +++ /dev/null @@ -1,184 +0,0 @@ -<?php - -/** - * Displays and accepts comments for a given proposal. - * - * This source file is subject to version 3.0 of the PHP license, - * that is bundled with this package in the file LICENSE, and is - * available through the world-wide-web at the following URI: - * http://www.php.net/license/3_0.txt. - * If you did not receive a copy of the PHP license and are unable to - * obtain it through the world-wide-web, please send a note to - * license@php.net so we can mail you a copy immediately. - * - * @original PEPr pearweb - * @category docweb - * @package RFC - * @author Vincent Gevers <vincent@php.net> - * @author Tobias Schlitt <toby@php.net> - * @author Daniel Convissor <danielc@php.net> - * @copyright Copyright (c) 1997-2011 The PHP Group - * @license http://www.php.net/license/3_0.txt PHP License - * @version $Id$ - */ - -/** - * Obtain the common functions and classes. - */ -$path = realpath(dirname(__FILE__)); -require_once $path . '/../../include/rfc/rfc.php'; - -if (!$proposal =& proposal::get($dbh, @$_GET['id'])) { - echo site_header('RFC :: Comments :: Invalid Request'); - echo "<h1>Comments Error</h1>\n"; - report_error('The requested proposal does not exist.'); - echo site_footer(); - exit; -} - -echo site_header('RFC :: Comments :: ' . htmlspecialchars($proposal->pkg_name)); -echo '<h1>Comments for ' . htmlspecialchars($proposal->pkg_name) . "</h1>\n"; - -if (isset($docwebUser) && - $proposal->getStatus() == 'proposal') -{ - $form =& new HTML_QuickForm('comment', 'post', - 'rfc-comments-show.php?id=' . $proposal->id); - - $form->addElement('textarea', 'comment', null, - array('cols' => 50, - 'rows' => 8, - 'id' => 'comment_field')); - - $form->addElement('static', '', '', - '<small>Your comment will also be sent to the' - . ' <strong>phpdoc</strong> mailing list.<br />' - . ' <strong>Please do not respond to other developers' - . ' comments</strong>.<br />' - . ' The author himself is responsible to reflect comments' - . ' in an acceptable way.</small>'); - - $form->addElement('submit', 'submit', 'Add New Comment'); - - $form->applyFilter('comment', 'trim'); - $form->addRule('comment', 'A comment is required', 'required', null, - 'server'); - - if (isset($_POST['submit'])) { - if ($form->validate()) { - $values = $form->exportValues(); - $proposal->sendActionEmail('proposal_comment', 'user', - $docwebUser, $values['comment']); - $proposal->addComment($values['comment'], - 'package_proposal_comments'); - report_success('Your comment was successfully processed'); - } else { - report_error($form->getElementError('comment')); - } - } -} - -display_pepr_nav($proposal); - -?> - -<table border="0" cellspacing="0" cellpadding="2" style="width: 75%"> - - <tr> - <th class="headrow" colspan="2">&raquo; Submit Your Comment</th> - </tr> - <tr> - <td class="textcell" valign="top" colspan="2"> - -<?php - -if ($proposal->getStatus() == 'proposal') { - if (isset($docwebUser)) { - $formArray = $form->toArray(); - - echo $form->getValidationScript(); - - echo '<form ' . $formArray['attributes'] . ">\n"; - echo '<table class="form-holder" cellspacing="1">' . "\n"; - - echo ' <caption class="form-caption">Comment on This'; - echo ' Proposal</caption>' . "\n"; - - echo " <tr>\n"; - echo ' <th class="form-label_left">'; - echo ' <label for="comment_field" accesskey="o">C<span'; - echo ' class="accesskey">o</span>mment:</label>'; - echo " </th>\n"; - echo ' <td class="form-input">'; - echo $formArray['elements'][0]['html'] . "</td>\n"; - echo " </tr>\n"; - - echo " <tr>\n"; - echo ' <th class="form-label_left">&nbsp;</th>' . "\n"; - echo ' <td class="form-input">'; - echo $formArray['elements'][1]['html'] . "</td>\n"; - echo " </tr>\n"; - - echo " <tr>\n"; - echo ' <th class="form-label_left">&nbsp;</th>' . "\n"; - echo ' <td class="form-input">'; - echo $formArray['elements'][2]['html'] . "</td>\n"; - echo " </tr>\n"; - - echo "</table>\n"; - echo "</form>\n"; - } else { - echo 'Please log in to enter your comment. If you are not a registered'; - echo ' PHP Docer, you can comment by sending an email to '; // !!! - echo make_mailto_link('phpdoc@lists.php.net') . '.'; - } -} else { - echo 'Comments are only accepted during the &quot;Proposal&quot; phase. '; - echo 'This proposal is currently in the &quot;'; - echo $proposal->getStatus(true) . '&quot; phase.'; -} - -?> - - </td> - </tr> - - <tr> - <th class="headrow" style="width: 100%">&raquo; Comments</th> - </tr> - <tr> - -<?php - -$comments = ppComment::getAll($proposal->id, 'package_proposal_comments'); -$userInfos = array(); - -if (is_array($comments) && (count($comments) > 0)) { - echo ' <td class="ulcell" valign="top">' . "\n"; - echo ' <ul class="spaced">' . "\n"; - foreach ($comments as $comment) { - if (empty($userInfos[$comment->user_handle])) { // not used? - //$userInfos[$comment->user_handle] = user_name(); - } - echo '<li><p style="margin: 0em 0em 0.3em 0em;">'; - echo make_link('/user/'.$comment->user_handle, user_name($comment->user_handle)); - echo ' [' . make_utc_date($comment->timestamp) . ']</p>'; - echo nl2br(htmlentities(trim($comment->comment))) . "\n</li>"; - } - echo " </ul>\n"; -} else { - echo ' <td class="textcell" valign="top">'; - echo 'There are no comments.'; -} - -?> - - </td> - </tr> -</table> - -<?php - -echo site_footer(); - -?> diff --git a/www/rfc/rfc-overview.php b/www/rfc/rfc-overview.php deleted file mode 100644 index bc8ef19..0000000 --- a/www/rfc/rfc-overview.php +++ /dev/null @@ -1,145 +0,0 @@ -<?php - -/** - * Displays a list of all proposals. - * - * The <var>$proposalStatiMap</var> array is defined in - * pearweb/include/pepr/pepr.php. - * - * This source file is subject to version 3.0 of the PHP license, - * that is bundled with this package in the file LICENSE, and is - * available through the world-wide-web at the following URI: - * http://www.php.net/license/3_0.txt. - * If you did not receive a copy of the PHP license and are unable to - * obtain it through the world-wide-web, please send a note to - * license@php.net so we can mail you a copy immediately. - * - * @original PEPr pearweb - * @category docweb - * @package RFC - * @author Vincent Gevers <vincent@php.net> - * @author Tobias Schlitt <toby@php.net> - * @author Daniel Convissor <danielc@php.net> - * @copyright Copyright (c) 1997-2011 The PHP Group - * @license http://www.php.net/license/3_0.txt PHP License - * @version $Id$ - */ - -/** - * Obtain the common functions and classes. - */ -$path = realpath(dirname(__FILE__)); -require_once $path . '/../../include/rfc/rfc.php'; - -if (isset($_GET['filter']) && isset($proposalStatiMap[$_GET['filter']])) { - $selectStatus = $_GET['filter']; -} else { - $selectStatus = ''; -} - -if ($selectStatus != '') { - $order = ' pkg_category ASC, pkg_name ASC'; -} - -@$proposals =& proposal::getAll($dbh, @$selectStatus, null, @$order); - -echo site_header('RFC :: Proposals'); - -echo '<h1>Proposals</h1>' . "\n"; - -display_overview_nav(); - -$last_status = false; -$first_loop = true; - -$finishedCounter = 0; - -if (empty($proposals)) { - report_warning('Sorry, there are no proposals in this category'); -} -foreach ($proposals as $proposal) { - - if ($proposal->getStatus() != $last_status) { - if ($first_loop != true) { - echo "</ul>\n"; - } - echo '<h2 id="' . $proposal->getStatus() . '">'; - echo '&raquo; ' . htmlspecialchars($proposal->getStatus(true)); - echo "</h2>\n"; - echo "<ul>\n"; - $last_status = $proposal->getStatus(); - $first_loop = false; - } - $prpCat = $proposal->pkg_category; - if ($selectStatus != '' && (!isset($lastChar) || $lastChar != $prpCat{0})) { - $lastChar = $prpCat{0}; - echo '</ul>'; - echo "<h3>$lastChar</h3>"; - echo '<ul>'; - } - if ($proposal->getStatus() == 'finished' && $selectStatus != 'finished') { - if (++$finishedCounter == 10) { - break; - } - } - if (!isset($users[$proposal->user_handle])) { - $users[$proposal->user_handle] = array($proposal->user_handle,'name'=>user_name($proposal->user_handle)); - } - - $already_voted = false; - if (isset($docwebUser) && $proposal->getStatus(true) == "Called for Votes") { - $proposal->getVotes($dbh); - - if (in_array($docwebUser, array_keys($proposal->votes))) { - $already_voted = true; - } - } - - echo "<li>"; - - if ($already_voted) { - echo '(Already voted) '; - } - - print_link('rfc-proposal-show.php?id=' . $proposal->id, - htmlspecialchars($proposal->pkg_category) . ' :: ' - . htmlspecialchars($proposal->pkg_name)); - echo ' by '; - print_link('/user/' . htmlspecialchars($proposal->user_handle), - htmlspecialchars($users[$proposal->user_handle]['name'])); - $proposalStatus = $proposal->getStatus(); - switch ($proposalStatus) { - case 'proposal': - echo ' &nbsp;(<a href="rfc-comments-show.php?id=' . $proposal->id; - echo '">Comments</a>)'; - break; - case 'vote': - case 'finished': - $voteSums = ppVote::getSum($dbh, $proposal->id); - echo ' &nbsp;(<a href="rfc-votes-show.php?id=' . $proposal->id; - echo '">Vote</a> sum: <strong>' . $voteSums['all'] . '</strong>'; - echo '<small>, ' . $voteSums['conditional']; - echo ' conditional'; - if ($proposalStatus == 'finished') { - if ($voteSums['all'] >= 5) { - echo ', accepted'; - } else { - echo ', rejected'; - } - } - echo "</small>)\n"; - } - echo "</li>\n"; - - -} - -if ($selectStatus == '' && isset($proposal) && $proposal->getStatus() == 'finished') { - print_link('rfc-overview.php?filter=finished', 'All finished proposals'); -} - -echo "</ul>\n"; - -echo site_footer(); - -?> diff --git a/www/rfc/rfc-proposal-delete.php b/www/rfc/rfc-proposal-delete.php deleted file mode 100644 index 9572446..0000000 --- a/www/rfc/rfc-proposal-delete.php +++ /dev/null @@ -1,109 +0,0 @@ -<?php - -/** - * Interface for deleting a proposal. - * - * This source file is subject to version 3.0 of the PHP license, - * that is bundled with this package in the file LICENSE, and is - * available through the world-wide-web at the following URI: - * http://www.php.net/license/3_0.txt. - * If you did not receive a copy of the PHP license and are unable to - * obtain it through the world-wide-web, please send a note to - * license@php.net so we can mail you a copy immediately. - * - * @original PEPr pearweb - * @category docweb - * @package RFC - * @author Vincent Gevers <vincent@php.net> - * @author Tobias Schlitt <toby@php.net> - * @author Daniel Convissor <danielc@php.net> - * @copyright Copyright (c) 1997-2011 The PHP Group - * @license http://www.php.net/license/3_0.txt PHP License - * @version $Id$ - */ - -/** - * Obtain the common functions and classes. - */ -$path = realpath(dirname(__FILE__)); -require_once $path . '/../../include/rfc/rfc.php'; - -auth(); - -if (!empty($_GET['isDeleted'])) { - echo site_header('RFC :: Delete'); - echo "<h1>Delete Proposal</h1>\n"; - report_success('Proposal deleted successfully.'); - echo '<p>'; - print_link('rfc-overview.php', 'Back to RFC Home Page'); - echo "</p>\n"; - echo site_footer(); - exit; -} - -if (!$proposal =& proposal::get($dbh, @$_GET['id'])) { - echo site_header('RFC :: Delete :: Invalid Request'); - echo "<h1>Delete Proposal Error</h1>\n"; - report_error('The requested proposal does not exist.'); - echo site_footer(); - exit; -} - -ob_start(); - -echo site_header('RFC :: Delete :: ' . htmlspecialchars($proposal->pkg_name)); -echo '<h1>Delete Proposal ' . htmlspecialchars($proposal->pkg_name) . "</h1>\n"; - -if (!$proposal->mayEdit($docwebUser)) { - 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 admin karma.'); - echo site_footer(); - exit; -} - -if ($proposal->compareStatus('>', 'proposal')) { - if (is_admin()) { - report_error('This proposal has reached the "' - . $proposal->getStatus(true) . '" phase.' - . ' Are you SURE you want to delete it?', - 'warnings', 'WARNING:'); - } -} - -$form =& new HTML_QuickForm('delete-proposal', 'post', - 'rfc-proposal-delete.php?id=' . $proposal->id); - -$form->addElement('checkbox', 'delete', 'Really delete proposal for ', - htmlspecialchars($proposal->pkg_category) . '::' - . htmlspecialchars($proposal->pkg_name)); -$form->addElement('textarea', 'reason', - 'Please tell us why you chose to delete this proposal '); - -$form->addElement('submit', 'submit', 'Do it'); - -$form->addRule('delete', 'You have to check the box to delete!!', 'required', - '', 'server'); - -if (isset($_POST['submit'])) { - if ($form->validate()) { - $proposal->delete($dbh); - $proposal->sendActionEmail('proposal_delete', 'mixed', $docwebUser, $form->exportValue('reason')); - ob_end_clean(); - header('Location: rfc-proposal-delete.php?id=' . $proposal->id . '&isDeleted=1'); - } else { - $pepr_form = $form->toArray(); - report_error($pepr_form['errors']); - } -} - -ob_end_flush(); -display_pepr_nav($proposal); - -$form->display(); - -echo site_footer(); - -?> diff --git a/www/rfc/rfc-proposal-edit.php b/www/rfc/rfc-proposal-edit.php deleted file mode 100644 index 150934f..0000000 --- a/www/rfc/rfc-proposal-edit.php +++ /dev/null @@ -1,417 +0,0 @@ -<?php - -/** - * Interface for inputing/editing a proposal. - * - * The <var>$proposalTypeMap</var> array is defined in - * docweb/include/rfc/rfc.php. - * - * This source file is subject to version 3.0 of the PHP license, - * that is bundled with this package in the file LICENSE, and is - * available through the world-wide-web at the following URI: - * http://www.php.net/license/3_0.txt. - * If you did not receive a copy of the PHP license and are unable to - * obtain it through the world-wide-web, please send a note to - * license@php.net so we can mail you a copy immediately. - * - * @original PEPr pearweb - * @category docweb - * @package RFC - * @author Vincent Gevers <vincent@php.net> - * @author Tobias Schlitt <toby@php.net> - * @author Daniel Convissor <danielc@php.net> - * @copyright Copyright (c) 1997-2011 The PHP Group - * @license http://www.php.net/license/3_0.txt PHP License - * @version $Id$ - */ - -/** - * Obtain the common functions and classes. - */ -$path = realpath(dirname(__FILE__)); -require_once $path . '/../../include/rfc/rfc.php'; - -auth(); - -/** - * Obtain code for Bulletin Board markup. - */ -require_once 'HTML/BBCodeParser.php'; - -ob_start(); - -if ($proposal =& proposal::get($dbh, @$_GET['id'])) { - - echo site_header('RFC :: Editor :: ' - . htmlspecialchars($proposal->pkg_name)); - echo '<h1>Proposal Editor for ' . htmlspecialchars($proposal->pkg_name); - echo ' (' . $proposal->getStatus(true) . ")</h1>\n"; - - -if (isset($_GET['delete']) AND !empty($_GET['delete'])) { - -if (strlen($_GET['delete']) >= 32 && - strpos($_GET['delete'], "..") === FALSE && (($docwebUser == $proposal->user_handle) || is_admin())) { - - $hash = substr($_GET['delete'], -32); - $file = substr($_GET['delete'], 0, -32); - if (!file_exists($path . '/../../files/' . $hash)) { - report_error('File ' . htmlspecialchars(stripslashes($file)) . ' does not exists'); - } else { - $proposal->pkg_filehash = str_replace('|' . $_GET['delete'], '', $proposal->pkg_filehash); - - $sql = "UPDATE package_proposals SET - pkg_filehash = ".$dbh->quoteSmart($proposal->pkg_filehash)." - WHERE id = ".$proposal->id; - $res = $dbh->query($sql); - - // this might need some more security - unlink($path . '/../../files/' . $hash); - - report_success('File ' . htmlspecialchars(stripslashes($file)) . ' deleted!'); - } -} - - -} - - - - - -// !!! - if (!$proposal->mayEdit($docwebUser) && empty($_GET['next_stage'])) { - report_error('You are not allowed to edit this proposal,' - . ' probably due to it having reached the "' - . $proposal->getStatus(true) . '" phase.' - . ' If this MUST be edited, contact someone ELSE' - . ' who has admin karma.'); - site_footer(); - exit; - } - - - if ($proposal->compareStatus('>', 'proposal') && - is_admin() && empty($_GET['next_stage'])) - { - report_error('This proposal has reached the "' - . $proposal->getStatus(true) . '" phase.' - . ' Are you SURE you want to edit it?', - 'warnings', 'WARNING:'); - } - - $proposal->getLinks($dbh); - $id = $proposal->id; -} else { - echo site_header('RFC :: Editor :: New Proposal'); - echo '<h1>New Proposal</h1>' . "\n"; - $id = 0; - $proposal = null; -} - - -$form =& new HTML_QuickForm('proposal_edit', 'post', - 'rfc-proposal-edit.php?id=' . $id); -$form->setMaxFileSize(round((1024 * 1024)/10)); - -$renderer =& $form->defaultRenderer(); -$renderer->setElementTemplate(' - <tr> - <th class="form-label_left"> - <!-- BEGIN required --><span style="color: #ff0000">*</span><!-- END required --> - {label} - </th> - <td class="form-input"> - <!-- BEGIN error --><span style="color: #ff0000">{error}</span><br /><!-- END error --> - {element} - </td> - </tr> -'); - -//$categories = category::listAll(); // !!! -$mapCategories['RFC'] = 'RFC'; -$mapCategories['Patches'] = 'Patches'; -//foreach ($categories as $categorie) { -// $mapCategories[$categorie['name']] = $categorie['name']; -//} - - - -$form->addElement('select', 'pkg_category', '<label for="pkg_category" accesskey="o">Categ<span class="accesskey">o</span>ry:</label>', $mapCategories, 'id="pkg_category"'); - -$categoryNewElements[] =& HTML_QuickForm::createElement('checkbox', 'pkg_category_new_do', ''); -$categoryNewElements[] =& HTML_QuickForm::createElement('text', 'pkg_category_new_text', ''); -$categoryNew = $form->addGroup($categoryNewElements, 'pkg_category_new', 'New category:', '(only use if really needed)<br />'); - -$form->addElement('text', 'pkg_name', 'Name:'); - -$form->addElement('textarea', 'pkg_describtion', 'Description:', array('rows' => 20, 'cols' => '75')); -$form->addElement('select', 'markup', 'Markup', array('bbcode' => 'BBCode', 'wiki' => 'Wiki')); - -$helpLinks[] =& HTML_QuickForm::createElement('link', 'help_bbcode', '_blank', 'rfc-bbcode-help.php', 'You can use BBCode inside your description', array('target' => '_blank')); -$helpLinks[] =& HTML_QuickForm::createElement('link', 'help_wiki', '_blank', 'http://wiki.ciaweb.net/yawiki/index.php?area=Text_Wiki&page=WikiRules', 'or Wiki markup', array('target' => '_blank')); -$form->addGroup($helpLinks, 'markup_help', '', ' '); - -$form->addElement('file', 'thefile', ''); -$form->addElement('static', '', '', 'Upload a file or link to your files'); - - $filecount = 0; - if ($proposal) { - $filecount = explode('|', $proposal->pkg_filehash); - - if (@$filecount[1] == '') { // failed, no files - $filecount = 0; - } else { - $filecount = (count($filecount) -1); - } - - if (isset($_POST['submit']) AND !empty($_FILES['thefile']['name'])) - $filecount++; - } - -$form->addElement('static', '', '', 'You have uploaded '.$filecount.' file(s). To delete, click on the file'); - -if (!empty($proposal->pkg_filehash)) { - $list = explode("|", htmlspecialchars(stripslashes($proposal->pkg_filehash))); - - foreach ($list as $hash) { - if ($hash == '') - continue; - - $file = substr($hash, 0, -32); - - $form->addElement('static', '', '', '<li><a href="rfc-proposal-edit.php?id='.$id.'&amp;delete='.urlencode($hash).'">'.$file.'</a></li>'); - - } -} - - - -$max = (isset($proposal->links) && (count($proposal->links) > 2)) ? (count($proposal->links) + 1) : 3; -for ($i = 0; $i < $max; $i++) { - unset($link); - $link[0] = $form->createElement('select', 'type', '', $proposalTypeMap); - $link[1] = $form->createElement('text', 'url', ''); - $label = ($i == 0) ? 'Links:': ''; - $links[$i] =& $form->addGroup($link, "link[$i]", $label, ' '); -} - -$form->addElement('static', '', '', '<small>To add more links, fill out all link forms and hit save. To delete a link leave the URL field blank.</small>'); - - - -if ($proposal != null && ($proposal->getStatus() != 'draft')) { - $form->addElement('static', '', '', '<strong>If you add any text to the Changelog comment textarea,<br />then a mail will be sent to phpdoc about this update.</strong>'); - $form->addElement('textarea', 'action_comment', 'Changelog comment:', array('cols' => 80, 'rows' => 10)); -} - - -$form->addElement('submit', 'submit', 'Save'); - - -if ($proposal != null) { - $defaults = array('pkg_name' => $proposal->pkg_name, - 'pkg_describtion' => $proposal->pkg_describtion, - 'markup' => $proposal->markup); - if (isset($mapCategories[$proposal->pkg_category])) { - $defaults['pkg_category'] = $proposal->pkg_category; - } else { - $defaults['pkg_category_new']['pkg_category_new_text'] = $proposal->pkg_category; - $defaults['pkg_category_new']['pkg_category_new_do'] = true; - } - if ((count($proposal->links) > 0)) { - $i = 0; - foreach ($proposal->links as $proposalLink) { - $defaults['link'][$i]['type'] = $proposalLink->type; - $defaults['link'][$i]['url'] = $proposalLink->url; - $i++; - } - } - - $form->setDefaults($defaults); - - switch ($proposal->status) { - case 'draft': - $next_stage_text = "Change status to 'Proposal'"; - break; - - case 'proposal': - $next_stage_text = "Change status to 'Call for votes'"; - break; - - case 'vote': - default: - if (is_admin() && - ($proposal->user_handle != $docwebUser)) { - $next_stage_text = 'Extend vote time'; - } else { - $next_stage_text = ''; - } - break; - } - - $timeline = $proposal->checkTimeLine(); - - if (!empty($next_stage_text)) { - if (($timeline === true) || (is_admin() && - ($proposal->user_handle != $docwebUser))) { - $form->addElement('checkbox', 'next_stage', $next_stage_text); - } else { - $form->addElement('static', 'next_stage', '', - 'You can set &quot;' . @$next_stage_text - . '&quot; after ' - . make_utc_date($timeline) . '.'); - } - } -} - - -$form->applyFilter('pkg_name', 'trim'); -$form->applyFilter('pkg_describtion', 'trim'); - -$form->addRule('pkg_category', 'You have to select a category!', 'required', '', 'server'); -$form->addRule('pkg_name', 'You have to enter a name!', 'required', '', 'server'); -$form->addRule('pkg_describtion', 'You have to enter a description!', 'required', '', 'server'); - - -if (isset($_POST['submit'])) { - if ($form->validate()) { - $values = $form->exportValues(); - - if (!empty($_FILES['thefile']['name'])) { - // this will need some more security checks - if ($_FILES['thefile']['size'] >= round((1024 * 1024)/10)) { - report_error('The file should NOT be bigger then 100kb, please upload - it somewhere and link to it'); - unlink($_FILES['thefile']['tmp_name']); - } else { - $filehash = md5($_FILES['thefile']['name'] . time()); - move_uploaded_file($_FILES['thefile']['tmp_name'], - $path . '/../../files/' . $filehash); - $proposal->pkg_filehash = $proposal->pkg_filehash . '|' . basename($_FILES['thefile']['name']) . $filehash; - - } - } else { - if (isset($proposal) && empty($proposal->pkg_filehash)) { - $proposal->pkg_filehash = ''; - } - } - - if (isset($values['pkg_category_new']['pkg_category_new_do'])) { - $values['pkg_category'] = $values['pkg_category_new']['pkg_category_new_text']; - } - - if (isset($values['next_stage'])) { - switch ($proposal->status) { - case 'draft': - if ($proposal->checkTimeLine()) { - $values['proposal_date'] = time(); - $proposal->status = 'proposal'; - $proposal->sendActionEmail('change_status_proposal', 'mixed', $docwebUser); - } else { - PEAR::raiseError('You can not change the status now.'); - } - break; - - case 'proposal': - if ($proposal->checkTimeLine()) { - $values['vote_date'] = time(); - $proposal->status = 'vote'; - $proposal->sendActionEmail('change_status_vote', 'mixed', $docwebUser); - } else { - PEAR::raiseError('You can not change the status now.'); - } - break; - - default: - if ($proposal->mayEdit($docwebUser)) { - $values['longened_date'] = time(); - $proposal->status = 'vote'; - $proposal->sendActionEmail('longened_timeline_admin', 'mixed', $docwebUser); - } - } - } else { - if (isset($proposal) && $proposal->status != 'draft') { - if (!empty($values['action_comment']) || (is_admin() && - ($proposal->user_handle != $docwebUser))) { - if (empty($values['action_comment'])) { - PEAR::raiseError('A changelog comment is required.'); - } - $proposal->addComment($values['action_comment']); - $proposal->sendActionEmail('edit_proposal', 'mixed', $docwebUser, $values['action_comment']); - } - } - } - - $linksData = $values['link']; - - if (isset($proposal)) { - $proposal->fromArray($values); - } else { - $proposal = new proposal($values); - $proposal->user_handle = $docwebUser; - } - - unset($proposal->links); - for ($i = 0; $i < count($linksData); $i++) { - $linkData['type'] = $linksData[$i]['type']; - $linkData['url'] = $linksData[$i]['url']; - - if ($linksData[$i]['url']) { - $proposal->addLink($dbh, new ppLink($linkData)); - } - } - - $proposal->store($dbh); - - if (isset($values['next_stage'])) { - $nextStage = 1; - } - - ob_end_clean(); - header('Location: rfc-proposal-edit.php?id=' - . $proposal->id . '&saved=1&next_stage=' . @$nextStage); - } else { - $pepr_form = $form->toArray(); - report_error($pepr_form['errors']); - } -} - -ob_end_flush(); - -if (!empty($_GET['next_stage'])) { - $form =& new HTML_QuickForm('no-form'); - $bbox = array(); - switch ($proposal->status) { - case 'proposal': - $bbox[] = 'The RFC has been proposed on phpdoc.' - . ' All further changes will produce an update email.'; - break; - - case 'vote': - $bbox[] = 'The RFC has been called for votes on phpdoc.' - . ' No further changes are allowed.'; - break; - } - if (is_admin()) { - $bbox[] = 'Your changes were recorded and necessary emails' - . ' were sent.'; - } - if ($bbox) { - report_success(implode(' ', $bbox)); - } -} else { - if (!empty($_GET['saved'])) { - report_success('Changes saved successfully.'); - } -} - -if ($id != 0) { -display_pepr_nav($proposal); -} - -$form->display(); - -echo site_footer(); - -?> diff --git a/www/rfc/rfc-proposal-show.php b/www/rfc/rfc-proposal-show.php deleted file mode 100644 index 3ae9072..0000000 --- a/www/rfc/rfc-proposal-show.php +++ /dev/null @@ -1,293 +0,0 @@ -<?php - -/** - * Display details of a particular proposal. - * - * This source file is subject to version 3.0 of the PHP license, - * that is bundled with this package in the file LICENSE, and is - * available through the world-wide-web at the following URI: - * http://www.php.net/license/3_0.txt. - * If you did not receive a copy of the PHP license and are unable to - * obtain it through the world-wide-web, please send a note to - * license@php.net so we can mail you a copy immediately. - * - * @original PEPr pearweb - * @category docweb - * @package RFC - * @author Vincent Gevers <vincent@php.net> - * @author Tobias Schlitt <toby@php.net> - * @author Daniel Convissor <danielc@php.net> - * @copyright Copyright (c) 1997-2011 The PHP Group - * @license http://www.php.net/license/3_0.txt PHP License - * @version $Id$ - */ - -/** - * Obtain the common functions and classes. - */ -$path = realpath(dirname(__FILE__)); -require_once $path . '/../../include/rfc/rfc.php'; - -if (isset($_GET['get']) AND !empty($_GET['get'])) { - $get = basename($_GET['get']); - - if (file_exists($path . '/../../files/' . $get) && strlen($get) == 32 && - strpos($get, "..") === FALSE) { - - $hash = sqlite_escape_string($get); - $sql = 'SELECT pkg_filehash FROM package_proposals WHERE pkg_filehash LIKE "%'.$hash.'%"'; - $res = sqlite_query($dbh->connection, $sql); - $files = sqlite_fetch_single($res); - - $file_tmp = explode('|', $files); - foreach ($file_tmp as $file) { - if (strpos($file, $hash)) { - $file = substr($file, 0, -32); - break; - } - } - // Output the file for download - header("Pragma: no-cache"); - header("Expires: 0"); - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); - header("Cache-Control: no-cache, must-revalidate"); - header("Content-Type: octet-stream"); - header("Content-Length: " . filesize($path . '/../../files/' . $get)); - header("Content-Disposition: attachment; filename=".stripslashes($file)); - echo file_get_contents($path . '/../../files/' . $get); - exit; - } else { - error_handler('File could not be found'); - } - exit; -} - - -if (!$proposal =& proposal::get($dbh, @$_GET['id'])) { - - echo site_header('RFC :: Details :: Invalid Request'); - echo "<h1>Proposal for</h1>\n"; - report_error('The requested proposal does not exist.'); - echo site_footer(); - exit; -} - -echo site_header('RFC :: Details :: ' . htmlspecialchars($proposal->pkg_name)); -echo '<h1>Proposal for ' . htmlspecialchars($proposal->pkg_name) . "</h1>\n"; - -display_pepr_nav($proposal); - -// Switching markup types -switch ($proposal->markup) { - case 'wiki': - require_once 'Text/Wiki.php'; - $wiki =& new Text_Wiki(); - $wiki->disableRule('wikilink'); - $describtion = $wiki->transform($proposal->pkg_describtion); - break; - case 'bbcode': - default: - require_once 'HTML/BBCodeParser.php'; - $bbparser = new HTML_BBCodeParser(array('filters' => 'Basic,Images,Links,Lists,Extended')); - $describtion = nl2br(htmlentities($bbparser->qparse($proposal->pkg_describtion))); -} - -?> - -<table border="0" cellspacing="0" cellpadding="2" style="width: 75%"> - - <tr> - <th class="headrow" style="width: 50%">&raquo; Metadata</th> - <th class="headrow" style="width: 50%">&raquo; Status</th> - </tr> - <tr> - <td class="ulcell" valign="top"> - <ul> - <li> - Category: <?php echo htmlspecialchars($proposal->pkg_category) ?> - </li> - <li> - Proposer: <?php echo user_name($proposal->user_handle); ?> - </li> - </ul> - </td> - - <td class="ulcell" valign="top"> - <ul> - <li> - Status: <?php echo $proposal->getStatus(true) ?> - </li> - -<?php - -if ($proposal->status == 'finished') { - $proposalVotesSum = ppVote::getSum($dbh, $proposal->id); - - echo ' <li>Result: '; - if ($proposalVotesSum['all'] >= 5) { - echo 'Accepted'; - } else { - echo 'Rejected'; - } - echo "</li>\n"; - - echo ' <li>Sum of Votes: '; - echo $proposalVotesSum['all']; - echo ' (' . $proposalVotesSum['conditional'] . ' conditional)'; - echo "</li>\n"; -} elseif ($proposal->status == 'vote') { - // Cron job runs at 0 am - $pepr_end = mktime(0, 0, 0, date('m', $proposal->vote_date), - date('d', $proposal->vote_date), - date('Y', $proposal->vote_date)); - - if (date('H', $proposal->vote_date) > '03') { - // add a day - $pepr_end += 86400; - } - - if ($proposal->longened_date) { - $pepr_end += PROPOSAL_STATUS_VOTE_TIMELINE * 2; - } else { - $pepr_end += PROPOSAL_STATUS_VOTE_TIMELINE; - } - echo ' <li>Voting Will End: '; - echo make_utc_date($pepr_end); - echo "</li>\n"; -} - -?> - - </ul> - </td> - </tr> - - <tr> - <th class="headrow" colspan="2">&raquo; Description</th> - </tr> - <tr> - <td class="textcell" valign="top" colspan="2"> - <p> - <?php echo $describtion; ?> - </p> - </td> - </tr> - - <tr> - <th class="headrow" style="width: 50%">&raquo; Links</th> - <th class="headrow" style="width: 50%">&raquo;Files</th> - </tr> - <tr> - - <td class="ulcell" valign="top"> - -<?php - -$proposal->getLinks($dbh); -if (!empty($proposal->links)) { - echo ' <ul>'; - foreach ($proposal->links as $link) { - echo ' <li>'; - print_link(htmlspecialchars($link->url), $link->getType(true)); - echo "</li>\n"; - } - echo ' </ul>'; -} - -?> - - </td> - <td class="ulcell"> - <ul> - -<?php - -if (!empty($proposal->pkg_filehash)) { - $list = explode("|", htmlspecialchars($proposal->pkg_filehash)); -foreach ($list as $hash) { - if ($hash == '') - continue; - - $file = substr($hash, 0, -32); - $hash = substr($hash, -32); - echo ' <li>'; - print_link('rfc-proposal-show.php?get=' . $hash, htmlspecialchars(stripslashes($file))); - echo "</li>\n"; -} -} - -?> - - </ul> - </td> - </tr> - - <tr> - <th class="headrow" style="width: 50%">&raquo; Timeline</th> - <th class="headrow" style="width: 50%">&raquo; Changelog</th> - </tr> - <tr> - <td class="ulcell" valign="top"> - <ul> - <li> - First Draft: <?php echo make_utc_date($proposal->draft_date, 'Y-m-d') ?> - </li> - -<?php - -if ($proposal->proposal_date) { - echo ' <li>'; - echo 'Proposal: ' . make_utc_date($proposal->proposal_date, 'Y-m-d'); - echo "</li>\n"; -} - -if ($proposal->vote_date) { - echo ' <li>'; - echo 'Call for Votes: ' . make_utc_date($proposal->vote_date, 'Y-m-d'); - echo "</li>\n"; -} - -if ($proposal->longened_date) { - echo ' <li>'; - echo 'Voting Extended: ' . make_utc_date($proposal->longened_date, 'Y-m-d'); - echo "</li>\n"; -} - -?> - - </ul> - </td> - <td class="ulcell" valign="top"> - -<?php - -if ($changelog = @ppComment::getAll($proposal->id, 'package_proposal_changelog')) { - echo "<ul>\n"; - foreach ($changelog as $comment) { - if (!isset($userinfos[$comment->user_handle])) { - $userinfo[$comment->user_handle] = array('name'=> user_name($comment->user_handle)); - } - echo '<li><p style="margin: 0em 0em 0.3em 0em; font-size: 90%;">'; - echo htmlspecialchars($userinfo[$comment->user_handle]['name']); - echo '<br />[' . make_utc_date($comment->timestamp) . ']</p>'; - - switch ($proposal->markup) { - case 'wiki': - echo $wiki->transform($comment->comment); - break; - case 'bbcode': - default: - echo $bbparser->qparse(nl2br($comment->comment)); - break; - } - echo "</li>\n"; - } - echo "</ul>\n"; -} - -echo " </td>\n </tr>\n"; -echo "</table>\n"; - -echo site_footer(); - -?> diff --git a/www/rfc/rfc-vote-show.php b/www/rfc/rfc-vote-show.php deleted file mode 100644 index 096b95c..0000000 --- a/www/rfc/rfc-vote-show.php +++ /dev/null @@ -1,120 +0,0 @@ -<?php - -/** - * Displays details about a specific vote. - * - * This source file is subject to version 3.0 of the PHP license, - * that is bundled with this package in the file LICENSE, and is - * available through the world-wide-web at the following URI: - * http://www.php.net/license/3_0.txt. - * If you did not receive a copy of the PHP license and are unable to - * obtain it through the world-wide-web, please send a note to - * license@php.net so we can mail you a copy immediately. - * - * @original PEPr pearweb - * @category docweb - * @package RFC - * @author Vincent Gevers <vincent@php.net> - * @author Tobias Schlitt <toby@php.net> - * @author Daniel Convissor <danielc@php.net> - * @copyright Copyright (c) 1997-2011 The PHP Group - * @license http://www.php.net/license/3_0.txt PHP License - * @version $Id$ - */ - -/** - * Obtain the common functions and classes. - */ -$path = realpath(dirname(__FILE__)); -require_once $path . '/../../include/rfc/rfc.php'; - -$handle = htmlspecialchars(@$_GET['handle']); - -if (!$proposal =& proposal::get($dbh, @$_GET['id']) || !$handle) -{ - echo site_header('RFC :: Vote Details :: Invalid Request'); - echo "<h1>Vote Details Error</h1>\n"; - report_error('The requested proposal or user does not exist.'); - echo site_footer(); - exit; -} - -echo site_header('RFC :: Vote Details :: ' - . htmlspecialchars($proposal->pkg_name) . ' :: ' . $handle); - -echo '<h1>Vote Details for ' . htmlspecialchars($proposal->pkg_name) . ' by '; -echo $handle . "</h1>\n"; - -display_pepr_nav($proposal); - -?> - -<table border="0" cellspacing="0" cellpadding="2" style="width: 75%"> - - <tr> - <th class="headrow">&raquo; Details</th> - </tr> - <tr> - -<?php - -$vote = ppVote::get($dbh, $proposal->id, $handle); - -if (!$vote) { - echo '<td class="textcell" valign="top">'; - echo 'This user has not voted on this proposal yet.'; -} else { - echo '<td class="ulcell" valign="top">'; - echo "<ul>\n"; - - echo ' <li>Voter: '; - print_link('/user/' . htmlspecialchars($handle), - htmlspecialchars(user_name($handle))); - echo "</li>\n"; - - echo ' <li>Vote: '; - if ($vote->value > 0) { - echo '+'; - } - echo $vote->value; - if ($vote->is_conditional) { - echo ' (conditional)'; - } else { - echo ' (not conditional)'; - } - echo "</li>\n"; - - echo ' <li>Reviews: '; - echo htmlspecialchars(implode(', ', $vote->getReviews(true))); - echo "</li>\n"; - - ?> - - </ul> - - </td> - </tr> - - <tr> - <th class="headrow">&raquo; Comment</th> - </tr> - <tr> - <td class="textcell" valign="top"> - - <?php - - $vote->comment = trim($vote->comment); - if ($vote->comment != '-') { - echo nl2br(htmlentities($vote->comment)); - } else { - echo '&nbsp;'; - } -} - -echo " </td>\n"; -echo " </tr>\n"; -echo "</table>\n"; - -echo site_footer(); - -?> diff --git a/www/rfc/rfc-votes-show.php b/www/rfc/rfc-votes-show.php deleted file mode 100644 index 784acec..0000000 --- a/www/rfc/rfc-votes-show.php +++ /dev/null @@ -1,298 +0,0 @@ -<?php - -/** - * Displays and accepts votes for a given proposal. - * - * This source file is subject to version 3.0 of the PHP license, - * that is bundled with this package in the file LICENSE, and is - * available through the world-wide-web at the following URI: - * http://www.php.net/license/3_0.txt. - * If you did not receive a copy of the PHP license and are unable to - * obtain it through the world-wide-web, please send a note to - * license@php.net so we can mail you a copy immediately. - * - * @original PEPr pearweb - * @category docweb - * @package RFC - * @author Vincent Gevers <vincent@php.net> - * @author Tobias Schlitt <toby@php.net> - * @author Daniel Convissor <danielc@php.net> - * @copyright Copyright (c) 1997-2011 The PHP Group - * @license http://www.php.net/license/3_0.txt PHP License - * @version $Id$ - */ - -/** - * Obtain the common functions and classes. - */ -$path = realpath(dirname(__FILE__)); -require_once $path . '/../../include/rfc/rfc.php'; - - -if (!$proposal =& proposal::get($dbh, @$_GET['id'])) { - echo site_header('RFC :: Votes :: Invalid Request'); - echo "<h1>Proposal Votes Error</h1>\n"; - report_error('The requested proposal does not exist.'); - echo site_footer(); - exit; -} - -echo site_header('RFC :: Votes :: ' . htmlspecialchars($proposal->pkg_name)); -echo '<h1>Proposal Votes for ' . htmlspecialchars($proposal->pkg_name) . "</h1>\n"; - -if (isset($docwebUser) && $proposal->mayVote($dbh, $docwebUser)) { - $form =& new HTML_QuickForm('vote', 'post', - 'rfc-votes-show.php?id=' . $proposal->id); - - $form->setDefaults(array('value' => 1)); - $form->addElement('select', 'value', '', - array(1 => '+1', - 0 => '0', - -1 => '-1'), - 'id="vote_field"'); - $form->addElement('checkbox', 'conditional', '', '', null, 1); - $form->addElement('textarea', 'comment', null, - array('cols' => 40, - 'rows' => 3)); - $form->addElement('select', 'reviews', '', $proposalReviewsMap, - array('size' => count($proposalReviewsMap), - 'multiple' => 'multiple')); - $form->addElement('static', '', '', - '<small>Note that you can only vote once!<br />' - . 'For conditional votes, please leave a comment and' - . ' vote +1 (<i>e.g.</i>, &quot;I\'m +1 if you' - . ' change...&quot;).</small>'); - $form->addElement('submit', 'submit', 'Vote'); - - $form->applyFilter('comment', 'trim'); - $form->addRule('value', 'Vote is a required field.', 'required', - null, 'server'); - $form->addRule('value', 'Vote must be +1, 0 or -1.', 'regex', - '/-1|0|1/', 'server'); - $form->addRule('reviews', 'Reviews is a required field.', 'required', - null, 'server'); - - if (isset($_POST['submit'])) { - if ($form->validate()) { - $value = $form->getElement('value'); - $value = $value->getSelected(); - $voteData['value'] = (int)$value['0']; - $is_conditional = $form->getElement('conditional'); - $voteData['is_conditional'] = ($is_conditional->getChecked()) ? 1 : 0; - $comment = $form->getElement('comment'); - $voteData['comment'] = $comment->getValue(); - $reviews = $form->getElement('reviews'); - $voteData['reviews'] = $reviews->getSelected(); - $voteData['user_handle'] = $docwebUser; - - $errors = array(); - - if ($voteData['is_conditional'] && empty($voteData['comment'])) { - $errors[] = 'You have to apply a comment if your vote is' - . ' conditional!'; - } - if ($voteData['is_conditional'] && ($voteData['value'] < 1)) { - $errors[] = 'Conditional votes have to be formulated positively!' - . " Please select '+1' and change your text to a" - . " form like 'I am +1 on this if you change...'."; - } - foreach ($voteData['reviews'] as $value) { - if (!array_key_exists($value, $proposalReviewsMap)) { - $errors[] = 'Reviews contains invalid data'; - } - } - - if ($errors) { - report_error($errors); - } else { - $proposal->addVote($dbh, new ppVote($voteData)); - $proposal->sendActionEmail('proposal_vote', 'user', $docwebUser); - report_success('Your vote has been registered successfully'); - $form->removeElement('submit'); - $form->freeze(); - } - } else { - $pepr_form = $form->toArray(); - report_error($pepr_form['errors']); - } - } -} else { - $form = false; -} - -display_pepr_nav($proposal); - -?> - -<table border="0" cellspacing="0" cellpadding="2" style="width: 75%"> - -<?php - -if ($proposal->status == 'vote') { - echo " <tr>\n"; - echo ' <th class="headrow">&raquo; Cast Your Vote</th>' . "\n"; - echo " </tr>\n"; - echo " <tr>\n"; - - if ($form) { - echo ' <td class="textcell" valign="top">' . "\n"; - - // Cron job runs at 0 am - $pepr_end = mktime(0, 0, 0, date('m', $proposal->vote_date), - date('d', $proposal->vote_date), - date('Y', $proposal->vote_date)); - - if (date('H', $proposal->vote_date) > '03') { - // add a day - $pepr_end += 86400; - } - - if ($proposal->longened_date) { - $pepr_end += PROPOSAL_STATUS_VOTE_TIMELINE * 2; - } else { - $pepr_end += PROPOSAL_STATUS_VOTE_TIMELINE; - } - echo ' <p>Voting Will End approximately '; - echo make_utc_date($pepr_end); - echo "</p>\n"; - - $formArray = $form->toArray(); - - echo $form->getValidationScript(); - - echo '<form ' . $formArray['attributes'] . ">\n"; - echo '<table class="form-holder" cellspacing="1">' . "\n"; - - echo ' <caption class="form-caption">Vote on This'; - echo ' Proposal</caption>' . "\n"; - - echo " <tr>\n"; - echo ' <th class="form-label_left">'; - echo ' <label for="vote_field" accesskey="o">V<span'; - echo ' class="accesskey">o</span>te:</label>'; - echo " </th>\n"; - echo ' <td class="form-input">'; - echo $formArray['elements'][0]['html'] . ' ' . $formArray['elements'][0]['label'] . "</td>\n"; - echo " </tr>\n"; - - echo " <tr>\n"; - echo ' <th class="form-label_left">Conditional:</th>' . "\n"; - echo ' <td class="form-input">'; - echo $formArray['elements'][1]['html'] . "</td>\n"; - echo " </tr>\n"; - - echo " <tr>\n"; - echo ' <th class="form-label_left">Comment:</th>' . "\n"; - echo ' <td class="form-input">'; - echo $formArray['elements'][2]['html'] . "</td>\n"; - echo " </tr>\n"; - - echo " <tr>\n"; - echo ' <th class="form-label_left">Reviews:</th>' . "\n"; - echo ' <td class="form-input">'; - echo $formArray['elements'][3]['html'].$formArray['elements'][3]['label'] . "</td>\n"; - echo " </tr>\n"; - - echo " <tr>\n"; - echo ' <th class="form-label_left"></th>' . "\n"; - echo ' <td class="form-input">'; - echo $formArray['elements'][4]['html'] . "</td>\n"; - echo " </tr>\n"; - - echo " <tr>\n"; - echo ' <th class="form-label_left"></th>' . "\n"; - echo ' <td class="form-input">'; - echo $formArray['elements'][5]['html'] . "</td>\n"; - echo " </tr>\n"; - - echo "</table>\n"; - echo "</form>\n"; - } else { - ?> - - <td class="ulcell" valign="top"> - <ul> - <li>You must be a full-featured PEAR developer.</li> - <li>You must be <a href="/login.php?return=<?php echo $_SERVER['REQUEST_URI']; ?>">logged in</a>.</li> - <li>Only one vote can be cast.</li> - <li>Proposers can not vote on their own package.</li> - </ul> - - <?php - } - - echo " </td>\n"; - echo " </tr>\n"; - -} - -echo " <tr>\n"; -echo ' <th class="headrow">&raquo; Votes</th>' . "\n"; -echo " </tr>\n"; -echo " <tr>\n"; - -switch ($proposal->status) { - case 'draft': - case 'proposal': - echo ' <td class="textcell" valign="top">'; - echo 'Voting has not started yet.'; - break; - - default: - $proposal->getVotes($dbh); - if (count($proposal->votes) == 0) { - echo ' <td class="textcell" valign="top">'; - echo 'No votes have been cast yet.'; - } else { - $users = array(); - $head = true; - - echo ' <td class="ulcell" valign="top">' . "\n<ul>\n"; - - foreach ($proposal->votes as $vote) { - if (!isset($users[$vote->user_handle])) { - $users[$vote->user_handle] = array('name'=>user_name($vote->user_handle)); - } - if ($vote->value > 0) { - $vote->value = '+' . $vote->value; - } - - echo ' <li><strong>'; - print_link('rfc-vote-show.php?id=' . $proposal->id - . '&amp;handle=' - . htmlspecialchars($vote->user_handle), - $vote->value); - echo '</strong>'; - - if ($vote->is_conditional) { - echo '^'; - } elseif ($vote->comment != '-') { - echo '*'; - } - echo ' &nbsp;('; - print_link('/user/' . htmlspecialchars($vote->user_handle), - htmlspecialchars($users[$vote->user_handle]['name'])); - echo ')&nbsp; ' . make_utc_date($vote->timestamp); - echo "</li>\n"; - } - - $proposalVotesSum = ppVote::getSum($dbh, $proposal->id); - - echo "</ul>\n" . '<p style="padding-left: 1.2em;"><strong>'; - echo 'Sum: ' . $proposalVotesSum['all'] . '</strong> <small>('; - echo $proposalVotesSum['conditional']; - echo ' conditional)</small></p>' . "\n"; - echo '<p style="padding-left: 1.2em;"><small>^ Indicates'; - echo ' the vote is conditional.' . "\n"; - echo '<br />* Indicates'; - echo ' the vote contains a comment.</small></p>' . "\n"; - } -} - -echo " </td>\n"; -echo " </tr>\n"; -echo "</table>\n"; - -echo site_footer(); - -?>
« previous php.doc.web (#2309) next »