* This class contains the functions that get called by using\r
* the special tags in the skins\r
*\r
- * The allowed tags for a type of skinpart are defined by the\r
- * Skin::getAllowedActionsForType($type) method\r
- *\r
* @license http://nucleuscms.org/license.txt GNU General Public License\r
* @copyright Copyright (C) 2002-2012 The Nucleus Group\r
- * @version $Id: ACTIONS.php 1721 2012-03-31 10:18:25Z sakamocchi $\r
+ * @version $Id: ACTIONS.php 1863 2012-05-19 10:50:27Z sakamocchi $
*/\r
\r
class Actions extends BaseActions\r
{\r
// part of the skin currently being parsed ('index', 'item', 'archive',\r
// 'archivelist', 'member', 'search', 'error', 'imagepopup')\r
- var $skintype;\r
+ private $skintype;\r
\r
// contains an assoc array with parameters that need to be included when\r
// generating links to items/archives/... (e.g. catid)\r
- var $linkparams;\r
- \r
- // reference to the skin object for which a part is being parsed\r
- var $skin;\r
+ private $linkparams;\r
\r
// used when including templated forms from the include/ dir. The $formdata var\r
// contains the values to fill out in there (assoc array name -> value)\r
- var $formdata;\r
+ private $formdata;\r
\r
// filled out with the number of displayed items after calling one of the\r
// (other)blog/(other)searchresults skinvars.\r
- var $amountfound;\r
+ private $amountfound;\r
+ \r
+ /**\r
+ * Actions::$default_actions\r
+ * list of whole action names with which this class can deal\r
+ */\r
+ static private $default_actions = array(\r
+ 'addlink',\r
+ 'addpopupcode',\r
+ 'adminurl',\r
+ 'archivelink',\r
+ 'bloglist',\r
+ 'category',\r
+ 'loginform',\r
+ 'member',\r
+ 'nucleusbutton',\r
+ 'otherarchivedaylist',\r
+ 'otherarchivelist',\r
+ 'otherarchiveyearlist',\r
+ 'otherblog',\r
+ 'plugin',\r
+ 'referer',\r
+ 'searchform',\r
+ 'self',\r
+ 'sitevar',\r
+ 'skinname',\r
+ 'sticky',\r
+ 'todaylink',\r
+ 'version',\r
+ // deprecated (Nucleus v2.0)\r
+ /* TODO: remove this */\r
+ 'ifcat'\r
+ );\r
+ \r
+ /**\r
+ * Actions::$skin_type_friendly_names\r
+ * friendly name for wrapped page types\r
+ */\r
+ static public $default_skin_types = array(\r
+ 'index' => _SKIN_PART_MAIN,\r
+ 'item' => _SKIN_PART_ITEM,\r
+ 'archivelist' => _SKIN_PART_ALIST,\r
+ 'archive' => _SKIN_PART_ARCHIVE,\r
+ 'search' => _SKIN_PART_SEARCH,\r
+ 'error' => _SKIN_PART_ERROR,\r
+ 'member' => _SKIN_PART_MEMBER,\r
+ 'imagepopup' => _SKIN_PART_POPUP\r
+ );\r
+ \r
+ /**\r
+ * Actions::getAvailableSkinTypes()\r
+ * \r
+ * @static\r
+ * @param void\r
+ * @return array list of friendly names for page actions\r
+ */\r
+ static public function getAvailableSkinTypes()\r
+ {\r
+ return self::$default_skin_types;\r
+ }\r
\r
/**\r
* Actions::__construct()\r
global $catid;\r
\r
// call constructor of superclass first\r
- $this->BaseActions();\r
+ parent::__construct();\r
$this->skintype = $type;\r
\r
if ( $catid )\r
}\r
\r
/**\r
- * Actions::setSkin()\r
- * Set the skin\r
- * @param object $skin an instance of Skin class\r
- * @return void\r
- */\r
- public function setSkin(&$skin)\r
- {\r
- $this->skin =& $skin;\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::setParser()\r
- * Set the parser\r
+ * Actions::getAvailableActions()\r
* \r
- * @param object $parser an instance of Parser class\r
- * @return void\r
+ * @param void\r
+ * @return array allowed actions for the page type\r
*/\r
- public function setParser(&$parser)\r
+ public function getAvailableActions()\r
{\r
- $this->parser =& $parser;\r
- return;\r
+ $extra_actions = array();\r
+ \r
+ switch ( $this->skintype )\r
+ {\r
+ case 'index':\r
+ $extra_actions = array(\r
+ 'blog',\r
+ 'blogsetting',\r
+ 'preview',\r
+ 'additemform',\r
+ 'categorylist',\r
+ 'archivelist',\r
+ 'archivedaylist',\r
+ 'archiveyearlist',\r
+ 'nextlink',\r
+ 'prevlink'\r
+ );\r
+ break;\r
+ case 'archive':\r
+ $extra_actions = array(\r
+ 'blog',\r
+ 'archive',\r
+ 'otherarchive',\r
+ 'categorylist',\r
+ 'archivelist',\r
+ 'archivedaylist',\r
+ 'archiveyearlist',\r
+ 'blogsetting',\r
+ 'archivedate',\r
+ 'nextarchive',\r
+ 'prevarchive',\r
+ 'nextlink',\r
+ 'prevlink',\r
+ 'archivetype'\r
+ );\r
+ break;\r
+ case 'archivelist':\r
+ $extra_actions = array(\r
+ 'blog',\r
+ 'archivelist',\r
+ 'archivedaylist',\r
+ 'archiveyearlist',\r
+ 'categorylist',\r
+ 'blogsetting'\r
+ );\r
+ break;\r
+ case 'search':\r
+ $extra_actions = array(\r
+ 'blog',\r
+ 'archivelist',\r
+ 'archivedaylist',\r
+ 'archiveyearlist',\r
+ 'categorylist',\r
+ 'searchresults',\r
+ 'othersearchresults',\r
+ 'blogsetting',\r
+ 'query',\r
+ 'nextlink',\r
+ 'prevlink'\r
+ );\r
+ break;\r
+ case 'imagepopup':\r
+ $extra_actions = array(\r
+ 'image',\r
+ // deprecated (Nucleus v2.0)\r
+ /* TODO: remove this */\r
+ 'imagetext'\r
+ );\r
+ break;\r
+ case 'member':\r
+ $extra_actions = array(\r
+ 'membermailform',\r
+ 'blogsetting',\r
+ 'nucleusbutton',\r
+ 'categorylist'\r
+ );\r
+ break;\r
+ case 'item':\r
+ $extra_actions = array(\r
+ 'blog',\r
+ 'item',\r
+ 'comments',\r
+ 'commentform',\r
+ 'vars',\r
+ 'blogsetting',\r
+ 'nextitem',\r
+ 'previtem',\r
+ 'nextlink',\r
+ 'prevlink',\r
+ 'nextitemtitle',\r
+ 'previtemtitle',\r
+ 'categorylist',\r
+ 'archivelist',\r
+ 'archivedaylist',\r
+ 'archiveyearlist',\r
+ 'itemtitle',\r
+ 'itemid',\r
+ 'itemlink'\r
+ );\r
+ break;\r
+ case 'error':\r
+ $extra_actions = array(\r
+ 'errormessage',\r
+ 'categorylist'\r
+ );\r
+ break;\r
+ default:\r
+ $extra_actions = array(\r
+ 'blog',\r
+ 'blogsetting',\r
+ 'preview',\r
+ 'additemform',\r
+ 'categorylist',\r
+ 'archivelist',\r
+ 'archivedaylist',\r
+ 'archiveyearlist',\r
+ 'nextlink',\r
+ 'prevlink',\r
+ 'membermailform',\r
+ 'nucleusbutton',\r
+ 'categorylist'\r
+ );\r
+ break;\r
+ }\r
+ \r
+ $defined_actions = array_merge(self::$default_actions, $extra_actions);\r
+ \r
+ return array_merge($defined_actions, parent::getAvailableActions());\r
}\r
\r
/**\r
public function doForm($filename)\r
{\r
global $DIR_NUCLEUS;\r
- array_push($this->parser->actions,'formdata','text','callback','errordiv','ticket');\r
+ array_push($this->parser->actions,'formdata', 'callback','errordiv','ticket');\r
\r
$oldIncludeMode = Parser::getProperty('IncludeMode');\r
$oldIncludePrefix = Parser::getProperty('IncludePrefix');\r
\r
array_pop($this->parser->actions); // errordiv\r
array_pop($this->parser->actions); // callback\r
- array_pop($this->parser->actions); // text\r
array_pop($this->parser->actions); // formdata\r
array_pop($this->parser->actions); // ticket\r
return;\r
* @param string $value value of property\r
* @return boolean condition\r
*/\r
- public function checkCondition($field, $name='', $value = '')\r
+ protected function checkCondition($field, $name='', $value = '')\r
{\r
global $catid, $blog, $member, $itemidnext, $itemidprev, $manager, $archiveprevexists, $archivenextexists;\r
\r
case 'admin':\r
$condition = $member->isLoggedIn() && $this->ifAdmin($name);\r
break;\r
- case 'superadmin':\r
- $condition = $member->isLoggedIn() && $member->isAdmin();\r
- break;\r
- case 'allowloginedit':\r
- $condition = $member->isLoggedIn() && ($CONF['AllowLoginEdit'] || $member->isAdmin());\r
- break;\r
case 'nextitem':\r
$condition = ($itemidnext != '');\r
break;\r
case 'hasplugin':\r
$condition = $this->ifHasPlugin($name, $value);\r
break;\r
- case 'adminaction':\r
- $condition = ($this->objAdmin->action == $name);\r
- break;\r
- case 'adminoldaction':\r
- $condition = ($this->objAdmin->action == $name);\r
- break;\r
- case 'addresschange':\r
- $condition = ($this->_ifAddresscange());\r
- break;\r
- case 'bechangepass':\r
- $condition = ($this->_beChangePassword());\r
- break;\r
- case 'skincandidates':\r
- $condition = ($this->_ifSkincandidates());\r
- break;\r
- case 'nameclashes':\r
- $condition = requestVar('nameclashes');\r
- break;\r
- case 'existsnewplugin':\r
- $condition = ($this->_existsNewPlugin());\r
- break;\r
default:\r
$condition = $manager->pluginInstalled("NP_{$field}") && $this->ifPlugin($field, $name, $value);\r
break;\r
}\r
\r
/**\r
- * Actions::beChangePassword()\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- function beChangePassword()\r
- {\r
- return intRequestVar('bNeedsPasswordChange');\r
- }\r
- \r
- /**\r
- * Actions::ifSkincandidates()\r
- * Checks if a plugin exists and call its doIf function\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- private function ifSkincandidates()\r
- {\r
- global $DIR_SKINS;\r
- $candidates = SKINIMPORT::searchForCandidates($DIR_SKINS);\r
- return (count($candidates) > 0);\r
- }\r
- \r
- /**\r
* Actions::ifPlugin()\r
* Checks if a plugin exists and call its doIf function\r
* \r
}\r
\r
// check category name\r
- if ( $name == 'catname' )\r
+ else if ( $name == 'catname' )
{\r
$value = $blog->getCategoryIdFromName($value);\r
if ( $value == $catid )\r
}\r
\r
// check category id\r
- if ( ($name == 'catid') && ($value == $catid) )\r
+ else if ( ($name == 'catid') && ($value == $catid) )
{\r
return $blog->isValidCategory($catid);\r
}\r
}\r
\r
/**\r
- * Actions::ifAddresscange()\r
- * Check e-Mail address is changed\r
- * \r
- * @param void\r
- * @return boolean\r
- */\r
- private function ifAddresscange()\r
- {\r
- $key = $this->objAdmin->sessionVar("{$CONF['CookiePrefix']}ackey");\r
- if ( !$key )\r
- {\r
- return FALSE;\r
- }\r
- $info = MEMBER::getActivationInfo($key);\r
- if ( !$info )\r
- {\r
- return FALSE;\r
- }\r
- $mem = MEMBER::createFromId($info->vmember);\r
- if ( !$mem )\r
- {\r
- return FALSE;\r
- }\r
- if ( $info->vtype == 'addresschange' )\r
- {\r
- return TRUE;\r
- }\r
- return FALSE;\r
- }\r
- \r
- /**\r
* Actions::link()\r
* returns either\r
* - a raw link (html/xml encoded) when no linktext is provided\r
// TODO: Move request uri to linkparams. this is ugly. sorry for that.\r
$startpos = (integer) $startpos;\r
$parsed = parse_url(serverVar('REQUEST_URI'));\r
- $path = $parsed['path'];\r
- $parsed = $parsed['query'];\r
+ $path = ( in_array('path', $parsed) ) ? $parsed['path'] : '';\r
+ $parsed = ( in_array('query', $parsed) ) ? $parsed['query'] : '';\r
$url = '';\r
\r
if ( $direction == 'prev' )\r
{\r
$url = $CONF['SearchURL'];\r
}\r
- $url .= '?' . alterQueryStr($parsed,'startpos',$startpos);\r
+ $url .= '?' . alterQueryStr($parsed, 'startpos', $startpos);\r
}\r
}\r
else if ( $direction == 'next' )\r
}\r
if ( $sqlquery )\r
{\r
- $iAmountOnPage = intval(quickQuery($sqlquery)) - intval($startpos);\r
+ $iAmountOnPage = intval(DB::getValue($sqlquery)) - intval($startpos);\r
}\r
}\r
\r
* @param string $linktext text for link\r
* @return void\r
*/\r
- public function itemlink($id, $linktext = '')\r
+ private function itemlink($id, $linktext = '')\r
{\r
global $CONF;\r
if ( $id != 0 )\r
{\r
- echo $this->link(Link::createitemlink($id, $this->linkparams), $linktext);\r
+ echo $this->link(Link::create_item_link($id, $this->linkparams), $linktext);\r
}\r
else\r
{\r
}\r
\r
/**\r
- * Actions:setBlogCategory()\r
- * Helper function that sets the category that a blog will need to use\r
- *\r
- * @param string $blog An object of the blog class, passed by reference (we want to make changes to it)\r
- * @param string $catname The name of the category to use\r
+ * Actions::archivelink)\r
+ * Creates an archive link and if no id is given a todaylink \r
+ * \r
+ * @param integer $id id for link\r
+ * @param string $linktext text for link\r
* @return void\r
*/\r
- private function setBlogCategory(&$blog, $catname)\r
+ private function archivelink($id, $linktext = '')\r
{\r
- global $catid;\r
- if ( $catname != '' )\r
+ global $CONF, $blog;\r
+ if ( $id != 0 )\r
{\r
- $blog->setSelectedCategoryByName($catname);\r
+ echo $this->link(Link::create_archive_link($blog->getID(), $id, $this->linkparams), $linktext);\r
}\r
else\r
{\r
- $blog->setSelectedCategory($catid);\r
+ $this->parse_todaylink($linktext);\r
}\r
return;\r
}\r
-\r
+ \r
/**\r
- * Actions::archivelink)\r
- * Creates an archive link and if no id is given a todaylink \r
- * \r
- * @param integer $id id for link\r
- * @param string $linktext text for link\r
+ * Actions:setBlogCategory()\r
+ * Helper function that sets the category that a blog will need to use\r
+ *\r
+ * @param string $blog An object of the blog class, passed by reference (we want to make changes to it)\r
+ * @param string $catname The name of the category to use\r
* @return void\r
*/\r
- public function archivelink($id, $linktext = '')\r
+ private function setBlogCategory(&$blog, $catname)\r
{\r
- global $CONF, $blog;\r
- if ( $id != 0 )\r
+ global $catid;\r
+ if ( $catname != '' )\r
{\r
- echo $this->link(Link::createarchivelink($blog->getID(), $id, $this->linkparams), $linktext);\r
+ $blog->setSelectedCategoryByName($catname);\r
}\r
else\r
{\r
- $this->parse_todaylink($linktext);\r
+ $blog->setSelectedCategory($catid);\r
}\r
return;\r
}\r
\r
/* \r
* TODO: these lines are no meaning because there is no $template.\r
- */\r
if ( $locale == '-def-' )\r
{\r
setlocale(LC_TIME, $template['LOCALE']);\r
{\r
setlocale(LC_TIME, $locale);\r
}\r
+ */\r
\r
// get archive date\r
sscanf($archive,'%d-%d-%d',$y,$m,$d);\r
{\r
$format = '%d %B %Y';\r
}\r
- echo i18n::formatted_timedate($format, mktime(0,0,0,$m?$m:1,$d?$d:1,$y));\r
+ echo i18n::formatted_datetime($format, mktime(0,0,0,$m?$m:1,$d?$d:1,$y));\r
return;\r
}\r
\r
}\r
\r
/**\r
- * Actions::parsearchivelink()\r
+ * Actions::parse_archivelink()\r
* A link to the archives for the current blog (or for default blog)\r
* \r
* @param string $linktext text for link\r
* @return void\r
*/\r
- public function parsearchivelink($linktext = '')\r
+ public function parse_archivelink($linktext = '')\r
{\r
global $blog, $CONF;\r
if ( $blog )\r
{\r
- echo $this->link(Link::create_archivelistlink($blog->getID(),$this->linkparams), $linktext);\r
+ echo $this->link(Link::create_archivelist_link($blog->getID(), $this->linkparams), $linktext);\r
}\r
else\r
{\r
- echo $this->link(Link::create_archivelistlink(), $linktext);\r
+ echo $this->link(Link::create_archivelist_link(), $linktext);\r
}\r
return;\r
}\r
}\r
\r
/**\r
- * Actions::parse_getblogsetting()\r
- * Parse skinvar getblogsetting\r
- */\r
- function parse_getblogsetting($which)\r
- {\r
- global $blog;\r
- if ( $blog )\r
- {\r
- $b =& $blog;\r
- }\r
- elseif ( $bid = intRequestVar('blogid') )\r
- {\r
- global $manager;\r
- $b = $manager->getBlog($bid);\r
- }\r
- else\r
- {\r
- return;\r
- }\r
- \r
- switch ( $which )\r
- {\r
- case 'id':\r
- return Entity::hsc($b->getID());\r
- break;\r
- case 'url':\r
- return Entity::hsc($b->getURL());\r
- break;\r
- case 'name':\r
- return Entity::hsc($b->getName());\r
- break;\r
- case 'desc':\r
- return Entity::hsc($b->getDescription());\r
- break;\r
- case 'short':\r
- return Entity::hsc($b->getShortName());\r
- break;\r
- case 'notifyaddress':\r
- return Entity::hsc($b->getNotifyAddress());\r
- break;\r
- case 'maxcomments':\r
- return Entity::hsc($b->getMaxComments());\r
- break;\r
- case 'updatefile':\r
- return Entity::hsc($b->getUpdateFile());\r
- break;\r
- case 'timeoffset':\r
- return Entity::hsc($b->getTimeOffset());\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
* Actions::parse_callback()\r
* Parse callback\r
* \r
}\r
\r
/**\r
- * Actions::parse_charset()\r
- * Parse skinvar charset\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_charset()\r
- {\r
- echo i18n::get_current_charset();\r
- return;\r
- }\r
- \r
- /**\r
* Actions::parse_commentform()\r
* Parse skinvar commentform\r
* \r
if ( !$destinationurl )\r
{\r
// note: createLink returns an HTML encoded URL\r
- $destinationurl = Link::createlink(\r
+ $destinationurl = Link::create_link(\r
'item',\r
array(\r
'itemid' => $itemid,\r
*/\r
public function parse_comments($template)\r
{\r
- global $itemid, $manager, $blog, $highlight;\r
+ global $manager, $blog, $highlight, $itemid;\r
+ \r
$template =& $manager->getTemplate($template);\r
+ $item =& $manager->getitem($itemid, 0, 0);\r
\r
// create parser object & action handler\r
- $actions = new ItemActions($blog);\r
- $parser = new Parser($actions->getDefinedActions(),$actions);\r
- $actions->setTemplate($template);\r
- $actions->setParser($parser);\r
- $item = Item::getitem($itemid, 0, 0);\r
- $actions->setCurrentItem($item);\r
+ $handler = new ItemActions($blog);\r
+ $handler->setTemplate($template);\r
+ $handler->setCurrentItem($item);\r
+ \r
+ $parser = new Parser($handler);\r
\r
$comments = new Comments($itemid);\r
- $comments->setItemActions($actions);\r
+ $comments->setItemActions($handler);\r
// shows ALL comments\r
$comments->showComments($template, -1, 1, $highlight);\r
return;\r
*/\r
public function parse_imagetext()\r
{\r
- echo Entity::hsc(requestVar('imagetext'));\r
- }\r
- \r
- /**\r
- * Actions::parse_skinfile()\r
- * Inserts an url relative to the skindir (useful when doing import/export)\r
- * e.g. <skinfile(default/myfile.sth)>\r
- * \r
- * @param string $filename name of file\r
- * @return void\r
- */\r
- public function parse_skinfile($filename)\r
- {\r
- $base = NP_SkinableAdmin::getAdminSkinURL();\r
- $pref = PARSER::getProperty('IncludePrefix');\r
- echo "{$base}{$pref}{$filename}";\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_imagetext()\r
- * Parse skinvar imagetext\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_imagetext()\r
- {\r
$this->parse_image('imagetext');\r
return;\r
}\r
\r
/**\r
- * Actions::parse_itemlink()\r
- * Parse skinvar itemlink\r
- * \r
- * @param string $linktext text for content of anchor element\r
- * @return void\r
- */\r
- function parse_itemlink($linktext = '')\r
- {\r
- global $itemid;\r
- $this->itemlink($itemid, $linktext);\r
- return;\r
- }\r
- \r
- /**\r
* Actions::parse_item()\r
* Parse skinvar item\r
* include one item (no comments)\r
* @param void\r
* @return void\r
*/\r
- public function parseitemlink($linktext = '')\r
+ public function parse_itemlink($linktext = '')\r
{\r
global $itemid;\r
$this->itemlink($itemid, $linktext);\r
public function parse_itemtitle($format = '')\r
{\r
global $manager, $itemid;\r
- $item =& $manager->getItem($itemid,0,0);\r
+ $item =& $manager->getItem($itemid, 1, 1);\r
\r
switch ( $format )\r
{\r
break;\r
case 'yourprofileurl':\r
if ($CONF['URLMode'] == 'pathinfo')\r
- echo Link::create_memberlink($member->getID());\r
+ echo Link::create_member_link($member->getID());\r
else\r
- echo $CONF['IndexURL'] . Link::create_memberlink($member->getID());\r
+ echo $CONF['IndexURL'] . Link::create_member_link($member->getID());\r
break;\r
}\r
}\r
{\r
if ( $CONF['URLMode'] == 'pathinfo' )\r
{\r
- $desturl = Link::create_memberlink($memberid);\r
+ $desturl = Link::create_member_link($memberid);\r
}\r
else\r
{\r
- $desturl = $CONF['IndexURL'] . Link::create_memberlink($memberid);\r
+ $desturl = $CONF['IndexURL'] . Link::create_member_link($memberid);\r
}\r
}\r
\r
*/\r
public function parse_skinname()\r
{\r
- echo $this->skin->getName();\r
+ echo $this->parser->skin->getName();\r
return;\r
}\r
\r
}\r
\r
/**\r
- * Actions::parse_text()\r
- * Parse text\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_text($which)\r
- {\r
- // constant($which) only available from 4.0.4 :(\r
- if ( defined($which) )\r
- {\r
- eval("echo $which;");\r
- }\r
- return;\r
- }\r
- \r
- /**\r
* Actions::parse_ticket()\r
* Parse ticket\r
* \r
global $blog, $CONF;\r
if ( $blog )\r
{\r
- echo $this->link(Link::create_blogidlink($blog->getID(),$this->linkparams), $linktext);\r
+ echo $this->link(Link::create_blogid_link($blog->getID(),$this->linkparams), $linktext);\r
}\r
else\r
{\r
* @param string $template name of template\r
* @return void\r
*/\r
- public function parse_sticky($itemnumber = 0, $template = '')\r
+ public function parse_sticky($itemid = 0, $template = '')\r
{\r
global $manager;\r
\r
- $itemnumber = intval($itemnumber);\r
- $itemarray = array($itemnumber);\r
+ $itemid = (integer) $itemid;\r
+ $itemarray = array($itemid);\r
\r
- $b =& $manager->getBlog(getBlogIDFromItemID($itemnumber));\r
- $this->preBlogContent('sticky',$b);\r
- $this->amountfound = $b->readLogFromList($itemarray, $template);\r
- $this->postBlogContent('sticky',$b);\r
- return;\r
- }\r
- \r
- /* TODO: checking these new added methods */\r
- \r
- /**\r
- * Actions::parse_adminbanlist()\r
- * Parse skinvar adminbanlist\r
- * \r
- * @param string $templateName name of template to use\r
- * @return void\r
- */\r
- public function parse_adminbanlist($templateName = '')\r
- {\r
- $blogid = intRequestVar('blogid');\r
- $query = "SELECT * FROM %s WHERE blogid=%d ORDER BY iprange;";\r
- $query = sprintf($query, sql_table('ban'), (integer) $blogid);\r
- $template['content'] = 'banlist';\r
- $amount = skinableShowlist($query, 'table', $template, $templateName);\r
- if ( $amount == 0 )\r
- {\r
- echo _BAN_NONE;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_adminbatchaction()\r
- * Parse skinvar adminbatchaction\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_adminbatchaction()\r
- {\r
- echo Entity::hsc(requestVar('batchaction'));\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_adminbatchlist()\r
- * Parse skinvar adminbatchlist\r
- * \r
- * @param string $templateName name of template to use\r
- * @return void\r
- */\r
- public function parse_adminbatchlist($templateName = '')\r
- {\r
- global $manager;\r
- $templates = array();\r
- if ( !empty($templateName) )\r
- {\r
- $templates = skinableTEMPLATE::read($templateName);\r
- }\r
- if ( isset($templates['ADMIN_BATCHLIST']) || !empty($templates['ADMIN_BATCHLIST']) )\r
- {\r
- $template = $templates['ADMIN_BATCHLIST'];\r
- }\r
- else\r
- {\r
- $template = '<li><%text(_BATCH_EXECUTING)%><b><%adminbatchaction%></b>'\r
- . '<%batchlisttype%> <b><%batchid%></b>...'\r
- . '<b><%batchlistmsg%></b></li>' . "\n";\r
- }\r
- \r
- $selected = requestIntArray('batch');\r
- $action = requestVar('batchaction');\r
- \r
- switch ( $this->skintype )\r
- {\r
- case 'batchitem':\r
- $batchlisttype = _BATCH_ONITEM;\r
- $deleteaction = 'deleteOneItem';\r
- $moveaction = 'moveOneItem';\r
- $destid = intRequestVar('destcatid');\r
- break;\r
- case 'batchcomment':\r
- $batchlisttype = _BATCH_ONCOMMENT;\r
- $deleteaction = 'deleteOneComment';\r
- break;\r
- case 'batchmember':\r
- $batchlisttype = _BATCH_ONMEMBER;\r
- $deleteaction = 'deleteOneMember';\r
- $setadminsql = sql_table('member') . ' SET madmin = 1 WHERE mnumber = ';\r
- $unsetchksql = 'SELECT * FROM ' . sql_table('member') . ' WHERE madmin = 1 AND mcanlogin = 1';\r
- $unsetupsql = sql_table('member') . ' SET madmin = 0 WHERE mnumber = ';\r
- $unseterrmsg = _ERROR_ATLEASTONEADMIN;\r
- break;\r
- case 'batchteam':\r
- $blogid = intRequestVar('blogid');\r
- $batchlisttype = _BATCH_ONTEAM;\r
- $deleteaction = 'deleteOneTeamMember';\r
- $setadminsql = sql_table('team') . ' SET tadmin = 1 WHERE tblog = ' . $blogid . ' AND tmember = ';\r
- $unsetchksql = 'SELECT * FROM ' . sql_table('team') . ' WHERE tadmin = 1 AND tblog = ' . $blogid;\r
- $unseterrmsg = _ERROR_ATLEASTONEBLOGADMIN;\r
- $unsetupsql = sql_table('team') . ' SET tadmin = 0 WHERE tblog = ' . $blogid . ' AND tmember = ';\r
- break;\r
- case 'batchcategory':\r
- $batchlisttype = _BATCH_ONCATEGORY;\r
- $deleteaction = 'deleteOneCategory';\r
- $moveaction = 'moveOneCategory';\r
- $destid = intRequestVar('destblogid');\r
- break;\r
- }\r
- \r
- // walk over all selectedids and perform action\r
- foreach ( $selected as $selectedid )\r
- {\r
- $error = '';\r
- $selectedid = intval($selectedid);\r
- switch ( $action )\r
- {\r
- case 'delete':\r
- if ( $this->skintype != 'batchteam' )\r
- {\r
- $error = $this->objAdmin->$deleteaction($selectedid);\r
- }\r
- else\r
- {\r
- $error = $this->objAdmin->deleteOneTeamMember($blogid, $selectedid);\r
- }\r
- break;\r
- case 'move':\r
- $error = $this->objAdmin->$moveaction($selectedid, $destid);\r
- break;\r
- case 'setadmin':\r
- // always succeeds\r
- sql_query('UPDATE ' . $setadminsql . $selectedid);\r
- $error = '';\r
- break;\r
- case 'unsetadmin':\r
- // there should always remain at least one super-admin\r
- $r = sql_query($unsetchksql);\r
- if ( sql_num_rows($r) < 2 )\r
- {\r
- $error = $unseterrmsg;\r
- }\r
- else\r
- {\r
- sql_query('UPDATE ' . $unsetupsql . $selectedid);\r
- }\r
- break;\r
- default:\r
- $error = _BATCH_UNKNOWN . Entity::hsc($action);\r
- }\r
- $data = array(\r
- 'batchid' => $selectedid,\r
- 'batchlisttype' => Entity::hsc($batchlisttype),\r
- 'adminbatchaction' => Entity::hsc($action),\r
- 'batchlistmsg' => $error ? $error : _BATCH_SUCCESS,\r
- );\r
- $handler = new skinableACTIONS('template', $template, new ADMIN);\r
- $parser = new skinablePARSER($handler);\r
- \r
- ob_start();\r
- $parser->parse($template);\r
- $template = ob_get_contents();\r
- ob_end_clean();\r
- \r
- echo TEMPLATE::fill($template, $data);\r
- return;\r
- }\r
- }\r
- \r
- /**\r
- * Actions::parse_adminbloglink()\r
- * Parse skinvar adminbloglink\r
- * \r
- * @param string $templateName name of template to use\r
- * @return void\r
- */\r
- public function parse_adminbloglink($templateName = '')\r
- {\r
- global $manager;\r
- $blogid = intRequestVar('blogid');\r
- $blog =& $manager->getBlog($blogid);\r
- $templates = array();\r
- \r
- if ( !empty($templateName) )\r
- {\r
- $templates = skinableTEMPLATE::read($templateName);\r
- }\r
- \r
- if ( isset($templates['ADMIN_BLOGLINK']) || !empty($templates['ADMIN_BLOGLINK']) )\r
- {\r
- $template = $templates['ADMIN_BLOGLINK'];\r
- }\r
- else\r
- {\r
- $template = '<a href="<%url%>" title="<%adminbloglinktitle%>"><%blogname%></a>';\r
- }\r
- \r
- $data = array(\r
- 'url' => Entity::hsc($blog->getURL()),\r
- 'adminbloglinktitle' => _BLOGLIST_TT_VISIT,\r
- 'blogname' => Entity::hsc($blog->getName())\r
- );\r
- \r
- echo TEMPLATE::fill($template, $data);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_adminerrormesg()\r
- * Parse skinvar adminerrormesg\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_adminerrormesg()\r
- {\r
- global $CONF;\r
- $message = '';\r
- \r
- if ( requestVar('errormessage') )\r
- {\r
- $message = requestVar('errormessage');\r
- }\r
- elseif ( cookieVar($CONF['CookiePrefix'] . 'errormessage') )\r
- {\r
- $message = cookieVar($CONF['CookiePrefix'] . 'errormessage');\r
- }\r
- elseif ( $this->objAdmin->sessionVar($CONF['CookiePrefix'] . 'errormessage') )\r
- {\r
- $message = $this->objAdmin->sessionVar($CONF['CookiePrefix'] . 'errormessage');\r
- }\r
- echo Entity::hsc($message);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_adminparsedinclude()\r
- * Parse skinvar adminparsedinclude\r
- * \r
- * @param string $filename name of file\r
- * @return void\r
- */\r
- public function parse_adminparsedinclude($filename)\r
- {\r
- // check current level\r
- if ( $this->level > 3)\r
- {\r
- // max. depth reached (avoid endless loop)\r
- return;\r
- }\r
- \r
- $skin = new skinableSKIN($this->skin->id);\r
- $file = $this->getIncludeFileName($filename);\r
- if ( !$skin->isValid && !file_exists($file) )\r
- {\r
- return;\r
- }\r
- $contents = $skin->getContent($filename);\r
- if ( !$contents )\r
- {\r
- if ( !file_exists($file) )\r
- {\r
- return;\r
- }\r
- $contents = file_get_contents($file);\r
- if ( empty($contents) )\r
- {\r
- return;\r
- }\r
- }\r
- $this->level = $this->level + 1;\r
- // parse file contents\r
- $this->parser->parse($contents);\r
- \r
- $this->level = $this->level - 1;\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_adminskineditallowedlist()\r
- * Parse skinvar adminskineditallowedlist\r
- * \r
- * @param string $type template/blog\r
- * @param string $templateName name of template to use\r
- * @return void\r
- */\r
- public function parse_adminskineditallowedlist($type = 'template', $templateName = '')\r
- {\r
- switch ( $type )\r
- {\r
- /* TODO: blog seems not to be used */\r
- case 'blog':\r
- $query = "SELECT bshortname, bname FROM %s";\r
- $query = sprintf($query, sql_table('blog'));\r
- $show = array(\r
- 'content' => 'shortblognames'\r
- );\r
- break;\r
- case 'template':\r
- $query = "SELECT tdname as name, tddesc as description FROM %s;";\r
- $query = sprintf($query, sql_table('admintemplate_desc'));\r
- $show = array(\r
- 'content' => 'shortnames'\r
- );\r
- break;\r
- }\r
- skinableShowlist($query, 'table', $show, $templateName);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_adminskinielist()\r
- * Parse skinvar adminskinielist\r
- * \r
- * @param string $type skin/template\r
- * @param string $templateName name of template to use\r
- * @return void\r
- */\r
- public function parse_adminskinielist($type, $templateName = '')\r
- {\r
- $templates = array();\r
- if ( $templateName )\r
- {\r
- $templates = skinableTEMPLATE::read($templateName);\r
- }\r
- if ( isset($templates['SKINIE_EXPORT_LIST']) && !empty($templates['SKINIE_EXPORT_LIST']) )\r
- {\r
- $template = $templates['SKINIE_EXPORT_LIST'];\r
- }\r
- else\r
- {\r
- $template = '<td><input type="checkbox" name="<%typeid%>" id="<%expid%>" /><label for="<%expid%>"><%expname%></label></td>' . "\n"\r
- . "<td><%expdesc%></td>\n"\r
- . "</tr><tr>\n";\r
- }\r
- switch ( $type )\r
- {\r
- case 'skin':\r
- $query = "SELECT * FROM %s;";\r
- $query = sprintf($query, sql_table('adminskin_desc'));\r
- $res = sql_query($query);\r
- \r
- while ( $skinObj = sql_fetch_object($res) )\r
- {\r
- $data = array(\r
- 'typeid' => 'skin[' . $skinObj->sdnumber . ']',\r
- 'expid' => 'skinexp' . $skinObj->sdnumber,\r
- 'expname' => Entity::hsc($skinObj->sdname),\r
- 'expdesc' => Entity::hsc($skinObj->sddesc),\r
- );\r
- echo TEMPLATE::fill($template, $data);\r
- }\r
- break;\r
- case 'template':\r
- $query = "SELECT * FROM %s;";\r
- $query = sprintf($query, sql_table('admintemplate_desc'));\r
- $res = sql_query($query);\r
- while ( $templateObj = sql_fetch_object($res) )\r
- {\r
- $data = array(\r
- 'typeid' => 'template[' . $templateObj->tdnumber . ']',\r
- 'expid' => 'templateexp' . $templateObj->tdnumber,\r
- 'expname' => Entity::hsc($templateObj->tdname),\r
- 'expdesc' => Entity::hsc($templateObj->tddesc),\r
- );\r
- echo TEMPLATE::fill($template, $data);\r
- }\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_adminskinoverview()\r
- * Parse skinvar adminskinoverview\r
- * \r
- * @param string $templateName name of template to use\r
- * @return void\r
- */\r
- public function parse_adminskinoverview($templateName = '')\r
- {\r
- $query = "SELECT * FROM %s ORDER BY sdname;";\r
- $query = sprintf($query, sql_table('adminskin_desc'));\r
- \r
- $template['content'] = 'adminskinlist';\r
- $template['tabindex'] = 10;\r
- skinableShowlist($query, 'table', $template, $templateName);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_adminskinselectoptions()\r
- * Parse skinvar adminskinselectoptions\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_adminskinselectoptions()\r
- {\r
- global $CONF;\r
- $query = "SELECT sdname as text, sdnumber as value FROM %s;";\r
- $query = sprintf($query, sql_table('adminskin_desc'));\r
- \r
- $template['name'] = 'adminskin';\r
- $template['selected'] = $CONF['DefaultAdminSkin'];\r
- $template['tabindex'] = 110;\r
- skinableShowlist($query, 'select', $template, '');\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_adminspecialskinlist()\r
- * Parse skinvar adminspecialskinlist\r
- * \r
- * @param string $templateName name of template to use\r
- */\r
- public function parse_adminspecialskinlist($templateName = '')\r
- {\r
- $templates = array();\r
- if ( $templateName )\r
- {\r
- $templates = skinableTEMPLATE::read($templateName);\r
- }\r
- \r
- $nType = skinableSKIN::getAdminskinDefaultTypes();\r
- $skinid = intRequestVar('skinid');\r
- \r
- $query = "SELECT stype FROM %s WHERE stype NOT IN (%s) AND sdesc=%d;";\r
- $query = sprintf($query, sql_table('adminskin'), "'" . implode("', '", $nType) . "'", (integer) $skinid);\r
- \r
- $res = sql_query($query);\r
- if ( $res && sql_num_rows($res) > 0 )\r
- {\r
- $data = array();\r
- if ( isset($templates['ADMIN_SPECIALSKINLIST_HEAD']) && !empty($templates['ADMIN_SPECIALSKINLIST_HEAD']) )\r
- {\r
- $template['head'] = $templates['ADMIN_SPECIALSKINLIST_HEAD'];\r
- }\r
- else\r
- {\r
- $template['head'] = "<ul>\n";\r
- }\r
- echo TEMPLATE::fill($template['head'], $data);\r
- if ( isset($templates['ADMIN_SPECIALSKINLIST_BODY']) && !empty($templates['ADMIN_SPECIALSKINLIST_BODY']) )\r
- {\r
- $template['body'] = $templates['ADMIN_SPECIALSKINLIST_BODY'];\r
- }\r
- else\r
- {\r
- $template['body'] = '<li><a tabindex="<%tabindex%>" href="index.php?action=adminskinedittype&skinid=<%skinid%>'\r
- . '&type=<%skintype%>"><%skintype%></a> (<a tabindex="<%tabindex%>" href="index.php?'\r
- . 'action=adminskinremovetype&skinid=<%skinid%>&type=<%skintype%>">remove</a>)</li>';\r
- }\r
- $tabstart = 120;\r
- while ( $row = sql_fetch_assoc($res) )\r
- {\r
- $data = array(\r
- 'tabindex' => $tabstart++,\r
- 'skinid' => $skinid,\r
- 'skintype' => Entity::hsc(strtolower($row['stype']))\r
- );\r
- echo TEMPLATE::fill($template['body'], $data);\r
- }\r
- \r
- $data = array();\r
- if ( isset($templates['ADMIN_SPECIALSKINLIST_FOOT']) && !empty($templates['ADMIN_SPECIALSKINLIST_FOOT']) )\r
- {\r
- $template['foot'] = $templates['ADMIN_SPECIALSKINLIST_FOOT'];\r
- }\r
- else\r
- {\r
- $template['foot'] = "<ul>\n";\r
- }\r
- echo TEMPLATE::fill($template['foot'], $data);\r
- return;\r
- }\r
- }\r
- \r
- /**\r
- * Actions::parse_adminstyleseets()\r
- * Parse skinvar adminstyleseets\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_adminstyleseets()\r
- {\r
- global $CONF;\r
- $includePrefix = $this->skin->includePrefix;\r
- \r
- if ( strlen($includePrefix) > 0 )\r
- {\r
- $styleURL = Entity::hsc($CONF['AdminURL']) . 'adminskins/' . $includePrefix . 'admin_' . $CONF['AdminCSS'] . '.css';\r
- }\r
- else\r
- {\r
- $styleURL = Entity::hsc($CONF['AdminURL']) . 'styles/admin_' . $CONF['AdminCSS'] . '.css';\r
- }\r
- echo $styleURL;\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_adminstyleselectoptions()\r
- * Parse skinvar adminstyleselectoptions\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_adminstyleselectoptions()\r
- {\r
- global $CONF, $manager, $DIR_NUCLEUS;\r
- if ( strlen($this->skin->includePrefix) > 0 )\r
- {\r
- $scndir = $DIR_NUCLEUS . 'adminskins/' . $this->skin->includePrefix;\r
- }\r
- else\r
- {\r
- $scndir = $DIR_NUCLEUS . 'styles/';\r
- }\r
- $files = scandir($scndir);\r
- \r
- foreach ( $files as $file )\r
- {\r
- if ( !preg_match("#^admin_(.*)\.css$#", $file, $matches) )\r
- {\r
- continue;\r
- }\r
- \r
- $name = $matches[1];\r
- $opts = '<option value="' . $name . '"';\r
- if ( $name != $CONF['AdminCSS'] )\r
- {\r
- $opts .= "<option value=\"{$name}\">{$name}</option>\n";\r
- }\r
- else\r
- {\r
- $opts .= "<option value=\"{$name}\" selected=\"selected\">{$name}</option>\n";\r
- }\r
- echo $opts;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_admintemplateoverview()\r
- * Parse skinvar admintemplateoverview\r
- * \r
- * @param string $templateName name of template to use\r
- * @return void\r
- */\r
- public function parse_admintemplateoverview($templateName = '')\r
- {\r
- $query = "SELECT * FROM %s ORDER BY tdname;";\r
- $query = sprintf($query, sql_table('admintemplate_desc'));\r
- \r
- $template['content'] = 'admintemplatelist';\r
- $template['tabindex'] = 10;\r
- \r
- skinableShowlist($query, 'table', $template, $templateName);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_allowedadminskinactions()\r
- * Parse skinvar allowedadminskinactions\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_allowedadminskinactions()\r
- {\r
- global $DIR_ADMINSKINS;\r
- $skinType = strtolower(trim(requestVar('type')));\r
- $actions = skinableSKIN::getAllowedActionsForType($skinType);\r
- sort($actions);\r
- \r
- while ( $current = array_shift($actions) )\r
- {\r
- // skip deprecated vars\r
- if ($current == 'ifcat' || $current == 'imagetext' || $current == 'vars')\r
- {\r
- continue;\r
- }\r
- \r
- echo "<a href=\"{$DIR_ADMINSKINS}documentation/help.html#{$current}\" onclick=\"if (event && event.preventDefault) event.preventDefault(); return help(this.href);\">{$current}</a>\n";\r
- \r
- if ( count($actions) != 0 )\r
- {\r
- echo ", ";\r
- }\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_allowedskinactions()\r
- * Parse skinvar allowedskinactions\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_allowedskinactions()\r
- {\r
- $skinType = strtolower(trim(requestVar('type')));\r
- $actions = SKIN::getAllowedActionsForType($skinType);\r
- sort($actions);\r
- \r
- while ( $current = array_shift($actions) )\r
- {\r
- // skip deprecated vars\r
- if ( $current == 'ifcat' || $current == 'imagetext' || $current == 'vars' )\r
- {\r
- continue;\r
- }\r
- \r
- /* TODO: alternative function should be used or not? */\r
- echo helplink("skinvar-{$current}") . "$current</a>\n";\r
- \r
- if ( count($actions) != 0 )\r
- {\r
- echo ", ";\r
- }\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Action::parse_banlistdeletedlist()\r
- * Parse skinvar banlistdeletedlist\r
- * \r
- * @param string $templateName name of template to use\r
- * @return void\r
- */\r
- public function parse_banlistdeletedlist($templateName = '')\r
- {\r
- global $manager;\r
- $templates = array();\r
- \r
- if ( $templateName )\r
- {\r
- $templates = skinableTEMPLATE::read($templateName);\r
- }\r
- if ( isset($templates['BANLIST_DELETED_LIST']) && !empty($templates['BANLIST_DELETED_LIST']) )\r
- {\r
- $template = $templates['BANLIST_DELETED_LIST'];\r
- }\r
- else\r
- {\r
- $template = "<li><%blogname%></li>\n";\r
- }\r
- $deleted = requestArray('delblogs');\r
- foreach ( $deleted as $delblog )\r
- {\r
- $blog =& $manager->getBlog($delblog);\r
- $data = array(\r
- Entity::hsc($blog->getName())\r
- );\r
- TEMPLATE::fill($template, $data);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_batchdeletelist()\r
- * Parse skinvar batchdeletelist\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_batchdeletelist()\r
- {\r
- $selected = requestIntArray('batch');\r
- $index = 0;\r
- \r
- foreach ( $selected as $select )\r
- {\r
- echo '<input type="hidden" name="batch[' . ($index++) . ']" value="' . intval($select) . "\" />\n";\r
- }\r
- // add hidden vars for team & comment\r
- if ( requestVar('action') == 'batchteam' )\r
- {\r
- echo '<input type="hidden" name="blogid" value="' . intRequestVar('blogid') . "\" />\n";\r
- }\r
- if ( requestVar('action') == 'batchcomment' )\r
- {\r
- echo '<input type="hidden" name="itemid" value="' . intRequestVar('itemid') . "\" />\n";\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_batchdeletetype()\r
- * Parse skinvar batchdeletetype\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- function parse_batchdeletetype()\r
- {\r
- echo Entity::hsc(requestVar('action'));\r
- return;\r
- }\r
-\r
- /**\r
- * Actions::parse_batchmovebtn()\r
- * Parse skinvar batchmovebtn\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_batchmovebtn()\r
- {\r
- $actionType = requestVar('action');\r
- switch ( $actionType )\r
- {\r
- case 'batchitem':\r
- echo _MOVE_BTN;\r
- break;\r
- case 'batchcategory':\r
- echo _MOVECAT_BTN;\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_batchmovelist()\r
- * Parse skinvar batchmovelist\r
- * \r
- * @param void\r
- * @param void\r
- */\r
- public function parse_batchmovelist()\r
- {\r
- $selected = requestIntArray('batch');\r
- foreach ( $selected as $select )\r
- {\r
- echo '<input type="hidden" name="batch[' . ($select++) . ']" value="' . intval($select) . "\" />\n";\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_batchmovetitle()\r
- * Parse skinvar batchmovetitle\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_batchmovetitle()\r
- {\r
- $actionType = requestVar('action');\r
- switch ( $actionType )\r
- {\r
- case 'batchitem':\r
- echo _MOVE_TITLE;\r
- break;\r
- case 'batchcategory':\r
- echo _MOVECAT_TITLE;\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_batchmovetype()\r
- * Parse skinvar batchmovetype\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_batchmovetype()\r
- {\r
- echo Entity::hsc(requestVar('action'));\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_blogcatlist()\r
- * Parse skinvar blogcatlist\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_blogcatlist()\r
- {\r
- global $manager;\r
- $blogid = intRequestVar('blogid');\r
- $query = "SELECT * FROM %s WHERE cblog = %d ORDER BY cname;";\r
- $query = sprintf($query, sql_table('category'), (integer) $blogid);\r
- \r
- $template['content'] = 'categorylist';\r
- $template['tabindex'] = 200;\r
- \r
- $batch = new skinableBATCH('member');\r
- $batch->showlist($query, 'table', $template);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_blognotifysetting()\r
- * Parse skinvar blognotifysetting\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_blognotifysetting($type)\r
- {\r
- global $manager;\r
- $blogid = intRequestVar('blogid');\r
- $blog = $manager->getBlog($blogid);\r
- \r
- switch ( $type )\r
- {\r
- case 'comment':\r
- if ( !$blog->notifyOnComment() )\r
- {\r
- return;\r
- }\r
- break;\r
- case 'vote':\r
- if ( !$blog->notifyOnVote() )\r
- {\r
- return;\r
- }\r
- break;\r
- case 'newitem':\r
- if ( !$blog->notifyOnNewItem() )\r
- {\r
- return;\r
- }\r
- break;\r
- }\r
- echo ' checked="checked"';\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_blogsetting()\r
- * Parse skinvar blogsetting\r
- * \r
- * @param string $which name of weblog setting\r
- * @return void\r
- */\r
- public function parse_blogsetting($which)\r
- {\r
- echo $this->parse_getblogsetting($which);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_blogsettingyesno()\r
- * Parse skinvar blogsettingyesno\r
- * \r
- * @param string $type type of weblog setting\r
- * @param string $templateName name of template to use\r
- * @return void\r
- */\r
- public function parse_blogsettingyesno($type, $templateName = '')\r
- {\r
- global $manager;\r
- \r
- $blogid = intRequestVar('blogid');\r
- $blog = $manager->getBlog($blogid);\r
- \r
- switch ( $type )\r
- {\r
- case 'convertbreaks':\r
- $checkedval = $blog->convertBreaks();\r
- $tabindex = 55;\r
- break;\r
- case 'allowpastposting':\r
- $checkedval = $blog->allowPastPosting();\r
- $tabindex = 57;\r
- break;\r
- case 'comments':\r
- $checkedval = $blog->commentsEnabled();\r
- $tabindex = 60;\r
- break;\r
- case 'public':\r
- $checkedval = $blog->isPublic();\r
- $tabindex = 70;\r
- break;\r
- case 'reqemail':\r
- $checkedval = $blog->emailRequired();\r
- $tabindex = 72;\r
- break;\r
- case 'searchable':\r
- $checkedval = $blog->getSearchable();\r
- $tabindex = 122;\r
- break;\r
- }\r
- $this->parse_inputyesno($type, $checkedval, $tabindex, 1, 0, _YES, _NO, 0, $templateName);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_blogteamlist()\r
- * Parse skinvar blogteamlist\r
- * \r
- * @param string $templateName name of template to use\r
- * @return void\r
- */\r
- public function parse_blogteamlist($templateName = '')\r
- {\r
- global $manager;\r
- $blogid = intRequestVar('blogid');\r
- $query = "SELECT tblog, tmember, mname, mrealname, memail, tadmin "\r
- . "FROM %s, %s "\r
- . "WHERE tmember=mnumber AND tblog= %d";\r
- $query = sprintf($query, sql_table('member'), sql_table('team'), (integer) $blogid);\r
- \r
- $template['content'] = 'teamlist';\r
- $template['tabindex'] = 10;\r
-\r
- $batch = new skinableBATCH('team');\r
- $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_blogteammembers()\r
- * Parse skinvar blogteammembers\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_blogteammembers()\r
- {\r
- $blogid = intRequestVar('blogid');\r
- $query = "SELECT mname, mrealname "\r
- . "FROM %s, %s "\r
- . "WHERE mnumber=tmember AND tblog=%d;";\r
- $query = sprintf($query, sql_table('member'), sql_table('team'), (integer) $blogid);\r
- $res = sql_query($query);\r
- $memberNames = array();\r
- while ($o = sql_fetch_object($res)) {\r
- $memberNames[] = Entity::hsc($o->mname) . ' (' . Entity::hsc($o->mrealname). ')';\r
- }\r
- echo implode(',', $memberNames);\r
- }\r
- \r
- /**\r
- * Actions::parse_blogtime()\r
- * Parse skinvar blogtime\r
- * \r
- * @param string $type type of time\r
- * @param string $format format for time expression\r
- * @param integer $offset offset of time\r
- * @return void\r
- */\r
- public function parse_blogtime($type, $format = '%H:%M', $offset = 0)\r
- {\r
- global $manager;\r
- \r
- if ( $type != 'blogtime' )\r
- {\r
- /* return server time */\r
- $timestamp = time() + $offset;\r
- }\r
- else\r
- {\r
- $bid = intRequestVar('blogid');\r
- $b = $manager->getBlog($bid);\r
- $timestamp = $b->getCorrectTime() + $offset;\r
- }\r
- \r
- echo i18n::formatted_datetime($format, $timestamp);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_bookmarkletadmin()\r
- * Parse skinvar bookmarkletadmin\r
- * \r
- * @param string $type type of anchor element for bookmarklet\r
- * @return void\r
- */\r
- public function parse_bookmarkletadmin($type)\r
- {\r
- global $manager;\r
- \r
- $blogid = intRequestVar('blogid');\r
- \r
- if ( $type != 'regfile' )\r
- {\r
- echo Entity::hsc(getBookmarklet($blogid));\r
- }\r
- else\r
- {\r
- $url = 'index.php?action=regfile&blogid=' . intval($blogid);\r
- $url = $manager->addTicketToUrl($url);\r
- /* TODO: Shift-JIS is not always correct, I think... */\r
- echo Entity::hsc($url, 'SJIS');\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_categorysetting()\r
- * Parse skinvar categorysetting\r
- * \r
- * @param string $type type in category setting\r
- * @return void\r
- */\r
- public function parse_categorysetting($type)\r
- {\r
- $catid = intRequestVar('catid');\r
- if ( $type == 'id' )\r
- {\r
- echo $catid;\r
- return;\r
- }\r
- $blogid = intRequestVar('blogid');\r
- $query = "SELECT * FROM %s WHERE cblog = %d AND catid = %d;";\r
- $query = sprintf($query, sql_table('category'), (integer) $blogid, (integer) $catid);\r
- $res = sql_query($query);\r
- $obj = sql_fetch_object($res);\r
- \r
- if ( $type != desc )\r
- {\r
- echo Entity::hsc($obj->cdesc);\r
- }\r
- else\r
- {\r
- echo Entity::hsc($obj->cname);\r
- }\r
- \r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_codename()\r
- * Parse templatevar codename\r
- * \r
- * @param void\r
- * @return void\r
- * \r
- * TODO: is this need???\r
- */\r
- public function parse_codename()\r
- {\r
- global $nucleus;\r
- echo $nucleus['codename'];\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_commentnavlist()\r
- * Parse skinvar commentnavlist\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_commentnavlist()\r
- {\r
- global $CONF, $manager, $member;\r
- \r
- // start index\r
- if ( postVar('start') )\r
- {\r
- $start = intPostVar('start');\r
- }\r
- else\r
- {\r
- $start = 0;\r
- }\r
- \r
- // amount of items to show\r
- if ( postVar('amount') )\r
- {\r
- $amount = intPostVar('amount');\r
- }\r
- else\r
- {\r
- $amount = (integer) $CONF['DefaultListSize'];\r
- if ( $amount < 1 )\r
- {\r
- $amount = 10;\r
- }\r
- }\r
- $query = 'SELECT cbody, cuser, cmail, cemail, mname, ctime, chost, cnumber, cip, citem '\r
- . 'FROM %s '\r
- . 'LEFT OUTER JOIN %s ON mnumber=cmember '\r
- . 'WHERE ';\r
- $query = sprintf($query, sql_table('comment'), sql_table('member'));\r
- \r
- if ( $this->skintype == 'itemcommentlist' )\r
- {\r
- $itemid = intRequestVar('itemid');\r
- $query .= " citem={$itemid}";\r
- $template['canAddBan'] = $member->blogAdminRights(intRequestVar('blogid'));\r
- $bid = 0;\r
- $nonComments = _NOCOMMENTS;\r
- }\r
- elseif ( $this->skintype == 'browseowncomments' )\r
- {\r
- $itemid = 0;\r
- $query .= ' cmember=' . $member->getID();\r
- $template['canAddBan'] = 0;\r
- $bid = 0;\r
- $nonComments = _NOCOMMENTS_YOUR;\r
- }\r
- elseif ( $this->skintype == 'blogcommentlist' )\r
- {\r
- $itemid = 0;\r
- $query .= ' cblog=' . intRequestVar('blogid');\r
- $template['canAddBan'] = $member->blogAdminRights(intRequestVar('blogid'));\r
- $bid = intRequestVar('blogid');\r
- $nonComments = _NOCOMMENTS_BLOG;\r
- }\r
- \r
- $search = postVar('search');\r
- if ( !empty($search) )\r
- {\r
- $query .= ' and cbody LIKE "%' . sql_real_escape_string($search) . '%"';\r
- }\r
- \r
- $query .= " ORDER BY ctime ASC LIMIT {$start},{$amount}";\r
- \r
- $template['content'] = 'commentlist';\r
- \r
- $navList = new skinableNAVLIST($this->skintype, $start, $amount, 0, 1000, $bid, $search, $itemid);\r
- $navList->showBatchList('comment', $query, 'table', $template, $nonComments);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_configsettingsedit()\r
- * Parse skinvar configsettingsedit\r
- * \r
- * @param string $type type of global configuration\r
- * @return void\r
- */\r
- public function parse_configsettingsedit($type)\r
- {\r
- global $CONF;\r
- switch ( $type )\r
- {\r
- case 'DefaultListSize':\r
- if ( !array_key_exists('DefaultListSize', $CONF) )\r
- {\r
- $query = "INSERT INTO %s VALUES (DefaultListSize, 10);";\r
- $query = sprintf($query, sql_table('config'));\r
- sql_query($query);\r
- $CONF['DefaultListSize'] = 10;\r
- }\r
- elseif ( intval($CONF['DefaultListSize']) < 1 )\r
- {\r
- $CONF['DefaultListSize'] = 10;\r
- }\r
- echo intval($CONF['DefaultListSize']);\r
- break;\r
- case 'SessionCookie':\r
- $value = $CONF['SessionCookie'];\r
- $txt1 = _SETTINGS_COOKIESESSION;\r
- $txt2 = _SETTINGS_COOKIEMONTH;\r
- $this->parse_inputyesno('SessionCookie', $value, 10190, 1, 0, $txt1, $txt2);\r
- break;\r
- case 'URLMode':\r
- $value = $CONF['URLMode'];\r
- $txt1 = _SETTINGS_URLMODE_NORMAL;\r
- $txt2 = _SETTINGS_URLMODE_PATHINFO;\r
- $this->parse_inputyesno('URLMode', $value, 10077, 'normal', 'pathinfo', $txt1, $txt2);\r
- break;\r
- default:\r
- if ( array_key_exists($type, $CONF) && is_string($CONF[$type]) )\r
- {\r
- echo Entity::hsc($CONF[$type]);\r
- }\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_configsettingsyesno()\r
- * Parse skinvar configsettingsyesno\r
- * \r
- * @param string $type type of global setting\r
- * @param integer $tabindex tabindex attribute of input element\r
- * @return void\r
- */\r
- function parse_configsettingsyesno($type, $tabindex)\r
- {\r
- global $CONF;\r
- if ( array_key_exists($type, $CONF) )\r
- {\r
- $this->parse_inputyesno($type, $CONF[$type], $tabindex);\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_customhelplink()\r
- * Parse skinvar customhelplink\r
- * \r
- * @param string $topic name of topic\r
- * @param string $tplName name of template\r
- * @param string $url string as URI\r
- * @param string $iconURL string as URI for icon\r
- * @param string $alt alternative text for image element\r
- * @param string $title title for anchor element\r
- * @return void\r
- */\r
- public function parse_customhelplink($topic, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')\r
- {\r
- $this->customHelp($topic, $url, $iconURL);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_date()\r
- * Parse skinvar date\r
- */\r
- public function parse_date($format = 'c')\r
- {\r
- global $CONF, $manager;\r
- echo i18n::formatted_datetime($format, time(), 'iso8601', $manager->getBlog((integer) $CONF['DefaultBlog']));\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_defaultadminskintypes()\r
- * Parse skinvar defaultadminskintypes\r
- * \r
- * @param string $tabindex index number for tabindex attribute of input element\r
- * @param string $templateName name of template\r
- * @return void\r
- */\r
- public function parse_defaultadminskintypes($tabindex, $templateName = '')\r
- {\r
- $templates = array();\r
- if ( $templateName )\r
- {\r
- $templates = skinableTEMPLATE::read($templateName);\r
- }\r
- \r
- $types = skinableSKIN::getAdminskinDefaultTypeFriendlyNames();\r
- ksort($types);\r
- \r
- if ( array_key_exists('ADMINSKINTYPELIST_HEAD', $templates) && !empty($templates['ADMINSKINTYPELIST_HEAD']) )\r
- {\r
- $template['head'] = $templates['ADMINSKINTYPELIST_HEAD'];\r
- }\r
- else\r
- {\r
- $template['head'] = "<ul>\n";\r
- }\r
- \r
- echo $template['head'];\r
- \r
- if ( array_key_exists('ADMINSKINTYPELIST_BODY', $templates) && !empty($templates['ADMINSKINTYPELIST_BODY']) )\r
- {\r
- $template['body'] = $templates['ADMINSKINTYPELIST_BODY'];\r
- }\r
- else\r
- {\r
- $template['body'] = '<li><a tabindex="<%tabindex%>" href="index.php?action=adminskinedittype&skinid=<%skinid%>&type=<%skintype%>">'\r
- . "<%name%></a> <%help%></li>\n";\r
- }\r
- $handler = new skinableACTIONS('template', $template, new ADMIN);\r
- $parser = new PARSER(skinableACTIONS::getDefinedActions(), $handler);\r
- \r
- foreach ( $types as $type => $fName )\r
- {\r
- $helplink = $this->customHelpHtml('skinpart' . $type, $templateName);\r
- $data = array(\r
- 'tabindex' => $tabindex,\r
- 'skintype' => $type,\r
- 'name' => $fName,\r
- 'help' => $helplink,\r
- 'skinid' => intrequestVar('skinid'),\r
- );\r
- $templateBody = skinableTEMPLATE::fill($template['body'], $data);\r
- $parser->parse($templateBody);\r
- $tabindex++;\r
- }\r
- if ( array_key_exists('ADMINSKINTYPELIST_FOOT', $templates) && !empty($templates['ADMINSKINTYPELIST_FOOT']) )\r
- {\r
- $template['foot'] = $templates['ADMINSKINTYPELIST_FOOT'];\r
- }\r
- else\r
- {\r
- $template['foot'] = " </ul>\n";\r
- }\r
- echo $template['foot'];\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_defblogselect()\r
- * Parse skinvar defblogselect\r
- * \r
- * @param string $templateName name of template\r
- * @return void\r
- */\r
- public function parse_defblogselect($templateName = '')\r
- {\r
- global $CONF;\r
- $query = "SELECT bname as text, bnumber as value FROM %s;";\r
- $query = sprintf($query, sql_table('blog'));\r
- $template['name'] = 'DefaultBlog';\r
- $template['selected'] = $CONF['DefaultBlog'];\r
- $template['tabindex'] = 10;\r
- skinableShowlist($query, 'select', $template, $templateName);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_defcatselect()\r
- * Parse skinvar defcatselect\r
- * \r
- * @param string $templateName name of template\r
- * @return void\r
- */\r
- public function parse_defcatselect($templateName = '')\r
- {\r
- global $manager;\r
- $blogid = intRequestVar('blogid');\r
- $blog = $manager->getBlog($blogid);\r
- $query = "SELECT cname as text, catid as value FROM %s WHERE cblog=%d;";\r
- $query = sprintf($query, sql_table('category'), (integer) $blog->getID());\r
- $template['name'] = 'defcat';\r
- $template['selected'] = $blog->getDefaultCategory();\r
- $template['tabindex'] = 110;\r
- skinableShowlist($query, 'select', $template, $templateName);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_defskinselect()\r
- * Parse skinvar defskinselect\r
- * \r
- * @param string $type type of skin\r
- * @param string $templateName name of template\r
- * @return void\r
- */\r
- public function parse_defskinselect($type = 'blog', $templateName = '')\r
- {\r
- global $manager;\r
- $query = "SELECT sdname as text, sdnumber as value FROM %s;";\r
- $query = sprintf($query, sql_table('skin_desc'));\r
- \r
- $blogid = intRequestVar('blogid');\r
- \r
- if ( !$blogid )\r
- {\r
- global $CONF;\r
- $template['selected'] = $CONF['BaseSkin'];\r
- }\r
- else\r
- {\r
- $blog = $manager->getBlog($blogid);\r
- $template['selected'] = $blog->getDefaultSkin();\r
- }\r
- \r
- if ( $type != 'blog' )\r
- {\r
- $nname = 'BaseSkin';\r
- }\r
- else\r
- {\r
- $nname = 'defskin';\r
- }\r
- \r
- $template['name'] = $nname;\r
- $template['tabindex'] = 50;\r
- skinableShowlist($query, 'select', $template, $templateName);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_deleteitembody()\r
- * Parse skinvar deleteitembody\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_deleteitembody()\r
- {\r
- global $manager;\r
- $itemid = intRequestVar('itemid');\r
- $item =& $manager->getItem($itemid, 1, 1);\r
- $body = strip_tags($item['body']);\r
- echo Entity::hsc(shorten($body, 300, '...'));\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_deleteitemid()\r
- * Parse skinvar deleteitemid\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_deleteitemid()\r
- {\r
- echo (integer) intRequestVar('itemid');\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_deleteitemtitle()\r
- * Parse skinvar deleteitemtitle\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_deleteitemtitle()\r
- {\r
- global $manager;\r
- $itemid = intRequestVar('itemid');\r
- $item =& $manager->getItem($itemid, 1, 1);\r
- echo Entity::hsc(strip_tags($item['title']));\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_editadminskin()\r
- * Parse skinvar editadminskin\r
- * \r
- * @param string $type type of skin setting\r
- * @return void\r
- */\r
- public function parse_editadminskin($type = 'id')\r
- {\r
- $skinid = intRequestVar('skinid');\r
- $skin = new skinableSKIN($skinid);\r
- switch ( $type )\r
- {\r
- case 'id':\r
- echo intRequestVar('skinid');\r
- break;\r
- case 'name':\r
- echo Entity::hsc($skin->getName());\r
- break;\r
- case 'desc':\r
- echo Entity::hsc($skin->getDescription());\r
- break;\r
- case 'type':\r
- echo Entity::hsc($skin->getContentType());\r
- break;\r
- case 'prefix':\r
- echo Entity::hsc($skin->getIncludePrefix());\r
- break;\r
- case 'mode':\r
- $this->parse_inputyesno('inc_mode', $skin->getIncludeMode(), 120, 'skindir', 'normal', _PARSER_INCMODE_SKINDIR, _PARSER_INCMODE_NORMAL);\r
- default:\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_editadminskintype()\r
- * Parse skinvar editadminskintype\r
- * \r
- * @param string $type name of skin type\r
- * @return void\r
- */\r
- public function parse_editadminskintype($type = 'id')\r
- {\r
- global $CONF, $manager, $member;\r
- $skinid = intRequestVar('skinid');\r
- $skin = new skinableSKIN($skinid);\r
- $fNames = skinableSKIN::getFriendlyNames();\r
- $sType = strtolower(trim(requestVar('type')));\r
- \r
- switch ( $type )\r
- {\r
- case 'id':\r
- echo intRequestVar('skinid');\r
- break;\r
- case 'name':\r
- echo Entity::hsc($skin->getName());\r
- break;\r
- case 'desc':\r
- echo Entity::hsc($skin->getDescription());\r
- break;\r
- case 'type':\r
- echo Entity::hsc($skin->getContentType());\r
- break;\r
- case 'content':\r
- echo Entity::hsc($skin->getContent($sType));\r
- break;\r
- case 'skintype':\r
- $skinType = isset($fNames[$sType]) ? $fNames[$sType] : ucfirst($sType);\r
- echo Entity::hsc($skinType);\r
- break;\r
- case 'skintyperaw':\r
- echo Entity::hsc($sType);\r
- break;\r
- case 'prefix':\r
- echo Entity::hsc($skin->getIncludePrefix());\r
- break;\r
- case 'mode':\r
- $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;\r
- echo Entity::hsc($incMode);\r
- break;\r
- default:\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_editadmintemplateinfo()\r
- * Parse skinvar editadmintemplateinfo\r
- * \r
- * @param string $type type of skin template\r
- * @param string $description description of template\r
- * @param string $name name of stemplate\r
- * @param string $tabindex index number for tabindex attribute of input element\r
- * @param string $big \r
- * @param string $tplt \r
- */\r
- function parse_editadmintemplateinfo($type, $description = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')\r
- {\r
- global $manager;\r
- $templateid = intRequestVar('templateid');\r
- $templatename = skinableTEMPLATE::getNameFromId($templateid);\r
- $templatedescription = skinableTEMPLATE::getDesc($templateid);\r
- $template =& skinableTEMPLATE::read($templatename);\r
- switch ( $type )\r
- {\r
- case 'id':\r
- echo intval($templateid);\r
- break;\r
- case 'name':\r
- echo Entity::hsc($templatename);\r
- break;\r
- case 'desc':\r
- echo Entity::hsc($templatedescription);\r
- break;\r
- case 'extratemplate':\r
- $tabidx = 600;\r
- $pluginfields = array();\r
- $manager->notify(\r
- 'AdminTemplateExtraFields',\r
- array(\r
- 'fields' => &$pluginfields\r
- )\r
- );\r
- $tmplt = array();\r
- if ( $description )\r
- {\r
- $tmplt = skinableTEMPLATE::read($description);\r
- }\r
- if ( array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) && !empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )\r
- {\r
- $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];\r
- }\r
- else\r
- {\r
- $base = "</tr>\n"\r
- . "<tr>\n"\r
- . "\t" . '<th colspan="2"><%explugtplname%>' . "</th>\n";\r
- }\r
- foreach ( $pluginfields as $pfkey => $pfvalue )\r
- {\r
- $data = array(\r
- 'explugtplname' => Entity::hsc($pfkey)\r
- );\r
- echo TEMPLATE::fill($base, $data);\r
- foreach ( $pfvalue as $pffield => $pfdesc )\r
- {\r
- $this->_templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);\r
- }\r
- }\r
- break;\r
- default:\r
- $desc = defined($description) ? constant($description) : $description;\r
- $name = defined($name) ? constant($name) : $name;\r
- $this->_templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_editcomment()\r
- * Parse skinvar editcomment\r
- * \r
- * @param string $type type of comment setting\r
- * @return void\r
- */\r
- public function parse_editcomment($type = 'id')\r
- {\r
- global $manager;\r
- $commentid = intRequestVar('commentid');\r
- $comment = COMMENT::getComment($commentid);\r
- \r
- $manager->notify('PrepareCommentForEdit', array('comment' => &$comment));\r
- \r
- switch ( $type )\r
- {\r
- case 'id':\r
- echo intRequestVar('commentid');\r
- break;\r
- case 'user':\r
- if (array_key_exists('member', $comment) && !empty($comment['member']) )\r
- {\r
- echo $comment['member'] . " (" . _EDITC_MEMBER . ")";\r
- }\r
- else\r
- {\r
- echo $comment['user'] . " (" . _EDITC_NONMEMBER . ")";\r
- }\r
- break;\r
- case 'date':\r
- echo date("Y-m-d @ H:i", $comment['timestamp']);\r
- break;\r
- case 'body':\r
- $comment['body'] = str_replace('<br />', '', $comment['body']);\r
- $comment['body'] = preg_replace("#<a href=['\"]([^'\"]+)['\"]( rel=\"nofollow\")?>[^<]*</a>#", "\\1", $comment['body']);\r
- echo $comment['body'];\r
- default:\r
- echo $comment[$type];\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_editdesturl()\r
- * Parse skinvar editdesturl\r
- */\r
- public function parse_editdesturl()\r
- {\r
- if ( requestVar('desturl') )\r
- {\r
- echo Entity::hsc(requestVar('desturl'));\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_editmemberlist()\r
- * Parse skinvar editmemberlist\r
- * \r
- * @param string $templateName name of template\r
- * @return void\r
- */\r
- public function parse_editmemberlist($templateName = '')\r
- {\r
- global $manager;\r
- // show list of members with actions\r
- $query = 'SELECT * FROM '.sql_table('member');\r
- $template['content'] = 'memberlist';\r
- $template['tabindex'] = 10;\r
- \r
- $batch = new skinableBATCH('member');\r
- $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_editmemberlist()\r
- * Parse skinvar editmemberlist\r
- * \r
- * @param string $templateName name of template\r
- * @return void\r
- */\r
- public function parse_editmemberlist($templateName = '')\r
- {\r
- global $manager;\r
- // show list of members with actions\r
- $query = 'SELECT * FROM '. sql_table('member');\r
- $template['content'] = 'memberlist';\r
- $template['tabindex'] = 10;\r
- \r
- $batch = new skinableBATCH('member');\r
- $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_editpluginfo()\r
- * Parse skinvar editpluginfo\r
- * \r
- * @param string $type type of plugin info\r
- * @return void\r
- */\r
- public function parse_editpluginfo($type)\r
- {\r
- $pid = intRequestVar('plugid');\r
- switch ( $type )\r
- {\r
- case 'id':\r
- echo $pid;\r
- break;\r
- case 'name':\r
- echo Entity::hsc(getPluginNameFromPid($pid));\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_editplugoptionslist()\r
- * Parse skinvar editplugoptionslist\r
- * \r
- * @param string $templateName name of template\r
- * @return void\r
- */\r
- public function parse_editplugoptionslist($templateName = '')\r
- {\r
- global $manager;\r
- \r
- $pid = intRequestVar('plugid');\r
- $aOptions = array();\r
- $aOIDs = array();\r
- \r
- $query = "SELECT * FROM %s WHERE ocontext='global' AND opid=%d ORDER BY oid ASC";\r
- $query = sprintf($query, sql_table('plugin_option_desc'), (integer) $pid);\r
- $resource = sql_query($query);\r
- \r
- while ( $o = sql_fetch_object($resource) )\r
- {\r
- array_push($aOIDs, $o->oid);\r
- $aOptions[$o->oid] = array(\r
- \r
- 'oid' => $o->oid,\r
- 'value' => $o->odef,\r
- 'name' => $o->oname,\r
- 'description' => $o->odesc,\r
- 'type' => $o->otype,\r
- 'typeinfo' => $o->oextra,\r
- 'contextid' => 0\r
- );\r
- }\r
- \r
- // fill out actual values\r
- if ( count($aOIDs) > 0 )\r
- {\r
- $query = 'SELECT oid, ovalue FROM %s WHERE oid in (%s)';\r
- $query = sprintf($query, sql_table('plugin_option'), implode(',', $aOIDs));\r
- \r
- $result = sql_query($query);\r
- \r
- while ( $o = sql_fetch_object($result) )\r
- {\r
- $aOptions[$o->oid]['value'] = $o->ovalue;\r
- }\r
- }\r
- \r
- // call plugins\r
- $manager->notify(\r
- 'PrePluginOptionsEdit',\r
- array(\r
- 'context' => 'global',\r
- 'plugid' => $pid,\r
- 'options' => &$aOptions\r
- )\r
- );\r
- \r
- $template['content'] = 'plugoptionlist';\r
- $amount = skinableShowlist($aOptions, 'table', $template, $templateName);\r
- if ( $amount == 0 )\r
- {\r
- echo '<p>' . _ERROR_NOPLUGOPTIONS . "</p>\n";\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_editskin()\r
- * Parse skinvar editskin\r
- * \r
- * @param string $type type of skin\r
- * @return void\r
- */\r
- public function parse_editskin($type = 'id')\r
- {\r
- $skinid = intRequestVar('skinid');\r
- $skin = new SKIN($skinid);\r
- switch ( $type )\r
- {\r
- case 'id':\r
- echo intRequestVar('skinid');\r
- break;\r
- case 'name':\r
- echo Entity::hsc($skin->getName());\r
- break;\r
- case 'desc':\r
- echo Entity::hsc($skin->getDescription());\r
- break;\r
- case 'type':\r
- echo Entity::hsc($skin->getContentType());\r
- break;\r
- case 'prefix':\r
- echo Entity::hsc($skin->getIncludePrefix());\r
- break;\r
- case 'mode':\r
- $this->parse_inputyesno('inc_mode', $skin->getIncludeMode(), 120, 'skindir', 'normal', _PARSER_INCMODE_SKINDIR, _PARSER_INCMODE_NORMAL);\r
- default:\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_editskintype()\r
- * Parse skinvar editskintype\r
- * \r
- * @param string $type name of type for skin type\r
- * @return void\r
- */\r
- function parse_editskintype($type = 'id')\r
- {\r
- global $CONF, $manager, $member;\r
- $skinid = intRequestVar('skinid');\r
- $skin = new SKIN($skinid);\r
- $fNames = SKIN::getFriendlyNames();\r
- $sType = strtolower(trim(requestVar('type')));\r
- \r
- switch ( $type )\r
- {\r
- case 'id':\r
- echo intRequestVar('skinid');\r
- break;\r
- case 'name':\r
- echo Entity::hsc($skin->getName());\r
- break;\r
- case 'desc':\r
- echo Entity::hsc($skin->getDescription());\r
- break;\r
- case 'type':\r
- echo Entity::hsc($skin->getContentType());\r
- break;\r
- case 'content':\r
- echo Entity::hsc($skin->getContent($sType));\r
- break;\r
- case 'skintype':\r
- $skinType = isset($fNames[$sType]) ? $fNames[$sType] : ucfirst($sType);\r
- echo Entity::hsc($skinType);\r
- break;\r
- case 'skintyperaw':\r
- echo Entity::hsc($sType);\r
- break;\r
- case 'prefix':\r
- echo Entity::hsc($skin->getIncludePrefix());\r
- break;\r
- case 'mode':\r
- $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;\r
- echo Entity::hsc($incMode);\r
- break;\r
- default:\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_edittemplateinfo()\r
- * Parse skinvar edittemplateinfo\r
- * \r
- * @param string $type name of type for skin\r
- * @param string $description description for skin\r
- * @param string $name name of skin\r
- * @param string $help \r
- * @param string $tabindex index value for tabindex attribute of input element\r
- * @param string $big \r
- * @param string $tplt name of template\r
- */\r
- public function parse_edittemplateinfo($type, $description = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')\r
- {\r
- global $manager;\r
- $templateid = intRequestVar('templateid');\r
- $templatename = TEMPLATE::getNameFromId($templateid);\r
- $templatedescription = TEMPLATE::getDesc($templateid);\r
- $template =& $manager->getTemplate($templatename);\r
- switch ( $type )\r
- {\r
- case 'id':\r
- echo intval($templateid);\r
- break;\r
- case 'name':\r
- echo Entity::hsc($templatename);\r
- break;\r
- case 'desc':\r
- echo Entity::hsc($templatedescription);\r
- break;\r
- case 'extratemplate':\r
- $tabidx = 600;\r
- $pluginfields = array();\r
- $manager->notify(\r
- 'TemplateExtraFields',\r
- array(\r
- 'fields' => &$pluginfields\r
- )\r
- );\r
- $tmplt = array();\r
- if ( $description )\r
- {\r
- $tmplt = skinableTEMPLATE::read($description);\r
- }\r
- if ( array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) && !empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )\r
- {\r
- $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];\r
- }\r
- else\r
- {\r
- $base = "</tr><tr>\n"\r
- . "\t" . '<th colspan="2"><%explugtplname%>' . "</th>\n";\r
- }\r
- foreach ( $pluginfields as $pfkey => $pfvalue )\r
- {\r
- $data = array(\r
- 'explugtplname' => Entity::hsc($pfkey)\r
- );\r
- echo TEMPLATE::fill($base, $data);\r
- foreach ( $pfvalue as $pffield => $pfdesc )\r
- {\r
- $this->_templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);\r
- }\r
- }\r
- break;\r
- default:\r
- $desc = defined($description) ? constant($description) : $description;\r
- $name = defined($name) ? constant($name) : $name;\r
- $this->_templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_eventformextra()\r
- * Parse skinvar eventformextra\r
- * \r
- * @param string $type name of type for event form extra\r
- * @return void\r
- */\r
- public function parse_eventformextra($type = 'activation')\r
- {\r
- global $manager;\r
- switch ( $type )\r
- {\r
- case 'activation':\r
- $key = requestVar('ackey');\r
- if ( !$key )\r
- {\r
- $this->objAdmin->error(_ERROR_ACTIVATE);\r
- }\r
- $info = MEMBER::getActivationInfo($key);\r
- if ( !$info )\r
- {\r
- $this->objAdmin->error(_ERROR_ACTIVATE);\r
- }\r
- $mem = MEMBER::createFromId($info->vmember);\r
- if ( !$mem )\r
- {\r
- $this->objAdmin->error(_ERROR_ACTIVATE);\r
- }\r
- $data = array(\r
- 'type' => 'activation',\r
- 'member' => $mem\r
- );\r
- break;\r
- case 'membermailform-notloggedin':\r
- $data = array(\r
- 'type' => 'membermailform-notloggedin',\r
- );\r
- break;\r
- }\r
- $manager->notify('FormExtra', $data);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_extrahead()\r
- * Parse skinvar extrahead\r
- */\r
- public function parse_extrahead()\r
- {\r
- global $manager;\r
- $extrahead = $this->objAdmin->extrahead;\r
- $manager->notify(\r
- 'AdminPrePageHead',\r
- array(\r
- 'extrahead' => &$extrahead,\r
- 'action' => $this->objAdmin->action\r
- )\r
- );\r
- echo $extrahead;\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_blogsetting()\r
- * Parse skinvar blogsetting\r
- * \r
- * @param string $which name of setting for blog\r
- * @return void\r
- */\r
- public function parse_blogsetting($which)\r
- {\r
- echo $this->parse_getblogsetting($which);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_category()\r
- * Parse skinvar category\r
- * \r
- * @param string $type name of setting for category\r
- * @return void\r
- */\r
- public function parse_category($type = 'name')\r
- {\r
- echo $this->parse_getcategory($type);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_geteditpluginfo()\r
- * Parse skinvar geteditpluginfo\r
- * \r
- * @param string $type name of setting for edit plugin info\r
- * @return void\r
- */\r
- public function parse_geteditpluginfo($type)\r
- {\r
- $pid = intRequestVar('plugid');\r
- switch ( $type )\r
- {\r
- case 'id':\r
- return $pid;\r
- break;\r
- case 'name':\r
- return Entity::hsc(getPluginNameFromPid($pid));\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_getmember()\r
- * Parse skinvar getmember\r
- * (includes a member info thingie)\r
- * \r
- * @param string $what name of setting for member\r
- * @return void\r
- */\r
- public function parse_getmember($what)\r
- {\r
- global $memberinfo, $member;\r
- // 1. only allow the member-details-page specific variables on member pages\r
- if ( $this->skintype == 'member' )\r
- {\r
- switch ( $what )\r
- {\r
- case 'name':\r
- return Entity::hsc($memberinfo->getDisplayName());\r
- break;\r
- case 'realname':\r
- return Entity::hsc($memberinfo->getRealName());\r
- break;\r
- case 'notes':\r
- return Entity::hsc($memberinfo->getNotes());\r
- break;\r
- case 'url':\r
- return Entity::hsc($memberinfo->getURL());\r
- break;\r
- case 'email':\r
- return Entity::hsc($memberinfo->getEmail());\r
- break;\r
- case 'id':\r
- return Entity::hsc($memberinfo->getID());\r
- break;\r
- }\r
- }\r
- // 2. the next bunch of options is available everywhere, as long as the user is logged in\r
- if ( $member->isLoggedIn() )\r
- {\r
- switch ( $what )\r
- {\r
- case 'yourname':\r
- return $member->getDisplayName();\r
- break;\r
- case 'yourrealname':\r
- return $member->getRealName();\r
- break;\r
- case 'yournotes':\r
- return $member->getNotes();\r
- break;\r
- case 'yoururl':\r
- return $member->getURL();\r
- break;\r
- case 'youremail':\r
- return $member->getEmail();\r
- break;\r
- case 'yourid':\r
- return $member->getID();\r
- break;\r
- }\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_headmessage()\r
- * Parse skinvar headmessage\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_headmessage()\r
- {\r
- if ( !empty($this->objAdmin->headMess) )\r
- {\r
- echo '<p>' . _MESSAGE . ': ' . Entity::hsc($this->objAdmin->headMess) . "</p>\n";\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_helplink()\r
- * Parse skinvar helplink\r
- * \r
- * @param string $topic name of topic for help\r
- * @return void\r
- */\r
- public function parse_helplink($topic = '')\r
- {\r
- if ( empty($topic) )\r
- {\r
- return;\r
- }\r
- help($topic);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_helpplugname()\r
- * Parse skinvar helpplugname\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_helpplugname()\r
- {\r
- $plugid = intGetVar('plugid');\r
- Entity::hsc(getPluginNameFromPid($plugid));\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_ilistaddnew()\r
- * Parse skinvar ilistaddnew\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_ilistaddnew()\r
- {\r
- $blogid = intRequestVar('blogid');\r
- if ( intPostVar('start') == 0 )\r
- {\r
- echo '<p><a href="index.php?action=createitem&blogid=' . $blogid . '">' . _ITEMLIST_ADDNEW . "</a></p>\n";\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_importskininfo()\r
- * Parse skinvar importskininfo\r
- * \r
- * @param string $type name of information for imported skin\r
- * @return void\r
- */\r
- public function parse_importskininfo($type)\r
- {\r
- switch ( $type )\r
- {\r
- case 'info':\r
- echo Entity::hsc(requestVar('skininfo'));\r
- break;\r
- case 'snames':\r
- $dataArr = requestArray('skinnames');\r
- echo implode(' <em>' . _AND . '</em> ', $dataArr);\r
- break;\r
- case 'tnames':\r
- $dataArr = requestArray('tpltnames');\r
- echo implode(' <em>' . _AND . '</em> ', $dataArr);\r
- break;\r
- case 'sclashes':\r
- $dataArr = requestArray('skinclashes');\r
- echo implode(' <em>' . _AND . '</em> ', $dataArr);\r
- break;\r
- case 'tclashes':\r
- $dataArr = requestArray('tpltclashes');\r
- echo implode(' <em>' . _AND . '</em> ', $dataArr);\r
- break;\r
- case 'skinfile':\r
- echo Entity::hsc(requestVar('skinfile'));\r
- break;\r
- case 'mode':\r
- echo Entity::hsc(requestVar('mode'));\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_inputyesno()\r
- * Parse skinvar inputyesno\r
- * \r
- * @param string $name \r
- * @param string $checkedval \r
- * @param string $tabindex \r
- * @param string $value1 \r
- * @param string $value2 \r
- * @param string $yesval \r
- * @param string $noval \r
- * @param string $isAdmin \r
- * @param string $templateName \r
- * @return void\r
- */\r
- public function parse_inputyesno($name, $checkedval, $tabindex = 0, $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO, $isAdmin = 0, $templateName = '')\r
- {\r
- self::input_yesno($name, $checkedval, $tabindex, $value1, $value2, $yesval, $noval, $isAdmin, $templateName );\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_insertpluginfo()\r
- * Parse templatevar insertpluginfo\r
- */\r
- public function parse_insertpluginfo($type)\r
- {\r
- $option = $this->objAdmin;\r
- switch ( $type )\r
- {\r
- case 'id':\r
- return $option['pid'];\r
- break;\r
- case 'name':\r
- return Entity::hsc($option['pfile']);\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_insertpluginoptions()\r
- * Parse skinvar insertpluginoptions\r
- * \r
- * @param string $templateName name of template\r
- * @return void\r
- */\r
- public function parse_insertpluginoptions($templateName = '')\r
- {\r
- $options = $this->objAdmin->aOptions;\r
- $template = array();\r
- $templats = array();\r
- \r
- if ( $templateName )\r
- {\r
- $templates = skinableTEMPLATE::read($templateName);\r
- }\r
- if (array_key_exists('INSERT_PLUGOPTION_TITLE', $templates) && !empty($templates['INSERT_PLUGOPTION_TITLE']) )\r
- {\r
- $template['title'] = $templates['INSERT_PLUGOPTION_TITLE'];\r
- }\r
- else\r
- {\r
- $template['title'] = '<tr><th colspan="2"><%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%></th></tr>' . "\n";\r
- }\r
- if ( array_key_exists('INSERT_PLUGOPTION_BODY', $templates) && !empty($templates['INSERT_PLUGOPTION_BODY']) )\r
- {\r
- $template['body'] = $templates['INSERT_PLUGOPTION_BODY'];\r
- }\r
- else\r
- {\r
- $template['body'] = '<tr><%listplugplugoptionrow%></tr>' . "\n";\r
- }\r
- \r
- $prevPid = -1;\r
- \r
- foreach ( $options as $option )\r
- {\r
- $handler = new skinableACTIONS($this->skintype, $template, $option);\r
- $parser = new PARSER(skinableACTIONS::getDefinedActions(), $handler);\r
- // new plugin?\r
- if ( $prevPid != $option['pid'] )\r
- {\r
- $prevPid = $option['pid'];\r
- $parser->parse($template['title']);\r
- }\r
- $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);\r
- if ( @$meta['access'] != 'hidden' )\r
- {\r
- $parsed = $parser->parse($template['body']);\r
- }\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_insplugoptcontent()\r
- * Parse skinvar insplugoptcontent\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_insplugoptcontent()\r
- {\r
- $option = $this->objAdmin->aOption;\r
- \r
- $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);\r
- if (array_key_exists('access', $meta) && $meta['access'] != 'hidden')\r
- {\r
- echo '<tr>';\r
- skinableListplug_plugOptionRow($option);\r
- echo '</tr>';\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_iprangeinput()\r
- * Parse skinvar iprangeinput\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- function parse_iprangeinput()\r
- {\r
- if ( requestVar('ip') )\r
- {\r
- $iprangeVal = Entity::hsc(requestVar('ip'));\r
- echo '<input name="iprange" type="radio" value="' . $iprangeVal . '" checked="checked" id="ip_fixed" />' . "\n";\r
- echo '<label for="ip_fixed">' . $iprangeVal . "</label><br />\n";\r
- echo '<input name="iprange" type="radio" value="custom" id="ip_custom" />' . "\n";\r
- echo '<label for="ip_custom">' . _BAN_IP_CUSTOM . '</label>' . "\n";\r
- echo '<input name="customiprange" value="' . $iprangeVal . '" maxlength="15" size="15" />' . "\n";\r
- }\r
- else\r
- {\r
- echo '<input name="iprange" value="custom" type="hidden" />' . "\n";\r
- echo '<input name="customiprange" value="" maxlength="15" size="15" />' . "\n";\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_itemnavlist()\r
- * Parse skinvar itemnavlist\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_itemnavlist()\r
- {\r
- global $CONF, $manager, $member;\r
- if ( $this->skintype == 'itemlist' )\r
- {\r
- $blogid = intRequestVar('blogid');\r
- $blog =& $manager->getBlog($blogid);\r
- }\r
- if ( postVar('start') )\r
- {\r
- $start = intPostVar('start');\r
- }\r
- else\r
- {\r
- $start = 0;\r
- }\r
- \r
- // amount of items to show\r
- if ( postVar('amount') )\r
- {\r
- $amount = intPostVar('amount');\r
- }\r
- else\r
- {\r
- $amount = intval($CONF['DefaultListSize']);\r
- if ( $amount < 1 )\r
- {\r
- $amount = 10;\r
- }\r
- }\r
- $query = "SELECT bshortname, cname, mname, ititle, ibody, inumber, idraft, itime"\r
- . " FROM %s, %s, %s"\r
- . " WHERE iblog=bnumber AND iauthor=mnumber AND icat=catid;";\r
- \r
- $query = sprintf($query, sql_table('item'), sql_table('blog'), sql_table('member'), sql_table('category'));\r
- \r
- if ( $this->skintype == 'itemlist' )\r
- {\r
- $query .= 'and iblog = ' . $blogid;\r
- $template['now'] = $blog->getCorrectTime(time());\r
- \r
- // non-blog-admins can only edit/delete their own items\r
- if ( !$member->blogAdminRights($blogid) )\r
- {\r
- $query .= ' and iauthor = ' . $member->getID();\r
- }\r
- }\r
- elseif ( $this->skintype == 'browseownitems' )\r
- {\r
- $query .= 'and iauthor = ' . $member->getID();\r
- $blogid = 0;\r
- $template['now'] = time();\r
- }\r
- \r
- // search through items\r
- $search = postVar('search');\r
- \r
- if ( !empty($search) )\r
- {\r
- $query .= ' AND ((ititle LIKE "%' . sql_real_escape_string($search) . '%") '\r
- . ' OR (ibody LIKE "%' . sql_real_escape_string($search) . '%") '\r
- . ' OR (imore LIKE "%' . sql_real_escape_string($search) . '%"))';\r
- }\r
- $query .= ' ORDER BY itime DESC'\r
- . " LIMIT {$start},{$amount}";\r
- \r
- $template['content'] = 'itemlist';\r
- \r
- $navList = new skinableNAVLIST($this->skintype, $start, $amount, 0, 1000, $blogid, $search, 0);\r
- $navList->showBatchList('item', $query, 'table', $template);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_jstoolbaroptions()\r
- * Parse skinvar jstoolbaroptions\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_jstoolbaroptions()\r
- {\r
- global $CONF;\r
- $options = array(\r
- _SETTINGS_JSTOOLBAR_NONE,\r
- _SETTINGS_JSTOOLBAR_SIMPLE,\r
- _SETTINGS_JSTOOLBAR_FULL\r
- );\r
- $i = 1;\r
- foreach ( $options as $option )\r
- {\r
- $text = "<option value=\"%d\"%s>%s</option>\n";\r
- $extra = ($CONF['DisableJsTools'] == $i) ? ' selected="selected"' : '';\r
- echo sprintf($text, $i, $extra, $option);\r
- $i++;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_localeselectoptions()\r
- * Parse skinvar localeselectoptions\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_localeselectoptions()\r
- {\r
- $locales = i18n::get_available_locale_list();\r
- $memid = intRequestVar('memberid');\r
- if ( $memid )\r
- {\r
- $mem = MEMBER::createFromID($memid);\r
- if ( !$mem->getLocale() || !in_array($mem->getLocale(), $locales) )\r
- {\r
- echo "<option value=\"\" selected=\"selected\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";\r
- }\r
- else\r
- {\r
- echo "<option value=\"\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";\r
- }\r
- }\r
- else\r
- {\r
- if ( !i18n::get_current_locale() || !in_array(i18n::get_current_locale(), $locales) )\r
- {\r
- echo "<option value=\"\" selected=\"selected\">en_Latn_US</option>\n";\r
- }\r
- }\r
- foreach ( $locales as $locale )\r
- {\r
- if ($memid)\r
- {\r
- if ( $locale == $mem->getLocale() )\r
- {\r
- echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";\r
- }\r
- else\r
- {\r
- echo "<option value=\"{$locale}\">{$locale}</option>\n";\r
- }\r
- }\r
- else\r
- {\r
- if ( $locale == i18n::get_current_locale() )\r
- {\r
- echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";\r
- }\r
- else\r
- {\r
- echo "<option value=\"{$locale}\">{$locale}</option>\n";\r
- }\r
- }\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_listplugplugoptionrow()\r
- * Parse templatevar listplugplugoptionrow\r
- * \r
- * @param string $templateName name of template\r
- * @return void\r
- */\r
- public function parse_listplugplugoptionrow($templateName = '')\r
- {\r
- $option = $this->objAdmin;\r
- echo skinableListplug_plugOptionRow($option, $templateName);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_mediadirwarning()\r
- * Parse skinvar mediadirwarning\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_mediadirwarning()\r
- {\r
- global $DIR_MEDIA;\r
- if ( !is_dir($DIR_MEDIA) )\r
- {\r
- echo "<br /><b>" . _WARNING_NOTADIR . "</b>\n";\r
- }\r
- if ( !is_readable($DIR_MEDIA) )\r
- {\r
- echo "<br /><b>" . _WARNING_NOTREADABLE . "</b>\n";\r
- }\r
- if ( !is_writeable($DIR_MEDIA) )\r
- {\r
- echo "<br /><b>" . _WARNING_NOTWRITABLE . "</b>\n";\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_movedistselect()\r
- * Parse skinvar movedistselect\r
- */\r
- function parse_movedistselect()\r
- {\r
- $actionType = requestVar('action');\r
- switch ( $actionType )\r
- {\r
- case 'batchitem':\r
- $this->objAdmin->selectBlogCategory('destcatid');\r
- break;\r
- case 'batchcategory':\r
- $this->objAdmin->selectBlog('destblogid');\r
- break;\r
- default:\r
- if ( $this->skintype == 'itemmove' )\r
- {\r
- $query = "SELECT icat as result FROM %s WHERE inumber=%d;";\r
- $query = spriintf($query, sql_table('item'), intRequestVar('itemid'));\r
- $catid = quickQuery(sprintf($query, intRequestVar('itemid')));\r
- $this->objAdmin->selectBlogCategory('catid', $catid, 10, 1);\r
- }\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_moveitemid()\r
- * Parse skinvar moveitemid\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_moveitemid()\r
- {\r
- echo intRequestVar('itemid');\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_newestcompare()\r
- * Parse skinvar newestcompare\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_newestcompare()\r
- {\r
- global $nucleus;\r
- $newestVersion = getLatestVersion();\r
- $newestCompare = str_replace('/', '.', $newestVersion);\r
- $currentVersion = str_replace(array('/', 'v'), array('.', ''), $nucleus['version']);\r
- if ( $newestVersion && version_compare($newestCompare, $currentVersion, '>') )\r
- {\r
- echo '<br /><a style="color:red" href="http://nucleuscms.org/upgrade.php" title="' . _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TITLE . '">';\r
- echo _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TEXT . $newestVersion . '</a>';\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_newmemberselect()\r
- * Parse skinvar newmemberselect\r
- * \r
- * @param string $templateName name of template to use\r
- * @return void\r
- */\r
- public function parse_newmemberselect($templateName = '')\r
- {\r
- $blogid = intRequestVar('blogid');\r
- \r
- $query = "SELECT tmember FROM %s WHERE tblog=%d;";\r
- $query = sprintf($query, sql_table('team'), (integer) $blogid);\r
- $res = sql_query($query);\r
- \r
- $tmem = array();\r
- while ( $tmember = sql_fetch_object($res) ) \r
- {\r
- $tmem[] = intval($tmember->tmember);\r
- }\r
- \r
- $query = "SELECT mname as text, mnumber as value FROM %s WHERE mnumber NOT IN (%s);";\r
- $query = sprintf($query, sql_table('member'), implode(', ', $tmem));\r
- \r
- $template['name'] = 'memberid';\r
- $template['tabindex'] = 10000;\r
- skinableShowlist($query, 'select', $template, $templateName);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_newpluginlist()\r
- * Parse skinvar newpluginlist\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_newpluginlist()\r
- {\r
- $candidates = $this->newPlugCandidates;\r
- foreach ( $candidates as $name )\r
- {\r
- echo '<option value="NP_' . $name . '">' . Entity::hsc($name) . "</option>\n";\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_outputspecialdirs()\r
- * Parse skinvar outputspecialdirs\r
- * \r
- * @param string $type type of setting for directory\r
- * @return void\r
- */\r
- public function parse_outputspecialdirs($type)\r
- {\r
- switch ( $type )\r
- {\r
- case 'nucleusdir':\r
- global $DIR_NUCLEUS;\r
- echo Entity::hsc($DIR_NUCLEUS);\r
- break;\r
- case 'mediadir':\r
- global $DIR_MEDIA;\r
- echo Entity::hsc($DIR_MEDIA);\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_passrequestvars()\r
- * Parse skinvar passrequestvars\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_passrequestvars()\r
- {\r
- $oldaction = postVar('oldaction');\r
- if ( ($oldaction != 'logout')\r
- && ($oldaction != 'login')\r
- && $this->objAdmin->passvar\r
- && !postVar('customaction') )\r
- {\r
- passRequestVars();\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_pluginextras()\r
- * Parse skinvar pluginextras\r
- * \r
- * @param string $type type of plugin context\r
- * @return void\r
- */\r
- function parse_pluginextras($type = 'global')\r
- {\r
- global $manager;\r
- switch ( $type )\r
- {\r
- case 'member':\r
- $id = intRequestVar('memberid');\r
- $mem = MEMBER::createFromID($id);\r
- $manager->notify(\r
- 'MemberSettingsFormExtras',\r
- array(\r
- 'member' => &$mem\r
- )\r
- );\r
- break;\r
- case 'blog':\r
- $id = intRequestVar('blogid');\r
- $blg = $manager->getBlog($id);\r
- $manager->notify(\r
- 'BlogSettingsFormExtras',\r
- array(\r
- 'member' => &$blg\r
- )\r
- );\r
- break;\r
- default:\r
- $manager->notify(\r
- 'GeneralSettingsFormExtras',\r
- array(\r
- )\r
- );\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_pluginhelp()\r
- * Parse skinvar pluginhelp\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_pluginhelp()\r
- {\r
- global $manager, $DIR_PLUGINS;\r
- $plugid = intGetVar('plugid');\r
- $plugName = getPluginNameFromPid($plugid);\r
- $plug =& $manager->getPlugin($plugName);\r
- \r
- if ( $plug->supportsFeature('HelpPage') > 0 )\r
- {\r
- $helpfile = $DIR_PLUGINS . $plug->getShortName() . '/help.';\r
- if ( @file_exists($helpfile . 'php') )\r
- {\r
- @include($helpfile . 'php');\r
- return;\r
- }\r
- elseif ( @file_exists($helpfile . 'html') )\r
- {\r
- @include($helpfile . 'html');\r
- return;\r
- }\r
- }\r
- echo '<p>' . _ERROR . ': ' . _ERROR_PLUGNOHELPFILE . "</p>\n";\r
- echo '<p><a href="index.php?action=pluginlist">(' . _BACK . ")</a></p>\n";\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_pluginlistlist()\r
- * Parse skinvar pluginlistlist\r
- * \r
- * @param string $templateName name of template to use\r
- * @return void\r
- */\r
- public function parse_pluginlistlist($templateName = '')\r
- {\r
- $query = "SELECT * FROM %s ORDER BY porder ASC;";\r
- $query = sprintf($query, sql_table('plugin'));\r
- $template['content'] = 'pluginlist';\r
- $template['tabindex'] = 10;\r
- skinableShowlist($query, 'table', $template, $templateName);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_pluginoptions()\r
- * Parse skinvar pluginoptions\r
- * \r
- * @param string $type type of plugin option\r
- * @return void\r
- */\r
- public function parse_pluginoptions($type = 'global')\r
- {\r
- switch ( $type )\r
- {\r
- case 'member':\r
- $id = intRequestVar('memberid');\r
- break;\r
- case 'blog':\r
- $id = intRequestVar('blogid');\r
- break;\r
- case 'category':\r
- $id = intRequestVar('catid');\r
- break;\r
- }\r
- $this->objAdmin->_insertPluginOptions($type, $id);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_qmenuaddselect()\r
- * Parse skinvar qmanuaddselect\r
- * \r
- * @param string $templateName name of template to use\r
- * @return void\r
- */\r
- public function parse_qmenuaddselect($templateName = '')\r
- {\r
- global $member;\r
- $showAll = requestVar('showall');\r
- if ( $member->isAdmin() && ($showAll == 'yes') )\r
- {\r
- // Super-Admins have access to all blogs! (no add item support though)\r
- $query = 'SELECT bnumber as value, bname as text'\r
- . ' FROM ' . sql_table('blog')\r
- . ' ORDER BY bname';\r
- }\r
- else\r
- {\r
- $query = 'SELECT bnumber as value, bname as text'\r
- . ' FROM ' . sql_table('blog') . ', ' . sql_table('team')\r
- . ' WHERE tblog=bnumber and tmember=' . $member->getID()\r
- . ' ORDER BY bname';\r
- }\r
- $template['name'] = 'blogid';\r
- $template['tabindex'] = 15000;\r
- $template['extra'] = _QMENU_ADD_SELECT;\r
- $template['selected'] = -1;\r
- $template['shorten'] = 10;\r
- $template['shortenel'] = '';\r
- $template['javascript'] = 'onchange="return form.submit()"';\r
- skinableShowlist($query, 'select', $template, $templateName);\r
- return;\r
- }\r
-\r
- /**\r
- * Actions::parse_quickmenu()\r
- * Parse skinvar quickmenu\r
- * \r
- * @param string $templateName name of template to use\r
- * @return void\r
- */\r
- public function parse_quickmenu($templateName = '')\r
- {\r
- global $manager;\r
- $templates = array();\r
- $template = array();\r
- if ( !empty($templateName) )\r
- {\r
- $templates = skinableTEMPLATE::read($templateName);\r
- }\r
- $pluginExtras = array();\r
- $manager->notify(\r
- 'QuickMenu',\r
- array(\r
- 'options' => &$pluginExtras\r
- )\r
- );\r
- if ( count($pluginExtras) > 0 )\r
- {\r
- if ( array_key_exists('PLUGIN_QUICKMENU_TITLE', $templates) || !empty($templates['PLUGIN_QUICKMENU_TITLE']) )\r
- {\r
- $template['title'] = $templates['PLUGIN_QUICKMENU_TITLE'];\r
- }\r
- else\r
- {\r
- $template['title'] = '<h2><%text(_QMENU_PLUGINS)%></h2>';\r
- }\r
- $handler = new skinableACTIONS($this->skintype, $template, $this->objAdmin);\r
- $parser = new PARSER(skinableACTIONS::getDefinedActions(), $handler);\r
- $parser->parse($template['title']);\r
- \r
- if ( array_key_exists('PLUGIN_QUICKMENU_HEAD', $templates) || !empty($templates['PLUGIN_QUICKMENU_HEAD']) )\r
- {\r
- $template['head'] = $templates['PLUGIN_QUICKMENU_HEAD'];\r
- }\r
- else\r
- {\r
- $template['head'] = '<ul>';\r
- }\r
- \r
- echo $template['head'];\r
- \r
- if ( array_key_exists('PLUGIN_QUICKMENU_BODY', $templates) || !empty($templates['PLUGIN_QUICKMENU_BODY']) )\r
- {\r
- $template['body'] = $templates['PLUGIN_QUICKMENU_BODY'];\r
- }\r
- else\r
- {\r
- $template['body'] = '<li><a href="<%plugadminurl%>" title="<%plugadmintooltip%>"><%plugadmintitle%></a></li>';\r
- }\r
- \r
- foreach ( $pluginExtras as $aInfo )\r
- {\r
- $data = array(\r
- 'plugadminurl' => ENTITY::hsc($aInfo['url'], ENT_QUOTES),\r
- 'plugadmintooltip' => ENTITY::hsc($aInfo['tooltip'], ENT_QUOTES),\r
- 'plugadmintitle' => ENTITY::hsc($aInfo['title'], ENT_QUOTES),\r
- );\r
- echo TEMPLATE::fill($template['body'], $data);\r
- }\r
- if ( array_key_exists('PLUGIN_QUICKMENU_FOOT', $templates) || !empty($templates['PLUGIN_QUICKMENU_FOOT']) )\r
- {\r
- $template['foot'] = $templates['PLUGIN_QUICKMENU_FOOT'];\r
- }\r
- else\r
- {\r
- $template['foot'] = '</ul>';\r
- }\r
- echo $template['foot'];\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_requestblogid()\r
- * Parse skinvar requestblogid\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_requestblogid()\r
- {\r
- echo intRequestVar('blogid');\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_requestiprange()\r
- * Parse skinvar requestiprange\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_requestiprange()\r
- {\r
- if ( requestVar('iprange') )\r
- {\r
- echo Entity::hsc(requestVar('iprange'));\r
- }\r
- elseif ( requestVar('ip') )\r
- {\r
- echo Entity::hsc(requestVar('ip'));\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_selectlocaladminskinfiles()\r
- * Parse skinvar selectlocaladminskinfiles\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_selectlocaladminskinfiles()\r
- {\r
- global $DIR_ADMINSKINS, $manager;\r
- $candidates = skinableSKINIMPORT::searchForCandidates($DIR_ADMINSKINS);\r
- foreach ( $candidates as $skinname => $skinfile )\r
- {\r
- $html = Entit::hsc($skinfile);\r
- echo '<option value="' . $html . '">' . $skinname . "</option>\n";\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_selectlocalskinfiles()\r
- * Parse skinvar selectlocalskinfiles\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- function parse_selectlocalskinfiles()\r
- {\r
- global $DIR_SKINS;\r
- $candidates = SKINIMPORT::searchForCandidates($DIR_SKINS);\r
- foreach ( $candidates as $skinname => $skinfile )\r
- {\r
- $html = ENTITY::hsc($skinfile);\r
- echo '<option value="' . $html . '">' . $skinname . "</option>\n";\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_skineditallowedlist()\r
- * Parse skinvar skineditallowedlist\r
- * \r
- * @param string $type type of skin\r
- * @param string $templateName name of template\r
- * @return void\r
- */\r
- public function parse_skineditallowedlist($type, $templateName = '')\r
- {\r
- switch ( $type )\r
- {\r
- case 'blog':\r
- $query = "SELECT bshortname, bname FROM %s";\r
- $show = array(\r
- 'content' => 'shortblognames'\r
- );\r
- $query = sprintf($query, sql_table('blog'));\r
- skinableShowlist($query, 'table', $show, $templateName);\r
- break;\r
- case 'template':\r
- $query = "SELECT tdname as name, tddesc as description FROM %s";\r
- $show = array(\r
- 'content' => 'shortnames'\r
- );\r
- $query = sprintf($query, sql_table('template_desc'));\r
- skinableShowlist($query, 'table', $show, $templateName);\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_skinfile()\r
- * Inserts an url relative to the skindir (useful when doing import/export)\r
- *\r
- * e.g. <skinfile(default/myfile.sth)>\r
- * \r
- * @param string $filename file name for skin\r
- * @return void\r
- */\r
- public function parse_skinfile($filename)\r
- {\r
- $base = NP_SkinableAdmin::getAdminSkinURL();\r
- $pref = PARSER::getProperty('IncludePrefix');\r
- echo $base . $pref . $filename;\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_skinielist()\r
- * Parse skinvar skinielist\r
- * \r
- * @param string $type type of skin\r
- * @param string $templateName name of template to use\r
- * @return void\r
- */\r
- public function parse_skinielist($type, $templateName = '')\r
- {\r
- $templates = array();\r
- if ( $templateName )\r
- {\r
- $templates = skinableTEMPLATE::read($templateName);\r
- }\r
- if ( array_key_exists('SKINIE_EXPORT_LIST', $templates) && !empty($templates['SKINIE_EXPORT_LIST']) )\r
- {\r
- $template = $templates['SKINIE_EXPORT_LIST'];\r
- }\r
- else\r
- {\r
- $template = '<td><input type="checkbox" name="<%typeid%>" id="<%expid%>" /><label for="<%expid%>"><%expname%></label></td>' . "\n"\r
- . "<td><%expdesc%></td>\n"\r
- . "</tr><tr>\n";\r
- }\r
- switch ( $type )\r
- {\r
- case 'skin':\r
- $res = sql_query('SELECT * FROM ' . sql_table('skin_desc'));\r
- while ( $skinObj = sql_fetch_object($res) )\r
- {\r
- $data = array(\r
- 'typeid' => 'skin[' . $skinObj->sdnumber . ']',\r
- 'expid' => 'skinexp' . $skinObj->sdnumber,\r
- 'expname' => ENTITY::hsc($skinObj->sdname, ENT_QUOTES),\r
- 'expdesc' => ENTITY::hsc($skinObj->sddesc, ENT_QUOTES),\r
- );\r
- echo TEMPLATE::fill($template, $data);\r
- }\r
- break;\r
- case 'template':\r
- $res = sql_query('SELECT * FROM '.sql_table('template_desc'));\r
- while ($templateObj = sql_fetch_object($res)) {\r
- $data = array(\r
- 'typeid' => 'template[' . $templateObj->tdnumber . ']',\r
- 'expid' => 'templateexp' . $templateObj->tdnumber,\r
- 'expname' => ENTITY::hsc($templateObj->tdname, ENT_QUOTES),\r
- 'expdesc' => ENTITY::hsc($templateObj->tddesc, ENT_QUOTES),\r
- );\r
- echo TEMPLATE::fill($template, $data);\r
- }\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_skinoverview()\r
- * Parse skinvar skinoverview\r
- * \r
- * @param string $templateName name of template to use\r
- * @return void\r
- */\r
- public function parse_skinoverview($templateName = '')\r
- {\r
- $query = "SELECT * FROM %s ORDER BY sdname";\r
- $query = sprintf($query, sql_table('skin_desc'));\r
- \r
- $template['content'] = 'skinlist';\r
- $template['tabindex'] = 10;\r
- \r
- skinableShowlist($query, 'table', $template, $templateName);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_skintypehelp()\r
- * Check editing skintypehelp\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_skintypehelp()\r
- {\r
- $nowSkinType = strtolower(trim(requestVar('type')));\r
- $regularType = array(\r
- 'index',\r
- 'item',\r
- 'archivelist',\r
- 'archive',\r
- 'search',\r
- 'error',\r
- 'member',\r
- 'imagepopup'\r
- );\r
- \r
- if ( in_array($nowSkinType, $regularType) )\r
- {\r
- help('skinpart' . $nowSkinType);\r
- }\r
- else\r
- {\r
- help('skinpartspecial');\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_specialskinlist()\r
- * Parse skinvar specialskinlist\r
- * \r
- * @param string $templateName name of template to use\r
- * @return void\r
- */\r
- public function parse_specialskinlist($templateName = '')\r
- {\r
- $templates = array();\r
- if ( $templateName )\r
- {\r
- $templates = skinableTEMPLATE::read($templateName);\r
- }\r
- $nType = array(\r
- 'index',\r
- 'item',\r
- 'error',\r
- 'search',\r
- 'archive',\r
- 'archivelist',\r
- 'imagepopup',\r
- 'member'\r
- );\r
- $skinid = intRequestVar('skinid');\r
- $query = "SELECT stype FROM %s WHERE stype NOT IN ('%s') AND sdesc = %d;";\r
- $query = sprintf($query, sql_table('skin'), implode("', '", $nType), $skinid);\r
- \r
- $res = sql_query($query);\r
- if ( $res && sql_num_rows($res) > 0 )\r
- {\r
- $data = array();\r
- if ( array_key_exists('SPECIALSKINLIST_HEAD', $templates) && !empty($templates['SPECIALSKINLIST_HEAD']) )\r
- {\r
- $template['head'] = $templates['SPECIALSKINLIST_HEAD'];\r
- }\r
- else\r
- {\r
- $template['head'] = "<ul>\n";\r
- }\r
- echo TEMPLATE::fill($template['head'], $data);\r
- if ( array_key_exists('SPECIALSKINLIST_BODY', $templates) && !empty($templates['SPECIALSKINLIST_BODY']) )\r
- {\r
- $template['body'] = $templates['SPECIALSKINLIST_BODY'];\r
- }\r
- else\r
- {\r
- $template['body'] = '<li><a tabindex="<%tabindex%>" href="index.php?action=skinedittype&skinid=<%skinid%>'\r
- . '&type=<%skintype%>"><%skintype%></a> (<a tabindex="<%tabindex%>" href="index.php?'\r
- . 'action=skinremovetype&skinid=<%skinid%>&type=<%skintype%>">remove</a>)</li>';\r
- }\r
- $tabstart = 75;\r
- while ( $row = sql_fetch_assoc($res) )\r
- {\r
- $data = array(\r
- 'tabindex' => $tabstart++,\r
- 'skinid' => $skinid,\r
- 'skintype' => ENTITY::hsc(strtolower($row['stype']), ENT_QUOTES)\r
- );\r
- echo TEMPLATE::fill($template['body'], $data);\r
- }\r
- $data = array();\r
- if (array_key_exists('SPECIALSKINLIST_FOOT', $templates) && !empty($templates['SPECIALSKINLIST_FOOT']) )\r
- {\r
- $template['foot'] = $templates['SPECIALSKINLIST_FOOT'];\r
- }\r
- else\r
- {\r
- $template['foot'] = "</ul>\n";\r
- }\r
- echo TEMPLATE::fill($template['foot'], $data);\r
- return;\r
- }\r
- }\r
- \r
- /**\r
- * Actions::parse_sprinttext()\r
- * Parse sprinttext\r
- * \r
- * @param string $which \r
- * @param string $val \r
- * @return void\r
- */\r
- public function parse_sprinttext($which, $val)\r
- {\r
- if ( !defined($which) )\r
- {\r
- $base = $which;\r
- }\r
- else\r
- {\r
- $base = constant($which);\r
- }\r
- \r
- if ( preg_match('#[^<|%].*[^%|>]#', $val, $matchies) )\r
- {\r
- if ( !preg_match('#[(].*[^)]#', $matchies[0], $args) )\r
- {\r
- $met = 'parse_' . $matchies[0];\r
- }\r
- else\r
- {\r
- $arg = trim($args[0], '()');\r
- $met = 'parse_' . substr($matchies[0], 0, strpos($matchies[0], '('));\r
- }\r
- \r
- if ( method_exists($this, $met) )\r
- {\r
- $value = call_user_func(array(&$this, $met), $arg);\r
- }\r
- }\r
- \r
- if ( !isset($value) || empty($value) )\r
- {\r
- $value = $val;\r
- }\r
- echo sprintf($base, $value);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_systemsettings()\r
- * Parse skinvar systemsettings\r
- * \r
- * @param string $type type of settings for system\r
- * @param string $templateName name of template to use \r
- * @return void\r
- */\r
- public function parse_systemsettings($type = 'phpinfo', $templateName = '')\r
- {\r
- global $member, $CONF, $nucleus;\r
- \r
- $member->isAdmin() or $this->objAdmin->disallow();\r
- \r
- $enable = _ADMIN_SYSTEMOVERVIEW_ENABLE;\r
- $disable = _ADMIN_SYSTEMOVERVIEW_DISABLE;\r
- \r
- switch ( $type )\r
- {\r
- case 'phpversion':\r
- echo phpversion();\r
- break;\r
- case 'sqlserverinfo':\r
- echo sql_get_server_info();\r
- break;\r
- case 'sqlclientinfo':\r
- echo sql_get_client_info();\r
- break;\r
- case 'magicquotesgpc':\r
- echo ini_get('magic_quotes_gpc') ? 'On' : 'Off';\r
- break;\r
- case 'magicquotesruntime':\r
- echo ini_get('magic_quotes_runtime') ? 'On' : 'Off';\r
- break;\r
- case 'registerglobals':\r
- echo ini_get('register_globals') ? 'On' : 'Off';\r
- break;\r
- case 'gdinfo':\r
- $templates = array();\r
- if ( $templateName )\r
- {\r
- $templates = skinableTEMPLATE::read($templateName);\r
- }\r
- if ( array_key_exists('SYSTEMINFO_GDSETTINGS', $templates) && !empty($templates['SYSTEMINFO_GDSETTINGS']) )\r
- {\r
- $template = $templates['SYSTEMINFO_GDSETTINGS'];\r
- }\r
- else\r
- {\r
- $template = "<tr>\n\t\t" . '<td width="50%">' . "<%key%></td><td><%value%></td>\n</tr>\n";\r
- }\r
- \r
- $gdinfo = gd_info();\r
- \r
- foreach ( $gdinfo as $key => $value )\r
- {\r
- if ( is_bool($value) )\r
- {\r
- $value = $value ? $enable : $disable;\r
- }\r
- else\r
- {\r
- $value = ENTITY::hsc($value, ENT_QUOTES);\r
- }\r
- $data = array(\r
- 'key' => $key,\r
- 'value' => $value,\r
- );\r
- echo TEMPLATE::fill($template, $data);\r
- }\r
- break;\r
- case 'modrewrite':\r
- ob_start();\r
- phpinfo(INFO_MODULES);\r
- $im = ob_get_contents();\r
- ob_end_clean();\r
- echo (strstr($im, 'mod_rewrite') != '') ? $enable : $disable;\r
- break;\r
- case 'nucleusversion':\r
- echo getNucleusVersion() / 100 . '(' . $nucleus['version'] . ')';\r
- break;\r
- case 'nucleuspatchlevel':\r
- echo getNucleusPatchLevel();\r
- break;\r
- case 'confself':\r
- echo $CONF['Self'];\r
- break;\r
- case 'confitemurl':\r
- echo $CONF['ItemURL'];\r
- break;\r
- case 'alertonheaderssent':\r
- echo $CONF['alertOnHeadersSent'] ? $enable : $disable;\r
- break;\r
- case 'nucleuscodename':\r
- if ( $nucleus['codename'] != '' )\r
- {\r
- echo ' "' . $nucleus['codename'] . '"';\r
- }\r
- break;\r
- case 'versioncheckurl':\r
- echo sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());\r
- break;\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_templateoverview()\r
- * Parse skinvar templateoverview\r
- * \r
- * @param string $templateName name of template to use\r
- * @return void\r
- */\r
- public function parse_templateoverview($templateName = '')\r
- {\r
- $query = "SELECT * FROM %s ORDER BY tdname";\r
- $query = sprintf($query, sql_table('template_desc'));\r
- $template['content'] = 'templatelist';\r
- $template['tabindex'] = 10;\r
- skinableShowlist($query, 'table', $template, $templateName);\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_versioncheckurl()\r
- * Parse skinvar versioncheckurl\r
- * \r
- * @param void\r
- * @return void\r
- */\r
- public function parse_versioncheckurl()\r
- {\r
- echo sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::parse_yrbloglist()\r
- * Parse skinvar yrbloglist\r
- * \r
- * @param string $templateName name of template to use\r
- * @return void\r
- */\r
- public function parse_yrbloglist($templateName = '')\r
- {\r
- global $member;\r
- $showAll = requestVar('showall');\r
- \r
- if ( $member->isAdmin() && ($showAll == 'yes') )\r
- {\r
- // Super-Admins have access to all blogs! (no add item support though)\r
- $query = "SELECT bnumber, bname, 1 as tadmin, burl, bshortname"\r
- . " FROM %s"\r
- . " ORDER BY bnumber";\r
- $query = sprintf($query, sql_table('blog'));\r
- }\r
- else\r
- {\r
- $query = "SELECT bnumber, bname, tadmin, burl, bshortname"\r
- . " FROM %s,%s"\r
- . " WHERE tblog=bnumber and tmember=%d"\r
- . " ORDER BY bnumber";\r
- $query = sprintf($query, sql_table('blog'), sql_table('team'), (integer) $member->getID());\r
- }\r
- \r
- $template['content'] = 'bloglist';\r
- $template['superadmin'] = $member->isAdmin();\r
- \r
- $amount = skinableShowlist($query, 'table', $template, $templateName);\r
- \r
- if ( ($showAll != 'yes') && ($member->isAdmin()) )\r
- {\r
- $query = 'SELECT COUNT(*) as result FROM ' . sql_table('blog');\r
- \r
- $total = quickQuery($query);\r
- if ( $total > $amount )\r
- {\r
- echo '<p><a href="index.php?action=overview&showall=yes">' . _OVERVIEW_SHOWALL . '</a></p>';\r
- }\r
- }\r
- \r
- if ( $amount == 0 )\r
- {\r
- echo _OVERVIEW_NOBLOGS;\r
- }\r
- elseif( $amount != 0 )\r
- {\r
- echo '<h2>' . _OVERVIEW_YRDRAFTS . '</h2>';\r
- \r
- $query = "SELECT ititle, inumber, bshortname"\r
- . " FROM %s,%s"\r
- . ' WHERE iauthor=%d AND iblog=bnumber AND idraft=1';\r
- $query = sprintf($query. sql_table('item'), sql_table('blog'), (integer) $member->getID());\r
- \r
- $template['content'] = 'draftlist';\r
- \r
- $amountdrafts = skinableShowlist($query, 'table', $template, $templateName);\r
- if ( $amountdrafts == 0 )\r
- {\r
- echo _OVERVIEW_NODRAFTS;\r
- }\r
- }\r
- return;\r
- }\r
- \r
- /**\r
- * Actions::customHelp()\r
- * shows a link to custom help file\r
- * \r
- * @param integer $id \r
- * @param string $tplName \r
- * @param string $url \r
- * @param string $iconURL \r
- * @param string $alt \r
- * @param string $title \r
- * @param $onclick\r
- * \r
- */\r
- private function customHelp($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')\r
- {\r
- echo self::customHelpHtml($id, $tplName, $url, $iconURL, $alt, $title, $onclick);\r
- }\r
- \r
- /**\r
- * Actions::customHelpHtml()\r
- * \r
- * @param integer $id \r
- * @param string $tplName \r
- * @param string $url \r
- * @param string $iconURL \r
- * @param string $alt \r
- * @param string $title \r
- * @param string $onclick \r
- * @return string anchor element with help uri\r
- */\r
- static public function customHelpHtml($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')\r
- {\r
- $templates = array();\r
- if ( $tplName )\r
- {\r
- $templates = skinableTEMPLATE::read($tplName);\r
- }\r
- if ( array_key_exists('ADMIN_CUSTOMHELPLINK_ICON', $templates) && !empty($templates['ADMIN_CUSTOMHELPLINK_ICON']) )\r
- {\r
- $template = $templates['ADMIN_CUSTOMHELPLINK_ICON'];\r
- }\r
- else\r
- {\r
- $template = '<img src="<%iconurl%>" <%width%><%height%>alt="<%alt%>" title="<%title%>" /></a>';\r
- }\r
- \r
- if ( empty($iconURL) )\r
- {\r
- global $CONF;\r
- $iconURL = $CONF['AdminURL'] . 'documentation/icon-help.gif';\r
- }\r
- if ( function_exists('getimagesize') )\r
- {\r
- $size = getimagesize($iconURL);\r
- $width = 'width="' . $size[0] . '" ';\r
- $height = 'height="' . $size[1] . '" ';\r
- }\r
- $data = array(\r
- 'iconurl' => $iconURL,\r
- 'width' => $width,\r
- 'height' => $height,\r
- 'alt' => (isset($alt) && !empty($alt)) ? $alt : _HELP_TT,\r
- 'title' => (isset($title) && !empty($title)) ? $title : _HELP_TT,\r
- );\r
- $icon = TEMPLATE::fill($template, $data);\r
- $help = self::customHelplink($id, $tplName, $url, $title, $onclick);\r
- return $help . $icon;\r
- }\r
- \r
- /**\r
- * Actions::input_yesno\r
- * \r
- * @param $name\r
- * @param $checkedval\r
- * @param $tabindex\r
- * @param $value1\r
- * @param $value2\r
- * @param $yesval\r
- * @param $noval\r
- * @param $isAdmin\r
- * @param $templateName\r
- * @param $showlist\r
- */\r
- static function input_yesno($name,\r
- $checkedval,\r
- $tabindex = 0,\r
- $value1 = 1,\r
- $value2 = 0,\r
- $yesval = _YES,\r
- $noval = _NO,\r
- $isAdmin = 0,\r
- $templateName = '',\r
- $showlist = false)\r
- {\r
- $templates = array();\r
- if ( $templateName )\r
- {\r
- $templates = skinableTEMPLATE::read($templateName);\r
- }\r
- \r
- if ( $name == 'admin' )\r
- {\r
- if ( array_key_exists('INPUTYESNO_TEMPLATE_ADMIN', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_ADMIN']) )\r
- {\r
- $template = $templates['INPUTYESNO_TEMPLATE_ADMIN'];\r
- }\r
- else\r
- {\r
- $template = '<input onclick="selectCanLogin(true);" type="radio" name="<%name%>" value="<%yesval%>" <%yescheckedval%> id="<%yesid%>" />' . "\n"\r
- . '<label for="<%yesid%>"><%yesvaltext%></label>' . "\n"\r
- . '<input onclick="selectCanLogin(false);" type="radio" name="<%name%>" value="<%noval%>" <%nocheckedval%> id="<%noid%>"<%disabled%> />' . "\n"\r
- . '<label for="<%noid%>"><%novaltext%></label>' . "\n";\r
- }\r
- }\r
- else\r
- {\r
- if ( array_key_exists('INPUTYESNO_TEMPLATE_NORMAL', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_NORMAL']) )\r
- {\r
- $template = $templates['INPUTYESNO_TEMPLATE_NORMAL'];\r
- }\r
- if ( $showlist )\r
- {\r
- if ( array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO', $templates) && !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO']) )\r
- {\r
- $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO'];\r
- }\r
- }\r
- if ( !isset($template) )\r
- {\r
- $template = '<input type="radio" name="<%name%>" value="<%yesval%>" <%yescheckedval%> id="<%yesid%>" />' . "\n"\r
- . '<label for="<%yesid%>"><%yesvaltext%></label>' . "\n"\r
- . '<input type="radio" name="<%name%>" value="<%noval%>" <%nocheckedval%> id="<%noid%>"<%disabled%> />' . "\n"\r
- . '<label for="<%noid%>"><%novaltext%></label>' . "\n";\r
- }\r
- }\r
- \r
- //echo $template;\r
- $id = ENTITY::hsc($name);\r
- $id = str_replace('[', '-', $id);\r
- $id = str_replace(']', '-', $id);\r
- $id1 = $id . ENTITY::hsc($value1);\r
- $id2 = $id . ENTITY::hsc($value2);\r
- $dat = array(\r
- 'name' => ENTITY::hsc($name),\r
- 'yesval' => ENTITY::hsc($value1),\r
- 'noval' => ENTITY::hsc($value2),\r
- 'yesid' => $id1,\r
- 'noid' => $id2,\r
- 'yesvaltext' => $yesval,\r
- 'novaltext' => $noval,\r
- 'yescheckedval' => ($checkedval == $value1) ? ' checked="checked" tabindex="' . $tabindex . '"': '',\r
- 'nocheckedval' => ($checkedval != $value1) ? ' checked="checked" tabindex="' . $tabindex . '"': '',\r
- 'disabled' => ($isAdmin && $name == 'canlogin') ? ' disabled="disabled"' : '',\r
- );\r
+ $item =& $manager->getItem($post['itemid'], 1, 1);\r
+ $blog =& $manager->getBlog($item['blogid']);\r
\r
- if ( $showlist )\r
- {\r
- return skinableTEMPLATE::fill($template, $dat);\r
- }\r
- else\r
- {\r
- echo TEMPLATE::fill($template, $dat);\r
- }\r
+ $this->preBlogContent('sticky', $blog);\r
+ $this->amountfound = $blog->readLogFromList($itemarray, $template);\r
+ $this->postBlogContent('sticky', $blog);\r
return;\r
}\r
}\r