class AdminActions extends BaseActions
{
- // reference to the skin object for which a part is being parsed
- private $skin;
-
private $skintype;
/* NOTE: list of whole available action names for tags
'iprangeinput',
'itemnavlist',
'jstoolbaroptions',
- 'languageselectoptions',
'listplugplugoptionrow',
+ 'localeselectoptions',
'mediadirwarning',
'movedistselect',
'moveitemid',
*/
static private $default_actions = array(
'addtickettourl',
+ 'adminurl',
+ 'codename',
+ 'customhelplink',
+ 'date',
+ 'extrahead',
'headmessage',
- 'ticket',
- 'sprinttext',
'helplink',
- 'customhelplink',
- 'adminurl'
+ 'member',
+ 'newestcompare',
+ 'pagehead',
+ 'pagefoot',
+ 'qmenuaddselect',
+ 'quickmenu',
+ 'sitevar',
+ 'sprinttext',
+ 'ticket',
+ 'version',
+ 'versioncheckurl'
);
/**
'editadminskintype',
);
break;
+ case 'admintemplatedelete':
+ $extra_actions = array(
+ 'editadmintemplateinfo',
+ );
case 'admintemplateedit':
$extra_actions = array(
'editadmintemplateinfo',
case 'blogsettings':
$extra_actions = array(
'adminbloglink',
- 'blogteammembers',
- 'requestblogid',
- 'blogsetting',
+ 'blogcatlist',
'blognotifysetting',
- 'defcatselect',
- 'blogtime',
+ 'blogsetting',
'blogsettingyesno',
- 'pluginoptions',
- 'blogcatlist',
+ 'blogteammembers',
+ 'blogtime',
+ 'defcatselect',
+ 'defskinselect',
'pluginextras',
+ 'pluginoptions',
+ 'requestblogid',
);
break;
case 'bookmarklet':
'requestblogid',
'categorysetting',
'editdesturl',
+ 'pluginoptions'
);
break;
case 'commentdelete':
'contents',
'categories',
'currenttime',
- 'pluginextras',
- 'itemoptions'
+ 'init',
+ 'pluginoptions',
+ 'pluginextras'
);
break;
case 'createnewlog':
break;
case 'editmembersettings':
$extra_actions = array(
- 'editmember',
- 'languageselectoptions',
'adminskinselectoptions',
+ 'editmember',
+ 'localeselectoptions',
'pluginoptions',
);
break;
'categories',
'currenttime',
'itemtime',
- 'pluginextras',
- 'itemoptions'
+ 'pluginoptions',
+ 'pluginextras'
);
break;
case 'itemlist':
'yrbloglist',
);
break;
- case 'pagefoot':
- $extra_actions = array(
- 'date',
- 'qmenuaddselect',
- 'member',
- 'quickmenu',
- );
- break;
- case 'pagehead':
- $extra_actions = array(
- 'charset',
- 'sitevar',
- 'adminurl',
- 'extrahead',
- 'member',
- 'versioncheckurl',
- 'version',
- 'codename',
- 'newestcompare',
- );
- break;
case 'plugindelete':
$extra_actions = array(
'editpluginfo',
'defblogselect',
'defskinselect',
'configsettingsedit',
- 'languageselectoptions',
'configsettingsyesno',
'outputspecialdirs',
'jstoolbaroptions',
+ 'localeselectoptions',
'mediadirwarning',
'pluginextras',
);
}
/**
- * AdminActions::setSkin()
- * Set the skin
- * @param object $skin an instance of Skin class
- * @return void
- */
- public function setSkin(&$skin)
- {
- $this->skin =& $skin;
- return;
- }
-
- /**
* AdminActions::parse_actionloglist()
* Parse skinvar actionloglist
*
{
global $manager;
$templates = array();
+
if ( !empty($templateName) )
{
$templates = Template::read($templateName);
}
- if ( isset($templates['ADMIN_BATCHLIST']) || !empty($templates['ADMIN_BATCHLIST']) )
+
+ if ( !array_key_exists('ADMIN_BATCHLIST', $templates) || empty($templates['ADMIN_BATCHLIST']) )
{
- $template = $templates['ADMIN_BATCHLIST'];
+ $template = '<li><%text(_BATCH_EXECUTING)%> '
+ . '<b><%adminbatchaction%></b> '
+ . '<%batchlisttype%> '
+ . '<b><%batchid%></b>... '
+ . '<b><%batchlistmsg%></b>'
+ . '</li>' . "\n";
}
else
{
- $template = '<li><%text(_BATCH_EXECUTING)%>'
- . '<b><%adminbatchaction%></b>'
- . '<%batchlisttype%>'
- . '<b><%batchid%></b>...'
- . '<b><%batchlistmsg%></b>'
- . '</li>' . "\n";
+ $template = $templates['ADMIN_BATCHLIST'];
}
$selected = requestIntArray('batch');
$action = requestVar('batchaction');
-
+
switch ( $this->skintype )
{
case 'batchitem':
// walk over all selectedids and perform action
foreach ( $selected as $selectedid )
{
- $error = '';
+ $error = '';
$selectedid = intval($selectedid);
switch ( $action )
{
case 'delete':
if ( $this->skintype != 'batchteam' )
{
- $error = Admin::$deleteaction($selectedid);
+ $error = call_user_func_array(array('Admin', $deleteaction), array($selectedid));
}
else
{
}
break;
case 'move':
- $error = Admin::moveaction($selectedid, $destid);
+ $error = call_user_func_array(array('Admin', $moveaction), array($selectedid, $destid));
break;
case 'setadmin':
// always succeeds
- sql_query('UPDATE ' . $setadminsql . $selectedid);
+ DB::execute("UPDATE {$setadminsql} {$selectedid};");
$error = '';
break;
case 'unsetadmin':
// there should always remain at least one super-admin
- $r = sql_query($unsetchksql);
- if ( sql_num_rows($r) < 2 )
+ $r = DB::getResult($unsetchksql);
+ if ( $r->rowCount() < 2 )
{
$error = $unseterrmsg;
}
else
{
- sql_query('UPDATE ' . $unsetupsql . $selectedid);
+ DB::execute("UPDATE {$unsetupsql} {$selectedid};");
}
break;
default:
$error = _BATCH_UNKNOWN . Entity::hsc($action);
}
+
$data = array(
'batchid' => $selectedid,
'batchlisttype' => Entity::hsc($batchlisttype),
'adminbatchaction' => Entity::hsc($action),
'batchlistmsg' => $error ? $error : _BATCH_SUCCESS,
);
- $handler = new Actions('template', $template, new ADMIN);
- $parser = new Parser($handler);
+ $handler = new AdminActions('template');
+ $parser = new Parser($handler);
+
+ $output = Template::fill($template, $data);
ob_start();
- $parser->parse($template);
- $template = ob_get_contents();
+ $parser->parse($output);
+ $output = ob_get_contents();
ob_end_clean();
-
- echo Template::fill($template, $data);
- return;
+ echo "{$output}<br />";
}
+ return;
}
/**
$templates = Template::read($templateName);
}
- if ( isset($templates['ADMIN_BLOGLINK']) || !empty($templates['ADMIN_BLOGLINK']) )
+ if ( !array_key_exists('ADMIN_BLOGLINK', $templates) || empty($templates['ADMIN_BLOGLINK']) )
{
- $template = $templates['ADMIN_BLOGLINK'];
+ $template = '<a href="<%url%>" title="<%adminbloglinktitle%>"><%blogname%></a>';
}
else
{
- $template = '<a href="<%url%>" title="<%adminbloglinktitle%>"><%blogname%></a>';
+ $template = $templates['ADMIN_BLOGLINK'];
}
$data = array(
$show = array(
'content' => 'shortblognames'
);
+ Showlist($query, 'table', $show, $templateName);
break;
case 'template':
$query = "SELECT tdname as name, tddesc as description FROM %s WHERE tdname LIKE 'admin/%%'";
$show = array(
'content' => 'shortnames'
);
+ Showlist($query, 'table', $show, $templateName);
break;
}
- Showlist($query, 'table', $show, $templateName);
return;
}
{
$templates = Template::read($templateName);
}
- if ( isset($templates['SKINIE_EXPORT_LIST']) && !empty($templates['SKINIE_EXPORT_LIST']) )
+
+ if ( !array_key_exists('SKINIE_EXPORT_LIST', $templates) || empty($templates['SKINIE_EXPORT_LIST']) )
{
- $template = $templates['SKINIE_EXPORT_LIST'];
+ $template = "<td>"
+ . "<input type=\"checkbox\" name=\"<%typeid%>\" id=\"<%expid%>\" />\n"
+ . "<label for=\"<%expid%>\"><%expname%></label>"
+ . "</td>\n"
+ . "<td><%expdesc%></td>\n"
+ . "</tr>\n"
+ . "<tr>\n";
}
else
{
- $template = '<td><input type="checkbox" name="<%typeid%>" id="<%expid%>" /><label for="<%expid%>"><%expname%></label></td>' . "\n"
- . "<td><%expdesc%></td>\n"
- . "</tr><tr>\n";
+ $template = $templates['SKINIE_EXPORT_LIST'];
}
+
switch ( $type )
{
case 'skin':
- $query = "SELECT * FROM %s WHERE sdincmode = 'admin';";
+ $query = "SELECT * FROM %s WHERE sdname LIKE 'admin/%%';";
$query = sprintf($query, sql_table('skin_desc'));
- $res = sql_query($query);
+ $res = DB::getResult($query);
- while ( $skinObj = sql_fetch_object($res) )
+ foreach ( $res as $row )
{
$data = array(
- 'typeid' => 'skin[' . $skinObj->sdnumber . ']',
- 'expid' => 'skinexp' . $skinObj->sdnumber,
- 'expname' => Entity::hsc($skinObj->sdname),
- 'expdesc' => Entity::hsc($skinObj->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':
- $query = "SELECT * FROM %s WHERE tdname LIKE 'admin/%%'";
+ $query = "SELECT * FROM %s WHERE tdname LIKE 'admin/%%';";
$query = sprintf($query, sql_table('template_desc'));
- $res = sql_query($query);
- while ( $templateObj = sql_fetch_object($res) )
+ $res = DB::getResult($query);
+ foreach ( $res as $row )
{
$data = array(
- 'typeid' => 'template[' . $templateObj->tdnumber . ']',
- 'expid' => 'templateexp' . $templateObj->tdnumber,
- 'expname' => Entity::hsc($templateObj->tdname),
- 'expdesc' => Entity::hsc($templateObj->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_adminskinoverview($templateName = '')
{
- $query = "SELECT * FROM %s WHERE sdincmode = 'admin' ORDER BY sdname;";
+ $query = "SELECT * FROM %s WHERE sdname LIKE 'admin/%%' ORDER BY sdname;";
$query = sprintf($query, sql_table('skin_desc'));
- $template['content'] = 'adminskinlist';
- $template['tabindex'] = 10;
- $template['friendly_names'] = $this->skin->getAvailableTypes();
+ $template['content'] = 'adminskinlist';
+ $template['tabindex'] = 10;
+ $template['friendly_names'] = $this->parser->skin->getAvailableTypes();
Showlist($query, 'table', $template, $templateName);
return;
}
*
* @param void
* @return void
- */
- public function parse_adminskinselectoptions()
+ */
+ public function parse_adminskinselectoptions($templateName = '')
{
global $CONF;
- $query = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdincmode = 'admin';";
+ $query = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdname LIKE 'admin/%%';";
$query = sprintf($query, sql_table('skin_desc'));
- $template['name'] = 'adminskin';
- $template['selected'] = $CONF['DefaultAdminSkin'];
+ $template['name'] = 'adminskin';
+ $template['selected'] = $CONF['AdminSkin'];
$template['tabindex'] = 110;
- Showlist($query, 'select', $template, '');
+ Showlist($query, 'select', $template, $templateName);
return;
}
$templates = Template::read($templateName);
}
- $nType = $this->skin->getAvailableTypes();
+ $nType = $this->parser->skin->getAvailableTypes();
$skinid = intRequestVar('skinid');
$query = "SELECT stype FROM %s WHERE stype NOT IN (%s) AND sdesc=%d;";
$query = sprintf($query, sql_table('skin'), "'" . implode("', '", $nType) . "'", (integer) $skinid);
- $res = sql_query($query);
- if ( $res && sql_num_rows($res) > 0 )
+ $res = DB::getResult($query);
+ if ( $res && $res->rowCount() > 0 )
{
- $data = array();
- if ( array_key_exists('ADMIN_SPECIALSKINLIST_HEAD', $templates) && !empty($templates['ADMIN_SPECIALSKINLIST_HEAD']) )
- {
- $template['head'] = $templates['ADMIN_SPECIALSKINLIST_HEAD'];
- }
- else
+ /* NOTE: set templates for HEAD/BODY/FOOT */
+ if ( !array_key_exists('ADMIN_SPECIALSKINLIST_HEAD', $templates) || empty($templates['ADMIN_SPECIALSKINLIST_HEAD']) )
{
$template['head'] = "<ul>\n";
}
- echo Template::fill($template['head'], $data);
-
- if ( array_key_exists('ADMIN_SPECIALSKINLIST_BODY', $templates) && !empty($templates['ADMIN_SPECIALSKINLIST_BODY']) )
+ else
{
- $template['body'] = $templates['ADMIN_SPECIALSKINLIST_BODY'];
+ $template['head'] = $templates['ADMIN_SPECIALSKINLIST_HEAD'];
}
- else
+ if ( !array_key_exists('ADMIN_SPECIALSKINLIST_BODY', $templates) || empty($templates['ADMIN_SPECIALSKINLIST_BODY']) )
{
$template['body'] = '<li>'
. '<a tabindex="<%tabindex%>" href="index.php?action=adminskinedittype&skinid=<%skinid%>&type=<%skintype%>">'
. '</a>)'
. "</li>\n";
}
+ else
+ {
+ $template['body'] = $templates['ADMIN_SPECIALSKINLIST_BODY'];
+ }
+ if ( !array_key_exists('ADMIN_SPECIALSKINLIST_FOOT', $templates) || empty($templates['ADMIN_SPECIALSKINLIST_FOOT']) )
+ {
+ $template['foot'] = "</ul>\n";
+ }
+ else
+ {
+ $template['foot'] = $templates['ADMIN_SPECIALSKINLIST_FOOT'];
+ }
+
$tabstart = 120;
- while ( $row = sql_fetch_assoc($res) )
+
+ /* NOTE: do echo */
+ $data = array();
+ echo $template['head'];
+ foreach ( $res as $row )
{
$data = array(
'tabindex' => $tabstart++,
);
echo Template::fill($template['body'], $data);
}
-
$data = array();
- if ( array_key_exists('ADMIN_SPECIALSKINLIST_FOOT', $templates) && !empty($templates['ADMIN_SPECIALSKINLIST_FOOT']) )
- {
- $template['foot'] = $templates['ADMIN_SPECIALSKINLIST_FOOT'];
- }
- else
- {
- $template['foot'] = "</ul>\n";
- }
- echo Template::fill($template['foot'], $data);
+ echo $template['foot'];
}
return;
}
$query = "SELECT * FROM %s WHERE tdname LIKE 'admin/%%' ORDER BY tdname;";
$query = sprintf($query, sql_table('template_desc'));
- $template['content'] = 'admintemplatelist';
+ $template['content'] = 'admintemplatelist';
$template['tabindex'] = 10;
Showlist($query, 'table', $template, $templateName);
{
global $DIR_ADMINSKINS;
$skinType = strtolower(trim(requestVar('type')));
- $actions = $this->skin->getAllowedActionsForType($skinType);
+ $actions = $this->parser->skin->getAllowedActionsForType($skinType);
sort($actions);
while ( $current = array_shift($actions) )
{
+ // TODO: remove this
// skip deprecated vars
if ($current == 'ifcat' || $current == 'imagetext' || $current == 'vars')
{
}
echo helplink("adminskinvar-{$current}") . "$current</a>\n";
-// echo "<a href=\"{$DIR_ADMINSKINS}documentation/help.html#{$current}\" onclick=\"if (event && event.preventDefault) event.preventDefault(); return help(this.href);\">{$current}</a>\n";
if ( count($actions) != 0 )
{
public function parse_allowedskinactions()
{
$skinType = strtolower(trim(requestVar('type')));
- $skinid = intRequestVar('skinid');
- $skin = new Skin($skinid);
- $actions = $skin->getAllowedActionsForType($skinType);
+ $skinid = intRequestVar('skinid');
+
+ $skin = new Skin($skinid);
+ $actions = $skin->getAllowedActionsForType($skinType);
sort($actions);
while ( $current = array_shift($actions) )
{
+ // TODO: remove this
// skip deprecated vars
if ( $current == 'ifcat' || $current == 'imagetext' || $current == 'vars' )
{
public function parse_banlistdeletedlist($templateName = '')
{
global $manager;
- $templates = array();
+ $templates = array();
if ( $templateName )
{
$templates = Template::read($templateName);
}
- if ( isset($templates['BANLIST_DELETED_LIST']) && !empty($templates['BANLIST_DELETED_LIST']) )
+
+ if ( !array_key_exists('BANLIST_DELETED_LIST', $templates) || empty($templates['BANLIST_DELETED_LIST']) )
{
- $template = $templates['BANLIST_DELETED_LIST'];
+ $template = "<li><%blogname%></li>\n";
}
else
{
- $template = "<li><%blogname%></li>\n";
+ $template = $templates['BANLIST_DELETED_LIST'];
}
+
$deleted = requestArray('delblogs');
foreach ( $deleted as $delblog )
{
$blog =& $manager->getBlog($delblog);
$data = array(
- Entity::hsc($blog->getName())
+ 'blogname' => Entity::hsc($blog->getName())
);
- Template::fill($template, $data);
+ echo Template::fill($template, $data);
}
+
return;
}
public function parse_batchmovelist()
{
$selected = requestIntArray('batch');
+ $count = 0;
foreach ( $selected as $select )
{
- echo '<input type="hidden" name="batch[' . ($select++) . ']" value="' . intval($select) . "\" />\n";
+ echo '<input type="hidden" name="batch[' . ($count) . ']" value="' . intval($select) . "\" />\n";
+ $count++;
}
return;
}
* @param void
* @return void
*/
- public function parse_blogcatlist()
+ public function parse_blogcatlist($templateName = '')
{
global $manager;
$blogid = intRequestVar('blogid');
$template['content'] = 'categorylist';
$template['tabindex'] = 200;
- $batch = new Batch('member');
- $batch->showlist($query, 'table', $template);
+ $batch = new Batch('category');
+ $batch->showlist($query, 'table', $template, $templateName);
return;
}
* @param void
* @return void
*/
- function parse_blogid()
+ public function parse_blogid()
{
echo intRequestVar('blogid');
return;
// (only select those blogs that have the user on the team)
$queryBlogs = "SELECT bnumber, bname FROM %s WHERE bnumber in (%s) ORDER BY bname;";
$queryBlogs = sprintf($queryBlogs, sql_table('blog'), implode(',', $aBlogIds));
- $blogs = sql_query($queryBlogs);
+ $blogs = DB::getResult($queryBlogs);
if ( $mode == 'category' )
{
- if ( sql_num_rows($blogs) > 1 )
+ if ( $blogs->rowCount() > 1 )
{
$multipleBlogs = 1;
}
- while ( $oBlog = sql_fetch_object($blogs) )
+ foreach ( $blogs as $rBlog )
{
if ( isset($multipleBlogs) && !empty($multipleBlogs) )
{
- echo '<optgroup label="' . Entity::hsc($oBlog->bname) . "\>\n";
+ echo '<optgroup label="' . Entity::hsc($rBlog['bname']) . "\">\n";
}
// show selection to create new category when allowed/wanted
if ( $showNewCat )
{
// check if allowed to do so
- if ( $member->blogAdminRights($oBlog->bnumber) )
+ if ( $member->blogAdminRights($rBlog['bnumber']) )
{
- echo '<option value="newcat-' . $oBlog->bnumber . '">' . _ADD_NEWCAT . "</option>\n";
+ echo '<option value="newcat-' . $rBlog['bnumber'] . '">' . _ADD_NEWCAT . "</option>\n";
}
}
// 2. for each category in that blog
$catQuery = "SELECT cname, catid FROM %s WHERE cblog=%d ORDER BY cname ASC;";
- $catQuery = sprintf($catQuery, sql_table('category'), (integer) $oBlog->bnumber);
- $categories = sql_query($catQuery);
- while ( $oCat = sql_fetch_object($categories) )
+ $catQuery = sprintf($catQuery, sql_table('category'), (integer) $rBlog['bnumber']);
+ $categories = DB::getResult($catQuery);
+ foreach ( $categories as $rCat )
{
- if ( $oCat->catid == $selected )
+ if ( $rCat['catid'] == $selected )
{
$selectText = ' selected="selected" ';
}
{
$selectText = '';
}
- echo '<option value="' . $oCat->catid . '" ' . $selectText . '>' . Entity::hsc($oCat->cname) . "</option>\n";
+ echo '<option value="' . $rCat['catid'] . '" ' . $selectText . '>' . Entity::hsc($rCat['cname']) . "</option>\n";
}
if ( isset($multipleBlogs) && !empty($multipleBlogs) )
else
{
// blog mode
- while ( $oBlog = sql_fetch_object($blogs) )
+ foreach ( $blogs as $rBlog )
{
- echo '<option value="' . $oBlog->bnumber . '"';
- if ( $oBlog->bnumber == $selected )
+ echo '<option value="' . $rBlog['bnumber'] . '"';
+ if ( $rBlog['bnumber'] == $selected )
{
- echo '<option value="' . $oBlog->bnumber . '" selected="selected">' . Entity::hsc($oBlog->bname) . "</option>\n";
+ echo '<option value="' . $rBlog['bnumber'] . '" selected="selected">' . Entity::hsc($rBlog['bname']) . "</option>\n";
}
else
{
- echo '<option value="' . $oBlog->bnumber . '">' . Entity::hsc($oBlog->bname) . "</option>\n";
+ echo '<option value="' . $rBlog['bnumber'] . '">' . Entity::hsc($rBlog['bname']) . "</option>\n";
}
}
}
$template['tabindex'] = 10;
$batch = new Batch('team');
- $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);
+ $batch->showList($query, 'table', $template, $templateName, _LISTS_NOMORE);
return;
}
. "FROM %s, %s "
. "WHERE mnumber=tmember AND tblog=%d;";
$query = sprintf($query, sql_table('member'), sql_table('team'), (integer) $blogid);
- $res = sql_query($query);
+ $res = DB::getResult($query);
$memberNames = array();
- while ($o = sql_fetch_object($res)) {
- $memberNames[] = Entity::hsc($o->mname) . ' (' . Entity::hsc($o->mrealname). ')';
+ foreach ( $res as $row )
+ {
+ $memberNames[] = Entity::hsc($row['mname']) . ' (' . Entity::hsc($row['mrealname']). ')';
}
echo implode(',', $memberNames);
}
}
else
{
- $bid = intRequestVar('blogid');
- $b = $manager->getBlog($bid);
- $timestamp = $b->getCorrectTime() + $offset;
+ $bid = intRequestVar('blogid');
+ $b = $manager->getBlog($bid);
+ $timestamp = $b->getCorrectTime() + $offset;
}
echo i18n::formatted_datetime($format, $timestamp);
* @param string $type name of setting for category
* @return void
*/
- function parse_categories($startidx = 0)
+ public function parse_categories($startidx = 0)
{
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 = 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 ( isset($contents['catid']) && $contents['catid'] )
+
+ if ( !array_key_exists('catid', $contents) || empty($contents['catid']) )
{
- $catid = $contents['catid']; // on edit item
+ // on add item
+ $catid = $blog->getDefaultCategory();
}
else
{
- $catid = $blog->getDefaultCategory(); // on add item
+ // on edit item
+ $catid = $contents['catid'];
}
+
Admin::selectBlogCategory('catid', $catid, $startidx, 1, $blog->getID());
+
+ return;
}
/**
$blogid = intRequestVar('blogid');
$query = "SELECT * FROM %s WHERE cblog = %d AND catid = %d;";
$query = sprintf($query, sql_table('category'), (integer) $blogid, (integer) $catid);
- $res = sql_query($query);
- $obj = sql_fetch_object($res);
+ $row = DB::getRow($query);
- if ( $type != desc )
+ if ( $type != 'name' )
{
- echo Entity::hsc($obj->cdesc);
+ echo Entity::hsc($row['cdesc']);
}
else
{
- echo Entity::hsc($obj->cname);
+ echo Entity::hsc($row['cname']);
}
return;
* @param $name
*
*/
- function parse_checkedonval($value, $name) {
+ public function parse_checkedonval($value, $name)
+ {
global $manager;
- $item = false;
+
+ $item = false;
$itemid = intRequestVar('itemid');
- $item =& $manager->getItem($itemid, 1, 1);
- $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
- if ($item && $blog->convertBreaks() && requestVar('action') == 'itemedit') {
+ $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' )
{
{
echo 'checked="checked"';
}
+ return;
}
/**
$search = postVar('search');
if ( !empty($search) )
{
- $query .= ' and cbody LIKE "%' . sql_real_escape_string($search) . '%"';
+ $query .= ' and cbody LIKE ' . DB::quoteValue('%'.$search.'%');
}
$query .= " ORDER BY ctime ASC LIMIT {$start},{$amount}";
{
$query = "INSERT INTO %s VALUES (DefaultListSize, 10);";
$query = sprintf($query, sql_table('config'));
- sql_query($query);
+ DB::execute($query);
$CONF['DefaultListSize'] = 10;
}
elseif ( intval($CONF['DefaultListSize']) < 1 )
* @param string $which part for item
* @return void
*/
- function parse_contents($which)
+ public function parse_contents($which)
{
global $manager;
- $item = false;
+
+ $item = false;
$contents = array();
+
if ( requestVar('action') == 'itemedit' )
{
$itemid = intRequestVar('itemid');
- $item =& $manager->getItem($itemid, 1, 1);
- $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
+ $item =& $manager->getItem($itemid, 1, 1);
+
+ $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
+
if ( $item && $blog->convertBreaks() )
{
$item['body'] = removeBreaks($item['body']);
}
elseif ( requestVar('action') == 'createitem' )
{
- $blog =& $manager->getBlog(intRequestVar($blogid));
+ $blogid = intRequestVar('blogid');
+ $blog =& $manager->getBlog($blogid);
$manager->notify(
'PreAddItemForm',
array(
)
);
}
- if ( !isset($contents[$which]) )
+
+ if ( !array_key_exists($which, $contents) )
{
$contents[$which] = '';
}
* @param string $what
*/
// for future items
- function parse_currenttime($what)
+ public function parse_currenttime($what)
{
global $manager;
if ( requestVar('action') == 'itemedit' )
{
$itemid = intRequestVar('itemid');
- $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
+ $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
}
elseif ( requestVar('action') == 'createitem' )
{
- $blog =& $manager->getBlog(intRequestVar('blogid'));
+ $blog =& $manager->getBlog(intRequestVar('blogid'));
}
- $nu = getdate($blog->getCorrectTime());
+ $nu = getdate($blog->getCorrectTime());
echo $nu[$what];
}
public function parse_defaultadminskintypes($tabindex, $templateName = '')
{
$templates = array();
+
if ( $templateName )
{
$templates = Template::read($templateName);
}
- $types = $this->skin->getAvailableTypes();
+ $types = $this->parser->skin->getAvailableTypes();
ksort($types);
- if ( array_key_exists('ADMINSKINTYPELIST_HEAD', $templates) && !empty($templates['ADMINSKINTYPELIST_HEAD']) )
+ /* NOTE: set templates for HEAD/BODY/FOOT */
+ if ( !array_key_exists('ADMINSKINTYPELIST_HEAD', $templates) || empty($templates['ADMINSKINTYPELIST_HEAD']) )
{
- $template['head'] = $templates['ADMINSKINTYPELIST_HEAD'];
+ $template['head'] = "<ul>\n";
}
else
{
- $template['head'] = "<ul>\n";
+ $template['head'] = $templates['ADMINSKINTYPELIST_HEAD'];
}
-
- echo $template['head'];
-
- if ( array_key_exists('ADMINSKINTYPELIST_BODY', $templates) && !empty($templates['ADMINSKINTYPELIST_BODY']) )
+ if ( !array_key_exists('ADMINSKINTYPELIST_BODY', $templates) || empty($templates['ADMINSKINTYPELIST_BODY']) )
+ {
+ $template['body'] = "<li>"
+ . "<a tabindex=\"<%tabindex%>\" href=\"index.php?action=adminskinedittype&skinid=<%skinid%>&type=<%skintype%>\"><%name%></a> <%help%>"
+ . "</li>\n";
+ }
+ else
{
$template['body'] = $templates['ADMINSKINTYPELIST_BODY'];
}
+ if ( !array_key_exists('ADMINSKINTYPELIST_FOOT', $templates) || empty($templates['ADMINSKINTYPELIST_FOOT']) )
+ {
+ $template['foot'] = "</ul>\n";
+ }
else
{
- $template['body'] = '<li><a tabindex="<%tabindex%>" href="index.php?action=adminskinedittype&skinid=<%skinid%>&type=<%skintype%>">'
- . "<%name%></a> <%help%></li>\n";
+ $template['foot'] = $templates['ADMINSKINTYPELIST_FOOT'];
}
- $handler = new Actions('template', $template, new ADMIN);
+ $handler = new AdminActions('template');
$parser = new PARSER($handler);
+ /* NOTE: do output */
+ echo $template['head'];
foreach ( $types as $type => $fName )
{
- $helplink = $this->customHelpHtml('skinpart' . $type, $templateName);
+ $helplink = $this->customHelpHtml("skinpart{$type}{$templateName}");
$data = array(
'tabindex' => $tabindex,
'skintype' => $type,
'help' => $helplink,
'skinid' => intrequestVar('skinid'),
);
- $templateBody = Template::fill($template['body'], $data);
- $parser->parse($templateBody);
+ $parser->parse(Template::fill($template['body'], $data));
$tabindex++;
}
- if ( array_key_exists('ADMINSKINTYPELIST_FOOT', $templates) && !empty($templates['ADMINSKINTYPELIST_FOOT']) )
- {
- $template['foot'] = $templates['ADMINSKINTYPELIST_FOOT'];
- }
- else
- {
- $template['foot'] = " </ul>\n";
- }
echo $template['foot'];
+
return;
}
public function parse_defblogselect($templateName = '')
{
global $CONF;
- $query = "SELECT bname as text, bnumber as value FROM %s;";
+
+ $query = "SELECT bname as text, bnumber as value FROM %s;";
$query = sprintf($query, sql_table('blog'));
- $template['name'] = 'DefaultBlog';
+
+ $template['name'] = 'DefaultBlog';
$template['selected'] = $CONF['DefaultBlog'];
$template['tabindex'] = 10;
+
Showlist($query, 'select', $template, $templateName);
+
return;
}
public function parse_defcatselect($templateName = '')
{
global $manager;
+
$blogid = intRequestVar('blogid');
- $blog = $manager->getBlog($blogid);
- $query = "SELECT cname as text, catid as value FROM %s WHERE cblog=%d;";
+ $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;
+
Showlist($query, 'select', $template, $templateName);
+
return;
}
*/
public function parse_defskinselect($type = 'blog', $templateName = '')
{
- global $manager;
- $query = "SELECT sdname as text, sdnumber as value FROM %s;";
+ global $CONF, $manager;
+
+ $query = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdname NOT LIKE 'admin/%%';";
$query = sprintf($query, sql_table('skin_desc'));
$blogid = intRequestVar('blogid');
if ( !$blogid )
{
- global $CONF;
$template['selected'] = $CONF['BaseSkin'];
}
else
{
- $blog = $manager->getBlog($blogid);
+ $blog = $manager->getBlog($blogid);
$template['selected'] = $blog->getDefaultSkin();
}
$template['name'] = $nname;
$template['tabindex'] = 50;
+
Showlist($query, 'select', $template, $templateName);
+
return;
}
public function parse_deleteitembody()
{
global $manager;
+
$itemid = intRequestVar('itemid');
- $item =& $manager->getItem($itemid, 1, 1);
- $body = strip_tags($item['body']);
+ $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);
+ $item =& $manager->getItem($itemid, 1, 1);
+
echo Entity::hsc(strip_tags($item['title']));
+
return;
}
public function parse_editadminskintype($type = 'id')
{
global $CONF, $manager, $member;
-// $skinid = intRequestVar('skinid');
-// $skin = new Skin($skinid);
- $fNames = $this->skin->getAvailableTypes();
+
+ $fNames = $this->parser->skin->getAvailableTypes();
$sType = strtolower(trim(requestVar('type')));
switch ( $type )
echo intRequestVar('skinid');
break;
case 'name':
- echo Entity::hsc($this->skin->getName());
+ echo Entity::hsc($this->parser->skin->getName());
break;
case 'desc':
- echo Entity::hsc($this->skin->getDescription());
+ echo Entity::hsc($this->parser->skin->getDescription());
break;
case 'type':
- echo Entity::hsc($this->skin->getContentType());
+ echo Entity::hsc($this->parser->skin->getContentType());
break;
case 'content':
- echo Entity::hsc($this->skin->getContentFromDB($sType));
+ echo Entity::hsc($this->parser->skin->getContentFromDB($sType));
break;
case 'skintype':
$skinType = !array_key_exists($sType, $fNames) ? ucfirst($sType) : $fNames[$sType];
echo Entity::hsc($sType);
break;
case 'prefix':
- echo Entity::hsc($this->skin->getIncludePrefix());
+ echo Entity::hsc($this->parser->skin->getIncludePrefix());
break;
case 'mode':
$incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
}
/**
- * AdminActions::parse_editadmintemplateinfo()
- * Parse skinvar editadmintemplateinfo
+ * AdminActions::parse_editcomment()
+ * Parse skinvar editcomment
*
- * @param string $type type of skin template
- * @param string $description description of template
- * @param string $name name of stemplate
- * @param string $tabindex index number for tabindex attribute of input element
- * @param string $big
- * @param string $tplt
+ * @param string $type type of comment setting
+ * @return void
*/
- public function parse_editadmintemplateinfo($type, $description = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
+ public function parse_editcomment($type = 'id')
{
global $manager;
- $templateid = intRequestVar('templateid');
- $templatename = Template::getNameFromId($templateid);
- $templatedescription = Template::getDesc($templateid);
- $template =& Template::read($templatename);
+
+ $commentid = intRequestVar('commentid');
+ $comment = COMMENT::getComment($commentid);
+
+ $manager->notify('PrepareCommentForEdit', array('comment' => &$comment));
+
switch ( $type )
{
case 'id':
- echo intval($templateid);
- break;
- case 'name':
- echo Entity::hsc($templatename);
- break;
- case 'desc':
- echo Entity::hsc($templatedescription);
+ echo intRequestVar('commentid');
break;
- case 'extratemplate':
- $tabidx = 600;
- $pluginfields = array();
- $manager->notify(
- 'AdminTemplateExtraFields',
- array(
- 'fields' => &$pluginfields
- )
- );
- $tmplt = array();
- if ( $description )
- {
- $tmplt = Template::read($description);
- }
- if ( array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) && !empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
+ case 'user':
+ if ( !array_key_exists('member', $comment) || empty($comment['member']) )
{
- $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
+ echo $comment['user'] . " (" . _EDITC_NONMEMBER . ")";
}
else
{
- $base = "</tr>\n"
- . "<tr>\n"
- . "\t" . '<th colspan="2"><%explugtplname%>' . "</th>\n";
- }
- foreach ( $pluginfields as $pfkey => $pfvalue )
- {
- $data = array(
- 'explugtplname' => Entity::hsc($pfkey)
- );
- echo Template::fill($base, $data);
- foreach ( $pfvalue as $pffield => $pfdesc )
- {
- $this->_templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
- }
- }
- break;
- default:
- $desc = defined($description) ? constant($description) : $description;
- $name = defined($name) ? constant($name) : $name;
- $this->_templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
- break;
- }
- return;
- }
-
- /**
- * AdminActions::parse_editcomment()
- * Parse skinvar editcomment
- *
- * @param string $type type of comment setting
- * @return void
- */
- public function parse_editcomment($type = 'id')
- {
- global $manager;
- $commentid = intRequestVar('commentid');
- $comment = COMMENT::getComment($commentid);
-
- $manager->notify('PrepareCommentForEdit', array('comment' => &$comment));
-
- switch ( $type )
- {
- case 'id':
- echo intRequestVar('commentid');
- break;
- case 'user':
- if (array_key_exists('member', $comment) && !empty($comment['member']) )
- {
echo $comment['member'] . " (" . _EDITC_MEMBER . ")";
}
- else
- {
- echo $comment['user'] . " (" . _EDITC_NONMEMBER . ")";
- }
break;
case 'date':
echo date("Y-m-d @ H:i", $comment['timestamp']);
$comment['body'] = str_replace('<br />', '', $comment['body']);
$comment['body'] = preg_replace("#<a href=['\"]([^'\"]+)['\"]( rel=\"nofollow\")?>[^<]*</a>#", "\\1", $comment['body']);
echo $comment['body'];
+ break;
+ case 'cmail':
+ echo $comment['userid'];
+ break;
+ case 'url':
+ echo $comment['userid'];
+ break;
default:
echo $comment[$type];
break;
global $manager;
// show list of members with actions
$query = 'SELECT * FROM '.sql_table('member');
- $template['content'] = 'memberlist';
+ $template['content'] = 'memberlist';
$template['tabindex'] = 10;
$batch = new Batch('member');
- $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);
+ $batch->showList($query, 'table', $template, $templateName, _LISTS_NOMORE);
return;
}
public function parse_editmember($type = 'id', $templateName = '')
{
global $CONF, $manager, $member;
- $memberid = intRequestVar('memberid');
- $mem = MEMBER::createFromID($memberid);
+
+ $memberid = intRequestVar('memberid');
+ $mem = MEMBER::createFromID($memberid);
switch ( $type )
{
*/
public function parse_editpluginfo($type)
{
+ global $manager;
+
$pid = intRequestVar('plugid');
switch ( $type )
{
echo $pid;
break;
case 'name':
- echo Entity::hsc(getPluginNameFromPid($pid));
+ echo Entity::hsc($manager->getPluginNameFromPid($pid));
break;
}
return;
$aOptions = array();
$aOIDs = array();
- $query = "SELECT * FROM %s WHERE ocontext='global' AND opid=%d ORDER BY oid ASC";
+ $query = "SELECT * FROM %s WHERE ocontext='global' AND opid=%d ORDER BY oid ASC;";
$query = sprintf($query, sql_table('plugin_option_desc'), (integer) $pid);
- $resource = sql_query($query);
+ $resource = DB::getResult($query);
- while ( $o = sql_fetch_object($resource) )
- {
- array_push($aOIDs, $o->oid);
- $aOptions[$o->oid] = array(
-
- 'oid' => $o->oid,
- 'value' => $o->odef,
- 'name' => $o->oname,
- 'description' => $o->odesc,
- 'type' => $o->otype,
- 'typeinfo' => $o->oextra,
+ foreach ( $resource as $row )
+ {
+ array_push($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
);
}
$query = 'SELECT oid, ovalue FROM %s WHERE oid in (%s)';
$query = sprintf($query, sql_table('plugin_option'), implode(',', $aOIDs));
- $result = sql_query($query);
+ $result = DB::getResult($query);
- while ( $o = sql_fetch_object($result) )
+ foreach ( $result as $row )
{
- $aOptions[$o->oid]['value'] = $o->ovalue;
+ $aOptions[$row['oid']]['value'] = $row['ovalue'];
}
}
// call plugins
- $manager->notify(
- 'PrePluginOptionsEdit',
- array(
- 'context' => 'global',
- 'plugid' => $pid,
- 'options' => &$aOptions
- )
+ $data = array(
+ 'context' => 'global',
+ 'plugid' => $pid,
+ 'options' => &$aOptions
);
+ $manager->notify('PrePluginOptionsEdit', $data);
$template['content'] = 'plugoptionlist';
- $amount = Showlist($aOptions, 'table', $template, $templateName);
+
+ $amount = Showlist($aOptions, 'table', $template, $templateName);
+
if ( $amount == 0 )
{
echo '<p>' . _ERROR_NOPLUGOPTIONS . "</p>\n";
public function parse_editskintype($type = 'id')
{
global $CONF, $manager, $member;
- $skinid = intRequestVar('skinid');
- $skin = new SKIN($skinid);
- $fNames = $skin->getAvailableTypes();
- $sType = strtolower(trim(requestVar('type')));
+ $skinid = intRequestVar('skinid');
+ $skin = new SKIN($skinid);
+ $fNames = $skin->getAvailableTypes();
+ $sType = strtolower(trim(requestVar('type')));
switch ( $type )
{
* @param string $tabindex index value for tabindex attribute of input element
* @param string $big
* @param string $tplt name of template
+ * @return boolean
*/
- public function parse_edittemplateinfo($type, $description = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
+ public function parse_edittemplateinfo($type, $desc = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
{
global $manager;
- $templateid = intRequestVar('templateid');
- $templatename = Template::getNameFromId($templateid);
- $templatedescription = Template::getDesc($templateid);
- $template =& $manager->getTemplate($templatename);
+
+ $t_id = intRequestVar('templateid');
+ $t_name = Template::getNameFromId($t_id);
+ $t_desc = Template::getDesc($t_id);
+ $template = &Template::read($t_name);
+
switch ( $type )
{
case 'id':
- echo intval($templateid);
+ echo intval($t_id);
break;
case 'name':
- echo Entity::hsc($templatename);
+ echo Entity::hsc($t_name);
break;
case 'desc':
- echo Entity::hsc($templatedescription);
+ echo Entity::hsc($t_desc);
break;
case 'extratemplate':
- $tabidx = 600;
+ $tabidx = 600;
$pluginfields = array();
- $manager->notify(
- 'TemplateExtraFields',
- array(
- 'fields' => &$pluginfields
- )
- );
+ $manager->notify('TemplateExtraFields', array('fields' => &$pluginfields));
+
$tmplt = array();
- if ( $description )
+ if ( $desc )
+ {
+ $tmplt = Template::read($desc);
+ }
+ if ( !array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) || empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
{
- $tmplt = Template::read($description);
+ $base = "</tr>\n"
+ . "<tr>\n"
+ . '<th colspan="2"><%explugtplname%>' . "</th>\n";
}
- if ( array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) && !empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
+ else
{
$base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
}
+
+ foreach ( $pluginfields as $pfkey => $pfvalue )
+ {
+ $data = array('explugtplname' => Entity::hsc($pfkey));
+
+ echo Template::fill($base, $data);
+
+ foreach ( $pfvalue as $pffield => $pfdesc )
+ {
+ $this->templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
+ }
+ }
+ break;
+ default:
+ $desc = defined($desc) ? constant($desc) : $desc;
+ $name = defined($name) ? constant($name) : $name;
+ $this->templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
+ break;
+ }
+
+ return;
+ }
+
+ /**
+ * AdminActions::parse_editadmintemplateinfo()
+ * Parse skinvar editadmintemplateinfo
+ *
+ * @param string $type type of skin template
+ * @param string $description description of template
+ * @param string $name name of stemplate
+ * @param string $tabindex index number for tabindex attribute of input element
+ * @param string $big
+ * @param string $tplt
+ */
+ public function parse_editadmintemplateinfo($type, $desc = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
+ {
+ global $manager;
+
+ $t_id = intRequestVar('templateid');
+ $t_name = Template::getNameFromId($t_id);
+ $t_desc = Template::getDesc($t_id);
+ $template = &Template::read($t_name);
+
+ switch ( $type )
+ {
+ case 'id':
+ echo intval($t_id);
+ break;
+ case 'name':
+ echo Entity::hsc($t_name);
+ break;
+ case 'desc':
+ echo Entity::hsc($t_desc);
+ break;
+ case 'extratemplate':
+ $tabidx = 600;
+ $pluginfields = array();
+ $manager->notify('AdminTemplateExtraFields', array('fields' => &$pluginfields));
+
+ $tmplt = array();
+ if ( $desc )
+ {
+ $tmplt = Template::read($desc);
+ }
+ if ( !array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) || empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
+ {
+ $base = "</tr>\n"
+ . "<tr>\n"
+ . '<th colspan="2"><%explugtplname%>' . "</th>\n";
+ }
else
{
- $base = "</tr><tr>\n"
- . "\t" . '<th colspan="2"><%explugtplname%>' . "</th>\n";
+ $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
}
+
foreach ( $pluginfields as $pfkey => $pfvalue )
{
- $data = array(
- 'explugtplname' => Entity::hsc($pfkey)
- );
+ $data = array('explugtplname' => Entity::hsc($pfkey));
+
echo Template::fill($base, $data);
+
foreach ( $pfvalue as $pffield => $pfdesc )
{
- $this->_templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
+ $this->templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
}
}
break;
default:
- $desc = defined($description) ? constant($description) : $description;
+ $desc = defined($desc) ? constant($desc) : $desc;
$name = defined($name) ? constant($name) : $name;
- $this->_templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
+ $this->templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
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':
- $data = array(
- 'type' => 'membermailform-notloggedin',
- );
+ $data = array('type' => 'membermailform-notloggedin',);
break;
}
$manager->notify('FormExtra', $data);
public function parse_extrahead()
{
global $manager;
+
$extrahead = Admin::getAdminextrahead();
- $manager->notify(
- 'AdminPrePageHead',
- array(
- 'extrahead' => &$extrahead,
- 'action' => Admin::getAdminAction()
- )
+
+ $data = array(
+ 'extrahead' => &$extrahead,
+ 'action' => Admin::getAdminAction()
);
+
+ $manager->notify('AdminPrePageHead', $data);
echo $extrahead;
return;
}
-
/**
* AdminActions::parse_member()
* Parse skinvar member
echo $member->getID();
break;
case 'yourprofileurl':
- if ($CONF['URLMode'] == 'pathinfo')
+ if ( $CONF['URLMode'] == 'pathinfo' )
+ {
echo Link::create_member_link($member->getID());
+ }
else
+ {
echo $CONF['IndexURL'] . Link::create_member_link($member->getID());
+ }
break;
}
}
*/
public function parse_getblogsetting($which)
{
- global $blog;
+ global $blog, $manager;
if ( $blog )
{
}
elseif ( $bid = intRequestVar('blogid') )
{
- global $manager;
$b = $manager->getBlog($bid);
}
else
return $pid;
break;
case 'name':
- return Entity::hsc(getPluginNameFromPid($pid));
+ return Entity::hsc($manager->getPluginNameFromPid($pid));
break;
}
return;
*/
public function parse_helplink($topic = '')
{
- if ( empty($topic) )
+ if ( !empty($topic) )
{
- return;
+ help($topic);
}
- help($topic);
return;
}
public function parse_helpplugname()
{
$plugid = intGetVar('plugid');
- Entity::hsc(getPluginNameFromPid($plugid));
+ Entity::hsc($manager->getPluginNameFromPid($plugid));
return;
}
* some init stuff for all forms
*
* @param void
+ * @return void
*/
- function parse_init()
+ public function parse_init()
{
global $manager;
- $item = false;
+
+ $item = false;
if ( requestVar('action') == 'itemedit' )
{
$itemid = intRequestVar('itemid');
- $item =& $manager->getItem($itemid, 1, 1);
- $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
+ $item =& $manager->getItem($itemid, 1, 1);
+
+ $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
if ( $item && $blog->convertBreaks() )
{
$item['body'] = removeBreaks($item['body']);
}
elseif ( requestVar('action') == 'createitem' )
{
- $blog =& $manager->getBlog(intRequestVar($blogid));
+ $blogid = intRequestVar('blogid');
+ $blog =& $manager->getBlog($blogid);
$authorid = '';
}
$blog->insertJavaScriptInfo($authorid);
+ return;
}
/**
*/
public function parse_insertpluginfo($type)
{
- $option = Admin::$aOptions;
+ $option = Admin::getAdminaOption();
switch ( $type )
{
case 'id':
{
$templates = Template::read($templateName);
}
- if (array_key_exists('INSERT_PLUGOPTION_TITLE', $templates) && !empty($templates['INSERT_PLUGOPTION_TITLE']) )
+
+ if ( !array_key_exists('INSERT_PLUGOPTION_TITLE', $templates) || empty($templates['INSERT_PLUGOPTION_TITLE']) )
{
- $template['title'] = $templates['INSERT_PLUGOPTION_TITLE'];
+ $template['title'] = "<tr>"
+ . "<th colspan=\"2\"><%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%></th>"
+ . "</tr>\n";
}
else
{
- $template['title'] = '<tr><th colspan="2"><%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%></th></tr>' . "\n";
+ $template['title'] = $templates['INSERT_PLUGOPTION_TITLE'];
}
- if ( array_key_exists('INSERT_PLUGOPTION_BODY', $templates) && !empty($templates['INSERT_PLUGOPTION_BODY']) )
+
+ if ( !array_key_exists('INSERT_PLUGOPTION_BODY', $templates) || empty($templates['INSERT_PLUGOPTION_BODY']) )
{
- $template['body'] = $templates['INSERT_PLUGOPTION_BODY'];
+ $template['body'] = "<tr>"
+ . "<%listplugplugoptionrow%>"
+ . "</tr>\n";
}
else
{
- $template['body'] = '<tr><%listplugplugoptionrow%></tr>' . "\n";
+ $template['body'] = $templates['INSERT_PLUGOPTION_BODY'];
}
$prevPid = -1;
+ include_libs('ACTIONS.php');
+ $handler = new Actions($this->skintype);
+ $parser = new PARSER($handler);
+
foreach ( $options as $option )
{
- $handler = new Actions($this->skintype, $template, $option);
-
- $parser = new PARSER($handler);
// new plugin?
if ( $prevPid != $option['pid'] )
$prevPid = $option['pid'];
$parser->parse($template['title']);
}
+
$meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
+
if ( @$meta['access'] != 'hidden' )
{
$parsed = $parser->parse($template['body']);
*/
public function parse_insplugoptcontent()
{
- $option = Admin::$aOption;
+ $option = Admin::getAdminaOption();
- $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
- if (array_key_exists('access', $meta) && $meta['access'] != 'hidden')
+ $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
+ if ( array_key_exists('access', $meta) && $meta['access'] != 'hidden' )
{
echo '<tr>';
listplug_plugOptionRow($option);
if ( requestVar('ip') )
{
$iprangeVal = Entity::hsc(requestVar('ip'));
- echo '<input name="iprange" type="radio" value="' . $iprangeVal . '" checked="checked" id="ip_fixed" />' . "\n";
- echo '<label for="ip_fixed">' . $iprangeVal . "</label><br />\n";
+ echo "<input name=\"iprange\" type=\"radio\" value=\"{$iprangeVal}\" checked=\"checked\" id=\"ip_fixed\" />\n";
+ echo "<label for=\"ip_fixed\">{$iprangeVal}</label><br />\n";
echo '<input name="iprange" type="radio" value="custom" id="ip_custom" />' . "\n";
echo '<label for="ip_custom">' . _BAN_IP_CUSTOM . '</label>' . "\n";
- echo '<input name="customiprange" value="' . $iprangeVal . '" maxlength="15" size="15" />' . "\n";
+ echo "<input name=\"customiprange\" value=\"{$iprangeVal}\" maxlength=\"15\" size=\"15\" />\n";
}
else
{
* @param void
* @return void
*/
- public function parse_itemnavlist()
+ public function parse_itemnavlist($templateName)
{
global $CONF, $manager, $member;
- if ( $this->skintype == 'itemlist' )
- {
- $blogid = intRequestVar('blogid');
- $blog =& $manager->getBlog($blogid);
- }
- if ( postVar('start') )
- {
- $start = intPostVar('start');
- }
- else
- {
- $start = 0;
- }
- // amount of items to show
- if ( postVar('amount') )
- {
- $amount = intPostVar('amount');
- }
- else
- {
- $amount = intval($CONF['DefaultListSize']);
- if ( $amount < 1 )
- {
- $amount = 10;
- }
- }
$query = "SELECT bshortname, cname, mname, ititle, ibody, inumber, idraft, itime"
. " FROM %s, %s, %s, %s"
. " WHERE iblog=bnumber AND iauthor=mnumber AND icat=catid";
if ( $this->skintype == 'itemlist' )
{
- $query .= ' AND iblog = ' . $blogid;
+ $blog = FALSE;
+ if ( array_key_exists('blogid', $_REQUEST) )
+ {
+ $blogid = intRequestVar('blogid');
+ }
+ else if ( array_key_exists('itemid', $_REQUEST) )
+ {
+ $itemid = intRequestVar('itemid');
+ $item = &$manager->getItem($itemid, 1, 1);
+ $blogid = (integer) $item['blogid'];
+ }
+ $blog =& $manager->getBlog($blogid);
+
+ $query .= " AND iblog={$blogid}";
$template['now'] = $blog->getCorrectTime(time());
// non-blog-admins can only edit/delete their own items
if ( !empty($search) )
{
- $query .= ' AND ((ititle LIKE "%' . sql_real_escape_string($search) . '%") '
- . ' OR (ibody LIKE "%' . sql_real_escape_string($search) . '%") '
- . ' OR (imore LIKE "%' . sql_real_escape_string($search) . '%"))';
+ $query .= ' AND ((ititle LIKE ' . DB::quoteValue('%'.$search.'%') . ') '
+ . ' OR (ibody LIKE ' . DB::quoteValue('%'.$search.'%') . ') '
+ . ' OR (imore LIKE ' . DB::quoteValue('%'.$search.'%') . '))';
+ }
+
+ if ( postVar('start') )
+ {
+ $start = intPostVar('start');
+ }
+ else
+ {
+ $start = 0;
+ }
+
+ // amount of items to show
+ if ( postVar('amount') )
+ {
+ $amount = intPostVar('amount');
+ }
+ else
+ {
+ $amount = (integer) $CONF['DefaultListSize'];
+ if ( $amount < 1 )
+ {
+ $amount = 10;
+ }
}
+
$query .= ' ORDER BY itime DESC'
. " LIMIT {$start},{$amount}";
$template['content'] = 'itemlist';
-
+
$navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $blogid, $search, 0);
- $navList->showBatchList('item', $query, 'table', $template);
+ $navList->showBatchList('item', $query, 'table', $template, '', $templateName);
return;
}
/**
- * AdminActions::parse_itemoptions()
- * Parse skinvar itemoptions
- * Adds the itemOptions of a plugin to a page
- * @author TeRanEX
- */
- function parse_itemoptions()
- {
- $this->parse_pluginoptions($type = 'item');
-// global $itemid;
-// Admin::insertPluginOptions('item', $itemid);
- }
-
- /**
- * AdminActions::parse_itemoptions()
- *
+ * AdminActions::parse_itemtime()
* date change on edit item
*
- * Parse skinvar itemoptions
- * Adds the itemOptions of a plugin to a page
- * @author TeRanEX
+ * @param string $key key of PHP's getDate()
+ * @return void
*/
- function parse_itemtime($what)
+ public function parse_itemtime($key)
{
global $manager;
- $item = false;
+
+ $item = false;
$itemid = intRequestVar('itemid');
- $item =& $manager->getItem($itemid, 1, 1);
+ $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' )
{
- $manager->notify(
- 'PreAddItemForm',
- array(
- 'contents' => &$contents,
- 'blog' => &$this->blog
- )
+ $data = array(
+ 'contents' => &$contents,
+ 'blog' => &$this->blog
);
+ $manager->notify('PreAddItemForm', $data);
}
$itemtime = getdate($contents['timestamp']);
- echo $itemtime[$what];
+ echo $itemtime[$key];
+ return;
}
/**
_SETTINGS_JSTOOLBAR_SIMPLE,
_SETTINGS_JSTOOLBAR_FULL
);
+
$i = 1;
foreach ( $options as $option )
{
return;
}
/**
- * Parse skinvar languageselectoptions
+ * AdminActions::parse_localeselectoptions()
+ * Parse skinvar localeselectoptions
+ *
+ * @param void
+ * @return void
*/
- function parse_languageselectoptions()
+ public function parse_localeselectoptions()
{
$locales = i18n::get_available_locale_list();
- $memid = intRequestVar('memberid');
- if ($memid)
+
+ $memid = intRequestVar('memberid');
+ if ( $memid )
{
$mem = MEMBER::createFromID($memid);
if ( !$mem->getLocale() || !in_array($mem->getLocale(), $locales) )
{
- echo "<option value=\"\" selected=\"selected\">" . ENTITY::hsc(_MEMBERS_USESITELANG) . "</option>\n";
+ echo "<option value=\"\" selected=\"selected\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
}
else
{
- echo "<option value=\"\">" . ENTITY::hsc(_MEMBERS_USESITELANG) . "</option>\n";
+ echo "<option value=\"\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
}
}
else
{
echo "<option value=\"\" selected=\"selected\">en_Latn_US</option>\n";
}
+ else
+ {
+ echo "<option value=\"\">en_Latn_US</option>\n";
+ }
}
foreach ( $locales as $locale )
{
- if ($memid)
+ if ( $locale == 'en_Latn_US' )
+ {
+ continue;
+ }
+ else if ($memid)
{
if ( $locale == $mem->getLocale() )
{
}
}
}
- }
-
- /**
- * AdminActions::parse_localeselectoptions()
- * Parse skinvar localeselectoptions
- *
- * @param void
- * @return void
- */
- public function parse_localeselectoptions()
- {
- $locales = i18n::get_available_locale_list();
- $memid = intRequestVar('memberid');
- if ( $memid )
- {
- $mem = MEMBER::createFromID($memid);
- if ( !$mem->getLocale() || !in_array($mem->getLocale(), $locales) )
- {
- echo "<option value=\"\" selected=\"selected\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
- }
- else
- {
- echo "<option value=\"\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
- }
- }
- else
- {
- if ( !i18n::get_current_locale() || !in_array(i18n::get_current_locale(), $locales) )
- {
- echo "<option value=\"\" selected=\"selected\">en_Latn_US</option>\n";
- }
- }
- foreach ( $locales as $locale )
- {
- if ($memid)
- {
- if ( $locale == $mem->getLocale() )
- {
- echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
- }
- else
- {
- echo "<option value=\"{$locale}\">{$locale}</option>\n";
- }
- }
- else
- {
- if ( $locale == i18n::get_current_locale() )
- {
- echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
- }
- else
- {
- echo "<option value=\"{$locale}\">{$locale}</option>\n";
- }
- }
- }
- return;
+ return;
}
/**
*/
public function parse_listplugplugoptionrow($templateName = '')
{
- echo listplug_plugOptionRow(Admin::$aOptions, $templateName);
+ echo listplug_plugOptionRow(Admin::getAdminaOption(), $templateName);
return;
}
if ( $this->skintype == 'itemmove' )
{
$query = "SELECT icat as result FROM %s WHERE inumber=%d;";
- $query = spriintf($query, sql_table('item'), intRequestVar('itemid'));
- $catid = quickQuery(sprintf($query, intRequestVar('itemid')));
+ $query = sprintf($query, sql_table('item'), intRequestVar('itemid'));
+ $catid = DB::getValue(sprintf($query, intRequestVar('itemid')));
Admin::selectBlogCategory('catid', $catid, 10, 1);
}
break;
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 . '">';
{
$blogid = intRequestVar('blogid');
- $query = "SELECT tmember FROM %s WHERE tblog=%d;";
+ $query = "SELECT tmember FROM %s WHERE tblog=%d;";
$query = sprintf($query, sql_table('team'), (integer) $blogid);
- $res = sql_query($query);
+ $res = DB::getResult($query);
$tmem = array();
- while ( $tmember = sql_fetch_object($res) )
+ foreach ( $res as $row )
{
- $tmem[] = intval($tmember->tmember);
+ $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['name'] = 'memberid';
- $template['tabindex'] = 10000;
+ $template = array(
+ 'name' => 'memberid',
+ 'tabindex' => 10000,
+ 'selected' => 0
+ );
Showlist($query, 'select', $template, $templateName);
return;
}
*/
public function parse_outputspecialdirs($type)
{
+ global $DIR_MEDIA, $DIR_NUCLEUS;
+
switch ( $type )
{
case 'nucleusdir':
- global $DIR_NUCLEUS;
echo Entity::hsc($DIR_NUCLEUS);
break;
case 'mediadir':
- global $DIR_MEDIA;
echo Entity::hsc($DIR_MEDIA);
break;
}
{
$passvar = Admin::getAdminpassvar();
$oldaction = postVar('oldaction');
+
if ( ($oldaction != 'logout')
&& ($oldaction != 'login')
&& $passvar
case 'member':
$id = intRequestVar('memberid');
$mem = MEMBER::createFromID($id);
- $manager->notify(
- 'MemberSettingsFormExtras',
- array(
- 'member' => &$mem
- )
- );
+ $manager->notify('MemberSettingsFormExtras', array('member' => &$mem));
break;
case 'blog':
$id = intRequestVar('blogid');
$blg = $manager->getBlog($id);
- $manager->notify(
- 'BlogSettingsFormExtras',
- array(
- 'member' => &$blg
- )
- );
+ $manager->notify('BlogSettingsFormExtras', array('member' => &$blg));
break;
default:
$manager->notify(
public function parse_pluginhelp()
{
global $manager, $DIR_PLUGINS;
+
$plugid = intGetVar('plugid');
- $plugName = getPluginNameFromPid($plugid);
+ $plugName = $manager->getPluginNameFromPid($plugid);
$plug =& $manager->getPlugin($plugName);
if ( $plug->supportsFeature('HelpPage') > 0 )
*/
public function parse_pluginlistlist($templateName = '')
{
- $query = "SELECT * FROM %s ORDER BY porder ASC;";
+ $query = "SELECT * FROM %s ORDER BY porder ASC;";
$query = sprintf($query, sql_table('plugin'));
+
$template['content'] = 'pluginlist';
$template['tabindex'] = 10;
+
Showlist($query, 'table', $template, $templateName);
+
return;
}
* @param string $type type of plugin option
* @return void
*/
- public function parse_pluginoptions($type = 'global')
+ public function parse_pluginoptions($context='global')
{
- switch ( $type )
+ global $itemid, $manager;
+
+ switch ( $context )
{
case 'member':
- $id = intRequestVar('memberid');
+ $contextid = intRequestVar('memberid');
break;
case 'blog':
- $id = intRequestVar('blogid');
+ $contextid = intRequestVar('blogid');
break;
case 'category':
- $id = intRequestVar('catid');
+ $contextid = intRequestVar('catid');
break;
case 'item':
- global $itemid;
- $id = $itemid;
+ $contextid = $itemid;
+ break;
+ }
+
+ /* Actually registererd plugin options */
+ $aIdToValue = array();
+ $query = "SELECT oid, ovalue FROM %s WHERE ocontextid=%d;";
+ $query = sprintf($query, sql_table('plugin_option'), (integer) $contextid);
+ $res = DB::getResult($query);
+ foreach ( $res as $row )
+ {
+ $aIdToValue[$row['oid']] = $row['ovalue'];
+ }
+
+ /* Currently available plugin options */
+ $query = "SELECT * FROM %s, %s WHERE opid=pid and ocontext= %s ORDER BY porder, oid ASC;";
+ $query = sprintf($query, sql_table('plugin_option_desc'), sql_table('plugin'), DB::quoteValue($context));
+ $res = DB::getResult($query);
+
+ $options = array();
+ foreach ($res as $row )
+ {
+ if ( !array_key_exists($row['oid'], $aIdToValue) )
+ {
+ $value = $row['odef'];
+ }
+ else
+ {
+ $value = $aIdToValue[$row['oid']];
+ }
+
+ $options[] = array(
+ 'pid' => $row['pid'],
+ 'pfile' => $row['pfile'],
+ 'oid' => $row['oid'],
+ 'value' => $value,
+ 'name' => $row['oname'],
+ 'description' => $row['odesc'],
+ 'type' => $row['otype'],
+ 'typeinfo' => $row['oextra'],
+ 'contextid' => $contextid,
+ 'extra' => ''
+ );
}
- Admin::insertPluginOptions($type, $id);
+
+ $data = array(
+ 'context' => $context,
+ 'contextid' => $contextid,
+ 'options' => &$opt4ions
+ );
+ $manager->notify('PrePluginOptionsEdit', $data);
+
+ $content = $this->parser->skin->getContentFromDB('insertpluginoptions');
+ $this->parser->parse($content);
+
return;
}
. ' WHERE tblog=bnumber and tmember=' . $member->getID()
. ' ORDER BY bname';
}
- $template['name'] = 'blogid';
- $template['tabindex'] = 15000;
- $template['extra'] = _QMENU_ADD_SELECT;
- $template['selected'] = -1;
+
+ $template['name'] = 'blogid';
+ $template['tabindex'] = 15000;
+ $template['extra'] = _QMENU_ADD_SELECT;
+ $template['selected'] = -1;
$template['shorten'] = 10;
- $template['shortenel'] = '';
- $template['javascript'] = 'onchange="return form.submit()"';
+ $template['shortenel'] = '';
+ $template['javascript'] = 'onchange="return form.submit()"';
+
Showlist($query, 'select', $template, $templateName);
+
return;
}
);
if ( count($pluginExtras) > 0 )
{
- if ( array_key_exists('PLUGIN_QUICKMENU_TITLE', $templates) || !empty($templates['PLUGIN_QUICKMENU_TITLE']) )
+ if ( !array_key_exists('PLUGIN_QUICKMENU_TITLE', $templates) || empty($templates['PLUGIN_QUICKMENU_TITLE']) )
{
- $template['title'] = $templates['PLUGIN_QUICKMENU_TITLE'];
+ $template['title'] = "<h2><%text(_QMENU_PLUGINS)%></h2>\n";
}
else
{
- $template['title'] = '<h2><%text(_QMENU_PLUGINS)%></h2>';
+ $template['title'] = $templates['PLUGIN_QUICKMENU_TITLE'];
}
- $handler = new Actions($this->skintype);
-
- $parser = new PARSER($handler);
- $parser->parse($template['title']);
-
- if ( array_key_exists('PLUGIN_QUICKMENU_HEAD', $templates) || !empty($templates['PLUGIN_QUICKMENU_HEAD']) )
+ if ( !array_key_exists('PLUGIN_QUICKMENU_HEAD', $templates) || empty($templates['PLUGIN_QUICKMENU_HEAD']) )
{
- $template['head'] = $templates['PLUGIN_QUICKMENU_HEAD'];
+ $template['head'] = "<ul>\n";
}
else
{
- $template['head'] = '<ul>';
+ $template['head'] = $templates['PLUGIN_QUICKMENU_HEAD'];
}
-
- echo $template['head'];
-
- if ( array_key_exists('PLUGIN_QUICKMENU_BODY', $templates) || !empty($templates['PLUGIN_QUICKMENU_BODY']) )
+ 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";
+ }
+ else
{
$template['body'] = $templates['PLUGIN_QUICKMENU_BODY'];
}
+ if ( !array_key_exists('PLUGIN_QUICKMENU_FOOT', $templates) || empty($templates['PLUGIN_QUICKMENU_FOOT']) )
+ {
+ $template['foot'] = "</ul>\n";
+ }
else
{
- $template['body'] = '<li><a href="<%plugadminurl%>" title="<%plugadmintooltip%>"><%plugadmintitle%></a></li>';
+ $template['foot'] = $templates['PLUGIN_QUICKMENU_FOOT'];
}
+ $handler = new Actions($this->skintype);
+ $parser = new PARSER($handler);
+
+ $parser->parse($template['title']);
+ echo $template['head'];
foreach ( $pluginExtras as $aInfo )
{
$data = array(
);
echo Template::fill($template['body'], $data);
}
- if ( array_key_exists('PLUGIN_QUICKMENU_FOOT', $templates) || !empty($templates['PLUGIN_QUICKMENU_FOOT']) )
- {
- $template['foot'] = $templates['PLUGIN_QUICKMENU_FOOT'];
- }
- else
- {
- $template['foot'] = '</ul>';
- }
echo $template['foot'];
}
return;
*/
public function parse_selectlocaladminskinfiles()
{
- echo 'UUU';
global $DIR_SKINS, $manager;
+
$adminskindir = $DIR_SKINS . 'admin/';
$candidates = SkinImport::searchForCandidates($adminskindir);
+
foreach ( $candidates as $skinname => $skinfile )
{
$html = Entity::hsc($skinfile);
echo '<option value="' . $html . '">' . $skinname . "</option>\n";
}
+
return;
}
public function parse_selectlocalskinfiles()
{
global $DIR_SKINS;
+
$candidates = SkinImport::searchForCandidates($DIR_SKINS);
+
foreach ( $candidates as $skinname => $skinfile )
{
$html = Entity::hsc($skinfile);
echo '<option value="' . $html . '">' . $skinname . "</option>\n";
}
+
return;
}
switch ( $type )
{
case 'blog':
- $query = "SELECT bshortname, bname FROM %s";
+ $query = "SELECT bshortname, bname FROM %s;";
$show = array(
'content' => 'shortblognames'
);
Showlist($query, 'table', $show, $templateName);
break;
case 'template':
- $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 NOT LIKE 'admin/%%';";
$show = array(
'content' => 'shortnames'
);
}
else
{
- $template = '<td><input type="checkbox" name="<%typeid%>" id="<%expid%>" /><label for="<%expid%>"><%expname%></label></td>' . "\n"
- . "<td><%expdesc%></td>\n"
- . "</tr><tr>\n";
+ $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";
}
switch ( $type )
{
case 'skin':
- $res = sql_query('SELECT * FROM ' . sql_table('skin_desc'));
- while ( $skinObj = sql_fetch_object($res) )
+ $res = DB::getResult('SELECT * FROM ' . sql_table('skin_desc'));
+ foreach ( $res as $row )
{
$data = array(
- 'typeid' => 'skin[' . $skinObj->sdnumber . ']',
- 'expid' => 'skinexp' . $skinObj->sdnumber,
- 'expname' => Entity::hsc($skinObj->sdname),
- 'expdesc' => Entity::hsc($skinObj->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':
- $res = sql_query('SELECT * FROM '.sql_table('template_desc'). " WHERE tdname NOT LIKE 'admin/%'");
- while ($templateObj = sql_fetch_object($res)) {
+ $res = DB::getResult('SELECT * FROM '.sql_table('template_desc'). " WHERE tdname NOT LIKE 'admin/%%';");
+ foreach ( $res as $row )
+ {
$data = array(
- 'typeid' => 'template[' . $templateObj->tdnumber . ']',
- 'expid' => 'templateexp' . $templateObj->tdnumber,
- 'expname' => Entity::hsc($templateObj->tdname),
- 'expdesc' => Entity::hsc($templateObj->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($templateName = '')
{
global $CONF;
- $query = "SELECT * FROM %s WHERE sdincmode != 'admin' ORDER BY sdname";
+ $query = "SELECT * FROM %s WHERE sdname NOT LIKE 'admin/%%';";
$query = sprintf($query, sql_table('skin_desc'));
$template['content'] = 'skinlist';
$template['tabindex'] = 10;
-// $template['friendly_names'] = Skin::getFriendlyNames('Actions');
- $skin = new Skin($CONF['BaseSkin']);
- $template['friendly_names'] = $skin->getDefaultTypes();
Showlist($query, 'table', $template, $templateName);
return;
public function parse_skintypehelp()
{
$nowSkinType = strtolower(trim(requestVar('type')));
+
+ /* TODO: use Skin class */
$regularType = array(
'index',
'item',
{
$templates = Template::read($templateName);
}
+
+ /* TODO: use Skin class */
$nType = array(
'index',
'item',
$query = "SELECT stype FROM %s WHERE stype NOT IN ('%s') AND sdesc = %d;";
$query = sprintf($query, sql_table('skin'), implode("', '", $nType), $skinid);
- $res = sql_query($query);
- if ( $res && sql_num_rows($res) > 0 )
+ $res = DB::getResult($query);
+ if ( $res && $res->rowCount() > 0 )
{
$data = array();
if ( array_key_exists('SPECIALSKINLIST_HEAD', $templates) && !empty($templates['SPECIALSKINLIST_HEAD']) )
$template['head'] = "<ul>\n";
}
echo Template::fill($template['head'], $data);
- if ( array_key_exists('SPECIALSKINLIST_BODY', $templates) && !empty($templates['SPECIALSKINLIST_BODY']) )
- {
- $template['body'] = $templates['SPECIALSKINLIST_BODY'];
- }
- else
+ if ( !array_key_exists('SPECIALSKINLIST_BODY', $templates) || empty($templates['SPECIALSKINLIST_BODY']) )
{
$template['body'] = '<li><a tabindex="<%tabindex%>" href="index.php?action=skinedittype&skinid=<%skinid%>'
. '&type=<%skintype%>"><%skintype%></a> (<a tabindex="<%tabindex%>" href="index.php?'
. 'action=skinremovetype&skinid=<%skinid%>&type=<%skintype%>">remove</a>)</li>';
}
+ else
+ {
+ $template['body'] = $templates['SPECIALSKINLIST_BODY'];
+ }
+
$tabstart = 75;
- while ( $row = sql_fetch_assoc($res) )
+ foreach ( $res as $row )
{
$data = array(
- 'tabindex' => $tabstart++,
- 'skinid' => $skinid,
- 'skintype' => Entity::hsc(strtolower($row['stype']))
+ 'tabindex' => $tabstart++,
+ 'skinid' => $skinid,
+ 'skintype' => Entity::hsc(strtolower($row['stype']))
);
echo Template::fill($template['body'], $data);
}
echo phpversion();
break;
case 'sqlserverinfo':
- echo sql_get_server_info();
+ echo DB::getAttribute(PDO::ATTR_SERVER_VERSION);
break;
case 'sqlclientinfo':
- echo sql_get_client_info();
+ echo DB::getAttribute(PDO::ATTR_CLIENT_VERSION);
break;
case 'magicquotesgpc':
echo ini_get('magic_quotes_gpc') ? 'On' : 'Off';
{
$templates = Template::read($templateName);
}
- if ( array_key_exists('SYSTEMINFO_GDSETTINGS', $templates) && !empty($templates['SYSTEMINFO_GDSETTINGS']) )
+ if ( !array_key_exists('SYSTEMINFO_GDSETTINGS', $templates) || empty($templates['SYSTEMINFO_GDSETTINGS']) )
{
- $template = $templates['SYSTEMINFO_GDSETTINGS'];
+ $template = "<tr>\n"
+ . "<td><%key%></td>\n"
+ . "<td><%value%></td>\n"
+ . "</tr>\n";
}
else
{
- $template = "<tr>\n\t\t" . '<td width="50%">' . "<%key%></td><td><%value%></td>\n</tr>\n";
+ $template = $templates['SYSTEMINFO_GDSETTINGS'];
}
$gdinfo = gd_info();
{
$query = "SELECT * FROM %s WHERE tdname NOT LIKE 'admin/%%' ORDER BY tdname";
$query = sprintf($query, sql_table('template_desc'));
+
$template['content'] = 'templatelist';
$template['tabindex'] = 10;
+
Showlist($query, 'table', $template, $templateName);
+
return;
}
// Super-Admins have access to all blogs! (no add item support though)
$query = "SELECT bnumber, bname, 1 as tadmin, burl, bshortname"
. " FROM %s"
- . " ORDER BY bnumber";
+ . " ORDER BY bnumber;";
$query = sprintf($query, sql_table('blog'));
}
else
$query = "SELECT bnumber, bname, tadmin, burl, bshortname"
. " FROM %s,%s"
. " WHERE tblog=bnumber and tmember=%d"
- . " ORDER BY bnumber";
+ . " ORDER BY bnumber;";
$query = sprintf($query, sql_table('blog'), sql_table('team'), (integer) $member->getID());
}
{
$query = 'SELECT COUNT(*) as result FROM ' . sql_table('blog');
- $total = quickQuery($query);
+ $total = DB::getValue($query);
if ( $total > $amount )
{
echo '<p><a href="index.php?action=overview&showall=yes">' . _OVERVIEW_SHOWALL . '</a></p>';
$query = "SELECT ititle, inumber, bshortname"
. " FROM %s,%s"
- . ' WHERE iauthor=%d AND iblog=bnumber AND idraft=1';
+ . ' WHERE iauthor=%d AND iblog=bnumber AND idraft=1;';
$query = sprintf($query, sql_table('item'), sql_table('blog'), (integer) $member->getID());
$template['content'] = 'draftlist';
*
* @param void
* @return void
+ * @return boolean
*/
private function ifSkincandidates()
{
/**
* Actions::ifPlugin()
* Checks if a plugin exists and call its doIf function
+ *
+ * @param string $name name of plugin
+ * @param string $key
+ * @param string $value
+ * @return callback
*/
private function ifPlugin($name, $key = '', $value = '')
{
{
return;
}
-
+
$params = func_get_args();
array_shift($params);
-
+
return call_user_func_array(array(&$plugin, 'doIf'), $params);
}
/**
+ * AdminActions::ifCategory()
* Different checks for a category
+ *
+ * @param string $key key for information of category
+ * @param string $value value for information of category
+ * @return boolean
*/
- private function ifCategory($name = '', $value='')
+ private function ifCategory($key = '', $value='')
{
global $blog, $catid;
-
+
// when no parameter is defined, just check if a category is selected
- if (($name != 'catname' && $name != 'catid') || ($value == ''))
+ if (($key != 'catname' && $key != 'catid') || ($value == ''))
{
return $blog->isValidCategory($catid);
}
-
+
// check category name
- if ( $name == 'catname' )
+ if ( $key == 'catname' )
{
$value = $blog->getCategoryIdFromName($value);
if ($value == $catid)
return $blog->isValidCategory($catid);
}
}
-
+
// check category id
- if (($name == 'catid') && ($value == $catid))
+ if (($key == 'catid') && ($value == $catid))
{
return $blog->isValidCategory($catid);
}
-
+
return FALSE;
}
-
+
/**
- * Checks if a member is on the team of a blog and return his rights
+ * AdminActions::ifOnTeam()
+ * Checks if a member is on the team of a blog and return his rights
+ *
+ * @param string $blogName name of weblog
+ * @return boolean
*/
private function ifOnTeam($blogName = '')
{
global $blog, $member, $manager;
-
+
// when no blog found
if ( ($blogName == '') && !is_object($blog) )
{
{
$blogid = getBlogIDFromName($blogName);
}
-
+
if (($blogName == '') || !$manager->existsBlogID($blogid))
{
// use current blog
}
return $member->teamRights($blogid);
}
-
+
/**
- * Checks if a member is admin of a blog
+ * AdminActions::ifAdmin()
+ * Checks if a member is admin of a blog
+ *
+ * @param string $blogName name of weblog
+ * @return boolean
*/
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
$blogid = $blog->getID();
}
-
+
return $member->isBlogAdmin($blogid);
}
-
+
/**
+ * AdminActions::ifAddresscange()
* Check e-Mail address is changed
+ *
+ * @param void
+ * @return boolean
*/
private function ifAddresscange()
{
}
/**
+ * AdminActions::templateEditRow()
+ * Template edit box
+ *
+ * @param array $template
+ * @param string $desc
+ * @param string $name
+ * @param string $help
+ * @param integer $tabindex
+ * @param boolean $big
+ * @param array $tmplt
+ * @return void
+ */
+ private function templateEditRow(&$template, $desc, $name, $help = '', $tabindex = 0, $big = 0, $tplt = '')
+ {
+ static $count = 1;
+
+ if ( !array_key_exists($name, $template) )
+ {
+ $template[$name] = '';
+ }
+
+ $tmplt = array();
+ $base = array();
+
+ if ( $tplt )
+ {
+ $tmplt = skinableTEMPLATE::read($tplt);
+ }
+
+ $data = array(
+ 'description' => $desc,
+ 'help' => empty($help) ? '' : helpHtml('template' . $help),
+ 'count' => $count,
+ 'name' => $name,
+ 'tabindex' => $tabindex,
+ 'rows' => $big ? 10 : 5,
+ );
+
+ if ( !array_key_exists('TEMPLATE_EDIT_ROW_HEAD', $tmplt) || empty($tmplt['TEMPLATE_EDIT_ROW_HEAD']) )
+ {
+ $base['head'] = "</tr>"
+ . "<tr>\n"
+ . "<td><%description%><%help%></td>\n"
+ . "<td id=\"td<%count%>\">\n"
+ . "<textarea class=\"templateedit\" name=\"<%name%>\" tabindex=\"<%tabindex%>\" cols=\"50\" rows=\"<%rows%>\" id=\"textarea<%count%>\">\n";
+ }
+ else
+ {
+ $base['head'] = $tmplt['TEMPLATE_EDIT_ROW_HEAD'];
+ }
+
+ if ( !array_key_exists('TEMPLATE_EDIT_ROW_TAIL', $tmplt) || empty($tmplt['TEMPLATE_EDIT_ROW_TAIL']) )
+ {
+ $base['tail'] = "</textarea>\n"
+ . "</td>\n";
+ }
+ else
+ {
+ $base['tail'] = $tmplt['TEMPLATE_EDIT_ROW_TAIL'];
+ }
+
+ echo TEMPLATE::fill($base['head'], $data);
+ echo ENTITY::hsc($template[$name]);
+ echo TEMPLATE::fill($base['tail'], $data);
+
+ $count++;
+
+ return;
+ }
+
+ /**
* AdminActions::customHelp()
* shows a link to custom help file
*
*/
static function customHelplink($id, $tplName = '', $url = '', $title = '', $onclick = '')
{
+ global $CONF;
+
$templates = array();
- if ($tplName) {
+
+ if ( $tplName )
+ {
$templates = Template::read($tplName);
}
- if (isset($templates['ADMIN_CUSTOMHELPLINK_ANCHOR']) && !empty($templates['ADMIN_CUSTOMHELPLINK_ANCHOR'])) {
+
+ if ( !array_key_exists('ADMIN_CUSTOMHELPLINK_ANCHOR', $templates) || empty($templates['ADMIN_CUSTOMHELPLINK_ANCHOR']) )
+ {
+ $template = "<a href=\"<%helpurl%>#<%helptarget%>\" title=\"<%title%>\" <%onclick%>>\n";
+ }
+ else
+ {
$template = $templates['ADMIN_CUSTOMHELPLINK_ANCHOR'];
- } else {
- $template = '<a href="<%helpurl%>#<%helptarget%>" title="<%title%>" <%onclick%>>';
}
- if (empty($url)) {
- global $CONF;
- $url = $CONF['AdminURL'] . 'documentation/customHelp.html';
+
+ if ( empty($url) )
+ {
+ $url = $CONF['AdminURL'] . 'documentation/customHelp.html';
}
- if (empty($onclick)) {
+
+ if ( empty($onclick) )
+ {
$onclick = 'onclick="if (event && event.preventDefault) event.preventDefault(); return help(this.href);"';
- } elseif (preg_match('/^onclick/', $onclick)) {
+ }
+ elseif ( preg_match('#^onclick#', $onclick) )
+ {
$onclick = $onclick;
- } else {
+ }
+ else
+ {
$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;
+
$templates = array();
+
if ( $tplName )
{
$templates = Template::read($tplName);
}
- if ( array_key_exists('ADMIN_CUSTOMHELPLINK_ICON', $templates) && !empty($templates['ADMIN_CUSTOMHELPLINK_ICON']) )
+ if ( !array_key_exists('ADMIN_CUSTOMHELPLINK_ICON', $templates) || !empty($templates['ADMIN_CUSTOMHELPLINK_ICON']) )
{
- $template = $templates['ADMIN_CUSTOMHELPLINK_ICON'];
+ $template = "<img src=\"<%iconurl%>\" <%width%><%height%>alt=\"<%alt%>\" title=\"<%title%>\" /></a>\n";
}
else
{
- $template = '<img src="<%iconurl%>" <%width%><%height%>alt="<%alt%>" title="<%title%>" /></a>';
+ $template = $templates['ADMIN_CUSTOMHELPLINK_ICON'];
}
if ( empty($iconURL) )
{
- global $CONF;
$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,
'alt' => (isset($alt) && !empty($alt)) ? $alt : _HELP_TT,
'title' => (isset($title) && !empty($title)) ? $title : _HELP_TT,
);
+
$icon = Template::fill($template, $data);
$help = self::customHelplink($id, $tplName, $url, $title, $onclick);
+
return $help . $icon;
}
* @param $templateName
* @param $showlist
*/
- private function input_yesno($name,
+ public function input_yesno($name,
$checkedval,
$tabindex = 0,
$value1 = 1,
if ( $name == 'admin' )
{
- if ( array_key_exists('INPUTYESNO_TEMPLATE_ADMIN', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_ADMIN']) )
- {
- $template = $templates['INPUTYESNO_TEMPLATE_ADMIN'];
- }
- else
+ if ( !array_key_exists('INPUTYESNO_TEMPLATE_ADMIN', $templates) || empty($templates['INPUTYESNO_TEMPLATE_ADMIN']) )
{
$template = '<input onclick="selectCanLogin(true);" type="radio" name="<%name%>" value="<%yesval%>" <%yescheckedval%> id="<%yesid%>" />' . "\n"
. '<label for="<%yesid%>"><%yesvaltext%></label>' . "\n"
. '<input onclick="selectCanLogin(false);" type="radio" name="<%name%>" value="<%noval%>" <%nocheckedval%> id="<%noid%>"<%disabled%> />' . "\n"
. '<label for="<%noid%>"><%novaltext%></label>' . "\n";
}
+ else
+ {
+ $template = $templates['INPUTYESNO_TEMPLATE_ADMIN'];
+ }
}
else
{
}
return;
}
-
+
/**
+ * AdminActions::existsNewPlugin()
* Check exists new plugin
+ *
+ * @param void
+ * @return boolean exists or not
*/
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();
- $files = scandir($DIR_PLUGINS);
- foreach ($files as $file) {
- if (preg_match("/^NP_(.*)\.php$/", $file, $matches)) {
- $name = $matches[1];
- $que = 'SELECT '
- . ' * '
- . 'FROM '
- . sql_table('plugin') . ' '
- . 'WHERE '
- . ' pfile = "NP_' . sql_real_escape_string($name) . '"';
- $res = sql_query($que);
- if (sql_num_rows($res) == 0) {
- $candidates[] = $name;
+ foreach ( $files as $file )
+ {
+ if ( preg_match("#^(NP_.*)\.php$#", $file, $matches) )
+ {
+ if ( !in_array($matches[1], $installed) )
+ {
+ $candidates[] = $matches[1];
}
}
}
$this->newPlugCandidates = $candidates;
return (count($candidates) > 0);
}
+
+ /**
+ * AdminActions::pagehead()
+ * Output admin page head
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_pagehead()
+ {
+ global $member, $nucleus, $CONF, $manager;
+
+ $content = $this->parser->skin->getContentFromDB('pagehead');
+ if ( !$content )
+ {
+ $extrahead = Admin::$extrahead;
+ $data = array(
+ 'extrahead' => &$extrahead,
+ 'action' => Admin::$action
+ );
+ $manager->notify('AdminPrePageHead', $data);
+
+ $baseUrl = Entity::hsc($CONF['SkinsURL']);
+
+ /*
+ * TODO: obsoleted
+ if ( !array_key_exists('AdminCSS', $CONF) )
+ {
+ DB::execute("INSERT INTO " . sql_table('config') . " VALUES ('AdminCSS', 'original')");
+ $CONF['AdminCSS'] = 'original';
+ }
+ */
+
+ /* HTTP 1.1 application for no caching */
+ header("Cache-Control: no-cache, must-revalidate");
+ header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
+
+ $root_element = 'html';
+ $charset = i18n::get_current_charset();
+ $locale = preg_replace('#_#', '-', i18n::get_current_locale());
+ $xml_version_info = self::$xml_version_info;
+ $formal_public_identifier = self::$formal_public_identifier;
+ $system_identifier = self::$system_identifier;
+ $xhtml_namespace = self::$xhtml_namespace;
+
+ echo "<?xml version=\"{$xml_version_info}\" encoding=\"{$charset}\" ?>\n";
+ echo "<!DOCTYPE {$root_element} PUBLIC \"{$formal_public_identifier}\" \"{$system_identifier}\">\n";
+ echo "<{$root_element} xmlns=\"{$xhtml_namespace}\" xml:lang=\"{$locale}\" lang=\"{$locale}\">\n";
+ echo "<head>\n";
+ echo '<title>' . Entity::hsc($CONF['SiteName']) . " - Admin</title>\n";
+ /*
+ * TODO: obsoleted
+ echo "<link rel=\"stylesheet\" title=\"Nucleus Admin Default\" type=\"text/css\" href=\"{$baseUrl}admin/defaultadmin/styles/admin_{$CONF["AdminCSS"]}.css\" />\n";
+ */
+ echo "<link rel=\"stylesheet\" title=\"Nucleus Admin Default\" type=\"text/css\" href=\"{$baseUrl}admin/defaultadmin/styles/addedit.css\" />\n";
+ echo "<script type=\"text/javascript\" src=\"{$baseUrl}javascripts/edit.js\"></script>\n";
+ echo "<script type=\"text/javascript\" src=\"{$baseUrl}javascripts/admin.js\"></script>\n";
+ echo "<script type=\"text/javascript\" src=\"{$baseUrl}javascripts/compatibility.js\"></script>\n";
+ echo "{$extrahead}\n";
+ echo "</head>\n\n";
+ echo "<body>\n";
+ echo "<div id=\"adminwrapper\">\n";
+ echo "<div class=\"header\">\n";
+ echo '<h1>' . Entity::hsc($CONF['SiteName']) . "</h1>\n";
+ echo "</div>\n";
+ echo "<div id=\"container\">\n";
+ echo "<div id=\"content\">\n";
+ echo "<div class=\"loginname\">\n";
+
+ if ( !$member->isLoggedIn() )
+ {
+ echo '<a href="index.php?action=showlogin" title="Log in">' . _NOTLOGGEDIN . "</a><br />\n";
+ }
+ else
+ {
+ echo _LOGGEDINAS . ' ' . $member->getDisplayName() ." - <a href='index.php?action=logout'>" . _LOGOUT. "</a><br />\n";
+ echo "<a href='index.php?action=overview'>" . _ADMINHOME . "</a> - ";
+ }
+
+ echo "<a href='".$CONF['IndexURL']."'>"._YOURSITE."</a><br />\n";
+ echo '(';
+
+ if ( !array_key_exists('codename', $nucleus) || empty($nucleus['codename']) )
+ {
+ $codenamestring = '';
+ }
+ else
+ {
+ $codenamestring = ' "' . $nucleus['codename'].'"';
+ }
+
+ if ( $member->isLoggedIn() && $member->isAdmin() )
+ {
+ $checkURL = sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
+ echo '<a href="' . $checkURL . '" title="' . _ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TITLE . '">Nucleus CMS ' . $nucleus['version'] . $codenamestring . '</a>';
+
+ $newestVersion = getLatestVersion();
+ $newestCompare = str_replace('/', '.', $newestVersion);
+ $currentVersion = str_replace(array('/','v'), array('.',''), $nucleus['version']);
+
+ if ( $newestVersion && version_compare($newestCompare, $currentVersion) > 0 )
+ {
+ echo "<br />\n";
+ echo '<a style="color:red" href="http://nucleuscms.org/upgrade.php" title="' . _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TITLE . '">';
+ echo _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TEXT . $newestVersion;
+ echo "</a>";
+ }
+ }
+ else
+ {
+ echo "Nucleus CMS {$nucleus['version']}{$codenamestring}";
+ }
+ echo ')';
+ echo '</div>';
+ }
+ else
+ {
+ $this->parser->parse($content);
+ }
+
+ return;
+ }
+
+ /**
+ * AdminActionss::pagefoot()
+ * Output admin page foot include quickmenu
+ *
+ * @param void
+ * @return void
+ */
+ public function parse_pagefoot()
+ {
+ global $action, $member, $manager;
+
+ $content = $this->parser->skin->getContentFromDB('pagefoot');
+ if ( !$content )
+ {
+ $data = array(
+ 'action' => self::$action
+ );
+ $manager->notify('AdminPrePageFoot', $data);
+
+ if ( $member->isLoggedIn() && ($action != 'showlogin') )
+ {
+ echo '<h2>' . _LOGOUT . "</h2>\n";
+ echo "<ul>\n";
+ echo '<li><a href="index.php?action=overview">' . _BACKHOME . "</a></li>\n";
+ echo '<li><a href="index.php?action=logout">' . _LOGOUT . "</a></li>\n";
+ echo "</ul>\n";
+ }
+
+ echo "<div class=\"foot\">\n";
+ echo '<a href="' . _ADMINPAGEFOOT_OFFICIALURL . '">Nucleus CMS</a> © 2002-' . date('Y') . ' ' . _ADMINPAGEFOOT_COPYRIGHT;
+ echo '-';
+ echo '<a href="' . _ADMINPAGEFOOT_DONATEURL . '">' . _ADMINPAGEFOOT_DONATE . "</a>\n";
+ echo "</div>\n";
+
+ echo "<div id=\"quickmenu\">\n";
+
+ if ( ($action != 'showlogin') && ($member->isLoggedIn()) )
+ {
+ echo "<ul>\n";
+ echo '<li><a href="index.php?action=overview">' . _QMENU_HOME . "</a></li>\n";
+ echo "</ul>\n";
+
+ echo '<h2>' . _QMENU_ADD . "</h2>\n";
+ echo "<form method=\"get\" action=\"index.php\">\n";
+ echo "<p>\n";
+ echo "<input type=\"hidden\" name=\"action\" value=\"createitem\" />\n";
+
+ $showAll = requestVar('showall');
+
+ if ( ($member->isAdmin()) && ($showAll == 'yes') )
+ {
+ // Super-Admins have access to all blogs! (no add item support though)
+ $query = "SELECT bnumber as value, bname as text FROM %s ORDER BY bname;";
+ $query = sprintf($query, sql_table('blog'));
+ }
+ else
+ {
+ $query = "SELECT bnumber as value, bname as text FROM %s, %s WHERE tblog=bnumber and tmember=%d ORDER BY bname;";
+ $query = sprintf($query, sql_table('blog'), sql_table('team'), (integer) $member->getID());
+ }
+ $template['name'] = 'blogid';
+ $template['tabindex'] = 15000;
+ $template['extra'] = _QMENU_ADD_SELECT;
+ $template['selected'] = -1;
+ $template['shorten'] = 10;
+ $template['shortenel'] = '';
+ $template['javascript'] = 'onchange="return form.submit()"';
+ showlist($query, 'select', $template);
+
+ echo "</p>\n";
+ echo "</form>\n";
+
+ echo "<h2>{$member->getDisplayName()}</h2>\n";
+ echo "<ul>\n";
+ echo '<li><a href="index.php?action=editmembersettings">' . _QMENU_USER_SETTINGS . "</a></li>\n";
+ echo '<li><a href="index.php?action=browseownitems">' . _QMENU_USER_ITEMS . "</a></li>\n";
+ echo '<li><a href="index.php?action=browseowncomments">' . _QMENU_USER_COMMENTS . "</a></li>\n";
+ echo "</ul>\n";
+
+ if ( $member->isAdmin() )
+ {
+ echo '<h2>' . _QMENU_MANAGE . "</h2>\n";
+ echo "<ul>\n";
+ echo '<li><a href="index.php?action=actionlog">' . _QMENU_MANAGE_LOG . "</a></li>\n";
+ echo '<li><a href="index.php?action=settingsedit">' . _QMENU_MANAGE_SETTINGS . "</a></li>\n";
+ echo '<li><a href="index.php?action=systemoverview">' . _QMENU_MANAGE_SYSTEM . "</a></li>\n";
+ echo '<li><a href="index.php?action=usermanagement">' . _QMENU_MANAGE_MEMBERS . "</a></li>\n";
+ echo '<li><a href="index.php?action=createnewlog">' . _QMENU_MANAGE_NEWBLOG . "</a></li>\n";
+ echo '<li><a href="index.php?action=backupoverview">' . _QMENU_MANAGE_BACKUPS . "</a></li>\n";
+ echo '<li><a href="index.php?action=pluginlist">' . _QMENU_MANAGE_PLUGINS . "</a></li>\n";
+ echo "</ul>\n";
+
+ echo "<h2>" . _QMENU_LAYOUT . "</h2>\n";
+ echo "<ul>\n";
+ echo '<li><a href="index.php?action=skinoverview">' . _QMENU_LAYOUT_SKINS . "</a></li>\n";
+ echo '<li><a href="index.php?action=templateoverview">' . _QMENU_LAYOUT_TEMPL . "</a></li>\n";
+ echo '<li><a href="index.php?action=skinieoverview">' . _QMENU_LAYOUT_IEXPORT . "</a></li>\n";
+ echo "</ul>\n";
+ }
+
+ $data = array('options' => array());
+
+ $manager->notify('QuickMenu', $data);
+
+ if ( count($data['options']) > 0 )
+ {
+ echo "<h2>" . _QMENU_PLUGINS . "</h2>\n";
+ echo "<ul>\n";
+ foreach ( $data['options'] as $option )
+ {
+ echo '<li><a href="' . Entity::hsc($option['url']) . '" title="' . Entity::hsc($option['tooltip']) . '">' . Entity::hsc($option['title']) . "</a></li>\n";
+ }
+ echo "</ul>\n";
+ }
+ }
+ else if ( ($action == 'activate') || ($action == 'activatesetpwd') )
+ {
+
+ echo '<h2>' . _QMENU_ACTIVATE . '</h2>' . _QMENU_ACTIVATE_TEXT;
+ }
+ else
+ {
+ echo '<h2>' . _QMENU_INTRO . '</h2>' . _QMENU_INTRO_TEXT;
+ }
+
+ echo "<!-- quickmenu -->\n";
+ echo "</div>\n";
+
+ echo "<!-- content -->\n";
+ echo "</div>\n";
+
+ echo "<!-- container -->\n";
+ echo "</div>\n";
+
+ echo "<!-- adminwrapper -->\n";
+ echo "</div>\n";
+
+ echo "</body>\n";
+ echo "</html>\n";
+ }
+ else
+ {
+ $this->parser->skin->parse('pagefoot');
+ exit;
+ }
+
+ return;
+ }
}