OSDN Git Service

管理画面用スキンのaction_classをAdminActionsに修正
[nucleus-jp/nucleus-next.git] / nucleus / libs / AdminActions.php
1 <?php
2 if ( !class_exists('BaseActions') )
3 {
4         include $DIR_LIBS . 'BaseActions.php';
5 }
6 class AdminActions extends BaseActions
7 {
8         // reference to the skin object for which a part is being parsed
9         private $skin;
10         
11         // an instance of parser class
12 //      private $parser;
13         protected $parser;
14         
15         private $skintype;
16         
17         /* NOTE: list of whole available action names for tags
18                 'actionloglist',
19                 'activationmessage',
20                 'addtickettourl',
21                 'adminbanlist',
22                 'adminbatchaction',
23                 'adminbatchlist',
24                 'adminbloglink',
25                 'adminerrormesg',
26                 'adminskineditallowedlist',
27                 'adminskinielist',
28                 'adminskinoverview',
29                 'adminskinselectoptions',
30                 'adminspecialskinlist',
31                 'admintemplateoverview',
32                 'allowedadminskinactions',
33                 'allowedskinactions',
34                 'banlistdeletedlist',
35                 'batchdeletelist',
36                 'batchdeletetype',
37                 'batchmovebtn',
38                 'batchmovelist',
39                 'batchmovetitle',
40                 'batchmovetype',
41                 'blogcatlist',
42                 'blognotifysetting',
43                 'blogselectbox',
44                 'blogsetting',
45                 'blogsettingyesno',
46                 'blogteamlist',
47                 'blogteammembers',
48                 'blogtime',
49                 'bookmarkletadmin',
50                 'category',
51                 'categorysetting',
52                 'codename',
53                 'commentnavlist',
54                 'configsettingsedit',
55                 'configsettingsyesno',
56                 'customhelplink',
57                 'date',
58                 'defaultadminskintypes',
59                 'defblogselect',
60                 'defcatselect',
61                 'defskinselect',
62                 'deletecomment',
63                 'deleteitembody',
64                 'deleteitemid',
65                 'deleteitemtitle',
66                 'editadminskin',
67                 'editadminskintype',
68                 'editadmintemplateinfo',
69                 'editcomment',
70                 'editdesturl',
71                 'editmember',
72                 'editmemberlist',
73                 'editpluginfo',
74                 'editplugoptionslist',
75                 'editskin',
76                 'editskintype',
77                 'edittemplateinfo',
78                 'eventformextra',
79                 'extrahead',
80                 'getblogsetting',
81                 'geteditpluginfo',
82                 'getmember',
83                 'headmessage',
84                 'helplink',
85                 'helpplugname',
86                 'ilistaddnew',
87                 'importskininfo',
88                 'inputyesno',
89                 'insertpluginfo',
90                 'insertpluginoptions',
91                 'insplugoptcontent',
92                 'iprangeinput',
93                 'itemnavlist',
94                 'jstoolbaroptions',
95                 'languageselectoptions',
96                 'listplugplugoptionrow',
97                 'mediadirwarning',
98                 'movedistselect',
99                 'moveitemid',
100                 'newestcompare',
101                 'newmemberselect',
102                 'newpluginlist',
103                 'outputspecialdirs',
104                 'passrequestvars',
105                 'pluginextras',
106                 'pluginhelp',
107                 'pluginlistlist',
108                 'pluginoptions',
109                 'qmenuaddselect',
110                 'quickmenu',
111                 'requestblogid',
112                 'requestiprange',
113                 'selectlocaladminskinfiles',
114                 'selectlocalskinfiles',
115                 'skineditallowedlist',
116                 'skinfile',
117                 'skinielist',
118                 'skinoverview',
119                 'skintypehelp',
120                 'specialskinlist',
121                 'sprinttext',
122                 'systemsettings',
123                 'templateoverview',
124                 'text',
125                 'ticket',
126                 'versioncheckurl',
127                 'yrbloglist'
128         );
129          */
130         
131         /**
132          * AdminActions::$default_actions
133          * list of whole action names with which this class can deal
134          */
135         static private $default_actions = array(
136                 'addtickettourl',
137                 'headmessage',
138                 'ticket',
139                 'sprinttext',
140                 'helplink',
141                 'customhelplink',
142                 'adminurl'
143         );
144         
145         /**
146          * AdminActions::$skin_type_friendly_names
147          * friendly name for wrapped page types
148          */
149         static private $default_skin_types = array(
150                 'actionlog'                             => _ADM_SKPRT_ACTIONLOG,
151                 'activate'                              => _ADM_SKPRT_ACTIVATE,
152                 'activatesetpwd'                => _ADM_SKPRT_ACTIVATESETPWD,
153                 'addnewlog'                             => _ADM_SKPRT_ADDNEWLOG,
154                 'adminerrorpage'                => _ADM_SKPRT_ADMINERRORPAGE,
155                 'adminskindelete'               => _ADM_SKPRT_ADMINSKINDELETE,
156                 'adminskinedit'                 => _ADM_SKPRT_ADMINSKINEDIT,
157                 'adminskinedittype'             => _ADM_SKPRT_ADMINSKINEDITTYPE,
158                 'adminskiniedoimport'   => _ADM_SKPRT_ADMINSKINIEDOIMPORT,
159                 'adminskinieimport'             => _ADM_SKPRT_ADMINSKINIEIMPORT,
160                 'adminskinieoverview'   => _ADM_SKPRT_ADMINSKINIEOVERVIEW,
161                 'adminskinoverview'             => _ADM_SKPRT_ADMINSKINOVERVIEW,
162                 'adminskinremovetype'   => _ADM_SKPRT_ADMINSKINREMOVETYPE,
163                 'admintemplatedelete'   => _ADM_SKPRT_ADMINTEMPLATEDELETE,
164                 'admintemplateedit'             => _ADM_SKPRT_ADMINTEMPLATEEDIT,
165                 'admintemplateoverview' => _ADM_SKPRT_ADMINTEMPLATEOVERVIEW,
166                 'backupoverview'                => _ADM_SKPRT_BACKUPOVERVIEW,
167                 'backuprestore'                 => _ADM_SKPRT_BACKUPRESTORE,
168                 'banlist'                               => _ADM_SKPRT_BANLIST,
169                 'banlistdelete'                 => _ADM_SKPRT_BANLISTDELETE,
170                 'banlistdeleteconfirm'  => _ADM_SKPRT_BANLISTDELETECONFIRM,
171                 'banlistnew'                    => _ADM_SKPRT_BANLISTNEW,
172                 'batchcategory'                 => _ADM_SKPRT_BATCHCATEGORY,
173                 'batchcomment'                  => _ADM_SKPRT_BATCHCOMMENT,
174                 'batchdelete'                   => _ADM_SKPRT_BATCHDELETE,
175                 'batchitem'                             => _ADM_SKPRT_BATCHITEM,
176                 'batchmember'                   => _ADM_SKPRT_BATCHMEMBER,
177                 'batchmove'                             => _ADM_SKPRT_BATCHMOVE,
178                 'batchteam'                             => _ADM_SKPRT_BATCHTEAM,
179                 'blogcommentlist'               => _ADM_SKPRT_BLOGCOMMENTLIST,
180                 'blogselectbox'                 => _ADM_SKPRT_BLOGSELECTBOX,
181                 'blogsettings'                  => _ADM_SKPRT_BLOGSETTINGS,
182                 'bookmarklet'                   => _ADM_SKPRT_BOOKMARKLET,
183                 'browseowncomments'             => _ADM_SKPRT_BROWSEOWNCOMMENTS,
184                 'browseownitems'                => _ADM_SKPRT_BROWSEOWNITEMS,
185                 'categorydelete'                => _ADM_SKPRT_CATEGORYDELETE,
186                 'categoryedit'                  => _ADM_SKPRT_CATEGORYEDIT,
187                 'commentdelete'                 => _ADM_SKPRT_COMMENTDELETE,
188                 'commentedit'                   => _ADM_SKPRT_COMMENTEDIT,
189                 'createitem'                    => _ADM_SKPRT_CREATEITEM,
190                 'createnewlog'                  => _ADM_SKPRT_CREATENEWLOG,
191                 'deleteblog'                    => _ADM_SKPRT_DELETEBLOG,
192                 'editmembersettings'    => _ADM_SKPRT_EDITMEMBERSETTINGS,
193                 'insertpluginoptions'   => _ADM_SKPRT_INSERTPLUGINO,
194                 'itemcommentlist'               => _ADM_SKPRT_ITEMCOMMENTLIST,
195                 'itemdelete'                    => _ADM_SKPRT_ITEMDELETE,
196                 'itemedit'                              => _ADM_SKPRT_ITEMEDIT,
197                 'itemlist'                              => _ADM_SKPRT_ITEMLIST,
198                 'itemmove'                              => _ADM_SKPRT_ITEMMOVE,
199                 'login'                                 => FALSE,       //missing
200                 'manage'                                => _ADM_SKPRT_MANAGE,
201                 'manageteam'                    => _ADM_SKPRT_MANAGETEAM,
202                 'memberdelete'                  => _ADM_SKPRT_MEMBERDELETE,
203                 'memberedit'                    => FALSE,       //missing
204                 'overview'                              => _ADM_SKPRT_OVERVIEW,
205                 'pagefoot'                              => _ADM_SKPRT_PAGEFOOT,
206                 'pagehead'                              => _ADM_SKPRT_PAGEHEAD,
207                 'plugindelete'                  => _ADM_SKPRT_PLUGINDELETE,
208                 'pluginhelp'                    => _ADM_SKPRT_PLUGINHELP,
209                 'pluginlist'                    => _ADM_SKPRT_PLUGINLIST,
210                 'pluginoptions'                 => _ADM_SKPRT_PLUGINOPTIONS,
211                 'settingsedit'                  => _ADM_SKPRT_SETTINGSEDIT,
212                 'showlogin'                             => _ADM_SKPRT_SHOWLOGIN,
213                 'skindelete'                    => _ADM_SKPRT_SKINDELETE,
214                 'skinedit'                              => _ADM_SKPRT_SKINEDIT,
215                 'skinedittype'                  => _ADM_SKPRT_SKINEDITTYPE,
216                 'skiniedoimport'                => _ADM_SKPRT_SKINIEDOIMPORT,
217                 'skinieimport'                  => _ADM_SKPRT_SKINIEIMPORT,
218                 'skinieoverview'                => _ADM_SKPRT_SKINIEOVERVIEW,
219                 'skinoverview'                  => _ADM_SKPRT_SKINOVERVIEW,
220                 'skinremovetype'                => _ADM_SKPRT_SKINREMOVETYPE,
221                 'systemoverview'                => _ADM_SKPRT_SYSTEMOVERVIEW,
222                 'teamdelete'                    => _ADM_SKPRT_TEAMDELETE,
223                 'templatedelete'                => _ADM_SKPRT_TEMPLATEDELETE,
224                 'templateedit'                  => _ADM_SKPRT_TEMPLATEEDIT,
225                 'templateoverview'              => _ADM_SKPRT_TEMPLATEOVERVIEW,
226                 'usermanagement'                => _ADM_SKPRT_USERMANAGEMENT,
227         );
228         
229         /**
230          * AdminActions::getDefinedActions()
231          * 
232          * @static
233          * @param       string  $type   page type
234          * @return      array   allowed actions for the page type
235          */
236         static public function getDefinedActions($type = '')
237         {
238                 $extra_actions = array();
239                 
240                 switch ( $type )
241                 {
242                         case 'actionlog':
243                                 $extra_actions = array(
244                                         'actionloglist',
245                                 );
246                                 break;
247                         case 'activate':
248                                 $extra_actions = array(
249                                         'activationmessage',
250                                         'eventformextra',
251                                 );
252                                 break;
253                         case 'activatesetpwd':
254                                 $extra_actions = array(
255                                 );
256                                 break;
257                         case 'addnewlog':
258                                 $extra_actions = array(
259                                         'getblogsetting',
260                                         'blogsetting',
261                                         'requestblogid',
262                                         );
263                                 break;
264                         case 'adminerrorpage':
265                                 $extra_actions = array(
266                                 );
267                                 break;
268                         case 'adminskindelete':
269                                 $extra_actions = array(
270                                         'editadminskintype',
271                                 );
272                                 break;
273                         case 'adminskinedit':
274                                 $extra_actions = array(
275                                         'editadminskin',
276                                         'defaultadminskintypes',
277                                         'adminspecialskinlist',
278                                 );
279                                 break;
280                         case 'adminskinedittype':
281                                 $extra_actions = array(
282                                         'editadminskintype',
283                                         'skintypehelp',
284                                         'allowedadminskinactions',
285                                         'adminskineditallowedlist',
286                                 );
287                                 break;
288                         case 'adminskiniedoimport':
289                                 $extra_actions = array(
290                                         'importskininfo',
291                                 );
292                                 break;
293                         case 'adminskinieimport':
294                                 $extra_actions = array(
295                                         'importskininfo',
296                                 );
297                                 break;
298                         case 'adminskinieoverview':
299                                 $extra_actions = array(
300                                         'selectlocaladminskinfiles',
301                                         'adminskinielist',
302                                 );
303                                 break;
304                         case 'adminskinoverview':
305                                 $extra_actions = array(
306                                         'adminskinoverview',
307                                 );
308                                 break;
309                         case 'adminskinremovetype':
310                                 $extra_actions = array(
311                                         'editadminskintype',
312                                 );
313                                 break;
314                         case 'admintemplateedit':
315                                 $extra_actions = array(
316                                         'editadmintemplateinfo',
317                                 );
318                                 break;
319                         case 'admintemplateoverview':
320                                 $extra_actions = array(
321                                         'admintemplateoverview',
322                                 );
323                                 break;
324                         case 'backupoverview':
325                                 $extra_actions = array(
326                                 );
327                                 break;
328                         case 'backuprestore':
329                                 $extra_actions = array(
330                                 );
331                                 break;
332                         case 'banlist':
333                                 $extra_actions = array(
334                                         'adminbloglink',
335                                         'adminbanlist',
336                                         'requestblogid',
337                                 );
338                                 break;
339                         case 'banlistdelete':
340                                 $extra_actions = array(
341                                         'requestiprange',
342                                         'requestblogid',
343                                 );
344                                 break;
345                         case 'banlistdeleteconfirm':
346                                 $extra_actions = array(
347                                         'banlistdeletedlist',
348                                         'requestblogid',
349                                 );
350                                 break;
351                         case 'banlistnew':
352                                 $extra_actions = array(
353                                         'iprangeinput',
354                                         'requestblogid',
355                                         'blogsetting',
356                                 );
357                                 break;
358                         case 'batchcategory':
359                                 $extra_actions = array(
360                                         'adminbatchaction',
361                                         'adminbatchlist',
362                                 );
363                                 break;
364                         case 'batchcomment':
365                                 $extra_actions = array(
366                                         'adminbatchaction',
367                                         'adminbatchlist',
368                                 );
369                                 break;
370                         case 'batchdelete':
371                                 $extra_actions = array(
372                                         'batchdeletetype',
373                                         'batchdeletelist',
374                                 );
375                                 break;
376                         case 'batchitem':
377                                 $extra_actions = array(
378                                         'adminbatchaction',
379                                         'adminbatchlist',
380                                 );
381                                 break;
382                         case 'batchmember':
383                                 $extra_actions = array(
384                                         'adminbatchaction',
385                                         'adminbatchlist',
386                                 );
387                                 break;
388                         case 'batchmove':
389                                 $extra_actions = array(
390                                         'batchmovetitle',
391                                         'batchmovetype',
392                                         'batchmovelist',
393                                         'movedistselect',
394                                         'batchmovebtn',
395                                 );
396                                 break;
397                         case 'batchmovecat':
398                                 $extra_actions = array(
399                                         'batchmovetitle',
400                                         'batchmovetype',
401                                         'batchmovelist',
402                                         'movedistselect',
403                                         'batchmovebtn',
404                                 );
405                                 break;
406                         case 'batchteam':
407                                 $extra_actions = array(
408                                         'requestblogid',
409                                         'adminbatchaction',
410                                         'adminbatchlist',
411                                 );
412                                 break;
413                         case 'blogcommentlist':
414                                 $extra_actions = array(
415                                         'adminbloglink',
416                                         'commentnavlist',
417                                         'adminbatchlist',
418                                 );
419                                 break;
420                         case 'blogselectbox':
421                                 $extra_actions = array(
422                                         'blogselectbox',
423                                 );
424                                 break;
425                         case 'blogsettings':
426                                 $extra_actions = array(
427                                         'adminbloglink',
428                                         'blogteammembers',
429                                         'requestblogid',
430                                         'blogsetting',
431                                         'blognotifysetting',
432                                         'defcatselect',
433                                         'blogtime',
434                                         'blogsettingyesno',
435                                         'pluginoptions',
436                                         'blogcatlist',
437                                         'pluginextras',
438                                 );
439                                 break;
440                         case 'bookmarklet':
441                                 $extra_actions = array(
442                                         'bookmarkletadmin',
443                                 );
444                                 break;
445                         case 'browseowncomments':
446                                 $extra_actions = array(
447                                         'commentnavlist',
448                                 );
449                                 break;
450                         case 'browseownitems':
451                                 $extra_actions = array(
452                                         'itemnavlist',
453                                 );
454                                 break;
455                         case 'categorydelete':
456                                 $extra_actions = array(
457                                         'categorysetting',
458                                         'requestblogid',
459                                 );
460                                 break;
461                         case 'categoryedit':
462                                 $extra_actions = array(
463                                         'requestblogid',
464                                         'categorysetting',
465                                         'editdesturl',
466                                 );
467                                 break;
468                         case 'commentdelete':
469                                 $extra_actions = array(
470                                         'deletecomment',
471                                 );
472                                 break;
473                         case 'commentedit':
474                                 $extra_actions = array(
475                                         'editcomment',
476                                 );
477                                 break;
478                         case 'createitem':
479                                 $extra_actions = array(
480                                         'adminbloglink',
481                                         'blogid',
482                                         'jsinput',
483                                         'jsbuttonbar',
484                                         'contents',
485                                         'categories',
486                                         'currenttime',
487                                         'pluginextras',
488                                         'itemoptions'
489                                 );
490                                 break;
491                         case 'createnewlog':
492                                 $extra_actions = array(
493                                         'defskinselect',
494                                         'blogtime',
495                                 );
496                                 break;
497                         case 'deleteblog':
498                                 $extra_actions = array(
499                                         'blogsetting',
500                                         'requestblogid',
501                                 );
502                                 break;
503                         case 'editmembersettings':
504                                 $extra_actions = array(
505                                         'editmember',
506                                         'languageselectoptions',
507                                         'adminskinselectoptions',
508                                         'pluginoptions',
509                                 );
510                                 break;
511                         case 'insertpluginoptions':
512                                 $extra_actions = array(
513                                         'insertpluginoptions',
514                                 );
515                                 break;
516                         case 'itemcommentlist':
517                                 $extra_actions = array(
518                                         'requestblogid',
519                                         'commentnavlist',
520                                 );
521                                 break;
522                         case 'itemdelete':
523                                 $extra_actions = array(
524                                         'deleteitemtitle',
525                                         'deleteitembody',
526                                         'deleteitemid',
527                                 );
528                                 break;
529                         case 'itemedit':
530                                 $extra_actions = array(
531                                         'init',
532                                         'contents',
533                                         'jsinput',
534                                         'jsbuttonbar',
535                                         'checkedonval',
536                                         'categories',
537                                         'currenttime',
538                                         'itemtime',
539                                         'pluginextras',
540                                         'itemoptions'
541                                 );
542                                 break;
543                         case 'itemlist':
544                                 $extra_actions = array(
545                                         'adminbloglink',
546                                         'ilistaddnew',
547                                         'itemnavlist',
548                                 );
549                                 break;
550                         case 'itemmove':
551                                 $extra_actions = array(
552                                         'moveitemid',
553                                         'movedistselect',
554                                 );
555                                 break;
556                         case 'manage':
557                                 $extra_actions = array(
558                                 );
559                                 break;
560                         case 'manageteam':
561                                 $extra_actions = array(
562                                         'requestblogid',
563                                         'blogsetting',
564                                         'blogteamlist',
565                                         'newmemberselect',
566                                         'inputyesno',
567                                 );
568                                 break;
569                         case 'memberdelete':
570                                 $extra_actions = array(
571                                         'editmember',
572                                 );
573                                 break;
574                         case 'overview':
575                                 $extra_actions = array(
576                                         'yrbloglist',
577                                 );
578                                 break;
579                         case 'pagefoot':
580                                 $extra_actions = array(
581                                         'date',
582                                         'qmenuaddselect',
583                                         'member',
584                                         'quickmenu',
585                                 );
586                                 break;
587                         case 'pagehead':
588                                 $extra_actions = array(
589                                         'charset',
590                                         'sitevar',
591                                         'adminurl',
592                                         'extrahead',
593                                         'member',
594                                         'versioncheckurl',
595                                         'version',
596                                         'codename',
597                                         'newestcompare',
598                                 );
599                                 break;
600                         case 'plugindelete':
601                                 $extra_actions = array(
602                                         'editpluginfo',
603                                 );
604                                 break;
605                         case 'pluginhelp':
606                                 $extra_actions = array(
607                                         'helpplugname',
608                                         'pluginhelp',
609                                 );
610                                 break;
611                         case 'pluginlist':
612                                 $extra_actions = array(
613                                         'pluginlistlist',
614                                         'newpluginlist',
615                                 );
616                                 break;
617                         case 'pluginoptions':
618                                 $extra_actions = array(
619                                         'editpluginfo',
620                                         'editplugoptionslist',
621                                 );
622                                 break;
623                         case 'settingsedit':
624                                 $extra_actions = array(
625                                         'defblogselect',
626                                         'defskinselect',
627                                         'configsettingsedit',
628                                         'languageselectoptions',
629                                         'configsettingsyesno',
630                                         'outputspecialdirs',
631                                         'jstoolbaroptions',
632                                         'mediadirwarning',
633                                         'pluginextras',
634                                 );
635                                 break;
636                         case 'showlogin':
637                                 $extra_actions = array(
638                                         'passrequestvars',
639                                 );
640                                 break;
641                         case 'skindelete':
642                                 $extra_actions = array(
643                                         'editskintype',
644                                 );
645                                 break;
646                         case 'skinedit':
647                                 $extra_actions = array(
648                                         'editskin',
649                                         'specialskinlist',
650                                 );
651                                 break;
652                         case 'skinedittype':
653                                 $extra_actions = array(
654                                         'editskintype',
655                                         'skintypehelp',
656                                         'allowedskinactions',
657                                         'skineditallowedlist',
658                                         'skineditallowedlist',
659                                 );
660                                 break;
661                         case 'skiniedoimport':
662                                 $extra_actions = array(
663                                         'importskininfo',
664                                 );
665                                 break;
666                         case 'skinieimport':
667                                 $extra_actions = array(
668                                         'importskininfo',
669                                 );
670                                 break;
671                         case 'skinieoverview':
672                                 $extra_actions = array(
673                                         'selectlocalskinfiles',
674                                         'skinielist',
675                                 );
676                                 break;
677                         case 'skinoverview':
678                                 $extra_actions = array(
679                                         'skinoverview',
680                                 );
681                                 break;
682                         case 'skinremovetype':
683                                 $extra_actions = array(
684                                         'editskintype',
685                                 );
686                                 break;
687                         case 'systemoverview':
688                                 $extra_actions = array(
689                                         'systemsettings',
690                                 );
691                                 break;
692                         case 'teamdelete':
693                                 $extra_actions = array(
694                                         'editmember',
695                                         'blogsetting',
696                                         'requestblogid',
697                                 );
698                                 break;
699                         case 'templatedelete':
700                                 $extra_actions = array(
701                                         'edittemplateinfo',
702                                 );
703                                 break;
704                         case 'templateedit':
705                                 $extra_actions = array(
706                                         'edittemplateinfo',
707                                 );
708                                 break;
709                         case 'templateoverview':
710                                 $extra_actions = array(
711                                         'templateoverview',
712                                 );
713                                 break;
714                         case 'usermanagement':
715                                 $extra_actions = array(
716                                         'editmemberlist',
717                                         'inputyesno',
718                                 );
719                                 break;
720                         case 'importAdmin':
721                                 $extra_actions = array(
722                                         'charset',
723                                         'sitevar',
724                                         'adminurl',
725                                         'extrahead',
726                                         'member',
727                                         'versioncheckurl',
728                                         'version',
729                                         'codename',
730                                         'newestcompare',
731                                         'selectlocaladminskinfiles',
732                                         'adminskinielist',
733                                 );
734                                 break;
735                         default:
736                                 break;
737                 }
738                 
739                 $defined_actions = array_merge(self::$default_actions, $extra_actions);
740                 
741                 return array_merge($defined_actions, parent::getDefinedActions());
742         }
743         
744         /**
745          * AdminActions::getSkinTypeFriendlyNames()
746          * 
747          * @static
748          * @param       void
749          * @return      array   list of friendly names for page actions
750          */
751         static public function getDefaultSkinTypes()
752         {
753                 return self::$default_skin_types;
754         }
755         
756         /**
757          * AdminActions::__construct()
758          * Constructor for a new Actions object
759          * 
760          * @param       string  $type
761          * @return      void
762          */
763         public function __construct($type)
764         {
765                 // call constructor of superclass first
766                 parent::__construct();
767                 $this->skintype = $type;
768                 return;
769         }
770         
771         /**
772          * AdminActions::setSkin()
773          * Set the skin
774          * @param       object  $skin   an instance of Skin class
775          * @return      void
776          */
777         public function setSkin(&$skin)
778         {
779                 $this->skin =& $skin;
780                 return;
781         }
782         
783         /**
784          * AdminActions::setParser()
785          * Set the parser
786          * 
787          * @param       object  $parser an instance of Parser class
788          * @return      void
789          */
790         public function setParser(&$parser)
791         {
792                 $this->parser =& $parser;
793                 return;
794         }
795         
796         /**
797          * AdminActions::parse_actionloglist()
798          * Parse skinvar actionloglist
799          * 
800          * @param       string  $templateName   name of template to use
801          * @return      void
802          */
803         public function parse_actionloglist($templateName = '')
804         {
805                 $query = "SELECT * FROM %s ORDER BY timestamp DESC";
806                 $query = sprintf($query, sql_table('actionlog'));       
807                 
808                 $template['content'] = 'actionlist';
809                 $amount = showlist($query, 'table', $template, $templateName);
810                 return;
811         }
812         
813         
814         /**
815          * AdminActions::parse_activationmessage()
816          * Parse skinvar activationmessage
817          * 
818          * @param       string  $type                   type of message
819          * @param       string  $templateName   name of template to use
820          * @return      void
821          */
822         public function parse_activationmessage($type, $templateName = '')
823         {
824                 global $CONF, $manager;
825                 
826                 $template = array();
827                 
828                 if ( !empty($templateName))
829                 {
830                         $template = Template::read($templateName);
831                 }
832                 
833                 $key = postVar('ackey');
834                 if ( !$key )
835                 {
836                         Admin::error(_ERROR_ACTIVATE);
837                 }
838                 
839                 $info = MEMBER::getActivationInfo($key);
840                 if ( !$info )
841                 {
842                         Admin::error(_ERROR_ACTIVATE);
843                 }
844                 
845                 $mem  = MEMBER::createFromId($info->vmember);
846                 if ( !$mem )
847                 {
848                         Admin::error(_ERROR_ACTIVATE);
849                 }
850                 switch ( $info->vtype )
851                 {
852                         case 'forgot':
853                                 if ( array_key_exists('ACTIVATE_FORGOT_TITLE', $template) && !empty($template['ACTIVATE_FORGOT_TITLE']) )
854                                 {
855                                         $title = $template['ACTIVATE_FORGOT_TITLE'];
856                                 }
857                                 else
858                                 {
859                                         $title = _ACTIVATE_FORGOT_TITLE;
860                                 }
861                                 if ( array_key_exists('ACTIVATE_FORGOT_TEXT', $template) && !empty($template['ACTIVATE_FORGOT_TEXT']) )
862                                 {
863                                         $text = $template['ACTIVATE_FORGOT_TEXT'];
864                                 }
865                                 else
866                                 {
867                                         $text = _ACTIVATE_FORGOT_TEXT;
868                                 }
869                                 break;
870                         case 'register':
871                                 if ( array_key_exists('ACTIVATE_REGISTER_TITLE', $template) && !empty($template['ACTIVATE_REGISTER_TITLE']) )
872                                 {
873                                         $title = $template['ACTIVATE_REGISTER_TITLE'];
874                                 }
875                                 else
876                                 {
877                                         $title = _ACTIVATE_REGISTER_TITLE;
878                                 }
879                                 if ( array_key_exists('ACTIVATE_REGISTER_TEXT', $template) && !empty($template['ACTIVATE_REGISTER_TEXT']) )
880                                 {
881                                         $text = $template['ACTIVATE_REGISTER_TEXT'];
882                                 }
883                                 else
884                                 {
885                                         $text = _ACTIVATE_REGISTER_TEXT;
886                                 }
887                                 break;
888                         case 'addresschange':
889                                 if ( array_key_exists('ACTIVATE_CHANGE_TITLE', $template) && !empty($template['ACTIVATE_CHANGE_TITLE']) )
890                                 {
891                                         $title = $template['ACTIVATE_CHANGE_TITLE'];
892                                 }
893                                 else
894                                 {
895                                         $title = _ACTIVATE_CHANGE_TITLE;
896                                 }
897                                 if (array_key_exists('ACTIVATE_CHANGE_TEXT', $template) && !empty($template['ACTIVATE_CHANGE_TEXT']))
898                                 {
899                                         $text = $template['ACTIVATE_CHANGE_TEXT'];
900                                 }
901                                 else
902                                 {
903                                         $text = _ACTIVATE_CHANGE_TEXT;
904                                 }
905                                 break;
906                 }
907                 $aVars = array(
908                         'memberName'    => Entity::hsc($mem->getDisplayName()),
909                         'realName'              => Entity::hsc($mem->getRealName()),
910                 );
911                 switch ( $type )
912                 {
913                         case 'title':
914                                 echo TEMPLATE::fill($title, $aVars);
915                                 break;
916                         case 'text':
917                                 echo TEMPLATE::fill($text,  $aVars);
918                                 break;
919                         case 'ackey':
920                                 echo Entity::hsc($key);
921                                 break;
922                 }
923                 return;
924         }
925         
926         /**
927          * AdminActions::parse_addtickettourl()
928          * Parse skinvar addtickettourl
929          * 
930          * @param       string  $url    URI for ticket
931          * @return      void
932          */
933         public function parse_addtickettourl($url)
934         {
935                 global $manager;
936                 $url = $manager->addTicketToUrl($url);
937                 echo Entity::hsc($url);
938                 return;
939         }
940         
941         /**
942          * AdminActions::parse_adminbanlist()
943          * Parse skinvar adminbanlist
944          * 
945          * @param       string  $templateName   name of template to use
946          * @return      void
947          */
948         public function parse_adminbanlist($templateName = '')
949         {
950                 $blogid = intRequestVar('blogid');
951                 
952                 $query = "SELECT * FROM %s WHERE blogid=%d ORDER BY iprange;";
953                 $query = sprintf($query, sql_table('ban'), (integer) $blogid);
954                 
955                 $template['content'] = 'banlist';
956                 
957                 $amount = Showlist($query, 'table', $template, $templateName);
958                 
959                 if ( $amount == 0 )
960                 {
961                         echo _BAN_NONE;
962                 }
963                 return;
964         }
965         
966         /**
967          * AdminActions::parse_adminbatchaction()
968          * Parse skinvar adminbatchaction
969          * 
970          * @param       void
971          * @return      void
972          */
973         public function parse_adminbatchaction()
974         {
975                 echo Entity::hsc(requestVar('batchaction'));
976                 return;
977         }
978         
979         /**
980          * AdminActions::parse_adminbatchlist()
981          * Parse skinvar adminbatchlist
982          * 
983          * @param       string  $templateName   name of template to use
984          * @return      void
985          */
986         public function parse_adminbatchlist($templateName = '')
987         {
988                 global $manager;
989                 $templates = array();
990                 if ( !empty($templateName) )
991                 {
992                         $templates = Template::read($templateName);
993                 }
994                 if ( isset($templates['ADMIN_BATCHLIST']) || !empty($templates['ADMIN_BATCHLIST']) )
995                 {
996                         $template = $templates['ADMIN_BATCHLIST'];
997                 }
998                 else
999                 {
1000                         $template = '<li><%text(_BATCH_EXECUTING)%>'
1001                                   . '<b><%adminbatchaction%></b>'
1002                                   . '<%batchlisttype%>'
1003                                   . '<b><%batchid%></b>...'
1004                                   . '<b><%batchlistmsg%></b>'
1005                                   . '</li>' . "\n";
1006                 }
1007                 
1008                 $selected = requestIntArray('batch');
1009                 $action   = requestVar('batchaction');
1010                 
1011                 switch ( $this->skintype )
1012                 {
1013                         case 'batchitem':
1014                                 $batchlisttype  = _BATCH_ONITEM;
1015                                 $deleteaction   = 'deleteOneItem';
1016                                 $moveaction             = 'moveOneItem';
1017                                 $destid                 = intRequestVar('destcatid');
1018                                 break;
1019                         case 'batchcomment':
1020                                 $batchlisttype  = _BATCH_ONCOMMENT;
1021                                 $deleteaction   = 'deleteOneComment';
1022                                 break;
1023                         case 'batchmember':
1024                                 $batchlisttype  = _BATCH_ONMEMBER;
1025                                 $deleteaction   = 'deleteOneMember';
1026                                 $setadminsql    = sql_table('member') . ' SET madmin = 1 WHERE mnumber = ';
1027                                 $unsetchksql    = 'SELECT * FROM ' . sql_table('member') . ' WHERE madmin = 1 AND mcanlogin = 1';
1028                                 $unsetupsql             = sql_table('member') . ' SET madmin = 0 WHERE mnumber = ';
1029                                 $unseterrmsg    = _ERROR_ATLEASTONEADMIN;
1030                                 break;
1031                         case 'batchteam':
1032                                 $blogid                 = intRequestVar('blogid');
1033                                 $batchlisttype  = _BATCH_ONTEAM;
1034                                 $deleteaction   = 'deleteOneTeamMember';
1035                                 $setadminsql    = sql_table('team') . ' SET tadmin = 1 WHERE tblog = ' . $blogid . ' AND tmember = ';
1036                                 $unsetchksql    = 'SELECT * FROM ' . sql_table('team') . ' WHERE tadmin = 1 AND tblog = ' . $blogid;
1037                                 $unseterrmsg    = _ERROR_ATLEASTONEBLOGADMIN;
1038                                 $unsetupsql             = sql_table('team') . ' SET tadmin = 0 WHERE tblog = ' . $blogid . ' AND tmember = ';
1039                                 break;
1040                         case 'batchcategory':
1041                                 $batchlisttype  = _BATCH_ONCATEGORY;
1042                                 $deleteaction   = 'deleteOneCategory';
1043                                 $moveaction             = 'moveOneCategory';
1044                                 $destid                 = intRequestVar('destblogid');
1045                                 break;
1046                 }
1047                 
1048                 // walk over all selectedids and perform action
1049                 foreach ( $selected as $selectedid )
1050                 {
1051                         $error    = '';
1052                         $selectedid = intval($selectedid);
1053                         switch ( $action )
1054                         {
1055                                 case 'delete':
1056                                         if ( $this->skintype != 'batchteam' )
1057                                         {
1058                                                 $error = Admin::$deleteaction($selectedid);
1059                                         }
1060                                         else
1061                                         {
1062                                                 $error  = Admin::deleteOneTeamMember($blogid, $selectedid);
1063                                         }
1064                                         break;
1065                                 case 'move':
1066                                         $error = Admin::moveaction($selectedid, $destid);
1067                                         break;
1068                                 case 'setadmin':
1069                                         // always succeeds
1070                                         sql_query('UPDATE ' . $setadminsql . $selectedid);
1071                                         $error = '';
1072                                         break;
1073                                 case 'unsetadmin':
1074                                         // there should always remain at least one super-admin
1075                                         $r = sql_query($unsetchksql);
1076                                         if ( sql_num_rows($r) < 2 )
1077                                         {
1078                                                 $error = $unseterrmsg;
1079                                         }
1080                                         else
1081                                         {
1082                                                 sql_query('UPDATE ' . $unsetupsql . $selectedid);
1083                                         }
1084                                         break;
1085                                 default:
1086                                         $error = _BATCH_UNKNOWN . Entity::hsc($action);
1087                         }
1088                         $data = array(
1089                                 'batchid'                       => $selectedid,
1090                                 'batchlisttype'         => Entity::hsc($batchlisttype),
1091                                 'adminbatchaction'      => Entity::hsc($action),
1092                                 'batchlistmsg'          => $error ? $error : _BATCH_SUCCESS,
1093                         );
1094                         $handler = new Actions('template', $template, new ADMIN);
1095                         $parser  = new Parser($handler);
1096                         
1097                         ob_start();
1098                         $parser->parse($template);
1099                         $template = ob_get_contents();
1100                         ob_end_clean();
1101                         
1102                         echo TEMPLATE::fill($template, $data);
1103                         return;
1104                 }
1105         }
1106         
1107         /**
1108          * AdminActions::parse_adminbloglink()
1109          * Parse skinvar adminbloglink
1110          * 
1111          * @param       string  $templateName   name of template to use
1112          * @return      void
1113          */
1114         public function parse_adminbloglink($templateName = '')
1115         {
1116                 global $manager;
1117                 $blogid =  intRequestVar('blogid');
1118                 $blog   =& $manager->getBlog($blogid);
1119                 $templates = array();
1120                 
1121                 if ( !empty($templateName) )
1122                 {
1123                         $templates = Template::read($templateName);
1124                 }
1125                 
1126                 if ( isset($templates['ADMIN_BLOGLINK']) || !empty($templates['ADMIN_BLOGLINK']) )
1127                 {
1128                         $template = $templates['ADMIN_BLOGLINK'];
1129                 }
1130                 else
1131                 {
1132                         $template = '<a href="<%url%>" title="<%adminbloglinktitle%>"><%blogname%></a>';
1133                 }
1134                 
1135                 $data = array(
1136                         'url'                                   => Entity::hsc($blog->getURL()),
1137                         'adminbloglinktitle'    => _BLOGLIST_TT_VISIT,
1138                         'blogname'                              => Entity::hsc($blog->getName())
1139                 );
1140                 
1141                 echo TEMPLATE::fill($template, $data);
1142                 return;
1143         }
1144         
1145         /**
1146          * AdminActions::parse_adminerrormesg()
1147          * Parse skinvar adminerrormesg
1148          * 
1149          * @param       void
1150          * @return      void
1151          */
1152         public function parse_adminerrormesg()
1153         {
1154                 global $CONF;
1155                 $message = '';
1156                 
1157                 if ( requestVar('errormessage') )
1158                 {
1159                         $message = requestVar('errormessage');
1160                 }
1161                 elseif ( cookieVar($CONF['CookiePrefix'] . 'errormessage') )
1162                 {
1163                         $message = cookieVar($CONF['CookiePrefix'] . 'errormessage');
1164                 }
1165                 elseif ( Admin::sessionVar($CONF['CookiePrefix'] . 'errormessage') )
1166                 {
1167                         $message = Admin::sessionVar($CONF['CookiePrefix'] . 'errormessage');
1168                 }
1169                 echo Entity::hsc($message);
1170                 return;
1171         }
1172         
1173         /**
1174          * AdminActions::parse_adminskineditallowedlist()
1175          * Parse skinvar adminskineditallowedlist
1176          * 
1177          * @param       string  $type                   template/blog
1178          * @param       string  $templateName   name of template to use
1179          * @return      void
1180          */
1181         public function parse_adminskineditallowedlist($type = 'template', $templateName = '')
1182         {
1183                 switch ( $type )
1184                 {
1185                         /* TODO: blog seems not to be used */
1186                         case 'blog':
1187                                 $query = "SELECT bshortname, bname FROM %s";
1188                                 $query = sprintf($query, sql_table('blog'));
1189                                 $show  = array(
1190                                         'content' => 'shortblognames'
1191                                 );
1192                                 break;
1193                         case 'template':
1194                                 $query = "SELECT tdname as name, tddesc as description FROM %s;";
1195                                 $query = sprintf($query, sql_table('admintemplate_desc'));
1196                                 $show  = array(
1197                                         'content' => 'shortnames'
1198                                 );
1199                                 break;
1200                 }
1201                 Showlist($query, 'table', $show, $templateName);
1202                 return;
1203         }
1204         
1205         /**
1206          * AdminActions::parse_adminskinielist()
1207          * Parse skinvar adminskinielist
1208          * 
1209          * @param       string  $type                   skin/template
1210          * @param       string  $templateName   name of template to use
1211          * @return      void
1212          */
1213         public function parse_adminskinielist($type, $templateName = '')
1214         {
1215                 $templates = array();
1216                 if ( $templateName )
1217                 {
1218                         $templates = Template::read($templateName);
1219                 }
1220                 if ( isset($templates['SKINIE_EXPORT_LIST']) && !empty($templates['SKINIE_EXPORT_LIST']) )
1221                 {
1222                         $template = $templates['SKINIE_EXPORT_LIST'];
1223                 }
1224                 else
1225                 {
1226                         $template = '<td><input type="checkbox" name="<%typeid%>"  id="<%expid%>" /><label for="<%expid%>"><%expname%></label></td>' . "\n"
1227                                   . "<td><%expdesc%></td>\n"
1228                                   . "</tr><tr>\n";
1229                 }
1230                 switch ( $type )
1231                 {
1232                         case 'skin':
1233                                 $query = "SELECT * FROM %s WHERE sdincmode = 'admin';";
1234                                 $query = sprintf($query, sql_table('skin_desc'));
1235                                 $res = sql_query($query);
1236                                 
1237                                 while ( $skinObj = sql_fetch_object($res) )
1238                                 {
1239                                         $data = array(
1240                                                 'typeid'        => 'skin[' . $skinObj->sdnumber . ']',
1241                                                 'expid'         => 'skinexp' . $skinObj->sdnumber,
1242                                                 'expname'       => Entity::hsc($skinObj->sdname),
1243                                                 'expdesc'       => Entity::hsc($skinObj->sddesc),
1244                                         );
1245                                         echo TEMPLATE::fill($template, $data);
1246                                 }
1247                                 break;
1248                         case 'template':
1249                                 $query = "SELECT * FROM %s;";
1250                                 $query = sprintf($query, sql_table('admintemplate_desc'));
1251                                 $res = sql_query($query);
1252                                 while ( $templateObj = sql_fetch_object($res) )
1253                                 {
1254                                         $data = array(
1255                                                 'typeid'        => 'template[' . $templateObj->tdnumber . ']',
1256                                                 'expid'         => 'templateexp' . $templateObj->tdnumber,
1257                                                 'expname'       => Entity::hsc($templateObj->tdname),
1258                                                 'expdesc'       => Entity::hsc($templateObj->tddesc),
1259                                         );
1260                                         echo TEMPLATE::fill($template, $data);
1261                                 }
1262                                 break;
1263                 }
1264                 return;
1265         }
1266         
1267         /**
1268          * AdminActions::parse_adminskinoverview()
1269          * Parse skinvar adminskinoverview
1270          * 
1271          * @param       string  $templateName   name of template to use
1272          * @return      void
1273          */
1274         public function parse_adminskinoverview($templateName = '')
1275         {
1276                 $query = "SELECT * FROM %s WHERE sdincmode = 'admin' ORDER BY sdname;";
1277                 $query = sprintf($query, sql_table('skin_desc'));
1278                 
1279                 $template['content']    = 'adminskinlist';
1280                 $template['tabindex']   = 10;
1281                 $template['friendly_names'] = Skin::getFriendlyNames('AdminActions');
1282                 Showlist($query, 'table', $template, $templateName);
1283                 return;
1284         }
1285         
1286         /**
1287          * AdminActions::parse_adminskinselectoptions()
1288          * Parse skinvar adminskinselectoptions
1289          * 
1290          * @param       void
1291          * @return      void
1292          */
1293         public function parse_adminskinselectoptions()
1294         {
1295                 global $CONF;
1296                 $query = "SELECT sdname as text, sdnumber as value FROM %s WHERE sdincmode = 'admin';";
1297                 $query = sprintf($query, sql_table('skin_desc'));
1298                 
1299                 $template['name']        = 'adminskin';
1300                 $template['selected'] = $CONF['DefaultAdminSkin'];
1301                 $template['tabindex'] = 110;
1302                 Showlist($query, 'select', $template, '');
1303                 return;
1304         }
1305         
1306         /**
1307          * AdminActions::parse_adminspecialskinlist()
1308          * Parse skinvar adminspecialskinlist
1309          * 
1310          * @param       string  $templateName   name of template to use
1311          */
1312         public function parse_adminspecialskinlist($templateName = '')
1313         {
1314                 $templates = array();
1315                 if ( $templateName )
1316                 {
1317                         $templates = Template::read($templateName);
1318                 }
1319                 
1320                 $nType  = Skin::getFriendlyNames('AdminActions');
1321                 $skinid = intRequestVar('skinid');
1322                 
1323                 $query = "SELECT stype FROM  %s WHERE stype NOT IN (%s) AND sdesc=%d;";
1324                 $query = sprintf($query, sql_table('skin'), "'" . implode("', '", $nType) . "'", (integer) $skinid);
1325                 
1326                 $res    = sql_query($query);
1327                 if ( $res && sql_num_rows($res) > 0 )
1328                 {
1329                         $data = array();
1330                         if ( array_key_exists('ADMIN_SPECIALSKINLIST_HEAD', $templates) && !empty($templates['ADMIN_SPECIALSKINLIST_HEAD']) )
1331                         {
1332                                 $template['head'] = $templates['ADMIN_SPECIALSKINLIST_HEAD'];
1333                         }
1334                         else
1335                         {
1336                                 $template['head'] = "<ul>\n";
1337                         }
1338                         echo TEMPLATE::fill($template['head'], $data);
1339                         
1340                         if ( array_key_exists('ADMIN_SPECIALSKINLIST_BODY', $templates) && !empty($templates['ADMIN_SPECIALSKINLIST_BODY']) )
1341                         {
1342                                 $template['body'] = $templates['ADMIN_SPECIALSKINLIST_BODY'];
1343                         }
1344                         else
1345                         {
1346                                 $template['body'] = '<li>'
1347                                                   . '<a tabindex="<%tabindex%>" href="index.php?action=adminskinedittype&amp;skinid=<%skinid%>&amp;type=<%skintype%>">'
1348                                                   . '<%skintype%>'
1349                                                   . '</a>'
1350                                                   . '(<a tabindex="<%tabindex%>" href="index.php?action=adminskinremovetype&amp;skinid=<%skinid%>&amp;type=<%skintype%>">'
1351                                                   . 'remove'
1352                                                   . '</a>)'
1353                                                   . "</li>\n";
1354                         }
1355                         $tabstart = 120;
1356                         while ( $row = sql_fetch_assoc($res) )
1357                         {
1358                                 $data = array(
1359                                         'tabindex'      => $tabstart++,
1360                                         'skinid'        => $skinid,
1361                                         'skintype'      => Entity::hsc(strtolower($row['stype']))
1362                                 );
1363                                 echo TEMPLATE::fill($template['body'], $data);
1364                         }
1365                         
1366                         $data = array();
1367                         if ( array_key_exists('ADMIN_SPECIALSKINLIST_FOOT', $templates) && !empty($templates['ADMIN_SPECIALSKINLIST_FOOT']) )
1368                         {
1369                                 $template['foot'] = $templates['ADMIN_SPECIALSKINLIST_FOOT'];
1370                         }
1371                         else
1372                         {
1373                                 $template['foot'] = "</ul>\n";
1374                         }
1375                         echo TEMPLATE::fill($template['foot'], $data);
1376                 }
1377                 return;
1378         }
1379         
1380         /**
1381          * AdminActions::parse_admintemplateoverview()
1382          * Parse skinvar admintemplateoverview
1383          * 
1384          * @param       string  $templateName   name of template to use
1385          * @return      void
1386          */
1387         public function parse_admintemplateoverview($templateName = '')
1388         {
1389                 $query  = "SELECT * FROM %s ORDER BY tdname;";
1390                 $query = sprintf($query, sql_table('admintemplate_desc'));
1391                 
1392                 $template['content']  = 'admintemplatelist';
1393                 $template['tabindex'] = 10;
1394                 
1395                 Showlist($query, 'table', $template, $templateName);
1396                 return;
1397         }
1398         
1399         /**
1400          * AdminActions::parse_allowedadminskinactions()
1401          * Parse skinvar allowedadminskinactions
1402          * 
1403          * @param       void
1404          * @return      void
1405          */
1406         public function parse_allowedadminskinactions()
1407         {
1408                 global $DIR_ADMINSKINS;
1409                 $skinType = strtolower(trim(requestVar('type')));
1410                 $actions  = Skin::getAllowedActionsForType($skinType);
1411                 sort($actions);
1412                 
1413                 while ( $current = array_shift($actions) )
1414                 {
1415                         // skip deprecated vars
1416                         if ($current == 'ifcat' || $current == 'imagetext' || $current == 'vars')
1417                         {
1418                                 continue;
1419                         }
1420                         
1421                         echo helplink("adminskinvar-{$current}") . "$current</a>\n";
1422 //                      echo "<a href=\"{$DIR_ADMINSKINS}documentation/help.html#{$current}\" onclick=\"if (event &amp;&amp; event.preventDefault) event.preventDefault(); return help(this.href);\">{$current}</a>\n";
1423                         
1424                         if ( count($actions) != 0 )
1425                         {
1426                                 echo ", ";
1427                         }
1428                 }
1429                 return;
1430         }
1431         
1432         /**
1433          * AdminActions::parse_allowedskinactions()
1434          * Parse skinvar allowedskinactions
1435          * 
1436          * @param       void
1437          * @return      void
1438          */
1439         public function parse_allowedskinactions()
1440         {
1441                 $skinType = strtolower(trim(requestVar('type')));
1442                 $actions  = SKIN::getAllowedActionsForType($skinType);
1443                 sort($actions);
1444                 
1445                 while ( $current = array_shift($actions) )
1446                 {
1447                         // skip deprecated vars
1448                         if ( $current == 'ifcat' || $current == 'imagetext' || $current == 'vars' )
1449                         {
1450                                 continue;
1451                         }
1452                         
1453                         /* TODO: alternative function should be used or not?  */
1454                         echo helplink("skinvar-{$current}") . "$current</a>\n";
1455                         
1456                         if ( count($actions) != 0 )
1457                         {
1458                                 echo ", ";
1459                         }
1460                 }
1461                 return;
1462         }
1463         
1464         /**
1465          * AdminActions::parse_banlistdeletedlist()
1466          * Parse skinvar banlistdeletedlist
1467          * 
1468          * @param       string  $templateName   name of template to use
1469          * @return      void
1470          */
1471         public function parse_banlistdeletedlist($templateName = '')
1472         {
1473                 global $manager;
1474                 $templates = array();
1475                 
1476                 if ( $templateName )
1477                 {
1478                         $templates = Template::read($templateName);
1479                 }
1480                 if ( isset($templates['BANLIST_DELETED_LIST']) && !empty($templates['BANLIST_DELETED_LIST']) )
1481                 {
1482                         $template = $templates['BANLIST_DELETED_LIST'];
1483                 }
1484                 else
1485                 {
1486                         $template = "<li><%blogname%></li>\n";
1487                 }
1488                 $deleted = requestArray('delblogs');
1489                 foreach ( $deleted as $delblog )
1490                 {
1491                         $blog =& $manager->getBlog($delblog);
1492                         $data =  array(
1493                                 Entity::hsc($blog->getName())
1494                         );
1495                         TEMPLATE::fill($template, $data);
1496                 }
1497                 return;
1498         }
1499         
1500         /**
1501          * AdminActions::parse_batchdeletelist()
1502          * Parse skinvar batchdeletelist
1503          * 
1504          * @param       void
1505          * @return      void
1506          */
1507         public function parse_batchdeletelist()
1508         {
1509                 $selected = requestIntArray('batch');
1510                 $index  = 0;
1511                 
1512                 foreach ( $selected as $select )
1513                 {
1514                         echo '<input type="hidden" name="batch[' . ($index++) . ']" value="' . intval($select) . "\" />\n";
1515                 }
1516                 // add hidden vars for team & comment
1517                 if ( requestVar('action') == 'batchteam' )
1518                 {
1519                         echo '<input type="hidden" name="blogid" value="' . intRequestVar('blogid') . "\" />\n";
1520                 }
1521                 if ( requestVar('action') == 'batchcomment' )
1522                 {
1523                         echo '<input type="hidden" name="itemid" value="' . intRequestVar('itemid') . "\" />\n";
1524                 }
1525                 return;
1526         }
1527         
1528         /**
1529          * AdminActions::parse_batchdeletetype()
1530          * Parse skinvar batchdeletetype
1531          * 
1532          * @param       void
1533          * @return      void
1534          */
1535         public function parse_batchdeletetype()
1536         {
1537                 echo Entity::hsc(requestVar('action'));
1538                 return;
1539         }
1540
1541         /**
1542          * AdminActions::parse_batchmovebtn()
1543          * Parse skinvar batchmovebtn
1544          * 
1545          * @param       void
1546          * @return      void
1547          */
1548         public function parse_batchmovebtn()
1549         {
1550                 $actionType = requestVar('action');
1551                 switch ( $actionType )
1552                 {
1553                         case 'batchitem':
1554                                 echo _MOVE_BTN;
1555                                 break;
1556                         case 'batchcategory':
1557                                 echo _MOVECAT_BTN;
1558                                 break;
1559                 }
1560                 return;
1561         }
1562         
1563         /**
1564          * AdminActions::parse_batchmovelist()
1565          * Parse skinvar batchmovelist
1566          * 
1567          * @param       void
1568          * @param       void
1569          */
1570         public function parse_batchmovelist()
1571         {
1572                 $selected = requestIntArray('batch');
1573                 foreach ( $selected as $select )
1574                 {
1575                         echo '<input type="hidden" name="batch[' . ($select++) . ']" value="' . intval($select) . "\" />\n";
1576                 }
1577                 return;
1578         }
1579         
1580         /**
1581          * AdminActions::parse_batchmovetitle()
1582          * Parse skinvar batchmovetitle
1583          * 
1584          * @param       void
1585          * @return      void
1586          */
1587         public function parse_batchmovetitle()
1588         {
1589                 $actionType = requestVar('action');
1590                 switch ( $actionType )
1591                 {
1592                         case 'batchitem':
1593                                 echo _MOVE_TITLE;
1594                                 break;
1595                         case 'batchcategory':
1596                                 echo _MOVECAT_TITLE;
1597                                 break;
1598                 }
1599                 return;
1600         }
1601         
1602         /**
1603          * AdminActions::parse_batchmovetype()
1604          * Parse skinvar batchmovetype
1605          * 
1606          * @param       void
1607          * @return      void
1608          */
1609         public function parse_batchmovetype()
1610         {
1611                 echo Entity::hsc(requestVar('action'));
1612                 return;
1613         }
1614         
1615         /**
1616          * AdminActions::parse_blogcatlist()
1617          * Parse skinvar blogcatlist
1618          * 
1619          * @param       void
1620          * @return      void
1621          */
1622         public function parse_blogcatlist()
1623         {
1624                 global $manager;
1625                 $blogid = intRequestVar('blogid');
1626                 $query  = "SELECT * FROM %s WHERE cblog = %d ORDER BY cname;";
1627                 $query = sprintf($query, sql_table('category'), (integer) $blogid);
1628                 
1629                 $template['content']  = 'categorylist';
1630                 $template['tabindex'] = 200;
1631                 
1632                 $batch = new Batch('member');
1633                 $batch->showlist($query, 'table', $template);
1634                 return;
1635         }
1636         
1637         /**
1638          * AdminActions::parse_blognotifysetting()
1639          * Parse skinvar blognotifysetting
1640          * 
1641          * @param       void
1642          * @return      void
1643          */
1644         public function parse_blognotifysetting($type)
1645         {
1646                 global $manager;
1647                 $blogid = intRequestVar('blogid');
1648                 $blog   = $manager->getBlog($blogid);
1649                 
1650                 switch ( $type )
1651                 {
1652                         case 'comment':
1653                                 if ( !$blog->notifyOnComment() )
1654                                 {
1655                                         return;
1656                                 }
1657                                 break;
1658                         case 'vote':
1659                                 if ( !$blog->notifyOnVote() )
1660                                 {
1661                                         return;
1662                                 }
1663                                 break;
1664                         case 'newitem':
1665                                 if ( !$blog->notifyOnNewItem() )
1666                                 {
1667                                         return;
1668                                 }
1669                                 break;
1670                 }
1671                 echo ' checked="checked"';
1672                 return;
1673         }
1674         
1675         /**
1676          * AdminActions::parse_blogselectbox()
1677          * Parse skinvar blogselectbox
1678          * 
1679          * @param       void
1680          * @return      void
1681          */
1682         public function parse_blogselectbox()
1683         {
1684                 global $member;
1685                 
1686                 $selectData     = requestVar('selectData');
1687                 $mode           = $selectData['mode'];
1688                 $name           = Entity::hsc($selectData['name']);
1689                 $tabindex       = Entity::hsc($selectData['tabindex']);
1690                 $aBlogIds       = array_map('intval', $selectData['aBlogIds']);
1691                 $showNewCat     = intval($selectData['showNewCat']);
1692                 $selected       = intval($selectData['selected']);
1693                 
1694                 echo "<select name=\"{$name}\" tabindex=\"{$tabindex}\">\n";
1695                 
1696                 // 1. select blogs (we'll create optiongroups)
1697                 // (only select those blogs that have the user on the team)
1698                 $queryBlogs = "SELECT bnumber, bname FROM %s WHERE bnumber in (%s) ORDER BY bname;";
1699                 $queryBlogs = sprintf($queryBlogs, sql_table('blog'), implode(',', $aBlogIds));
1700                 $blogs = sql_query($queryBlogs);
1701                 
1702                 if ( $mode == 'category' )
1703                 {
1704                         if ( sql_num_rows($blogs) > 1 )
1705                         {
1706                                 $multipleBlogs = 1;
1707                         }
1708                         while ( $oBlog = sql_fetch_object($blogs) )
1709                         {
1710                                 if ( isset($multipleBlogs) && !empty($multipleBlogs) )
1711                                 {
1712                                         echo '<optgroup label="' . Entity::hsc($oBlog->bname) . "\>\n";
1713                                 }
1714                                 
1715                                 // show selection to create new category when allowed/wanted
1716                                 if ( $showNewCat )
1717                                 {
1718                                         // check if allowed to do so
1719                                         if ( $member->blogAdminRights($oBlog->bnumber) )
1720                                         {
1721                                                 echo '<option value="newcat-' . $oBlog->bnumber . '">' . _ADD_NEWCAT . "</option>\n";
1722                                         }
1723                                 }
1724                                 
1725                                 // 2. for each category in that blog
1726                                 $catQueriy  = "SELECT cname, catid FROM %s WHERE cblog=%d ORDER BY cname ASC;";
1727                                 $catQuery = sprintf($catQuery, sql_table('category'), (integer) $oBlog->bnumber);
1728                                 $categories = sql_query(sprintf($catQueriy));
1729                                 while ( $oCat = sql_fetch_object($categories) )
1730                                 {
1731                                         if ( $oCat->catid == $selected )
1732                                         {
1733                                                 $selectText = ' selected="selected" ';
1734                                         }
1735                                         else
1736                                         {
1737                                                 $selectText = '';
1738                                         }
1739                                         echo '<option value="' . $oCat->catid . '" ' . $selectText . '>' . Entity::hsc($oCat->cname) . "</option>\n";
1740                                 }
1741                                 
1742                                 if ( isset($multipleBlogs) && !empty($multipleBlogs) )
1743                                 {
1744                                         echo '</optgroup>';
1745                                 }
1746                         }
1747                 }
1748                 else
1749                 {
1750                         // blog mode
1751                         while ( $oBlog = sql_fetch_object($blogs) )
1752                         {
1753                                 echo '<option value="' . $oBlog->bnumber . '"';
1754                                 if ( $oBlog->bnumber == $selected )
1755                                 {
1756                                         echo '<option value="' . $oBlog->bnumber . '" selected="selected">' . Entity::hsc($oBlog->bname) . "</option>\n";
1757                                 }
1758                                 else
1759                                 {
1760                                         echo '<option value="' . $oBlog->bnumber . '">' . Entity::hsc($oBlog->bname) . "</option>\n";
1761                                 }
1762                         }
1763                 }
1764                 echo "</select>\n";
1765                 return;
1766         }
1767         
1768         /**
1769          * AdminActions::parse_blogsetting()
1770          * Parse skinvar blogsetting
1771          * 
1772          * @param       string  $which  name of weblog setting
1773          * @return      void
1774          */
1775         public function parse_blogsetting($which)
1776         {
1777                 echo $this->parse_getblogsetting($which);
1778                 return;
1779         }
1780         
1781         /**
1782          * AdminActions::parse_blogsettingyesno()
1783          * Parse skinvar blogsettingyesno
1784          * 
1785          * @param       string  $type                   type of weblog setting
1786          * @param       string  $templateName   name of template to use
1787          * @return      void
1788          */
1789         public function parse_blogsettingyesno($type, $templateName = '')
1790         {
1791                 global $manager;
1792                 
1793                 $blogid = intRequestVar('blogid');
1794                 $blog   = $manager->getBlog($blogid);
1795                 
1796                 switch ( $type )
1797                 {
1798                         case 'convertbreaks':
1799                                 $checkedval = $blog->convertBreaks();
1800                                 $tabindex   = 55;
1801                                 break;
1802                         case 'allowpastposting':
1803                                 $checkedval = $blog->allowPastPosting();
1804                                 $tabindex   = 57;
1805                                 break;
1806                         case 'comments':
1807                                 $checkedval = $blog->commentsEnabled();
1808                                 $tabindex   = 60;
1809                                 break;
1810                         case 'public':
1811                                 $checkedval = $blog->isPublic();
1812                                 $tabindex   = 70;
1813                                 break;
1814                         case 'reqemail':
1815                                 $checkedval = $blog->emailRequired();
1816                                 $tabindex   = 72;
1817                                 break;
1818                         case 'searchable':
1819                                 $checkedval = $blog->getSearchable();
1820                                 $tabindex   = 122;
1821                                 break;
1822                 }
1823                 $this->parse_inputyesno($type, $checkedval, $tabindex, 1, 0, _YES, _NO, 0, $templateName);
1824                 return;
1825         }
1826         
1827         /**
1828          * AdminActions::parse_blogteamlist()
1829          * Parse skinvar blogteamlist
1830          * 
1831          * @param       string  $templateName   name of template to use
1832          * @return      void
1833          */
1834         public function parse_blogteamlist($templateName = '')
1835         {
1836                 global $manager;
1837                 $blogid = intRequestVar('blogid');
1838                 $query  = "SELECT tblog, tmember, mname, mrealname, memail, tadmin "
1839                         . "FROM %s, %s "
1840                         . "WHERE tmember=mnumber AND tblog= %d";
1841                 $query = sprintf($query, sql_table('member'), sql_table('team'), (integer) $blogid);
1842                 
1843                 $template['content']  = 'teamlist';
1844                 $template['tabindex'] = 10;
1845
1846                 $batch = new Batch('team');
1847                 $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);
1848                 return;
1849         }
1850         
1851         /**
1852          * AdminActions::parse_blogteammembers()
1853          * Parse skinvar blogteammembers
1854          * 
1855          * @param       void
1856          * @return      void
1857          */
1858         public function parse_blogteammembers()
1859         {
1860                 $blogid = intRequestVar('blogid');
1861                 $query  = "SELECT mname, mrealname "
1862                                 . "FROM %s, %s "
1863                                 . "WHERE mnumber=tmember AND tblog=%d;";
1864                 $query = sprintf($query, sql_table('member'), sql_table('team'), (integer) $blogid);
1865                 $res    = sql_query($query);
1866                 $memberNames = array();
1867                 while ($o = sql_fetch_object($res)) {
1868                         $memberNames[] = Entity::hsc($o->mname) . ' (' . Entity::hsc($o->mrealname). ')';
1869                 }
1870                 echo implode(',', $memberNames);
1871         }
1872         
1873         /**
1874          * AdminActions::parse_blogtime()
1875          * Parse skinvar blogtime
1876          * 
1877          * @param       string  $type   type of time
1878          * @param       string  $format format for time expression
1879          * @param       integer $offset offset of time
1880          * @return      void
1881          */
1882         public function parse_blogtime($type, $format = '%H:%M', $offset = 0)
1883         {
1884                 global $manager;
1885                 
1886                 if ( $type != 'blogtime' )
1887                 {
1888                         /* return server time */
1889                         $timestamp = time() + $offset;
1890                 }
1891                 else
1892                 {
1893                         $bid            = intRequestVar('blogid');
1894                         $b                      = $manager->getBlog($bid);
1895                         $timestamp      = $b->getCorrectTime() + $offset;
1896                 }
1897                 
1898                 echo i18n::formatted_datetime($format, $timestamp);
1899                 return;
1900         }
1901         
1902         /**
1903          * AdminActions::parse_bookmarkletadmin()
1904          * Parse skinvar bookmarkletadmin
1905          * 
1906          * @param       void
1907          * @return      void
1908          */
1909         public function parse_bookmarkletadmin()
1910         {
1911                 global $manager;
1912                 
1913                 $blogid = intRequestVar('blogid');
1914                 
1915                 echo Entity::hsc(getBookmarklet($blogid));
1916                 return;
1917         }
1918         
1919         /**
1920          * AdminActions::parse_category()
1921          * Parse skinvar category
1922          * 
1923          * @param       string  $type   name of setting for category
1924          * @return      void
1925          */
1926         public function parse_category($type = 'name')
1927         {
1928                 echo $this->parse_getcategory($type);
1929                 return;
1930         }
1931         
1932         /**
1933          * AdminActions::parse_categorysetting()
1934          * Parse skinvar categorysetting
1935          * 
1936          * @param       string  $type   type in category setting
1937          * @return      void
1938          */
1939         public function parse_categorysetting($type)
1940         {
1941                 $catid  = intRequestVar('catid');
1942                 if ( $type == 'id' )
1943                 {
1944                         echo $catid;
1945                         return;
1946                 }
1947                 $blogid = intRequestVar('blogid');
1948                 $query  = "SELECT * FROM %s WHERE cblog = %d AND catid = %d;";
1949                 $query  = sprintf($query, sql_table('category'), (integer) $blogid, (integer) $catid);
1950                 $res    = sql_query($query);
1951                 $obj    = sql_fetch_object($res);
1952                 
1953                 if ( $type != desc )
1954                 {
1955                         echo Entity::hsc($obj->cdesc);
1956                 }
1957                 else
1958                 {
1959                         echo Entity::hsc($obj->cname);
1960                 }
1961                 
1962                 return;
1963         }
1964         
1965         /**
1966          * AdminActions::parse_codename()
1967          * Parse templatevar codename
1968          * 
1969          * @param       void
1970          * @return      void
1971          * 
1972          * TODO: is this need???
1973          */
1974         public function parse_codename()
1975         {
1976                 global $nucleus;
1977                 echo $nucleus['codename'];
1978                 return;
1979         }
1980         
1981         /**
1982          * AdminActions::parse_commentnavlist()
1983          * Parse skinvar commentnavlist
1984          * 
1985          * @param       void
1986          * @return      void
1987          */
1988         public function parse_commentnavlist()
1989         {
1990                 global $CONF, $manager, $member;
1991                 
1992                 // start index
1993                 if ( postVar('start') )
1994                 {
1995                         $start = intPostVar('start');
1996                 }
1997                 else
1998                 {
1999                         $start = 0;
2000                 }
2001                 
2002                 // amount of items to show
2003                 if ( postVar('amount') )
2004                 {
2005                         $amount = intPostVar('amount');
2006                 }
2007                 else
2008                 {
2009                         $amount = (integer) $CONF['DefaultListSize'];
2010                         if ( $amount < 1 )
2011                         {
2012                                 $amount = 10;
2013                         }
2014                 }
2015                 $query = 'SELECT cbody, cuser, cmail, cemail, mname, ctime, chost, cnumber, cip, citem '
2016                        . 'FROM %s '
2017                        . 'LEFT OUTER JOIN %s ON  mnumber=cmember '
2018                        . 'WHERE ';
2019                 $query = sprintf($query, sql_table('comment'), sql_table('member'));
2020                 
2021                 if ( $this->skintype == 'itemcommentlist' )
2022                 {
2023                         $itemid                                 = intRequestVar('itemid');
2024                         $query                                  .= " citem={$itemid}";
2025                         $template['canAddBan']  = $member->blogAdminRights(intRequestVar('blogid'));
2026                         $bid                                    = 0;
2027                         $nonComments                    = _NOCOMMENTS;
2028                 }
2029                 elseif ( $this->skintype == 'browseowncomments' )
2030                 {
2031                         $itemid                                 = 0;
2032                         $query                                  .= ' cmember=' . $member->getID();
2033                         $template['canAddBan']  = 0;
2034                         $bid                                    = 0;
2035                         $nonComments                    = _NOCOMMENTS_YOUR;
2036                 }
2037                 elseif ( $this->skintype == 'blogcommentlist' )
2038                 {
2039                         $itemid                                 = 0;
2040                         $query                                  .= ' cblog=' . intRequestVar('blogid');
2041                         $template['canAddBan']  = $member->blogAdminRights(intRequestVar('blogid'));
2042                         $bid                                    = intRequestVar('blogid');
2043                         $nonComments                    = _NOCOMMENTS_BLOG;
2044                 }
2045                 
2046                 $search = postVar('search');
2047                 if ( !empty($search) )
2048                 {
2049                         $query .= ' and cbody LIKE "%' . sql_real_escape_string($search) . '%"';
2050                 }
2051                 
2052                 $query .= " ORDER BY ctime ASC LIMIT {$start},{$amount}";
2053                 
2054                 $template['content'] = 'commentlist';
2055                 
2056                 $navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $bid, $search, $itemid);
2057                 $navList->showBatchList('comment', $query, 'table', $template, $nonComments);
2058                 return;
2059         }
2060         
2061         /**
2062          * AdminActions::parse_configsettingsedit()
2063          * Parse skinvar configsettingsedit
2064          * 
2065          * @param       string  $type   type of global configuration
2066          * @return      void
2067          */
2068         public function parse_configsettingsedit($type)
2069         {
2070                 global $CONF;
2071                 switch ( $type )
2072                 {
2073                         case 'DefaultListSize':
2074                                 if ( !array_key_exists('DefaultListSize', $CONF) )
2075                                 {
2076                                         $query = "INSERT INTO %s VALUES (DefaultListSize, 10);";
2077                                         $query = sprintf($query, sql_table('config'));
2078                                         sql_query($query);
2079                                         $CONF['DefaultListSize'] = 10;
2080                                 }
2081                                 elseif ( intval($CONF['DefaultListSize']) < 1 )
2082                                 {
2083                                         $CONF['DefaultListSize'] = 10;
2084                                 }
2085                                 echo intval($CONF['DefaultListSize']);
2086                                 break;
2087                         case 'SessionCookie':
2088                                 $value = $CONF['SessionCookie'];
2089                                 $txt1  = _SETTINGS_COOKIESESSION;
2090                                 $txt2  = _SETTINGS_COOKIEMONTH;
2091                                 $this->parse_inputyesno('SessionCookie', $value, 10190, 1, 0, $txt1, $txt2);
2092                                 break;
2093                         case 'URLMode':
2094                                 $value = $CONF['URLMode'];
2095                                 $txt1  = _SETTINGS_URLMODE_NORMAL;
2096                                 $txt2  = _SETTINGS_URLMODE_PATHINFO;
2097                                 $this->parse_inputyesno('URLMode', $value, 10077, 'normal', 'pathinfo', $txt1, $txt2);
2098                                 break;
2099                         default:
2100                                 if ( array_key_exists($type, $CONF) && is_string($CONF[$type]) )
2101                                 {
2102                                         echo  Entity::hsc($CONF[$type]);
2103                                 }
2104                                 break;
2105                 }
2106                 return;
2107         }
2108         
2109         /**
2110          * AdminActions::parse_configsettingsyesno()
2111          * Parse skinvar configsettingsyesno
2112          * 
2113          * @param       string  $type           type of global setting
2114          * @param       integer $tabindex       tabindex attribute of input element
2115          * @return      void
2116          */
2117         public function parse_configsettingsyesno($type, $tabindex)
2118         {
2119                 global $CONF;
2120                 if ( array_key_exists($type, $CONF) )
2121                 {
2122                         $this->parse_inputyesno($type, $CONF[$type], $tabindex);
2123                 }
2124                 return;
2125         }
2126         
2127         /**
2128          * AdminActions::parse_customhelplink()
2129          * Parse skinvar customhelplink
2130          * 
2131          * @param       string  $topic          name of topic
2132          * @param       string  $tplName        name of template
2133          * @param       string  $url            string as URI
2134          * @param       string  $iconURL        string as URI for icon
2135          * @param       string  $alt            alternative text for image element
2136          * @param       string  $title          title for anchor element
2137          * @return      void
2138          */
2139         public function parse_customhelplink($topic, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
2140         {
2141                 $this->customHelp($topic, $url, $iconURL);
2142                 return;
2143         }
2144         
2145         /**
2146          * AdminActions::parse_date()
2147          * Parse skinvar date
2148          */
2149         public function parse_date($format = 'c')
2150         {
2151                 global $CONF, $manager;
2152                 echo i18n::formatted_datetime($format, time(), 'iso8601', $manager->getBlog((integer) $CONF['DefaultBlog']));
2153                 return;
2154         }
2155         
2156         /**
2157          * AdminActions::parse_defaultadminskintypes()
2158          * Parse skinvar defaultadminskintypes
2159          * 
2160          * @param       string  $tabindex               index number for tabindex attribute of input element
2161          * @param       string  $templateName   name of template
2162          * @return      void
2163          */
2164         public function parse_defaultadminskintypes($tabindex, $templateName = '')
2165         {
2166                 $templates = array();
2167                 if ( $templateName )
2168                 {
2169                         $templates = Template::read($templateName);
2170                 }
2171                 
2172                 $types   = Skin::getFriendlyNames('AdminActions');
2173                 ksort($types);
2174                 
2175                 if ( array_key_exists('ADMINSKINTYPELIST_HEAD', $templates) && !empty($templates['ADMINSKINTYPELIST_HEAD']) )
2176                 {
2177                         $template['head'] = $templates['ADMINSKINTYPELIST_HEAD'];
2178                 }
2179                 else
2180                 {
2181                         $template['head'] = "<ul>\n";
2182                 }
2183                 
2184                 echo $template['head'];
2185                 
2186                 if ( array_key_exists('ADMINSKINTYPELIST_BODY', $templates) && !empty($templates['ADMINSKINTYPELIST_BODY']) )
2187                 {
2188                         $template['body'] = $templates['ADMINSKINTYPELIST_BODY'];
2189                 }
2190                 else
2191                 {
2192                         $template['body'] = '<li><a tabindex="<%tabindex%>" href="index.php?action=adminskinedittype&amp;skinid=<%skinid%>&amp;type=<%skintype%>">'
2193                                           . "<%name%></a> <%help%></li>\n";
2194                 }
2195                 $handler = new Actions('template', $template, new ADMIN);
2196                 $parser  = new PARSER(Actions::getDefinedActions(), $handler);
2197                 
2198                 foreach ( $types as $type => $fName )
2199                 {
2200                         $helplink = $this->customHelpHtml('skinpart' . $type, $templateName);
2201                         $data = array(
2202                                 'tabindex'      => $tabindex,
2203                                 'skintype'      => $type,
2204                                 'name'          => $fName,
2205                                 'help'          => $helplink,
2206                                 'skinid'        => intrequestVar('skinid'),
2207                         );
2208                         $templateBody = Template::fill($template['body'], $data);
2209                         $parser->parse($templateBody);
2210                         $tabindex++;
2211                 }
2212                 if ( array_key_exists('ADMINSKINTYPELIST_FOOT', $templates) && !empty($templates['ADMINSKINTYPELIST_FOOT']) )
2213                 {
2214                         $template['foot'] = $templates['ADMINSKINTYPELIST_FOOT'];
2215                 }
2216                 else
2217                 {
2218                         $template['foot'] = "           </ul>\n";
2219                 }
2220                 echo $template['foot'];
2221                 return;
2222         }
2223         
2224         /**
2225          * AdminActions::parse_defblogselect()
2226          * Parse skinvar defblogselect
2227          * 
2228          * @param       string  $templateName   name of template
2229          * @return      void
2230          */
2231         public function parse_defblogselect($templateName = '')
2232         {
2233                 global $CONF;
2234                 $query  = "SELECT bname as text, bnumber as value FROM %s;";
2235                 $query = sprintf($query, sql_table('blog'));
2236                 $template['name']        = 'DefaultBlog';
2237                 $template['selected'] = $CONF['DefaultBlog'];
2238                 $template['tabindex'] = 10;
2239                 Showlist($query, 'select', $template, $templateName);
2240                 return;
2241         }
2242         
2243         /**
2244          * AdminActions::parse_defcatselect()
2245          * Parse skinvar defcatselect
2246          * 
2247          * @param       string  $templateName   name of template
2248          * @return      void
2249          */
2250         public function parse_defcatselect($templateName = '')
2251         {
2252                 global $manager;
2253                 $blogid = intRequestVar('blogid');
2254                 $blog   = $manager->getBlog($blogid);
2255                 $query  = "SELECT cname as text, catid as value FROM %s WHERE cblog=%d;";
2256                 $query = sprintf($query, sql_table('category'), (integer) $blog->getID());
2257                 $template['name']        = 'defcat';
2258                 $template['selected'] = $blog->getDefaultCategory();
2259                 $template['tabindex'] = 110;
2260                 Showlist($query, 'select', $template, $templateName);
2261                 return;
2262         }
2263         
2264         /**
2265          * AdminActions::parse_defskinselect()
2266          * Parse skinvar defskinselect
2267          * 
2268          * @param       string  $type                   type of skin
2269          * @param       string  $templateName   name of template
2270          * @return      void
2271          */
2272         public function parse_defskinselect($type = 'blog', $templateName = '')
2273         {
2274                 global $manager;
2275                 $query  = "SELECT sdname as text, sdnumber as value FROM %s;";
2276                 $query = sprintf($query, sql_table('skin_desc'));
2277                 
2278                 $blogid = intRequestVar('blogid');
2279                 
2280                 if ( !$blogid )
2281                 {
2282                         global $CONF;
2283                         $template['selected'] = $CONF['BaseSkin'];
2284                 }
2285                 else
2286                 {
2287                         $blog                            = $manager->getBlog($blogid);
2288                         $template['selected'] = $blog->getDefaultSkin();
2289                 }
2290                 
2291                 if ( $type != 'blog' )
2292                 {
2293                         $nname = 'BaseSkin';
2294                 }
2295                 else
2296                 {
2297                         $nname = 'defskin';
2298                 }
2299                 
2300                 $template['name']        = $nname;
2301                 $template['tabindex'] = 50;
2302                 Showlist($query, 'select', $template, $templateName);
2303                 return;
2304         }
2305         
2306         /**
2307          * AdminActions::parse_deletecomment()
2308          * Parse skinvar deletecomment
2309          * 
2310          * @param       string  $type   type of infomation for comment
2311          * @return      void
2312          */
2313         public function parse_deletecomment($type = 'id')
2314         {
2315                 $commentid      = intRequestVar('commentid');
2316                 $comment        = COMMENT::getComment($commentid);
2317                 
2318                 switch ( $type )
2319                 {
2320                         case 'id':
2321                                 echo intRequestVar('commentid');
2322                                 break;
2323                         case 'author':
2324                                 if ( array_key_exists('member', $comment) && !empty($comment['member']) )
2325                                 {
2326                                         echo $comment['member'];
2327                                 }
2328                                 else
2329                                 {
2330                                         echo $comment['user'];
2331                                 }
2332                                 break;
2333                         case 'body':
2334                                 $body = strip_tags($comment['body']);
2335                                 echo Entity::hsc(shorten($body, 300, '...'));
2336                 }
2337                 return;
2338         }
2339         
2340         /**
2341          * AdminActions::parse_deleteitembody()
2342          * Parse skinvar deleteitembody
2343          * 
2344          * @param       void
2345          * @return      void
2346          */
2347         public function parse_deleteitembody()
2348         {
2349                 global $manager;
2350                 $itemid =  intRequestVar('itemid');
2351                 $item   =& $manager->getItem($itemid, 1, 1);
2352                 $body   =  strip_tags($item['body']);
2353                 echo Entity::hsc(shorten($body, 300, '...'));
2354                 return;
2355         }
2356         
2357         /**
2358          * AdminActions::parse_deleteitemid()
2359          * Parse skinvar deleteitemid
2360          * 
2361          * @param       void
2362          * @return      void
2363          */
2364         public function parse_deleteitemid()
2365         {
2366                 echo (integer) intRequestVar('itemid');
2367                 return;
2368         }
2369         
2370         /**
2371          * AdminActions::parse_deleteitemtitle()
2372          * Parse skinvar deleteitemtitle
2373          * 
2374          * @param       void
2375          * @return      void
2376          */
2377         public function parse_deleteitemtitle()
2378         {
2379                 global $manager;
2380                 $itemid = intRequestVar('itemid');
2381                 $item  =& $manager->getItem($itemid, 1, 1);
2382                 echo Entity::hsc(strip_tags($item['title']));
2383                 return;
2384         }
2385         
2386         /**
2387          * AdminActions::parse_editadminskin()
2388          * Parse skinvar editadminskin
2389          * 
2390          * @param       string  $type   type of skin setting
2391          * @return      void
2392          */
2393         public function parse_editadminskin($type = 'id')
2394         {
2395                 $skinid = intRequestVar('skinid');
2396                 $skin   = new Skin($skinid);
2397                 switch ( $type )
2398                 {
2399                         case 'id':
2400                                 echo intRequestVar('skinid');
2401                                 break;
2402                         case 'name':
2403                                 echo Entity::hsc($skin->getName());
2404                                 break;
2405                         case 'desc':
2406                                 echo Entity::hsc($skin->getDescription());
2407                                 break;
2408                         case 'type':
2409                                 echo Entity::hsc($skin->getContentType());
2410                                 break;
2411                         case 'prefix':
2412                                 echo Entity::hsc($skin->getIncludePrefix());
2413                                 break;
2414                         case 'mode':
2415                                 $this->parse_inputyesno('inc_mode', $skin->getIncludeMode(), 120, 'skindir', 'normal', _PARSER_INCMODE_SKINDIR, _PARSER_INCMODE_NORMAL);
2416                         default:
2417                                 break;
2418                 }
2419                 return;
2420         }
2421         
2422         /**
2423          * AdminActions::parse_editadminskintype()
2424          * Parse skinvar editadminskintype
2425          * 
2426          * @param       string  $type   name of skin type
2427          * @return      void
2428          */
2429         public function parse_editadminskintype($type = 'id')
2430         {
2431                 global $CONF, $manager, $member;
2432                 $skinid = intRequestVar('skinid');
2433                 $skin   = new Skin($skinid);
2434                 $fNames = Skin::getFriendlyNames();
2435                 $sType  = strtolower(trim(requestVar('type')));
2436                 
2437                 switch ( $type )
2438                 {
2439                         case 'id':
2440                                 echo intRequestVar('skinid');
2441                                 break;
2442                         case 'name':
2443                                 echo Entity::hsc($skin->getName());
2444                                 break;
2445                         case 'desc':
2446                                 echo Entity::hsc($skin->getDescription());
2447                                 break;
2448                         case 'type':
2449                                 echo Entity::hsc($skin->getContentType());
2450                                 break;
2451                         case 'content':
2452                                 echo Entity::hsc($skin->getContent($sType));
2453                                 break;
2454                         case 'skintype':
2455                                 $skinType = !array_key_exists($sType, $fNames) ? ucfirst($sType) : $fNames[$sType];
2456                                 echo Entity::hsc($skinType);
2457                                 break;
2458                         case 'skintyperaw':
2459                                 echo Entity::hsc($sType);
2460                                 break;
2461                         case 'prefix':
2462                                 echo Entity::hsc($skin->getIncludePrefix());
2463                                 break;
2464                         case 'mode':
2465                                 $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
2466                                 echo Entity::hsc($incMode);
2467                                 break;
2468                         default:
2469                                 break;
2470                 }
2471                 return;
2472         }
2473         
2474         /**
2475          * AdminActions::parse_editadmintemplateinfo()
2476          * Parse skinvar editadmintemplateinfo
2477          * 
2478          * @param       string  $type                   type of skin template
2479          * @param       string  $description    description of template
2480          * @param       string  $name                   name of stemplate
2481          * @param       string  $tabindex               index number for tabindex attribute of input element
2482          * @param       string  $big                    
2483          * @param       string  $tplt                   
2484          */
2485         public function parse_editadmintemplateinfo($type, $description = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
2486         {
2487                 global $manager;
2488                 $templateid                             =  intRequestVar('templateid');
2489                 $templatename                   =  Template::getNameFromId($templateid);
2490                 $templatedescription    =  Template::getDesc($templateid);
2491                 $template                               =& Template::read($templatename);
2492                 switch ( $type )
2493                 {
2494                         case 'id':
2495                                 echo intval($templateid);
2496                                 break;
2497                         case 'name':
2498                                 echo Entity::hsc($templatename);
2499                                 break;
2500                         case 'desc':
2501                                 echo Entity::hsc($templatedescription);
2502                                 break;
2503                         case 'extratemplate':
2504                                 $tabidx    = 600;
2505                                 $pluginfields = array();
2506                                 $manager->notify(
2507                                         'AdminTemplateExtraFields',
2508                                         array(
2509                                                 'fields' => &$pluginfields
2510                                         )
2511                                 );
2512                                 $tmplt = array();
2513                                 if ( $description )
2514                                 {
2515                                         $tmplt = Template::read($description);
2516                                 }
2517                                 if ( array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) && !empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
2518                                 {
2519                                         $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
2520                                 }
2521                                 else
2522                                 {
2523                                         $base = "</tr>\n"
2524                                               . "<tr>\n"
2525                                               . "\t" . '<th colspan="2"><%explugtplname%>' . "</th>\n";
2526                                 }
2527                                 foreach ( $pluginfields as $pfkey => $pfvalue )
2528                                 {
2529                                         $data = array(
2530                                                 'explugtplname' => Entity::hsc($pfkey)
2531                                         );
2532                                         echo TEMPLATE::fill($base, $data);
2533                                         foreach ( $pfvalue as $pffield => $pfdesc )
2534                                         {
2535                                                 $this->_templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
2536                                         }
2537                                 }
2538                                 break;
2539                         default:
2540                                 $desc = defined($description) ? constant($description) : $description;
2541                                 $name = defined($name) ? constant($name) : $name;
2542                                 $this->_templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
2543                                 break;
2544                 }
2545                 return;
2546         }
2547         
2548         /**
2549          * AdminActions::parse_editcomment()
2550          * Parse skinvar editcomment
2551          * 
2552          * @param       string  $type   type of comment setting
2553          * @return      void
2554          */
2555         public function parse_editcomment($type = 'id')
2556         {
2557                 global $manager;
2558                 $commentid      = intRequestVar('commentid');
2559                 $comment        = COMMENT::getComment($commentid);
2560                 
2561                 $manager->notify('PrepareCommentForEdit', array('comment' => &$comment));
2562                 
2563                 switch ( $type )
2564                 {
2565                         case 'id':
2566                                 echo intRequestVar('commentid');
2567                                 break;
2568                         case 'user':
2569                                 if (array_key_exists('member', $comment) && !empty($comment['member']) )
2570                                 {
2571                                         echo $comment['member'] . " (" . _EDITC_MEMBER . ")";
2572                                 }
2573                                 else
2574                                 {
2575                                         echo $comment['user'] . " (" . _EDITC_NONMEMBER . ")";
2576                                 }
2577                                 break;
2578                         case 'date':
2579                                 echo date("Y-m-d @ H:i", $comment['timestamp']);
2580                                 break;
2581                         case 'body':
2582                                 $comment['body'] = str_replace('<br />', '', $comment['body']);
2583                                 $comment['body'] = preg_replace("#<a href=['\"]([^'\"]+)['\"]( rel=\"nofollow\")?>[^<]*</a>#", "\\1", $comment['body']);
2584                                 echo $comment['body'];
2585                         default:
2586                                 echo $comment[$type];
2587                                 break;
2588                 }
2589                 return;
2590         }
2591         
2592         /**
2593          * AdminActions::parse_editdesturl()
2594          * Parse skinvar editdesturl
2595          */
2596         public function parse_editdesturl()
2597         {
2598                 if ( requestVar('desturl') )
2599                 {
2600                         echo Entity::hsc(requestVar('desturl'));
2601                 }
2602                 return;
2603         }
2604         
2605         /**
2606          * AdminActions::parse_editmemberlist()
2607          * Parse skinvar editmemberlist
2608          * 
2609          * @param       string  $templateName   name of template
2610          * @return      void
2611          */
2612         public function parse_editmemberlist($templateName = '')
2613         {
2614                 global $manager;
2615                 // show list of members with actions
2616                 $query =  'SELECT * FROM '.sql_table('member');
2617                 $template['content']  = 'memberlist';
2618                 $template['tabindex'] = 10;
2619                 
2620                 $batch = new Batch('member');
2621                 $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);
2622                 return;
2623         }
2624         
2625         /**
2626          * AdminActions::parse_editmember()
2627          * Parse skinvar editmember
2628          * 
2629          * @param       string  $type                   type of information for member
2630          * @return      string  $tempateName    name of template to use
2631          * @return      void
2632          */
2633         public function parse_editmember($type = 'id', $templateName = '')
2634         {
2635                 global $CONF, $manager, $member;
2636                 $memberid       = intRequestVar('memberid');
2637                 $mem            = MEMBER::createFromID($memberid);
2638                 
2639                 switch ( $type )
2640                 {
2641                         case 'id':
2642                                 echo intRequestVar('memberid');
2643                                 break;
2644                         case 'displayname':
2645                                 if ( $this->skintype == 'teamdelete' || $this->skintype == 'memberdelete' )
2646                                 {
2647                                         echo Entity::hsc($mem->getDisplayName());
2648                                 }
2649                                 else
2650                                 {
2651                                         $dispName = Entity::hsc($mem->getDisplayName());
2652                                         if ( $CONF['AllowLoginEdit'] || $member->isAdmin() )
2653                                         {
2654                                                 echo '<input name="name" tabindex="10" maxlength="32" size="32" value="' . $dispName . "\" />\n";
2655                                         }
2656                                         else
2657                                         {
2658                                                 echo $dispName;
2659                                         }
2660                                 }
2661                                 break;
2662                         case 'realname':
2663                                 echo Entity::hsc($mem->getRealName());
2664                                 break;
2665                         case 'email':
2666                                 echo Entity::hsc($mem->getEmail());
2667                                 break;
2668                         case 'url':
2669                                 echo Entity::hsc($mem->getURL());
2670                                 break;
2671                         case 'admin':
2672                                 $this->parse_inputyesno('admin', $mem->isAdmin(), 60, 1, 0, _YES, _NO, 0, $templateName);
2673                                 break;
2674                         case 'canlogin':
2675                                 $this->parse_inputyesno('canlogin', $mem->canLogin(), 70, 1, 0, _YES, _NO, $mem->isAdmin(), $templateName);
2676                                 break;
2677                         case 'notes':
2678                                 echo Entity::hsc($mem->getNotes());
2679                                 break;
2680                         case 'autosave':
2681                                 $this->parse_inputyesno('autosave', $mem->getAutosave(), 87, 1, 0, _YES, _NO, 0, $templateName);
2682                                 break;
2683                         default:
2684                                 break;
2685                 }
2686                 return;
2687         }
2688         
2689         /**
2690          * AdminActions::parse_editpluginfo()
2691          * Parse skinvar editpluginfo
2692          * 
2693          * @param       string  $type   type of plugin info
2694          * @return      void
2695          */
2696         public function parse_editpluginfo($type)
2697         {
2698                 $pid = intRequestVar('plugid');
2699                 switch ( $type )
2700                 {
2701                         case 'id':
2702                                 echo $pid;
2703                                 break;
2704                         case 'name':
2705                                 echo Entity::hsc(getPluginNameFromPid($pid));
2706                                 break;
2707                 }
2708                 return;
2709         }
2710         
2711         /**
2712          * AdminActions::parse_editplugoptionslist()
2713          * Parse skinvar editplugoptionslist
2714          * 
2715          * @param       string  $templateName   name of template
2716          * @return      void
2717          */
2718         public function parse_editplugoptionslist($templateName = '')
2719         {
2720                 global $manager;
2721                 
2722                 $pid = intRequestVar('plugid');
2723                 $aOptions = array();
2724                 $aOIDs  = array();
2725                 
2726                 $query  = "SELECT * FROM %s WHERE ocontext='global' AND opid=%d ORDER BY oid ASC";
2727                 $query = sprintf($query, sql_table('plugin_option_desc'), (integer) $pid);
2728                 $resource = sql_query($query);
2729                 
2730                 while ( $o = sql_fetch_object($resource) )
2731                 {
2732                         array_push($aOIDs, $o->oid);
2733                         $aOptions[$o->oid] = array(
2734                                 
2735                                 'oid'                   => $o->oid,
2736                                 'value'                 => $o->odef,
2737                                 'name'                  => $o->oname,
2738                                 'description'   => $o->odesc,
2739                                 'type'                  => $o->otype,
2740                                 'typeinfo'              => $o->oextra,
2741                                 'contextid'             => 0
2742                         );
2743                 }
2744                 
2745                 // fill out actual values
2746                 if ( count($aOIDs) > 0 )
2747                 {
2748                         $query = 'SELECT oid, ovalue FROM %s WHERE oid in (%s)';
2749                         $query = sprintf($query, sql_table('plugin_option'), implode(',', $aOIDs));
2750                         
2751                         $result = sql_query($query);
2752                         
2753                         while ( $o = sql_fetch_object($result) )
2754                         {
2755                                 $aOptions[$o->oid]['value'] = $o->ovalue;
2756                         }
2757                 }
2758                 
2759                 // call plugins
2760                 $manager->notify(
2761                         'PrePluginOptionsEdit',
2762                         array(
2763                                 'context'       =>  'global',
2764                                 'plugid'        =>  $pid,
2765                                 'options'       => &$aOptions
2766                         )
2767                 );
2768                 
2769                 $template['content'] = 'plugoptionlist';
2770                 $amount                   = Showlist($aOptions, 'table', $template, $templateName);
2771                 if ( $amount == 0 )
2772                 {
2773                         echo '<p>' . _ERROR_NOPLUGOPTIONS . "</p>\n";
2774                 }
2775                 return;
2776         }
2777         
2778         /**
2779          * AdminActions::parse_editskin()
2780          * Parse skinvar editskin
2781          * 
2782          * @param       string  $type   type of skin
2783          * @return      void
2784          */
2785         public function parse_editskin($type = 'id')
2786         {
2787                 $skinid = intRequestVar('skinid');
2788                 $skin   = new SKIN($skinid);
2789                 switch ( $type )
2790                 {
2791                         case 'id':
2792                                 echo intRequestVar('skinid');
2793                                 break;
2794                         case 'name':
2795                                 echo Entity::hsc($skin->getName());
2796                                 break;
2797                         case 'desc':
2798                                 echo Entity::hsc($skin->getDescription());
2799                                 break;
2800                         case 'type':
2801                                 echo Entity::hsc($skin->getContentType());
2802                                 break;
2803                         case 'prefix':
2804                                 echo Entity::hsc($skin->getIncludePrefix());
2805                                 break;
2806                         case 'mode':
2807                                 $this->parse_inputyesno('inc_mode', $skin->getIncludeMode(), 120, 'skindir', 'normal', _PARSER_INCMODE_SKINDIR, _PARSER_INCMODE_NORMAL);
2808                         default:
2809                                 break;
2810                 }
2811                 return;
2812         }
2813         
2814         /**
2815          * AdminActions::parse_editskintype()
2816          * Parse skinvar editskintype
2817          * 
2818          * @param       string  $type   name of type for skin type
2819          * @return      void
2820          */
2821         public function parse_editskintype($type = 'id')
2822         {
2823                 global $CONF, $manager, $member;
2824                 $skinid = intRequestVar('skinid');
2825                 $skin   = new SKIN($skinid);
2826                 $fNames = SKIN::getFriendlyNames('Actions');
2827                 $sType  = strtolower(trim(requestVar('type')));
2828                 
2829                 switch ( $type )
2830                 {
2831                         case 'id':
2832                                 echo intRequestVar('skinid');
2833                                 break;
2834                         case 'name':
2835                                 echo Entity::hsc($skin->getName());
2836                                 break;
2837                         case 'desc':
2838                                 echo Entity::hsc($skin->getDescription());
2839                                 break;
2840                         case 'type':
2841                                 echo Entity::hsc($skin->getContentType());
2842                                 break;
2843                         case 'content':
2844                                 echo Entity::hsc($skin->getContent($sType));
2845                                 break;
2846                         case 'skintype':
2847                                 $skinType = !array_key_exists($sType, $fNames) ? ucfirst($sType) : $fNames[$sType];
2848                                 echo Entity::hsc($skinType);
2849                                 break;
2850                         case 'skintyperaw':
2851                                 echo Entity::hsc($sType);
2852                                 break;
2853                         case 'prefix':
2854                                 echo Entity::hsc($skin->getIncludePrefix());
2855                                 break;
2856                         case 'mode':
2857                                 $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
2858                                 echo Entity::hsc($incMode);
2859                                 break;
2860                         default:
2861                                 break;
2862                 }
2863                 return;
2864         }
2865         
2866         /**
2867          * AdminActions::parse_adminurl()
2868          * Parse skinvar adminurl
2869          * (shortcut for admin url)
2870          *
2871          * @param       void
2872          * @return      void
2873          */
2874         public function parse_adminurl()
2875         {
2876                 $this->parse_sitevar('adminurl');
2877                 return;
2878         }
2879         
2880         /**
2881          * AdminActions::parse_edittemplateinfo()
2882          * Parse skinvar edittemplateinfo
2883          * 
2884          * @param       string  $type                   name of type for skin
2885          * @param       string  $description    description for skin
2886          * @param       string  $name                   name of skin
2887          * @param       string  $help                   
2888          * @param       string  $tabindex               index value for tabindex attribute of input element
2889          * @param       string  $big                    
2890          * @param       string  $tplt                   name of template
2891          */
2892         public function parse_edittemplateinfo($type, $description = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
2893         {
2894                 global $manager;
2895                 $templateid                             =  intRequestVar('templateid');
2896                 $templatename                   =  TEMPLATE::getNameFromId($templateid);
2897                 $templatedescription    =  TEMPLATE::getDesc($templateid);
2898                 $template                               =& $manager->getTemplate($templatename);
2899                 switch ( $type )
2900                 {
2901                         case 'id':
2902                                 echo intval($templateid);
2903                                 break;
2904                         case 'name':
2905                                 echo Entity::hsc($templatename);
2906                                 break;
2907                         case 'desc':
2908                                 echo Entity::hsc($templatedescription);
2909                                 break;
2910                         case 'extratemplate':
2911                                 $tabidx    = 600;
2912                                 $pluginfields = array();
2913                                 $manager->notify(
2914                                         'TemplateExtraFields',
2915                                         array(
2916                                                 'fields' => &$pluginfields
2917                                         )
2918                                 );
2919                                 $tmplt = array();
2920                                 if ( $description )
2921                                 {
2922                                         $tmplt = Template::read($description);
2923                                 }
2924                                 if ( array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) && !empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
2925                                 {
2926                                         $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
2927                                 }
2928                                 else
2929                                 {
2930                                         $base = "</tr><tr>\n"
2931                                                   . "\t" . '<th colspan="2"><%explugtplname%>' . "</th>\n";
2932                                 }
2933                                 foreach ( $pluginfields as $pfkey => $pfvalue )
2934                                 {
2935                                         $data = array(
2936                                                 'explugtplname' => Entity::hsc($pfkey)
2937                                         );
2938                                         echo TEMPLATE::fill($base, $data);
2939                                         foreach ( $pfvalue as $pffield => $pfdesc )
2940                                         {
2941                                                 $this->_templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
2942                                         }
2943                                 }
2944                                 break;
2945                         default:
2946                                 $desc = defined($description) ? constant($description) : $description;
2947                                 $name = defined($name) ? constant($name) : $name;
2948                                 $this->_templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
2949                                 break;
2950                 }
2951                 return;
2952         }
2953         
2954         /**
2955          * AdminActions::parse_eventformextra()
2956          * Parse skinvar eventformextra
2957          * 
2958          * @param       string  $type   name of type for event form extra
2959          * @return      void
2960          */
2961         public function parse_eventformextra($type = 'activation')
2962         {
2963                 global $manager;
2964                 switch ( $type )
2965                 {
2966                         case 'activation':
2967                                 $key = requestVar('ackey');
2968                                 if ( !$key )
2969                                 {
2970                                         Admin::error(_ERROR_ACTIVATE);
2971                                 }
2972                                 $info = MEMBER::getActivationInfo($key);
2973                                 if ( !$info )
2974                                 {
2975                                         Admin::error(_ERROR_ACTIVATE);
2976                                 }
2977                                 $mem  = MEMBER::createFromId($info->vmember);
2978                                 if ( !$mem )
2979                                 {
2980                                         Admin::error(_ERROR_ACTIVATE);
2981                                 }
2982                                 $data = array(
2983                                         'type'   => 'activation',
2984                                         'member' => $mem
2985                                 );
2986                                 break;
2987                         case 'membermailform-notloggedin':
2988                                 $data = array(
2989                                         'type' => 'membermailform-notloggedin',
2990                                 );
2991                                 break;
2992                 }
2993                 $manager->notify('FormExtra', $data);
2994                 return;
2995         }
2996         
2997         /**
2998          * AdminActions::parse_extrahead()
2999          * Parse skinvar extrahead
3000          */
3001         public function parse_extrahead()
3002         {
3003                 global $manager;
3004                 $extrahead = Admin::getAdminextrahead();
3005                 $manager->notify(
3006                         'AdminPrePageHead',
3007                         array(
3008                                 'extrahead'     => &$extrahead,
3009                                 'action'        => Admin::getAdminAction()
3010                         )
3011                 );
3012                 echo $extrahead;
3013                 return;
3014         }
3015         
3016         
3017         /**
3018          * AdminActions::parse_member()
3019          * Parse skinvar member
3020          * (includes a member info thingie)
3021          * 
3022          * @param       string  $what   which memberdata is needed
3023          * @return      void
3024          */
3025         public function parse_member($what)
3026         {
3027                 global $memberinfo, $member, $CONF;
3028                 
3029                 // 1. only allow the member-details-page specific variables on member pages
3030                 if ( $this->skintype == 'member' )
3031                 {
3032                         switch( $what )
3033                         {
3034                                 case 'name':
3035                                         echo Entity::hsc($memberinfo->getDisplayName());
3036                                         break;
3037                                 case 'realname':
3038                                         echo Entity::hsc($memberinfo->getRealName());
3039                                         break;
3040                                 case 'notes':
3041                                         echo Entity::hsc($memberinfo->getNotes());
3042                                         break;
3043                                 case 'url':
3044                                         echo Entity::hsc($memberinfo->getURL());
3045                                         break;
3046                                 case 'email':
3047                                         echo Entity::hsc($memberinfo->getEmail());
3048                                         break;
3049                                 case 'id':
3050                                         echo Entity::hsc($memberinfo->getID());
3051                                         break;
3052                         }
3053                 }
3054                 
3055                 // 2. the next bunch of options is available everywhere, as long as the user is logged in
3056                 if ( $member->isLoggedIn() )
3057                 {
3058                         switch( $what )
3059                         {
3060                                 case 'yourname':
3061                                         echo $member->getDisplayName();
3062                                         break;
3063                                 case 'yourrealname':
3064                                         echo $member->getRealName();
3065                                         break;
3066                                 case 'yournotes':
3067                                         echo $member->getNotes();
3068                                         break;
3069                                 case 'yoururl':
3070                                         echo $member->getURL();
3071                                         break;
3072                                 case 'youremail':
3073                                         echo $member->getEmail();
3074                                         break;
3075                                 case 'yourid':
3076                                         echo $member->getID();
3077                                         break;
3078                                 case 'yourprofileurl':
3079                                         if ($CONF['URLMode'] == 'pathinfo')
3080                                                 echo Link::create_member_link($member->getID());
3081                                         else
3082                                                 echo $CONF['IndexURL'] . Link::create_member_link($member->getID());
3083                                         break;
3084                         }
3085                 }
3086                 return;
3087         }
3088         
3089         /**
3090          * AdminActions::parse_version()
3091          * Parse skinvar version
3092          * (include nucleus versionnumber)
3093          *
3094          * @param       void
3095          * @return      void
3096          */
3097         public function parse_version()
3098         {
3099                 global $nucleus;
3100                 echo 'Nucleus CMS ' . $nucleus['version'];
3101                 return;
3102         }
3103         
3104         /**
3105          * AdminActions::parse_sitevar()
3106          * Parse skinvar sitevar
3107          * (include a sitevar)
3108          *
3109          * @param       string  $which
3110          * @return      void
3111          */
3112         public function parse_sitevar($which)
3113         {
3114                 global $CONF;
3115                 switch ( $which )
3116                 {
3117                         case 'url':
3118                                 echo $CONF['IndexURL'];
3119                                 break;
3120                         case 'name':
3121                                 echo $CONF['SiteName'];
3122                                 break;
3123                         case 'admin':
3124                                 echo $CONF['AdminEmail'];
3125                                 break;
3126                         case 'adminurl':
3127                                 echo $CONF['AdminURL'];
3128                 }
3129                 return;
3130         }
3131         
3132         /**
3133          * AdminActions::parse_charset()
3134          * Parse skinvar charset
3135          *
3136          * @param       void
3137          * @return      void
3138          */
3139         public function parse_charset()
3140         {
3141                 echo i18n::get_current_charset();
3142                 return;
3143         }
3144         
3145         /**
3146          * AdminActions::parse_getblogsetting()
3147          * Parse skinvar getblogsetting
3148          */
3149         public function parse_getblogsetting($which)
3150         {
3151                 global $blog;
3152                 
3153                 if ( $blog )
3154                 {
3155                         $b =& $blog;
3156                 }
3157                 elseif ( $bid = intRequestVar('blogid') )
3158                 {
3159                         global $manager;
3160                         $b = $manager->getBlog($bid);
3161                 }
3162                 else
3163                 {
3164                         return;
3165                 }
3166                 
3167                 switch ( $which )
3168                 {
3169                         case 'id':
3170                                 return Entity::hsc($b->getID());
3171                                 break;
3172                         case 'url':
3173                                 return Entity::hsc($b->getURL());
3174                                 break;
3175                         case 'name':
3176                                 return Entity::hsc($b->getName());
3177                                 break;
3178                         case 'desc':
3179                                 return Entity::hsc($b->getDescription());
3180                                 break;
3181                         case 'short':
3182                                 return Entity::hsc($b->getShortName());
3183                                 break;
3184                         case 'notifyaddress':
3185                                 return Entity::hsc($b->getNotifyAddress());
3186                                 break;
3187                         case 'maxcomments':
3188                                 return Entity::hsc($b->getMaxComments());
3189                                 break;
3190                         case 'updatefile':
3191                                 return Entity::hsc($b->getUpdateFile());
3192                                 break;
3193                         case 'timeoffset':
3194                                 return Entity::hsc($b->getTimeOffset());
3195                                 break;
3196                 }
3197                 return;
3198         }
3199         
3200         /**
3201          * AdminActions::parse_geteditpluginfo()
3202          * Parse skinvar geteditpluginfo
3203          * 
3204          * @param       string  $type   name of setting for edit plugin info
3205          * @return      void
3206          */
3207         public function parse_geteditpluginfo($type)
3208         {
3209                 $pid = intRequestVar('plugid');
3210                 switch ( $type )
3211                 {
3212                         case 'id':
3213                                 return $pid;
3214                                 break;
3215                         case 'name':
3216                                 return Entity::hsc(getPluginNameFromPid($pid));
3217                                 break;
3218                 }
3219                 return;
3220         }
3221         
3222         /**
3223          * AdminActions::parse_getmember()
3224          * Parse skinvar getmember
3225          * (includes a member info thingie)
3226          * 
3227          * @param       string  $what   name of setting for member
3228          * @return      void
3229          */
3230         public function parse_getmember($what)
3231         {
3232                 global $memberinfo, $member;
3233                 // 1. only allow the member-details-page specific variables on member pages
3234                 if ( $this->skintype == 'member' )
3235                 {
3236                         switch ( $what )
3237                         {
3238                                 case 'name':
3239                                         return Entity::hsc($memberinfo->getDisplayName());
3240                                         break;
3241                                 case 'realname':
3242                                         return Entity::hsc($memberinfo->getRealName());
3243                                         break;
3244                                 case 'notes':
3245                                         return Entity::hsc($memberinfo->getNotes());
3246                                         break;
3247                                 case 'url':
3248                                         return Entity::hsc($memberinfo->getURL());
3249                                         break;
3250                                 case 'email':
3251                                         return Entity::hsc($memberinfo->getEmail());
3252                                         break;
3253                                 case 'id':
3254                                         return Entity::hsc($memberinfo->getID());
3255                                         break;
3256                         }
3257                 }
3258                 // 2. the next bunch of options is available everywhere, as long as the user is logged in
3259                 if ( $member->isLoggedIn() )
3260                 {
3261                         switch ( $what )
3262                         {
3263                                 case 'yourname':
3264                                         return $member->getDisplayName();
3265                                         break;
3266                                 case 'yourrealname':
3267                                         return $member->getRealName();
3268                                         break;
3269                                 case 'yournotes':
3270                                         return $member->getNotes();
3271                                         break;
3272                                 case 'yoururl':
3273                                         return $member->getURL();
3274                                         break;
3275                                 case 'youremail':
3276                                         return $member->getEmail();
3277                                         break;
3278                                 case 'yourid':
3279                                         return $member->getID();
3280                                         break;
3281                         }
3282                 }
3283                 return;
3284         }
3285         
3286         /**
3287          * AdminActions::parse_headmessage()
3288          * Parse skinvar headmessage
3289          * 
3290          * @param       void
3291          * @return      void
3292          */
3293         public function parse_headmessage()
3294         {
3295                 if ( !empty(Admin::$headMess) )
3296                 {
3297                         echo '<p>' . _MESSAGE . ': ' . Entity::hsc(Admin::$headMess) . "</p>\n";
3298                 }
3299                 return;
3300         }
3301         
3302         /**
3303          * AdminActions::parse_helplink()
3304          * Parse skinvar helplink
3305          * 
3306          * @param       string  $topic  name of topic for help
3307          * @return      void
3308          */
3309         public function parse_helplink($topic = '')
3310         {
3311                 if ( empty($topic) )
3312                 {
3313                         return;
3314                 }
3315                 help($topic);
3316                 return;
3317         }
3318         
3319         /**
3320          * AdminActions::parse_helpplugname()
3321          * Parse skinvar helpplugname
3322          * 
3323          * @param       void
3324          * @return      void
3325          */
3326         public function parse_helpplugname()
3327         {
3328                 $plugid = intGetVar('plugid');
3329                 Entity::hsc(getPluginNameFromPid($plugid));
3330                 return;
3331         }
3332         
3333         /**
3334          * AdminActions::parse_ilistaddnew()
3335          * Parse skinvar ilistaddnew
3336          * 
3337          * @param       void
3338          * @return      void
3339          */
3340         public function parse_ilistaddnew()
3341         {
3342                 $blogid = intRequestVar('blogid');
3343                 if ( intPostVar('start') == 0 )
3344                 {
3345                         echo '<p><a href="index.php?action=createitem&amp;blogid=' . $blogid . '">' . _ITEMLIST_ADDNEW . "</a></p>\n";
3346                 }
3347                 return;
3348         }
3349         
3350         /**
3351          * AdminActions::parse_importskininfo()
3352          * Parse skinvar importskininfo
3353          * 
3354          * @param       string  $type   name of information for imported skin
3355          * @return      void
3356          */
3357         public function parse_importskininfo($type)
3358         {
3359                 switch ( $type )
3360                 {
3361                         case 'info':
3362                                 echo Entity::hsc(requestVar('skininfo'));
3363                                 break;
3364                         case 'snames':
3365                                 $dataArr = requestArray('skinnames');
3366                                 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3367                                 break;
3368                         case 'tnames':
3369                                 $dataArr = requestArray('tpltnames');
3370                                 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3371                                 break;
3372                         case 'sclashes':
3373                                 $dataArr = requestArray('skinclashes');
3374                                 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3375                                 break;
3376                         case 'tclashes':
3377                                 $dataArr = requestArray('tpltclashes');
3378                                 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3379                                 break;
3380                         case 'skinfile':
3381                                 echo Entity::hsc(requestVar('skinfile'));
3382                                 break;
3383                         case 'mode':
3384                                 echo Entity::hsc(requestVar('mode'));
3385                                 break;
3386                 }
3387                 return;
3388         }
3389         
3390         /**
3391          * AdminActions::parse_inputyesno()
3392          * Parse skinvar inputyesno
3393          * 
3394          * @param       string  $name                   
3395          * @param       string  $checkedval             
3396          * @param       string  $tabindex               
3397          * @param       string  $value1                 
3398          * @param       string  $value2                 
3399          * @param       string  $yesval                 
3400          * @param       string  $noval                  
3401          * @param       string  $isAdmin                
3402          * @param       string  $templateName   
3403          * @return      void
3404          */
3405         public function parse_inputyesno($name, $checkedval, $tabindex = 0, $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO, $isAdmin = 0, $templateName = '')
3406         {
3407                 self::input_yesno($name, $checkedval, $tabindex, $value1, $value2, $yesval, $noval, $isAdmin, $templateName );
3408                 return;
3409         }
3410         
3411         /**
3412          * AdminActions::parse_insertpluginfo()
3413          * Parse templatevar insertpluginfo
3414          */
3415         public function parse_insertpluginfo($type)
3416         {
3417                 $option = Admin::$aOptions;
3418                 switch ( $type )
3419                 {
3420                         case 'id':
3421                                 return $option['pid'];
3422                                 break;
3423                         case 'name':
3424                                 return Entity::hsc($option['pfile']);
3425                                 break;
3426                 }
3427                 return;
3428         }
3429         
3430         /**
3431          * AdminActions::parse_insertpluginoptions()
3432          * Parse skinvar insertpluginoptions
3433          * 
3434          * @param       string  $templateName   name of template
3435          * @return      void
3436          */
3437         public function parse_insertpluginoptions($templateName = '')
3438         {
3439                 $options        = Admin::$aOptions;
3440                 $template       = array();
3441                 $templats       = array();
3442                 
3443                 if ( $templateName )
3444                 {
3445                         $templates = Template::read($templateName);
3446                 }
3447                 if (array_key_exists('INSERT_PLUGOPTION_TITLE', $templates) && !empty($templates['INSERT_PLUGOPTION_TITLE']) )
3448                 {
3449                         $template['title'] = $templates['INSERT_PLUGOPTION_TITLE'];
3450                 }
3451                 else
3452                 {
3453                         $template['title'] = '<tr><th colspan="2"><%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%></th></tr>' . "\n";
3454                 }
3455                 if ( array_key_exists('INSERT_PLUGOPTION_BODY', $templates) && !empty($templates['INSERT_PLUGOPTION_BODY']) )
3456                 {
3457                         $template['body'] = $templates['INSERT_PLUGOPTION_BODY'];
3458                 }
3459                 else
3460                 {
3461                         $template['body'] = '<tr><%listplugplugoptionrow%></tr>' . "\n";
3462                 }
3463                 
3464                 $prevPid = -1;
3465                 
3466                 foreach ( $options as $option )
3467                 {
3468                         $handler = new Actions($this->skintype, $template, $option);
3469                         $parser  = new PARSER(Actions::getDefinedActions(), $handler);
3470                         // new plugin?
3471                         if ( $prevPid != $option['pid'] )
3472                         {
3473                                 $prevPid  = $option['pid'];
3474                                 $parser->parse($template['title']);
3475                         }
3476                         $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
3477                         if ( @$meta['access'] != 'hidden' )
3478                         {
3479                                 $parsed = $parser->parse($template['body']);
3480                         }
3481                 }
3482                 return;
3483         }
3484         
3485         /**
3486          * AdminActions::parse_insplugoptcontent()
3487          * Parse skinvar insplugoptcontent
3488          * 
3489          * @param       void
3490          * @return      void
3491          */
3492         public function parse_insplugoptcontent()
3493         {
3494                 $option = Admin::$aOption;
3495                 
3496                 $meta   = NucleusPlugin::getOptionMeta($option['typeinfo']);
3497                 if (array_key_exists('access', $meta) && $meta['access'] != 'hidden')
3498                 {
3499                         echo '<tr>';
3500                         listplug_plugOptionRow($option);
3501                         echo '</tr>';
3502                 }
3503                 return;
3504         }
3505         
3506         /**
3507          * AdminActions::parse_iprangeinput()
3508          * Parse skinvar iprangeinput
3509          * 
3510          * @param       void
3511          * @return      void
3512          */
3513         public function parse_iprangeinput()
3514         {
3515                 if ( requestVar('ip') )
3516                 {
3517                         $iprangeVal = Entity::hsc(requestVar('ip'));
3518                         echo '<input name="iprange" type="radio" value="' . $iprangeVal . '" checked="checked" id="ip_fixed" />' . "\n";
3519                         echo '<label for="ip_fixed">' . $iprangeVal . "</label><br />\n";
3520                         echo '<input name="iprange" type="radio" value="custom" id="ip_custom" />' . "\n";
3521                         echo '<label for="ip_custom">' . _BAN_IP_CUSTOM . '</label>' . "\n";
3522                         echo '<input name="customiprange" value="' . $iprangeVal . '" maxlength="15" size="15" />' . "\n";
3523                 }
3524                 else
3525                 {
3526                         echo '<input name="iprange" value="custom" type="hidden" />' . "\n";
3527                         echo '<input name="customiprange" value="" maxlength="15" size="15" />' . "\n";
3528                 }
3529                 return;
3530         }
3531         
3532         /**
3533          * AdminActions::parse_itemnavlist()
3534          * Parse skinvar itemnavlist
3535          * 
3536          * @param       void
3537          * @return      void
3538          */
3539         public function parse_itemnavlist()
3540         {
3541                 global $CONF, $manager, $member;
3542                 if ( $this->skintype == 'itemlist' )
3543                 {
3544                         $blogid =  intRequestVar('blogid');
3545                         $blog   =& $manager->getBlog($blogid);
3546                 }
3547                 if ( postVar('start') )
3548                 {
3549                         $start = intPostVar('start');
3550                 }
3551                 else
3552                 {
3553                         $start = 0;
3554                 }
3555                 
3556                 // amount of items to show
3557                 if ( postVar('amount') )
3558                 {
3559                         $amount = intPostVar('amount');
3560                 }
3561                 else
3562                 {
3563                         $amount = intval($CONF['DefaultListSize']);
3564                         if ( $amount < 1 )
3565                         {
3566                                 $amount = 10;
3567                         }
3568                 }
3569                 $query  = "SELECT bshortname, cname, mname, ititle, ibody, inumber, idraft, itime"
3570                         . " FROM %s, %s, %s"
3571                         . " WHERE iblog=bnumber AND iauthor=mnumber AND icat=catid;";
3572                 
3573                 $query = sprintf($query, sql_table('item'), sql_table('blog'), sql_table('member'), sql_table('category'));
3574                 
3575                 if ( $this->skintype == 'itemlist' )
3576                 {
3577                         $query .= 'and iblog   = ' . $blogid;
3578                         $template['now'] = $blog->getCorrectTime(time());
3579                         
3580                         // non-blog-admins can only edit/delete their own items
3581                         if ( !$member->blogAdminRights($blogid) )
3582                         {
3583                                 $query .= ' and iauthor = ' . $member->getID();
3584                         }
3585                 }
3586                 elseif ( $this->skintype == 'browseownitems' )
3587                 {
3588                         $query .= 'and iauthor   = ' . $member->getID();
3589                         $blogid = 0;
3590                         $template['now'] = time();
3591                 }
3592                 
3593                 // search through items
3594                 $search = postVar('search');
3595                 
3596                 if ( !empty($search) )
3597                 {
3598                         $query .= ' AND ((ititle LIKE "%' . sql_real_escape_string($search) . '%") '
3599                                 . '  OR  (ibody LIKE "%' . sql_real_escape_string($search) . '%") '
3600                                 . '  OR  (imore LIKE "%' . sql_real_escape_string($search) . '%"))';
3601                 }
3602                 $query .= ' ORDER BY itime DESC'
3603                         . " LIMIT {$start},{$amount}";
3604                 
3605                 $template['content'] = 'itemlist';
3606                 
3607                 $navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $blogid, $search, 0);
3608                 $navList->showBatchList('item', $query, 'table', $template);
3609                 return;
3610         }
3611         
3612         /**
3613          * AdminActions::parse_jstoolbaroptions()
3614          * Parse skinvar jstoolbaroptions
3615          * 
3616          * @param       void
3617          * @return      void
3618          */
3619         public function parse_jstoolbaroptions()
3620         {
3621                 global $CONF;
3622                 $options = array(
3623                         _SETTINGS_JSTOOLBAR_NONE,
3624                         _SETTINGS_JSTOOLBAR_SIMPLE,
3625                         _SETTINGS_JSTOOLBAR_FULL
3626                 );
3627                 $i = 1;
3628                 foreach ( $options as $option )
3629                 {
3630                         $text  = "<option value=\"%d\"%s>%s</option>\n";
3631                         $extra = ($CONF['DisableJsTools'] == $i) ? ' selected="selected"' : '';
3632                         echo sprintf($text, $i, $extra, $option);
3633                         $i++;
3634                 }
3635                 return;
3636         }
3637         
3638         /**
3639          * AdminActions::parse_localeselectoptions()
3640          * Parse skinvar localeselectoptions
3641          * 
3642          * @param       void
3643          * @return      void
3644          */
3645         public function parse_localeselectoptions()
3646         {
3647                 $locales = i18n::get_available_locale_list();
3648                 $memid   = intRequestVar('memberid');
3649                 if ( $memid )
3650                 {
3651                         $mem = MEMBER::createFromID($memid);
3652                         if ( !$mem->getLocale() || !in_array($mem->getLocale(), $locales) )
3653                         {
3654                                 echo "<option value=\"\" selected=\"selected\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
3655                         }
3656                         else
3657                         {
3658                                 echo "<option value=\"\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
3659                         }
3660                 }
3661                 else
3662                 {
3663                         if ( !i18n::get_current_locale() || !in_array(i18n::get_current_locale(), $locales) )
3664                         {
3665                                 echo "<option value=\"\" selected=\"selected\">en_Latn_US</option>\n";
3666                         }
3667                 }
3668                 foreach ( $locales as $locale )
3669                 {
3670                         if ($memid)
3671                         {
3672                                 if ( $locale == $mem->getLocale() )
3673                                 {
3674                                         echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
3675                                 }
3676                                 else
3677                                 {
3678                                         echo "<option value=\"{$locale}\">{$locale}</option>\n";
3679                                 }
3680                         }
3681                         else
3682                         {
3683                                 if ( $locale == i18n::get_current_locale() )
3684                                 {
3685                                         echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
3686                                 }
3687                                 else
3688                                 {
3689                                         echo "<option value=\"{$locale}\">{$locale}</option>\n";
3690                                 }
3691                         }
3692                 }
3693                 return;
3694         }
3695         
3696         /**
3697          * AdminActions::parse_listplugplugoptionrow()
3698          * Parse templatevar listplugplugoptionrow
3699          * 
3700          * @param       string  $templateName   name of template
3701          * @return      void
3702          */
3703         public function parse_listplugplugoptionrow($templateName = '')
3704         {
3705                 echo listplug_plugOptionRow(Admin::$aOptions, $templateName);
3706                 return;
3707         }
3708         
3709         /**
3710          * AdminActions::parse_mediadirwarning()
3711          * Parse skinvar mediadirwarning
3712          * 
3713          * @param       void
3714          * @return      void
3715          */
3716         public function parse_mediadirwarning()
3717         {
3718                 global $DIR_MEDIA;
3719                 if ( !is_dir($DIR_MEDIA) )
3720                 {
3721                         echo "<br /><b>" . _WARNING_NOTADIR . "</b>\n";
3722                 }
3723                 if ( !is_readable($DIR_MEDIA) )
3724                 {
3725                         echo "<br /><b>" . _WARNING_NOTREADABLE . "</b>\n";
3726                 }
3727                 if ( !is_writeable($DIR_MEDIA) )
3728                 {
3729                         echo "<br /><b>" . _WARNING_NOTWRITABLE . "</b>\n";
3730                 }
3731                 return;
3732         }
3733         
3734         /**
3735          * AdminActions::parse_movedistselect()
3736          * Parse skinvar movedistselect
3737          */
3738         public function parse_movedistselect()
3739         {
3740                 $actionType = requestVar('action');
3741                 switch ( $actionType )
3742                 {
3743                         case 'batchitem':
3744                                 Admin::selectBlogCategory('destcatid');
3745                                 break;
3746                         case 'batchcategory':
3747                                 Admin::selectBlog('destblogid');
3748                                 break;
3749                         default:
3750                                 if ( $this->skintype == 'itemmove' )
3751                                 {
3752                                         $query  = "SELECT icat as result FROM %s WHERE inumber=%d;";
3753                                         $query = spriintf($query, sql_table('item'), intRequestVar('itemid'));
3754                                         $catid  = quickQuery(sprintf($query, intRequestVar('itemid')));
3755                                         Admin::selectBlogCategory('catid', $catid, 10, 1);
3756                                 }
3757                                 break;
3758                 }
3759                 return;
3760         }
3761         
3762         /**
3763          * AdminActions::parse_moveitemid()
3764          * Parse skinvar moveitemid
3765          * 
3766          * @param       void
3767          * @return      void
3768          */
3769         public function parse_moveitemid()
3770         {
3771                 echo intRequestVar('itemid');
3772                 return;
3773         }
3774         
3775         /**
3776          * AdminActions::parse_newestcompare()
3777          * Parse skinvar newestcompare
3778          * 
3779          * @param       void
3780          * @return      void
3781          */
3782         public function parse_newestcompare()
3783         {
3784                 global $nucleus;
3785                 $newestVersion  = getLatestVersion();
3786                 $newestCompare  = str_replace('/', '.', $newestVersion);
3787                 $currentVersion = str_replace(array('/', 'v'), array('.', ''), $nucleus['version']);
3788                 if ( $newestVersion && version_compare($newestCompare, $currentVersion, '>') )
3789                 {
3790                         echo '<br /><a style="color:red" href="http://nucleuscms.org/upgrade.php" title="' . _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TITLE . '">';
3791                         echo _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TEXT . $newestVersion . '</a>';
3792                 }
3793                 return;
3794         }
3795         
3796         /**
3797          * AdminActions::parse_newmemberselect()
3798          * Parse skinvar newmemberselect
3799          * 
3800          * @param       string  $templateName   name of template to use
3801          * @return      void
3802          */
3803         public function parse_newmemberselect($templateName = '')
3804         {
3805                 $blogid = intRequestVar('blogid');
3806                 
3807                 $query  = "SELECT tmember FROM %s WHERE tblog=%d;";
3808                 $query = sprintf($query, sql_table('team'), (integer) $blogid);
3809                 $res = sql_query($query);
3810                 
3811                 $tmem = array();
3812                 while ( $tmember = sql_fetch_object($res) ) 
3813                 {
3814                         $tmem[] = intval($tmember->tmember);
3815                 }
3816                 
3817                 $query  = "SELECT mname as text, mnumber as value FROM %s WHERE mnumber NOT IN (%s);";
3818                 $query = sprintf($query, sql_table('member'), implode(', ', $tmem));
3819                 
3820                 $template['name']        = 'memberid';
3821                 $template['tabindex'] = 10000;
3822                 Showlist($query, 'select', $template, $templateName);
3823                 return;
3824         }
3825         
3826         /**
3827          * AdminActions::parse_newpluginlist()
3828          * Parse skinvar newpluginlist
3829          * 
3830          * @param       void
3831          * @return      void
3832          */
3833         public function parse_newpluginlist()
3834         {
3835                 $candidates = $this->newPlugCandidates;
3836                 foreach ( $candidates as $name )
3837                 {
3838                         echo '<option value="NP_' . $name . '">' . Entity::hsc($name) . "</option>\n";
3839                 }
3840                 return;
3841         }
3842         
3843         /**
3844          * AdminActions::parse_outputspecialdirs()
3845          * Parse skinvar outputspecialdirs
3846          * 
3847          * @param       string  $type   type of setting for directory
3848          * @return      void
3849          */
3850         public function parse_outputspecialdirs($type)
3851         {
3852                 switch ( $type )
3853                 {
3854                         case 'nucleusdir':
3855                                 global $DIR_NUCLEUS;
3856                                 echo Entity::hsc($DIR_NUCLEUS);
3857                                 break;
3858                         case 'mediadir':
3859                                 global $DIR_MEDIA;
3860                                 echo Entity::hsc($DIR_MEDIA);
3861                                 break;
3862                 }
3863                 return;
3864         }
3865         
3866         /**
3867          * AdminActions::parse_passrequestvars()
3868          * Parse skinvar passrequestvars
3869          * 
3870          * @param       void
3871          * @return      void
3872          */
3873         public function parse_passrequestvars()
3874         {
3875                 $oldaction = postVar('oldaction');
3876                 if ( ($oldaction != 'logout')
3877                   && ($oldaction != 'login')
3878                   && Admin::passvar
3879                   && !postVar('customaction') )
3880                 {
3881                         passRequestVars();
3882                 }
3883                 return;
3884         }
3885         
3886         /**
3887          * AdminActions::parse_pluginextras()
3888          * Parse skinvar pluginextras
3889          * 
3890          * @param       string  $type   type of plugin context
3891          * @return      void
3892          */
3893         public function parse_pluginextras($type = 'global')
3894         {
3895                 global $manager;
3896                 switch ( $type )
3897                 {
3898                         case 'member':
3899                                 $id  = intRequestVar('memberid');
3900                                 $mem = MEMBER::createFromID($id);
3901                                 $manager->notify(
3902                                         'MemberSettingsFormExtras',
3903                                         array(
3904                                                 'member' => &$mem
3905                                         )
3906                                 );
3907                                 break;
3908                         case 'blog':
3909                                 $id  = intRequestVar('blogid');
3910                                 $blg = $manager->getBlog($id);
3911                                 $manager->notify(
3912                                         'BlogSettingsFormExtras',
3913                                         array(
3914                                                 'member' => &$blg
3915                                         )
3916                                 );
3917                                 break;
3918                         default:
3919                                 $manager->notify(
3920                                         'GeneralSettingsFormExtras',
3921                                         array(
3922                                         )
3923                                 );
3924                                 break;
3925                 }
3926                 return;
3927         }
3928         
3929         /**
3930          * AdminActions::parse_pluginhelp()
3931          * Parse skinvar pluginhelp
3932          * 
3933          * @param       void
3934          * @return      void
3935          */
3936         public function parse_pluginhelp()
3937         {
3938                 global $manager, $DIR_PLUGINS;
3939                 $plugid = intGetVar('plugid');
3940                 $plugName =  getPluginNameFromPid($plugid);
3941                 $plug =& $manager->getPlugin($plugName);
3942                 
3943                 if ( $plug->supportsFeature('HelpPage') > 0 )
3944                 {
3945                         $helpfile = $DIR_PLUGINS . $plug->getShortName() . '/help.';
3946                         if ( @file_exists($helpfile . 'php') )
3947                         {
3948                                 @include($helpfile . 'php');
3949                                 return;
3950                         }
3951                         elseif ( @file_exists($helpfile . 'html') )
3952                         {
3953                                 @include($helpfile . 'html');
3954                                 return;
3955                         }
3956                 }
3957                 echo '<p>' . _ERROR . ': ' . _ERROR_PLUGNOHELPFILE . "</p>\n";
3958                 echo '<p><a href="index.php?action=pluginlist">(' . _BACK . ")</a></p>\n";
3959                 return;
3960         }
3961         
3962         /**
3963          * AdminActions::parse_pluginlistlist()
3964          * Parse skinvar pluginlistlist
3965          * 
3966          * @param       string  $templateName   name of template to use
3967          * @return      void
3968          */
3969         public function parse_pluginlistlist($templateName = '')
3970         {
3971                 $query  = "SELECT * FROM %s ORDER BY porder ASC;";
3972                 $query = sprintf($query, sql_table('plugin'));
3973                 $template['content']  = 'pluginlist';
3974                 $template['tabindex'] = 10;
3975                 Showlist($query, 'table', $template, $templateName);
3976                 return;
3977         }
3978         
3979         /**
3980          * AdminActions::parse_pluginoptions()
3981          * Parse skinvar pluginoptions
3982          * 
3983          * @param       string  $type   type of plugin option
3984          * @return      void
3985          */
3986         public function parse_pluginoptions($type = 'global')
3987         {
3988                 switch ( $type )
3989                 {
3990                         case 'member':
3991                                 $id = intRequestVar('memberid');
3992                                 break;
3993                         case 'blog':
3994                                 $id = intRequestVar('blogid');
3995                                 break;
3996                         case 'category':
3997                                 $id = intRequestVar('catid');
3998                                 break;
3999                 }
4000                 Admin::insertPluginOptions($type, $id);
4001                 return;
4002         }
4003         
4004         /**
4005          * AdminActions::parse_qmenuaddselect()
4006          * Parse skinvar qmanuaddselect
4007          * 
4008          * @param       string  $templateName   name of template to use
4009          * @return      void
4010          */
4011         public function parse_qmenuaddselect($templateName = '')
4012         {
4013                 global $member;
4014                 $showAll = requestVar('showall');
4015                 if ( $member->isAdmin() && ($showAll == 'yes') )
4016                 {
4017                         // Super-Admins have access to all blogs! (no add item support though)
4018                         $query =  'SELECT bnumber as value, bname as text'
4019                                . ' FROM ' . sql_table('blog')
4020                                . ' ORDER BY bname';
4021                 }
4022                 else
4023                 {
4024                         $query =  'SELECT bnumber as value, bname as text'
4025                                . ' FROM ' . sql_table('blog') . ', ' . sql_table('team')
4026                                . ' WHERE tblog=bnumber and tmember=' . $member->getID()
4027                                . ' ORDER BY bname';
4028                 }
4029                 $template['name']          = 'blogid';
4030                 $template['tabindex']   = 15000;
4031                 $template['extra']        = _QMENU_ADD_SELECT;
4032                 $template['selected']   = -1;
4033                 $template['shorten']    = 10;
4034                 $template['shortenel']  = '';
4035                 $template['javascript'] = 'onchange="return form.submit()"';
4036                 Showlist($query, 'select', $template, $templateName);
4037                 return;
4038         }
4039
4040         /**
4041          * AdminActions::parse_quickmenu()
4042          * Parse skinvar quickmenu
4043          * 
4044          * @param       string  $templateName   name of template to use
4045          * @return      void
4046          */
4047         public function parse_quickmenu($templateName = '')
4048         {
4049                 global $manager;
4050                 $templates = array();
4051                 $template  = array();
4052                 if ( !empty($templateName) )
4053                 {
4054                         $templates = Template::read($templateName);
4055                 }
4056                 $pluginExtras = array();
4057                 $manager->notify(
4058                         'QuickMenu',
4059                         array(
4060                                 'options' => &$pluginExtras
4061                         )
4062                 );
4063                 if ( count($pluginExtras) > 0 )
4064                 {
4065                         if ( array_key_exists('PLUGIN_QUICKMENU_TITLE', $templates) || !empty($templates['PLUGIN_QUICKMENU_TITLE']) )
4066                         {
4067                                 $template['title'] = $templates['PLUGIN_QUICKMENU_TITLE'];
4068                         }
4069                         else
4070                         {
4071                                 $template['title'] = '<h2><%text(_QMENU_PLUGINS)%></h2>';
4072                         }
4073                         $handler = new Actions($this->skintype, $template, $this->objAdmin);
4074                         $parser  = new PARSER(Actions::getDefinedActions(), $handler);
4075                         $parser->parse($template['title']);
4076                         
4077                         if ( array_key_exists('PLUGIN_QUICKMENU_HEAD', $templates) || !empty($templates['PLUGIN_QUICKMENU_HEAD']) )
4078                         {
4079                                 $template['head'] = $templates['PLUGIN_QUICKMENU_HEAD'];
4080                         }
4081                         else
4082                         {
4083                                 $template['head'] = '<ul>';
4084                         }
4085                         
4086                         echo $template['head'];
4087                         
4088                         if ( array_key_exists('PLUGIN_QUICKMENU_BODY', $templates) || !empty($templates['PLUGIN_QUICKMENU_BODY']) )
4089                         {
4090                                 $template['body'] = $templates['PLUGIN_QUICKMENU_BODY'];
4091                         }
4092                         else
4093                         {
4094                                 $template['body'] = '<li><a href="<%plugadminurl%>" title="<%plugadmintooltip%>"><%plugadmintitle%></a></li>';
4095                         }
4096                         
4097                         foreach ( $pluginExtras as $aInfo )
4098                         {
4099                                 $data = array(
4100                                         'plugadminurl'          => Entity::hsc($aInfo['url']),
4101                                         'plugadmintooltip'      => Entity::hsc($aInfo['tooltip']),
4102                                         'plugadmintitle'        => Entity::hsc($aInfo['title']),
4103                                 );
4104                                 echo TEMPLATE::fill($template['body'], $data);
4105                         }
4106                         if ( array_key_exists('PLUGIN_QUICKMENU_FOOT', $templates) || !empty($templates['PLUGIN_QUICKMENU_FOOT']) )
4107                         {
4108                                 $template['foot'] = $templates['PLUGIN_QUICKMENU_FOOT'];
4109                         }
4110                         else
4111                         {
4112                                 $template['foot'] = '</ul>';
4113                         }
4114                         echo $template['foot'];
4115                 }
4116                 return;
4117         }
4118         
4119         /**
4120          * AdminActions::parse_requestblogid()
4121          * Parse skinvar requestblogid
4122          * 
4123          * @param       void
4124          * @return      void
4125          */
4126         public function parse_requestblogid()
4127         {
4128                 echo intRequestVar('blogid');
4129                 return;
4130         }
4131         
4132         /**
4133          * AdminActions::parse_requestiprange()
4134          * Parse skinvar requestiprange
4135          * 
4136          * @param       void
4137          * @return      void
4138          */
4139         public function parse_requestiprange()
4140         {
4141                 if ( requestVar('iprange') )
4142                 {
4143                         echo Entity::hsc(requestVar('iprange'));
4144                 }
4145                 elseif ( requestVar('ip') )
4146                 {
4147                         echo Entity::hsc(requestVar('ip'));
4148                 }
4149                 return;
4150         }
4151         
4152         /**
4153          * AdminActions::parse_selectlocaladminskinfiles()
4154          * Parse skinvar selectlocaladminskinfiles
4155          * 
4156          * @param       void
4157          * @return      void
4158          */
4159         public function parse_selectlocaladminskinfiles()
4160         {
4161                 global $DIR_ADMINSKINS, $manager;
4162                 $candidates = SkinImport::searchForCandidates($DIR_ADMINSKINS);
4163                 foreach ( $candidates as $skinname => $skinfile )
4164                 {
4165                         $html = Entit::hsc($skinfile);
4166                         echo '<option value="' . $html . '">' . $skinname . "</option>\n";
4167                 }
4168                 return;
4169         }
4170         
4171         /**
4172          * AdminActions::parse_selectlocalskinfiles()
4173          * Parse skinvar selectlocalskinfiles
4174          * 
4175          * @param       void
4176          * @return      void
4177          */
4178         public function parse_selectlocalskinfiles()
4179         {
4180                 global $DIR_SKINS;
4181                 $candidates = SkinImport::searchForCandidates($DIR_SKINS);
4182                 foreach ( $candidates as $skinname => $skinfile )
4183                 {
4184                         $html = Entity::hsc($skinfile);
4185                         echo '<option value="' . $html . '">' . $skinname . "</option>\n";
4186                 }
4187                 return;
4188         }
4189         
4190         /**
4191          * AdminActions::parse_skineditallowedlist()
4192          * Parse skinvar skineditallowedlist
4193          * 
4194          * @param       string  $type                   type of skin
4195          * @param       string  $templateName   name of template
4196          * @return      void
4197          */
4198         public function parse_skineditallowedlist($type, $templateName = '')
4199         {
4200                 switch ( $type )
4201                 {
4202                         case 'blog':
4203                                 $query = "SELECT bshortname, bname FROM %s";
4204                                 $show  = array(
4205                                         'content' => 'shortblognames'
4206                                 );
4207                                 $query = sprintf($query, sql_table('blog'));
4208                                 Showlist($query, 'table', $show, $templateName);
4209                                 break;
4210                         case 'template':
4211                                 $query = "SELECT tdname as name, tddesc as description FROM %s";
4212                                 $show  = array(
4213                                         'content' => 'shortnames'
4214                                 );
4215                                 $query = sprintf($query, sql_table('template_desc'));
4216                                 Showlist($query, 'table', $show, $templateName);
4217                                 break;
4218                 }
4219                 return;
4220         }
4221         
4222         /**
4223          * AdminActions::parse_skinielist()
4224          * Parse skinvar skinielist
4225          * 
4226          * @param       string  $type                   type of skin
4227          * @param       string  $templateName   name of template to use
4228          * @return      void
4229          */
4230         public function parse_skinielist($type, $templateName = '')
4231         {
4232                 $templates = array();
4233                 if ( $templateName )
4234                 {
4235                         $templates = Template::read($templateName);
4236                 }
4237                 if ( array_key_exists('SKINIE_EXPORT_LIST', $templates) && !empty($templates['SKINIE_EXPORT_LIST']) )
4238                 {
4239                         $template = $templates['SKINIE_EXPORT_LIST'];
4240                 }
4241                 else
4242                 {
4243                         $template = '<td><input type="checkbox" name="<%typeid%>"  id="<%expid%>" /><label for="<%expid%>"><%expname%></label></td>' . "\n"
4244                                           . "<td><%expdesc%></td>\n"
4245                                           . "</tr><tr>\n";
4246                 }
4247                 switch ( $type )
4248                 {
4249                         case 'skin':
4250                                 $res = sql_query('SELECT * FROM ' . sql_table('skin_desc'));
4251                                 while ( $skinObj = sql_fetch_object($res) )
4252                                 {
4253                                         $data = array(
4254                                                 'typeid'        => 'skin[' . $skinObj->sdnumber . ']',
4255                                                 'expid'         => 'skinexp' . $skinObj->sdnumber,
4256                                                 'expname'       => Entity::hsc($skinObj->sdname),
4257                                                 'expdesc'       => Entity::hsc($skinObj->sddesc),
4258                                         );
4259                                         echo TEMPLATE::fill($template, $data);
4260                                 }
4261                                 break;
4262                         case 'template':
4263                                 $res = sql_query('SELECT * FROM '.sql_table('template_desc'));
4264                                 while ($templateObj = sql_fetch_object($res)) {
4265                                         $data = array(
4266                                                 'typeid'        => 'template[' . $templateObj->tdnumber . ']',
4267                                                 'expid'         => 'templateexp' . $templateObj->tdnumber,
4268                                                 'expname'       => Entity::hsc($templateObj->tdname),
4269                                                 'expdesc'       => Entity::hsc($templateObj->tddesc),
4270                                         );
4271                                         echo TEMPLATE::fill($template, $data);
4272                                 }
4273                                 break;
4274                 }
4275                 return;
4276         }
4277         
4278         /**
4279          * AdminActions::parse_skinoverview()
4280          * Parse skinvar skinoverview
4281          * 
4282          * @param       string  $templateName   name of template to use
4283          * @return      void
4284          */
4285         public function parse_skinoverview($templateName = '')
4286         {
4287                 $query  = "SELECT * FROM %s ORDER BY sdname";
4288                 $query = sprintf($query, sql_table('skin_desc'));
4289                 
4290                 $template['content']  = 'skinlist';
4291                 $template['tabindex'] = 10;
4292                 $template['friendly_names'] = Skin::getFriendlyNames('Actions');
4293                 
4294                 Showlist($query, 'table', $template, $templateName);
4295                 return;
4296         }
4297         
4298         /**
4299          * AdminActions::parse_skintypehelp()
4300          * Check editing skintypehelp
4301          * 
4302          * @param       void
4303          * @return      void
4304          */
4305         public function parse_skintypehelp()
4306         {
4307                 $nowSkinType = strtolower(trim(requestVar('type')));
4308                 $regularType = array(
4309                         'index',
4310                         'item',
4311                         'archivelist',
4312                         'archive',
4313                         'search',
4314                         'error',
4315                         'member',
4316                         'imagepopup'
4317                 );
4318                 
4319                 if ( in_array($nowSkinType, $regularType) )
4320                 {
4321                         help('skinpart' . $nowSkinType);
4322                 }
4323                 else
4324                 {
4325                         help('skinpartspecial');
4326                 }
4327                 return;
4328         }
4329         
4330         /**
4331          * AdminActions::parse_specialskinlist()
4332          * Parse skinvar specialskinlist
4333          * 
4334          * @param       string  $templateName   name of template to use
4335          * @return      void
4336          */
4337         public function parse_specialskinlist($templateName = '')
4338         {
4339                 $templates = array();
4340                 if ( $templateName )
4341                 {
4342                         $templates = Template::read($templateName);
4343                 }
4344                 $nType  = array(
4345                         'index',
4346                         'item',
4347                         'error',
4348                         'search',
4349                         'archive',
4350                         'archivelist',
4351                         'imagepopup',
4352                         'member'
4353                 );
4354                 $skinid = intRequestVar('skinid');
4355                 $query  = "SELECT stype FROM %s WHERE stype NOT IN ('%s') AND sdesc = %d;";
4356                 $query = sprintf($query, sql_table('skin'), implode("', '", $nType), $skinid);
4357                 
4358                 $res    = sql_query($query);
4359                 if ( $res && sql_num_rows($res) > 0 )
4360                 {
4361                         $data = array();
4362                         if ( array_key_exists('SPECIALSKINLIST_HEAD', $templates) && !empty($templates['SPECIALSKINLIST_HEAD']) )
4363                         {
4364                                 $template['head'] = $templates['SPECIALSKINLIST_HEAD'];
4365                         }
4366                         else
4367                         {
4368                                 $template['head'] = "<ul>\n";
4369                         }
4370                         echo TEMPLATE::fill($template['head'], $data);
4371                         if ( array_key_exists('SPECIALSKINLIST_BODY', $templates) && !empty($templates['SPECIALSKINLIST_BODY']) )
4372                         {
4373                                 $template['body'] = $templates['SPECIALSKINLIST_BODY'];
4374                         }
4375                         else
4376                         {
4377                                 $template['body'] = '<li><a tabindex="<%tabindex%>" href="index.php?action=skinedittype&amp;skinid=<%skinid%>'
4378                                                                   . '&amp;type=<%skintype%>"><%skintype%></a> (<a tabindex="<%tabindex%>" href="index.php?'
4379                                                                   . 'action=skinremovetype&amp;skinid=<%skinid%>&amp;type=<%skintype%>">remove</a>)</li>';
4380                         }
4381                         $tabstart = 75;
4382                         while ( $row = sql_fetch_assoc($res) )
4383                         {
4384                                 $data = array(
4385                                         'tabindex' => $tabstart++,
4386                                         'skinid'   => $skinid,
4387                                         'skintype' => Entity::hsc(strtolower($row['stype']))
4388                                 );
4389                                 echo TEMPLATE::fill($template['body'], $data);
4390                         }
4391                         $data = array();
4392                         if (array_key_exists('SPECIALSKINLIST_FOOT', $templates) && !empty($templates['SPECIALSKINLIST_FOOT']) )
4393                         {
4394                                 $template['foot'] = $templates['SPECIALSKINLIST_FOOT'];
4395                         }
4396                         else
4397                         {
4398                                 $template['foot'] = "</ul>\n";
4399                         }
4400                         echo TEMPLATE::fill($template['foot'], $data);
4401                         return;
4402                 }
4403         }
4404         
4405         /**
4406          * AdminActions::parse_sprinttext()
4407          * Parse sprinttext
4408          * 
4409          * @param       string  $which  
4410          * @param       string  $val    
4411          * @return      void
4412          */
4413         public function parse_sprinttext($which, $val)
4414         {
4415                 if ( !defined($which) )
4416                 {
4417                         $base = $which;
4418                 }
4419                 else
4420                 {
4421                         $base = constant($which);
4422                 }
4423                 
4424                 if ( preg_match('#[^<|%].*[^%|>]#', $val, $matchies) )
4425                 {
4426                         if ( !preg_match('#[(].*[^)]#', $matchies[0], $args) )
4427                         {
4428                                 $met = 'parse_' . $matchies[0];
4429                         }
4430                         else
4431                         {
4432                                 $arg = trim($args[0], '()');
4433                                 $met = 'parse_' . substr($matchies[0], 0, strpos($matchies[0], '('));
4434                         }
4435                         
4436                         if ( method_exists($this, $met) )
4437                         {
4438                                 $value = call_user_func(array(&$this, $met), $arg);
4439                         }
4440                 }
4441                 
4442                 if ( !isset($value) || empty($value) )
4443                 {
4444                         $value = $val;
4445                 }
4446                 echo sprintf($base, $value);
4447                 return;
4448         }
4449         
4450         /**
4451          * AdminActions::parse_systemsettings()
4452          * Parse skinvar systemsettings
4453          * 
4454          * @param       string  $type                   type of settings for system
4455          * @param       string  $templateName   name of template to use 
4456          * @return      void
4457          */
4458         public function parse_systemsettings($type = 'phpinfo', $templateName = '')
4459         {
4460                 global $member, $CONF, $nucleus;
4461                 
4462                 $member->isAdmin() or Admin::disallow();
4463                 
4464                 $enable  = _ADMIN_SYSTEMOVERVIEW_ENABLE;
4465                 $disable = _ADMIN_SYSTEMOVERVIEW_DISABLE;
4466                 
4467                 switch ( $type )
4468                 {
4469                         case 'phpversion':
4470                                 echo phpversion();
4471                                 break;
4472                         case 'sqlserverinfo':
4473                                 echo sql_get_server_info();
4474                                 break;
4475                         case 'sqlclientinfo':
4476                                 echo sql_get_client_info();
4477                                 break;
4478                         case 'magicquotesgpc':
4479                                 echo ini_get('magic_quotes_gpc') ? 'On' : 'Off';
4480                                 break;
4481                         case 'magicquotesruntime':
4482                                 echo ini_get('magic_quotes_runtime') ? 'On' : 'Off';
4483                                 break;
4484                         case 'registerglobals':
4485                                 echo ini_get('register_globals') ? 'On' : 'Off';
4486                                 break;
4487                         case 'gdinfo':
4488                                 $templates = array();
4489                                 if ( $templateName )
4490                                 {
4491                                         $templates = Template::read($templateName);
4492                                 }
4493                                 if ( array_key_exists('SYSTEMINFO_GDSETTINGS', $templates) && !empty($templates['SYSTEMINFO_GDSETTINGS']) )
4494                                 {
4495                                         $template = $templates['SYSTEMINFO_GDSETTINGS'];
4496                                 }
4497                                 else
4498                                 {
4499                                         $template = "<tr>\n\t\t" . '<td width="50%">' . "<%key%></td><td><%value%></td>\n</tr>\n";
4500                                 }
4501                                 
4502                                 $gdinfo = gd_info();
4503                                 
4504                                 foreach ( $gdinfo as $key => $value )
4505                                 {
4506                                         if ( is_bool($value) )
4507                                         {
4508                                                 $value = $value ? $enable : $disable;
4509                                         }
4510                                         else
4511                                         {
4512                                                 $value = Entity::hsc($value);
4513                                         }
4514                                         $data = array(
4515                                                 'key'   => $key,
4516                                                 'value' => $value,
4517                                         );
4518                                         echo TEMPLATE::fill($template, $data);
4519                                 }
4520                                 break;
4521                         case 'modrewrite':
4522                                 ob_start();
4523                                 phpinfo(INFO_MODULES);
4524                                 $im = ob_get_contents();
4525                                 ob_end_clean();
4526                                 echo ( i18n::strpos($im, 'mod_rewrite') !== FALSE ) ? $enable : $disable;
4527                                 break;
4528                         case 'nucleusversion':
4529                                 echo getNucleusVersion() / 100 . '(' . $nucleus['version'] . ')';
4530                                 break;
4531                         case 'nucleuspatchlevel':
4532                                 echo getNucleusPatchLevel();
4533                                 break;
4534                         case 'confself':
4535                                 echo $CONF['Self'];
4536                                 break;
4537                         case 'confitemurl':
4538                                 echo $CONF['ItemURL'];
4539                                 break;
4540                         case 'alertonheaderssent':
4541                                 echo $CONF['alertOnHeadersSent'] ? $enable : $disable;
4542                                 break;
4543                         case 'nucleuscodename':
4544                                 if ( $nucleus['codename'] != '' )
4545                                 {
4546                                         echo ' &quot;' . $nucleus['codename'] . '&quot;';
4547                                 }
4548                                 break;
4549                         case 'versioncheckurl':
4550                                 echo sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
4551                                 break;
4552                 }
4553                 return;
4554         }
4555         
4556         /**
4557          * AdminActions::parse_templateoverview()
4558          * Parse skinvar templateoverview
4559          * 
4560          * @param       string  $templateName   name of template to use
4561          * @return      void
4562          */
4563         public function parse_templateoverview($templateName = '')
4564         {
4565                 $query  = "SELECT * FROM %s ORDER BY tdname";
4566                 $query = sprintf($query, sql_table('template_desc'));
4567                 $template['content']  = 'templatelist';
4568                 $template['tabindex'] = 10;
4569                 Showlist($query, 'table', $template, $templateName);
4570                 return;
4571         }
4572         
4573         /**
4574          * AdminActions::parse_ticket()
4575          * Parse ticket
4576          * 
4577          * @param       void
4578          * @return      void
4579          */
4580         public function parse_ticket()
4581         {
4582                 global $manager;
4583                 $manager->addTicketHidden();
4584                 return;
4585         }
4586         
4587         /**
4588          * AdminActions::parse_versioncheckurl()
4589          * Parse skinvar versioncheckurl
4590          * 
4591          * @param       void
4592          * @return      void
4593          */
4594         public function parse_versioncheckurl()
4595         {
4596                 echo sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
4597                 return;
4598         }
4599         
4600         /**
4601          * AdminActions::parse_yrbloglist()
4602          * Parse skinvar yrbloglist
4603          * 
4604          * @param       string  $templateName   name of template to use
4605          * @return      void
4606          */
4607         public function parse_yrbloglist($templateName = '')
4608         {
4609                 global $member;
4610                 $showAll = requestVar('showall');
4611                 
4612                 if ( $member->isAdmin() && ($showAll == 'yes') )
4613                 {
4614                         // Super-Admins have access to all blogs! (no add item support though)
4615                         $query =  "SELECT bnumber, bname, 1 as tadmin, burl, bshortname"
4616                                 . " FROM %s"
4617                                 . " ORDER BY bnumber";
4618                         $query = sprintf($query, sql_table('blog'));
4619                 }
4620                 else
4621                 {
4622                         $query =  "SELECT bnumber, bname, tadmin, burl, bshortname"
4623                                 . " FROM %s,%s"
4624                                 . " WHERE tblog=bnumber and tmember=%d"
4625                                 . " ORDER BY bnumber";
4626                         $query = sprintf($query, sql_table('blog'), sql_table('team'), (integer) $member->getID());
4627                 }
4628                 
4629                 $template['content']    = 'bloglist';
4630                 $template['superadmin'] = $member->isAdmin();
4631                 
4632                 $amount = Showlist($query, 'table', $template, $templateName);
4633                 
4634                 if ( ($showAll != 'yes') && ($member->isAdmin()) )
4635                 {
4636                         $query = 'SELECT COUNT(*) as result FROM ' . sql_table('blog');
4637                         
4638                         $total = quickQuery($query);
4639                         if ( $total > $amount )
4640                         {
4641                                 echo '<p><a href="index.php?action=overview&amp;showall=yes">' . _OVERVIEW_SHOWALL . '</a></p>';
4642                         }
4643                 }
4644                 
4645                 if ( $amount == 0 )
4646                 {
4647                         echo _OVERVIEW_NOBLOGS;
4648                 }
4649                 elseif( $amount != 0 )
4650                 {
4651                         echo '<h2>' . _OVERVIEW_YRDRAFTS . '</h2>';
4652                         
4653                         $query =  "SELECT ititle, inumber, bshortname"
4654                                . " FROM %s,%s"
4655                                . ' WHERE iauthor=%d AND iblog=bnumber AND idraft=1';
4656                         $query = sprintf($query, sql_table('item'), sql_table('blog'), (integer) $member->getID());
4657                         
4658                         $template['content'] = 'draftlist';
4659                         
4660                         $amountdrafts = Showlist($query, 'table', $template, $templateName);
4661                         if ( $amountdrafts == 0 )
4662                         {
4663                                 echo _OVERVIEW_NODRAFTS;
4664                         }
4665                 }
4666                 return;
4667         }
4668         
4669         /**
4670          * AdminActions::checkCondition()
4671          * Checks conditions for if statements
4672          *
4673          * @param       string  $field type of <%if%>
4674          * @param       string  $name property of field
4675          * @param       string  $value value of property
4676          * @return      boolean condition
4677          */
4678         protected function checkCondition($field, $name='', $value = '')
4679         {
4680                 global $CONF, $catid, $blog, $member, $itemidnext, $itemidprev, $manager, $archiveprevexists, $archivenextexists;
4681                 
4682                 $condition = 0;
4683                 switch ( $field )
4684                 {
4685                         case 'category':
4686                                 if ( !$blog )
4687                                 {
4688                                         if ( $blogid )
4689                                         {
4690                                                 global $manager;
4691                                                 $blog =& $manager->getBlog($blogid);
4692                                         }
4693                                         elseif ( $catid )
4694                                         {
4695                                                 $blogid = getBlogIDFromCatID($catid);
4696                                                 global $manager;
4697                                                 $blog =& $manager->getBlog($blogid);
4698                                         }
4699                                         elseif ( intRequestVar('catid') )
4700                                         {
4701                                                 $catid = intRequestVar('catid');
4702                                                 $blogid = getBlogIDFromCatID($catid);
4703                                                 global $manager;
4704                                                 $blog =& $manager->getBlog($blogid);
4705                                         }
4706                                         else
4707                                         {
4708                                                 return;
4709                                         }
4710                                 }
4711                                 $condition = ($blog && $this->ifCategory($name, $value));
4712                                 break;
4713                         case 'blogsetting':
4714                                 $condition = ($blog && ($blog->getSetting($name) == $value));
4715                                 break;
4716                         case 'loggedin':
4717                                 $condition = $member->isLoggedIn();
4718                                 break;
4719                         case 'onteam':
4720                                 $condition = $member->isLoggedIn() && $this->ifOnTeam($name);
4721                                 break;
4722                         case 'admin':
4723                                 $condition = $member->isLoggedIn() && $this->ifAdmin($name);
4724                                 break;
4725                         case 'superadmin':
4726                                 $condition = $member->isLoggedIn() && $member->isAdmin();
4727                                 break;
4728                         case 'allowloginedit':
4729                                 $condition = $member->isLoggedIn() && ($CONF['AllowLoginEdit'] || $member->isAdmin());
4730                                 break;
4731                         case 'nextitem':
4732                                 $condition = ($itemidnext != '');
4733                                 break;
4734                         case 'previtem':
4735                                 $condition = ($itemidprev != '');
4736                                 break;
4737                         case 'archiveprevexists':
4738                                 $condition = ($archiveprevexists == true);
4739                                 break;
4740                         case 'archivenextexists':
4741                                 $condition = ($archivenextexists == true);
4742                                 break;
4743                         case 'skintype':
4744                                 $condition = (($name == $this->skintype) || ($name == requestVar('action')));
4745                                 break;
4746                         case 'hasplugin':
4747                                 $condition = $this->ifHasPlugin($name, $value);
4748                                 break;
4749                         case 'adminaction':
4750                                 $condition = ($this->objAdmin->action == $name);
4751                                 break;
4752                         case 'adminoldaction':
4753                                 $condition = ($this->objAdmin->action == $name);
4754                                 break;
4755                         case 'addresschange':
4756                                 $condition = ($this->ifAddresscange());
4757                                 break;
4758                         case 'bechangepass':
4759                                 $condition = ($this->beChangePassword());
4760                                 break;
4761                         case 'skincandidates':
4762                                 $condition = ($this->ifSkincandidates());
4763                                 break;
4764                         case 'nameclashes':
4765                                 $condition = requestVar('nameclashes');
4766                                 break;
4767                         case 'existsnewplugin':
4768                                 $condition = ($this->existsNewPlugin());
4769                                 break;
4770                         case 'autosave':
4771                                 $condition = (boolean) ($member->getAutosave() == $value);
4772                                 break;
4773                         default:
4774                                 $condition = $manager->pluginInstalled("NP_{$field}") && $this->ifPlugin($field, $name, $value);
4775                                 break;
4776                 }
4777                 return $condition;
4778         }
4779         
4780         /**
4781          * Actions::_ifHasPlugin()
4782          *      hasplugin,PlugName
4783          *         -> checks if plugin exists
4784          *      hasplugin,PlugName,OptionName
4785          *         -> checks if the option OptionName from plugin PlugName is not set to 'no'
4786          *      hasplugin,PlugName,OptionName=value
4787          *         -> checks if the option OptionName from plugin PlugName is set to value
4788          *
4789          * @param       string  $name   name of plugin
4790          * @param       string  $value  
4791          * @return      
4792          */
4793         private function ifHasPlugin($name, $value)
4794         {
4795                 global $manager;
4796                 $condition = false;
4797                 // (pluginInstalled method won't write a message in the actionlog on failure)
4798                 if ( $manager->pluginInstalled("NP_{$name}") )
4799                 {
4800                         $plugin =& $manager->getPlugin("NP_{$name}");
4801                         if ( $plugin != NULL )
4802                         {
4803                                 if ( $value == "" )
4804                                 {
4805                                         $condition = true;
4806                                 }
4807                                 else
4808                                 {
4809                                         list($name2, $value2) = preg_split('#=#', $value, 2);
4810                                         if ( $value2 == "" && $plugin->getOption($name2) != 'no' )
4811                                         {
4812                                                 $condition = true;
4813                                         }
4814                                         else if ( $plugin->getOption($name2) == $value2 )
4815                                         {
4816                                                 $condition = true;
4817                                         }
4818                                 }
4819                         }
4820                 }
4821                 return $condition;
4822         }
4823         
4824         /**
4825          * Actions::beChangePassword()
4826          * 
4827          * @param       void
4828          * @return      void
4829          */
4830         private function beChangePassword()
4831         {
4832                 return intRequestVar('bNeedsPasswordChange');
4833         }
4834         
4835         /**
4836          * Actions::ifSkincandidates()
4837          * Checks if a plugin exists and call its doIf function
4838          * 
4839          * @param       void
4840          * @return      void
4841          */
4842         private function ifSkincandidates()
4843         {
4844                 global $DIR_SKINS;
4845                 $candidates = SKINIMPORT::searchForCandidates($DIR_SKINS);
4846                 return (count($candidates) > 0);
4847         }
4848         
4849         /**
4850          * Actions::ifPlugin()
4851          * Checks if a plugin exists and call its doIf function
4852          */
4853         private function ifPlugin($name, $key = '', $value = '')
4854         {
4855                 global $manager;
4856
4857                 $plugin =& $manager->getPlugin("NP_{$name}");
4858                 if ( !$plugin )
4859                 {
4860                         return;
4861                 }
4862
4863                 $params = func_get_args();
4864                 array_shift($params);
4865
4866                 return call_user_func_array(array(&$plugin, 'doIf'), $params);
4867         }
4868
4869         /**
4870          *  Different checks for a category
4871          */
4872         private function ifCategory($name = '', $value='')
4873         {
4874                 global $blog, $catid;
4875
4876                 // when no parameter is defined, just check if a category is selected
4877                 if (($name != 'catname' && $name != 'catid') || ($value == ''))
4878                 {
4879                         return $blog->isValidCategory($catid);
4880                 }
4881
4882                 // check category name
4883                 if ( $name == 'catname' )
4884                 {
4885                         $value = $blog->getCategoryIdFromName($value);
4886                         if ($value == $catid)
4887                         {
4888                                 return $blog->isValidCategory($catid);
4889                         }
4890                 }
4891
4892                 // check category id
4893                 if (($name == 'catid') && ($value == $catid))
4894                 {
4895                         return $blog->isValidCategory($catid);
4896                 }
4897
4898                 return FALSE;
4899         }
4900
4901         /**
4902          *  Checks if a member is on the team of a blog and return his rights
4903          */
4904         private function ifOnTeam($blogName = '')
4905         {
4906                 global $blog, $member, $manager;
4907
4908                 // when no blog found
4909                 if ( ($blogName == '') && !is_object($blog) )
4910                 {
4911                         return 0;
4912                 }
4913                 
4914                 // explicit blog selection
4915                 if ($blogName != '')
4916                 {
4917                         $blogid = getBlogIDFromName($blogName);
4918                 }
4919
4920                 if (($blogName == '') || !$manager->existsBlogID($blogid))
4921                 {
4922                         // use current blog
4923                         $blogid = $blog->getID();
4924                 }
4925                 return $member->teamRights($blogid);
4926         }
4927
4928         /**
4929          *  Checks if a member is admin of a blog
4930          */
4931         private function ifAdmin($blogName = '')
4932         {
4933                 global $blog, $member, $manager;
4934
4935                 // when no blog found
4936                 if (($blogName == '') && (!is_object($blog)))
4937                 {
4938                         return 0;
4939                 }
4940
4941                 // explicit blog selection
4942                 if ($blogName != '')
4943                 {
4944                         $blogid = getBlogIDFromName($blogName);
4945                 }
4946
4947                 if (($blogName == '') || !$manager->existsBlogID($blogid))
4948                 {
4949                         // use current blog
4950                         $blogid = $blog->getID();
4951                 }
4952
4953                 return $member->isBlogAdmin($blogid);
4954         }
4955
4956         /**
4957          * Check e-Mail address is changed
4958          */
4959         private function ifAddresscange()
4960         {
4961                 $key = $this->objAdmin->sessionVar("{$CONF['CookiePrefix']}ackey");
4962                 if ( !$key )
4963                 {
4964                         return FALSE;
4965                 }
4966                 $info = MEMBER::getActivationInfo($key);
4967                 if ( !$info )
4968                 {
4969                         return FALSE;
4970                 }
4971                 $mem  = MEMBER::createFromId($info->vmember);
4972                 if ( !$mem )
4973                 {
4974                         return FALSE;
4975                 }
4976                 if ( $info->vtype == 'addresschange' )
4977                 {
4978                         return TRUE;
4979                 }
4980                 return FALSE;
4981         }
4982         
4983         /**
4984          * AdminActions::customHelp()
4985          * shows a link to custom help file
4986          * 
4987          * @param       integer $id                     
4988          * @param       string  $tplName        
4989          * @param       string  $url            
4990          * @param       string  $iconURL        
4991          * @param       string  $alt            
4992          * @param       string  $title          
4993          * @param       $onclick
4994          * 
4995          */
4996         private function customHelp($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
4997         {
4998                 echo self::customHelpHtml($id, $tplName, $url, $iconURL, $alt, $title, $onclick);
4999         }
5000         
5001         /**
5002          * AdminActions::customHelpHtml()
5003          * 
5004          * @param       integer $id                     
5005          * @param       string  $tplName        
5006          * @param       string  $url            
5007          * @param       string  $iconURL        
5008          * @param       string  $alt            
5009          * @param       string  $title          
5010          * @param       string  $onclick        
5011          * @return      string  anchor element with help uri
5012          */
5013         private function customHelpHtml($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
5014         {
5015                 $templates = array();
5016                 if ( $tplName )
5017                 {
5018                         $templates = Template::read($tplName);
5019                 }
5020                 if ( array_key_exists('ADMIN_CUSTOMHELPLINK_ICON', $templates) && !empty($templates['ADMIN_CUSTOMHELPLINK_ICON']) )
5021                 {
5022                         $template = $templates['ADMIN_CUSTOMHELPLINK_ICON'];
5023                 }
5024                 else
5025                 {
5026                         $template = '<img src="<%iconurl%>" <%width%><%height%>alt="<%alt%>" title="<%title%>" /></a>';
5027                 }
5028                 
5029                 if ( empty($iconURL) )
5030                 {
5031                         global $CONF;
5032                         $iconURL = $CONF['AdminURL'] . 'documentation/icon-help.gif';
5033                 }
5034                 if ( function_exists('getimagesize') )
5035                 {
5036                         $size   = getimagesize($iconURL);
5037                         $width  = 'width="'  . $size[0] . '" ';
5038                         $height = 'height="' . $size[1] . '" ';
5039                 }
5040                 $data = array(
5041                         'iconurl'       => $iconURL,
5042                         'width'         => $width,
5043                         'height'        => $height,
5044                         'alt'           => (isset($alt) && !empty($alt))         ? $alt   : _HELP_TT,
5045                         'title'         => (isset($title) && !empty($title)) ? $title : _HELP_TT,
5046                 );
5047                 $icon = TEMPLATE::fill($template, $data);
5048                 $help = self::customHelplink($id, $tplName, $url, $title, $onclick);
5049                 return $help . $icon;
5050         }
5051         
5052         /**
5053          * AdminActions::input_yesno
5054          * 
5055          * @param               $name
5056          * @param               $checkedval
5057          * @param               $tabindex
5058          * @param               $value1
5059          * @param               $value2
5060          * @param               $yesval
5061          * @param               $noval
5062          * @param               $isAdmin
5063          * @param               $templateName
5064          * @param               $showlist
5065          */
5066         private function input_yesno($name,
5067                                                                 $checkedval,
5068                                                                 $tabindex        = 0,
5069                                                                 $value1    = 1,
5070                                                                 $value2    = 0,
5071                                                                 $yesval    = _YES,
5072                                                                 $noval          = _NO,
5073                                                                 $isAdmin          = 0,
5074                                                                 $templateName = '',
5075                                                                 $showlist        = false)
5076         {
5077                 $templates = array();
5078                 if ( $templateName )
5079                 {
5080                         $templates = Template::read($templateName);
5081                 }
5082                 
5083                 if ( $name == 'admin' )
5084                 {
5085                         if ( array_key_exists('INPUTYESNO_TEMPLATE_ADMIN', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_ADMIN']) )
5086                         {
5087                                 $template = $templates['INPUTYESNO_TEMPLATE_ADMIN'];
5088                         }
5089                         else
5090                         {
5091                                 $template = '<input onclick="selectCanLogin(true);" type="radio" name="<%name%>" value="<%yesval%>" <%yescheckedval%> id="<%yesid%>" />' . "\n"
5092                                           . '<label for="<%yesid%>"><%yesvaltext%></label>' . "\n"
5093                                           . '<input onclick="selectCanLogin(false);" type="radio" name="<%name%>" value="<%noval%>" <%nocheckedval%> id="<%noid%>"<%disabled%> />' . "\n"
5094                                           . '<label for="<%noid%>"><%novaltext%></label>' . "\n";
5095                         }
5096                 }
5097                 else
5098                 {
5099                         if ( array_key_exists('INPUTYESNO_TEMPLATE_NORMAL', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_NORMAL']) )
5100                         {
5101                                 $template = $templates['INPUTYESNO_TEMPLATE_NORMAL'];
5102                         }
5103                         if ( $showlist )
5104                         {
5105                                 if ( array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO', $templates) && !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO']) )
5106                                 {
5107                                         $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO'];
5108                                 }
5109                         }
5110                         if ( !isset($template) )
5111                         {
5112                                 $template = '<input type="radio" name="<%name%>" value="<%yesval%>" <%yescheckedval%> id="<%yesid%>" />' . "\n"
5113                                           . '<label for="<%yesid%>"><%yesvaltext%></label>' . "\n"
5114                                           . '<input type="radio" name="<%name%>" value="<%noval%>" <%nocheckedval%> id="<%noid%>"<%disabled%> />' . "\n"
5115                                           . '<label for="<%noid%>"><%novaltext%></label>' . "\n";
5116                         }
5117                 }
5118                 
5119                 //echo $template;
5120                 $id             = Entity::hsc($name);
5121                 $id             = str_replace('[', '-', $id);
5122                 $id             = str_replace(']', '-', $id);
5123                 $id1    = $id . Entity::hsc($value1);
5124                 $id2    = $id . Entity::hsc($value2);
5125                 $dat = array(
5126                         'name'                  => Entity::hsc($name),
5127                         'yesval'                => Entity::hsc($value1),
5128                         'noval'                 => Entity::hsc($value2),
5129                         'yesid'                 => $id1,
5130                         'noid'                  => $id2,
5131                         'yesvaltext'    => $yesval,
5132                         'novaltext'             => $noval,
5133                         'yescheckedval' => ($checkedval == $value1) ? ' checked="checked" tabindex="' . $tabindex . '"': '',
5134                         'nocheckedval'  => ($checkedval != $value1) ? ' checked="checked" tabindex="' . $tabindex . '"': '',
5135                         'disabled'              => ($isAdmin && $name == 'canlogin') ? ' disabled="disabled"' : '',
5136                 );
5137                 
5138                 if ( $showlist )
5139                 {
5140                         return Template::fill($template, $dat);
5141                 }
5142                 else
5143                 {
5144                         echo TEMPLATE::fill($template, $dat);
5145                 }
5146                 return;
5147         }
5148 }