// reference to the skin object for which a part is being parsed
private $skin;
- // an instance of parser class
-// private $parser;
- protected $parser;
-
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',
+ 'customhelplink',
'headmessage',
- 'ticket',
- 'sprinttext',
'helplink',
- 'customhelplink',
- 'adminurl'
+ 'sprinttext',
+ 'ticket'
);
/**
'adminskinremovetype' => _ADM_SKPRT_ADMINSKINREMOVETYPE,
'admintemplatedelete' => _ADM_SKPRT_ADMINTEMPLATEDELETE,
'admintemplateedit' => _ADM_SKPRT_ADMINTEMPLATEEDIT,
- 'admntemplateoverview' => _ADM_SKPRT_ADMINTEMPLATEOVERVIEW,
+ 'admintemplateoverview' => _ADM_SKPRT_ADMINTEMPLATEOVERVIEW,
'backupoverview' => _ADM_SKPRT_BACKUPOVERVIEW,
'backuprestore' => _ADM_SKPRT_BACKUPRESTORE,
'banlist' => _ADM_SKPRT_BANLIST,
'batchitem' => _ADM_SKPRT_BATCHITEM,
'batchmember' => _ADM_SKPRT_BATCHMEMBER,
'batchmove' => _ADM_SKPRT_BATCHMOVE,
+ 'batchmovecat' => _ADM_SKPRT_BATCHMOVECAT,
'batchteam' => _ADM_SKPRT_BATCHTEAM,
'blogcommentlist' => _ADM_SKPRT_BLOGCOMMENTLIST,
'blogselectbox' => _ADM_SKPRT_BLOGSELECTBOX,
);
/**
- * AdminActions::getDefinedActions()
+ * AdminActions::getAvailableSkinTypes()
*
* @static
- * @param string $type page type
+ * @param void
+ * @return array list of friendly names for page actions
+ */
+ static public function getAvailableSkinTypes()
+ {
+ return self::$default_skin_types;
+ }
+
+ /**
+ * AdminActions::getDefaultTypes()
+ *
+ * @static
+ * @param void
+ * @return array list of friendly names for page actions
+ */
+ static public function getDefaultTypes()
+ {
+ return self::$default_skin_types;
+ }
+
+ /**
+ * AdminActions::__construct()
+ * Constructor for a new Actions object
+ *
+ * @param string $type
+ * @return void
+ */
+ public function __construct($type)
+ {
+ // call constructor of superclass first
+ parent::__construct();
+ $this->skintype = $type;
+ if ( !class_exists('Navlist') || !class_exists('Batch') )
+ {
+ global $DIR_LIBS;
+ include $DIR_LIBS . 'ENCAPSULATE.php';
+ }
+ return;
+ }
+
+ /**
+ * AdminActions::getAvailableActions()
+ *
+ * @param void
* @return array allowed actions for the page type
*/
- static public function getDefinedActions($type = '')
+ public function getAvailableActions()
{
$extra_actions = array();
- switch ( $type )
+ switch ( $this->skintype )
{
case 'actionlog':
$extra_actions = array(
'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':
$extra_actions = array(
'adminbloglink',
'blogid',
- 'jsinput',
- 'jsbuttonbar',
'contents',
'categories',
'currenttime',
- 'pluginextras',
- 'itemoptions'
+ 'init',
+ 'itemoptions',
+ 'pluginextras'
);
break;
case 'createnewlog':
break;
case 'editmembersettings':
$extra_actions = array(
- 'editmember',
- 'languageselectoptions',
'adminskinselectoptions',
+ 'editmember',
+ 'localeselectoptions',
'pluginoptions',
);
break;
$extra_actions = array(
'init',
'contents',
- 'jsinput',
- 'jsbuttonbar',
'checkedonval',
'categories',
'currenttime',
'defblogselect',
'defskinselect',
'configsettingsedit',
- 'languageselectoptions',
'configsettingsyesno',
'outputspecialdirs',
'jstoolbaroptions',
+ 'localeselectoptions',
'mediadirwarning',
'pluginextras',
);
$defined_actions = array_merge(self::$default_actions, $extra_actions);
- return array_merge($defined_actions, parent::getDefinedActions());
- }
-
- /**
- * AdminActions::getDefaultSkinTypes()
- *
- * @static
- * @param void
- * @return array list of friendly names for page actions
- */
- static public function getDefaultSkinTypes()
- {
- return self::$default_skin_types;
- }
-
- /**
- * AdminActions::getDefaultTypes()
- *
- * @static
- * @param void
- * @return array list of friendly names for page actions
- */
- static public function getDefaultTypes()
- {
- return self::$default_skin_types;
- }
-
- /**
- * AdminActions::__construct()
- * Constructor for a new Actions object
- *
- * @param string $type
- * @return void
- */
- public function __construct($type)
- {
- // call constructor of superclass first
- parent::__construct();
- $this->skintype = $type;
- if ( !class_exists('Navlist') || !class_exists('Batch') )
- {
- global $DIR_LIBS;
- include $DIR_LIBS . 'ENCAPSULATE.php';
- }
- return;
+ return array_merge($defined_actions, parent::getAvailableActions());
}
/**
}
/**
- * AdminActions::setParser()
- * Set the parser
- *
- * @param object $parser an instance of Parser class
- * @return void
- */
- public function setParser(&$parser)
- {
- $this->parser =& $parser;
- return;
- }
-
- /**
* AdminActions::parse_actionloglist()
* Parse skinvar actionloglist
*
switch ( $type )
{
case 'title':
- echo TEMPLATE::fill($title, $aVars);
+ echo Template::fill($title, $aVars);
break;
case 'text':
- echo TEMPLATE::fill($text, $aVars);
+ echo Template::fill($text, $aVars);
break;
case 'ackey':
echo Entity::hsc($key);
{
global $manager;
$templates = array();
+
if ( !empty($templateName) )
{
$templates = Template::read($templateName);
}
- if ( isset($templates['ADMIN_BATCHLIST']) || !empty($templates['ADMIN_BATCHLIST']) )
- {
- $template = $templates['ADMIN_BATCHLIST'];
- }
- else
+
+ if ( !array_key_exists('ADMIN_BATCHLIST', $templates) || empty($templates['ADMIN_BATCHLIST']) )
{
$template = '<li><%text(_BATCH_EXECUTING)%>'
. '<b><%adminbatchaction%></b>'
. '<b><%batchlistmsg%></b>'
. '</li>' . "\n";
}
+ else
+ {
+ $template = $templates['ADMIN_BATCHLIST'];
+ }
$selected = requestIntArray('batch');
$action = requestVar('batchaction');
// 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 = Admin::deleteaction($selectedid);
}
else
{
break;
case 'setadmin':
// always succeeds
- sql_query('UPDATE ' . $setadminsql . $selectedid);
+ sql_query("UPDATE {$setadminsql} {$selectedid};");
$error = '';
break;
case 'unsetadmin':
}
else
{
- sql_query('UPDATE ' . $unsetupsql . $selectedid);
+ sql_query("UPDATE {$setadminsql} {$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);
ob_start();
$parser->parse($template);
$template = ob_get_contents();
ob_end_clean();
- echo TEMPLATE::fill($template, $data);
+ echo Template::fill($template, $data);
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(
'blogname' => Entity::hsc($blog->getName())
);
- echo TEMPLATE::fill($template, $data);
+ echo Template::fill($template, $data);
return;
}
$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);
'expname' => Entity::hsc($skinObj->sdname),
'expdesc' => Entity::hsc($skinObj->sddesc),
);
- echo TEMPLATE::fill($template, $data);
+ 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) )
'expname' => Entity::hsc($templateObj->tdname),
'expdesc' => Entity::hsc($templateObj->tddesc),
);
- echo TEMPLATE::fill($template, $data);
+ echo Template::fill($template, $data);
}
break;
}
*/
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'] = Skin::getAvailableTypes();
+ $template['content'] = 'adminskinlist';
+ $template['tabindex'] = 10;
+ $template['friendly_names'] = $this->skin->getAvailableTypes();
Showlist($query, 'table', $template, $templateName);
return;
}
*
* @param void
* @return void
- */
+ */
public function parse_adminskinselectoptions()
{
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['name'] = 'adminskin';
$template['selected'] = $CONF['DefaultAdminSkin'];
$template['tabindex'] = 110;
Showlist($query, 'select', $template, '');
$templates = Template::read($templateName);
}
- $nType = Skin::getFriendlyNames('AdminActions');
+ $nType = $this->skin->getAvailableTypes();
$skinid = intRequestVar('skinid');
$query = "SELECT stype FROM %s WHERE stype NOT IN (%s) AND sdesc=%d;";
$res = sql_query($query);
if ( $res && sql_num_rows($res) > 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;
+
+ /* NOTE: do echo */
+ $data = array();
+ echo $template['head'];
while ( $row = sql_fetch_assoc($res) )
{
$data = array(
'skinid' => $skinid,
'skintype' => Entity::hsc(strtolower($row['stype']))
);
- echo TEMPLATE::fill($template['body'], $data);
+ 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 = Skin::getAllowedActionsForType($skinType);
+ $actions = $this->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')));
- $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;
}
$template['content'] = 'categorylist';
$template['tabindex'] = 200;
- $batch = new Batch('member');
+ $batch = new Batch('category');
$batch->showlist($query, 'table', $template);
return;
}
/**
+ * AdminActions::parse_blogid()
+ * Parse skinvar blogid
+ *
+ * @param void
+ * @return void
+ */
+ function parse_blogid()
+ {
+ echo intRequestVar('blogid');
+ return;
+ }
+
+ /**
* AdminActions::parse_blognotifysetting()
* Parse skinvar blognotifysetting
*
{
if ( isset($multipleBlogs) && !empty($multipleBlogs) )
{
- echo '<optgroup label="' . Entity::hsc($oBlog->bname) . "\>\n";
+ echo '<optgroup label="' . Entity::hsc($oBlog->bname) . "\">\n";
}
// show selection to create new category when allowed/wanted
}
// 2. for each category in that blog
- $catQueriy = "SELECT cname, catid FROM %s WHERE cblog=%d ORDER BY cname ASC;";
+ $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(sprintf($catQueriy));
+ $categories = sql_query($catQuery);
while ( $oCat = sql_fetch_object($categories) )
{
if ( $oCat->catid == $selected )
. "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 = sql_query($query);
$memberNames = array();
- while ($o = sql_fetch_object($res)) {
+ while ( $o = sql_fetch_object($res) )
+ {
$memberNames[] = Entity::hsc($o->mname) . ' (' . Entity::hsc($o->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);
echo Entity::hsc('javascript:' . getBookmarklet($blogid));
return;
}
+
+ /**
+ * AdminActions::parse_categories()
+ * Parse skinvar categories
+ *
+ * create category dropdown box
+ *
+ * @param string $type name of setting for category
+ * @return void
+ */
+ function parse_categories($startidx = 0)
+ {
+ global $manager;
+
+ $item = FALSE;
+ $itemid = intRequestVar('itemid');
+ $item = &$manager->getItem($itemid, 1, 1);
+
+ $blog = FALSE;
+ if ( !$item )
+ {
+ $blogid = intRequestVar('blogid');
+ }
+ else
+ {
+ $blogid = $item['blogid'];
+ }
+ $blog = &$manager->getBlog($blogid);
+
+ if ( $item && $blog->convertBreaks() && requestVar('action') == 'itemedit' )
+ {
+ $item['body'] = removeBreaks($item['body']);
+ $item['more'] = removeBreaks($item['more']);
+ }
+
+ $contents = array();
+ if ( requestVar('action') == 'itemedit' )
+ {
+ $contents = $item;
+ }
+
+ if ( !array_key_exists('catid', $contents) || empty($contents['catid']) )
+ {
+ // on add item
+ $catid = $blog->getDefaultCategory();
+ }
+ else
+ {
+ // on edit item
+ $catid = $contents['catid'];
+ }
+
+ Admin::selectBlogCategory('catid', $catid, $startidx, 1, $blog->getID());
+
+ return;
+ }
/**
* AdminActions::parse_category()
$res = sql_query($query);
$obj = sql_fetch_object($res);
- if ( $type != desc )
+ if ( $type != 'name' )
{
echo Entity::hsc($obj->cdesc);
}
* AdminActions::parse_codename()
* Parse templatevar codename
*
- * @param void
- * @return void
+ * @param $value
+ * @param $name
*
- * TODO: is this need???
*/
- public function parse_codename()
+ function parse_checkedonval($value, $name)
{
- global $nucleus;
- echo $nucleus['codename'];
- return;
- }
-
- /**
- * AdminActions::parse_commentnavlist()
- * Parse skinvar commentnavlist
- *
+ global $manager;
+
+ $item = false;
+ $itemid = intRequestVar('itemid');
+ $item =& $manager->getItem($itemid, 1, 1);
+
+ $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
+
+ if ( $item && $blog->convertBreaks() && requestVar('action') == 'itemedit' )
+ {
+ $item['body'] = removeBreaks($item['body']);
+ $item['more'] = removeBreaks($item['more']);
+ }
+
+ $contents = array();
+ if ( requestVar('action') == 'itemedit' )
+ {
+ $contents = $item;
+ }
+ if ( !isset($contents[$name]) )
+ {
+ $contents[$name] = '';
+ }
+ if ($contents[$name] == $value)
+ {
+ echo 'checked="checked"';
+ }
+ return;
+ }
+
+ /**
+ * AdminActions::parse_codename()
+ * Parse templatevar codename
+ *
+ * @param void
+ * @return void
+ *
+ * TODO: is this need???
+ */
+ public function parse_codename()
+ {
+ global $nucleus;
+ echo $nucleus['codename'];
+ return;
+ }
+
+ /**
+ * AdminActions::parse_commentnavlist()
+ * Parse skinvar commentnavlist
+ *
* @param void
* @return void
*/
}
/**
+ * AdminActions::parse_contents()
+ * Parse skinvar contents
+ *
+ * @param string $which part for item
+ * @return void
+ */
+ function parse_contents($which)
+ {
+ global $manager;
+
+ $item = false;
+ $contents = array();
+
+ if ( requestVar('action') == 'itemedit' )
+ {
+ $itemid = intRequestVar('itemid');
+ $item =& $manager->getItem($itemid, 1, 1);
+
+ $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
+
+ if ( $item && $blog->convertBreaks() )
+ {
+ $item['body'] = removeBreaks($item['body']);
+ $item['more'] = removeBreaks($item['more']);
+ }
+ $contents = $item;
+ }
+ elseif ( requestVar('action') == 'createitem' )
+ {
+ $blogid = intRequestVar('blogid');
+ $blog =& $manager->getBlog($blogid);
+ $manager->notify(
+ 'PreAddItemForm',
+ array(
+ 'contents' => &$contents,
+ 'blog' => &$blog
+ )
+ );
+ }
+
+ if ( !array_key_exists($which, $contents) )
+ {
+ $contents[$which] = '';
+ }
+ echo Entity::hsc($contents[$which],ENT_QUOTES);
+ }
+
+ /**
+ * AdminActions::parse_currenttime()
+ * Parse skinvar currenttime
+ *
+ * @param string $what
+ */
+ // for future items
+ function parse_currenttime($what)
+ {
+ global $manager;
+ if ( requestVar('action') == 'itemedit' )
+ {
+ $itemid = intRequestVar('itemid');
+ $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
+ }
+ elseif ( requestVar('action') == 'createitem' )
+ {
+ $blog =& $manager->getBlog(intRequestVar('blogid'));
+ }
+ $nu = getdate($blog->getCorrectTime());
+ echo $nu[$what];
+ }
+
+ /**
* AdminActions::parse_customhelplink()
* Parse skinvar customhelplink
*
public function parse_defaultadminskintypes($tabindex, $templateName = '')
{
$templates = array();
+
if ( $templateName )
{
$templates = Template::read($templateName);
}
- $types = Skin::getFriendlyNames('AdminActions');
+ $types = $this->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);
- $parser = new PARSER(Actions::getDefinedActions(), $handler);
+ $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 = Skin::getFriendlyNames();
+
+ $fNames = $this->skin->getAvailableTypes();
$sType = strtolower(trim(requestVar('type')));
switch ( $type )
echo intRequestVar('skinid');
break;
case 'name':
- echo Entity::hsc($skin->getName());
+ echo Entity::hsc($this->skin->getName());
break;
case 'desc':
- echo Entity::hsc($skin->getDescription());
+ echo Entity::hsc($this->skin->getDescription());
break;
case 'type':
- echo Entity::hsc($skin->getContentType());
+ echo Entity::hsc($this->skin->getContentType());
break;
case 'content':
- echo Entity::hsc($skin->getContent($sType));
+ echo Entity::hsc($this->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($skin->getIncludePrefix());
+ echo Entity::hsc($this->skin->getIncludePrefix());
break;
case 'mode':
$incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
}
/**
- * 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, $description = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
- {
- global $manager;
- $templateid = intRequestVar('templateid');
- $templatename = Template::getNameFromId($templateid);
- $templatedescription = Template::getDesc($templateid);
- $template =& Template::read($templatename);
- switch ( $type )
- {
- case 'id':
- echo intval($templateid);
- break;
- case 'name':
- echo Entity::hsc($templatename);
- break;
- case 'desc':
- echo Entity::hsc($templatedescription);
- 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']) )
- {
- $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
- }
- 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
*
public function parse_editcomment($type = 'id')
{
global $manager;
+
$commentid = intRequestVar('commentid');
$comment = COMMENT::getComment($commentid);
echo intRequestVar('commentid');
break;
case 'user':
- if (array_key_exists('member', $comment) && !empty($comment['member']) )
+ if ( !array_key_exists('member', $comment) || empty($comment['member']) )
{
- echo $comment['member'] . " (" . _EDITC_MEMBER . ")";
+ echo $comment['user'] . " (" . _EDITC_NONMEMBER . ")";
}
else
{
- echo $comment['user'] . " (" . _EDITC_NONMEMBER . ")";
+ echo $comment['member'] . " (" . _EDITC_MEMBER . ")";
}
break;
case 'date':
$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');
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 )
{
$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);
{
array_push($aOIDs, $o->oid);
$aOptions[$o->oid] = array(
-
'oid' => $o->oid,
'value' => $o->odef,
'name' => $o->oname,
}
// 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::getFriendlyNames('Actions');
- $sType = strtolower(trim(requestVar('type')));
+ $skinid = intRequestVar('skinid');
+ $skin = new SKIN($skinid);
+ $fNames = $skin->getAvailableTypes();
+ $sType = strtolower(trim(requestVar('type')));
switch ( $type )
{
echo Entity::hsc($skin->getContentType());
break;
case 'content':
- echo Entity::hsc($skin->getContent($sType));
+ echo Entity::hsc($skin->getContentFromDB($sType));
break;
case 'skintype':
$skinType = !array_key_exists($sType, $fNames) ? ucfirst($sType) : $fNames[$sType];
* @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)
- );
- echo TEMPLATE::fill($base, $data);
+ $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
*/
public function parse_helplink($topic = '')
{
- if ( empty($topic) )
+ if ( !empty($topic) )
{
- return;
+ help($topic);
}
- help($topic);
return;
}
* AdminActions::parse_inputyesno()
* Parse skinvar inputyesno
*
+ * some init stuff for all forms
+ *
+ * @param void
+ * @return void
+ */
+ function parse_init()
+ {
+ global $manager;
+
+ $item = false;
+ if ( requestVar('action') == 'itemedit' )
+ {
+ $itemid = intRequestVar('itemid');
+ $item =& $manager->getItem($itemid, 1, 1);
+
+ $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
+ if ( $item && $blog->convertBreaks() )
+ {
+ $item['body'] = removeBreaks($item['body']);
+ $item['more'] = removeBreaks($item['more']);
+ }
+ $contents = $item;
+ $authorid = $contents['authorid'];
+ }
+ elseif ( requestVar('action') == 'createitem' )
+ {
+ $blogid = intRequestVar('blogid');
+ $blog =& $manager->getBlog($blogid);
+ $authorid = '';
+ }
+ $blog->insertJavaScriptInfo($authorid);
+ return;
+ }
+
+ /**
+ * AdminActions::parse_inputyesno()
+ * Parse skinvar inputyesno
+ *
* @param string $name
* @param string $checkedval
* @param string $tabindex
{
$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(Actions::getDefinedActions(), $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']);
{
$option = Admin::$aOption;
- $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
{
public function parse_itemnavlist()
{
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
. ' OR (ibody LIKE "%' . sql_real_escape_string($search) . '%") '
. ' OR (imore LIKE "%' . sql_real_escape_string($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 = new Navlist($this->skintype, $start, $amount, 0, 1000, $blogid, $search, 0);
+ $navList->showBatchList('item', $query, 'table', $template);
+ return;
+ }
+
+ /**
+ * AdminActions::parse_itemoptions()
+ * Parse skinvar itemoptions
+ * Adds the itemOptions of a plugin to a page
+ * @author TeRanEX
+ */
+ function parse_itemoptions()
+ {
+ $this->parse_pluginoptions('item');
+ return;
+ }
+
+ /**
+ * AdminActions::parse_itemoptions()
+ *
+ * date change on edit item
+ *
+ * Parse skinvar itemoptions
+ * Adds the itemOptions of a plugin to a page
+ * @author TeRanEX
+ */
+ function parse_itemtime($what)
+ {
+ global $manager;
+
+ $item = false;
+ $itemid = intRequestVar('itemid');
+ $item =& $manager->getItem($itemid, 1, 1);
+
+ $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
+
+ if ( $item && $blog->convertBreaks() && requestVar('action') == 'itemedit' )
+ {
+ $item['body'] = removeBreaks($item['body']);
+ $item['more'] = removeBreaks($item['more']);
+ }
+
+ $contents = array();
+ if ( requestVar('action') == 'itemedit' )
+ {
+ $contents = $item;
+ }
+ elseif ( requestVar('action') == 'createitem' )
+ {
+ $data = array(
+ 'contents' => &$contents,
+ 'blog' => &$this->blog
+ );
+ $manager->notify('PreAddItemForm', $data);
+ }
+ $itemtime = getdate($contents['timestamp']);
+ echo $itemtime[$what];
return;
}
_SETTINGS_JSTOOLBAR_SIMPLE,
_SETTINGS_JSTOOLBAR_FULL
);
+
$i = 1;
foreach ( $options as $option )
{
return;
}
/**
- * Parse skinvar languageselectoptions
- */
- function parse_languageselectoptions()
- {
- $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";
- }
- }
- }
- }
-
- /**
* AdminActions::parse_localeselectoptions()
* Parse skinvar localeselectoptions
*
public function parse_localeselectoptions()
{
$locales = i18n::get_available_locale_list();
- $memid = intRequestVar('memberid');
+
+ $memid = intRequestVar('memberid');
if ( $memid )
{
$mem = MEMBER::createFromID($memid);
{
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() )
{
if ( $this->skintype == 'itemmove' )
{
$query = "SELECT icat as result FROM %s WHERE inumber=%d;";
- $query = spriintf($query, sql_table('item'), intRequestVar('itemid'));
+ $query = sprintf($query, sql_table('item'), intRequestVar('itemid'));
$catid = quickQuery(sprintf($query, intRequestVar('itemid')));
Admin::selectBlogCategory('catid', $catid, 10, 1);
}
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);
*/
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;
}
*/
public function parse_passrequestvars()
{
+ $passvar = Admin::getAdminpassvar();
$oldaction = postVar('oldaction');
+
if ( ($oldaction != 'logout')
&& ($oldaction != 'login')
- && Admin::passvar
+ && $passvar
&& !postVar('customaction') )
{
passRequestVars();
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);
$plug =& $manager->getPlugin($plugName);
*/
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;
}
*/
public function parse_pluginoptions($type = 'global')
{
+ global $itemid;
+
switch ( $type )
{
case 'member':
case 'category':
$id = intRequestVar('catid');
break;
+ case 'item':
+ $id = $itemid;
+ break;
}
Admin::insertPluginOptions($type, $id);
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, $template, $this->objAdmin);
- $parser = new PARSER(Actions::getDefinedActions(), $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(
'plugadmintooltip' => Entity::hsc($aInfo['tooltip']),
'plugadmintitle' => Entity::hsc($aInfo['title']),
);
- 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::fill($template['body'], $data);
}
echo $template['foot'];
}
*/
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 WHERE tdname NOT LIKE 'admin/%%' FROM %s";
+ $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 )
{
'expname' => Entity::hsc($skinObj->sdname),
'expdesc' => Entity::hsc($skinObj->sddesc),
);
- echo TEMPLATE::fill($template, $data);
+ echo Template::fill($template, $data);
}
break;
case 'template':
- $res = sql_query('SELECT * FROM '.sql_table('template_desc'). " WHERE tdname NOT LIKE 'admin/%'");
+ $res = sql_query('SELECT * FROM '.sql_table('template_desc'). " WHERE tdname NOT LIKE 'admin/%%';");
while ($templateObj = sql_fetch_object($res)) {
$data = array(
'typeid' => 'template[' . $templateObj->tdnumber . ']',
'expname' => Entity::hsc($templateObj->tdname),
'expdesc' => Entity::hsc($templateObj->tddesc),
);
- echo TEMPLATE::fill($template, $data);
+ echo Template::fill($template, $data);
}
break;
}
public function parse_skinoverview($templateName = '')
{
global $CONF;
- $query = "SELECT * FROM %s 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',
{
$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
+ echo Template::fill($template['head'], $data);
+ 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) )
{
$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 Template::fill($template['body'], $data);
}
$data = array();
if (array_key_exists('SPECIALSKINLIST_FOOT', $templates) && !empty($templates['SPECIALSKINLIST_FOOT']) )
{
$template['foot'] = "</ul>\n";
}
- echo TEMPLATE::fill($template['foot'], $data);
+ echo Template::fill($template['foot'], $data);
return;
}
}
{
$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();
'key' => $key,
'value' => $value,
);
- echo TEMPLATE::fill($template, $data);
+ echo Template::fill($template, $data);
}
break;
case 'modrewrite':
{
$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 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) {
- $templates = skinableTEMPLATE::read($tplName);
+
+ if ( $tplName )
+ {
+ $templates = Template::read($tplName);
+ }
+
+ if ( !array_key_exists('ADMIN_CUSTOMHELPLINK_ANCHOR', $templates) || empty($templates['ADMIN_CUSTOMHELPLINK_ANCHOR']) )
+ {
+ $template = "<a href=\"<%helpurl%>#<%helptarget%>\" title=\"<%title%>\" <%onclick%>>\n";
}
- if (isset($templates['ADMIN_CUSTOMHELPLINK_ANCHOR']) && !empty($templates['ADMIN_CUSTOMHELPLINK_ANCHOR'])) {
+ 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);
+ 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);
+
+ $icon = Template::fill($template, $data);
$help = self::customHelplink($id, $tplName, $url, $title, $onclick);
+
return $help . $icon;
}
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
{
}
else
{
- echo TEMPLATE::fill($template, $dat);
+ echo Template::fill($template, $dat);
}
return;
}
-
+
/**
+ * AdminActions::existsNewPlugin()
* Check exists new plugin
+ *
+ * @param void
+ * @return boolean exists or not
*/
private function existsNewPlugin()
{
global $DIR_PLUGINS;
+
$candidates = array();
- $files = scandir($DIR_PLUGINS);
- foreach ($files as $file) {
- if (preg_match("/^NP_(.*)\.php$/", $file, $matches)) {
+ $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) {
+ $query = "SELECT * FROM %s WHERE pfile='%s';";
+ $query = sprintf($query, sql_table('plugin'), sql_real_escape_string("{NP_{$name}"));
+ $res = sql_query($query);
+
+ if ( sql_num_rows($res) == 0 )
+ {
$candidates[] = $name;
}
}
+ continue;
}
$this->newPlugCandidates = $candidates;
return (count($candidates) > 0);