{
// call constructor of superclass first
parent::__construct();
-
+
/* alias */
if ( $type == 'admntemplateoverview' )
{
public function getAvailableActions()
{
$extra_actions = array();
-
+
switch ( $this->skintype )
{
case 'actionlog':
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 =& $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 )
{
{
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');
{
$type = strtolower(trim(requestVar('type')));
$skinid = intRequestVar('skinid');
-
+
if ( !preg_match('#^admin#', $this->skintype) )
{
$skin = new Skin($skinid);
$skin = new Skin($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";
$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 )
{
/* TODO: nothing to be shown */
}
$resource->closeCursor();
-
+
return;
}
global $manager;
$blogid = intRequestVar('blogid');
$blog =& $manager->getBlog($blogid);
-
+
switch ( $type )
{
case 'comment':
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 = $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']) )
{
// on add item
// on edit item
$catid = $contents['catid'];
}
-
+
$this->selectBlog('catid', 'category', $catid, $startidx, 1, $blog->getID());
-
+
return;
}
$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']);
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' )
{
$item['body'] = removeBreaks($item['body']);
$item['more'] = removeBreaks($item['more']);
}
-
+
$contents = array();
if ( requestVar('action') == 'itemedit' )
{
public function parse_commentnavlist()
{
global $CONF, $manager, $member;
-
+
// start index
if ( postVar('start') )
{
{
$start = 0;
}
-
+
// amount of items to show
if ( postVar('amount') )
{
. '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 )
{
/* TODO: nothing to be shown */
}
$resource->closeCursor();
-
+
return;
}
public function parse_normalskinlist($template_name = '')
{
global $CONF, $manager;
-
+
if ( !preg_match('#^admin#', $this->skintype) )
{
$skin = new Skin($CONF['BaseSkin']);
$template['editaction'] = 'adminskinedittype';
/* TODO: removeaction? */
}
-
+
$temporary = $skin->getDefaultTypes();
$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['skinname'] = $skin->getName();
$this->parser->parse(showlist($normal_skintype, 'list_normalskinlist', $template, $template_name));
-
+
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));
-
+
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));
-
+
return;
}
public function parse_defskinselect($type = 'blog', $template_name = '')
{
global $CONF, $manager, $member;
-
+
if ( !preg_match('#^admin#', $this->skintype) )
{
$blogid = intRequestVar('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));
-
+
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 )
{
case 'id':
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';
public function parse_editskin($type = 'id')
{
$skinid = intRequestVar('skinid');
-
+
if ( !preg_match('#^admin#', $this->skintype) )
{
$skin = new SKIN($skinid);
{
$skin = new SKIN($skinid, 'AdminActions');
}
-
+
switch ( $type )
{
case 'id':
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':
{
$manager->notify('AdminTemplateExtraFields', array('fields' => &$pluginfields));
}
-
+
foreach ( $pluginfields as $ptkey => $ptvalue )
{
$tmplt = array();
if ( !array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) || empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
{
$base = "</tr>\n"
- . "<tr>\n"
- . "<th colspan=\"2\"><%explugtplname%></th>\n";
+ . "<tr>\n"
+ . "<th colspan=\"2\"><%explugtplname%></th>\n";
}
else
{
$base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
}
$data = array(
- 'explugtplname' => Entity::hsc($ptkey)
+ 'explugtplname' => Entity::hsc($ptkey)
);
echo Template::fill($base, $data);
default:
$typedesc = defined($typedesc) ? constant($typedesc) : $typedesc;
$typename = defined($typename) ? constant($typename) : $typename;
-
+
if ( !array_key_exists($typename, $template) )
{
$content = '';
$this->parser->parse(listplug_templateEditRow($content, $typedesc, $typename, $help, $tabindex, $big, $template_name));
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' => &$extrahead,
+ 'action' => Admin::getAdminAction()
);
-
+
$manager->notify('AdminPrePageHead', $data);
echo $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;
public function parse_init()
{
global $manager;
-
+
$authorid = '';
if ( requestVar('action') == 'itemedit' )
{
$authorid = Admin::$contents['authorid'];
}
-
+
Admin::$blog->insertJavaScriptInfo($authorid);
return;
}
public function parse_insplugoptcontent()
{
$option = Admin::getAdminaOption();
-
+
$meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
if ( array_key_exists('access', $meta) && $meta['access'] != 'hidden' )
{
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 )
{
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' )
{
elseif ( requestVar('action') == 'createitem' )
{
$data = array(
- 'contents' => &$contents,
- 'blog' => &$this->blog
+ 'contents' => &$contents,
+ 'blog' => &$this->blog
);
$manager->notify('PreAddItemForm', $data);
}
{
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;
-
+
$locales = i18n::get_available_locale_list();
-
+
$memid = intRequestVar('memberid');
if ( $memid )
{
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 . '">';
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));
return;
public function parse_outputspecialdirs($type)
{
global $DIR_MEDIA, $DIR_NUCLEUS;
-
+
switch ( $type )
{
case 'nucleusdir':
{
$passvar = Admin::getAdminpassvar();
$oldaction = postVar('oldaction');
-
+
if ( ($oldaction != 'logout')
&& ($oldaction != 'login')
&& $passvar
public function parse_pluginextras($type = 'global')
{
global $manager;
-
+
switch ( $type )
{
case 'member':
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());
break;
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));
-
+
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));
-
+
return;
}
{
global $manager;
$templates = array();
-
+
if ( !empty($template_name) )
{
$templates = & $manager->getTemplate($template_name);
}
$pluginExtras = array();
$manager->notify('QuickMenu', array('options' => &$pluginExtras));
-
+
$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));
}
public function parse_selectlocalskinfiles()
{
global $DIR_SKINS;
-
+
if ( !class_exists('SkinImport', FALSE) )
{
include_libs('skinie.php');
}
-
+
if ( !preg_match('#^admin#', $this->skintype) )
{
$skindir = $DIR_SKINS;
{
$skindir = "{$DIR_SKINS}admin/";
}
-
+
$candidates = SkinImport::searchForCandidates($skindir);
foreach ( $candidates as $skinname => $skinfile )
{
case 'blog':
$query = "SELECT bshortname, bname FROM %s;";
$show = array(
- 'content' => 'shortblognames'
+ 'content' => 'shortblognames'
);
$query = sprintf($query, sql_table('blog'));
break;
$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;
public function parse_skinielist($type, $template_name = '')
{
global $manager;
-
+
$templates = array();
if ( $template_name )
{
{
$template = $templates['SKINIE_EXPORT_LIST'];
}
-
+
switch ( $type )
{
case 'skin':
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);
}
if ( !preg_match('#^admin#', $this->skintype) )
{
$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) )
{
$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));
-
+
return;
}
{
/* TODO: use Skin class */
$regularType = array(
- 'index',
- 'item',
- 'archivelist',
- 'archive',
- 'search',
- 'error',
- 'member',
- 'imagepopup'
- );
+ 'index',
+ 'item',
+ 'archivelist',
+ 'archive',
+ 'search',
+ 'error',
+ 'member',
+ 'imagepopup'
+ );
}
-
+
if ( in_array($nowSkinType, $regularType) )
{
help('skinpart' . $nowSkinType);
public function parse_specialskinlist($template_name = '')
{
global $CONF, $manager;
-
+
$template = array();
-
+
$skinid = intRequestVar('skinid');
-
+
if ( !preg_match('#^admin#', $this->skintype) )
{
$skin = new Skin($skinid);
}
$normal_types = $skin->getDefaultTypes();
$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;
{
$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);
}
$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));
-
+
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';
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 )
{
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()
+ 'extrahead' => &$extrahead,
+ 'action' => Admin::getAdminAction()
);
$manager->notify('AdminPrePageHead', $data);
-
+
$content = $this->parser->skin->getContentFromDB('pagehead');
if ( !$content )
{
$baseUrl = Entity::hsc($CONF['SkinsURL']);
-
+
/*
* TODO: obsoleted
if ( !array_key_exists('AdminCSS', $CONF) )
$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());
$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 "<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";
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 = '';
{
$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";
{
$this->parser->parse($content);
}
-
+
return;
}
public function parse_pagefoot()
{
global $action, $member, $manager, $blogid;
-
+
$data = array(
- 'action' => Admin::getAdminAction()
+ 'action' => Admin::getAdminAction()
);
$manager->notify('AdminPrePageFoot', $data);
-
+
$content = $this->parser->skin->getContentFromDB('pagefoot');
if ( !$content )
{
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 "<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)
$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 '<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";
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 )
{