From 9afa1445890254e867dd172a36f42484aec8916b Mon Sep 17 00:00:00 2001 From: xue <> Date: Wed, 28 Jun 2006 18:23:52 +0000 Subject: merge from 3.0 branch till 1208. --- .../protected/comments/QuickStartComments.php | 34 +++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'demos/quickstart/protected/comments/QuickStartComments.php') diff --git a/demos/quickstart/protected/comments/QuickStartComments.php b/demos/quickstart/protected/comments/QuickStartComments.php index c138bd94..7b504caf 100644 --- a/demos/quickstart/protected/comments/QuickStartComments.php +++ b/demos/quickstart/protected/comments/QuickStartComments.php @@ -18,7 +18,7 @@ class QuickStartComments * @var sqlite connection. */ private $_connection; - + /** * Sets the sqlite comment database file. */ @@ -26,7 +26,7 @@ class QuickStartComments { $this->_database = realpath(dirname(__FILE__).'/comments.db'); } - + /** * Closed the database connection. */ @@ -35,7 +35,7 @@ class QuickStartComments if(!is_null($this->_connection)) sqlite_close($this->_connection); } - + /** * @return resource sqlite database connection. */ @@ -45,7 +45,7 @@ class QuickStartComments $this->_connection = sqlite_open($this->_database); return $this->_connection; } - + /** * Quote database input data. */ @@ -53,7 +53,7 @@ class QuickStartComments { return sqlite_escape_string($value); } - + /** * Executes an sqlite query. * @param string SQL @@ -63,7 +63,7 @@ class QuickStartComments { return sqlite_query($this->getConnection(), $sql); } - + /** * Returns a row from the sqlite result. * @param resource sqlite result @@ -76,7 +76,7 @@ class QuickStartComments else return false; } - + /** * Fetch all the records for given SQL query. * @param string SQL query. @@ -90,7 +90,7 @@ class QuickStartComments $rows[] = $row; return $rows; } - + /** * Returns all the comments for a given page. * @param string specific page comments @@ -99,10 +99,10 @@ class QuickStartComments public function getComments($pageID) { $page = $this->quote($pageID); - $sql = "SELECT * FROM comments WHERE page=\"$page\" AND approved = 1 ORDER BY date_added ASC"; + $sql = "SELECT * FROM comments WHERE page='$page' AND approved = 1 ORDER BY date_added ASC"; return $this->fetchAll($sql); } - + /** * Adds a new comment for moderation. * @param string ID of the page to comment belongs @@ -117,11 +117,11 @@ class QuickStartComments $date_added = time(); $sql = <<query($sql); } - + /** * Update an existing comment. * @param string comment ID @@ -136,13 +136,13 @@ EOD; $comment = $this->quote($content); $page = $this->quote($page); $sql = <<query($sql); } - + /** * Delete a comment. * @param string comment ID @@ -152,7 +152,7 @@ EOD; $ID = intval($commentID); $this->query("DELETE FROM comments WHERE id=$ID"); } - + /** * @return array all the quequed comments. */ @@ -160,7 +160,7 @@ EOD; { return $this->fetchAll("SELECT * FROM comments WHERE approved != 1"); } - + /** * Approve a quequed comment. * @param string comment ID. -- cgit v1.2.3