3 * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
\r
4 * Copyright (C) 2002-2009 The Nucleus Group
\r
6 * This program is free software; you can redistribute it and/or
\r
7 * modify it under the terms of the GNU General Public License
\r
8 * as published by the Free Software Foundation; either version 2
\r
9 * of the License, or (at your option) any later version.
\r
10 * (see nucleus/documentation/index.html#license for more info)
\r
13 * The code for the Nucleus admin area
\r
15 * @license http://nucleuscms.org/license.txt GNU General Public License
\r
16 * @copyright Copyright (C) 2002-2009 The Nucleus Group
\r
18 * @version $NucleusJP: ADMIN.php,v 1.21.2.4 2007/10/30 19:04:24 kmorimatsu Exp $
\r
21 if ( !function_exists('requestVar') ) exit;
\r
22 require_once dirname(__FILE__) . '/showlist.php';
\r
25 * Builds the admin area and executes admin actions
\r
30 * @var string $action action currently being executed ($action=xxxx -> action_xxxx method)
\r
42 * Executes an action
\r
44 * @param string $action action to be performed
\r
46 function action($action) {
\r
47 global $CONF, $manager;
\r
49 // list of action aliases
\r
51 'login' => 'overview',
\r
55 if (isset($alias[$action]))
\r
56 $action = $alias[$action];
\r
58 $methodName = 'action_' . $action;
\r
60 $this->action = strtolower($action);
\r
62 // check ticket. All actions need a ticket, unless they are considered to be safe (a safe action
\r
63 // is an action that requires user interaction before something is actually done)
\r
64 // all safe actions are in this array:
\r
65 $aActionsNotToCheck = array(
\r
75 'editmembersettings',
\r
77 'browseowncomments',
\r
96 'banlistnewfromitem',
\r
117 // the rest of the actions needs to be checked
\r
118 $aActionsToCheck = array('additem', 'itemupdate', 'itemmoveto', 'categoryupdate', 'categorydeleteconfirm', 'itemdeleteconfirm', 'commentdeleteconfirm', 'teamdeleteconfirm', 'memberdeleteconfirm', 'templatedeleteconfirm', 'skindeleteconfirm', 'banlistdeleteconfirm', 'plugindeleteconfirm', 'batchitem', 'batchcomment', 'batchmember', 'batchcategory', 'batchteam', 'regfile', 'commentupdate', 'banlistadd', 'changemembersettings', 'clearactionlog', 'settingsupdate', 'blogsettingsupdate', 'categorynew', 'teamchangeadmin', 'teamaddmember', 'memberadd', 'addnewlog', 'addnewlog2', 'backupcreate', 'backuprestore', 'pluginup', 'plugindown', 'pluginupdate', 'pluginadd', 'pluginoptionsupdate', 'skinupdate', 'skinclone', 'skineditgeneral', 'templateclone', 'templatenew', 'templateupdate', 'skinieimport', 'skinieexport', 'skiniedoimport', 'skinnew', 'deleteblogconfirm', 'sendping', 'rawping', 'activatesetpwd');
\r
120 if (!in_array($this->action, $aActionsNotToCheck))
\r
122 if (!$manager->checkTicket())
\r
123 $this->error(_ERROR_BADTICKET);
\r
126 if (method_exists($this, $methodName))
\r
127 call_user_func(array(&$this, $methodName));
\r
129 $this->error(_BADACTION . htmlspecialchars(" ($action)"));
\r
134 * @todo document this
\r
136 function action_showlogin() {
\r
138 $this->action_login($error);
\r
142 * @todo document this
\r
144 function action_login($msg = '', $passvars = 1) {
\r
147 // skip to overview when allowed
\r
148 if ($member->isLoggedIn() && $member->canLogin()) {
\r
149 $this->action_overview();
\r
155 echo '<h2>', _LOGIN ,'</h2>';
\r
156 if ($msg) echo _MESSAGE , ': ', htmlspecialchars($msg);
\r
159 <form action="index.php" method="post"><p>
\r
160 <?php echo _LOGIN_NAME; ?> <br /><input name="login" tabindex="10" />
\r
162 <?php echo _LOGIN_PASSWORD; ?> <br /><input name="password" tabindex="20" type="password" />
\r
164 <input name="action" value="login" type="hidden" />
\r
166 <input type="submit" value="<?php echo _LOGIN?>" tabindex="30" />
\r
169 <input type="checkbox" value="1" name="shared" tabindex="40" id="shared" /><label for="shared"><?php echo _LOGIN_SHARED?></label>
\r
170 <br /><a href="forgotpassword.html"><?php echo _LOGIN_FORGOT?></a>
\r
172 <?php // pass through vars
\r
174 $oldaction = postVar('oldaction');
\r
175 if ( ($oldaction != 'logout') && ($oldaction != 'login') && $passvars ) {
\r
182 <?php $this->pagefoot();
\r
187 * provides a screen with the overview of the actions available
\r
188 * @todo document parameter
\r
190 function action_overview($msg = '') {
\r
196 echo _MESSAGE , ': ', $msg;
\r
198 /* ---- add items ---- */
\r
199 echo '<h2>' . _OVERVIEW_YRBLOGS . '</h2>';
\r
201 $showAll = requestVar('showall');
\r
203 if (($member->isAdmin()) && ($showAll == 'yes')) {
\r
204 // Super-Admins have access to all blogs! (no add item support though)
\r
205 $query = 'SELECT bnumber, bname, 1 as tadmin, burl, bshortname'
\r
206 . ' FROM ' . sql_table('blog')
\r
207 . ' ORDER BY bname';
\r
209 $query = 'SELECT bnumber, bname, tadmin, burl, bshortname'
\r
210 . ' FROM ' . sql_table('blog') . ', ' . sql_table('team')
\r
211 . ' WHERE tblog=bnumber and tmember=' . $member->getID()
\r
212 . ' ORDER BY bname';
\r
214 $template['content'] = 'bloglist';
\r
215 $template['superadmin'] = $member->isAdmin();
\r
216 $amount = showlist($query,'table',$template);
\r
218 if (($showAll != 'yes') && ($member->isAdmin())) {
\r
219 $total = quickQuery('SELECT COUNT(*) as result FROM ' . sql_table('blog'));
\r
220 if ($total > $amount)
\r
221 echo '<p><a href="index.php?action=overview&showall=yes">' . _OVERVIEW_SHOWALL . '</a></p>';
\r
225 echo _OVERVIEW_NOBLOGS;
\r
227 if ($amount != 0) {
\r
228 echo '<h2>' . _OVERVIEW_YRDRAFTS . '</h2>';
\r
229 $query = 'SELECT ititle, inumber, bshortname'
\r
230 . ' FROM ' . sql_table('item'). ', ' . sql_table('blog')
\r
231 . ' WHERE iauthor='.$member->getID().' and iblog=bnumber and idraft=1';
\r
232 $template['content'] = 'draftlist';
\r
233 $amountdrafts = showlist($query, 'table', $template);
\r
234 if ($amountdrafts == 0)
\r
235 echo _OVERVIEW_NODRAFTS;
\r
238 /* ---- user settings ---- */
\r
239 echo '<h2>' . _OVERVIEW_YRSETTINGS . '</h2>';
\r
241 echo '<li><a href="index.php?action=editmembersettings">' . _OVERVIEW_EDITSETTINGS. '</a></li>';
\r
242 echo '<li><a href="index.php?action=browseownitems">' . _OVERVIEW_BROWSEITEMS.'</a></li>';
\r
243 echo '<li><a href="index.php?action=browseowncomments">'._OVERVIEW_BROWSECOMM.'</a></li>';
\r
246 /* ---- general settings ---- */
\r
247 if ($member->isAdmin()) {
\r
248 echo '<h2>' . _OVERVIEW_MANAGEMENT. '</h2>';
\r
250 echo '<li><a href="index.php?action=manage">',_OVERVIEW_MANAGE,'</a></li>';
\r
259 * Returns a link to a weblog
\r
260 * @param object BLOG
\r
262 function bloglink(&$blog) {
\r
263 return '<a href="'.htmlspecialchars($blog->getURL()).'" title="'._BLOGLIST_TT_VISIT.'">'. htmlspecialchars( $blog->getName() ) .'</a>';
\r
267 * @todo document this
\r
269 function action_manage($msg = '') {
\r
272 $member->isAdmin() or $this->disallow();
\r
276 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
\r
279 echo '<p>' , _MESSAGE , ': ', $msg , '</p>';
\r
282 echo '<h2>' . _MANAGE_GENERAL. '</h2>';
\r
285 echo '<li><a href="index.php?action=createnewlog">'._OVERVIEW_NEWLOG.'</a></li>';
\r
286 echo '<li><a href="index.php?action=settingsedit">'._OVERVIEW_SETTINGS.'</a></li>';
\r
287 echo '<li><a href="index.php?action=usermanagement">'._OVERVIEW_MEMBERS.'</a></li>';
\r
288 echo '<li><a href="index.php?action=actionlog">'._OVERVIEW_VIEWLOG.'</a></li>';
\r
291 echo '<h2>' . _MANAGE_SKINS . '</h2>';
\r
293 echo '<li><a href="index.php?action=skinoverview">'._OVERVIEW_SKINS.'</a></li>';
\r
294 echo '<li><a href="index.php?action=templateoverview">'._OVERVIEW_TEMPLATES.'</a></li>';
\r
295 echo '<li><a href="index.php?action=skinieoverview">'._OVERVIEW_SKINIMPORT.'</a></li>';
\r
298 echo '<h2>' . _MANAGE_EXTRA . '</h2>';
\r
300 echo '<li><a href="index.php?action=backupoverview">'._OVERVIEW_BACKUP.'</a></li>';
\r
301 echo '<li><a href="index.php?action=pluginlist">'._OVERVIEW_PLUGINS.'</a></li>';
\r
308 * @todo document this
\r
310 function action_itemlist($blogid = '') {
\r
311 global $member, $manager, $CONF;
\r
314 $blogid = intRequestVar('blogid');
\r
316 $member->teamRights($blogid) or $member->isAdmin() or $this->disallow();
\r
319 $blog =& $manager->getBlog($blogid);
\r
321 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
\r
322 echo '<h2>' . _ITEMLIST_BLOG . ' ' . $this->bloglink($blog) . '</h2>';
\r
325 if (postVar('start'))
\r
326 $start = intPostVar('start');
\r
331 echo '<p><a href="index.php?action=createitem&blogid='.$blogid.'">',_ITEMLIST_ADDNEW,'</a></p>';
\r
333 // amount of items to show
\r
334 if (postVar('amount'))
\r
335 $amount = intPostVar('amount');
\r
337 $amount = intval($CONF['DefaultListSize']);
\r
342 $search = postVar('search'); // search through items
\r
344 $query = 'SELECT bshortname, cname, mname, ititle, ibody, inumber, idraft, itime'
\r
345 . ' FROM ' . sql_table('item') . ', ' . sql_table('blog') . ', ' . sql_table('member') . ', ' . sql_table('category')
\r
346 . ' WHERE iblog=bnumber and iauthor=mnumber and icat=catid and iblog=' . $blogid;
\r
349 $query .= ' and ((ititle LIKE "%' . addslashes($search) . '%") or (ibody LIKE "%' . addslashes($search) . '%") or (imore LIKE "%' . addslashes($search) . '%"))';
\r
351 // non-blog-admins can only edit/delete their own items
\r
352 if (!$member->blogAdminRights($blogid))
\r
353 $query .= ' and iauthor=' . $member->getID();
\r
356 $query .= ' ORDER BY itime DESC'
\r
357 . " LIMIT $start,$amount";
\r
359 $template['content'] = 'itemlist';
\r
360 $template['now'] = $blog->getCorrectTime(time());
\r
362 $manager->loadClass("ENCAPSULATE");
\r
363 $navList =& new NAVLIST('itemlist', $start, $amount, 0, 1000, $blogid, $search, 0);
\r
364 $navList->showBatchList('item',$query,'table',$template);
\r
371 * @todo document this
\r
373 function action_batchitem() {
\r
374 global $member, $manager;
\r
376 // check if logged in
\r
377 $member->isLoggedIn() or $this->disallow();
\r
379 // more precise check will be done for each performed operation
\r
381 // get array of itemids from request
\r
382 $selected = requestIntArray('batch');
\r
383 $action = requestVar('batchaction');
\r
385 // Show error when no items were selected
\r
386 if (!is_array($selected) || sizeof($selected) == 0)
\r
387 $this->error(_BATCH_NOSELECTION);
\r
389 // On move: when no destination blog/category chosen, show choice now
\r
390 $destCatid = intRequestVar('destcatid');
\r
391 if (($action == 'move') && (!$manager->existsCategory($destCatid)))
\r
392 $this->batchMoveSelectDestination('item',$selected);
\r
394 // On delete: check if confirmation has been given
\r
395 if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
\r
396 $this->batchAskDeleteConfirmation('item',$selected);
\r
400 echo '<a href="index.php?action=overview">(',_BACKHOME,')</a>';
\r
401 echo '<h2>',_BATCH_ITEMS,'</h2>';
\r
402 echo '<p>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b></p>';
\r
406 // walk over all itemids and perform action
\r
407 foreach ($selected as $itemid) {
\r
408 $itemid = intval($itemid);
\r
409 echo '<li>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b> ',_BATCH_ONITEM,' <b>', $itemid, '</b>...';
\r
411 // perform action, display errors if needed
\r
414 $error = $this->deleteOneItem($itemid);
\r
417 $error = $this->moveOneItem($itemid, $destCatid);
\r
420 $error = _BATCH_UNKNOWN . htmlspecialchars($action);
\r
423 echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
\r
428 echo '<b>',_BATCH_DONE,'</b>';
\r
436 * @todo document this
\r
438 function action_batchcomment() {
\r
441 // check if logged in
\r
442 $member->isLoggedIn() or $this->disallow();
\r
444 // more precise check will be done for each performed operation
\r
446 // get array of itemids from request
\r
447 $selected = requestIntArray('batch');
\r
448 $action = requestVar('batchaction');
\r
450 // Show error when no items were selected
\r
451 if (!is_array($selected) || sizeof($selected) == 0)
\r
452 $this->error(_BATCH_NOSELECTION);
\r
454 // On delete: check if confirmation has been given
\r
455 if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
\r
456 $this->batchAskDeleteConfirmation('comment',$selected);
\r
460 echo '<a href="index.php?action=overview">(',_BACKHOME,')</a>';
\r
461 echo '<h2>',_BATCH_COMMENTS,'</h2>';
\r
462 echo '<p>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b></p>';
\r
465 // walk over all itemids and perform action
\r
466 foreach ($selected as $commentid) {
\r
467 $commentid = intval($commentid);
\r
468 echo '<li>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b> ',_BATCH_ONCOMMENT,' <b>', $commentid, '</b>...';
\r
470 // perform action, display errors if needed
\r
473 $error = $this->deleteOneComment($commentid);
\r
476 $error = _BATCH_UNKNOWN . htmlspecialchars($action);
\r
479 echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
\r
484 echo '<b>',_BATCH_DONE,'</b>';
\r
492 * @todo document this
\r
494 function action_batchmember() {
\r
497 // check if logged in and admin
\r
498 ($member->isLoggedIn() && $member->isAdmin()) or $this->disallow();
\r
500 // get array of itemids from request
\r
501 $selected = requestIntArray('batch');
\r
502 $action = requestVar('batchaction');
\r
504 // Show error when no members selected
\r
505 if (!is_array($selected) || sizeof($selected) == 0)
\r
506 $this->error(_BATCH_NOSELECTION);
\r
508 // On delete: check if confirmation has been given
\r
509 if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
\r
510 $this->batchAskDeleteConfirmation('member',$selected);
\r
514 echo '<a href="index.php?action=usermanagement">(',_MEMBERS_BACKTOOVERVIEW,')</a>';
\r
515 echo '<h2>',_BATCH_MEMBERS,'</h2>';
\r
516 echo '<p>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b></p>';
\r
519 // walk over all itemids and perform action
\r
520 foreach ($selected as $memberid) {
\r
521 $memberid = intval($memberid);
\r
522 echo '<li>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b> ',_BATCH_ONMEMBER,' <b>', $memberid, '</b>...';
\r
524 // perform action, display errors if needed
\r
527 $error = $this->deleteOneMember($memberid);
\r
531 sql_query('UPDATE ' . sql_table('member') . ' SET madmin=1 WHERE mnumber='.$memberid);
\r
535 // there should always remain at least one super-admin
\r
536 $r = sql_query('SELECT * FROM '.sql_table('member'). ' WHERE madmin=1 and mcanlogin=1');
\r
537 if (mysql_num_rows($r) < 2)
\r
538 $error = _ERROR_ATLEASTONEADMIN;
\r
540 sql_query('UPDATE ' . sql_table('member') .' SET madmin=0 WHERE mnumber='.$memberid);
\r
543 $error = _BATCH_UNKNOWN . htmlspecialchars($action);
\r
546 echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
\r
551 echo '<b>',_BATCH_DONE,'</b>';
\r
559 * @todo document this
\r
561 function action_batchteam() {
\r
564 $blogid = intRequestVar('blogid');
\r
566 // check if logged in and admin
\r
567 ($member->isLoggedIn() && $member->blogAdminRights($blogid)) or $this->disallow();
\r
569 // get array of itemids from request
\r
570 $selected = requestIntArray('batch');
\r
571 $action = requestVar('batchaction');
\r
573 // Show error when no members selected
\r
574 if (!is_array($selected) || sizeof($selected) == 0)
\r
575 $this->error(_BATCH_NOSELECTION);
\r
577 // On delete: check if confirmation has been given
\r
578 if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
\r
579 $this->batchAskDeleteConfirmation('team',$selected);
\r
583 echo '<p><a href="index.php?action=manageteam&blogid=',$blogid,'">(',_BACK,')</a></p>';
\r
585 echo '<h2>',_BATCH_TEAM,'</h2>';
\r
586 echo '<p>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b></p>';
\r
589 // walk over all itemids and perform action
\r
590 foreach ($selected as $memberid) {
\r
591 $memberid = intval($memberid);
\r
592 echo '<li>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b> ',_BATCH_ONTEAM,' <b>', $memberid, '</b>...';
\r
594 // perform action, display errors if needed
\r
597 $error = $this->deleteOneTeamMember($blogid, $memberid);
\r
601 sql_query('UPDATE '.sql_table('team').' SET tadmin=1 WHERE tblog='.$blogid.' and tmember='.$memberid);
\r
605 // there should always remain at least one admin
\r
606 $r = sql_query('SELECT * FROM '.sql_table('team').' WHERE tadmin=1 and tblog='.$blogid);
\r
607 if (mysql_num_rows($r) < 2)
\r
608 $error = _ERROR_ATLEASTONEBLOGADMIN;
\r
610 sql_query('UPDATE '.sql_table('team').' SET tadmin=0 WHERE tblog='.$blogid.' and tmember='.$memberid);
\r
613 $error = _BATCH_UNKNOWN . htmlspecialchars($action);
\r
616 echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
\r
621 echo '<b>',_BATCH_DONE,'</b>';
\r
629 * @todo document this
\r
631 function action_batchcategory() {
\r
632 global $member, $manager;
\r
634 // check if logged in
\r
635 $member->isLoggedIn() or $this->disallow();
\r
637 // more precise check will be done for each performed operation
\r
639 // get array of itemids from request
\r
640 $selected = requestIntArray('batch');
\r
641 $action = requestVar('batchaction');
\r
643 // Show error when no items were selected
\r
644 if (!is_array($selected) || sizeof($selected) == 0)
\r
645 $this->error(_BATCH_NOSELECTION);
\r
647 // On move: when no destination blog chosen, show choice now
\r
648 $destBlogId = intRequestVar('destblogid');
\r
649 if (($action == 'move') && (!$manager->existsBlogID($destBlogId)))
\r
650 $this->batchMoveCategorySelectDestination('category',$selected);
\r
652 // On delete: check if confirmation has been given
\r
653 if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
\r
654 $this->batchAskDeleteConfirmation('category',$selected);
\r
658 echo '<a href="index.php?action=overview">(',_BACKHOME,')</a>';
\r
659 echo '<h2>',BATCH_CATEGORIES,'</h2>';
\r
660 echo '<p>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b></p>';
\r
663 // walk over all itemids and perform action
\r
664 foreach ($selected as $catid) {
\r
665 $catid = intval($catid);
\r
666 echo '<li>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b> ',_BATCH_ONCATEGORY,' <b>', $catid, '</b>...';
\r
668 // perform action, display errors if needed
\r
671 $error = $this->deleteOneCategory($catid);
\r
674 $error = $this->moveOneCategory($catid, $destBlogId);
\r
677 $error = _BATCH_UNKNOWN . htmlspecialchars($action);
\r
680 echo '<b>',($error ? 'Error: '.$error : _BATCH_SUCCESS),'</b>';
\r
685 echo '<b>',_BATCH_DONE,'</b>';
\r
692 * @todo document this
\r
694 function batchMoveSelectDestination($type, $ids) {
\r
698 <h2><?php echo _MOVE_TITLE?></h2>
\r
699 <form method="post" action="index.php"><div>
\r
701 <input type="hidden" name="action" value="batch<?php echo $type?>" />
\r
702 <input type="hidden" name="batchaction" value="move" />
\r
704 $manager->addTicketHidden();
\r
706 // insert selected item numbers
\r
708 foreach ($ids as $id)
\r
709 echo '<input type="hidden" name="batch[',($idx++),']" value="',intval($id),'" />';
\r
711 // show blog/category selection list
\r
712 $this->selectBlogCategory('destcatid');
\r
717 <input type="submit" value="<?php echo _MOVE_BTN?>" onclick="return checkSubmit();" />
\r
720 <?php $this->pagefoot();
\r
725 * @todo document this
\r
727 function batchMoveCategorySelectDestination($type, $ids) {
\r
731 <h2><?php echo _MOVECAT_TITLE?></h2>
\r
732 <form method="post" action="index.php"><div>
\r
734 <input type="hidden" name="action" value="batch<?php echo $type?>" />
\r
735 <input type="hidden" name="batchaction" value="move" />
\r
737 $manager->addTicketHidden();
\r
739 // insert selected item numbers
\r
741 foreach ($ids as $id)
\r
742 echo '<input type="hidden" name="batch[',($idx++),']" value="',intval($id),'" />';
\r
744 // show blog/category selection list
\r
745 $this->selectBlog('destblogid');
\r
750 <input type="submit" value="<?php echo _MOVECAT_BTN?>" onclick="return checkSubmit();" />
\r
753 <?php $this->pagefoot();
\r
758 * @todo document this
\r
760 function batchAskDeleteConfirmation($type, $ids) {
\r
765 <h2><?php echo _BATCH_DELETE_CONFIRM?></h2>
\r
766 <form method="post" action="index.php"><div>
\r
768 <input type="hidden" name="action" value="batch<?php echo $type?>" />
\r
769 <?php $manager->addTicketHidden() ?>
\r
770 <input type="hidden" name="batchaction" value="delete" />
\r
771 <input type="hidden" name="confirmation" value="yes" />
\r
772 <?php // insert selected item numbers
\r
774 foreach ($ids as $id)
\r
775 echo '<input type="hidden" name="batch[',($idx++),']" value="',intval($id),'" />';
\r
777 // add hidden vars for team & comment
\r
778 if ($type == 'team')
\r
780 echo '<input type="hidden" name="blogid" value="',intRequestVar('blogid'),'" />';
\r
782 if ($type == 'comment')
\r
784 echo '<input type="hidden" name="itemid" value="',intRequestVar('itemid'),'" />';
\r
789 <input type="submit" value="<?php echo _BATCH_DELETE_CONFIRM_BTN?>" onclick="return checkSubmit();" />
\r
792 <?php $this->pagefoot();
\r
798 * Inserts a HTML select element with choices for all categories to which the current
\r
799 * member has access
\r
800 * @see function selectBlog
\r
802 function selectBlogCategory($name, $selected = 0, $tabindex = 0, $showNewCat = 0, $iForcedBlogInclude = -1) {
\r
803 ADMIN::selectBlog($name, 'category', $selected, $tabindex, $showNewCat, $iForcedBlogInclude);
\r
807 * Inserts a HTML select element with choices for all blogs to which the user has access
\r
808 * mode = 'blog' => shows blognames and values are blogids
\r
809 * mode = 'category' => show category names and values are catids
\r
811 * @param $iForcedBlogInclude
\r
812 * ID of a blog that always needs to be included, without checking if the
\r
813 * member is on the blog team (-1 = none)
\r
814 * @todo document parameters
\r
816 function selectBlog($name, $mode='blog', $selected = 0, $tabindex = 0, $showNewCat = 0, $iForcedBlogInclude = -1) {
\r
817 global $member, $CONF;
\r
819 // 0. get IDs of blogs to which member can post items (+ forced blog)
\r
820 $aBlogIds = array();
\r
821 if ($iForcedBlogInclude != -1)
\r
822 $aBlogIds[] = intval($iForcedBlogInclude);
\r
824 if (($member->isAdmin()) && ($CONF['ShowAllBlogs']))
\r
825 $queryBlogs = 'SELECT bnumber FROM '.sql_table('blog').' ORDER BY bname';
\r
827 $queryBlogs = 'SELECT bnumber FROM '.sql_table('blog').', '.sql_table('team').' WHERE tblog=bnumber and tmember=' . $member->getID();
\r
828 $rblogids = sql_query($queryBlogs);
\r
829 while ($o = mysql_fetch_object($rblogids))
\r
830 if ($o->bnumber != $iForcedBlogInclude)
\r
831 $aBlogIds[] = intval($o->bnumber);
\r
833 if (count($aBlogIds) == 0)
\r
836 echo '<select name="',$name,'" tabindex="',$tabindex,'">';
\r
838 // 1. select blogs (we'll create optiongroups)
\r
839 // (only select those blogs that have the user on the team)
\r
840 $queryBlogs = 'SELECT bnumber, bname FROM '.sql_table('blog').' WHERE bnumber in ('.implode(',',$aBlogIds).') ORDER BY bname';
\r
841 $blogs = sql_query($queryBlogs);
\r
842 if ($mode == 'category') {
\r
843 if (mysql_num_rows($blogs) > 1)
\r
844 $multipleBlogs = 1;
\r
846 while ($oBlog = mysql_fetch_object($blogs)) {
\r
847 if ($multipleBlogs)
\r
848 echo '<optgroup label="',htmlspecialchars($oBlog->bname),'">';
\r
850 // show selection to create new category when allowed/wanted
\r
852 // check if allowed to do so
\r
853 if ($member->blogAdminRights($oBlog->bnumber))
\r
854 echo '<option value="newcat-',$oBlog->bnumber,'">',_ADD_NEWCAT,'</option>';
\r
857 // 2. for each category in that blog
\r
858 $categories = sql_query('SELECT cname, catid FROM '.sql_table('category').' WHERE cblog=' . $oBlog->bnumber . ' ORDER BY cname ASC');
\r
859 while ($oCat = mysql_fetch_object($categories)) {
\r
860 if ($oCat->catid == $selected)
\r
861 $selectText = ' selected="selected" ';
\r
864 echo '<option value="',$oCat->catid,'" ', $selectText,'>',htmlspecialchars($oCat->cname),'</option>';
\r
867 if ($multipleBlogs)
\r
868 echo '</optgroup>';
\r
872 while ($oBlog = mysql_fetch_object($blogs)) {
\r
873 echo '<option value="',$oBlog->bnumber,'"';
\r
874 if ($oBlog->bnumber == $selected)
\r
875 echo ' selected="selected"';
\r
876 echo'>',htmlspecialchars($oBlog->bname),'</option>';
\r
884 * @todo document this
\r
886 function action_browseownitems() {
\r
887 global $member, $manager, $CONF;
\r
891 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
\r
892 echo '<h2>' . _ITEMLIST_YOUR. '</h2>';
\r
895 if (postVar('start'))
\r
896 $start = intPostVar('start');
\r
900 // amount of items to show
\r
901 if (postVar('amount'))
\r
902 $amount = intPostVar('amount');
\r
904 $amount = intval($CONF['DefaultListSize']);
\r
909 $search = postVar('search'); // search through items
\r
911 $query = 'SELECT bshortname, cname, mname, ititle, ibody, idraft, inumber, itime'
\r
912 . ' FROM '.sql_table('item').', '.sql_table('blog') . ', '.sql_table('member') . ', '.sql_table('category')
\r
913 . ' WHERE iauthor='. $member->getID() .' and iauthor=mnumber and iblog=bnumber and icat=catid';
\r
916 $query .= ' and ((ititle LIKE "%' . addslashes($search) . '%") or (ibody LIKE "%' . addslashes($search) . '%") or (imore LIKE "%' . addslashes($search) . '%"))';
\r
918 $query .= ' ORDER BY itime DESC'
\r
919 . " LIMIT $start,$amount";
\r
921 $template['content'] = 'itemlist';
\r
922 $template['now'] = time();
\r
924 $manager->loadClass("ENCAPSULATE");
\r
925 $navList =& new NAVLIST('browseownitems', $start, $amount, 0, 1000, /*$blogid*/ 0, $search, 0);
\r
926 $navList->showBatchList('item',$query,'table',$template);
\r
933 * Show all the comments for a given item
\r
934 * @param int $itemid
\r
936 function action_itemcommentlist($itemid = '') {
\r
937 global $member, $manager, $CONF;
\r
940 $itemid = intRequestVar('itemid');
\r
942 // only allow if user is allowed to alter item
\r
943 $member->canAlterItem($itemid) or $this->disallow();
\r
945 $blogid = getBlogIdFromItemId($itemid);
\r
950 if (postVar('start'))
\r
951 $start = intPostVar('start');
\r
955 // amount of items to show
\r
956 if (postVar('amount'))
\r
957 $amount = intPostVar('amount');
\r
959 $amount = intval($CONF['DefaultListSize']);
\r
964 $search = postVar('search');
\r
966 echo '<p>(<a href="index.php?action=itemlist&blogid=',$blogid,'">',_BACKTOOVERVIEW,'</a>)</p>';
\r
967 echo '<h2>',_COMMENTS,'</h2>';
\r
969 $query = 'SELECT cbody, cuser, cmail, cemail, mname, ctime, chost, cnumber, cip, citem FROM ' . sql_table('comment') . ' LEFT OUTER JOIN ' . sql_table('member') . ' ON mnumber = cmember WHERE citem = ' . $itemid;
\r
972 $query .= ' and cbody LIKE "%' . addslashes($search) . '%"';
\r
974 $query .= ' ORDER BY ctime ASC'
\r
975 . " LIMIT $start,$amount";
\r
977 $template['content'] = 'commentlist';
\r
978 $template['canAddBan'] = $member->blogAdminRights(getBlogIDFromItemID($itemid));
\r
980 $manager->loadClass("ENCAPSULATE");
\r
981 $navList =& new NAVLIST('itemcommentlist', $start, $amount, 0, 1000, 0, $search, $itemid);
\r
982 $navList->showBatchList('comment',$query,'table',$template,_NOCOMMENTS);
\r
988 * Browse own comments
\r
990 function action_browseowncomments() {
\r
991 global $member, $manager, $CONF;
\r
994 if (postVar('start'))
\r
995 $start = intPostVar('start');
\r
999 // amount of items to show
\r
1000 if (postVar('amount'))
\r
1001 $amount = intPostVar('amount');
\r
1003 $amount = intval($CONF['DefaultListSize']);
\r
1008 $search = postVar('search');
\r
1011 $query = 'SELECT cbody, cuser, cmail, mname, ctime, chost, cnumber, cip, citem FROM '.sql_table('comment').' LEFT OUTER JOIN '.sql_table('member').' ON mnumber=cmember WHERE cmember=' . $member->getID();
\r
1014 $query .= ' and cbody LIKE "%' . addslashes($search) . '%"';
\r
1016 $query .= ' ORDER BY ctime DESC'
\r
1017 . " LIMIT $start,$amount";
\r
1019 $this->pagehead();
\r
1021 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
\r
1022 echo '<h2>', _COMMENTS_YOUR ,'</h2>';
\r
1024 $template['content'] = 'commentlist';
\r
1025 $template['canAddBan'] = 0; // doesn't make sense to allow banning yourself
\r
1027 $manager->loadClass("ENCAPSULATE");
\r
1028 $navList =& new NAVLIST('browseowncomments', $start, $amount, 0, 1000, 0, $search, 0);
\r
1029 $navList->showBatchList('comment',$query,'table',$template,_NOCOMMENTS_YOUR);
\r
1031 $this->pagefoot();
\r
1035 * Browse all comments for a weblog
\r
1036 * @param int $blogid
\r
1038 function action_blogcommentlist($blogid = '')
\r
1040 global $member, $manager, $CONF;
\r
1042 if ($blogid == '')
\r
1043 $blogid = intRequestVar('blogid');
\r
1045 $blogid = intval($blogid);
\r
1047 $member->teamRights($blogid) or $member->isAdmin() or $this->disallow();
\r
1050 if (postVar('start'))
\r
1051 $start = intPostVar('start');
\r
1055 // amount of items to show
\r
1056 if (postVar('amount'))
\r
1057 $amount = intPostVar('amount');
\r
1059 $amount = intval($CONF['DefaultListSize']);
\r
1064 $search = postVar('search'); // search through comments
\r
1067 $query = 'SELECT cbody, cuser, cemail, cmail, mname, ctime, chost, cnumber, cip, citem FROM '.sql_table('comment').' LEFT OUTER JOIN '.sql_table('member').' ON mnumber=cmember WHERE cblog=' . intval($blogid);
\r
1069 if ($search != '')
\r
1070 $query .= ' and cbody LIKE "%' . addslashes($search) . '%"';
\r
1073 $query .= ' ORDER BY ctime DESC'
\r
1074 . " LIMIT $start,$amount";
\r
1077 $blog =& $manager->getBlog($blogid);
\r
1079 $this->pagehead();
\r
1081 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
\r
1082 echo '<h2>', _COMMENTS_BLOG , ' ' , $this->bloglink($blog), '</h2>';
\r
1084 $template['content'] = 'commentlist';
\r
1085 $template['canAddBan'] = $member->blogAdminRights($blogid);
\r
1087 $manager->loadClass("ENCAPSULATE");
\r
1088 $navList =& new NAVLIST('blogcommentlist', $start, $amount, 0, 1000, $blogid, $search, 0);
\r
1089 $navList->showBatchList('comment',$query,'table',$template, _NOCOMMENTS_BLOG);
\r
1091 $this->pagefoot();
\r
1095 * Provide a page to item a new item to the given blog
\r
1097 function action_createitem() {
\r
1098 global $member, $manager;
\r
1100 $blogid = intRequestVar('blogid');
\r
1102 // check if allowed
\r
1103 $member->teamRights($blogid) or $this->disallow();
\r
1105 $memberid = $member->getID();
\r
1107 $blog =& $manager->getBlog($blogid);
\r
1109 $this->pagehead();
\r
1111 // generate the add-item form
\r
1112 $formfactory =& new PAGEFACTORY($blogid);
\r
1113 $formfactory->createAddForm('admin');
\r
1115 $this->pagefoot();
\r
1119 * @todo document this
\r
1121 function action_itemedit() {
\r
1122 global $member, $manager;
\r
1124 $itemid = intRequestVar('itemid');
\r
1126 // only allow if user is allowed to alter item
\r
1127 $member->canAlterItem($itemid) or $this->disallow();
\r
1129 $item =& $manager->getItem($itemid,1,1);
\r
1130 $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
\r
1132 $manager->notify('PrepareItemForEdit', array('item' => &$item));
\r
1134 if ($blog->convertBreaks()) {
\r
1135 $item['body'] = removeBreaks($item['body']);
\r
1136 $item['more'] = removeBreaks($item['more']);
\r
1139 // form to edit blog items
\r
1140 $this->pagehead();
\r
1141 $formfactory =& new PAGEFACTORY($blog->getID());
\r
1142 $formfactory->createEditForm('admin',$item);
\r
1143 $this->pagefoot();
\r
1147 * @todo document this
\r
1149 function action_itemupdate() {
\r
1150 global $member, $manager, $CONF;
\r
1152 $itemid = intRequestVar('itemid');
\r
1153 $catid = postVar('catid');
\r
1155 // only allow if user is allowed to alter item
\r
1156 $member->canUpdateItem($itemid, $catid) or $this->disallow();
\r
1158 $actiontype = postVar('actiontype');
\r
1160 // delete actions are handled by itemdelete (which has confirmation)
\r
1161 if ($actiontype == 'delete') {
\r
1162 $this->action_itemdelete();
\r
1166 $body = postVar('body');
\r
1167 $title = postVar('title');
\r
1168 $more = postVar('more');
\r
1169 $closed = intPostVar('closed');
\r
1170 $draftid = intPostVar('draftid');
\r
1172 // default action = add now
\r
1174 $actiontype='addnow';
\r
1176 // create new category if needed
\r
1177 if (strstr($catid,'newcat')) {
\r
1179 list($blogid) = sscanf($catid,"newcat-%d");
\r
1182 $blog =& $manager->getBlog($blogid);
\r
1183 $catid = $blog->createNewCategory();
\r
1185 // show error when sth goes wrong
\r
1187 $this->doError(_ERROR_CATCREATEFAIL);
\r
1191 set some variables based on actiontype
\r
1194 draft items -> addnow, addfuture, adddraft, delete
\r
1195 non-draft items -> edit, changedate, delete
\r
1198 $timestamp: set to a nonzero value for future dates or date changes
\r
1199 $wasdraft: set to 1 when the item used to be a draft item
\r
1200 $publish: set to 1 when the edited item is not a draft
\r
1202 /*<del by shizuki>
\r
1203 switch ($actiontype) {
\r
1212 $timestamp = mktime(intPostVar('hour'), intPostVar('minutes'), 0, intPostVar('month'), intPostVar('day'), intPostVar('year'));
\r
1219 case 'changedate':
\r
1220 $timestamp = mktime(intPostVar('hour'), intPostVar('minutes'), 0, intPostVar('month'), intPostVar('day'), intPostVar('year'));
\r
1224 case 'backtodrafts':
\r
1235 </del by shizuki>*/
\r
1236 // <add by shizuki>
\r
1237 $blogid = getBlogIDFromItemID($itemid);
\r
1238 $blog =& $manager->getBlog($blogid);
\r
1240 $wasdrafts = array('adddraft', 'addfuture', 'addnow');
\r
1241 $wasdraft = in_array($actiontype, $wasdrafts) ? 1 : 0;
\r
1242 $publish = ($actiontype != 'adddraft' && $actiontype != 'backtodrafts') ? 1 : 0;
\r
1243 if ($actiontype == 'addfuture' || $actiontype == 'changedate') {
\r
1244 $timestamp = mktime(intPostVar('hour'), intPostVar('minutes'), 0, intPostVar('month'), intPostVar('day'), intPostVar('year'));
\r
1248 $doping = ($publish && $timestamp < $blog->getCorrectTime() && postVar('dosendping')) ? 1 : 0;
\r
1249 // </add by shizuki>
\r
1251 // edit the item for real
\r
1252 ITEM::update($itemid, $catid, $title, $body, $more, $closed, $wasdraft, $publish, $timestamp);
\r
1254 /* <del by shizuki>
\r
1255 $blogid = getBlogIDFromItemID($itemid);
\r
1256 $blog =& $manager->getBlog($blogid);
\r
1259 if ($timestamp > $blog->getCorrectTime(time())) {
\r
1263 </del by shizuki>*/
\r
1264 $this->updateFuturePosted($blogid);
\r
1266 if ($draftid > 0) {
\r
1267 // delete permission is checked inside ITEM::delete()
\r
1268 ITEM::delete($draftid);
\r
1271 // if (!$closed && $publish && $wasdraft && $blog->sendPing() && numberOfEventSubscriber('SendPing') > 0 && !$isFuture) {
\r
1272 if (!$closed && $doping && $blog->sendPing() && numberOfEventSubscriber('SendPing') > 0) { //<mod by shizuki />
\r
1273 $this->action_sendping($blogid);
\r
1277 // show category edit window when we created a new category
\r
1278 // ($catid will then be a new category ID, while postVar('catid') will be 'newcat-x')
\r
1279 if ($catid != intPostVar('catid')) {
\r
1280 $this->action_categoryedit(
\r
1283 $CONF['AdminURL'] . 'index.php?action=itemlist&blogid=' . getBlogIDFromItemID($itemid)
\r
1286 // TODO: set start item correctly for itemlist
\r
1287 $this->action_itemlist(getBlogIDFromItemID($itemid));
\r
1292 * @todo document this
\r
1294 function action_itemdelete() {
\r
1295 global $member, $manager;
\r
1297 $itemid = intRequestVar('itemid');
\r
1299 // only allow if user is allowed to alter item
\r
1300 $member->canAlterItem($itemid) or $this->disallow();
\r
1302 if (!$manager->existsItem($itemid,1,1))
\r
1303 $this->error(_ERROR_NOSUCHITEM);
\r
1305 $item =& $manager->getItem($itemid,1,1);
\r
1306 $title = htmlspecialchars(strip_tags($item['title']));
\r
1307 $body = strip_tags($item['body']);
\r
1308 $body = htmlspecialchars(shorten($body,300,'...'));
\r
1310 $this->pagehead();
\r
1312 <h2><?php echo _DELETE_CONFIRM?></h2>
\r
1314 <p><?php echo _CONFIRMTXT_ITEM?></p>
\r
1316 <div class="note">
\r
1317 <b>"<?php echo $title ?>"</b>
\r
1319 <?php echo $body?>
\r
1322 <form method="post" action="index.php"><div>
\r
1323 <input type="hidden" name="action" value="itemdeleteconfirm" />
\r
1324 <?php $manager->addTicketHidden() ?>
\r
1325 <input type="hidden" name="itemid" value="<?php echo $itemid; ?>" />
\r
1326 <input type="submit" value="<?php echo _DELETE_CONFIRM_BTN?>" tabindex="10" />
\r
1329 $this->pagefoot();
\r
1333 * @todo document this
\r
1335 function action_itemdeleteconfirm() {
\r
1338 $itemid = intRequestVar('itemid');
\r
1340 // only allow if user is allowed to alter item
\r
1341 $member->canAlterItem($itemid) or $this->disallow();
\r
1343 // get blogid first
\r
1344 $blogid = getBlogIdFromItemId($itemid);
\r
1346 // delete item (note: some checks will be performed twice)
\r
1347 $this->deleteOneItem($itemid);
\r
1349 $this->action_itemlist($blogid);
\r
1353 * Deletes one item and returns error if something goes wrong
\r
1354 * @param int $itemid
\r
1356 function deleteOneItem($itemid) {
\r
1357 global $member, $manager;
\r
1359 // only allow if user is allowed to alter item (also checks if itemid exists)
\r
1360 if (!$member->canAlterItem($itemid))
\r
1361 return _ERROR_DISALLOWED;
\r
1363 // need to get blogid before the item is deleted
\r
1364 $blogid = getBlogIDFromItemId($itemid);
\r
1366 $manager->loadClass('ITEM');
\r
1367 ITEM::delete($itemid);
\r
1369 // update blog's futureposted
\r
1370 $this->updateFuturePosted($blogid);
\r
1374 * Update a blog's future posted flag
\r
1375 * @param int $blogid
\r
1377 function updateFuturePosted($blogid) {
\r
1380 $blog =& $manager->getBlog($blogid);
\r
1381 $currenttime = $blog->getCorrectTime(time());
\r
1382 $result = sql_query("SELECT * FROM ".sql_table('item').
\r
1383 " WHERE iblog='".$blogid."' AND iposted=0 AND itime>".mysqldate($currenttime));
\r
1384 if (mysql_num_rows($result) > 0) {
\r
1385 $blog->setFuturePost();
\r
1388 $blog->clearFuturePost();
\r
1393 * @todo document this
\r
1395 function action_itemmove() {
\r
1396 global $member, $manager;
\r
1398 $itemid = intRequestVar('itemid');
\r
1400 // only allow if user is allowed to alter item
\r
1401 $member->canAlterItem($itemid) or $this->disallow();
\r
1403 $item =& $manager->getItem($itemid,1,1);
\r
1405 $this->pagehead();
\r
1407 <h2><?php echo _MOVE_TITLE?></h2>
\r
1408 <form method="post" action="index.php"><div>
\r
1409 <input type="hidden" name="action" value="itemmoveto" />
\r
1410 <input type="hidden" name="itemid" value="<?php echo $itemid; ?>" />
\r
1414 $manager->addTicketHidden();
\r
1415 $this->selectBlogCategory('catid',$item['catid'],10,1);
\r
1418 <input type="submit" value="<?php echo _MOVE_BTN?>" tabindex="10000" onclick="return checkSubmit();" />
\r
1421 $this->pagefoot();
\r
1425 * @todo document this
\r
1427 function action_itemmoveto() {
\r
1428 global $member, $manager;
\r
1430 $itemid = intRequestVar('itemid');
\r
1431 $catid = requestVar('catid');
\r
1433 // create new category if needed
\r
1434 if (strstr($catid,'newcat')) {
\r
1436 list($blogid) = sscanf($catid,'newcat-%d');
\r
1439 $blog =& $manager->getBlog($blogid);
\r
1440 $catid = $blog->createNewCategory();
\r
1442 // show error when sth goes wrong
\r
1444 $this->doError(_ERROR_CATCREATEFAIL);
\r
1447 // only allow if user is allowed to alter item
\r
1448 $member->canUpdateItem($itemid, $catid) or $this->disallow();
\r
1450 $old_blogid = getBlogIDFromItemId($itemid);
\r
1452 ITEM::move($itemid, $catid);
\r
1454 // set the futurePosted flag on the blog
\r
1455 $this->updateFuturePosted(getBlogIDFromItemId($itemid));
\r
1457 // reset the futurePosted in case the item is moved from one blog to another
\r
1458 $this->updateFuturePosted($old_blogid);
\r
1460 if ($catid != intRequestVar('catid'))
\r
1461 $this->action_categoryedit($catid, $blog->getID());
\r
1463 $this->action_itemlist(getBlogIDFromCatID($catid));
\r
1467 * Moves one item to a given category (category existance should be checked by caller)
\r
1468 * errors are returned
\r
1469 * @param int $itemid
\r
1470 * @param int $destCatid category ID to which the item will be moved
\r
1472 function moveOneItem($itemid, $destCatid) {
\r
1475 // only allow if user is allowed to move item
\r
1476 if (!$member->canUpdateItem($itemid, $destCatid))
\r
1477 return _ERROR_DISALLOWED;
\r
1479 ITEM::move($itemid, $destCatid);
\r
1483 * Adds a item to the chosen blog
\r
1485 function action_additem() {
\r
1486 global $member, $manager, $CONF;
\r
1488 $manager->loadClass('ITEM');
\r
1490 $result = ITEM::createFromRequest();
\r
1492 if ($result['status'] == 'error')
\r
1493 $this->error($result['message']);
\r
1495 $blogid = getBlogIDFromItemID($result['itemid']);
\r
1496 $blog =& $manager->getBlog($blogid);
\r
1497 /* <del by shizuki>
\r
1498 $pingUrl = $manager->addTicketToUrl($CONF['AdminURL'] . 'index.php?action=sendping&blogid=' . intval($blogid));
\r
1500 if ($result['status'] == 'newcategory')
\r
1501 $this->action_categoryedit(
\r
1504 $blog->sendPing() && numberOfEventSubscriber('SendPing') > 0 ? $pingUrl : ''
\r
1506 elseif ((postVar('actiontype') == 'addnow') && $blog->sendPing() && numberOfEventSubscriber('SendPing') > 0)
\r
1507 $this->action_sendping($blogid);
\r
1509 $this->action_itemlist($blogid);
\r
1510 </del by shizuki>*/
\r
1511 // <add by shizuki>
\r
1512 $btimestamp = $blog->getCorrectTime();
\r
1513 $bPingInfo = ($blog->sendPing() && numberOfEventSubscriber('SendPing') > 0);
\r
1514 $item = $manager->getItem(intval($result['itemid']), 1, 1);
\r
1515 $iPingInfo = (!$item['draft'] && postVar('dosendping') && $item['timestamp'] <= $btimestamp);
\r
1516 if ($iPingInfo && $bPingInfo) {
\r
1517 $nextAction = 'sendping';
\r
1519 $nextAction = 'itemlist';
\r
1521 if ($result['status'] == 'newcategory') {
\r
1522 // $distURI = ($nextAction == 'sendping') ? $manager->addTicketToUrl($CONF['AdminURL'] . 'index.php?action='
\r
1523 // . $nextAction . '&blogid=' . intval($blogid)) :
\r
1525 $distURI = $manager->addTicketToUrl($CONF['AdminURL'] . 'index.php?action=' . $nextAction . '&blogid=' . intval($blogid));
\r
1526 $this->action_categoryedit($result['catid'], $blogid, $distURI);
\r
1528 $methodName = 'action_' . $nextAction;
\r
1529 call_user_func(array(&$this, $methodName), $blogid);
\r
1531 //</add by shizuki>
\r
1535 * Shows a window that says we're about to ping.
\r
1536 * immediately refresh to the real pinging page, which will
\r
1537 * show an error, or redirect to the blog.
\r
1539 * @param int $blogid ID of blog for which ping needs to be sent out
\r
1541 function action_sendping($blogid = -1) {
\r
1542 global $member, $manager;
\r
1544 if ($blogid == -1)
\r
1545 $blogid = intRequestVar('blogid');
\r
1547 $member->isLoggedIn() or $this->disallow();
\r
1549 $rawPingUrl = $manager->addTicketToUrl('index.php?action=rawping&blogid=' . intval($blogid));
\r
1551 $this->pagehead('<meta http-equiv="refresh" content="1; url='.htmlspecialchars($rawPingUrl).'" />');
\r
1552 echo _UPDATEDPING_MESSAGE;
\r
1554 <a href="index.php?action=rawping&blogid=<?php echo $blogid?>"><?php echo _UPDATEDPING_GOPINGPAGE ?></a>
\r
1557 $this->pagefoot();
\r
1561 * Sends the real ping (can take up to 10 seconds!)
\r
1563 function action_rawping() {
\r
1567 $blogid = intRequestVar('blogid');
\r
1568 $blog =& $manager->getBlog($blogid);
\r
1570 $this->pagehead();
\r
1574 <h2><?php echo _UPDATEDPING_PINGING ?></h2>
\r
1575 <div class='note'>
\r
1578 // send sendPing event
\r
1579 $manager->notify('SendPing', array('blogid' => $blogid));
\r
1585 <li><a href="index.php?action=itemlist&blogid=<?php echo $blog->getID()?>"><?php echo _UPDATEDPING_VIEWITEM . htmlspecialchars($blog->getName())?></a></li>
\r
1586 <li><a href="<?php echo $blog->getURL()?>"><?php echo _UPDATEDPING_VISITOWNSITE ?></a></li>
\r
1589 <?php $this->pagefoot();
\r
1593 * Allows to edit previously made comments
\r
1595 function action_commentedit() {
\r
1596 global $member, $manager;
\r
1598 $commentid = intRequestVar('commentid');
\r
1600 $member->canAlterComment($commentid) or $this->disallow();
\r
1602 $comment = COMMENT::getComment($commentid);
\r
1604 $manager->notify('PrepareCommentForEdit',array('comment' => &$comment));
\r
1606 // change <br /> to \n
\r
1607 $comment['body'] = str_replace('<br />','',$comment['body']);
\r
1609 $comment['body'] = eregi_replace("<a href=['\"]([^'\"]+)['\"]( rel=\"nofollow\")?>[^<]*</a>","\\1",$comment['body']);
\r
1611 $this->pagehead();
\r
1614 <h2><?php echo _EDITC_TITLE?></h2>
\r
1616 <form action="index.php" method="post"><div>
\r
1618 <input type="hidden" name="action" value="commentupdate" />
\r
1619 <?php $manager->addTicketHidden(); ?>
\r
1620 <input type="hidden" name="commentid" value="<?php echo $commentid; ?>" />
\r
1622 <th colspan="2"><?php echo _EDITC_TITLE?></th>
\r
1624 <td><?php echo _EDITC_WHO?></td>
\r
1626 <?php if ($comment['member'])
\r
1627 echo $comment['member'] . " (" . _EDITC_MEMBER . ")";
\r
1629 echo $comment['user'] . " (" . _EDITC_NONMEMBER . ")";
\r
1633 <td><?php echo _EDITC_WHEN?></td>
\r
1634 <td><?php echo date("Y-m-d @ H:i",$comment['timestamp']); ?></td>
\r
1636 <td><?php echo _EDITC_HOST?></td>
\r
1637 <td><?php echo $comment['host']; ?></td>
\r
1640 <td><?php echo _EDITC_URL; ?></td>
\r
1641 <td><input type="text" name="url" size="30" tabindex="6" value="<?php echo $comment['userid']; ?>" /></td>
\r
1644 <td><?php echo _EDITC_EMAIL; ?></td>
\r
1645 <td><input type="text" name="email" size="30" tabindex="8" value="<?php echo $comment['email']; ?>" /></td>
\r
1648 <td><?php echo _EDITC_TEXT?></td>
\r
1650 <textarea name="body" tabindex="10" rows="10" cols="50"><?php // htmlspecialchars not needed (things should be escaped already)
\r
1651 echo $comment['body'];
\r
1655 <td><?php echo _EDITC_EDIT?></td>
\r
1656 <td><input type="submit" tabindex="20" value="<?php echo _EDITC_EDIT?>" onclick="return checkSubmit();" /></td>
\r
1661 $this->pagefoot();
\r
1665 * @todo document this
\r
1667 function action_commentupdate() {
\r
1668 global $member, $manager;
\r
1670 $commentid = intRequestVar('commentid');
\r
1672 $member->canAlterComment($commentid) or $this->disallow();
\r
1674 $url = postVar('url');
\r
1675 $email = postVar('email');
\r
1676 $body = postVar('body');
\r
1678 // intercept words that are too long
\r
1679 if (eregi("[a-zA-Z0-9|\.,;:!\?=\/\\]{90,90}",$body) != false)
\r
1680 $this->error(_ERROR_COMMENT_LONGWORD);
\r
1683 if (strlen($body)<3)
\r
1684 $this->error(_ERROR_COMMENT_NOCOMMENT);
\r
1685 if (strlen($body)>5000)
\r
1686 $this->error(_ERROR_COMMENT_TOOLONG);
\r
1690 $body = COMMENT::prepareBody($body);
\r
1693 $manager->notify('PreUpdateComment',array('body' => &$body));
\r
1695 $query = 'UPDATE '.sql_table('comment')
\r
1696 . " SET cmail = '" . addslashes($url) . "', cemail = '" . addslashes($email) . "', cbody = '" . addslashes($body) . "'"
\r
1697 . " WHERE cnumber=" . $commentid;
\r
1698 sql_query($query);
\r
1701 $res = sql_query('SELECT citem FROM '.sql_table('comment').' WHERE cnumber=' . $commentid);
\r
1702 $o = mysql_fetch_object($res);
\r
1703 $itemid = $o->citem;
\r
1705 if ($member->canAlterItem($itemid))
\r
1706 $this->action_itemcommentlist($itemid);
\r
1708 $this->action_browseowncomments();
\r
1713 * @todo document this
\r
1715 function action_commentdelete() {
\r
1716 global $member, $manager;
\r
1718 $commentid = intRequestVar('commentid');
\r
1720 $member->canAlterComment($commentid) or $this->disallow();
\r
1722 $comment = COMMENT::getComment($commentid);
\r
1724 $body = strip_tags($comment['body']);
\r
1725 $body = htmlspecialchars(shorten($body, 300, '...'));
\r
1727 if ($comment['member'])
\r
1728 $author = $comment['member'];
\r
1730 $author = $comment['user'];
\r
1732 $this->pagehead();
\r
1735 <h2><?php echo _DELETE_CONFIRM?></h2>
\r
1737 <p><?php echo _CONFIRMTXT_COMMENT?></p>
\r
1739 <div class="note">
\r
1740 <b><?php echo _EDITC_WHO?>:</b> <?php echo $author ?>
\r
1742 <b><?php echo _EDITC_TEXT?>:</b> <?php echo $body ?>
\r
1745 <form method="post" action="index.php"><div>
\r
1746 <input type="hidden" name="action" value="commentdeleteconfirm" />
\r
1747 <?php $manager->addTicketHidden() ?>
\r
1748 <input type="hidden" name="commentid" value="<?php echo $commentid; ?>" />
\r
1749 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
\r
1752 $this->pagefoot();
\r
1756 * @todo document this
\r
1758 function action_commentdeleteconfirm() {
\r
1761 $commentid = intRequestVar('commentid');
\r
1763 // get item id first
\r
1764 $res = sql_query('SELECT citem FROM '.sql_table('comment') .' WHERE cnumber=' . $commentid);
\r
1765 $o = mysql_fetch_object($res);
\r
1766 $itemid = $o->citem;
\r
1768 $error = $this->deleteOneComment($commentid);
\r
1770 $this->doError($error);
\r
1772 if ($member->canAlterItem($itemid))
\r
1773 $this->action_itemcommentlist($itemid);
\r
1775 $this->action_browseowncomments();
\r
1779 * @todo document this
\r
1781 function deleteOneComment($commentid) {
\r
1782 global $member, $manager;
\r
1784 $commentid = intval($commentid);
\r
1786 if (!$member->canAlterComment($commentid))
\r
1787 return _ERROR_DISALLOWED;
\r
1789 $manager->notify('PreDeleteComment', array('commentid' => $commentid));
\r
1791 // delete the comments associated with the item
\r
1792 $query = 'DELETE FROM '.sql_table('comment').' WHERE cnumber=' . $commentid;
\r
1793 sql_query($query);
\r
1795 $manager->notify('PostDeleteComment', array('commentid' => $commentid));
\r
1801 * Usermanagement main
\r
1803 function action_usermanagement() {
\r
1804 global $member, $manager;
\r
1806 // check if allowed
\r
1807 $member->isAdmin() or $this->disallow();
\r
1809 $this->pagehead();
\r
1811 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
\r
1813 echo '<h2>' . _MEMBERS_TITLE .'</h2>';
\r
1815 echo '<h3>' . _MEMBERS_CURRENT .'</h3>';
\r
1817 // show list of members with actions
\r
1818 $query = 'SELECT *'
\r
1819 . ' FROM '.sql_table('member');
\r
1820 $template['content'] = 'memberlist';
\r
1821 $template['tabindex'] = 10;
\r
1823 $manager->loadClass("ENCAPSULATE");
\r
1824 $batch =& new BATCH('member');
\r
1825 $batch->showlist($query,'table',$template);
\r
1827 echo '<h3>' . _MEMBERS_NEW .'</h3>';
\r
1829 <form method="post" action="index.php" name="memberedit"><div>
\r
1831 <input type="hidden" name="action" value="memberadd" />
\r
1832 <?php $manager->addTicketHidden() ?>
\r
1836 <th colspan="2"><?php echo _MEMBERS_NEW?></th>
\r
1838 <td><?php echo _MEMBERS_DISPLAY?> <?php help('shortnames');?>
\r
1839 <br /><small><?php echo _MEMBERS_DISPLAY_INFO?></small>
\r
1841 <td><input tabindex="10010" name="name" size="16" maxlength="16" /></td>
\r
1843 <td><?php echo _MEMBERS_REALNAME?></td>
\r
1844 <td><input name="realname" tabindex="10020" size="40" maxlength="60" /></td>
\r
1846 <td><?php echo _MEMBERS_PWD?></td>
\r
1847 <td><input name="password" tabindex="10030" size="16" maxlength="40" type="password" /></td>
\r
1849 <td><?php echo _MEMBERS_REPPWD?></td>
\r
1850 <td><input name="repeatpassword" tabindex="10035" size="16" maxlength="40" type="password" /></td>
\r
1852 <td><?php echo _MEMBERS_EMAIL?></td>
\r
1853 <td><input name="email" tabindex="10040" size="40" maxlength="60" /></td>
\r
1855 <td><?php echo _MEMBERS_URL?></td>
\r
1856 <td><input name="url" tabindex="10050" size="40" maxlength="100" /></td>
\r
1858 <td><?php echo _MEMBERS_SUPERADMIN?> <?php help('superadmin'); ?></td>
\r
1859 <td><?php $this->input_yesno('admin',0,10060); ?> </td>
\r
1861 <td><?php echo _MEMBERS_CANLOGIN?> <?php help('canlogin'); ?></td>
\r
1862 <td><?php $this->input_yesno('canlogin',1,10070); ?></td>
\r
1864 <td><?php echo _MEMBERS_NOTES?></td>
\r
1865 <td><input name="notes" maxlength="100" size="40" tabindex="10080" /></td>
\r
1867 <td><?php echo _MEMBERS_NEW?></td>
\r
1868 <td><input type="submit" value="<?php echo _MEMBERS_NEW_BTN?>" tabindex="10090" onclick="return checkSubmit();" /></td>
\r
1873 $this->pagefoot();
\r
1877 * Edit member settings
\r
1879 function action_memberedit() {
\r
1880 $this->action_editmembersettings(intRequestVar('memberid'));
\r
1884 * @todo document this
\r
1886 function action_editmembersettings($memberid = '') {
\r
1887 global $member, $manager, $CONF;
\r
1889 if ($memberid == '')
\r
1890 $memberid = $member->getID();
\r
1892 // check if allowed
\r
1893 ($member->getID() == $memberid) or $member->isAdmin() or $this->disallow();
\r
1895 $extrahead = '<script type="text/javascript" src="javascript/numbercheck.js"></script>';
\r
1896 $this->pagehead($extrahead);
\r
1898 // show message to go back to member overview (only for admins)
\r
1899 if ($member->isAdmin())
\r
1900 echo '<a href="index.php?action=usermanagement">(' ._MEMBERS_BACKTOOVERVIEW. ')</a>';
\r
1902 echo '<a href="index.php?action=overview">(' ._BACKHOME. ')</a>';
\r
1904 echo '<h2>' . _MEMBERS_EDIT . '</h2>';
\r
1906 $mem = MEMBER::createFromID($memberid);
\r
1909 <form method="post" action="index.php" name="memberedit"><div>
\r
1911 <input type="hidden" name="action" value="changemembersettings" />
\r
1912 <input type="hidden" name="memberid" value="<?php echo $memberid; ?>" />
\r
1913 <?php $manager->addTicketHidden() ?>
\r
1916 <th colspan="2"><?php echo _MEMBERS_EDIT?></th>
\r
1918 <td><?php echo _MEMBERS_DISPLAY?> <?php help('shortnames');?>
\r
1919 <br /><small><?php echo _MEMBERS_DISPLAY_INFO?></small>
\r
1922 <?php if ($CONF['AllowLoginEdit'] || $member->isAdmin()) { ?>
\r
1923 <input name="name" tabindex="10" maxlength="16" size="16" value="<?php echo htmlspecialchars($mem->getDisplayName()); ?>" />
\r
1925 echo htmlspecialchars($member->getDisplayName());
\r
1930 <td><?php echo _MEMBERS_REALNAME?></td>
\r
1931 <td><input name="realname" tabindex="20" maxlength="60" size="40" value="<?php echo htmlspecialchars($mem->getRealName()); ?>" /></td>
\r
1933 <?php if ($CONF['AllowLoginEdit'] || $member->isAdmin()) { ?>
\r
1934 <td><?php echo _MEMBERS_PWD?></td>
\r
1935 <td><input type="password" tabindex="30" maxlength="40" size="16" name="password" /></td>
\r
1937 <td><?php echo _MEMBERS_REPPWD?></td>
\r
1938 <td><input type="password" tabindex="35" maxlength="40" size="16" name="repeatpassword" /></td>
\r
1941 <td><?php echo _MEMBERS_EMAIL?>
\r
1942 <br /><small><?php echo _MEMBERS_EMAIL_EDIT?></small>
\r
1944 <td><input name="email" tabindex="40" size="40" maxlength="60" value="<?php echo htmlspecialchars($mem->getEmail()); ?>" /></td>
\r
1946 <td><?php echo _MEMBERS_URL?></td>
\r
1947 <td><input name="url" tabindex="50" size="40" maxlength="100" value="<?php echo htmlspecialchars($mem->getURL()); ?>" /></td>
\r
1948 <?php // only allow to change this by super-admins
\r
1949 // we don't want normal users to 'upgrade' themselves to super-admins, do we? ;-)
\r
1950 if ($member->isAdmin()) {
\r
1953 <td><?php echo _MEMBERS_SUPERADMIN?> <?php help('superadmin'); ?></td>
\r
1954 <td><?php $this->input_yesno('admin',$mem->isAdmin(),60); ?></td>
\r
1956 <td><?php echo _MEMBERS_CANLOGIN?> <?php help('canlogin'); ?></td>
\r
1957 <td><?php $this->input_yesno('canlogin',$mem->canLogin(),70,1,0,_YES,_NO,$mem->isAdmin()); ?></td>
\r
1960 <td><?php echo _MEMBERS_NOTES?></td>
\r
1961 <td><input name="notes" tabindex="80" size="40" maxlength="100" value="<?php echo htmlspecialchars($mem->getNotes()); ?>" /></td>
\r
1963 <td><?php echo _MEMBERS_DEFLANG?> <?php help('language'); ?>
\r
1967 <select name="deflang" tabindex="85">
\r
1968 <option value=""><?php echo _MEMBERS_USESITELANG?></option>
\r
1969 <?php // show a dropdown list of all available languages
\r
1971 $dirhandle = opendir($DIR_LANG);
\r
1972 while ($filename = readdir($dirhandle)) {
\r
1973 if (ereg("^(.*)\.php$",$filename,$matches)) {
\r
1974 $name = $matches[1];
\r
1975 echo "<option value='$name'";
\r
1976 if ($name == $mem->getLanguage())
\r
1977 echo " selected='selected'";
\r
1978 echo ">$name</option>";
\r
1981 closedir($dirhandle);
\r
1989 <td><?php echo _MEMBERS_USEAUTOSAVE?> <?php help('autosave'); ?></td>
\r
1990 <td><?php $this->input_yesno('autosave', $mem->getAutosave(), 87); ?></td>
\r
1994 $this->_insertPluginOptions('member',$memberid);
\r
1997 <th colspan="2"><?php echo _MEMBERS_EDIT ?></th>
\r
1999 <td><?php echo _MEMBERS_EDIT?></td>
\r
2000 <td><input type="submit" tabindex="90" value="<?php echo _MEMBERS_EDIT_BTN?>" onclick="return checkSubmit();" /></td>
\r
2006 echo '<h3>',_PLUGINS_EXTRA,'</h3>';
\r
2009 'MemberSettingsFormExtras',
\r
2015 $this->pagefoot();
\r
2019 * @todo document this
\r
2021 function action_changemembersettings() {
\r
2022 global $member, $CONF, $manager;
\r
2024 $memberid = intRequestVar('memberid');
\r
2026 // check if allowed
\r
2027 ($member->getID() == $memberid) or $member->isAdmin() or $this->disallow();
\r
2029 $name = trim(strip_tags(postVar('name')));
\r
2030 $realname = trim(strip_tags(postVar('realname')));
\r
2031 $password = postVar('password');
\r
2032 $repeatpassword = postVar('repeatpassword');
\r
2033 $email = strip_tags(postVar('email'));
\r
2034 $url = strip_tags(postVar('url'));
\r
2036 // Sometimes user didn't prefix the URL with http://, this cause a malformed URL. Let's fix it.
\r
2037 if (!eregi("^https?://", $url))
\r
2038 $url = "http://".$url;
\r
2040 $admin = postVar('admin');
\r
2041 $canlogin = postVar('canlogin');
\r
2042 $notes = strip_tags(postVar('notes'));
\r
2043 $deflang = postVar('deflang');
\r
2045 $mem = MEMBER::createFromID($memberid);
\r
2047 if ($CONF['AllowLoginEdit'] || $member->isAdmin()) {
\r
2049 if (!isValidDisplayName($name))
\r
2050 $this->error(_ERROR_BADNAME);
\r
2052 if (($name != $mem->getDisplayName()) && MEMBER::exists($name))
\r
2053 $this->error(_ERROR_NICKNAMEINUSE);
\r
2055 if ($password != $repeatpassword)
\r
2056 $this->error(_ERROR_PASSWORDMISMATCH);
\r
2058 if ($password && (strlen($password) < 6))
\r
2059 $this->error(_ERROR_PASSWORDTOOSHORT);
\r
2062 if (!isValidMailAddress($email))
\r
2063 $this->error(_ERROR_BADMAILADDRESS);
\r
2067 $this->error(_ERROR_REALNAMEMISSING);
\r
2069 if (($deflang != '') && (!checkLanguage($deflang)))
\r
2070 $this->error(_ERROR_NOSUCHLANGUAGE);
\r
2072 // check if there will remain at least one site member with both the logon and admin rights
\r
2073 // (check occurs when taking away one of these rights from such a member)
\r
2074 if ( (!$admin && $mem->isAdmin() && $mem->canLogin())
\r
2075 || (!$canlogin && $mem->isAdmin() && $mem->canLogin())
\r
2078 $r = sql_query('SELECT * FROM '.sql_table('member').' WHERE madmin=1 and mcanlogin=1');
\r
2079 if (mysql_num_rows($r) < 2)
\r
2080 $this->error(_ERROR_ATLEASTONEADMIN);
\r
2083 if ($CONF['AllowLoginEdit'] || $member->isAdmin()) {
\r
2084 $mem->setDisplayName($name);
\r
2086 $mem->setPassword($password);
\r
2089 $oldEmail = $mem->getEmail();
\r
2091 $mem->setRealName($realname);
\r
2092 $mem->setEmail($email);
\r
2093 $mem->setURL($url);
\r
2094 $mem->setNotes($notes);
\r
2095 $mem->setLanguage($deflang);
\r
2098 // only allow super-admins to make changes to the admin status
\r
2099 if ($member->isAdmin()) {
\r
2100 $mem->setAdmin($admin);
\r
2101 $mem->setCanLogin($canlogin);
\r
2104 $autosave = postVar ('autosave');
\r
2105 $mem->setAutosave($autosave);
\r
2109 // store plugin options
\r
2110 $aOptions = requestArray('plugoption');
\r
2111 NucleusPlugin::_applyPluginOptions($aOptions);
\r
2112 $manager->notify('PostPluginOptionsUpdate',array('context' => 'member', 'memberid' => $memberid, 'member' => &$mem));
\r
2114 // if email changed, generate new password
\r
2115 if ($oldEmail != $mem->getEmail())
\r
2117 $mem->sendActivationLink('addresschange', $oldEmail);
\r
2119 $mem->newCookieKey();
\r
2121 // only log out if the member being edited is the current member.
\r
2122 if ($member->getID() == $memberid)
\r
2123 $member->logout();
\r
2124 $this->action_login(_MSG_ACTIVATION_SENT, 0);
\r
2129 if ( ( $mem->getID() == $member->getID() )
\r
2130 && ( $mem->getDisplayName() != $member->getDisplayName() )
\r
2132 $mem->newCookieKey();
\r
2133 $member->logout();
\r
2134 $this->action_login(_MSG_LOGINAGAIN, 0);
\r
2136 $this->action_overview(_MSG_SETTINGSCHANGED);
\r
2141 * @todo document this
\r
2143 function action_memberadd() {
\r
2144 global $member, $manager;
\r
2146 // check if allowed
\r
2147 $member->isAdmin() or $this->disallow();
\r
2149 if (postVar('password') != postVar('repeatpassword'))
\r
2150 $this->error(_ERROR_PASSWORDMISMATCH);
\r
2151 if (strlen(postVar('password')) < 6)
\r
2152 $this->error(_ERROR_PASSWORDTOOSHORT);
\r
2154 $res = MEMBER::create(postVar('name'), postVar('realname'), postVar('password'), postVar('email'), postVar('url'), postVar('admin'), postVar('canlogin'), postVar('notes'));
\r
2156 $this->error($res);
\r
2158 // fire PostRegister event
\r
2159 $newmem = new MEMBER();
\r
2160 $newmem->readFromName(postVar('name'));
\r
2161 $manager->notify('PostRegister',array('member' => &$newmem));
\r
2163 $this->action_usermanagement();
\r
2167 * Account activation
\r
2171 function action_activate() {
\r
2173 $key = getVar('key');
\r
2174 $this->_showActivationPage($key);
\r
2178 * @todo document this
\r
2180 function _showActivationPage($key, $message = '')
\r
2184 // clean up old activation keys
\r
2185 MEMBER::cleanupActivationTable();
\r
2187 // get activation info
\r
2188 $info = MEMBER::getActivationInfo($key);
\r
2191 $this->error(_ERROR_ACTIVATE);
\r
2193 $mem = MEMBER::createFromId($info->vmember);
\r
2196 $this->error(_ERROR_ACTIVATE);
\r
2200 $bNeedsPasswordChange = true;
\r
2202 switch ($info->vtype)
\r
2205 $title = _ACTIVATE_FORGOT_TITLE;
\r
2206 $text = _ACTIVATE_FORGOT_TEXT;
\r
2209 $title = _ACTIVATE_REGISTER_TITLE;
\r
2210 $text = _ACTIVATE_REGISTER_TEXT;
\r
2212 case 'addresschange':
\r
2213 $title = _ACTIVATE_CHANGE_TITLE;
\r
2214 $text = _ACTIVATE_CHANGE_TEXT;
\r
2215 $bNeedsPasswordChange = false;
\r
2216 MEMBER::activate($key);
\r
2221 'memberName' => htmlspecialchars($mem->getDisplayName())
\r
2223 $title = TEMPLATE::fill($title, $aVars);
\r
2224 $text = TEMPLATE::fill($text, $aVars);
\r
2226 $this->pagehead();
\r
2228 echo '<h2>' , $title, '</h2>';
\r
2229 echo '<p>' , $text, '</p>';
\r
2231 if ($message != '')
\r
2233 echo '<p class="error">',$message,'</p>';
\r
2236 if ($bNeedsPasswordChange)
\r
2239 <div><form action="index.php" method="post">
\r
2241 <input type="hidden" name="action" value="activatesetpwd" />
\r
2242 <?php $manager->addTicketHidden() ?>
\r
2243 <input type="hidden" name="key" value="<?php echo htmlspecialchars($key) ?>" />
\r
2246 <td><?php echo _MEMBERS_PWD?></td>
\r
2247 <td><input type="password" maxlength="40" size="16" name="password" /></td>
\r
2249 <td><?php echo _MEMBERS_REPPWD?></td>
\r
2250 <td><input type="password" maxlength="40" size="16" name="repeatpassword" /></td>
\r
2254 $manager->notify('FormExtra', array('type' => 'activation', 'member' => $mem));
\r
2258 <td><?php echo _MEMBERS_SETPWD ?></td>
\r
2259 <td><input type='submit' value='<?php echo _MEMBERS_SETPWD_BTN ?>' /></td>
\r
2269 $this->pagefoot();
\r
2274 * Account activation - set password part
\r
2278 function action_activatesetpwd() {
\r
2280 $key = postVar('key');
\r
2282 // clean up old activation keys
\r
2283 MEMBER::cleanupActivationTable();
\r
2285 // get activation info
\r
2286 $info = MEMBER::getActivationInfo($key);
\r
2288 if (!$info || ($info->type == 'addresschange'))
\r
2289 return $this->_showActivationPage($key, _ERROR_ACTIVATE);
\r
2291 $mem = MEMBER::createFromId($info->vmember);
\r
2294 return $this->_showActivationPage($key, _ERROR_ACTIVATE);
\r
2296 $password = postVar('password');
\r
2297 $repeatpassword = postVar('repeatpassword');
\r
2299 if ($password != $repeatpassword)
\r
2300 return $this->_showActivationPage($key, _ERROR_PASSWORDMISMATCH);
\r
2302 if ($password && (strlen($password) < 6))
\r
2303 return $this->_showActivationPage($key, _ERROR_PASSWORDTOOSHORT);
\r
2307 $manager->notify('ValidateForm', array('type' => 'activation', 'member' => $mem, 'error' => &$error));
\r
2309 return $this->_showActivationPage($key, $error);
\r
2313 $mem->setPassword($password);
\r
2316 // do the activation
\r
2317 MEMBER::activate($key);
\r
2319 $this->pagehead();
\r
2320 echo '<h2>',_ACTIVATE_SUCCESS_TITLE,'</h2>';
\r
2321 echo '<p>',_ACTIVATE_SUCCESS_TEXT,'</p>';
\r
2322 $this->pagefoot();
\r
2328 function action_manageteam() {
\r
2329 global $member, $manager;
\r
2331 $blogid = intRequestVar('blogid');
\r
2333 // check if allowed
\r
2334 $member->blogAdminRights($blogid) or $this->disallow();
\r
2336 $this->pagehead();
\r
2338 echo "<p><a href='index.php?action=blogsettings&blogid=$blogid'>(",_BACK_TO_BLOGSETTINGS,")</a></p>";
\r
2340 echo '<h2>' . _TEAM_TITLE . getBlogNameFromID($blogid) . '</h2>';
\r
2342 echo '<h3>' . _TEAM_CURRENT . '</h3>';
\r
2346 $query = 'SELECT tblog, tmember, mname, mrealname, memail, tadmin'
\r
2347 . ' FROM '.sql_table('member').', '.sql_table('team')
\r
2348 . ' WHERE tmember=mnumber and tblog=' . $blogid;
\r
2350 $template['content'] = 'teamlist';
\r
2351 $template['tabindex'] = 10;
\r
2353 $manager->loadClass("ENCAPSULATE");
\r
2354 $batch =& new BATCH('team');
\r
2355 $batch->showlist($query, 'table', $template);
\r
2358 <h3><?php echo _TEAM_ADDNEW?></h3>
\r
2360 <form method='post' action='index.php'><div>
\r
2362 <input type='hidden' name='action' value='teamaddmember' />
\r
2363 <input type='hidden' name='blogid' value='<?php echo $blogid; ?>' />
\r
2364 <?php $manager->addTicketHidden() ?>
\r
2367 <td><?php echo _TEAM_CHOOSEMEMBER?></td>
\r
2368 <td><?php // TODO: try to make it so only non-team-members are listed
\r
2369 $query = 'SELECT mname as text, mnumber as value'
\r
2370 . ' FROM '.sql_table('member');
\r
2372 $template['name'] = 'memberid';
\r
2373 $template['tabindex'] = 10000;
\r
2374 showlist($query,'select',$template);
\r
2377 <td><?php echo _TEAM_ADMIN?><?php help('teamadmin'); ?></td>
\r
2378 <td><?php $this->input_yesno('admin',0,10020); ?></td>
\r
2380 <td><?php echo _TEAM_ADD?></td>
\r
2381 <td><input type='submit' value='<?php echo _TEAM_ADD_BTN?>' tabindex="10030" /></td>
\r
2386 $this->pagefoot();
\r
2390 * Add member to team
\r
2392 function action_teamaddmember() {
\r
2393 global $member, $manager;
\r
2395 $memberid = intPostVar('memberid');
\r
2396 $blogid = intPostVar('blogid');
\r
2397 $admin = intPostVar('admin');
\r
2399 // check if allowed
\r
2400 $member->blogAdminRights($blogid) or $this->disallow();
\r
2402 $blog =& $manager->getBlog($blogid);
\r
2403 if (!$blog->addTeamMember($memberid, $admin))
\r
2404 $this->error(_ERROR_ALREADYONTEAM);
\r
2406 $this->action_manageteam();
\r
2411 * @todo document this
\r
2413 function action_teamdelete() {
\r
2414 global $member, $manager;
\r
2416 $memberid = intRequestVar('memberid');
\r
2417 $blogid = intRequestVar('blogid');
\r
2419 // check if allowed
\r
2420 $member->blogAdminRights($blogid) or $this->disallow();
\r
2422 $teammem = MEMBER::createFromID($memberid);
\r
2423 $blog =& $manager->getBlog($blogid);
\r
2425 $this->pagehead();
\r
2427 <h2><?php echo _DELETE_CONFIRM?></h2>
\r
2429 <p><?php echo _CONFIRMTXT_TEAM1?><b><?php echo htmlspecialchars($teammem->getDisplayName()) ?></b><?php echo _CONFIRMTXT_TEAM2?><b><?php echo htmlspecialchars(strip_tags($blog->getName())) ?></b>
\r
2433 <form method="post" action="index.php"><div>
\r
2434 <input type="hidden" name="action" value="teamdeleteconfirm" />
\r
2435 <?php $manager->addTicketHidden() ?>
\r
2436 <input type="hidden" name="memberid" value="<?php echo $memberid; ?>" />
\r
2437 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
\r
2438 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
\r
2441 $this->pagefoot();
\r
2445 * @todo document this
\r
2447 function action_teamdeleteconfirm() {
\r
2450 $memberid = intRequestVar('memberid');
\r
2451 $blogid = intRequestVar('blogid');
\r
2453 $error = $this->deleteOneTeamMember($blogid, $memberid);
\r
2455 $this->error($error);
\r
2458 $this->action_manageteam();
\r
2462 * @todo document this
\r
2464 function deleteOneTeamMember($blogid, $memberid) {
\r
2465 global $member, $manager;
\r
2467 $blogid = intval($blogid);
\r
2468 $memberid = intval($memberid);
\r
2470 // check if allowed
\r
2471 if (!$member->blogAdminRights($blogid))
\r
2472 return _ERROR_DISALLOWED;
\r
2474 // check if: - there remains at least one blog admin
\r
2475 // - (there remains at least one team member)
\r
2476 $tmem = MEMBER::createFromID($memberid);
\r
2478 $manager->notify('PreDeleteTeamMember', array('member' => &$tmem, 'blogid' => $blogid));
\r
2480 if ($tmem->isBlogAdmin($blogid)) {
\r
2481 // check if there are more blog members left and at least one admin
\r
2482 // (check for at least two admins before deletion)
\r
2483 $query = 'SELECT * FROM '.sql_table('team') . ' WHERE tblog='.$blogid.' and tadmin=1';
\r
2484 $r = sql_query($query);
\r
2485 if (mysql_num_rows($r) < 2)
\r
2486 return _ERROR_ATLEASTONEBLOGADMIN;
\r
2489 $query = 'DELETE FROM '.sql_table('team')." WHERE tblog=$blogid and tmember=$memberid";
\r
2490 sql_query($query);
\r
2492 $manager->notify('PostDeleteTeamMember', array('member' => &$tmem, 'blogid' => $blogid));
\r
2498 * @todo document this
\r
2500 function action_teamchangeadmin() {
\r
2503 $blogid = intRequestVar('blogid');
\r
2504 $memberid = intRequestVar('memberid');
\r
2506 // check if allowed
\r
2507 $member->blogAdminRights($blogid) or $this->disallow();
\r
2509 $mem = MEMBER::createFromID($memberid);
\r
2511 // don't allow when there is only one admin at this moment
\r
2512 if ($mem->isBlogAdmin($blogid)) {
\r
2513 $r = sql_query('SELECT * FROM '.sql_table('team') . " WHERE tblog=$blogid and tadmin=1");
\r
2514 if (mysql_num_rows($r) == 1)
\r
2515 $this->error(_ERROR_ATLEASTONEBLOGADMIN);
\r
2518 if ($mem->isBlogAdmin($blogid))
\r
2523 $query = 'UPDATE '.sql_table('team') ." SET tadmin=$newval WHERE tblog=$blogid and tmember=$memberid";
\r
2524 sql_query($query);
\r
2526 // only show manageteam if member did not change its own admin privileges
\r
2527 if ($member->isBlogAdmin($blogid))
\r
2528 $this->action_manageteam();
\r
2530 $this->action_overview(_MSG_ADMINCHANGED);
\r
2534 * @todo document this
\r
2536 function action_blogsettings() {
\r
2537 global $member, $manager;
\r
2539 $blogid = intRequestVar('blogid');
\r
2541 // check if allowed
\r
2542 $member->blogAdminRights($blogid) or $this->disallow();
\r
2544 $blog =& $manager->getBlog($blogid);
\r
2546 $extrahead = '<script type="text/javascript" src="javascript/numbercheck.js"></script>';
\r
2547 $this->pagehead($extrahead);
\r
2549 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
\r
2551 <h2><?php echo _EBLOG_TITLE?>: '<?php echo $this->bloglink($blog)?>'</h2>
\r
2553 <h3><?php echo _EBLOG_TEAM_TITLE?></h3>
\r
2555 <p><?php echo _EBLOG_CURRENT_TEAM_MEMBER; ?>
\r
2557 $res = sql_query('SELECT mname, mrealname FROM ' . sql_table('member') . ',' . sql_table('team') . ' WHERE mnumber=tmember AND tblog=' . intval($blogid));
\r
2558 $aMemberNames = array();
\r
2559 while ($o = mysql_fetch_object($res))
\r
2560 array_push($aMemberNames, htmlspecialchars($o->mname) . ' (' . htmlspecialchars($o->mrealname). ')');
\r
2561 echo implode(',', $aMemberNames);
\r
2568 <a href="index.php?action=manageteam&blogid=<?php echo $blogid?>"><?php echo _EBLOG_TEAM_TEXT?></a>
\r
2571 <h3><?php echo _EBLOG_SETTINGS_TITLE?></h3>
\r
2573 <form method="post" action="index.php"><div>
\r
2575 <input type="hidden" name="action" value="blogsettingsupdate" />
\r
2576 <?php $manager->addTicketHidden() ?>
\r
2577 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
\r
2579 <td><?php echo _EBLOG_NAME?></td>
\r
2580 <td><input name="name" tabindex="10" size="40" maxlength="60" value="<?php echo htmlspecialchars($blog->getName()) ?>" /></td>
\r
2582 <td><?php echo _EBLOG_SHORTNAME?> <?php help('shortblogname'); ?>
\r
2583 <?php echo _EBLOG_SHORTNAME_EXTRA?>
\r
2585 <td><input name="shortname" tabindex="20" maxlength="15" size="15" value="<?php echo htmlspecialchars($blog->getShortName()) ?>" /></td>
\r
2587 <td><?php echo _EBLOG_DESC?></td>
\r
2588 <td><input name="desc" tabindex="30" maxlength="200" size="40" value="<?php echo htmlspecialchars($blog->getDescription()) ?>" /></td>
\r
2590 <td><?php echo _EBLOG_URL?></td>
\r
2591 <td><input name="url" tabindex="40" size="40" maxlength="100" value="<?php echo htmlspecialchars($blog->getURL()) ?>" /></td>
\r
2593 <td><?php echo _EBLOG_DEFSKIN?>
\r
2594 <?php help('blogdefaultskin'); ?>
\r
2598 $query = 'SELECT sdname as text, sdnumber as value'
\r
2599 . ' FROM '.sql_table('skin_desc');
\r
2600 $template['name'] = 'defskin';
\r
2601 $template['selected'] = $blog->getDefaultSkin();
\r
2602 $template['tabindex'] = 50;
\r
2603 showlist($query,'select',$template);
\r
2608 <td><?php echo _EBLOG_LINEBREAKS?> <?php help('convertbreaks'); ?>
\r
2610 <td><?php $this->input_yesno('convertbreaks',$blog->convertBreaks(),55); ?></td>
\r
2612 <td><?php echo _EBLOG_ALLOWPASTPOSTING?> <?php help('allowpastposting'); ?>
\r
2614 <td><?php $this->input_yesno('allowpastposting',$blog->allowPastPosting(),57); ?></td>
\r
2616 <td><?php echo _EBLOG_DISABLECOMMENTS?>
\r
2618 <td><?php $this->input_yesno('comments',$blog->commentsEnabled(),60); ?></td>
\r
2620 <td><?php echo _EBLOG_ANONYMOUS?>
\r
2622 <td><?php $this->input_yesno('public',$blog->isPublic(),70); ?></td>
\r
2624 <td><?php echo _EBLOG_REQUIREDEMAIL?>
\r
2626 <td><?php $this->input_yesno('reqemail',$blog->emailRequired(),72); ?></td>
\r
2628 <td><?php echo _EBLOG_NOTIFY?> <?php help('blognotify'); ?></td>
\r
2629 <td><input name="notify" tabindex="80" maxlength="60" size="40" value="<?php echo htmlspecialchars($blog->getNotifyAddress()); ?>" /></td>
\r
2631 <td><?php echo _EBLOG_NOTIFY_ON?></td>
\r
2633 <input name="notifyComment" value="3" type="checkbox" tabindex="81" id="notifyComment"
\r
2634 <?php if ($blog->notifyOnComment()) echo "checked='checked'" ?>
\r
2635 /><label for="notifyComment"><?php echo _EBLOG_NOTIFY_COMMENT?></label>
\r
2637 <input name="notifyVote" value="5" type="checkbox" tabindex="82" id="notifyVote"
\r
2638 <?php if ($blog->notifyOnVote()) echo "checked='checked'" ?>
\r
2639 /><label for="notifyVote"><?php echo _EBLOG_NOTIFY_KARMA?></label>
\r
2641 <input name="notifyNewItem" value="7" type="checkbox" tabindex="83" id="notifyNewItem"
\r
2642 <?php if ($blog->notifyOnNewItem()) echo "checked='checked'" ?>
\r
2643 /><label for="notifyNewItem"><?php echo _EBLOG_NOTIFY_ITEM?></label>
\r
2647 if (numberOfEventSubscriber('SendPing') > 0) {
\r
2649 <td><?php echo _EBLOG_PING?> <?php help('sendping'); ?></td>
\r
2650 <td><?php $this->input_yesno('sendping',$blog->sendPing(),85); ?></td>
\r
2655 <td><?php echo _EBLOG_MAXCOMMENTS?> <?php help('blogmaxcomments'); ?></td>
\r
2656 <td><input name="maxcomments" tabindex="90" size="3" value="<?php echo htmlspecialchars($blog->getMaxComments()); ?>" /></td>
\r
2658 <td><?php echo _EBLOG_UPDATE?> <?php help('blogupdatefile'); ?></td>
\r
2659 <td><input name="update" tabindex="100" size="40" maxlength="60" value="<?php echo htmlspecialchars($blog->getUpdateFile()) ?>" /></td>
\r
2661 <td><?php echo _EBLOG_DEFCAT?></td>
\r
2664 $query = 'SELECT cname as text, catid as value'
\r
2665 . ' FROM '.sql_table('category')
\r
2666 . ' WHERE cblog=' . $blog->getID();
\r
2667 $template['name'] = 'defcat';
\r
2668 $template['selected'] = $blog->getDefaultCategory();
\r
2669 $template['tabindex'] = 110;
\r
2670 showlist($query,'select',$template);
\r
2674 <td><?php echo _EBLOG_OFFSET?> <?php help('blogtimeoffset'); ?>
\r
2675 <br /><?php echo _EBLOG_STIME?> <b><?php echo strftime("%H:%M",time()); ?></b>
\r
2676 <br /><?php echo _EBLOG_BTIME?> <b><?php echo strftime("%H:%M",$blog->getCorrectTime()); ?></b>
\r
2678 <td><input name="timeoffset" tabindex="120" size="3" value="<?php echo htmlspecialchars($blog->getTimeOffset()); ?>" /></td>
\r
2680 <td><?php echo _EBLOG_SEARCH?> <?php help('blogsearchable'); ?></td>
\r
2681 <td><?php $this->input_yesno('searchable',$blog->getSearchable(),122); ?></td>
\r
2685 $this->_insertPluginOptions('blog',$blogid);
\r
2688 <th colspan="2"><?php echo _EBLOG_CHANGE?></th>
\r
2690 <td><?php echo _EBLOG_CHANGE?></td>
\r
2691 <td><input type="submit" tabindex="130" value="<?php echo _EBLOG_CHANGE_BTN?>" onclick="return checkSubmit();" /></td>
\r
2696 <h3><?php echo _EBLOG_CAT_TITLE?></h3>
\r
2700 $query = 'SELECT * FROM '.sql_table('category').' WHERE cblog='.$blog->getID().' ORDER BY cname';
\r
2701 $template['content'] = 'categorylist';
\r
2702 $template['tabindex'] = 200;
\r
2704 $manager->loadClass("ENCAPSULATE");
\r
2705 $batch =& new BATCH('category');
\r
2706 $batch->showlist($query,'table',$template);
\r
2711 <form action="index.php" method="post"><div>
\r
2712 <input name="action" value="categorynew" type="hidden" />
\r
2713 <?php $manager->addTicketHidden() ?>
\r
2714 <input name="blogid" value="<?php echo $blog->getID()?>" type="hidden" />
\r
2717 <th colspan="2"><?php echo _EBLOG_CAT_CREATE?></th>
\r
2719 <td><?php echo _EBLOG_CAT_NAME?></td>
\r
2720 <td><input name="cname" size="40" maxlength="40" tabindex="300" /></td>
\r
2722 <td><?php echo _EBLOG_CAT_DESC?></td>
\r
2723 <td><input name="cdesc" size="40" maxlength="200" tabindex="310" /></td>
\r
2725 <td><?php echo _EBLOG_CAT_CREATE?></td>
\r
2726 <td><input type="submit" value="<?php echo _EBLOG_CAT_CREATE?>" tabindex="320" /></td>
\r
2733 echo '<h3>',_PLUGINS_EXTRA,'</h3>';
\r
2736 'BlogSettingsFormExtras',
\r
2742 $this->pagefoot();
\r
2746 * @todo document this
\r
2748 function action_categorynew() {
\r
2749 global $member, $manager;
\r
2751 $blogid = intRequestVar('blogid');
\r
2753 $member->blogAdminRights($blogid) or $this->disallow();
\r
2755 $cname = postVar('cname');
\r
2756 $cdesc = postVar('cdesc');
\r
2758 if (!isValidCategoryName($cname))
\r
2759 $this->error(_ERROR_BADCATEGORYNAME);
\r
2761 $query = 'SELECT * FROM '.sql_table('category') . ' WHERE cname=\'' . addslashes($cname).'\' and cblog=' . intval($blogid);
\r
2762 $res = sql_query($query);
\r
2763 if (mysql_num_rows($res) > 0)
\r
2764 $this->error(_ERROR_DUPCATEGORYNAME);
\r
2766 $blog =& $manager->getBlog($blogid);
\r
2767 $newCatID = $blog->createNewCategory($cname, $cdesc);
\r
2769 $this->action_blogsettings();
\r
2773 * @todo document this
\r
2775 function action_categoryedit($catid = '', $blogid = '', $desturl = '') {
\r
2776 global $member, $manager;
\r
2778 if ($blogid == '')
\r
2779 $blogid = intGetVar('blogid');
\r
2781 $blogid = intval($blogid);
\r
2783 $catid = intGetVar('catid');
\r
2785 $catid = intval($catid);
\r
2787 $member->blogAdminRights($blogid) or $this->disallow();
\r
2789 $res = sql_query('SELECT * FROM '.sql_table('category')." WHERE cblog=$blogid AND catid=$catid");
\r
2790 $obj = mysql_fetch_object($res);
\r
2792 $cname = $obj->cname;
\r
2793 $cdesc = $obj->cdesc;
\r
2795 $extrahead = '<script type="text/javascript" src="javascript/numbercheck.js"></script>';
\r
2796 $this->pagehead($extrahead);
\r
2798 echo "<p><a href='index.php?action=blogsettings&blogid=$blogid'>(",_BACK_TO_BLOGSETTINGS,")</a></p>";
\r
2801 <h2><?php echo _EBLOG_CAT_UPDATE?> '<?php echo htmlspecialchars($cname)?>'</h2>
\r
2802 <form method='post' action='index.php'><div>
\r
2803 <input name="blogid" type="hidden" value="<?php echo $blogid?>" />
\r
2804 <input name="catid" type="hidden" value="<?php echo $catid?>" />
\r
2805 <input name="desturl" type="hidden" value="<?php echo htmlspecialchars($desturl) ?>" />
\r
2806 <input name="action" type="hidden" value="categoryupdate" />
\r
2807 <?php $manager->addTicketHidden(); ?>
\r
2810 <th colspan="2"><?php echo _EBLOG_CAT_UPDATE ?></th>
\r
2812 <td><?php echo _EBLOG_CAT_NAME?></td>
\r
2813 <td><input type="text" name="cname" value="<?php echo htmlspecialchars($cname)?>" size="40" maxlength="40" /></td>
\r
2815 <td><?php echo _EBLOG_CAT_DESC?></td>
\r
2816 <td><input type="text" name="cdesc" value="<?php echo htmlspecialchars($cdesc)?>" size="40" maxlength="200" /></td>
\r
2819 // insert plugin options
\r
2820 $this->_insertPluginOptions('category',$catid);
\r
2823 <th colspan="2"><?php echo _EBLOG_CAT_UPDATE ?></th>
\r
2825 <td><?php echo _EBLOG_CAT_UPDATE?></td>
\r
2826 <td><input type="submit" value="<?php echo _EBLOG_CAT_UPDATE_BTN?>" /></td>
\r
2831 $this->pagefoot();
\r
2835 * @todo document this
\r
2837 function action_categoryupdate() {
\r
2838 global $member, $manager;
\r
2840 $blogid = intPostVar('blogid');
\r
2841 $catid = intPostVar('catid');
\r
2842 $cname = postVar('cname');
\r
2843 $cdesc = postVar('cdesc');
\r
2844 $desturl = postVar('desturl');
\r
2846 $member->blogAdminRights($blogid) or $this->disallow();
\r
2848 if (!isValidCategoryName($cname))
\r
2849 $this->error(_ERROR_BADCATEGORYNAME);
\r
2851 $query = 'SELECT * FROM '.sql_table('category').' WHERE cname=\'' . addslashes($cname).'\' and cblog=' . intval($blogid) . " and not(catid=$catid)";
\r
2852 $res = sql_query($query);
\r
2853 if (mysql_num_rows($res) > 0)
\r
2854 $this->error(_ERROR_DUPCATEGORYNAME);
\r
2856 $query = 'UPDATE '.sql_table('category').' SET'
\r
2857 . " cname='" . addslashes($cname) . "',"
\r
2858 . " cdesc='" . addslashes($cdesc) . "'"
\r
2859 . " WHERE catid=" . $catid;
\r
2861 sql_query($query);
\r
2863 // store plugin options
\r
2864 $aOptions = requestArray('plugoption');
\r
2865 NucleusPlugin::_applyPluginOptions($aOptions);
\r
2866 $manager->notify('PostPluginOptionsUpdate',array('context' => 'category', 'catid' => $catid));
\r
2870 redirect($desturl);
\r
2873 $this->action_blogsettings();
\r
2878 * @todo document this
\r
2880 function action_categorydelete() {
\r
2881 global $member, $manager;
\r
2883 $blogid = intRequestVar('blogid');
\r
2884 $catid = intRequestVar('catid');
\r
2886 $member->blogAdminRights($blogid) or $this->disallow();
\r
2888 $blog =& $manager->getBlog($blogid);
\r
2890 // check if the category is valid
\r
2891 if (!$blog->isValidCategory($catid))
\r
2892 $this->error(_ERROR_NOSUCHCATEGORY);
\r
2894 // don't allow deletion of default category
\r
2895 if ($blog->getDefaultCategory() == $catid)
\r
2896 $this->error(_ERROR_DELETEDEFCATEGORY);
\r
2898 // check if catid is the only category left for blogid
\r
2899 $query = 'SELECT catid FROM '.sql_table('category').' WHERE cblog=' . $blogid;
\r
2900 $res = sql_query($query);
\r
2901 if (mysql_num_rows($res) == 1)
\r
2902 $this->error(_ERROR_DELETELASTCATEGORY);
\r
2905 $this->pagehead();
\r
2907 <h2><?php echo _DELETE_CONFIRM?></h2>
\r
2910 <?php echo _CONFIRMTXT_CATEGORY?><b><?php echo htmlspecialchars($blog->getCategoryName($catid))?></b>
\r
2913 <form method="post" action="index.php"><div>
\r
2914 <input type="hidden" name="action" value="categorydeleteconfirm" />
\r
2915 <?php $manager->addTicketHidden() ?>
\r
2916 <input type="hidden" name="blogid" value="<?php echo $blogid?>" />
\r
2917 <input type="hidden" name="catid" value="<?php echo $catid?>" />
\r
2918 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
\r
2921 $this->pagefoot();
\r
2925 * @todo document this
\r
2927 function action_categorydeleteconfirm() {
\r
2928 global $member, $manager;
\r
2930 $blogid = intRequestVar('blogid');
\r
2931 $catid = intRequestVar('catid');
\r
2933 $member->blogAdminRights($blogid) or $this->disallow();
\r
2935 $error = $this->deleteOneCategory($catid);
\r
2937 $this->error($error);
\r
2939 $this->action_blogsettings();
\r
2943 * @todo document this
\r
2945 function deleteOneCategory($catid) {
\r
2946 global $manager, $member;
\r
2948 $catid = intval($catid);
\r
2950 $manager->notify('PreDeleteCategory', array('catid' => $catid));
\r
2952 $blogid = getBlogIDFromCatID($catid);
\r
2954 if (!$member->blogAdminRights($blogid))
\r
2955 return ERROR_DISALLOWED;
\r
2958 $blog =& $manager->getBlog($blogid);
\r
2960 // check if the category is valid
\r
2961 if (!$blog || !$blog->isValidCategory($catid))
\r
2962 return _ERROR_NOSUCHCATEGORY;
\r
2964 $destcatid = $blog->getDefaultCategory();
\r
2966 // don't allow deletion of default category
\r
2967 if ($blog->getDefaultCategory() == $catid)
\r
2968 return _ERROR_DELETEDEFCATEGORY;
\r
2970 // check if catid is the only category left for blogid
\r
2971 $query = 'SELECT catid FROM '.sql_table('category').' WHERE cblog=' . $blogid;
\r
2972 $res = sql_query($query);
\r
2973 if (mysql_num_rows($res) == 1)
\r
2974 return _ERROR_DELETELASTCATEGORY;
\r
2976 // change category for all items to the default category
\r
2977 $query = 'UPDATE '.sql_table('item')." SET icat=$destcatid WHERE icat=$catid";
\r
2978 sql_query($query);
\r
2980 // delete all associated plugin options
\r
2981 NucleusPlugin::_deleteOptionValues('category', $catid);
\r
2983 // delete category
\r
2984 $query = 'DELETE FROM '.sql_table('category').' WHERE catid=' .$catid;
\r
2985 sql_query($query);
\r
2987 $manager->notify('PostDeleteCategory', array('catid' => $catid));
\r
2992 * @todo document this
\r
2994 function moveOneCategory($catid, $destblogid) {
\r
2995 global $manager, $member;
\r
2997 $catid = intval($catid);
\r
2998 $destblogid = intval($destblogid);
\r
3000 $blogid = getBlogIDFromCatID($catid);
\r
3002 // mover should have admin rights on both blogs
\r
3003 if (!$member->blogAdminRights($blogid))
\r
3004 return _ERROR_DISALLOWED;
\r
3005 if (!$member->blogAdminRights($destblogid))
\r
3006 return _ERROR_DISALLOWED;
\r
3008 // cannot move to self
\r
3009 if ($blogid == $destblogid)
\r
3010 return _ERROR_MOVETOSELF;
\r
3013 $blog =& $manager->getBlog($blogid);
\r
3014 $destblog =& $manager->getBlog($destblogid);
\r
3016 // check if the category is valid
\r
3017 if (!$blog || !$blog->isValidCategory($catid))
\r
3018 return _ERROR_NOSUCHCATEGORY;
\r
3020 // don't allow default category to be moved
\r
3021 if ($blog->getDefaultCategory() == $catid)
\r
3022 return _ERROR_MOVEDEFCATEGORY;
\r
3025 'PreMoveCategory',
\r
3027 'catid' => &$catid,
\r
3028 'sourceblog' => &$blog,
\r
3029 'destblog' => &$destblog
\r
3033 // update comments table (cblog)
\r
3034 $query = 'SELECT inumber FROM '.sql_table('item').' WHERE icat='.$catid;
\r
3035 $items = sql_query($query);
\r
3036 while ($oItem = mysql_fetch_object($items)) {
\r
3037 sql_query('UPDATE '.sql_table('comment').' SET cblog='.$destblogid.' WHERE citem='.$oItem->inumber);
\r
3040 // update items (iblog)
\r
3041 $query = 'UPDATE '.sql_table('item').' SET iblog='.$destblogid.' WHERE icat='.$catid;
\r
3042 sql_query($query);
\r
3045 $query = 'UPDATE '.sql_table('category').' SET cblog='.$destblogid.' WHERE catid='.$catid;
\r
3046 sql_query($query);
\r
3049 'PostMoveCategory',
\r
3051 'catid' => &$catid,
\r
3052 'sourceblog' => &$blog,
\r
3053 'destblog' => $destblog
\r
3060 * @todo document this
\r
3062 function action_blogsettingsupdate() {
\r
3063 global $member, $manager;
\r
3065 $blogid = intRequestVar('blogid');
\r
3067 $member->blogAdminRights($blogid) or $this->disallow();
\r
3069 $blog =& $manager->getBlog($blogid);
\r
3071 $notify = trim(postVar('notify'));
\r
3072 $shortname = trim(postVar('shortname'));
\r
3073 $updatefile = trim(postVar('update'));
\r
3075 $notifyComment = intPostVar('notifyComment');
\r
3076 $notifyVote = intPostVar('notifyVote');
\r
3077 $notifyNewItem = intPostVar('notifyNewItem');
\r
3079 if ($notifyComment == 0) $notifyComment = 1;
\r
3080 if ($notifyVote == 0) $notifyVote = 1;
\r
3081 if ($notifyNewItem == 0) $notifyNewItem = 1;
\r
3083 $notifyType = $notifyComment * $notifyVote * $notifyNewItem;
\r
3087 $not =& new NOTIFICATION($notify);
\r
3088 if (!$not->validAddresses())
\r
3089 $this->error(_ERROR_BADNOTIFY);
\r
3093 if (!isValidShortName($shortname))
\r
3094 $this->error(_ERROR_BADSHORTBLOGNAME);
\r
3096 if (($blog->getShortName() != $shortname) && $manager->existsBlog($shortname))
\r
3097 $this->error(_ERROR_DUPSHORTBLOGNAME);
\r
3099 // check if update file is writable
\r
3100 if ($updatefile && !is_writeable($updatefile))
\r
3101 $this->error(_ERROR_UPDATEFILE);
\r
3103 $blog->setName(trim(postVar('name')));
\r
3104 $blog->setShortName($shortname);
\r
3105 $blog->setNotifyAddress($notify);
\r
3106 $blog->setNotifyType($notifyType);
\r
3107 $blog->setMaxComments(postVar('maxcomments'));
\r
3108 $blog->setCommentsEnabled(postVar('comments'));
\r
3109 $blog->setTimeOffset(postVar('timeoffset'));
\r
3110 $blog->setUpdateFile($updatefile);
\r
3111 $blog->setURL(trim(postVar('url')));
\r
3112 $blog->setDefaultSkin(intPostVar('defskin'));
\r
3113 $blog->setDescription(trim(postVar('desc')));
\r
3114 $blog->setPublic(postVar('public'));
\r
3115 $blog->setPingUserland(postVar('sendping'));
\r
3116 $blog->setConvertBreaks(intPostVar('convertbreaks'));
\r
3117 $blog->setAllowPastPosting(intPostVar('allowpastposting'));
\r
3118 $blog->setDefaultCategory(intPostVar('defcat'));
\r
3119 $blog->setSearchable(intPostVar('searchable'));
\r
3120 $blog->setEmailRequired(intPostVar('reqemail'));
\r
3122 $blog->writeSettings();
\r
3124 // store plugin options
\r
3125 $aOptions = requestArray('plugoption');
\r
3126 NucleusPlugin::_applyPluginOptions($aOptions);
\r
3127 $manager->notify('PostPluginOptionsUpdate',array('context' => 'blog', 'blogid' => $blogid, 'blog' => &$blog));
\r
3130 $this->action_overview(_MSG_SETTINGSCHANGED);
\r
3134 * @todo document this
\r
3136 function action_deleteblog() {
\r
3137 global $member, $CONF, $manager;
\r
3139 $blogid = intRequestVar('blogid');
\r
3141 $member->blogAdminRights($blogid) or $this->disallow();
\r
3143 // check if blog is default blog
\r
3144 if ($CONF['DefaultBlog'] == $blogid)
\r
3145 $this->error(_ERROR_DELDEFBLOG);
\r
3147 $blog =& $manager->getBlog($blogid);
\r
3149 $this->pagehead();
\r
3151 <h2><?php echo _DELETE_CONFIRM?></h2>
\r
3153 <p><?php echo _WARNINGTXT_BLOGDEL?>
\r
3157 <?php echo _CONFIRMTXT_BLOG?><b><?php echo htmlspecialchars($blog->getName())?></b>
\r
3160 <form method="post" action="index.php"><div>
\r
3161 <input type="hidden" name="action" value="deleteblogconfirm" />
\r
3162 <?php $manager->addTicketHidden() ?>
\r
3163 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
\r
3164 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
\r
3167 $this->pagefoot();
\r
3171 * @todo document this
\r
3173 function action_deleteblogconfirm() {
\r
3174 global $member, $CONF, $manager;
\r
3176 $blogid = intRequestVar('blogid');
\r
3178 $manager->notify('PreDeleteBlog', array('blogid' => $blogid));
\r
3180 $member->blogAdminRights($blogid) or $this->disallow();
\r
3182 // check if blog is default blog
\r
3183 if ($CONF['DefaultBlog'] == $blogid)
\r
3184 $this->error(_ERROR_DELDEFBLOG);
\r
3186 // delete all comments
\r
3187 $query = 'DELETE FROM '.sql_table('comment').' WHERE cblog='.$blogid;
\r
3188 sql_query($query);
\r
3190 // delete all items
\r
3191 $query = 'DELETE FROM '.sql_table('item').' WHERE iblog='.$blogid;
\r
3192 sql_query($query);
\r
3194 // delete all team members
\r
3195 $query = 'DELETE FROM '.sql_table('team').' WHERE tblog='.$blogid;
\r
3196 sql_query($query);
\r
3198 // delete all bans
\r
3199 $query = 'DELETE FROM '.sql_table('ban').' WHERE blogid='.$blogid;
\r
3200 sql_query($query);
\r
3202 // delete all categories
\r
3203 $query = 'DELETE FROM '.sql_table('category').' WHERE cblog='.$blogid;
\r
3204 sql_query($query);
\r
3206 // delete all associated plugin options
\r
3207 NucleusPlugin::_deleteOptionValues('blog', $blogid);
\r
3209 // delete the blog itself
\r
3210 $query = 'DELETE FROM '.sql_table('blog').' WHERE bnumber='.$blogid;
\r
3211 sql_query($query);
\r
3213 $manager->notify('PostDeleteBlog', array('blogid' => $blogid));
\r
3215 $this->action_overview(_DELETED_BLOG);
\r
3219 * @todo document this
\r
3221 function action_memberdelete() {
\r
3222 global $member, $manager;
\r
3224 $memberid = intRequestVar('memberid');
\r
3226 ($member->getID() == $memberid) or $member->isAdmin() or $this->disallow();
\r
3228 $mem = MEMBER::createFromID($memberid);
\r
3230 $this->pagehead();
\r
3232 <h2><?php echo _DELETE_CONFIRM?></h2>
\r
3234 <p><?php echo _CONFIRMTXT_MEMBER?><b><?php echo htmlspecialchars($mem->getDisplayName()) ?></b>
\r
3238 <?php echo _WARNINGTXT_NOTDELMEDIAFILES ?>
\r
3241 <form method="post" action="index.php"><div>
\r
3242 <input type="hidden" name="action" value="memberdeleteconfirm" />
\r
3243 <?php $manager->addTicketHidden() ?>
\r
3244 <input type="hidden" name="memberid" value="<?php echo $memberid; ?>" />
\r
3245 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
\r
3248 $this->pagefoot();
\r
3252 * @todo document this
\r
3254 function action_memberdeleteconfirm() {
\r
3257 $memberid = intRequestVar('memberid');
\r
3259 ($member->getID() == $memberid) or $member->isAdmin() or $this->disallow();
\r
3261 $error = $this->deleteOneMember($memberid);
\r
3263 $this->error($error);
\r
3265 if ($member->isAdmin())
\r
3266 $this->action_usermanagement();
\r
3268 $this->action_overview(_DELETED_MEMBER);
\r
3273 * @todo document this
\r
3275 function deleteOneMember($memberid) {
\r
3278 $memberid = intval($memberid);
\r
3279 $mem = MEMBER::createFromID($memberid);
\r
3281 if (!$mem->canBeDeleted())
\r
3282 return _ERROR_DELETEMEMBER;
\r
3284 $manager->notify('PreDeleteMember', array('member' => &$mem));
\r
3286 /* unlink comments from memberid */
\r
3288 $query = 'UPDATE ' . sql_table('comment') . ' SET cmember="0", cuser="'. addslashes($mem->getDisplayName())
\r
3289 .'" WHERE cmember='.$memberid;
\r
3290 sql_query($query);
\r
3293 $query = 'DELETE FROM '.sql_table('member').' WHERE mnumber='.$memberid;
\r
3294 sql_query($query);
\r
3296 $query = 'DELETE FROM '.sql_table('team').' WHERE tmember='.$memberid;
\r
3297 sql_query($query);
\r
3299 $query = 'DELETE FROM '.sql_table('activation').' WHERE vmember='.$memberid;
\r
3300 sql_query($query);
\r
3302 // delete all associated plugin options
\r
3303 NucleusPlugin::_deleteOptionValues('member', $memberid);
\r
3305 $manager->notify('PostDeleteMember', array('member' => &$mem));
\r
3311 * @todo document this
\r
3313 function action_createnewlog() {
\r
3314 global $member, $CONF, $manager;
\r
3316 // Only Super-Admins can do this
\r
3317 $member->isAdmin() or $this->disallow();
\r
3319 $this->pagehead();
\r
3321 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
\r
3323 <h2><?php echo _EBLOG_CREATE_TITLE?></h2>
\r
3325 <h3><?php echo _ADMIN_NOTABILIA ?></h3>
\r
3327 <p><?php echo _ADMIN_PLEASE_READ ?></p>
\r
3329 <p><?php echo _ADMIN_HOW_TO_ACCESS ?></p>
\r
3332 <li><?php echo _ADMIN_SIMPLE_WAY ?></li>
\r
3333 <li><?php echo _ADMIN_ADVANCED_WAY ?></li>
\r
3336 <h3><?php echo _ADMIN_HOW_TO_CREATE ?></h3>
\r
3339 <?php echo _EBLOG_CREATE_TEXT?>
\r
3342 <form method="post" action="index.php"><div>
\r
3344 <input type="hidden" name="action" value="addnewlog" />
\r
3345 <?php $manager->addTicketHidden() ?>
\r
3349 <td><?php echo _EBLOG_NAME?></td>
\r
3350 <td><input name="name" tabindex="10" size="40" maxlength="60" /></td>
\r
3352 <td><?php echo _EBLOG_SHORTNAME?>
\r
3353 <?php help('shortblogname'); ?>
\r
3355 <td><input name="shortname" tabindex="20" maxlength="15" size="15" /></td>
\r
3357 <td><?php echo _EBLOG_DESC?></td>
\r
3358 <td><input name="desc" tabindex="30" maxlength="200" size="40" /></td>
\r
3360 <td><?php echo _EBLOG_DEFSKIN?>
\r
3361 <?php help('blogdefaultskin'); ?>
\r
3365 $query = 'SELECT sdname as text, sdnumber as value'
\r
3366 . ' FROM '.sql_table('skin_desc');
\r
3367 $template['name'] = 'defskin';
\r
3368 $template['tabindex'] = 50;
\r
3369 $template['selected'] = $CONF['BaseSkin']; // set default selected skin to be globally defined base skin
\r
3370 showlist($query,'select',$template);
\r
3374 <td><?php echo _EBLOG_OFFSET?>
\r
3375 <?php help('blogtimeoffset'); ?>
\r
3376 <br /><?php echo _EBLOG_STIME?> <b><?php echo strftime("%H:%M",time()); ?></b>
\r
3378 <td><input name="timeoffset" tabindex="110" size="3" value="0" /></td>
\r
3380 <td><?php echo _EBLOG_ADMIN?>
\r
3381 <?php help('teamadmin'); ?>
\r
3383 <td><?php echo _EBLOG_ADMIN_MSG?></td>
\r
3385 <td><?php echo _EBLOG_CREATE?></td>
\r
3386 <td><input type="submit" tabindex="120" value="<?php echo _EBLOG_CREATE_BTN?>" onclick="return checkSubmit();" /></td>
\r
3391 $this->pagefoot();
\r
3395 * @todo document this
\r
3397 function action_addnewlog() {
\r
3398 global $member, $manager, $CONF;
\r
3400 // Only Super-Admins can do this
\r
3401 $member->isAdmin() or $this->disallow();
\r
3403 $bname = trim(postVar('name'));
\r
3404 $bshortname = trim(postVar('shortname'));
\r
3405 $btimeoffset = postVar('timeoffset');
\r
3406 $bdesc = trim(postVar('desc'));
\r
3407 $bdefskin = postVar('defskin');
\r
3409 if (!isValidShortName($bshortname))
\r
3410 $this->error(_ERROR_BADSHORTBLOGNAME);
\r
3412 if ($manager->existsBlog($bshortname))
\r
3413 $this->error(_ERROR_DUPSHORTBLOGNAME);
\r
3418 'name' => &$bname,
\r
3419 'shortname' => &$bshortname,
\r
3420 'timeoffset' => &$btimeoffset,
\r
3421 'description' => &$bdesc,
\r
3422 'defaultskin' => &$bdefskin
\r
3427 // add slashes for sql queries
\r
3428 $bname = addslashes($bname);
\r
3429 $bshortname = addslashes($bshortname);
\r
3430 $btimeoffset = addslashes($btimeoffset);
\r
3431 $bdesc = addslashes($bdesc);
\r
3432 $bdefskin = addslashes($bdefskin);
\r
3435 $query = 'INSERT INTO '.sql_table('blog')." (bname, bshortname, bdesc, btimeoffset, bdefskin) VALUES ('$bname', '$bshortname', '$bdesc', '$btimeoffset', '$bdefskin')";
\r
3436 sql_query($query);
\r
3437 $blogid = mysql_insert_id();
\r
3438 $blog =& $manager->getBlog($blogid);
\r
3440 // create new category
\r
3441 $sql = 'INSERT INTO %s (cblog, cname, cdesc) VALUES (%d, "%s", "%s")';
\r
3442 sql_query(sprintf($sql, sql_table('category'), $blogid, _EBLOGDEFAULTCATEGORY_NAME, _EBLOGDEFAULTCATEGORY_DESC));
\r
3443 // sql_query('INSERT INTO '.sql_table('category')." (cblog, cname, cdesc) VALUES ($blogid, _EBLOGDEFAULTCATEGORY_NAME, _EBLOGDEFAULTCATEGORY_DESC)");
\r
3444 $catid = mysql_insert_id();
\r
3446 // set as default category
\r
3447 $blog->setDefaultCategory($catid);
\r
3448 $blog->writeSettings();
\r
3450 // create team member
\r
3451 $memberid = $member->getID();
\r
3452 $query = 'INSERT INTO '.sql_table('team')." (tmember, tblog, tadmin) VALUES ($memberid, $blogid, 1)";
\r
3453 sql_query($query);
\r
3456 $blog->additem($blog->getDefaultCategory(),_EBLOG_FIRSTITEM_TITLE,_EBLOG_FIRSTITEM_BODY,'',$blogid, $memberid,$blog->getCorrectTime(),0,0,0);
\r
3466 'PostAddCategory',
\r
3469 'name' => _EBLOGDEFAULTCATEGORY_NAME,
\r
3470 'description' => _EBLOGDEFAULTCATEGORY_DESC,
\r
3475 $this->pagehead();
\r
3477 <h2><?php echo _BLOGCREATED_TITLE ?></h2>
\r
3479 <p><?php echo sprintf(_BLOGCREATED_ADDEDTXT, htmlspecialchars($bname)) ?></p>
\r
3482 <li><a href="#index_php"><?php echo sprintf(_BLOGCREATED_SIMPLEWAY, htmlspecialchars($bshortname)) ?></a></li>
\r
3483 <li><a href="#skins"><?php echo _BLOGCREATED_ADVANCEDWAY ?></a></li>
\r
3486 <h3><a id="index_php"><?php echo sprintf(_BLOGCREATED_SIMPLEDESC1, htmlspecialchars($bshortname)) ?></a></h3>
\r
3488 <p><?php echo sprintf(_BLOGCREATED_SIMPLEDESC2, htmlspecialchars($bshortname)) ?></p>
\r
3489 <pre><code><?php
\r
3491 $CONF['Self'] = '<b><?php echo htmlspecialchars($bshortname)?>.php</b>';
\r
3493 include('<i>./config.php</i>');
\r
3495 selectBlog('<b><?php echo htmlspecialchars($bshortname)?></b>');
\r
3498 ?></code></pre>
\r
3500 <p><?php echo _BLOGCREATED_SIMPLEDESC3 ?></p>
\r
3502 <p><?php echo _BLOGCREATED_SIMPLEDESC4 ?></p>
\r
3504 <form action="index.php" method="post"><div>
\r
3505 <input type="hidden" name="action" value="addnewlog2" />
\r
3506 <?php $manager->addTicketHidden() ?>
\r
3507 <input type="hidden" name="blogid" value="<?php echo intval($blogid)?>" />
\r
3509 <td><?php echo _EBLOG_URL?></td>
\r
3510 <td><input name="url" maxlength="100" size="40" value="<?php echo htmlspecialchars($CONF['IndexURL'].$bshortname.'.php')?>" /></td>
\r
3512 <td><?php echo _EBLOG_CREATE?></td>
\r
3513 <td><input type="submit" value="<?php echo _EBLOG_CREATE_BTN?>" onclick="return checkSubmit();" /></td>
\r
3517 <h3><a id="skins"><?php echo _BLOGCREATED_ADVANCEDWAY2 ?></a></h3>
\r
3519 <p><?php echo _BLOGCREATED_ADVANCEDWAY3 ?></p>
\r
3521 <form action="index.php" method="post"><div>
\r
3522 <input type="hidden" name="action" value="addnewlog2" />
\r
3523 <?php $manager->addTicketHidden() ?>
\r
3524 <input type="hidden" name="blogid" value="<?php echo intval($blogid)?>" />
\r
3526 <td><?php echo _EBLOG_URL?></td>
\r
3527 <td><input name="url" maxlength="100" size="40" /></td>
\r
3529 <td><?php echo _EBLOG_CREATE?></td>
\r
3530 <td><input type="submit" value="<?php echo _EBLOG_CREATE_BTN?>" onclick="return checkSubmit();" /></td>
\r
3534 <?php $this->pagefoot();
\r
3539 * @todo document this
\r
3541 function action_addnewlog2() {
\r
3542 global $member, $manager;
\r
3544 $member->blogAdminRights($blogid) or $this->disallow();
\r
3546 $burl = requestVar('url');
\r
3547 $blogid = intRequestVar('blogid');
\r
3549 $blog =& $manager->getBlog($blogid);
\r
3550 $blog->setURL(trim($burl));
\r
3551 $blog->writeSettings();
\r
3553 $this->action_overview(_MSG_NEWBLOG);
\r
3557 * @todo document this
\r
3559 function action_skinieoverview() {
\r
3560 global $member, $DIR_LIBS, $manager;
\r
3562 $member->isAdmin() or $this->disallow();
\r
3564 // load skinie class
\r
3565 include_once($DIR_LIBS . 'skinie.php');
\r
3567 $this->pagehead();
\r
3569 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
\r
3572 <h2><?php echo _SKINIE_TITLE_IMPORT?></h2>
\r
3574 <p><label for="skinie_import_local"><?php echo _SKINIE_LOCAL?></label>
\r
3575 <?php global $DIR_SKINS;
\r
3577 $candidates = SKINIMPORT::searchForCandidates($DIR_SKINS);
\r
3579 if (sizeof($candidates) > 0) {
\r
3581 <form method="post" action="index.php"><div>
\r
3582 <input type="hidden" name="action" value="skinieimport" />
\r
3583 <?php $manager->addTicketHidden() ?>
\r
3584 <input type="hidden" name="mode" value="file" />
\r
3585 <select name="skinfile" id="skinie_import_local">
\r
3586 <?php foreach ($candidates as $skinname => $skinfile) {
\r
3587 $html = htmlspecialchars($skinfile);
\r
3588 echo '<option value="',$html,'">',$skinname,'</option>';
\r
3592 <input type="submit" value="<?php echo _SKINIE_BTN_IMPORT?>" />
\r
3595 echo _SKINIE_NOCANDIDATES;
\r
3600 <p><em><?php echo _OR?></em></p>
\r
3602 <form method="post" action="index.php"><p>
\r
3603 <?php $manager->addTicketHidden() ?>
\r
3604 <input type="hidden" name="action" value="skinieimport" />
\r
3605 <input type="hidden" name="mode" value="url" />
\r
3606 <label for="skinie_import_url"><?php echo _SKINIE_FROMURL?></label>
\r
3607 <input type="text" name="skinfile" id="skinie_import_url" size="60" value="http://" />
\r
3608 <input type="submit" value="<?php echo _SKINIE_BTN_IMPORT?>" />
\r
3612 <h2><?php echo _SKINIE_TITLE_EXPORT?></h2>
\r
3613 <form method="post" action="index.php"><div>
\r
3614 <input type="hidden" name="action" value="skinieexport" />
\r
3615 <?php $manager->addTicketHidden() ?>
\r
3617 <p><?php echo _SKINIE_EXPORT_INTRO?></p>
\r
3620 <th colspan="2"><?php echo _SKINIE_EXPORT_SKINS?></th>
\r
3622 <?php // show list of skins
\r
3623 $res = sql_query('SELECT * FROM '.sql_table('skin_desc'));
\r
3624 while ($skinObj = mysql_fetch_object($res)) {
\r
3625 $id = 'skinexp' . $skinObj->sdnumber;
\r
3626 echo '<td><input type="checkbox" name="skin[',$skinObj->sdnumber,']" id="',$id,'" />';
\r
3627 echo '<label for="',$id,'">',htmlspecialchars($skinObj->sdname),'</label></td>';
\r
3628 echo '<td>',htmlspecialchars($skinObj->sddesc),'</td>';
\r
3632 echo '<th colspan="2">',_SKINIE_EXPORT_TEMPLATES,'</th></tr><tr>';
\r
3634 // show list of templates
\r
3635 $res = sql_query('SELECT * FROM '.sql_table('template_desc'));
\r
3636 while ($templateObj = mysql_fetch_object($res)) {
\r
3637 $id = 'templateexp' . $templateObj->tdnumber;
\r
3638 echo '<td><input type="checkbox" name="template[',$templateObj->tdnumber,']" id="',$id,'" />';
\r
3639 echo '<label for="',$id,'">',htmlspecialchars($templateObj->tdname),'</label></td>';
\r
3640 echo '<td>',htmlspecialchars($templateObj->tddesc),'</td>';
\r
3645 <th colspan="2"><?php echo _SKINIE_EXPORT_EXTRA?></th>
\r
3647 <td colspan="2"><textarea cols="40" rows="5" name="info"></textarea></td>
\r
3649 <th colspan="2"><?php echo _SKINIE_TITLE_EXPORT?></th>
\r
3651 <td colspan="2"><input type="submit" value="<?php echo _SKINIE_BTN_EXPORT?>" /></td>
\r
3656 $this->pagefoot();
\r
3661 * @todo document this
\r
3663 function action_skinieimport() {
\r
3664 global $member, $DIR_LIBS, $DIR_SKINS, $manager;
\r
3666 $member->isAdmin() or $this->disallow();
\r
3668 // load skinie class
\r
3669 include_once($DIR_LIBS . 'skinie.php');
\r
3671 $skinFileRaw= postVar('skinfile');
\r
3672 $mode = postVar('mode');
\r
3674 $importer =& new SKINIMPORT();
\r
3676 // get full filename
\r
3677 if ($mode == 'file')
\r
3679 $skinFile = $DIR_SKINS . $skinFileRaw . '/skinbackup.xml';
\r
3681 // backwards compatibilty (in v2.0, exports were saved as skindata.xml)
\r
3682 if (!file_exists($skinFile))
\r
3683 $skinFile = $DIR_SKINS . $skinFileRaw . '/skindata.xml';
\r
3685 $skinFile = $skinFileRaw;
\r
3688 // read only metadata
\r
3689 $error = $importer->readFile($skinFile, 1);
\r
3692 $skinNameClashes = $importer->checkSkinNameClashes();
\r
3693 $templateNameClashes = $importer->checkTemplateNameClashes();
\r
3694 $hasNameClashes = (count($skinNameClashes) > 0) || (count($templateNameClashes) > 0);
\r
3696 if ($error) $this->error($error);
\r
3698 $this->pagehead();
\r
3700 echo '<p><a href="index.php?action=skinieoverview">(',_BACK,')</a></p>';
\r
3702 <h2><?php echo _SKINIE_CONFIRM_TITLE?></h2>
\r
3705 <li><p><strong><?php echo _SKINIE_INFO_GENERAL?></strong> <?php echo htmlspecialchars($importer->getInfo())?></p></li>
\r
3706 <li><p><strong><?php echo _SKINIE_INFO_SKINS?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->getSkinNames())?></p></li>
\r
3707 <li><p><strong><?php echo _SKINIE_INFO_TEMPLATES?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->getTemplateNames())?></p></li>
\r
3709 if ($hasNameClashes)
\r
3712 <li><p><strong style="color: red;"><?php echo _SKINIE_INFO_SKINCLASH?></strong> <?php echo implode(' <em>'._AND.'</em> ',$skinNameClashes)?></p></li>
\r
3713 <li><p><strong style="color: red;"><?php echo _SKINIE_INFO_TEMPLCLASH?></strong> <?php echo implode(' <em>'._AND.'</em> ',$templateNameClashes)?></p></li>
\r
3715 } // if (hasNameClashes)
\r
3719 <form method="post" action="index.php"><div>
\r
3720 <input type="hidden" name="action" value="skiniedoimport" />
\r
3721 <?php $manager->addTicketHidden() ?>
\r
3722 <input type="hidden" name="skinfile" value="<?php echo htmlspecialchars(postVar('skinfile'))?>" />
\r
3723 <input type="hidden" name="mode" value="<?php echo htmlspecialchars($mode)?>" />
\r
3724 <input type="submit" value="<?php echo _SKINIE_CONFIRM_IMPORT?>" />
\r
3726 if ($hasNameClashes)
\r
3730 <input type="checkbox" name="overwrite" value="1" id="cb_overwrite" /><label for="cb_overwrite"><?php echo _SKINIE_CONFIRM_OVERWRITE?></label>
\r
3732 } // if (hasNameClashes)
\r
3738 $this->pagefoot();
\r
3742 * @todo document this
\r
3744 function action_skiniedoimport() {
\r
3745 global $member, $DIR_LIBS, $DIR_SKINS;
\r
3747 $member->isAdmin() or $this->disallow();
\r
3749 // load skinie class
\r
3750 include_once($DIR_LIBS . 'skinie.php');
\r
3752 $skinFileRaw= postVar('skinfile');
\r
3753 $mode = postVar('mode');
\r
3755 $allowOverwrite = intPostVar('overwrite');
\r
3757 // get full filename
\r
3758 if ($mode == 'file')
\r
3760 $skinFile = $DIR_SKINS . $skinFileRaw . '/skinbackup.xml';
\r
3762 // backwards compatibilty (in v2.0, exports were saved as skindata.xml)
\r
3763 if (!file_exists($skinFile))
\r
3764 $skinFile = $DIR_SKINS . $skinFileRaw . '/skindata.xml';
\r
3767 $skinFile = $skinFileRaw;
\r
3770 $importer =& new SKINIMPORT();
\r
3772 $error = $importer->readFile($skinFile);
\r
3775 $this->error($error);
\r
3777 $error = $importer->writeToDatabase($allowOverwrite);
\r
3780 $this->error($error);
\r
3782 $this->pagehead();
\r
3784 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
\r
3786 <h2><?php echo _SKINIE_DONE?></h2>
\r
3789 <li><p><strong><?php echo _SKINIE_INFO_GENERAL?></strong> <?php echo htmlspecialchars($importer->getInfo())?></p></li>
\r
3790 <li><p><strong><?php echo _SKINIE_INFO_IMPORTEDSKINS?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->getSkinNames())?></p></li>
\r
3791 <li><p><strong><?php echo _SKINIE_INFO_IMPORTEDTEMPLS?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->getTemplateNames())?></p></li>
\r
3794 <?php $this->pagefoot();
\r
3799 * @todo document this
\r
3801 function action_skinieexport() {
\r
3802 global $member, $DIR_LIBS;
\r
3804 $member->isAdmin() or $this->disallow();
\r
3806 // load skinie class
\r
3807 include_once($DIR_LIBS . 'skinie.php');
\r
3809 $aSkins = requestIntArray('skin');
\r
3810 $aTemplates = requestIntArray('template');
\r
3812 if (!is_array($aTemplates)) $aTemplates = array();
\r
3813 if (!is_array($aSkins)) $aSkins = array();
\r
3815 $skinList = array_keys($aSkins);
\r
3816 $templateList = array_keys($aTemplates);
\r
3818 $info = postVar('info');
\r
3820 $exporter =& new SKINEXPORT();
\r
3821 foreach ($skinList as $skinId) {
\r
3822 $exporter->addSkin($skinId);
\r
3824 foreach ($templateList as $templateId) {
\r
3825 $exporter->addTemplate($templateId);
\r
3827 $exporter->setInfo($info);
\r
3829 $exporter->export();
\r
3833 * @todo document this
\r
3835 function action_templateoverview() {
\r
3836 global $member, $manager;
\r
3838 $member->isAdmin() or $this->disallow();
\r
3840 $this->pagehead();
\r
3842 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
\r
3844 echo '<h2>' . _TEMPLATE_TITLE . '</h2>';
\r
3845 echo '<h3>' . _TEMPLATE_AVAILABLE_TITLE . '</h3>';
\r
3847 $query = 'SELECT * FROM '.sql_table('template_desc').' ORDER BY tdname';
\r
3848 $template['content'] = 'templatelist';
\r
3849 $template['tabindex'] = 10;
\r
3850 showlist($query,'table',$template);
\r
3852 echo '<h3>' . _TEMPLATE_NEW_TITLE . '</h3>';
\r
3855 <form method="post" action="index.php"><div>
\r
3857 <input name="action" value="templatenew" type="hidden" />
\r
3858 <?php $manager->addTicketHidden() ?>
\r
3860 <td><?php echo _TEMPLATE_NAME?> <?php help('shortnames');?></td>
\r
3861 <td><input name="name" tabindex="10010" maxlength="20" size="20" /></td>
\r
3863 <td><?php echo _TEMPLATE_DESC?></td>
\r
3864 <td><input name="desc" tabindex="10020" maxlength="200" size="50" /></td>
\r
3866 <td><?php echo _TEMPLATE_CREATE?></td>
\r
3867 <td><input type="submit" tabindex="10030" value="<?php echo _TEMPLATE_CREATE_BTN?>" onclick="return checkSubmit();" /></td>
\r
3873 $this->pagefoot();
\r
3877 * @todo document this
\r
3879 function action_templateedit($msg = '') {
\r
3880 global $member, $manager;
\r
3882 $templateid = intRequestVar('templateid');
\r
3884 $member->isAdmin() or $this->disallow();
\r
3886 $extrahead = '<script type="text/javascript" src="javascript/templateEdit.js"></script>';
\r
3887 $extrahead .= '<script type="text/javascript">setTemplateEditText("'.addslashes(_EDITTEMPLATE_EMPTY).'");</script>';
\r
3889 $this->pagehead($extrahead);
\r
3891 $templatename = TEMPLATE::getNameFromId($templateid);
\r
3892 $templatedescription = TEMPLATE::getDesc($templateid);
\r
3893 $template =& $manager->getTemplate($templatename);
\r
3897 <a href="index.php?action=templateoverview">(<?php echo _TEMPLATE_BACK?>)</a>
\r
3900 <h2><?php echo _TEMPLATE_EDIT_TITLE?> '<?php echo htmlspecialchars($templatename); ?>'</h2>
\r
3902 <?php if ($msg) echo "<p>"._MESSAGE.": $msg</p>";
\r
3905 <p><?php echo _TEMPLATE_EDIT_MSG?></p>
\r
3907 <form method="post" action="index.php">
\r
3910 <input type="hidden" name="action" value="templateupdate" />
\r
3911 <?php $manager->addTicketHidden() ?>
\r
3912 <input type="hidden" name="templateid" value="<?php echo $templateid; ?>" />
\r
3915 <th colspan="2"><?php echo _TEMPLATE_SETTINGS?></th>
\r
3917 <td><?php echo _TEMPLATE_NAME?> <?php help('shortnames');?></td>
\r
3918 <td><input name="tname" tabindex="4" size="20" maxlength="20" value="<?php echo htmlspecialchars($templatename) ?>" /></td>
\r
3920 <td><?php echo _TEMPLATE_DESC?></td>
\r
3921 <td><input name="tdesc" tabindex="5" size="50" maxlength="200" value="<?php echo htmlspecialchars($templatedescription) ?>" /></td>
\r
3923 <th colspan="2"><?php echo _TEMPLATE_UPDATE?></th>
\r
3925 <td><?php echo _TEMPLATE_UPDATE?></td>
\r
3927 <input type="submit" tabindex="6" value="<?php echo _TEMPLATE_UPDATE_BTN?>" onclick="return checkSubmit();" />
\r
3928 <input type="reset" tabindex="7" value="<?php echo _TEMPLATE_RESET_BTN?>" />
\r
3931 <th colspan="2"><?php echo _TEMPLATE_ITEMS?> <?php help('templateitems'); ?></th>
\r
3932 <?php $this->_templateEditRow($template, _TEMPLATE_ITEMHEADER, 'ITEM_HEADER', '', 8);
\r
3933 $this->_templateEditRow($template, _TEMPLATE_ITEMBODY, 'ITEM', '', 9, 1);
\r
3934 $this->_templateEditRow($template, _TEMPLATE_ITEMFOOTER, 'ITEM_FOOTER', '', 10);
\r
3935 $this->_templateEditRow($template, _TEMPLATE_MORELINK, 'MORELINK', 'morelink', 20);
\r
3936 $this->_templateEditRow($template, _TEMPLATE_EDITLINK, 'EDITLINK', 'editlink', 25);
\r
3937 $this->_templateEditRow($template, _TEMPLATE_NEW, 'NEW', 'new', 30);
\r
3940 <th colspan="2"><?php echo _TEMPLATE_COMMENTS_ANY?> <?php help('templatecomments'); ?></th>
\r
3941 <?php $this->_templateEditRow($template, _TEMPLATE_CHEADER, 'COMMENTS_HEADER', 'commentheaders', 40);
\r
3942 $this->_templateEditRow($template, _TEMPLATE_CBODY, 'COMMENTS_BODY', 'commentbody', 50, 1);
\r
3943 $this->_templateEditRow($template, _TEMPLATE_CFOOTER, 'COMMENTS_FOOTER', 'commentheaders', 60);
\r
3944 $this->_templateEditRow($template, _TEMPLATE_CONE, 'COMMENTS_ONE', 'commentwords', 70);
\r
3945 $this->_templateEditRow($template, _TEMPLATE_CMANY, 'COMMENTS_MANY', 'commentwords', 80);
\r
3946 $this->_templateEditRow($template, _TEMPLATE_CMORE, 'COMMENTS_CONTINUED', 'commentcontinued', 90);
\r
3947 $this->_templateEditRow($template, _TEMPLATE_CMEXTRA, 'COMMENTS_AUTH', 'memberextra', 100);
\r
3950 <th colspan="2"><?php echo _TEMPLATE_COMMENTS_NONE?> <?php help('templatecomments'); ?></th>
\r
3952 $this->_templateEditRow($template, _TEMPLATE_CNONE, 'COMMENTS_NONE', '', 110);
\r
3955 <th colspan="2"><?php echo _TEMPLATE_COMMENTS_TOOMUCH?> <?php help('templatecomments'); ?></th>
\r
3956 <?php $this->_templateEditRow($template, _TEMPLATE_CTOOMUCH, 'COMMENTS_TOOMUCH', '', 120);
\r
3959 <th colspan="2"><?php echo _TEMPLATE_ARCHIVELIST?> <?php help('templatearchivelists'); ?></th>
\r
3960 <?php $this->_templateEditRow($template, _TEMPLATE_AHEADER, 'ARCHIVELIST_HEADER', '', 130);
\r
3961 $this->_templateEditRow($template, _TEMPLATE_AITEM, 'ARCHIVELIST_LISTITEM', '', 140);
\r
3962 $this->_templateEditRow($template, _TEMPLATE_AFOOTER, 'ARCHIVELIST_FOOTER', '', 150);
\r
3965 <th colspan="2"><?php echo _TEMPLATE_BLOGLIST?> <?php help('templatebloglists'); ?></th>
\r
3966 <?php $this->_templateEditRow($template, _TEMPLATE_BLOGHEADER, 'BLOGLIST_HEADER', '', 160);
\r
3967 $this->_templateEditRow($template, _TEMPLATE_BLOGITEM, 'BLOGLIST_LISTITEM', '', 170);
\r
3968 $this->_templateEditRow($template, _TEMPLATE_BLOGFOOTER, 'BLOGLIST_FOOTER', '', 180);
\r
3971 <th colspan="2"><?php echo _TEMPLATE_CATEGORYLIST?> <?php help('templatecategorylists'); ?></th>
\r
3972 <?php $this->_templateEditRow($template, _TEMPLATE_CATHEADER, 'CATLIST_HEADER', '', 190);
\r
3973 $this->_templateEditRow($template, _TEMPLATE_CATITEM, 'CATLIST_LISTITEM', '', 200);
\r
3974 $this->_templateEditRow($template, _TEMPLATE_CATFOOTER, 'CATLIST_FOOTER', '', 210);
\r
3977 <th colspan="2"><?php echo _TEMPLATE_DATETIME?></th>
\r
3978 <?php $this->_templateEditRow($template, _TEMPLATE_DHEADER, 'DATE_HEADER', 'dateheads', 220);
\r
3979 $this->_templateEditRow($template, _TEMPLATE_DFOOTER, 'DATE_FOOTER', 'dateheads', 230);
\r
3980 $this->_templateEditRow($template, _TEMPLATE_DFORMAT, 'FORMAT_DATE', 'datetime', 240);
\r
3981 $this->_templateEditRow($template, _TEMPLATE_TFORMAT, 'FORMAT_TIME', 'datetime', 250);
\r
3982 $this->_templateEditRow($template, _TEMPLATE_LOCALE, 'LOCALE', 'locale', 260);
\r
3985 <th colspan="2"><?php echo _TEMPLATE_IMAGE?> <?php help('templatepopups'); ?></th>
\r
3986 <?php $this->_templateEditRow($template, _TEMPLATE_PCODE, 'POPUP_CODE', '', 270);
\r
3987 $this->_templateEditRow($template, _TEMPLATE_ICODE, 'IMAGE_CODE', '', 280);
\r
3988 $this->_templateEditRow($template, _TEMPLATE_MCODE, 'MEDIA_CODE', '', 290);
\r
3991 <th colspan="2"><?php echo _TEMPLATE_SEARCH?></th>
\r
3992 <?php $this->_templateEditRow($template, _TEMPLATE_SHIGHLIGHT, 'SEARCH_HIGHLIGHT', 'highlight',300);
\r
3993 $this->_templateEditRow($template, _TEMPLATE_SNOTFOUND, 'SEARCH_NOTHINGFOUND', 'nothingfound',310);
\r
3996 <th colspan="2"><?php echo _TEMPLATE_PLUGIN_FIELDS?></th>
\r
3999 $pluginfields = array();
\r
4000 $manager->notify('TemplateExtraFields',array('fields'=>&$pluginfields));
\r
4002 foreach ($pluginfields as $pfkey=>$pfvalue) {
\r
4003 echo "</tr><tr>\n";
\r
4004 echo '<th colspan="2">'.htmlentities($pfkey)."</th>\n";
\r
4005 foreach ($pfvalue as $pffield=>$pfdesc) {
\r
4006 $this->_templateEditRow($template, $pfdesc, $pffield, '',++$tab,0);
\r
4011 <th colspan="2"><?php echo _TEMPLATE_UPDATE?></th>
\r
4013 <td><?php echo _TEMPLATE_UPDATE?></td>
\r
4015 <input type="submit" tabindex="800" value="<?php echo _TEMPLATE_UPDATE_BTN?>" onclick="return checkSubmit();" />
\r
4016 <input type="reset" tabindex="810" value="<?php echo _TEMPLATE_RESET_BTN?>" />
\r
4023 $this->pagefoot();
\r
4027 * @todo document this
\r
4029 function _templateEditRow(&$template, $description, $name, $help = '', $tabindex = 0, $big = 0) {
\r
4030 static $count = 1;
\r
4031 if (!isset($template[$name])) $template[$name] = '';
\r
4034 <td><?php echo $description?> <?php if ($help) help('template'.$help); ?></td>
\r
4035 <td id="td<?php echo $count?>"><textarea class="templateedit" name="<?php echo $name?>" tabindex="<?php echo $tabindex?>" cols="50" rows="<?php echo $big?10:5?>" id="textarea<?php echo $count?>"><?php echo htmlspecialchars($template[$name]); ?></textarea></td>
\r
4040 * @todo document this
\r
4042 function action_templateupdate() {
\r
4043 global $member, $manager;
\r
4045 $templateid = intRequestVar('templateid');
\r
4047 $member->isAdmin() or $this->disallow();
\r
4049 $name = postVar('tname');
\r
4050 $desc = postVar('tdesc');
\r
4052 if (!isValidTemplateName($name))
\r
4053 $this->error(_ERROR_BADTEMPLATENAME);
\r
4055 if ((TEMPLATE::getNameFromId($templateid) != $name) && TEMPLATE::exists($name))
\r
4056 $this->error(_ERROR_DUPTEMPLATENAME);
\r
4059 $name = addslashes($name);
\r
4060 $desc = addslashes($desc);
\r
4062 // 1. Remove all template parts
\r
4063 $query = 'DELETE FROM '.sql_table('template').' WHERE tdesc=' . $templateid;
\r
4064 sql_query($query);
\r
4066 // 2. Update description
\r
4067 $query = 'UPDATE '.sql_table('template_desc').' SET'
\r
4068 . " tdname='" . $name . "',"
\r
4069 . " tddesc='" . $desc . "'"
\r
4070 . " WHERE tdnumber=" . $templateid;
\r
4071 sql_query($query);
\r
4073 // 3. Add non-empty template parts
\r
4074 $this->addToTemplate($templateid, 'ITEM_HEADER', postVar('ITEM_HEADER'));
\r
4075 $this->addToTemplate($templateid, 'ITEM', postVar('ITEM'));
\r
4076 $this->addToTemplate($templateid, 'ITEM_FOOTER', postVar('ITEM_FOOTER'));
\r
4077 $this->addToTemplate($templateid, 'MORELINK', postVar('MORELINK'));
\r
4078 $this->addToTemplate($templateid, 'EDITLINK', postVar('EDITLINK'));
\r
4079 $this->addToTemplate($templateid, 'NEW', postVar('NEW'));
\r
4080 $this->addToTemplate($templateid, 'COMMENTS_HEADER', postVar('COMMENTS_HEADER'));
\r
4081 $this->addToTemplate($templateid, 'COMMENTS_BODY', postVar('COMMENTS_BODY'));
\r
4082 $this->addToTemplate($templateid, 'COMMENTS_FOOTER', postVar('COMMENTS_FOOTER'));
\r
4083 $this->addToTemplate($templateid, 'COMMENTS_CONTINUED', postVar('COMMENTS_CONTINUED'));
\r
4084 $this->addToTemplate($templateid, 'COMMENTS_TOOMUCH', postVar('COMMENTS_TOOMUCH'));
\r
4085 $this->addToTemplate($templateid, 'COMMENTS_AUTH', postVar('COMMENTS_AUTH'));
\r
4086 $this->addToTemplate($templateid, 'COMMENTS_ONE', postVar('COMMENTS_ONE'));
\r
4087 $this->addToTemplate($templateid, 'COMMENTS_MANY', postVar('COMMENTS_MANY'));
\r
4088 $this->addToTemplate($templateid, 'COMMENTS_NONE', postVar('COMMENTS_NONE'));
\r
4089 $this->addToTemplate($templateid, 'ARCHIVELIST_HEADER', postVar('ARCHIVELIST_HEADER'));
\r
4090 $this->addToTemplate($templateid, 'ARCHIVELIST_LISTITEM', postVar('ARCHIVELIST_LISTITEM'));
\r
4091 $this->addToTemplate($templateid, 'ARCHIVELIST_FOOTER', postVar('ARCHIVELIST_FOOTER'));
\r
4092 $this->addToTemplate($templateid, 'BLOGLIST_HEADER', postVar('BLOGLIST_HEADER'));
\r
4093 $this->addToTemplate($templateid, 'BLOGLIST_LISTITEM', postVar('BLOGLIST_LISTITEM'));
\r
4094 $this->addToTemplate($templateid, 'BLOGLIST_FOOTER', postVar('BLOGLIST_FOOTER'));
\r
4095 $this->addToTemplate($templateid, 'CATLIST_HEADER', postVar('CATLIST_HEADER'));
\r
4096 $this->addToTemplate($templateid, 'CATLIST_LISTITEM', postVar('CATLIST_LISTITEM'));
\r
4097 $this->addToTemplate($templateid, 'CATLIST_FOOTER', postVar('CATLIST_FOOTER'));
\r
4098 $this->addToTemplate($templateid, 'DATE_HEADER', postVar('DATE_HEADER'));
\r
4099 $this->addToTemplate($templateid, 'DATE_FOOTER', postVar('DATE_FOOTER'));
\r
4100 $this->addToTemplate($templateid, 'FORMAT_DATE', postVar('FORMAT_DATE'));
\r
4101 $this->addToTemplate($templateid, 'FORMAT_TIME', postVar('FORMAT_TIME'));
\r
4102 $this->addToTemplate($templateid, 'LOCALE', postVar('LOCALE'));
\r
4103 $this->addToTemplate($templateid, 'SEARCH_HIGHLIGHT', postVar('SEARCH_HIGHLIGHT'));
\r
4104 $this->addToTemplate($templateid, 'SEARCH_NOTHINGFOUND', postVar('SEARCH_NOTHINGFOUND'));
\r
4105 $this->addToTemplate($templateid, 'POPUP_CODE', postVar('POPUP_CODE'));
\r
4106 $this->addToTemplate($templateid, 'MEDIA_CODE', postVar('MEDIA_CODE'));
\r
4107 $this->addToTemplate($templateid, 'IMAGE_CODE', postVar('IMAGE_CODE'));
\r
4109 $pluginfields = array();
\r
4110 $manager->notify('TemplateExtraFields',array('fields'=>&$pluginfields));
\r
4111 foreach ($pluginfields as $pfkey=>$pfvalue) {
\r
4112 foreach ($pfvalue as $pffield=>$pfdesc) {
\r
4113 $this->addToTemplate($templateid, $pffield, postVar($pffield));
\r
4117 // jump back to template edit
\r
4118 $this->action_templateedit(_TEMPLATE_UPDATED);
\r
4123 * @todo document this
\r
4125 function addToTemplate($id, $partname, $content) {
\r
4126 $partname = addslashes($partname);
\r
4127 $content = addslashes($content);
\r
4129 $id = intval($id);
\r
4131 // don't add empty parts:
\r
4132 if (!trim($content)) return -1;
\r
4134 $query = 'INSERT INTO '.sql_table('template')." (tdesc, tpartname, tcontent) "
\r
4135 . "VALUES ($id, '$partname', '$content')";
\r
4136 sql_query($query) or exit(_ADMIN_SQLDIE_QUERYERROR . mysql_error());
\r
4137 return mysql_insert_id();
\r
4141 * @todo document this
\r
4143 function action_templatedelete() {
\r
4144 global $member, $manager;
\r
4146 $member->isAdmin() or $this->disallow();
\r
4148 $templateid = intRequestVar('templateid');
\r
4149 // TODO: check if template can be deleted
\r
4151 $this->pagehead();
\r
4153 $name = TEMPLATE::getNameFromId($templateid);
\r
4154 $desc = TEMPLATE::getDesc($templateid);
\r
4157 <h2><?php echo _DELETE_CONFIRM?></h2>
\r
4160 <?php echo _CONFIRMTXT_TEMPLATE?><b><?php echo htmlspecialchars($name)?></b> (<?php echo htmlspecialchars($desc) ?>)
\r
4163 <form method="post" action="index.php"><div>
\r
4164 <input type="hidden" name="action" value="templatedeleteconfirm" />
\r
4165 <?php $manager->addTicketHidden() ?>
\r
4166 <input type="hidden" name="templateid" value="<?php echo $templateid ?>" />
\r
4167 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
\r
4170 $this->pagefoot();
\r
4174 * @todo document this
\r
4176 function action_templatedeleteconfirm() {
\r
4177 global $member, $manager;
\r
4179 $templateid = intRequestVar('templateid');
\r
4181 $member->isAdmin() or $this->disallow();
\r
4183 $manager->notify('PreDeleteTemplate', array('templateid' => $templateid));
\r
4185 // 1. delete description
\r
4186 sql_query('DELETE FROM '.sql_table('template_desc').' WHERE tdnumber=' . $templateid);
\r
4188 // 2. delete parts
\r
4189 sql_query('DELETE FROM '.sql_table('template').' WHERE tdesc=' . $templateid);
\r
4191 $manager->notify('PostDeleteTemplate', array('templateid' => $templateid));
\r
4193 $this->action_templateoverview();
\r
4197 * @todo document this
\r
4199 function action_templatenew() {
\r
4202 $member->isAdmin() or $this->disallow();
\r
4204 $name = postVar('name');
\r
4205 $desc = postVar('desc');
\r
4207 if (!isValidTemplateName($name))
\r
4208 $this->error(_ERROR_BADTEMPLATENAME);
\r
4210 if (TEMPLATE::exists($name))
\r
4211 $this->error(_ERROR_DUPTEMPLATENAME);
\r
4213 $newTemplateId = TEMPLATE::createNew($name, $desc);
\r
4215 $this->action_templateoverview();
\r
4219 * @todo document this
\r
4221 function action_templateclone() {
\r
4224 $templateid = intRequestVar('templateid');
\r
4226 $member->isAdmin() or $this->disallow();
\r
4228 // 1. read old template
\r
4229 $name = TEMPLATE::getNameFromId($templateid);
\r
4230 $desc = TEMPLATE::getDesc($templateid);
\r
4232 // 2. create desc thing
\r
4233 $name = "cloned" . $name;
\r
4235 // if a template with that name already exists:
\r
4236 if (TEMPLATE::exists($name)) {
\r
4238 while (TEMPLATE::exists($name . $i))
\r
4243 $newid = TEMPLATE::createNew($name, $desc);
\r
4245 // 3. create clone
\r
4246 // go through parts of old template and add them to the new one
\r
4247 $res = sql_query('SELECT tpartname, tcontent FROM '.sql_table('template').' WHERE tdesc=' . $templateid);
\r
4248 while ($o = mysql_fetch_object($res)) {
\r
4249 $this->addToTemplate($newid, $o->tpartname, $o->tcontent);
\r
4252 $this->action_templateoverview();
\r
4256 * @todo document this
\r
4258 function action_skinoverview() {
\r
4259 global $member, $manager;
\r
4261 $member->isAdmin() or $this->disallow();
\r
4263 $this->pagehead();
\r
4265 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
\r
4267 echo '<h2>' . _SKIN_EDIT_TITLE . '</h2>';
\r
4269 echo '<h3>' . _SKIN_AVAILABLE_TITLE . '</h3>';
\r
4271 $query = 'SELECT * FROM '.sql_table('skin_desc').' ORDER BY sdname';
\r
4272 $template['content'] = 'skinlist';
\r
4273 $template['tabindex'] = 10;
\r
4274 showlist($query,'table',$template);
\r
4276 echo '<h3>' . _SKIN_NEW_TITLE . '</h3>';
\r
4279 <form method="post" action="index.php">
\r
4282 <input name="action" value="skinnew" type="hidden" />
\r
4283 <?php $manager->addTicketHidden() ?>
\r
4285 <td><?php echo _SKIN_NAME?> <?php help('shortnames');?></td>
\r
4286 <td><input name="name" tabindex="10010" maxlength="20" size="20" /></td>
\r
4288 <td><?php echo _SKIN_DESC?></td>
\r
4289 <td><input name="desc" tabindex="10020" maxlength="200" size="50" /></td>
\r
4291 <td><?php echo _SKIN_CREATE?></td>
\r
4292 <td><input type="submit" tabindex="10030" value="<?php echo _SKIN_CREATE_BTN?>" onclick="return checkSubmit();" /></td>
\r
4299 $this->pagefoot();
\r
4303 * @todo document this
\r
4305 function action_skinnew() {
\r
4308 $member->isAdmin() or $this->disallow();
\r
4310 $name = trim(postVar('name'));
\r
4311 $desc = trim(postVar('desc'));
\r
4313 if (!isValidSkinName($name))
\r
4314 $this->error(_ERROR_BADSKINNAME);
\r
4316 if (SKIN::exists($name))
\r
4317 $this->error(_ERROR_DUPSKINNAME);
\r
4319 $newId = SKIN::createNew($name, $desc);
\r
4321 $this->action_skinoverview();
\r
4325 * @todo document this
\r
4327 function action_skinedit() {
\r
4328 global $member, $manager;
\r
4330 $skinid = intRequestVar('skinid');
\r
4332 $member->isAdmin() or $this->disallow();
\r
4334 $skin =& new SKIN($skinid);
\r
4336 $this->pagehead();
\r
4339 <a href="index.php?action=skinoverview">(<?php echo _SKIN_BACK?>)</a>
\r
4341 <h2><?php echo _SKIN_EDITONE_TITLE?> '<?php echo $skin->getName() ?>'</h2>
\r
4343 <h3><?php echo _SKIN_PARTS_TITLE?></h3>
\r
4344 <?php echo _SKIN_PARTS_MSG?>
\r
4346 <li><a tabindex="10" href="index.php?action=skinedittype&skinid=<?php echo $skinid ?>&type=index"><?php echo _SKIN_PART_MAIN?></a> <?php help('skinpartindex')?></li>
\r
4347 <li><a tabindex="20" href="index.php?action=skinedittype&skinid=<?php echo $skinid ?>&type=item"><?php echo _SKIN_PART_ITEM?></a> <?php help('skinpartitem')?></li>
\r
4348 <li><a tabindex="30" href="index.php?action=skinedittype&skinid=<?php echo $skinid ?>&type=archivelist"><?php echo _SKIN_PART_ALIST?></a> <?php help('skinpartarchivelist')?></li>
\r
4349 <li><a tabindex="40" href="index.php?action=skinedittype&skinid=<?php echo $skinid ?>&type=archive"><?php echo _SKIN_PART_ARCHIVE?></a> <?php help('skinpartarchive')?></li>
\r
4350 <li><a tabindex="50" href="index.php?action=skinedittype&skinid=<?php echo $skinid ?>&type=search"><?php echo _SKIN_PART_SEARCH?></a> <?php help('skinpartsearch')?></li>
\r
4351 <li><a tabindex="60" href="index.php?action=skinedittype&skinid=<?php echo $skinid ?>&type=error"><?php echo _SKIN_PART_ERROR?></a> <?php help('skinparterror')?></li>
\r
4352 <li><a tabindex="70" href="index.php?action=skinedittype&skinid=<?php echo $skinid ?>&type=member"><?php echo _SKIN_PART_MEMBER?></a> <?php help('skinpartmember')?></li>
\r
4353 <li><a tabindex="75" href="index.php?action=skinedittype&skinid=<?php echo $skinid ?>&type=imagepopup"><?php echo _SKIN_PART_POPUP?></a> <?php help('skinpartimagepopup')?></li>
\r
4358 $query = "SELECT stype FROM " . sql_table('skin') . " WHERE stype NOT IN ('index', 'item', 'error', 'search', 'archive', 'archivelist', 'imagepopup', 'member') and sdesc = " . $skinid;
\r
4359 $res = sql_query($query);
\r
4361 echo '<h3>' . _SKIN_PARTS_SPECIAL . '</h3>';
\r
4362 echo '<form method="get" action="index.php">' . "\r\n";
\r
4363 echo '<input type="hidden" name="action" value="skinedittype" />' . "\r\n";
\r
4364 echo '<input type="hidden" name="skinid" value="' . $skinid . '" />' . "\r\n";
\r
4365 echo '<input name="type" tabindex="89" size="20" maxlength="20" />' . "\r\n";
\r
4366 echo '<input type="submit" tabindex="140" value="' . _SKIN_CREATE . '" onclick="return checkSubmit();" />' . "\r\n";
\r
4367 echo '</form>' . "\r\n";
\r
4369 if ($res && mysql_num_rows($res) > 0) {
\r
4373 while ($row = mysql_fetch_assoc($res)) {
\r
4374 echo '<li><a tabindex="' . ($tabstart++) . '" href="index.php?action=skinedittype&skinid=' . $skinid . '&type=' . htmlspecialchars(strtolower($row['stype'])) . '">' . htmlspecialchars(ucfirst($row['stype'])) . '</a> (<a tabindex="' . ($tabstart++) . '" href="index.php?action=skinremovetype&skinid=' . $skinid . '&type=' . htmlspecialchars(strtolower($row['stype'])) . '">remove</a>)</li>';
\r
4382 <h3><?php echo _SKIN_GENSETTINGS_TITLE; ?></h3>
\r
4383 <form method="post" action="index.php">
\r
4386 <input type="hidden" name="action" value="skineditgeneral" />
\r
4387 <?php $manager->addTicketHidden() ?>
\r
4388 <input type="hidden" name="skinid" value="<?php echo $skinid ?>" />
\r
4390 <td><?php echo _SKIN_NAME?> <?php help('shortnames');?></td>
\r
4391 <td><input name="name" tabindex="90" value="<?php echo htmlspecialchars($skin->getName()) ?>" maxlength="20" size="20" /></td>
\r
4393 <td><?php echo _SKIN_DESC?></td>
\r
4394 <td><input name="desc" tabindex="100" value="<?php echo htmlspecialchars($skin->getDescription()) ?>" maxlength="200" size="50" /></td>
\r
4396 <td><?php echo _SKIN_TYPE?></td>
\r
4397 <td><input name="type" tabindex="110" value="<?php echo htmlspecialchars($skin->getContentType()) ?>" maxlength="40" size="20" /></td>
\r
4399 <td><?php echo _SKIN_INCLUDE_MODE?> <?php help('includemode')?></td>
\r
4400 <td><?php $this->input_yesno('inc_mode',$skin->getIncludeMode(),120,'skindir','normal',_PARSER_INCMODE_SKINDIR,_PARSER_INCMODE_NORMAL);?></td>
\r
4402 <td><?php echo _SKIN_INCLUDE_PREFIX?> <?php help('includeprefix')?></td>
\r
4403 <td><input name="inc_prefix" tabindex="130" value="<?php echo htmlspecialchars($skin->getIncludePrefix()) ?>" maxlength="40" size="20" /></td>
\r
4405 <td><?php echo _SKIN_CHANGE?></td>
\r
4406 <td><input type="submit" tabindex="140" value="<?php echo _SKIN_CHANGE_BTN?>" onclick="return checkSubmit();" /></td>
\r
4413 <?php $this->pagefoot();
\r
4417 * @todo document this
\r
4419 function action_skineditgeneral() {
\r
4422 $skinid = intRequestVar('skinid');
\r
4424 $member->isAdmin() or $this->disallow();
\r
4426 $name = postVar('name');
\r
4427 $desc = postVar('desc');
\r
4428 $type = postVar('type');
\r
4429 $inc_mode = postVar('inc_mode');
\r
4430 $inc_prefix = postVar('inc_prefix');
\r
4432 $skin =& new SKIN($skinid);
\r
4435 if (!isValidSkinName($name))
\r
4436 $this->error(_ERROR_BADSKINNAME);
\r
4438 if (($skin->getName() != $name) && SKIN::exists($name))
\r
4439 $this->error(_ERROR_DUPSKINNAME);
\r
4441 if (!$type) $type = 'text/html';
\r
4442 if (!$inc_mode) $inc_mode = 'normal';
\r
4444 // 2. Update description
\r
4445 $skin->updateGeneralInfo($name, $desc, $type, $inc_mode, $inc_prefix);
\r
4447 $this->action_skinedit();
\r
4452 * @todo document this
\r
4454 function action_skinedittype($msg = '') {
\r
4455 global $member, $manager;
\r
4457 $skinid = intRequestVar('skinid');
\r
4458 $type = requestVar('type');
\r
4460 $member->isAdmin() or $this->disallow();
\r
4462 $type = trim($type);
\r
4463 $type = strtolower($type);
\r
4465 if (!isValidShortName($type)) {
\r
4466 $this->error(_ERROR_SKIN_PARTS_SPECIAL_FORMAT);
\r
4469 $skin =& new SKIN($skinid);
\r
4471 $friendlyNames = SKIN::getFriendlyNames();
\r
4473 $this->pagehead();
\r
4475 <p>(<a href="index.php?action=skinoverview"><?php echo _SKIN_GOBACK?></a>)</p>
\r
4477 <h2><?php echo _SKIN_EDITPART_TITLE?> '<?php echo htmlspecialchars($skin->getName()) ?>': <?php echo htmlspecialchars(isset($friendlyNames[$type]) ? $friendlyNames[$type] : ucfirst($type)); ?></h2>
\r
4479 <?php if ($msg) echo "<p>"._MESSAGE.": $msg</p>";
\r
4483 <form method="post" action="index.php">
\r
4486 <input type="hidden" name="action" value="skinupdate" />
\r
4487 <?php $manager->addTicketHidden() ?>
\r
4488 <input type="hidden" name="skinid" value="<?php echo $skinid ?>" />
\r
4489 <input type="hidden" name="type" value="<?php echo $type ?>" />
\r
4491 <input type="submit" value="<?php echo _SKIN_UPDATE_BTN?>" onclick="return checkSubmit();" />
\r
4492 <input type="reset" value="<?php echo _SKIN_RESET_BTN?>" />
\r
4493 (skin type: <?php echo htmlspecialchars(isset($friendlyNames[$type]) ? $friendlyNames[$type] : ucfirst($type)); ?>)
\r
4494 <?php if (in_array($type, array('index', 'item', 'archivelist', 'archive', 'search', 'error', 'member', 'imagepopup'))) {
\r
4495 help('skinpart' . $type);
\r
4497 help('skinpartspecial');
\r
4501 <textarea class="skinedit" tabindex="10" rows="20" cols="80" name="content"><?php echo htmlspecialchars($skin->getContent($type)) ?></textarea>
\r
4504 <input type="submit" tabindex="20" value="<?php echo _SKIN_UPDATE_BTN?>" onclick="return checkSubmit();" />
\r
4505 <input type="reset" value="<?php echo _SKIN_RESET_BTN?>" />
\r
4506 (skin type: <?php echo htmlspecialchars(isset($friendlyNames[$type]) ? $friendlyNames[$type] : ucfirst($type)); ?>)
\r
4509 <?php echo _SKIN_ALLOWEDVARS?>
\r
4510 <?php $actions = SKIN::getAllowedActionsForType($type);
\r
4514 while ($current = array_shift($actions)) {
\r
4515 // skip deprecated vars
\r
4516 if ($current == 'ifcat') continue;
\r
4517 if ($current == 'imagetext') continue;
\r
4518 if ($current == 'vars') continue;
\r
4520 echo helplink('skinvar-' . $current) . "$current</a>";
\r
4521 if (count($actions) != 0) echo ", ";
\r
4523 echo '<br /><br />' . _SKINEDIT_ALLOWEDBLOGS;
\r
4524 $query = 'SELECT bshortname, bname FROM '.sql_table('blog');
\r
4525 showlist($query,'table',array('content'=>'shortblognames'));
\r
4526 echo '<br />' . _SKINEDIT_ALLOWEDTEMPLATESS;
\r
4527 $query = 'SELECT tdname as name, tddesc as description FROM '.sql_table('template_desc');
\r
4528 showlist($query,'table',array('content'=>'shortnames'));
\r
4529 echo '</div></form>';
\r
4530 $this->pagefoot();
\r
4534 * @todo document this
\r
4536 function action_skinupdate() {
\r
4539 $skinid = intRequestVar('skinid');
\r
4540 $content = trim(postVar('content'));
\r
4541 $type = postVar('type');
\r
4543 $member->isAdmin() or $this->disallow();
\r
4545 $skin =& new SKIN($skinid);
\r
4546 $skin->update($type, $content);
\r
4548 $this->action_skinedittype(_SKIN_UPDATED);
\r
4552 * @todo document this
\r
4554 function action_skindelete() {
\r
4555 global $member, $manager, $CONF;
\r
4557 $skinid = intRequestVar('skinid');
\r
4559 $member->isAdmin() or $this->disallow();
\r
4561 // don't allow default skin to be deleted
\r
4562 if ($skinid == $CONF['BaseSkin'])
\r
4563 $this->error(_ERROR_DEFAULTSKIN);
\r
4565 // don't allow deletion of default skins for blogs
\r
4566 $query = 'SELECT bname FROM '.sql_table('blog').' WHERE bdefskin=' . $skinid;
\r
4567 $r = sql_query($query);
\r
4568 if ($o = mysql_fetch_object($r))
\r
4569 $this->error(_ERROR_SKINDEFDELETE . htmlspecialchars($o->bname));
\r
4571 $this->pagehead();
\r
4573 $skin =& new SKIN($skinid);
\r
4574 $name = $skin->getName();
\r
4575 $desc = $skin->getDescription();
\r
4578 <h2><?php echo _DELETE_CONFIRM?></h2>
\r
4581 <?php echo _CONFIRMTXT_SKIN?><b><?php echo htmlspecialchars($name) ?></b> (<?php echo htmlspecialchars($desc)?>)
\r
4584 <form method="post" action="index.php"><div>
\r
4585 <input type="hidden" name="action" value="skindeleteconfirm" />
\r
4586 <?php $manager->addTicketHidden() ?>
\r
4587 <input type="hidden" name="skinid" value="<?php echo $skinid ?>" />
\r
4588 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
\r
4591 $this->pagefoot();
\r
4595 * @todo document this
\r
4597 function action_skindeleteconfirm() {
\r
4598 global $member, $CONF, $manager;
\r
4600 $skinid = intRequestVar('skinid');
\r
4602 $member->isAdmin() or $this->disallow();
\r
4604 // don't allow default skin to be deleted
\r
4605 if ($skinid == $CONF['BaseSkin'])
\r
4606 $this->error(_ERROR_DEFAULTSKIN);
\r
4608 // don't allow deletion of default skins for blogs
\r
4609 $query = 'SELECT bname FROM '.sql_table('blog').' WHERE bdefskin=' . $skinid;
\r
4610 $r = sql_query($query);
\r
4611 if ($o = mysql_fetch_object($r))
\r
4612 $this->error(_ERROR_SKINDEFDELETE .$o->bname);
\r
4614 $manager->notify('PreDeleteSkin', array('skinid' => $skinid));
\r
4616 // 1. delete description
\r
4617 sql_query('DELETE FROM '.sql_table('skin_desc').' WHERE sdnumber=' . $skinid);
\r
4619 // 2. delete parts
\r
4620 sql_query('DELETE FROM '.sql_table('skin').' WHERE sdesc=' . $skinid);
\r
4622 $manager->notify('PostDeleteSkin', array('skinid' => $skinid));
\r
4624 $this->action_skinoverview();
\r
4628 * @todo document this
\r
4630 function action_skinremovetype() {
\r
4631 global $member, $manager, $CONF;
\r
4633 $skinid = intRequestVar('skinid');
\r
4634 $skintype = requestVar('type');
\r
4636 if (!isValidShortName($skintype)) {
\r
4637 $this->error(_ERROR_SKIN_PARTS_SPECIAL_DELETE);
\r
4640 $member->isAdmin() or $this->disallow();
\r
4642 // don't allow default skinparts to be deleted
\r
4643 if (in_array($skintype, array('index', 'item', 'archivelist', 'archive', 'search', 'error', 'member', 'imagepopup'))) {
\r
4644 $this->error(_ERROR_SKIN_PARTS_SPECIAL_DELETE);
\r
4647 $this->pagehead();
\r
4649 $skin =& new SKIN($skinid);
\r
4650 $name = $skin->getName();
\r
4651 $desc = $skin->getDescription();
\r
4654 <h2><?php echo _DELETE_CONFIRM?></h2>
\r
4657 <?php echo _CONFIRMTXT_SKIN_PARTS_SPECIAL; ?> <b><?php echo htmlspecialchars($skintype); ?> (<?php echo htmlspecialchars($name); ?>)</b> (<?php echo htmlspecialchars($desc)?>)
\r
4660 <form method="post" action="index.php"><div>
\r
4661 <input type="hidden" name="action" value="skinremovetypeconfirm" />
\r
4662 <?php $manager->addTicketHidden() ?>
\r
4663 <input type="hidden" name="skinid" value="<?php echo $skinid; ?>" />
\r
4664 <input type="hidden" name="type" value="<?php echo htmlspecialchars($skintype); ?>" />
\r
4665 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
\r
4668 $this->pagefoot();
\r
4672 * @todo document this
\r
4674 function action_skinremovetypeconfirm() {
\r
4675 global $member, $CONF, $manager;
\r
4677 $skinid = intRequestVar('skinid');
\r
4678 $skintype = requestVar('type');
\r
4680 if (!isValidShortName($skintype)) {
\r
4681 $this->error(_ERROR_SKIN_PARTS_SPECIAL_DELETE);
\r
4684 $member->isAdmin() or $this->disallow();
\r
4686 // don't allow default skinparts to be deleted
\r
4687 if (in_array($skintype, array('index', 'item', 'archivelist', 'archive', 'search', 'error', 'member', 'imagepopup'))) {
\r
4688 $this->error(_ERROR_SKIN_PARTS_SPECIAL_DELETE);
\r
4691 $manager->notify('PreDeleteSkinPart', array('skinid' => $skinid, 'skintype' => $skintype));
\r
4694 sql_query('DELETE FROM '.sql_table('skin').' WHERE sdesc=' . $skinid . ' AND stype=\'' . $skintype . '\'');
\r
4696 $manager->notify('PostDeleteSkinPart', array('skinid' => $skinid, 'skintype' => $skintype));
\r
4698 $this->action_skinedit();
\r
4702 * @todo document this
\r
4704 function action_skinclone() {
\r
4707 $skinid = intRequestVar('skinid');
\r
4709 $member->isAdmin() or $this->disallow();
\r
4711 // 1. read skin to clone
\r
4712 $skin =& new SKIN($skinid);
\r
4714 $name = "clone_" . $skin->getName();
\r
4716 // if a skin with that name already exists:
\r
4717 if (SKIN::exists($name)) {
\r
4719 while (SKIN::exists($name . $i))
\r
4724 // 2. create skin desc
\r
4725 $newid = SKIN::createNew(
\r
4727 $skin->getDescription(),
\r
4728 $skin->getContentType(),
\r
4729 $skin->getIncludeMode(),
\r
4730 $skin->getIncludePrefix()
\r
4736 $this->skinclonetype($skin, $newid, 'index');
\r
4737 $this->skinclonetype($skin, $newid, 'item');
\r
4738 $this->skinclonetype($skin, $newid, 'archivelist');
\r
4739 $this->skinclonetype($skin, $newid, 'archive');
\r
4740 $this->skinclonetype($skin, $newid, 'search');
\r
4741 $this->skinclonetype($skin, $newid, 'error');
\r
4742 $this->skinclonetype($skin, $newid, 'member');
\r
4743 $this->skinclonetype($skin, $newid, 'imagepopup');
\r
4746 $query = "SELECT stype FROM " . sql_table('skin') . " WHERE sdesc = " . $skinid;
\r
4747 $res = sql_query($query);
\r
4748 while ($row = mysql_fetch_assoc($res)) {
\r
4749 $this->skinclonetype($skin, $newid, $row['stype']);
\r
4752 $this->action_skinoverview();
\r
4757 * @todo document this
\r
4759 function skinclonetype($skin, $newid, $type) {
\r
4760 $newid = intval($newid);
\r
4761 $content = $skin->getContent($type);
\r
4763 $query = 'INSERT INTO '.sql_table('skin')." (sdesc, scontent, stype) VALUES ($newid,'". addslashes($content)."', '". addslashes($type)."')";
\r
4764 sql_query($query);
\r
4769 * @todo document this
\r
4771 function action_settingsedit() {
\r
4772 global $member, $manager, $CONF, $DIR_NUCLEUS, $DIR_MEDIA;
\r
4774 $member->isAdmin() or $this->disallow();
\r
4776 $this->pagehead();
\r
4778 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
\r
4781 <h2><?php echo _SETTINGS_TITLE?></h2>
\r
4783 <form action="index.php" method="post">
\r
4786 <input type="hidden" name="action" value="settingsupdate" />
\r
4787 <?php $manager->addTicketHidden() ?>
\r
4790 <th colspan="2"><?php echo _SETTINGS_SUB_GENERAL?></th>
\r
4792 <td><?php echo _SETTINGS_DEFBLOG?> <?php help('defaultblog'); ?></td>
\r
4795 $query = 'SELECT bname as text, bnumber as value'
\r
4796 . ' FROM '.sql_table('blog');
\r
4797 $template['name'] = 'DefaultBlog';
\r
4798 $template['selected'] = $CONF['DefaultBlog'];
\r
4799 $template['tabindex'] = 10;
\r
4800 showlist($query,'select',$template);
\r
4804 <td><?php echo _SETTINGS_BASESKIN?> <?php help('baseskin'); ?></td>
\r
4807 $query = 'SELECT sdname as text, sdnumber as value'
\r
4808 . ' FROM '.sql_table('skin_desc');
\r
4809 $template['name'] = 'BaseSkin';
\r
4810 $template['selected'] = $CONF['BaseSkin'];
\r
4811 $template['tabindex'] = 1;
\r
4812 showlist($query,'select',$template);
\r
4816 <td><?php echo _SETTINGS_ADMINMAIL?></td>
\r
4817 <td><input name="AdminEmail" tabindex="10010" size="40" value="<?php echo htmlspecialchars($CONF['AdminEmail']) ?>" /></td>
\r
4819 <td><?php echo _SETTINGS_SITENAME?></td>
\r
4820 <td><input name="SiteName" tabindex="10020" size="40" value="<?php echo htmlspecialchars($CONF['SiteName']) ?>" /></td>
\r
4822 <td><?php echo _SETTINGS_SITEURL?></td>
\r
4823 <td><input name="IndexURL" tabindex="10030" size="40" value="<?php echo htmlspecialchars($CONF['IndexURL']) ?>" /></td>
\r
4825 <td><?php echo _SETTINGS_ADMINURL?></td>
\r
4826 <td><input name="AdminURL" tabindex="10040" size="40" value="<?php echo htmlspecialchars($CONF['AdminURL']) ?>" /></td>
\r
4828 <td><?php echo _SETTINGS_PLUGINURL?> <?php help('pluginurl');?></td>
\r
4829 <td><input name="PluginURL" tabindex="10045" size="40" value="<?php echo htmlspecialchars($CONF['PluginURL']) ?>" /></td>
\r
4831 <td><?php echo _SETTINGS_SKINSURL?> <?php help('skinsurl');?></td>
\r
4832 <td><input name="SkinsURL" tabindex="10046" size="40" value="<?php echo htmlspecialchars($CONF['SkinsURL']) ?>" /></td>
\r
4834 <td><?php echo _SETTINGS_ACTIONSURL?> <?php help('actionurl');?></td>
\r
4835 <td><input name="ActionURL" tabindex="10047" size="40" value="<?php echo htmlspecialchars($CONF['ActionURL']) ?>" /></td>
\r
4837 <td><?php echo _SETTINGS_LANGUAGE?> <?php help('language'); ?>
\r
4841 <select name="Language" tabindex="10050">
\r
4842 <?php // show a dropdown list of all available languages
\r
4844 $dirhandle = opendir($DIR_LANG);
\r
4845 while ($filename = readdir($dirhandle)) {
\r
4846 if (ereg("^(.*)\.php$",$filename,$matches)) {
\r
4847 $name = $matches[1];
\r
4848 echo "<option value='$name'";
\r
4849 if ($name == $CONF['Language'])
\r
4850 echo " selected='selected'";
\r
4851 echo ">$name</option>";
\r
4854 closedir($dirhandle);
\r
4861 <td><?php echo _SETTINGS_DISABLESITE?> <?php help('disablesite'); ?>
\r
4863 <td><?php $this->input_yesno('DisableSite',$CONF['DisableSite'],10060); ?>
\r
4865 <?php echo _SETTINGS_DISABLESITEURL ?> <input name="DisableSiteURL" tabindex="10070" size="40" value="<?php echo htmlspecialchars($CONF['DisableSiteURL'])?>" />
\r
4868 <td><?php echo _SETTINGS_DIRS?></td>
\r
4869 <td><?php echo htmlspecialchars($DIR_NUCLEUS) ?>
\r
4870 <i><?php echo _SETTINGS_SEECONFIGPHP?></i></td>
\r
4872 <td><?php echo _SETTINGS_DBLOGIN?></td>
\r
4873 <td><i><?php echo _SETTINGS_SEECONFIGPHP?></i></td>
\r
4877 echo _SETTINGS_JSTOOLBAR
\r
4878 /* =_SETTINGS_DISABLEJS
\r
4880 I temporary changed the meaning of DisableJsTools, until I can find a good
\r
4881 way to select the javascript version to use
\r
4885 1 : all javascript disabled
\r
4886 2 : 'simpler' javascript (for mozilla/opera/mac)
\r
4890 <td><?php /* $this->input_yesno('DisableJsTools',$CONF['DisableJsTools'],10075); */?>
\r
4891 <select name="DisableJsTools" tabindex="10075">
\r
4892 <?php $extra = ($CONF['DisableJsTools'] == 1) ? 'selected="selected"' : '';
\r
4893 echo "<option $extra value='1'>",_SETTINGS_JSTOOLBAR_NONE,"</option>";
\r
4894 $extra = ($CONF['DisableJsTools'] == 2) ? 'selected="selected"' : '';
\r
4895 echo "<option $extra value='2'>",_SETTINGS_JSTOOLBAR_SIMPLE,"</option>";
\r
4896 $extra = ($CONF['DisableJsTools'] == 0) ? 'selected="selected"' : '';
\r
4897 echo "<option $extra value='0'>",_SETTINGS_JSTOOLBAR_FULL,"</option>";
\r
4902 <td><?php echo _SETTINGS_URLMODE?> <?php help('urlmode');?></td>
\r
4905 $this->input_yesno('URLMode',$CONF['URLMode'],10077,
\r
4906 'normal','pathinfo',_SETTINGS_URLMODE_NORMAL,_SETTINGS_URLMODE_PATHINFO);
\r
4908 echo ' ', _SETTINGS_URLMODE_HELP;
\r
4914 <td><?php echo _SETTINGS_DEBUGVARS?> <?php help('debugvars');?></td>
\r
4917 $this->input_yesno('DebugVars',$CONF['DebugVars'],10078);
\r
4923 <td><?php echo _SETTINGS_DEFAULTLISTSIZE?> <?php help('defaultlistsize');?></td>
\r
4926 if (!array_key_exists('DefaultListSize',$CONF)) {
\r
4927 sql_query("INSERT INTO ".sql_table('config')." VALUES ('DefaultListSize', '10')");
\r
4928 $CONF['DefaultListSize'] = 10;
\r
4931 <input name="DefaultListSize" tabindex="10079" size="40" value="<?php echo htmlspecialchars((intval($CONF['DefaultListSize']) < 1 ? '10' : $CONF['DefaultListSize'])) ?>" />
\r
4934 <th colspan="2"><?php echo _SETTINGS_MEDIA?> <?php help('media'); ?></th>
\r
4936 <td><?php echo _SETTINGS_MEDIADIR?></td>
\r
4937 <td><?php echo htmlspecialchars($DIR_MEDIA) ?>
\r
4938 <i><?php echo _SETTINGS_SEECONFIGPHP?></i>
\r
4939 <?php if (!is_dir($DIR_MEDIA))
\r
4940 echo "<br /><b>" . _WARNING_NOTADIR . "</b>";
\r
4941 if (!is_readable($DIR_MEDIA))
\r
4942 echo "<br /><b>" . _WARNING_NOTREADABLE . "</b>";
\r
4943 if (!is_writeable($DIR_MEDIA))
\r
4944 echo "<br /><b>" . _WARNING_NOTWRITABLE . "</b>";
\r
4948 <td><?php echo _SETTINGS_MEDIAURL?></td>
\r
4950 <input name="MediaURL" tabindex="10080" size="40" value="<?php echo htmlspecialchars($CONF['MediaURL']) ?>" />
\r
4953 <td><?php echo _SETTINGS_ALLOWUPLOAD?></td>
\r
4954 <td><?php $this->input_yesno('AllowUpload',$CONF['AllowUpload'],10090); ?></td>
\r
4956 <td><?php echo _SETTINGS_ALLOWUPLOADTYPES?></td>
\r
4958 <input name="AllowedTypes" tabindex="10100" size="40" value="<?php echo htmlspecialchars($CONF['AllowedTypes']) ?>" />
\r
4961 <td><?php echo _SETTINGS_MAXUPLOADSIZE?></td>
\r
4963 <input name="MaxUploadSize" tabindex="10105" size="40" value="<?php echo htmlspecialchars($CONF['MaxUploadSize']) ?>" />
\r
4966 <td><?php echo _SETTINGS_MEDIAPREFIX?></td>
\r
4967 <td><?php $this->input_yesno('MediaPrefix',$CONF['MediaPrefix'],10110); ?></td>
\r
4970 <th colspan="2"><?php echo _SETTINGS_MEMBERS?></th>
\r
4972 <td><?php echo _SETTINGS_CHANGELOGIN?></td>
\r
4973 <td><?php $this->input_yesno('AllowLoginEdit',$CONF['AllowLoginEdit'],10120); ?></td>
\r
4975 <td><?php echo _SETTINGS_ALLOWCREATE?>
\r
4976 <?php help('allowaccountcreation'); ?>
\r
4978 <td><?php $this->input_yesno('AllowMemberCreate',$CONF['AllowMemberCreate'],10130); ?>
\r
4981 <td><?php echo _SETTINGS_NEWLOGIN?> <?php help('allownewmemberlogin'); ?>
\r
4982 <br /><?php echo _SETTINGS_NEWLOGIN2?>
\r
4984 <td><?php $this->input_yesno('NewMemberCanLogon',$CONF['NewMemberCanLogon'],10140); ?>
\r
4987 <td><?php echo _SETTINGS_MEMBERMSGS?>
\r
4988 <?php help('messageservice'); ?>
\r
4990 <td><?php $this->input_yesno('AllowMemberMail',$CONF['AllowMemberMail'],10150); ?>
\r
4993 <td><?php echo _SETTINGS_NONMEMBERMSGS?>
\r
4994 <?php help('messageservice'); ?>
\r
4996 <td><?php $this->input_yesno('NonmemberMail',$CONF['NonmemberMail'],10155); ?>
\r
4999 <td><?php echo _SETTINGS_PROTECTMEMNAMES?>
\r
5000 <?php help('protectmemnames'); ?>
\r
5002 <td><?php $this->input_yesno('ProtectMemNames',$CONF['ProtectMemNames'],10156); ?>
\r
5008 <th colspan="2"><?php echo _SETTINGS_COOKIES_TITLE?> <?php help('cookies'); ?></th>
\r
5010 <td><?php echo _SETTINGS_COOKIEPREFIX?></td>
\r
5011 <td><input name="CookiePrefix" tabindex="10159" size="40" value="<?php echo htmlspecialchars($CONF['CookiePrefix'])?>" /></td>
\r
5013 <td><?php echo _SETTINGS_COOKIEDOMAIN?></td>
\r
5014 <td><input name="CookieDomain" tabindex="10160" size="40" value="<?php echo htmlspecialchars($CONF['CookieDomain'])?>" /></td>
\r
5016 <td><?php echo _SETTINGS_COOKIEPATH?></td>
\r
5017 <td><input name="CookiePath" tabindex="10170" size="40" value="<?php echo htmlspecialchars($CONF['CookiePath'])?>" /></td>
\r
5019 <td><?php echo _SETTINGS_COOKIESECURE?></td>
\r
5020 <td><?php $this->input_yesno('CookieSecure',$CONF['CookieSecure'],10180); ?></td>
\r
5022 <td><?php echo _SETTINGS_COOKIELIFE?></td>
\r
5023 <td><?php $this->input_yesno('SessionCookie',$CONF['SessionCookie'],10190,
\r
5024 1,0,_SETTINGS_COOKIESESSION,_SETTINGS_COOKIEMONTH); ?>
\r
5027 <td><?php echo _SETTINGS_LASTVISIT?></td>
\r
5028 <td><?php $this->input_yesno('LastVisit',$CONF['LastVisit'],10200); ?></td>
\r
5033 <th colspan="2"><?php echo _SETTINGS_UPDATE?></th>
\r
5035 <td><?php echo _SETTINGS_UPDATE?></td>
\r
5036 <td><input type="submit" tabindex="10210" value="<?php echo _SETTINGS_UPDATE_BTN?>" onclick="return checkSubmit();" /></td>
\r
5043 echo '<h2>',_PLUGINS_EXTRA,'</h2>';
\r
5046 'GeneralSettingsFormExtras',
\r
5050 $this->pagefoot();
\r
5054 * @todo document this
\r
5056 function action_settingsupdate() {
\r
5057 global $member, $CONF;
\r
5059 $member->isAdmin() or $this->disallow();
\r
5061 // check if email address for admin is valid
\r
5062 if (!isValidMailAddress(postVar('AdminEmail')))
\r
5063 $this->error(_ERROR_BADMAILADDRESS);
\r
5067 $this->updateConfig('DefaultBlog', postVar('DefaultBlog'));
\r
5068 $this->updateConfig('BaseSkin', postVar('BaseSkin'));
\r
5069 $this->updateConfig('IndexURL', postVar('IndexURL'));
\r
5070 $this->updateConfig('AdminURL', postVar('AdminURL'));
\r
5071 $this->updateConfig('PluginURL', postVar('PluginURL'));
\r
5072 $this->updateConfig('SkinsURL', postVar('SkinsURL'));
\r
5073 $this->updateConfig('ActionURL', postVar('ActionURL'));
\r
5074 $this->updateConfig('Language', postVar('Language'));
\r
5075 $this->updateConfig('AdminEmail', postVar('AdminEmail'));
\r
5076 $this->updateConfig('SessionCookie', postVar('SessionCookie'));
\r
5077 $this->updateConfig('AllowMemberCreate',postVar('AllowMemberCreate'));
\r
5078 $this->updateConfig('AllowMemberMail', postVar('AllowMemberMail'));
\r
5079 $this->updateConfig('NonmemberMail', postVar('NonmemberMail'));
\r
5080 $this->updateConfig('ProtectMemNames', postVar('ProtectMemNames'));
\r
5081 $this->updateConfig('SiteName', postVar('SiteName'));
\r
5082 $this->updateConfig('NewMemberCanLogon',postVar('NewMemberCanLogon'));
\r
5083 $this->updateConfig('DisableSite', postVar('DisableSite'));
\r
5084 $this->updateConfig('DisableSiteURL', postVar('DisableSiteURL'));
\r
5085 $this->updateConfig('LastVisit', postVar('LastVisit'));
\r
5086 $this->updateConfig('MediaURL', postVar('MediaURL'));
\r
5087 $this->updateConfig('AllowedTypes', postVar('AllowedTypes'));
\r
5088 $this->updateConfig('AllowUpload', postVar('AllowUpload'));
\r
5089 $this->updateConfig('MaxUploadSize', postVar('MaxUploadSize'));
\r
5090 $this->updateConfig('MediaPrefix', postVar('MediaPrefix'));
\r
5091 $this->updateConfig('AllowLoginEdit', postVar('AllowLoginEdit'));
\r
5092 $this->updateConfig('DisableJsTools', postVar('DisableJsTools'));
\r
5093 $this->updateConfig('CookieDomain', postVar('CookieDomain'));
\r
5094 $this->updateConfig('CookiePath', postVar('CookiePath'));
\r
5095 $this->updateConfig('CookieSecure', postVar('CookieSecure'));
\r
5096 $this->updateConfig('URLMode', postVar('URLMode'));
\r
5097 $this->updateConfig('CookiePrefix', postVar('CookiePrefix'));
\r
5098 $this->updateConfig('DebugVars', postVar('DebugVars'));
\r
5099 $this->updateConfig('DefaultListSize', postVar('DefaultListSize'));
\r
5101 // load new config and redirect (this way, the new language will be used is necessary)
\r
5102 // note that when changing cookie settings, this redirect might cause the user
\r
5103 // to have to log in again.
\r
5105 redirect($CONF['AdminURL'] . '?action=manage');
\r
5111 * Give an overview over the used system
\r
5113 function action_systemoverview() {
\r
5114 global $member, $nucleus, $CONF;
\r
5116 $this->pagehead();
\r
5118 echo '<h2>' . _ADMIN_SYSTEMOVERVIEW_HEADING . "</h2>\n";
\r
5120 if ($member->isLoggedIn() && $member->isAdmin()) {
\r
5122 // Information about the used PHP and MySQL installation
\r
5123 echo '<h3>' . _ADMIN_SYSTEMOVERVIEW_PHPANDMYSQL . "</h3>\n";
\r
5125 // Version of PHP MySQL
\r
5128 echo "\t\t" . '<th colspan="2">' . _ADMIN_SYSTEMOVERVIEW_VERSIONS . "</th>\n";
\r
5129 echo "\t</tr><tr>\n";
\r
5130 echo "\t\t" . '<td width="50%">' . _ADMIN_SYSTEMOVERVIEW_PHPVERSION . "</td>\n";
\r
5131 echo "\t\t" . '<td>' . phpversion() . "</td>\n";
\r
5132 echo "\t</tr><tr>\n";
\r
5133 echo "\t\t" . '<td>' . _ADMIN_SYSTEMOVERVIEW_MYSQLVERSION . "</td>\n";
\r
5134 echo "\t\t" . '<td>' . mysql_get_server_info() . ' (' . mysql_get_client_info() . ')' . "</td>\n";
\r
5136 echo "</table>\n";
\r
5138 // Important PHP settings
\r
5141 echo "\t\t" . '<th colspan="2">' . _ADMIN_SYSTEMOVERVIEW_SETTINGS . "</th>\n";
\r
5142 echo "\t</tr><tr>\n";
\r
5143 echo "\t\t" . '<td width="50%">magic_quotes_gpc' . "</td>\n";
\r
5144 $mqg = get_magic_quotes_gpc() ? 'On' : 'Off';
\r
5145 echo "\t\t" . '<td>' . $mqg . "</td>\n";
\r
5146 echo "\t</tr><tr>\n";
\r
5147 echo "\t\t" . '<td>magic_quotes_runtime' . "</td>\n";
\r
5148 $mqr = get_magic_quotes_runtime() ? 'On' : 'Off';
\r
5149 echo "\t\t" . '<td>' . $mqr . "</td>\n";
\r
5150 echo "\t</tr><tr>\n";
\r
5151 echo "\t\t" . '<td>register_globals' . "</td>\n";
\r
5152 $rg = ini_get('register_globals') ? 'On' : 'Off';
\r
5153 echo "\t\t" . '<td>' . $rg . "</td>\n";
\r
5155 echo "</table>\n";
\r
5157 // Information about GD library
\r
5158 $gdinfo = gd_info();
\r
5161 echo "\t\t" . '<th colspan="2">' . _ADMIN_SYSTEMOVERVIEW_GDLIBRALY . "</th>\n";
\r
5163 foreach ($gdinfo as $key=>$value) {
\r
5164 if (is_bool($value)) {
\r
5165 $value = $value ? _ADMIN_SYSTEMOVERVIEW_ENABLE : _ADMIN_SYSTEMOVERVIEW_DISABLE;
\r
5167 $value = htmlspecialchars($value, ENT_QUOTES);
\r
5170 echo "\t\t" . '<td width="50%">' . $key . "</td>\n";
\r
5171 echo "\t\t" . '<td>' . $value . "</td>\n";
\r
5174 echo "</table>\n";
\r
5176 // Check if special modules are loaded
\r
5178 phpinfo(INFO_MODULES);
\r
5179 $im = ob_get_contents();
\r
5183 echo "\t\t" . '<th colspan="2">' . _ADMIN_SYSTEMOVERVIEW_MODULES . "</th>\n";
\r
5184 echo "\t</tr><tr>\n";
\r
5185 echo "\t\t" . '<td width="50%">mod_rewrite' . "</td>\n";
\r
5186 $modrewrite = (strstr($im, 'mod_rewrite') != '') ?
\r
5187 _ADMIN_SYSTEMOVERVIEW_ENABLE :
\r
5188 _ADMIN_SYSTEMOVERVIEW_DISABLE;
\r
5189 echo "\t\t" . '<td>' . $modrewrite . "</td>\n";
\r
5191 echo "</table>\n";
\r
5193 // Information about the used Nucleus CMS
\r
5194 echo '<h3>' . _ADMIN_SYSTEMOVERVIEW_NUCLEUSSYSTEM . "</h3>\n";
\r
5196 $nv = getNucleusVersion() / 100 . '(' . $nucleus['version'] . ')';
\r
5197 $np = getNucleusPatchLevel();
\r
5200 echo "\t\t" . '<th colspan="2">Nucleus CMS' . "</th>\n";
\r
5201 echo "\t</tr><tr>\n";
\r
5202 echo "\t\t" . '<td width="50%">' . _ADMIN_SYSTEMOVERVIEW_NUCLEUSVERSION . "</td>\n";
\r
5203 echo "\t\t" . '<td>' . $nv . "</td>\n";
\r
5204 echo "\t</tr><tr>\n";
\r
5205 echo "\t\t" . '<td width="50%">' . _ADMIN_SYSTEMOVERVIEW_NUCLEUSPATCHLEVEL . "</td>\n";
\r
5206 echo "\t\t" . '<td>' . $np . "</td>\n";
\r
5208 echo "</table>\n";
\r
5210 // Important settings of the installation
\r
5213 echo "\t\t" . '<th colspan="2">' . _ADMIN_SYSTEMOVERVIEW_NUCLEUSSETTINGS . "</th>\n";
\r
5214 echo "\t</tr><tr>\n";
\r
5215 echo "\t\t" . '<td width="50%">' . '$CONF[' . "'Self']</td>\n";
\r
5216 echo "\t\t" . '<td>' . $CONF['Self'] . "</td>\n";
\r
5217 echo "\t</tr><tr>\n";
\r
5218 echo "\t\t" . '<td width="50%">' . '$CONF[' . "'ItemURL']</td>\n";
\r
5219 echo "\t\t" . '<td>' . $CONF['ItemURL'] . "</td>\n";
\r
5220 echo "\t</tr><tr>\n";
\r
5221 echo "\t\t" . '<td width="50%">' . '$CONF[' . "'alertOnHeadersSent']</td>\n";
\r
5222 $ohs = $CONF['alertOnHeadersSent'] ?
\r
5223 _ADMIN_SYSTEMOVERVIEW_ENABLE :
\r
5224 _ADMIN_SYSTEMOVERVIEW_DISABLE;
\r
5225 echo "\t\t" . '<td>' . $ohs . "</td>\n";
\r
5227 echo "</table>\n";
\r
5229 // Link to the online version test at the Nucleus CMS website
\r
5230 echo '<h3>' . _ADMIN_SYSTEMOVERVIEW_VERSIONCHECK . "</h3>\n";
\r
5231 if ($nucleus['codename'] != '') {
\r
5232 $codenamestring = ' "' . $nucleus['codename'] . '"';
\r
5234 $codenamestring = '';
\r
5236 echo _ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TXT;
\r
5237 $checkURL = sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
\r
5238 echo '<a href="' . $checkURL . '" title="' . _ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TITLE . '">';
\r
5239 echo 'Nucleus CMS ' . $nv . $codenamestring;
\r
5244 echo _ADMIN_SYSTEMOVERVIEW_NOT_ADMIN;
\r
5247 $this->pagefoot();
\r
5251 * @todo document this
\r
5253 function updateConfig($name, $val) {
\r
5254 $name = addslashes($name);
\r
5255 $val = trim(addslashes($val));
\r
5257 $query = 'UPDATE '.sql_table('config')
\r
5258 . " SET value='$val'"
\r
5259 . " WHERE name='$name'";
\r
5261 sql_query($query) or die("Query error: " . mysql_error());
\r
5262 return mysql_insert_id();
\r
5267 * @param string $msg message that will be shown
\r
5269 function error($msg) {
\r
5270 $this->pagehead();
\r
5275 echo "<a href='index.php' onclick='history.back()'>"._BACK."</a>";
\r
5276 $this->pagefoot();
\r
5281 * @todo document this
\r
5283 function disallow() {
\r
5284 ACTIONLOG::add(WARNING, _ACTIONLOG_DISALLOWED . serverVar('REQUEST_URI'));
\r
5286 $this->error(_ERROR_DISALLOWED);
\r
5290 * @todo document this
\r
5292 function pagehead($extrahead = '') {
\r
5293 global $member, $nucleus, $CONF, $manager;
\r
5296 'AdminPrePageHead',
\r
5298 'extrahead' => &$extrahead,
\r
5299 'action' => $this->action
\r
5303 $baseUrl = htmlspecialchars($CONF['AdminURL']);
\r
5306 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
\r
5307 <html <?php echo _HTML_XML_NAME_SPACE_AND_LANG_CODE; ?>>
\r
5309 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo _CHARSET ?>" />
\r
5310 <title><?php echo htmlspecialchars($CONF['SiteName'])?> - Admin</title>
\r
5311 <link rel="stylesheet" title="Nucleus Admin Default" type="text/css" href="<?php echo $baseUrl?>styles/admin.css" />
\r
5312 <link rel="stylesheet" title="Nucleus Admin Default" type="text/css"
\r
5313 href="<?php echo $baseUrl?>styles/addedit.css" />
\r
5315 <script type="text/javascript" src="<?php echo $baseUrl?>javascript/edit.js"></script>
\r
5316 <script type="text/javascript" src="<?php echo $baseUrl?>javascript/admin.js"></script>
\r
5317 <script type="text/javascript" src="<?php echo $baseUrl?>javascript/compatibility.js"></script>
\r
5319 <meta http-equiv='Pragma' content='no-cache' />
\r
5320 <meta http-equiv='Cache-Control' content='no-cache, must-revalidate' />
\r
5321 <meta http-equiv='Expires' content='-1' />
\r
5323 <?php echo $extrahead?>
\r
5326 <div class="header">
\r
5327 <h1><?php echo htmlspecialchars($CONF['SiteName'])?></h1>
\r
5329 <div id="container">
\r
5330 <div id="content">
\r
5331 <div class="loginname">
\r
5332 <?php if ($member->isLoggedIn())
\r
5333 echo _LOGGEDINAS . ' ' . $member->getDisplayName()
\r
5334 ." - <a href='index.php?action=logout'>" . _LOGOUT. "</a>"
\r
5335 . "<br /><a href='index.php?action=overview'>" . _ADMINHOME . "</a> - ";
\r
5337 echo '<a href="index.php?action=showlogin" title="Log in">' , _NOTLOGGEDIN , '</a> <br />';
\r
5339 echo "<a href='".$CONF['IndexURL']."'>"._YOURSITE."</a>";
\r
5343 $codenamestring = ($nucleus['codename']!='')? ' "'.$nucleus['codename'].'"':'';
\r
5345 if ($member->isLoggedIn() && $member->isAdmin()) {
\r
5346 $checkURL = sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
\r
5347 echo '<a href="' . $checkURL . '" title="' . _ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TITLE . '">Nucleus CMS ' . $nucleus['version'] . $codenamestring . '</a>';
\r
5349 echo 'Nucleus CMS ' . $nucleus['version'] . $codenamestring;
\r
5356 * @todo document this
\r
5358 function pagefoot() {
\r
5359 global $action, $member, $manager;
\r
5362 'AdminPrePageFoot',
\r
5364 'action' => $this->action
\r
5368 if ($member->isLoggedIn() && ($action != 'showlogin')) {
\r
5370 <h2><?php echo _LOGOUT ?></h2>
\r
5372 <li><a href="index.php?action=overview"><?php echo _BACKHOME?></a></li>
\r
5373 <li><a href='index.php?action=logout'><?php echo _LOGOUT?></a></li>
\r
5377 <div class="foot">
\r
5378 <a href="<?php echo _ADMINPAGEFOOT_OFFICIALURL ?>">Nucleus CMS</a> © 2002-<?php echo date('Y') . ' ' . _ADMINPAGEFOOT_COPYRIGHT; ?>
\r
5380 <a href="<?php echo _ADMINPAGEFOOT_DONATEURL ?>"><?php echo _ADMINPAGEFOOT_DONATE ?></a>
\r
5383 </div><!-- content -->
\r
5385 <div id="quickmenu">
\r
5387 <?php // ---- user settings ----
\r
5388 if (($action != 'showlogin') && ($member->isLoggedIn())) {
\r
5390 echo '<li><a href="index.php?action=overview">',_QMENU_HOME,'</a></li>';
\r
5393 echo '<h2>',_QMENU_ADD,'</h2>';
\r
5394 echo '<form method="get" action="index.php"><div>';
\r
5395 echo '<input type="hidden" name="action" value="createitem" />';
\r
5397 $showAll = requestVar('showall');
\r
5398 if (($member->isAdmin()) && ($showAll == 'yes')) {
\r
5399 // Super-Admins have access to all blogs! (no add item support though)
\r
5400 $query = 'SELECT bnumber as value, bname as text'
\r
5401 . ' FROM ' . sql_table('blog')
\r
5402 . ' ORDER BY bname';
\r
5404 $query = 'SELECT bnumber as value, bname as text'
\r
5405 . ' FROM ' . sql_table('blog') . ', ' . sql_table('team')
\r
5406 . ' WHERE tblog=bnumber and tmember=' . $member->getID()
\r
5407 . ' ORDER BY bname';
\r
5409 $template['name'] = 'blogid';
\r
5410 $template['tabindex'] = 15000;
\r
5411 $template['extra'] = _QMENU_ADD_SELECT;
\r
5412 $template['selected'] = -1;
\r
5413 $template['shorten'] = 10;
\r
5414 $template['shortenel'] = '';
\r
5415 $template['javascript'] = 'onchange="return form.submit()"';
\r
5416 showlist($query,'select',$template);
\r
5418 echo '</div></form>';
\r
5420 echo '<h2>' . $member->getDisplayName(). '</h2>';
\r
5422 echo '<li><a href="index.php?action=editmembersettings">' . _QMENU_USER_SETTINGS . '</a></li>';
\r
5423 echo '<li><a href="index.php?action=browseownitems">' . _QMENU_USER_ITEMS . '</a></li>';
\r
5424 echo '<li><a href="index.php?action=browseowncomments">' . _QMENU_USER_COMMENTS . '</a></li>';
\r
5430 // ---- general settings ----
\r
5431 if ($member->isAdmin()) {
\r
5433 echo '<h2>',_QMENU_MANAGE,'</h2>';
\r
5436 echo '<li><a href="index.php?action=actionlog">' . _QMENU_MANAGE_LOG . '</a></li>';
\r
5437 echo '<li><a href="index.php?action=settingsedit">' . _QMENU_MANAGE_SETTINGS . '</a></li>';
\r
5438 echo '<li><a href="index.php?action=systemoverview">' . _QMENU_MANAGE_SYSTEM . '</a></li>';
\r
5439 echo '<li><a href="index.php?action=usermanagement">' . _QMENU_MANAGE_MEMBERS . '</a></li>';
\r
5440 echo '<li><a href="index.php?action=createnewlog">' . _QMENU_MANAGE_NEWBLOG . '</a></li>';
\r
5441 echo '<li><a href="index.php?action=backupoverview">' . _QMENU_MANAGE_BACKUPS . '</a></li>';
\r
5442 echo '<li><a href="index.php?action=pluginlist">' . _QMENU_MANAGE_PLUGINS . '</a></li>';
\r
5445 echo '<h2>',_QMENU_LAYOUT,'</h2>';
\r
5447 echo '<li><a href="index.php?action=skinoverview">' . _QMENU_LAYOUT_SKINS . '</a></li>';
\r
5448 echo '<li><a href="index.php?action=templateoverview">' . _QMENU_LAYOUT_TEMPL . '</a></li>';
\r
5449 echo '<li><a href="index.php?action=skinieoverview">' . _QMENU_LAYOUT_IEXPORT . '</a></li>';
\r
5454 $aPluginExtras = array();
\r
5458 'options' => &$aPluginExtras
\r
5461 if (count($aPluginExtras) > 0)
\r
5463 echo '<h2>', _QMENU_PLUGINS, '</h2>';
\r
5465 foreach ($aPluginExtras as $aInfo)
\r
5467 echo '<li><a href="'.htmlspecialchars($aInfo['url']).'" title="'.htmlspecialchars($aInfo['tooltip']).'">'.htmlspecialchars($aInfo['title']).'</a></li>';
\r
5472 } else if (($action == 'activate') || ($action == 'activatesetpwd')) {
\r
5474 echo '<h2>', _QMENU_ACTIVATE, '</h2>', _QMENU_ACTIVATE_TEXT;
\r
5476 // introduction text on login screen
\r
5477 echo '<h2>', _QMENU_INTRO, '</h2>', _QMENU_INTRO_TEXT;
\r
5482 <!-- content / quickmenu container -->
\r
5491 * @todo document this
\r
5493 function action_regfile() {
\r
5494 global $member, $CONF;
\r
5496 $blogid = intRequestVar('blogid');
\r
5498 $member->teamRights($blogid) or $this->disallow();
\r
5500 // header-code stolen from phpMyAdmin
\r
5501 // REGEDIT and bookmarklet code stolen from GreyMatter
\r
5503 $sjisBlogName = sprintf(_WINREGFILE_TEXT, getBlogNameFromID($blogid));
\r
5504 $sjisBlogName = mb_convert_encoding($sjisBlogName, "SJIS", "auto");
\r
5506 header('Content-Type: application/octetstream');
\r
5507 header('Content-Disposition: filename="nucleus.reg"');
\r
5508 header('Pragma: no-cache');
\r
5509 header('Expires: 0');
\r
5511 echo "REGEDIT4\n";
\r
5512 echo "[HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\MenuExt\\" . $sjisBlogName . "]\n";
\r
5513 echo '@="' . $CONF['AdminURL'] . "bookmarklet.php?action=contextmenucode&blogid=".intval($blogid)."\"\n";
\r
5514 echo '"contexts"=hex:31';
\r
5518 * @todo document this
\r
5520 function action_bookmarklet() {
\r
5521 global $member, $manager;
\r
5523 $blogid = intRequestVar('blogid');
\r
5525 $member->teamRights($blogid) or $this->disallow();
\r
5527 $blog =& $manager->getBlog($blogid);
\r
5528 $bm = getBookmarklet($blogid);
\r
5530 $this->pagehead();
\r
5532 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
\r
5536 <h2><?php echo _BOOKMARKLET_TITLE ?></h2>
\r
5539 <?php echo _BOOKMARKLET_DESC1 . _BOOKMARKLET_DESC2 . _BOOKMARKLET_DESC3 . _BOOKMARKLET_DESC4 . _BOOKMARKLET_DESC5 ?>
\r
5542 <h3><?php echo _BOOKMARKLET_BOOKARKLET ?></h3>
\r
5544 <?php echo _BOOKMARKLET_BMARKTEXT ?><small><?php echo _BOOKMARKLET_BMARKTEST ?></small>
\r
5547 <?php echo '<a href="' . htmlspecialchars($bm, ENT_QUOTES) . '">' . sprintf(_BOOKMARKLET_ANCHOR, htmlspecialchars($blog->getName(), ENT_QUOTES)) . '</a>' . _BOOKMARKLET_BMARKFOLLOW; ?>
\r
5550 <h3><?php echo _BOOKMARKLET_RIGHTCLICK ?></h3>
\r
5553 $url = 'index.php?action=regfile&blogid=' . intval($blogid);
\r
5554 $url = $manager->addTicketToUrl($url);
\r
5556 <?php echo _BOOKMARKLET_RIGHTTEXT1 . '<a href="' . htmlspecialchars($url, ENT_QUOTES, "SJIS") . '">' . _BOOKMARKLET_RIGHTLABEL . '</a>' . _BOOKMARKLET_RIGHTTEXT2; ?>
\r
5560 <?php echo _BOOKMARKLET_RIGHTTEXT3 ?>
\r
5563 <h3><?php echo _BOOKMARKLET_UNINSTALLTT ?></h3>
\r
5565 <?php echo _BOOKMARKLET_DELETEBAR ?>
\r
5569 <?php echo _BOOKMARKLET_DELETERIGHTT ?>
\r
5573 <li><?php echo _BOOKMARKLET_DELETERIGHT1 ?></li>
\r
5574 <li><?php echo _BOOKMARKLET_DELETERIGHT2 ?></li>
\r
5575 <li><?php echo _BOOKMARKLET_DELETERIGHT3 ?></li>
\r
5576 <li><?php echo _BOOKMARKLET_DELETERIGHT4 ?></li>
\r
5577 <li><?php echo _BOOKMARKLET_DELETERIGHT5 ?></li>
\r
5581 $this->pagefoot();
\r
5586 * @todo document this
\r
5588 function action_actionlog() {
\r
5589 global $member, $manager;
\r
5591 $member->isAdmin() or $this->disallow();
\r
5593 $this->pagehead();
\r
5595 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
\r
5597 $url = $manager->addTicketToUrl('index.php?action=clearactionlog');
\r
5600 <h2><?php echo _ACTIONLOG_CLEAR_TITLE?></h2>
\r
5601 <p><a href="<?php echo htmlspecialchars($url)?>"><?php echo _ACTIONLOG_CLEAR_TEXT?></a></p>
\r
5603 echo '<h2>' . _ACTIONLOG_TITLE . '</h2>';
\r
5605 $query = 'SELECT * FROM '.sql_table('actionlog').' ORDER BY timestamp DESC';
\r
5606 $template['content'] = 'actionlist';
\r
5607 $amount = showlist($query,'table',$template);
\r
5609 $this->pagefoot();
\r
5614 * @todo document this
\r
5616 function action_banlist() {
\r
5617 global $member, $manager;
\r
5619 $blogid = intRequestVar('blogid');
\r
5621 $member->blogAdminRights($blogid) or $this->disallow();
\r
5623 $blog =& $manager->getBlog($blogid);
\r
5625 $this->pagehead();
\r
5627 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
\r
5629 echo '<h2>' . _BAN_TITLE . " '". $this->bloglink($blog) ."'</h2>";
\r
5631 $query = 'SELECT * FROM '.sql_table('ban').' WHERE blogid='.$blogid.' ORDER BY iprange';
\r
5632 $template['content'] = 'banlist';
\r
5633 $amount = showlist($query,'table',$template);
\r
5638 echo '<h2>'._BAN_NEW_TITLE.'</h2>';
\r
5639 echo "<p><a href='index.php?action=banlistnew&blogid=$blogid'>"._BAN_NEW_TEXT."</a></p>";
\r
5642 $this->pagefoot();
\r
5647 * @todo document this
\r
5649 function action_banlistdelete() {
\r
5650 global $member, $manager;
\r
5652 $blogid = intRequestVar('blogid');
\r
5653 $iprange = requestVar('iprange');
\r
5655 $member->blogAdminRights($blogid) or $this->disallow();
\r
5657 $blog =& $manager->getBlog($blogid);
\r
5658 $banBlogName = htmlspecialchars($blog->getName(), ENT_QUOTES);
\r
5660 $this->pagehead();
\r
5662 <h2><?php echo _BAN_REMOVE_TITLE?></h2>
\r
5664 <form method="post" action="index.php">
\r
5666 <h3><?php echo _BAN_IPRANGE?></h3>
\r
5669 <?php echo _CONFIRMTXT_BAN?> <?php echo htmlspecialchars($iprange) ?>
\r
5670 <input name="iprange" type="hidden" value="<?php echo htmlspecialchars($iprange)?>" />
\r
5673 <h3><?php echo _BAN_BLOGS?></h3>
\r
5676 <input type="hidden" name="blogid" value="<?php echo $blogid?>" />
\r
5677 <input name="allblogs" type="radio" value="0" id="allblogs_one" />
\r
5678 <label for="allblogs_one"><?php echo sprintf(_BAN_BANBLOGNAME, $banBlogName) ?></label>
\r
5680 <input name="allblogs" type="radio" value="1" checked="checked" id="allblogs_all" /><label for="allblogs_all"><?php echo _BAN_ALLBLOGS?></label>
\r
5683 <h3><?php echo _BAN_DELETE_TITLE?></h3>
\r
5686 <?php $manager->addTicketHidden() ?>
\r
5687 <input type="hidden" name="action" value="banlistdeleteconfirm" />
\r
5688 <input type="submit" value="<?php echo _DELETE_CONFIRM_BTN?>" />
\r
5693 $this->pagefoot();
\r
5697 * @todo document this
\r
5699 function action_banlistdeleteconfirm() {
\r
5700 global $member, $manager;
\r
5702 $blogid = intPostVar('blogid');
\r
5703 $allblogs = postVar('allblogs');
\r
5704 $iprange = postVar('iprange');
\r
5706 $member->blogAdminRights($blogid) or $this->disallow();
\r
5708 $deleted = array();
\r
5711 if (BAN::removeBan($blogid, $iprange))
\r
5712 array_push($deleted, $blogid);
\r
5714 // get blogs fot which member has admin rights
\r
5715 $adminblogs = $member->getAdminBlogs();
\r
5716 foreach ($adminblogs as $blogje) {
\r
5717 if (BAN::removeBan($blogje, $iprange))
\r
5718 array_push($deleted, $blogje);
\r
5722 if (sizeof($deleted) == 0)
\r
5723 $this->error(_ERROR_DELETEBAN);
\r
5725 $this->pagehead();
\r
5727 echo '<a href="index.php?action=banlist&blogid=',$blogid,'">(',_BACK,')</a>';
\r
5728 echo '<h2>'._BAN_REMOVED_TITLE.'</h2>';
\r
5729 echo "<p>"._BAN_REMOVED_TEXT."</p>";
\r
5732 foreach ($deleted as $delblog) {
\r
5733 $b =& $manager->getBlog($delblog);
\r
5734 echo "<li>" . htmlspecialchars($b->getName()). "</li>";
\r
5738 $this->pagefoot();
\r
5743 * @todo document this
\r
5745 function action_banlistnewfromitem() {
\r
5746 $this->action_banlistnew(getBlogIDFromItemID(intRequestVar('itemid')));
\r
5750 * @todo document this
\r
5752 function action_banlistnew($blogid = '') {
\r
5753 global $member, $manager;
\r
5755 if ($blogid == '')
\r
5756 $blogid = intRequestVar('blogid');
\r
5758 $ip = requestVar('ip');
\r
5760 $member->blogAdminRights($blogid) or $this->disallow();
\r
5762 $blog =& $manager->getBlog($blogid);
\r
5764 $this->pagehead();
\r
5766 <h2><?php echo _BAN_ADD_TITLE?></h2>
\r
5769 <form method="post" action="index.php">
\r
5771 <h3><?php echo _BAN_IPRANGE?></h3>
\r
5773 <p><?php echo _BAN_IPRANGE_TEXT?></p>
\r
5775 <div class="note">
\r
5776 <strong><?php echo _BAN_EXAMPLE_TITLE ?></strong>
\r
5777 <?php echo _BAN_EXAMPLE_TEXT ?>
\r
5783 $iprangeVal = htmlspecialchars($ip, ENT_QUOTES);
\r
5785 <input name="iprange" type="radio" value="<?php echo $iprangeVal ?>" checked="checked" id="ip_fixed" />
\r
5786 <label for="ip_fixed"><?php echo $iprangeVal ?></label>
\r
5788 <input name="iprange" type="radio" value="custom" id="ip_custom" />
\r
5789 <label for="ip_custom"><?php echo _BAN_IP_CUSTOM ?></label>
\r
5790 <input name='customiprange' value='<?php echo $iprangeVal ?>' maxlength='15' size='15' />
\r
5793 echo "<input name='iprange' value='custom' type='hidden' />";
\r
5794 echo "<input name='customiprange' value='' maxlength='15' size='15' />";
\r
5799 <h3><?php echo _BAN_BLOGS?></h3>
\r
5801 <p><?php echo _BAN_BLOGS_TEXT?></p>
\r
5804 <input type="hidden" name="blogid" value="<?php echo $blogid?>" />
\r
5805 <input name="allblogs" type="radio" value="0" id="allblogs_one" /><label for="allblogs_one">'<?php echo htmlspecialchars($blog->getName())?>'</label>
\r
5807 <input name="allblogs" type="radio" value="1" checked="checked" id="allblogs_all" /><label for="allblogs_all"><?php echo _BAN_ALLBLOGS?></label>
\r
5810 <h3><?php echo _BAN_REASON_TITLE?></h3>
\r
5812 <p><?php echo _BAN_REASON_TEXT?></p>
\r
5814 <div><textarea name="reason" cols="40" rows="5"></textarea></div>
\r
5816 <h3><?php echo _BAN_ADD_TITLE?></h3>
\r
5819 <input name="action" type="hidden" value="banlistadd" />
\r
5820 <?php $manager->addTicketHidden() ?>
\r
5821 <input type="submit" value="<?php echo _BAN_ADD_BTN?>" />
\r
5826 <?php $this->pagefoot();
\r
5830 * @todo document this
\r
5832 function action_banlistadd() {
\r
5835 $blogid = intPostVar('blogid');
\r
5836 $allblogs = postVar('allblogs');
\r
5837 $iprange = postVar('iprange');
\r
5838 if ($iprange == "custom")
\r
5839 $iprange = postVar('customiprange');
\r
5840 $reason = postVar('reason');
\r
5842 $member->blogAdminRights($blogid) or $this->disallow();
\r
5844 // TODO: check IP range validity
\r
5847 if (!BAN::addBan($blogid, $iprange, $reason))
\r
5848 $this->error(_ERROR_ADDBAN);
\r
5850 // get blogs fot which member has admin rights
\r
5851 $adminblogs = $member->getAdminBlogs();
\r
5853 foreach ($adminblogs as $blogje) {
\r
5854 if (!BAN::addBan($blogje, $iprange, $reason))
\r
5858 $this->error(_ERROR_ADDBAN);
\r
5861 $this->action_banlist();
\r
5866 * @todo document this
\r
5868 function action_clearactionlog() {
\r
5871 $member->isAdmin() or $this->disallow();
\r
5873 ACTIONLOG::clear();
\r
5875 $this->action_manage(_MSG_ACTIONLOGCLEARED);
\r
5879 * @todo document this
\r
5881 function action_backupoverview() {
\r
5882 global $member, $manager;
\r
5884 $member->isAdmin() or $this->disallow();
\r
5886 $this->pagehead();
\r
5888 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
\r
5890 <h2><?php echo _BACKUPS_TITLE?></h2>
\r
5892 <h3><?php echo _BACKUP_TITLE?></h3>
\r
5894 <p><?php echo _BACKUP_INTRO?></p>
\r
5896 <form method="post" action="index.php"><p>
\r
5897 <input type="hidden" name="action" value="backupcreate" />
\r
5898 <?php $manager->addTicketHidden() ?>
\r
5900 <input type="radio" name="gzip" value="1" checked="checked" id="gzip_yes" tabindex="10" /><label for="gzip_yes"><?php echo _BACKUP_ZIP_YES?></label>
\r
5902 <input type="radio" name="gzip" value="0" id="gzip_no" tabindex="10" /><label for="gzip_no" ><?php echo _BACKUP_ZIP_NO?></label>
\r
5904 <input type="submit" value="<?php echo _BACKUP_BTN?>" tabindex="20" />
\r
5908 <div class="note"><?php echo _BACKUP_NOTE?></div>
\r
5911 <h3><?php echo _RESTORE_TITLE?></h3>
\r
5913 <div class="note"><?php echo _RESTORE_NOTE?></div>
\r
5915 <p><?php echo _RESTORE_INTRO?></p>
\r
5917 <form method="post" action="index.php" enctype="multipart/form-data"><p>
\r
5918 <input type="hidden" name="action" value="backuprestore" />
\r
5919 <?php $manager->addTicketHidden() ?>
\r
5920 <input name="backup_file" type="file" tabindex="30" />
\r
5922 <input type="submit" value="<?php echo _RESTORE_BTN?>" tabindex="40" />
\r
5923 <br /><input type="checkbox" name="letsgo" value="1" id="letsgo" tabindex="50" /><label for="letsgo"><?php echo _RESTORE_IMSURE?></label>
\r
5924 <br /><?php echo _RESTORE_WARNING?>
\r
5927 <?php $this->pagefoot();
\r
5931 * @todo document this
\r
5933 function action_backupcreate() {
\r
5934 global $member, $DIR_LIBS;
\r
5936 $member->isAdmin() or $this->disallow();
\r
5938 // use compression ?
\r
5939 $useGzip = intval(postVar('gzip'));
\r
5941 include($DIR_LIBS . 'backup.php');
\r
5943 // try to extend time limit
\r
5944 // (creating/restoring dumps might take a while)
\r
5945 @set_time_limit(1200);
\r
5947 $bu = new Backup();
\r
5948 $bu->do_backup($useGzip);
\r
5953 * @todo document this
\r
5955 function action_backuprestore() {
\r
5956 global $member, $DIR_LIBS;
\r
5958 $member->isAdmin() or $this->disallow();
\r
5960 if (intPostVar('letsgo') != 1)
\r
5961 $this->error(_ERROR_BACKUP_NOTSURE);
\r
5963 include($DIR_LIBS . 'backup.php');
\r
5965 // try to extend time limit
\r
5966 // (creating/restoring dumps might take a while)
\r
5967 @set_time_limit(1200);
\r
5969 $bu = new Backup();
\r
5970 $message = $bu->do_restore();
\r
5971 if ($message != '')
\r
5972 $this->error($message);
\r
5974 $this->pagehead();
\r
5976 <h2><?php echo _RESTORE_COMPLETE?></h2>
\r
5977 <?php $this->pagefoot();
\r
5982 * @todo document this
\r
5984 function action_pluginlist() {
\r
5985 global $member, $manager;
\r
5987 // check if allowed
\r
5988 $member->isAdmin() or $this->disallow();
\r
5990 $this->pagehead();
\r
5992 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
\r
5994 echo '<h2>' , _PLUGS_TITLE_MANAGE , ' ', help('plugins'), '</h2>';
\r
5996 echo '<h3>' , _PLUGS_TITLE_INSTALLED , '</h3>';
\r
5999 $query = 'SELECT * FROM '.sql_table('plugin').' ORDER BY porder ASC';
\r
6001 $template['content'] = 'pluginlist';
\r
6002 $template['tabindex'] = 10;
\r
6003 showlist($query, 'table', $template);
\r
6006 <h3><?php echo _PLUGS_TITLE_UPDATE?></h3>
\r
6008 <p><?php echo _PLUGS_TEXT_UPDATE?></p>
\r
6010 <form method="post" action="index.php"><div>
\r
6011 <input type="hidden" name="action" value="pluginupdate" />
\r
6012 <?php $manager->addTicketHidden() ?>
\r
6013 <input type="submit" value="<?php echo _PLUGS_BTN_UPDATE ?>" tabindex="20" />
\r
6016 <h3><?php echo _PLUGS_TITLE_NEW?></h3>
\r
6018 <?php // find a list of possibly non-installed plugins
\r
6019 $candidates = array();
\r
6020 global $DIR_PLUGINS;
\r
6021 $dirhandle = opendir($DIR_PLUGINS);
\r
6022 while ($filename = readdir($dirhandle)) {
\r
6023 if (ereg('^NP_(.*)\.php$',$filename,$matches)) {
\r
6024 $name = $matches[1];
\r
6025 // only show in list when not yet installed
\r
6026 $res = sql_query('SELECT * FROM '.sql_table('plugin').' WHERE pfile="NP_'.addslashes($name).'"');
\r
6027 if (mysql_num_rows($res) == 0)
\r
6028 array_push($candidates,$name);
\r
6031 closedir($dirhandle);
\r
6033 if (sizeof($candidates) > 0) {
\r
6036 <p><?php echo _PLUGS_ADD_TEXT?></p>
\r
6039 <form method='post' action='index.php'><div>
\r
6040 <input type='hidden' name='action' value='pluginadd' />
\r
6041 <?php $manager->addTicketHidden() ?>
\r
6042 <select name="filename" tabindex="30">
\r
6043 <?php foreach($candidates as $name)
\r
6044 echo '<option value="NP_',$name,'">',htmlspecialchars($name),'</option>';
\r
6047 <input type='submit' tabindex="40" value='<?php echo _PLUGS_BTN_INSTALL?>' />
\r
6050 <?php } else { // sizeof(candidates) == 0
\r
6051 echo '<p>',_PLUGS_NOCANDIDATES,'</p>';
\r
6054 $this->pagefoot();
\r
6058 * @todo document this
\r
6060 function action_pluginhelp() {
\r
6061 global $member, $manager, $DIR_PLUGINS, $CONF;
\r
6063 // check if allowed
\r
6064 $member->isAdmin() or $this->disallow();
\r
6066 $plugid = intGetVar('plugid');
\r
6068 if (!$manager->pidInstalled($plugid))
\r
6069 $this->error(_ERROR_NOSUCHPLUGIN);
\r
6071 $plugName = getPluginNameFromPid($plugid);
\r
6073 $this->pagehead();
\r
6075 echo '<p><a href="index.php?action=pluginlist">(',_PLUGS_BACK,')</a></p>';
\r
6077 echo '<h2>',_PLUGS_HELP_TITLE,': ',htmlspecialchars($plugName),'</h2>';
\r
6079 $plug =& $manager->getPlugin($plugName);
\r
6080 $helpFile = $DIR_PLUGINS.$plug->getShortName().'/help.html';
\r
6082 if (($plug->supportsFeature('HelpPage') > 0) && (@file_exists($helpFile))) {
\r
6083 @readfile($helpFile);
\r
6085 echo '<p>Error: ', _ERROR_PLUGNOHELPFILE,'</p>';
\r
6086 echo '<p><a href="index.php?action=pluginlist">(',_BACK,')</a></p>';
\r
6090 $this->pagefoot();
\r
6094 * @todo document this
\r
6096 function action_pluginadd() {
\r
6097 global $member, $manager, $DIR_PLUGINS;
\r
6099 // check if allowed
\r
6100 $member->isAdmin() or $this->disallow();
\r
6102 $name = postVar('filename');
\r
6104 if ($manager->pluginInstalled($name))
\r
6105 $this->error(_ERROR_DUPPLUGIN);
\r
6106 if (!checkPlugin($name))
\r
6107 $this->error(_ERROR_PLUGFILEERROR . ' (' . htmlspecialchars($name) . ')');
\r
6109 // get number of currently installed plugins
\r
6110 $res = sql_query('SELECT * FROM '.sql_table('plugin'));
\r
6111 $numCurrent = mysql_num_rows($res);
\r
6113 // plugin will be added as last one in the list
\r
6114 $newOrder = $numCurrent + 1;
\r
6123 // do this before calling getPlugin (in case the plugin id is used there)
\r
6124 $query = 'INSERT INTO '.sql_table('plugin').' (porder, pfile) VALUES ('.$newOrder.',"'.addslashes($name).'")';
\r
6125 sql_query($query);
\r
6126 $iPid = mysql_insert_id();
\r
6128 $manager->clearCachedInfo('installedPlugins');
\r
6130 // Load the plugin for condition checking and instalation
\r
6131 $plugin =& $manager->getPlugin($name);
\r
6133 // check if it got loaded (could have failed)
\r
6136 sql_query('DELETE FROM ' . sql_table('plugin') . ' WHERE pid='. intval($iPid));
\r
6137 $manager->clearCachedInfo('installedPlugins');
\r
6138 $this->error(_ERROR_PLUGIN_LOAD);
\r
6141 // check if plugin needs a newer Nucleus version
\r
6142 if (getNucleusVersion() < $plugin->getMinNucleusVersion())
\r
6144 // uninstall plugin again...
\r
6145 $this->deleteOnePlugin($plugin->getID());
\r
6147 // ...and show error
\r
6148 $this->error(_ERROR_NUCLEUSVERSIONREQ . htmlspecialchars($plugin->getMinNucleusVersion()));
\r
6151 // check if plugin needs a newer Nucleus version
\r
6152 if ((getNucleusVersion() == $plugin->getMinNucleusVersion()) && (getNucleusPatchLevel() < $plugin->getMinNucleusPatchLevel()))
\r
6154 // uninstall plugin again...
\r
6155 $this->deleteOnePlugin($plugin->getID());
\r
6157 // ...and show error
\r
6158 $this->error(_ERROR_NUCLEUSVERSIONREQ . htmlspecialchars( $plugin->getMinNucleusVersion() . ' patch ' . $plugin->getMinNucleusPatchLevel() ) );
\r
6161 $pluginList = $plugin->getPluginDep();
\r
6162 foreach ($pluginList as $pluginName)
\r
6165 $res = sql_query('SELECT * FROM '.sql_table('plugin') . ' WHERE pfile="' . $pluginName . '"');
\r
6166 if (mysql_num_rows($res) == 0)
\r
6168 // uninstall plugin again...
\r
6169 $this->deleteOnePlugin($plugin->getID());
\r
6171 $this->error(sprintf(_ERROR_INSREQPLUGIN, htmlspecialchars($pluginName, ENT_QUOTES)));
\r
6175 // call the install method of the plugin
\r
6176 $plugin->install();
\r
6181 'plugin' => &$plugin
\r
6185 // update all events
\r
6186 $this->action_pluginupdate();
\r
6190 * @todo document this
\r
6192 function action_pluginupdate() {
\r
6193 global $member, $manager, $CONF;
\r
6195 // check if allowed
\r
6196 $member->isAdmin() or $this->disallow();
\r
6198 // delete everything from plugin_events
\r
6199 sql_query('DELETE FROM '.sql_table('plugin_event'));
\r
6201 // loop over all installed plugins
\r
6202 $res = sql_query('SELECT pid, pfile FROM '.sql_table('plugin'));
\r
6203 while($o = mysql_fetch_object($res)) {
\r
6205 $plug =& $manager->getPlugin($o->pfile);
\r
6208 $eventList = $plug->getEventList();
\r
6209 foreach ($eventList as $eventName)
\r
6210 sql_query('INSERT INTO '.sql_table('plugin_event').' (pid, event) VALUES ('.$pid.', \''.addslashes($eventName).'\')');
\r
6214 redirect($CONF['AdminURL'] . '?action=pluginlist');
\r
6215 // $this->action_pluginlist();
\r
6219 * @todo document this
\r
6221 function action_plugindelete() {
\r
6222 global $member, $manager;
\r
6224 // check if allowed
\r
6225 $member->isAdmin() or $this->disallow();
\r
6227 $pid = intGetVar('plugid');
\r
6229 if (!$manager->pidInstalled($pid))
\r
6230 $this->error(_ERROR_NOSUCHPLUGIN);
\r
6232 $this->pagehead();
\r
6234 <h2><?php echo _DELETE_CONFIRM?></h2>
\r
6236 <p><?php echo _CONFIRMTXT_PLUGIN?> <strong><?php echo getPluginNameFromPid($pid)?></strong>?</p>
\r
6238 <form method="post" action="index.php"><div>
\r
6239 <?php $manager->addTicketHidden() ?>
\r
6240 <input type="hidden" name="action" value="plugindeleteconfirm" />
\r
6241 <input type="hidden" name="plugid" value="<?php echo $pid; ?>" />
\r
6242 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
\r
6245 $this->pagefoot();
\r
6249 * @todo document this
\r
6251 function action_plugindeleteconfirm() {
\r
6252 global $member, $manager, $CONF;
\r
6254 // check if allowed
\r
6255 $member->isAdmin() or $this->disallow();
\r
6257 $pid = intPostVar('plugid');
\r
6259 $error = $this->deleteOnePlugin($pid, 1);
\r
6261 $this->error($error);
\r
6264 redirect($CONF['AdminURL'] . '?action=pluginlist');
\r
6265 // $this->action_pluginlist();
\r
6269 * @todo document this
\r
6271 function deleteOnePlugin($pid, $callUninstall = 0) {
\r
6274 $pid = intval($pid);
\r
6276 if (!$manager->pidInstalled($pid))
\r
6277 return _ERROR_NOSUCHPLUGIN;
\r
6279 $name = quickQuery('SELECT pfile as result FROM '.sql_table('plugin').' WHERE pid='.$pid);
\r
6281 /* // call the unInstall method of the plugin
\r
6282 if ($callUninstall) {
\r
6283 $plugin =& $manager->getPlugin($name);
\r
6284 if ($plugin) $plugin->unInstall();
\r
6287 // check dependency before delete
\r
6288 $res = sql_query('SELECT pfile FROM '.sql_table('plugin'));
\r
6289 while($o = mysql_fetch_object($res)) {
\r
6290 $plug =& $manager->getPlugin($o->pfile);
\r
6293 $depList = $plug->getPluginDep();
\r
6294 foreach ($depList as $depName)
\r
6296 if ($name == $depName)
\r
6298 return sprintf(_ERROR_DELREQPLUGIN, $o->pfile);
\r
6304 $manager->notify('PreDeletePlugin', array('plugid' => $pid));
\r
6306 // call the unInstall method of the plugin
\r
6307 if ($callUninstall) {
\r
6308 $plugin =& $manager->getPlugin($name);
\r
6309 if ($plugin) $plugin->unInstall();
\r
6312 // delete all subscriptions
\r
6313 sql_query('DELETE FROM '.sql_table('plugin_event').' WHERE pid=' . $pid);
\r
6315 // delete all options
\r
6316 // get OIDs from plugin_option_desc
\r
6317 $res = sql_query('SELECT oid FROM ' . sql_table('plugin_option_desc') . ' WHERE opid=' . $pid);
\r
6319 while ($o = mysql_fetch_object($res)) {
\r
6320 array_push($aOIDs, $o->oid);
\r
6323 // delete from plugin_option and plugin_option_desc
\r
6324 sql_query('DELETE FROM '.sql_table('plugin_option_desc').' WHERE opid=' . $pid);
\r
6325 if (count($aOIDs) > 0)
\r
6326 sql_query('DELETE FROM '.sql_table('plugin_option').' WHERE oid in ('.implode(',',$aOIDs).')');
\r
6328 // update order numbers
\r
6329 $res = sql_query('SELECT porder FROM '.sql_table('plugin').' WHERE pid=' . $pid);
\r
6330 $o = mysql_fetch_object($res);
\r
6331 sql_query('UPDATE '.sql_table('plugin').' SET porder=(porder - 1) WHERE porder>'.$o->porder);
\r
6334 sql_query('DELETE FROM '.sql_table('plugin').' WHERE pid='.$pid);
\r
6336 $manager->clearCachedInfo('installedPlugins');
\r
6337 $manager->notify('PostDeletePlugin', array('plugid' => $pid));
\r
6343 * @todo document this
\r
6345 function action_pluginup() {
\r
6346 global $member, $manager, $CONF;
\r
6348 // check if allowed
\r
6349 $member->isAdmin() or $this->disallow();
\r
6351 $plugid = intGetVar('plugid');
\r
6353 if (!$manager->pidInstalled($plugid))
\r
6354 $this->error(_ERROR_NOSUCHPLUGIN);
\r
6356 // 1. get old order number
\r
6357 $res = sql_query('SELECT porder FROM '.sql_table('plugin').' WHERE pid='.$plugid);
\r
6358 $o = mysql_fetch_object($res);
\r
6359 $oldOrder = $o->porder;
\r
6361 // 2. calculate new order number
\r
6362 $newOrder = ($oldOrder > 1) ? ($oldOrder - 1) : 1;
\r
6364 // 3. update plug numbers
\r
6365 sql_query('UPDATE '.sql_table('plugin').' SET porder='.$oldOrder.' WHERE porder='.$newOrder);
\r
6366 sql_query('UPDATE '.sql_table('plugin').' SET porder='.$newOrder.' WHERE pid='.$plugid);
\r
6368 //$this->action_pluginlist();
\r
6369 // To avoid showing ticket in the URL, redirect to pluginlist, instead.
\r
6370 redirect($CONF['AdminURL'] . '?action=pluginlist');
\r
6374 * @todo document this
\r
6376 function action_plugindown() {
\r
6377 global $member, $manager, $CONF;
\r
6379 // check if allowed
\r
6380 $member->isAdmin() or $this->disallow();
\r
6382 $plugid = intGetVar('plugid');
\r
6383 if (!$manager->pidInstalled($plugid))
\r
6384 $this->error(_ERROR_NOSUCHPLUGIN);
\r
6386 // 1. get old order number
\r
6387 $res = sql_query('SELECT porder FROM '.sql_table('plugin').' WHERE pid='.$plugid);
\r
6388 $o = mysql_fetch_object($res);
\r
6389 $oldOrder = $o->porder;
\r
6391 $res = sql_query('SELECT * FROM '.sql_table('plugin'));
\r
6392 $maxOrder = mysql_num_rows($res);
\r
6394 // 2. calculate new order number
\r
6395 $newOrder = ($oldOrder < $maxOrder) ? ($oldOrder + 1) : $maxOrder;
\r
6397 // 3. update plug numbers
\r
6398 sql_query('UPDATE '.sql_table('plugin').' SET porder='.$oldOrder.' WHERE porder='.$newOrder);
\r
6399 sql_query('UPDATE '.sql_table('plugin').' SET porder='.$newOrder.' WHERE pid='.$plugid);
\r
6401 //$this->action_pluginlist();
\r
6402 // To avoid showing ticket in the URL, redirect to pluginlist, instead.
\r
6403 redirect($CONF['AdminURL'] . '?action=pluginlist');
\r
6407 * @todo document this
\r
6409 function action_pluginoptions($message = '') {
\r
6410 global $member, $manager;
\r
6412 // check if allowed
\r
6413 $member->isAdmin() or $this->disallow();
\r
6415 $pid = intRequestVar('plugid');
\r
6416 if (!$manager->pidInstalled($pid))
\r
6417 $this->error(_ERROR_NOSUCHPLUGIN);
\r
6419 $extrahead = '<script type="text/javascript" src="javascript/numbercheck.js"></script>';
\r
6420 $pluginName = htmlspecialchars(getPluginNameFromPid($pid), ENT_QUOTES);
\r
6421 $this->pagehead($extrahead);
\r
6424 <p><a href="index.php?action=pluginlist">(<?php echo _PLUGS_BACK?>)</a></p>
\r
6426 <h2><?php echo sprintf(_PLUGIN_OPTIONS_TITLE, $pluginName) ?></h2>
\r
6428 <?php if ($message) echo $message?>
\r
6430 <form action="index.php" method="post">
\r
6432 <input type="hidden" name="action" value="pluginoptionsupdate" />
\r
6433 <input type="hidden" name="plugid" value="<?php echo $pid?>" />
\r
6437 $manager->addTicketHidden();
\r
6439 $aOptions = array();
\r
6441 $query = 'SELECT * FROM ' . sql_table('plugin_option_desc') . ' WHERE ocontext=\'global\' and opid=' . $pid . ' ORDER BY oid ASC';
\r
6442 $r = sql_query($query);
\r
6443 while ($o = mysql_fetch_object($r)) {
\r
6444 array_push($aOIDs, $o->oid);
\r
6445 $aOptions[$o->oid] = array(
\r
6447 'value' => $o->odef,
\r
6448 'name' => $o->oname,
\r
6449 'description' => $o->odesc,
\r
6450 'type' => $o->otype,
\r
6451 'typeinfo' => $o->oextra,
\r
6455 // fill out actual values
\r
6456 if (count($aOIDs) > 0) {
\r
6457 $r = sql_query('SELECT oid, ovalue FROM ' . sql_table('plugin_option') . ' WHERE oid in ('.implode(',',$aOIDs).')');
\r
6458 while ($o = mysql_fetch_object($r))
\r
6459 $aOptions[$o->oid]['value'] = $o->ovalue;
\r
6463 $manager->notify('PrePluginOptionsEdit',array('context' => 'global', 'plugid' => $pid, 'options'=>&$aOptions));
\r
6465 $template['content'] = 'plugoptionlist';
\r
6466 $amount = showlist($aOptions,'table',$template);
\r
6468 echo '<p>',_ERROR_NOPLUGOPTIONS,'</p>';
\r
6473 <?php $this->pagefoot();
\r
6480 * @todo document this
\r
6482 function action_pluginoptionsupdate() {
\r
6483 global $member, $manager;
\r
6485 // check if allowed
\r
6486 $member->isAdmin() or $this->disallow();
\r
6488 $pid = intRequestVar('plugid');
\r
6489 if (!$manager->pidInstalled($pid))
\r
6490 $this->error(_ERROR_NOSUCHPLUGIN);
\r
6492 $aOptions = requestArray('plugoption');
\r
6493 NucleusPlugin::_applyPluginOptions($aOptions);
\r
6495 $manager->notify('PostPluginOptionsUpdate',array('context' => 'global', 'plugid' => $pid));
\r
6497 $this->action_pluginoptions(_PLUGS_OPTIONS_UPDATED);
\r
6502 * @todo document this
\r
6504 function _insertPluginOptions($context, $contextid = 0) {
\r
6505 // get all current values for this contextid
\r
6506 // (note: this might contain doubles for overlapping contextids)
\r
6507 $aIdToValue = array();
\r
6508 $res = sql_query('SELECT oid, ovalue FROM ' . sql_table('plugin_option') . ' WHERE ocontextid=' . intval($contextid));
\r
6509 while ($o = mysql_fetch_object($res)) {
\r
6510 $aIdToValue[$o->oid] = $o->ovalue;
\r
6513 // get list of oids per pid
\r
6514 $query = 'SELECT * FROM ' . sql_table('plugin_option_desc') . ',' . sql_table('plugin')
\r
6515 . ' WHERE opid=pid and ocontext=\''.addslashes($context).'\' ORDER BY porder, oid ASC';
\r
6516 $res = sql_query($query);
\r
6517 $aOptions = array();
\r
6518 while ($o = mysql_fetch_object($res)) {
\r
6519 if (in_array($o->oid, array_keys($aIdToValue)))
\r
6520 $value = $aIdToValue[$o->oid];
\r
6522 $value = $o->odef;
\r
6524 array_push($aOptions, array(
\r
6526 'pfile' => $o->pfile,
\r
6528 'value' => $value,
\r
6529 'name' => $o->oname,
\r
6530 'description' => $o->odesc,
\r
6531 'type' => $o->otype,
\r
6532 'typeinfo' => $o->oextra,
\r
6533 'contextid' => $contextid,
\r
6539 $manager->notify('PrePluginOptionsEdit',array('context' => $context, 'contextid' => $contextid, 'options'=>&$aOptions));
\r
6543 foreach ($aOptions as $aOption) {
\r
6546 if ($iPrevPid != $aOption['pid']) {
\r
6547 $iPrevPid = $aOption['pid'];
\r
6549 echo '<tr><th colspan="2">Options for ', htmlspecialchars($aOption['pfile']),'</th></tr>';
\r
6552 $meta = NucleusPlugin::getOptionMeta($aOption['typeinfo']);
\r
6553 if (@$meta['access'] != 'hidden') {
\r
6555 listplug_plugOptionRow($aOption);
\r
6565 * Helper functions to create option forms etc.
\r
6566 * @todo document parameters
\r
6568 function input_yesno($name, $checkedval,$tabindex = 0, $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO, $isAdmin = 0) {
\r
6569 $id = htmlspecialchars($name);
\r
6570 $id = str_replace('[','-',$id);
\r
6571 $id = str_replace(']','-',$id);
\r
6572 $id1 = $id . htmlspecialchars($value1);
\r
6573 $id2 = $id . htmlspecialchars($value2);
\r
6575 if ($name=="admin") {
\r
6576 echo '<input onclick="selectCanLogin(true);" type="radio" name="', htmlspecialchars($name),'" value="', htmlspecialchars($value1),'" ';
\r
6578 echo '<input type="radio" name="', htmlspecialchars($name),'" value="', htmlspecialchars($value1),'" ';
\r
6581 if ($checkedval == $value1)
\r
6582 echo "tabindex='$tabindex' checked='checked'";
\r
6583 echo ' id="'.$id1.'" /><label for="'.$id1.'">' . $yesval . '</label>';
\r
6585 if ($name=="admin") {
\r
6586 echo '<input onclick="selectCanLogin(false);" type="radio" name="', htmlspecialchars($name),'" value="', htmlspecialchars($value2),'" ';
\r
6588 echo '<input type="radio" name="', htmlspecialchars($name),'" value="', htmlspecialchars($value2),'" ';
\r
6590 if ($checkedval != $value1)
\r
6591 echo "tabindex='$tabindex' checked='checked'";
\r
6592 if ($isAdmin && $name=="canlogin")
\r
6593 echo ' disabled="disabled"';
\r
6594 echo ' id="'.$id2.'" /><label for="'.$id2.'">' . $noval . '</label>';
\r