cvs: pearweb /include pear-database-note.php
| From: | Helgi �ormar �orbj�rnsson | Date: | Sun, 01 Jun 2008 00:43:06 +0000 |
| Subject: | cvs: pearweb /include pear-database-note.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-7592@lists.php.net to get a copy of this message | ||
dufuz Sun Jun 1 00:43:06 2008 UTC
Modified files:
/pearweb/include pear-database-note.php
Log:
remove the ability to use rid, cid and pid in the note class, we've never ever filled out
that data since pearweb and peclweb were started
http://cvs.php.net/viewvc.cgi/pearweb/include/pear-database-note.php?r1=1.4&r2=1.5&diff_format=u
Index: pearweb/include/pear-database-note.php
diff -u pearweb/include/pear-database-note.php:1.4 pearweb/include/pear-database-note.php:1.5
--- pearweb/include/pear-database-note.php:1.4 Sun Mar 9 20:42:07 2008
+++ pearweb/include/pear-database-note.php Sun Jun 1 00:43:06 2008
@@ -10,19 +10,16 @@
*/
class note
{
- static function add($key, $value, $note, $author = '')
+ static function add($value, $note, $author = '')
{
global $dbh, $auth_user;
if (empty($author)) {
$author = $auth_user->handle;
}
- if (!in_array($key, array('uid', 'rid', 'cid',
'pid'), true)) {
- // bad hackers not allowed
- $key = 'uid';
- }
- $nid = $dbh->nextId("notes");
- $stmt = $dbh->prepare("INSERT INTO notes (id,$key,nby,ntime,note) ".
- "VALUES(?,?,?,?,?)");
+
+ $nid = $dbh->nextId('notes');
+ $sql = 'INSERT INTO notes (id, uid, nby, ntime, note) VALUES(?,?,?,?,?)';
+ $stmt = $dbh->prepare($sql);
$res = $dbh->execute($stmt, array($nid, $value, $author,
gmdate('Y-m-d H:i'), $note));
if (DB::isError($res)) {
@@ -41,10 +38,10 @@
return true;
}
- static function removeAll($key, $value)
+ static function removeAll($value)
{
global $dbh;
- $res = $dbh->query("DELETE FROM notes WHERE $key = ". $dbh->quote($value));
+ $res = $dbh->query("DELETE FROM notes WHERE uid = ".
$dbh->quoteSmart($value));
if (DB::isError($res)) {
return $res;
}