-// $adminActions = skinableACTIONS::getDefinedActions();\r
-// $this->actions = array_merge($skinActions, $adminActions, $formActions);\r
-\r
- # TODO: maybe add 'skin' later on?\r
- # TODO: maybe add other pages from admin area\r
-// $this->allowed_types = array('bookmarklet', 'admin');\r
- }\r
-\r
-\r
-/***** The bottom isn't used from here. *****/\r
-\r
- /**\r
- * Creates an "add item" form for a given type of page\r
- * @param string $type - 'admin' or 'bookmarklet'\r
- * @param array $contents\r
- */\r
- public function createAddForm($type, $contents = array())\r
- {\r
-\r
- // begin if: the $type is not in the allowed types array\r
- if ( !in_array($type, $this->allowed_types) )\r
- {\r
- return;\r
- } // end if\r
-\r
- $this->type = $type;\r
- $this->method = 'add';\r
-\r
- global $manager;\r
- $manager->notify(\r
- 'PreAddItemForm',\r
- array(\r
- 'contents' => &$contents,\r
- 'blog' => &$this->blog\r
- )\r
- );\r
-\r
- $this->createForm($contents);\r
- }\r
-\r
-\r
- /**\r
- * Creates an "edit item" form for a given type of page\r
- * @param string $type 'admin' or 'bookmarklet'\r
- * @param array $contents\r
- */\r
- public function createEditForm($type, $contents)\r
- {\r
-\r
- // begin if: the $type is not in the allowed types array\r
- if ( !in_array($type, $this->allowed_types) )\r
- {\r
- return;\r
- } // end if\r
-\r
- $this->type = $type;\r
- $this->method = 'edit';\r
- $this->createForm($contents);\r
- }\r
-\r
-\r
- /**\r
- * (private) creates a form for a given type of page\r
- * @param array $contents\r
- */\r
- private function createForm($contents)\r
- {\r
- # save contents\r
- $this->variables = $contents;\r
-\r
- # get template to use\r
- $template = $this->getTemplateFor($this->type);\r
-\r
- # use the PARSER engine to parse that template\r
- $parser = new Parser($this->actions, $this);\r
- $parser->parse($template);\r
- }\r
-\r
-\r
- /**\r
- * Returns an appropriate template\r
- * @param string $type\r
- */\r
- private function getTemplateFor($type)\r
- {\r
- global $DIR_LIBS;\r
-\r
- $filename = $DIR_LIBS . 'include/' . $this->type . '-' . $this->method . '.template';\r
-\r
- // begin if: file doesn't exist\r
- if ( !file_exists($filename) )\r
- {\r
- return '';\r
- } // end if\r
-\r
- $filesize = filesize($filename);\r
-\r
- // begin if: filesize is LTE zero\r
- if ( $filesize <= 0 )\r
- {\r
- return '';\r
- } // end if\r
-\r
- # read file and return it\r
- $fd = fopen ($filename, 'r');\r
- $contents = fread ($fd, $filesize);\r
- fclose ($fd);\r
-\r
- return $contents;\r
- }\r
-\r
-\r
- /**\r
- * Create category dropdown box\r
- * @param int $start_index\r
- */\r
- function parse_categories($start_index = 0)\r
- {\r
-\r
- // begin if: catid variable is set; use it to select the category\r
- if ( $this->variables['catid'] )\r
- {\r
- $category_id = $this->variables['catid'];\r
- }\r
- // else: get the default category\r
- else\r
- {\r
- $category_id = $this->blog->getDefaultCategory();\r
- } // end if\r
-\r
- Admin::selectBlogCategory('catid', $category_id, $start_index, 1, $this->blog->getID());\r
- }\r
-\r
-\r
- /**\r
- * Displays the blog ID\r
- */\r
- function parse_blogid()\r
- {\r
- echo $this->blog->getID();\r
- }\r
-\r
-\r
- /**\r
- * Displays the blog name\r
- */\r
- function parse_blogname()\r
- {\r
- echo $this->blog->getName();\r
- }\r
-\r
-\r
- /**\r
- * Displays the blog link\r
- */\r
- function parse_bloglink()\r
- {\r
- echo '<a href="', Entity::hsc($this->blog->getURL()), '">', Entity::hsc($this->blog->getName()), '</a>';\r
- }\r
-\r
-\r
- /**\r
- * Displays the author's name\r
- */\r
- function parse_authorname()\r
- {\r
- // don't use on add item?\r
- global $member;\r
- echo $member->getDisplayName();\r
- }\r
-\r
-\r
- /**\r
- * Displays the title\r
- */\r
- function parse_title()\r
- {\r
- echo $this->contents['title'];\r
- }\r
-\r
-\r
- /**\r
- * Indicates the start of a conditional block of data. It will be added to\r
- * the output only if the blogsetting with the given name equals the\r
- * given value (default for value = 1 = true)\r
- *\r
- * the name of the blogsetting is the column name in the nucleus_blog table\r
- *\r
- * the conditional block ends with an <endif> var\r
- */\r
- function parse_ifblogsetting($name,$value=1)\r
- {\r
- $this->_addIfCondition(($this->blog->getSetting($name) == $value));\r
- }\r
-\r
-\r
- /**\r
- *\r
- */\r
- function parse_ifitemproperty($name,$value=1)\r
- {\r
- $this->_addIfCondition(($this->variables[$name] == $value));\r
- }\r
-\r
-\r
- /**\r
- *\r
- */\r
- function parse_ifautosave($name,$value=1)\r
- {\r
- global $member;\r
- $this->_addIfCondition($member->getAutosave() == $value);\r
- }\r
-\r
-\r
- /**\r
- *\r
- */\r
- function parse_helplink($topic)\r
- {\r
- help($topic);\r
- }\r
-\r
-\r
- /**\r
- * for future items\r
- */\r
- function parse_currenttime($what)\r
- {\r
- $nu = getdate($this->blog->getCorrectTime());\r
- echo $nu[$what];\r
- }\r
-\r
-\r
- /**\r
- *\r
- */\r
- // date change on edit item\r
- function parse_itemtime($what)\r
- {\r
- $itemtime = getdate($this->variables['timestamp']);\r
- echo $itemtime[$what];\r
- }\r
-\r
-\r
- /**\r
- * some init stuff for all forms\r
- */\r
- function parse_init()\r
- {\r
- $authorid = ($this->method == 'edit') ? $this->variables['authorid'] : '';\r
- $this->blog->insertJavaScriptInfo($authorid);\r
- }\r
-\r
-\r
- /**\r
- * on bookmarklets only: insert extra html header information (by plugins)\r
- */\r
- function parse_extrahead()\r
- {\r
- global $manager;\r
-\r
- $extrahead = '';\r
-\r
- $manager->notify(\r
- 'BookmarkletExtraHead',\r
- array(\r
- 'extrahead' => &$extrahead\r
- )\r
- );\r
-\r
- echo $extrahead;\r
- }\r
-\r
-\r
- /**\r
- * inserts some localized text\r
- */\r
- function parse_text($which)\r
- {\r
- // constant($which) only available from 4.0.4 :(\r
- if (defined($which)) {\r
- eval("echo $which;");\r
- } else {\r
- echo $which; // this way we see where definitions are missing\r
- }\r
-\r
- }\r
-\r
-\r
- /**\r
- *\r
- */\r
- function parse_contents($which)\r
- {\r
- if (!isset($this->variables[$which])) $this->variables[$which] = '';\r
- echo Entity::hsc($this->variables[$which]);\r
- }\r
-\r
-\r
- /**\r
- *\r
- */\r
- function parse_checkedonval($value, $name)\r
- {\r
- if (!isset($this->variables[$name])) $this->variables[$name] = '';\r
- if ($this->variables[$name] == $value)\r
- echo "checked='checked'";\r