* \r
* @static\r
*/\r
- static private $actiontypes\r
- = array('addnow', 'adddraft', 'addfuture', 'edit', 'changedate', 'backtodrafts', 'delete');\r
+ static private $actiontypes = array(\r
+ 'addnow', 'adddraft', 'addfuture', 'edit',\r
+ 'changedate', 'backtodrafts', 'delete'\r
+ );\r
\r
/**\r
* Item::$itemid\r
* item id\r
* @deprecated\r
- * \r
*/\r
public $itemid;\r
\r
/**\r
* Item::getitem()\r
* Returns one item with the specific itemid\r
- *\r
+ * \r
+ * @static\r
* @param int $item_id\r
* @param bool $allow_draft\r
* @param bool $allow_future\r
* @return mixed\r
- * \r
*/\r
static public function getitem($item_id, $allow_draft, $allow_future)\r
{\r
$aItemInfo['timestamp'] = strtotime($aItemInfo['itime']);\r
return $aItemInfo;\r
}\r
- else\r
- {\r
- return 0;\r
- }\r
+ return 0;\r
}\r
\r
/**\r
//Setting the itemOptions\r
$aOptions = requestArray('plugoption');\r
NucleusPlugin::apply_plugin_options($aOptions, $itemid);\r
- $manager->notify('PostPluginOptionsUpdate', array(\r
- 'context' => 'item',\r
- 'itemid' => $itemid,\r
- 'item' => array(\r
- 'title' => $i_title,\r
- 'body' => $i_body,\r
- 'more' => $i_more,\r
- 'closed' => $i_closed,\r
- 'catid' => $i_catid\r
- )\r
+ $data = array(\r
+ 'context' => 'item',\r
+ 'itemid' => $itemid,\r
+ 'item' => array(\r
+ 'title' => $i_title,\r
+ 'body' => $i_body,\r
+ 'more' => $i_more,\r
+ 'closed' => $i_closed,\r
+ 'catid' => $i_catid\r
)\r
);\r
\r
+ $manager->notify('PostPluginOptionsUpdate', $data);\r
+ \r
if ( $i_draftid > 0 )\r
{\r
// delete permission is checked inside Item::delete()\r
{\r
return array('status' => 'newcategory', 'itemid' => $itemid, 'catid' => $i_catid);\r
}\r
- else\r
- {\r
- return array('status' => 'added', 'itemid' => $itemid);\r
- }\r
+ \r
+ return array('status' => 'added', 'itemid' => $itemid);\r
}\r
\r
/**\r
* @param boolean $publish published or not\r
* @param timestamp $timestamp timestamp\r
* @return void\r
- * \r
*/\r
static public function update($itemid, $catid, $title, $body, $more, $closed, $wasdraft, $publish, $timestamp = 0)\r
{\r
}\r
\r
// call plugins\r
- $manager->notify('PreUpdateItem', array(\r
+ $data = array(\r
'itemid' => $itemid,\r
'title' => &$title,\r
'body' => &$body,\r
'blog' => &$blog,\r
'closed' => &$closed,\r
'catid' => &$catid\r
- )\r
);\r
+ $manager->notify('PreUpdateItem', $data);\r
\r
// update item itself\r
$query = 'UPDATE ' . sql_table('item')\r
. ' iclosed = ' . intval($closed) . ','\r
. ' icat = ' . intval($catid);\r
\r
- // if we received an updated timestamp that is in the past, but past posting is not allowed, reject that date change (timestamp = 0 will make sure the current date is kept)\r
+ // if we received an updated timestamp that is in the past, but past posting is not allowed,\r
+ // reject that date change (timestamp = 0 will make sure the current date is kept)\r
if ( (!$blog->allowPastPosting()) && ($timestamp < $blog->getCorrectTime()) )\r
{\r
$timestamp = 0;\r
//update the itemOptions\r
$aOptions = requestArray('plugoption');\r
NucleusPlugin::apply_plugin_options($aOptions);\r
- $manager->notify('PostPluginOptionsUpdate', array(\r
- 'context' => 'item',\r
- 'itemid' => $itemid,\r
- 'item' => array(\r
- 'title' => $title,\r
- 'body' => $body,\r
- 'more' => $more,\r
- 'closed' => $closed,\r
- 'catid' => $catid\r
- )\r
+ $data = array(\r
+ 'context' => 'item',\r
+ 'itemid' => $itemid,\r
+ 'item' => array(\r
+ 'title' => $title,\r
+ 'body' => $body,\r
+ 'more' => $more,\r
+ 'closed' => $closed,\r
+ 'catid' => $catid\r
)\r
);\r
+ $manager->notify('PostPluginOptionsUpdate', $data);\r
return;\r
}\r
\r
{\r
global $manager;\r
\r
- $itemid = (integer) $itemid;\r
- $new_catid = (integer) $new_catid;\r
- $new_blogid = getBlogIDFromCatID($new_catid);\r
+ $itemid = (integer) $itemid;\r
+ $new_catid = (integer) $new_catid;\r
+ $new_blogid = getBlogIDFromCatID($new_catid);\r
\r
- $manager->notify(\r
- 'PreMoveItem',\r
- array(\r
- 'itemid' => $itemid,\r
- 'destblogid' => $new_blogid,\r
- 'destcatid' => $new_catid\r
- )\r
+ $data = array(\r
+ 'itemid' => $itemid,\r
+ 'destblogid' => $new_blogid,\r
+ 'destcatid' => $new_catid\r
);\r
+ $manager->notify('PreMoveItem', $data);\r
\r
// update item table\r
$query = "UPDATE %s SET iblog=%d, icat=%d WHERE inumber=%d";\r
$query = sprintf($query, sql_table('comment'), $new_blogid, $itemid);\r
DB::execute($query);\r
\r
- $manager->notify(\r
- 'PostMoveItem',\r
- array(\r
- 'itemid' => $itemid,\r
- 'destblogid' => $new_blogid,\r
- 'destcatid' => $new_catid\r
- )\r
+ $data = array(\r
+ 'itemid' => $itemid,\r
+ 'destblogid' => $new_blogid,\r
+ 'destcatid' => $new_catid\r
);\r
+ $manager->notify('PostMoveItem', $data);\r
return;\r
}\r
\r
$manager->notify('PreDeleteItem', array('itemid' => $itemid));\r
\r
// delete item\r
- $query = "DELETE FROM %s WHERE inumber=%d";\r
+ $query = "DELETE FROM %s WHERE inumber=%d;";\r
$query = sprintf($query, sql_table('item'), $itemid);\r
DB::execute($query);\r
\r
// delete the comments associated with the item\r
- $query = "DELETE FROM %s WHERE citem=%d";\r
+ $query = "DELETE FROM %s WHERE citem=%d;";\r
$query = sprintf($query, sql_table('comment'), $itemid);\r
DB::execute($query);\r
\r
* @param boolean $future\r
* @param boolean $draft\r
* @return boolean exists or not\r
- * \r
*/\r
static public function exists($itemid, $future, $draft)\r
{\r
global $manager;\r
\r
$itemid = (integer) $itemid;\r
- $query = 'select * FROM '.sql_table('item').' WHERE inumber='.$itemid;\r
+ \r
+ $query = 'SELECT * FROM %s WHERE inumber=%d';\r
+ $query = sprintf($query, sql_table('item'), $itemid);\r
\r
if ( !$future )\r
{\r
return 0;\r
}\r
$blog =& $manager->getBlog($blogid);\r
- $query .= ' and itime<=' . DB::formatDateTime($blog->getCorrectTime());\r
+ $query .= ' AND itime<=' . DB::formatDateTime($blog->getCorrectTime());\r
}\r
+ \r
if ( !$draft )\r
{\r
- $query .= ' and idraft=0';\r
+ $query .= ' AND idraft=0';\r
}\r
+ \r
$result = DB::getResult($query);\r
return ( $result->rowCount() != 0 );\r
}\r
* @static\r
* @param void\r
* @return array (status = added/error/newcategory, message)\r
- *\r
*/\r
static public function createDraftFromRequest()\r
{\r
/*\r
* TODO: these values from user agent should be validated but not implemented yet\r
*/\r
- $i_author = $member->getID();\r
- $i_body = postVar('body');\r
- $i_title = postVar('title');\r
- $i_more = postVar('more');\r
- $i_closed = intPostVar('closed');\r
- $i_catid = postVar('catid');\r
- $i_draft = 1;\r
- $type = postVar('type');\r
+ $i_author = $member->getID();\r
+ $i_body = postVar('body');\r
+ $i_title = postVar('title');\r
+ $i_more = postVar('more');\r
+ $i_closed = intPostVar('closed');\r
+ $i_catid = postVar('catid');\r
+ $i_draft = 1;\r
+ $type = postVar('type');\r
$i_draftid = intPostVar('draftid');\r
\r
if ( $type == 'edit' )\r