cvs: pearweb /public_html/pepr pepr-proposal-edit.php

From: Date: Thu, 08 Apr 2004 15:03:31 +0000
Subject: cvs: pearweb /public_html/pepr pepr-proposal-edit.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-18021@lists.php.net to get a copy of this message
toby Thu Apr 8 11:03:31 2004 EDT Modified files: /pearweb/public_html/pepr pepr-proposal-edit.php Log: * Switched to $proposal->mayEdit() method. * Cleanup. http://cvs.php.net/diff.php/pearweb/public_html/pepr/pepr-proposal-edit.php?r1=1.15&r2=1.16&ty=u Index: pearweb/public_html/pepr/pepr-proposal-edit.php diff -u pearweb/public_html/pepr/pepr-proposal-edit.php:1.15 pearweb/public_html/pepr/pepr-proposal-edit.php:1.16 --- pearweb/public_html/pepr/pepr-proposal-edit.php:1.15 Tue Mar 16 15:38:51 2004 +++ pearweb/public_html/pepr/pepr-proposal-edit.php Thu Apr 8 11:03:31 2004 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ | Authors: Tobias Schlitt <toby@php.net> | +----------------------------------------------------------------------+ - $Id: pepr-proposal-edit.php,v 1.15 2004/03/16 20:38:51 toby Exp $ + $Id: pepr-proposal-edit.php,v 1.16 2004/04/08 15:03:31 toby Exp $ */ require_once 'pepr/pepr.php'; @@ -33,26 +33,9 @@ PEAR::raiseError("Package proposal not found."); } - if (!$proposal->isFromUser($_COOKIE['PEAR_USER']) && !$karma->has($_COOKIE['PEAR_USER'], "pear.pepr.admin")) { - PEAR::raiseError("You did not create this proposal!"); + if (!$proposal->mayEdit($_COOKIE['PEAR_USER'])) { + PEAR::raiseError("Proposal can not be edited."); } - - if ( - ( - ( - ($proposal->status == "vote") || ($proposal->status == "finished") - ) - && ( - !$karma->has($_COOKIE['PEAR_USER'], "pear.pepr.admin") - || ($proposal->user_handle == $_COOKIE['PEAR_USER']) - ) - ) - - && empty($next_stage) - ) { - PEAR::raiseError("This proposal can not be edited, because it's status is later than proposal."); - } - $proposal->getLinks($dbh); } @@ -166,29 +149,32 @@ } 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', $_COOKIE['PEAR_USER']); - } else { - PEAR::raiseError("You can not change the status now."); - } + case 'draft': + if ($proposal->checkTimeLine()) { + $values['proposal_date'] = time(); + $proposal->status = 'proposal'; + $proposal->sendActionEmail('change_status_proposal', 'mixed', $_COOKIE['PEAR_USER']); + } 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', $_COOKIE['PEAR_USER']); - } else { - PEAR::raiseError("You can not change the status now."); - } + case 'proposal': + if ($proposal->checkTimeLine()) { + $values['vote_date'] = time(); + $proposal->status = 'vote'; + $proposal->sendActionEmail('change_status_vote', 'mixed', $_COOKIE['PEAR_USER']); + } else { + PEAR::raiseError("You can not change the status now."); + } break; - default: if ($karma->has($_COOKIE['PEAR_USER'], "pear.pepr.admin")) { - $values['longened_date'] = time(); - $proposal->status = 'vote'; - $proposal->sendActionEmail('longened_timeline_admin', 'mixed', $_COOKIE['PEAR_USER']); - } + default: + if ($proposal->mayEdit($_COOKIE['PEAR_USER'])) { + $values['longened_date'] = time(); + $proposal->status = 'vote'; + $proposal->sendActionEmail('longened_timeline_admin', 'mixed', $_COOKIE['PEAR_USER']); + } break; } } else { @@ -242,7 +228,7 @@ case 'vote': $bbox['header'] = "Call for votes"; $bbox['text'] = "For your package has been called for votes on pear-dev. No further changes are allowed."; - if ($karma->has($_COOKIE['PEAR_USER'], "pear.pepr.admin") && ($proposal->user_handle != $_COOKIE['PEAR_USER'])) { + if ($proposal->mayEdit($_COOKIE['PEAR_USER'])) { $form->addElement('link', 'link_package_edit', '', 'pepr-proposal-edit.php?id='.$id, 'Edit the proposal'); } break; @@ -279,4 +265,4 @@ response_footer(); -?> +?> \ No newline at end of file

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