'batchmovetype',
'blogcatlist',
'blognotifysetting',
- 'blogselectbox',
'blogsetting',
'blogsettingyesno',
'blogteamlist',
'importskininfo',
'inputyesno',
'insertpluginfo',
- 'insertpluginoptions',
'insplugoptcontent',
'iprangeinput',
'itemnavlist',
'batchmovecat' => _ADM_SKPRT_BATCHMOVECAT,
'batchteam' => _ADM_SKPRT_BATCHTEAM,
'blogcommentlist' => _ADM_SKPRT_BLOGCOMMENTLIST,
- 'blogselectbox' => _ADM_SKPRT_BLOGSELECTBOX,
'blogsettings' => _ADM_SKPRT_BLOGSETTINGS,
'bookmarklet' => _ADM_SKPRT_BOOKMARKLET,
'browseowncomments' => _ADM_SKPRT_BROWSEOWNCOMMENTS,
'createnewlog' => _ADM_SKPRT_CREATENEWLOG,
'deleteblog' => _ADM_SKPRT_DELETEBLOG,
'editmembersettings' => _ADM_SKPRT_EDITMEMBERSETTINGS,
- 'insertpluginoptions' => _ADM_SKPRT_INSERTPLUGINO,
'itemcommentlist' => _ADM_SKPRT_ITEMCOMMENTLIST,
'itemdelete' => _ADM_SKPRT_ITEMDELETE,
'itemedit' => _ADM_SKPRT_ITEMEDIT,
'adminbatchlist',
);
break;
- case 'blogselectbox':
- $extra_actions = array(
- 'blogselectbox',
- );
- break;
case 'blogsettings':
$extra_actions = array(
'adminbloglink',
'pluginoptions',
);
break;
- case 'insertpluginoptions':
- $extra_actions = array(
- 'insertpluginoptions',
- );
- break;
case 'itemcommentlist':
$extra_actions = array(
'requestblogid',
}
/**
- * AdminActions::parse_blogselectbox()
- * Parse skinvar blogselectbox
- *
- * @param void
- * @return void
- */
- public function parse_blogselectbox()
- {
- global $member;
-
- $selectData = requestVar('selectData');
- $mode = $selectData['mode'];
- $name = Entity::hsc($selectData['name']);
- $tabindex = Entity::hsc($selectData['tabindex']);
- $aBlogIds = array_map('intval', $selectData['aBlogIds']);
- $showNewCat = intval($selectData['showNewCat']);
- $selected = intval($selectData['selected']);
-
- echo "<select name=\"{$name}\" tabindex=\"{$tabindex}\">\n";
-
- // 1. select blogs (we'll create optiongroups)
- // (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 = DB::getResult($queryBlogs);
-
- if ( $mode == 'category' )
- {
- if ( $blogs->rowCount() > 1 )
- {
- $multipleBlogs = 1;
- }
- foreach ( $blogs as $rBlog )
- {
- if ( isset($multipleBlogs) && !empty($multipleBlogs) )
- {
- 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($rBlog['bnumber']) )
- {
- 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) $rBlog['bnumber']);
- $categories = DB::getResult($catQuery);
- foreach ( $categories as $rCat )
- {
- if ( $rCat['catid'] == $selected )
- {
- $selectText = ' selected="selected" ';
- }
- else
- {
- $selectText = '';
- }
- echo '<option value="' . $rCat['catid'] . '" ' . $selectText . '>' . Entity::hsc($rCat['cname']) . "</option>\n";
- }
-
- if ( isset($multipleBlogs) && !empty($multipleBlogs) )
- {
- echo '</optgroup>';
- }
- }
- }
- else
- {
- // blog mode
- foreach ( $blogs as $rBlog )
- {
- echo '<option value="' . $rBlog['bnumber'] . '"';
- if ( $rBlog['bnumber'] == $selected )
- {
- echo '<option value="' . $rBlog['bnumber'] . '" selected="selected">' . Entity::hsc($rBlog['bname']) . "</option>\n";
- }
- else
- {
- echo '<option value="' . $rBlog['bnumber'] . '">' . Entity::hsc($rBlog['bname']) . "</option>\n";
- }
- }
- }
- echo "</select>\n";
- return;
- }
-
- /**
* AdminActions::parse_blogsetting()
* Parse skinvar blogsetting
*
$catid = $contents['catid'];
}
- Admin::selectBlogCategory('catid', $catid, $startidx, 1, $blog->getID());
+ $this->selectBlog('catid', 'category', $catid, $startidx, 1, $blog->getID());
return;
}
*/
public function parse_geteditpluginfo($type)
{
+ global $manager;
$pid = intRequestVar('plugid');
switch ( $type )
{
}
/**
- * AdminActions::parse_insertpluginoptions()
- * Parse skinvar insertpluginoptions
- *
- * @param string $templateName name of template
- * @return void
- */
- public function parse_insertpluginoptions($templateName = '')
- {
- $options = Admin::getAdminaOption();
- $template = array();
- $templats = array();
-
- if ( $templateName )
- {
- $templates = Template::read($templateName);
- }
-
- if ( !array_key_exists('INSERT_PLUGOPTION_TITLE', $templates) || empty($templates['INSERT_PLUGOPTION_TITLE']) )
- {
- $template['title'] = "<tr>"
- . "<th colspan=\"2\"><%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%></th>"
- . "</tr>\n";
- }
- else
- {
- $template['title'] = $templates['INSERT_PLUGOPTION_TITLE'];
- }
-
- if ( !array_key_exists('INSERT_PLUGOPTION_BODY', $templates) || empty($templates['INSERT_PLUGOPTION_BODY']) )
- {
- $template['body'] = "<tr>"
- . "<%listplugplugoptionrow%>"
- . "</tr>\n";
- }
- else
- {
- $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 )
- {
-
- // 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']);
- }
- }
- return;
- }
-
- /**
* AdminActions::parse_insplugoptcontent()
* Parse skinvar insplugoptcontent
*
switch ( $actionType )
{
case 'batchitem':
- Admin::selectBlogCategory('destcatid');
+ $this->selectBlog('destcatid', 'category');
break;
case 'batchcategory':
- Admin::selectBlog('destblogid');
+ $this->selectBlog('destblogid');
break;
default:
if ( $this->skintype == 'itemmove' )
$query = "SELECT icat as result FROM %s WHERE inumber=%d;";
$query = sprintf($query, sql_table('item'), intRequestVar('itemid'));
$catid = DB::getValue(sprintf($query, intRequestVar('itemid')));
- Admin::selectBlogCategory('catid', $catid, 10, 1);
+ $this->selectBlog('catid', 'category', $catid, 10, 1);
}
break;
}
* @param string $type type of plugin option
* @return void
*/
- public function parse_pluginoptions($context='global')
+ public function parse_pluginoptions($context='global', $templateName='')
{
global $itemid, $manager;
$data = array(
'context' => $context,
'contextid' => $contextid,
- 'options' => &$opt4ions
+ 'options' => &$options
);
$manager->notify('PrePluginOptionsEdit', $data);
- $content = $this->parser->skin->getContentFromDB('insertpluginoptions');
- $this->parser->parse($content);
+ $template = array();
+ if ( $templateName )
+ {
+ $templates = Template::read($templateName);
+ if ( !array_key_exists('INSERT_PLUGOPTION_TITLE', $templates) || empty($templates['INSERT_PLUGOPTION_TITLE']) )
+ {
+ $template['title'] = "<tr>"
+ . "<th colspan=\"2\"><%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%></th>"
+ . "</tr>\n";
+ }
+ else
+ {
+ $template['title'] = $templates['INSERT_PLUGOPTION_TITLE'];
+ }
+
+ if ( !array_key_exists('INSERT_PLUGOPTION_BODY', $templates) || empty($templates['INSERT_PLUGOPTION_BODY']) )
+ {
+ $template['body'] = "<tr>"
+ . "<%listplugplugoptionrow%>"
+ . "</tr>\n";
+ }
+ else
+ {
+ $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 )
+ {
+ // 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']);
+ }
+ }
return;
}
switch ( $type )
{
case 'skin':
- $res = DB::getResult('SELECT * FROM ' . sql_table('skin_desc'));
+ $res = DB::getResult('SELECT * FROM ' . sql_table('skin_desc'). " WHERE sdname NOT LIKE 'admin/%%';");
foreach ( $res as $row )
{
$data = array(
{
if ( !in_array($matches[1], $installed) )
{
- $candidates[] = $matches[1];
+ $candidates[] = preg_replace("#^NP_#", "", $matches[1]);
}
}
}
{
global $member, $nucleus, $CONF, $manager;
+ $extrahead = Admin::getAdminextrahead();
+ $data = array(
+ 'extrahead' => &$extrahead,
+ 'action' => Admin::getAdminAction()
+ );
+ $manager->notify('AdminPrePageHead', $data);
+
$content = $this->parser->skin->getContentFromDB('pagehead');
if ( !$content )
{
- $extrahead = Admin::getAdminextrahead();
- $data = array(
- 'extrahead' => &$extrahead,
- 'action' => Admin::getAdminAction()
- );
- $manager->notify('AdminPrePageHead', $data);
-
$baseUrl = Entity::hsc($CONF['SkinsURL']);
/*
{
global $action, $member, $manager;
+ $data = array(
+ 'action' => Admin::getAdminAction()
+ );
+ $manager->notify('AdminPrePageFoot', $data);
+
$content = $this->parser->skin->getContentFromDB('pagefoot');
if ( !$content )
{
- $data = array(
- 'action' => Admin::getAdminAction()
- );
- $manager->notify('AdminPrePageFoot', $data);
-
if ( $member->isLoggedIn() && ($action != 'showlogin') )
{
echo '<h2>' . _LOGOUT . "</h2>\n";
return;
}
+ /**
+ * AdminActions::selectBlog()
+ * Inserts a HTML select element with choices for all blogs to which the user has access
+ * mode = 'blog' => shows blognames and values are blogids
+ * mode = 'category' => show category names and values are catids
+ *
+ * @param string $name
+ * @param string $mode
+ * @param integer $selected
+ * @param integer $tabindex
+ * @param integer $showNewCat
+ * @param integer $iForcedBlogInclude ID for weblog always included
+ * @param $iForcedBlogInclude
+ * ID of a blog that always needs to be included, without checking if the
+ * member is on the blog team (-1 = none)
+ * @return void
+ */
+ 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 = sprintf($query, sql_table('blog'));
+ }
+ else
+ {
+ $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 )
+ {
+ if ( $row['bnumber'] != $iForcedBlogInclude )
+ {
+ $aBlogIds[] = intval($row['bnumber']);
+ }
+ }
+
+ if ( count($aBlogIds) == 0 )
+ {
+ return;
+ }
+
+ echo "<select name=\"{$name}\" tabindex=\"{$tabindex}\">\n";
+
+ // 1. select blogs (we'll create optiongroups)
+ // (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 = DB::getResult($queryBlogs);
+
+ if ( $mode == 'category' )
+ {
+ if ( $blogs->rowCount() > 1 )
+ {
+ $multipleBlogs = 1;
+ }
+ foreach ( $blogs as $rBlog )
+ {
+ if ( isset($multipleBlogs) && !empty($multipleBlogs) )
+ {
+ 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($rBlog['bnumber']) )
+ {
+ 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) $rBlog['bnumber']);
+ $categories = DB::getResult($catQuery);
+ foreach ( $categories as $rCat )
+ {
+ if ( $rCat['catid'] == $selected )
+ {
+ $selectText = ' selected="selected" ';
+ }
+ else
+ {
+ $selectText = '';
+ }
+ echo '<option value="' . $rCat['catid'] . '" ' . $selectText . '>' . Entity::hsc($rCat['cname']) . "</option>\n";
+ }
+
+ if ( isset($multipleBlogs) && !empty($multipleBlogs) )
+ {
+ echo '</optgroup>';
+ }
+ }
+ }
+ else
+ {
+ foreach ( $blogs as $rBlog )
+ {
+ echo '<option value="' . $rBlog['bnumber'] . '"';
+ if ( $rBlog['bnumber'] == $selected )
+ {
+ echo '<option value="' . $rBlog['bnumber'] . '" selected="selected">' . Entity::hsc($rBlog['bname']) . "</option>\n";
+ }
+ else
+ {
+ echo '<option value="' . $rBlog['bnumber'] . '">' . Entity::hsc($rBlog['bname']) . "</option>\n";
+ }
+ }
+ }
+ echo "</select>\n";
+ return;
+ }
}