cvs: pearweb /include/pepr pepr.php
| From: | Tobias Schlitt | Date: | Thu, 08 Apr 2004 15:01:24 +0000 |
| Subject: | cvs: pearweb /include/pepr pepr.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-18019@lists.php.net to get a copy of this message | ||
toby Thu Apr 8 11:01:24 2004 EDT
Modified files:
/pearweb/include/pepr pepr.php
Log:
* Renamed isFromUser to isOwner (sounds better).
* Added new method mayEdit().
http://cvs.php.net/diff.php/pearweb/include/pepr/pepr.php?r1=1.26&r2=1.27&ty=u
Index: pearweb/include/pepr/pepr.php
diff -u pearweb/include/pepr/pepr.php:1.26 pearweb/include/pepr/pepr.php:1.27
--- pearweb/include/pepr/pepr.php:1.26 Wed Mar 24 04:16:19 2004
+++ pearweb/include/pepr/pepr.php Thu Apr 8 11:01:24 2004
@@ -197,14 +197,32 @@
$this->links[] =& $link;
return true;
}
-
- function isFromUser ( $handle ) {
+
+ function isOwner ($handle) {
if (strtolower($this->user_handle) != strtolower($handle)) {
return false;
}
return true;
}
+ function mayEdit ( $handle ) {
+ $karma = new Damblan_Karma($dbh);
+ switch ($this->status) {
+ case 'draft':
+ case 'proposal':
+ if ($this->isOwner($handle) || $karma->has($handlel,
'pear.pepr.admin')) {
+ return true;
+ }
+ break;
+ default:
+ if (!$this->isOwner($handle) && $karma->has($handlel,
'pear.pepr.admin')) {
+ return true;
+ }
+ break;
+ }
+ return false;
+ }
+
function getStatus ( $humanReadable = false ) {
if ($humanReadable) {
return $GLOBALS['proposalStatiMap'][$this->status];