cvs: pearweb /include/pepr pepr.php
| From: | Helgi �ormar �orbj�rnsson | Date: | Fri, 21 Mar 2008 19:25:50 +0000 |
| Subject: | cvs: pearweb /include/pepr pepr.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-7353@lists.php.net to get a copy of this message | ||
dufuz Fri Mar 21 19:25:50 2008 UTC
Modified files:
/pearweb/include/pepr pepr.php
Log:
Cosmetics
http://cvs.php.net/viewvc.cgi/pearweb/include/pepr/pepr.php?r1=1.76&r2=1.77&diff_format=u
Index: pearweb/include/pepr/pepr.php
diff -u pearweb/include/pepr/pepr.php:1.76 pearweb/include/pepr/pepr.php:1.77
--- pearweb/include/pepr/pepr.php:1.76 Mon Jan 21 20:52:13 2008
+++ pearweb/include/pepr/pepr.php Fri Mar 21 19:25:49 2008
@@ -22,7 +22,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright Copyright (c) 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License
- * @version $Id: pepr.php,v 1.76 2008/01/21 20:52:13 dufuz Exp $
+ * @version $Id: pepr.php,v 1.77 2008/03/21 19:25:49 dufuz Exp $
*/
/**#@+
@@ -43,16 +43,13 @@
{
global $auth_user;
- /* There is no point to have a pepr navigation bar for
- a new proposal
- */
+ // There is no point to have a pepr navigation bar for a new proposal
if ($proposal == null || isset($_GET['old'])) {
- $id = 0;
return;
- } else {
- $id = $proposal->id;
}
+ $id = $proposal->id;
+
$items = array(
'Main' => array('url' =>
'pepr-proposal-show.php?id=' . $id,
'title' => 'View proposal details'
@@ -65,9 +62,8 @@
),
);
- if ($proposal != null &&
- isset($auth_user) && $auth_user &&
- $proposal->mayEdit($auth_user->handle))
+ if ($proposal != null && isset($auth_user) && $auth_user
+ && $proposal->mayEdit($auth_user->handle))
{
$items['Edit'] = array(
'url' => 'pepr-proposal-edit.php?id=' . $id,
@@ -90,7 +86,7 @@
print_tabbed_navigation($items);
}
-function display_overview_nav ()
+function display_overview_nav()
{
global $proposalStatiMap;
$items = array(
@@ -107,19 +103,16 @@
print_tabbed_navigation($items);
}
-
-
function shorten_string($string)
{
if (strlen($string) < 80) {
return $string;
}
$string_new = substr($string, 0, 20);
- $string_new .= "..." . substr($string, (strlen($string) - 60));
+ $string_new .= '...' . substr($string, (strlen($string) - 60));
return $string_new;
}
-
global $proposalStatiMap;
$proposalStatiMap = array(
'draft' => 'Draft',
@@ -129,39 +122,25 @@
);
-class proposal {
-
+class proposal
+{
var $id;
-
var $pkg_category;
-
var $pkg_name;
-
var $pkg_license;
-
var $pkg_description;
-
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)
+ function __construct($dbhResArr)
{
$this->fromArray($dbhResArr);
}
@@ -193,7 +172,7 @@
);
}
- function getParsedDescription ()
+ function getParsedDescription()
{
if (empty($this->pkg_description)) {
return '';
@@ -482,11 +461,7 @@
$res->getUserInfo());
}
}
- if (function_exists('mysql_insert_id')) {
- $this->id = mysql_insert_id($dbh->connection);
- } else {
- $this->id = mysqli_insert_id($dbh->connection);
- }
+ $this->id = mysqli_insert_id($dbh->connection);
}
ppLink::deleteAll($dbh, $this->id);
foreach ($this->links as $link) {
@@ -661,26 +636,18 @@
switch ($this->status) {
case 'draft':
return true;
-
case 'proposal':
- if (($this->proposal_date + PROPOSAL_STATUS_PROPOSAL_TIMELINE) <
- time())
- {
+ 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())
- {
+ 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())
- {
+ if (($this->vote_date + PROPOSAL_STATUS_VOTE_TIMELINE) > time()) {
return (int)($this->vote_date + PROPOSAL_STATUS_VOTE_TIMELINE);
}
}
@@ -861,7 +828,7 @@
if (!DEVBOX) {
$res = mail($email['to'], $email['subject'],
$email['text'],
- $headers, '-f bounce-no-user@php.net');
+ $headers, '-f ' . PEAR_BOUNCE_EMAIL);
} else {
$res = true;
}
@@ -872,21 +839,15 @@
}
}
-
-
-class ppComment {
-
+class ppComment
+{
var $pkg_prop_id;
-
var $user_handle;
-
var $timestamp;
-
var $comment;
-
var $table;
- function ppComment($dbhResArr, $table = 'package_proposal_changelog')
+ function __construct($dbhResArr, $table = 'package_proposal_changelog')
{
foreach ($dbhResArr as $name => $value) {
$this->$name = $value;
@@ -953,23 +914,17 @@
'deep' => 'Deep source review',
'test' => 'Run examples');
-class ppVote {
-
+class ppVote
+{
var $pkg_prop_id;
-
var $user_handle;
-
var $value;
-
var $reviews;
-
var $is_conditional;
-
var $comment;
-
var $timestamp;
- function ppVote($dbhResArr)
+ function __construct($dbhResArr)
{
foreach ($dbhResArr as $name => $value) {
$this->$name = $value;
@@ -1066,15 +1021,13 @@
'pkg_example_source' => "Package example source
(.phps/.htm)",
'pkg_doc' => "Package documentation");
-class ppLink {
-
+class ppLink
+{
var $pkg_prop_id;
-
var $type;
-
var $url;
- function ppLink($dbhResArr)
+ function __construct($dbhResArr)
{
foreach ($dbhResArr as $name => $value) {
$this->$name = $value;
@@ -1083,8 +1036,8 @@
function &getAll(&$dbh, $proposalId)
{
- $sql = "SELECT * FROM package_proposal_links WHERE pkg_prop_id =
".$proposalId." ORDER BY type";
- $res = $dbh->query($sql);
+ $sql = 'SELECT * FROM package_proposal_links WHERE pkg_prop_id = ? ORDER BY
type';
+ $res = $dbh->query($sql, array($proposalId));
if (DB::isError($res)) {
return $res;
}
@@ -1097,8 +1050,8 @@
function deleteAll($dbh, $proposalId)
{
- $sql = "DELETE FROM package_proposal_links WHERE pkg_prop_id = ".$proposalId;
- $res = $dbh->query($sql);
+ $sql = 'DELETE FROM package_proposal_links WHERE pkg_prop_id = ?';
+ $res = $dbh->query($sql, array($proposalId));
return $res;
}
@@ -1115,6 +1068,7 @@
if ($humanReadable) {
return $GLOBALS['proposalTypeMap'][$this->type];
}
+
return $this->type;
}
-}
+}
\ No newline at end of file