From b82168398ee0160603b015a4930998f6e656c098 Mon Sep 17 00:00:00 2001 From: sakamocchi Date: Sat, 26 May 2012 20:56:26 +0900 Subject: [PATCH] =?utf8?q?ADD/FIX/CHANGE/REMOVE:=20=E3=82=B9=E3=82=AD?= =?utf8?q?=E3=83=B3=E3=83=BB=E3=83=86=E3=83=B3=E3=83=97=E3=83=AC=E3=83=BC?= =?utf8?q?=E3=83=88=E8=A1=A8=E7=A4=BA=E5=87=A6=E7=90=86=E3=81=AE=E6=94=B9?= =?utf8?q?=E8=89=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 変更点は多岐に渡る。概ね以下の通り ・Encapsulate/Batch/navListクラスを廃止。代替関数をshowlist.phpに用意。 ・通常/管理画面用スキン・テンプレート内で使用可能な変数名を、区別せず統合 ・通常/管理画面用スキン・テンプレートを表示する処理を、区別せず統合 具体的には以下。 ・統合・変更したスキン用タグ(括弧内を廃止) defskinselect (adminskinselectoptions) editskintype (admineditskintype) editskin (editadminskin) normalskinlist (defaultadminskintypes) specialskinlist (adminspecialskinlist) editskintype (editadminskintype) allowedskinactions (allowedadminskinactions) skineditallowedlist (adminskineditallowedlist) selectlocalskinfiles (selectlocaladminskinfiles) skinielist (adminskinielist) skinoverview (adminskinoverview) editskintype (editadminskintype) edittemplateinfo (editadmintemplateinfo) templateoverview (admintemplateoverview) ・追加・変更したテンプレート用タグ(括弧内を廃止) NORMALSKINLIST_HEAD (SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD) NORMALSKINLIST_BODY (SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY) NORMALSKINLIST_FOOT (SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT) SPECIALSKINLIST_HEAD (SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD) SPECIALSKINLIST_BODY (SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY) SPECIALSKINLIST_FOOT (SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT) ・統合・変更した関数・クラス(括弧内を廃止) listplug_list_normalskinlist() (listplug_table_adminskinlist()) listplug_list_specialskinlist() (listplug_table_admintemplatelist()) listplug_input_yesno() (AdminActions::input_yesno()) batchlist() (Batchクラス) (Encapsulateクラス) navlist() (NavListクラス) (Encapsulateクラス) --- install/index.php | 1 - nucleus/convert/bloggercaif.php | 6 +- nucleus/convert/functions.inc.php | 2 +- nucleus/convert/genericImport.php | 4 +- nucleus/convert/greymatter.php | 8 +- nucleus/convert/livejournal.php | 6 +- nucleus/documentation/help.html | 2 +- nucleus/index.php | 7 +- nucleus/libs/ADMIN.php | 29 +- nucleus/libs/AdminActions.php | 3323 +++++++++------------- nucleus/libs/ENCAPSULATE.php | 287 -- nucleus/libs/showlist.php | 1130 +++++--- nucleus/locales/adminskinTypes.php | 6 +- skins/admin/default/skinbackup.xml | 5289 ++++++++++++++++++++---------------- skins/admin/defaultimporter.skn | 272 +- skins/admin/showlogin.skn | 117 +- 16 files changed, 5227 insertions(+), 5262 deletions(-) delete mode 100644 nucleus/libs/ENCAPSULATE.php diff --git a/install/index.php b/install/index.php index 11e3c6e..03d65f9 100644 --- a/install/index.php +++ b/install/index.php @@ -1341,7 +1341,6 @@ function do_check_files() '../nucleus/libs/COMMENT.php', '../nucleus/libs/COMMENTACTIONS.php', '../nucleus/libs/COMMENTS.php', - '../nucleus/libs/ENCAPSULATE.php', '../nucleus/libs/ENTITY.php', '../nucleus/libs/globalfunctions.php', '../nucleus/libs/i18n.php', diff --git a/nucleus/convert/bloggercaif.php b/nucleus/convert/bloggercaif.php index 72c70bf..8293083 100644 --- a/nucleus/convert/bloggercaif.php +++ b/nucleus/convert/bloggercaif.php @@ -220,7 +220,7 @@ while ($a_name = array_pop($authors)) { @@ -247,7 +247,7 @@ while ($a_name = array_pop($authors)) {
@@ -258,7 +258,7 @@ while ($a_name = array_pop($authors)) { diff --git a/nucleus/convert/functions.inc.php b/nucleus/convert/functions.inc.php index 045cbdb..c712614 100644 --- a/nucleus/convert/functions.inc.php +++ b/nucleus/convert/functions.inc.php @@ -294,7 +294,7 @@ class BlogImport { $query = 'SELECT bname as text, bnumber as value FROM '.sql_table('blog'); $template['name'] = 'blogid'; $template['selected'] = $CONF['DefaultBlog']; - showlist($query,'select',$template); + echo showlist($query,'select',$template); break; // ---------------------------------------------------------------------------------------- case 'ConvertSelectMembers': diff --git a/nucleus/convert/genericImport.php b/nucleus/convert/genericImport.php index 58f5f7d..2c46a9a 100644 --- a/nucleus/convert/genericImport.php +++ b/nucleus/convert/genericImport.php @@ -149,7 +149,7 @@ function gi_assignMembers() {
@@ -160,7 +160,7 @@ function gi_assignMembers() { diff --git a/nucleus/convert/greymatter.php b/nucleus/convert/greymatter.php index f0bda61..30367f0 100644 --- a/nucleus/convert/greymatter.php +++ b/nucleus/convert/greymatter.php @@ -184,7 +184,7 @@ while ($author = fgets($filehandle,4096)) { $query = 'SELECT mname as text, mnumber as value FROM '.sql_table('member'); $template['name'] = 'memberid[' . $idx . ']'; - showlist($query,'select',$template); + echo showlist($query,'select',$template); ?> @@ -209,7 +209,7 @@ fclose($filehandle); $query = 'SELECT mname as text, mnumber as value FROM '.sql_table('member'); $template['name'] = 'memberid[0]'; - showlist($query,'select',$template); + echo showlist($query,'select',$template); ?> @@ -231,7 +231,7 @@ fclose($filehandle);
@@ -243,7 +243,7 @@ fclose($filehandle); $query = 'SELECT mname as text, mnumber as value FROM '.sql_table('member'); $template['name'] = 'newowner'; - showlist($query,'select',$template); + echo showlist($query,'select',$template); ?> diff --git a/nucleus/convert/livejournal.php b/nucleus/convert/livejournal.php index a20f493..735c988 100644 --- a/nucleus/convert/livejournal.php +++ b/nucleus/convert/livejournal.php @@ -157,7 +157,7 @@ function bc_assignMembers() { . " FROM ".sql_table('member'); $template['name'] = 'memberid[' . $idx . ']'; - showlist($query,'select',$template); + echo showlist($query,'select',$template); ?> @@ -187,7 +187,7 @@ function bc_assignMembers() { . " FROM ".sql_table('blog'); $template['name'] = 'blogid'; $template['selected'] = $CONF['DefaultBlog']; - showlist($query,'select',$template); + echo showlist($query,'select',$template); ?>
@@ -200,7 +200,7 @@ function bc_assignMembers() { . " FROM ".sql_table('member'); $template['name'] = 'newowner'; - showlist($query,'select',$template); + echo showlist($query,'select',$template); ?> diff --git a/nucleus/documentation/help.html b/nucleus/documentation/help.html index 64086f9..dd78248 100644 --- a/nucleus/documentation/help.html +++ b/nucleus/documentation/help.html @@ -5561,7 +5561,7 @@ adminskinoverview

templateName

Skintypes

-admntemplateoverview +admintemplateoverview

Examples

diff --git a/nucleus/index.php b/nucleus/index.php
index 6bc8c7e..a2b5368 100644
--- a/nucleus/index.php
+++ b/nucleus/index.php
@@ -78,12 +78,11 @@ if ( $bNeedsLogin )
 	$action = 'showlogin';
 }
 
-/* FIXME: Skin class also output this HTTP1.1 headers
-sendContentType('text/html', 'admin-' . $action);
-*/
-
 if ( !Admin::initialize() )
 {
+	/* TODO: this is a bad way... */
+	sendContentType('text/html', 'admin-' . $action);
+	
 	$skin = new Skin(0, 'AdminActions', 'AdminSkin');
 	if ( $bNeedsLogin )
 	{
diff --git a/nucleus/libs/ADMIN.php b/nucleus/libs/ADMIN.php
index 453d624..6dbf3b3 100644
--- a/nucleus/libs/ADMIN.php
+++ b/nucleus/libs/ADMIN.php
@@ -208,7 +208,6 @@ class Admin
 			$alias = array(
 				'login'	=> 'overview',
 				''		=> 'overview',
-				'admntemplateoverview' => 'admintemplateoverview'
 			);
 		}
 		if ( array_key_exists($action, $alias) && isset($alias[$action]) )
@@ -233,7 +232,7 @@ class Admin
 				self::error(_ERROR_BADTICKET);
 			}
 		}
-
+		
 		/* 3. parse according to the action */
 		if ( !method_exists('Admin', $methodName) && !in_array(self::$action, $allowActions) && self::existsSkinContents($action) )
 		{
@@ -251,7 +250,7 @@ class Admin
 		}
 		elseif ( $id != $CONF['AdminSkin'] )
 		{
-			self::$skin = new Skin($CONF['AdminSkin']);
+			self::$skin = new Skin($CONF['AdminSkin'], 'AdminActions');
 			if ( self::$skin && self::existsSkinContents('adminerrorpage') )
 			{
 				self::error(_BADACTION . ENTITY::hsc($action));
@@ -3059,27 +3058,13 @@ class Admin
 		$member->isAdmin() or self::disallow();
 		
 		Admin::$extrahead .= "\n";
-		Admin::$extrahead .= '\n";
+		Admin::$extrahead .= "\n";
 		
 		self::$skin->parse('templateedit');
 		return;
 	}
 	
 	/**
-	 * TODO: remove this
-	 *
-	static private function _templateEditRow(&$template, $description, $name, $help = '', $tabindex = 0, $big = 0) {
-		static $count = 1;
-		if (!isset($template[$name])) $template[$name] = '';
-	?>
-		
-			 
-			
-	 _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,
@@ -241,7 +125,7 @@ class AdminActions extends BaseActions
 	
 	/**
 	 * AdminActions::getAvailableSkinTypes()
-	 * 
+	 *
 	 * @static
 	 * @param	void
 	 * @return	array	list of friendly names for page actions
@@ -266,7 +150,7 @@ class AdminActions extends BaseActions
 	/**
 	 * AdminActions::__construct()
 	 * Constructor for a new Actions object
-	 * 
+	 *
 	 * @param	string	$type
 	 * @return	void
 	 */
@@ -274,571 +158,588 @@ class AdminActions extends BaseActions
 	{
 		// call constructor of superclass first
 		parent::__construct();
-		$this->skintype = $type;
-		if ( !class_exists('Navlist') || !class_exists('Batch') )
+
+		/* alias */
+		if ( $type == 'admntemplateoverview' )
+		{
+			$this->skintype = 'admintemplateoverview';
+		}
+		else
 		{
-			global $DIR_LIBS;
-			include $DIR_LIBS . 'ENCAPSULATE.php';
+			$this->skintype = $type;
 		}
+	
 		return;
 	}
 	
 	/**
 	 * AdminActions::getAvailableActions()
-	 * 
+	 *
 	 * @param	void
 	 * @return	array	allowed	actions for the page type
 	 */
 	public function getAvailableActions()
 	{
 		$extra_actions = array();
-		
+
 		switch ( $this->skintype )
 		{
 			case 'actionlog':
 				$extra_actions = array(
-					'actionloglist',
+				'actionloglist',
 				);
 				break;
 			case 'activate':
 				$extra_actions = array(
-					'activationmessage',
-					'eventformextra',
+				'activationmessage',
+				'eventformextra',
 				);
 				break;
 			case 'activatesetpwd':
 				$extra_actions = array(
+				/* nothing special */
 				);
 				break;
 			case 'addnewlog':
 				$extra_actions = array(
-					'getblogsetting',
-					'blogsetting',
-					'requestblogid',
-					);
+				'getblogsetting',
+				'blogsetting',
+				'requestblogid',
+				);
 				break;
 			case 'adminerrorpage':
 				$extra_actions = array(
+				/* nothing special */
 				);
 				break;
 			case 'adminskindelete':
 				$extra_actions = array(
-					'editadminskintype',
+				'editskintype',
 				);
 				break;
 			case 'adminskinedit':
 				$extra_actions = array(
-					'editadminskin',
-					'defaultadminskintypes',
-					'adminspecialskinlist',
+				'editskin',
+				'normalskinlist',
+				'specialskinlist',
 				);
 				break;
 			case 'adminskinedittype':
 				$extra_actions = array(
-					'editadminskintype',
-					'skintypehelp',
-					'allowedadminskinactions',
-					'adminskineditallowedlist',
+				'editskintype',
+				'skintypehelp',
+				'allowedskinactions',
+				'skineditallowedlist',
 				);
 				break;
 			case 'adminskiniedoimport':
 				$extra_actions = array(
-					'importskininfo',
+				'importskininfo',
 				);
 				break;
 			case 'adminskinieimport':
 				$extra_actions = array(
-					'importskininfo',
+				'importskininfo',
 				);
 				break;
 			case 'adminskinieoverview':
 				$extra_actions = array(
-					'selectlocaladminskinfiles',
-					'adminskinielist',
+				'selectlocalskinfiles',
+				'skinielist',
 				);
 				break;
 			case 'adminskinoverview':
 				$extra_actions = array(
-					'adminskinoverview',
+				'skinoverview',
 				);
 				break;
 			case 'adminskinremovetype':
 				$extra_actions = array(
-					'editadminskintype',
+				'editskintype',
 				);
 				break;
 			case 'admintemplatedelete':
 				$extra_actions = array(
-					'editadmintemplateinfo',
+				'editadmintemplateinfo',
 				);
 			case 'admintemplateedit':
 				$extra_actions = array(
-					'editadmintemplateinfo',
+				'edittemplateinfo',
 				);
 				break;
-			case 'admntemplateoverview':
+			case 'admintemplateoverview':
 				$extra_actions = array(
-					'admintemplateoverview',
+				'templateoverview',
 				);
 				break;
 			case 'backupoverview':
 				$extra_actions = array(
+				/* nothing special */
 				);
 				break;
 			case 'backuprestore':
 				$extra_actions = array(
+				/* nothing special */
 				);
 				break;
 			case 'banlist':
 				$extra_actions = array(
-					'adminbloglink',
-					'adminbanlist',
-					'requestblogid',
+				'adminbloglink',
+				'adminbanlist',
+				'requestblogid',
 				);
 				break;
 			case 'banlistdelete':
 				$extra_actions = array(
-					'requestiprange',
-					'requestblogid',
+				'requestiprange',
+				'requestblogid',
 				);
 				break;
 			case 'banlistdeleteconfirm':
 				$extra_actions = array(
-					'banlistdeletedlist',
-					'requestblogid',
+				'banlistdeletedlist',
+				'requestblogid',
 				);
 				break;
 			case 'banlistnew':
 				$extra_actions = array(
-					'iprangeinput',
-					'requestblogid',
-					'blogsetting',
+				'iprangeinput',
+				'requestblogid',
+				'blogsetting',
 				);
 				break;
 			case 'batchcategory':
 				$extra_actions = array(
-					'adminbatchaction',
-					'adminbatchlist',
+				'adminbatchaction',
+				'adminbatchlist',
 				);
 				break;
 			case 'batchcomment':
 				$extra_actions = array(
-					'adminbatchaction',
-					'adminbatchlist',
+				'adminbatchaction',
+				'adminbatchlist',
 				);
 				break;
 			case 'batchdelete':
 				$extra_actions = array(
-					'batchdeletetype',
-					'batchdeletelist',
+				'batchdeletetype',
+				'batchdeletelist',
 				);
 				break;
 			case 'batchitem':
 				$extra_actions = array(
-					'adminbatchaction',
-					'adminbatchlist',
+				'adminbatchaction',
+				'adminbatchlist',
 				);
 				break;
 			case 'batchmember':
 				$extra_actions = array(
-					'adminbatchaction',
-					'adminbatchlist',
+				'adminbatchaction',
+				'adminbatchlist',
 				);
 				break;
 			case 'batchmove':
 				$extra_actions = array(
-					'batchmovetitle',
-					'batchmovetype',
-					'batchmovelist',
-					'movedistselect',
-					'batchmovebtn',
+				'batchmovetitle',
+				'batchmovetype',
+				'batchmovelist',
+				'movedistselect',
+				'batchmovebtn',
 				);
 				break;
 			case 'batchmovecat':
 				$extra_actions = array(
-					'batchmovetitle',
-					'batchmovetype',
-					'batchmovelist',
-					'movedistselect',
-					'batchmovebtn',
+				'batchmovetitle',
+				'batchmovetype',
+				'batchmovelist',
+				'movedistselect',
+				'batchmovebtn',
 				);
 				break;
 			case 'batchteam':
 				$extra_actions = array(
-					'requestblogid',
-					'adminbatchaction',
-					'adminbatchlist',
+				'requestblogid',
+				'adminbatchaction',
+				'adminbatchlist',
 				);
 				break;
 			case 'blogcommentlist':
 				$extra_actions = array(
-					'adminbloglink',
-					'commentnavlist',
-					'adminbatchlist',
+				'adminbloglink',
+				'commentnavlist',
+				'adminbatchlist',
 				);
 				break;
 			case 'blogsettings':
 				$extra_actions = array(
-					'adminbloglink',
-					'blogcatlist',
-					'blognotifysetting',
-					'blogsetting',
-					'blogsettingyesno',
-					'blogteammembers',
-					'blogtime',
-					'defcatselect',
-					'defskinselect',
-					'pluginextras',
-					'pluginoptions',
-					'requestblogid',
+				'adminbloglink',
+				'blogcatlist',
+				'blognotifysetting',
+				'blogsetting',
+				'blogsettingyesno',
+				'blogteammembers',
+				'blogtime',
+				'defcatselect',
+				'defskinselect',
+				'pluginextras',
+				'pluginoptions',
+				'requestblogid',
 				);
 				break;
 			case 'bookmarklet':
 				$extra_actions = array(
-					'bookmarkletadmin',
+				'bookmarkletadmin',
 				);
 				break;
 			case 'browseowncomments':
 				$extra_actions = array(
-					'commentnavlist',
+				'commentnavlist',
 				);
 				break;
 			case 'browseownitems':
 				$extra_actions = array(
-					'itemnavlist',
+				'itemnavlist',
 				);
 				break;
 			case 'categorydelete':
 				$extra_actions = array(
-					'categorysetting',
-					'requestblogid',
+				'categorysetting',
+				'requestblogid',
 				);
 				break;
 			case 'categoryedit':
 				$extra_actions = array(
-					'requestblogid',
-					'categorysetting',
-					'editdesturl',
-					'pluginoptions'
+				'requestblogid',
+				'categorysetting',
+				'editdesturl',
+				'pluginoptions'
 				);
 				break;
 			case 'commentdelete':
 				$extra_actions = array(
-					'deletecomment',
+				'deletecomment',
 				);
 				break;
 			case 'commentedit':
 				$extra_actions = array(
-					'editcomment',
+				'editcomment',
 				);
 				break;
 			case 'createaccountinput':
 				$extra_actions = array(
-					'contents',
-					'pluginextras',
-					'eventformextra',
+				'contents',
+				'pluginextras',
+				'eventformextra',
 				);
 				break;
 			case 'createaccountsuccess':
 				$extra_actions = array(
-					'contents',
+				'contents',
 				);
 				break;
 			case 'createaccountdisable':
 				$extra_actions = array(
-					/* nothins */
+				/* nothing special */
 				);
 				break;
 			case 'createitem':
 				$extra_actions = array(
-					'adminbloglink',
-					'blogid',
-					'contents',
-					'categories',
-					'currenttime',
-					'init',
-					'pluginoptions',
-					'pluginextras'
+				'adminbloglink',
+				'blogid',
+				'contents',
+				'categories',
+				'currenttime',
+				'init',
+				'pluginoptions',
+				'pluginextras'
 				);
 				break;
 			case 'createnewlog':
 				$extra_actions = array(
-					'defskinselect',
-					'blogtime',
+				'defskinselect',
+				'blogtime',
 				);
 				break;
 			case 'deleteblog':
 				$extra_actions = array(
-					'blogsetting',
-					'requestblogid',
+				'blogsetting',
+				'requestblogid',
 				);
 				break;
 			case 'editmembersettings':
 				$extra_actions = array(
-					'adminskinselectoptions',
-					'editmember',
-					'localeselectoptions',
-					'pluginoptions',
+				'defskinselect',
+				'editmember',
+				'localeselectoptions',
+				'pluginoptions',
 				);
 				break;
 			case 'forgotpassword':
 				$extra_actions = array(
-					/* nothing */
+				/* nothing special */
 				);
 				break;
 			case 'itemcommentlist':
 				$extra_actions = array(
-					'requestblogid',
-					'commentnavlist',
+				'requestblogid',
+				'commentnavlist',
 				);
 				break;
 			case 'itemdelete':
 				$extra_actions = array(
-					'deleteitemtitle',
-					'deleteitembody',
-					'deleteitemid',
+				'deleteitemtitle',
+				'deleteitembody',
+				'deleteitemid',
 				);
 				break;
 			case 'itemedit':
 				$extra_actions = array(
-					'init',
-					'contents',
-					'checkedonval',
-					'categories',
-					'currenttime',
-					'itemtime',
-					'pluginoptions',
-					'pluginextras'
+				'init',
+				'contents',
+				'checkedonval',
+				'categories',
+				'currenttime',
+				'itemtime',
+				'pluginoptions',
+				'pluginextras'
 				);
 				break;
 			case 'itemlist':
 				$extra_actions = array(
-					'adminbloglink',
-					'ilistaddnew',
-					'itemnavlist',
+				'adminbloglink',
+				'ilistaddnew',
+				'itemnavlist',
 				);
 				break;
 			case 'itemmove':
 				$extra_actions = array(
-					'moveitemid',
-					'movedistselect',
+				'moveitemid',
+				'movedistselect',
 				);
 				break;
 			case 'manage':
 				$extra_actions = array(
+				/* nothing special */
 				);
 				break;
 			case 'manageteam':
 				$extra_actions = array(
-					'requestblogid',
-					'blogsetting',
-					'blogteamlist',
-					'newmemberselect',
-					'inputyesno',
+				'requestblogid',
+				'blogsetting',
+				'blogteamlist',
+				'newmemberselect',
+				'inputyesno',
 				);
 				break;
 			case 'memberdelete':
 				$extra_actions = array(
-					'editmember',
+				'editmember',
 				);
 				break;
 			case 'overview':
 				$extra_actions = array(
-					'yrbloglist',
+				'yrbloglist',
 				);
 				break;
 			case 'plugindelete':
 				$extra_actions = array(
-					'editpluginfo',
+				'editpluginfo',
 				);
 				break;
 			case 'pluginhelp':
 				$extra_actions = array(
-					'helpplugname',
-					'pluginhelp',
+				'helpplugname',
+				'pluginhelp',
 				);
 				break;
 			case 'pluginlist':
 				$extra_actions = array(
-					'pluginlistlist',
-					'newpluginlist',
+				'pluginlistlist',
+				'newpluginlist',
 				);
 				break;
 			case 'pluginoptions':
 				$extra_actions = array(
-					'editpluginfo',
-					'editplugoptionslist',
+				'editpluginfo',
+				'editplugoptionslist',
 				);
 				break;
 			case 'settingsedit':
 				$extra_actions = array(
-					'defblogselect',
-					'defskinselect',
-					'configsettingsedit',
-					'configsettingsyesno',
-					'outputspecialdirs',
-					'jstoolbaroptions',
-					'localeselectoptions',
-					'mediadirwarning',
-					'pluginextras',
+				'defblogselect',
+				'defskinselect',
+				'configsettingsedit',
+				'configsettingsyesno',
+				'outputspecialdirs',
+				'jstoolbaroptions',
+				'localeselectoptions',
+				'mediadirwarning',
+				'pluginextras',
 				);
 				break;
 			case 'showlogin':
 				$extra_actions = array(
-					'passrequestvars',
+				'passrequestvars',
 				);
 				break;
 			case 'skindelete':
 				$extra_actions = array(
-					'editskintype',
+				'editskintype',
 				);
 				break;
 			case 'skinedit':
 				$extra_actions = array(
-					'editskin',
-					'specialskinlist',
+				'editskin',
+				'normalskinlist',
+				'specialskinlist'
 				);
 				break;
 			case 'skinedittype':
 				$extra_actions = array(
-					'editskintype',
-					'skintypehelp',
-					'allowedskinactions',
-					'skineditallowedlist',
-					'skineditallowedlist',
+				'editskintype',
+				'skintypehelp',
+				'allowedskinactions',
+				'skineditallowedlist'
 				);
 				break;
 			case 'skiniedoimport':
 				$extra_actions = array(
-					'importskininfo',
+				'importskininfo',
 				);
 				break;
 			case 'skinieimport':
 				$extra_actions = array(
-					'importskininfo',
+				'importskininfo',
 				);
 				break;
 			case 'skinieoverview':
 				$extra_actions = array(
-					'selectlocalskinfiles',
-					'skinielist',
+				'selectlocalskinfiles',
+				'skinielist',
 				);
 				break;
 			case 'skinoverview':
 				$extra_actions = array(
-					'skinoverview',
+				'skinoverview',
 				);
 				break;
 			case 'skinremovetype':
 				$extra_actions = array(
-					'editskintype',
+				'editskintype',
 				);
 				break;
 			case 'systemoverview':
 				$extra_actions = array(
-					'systemsettings',
+				'systemsettings',
 				);
 				break;
 			case 'teamdelete':
 				$extra_actions = array(
-					'editmember',
-					'blogsetting',
-					'requestblogid',
+				'editmember',
+				'blogsetting',
+				'requestblogid',
 				);
 				break;
 			case 'templatedelete':
 				$extra_actions = array(
-					'edittemplateinfo',
+				'edittemplateinfo',
 				);
 				break;
 			case 'templateedit':
 				$extra_actions = array(
-					'edittemplateinfo',
+				'edittemplateinfo',
 				);
 				break;
 			case 'templateoverview':
 				$extra_actions = array(
-					'templateoverview',
+				'templateoverview',
 				);
 				break;
 			case 'usermanagement':
 				$extra_actions = array(
-					'editmemberlist',
-					'inputyesno',
+				'editmemberlist',
+				'inputyesno',
 				);
 				break;
 			case 'importAdmin':
 				$extra_actions = array(
-					'charset',
-					'adminurl',
-					'extrahead',
-					'member',
-					'versioncheckurl',
-					'version',
-					'codename',
-					'newestcompare',
-					'selectlocaladminskinfiles',
-					'adminskinielist',
+				'charset',
+				'adminurl',
+				'extrahead',
+				'member',
+				'versioncheckurl',
+				'version',
+				'codename',
+				'newestcompare',
+				'selectlocalskinfiles',
+				'skinielist',
 				);
 				break;
 			default:
 				break;
 		}
-		
+	
 		$defined_actions = array_merge(self::$default_actions, $extra_actions);
-		
+
 		return array_merge($defined_actions, parent::getAvailableActions());
 	}
 	
 	/**
 	 * AdminActions::parse_actionloglist()
 	 * Parse skinvar actionloglist
-	 * 
-	 * @param	string	$templateName	name of template to use
+	 *
+	 * @param	string	$template_name	name of template to use
 	 * @return	void
 	 */
-	public function parse_actionloglist($templateName = '')
+	public function parse_actionloglist($template_name = '')
 	{
-		$query = "SELECT * FROM %s ORDER BY timestamp DESC";
-		$query = sprintf($query, sql_table('actionlog'));	
-		
-		$template['content'] = 'actionlist';
-		$amount = showlist($query, 'table', $template, $templateName);
+		$query = "SELECT * FROM %s ORDER BY timestamp DESC;";
+		$query = sprintf($query, sql_table('actionlog'));
+
+		$resource = DB::getResult($query);
+		if ( $resource->rowCount() > 0 )
+		{
+			$template['content'] = 'actionlist';
+			$this->parser->parse(showlist($resource, 'table', $template, $template_name));
+		}
+		else
+		{
+			/* TODO: nothing to be shown */
+		}
 		return;
 	}
 	
-	
 	/**
 	 * AdminActions::parse_activationmessage()
 	 * Parse skinvar activationmessage
-	 * 
+	 *
 	 * @param	string	$type			type of message
-	 * @param	string	$templateName	name of template to use
+	 * @param	string	$template_name	name of template to use
 	 * @return	void
 	 */
-	public function parse_activationmessage($type, $templateName = '')
+	public function parse_activationmessage($type, $template_name = '')
 	{
 		global $CONF, $manager;
 		
 		$template = array();
 		
-		if ( !empty($templateName))
+		if ( !empty($template_name))
 		{
-			$template =& $manager->getTemplate($templateName);
+			$template =& $manager->getTemplate($template_name);
 		}
-		
+	
 		$key = postVar('ackey');
 		if ( !$key )
 		{
 			Admin::error(_ERROR_ACTIVATE);
 		}
-		
+	
 		$info = MEMBER::getActivationInfo($key);
 		if ( !$info )
 		{
 			Admin::error(_ERROR_ACTIVATE);
 		}
-		
+	
 		$mem =& $manager->getMember($info->vmember);
 		if ( !$mem )
 		{
@@ -902,8 +803,8 @@ class AdminActions extends BaseActions
 				break;
 		}
 		$aVars = array(
-			'memberName'	=> Entity::hsc($mem->getDisplayName()),
-			'realName'		=> Entity::hsc($mem->getRealName()),
+		'memberName'	=> Entity::hsc($mem->getDisplayName()),
+		'realName'		=> Entity::hsc($mem->getRealName()),
 		);
 		switch ( $type )
 		{
@@ -923,7 +824,7 @@ class AdminActions extends BaseActions
 	/**
 	 * AdminActions::parse_addtickettourl()
 	 * Parse skinvar addtickettourl
-	 * 
+	 *
 	 * @param	string	$url	URI for ticket
 	 * @return	void
 	 */
@@ -938,22 +839,24 @@ class AdminActions extends BaseActions
 	/**
 	 * AdminActions::parse_adminbanlist()
 	 * Parse skinvar adminbanlist
-	 * 
-	 * @param	string	$templateName	name of template to use
+	 *
+	 * @param	string	$template_name	name of template to use
 	 * @return	void
 	 */
-	public function parse_adminbanlist($templateName = '')
+	public function parse_adminbanlist($template_name = '')
 	{
 		$blogid = intRequestVar('blogid');
-		
+
 		$query = "SELECT * FROM %s WHERE blogid=%d ORDER BY iprange;";
 		$query = sprintf($query, sql_table('ban'), (integer) $blogid);
-		
-		$template['content'] = 'banlist';
-		
-		$amount = Showlist($query, 'table', $template, $templateName);
-		
-		if ( $amount == 0 )
+
+		$resource = DB::getResult($query);
+		if ( $resource->rowCount() > 0 )
+		{
+			$template['content'] = 'banlist';
+			$this->parser-parse(showlist($resource, 'table', $template, $template_name));
+		}
+		else
 		{
 			echo _BAN_NONE;
 		}
@@ -963,7 +866,7 @@ class AdminActions extends BaseActions
 	/**
 	 * AdminActions::parse_adminbatchaction()
 	 * Parse skinvar adminbatchaction
-	 * 
+	 *
 	 * @param	void
 	 * @return	void
 	 */
@@ -976,36 +879,36 @@ class AdminActions extends BaseActions
 	/**
 	 * AdminActions::parse_adminbatchlist()
 	 * Parse skinvar adminbatchlist
-	 * 
-	 * @param	string	$templateName	name of template to use
+	 *
+	 * @param	string	$template_name	name of template to use
 	 * @return	void
 	 */
-	public function parse_adminbatchlist($templateName = '')
+	public function parse_adminbatchlist($template_name = '')
 	{
 		global $manager;
 		$templates = array();
-		
-		if ( !empty($templateName) )
+
+		if ( !empty($template_name) )
 		{
-			$templates =& $manager->getTemplate($templateName);
+			$templates =& $manager->getTemplate($template_name);
 		}
-		
+	
 		if ( !array_key_exists('ADMIN_BATCHLIST', $templates) || empty($templates['ADMIN_BATCHLIST']) )
 		{
 			$template = '
  • <%text(_BATCH_EXECUTING)%> ' - . '<%adminbatchaction%> ' - . '<%batchlisttype%> ' - . '<%batchid%>... ' - . '<%batchlistmsg%>' - . '
  • ' . "\n"; + . '<%adminbatchaction%> ' + . '<%batchlisttype%> ' + . '<%batchid%>... ' + . '<%batchlistmsg%>' + . "\n"; } else { $template = $templates['ADMIN_BATCHLIST']; } - + $selected = requestIntArray('batch'); - $action = requestVar('batchaction'); + $action = requestVar('batchaction'); switch ( $this->skintype ) { @@ -1043,7 +946,7 @@ class AdminActions extends BaseActions $destid = intRequestVar('destblogid'); break; } - + // walk over all selectedids and perform action foreach ( $selected as $selectedid ) { @@ -1058,7 +961,7 @@ class AdminActions extends BaseActions } else { - $error = Admin::deleteOneTeamMember($blogid, $selectedid); + $error = Admin::deleteOneTeamMember($blogid, $selectedid); } break; case 'move': @@ -1084,23 +987,16 @@ class AdminActions extends BaseActions default: $error = _BATCH_UNKNOWN . Entity::hsc($action); } - + $data = array( - 'batchid' => $selectedid, - 'batchlisttype' => Entity::hsc($batchlisttype), - 'adminbatchaction' => Entity::hsc($action), - 'batchlistmsg' => $error ? $error : _BATCH_SUCCESS, + 'batchid' => $selectedid, + 'batchlisttype' => Entity::hsc($batchlisttype), + 'adminbatchaction' => Entity::hsc($action), + 'batchlistmsg' => $error ? $error : _BATCH_SUCCESS, ); - - $handler = new AdminActions('template'); - $parser = new Parser($handler); - - $output = Template::fill($template, $data); - ob_start(); - $parser->parse($output); - $output = ob_get_contents(); - ob_end_clean(); - echo "{$output}
    "; + + $this->parser->parse(Template::fill($template, $data)); + echo '
    '; } return; } @@ -1108,22 +1004,22 @@ class AdminActions extends BaseActions /** * AdminActions::parse_adminbloglink() * Parse skinvar adminbloglink - * - * @param string $templateName name of template to use + * + * @param string $template_name name of template to use * @return void */ - public function parse_adminbloglink($templateName = '') + public function parse_adminbloglink($template_name = '') { global $manager; $blogid = intRequestVar('blogid'); $blog =& $manager->getBlog($blogid); $templates = array(); - - if ( !empty($templateName) ) + + if ( !empty($template_name) ) { - $templates =& $manager->getTemplate($templateName); + $templates =& $manager->getTemplate($template_name); } - + if ( !array_key_exists('ADMIN_BLOGLINK', $templates) || empty($templates['ADMIN_BLOGLINK']) ) { $template = '<%blogname%>'; @@ -1132,13 +1028,13 @@ class AdminActions extends BaseActions { $template = $templates['ADMIN_BLOGLINK']; } - + $data = array( - 'url' => Entity::hsc($blog->getURL()), - 'adminbloglinktitle' => _BLOGLIST_TT_VISIT, - 'blogname' => Entity::hsc($blog->getName()) + 'url' => Entity::hsc($blog->getURL()), + 'adminbloglinktitle' => _BLOGLIST_TT_VISIT, + 'blogname' => Entity::hsc($blog->getName()) ); - + echo Template::fill($template, $data); return; } @@ -1146,7 +1042,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_adminerrormesg() * Parse skinvar adminerrormesg - * + * * @param void * @return void */ @@ -1154,7 +1050,7 @@ class AdminActions extends BaseActions { global $CONF; $message = ''; - + if ( requestVar('errormessage') ) { $message = requestVar('errormessage'); @@ -1172,408 +1068,134 @@ class AdminActions extends BaseActions } /** - * AdminActions::parse_adminskineditallowedlist() - * Parse skinvar adminskineditallowedlist - * - * @param string $type template/blog - * @param string $templateName name of template to use + * AdminActions::parse_allowedskinactions() + * Parse skinvar allowedskinactions + * + * @param void * @return void */ - public function parse_adminskineditallowedlist($type = 'template', $templateName = '') + public function parse_allowedskinactions() { - switch ( $type ) + $type = strtolower(trim(requestVar('type'))); + $skinid = intRequestVar('skinid'); + + if ( !preg_match('#^admin#', $this->skintype) ) { - /* TODO: blog seems not to be used */ - case 'blog': - $query = "SELECT bshortname, bname FROM %s"; - $query = sprintf($query, sql_table('blog')); - $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/%%'"; - $query = sprintf($query, sql_table('template_desc')); - $show = array( - 'content' => 'shortnames' - ); - Showlist($query, 'table', $show, $templateName); - break; + $skin = new Skin($skinid); + $tag = 'skinvar'; + } + else + { + $skin = new Skin($skinid, 'AdminActions'); + $tag = 'adminskinvar'; + } + + $actions = $skin->getAllowedActionsForType($type); + sort($actions); + + while ( $current = array_shift($actions) ) + { + echo helplink("{$tag}-{$current}") . "$current\n"; + + if ( count($actions) != 0 ) + { + echo ", "; + } } return; } /** - * AdminActions::parse_adminskinielist() - * Parse skinvar adminskinielist - * - * @param string $type skin/template - * @param string $templateName name of template to use + * AdminActions::parse_banlistdeletedlist() + * Parse skinvar banlistdeletedlist + * + * @param string $template_name name of template to use * @return void */ - public function parse_adminskinielist($type, $templateName = '') + public function parse_banlistdeletedlist($template_name = '') { global $manager; - + $templates = array(); - if ( $templateName ) + if ( $template_name ) { - $templates =& $manager->getTemplate($templateName); + $templates =& $manager->getTemplate($template_name); } - - if ( !array_key_exists('SKINIE_EXPORT_LIST', $templates) || empty($templates['SKINIE_EXPORT_LIST']) ) + + if ( !array_key_exists('BANLIST_DELETED_LIST', $templates) || empty($templates['BANLIST_DELETED_LIST']) ) { - $template = "" - . "\" id=\"<%expid%>\" />\n" - . "" - . "\n" - . "<%expdesc%>\n" - . "\n" - . "\n"; + $template = "
  • <%blogname%>
  • \n"; } else { - $template = $templates['SKINIE_EXPORT_LIST']; + $template = $templates['BANLIST_DELETED_LIST']; } - - switch ( $type ) + + $deleted = requestArray('delblogs'); + foreach ( $deleted as $delblog ) { - case 'skin': - $query = "SELECT * FROM %s WHERE sdname LIKE 'admin/%%';"; - $query = sprintf($query, sql_table('skin_desc')); - $res = DB::getResult($query); - - foreach ( $res as $row ) - { - $data = array( - '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 = sprintf($query, sql_table('template_desc')); - $res = DB::getResult($query); - foreach ( $res as $row ) - { - $data = array( - 'typeid' => 'template[' . $row['tdnumber'] . ']', - 'expid' => 'templateexp' . $row['tdnumber'], - 'expname' => Entity::hsc($row['tdname']), - 'expdesc' => Entity::hsc($row['tddesc']), - ); - echo Template::fill($template, $data); - } - break; + $blog =& $manager->getBlog($delblog); + $data = array( + 'blogname' => Entity::hsc($blog->getName()) + ); + echo Template::fill($template, $data); } - return; - } - /** - * AdminActions::parse_adminskinoverview() - * Parse skinvar adminskinoverview - * - * @param string $templateName name of template to use - * @return void - */ - public function parse_adminskinoverview($templateName = '') - { - $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->parser->skin->getAvailableTypes(); - Showlist($query, 'table', $template, $templateName); return; } /** - * AdminActions::parse_adminskinselectoptions() - * Parse skinvar adminskinselectoptions - * + * AdminActions::parse_batchdeletelist() + * Parse skinvar batchdeletelist + * * @param void * @return void - */ - public function parse_adminskinselectoptions($templateName = '') - { - global $CONF; - $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['AdminSkin']; - $template['tabindex'] = 110; - Showlist($query, 'select', $template, $templateName); - return; - } - - /** - * AdminActions::parse_adminspecialskinlist() - * Parse skinvar adminspecialskinlist - * - * @param string $templateName name of template to use */ - public function parse_adminspecialskinlist($templateName = '') + public function parse_batchdeletelist() { - global $manager; - - $templates = array(); - if ( $templateName ) + $selected = requestIntArray('batch'); + $index = 0; + + foreach ( $selected as $select ) + { + echo '\n"; + } + // add hidden vars for team & comment + if ( requestVar('action') == 'batchteam' ) { - $templates =& $manager->getTemplate($templateName); + echo '\n"; } - - $nType = $this->parser->skin->getDefaultTypes(); - $types = self::$default_skin_types; - unset($types['memberedit']); - unset($types['login']); - $nType = array_keys($types); - $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 = DB::getResult($query); - if ( $res && $res->rowCount() > 0 ) + if ( requestVar('action') == 'batchcomment' ) { - /* NOTE: set templates for HEAD/BODY/FOOT */ - if ( !array_key_exists('ADMIN_SPECIALSKINLIST_HEAD', $templates) || empty($templates['ADMIN_SPECIALSKINLIST_HEAD']) ) - { - $template['head'] = "
      \n"; - } - else - { - $template['head'] = $templates['ADMIN_SPECIALSKINLIST_HEAD']; - } - if ( !array_key_exists('ADMIN_SPECIALSKINLIST_BODY', $templates) || empty($templates['ADMIN_SPECIALSKINLIST_BODY']) ) - { - $template['body'] = '
    • ' - . '' - . '<%skintype%>' - . '' - . '(' - . 'remove' - . ')' - . "
    • \n"; - } - else - { - $template['body'] = $templates['ADMIN_SPECIALSKINLIST_BODY']; - } - if ( !array_key_exists('ADMIN_SPECIALSKINLIST_FOOT', $templates) || empty($templates['ADMIN_SPECIALSKINLIST_FOOT']) ) - { - $template['foot'] = "
    \n"; - } - else - { - $template['foot'] = $templates['ADMIN_SPECIALSKINLIST_FOOT']; - } - - $tabstart = 120; - - /* NOTE: do echo */ - $data = array(); - echo $template['head']; - foreach ( $res as $row ) - { - $data = array( - 'tabindex' => $tabstart++, - 'skinid' => $skinid, - 'skintype' => Entity::hsc(strtolower($row['stype'])) - ); - echo Template::fill($template['body'], $data); - } - $data = array(); - echo $template['foot']; + echo '\n"; } return; } /** - * AdminActions::parse_admintemplateoverview() - * Parse skinvar admintemplateoverview - * - * @param string $templateName name of template to use + * AdminActions::parse_batchdeletetype() + * Parse skinvar batchdeletetype + * + * @param void * @return void */ - public function parse_admintemplateoverview($templateName = '') + public function parse_batchdeletetype() { - $query = "SELECT * FROM %s WHERE tdname LIKE 'admin/%%' ORDER BY tdname;"; - $query = sprintf($query, sql_table('template_desc')); - - $template['content'] = 'admintemplatelist'; - $template['tabindex'] = 10; - - Showlist($query, 'table', $template, $templateName); + echo Entity::hsc(requestVar('action')); return; } /** - * AdminActions::parse_allowedadminskinactions() - * Parse skinvar allowedadminskinactions - * + * AdminActions::parse_batchmovebtn() + * Parse skinvar batchmovebtn + * * @param void * @return void */ - public function parse_allowedadminskinactions() + public function parse_batchmovebtn() { - global $DIR_ADMINSKINS; - $skinType = strtolower(trim(requestVar('type'))); - $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') - { - continue; - } - - echo helplink("adminskinvar-{$current}") . "$current\n"; - - if ( count($actions) != 0 ) - { - echo ", "; - } - } - return; - } - - /** - * AdminActions::parse_allowedskinactions() - * Parse skinvar allowedskinactions - * - * @param void - * @return void - */ - public function parse_allowedskinactions() - { - $skinType = strtolower(trim(requestVar('type'))); - $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' ) - { - continue; - } - - /* TODO: alternative function should be used or not? */ - echo helplink("skinvar-{$current}") . "$current\n"; - - if ( count($actions) != 0 ) - { - echo ", "; - } - } - return; - } - - /** - * AdminActions::parse_banlistdeletedlist() - * Parse skinvar banlistdeletedlist - * - * @param string $templateName name of template to use - * @return void - */ - public function parse_banlistdeletedlist($templateName = '') - { - global $manager; - - $templates = array(); - if ( $templateName ) - { - $templates =& $manager->getTemplate($templateName); - } - - if ( !array_key_exists('BANLIST_DELETED_LIST', $templates) || empty($templates['BANLIST_DELETED_LIST']) ) - { - $template = "
  • <%blogname%>
  • \n"; - } - else - { - $template = $templates['BANLIST_DELETED_LIST']; - } - - $deleted = requestArray('delblogs'); - foreach ( $deleted as $delblog ) - { - $blog =& $manager->getBlog($delblog); - $data = array( - 'blogname' => Entity::hsc($blog->getName()) - ); - echo Template::fill($template, $data); - } - - return; - } - - /** - * AdminActions::parse_batchdeletelist() - * Parse skinvar batchdeletelist - * - * @param void - * @return void - */ - public function parse_batchdeletelist() - { - $selected = requestIntArray('batch'); - $index = 0; - - foreach ( $selected as $select ) - { - echo '\n"; - } - // add hidden vars for team & comment - if ( requestVar('action') == 'batchteam' ) - { - echo '\n"; - } - if ( requestVar('action') == 'batchcomment' ) - { - echo '\n"; - } - return; - } - - /** - * AdminActions::parse_batchdeletetype() - * Parse skinvar batchdeletetype - * - * @param void - * @return void - */ - public function parse_batchdeletetype() - { - echo Entity::hsc(requestVar('action')); - return; - } - - /** - * AdminActions::parse_batchmovebtn() - * Parse skinvar batchmovebtn - * - * @param void - * @return void - */ - public function parse_batchmovebtn() - { - $actionType = requestVar('action'); - switch ( $actionType ) + $actionType = requestVar('action'); + switch ( $actionType ) { case 'batchitem': echo _MOVE_BTN; @@ -1588,7 +1210,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_batchmovelist() * Parse skinvar batchmovelist - * + * * @param void * @param void */ @@ -1607,7 +1229,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_batchmovetitle() * Parse skinvar batchmovetitle - * + * * @param void * @return void */ @@ -1629,7 +1251,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_batchmovetype() * Parse skinvar batchmovetype - * + * * @param void * @return void */ @@ -1642,29 +1264,37 @@ class AdminActions extends BaseActions /** * AdminActions::parse_blogcatlist() * Parse skinvar blogcatlist - * + * * @param void * @return void */ - public function parse_blogcatlist($templateName = '') + public function parse_blogcatlist($template_name = '') { global $manager; $blogid = intRequestVar('blogid'); - $query = "SELECT * FROM %s WHERE cblog = %d ORDER BY cname;"; + $query = "SELECT * FROM %s WHERE cblog = %d ORDER BY cname;"; $query = sprintf($query, sql_table('category'), (integer) $blogid); - - $template['content'] = 'categorylist'; - $template['tabindex'] = 200; - - $batch = new Batch('category'); - $batch->showlist($query, 'table', $template, $templateName); + + $resource = DB::getResult($query); + if ( $resource->rowCount() > 0 ) + { + $template['content'] = 'categorylist'; + $template['tabindex'] = 200; + $this->parser->parse(listplug_batchlist('category', $resource, 'table', $template)); + } + else + { + /* TODO: nothing to be shown */ + } + $resource->closeCursor(); + return; } /** * AdminActions::parse_blogid() * Parse skinvar blogid - * + * * @param void * @return void */ @@ -1677,7 +1307,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_blognotifysetting() * Parse skinvar blognotifysetting - * + * * @param void * @return void */ @@ -1686,7 +1316,7 @@ class AdminActions extends BaseActions global $manager; $blogid = intRequestVar('blogid'); $blog =& $manager->getBlog($blogid); - + switch ( $type ) { case 'comment': @@ -1715,7 +1345,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_blogsetting() * Parse skinvar blogsetting - * + * * @param string $which name of weblog setting * @return void */ @@ -1728,18 +1358,18 @@ class AdminActions extends BaseActions /** * AdminActions::parse_blogsettingyesno() * Parse skinvar blogsettingyesno - * + * * @param string $type type of weblog setting - * @param string $templateName name of template to use + * @param string $template_name name of template to use * @return void */ - public function parse_blogsettingyesno($type, $templateName = '') + public function parse_blogsettingyesno($type, $template_name = '') { global $manager; - + $blogid = intRequestVar('blogid'); $blog =& $manager->getBlog($blogid); - + switch ( $type ) { case 'convertbreaks': @@ -1767,38 +1397,47 @@ class AdminActions extends BaseActions $tabindex = 122; break; } - $this->parse_inputyesno($type, $checkedval, $tabindex, 1, 0, _YES, _NO, 0, $templateName); + $this->parse_inputyesno($type, $checkedval, $tabindex, 1, 0, _YES, _NO, 0, $template_name); return; } /** * AdminActions::parse_blogteamlist() * Parse skinvar blogteamlist - * - * @param string $templateName name of template to use + * + * @param string $template_name name of template to use * @return void */ - public function parse_blogteamlist($templateName = '') + public function parse_blogteamlist($template_name = '') { global $manager; $blogid = intRequestVar('blogid'); - $query = "SELECT tblog, tmember, mname, mrealname, memail, tadmin " - . "FROM %s, %s " - . "WHERE tmember=mnumber AND tblog= %d"; + $query = "SELECT tblog, tmember, mname, mrealname, memail, tadmin " + . "FROM %s, %s " + . "WHERE tmember=mnumber AND tblog= %d"; $query = sprintf($query, sql_table('member'), sql_table('team'), (integer) $blogid); - $template['content'] = 'teamlist'; - $template['tabindex'] = 10; - - $batch = new Batch('team'); - $batch->showList($query, 'table', $template, $templateName, _LISTS_NOMORE); + $resource = DB::getResult($query); + if ( $resource->rowCount() > 0 ) + { + $template['content'] = 'teamlist'; + $template['tabindex'] = 10; + + $this->parser->parse(listplug_batchlist('team', $resource, 'table', $template)); + } + else + { + echo _LISTS_NOMORE; + } + $resource->closeCursor(); + return; } /** * AdminActions::parse_blogteammembers() * Parse skinvar blogteammembers - * + * * @param void * @return void */ @@ -1806,8 +1445,8 @@ class AdminActions extends BaseActions { $blogid = intRequestVar('blogid'); $query = "SELECT mname, mrealname " - . "FROM %s, %s " - . "WHERE mnumber=tmember AND tblog=%d;"; + . "FROM %s, %s " + . "WHERE mnumber=tmember AND tblog=%d;"; $query = sprintf($query, sql_table('member'), sql_table('team'), (integer) $blogid); $res = DB::getResult($query); $memberNames = array(); @@ -1821,7 +1460,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_blogtime() * Parse skinvar blogtime - * + * * @param string $type type of time * @param string $format format for time expression * @param integer $offset offset of time @@ -1830,7 +1469,7 @@ class AdminActions extends BaseActions public function parse_blogtime($type, $format = '%H:%M', $offset = 0) { global $manager; - + if ( $type != 'blogtime' ) { /* return server time */ @@ -1850,7 +1489,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_bookmarkletadmin() * Parse skinvar bookmarkletadmin - * + * * @param void * @return void */ @@ -1863,24 +1502,24 @@ class AdminActions extends BaseActions 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 */ public function parse_categories($startidx = 0) { global $manager; - + $item = FALSE; $itemid = intRequestVar('itemid'); $item = &$manager->getItem($itemid, 1, 1); - + $blog = FALSE; if ( !$item ) { @@ -1891,19 +1530,19 @@ class AdminActions extends BaseActions $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 @@ -1914,16 +1553,16 @@ class AdminActions extends BaseActions // on edit item $catid = $contents['catid']; } - + $this->selectBlog('catid', 'category', $catid, $startidx, 1, $blog->getID()); - + return; } /** * AdminActions::parse_category() * Parse skinvar category - * + * * @param string $type name of setting for category * @return void */ @@ -1936,7 +1575,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_categorysetting() * Parse skinvar categorysetting - * + * * @param string $type type in category setting * @return void */ @@ -1952,7 +1591,7 @@ class AdminActions extends BaseActions $query = "SELECT * FROM %s WHERE cblog = %d AND catid = %d;"; $query = sprintf($query, sql_table('category'), (integer) $blogid, (integer) $catid); $row = DB::getRow($query); - + if ( $type != 'name' ) { echo Entity::hsc($row['cdesc']); @@ -1961,34 +1600,34 @@ class AdminActions extends BaseActions { echo Entity::hsc($row['cname']); } - + return; } /** * AdminActions::parse_codename() * Parse templatevar codename - * + * * @param $value * @param $name - * + * */ public function parse_checkedonval($value, $name) { global $manager; - + $item = false; $itemid = intRequestVar('itemid'); $item =& $manager->getItem($itemid, 1, 1); - + $blog =& $manager->getBlog(getBlogIDFromItemID($itemid)); - + if ( $item && $blog->convertBreaks() && requestVar('action') == 'itemedit' ) { $item['body'] = removeBreaks($item['body']); $item['more'] = removeBreaks($item['more']); } - + $contents = array(); if ( requestVar('action') == 'itemedit' ) { @@ -2008,10 +1647,10 @@ class AdminActions extends BaseActions /** * AdminActions::parse_codename() * Parse templatevar codename - * + * * @param void * @return void - * + * * TODO: is this need??? */ public function parse_codename() @@ -2024,14 +1663,14 @@ class AdminActions extends BaseActions /** * AdminActions::parse_commentnavlist() * Parse skinvar commentnavlist - * + * * @param void * @return void */ public function parse_commentnavlist() { global $CONF, $manager, $member; - + // start index if ( postVar('start') ) { @@ -2041,7 +1680,7 @@ class AdminActions extends BaseActions { $start = 0; } - + // amount of items to show if ( postVar('amount') ) { @@ -2056,11 +1695,11 @@ class AdminActions extends BaseActions } } $query = 'SELECT cbody, cuser, cmail, cemail, mname, ctime, chost, cnumber, cip, citem ' - . 'FROM %s ' - . 'LEFT OUTER JOIN %s ON mnumber=cmember ' - . 'WHERE '; + . 'FROM %s ' + . 'LEFT OUTER JOIN %s ON mnumber=cmember ' + . 'WHERE '; $query = sprintf($query, sql_table('comment'), sql_table('member')); - + if ( $this->skintype == 'itemcommentlist' ) { $itemid = intRequestVar('itemid'); @@ -2085,26 +1724,44 @@ class AdminActions extends BaseActions $bid = intRequestVar('blogid'); $nonComments = _NOCOMMENTS_BLOG; } - + $search = postVar('search'); if ( !empty($search) ) { $query .= ' and cbody LIKE ' . DB::quoteValue('%'.$search.'%'); } - + $query .= " ORDER BY ctime ASC LIMIT {$start},{$amount}"; - - $template['content'] = 'commentlist'; - - $navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $bid, $search, $itemid); - $navList->showBatchList('comment', $query, 'table', $template, $nonComments); + + $resource = DB::getResult($query); + if ( $resource->rowCount() > 0 ) + { + $template['action'] = $this->skintype; + $template['start'] = $start; + $template['amount'] = $amount; + $template['minamount'] = 0; + $template['maxamount'] = 1000; + $template['blogid'] = $bid; + $template['search'] = $search; + $template['itemid'] = $itemid; + + $template['content'] = 'commentlist'; + + $this->parser->parse(listplug_navlist('comment', $query, 'table', $template)); + } + else + { + /* TODO: nothing to be shown */ + } + $resource->closeCursor(); + return; } /** * AdminActions::parse_configsettingsedit() * Parse skinvar configsettingsedit - * + * * @param string $type type of global configuration * @return void */ @@ -2152,7 +1809,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_configsettingsyesno() * Parse skinvar configsettingsyesno - * + * * @param string $type type of global setting * @param integer $tabindex tabindex attribute of input element * @return void @@ -2170,7 +1827,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_contents() * Parse skinvar contents - * + * * @param string $which part for item * @return void */ @@ -2186,7 +1843,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_currenttime() * Parse skinvar currenttime - * + * * @param string $what */ // for future items @@ -2199,7 +1856,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_customhelplink() * Parse skinvar customhelplink - * + * * @param string $topic name of topic * @param string $tplName name of template * @param string $url string as URI @@ -2227,177 +1884,151 @@ class AdminActions extends BaseActions } /** - * AdminActions::parse_defaultadminskintypes() + * AdminActions::parse_normalskinlist() * Parse skinvar defaultadminskintypes - * - * @param string $tabindex index number for tabindex attribute of input element - * @param string $templateName name of template + * + * @param string $template_name name of template * @return void */ - public function parse_defaultadminskintypes($tabindex, $templateName = '') + public function parse_normalskinlist($template_name = '') { - global $manager; - - $templates = array(); - - if ( $templateName ) - { - $templates =& $manager->getTemplate($templateName); - } - - $types = self::$default_skin_types; - unset($types['memberedit']); - unset($types['login']); - ksort($types); - - /* NOTE: set templates for HEAD/BODY/FOOT */ - if ( !array_key_exists('ADMINSKINTYPELIST_HEAD', $templates) || empty($templates['ADMINSKINTYPELIST_HEAD']) ) - { - $template['head'] = "
      \n"; - } - else - { - $template['head'] = $templates['ADMINSKINTYPELIST_HEAD']; - } - if ( !array_key_exists('ADMINSKINTYPELIST_BODY', $templates) || empty($templates['ADMINSKINTYPELIST_BODY']) ) - { - $template['body'] = "
    • " - . "\" href=\"index.php?action=adminskinedittype&skinid=<%skinid%>&type=<%skintype%>\"><%name%> <%help%>" - . "
    • \n"; - } - else - { - $template['body'] = $templates['ADMINSKINTYPELIST_BODY']; - } - if ( !array_key_exists('ADMINSKINTYPELIST_FOOT', $templates) || empty($templates['ADMINSKINTYPELIST_FOOT']) ) + global $CONF, $manager; + + if ( !preg_match('#^admin#', $this->skintype) ) { - $template['foot'] = "
    \n"; + $skin = new Skin($CONF['BaseSkin']); + /* TODO: removeaction? */ + $template['editaction'] = 'skinedittype'; } else { - $template['foot'] = $templates['ADMINSKINTYPELIST_FOOT']; + $skin = new Skin($CONF['AdminSkin'], 'AdminActions'); + $template['editaction'] = 'adminskinedittype'; + /* TODO: removeaction? */ } - - $handler = new AdminActions('template'); - $parser = new PARSER($handler); - - /* NOTE: do output */ - echo $template['head']; - foreach ( $types as $type => $fName ) + + $temporary = $skin->getDefaultTypes(); + $normal_skintype = array(); + foreach ( $temporary as $type => $label ) { - $helplink = $this->customHelpHtml("skinpart{$type}{$templateName}"); - $data = array( - 'tabindex' => $tabindex, - 'skintype' => $type, - 'name' => $fName, - 'help' => $helplink, - 'skinid' => intrequestVar('skinid'), + $normal_skintype[] = array( + 'skintype' => $type, + 'skintypename' => $label ); - $parser->parse(Template::fill($template['body'], $data)); - $tabindex++; } - echo $template['foot']; - + + $template['tabindex'] = 10; + $template['skinid'] = $skin->getID(); + $template['skinname'] = $skin->getName(); + $this->parser->parse(showlist($normal_skintype, 'list_normalskinlist', $template, $template_name)); + return; } /** * AdminActions::parse_defblogselect() * Parse skinvar defblogselect - * - * @param string $templateName name of template + * + * @param string $template_name name of template * @return void */ - public function parse_defblogselect($templateName = '') + public function parse_defblogselect($template_name = '') { global $CONF; - + $query = "SELECT bname as text, bnumber as value FROM %s;"; $query = sprintf($query, sql_table('blog')); - + $template['name'] = 'DefaultBlog'; $template['selected'] = $CONF['DefaultBlog']; $template['tabindex'] = 10; - - Showlist($query, 'select', $template, $templateName); - + $this->parser->parse(showlist($query, 'select', $template, $template_name)); + return; } /** * AdminActions::parse_defcatselect() * Parse skinvar defcatselect - * - * @param string $templateName name of template + * + * @param string $template_name name of template * @return void */ - public function parse_defcatselect($templateName = '') + public function parse_defcatselect($template_name = '') { global $manager; - + $blogid = intRequestVar('blogid'); $blog =& $manager->getBlog($blogid); - + $query = "SELECT cname as text, catid as value FROM %s WHERE cblog=%d;"; $query = sprintf($query, sql_table('category'), (integer) $blog->getID()); - + $template['name'] = 'defcat'; $template['selected'] = $blog->getDefaultCategory(); $template['tabindex'] = 110; - - Showlist($query, 'select', $template, $templateName); - + + $this->parser->parse(showlist($query, 'select', $template, $template_name)); + return; } /** * AdminActions::parse_defskinselect() * Parse skinvar defskinselect - * + * * @param string $type type of skin - * @param string $templateName name of template + * @param string $template_name name of template * @return void */ - public function parse_defskinselect($type = 'blog', $templateName = '') + public function parse_defskinselect($type = 'blog', $template_name = '') { - 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 ) - { - $template['selected'] = $CONF['BaseSkin']; - } - else - { - $blog =& $manager->getBlog($blogid); - $template['selected'] = $blog->getDefaultSkin(); - } - - if ( $type != 'blog' ) + global $CONF, $manager, $member; + + if ( !preg_match('#^admin#', $this->skintype) ) { - $nname = 'BaseSkin'; + $blogid = intRequestVar('blogid'); + if ( !$blogid ) + { + $template['selected'] = $CONF['BaseSkin']; + } + else + { + $blog =& $manager->getBlog($blogid); + $template['selected'] = $blog->getDefaultSkin(); + } + + if ( $type != 'blog' ) + { + $template['name'] = 'BaseSkin'; + } + else + { + $template['name'] = 'defskin'; + } + + $query = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdname NOT LIKE 'admin/%%';"; } else { - $nname = 'defskin'; + /* TODO: member object will have its own adminskin id */ + $template['selected'] = $CONF['AdminSkin']; + $template['name'] = 'AdminSkin'; + $query = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdname LIKE 'admin/%%';"; } - - $template['name'] = $nname; + + $query = sprintf($query, sql_table('skin_desc')); $template['tabindex'] = 50; - - Showlist($query, 'select', $template, $templateName); - + + $this->parser->parse(showlist($query, 'select', $template, $template_name)); + return; } /** * AdminActions::parse_deletecomment() * Parse skinvar deletecomment - * + * * @param string $type type of infomation for comment * @return void */ @@ -2405,7 +2036,7 @@ class AdminActions extends BaseActions { $commentid = intRequestVar('commentid'); $comment = COMMENT::getComment($commentid); - + switch ( $type ) { case 'id': @@ -2431,28 +2062,28 @@ class AdminActions extends BaseActions /** * AdminActions::parse_deleteitembody() * Parse skinvar deleteitembody - * + * * @param void * @return void */ public function parse_deleteitembody() { global $manager; - + $itemid = intRequestVar('itemid'); $item =& $manager->getItem($itemid, 1, 1); - + $body = strip_tags($item['body']); - + echo Entity::hsc(shorten($body, 300, '...')); - + return; } /** * AdminActions::parse_deleteitemid() * Parse skinvar deleteitemid - * + * * @param void * @return void */ @@ -2465,137 +2096,38 @@ class AdminActions extends BaseActions /** * AdminActions::parse_deleteitemtitle() * Parse skinvar deleteitemtitle - * + * * @param void * @return void */ public function parse_deleteitemtitle() { global $manager; - + $itemid = intRequestVar('itemid'); $item =& $manager->getItem($itemid, 1, 1); - + echo Entity::hsc(strip_tags($item['title'])); - - return; - } - - /** - * AdminActions::parse_editadminskin() - * Parse skinvar editadminskin - * - * @param string $type type of skin setting - * @return void - */ - public function parse_editadminskin($type = 'id') - { - $skinid = intRequestVar('skinid'); - $skin = new Skin($skinid); - switch ( $type ) - { - case 'id': - echo intRequestVar('skinid'); - break; - case 'name': - echo Entity::hsc($skin->getName()); - break; - case 'desc': - echo Entity::hsc($skin->getDescription()); - break; - case 'type': - echo Entity::hsc($skin->getContentType()); - break; - case 'prefix': - echo Entity::hsc($skin->getIncludePrefix()); - break; - case 'mode': - $this->parse_inputyesno('inc_mode', $skin->getIncludeMode(), 120, 'skindir', 'normal', _PARSER_INCMODE_SKINDIR, _PARSER_INCMODE_NORMAL); - default: - break; - } - return; - } - - /** - * AdminActions::parse_editadminskintype() - * Parse skinvar editadminskintype - * - * @param string $type name of skin type - * @return void - */ - public function parse_editadminskintype($type = 'id') - { - global $CONF, $manager, $member; - - static $skin = NULL; - static $types = array(); - - if ( $skin == NULL ) - { - $skinid = intRequestVar('skinid'); - $skin = new Skin($skinid, 'AdminActions'); - $types = $skin->getDefaultTypes(); - } - - $stype = strtolower(trim(requestVar('type'))); - if ( empty($stype) ) - { - $stype = $type; - } - switch ( $type ) - { - case 'id': - echo $skin->getID(); - break; - case 'name': - echo Entity::hsc($skin->getName()); - break; - case 'desc': - echo Entity::hsc($skin->getDescription()); - break; - case 'type': - echo Entity::hsc($skin->getContentType()); - break; - case 'content': - echo Entity::hsc($skin->getContentFromDB($stype)); - break; - case 'skintype': - $friendly_name = !array_key_exists($stype, $types) ? ucfirst($stype) : $types[$stype]; - echo Entity::hsc($friendly_name); - break; - case 'skintyperaw': - echo Entity::hsc($stype); - break; - case 'prefix': - echo Entity::hsc($skin->getIncludePrefix()); - break; - case 'mode': - $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL; - echo Entity::hsc($incMode); - break; - default: - 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': @@ -2648,38 +2180,49 @@ class AdminActions extends BaseActions /** * AdminActions::parse_editmemberlist() * Parse skinvar editmemberlist - * - * @param string $templateName name of template + * + * @param string $template_name name of template * @return void */ - public function parse_editmemberlist($templateName = '') + public function parse_editmemberlist($template_name = '') { global $manager; // show list of members with actions - $query = 'SELECT * FROM '.sql_table('member'); - $template['content'] = 'memberlist'; - $template['tabindex'] = 10; + $query = 'SELECT * FROM %s;'; + $query = sprintf($query, sql_table('member')); + + $resource = DB::getResult($query); + if ( $resource->rowCount() > 0 ) + { + $template['content'] = 'memberlist'; + $template['tabindex'] = 10; + + $this->parser->parse(listplug_batchlist('member', $resource, 'table', $template)); + } + else + { + echo _LISTS_NOMORE; + } + $resource->closeCursor(); - $batch = new Batch('member'); - $batch->showList($query, 'table', $template, $templateName, _LISTS_NOMORE); return; } /** * AdminActions::parse_editmember() * Parse skinvar editmember - * + * * @param string $type type of information for member * @return string $tempateName name of template to use * @return void */ - public function parse_editmember($type = 'id', $templateName = '') + public function parse_editmember($type = 'id', $template_name = '') { global $CONF, $manager, $member; - + $memberid = intRequestVar('memberid'); $mem =& $manager->getMember($memberid); - + switch ( $type ) { case 'id': @@ -2713,16 +2256,16 @@ class AdminActions extends BaseActions echo Entity::hsc($mem->getURL()); break; case 'admin': - $this->parse_inputyesno('admin', $mem->isAdmin(), 60, 1, 0, _YES, _NO, 0, $templateName); + $this->parse_inputyesno('admin', $mem->isAdmin(), 60, 1, 0, _YES, _NO, 0, $template_name); break; case 'canlogin': - $this->parse_inputyesno('canlogin', $mem->canLogin(), 70, 1, 0, _YES, _NO, $mem->isAdmin(), $templateName); + $this->parse_inputyesno('canlogin', $mem->canLogin(), 70, 1, 0, _YES, _NO, $mem->isAdmin(), $template_name); break; case 'notes': echo Entity::hsc($mem->getNotes()); break; case 'autosave': - $this->parse_inputyesno('autosave', $mem->getAutosave(), 87, 1, 0, _YES, _NO, 0, $templateName); + $this->parse_inputyesno('autosave', $mem->getAutosave(), 87, 1, 0, _YES, _NO, 0, $template_name); break; default: break; @@ -2733,14 +2276,14 @@ class AdminActions extends BaseActions /** * AdminActions::parse_editpluginfo() * Parse skinvar editpluginfo - * + * * @param string $type type of plugin info * @return void */ public function parse_editpluginfo($type) { global $manager; - + $pid = intRequestVar('plugid'); switch ( $type ) { @@ -2757,63 +2300,63 @@ class AdminActions extends BaseActions /** * AdminActions::parse_editplugoptionslist() * Parse skinvar editplugoptionslist - * - * @param string $templateName name of template + * + * @param string $template_name name of template * @return void */ - public function parse_editplugoptionslist($templateName = '') + public function parse_editplugoptionslist($template_name = '') { global $manager; - + $pid = intRequestVar('plugid'); $aOptions = array(); $aOIDs = array(); - + $query = "SELECT * FROM %s WHERE ocontext='global' AND opid=%d ORDER BY oid ASC;"; $query = sprintf($query, sql_table('plugin_option_desc'), (integer) $pid); $resource = DB::getResult($query); - + foreach ( $resource as $row ) { - array_push($aOIDs, $row['oid']); + $aOIDs[] = $row['oid']; $aOptions[$row['oid']] = array( - 'oid' => $row['oid'], - 'value' => $row['odef'], - 'name' => $row['oname'], - 'description' => $row['odesc'], - 'type' => $row['otype'], - 'typeinfo' => $row['oextra'], - 'contextid' => 0 + 'oid' => $row['oid'], + 'value' => $row['odef'], + 'name' => $row['oname'], + 'description' => $row['odesc'], + 'type' => $row['otype'], + 'typeinfo' => $row['oextra'], + 'contextid' => 0 ); } - + // fill out actual values if ( count($aOIDs) > 0 ) { $query = 'SELECT oid, ovalue FROM %s WHERE oid in (%s)'; $query = sprintf($query, sql_table('plugin_option'), implode(',', $aOIDs)); - + $result = DB::getResult($query); - foreach ( $result as $row ) { $aOptions[$row['oid']]['value'] = $row['ovalue']; } } - + // call plugins $data = array( - 'context' => 'global', - 'plugid' => $pid, - 'options' => &$aOptions + 'context' => 'global', + 'plugid' => $pid, + 'options' => &$aOptions ); $manager->notify('PrePluginOptionsEdit', $data); - - $template['content'] = 'plugoptionlist'; - - $amount = Showlist($aOptions, 'table', $template, $templateName); - - if ( $amount == 0 ) + + if ( sizeof($aOptions) > 0 ) + { + $template['content'] = 'plugoptionlist'; + $this->parser->parse(showlist($aOptions, 'table', $template, $template_name)); + } + else { echo '

    ' . _ERROR_NOPLUGOPTIONS . "

    \n"; } @@ -2823,14 +2366,23 @@ class AdminActions extends BaseActions /** * AdminActions::parse_editskin() * Parse skinvar editskin - * + * * @param string $type type of skin * @return void */ public function parse_editskin($type = 'id') { $skinid = intRequestVar('skinid'); - $skin = new SKIN($skinid); + + if ( !preg_match('#^admin#', $this->skintype) ) + { + $skin = new SKIN($skinid); + } + else + { + $skin = new SKIN($skinid, 'AdminActions'); + } + switch ( $type ) { case 'id': @@ -2859,21 +2411,37 @@ class AdminActions extends BaseActions /** * AdminActions::parse_editskintype() * Parse skinvar editskintype - * + * * @param string $type name of type for skin type * @return void */ - public function parse_editskintype($type = 'id') + public function parse_editskintype($stype = 'id') { - global $CONF, $manager, $member; - $skinid = intRequestVar('skinid'); - $skin = new SKIN($skinid); - $fNames = $skin->getDefaultTypes(); - $sType = strtolower(trim(requestVar('type'))); - switch ( $type ) + static $skin = NULL; + static $types = array(); + + if ( $skin == NULL ) + { + $skinid = intRequestVar('skinid'); + + if ( !preg_match('#^admin#', $this->skintype) ) + { + $skin = new Skin($skinid); + } + else + { + $skin = new Skin($skinid, 'AdminActions'); + } + + $types = $skin->getDefaultTypes(); + } + + $type = strtolower(trim(requestVar('type'))); + + switch ( $stype ) { case 'id': - echo intRequestVar('skinid'); + echo $skin->getID(); break; case 'name': echo Entity::hsc($skin->getName()); @@ -2885,20 +2453,34 @@ class AdminActions extends BaseActions echo Entity::hsc($skin->getContentType()); break; case 'content': - echo Entity::hsc($skin->getContentFromDB($sType)); + echo Entity::hsc($skin->getContentFromDB($type)); break; case 'skintype': - $skinType = !array_key_exists($sType, $fNames) ? ucfirst($sType) : $fNames[$sType]; + if ( !array_key_exists($type, $types) ) + { + $skinType = ucfirst($type); + } + else + { + $skinType = $types[$type]; + } echo Entity::hsc($skinType); break; case 'skintyperaw': - echo Entity::hsc($sType); + echo Entity::hsc($type); break; case 'prefix': echo Entity::hsc($skin->getIncludePrefix()); break; case 'mode': - $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL; + if ( !$skin->getIncludeMode() != 'skindir' ) + { + $incMode = _PARSER_INCMODE_NORMAL; + } + else + { + $incMode = _PARSER_INCMODE_SKINDIR; + } echo Entity::hsc($incMode); break; default: @@ -2924,191 +2506,134 @@ class AdminActions extends BaseActions /** * AdminActions::parse_edittemplateinfo() * Parse skinvar edittemplateinfo - * - * @param string $type name of type for skin - * @param string $description description for skin - * @param string $name name of skin - * @param string $help - * @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, $desc = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '') + * + * @param string $format format to output + * @param string $typedesc type of template + * @param string $typename type name of template + * @param string $help help text + * @param string $tabindex index value for tabindex attribute of input element + * @param string $big textarea size + * @param string $tplt name of template to be filled + * @return boolean + */ + public function parse_edittemplateinfo($format, $typedesc = '', $typename = '', $help = '', $tabindex = 0, $big = 0, $template_name = '') { global $manager; - static $cache = array(); - - if ( !array_key_exists('id', $cache) ) + static $id = NULL; + static $name = NULL; + static $desc = NULL; + + if ( $id == NULL ) { - $cache['id'] = intRequestVar('templateid'); + $id = intRequestVar('templateid'); } - - if ( !array_key_exists('name', $cache) ) + + if ( $name == NULL ) { - $cache['name'] = Template::getNameFromId($cache['id']); + $name = Template::getNameFromId($id); } - - if ( !array_key_exists('desc', $cache) ) + + if ( $desc == NULL ) { - $cache['desc'] = Template::getDesc($cache['id']); + $desc = Template::getDesc($id); } - - $template =& $manager->getTemplate($cache['name']); - - switch ( $type ) + + $template =& $manager->getTemplate($name); + + switch ( $format ) { case 'id': - echo (integer) $cache['id']; + echo (integer) $id; break; case 'name': - echo Entity::hsc($cache['name']); + echo Entity::hsc($name); break; case 'desc': - echo Entity::hsc($cache['desc']); + echo Entity::hsc($desc); break; case 'extratemplate': $tabidx = 600; $pluginfields = array(); - $manager->notify('TemplateExtraFields', array('fields' => &$pluginfields)); - - $tmplt = array(); - if ( $desc ) + if ( !preg_match('#^admin/#', $this->skintype) ) { - $tmplt =& $manager->getTemplate($desc); - } - if ( !array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) || empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) ) - { - $base = "\n" - . "\n" - . '<%explugtplname%>' . "\n"; + $manager->notify('TemplateExtraFields', array('fields' => &$pluginfields)); } else { - $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME']; + $manager->notify('AdminTemplateExtraFields', array('fields' => &$pluginfields)); } - - foreach ( $pluginfields as $pfkey => $pfvalue ) + + foreach ( $pluginfields as $ptkey => $ptvalue ) { - $data = array('explugtplname' => Entity::hsc($pfkey)); - + $tmplt = array(); + if ( $desc ) + { + $tmplt =& $manager->getTemplate($desc); + } + + /* extra plugin field */ + if ( !array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) || empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) ) + { + $base = "\n" + . "\n" + . "<%explugtplname%>\n"; + } + else + { + $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME']; + } + $data = array( + 'explugtplname' => Entity::hsc($ptkey) + ); echo Template::fill($base, $data); - - foreach ( $pfvalue as $pffield => $pfdesc ) + + foreach ( $ptvalue as $ptname => $ptdesc ) { - $this->templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name); + if ( !array_key_exists($ptname, $template) ) + { + $content = ''; + } + else + { + $content = $template[$ptname]; + } + $this->parser->parse(listplug_templateEditRow($content, $ptdesc, $ptname, $help, $tabidx++, $big, $template_name)); + continue; } } 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; - static $cache = array(); - - if ( !array_key_exists('id', $cache) ) - { - $cache['id'] = intRequestVar('templateid'); - } - - if ( !array_key_exists('name', $cache) ) - { - $cache['name'] = Template::getNameFromId($cache['id']); - } - - if ( !array_key_exists('desc', $cache) ) - { - $cache['desc'] = Template::getDesc($cache['id']); - } - - $template =& $manager->getTemplate($cache['name']); - - switch ( $type ) - { - case 'id': - echo (integer) $cache['id']; - break; - case 'name': - echo Entity::hsc($cache['name']); - break; - case 'desc': - echo Entity::hsc($cache['desc']); - break; - case 'extratemplate': - $tabidx = 600; - $pluginfields = array(); - $manager->notify('AdminTemplateExtraFields', array('fields' => &$pluginfields)); - - $tmplt = array(); - if ( $desc ) - { - $tmplt =& $manager->getTemplate($desc); - } - if ( !array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) || empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) ) + $typedesc = defined($typedesc) ? constant($typedesc) : $typedesc; + $typename = defined($typename) ? constant($typename) : $typename; + + if ( !array_key_exists($typename, $template) ) { - $base = "\n" - . "\n" - . '<%explugtplname%>' . "\n"; + $content = ''; } 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); - } + $content = $template[$typename]; } - break; - default: - $desc = defined($desc) ? constant($desc) : $desc; - $name = defined($name) ? constant($name) : $name; - $this->templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt); + $this->parser->parse(listplug_templateEditRow($content, $typedesc, $typename, $help, $tabindex, $big, $template_name)); break; } + return; } /** * AdminActions::parse_eventformextra() * Parse skinvar eventformextra - * + * * @param string $type name of type for event form extra * @return void */ public function parse_eventformextra($type = 'activation') { global $manager; - + $data = array(); - + switch ( $type ) { case 'activation': @@ -3128,8 +2653,8 @@ class AdminActions extends BaseActions Admin::error(_ERROR_ACTIVATE); } $data = array( - 'type' => 'activation', - 'member' => $mem + 'type' => 'activation', + 'member' => $mem ); break; case 'membermailform-notloggedin': @@ -3147,14 +2672,14 @@ class AdminActions extends BaseActions public function parse_extrahead() { global $manager; - + $extrahead = Admin::getAdminextrahead(); - + $data = array( - 'extrahead' => &$extrahead, - 'action' => Admin::getAdminAction() +'extrahead' => &$extrahead, +'action' => Admin::getAdminAction() ); - + $manager->notify('AdminPrePageHead', $data); echo $extrahead; return; @@ -3164,14 +2689,14 @@ class AdminActions extends BaseActions * AdminActions::parse_member() * Parse skinvar member * (includes a member info thingie) - * + * * @param string $what which memberdata is needed * @return void */ public function parse_member($what) { global $memberinfo, $member, $CONF; - + // 1. only allow the member-details-page specific variables on member pages if ( $this->skintype == 'member' ) { @@ -3197,7 +2722,7 @@ class AdminActions extends BaseActions break; } } - + // 2. the next bunch of options is available everywhere, as long as the user is logged in if ( $member->isLoggedIn() ) { @@ -3255,7 +2780,7 @@ class AdminActions extends BaseActions * AdminActions::parse_sitevar() * Parse skinvar sitevar * (include a sitevar) - * + * * @param string $which * @return void */ @@ -3283,7 +2808,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_actionurl() * Parse $CONF; - * + * * @param void * @return void */ @@ -3301,7 +2826,7 @@ class AdminActions extends BaseActions public function parse_getblogsetting($which) { global $blog, $manager; - + if ( $blog ) { $b =& $blog; @@ -3314,7 +2839,7 @@ class AdminActions extends BaseActions { return; } - + switch ( $which ) { case 'id': @@ -3351,7 +2876,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_geteditpluginfo() * Parse skinvar geteditpluginfo - * + * * @param string $type name of setting for edit plugin info * @return void */ @@ -3375,7 +2900,7 @@ class AdminActions extends BaseActions * AdminActions::parse_getmember() * Parse skinvar getmember * (includes a member info thingie) - * + * * @param string $what name of setting for member * @return void */ @@ -3438,7 +2963,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_headmessage() * Parse skinvar headmessage - * + * * @param void * @return void */ @@ -3454,7 +2979,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_helplink() * Parse skinvar helplink - * + * * @param string $topic name of topic for help * @return void */ @@ -3470,7 +2995,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_helpplugname() * Parse skinvar helpplugname - * + * * @param void * @return void */ @@ -3484,7 +3009,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_ilistaddnew() * Parse skinvar ilistaddnew - * + * * @param void * @return void */ @@ -3501,7 +3026,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_importskininfo() * Parse skinvar importskininfo - * + * * @param string $type name of information for imported skin * @return void */ @@ -3539,24 +3064,22 @@ class AdminActions extends BaseActions } /** - * AdminActions::parse_inputyesno() - * Parse skinvar inputyesno - * + * AdminActions::parse_init() * some init stuff for all forms - * + * * @param void * @return void */ public function parse_init() { global $manager; - + $authorid = ''; if ( requestVar('action') == 'itemedit' ) { $authorid = Admin::$contents['authorid']; } - + Admin::$blog->insertJavaScriptInfo($authorid); return; } @@ -3564,21 +3087,21 @@ class AdminActions extends BaseActions /** * AdminActions::parse_inputyesno() * Parse skinvar inputyesno - * - * @param string $name - * @param string $checkedval - * @param string $tabindex - * @param string $value1 - * @param string $value2 - * @param string $yesval - * @param string $noval - * @param string $isAdmin - * @param string $templateName + * + * @param string $name + * @param string $checkedval + * @param string $tabindex + * @param string $value1 + * @param string $value2 + * @param string $yesval + * @param string $noval + * @param string $isAdmin + * @param string $template_name * @return void */ - public function parse_inputyesno($name, $checkedval, $tabindex = 0, $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO, $isAdmin = 0, $templateName = '') + public function parse_inputyesno($name, $checkedval, $tabindex = 0, $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO, $isAdmin = 0, $template_name = '') { - self::input_yesno($name, $checkedval, $tabindex, $value1, $value2, $yesval, $noval, $isAdmin, $templateName ); + $this->parser->parse(listplug_input_yesno($name, $checkedval, $tabindex, $value1, $value2, $yesval, $noval, $isAdmin, $template_name)); return; } @@ -3604,14 +3127,14 @@ class AdminActions extends BaseActions /** * AdminActions::parse_insplugoptcontent() * Parse skinvar insplugoptcontent - * + * * @param void * @return void */ public function parse_insplugoptcontent() { $option = Admin::getAdminaOption(); - + $meta = NucleusPlugin::getOptionMeta($option['typeinfo']); if ( array_key_exists('access', $meta) && $meta['access'] != 'hidden' ) { @@ -3625,7 +3148,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_iprangeinput() * Parse skinvar iprangeinput - * + * * @param void * @return void */ @@ -3651,20 +3174,20 @@ class AdminActions extends BaseActions /** * AdminActions::parse_itemnavlist() * Parse skinvar itemnavlist - * + * * @param void * @return void */ - public function parse_itemnavlist($templateName) + public function parse_itemnavlist($template_name) { global $CONF, $manager, $member; - + $query = "SELECT bshortname, cname, mname, ititle, ibody, inumber, idraft, itime" - . " FROM %s, %s, %s, %s" - . " WHERE iblog=bnumber AND iauthor=mnumber AND icat=catid"; - + . " FROM %s, %s, %s, %s" + . " WHERE iblog=bnumber AND iauthor=mnumber AND icat=catid"; + $query = sprintf($query, sql_table('item'), sql_table('blog'), sql_table('member'), sql_table('category')); - + if ( $this->skintype == 'itemlist' ) { $blog = FALSE; @@ -3679,10 +3202,10 @@ class AdminActions extends BaseActions $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 ( !$member->blogAdminRights($blogid) ) { @@ -3695,17 +3218,17 @@ class AdminActions extends BaseActions $blogid = 0; $template['now'] = time(); } - + // search through items $search = postVar('search'); - + if ( !empty($search) ) { $query .= ' AND ((ititle LIKE ' . DB::quoteValue('%'.$search.'%') . ') ' - . ' OR (ibody LIKE ' . DB::quoteValue('%'.$search.'%') . ') ' - . ' OR (imore LIKE ' . DB::quoteValue('%'.$search.'%') . '))'; + . ' OR (ibody LIKE ' . DB::quoteValue('%'.$search.'%') . ') ' + . ' OR (imore LIKE ' . DB::quoteValue('%'.$search.'%') . '))'; } - + if ( postVar('start') ) { $start = intPostVar('start'); @@ -3714,7 +3237,7 @@ class AdminActions extends BaseActions { $start = 0; } - + // amount of items to show if ( postVar('amount') ) { @@ -3728,50 +3251,68 @@ class AdminActions extends BaseActions $amount = 10; } } - + $query .= ' ORDER BY itime DESC' - . " LIMIT {$start},{$amount}"; - - $template['content'] = 'itemlist'; + . " LIMIT {$start},{$amount}"; + + $resource = DB::getResult($query); + if ( $resource->rowCount() > 0 ) + { + $template['action'] = $this->skintype; + $template['start'] = $start; + $template['amount'] = $amount; + $template['minamount'] = 0; + $template['maxamount'] = 1000; + $template['blogid'] = $blogid; + $template['search'] = $search; + $template['itemid'] = 0; + + $template['content'] = 'itemlist'; + + $this->parser->parse(listplug_navlist('item', $query, 'table', $template)); + } + else + { + /* TODO: nothing to be shown */ + } + $resource->closeCursor(); - $navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $blogid, $search, 0); - $navList->showBatchList('item', $query, 'table', $template, '', $templateName); return; } /** * AdminActions::parse_itemtime() * date change on edit item - * + * * @param string $key key of PHP's getDate() * @return void */ public function parse_itemtime($key) { global $manager; - + $item = false; $itemid = intRequestVar('itemid'); $item =& $manager->getItem($itemid, 1, 1); - + $blog =& $manager->getBlog(getBlogIDFromItemID($itemid)); - + if ( $item && $blog->convertBreaks() && requestVar('action') == 'itemedit' ) { $item['body'] = removeBreaks($item['body']); $item['more'] = removeBreaks($item['more']); } - + $contents = array(); if ( requestVar('action') == 'itemedit' ) { $contents = $item; - } + } elseif ( requestVar('action') == 'createitem' ) { $data = array( - 'contents' => &$contents, - 'blog' => &$this->blog + 'contents' => &$contents, + 'blog' => &$this->blog ); $manager->notify('PreAddItemForm', $data); } @@ -3783,7 +3324,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_jstoolbaroptions() * Parse skinvar jstoolbaroptions - * + * * @param void * @return void */ @@ -3791,11 +3332,11 @@ class AdminActions extends BaseActions { global $CONF; $options = array( - _SETTINGS_JSTOOLBAR_NONE, - _SETTINGS_JSTOOLBAR_SIMPLE, - _SETTINGS_JSTOOLBAR_FULL + _SETTINGS_JSTOOLBAR_NONE, + _SETTINGS_JSTOOLBAR_SIMPLE, + _SETTINGS_JSTOOLBAR_FULL ); - + $i = 1; foreach ( $options as $option ) { @@ -3809,16 +3350,16 @@ class AdminActions extends BaseActions /** * AdminActions::parse_localeselectoptions() * Parse skinvar localeselectoptions - * + * * @param void * @return void */ public function parse_localeselectoptions() { global $manager; - + $locales = i18n::get_available_locale_list(); - + $memid = intRequestVar('memberid'); if ( $memid ) { @@ -3878,20 +3419,20 @@ class AdminActions extends BaseActions /** * AdminActions::parse_listplugplugoptionrow() * Parse templatevar listplugplugoptionrow - * - * @param string $templateName name of template + * + * @param string $template_name name of template * @return void */ - public function parse_listplugplugoptionrow($templateName = '') + public function parse_listplugplugoptionrow($template_name = '') { - echo listplug_plugOptionRow(Admin::getAdminaOption(), $templateName); + echo listplug_plugOptionRow(Admin::getAdminaOption(), $template_name); return; } /** * AdminActions::parse_mediadirwarning() * Parse skinvar mediadirwarning - * + * * @param void * @return void */ @@ -3944,7 +3485,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_moveitemid() * Parse skinvar moveitemid - * + * * @param void * @return void */ @@ -3957,18 +3498,18 @@ class AdminActions extends BaseActions /** * AdminActions::parse_newestcompare() * Parse skinvar newestcompare - * + * * @param void * @return void */ 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 '
    '; @@ -3980,40 +3521,40 @@ class AdminActions extends BaseActions /** * AdminActions::parse_newmemberselect() * Parse skinvar newmemberselect - * - * @param string $templateName name of template to use + * + * @param string $template_name name of template to use * @return void */ - public function parse_newmemberselect($templateName = '') + public function parse_newmemberselect($template_name = '') { $blogid = intRequestVar('blogid'); - + $query = "SELECT tmember FROM %s WHERE tblog=%d;"; $query = sprintf($query, sql_table('team'), (integer) $blogid); $res = DB::getResult($query); - + $tmem = array(); - foreach ( $res as $row ) + foreach ( $res as $row ) { $tmem[] = intval($row['tmember']); } - + $query = "SELECT mname as text, mnumber as value FROM %s WHERE mnumber NOT IN (%s);"; $query = sprintf($query, sql_table('member'), implode(', ', $tmem)); - + $template = array( - 'name' => 'memberid', - 'tabindex' => 10000, - 'selected' => 0 - ); - Showlist($query, 'select', $template, $templateName); + 'name' => 'memberid', + 'tabindex' => 10000, + 'selected' => 0 + ); + $this->parser->parse(showlist($query, 'select', $template, $template_name)); return; } /** * AdminActions::parse_newpluginlist() * Parse skinvar newpluginlist - * + * * @param void * @return void */ @@ -4030,14 +3571,14 @@ class AdminActions extends BaseActions /** * AdminActions::parse_outputspecialdirs() * Parse skinvar outputspecialdirs - * + * * @param string $type type of setting for directory * @return void */ public function parse_outputspecialdirs($type) { global $DIR_MEDIA, $DIR_NUCLEUS; - + switch ( $type ) { case 'nucleusdir': @@ -4053,7 +3594,7 @@ class AdminActions extends BaseActions /** * AdminActions::parse_passrequestvars() * Parse skinvar passrequestvars - * + * * @param void * @return void */ @@ -4061,11 +3602,11 @@ class AdminActions extends BaseActions { $passvar = Admin::getAdminpassvar(); $oldaction = postVar('oldaction'); - + if ( ($oldaction != 'logout') - && ($oldaction != 'login') - && $passvar - && !postVar('customaction') ) + && ($oldaction != 'login') + && $passvar + && !postVar('customaction') ) { passRequestVars(); } @@ -4075,14 +3616,14 @@ class AdminActions extends BaseActions /** * AdminActions::parse_pluginextras() * Parse skinvar pluginextras - * + * * @param string $type type of plugin context * @return void */ public function parse_pluginextras($type = 'global') { global $manager; - + switch ( $type ) { case 'member': @@ -4097,14 +3638,14 @@ class AdminActions extends BaseActions break; case 'createaccount': $data = array( - 'type' => 'createaccount.php', - 'prelabel' => '', - 'postlabel' => '
    ', - 'prefield' => '', - 'postfield' => '

    ' - ); - $manager->notify('RegistrationFormExtraFields', $data); - break; + 'type' => 'createaccount.php', + 'prelabel' => '', + 'postlabel' => '
    ', + 'prefield' => '', + 'postfield' => '

    ' + ); + $manager->notify('RegistrationFormExtraFields', $data); + break; default: $manager->notify('GeneralSettingsFormExtras', array()); break; @@ -4115,18 +3656,18 @@ class AdminActions extends BaseActions /** * AdminActions::parse_pluginhelp() * Parse skinvar pluginhelp - * + * * @param void * @return void */ public function parse_pluginhelp() { global $manager, $DIR_PLUGINS; - + $plugid = intGetVar('plugid'); $plugName = $manager->getPluginNameFromPid($plugid); $plug =& $manager->getPlugin($plugName); - + if ( $plug->supportsFeature('HelpPage') > 0 ) { $helpfile = $DIR_PLUGINS . $plug->getShortName() . '/help.'; @@ -4149,34 +3690,34 @@ class AdminActions extends BaseActions /** * AdminActions::parse_pluginlistlist() * Parse skinvar pluginlistlist - * - * @param string $templateName name of template to use + * + * @param string $template_name name of template to use * @return void */ - public function parse_pluginlistlist($templateName = '') + public function parse_pluginlistlist($template_name = '') { $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); - + + $this->parser->parse(showlist($query, 'table', $template, $template_name)); + return; } /** * AdminActions::parse_pluginoptions() * Parse skinvar pluginoptions - * + * * @param string $type type of plugin option * @return void */ - public function parse_pluginoptions($context='global', $templateName='') + public function parse_pluginoptions($context='global', $template_name='') { global $itemid, $manager; - + switch ( $context ) { case 'member': @@ -4192,7 +3733,7 @@ class AdminActions extends BaseActions $contextid = $itemid; break; } - + /* Actually registererd plugin options */ $aIdToValue = array(); $query = "SELECT oid, ovalue FROM %s WHERE ocontextid=%d;"; @@ -4202,12 +3743,12 @@ class AdminActions extends BaseActions { $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 ) { @@ -4219,161 +3760,145 @@ class AdminActions extends BaseActions { $value = $aIdToValue[$row['oid']]; } - + $options[] = array( - 'pid' => $row['pid'], - 'pfile' => $row['pfile'], - 'oid' => $row['oid'], - 'value' => $value, - 'name' => $row['oname'], - 'description' => $row['odesc'], - 'type' => $row['otype'], - 'typeinfo' => $row['oextra'], - 'contextid' => $contextid, - 'extra' => '' - ); + 'pid' => $row['pid'], + 'pfile' => $row['pfile'], + 'oid' => $row['oid'], + 'value' => $value, + 'name' => $row['oname'], + 'description' => $row['odesc'], + 'type' => $row['otype'], + 'typeinfo' => $row['oextra'], + 'contextid' => $contextid, + 'extra' => '' + ); } - + $data = array( - 'context' => $context, - 'contextid' => $contextid, - 'options' => &$options +'context' => $context, +'contextid' => $contextid, +'options' => &$options ); $manager->notify('PrePluginOptionsEdit', $data); - + $template = array(); - if ( $templateName ) + if ( $template_name ) { - $templates =& $manager->getTemplate($templateName); + $templates =& $manager->getTemplate($template_name); if ( !array_key_exists('INSERT_PLUGOPTION_TITLE', $templates) || empty($templates['INSERT_PLUGOPTION_TITLE']) ) { $template['title'] = "" - . "<%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%>" - . "\n"; + . "<%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%>" + . "\n"; } else { $template['title'] = $templates['INSERT_PLUGOPTION_TITLE']; } - + if ( !array_key_exists('INSERT_PLUGOPTION_BODY', $templates) || empty($templates['INSERT_PLUGOPTION_BODY']) ) { $template['body'] = "" - . "<%listplugplugoptionrow%>" - . "\n"; + . "<%listplugplugoptionrow%>" + . "\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']); + $this->parser->parse($template['title']); } - + $meta = NucleusPlugin::getOptionMeta($option['typeinfo']); - + if ( @$meta['access'] != 'hidden' ) { - $parsed = $parser->parse($template['body']); + $parsed = $this->parser->parse($template['body']); } } - + return; } /** * AdminActions::parse_qmenuaddselect() * Parse skinvar qmanuaddselect - * - * @param string $templateName name of template to use + * + * @param string $template_name name of template to use * @return void */ - public function parse_qmenuaddselect($templateName = '') + public function parse_qmenuaddselect($template_name = '') { - global $member; + global $member, $blogid; $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 ' . sql_table('blog') - . ' ORDER BY bname'; + $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 ' . sql_table('blog') . ', ' . sql_table('team') - . ' WHERE tblog=bnumber and tmember=' . $member->getID() - . ' ORDER BY bname'; + $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['selected'] = 0; $template['shorten'] = 10; $template['shortenel'] = ''; $template['javascript'] = 'onchange="return form.submit()"'; - - Showlist($query, 'select', $template, $templateName); - + + $this->parser->parse(showlist($query, 'select', $template, $template_name)); + return; } - + /** * AdminActions::parse_quickmenu() * Parse skinvar quickmenu - * - * @param string $templateName name of template to use + * + * @param string $template_name name of template to use * @return void */ - public function parse_quickmenu($templateName = '') + public function parse_quickmenu($template_name = '') { global $manager; $templates = array(); - $template = array(); - if ( !empty($templateName) ) + + if ( !empty($template_name) ) { - $templates = & $manager->getTemplate($templateName); + $templates = & $manager->getTemplate($template_name); } $pluginExtras = array(); - $manager->notify( - 'QuickMenu', - array( - 'options' => &$pluginExtras - ) - ); + $manager->notify('QuickMenu', array('options' => &$pluginExtras)); + + $template = array(); if ( count($pluginExtras) > 0 ) { - if ( !array_key_exists('PLUGIN_QUICKMENU_TITLE', $templates) || empty($templates['PLUGIN_QUICKMENU_TITLE']) ) - { - $template['title'] = "

    <%text(_QMENU_PLUGINS)%>

    \n"; - } - else - { - $template['title'] = $templates['PLUGIN_QUICKMENU_TITLE']; - } if ( !array_key_exists('PLUGIN_QUICKMENU_HEAD', $templates) || empty($templates['PLUGIN_QUICKMENU_HEAD']) ) { - $template['head'] = "
    \n"; } - + echo "
    \n"; echo 'Nucleus CMS © 2002-' . date('Y') . ' ' . _ADMINPAGEFOOT_COPYRIGHT; echo '-'; echo '' . _ADMINPAGEFOOT_DONATE . "\n"; echo "
    \n"; - + echo "
    \n"; - + if ( ($action != 'showlogin') && ($member->isLoggedIn()) ) { echo "\n"; - + echo '

    ' . _QMENU_ADD . "

    \n"; echo "
    \n"; echo "

    \n"; echo "\n"; - + $showAll = requestVar('showall'); - + if ( ($member->isAdmin()) && ($showAll == 'yes') ) { // Super-Admins have access to all blogs! (no add item support though) @@ -5885,22 +5255,22 @@ class AdminActions extends BaseActions $template['name'] = 'blogid'; $template['tabindex'] = 15000; $template['extra'] = _QMENU_ADD_SELECT; - $template['selected'] = -1; + $template['selected'] = $blogid; $template['shorten'] = 10; $template['shortenel'] = ''; $template['javascript'] = 'onchange="return form.submit()"'; - showlist($query, 'select', $template); - + $this->parser->parse(showlist($query, 'select', $template)); + echo "

    \n"; echo "
    \n"; - + echo "

    {$member->getDisplayName()}

    \n"; echo "\n"; - + if ( $member->isAdmin() ) { echo '

    ' . _QMENU_MANAGE . "

    \n"; @@ -5913,7 +5283,7 @@ class AdminActions extends BaseActions echo '
  • ' . _QMENU_MANAGE_BACKUPS . "
  • \n"; echo '
  • ' . _QMENU_MANAGE_PLUGINS . "
  • \n"; echo "\n"; - + echo "

    " . _QMENU_LAYOUT . "

    \n"; echo "\n"; } - + $data = array('options' => array()); - $manager->notify('QuickMenu', $data); - + if ( count($data['options']) > 0 ) { echo "

    " . _QMENU_PLUGINS . "

    \n"; @@ -5939,26 +5308,26 @@ class AdminActions extends BaseActions } else if ( ($action == 'activate') || ($action == 'activatesetpwd') ) { - + echo '

    ' . _QMENU_ACTIVATE . '

    ' . _QMENU_ACTIVATE_TEXT; } else { echo '

    ' . _QMENU_INTRO . '

    ' . _QMENU_INTRO_TEXT; } - + echo "\n"; echo "
    \n"; - + echo "\n"; echo "
    \n"; - + echo "\n"; echo "\n"; - + echo "\n"; echo "\n"; - + echo "\n"; echo "\n"; } @@ -5967,7 +5336,7 @@ class AdminActions extends BaseActions $this->parser->parse($content); exit; } - + return; } /** @@ -5976,11 +5345,11 @@ class AdminActions extends BaseActions * 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 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 @@ -5990,14 +5359,14 @@ class AdminActions extends BaseActions 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;"; @@ -6008,7 +5377,7 @@ class AdminActions extends BaseActions $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 ) { @@ -6095,4 +5464,4 @@ class AdminActions extends BaseActions echo "\n"; return; } -} +} \ No newline at end of file diff --git a/nucleus/libs/ENCAPSULATE.php b/nucleus/libs/ENCAPSULATE.php deleted file mode 100644 index 93a465b..0000000 --- a/nucleus/libs/ENCAPSULATE.php +++ /dev/null @@ -1,287 +0,0 @@ - 0 ) - { - $this->showHead($templateName); - echo $list; - $this->showFoot($templateName); - } - else - { - echo $errorMessage; - } - - return $nbOfRows; - } -} - -/** - * A class used to encapsulate a list of some sort inside next/prev buttons - */ -class NavList extends Encapsulate -{ - function __construct($action, $start, $amount, $minamount, $maxamount, $blogid, $search, $itemid) - { - $this->action = $action; - $this->start = $start; - $this->amount = $amount; - $this->minamount = $minamount; - $this->maxamount = $maxamount; - $this->blogid = $blogid; - $this->search = $search; - $this->itemid = $itemid; - } - - function showBatchList($batchtype, $query, $type, $template, $errorMessage = _LISTS_NOMORE, $templateName = '') - { - $batch = new Batch($batchtype); - - $this->doEncapsulate( - array(&$batch, 'showlist'), - array(&$query, $type, $template, $templateName), - $errorMessage - ); - - } - - - function showHead() - { - $this->showNavigation(); - } - function showFoot() - { - $this->showNavigation(); - } - - /** - * Displays a next/prev bar for long tables - */ - function showNavigation() - { - $action = $this->action; - $start = $this->start; - $amount = $this->amount; - $minamount = $this->minamount; - $maxamount = $this->maxamount; - $blogid = $this->blogid; - $search = Entity::hsc($this->search); - $itemid = $this->itemid; - - $prev = $start - $amount; - if ( $prev < $minamount ) - { - $prev=$minamount; - } - - // maxamount not used yet - // if ($start + $amount <= $maxamount) - $next = $start + $amount; - // else - // $next = $start; - - ?> - - - - type = $type; - } - - function showHead($templateName = '') - { - ?> -
    - showOperationList(); - } - - function showFoot($templateName = '') - { - $this->showOperationList(); -?> -
    - -
    - - - - addTicketHidden(); - - // add hidden fields for 'team' and 'comment' batchlists - if ($this->type == 'team') - { - echo ''; - } - if ($this->type == 'comment') - { - echo ''; - } - - echo ''; - ?>( - - - - ) -
    - doEncapsulate( 'showlist', - array($query, $type, $template, $templateName), - $errorMessage - ); - } - -} -?> diff --git a/nucleus/libs/showlist.php b/nucleus/libs/showlist.php index 5a09e7e..efe6aab 100644 --- a/nucleus/libs/showlist.php +++ b/nucleus/libs/showlist.php @@ -19,61 +19,50 @@ // can take either an array of objects, or an SQL query -function showlist($query, $type, $vars, $templateName = '') +function showlist($query, $type, $vars, $template_name = '') { - if ( is_array($query) ) + $contents = ''; + + /* count */ + if ( is_string($query) ) { - if ( sizeof($query) == 0 ) - { - return 0; - } - - call_user_func("listplug_{$type}", $vars, 'HEAD', $templateName); - - foreach ( $query as $currentObj ) - { - $vars['current'] = $currentObj; - call_user_func("listplug_{$type}", $vars, 'BODY', $templateName); - } - - call_user_func("listplug_{$type}", $vars, 'FOOT', $templateName); - - return sizeof($query); + $resource = DB::getResult($query); } else { - $res = DB::getResult($query); - - // don't do anything if there are no results - $numrows = $res->rowCount(); - if ( $numrows == 0 ) - { - return 0; - } - call_user_func("listplug_{$type}", $vars, 'HEAD', $templateName); - - while( $vars['current'] = $res->fetchObject() ) - { - call_user_func("listplug_{$type}", $vars, 'BODY', $templateName); - } - - call_user_func("listplug_{$type}", $vars, 'FOOT', $templateName); - - $res->closeCursor(); - - // return amount of results - return $numrows; + $resource = $query; + } + + /* HEAD */ + $contents .= call_user_func("listplug_{$type}", $vars, 'HEAD', $template_name); + + /* BODY */ + foreach ( $resource as $row ) + { + $vars['current'] = $row; + $contents .= call_user_func("listplug_{$type}", $vars, 'BODY', $template_name); + } + + /* FOOT */ + $contents .= call_user_func("listplug_{$type}", $vars, 'FOOT', $template_name); + + /* close SQL resource */ + if ( is_string($query) ) + { + $resource->closeCursor(); } + + return $contents; } -function listplug_select($vars, $type, $templateName = '') +function listplug_select($vars, $type, $template_name = '') { - global $DIR_LIBS, $manager; + global $manager; $templates = array(); - if ( !empty($templateName) ) + if ( !empty($template_name) ) { - $templates =& $manager->getTemplate($templateName); + $templates =& $manager->getTemplate($template_name); } switch( $type ) @@ -81,7 +70,7 @@ function listplug_select($vars, $type, $templateName = '') case 'HEAD': if ( !array_key_exists('SHOWLIST_LISTPLUG_SELECT_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_SELECT_HEAD']) ) { - $template = "<%tabindex%><%javascript%>>\n" + $template = "\n" + . "\n"; + } + else + { + $template = $tmplt['TEMPLATE_EDIT_ROW_TAIL']; + } + $message .= TEMPLATE::fill($template, $data); + + return $message; +} + +function listplug_table_itemlist($vars, $type, $template_name = '') { global $manager; $cssclass = ''; $templates = array(); - if ( !empty($templateName) ) + if ( !empty($template_name) ) { - $templates =& $manager->getTemplate($templateName); + $templates =& $manager->getTemplate($template_name); } switch( $type ) @@ -991,7 +1029,7 @@ function listplug_table_itemlist($vars, $type, $templateName = '') case 'BODY': $current = $vars['current']; // string -> unix timestamp - $current->itime = strtotime($current->itime); + $current['itime'] = strtotime($current['itime']); if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY']) ) { $template = ">\n" @@ -1001,10 +1039,12 @@ function listplug_table_itemlist($vars, $type, $templateName = '') . "<%itemdatelabel%> <%itemdateval%>
    \n" . "<%itemtimelabel%> <%itemtimeval%>\n" . "\n" - . "\" name=\"batch[<%batchid%>]\" value=\"<%itemid%>\" />\n" + . ">\n" + . "\" name=\"batch[<%batchid%>]\" value=\"<%itemid%>\" />\n" . "
    \n" . "<%itembody%>\n" - . "" + . "\n" + . ">\n" . "\"><%editbtn%>
    \n" . "<%camount%>\n" . "\"><%movebtn%>
    \n" @@ -1016,48 +1056,48 @@ function listplug_table_itemlist($vars, $type, $templateName = '') $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY']; } $cssclass = ''; - - if ( $current->idraft == 1 ) + + if ( $current['idraft'] == 1 ) { $cssclass = ' class="draft"'; } // (can't use offset time since offsets might vary between blogs) - if ( $current->itime > $vars['now'] ) + if ( $current['itime'] > $vars['now'] ) { $cssclass = ' class="future"'; } - $body = strip_tags($current->ibody); + $body = strip_tags($current['ibody']); $data = array( 'cssclass' => $cssclass, 'bshortlabel' => _LIST_ITEM_BLOG, - 'bshortnameval' => Entity::hsc($current->bshortname), + 'bshortnameval' => Entity::hsc($current['bshortname']), 'categorylabel' => _LIST_ITEM_CAT, - 'categorynameval' => Entity::hsc($current->cname), + 'categorynameval' => Entity::hsc($current['cname']), 'authorlabel' => _LIST_ITEM_AUTHOR, - 'authornameval' => Entity::hsc($current->mname), + 'authornameval' => Entity::hsc($current['mname']), 'itemdatelabel' => _LIST_ITEM_DATE, - 'itemdateval' => date("Y-m-d",$current->itime), + 'itemdateval' => date("Y-m-d",$current['itime']), 'itemdatelabel' => _LIST_ITEM_TIME, - 'itemdateval' => date("H:i",$current->itime), + 'itemdateval' => date("H:i",$current['itime']), 'batchid' => listplug_nextBatchId(), - 'itemid' => $current->inumber, - 'itemtitle' => Entity::hsc(strip_tags($current->ititle)), + 'itemid' => $current['inumber'], + 'itemtitle' => Entity::hsc(strip_tags($current['ititle'])), 'itembody' => Entity::hsc(Entity::shorten($body, 300, '...')), 'editbtn' => _LISTS_EDIT, 'movebtn' => _LISTS_MOVE, 'delbtn' => _LISTS_DELETE, ); // evaluate amount of comments for the item - $comment = new Comments($current->inumber); + $comment = new Comments($current['inumber']); $camount = $comment->amountComments(); if ( $camount > 0 ) { - $data['camount'] = "inumber}\">(" . sprintf(_LIST_ITEM_COMMENTS, $comment->amountComments()) . ")
    \n"; + $data['camount'] = "(" . sprintf(_LIST_ITEM_COMMENTS, $comment->amountComments()) . ")
    \n"; } else { - $data['camount'] = _LIST_ITEM_NOCONTENT . "\n"; + $data['camount'] = _LIST_ITEM_NOCONTENT . "
    \n"; } break; case 'FOOT': @@ -1082,14 +1122,14 @@ function listplug_nextBatchId() return $id++; } -function listplug_table_commentlist($vars, $type, $templateName = '') +function listplug_table_commentlist($vars, $type, $template_name = '') { global $manager; $templates = array(); - if ( !empty($templateName) ) + if ( !empty($template_name) ) { - $templates =& $manager->getTemplate($templateName); + $templates =& $manager->getTemplate($template_name); } switch( $type ) @@ -1115,12 +1155,16 @@ function listplug_table_commentlist($vars, $type, $templateName = '') if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY']) ) { $template = "<%commentdate%>
    <%commentator%>
    <%commentsite%>
    <%commentmail%>
    \n" - . "\" name=\"batch[<%batchid%>]\" value=\"<%commentid%>\" />" - . "\n" - . "" - . "\"><%editbtn%>\n" - . "" - . "\"><%delbtn%>\n" + . "\n" + . "\" name=\"batch[<%batchid%>]\" value=\"<%commentid%>\" />" + . "\n" + . "\n" + . "\n" + . "\"><%editbtn%>\n" + . "\n" + . "\n" + . "\"><%delbtn%>\n" + . "\n" . "<%addbanlist%>"; } else @@ -1128,34 +1172,34 @@ function listplug_table_commentlist($vars, $type, $templateName = '') $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY']; } $current = $vars['current']; - $body = strip_tags($current->cbody); + $body = strip_tags($current['cbody']); $data = array( - 'commentdate' => date("Y-m-d@H:i", strtotime($current->ctime)), + 'commentdate' => date("Y-m-d@H:i", strtotime($current['ctime'])), 'batchid' => listplug_nextBatchId(), - 'commentid' => $current->cnumber, - 'commentbody' => Entity::hsc(Entity::shorten($current->cbody, 300, '...')), + 'commentid' => $current['cnumber'], + 'commentbody' => Entity::hsc(Entity::shorten($current['cbody'], 300, '...')), 'editbtn' => _LISTS_EDIT, 'delbtn' => _LISTS_DELETE, ); - if ( isset($current->mname) ) + if ( isset($current['mname']) ) { - $data['commentator'] = Entity::hsc($current->mname) . ' ' . _LIST_COMMENTS_MEMBER; + $data['commentator'] = Entity::hsc($current['mname']) . ' ' . _LIST_COMMENTS_MEMBER; } else { - $data['commentator'] = Entity::hsc($current->cuser); + $data['commentator'] = Entity::hsc($current['cuser']); } - if ( isset($current->cmail) && $current->cmail ) + if ( isset($current['cmail']) && $current['cmail'] ) { - $data['commentsite'] = Entity::hsc($current->cmail); + $data['commentsite'] = Entity::hsc($current['cmail']); } else { $data['commentsite'] = ''; } - if ( isset($current->cemail) && $current->cemail ) + if ( isset($current['cemail']) && $current['cemail'] ) { - $data['commentmail'] = Entity::hsc($current->cemail); + $data['commentmail'] = Entity::hsc($current['cemail']); } else { @@ -1165,15 +1209,17 @@ function listplug_table_commentlist($vars, $type, $templateName = '') { if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN']) ) { - $subTpl = "&ip=<%banip%>\" title=\"<%banhost%>\"><%banbtn%>\n"; + $subTpl = "" + . "&ip=<%banip%>\" title=\"<%banhost%>\"><%banbtn%>" + . "\n"; } else { $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN']; } $subData = array( - 'itemid' => $current->citem, - 'banip' => Entity::hsc($current->cip), + 'itemid' => $current['citem'], + 'banip' => Entity::hsc($current['cip']), 'banbtn' => _LIST_COMMENT_BANIP, ); $data['addbanlist'] = Template::fill($subTpl, $subData); @@ -1194,14 +1240,14 @@ function listplug_table_commentlist($vars, $type, $templateName = '') return Template::fill($template, $data); } -function listplug_table_bloglist($vars, $type, $templateName = '') +function listplug_table_bloglist($vars, $type, $template_name = '') { global $manager; $templates = array(); - if ( !empty($templateName) ) + if ( !empty($template_name) ) { - $templates =& $manager->getTemplate($templateName); + $templates =& $manager->getTemplate($template_name); } switch( $type ) @@ -1237,10 +1283,10 @@ function listplug_table_bloglist($vars, $type, $templateName = '') $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY']; } $data = array( - 'blogid' => $current->bnumber, - 'shortname' => Entity::hsc($current->bshortname), - 'blogurl' => $current->burl, - 'blogname' => Entity::hsc($current->bname), + 'blogid' => $current['bnumber'], + 'shortname' => Entity::hsc($current['bshortname']), + 'blogurl' => $current['burl'], + 'blogname' => Entity::hsc($current['bname']), 'ttaddtext' => _BLOGLIST_TT_ADD, 'addtext' => _BLOGLIST_ADD, 'ttedittext' => _BLOGLIST_TT_EDIT, @@ -1250,12 +1296,12 @@ function listplug_table_bloglist($vars, $type, $templateName = '') 'ttbmlettext' => _BLOGLIST_TT_BMLET, 'bmlettext' => _BLOGLIST_BMLET, ); - if ( $current->tadmin == 1 ) + if ( $current['tadmin'] == 1 ) { if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) ) { $template .= "\" title=\"<%ttsettingtext%>\"><%settingtext%>\n" - . "\" title=\"<%ttbanstext%>\"><%banstext%>\n"; + . "\" title=\"<%ttbanstext%>\"><%banstext%>\n"; } else { @@ -1282,7 +1328,6 @@ function listplug_table_bloglist($vars, $type, $templateName = '') } break; case 'FOOT': - $current = $vars['current']; if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT']) ) { $template = "\n"; @@ -1297,14 +1342,14 @@ function listplug_table_bloglist($vars, $type, $templateName = '') return Template::fill($template, $data); } -function listplug_table_shortblognames($vars, $type, $templateName = '') +function listplug_table_shortblognames($vars, $type, $template_name = '') { global $manager; $templates = array(); - if ( !empty($templateName) ) + if ( !empty($template_name) ) { - $templates =& $manager->getTemplate($templateName); + $templates =& $manager->getTemplate($template_name); } switch( $type ) @@ -1336,8 +1381,8 @@ function listplug_table_shortblognames($vars, $type, $templateName = '') $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY']; } $data = array( - 'bshortname' => Entity::hsc($current->bshortname), - 'blogname' => Entity::hsc($current->bname), + 'bshortname' => Entity::hsc($current['bshortname']), + 'blogname' => Entity::hsc($current['bname']), ); break; case 'FOOT': @@ -1356,14 +1401,14 @@ function listplug_table_shortblognames($vars, $type, $templateName = '') return Template::fill($template, $data); } -function listplug_table_shortnames($vars, $type, $templateName = '') +function listplug_table_shortnames($vars, $type, $template_name = '') { global $manager; $templates = array(); - if ( !empty($templateName) ) + if ( !empty($template_name) ) { - $templates =& $manager->getTemplate($templateName); + $templates =& $manager->getTemplate($template_name); } switch( $type ) @@ -1395,8 +1440,8 @@ function listplug_table_shortnames($vars, $type, $templateName = '') $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY']; } $data = array( - 'name' => Entity::hsc($current->name), - 'desc' => Entity::hsc($current->description), + 'name' => Entity::hsc($current['name']), + 'desc' => Entity::hsc($current['description']), ); break; case 'FOOT': @@ -1415,14 +1460,14 @@ function listplug_table_shortnames($vars, $type, $templateName = '') return Template::fill($template, $data); } -function listplug_table_categorylist($vars, $type, $templateName = '') +function listplug_table_categorylist($vars, $type, $template_name = '') { global $manager; $templates = array(); - if ( !empty($templateName) ) + if ( !empty($template_name) ) { - $templates =& $manager->getTemplate($templateName); + $templates =& $manager->getTemplate($template_name); } switch( $type ) @@ -1463,10 +1508,10 @@ function listplug_table_categorylist($vars, $type, $templateName = '') $data = array( 'batchid' => listplug_nextBatchId(), - 'catid' => intval($current->catid), - 'catname' => Entity::hsc($current->cname), - 'catdesc' => Entity::hsc($current->cdesc), - 'blogid' => intval($current->cblog), + 'catid' => intval($current['catid']), + 'catname' => Entity::hsc($current['cname']), + 'catdesc' => Entity::hsc($current['cdesc']), + 'blogid' => intval($current['cblog']), 'tabindex' => intval($vars['tabindex']), 'editbtn' => _LISTS_EDIT, 'delbtn' => _LISTS_DELETE, @@ -1487,14 +1532,14 @@ function listplug_table_categorylist($vars, $type, $templateName = '') return Template::fill($template, $data); } -function listplug_table_templatelist($vars, $type, $templateName = '') +function listplug_table_templatelist($vars, $type, $template_name = '') { global $manager, $CONF; $templates = array(); - if ( !empty($templateName) ) + if ( !empty($template_name) ) { - $templates =& $manager->getTemplate($templateName); + $templates =& $manager->getTemplate($template_name); } switch( $type ) @@ -1537,22 +1582,23 @@ function listplug_table_templatelist($vars, $type, $templateName = '') $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY']; } - $deleteurl = "{$CONF['AdminURL']}index.php?action=templatedelete&templateid={$current->tdnumber}"; - $editurl = "{$CONF['AdminURL']}index.php?action=templateedit&templateid={$current->tdnumber}"; - $cloneurl = "{$CONF['AdminURL']}index.php?action=templateclone&templateid={$current->tdnumber}"; - $data = array( - 'templatename' => Entity::hsc($current->tdname), - 'templatedesc' => Entity::hsc($current->tddesc), - 'templateid' => (integer) $current->tdnumber, + 'templatename' => Entity::hsc($current['tdname']), + 'templatedesc' => Entity::hsc($current['tddesc']), + 'templateid' => (integer) $current['tdnumber'], 'tabindex' => (integer) $vars['tabindex'], - 'deleteurl' => Entity::hsc($manager->addTicketToUrl($deleteurl)), - 'editurl' => Entity::hsc($manager->addTicketToUrl($editurl)), - 'cloneurl' => Entity::hsc($manager->addTicketToUrl($cloneurl)), - 'editbtn' => _LISTS_EDIT, + 'clonebtn' => _LISTS_CLONE, + 'cloneaction' => $vars['cloneaction'], + 'cloneurl' => "{$CONF['AdminURL']}index.php?action={$vars['cloneaction']}&templateid={$current['tdnumber']}", + 'delbtn' => _LISTS_DELETE, - 'adminflg' => '', + 'deleteaction' => $vars['deleteaction'], + 'deleteurl' => "{$CONF['AdminURL']}index.php?action={$vars['deleteaction']}&templateid={$current['tdnumber']}", + + 'editbtn' => _LISTS_EDIT, + 'editaction' => $vars['editaction'], + 'editurl' => "{$CONF['AdminURL']}index.php?action={$vars['editaction']}&templateid={$current['tdnumber']}" ); break; case 'FOOT': @@ -1570,14 +1616,14 @@ function listplug_table_templatelist($vars, $type, $templateName = '') return Template::fill($template, $data); } -function listplug_table_skinlist($vars, $type, $templateName = '') +function listplug_table_skinlist($vars, $type, $template_name = '') { global $CONF, $DIR_SKINS, $manager; $templates = array(); - if ( !empty($templateName) ) + if ( !empty($template_name) ) { - $templates =& $manager->getTemplate($templateName); + $templates =& $manager->getTemplate($template_name); } switch( $type ) @@ -1611,73 +1657,78 @@ function listplug_table_skinlist($vars, $type, $templateName = '') . "<%readme%>\n" . "<%skindesc%><%skinparts%>\n" . "" - . "\" tabindex=\"<%tabindex%>\"><%editbtn%>" - . "\n" + . "\" tabindex=\"<%tabindex%>\"><%editbtn%>" + . "\n" . "" - . "\" tabindex=\"<%tabindex%>\"><%clonebtn%>" - . "\n" + . "\" tabindex=\"<%tabindex%>\"><%clonebtn%>" + . "\n" . "" - . "\" tabindex=\"<%tabindex%>\"><%delbtn%>" - . "\n"; + . "\" tabindex=\"<%tabindex%>\"><%delbtn%>" + . "\n"; } else { $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY']; } - $editurl = "{$CONF['AdminURL']}index.php?action=skinedit&skinid={$current->sdnumber}"; - $cloneurl = "{$CONF['AdminURL']}index.php?action=skinclone&skinid={$current->sdnumber}"; - $deleteurl = "{$CONF['AdminURL']}index.php?action=skindelete&skinid={$current->sdnumber}"; - $data = array( + 'tabindex' => $vars['tabindex']++, + + 'skinid' => (integer) $current['sdnumber'], + 'skindesc' => Entity::hsc($current['sddesc']), + 'skintypelabel' => _LISTS_TYPE, - 'skintype' => Entity::hsc($current->sdtype), + 'skintype' => Entity::hsc($current['sdtype']), + 'incmodelabel' => _LIST_SKINS_INCMODE, - 'incmode' => ($current->sdincmode == 'skindir') ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL, - 'incpreflabel' => ($current->sdincpref) ? _LIST_SKINS_INCMODE : '', - 'incpref' => ($current->sdincpref) ? Entity::hsc($current->sdincpref) : '', - 'skindesc' => Entity::hsc($current->sddesc), - 'skinid' => (integer) $current->sdnumber, - 'tabindex' => $vars['tabindex'], - 'editurl' => Entity::hsc($manager->addTicketToUrl($editurl)), - 'cloneurl' => Entity::hsc($manager->addTicketToUrl($cloneurl)), - 'deleteurl' => Entity::hsc($manager->addTicketToUrl($deleteurl)), + 'incmode' => ($current['sdincmode'] == 'skindir') ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL, + + 'incpreflabel' => ($current['sdincpref']) ? _LIST_SKINS_INCMODE : '', + 'incpref' => ($current['sdincpref']) ? Entity::hsc($current['sdincpref']) : '', + 'editbtn' => _LISTS_EDIT, + 'editaction' => $vars['editaction'], + 'editurl' => "{$CONF['AdminURL']}index.php?action={$vars['editaction']}&skinid={$current['sdnumber']}", + 'clonebtn' => _LISTS_CLONE, + 'cloneaction' => $vars['cloneaction'], + 'cloneurl' => "{$CONF['AdminURL']}index.php?action={$vars['cloneaction']}&skinid={$current['sdnumber']}", + 'delbtn' => _LISTS_DELETE, + 'deleteaction' => $vars['deleteaction'], + 'deleteurl' => "{$CONF['AdminURL']}index.php?action={$vars['deleteaction']}&skinid={$current['sdnumber']}" ); - // use a special style for the default skin - if ( $current->sdnumber != $CONF['BaseSkin'] ) + if ( $current['sdnumber'] != $vars['default'] ) { - $data['skinname'] = Entity::hsc($current->sdname); + $data['skinname'] = Entity::hsc($current['sdname']); } else { - $data['skinname'] = '' . Entity::hsc($current->sdname) . ''; + $data['skinname'] = '' . Entity::hsc($current['sdname']) . ''; } // add preview image when present - if ( $current->sdincpref && @file_exists("{$DIR_SKINS}{$current->sdincpref}preview.png") ) + if ( $current['sdincpref'] && @file_exists("{$DIR_SKINS}{$current['sdincpref']}preview.png") ) { $data['skinthumb'] = "

    \n"; - $alternatve_text = sprintf(_LIST_SKIN_PREVIEW, $current->sdname); - $has_enlargement = @file_exists($DIR_SKINS . $current->sdincpref . 'preview-large.png'); + $alternatve_text = sprintf(_LIST_SKIN_PREVIEW, $current['sdname']); + $has_enlargement = @file_exists($DIR_SKINS . $current['sdincpref'] . 'preview-large.png'); if ( $has_enlargement ) { - $data['skinthumb'] .= '\n"; + $data['skinthumb'] .= '\n"; } - $data['skinthumb'] .= '' . $alternatve_text . \n"; + $data['skinthumb'] .= '' . $alternatve_text . \n"; if ( $has_enlargement ) { $data['skinthumb'] .= "
    \n"; } - if ( @file_exists("{$DIR_SKINS}{$current->sdincpref}readme.html") ) + if ( @file_exists("{$DIR_SKINS}{$current['sdincpref']}readme.html") ) { - $url = $CONF['SkinsURL'] . Entity::hsc($current->sdincpref) . 'readme.html'; - $title = sprintf(_LIST_SKIN_README, $current->sdname); + $url = $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'readme.html'; + $title = sprintf(_LIST_SKIN_README, $current['sdname']); $data['readme'] = "" . _LIST_SKIN_README_TXT . "\n"; } else @@ -1688,16 +1739,23 @@ function listplug_table_skinlist($vars, $type, $templateName = '') $data['skinthumb'] .= "

    \n"; } - $skin = new Skin($current->sdnumber); - $available_skin_types = $skin->getAvailableTypes(); + if ( !preg_match('#^admin#', $current['sdname']) ) + { + $skin = new Skin($current['sdnumber']); + } + else + { + $skin = new Skin($current['sdnumber'], 'AdminActions'); + } + $available_types = $skin->getAvailableTypes(); - $data['skinparts'] = _LIST_SKINS_DEFINED; - $data['skinparts'] .= "
      \n"; - foreach ( $available_skin_types as $type => $friendlyName ) + $data['skinparts'] = _LIST_SKINS_DEFINED + . "
        \n"; + foreach ( $available_types as $type => $label ) { - if ( $friendlyName === FALSE ) + if ( $label === FALSE ) { - $friendlyName = ucfirst($type); + $label = ucfirst($type); $article = 'skinpartspecial'; } else @@ -1706,8 +1764,8 @@ function listplug_table_skinlist($vars, $type, $templateName = '') } $data['skinparts'] .= "
      • \n" . helpHtml($article) . "\n" - . "sdnumber}&type={$type}\" tabindex=\"{$vars['tabindex']}\">" - . Entity::hsc($friendlyName) + . "" + . Entity::hsc($label) . "\n" . "
      • \n"; } @@ -1728,14 +1786,14 @@ function listplug_table_skinlist($vars, $type, $templateName = '') return Template::fill($template, $data); } -function listplug_table_draftlist($vars, $type, $templateName = '') +function listplug_table_draftlist($vars, $type, $template_name = '') { global $manager; $templates = array(); - if ( !empty($templateName) ) + if ( !empty($template_name) ) { - $templates =& $manager->getTemplate($templateName); + $templates =& $manager->getTemplate($template_name); } switch( $type ) { @@ -1770,9 +1828,9 @@ function listplug_table_draftlist($vars, $type, $templateName = '') $template = $templates['SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY']; } $data = array( - 'bshortname' => Entity::hsc($current->bshortname), - 'ititle' => Entity::hsc(strip_tags($current->ititle)), - 'itemid' => intval($current->inumber), + 'bshortname' => Entity::hsc($current['bshortname']), + 'ititle' => Entity::hsc(strip_tags($current['ititle'])), + 'itemid' => intval($current['inumber']), 'editbtn' => _LISTS_EDIT, 'delbtn' => _LISTS_DELETE, ); @@ -1792,14 +1850,14 @@ function listplug_table_draftlist($vars, $type, $templateName = '') return Template::fill($template, $data); } -function listplug_table_otherdraftlist($vars, $type, $templateName = '') +function listplug_table_otherdraftlist($vars, $type, $template_name = '') { global $manager; $templates = array(); - if ( !empty($templateName) ) + if ( !empty($template_name) ) { - $templates =& $manager->getTemplate($templateName); + $templates =& $manager->getTemplate($template_name); } switch( $type ) @@ -1838,10 +1896,10 @@ function listplug_table_otherdraftlist($vars, $type, $templateName = '') $template = $templates['SHOWLIST_LISTPLUG_TABLE_ODRFTLIST_BODY']; } $data = array( - 'bshortname' => Entity::hsc($current->bshortname), - 'ititle' => Entity::hsc(strip_tags($current->ititle)), - 'iauthor' => Entity::hsc(strip_tags($current->mname)), - 'itemid' => intval($current->inumber), + 'bshortname' => Entity::hsc($current['bshortname']), + 'ititle' => Entity::hsc(strip_tags($current['ititle'])), + 'iauthor' => Entity::hsc(strip_tags($current['mname'])), + 'itemid' => intval($current['inumber']), 'editbtn' => _LISTS_EDIT, 'delbtn' => _LISTS_DELETE, ); @@ -1861,14 +1919,14 @@ function listplug_table_otherdraftlist($vars, $type, $templateName = '') return Template::fill($template, $data); } -function listplug_table_actionlist($vars, $type, $templateName = '') +function listplug_table_actionlist($vars, $type, $template_name = '') { global $manager; $templates = array(); - if ( !empty($templateName) ) + if ( !empty($template_name) ) { - $templates =& $manager->getTemplate($templateName); + $templates =& $manager->getTemplate($template_name); } switch( $type ) @@ -1900,8 +1958,8 @@ function listplug_table_actionlist($vars, $type, $templateName = '') $template = $templates['SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY']; } $data = array( - 'timestamp' => Entity::hsc($current->timestamp), - 'message' => Entity::hsc($current->message), + 'timestamp' => Entity::hsc($current['timestamp']), + 'message' => Entity::hsc($current['message']), ); break; case 'FOOT': @@ -1920,14 +1978,14 @@ function listplug_table_actionlist($vars, $type, $templateName = '') return Template::fill($template, $data); } -function listplug_table_banlist($vars, $type, $templateName = '') +function listplug_table_banlist($vars, $type, $template_name = '') { global $manager; $templates = array(); - if ( !empty($templateName) ) + if ( !empty($template_name) ) { - $templates =& $manager->getTemplate($templateName); + $templates =& $manager->getTemplate($template_name); } switch( $type ) @@ -1962,9 +2020,9 @@ function listplug_table_banlist($vars, $type, $templateName = '') $template = $templates['SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY']; } $data = array( - 'iprange' => Entity::hsc($current->iprange), - 'reason' => Entity::hsc($current->reason), - 'blogid' => intval($current->blogid), + 'iprange' => Entity::hsc($current['iprange']), + 'reason' => Entity::hsc($current['reason']), + 'blogid' => intval($current['blogid']), 'delbtn' => _LISTS_DELETE, ); break; @@ -1984,243 +2042,409 @@ function listplug_table_banlist($vars, $type, $templateName = '') return Template::fill($template, $data); } -function listplug_table_adminskinlist($vars, $type, $templateName = '') +/** + * listplug_list_normalskinlist() + * + * @param array $vars array for variables + * @param string $type HEAD/BODY/FOOT + * @param string $template_name name of template + * @return string marked-up string + */ +function listplug_list_normalskinlist($vars, $type, $template_name = '') { - global $CONF, $DIR_SKINS, $DIR_NUCLEUS, $manager; + global $manager, $CONF; - $adminSkinURL = $CONF['SkinsURL'] . 'admin/'; - $adminSkinDir = $DIR_SKINS . 'admin/'; + /* available variables as a default */ + $data = array( + 'skinid' => (integer) $vars['skinid'], + 'skinname' => Entity::hsc($vars['skinname']), + ); $templates = array(); - if ( !empty($templateName) ) + if ( $template_name ) { - $templates =& $manager->getTemplate($templateName); + $templates =& $manager->getTemplate($template_name); } - switch( $type ) + + switch ( $type ) { case 'HEAD': - if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD']) ) + if ( !array_key_exists('NORMALSKINLIST_HEAD', $templates) || empty($templates['NORMALSKINLIST_HEAD']) ) { - $template = "<%colname%>\n" - . "<%coldesc%>\n" - . "<%colact%>\n"; + $template = "
          \n"; } else { - $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD']; + $template = $templates['NORMALSKINLIST_HEAD']; } - $data = array( - 'colname' => _LISTS_NAME, - 'coldesc' => _LISTS_DESC, - 'colact' => _LISTS_ACTIONS, - ); + break; case 'BODY': $current = $vars['current']; - if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY']) ) + if ( !array_key_exists('NORMALSKINLIST_BODY', $templates) || empty($templates['NORMALSKINLIST_BODY']) ) { - $template = "<%skinname%>

          \n" - . "<%skintypelabel%> <%skintype%>
          \n" - . "<%incmodelabel%> <%incmode%>
          \n" - . "<%incpreflabel%> <%incpref%>
          \n" - . "<%skinthumb%>" - . "<%readme%>\n" - . "<%skindesc%><%skinparts%>\n" - . "" - . "\" tabindex=\"<%tabindex%>\"><%editbtn%>" - . "\n" - . "" - . "\" tabindex=\"<%tabindex%>\"><%clonebtn%>" - . "\n" - . "" - . "\" tabindex=\"<%tabindex%>\"><%delbtn%>" - . "\n"; + $template = "
        • " + . "\" tabindex=\"<%tabindex%>\"><%skintypename%>" + . " <%help%>" + . "
        • \n"; } else { - $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY']; + $template = $templates['NORMALSKINLIST_BODY']; } - $editurl = "{$CONF['AdminURL']}index.php?action=adminskinedit&skinid={$current->sdnumber}"; - $cloneurl = "{$CONF['AdminURL']}index.php?action=adminskinclone&skinid={$current->sdnumber}"; - $deleteurl = "{$CONF['AdminURL']}index.php?action=adminskindelete&skinid={$current->sdnumber}"; - - $data = array( - 'skintypelabel' => _LISTS_TYPE, - 'skintype' => Entity::hsc($current->sdtype), - 'incmodelabel' => _LIST_SKINS_INCMODE, - 'incmode' => ($current->sdincmode == 'skindir') ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL, - 'incpreflabel' => ($current->sdincpref) ? _LIST_SKINS_INCMODE : '', - 'incpref' => ($current->sdincpref) ? Entity::hsc($current->sdincpref) : '', - 'skindesc' => Entity::hsc($current->sddesc), - 'skinid' => (integer) $current->sdnumber, - 'tabindex' => $vars['tabindex'], - 'editurl' => Entity::hsc($manager->addTicketToUrl($editurl)), - 'cloneurl' => Entity::hsc($manager->addTicketToUrl($cloneurl)), - 'deleteurl' => Entity::hsc($manager->addTicketToUrl($deleteurl)), - 'editbtn' => _LISTS_EDIT, - 'clonebtn' => _LISTS_CLONE, - 'delbtn' => _LISTS_DELETE, - ); - - // use a special style for the default skin - if ( $current->sdnumber != $CONF['AdminSkin'] ) - { - $data['skinname'] = Entity::hsc($current->sdname); - } - else - { - $data['skinname'] = '' . Entity::hsc($current->sdname) . ''; - } - - // add preview image when present - if ( $current->sdincpref && @file_exists("{$adminSkinDir}{$current->sdincpref}preview.png") ) - { - $data['skinthumb'] = "

          \n"; - - $alternatve_text = sprintf(_LIST_SKIN_PREVIEW, $current->sdname); - $has_enlargement = @file_exists($adminSkinDir . $current->sdincpref . 'preview-large.png'); - if ( $has_enlargement ) - { - $data['skinthumb'] .= '\n"; - } - $data['skinthumb'] .= '' . $alternatve_text . \n"; - if ( $has_enlargement ) - { - $data['skinthumb'] .= "
          \n"; - } - - if ( @file_exists("{$DIR_SKINS}{$current->sdincpref}readme.html") ) - { - $url = $adminSkinURL . Entity::hsc($current->sdincpref) . 'readme.html'; - $title = sprintf(_LIST_SKIN_README, $current->sdname); - $data['readme'] = "" . _LIST_SKIN_README_TXT . "\n"; - } - else - { - $data['readme'] =""; - } - - $data['skinthumb'] .= "

          \n"; - } - - $skin = new Skin($current->sdnumber, 'AdminActions'); - $available_skin_types = $skin->getAvailableTypes(); - - $data['skinparts'] = _LIST_SKINS_DEFINED; - $data['skinparts'] .= "\n"; + $data['tabindex'] = $vars['tabindex']++; + $data['skintype'] = $current['skintype']; + $data['skintypename'] = $current['skintypename']; + $data['editaction'] = $vars['editaction']; + $data['editurl'] = "{$CONF['AdminURL']}?action={$vars['editaction']}&skinid={$vars['skinid']}&type={$current['skintype']}"; + /* TODO: removeaction? */ + /* TODO: customHelpHtml("skinpart{$skintype}-{$template_name}") */ + $data['help'] = ''; break; case 'FOOT': - if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT']) ) + if ( !array_key_exists('NORMALSKINLIST_FOOT', $templates) || empty($templates['NORMALSKINLIST_FOOT']) ) { - $template = ""; + $template = "
        \n"; } else { - $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT']; + $template = $templates['NORMALSKINLIST_FOOT']; } - $data = array(); + break; } + return Template::fill($template, $data); } -function listplug_table_admintemplatelist($vars, $type, $templateName = '') +/** + * listplug_list_specialskinlist() + * + * @param array $vars array for variables + * @param string $type HEAD/BODY/FOOT + * @param string $template_name name of template + * @return string marked-up string + */ +function listplug_list_specialskinlist($vars, $type, $template_name = '') { global $manager, $CONF; + /* available variables as a default */ + $data = array( + 'skinid' => (integer) $vars['skinid'], + 'skinname' => Entity::hsc($vars['skinname']), + ); + + /* retrieve templates */ $templates = array(); - if ( !empty($templateName) ) + if ( $template_name ) { - $templates =& $manager->getTemplate($templateName); + $templates =& $manager->getTemplate($template_name); } - switch( $type ) + switch ( $type ) { case 'HEAD': - if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD']) ) + if ( !array_key_exists('SPECIALSKINLIST_HEAD', $templates) || empty($templates['SPECIALSKINLIST_HEAD']) ) { - $template = "<%colname%>\n" - . "<%coldesc%>\n" - . "<%colact%>\n"; + $template = "
          \n"; } else { - $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD']; + $template = $templates['SPECIALSKINLIST_HEAD']; } - $data = array( - 'colname' => _LISTS_NAME, - 'coldesc' => _LISTS_DESC, - 'colact' => _LISTS_ACTIONS, - ); break; case 'BODY': $current = $vars['current']; - if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY']) ) + if ( !array_key_exists('SPECIALSKINLIST_BODY', $templates) || empty($templates['SPECIALSKINLIST_BODY']) ) { - $template = "<%templatename%>\n" - . "<%templatedesc%>\n" - . "" - . "\" tabindex=\"<%tabindex%>\"><%editbtn%>\n" - . "\n" - . "\n" - . "\" tabindex=\"<%tabindex%>\"><%clonebtn%>\n" - . "\n" - . "\n" - . "\" tabindex=\"<%tabindex%>\"><%delbtn%>\n" - . "\n"; + $template = "
        • " + . "\" tabindex=\"<%tabindex%>\">" + . "<%skintype%>" + . "" + . " (" + . "\" tabindex=\"<%tabindex%>\" >" + . "<%text(_LISTS_DELETE)%>" + . "" + . ")" + . "
        • \n"; } else { - $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY']; + $template = $templates['SPECIALSKINLIST_BODY']; } - $deleteurl = "{$CONF['AdminURL']}index.php?action=admintemplatedelete&templateid={$current->tdnumber}"; - $editurl = "{$CONF['AdminURL']}index.php?action=admintemplateedit&templateid={$current->tdnumber}"; - $cloneurl = "{$CONF['AdminURL']}index.php?action=admintemplateclone&templateid={$current->tdnumber}"; - $data = array( - 'templatename' => Entity::hsc($current->tdname), - 'templatedesc' => Entity::hsc($current->tddesc), - 'templateid' => (integer) $current->tdnumber, - 'tabindex' => (integer) $vars['tabindex'], - 'deleteurl' => Entity::hsc($manager->addTicketToUrl($deleteurl)), - 'editurl' => Entity::hsc($manager->addTicketToUrl($editurl)), - 'cloneurl' => Entity::hsc($manager->addTicketToUrl($cloneurl)), - 'editbtn' => _LISTS_EDIT, - 'clonebtn' => _LISTS_CLONE, - 'delbtn' => _LISTS_DELETE, - 'adminflg' => 'admin', - ); + + $data['tabindex'] = (integer) $vars['tabindex']++; + $data['skintype'] = Entity::hsc($current['skintype']); + $data['skintypename'] = Entity::hsc($current['skintypename']); + $data['editaction'] = $vars['editaction']; + $data['editurl'] = "{$CONF['AdminURL']}?action={$vars['editaction']}&skinid={$vars['skinid']}&type={$current['skintype']}"; + $data['removeaction'] = $vars['editaction']; + $data['removeurl'] = "{$CONF['AdminURL']}?action={$vars['removeaction']}&skinid={$vars['skinid']}&type={$current['skintype']}"; + break; case 'FOOT': - if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT']) ) + if ( !array_key_exists('SPECIALSKINLIST_FOOT', $templates) || empty($templates['SPECIALSKINLIST_FOOT']) ) { - $template = "\n"; + $template = "
        \n"; } else { - $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT']; + $template = $templates['SPECIALSKINLIST_FOOT']; } - $data = array(); break; } + return Template::fill($template, $data); } + +/** + * listplug_input_yesno() + * + * @param string $name name of input element with radio type attribute + * @param string $checkedval value which should be checked + * @param integer $tabindex tabindex number + * @param string $value1 value of radio 1 + * @param string $value2 value of radio 2 + * @param string $yesval label for yes + * @param string $noval label for no + * @param boolean $isAdmin super admin or not + * @param string $template_name name of template + * @param boolean $showlist used in showlist or not + * @return string marked-up string + */ +function listplug_input_yesno($name, $checkedval, $tabindex = 0, + $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO, + $isAdmin = 0, $template_name = '', $showlist = FALSE) +{ + global $manager; + + $templates = array(); + if ( $template_name ) + { + $templates =& $manager->getTemplate($template_name); + } + + if ( $name == 'admin' ) + { + if ( !array_key_exists('INPUTYESNO_TEMPLATE_ADMIN', $templates) || empty($templates['INPUTYESNO_TEMPLATE_ADMIN']) ) + { + $template = "\" name=\"<%name%>\" value=\"<%yesval%>\" <%yescheckedval%> onclick=\"selectCanLogin(true);\" />\n" + . "\n" + . "\" name=\"<%name%>\" value=\"<%noval%>\" <%nocheckedval%> <%disabled%> onclick=\"selectCanLogin(false);\" />\n" + . "\n"; + } + else + { + $template = $templates['INPUTYESNO_TEMPLATE_ADMIN']; + } + } + else + { + if ( array_key_exists('INPUTYESNO_TEMPLATE_NORMAL', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_NORMAL']) ) + { + $template = $templates['INPUTYESNO_TEMPLATE_NORMAL']; + } + else if ( $showlist && array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO', $templates) && !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO']) ) + { + $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO']; + } + else + { + $template = "\" name=\"<%name%>\" value=\"<%yesval%>\" <%yescheckedval%> />\n" + . "\n" + . "\" name=\"<%name%>\" value=\"<%noval%>\" <%nocheckedval%> <%disabled%> />\n" + . "\n"; + } + } + + $id = preg_replace('#[|]#', '-', $name); + $id1 = $id . $value1; + $id2 = $id . $value2; + $dat = array( + 'name' => Entity::hsc($name), + 'yesval' => Entity::hsc($value1), + 'noval' => Entity::hsc($value2), + 'yesid' => Entity::hsc($id1), + 'noid' => Entity::hsc($id2), + 'yesvaltext' => $yesval, + 'novaltext' => $noval, + 'yescheckedval' => ($checkedval == $value1) ? 'checked="checked" tabindex="' . $tabindex . '"': '', + 'nocheckedval' => ($checkedval != $value1) ? 'checked="checked" tabindex="' . $tabindex . '"': '', + 'disabled' => ($isAdmin && $name == 'canlogin') ? ' disabled="disabled"' : '', + ); + + return Template::fill($template, $dat); +} + +/** + * listplug_batchlist() + * + * @param string $attr item/member/team/category/comment + * @param resource $query SQL resorce + * @param string $type type for showlist() + * @param array $vars array for variables + */ +function listplug_batchlist($attr, $query, $type, $vars) +{ + global $manager; + + /* HEAD */ + $content = "
        \n"; + + /* BODY */ + $content .= showlist($query, $type, $vars); + + /* FOOT */ + switch ( $attr ) + { + case 'item': + $options = array( + 'delete' => _BATCH_ITEM_DELETE, + 'move' => _BATCH_ITEM_MOVE + ); + break; + case 'member': + $options = array( + 'delete' => _BATCH_MEMBER_DELETE, + 'setadmin' => _BATCH_MEMBER_SET_ADM, + 'unsetadmin' => _BATCH_MEMBER_UNSET_ADM + ); + break; + case 'team': + $options = array( + 'delete' => _BATCH_TEAM_DELETE, + 'setadmin' => _BATCH_TEAM_SET_ADM, + 'unsetadmin' => _BATCH_TEAM_UNSET_ADM, + ); + break; + case 'category': + $options = array( + 'delete' => _BATCH_CAT_DELETE, + 'move' => _BATCH_CAT_MOVE, + ); + break; + case 'comment': + $options = array( + 'delete' => _BATCH_COMMENT_DELETE, + ); + break; + default: + $options = array(); + break; + } + + $content .= "

        \n" + . _BATCH_WITH_SEL + . "\n"; + + if ( $attr == 'team' ) + { + $content .= ''; + } + else if ( $attr == 'comment' ) + { + $content .= ''; + } + + $content .= '' + . "(" + . "" . _BATCH_SELECTALL . "" + . " - " + . "" . _BATCH_DESELECTALL . "" + . ")\n" + . "\n" + . '' . "\n" + . "

        \n" + . "
        \n"; + + return $content; +} + +/** + * listplug_navlist() + * + * @param string $attr item/member/team/category/comment + * @param resource $query SQL resorce + * @param string $type type for showlist() + * @param array $vars array for variables + */ +function listplug_navlist($attribute, $query, $type, $vars) +{ + global $CONF; + + $prev = $vars['start'] - $vars['amount']; + if ( $prev < $vars['minamount'] ) + { + $prev = $vars['minamount']; + } + + $next = $vars['start'] + $vars['amount']; + + $navi = "\n"; + $navi .= "\n" + . "\n"; + $navi .= "\n"; + $navi .= "\n"; + $navi .= "\n"; + $navi .= "\n"; + $navi .= "\n" + . "
        \n" + . "
        \n" + . "\n" + . "\n" + . "\n" + . "\n" + . "\n" + . "\n" + . "
        \n" + . "
        \n" + . "
        \n" + . "\n" + . _LISTS_PERPAGE + . "\n" + . "\n" + . "\n" + . "\n" + . "\n" + . "\n" + . "
        \n" + . "
        \n" + . "
        \n" + . "\n" + . "\n" + . "\n" + . "\n" + . "\n" + . "\n" + . "\n" + . "
        \n" + . "
        \n" + . "
        \n" + . "\n" + . "\n" + . "\n" + . "\n" + . "\n" + . "\n" + . "
        \n" + . "
        \n"; + + /* HEAD */ + $template = $navi; + + /* BODY */ + $template .= listplug_batchlist($attribute, $query, $type, $vars); + + /* FOOT */ + $template .= $navi; + + return $template; +} diff --git a/nucleus/locales/adminskinTypes.php b/nucleus/locales/adminskinTypes.php index 92d6ff4..ed680c4 100644 --- a/nucleus/locales/adminskinTypes.php +++ b/nucleus/locales/adminskinTypes.php @@ -83,9 +83,9 @@ define('_ADM_SKPRT_FORGOTPASSWORD', '[' . _FORGOTPASSWOR // ADMIN-template template types -define('_ADM_TPLPT_ADMINSKINTYPELIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [defaultadminskintypes]' . _SKINABLEADMIN_HEAD_STR); -define('_ADM_TPLPT_ADMINSKINTYPELIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [defaultadminskintypes]' . _SKINABLEADMIN_BODY_STR); -define('_ADM_TPLPT_ADMINSKINTYPELIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [defaultadminskintypes]' . _SKINABLEADMIN_FOOT_STR); +define('_ADM_TPLPT_NORMALSKINLIST_HEAD', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [defaultadminskintypes]' . _SKINABLEADMIN_HEAD_STR); +define('_ADM_TPLPT_NORMALSKINLIST_BODY', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [defaultadminskintypes]' . _SKINABLEADMIN_BODY_STR); +define('_ADM_TPLPT_NORMALSKINLIST_FOOT', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [defaultadminskintypes]' . _SKINABLEADMIN_FOOT_STR); define('_ADM_TPLPT_ADMIN_CUSTOMHELPLINK_ICON', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [customhelplink] ' . _SKINABLEADMIN_HELPICONURL_STR); define('_ADM_TPLPT_ADMIN_CUSTOMHELPLINK_ANCHOR', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [customhelplink] ' . _SKINABLEADMIN_HELPFILEURL_STR); define('_ADM_TPLPT_ADMIN_BLOGLINK', _SKINABLEADMIN_ADMINSKINVAR_STR . ' [adminbloglink]'); diff --git a/skins/admin/default/skinbackup.xml b/skins/admin/default/skinbackup.xml index 841cf93..a077554 100644 --- a/skins/admin/default/skinbackup.xml +++ b/skins/admin/default/skinbackup.xml @@ -1,1316 +1,1592 @@ - - -