class AdminActions extends BaseActions
{
- // reference to the skin object for which a part is being parsed
- private $skin;
-
private $skintype;
/* NOTE: list of whole available action names for tags
static private $default_actions = array(
'addtickettourl',
'adminurl',
+ 'codename',
'customhelplink',
+ 'date',
+ 'extrahead',
'headmessage',
'helplink',
+ 'member',
+ 'newestcompare',
+ 'pagehead',
+ 'pagefoot',
+ 'qmenuaddselect',
+ 'quickmenu',
+ 'sitevar',
'sprinttext',
- 'ticket'
+ 'ticket',
+ 'version',
+ 'versioncheckurl'
);
/**
'categories',
'currenttime',
'init',
- 'itemoptions',
+ 'pluginoptions',
'pluginextras'
);
break;
'categories',
'currenttime',
'itemtime',
- 'pluginextras',
- 'itemoptions'
+ 'pluginoptions',
+ 'pluginextras'
);
break;
case 'itemlist':
'yrbloglist',
);
break;
- case 'pagefoot':
- $extra_actions = array(
- 'date',
- 'qmenuaddselect',
- 'member',
- 'quickmenu',
- );
- break;
- case 'pagehead':
- $extra_actions = array(
- 'charset',
- 'sitevar',
- 'adminurl',
- 'extrahead',
- 'member',
- 'versioncheckurl',
- 'version',
- 'codename',
- 'newestcompare',
- );
- break;
case 'plugindelete':
$extra_actions = array(
'editpluginfo',
}
/**
- * AdminActions::setSkin()
- * Set the skin
- * @param object $skin an instance of Skin class
- * @return void
- */
- public function setSkin(&$skin)
- {
- $this->skin =& $skin;
- return;
- }
-
- /**
* AdminActions::parse_actionloglist()
* Parse skinvar actionloglist
*
$template['content'] = 'adminskinlist';
$template['tabindex'] = 10;
- $template['friendly_names'] = $this->skin->getAvailableTypes();
+ $template['friendly_names'] = $this->parser->skin->getAvailableTypes();
Showlist($query, 'table', $template, $templateName);
return;
}
$templates = Template::read($templateName);
}
- $nType = $this->skin->getAvailableTypes();
+ $nType = $this->parser->skin->getAvailableTypes();
$skinid = intRequestVar('skinid');
$query = "SELECT stype FROM %s WHERE stype NOT IN (%s) AND sdesc=%d;";
{
global $DIR_ADMINSKINS;
$skinType = strtolower(trim(requestVar('type')));
- $actions = $this->skin->getAllowedActionsForType($skinType);
+ $actions = $this->parser->skin->getAllowedActionsForType($skinType);
sort($actions);
while ( $current = array_shift($actions) )
* @param void
* @return void
*/
- public function parse_blogcatlist()
+ public function parse_blogcatlist($templateName = '')
{
global $manager;
$blogid = intRequestVar('blogid');
$template['tabindex'] = 200;
$batch = new Batch('category');
- $batch->showlist($query, 'table', $template);
+ $batch->showlist($query, 'table', $template, $templateName);
return;
}
$template['tabindex'] = 10;
$batch = new Batch('team');
- $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);
+ $batch->showList($query, 'table', $template, $templateName, _LISTS_NOMORE);
return;
}
$templates = Template::read($templateName);
}
- $types = $this->skin->getAvailableTypes();
+ $types = $this->parser->skin->getAvailableTypes();
ksort($types);
/* NOTE: set templates for HEAD/BODY/FOOT */
{
global $CONF, $manager, $member;
- $fNames = $this->skin->getAvailableTypes();
+ $fNames = $this->parser->skin->getAvailableTypes();
$sType = strtolower(trim(requestVar('type')));
switch ( $type )
echo intRequestVar('skinid');
break;
case 'name':
- echo Entity::hsc($this->skin->getName());
+ echo Entity::hsc($this->parser->skin->getName());
break;
case 'desc':
- echo Entity::hsc($this->skin->getDescription());
+ echo Entity::hsc($this->parser->skin->getDescription());
break;
case 'type':
- echo Entity::hsc($this->skin->getContentType());
+ echo Entity::hsc($this->parser->skin->getContentType());
break;
case 'content':
- echo Entity::hsc($this->skin->getContentFromDB($sType));
+ echo Entity::hsc($this->parser->skin->getContentFromDB($sType));
break;
case 'skintype':
$skinType = !array_key_exists($sType, $fNames) ? ucfirst($sType) : $fNames[$sType];
echo Entity::hsc($sType);
break;
case 'prefix':
- echo Entity::hsc($this->skin->getIncludePrefix());
+ echo Entity::hsc($this->parser->skin->getIncludePrefix());
break;
case 'mode':
$incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
$template['tabindex'] = 10;
$batch = new Batch('member');
- $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);
+ $batch->showList($query, 'table', $template, $templateName, _LISTS_NOMORE);
return;
}
{
$templates = Template::read($templateName);
}
+
if ( !array_key_exists('INSERT_PLUGOPTION_TITLE', $templates) || empty($templates['INSERT_PLUGOPTION_TITLE']) )
{
$template['title'] = "<tr>"
{
$template['title'] = $templates['INSERT_PLUGOPTION_TITLE'];
}
+
if ( !array_key_exists('INSERT_PLUGOPTION_BODY', $templates) || empty($templates['INSERT_PLUGOPTION_BODY']) )
{
$template['body'] = "<tr>"
* @param void
* @return void
*/
- public function parse_itemnavlist()
+ public function parse_itemnavlist($templateName)
{
global $CONF, $manager, $member;
. " LIMIT {$start},{$amount}";
$template['content'] = 'itemlist';
-
+
$navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $blogid, $search, 0);
- $navList->showBatchList('item', $query, 'table', $template);
+ $navList->showBatchList('item', $query, 'table', $template, '', $templateName);
return;
}
/**
- * AdminActions::parse_itemoptions()
- * Parse skinvar itemoptions
- * Adds the itemOptions of a plugin to a page
- * @author TeRanEX
- */
- public function parse_itemoptions()
- {
- $this->parse_pluginoptions('item');
- return;
- }
-
- /**
- * AdminActions::parse_itemoptions()
- *
+ * AdminActions::parse_itemtime()
* date change on edit item
*
- * Parse skinvar itemoptions
- * Adds the itemOptions of a plugin to a page
- * @author TeRanEX
+ * @param string $key key of PHP's getDate()
+ * @return void
*/
- public function parse_itemtime($what)
+ public function parse_itemtime($key)
{
global $manager;
$manager->notify('PreAddItemForm', $data);
}
$itemtime = getdate($contents['timestamp']);
- echo $itemtime[$what];
+ echo $itemtime[$key];
return;
}
* @param string $type type of plugin option
* @return void
*/
- public function parse_pluginoptions($type = 'global')
+ public function parse_pluginoptions($context='global')
{
- global $itemid;
+ global $itemid, $manager;
- switch ( $type )
+ switch ( $context )
{
case 'member':
- $id = intRequestVar('memberid');
+ $contextid = intRequestVar('memberid');
break;
case 'blog':
- $id = intRequestVar('blogid');
+ $contextid = intRequestVar('blogid');
break;
case 'category':
- $id = intRequestVar('catid');
+ $contextid = intRequestVar('catid');
break;
case 'item':
- $id = $itemid;
+ $contextid = $itemid;
break;
}
- Admin::insertPluginOptions($type, $id);
+
+ /* Actually registererd plugin options */
+ $aIdToValue = array();
+ $query = "SELECT oid, ovalue FROM %s WHERE ocontextid=%d;";
+ $query = sprintf($query, sql_table('plugin_option'), (integer) $contextid);
+ $res = DB::getResult($query);
+ foreach ( $res as $row )
+ {
+ $aIdToValue[$row['oid']] = $row['ovalue'];
+ }
+
+ /* Currently available plugin options */
+ $query = "SELECT * FROM %s, %s WHERE opid=pid and ocontext= %s ORDER BY porder, oid ASC;";
+ $query = sprintf($query, sql_table('plugin_option_desc'), sql_table('plugin'), DB::quoteValue($context));
+ $res = DB::getResult($query);
+
+ $options = array();
+ foreach ($res as $row )
+ {
+ if ( !array_key_exists($row['oid'], $aIdToValue) )
+ {
+ $value = $row['odef'];
+ }
+ else
+ {
+ $value = $aIdToValue[$row['oid']];
+ }
+
+ $options[] = array(
+ 'pid' => $row['pid'],
+ 'pfile' => $row['pfile'],
+ 'oid' => $row['oid'],
+ 'value' => $value,
+ 'name' => $row['oname'],
+ 'description' => $row['odesc'],
+ 'type' => $row['otype'],
+ 'typeinfo' => $row['oextra'],
+ 'contextid' => $contextid,
+ 'extra' => ''
+ );
+ }
+
+ $data = array(
+ 'context' => $context,
+ 'contextid' => $contextid,
+ 'options' => &$opt4ions
+ );
+ $manager->notify('PrePluginOptionsEdit', $data);
+
+ $content = $this->parser->skin->getContentFromDB('insertpluginoptions');
+ $this->parser->parse($content);
+
return;
}
* @param $templateName
* @param $showlist
*/
- private function input_yesno($name,
+ public function input_yesno($name,
$checkedval,
$tabindex = 0,
$value1 = 1,
$this->newPlugCandidates = $candidates;
return (count($candidates) > 0);
}
+
+ /**
+ * AdminActions::pagehead()
+ * Output admin page head
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_pagehead()
+ {
+ global $member, $nucleus, $CONF, $manager;
+
+ $content = $this->parser->skin->getContentFromDB('pagehead');
+ if ( !$content )
+ {
+ $extrahead = Admin::$extrahead;
+ $data = array(
+ 'extrahead' => &$extrahead,
+ 'action' => Admin::$action
+ );
+ $manager->notify('AdminPrePageHead', $data);
+
+ $baseUrl = Entity::hsc($CONF['SkinsURL']);
+
+ /*
+ * TODO: obsoleted
+ if ( !array_key_exists('AdminCSS', $CONF) )
+ {
+ DB::execute("INSERT INTO " . sql_table('config') . " VALUES ('AdminCSS', 'original')");
+ $CONF['AdminCSS'] = 'original';
+ }
+ */
+
+ /* HTTP 1.1 application for no caching */
+ header("Cache-Control: no-cache, must-revalidate");
+ header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
+
+ $root_element = 'html';
+ $charset = i18n::get_current_charset();
+ $locale = preg_replace('#_#', '-', i18n::get_current_locale());
+ $xml_version_info = self::$xml_version_info;
+ $formal_public_identifier = self::$formal_public_identifier;
+ $system_identifier = self::$system_identifier;
+ $xhtml_namespace = self::$xhtml_namespace;
+
+ echo "<?xml version=\"{$xml_version_info}\" encoding=\"{$charset}\" ?>\n";
+ echo "<!DOCTYPE {$root_element} PUBLIC \"{$formal_public_identifier}\" \"{$system_identifier}\">\n";
+ echo "<{$root_element} xmlns=\"{$xhtml_namespace}\" xml:lang=\"{$locale}\" lang=\"{$locale}\">\n";
+ echo "<head>\n";
+ echo '<title>' . Entity::hsc($CONF['SiteName']) . " - Admin</title>\n";
+ /*
+ * TODO: obsoleted
+ echo "<link rel=\"stylesheet\" title=\"Nucleus Admin Default\" type=\"text/css\" href=\"{$baseUrl}admin/defaultadmin/styles/admin_{$CONF["AdminCSS"]}.css\" />\n";
+ */
+ echo "<link rel=\"stylesheet\" title=\"Nucleus Admin Default\" type=\"text/css\" href=\"{$baseUrl}admin/defaultadmin/styles/addedit.css\" />\n";
+ echo "<script type=\"text/javascript\" src=\"{$baseUrl}javascripts/edit.js\"></script>\n";
+ echo "<script type=\"text/javascript\" src=\"{$baseUrl}javascripts/admin.js\"></script>\n";
+ echo "<script type=\"text/javascript\" src=\"{$baseUrl}javascripts/compatibility.js\"></script>\n";
+ echo "{$extrahead}\n";
+ echo "</head>\n\n";
+ echo "<body>\n";
+ echo "<div id=\"adminwrapper\">\n";
+ echo "<div class=\"header\">\n";
+ echo '<h1>' . Entity::hsc($CONF['SiteName']) . "</h1>\n";
+ echo "</div>\n";
+ echo "<div id=\"container\">\n";
+ echo "<div id=\"content\">\n";
+ echo "<div class=\"loginname\">\n";
+
+ if ( !$member->isLoggedIn() )
+ {
+ echo '<a href="index.php?action=showlogin" title="Log in">' . _NOTLOGGEDIN . "</a><br />\n";
+ }
+ else
+ {
+ echo _LOGGEDINAS . ' ' . $member->getDisplayName() ." - <a href='index.php?action=logout'>" . _LOGOUT. "</a><br />\n";
+ echo "<a href='index.php?action=overview'>" . _ADMINHOME . "</a> - ";
+ }
+
+ echo "<a href='".$CONF['IndexURL']."'>"._YOURSITE."</a><br />\n";
+ echo '(';
+
+ if ( !array_key_exists('codename', $nucleus) || empty($nucleus['codename']) )
+ {
+ $codenamestring = '';
+ }
+ else
+ {
+ $codenamestring = ' "' . $nucleus['codename'].'"';
+ }
+
+ if ( $member->isLoggedIn() && $member->isAdmin() )
+ {
+ $checkURL = sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
+ echo '<a href="' . $checkURL . '" title="' . _ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TITLE . '">Nucleus CMS ' . $nucleus['version'] . $codenamestring . '</a>';
+
+ $newestVersion = getLatestVersion();
+ $newestCompare = str_replace('/', '.', $newestVersion);
+ $currentVersion = str_replace(array('/','v'), array('.',''), $nucleus['version']);
+
+ if ( $newestVersion && version_compare($newestCompare, $currentVersion) > 0 )
+ {
+ echo "<br />\n";
+ echo '<a style="color:red" href="http://nucleuscms.org/upgrade.php" title="' . _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TITLE . '">';
+ echo _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TEXT . $newestVersion;
+ echo "</a>";
+ }
+ }
+ else
+ {
+ echo "Nucleus CMS {$nucleus['version']}{$codenamestring}";
+ }
+ echo ')';
+ echo '</div>';
+ }
+ else
+ {
+ $this->parser->parse($content);
+ }
+
+ return;
+ }
+
+ /**
+ * AdminActionss::pagefoot()
+ * Output admin page foot include quickmenu
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_pagefoot()
+ {
+ global $action, $member, $manager;
+
+ $content = $this->parser->skin->getContentFromDB('pagefoot');
+ if ( !$content )
+ {
+ $data = array(
+ 'action' => self::$action
+ );
+ $manager->notify('AdminPrePageFoot', $data);
+
+ if ( $member->isLoggedIn() && ($action != 'showlogin') )
+ {
+ echo '<h2>' . _LOGOUT . "</h2>\n";
+ echo "<ul>\n";
+ echo '<li><a href="index.php?action=overview">' . _BACKHOME . "</a></li>\n";
+ echo '<li><a href="index.php?action=logout">' . _LOGOUT . "</a></li>\n";
+ echo "</ul>\n";
+ }
+
+ echo "<div class=\"foot\">\n";
+ echo '<a href="' . _ADMINPAGEFOOT_OFFICIALURL . '">Nucleus CMS</a> © 2002-' . date('Y') . ' ' . _ADMINPAGEFOOT_COPYRIGHT;
+ echo '-';
+ echo '<a href="' . _ADMINPAGEFOOT_DONATEURL . '">' . _ADMINPAGEFOOT_DONATE . "</a>\n";
+ echo "</div>\n";
+
+ echo "<div id=\"quickmenu\">\n";
+
+ if ( ($action != 'showlogin') && ($member->isLoggedIn()) )
+ {
+ echo "<ul>\n";
+ echo '<li><a href="index.php?action=overview">' . _QMENU_HOME . "</a></li>\n";
+ echo "</ul>\n";
+
+ echo '<h2>' . _QMENU_ADD . "</h2>\n";
+ echo "<form method=\"get\" action=\"index.php\">\n";
+ echo "<p>\n";
+ echo "<input type=\"hidden\" name=\"action\" value=\"createitem\" />\n";
+
+ $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 %s ORDER BY bname;";
+ $query = sprintf($query, sql_table('blog'));
+ }
+ else
+ {
+ $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['shorten'] = 10;
+ $template['shortenel'] = '';
+ $template['javascript'] = 'onchange="return form.submit()"';
+ showlist($query, 'select', $template);
+
+ echo "</p>\n";
+ echo "</form>\n";
+
+ echo "<h2>{$member->getDisplayName()}</h2>\n";
+ echo "<ul>\n";
+ echo '<li><a href="index.php?action=editmembersettings">' . _QMENU_USER_SETTINGS . "</a></li>\n";
+ echo '<li><a href="index.php?action=browseownitems">' . _QMENU_USER_ITEMS . "</a></li>\n";
+ echo '<li><a href="index.php?action=browseowncomments">' . _QMENU_USER_COMMENTS . "</a></li>\n";
+ echo "</ul>\n";
+
+ if ( $member->isAdmin() )
+ {
+ echo '<h2>' . _QMENU_MANAGE . "</h2>\n";
+ echo "<ul>\n";
+ echo '<li><a href="index.php?action=actionlog">' . _QMENU_MANAGE_LOG . "</a></li>\n";
+ echo '<li><a href="index.php?action=settingsedit">' . _QMENU_MANAGE_SETTINGS . "</a></li>\n";
+ echo '<li><a href="index.php?action=systemoverview">' . _QMENU_MANAGE_SYSTEM . "</a></li>\n";
+ echo '<li><a href="index.php?action=usermanagement">' . _QMENU_MANAGE_MEMBERS . "</a></li>\n";
+ echo '<li><a href="index.php?action=createnewlog">' . _QMENU_MANAGE_NEWBLOG . "</a></li>\n";
+ echo '<li><a href="index.php?action=backupoverview">' . _QMENU_MANAGE_BACKUPS . "</a></li>\n";
+ echo '<li><a href="index.php?action=pluginlist">' . _QMENU_MANAGE_PLUGINS . "</a></li>\n";
+ echo "</ul>\n";
+
+ echo "<h2>" . _QMENU_LAYOUT . "</h2>\n";
+ echo "<ul>\n";
+ echo '<li><a href="index.php?action=skinoverview">' . _QMENU_LAYOUT_SKINS . "</a></li>\n";
+ echo '<li><a href="index.php?action=templateoverview">' . _QMENU_LAYOUT_TEMPL . "</a></li>\n";
+ echo '<li><a href="index.php?action=skinieoverview">' . _QMENU_LAYOUT_IEXPORT . "</a></li>\n";
+ echo "</ul>\n";
+ }
+
+ $data = array('options' => array());
+
+ $manager->notify('QuickMenu', $data);
+
+ if ( count($data['options']) > 0 )
+ {
+ echo "<h2>" . _QMENU_PLUGINS . "</h2>\n";
+ echo "<ul>\n";
+ foreach ( $data['options'] as $option )
+ {
+ echo '<li><a href="' . Entity::hsc($option['url']) . '" title="' . Entity::hsc($option['tooltip']) . '">' . Entity::hsc($option['title']) . "</a></li>\n";
+ }
+ echo "</ul>\n";
+ }
+ }
+ else if ( ($action == 'activate') || ($action == 'activatesetpwd') )
+ {
+
+ echo '<h2>' . _QMENU_ACTIVATE . '</h2>' . _QMENU_ACTIVATE_TEXT;
+ }
+ else
+ {
+ echo '<h2>' . _QMENU_INTRO . '</h2>' . _QMENU_INTRO_TEXT;
+ }
+
+ echo "<!-- quickmenu -->\n";
+ echo "</div>\n";
+
+ echo "<!-- content -->\n";
+ echo "</div>\n";
+
+ echo "<!-- container -->\n";
+ echo "</div>\n";
+
+ echo "<!-- adminwrapper -->\n";
+ echo "</div>\n";
+
+ echo "</body>\n";
+ echo "</html>\n";
+ }
+ else
+ {
+ $this->parser->skin->parse('pagefoot');
+ exit;
+ }
+
+ return;
+ }
}