* The $items, $blogs, ... arrays map an id to an object (for plugins, the name is used\r
* rather than an ID)\r
*/\r
- var $items;\r
- var $blogs;\r
- var $plugins;\r
- var $karma;\r
- var $templates;\r
- var $members;\r
+ private $items;\r
+ private $blogs;\r
+ private $plugins;\r
+ private $karma;\r
+ private $templates;\r
+ private $members;\r
\r
/**\r
* cachedInfo to avoid repeated SQL queries (see pidInstalled/pluginInstalled/getPidFromName)\r
/**\r
* Returns the requested item object. If it is not in the cache, it will\r
* first be loaded and then placed in the cache.\r
- * Intended use: $item =& $manager->getItem(1234)\r
+ * Intended use: $item =& $manager->getItem(1234, 0, 0)\r
*/\r
public function &getItem($itemid, $allowdraft, $allowfuture)\r
{\r
$item =& $this->items[$itemid];\r
\r
- // check the draft and future rules if the item was already cached\r
- if ( $item )\r
+ /* confirm to cached */\r
+ if ( !array_key_exists($itemid, $this->items) )\r
{\r
- if ( (!$allowdraft) && ($item['draft']) )\r
- {\r
- return 0;\r
- }\r
- \r
- $blog =& $this->getBlog(getBlogIDFromItemID($itemid));\r
- \r
- if ( (!$allowfuture) && ($item['timestamp'] > $blog->getCorrectTime()) )\r
- {\r
- return 0;\r
- }\r
- }\r
- \r
- if ( !$item )\r
- {\r
- // load class if needed\r
$this->loadClass('ITEM');\r
- // load item object\r
$item = Item::getitem($itemid, $allowdraft, $allowfuture);\r
$this->items[$itemid] = $item;\r
}\r
+ \r
+ $item =& $this->items[$itemid];\r
+ if ( !$allowdraft && ($item['draft']) )\r
+ {\r
+ return 0;\r
+ }\r
+ \r
+ $blog =& $this->getBlog($item['blogid']);\r
+ if ( !$allowfuture && ($item['timestamp'] > $blog->getCorrectTime()) )\r
+ {\r
+ return 0;\r
+ }\r
+ \r
return $item;\r
}\r
\r