X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=nucleus%2Flibs%2FAdminActions.php;h=7651600069a2ca57850b5631cfc75f048006e451;hb=e77937313dbcaf91fdc737515a0f0949712934c0;hp=1182503f17b448c075c694b05b4b4e5ef7acebb2;hpb=c7521604402334c0e0cb6e6ce10d169ab1736f03;p=nucleus-jp%2Fnucleus-next.git diff --git a/nucleus/libs/AdminActions.php b/nucleus/libs/AdminActions.php index 1182503..7651600 100644 --- a/nucleus/libs/AdminActions.php +++ b/nucleus/libs/AdminActions.php @@ -9,123 +9,12 @@ class AdminActions extends BaseActions { private $skintype; - /* NOTE: list of whole available action names for tags - 'actionloglist', - 'activationmessage', - 'addtickettourl', - 'adminbanlist', - 'adminbatchaction', - 'adminbatchlist', - 'adminbloglink', - 'adminerrormesg', - 'adminskineditallowedlist', - 'adminskinielist', - 'adminskinoverview', - 'adminskinselectoptions', - 'adminspecialskinlist', - 'admintemplateoverview', - 'allowedadminskinactions', - 'allowedskinactions', - 'banlistdeletedlist', - 'batchdeletelist', - 'batchdeletetype', - 'batchmovebtn', - 'batchmovelist', - 'batchmovetitle', - 'batchmovetype', - 'blogcatlist', - 'blognotifysetting', - 'blogsetting', - 'blogsettingyesno', - 'blogteamlist', - 'blogteammembers', - 'blogtime', - 'bookmarkletadmin', - 'category', - 'categorysetting', - 'codename', - 'commentnavlist', - 'configsettingsedit', - 'configsettingsyesno', - 'customhelplink', - 'date', - 'defaultadminskintypes', - 'defblogselect', - 'defcatselect', - 'defskinselect', - 'deletecomment', - 'deleteitembody', - 'deleteitemid', - 'deleteitemtitle', - 'editadminskin', - 'editadminskintype', - 'editadmintemplateinfo', - 'editcomment', - 'editdesturl', - 'editmember', - 'editmemberlist', - 'editpluginfo', - 'editplugoptionslist', - 'editskin', - 'editskintype', - 'edittemplateinfo', - 'eventformextra', - 'extrahead', - 'getblogsetting', - 'geteditpluginfo', - 'getmember', - 'headmessage', - 'helplink', - 'helpplugname', - 'ilistaddnew', - 'importskininfo', - 'inputyesno', - 'insertpluginfo', - 'insplugoptcontent', - 'iprangeinput', - 'itemnavlist', - 'jstoolbaroptions', - 'listplugplugoptionrow', - 'localeselectoptions', - 'mediadirwarning', - 'movedistselect', - 'moveitemid', - 'newestcompare', - 'newmemberselect', - 'newpluginlist', - 'outputspecialdirs', - 'passrequestvars', - 'pluginextras', - 'pluginhelp', - 'pluginlistlist', - 'pluginoptions', - 'qmenuaddselect', - 'quickmenu', - 'requestblogid', - 'requestiprange', - 'selectlocaladminskinfiles', - 'selectlocalskinfiles', - 'skineditallowedlist', - 'skinfile', - 'skinielist', - 'skinoverview', - 'skintypehelp', - 'specialskinlist', - 'sprinttext', - 'systemsettings', - 'templateoverview', - 'text', - 'ticket', - 'versioncheckurl', - 'yrbloglist' - ); - */ - /** * AdminActions::$default_actions * list of whole action names with which this class can deal */ static private $default_actions = array( + 'actionurl', 'addtickettourl', 'adminurl', 'codename', @@ -167,7 +56,7 @@ class AdminActions extends BaseActions 'adminskinremovetype' => _ADM_SKPRT_ADMINSKINREMOVETYPE, 'admintemplatedelete' => _ADM_SKPRT_ADMINTEMPLATEDELETE, 'admintemplateedit' => _ADM_SKPRT_ADMINTEMPLATEEDIT, - 'admntemplateoverview' => _ADM_SKPRT_ADMINTEMPLATEOVERVIEW, + 'admintemplateoverview' => _ADM_SKPRT_ADMINTEMPLATEOVERVIEW, 'backupoverview' => _ADM_SKPRT_BACKUPOVERVIEW, 'backuprestore' => _ADM_SKPRT_BACKUPRESTORE, 'banlist' => _ADM_SKPRT_BANLIST, @@ -193,8 +82,12 @@ class AdminActions extends BaseActions 'commentedit' => _ADM_SKPRT_COMMENTEDIT, 'createitem' => _ADM_SKPRT_CREATEITEM, 'createnewlog' => _ADM_SKPRT_CREATENEWLOG, + 'createaccountinput' => _ADM_SKPRT_CREATEACCOUNTINPUT, /* not yet */ + 'createaccountsuccess' => _ADM_SKPRT_CREATEACCOUNTSUCCESS, /* not yet */ + 'createaccountdisable' => _ADM_SKPRT_CREATEACCOUNTDISALLOWED, /* not yet */ 'deleteblog' => _ADM_SKPRT_DELETEBLOG, 'editmembersettings' => _ADM_SKPRT_EDITMEMBERSETTINGS, + 'forgotpassword' => _ADM_SKPRT_FORGOTPASSWORD, /* not yet */ 'itemcommentlist' => _ADM_SKPRT_ITEMCOMMENTLIST, 'itemdelete' => _ADM_SKPRT_ITEMDELETE, 'itemedit' => _ADM_SKPRT_ITEMEDIT, @@ -232,7 +125,7 @@ class AdminActions extends BaseActions /** * AdminActions::getAvailableSkinTypes() - * + * * @static * @param void * @return array list of friendly names for page actions @@ -257,7 +150,7 @@ class AdminActions extends BaseActions /** * AdminActions::__construct() * Constructor for a new Actions object - * + * * @param string $type * @return void */ @@ -265,18 +158,23 @@ class AdminActions extends BaseActions { // call constructor of superclass first parent::__construct(); - $this->skintype = $type; - if ( !class_exists('Navlist') || !class_exists('Batch') ) + + /* alias */ + if ( $type == 'admntemplateoverview' ) { - global $DIR_LIBS; - include $DIR_LIBS . 'ENCAPSULATE.php'; + $this->skintype = 'admintemplateoverview'; } + else + { + $this->skintype = $type; + } + return; } /** * AdminActions::getAvailableActions() - * + * * @param void * @return array allowed actions for the page type */ @@ -288,467 +186,493 @@ class AdminActions extends BaseActions { case 'actionlog': $extra_actions = array( - 'actionloglist', + 'actionloglist', ); break; case 'activate': $extra_actions = array( - 'activationmessage', - 'eventformextra', + 'activationmessage', + 'eventformextra', ); break; case 'activatesetpwd': $extra_actions = array( + /* nothing special */ ); break; case 'addnewlog': $extra_actions = array( - 'getblogsetting', - 'blogsetting', - 'requestblogid', - ); + 'getblogsetting', + 'blogsetting', + 'requestblogid', + ); break; case 'adminerrorpage': $extra_actions = array( + /* nothing special */ ); break; case 'adminskindelete': $extra_actions = array( - 'editadminskintype', + 'editskintype', ); break; case 'adminskinedit': $extra_actions = array( - 'editadminskin', - 'defaultadminskintypes', - 'adminspecialskinlist', + 'editskin', + 'normalskinlist', + 'specialskinlist', ); break; case 'adminskinedittype': $extra_actions = array( - 'editadminskintype', - 'skintypehelp', - 'allowedadminskinactions', - 'adminskineditallowedlist', + 'editskintype', + 'skintypehelp', + 'allowedskinactions', + 'skineditallowedlist', ); break; case 'adminskiniedoimport': $extra_actions = array( - 'importskininfo', + 'importskininfo', ); break; case 'adminskinieimport': $extra_actions = array( - 'importskininfo', + 'importskininfo', ); break; case 'adminskinieoverview': $extra_actions = array( - 'selectlocaladminskinfiles', - 'adminskinielist', + 'selectlocalskinfiles', + 'skinielist', ); break; case 'adminskinoverview': $extra_actions = array( - 'adminskinoverview', + 'skinoverview', ); break; case 'adminskinremovetype': $extra_actions = array( - 'editadminskintype', + 'editskintype', ); break; case 'admintemplatedelete': $extra_actions = array( - 'editadmintemplateinfo', + 'editadmintemplateinfo', ); case 'admintemplateedit': $extra_actions = array( - 'editadmintemplateinfo', + 'edittemplateinfo', ); break; - case 'admntemplateoverview': + case 'admintemplateoverview': $extra_actions = array( - 'admintemplateoverview', + 'templateoverview', ); break; case 'backupoverview': $extra_actions = array( + /* nothing special */ ); break; case 'backuprestore': $extra_actions = array( + /* nothing special */ ); break; case 'banlist': $extra_actions = array( - 'adminbloglink', - 'adminbanlist', - 'requestblogid', + 'adminbloglink', + 'adminbanlist', + 'requestblogid', ); break; case 'banlistdelete': $extra_actions = array( - 'requestiprange', - 'requestblogid', + 'requestiprange', + 'requestblogid', ); break; case 'banlistdeleteconfirm': $extra_actions = array( - 'banlistdeletedlist', - 'requestblogid', + 'banlistdeletedlist', + 'requestblogid', ); break; case 'banlistnew': $extra_actions = array( - 'iprangeinput', - 'requestblogid', - 'blogsetting', + 'iprangeinput', + 'requestblogid', + 'blogsetting', ); break; case 'batchcategory': $extra_actions = array( - 'adminbatchaction', - 'adminbatchlist', + 'adminbatchaction', + 'adminbatchlist', ); break; case 'batchcomment': $extra_actions = array( - 'adminbatchaction', - 'adminbatchlist', + 'adminbatchaction', + 'adminbatchlist', ); break; case 'batchdelete': $extra_actions = array( - 'batchdeletetype', - 'batchdeletelist', + 'batchdeletetype', + 'batchdeletelist', ); break; case 'batchitem': $extra_actions = array( - 'adminbatchaction', - 'adminbatchlist', + 'adminbatchaction', + 'adminbatchlist', ); break; case 'batchmember': $extra_actions = array( - 'adminbatchaction', - 'adminbatchlist', + 'adminbatchaction', + 'adminbatchlist', ); break; case 'batchmove': $extra_actions = array( - 'batchmovetitle', - 'batchmovetype', - 'batchmovelist', - 'movedistselect', - 'batchmovebtn', + 'batchmovetitle', + 'batchmovetype', + 'batchmovelist', + 'movedistselect', + 'batchmovebtn', ); break; case 'batchmovecat': $extra_actions = array( - 'batchmovetitle', - 'batchmovetype', - 'batchmovelist', - 'movedistselect', - 'batchmovebtn', + 'batchmovetitle', + 'batchmovetype', + 'batchmovelist', + 'movedistselect', + 'batchmovebtn', ); break; case 'batchteam': $extra_actions = array( - 'requestblogid', - 'adminbatchaction', - 'adminbatchlist', + 'requestblogid', + 'adminbatchaction', + 'adminbatchlist', ); break; case 'blogcommentlist': $extra_actions = array( - 'adminbloglink', - 'commentnavlist', - 'adminbatchlist', + 'adminbloglink', + 'commentnavlist', + 'adminbatchlist', ); break; case 'blogsettings': $extra_actions = array( - 'adminbloglink', - 'blogcatlist', - 'blognotifysetting', - 'blogsetting', - 'blogsettingyesno', - 'blogteammembers', - 'blogtime', - 'defcatselect', - 'defskinselect', - 'pluginextras', - 'pluginoptions', - 'requestblogid', + 'adminbloglink', + 'blogcatlist', + 'blognotifysetting', + 'blogsetting', + 'blogsettingyesno', + 'blogteammembers', + 'blogtime', + 'defcatselect', + 'defskinselect', + 'pluginextras', + 'pluginoptions', + 'requestblogid', ); break; case 'bookmarklet': $extra_actions = array( - 'bookmarkletadmin', + 'bookmarkletadmin', ); break; case 'browseowncomments': $extra_actions = array( - 'commentnavlist', + 'commentnavlist', ); break; case 'browseownitems': $extra_actions = array( - 'itemnavlist', + 'itemnavlist', ); break; case 'categorydelete': $extra_actions = array( - 'categorysetting', - 'requestblogid', + 'categorysetting', + 'requestblogid', ); break; case 'categoryedit': $extra_actions = array( - 'requestblogid', - 'categorysetting', - 'editdesturl', - 'pluginoptions' + 'requestblogid', + 'categorysetting', + 'editdesturl', + 'pluginoptions' ); break; case 'commentdelete': $extra_actions = array( - 'deletecomment', + 'deletecomment', ); break; case 'commentedit': $extra_actions = array( - 'editcomment', + 'editcomment', ); break; + case 'createaccountinput': + $extra_actions = array( + 'contents', + 'pluginextras', + 'eventformextra', + ); + break; + case 'createaccountsuccess': + $extra_actions = array( + 'contents', + ); + break; + case 'createaccountdisable': + $extra_actions = array( + /* nothing special */ + ); + break; case 'createitem': $extra_actions = array( - 'adminbloglink', - 'blogid', - 'contents', - 'categories', - 'currenttime', - 'init', - 'pluginoptions', - 'pluginextras' + 'adminbloglink', + 'blogid', + 'contents', + 'categories', + 'currenttime', + 'init', + 'pluginoptions', + 'pluginextras' ); break; case 'createnewlog': $extra_actions = array( - 'defskinselect', - 'blogtime', + 'defskinselect', + 'blogtime', ); break; case 'deleteblog': $extra_actions = array( - 'blogsetting', - 'requestblogid', + 'blogsetting', + 'requestblogid', ); break; case 'editmembersettings': $extra_actions = array( - 'adminskinselectoptions', - 'editmember', - 'localeselectoptions', - 'pluginoptions', + 'defskinselect', + 'editmember', + 'localeselectoptions', + 'pluginoptions', + ); + break; + case 'forgotpassword': + $extra_actions = array( + /* nothing special */ ); break; case 'itemcommentlist': $extra_actions = array( - 'requestblogid', - 'commentnavlist', + 'requestblogid', + 'commentnavlist', ); break; case 'itemdelete': $extra_actions = array( - 'deleteitemtitle', - 'deleteitembody', - 'deleteitemid', + 'deleteitemtitle', + 'deleteitembody', + 'deleteitemid', ); break; case 'itemedit': $extra_actions = array( - 'init', - 'contents', - 'checkedonval', - 'categories', - 'currenttime', - 'itemtime', - 'pluginoptions', - 'pluginextras' + 'init', + 'contents', + 'checkedonval', + 'categories', + 'currenttime', + 'itemtime', + 'pluginoptions', + 'pluginextras' ); break; case 'itemlist': $extra_actions = array( - 'adminbloglink', - 'ilistaddnew', - 'itemnavlist', + 'adminbloglink', + 'ilistaddnew', + 'itemnavlist', ); break; case 'itemmove': $extra_actions = array( - 'moveitemid', - 'movedistselect', + 'moveitemid', + 'movedistselect', ); break; case 'manage': $extra_actions = array( + /* nothing special */ ); break; case 'manageteam': $extra_actions = array( - 'requestblogid', - 'blogsetting', - 'blogteamlist', - 'newmemberselect', - 'inputyesno', + 'requestblogid', + 'blogsetting', + 'blogteamlist', + 'newmemberselect', + 'inputyesno', ); break; case 'memberdelete': $extra_actions = array( - 'editmember', + 'editmember', ); break; case 'overview': $extra_actions = array( - 'yrbloglist', + 'yrbloglist', ); break; case 'plugindelete': $extra_actions = array( - 'editpluginfo', + 'editpluginfo', ); break; case 'pluginhelp': $extra_actions = array( - 'helpplugname', - 'pluginhelp', + 'helpplugname', + 'pluginhelp', ); break; case 'pluginlist': $extra_actions = array( - 'pluginlistlist', - 'newpluginlist', + 'pluginlistlist', + 'newpluginlist', ); break; case 'pluginoptions': $extra_actions = array( - 'editpluginfo', - 'editplugoptionslist', + 'editpluginfo', + 'editplugoptionslist', ); break; case 'settingsedit': $extra_actions = array( - 'defblogselect', - 'defskinselect', - 'configsettingsedit', - 'configsettingsyesno', - 'outputspecialdirs', - 'jstoolbaroptions', - 'localeselectoptions', - 'mediadirwarning', - 'pluginextras', + 'defblogselect', + 'defskinselect', + 'configsettingsedit', + 'configsettingsyesno', + 'outputspecialdirs', + 'jstoolbaroptions', + 'localeselectoptions', + 'mediadirwarning', + 'pluginextras', ); break; case 'showlogin': $extra_actions = array( - 'passrequestvars', + 'passrequestvars', ); break; case 'skindelete': $extra_actions = array( - 'editskintype', + 'editskintype', ); break; case 'skinedit': $extra_actions = array( - 'editskin', - 'specialskinlist', + 'editskin', + 'normalskinlist', + 'specialskinlist' ); break; case 'skinedittype': $extra_actions = array( - 'editskintype', - 'skintypehelp', - 'allowedskinactions', - 'skineditallowedlist', - 'skineditallowedlist', + 'editskintype', + 'skintypehelp', + 'allowedskinactions', + 'skineditallowedlist' ); break; case 'skiniedoimport': $extra_actions = array( - 'importskininfo', + 'importskininfo', ); break; case 'skinieimport': $extra_actions = array( - 'importskininfo', + 'importskininfo', ); break; case 'skinieoverview': $extra_actions = array( - 'selectlocalskinfiles', - 'skinielist', + 'selectlocalskinfiles', + 'skinielist', ); break; case 'skinoverview': $extra_actions = array( - 'skinoverview', + 'skinoverview', ); break; case 'skinremovetype': $extra_actions = array( - 'editskintype', + 'editskintype', ); break; case 'systemoverview': $extra_actions = array( - 'systemsettings', + 'systemsettings', ); break; case 'teamdelete': $extra_actions = array( - 'editmember', - 'blogsetting', - 'requestblogid', + 'editmember', + 'blogsetting', + 'requestblogid', ); break; case 'templatedelete': $extra_actions = array( - 'edittemplateinfo', + 'edittemplateinfo', ); break; case 'templateedit': $extra_actions = array( - 'edittemplateinfo', + 'edittemplateinfo', ); break; case 'templateoverview': $extra_actions = array( - 'templateoverview', + 'templateoverview', ); break; case 'usermanagement': $extra_actions = array( - 'editmemberlist', - 'inputyesno', + 'editmemberlist', + 'inputyesno', ); break; case 'importAdmin': $extra_actions = array( - 'charset', - 'sitevar', - 'adminurl', - 'extrahead', - 'member', - 'versioncheckurl', - 'version', - 'codename', - 'newestcompare', - 'selectlocaladminskinfiles', - 'adminskinielist', + 'charset', + 'adminurl', + 'extrahead', + 'member', + 'versioncheckurl', + 'version', + 'codename', + 'newestcompare', + 'selectlocalskinfiles', + 'skinielist', ); break; default: @@ -763,38 +687,45 @@ class AdminActions extends BaseActions /** * AdminActions::parse_actionloglist() * Parse skinvar actionloglist - * - * @param string $templateName name of template to use + * + * @param string $template_name name of template to use * @return void */ - public function parse_actionloglist($templateName = '') + public function parse_actionloglist($template_name = '') { - $query = "SELECT * FROM %s ORDER BY timestamp DESC"; - $query = sprintf($query, sql_table('actionlog')); + $query = "SELECT * FROM %s ORDER BY timestamp DESC;"; + $query = sprintf($query, sql_table('actionlog')); - $template['content'] = 'actionlist'; - $amount = showlist($query, 'table', $template, $templateName); + $resource = DB::getResult($query); + if ( $resource->rowCount() > 0 ) + { + $template['content'] = 'actionlist'; + $this->parser->parse(showlist($resource, 'table', $template, $template_name)); + } + else + { + /* TODO: nothing to be shown */ + } return; } - /** * AdminActions::parse_activationmessage() * Parse skinvar activationmessage - * + * * @param string $type type of message - * @param string $templateName name of template to use + * @param string $template_name name of template to use * @return void */ - public function parse_activationmessage($type, $templateName = '') + public function parse_activationmessage($type, $template_name = '') { global $CONF, $manager; $template = array(); - if ( !empty($templateName)) + if ( !empty($template_name)) { - $template = Template::read($templateName); + $template =& $manager->getTemplate($template_name); } $key = postVar('ackey'); @@ -809,7 +740,7 @@ class AdminActions extends BaseActions Admin::error(_ERROR_ACTIVATE); } - $mem = MEMBER::createFromId($info->vmember); + $mem =& $manager->getMember($info->vmember); if ( !$mem ) { Admin::error(_ERROR_ACTIVATE); @@ -893,7 +824,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_addtickettourl() * Parse skinvar addtickettourl - * + * * @param string $url URI for ticket * @return void */ @@ -908,22 +839,24 @@ class AdminActions extends BaseActions /** * AdminActions::parse_adminbanlist() * Parse skinvar adminbanlist - * - * @param string $templateName name of template to use + * + * @param string $template_name name of template to use * @return void */ - public function parse_adminbanlist($templateName = '') + public function parse_adminbanlist($template_name = '') { $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 ) + $resource = DB::getResult($query); + if ( $resource->rowCount() > 0 ) + { + $template['content'] = 'banlist'; + $this->parser-parse(showlist($resource, 'table', $template, $template_name)); + } + else { echo _BAN_NONE; } @@ -933,7 +866,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_adminbatchaction() * Parse skinvar adminbatchaction - * + * * @param void * @return void */ @@ -946,28 +879,28 @@ class AdminActions extends BaseActions /** * AdminActions::parse_adminbatchlist() * Parse skinvar adminbatchlist - * - * @param string $templateName name of template to use + * + * @param string $template_name name of template to use * @return void */ - public function parse_adminbatchlist($templateName = '') + public function parse_adminbatchlist($template_name = '') { global $manager; $templates = array(); - if ( !empty($templateName) ) + if ( !empty($template_name) ) { - $templates = Template::read($templateName); + $templates =& $manager->getTemplate($template_name); } if ( !array_key_exists('ADMIN_BATCHLIST', $templates) || empty($templates['ADMIN_BATCHLIST']) ) { $template = '
  • <%text(_BATCH_EXECUTING)%> ' - . '<%adminbatchaction%> ' - . '<%batchlisttype%> ' - . '<%batchid%>... ' - . '<%batchlistmsg%>' - . '
  • ' . "\n"; + . '<%adminbatchaction%> ' + . '<%batchlisttype%> ' + . '<%batchid%>... ' + . '<%batchlistmsg%>' + . "\n"; } else { @@ -975,8 +908,8 @@ class AdminActions extends BaseActions } $selected = requestIntArray('batch'); - $action = requestVar('batchaction'); - + $action = requestVar('batchaction'); + switch ( $this->skintype ) { case 'batchitem': @@ -1028,7 +961,7 @@ class AdminActions extends BaseActions } else { - $error = Admin::deleteOneTeamMember($blogid, $selectedid); + $error = Admin::deleteOneTeamMember($blogid, $selectedid); } break; case 'move': @@ -1054,23 +987,16 @@ class AdminActions extends BaseActions 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 AdminActions('template'); - $parser = new Parser($handler); - - $output = Template::fill($template, $data); - ob_start(); - $parser->parse($output); - $output = ob_get_contents(); - ob_end_clean(); - echo "{$output}
    "; + + $this->parser->parse(Template::fill($template, $data)); + echo '
    '; } return; } @@ -1078,20 +1004,20 @@ class AdminActions extends BaseActions /** * AdminActions::parse_adminbloglink() * Parse skinvar adminbloglink - * - * @param string $templateName name of template to use + * + * @param string $template_name name of template to use * @return void */ - public function parse_adminbloglink($templateName = '') + public function parse_adminbloglink($template_name = '') { global $manager; $blogid = intRequestVar('blogid'); $blog =& $manager->getBlog($blogid); $templates = array(); - if ( !empty($templateName) ) + if ( !empty($template_name) ) { - $templates = Template::read($templateName); + $templates =& $manager->getTemplate($template_name); } if ( !array_key_exists('ADMIN_BLOGLINK', $templates) || empty($templates['ADMIN_BLOGLINK']) ) @@ -1116,7 +1042,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_adminerrormesg() * Parse skinvar adminerrormesg - * + * * @param void * @return void */ @@ -1142,300 +1068,34 @@ class AdminActions extends BaseActions } /** - * AdminActions::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' - ); - Showlist($query, 'table', $show, $templateName); - break; - case 'template': - $query = "SELECT tdname as name, tddesc as description FROM %s WHERE tdname LIKE 'admin/%%'"; - $query = sprintf($query, sql_table('template_desc')); - $show = array( - 'content' => 'shortnames' - ); - Showlist($query, 'table', $show, $templateName); - break; - } - return; - } - - /** - * AdminActions::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 ( !array_key_exists('SKINIE_EXPORT_LIST', $templates) || empty($templates['SKINIE_EXPORT_LIST']) ) - { - $template = "" - . "\" id=\"<%expid%>\" />\n" - . "" - . "\n" - . "<%expdesc%>\n" - . "\n" - . "\n"; - } - else - { - $template = $templates['SKINIE_EXPORT_LIST']; - } - - switch ( $type ) - { - case 'skin': - $query = "SELECT * FROM %s WHERE sdname LIKE 'admin/%%';"; - $query = sprintf($query, sql_table('skin_desc')); - $res = DB::getResult($query); - - foreach ( $res as $row ) - { - $data = array( - 'typeid' => 'skin[' . $row['sdnumber'] . ']', - 'expid' => 'skinexp' . $row['sdnumber'], - 'expname' => Entity::hsc($row['sdname']), - 'expdesc' => Entity::hsc($row['sddesc']), - ); - echo Template::fill($template, $data); - } - break; - case 'template': - $query = "SELECT * FROM %s WHERE tdname LIKE 'admin/%%';"; - $query = sprintf($query, sql_table('template_desc')); - $res = DB::getResult($query); - foreach ( $res as $row ) - { - $data = array( - 'typeid' => 'template[' . $row['tdnumber'] . ']', - 'expid' => 'templateexp' . $row['tdnumber'], - 'expname' => Entity::hsc($row['tdname']), - 'expdesc' => Entity::hsc($row['tddesc']), - ); - echo Template::fill($template, $data); - } - break; - } - return; - } - - /** - * AdminActions::parse_adminskinoverview() - * Parse skinvar adminskinoverview - * - * @param string $templateName name of template to use - * @return void - */ - public function parse_adminskinoverview($templateName = '') - { - $query = "SELECT * FROM %s WHERE sdname LIKE 'admin/%%' ORDER BY sdname;"; - $query = sprintf($query, sql_table('skin_desc')); - - $template['content'] = 'adminskinlist'; - $template['tabindex'] = 10; - $template['friendly_names'] = $this->parser->skin->getAvailableTypes(); - Showlist($query, 'table', $template, $templateName); - return; - } - - /** - * AdminActions::parse_adminskinselectoptions() - * Parse skinvar adminskinselectoptions - * + * AdminActions::parse_allowedskinactions() + * Parse skinvar allowedskinactions + * * @param void * @return void - */ - public function parse_adminskinselectoptions($templateName = '') - { - global $CONF; - $query = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdname LIKE 'admin/%%';"; - $query = sprintf($query, sql_table('skin_desc')); - - $template['name'] = 'adminskin'; - $template['selected'] = $CONF['AdminSkin']; - $template['tabindex'] = 110; - Showlist($query, 'select', $template, $templateName); - return; - } - - /** - * AdminActions::parse_adminspecialskinlist() - * Parse skinvar adminspecialskinlist - * - * @param string $templateName name of template to use */ - public function parse_adminspecialskinlist($templateName = '') + public function parse_allowedskinactions() { - $templates = array(); - if ( $templateName ) - { - $templates = Template::read($templateName); - } - - $nType = $this->parser->skin->getAvailableTypes(); + $type = strtolower(trim(requestVar('type'))); $skinid = intRequestVar('skinid'); - $query = "SELECT stype FROM %s WHERE stype NOT IN (%s) AND sdesc=%d;"; - $query = sprintf($query, sql_table('skin'), "'" . implode("', '", $nType) . "'", (integer) $skinid); - - $res = DB::getResult($query); - if ( $res && $res->rowCount() > 0 ) + if ( !preg_match('#^admin#', $this->skintype) ) { - /* NOTE: set templates for HEAD/BODY/FOOT */ - if ( !array_key_exists('ADMIN_SPECIALSKINLIST_HEAD', $templates) || empty($templates['ADMIN_SPECIALSKINLIST_HEAD']) ) - { - $template['head'] = "\n"; - } - else - { - $template['foot'] = $templates['ADMIN_SPECIALSKINLIST_FOOT']; - } - - $tabstart = 120; - - /* NOTE: do echo */ - $data = array(); - echo $template['head']; - foreach ( $res as $row ) - { - $data = array( - 'tabindex' => $tabstart++, - 'skinid' => $skinid, - 'skintype' => Entity::hsc(strtolower($row['stype'])) - ); - echo Template::fill($template['body'], $data); - } - $data = array(); - echo $template['foot']; + $skin = new Skin($skinid); + $tag = 'skinvar'; } - return; - } - - /** - * AdminActions::parse_admintemplateoverview() - * Parse skinvar admintemplateoverview - * - * @param string $templateName name of template to use - * @return void - */ - public function parse_admintemplateoverview($templateName = '') - { - $query = "SELECT * FROM %s WHERE tdname LIKE 'admin/%%' ORDER BY tdname;"; - $query = sprintf($query, sql_table('template_desc')); - - $template['content'] = 'admintemplatelist'; - $template['tabindex'] = 10; - - Showlist($query, 'table', $template, $templateName); - return; - } - - /** - * AdminActions::parse_allowedadminskinactions() - * Parse skinvar allowedadminskinactions - * - * @param void - * @return void - */ - public function parse_allowedadminskinactions() - { - global $DIR_ADMINSKINS; - $skinType = strtolower(trim(requestVar('type'))); - $actions = $this->parser->skin->getAllowedActionsForType($skinType); - sort($actions); - - while ( $current = array_shift($actions) ) + else { - // TODO: remove this - // skip deprecated vars - if ($current == 'ifcat' || $current == 'imagetext' || $current == 'vars') - { - continue; - } - - echo helplink("adminskinvar-{$current}") . "$current\n"; - - if ( count($actions) != 0 ) - { - echo ", "; - } + $skin = new Skin($skinid, 'AdminActions'); + $tag = 'adminskinvar'; } - return; - } - - /** - * AdminActions::parse_allowedskinactions() - * Parse skinvar allowedskinactions - * - * @param void - * @return void - */ - public function parse_allowedskinactions() - { - $skinType = strtolower(trim(requestVar('type'))); - $skinid = intRequestVar('skinid'); - $skin = new Skin($skinid); - $actions = $skin->getAllowedActionsForType($skinType); + $actions = $skin->getAllowedActionsForType($type); sort($actions); while ( $current = array_shift($actions) ) { - // TODO: remove this - // skip deprecated vars - if ( $current == 'ifcat' || $current == 'imagetext' || $current == 'vars' ) - { - continue; - } - - /* TODO: alternative function should be used or not? */ - echo helplink("skinvar-{$current}") . "$current\n"; + echo helplink("{$tag}-{$current}") . "$current\n"; if ( count($actions) != 0 ) { @@ -1448,18 +1108,18 @@ class AdminActions extends BaseActions /** * AdminActions::parse_banlistdeletedlist() * Parse skinvar banlistdeletedlist - * - * @param string $templateName name of template to use + * + * @param string $template_name name of template to use * @return void */ - public function parse_banlistdeletedlist($templateName = '') + public function parse_banlistdeletedlist($template_name = '') { global $manager; $templates = array(); - if ( $templateName ) + if ( $template_name ) { - $templates = Template::read($templateName); + $templates =& $manager->getTemplate($template_name); } if ( !array_key_exists('BANLIST_DELETED_LIST', $templates) || empty($templates['BANLIST_DELETED_LIST']) ) @@ -1487,7 +1147,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_batchdeletelist() * Parse skinvar batchdeletelist - * + * * @param void * @return void */ @@ -1515,7 +1175,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_batchdeletetype() * Parse skinvar batchdeletetype - * + * * @param void * @return void */ @@ -1524,11 +1184,11 @@ class AdminActions extends BaseActions echo Entity::hsc(requestVar('action')); return; } - + /** * AdminActions::parse_batchmovebtn() * Parse skinvar batchmovebtn - * + * * @param void * @return void */ @@ -1550,7 +1210,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_batchmovelist() * Parse skinvar batchmovelist - * + * * @param void * @param void */ @@ -1569,7 +1229,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_batchmovetitle() * Parse skinvar batchmovetitle - * + * * @param void * @return void */ @@ -1591,7 +1251,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_batchmovetype() * Parse skinvar batchmovetype - * + * * @param void * @return void */ @@ -1604,29 +1264,37 @@ class AdminActions extends BaseActions /** * AdminActions::parse_blogcatlist() * Parse skinvar blogcatlist - * + * * @param void * @return void */ - public function parse_blogcatlist($templateName = '') + public function parse_blogcatlist($template_name = '') { global $manager; $blogid = intRequestVar('blogid'); - $query = "SELECT * FROM %s WHERE cblog = %d ORDER BY cname;"; + $query = "SELECT * FROM %s WHERE cblog = %d ORDER BY cname;"; $query = sprintf($query, sql_table('category'), (integer) $blogid); - $template['content'] = 'categorylist'; - $template['tabindex'] = 200; + $resource = DB::getResult($query); + if ( $resource->rowCount() > 0 ) + { + $template['content'] = 'categorylist'; + $template['tabindex'] = 200; + $this->parser->parse(listplug_batchlist('category', $resource, 'table', $template)); + } + else + { + /* TODO: nothing to be shown */ + } + $resource->closeCursor(); - $batch = new Batch('category'); - $batch->showlist($query, 'table', $template, $templateName); return; } /** * AdminActions::parse_blogid() * Parse skinvar blogid - * + * * @param void * @return void */ @@ -1639,15 +1307,15 @@ class AdminActions extends BaseActions /** * AdminActions::parse_blognotifysetting() * Parse skinvar blognotifysetting - * + * * @param void * @return void */ public function parse_blognotifysetting($type) { global $manager; - $blogid = intRequestVar('blogid'); - $blog = $manager->getBlog($blogid); + $blogid = intRequestVar('blogid'); + $blog =& $manager->getBlog($blogid); switch ( $type ) { @@ -1677,7 +1345,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_blogsetting() * Parse skinvar blogsetting - * + * * @param string $which name of weblog setting * @return void */ @@ -1690,18 +1358,18 @@ class AdminActions extends BaseActions /** * AdminActions::parse_blogsettingyesno() * Parse skinvar blogsettingyesno - * + * * @param string $type type of weblog setting - * @param string $templateName name of template to use + * @param string $template_name name of template to use * @return void */ - public function parse_blogsettingyesno($type, $templateName = '') + public function parse_blogsettingyesno($type, $template_name = '') { global $manager; - - $blogid = intRequestVar('blogid'); - $blog = $manager->getBlog($blogid); - + + $blogid = intRequestVar('blogid'); + $blog =& $manager->getBlog($blogid); + switch ( $type ) { case 'convertbreaks': @@ -1729,38 +1397,47 @@ class AdminActions extends BaseActions $tabindex = 122; break; } - $this->parse_inputyesno($type, $checkedval, $tabindex, 1, 0, _YES, _NO, 0, $templateName); + $this->parse_inputyesno($type, $checkedval, $tabindex, 1, 0, _YES, _NO, 0, $template_name); return; } /** * AdminActions::parse_blogteamlist() * Parse skinvar blogteamlist - * - * @param string $templateName name of template to use + * + * @param string $template_name name of template to use * @return void */ - public function parse_blogteamlist($templateName = '') + public function parse_blogteamlist($template_name = '') { global $manager; $blogid = intRequestVar('blogid'); - $query = "SELECT tblog, tmember, mname, mrealname, memail, tadmin " - . "FROM %s, %s " - . "WHERE tmember=mnumber AND tblog= %d"; + $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, $templateName, _LISTS_NOMORE); + $resource = DB::getResult($query); + if ( $resource->rowCount() > 0 ) + { + $template['content'] = 'teamlist'; + $template['tabindex'] = 10; + + $this->parser->parse(listplug_batchlist('team', $resource, 'table', $template)); + } + else + { + echo _LISTS_NOMORE; + } + $resource->closeCursor(); + return; } /** * AdminActions::parse_blogteammembers() * Parse skinvar blogteammembers - * + * * @param void * @return void */ @@ -1768,8 +1445,8 @@ class AdminActions extends BaseActions { $blogid = intRequestVar('blogid'); $query = "SELECT mname, mrealname " - . "FROM %s, %s " - . "WHERE mnumber=tmember AND tblog=%d;"; + . "FROM %s, %s " + . "WHERE mnumber=tmember AND tblog=%d;"; $query = sprintf($query, sql_table('member'), sql_table('team'), (integer) $blogid); $res = DB::getResult($query); $memberNames = array(); @@ -1783,7 +1460,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_blogtime() * Parse skinvar blogtime - * + * * @param string $type type of time * @param string $format format for time expression * @param integer $offset offset of time @@ -1801,7 +1478,7 @@ class AdminActions extends BaseActions else { $bid = intRequestVar('blogid'); - $b = $manager->getBlog($bid); + $b =& $manager->getBlog($bid); $timestamp = $b->getCorrectTime() + $offset; } @@ -1812,7 +1489,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_bookmarkletadmin() * Parse skinvar bookmarkletadmin - * + * * @param void * @return void */ @@ -1825,13 +1502,13 @@ class AdminActions extends BaseActions echo Entity::hsc('javascript:' . getBookmarklet($blogid)); return; } - + /** * AdminActions::parse_categories() * Parse skinvar categories - * + * * create category dropdown box - * + * * @param string $type name of setting for category * @return void */ @@ -1885,7 +1562,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_category() * Parse skinvar category - * + * * @param string $type name of setting for category * @return void */ @@ -1898,7 +1575,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_categorysetting() * Parse skinvar categorysetting - * + * * @param string $type type in category setting * @return void */ @@ -1923,17 +1600,17 @@ class AdminActions extends BaseActions { echo Entity::hsc($row['cname']); } - + return; } /** * AdminActions::parse_codename() * Parse templatevar codename - * + * * @param $value * @param $name - * + * */ public function parse_checkedonval($value, $name) { @@ -1943,12 +1620,15 @@ class AdminActions extends BaseActions $itemid = intRequestVar('itemid'); $item =& $manager->getItem($itemid, 1, 1); - $blog =& $manager->getBlog(getBlogIDFromItemID($itemid)); - - if ( $item && $blog->convertBreaks() && requestVar('action') == 'itemedit' ) + if ( $item ) { - $item['body'] = removeBreaks($item['body']); - $item['more'] = removeBreaks($item['more']); + $blog =& $manager->getBlog($item['blogid']); + + if ( $blog->convertBreaks() && requestVar('action') == 'itemedit' ) + { + $item['body'] = removeBreaks($item['body']); + $item['more'] = removeBreaks($item['more']); + } } $contents = array(); @@ -1970,10 +1650,10 @@ class AdminActions extends BaseActions /** * AdminActions::parse_codename() * Parse templatevar codename - * + * * @param void * @return void - * + * * TODO: is this need??? */ public function parse_codename() @@ -1986,7 +1666,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_commentnavlist() * Parse skinvar commentnavlist - * + * * @param void * @return void */ @@ -2056,17 +1736,35 @@ class AdminActions extends BaseActions $query .= " ORDER BY ctime ASC LIMIT {$start},{$amount}"; - $template['content'] = 'commentlist'; + $resource = DB::getResult($query); + if ( $resource->rowCount() > 0 ) + { + $template['action'] = $this->skintype; + $template['start'] = $start; + $template['amount'] = $amount; + $template['minamount'] = 0; + $template['maxamount'] = 1000; + $template['blogid'] = $bid; + $template['search'] = $search; + $template['itemid'] = $itemid; + + $template['content'] = 'commentlist'; + + $this->parser->parse(listplug_navlist('comment', $query, 'table', $template)); + } + else + { + /* TODO: nothing to be shown */ + } + $resource->closeCursor(); - $navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $bid, $search, $itemid); - $navList->showBatchList('comment', $query, 'table', $template, $nonComments); return; } /** * AdminActions::parse_configsettingsedit() * Parse skinvar configsettingsedit - * + * * @param string $type type of global configuration * @return void */ @@ -2114,7 +1812,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_configsettingsyesno() * Parse skinvar configsettingsyesno - * + * * @param string $type type of global setting * @param integer $tabindex tabindex attribute of input element * @return void @@ -2132,78 +1830,36 @@ class AdminActions extends BaseActions /** * AdminActions::parse_contents() * Parse skinvar contents - * + * * @param string $which part for item * @return void */ public function parse_contents($which) { - global $manager; - - $item = false; - $contents = array(); - - if ( requestVar('action') == 'itemedit' ) + if ( !array_key_exists($which, Admin::$contents) ) { - $itemid = intRequestVar('itemid'); - $item =& $manager->getItem($itemid, 1, 1); - - $blog =& $manager->getBlog(getBlogIDFromItemID($itemid)); - - if ( $item && $blog->convertBreaks() ) - { - $item['body'] = removeBreaks($item['body']); - $item['more'] = removeBreaks($item['more']); - } - $contents = $item; + Admin::$contents[$which] = ''; } - elseif ( requestVar('action') == 'createitem' ) - { - $blogid = intRequestVar('blogid'); - $blog =& $manager->getBlog($blogid); - $manager->notify( - 'PreAddItemForm', - array( - 'contents' => &$contents, - 'blog' => &$blog - ) - ); - } - - if ( !array_key_exists($which, $contents) ) - { - $contents[$which] = ''; - } - echo Entity::hsc($contents[$which],ENT_QUOTES); + echo Entity::hsc(Admin::$contents[$which]); } /** * AdminActions::parse_currenttime() * Parse skinvar currenttime - * + * * @param string $what */ // for future items public function parse_currenttime($what) { - global $manager; - if ( requestVar('action') == 'itemedit' ) - { - $itemid = intRequestVar('itemid'); - $blog =& $manager->getBlog(getBlogIDFromItemID($itemid)); - } - elseif ( requestVar('action') == 'createitem' ) - { - $blog =& $manager->getBlog(intRequestVar('blogid')); - } - $nu = getdate($blog->getCorrectTime()); + $nu = getdate(Admin::$blog->getCorrectTime()); echo $nu[$what]; } /** * AdminActions::parse_customhelplink() * Parse skinvar customhelplink - * + * * @param string $topic name of topic * @param string $tplName name of template * @param string $url string as URI @@ -2225,77 +1881,49 @@ class AdminActions extends BaseActions public function parse_date($format = 'c') { global $CONF, $manager; - echo i18n::formatted_datetime($format, time(), 'iso8601', $manager->getBlog((integer) $CONF['DefaultBlog'])); + /* TODO: offset is based on i18n::get_current_locale()? */ + echo i18n::formatted_datetime($format, time()); return; } /** - * AdminActions::parse_defaultadminskintypes() + * AdminActions::parse_normalskinlist() * Parse skinvar defaultadminskintypes - * - * @param string $tabindex index number for tabindex attribute of input element - * @param string $templateName name of template + * + * @param string $template_name name of template * @return void */ - public function parse_defaultadminskintypes($tabindex, $templateName = '') + public function parse_normalskinlist($template_name = '') { - $templates = array(); - - if ( $templateName ) - { - $templates = Template::read($templateName); - } - - $types = $this->parser->skin->getAvailableTypes(); - ksort($types); + global $CONF, $manager; - /* NOTE: set templates for HEAD/BODY/FOOT */ - if ( !array_key_exists('ADMINSKINTYPELIST_HEAD', $templates) || empty($templates['ADMINSKINTYPELIST_HEAD']) ) - { - $template['head'] = "\n"; + $skin = new Skin($CONF['BaseSkin']); + /* TODO: removeaction? */ + $template['editaction'] = 'skinedittype'; } else { - $template['foot'] = $templates['ADMINSKINTYPELIST_FOOT']; + $skin = new Skin($CONF['AdminSkin'], 'AdminActions'); + $template['editaction'] = 'adminskinedittype'; + /* TODO: removeaction? */ } - $handler = new AdminActions('template'); - $parser = new PARSER($handler); - - /* NOTE: do output */ - echo $template['head']; - foreach ( $types as $type => $fName ) + $temporary = $skin->getDefaultTypes(); + $normal_skintype = array(); + foreach ( $temporary as $type => $label ) { - $helplink = $this->customHelpHtml("skinpart{$type}{$templateName}"); - $data = array( - 'tabindex' => $tabindex, - 'skintype' => $type, - 'name' => $fName, - 'help' => $helplink, - 'skinid' => intrequestVar('skinid'), + $normal_skintype[] = array( + 'skintype' => $type, + 'skintypename' => $label ); - $parser->parse(Template::fill($template['body'], $data)); - $tabindex++; } - echo $template['foot']; + + $template['tabindex'] = 10; + $template['skinid'] = $skin->getID(); + $template['skinname'] = $skin->getName(); + $this->parser->parse(showlist($normal_skintype, 'list_normalskinlist', $template, $template_name)); return; } @@ -2303,11 +1931,11 @@ class AdminActions extends BaseActions /** * AdminActions::parse_defblogselect() * Parse skinvar defblogselect - * - * @param string $templateName name of template + * + * @param string $template_name name of template * @return void */ - public function parse_defblogselect($templateName = '') + public function parse_defblogselect($template_name = '') { global $CONF; @@ -2317,8 +1945,7 @@ class AdminActions extends BaseActions $template['name'] = 'DefaultBlog'; $template['selected'] = $CONF['DefaultBlog']; $template['tabindex'] = 10; - - Showlist($query, 'select', $template, $templateName); + $this->parser->parse(showlist($query, 'select', $template, $template_name)); return; } @@ -2326,16 +1953,16 @@ class AdminActions extends BaseActions /** * AdminActions::parse_defcatselect() * Parse skinvar defcatselect - * - * @param string $templateName name of template + * + * @param string $template_name name of template * @return void */ - public function parse_defcatselect($templateName = '') + public function parse_defcatselect($template_name = '') { global $manager; $blogid = intRequestVar('blogid'); - $blog = $manager->getBlog($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()); @@ -2344,7 +1971,7 @@ class AdminActions extends BaseActions $template['selected'] = $blog->getDefaultCategory(); $template['tabindex'] = 110; - Showlist($query, 'select', $template, $templateName); + $this->parser->parse(showlist($query, 'select', $template, $template_name)); return; } @@ -2352,43 +1979,51 @@ class AdminActions extends BaseActions /** * AdminActions::parse_defskinselect() * Parse skinvar defskinselect - * + * * @param string $type type of skin - * @param string $templateName name of template + * @param string $template_name name of template * @return void */ - public function parse_defskinselect($type = 'blog', $templateName = '') + public function parse_defskinselect($type = 'blog', $template_name = '') { - global $CONF, $manager; - - $query = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdname NOT LIKE 'admin/%%';"; - $query = sprintf($query, sql_table('skin_desc')); - - $blogid = intRequestVar('blogid'); - - if ( !$blogid ) - { - $template['selected'] = $CONF['BaseSkin']; - } - else - { - $blog = $manager->getBlog($blogid); - $template['selected'] = $blog->getDefaultSkin(); - } + global $CONF, $manager, $member; - if ( $type != 'blog' ) + if ( !preg_match('#^admin#', $this->skintype) ) { - $nname = 'BaseSkin'; + $blogid = intRequestVar('blogid'); + if ( !$blogid ) + { + $template['selected'] = $CONF['BaseSkin']; + } + else + { + $blog =& $manager->getBlog($blogid); + $template['selected'] = $blog->getDefaultSkin(); + } + + if ( $type != 'blog' ) + { + $template['name'] = 'BaseSkin'; + } + else + { + $template['name'] = 'defskin'; + } + + $query = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdname NOT LIKE 'admin/%%';"; } else { - $nname = 'defskin'; + /* TODO: member object will have its own adminskin id */ + $template['selected'] = $CONF['AdminSkin']; + $template['name'] = 'AdminSkin'; + $query = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdname LIKE 'admin/%%';"; } - $template['name'] = $nname; + $query = sprintf($query, sql_table('skin_desc')); $template['tabindex'] = 50; - Showlist($query, 'select', $template, $templateName); + $this->parser->parse(showlist($query, 'select', $template, $template_name)); return; } @@ -2396,7 +2031,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_deletecomment() * Parse skinvar deletecomment - * + * * @param string $type type of infomation for comment * @return void */ @@ -2430,7 +2065,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_deleteitembody() * Parse skinvar deleteitembody - * + * * @param void * @return void */ @@ -2451,7 +2086,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_deleteitemid() * Parse skinvar deleteitemid - * + * * @param void * @return void */ @@ -2464,113 +2099,26 @@ class AdminActions extends BaseActions /** * AdminActions::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; - } - - /** - * AdminActions::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; - } - - /** - * AdminActions::parse_editadminskintype() - * Parse skinvar editadminskintype - * - * @param string $type name of skin type - * @return void - */ - public function parse_editadminskintype($type = 'id') - { - global $CONF, $manager, $member; - - $fNames = $this->parser->skin->getAvailableTypes(); - $sType = strtolower(trim(requestVar('type'))); - - switch ( $type ) - { - case 'id': - echo intRequestVar('skinid'); - break; - case 'name': - echo Entity::hsc($this->parser->skin->getName()); - break; - case 'desc': - echo Entity::hsc($this->parser->skin->getDescription()); - break; - case 'type': - echo Entity::hsc($this->parser->skin->getContentType()); - break; - case 'content': - echo Entity::hsc($this->parser->skin->getContentFromDB($sType)); - break; - case 'skintype': - $skinType = !array_key_exists($sType, $fNames) ? ucfirst($sType) : $fNames[$sType]; - echo Entity::hsc($skinType); - break; - case 'skintyperaw': - echo Entity::hsc($sType); - break; - case 'prefix': - echo Entity::hsc($this->parser->skin->getIncludePrefix()); - break; - case 'mode': - $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL; - echo Entity::hsc($incMode); - break; - default: - break; - } + global $manager; + + $itemid = intRequestVar('itemid'); + $item =& $manager->getItem($itemid, 1, 1); + + echo Entity::hsc(strip_tags($item['title'])); + return; } /** * AdminActions::parse_editcomment() * Parse skinvar editcomment - * + * * @param string $type type of comment setting * @return void */ @@ -2635,37 +2183,48 @@ class AdminActions extends BaseActions /** * AdminActions::parse_editmemberlist() * Parse skinvar editmemberlist - * - * @param string $templateName name of template + * + * @param string $template_name name of template * @return void */ - public function parse_editmemberlist($templateName = '') + public function parse_editmemberlist($template_name = '') { global $manager; // show list of members with actions - $query = 'SELECT * FROM '.sql_table('member'); - $template['content'] = 'memberlist'; - $template['tabindex'] = 10; + $query = 'SELECT * FROM %s;'; + $query = sprintf($query, sql_table('member')); + + $resource = DB::getResult($query); + if ( $resource->rowCount() > 0 ) + { + $template['content'] = 'memberlist'; + $template['tabindex'] = 10; + + $this->parser->parse(listplug_batchlist('member', $resource, 'table', $template)); + } + else + { + echo _LISTS_NOMORE; + } + $resource->closeCursor(); - $batch = new Batch('member'); - $batch->showList($query, 'table', $template, $templateName, _LISTS_NOMORE); 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 = '') + public function parse_editmember($type = 'id', $template_name = '') { global $CONF, $manager, $member; $memberid = intRequestVar('memberid'); - $mem = MEMBER::createFromID($memberid); + $mem =& $manager->getMember($memberid); switch ( $type ) { @@ -2700,16 +2259,16 @@ class AdminActions extends BaseActions echo Entity::hsc($mem->getURL()); break; case 'admin': - $this->parse_inputyesno('admin', $mem->isAdmin(), 60, 1, 0, _YES, _NO, 0, $templateName); + $this->parse_inputyesno('admin', $mem->isAdmin(), 60, 1, 0, _YES, _NO, 0, $template_name); break; case 'canlogin': - $this->parse_inputyesno('canlogin', $mem->canLogin(), 70, 1, 0, _YES, _NO, $mem->isAdmin(), $templateName); + $this->parse_inputyesno('canlogin', $mem->canLogin(), 70, 1, 0, _YES, _NO, $mem->isAdmin(), $template_name); break; case 'notes': echo Entity::hsc($mem->getNotes()); break; case 'autosave': - $this->parse_inputyesno('autosave', $mem->getAutosave(), 87, 1, 0, _YES, _NO, 0, $templateName); + $this->parse_inputyesno('autosave', $mem->getAutosave(), 87, 1, 0, _YES, _NO, 0, $template_name); break; default: break; @@ -2720,7 +2279,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_editpluginfo() * Parse skinvar editpluginfo - * + * * @param string $type type of plugin info * @return void */ @@ -2744,11 +2303,11 @@ class AdminActions extends BaseActions /** * AdminActions::parse_editplugoptionslist() * Parse skinvar editplugoptionslist - * - * @param string $templateName name of template + * + * @param string $template_name name of template * @return void */ - public function parse_editplugoptionslist($templateName = '') + public function parse_editplugoptionslist($template_name = '') { global $manager; @@ -2762,7 +2321,7 @@ class AdminActions extends BaseActions foreach ( $resource as $row ) { - array_push($aOIDs, $row['oid']); + $aOIDs[] = $row['oid']; $aOptions[$row['oid']] = array( 'oid' => $row['oid'], 'value' => $row['odef'], @@ -2779,15 +2338,14 @@ class AdminActions extends BaseActions { $query = 'SELECT oid, ovalue FROM %s WHERE oid in (%s)'; $query = sprintf($query, sql_table('plugin_option'), implode(',', $aOIDs)); - + $result = DB::getResult($query); - foreach ( $result as $row ) { $aOptions[$row['oid']]['value'] = $row['ovalue']; } } - + // call plugins $data = array( 'context' => 'global', @@ -2796,11 +2354,12 @@ class AdminActions extends BaseActions ); $manager->notify('PrePluginOptionsEdit', $data); - $template['content'] = 'plugoptionlist'; - - $amount = Showlist($aOptions, 'table', $template, $templateName); - - if ( $amount == 0 ) + if ( sizeof($aOptions) > 0 ) + { + $template['content'] = 'plugoptionlist'; + $this->parser->parse(showlist($aOptions, 'table', $template, $template_name)); + } + else { echo '

    ' . _ERROR_NOPLUGOPTIONS . "

    \n"; } @@ -2810,14 +2369,23 @@ class AdminActions extends BaseActions /** * AdminActions::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); + + if ( !preg_match('#^admin#', $this->skintype) ) + { + $skin = new SKIN($skinid); + } + else + { + $skin = new SKIN($skinid, 'AdminActions'); + } + switch ( $type ) { case 'id': @@ -2846,22 +2414,37 @@ class AdminActions extends BaseActions /** * AdminActions::parse_editskintype() * Parse skinvar editskintype - * + * * @param string $type name of type for skin type * @return void */ - public function parse_editskintype($type = 'id') + public function parse_editskintype($stype = 'id') { - global $CONF, $manager, $member; - $skinid = intRequestVar('skinid'); - $skin = new SKIN($skinid); - $fNames = $skin->getAvailableTypes(); - $sType = strtolower(trim(requestVar('type'))); + static $skin = NULL; + static $types = array(); - switch ( $type ) + if ( $skin == NULL ) + { + $skinid = intRequestVar('skinid'); + + if ( !preg_match('#^admin#', $this->skintype) ) + { + $skin = new Skin($skinid); + } + else + { + $skin = new Skin($skinid, 'AdminActions'); + } + + $types = $skin->getDefaultTypes(); + } + + $type = strtolower(trim(requestVar('type'))); + + switch ( $stype ) { case 'id': - echo intRequestVar('skinid'); + echo $skin->getID(); break; case 'name': echo Entity::hsc($skin->getName()); @@ -2873,20 +2456,34 @@ class AdminActions extends BaseActions echo Entity::hsc($skin->getContentType()); break; case 'content': - echo Entity::hsc($skin->getContentFromDB($sType)); + echo Entity::hsc($skin->getContentFromDB($type)); break; case 'skintype': - $skinType = !array_key_exists($sType, $fNames) ? ucfirst($sType) : $fNames[$sType]; + if ( !array_key_exists($type, $types) ) + { + $skinType = ucfirst($type); + } + else + { + $skinType = $types[$type]; + } echo Entity::hsc($skinType); break; case 'skintyperaw': - echo Entity::hsc($sType); + echo Entity::hsc($type); break; case 'prefix': echo Entity::hsc($skin->getIncludePrefix()); break; case 'mode': - $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL; + if ( !$skin->getIncludeMode() != 'skindir' ) + { + $incMode = _PARSER_INCMODE_NORMAL; + } + else + { + $incMode = _PARSER_INCMODE_SKINDIR; + } echo Entity::hsc($incMode); break; default: @@ -2912,156 +2509,125 @@ class AdminActions extends BaseActions /** * AdminActions::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 - * @return boolean - */ - public function parse_edittemplateinfo($type, $desc = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '') + * + * @param string $format format to output + * @param string $typedesc type of template + * @param string $typename type name of template + * @param string $help help text + * @param string $tabindex index value for tabindex attribute of input element + * @param string $big textarea size + * @param string $tplt name of template to be filled + * @return boolean + */ + public function parse_edittemplateinfo($format, $typedesc = '', $typename = '', $help = '', $tabindex = 0, $big = 0, $template_name = '') { global $manager; + static $id = NULL; + static $name = NULL; + static $desc = NULL; - $t_id = intRequestVar('templateid'); - $t_name = Template::getNameFromId($t_id); - $t_desc = Template::getDesc($t_id); - $template = &Template::read($t_name); + if ( $id == NULL ) + { + $id = intRequestVar('templateid'); + } - switch ( $type ) + if ( $name == NULL ) + { + $name = Template::getNameFromId($id); + } + + if ( $desc == NULL ) + { + $desc = Template::getDesc($id); + } + + $template =& $manager->getTemplate($name); + + switch ( $format ) { case 'id': - echo intval($t_id); + echo (integer) $id; break; case 'name': - echo Entity::hsc($t_name); + echo Entity::hsc($name); break; case 'desc': - echo Entity::hsc($t_desc); + echo Entity::hsc($desc); break; case 'extratemplate': $tabidx = 600; $pluginfields = array(); - $manager->notify('TemplateExtraFields', array('fields' => &$pluginfields)); - - $tmplt = array(); - if ( $desc ) - { - $tmplt = Template::read($desc); - } - if ( !array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) || empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) ) + if ( !preg_match('#^admin/#', $this->skintype) ) { - $base = "\n" - . "\n" - . '<%explugtplname%>' . "\n"; + $manager->notify('TemplateExtraFields', array('fields' => &$pluginfields)); } else { - $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME']; + $manager->notify('AdminTemplateExtraFields', array('fields' => &$pluginfields)); } - foreach ( $pluginfields as $pfkey => $pfvalue ) + foreach ( $pluginfields as $ptkey => $ptvalue ) { - $data = array('explugtplname' => Entity::hsc($pfkey)); - + $tmplt = array(); + if ( $desc ) + { + $tmplt =& $manager->getTemplate($desc); + } + + /* extra plugin field */ + if ( !array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) || empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) ) + { + $base = "\n" + . "\n" + . "<%explugtplname%>\n"; + } + else + { + $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME']; + } + $data = array( + 'explugtplname' => Entity::hsc($ptkey) + ); echo Template::fill($base, $data); - - foreach ( $pfvalue as $pffield => $pfdesc ) + + foreach ( $ptvalue as $ptname => $ptdesc ) { - $this->templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name); + if ( !array_key_exists($ptname, $template) ) + { + $content = ''; + } + else + { + $content = $template[$ptname]; + } + $this->parser->parse(listplug_templateEditRow($content, $ptdesc, $ptname, $help, $tabidx++, $big, $template_name)); + continue; } } break; default: - $desc = defined($desc) ? constant($desc) : $desc; - $name = defined($name) ? constant($name) : $name; - $this->templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt); - break; - } - - return; - } - - /** - * AdminActions::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, $desc = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '') - { - global $manager; - - $t_id = intRequestVar('templateid'); - $t_name = Template::getNameFromId($t_id); - $t_desc = Template::getDesc($t_id); - $template = &Template::read($t_name); - - switch ( $type ) - { - case 'id': - echo intval($t_id); - break; - case 'name': - echo Entity::hsc($t_name); - break; - case 'desc': - echo Entity::hsc($t_desc); - break; - case 'extratemplate': - $tabidx = 600; - $pluginfields = array(); - $manager->notify('AdminTemplateExtraFields', array('fields' => &$pluginfields)); + $typedesc = defined($typedesc) ? constant($typedesc) : $typedesc; + $typename = defined($typename) ? constant($typename) : $typename; - $tmplt = array(); - if ( $desc ) - { - $tmplt = Template::read($desc); - } - if ( !array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) || empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) ) + if ( !array_key_exists($typename, $template) ) { - $base = "\n" - . "\n" - . '<%explugtplname%>' . "\n"; + $content = ''; } else { - $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME']; - } - - 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); - } + $content = $template[$typename]; } - break; - default: - $desc = defined($desc) ? constant($desc) : $desc; - $name = defined($name) ? constant($name) : $name; - $this->templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt); + $this->parser->parse(listplug_templateEditRow($content, $typedesc, $typename, $help, $tabindex, $big, $template_name)); break; } + return; } /** * AdminActions::parse_eventformextra() * Parse skinvar eventformextra - * + * * @param string $type name of type for event form extra * @return void */ @@ -3084,7 +2650,7 @@ class AdminActions extends BaseActions { Admin::error(_ERROR_ACTIVATE); } - $mem = MEMBER::createFromId($info->vmember); + $mem =& $manager->getMember($info->vmember); if ( !$mem ) { Admin::error(_ERROR_ACTIVATE); @@ -3126,7 +2692,7 @@ class AdminActions extends BaseActions * AdminActions::parse_member() * Parse skinvar member * (includes a member info thingie) - * + * * @param string $what which memberdata is needed * @return void */ @@ -3237,20 +2803,22 @@ class AdminActions extends BaseActions break; case 'adminurl': echo $CONF['AdminURL']; + break; } return; } /** - * AdminActions::parse_charset() - * Parse skinvar charset + * AdminActions::parse_actionurl() + * Parse $CONF; * * @param void * @return void */ - public function parse_charset() + public function parse_actionurl() { - echo i18n::get_current_charset(); + global $CONF; + echo Entity::hsc($CONF['ActionURL']); return; } @@ -3268,13 +2836,13 @@ class AdminActions extends BaseActions } elseif ( $bid = intRequestVar('blogid') ) { - $b = $manager->getBlog($bid); + $b =& $manager->getBlog($bid); } else { return; } - + switch ( $which ) { case 'id': @@ -3311,7 +2879,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_geteditpluginfo() * Parse skinvar geteditpluginfo - * + * * @param string $type name of setting for edit plugin info * @return void */ @@ -3335,7 +2903,7 @@ class AdminActions extends BaseActions * AdminActions::parse_getmember() * Parse skinvar getmember * (includes a member info thingie) - * + * * @param string $what name of setting for member * @return void */ @@ -3398,7 +2966,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_headmessage() * Parse skinvar headmessage - * + * * @param void * @return void */ @@ -3414,7 +2982,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_helplink() * Parse skinvar helplink - * + * * @param string $topic name of topic for help * @return void */ @@ -3430,7 +2998,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_helpplugname() * Parse skinvar helpplugname - * + * * @param void * @return void */ @@ -3444,7 +3012,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_ilistaddnew() * Parse skinvar ilistaddnew - * + * * @param void * @return void */ @@ -3461,7 +3029,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_importskininfo() * Parse skinvar importskininfo - * + * * @param string $type name of information for imported skin * @return void */ @@ -3499,11 +3067,9 @@ class AdminActions extends BaseActions } /** - * AdminActions::parse_inputyesno() - * Parse skinvar inputyesno - * + * AdminActions::parse_init() * some init stuff for all forms - * + * * @param void * @return void */ @@ -3511,49 +3077,34 @@ class AdminActions extends BaseActions { global $manager; - $item = false; + $authorid = ''; if ( requestVar('action') == 'itemedit' ) { - $itemid = intRequestVar('itemid'); - $item =& $manager->getItem($itemid, 1, 1); - - $blog =& $manager->getBlog(getBlogIDFromItemID($itemid)); - if ( $item && $blog->convertBreaks() ) - { - $item['body'] = removeBreaks($item['body']); - $item['more'] = removeBreaks($item['more']); - } - $contents = $item; - $authorid = $contents['authorid']; - } - elseif ( requestVar('action') == 'createitem' ) - { - $blogid = intRequestVar('blogid'); - $blog =& $manager->getBlog($blogid); - $authorid = ''; + $authorid = Admin::$contents['authorid']; } - $blog->insertJavaScriptInfo($authorid); + + Admin::$blog->insertJavaScriptInfo($authorid); return; } /** * AdminActions::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 + * + * @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 $template_name * @return void */ - public function parse_inputyesno($name, $checkedval, $tabindex = 0, $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO, $isAdmin = 0, $templateName = '') + public function parse_inputyesno($name, $checkedval, $tabindex = 0, $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO, $isAdmin = 0, $template_name = '') { - self::input_yesno($name, $checkedval, $tabindex, $value1, $value2, $yesval, $noval, $isAdmin, $templateName ); + $this->parser->parse(listplug_input_yesno($name, $checkedval, $tabindex, $value1, $value2, $yesval, $noval, $isAdmin, $template_name)); return; } @@ -3579,7 +3130,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_insplugoptcontent() * Parse skinvar insplugoptcontent - * + * * @param void * @return void */ @@ -3600,7 +3151,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_iprangeinput() * Parse skinvar iprangeinput - * + * * @param void * @return void */ @@ -3626,17 +3177,17 @@ class AdminActions extends BaseActions /** * AdminActions::parse_itemnavlist() * Parse skinvar itemnavlist - * + * * @param void * @return void */ - public function parse_itemnavlist($templateName) + public function parse_itemnavlist($template_name) { global $CONF, $manager, $member; $query = "SELECT bshortname, cname, mname, ititle, ibody, inumber, idraft, itime" - . " FROM %s, %s, %s, %s" - . " WHERE iblog=bnumber AND iauthor=mnumber AND icat=catid"; + . " FROM %s, %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')); @@ -3654,10 +3205,10 @@ class AdminActions extends BaseActions $blogid = (integer) $item['blogid']; } $blog =& $manager->getBlog($blogid); - + $query .= " AND iblog={$blogid}"; $template['now'] = $blog->getCorrectTime(time()); - + // non-blog-admins can only edit/delete their own items if ( !$member->blogAdminRights($blogid) ) { @@ -3677,8 +3228,8 @@ class AdminActions extends BaseActions if ( !empty($search) ) { $query .= ' AND ((ititle LIKE ' . DB::quoteValue('%'.$search.'%') . ') ' - . ' OR (ibody LIKE ' . DB::quoteValue('%'.$search.'%') . ') ' - . ' OR (imore LIKE ' . DB::quoteValue('%'.$search.'%') . '))'; + . ' OR (ibody LIKE ' . DB::quoteValue('%'.$search.'%') . ') ' + . ' OR (imore LIKE ' . DB::quoteValue('%'.$search.'%') . '))'; } if ( postVar('start') ) @@ -3707,17 +3258,35 @@ class AdminActions extends BaseActions $query .= ' ORDER BY itime DESC' . " LIMIT {$start},{$amount}"; - $template['content'] = 'itemlist'; + $resource = DB::getResult($query); + if ( $resource->rowCount() > 0 ) + { + $template['action'] = $this->skintype; + $template['start'] = $start; + $template['amount'] = $amount; + $template['minamount'] = 0; + $template['maxamount'] = 1000; + $template['blogid'] = $blogid; + $template['search'] = $search; + $template['itemid'] = 0; + + $template['content'] = 'itemlist'; + + $this->parser->parse(listplug_navlist('item', $query, 'table', $template)); + } + else + { + /* TODO: nothing to be shown */ + } + $resource->closeCursor(); - $navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $blogid, $search, 0); - $navList->showBatchList('item', $query, 'table', $template, '', $templateName); return; } /** * AdminActions::parse_itemtime() * date change on edit item - * + * * @param string $key key of PHP's getDate() * @return void */ @@ -3729,24 +3298,27 @@ class AdminActions extends BaseActions $itemid = intRequestVar('itemid'); $item =& $manager->getItem($itemid, 1, 1); - $blog =& $manager->getBlog(getBlogIDFromItemID($itemid)); - - if ( $item && $blog->convertBreaks() && requestVar('action') == 'itemedit' ) + if ( $item ) { - $item['body'] = removeBreaks($item['body']); - $item['more'] = removeBreaks($item['more']); + $blog =& $manager->getBlog($item['blogid']); + + if ( $blog->convertBreaks() && requestVar('action') == 'itemedit' ) + { + $item['body'] = removeBreaks($item['body']); + $item['more'] = removeBreaks($item['more']); + } } $contents = array(); if ( requestVar('action') == 'itemedit' ) { $contents = $item; - } + } elseif ( requestVar('action') == 'createitem' ) { $data = array( - 'contents' => &$contents, - 'blog' => &$this->blog + 'contents' => &$contents, + 'blog' => &$this->blog ); $manager->notify('PreAddItemForm', $data); } @@ -3758,7 +3330,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_jstoolbaroptions() * Parse skinvar jstoolbaroptions - * + * * @param void * @return void */ @@ -3784,18 +3356,20 @@ class AdminActions extends BaseActions /** * AdminActions::parse_localeselectoptions() * Parse skinvar localeselectoptions - * + * * @param void * @return void */ public function parse_localeselectoptions() { + global $manager; + $locales = i18n::get_available_locale_list(); $memid = intRequestVar('memberid'); if ( $memid ) { - $mem = MEMBER::createFromID($memid); + $mem =& $manager->getMember($memid); if ( !$mem->getLocale() || !in_array($mem->getLocale(), $locales) ) { echo "\n"; @@ -3851,20 +3425,20 @@ class AdminActions extends BaseActions /** * AdminActions::parse_listplugplugoptionrow() * Parse templatevar listplugplugoptionrow - * - * @param string $templateName name of template + * + * @param string $template_name name of template * @return void */ - public function parse_listplugplugoptionrow($templateName = '') + public function parse_listplugplugoptionrow($template_name = '') { - echo listplug_plugOptionRow(Admin::getAdminaOption(), $templateName); + echo listplug_plugOptionRow(Admin::getAdminaOption(), $template_name); return; } /** * AdminActions::parse_mediadirwarning() * Parse skinvar mediadirwarning - * + * * @param void * @return void */ @@ -3917,7 +3491,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_moveitemid() * Parse skinvar moveitemid - * + * * @param void * @return void */ @@ -3930,7 +3504,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_newestcompare() * Parse skinvar newestcompare - * + * * @param void * @return void */ @@ -3953,11 +3527,11 @@ class AdminActions extends BaseActions /** * AdminActions::parse_newmemberselect() * Parse skinvar newmemberselect - * - * @param string $templateName name of template to use + * + * @param string $template_name name of template to use * @return void */ - public function parse_newmemberselect($templateName = '') + public function parse_newmemberselect($template_name = '') { $blogid = intRequestVar('blogid'); @@ -3966,7 +3540,7 @@ class AdminActions extends BaseActions $res = DB::getResult($query); $tmem = array(); - foreach ( $res as $row ) + foreach ( $res as $row ) { $tmem[] = intval($row['tmember']); } @@ -3975,18 +3549,18 @@ class AdminActions extends BaseActions $query = sprintf($query, sql_table('member'), implode(', ', $tmem)); $template = array( - 'name' => 'memberid', - 'tabindex' => 10000, - 'selected' => 0 - ); - Showlist($query, 'select', $template, $templateName); + 'name' => 'memberid', + 'tabindex' => 10000, + 'selected' => 0 + ); + $this->parser->parse(showlist($query, 'select', $template, $template_name)); return; } /** * AdminActions::parse_newpluginlist() * Parse skinvar newpluginlist - * + * * @param void * @return void */ @@ -4003,7 +3577,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_outputspecialdirs() * Parse skinvar outputspecialdirs - * + * * @param string $type type of setting for directory * @return void */ @@ -4026,7 +3600,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_passrequestvars() * Parse skinvar passrequestvars - * + * * @param void * @return void */ @@ -4036,9 +3610,9 @@ class AdminActions extends BaseActions $oldaction = postVar('oldaction'); if ( ($oldaction != 'logout') - && ($oldaction != 'login') - && $passvar - && !postVar('customaction') ) + && ($oldaction != 'login') + && $passvar + && !postVar('customaction') ) { passRequestVars(); } @@ -4048,31 +3622,38 @@ class AdminActions extends BaseActions /** * AdminActions::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); + $mem =& $manager->getMember($id); $manager->notify('MemberSettingsFormExtras', array('member' => &$mem)); break; case 'blog': $id = intRequestVar('blogid'); - $blg = $manager->getBlog($id); + $blg =& $manager->getBlog($id); $manager->notify('BlogSettingsFormExtras', array('member' => &$blg)); break; - default: - $manager->notify( - 'GeneralSettingsFormExtras', - array( - ) + case 'createaccount': + $data = array( + 'type' => 'createaccount.php', + 'prelabel' => '', + 'postlabel' => '
    ', + 'prefield' => '', + 'postfield' => '

    ' ); + $manager->notify('RegistrationFormExtraFields', $data); + break; + default: + $manager->notify('GeneralSettingsFormExtras', array()); break; } return; @@ -4081,7 +3662,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_pluginhelp() * Parse skinvar pluginhelp - * + * * @param void * @return void */ @@ -4115,11 +3696,11 @@ class AdminActions extends BaseActions /** * AdminActions::parse_pluginlistlist() * Parse skinvar pluginlistlist - * - * @param string $templateName name of template to use + * + * @param string $template_name name of template to use * @return void */ - public function parse_pluginlistlist($templateName = '') + public function parse_pluginlistlist($template_name = '') { $query = "SELECT * FROM %s ORDER BY porder ASC;"; $query = sprintf($query, sql_table('plugin')); @@ -4127,7 +3708,7 @@ class AdminActions extends BaseActions $template['content'] = 'pluginlist'; $template['tabindex'] = 10; - Showlist($query, 'table', $template, $templateName); + $this->parser->parse(showlist($query, 'table', $template, $template_name)); return; } @@ -4135,11 +3716,11 @@ class AdminActions extends BaseActions /** * AdminActions::parse_pluginoptions() * Parse skinvar pluginoptions - * + * * @param string $type type of plugin option * @return void */ - public function parse_pluginoptions($context='global', $templateName='') + public function parse_pluginoptions($context='global', $template_name='') { global $itemid, $manager; @@ -4185,7 +3766,7 @@ class AdminActions extends BaseActions { $value = $aIdToValue[$row['oid']]; } - + $options[] = array( 'pid' => $row['pid'], 'pfile' => $row['pfile'], @@ -4208,14 +3789,14 @@ class AdminActions extends BaseActions $manager->notify('PrePluginOptionsEdit', $data); $template = array(); - if ( $templateName ) + if ( $template_name ) { - $templates = Template::read($templateName); + $templates =& $manager->getTemplate($template_name); if ( !array_key_exists('INSERT_PLUGOPTION_TITLE', $templates) || empty($templates['INSERT_PLUGOPTION_TITLE']) ) { $template['title'] = "" - . "<%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%>" - . "\n"; + . "<%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%>" + . "\n"; } else { @@ -4225,8 +3806,8 @@ class AdminActions extends BaseActions if ( !array_key_exists('INSERT_PLUGOPTION_BODY', $templates) || empty($templates['INSERT_PLUGOPTION_BODY']) ) { $template['body'] = "" - . "<%listplugplugoptionrow%>" - . "\n"; + . "<%listplugplugoptionrow%>" + . "\n"; } else { @@ -4236,110 +3817,94 @@ class AdminActions extends BaseActions $prevPid = -1; - include_libs('ACTIONS.php'); - $handler = new Actions($this->skintype); - $parser = new PARSER($handler); - foreach ( $options as $option ) { // new plugin? if ( $prevPid != $option['pid'] ) { $prevPid = $option['pid']; - $parser->parse($template['title']); + $this->parser->parse($template['title']); } $meta = NucleusPlugin::getOptionMeta($option['typeinfo']); if ( @$meta['access'] != 'hidden' ) { - $parsed = $parser->parse($template['body']); + $parsed = $this->parser->parse($template['body']); } } - + return; } /** * AdminActions::parse_qmenuaddselect() * Parse skinvar qmanuaddselect - * - * @param string $templateName name of template to use + * + * @param string $template_name name of template to use * @return void */ - public function parse_qmenuaddselect($templateName = '') + public function parse_qmenuaddselect($template_name = '') { - global $member; + global $member, $blogid; $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'; + $query = 'SELECT bnumber as value, bname as text FROM %s ORDER BY bname;'; + $query = sprintf($query, sql_table('blog')); } 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'; + $query = 'SELECT bnumber as value, bname as text FROM %s, %s WHERE tblog=bnumber and tmember=%d ORDER BY bname;'; + $query = sprintf($query, sql_table('blog'), sql_table('team'), (integer) $member->getID()); } $template['name'] = 'blogid'; $template['tabindex'] = 15000; $template['extra'] = _QMENU_ADD_SELECT; - $template['selected'] = -1; + $template['selected'] = 0; $template['shorten'] = 10; $template['shortenel'] = ''; $template['javascript'] = 'onchange="return form.submit()"'; - Showlist($query, 'select', $template, $templateName); + $this->parser->parse(showlist($query, 'select', $template, $template_name)); return; } - + /** * AdminActions::parse_quickmenu() * Parse skinvar quickmenu - * - * @param string $templateName name of template to use + * + * @param string $template_name name of template to use * @return void */ - public function parse_quickmenu($templateName = '') + public function parse_quickmenu($template_name = '') { global $manager; $templates = array(); - $template = array(); - if ( !empty($templateName) ) + + if ( !empty($template_name) ) { - $templates = Template::read($templateName); + $templates = & $manager->getTemplate($template_name); } $pluginExtras = array(); - $manager->notify( - 'QuickMenu', - array( - 'options' => &$pluginExtras - ) - ); + $manager->notify('QuickMenu', array('options' => &$pluginExtras)); + + $template = array(); if ( count($pluginExtras) > 0 ) { - if ( !array_key_exists('PLUGIN_QUICKMENU_TITLE', $templates) || empty($templates['PLUGIN_QUICKMENU_TITLE']) ) - { - $template['title'] = "

    <%text(_QMENU_PLUGINS)%>

    \n"; - } - else - { - $template['title'] = $templates['PLUGIN_QUICKMENU_TITLE']; - } if ( !array_key_exists('PLUGIN_QUICKMENU_HEAD', $templates) || empty($templates['PLUGIN_QUICKMENU_HEAD']) ) { - $template['head'] = "