<?php
-if ( !class_exists('BaseActions') )
-{
- include $DIR_LIBS . 'BaseActions.php';
-}
-
+/**
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2012 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2012 The Nucleus Group
+ * @version $Id: AdminActions.php 1661 2012-02-12 11:55:39Z sakamocchi $
+ */
class AdminActions extends BaseActions
{
);
/**
- * AdminActions::$skin_type_friendly_names
+ * AdminActions::$normal_skin_types
* friendly name for wrapped page types
*/
- static private $default_skin_types = array(
+ static private $normal_skin_types = array(
'actionlog' => _ADM_SKPRT_ACTIONLOG,
'activate' => _ADM_SKPRT_ACTIVATE,
'activatesetpwd' => _ADM_SKPRT_ACTIVATESETPWD,
'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 */
+ 'createaccountinput' => _ADM_SKPRT_CREATEACCOUNTINPUT,
+ 'createaccountsuccess' => _ADM_SKPRT_CREATEACCOUNTSUCCESS,
+ 'createaccountdisable' => _ADM_SKPRT_CREATEACCOUNTDISALLOWED,
'deleteblog' => _ADM_SKPRT_DELETEBLOG,
'editmembersettings' => _ADM_SKPRT_EDITMEMBERSETTINGS,
- 'forgotpassword' => _ADM_SKPRT_FORGOTPASSWORD, /* not yet */
+ 'forgotpassword' => _ADM_SKPRT_FORGOTPASSWORD,
'itemcommentlist' => _ADM_SKPRT_ITEMCOMMENTLIST,
'itemdelete' => _ADM_SKPRT_ITEMDELETE,
'itemedit' => _ADM_SKPRT_ITEMEDIT,
'itemlist' => _ADM_SKPRT_ITEMLIST,
'itemmove' => _ADM_SKPRT_ITEMMOVE,
- 'login' => FALSE, //missing
'manage' => _ADM_SKPRT_MANAGE,
'manageteam' => _ADM_SKPRT_MANAGETEAM,
'memberdelete' => _ADM_SKPRT_MEMBERDELETE,
- 'memberedit' => FALSE, //missing
'overview' => _ADM_SKPRT_OVERVIEW,
'pagefoot' => _ADM_SKPRT_PAGEFOOT,
'pagehead' => _ADM_SKPRT_PAGEHEAD,
'templatedelete' => _ADM_SKPRT_TEMPLATEDELETE,
'templateedit' => _ADM_SKPRT_TEMPLATEEDIT,
'templateoverview' => _ADM_SKPRT_TEMPLATEOVERVIEW,
- 'usermanagement' => _ADM_SKPRT_USERMANAGEMENT,
+ 'usermanagement' => _ADM_SKPRT_USERMANAGEMENT
);
/**
- * AdminActions::getAvailableSkinTypes()
- *
- * @static
- * @param void
- * @return array list of friendly names for page actions
- */
- static public function getAvailableSkinTypes()
- {
- return self::$default_skin_types;
- }
-
- /**
- * AdminActions::getDefaultTypes()
+ * AdminActions::getNormalSkinTypes()
*
* @static
* @param void
* @return array list of friendly names for page actions
*/
- static public function getDefaultTypes()
+ static public function getNormalSkinTypes()
{
- return self::$default_skin_types;
+ return self::$normal_skin_types;
}
/**
{
// call constructor of superclass first
parent::__construct();
-
+
/* alias */
if ( $type == 'admntemplateoverview' )
{
public function getAvailableActions()
{
$extra_actions = array();
-
+
switch ( $this->skintype )
{
case 'actionlog':
'contents',
'pluginextras',
'eventformextra',
- );\r
+ );
break;
case 'createaccountsuccess':
- $extra_actions = array(\r
+ $extra_actions = array(
'contents',
- );\r
+ );
break;
case 'createaccountdisable':
$extra_actions = array(
/* nothing special */
- );\r
+ );
break;
case 'createitem':
$extra_actions = array(
'editmember',
'localeselectoptions',
'pluginoptions',
+ 'defadminskinselect',
+ 'defbookmarkletselect',
+ 'pluginextras',
);
break;
case 'forgotpassword':
'localeselectoptions',
'mediadirwarning',
'pluginextras',
+ 'defadminskinselect',
+ 'defbookmarkletselect',
);
break;
case 'showlogin':
default:
break;
}
-
+
$defined_actions = array_merge(self::$default_actions, $extra_actions);
-
+
return array_merge($defined_actions, parent::getAvailableActions());
}
{
$query = "SELECT * FROM %s ORDER BY timestamp DESC;";
$query = sprintf($query, sql_table('actionlog'));
-
+
$resource = DB::getResult($query);
if ( $resource->rowCount() > 0 )
{
$template['content'] = 'actionlist';
- $this->parser->parse(showlist($resource, 'table', $template, $template_name));
+ $action_list = showlist($resource, 'table', $template, $template_name);
+ $this->parser->parse($action_list);
}
else
{
{
$template =& $manager->getTemplate($template_name);
}
-
+
$key = postVar('ackey');
if ( !$key )
{
Admin::error(_ERROR_ACTIVATE);
}
-
+
$info = MEMBER::getActivationInfo($key);
if ( !$info )
{
Admin::error(_ERROR_ACTIVATE);
}
-
+
$mem =& $manager->getMember($info->vmember);
if ( !$mem )
{
break;
}
$aVars = array(
- 'memberName' => Entity::hsc($mem->getDisplayName()),
- 'realName' => Entity::hsc($mem->getRealName()),
+ 'memberName' => Entity::hsc($mem->getDisplayName()),
+ 'realName' => Entity::hsc($mem->getRealName()),
);
switch ( $type )
{
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);
-
+
$resource = DB::getResult($query);
if ( $resource->rowCount() > 0 )
{
$template['content'] = 'banlist';
- $this->parser-parse(showlist($resource, 'table', $template, $template_name));
+ $ban_list = showlist($resource, 'table', $template, $template_name);
+ $this->parser-parse($ban_list);
}
else
{
{
global $manager;
$templates = array();
-
+
if ( !empty($template_name) )
{
$templates =& $manager->getTemplate($template_name);
}
-
+
if ( !array_key_exists('ADMIN_BATCHLIST', $templates) || empty($templates['ADMIN_BATCHLIST']) )
{
$template = '<li><%text(_BATCH_EXECUTING)%> '
{
$template = $templates['ADMIN_BATCHLIST'];
}
-
+
$selected = requestIntArray('batch');
$action = requestVar('batchaction');
-
+
switch ( $this->skintype )
{
case 'batchitem':
$destid = intRequestVar('destblogid');
break;
}
-
+
// walk over all selectedids and perform action
foreach ( $selected as $selectedid )
{
}
$data = array(
- 'batchid' => $selectedid,
- 'batchlisttype' => Entity::hsc($batchlisttype),
- 'adminbatchaction' => Entity::hsc($action),
- 'batchlistmsg' => $error ? $error : _BATCH_SUCCESS,
+ 'batchid' => $selectedid,
+ 'batchlisttype' => Entity::hsc($batchlisttype),
+ 'adminbatchaction' => Entity::hsc($action),
+ 'batchlistmsg' => $error ? $error : _BATCH_SUCCESS,
);
$this->parser->parse(Template::fill($template, $data));
$blogid = intRequestVar('blogid');
$blog =& $manager->getBlog($blogid);
$templates = array();
-
+
if ( !empty($template_name) )
{
$templates =& $manager->getTemplate($template_name);
}
-
+
if ( !array_key_exists('ADMIN_BLOGLINK', $templates) || empty($templates['ADMIN_BLOGLINK']) )
{
$template = '<a href="<%url%>" title="<%adminbloglinktitle%>"><%blogname%></a>';
{
$template = $templates['ADMIN_BLOGLINK'];
}
-
+
$data = array(
- 'url' => Entity::hsc($blog->getURL()),
- 'adminbloglinktitle' => _BLOGLIST_TT_VISIT,
- 'blogname' => Entity::hsc($blog->getName())
+ 'url' => Entity::hsc($blog->getURL()),
+ 'adminbloglinktitle' => _BLOGLIST_TT_VISIT,
+ 'blogname' => Entity::hsc($blog->getName())
);
-
+
echo Template::fill($template, $data);
return;
}
{
global $CONF;
$message = '';
-
+
if ( requestVar('errormessage') )
{
$message = requestVar('errormessage');
*/
public function parse_allowedskinactions()
{
+ global $manager;
+
$type = strtolower(trim(requestVar('type')));
$skinid = intRequestVar('skinid');
-
- if ( !preg_match('#^admin#', $this->skintype) )
+
+ if ( !in_array($this->skintype, Admin::$adminskin_actions) )
{
- $skin = new Skin($skinid);
+ $skin =& $manager->getSkin($skinid);
$tag = 'skinvar';
}
else
{
- $skin = new Skin($skinid, 'AdminActions');
+ $skin =& $manager->getSkin($skinid, 'AdminActions');
$tag = 'adminskinvar';
}
-
+
$actions = $skin->getAllowedActionsForType($type);
sort($actions);
-
+
while ( $current = array_shift($actions) )
{
echo helplink("{$tag}-{$current}") . "$current</a>\n";
-
+
if ( count($actions) != 0 )
{
echo ", ";
public function parse_banlistdeletedlist($template_name = '')
{
global $manager;
-
+
$templates = array();
if ( $template_name )
{
$templates =& $manager->getTemplate($template_name);
}
-
+
if ( !array_key_exists('BANLIST_DELETED_LIST', $templates) || empty($templates['BANLIST_DELETED_LIST']) )
{
$template = "<li><%blogname%></li>\n";
{
$template = $templates['BANLIST_DELETED_LIST'];
}
-
+
$deleted = requestArray('delblogs');
foreach ( $deleted as $delblog )
{
$blog =& $manager->getBlog($delblog);
$data = array(
- 'blogname' => Entity::hsc($blog->getName())
+ 'blogname' => Entity::hsc($blog->getName())
);
echo Template::fill($template, $data);
}
-
+
return;
}
{
$selected = requestIntArray('batch');
$index = 0;
-
+
foreach ( $selected as $select )
{
echo '<input type="hidden" name="batch[' . ($index++) . ']" value="' . intval($select) . "\" />\n";
}
return;
}
+
+ /**
+ * AdminActions::parse_defadminskinselect()
+ * Parse skinvar defadminskinselect
+ *
+ * @param string $template_name name of template to use
+ * @return void
+ */
+ public function parse_defadminskinselect($template_name)
+ {
+ global $CONF, $action, $manager;
+
+ if ( $action == 'editmembersettings' )
+ {
+ global $member;
+ $default = $member->adminskin;
+ }
+ elseif ( $action == 'memberedit' )
+ {
+ $mem = $manager->getMember(intRequestVar('memberid'));
+ $default = $mem->adminskin;
+ }
+ else
+ {
+ $default = $CONF['AdminSkin'];
+ }
+
+ $query = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdname LIKE 'admin/%%'";
+ $query = sprintf($query, sql_table('skin_desc'));
+ $template = array(
+ 'name' => 'adminskin',
+ 'tabindex' => 10080,
+ 'selected' => $default
+ );
+
+ if ( $this->skintype != 'settingsedit' )
+ {
+ $template['extra'] = Entity::hsc(_MEMBERS_USESITELANG);
+ }
+
+ $skin_select = showlist($query, 'select', $template, $template_name);
+ $this->parser->parse($skin_select);
+ return;
+ }
+
+ /**
+ * AdminActions::parse_defbookmarkletselect()
+ * Parse skinvar defbookmarkletselect
+ *
+ * @param string $template_name name of template to use
+ * @return void
+ */
+ public function parse_defbookmarkletselect($template_name)
+ {
+ global $CONF, $action, $manager;
+
+ if ( $action == 'editmembersettings' )
+ {
+ global $member;
+ $default = $member->bookmarklet;
+ }
+ elseif ( $action == 'memberedit' )
+ {
+ $mem = $manager->getMember(intRequestVar('memberid'));
+ $default = $mem->bookmarklet;
+ }
+ else
+ {
+ $default = $CONF['BookmarkletSkin'];
+ }
+
+ $query = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdname LIKE 'admin/%%'";
+ $query = sprintf($query, sql_table('skin_desc'));
+
+ $template = array(
+ 'name' => 'bookmarklet',
+ 'tabindex' => 10085,
+ 'selected' => $default
+ );
+
+ if ( $this->skintype != 'settingsedit' )
+ {
+ $template['extra'] = Entity::hsc(_MEMBERS_USESITELANG);
+ }
+
+ $bookmarklet_select = showlist($query, 'select', $template, $template_name);
+ $this->parser->parse($bookmarklet_select);
+ return;
+ }
/**
* AdminActions::parse_batchdeletetype()
$blogid = intRequestVar('blogid');
$query = "SELECT * FROM %s WHERE cblog = %d ORDER BY cname;";
$query = sprintf($query, sql_table('category'), (integer) $blogid);
-
+
$resource = DB::getResult($query);
if ( $resource->rowCount() > 0 )
{
$template['content'] = 'categorylist';
$template['tabindex'] = 200;
- $this->parser->parse(listplug_batchlist('category', $resource, 'table', $template));
+ $category_list = listplug_batchlist('category', $resource, 'table', $template, $template_name);
+ $this->parser->parse($category_list);
}
else
{
/* TODO: nothing to be shown */
}
$resource->closeCursor();
-
+
return;
}
global $manager;
$blogid = intRequestVar('blogid');
$blog =& $manager->getBlog($blogid);
-
+
switch ( $type )
{
case 'comment':
{
$template['content'] = 'teamlist';
$template['tabindex'] = 10;
-
- $this->parser->parse(listplug_batchlist('team', $resource, 'table', $template));
+
+ $team_list = listplug_batchlist('team', $resource, 'table', $template, $template_name);
+ $this->parser->parse($team_list);
}
else
{
public function parse_blogtime($type, $format = '%H:%M', $offset = 0)
{
global $manager;
-
+
if ( $type != 'blogtime' )
{
/* return server time */
public function parse_categories($startidx = 0)
{
global $manager;
-
- $item = FALSE;
- $itemid = intRequestVar('itemid');
- $item = &$manager->getItem($itemid, 1, 1);
-
- $blog = FALSE;
- if ( !$item )
- {
- $blogid = intRequestVar('blogid');
- }
- else
- {
- $blogid = $item['blogid'];
- }
- $blog = &$manager->getBlog($blogid);
-
- if ( $item && $blog->convertBreaks() && requestVar('action') == 'itemedit' )
- {
- $item['body'] = removeBreaks($item['body']);
- $item['more'] = removeBreaks($item['more']);
- }
-
- $contents = array();
- if ( requestVar('action') == 'itemedit' )
- {
- $contents = $item;
- }
-
- if ( !array_key_exists('catid', $contents) || empty($contents['catid']) )
+
+ if ( !array_key_exists('catid', Admin::$contents) || empty(Admin::$contents['catid']) )
{
- // on add item
- $catid = $blog->getDefaultCategory();
+ $catid = Admin::$blog->getDefaultCategory();
}
else
{
- // on edit item
- $catid = $contents['catid'];
+ $catid = Admin::$contents['catid'];
}
-
- $this->selectBlog('catid', 'category', $catid, $startidx, 1, $blog->getID());
-
- return;
- }
-
- /**
- * AdminActions::parse_category()
- * Parse skinvar category
- *
- * @param string $type name of setting for category
- * @return void
- */
- public function parse_category($type = 'name')
- {
- echo $this->parse_getcategory($type);
+
+ $this->selectBlog('catid', 'category', $catid, $startidx, 1, Admin::$blog->getID());
+
return;
}
-
+
/**
* AdminActions::parse_categorysetting()
* Parse skinvar categorysetting
$query = "SELECT * FROM %s WHERE cblog = %d AND catid = %d;";
$query = sprintf($query, sql_table('category'), (integer) $blogid, (integer) $catid);
$row = DB::getRow($query);
-
+
if ( $type != 'name' )
{
echo Entity::hsc($row['cdesc']);
{
echo Entity::hsc($row['cname']);
}
-
+
return;
}
public function parse_checkedonval($value, $name)
{
global $manager;
-
+
$item = false;
$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' )
{
* AdminActions::parse_commentnavlist()
* Parse skinvar commentnavlist
*
- * @param void
+ * @param string $template_name name of template to use
* @return void
*/
- public function parse_commentnavlist()
+ public function parse_commentnavlist($template_name = '')
{
global $CONF, $manager, $member;
-
+
// start index
if ( postVar('start') )
{
{
$start = 0;
}
-
+
// amount of items to show
if ( postVar('amount') )
{
}
}
$query = 'SELECT cbody, cuser, cmail, cemail, mname, ctime, chost, cnumber, cip, citem '
- . 'FROM %s '
- . 'LEFT OUTER JOIN %s ON mnumber=cmember '
- . 'WHERE ';
+ . 'FROM %s '
+ . 'LEFT OUTER JOIN %s ON mnumber=cmember '
+ . 'WHERE ';
$query = sprintf($query, sql_table('comment'), sql_table('member'));
-
+
if ( $this->skintype == 'itemcommentlist' )
{
$itemid = intRequestVar('itemid');
$bid = intRequestVar('blogid');
$nonComments = _NOCOMMENTS_BLOG;
}
-
+
$search = postVar('search');
if ( !empty($search) )
{
$query .= ' and cbody LIKE ' . DB::quoteValue('%'.$search.'%');
}
-
+
$query .= " ORDER BY ctime ASC LIMIT {$start},{$amount}";
-
+
$resource = DB::getResult($query);
if ( $resource->rowCount() > 0 )
{
$template['content'] = 'commentlist';
- $this->parser->parse(listplug_navlist('comment', $query, 'table', $template));
+ $navlist = listplug_navlist('comment', $resource, 'table', $template, $template_name);
+ $this->parser->parse($navlist);
}
else
{
/* TODO: nothing to be shown */
}
$resource->closeCursor();
-
+
return;
}
public function parse_normalskinlist($template_name = '')
{
global $CONF, $manager;
-
- if ( !preg_match('#^admin#', $this->skintype) )
+
+ if ( !in_array($this->skintype, Admin::$adminskin_actions) )
{
- $skin = new Skin($CONF['BaseSkin']);
+ $skin =& $manager->getSkin($CONF['BaseSkin']);
/* TODO: removeaction? */
$template['editaction'] = 'skinedittype';
}
else
{
- $skin = new Skin($CONF['AdminSkin'], 'AdminActions');
+ $skin =& $manager->getSkin($CONF['AdminSkin'], 'AdminActions');
$template['editaction'] = 'adminskinedittype';
/* TODO: removeaction? */
}
-
- $temporary = $skin->getDefaultTypes();
+
+ $temporary = $skin->getNormalTypes();
$normal_skintype = array();
foreach ( $temporary as $type => $label )
{
$normal_skintype[] = array(
- 'skintype' => $type,
- 'skintypename' => $label
+ 'skintype' => $type,
+ 'skintypename' => $label
);
}
-
+
$template['tabindex'] = 10;
- $template['skinid'] = $skin->getID();
+ $template['skinid'] = intRequestVar('skinid');
$template['skinname'] = $skin->getName();
- $this->parser->parse(showlist($normal_skintype, 'list_normalskinlist', $template, $template_name));
-
+ $skin_list = showlist($normal_skintype, 'list_normalskinlist', $template, $template_name);
+ $this->parser->parse($skin_list);
+
return;
}
public function parse_defblogselect($template_name = '')
{
global $CONF;
-
+
$query = "SELECT bname as text, bnumber as value FROM %s;";
$query = sprintf($query, sql_table('blog'));
-
+
$template['name'] = 'DefaultBlog';
$template['selected'] = $CONF['DefaultBlog'];
$template['tabindex'] = 10;
- $this->parser->parse(showlist($query, 'select', $template, $template_name));
-
+ $blog_select = showlist($query, 'select', $template, $template_name);
+ $this->parser->parse($blog_select);
+
return;
}
public function parse_defcatselect($template_name = '')
{
global $manager;
-
+
$blogid = intRequestVar('blogid');
$blog =& $manager->getBlog($blogid);
-
+
$query = "SELECT cname as text, catid as value FROM %s WHERE cblog=%d;";
$query = sprintf($query, sql_table('category'), (integer) $blog->getID());
-
+
$template['name'] = 'defcat';
$template['selected'] = $blog->getDefaultCategory();
$template['tabindex'] = 110;
-
- $this->parser->parse(showlist($query, 'select', $template, $template_name));
-
+
+ $category_select = showlist($query, 'select', $template, $template_name);
+ $this->parser->parse($category_select);
+
return;
}
public function parse_defskinselect($type = 'blog', $template_name = '')
{
global $CONF, $manager, $member;
-
- if ( !preg_match('#^admin#', $this->skintype) )
+
+ if ( !in_array($this->skintype, Admin::$adminskin_actions) )
{
$blogid = intRequestVar('blogid');
if ( !$blogid )
$template['name'] = 'AdminSkin';
$query = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdname LIKE 'admin/%%';";
}
-
+
$query = sprintf($query, sql_table('skin_desc'));
$template['tabindex'] = 50;
-
- $this->parser->parse(showlist($query, 'select', $template, $template_name));
-
+
+ $skin_select = showlist($query, 'select', $template, $template_name);
+ $this->parser->parse($skin_select);
+
return;
}
{
$commentid = intRequestVar('commentid');
$comment = COMMENT::getComment($commentid);
-
+
switch ( $type )
{
case 'id':
public function parse_deleteitembody()
{
global $manager;
-
+
$itemid = intRequestVar('itemid');
$item =& $manager->getItem($itemid, 1, 1);
-
+
$body = strip_tags($item['body']);
-
+
echo Entity::hsc(shorten($body, 300, '...'));
-
+
return;
}
public function parse_deleteitemtitle()
{
global $manager;
-
+
$itemid = intRequestVar('itemid');
$item =& $manager->getItem($itemid, 1, 1);
-
+
echo Entity::hsc(strip_tags($item['title']));
-
+
return;
}
public function parse_editcomment($type = 'id')
{
global $manager;
-
- $commentid = intRequestVar('commentid');
- $comment = COMMENT::getComment($commentid);
-
- $manager->notify('PrepareCommentForEdit', array('comment' => &$comment));
-
- switch ( $type )
+
+ $comment = Admin::$contents;
+
+ switch ( $type )
{
case 'id':
echo intRequestVar('commentid');
echo $comment['userid'];
break;
default:
- echo $comment[$type];
+ if ( array_key_exists($type, $comment) && !empty($comment[$type]) )
+ {
+ echo $comment[$type];
+ }
break;
}
return;
{
$template['content'] = 'memberlist';
$template['tabindex'] = 10;
-
- $this->parser->parse(listplug_batchlist('member', $resource, 'table', $template));
+
+ $member_list = listplug_batchlist('member', $resource, 'table', $template, $template_name);
+ $this->parser->parse($member_list);
}
else
{
public function parse_editmember($type = 'id', $template_name = '')
{
global $CONF, $manager, $member;
-
+
$memberid = intRequestVar('memberid');
$mem =& $manager->getMember($memberid);
-
+
switch ( $type )
{
case 'id':
public function parse_editpluginfo($type)
{
global $manager;
-
+
$pid = intRequestVar('plugid');
switch ( $type )
{
public function parse_editplugoptionslist($template_name = '')
{
global $manager;
-
+
$pid = intRequestVar('plugid');
$aOptions = array();
$aOIDs = array();
-
+
$query = "SELECT * FROM %s WHERE ocontext='global' AND opid=%d ORDER BY oid ASC;";
$query = sprintf($query, sql_table('plugin_option_desc'), (integer) $pid);
$resource = DB::getResult($query);
-
+
foreach ( $resource as $row )
{
$aOIDs[] = $row['oid'];
$aOptions[$row['oid']] = array(
- 'oid' => $row['oid'],
- 'value' => $row['odef'],
- 'name' => $row['oname'],
- 'description' => $row['odesc'],
- 'type' => $row['otype'],
- 'typeinfo' => $row['oextra'],
- 'contextid' => 0
+ 'oid' => $row['oid'],
+ 'value' => $row['odef'],
+ 'name' => $row['oname'],
+ 'description' => $row['odesc'],
+ 'type' => $row['otype'],
+ 'typeinfo' => $row['oextra'],
+ 'contextid' => 0
);
}
-
+
// fill out actual values
if ( count($aOIDs) > 0 )
{
// call plugins
$data = array(
- 'context' => 'global',
- 'plugid' => $pid,
- 'options' => &$aOptions
+ 'context' => 'global',
+ 'plugid' => $pid,
+ 'options' => &$aOptions
);
$manager->notify('PrePluginOptionsEdit', $data);
-
+
if ( sizeof($aOptions) > 0 )
{
$template['content'] = 'plugoptionlist';
- $this->parser->parse(showlist($aOptions, 'table', $template, $template_name));
+ $option_list = showlist($aOptions, 'table', $template, $template_name);
+ $this->parser->parse($option_list);
}
else
{
*/
public function parse_editskin($type = 'id')
{
+ global $manager;
+
$skinid = intRequestVar('skinid');
-
- if ( !preg_match('#^admin#', $this->skintype) )
+
+ if ( !in_array($this->skintype, Admin::$adminskin_actions) )
{
- $skin = new SKIN($skinid);
+ $skin =& $manager->getSKIN($skinid);
}
else
{
- $skin = new SKIN($skinid, 'AdminActions');
+ $skin =& $manager->getSKIN($skinid, 'AdminActions');
}
-
+
switch ( $type )
{
case 'id':
*/
public function parse_editskintype($stype = 'id')
{
+ global $manager;
+
static $skin = NULL;
static $types = array();
{
$skinid = intRequestVar('skinid');
- if ( !preg_match('#^admin#', $this->skintype) )
+ if ( !in_array($this->skintype, Admin::$adminskin_actions) )
{
- $skin = new Skin($skinid);
+ $skin =& $manager->getSkin($skinid);
}
else
{
- $skin = new Skin($skinid, 'AdminActions');
+ $skin =& $manager->getSkin($skinid, 'AdminActions');
}
- $types = $skin->getDefaultTypes();
+ $types = $skin->getNormalTypes();
}
$type = strtolower(trim(requestVar('type')));
static $id = NULL;
static $name = NULL;
static $desc = NULL;
-
+
if ( $id == NULL )
{
$id = intRequestVar('templateid');
}
-
+
if ( $name == NULL )
{
$name = Template::getNameFromId($id);
}
-
+
if ( $desc == NULL )
{
$desc = Template::getDesc($id);
}
-
+
$template =& $manager->getTemplate($name);
-
+
switch ( $format )
{
case 'id':
case 'extratemplate':
$tabidx = 600;
$pluginfields = array();
- if ( !preg_match('#^admin/#', $this->skintype) )
+ if ( !in_array($this->skintype, Admin::$adminskin_actions) )
{
- $manager->notify('TemplateExtraFields', array('fields' => &$pluginfields));
+ $data = array('fields' => &$pluginfields);
+ $manager->notify('TemplateExtraFields', $data);
}
else
{
- $manager->notify('AdminTemplateExtraFields', array('fields' => &$pluginfields));
+ $data = array('fields' => &$pluginfields);
+ $manager->notify('AdminTemplateExtraFields', $data);
}
-
+
foreach ( $pluginfields as $ptkey => $ptvalue )
{
$tmplt = array();
/* extra plugin field */
if ( !array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) || empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
{
- $base = "</tr>\n"
- . "<tr>\n"
- . "<th colspan=\"2\"><%explugtplname%></th>\n";
+ $base = "<tr>\n"
+ . "<th colspan=\"2\"><%explugtplname%></th>\n"
+ . "</tr>";
}
else
{
$base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
}
$data = array(
- 'explugtplname' => Entity::hsc($ptkey)
+ 'explugtplname' => Entity::hsc($ptkey)
);
echo Template::fill($base, $data);
{
$content = $template[$ptname];
}
- $this->parser->parse(listplug_templateEditRow($content, $ptdesc, $ptname, $help, $tabidx++, $big, $template_name));
+ $tempate_textarea = listplug_templateEditRow($content, $ptdesc, $ptname, $help, $tabidx++, $big, $template_name);
+ $this->parser->parse($tempate_textarea);
continue;
}
}
default:
$typedesc = defined($typedesc) ? constant($typedesc) : $typedesc;
$typename = defined($typename) ? constant($typename) : $typename;
-
+
if ( !array_key_exists($typename, $template) )
{
$content = '';
{
$content = $template[$typename];
}
- $this->parser->parse(listplug_templateEditRow($content, $typedesc, $typename, $help, $tabindex, $big, $template_name));
+ $tempate_textarea = listplug_templateEditRow($content, $typedesc, $typename, $help, $tabindex, $big, $template_name);
+ $this->parser->parse($tempate_textarea);
break;
}
-
+
return;
}
public function parse_eventformextra($type = 'activation')
{
global $manager;
-
+
$data = array();
-
+
switch ( $type )
{
case 'activation':
Admin::error(_ERROR_ACTIVATE);
}
$data = array(
- 'type' => 'activation',
- 'member' => $mem
+ 'type' => 'activation',
+ 'member' => $mem
);
break;
case 'membermailform-notloggedin':
public function parse_extrahead()
{
global $manager;
-
- $extrahead = Admin::getAdminextrahead();
-
+
$data = array(
-'extrahead' => &$extrahead,
-'action' => Admin::getAdminAction()
+ 'extrahead' => &Admin::$extrahead,
+ 'action' => Admin::$action
);
-
+
$manager->notify('AdminPrePageHead', $data);
- echo $extrahead;
+
+ $this->parser->parse(Admin::$extrahead);
return;
}
public function parse_member($what)
{
global $memberinfo, $member, $CONF;
-
+
// 1. only allow the member-details-page specific variables on member pages
if ( $this->skintype == 'member' )
{
break;
}
}
-
+
// 2. the next bunch of options is available everywhere, as long as the user is logged in
if ( $member->isLoggedIn() )
{
public function parse_getblogsetting($which)
{
global $blog, $manager;
-
+
if ( $blog )
{
$b =& $blog;
switch ( $type )
{
case 'info':
- echo Entity::hsc(requestVar('skininfo'));
+ echo Entity::hsc(Admin::$contents['skininfo']);
break;
case 'snames':
- $dataArr = requestArray('skinnames');
+ $dataArr = Admin::$contents['skinnames'];
echo implode(' <em>' . _AND . '</em> ', $dataArr);
break;
case 'tnames':
- $dataArr = requestArray('tpltnames');
+ $dataArr = Admin::$contents['tpltnames'];
echo implode(' <em>' . _AND . '</em> ', $dataArr);
break;
case 'sclashes':
- $dataArr = requestArray('skinclashes');
+ $dataArr = Admin::$contents['skinclashes'];
echo implode(' <em>' . _AND . '</em> ', $dataArr);
break;
case 'tclashes':
- $dataArr = requestArray('tpltclashes');
+ $dataArr = Admin::$contents['tpltclashes'];
echo implode(' <em>' . _AND . '</em> ', $dataArr);
break;
case 'skinfile':
- echo Entity::hsc(requestVar('skinfile'));
+ echo Entity::hsc(Admin::$contents['skinfile']);
break;
case 'mode':
- echo Entity::hsc(requestVar('mode'));
+ echo Entity::hsc(Admin::$contents['mode']);
break;
}
return;
public function parse_init()
{
global $manager;
-
+
$authorid = '';
if ( requestVar('action') == 'itemedit' )
{
$authorid = Admin::$contents['authorid'];
}
-
+
Admin::$blog->insertJavaScriptInfo($authorid);
return;
}
*/
public function parse_inputyesno($name, $checkedval, $tabindex = 0, $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO, $isAdmin = 0, $template_name = '')
{
- $this->parser->parse(listplug_input_yesno($name, $checkedval, $tabindex, $value1, $value2, $yesval, $noval, $isAdmin, $template_name));
+ $input_yesno = listplug_input_yesno($name, $checkedval, $tabindex, $value1, $value2, $yesval, $noval, $isAdmin, $template_name);
+ $this->parser->parse($input_yesno);
return;
}
*/
public function parse_insertpluginfo($type)
{
- $option = Admin::getAdminaOption();
switch ( $type )
{
case 'id':
- return $option['pid'];
+ return Admin::$aOptions['pid'];
break;
case 'name':
- return Entity::hsc($option['pfile']);
+ return Entity::hsc(Admin::$aOptions['pfile']);
break;
}
return;
*/
public function parse_insplugoptcontent()
{
- $option = Admin::getAdminaOption();
-
- $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
+ $meta = NucleusPlugin::getOptionMeta(Admin::$aOptions['typeinfo']);
if ( array_key_exists('access', $meta) && $meta['access'] != 'hidden' )
{
echo '<tr>';
- listplug_plugOptionRow($option);
+ listplug_plugOptionRow(Admin::$aOptions);
echo '</tr>';
}
return;
* AdminActions::parse_itemnavlist()
* Parse skinvar itemnavlist
*
- * @param void
+ * @param string $template_name name of template to use
* @return void
*/
- public function parse_itemnavlist($template_name)
+ 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'));
-
+
if ( $this->skintype == 'itemlist' )
{
$blog = FALSE;
$blogid = 0;
$template['now'] = time();
}
-
+
// search through items
$search = postVar('search');
-
+
if ( !empty($search) )
{
$query .= ' AND ((ititle LIKE ' . DB::quoteValue('%'.$search.'%') . ') '
. ' OR (ibody LIKE ' . DB::quoteValue('%'.$search.'%') . ') '
. ' OR (imore LIKE ' . DB::quoteValue('%'.$search.'%') . '))';
}
-
+
if ( postVar('start') )
{
$start = intPostVar('start');
{
$start = 0;
}
-
+
// amount of items to show
if ( postVar('amount') )
{
$amount = 10;
}
}
-
+
$query .= ' ORDER BY itime DESC'
- . " LIMIT {$start},{$amount}";
-
+ . " LIMIT {$start},{$amount}";
+
$resource = DB::getResult($query);
if ( $resource->rowCount() > 0 )
{
$template['content'] = 'itemlist';
- $this->parser->parse(listplug_navlist('item', $query, 'table', $template));
+ $navlist = listplug_navlist('item', $query, 'table', $template, $template_name);
+ $this->parser->parse($navlist);
}
else
{
public function parse_itemtime($key)
{
global $manager;
-
- $item = false;
- $itemid = intRequestVar('itemid');
- $item =& $manager->getItem($itemid, 1, 1);
-
- $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
-
- if ( $item && $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
- );
- $manager->notify('PreAddItemForm', $data);
- }
+
+ $contents = Admin::$contents;
$itemtime = getdate($contents['timestamp']);
echo $itemtime[$key];
return;
{
global $CONF;
$options = array(
- _SETTINGS_JSTOOLBAR_NONE,
- _SETTINGS_JSTOOLBAR_SIMPLE,
- _SETTINGS_JSTOOLBAR_FULL
+ _SETTINGS_JSTOOLBAR_NONE,
+ _SETTINGS_JSTOOLBAR_SIMPLE,
+ _SETTINGS_JSTOOLBAR_FULL
);
-
+
$i = 1;
foreach ( $options as $option )
{
*/
public function parse_localeselectoptions()
{
- global $manager;
-
+ global $CONF, $member;
+
$locales = i18n::get_available_locale_list();
-
- $memid = intRequestVar('memberid');
- if ( $memid )
+
+ /* default option */
+ if ( $this->skintype == 'editmembersettings' )
{
- $mem =& $manager->getMember($memid);
- if ( !$mem->getLocale() || !in_array($mem->getLocale(), $locales) )
+ if ( !$member->getLocale() )
{
echo "<option value=\"\" selected=\"selected\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
}
}
else
{
- if ( !i18n::get_current_locale() || !in_array(i18n::get_current_locale(), $locales) )
+ if ( $CONF['Locale'] == 'en_Latn_US' )
{
- echo "<option value=\"\" selected=\"selected\">en_Latn_US</option>\n";
+ echo "<option value=\"\" selected=\"selected\">" . Entity::hsc(_LOCALE_EN_LATN_US) . "</option>\n";
}
else
{
- echo "<option value=\"\">en_Latn_US</option>\n";
+ echo "<option value=\"\">" . Entity::hsc(_LOCALE_EN_LATN_US) . "</option>\n";
}
}
+
+ /* optional options */
foreach ( $locales as $locale )
{
- if ( $locale == 'en_Latn_US' )
- {
- continue;
- }
- else if ($memid)
+ if ( $this->skintype == 'editmembersettings' )
{
- if ( $locale == $mem->getLocale() )
+ if ( $locale != $member->getLocale() )
{
- echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
+ echo "<option value=\"{$locale}\">";
}
else
{
- echo "<option value=\"{$locale}\">{$locale}</option>\n";
+ echo "<option value=\"{$locale}\" selected=\"selected\">";
}
}
else
{
- if ( $locale == i18n::get_current_locale() )
+ if ( $locale == 'en_Latn_US' )
+ {
+ /* already output */
+ continue;
+ }
+ else if ( $locale != $CONF['Locale'] )
{
- echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
+ echo "<option value=\"{$locale}\">";
}
else
{
- echo "<option value=\"{$locale}\">{$locale}</option>\n";
+ echo "<option value=\"{$locale}\" selected=\"selected\">";
}
}
+ $label = '_LOCALE_' . strtoupper($locale);
+ if ( !defined($label) )
+ {
+ echo $locale;
+ }
+ else
+ {
+ echo constant($label);
+ }
+ echo "</option>\n";
}
return;
}
*/
public function parse_listplugplugoptionrow($template_name = '')
{
- echo listplug_plugOptionRow(Admin::getAdminaOption(), $template_name);
+ echo listplug_plugOptionRow(Admin::$aOptions, $template_name);
return;
}
public function parse_newestcompare()
{
global $nucleus;
-
+
$newestVersion = getLatestVersion();
$newestCompare = str_replace('/', '.', $newestVersion);
$currentVersion = str_replace(array('/', 'v'), array('.', ''), $nucleus['version']);
-
+
if ( $newestVersion && version_compare($newestCompare, $currentVersion, '>') )
{
echo '<br /><a style="color:red" href="http://nucleuscms.org/upgrade.php" title="' . _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TITLE . '">';
echo _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TEXT . $newestVersion . '</a>';
}
+ else
+ {
+ echo _ADMIN_SYSTEMOVERVIEW_VERSION_LATEST;
+ }
return;
}
public function parse_newmemberselect($template_name = '')
{
$blogid = intRequestVar('blogid');
-
+
$query = "SELECT tmember FROM %s WHERE tblog=%d;";
$query = sprintf($query, sql_table('team'), (integer) $blogid);
$res = DB::getResult($query);
-
+
$tmem = array();
foreach ( $res as $row )
{
$tmem[] = intval($row['tmember']);
}
-
+
$query = "SELECT mname as text, mnumber as value FROM %s WHERE mnumber NOT IN (%s);";
$query = sprintf($query, sql_table('member'), implode(', ', $tmem));
-
+
$template = array(
- 'name' => 'memberid',
- 'tabindex' => 10000,
- 'selected' => 0
+ 'name' => 'memberid',
+ 'tabindex' => 10000,
+ 'selected' => 0
);
- $this->parser->parse(showlist($query, 'select', $template, $template_name));
+ $member_select = showlist($query, 'select', $template, $template_name);
+ $this->parser->parse($member_select);
return;
}
public function parse_outputspecialdirs($type)
{
global $DIR_MEDIA, $DIR_NUCLEUS;
-
+
switch ( $type )
{
case 'nucleusdir':
*/
public function parse_passrequestvars()
{
- $passvar = Admin::getAdminpassvar();
+ $passvar = Admin::$passvar;
$oldaction = postVar('oldaction');
-
+
if ( ($oldaction != 'logout')
&& ($oldaction != 'login')
&& $passvar
public function parse_pluginextras($type = 'global')
{
global $manager;
-
+
switch ( $type )
{
case 'member':
$id = intRequestVar('memberid');
$mem =& $manager->getMember($id);
- $manager->notify('MemberSettingsFormExtras', array('member' => &$mem));
+ $data = array('member' => &$mem);
+ $manager->notify('MemberSettingsFormExtras', $data);
break;
case 'blog':
$id = intRequestVar('blogid');
$blg =& $manager->getBlog($id);
- $manager->notify('BlogSettingsFormExtras', array('member' => &$blg));
+ $data = array('member' => &$blg);
+ $manager->notify('BlogSettingsFormExtras', $data);
break;
case 'createaccount':
$data = array(
- 'type' => 'createaccount.php',
- 'prelabel' => '',
- 'postlabel' => '<br />',
- 'prefield' => '',
- 'postfield' => '<br /><br />'
- );
- $manager->notify('RegistrationFormExtraFields', $data);
- break;
+ 'type' => 'createaccount.php',
+ 'prelabel' => '',
+ 'postlabel' => '<br />',
+ 'prefield' => '',
+ 'postfield' => '<br /><br />'
+ );
+ $manager->notify('RegistrationFormExtraFields', $data);
+ break;
default:
- $manager->notify('GeneralSettingsFormExtras', array());
+ $data = array();
+ $manager->notify('GeneralSettingsFormExtras', $data);
break;
}
return;
public function parse_pluginhelp()
{
global $manager, $DIR_PLUGINS;
-
+
$plugid = intGetVar('plugid');
$plugName = $manager->getPluginNameFromPid($plugid);
$plug =& $manager->getPlugin($plugName);
-
+
if ( $plug->supportsFeature('HelpPage') > 0 )
{
$helpfile = $DIR_PLUGINS . $plug->getShortName() . '/help.';
{
$query = "SELECT * FROM %s ORDER BY porder ASC;";
$query = sprintf($query, sql_table('plugin'));
-
+
$template['content'] = 'pluginlist';
$template['tabindex'] = 10;
-
- $this->parser->parse(showlist($query, 'table', $template, $template_name));
-
+
+ $plugin_list = showlist($query, 'table', $template, $template_name);
+ $this->parser->parse($plugin_list);
+
return;
}
public function parse_pluginoptions($context='global', $template_name='')
{
global $itemid, $manager;
-
+
switch ( $context )
{
case 'member':
$contextid = $itemid;
break;
}
-
+
/* Actually registererd plugin options */
$aIdToValue = array();
$query = "SELECT oid, ovalue FROM %s WHERE ocontextid=%d;";
{
$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 )
{
{
$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' => ''
- );
+ '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' => &$options
+ 'context' => $context,
+ 'contextid' => $contextid,
+ 'options' => &$options
);
$manager->notify('PrePluginOptionsEdit', $data);
-
+
$template = array();
if ( $template_name )
{
{
$template['title'] = $templates['INSERT_PLUGOPTION_TITLE'];
}
-
+
if ( !array_key_exists('INSERT_PLUGOPTION_BODY', $templates) || empty($templates['INSERT_PLUGOPTION_BODY']) )
{
$template['body'] = "<tr>"
$template['body'] = $templates['INSERT_PLUGOPTION_BODY'];
}
}
-
+
$prevPid = -1;
-
+
foreach ( $options as $option )
{
// new plugin?
$prevPid = $option['pid'];
$this->parser->parse($template['title']);
}
-
+
$meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
-
+
if ( @$meta['access'] != 'hidden' )
{
$parsed = $this->parser->parse($template['body']);
$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['shorten'] = 10;
$template['shortenel'] = '';
$template['javascript'] = 'onchange="return form.submit()"';
-
- $this->parser->parse(showlist($query, 'select', $template, $template_name));
-
+
+ $selectlist = showlist($query, 'select', $template, $template_name);
+ $this->parser->parse($selectlist);
+
return;
}
{
global $manager;
$templates = array();
-
+
if ( !empty($template_name) )
{
$templates = & $manager->getTemplate($template_name);
}
$pluginExtras = array();
- $manager->notify('QuickMenu', array('options' => &$pluginExtras));
-
+ $data = array('options' => &$pluginExtras);
+ $manager->notify('QuickMenu', $data);
+
$template = array();
if ( count($pluginExtras) > 0 )
{
{
$template['head'] = $templates['PLUGIN_QUICKMENU_HEAD'];
}
-
+
if ( !array_key_exists('PLUGIN_QUICKMENU_BODY', $templates) && empty($templates['PLUGIN_QUICKMENU_BODY']) )
{
$template['body'] = "<li><a href=\"<%plugadminurl%>\" title=\"<%plugadmintooltip%>\"><%plugadmintitle%></a></li>\n";
{
$template['body'] = $templates['PLUGIN_QUICKMENU_BODY'];
}
-
+
if ( !array_key_exists('PLUGIN_QUICKMENU_FOOT', $templates) || empty($templates['PLUGIN_QUICKMENU_FOOT']) )
{
$template['foot'] = "</ul>\n";
{
$template['foot'] = $templates['PLUGIN_QUICKMENU_FOOT'];
}
-
+
$this->parser->parse($template['head']);
foreach ( $pluginExtras as $aInfo )
{
$data = array(
- 'plugadminurl' => Entity::hsc($aInfo['url']),
- 'plugadmintooltip' => Entity::hsc($aInfo['tooltip']),
- 'plugadmintitle' => Entity::hsc($aInfo['title']),
+ 'plugadminurl' => Entity::hsc($aInfo['url']),
+ 'plugadmintooltip' => Entity::hsc($aInfo['tooltip']),
+ 'plugadmintitle' => Entity::hsc($aInfo['title']),
);
- $this->parser->parse(Template::fill($template['body'], $data));
+ $body = Template::fill($template['body'], $data);
+ $this->parser->parse($body);
}
$this->parser->parse($template['foot']);
}
public function parse_selectlocalskinfiles()
{
global $DIR_SKINS;
-
+
if ( !class_exists('SkinImport', FALSE) )
{
include_libs('skinie.php');
}
-
- if ( !preg_match('#^admin#', $this->skintype) )
+
+ if ( !in_array($this->skintype, Admin::$adminskin_actions) && $this->skintype != 'importAdmin' )
{
$skindir = $DIR_SKINS;
}
{
$skindir = "{$DIR_SKINS}admin/";
}
-
+
$candidates = SkinImport::searchForCandidates($skindir);
foreach ( $candidates as $skinname => $skinfile )
{
- $skinfile = Entity::hsc($skinfile);
$skinname = Entity::hsc($skinname);
+ if ( !in_array($this->skintype, Admin::$adminskin_actions) && $this->skintype != 'importAdmin' )
+ {
+ $skinfile = Entity::hsc($skinfile);
+ }
+ else
+ {
+ $skinfile = Entity::hsc("admin/$skinfile");
+ }
echo "<option value=\"{$skinfile}\">{$skinname}</option>\n";
}
case 'blog':
$query = "SELECT bshortname, bname FROM %s;";
$show = array(
- 'content' => 'shortblognames'
+ 'content' => 'shortblognames'
);
$query = sprintf($query, sql_table('blog'));
break;
case 'template':
- if ( !preg_match('#^admin#', $this->skintype) )
+ if ( !in_array($this->skintype, Admin::$adminskin_actions) )
{
$query = "SELECT tdname as name, tddesc as description FROM %s WHERE tdname NOT LIKE 'admin/%%';";
}
$query = "SELECT tdname as name, tddesc as description FROM %s WHERE tdname LIKE 'admin/%%';";
}
$show = array(
- 'content' => 'shortnames'
+ 'content' => 'shortnames'
);
$query = sprintf($query, sql_table('template_desc'));
break;
}
-
- $this->parser->parse(showlist($query, 'table', $show, $template_name));
+
+ $skin_list = showlist($query, 'table', $show, $template_name);
+ $this->parser->parse($skin_list);
return;
}
public function parse_skinielist($type, $template_name = '')
{
global $manager;
-
+
$templates = array();
if ( $template_name )
{
}
if ( !array_key_exists('SKINIE_EXPORT_LIST', $templates) || empty($templates['SKINIE_EXPORT_LIST']) )
{
- $template = "<td>"
- . "<input type=\"checkbox\" name=\"<%typeid%>\" id=\"<%expid%>\" />\n"
- . "<label for=\"<%expid%>\"><%expname%></label>\n"
- . "</td>\n"
- . "<td><%expdesc%></td>\n"
- . "</tr>\n"
- . "<tr>\n";
+ $template = "<tr>\n"
+ . "<td>"
+ . "<input type=\"checkbox\" name=\"<%typeid%>\" id=\"<%expid%>\" />\n"
+ . "<label for=\"<%expid%>\"><%expname%></label>\n"
+ . "</td>\n"
+ . "<td><%expdesc%></td>\n"
+ . "</tr>\n";
}
else
{
$template = $templates['SKINIE_EXPORT_LIST'];
}
-
+
switch ( $type )
{
case 'skin':
- if ( !preg_match('#^admin#', $this->skintype) )
+ if ( !in_array($this->skintype, Admin::$adminskin_actions) )
{
$res = DB::getResult('SELECT * FROM ' . sql_table('skin_desc'). " WHERE sdname NOT LIKE 'admin/%%';");
}
foreach ( $res as $row )
{
$data = array(
- 'typeid' => 'skin[' . $row['sdnumber'] . ']',
- 'expid' => 'skinexp' . $row['sdnumber'],
- 'expname' => Entity::hsc($row['sdname']),
- 'expdesc' => Entity::hsc($row['sddesc'])
+ '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':
- if ( !preg_match('#^admin#', $this->skintype) )
+ if ( !in_array($this->skintype, Admin::$adminskin_actions) )
{
$res = DB::getResult('SELECT * FROM '.sql_table('template_desc'). " WHERE tdname NOT LIKE 'admin/%%';");
-
}
else
{
foreach ( $res as $row )
{
$data = array(
- 'typeid' => 'template[' . $row['tdnumber'] . ']',
- 'expid' => 'templateexp' . $row['tdnumber'],
- 'expname' => Entity::hsc($row['tdname']),
- 'expdesc' => Entity::hsc($row['tddesc'])
+ 'typeid' => 'template[' . $row['tdnumber'] . ']',
+ 'expid' => 'templateexp' . $row['tdnumber'],
+ 'expname' => Entity::hsc($row['tdname']),
+ 'expdesc' => Entity::hsc($row['tddesc'])
);
echo Template::fill($template, $data);
}
public function parse_skinoverview($template_name = '')
{
global $CONF;
-
+
$template = array();
- if ( !preg_match('#^admin#', $this->skintype) )
+ if ( !in_array($this->skintype, Admin::$adminskin_actions) )
{
$query = "SELECT * FROM %s WHERE sdname NOT LIKE 'admin/%%' ORDER BY sdname;";
+ $template['handler'] = 'Actions';
$template['editaction'] = 'skinedit';
$template['cloneaction'] = 'skinclone';
$template['deleteaction'] = 'skindelete';
else
{
$query = "SELECT * FROM %s WHERE sdname LIKE 'admin/%%' ORDER BY sdname;";
+ $template['handler'] = 'AdminActions';
$template['editaction'] = 'adminskinedit';
$template['cloneaction'] = 'adminskinclone';
$template['deleteaction'] = 'adminskindelete';
$template['default'] = $CONF['AdminSkin'];
}
$query = sprintf($query, sql_table('skin_desc'));
-
+
$template['tabindex'] = 10;
$template['content'] = 'skinlist';
-
- $this->parser->parse(showlist($query, 'table', $template, $template_name));
-
+
+ $skin_list = showlist($query, 'table', $template, $template_name);
+ $this->parser->parse($skin_list);
+
return;
}
*/
public function parse_skintypehelp()
{
- $nowSkinType = strtolower(trim(requestVar('type')));
- $pageAction = strtolower(trim(requestVar('action')));
- if ( preg_match('/^admin.*/', $pageAction) )
+ $surrent_skin_type = strtolower(trim(requestVar('type')));
+ $page_action = strtolower(trim(requestVar('action')));
+ if ( in_array($page_action, Admin::$adminskin_actions) )
{
- $regularType = self::$default_skin_types;
- unset($regularType['memberedit']);
- unset($regularType['login']);
- $regularType = array_keys($regularType);
+ $normal_types = array_keys(self::$normal_skin_types);
}
else
{
- /* TODO: use Skin class */
- $regularType = array(
- 'index',
- 'item',
- 'archivelist',
- 'archive',
- 'search',
- 'error',
- 'member',
- 'imagepopup'
- );
+ $normal_types = array_keys(Actions::getNormalSkinTypes());
}
-
- if ( in_array($nowSkinType, $regularType) )
+
+ if ( in_array($surrent_skin_type, $normal_types) )
{
- help('skinpart' . $nowSkinType);
+ help('skinpart' . $surrent_skin_type);
}
else
{
public function parse_specialskinlist($template_name = '')
{
global $CONF, $manager;
-
+
$template = array();
-
+
$skinid = intRequestVar('skinid');
-
- if ( !preg_match('#^admin#', $this->skintype) )
+
+ if ( !in_array($this->skintype, Admin::$adminskin_actions) )
{
- $skin = new Skin($skinid);
+ $skin =& $manager->getSkin($skinid);
$template['editaction'] = 'skinedittype';
$template['removeaction'] = 'skinremovetype';
}
else
{
- $skin = new Skin($skinid, 'AdminActions');
+ $skin =& $manager->getSkin($skinid, 'AdminActions');
$template['editaction'] = 'adminskinedittype';
$template['removeaction'] = 'adminskinremovetype';
}
- $normal_types = $skin->getDefaultTypes();
+ $normal_types = $skin->getNormalTypes();
$available_types = $skin->getAvailableTypes();
-
+
$special_skintypes = array();
foreach( $available_types as $skintype => $skinname )
{
if ( !array_key_exists($skintype, $normal_types) )
{
$special_skintypes[] = array(
- 'skintype' => $skintype,
- 'skintypename' => $skinname
+ 'skintype' => $skintype,
+ 'skintypename' => $skinname
);
}
}
-
+
if ( sizeof($special_skintypes) > 0 )
{
$template['tabindex'] = 75;
$template['skinid'] = $skin->getID();
$template['skinname'] = $skin->getName();
- $this->parser->parse(showlist($special_skintypes, 'list_specialskinlist', $template, $template_name));
+ $skin_list = showlist($special_skintypes, 'list_specialskinlist', $template, $template_name);
+ $this->parser->parse($skin_list);
}
else
{
{
$base = constant($which);
}
-
+
if ( preg_match('#[^<|%].*[^%|>]#', $val, $matchies) )
{
if ( !preg_match('#[(].*[^)]#', $matchies[0], $args) )
$arg = trim($args[0], '()');
$met = 'parse_' . substr($matchies[0], 0, strpos($matchies[0], '('));
}
-
+
if ( method_exists($this, $met) )
{
$value = call_user_func(array(&$this, $met), $arg);
}
}
-
+
if ( !isset($value) || empty($value) )
{
$value = $val;
public function parse_systemsettings($type = 'phpinfo', $template_name = '')
{
global $manager, $member, $CONF, $nucleus;
-
+
$member->isAdmin() or Admin::disallow();
-
+
$enable = _ADMIN_SYSTEMOVERVIEW_ENABLE;
$disable = _ADMIN_SYSTEMOVERVIEW_DISABLE;
-
+
switch ( $type )
{
case 'phpversion':
{
$template = $templates['SYSTEMINFO_GDSETTINGS'];
}
-
+
$gdinfo = gd_info();
-
+
foreach ( $gdinfo as $key => $value )
{
if ( is_bool($value) )
$value = Entity::hsc($value);
}
$data = array(
- 'key' => $key,
- 'value' => $value,
+ 'key' => $key,
+ 'value' => $value,
);
echo Template::fill($template, $data);
}
break;
case 'modrewrite':
- ob_start();
- phpinfo(INFO_MODULES);
- $im = ob_get_contents();
- ob_end_clean();
- echo ( i18n::strpos($im, 'mod_rewrite') !== FALSE ) ? $enable : $disable;
+ if ( function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules()) )
+ {
+ echo $enable;
+ }
+ else
+ {
+ ob_start();
+ phpinfo(INFO_MODULES);
+ $im = ob_get_contents();
+ ob_end_clean();
+ if ( i18n::strpos($im, 'mod_rewrite') !== FALSE )
+ {
+ echo $enable;
+ }
+ else
+ {
+ echo $disable;
+ }
+ }
break;
case 'nucleusversion':
echo getNucleusVersion() / 100 . '(' . $nucleus['version'] . ')';
*/
public function parse_templateoverview($template_name = '')
{
- if ( !preg_match('#^admin#', $this->skintype) )
+ if ( !in_array($this->skintype, Admin::$adminskin_actions) )
{
$query = "SELECT * FROM %s WHERE tdname NOT LIKE 'admin/%%' ORDER BY tdname;";
$template['deleteaction'] = 'templatedelete';
$template['cloneaction'] = 'admintemplateclone';
}
$query = sprintf($query, sql_table('template_desc'));
-
+
$template['tabindex'] = 10;
$template['content'] = 'templatelist';
-
- $this->parser->parse(showlist($query, 'table', $template, $template_name));
-
+
+ $template_list = showlist($query, 'table', $template, $template_name);
+ $this->parser->parse($template_list);
+
return;
}
{
global $member;
$showAll = requestVar('showall');
-
+
if ( $member->isAdmin() && ($showAll == 'yes') )
{
// Super-Admins have access to all blogs! (no add item support though)
. " ORDER BY bnumber;";
$query = sprintf($query, sql_table('blog'), sql_table('team'), (integer) $member->getID());
}
-
+
$resource = DB::getResult($query);
if ( ($showAll != 'yes') && $member->isAdmin() )
{
echo '<p><a href="index.php?action=overview&showall=yes">' . _OVERVIEW_SHOWALL . '</a></p>';
}
}
-
+
if ( $resource->rowCount() > 0 )
{
$template['content'] = 'bloglist';
$template['superadmin'] = $member->isAdmin();
- $this->parser->parse(showlist($resource, 'table', $template, $template_name));
+ $list_resource_table = showlist($resource, 'table', $template, $template_name);
+ $this->parser->parse($list_resource_table);
$resource->closeCursor();
echo '<h2>' . _OVERVIEW_YRDRAFTS . '</h2>';
if ( $resource->rowCount() > 0 )
{
$template['content'] = 'draftlist';
- $this->parser->parse(showlist($resource, 'table', $template, $template_name));
+ $draft_list = showlist($resource, 'table', $template, $template_name);
+ $this->parser->parse($draft_list);
}
else
{
echo _OVERVIEW_NOBLOGS;
}
$resource->closeCursor();
-
+
return;
}
protected function checkCondition($field, $name='', $value = '')
{
global $CONF, $archiveprevexists, $archivenextexists, $blog, $catid, $itemidnext, $itemidprev, $manager, $member;
-
+
$condition = 0;
switch ( $field )
{
$condition = $this->ifHasPlugin($name, $value);
break;
case 'adminaction':
- $condition = (Admin::getAdminAction() == $name);
+ $condition = (Admin::$action == $name);
break;
case 'adminoldaction':
- $condition = (Admin::getAdminAction() == $name);
+ $condition = (Admin::$action == $name);
break;
case 'addresschange':
$condition = ($this->ifAddresscange());
$condition = ($this->ifSkincandidates());
break;
case 'nameclashes':
- $condition = requestVar('nameclashes');
+ $condition = Admin::$contents['nameclashes'];
break;
case 'existsnewplugin':
$condition = ($this->existsNewPlugin());
private function ifPlugin($name, $key = '', $value = '')
{
global $manager;
-
+
$plugin =& $manager->getPlugin("NP_{$name}");
if ( !$plugin )
{
return;
}
-
+
$params = func_get_args();
array_shift($params);
-
+
return call_user_func_array(array(&$plugin, 'doIf'), $params);
}
private function ifCategory($key = '', $value='')
{
global $blog, $catid;
-
+
// when no parameter is defined, just check if a category is selected
if (($key != 'catname' && $key != 'catid') || ($value == ''))
{
return $blog->isValidCategory($catid);
}
-
+
// check category name
if ( $key == 'catname' )
{
return $blog->isValidCategory($catid);
}
}
-
+
// check category id
if (($key == 'catid') && ($value == $catid))
{
return $blog->isValidCategory($catid);
}
-
+
return FALSE;
}
private function ifOnTeam($blogName = '')
{
global $blog, $member, $manager;
-
+
// when no blog found
if ( ($blogName == '') && !is_object($blog) )
{
return 0;
}
-
+
// explicit blog selection
if ($blogName != '')
{
$blogid = getBlogIDFromName($blogName);
}
-
+
if (($blogName == '') || !$manager->existsBlogID($blogid))
{
// use current blog
private function ifAdmin($blogName = '')
{
global $blog, $member, $manager;
-
+
// when no blog found
if (($blogName == '') && (!is_object($blog)))
{
return 0;
}
-
+
// explicit blog selection
if ($blogName != '')
{
$blogid = getBlogIDFromName($blogName);
}
-
+
if (($blogName == '') || !$manager->existsBlogID($blogid))
{
// use current blog
static function customHelplink($id, $tplName = '', $url = '', $title = '', $onclick = '')
{
global $CONF, $manager;
-
+
$templates = array();
-
+
if ( $tplName )
{
$templates =& $manager->getTemplate($tplName);
}
-
+
if ( !array_key_exists('ADMIN_CUSTOMHELPLINK_ANCHOR', $templates) || empty($templates['ADMIN_CUSTOMHELPLINK_ANCHOR']) )
{
$template = "<a href=\"<%helpurl%>#<%helptarget%>\" title=\"<%title%>\" <%onclick%>>\n";
{
$template = $templates['ADMIN_CUSTOMHELPLINK_ANCHOR'];
}
-
+
if ( empty($url) )
{
$url = $CONF['AdminURL'] . 'documentation/customHelp.html';
}
-
+
if ( empty($onclick) )
{
$onclick = 'onclick="if (event && event.preventDefault) event.preventDefault(); return help(this.href);"';
{
$onclick = 'onclick="' . $onclick . '"';
}
-
+
$data = array(
-'helpurl' => $url,
-'helptarget' => $id,
-'onclick' => $onclick,
-'title' => (isset($title) && !empty($title)) ? $title : _HELP_TT,
+ 'helpurl' => $url,
+ 'helptarget' => $id,
+ 'onclick' => $onclick,
+ 'title' => (isset($title) && !empty($title)) ? $title : _HELP_TT,
);
return Template::fill($template, $data);
}
private function customHelpHtml($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
{
global $CONF, $manager;
-
+
$templates = array();
-
+
if ( $tplName )
{
$templates =& $manager->getTemplate($tplName);
{
$template = $templates['ADMIN_CUSTOMHELPLINK_ICON'];
}
-
+
if ( empty($iconURL) )
{
$iconURL = $CONF['AdminURL'] . 'documentation/icon-help.gif';
}
-
+
if ( function_exists('getimagesize') )
{
$size = getimagesize($iconURL);
$width = 'width="' . $size[0] . '" ';
$height = 'height="' . $size[1] . '" ';
}
-
+
$data = array(
-'iconurl' => $iconURL,
-'width' => $width,
-'height' => $height,
-'alt' => (isset($alt) && !empty($alt)) ? $alt : _HELP_TT,
-'title' => (isset($title) && !empty($title)) ? $title : _HELP_TT,
+ 'iconurl' => $iconURL,
+ 'width' => $width,
+ 'height' => $height,
+ 'alt' => (isset($alt) && !empty($alt)) ? $alt : _HELP_TT,
+ 'title' => (isset($title) && !empty($title)) ? $title : _HELP_TT,
);
-
+
$icon = Template::fill($template, $data);
$help = $this->customHelplink($id, $tplName, $url, $title, $onclick);
-
+
return $help . $icon;
}
private function existsNewPlugin()
{
global $DIR_PLUGINS;
-
+
$query = "SELECT * FROM %s;";
$query = sprintf($query, sql_table('plugin'));
$res = DB::getResult($query);
-
+
$installed = array();
foreach( $res as $row )
{
$installed[] = $row['pfile'];
}
-
+
$files = scandir($DIR_PLUGINS);
-
+
$candidates = array();
foreach ( $files as $file )
{
public function parse_pagehead()
{
global $member, $nucleus, $CONF, $manager;
-
- $extrahead = Admin::getAdminextrahead();
- $data = array(
-'extrahead' => &$extrahead,
-'action' => Admin::getAdminAction()
- );
- $manager->notify('AdminPrePageHead', $data);
-
+
+ /* HTTP 1.1 application for no caching */
+ header("Cache-Control: no-cache, must-revalidate");
+ header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
+
$content = $this->parser->skin->getContentFromDB('pagehead');
if ( !$content )
{
- $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);
+ $xml_version_info = '1.0';
+ $formal_public_identifier = '-//W3C//DTD XHTML 1.0 Strict//EN';
+ $system_identifier = 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd';
+ $xhtml_namespace = 'http://www.w3.org/1999/xhtml';
+
+ $content = "<?xml version=\"{$xml_version_info}\" encoding=\"{$charset}\" ?>\n"
+ . "<!DOCTYPE {$root_element} PUBLIC \"{$formal_public_identifier}\" \"{$system_identifier}\">\n"
+ . "<{$root_element} xmlns=\"{$xhtml_namespace}\" xml:lang=\"{$locale}\" lang=\"{$locale}\">\n"
+ . "<head>\n"
+ . "<title><%sitevar(name)%> - Admin</title>\n"
+ . "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/edit.js)%>\"></script>"
+ . "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/admin.js)%>\"></script>"
+ . "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/compatibility.js)%>\"></script>"
+ . "<%extrahead%>"
+ . "</head>"
+ . "<body>"
+ . "<div id=\"adminwrapper\">"
+ . "<div class=\"header\">"
+ . "<h1><%sitevar(name)%></h1>"
+ . "</div>"
+ . "<div id=\"container\">"
+ . "<div id=\"content\">"
+ . "<div class=\"loginname\">"
+ . "<link rel=\"stylesheet\" title=\"Nucleus Admin Default\" type=\"text/css\" href=\"<%skinfile(admin/defaultadmin/styles/addedit.css%>\" />\n"
+ . "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/edit.js)%>\"></script>\n"
+ . "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/admin.js)%>\"></script>\n"
+ . "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/compatibility.js)%>\"></script>\n"
+ . "<%extrahead%>\n"
+ . "</head>\n"
+ . "\n"
+ . "<body>\n"
+ . "<div id=\"adminwrapper\">\n"
+ . "<div class=\"header\">\n"
+ . "<h1><%sitevar(name)%></h1>\n"
+ . "</div>\n"
+ . "<div id=\"container\">\n"
+ . "<div id=\"content\">\n"
+ . "<div class=\"loginname\">\n"
+ . "<%if(loggedin)%>"
+ . "<%text(_LOGGEDINAS)%> <%member(yourrealname)%> - <a href=\"<%adminurl%>index.php?action=logout\"><%text(_LOGOUT)%></a><br />"
+ . "<a href=\"<%adminurl%>index.php?action=overview\"><%text(_ADMINHOME)%></a> - "
+ . "<%else%>"
+ . "<a href=\"<%adminurl%>index.php?action=showlogin\" title=\"Log in\"><%text(_NOTLOGGEDIN)%></a><br />"
+ . "<%endif%>"
+ . "<a href=\"<%sitevar(url)%>\"><%text(_YOURSITE)%></a><br />"
+ . "("
+ . "<%if(superadmin)%>"
+ . "<a href=\"<%versioncheckurl%>\" title=\"<%text(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TITLE)%>\"><%version%><%codename%></a>"
+ . "<%newestcompare%><%else%><%version%><%codename%>"
+ . "<%endif%>"
+ . ")"
+ . "</div>";
}
-
+
+ $this->parser->parse($content);
return;
}
{
global $action, $member, $manager, $blogid;
- $data = array(
- 'action' => Admin::getAdminAction()
- );
+ $data = array('action' => Admin::$action);
$manager->notify('AdminPrePageFoot', $data);
-
+
$content = $this->parser->skin->getContentFromDB('pagefoot');
if ( !$content )
{
- 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'] = $blogid;
- $template['shorten'] = 10;
- $template['shortenel'] = '';
- $template['javascript'] = 'onchange="return form.submit()"';
- $this->parser->parse(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->parse($content);
- exit;
+ $content = "<%if(loggedin)%>"
+ . "<%ifnot(adminaction,showlogin)%>"
+ . "<h2><%text(_LOGOUT)%></h2>"
+ . "<ul>"
+ . "<li><a href=\"<%adminurl%>index.php?action=overview\"><%text(_BACKHOME)%></a></li>"
+ . "<li><a href=\"<%adminurl%>index.php?action=logout\"><%text(_LOGOUT)%></a></li>"
+ . "</ul>"
+ . "<%endif%>"
+ . "<%endif%>"
+ . "<div class=\"foot\">"
+ . "<a href=\"<%text(_ADMINPAGEFOOT_OFFICIALURL)%>\">Nucleus CMS</a> © 2002- <%date(%Y)%> <%text(_ADMINPAGEFOOT_COPYRIGHT)%>"
+ . " - <a href=\"<%text(_ADMINPAGEFOOT_DONATEURL)%>\"><%text(_ADMINPAGEFOOT_DONATE)%></a>"
+ . "</div>"
+ . "</div>"
+ . "<!-- content -->"
+ . "<div id=\"quickmenu\">"
+ . "<%if(loggedin)%>"
+ . "<%ifnot(adminaction,showlogin)%>"
+ . "<ul>"
+ . "<li><a href=\"<%adminurl%>index.php?action=overview\"><%text(_QMENU_HOME)%></a></li>"
+ . "</ul>"
+ . "<h2><%text(_QMENU_ADD)%></h2>"
+ . "<form method=\"get\" action=\"<%adminurl%>index.php\">"
+ . "<div>"
+ . "<input type=\"hidden\" name=\"action\" value=\"createitem\" />"
+ . "<%qmenuaddselect(admin/default)%>"
+ . "</div>"
+ . "</form>"
+ . "<h2><%member(yourrealname)%></h2>"
+ . "<ul>"
+ . "<li><a href=\"<%adminurl%>index.php?action=editmembersettings\"><%text(_QMENU_USER_SETTINGS)%></a></li>"
+ . "<li><a href=\"<%adminurl%>index.php?action=browseownitems\"><%text(_QMENU_USER_ITEMS)%></a></li>"
+ . "<li><a href=\"<%adminurl%>index.php?action=browseowncomments\"><%text(_QMENU_USER_COMMENTS)%></a></li>"
+ . "</ul>"
+ . "<%if(superadmin)%>"
+ . "<h2><%text(_QMENU_MANAGE)%></h2>"
+ . "<ul>"
+ . "<li><a href=\"<%adminurl%>index.php?action=actionlog\"><%text(_QMENU_MANAGE_LOG)%></a></li>"
+ . "<li><a href=\"<%adminurl%>index.php?action=settingsedit\"><%text(_QMENU_MANAGE_SETTINGS)%></a></li>"
+ . "<li><a href=\"<%adminurl%>index.php?action=systemoverview\"><%text(_QMENU_MANAGE_SYSTEM)%></a></li>"
+ . "<li><a href=\"<%adminurl%>index.php?action=usermanagement\"><%text(_QMENU_MANAGE_MEMBERS)%></a></li>"
+ . "<li><a href=\"<%adminurl%>index.php?action=createnewlog\"><%text(_QMENU_MANAGE_NEWBLOG)%></a></li>"
+ . "<li><a href=\"<%adminurl%>index.php?action=backupoverview\"><%text(_QMENU_MANAGE_BACKUPS)%></a></li>"
+ . "<li><a href=\"<%adminurl%>index.php?action=pluginlist\"><%text(_QMENU_MANAGE_PLUGINS)%></a></li>"
+ . "</ul>"
+ . "<h2><%text(_QMENU_LAYOUT)%></h2>"
+ . "<ul>"
+ . "<li><a href=\"<%adminurl%>index.php?action=skinoverview\"><%text(_QMENU_LAYOUT_SKINS)%></a></li>"
+ . "<li><a href=\"<%adminurl%>index.php?action=templateoverview\"><%text(_QMENU_LAYOUT_TEMPL)%></a></li>"
+ . "<li><a href=\"<%adminurl%>index.php?action=skinieoverview\"><%text(_QMENU_LAYOUT_IEXPORT)%></a></li>"
+ . "</ul>"
+ . "<h2><%text(_SKINABLEADMIN_QMENU_LAYOUT)%></h2>"
+ . "<ul>"
+ . "<li><a href=\"<%adminurl%>index.php?action=adminskinoverview\"><%text(_QMENU_LAYOUT_SKINS)%></a></li>"
+ . "<li><a href=\"<%adminurl%>index.php?action=admintemplateoverview\"><%text(_QMENU_LAYOUT_TEMPL)%></a></li>"
+ . "<li><a href=\"<%adminurl%>index.php?action=adminskinieoverview\"><%text(_QMENU_LAYOUT_IEXPORT)%></a></li>"
+ . "</ul>"
+ . "<%endif%>"
+ . "<%quickmenu(admin/default)%>"
+ . "<%endif%>"
+ . "<%elseif(adminaction,activate)%>"
+ . "<h2><%text(_QMENU_ACTIVATE)%></h2>"
+ . "<%text(_QMENU_ACTIVATE_TEXT)%>"
+ . "<%elseif(adminaction,activatesetpwd)%>"
+ . "<h2><%text(_QMENU_ACTIVATE)%></h2><%text(_QMENU_ACTIVATE_TEXT)%>"
+ . "<%else%>"
+ . "<h2><%text(_QMENU_INTRO)%></h2><%text(_QMENU_INTRO_TEXT)%>"
+ . "<%endif%>"
+ . "</div>"
+ . "<!-- content / quickmenu container -->"
+ . "<div class=\"clear\"></div>"
+ . "<!-- new -->"
+ . "</div>"
+ . "<!-- adminwrapper -->"
+ . "<!-- new -->"
+ . "</div>"
+ . "<!-- new -->"
+ . "<p style=\"text-align:right;\"><%benchmark%></p>"
+ . "</body>"
+ . "</html>";
}
-
+
+ $this->parser->parse($content);
return;
}
/**
private function selectBlog($name, $mode='blog', $selected = 0, $tabindex = 0, $showNewCat = 0, $iForcedBlogInclude = -1)
{
global $member, $CONF;
-
+
// 0. get IDs of blogs to which member can post items (+ forced blog)
$aBlogIds = array();
if ( $iForcedBlogInclude != -1 )
{
$aBlogIds[] = intval($iForcedBlogInclude);
}
-
+
if ( $member->isAdmin() && array_key_exists('ShowAllBlogs', $CONF) && $CONF['ShowAllBlogs'] )
{
$query = "SELECT bnumber FROM %s ORDER BY bname;";
$query = "SELECT bnumber FROM %s, %s WHERE tblog=bnumber AND tmember=%d;";
$query = sprintf($query, sql_table('blog'), sql_table('team'), (integer) $member->getID());
}
-
+
$rblogids = DB::getResult($query);
foreach ( $rblogids as $row )
{
echo "</select>\n";
return;
}
-}
\ No newline at end of file
+}