OSDN Git Service

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