cvs: docweb /include lib_auth.inc.php /include/rfc rfc.php /www/rfc rfc-comments-show.php rfc-overview.php rfc-proposal-delete.php rfc-proposal-edit.php rfc-proposal-show.php rfc-votes-show.php

[email protected] ("Vincent Gevers")
Newsgroups php.doc.web
Message-ID <cvsvincent1122636289@cvsserver>
vincent		Fri Jul 29 07:24:49 2005 EDT

  Modified files:              
    /docweb/include	lib_auth.inc.php 
    /docweb/include/rfc	rfc.php 
    /docweb/www/rfc	rfc-comments-show.php rfc-overview.php 
                   	rfc-proposal-delete.php rfc-proposal-edit.php 
                   	rfc-proposal-show.php rfc-votes-show.php 
  Log:
  First steps to make the RFC system use real usernames.
  Also added myself in the admins list so I can test the rfc system on the
  doc.php.net server
vincent-20050729072449.txt (text/plain, 23.4 KB)
http://cvs.php.net/diff.php/docweb/include/lib_auth.inc.php?r1=1.4&r2=1.5&ty=u
Index: docweb/include/lib_auth.inc.php
diff -u docweb/include/lib_auth.inc.php:1.4 docweb/include/lib_auth.inc.php:1.5
--- docweb/include/lib_auth.inc.php:1.4	Thu Jul 28 14:05:10 2005
+++ docweb/include/lib_auth.inc.php	Fri Jul 29 07:24:46 2005
@@ -16,7 +16,7 @@
  * | Authors: Jacques Marneweck <[email protected]>                         |
  * +----------------------------------------------------------------------+
  *
- * $Id: lib_auth.inc.php,v 1.4 2005/07/28 18:05:10 nlopess Exp $
+ * $Id: lib_auth.inc.php,v 1.5 2005/07/29 11:24:46 vincent Exp $
  */
 
 require_once 'cvs-auth.inc';
@@ -29,6 +29,7 @@
 	'nlopess',
 	'philip',
 	'sean',
+	'vincent',
 );
 
 $user = $pw = false;
@@ -39,7 +40,7 @@
  */
 function read_magic_cookie()
 {
-	return explode(':', base64_decode($_COOKIE['MAGIC_COOKIE']));
+	return explode(':', base64_decode(@$_COOKIE['MAGIC_COOKIE']));
 }
 
 
http://cvs.php.net/diff.php/docweb/include/rfc/rfc.php?r1=1.12&r2=1.13&ty=u
Index: docweb/include/rfc/rfc.php
diff -u docweb/include/rfc/rfc.php:1.12 docweb/include/rfc/rfc.php:1.13
--- docweb/include/rfc/rfc.php:1.12	Fri Sep 24 13:32:19 2004
+++ docweb/include/rfc/rfc.php	Fri Jul 29 07:24:49 2005
@@ -24,7 +24,7 @@
  * @author    Daniel Convissor <[email protected]>
  * @copyright Copyright (c) 1997-2004 The PHP Group
  * @license   http://www.php.net/license/3_0.txt  PHP License
- * @version   $Id: rfc.php,v 1.12 2004/09/24 17:32:19 sean Exp $
+ * @version   $Id: rfc.php,v 1.13 2005/07/29 11:24:49 vincent Exp $
  */
 
 $path = realpath(dirname(__FILE__));
@@ -32,7 +32,14 @@
 require_once 'DB.php';
 require_once 'DB/storage.php'; 
 require_once $path . '/rfc-config.php';
-require_once $path . '/../../include/init.inc.php';
+require_once $path . '/../init.inc.php';
+require_once $path . '/../lib_auth.inc.php';
+
+
+list($docwebUser) = read_magic_cookie();
+if ($docwebUser === '') {
+    unset($docwebUser);
+}    
 
 define('PEAR_DATABASE_DSN', 'sqlite:///'.$path.'/../../sqlite/rfc.sqlite');
 
@@ -243,10 +250,6 @@
 require_once 'HTML/QuickForm.php';
 require_once 'Mail.php';
 
-// HACK // !!!
-$_COOKIE['PEAR_USER'] = 'TestUser';
-
-
 /**
  * Prints the navigation tabs
  *
@@ -256,6 +259,7 @@
  */
 function display_pepr_nav(&$proposal)
 {
+    global  $docwebUser;
     if ($proposal == null) {
         $id = 0;
     } else {
@@ -283,8 +287,8 @@
     }                        
 
     if ($proposal != null &&
-        isset($_COOKIE['PEAR_USER']) &&
-        $proposal->mayEdit($_COOKIE['PEAR_USER'])) // !!!
+        isset($docwebUser) &&
+        $proposal->mayEdit($docwebUser))
     {
         $items['Edit'] = array(
             'url'   => 'rfc-proposal-edit.php?id=' . $id,
@@ -552,8 +556,9 @@
 
     function addComment($comment, $table = 'package_proposal_changelog')
     {
+        global $docwebUser;
         $commentData = array("pkg_prop_id" => $this->id,
-                             "user_handle" => $_COOKIE['PEAR_USER'],
+                             "user_handle" => $docwebUser,
                              "comment"     => $comment);
         $comment = new ppComment( $commentData, $table );
         $comment->store($this->id);
@@ -576,23 +581,17 @@
     }
 
     function mayEdit($handle = '')
-    { // !!!
-        global $dbh, $karma;
-
-return true; // !!!
-        if (empty($karma)) {
-            $karma =& new Damblan_Karma($dbh); // !!!
-        }
+    {
 
         switch ($this->status) {
             case 'draft':
             case 'proposal':
-                if ($this->isOwner($handle) || $karma->has($handle, 'pear.pepr.admin')) { // !!!
+                if ($this->isOwner($handle) || is_admin()) {
                     return true;
                 }
               break;
             default:
-                if (!$this->isOwner($handle) && $karma->has($handle, 'pear.pepr.admin')) { // !!!
+                if (!$this->isOwner($handle) && is_admin()) {
                     return true;
                 }
                 break;
@@ -618,15 +617,9 @@
      * @access public
      */
     function mayVote(&$dbh, $userHandle)
-    {  // !!! needs karma fixing
-        global $karma;
-return true; // !!!
-        if (empty($karma)) {
-            $karma =& new Damblan_Karma($dbh);
-        }
+    {
 
         if ($this->getStatus() == 'vote' &&
-            $karma->has($userHandle, 'pear.dev') &&
             !ppVote::hasVoted($dbh, $userHandle, $this->id) &&
             (!$this->isOwner($userHandle) ||
              ($this->isOwner($userHandle) &&
@@ -757,11 +750,7 @@
 
     function sendActionEmail($event, $userType, $user_handle = null, $comment = '')
     { // !!!
-        global $dbh, $karma, $auth;
-
-        if (empty($karma)) {
-         //   $karma =& new Damblan_Karma($dbh); // !!!
-        }
+        global $dbh;
 
         $master_url = 'http://doc.php.net/';
         require dirname(__FILE__) . '/rfc-emails.php';
@@ -774,7 +763,7 @@
             $prefix = "[ADMIN]";
             break;
         case 'mixed':
-            if (/*$karma->has($user_handle, "pear.pepr.admin") && */($this->user_handle != $user_handle)) { // !!!
+            if (is_admin() && ($this->user_handle != $user_handle)) {
                 $prefix = "[ADMIN]";
             } else {
                 $prefix = "";
@@ -784,8 +773,8 @@
             $prefix = "";
         }
         $prefix = PROPOSAL_EMAIL_PREFIX . $prefix . " ";
-        $actorinfo = 'TestUser';//user::info($user_handle); // !!!
-        $ownerinfo = 'TestOwner';//user::info($this->user_handle); // !!!
+        $actorinfo = $user_handle; // !!!
+        $ownerinfo = $this->user_handle; // !!!
         $this->getVotes($dbh);
         $vote = @$this->votes[$user_handle];
 
@@ -819,8 +808,8 @@
 
         if (!isset($user_handle)) {
             $email['to'] = $email['to']['pearweb'];
-      //  } else if ($karma->has($user_handle, "pear.pepr.admin")) { // !!!
-      //      $email['to'] = $email['to']['admin'];
+        } else if (is_admin()) {
+            $email['to'] = $email['to']['admin'];
         } else {
             $email['to'] = $email['to']['user'];
         }
@@ -868,11 +857,11 @@
         $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 ;
-        }
+        //if (is_object($auth)) {
+        //    $from = '"' . $auth->name . '" <' . $auth->email . '>';
+       // } else {
+            $from = PROPOSAL_MAIL_FROM ; // !!!
+       // }
         
         $to = explode(", ", $email['to']);
         $email['to'] = array_shift($to);
http://cvs.php.net/diff.php/docweb/www/rfc/rfc-comments-show.php?r1=1.4&r2=1.5&ty=u
Index: docweb/www/rfc/rfc-comments-show.php
diff -u docweb/www/rfc/rfc-comments-show.php:1.4 docweb/www/rfc/rfc-comments-show.php:1.5
--- docweb/www/rfc/rfc-comments-show.php:1.4	Sun Sep 12 03:39:02 2004
+++ docweb/www/rfc/rfc-comments-show.php	Fri Jul 29 07:24:49 2005
@@ -19,7 +19,7 @@
  * @author    Daniel Convissor <[email protected]>
  * @copyright Copyright (c) 1997-2004 The PHP Group
  * @license   http://www.php.net/license/3_0.txt  PHP License
- * @version   $Id: rfc-comments-show.php,v 1.4 2004/09/12 07:39:02 vincent Exp $
+ * @version   $Id: rfc-comments-show.php,v 1.5 2005/07/29 11:24:49 vincent Exp $
  */
 
 /**
@@ -39,7 +39,7 @@
 echo site_header('RFC :: Comments :: ' . htmlspecialchars($proposal->pkg_name));
 echo '<h1>Comments for ' . htmlspecialchars($proposal->pkg_name) . "</h1>\n";
 
-if (isset($_COOKIE['PEAR_USER']) &&
+if (isset($docwebUser) &&
     $proposal->getStatus() == 'proposal')
 {
     $form =& new HTML_QuickForm('comment', 'post',
@@ -68,8 +68,7 @@
         if ($form->validate()) {
             $values = $form->exportValues();
             $proposal->sendActionEmail('proposal_comment', 'user',
-                                       $_COOKIE['PEAR_USER'],
-                                       $values['comment']);
+                                       $docwebUser, $values['comment']);
             $proposal->addComment($values['comment'],
                                   'package_proposal_comments');
             report_success('Your comment was successfully processed');
@@ -94,7 +93,7 @@
 <?php
 
 if ($proposal->getStatus() == 'proposal') {
-    if (isset($_COOKIE['PEAR_USER'])) {
+    if (isset($docwebUser)) {
         $formArray = $form->toArray();
 
         echo $form->getValidationScript();
http://cvs.php.net/diff.php/docweb/www/rfc/rfc-overview.php?r1=1.9&r2=1.10&ty=u
Index: docweb/www/rfc/rfc-overview.php
diff -u docweb/www/rfc/rfc-overview.php:1.9 docweb/www/rfc/rfc-overview.php:1.10
--- docweb/www/rfc/rfc-overview.php:1.9	Mon Nov  1 05:01:43 2004
+++ docweb/www/rfc/rfc-overview.php	Fri Jul 29 07:24:49 2005
@@ -22,7 +22,7 @@
  * @author    Daniel Convissor <[email protected]>
  * @copyright Copyright (c) 1997-2004 The PHP Group
  * @license   http://www.php.net/license/3_0.txt  PHP License
- * @version   $Id: rfc-overview.php,v 1.9 2004/11/01 10:01:43 nlopess Exp $
+ * @version   $Id: rfc-overview.php,v 1.10 2005/07/29 11:24:49 vincent Exp $
  */
 
 /**
@@ -87,10 +87,10 @@
     }
     
     $already_voted = false;
-    if (isset($_COOKIE['PEAR_USER']) && $proposal->getStatus(true) == "Called for Votes") {
+    if (isset($docwebUser) && $proposal->getStatus(true) == "Called for Votes") {
         $proposal->getVotes($dbh);
 
-        if (in_array($_COOKIE['PEAR_USER'], array_keys($proposal->votes))) {
+        if (in_array($docwebUser, array_keys($proposal->votes))) {
             $already_voted = true;
         }
     }
http://cvs.php.net/diff.php/docweb/www/rfc/rfc-proposal-delete.php?r1=1.3&r2=1.4&ty=u
Index: docweb/www/rfc/rfc-proposal-delete.php
diff -u docweb/www/rfc/rfc-proposal-delete.php:1.3 docweb/www/rfc/rfc-proposal-delete.php:1.4
--- docweb/www/rfc/rfc-proposal-delete.php:1.3	Sun Sep 12 03:39:02 2004
+++ docweb/www/rfc/rfc-proposal-delete.php	Fri Jul 29 07:24:49 2005
@@ -19,7 +19,7 @@
  * @author    Daniel Convissor <[email protected]>
  * @copyright Copyright (c) 1997-2004 The PHP Group
  * @license   http://www.php.net/license/3_0.txt  PHP License
- * @version   $Id: rfc-proposal-delete.php,v 1.3 2004/09/12 07:39:02 vincent Exp $
+ * @version   $Id: rfc-proposal-delete.php,v 1.4 2005/07/29 11:24:49 vincent Exp $
  */
 
 /**
@@ -29,8 +29,6 @@
 require_once $path . '/../../include/rfc/rfc.php';
 
 
-//auth_require('pear.pepr'); // deleting is something for admins
-
 if (!empty($_GET['isDeleted'])) {
     echo site_header('RFC :: Delete');
     echo "<h1>Delete Proposal</h1>\n";
@@ -55,24 +53,23 @@
 echo site_header('RFC :: Delete :: ' . htmlspecialchars($proposal->pkg_name));
 echo '<h1>Delete Proposal ' . htmlspecialchars($proposal->pkg_name) . "</h1>\n";
 
-if (!$proposal->mayEdit($_COOKIE['PEAR_USER'])) {
+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 pear.pepr.admin karma.');
+                 . ' who has admin karma.');
     echo site_footer();
     exit;
 }
 
 if ($proposal->compareStatus('>', 'proposal')) {
-//    $karma =& new Damblan_Karma($dbh);
-//    if ($karma->has($_COOKIE['PEAR_USER'], 'pear.pepr.admin')) {
+    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',
@@ -89,8 +86,7 @@
 if (isset($_POST['submit'])) {
     if ($form->validate()) {
         $proposal->delete($dbh);
-        $proposal->sendActionEmail('proposal_delete', 'mixed',
-                                   $_COOKIE['PEAR_USER']);
+        $proposal->sendActionEmail('proposal_delete', 'mixed', $docwebUser);
         ob_end_clean();
         header('Location: rfc-proposal-delete.php?id=' . $proposal->id . '&isDeleted=1');
     } else {
http://cvs.php.net/diff.php/docweb/www/rfc/rfc-proposal-edit.php?r1=1.13&r2=1.14&ty=u
Index: docweb/www/rfc/rfc-proposal-edit.php
diff -u docweb/www/rfc/rfc-proposal-edit.php:1.13 docweb/www/rfc/rfc-proposal-edit.php:1.14
--- docweb/www/rfc/rfc-proposal-edit.php:1.13	Mon Sep 13 13:02:47 2004
+++ docweb/www/rfc/rfc-proposal-edit.php	Fri Jul 29 07:24:49 2005
@@ -22,7 +22,7 @@
  * @author    Daniel Convissor <[email protected]>
  * @copyright Copyright (c) 1997-2004 The PHP Group
  * @license   http://www.php.net/license/3_0.txt  PHP License
- * @version   $Id: rfc-proposal-edit.php,v 1.13 2004/09/13 17:02:47 vincent Exp $
+ * @version   $Id: rfc-proposal-edit.php,v 1.14 2005/07/29 11:24:49 vincent Exp $
  */
 
 /**
@@ -35,21 +35,10 @@
  */
 require_once 'HTML/BBCodeParser.php';
 
-//auth_require('pear.pepr'); // !!!
-
-//$karma =& new Damblan_Karma($dbh);
-
-// !!! hack !!! karma system should replace this
-function is_admin ()
-{
-return true;
-}
-
 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);
@@ -59,7 +48,7 @@
 if (isset($_GET['delete']) AND !empty($_GET['delete'])) {
 
 if (strlen($_GET['delete']) >= 32 &&
-        strpos($_GET['delete'], "..") === FALSE && (($_COOKIE['PEAR_USER'] == $proposal->user_handle) || is_admin())) {
+        strpos($_GET['delete'], "..") === FALSE && (($docwebUser == $proposal->user_handle) || is_admin())) {
         
         $hash = substr($_GET['delete'], -32);
         $file = substr($_GET['delete'], 0, -32);
@@ -88,7 +77,7 @@
 
 
 // !!!
-    if (!$proposal->mayEdit($_COOKIE['PEAR_USER']) && empty($_GET['next_stage'])) {
+    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.'
@@ -99,9 +88,8 @@
     }
     
 
-    if ($proposal->compareStatus('>', 'proposal')/* &&
-        $karma->has($_COOKIE['PEAR_USER'], 'pear.pepr.admin')*/ &&
-        empty($_GET['next_stage']))
+    if ($proposal->compareStatus('>', 'proposal') && 
+        is_admin() && empty($_GET['next_stage']))
     {
         report_error('This proposal has reached the "'
                      . $proposal->getStatus(true) . '" phase.'
@@ -154,7 +142,7 @@
 
 $form->addElement('text', 'pkg_name', 'Name:');
 
-$form->addElement('textarea', 'pkg_describtion', 'Description:', array('rows' => 20, 'cols' => '80'));
+$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'));
@@ -250,8 +238,8 @@
 
         case 'vote':
         default:
-            if (/*$karma->has($_COOKIE['PEAR_USER'], 'pear.pepr.admin') &&*/ // !!!
-	     ($proposal->user_handle != $_COOKIE['PEAR_USER'])) {
+            if (is_admin() &&
+	     ($proposal->user_handle != $docwebUser)) {
                 $next_stage_text = 'Extend vote time';
             } else {
                 $next_stage_text = '';
@@ -262,8 +250,8 @@
     $timeline = $proposal->checkTimeLine();
     
     if (!empty($next_stage_text)) {
-        if (($timeline === true) /*|| ($karma->has($_COOKIE['PEAR_USER'], 'pear.pepr.admin') && 
-            ($proposal->user_handle != $_COOKIE['PEAR_USER'])))*/) { // !!!
+        if (($timeline === true) || (is_admin() && 
+            ($proposal->user_handle != $docwebUser))) {
             $form->addElement('checkbox', 'next_stage', $next_stage_text);
         } else {
             $form->addElement('static', 'next_stage', '',
@@ -315,7 +303,7 @@
                     if ($proposal->checkTimeLine()) {
                        $values['proposal_date'] = time();
                        $proposal->status = 'proposal';
-                       $proposal->sendActionEmail('change_status_proposal', 'mixed', $_COOKIE['PEAR_USER']);
+                       $proposal->sendActionEmail('change_status_proposal', 'mixed', $docwebUser);
                     } else {
                        PEAR::raiseError('You can not change the status now.');
                     }
@@ -325,28 +313,28 @@
                     if ($proposal->checkTimeLine()) {
                        $values['vote_date'] = time();
                        $proposal->status = 'vote';
-                       $proposal->sendActionEmail('change_status_vote', 'mixed', $_COOKIE['PEAR_USER']);
+                       $proposal->sendActionEmail('change_status_vote', 'mixed', $docwebUser);
                     } else {
                        PEAR::raiseError('You can not change the status now.');
                     }
                     break;
 
                 default:
-                    if ($proposal->mayEdit($_COOKIE['PEAR_USER'])) {
+                    if ($proposal->mayEdit($docwebUser)) {
                        $values['longened_date'] = time();
                        $proposal->status = 'vote';
-                       $proposal->sendActionEmail('longened_timeline_admin', 'mixed', $_COOKIE['PEAR_USER']);
+                       $proposal->sendActionEmail('longened_timeline_admin', 'mixed', $docwebUser);
                     }
             }
         } else {
             if (isset($proposal) && $proposal->status != 'draft') {
-                if (!empty($values['action_comment']) ) /*|| ($karma->has($_COOKIE['PEAR_USER'], "pear.pepr.admin") &&
-		 ($proposal->user_handle != $_COOKIE['PEAR_USER'])))*/ { // !!!
+                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', $_COOKIE['PEAR_USER'], $values['action_comment']);
+                    $proposal->sendActionEmail('edit_proposal', 'mixed', $docwebUser, $values['action_comment']);
                 }
             }
         }
@@ -357,7 +345,7 @@
             $proposal->fromArray($values);
         } else {
             $proposal = new proposal($values);
-            $proposal->user_handle = $_COOKIE['PEAR_USER'];
+            $proposal->user_handle = $docwebUser;
         }
 
         unset($proposal->links);
@@ -401,10 +389,10 @@
                     . ' No further changes are allowed.';
             break;
     }
-   // if ($karma->has($_COOKIE['PEAR_USER'], 'pear.pepr.admin')) { // !!!
+    if (is_admin()) {
         $bbox[] = 'Your changes were recorded and necessary emails'
                 . ' were sent.';
-   // } // !!!
+    }
     if ($bbox) {
         report_success(implode(' ', $bbox));
     }
http://cvs.php.net/diff.php/docweb/www/rfc/rfc-proposal-show.php?r1=1.11&r2=1.12&ty=u
Index: docweb/www/rfc/rfc-proposal-show.php
diff -u docweb/www/rfc/rfc-proposal-show.php:1.11 docweb/www/rfc/rfc-proposal-show.php:1.12
--- docweb/www/rfc/rfc-proposal-show.php:1.11	Wed Sep 15 07:54:44 2004
+++ docweb/www/rfc/rfc-proposal-show.php	Fri Jul 29 07:24:49 2005
@@ -19,7 +19,7 @@
  * @author    Daniel Convissor <[email protected]>
  * @copyright Copyright (c) 1997-2004 The PHP Group
  * @license   http://www.php.net/license/3_0.txt  PHP License
- * @version   $Id: rfc-proposal-show.php,v 1.11 2004/09/15 11:54:44 vincent Exp $
+ * @version   $Id: rfc-proposal-show.php,v 1.12 2005/07/29 11:24:49 vincent Exp $
  */
 
 /**
@@ -265,8 +265,8 @@
     echo "<ul>\n";
     foreach ($changelog as $comment) {
         if (!isset($userinfos[$comment->user_handle])) {
-          //  $userinfo[$comment->user_handle] = user::info($comment->user_handle); // !!!
-          $userinfo[$comment->user_handle] = array('name'=>'TestUser');
+          //$userinfo[$comment->user_handle] = user::info($comment->user_handle); // !!!
+          $userinfo[$comment->user_handle] = array('name'=> $comment->user_handle);
         }
         echo '<li><p style="margin: 0em 0em 0.3em 0em; font-size: 90%;">';
         echo htmlspecialchars($userinfo[$comment->user_handle]['name']);
http://cvs.php.net/diff.php/docweb/www/rfc/rfc-votes-show.php?r1=1.4&r2=1.5&ty=u
Index: docweb/www/rfc/rfc-votes-show.php
diff -u docweb/www/rfc/rfc-votes-show.php:1.4 docweb/www/rfc/rfc-votes-show.php:1.5
--- docweb/www/rfc/rfc-votes-show.php:1.4	Sun Sep 12 03:39:02 2004
+++ docweb/www/rfc/rfc-votes-show.php	Fri Jul 29 07:24:49 2005
@@ -19,7 +19,7 @@
  * @author    Daniel Convissor <[email protected]>
  * @copyright Copyright (c) 1997-2004 The PHP Group
  * @license   http://www.php.net/license/3_0.txt  PHP License
- * @version   $Id: rfc-votes-show.php,v 1.4 2004/09/12 07:39:02 vincent Exp $
+ * @version   $Id: rfc-votes-show.php,v 1.5 2005/07/29 11:24:49 vincent Exp $
  */
 
 /**
@@ -40,7 +40,7 @@
 echo site_header('RFC :: Votes :: ' . htmlspecialchars($proposal->pkg_name));
 echo '<h1>Proposal Votes for ' . htmlspecialchars($proposal->pkg_name) . "</h1>\n";
 
-if ($proposal->mayVote($dbh, @$_COOKIE['PEAR_USER'])) { // !!!
+if ($proposal->mayVote($dbh, @$docwebUser)) {
     $form =& new HTML_QuickForm('vote', 'post',
                                 'rfc-votes-show.php?id=' . $proposal->id);
 
@@ -58,7 +58,7 @@
                       array('size' => count($proposalReviewsMap),
                             'multiple' => 'multiple'));
     $form->addElement('static', '', '',
-                      '<small>Note that you can only vote once!(Modified for testing!)<br />'
+                      '<small>Note that you can only vote once!(Modified for testing!)<br />' // !!!
                       . 'For conditional votes, please leave a comment and'
                       . ' vote +1 (<i>e.g.</i>, &quot;I\'m +1 if you'
                       . ' change...&quot;).</small>');
@@ -83,7 +83,7 @@
             $voteData['comment'] = $comment->getValue();
             $reviews = $form->getElement('reviews');
             $voteData['reviews'] = $reviews->getSelected();
-            $voteData['user_handle'] = $_COOKIE['PEAR_USER'];
+            $voteData['user_handle'] = $docwebUser;
 
             $errors = array();
 
@@ -106,8 +106,7 @@
                 report_error($errors);
             } else {
                 $proposal->addVote($dbh, new ppVote($voteData));
-                $proposal->sendActionEmail('proposal_vote', 'user',
-                                            $_COOKIE['PEAR_USER']);
+                $proposal->sendActionEmail('proposal_vote', 'user', $docwebUser);
                 report_success('Your vote has been registered successfully');
                 $form->freeze();
             }
@@ -252,7 +251,7 @@
             foreach ($proposal->votes as $vote) {
                 if (!isset($users[$vote->user_handle])) {
                    // $users[$vote->user_handle] =& user::info($vote->user_handle); // !!!
-		   $users[$vote->user_handle] = array('name'=>'TestUser');
+		   $users[$vote->user_handle] = array('name'=>$vote->user_handle);
                 }
                 if ($vote->value > 0) {
                     $vote->value = '+' . $vote->value;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.