From: sakamocchi Date: Thu, 5 Apr 2012 23:53:21 +0000 (+0900) Subject: 追加で、ActionsクラスにskinnableActonsクラスのメソッドの大部分を移植。 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=b4bc29ae0bdee36c84a84f807353afeabc2a94cc;p=nucleus-jp%2Fnucleus-next.git 追加で、ActionsクラスにskinnableActonsクラスのメソッドの大部分を移植。 まだすべて移植し終えてない。 --- diff --git a/nucleus/libs/ACTIONS.php b/nucleus/libs/ACTIONS.php index eb83203..f4ea58f 100644 --- a/nucleus/libs/ACTIONS.php +++ b/nucleus/libs/ACTIONS.php @@ -3303,4 +3303,1548 @@ class Actions extends BaseActions return; } -} \ No newline at end of file + /** + * 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 skinableNAVLIST($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 + */ + 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 = skinableTEMPLATE::read($templateName); + } + + $types = skinableSKIN::getAdminskinDefaultTypeFriendlyNames(); + ksort($types); + + if ( array_key_exists('ADMINSKINTYPELIST_HEAD', $templates) && !empty($templates['ADMINSKINTYPELIST_HEAD']) ) + { + $template['head'] = $templates['ADMINSKINTYPELIST_HEAD']; + } + else + { + $template['head'] = "\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; + skinableShowlist($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; + skinableShowlist($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; + skinableShowlist($query, 'select', $template, $templateName); + 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 skinableSKIN($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 skinableSKIN($skinid); + $fNames = skinableSKIN::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 + */ + function parse_editadmintemplateinfo($type, $description = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '') + { + global $manager; + $templateid = intRequestVar('templateid'); + $templatename = skinableTEMPLATE::getNameFromId($templateid); + $templatedescription = skinableTEMPLATE::getDesc($templateid); + $template =& skinableTEMPLATE::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 = skinableTEMPLATE::read($description); + } + if ( array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) && !empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) ) + { + $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME']; + } + else + { + $base = "\n" + . "\n" + . "\t" . '<%explugtplname%>' . "\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('
', '', $comment['body']); + $comment['body'] = preg_replace("#[^<]*#", "\\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 skinableBATCH('member'); + $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName); + 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 skinableBATCH('member'); + $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName); + 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 = skinableShowlist($aOptions, 'table', $template, $templateName); + if ( $amount == 0 ) + { + echo '

' . _ERROR_NOPLUGOPTIONS . "

\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 + */ + 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 = skinableTEMPLATE::read($description); + } + if ( array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) && !empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) ) + { + $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME']; + } + else + { + $base = "\n" + . "\t" . '<%explugtplname%>' . "\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; + } + + /** + * Actions::parse_blogsetting() + * Parse skinvar blogsetting + * + * @param string $which name of setting for blog + * @return void + */ + public function parse_blogsetting($which) + { + echo $this->parse_getblogsetting($which); + 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_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 '

' . _MESSAGE . ': ' . Entity::hsc($this->objAdmin->headMess) . "

\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 '

' . _ITEMLIST_ADDNEW . "

\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(' ' . _AND . ' ', $dataArr); + break; + case 'tnames': + $dataArr = requestArray('tpltnames'); + echo implode(' ' . _AND . ' ', $dataArr); + break; + case 'sclashes': + $dataArr = requestArray('skinclashes'); + echo implode(' ' . _AND . ' ', $dataArr); + break; + case 'tclashes': + $dataArr = requestArray('tpltclashes'); + echo implode(' ' . _AND . ' ', $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 = skinableTEMPLATE::read($templateName); + } + if (array_key_exists('INSERT_PLUGOPTION_TITLE', $templates) && !empty($templates['INSERT_PLUGOPTION_TITLE']) ) + { + $template['title'] = $templates['INSERT_PLUGOPTION_TITLE']; + } + else + { + $template['title'] = '<%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%>' . "\n"; + } + if ( array_key_exists('INSERT_PLUGOPTION_BODY', $templates) && !empty($templates['INSERT_PLUGOPTION_BODY']) ) + { + $template['body'] = $templates['INSERT_PLUGOPTION_BODY']; + } + else + { + $template['body'] = '<%listplugplugoptionrow%>' . "\n"; + } + + $prevPid = -1; + + foreach ( $options as $option ) + { + $handler = new skinableACTIONS($this->skintype, $template, $option); + $parser = new PARSER(skinableACTIONS::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 ''; + skinableListplug_plugOptionRow($option); + echo ''; + } + return; + } + + /** + * Actions::parse_iprangeinput() + * Parse skinvar iprangeinput + * + * @param void + * @return void + */ + function parse_iprangeinput() + { + if ( requestVar('ip') ) + { + $iprangeVal = Entity::hsc(requestVar('ip')); + echo '' . "\n"; + echo '
\n"; + echo '' . "\n"; + echo '' . "\n"; + echo '' . "\n"; + } + else + { + echo '' . "\n"; + echo '' . "\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 skinableNAVLIST($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 = "\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 "\n"; + } + else + { + echo "\n"; + } + } + else + { + if ( !i18n::get_current_locale() || !in_array(i18n::get_current_locale(), $locales) ) + { + echo "\n"; + } + } + foreach ( $locales as $locale ) + { + if ($memid) + { + if ( $locale == $mem->getLocale() ) + { + echo "\n"; + } + else + { + echo "\n"; + } + } + else + { + if ( $locale == i18n::get_current_locale() ) + { + echo "\n"; + } + else + { + echo "\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 skinableListplug_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 "
" . _WARNING_NOTADIR . "\n"; + } + if ( !is_readable($DIR_MEDIA) ) + { + echo "
" . _WARNING_NOTREADABLE . "\n"; + } + if ( !is_writeable($DIR_MEDIA) ) + { + echo "
" . _WARNING_NOTWRITABLE . "\n"; + } + return; + } + + /** + * Actions::parse_movedistselect() + * Parse skinvar movedistselect + */ + 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; + } +}