\r
/*\r
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2007 The Nucleus Group\r
+ * Copyright (C) 2002-2009 The Nucleus Group\r
*\r
* This program is free software; you can redistribute it and/or\r
* modify it under the terms of the GNU General Public License\r
* A class representing an item\r
*\r
* @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2007 The Nucleus Group\r
- * @version $Id: ITEM.php,v 1.8 2008-02-08 09:31:22 kimitake Exp $\r
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
+ * @version $Id$\r
* $NucleusJP: ITEM.php,v 1.7.2.3 2008/02/07 06:13:30 kimitake Exp $\r
*/\r
class ITEM {\r
\r
var $itemid;\r
\r
+ /**\r
+ * Constructor of an ITEM object\r
+ * \r
+ * @param integer $itemid id of the item\r
+ */\r
function ITEM($itemid) {\r
$this->itemid = $itemid;\r
}\r
\r
/**\r
* Returns one item with the specific itemid\r
- * (static)\r
+ * \r
+ * @param integer $itemid id of the item\r
+ * @param boolean $allowdraft\r
+ * @param boolean $allowfuture\r
+ * @static\r
*/\r
function getitem($itemid, $allowdraft, $allowfuture) {\r
global $manager;\r
\r
$res = sql_query($query);\r
\r
- if (mysql_num_rows($res) == 1)\r
+ if (sql_num_rows($res) == 1)\r
{\r
- $aItemInfo = mysql_fetch_assoc($res);\r
+ $aItemInfo = sql_fetch_assoc($res);\r
$aItemInfo['timestamp'] = strtotime($aItemInfo['itime']);\r
return $aItemInfo;\r
} else {\r
* Tries to create an item from the data in the current request (comes from\r
* bookmarklet or admin area\r
*\r
- * Returns an array with status info (status = 'added', 'error', 'newcategory')\r
+ * Returns an array with status info:\r
+ * status = 'added', 'error', 'newcategory'\r
*\r
- * (static)\r
+ * @static\r
*/\r
function createFromRequest() {\r
global $member, $manager;\r
\r
\r
/**\r
- * Updates an item (static)\r
+ * Updates an item\r
+ *\r
+ * @static\r
*/\r
function update($itemid, $catid, $title, $body, $more, $closed, $wasdraft, $publish, $timestamp = 0) {\r
global $manager;\r
$blog->sendNewItemNotification($itemid, $title, $body);\r
}\r
\r
+ // save back to drafts \r
+ if (!$wasdraft && !$publish) {\r
+ $query .= ', idraft=1';\r
+ // set timestamp back to zero for a draft\r
+ $query .= ", itime=" . mysqldate($timestamp);\r
+ }\r
+\r
// update timestamp when needed\r
if ($timestamp != 0)\r
$query .= ", itime=" . mysqldate($timestamp);\r
\r
}\r
\r
- // move an item to another blog (no checks, static)\r
+ /**\r
+ * Move an item to another blog (no checks)\r
+ *\r
+ * @static\r
+ */\r
function move($itemid, $new_catid) {\r
global $manager;\r
\r
global $manager, $member;\r
\r
$itemid = intval($itemid);\r
+\r
// check to ensure only those allow to alter the item can\r
// proceed\r
if (!$member->canAlterItem($itemid)) {\r
return 1;\r
}\r
\r
+\r
$manager->notify('PreDeleteItem', array('itemid' => $itemid));\r
\r
// delete item\r
NucleusPlugin::_deleteOptionValues('item', $itemid);\r
\r
$manager->notify('PostDeleteItem', array('itemid' => $itemid));\r
+\r
+ return 0;\r
}\r
\r
- // returns true if there is an item with the given ID (static)\r
+ /**\r
+ * Returns true if there is an item with the given ID\r
+ *\r
+ * @static\r
+ */\r
function exists($id,$future,$draft) {\r
global $manager;\r
\r
}\r
$r = sql_query($r);\r
\r
- return (mysql_num_rows($r) != 0);\r
+ return (sql_num_rows($r) != 0);\r
}\r
\r
/**\r
* Tries to create an draft from the data in the current request (comes from\r
* bookmarklet or admin area\r
*\r
- * Returns an array with status info (status = 'added', 'error', 'newcategory')\r
+ * Returns an array with status info:\r
+ * status = 'added', 'error', 'newcategory'\r
*\r
- * (static)\r
+ * @static\r
*\r
* Used by xmlHTTPRequest AutoDraft\r
*/\r
$i_title = postVar('title');\r
$i_more = postVar('more');\r
\r
- if(_CHARSET != 'UTF-8'){\r
- $i_body = mb_convert_encoding($i_body, _CHARSET, "UTF-8");\r
+ if(strtoupper(_CHARSET) != 'UTF-8'){\r
+ $i_body = mb_convert_encoding($i_body, _CHARSET, "UTF-8");\r
$i_title = mb_convert_encoding($i_title, _CHARSET, "UTF-8");\r
- $i_more = mb_convert_encoding($i_more, _CHARSET, "UTF-8");\r
+ $i_more = mb_convert_encoding($i_more, _CHARSET, "UTF-8");\r
}\r
//$i_actiontype = postVar('actiontype');\r
$i_closed = intPostVar('closed');\r
\r
}\r
\r
-?>\r
+?>
\ No newline at end of file