--- /dev/null
+<?php
+class AdminActions extends BaseActions
+{
+ /*
+ * TODO: I believe we can push them into Admin class
+ * if Admin class is just a static class.
+ */
+ private $skintype;
+ private $objAdmin;
+
+ private $actions = array(
+ 'actionloglist',
+ 'activationmessage',
+ 'addtickettourl',
+ 'adminbatchaction',
+ 'adminbatchlist',
+ 'adminbanlist',
+ 'adminbloglink',
+ 'adminerrormesg',
+ 'adminparsedinclude',
+ 'adminskineditallowedlist',
+ 'adminskinielist',
+ 'adminskinoverview',
+ 'adminspecialskinlist',
+ 'admintemplateoverview',
+ 'allowedadminskinactions',
+ 'allowedskinactions',
+ 'batchmovetitle',
+ 'batchmovetype',
+ 'batchmovelist',
+ 'batchmovebtn',
+ 'batchdeletelist',
+ 'batchdeletetype',
+ 'blogcatlist',
+ 'blognotifysetting',
+ 'blogselectbox',
+ 'blogsettingyesno',
+ 'blogteamlist',
+ 'blogteammembers',
+ 'blogtime',
+ 'bookmarkletadmin',
+ 'categorysetting',
+ 'codename',
+ 'commentnavlist',
+ 'configsettingsedit',
+ 'configsettingsyesno',
+ 'date',
+ 'defaultadminskintypes',
+ 'defblogselect',
+ 'defcatselect',
+ 'defskinselect',
+ 'deletecomment',
+ 'deleteitemid',
+ 'deleteitembody',
+ 'deleteitemtitle',
+ 'editadminskin',
+ 'editadminskintype',
+ 'editadmintemplateinfo',
+ 'editcomment',
+ 'editdesturl',
+ 'editmemberlist',
+ 'editmember',
+ 'editskin',
+ 'editskintype',
+ 'edittemplateinfo',
+ 'editpluginfo',
+ 'editplugoptionslist',
+ 'extrahead',
+ 'eventformextra',
+ 'getblogsetting',
+ 'geteditpluginfo',
+ 'headmessage',
+ 'helplink',
+ 'helpplugname',
+ 'ilistaddnew',
+ 'importskininfo',
+ 'inputyesno',
+ 'insertpluginoptions',
+ 'iprangeinput',
+ 'itemnavlist',
+ 'jstoolbaroptions',
+ 'languageselectoptions',
+ 'listplugplugoptionrow',
+ 'mediadirwarning',
+ 'movedistselect',
+ 'moveitemid',
+ 'newmemberselect',
+ 'newestcompare',
+ 'newpluginlist',
+ 'outputspecialdirs',
+ 'passrequestvars',
+ 'pluginhelp',
+ 'pluginlistlist',
+ 'pluginextras',
+ 'pluginoptions',
+ 'qmenuaddselect',
+ 'quickmenu',
+ 'requestblogid',
+ 'requestiprange',
+ 'selectlocaladminskinfiles',
+ 'selectlocalskinfiles',
+ 'skineditallowedlist',
+ 'skinielist',
+ 'skinoverview',
+ 'skintypehelp',
+ 'specialskinlist',
+ 'sprinttext',
+ 'systemsettings',
+ 'text',
+ 'templateoverview',
+ 'ticket',
+ 'versioncheckurl',
+ 'yrbloglist',
+ 'adminstyleselectoptions',
+ /* FIXME: typo of adminstylesheets */
+ 'adminstyleseets',
+ 'adminskinselectoptions'
+ /* FIXME: lack entries. need to be review
+ * parse_banlistdeletedlist
+ * parse_blogsetting
+ * parse_category
+ * parse_customhelplink
+ * parse_getmember
+ * parse_insertpluginfo
+ * parse_insplugoptcontent
+ * parse_skinfile
+ */
+ );
+
+ /**
+ * AdminActions::getDefinedActions()
+ * Returns an array with the actions that are defined
+ * in the AdminActions class
+ *
+ * @param void
+ * @return void
+ */
+ public function getDefinedActions()
+ {
+ return $this->actions;
+ }
+
+ /**
+ * AdminActions::parse_actionloglist()
+ * Parse skinvar actionloglist
+ *
+ * @param string $templateName name of template to use
+ * @return void
+ */
+ public function parse_actionloglist($templateName = '')
+ {
+ $query = "SELECT * FROM %s ORDER BY timestamp DESC";
+ $query = sprintf($query, sql_table('actionlog'));
+
+ $template['content'] = 'actionlist';
+ $amount = skinableShowlist($query, 'table', $template, $templateName);
+ return;
+ }
+
+ /**
+ * AdminActions::parse_activationmessage()
+ * Parse skinvar activationmessage
+ *
+ * @param string $type type of message
+ * @param string $templateName name of template to use
+ * @return void
+ */
+ public function parse_activationmessage($type, $templateName = '')
+ {
+ global $CONF, $manager;
+
+ $template = array();
+
+ if ( !empty($templateName))
+ {
+ $template = skinableTEMPLATE::read($templateName);
+ }
+
+ $key = postVar('ackey');
+ if ( !$key )
+ {
+ $this->objAdmin->error(_ERROR_ACTIVATE);
+ }
+
+ $info = MEMBER::getActivationInfo($key);
+ if ( !$info )
+ {
+ $this->objAdmin->error(_ERROR_ACTIVATE);
+ }
+
+ $mem = MEMBER::createFromId($info->vmember);
+ if ( !$mem )
+ {
+ $this->objAdmin->error(_ERROR_ACTIVATE);
+ }
+ switch ( $info->vtype )
+ {
+ case 'forgot':
+ if ( array_key_exists('ACTIVATE_FORGOT_TITLE', $template) && !empty($template['ACTIVATE_FORGOT_TITLE']) )
+ {
+ $title = $template['ACTIVATE_FORGOT_TITLE'];
+ }
+ else
+ {
+ $title = _ACTIVATE_FORGOT_TITLE;
+ }
+ if ( array_key_exists('ACTIVATE_FORGOT_TEXT', $template) && !empty($template['ACTIVATE_FORGOT_TEXT']) )
+ {
+ $text = $template['ACTIVATE_FORGOT_TEXT'];
+ }
+ else
+ {
+ $text = _ACTIVATE_FORGOT_TEXT;
+ }
+ break;
+ case 'register':
+ if ( array_key_exists('ACTIVATE_REGISTER_TITLE', $template) && !empty($template['ACTIVATE_REGISTER_TITLE']) )
+ {
+ $title = $template['ACTIVATE_REGISTER_TITLE'];
+ }
+ else
+ {
+ $title = _ACTIVATE_REGISTER_TITLE;
+ }
+ if ( array_key_exists('ACTIVATE_REGISTER_TEXT', $template) && !empty($template['ACTIVATE_REGISTER_TEXT']) )
+ {
+ $text = $template['ACTIVATE_REGISTER_TEXT'];
+ }
+ else
+ {
+ $text = _ACTIVATE_REGISTER_TEXT;
+ }
+ break;
+ case 'addresschange':
+ if ( array_key_exists('ACTIVATE_CHANGE_TITLE', $template) && !empty($template['ACTIVATE_CHANGE_TITLE']) )
+ {
+ $title = $template['ACTIVATE_CHANGE_TITLE'];
+ }
+ else
+ {
+ $title = _ACTIVATE_CHANGE_TITLE;
+ }
+ if (array_key_exists('ACTIVATE_CHANGE_TEXT', $template) && !empty($template['ACTIVATE_CHANGE_TEXT']))
+ {
+ $text = $template['ACTIVATE_CHANGE_TEXT'];
+ }
+ else
+ {
+ $text = _ACTIVATE_CHANGE_TEXT;
+ }
+ break;
+ }
+ $aVars = array(
+ 'memberName' => Entity::hsc($mem->getDisplayName()),
+ 'realName' => Entity::hsc($mem->getRealName()),
+ );
+ switch ( $type )
+ {
+ case 'title':
+ echo TEMPLATE::fill($title, $aVars);
+ break;
+ case 'text':
+ echo TEMPLATE::fill($text, $aVars);
+ break;
+ case 'ackey':
+ echo Entity::hsc($key);
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_addtickettourl()
+ * Parse skinvar addtickettourl
+ *
+ * @param string $url URI for ticket
+ * @return void
+ */
+ public function parse_addtickettourl($url)
+ {
+ global $manager;
+ $url = $manager->addTicketToUrl($url);
+ echo Entity::hsc($url);
+ return;
+ }
+
+ /**
+ * Actions::parse_adminbanlist()
+ * Parse skinvar adminbanlist
+ *
+ * @param string $templateName name of template to use
+ * @return void
+ */
+ public function parse_adminbanlist($templateName = '')
+ {
+ $blogid = intRequestVar('blogid');
+
+ $query = "SELECT * FROM %s WHERE blogid=%d ORDER BY iprange;";
+ $query = sprintf($query, sql_table('ban'), (integer) $blogid);
+
+ $template['content'] = 'banlist';
+
+ $amount = Showlist($query, 'table', $template, $templateName);
+
+ if ( $amount == 0 )
+ {
+ echo _BAN_NONE;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_adminbatchaction()
+ * Parse skinvar adminbatchaction
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_adminbatchaction()
+ {
+ echo Entity::hsc(requestVar('batchaction'));
+ return;
+ }
+
+ /**
+ * Actions::parse_adminbatchlist()
+ * Parse skinvar adminbatchlist
+ *
+ * @param string $templateName name of template to use
+ * @return void
+ */
+ public function parse_adminbatchlist($templateName = '')
+ {
+ global $manager;
+ $templates = array();
+ if ( !empty($templateName) )
+ {
+ $templates = Template::read($templateName);
+ }
+ if ( isset($templates['ADMIN_BATCHLIST']) || !empty($templates['ADMIN_BATCHLIST']) )
+ {
+ $template = $templates['ADMIN_BATCHLIST'];
+ }
+ else
+ {
+ $template = '<li><%text(_BATCH_EXECUTING)%><b><%adminbatchaction%></b>'
+ . '<%batchlisttype%> <b><%batchid%></b>...'
+ . '<b><%batchlistmsg%></b></li>' . "\n";
+ }
+
+ $selected = requestIntArray('batch');
+ $action = requestVar('batchaction');
+
+ switch ( $this->skintype )
+ {
+ case 'batchitem':
+ $batchlisttype = _BATCH_ONITEM;
+ $deleteaction = 'deleteOneItem';
+ $moveaction = 'moveOneItem';
+ $destid = intRequestVar('destcatid');
+ break;
+ case 'batchcomment':
+ $batchlisttype = _BATCH_ONCOMMENT;
+ $deleteaction = 'deleteOneComment';
+ break;
+ case 'batchmember':
+ $batchlisttype = _BATCH_ONMEMBER;
+ $deleteaction = 'deleteOneMember';
+ $setadminsql = sql_table('member') . ' SET madmin = 1 WHERE mnumber = ';
+ $unsetchksql = 'SELECT * FROM ' . sql_table('member') . ' WHERE madmin = 1 AND mcanlogin = 1';
+ $unsetupsql = sql_table('member') . ' SET madmin = 0 WHERE mnumber = ';
+ $unseterrmsg = _ERROR_ATLEASTONEADMIN;
+ break;
+ case 'batchteam':
+ $blogid = intRequestVar('blogid');
+ $batchlisttype = _BATCH_ONTEAM;
+ $deleteaction = 'deleteOneTeamMember';
+ $setadminsql = sql_table('team') . ' SET tadmin = 1 WHERE tblog = ' . $blogid . ' AND tmember = ';
+ $unsetchksql = 'SELECT * FROM ' . sql_table('team') . ' WHERE tadmin = 1 AND tblog = ' . $blogid;
+ $unseterrmsg = _ERROR_ATLEASTONEBLOGADMIN;
+ $unsetupsql = sql_table('team') . ' SET tadmin = 0 WHERE tblog = ' . $blogid . ' AND tmember = ';
+ break;
+ case 'batchcategory':
+ $batchlisttype = _BATCH_ONCATEGORY;
+ $deleteaction = 'deleteOneCategory';
+ $moveaction = 'moveOneCategory';
+ $destid = intRequestVar('destblogid');
+ break;
+ }
+
+ // walk over all selectedids and perform action
+ foreach ( $selected as $selectedid )
+ {
+ $error = '';
+ $selectedid = intval($selectedid);
+ switch ( $action )
+ {
+ case 'delete':
+ if ( $this->skintype != 'batchteam' )
+ {
+ $error = $this->objAdmin->$deleteaction($selectedid);
+ }
+ else
+ {
+ $error = $this->objAdmin->deleteOneTeamMember($blogid, $selectedid);
+ }
+ break;
+ case 'move':
+ $error = $this->objAdmin->$moveaction($selectedid, $destid);
+ break;
+ case 'setadmin':
+ // always succeeds
+ sql_query('UPDATE ' . $setadminsql . $selectedid);
+ $error = '';
+ break;
+ case 'unsetadmin':
+ // there should always remain at least one super-admin
+ $r = sql_query($unsetchksql);
+ if ( sql_num_rows($r) < 2 )
+ {
+ $error = $unseterrmsg;
+ }
+ else
+ {
+ sql_query('UPDATE ' . $unsetupsql . $selectedid);
+ }
+ break;
+ default:
+ $error = _BATCH_UNKNOWN . Entity::hsc($action);
+ }
+ $data = array(
+ 'batchid' => $selectedid,
+ 'batchlisttype' => Entity::hsc($batchlisttype),
+ 'adminbatchaction' => Entity::hsc($action),
+ 'batchlistmsg' => $error ? $error : _BATCH_SUCCESS,
+ );
+ $handler = new Actions('template', $template, new ADMIN);
+ $parser = new Parser($handler);
+
+ ob_start();
+ $parser->parse($template);
+ $template = ob_get_contents();
+ ob_end_clean();
+
+ echo TEMPLATE::fill($template, $data);
+ return;
+ }
+ }
+
+ /**
+ * Actions::parse_adminbloglink()
+ * Parse skinvar adminbloglink
+ *
+ * @param string $templateName name of template to use
+ * @return void
+ */
+ public function parse_adminbloglink($templateName = '')
+ {
+ global $manager;
+ $blogid = intRequestVar('blogid');
+ $blog =& $manager->getBlog($blogid);
+ $templates = array();
+
+ if ( !empty($templateName) )
+ {
+ $templates = Template::read($templateName);
+ }
+
+ if ( isset($templates['ADMIN_BLOGLINK']) || !empty($templates['ADMIN_BLOGLINK']) )
+ {
+ $template = $templates['ADMIN_BLOGLINK'];
+ }
+ else
+ {
+ $template = '<a href="<%url%>" title="<%adminbloglinktitle%>"><%blogname%></a>';
+ }
+
+ $data = array(
+ 'url' => Entity::hsc($blog->getURL()),
+ 'adminbloglinktitle' => _BLOGLIST_TT_VISIT,
+ 'blogname' => Entity::hsc($blog->getName())
+ );
+
+ echo TEMPLATE::fill($template, $data);
+ return;
+ }
+
+ /**
+ * Actions::parse_adminerrormesg()
+ * Parse skinvar adminerrormesg
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_adminerrormesg()
+ {
+ global $CONF;
+ $message = '';
+
+ if ( requestVar('errormessage') )
+ {
+ $message = requestVar('errormessage');
+ }
+ elseif ( cookieVar($CONF['CookiePrefix'] . 'errormessage') )
+ {
+ $message = cookieVar($CONF['CookiePrefix'] . 'errormessage');
+ }
+ elseif ( $this->objAdmin->sessionVar($CONF['CookiePrefix'] . 'errormessage') )
+ {
+ $message = $this->objAdmin->sessionVar($CONF['CookiePrefix'] . 'errormessage');
+ }
+ echo Entity::hsc($message);
+ return;
+ }
+
+ /**
+ * Actions::parse_adminparsedinclude()
+ * Parse skinvar adminparsedinclude
+ *
+ * @param string $filename name of file
+ * @return void
+ */
+ public function parse_adminparsedinclude($filename)
+ {
+ // check current level
+ if ( $this->level > 3)
+ {
+ // max. depth reached (avoid endless loop)
+ return;
+ }
+ $skin = new Skin($this->skin->id);
+ $file = $this->getIncludeFileName($filename);
+
+ if ( !$skin->isValid && !file_exists($file) )
+ {
+ return;
+ }
+
+ $contents = $skin->getContent($filename);
+
+ if ( !$contents )
+ {
+ if ( !file_exists($file) )
+ {
+ return;
+ }
+ $contents = file_get_contents($file);
+ if ( empty($contents) )
+ {
+ return;
+ }
+ }
+ $this->level = $this->level + 1;
+ // parse file contents
+ $this->parser->parse($contents);
+
+ $this->level = $this->level - 1;
+ return;
+ }
+
+ /**
+ * Actions::parse_adminskineditallowedlist()
+ * Parse skinvar adminskineditallowedlist
+ *
+ * @param string $type template/blog
+ * @param string $templateName name of template to use
+ * @return void
+ */
+ public function parse_adminskineditallowedlist($type = 'template', $templateName = '')
+ {
+ switch ( $type )
+ {
+ /* TODO: blog seems not to be used */
+ case 'blog':
+ $query = "SELECT bshortname, bname FROM %s";
+ $query = sprintf($query, sql_table('blog'));
+ $show = array(
+ 'content' => 'shortblognames'
+ );
+ break;
+ case 'template':
+ $query = "SELECT tdname as name, tddesc as description FROM %s;";
+ $query = sprintf($query, sql_table('admintemplate_desc'));
+ $show = array(
+ 'content' => 'shortnames'
+ );
+ break;
+ }
+ Showlist($query, 'table', $show, $templateName);
+ return;
+ }
+
+ /**
+ * Actions::parse_adminskinielist()
+ * Parse skinvar adminskinielist
+ *
+ * @param string $type skin/template
+ * @param string $templateName name of template to use
+ * @return void
+ */
+ public function parse_adminskinielist($type, $templateName = '')
+ {
+ $templates = array();
+ if ( $templateName )
+ {
+ $templates = Template::read($templateName);
+ }
+ if ( isset($templates['SKINIE_EXPORT_LIST']) && !empty($templates['SKINIE_EXPORT_LIST']) )
+ {
+ $template = $templates['SKINIE_EXPORT_LIST'];
+ }
+ else
+ {
+ $template = '<td><input type="checkbox" name="<%typeid%>" id="<%expid%>" /><label for="<%expid%>"><%expname%></label></td>' . "\n"
+ . "<td><%expdesc%></td>\n"
+ . "</tr><tr>\n";
+ }
+ switch ( $type )
+ {
+ case 'skin':
+ $query = "SELECT * FROM %s;";
+ $query = sprintf($query, sql_table('adminskin_desc'));
+ $res = sql_query($query);
+
+ while ( $skinObj = sql_fetch_object($res) )
+ {
+ $data = array(
+ 'typeid' => 'skin[' . $skinObj->sdnumber . ']',
+ 'expid' => 'skinexp' . $skinObj->sdnumber,
+ 'expname' => Entity::hsc($skinObj->sdname),
+ 'expdesc' => Entity::hsc($skinObj->sddesc),
+ );
+ echo TEMPLATE::fill($template, $data);
+ }
+ break;
+ case 'template':
+ $query = "SELECT * FROM %s;";
+ $query = sprintf($query, sql_table('admintemplate_desc'));
+ $res = sql_query($query);
+ while ( $templateObj = sql_fetch_object($res) )
+ {
+ $data = array(
+ 'typeid' => 'template[' . $templateObj->tdnumber . ']',
+ 'expid' => 'templateexp' . $templateObj->tdnumber,
+ 'expname' => Entity::hsc($templateObj->tdname),
+ 'expdesc' => Entity::hsc($templateObj->tddesc),
+ );
+ echo TEMPLATE::fill($template, $data);
+ }
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_adminskinoverview()
+ * Parse skinvar adminskinoverview
+ *
+ * @param string $templateName name of template to use
+ * @return void
+ */
+ public function parse_adminskinoverview($templateName = '')
+ {
+ $query = "SELECT * FROM %s ORDER BY sdname;";
+ $query = sprintf($query, sql_table('adminskin_desc'));
+
+ $template['content'] = 'adminskinlist';
+ $template['tabindex'] = 10;
+ Showlist($query, 'table', $template, $templateName);
+ return;
+ }
+
+ /**
+ * Actions::parse_adminskinselectoptions()
+ * Parse skinvar adminskinselectoptions
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_adminskinselectoptions()
+ {
+ global $CONF;
+ $query = "SELECT sdname as text, sdnumber as value FROM %s;";
+ $query = sprintf($query, sql_table('adminskin_desc'));
+
+ $template['name'] = 'adminskin';
+ $template['selected'] = $CONF['DefaultAdminSkin'];
+ $template['tabindex'] = 110;
+ Showlist($query, 'select', $template, '');
+ return;
+ }
+
+ /**
+ * Actions::parse_adminspecialskinlist()
+ * Parse skinvar adminspecialskinlist
+ *
+ * @param string $templateName name of template to use
+ */
+ public function parse_adminspecialskinlist($templateName = '')
+ {
+ $templates = array();
+ if ( $templateName )
+ {
+ $templates = Template::read($templateName);
+ }
+
+ $nType = Skin::getAdminskinDefaultTypes();
+ $skinid = intRequestVar('skinid');
+
+ $query = "SELECT stype FROM %s WHERE stype NOT IN (%s) AND sdesc=%d;";
+ $query = sprintf($query, sql_table('adminskin'), "'" . implode("', '", $nType) . "'", (integer) $skinid);
+
+ $res = sql_query($query);
+ if ( $res && sql_num_rows($res) > 0 )
+ {
+ $data = array();
+ if ( isset($templates['ADMIN_SPECIALSKINLIST_HEAD']) && !empty($templates['ADMIN_SPECIALSKINLIST_HEAD']) )
+ {
+ $template['head'] = $templates['ADMIN_SPECIALSKINLIST_HEAD'];
+ }
+ else
+ {
+ $template['head'] = "<ul>\n";
+ }
+ echo TEMPLATE::fill($template['head'], $data);
+ if ( isset($templates['ADMIN_SPECIALSKINLIST_BODY']) && !empty($templates['ADMIN_SPECIALSKINLIST_BODY']) )
+ {
+ $template['body'] = $templates['ADMIN_SPECIALSKINLIST_BODY'];
+ }
+ else
+ {
+ $template['body'] = '<li><a tabindex="<%tabindex%>" href="index.php?action=adminskinedittype&skinid=<%skinid%>'
+ . '&type=<%skintype%>"><%skintype%></a> (<a tabindex="<%tabindex%>" href="index.php?'
+ . 'action=adminskinremovetype&skinid=<%skinid%>&type=<%skintype%>">remove</a>)</li>';
+ }
+ $tabstart = 120;
+ while ( $row = sql_fetch_assoc($res) )
+ {
+ $data = array(
+ 'tabindex' => $tabstart++,
+ 'skinid' => $skinid,
+ 'skintype' => Entity::hsc(strtolower($row['stype']))
+ );
+ echo TEMPLATE::fill($template['body'], $data);
+ }
+
+ $data = array();
+ if ( isset($templates['ADMIN_SPECIALSKINLIST_FOOT']) && !empty($templates['ADMIN_SPECIALSKINLIST_FOOT']) )
+ {
+ $template['foot'] = $templates['ADMIN_SPECIALSKINLIST_FOOT'];
+ }
+ else
+ {
+ $template['foot'] = "<ul>\n";
+ }
+ echo TEMPLATE::fill($template['foot'], $data);
+ return;
+ }
+ }
+
+ /**
+ * Actions::parse_adminstylesheets()
+ * Parse skinvar adminstylesheets
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_adminstylesheets()
+ {
+ global $CONF;
+ $includePrefix = $this->skin->includePrefix;
+
+ if ( strlen($includePrefix) > 0 )
+ {
+ $styleURL = Entity::hsc($CONF['AdminURL']) . 'adminskins/' . $includePrefix . 'admin_' . $CONF['AdminCSS'] . '.css';
+ }
+ else
+ {
+ $styleURL = Entity::hsc($CONF['AdminURL']) . 'styles/admin_' . $CONF['AdminCSS'] . '.css';
+ }
+ echo $styleURL;
+ return;
+ }
+
+ /**
+ * Actions::parse_adminstyleselectoptions()
+ * Parse skinvar adminstyleselectoptions
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_adminstyleselectoptions()
+ {
+ global $CONF, $manager, $DIR_NUCLEUS;
+ if ( strlen($this->skin->includePrefix) > 0 )
+ {
+ $scndir = $DIR_NUCLEUS . 'adminskins/' . $this->skin->includePrefix;
+ }
+ else
+ {
+ $scndir = $DIR_NUCLEUS . 'styles/';
+ }
+ $files = scandir($scndir);
+
+ foreach ( $files as $file )
+ {
+ if ( !preg_match("#^admin_(.*)\.css$#", $file, $matches) )
+ {
+ continue;
+ }
+
+ $name = $matches[1];
+ $opts = '<option value="' . $name . '"';
+ if ( $name != $CONF['AdminCSS'] )
+ {
+ $opts .= "<option value=\"{$name}\">{$name}</option>\n";
+ }
+ else
+ {
+ $opts .= "<option value=\"{$name}\" selected=\"selected\">{$name}</option>\n";
+ }
+ echo $opts;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_admintemplateoverview()
+ * Parse skinvar admintemplateoverview
+ *
+ * @param string $templateName name of template to use
+ * @return void
+ */
+ public function parse_admintemplateoverview($templateName = '')
+ {
+ $query = "SELECT * FROM %s ORDER BY tdname;";
+ $query = sprintf($query, sql_table('admintemplate_desc'));
+
+ $template['content'] = 'admintemplatelist';
+ $template['tabindex'] = 10;
+
+ Showlist($query, 'table', $template, $templateName);
+ return;
+ }
+
+ /**
+ * Actions::parse_allowedadminskinactions()
+ * Parse skinvar allowedadminskinactions
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_allowedadminskinactions()
+ {
+ global $DIR_ADMINSKINS;
+ $skinType = strtolower(trim(requestVar('type')));
+ $actions = Skin::getAllowedActionsForType($skinType);
+ sort($actions);
+
+ while ( $current = array_shift($actions) )
+ {
+ // skip deprecated vars
+ if ($current == 'ifcat' || $current == 'imagetext' || $current == 'vars')
+ {
+ continue;
+ }
+
+ echo "<a href=\"{$DIR_ADMINSKINS}documentation/help.html#{$current}\" onclick=\"if (event && event.preventDefault) event.preventDefault(); return help(this.href);\">{$current}</a>\n";
+
+ if ( count($actions) != 0 )
+ {
+ echo ", ";
+ }
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_allowedskinactions()
+ * Parse skinvar allowedskinactions
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_allowedskinactions()
+ {
+ $skinType = strtolower(trim(requestVar('type')));
+ $actions = SKIN::getAllowedActionsForType($skinType);
+ sort($actions);
+
+ while ( $current = array_shift($actions) )
+ {
+ // skip deprecated vars
+ if ( $current == 'ifcat' || $current == 'imagetext' || $current == 'vars' )
+ {
+ continue;
+ }
+
+ /* TODO: alternative function should be used or not? */
+ echo helplink("skinvar-{$current}") . "$current</a>\n";
+
+ if ( count($actions) != 0 )
+ {
+ echo ", ";
+ }
+ }
+ return;
+ }
+
+ /**
+ * Action::parse_banlistdeletedlist()
+ * Parse skinvar banlistdeletedlist
+ *
+ * @param string $templateName name of template to use
+ * @return void
+ */
+ public function parse_banlistdeletedlist($templateName = '')
+ {
+ global $manager;
+ $templates = array();
+
+ if ( $templateName )
+ {
+ $templates = Template::read($templateName);
+ }
+ if ( isset($templates['BANLIST_DELETED_LIST']) && !empty($templates['BANLIST_DELETED_LIST']) )
+ {
+ $template = $templates['BANLIST_DELETED_LIST'];
+ }
+ else
+ {
+ $template = "<li><%blogname%></li>\n";
+ }
+ $deleted = requestArray('delblogs');
+ foreach ( $deleted as $delblog )
+ {
+ $blog =& $manager->getBlog($delblog);
+ $data = array(
+ Entity::hsc($blog->getName())
+ );
+ TEMPLATE::fill($template, $data);
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_batchdeletelist()
+ * Parse skinvar batchdeletelist
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_batchdeletelist()
+ {
+ $selected = requestIntArray('batch');
+ $index = 0;
+
+ foreach ( $selected as $select )
+ {
+ echo '<input type="hidden" name="batch[' . ($index++) . ']" value="' . intval($select) . "\" />\n";
+ }
+ // add hidden vars for team & comment
+ if ( requestVar('action') == 'batchteam' )
+ {
+ echo '<input type="hidden" name="blogid" value="' . intRequestVar('blogid') . "\" />\n";
+ }
+ if ( requestVar('action') == 'batchcomment' )
+ {
+ echo '<input type="hidden" name="itemid" value="' . intRequestVar('itemid') . "\" />\n";
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_batchdeletetype()
+ * Parse skinvar batchdeletetype
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_batchdeletetype()
+ {
+ echo Entity::hsc(requestVar('action'));
+ return;
+ }
+
+ /**
+ * Actions::parse_batchmovebtn()
+ * Parse skinvar batchmovebtn
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_batchmovebtn()
+ {
+ $actionType = requestVar('action');
+ switch ( $actionType )
+ {
+ case 'batchitem':
+ echo _MOVE_BTN;
+ break;
+ case 'batchcategory':
+ echo _MOVECAT_BTN;
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_batchmovelist()
+ * Parse skinvar batchmovelist
+ *
+ * @param void
+ * @param void
+ */
+ public function parse_batchmovelist()
+ {
+ $selected = requestIntArray('batch');
+ foreach ( $selected as $select )
+ {
+ echo '<input type="hidden" name="batch[' . ($select++) . ']" value="' . intval($select) . "\" />\n";
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_batchmovetitle()
+ * Parse skinvar batchmovetitle
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_batchmovetitle()
+ {
+ $actionType = requestVar('action');
+ switch ( $actionType )
+ {
+ case 'batchitem':
+ echo _MOVE_TITLE;
+ break;
+ case 'batchcategory':
+ echo _MOVECAT_TITLE;
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_batchmovetype()
+ * Parse skinvar batchmovetype
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_batchmovetype()
+ {
+ echo Entity::hsc(requestVar('action'));
+ return;
+ }
+
+ /**
+ * Actions::parse_blogcatlist()
+ * Parse skinvar blogcatlist
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_blogcatlist()
+ {
+ global $manager;
+ $blogid = intRequestVar('blogid');
+ $query = "SELECT * FROM %s WHERE cblog = %d ORDER BY cname;";
+ $query = sprintf($query, sql_table('category'), (integer) $blogid);
+
+ $template['content'] = 'categorylist';
+ $template['tabindex'] = 200;
+
+ $batch = new Batch('member');
+ $batch->showlist($query, 'table', $template);
+ return;
+ }
+
+ /**
+ * Actions::parse_blognotifysetting()
+ * Parse skinvar blognotifysetting
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_blognotifysetting($type)
+ {
+ global $manager;
+ $blogid = intRequestVar('blogid');
+ $blog = $manager->getBlog($blogid);
+
+ switch ( $type )
+ {
+ case 'comment':
+ if ( !$blog->notifyOnComment() )
+ {
+ return;
+ }
+ break;
+ case 'vote':
+ if ( !$blog->notifyOnVote() )
+ {
+ return;
+ }
+ break;
+ case 'newitem':
+ if ( !$blog->notifyOnNewItem() )
+ {
+ return;
+ }
+ break;
+ }
+ echo ' checked="checked"';
+ return;
+ }
+
+ /**
+ * AdminAction::parse_blogselectbox()
+ * Parse skinvar blogselectbox
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_blogselectbox()
+ {
+ global $member;
+
+ $selectData = requestVar('selectData');
+ $mode = $selectData['mode'];
+ $name = ENTITY::hsc($selectData['name'], ENT_QUOTES);
+ $tabindex = ENTITY::hsc($selectData['tabindex'], ENT_QUOTES);
+ $aBlogIds = array_map('intval', $selectData['aBlogIds']);
+ $showNewCat = intval($selectData['showNewCat']);
+ $selected = intval($selectData['selected']);
+
+ echo "<select name=\"{$name}\" tabindex=\"{$tabindex}\">\n";
+
+ // 1. select blogs (we'll create optiongroups)
+ // (only select those blogs that have the user on the team)
+ $queryBlogs = "SELECT bnumber, bname FROM %s WHERE bnumber in (%s) ORDER BY bname;";
+ $queryBlogs = sprintf($queryBlogs, sql_table('blog'), implode(',', $aBlogIds));
+ $blogs = sql_query($queryBlogs);
+
+ if ( $mode == 'category' )
+ {
+ if ( sql_num_rows($blogs) > 1 )
+ {
+ $multipleBlogs = 1;
+ }
+ while ( $oBlog = sql_fetch_object($blogs) )
+ {
+ if ( isset($multipleBlogs) && !empty($multipleBlogs) )
+ {
+ echo '<optgroup label="' . ENTITY::hsc($oBlog->bname, ENT_QUOTES) . "\>\n";
+ }
+
+ // show selection to create new category when allowed/wanted
+ if ( $showNewCat )
+ {
+ // check if allowed to do so
+ if ( $member->blogAdminRights($oBlog->bnumber) )
+ {
+ echo '<option value="newcat-' . $oBlog->bnumber . '">' . _ADD_NEWCAT . "</option>\n";
+ }
+ }
+
+ // 2. for each category in that blog
+ $catQueriy = "SELECT cname, catid FROM %s WHERE cblog=%d ORDER BY cname ASC;";
+ $catQuery = sprintf($catQuery, sql_table('category'), (integer) $oBlog->bnumber);
+ $categories = sql_query(sprintf($catQueriy));
+ while ( $oCat = sql_fetch_object($categories) )
+ {
+ if ( $oCat->catid == $selected )
+ {
+ $selectText = ' selected="selected" ';
+ }
+ else
+ {
+ $selectText = '';
+ }
+ echo '<option value="' . $oCat->catid . '" ' . $selectText . '>' . ENTITY::hsc($oCat->cname, ENT_QUOTES) . "</option>\n";
+ }
+
+ if ( isset($multipleBlogs) && !empty($multipleBlogs) )
+ {
+ echo '</optgroup>';
+ }
+ }
+ }
+ else
+ {
+ // blog mode
+ while ( $oBlog = sql_fetch_object($blogs) )
+ {
+ echo '<option value="' . $oBlog->bnumber . '"';
+ if ( $oBlog->bnumber == $selected )
+ {
+ echo '<option value="' . $oBlog->bnumber . '" selected="selected">' . ENTITY::hsc($oBlog->bname, ENT_QUOTES) . "</option>\n";
+ }
+ else
+ {
+ echo '<option value="' . $oBlog->bnumber . '">' . ENTITY::hsc($oBlog->bname, ENT_QUOTES) . "</option>\n";
+ }
+ }
+ }
+ echo "</select>\n";
+ return;
+ }
+
+ /**
+ * Actions::parse_blogsetting()
+ * Parse skinvar blogsetting
+ *
+ * @param string $which name of weblog setting
+ * @return void
+ */
+ public function parse_blogsetting($which)
+ {
+ echo $this->parse_getblogsetting($which);
+ return;
+ }
+
+ /**
+ * Actions::parse_blogsettingyesno()
+ * Parse skinvar blogsettingyesno
+ *
+ * @param string $type type of weblog setting
+ * @param string $templateName name of template to use
+ * @return void
+ */
+ public function parse_blogsettingyesno($type, $templateName = '')
+ {
+ global $manager;
+
+ $blogid = intRequestVar('blogid');
+ $blog = $manager->getBlog($blogid);
+
+ switch ( $type )
+ {
+ case 'convertbreaks':
+ $checkedval = $blog->convertBreaks();
+ $tabindex = 55;
+ break;
+ case 'allowpastposting':
+ $checkedval = $blog->allowPastPosting();
+ $tabindex = 57;
+ break;
+ case 'comments':
+ $checkedval = $blog->commentsEnabled();
+ $tabindex = 60;
+ break;
+ case 'public':
+ $checkedval = $blog->isPublic();
+ $tabindex = 70;
+ break;
+ case 'reqemail':
+ $checkedval = $blog->emailRequired();
+ $tabindex = 72;
+ break;
+ case 'searchable':
+ $checkedval = $blog->getSearchable();
+ $tabindex = 122;
+ break;
+ }
+ $this->parse_inputyesno($type, $checkedval, $tabindex, 1, 0, _YES, _NO, 0, $templateName);
+ return;
+ }
+
+ /**
+ * Actions::parse_blogteamlist()
+ * Parse skinvar blogteamlist
+ *
+ * @param string $templateName name of template to use
+ * @return void
+ */
+ public function parse_blogteamlist($templateName = '')
+ {
+ global $manager;
+ $blogid = intRequestVar('blogid');
+ $query = "SELECT tblog, tmember, mname, mrealname, memail, tadmin "
+ . "FROM %s, %s "
+ . "WHERE tmember=mnumber AND tblog= %d";
+ $query = sprintf($query, sql_table('member'), sql_table('team'), (integer) $blogid);
+
+ $template['content'] = 'teamlist';
+ $template['tabindex'] = 10;
+
+ $batch = new Batch('team');
+ $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);
+ return;
+ }
+
+ /**
+ * Actions::parse_blogteammembers()
+ * Parse skinvar blogteammembers
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_blogteammembers()
+ {
+ $blogid = intRequestVar('blogid');
+ $query = "SELECT mname, mrealname "
+ . "FROM %s, %s "
+ . "WHERE mnumber=tmember AND tblog=%d;";
+ $query = sprintf($query, sql_table('member'), sql_table('team'), (integer) $blogid);
+ $res = sql_query($query);
+ $memberNames = array();
+ while ($o = sql_fetch_object($res)) {
+ $memberNames[] = Entity::hsc($o->mname) . ' (' . Entity::hsc($o->mrealname). ')';
+ }
+ echo implode(',', $memberNames);
+ }
+
+ /**
+ * Actions::parse_blogtime()
+ * Parse skinvar blogtime
+ *
+ * @param string $type type of time
+ * @param string $format format for time expression
+ * @param integer $offset offset of time
+ * @return void
+ */
+ public function parse_blogtime($type, $format = '%H:%M', $offset = 0)
+ {
+ global $manager;
+
+ if ( $type != 'blogtime' )
+ {
+ /* return server time */
+ $timestamp = time() + $offset;
+ }
+ else
+ {
+ $bid = intRequestVar('blogid');
+ $b = $manager->getBlog($bid);
+ $timestamp = $b->getCorrectTime() + $offset;
+ }
+
+ echo i18n::formatted_datetime($format, $timestamp);
+ return;
+ }
+
+ /**
+ * Actions::parse_bookmarkletadmin()
+ * Parse skinvar bookmarkletadmin
+ *
+ * @param string $type type of anchor element for bookmarklet
+ * @return void
+ */
+ public function parse_bookmarkletadmin($type)
+ {
+ global $manager;
+
+ $blogid = intRequestVar('blogid');
+
+ if ( $type != 'regfile' )
+ {
+ echo Entity::hsc(getBookmarklet($blogid));
+ }
+ else
+ {
+ $url = 'index.php?action=regfile&blogid=' . intval($blogid);
+ $url = $manager->addTicketToUrl($url);
+ /* TODO: Shift-JIS is not always correct, I think... */
+ echo Entity::hsc($url, 'SJIS');
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_category()
+ * Parse skinvar category
+ *
+ * @param string $type name of setting for category
+ * @return void
+ */
+ public function parse_category($type = 'name')
+ {
+ echo $this->parse_getcategory($type);
+ return;
+ }
+
+ /**
+ * Actions::parse_categorysetting()
+ * Parse skinvar categorysetting
+ *
+ * @param string $type type in category setting
+ * @return void
+ */
+ public function parse_categorysetting($type)
+ {
+ $catid = intRequestVar('catid');
+ if ( $type == 'id' )
+ {
+ echo $catid;
+ return;
+ }
+ $blogid = intRequestVar('blogid');
+ $query = "SELECT * FROM %s WHERE cblog = %d AND catid = %d;";
+ $query = sprintf($query, sql_table('category'), (integer) $blogid, (integer) $catid);
+ $res = sql_query($query);
+ $obj = sql_fetch_object($res);
+
+ if ( $type != desc )
+ {
+ echo Entity::hsc($obj->cdesc);
+ }
+ else
+ {
+ echo Entity::hsc($obj->cname);
+ }
+
+ return;
+ }
+
+ /**
+ * Actions::parse_codename()
+ * Parse templatevar codename
+ *
+ * @param void
+ * @return void
+ *
+ * TODO: is this need???
+ */
+ public function parse_codename()
+ {
+ global $nucleus;
+ echo $nucleus['codename'];
+ return;
+ }
+
+ /**
+ * Actions::parse_commentnavlist()
+ * Parse skinvar commentnavlist
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_commentnavlist()
+ {
+ global $CONF, $manager, $member;
+
+ // start index
+ if ( postVar('start') )
+ {
+ $start = intPostVar('start');
+ }
+ else
+ {
+ $start = 0;
+ }
+
+ // amount of items to show
+ if ( postVar('amount') )
+ {
+ $amount = intPostVar('amount');
+ }
+ else
+ {
+ $amount = (integer) $CONF['DefaultListSize'];
+ if ( $amount < 1 )
+ {
+ $amount = 10;
+ }
+ }
+ $query = 'SELECT cbody, cuser, cmail, cemail, mname, ctime, chost, cnumber, cip, citem '
+ . 'FROM %s '
+ . 'LEFT OUTER JOIN %s ON mnumber=cmember '
+ . 'WHERE ';
+ $query = sprintf($query, sql_table('comment'), sql_table('member'));
+
+ if ( $this->skintype == 'itemcommentlist' )
+ {
+ $itemid = intRequestVar('itemid');
+ $query .= " citem={$itemid}";
+ $template['canAddBan'] = $member->blogAdminRights(intRequestVar('blogid'));
+ $bid = 0;
+ $nonComments = _NOCOMMENTS;
+ }
+ elseif ( $this->skintype == 'browseowncomments' )
+ {
+ $itemid = 0;
+ $query .= ' cmember=' . $member->getID();
+ $template['canAddBan'] = 0;
+ $bid = 0;
+ $nonComments = _NOCOMMENTS_YOUR;
+ }
+ elseif ( $this->skintype == 'blogcommentlist' )
+ {
+ $itemid = 0;
+ $query .= ' cblog=' . intRequestVar('blogid');
+ $template['canAddBan'] = $member->blogAdminRights(intRequestVar('blogid'));
+ $bid = intRequestVar('blogid');
+ $nonComments = _NOCOMMENTS_BLOG;
+ }
+
+ $search = postVar('search');
+ if ( !empty($search) )
+ {
+ $query .= ' and cbody LIKE "%' . sql_real_escape_string($search) . '%"';
+ }
+
+ $query .= " ORDER BY ctime ASC LIMIT {$start},{$amount}";
+
+ $template['content'] = 'commentlist';
+
+ $navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $bid, $search, $itemid);
+ $navList->showBatchList('comment', $query, 'table', $template, $nonComments);
+ return;
+ }
+
+ /**
+ * Actions::parse_configsettingsedit()
+ * Parse skinvar configsettingsedit
+ *
+ * @param string $type type of global configuration
+ * @return void
+ */
+ public function parse_configsettingsedit($type)
+ {
+ global $CONF;
+ switch ( $type )
+ {
+ case 'DefaultListSize':
+ if ( !array_key_exists('DefaultListSize', $CONF) )
+ {
+ $query = "INSERT INTO %s VALUES (DefaultListSize, 10);";
+ $query = sprintf($query, sql_table('config'));
+ sql_query($query);
+ $CONF['DefaultListSize'] = 10;
+ }
+ elseif ( intval($CONF['DefaultListSize']) < 1 )
+ {
+ $CONF['DefaultListSize'] = 10;
+ }
+ echo intval($CONF['DefaultListSize']);
+ break;
+ case 'SessionCookie':
+ $value = $CONF['SessionCookie'];
+ $txt1 = _SETTINGS_COOKIESESSION;
+ $txt2 = _SETTINGS_COOKIEMONTH;
+ $this->parse_inputyesno('SessionCookie', $value, 10190, 1, 0, $txt1, $txt2);
+ break;
+ case 'URLMode':
+ $value = $CONF['URLMode'];
+ $txt1 = _SETTINGS_URLMODE_NORMAL;
+ $txt2 = _SETTINGS_URLMODE_PATHINFO;
+ $this->parse_inputyesno('URLMode', $value, 10077, 'normal', 'pathinfo', $txt1, $txt2);
+ break;
+ default:
+ if ( array_key_exists($type, $CONF) && is_string($CONF[$type]) )
+ {
+ echo Entity::hsc($CONF[$type]);
+ }
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_configsettingsyesno()
+ * Parse skinvar configsettingsyesno
+ *
+ * @param string $type type of global setting
+ * @param integer $tabindex tabindex attribute of input element
+ * @return void
+ */
+ public function parse_configsettingsyesno($type, $tabindex)
+ {
+ global $CONF;
+ if ( array_key_exists($type, $CONF) )
+ {
+ $this->parse_inputyesno($type, $CONF[$type], $tabindex);
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_customhelplink()
+ * Parse skinvar customhelplink
+ *
+ * @param string $topic name of topic
+ * @param string $tplName name of template
+ * @param string $url string as URI
+ * @param string $iconURL string as URI for icon
+ * @param string $alt alternative text for image element
+ * @param string $title title for anchor element
+ * @return void
+ */
+ public function parse_customhelplink($topic, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
+ {
+ $this->customHelp($topic, $url, $iconURL);
+ return;
+ }
+
+ /**
+ * Actions::parse_date()
+ * Parse skinvar date
+ */
+ public function parse_date($format = 'c')
+ {
+ global $CONF, $manager;
+ echo i18n::formatted_datetime($format, time(), 'iso8601', $manager->getBlog((integer) $CONF['DefaultBlog']));
+ return;
+ }
+
+ /**
+ * Actions::parse_defaultadminskintypes()
+ * Parse skinvar defaultadminskintypes
+ *
+ * @param string $tabindex index number for tabindex attribute of input element
+ * @param string $templateName name of template
+ * @return void
+ */
+ public function parse_defaultadminskintypes($tabindex, $templateName = '')
+ {
+ $templates = array();
+ if ( $templateName )
+ {
+ $templates = Template::read($templateName);
+ }
+
+ $types = Skin::getAdminskinDefaultTypeFriendlyNames();
+ ksort($types);
+
+ if ( array_key_exists('ADMINSKINTYPELIST_HEAD', $templates) && !empty($templates['ADMINSKINTYPELIST_HEAD']) )
+ {
+ $template['head'] = $templates['ADMINSKINTYPELIST_HEAD'];
+ }
+ else
+ {
+ $template['head'] = "<ul>\n";
+ }
+
+ echo $template['head'];
+
+ if ( array_key_exists('ADMINSKINTYPELIST_BODY', $templates) && !empty($templates['ADMINSKINTYPELIST_BODY']) )
+ {
+ $template['body'] = $templates['ADMINSKINTYPELIST_BODY'];
+ }
+ else
+ {
+ $template['body'] = '<li><a tabindex="<%tabindex%>" href="index.php?action=adminskinedittype&skinid=<%skinid%>&type=<%skintype%>">'
+ . "<%name%></a> <%help%></li>\n";
+ }
+ $handler = new Actions('template', $template, new ADMIN);
+ $parser = new PARSER(Actions::getDefinedActions(), $handler);
+
+ foreach ( $types as $type => $fName )
+ {
+ $helplink = $this->customHelpHtml('skinpart' . $type, $templateName);
+ $data = array(
+ 'tabindex' => $tabindex,
+ 'skintype' => $type,
+ 'name' => $fName,
+ 'help' => $helplink,
+ 'skinid' => intrequestVar('skinid'),
+ );
+ $templateBody = Template::fill($template['body'], $data);
+ $parser->parse($templateBody);
+ $tabindex++;
+ }
+ if ( array_key_exists('ADMINSKINTYPELIST_FOOT', $templates) && !empty($templates['ADMINSKINTYPELIST_FOOT']) )
+ {
+ $template['foot'] = $templates['ADMINSKINTYPELIST_FOOT'];
+ }
+ else
+ {
+ $template['foot'] = " </ul>\n";
+ }
+ echo $template['foot'];
+ return;
+ }
+
+ /**
+ * Actions::parse_defblogselect()
+ * Parse skinvar defblogselect
+ *
+ * @param string $templateName name of template
+ * @return void
+ */
+ public function parse_defblogselect($templateName = '')
+ {
+ global $CONF;
+ $query = "SELECT bname as text, bnumber as value FROM %s;";
+ $query = sprintf($query, sql_table('blog'));
+ $template['name'] = 'DefaultBlog';
+ $template['selected'] = $CONF['DefaultBlog'];
+ $template['tabindex'] = 10;
+ Showlist($query, 'select', $template, $templateName);
+ return;
+ }
+
+ /**
+ * Actions::parse_defcatselect()
+ * Parse skinvar defcatselect
+ *
+ * @param string $templateName name of template
+ * @return void
+ */
+ public function parse_defcatselect($templateName = '')
+ {
+ global $manager;
+ $blogid = intRequestVar('blogid');
+ $blog = $manager->getBlog($blogid);
+ $query = "SELECT cname as text, catid as value FROM %s WHERE cblog=%d;";
+ $query = sprintf($query, sql_table('category'), (integer) $blog->getID());
+ $template['name'] = 'defcat';
+ $template['selected'] = $blog->getDefaultCategory();
+ $template['tabindex'] = 110;
+ Showlist($query, 'select', $template, $templateName);
+ return;
+ }
+
+ /**
+ * Actions::parse_defskinselect()
+ * Parse skinvar defskinselect
+ *
+ * @param string $type type of skin
+ * @param string $templateName name of template
+ * @return void
+ */
+ public function parse_defskinselect($type = 'blog', $templateName = '')
+ {
+ global $manager;
+ $query = "SELECT sdname as text, sdnumber as value FROM %s;";
+ $query = sprintf($query, sql_table('skin_desc'));
+
+ $blogid = intRequestVar('blogid');
+
+ if ( !$blogid )
+ {
+ global $CONF;
+ $template['selected'] = $CONF['BaseSkin'];
+ }
+ else
+ {
+ $blog = $manager->getBlog($blogid);
+ $template['selected'] = $blog->getDefaultSkin();
+ }
+
+ if ( $type != 'blog' )
+ {
+ $nname = 'BaseSkin';
+ }
+ else
+ {
+ $nname = 'defskin';
+ }
+
+ $template['name'] = $nname;
+ $template['tabindex'] = 50;
+ Showlist($query, 'select', $template, $templateName);
+ return;
+ }
+
+ /**
+ * AdminActions::parse_deletecomment()
+ * Parse skinvar deletecomment
+ *
+ * @param string $type type of infomation for comment
+ * @return void
+ */
+ public function parse_deletecomment($type = 'id')
+ {
+ $commentid = intRequestVar('commentid');
+ $comment = COMMENT::getComment($commentid);
+
+ switch ( $type )
+ {
+ case 'id':
+ echo intRequestVar('commentid');
+ break;
+ case 'author':
+ if ( array_key_exists('member', $comment) && !empty($comment['member']) )
+ {
+ echo $comment['member'];
+ }
+ else
+ {
+ echo $comment['user'];
+ }
+ break;
+ case 'body':
+ $body = strip_tags($comment['body']);
+ echo ENTITY::hsc(shorten($body, 300, '...'), ENT_QUOTES);
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_deleteitembody()
+ * Parse skinvar deleteitembody
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_deleteitembody()
+ {
+ global $manager;
+ $itemid = intRequestVar('itemid');
+ $item =& $manager->getItem($itemid, 1, 1);
+ $body = strip_tags($item['body']);
+ echo Entity::hsc(shorten($body, 300, '...'));
+ return;
+ }
+
+ /**
+ * Actions::parse_deleteitemid()
+ * Parse skinvar deleteitemid
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_deleteitemid()
+ {
+ echo (integer) intRequestVar('itemid');
+ return;
+ }
+
+ /**
+ * Actions::parse_deleteitemtitle()
+ * Parse skinvar deleteitemtitle
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_deleteitemtitle()
+ {
+ global $manager;
+ $itemid = intRequestVar('itemid');
+ $item =& $manager->getItem($itemid, 1, 1);
+ echo Entity::hsc(strip_tags($item['title']));
+ return;
+ }
+
+ /**
+ * Actions::parse_editadminskin()
+ * Parse skinvar editadminskin
+ *
+ * @param string $type type of skin setting
+ * @return void
+ */
+ public function parse_editadminskin($type = 'id')
+ {
+ $skinid = intRequestVar('skinid');
+ $skin = new Skin($skinid);
+ switch ( $type )
+ {
+ case 'id':
+ echo intRequestVar('skinid');
+ break;
+ case 'name':
+ echo Entity::hsc($skin->getName());
+ break;
+ case 'desc':
+ echo Entity::hsc($skin->getDescription());
+ break;
+ case 'type':
+ echo Entity::hsc($skin->getContentType());
+ break;
+ case 'prefix':
+ echo Entity::hsc($skin->getIncludePrefix());
+ break;
+ case 'mode':
+ $this->parse_inputyesno('inc_mode', $skin->getIncludeMode(), 120, 'skindir', 'normal', _PARSER_INCMODE_SKINDIR, _PARSER_INCMODE_NORMAL);
+ default:
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_editadminskintype()
+ * Parse skinvar editadminskintype
+ *
+ * @param string $type name of skin type
+ * @return void
+ */
+ public function parse_editadminskintype($type = 'id')
+ {
+ global $CONF, $manager, $member;
+ $skinid = intRequestVar('skinid');
+ $skin = new Skin($skinid);
+ $fNames = Skin::getFriendlyNames();
+ $sType = strtolower(trim(requestVar('type')));
+
+ switch ( $type )
+ {
+ case 'id':
+ echo intRequestVar('skinid');
+ break;
+ case 'name':
+ echo Entity::hsc($skin->getName());
+ break;
+ case 'desc':
+ echo Entity::hsc($skin->getDescription());
+ break;
+ case 'type':
+ echo Entity::hsc($skin->getContentType());
+ break;
+ case 'content':
+ echo Entity::hsc($skin->getContent($sType));
+ break;
+ case 'skintype':
+ $skinType = isset($fNames[$sType]) ? $fNames[$sType] : ucfirst($sType);
+ echo Entity::hsc($skinType);
+ break;
+ case 'skintyperaw':
+ echo Entity::hsc($sType);
+ break;
+ case 'prefix':
+ echo Entity::hsc($skin->getIncludePrefix());
+ break;
+ case 'mode':
+ $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
+ echo Entity::hsc($incMode);
+ break;
+ default:
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_editadmintemplateinfo()
+ * Parse skinvar editadmintemplateinfo
+ *
+ * @param string $type type of skin template
+ * @param string $description description of template
+ * @param string $name name of stemplate
+ * @param string $tabindex index number for tabindex attribute of input element
+ * @param string $big
+ * @param string $tplt
+ */
+ public function parse_editadmintemplateinfo($type, $description = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
+ {
+ global $manager;
+ $templateid = intRequestVar('templateid');
+ $templatename = Template::getNameFromId($templateid);
+ $templatedescription = Template::getDesc($templateid);
+ $template =& Template::read($templatename);
+ switch ( $type )
+ {
+ case 'id':
+ echo intval($templateid);
+ break;
+ case 'name':
+ echo Entity::hsc($templatename);
+ break;
+ case 'desc':
+ echo Entity::hsc($templatedescription);
+ break;
+ case 'extratemplate':
+ $tabidx = 600;
+ $pluginfields = array();
+ $manager->notify(
+ 'AdminTemplateExtraFields',
+ array(
+ 'fields' => &$pluginfields
+ )
+ );
+ $tmplt = array();
+ if ( $description )
+ {
+ $tmplt = Template::read($description);
+ }
+ if ( array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) && !empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
+ {
+ $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
+ }
+ else
+ {
+ $base = "</tr>\n"
+ . "<tr>\n"
+ . "\t" . '<th colspan="2"><%explugtplname%>' . "</th>\n";
+ }
+ foreach ( $pluginfields as $pfkey => $pfvalue )
+ {
+ $data = array(
+ 'explugtplname' => Entity::hsc($pfkey)
+ );
+ echo TEMPLATE::fill($base, $data);
+ foreach ( $pfvalue as $pffield => $pfdesc )
+ {
+ $this->_templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
+ }
+ }
+ break;
+ default:
+ $desc = defined($description) ? constant($description) : $description;
+ $name = defined($name) ? constant($name) : $name;
+ $this->_templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_editcomment()
+ * Parse skinvar editcomment
+ *
+ * @param string $type type of comment setting
+ * @return void
+ */
+ public function parse_editcomment($type = 'id')
+ {
+ global $manager;
+ $commentid = intRequestVar('commentid');
+ $comment = COMMENT::getComment($commentid);
+
+ $manager->notify('PrepareCommentForEdit', array('comment' => &$comment));
+
+ switch ( $type )
+ {
+ case 'id':
+ echo intRequestVar('commentid');
+ break;
+ case 'user':
+ if (array_key_exists('member', $comment) && !empty($comment['member']) )
+ {
+ echo $comment['member'] . " (" . _EDITC_MEMBER . ")";
+ }
+ else
+ {
+ echo $comment['user'] . " (" . _EDITC_NONMEMBER . ")";
+ }
+ break;
+ case 'date':
+ echo date("Y-m-d @ H:i", $comment['timestamp']);
+ break;
+ case 'body':
+ $comment['body'] = str_replace('<br />', '', $comment['body']);
+ $comment['body'] = preg_replace("#<a href=['\"]([^'\"]+)['\"]( rel=\"nofollow\")?>[^<]*</a>#", "\\1", $comment['body']);
+ echo $comment['body'];
+ default:
+ echo $comment[$type];
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_editdesturl()
+ * Parse skinvar editdesturl
+ */
+ public function parse_editdesturl()
+ {
+ if ( requestVar('desturl') )
+ {
+ echo Entity::hsc(requestVar('desturl'));
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_editmemberlist()
+ * Parse skinvar editmemberlist
+ *
+ * @param string $templateName name of template
+ * @return void
+ */
+ public function parse_editmemberlist($templateName = '')
+ {
+ global $manager;
+ // show list of members with actions
+ $query = 'SELECT * FROM '.sql_table('member');
+ $template['content'] = 'memberlist';
+ $template['tabindex'] = 10;
+
+ $batch = new Batch('member');
+ $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);
+ return;
+ }
+
+ /**
+ * AdminActions::parse_editmember()
+ * Parse skinvar editmember
+ *
+ * @param string $type type of information for member
+ * @return string $tempateName name of template to use
+ * @return void
+ */
+ public function parse_editmember($type = 'id', $templateName = '')
+ {
+ global $CONF, $manager, $member;
+ $memberid = intRequestVar('memberid');
+ $mem = MEMBER::createFromID($memberid);
+
+ switch ( $type )
+ {
+ case 'id':
+ echo intRequestVar('memberid');
+ break;
+ case 'displayname':
+ if ( $this->skintype == 'teamdelete' || $this->skintype == 'memberdelete' )
+ {
+ echo ENTITY::hsc($mem->getDisplayName(), ENT_QUOTES);
+ }
+ else
+ {
+ $dispName = ENTITY::hsc($mem->getDisplayName(), ENT_QUOTES);
+ if ( $CONF['AllowLoginEdit'] || $member->isAdmin() )
+ {
+ echo '<input name="name" tabindex="10" maxlength="32" size="32" value="' . $dispName . "\" />\n";
+ }
+ else
+ {
+ echo $dispName;
+ }
+ }
+ break;
+ case 'realname':
+ echo ENTITY::hsc($mem->getRealName(), ENT_QUOTES);
+ break;
+ case 'email':
+ echo ENTITY::hsc($mem->getEmail(), ENT_QUOTES);
+ break;
+ case 'url':
+ echo ENTITY::hsc($mem->getURL(), ENT_QUOTES);
+ break;
+ case 'admin':
+ $this->parse_inputyesno('admin', $mem->isAdmin(), 60, 1, 0, _YES, _NO, 0, $templateName);
+ break;
+ case 'canlogin':
+ $this->parse_inputyesno('canlogin', $mem->canLogin(), 70, 1, 0, _YES, _NO, $mem->isAdmin(), $templateName);
+ break;
+ case 'notes':
+ echo ENTITY::hsc($mem->getNotes(), ENT_QUOTES);
+ break;
+ case 'autosave':
+ $this->parse_inputyesno('autosave', $mem->getAutosave(), 87, 1, 0, _YES, _NO, 0, $templateName);
+ break;
+ default:
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_editpluginfo()
+ * Parse skinvar editpluginfo
+ *
+ * @param string $type type of plugin info
+ * @return void
+ */
+ public function parse_editpluginfo($type)
+ {
+ $pid = intRequestVar('plugid');
+ switch ( $type )
+ {
+ case 'id':
+ echo $pid;
+ break;
+ case 'name':
+ echo Entity::hsc(getPluginNameFromPid($pid));
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_editplugoptionslist()
+ * Parse skinvar editplugoptionslist
+ *
+ * @param string $templateName name of template
+ * @return void
+ */
+ public function parse_editplugoptionslist($templateName = '')
+ {
+ global $manager;
+
+ $pid = intRequestVar('plugid');
+ $aOptions = array();
+ $aOIDs = array();
+
+ $query = "SELECT * FROM %s WHERE ocontext='global' AND opid=%d ORDER BY oid ASC";
+ $query = sprintf($query, sql_table('plugin_option_desc'), (integer) $pid);
+ $resource = sql_query($query);
+
+ while ( $o = sql_fetch_object($resource) )
+ {
+ array_push($aOIDs, $o->oid);
+ $aOptions[$o->oid] = array(
+
+ 'oid' => $o->oid,
+ 'value' => $o->odef,
+ 'name' => $o->oname,
+ 'description' => $o->odesc,
+ 'type' => $o->otype,
+ 'typeinfo' => $o->oextra,
+ 'contextid' => 0
+ );
+ }
+
+ // fill out actual values
+ if ( count($aOIDs) > 0 )
+ {
+ $query = 'SELECT oid, ovalue FROM %s WHERE oid in (%s)';
+ $query = sprintf($query, sql_table('plugin_option'), implode(',', $aOIDs));
+
+ $result = sql_query($query);
+
+ while ( $o = sql_fetch_object($result) )
+ {
+ $aOptions[$o->oid]['value'] = $o->ovalue;
+ }
+ }
+
+ // call plugins
+ $manager->notify(
+ 'PrePluginOptionsEdit',
+ array(
+ 'context' => 'global',
+ 'plugid' => $pid,
+ 'options' => &$aOptions
+ )
+ );
+
+ $template['content'] = 'plugoptionlist';
+ $amount = Showlist($aOptions, 'table', $template, $templateName);
+ if ( $amount == 0 )
+ {
+ echo '<p>' . _ERROR_NOPLUGOPTIONS . "</p>\n";
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_editskin()
+ * Parse skinvar editskin
+ *
+ * @param string $type type of skin
+ * @return void
+ */
+ public function parse_editskin($type = 'id')
+ {
+ $skinid = intRequestVar('skinid');
+ $skin = new SKIN($skinid);
+ switch ( $type )
+ {
+ case 'id':
+ echo intRequestVar('skinid');
+ break;
+ case 'name':
+ echo Entity::hsc($skin->getName());
+ break;
+ case 'desc':
+ echo Entity::hsc($skin->getDescription());
+ break;
+ case 'type':
+ echo Entity::hsc($skin->getContentType());
+ break;
+ case 'prefix':
+ echo Entity::hsc($skin->getIncludePrefix());
+ break;
+ case 'mode':
+ $this->parse_inputyesno('inc_mode', $skin->getIncludeMode(), 120, 'skindir', 'normal', _PARSER_INCMODE_SKINDIR, _PARSER_INCMODE_NORMAL);
+ default:
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_editskintype()
+ * Parse skinvar editskintype
+ *
+ * @param string $type name of type for skin type
+ * @return void
+ */
+ public function parse_editskintype($type = 'id')
+ {
+ global $CONF, $manager, $member;
+ $skinid = intRequestVar('skinid');
+ $skin = new SKIN($skinid);
+ $fNames = SKIN::getFriendlyNames();
+ $sType = strtolower(trim(requestVar('type')));
+
+ switch ( $type )
+ {
+ case 'id':
+ echo intRequestVar('skinid');
+ break;
+ case 'name':
+ echo Entity::hsc($skin->getName());
+ break;
+ case 'desc':
+ echo Entity::hsc($skin->getDescription());
+ break;
+ case 'type':
+ echo Entity::hsc($skin->getContentType());
+ break;
+ case 'content':
+ echo Entity::hsc($skin->getContent($sType));
+ break;
+ case 'skintype':
+ $skinType = isset($fNames[$sType]) ? $fNames[$sType] : ucfirst($sType);
+ echo Entity::hsc($skinType);
+ break;
+ case 'skintyperaw':
+ echo Entity::hsc($sType);
+ break;
+ case 'prefix':
+ echo Entity::hsc($skin->getIncludePrefix());
+ break;
+ case 'mode':
+ $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
+ echo Entity::hsc($incMode);
+ break;
+ default:
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_edittemplateinfo()
+ * Parse skinvar edittemplateinfo
+ *
+ * @param string $type name of type for skin
+ * @param string $description description for skin
+ * @param string $name name of skin
+ * @param string $help
+ * @param string $tabindex index value for tabindex attribute of input element
+ * @param string $big
+ * @param string $tplt name of template
+ */
+ public function parse_edittemplateinfo($type, $description = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
+ {
+ global $manager;
+ $templateid = intRequestVar('templateid');
+ $templatename = TEMPLATE::getNameFromId($templateid);
+ $templatedescription = TEMPLATE::getDesc($templateid);
+ $template =& $manager->getTemplate($templatename);
+ switch ( $type )
+ {
+ case 'id':
+ echo intval($templateid);
+ break;
+ case 'name':
+ echo Entity::hsc($templatename);
+ break;
+ case 'desc':
+ echo Entity::hsc($templatedescription);
+ break;
+ case 'extratemplate':
+ $tabidx = 600;
+ $pluginfields = array();
+ $manager->notify(
+ 'TemplateExtraFields',
+ array(
+ 'fields' => &$pluginfields
+ )
+ );
+ $tmplt = array();
+ if ( $description )
+ {
+ $tmplt = Template::read($description);
+ }
+ if ( array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) && !empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
+ {
+ $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
+ }
+ else
+ {
+ $base = "</tr><tr>\n"
+ . "\t" . '<th colspan="2"><%explugtplname%>' . "</th>\n";
+ }
+ foreach ( $pluginfields as $pfkey => $pfvalue )
+ {
+ $data = array(
+ 'explugtplname' => Entity::hsc($pfkey)
+ );
+ echo TEMPLATE::fill($base, $data);
+ foreach ( $pfvalue as $pffield => $pfdesc )
+ {
+ $this->_templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
+ }
+ }
+ break;
+ default:
+ $desc = defined($description) ? constant($description) : $description;
+ $name = defined($name) ? constant($name) : $name;
+ $this->_templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_eventformextra()
+ * Parse skinvar eventformextra
+ *
+ * @param string $type name of type for event form extra
+ * @return void
+ */
+ public function parse_eventformextra($type = 'activation')
+ {
+ global $manager;
+ switch ( $type )
+ {
+ case 'activation':
+ $key = requestVar('ackey');
+ if ( !$key )
+ {
+ $this->objAdmin->error(_ERROR_ACTIVATE);
+ }
+ $info = MEMBER::getActivationInfo($key);
+ if ( !$info )
+ {
+ $this->objAdmin->error(_ERROR_ACTIVATE);
+ }
+ $mem = MEMBER::createFromId($info->vmember);
+ if ( !$mem )
+ {
+ $this->objAdmin->error(_ERROR_ACTIVATE);
+ }
+ $data = array(
+ 'type' => 'activation',
+ 'member' => $mem
+ );
+ break;
+ case 'membermailform-notloggedin':
+ $data = array(
+ 'type' => 'membermailform-notloggedin',
+ );
+ break;
+ }
+ $manager->notify('FormExtra', $data);
+ return;
+ }
+
+ /**
+ * Actions::parse_extrahead()
+ * Parse skinvar extrahead
+ */
+ public function parse_extrahead()
+ {
+ global $manager;
+ $extrahead = $this->objAdmin->extrahead;
+ $manager->notify(
+ 'AdminPrePageHead',
+ array(
+ 'extrahead' => &$extrahead,
+ 'action' => $this->objAdmin->action
+ )
+ );
+ echo $extrahead;
+ return;
+ }
+
+ /**
+ * AdminActions::parse_getblogsetting()
+ * Parse skinvar getblogsetting
+ */
+ public function parse_getblogsetting($which)
+ {
+ global $blog;
+
+ if ( $blog )
+ {
+ $b =& $blog;
+ }
+ elseif ( $bid = intRequestVar('blogid') )
+ {
+ global $manager;
+ $b = $manager->getBlog($bid);
+ }
+ else
+ {
+ return;
+ }
+
+ switch ( $which )
+ {
+ case 'id':
+ return ENTITY::hsc($b->getID(), ENT_QUOTES);
+ break;
+ case 'url':
+ return ENTITY::hsc($b->getURL(), ENT_QUOTES);
+ break;
+ case 'name':
+ return ENTITY::hsc($b->getName(), ENT_QUOTES);
+ break;
+ case 'desc':
+ return ENTITY::hsc($b->getDescription(), ENT_QUOTES);
+ break;
+ case 'short':
+ return ENTITY::hsc($b->getShortName(), ENT_QUOTES);
+ break;
+ case 'notifyaddress':
+ return ENTITY::hsc($b->getNotifyAddress(), ENT_QUOTES);
+ break;
+ case 'maxcomments':
+ return ENTITY::hsc($b->getMaxComments(), ENT_QUOTES);
+ break;
+ case 'updatefile':
+ return ENTITY::hsc($b->getUpdateFile(), ENT_QUOTES);
+ break;
+ case 'timeoffset':
+ return ENTITY::hsc($b->getTimeOffset(), ENT_QUOTES);
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_geteditpluginfo()
+ * Parse skinvar geteditpluginfo
+ *
+ * @param string $type name of setting for edit plugin info
+ * @return void
+ */
+ public function parse_geteditpluginfo($type)
+ {
+ $pid = intRequestVar('plugid');
+ switch ( $type )
+ {
+ case 'id':
+ return $pid;
+ break;
+ case 'name':
+ return Entity::hsc(getPluginNameFromPid($pid));
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_getmember()
+ * Parse skinvar getmember
+ * (includes a member info thingie)
+ *
+ * @param string $what name of setting for member
+ * @return void
+ */
+ public function parse_getmember($what)
+ {
+ global $memberinfo, $member;
+ // 1. only allow the member-details-page specific variables on member pages
+ if ( $this->skintype == 'member' )
+ {
+ switch ( $what )
+ {
+ case 'name':
+ return Entity::hsc($memberinfo->getDisplayName());
+ break;
+ case 'realname':
+ return Entity::hsc($memberinfo->getRealName());
+ break;
+ case 'notes':
+ return Entity::hsc($memberinfo->getNotes());
+ break;
+ case 'url':
+ return Entity::hsc($memberinfo->getURL());
+ break;
+ case 'email':
+ return Entity::hsc($memberinfo->getEmail());
+ break;
+ case 'id':
+ return Entity::hsc($memberinfo->getID());
+ break;
+ }
+ }
+ // 2. the next bunch of options is available everywhere, as long as the user is logged in
+ if ( $member->isLoggedIn() )
+ {
+ switch ( $what )
+ {
+ case 'yourname':
+ return $member->getDisplayName();
+ break;
+ case 'yourrealname':
+ return $member->getRealName();
+ break;
+ case 'yournotes':
+ return $member->getNotes();
+ break;
+ case 'yoururl':
+ return $member->getURL();
+ break;
+ case 'youremail':
+ return $member->getEmail();
+ break;
+ case 'yourid':
+ return $member->getID();
+ break;
+ }
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_headmessage()
+ * Parse skinvar headmessage
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_headmessage()
+ {
+ if ( !empty($this->objAdmin->headMess) )
+ {
+ echo '<p>' . _MESSAGE . ': ' . Entity::hsc($this->objAdmin->headMess) . "</p>\n";
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_helplink()
+ * Parse skinvar helplink
+ *
+ * @param string $topic name of topic for help
+ * @return void
+ */
+ public function parse_helplink($topic = '')
+ {
+ if ( empty($topic) )
+ {
+ return;
+ }
+ help($topic);
+ return;
+ }
+
+ /**
+ * Actions::parse_helpplugname()
+ * Parse skinvar helpplugname
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_helpplugname()
+ {
+ $plugid = intGetVar('plugid');
+ Entity::hsc(getPluginNameFromPid($plugid));
+ return;
+ }
+
+ /**
+ * Actions::parse_ilistaddnew()
+ * Parse skinvar ilistaddnew
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_ilistaddnew()
+ {
+ $blogid = intRequestVar('blogid');
+ if ( intPostVar('start') == 0 )
+ {
+ echo '<p><a href="index.php?action=createitem&blogid=' . $blogid . '">' . _ITEMLIST_ADDNEW . "</a></p>\n";
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_importskininfo()
+ * Parse skinvar importskininfo
+ *
+ * @param string $type name of information for imported skin
+ * @return void
+ */
+ public function parse_importskininfo($type)
+ {
+ switch ( $type )
+ {
+ case 'info':
+ echo Entity::hsc(requestVar('skininfo'));
+ break;
+ case 'snames':
+ $dataArr = requestArray('skinnames');
+ echo implode(' <em>' . _AND . '</em> ', $dataArr);
+ break;
+ case 'tnames':
+ $dataArr = requestArray('tpltnames');
+ echo implode(' <em>' . _AND . '</em> ', $dataArr);
+ break;
+ case 'sclashes':
+ $dataArr = requestArray('skinclashes');
+ echo implode(' <em>' . _AND . '</em> ', $dataArr);
+ break;
+ case 'tclashes':
+ $dataArr = requestArray('tpltclashes');
+ echo implode(' <em>' . _AND . '</em> ', $dataArr);
+ break;
+ case 'skinfile':
+ echo Entity::hsc(requestVar('skinfile'));
+ break;
+ case 'mode':
+ echo Entity::hsc(requestVar('mode'));
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_inputyesno()
+ * Parse skinvar inputyesno
+ *
+ * @param string $name
+ * @param string $checkedval
+ * @param string $tabindex
+ * @param string $value1
+ * @param string $value2
+ * @param string $yesval
+ * @param string $noval
+ * @param string $isAdmin
+ * @param string $templateName
+ * @return void
+ */
+ public function parse_inputyesno($name, $checkedval, $tabindex = 0, $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO, $isAdmin = 0, $templateName = '')
+ {
+ self::input_yesno($name, $checkedval, $tabindex, $value1, $value2, $yesval, $noval, $isAdmin, $templateName );
+ return;
+ }
+
+ /**
+ * Actions::parse_insertpluginfo()
+ * Parse templatevar insertpluginfo
+ */
+ public function parse_insertpluginfo($type)
+ {
+ $option = $this->objAdmin;
+ switch ( $type )
+ {
+ case 'id':
+ return $option['pid'];
+ break;
+ case 'name':
+ return Entity::hsc($option['pfile']);
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_insertpluginoptions()
+ * Parse skinvar insertpluginoptions
+ *
+ * @param string $templateName name of template
+ * @return void
+ */
+ public function parse_insertpluginoptions($templateName = '')
+ {
+ $options = $this->objAdmin->aOptions;
+ $template = array();
+ $templats = array();
+
+ if ( $templateName )
+ {
+ $templates = Template::read($templateName);
+ }
+ if (array_key_exists('INSERT_PLUGOPTION_TITLE', $templates) && !empty($templates['INSERT_PLUGOPTION_TITLE']) )
+ {
+ $template['title'] = $templates['INSERT_PLUGOPTION_TITLE'];
+ }
+ else
+ {
+ $template['title'] = '<tr><th colspan="2"><%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%></th></tr>' . "\n";
+ }
+ if ( array_key_exists('INSERT_PLUGOPTION_BODY', $templates) && !empty($templates['INSERT_PLUGOPTION_BODY']) )
+ {
+ $template['body'] = $templates['INSERT_PLUGOPTION_BODY'];
+ }
+ else
+ {
+ $template['body'] = '<tr><%listplugplugoptionrow%></tr>' . "\n";
+ }
+
+ $prevPid = -1;
+
+ foreach ( $options as $option )
+ {
+ $handler = new Actions($this->skintype, $template, $option);
+ $parser = new PARSER(Actions::getDefinedActions(), $handler);
+ // new plugin?
+ if ( $prevPid != $option['pid'] )
+ {
+ $prevPid = $option['pid'];
+ $parser->parse($template['title']);
+ }
+ $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
+ if ( @$meta['access'] != 'hidden' )
+ {
+ $parsed = $parser->parse($template['body']);
+ }
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_insplugoptcontent()
+ * Parse skinvar insplugoptcontent
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_insplugoptcontent()
+ {
+ $option = $this->objAdmin->aOption;
+
+ $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
+ if (array_key_exists('access', $meta) && $meta['access'] != 'hidden')
+ {
+ echo '<tr>';
+ listplug_plugOptionRow($option);
+ echo '</tr>';
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_iprangeinput()
+ * Parse skinvar iprangeinput
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_iprangeinput()
+ {
+ if ( requestVar('ip') )
+ {
+ $iprangeVal = Entity::hsc(requestVar('ip'));
+ echo '<input name="iprange" type="radio" value="' . $iprangeVal . '" checked="checked" id="ip_fixed" />' . "\n";
+ echo '<label for="ip_fixed">' . $iprangeVal . "</label><br />\n";
+ echo '<input name="iprange" type="radio" value="custom" id="ip_custom" />' . "\n";
+ echo '<label for="ip_custom">' . _BAN_IP_CUSTOM . '</label>' . "\n";
+ echo '<input name="customiprange" value="' . $iprangeVal . '" maxlength="15" size="15" />' . "\n";
+ }
+ else
+ {
+ echo '<input name="iprange" value="custom" type="hidden" />' . "\n";
+ echo '<input name="customiprange" value="" maxlength="15" size="15" />' . "\n";
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_itemnavlist()
+ * Parse skinvar itemnavlist
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_itemnavlist()
+ {
+ global $CONF, $manager, $member;
+ if ( $this->skintype == 'itemlist' )
+ {
+ $blogid = intRequestVar('blogid');
+ $blog =& $manager->getBlog($blogid);
+ }
+ if ( postVar('start') )
+ {
+ $start = intPostVar('start');
+ }
+ else
+ {
+ $start = 0;
+ }
+
+ // amount of items to show
+ if ( postVar('amount') )
+ {
+ $amount = intPostVar('amount');
+ }
+ else
+ {
+ $amount = intval($CONF['DefaultListSize']);
+ if ( $amount < 1 )
+ {
+ $amount = 10;
+ }
+ }
+ $query = "SELECT bshortname, cname, mname, ititle, ibody, inumber, idraft, itime"
+ . " FROM %s, %s, %s"
+ . " WHERE iblog=bnumber AND iauthor=mnumber AND icat=catid;";
+
+ $query = sprintf($query, sql_table('item'), sql_table('blog'), sql_table('member'), sql_table('category'));
+
+ if ( $this->skintype == 'itemlist' )
+ {
+ $query .= 'and iblog = ' . $blogid;
+ $template['now'] = $blog->getCorrectTime(time());
+
+ // non-blog-admins can only edit/delete their own items
+ if ( !$member->blogAdminRights($blogid) )
+ {
+ $query .= ' and iauthor = ' . $member->getID();
+ }
+ }
+ elseif ( $this->skintype == 'browseownitems' )
+ {
+ $query .= 'and iauthor = ' . $member->getID();
+ $blogid = 0;
+ $template['now'] = time();
+ }
+
+ // search through items
+ $search = postVar('search');
+
+ if ( !empty($search) )
+ {
+ $query .= ' AND ((ititle LIKE "%' . sql_real_escape_string($search) . '%") '
+ . ' OR (ibody LIKE "%' . sql_real_escape_string($search) . '%") '
+ . ' OR (imore LIKE "%' . sql_real_escape_string($search) . '%"))';
+ }
+ $query .= ' ORDER BY itime DESC'
+ . " LIMIT {$start},{$amount}";
+
+ $template['content'] = 'itemlist';
+
+ $navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $blogid, $search, 0);
+ $navList->showBatchList('item', $query, 'table', $template);
+ return;
+ }
+
+ /**
+ * Actions::parse_jstoolbaroptions()
+ * Parse skinvar jstoolbaroptions
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_jstoolbaroptions()
+ {
+ global $CONF;
+ $options = array(
+ _SETTINGS_JSTOOLBAR_NONE,
+ _SETTINGS_JSTOOLBAR_SIMPLE,
+ _SETTINGS_JSTOOLBAR_FULL
+ );
+ $i = 1;
+ foreach ( $options as $option )
+ {
+ $text = "<option value=\"%d\"%s>%s</option>\n";
+ $extra = ($CONF['DisableJsTools'] == $i) ? ' selected="selected"' : '';
+ echo sprintf($text, $i, $extra, $option);
+ $i++;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_localeselectoptions()
+ * Parse skinvar localeselectoptions
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_localeselectoptions()
+ {
+ $locales = i18n::get_available_locale_list();
+ $memid = intRequestVar('memberid');
+ if ( $memid )
+ {
+ $mem = MEMBER::createFromID($memid);
+ if ( !$mem->getLocale() || !in_array($mem->getLocale(), $locales) )
+ {
+ echo "<option value=\"\" selected=\"selected\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
+ }
+ else
+ {
+ echo "<option value=\"\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
+ }
+ }
+ else
+ {
+ if ( !i18n::get_current_locale() || !in_array(i18n::get_current_locale(), $locales) )
+ {
+ echo "<option value=\"\" selected=\"selected\">en_Latn_US</option>\n";
+ }
+ }
+ foreach ( $locales as $locale )
+ {
+ if ($memid)
+ {
+ if ( $locale == $mem->getLocale() )
+ {
+ echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
+ }
+ else
+ {
+ echo "<option value=\"{$locale}\">{$locale}</option>\n";
+ }
+ }
+ else
+ {
+ if ( $locale == i18n::get_current_locale() )
+ {
+ echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
+ }
+ else
+ {
+ echo "<option value=\"{$locale}\">{$locale}</option>\n";
+ }
+ }
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_listplugplugoptionrow()
+ * Parse templatevar listplugplugoptionrow
+ *
+ * @param string $templateName name of template
+ * @return void
+ */
+ public function parse_listplugplugoptionrow($templateName = '')
+ {
+ $option = $this->objAdmin;
+ echo listplug_plugOptionRow($option, $templateName);
+ return;
+ }
+
+ /**
+ * Actions::parse_mediadirwarning()
+ * Parse skinvar mediadirwarning
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_mediadirwarning()
+ {
+ global $DIR_MEDIA;
+ if ( !is_dir($DIR_MEDIA) )
+ {
+ echo "<br /><b>" . _WARNING_NOTADIR . "</b>\n";
+ }
+ if ( !is_readable($DIR_MEDIA) )
+ {
+ echo "<br /><b>" . _WARNING_NOTREADABLE . "</b>\n";
+ }
+ if ( !is_writeable($DIR_MEDIA) )
+ {
+ echo "<br /><b>" . _WARNING_NOTWRITABLE . "</b>\n";
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_movedistselect()
+ * Parse skinvar movedistselect
+ */
+ public function parse_movedistselect()
+ {
+ $actionType = requestVar('action');
+ switch ( $actionType )
+ {
+ case 'batchitem':
+ $this->objAdmin->selectBlogCategory('destcatid');
+ break;
+ case 'batchcategory':
+ $this->objAdmin->selectBlog('destblogid');
+ break;
+ default:
+ if ( $this->skintype == 'itemmove' )
+ {
+ $query = "SELECT icat as result FROM %s WHERE inumber=%d;";
+ $query = spriintf($query, sql_table('item'), intRequestVar('itemid'));
+ $catid = quickQuery(sprintf($query, intRequestVar('itemid')));
+ $this->objAdmin->selectBlogCategory('catid', $catid, 10, 1);
+ }
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_moveitemid()
+ * Parse skinvar moveitemid
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_moveitemid()
+ {
+ echo intRequestVar('itemid');
+ return;
+ }
+
+ /**
+ * Actions::parse_newestcompare()
+ * Parse skinvar newestcompare
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_newestcompare()
+ {
+ global $nucleus;
+ $newestVersion = getLatestVersion();
+ $newestCompare = str_replace('/', '.', $newestVersion);
+ $currentVersion = str_replace(array('/', 'v'), array('.', ''), $nucleus['version']);
+ if ( $newestVersion && version_compare($newestCompare, $currentVersion, '>') )
+ {
+ echo '<br /><a style="color:red" href="http://nucleuscms.org/upgrade.php" title="' . _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TITLE . '">';
+ echo _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TEXT . $newestVersion . '</a>';
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_newmemberselect()
+ * Parse skinvar newmemberselect
+ *
+ * @param string $templateName name of template to use
+ * @return void
+ */
+ public function parse_newmemberselect($templateName = '')
+ {
+ $blogid = intRequestVar('blogid');
+
+ $query = "SELECT tmember FROM %s WHERE tblog=%d;";
+ $query = sprintf($query, sql_table('team'), (integer) $blogid);
+ $res = sql_query($query);
+
+ $tmem = array();
+ while ( $tmember = sql_fetch_object($res) )
+ {
+ $tmem[] = intval($tmember->tmember);
+ }
+
+ $query = "SELECT mname as text, mnumber as value FROM %s WHERE mnumber NOT IN (%s);";
+ $query = sprintf($query, sql_table('member'), implode(', ', $tmem));
+
+ $template['name'] = 'memberid';
+ $template['tabindex'] = 10000;
+ Showlist($query, 'select', $template, $templateName);
+ return;
+ }
+
+ /**
+ * Actions::parse_newpluginlist()
+ * Parse skinvar newpluginlist
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_newpluginlist()
+ {
+ $candidates = $this->newPlugCandidates;
+ foreach ( $candidates as $name )
+ {
+ echo '<option value="NP_' . $name . '">' . Entity::hsc($name) . "</option>\n";
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_outputspecialdirs()
+ * Parse skinvar outputspecialdirs
+ *
+ * @param string $type type of setting for directory
+ * @return void
+ */
+ public function parse_outputspecialdirs($type)
+ {
+ switch ( $type )
+ {
+ case 'nucleusdir':
+ global $DIR_NUCLEUS;
+ echo Entity::hsc($DIR_NUCLEUS);
+ break;
+ case 'mediadir':
+ global $DIR_MEDIA;
+ echo Entity::hsc($DIR_MEDIA);
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_passrequestvars()
+ * Parse skinvar passrequestvars
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_passrequestvars()
+ {
+ $oldaction = postVar('oldaction');
+ if ( ($oldaction != 'logout')
+ && ($oldaction != 'login')
+ && $this->objAdmin->passvar
+ && !postVar('customaction') )
+ {
+ passRequestVars();
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_pluginextras()
+ * Parse skinvar pluginextras
+ *
+ * @param string $type type of plugin context
+ * @return void
+ */
+ public function parse_pluginextras($type = 'global')
+ {
+ global $manager;
+ switch ( $type )
+ {
+ case 'member':
+ $id = intRequestVar('memberid');
+ $mem = MEMBER::createFromID($id);
+ $manager->notify(
+ 'MemberSettingsFormExtras',
+ array(
+ 'member' => &$mem
+ )
+ );
+ break;
+ case 'blog':
+ $id = intRequestVar('blogid');
+ $blg = $manager->getBlog($id);
+ $manager->notify(
+ 'BlogSettingsFormExtras',
+ array(
+ 'member' => &$blg
+ )
+ );
+ break;
+ default:
+ $manager->notify(
+ 'GeneralSettingsFormExtras',
+ array(
+ )
+ );
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_pluginhelp()
+ * Parse skinvar pluginhelp
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_pluginhelp()
+ {
+ global $manager, $DIR_PLUGINS;
+ $plugid = intGetVar('plugid');
+ $plugName = getPluginNameFromPid($plugid);
+ $plug =& $manager->getPlugin($plugName);
+
+ if ( $plug->supportsFeature('HelpPage') > 0 )
+ {
+ $helpfile = $DIR_PLUGINS . $plug->getShortName() . '/help.';
+ if ( @file_exists($helpfile . 'php') )
+ {
+ @include($helpfile . 'php');
+ return;
+ }
+ elseif ( @file_exists($helpfile . 'html') )
+ {
+ @include($helpfile . 'html');
+ return;
+ }
+ }
+ echo '<p>' . _ERROR . ': ' . _ERROR_PLUGNOHELPFILE . "</p>\n";
+ echo '<p><a href="index.php?action=pluginlist">(' . _BACK . ")</a></p>\n";
+ return;
+ }
+
+ /**
+ * Actions::parse_pluginlistlist()
+ * Parse skinvar pluginlistlist
+ *
+ * @param string $templateName name of template to use
+ * @return void
+ */
+ public function parse_pluginlistlist($templateName = '')
+ {
+ $query = "SELECT * FROM %s ORDER BY porder ASC;";
+ $query = sprintf($query, sql_table('plugin'));
+ $template['content'] = 'pluginlist';
+ $template['tabindex'] = 10;
+ Showlist($query, 'table', $template, $templateName);
+ return;
+ }
+
+ /**
+ * Actions::parse_pluginoptions()
+ * Parse skinvar pluginoptions
+ *
+ * @param string $type type of plugin option
+ * @return void
+ */
+ public function parse_pluginoptions($type = 'global')
+ {
+ switch ( $type )
+ {
+ case 'member':
+ $id = intRequestVar('memberid');
+ break;
+ case 'blog':
+ $id = intRequestVar('blogid');
+ break;
+ case 'category':
+ $id = intRequestVar('catid');
+ break;
+ }
+ $this->objAdmin->_insertPluginOptions($type, $id);
+ return;
+ }
+
+ /**
+ * Actions::parse_qmenuaddselect()
+ * Parse skinvar qmanuaddselect
+ *
+ * @param string $templateName name of template to use
+ * @return void
+ */
+ public function parse_qmenuaddselect($templateName = '')
+ {
+ global $member;
+ $showAll = requestVar('showall');
+ if ( $member->isAdmin() && ($showAll == 'yes') )
+ {
+ // Super-Admins have access to all blogs! (no add item support though)
+ $query = 'SELECT bnumber as value, bname as text'
+ . ' FROM ' . sql_table('blog')
+ . ' ORDER BY bname';
+ }
+ else
+ {
+ $query = 'SELECT bnumber as value, bname as text'
+ . ' FROM ' . sql_table('blog') . ', ' . sql_table('team')
+ . ' WHERE tblog=bnumber and tmember=' . $member->getID()
+ . ' ORDER BY bname';
+ }
+ $template['name'] = 'blogid';
+ $template['tabindex'] = 15000;
+ $template['extra'] = _QMENU_ADD_SELECT;
+ $template['selected'] = -1;
+ $template['shorten'] = 10;
+ $template['shortenel'] = '';
+ $template['javascript'] = 'onchange="return form.submit()"';
+ Showlist($query, 'select', $template, $templateName);
+ return;
+ }
+
+ /**
+ * Actions::parse_quickmenu()
+ * Parse skinvar quickmenu
+ *
+ * @param string $templateName name of template to use
+ * @return void
+ */
+ public function parse_quickmenu($templateName = '')
+ {
+ global $manager;
+ $templates = array();
+ $template = array();
+ if ( !empty($templateName) )
+ {
+ $templates = Template::read($templateName);
+ }
+ $pluginExtras = array();
+ $manager->notify(
+ 'QuickMenu',
+ array(
+ 'options' => &$pluginExtras
+ )
+ );
+ if ( count($pluginExtras) > 0 )
+ {
+ if ( array_key_exists('PLUGIN_QUICKMENU_TITLE', $templates) || !empty($templates['PLUGIN_QUICKMENU_TITLE']) )
+ {
+ $template['title'] = $templates['PLUGIN_QUICKMENU_TITLE'];
+ }
+ else
+ {
+ $template['title'] = '<h2><%text(_QMENU_PLUGINS)%></h2>';
+ }
+ $handler = new Actions($this->skintype, $template, $this->objAdmin);
+ $parser = new PARSER(Actions::getDefinedActions(), $handler);
+ $parser->parse($template['title']);
+
+ if ( array_key_exists('PLUGIN_QUICKMENU_HEAD', $templates) || !empty($templates['PLUGIN_QUICKMENU_HEAD']) )
+ {
+ $template['head'] = $templates['PLUGIN_QUICKMENU_HEAD'];
+ }
+ else
+ {
+ $template['head'] = '<ul>';
+ }
+
+ echo $template['head'];
+
+ if ( array_key_exists('PLUGIN_QUICKMENU_BODY', $templates) || !empty($templates['PLUGIN_QUICKMENU_BODY']) )
+ {
+ $template['body'] = $templates['PLUGIN_QUICKMENU_BODY'];
+ }
+ else
+ {
+ $template['body'] = '<li><a href="<%plugadminurl%>" title="<%plugadmintooltip%>"><%plugadmintitle%></a></li>';
+ }
+
+ foreach ( $pluginExtras as $aInfo )
+ {
+ $data = array(
+ 'plugadminurl' => Entity::hsc($aInfo['url']),
+ 'plugadmintooltip' => Entity::hsc($aInfo['tooltip']),
+ 'plugadmintitle' => Entity::hsc($aInfo['title']),
+ );
+ echo TEMPLATE::fill($template['body'], $data);
+ }
+ if ( array_key_exists('PLUGIN_QUICKMENU_FOOT', $templates) || !empty($templates['PLUGIN_QUICKMENU_FOOT']) )
+ {
+ $template['foot'] = $templates['PLUGIN_QUICKMENU_FOOT'];
+ }
+ else
+ {
+ $template['foot'] = '</ul>';
+ }
+ echo $template['foot'];
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_requestblogid()
+ * Parse skinvar requestblogid
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_requestblogid()
+ {
+ echo intRequestVar('blogid');
+ return;
+ }
+
+ /**
+ * Actions::parse_requestiprange()
+ * Parse skinvar requestiprange
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_requestiprange()
+ {
+ if ( requestVar('iprange') )
+ {
+ echo Entity::hsc(requestVar('iprange'));
+ }
+ elseif ( requestVar('ip') )
+ {
+ echo Entity::hsc(requestVar('ip'));
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_selectlocaladminskinfiles()
+ * Parse skinvar selectlocaladminskinfiles
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_selectlocaladminskinfiles()
+ {
+ global $DIR_ADMINSKINS, $manager;
+ $candidates = SkinImport::searchForCandidates($DIR_ADMINSKINS);
+ foreach ( $candidates as $skinname => $skinfile )
+ {
+ $html = Entit::hsc($skinfile);
+ echo '<option value="' . $html . '">' . $skinname . "</option>\n";
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_selectlocalskinfiles()
+ * Parse skinvar selectlocalskinfiles
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_selectlocalskinfiles()
+ {
+ global $DIR_SKINS;
+ $candidates = SkinImport::searchForCandidates($DIR_SKINS);
+ foreach ( $candidates as $skinname => $skinfile )
+ {
+ $html = Entity::hsc($skinfile);
+ echo '<option value="' . $html . '">' . $skinname . "</option>\n";
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_skineditallowedlist()
+ * Parse skinvar skineditallowedlist
+ *
+ * @param string $type type of skin
+ * @param string $templateName name of template
+ * @return void
+ */
+ public function parse_skineditallowedlist($type, $templateName = '')
+ {
+ switch ( $type )
+ {
+ case 'blog':
+ $query = "SELECT bshortname, bname FROM %s";
+ $show = array(
+ 'content' => 'shortblognames'
+ );
+ $query = sprintf($query, sql_table('blog'));
+ Showlist($query, 'table', $show, $templateName);
+ break;
+ case 'template':
+ $query = "SELECT tdname as name, tddesc as description FROM %s";
+ $show = array(
+ 'content' => 'shortnames'
+ );
+ $query = sprintf($query, sql_table('template_desc'));
+ Showlist($query, 'table', $show, $templateName);
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_skinfile()
+ * Inserts an url relative to the skindir (useful when doing import/export)
+ *
+ * e.g. <skinfile(default/myfile.sth)>
+ *
+ * @param string $filename file name for skin
+ * @return void
+ */
+ public function parse_skinfile($filename)
+ {
+ /*
+ * TODO: we should decide to use different directory or default $DIR_SKINS
+ $base = NP_SkinableAdmin::getAdminSkinURL();
+ $pref = PARSER::getProperty('IncludePrefix');
+ echo $base . $pref . $filename;
+ */
+ $pref = PARSER::getProperty('IncludePrefix');
+ echo $pref . $filename;
+ return;
+ }
+
+ /**
+ * Actions::parse_skinielist()
+ * Parse skinvar skinielist
+ *
+ * @param string $type type of skin
+ * @param string $templateName name of template to use
+ * @return void
+ */
+ public function parse_skinielist($type, $templateName = '')
+ {
+ $templates = array();
+ if ( $templateName )
+ {
+ $templates = Template::read($templateName);
+ }
+ if ( array_key_exists('SKINIE_EXPORT_LIST', $templates) && !empty($templates['SKINIE_EXPORT_LIST']) )
+ {
+ $template = $templates['SKINIE_EXPORT_LIST'];
+ }
+ else
+ {
+ $template = '<td><input type="checkbox" name="<%typeid%>" id="<%expid%>" /><label for="<%expid%>"><%expname%></label></td>' . "\n"
+ . "<td><%expdesc%></td>\n"
+ . "</tr><tr>\n";
+ }
+ switch ( $type )
+ {
+ case 'skin':
+ $res = sql_query('SELECT * FROM ' . sql_table('skin_desc'));
+ while ( $skinObj = sql_fetch_object($res) )
+ {
+ $data = array(
+ 'typeid' => 'skin[' . $skinObj->sdnumber . ']',
+ 'expid' => 'skinexp' . $skinObj->sdnumber,
+ 'expname' => Entity::hsc($skinObj->sdname),
+ 'expdesc' => Entity::hsc($skinObj->sddesc),
+ );
+ echo TEMPLATE::fill($template, $data);
+ }
+ break;
+ case 'template':
+ $res = sql_query('SELECT * FROM '.sql_table('template_desc'));
+ while ($templateObj = sql_fetch_object($res)) {
+ $data = array(
+ 'typeid' => 'template[' . $templateObj->tdnumber . ']',
+ 'expid' => 'templateexp' . $templateObj->tdnumber,
+ 'expname' => Entity::hsc($templateObj->tdname),
+ 'expdesc' => Entity::hsc($templateObj->tddesc),
+ );
+ echo TEMPLATE::fill($template, $data);
+ }
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_skinoverview()
+ * Parse skinvar skinoverview
+ *
+ * @param string $templateName name of template to use
+ * @return void
+ */
+ public function parse_skinoverview($templateName = '')
+ {
+ $query = "SELECT * FROM %s ORDER BY sdname";
+ $query = sprintf($query, sql_table('skin_desc'));
+
+ $template['content'] = 'skinlist';
+ $template['tabindex'] = 10;
+
+ Showlist($query, 'table', $template, $templateName);
+ return;
+ }
+
+ /**
+ * Actions::parse_skintypehelp()
+ * Check editing skintypehelp
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_skintypehelp()
+ {
+ $nowSkinType = strtolower(trim(requestVar('type')));
+ $regularType = array(
+ 'index',
+ 'item',
+ 'archivelist',
+ 'archive',
+ 'search',
+ 'error',
+ 'member',
+ 'imagepopup'
+ );
+
+ if ( in_array($nowSkinType, $regularType) )
+ {
+ help('skinpart' . $nowSkinType);
+ }
+ else
+ {
+ help('skinpartspecial');
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_specialskinlist()
+ * Parse skinvar specialskinlist
+ *
+ * @param string $templateName name of template to use
+ * @return void
+ */
+ public function parse_specialskinlist($templateName = '')
+ {
+ $templates = array();
+ if ( $templateName )
+ {
+ $templates = Template::read($templateName);
+ }
+ $nType = array(
+ 'index',
+ 'item',
+ 'error',
+ 'search',
+ 'archive',
+ 'archivelist',
+ 'imagepopup',
+ 'member'
+ );
+ $skinid = intRequestVar('skinid');
+ $query = "SELECT stype FROM %s WHERE stype NOT IN ('%s') AND sdesc = %d;";
+ $query = sprintf($query, sql_table('skin'), implode("', '", $nType), $skinid);
+
+ $res = sql_query($query);
+ if ( $res && sql_num_rows($res) > 0 )
+ {
+ $data = array();
+ if ( array_key_exists('SPECIALSKINLIST_HEAD', $templates) && !empty($templates['SPECIALSKINLIST_HEAD']) )
+ {
+ $template['head'] = $templates['SPECIALSKINLIST_HEAD'];
+ }
+ else
+ {
+ $template['head'] = "<ul>\n";
+ }
+ echo TEMPLATE::fill($template['head'], $data);
+ if ( array_key_exists('SPECIALSKINLIST_BODY', $templates) && !empty($templates['SPECIALSKINLIST_BODY']) )
+ {
+ $template['body'] = $templates['SPECIALSKINLIST_BODY'];
+ }
+ else
+ {
+ $template['body'] = '<li><a tabindex="<%tabindex%>" href="index.php?action=skinedittype&skinid=<%skinid%>'
+ . '&type=<%skintype%>"><%skintype%></a> (<a tabindex="<%tabindex%>" href="index.php?'
+ . 'action=skinremovetype&skinid=<%skinid%>&type=<%skintype%>">remove</a>)</li>';
+ }
+ $tabstart = 75;
+ while ( $row = sql_fetch_assoc($res) )
+ {
+ $data = array(
+ 'tabindex' => $tabstart++,
+ 'skinid' => $skinid,
+ 'skintype' => Entity::hsc(strtolower($row['stype']))
+ );
+ echo TEMPLATE::fill($template['body'], $data);
+ }
+ $data = array();
+ if (array_key_exists('SPECIALSKINLIST_FOOT', $templates) && !empty($templates['SPECIALSKINLIST_FOOT']) )
+ {
+ $template['foot'] = $templates['SPECIALSKINLIST_FOOT'];
+ }
+ else
+ {
+ $template['foot'] = "</ul>\n";
+ }
+ echo TEMPLATE::fill($template['foot'], $data);
+ return;
+ }
+ }
+
+ /**
+ * Actions::parse_sprinttext()
+ * Parse sprinttext
+ *
+ * @param string $which
+ * @param string $val
+ * @return void
+ */
+ public function parse_sprinttext($which, $val)
+ {
+ if ( !defined($which) )
+ {
+ $base = $which;
+ }
+ else
+ {
+ $base = constant($which);
+ }
+
+ if ( preg_match('#[^<|%].*[^%|>]#', $val, $matchies) )
+ {
+ if ( !preg_match('#[(].*[^)]#', $matchies[0], $args) )
+ {
+ $met = 'parse_' . $matchies[0];
+ }
+ else
+ {
+ $arg = trim($args[0], '()');
+ $met = 'parse_' . substr($matchies[0], 0, strpos($matchies[0], '('));
+ }
+
+ if ( method_exists($this, $met) )
+ {
+ $value = call_user_func(array(&$this, $met), $arg);
+ }
+ }
+
+ if ( !isset($value) || empty($value) )
+ {
+ $value = $val;
+ }
+ echo sprintf($base, $value);
+ return;
+ }
+
+ /**
+ * Actions::parse_systemsettings()
+ * Parse skinvar systemsettings
+ *
+ * @param string $type type of settings for system
+ * @param string $templateName name of template to use
+ * @return void
+ */
+ public function parse_systemsettings($type = 'phpinfo', $templateName = '')
+ {
+ global $member, $CONF, $nucleus;
+
+ $member->isAdmin() or $this->objAdmin->disallow();
+
+ $enable = _ADMIN_SYSTEMOVERVIEW_ENABLE;
+ $disable = _ADMIN_SYSTEMOVERVIEW_DISABLE;
+
+ switch ( $type )
+ {
+ case 'phpversion':
+ echo phpversion();
+ break;
+ case 'sqlserverinfo':
+ echo sql_get_server_info();
+ break;
+ case 'sqlclientinfo':
+ echo sql_get_client_info();
+ break;
+ case 'magicquotesgpc':
+ echo ini_get('magic_quotes_gpc') ? 'On' : 'Off';
+ break;
+ case 'magicquotesruntime':
+ echo ini_get('magic_quotes_runtime') ? 'On' : 'Off';
+ break;
+ case 'registerglobals':
+ echo ini_get('register_globals') ? 'On' : 'Off';
+ break;
+ case 'gdinfo':
+ $templates = array();
+ if ( $templateName )
+ {
+ $templates = Template::read($templateName);
+ }
+ if ( array_key_exists('SYSTEMINFO_GDSETTINGS', $templates) && !empty($templates['SYSTEMINFO_GDSETTINGS']) )
+ {
+ $template = $templates['SYSTEMINFO_GDSETTINGS'];
+ }
+ else
+ {
+ $template = "<tr>\n\t\t" . '<td width="50%">' . "<%key%></td><td><%value%></td>\n</tr>\n";
+ }
+
+ $gdinfo = gd_info();
+
+ foreach ( $gdinfo as $key => $value )
+ {
+ if ( is_bool($value) )
+ {
+ $value = $value ? $enable : $disable;
+ }
+ else
+ {
+ $value = Entity::hsc($value);
+ }
+ $data = array(
+ 'key' => $key,
+ 'value' => $value,
+ );
+ echo TEMPLATE::fill($template, $data);
+ }
+ break;
+ case 'modrewrite':
+ ob_start();
+ phpinfo(INFO_MODULES);
+ $im = ob_get_contents();
+ ob_end_clean();
+ echo (strstr($im, 'mod_rewrite') != '') ? $enable : $disable;
+ break;
+ case 'nucleusversion':
+ echo getNucleusVersion() / 100 . '(' . $nucleus['version'] . ')';
+ break;
+ case 'nucleuspatchlevel':
+ echo getNucleusPatchLevel();
+ break;
+ case 'confself':
+ echo $CONF['Self'];
+ break;
+ case 'confitemurl':
+ echo $CONF['ItemURL'];
+ break;
+ case 'alertonheaderssent':
+ echo $CONF['alertOnHeadersSent'] ? $enable : $disable;
+ break;
+ case 'nucleuscodename':
+ if ( $nucleus['codename'] != '' )
+ {
+ echo ' "' . $nucleus['codename'] . '"';
+ }
+ break;
+ case 'versioncheckurl':
+ echo sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
+ break;
+ }
+ return;
+ }
+
+ /**
+ * Actions::parse_templateoverview()
+ * Parse skinvar templateoverview
+ *
+ * @param string $templateName name of template to use
+ * @return void
+ */
+ public function parse_templateoverview($templateName = '')
+ {
+ $query = "SELECT * FROM %s ORDER BY tdname";
+ $query = sprintf($query, sql_table('template_desc'));
+ $template['content'] = 'templatelist';
+ $template['tabindex'] = 10;
+ Showlist($query, 'table', $template, $templateName);
+ return;
+ }
+
+ /**
+ * AdminActions::parse_ticket()
+ * Parse ticket
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_ticket()
+ {
+ global $manager;
+ $manager->addTicketHidden();
+ return;
+ }
+
+ /**
+ * Actions::parse_versioncheckurl()
+ * Parse skinvar versioncheckurl
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_versioncheckurl()
+ {
+ echo sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
+ return;
+ }
+
+ /**
+ * Actions::parse_yrbloglist()
+ * Parse skinvar yrbloglist
+ *
+ * @param string $templateName name of template to use
+ * @return void
+ */
+ public function parse_yrbloglist($templateName = '')
+ {
+ global $member;
+ $showAll = requestVar('showall');
+
+ if ( $member->isAdmin() && ($showAll == 'yes') )
+ {
+ // Super-Admins have access to all blogs! (no add item support though)
+ $query = "SELECT bnumber, bname, 1 as tadmin, burl, bshortname"
+ . " FROM %s"
+ . " ORDER BY bnumber";
+ $query = sprintf($query, sql_table('blog'));
+ }
+ else
+ {
+ $query = "SELECT bnumber, bname, tadmin, burl, bshortname"
+ . " FROM %s,%s"
+ . " WHERE tblog=bnumber and tmember=%d"
+ . " ORDER BY bnumber";
+ $query = sprintf($query, sql_table('blog'), sql_table('team'), (integer) $member->getID());
+ }
+
+ $template['content'] = 'bloglist';
+ $template['superadmin'] = $member->isAdmin();
+
+ $amount = Showlist($query, 'table', $template, $templateName);
+
+ if ( ($showAll != 'yes') && ($member->isAdmin()) )
+ {
+ $query = 'SELECT COUNT(*) as result FROM ' . sql_table('blog');
+
+ $total = quickQuery($query);
+ if ( $total > $amount )
+ {
+ echo '<p><a href="index.php?action=overview&showall=yes">' . _OVERVIEW_SHOWALL . '</a></p>';
+ }
+ }
+
+ if ( $amount == 0 )
+ {
+ echo _OVERVIEW_NOBLOGS;
+ }
+ elseif( $amount != 0 )
+ {
+ echo '<h2>' . _OVERVIEW_YRDRAFTS . '</h2>';
+
+ $query = "SELECT ititle, inumber, bshortname"
+ . " FROM %s,%s"
+ . ' WHERE iauthor=%d AND iblog=bnumber AND idraft=1';
+ $query = sprintf($query. sql_table('item'), sql_table('blog'), (integer) $member->getID());
+
+ $template['content'] = 'draftlist';
+
+ $amountdrafts = Showlist($query, 'table', $template, $templateName);
+ if ( $amountdrafts == 0 )
+ {
+ echo _OVERVIEW_NODRAFTS;
+ }
+ }
+ return;
+ }
+
+ /**
+ * Actions::customHelp()
+ * shows a link to custom help file
+ *
+ * @param integer $id
+ * @param string $tplName
+ * @param string $url
+ * @param string $iconURL
+ * @param string $alt
+ * @param string $title
+ * @param $onclick
+ *
+ */
+ private function customHelp($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
+ {
+ echo self::customHelpHtml($id, $tplName, $url, $iconURL, $alt, $title, $onclick);
+ }
+
+ /**
+ * Actions::customHelpHtml()
+ *
+ * @param integer $id
+ * @param string $tplName
+ * @param string $url
+ * @param string $iconURL
+ * @param string $alt
+ * @param string $title
+ * @param string $onclick
+ * @return string anchor element with help uri
+ */
+ private function customHelpHtml($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
+ {
+ $templates = array();
+ if ( $tplName )
+ {
+ $templates = Template::read($tplName);
+ }
+ if ( array_key_exists('ADMIN_CUSTOMHELPLINK_ICON', $templates) && !empty($templates['ADMIN_CUSTOMHELPLINK_ICON']) )
+ {
+ $template = $templates['ADMIN_CUSTOMHELPLINK_ICON'];
+ }
+ else
+ {
+ $template = '<img src="<%iconurl%>" <%width%><%height%>alt="<%alt%>" title="<%title%>" /></a>';
+ }
+
+ if ( empty($iconURL) )
+ {
+ global $CONF;
+ $iconURL = $CONF['AdminURL'] . 'documentation/icon-help.gif';
+ }
+ if ( function_exists('getimagesize') )
+ {
+ $size = getimagesize($iconURL);
+ $width = 'width="' . $size[0] . '" ';
+ $height = 'height="' . $size[1] . '" ';
+ }
+ $data = array(
+ 'iconurl' => $iconURL,
+ 'width' => $width,
+ 'height' => $height,
+ 'alt' => (isset($alt) && !empty($alt)) ? $alt : _HELP_TT,
+ 'title' => (isset($title) && !empty($title)) ? $title : _HELP_TT,
+ );
+ $icon = TEMPLATE::fill($template, $data);
+ $help = self::customHelplink($id, $tplName, $url, $title, $onclick);
+ return $help . $icon;
+ }
+
+ /**
+ * Actions::input_yesno
+ *
+ * @param $name
+ * @param $checkedval
+ * @param $tabindex
+ * @param $value1
+ * @param $value2
+ * @param $yesval
+ * @param $noval
+ * @param $isAdmin
+ * @param $templateName
+ * @param $showlist
+ */
+ private function input_yesno($name,
+ $checkedval,
+ $tabindex = 0,
+ $value1 = 1,
+ $value2 = 0,
+ $yesval = _YES,
+ $noval = _NO,
+ $isAdmin = 0,
+ $templateName = '',
+ $showlist = false)
+ {
+ $templates = array();
+ if ( $templateName )
+ {
+ $templates = Template::read($templateName);
+ }
+
+ if ( $name == 'admin' )
+ {
+ if ( array_key_exists('INPUTYESNO_TEMPLATE_ADMIN', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_ADMIN']) )
+ {
+ $template = $templates['INPUTYESNO_TEMPLATE_ADMIN'];
+ }
+ else
+ {
+ $template = '<input onclick="selectCanLogin(true);" type="radio" name="<%name%>" value="<%yesval%>" <%yescheckedval%> id="<%yesid%>" />' . "\n"
+ . '<label for="<%yesid%>"><%yesvaltext%></label>' . "\n"
+ . '<input onclick="selectCanLogin(false);" type="radio" name="<%name%>" value="<%noval%>" <%nocheckedval%> id="<%noid%>"<%disabled%> />' . "\n"
+ . '<label for="<%noid%>"><%novaltext%></label>' . "\n";
+ }
+ }
+ else
+ {
+ if ( array_key_exists('INPUTYESNO_TEMPLATE_NORMAL', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_NORMAL']) )
+ {
+ $template = $templates['INPUTYESNO_TEMPLATE_NORMAL'];
+ }
+ if ( $showlist )
+ {
+ if ( array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO', $templates) && !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO']) )
+ {
+ $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO'];
+ }
+ }
+ if ( !isset($template) )
+ {
+ $template = '<input type="radio" name="<%name%>" value="<%yesval%>" <%yescheckedval%> id="<%yesid%>" />' . "\n"
+ . '<label for="<%yesid%>"><%yesvaltext%></label>' . "\n"
+ . '<input type="radio" name="<%name%>" value="<%noval%>" <%nocheckedval%> id="<%noid%>"<%disabled%> />' . "\n"
+ . '<label for="<%noid%>"><%novaltext%></label>' . "\n";
+ }
+ }
+
+ //echo $template;
+ $id = Entity::hsc($name);
+ $id = str_replace('[', '-', $id);
+ $id = str_replace(']', '-', $id);
+ $id1 = $id . Entity::hsc($value1);
+ $id2 = $id . Entity::hsc($value2);
+ $dat = array(
+ 'name' => Entity::hsc($name),
+ 'yesval' => Entity::hsc($value1),
+ 'noval' => Entity::hsc($value2),
+ 'yesid' => $id1,
+ 'noid' => $id2,
+ 'yesvaltext' => $yesval,
+ 'novaltext' => $noval,
+ 'yescheckedval' => ($checkedval == $value1) ? ' checked="checked" tabindex="' . $tabindex . '"': '',
+ 'nocheckedval' => ($checkedval != $value1) ? ' checked="checked" tabindex="' . $tabindex . '"': '',
+ 'disabled' => ($isAdmin && $name == 'canlogin') ? ' disabled="disabled"' : '',
+ );
+
+ if ( $showlist )
+ {
+ return Template::fill($template, $dat);
+ }
+ else
+ {
+ echo TEMPLATE::fill($template, $dat);
+ }
+ return;
+ }
+
+ /**
+ * AdminActions::parse_text()
+ * Parse text
+ *
+ * FIXME: is this really needed?
+ *
+ * @param string $which constant vallue
+ * @return void
+ */
+ public function parse_text($which)
+ {
+ if ( defined($which) )
+ {
+ echo constant($which);
+ }
+ return;
+ }
+
+}
\ No newline at end of file