OSDN Git Service

277172f353c438c858320d15efb3d2175490e5bf
[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 WHERE sdincmode = 'admin';";
1228                                 $query = sprintf($query, sql_table('skin_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 WHERE sdincmode = 'admin' ORDER BY sdname;";
1271                 $query = sprintf($query, sql_table('skin_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 WHERE sdincmode = 'admin';";
1291                 $query = sprintf($query, sql_table('skin_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('skin'), "'" . 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       void
1901          * @return      void
1902          */
1903         public function parse_bookmarkletadmin()
1904         {
1905                 global $manager;
1906                 
1907                 $blogid = intRequestVar('blogid');
1908                 
1909                 echo Entity::hsc(getBookmarklet($blogid));
1910                 return;
1911         }
1912         
1913         /**
1914          * AdminActions::parse_category()
1915          * Parse skinvar category
1916          * 
1917          * @param       string  $type   name of setting for category
1918          * @return      void
1919          */
1920         public function parse_category($type = 'name')
1921         {
1922                 echo $this->parse_getcategory($type);
1923                 return;
1924         }
1925         
1926         /**
1927          * AdminActions::parse_categorysetting()
1928          * Parse skinvar categorysetting
1929          * 
1930          * @param       string  $type   type in category setting
1931          * @return      void
1932          */
1933         public function parse_categorysetting($type)
1934         {
1935                 $catid  = intRequestVar('catid');
1936                 if ( $type == 'id' )
1937                 {
1938                         echo $catid;
1939                         return;
1940                 }
1941                 $blogid = intRequestVar('blogid');
1942                 $query  = "SELECT * FROM %s WHERE cblog = %d AND catid = %d;";
1943                 $query  = sprintf($query, sql_table('category'), (integer) $blogid, (integer) $catid);
1944                 $res    = sql_query($query);
1945                 $obj    = sql_fetch_object($res);
1946                 
1947                 if ( $type != desc )
1948                 {
1949                         echo Entity::hsc($obj->cdesc);
1950                 }
1951                 else
1952                 {
1953                         echo Entity::hsc($obj->cname);
1954                 }
1955                 
1956                 return;
1957         }
1958         
1959         /**
1960          * AdminActions::parse_codename()
1961          * Parse templatevar codename
1962          * 
1963          * @param       void
1964          * @return      void
1965          * 
1966          * TODO: is this need???
1967          */
1968         public function parse_codename()
1969         {
1970                 global $nucleus;
1971                 echo $nucleus['codename'];
1972                 return;
1973         }
1974         
1975         /**
1976          * AdminActions::parse_commentnavlist()
1977          * Parse skinvar commentnavlist
1978          * 
1979          * @param       void
1980          * @return      void
1981          */
1982         public function parse_commentnavlist()
1983         {
1984                 global $CONF, $manager, $member;
1985                 
1986                 // start index
1987                 if ( postVar('start') )
1988                 {
1989                         $start = intPostVar('start');
1990                 }
1991                 else
1992                 {
1993                         $start = 0;
1994                 }
1995                 
1996                 // amount of items to show
1997                 if ( postVar('amount') )
1998                 {
1999                         $amount = intPostVar('amount');
2000                 }
2001                 else
2002                 {
2003                         $amount = (integer) $CONF['DefaultListSize'];
2004                         if ( $amount < 1 )
2005                         {
2006                                 $amount = 10;
2007                         }
2008                 }
2009                 $query = 'SELECT cbody, cuser, cmail, cemail, mname, ctime, chost, cnumber, cip, citem '
2010                        . 'FROM %s '
2011                        . 'LEFT OUTER JOIN %s ON  mnumber=cmember '
2012                        . 'WHERE ';
2013                 $query = sprintf($query, sql_table('comment'), sql_table('member'));
2014                 
2015                 if ( $this->skintype == 'itemcommentlist' )
2016                 {
2017                         $itemid                                 = intRequestVar('itemid');
2018                         $query                                  .= " citem={$itemid}";
2019                         $template['canAddBan']  = $member->blogAdminRights(intRequestVar('blogid'));
2020                         $bid                                    = 0;
2021                         $nonComments                    = _NOCOMMENTS;
2022                 }
2023                 elseif ( $this->skintype == 'browseowncomments' )
2024                 {
2025                         $itemid                                 = 0;
2026                         $query                                  .= ' cmember=' . $member->getID();
2027                         $template['canAddBan']  = 0;
2028                         $bid                                    = 0;
2029                         $nonComments                    = _NOCOMMENTS_YOUR;
2030                 }
2031                 elseif ( $this->skintype == 'blogcommentlist' )
2032                 {
2033                         $itemid                                 = 0;
2034                         $query                                  .= ' cblog=' . intRequestVar('blogid');
2035                         $template['canAddBan']  = $member->blogAdminRights(intRequestVar('blogid'));
2036                         $bid                                    = intRequestVar('blogid');
2037                         $nonComments                    = _NOCOMMENTS_BLOG;
2038                 }
2039                 
2040                 $search = postVar('search');
2041                 if ( !empty($search) )
2042                 {
2043                         $query .= ' and cbody LIKE "%' . sql_real_escape_string($search) . '%"';
2044                 }
2045                 
2046                 $query .= " ORDER BY ctime ASC LIMIT {$start},{$amount}";
2047                 
2048                 $template['content'] = 'commentlist';
2049                 
2050                 $navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $bid, $search, $itemid);
2051                 $navList->showBatchList('comment', $query, 'table', $template, $nonComments);
2052                 return;
2053         }
2054         
2055         /**
2056          * AdminActions::parse_configsettingsedit()
2057          * Parse skinvar configsettingsedit
2058          * 
2059          * @param       string  $type   type of global configuration
2060          * @return      void
2061          */
2062         public function parse_configsettingsedit($type)
2063         {
2064                 global $CONF;
2065                 switch ( $type )
2066                 {
2067                         case 'DefaultListSize':
2068                                 if ( !array_key_exists('DefaultListSize', $CONF) )
2069                                 {
2070                                         $query = "INSERT INTO %s VALUES (DefaultListSize, 10);";
2071                                         $query = sprintf($query, sql_table('config'));
2072                                         sql_query($query);
2073                                         $CONF['DefaultListSize'] = 10;
2074                                 }
2075                                 elseif ( intval($CONF['DefaultListSize']) < 1 )
2076                                 {
2077                                         $CONF['DefaultListSize'] = 10;
2078                                 }
2079                                 echo intval($CONF['DefaultListSize']);
2080                                 break;
2081                         case 'SessionCookie':
2082                                 $value = $CONF['SessionCookie'];
2083                                 $txt1  = _SETTINGS_COOKIESESSION;
2084                                 $txt2  = _SETTINGS_COOKIEMONTH;
2085                                 $this->parse_inputyesno('SessionCookie', $value, 10190, 1, 0, $txt1, $txt2);
2086                                 break;
2087                         case 'URLMode':
2088                                 $value = $CONF['URLMode'];
2089                                 $txt1  = _SETTINGS_URLMODE_NORMAL;
2090                                 $txt2  = _SETTINGS_URLMODE_PATHINFO;
2091                                 $this->parse_inputyesno('URLMode', $value, 10077, 'normal', 'pathinfo', $txt1, $txt2);
2092                                 break;
2093                         default:
2094                                 if ( array_key_exists($type, $CONF) && is_string($CONF[$type]) )
2095                                 {
2096                                         echo  Entity::hsc($CONF[$type]);
2097                                 }
2098                                 break;
2099                 }
2100                 return;
2101         }
2102         
2103         /**
2104          * AdminActions::parse_configsettingsyesno()
2105          * Parse skinvar configsettingsyesno
2106          * 
2107          * @param       string  $type           type of global setting
2108          * @param       integer $tabindex       tabindex attribute of input element
2109          * @return      void
2110          */
2111         public function parse_configsettingsyesno($type, $tabindex)
2112         {
2113                 global $CONF;
2114                 if ( array_key_exists($type, $CONF) )
2115                 {
2116                         $this->parse_inputyesno($type, $CONF[$type], $tabindex);
2117                 }
2118                 return;
2119         }
2120         
2121         /**
2122          * AdminActions::parse_customhelplink()
2123          * Parse skinvar customhelplink
2124          * 
2125          * @param       string  $topic          name of topic
2126          * @param       string  $tplName        name of template
2127          * @param       string  $url            string as URI
2128          * @param       string  $iconURL        string as URI for icon
2129          * @param       string  $alt            alternative text for image element
2130          * @param       string  $title          title for anchor element
2131          * @return      void
2132          */
2133         public function parse_customhelplink($topic, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
2134         {
2135                 $this->customHelp($topic, $url, $iconURL);
2136                 return;
2137         }
2138         
2139         /**
2140          * AdminActions::parse_date()
2141          * Parse skinvar date
2142          */
2143         public function parse_date($format = 'c')
2144         {
2145                 global $CONF, $manager;
2146                 echo i18n::formatted_datetime($format, time(), 'iso8601', $manager->getBlog((integer) $CONF['DefaultBlog']));
2147                 return;
2148         }
2149         
2150         /**
2151          * AdminActions::parse_defaultadminskintypes()
2152          * Parse skinvar defaultadminskintypes
2153          * 
2154          * @param       string  $tabindex               index number for tabindex attribute of input element
2155          * @param       string  $templateName   name of template
2156          * @return      void
2157          */
2158         public function parse_defaultadminskintypes($tabindex, $templateName = '')
2159         {
2160                 $templates = array();
2161                 if ( $templateName )
2162                 {
2163                         $templates = Template::read($templateName);
2164                 }
2165                 
2166                 $types   = Skin::getFriendlyNames('AdminActions');
2167                 ksort($types);
2168                 
2169                 if ( array_key_exists('ADMINSKINTYPELIST_HEAD', $templates) && !empty($templates['ADMINSKINTYPELIST_HEAD']) )
2170                 {
2171                         $template['head'] = $templates['ADMINSKINTYPELIST_HEAD'];
2172                 }
2173                 else
2174                 {
2175                         $template['head'] = "<ul>\n";
2176                 }
2177                 
2178                 echo $template['head'];
2179                 
2180                 if ( array_key_exists('ADMINSKINTYPELIST_BODY', $templates) && !empty($templates['ADMINSKINTYPELIST_BODY']) )
2181                 {
2182                         $template['body'] = $templates['ADMINSKINTYPELIST_BODY'];
2183                 }
2184                 else
2185                 {
2186                         $template['body'] = '<li><a tabindex="<%tabindex%>" href="index.php?action=adminskinedittype&amp;skinid=<%skinid%>&amp;type=<%skintype%>">'
2187                                           . "<%name%></a> <%help%></li>\n";
2188                 }
2189                 $handler = new Actions('template', $template, new ADMIN);
2190                 $parser  = new PARSER(Actions::getDefinedActions(), $handler);
2191                 
2192                 foreach ( $types as $type => $fName )
2193                 {
2194                         $helplink = $this->customHelpHtml('skinpart' . $type, $templateName);
2195                         $data = array(
2196                                 'tabindex'      => $tabindex,
2197                                 'skintype'      => $type,
2198                                 'name'          => $fName,
2199                                 'help'          => $helplink,
2200                                 'skinid'        => intrequestVar('skinid'),
2201                         );
2202                         $templateBody = Template::fill($template['body'], $data);
2203                         $parser->parse($templateBody);
2204                         $tabindex++;
2205                 }
2206                 if ( array_key_exists('ADMINSKINTYPELIST_FOOT', $templates) && !empty($templates['ADMINSKINTYPELIST_FOOT']) )
2207                 {
2208                         $template['foot'] = $templates['ADMINSKINTYPELIST_FOOT'];
2209                 }
2210                 else
2211                 {
2212                         $template['foot'] = "           </ul>\n";
2213                 }
2214                 echo $template['foot'];
2215                 return;
2216         }
2217         
2218         /**
2219          * AdminActions::parse_defblogselect()
2220          * Parse skinvar defblogselect
2221          * 
2222          * @param       string  $templateName   name of template
2223          * @return      void
2224          */
2225         public function parse_defblogselect($templateName = '')
2226         {
2227                 global $CONF;
2228                 $query  = "SELECT bname as text, bnumber as value FROM %s;";
2229                 $query = sprintf($query, sql_table('blog'));
2230                 $template['name']        = 'DefaultBlog';
2231                 $template['selected'] = $CONF['DefaultBlog'];
2232                 $template['tabindex'] = 10;
2233                 Showlist($query, 'select', $template, $templateName);
2234                 return;
2235         }
2236         
2237         /**
2238          * AdminActions::parse_defcatselect()
2239          * Parse skinvar defcatselect
2240          * 
2241          * @param       string  $templateName   name of template
2242          * @return      void
2243          */
2244         public function parse_defcatselect($templateName = '')
2245         {
2246                 global $manager;
2247                 $blogid = intRequestVar('blogid');
2248                 $blog   = $manager->getBlog($blogid);
2249                 $query  = "SELECT cname as text, catid as value FROM %s WHERE cblog=%d;";
2250                 $query = sprintf($query, sql_table('category'), (integer) $blog->getID());
2251                 $template['name']        = 'defcat';
2252                 $template['selected'] = $blog->getDefaultCategory();
2253                 $template['tabindex'] = 110;
2254                 Showlist($query, 'select', $template, $templateName);
2255                 return;
2256         }
2257         
2258         /**
2259          * AdminActions::parse_defskinselect()
2260          * Parse skinvar defskinselect
2261          * 
2262          * @param       string  $type                   type of skin
2263          * @param       string  $templateName   name of template
2264          * @return      void
2265          */
2266         public function parse_defskinselect($type = 'blog', $templateName = '')
2267         {
2268                 global $manager;
2269                 $query  = "SELECT sdname as text, sdnumber as value FROM %s;";
2270                 $query = sprintf($query, sql_table('skin_desc'));
2271                 
2272                 $blogid = intRequestVar('blogid');
2273                 
2274                 if ( !$blogid )
2275                 {
2276                         global $CONF;
2277                         $template['selected'] = $CONF['BaseSkin'];
2278                 }
2279                 else
2280                 {
2281                         $blog                            = $manager->getBlog($blogid);
2282                         $template['selected'] = $blog->getDefaultSkin();
2283                 }
2284                 
2285                 if ( $type != 'blog' )
2286                 {
2287                         $nname = 'BaseSkin';
2288                 }
2289                 else
2290                 {
2291                         $nname = 'defskin';
2292                 }
2293                 
2294                 $template['name']        = $nname;
2295                 $template['tabindex'] = 50;
2296                 Showlist($query, 'select', $template, $templateName);
2297                 return;
2298         }
2299         
2300         /**
2301          * AdminActions::parse_deletecomment()
2302          * Parse skinvar deletecomment
2303          * 
2304          * @param       string  $type   type of infomation for comment
2305          * @return      void
2306          */
2307         public function parse_deletecomment($type = 'id')
2308         {
2309                 $commentid      = intRequestVar('commentid');
2310                 $comment        = COMMENT::getComment($commentid);
2311                 
2312                 switch ( $type )
2313                 {
2314                         case 'id':
2315                                 echo intRequestVar('commentid');
2316                                 break;
2317                         case 'author':
2318                                 if ( array_key_exists('member', $comment) && !empty($comment['member']) )
2319                                 {
2320                                         echo $comment['member'];
2321                                 }
2322                                 else
2323                                 {
2324                                         echo $comment['user'];
2325                                 }
2326                                 break;
2327                         case 'body':
2328                                 $body = strip_tags($comment['body']);
2329                                 echo Entity::hsc(shorten($body, 300, '...'));
2330                 }
2331                 return;
2332         }
2333         
2334         /**
2335          * AdminActions::parse_deleteitembody()
2336          * Parse skinvar deleteitembody
2337          * 
2338          * @param       void
2339          * @return      void
2340          */
2341         public function parse_deleteitembody()
2342         {
2343                 global $manager;
2344                 $itemid =  intRequestVar('itemid');
2345                 $item   =& $manager->getItem($itemid, 1, 1);
2346                 $body   =  strip_tags($item['body']);
2347                 echo Entity::hsc(shorten($body, 300, '...'));
2348                 return;
2349         }
2350         
2351         /**
2352          * AdminActions::parse_deleteitemid()
2353          * Parse skinvar deleteitemid
2354          * 
2355          * @param       void
2356          * @return      void
2357          */
2358         public function parse_deleteitemid()
2359         {
2360                 echo (integer) intRequestVar('itemid');
2361                 return;
2362         }
2363         
2364         /**
2365          * AdminActions::parse_deleteitemtitle()
2366          * Parse skinvar deleteitemtitle
2367          * 
2368          * @param       void
2369          * @return      void
2370          */
2371         public function parse_deleteitemtitle()
2372         {
2373                 global $manager;
2374                 $itemid = intRequestVar('itemid');
2375                 $item  =& $manager->getItem($itemid, 1, 1);
2376                 echo Entity::hsc(strip_tags($item['title']));
2377                 return;
2378         }
2379         
2380         /**
2381          * AdminActions::parse_editadminskin()
2382          * Parse skinvar editadminskin
2383          * 
2384          * @param       string  $type   type of skin setting
2385          * @return      void
2386          */
2387         public function parse_editadminskin($type = 'id')
2388         {
2389                 $skinid = intRequestVar('skinid');
2390                 $skin   = new Skin($skinid);
2391                 switch ( $type )
2392                 {
2393                         case 'id':
2394                                 echo intRequestVar('skinid');
2395                                 break;
2396                         case 'name':
2397                                 echo Entity::hsc($skin->getName());
2398                                 break;
2399                         case 'desc':
2400                                 echo Entity::hsc($skin->getDescription());
2401                                 break;
2402                         case 'type':
2403                                 echo Entity::hsc($skin->getContentType());
2404                                 break;
2405                         case 'prefix':
2406                                 echo Entity::hsc($skin->getIncludePrefix());
2407                                 break;
2408                         case 'mode':
2409                                 $this->parse_inputyesno('inc_mode', $skin->getIncludeMode(), 120, 'skindir', 'normal', _PARSER_INCMODE_SKINDIR, _PARSER_INCMODE_NORMAL);
2410                         default:
2411                                 break;
2412                 }
2413                 return;
2414         }
2415         
2416         /**
2417          * AdminActions::parse_editadminskintype()
2418          * Parse skinvar editadminskintype
2419          * 
2420          * @param       string  $type   name of skin type
2421          * @return      void
2422          */
2423         public function parse_editadminskintype($type = 'id')
2424         {
2425                 global $CONF, $manager, $member;
2426                 $skinid = intRequestVar('skinid');
2427                 $skin   = new Skin($skinid);
2428                 $fNames = Skin::getFriendlyNames();
2429                 $sType  = strtolower(trim(requestVar('type')));
2430                 
2431                 switch ( $type )
2432                 {
2433                         case 'id':
2434                                 echo intRequestVar('skinid');
2435                                 break;
2436                         case 'name':
2437                                 echo Entity::hsc($skin->getName());
2438                                 break;
2439                         case 'desc':
2440                                 echo Entity::hsc($skin->getDescription());
2441                                 break;
2442                         case 'type':
2443                                 echo Entity::hsc($skin->getContentType());
2444                                 break;
2445                         case 'content':
2446                                 echo Entity::hsc($skin->getContent($sType));
2447                                 break;
2448                         case 'skintype':
2449                                 $skinType = !array_key_exists($sType, $fNames) ? ucfirst($sType) : $fNames[$sType];
2450                                 echo Entity::hsc($skinType);
2451                                 break;
2452                         case 'skintyperaw':
2453                                 echo Entity::hsc($sType);
2454                                 break;
2455                         case 'prefix':
2456                                 echo Entity::hsc($skin->getIncludePrefix());
2457                                 break;
2458                         case 'mode':
2459                                 $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
2460                                 echo Entity::hsc($incMode);
2461                                 break;
2462                         default:
2463                                 break;
2464                 }
2465                 return;
2466         }
2467         
2468         /**
2469          * AdminActions::parse_editadmintemplateinfo()
2470          * Parse skinvar editadmintemplateinfo
2471          * 
2472          * @param       string  $type                   type of skin template
2473          * @param       string  $description    description of template
2474          * @param       string  $name                   name of stemplate
2475          * @param       string  $tabindex               index number for tabindex attribute of input element
2476          * @param       string  $big                    
2477          * @param       string  $tplt                   
2478          */
2479         public function parse_editadmintemplateinfo($type, $description = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
2480         {
2481                 global $manager;
2482                 $templateid                             =  intRequestVar('templateid');
2483                 $templatename                   =  Template::getNameFromId($templateid);
2484                 $templatedescription    =  Template::getDesc($templateid);
2485                 $template                               =& Template::read($templatename);
2486                 switch ( $type )
2487                 {
2488                         case 'id':
2489                                 echo intval($templateid);
2490                                 break;
2491                         case 'name':
2492                                 echo Entity::hsc($templatename);
2493                                 break;
2494                         case 'desc':
2495                                 echo Entity::hsc($templatedescription);
2496                                 break;
2497                         case 'extratemplate':
2498                                 $tabidx    = 600;
2499                                 $pluginfields = array();
2500                                 $manager->notify(
2501                                         'AdminTemplateExtraFields',
2502                                         array(
2503                                                 'fields' => &$pluginfields
2504                                         )
2505                                 );
2506                                 $tmplt = array();
2507                                 if ( $description )
2508                                 {
2509                                         $tmplt = Template::read($description);
2510                                 }
2511                                 if ( array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) && !empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
2512                                 {
2513                                         $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
2514                                 }
2515                                 else
2516                                 {
2517                                         $base = "</tr>\n"
2518                                               . "<tr>\n"
2519                                               . "\t" . '<th colspan="2"><%explugtplname%>' . "</th>\n";
2520                                 }
2521                                 foreach ( $pluginfields as $pfkey => $pfvalue )
2522                                 {
2523                                         $data = array(
2524                                                 'explugtplname' => Entity::hsc($pfkey)
2525                                         );
2526                                         echo TEMPLATE::fill($base, $data);
2527                                         foreach ( $pfvalue as $pffield => $pfdesc )
2528                                         {
2529                                                 $this->_templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
2530                                         }
2531                                 }
2532                                 break;
2533                         default:
2534                                 $desc = defined($description) ? constant($description) : $description;
2535                                 $name = defined($name) ? constant($name) : $name;
2536                                 $this->_templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
2537                                 break;
2538                 }
2539                 return;
2540         }
2541         
2542         /**
2543          * AdminActions::parse_editcomment()
2544          * Parse skinvar editcomment
2545          * 
2546          * @param       string  $type   type of comment setting
2547          * @return      void
2548          */
2549         public function parse_editcomment($type = 'id')
2550         {
2551                 global $manager;
2552                 $commentid      = intRequestVar('commentid');
2553                 $comment        = COMMENT::getComment($commentid);
2554                 
2555                 $manager->notify('PrepareCommentForEdit', array('comment' => &$comment));
2556                 
2557                 switch ( $type )
2558                 {
2559                         case 'id':
2560                                 echo intRequestVar('commentid');
2561                                 break;
2562                         case 'user':
2563                                 if (array_key_exists('member', $comment) && !empty($comment['member']) )
2564                                 {
2565                                         echo $comment['member'] . " (" . _EDITC_MEMBER . ")";
2566                                 }
2567                                 else
2568                                 {
2569                                         echo $comment['user'] . " (" . _EDITC_NONMEMBER . ")";
2570                                 }
2571                                 break;
2572                         case 'date':
2573                                 echo date("Y-m-d @ H:i", $comment['timestamp']);
2574                                 break;
2575                         case 'body':
2576                                 $comment['body'] = str_replace('<br />', '', $comment['body']);
2577                                 $comment['body'] = preg_replace("#<a href=['\"]([^'\"]+)['\"]( rel=\"nofollow\")?>[^<]*</a>#", "\\1", $comment['body']);
2578                                 echo $comment['body'];
2579                         default:
2580                                 echo $comment[$type];
2581                                 break;
2582                 }
2583                 return;
2584         }
2585         
2586         /**
2587          * AdminActions::parse_editdesturl()
2588          * Parse skinvar editdesturl
2589          */
2590         public function parse_editdesturl()
2591         {
2592                 if ( requestVar('desturl') )
2593                 {
2594                         echo Entity::hsc(requestVar('desturl'));
2595                 }
2596                 return;
2597         }
2598         
2599         /**
2600          * AdminActions::parse_editmemberlist()
2601          * Parse skinvar editmemberlist
2602          * 
2603          * @param       string  $templateName   name of template
2604          * @return      void
2605          */
2606         public function parse_editmemberlist($templateName = '')
2607         {
2608                 global $manager;
2609                 // show list of members with actions
2610                 $query =  'SELECT * FROM '.sql_table('member');
2611                 $template['content']  = 'memberlist';
2612                 $template['tabindex'] = 10;
2613                 
2614                 $batch = new Batch('member');
2615                 $batch->showlist($query, 'table', $template, _LISTS_NOMORE, $templateName);
2616                 return;
2617         }
2618         
2619         /**
2620          * AdminActions::parse_editmember()
2621          * Parse skinvar editmember
2622          * 
2623          * @param       string  $type                   type of information for member
2624          * @return      string  $tempateName    name of template to use
2625          * @return      void
2626          */
2627         public function parse_editmember($type = 'id', $templateName = '')
2628         {
2629                 global $CONF, $manager, $member;
2630                 $memberid       = intRequestVar('memberid');
2631                 $mem            = MEMBER::createFromID($memberid);
2632                 
2633                 switch ( $type )
2634                 {
2635                         case 'id':
2636                                 echo intRequestVar('memberid');
2637                                 break;
2638                         case 'displayname':
2639                                 if ( $this->skintype == 'teamdelete' || $this->skintype == 'memberdelete' )
2640                                 {
2641                                         echo Entity::hsc($mem->getDisplayName());
2642                                 }
2643                                 else
2644                                 {
2645                                         $dispName = Entity::hsc($mem->getDisplayName());
2646                                         if ( $CONF['AllowLoginEdit'] || $member->isAdmin() )
2647                                         {
2648                                                 echo '<input name="name" tabindex="10" maxlength="32" size="32" value="' . $dispName . "\" />\n";
2649                                         }
2650                                         else
2651                                         {
2652                                                 echo $dispName;
2653                                         }
2654                                 }
2655                                 break;
2656                         case 'realname':
2657                                 echo Entity::hsc($mem->getRealName());
2658                                 break;
2659                         case 'email':
2660                                 echo Entity::hsc($mem->getEmail());
2661                                 break;
2662                         case 'url':
2663                                 echo Entity::hsc($mem->getURL());
2664                                 break;
2665                         case 'admin':
2666                                 $this->parse_inputyesno('admin', $mem->isAdmin(), 60, 1, 0, _YES, _NO, 0, $templateName);
2667                                 break;
2668                         case 'canlogin':
2669                                 $this->parse_inputyesno('canlogin', $mem->canLogin(), 70, 1, 0, _YES, _NO, $mem->isAdmin(), $templateName);
2670                                 break;
2671                         case 'notes':
2672                                 echo Entity::hsc($mem->getNotes());
2673                                 break;
2674                         case 'autosave':
2675                                 $this->parse_inputyesno('autosave', $mem->getAutosave(), 87, 1, 0, _YES, _NO, 0, $templateName);
2676                                 break;
2677                         default:
2678                                 break;
2679                 }
2680                 return;
2681         }
2682         
2683         /**
2684          * AdminActions::parse_editpluginfo()
2685          * Parse skinvar editpluginfo
2686          * 
2687          * @param       string  $type   type of plugin info
2688          * @return      void
2689          */
2690         public function parse_editpluginfo($type)
2691         {
2692                 $pid = intRequestVar('plugid');
2693                 switch ( $type )
2694                 {
2695                         case 'id':
2696                                 echo $pid;
2697                                 break;
2698                         case 'name':
2699                                 echo Entity::hsc(getPluginNameFromPid($pid));
2700                                 break;
2701                 }
2702                 return;
2703         }
2704         
2705         /**
2706          * AdminActions::parse_editplugoptionslist()
2707          * Parse skinvar editplugoptionslist
2708          * 
2709          * @param       string  $templateName   name of template
2710          * @return      void
2711          */
2712         public function parse_editplugoptionslist($templateName = '')
2713         {
2714                 global $manager;
2715                 
2716                 $pid = intRequestVar('plugid');
2717                 $aOptions = array();
2718                 $aOIDs  = array();
2719                 
2720                 $query  = "SELECT * FROM %s WHERE ocontext='global' AND opid=%d ORDER BY oid ASC";
2721                 $query = sprintf($query, sql_table('plugin_option_desc'), (integer) $pid);
2722                 $resource = sql_query($query);
2723                 
2724                 while ( $o = sql_fetch_object($resource) )
2725                 {
2726                         array_push($aOIDs, $o->oid);
2727                         $aOptions[$o->oid] = array(
2728                                 
2729                                 'oid'                   => $o->oid,
2730                                 'value'                 => $o->odef,
2731                                 'name'                  => $o->oname,
2732                                 'description'   => $o->odesc,
2733                                 'type'                  => $o->otype,
2734                                 'typeinfo'              => $o->oextra,
2735                                 'contextid'             => 0
2736                         );
2737                 }
2738                 
2739                 // fill out actual values
2740                 if ( count($aOIDs) > 0 )
2741                 {
2742                         $query = 'SELECT oid, ovalue FROM %s WHERE oid in (%s)';
2743                         $query = sprintf($query, sql_table('plugin_option'), implode(',', $aOIDs));
2744                         
2745                         $result = sql_query($query);
2746                         
2747                         while ( $o = sql_fetch_object($result) )
2748                         {
2749                                 $aOptions[$o->oid]['value'] = $o->ovalue;
2750                         }
2751                 }
2752                 
2753                 // call plugins
2754                 $manager->notify(
2755                         'PrePluginOptionsEdit',
2756                         array(
2757                                 'context'       =>  'global',
2758                                 'plugid'        =>  $pid,
2759                                 'options'       => &$aOptions
2760                         )
2761                 );
2762                 
2763                 $template['content'] = 'plugoptionlist';
2764                 $amount                   = Showlist($aOptions, 'table', $template, $templateName);
2765                 if ( $amount == 0 )
2766                 {
2767                         echo '<p>' . _ERROR_NOPLUGOPTIONS . "</p>\n";
2768                 }
2769                 return;
2770         }
2771         
2772         /**
2773          * AdminActions::parse_editskin()
2774          * Parse skinvar editskin
2775          * 
2776          * @param       string  $type   type of skin
2777          * @return      void
2778          */
2779         public function parse_editskin($type = 'id')
2780         {
2781                 $skinid = intRequestVar('skinid');
2782                 $skin   = new SKIN($skinid);
2783                 switch ( $type )
2784                 {
2785                         case 'id':
2786                                 echo intRequestVar('skinid');
2787                                 break;
2788                         case 'name':
2789                                 echo Entity::hsc($skin->getName());
2790                                 break;
2791                         case 'desc':
2792                                 echo Entity::hsc($skin->getDescription());
2793                                 break;
2794                         case 'type':
2795                                 echo Entity::hsc($skin->getContentType());
2796                                 break;
2797                         case 'prefix':
2798                                 echo Entity::hsc($skin->getIncludePrefix());
2799                                 break;
2800                         case 'mode':
2801                                 $this->parse_inputyesno('inc_mode', $skin->getIncludeMode(), 120, 'skindir', 'normal', _PARSER_INCMODE_SKINDIR, _PARSER_INCMODE_NORMAL);
2802                         default:
2803                                 break;
2804                 }
2805                 return;
2806         }
2807         
2808         /**
2809          * AdminActions::parse_editskintype()
2810          * Parse skinvar editskintype
2811          * 
2812          * @param       string  $type   name of type for skin type
2813          * @return      void
2814          */
2815         public function parse_editskintype($type = 'id')
2816         {
2817                 global $CONF, $manager, $member;
2818                 $skinid = intRequestVar('skinid');
2819                 $skin   = new SKIN($skinid);
2820                 $fNames = SKIN::getFriendlyNames('Actions');
2821                 $sType  = strtolower(trim(requestVar('type')));
2822                 
2823                 switch ( $type )
2824                 {
2825                         case 'id':
2826                                 echo intRequestVar('skinid');
2827                                 break;
2828                         case 'name':
2829                                 echo Entity::hsc($skin->getName());
2830                                 break;
2831                         case 'desc':
2832                                 echo Entity::hsc($skin->getDescription());
2833                                 break;
2834                         case 'type':
2835                                 echo Entity::hsc($skin->getContentType());
2836                                 break;
2837                         case 'content':
2838                                 echo Entity::hsc($skin->getContent($sType));
2839                                 break;
2840                         case 'skintype':
2841                                 $skinType = !array_key_exists($sType, $fNames) ? ucfirst($sType) : $fNames[$sType];
2842                                 echo Entity::hsc($skinType);
2843                                 break;
2844                         case 'skintyperaw':
2845                                 echo Entity::hsc($sType);
2846                                 break;
2847                         case 'prefix':
2848                                 echo Entity::hsc($skin->getIncludePrefix());
2849                                 break;
2850                         case 'mode':
2851                                 $incMode = $skin->getIncludeMode() ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL;
2852                                 echo Entity::hsc($incMode);
2853                                 break;
2854                         default:
2855                                 break;
2856                 }
2857                 return;
2858         }
2859         
2860         /**
2861          * AdminActions::parse_edittemplateinfo()
2862          * Parse skinvar edittemplateinfo
2863          * 
2864          * @param       string  $type                   name of type for skin
2865          * @param       string  $description    description for skin
2866          * @param       string  $name                   name of skin
2867          * @param       string  $help                   
2868          * @param       string  $tabindex               index value for tabindex attribute of input element
2869          * @param       string  $big                    
2870          * @param       string  $tplt                   name of template
2871          */
2872         public function parse_edittemplateinfo($type, $description = '', $name = '', $help = '', $tabindex = 0, $big = 0, $tplt = '')
2873         {
2874                 global $manager;
2875                 $templateid                             =  intRequestVar('templateid');
2876                 $templatename                   =  TEMPLATE::getNameFromId($templateid);
2877                 $templatedescription    =  TEMPLATE::getDesc($templateid);
2878                 $template                               =& $manager->getTemplate($templatename);
2879                 switch ( $type )
2880                 {
2881                         case 'id':
2882                                 echo intval($templateid);
2883                                 break;
2884                         case 'name':
2885                                 echo Entity::hsc($templatename);
2886                                 break;
2887                         case 'desc':
2888                                 echo Entity::hsc($templatedescription);
2889                                 break;
2890                         case 'extratemplate':
2891                                 $tabidx    = 600;
2892                                 $pluginfields = array();
2893                                 $manager->notify(
2894                                         'TemplateExtraFields',
2895                                         array(
2896                                                 'fields' => &$pluginfields
2897                                         )
2898                                 );
2899                                 $tmplt = array();
2900                                 if ( $description )
2901                                 {
2902                                         $tmplt = Template::read($description);
2903                                 }
2904                                 if ( array_key_exists('TEMPLATE_EDIT_EXPLUGNAME', $tmplt) && !empty($tmplt['TEMPLATE_EDIT_EXPLUGNAME']) )
2905                                 {
2906                                         $base = $tmplt['TEMPLATE_EDIT_EXPLUGNAME'];
2907                                 }
2908                                 else
2909                                 {
2910                                         $base = "</tr><tr>\n"
2911                                                   . "\t" . '<th colspan="2"><%explugtplname%>' . "</th>\n";
2912                                 }
2913                                 foreach ( $pluginfields as $pfkey => $pfvalue )
2914                                 {
2915                                         $data = array(
2916                                                 'explugtplname' => Entity::hsc($pfkey)
2917                                         );
2918                                         echo TEMPLATE::fill($base, $data);
2919                                         foreach ( $pfvalue as $pffield => $pfdesc )
2920                                         {
2921                                                 $this->_templateEditRow($template, $pfdesc, $pffield, '', ++$tabidx, 0, $name);
2922                                         }
2923                                 }
2924                                 break;
2925                         default:
2926                                 $desc = defined($description) ? constant($description) : $description;
2927                                 $name = defined($name) ? constant($name) : $name;
2928                                 $this->_templateEditRow($template, $desc, $name, $help, $tabindex, $big, $tplt);
2929                                 break;
2930                 }
2931                 return;
2932         }
2933         
2934         /**
2935          * AdminActions::parse_eventformextra()
2936          * Parse skinvar eventformextra
2937          * 
2938          * @param       string  $type   name of type for event form extra
2939          * @return      void
2940          */
2941         public function parse_eventformextra($type = 'activation')
2942         {
2943                 global $manager;
2944                 switch ( $type )
2945                 {
2946                         case 'activation':
2947                                 $key = requestVar('ackey');
2948                                 if ( !$key )
2949                                 {
2950                                         Admin::error(_ERROR_ACTIVATE);
2951                                 }
2952                                 $info = MEMBER::getActivationInfo($key);
2953                                 if ( !$info )
2954                                 {
2955                                         Admin::error(_ERROR_ACTIVATE);
2956                                 }
2957                                 $mem  = MEMBER::createFromId($info->vmember);
2958                                 if ( !$mem )
2959                                 {
2960                                         Admin::error(_ERROR_ACTIVATE);
2961                                 }
2962                                 $data = array(
2963                                         'type'   => 'activation',
2964                                         'member' => $mem
2965                                 );
2966                                 break;
2967                         case 'membermailform-notloggedin':
2968                                 $data = array(
2969                                         'type' => 'membermailform-notloggedin',
2970                                 );
2971                                 break;
2972                 }
2973                 $manager->notify('FormExtra', $data);
2974                 return;
2975         }
2976         
2977         /**
2978          * AdminActions::parse_extrahead()
2979          * Parse skinvar extrahead
2980          */
2981         public function parse_extrahead()
2982         {
2983                 global $manager;
2984                 $extrahead = Admin::extrahead;
2985                 $manager->notify(
2986                         'AdminPrePageHead',
2987                         array(
2988                                 'extrahead'     => &$extrahead,
2989                                 'action'        => Admin::action
2990                         )
2991                 );
2992                 echo $extrahead;
2993                 return;
2994         }
2995         
2996         /**
2997          * AdminActions::parse_getblogsetting()
2998          * Parse skinvar getblogsetting
2999          */
3000         public function parse_getblogsetting($which)
3001         {
3002                 global $blog;
3003                 
3004                 if ( $blog )
3005                 {
3006                         $b =& $blog;
3007                 }
3008                 elseif ( $bid = intRequestVar('blogid') )
3009                 {
3010                         global $manager;
3011                         $b = $manager->getBlog($bid);
3012                 }
3013                 else
3014                 {
3015                         return;
3016                 }
3017                 
3018                 switch ( $which )
3019                 {
3020                         case 'id':
3021                                 return Entity::hsc($b->getID());
3022                                 break;
3023                         case 'url':
3024                                 return Entity::hsc($b->getURL());
3025                                 break;
3026                         case 'name':
3027                                 return Entity::hsc($b->getName());
3028                                 break;
3029                         case 'desc':
3030                                 return Entity::hsc($b->getDescription());
3031                                 break;
3032                         case 'short':
3033                                 return Entity::hsc($b->getShortName());
3034                                 break;
3035                         case 'notifyaddress':
3036                                 return Entity::hsc($b->getNotifyAddress());
3037                                 break;
3038                         case 'maxcomments':
3039                                 return Entity::hsc($b->getMaxComments());
3040                                 break;
3041                         case 'updatefile':
3042                                 return Entity::hsc($b->getUpdateFile());
3043                                 break;
3044                         case 'timeoffset':
3045                                 return Entity::hsc($b->getTimeOffset());
3046                                 break;
3047                 }
3048                 return;
3049         }
3050         
3051         /**
3052          * AdminActions::parse_geteditpluginfo()
3053          * Parse skinvar geteditpluginfo
3054          * 
3055          * @param       string  $type   name of setting for edit plugin info
3056          * @return      void
3057          */
3058         public function parse_geteditpluginfo($type)
3059         {
3060                 $pid = intRequestVar('plugid');
3061                 switch ( $type )
3062                 {
3063                         case 'id':
3064                                 return $pid;
3065                                 break;
3066                         case 'name':
3067                                 return Entity::hsc(getPluginNameFromPid($pid));
3068                                 break;
3069                 }
3070                 return;
3071         }
3072         
3073         /**
3074          * AdminActions::parse_getmember()
3075          * Parse skinvar getmember
3076          * (includes a member info thingie)
3077          * 
3078          * @param       string  $what   name of setting for member
3079          * @return      void
3080          */
3081         public function parse_getmember($what)
3082         {
3083                 global $memberinfo, $member;
3084                 // 1. only allow the member-details-page specific variables on member pages
3085                 if ( $this->skintype == 'member' )
3086                 {
3087                         switch ( $what )
3088                         {
3089                                 case 'name':
3090                                         return Entity::hsc($memberinfo->getDisplayName());
3091                                         break;
3092                                 case 'realname':
3093                                         return Entity::hsc($memberinfo->getRealName());
3094                                         break;
3095                                 case 'notes':
3096                                         return Entity::hsc($memberinfo->getNotes());
3097                                         break;
3098                                 case 'url':
3099                                         return Entity::hsc($memberinfo->getURL());
3100                                         break;
3101                                 case 'email':
3102                                         return Entity::hsc($memberinfo->getEmail());
3103                                         break;
3104                                 case 'id':
3105                                         return Entity::hsc($memberinfo->getID());
3106                                         break;
3107                         }
3108                 }
3109                 // 2. the next bunch of options is available everywhere, as long as the user is logged in
3110                 if ( $member->isLoggedIn() )
3111                 {
3112                         switch ( $what )
3113                         {
3114                                 case 'yourname':
3115                                         return $member->getDisplayName();
3116                                         break;
3117                                 case 'yourrealname':
3118                                         return $member->getRealName();
3119                                         break;
3120                                 case 'yournotes':
3121                                         return $member->getNotes();
3122                                         break;
3123                                 case 'yoururl':
3124                                         return $member->getURL();
3125                                         break;
3126                                 case 'youremail':
3127                                         return $member->getEmail();
3128                                         break;
3129                                 case 'yourid':
3130                                         return $member->getID();
3131                                         break;
3132                         }
3133                 }
3134                 return;
3135         }
3136         
3137         /**
3138          * AdminActions::parse_headmessage()
3139          * Parse skinvar headmessage
3140          * 
3141          * @param       void
3142          * @return      void
3143          */
3144         public function parse_headmessage()
3145         {
3146                 if ( !empty(Admin::$headMess) )
3147                 {
3148                         echo '<p>' . _MESSAGE . ': ' . Entity::hsc(Admin::$headMess) . "</p>\n";
3149                 }
3150                 return;
3151         }
3152         
3153         /**
3154          * AdminActions::parse_helplink()
3155          * Parse skinvar helplink
3156          * 
3157          * @param       string  $topic  name of topic for help
3158          * @return      void
3159          */
3160         public function parse_helplink($topic = '')
3161         {
3162                 if ( empty($topic) )
3163                 {
3164                         return;
3165                 }
3166                 help($topic);
3167                 return;
3168         }
3169         
3170         /**
3171          * AdminActions::parse_helpplugname()
3172          * Parse skinvar helpplugname
3173          * 
3174          * @param       void
3175          * @return      void
3176          */
3177         public function parse_helpplugname()
3178         {
3179                 $plugid = intGetVar('plugid');
3180                 Entity::hsc(getPluginNameFromPid($plugid));
3181                 return;
3182         }
3183         
3184         /**
3185          * AdminActions::parse_ilistaddnew()
3186          * Parse skinvar ilistaddnew
3187          * 
3188          * @param       void
3189          * @return      void
3190          */
3191         public function parse_ilistaddnew()
3192         {
3193                 $blogid = intRequestVar('blogid');
3194                 if ( intPostVar('start') == 0 )
3195                 {
3196                         echo '<p><a href="index.php?action=createitem&amp;blogid=' . $blogid . '">' . _ITEMLIST_ADDNEW . "</a></p>\n";
3197                 }
3198                 return;
3199         }
3200         
3201         /**
3202          * AdminActions::parse_importskininfo()
3203          * Parse skinvar importskininfo
3204          * 
3205          * @param       string  $type   name of information for imported skin
3206          * @return      void
3207          */
3208         public function parse_importskininfo($type)
3209         {
3210                 switch ( $type )
3211                 {
3212                         case 'info':
3213                                 echo Entity::hsc(requestVar('skininfo'));
3214                                 break;
3215                         case 'snames':
3216                                 $dataArr = requestArray('skinnames');
3217                                 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3218                                 break;
3219                         case 'tnames':
3220                                 $dataArr = requestArray('tpltnames');
3221                                 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3222                                 break;
3223                         case 'sclashes':
3224                                 $dataArr = requestArray('skinclashes');
3225                                 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3226                                 break;
3227                         case 'tclashes':
3228                                 $dataArr = requestArray('tpltclashes');
3229                                 echo implode(' <em>' . _AND . '</em> ', $dataArr);
3230                                 break;
3231                         case 'skinfile':
3232                                 echo Entity::hsc(requestVar('skinfile'));
3233                                 break;
3234                         case 'mode':
3235                                 echo Entity::hsc(requestVar('mode'));
3236                                 break;
3237                 }
3238                 return;
3239         }
3240         
3241         /**
3242          * AdminActions::parse_inputyesno()
3243          * Parse skinvar inputyesno
3244          * 
3245          * @param       string  $name                   
3246          * @param       string  $checkedval             
3247          * @param       string  $tabindex               
3248          * @param       string  $value1                 
3249          * @param       string  $value2                 
3250          * @param       string  $yesval                 
3251          * @param       string  $noval                  
3252          * @param       string  $isAdmin                
3253          * @param       string  $templateName   
3254          * @return      void
3255          */
3256         public function parse_inputyesno($name, $checkedval, $tabindex = 0, $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO, $isAdmin = 0, $templateName = '')
3257         {
3258                 self::input_yesno($name, $checkedval, $tabindex, $value1, $value2, $yesval, $noval, $isAdmin, $templateName );
3259                 return;
3260         }
3261         
3262         /**
3263          * AdminActions::parse_insertpluginfo()
3264          * Parse templatevar insertpluginfo
3265          */
3266         public function parse_insertpluginfo($type)
3267         {
3268                 $option = Admin::$aOptions;
3269                 switch ( $type )
3270                 {
3271                         case 'id':
3272                                 return $option['pid'];
3273                                 break;
3274                         case 'name':
3275                                 return Entity::hsc($option['pfile']);
3276                                 break;
3277                 }
3278                 return;
3279         }
3280         
3281         /**
3282          * AdminActions::parse_insertpluginoptions()
3283          * Parse skinvar insertpluginoptions
3284          * 
3285          * @param       string  $templateName   name of template
3286          * @return      void
3287          */
3288         public function parse_insertpluginoptions($templateName = '')
3289         {
3290                 $options        = Admin::$aOptions;
3291                 $template       = array();
3292                 $templats       = array();
3293                 
3294                 if ( $templateName )
3295                 {
3296                         $templates = Template::read($templateName);
3297                 }
3298                 if (array_key_exists('INSERT_PLUGOPTION_TITLE', $templates) && !empty($templates['INSERT_PLUGOPTION_TITLE']) )
3299                 {
3300                         $template['title'] = $templates['INSERT_PLUGOPTION_TITLE'];
3301                 }
3302                 else
3303                 {
3304                         $template['title'] = '<tr><th colspan="2"><%sprinttext(_PLUGIN_OPTIONS_TITLE, <|%insertpluginfo(name)%|>)%></th></tr>' . "\n";
3305                 }
3306                 if ( array_key_exists('INSERT_PLUGOPTION_BODY', $templates) && !empty($templates['INSERT_PLUGOPTION_BODY']) )
3307                 {
3308                         $template['body'] = $templates['INSERT_PLUGOPTION_BODY'];
3309                 }
3310                 else
3311                 {
3312                         $template['body'] = '<tr><%listplugplugoptionrow%></tr>' . "\n";
3313                 }
3314                 
3315                 $prevPid = -1;
3316                 
3317                 foreach ( $options as $option )
3318                 {
3319                         $handler = new Actions($this->skintype, $template, $option);
3320                         $parser  = new PARSER(Actions::getDefinedActions(), $handler);
3321                         // new plugin?
3322                         if ( $prevPid != $option['pid'] )
3323                         {
3324                                 $prevPid  = $option['pid'];
3325                                 $parser->parse($template['title']);
3326                         }
3327                         $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
3328                         if ( @$meta['access'] != 'hidden' )
3329                         {
3330                                 $parsed = $parser->parse($template['body']);
3331                         }
3332                 }
3333                 return;
3334         }
3335         
3336         /**
3337          * AdminActions::parse_insplugoptcontent()
3338          * Parse skinvar insplugoptcontent
3339          * 
3340          * @param       void
3341          * @return      void
3342          */
3343         public function parse_insplugoptcontent()
3344         {
3345                 $option = Admin::$aOption;
3346                 
3347                 $meta   = NucleusPlugin::getOptionMeta($option['typeinfo']);
3348                 if (array_key_exists('access', $meta) && $meta['access'] != 'hidden')
3349                 {
3350                         echo '<tr>';
3351                         listplug_plugOptionRow($option);
3352                         echo '</tr>';
3353                 }
3354                 return;
3355         }
3356         
3357         /**
3358          * AdminActions::parse_iprangeinput()
3359          * Parse skinvar iprangeinput
3360          * 
3361          * @param       void
3362          * @return      void
3363          */
3364         public function parse_iprangeinput()
3365         {
3366                 if ( requestVar('ip') )
3367                 {
3368                         $iprangeVal = Entity::hsc(requestVar('ip'));
3369                         echo '<input name="iprange" type="radio" value="' . $iprangeVal . '" checked="checked" id="ip_fixed" />' . "\n";
3370                         echo '<label for="ip_fixed">' . $iprangeVal . "</label><br />\n";
3371                         echo '<input name="iprange" type="radio" value="custom" id="ip_custom" />' . "\n";
3372                         echo '<label for="ip_custom">' . _BAN_IP_CUSTOM . '</label>' . "\n";
3373                         echo '<input name="customiprange" value="' . $iprangeVal . '" maxlength="15" size="15" />' . "\n";
3374                 }
3375                 else
3376                 {
3377                         echo '<input name="iprange" value="custom" type="hidden" />' . "\n";
3378                         echo '<input name="customiprange" value="" maxlength="15" size="15" />' . "\n";
3379                 }
3380                 return;
3381         }
3382         
3383         /**
3384          * AdminActions::parse_itemnavlist()
3385          * Parse skinvar itemnavlist
3386          * 
3387          * @param       void
3388          * @return      void
3389          */
3390         public function parse_itemnavlist()
3391         {
3392                 global $CONF, $manager, $member;
3393                 if ( $this->skintype == 'itemlist' )
3394                 {
3395                         $blogid =  intRequestVar('blogid');
3396                         $blog   =& $manager->getBlog($blogid);
3397                 }
3398                 if ( postVar('start') )
3399                 {
3400                         $start = intPostVar('start');
3401                 }
3402                 else
3403                 {
3404                         $start = 0;
3405                 }
3406                 
3407                 // amount of items to show
3408                 if ( postVar('amount') )
3409                 {
3410                         $amount = intPostVar('amount');
3411                 }
3412                 else
3413                 {
3414                         $amount = intval($CONF['DefaultListSize']);
3415                         if ( $amount < 1 )
3416                         {
3417                                 $amount = 10;
3418                         }
3419                 }
3420                 $query  = "SELECT bshortname, cname, mname, ititle, ibody, inumber, idraft, itime"
3421                         . " FROM %s, %s, %s"
3422                         . " WHERE iblog=bnumber AND iauthor=mnumber AND icat=catid;";
3423                 
3424                 $query = sprintf($query, sql_table('item'), sql_table('blog'), sql_table('member'), sql_table('category'));
3425                 
3426                 if ( $this->skintype == 'itemlist' )
3427                 {
3428                         $query .= 'and iblog   = ' . $blogid;
3429                         $template['now'] = $blog->getCorrectTime(time());
3430                         
3431                         // non-blog-admins can only edit/delete their own items
3432                         if ( !$member->blogAdminRights($blogid) )
3433                         {
3434                                 $query .= ' and iauthor = ' . $member->getID();
3435                         }
3436                 }
3437                 elseif ( $this->skintype == 'browseownitems' )
3438                 {
3439                         $query .= 'and iauthor   = ' . $member->getID();
3440                         $blogid = 0;
3441                         $template['now'] = time();
3442                 }
3443                 
3444                 // search through items
3445                 $search = postVar('search');
3446                 
3447                 if ( !empty($search) )
3448                 {
3449                         $query .= ' AND ((ititle LIKE "%' . sql_real_escape_string($search) . '%") '
3450                                 . '  OR  (ibody LIKE "%' . sql_real_escape_string($search) . '%") '
3451                                 . '  OR  (imore LIKE "%' . sql_real_escape_string($search) . '%"))';
3452                 }
3453                 $query .= ' ORDER BY itime DESC'
3454                         . " LIMIT {$start},{$amount}";
3455                 
3456                 $template['content'] = 'itemlist';
3457                 
3458                 $navList = new Navlist($this->skintype, $start, $amount, 0, 1000, $blogid, $search, 0);
3459                 $navList->showBatchList('item', $query, 'table', $template);
3460                 return;
3461         }
3462         
3463         /**
3464          * AdminActions::parse_jstoolbaroptions()
3465          * Parse skinvar jstoolbaroptions
3466          * 
3467          * @param       void
3468          * @return      void
3469          */
3470         public function parse_jstoolbaroptions()
3471         {
3472                 global $CONF;
3473                 $options = array(
3474                         _SETTINGS_JSTOOLBAR_NONE,
3475                         _SETTINGS_JSTOOLBAR_SIMPLE,
3476                         _SETTINGS_JSTOOLBAR_FULL
3477                 );
3478                 $i = 1;
3479                 foreach ( $options as $option )
3480                 {
3481                         $text  = "<option value=\"%d\"%s>%s</option>\n";
3482                         $extra = ($CONF['DisableJsTools'] == $i) ? ' selected="selected"' : '';
3483                         echo sprintf($text, $i, $extra, $option);
3484                         $i++;
3485                 }
3486                 return;
3487         }
3488         
3489         /**
3490          * AdminActions::parse_localeselectoptions()
3491          * Parse skinvar localeselectoptions
3492          * 
3493          * @param       void
3494          * @return      void
3495          */
3496         public function parse_localeselectoptions()
3497         {
3498                 $locales = i18n::get_available_locale_list();
3499                 $memid   = intRequestVar('memberid');
3500                 if ( $memid )
3501                 {
3502                         $mem = MEMBER::createFromID($memid);
3503                         if ( !$mem->getLocale() || !in_array($mem->getLocale(), $locales) )
3504                         {
3505                                 echo "<option value=\"\" selected=\"selected\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
3506                         }
3507                         else
3508                         {
3509                                 echo "<option value=\"\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
3510                         }
3511                 }
3512                 else
3513                 {
3514                         if ( !i18n::get_current_locale() || !in_array(i18n::get_current_locale(), $locales) )
3515                         {
3516                                 echo "<option value=\"\" selected=\"selected\">en_Latn_US</option>\n";
3517                         }
3518                 }
3519                 foreach ( $locales as $locale )
3520                 {
3521                         if ($memid)
3522                         {
3523                                 if ( $locale == $mem->getLocale() )
3524                                 {
3525                                         echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
3526                                 }
3527                                 else
3528                                 {
3529                                         echo "<option value=\"{$locale}\">{$locale}</option>\n";
3530                                 }
3531                         }
3532                         else
3533                         {
3534                                 if ( $locale == i18n::get_current_locale() )
3535                                 {
3536                                         echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
3537                                 }
3538                                 else
3539                                 {
3540                                         echo "<option value=\"{$locale}\">{$locale}</option>\n";
3541                                 }
3542                         }
3543                 }
3544                 return;
3545         }
3546         
3547         /**
3548          * AdminActions::parse_listplugplugoptionrow()
3549          * Parse templatevar listplugplugoptionrow
3550          * 
3551          * @param       string  $templateName   name of template
3552          * @return      void
3553          */
3554         public function parse_listplugplugoptionrow($templateName = '')
3555         {
3556                 echo listplug_plugOptionRow(Admin::$aOptions, $templateName);
3557                 return;
3558         }
3559         
3560         /**
3561          * AdminActions::parse_mediadirwarning()
3562          * Parse skinvar mediadirwarning
3563          * 
3564          * @param       void
3565          * @return      void
3566          */
3567         public function parse_mediadirwarning()
3568         {
3569                 global $DIR_MEDIA;
3570                 if ( !is_dir($DIR_MEDIA) )
3571                 {
3572                         echo "<br /><b>" . _WARNING_NOTADIR . "</b>\n";
3573                 }
3574                 if ( !is_readable($DIR_MEDIA) )
3575                 {
3576                         echo "<br /><b>" . _WARNING_NOTREADABLE . "</b>\n";
3577                 }
3578                 if ( !is_writeable($DIR_MEDIA) )
3579                 {
3580                         echo "<br /><b>" . _WARNING_NOTWRITABLE . "</b>\n";
3581                 }
3582                 return;
3583         }
3584         
3585         /**
3586          * AdminActions::parse_movedistselect()
3587          * Parse skinvar movedistselect
3588          */
3589         public function parse_movedistselect()
3590         {
3591                 $actionType = requestVar('action');
3592                 switch ( $actionType )
3593                 {
3594                         case 'batchitem':
3595                                 Admin::selectBlogCategory('destcatid');
3596                                 break;
3597                         case 'batchcategory':
3598                                 Admin::selectBlog('destblogid');
3599                                 break;
3600                         default:
3601                                 if ( $this->skintype == 'itemmove' )
3602                                 {
3603                                         $query  = "SELECT icat as result FROM %s WHERE inumber=%d;";
3604                                         $query = spriintf($query, sql_table('item'), intRequestVar('itemid'));
3605                                         $catid  = quickQuery(sprintf($query, intRequestVar('itemid')));
3606                                         Admin::selectBlogCategory('catid', $catid, 10, 1);
3607                                 }
3608                                 break;
3609                 }
3610                 return;
3611         }
3612         
3613         /**
3614          * AdminActions::parse_moveitemid()
3615          * Parse skinvar moveitemid
3616          * 
3617          * @param       void
3618          * @return      void
3619          */
3620         public function parse_moveitemid()
3621         {
3622                 echo intRequestVar('itemid');
3623                 return;
3624         }
3625         
3626         /**
3627          * AdminActions::parse_newestcompare()
3628          * Parse skinvar newestcompare
3629          * 
3630          * @param       void
3631          * @return      void
3632          */
3633         public function parse_newestcompare()
3634         {
3635                 global $nucleus;
3636                 $newestVersion  = getLatestVersion();
3637                 $newestCompare  = str_replace('/', '.', $newestVersion);
3638                 $currentVersion = str_replace(array('/', 'v'), array('.', ''), $nucleus['version']);
3639                 if ( $newestVersion && version_compare($newestCompare, $currentVersion, '>') )
3640                 {
3641                         echo '<br /><a style="color:red" href="http://nucleuscms.org/upgrade.php" title="' . _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TITLE . '">';
3642                         echo _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TEXT . $newestVersion . '</a>';
3643                 }
3644                 return;
3645         }
3646         
3647         /**
3648          * AdminActions::parse_newmemberselect()
3649          * Parse skinvar newmemberselect
3650          * 
3651          * @param       string  $templateName   name of template to use
3652          * @return      void
3653          */
3654         public function parse_newmemberselect($templateName = '')
3655         {
3656                 $blogid = intRequestVar('blogid');
3657                 
3658                 $query  = "SELECT tmember FROM %s WHERE tblog=%d;";
3659                 $query = sprintf($query, sql_table('team'), (integer) $blogid);
3660                 $res = sql_query($query);
3661                 
3662                 $tmem = array();
3663                 while ( $tmember = sql_fetch_object($res) ) 
3664                 {
3665                         $tmem[] = intval($tmember->tmember);
3666                 }
3667                 
3668                 $query  = "SELECT mname as text, mnumber as value FROM %s WHERE mnumber NOT IN (%s);";
3669                 $query = sprintf($query, sql_table('member'), implode(', ', $tmem));
3670                 
3671                 $template['name']        = 'memberid';
3672                 $template['tabindex'] = 10000;
3673                 Showlist($query, 'select', $template, $templateName);
3674                 return;
3675         }
3676         
3677         /**
3678          * AdminActions::parse_newpluginlist()
3679          * Parse skinvar newpluginlist
3680          * 
3681          * @param       void
3682          * @return      void
3683          */
3684         public function parse_newpluginlist()
3685         {
3686                 $candidates = $this->newPlugCandidates;
3687                 foreach ( $candidates as $name )
3688                 {
3689                         echo '<option value="NP_' . $name . '">' . Entity::hsc($name) . "</option>\n";
3690                 }
3691                 return;
3692         }
3693         
3694         /**
3695          * AdminActions::parse_outputspecialdirs()
3696          * Parse skinvar outputspecialdirs
3697          * 
3698          * @param       string  $type   type of setting for directory
3699          * @return      void
3700          */
3701         public function parse_outputspecialdirs($type)
3702         {
3703                 switch ( $type )
3704                 {
3705                         case 'nucleusdir':
3706                                 global $DIR_NUCLEUS;
3707                                 echo Entity::hsc($DIR_NUCLEUS);
3708                                 break;
3709                         case 'mediadir':
3710                                 global $DIR_MEDIA;
3711                                 echo Entity::hsc($DIR_MEDIA);
3712                                 break;
3713                 }
3714                 return;
3715         }
3716         
3717         /**
3718          * AdminActions::parse_passrequestvars()
3719          * Parse skinvar passrequestvars
3720          * 
3721          * @param       void
3722          * @return      void
3723          */
3724         public function parse_passrequestvars()
3725         {
3726                 $oldaction = postVar('oldaction');
3727                 if ( ($oldaction != 'logout')
3728                   && ($oldaction != 'login')
3729                   && Admin::passvar
3730                   && !postVar('customaction') )
3731                 {
3732                         passRequestVars();
3733                 }
3734                 return;
3735         }
3736         
3737         /**
3738          * AdminActions::parse_pluginextras()
3739          * Parse skinvar pluginextras
3740          * 
3741          * @param       string  $type   type of plugin context
3742          * @return      void
3743          */
3744         public function parse_pluginextras($type = 'global')
3745         {
3746                 global $manager;
3747                 switch ( $type )
3748                 {
3749                         case 'member':
3750                                 $id  = intRequestVar('memberid');
3751                                 $mem = MEMBER::createFromID($id);
3752                                 $manager->notify(
3753                                         'MemberSettingsFormExtras',
3754                                         array(
3755                                                 'member' => &$mem
3756                                         )
3757                                 );
3758                                 break;
3759                         case 'blog':
3760                                 $id  = intRequestVar('blogid');
3761                                 $blg = $manager->getBlog($id);
3762                                 $manager->notify(
3763                                         'BlogSettingsFormExtras',
3764                                         array(
3765                                                 'member' => &$blg
3766                                         )
3767                                 );
3768                                 break;
3769                         default:
3770                                 $manager->notify(
3771                                         'GeneralSettingsFormExtras',
3772                                         array(
3773                                         )
3774                                 );
3775                                 break;
3776                 }
3777                 return;
3778         }
3779         
3780         /**
3781          * AdminActions::parse_pluginhelp()
3782          * Parse skinvar pluginhelp
3783          * 
3784          * @param       void
3785          * @return      void
3786          */
3787         public function parse_pluginhelp()
3788         {
3789                 global $manager, $DIR_PLUGINS;
3790                 $plugid = intGetVar('plugid');
3791                 $plugName =  getPluginNameFromPid($plugid);
3792                 $plug =& $manager->getPlugin($plugName);
3793                 
3794                 if ( $plug->supportsFeature('HelpPage') > 0 )
3795                 {
3796                         $helpfile = $DIR_PLUGINS . $plug->getShortName() . '/help.';
3797                         if ( @file_exists($helpfile . 'php') )
3798                         {
3799                                 @include($helpfile . 'php');
3800                                 return;
3801                         }
3802                         elseif ( @file_exists($helpfile . 'html') )
3803                         {
3804                                 @include($helpfile . 'html');
3805                                 return;
3806                         }
3807                 }
3808                 echo '<p>' . _ERROR . ': ' . _ERROR_PLUGNOHELPFILE . "</p>\n";
3809                 echo '<p><a href="index.php?action=pluginlist">(' . _BACK . ")</a></p>\n";
3810                 return;
3811         }
3812         
3813         /**
3814          * AdminActions::parse_pluginlistlist()
3815          * Parse skinvar pluginlistlist
3816          * 
3817          * @param       string  $templateName   name of template to use
3818          * @return      void
3819          */
3820         public function parse_pluginlistlist($templateName = '')
3821         {
3822                 $query  = "SELECT * FROM %s ORDER BY porder ASC;";
3823                 $query = sprintf($query, sql_table('plugin'));
3824                 $template['content']  = 'pluginlist';
3825                 $template['tabindex'] = 10;
3826                 Showlist($query, 'table', $template, $templateName);
3827                 return;
3828         }
3829         
3830         /**
3831          * AdminActions::parse_pluginoptions()
3832          * Parse skinvar pluginoptions
3833          * 
3834          * @param       string  $type   type of plugin option
3835          * @return      void
3836          */
3837         public function parse_pluginoptions($type = 'global')
3838         {
3839                 switch ( $type )
3840                 {
3841                         case 'member':
3842                                 $id = intRequestVar('memberid');
3843                                 break;
3844                         case 'blog':
3845                                 $id = intRequestVar('blogid');
3846                                 break;
3847                         case 'category':
3848                                 $id = intRequestVar('catid');
3849                                 break;
3850                 }
3851                 Admin::insertPluginOptions($type, $id);
3852                 return;
3853         }
3854         
3855         /**
3856          * AdminActions::parse_qmenuaddselect()
3857          * Parse skinvar qmanuaddselect
3858          * 
3859          * @param       string  $templateName   name of template to use
3860          * @return      void
3861          */
3862         public function parse_qmenuaddselect($templateName = '')
3863         {
3864                 global $member;
3865                 $showAll = requestVar('showall');
3866                 if ( $member->isAdmin() && ($showAll == 'yes') )
3867                 {
3868                         // Super-Admins have access to all blogs! (no add item support though)
3869                         $query =  'SELECT bnumber as value, bname as text'
3870                                . ' FROM ' . sql_table('blog')
3871                                . ' ORDER BY bname';
3872                 }
3873                 else
3874                 {
3875                         $query =  'SELECT bnumber as value, bname as text'
3876                                . ' FROM ' . sql_table('blog') . ', ' . sql_table('team')
3877                                . ' WHERE tblog=bnumber and tmember=' . $member->getID()
3878                                . ' ORDER BY bname';
3879                 }
3880                 $template['name']          = 'blogid';
3881                 $template['tabindex']   = 15000;
3882                 $template['extra']        = _QMENU_ADD_SELECT;
3883                 $template['selected']   = -1;
3884                 $template['shorten']    = 10;
3885                 $template['shortenel']  = '';
3886                 $template['javascript'] = 'onchange="return form.submit()"';
3887                 Showlist($query, 'select', $template, $templateName);
3888                 return;
3889         }
3890
3891         /**
3892          * AdminActions::parse_quickmenu()
3893          * Parse skinvar quickmenu
3894          * 
3895          * @param       string  $templateName   name of template to use
3896          * @return      void
3897          */
3898         public function parse_quickmenu($templateName = '')
3899         {
3900                 global $manager;
3901                 $templates = array();
3902                 $template  = array();
3903                 if ( !empty($templateName) )
3904                 {
3905                         $templates = Template::read($templateName);
3906                 }
3907                 $pluginExtras = array();
3908                 $manager->notify(
3909                         'QuickMenu',
3910                         array(
3911                                 'options' => &$pluginExtras
3912                         )
3913                 );
3914                 if ( count($pluginExtras) > 0 )
3915                 {
3916                         if ( array_key_exists('PLUGIN_QUICKMENU_TITLE', $templates) || !empty($templates['PLUGIN_QUICKMENU_TITLE']) )
3917                         {
3918                                 $template['title'] = $templates['PLUGIN_QUICKMENU_TITLE'];
3919                         }
3920                         else
3921                         {
3922                                 $template['title'] = '<h2><%text(_QMENU_PLUGINS)%></h2>';
3923                         }
3924                         $handler = new Actions($this->skintype, $template, $this->objAdmin);
3925                         $parser  = new PARSER(Actions::getDefinedActions(), $handler);
3926                         $parser->parse($template['title']);
3927                         
3928                         if ( array_key_exists('PLUGIN_QUICKMENU_HEAD', $templates) || !empty($templates['PLUGIN_QUICKMENU_HEAD']) )
3929                         {
3930                                 $template['head'] = $templates['PLUGIN_QUICKMENU_HEAD'];
3931                         }
3932                         else
3933                         {
3934                                 $template['head'] = '<ul>';
3935                         }
3936                         
3937                         echo $template['head'];
3938                         
3939                         if ( array_key_exists('PLUGIN_QUICKMENU_BODY', $templates) || !empty($templates['PLUGIN_QUICKMENU_BODY']) )
3940                         {
3941                                 $template['body'] = $templates['PLUGIN_QUICKMENU_BODY'];
3942                         }
3943                         else
3944                         {
3945                                 $template['body'] = '<li><a href="<%plugadminurl%>" title="<%plugadmintooltip%>"><%plugadmintitle%></a></li>';
3946                         }
3947                         
3948                         foreach ( $pluginExtras as $aInfo )
3949                         {
3950                                 $data = array(
3951                                         'plugadminurl'          => Entity::hsc($aInfo['url']),
3952                                         'plugadmintooltip'      => Entity::hsc($aInfo['tooltip']),
3953                                         'plugadmintitle'        => Entity::hsc($aInfo['title']),
3954                                 );
3955                                 echo TEMPLATE::fill($template['body'], $data);
3956                         }
3957                         if ( array_key_exists('PLUGIN_QUICKMENU_FOOT', $templates) || !empty($templates['PLUGIN_QUICKMENU_FOOT']) )
3958                         {
3959                                 $template['foot'] = $templates['PLUGIN_QUICKMENU_FOOT'];
3960                         }
3961                         else
3962                         {
3963                                 $template['foot'] = '</ul>';
3964                         }
3965                         echo $template['foot'];
3966                 }
3967                 return;
3968         }
3969         
3970         /**
3971          * AdminActions::parse_requestblogid()
3972          * Parse skinvar requestblogid
3973          * 
3974          * @param       void
3975          * @return      void
3976          */
3977         public function parse_requestblogid()
3978         {
3979                 echo intRequestVar('blogid');
3980                 return;
3981         }
3982         
3983         /**
3984          * AdminActions::parse_requestiprange()
3985          * Parse skinvar requestiprange
3986          * 
3987          * @param       void
3988          * @return      void
3989          */
3990         public function parse_requestiprange()
3991         {
3992                 if ( requestVar('iprange') )
3993                 {
3994                         echo Entity::hsc(requestVar('iprange'));
3995                 }
3996                 elseif ( requestVar('ip') )
3997                 {
3998                         echo Entity::hsc(requestVar('ip'));
3999                 }
4000                 return;
4001         }
4002         
4003         /**
4004          * AdminActions::parse_selectlocaladminskinfiles()
4005          * Parse skinvar selectlocaladminskinfiles
4006          * 
4007          * @param       void
4008          * @return      void
4009          */
4010         public function parse_selectlocaladminskinfiles()
4011         {
4012                 global $DIR_ADMINSKINS, $manager;
4013                 $candidates = SkinImport::searchForCandidates($DIR_ADMINSKINS);
4014                 foreach ( $candidates as $skinname => $skinfile )
4015                 {
4016                         $html = Entit::hsc($skinfile);
4017                         echo '<option value="' . $html . '">' . $skinname . "</option>\n";
4018                 }
4019                 return;
4020         }
4021         
4022         /**
4023          * AdminActions::parse_selectlocalskinfiles()
4024          * Parse skinvar selectlocalskinfiles
4025          * 
4026          * @param       void
4027          * @return      void
4028          */
4029         public function parse_selectlocalskinfiles()
4030         {
4031                 global $DIR_SKINS;
4032                 $candidates = SkinImport::searchForCandidates($DIR_SKINS);
4033                 foreach ( $candidates as $skinname => $skinfile )
4034                 {
4035                         $html = Entity::hsc($skinfile);
4036                         echo '<option value="' . $html . '">' . $skinname . "</option>\n";
4037                 }
4038                 return;
4039         }
4040         
4041         /**
4042          * AdminActions::parse_skineditallowedlist()
4043          * Parse skinvar skineditallowedlist
4044          * 
4045          * @param       string  $type                   type of skin
4046          * @param       string  $templateName   name of template
4047          * @return      void
4048          */
4049         public function parse_skineditallowedlist($type, $templateName = '')
4050         {
4051                 switch ( $type )
4052                 {
4053                         case 'blog':
4054                                 $query = "SELECT bshortname, bname FROM %s";
4055                                 $show  = array(
4056                                         'content' => 'shortblognames'
4057                                 );
4058                                 $query = sprintf($query, sql_table('blog'));
4059                                 Showlist($query, 'table', $show, $templateName);
4060                                 break;
4061                         case 'template':
4062                                 $query = "SELECT tdname as name, tddesc as description FROM %s";
4063                                 $show  = array(
4064                                         'content' => 'shortnames'
4065                                 );
4066                                 $query = sprintf($query, sql_table('template_desc'));
4067                                 Showlist($query, 'table', $show, $templateName);
4068                                 break;
4069                 }
4070                 return;
4071         }
4072         
4073         /**
4074          * AdminActions::parse_skinielist()
4075          * Parse skinvar skinielist
4076          * 
4077          * @param       string  $type                   type of skin
4078          * @param       string  $templateName   name of template to use
4079          * @return      void
4080          */
4081         public function parse_skinielist($type, $templateName = '')
4082         {
4083                 $templates = array();
4084                 if ( $templateName )
4085                 {
4086                         $templates = Template::read($templateName);
4087                 }
4088                 if ( array_key_exists('SKINIE_EXPORT_LIST', $templates) && !empty($templates['SKINIE_EXPORT_LIST']) )
4089                 {
4090                         $template = $templates['SKINIE_EXPORT_LIST'];
4091                 }
4092                 else
4093                 {
4094                         $template = '<td><input type="checkbox" name="<%typeid%>"  id="<%expid%>" /><label for="<%expid%>"><%expname%></label></td>' . "\n"
4095                                           . "<td><%expdesc%></td>\n"
4096                                           . "</tr><tr>\n";
4097                 }
4098                 switch ( $type )
4099                 {
4100                         case 'skin':
4101                                 $res = sql_query('SELECT * FROM ' . sql_table('skin_desc'));
4102                                 while ( $skinObj = sql_fetch_object($res) )
4103                                 {
4104                                         $data = array(
4105                                                 'typeid'        => 'skin[' . $skinObj->sdnumber . ']',
4106                                                 'expid'         => 'skinexp' . $skinObj->sdnumber,
4107                                                 'expname'       => Entity::hsc($skinObj->sdname),
4108                                                 'expdesc'       => Entity::hsc($skinObj->sddesc),
4109                                         );
4110                                         echo TEMPLATE::fill($template, $data);
4111                                 }
4112                                 break;
4113                         case 'template':
4114                                 $res = sql_query('SELECT * FROM '.sql_table('template_desc'));
4115                                 while ($templateObj = sql_fetch_object($res)) {
4116                                         $data = array(
4117                                                 'typeid'        => 'template[' . $templateObj->tdnumber . ']',
4118                                                 'expid'         => 'templateexp' . $templateObj->tdnumber,
4119                                                 'expname'       => Entity::hsc($templateObj->tdname),
4120                                                 'expdesc'       => Entity::hsc($templateObj->tddesc),
4121                                         );
4122                                         echo TEMPLATE::fill($template, $data);
4123                                 }
4124                                 break;
4125                 }
4126                 return;
4127         }
4128         
4129         /**
4130          * AdminActions::parse_skinoverview()
4131          * Parse skinvar skinoverview
4132          * 
4133          * @param       string  $templateName   name of template to use
4134          * @return      void
4135          */
4136         public function parse_skinoverview($templateName = '')
4137         {
4138                 $query  = "SELECT * FROM %s ORDER BY sdname";
4139                 $query = sprintf($query, sql_table('skin_desc'));
4140                 
4141                 $template['content']  = 'skinlist';
4142                 $template['tabindex'] = 10;
4143                 $template['friendly_names'] = Skin::getFriendlyNames('Actions');
4144                 
4145                 Showlist($query, 'table', $template, $templateName);
4146                 return;
4147         }
4148         
4149         /**
4150          * AdminActions::parse_skintypehelp()
4151          * Check editing skintypehelp
4152          * 
4153          * @param       void
4154          * @return      void
4155          */
4156         public function parse_skintypehelp()
4157         {
4158                 $nowSkinType = strtolower(trim(requestVar('type')));
4159                 $regularType = array(
4160                         'index',
4161                         'item',
4162                         'archivelist',
4163                         'archive',
4164                         'search',
4165                         'error',
4166                         'member',
4167                         'imagepopup'
4168                 );
4169                 
4170                 if ( in_array($nowSkinType, $regularType) )
4171                 {
4172                         help('skinpart' . $nowSkinType);
4173                 }
4174                 else
4175                 {
4176                         help('skinpartspecial');
4177                 }
4178                 return;
4179         }
4180         
4181         /**
4182          * AdminActions::parse_specialskinlist()
4183          * Parse skinvar specialskinlist
4184          * 
4185          * @param       string  $templateName   name of template to use
4186          * @return      void
4187          */
4188         public function parse_specialskinlist($templateName = '')
4189         {
4190                 $templates = array();
4191                 if ( $templateName )
4192                 {
4193                         $templates = Template::read($templateName);
4194                 }
4195                 $nType  = array(
4196                         'index',
4197                         'item',
4198                         'error',
4199                         'search',
4200                         'archive',
4201                         'archivelist',
4202                         'imagepopup',
4203                         'member'
4204                 );
4205                 $skinid = intRequestVar('skinid');
4206                 $query  = "SELECT stype FROM %s WHERE stype NOT IN ('%s') AND sdesc = %d;";
4207                 $query = sprintf($query, sql_table('skin'), implode("', '", $nType), $skinid);
4208                 
4209                 $res    = sql_query($query);
4210                 if ( $res && sql_num_rows($res) > 0 )
4211                 {
4212                         $data = array();
4213                         if ( array_key_exists('SPECIALSKINLIST_HEAD', $templates) && !empty($templates['SPECIALSKINLIST_HEAD']) )
4214                         {
4215                                 $template['head'] = $templates['SPECIALSKINLIST_HEAD'];
4216                         }
4217                         else
4218                         {
4219                                 $template['head'] = "<ul>\n";
4220                         }
4221                         echo TEMPLATE::fill($template['head'], $data);
4222                         if ( array_key_exists('SPECIALSKINLIST_BODY', $templates) && !empty($templates['SPECIALSKINLIST_BODY']) )
4223                         {
4224                                 $template['body'] = $templates['SPECIALSKINLIST_BODY'];
4225                         }
4226                         else
4227                         {
4228                                 $template['body'] = '<li><a tabindex="<%tabindex%>" href="index.php?action=skinedittype&amp;skinid=<%skinid%>'
4229                                                                   . '&amp;type=<%skintype%>"><%skintype%></a> (<a tabindex="<%tabindex%>" href="index.php?'
4230                                                                   . 'action=skinremovetype&amp;skinid=<%skinid%>&amp;type=<%skintype%>">remove</a>)</li>';
4231                         }
4232                         $tabstart = 75;
4233                         while ( $row = sql_fetch_assoc($res) )
4234                         {
4235                                 $data = array(
4236                                         'tabindex' => $tabstart++,
4237                                         'skinid'   => $skinid,
4238                                         'skintype' => Entity::hsc(strtolower($row['stype']))
4239                                 );
4240                                 echo TEMPLATE::fill($template['body'], $data);
4241                         }
4242                         $data = array();
4243                         if (array_key_exists('SPECIALSKINLIST_FOOT', $templates) && !empty($templates['SPECIALSKINLIST_FOOT']) )
4244                         {
4245                                 $template['foot'] = $templates['SPECIALSKINLIST_FOOT'];
4246                         }
4247                         else
4248                         {
4249                                 $template['foot'] = "</ul>\n";
4250                         }
4251                         echo TEMPLATE::fill($template['foot'], $data);
4252                         return;
4253                 }
4254         }
4255         
4256         /**
4257          * AdminActions::parse_sprinttext()
4258          * Parse sprinttext
4259          * 
4260          * @param       string  $which  
4261          * @param       string  $val    
4262          * @return      void
4263          */
4264         public function parse_sprinttext($which, $val)
4265         {
4266                 if ( !defined($which) )
4267                 {
4268                         $base = $which;
4269                 }
4270                 else
4271                 {
4272                         $base = constant($which);
4273                 }
4274                 
4275                 if ( preg_match('#[^<|%].*[^%|>]#', $val, $matchies) )
4276                 {
4277                         if ( !preg_match('#[(].*[^)]#', $matchies[0], $args) )
4278                         {
4279                                 $met = 'parse_' . $matchies[0];
4280                         }
4281                         else
4282                         {
4283                                 $arg = trim($args[0], '()');
4284                                 $met = 'parse_' . substr($matchies[0], 0, strpos($matchies[0], '('));
4285                         }
4286                         
4287                         if ( method_exists($this, $met) )
4288                         {
4289                                 $value = call_user_func(array(&$this, $met), $arg);
4290                         }
4291                 }
4292                 
4293                 if ( !isset($value) || empty($value) )
4294                 {
4295                         $value = $val;
4296                 }
4297                 echo sprintf($base, $value);
4298                 return;
4299         }
4300         
4301         /**
4302          * AdminActions::parse_systemsettings()
4303          * Parse skinvar systemsettings
4304          * 
4305          * @param       string  $type                   type of settings for system
4306          * @param       string  $templateName   name of template to use 
4307          * @return      void
4308          */
4309         public function parse_systemsettings($type = 'phpinfo', $templateName = '')
4310         {
4311                 global $member, $CONF, $nucleus;
4312                 
4313                 $member->isAdmin() or Admin::disallow();
4314                 
4315                 $enable  = _ADMIN_SYSTEMOVERVIEW_ENABLE;
4316                 $disable = _ADMIN_SYSTEMOVERVIEW_DISABLE;
4317                 
4318                 switch ( $type )
4319                 {
4320                         case 'phpversion':
4321                                 echo phpversion();
4322                                 break;
4323                         case 'sqlserverinfo':
4324                                 echo sql_get_server_info();
4325                                 break;
4326                         case 'sqlclientinfo':
4327                                 echo sql_get_client_info();
4328                                 break;
4329                         case 'magicquotesgpc':
4330                                 echo ini_get('magic_quotes_gpc') ? 'On' : 'Off';
4331                                 break;
4332                         case 'magicquotesruntime':
4333                                 echo ini_get('magic_quotes_runtime') ? 'On' : 'Off';
4334                                 break;
4335                         case 'registerglobals':
4336                                 echo ini_get('register_globals') ? 'On' : 'Off';
4337                                 break;
4338                         case 'gdinfo':
4339                                 $templates = array();
4340                                 if ( $templateName )
4341                                 {
4342                                         $templates = Template::read($templateName);
4343                                 }
4344                                 if ( array_key_exists('SYSTEMINFO_GDSETTINGS', $templates) && !empty($templates['SYSTEMINFO_GDSETTINGS']) )
4345                                 {
4346                                         $template = $templates['SYSTEMINFO_GDSETTINGS'];
4347                                 }
4348                                 else
4349                                 {
4350                                         $template = "<tr>\n\t\t" . '<td width="50%">' . "<%key%></td><td><%value%></td>\n</tr>\n";
4351                                 }
4352                                 
4353                                 $gdinfo = gd_info();
4354                                 
4355                                 foreach ( $gdinfo as $key => $value )
4356                                 {
4357                                         if ( is_bool($value) )
4358                                         {
4359                                                 $value = $value ? $enable : $disable;
4360                                         }
4361                                         else
4362                                         {
4363                                                 $value = Entity::hsc($value);
4364                                         }
4365                                         $data = array(
4366                                                 'key'   => $key,
4367                                                 'value' => $value,
4368                                         );
4369                                         echo TEMPLATE::fill($template, $data);
4370                                 }
4371                                 break;
4372                         case 'modrewrite':
4373                                 ob_start();
4374                                 phpinfo(INFO_MODULES);
4375                                 $im = ob_get_contents();
4376                                 ob_end_clean();
4377                                 echo ( i18n::strpos($im, 'mod_rewrite') !== FALSE ) ? $enable : $disable;
4378                                 break;
4379                         case 'nucleusversion':
4380                                 echo getNucleusVersion() / 100 . '(' . $nucleus['version'] . ')';
4381                                 break;
4382                         case 'nucleuspatchlevel':
4383                                 echo getNucleusPatchLevel();
4384                                 break;
4385                         case 'confself':
4386                                 echo $CONF['Self'];
4387                                 break;
4388                         case 'confitemurl':
4389                                 echo $CONF['ItemURL'];
4390                                 break;
4391                         case 'alertonheaderssent':
4392                                 echo $CONF['alertOnHeadersSent'] ? $enable : $disable;
4393                                 break;
4394                         case 'nucleuscodename':
4395                                 if ( $nucleus['codename'] != '' )
4396                                 {
4397                                         echo ' &quot;' . $nucleus['codename'] . '&quot;';
4398                                 }
4399                                 break;
4400                         case 'versioncheckurl':
4401                                 echo sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
4402                                 break;
4403                 }
4404                 return;
4405         }
4406         
4407         /**
4408          * AdminActions::parse_templateoverview()
4409          * Parse skinvar templateoverview
4410          * 
4411          * @param       string  $templateName   name of template to use
4412          * @return      void
4413          */
4414         public function parse_templateoverview($templateName = '')
4415         {
4416                 $query  = "SELECT * FROM %s ORDER BY tdname";
4417                 $query = sprintf($query, sql_table('template_desc'));
4418                 $template['content']  = 'templatelist';
4419                 $template['tabindex'] = 10;
4420                 Showlist($query, 'table', $template, $templateName);
4421                 return;
4422         }
4423         
4424         /**
4425          * AdminActions::parse_ticket()
4426          * Parse ticket
4427          * 
4428          * @param       void
4429          * @return      void
4430          */
4431         public function parse_ticket()
4432         {
4433                 global $manager;
4434                 $manager->addTicketHidden();
4435                 return;
4436         }
4437         
4438         /**
4439          * AdminActions::parse_versioncheckurl()
4440          * Parse skinvar versioncheckurl
4441          * 
4442          * @param       void
4443          * @return      void
4444          */
4445         public function parse_versioncheckurl()
4446         {
4447                 echo sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
4448                 return;
4449         }
4450         
4451         /**
4452          * AdminActions::parse_yrbloglist()
4453          * Parse skinvar yrbloglist
4454          * 
4455          * @param       string  $templateName   name of template to use
4456          * @return      void
4457          */
4458         public function parse_yrbloglist($templateName = '')
4459         {
4460                 global $member;
4461                 $showAll = requestVar('showall');
4462                 
4463                 if ( $member->isAdmin() && ($showAll == 'yes') )
4464                 {
4465                         // Super-Admins have access to all blogs! (no add item support though)
4466                         $query =  "SELECT bnumber, bname, 1 as tadmin, burl, bshortname"
4467                                 . " FROM %s"
4468                                 . " ORDER BY bnumber";
4469                         $query = sprintf($query, sql_table('blog'));
4470                 }
4471                 else
4472                 {
4473                         $query =  "SELECT bnumber, bname, tadmin, burl, bshortname"
4474                                 . " FROM %s,%s"
4475                                 . " WHERE tblog=bnumber and tmember=%d"
4476                                 . " ORDER BY bnumber";
4477                         $query = sprintf($query, sql_table('blog'), sql_table('team'), (integer) $member->getID());
4478                 }
4479                 
4480                 $template['content']    = 'bloglist';
4481                 $template['superadmin'] = $member->isAdmin();
4482                 
4483                 $amount = Showlist($query, 'table', $template, $templateName);
4484                 
4485                 if ( ($showAll != 'yes') && ($member->isAdmin()) )
4486                 {
4487                         $query = 'SELECT COUNT(*) as result FROM ' . sql_table('blog');
4488                         
4489                         $total = quickQuery($query);
4490                         if ( $total > $amount )
4491                         {
4492                                 echo '<p><a href="index.php?action=overview&amp;showall=yes">' . _OVERVIEW_SHOWALL . '</a></p>';
4493                         }
4494                 }
4495                 
4496                 if ( $amount == 0 )
4497                 {
4498                         echo _OVERVIEW_NOBLOGS;
4499                 }
4500                 elseif( $amount != 0 )
4501                 {
4502                         echo '<h2>' . _OVERVIEW_YRDRAFTS . '</h2>';
4503                         
4504                         $query =  "SELECT ititle, inumber, bshortname"
4505                                . " FROM %s,%s"
4506                                . ' WHERE iauthor=%d AND iblog=bnumber AND idraft=1';
4507                         $query = sprintf($query. sql_table('item'), sql_table('blog'), (integer) $member->getID());
4508                         
4509                         $template['content'] = 'draftlist';
4510                         
4511                         $amountdrafts = Showlist($query, 'table', $template, $templateName);
4512                         if ( $amountdrafts == 0 )
4513                         {
4514                                 echo _OVERVIEW_NODRAFTS;
4515                         }
4516                 }
4517                 return;
4518         }
4519         
4520         /**
4521          * AdminActions::checkCondition()
4522          * Checks conditions for if statements
4523          *
4524          * @param       string  $field type of <%if%>
4525          * @param       string  $name property of field
4526          * @param       string  $value value of property
4527          * @return      boolean condition
4528          */
4529         protected function checkCondition($field, $name='', $value = '')
4530         {
4531                 global $CONF, $catid, $blog, $member, $itemidnext, $itemidprev, $manager, $archiveprevexists, $archivenextexists;
4532                 
4533                 $condition = 0;
4534                 switch ( $field )
4535                 {
4536                         case 'category':
4537                                 if ( !$blog )
4538                                 {
4539                                         if ( $blogid )
4540                                         {
4541                                                 global $manager;
4542                                                 $blog =& $manager->getBlog($blogid);
4543                                         }
4544                                         elseif ( $catid )
4545                                         {
4546                                                 $blogid = getBlogIDFromCatID($catid);
4547                                                 global $manager;
4548                                                 $blog =& $manager->getBlog($blogid);
4549                                         }
4550                                         elseif ( intRequestVar('catid') )
4551                                         {
4552                                                 $catid = intRequestVar('catid');
4553                                                 $blogid = getBlogIDFromCatID($catid);
4554                                                 global $manager;
4555                                                 $blog =& $manager->getBlog($blogid);
4556                                         }
4557                                         else
4558                                         {
4559                                                 return;
4560                                         }
4561                                 }
4562                                 $condition = ($blog && $this->ifCategory($name, $value));
4563                                 break;
4564                         case 'blogsetting':
4565                                 $condition = ($blog && ($blog->getSetting($name) == $value));
4566                                 break;
4567                         case 'loggedin':
4568                                 $condition = $member->isLoggedIn();
4569                                 break;
4570                         case 'onteam':
4571                                 $condition = $member->isLoggedIn() && $this->ifOnTeam($name);
4572                                 break;
4573                         case 'admin':
4574                                 $condition = $member->isLoggedIn() && $this->ifAdmin($name);
4575                                 break;
4576                         case 'superadmin':
4577                                 $condition = $member->isLoggedIn() && $member->isAdmin();
4578                                 break;
4579                         case 'allowloginedit':
4580                                 $condition = $member->isLoggedIn() && ($CONF['AllowLoginEdit'] || $member->isAdmin());
4581                                 break;
4582                         case 'nextitem':
4583                                 $condition = ($itemidnext != '');
4584                                 break;
4585                         case 'previtem':
4586                                 $condition = ($itemidprev != '');
4587                                 break;
4588                         case 'archiveprevexists':
4589                                 $condition = ($archiveprevexists == true);
4590                                 break;
4591                         case 'archivenextexists':
4592                                 $condition = ($archivenextexists == true);
4593                                 break;
4594                         case 'skintype':
4595                                 $condition = (($name == $this->skintype) || ($name == requestVar('action')));
4596                                 break;
4597                         case 'hasplugin':
4598                                 $condition = $this->ifHasPlugin($name, $value);
4599                                 break;
4600                         case 'adminaction':
4601                                 $condition = ($this->objAdmin->action == $name);
4602                                 break;
4603                         case 'adminoldaction':
4604                                 $condition = ($this->objAdmin->action == $name);
4605                                 break;
4606                         case 'addresschange':
4607                                 $condition = ($this->ifAddresscange());
4608                                 break;
4609                         case 'bechangepass':
4610                                 $condition = ($this->beChangePassword());
4611                                 break;
4612                         case 'skincandidates':
4613                                 $condition = ($this->ifSkincandidates());
4614                                 break;
4615                         case 'nameclashes':
4616                                 $condition = requestVar('nameclashes');
4617                                 break;
4618                         case 'existsnewplugin':
4619                                 $condition = ($this->existsNewPlugin());
4620                                 break;
4621                         case 'autosave':
4622                                 $condition = (boolean) ($member->getAutosave() == $value);
4623                                 break;
4624                         default:
4625                                 $condition = $manager->pluginInstalled("NP_{$field}") && $this->ifPlugin($field, $name, $value);
4626                                 break;
4627                 }
4628                 return $condition;
4629         }
4630         
4631         /**
4632          * Actions::_ifHasPlugin()
4633          *      hasplugin,PlugName
4634          *         -> checks if plugin exists
4635          *      hasplugin,PlugName,OptionName
4636          *         -> checks if the option OptionName from plugin PlugName is not set to 'no'
4637          *      hasplugin,PlugName,OptionName=value
4638          *         -> checks if the option OptionName from plugin PlugName is set to value
4639          *
4640          * @param       string  $name   name of plugin
4641          * @param       string  $value  
4642          * @return      
4643          */
4644         private function ifHasPlugin($name, $value)
4645         {
4646                 global $manager;
4647                 $condition = false;
4648                 // (pluginInstalled method won't write a message in the actionlog on failure)
4649                 if ( $manager->pluginInstalled("NP_{$name}") )
4650                 {
4651                         $plugin =& $manager->getPlugin("NP_{$name}");
4652                         if ( $plugin != NULL )
4653                         {
4654                                 if ( $value == "" )
4655                                 {
4656                                         $condition = true;
4657                                 }
4658                                 else
4659                                 {
4660                                         list($name2, $value2) = preg_split('#=#', $value, 2);
4661                                         if ( $value2 == "" && $plugin->getOption($name2) != 'no' )
4662                                         {
4663                                                 $condition = true;
4664                                         }
4665                                         else if ( $plugin->getOption($name2) == $value2 )
4666                                         {
4667                                                 $condition = true;
4668                                         }
4669                                 }
4670                         }
4671                 }
4672                 return $condition;
4673         }
4674         
4675         /**
4676          * Actions::beChangePassword()
4677          * 
4678          * @param       void
4679          * @return      void
4680          */
4681         private function beChangePassword()
4682         {
4683                 return intRequestVar('bNeedsPasswordChange');
4684         }
4685         
4686         /**
4687          * Actions::ifSkincandidates()
4688          * Checks if a plugin exists and call its doIf function
4689          * 
4690          * @param       void
4691          * @return      void
4692          */
4693         private function ifSkincandidates()
4694         {
4695                 global $DIR_SKINS;
4696                 $candidates = SKINIMPORT::searchForCandidates($DIR_SKINS);
4697                 return (count($candidates) > 0);
4698         }
4699         
4700         /**
4701          * Actions::ifPlugin()
4702          * Checks if a plugin exists and call its doIf function
4703          */
4704         private function ifPlugin($name, $key = '', $value = '')
4705         {
4706                 global $manager;
4707
4708                 $plugin =& $manager->getPlugin("NP_{$name}");
4709                 if ( !$plugin )
4710                 {
4711                         return;
4712                 }
4713
4714                 $params = func_get_args();
4715                 array_shift($params);
4716
4717                 return call_user_func_array(array(&$plugin, 'doIf'), $params);
4718         }
4719
4720         /**
4721          *  Different checks for a category
4722          */
4723         private function ifCategory($name = '', $value='')
4724         {
4725                 global $blog, $catid;
4726
4727                 // when no parameter is defined, just check if a category is selected
4728                 if (($name != 'catname' && $name != 'catid') || ($value == ''))
4729                 {
4730                         return $blog->isValidCategory($catid);
4731                 }
4732
4733                 // check category name
4734                 if ( $name == 'catname' )
4735                 {
4736                         $value = $blog->getCategoryIdFromName($value);
4737                         if ($value == $catid)
4738                         {
4739                                 return $blog->isValidCategory($catid);
4740                         }
4741                 }
4742
4743                 // check category id
4744                 if (($name == 'catid') && ($value == $catid))
4745                 {
4746                         return $blog->isValidCategory($catid);
4747                 }
4748
4749                 return FALSE;
4750         }
4751
4752         /**
4753          *  Checks if a member is on the team of a blog and return his rights
4754          */
4755         private function ifOnTeam($blogName = '')
4756         {
4757                 global $blog, $member, $manager;
4758
4759                 // when no blog found
4760                 if ( ($blogName == '') && !is_object($blog) )
4761                 {
4762                         return 0;
4763                 }
4764                 
4765                 // explicit blog selection
4766                 if ($blogName != '')
4767                 {
4768                         $blogid = getBlogIDFromName($blogName);
4769                 }
4770
4771                 if (($blogName == '') || !$manager->existsBlogID($blogid))
4772                 {
4773                         // use current blog
4774                         $blogid = $blog->getID();
4775                 }
4776                 return $member->teamRights($blogid);
4777         }
4778
4779         /**
4780          *  Checks if a member is admin of a blog
4781          */
4782         private function ifAdmin($blogName = '')
4783         {
4784                 global $blog, $member, $manager;
4785
4786                 // when no blog found
4787                 if (($blogName == '') && (!is_object($blog)))
4788                 {
4789                         return 0;
4790                 }
4791
4792                 // explicit blog selection
4793                 if ($blogName != '')
4794                 {
4795                         $blogid = getBlogIDFromName($blogName);
4796                 }
4797
4798                 if (($blogName == '') || !$manager->existsBlogID($blogid))
4799                 {
4800                         // use current blog
4801                         $blogid = $blog->getID();
4802                 }
4803
4804                 return $member->isBlogAdmin($blogid);
4805         }
4806
4807         /**
4808          * Check e-Mail address is changed
4809          */
4810         private function ifAddresscange()
4811         {
4812                 $key = $this->objAdmin->sessionVar("{$CONF['CookiePrefix']}ackey");
4813                 if ( !$key )
4814                 {
4815                         return FALSE;
4816                 }
4817                 $info = MEMBER::getActivationInfo($key);
4818                 if ( !$info )
4819                 {
4820                         return FALSE;
4821                 }
4822                 $mem  = MEMBER::createFromId($info->vmember);
4823                 if ( !$mem )
4824                 {
4825                         return FALSE;
4826                 }
4827                 if ( $info->vtype == 'addresschange' )
4828                 {
4829                         return TRUE;
4830                 }
4831                 return FALSE;
4832         }
4833         
4834         /**
4835          * AdminActions::customHelp()
4836          * shows a link to custom help file
4837          * 
4838          * @param       integer $id                     
4839          * @param       string  $tplName        
4840          * @param       string  $url            
4841          * @param       string  $iconURL        
4842          * @param       string  $alt            
4843          * @param       string  $title          
4844          * @param       $onclick
4845          * 
4846          */
4847         private function customHelp($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
4848         {
4849                 echo self::customHelpHtml($id, $tplName, $url, $iconURL, $alt, $title, $onclick);
4850         }
4851         
4852         /**
4853          * AdminActions::customHelpHtml()
4854          * 
4855          * @param       integer $id                     
4856          * @param       string  $tplName        
4857          * @param       string  $url            
4858          * @param       string  $iconURL        
4859          * @param       string  $alt            
4860          * @param       string  $title          
4861          * @param       string  $onclick        
4862          * @return      string  anchor element with help uri
4863          */
4864         private function customHelpHtml($id, $tplName = '', $url = '', $iconURL = '', $alt = '', $title = '', $onclick = '')
4865         {
4866                 $templates = array();
4867                 if ( $tplName )
4868                 {
4869                         $templates = Template::read($tplName);
4870                 }
4871                 if ( array_key_exists('ADMIN_CUSTOMHELPLINK_ICON', $templates) && !empty($templates['ADMIN_CUSTOMHELPLINK_ICON']) )
4872                 {
4873                         $template = $templates['ADMIN_CUSTOMHELPLINK_ICON'];
4874                 }
4875                 else
4876                 {
4877                         $template = '<img src="<%iconurl%>" <%width%><%height%>alt="<%alt%>" title="<%title%>" /></a>';
4878                 }
4879                 
4880                 if ( empty($iconURL) )
4881                 {
4882                         global $CONF;
4883                         $iconURL = $CONF['AdminURL'] . 'documentation/icon-help.gif';
4884                 }
4885                 if ( function_exists('getimagesize') )
4886                 {
4887                         $size   = getimagesize($iconURL);
4888                         $width  = 'width="'  . $size[0] . '" ';
4889                         $height = 'height="' . $size[1] . '" ';
4890                 }
4891                 $data = array(
4892                         'iconurl'       => $iconURL,
4893                         'width'         => $width,
4894                         'height'        => $height,
4895                         'alt'           => (isset($alt) && !empty($alt))         ? $alt   : _HELP_TT,
4896                         'title'         => (isset($title) && !empty($title)) ? $title : _HELP_TT,
4897                 );
4898                 $icon = TEMPLATE::fill($template, $data);
4899                 $help = self::customHelplink($id, $tplName, $url, $title, $onclick);
4900                 return $help . $icon;
4901         }
4902         
4903         /**
4904          * AdminActions::input_yesno
4905          * 
4906          * @param               $name
4907          * @param               $checkedval
4908          * @param               $tabindex
4909          * @param               $value1
4910          * @param               $value2
4911          * @param               $yesval
4912          * @param               $noval
4913          * @param               $isAdmin
4914          * @param               $templateName
4915          * @param               $showlist
4916          */
4917         private function input_yesno($name,
4918                                                                 $checkedval,
4919                                                                 $tabindex        = 0,
4920                                                                 $value1    = 1,
4921                                                                 $value2    = 0,
4922                                                                 $yesval    = _YES,
4923                                                                 $noval          = _NO,
4924                                                                 $isAdmin          = 0,
4925                                                                 $templateName = '',
4926                                                                 $showlist        = false)
4927         {
4928                 $templates = array();
4929                 if ( $templateName )
4930                 {
4931                         $templates = Template::read($templateName);
4932                 }
4933                 
4934                 if ( $name == 'admin' )
4935                 {
4936                         if ( array_key_exists('INPUTYESNO_TEMPLATE_ADMIN', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_ADMIN']) )
4937                         {
4938                                 $template = $templates['INPUTYESNO_TEMPLATE_ADMIN'];
4939                         }
4940                         else
4941                         {
4942                                 $template = '<input onclick="selectCanLogin(true);" type="radio" name="<%name%>" value="<%yesval%>" <%yescheckedval%> id="<%yesid%>" />' . "\n"
4943                                           . '<label for="<%yesid%>"><%yesvaltext%></label>' . "\n"
4944                                           . '<input onclick="selectCanLogin(false);" type="radio" name="<%name%>" value="<%noval%>" <%nocheckedval%> id="<%noid%>"<%disabled%> />' . "\n"
4945                                           . '<label for="<%noid%>"><%novaltext%></label>' . "\n";
4946                         }
4947                 }
4948                 else
4949                 {
4950                         if ( array_key_exists('INPUTYESNO_TEMPLATE_NORMAL', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_NORMAL']) )
4951                         {
4952                                 $template = $templates['INPUTYESNO_TEMPLATE_NORMAL'];
4953                         }
4954                         if ( $showlist )
4955                         {
4956                                 if ( array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO', $templates) && !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO']) )
4957                                 {
4958                                         $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO'];
4959                                 }
4960                         }
4961                         if ( !isset($template) )
4962                         {
4963                                 $template = '<input type="radio" name="<%name%>" value="<%yesval%>" <%yescheckedval%> id="<%yesid%>" />' . "\n"
4964                                           . '<label for="<%yesid%>"><%yesvaltext%></label>' . "\n"
4965                                           . '<input type="radio" name="<%name%>" value="<%noval%>" <%nocheckedval%> id="<%noid%>"<%disabled%> />' . "\n"
4966                                           . '<label for="<%noid%>"><%novaltext%></label>' . "\n";
4967                         }
4968                 }
4969                 
4970                 //echo $template;
4971                 $id             = Entity::hsc($name);
4972                 $id             = str_replace('[', '-', $id);
4973                 $id             = str_replace(']', '-', $id);
4974                 $id1    = $id . Entity::hsc($value1);
4975                 $id2    = $id . Entity::hsc($value2);
4976                 $dat = array(
4977                         'name'                  => Entity::hsc($name),
4978                         'yesval'                => Entity::hsc($value1),
4979                         'noval'                 => Entity::hsc($value2),
4980                         'yesid'                 => $id1,
4981                         'noid'                  => $id2,
4982                         'yesvaltext'    => $yesval,
4983                         'novaltext'             => $noval,
4984                         'yescheckedval' => ($checkedval == $value1) ? ' checked="checked" tabindex="' . $tabindex . '"': '',
4985                         'nocheckedval'  => ($checkedval != $value1) ? ' checked="checked" tabindex="' . $tabindex . '"': '',
4986                         'disabled'              => ($isAdmin && $name == 'canlogin') ? ' disabled="disabled"' : '',
4987                 );
4988                 
4989                 if ( $showlist )
4990                 {
4991                         return Template::fill($template, $dat);
4992                 }
4993                 else
4994                 {
4995                         echo TEMPLATE::fill($template, $dat);
4996                 }
4997                 return;
4998         }
4999 }