3 * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4 * Copyright (C) 2002-2004 The Nucleus Group
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 * (see nucleus/documentation/index.html#license for more info)
12 * The code for the Nucleus admin area
14 * $Id: ADMIN.php,v 1.1.1.1 2005-02-28 07:14:47 kimitake Exp $
19 // action currently being executed ($action=xxxx -> action_xxxx method)
30 * action to be performed
32 function action($action) {
33 global $CONF, $manager;
35 // list of action aliases
37 'login' => 'overview',
42 $action = $alias[$action];
44 $methodName = 'action_' . $action;
46 $this->action = strtolower($action);
48 // check ticket. All actions need a ticket, unless they are considered to be safe (a safe action
49 // is an action that requires user interaction before something is actually done)
50 // all safe actions are in this array:
51 $aActionsNotToCheck = array('showlogin', 'login', 'overview', 'itemlist', 'blogcommentlist', 'bookmarklet', 'blogsettings', 'banlist', 'deleteblog', 'editmembersettings', 'browseownitems', 'browseowncomments', 'createitem', 'itemedit', 'itemmove', 'categoryedit', 'categorydelete', 'manage', 'actionlog', 'settingsedit', 'backupoverview', 'pluginlist', 'createnewlog', 'usermanagement', 'skinoverview', 'templateoverview', 'skinieoverview', 'itemcommentlist', 'commentedit', 'commentdelete', 'banlistnewfromitem', 'banlistdelete', 'itemdelete', 'manageteam', 'teamdelete', 'banlistnew', 'memberedit', 'memberdelete', 'pluginhelp', 'pluginoptions', 'plugindelete', 'skinedittype', 'skindelete', 'skinedit', 'templateedit', 'templatedelete', 'activate');
53 // the rest of the actions needs to be checked
54 $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');
56 if (!in_array($this->action, $aActionsNotToCheck))
58 if (!$manager->checkTicket())
59 $this->error(_ERROR_BADTICKET);
62 if (method_exists($this, $methodName))
63 call_user_func(array(&$this, $methodName));
65 $this->error(_BADACTION . " ($action)");
70 function action_showlogin() {
72 $this->action_login($error);
75 function action_login($msg = '', $passvars = 1) {
78 // skip to overview when allowed
79 if ($member->isLoggedIn() && $member->canLogin()) {
80 $this->action_overview();
86 echo '<h2>', _LOGIN ,'</h2>';
87 if ($msg) echo _MESSAGE , ': ', $msg;
90 <form action="index.php" method="post"><p>
91 <?php echo _LOGIN_NAME?>: <br /><input name="login" tabindex="10" />
93 <?php echo _LOGIN_PASSWORD?>: <br /><input name="password" tabindex="20" type="password" />
95 <input name="action" value="login" type="hidden" />
97 <input type="submit" value="<?php echo _LOGIN?>" tabindex="30" />
100 <input type="checkbox" value="1" name="shared" tabindex="40" id="shared" /><label for="shared"><?php echo _LOGIN_SHARED?></label>
101 <br /><a href="forgotpassword.html"><?php echo _LOGIN_FORGOT?></a>
103 <?php // pass through vars
105 $oldaction = postVar('oldaction');
106 if ( ($oldaction != 'logout') && ($oldaction != 'login') && $passvars ) {
113 <?php $this->pagefoot();
118 * provides a screen with the overview of the actions available
120 function action_overview($msg = '') {
126 echo _MESSAGE , ': ', $msg;
128 /* ---- add items ---- */
129 echo '<h2>' . _OVERVIEW_YRBLOGS . '</h2>';
131 $showAll = requestVar('showall');
133 if (($member->isAdmin()) && ($showAll == 'yes')) {
134 // Super-Admins have access to all blogs! (no add item support though)
135 $query = 'SELECT bnumber, bname, 1 as tadmin, burl, bshortname'
136 . ' FROM ' . sql_table('blog')
139 $query = 'SELECT bnumber, bname, tadmin, burl, bshortname'
140 . ' FROM ' . sql_table('blog') . ', ' . sql_table('team')
141 . ' WHERE tblog=bnumber and tmember=' . $member->getID()
144 $template['content'] = 'bloglist';
145 $template['superadmin'] = $member->isAdmin();
146 $amount = showlist($query,'table',$template);
148 if (($showAll != 'yes') && ($member->isAdmin())) {
149 $total = quickQuery('SELECT COUNT(*) as result FROM ' . sql_table('blog'));
150 if ($total > $amount)
151 echo '<p><a href="index.php?action=overview&showall=yes">Show all blogs</a></p>';
155 echo _OVERVIEW_NOBLOGS;
158 echo '<h2>' . _OVERVIEW_YRDRAFTS . '</h2>';
159 $query = 'SELECT ititle, inumber, bshortname'
160 . ' FROM ' . sql_table('item'). ', ' . sql_table('blog')
161 . ' WHERE iauthor='.$member->getID().' and iblog=bnumber and idraft=1';
162 $template['content'] = 'draftlist';
163 $amountdrafts = showlist($query, 'table', $template);
164 if ($amountdrafts == 0)
165 echo _OVERVIEW_NODRAFTS;
168 /* ---- user settings ---- */
169 echo '<h2>' . _OVERVIEW_YRSETTINGS . '</h2>';
171 echo '<li><a href="index.php?action=editmembersettings">' . _OVERVIEW_EDITSETTINGS. '</a></li>';
172 echo '<li><a href="index.php?action=browseownitems">' . _OVERVIEW_BROWSEITEMS.'</a></li>';
173 echo '<li><a href="index.php?action=browseowncomments">'._OVERVIEW_BROWSECOMM.'</a></li>';
176 /* ---- general settings ---- */
177 if ($member->isAdmin()) {
178 echo '<h2>' . _OVERVIEW_MANAGEMENT. '</h2>';
180 echo '<li><a href="index.php?action=manage">',_OVERVIEW_MANAGE,'</a></li>';
188 // returns a link to a weblog (takes BLOG object as parameter)
189 function bloglink(&$blog) {
190 return '<a href="'.htmlspecialchars($blog->getURL()).'" title="'._BLOGLIST_TT_VISIT.'">'.$blog->getName() .'</a>';
193 function action_manage($msg = '') {
196 $member->isAdmin() or $this->disallow();
200 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
203 echo '<p>' , _MESSAGE , ': ', $msg , '</p>';
206 echo '<h2>' . _MANAGE_GENERAL. '</h2>';
209 echo '<li><a href="index.php?action=createnewlog">'._OVERVIEW_NEWLOG.'</a></li>';
210 echo '<li><a href="index.php?action=settingsedit">'._OVERVIEW_SETTINGS.'</a></li>';
211 echo '<li><a href="index.php?action=usermanagement">'._OVERVIEW_MEMBERS.'</a></li>';
212 echo '<li><a href="index.php?action=actionlog">'._OVERVIEW_VIEWLOG.'</a></li>';
215 echo '<h2>' . _MANAGE_SKINS . '</h2>';
217 echo '<li><a href="index.php?action=skinoverview">'._OVERVIEW_SKINS.'</a></li>';
218 echo '<li><a href="index.php?action=templateoverview">'._OVERVIEW_TEMPLATES.'</a></li>';
219 echo '<li><a href="index.php?action=skinieoverview">'._OVERVIEW_SKINIMPORT.'</a></li>';
222 echo '<h2>' . _MANAGE_EXTRA . '</h2>';
224 echo '<li><a href="index.php?action=backupoverview">'._OVERVIEW_BACKUP.'</a></li>';
225 echo '<li><a href="index.php?action=pluginlist">'._OVERVIEW_PLUGINS.'</a></li>';
231 function action_itemlist($blogid = '') {
232 global $member, $manager;
235 $blogid = intRequestVar('blogid');
237 $member->teamRights($blogid) or $member->isAdmin() or $this->disallow();
240 $blog =& $manager->getBlog($blogid);
242 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
243 echo '<h2>' . _ITEMLIST_BLOG . ' ' . $this->bloglink($blog) . '</h2>';
246 if (postVar('start'))
247 $start = intPostVar('start');
252 echo '<p><a href="index.php?action=createitem&blogid='.$blogid.'">',_ITEMLIST_ADDNEW,'</a></p>';
254 // amount of items to show
255 if (postVar('amount'))
256 $amount = intPostVar('amount');
260 $search = postVar('search'); // search through items
262 $query = 'SELECT bshortname, cname, mname, ititle, ibody, inumber, idraft, itime'
263 . ' FROM ' . sql_table('item') . ', ' . sql_table('blog') . ', ' . sql_table('member') . ', ' . sql_table('category')
264 . ' WHERE iblog=bnumber and iauthor=mnumber and icat=catid and iblog=' . $blogid;
267 $query .= ' and ((ititle LIKE "%' . addslashes($search) . '%") or (ibody LIKE "%' . addslashes($search) . '%") or (imore LIKE "%' . addslashes($search) . '%"))';
269 // non-blog-admins can only edit/delete their own items
270 if (!$member->blogAdminRights($blogid))
271 $query .= ' and iauthor=' . $member->getID();
274 $query .= ' ORDER BY itime DESC'
275 . " LIMIT $start,$amount";
277 $template['content'] = 'itemlist';
278 $template['now'] = $blog->getCorrectTime(time());
281 $navList =& new NAVLIST('itemlist', $start, $amount, 0, 1000, $blogid, $search, 0);
282 $navList->showBatchList('item',$query,'table',$template);
289 function action_batchitem() {
290 global $member, $manager;
292 // check if logged in
293 $member->isLoggedIn() or $this->disallow();
295 // more precise check will be done for each performed operation
297 // get array of itemids from request
298 $selected = requestIntArray('batch');
299 $action = requestVar('batchaction');
301 // Show error when no items were selected
302 if (!is_array($selected) || sizeof($selected) == 0)
303 $this->error(_BATCH_NOSELECTION);
305 // On move: when no destination blog/category chosen, show choice now
306 $destCatid = intRequestVar('destcatid');
307 if (($action == 'move') && (!$manager->existsCategory($destCatid)))
308 $this->batchMoveSelectDestination('item',$selected);
310 // On delete: check if confirmation has been given
311 if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
312 $this->batchAskDeleteConfirmation('item',$selected);
316 echo '<a href="index.php?action=overview">(',_BACKHOME,')</a>';
317 echo '<h2>',_BATCH_ITEMS,'</h2>';
318 echo '<p>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b></p>';
322 // walk over all itemids and perform action
323 foreach ($selected as $itemid) {
324 $itemid = intval($itemid);
325 echo '<li>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b> ',_BATCH_ONITEM,' <b>', $itemid, '</b>...';
327 // perform action, display errors if needed
330 $error = $this->deleteOneItem($itemid);
333 $error = $this->moveOneItem($itemid, $destCatid);
336 $error = _BATCH_UNKNOWN . $action;
339 echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
344 echo '<b>',_BATCH_DONE,'</b>';
351 function action_batchcomment() {
354 // check if logged in
355 $member->isLoggedIn() or $this->disallow();
357 // more precise check will be done for each performed operation
359 // get array of itemids from request
360 $selected = requestIntArray('batch');
361 $action = requestVar('batchaction');
363 // Show error when no items were selected
364 if (!is_array($selected) || sizeof($selected) == 0)
365 $this->error(_BATCH_NOSELECTION);
367 // On delete: check if confirmation has been given
368 if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
369 $this->batchAskDeleteConfirmation('comment',$selected);
373 echo '<a href="index.php?action=overview">(',_BACKHOME,')</a>';
374 echo '<h2>',_BATCH_COMMENTS,'</h2>';
375 echo '<p>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b></p>';
378 // walk over all itemids and perform action
379 foreach ($selected as $commentid) {
380 $commentid = intval($commentid);
381 echo '<li>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b> ',_BATCH_ONCOMMENT,' <b>', $commentid, '</b>...';
383 // perform action, display errors if needed
386 $error = $this->deleteOneComment($commentid);
389 $error = _BATCH_UNKNOWN . $action;
392 echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
397 echo '<b>',_BATCH_DONE,'</b>';
404 function action_batchmember() {
407 // check if logged in and admin
408 ($member->isLoggedIn() && $member->isAdmin()) or $this->disallow();
410 // get array of itemids from request
411 $selected = requestIntArray('batch');
412 $action = requestVar('batchaction');
414 // Show error when no members selected
415 if (!is_array($selected) || sizeof($selected) == 0)
416 $this->error(_BATCH_NOSELECTION);
418 // On delete: check if confirmation has been given
419 if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
420 $this->batchAskDeleteConfirmation('member',$selected);
424 echo '<a href="index.php?action=usermanagement">(',_MEMBERS_BACKTOOVERVIEW,')</a>';
425 echo '<h2>',_BATCH_MEMBERS,'</h2>';
426 echo '<p>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b></p>';
429 // walk over all itemids and perform action
430 foreach ($selected as $memberid) {
431 $memberid = intval($memberid);
432 echo '<li>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b> ',_BATCH_ONMEMBER,' <b>', $memberid, '</b>...';
434 // perform action, display errors if needed
437 $error = $this->deleteOneMember($memberid);
441 sql_query('UPDATE ' . sql_table('member') . ' SET madmin=1 WHERE mnumber='.$memberid);
445 // there should always remain at least one super-admin
446 $r = sql_query('SELECT * FROM '.sql_table('member'). ' WHERE madmin=1 and mcanlogin=1');
447 if (mysql_num_rows($r) < 2)
448 $error = _ERROR_ATLEASTONEADMIN;
450 sql_query('UPDATE ' . sql_table('member') .' SET madmin=0 WHERE mnumber='.$memberid);
453 $error = _BATCH_UNKNOWN . $action;
456 echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
461 echo '<b>',_BATCH_DONE,'</b>';
469 function action_batchteam() {
472 $blogid = intRequestVar('blogid');
474 // check if logged in and admin
475 ($member->isLoggedIn() && $member->blogAdminRights($blogid)) or $this->disallow();
477 // get array of itemids from request
478 $selected = requestIntArray('batch');
479 $action = requestVar('batchaction');
481 // Show error when no members selected
482 if (!is_array($selected) || sizeof($selected) == 0)
483 $this->error(_BATCH_NOSELECTION);
485 // On delete: check if confirmation has been given
486 if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
487 $this->batchAskDeleteConfirmation('team',$selected);
491 echo '<p><a href="index.php?action=manageteam&blogid=',$blogid,'">(',_BACK,')</a></p>';
493 echo '<h2>',_BATCH_TEAM,'</h2>';
494 echo '<p>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b></p>';
497 // walk over all itemids and perform action
498 foreach ($selected as $memberid) {
499 $memberid = intval($memberid);
500 echo '<li>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b> ',_BATCH_ONTEAM,' <b>', $memberid, '</b>...';
502 // perform action, display errors if needed
505 $error = $this->deleteOneTeamMember($blogid, $memberid);
509 sql_query('UPDATE '.sql_table('team').' SET tadmin=1 WHERE tblog='.$blogid.' and tmember='.$memberid);
513 // there should always remain at least one admin
514 $r = sql_query('SELECT * FROM '.sql_table('team').' WHERE tadmin=1 and tblog='.$blogid);
515 if (mysql_num_rows($r) < 2)
516 $error = _ERROR_ATLEASTONEBLOGADMIN;
518 sql_query('UPDATE '.sql_table('team').' SET tadmin=0 WHERE tblog='.$blogid.' and tmember='.$memberid);
521 $error = _BATCH_UNKNOWN . $action;
524 echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
529 echo '<b>',_BATCH_DONE,'</b>';
538 function action_batchcategory() {
539 global $member, $manager;
541 // check if logged in
542 $member->isLoggedIn() or $this->disallow();
544 // more precise check will be done for each performed operation
546 // get array of itemids from request
547 $selected = requestIntArray('batch');
548 $action = requestVar('batchaction');
550 // Show error when no items were selected
551 if (!is_array($selected) || sizeof($selected) == 0)
552 $this->error(_BATCH_NOSELECTION);
554 // On move: when no destination blog chosen, show choice now
555 $destBlogId = intRequestVar('destblogid');
556 if (($action == 'move') && (!$manager->existsBlogID($destBlogId)))
557 $this->batchMoveCategorySelectDestination('category',$selected);
559 // On delete: check if confirmation has been given
560 if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
561 $this->batchAskDeleteConfirmation('category',$selected);
565 echo '<a href="index.php?action=overview">(',_BACKHOME,')</a>';
566 echo '<h2>',BATCH_CATEGORIES,'</h2>';
567 echo '<p>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b></p>';
570 // walk over all itemids and perform action
571 foreach ($selected as $catid) {
572 $catid = intval($catid);
573 echo '<li>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b> ',_BATCH_ONCATEGORY,' <b>', $catid, '</b>...';
575 // perform action, display errors if needed
578 $error = $this->deleteOneCategory($catid);
581 $error = $this->moveOneCategory($catid, $destBlogId);
584 $error = _BATCH_UNKNOWN . $action;
587 echo '<b>',($error ? 'Error: '.$error : _BATCH_SUCCESS),'</b>';
592 echo '<b>',_BATCH_DONE,'</b>';
598 function batchMoveSelectDestination($type, $ids) {
602 <h2><?php echo _MOVE_TITLE?></h2>
603 <form method="post" action="index.php"><div>
605 <input type="hidden" name="action" value="batch<?php echo $type?>" />
606 <input type="hidden" name="batchaction" value="move" />
608 $manager->addTicketHidden();
610 // insert selected item numbers
612 foreach ($ids as $id)
613 echo '<input type="hidden" name="batch[',($idx++),']" value="',intval($id),'" />';
615 // show blog/category selection list
616 $this->selectBlogCategory('destcatid');
621 <input type="submit" value="<?php echo _MOVE_BTN?>" onclick="return checkSubmit();" />
624 <?php $this->pagefoot();
628 function batchMoveCategorySelectDestination($type, $ids) {
632 <h2><?php echo _MOVECAT_TITLE?></h2>
633 <form method="post" action="index.php"><div>
635 <input type="hidden" name="action" value="batch<?php echo $type?>" />
636 <input type="hidden" name="batchaction" value="move" />
638 $manager->addTicketHidden();
640 // insert selected item numbers
642 foreach ($ids as $id)
643 echo '<input type="hidden" name="batch[',($idx++),']" value="',intval($id),'" />';
645 // show blog/category selection list
646 $this->selectBlog('destblogid');
651 <input type="submit" value="<?php echo _MOVECAT_BTN?>" onclick="return checkSubmit();" />
654 <?php $this->pagefoot();
658 function batchAskDeleteConfirmation($type, $ids) {
663 <h2><?php echo _BATCH_DELETE_CONFIRM?></h2>
664 <form method="post" action="index.php"><div>
666 <input type="hidden" name="action" value="batch<?php echo $type?>" />
667 <?php $manager->addTicketHidden() ?>
668 <input type="hidden" name="batchaction" value="delete" />
669 <input type="hidden" name="confirmation" value="yes" />
670 <?php // insert selected item numbers
672 foreach ($ids as $id)
673 echo '<input type="hidden" name="batch[',($idx++),']" value="',intval($id),'" />';
675 // add hidden vars for team & comment
678 echo '<input type="hidden" name="blogid" value="',intRequestVar('blogid'),'" />';
680 if ($type == 'comment')
682 echo '<input type="hidden" name="itemid" value="',intRequestVar('itemid'),'" />';
687 <input type="submit" value="<?php echo _BATCH_DELETE_CONFIRM_BTN?>" onclick="return checkSubmit();" />
690 <?php $this->pagefoot();
696 * Inserts a HTML select element with choices for all categories to which the current
699 function selectBlogCategory($name, $selected = 0, $tabindex = 0, $showNewCat = 0, $iForcedBlogInclude = -1) {
700 ADMIN::selectBlog($name, 'category', $selected, $tabindex, $showNewCat, $iForcedBlogInclude);
704 * Inserts a HTML select element with choices for all blogs to which the user has access
705 * mode = 'blog' => shows blognames and values are blogids
706 * mode = 'category' => show category names and values are catids
708 * @param $iForcedBlogInclude
709 * ID of a blog that always needs to be included, without checking if the member is on the blog team (-1 = none)
711 function selectBlog($name, $mode='blog', $selected = 0, $tabindex = 0, $showNewCat = 0, $iForcedBlogInclude = -1) {
712 global $member, $CONF;
714 // 0. get IDs of blogs to which member can post items (+ forced blog)
716 if ($iForcedBlogInclude != -1)
717 $aBlogIds[] = intval($iForcedBlogInclude);
719 if (($member->isAdmin()) && ($CONF['ShowAllBlogs']))
720 $queryBlogs = 'SELECT bnumber FROM '.sql_table('blog').' ORDER BY bname';
722 $queryBlogs = 'SELECT bnumber FROM '.sql_table('blog').', '.sql_table('team').' WHERE tblog=bnumber and tmember=' . $member->getID();
723 $rblogids = sql_query($queryBlogs);
724 while ($o = mysql_fetch_object($rblogids))
725 if ($o->bnumber != $iForcedBlogInclude)
726 $aBlogIds[] = intval($o->bnumber);
728 if (count($aBlogIds) == 0)
731 echo '<select name="',$name,'" tabindex="',$tabindex,'">';
733 // 1. select blogs (we'll create optiongroups)
734 // (only select those blogs that have the user on the team)
735 $queryBlogs = 'SELECT bnumber, bname FROM '.sql_table('blog').' WHERE bnumber in ('.implode(',',$aBlogIds).') ORDER BY bname';
736 $blogs = sql_query($queryBlogs);
737 if ($mode == 'category') {
738 if (mysql_num_rows($blogs) > 1)
741 while ($oBlog = mysql_fetch_object($blogs)) {
743 echo '<optgroup label="',htmlspecialchars($oBlog->bname),'">';
745 // show selection to create new category when allowed/wanted
747 // check if allowed to do so
748 if ($member->blogAdminRights($oBlog->bnumber))
749 echo '<option value="newcat-',$oBlog->bnumber,'">',_ADD_NEWCAT,'</option>';
752 // 2. for each category in that blog
753 $categories = sql_query('SELECT cname, catid FROM '.sql_table('category').' WHERE cblog=' . $oBlog->bnumber . ' ORDER BY cname ASC');
754 while ($oCat = mysql_fetch_object($categories)) {
755 if ($oCat->catid == $selected)
756 $selectText = ' selected="selected" ';
759 echo '<option value="',$oCat->catid,'" ', $selectText,'>',htmlspecialchars($oCat->cname),'</option>';
767 while ($oBlog = mysql_fetch_object($blogs)) {
768 echo '<option value="',$oBlog->bnumber,'"';
769 if ($oBlog->bnumber == $selected)
770 echo ' selected="selected"';
771 echo'>',htmlspecialchars($oBlog->bname),'</option>';
778 function action_browseownitems() {
783 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
784 echo '<h2>' . _ITEMLIST_YOUR. '</h2>';
787 if (postVar('start'))
788 $start = postVar('start');
792 // amount of items to show
793 if (postVar('amount'))
794 $amount = postVar('amount');
798 $search = postVar('search'); // search through items
800 $query = 'SELECT bshortname, cname, mname, ititle, ibody, idraft, inumber, itime'
801 . ' FROM '.sql_table('item').', '.sql_table('blog') . ', '.sql_table('member') . ', '.sql_table('category')
802 . ' WHERE iauthor='. $member->getID() .' and iauthor=mnumber and iblog=bnumber and icat=catid';
805 $query .= ' and ((ititle LIKE "%' . addslashes($search) . '%") or (ibody LIKE "%' . addslashes($search) . '%") or (imore LIKE "%' . addslashes($search) . '%"))';
807 $query .= ' ORDER BY itime DESC'
808 . " LIMIT $start,$amount";
810 $template['content'] = 'itemlist';
811 $template['now'] = time();
813 $navList =& new NAVLIST('browseownitems', $start, $amount, 0, 1000, $blogid, $search, 0);
814 $navList->showBatchList('item',$query,'table',$template);
821 * Show all the comments for a given item
823 function action_itemcommentlist($itemid = '') {
827 $itemid = intRequestVar('itemid');
829 // only allow if user is allowed to alter item
830 $member->canAlterItem($itemid) or $this->disallow();
832 $blogid = getBlogIdFromItemId($itemid);
837 if (postVar('start'))
838 $start = postVar('start');
842 // amount of items to show
843 if (postVar('amount'))
844 $amount = postVar('amount');
848 $search = postVar('search');
850 echo '<p>(<a href="index.php?action=itemlist&blogid=',$blogid,'">',_BACKTOOVERVIEW,'</a>)</p>';
851 echo '<h2>',_COMMENTS,'</h2>';
853 $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 citem=' . $itemid;
856 $query .= ' and cbody LIKE "%' . addslashes($search) . '%"';
858 $query .= ' ORDER BY ctime ASC'
859 . " LIMIT $start,$amount";
861 $template['content'] = 'commentlist';
862 $template['canAddBan'] = $member->blogAdminRights(getBlogIDFromItemID($itemid));
864 $navList =& new NAVLIST('itemcommentlist', $start, $amount, 0, 1000, 0, $search, $itemid);
865 $navList->showBatchList('comment',$query,'table',$template,_NOCOMMENTS);
871 * Browse own comments
873 function action_browseowncomments() {
877 if (postVar('start'))
878 $start = postVar('start');
882 // amount of items to show
883 if (postVar('amount'))
884 $amount = postVar('amount');
888 $search = postVar('search');
891 $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();
894 $query .= ' and cbody LIKE "%' . addslashes($search) . '%"';
896 $query .= ' ORDER BY ctime DESC'
897 . " LIMIT $start,$amount";
901 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
902 echo '<h2>', _COMMENTS_YOUR ,'</h2>';
904 $template['content'] = 'commentlist';
905 $template['canAddBan'] = 0; // doesn't make sense to allow banning yourself
907 $navList =& new NAVLIST('browseowncomments', $start, $amount, 0, 1000, 0, $search, 0);
908 $navList->showBatchList('comment',$query,'table',$template,_NOCOMMENTS_YOUR);
914 * Browse all comments for a weblog
916 function action_blogcommentlist($blogid = '')
918 global $member, $manager;
921 $blogid = intRequestVar('blogid');
923 $blogid = intval($blogid);
925 $member->teamRights($blogid) or $member->isAdmin() or $this->disallow();
928 if (postVar('start'))
929 $start = postVar('start');
933 // amount of items to show
934 if (postVar('amount'))
935 $amount = postVar('amount');
939 $search = postVar('search'); // search through comments
942 $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 cblog=' . intval($blogid);
945 $query .= ' and cbody LIKE "%' . addslashes($search) . '%"';
948 $query .= ' ORDER BY ctime DESC'
949 . " LIMIT $start,$amount";
952 $blog =& $manager->getBlog($blogid);
956 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
957 echo '<h2>', _COMMENTS_BLOG , ' ' , $this->bloglink($blog), '</h2>';
959 $template['content'] = 'commentlist';
960 $template['canAddBan'] = $member->blogAdminRights($blogid);
962 $navList =& new NAVLIST('blogcommentlist', $start, $amount, 0, 1000, $blogid, $search, 0);
963 $navList->showBatchList('comment',$query,'table',$template, _NOCOMMENTS_BLOG);
969 * Provide a page to item a new item to the given blog
971 function action_createitem() {
972 global $member, $manager;
974 $blogid = intRequestVar('blogid');
977 $member->teamRights($blogid) or $this->disallow();
979 $memberid = $member->getID();
981 $blog =& $manager->getBlog($blogid);
985 // generate the add-item form
986 $formfactory =& new PAGEFACTORY($blogid);
987 $formfactory->createAddForm('admin');
992 function action_itemedit() {
993 global $member, $manager;
995 $itemid = intRequestVar('itemid');
997 // only allow if user is allowed to alter item
998 $member->canAlterItem($itemid) or $this->disallow();
1000 $item =& $manager->getItem($itemid,1,1);
1001 $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
1003 $manager->notify('PrepareItemForEdit', array('item' => &$item));
1005 if ($blog->convertBreaks()) {
1006 $item['body'] = removeBreaks($item['body']);
1007 $item['more'] = removeBreaks($item['more']);
1010 // form to edit blog items
1012 $formfactory =& new PAGEFACTORY($blog->getID());
1013 $formfactory->createEditForm('admin',$item);
1017 function action_itemupdate() {
1018 global $member, $manager, $CONF;
1020 $itemid = intRequestVar('itemid');
1021 $catid = postVar('catid');
1023 // only allow if user is allowed to alter item
1024 $member->canUpdateItem($itemid, $catid) or $this->disallow();
1026 $actiontype = postVar('actiontype');
1028 // delete actions are handled by itemdelete (which has confirmation)
1029 if ($actiontype == 'delete') {
1030 $this->action_itemdelete();
1034 $body = postVar('body');
1035 $title = postVar('title');
1036 $more = postVar('more');
1037 $closed = intPostVar('closed');
1039 // default action = add now
1041 $actiontype='addnow';
1043 // create new category if needed
1044 if (strstr($catid,'newcat')) {
1046 list($blogid) = sscanf($catid,"newcat-%d");
1049 $blog =& $manager->getBlog($blogid);
1050 $catid = $blog->createNewCategory();
1052 // show error when sth goes wrong
1054 $this->doError(_ERROR_CATCREATEFAIL);
1058 set some variables based on actiontype
1061 draft items -> addnow, addfuture, adddraft, delete
1062 non-draft items -> edit, changedate, delete
1065 $timestamp: set to a nonzero value for future dates or date changes
1066 $wasdraft: set to 1 when the item used to be a draft item
1067 $publish: set to 1 when the edited item is not a draft
1069 switch ($actiontype) {
1078 $timestamp = mktime(postVar('hour'), postVar('minutes'), 0, postVar('month'), postVar('day'), postVar('year'));
1086 $timestamp = mktime(postVar('hour'), postVar('minutes'), 0, postVar('month'), postVar('day'), postVar('year'));
1097 // edit the item for real
1098 ITEM::update($itemid, $catid, $title, $body, $more, $closed, $wasdraft, $publish, $timestamp);
1100 $blogid = getBlogIDFromItemID($itemid);
1101 $blog =& $manager->getBlog($blogid);
1102 if (!$closed && $publish && $wasdraft && $blog->pingUserland()) {
1103 $this->action_sendping($blogid);
1107 // show category edit window when we created a new category
1108 // ($catid will then be a new category ID, while postVar('catid') will be 'newcat-x')
1109 if ($catid != intPostVar('catid')) {
1110 $this->action_categoryedit(
1113 $CONF['AdminURL'] . 'index.php?action=itemlist&blogid=' . getBlogIDFromItemID($itemid)
1116 // TODO: set start item correctly for itemlist
1117 $this->action_itemlist(getBlogIDFromItemID($itemid));
1121 function action_itemdelete() {
1122 global $member, $manager;
1124 $itemid = intRequestVar('itemid');
1126 // only allow if user is allowed to alter item
1127 $member->canAlterItem($itemid) or $this->disallow();
1129 if (!$manager->existsItem($itemid,1,1))
1130 $this->error(_ERROR_NOSUCHITEM);
1132 $item =& $manager->getItem($itemid,1,1);
1133 $title = htmlspecialchars(strip_tags($item['title']));
1134 $body = strip_tags($item['body']);
1135 $body = htmlspecialchars(shorten($body,300,'...'));
1139 <h2><?php echo _DELETE_CONFIRM?></h2>
1141 <p><?php echo _CONFIRMTXT_ITEM?></p>
1144 <b>"<?php echo $title ?>"</b>
1149 <form method="post" action="index.php"><div>
1150 <input type="hidden" name="action" value="itemdeleteconfirm" />
1151 <?php $manager->addTicketHidden() ?>
1152 <input type="hidden" name="itemid" value="<?php echo $itemid; ?>" />
1153 <input type="submit" value="<?php echo _DELETE_CONFIRM_BTN?>" tabindex="10" />
1159 function action_itemdeleteconfirm() {
1162 $itemid = intRequestVar('itemid');
1164 // only allow if user is allowed to alter item
1165 $member->canAlterItem($itemid) or $this->disallow();
1168 $blogid = getBlogIdFromItemId($itemid);
1170 // delete item (note: some checks will be performed twice)
1171 $this->deleteOneItem($itemid);
1173 $this->action_itemlist($blogid);
1176 // deletes one item and returns error if something goes wrong
1177 function deleteOneItem($itemid) {
1178 global $member, $manager;
1180 // only allow if user is allowed to alter item (also checks if itemid exists)
1181 if (!$member->canAlterItem($itemid))
1182 return _ERROR_DISALLOWED;
1184 $manager->loadClass('ITEM');
1185 ITEM::delete($itemid);
1188 function action_itemmove() {
1189 global $member, $manager;
1191 $itemid = intRequestVar('itemid');
1193 // only allow if user is allowed to alter item
1194 $member->canAlterItem($itemid) or $this->disallow();
1196 $item =& $manager->getItem($itemid,1,1);
1200 <h2><?php echo _MOVE_TITLE?></h2>
1201 <form method="post" action="index.php"><div>
1202 <input type="hidden" name="action" value="itemmoveto" />
1203 <input type="hidden" name="itemid" value="<?php echo $itemid; ?>" />
1207 $manager->addTicketHidden();
1208 $this->selectBlogCategory('catid',$item['catid'],10,1);
1211 <input type="submit" value="<?php echo _MOVE_BTN?>" tabindex="10000" onclick="return checkSubmit();" />
1217 function action_itemmoveto() {
1218 global $member, $manager;
1220 $itemid = intRequestVar('itemid');
1221 $catid = requestVar('catid');
1223 // create new category if needed
1224 if (strstr($catid,'newcat')) {
1226 list($blogid) = sscanf($catid,'newcat-%d');
1229 $blog =& $manager->getBlog($blogid);
1230 $catid = $blog->createNewCategory();
1232 // show error when sth goes wrong
1234 $this->doError(_ERROR_CATCREATEFAIL);
1237 // only allow if user is allowed to alter item
1238 $member->canUpdateItem($itemid, $catid) or $this->disallow();
1240 ITEM::move($itemid, $catid);
1242 if ($catid != intRequestVar('catid'))
1243 $this->action_categoryedit($catid, $blog->getID());
1245 $this->action_itemlist(getBlogIDFromCatID($catid));
1249 * Moves one item to a given category (category existance should be checked by caller)
1250 * errors are returned
1252 function moveOneItem($itemid, $destCatid) {
1255 // only allow if user is allowed to move item
1256 if (!$member->canUpdateItem($itemid, $destCatid))
1257 return _ERROR_DISALLOWED;
1259 ITEM::move($itemid, $destCatid);
1263 * Adds a item to the chosen blog
1265 function action_additem() {
1266 global $member, $manager, $CONF;
1268 $manager->loadClass('ITEM');
1270 $result = ITEM::createFromRequest();
1272 if ($result['status'] == 'error')
1273 $this->error($result['message']);
1275 $blogid = getBlogIDFromItemID($result['itemid']);
1276 $blog =& $manager->getBlog($blogid);
1278 $pingUrl = $manager->addTicketToUrl($CONF['AdminURL'] . 'index.php?action=sendping&blogid=' . intval($blogid));
1280 if ($result['status'] == 'newcategory')
1281 $this->action_categoryedit(
1284 $blog->pingUserland() ? $pingUrl : ''
1286 elseif ((postVar('actiontype') == 'addnow') && $blog->pingUserland())
1287 $this->action_sendping($blogid);
1289 $this->action_itemlist($blogid);
1293 * Shows a window that says we're about to ping weblogs.com.
1294 * immediately refresh to the real pinging page, which will
1295 * show an error, or redirect to the blog.
1297 * @param $blogid ID of blog for which ping needs to be sent out
1299 function action_sendping($blogid = -1) {
1300 global $member, $manager;
1303 $blogid = intRequestVar('blogid');
1305 $member->isLoggedIn() or $this->disallow();
1307 $rawPingUrl = $manager->addTicketToUrl('index.php?action=rawping&blogid=' . intval($blogid));
1309 $this->pagehead('<meta http-equiv="refresh" content="1; url='.htmlspecialchars($rawPingUrl).'" />');
1311 <h2>Site Updated, Now pinging weblogs.com</h2>
1314 Pinging weblogs.com! This can a while...
1316 When the ping is complete (and successfull), your weblog will show up in the weblogs.com updates list.
1320 If you aren't automatically passed through, <a href="index.php?action=rawping&blogid=<?php echo $blogid?>">try again</a>
1322 <?php $this->pagefoot();
1325 // ping to Weblogs.com
1326 // sends the real ping (can take up to 10 seconds!)
1327 function action_rawping() {
1331 $blogid = intRequestVar('blogid');
1332 $blog =& $manager->getBlog($blogid);
1334 $result = $blog->sendUserlandPing();
1340 <h2>Ping Results</h2>
1342 <p>The following message was returned by weblogs.com:</p>
1344 <div class='note'><?php echo $result ?></div>
1347 <li><a href="index.php?action=itemlist&blogid=<?php echo $blog->getID()?>">View list of recent items for <?php echo htmlspecialchars($blog->getName())?></a></li>
1348 <li><a href="<?php echo $blog->getURL()?>">Visit your own site</a></li>
1351 <?php $this->pagefoot();
1355 * Allows to edit previously made comments
1357 function action_commentedit() {
1358 global $member, $manager;
1360 $commentid = intRequestVar('commentid');
1362 $member->canAlterComment($commentid) or $this->disallow();
1364 $comment = COMMENT::getComment($commentid);
1366 $manager->notify('PrepareCommentForEdit',array('comment' => &$comment));
1368 // change <br /> to \n
1369 $comment['body'] = str_replace('<br />','',$comment['body']);
1371 $comment['body'] = eregi_replace("<a href=['\"]([^'\"]+)['\"]>[^<]*</a>","\\1",$comment['body']);
1376 <h2><?php echo _EDITC_TITLE?></h2>
1378 <form action="index.php" method="post"><div>
1380 <input type="hidden" name="action" value="commentupdate" />
1381 <?php $manager->addTicketHidden(); ?>
1382 <input type="hidden" name="commentid" value="<?php echo $commentid; ?>" />
1384 <th colspan="2"><?php echo _EDITC_TITLE?></th>
1386 <td><?php echo _EDITC_WHO?></td>
1388 <?php if ($comment['member'])
1389 echo $comment['member'] . " (" . _EDITC_MEMBER . ")";
1391 echo $comment['user'] . " (" . _EDITC_NONMEMBER . ")";
1395 <td><?php echo _EDITC_WHEN?></td>
1396 <td><?php echo date("Y-m-d @ H:i",$comment['timestamp']); ?></td>
1398 <td><?php echo _EDITC_HOST?></td>
1399 <td><?php echo $comment['host']; ?></td>
1401 <td><?php echo _EDITC_TEXT?></td>
1403 <textarea name="body" tabindex="10" rows="10" cols="50"><?php // htmlspecialchars not needed (things should be escaped already)
1404 echo $comment['body'];
1408 <td><?php echo _EDITC_EDIT?></td>
1409 <td><input type="submit" tabindex="20" value="<?php echo _EDITC_EDIT?>" onclick="return checkSubmit();" /></td>
1417 function action_commentupdate() {
1418 global $member, $manager;
1420 $commentid = intRequestVar('commentid');
1422 $member->canAlterComment($commentid) or $this->disallow();
1424 $body = postVar('body');
1426 // intercept words that are too long
1427 if (eregi("[a-zA-Z0-9|\.,;:!\?=\/\\]{90,90}",$body) != false)
1428 $this->error(_ERROR_COMMENT_LONGWORD);
1431 if (strlen($body)<3)
1432 $this->error(_ERROR_COMMENT_NOCOMMENT);
1433 if (strlen($body)>5000)
1434 $this->error(_ERROR_COMMENT_TOOLONG);
1438 $body = COMMENT::prepareBody($body);
1441 $manager->notify('PreUpdateComment',array('body' => &$body));
1443 $query = 'UPDATE '.sql_table('comment')
1444 . " SET cbody='" .addslashes($body). "'"
1445 . " WHERE cnumber=" . $commentid;
1449 $res = sql_query('SELECT citem FROM '.sql_table('comment').' WHERE cnumber=' . $commentid);
1450 $o = mysql_fetch_object($res);
1451 $itemid = $o->citem;
1453 if ($member->canAlterItem($itemid))
1454 $this->action_itemcommentlist($itemid);
1456 $this->action_browseowncomments();
1460 function action_commentdelete() {
1461 global $member, $manager;
1463 $commentid = intRequestVar('commentid');
1465 $member->canAlterComment($commentid) or $this->disallow();
1467 $comment = COMMENT::getComment($commentid);
1469 $body = strip_tags($comment['body']);
1470 $body = htmlspecialchars(shorten($body, 300, '...'));
1472 if ($comment['member'])
1473 $author = $comment['member'];
1475 $author = $comment['user'];
1480 <h2><?php echo _DELETE_CONFIRM?></h2>
1482 <p><?php echo _CONFIRMTXT_COMMENT?></p>
1485 <b><?php echo _EDITC_WHO?>:</b> <?php echo $author ?>
1487 <b><?php echo _EDITC_TEXT?>:</b> <?php echo $body ?>
1490 <form method="post" action="index.php"><div>
1491 <input type="hidden" name="action" value="commentdeleteconfirm" />
1492 <?php $manager->addTicketHidden() ?>
1493 <input type="hidden" name="commentid" value="<?php echo $commentid; ?>" />
1494 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
1500 function action_commentdeleteconfirm() {
1503 $commentid = intRequestVar('commentid');
1505 // get item id first
1506 $res = sql_query('SELECT citem FROM '.sql_table('comment') .' WHERE cnumber=' . $commentid);
1507 $o = mysql_fetch_object($res);
1508 $itemid = $o->citem;
1510 $error = $this->deleteOneComment($commentid);
1512 $this->doError($error);
1514 if ($member->canAlterItem($itemid))
1515 $this->action_itemcommentlist($itemid);
1517 $this->action_browseowncomments();
1520 function deleteOneComment($commentid) {
1521 global $member, $manager;
1523 $commentid = intval($commentid);
1525 if (!$member->canAlterComment($commentid))
1526 return _ERROR_DISALLOWED;
1528 $manager->notify('PreDeleteComment', array('commentid' => $commentid));
1530 // delete the comments associated with the item
1531 $query = 'DELETE FROM '.sql_table('comment').' WHERE cnumber=' . $commentid;
1534 $manager->notify('PostDeleteComment', array('commentid' => $commentid));
1540 * Usermanagement main
1542 function action_usermanagement() {
1543 global $member, $manager;
1546 $member->isAdmin() or $this->disallow();
1550 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
1552 echo '<h2>' . _MEMBERS_TITLE .'</h2>';
1554 echo '<h3>' . _MEMBERS_CURRENT .'</h3>';
1556 // show list of members with actions
1558 . ' FROM '.sql_table('member');
1559 $template['content'] = 'memberlist';
1560 $template['tabindex'] = 10;
1562 $batch =& new BATCH('member');
1563 $batch->showlist($query,'table',$template);
1565 echo '<h3>' . _MEMBERS_NEW .'</h3>';
1567 <form method="post" action="index.php"><div>
1569 <input type="hidden" name="action" value="memberadd" />
1570 <?php $manager->addTicketHidden() ?>
1574 <th colspan="2"><?php echo _MEMBERS_NEW?></th>
1576 <td><?php echo _MEMBERS_DISPLAY?> <?php help('shortnames');?>
1577 <br /><small>(This is the name used to logon)</small>
1579 <td><input tabindex="10010" name="name" size="16" maxlength="16" /></td>
1581 <td><?php echo _MEMBERS_REALNAME?></td>
1582 <td><input name="realname" tabindex="10020" size="40" maxlength="60" /></td>
1584 <td><?php echo _MEMBERS_PWD?></td>
1585 <td><input name="password" tabindex="10030" size="16" maxlength="40" type="password" /></td>
1587 <td><?php echo _MEMBERS_REPPWD?></td>
1588 <td><input name="repeatpassword" tabindex="10035" size="16" maxlength="40" type="password" /></td>
1590 <td><?php echo _MEMBERS_EMAIL?></td>
1591 <td><input name="email" tabindex="10040" size="40" maxlength="60" /></td>
1593 <td><?php echo _MEMBERS_URL?></td>
1594 <td><input name="url" tabindex="10050" size="40" maxlength="100" /></td>
1596 <td><?php echo _MEMBERS_SUPERADMIN?> <?php help('superadmin'); ?></td>
1597 <td><?php $this->input_yesno('admin',0,10060); ?> </td>
1599 <td><?php echo _MEMBERS_CANLOGIN?> <?php help('canlogin'); ?></td>
1600 <td><?php $this->input_yesno('canlogin',1,10070); ?></td>
1602 <td><?php echo _MEMBERS_NOTES?></td>
1603 <td><input name="notes" maxlength="100" size="40" tabindex="10080" /></td>
1605 <td><?php echo _MEMBERS_NEW?></td>
1606 <td><input type="submit" value="<?php echo _MEMBERS_NEW_BTN?>" tabindex="10090" onclick="return checkSubmit();" /></td>
1615 * Edit member settings
1617 function action_memberedit() {
1618 $this->action_editmembersettings(intRequestVar('memberid'));
1620 function action_editmembersettings($memberid = '') {
1621 global $member, $manager, $CONF;
1623 if ($memberid == '')
1624 $memberid = $member->getID();
1627 ($member->getID() == $memberid) or $member->isAdmin() or $this->disallow();
1629 $extrahead = '<script type="text/javascript" src="javascript/numbercheck.js"></script>';
1630 $this->pagehead($extrahead);
1632 // show message to go back to member overview (only for admins)
1633 if ($member->isAdmin())
1634 echo '<a href="index.php?action=usermanagement">(' ._MEMBERS_BACKTOOVERVIEW. ')</a>';
1636 echo '<a href="index.php?action=overview">(' ._BACKHOME. ')</a>';
1638 echo '<h2>' . _MEMBERS_EDIT . '</h2>';
1640 $mem = MEMBER::createFromID($memberid);
1643 <form method="post" action="index.php"><div>
1645 <input type="hidden" name="action" value="changemembersettings" />
1646 <input type="hidden" name="memberid" value="<?php echo $memberid; ?>" />
1647 <?php $manager->addTicketHidden() ?>
1650 <th colspan="2"><?php echo _MEMBERS_EDIT?></th>
1652 <td><?php echo _MEMBERS_DISPLAY?> <?php help('shortnames');?>
1653 <br /><small><?php echo _MEMBERS_DISPLAY_INFO?></small>
1656 <?php if ($CONF['AllowLoginEdit'] || $member->isAdmin()) { ?>
1657 <input name="name" tabindex="10" maxlength="16" size="16" value="<?php echo htmlspecialchars($mem->getDisplayName()); ?>" />
1659 echo htmlspecialchars($member->getDisplayName());
1664 <td><?php echo _MEMBERS_REALNAME?></td>
1665 <td><input name="realname" tabindex="20" maxlength="60" size="40" value="<?php echo htmlspecialchars($mem->getRealName()); ?>" /></td>
1667 <?php if ($CONF['AllowLoginEdit'] || $member->isAdmin()) { ?>
1668 <td><?php echo _MEMBERS_PWD?></td>
1669 <td><input type="password" tabindex="30" maxlength="40" size="16" name="password" /></td>
1671 <td><?php echo _MEMBERS_REPPWD?></td>
1672 <td><input type="password" tabindex="35" maxlength="40" size="16" name="repeatpassword" /></td>
1675 <td><?php echo _MEMBERS_EMAIL?>
1676 <br /><small><?php echo _MEMBERS_EMAIL_EDIT?></small>
1678 <td><input name="email" tabindex="40" size="40" maxlength="60" value="<?php echo htmlspecialchars($mem->getEmail()); ?>" /></td>
1680 <td><?php echo _MEMBERS_URL?></td>
1681 <td><input name="url" tabindex="50" size="40" maxlength="100" value="<?php echo htmlspecialchars($mem->getURL()); ?>" /></td>
1682 <?php // only allow to change this by super-admins
1683 // we don't want normal users to 'upgrade' themselves to super-admins, do we? ;-)
1684 if ($member->isAdmin()) {
1687 <td><?php echo _MEMBERS_SUPERADMIN?> <?php help('superadmin'); ?></td>
1688 <td><?php $this->input_yesno('admin',$mem->isAdmin(),60); ?></td>
1690 <td><?php echo _MEMBERS_CANLOGIN?> <?php help('canlogin'); ?></td>
1691 <td><?php $this->input_yesno('canlogin',$mem->canLogin(),70); ?></td>
1694 <td><?php echo _MEMBERS_NOTES?></td>
1695 <td><input name="notes" tabindex="80" size="40" maxlength="100" value="<?php echo htmlspecialchars($mem->getNotes()); ?>" /></td>
1697 <td><?php echo _MEMBERS_DEFLANG?> <?php help('language'); ?>
1701 <select name="deflang" tabindex="85">
1702 <option value=""><?php echo _MEMBERS_USESITELANG?></option>
1703 <?php // show a dropdown list of all available languages
1705 $dirhandle = opendir($DIR_LANG);
1706 while ($filename = readdir($dirhandle)) {
1707 if (ereg("^(.*)\.php$",$filename,$matches)) {
1708 $name = $matches[1];
1709 echo "<option value='$name'";
1710 if ($name == $mem->getLanguage())
1711 echo " selected='selected'";
1712 echo ">$name</option>";
1715 closedir($dirhandle);
1724 $this->_insertPluginOptions('member',$memberid);
1727 <th colspan="2"><?php echo _MEMBERS_EDIT ?></th>
1729 <td><?php echo _MEMBERS_EDIT?></td>
1730 <td><input type="submit" tabindex="90" value="<?php echo _MEMBERS_EDIT_BTN?>" onclick="return checkSubmit();" /></td>
1736 echo '<h3>',_PLUGINS_EXTRA,'</h3>';
1739 'MemberSettingsFormExtras',
1749 function action_changemembersettings() {
1750 global $member, $CONF, $manager;
1752 $memberid = intRequestVar('memberid');
1755 ($member->getID() == $memberid) or $member->isAdmin() or $this->disallow();
1757 $name = trim(postVar('name'));
1758 $realname = trim(postVar('realname'));
1759 $password = postVar('password');
1760 $repeatpassword = postVar('repeatpassword');
1761 $email = postVar('email');
1762 $url = postVar('url');
1764 // Sometimes user didn't prefix the URL with http://, this cause a malformed URL. Let's fix it.
1765 if (!eregi("^https?://", $url))
1766 $url = "http://".$url;
1768 $admin = postVar('admin');
1769 $canlogin = postVar('canlogin');
1770 $notes = postVar('notes');
1771 $deflang = postVar('deflang');
1773 $mem = MEMBER::createFromID($memberid);
1775 if ($CONF['AllowLoginEdit'] || $member->isAdmin()) {
1777 if (!isValidDisplayName($name))
1778 $this->error(_ERROR_BADNAME);
1780 if (($name != $mem->getDisplayName()) && MEMBER::exists($name))
1781 $this->error(_ERROR_NICKNAMEINUSE);
1783 if ($password != $repeatpassword)
1784 $this->error(_ERROR_PASSWORDMISMATCH);
1786 if ($password && (strlen($password) < 6))
1787 $this->error(_ERROR_PASSWORDTOOSHORT);
1790 if (!isValidMailAddress($email))
1791 $this->error(_ERROR_BADMAILADDRESS);
1795 $this->error(_ERROR_REALNAMEMISSING);
1797 if (($deflang != '') && (!checkLanguage($deflang)))
1798 $this->error(_ERROR_NOSUCHLANGUAGE);
1800 // check if there will remain at least one site member with both the logon and admin rights
1801 // (check occurs when taking away one of these rights from such a member)
1802 if ( (!$admin && $mem->isAdmin() && $mem->canLogin())
1803 || (!$canlogin && $mem->isAdmin() && $mem->canLogin())
1806 $r = sql_query('SELECT * FROM '.sql_table('member').' WHERE madmin=1 and mcanlogin=1');
1807 if (mysql_num_rows($r) < 2)
1808 $this->error(_ERROR_ATLEASTONEADMIN);
1811 if ($CONF['AllowLoginEdit'] || $member->isAdmin()) {
1812 $mem->setDisplayName($name);
1814 $mem->setPassword($password);
1818 $mem->setPassword($password);
1820 $oldEmail = $mem->getEmail();
1822 $mem->setRealName($realname);
1823 $mem->setEmail($email);
1825 $mem->setNotes($notes);
1826 $mem->setLanguage($deflang);
1829 // only allow super-admins to make changes to the admin status
1830 if ($member->isAdmin()) {
1831 $mem->setAdmin($admin);
1832 $mem->setCanLogin($canlogin);
1838 // if email changed, generate new password
1839 if ($oldEmail != $mem->getEmail())
1841 $mem->sendActivationLink('addresschange', $oldEmail);
1843 $mem->newCookieKey();
1845 $this->action_login(_MSG_ACTIVATION_SENT, 0);
1850 // store plugin options
1851 $aOptions = requestArray('plugoption');
1852 NucleusPlugin::_applyPluginOptions($aOptions);
1853 $manager->notify('PostPluginOptionsUpdate',array('context' => 'member', 'memberid' => $memberid, 'member' => &$mem));
1855 if ( ( $mem->getID() == $member->getID() )
1856 && ( $newpass || ( $mem->getDisplayName() != $member->getDisplayName() ) )
1858 $mem->newCookieKey();
1860 $this->action_login(_MSG_LOGINAGAIN, 0);
1862 $this->action_overview(_MSG_SETTINGSCHANGED);
1866 function action_memberadd() {
1870 $member->isAdmin() or $this->disallow();
1872 if (postVar('password') != postVar('repeatpassword'))
1873 $this->error(_ERROR_PASSWORDMISMATCH);
1874 if (strlen(postVar('password')) < 6)
1875 $this->error(_ERROR_PASSWORDTOOSHORT);
1877 $res = MEMBER::create(postVar('name'), postVar('realname'), postVar('password'), postVar('email'), postVar('url'), postVar('admin'), postVar('canlogin'), postVar('notes'));
1881 $this->action_usermanagement();
1885 * Account activation
1889 function action_activate() {
1891 $key = getVar('key');
1892 $this->_showActivationPage($key);
1895 function _showActivationPage($key, $message = '')
1899 // clean up old activation keys
1900 MEMBER::cleanupActivationTable();
1902 // get activation info
1903 $info = MEMBER::getActivationInfo($key);
1906 $this->error(_ERROR_ACTIVATE);
1908 $mem = MEMBER::createFromId($info->vmember);
1911 $this->error(_ERROR_ACTIVATE);
1915 $bNeedsPasswordChange = true;
1917 switch ($info->vtype)
1920 $title = _ACTIVATE_FORGOT_TITLE;
1921 $text = _ACTIVATE_FORGOT_TEXT;
1924 $title = _ACTIVATE_REGISTER_TITLE;
1925 $text = _ACTIVATE_REGISTER_TEXT;
1927 case 'addresschange':
1928 $title = _ACTIVATE_CHANGE_TITLE;
1929 $text = _ACTIVATE_CHANGE_TEXT;
1930 $bNeedsPasswordChange = false;
1931 MEMBER::activate($key);
1936 'memberName' => htmlspecialchars($mem->getDisplayName())
1938 $title = TEMPLATE::fill($title, $aVars);
1939 $text = TEMPLATE::fill($text, $aVars);
1943 echo '<h2>' , $title, '</h2>';
1944 echo '<p>' , $text, '</p>';
1948 echo '<p class="error">',$message,'</p>';
1951 if ($bNeedsPasswordChange)
1954 <div><form action="index.php" method="post">
1956 <input type="hidden" name="action" value="activatesetpwd" />
1957 <?php $manager->addTicketHidden() ?>
1958 <input type="hidden" name="key" value="<?php echo htmlspecialchars($key) ?>" />
1961 <td><?php echo _MEMBERS_PWD?></td>
1962 <td><input type="password" maxlength="40" size="16" name="password" /></td>
1964 <td><?php echo _MEMBERS_REPPWD?></td>
1965 <td><input type="password" maxlength="40" size="16" name="repeatpassword" /></td>
1969 $manager->notify('FormExtra', array('type' => 'activation', 'member' => $mem));
1973 <td><?php echo _MEMBERS_SETPWD ?></td>
1974 <td><input type='submit' value='<?php echo _MEMBERS_SETPWD_BTN ?>' /></td>
1989 * Account activation - set password part
1993 function action_activatesetpwd() {
1995 $key = postVar('key');
1997 // clean up old activation keys
1998 MEMBER::cleanupActivationTable();
2000 // get activation info
2001 $info = MEMBER::getActivationInfo($key);
2003 if (!$info || ($info->type == 'addresschange'))
2004 return $this->_showActivationPage($key, _ERROR_ACTIVATE);
2006 $mem = MEMBER::createFromId($info->vmember);
2009 return $this->_showActivationPage($key, _ERROR_ACTIVATE);
2011 $password = postVar('password');
2012 $repeatpassword = postVar('repeatpassword');
2014 if ($password != $repeatpassword)
2015 return $this->_showActivationPage($key, _ERROR_PASSWORDMISMATCH);
2017 if ($password && (strlen($password) < 6))
2018 return $this->_showActivationPage($key, _ERROR_PASSWORDTOOSHORT);
2022 $manager->notify('ValidateForm', array('type' => 'activation', 'member' => $mem, 'error' => &$error));
2024 return $this->_showActivationPage($key, $error);
2028 $mem->setPassword($password);
2031 // do the activation
2032 MEMBER::activate($key);
2035 echo '<h2>',_ACTIVATE_SUCCESS_TITLE,'</h2>';
2036 echo '<p>',_ACTIVATE_SUCCESS_TEXT,'</p>';
2043 function action_manageteam() {
2044 global $member, $manager;
2046 $blogid = intRequestVar('blogid');
2049 $member->blogAdminRights($blogid) or $this->disallow();
2053 echo "<p><a href='index.php?action=blogsettings&blogid=$blogid'>(",_BACK_TO_BLOGSETTINGS,")</a></p>";
2055 echo '<h2>' . _TEAM_TITLE . getBlogNameFromID($blogid) . '</h2>';
2057 echo '<h3>' . _TEAM_CURRENT . '</h3>';
2061 $query = 'SELECT tblog, tmember, mname, mrealname, memail, tadmin'
2062 . ' FROM '.sql_table('member').', '.sql_table('team')
2063 . ' WHERE tmember=mnumber and tblog=' . $blogid;
2065 $template['content'] = 'teamlist';
2066 $template['tabindex'] = 10;
2068 $batch =& new BATCH('team');
2069 $batch->showlist($query, 'table', $template);
2072 <h3><?php echo _TEAM_ADDNEW?></h3>
2074 <form method='post' action='index.php'><div>
2076 <input type='hidden' name='action' value='teamaddmember' />
2077 <input type='hidden' name='blogid' value='<?php echo $blogid; ?>' />
2078 <?php $manager->addTicketHidden() ?>
2081 <td><?php echo _TEAM_CHOOSEMEMBER?></td>
2082 <td><?php // TODO: try to make it so only non-team-members are listed
2083 $query = 'SELECT mname as text, mnumber as value'
2084 . ' FROM '.sql_table('member');
2086 $template['name'] = 'memberid';
2087 $template['tabindex'] = 10000;
2088 showlist($query,'select',$template);
2091 <td><?php echo _TEAM_ADMIN?><?php help('teamadmin'); ?></td>
2092 <td><?php $this->input_yesno('admin',0,10020); ?></td>
2094 <td><?php echo _TEAM_ADD?></td>
2095 <td><input type='submit' value='<?php echo _TEAM_ADD_BTN?>' tabindex="10030" /></td>
2104 * Add member tot tram
2106 function action_teamaddmember() {
2107 global $member, $manager;
2109 $memberid = intPostVar('memberid');
2110 $blogid = intPostVar('blogid');
2111 $admin = intPostVar('admin');
2114 $member->blogAdminRights($blogid) or $this->disallow();
2116 $blog =& $manager->getBlog($blogid);
2117 if (!$blog->addTeamMember($memberid, $admin))
2118 $this->error(_ERROR_ALREADYONTEAM);
2120 $this->action_manageteam();
2124 function action_teamdelete() {
2125 global $member, $manager;
2127 $memberid = intRequestVar('memberid');
2128 $blogid = intRequestVar('blogid');
2131 $member->blogAdminRights($blogid) or $this->disallow();
2133 $teammem = MEMBER::createFromID($memberid);
2134 $blog =& $manager->getBlog($blogid);
2138 <h2><?php echo _DELETE_CONFIRM?></h2>
2140 <p><?php echo _CONFIRMTXT_TEAM1?><b><?php echo $teammem->getDisplayName() ?></b><?php echo _CONFIRMTXT_TEAM2?><b><?php echo htmlspecialchars(strip_tags($blog->getName())) ?></b>
2144 <form method="post" action="index.php"><div>
2145 <input type="hidden" name="action" value="teamdeleteconfirm" />
2146 <?php $manager->addTicketHidden() ?>
2147 <input type="hidden" name="memberid" value="<?php echo $memberid; ?>" />
2148 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
2149 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
2155 function action_teamdeleteconfirm() {
2158 $memberid = intRequestVar('memberid');
2159 $blogid = intRequestVar('blogid');
2161 $error = $this->deleteOneTeamMember($blogid, $memberid);
2163 $this->error($error);
2166 $this->action_manageteam();
2169 function deleteOneTeamMember($blogid, $memberid) {
2170 global $member, $manager;
2172 $blogid = intval($blogid);
2173 $memberid = intval($memberid);
2176 if (!$member->blogAdminRights($blogid))
2177 return _ERROR_DISALLOWED;
2179 // check if: - there remains at least one blog admin
2180 // - (there remains at least one team member)
2181 $tmem = MEMBER::createFromID($memberid);
2183 $manager->notify('PreDeleteTeamMember', array('member' => &$tmem, 'blogid' => $blogid));
2185 if ($tmem->isBlogAdmin($blogid)) {
2186 // check if there are more blog members left and at least one admin
2187 // (check for at least two admins before deletion)
2188 $query = 'SELECT * FROM '.sql_table('team') . ' WHERE tblog='.$blogid.' and tadmin=1';
2189 $r = sql_query($query);
2190 if (mysql_num_rows($r) < 2)
2191 return _ERROR_ATLEASTONEBLOGADMIN;
2194 $query = 'DELETE FROM '.sql_table('team')." WHERE tblog=$blogid and tmember=$memberid";
2197 $manager->notify('PostDeleteTeamMember', array('member' => &$tmem, 'blogid' => $blogid));
2202 function action_teamchangeadmin() {
2205 $blogid = intRequestVar('blogid');
2206 $memberid = intRequestVar('memberid');
2209 $member->blogAdminRights($blogid) or $this->disallow();
2211 $mem = MEMBER::createFromID($memberid);
2213 // don't allow when there is only one admin at this moment
2214 if ($mem->isBlogAdmin($blogid)) {
2215 $r = sql_query('SELECT * FROM '.sql_table('team') . " WHERE tblog=$blogid and tadmin=1");
2216 if (mysql_num_rows($r) == 1)
2217 $this->error(_ERROR_ATLEASTONEBLOGADMIN);
2220 if ($mem->isBlogAdmin($blogid))
2225 $query = 'UPDATE '.sql_table('team') ." SET tadmin=$newval WHERE tblog=$blogid and tmember=$memberid";
2228 // only show manageteam if member did not change its own admin privileges
2229 if ($member->isBlogAdmin($blogid))
2230 $this->action_manageteam();
2232 $this->action_overview(_MSG_ADMINCHANGED);
2235 function action_blogsettings() {
2236 global $member, $manager;
2238 $blogid = intRequestVar('blogid');
2241 $member->blogAdminRights($blogid) or $this->disallow();
2243 $blog =& $manager->getBlog($blogid);
2245 $extrahead = '<script type="text/javascript" src="javascript/numbercheck.js"></script>';
2246 $this->pagehead($extrahead);
2248 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
2250 <h2><?php echo _EBLOG_TITLE?>: '<?php echo $this->bloglink($blog)?>'</h2>
2252 <h3><?php echo _EBLOG_TEAM_TITLE?></h3>
2254 <p>Members currently on your team:
2256 $res = sql_query('SELECT mname, mrealname FROM ' . sql_table('member') . ',' . sql_table('team') . ' WHERE mnumber=tmember AND tblog=' . intval($blogid));
2257 $aMemberNames = array();
2258 while ($o = mysql_fetch_object($res))
2259 array_push($aMemberNames, htmlspecialchars($o->mname) . ' (' . htmlspecialchars($o->mrealname). ')');
2260 echo implode(',', $aMemberNames);
2267 <a href="index.php?action=manageteam&blogid=<?php echo $blogid?>"><?php echo _EBLOG_TEAM_TEXT?></a>
2270 <h3><?php echo _EBLOG_SETTINGS_TITLE?></h3>
2272 <form method="post" action="index.php"><div>
2274 <input type="hidden" name="action" value="blogsettingsupdate" />
2275 <?php $manager->addTicketHidden() ?>
2276 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
2278 <td><?php echo _EBLOG_NAME?></td>
2279 <td><input name="name" tabindex="10" size="40" maxlength="60" value="<?php echo htmlspecialchars($blog->getName()) ?>" /></td>
2281 <td><?php echo _EBLOG_SHORTNAME?> <?php help('shortblogname'); ?>
2282 <?php echo _EBLOG_SHORTNAME_EXTRA?>
2284 <td><input name="shortname" tabindex="20" maxlength="15" size="15" value="<?php echo htmlspecialchars($blog->getShortName()) ?>" /></td>
2286 <td><?php echo _EBLOG_DESC?></td>
2287 <td><input name="desc" tabindex="30" maxlength="200" size="40" value="<?php echo htmlspecialchars($blog->getDescription()) ?>" /></td>
2289 <td><?php echo _EBLOG_URL?></td>
2290 <td><input name="url" tabindex="40" size="40" maxlength="100" value="<?php echo htmlspecialchars($blog->getURL()) ?>" /></td>
2292 <td><?php echo _EBLOG_DEFSKIN?>
2293 <?php help('blogdefaultskin'); ?>
2297 $query = 'SELECT sdname as text, sdnumber as value'
2298 . ' FROM '.sql_table('skin_desc');
2299 $template['name'] = 'defskin';
2300 $template['selected'] = $blog->getDefaultSkin();
2301 $template['tabindex'] = 50;
2302 showlist($query,'select',$template);
2307 <td><?php echo _EBLOG_LINEBREAKS?> <?php help('convertbreaks'); ?>
2309 <td><?php $this->input_yesno('convertbreaks',$blog->convertBreaks(),55); ?></td>
2311 <td><?php echo _EBLOG_ALLOWPASTPOSTING?> <?php help('allowpastposting'); ?>
2313 <td><?php $this->input_yesno('allowpastposting',$blog->allowPastPosting(),57); ?></td>
2315 <td><?php echo _EBLOG_DISABLECOMMENTS?>
2317 <td><?php $this->input_yesno('comments',$blog->commentsEnabled(),60); ?></td>
2319 <td><?php echo _EBLOG_ANONYMOUS?>
2321 <td><?php $this->input_yesno('public',$blog->isPublic(),70); ?></td>
2323 <td><?php echo _EBLOG_NOTIFY?> <?php help('blognotify'); ?></td>
2324 <td><input name="notify" tabindex="80" maxlength="60" size="40" value="<?php echo htmlspecialchars($blog->getNotifyAddress()); ?>" /></td>
2326 <td><?php echo _EBLOG_NOTIFY_ON?></td>
2328 <input name="notifyComment" value="3" type="checkbox" tabindex="81" id="notifyComment"
2329 <?php if ($blog->notifyOnComment()) echo "checked='checked'" ?>
2330 /><label for="notifyComment"><?php echo _EBLOG_NOTIFY_COMMENT?></label>
2332 <input name="notifyVote" value="5" type="checkbox" tabindex="82" id="notifyVote"
2333 <?php if ($blog->notifyOnVote()) echo "checked='checked'" ?>
2334 /><label for="notifyVote"><?php echo _EBLOG_NOTIFY_KARMA?></label>
2336 <input name="notifyNewItem" value="7" type="checkbox" tabindex="83" id="notifyNewItem"
2337 <?php if ($blog->notifyOnNewItem()) echo "checked='checked'" ?>
2338 /><label for="notifyNewItem"><?php echo _EBLOG_NOTIFY_ITEM?></label>
2341 <td><?php echo _EBLOG_PING?> <?php help('pinguserland'); ?></td>
2342 <td><?php $this->input_yesno('pinguserland',$blog->pingUserland(),85); ?></td>
2344 <td><?php echo _EBLOG_MAXCOMMENTS?> <?php help('blogmaxcomments'); ?></td>
2345 <td><input name="maxcomments" tabindex="90" size="3" value="<?php echo htmlspecialchars($blog->getMaxComments()); ?>" /></td>
2347 <td><?php echo _EBLOG_UPDATE?> <?php help('blogupdatefile'); ?></td>
2348 <td><input name="update" tabindex="100" size="40" maxlength="60" value="<?php echo htmlspecialchars($blog->getUpdateFile()) ?>" /></td>
2350 <td><?php echo _EBLOG_DEFCAT?></td>
2353 $query = 'SELECT cname as text, catid as value'
2354 . ' FROM '.sql_table('category')
2355 . ' WHERE cblog=' . $blog->getID();
2356 $template['name'] = 'defcat';
2357 $template['selected'] = $blog->getDefaultCategory();
2358 $template['tabindex'] = 110;
2359 showlist($query,'select',$template);
2363 <td><?php echo _EBLOG_OFFSET?> <?php help('blogtimeoffset'); ?>
2364 <br /><?php echo _EBLOG_STIME?> <b><?php echo strftime("%H:%M",time()); ?></b>
2365 <br /><?php echo _EBLOG_BTIME?> <b><?php echo strftime("%H:%M",$blog->getCorrectTime()); ?></b>
2367 <td><input name="timeoffset" tabindex="120" size="3" value="<?php echo htmlspecialchars($blog->getTimeOffset()); ?>" /></td>
2369 <td><?php echo _EBLOG_SEARCH?> <?php help('blogsearchable'); ?></td>
2370 <td><?php $this->input_yesno('searchable',$blog->getSearchable(),122); ?></td>
2374 $this->_insertPluginOptions('blog',$blogid);
2377 <th colspan="2"><?php echo _EBLOG_CHANGE?></th>
2379 <td><?php echo _EBLOG_CHANGE?></td>
2380 <td><input type="submit" tabindex="130" value="<?php echo _EBLOG_CHANGE_BTN?>" onclick="return checkSubmit();" /></td>
2385 <h3><?php echo _EBLOG_CAT_TITLE?></h3>
2389 $query = 'SELECT * FROM '.sql_table('category').' WHERE cblog='.$blog->getID().' ORDER BY cname';
2390 $template['content'] = 'categorylist';
2391 $template['tabindex'] = 200;
2393 $batch =& new BATCH('category');
2394 $batch->showlist($query,'table',$template);
2399 <form action="index.php" method="post"><div>
2400 <input name="action" value="categorynew" type="hidden" />
2401 <?php $manager->addTicketHidden() ?>
2402 <input name="blogid" value="<?php echo $blog->getID()?>" type="hidden" />
2405 <th colspan="2"><?php echo _EBLOG_CAT_CREATE?></th>
2407 <td><?php echo _EBLOG_CAT_NAME?></td>
2408 <td><input name="cname" size="40" maxlength="40" tabindex="300" /></td>
2410 <td><?php echo _EBLOG_CAT_DESC?></td>
2411 <td><input name="cdesc" size="40" maxlength="200" tabindex="310" /></td>
2413 <td><?php echo _EBLOG_CAT_CREATE?></td>
2414 <td><input type="submit" value="<?php echo _EBLOG_CAT_CREATE?>" tabindex="320" /></td>
2421 echo '<h3>',_PLUGINS_EXTRA,'</h3>';
2424 'BlogSettingsFormExtras',
2433 function action_categorynew() {
2434 global $member, $manager;
2436 $blogid = intRequestVar('blogid');
2438 $member->blogAdminRights($blogid) or $this->disallow();
2440 $cname = postVar('cname');
2441 $cdesc = postVar('cdesc');
2443 if (!isValidCategoryName($cname))
2444 $this->error(_ERROR_BADCATEGORYNAME);
2446 $query = 'SELECT * FROM '.sql_table('category') . ' WHERE cname=\'' . addslashes($cname).'\' and cblog=' . intval($blogid);
2447 $res = sql_query($query);
2448 if (mysql_num_rows($res) > 0)
2449 $this->error(_ERROR_DUPCATEGORYNAME);
2451 $blog =& $manager->getBlog($blogid);
2452 $newCatID = $blog->createNewCategory($cname, $cdesc);
2454 $this->action_blogsettings();
2458 function action_categoryedit($catid = '', $blogid = '', $desturl = '') {
2459 global $member, $manager;
2462 $blogid = intGetVar('blogid');
2464 $blogid = intval($blogid);
2466 $catid = intGetVar('catid');
2468 $catid = intval($catid);
2470 $member->blogAdminRights($blogid) or $this->disallow();
2472 $res = sql_query('SELECT * FROM '.sql_table('category')." WHERE cblog=$blogid AND catid=$catid");
2473 $obj = mysql_fetch_object($res);
2475 $cname = $obj->cname;
2476 $cdesc = $obj->cdesc;
2478 $extrahead = '<script type="text/javascript" src="javascript/numbercheck.js"></script>';
2479 $this->pagehead($extrahead);
2482 <h2><?php echo _EBLOG_CAT_UPDATE?> '<?php echo htmlspecialchars($cname)?>'</h2>
2483 <form method='post' action='index.php'><div>
2484 <input name="blogid" type="hidden" value="<?php echo $blogid?>" />
2485 <input name="catid" type="hidden" value="<?php echo $catid?>" />
2486 <input name="desturl" type="hidden" value="<?php echo htmlspecialchars($desturl) ?>" />
2487 <input name="action" type="hidden" value="categoryupdate" />
2488 <?php $manager->addTicketHidden(); ?>
2491 <th colspan="2"><?php echo _EBLOG_CAT_UPDATE ?></th>
2493 <td><?php echo _EBLOG_CAT_NAME?></td>
2494 <td><input type="text" name="cname" value="<?php echo htmlspecialchars($cname)?>" size="40" maxlength="40" /></td>
2496 <td><?php echo _EBLOG_CAT_DESC?></td>
2497 <td><input type="text" name="cdesc" value="<?php echo htmlspecialchars($cdesc)?>" size="40" maxlength="200" /></td>
2500 // insert plugin options
2501 $this->_insertPluginOptions('category',$catid);
2504 <th colspan="2"><?php echo _EBLOG_CAT_UPDATE ?></th>
2506 <td><?php echo _EBLOG_CAT_UPDATE?></td>
2507 <td><input type="submit" value="<?php echo _EBLOG_CAT_UPDATE_BTN?>" /></td>
2516 function action_categoryupdate() {
2517 global $member, $manager;
2519 $blogid = intPostVar('blogid');
2520 $catid = intPostVar('catid');
2521 $cname = postVar('cname');
2522 $cdesc = postVar('cdesc');
2523 $desturl = postVar('desturl');
2525 $member->blogAdminRights($blogid) or $this->disallow();
2527 if (!isValidCategoryName($cname))
2528 $this->error(_ERROR_BADCATEGORYNAME);
2530 $query = 'SELECT * FROM '.sql_table('category').' WHERE cname=\'' . addslashes($cname).'\' and cblog=' . intval($blogid) . " and not(catid=$catid)";
2531 $res = sql_query($query);
2532 if (mysql_num_rows($res) > 0)
2533 $this->error(_ERROR_DUPCATEGORYNAME);
2535 $query = 'UPDATE '.sql_table('category').' SET'
2536 . " cname='" . addslashes($cname) . "',"
2537 . " cdesc='" . addslashes($cdesc) . "'"
2538 . " WHERE catid=" . $catid;
2542 // store plugin options
2543 $aOptions = requestArray('plugoption');
2544 NucleusPlugin::_applyPluginOptions($aOptions);
2545 $manager->notify('PostPluginOptionsUpdate',array('context' => 'category', 'catid' => $catid));
2552 $this->action_blogsettings();
2556 function action_categorydelete() {
2557 global $member, $manager;
2559 $blogid = intRequestVar('blogid');
2560 $catid = intRequestVar('catid');
2562 $member->blogAdminRights($blogid) or $this->disallow();
2564 $blog =& $manager->getBlog($blogid);
2566 // check if the category is valid
2567 if (!$blog->isValidCategory($catid))
2568 $this->error(_ERROR_NOSUCHCATEGORY);
2570 // don't allow deletion of default category
2571 if ($blog->getDefaultCategory() == $catid)
2572 $this->error(_ERROR_DELETEDEFCATEGORY);
2574 // check if catid is the only category left for blogid
2575 $query = 'SELECT catid FROM '.sql_table('category').' WHERE cblog=' . $blogid;
2576 $res = sql_query($query);
2577 if (mysql_num_rows($res) == 1)
2578 $this->error(_ERROR_DELETELASTCATEGORY);
2583 <h2><?php echo _DELETE_CONFIRM?></h2>
2586 <?php echo _CONFIRMTXT_CATEGORY?><b><?php echo $blog->getCategoryName($catid)?></b>
2589 <form method="post" action="index.php"><div>
2590 <input type="hidden" name="action" value="categorydeleteconfirm" />
2591 <?php $manager->addTicketHidden() ?>
2592 <input type="hidden" name="blogid" value="<?php echo $blogid?>" />
2593 <input type="hidden" name="catid" value="<?php echo $catid?>" />
2594 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
2600 function action_categorydeleteconfirm() {
2601 global $member, $manager;
2603 $blogid = intRequestVar('blogid');
2604 $catid = intRequestVar('catid');
2606 $member->blogAdminRights($blogid) or $this->disallow();
2608 $error = $this->deleteOneCategory($catid);
2610 $this->error($error);
2612 $this->action_blogsettings();
2615 function deleteOneCategory($catid) {
2616 global $manager, $member;
2618 $catid = intval($catid);
2620 $manager->notify('PreDeleteCategory', array('catid' => $catid));
2622 $blogid = getBlogIDFromCatID($catid);
2624 if (!$member->blogAdminRights($blogid))
2625 return ERROR_DISALLOWED;
2628 $blog =& $manager->getBlog($blogid);
2630 // check if the category is valid
2631 if (!$blog || !$blog->isValidCategory($catid))
2632 return _ERROR_NOSUCHCATEGORY;
2634 $destcatid = $blog->getDefaultCategory();
2636 // don't allow deletion of default category
2637 if ($blog->getDefaultCategory() == $catid)
2638 return _ERROR_DELETEDEFCATEGORY;
2640 // check if catid is the only category left for blogid
2641 $query = 'SELECT catid FROM '.sql_table('category').' WHERE cblog=' . $blogid;
2642 $res = sql_query($query);
2643 if (mysql_num_rows($res) == 1)
2644 return _ERROR_DELETELASTCATEGORY;
2646 // change category for all items to the default category
2647 $query = 'UPDATE '.sql_table('item')." SET icat=$destcatid WHERE icat=$catid";
2650 // delete all associated plugin options
2651 NucleusPlugin::_deleteOptionValues('category', $catid);
2654 $query = 'DELETE FROM '.sql_table('category').' WHERE catid=' .$catid;
2657 $manager->notify('PostDeleteCategory', array('catid' => $catid));
2661 function moveOneCategory($catid, $destblogid) {
2662 global $manager, $member;
2664 $catid = intval($catid);
2665 $destblogid = intval($destblogid);
2667 $blogid = getBlogIDFromCatID($catid);
2669 // mover should have admin rights on both blogs
2670 if (!$member->blogAdminRights($blogid))
2671 return _ERROR_DISALLOWED;
2672 if (!$member->blogAdminRights($destblogid))
2673 return _ERROR_DISALLOWED;
2675 // cannot move to self
2676 if ($blogid == $destblogid)
2677 return _ERROR_MOVETOSELF;
2680 $blog =& $manager->getBlog($blogid);
2681 $destblog =& $manager->getBlog($destblogid);
2683 // check if the category is valid
2684 if (!$blog || !$blog->isValidCategory($catid))
2685 return _ERROR_NOSUCHCATEGORY;
2687 // don't allow default category to be moved
2688 if ($blog->getDefaultCategory() == $catid)
2689 return _ERROR_MOVEDEFCATEGORY;
2695 'sourceblog' => &$blog,
2696 'destblog' => &$destblog
2700 // update comments table (cblog)
2701 $query = 'SELECT inumber FROM '.sql_table('item').' WHERE icat='.$catid;
2702 $items = sql_query($query);
2703 while ($oItem = mysql_fetch_object($items)) {
2704 sql_query('UPDATE '.sql_table('comment').' SET cblog='.$destblogid.' WHERE citem='.$oItem->inumber);
2707 // update items (iblog)
2708 $query = 'UPDATE '.sql_table('item').' SET iblog='.$destblogid.' WHERE icat='.$catid;
2712 $query = 'UPDATE '.sql_table('category').' SET cblog='.$destblogid.' WHERE catid='.$catid;
2719 'sourceblog' => &$blog,
2720 'destblog' => $destblog
2726 function action_blogsettingsupdate() {
2727 global $member, $manager;
2729 $blogid = intRequestVar('blogid');
2731 $member->blogAdminRights($blogid) or $this->disallow();
2733 $blog =& $manager->getBlog($blogid);
2735 $notify = trim(postVar('notify'));
2736 $shortname = trim(postVar('shortname'));
2737 $updatefile = trim(postVar('update'));
2739 $notifyComment = intPostVar('notifyComment');
2740 $notifyVote = intPostVar('notifyVote');
2741 $notifyNewItem = intPostVar('notifyNewItem');
2743 if ($notifyComment == 0) $notifyComment = 1;
2744 if ($notifyVote == 0) $notifyVote = 1;
2745 if ($notifyNewItem == 0) $notifyNewItem = 1;
2747 $notifyType = $notifyComment * $notifyVote * $notifyNewItem;
2751 $not =& new NOTIFICATION($notify);
2752 if (!$not->validAddresses())
2753 $this->error(_ERROR_BADNOTIFY);
2757 if (!isValidShortName($shortname))
2758 $this->error(_ERROR_BADSHORTBLOGNAME);
2760 if (($blog->getShortName() != $shortname) && $manager->existsBlog($shortname))
2761 $this->error(_ERROR_DUPSHORTBLOGNAME);
2763 // check if update file is writable
2764 if ($updatefile && !is_writeable($updatefile))
2765 $this->error(_ERROR_UPDATEFILE);
2767 $blog->setName(trim(postVar('name')));
2768 $blog->setShortName($shortname);
2769 $blog->setNotifyAddress($notify);
2770 $blog->setNotifyType($notifyType);
2771 $blog->setMaxComments(postVar('maxcomments'));
2772 $blog->setCommentsEnabled(postVar('comments'));
2773 $blog->setTimeOffset(postVar('timeoffset'));
2774 $blog->setUpdateFile($updatefile);
2775 $blog->setURL(trim(postVar('url')));
2776 $blog->setDefaultSkin(intPostVar('defskin'));
2777 $blog->setDescription(trim(postVar('desc')));
2778 $blog->setPublic(postVar('public'));
2779 $blog->setPingUserland(postVar('pinguserland'));
2780 $blog->setConvertBreaks(intPostVar('convertbreaks'));
2781 $blog->setAllowPastPosting(intPostVar('allowpastposting'));
2782 $blog->setDefaultCategory(intPostVar('defcat'));
2783 $blog->setSearchable(intPostVar('searchable'));
2785 $blog->writeSettings();
2787 // store plugin options
2788 $aOptions = requestArray('plugoption');
2789 NucleusPlugin::_applyPluginOptions($aOptions);
2790 $manager->notify('PostPluginOptionsUpdate',array('context' => 'blog', 'blogid' => $blogid, 'blog' => &$blog));
2793 $this->action_overview(_MSG_SETTINGSCHANGED);
2796 function action_deleteblog() {
2797 global $member, $CONF, $manager;
2799 $blogid = intRequestVar('blogid');
2801 $member->blogAdminRights($blogid) or $this->disallow();
2803 // check if blog is default blog
2804 if ($CONF['DefaultBlog'] == $blogid)
2805 $this->error(_ERROR_DELDEFBLOG);
2807 $blog =& $manager->getBlog($blogid);
2811 <h2><?php echo _DELETE_CONFIRM?></h2>
2813 <p><?php echo _WARNINGTXT_BLOGDEL?>
2817 <?php echo _CONFIRMTXT_BLOG?><b><?php echo htmlspecialchars($blog->getName())?></b>
2820 <form method="post" action="index.php"><div>
2821 <input type="hidden" name="action" value="deleteblogconfirm" />
2822 <?php $manager->addTicketHidden() ?>
2823 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
2824 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
2830 function action_deleteblogconfirm() {
2831 global $member, $CONF, $manager;
2833 $blogid = intRequestVar('blogid');
2835 $manager->notify('PreDeleteBlog', array('blogid' => $blogid));
2837 $member->blogAdminRights($blogid) or $this->disallow();
2839 // check if blog is default blog
2840 if ($CONF['DefaultBlog'] == $blogid)
2841 $this->error(_ERROR_DELDEFBLOG);
2843 // delete all comments
2844 $query = 'DELETE FROM '.sql_table('comment').' WHERE cblog='.$blogid;
2848 $query = 'DELETE FROM '.sql_table('item').' WHERE iblog='.$blogid;
2851 // delete all team members
2852 $query = 'DELETE FROM '.sql_table('team').' WHERE tblog='.$blogid;
2856 $query = 'DELETE FROM '.sql_table('ban').' WHERE blogid='.$blogid;
2859 // delete all categories
2860 $query = 'DELETE FROM '.sql_table('category').' WHERE cblog='.$blogid;
2863 // delete all associated plugin options
2864 NucleusPlugin::_deleteOptionValues('blog', $blogid);
2866 // delete the blog itself
2867 $query = 'DELETE FROM '.sql_table('blog').' WHERE bnumber='.$blogid;
2870 $manager->notify('PostDeleteBlog', array('blogid' => $blogid));
2872 $this->action_overview(_DELETED_BLOG);
2875 function action_memberdelete() {
2876 global $member, $manager;
2878 $memberid = intRequestVar('memberid');
2880 ($member->getID() == $memberid) or $member->isAdmin() or $this->disallow();
2882 $mem = MEMBER::createFromID($memberid);
2886 <h2><?php echo _DELETE_CONFIRM?></h2>
2888 <p><?php echo _CONFIRMTXT_MEMBER?><b><?php echo $mem->getDisplayName() ?></b>
2892 Please note that media files will <b>NOT</b> be deleted. (At least not in this Nucleus version)
2895 <form method="post" action="index.php"><div>
2896 <input type="hidden" name="action" value="memberdeleteconfirm" />
2897 <?php $manager->addTicketHidden() ?>
2898 <input type="hidden" name="memberid" value="<?php echo $memberid; ?>" />
2899 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
2905 function action_memberdeleteconfirm() {
2908 $memberid = intRequestVar('memberid');
2910 ($member->getID() == $memberid) or $member->isAdmin() or $this->disallow();
2912 $error = $this->deleteOneMember($memberid);
2914 $this->error($error);
2916 if ($member->isAdmin())
2917 $this->action_usermanagement();
2919 $this->action_overview(_DELETED_MEMBER);
2923 function deleteOneMember($memberid) {
2926 $memberid = intval($memberid);
2927 $mem = MEMBER::createFromID($memberid);
2929 if (!$mem->canBeDeleted())
2930 return _ERROR_DELETEMEMBER;
2932 $manager->notify('PreDeleteMember', array('member' => &$mem));
2934 $query = 'DELETE FROM '.sql_table('member').' WHERE mnumber='.$memberid;
2937 $query = 'DELETE FROM '.sql_table('team').' WHERE tmember='.$memberid;
2940 $query = 'DELETE FROM '.sql_table('activation').' WHERE vmember='.$memberid;
2943 // delete all associated plugin options
2944 NucleusPlugin::_deleteOptionValues('member', $memberid);
2946 $manager->notify('PostDeleteMember', array('member' => &$mem));
2951 function action_createnewlog() {
2952 global $member, $CONF, $manager;
2954 // Only Super-Admins can do this
2955 $member->isAdmin() or $this->disallow();
2959 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
2961 <h2><?php echo _EBLOG_CREATE_TITLE?></h2>
2965 <p>作成にあたって、下記の<strong>注意事項</strong> をまずお読み下さい</p>
2967 <p>新しいweblogを作成した後に、このblogにアクセスするための方法を紹介しておきます。方法は2つあります:</p>
2970 <li><strong>簡単な方法:</strong> <code>index.php</code>の複製を作り、新しいblogを表示するように変更を加えます。 この変更の詳細は、作成後に表示されます。Further instructions on how to do this will be provided after you've submitted this first form.</li>
2971 <li><strong>高度な方法:</strong> 現在のblogで使用しているスキンに<code>otherblog</code>というコードを使った記述を加えます。この方法では、同じページ内で複数のblogを展開することが可能となります。</li>
2977 <?php echo _EBLOG_CREATE_TEXT?>
2980 <form method="post" action="index.php"><div>
2982 <input type="hidden" name="action" value="addnewlog" />
2983 <?php $manager->addTicketHidden() ?>
2987 <td><?php echo _EBLOG_NAME?></td>
2988 <td><input name="name" tabindex="10" size="40" maxlength="60" /></td>
2990 <td><?php echo _EBLOG_SHORTNAME?>
2991 <?php help('shortblogname'); ?>
2993 <td><input name="shortname" tabindex="20" maxlength="15" size="15" /></td>
2995 <td><?php echo _EBLOG_DESC?></td>
2996 <td><input name="desc" tabindex="30" maxlength="200" size="40" /></td>
2998 <td><?php echo _EBLOG_DEFSKIN?>
2999 <?php help('blogdefaultskin'); ?>
3003 $query = 'SELECT sdname as text, sdnumber as value'
3004 . ' FROM '.sql_table('skin_desc');
3005 $template['name'] = 'defskin';
3006 $template['tabindex'] = 50;
3007 $template['selected'] = $CONF['BaseSkin']; // set default selected skin to be globally defined base skin
3008 showlist($query,'select',$template);
3012 <td><?php echo _EBLOG_OFFSET?>
3013 <?php help('blogtimeoffset'); ?>
3014 <br /><?php echo _EBLOG_STIME?> <b><?php echo strftime("%H:%M",time()); ?></b>
3016 <td><input name="timeoffset" tabindex="110" size="3" value="0" /></td>
3018 <td><?php echo _EBLOG_ADMIN?>
3019 <?php help('blogadmin'); ?>
3021 <td><?php echo _EBLOG_ADMIN_MSG?></td>
3023 <td><?php echo _EBLOG_CREATE?></td>
3024 <td><input type="submit" tabindex="120" value="<?php echo _EBLOG_CREATE_BTN?>" onclick="return checkSubmit();" /></td>
3032 function action_addnewlog() {
3033 global $member, $manager, $CONF;
3035 // Only Super-Admins can do this
3036 $member->isAdmin() or $this->disallow();
3038 $bname = trim(postVar('name'));
3039 $bshortname = trim(postVar('shortname'));
3040 $btimeoffset = postVar('timeoffset');
3041 $bdesc = trim(postVar('desc'));
3042 $bdefskin = postVar('defskin');
3044 if (!isValidShortName($bshortname))
3045 $this->error(_ERROR_BADSHORTBLOGNAME);
3047 if ($manager->existsBlog($bshortname))
3048 $this->error(_ERROR_DUPSHORTBLOGNAME);
3054 'shortname' => &$bshortname,
3055 'timeoffset' => &$btimeoffset,
3056 'description' => &$bdescription,
3057 'defaultskin' => &$bdefskin
3062 // add slashes for sql queries
3063 $bname = addslashes($bname);
3064 $bshortname = addslashes($bshortname);
3065 $btimeoffset = addslashes($btimeoffset);
3066 $bdesc = addslashes($bdesc);
3067 $bdefskin = addslashes($bdefskin);
3070 $query = 'INSERT INTO '.sql_table('blog')." (bname, bshortname, bdesc, btimeoffset, bdefskin) VALUES ('$bname', '$bshortname', '$bdesc', '$btimeoffset', '$bdefskin')";
3072 $blogid = mysql_insert_id();
3073 $blog =& $manager->getBlog($blogid);
3075 // create new category
3076 sql_query('INSERT INTO '.sql_table('category')." (cblog, cname, cdesc) VALUES ($blogid, 'General','Items that do not fit in other categories')");
3077 $catid = mysql_insert_id();
3079 // set as default category
3080 $blog->setDefaultCategory($catid);
3081 $blog->writeSettings();
3083 // create team member
3084 $memberid = $member->getID();
3085 $query = 'INSERT INTO '.sql_table('team')." (tmember, tblog, tadmin) VALUES ($memberid, $blogid, 1)";
3089 $blog->additem($blog->getDefaultCategory(),'First Item','これはあなたのweblogにおける最初のアイテムです。自由に削除していただいてかまいません。','',$blogid, $memberid,$blog->getCorrectTime(),0,0,0);
3107 <h2>新しいweblogが作成されました</h2>
3109 <p>新しいweblog 「<?php echo htmlspecialchars($bname)?>」が作成されました。続けて、これにアクセスするために以下のどちらかの手順に進んでください。</p>
3112 <li><a href="#index_php">簡単な方法: 下のコードを貼付けた <code><?php echo htmlspecialchars($bshortname)?>.php</code> というファイルを作成する</a></li>
3113 <li><a href="#skins">高度な方法: 現在使用しているスキンに新しいweblogを展開させるための記述を加える</a></li>
3116 <h3><a id="index_php">方法 1: <code><?php echo htmlspecialchars($bshortname)?>.php</code> というファイルを作成</a></h3>
3118 <p><code><?php echo htmlspecialchars($bshortname)?>.php</code> というファイルを作成して、中身に以下のコードを貼り付ける:</p>
3121 $CONF['Self'] = '<b><?php echo htmlspecialchars($bshortname)?>.php</b>';
3123 include('<i>./config.php</i>');
3125 selectBlog('<b><?php echo htmlspecialchars($bshortname)?></b>');
3130 <p>すでにある<code>index.php</code>と同じディレクトリにアップロードします。</p>
3132 <p>新しいweblogの作成を完了するためには、下にこのファイルのURLを入力してください。 (すでに用意した値で合っているとは思いますが保証はしません):</p>
3134 <form action="index.php" method="post"><div>
3135 <input type="hidden" name="action" value="addnewlog2" />
3136 <?php $manager->addTicketHidden() ?>
3137 <input type="hidden" name="blogid" value="<?php echo intval($blogid)?>" />
3139 <td><?php echo _EBLOG_URL?></td>
3140 <td><input name="url" maxlength="100" size="40" value="<?php echo htmlspecialchars($CONF['IndexURL'].$bshortname.'.php')?>" /></td>
3142 <td><?php echo _EBLOG_CREATE?></td>
3143 <td><input type="submit" value="<?php echo _EBLOG_CREATE_BTN?>" onclick="return checkSubmit();" /></td>
3147 <h3><a id="skins">方法 2: 現在使用しているスキンに新しいweblogを展開する記述を加える</a></h3>
3149 <p>新しいweblogの作成を完了するためには、下にURLを入力してください。 (大抵は既存blogと同じURL)</p>
3151 <form action="index.php" method="post"><div>
3152 <input type="hidden" name="action" value="addnewlog2" />
3153 <?php $manager->addTicketHidden() ?>
3154 <input type="hidden" name="blogid" value="<?php echo intval($blogid)?>" />
3156 <td><?php echo _EBLOG_URL?></td>
3157 <td><input name="url" maxlength="100" size="40" /></td>
3159 <td><?php echo _EBLOG_CREATE?></td>
3160 <td><input type="submit" value="<?php echo _EBLOG_CREATE_BTN?>" onclick="return checkSubmit();" /></td>
3164 <?php $this->pagefoot();
3168 function action_addnewlog2() {
3169 global $member, $manager;
3171 $member->blogAdminRights($blogid) or $this->disallow();
3173 $burl = requestVar('url');
3174 $blogid = intRequestVar('blogid');
3176 $blog =& $manager->getBlog($blogid);
3177 $blog->setURL(trim($burl));
3178 $blog->writeSettings();
3180 $this->action_overview(_MSG_NEWBLOG);
3183 function action_skinieoverview() {
3184 global $member, $DIR_LIBS, $manager;
3186 $member->isAdmin() or $this->disallow();
3188 // load skinie class
3189 include_once($DIR_LIBS . 'skinie.php');
3193 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
3196 <h2><?php echo _SKINIE_TITLE_IMPORT?></h2>
3198 <p><label for="skinie_import_local"><?php echo _SKINIE_LOCAL?></label>
3199 <?php global $DIR_SKINS;
3201 $candidates = SKINIMPORT::searchForCandidates($DIR_SKINS);
3203 if (sizeof($candidates) > 0) {
3205 <form method="post" action="index.php"><div>
3206 <input type="hidden" name="action" value="skinieimport" />
3207 <?php $manager->addTicketHidden() ?>
3208 <input type="hidden" name="mode" value="file" />
3209 <select name="skinfile" id="skinie_import_local">
3210 <?php foreach ($candidates as $skinname => $skinfile) {
3211 $html = htmlspecialchars($skinfile);
3212 echo '<option value="',$html,'">',$skinname,'</option>';
3216 <input type="submit" value="<?php echo _SKINIE_BTN_IMPORT?>" />
3219 echo _SKINIE_NOCANDIDATES;
3224 <p><em><?php echo _OR?></em></p>
3226 <form method="post" action="index.php"><p>
3227 <?php $manager->addTicketHidden() ?>
3228 <input type="hidden" name="action" value="skinieimport" />
3229 <input type="hidden" name="mode" value="url" />
3230 <label for="skinie_import_url"><?php echo _SKINIE_FROMURL?></label>
3231 <input type="text" name="skinfile" id="skinie_import_url" size="60" value="http://" />
3232 <input type="submit" value="<?php echo _SKINIE_BTN_IMPORT?>" />
3236 <h2><?php echo _SKINIE_TITLE_EXPORT?></h2>
3237 <form method="post" action="index.php"><div>
3238 <input type="hidden" name="action" value="skinieexport" />
3239 <?php $manager->addTicketHidden() ?>
3241 <p><?php echo _SKINIE_EXPORT_INTRO?></p>
3244 <th colspan="2"><?php echo _SKINIE_EXPORT_SKINS?></th>
3246 <?php // show list of skins
3247 $res = sql_query('SELECT * FROM '.sql_table('skin_desc'));
3248 while ($skinObj = mysql_fetch_object($res)) {
3249 $id = 'skinexp' . $skinObj->sdnumber;
3250 echo '<td><input type="checkbox" name="skin[',$skinObj->sdnumber,']" id="',$id,'" />';
3251 echo '<label for="',$id,'">',htmlspecialchars($skinObj->sdname),'</label></td>';
3252 echo '<td>',htmlspecialchars($skinObj->sddesc),'</td>';
3256 echo '<th colspan="2">',_SKINIE_EXPORT_TEMPLATES,'</th></tr><tr>';
3258 // show list of templates
3259 $res = sql_query('SELECT * FROM '.sql_table('template_desc'));
3260 while ($templateObj = mysql_fetch_object($res)) {
3261 $id = 'templateexp' . $templateObj->tdnumber;
3262 echo '<td><input type="checkbox" name="template[',$templateObj->tdnumber,']" id="',$id,'" />';
3263 echo '<label for="',$id,'">',htmlspecialchars($templateObj->tdname),'</label></td>';
3264 echo '<td>',htmlspecialchars($templateObj->tddesc),'</td>';
3269 <th colspan="2"><?php echo _SKINIE_EXPORT_EXTRA?></th>
3271 <td colspan="2"><textarea cols="40" rows="5" name="info"></textarea></td>
3273 <th colspan="2"><?php echo _SKINIE_TITLE_EXPORT?></th>
3275 <td colspan="2"><input type="submit" value="<?php echo _SKINIE_BTN_EXPORT?>" /></td>
3284 function action_skinieimport() {
3285 global $member, $DIR_LIBS, $DIR_SKINS, $manager;
3287 $member->isAdmin() or $this->disallow();
3289 // load skinie class
3290 include_once($DIR_LIBS . 'skinie.php');
3292 $skinFileRaw= postVar('skinfile');
3293 $mode = postVar('mode');
3295 $importer =& new SKINIMPORT();
3297 // get full filename
3298 if ($mode == 'file')
3300 $skinFile = $DIR_SKINS . $skinFileRaw . '/skinbackup.xml';
3302 // backwards compatibilty (in v2.0, exports were saved as skindata.xml)
3303 if (!file_exists($skinFile))
3304 $skinFile = $DIR_SKINS . $skinFileRaw . '/skindata.xml';
3306 $skinFile = $skinFileRaw;
3309 // read only metadata
3310 $error = $importer->readFile($skinFile, 1);
3313 if ($error) $this->error($error);
3317 echo '<p><a href="index.php?action=skinieoverview">(',_BACK,')</a></p>';
3319 <h2><?php echo _SKINIE_CONFIRM_TITLE?></h2>
3322 <li><p><strong><?php echo _SKINIE_INFO_GENERAL?></strong> <?php echo htmlspecialchars($importer->getInfo())?></p></li>
3323 <li><p><strong><?php echo _SKINIE_INFO_SKINS?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->getSkinNames())?></p></li>
3324 <li><p><strong><?php echo _SKINIE_INFO_TEMPLATES?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->getTemplateNames())?></p></li>
3325 <li><p><strong style="color: red;"><?php echo _SKINIE_INFO_SKINCLASH?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->checkSkinNameClashes())?></p></li>
3326 <li><p><strong style="color: red;"><?php echo _SKINIE_INFO_TEMPLCLASH?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->checkTemplateNameClashes())?></p></li>
3329 <form method="post" action="index.php"><div>
3330 <input type="hidden" name="action" value="skiniedoimport" />
3331 <?php $manager->addTicketHidden() ?>
3332 <input type="hidden" name="skinfile" value="<?php echo htmlspecialchars(postVar('skinfile'))?>" />
3333 <input type="hidden" name="mode" value="<?php echo htmlspecialchars($mode)?>" />
3334 <input type="submit" value="<?php echo _SKINIE_CONFIRM_IMPORT?>" />
3336 <input type="checkbox" name="overwrite" value="1" id="cb_overwrite" /><label for="cb_overwrite"><?php echo _SKINIE_CONFIRM_OVERWRITE?></label>
3344 function action_skiniedoimport() {
3345 global $member, $DIR_LIBS, $DIR_SKINS;
3347 $member->isAdmin() or $this->disallow();
3349 // load skinie class
3350 include_once($DIR_LIBS . 'skinie.php');
3352 $skinFileRaw= postVar('skinfile');
3353 $mode = postVar('mode');
3355 $allowOverwrite = intPostVar('overwrite');
3357 // get full filename
3358 if ($mode == 'file')
3360 $skinFile = $DIR_SKINS . $skinFileRaw . '/skinbackup.xml';
3362 // backwards compatibilty (in v2.0, exports were saved as skindata.xml)
3363 if (!file_exists($skinFile))
3364 $skinFile = $DIR_SKINS . $skinFileRaw . '/skindata.xml';
3367 $skinFile = $skinFileRaw;
3370 $importer =& new SKINIMPORT();
3372 $error = $importer->readFile($skinFile);
3375 $this->error($error);
3377 $error = $importer->writeToDatabase($allowOverwrite);
3380 $this->error($error);
3384 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
3386 <h2><?php echo _SKINIE_DONE?></h2>
3389 <li><p><strong><?php echo _SKINIE_INFO_GENERAL?></strong> <?php echo htmlspecialchars($importer->getInfo())?></p></li>
3390 <li><p><strong><?php echo _SKINIE_INFO_IMPORTEDSKINS?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->getSkinNames())?></p></li>
3391 <li><p><strong><?php echo _SKINIE_INFO_IMPORTEDTEMPLS?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->getTemplateNames())?></p></li>
3394 <?php $this->pagefoot();
3398 function action_skinieexport() {
3399 global $member, $DIR_LIBS;
3401 $member->isAdmin() or $this->disallow();
3403 // load skinie class
3404 include_once($DIR_LIBS . 'skinie.php');
3406 $aSkins = requestIntArray('skin');
3407 $aTemplates = requestIntArray('template');
3409 if (!is_array($aTemplates)) $aTemplates = array();
3410 if (!is_array($aSkins)) $aSkins = array();
3412 $skinList = array_keys($aSkins);
3413 $templateList = array_keys($aTemplates);
3415 $info = postVar('info');
3417 $exporter =& new SKINEXPORT();
3418 foreach ($skinList as $skinId) {
3419 $exporter->addSkin($skinId);
3421 foreach ($templateList as $templateId) {
3422 $exporter->addTemplate($templateId);
3424 $exporter->setInfo($info);
3426 $exporter->export();
3429 function action_templateoverview() {
3430 global $member, $manager;
3432 $member->isAdmin() or $this->disallow();
3436 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
3438 echo '<h2>' . _TEMPLATE_TITLE . '</h2>';
3439 echo '<h3>' . _TEMPLATE_AVAILABLE_TITLE . '</h3>';
3441 $query = 'SELECT * FROM '.sql_table('template_desc').' ORDER BY tdname';
3442 $template['content'] = 'templatelist';
3443 $template['tabindex'] = 10;
3444 showlist($query,'table',$template);
3446 echo '<h3>' . _TEMPLATE_NEW_TITLE . '</h3>';
3449 <form method="post" action="index.php"><div>
3451 <input name="action" value="templatenew" type="hidden" />
3452 <?php $manager->addTicketHidden() ?>
3454 <td><?php echo _TEMPLATE_NAME?> <?php help('shortnames');?></td>
3455 <td><input name="name" tabindex="10010" maxlength="20" size="20" /></td>
3457 <td><?php echo _TEMPLATE_DESC?></td>
3458 <td><input name="desc" tabindex="10020" maxlength="200" size="50" /></td>
3460 <td><?php echo _TEMPLATE_CREATE?></td>
3461 <td><input type="submit" tabindex="10030" value="<?php echo _TEMPLATE_CREATE_BTN?>" onclick="return checkSubmit();" /></td>
3470 function action_templateedit($msg = '') {
3471 global $member, $manager;
3473 $templateid = intRequestVar('templateid');
3475 $member->isAdmin() or $this->disallow();
3477 $extrahead = '<script type="text/javascript" src="javascript/templateEdit.js"></script>';
3478 $extrahead .= '<script type="text/javascript">setTemplateEditText("'.addslashes(_EDITTEMPLATE_EMPTY).'");</script>';
3480 $this->pagehead($extrahead);
3482 $templatename = TEMPLATE::getNameFromId($templateid);
3483 $templatedescription = TEMPLATE::getDesc($templateid);
3484 $template =& $manager->getTemplate($templatename);
3488 <a href="index.php?action=templateoverview">(<?php echo _TEMPLATE_BACK?>)</a>
3491 <h2><?php echo _TEMPLATE_EDIT_TITLE?> '<?php echo $templatename; ?>'</h2>
3493 <?php if ($msg) echo "<p>"._MESSAGE.": $msg</p>";
3496 <p><?php echo _TEMPLATE_EDIT_MSG?></p>
3498 <form method="post" action="index.php">
3501 <input type="hidden" name="action" value="templateupdate" />
3502 <?php $manager->addTicketHidden() ?>
3503 <input type="hidden" name="templateid" value="<?php echo $templateid; ?>" />
3506 <th colspan="2"><?php echo _TEMPLATE_SETTINGS?></th>
3508 <td><?php echo _TEMPLATE_NAME?> <?php help('shortnames');?></td>
3509 <td><input name="tname" tabindex="4" size="20" maxlength="20" value="<?php echo htmlspecialchars($templatename) ?>" /></td>
3511 <td><?php echo _TEMPLATE_DESC?></td>
3512 <td><input name="tdesc" tabindex="5" size="50" maxlength="200" value="<?php echo htmlspecialchars($templatedescription) ?>" /></td>
3514 <th colspan="2"><?php echo _TEMPLATE_UPDATE?></th>
3516 <td><?php echo _TEMPLATE_UPDATE?></td>
3518 <input type="submit" tabindex="6" value="<?php echo _TEMPLATE_UPDATE_BTN?>" onclick="return checkSubmit();" />
3519 <input type="reset" tabindex="7" value="<?php echo _TEMPLATE_RESET_BTN?>" />
3522 <th colspan="2"><?php echo _TEMPLATE_ITEMS?> <?php help('templateitems'); ?></th>
3523 <?php $this->_templateEditRow($template, _TEMPLATE_ITEMHEADER, 'ITEM_HEADER', '', 8);
3524 $this->_templateEditRow($template, _TEMPLATE_ITEMBODY, 'ITEM', '', 9, 1);
3525 $this->_templateEditRow($template, _TEMPLATE_ITEMFOOTER, 'ITEM_FOOTER', '', 10);
3526 $this->_templateEditRow($template, _TEMPLATE_MORELINK, 'MORELINK', 'morelink', 20);
3527 $this->_templateEditRow($template, _TEMPLATE_EDITLINK, 'EDITLINK', 'editlink', 25);
3528 $this->_templateEditRow($template, _TEMPLATE_NEW, 'NEW', 'new', 30);
3531 <th colspan="2"><?php echo _TEMPLATE_COMMENTS_ANY?> <?php help('templatecomments'); ?></th>
3532 <?php $this->_templateEditRow($template, _TEMPLATE_CHEADER, 'COMMENTS_HEADER', 'commentheaders', 40);
3533 $this->_templateEditRow($template, _TEMPLATE_CBODY, 'COMMENTS_BODY', 'commentbody', 50, 1);
3534 $this->_templateEditRow($template, _TEMPLATE_CFOOTER, 'COMMENTS_FOOTER', 'commentheaders', 60);
3535 $this->_templateEditRow($template, _TEMPLATE_CONE, 'COMMENTS_ONE', 'commentwords', 70);
3536 $this->_templateEditRow($template, _TEMPLATE_CMANY, 'COMMENTS_MANY', 'commentwords', 80);
3537 $this->_templateEditRow($template, _TEMPLATE_CMORE, 'COMMENTS_CONTINUED', 'commentcontinued', 90);
3538 $this->_templateEditRow($template, _TEMPLATE_CMEXTRA, 'COMMENTS_AUTH', 'memberextra', 100);
3541 <th colspan="2"><?php echo _TEMPLATE_COMMENTS_NONE?> <?php help('templatecomments'); ?></th>
3543 $this->_templateEditRow($template, _TEMPLATE_CNONE, 'COMMENTS_NONE', '', 110);
3546 <th colspan="2"><?php echo _TEMPLATE_COMMENTS_TOOMUCH?> <?php help('templatecomments'); ?></th>
3547 <?php $this->_templateEditRow($template, _TEMPLATE_CTOOMUCH, 'COMMENTS_TOOMUCH', '', 120);
3550 <th colspan="2"><?php echo _TEMPLATE_ARCHIVELIST?> <?php help('templatearchivelists'); ?></th>
3551 <?php $this->_templateEditRow($template, _TEMPLATE_AHEADER, 'ARCHIVELIST_HEADER', '', 130);
3552 $this->_templateEditRow($template, _TEMPLATE_AITEM, 'ARCHIVELIST_LISTITEM', '', 140);
3553 $this->_templateEditRow($template, _TEMPLATE_AFOOTER, 'ARCHIVELIST_FOOTER', '', 150);
3556 <th colspan="2"><?php echo _TEMPLATE_CATEGORYLIST?> <?php help('templatecategorylists'); ?></th>
3557 <?php $this->_templateEditRow($template, _TEMPLATE_CATHEADER, 'CATLIST_HEADER', '', 160);
3558 $this->_templateEditRow($template, _TEMPLATE_CATITEM, 'CATLIST_LISTITEM', '', 170);
3559 $this->_templateEditRow($template, _TEMPLATE_CATFOOTER, 'CATLIST_FOOTER', '', 180);
3562 <th colspan="2"><?php echo _TEMPLATE_DATETIME?></th>
3563 <?php $this->_templateEditRow($template, _TEMPLATE_DHEADER, 'DATE_HEADER', 'dateheads', 190);
3564 $this->_templateEditRow($template, _TEMPLATE_DFOOTER, 'DATE_FOOTER', 'dateheads', 200);
3565 $this->_templateEditRow($template, _TEMPLATE_DFORMAT, 'FORMAT_DATE', 'datetime', 210);
3566 $this->_templateEditRow($template, _TEMPLATE_TFORMAT, 'FORMAT_TIME', 'datetime', 220);
3567 $this->_templateEditRow($template, _TEMPLATE_LOCALE, 'LOCALE', 'locale', 230);
3570 <th colspan="2"><?php echo _TEMPLATE_IMAGE?> <?php help('templatepopups'); ?></th>
3571 <?php $this->_templateEditRow($template, _TEMPLATE_PCODE, 'POPUP_CODE', '', 240);
3572 $this->_templateEditRow($template, _TEMPLATE_ICODE, 'IMAGE_CODE', '', 250);
3573 $this->_templateEditRow($template, _TEMPLATE_MCODE, 'MEDIA_CODE', '', 260);
3576 <th colspan="2"><?php echo _TEMPLATE_SEARCH?></th>
3577 <?php $this->_templateEditRow($template, _TEMPLATE_SHIGHLIGHT, 'SEARCH_HIGHLIGHT', 'highlight',270);
3578 $this->_templateEditRow($template, _TEMPLATE_SNOTFOUND, 'SEARCH_NOTHINGFOUND', 'nothingfound',280);
3581 <th colspan="2"><?php echo _TEMPLATE_UPDATE?></th>
3583 <td><?php echo _TEMPLATE_UPDATE?></td>
3585 <input type="submit" tabindex="290" value="<?php echo _TEMPLATE_UPDATE_BTN?>" onclick="return checkSubmit();" />
3586 <input type="reset" tabindex="300" value="<?php echo _TEMPLATE_RESET_BTN?>" />
3596 function _templateEditRow(&$template, $description, $name, $help = '', $tabindex = 0, $big = 0) {
3600 <td><?php echo $description?> <?php if ($help) help('template'.$help); ?></td>
3601 <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>
3605 function action_templateupdate() {
3608 $templateid = intRequestVar('templateid');
3610 $member->isAdmin() or $this->disallow();
3612 $name = postVar('tname');
3613 $desc = postVar('tdesc');
3615 if (!isValidTemplateName($name))
3616 $this->error(_ERROR_BADTEMPLATENAME);
3618 if ((TEMPLATE::getNameFromId($templateid) != $name) && TEMPLATE::exists($name))
3619 $this->error(_ERROR_DUPTEMPLATENAME);
3622 $name = addslashes($name);
3623 $desc = addslashes($desc);
3625 // 1. Remove all template parts
3626 $query = 'DELETE FROM '.sql_table('template').' WHERE tdesc=' . $templateid;
3629 // 2. Update description
3630 $query = 'UPDATE '.sql_table('template_desc').' SET'
3631 . " tdname='" . $name . "',"
3632 . " tddesc='" . $desc . "'"
3633 . " WHERE tdnumber=" . $templateid;
3636 // 3. Add non-empty template parts
3637 $this->addToTemplate($templateid, 'ITEM_HEADER', postVar('ITEM_HEADER'));
3638 $this->addToTemplate($templateid, 'ITEM', postVar('ITEM'));
3639 $this->addToTemplate($templateid, 'ITEM_FOOTER', postVar('ITEM_FOOTER'));
3640 $this->addToTemplate($templateid, 'MORELINK', postVar('MORELINK'));
3641 $this->addToTemplate($templateid, 'EDITLINK', postVar('EDITLINK'));
3642 $this->addToTemplate($templateid, 'NEW', postVar('NEW'));
3643 $this->addToTemplate($templateid, 'COMMENTS_HEADER', postVar('COMMENTS_HEADER'));
3644 $this->addToTemplate($templateid, 'COMMENTS_BODY', postVar('COMMENTS_BODY'));
3645 $this->addToTemplate($templateid, 'COMMENTS_FOOTER', postVar('COMMENTS_FOOTER'));
3646 $this->addToTemplate($templateid, 'COMMENTS_CONTINUED', postVar('COMMENTS_CONTINUED'));
3647 $this->addToTemplate($templateid, 'COMMENTS_TOOMUCH', postVar('COMMENTS_TOOMUCH'));
3648 $this->addToTemplate($templateid, 'COMMENTS_AUTH', postVar('COMMENTS_AUTH'));
3649 $this->addToTemplate($templateid, 'COMMENTS_ONE', postVar('COMMENTS_ONE'));
3650 $this->addToTemplate($templateid, 'COMMENTS_MANY', postVar('COMMENTS_MANY'));
3651 $this->addToTemplate($templateid, 'COMMENTS_NONE', postVar('COMMENTS_NONE'));
3652 $this->addToTemplate($templateid, 'ARCHIVELIST_HEADER', postVar('ARCHIVELIST_HEADER'));
3653 $this->addToTemplate($templateid, 'ARCHIVELIST_LISTITEM', postVar('ARCHIVELIST_LISTITEM'));
3654 $this->addToTemplate($templateid, 'ARCHIVELIST_FOOTER', postVar('ARCHIVELIST_FOOTER'));
3655 $this->addToTemplate($templateid, 'CATLIST_HEADER', postVar('CATLIST_HEADER'));
3656 $this->addToTemplate($templateid, 'CATLIST_LISTITEM', postVar('CATLIST_LISTITEM'));
3657 $this->addToTemplate($templateid, 'CATLIST_FOOTER', postVar('CATLIST_FOOTER'));
3658 $this->addToTemplate($templateid, 'DATE_HEADER', postVar('DATE_HEADER'));
3659 $this->addToTemplate($templateid, 'DATE_FOOTER', postVar('DATE_FOOTER'));
3660 $this->addToTemplate($templateid, 'FORMAT_DATE', postVar('FORMAT_DATE'));
3661 $this->addToTemplate($templateid, 'FORMAT_TIME', postVar('FORMAT_TIME'));
3662 $this->addToTemplate($templateid, 'LOCALE', postVar('LOCALE'));
3663 $this->addToTemplate($templateid, 'SEARCH_HIGHLIGHT', postVar('SEARCH_HIGHLIGHT'));
3664 $this->addToTemplate($templateid, 'SEARCH_NOTHINGFOUND', postVar('SEARCH_NOTHINGFOUND'));
3665 $this->addToTemplate($templateid, 'POPUP_CODE', postVar('POPUP_CODE'));
3666 $this->addToTemplate($templateid, 'MEDIA_CODE', postVar('MEDIA_CODE'));
3667 $this->addToTemplate($templateid, 'IMAGE_CODE', postVar('IMAGE_CODE'));
3670 // jump back to template edit
3671 $this->action_templateedit(_TEMPLATE_UPDATED);
3675 function addToTemplate($id, $partname, $content) {
3676 $partname = addslashes($partname);
3677 $content = addslashes($content);
3681 // don't add empty parts:
3682 if (!trim($content)) return -1;
3684 $query = 'INSERT INTO '.sql_table('template')." (tdesc, tpartname, tcontent) "
3685 . "VALUES ($id, '$partname', '$content')";
3686 mysql_query($query) or die("Query error: " . mysql_error());
3687 return mysql_insert_id();
3690 function action_templatedelete() {
3691 global $member, $manager;
3693 $member->isAdmin() or $this->disallow();
3695 $templateid = intRequestVar('templateid');
3696 // TODO: check if template can be deleted
3700 $name = TEMPLATE::getNameFromId($templateid);
3701 $desc = TEMPLATE::getDesc($templateid);
3704 <h2><?php echo _DELETE_CONFIRM?></h2>
3707 <?php echo _CONFIRMTXT_TEMPLATE?><b><?php echo $name?></b> (<?php echo htmlspecialchars($desc) ?>)
3710 <form method="post" action="index.php"><div>
3711 <input type="hidden" name="action" value="templatedeleteconfirm" />
3712 <?php $manager->addTicketHidden() ?>
3713 <input type="hidden" name="templateid" value="<?php echo $templateid ?>" />
3714 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
3720 function action_templatedeleteconfirm() {
3721 global $member, $manager;
3723 $templateid = intRequestVar('templateid');
3725 $member->isAdmin() or $this->disallow();
3727 $manager->notify('PreDeleteTemplate', array('templateid' => $templateid));
3729 // 1. delete description
3730 sql_query('DELETE FROM '.sql_table('template_desc').' WHERE tdnumber=' . $templateid);
3733 sql_query('DELETE FROM '.sql_table('template').' WHERE tdesc=' . $templateid);
3735 $manager->notify('PostDeleteTemplate', array('templateid' => $templateid));
3737 $this->action_templateoverview();
3740 function action_templatenew() {
3743 $member->isAdmin() or $this->disallow();
3745 $name = postVar('name');
3746 $desc = postVar('desc');
3748 if (!isValidTemplateName($name))
3749 $this->error(_ERROR_BADTEMPLATENAME);
3751 if (TEMPLATE::exists($name))
3752 $this->error(_ERROR_DUPTEMPLATENAME);
3754 $newTemplateId = TEMPLATE::createNew($name, $desc);
3756 $this->action_templateoverview();
3759 function action_templateclone() {
3762 $templateid = intRequestVar('templateid');
3764 $member->isAdmin() or $this->disallow();
3766 // 1. read old template
3767 $name = TEMPLATE::getNameFromId($templateid);
3768 $desc = TEMPLATE::getDesc($templateid);
3770 // 2. create desc thing
3771 $name = "cloned" . $name;
3773 // if a template with that name already exists:
3774 if (TEMPLATE::exists($name)) {
3776 while (TEMPLATE::exists($name . $i))
3781 $newid = TEMPLATE::createNew($name, $desc);
3784 // go through parts of old template and add them to the new one
3785 $res = sql_query('SELECT tpartname, tcontent FROM '.sql_table('template').' WHERE tdesc=' . $templateid);
3786 while ($o = mysql_fetch_object($res)) {
3787 $this->addToTemplate($newid, $o->tpartname, $o->tcontent);
3790 $this->action_templateoverview();
3793 function action_skinoverview() {
3794 global $member, $manager;
3796 $member->isAdmin() or $this->disallow();
3800 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
3802 echo '<h2>' . _SKIN_EDIT_TITLE . '</h2>';
3804 echo '<h3>' . _SKIN_AVAILABLE_TITLE . '</h3>';
3806 $query = 'SELECT * FROM '.sql_table('skin_desc').' ORDER BY sdname';
3807 $template['content'] = 'skinlist';
3808 $template['tabindex'] = 10;
3809 showlist($query,'table',$template);
3811 echo '<h3>' . _SKIN_NEW_TITLE . '</h3>';
3814 <form method="post" action="index.php">
3817 <input name="action" value="skinnew" type="hidden" />
3818 <?php $manager->addTicketHidden() ?>
3820 <td><?php echo _SKIN_NAME?> <?php help('shortnames');?></td>
3821 <td><input name="name" tabindex="10010" maxlength="20" size="20" /></td>
3823 <td><?php echo _SKIN_DESC?></td>
3824 <td><input name="desc" tabindex="10020" maxlength="200" size="50" /></td>
3826 <td><?php echo _SKIN_CREATE?></td>
3827 <td><input type="submit" tabindex="10030" value="<?php echo _SKIN_CREATE_BTN?>" onclick="return checkSubmit();" /></td>
3837 function action_skinnew() {
3840 $member->isAdmin() or $this->disallow();
3842 $name = trim(postVar('name'));
3843 $desc = trim(postVar('desc'));
3845 if (!isValidSkinName($name))
3846 $this->error(_ERROR_BADSKINNAME);
3848 if (SKIN::exists($name))
3849 $this->error(_ERROR_DUPSKINNAME);
3851 $newId = SKIN::createNew($name, $desc);
3853 $this->action_skinoverview();
3856 function action_skinedit() {
3857 global $member, $manager;
3859 $skinid = intRequestVar('skinid');
3861 $member->isAdmin() or $this->disallow();
3863 $skin =& new SKIN($skinid);
3868 <a href="index.php?action=skinoverview">(<?php echo _SKIN_BACK?>)</a>
3870 <h2><?php echo _SKIN_EDITONE_TITLE?> '<?php echo $skin->getName() ?>'</h2>
3872 <h3><?php echo _SKIN_PARTS_TITLE?></h3>
3873 <?php echo _SKIN_PARTS_MSG?>
3875 <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>
3876 <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>
3877 <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>
3878 <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>
3879 <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>
3880 <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>
3881 <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>
3882 <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>
3885 <h3><?php echo _SKIN_GENSETTINGS_TITLE?></h3>
3886 <form method="post" action="index.php">
3889 <input type="hidden" name="action" value="skineditgeneral" />
3890 <?php $manager->addTicketHidden() ?>
3891 <input type="hidden" name="skinid" value="<?php echo $skinid ?>" />
3893 <td><?php echo _SKIN_NAME?> <?php help('shortnames');?></td>
3894 <td><input name="name" tabindex="90" value="<?php echo htmlspecialchars($skin->getName()) ?>" maxlength="20" size="20" /></td>
3896 <td><?php echo _SKIN_DESC?></td>
3897 <td><input name="desc" tabindex="100" value="<?php echo htmlspecialchars($skin->getDescription()) ?>" maxlength="200" size="50" /></td>
3899 <td><?php echo _SKIN_TYPE?></td>
3900 <td><input name="type" tabindex="110" value="<?php echo htmlspecialchars($skin->getContentType()) ?>" maxlength="40" size="20" /></td>
3902 <td><?php echo _SKIN_INCLUDE_MODE?> <?php help('includemode')?></td>
3903 <td><?php $this->input_yesno('inc_mode',$skin->getIncludeMode(),120,'skindir','normal',_PARSER_INCMODE_SKINDIR,_PARSER_INCMODE_NORMAL);?></td>
3905 <td><?php echo _SKIN_INCLUDE_PREFIX?> <?php help('includeprefix')?></td>
3906 <td><input name="inc_prefix" tabindex="130" value="<?php echo htmlspecialchars($skin->getIncludePrefix()) ?>" maxlength="40" size="20" /></td>
3908 <td><?php echo _SKIN_CHANGE?></td>
3909 <td><input type="submit" tabindex="140" value="<?php echo _SKIN_CHANGE_BTN?>" onclick="return checkSubmit();" /></td>
3916 <?php $this->pagefoot();
3919 function action_skineditgeneral() {
3922 $skinid = intRequestVar('skinid');
3924 $member->isAdmin() or $this->disallow();
3926 $name = postVar('name');
3927 $desc = postVar('desc');
3928 $type = postVar('type');
3929 $inc_mode = postVar('inc_mode');
3930 $inc_prefix = postVar('inc_prefix');
3932 $skin =& new SKIN($skinid);
3935 if (!isValidSkinName($name))
3936 $this->error(_ERROR_BADSKINNAME);
3938 if (($skin->getName() != $name) && SKIN::exists($name))
3939 $this->error(_ERROR_DUPSKINNAME);
3941 if (!$type) $type = 'text/html';
3942 if (!$inc_mode) $inc_mode = 'normal';
3944 // 2. Update description
3945 $skin->updateGeneralInfo($name, $desc, $type, $inc_mode, $inc_prefix);
3947 $this->action_skinedit();
3951 function action_skinedittype($msg = '') {
3952 global $member, $manager;
3954 $skinid = intRequestVar('skinid');
3955 $type = requestVar('type');
3957 $member->isAdmin() or $this->disallow();
3959 $skin =& new SKIN($skinid);
3961 $friendlyNames = SKIN::getFriendlyNames();
3965 <p>(<a href="index.php?action=skinoverview"><?php echo _SKIN_GOBACK?></a>)</p>
3967 <h2><?php echo _SKIN_EDITPART_TITLE?> '<?php echo $skin->getName() ?>': <?php echo $friendlyNames[$type] ?></h2>
3969 <?php if ($msg) echo "<p>"._MESSAGE.": $msg</p>";
3973 <form method="post" action="index.php">
3976 <input type="hidden" name="action" value="skinupdate" />
3977 <?php $manager->addTicketHidden() ?>
3978 <input type="hidden" name="skinid" value="<?php echo $skinid ?>" />
3979 <input type="hidden" name="type" value="<?php echo $type ?>" />
3981 <input type="submit" value="<?php echo _SKIN_UPDATE_BTN?>" onclick="return checkSubmit();" />
3982 <input type="reset" value="<?php echo _SKIN_RESET_BTN?>" />
3983 (skin type: <?php echo $friendlyNames[$type] ?>)
3984 <?php help('skinpart' . $type);?>
3987 <textarea class="skinedit" tabindex="10" rows="20" cols="80" name="content"><?php echo htmlspecialchars($skin->getContent($type)) ?></textarea>
3990 <input type="submit" tabindex="20" value="<?php echo _SKIN_UPDATE_BTN?>" onclick="return checkSubmit();" />
3991 <input type="reset" value="<?php echo _SKIN_RESET_BTN?>" />
3992 (skin type: <?php echo $friendlyNames[$type] ?>)
3995 <?php echo _SKIN_ALLOWEDVARS?>
3996 <?php $actions = SKIN::getAllowedActionsForType($type);
4000 while ($current = array_shift($actions)) {
4001 // skip deprecated vars
4002 if ($current == 'ifcat') continue;
4003 if ($current == 'imagetext') continue;
4004 if ($current == 'vars') continue;
4006 echo helplink('skinvar-' . $current) . "$current</a>";
4007 if (count($actions) != 0) echo ", ";
4012 <?php $query = 'SELECT bshortname, bname FROM '.sql_table('blog');
4013 showlist($query,'table',array('content'=>'shortblognames'));
4018 <?php $query = 'SELECT tdname as name, tddesc as description FROM '.sql_table('template_desc');
4019 showlist($query,'table',array('content'=>'shortnames'));
4027 <?php $this->pagefoot();
4030 function action_skinupdate() {
4033 $skinid = intRequestVar('skinid');
4034 $content = trim(postVar('content'));
4035 $type = postVar('type');
4037 $member->isAdmin() or $this->disallow();
4039 $skin =& new SKIN($skinid);
4040 $skin->update($type, $content);
4042 $this->action_skinedittype(_SKIN_UPDATED);
4045 function action_skindelete() {
4046 global $member, $manager, $CONF;
4048 $skinid = intRequestVar('skinid');
4050 $member->isAdmin() or $this->disallow();
4052 // don't allow default skin to be deleted
4053 if ($skinid == $CONF['BaseSkin'])
4054 $this->error(_ERROR_DEFAULTSKIN);
4056 // don't allow deletion of default skins for blogs
4057 $query = 'SELECT bname FROM '.sql_table('blog').' WHERE bdefskin=' . $skinid;
4058 $r = sql_query($query);
4059 if ($o = mysql_fetch_object($r))
4060 $this->error(_ERROR_SKINDEFDELETE . $o->bname);
4064 $skin =& new SKIN($skinid);
4065 $name = $skin->getName();
4066 $desc = $skin->getDescription();
4069 <h2><?php echo _DELETE_CONFIRM?></h2>
4072 <?php echo _CONFIRMTXT_SKIN?><b><?php echo $name ?></b> (<?php echo htmlspecialchars($desc)?>)
4075 <form method="post" action="index.php"><div>
4076 <input type="hidden" name="action" value="skindeleteconfirm" />
4077 <?php $manager->addTicketHidden() ?>
4078 <input type="hidden" name="skinid" value="<?php echo $skinid ?>" />
4079 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
4085 function action_skindeleteconfirm() {
4086 global $member, $CONF, $manager;
4088 $skinid = intRequestVar('skinid');
4090 $member->isAdmin() or $this->disallow();
4092 // don't allow default skin to be deleted
4093 if ($skinid == $CONF['BaseSkin'])
4094 $this->error(_ERROR_DEFAULTSKIN);
4096 // don't allow deletion of default skins for blogs
4097 $query = 'SELECT bname FROM '.sql_table('blog').' WHERE bdefskin=' . $skinid;
4098 $r = sql_query($query);
4099 if ($o = mysql_fetch_object($r))
4100 $this->error(_ERROR_SKINDEFDELETE .$o->bname);
4102 $manager->notify('PreDeleteSkin', array('skinid' => $skinid));
4104 // 1. delete description
4105 sql_query('DELETE FROM '.sql_table('skin_desc').' WHERE sdnumber=' . $skinid);
4108 sql_query('DELETE FROM '.sql_table('skin').' WHERE sdesc=' . $skinid);
4110 $manager->notify('PostDeleteSkin', array('skinid' => $skinid));
4112 $this->action_skinoverview();
4115 function action_skinclone() {
4118 $skinid = intRequestVar('skinid');
4120 $member->isAdmin() or $this->disallow();
4122 // 1. read skin to clone
4123 $skin =& new SKIN($skinid);
4125 $name = "clone_" . $skin->getName();
4127 // if a skin with that name already exists:
4128 if (SKIN::exists($name)) {
4130 while (SKIN::exists($name . $i))
4135 // 2. create skin desc
4136 $newid = SKIN::createNew(
4138 $skin->getDescription(),
4139 $skin->getContentType(),
4140 $skin->getIncludeMode(),
4141 $skin->getIncludePrefix()
4146 $this->skinclonetype($skin, $newid, 'index');
4147 $this->skinclonetype($skin, $newid, 'item');
4148 $this->skinclonetype($skin, $newid, 'archivelist');
4149 $this->skinclonetype($skin, $newid, 'archive');
4150 $this->skinclonetype($skin, $newid, 'search');
4151 $this->skinclonetype($skin, $newid, 'error');
4152 $this->skinclonetype($skin, $newid, 'member');
4153 $this->skinclonetype($skin, $newid, 'imagepopup');
4155 $this->action_skinoverview();
4159 function skinclonetype($skin, $newid, $type) {
4160 $newid = intval($newid);
4161 $content = $skin->getContent($type);
4163 $query = 'INSERT INTO '.sql_table('skin')." (sdesc, scontent, stype) VALUES ($newid,'". addslashes($content)."', '". addslashes($type)."')";
4168 function action_settingsedit() {
4169 global $member, $manager, $CONF, $DIR_NUCLEUS, $DIR_MEDIA;
4171 $member->isAdmin() or $this->disallow();
4175 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
4178 <h2><?php echo _SETTINGS_TITLE?></h2>
4180 <form action="index.php" method="post">
4183 <input type="hidden" name="action" value="settingsupdate" />
4184 <?php $manager->addTicketHidden() ?>
4187 <th colspan="2"><?php echo _SETTINGS_SUB_GENERAL?></th>
4189 <td><?php echo _SETTINGS_DEFBLOG?> <?php help('defaultblog'); ?></td>
4192 $query = 'SELECT bname as text, bnumber as value'
4193 . ' FROM '.sql_table('blog');
4194 $template['name'] = 'DefaultBlog';
4195 $template['selected'] = $CONF['DefaultBlog'];
4196 $template['tabindex'] = 10;
4197 showlist($query,'select',$template);
4201 <td><?php echo _SETTINGS_BASESKIN?> <?php help('baseskin'); ?></td>
4204 $query = 'SELECT sdname as text, sdnumber as value'
4205 . ' FROM '.sql_table('skin_desc');
4206 $template['name'] = 'BaseSkin';
4207 $template['selected'] = $CONF['BaseSkin'];
4208 $template['tabindex'] = 1;
4209 showlist($query,'select',$template);
4213 <td><?php echo _SETTINGS_ADMINMAIL?></td>
4214 <td><input name="AdminEmail" tabindex="10010" size="40" value="<?php echo htmlspecialchars($CONF['AdminEmail']) ?>" /></td>
4216 <td><?php echo _SETTINGS_SITENAME?></td>
4217 <td><input name="SiteName" tabindex="10020" size="40" value="<?php echo htmlspecialchars($CONF['SiteName']) ?>" /></td>
4219 <td><?php echo _SETTINGS_SITEURL?></td>
4220 <td><input name="IndexURL" tabindex="10030" size="40" value="<?php echo htmlspecialchars($CONF['IndexURL']) ?>" /></td>
4222 <td><?php echo _SETTINGS_ADMINURL?></td>
4223 <td><input name="AdminURL" tabindex="10040" size="40" value="<?php echo htmlspecialchars($CONF['AdminURL']) ?>" /></td>
4225 <td><?php echo _SETTINGS_PLUGINURL?> <?php help('pluginurl');?></td>
4226 <td><input name="PluginURL" tabindex="10045" size="40" value="<?php echo htmlspecialchars($CONF['PluginURL']) ?>" /></td>
4228 <td><?php echo _SETTINGS_SKINSURL?> <?php help('skinsurl');?></td>
4229 <td><input name="SkinsURL" tabindex="10046" size="40" value="<?php echo htmlspecialchars($CONF['SkinsURL']) ?>" /></td>
4231 <td><?php echo _SETTINGS_ACTIONSURL?> <?php help('actionurl');?></td>
4232 <td><input name="ActionURL" tabindex="10047" size="40" value="<?php echo htmlspecialchars($CONF['ActionURL']) ?>" /></td>
4234 <td><?php echo _SETTINGS_LANGUAGE?> <?php help('language'); ?>
4238 <select name="Language" tabindex="10050">
4239 <?php // show a dropdown list of all available languages
4241 $dirhandle = opendir($DIR_LANG);
4242 while ($filename = readdir($dirhandle)) {
4243 if (ereg("^(.*)\.php$",$filename,$matches)) {
4244 $name = $matches[1];
4245 echo "<option value='$name'";
4246 if ($name == $CONF['Language'])
4247 echo " selected='selected'";
4248 echo ">$name</option>";
4251 closedir($dirhandle);
4258 <td><?php echo _SETTINGS_DISABLESITE?> <?php help('disablesite'); ?>
4260 <td><?php $this->input_yesno('DisableSite',$CONF['DisableSite'],10060); ?>
4262 URL: <input name="DisableSiteURL" tabindex="10070" size="40" value="<?php echo htmlspecialchars($CONF['DisableSiteURL'])?>" />
4265 <td><?php echo _SETTINGS_DIRS?></td>
4266 <td><?php echo htmlspecialchars($DIR_NUCLEUS) ?>
4267 <i><?php echo _SETTINGS_SEECONFIGPHP?></i></td>
4269 <td><?php echo _SETTINGS_DBLOGIN?></td>
4270 <td><i><?php echo _SETTINGS_SEECONFIGPHP?></i></td>
4274 echo _SETTINGS_JSTOOLBAR
4275 /* =_SETTINGS_DISABLEJS
4277 I temporary changed the meaning of DisableJsTools, until I can find a good
4278 way to select the javascript version to use
4282 1 : all javascript disabled
4283 2 : 'simpler' javascript (for mozilla/opera/mac)
4287 <td><?php /* $this->input_yesno('DisableJsTools',$CONF['DisableJsTools'],10075); */?>
4288 <select name="DisableJsTools" tabindex="10075">
4289 <?php $extra = ($CONF['DisableJsTools'] == 1) ? 'selected="selected"' : '';
4290 echo "<option $extra value='1'>",_SETTINGS_JSTOOLBAR_NONE,"</option>";
4291 $extra = ($CONF['DisableJsTools'] == 2) ? 'selected="selected"' : '';
4292 echo "<option $extra value='2'>",_SETTINGS_JSTOOLBAR_SIMPLE,"</option>";
4293 $extra = ($CONF['DisableJsTools'] == 0) ? 'selected="selected"' : '';
4294 echo "<option $extra value='0'>",_SETTINGS_JSTOOLBAR_FULL,"</option>";
4299 <td><?php echo _SETTINGS_URLMODE?> <?php help('urlmode');?></td>
4302 $this->input_yesno('URLMode',$CONF['URLMode'],10077,
4303 'normal','pathinfo',_SETTINGS_URLMODE_NORMAL,_SETTINGS_URLMODE_PATHINFO);
4305 echo ' ', _SETTINGS_URLMODE_HELP;
4311 <th colspan="2"><?php echo _SETTINGS_MEDIA?> <?php help('media'); ?></th>
4313 <td><?php echo _SETTINGS_MEDIADIR?></td>
4314 <td><?php echo htmlspecialchars($DIR_MEDIA) ?>
4315 <i><?php echo _SETTINGS_SEECONFIGPHP?></i>
4316 <?php if (!is_dir($DIR_MEDIA))
4317 echo "<br /><b>" . _WARNING_NOTADIR . "</b>";
4318 if (!is_readable($DIR_MEDIA))
4319 echo "<br /><b>" . _WARNING_NOTREADABLE . "</b>";
4320 if (!is_writeable($DIR_MEDIA))
4321 echo "<br /><b>" . _WARNING_NOTWRITABLE . "</b>";
4325 <td><?php echo _SETTINGS_MEDIAURL?></td>
4327 <input name="MediaURL" tabindex="10080" size="40" value="<?php echo htmlspecialchars($CONF['MediaURL']) ?>" />
4330 <td><?php echo _SETTINGS_ALLOWUPLOAD?></td>
4331 <td><?php $this->input_yesno('AllowUpload',$CONF['AllowUpload'],10090); ?></td>
4333 <td><?php echo _SETTINGS_ALLOWUPLOADTYPES?></td>
4335 <input name="AllowedTypes" tabindex="10100" size="40" value="<?php echo htmlspecialchars($CONF['AllowedTypes']) ?>" />
4338 <td><?php echo _SETTINGS_MAXUPLOADSIZE?></td>
4340 <input name="MaxUploadSize" tabindex="10105" size="40" value="<?php echo htmlspecialchars($CONF['MaxUploadSize']) ?>" />
4343 <td><?php echo _SETTINGS_MEDIAPREFIX?></td>
4344 <td><?php $this->input_yesno('MediaPrefix',$CONF['MediaPrefix'],10110); ?></td>
4347 <th colspan="2"><?php echo _SETTINGS_MEMBERS?></th>
4349 <td><?php echo _SETTINGS_CHANGELOGIN?></td>
4350 <td><?php $this->input_yesno('AllowLoginEdit',$CONF['AllowLoginEdit'],10120); ?></td>
4352 <td><?php echo _SETTINGS_ALLOWCREATE?>
4353 <?php help('allowaccountcreation'); ?>
4355 <td><?php $this->input_yesno('AllowMemberCreate',$CONF['AllowMemberCreate'],10130); ?>
4358 <td><?php echo _SETTINGS_NEWLOGIN?> <?php help('allownewmemberlogin'); ?>
4359 <br /><?php echo _SETTINGS_NEWLOGIN2?>
4361 <td><?php $this->input_yesno('NewMemberCanLogon',$CONF['NewMemberCanLogon'],10140); ?>
4364 <td><?php echo _SETTINGS_MEMBERMSGS?>
4365 <?php help('messageservice'); ?>
4367 <td><?php $this->input_yesno('AllowMemberMail',$CONF['AllowMemberMail'],10150); ?>
4370 <td><?php echo _SETTINGS_NONMEMBERMSGS?>
4371 <?php help('messageservice'); ?>
4373 <td><?php $this->input_yesno('NonmemberMail',$CONF['NonmemberMail'],10155); ?>
4376 <td><?php echo _SETTINGS_PROTECTMEMNAMES?>
4377 <?php help('protectmemnames'); ?>
4379 <td><?php $this->input_yesno('ProtectMemNames',$CONF['ProtectMemNames'],10156); ?>
4385 <th colspan="2"><?php echo _SETTINGS_COOKIES_TITLE?> <?php help('cookies'); ?></th>
4387 <td><?php echo _SETTINGS_COOKIEPREFIX?></td>
4388 <td><input name="CookiePrefix" tabindex="10159" size="40" value="<?php echo htmlspecialchars($CONF['CookiePrefix'])?>" /></td>
4390 <td><?php echo _SETTINGS_COOKIEDOMAIN?></td>
4391 <td><input name="CookieDomain" tabindex="10160" size="40" value="<?php echo htmlspecialchars($CONF['CookieDomain'])?>" /></td>
4393 <td><?php echo _SETTINGS_COOKIEPATH?></td>
4394 <td><input name="CookiePath" tabindex="10170" size="40" value="<?php echo htmlspecialchars($CONF['CookiePath'])?>" /></td>
4396 <td><?php echo _SETTINGS_COOKIESECURE?></td>
4397 <td><?php $this->input_yesno('CookieSecure',$CONF['CookieSecure'],10180); ?></td>
4399 <td><?php echo _SETTINGS_COOKIELIFE?></td>
4400 <td><?php $this->input_yesno('SessionCookie',$CONF['SessionCookie'],10190,
4401 1,0,_SETTINGS_COOKIESESSION,_SETTINGS_COOKIEMONTH); ?>
4404 <td><?php echo _SETTINGS_LASTVISIT?></td>
4405 <td><?php $this->input_yesno('LastVisit',$CONF['LastVisit'],10200); ?></td>
4410 <th colspan="2"><?php echo _SETTINGS_UPDATE?></th>
4412 <td><?php echo _SETTINGS_UPDATE?></td>
4413 <td><input type="submit" tabindex="10210" value="<?php echo _SETTINGS_UPDATE_BTN?>" onclick="return checkSubmit();" /></td>
4420 echo '<h2>',_PLUGINS_EXTRA,'</h2>';
4423 'GeneralSettingsFormExtras',
4430 function action_settingsupdate() {
4431 global $member, $CONF;
4433 $member->isAdmin() or $this->disallow();
4435 // check if email address for admin is valid
4436 if (!isValidMailAddress(postVar('AdminEmail')))
4437 $this->error(_ERROR_BADMAILADDRESS);
4441 $this->updateConfig('DefaultBlog', postVar('DefaultBlog'));
4442 $this->updateConfig('BaseSkin', postVar('BaseSkin'));
4443 $this->updateConfig('IndexURL', postVar('IndexURL'));
4444 $this->updateConfig('AdminURL', postVar('AdminURL'));
4445 $this->updateConfig('PluginURL', postVar('PluginURL'));
4446 $this->updateConfig('SkinsURL', postVar('SkinsURL'));
4447 $this->updateConfig('ActionURL', postVar('ActionURL'));
4448 $this->updateConfig('Language', postVar('Language'));
4449 $this->updateConfig('AdminEmail', postVar('AdminEmail'));
4450 $this->updateConfig('SessionCookie', postVar('SessionCookie'));
4451 $this->updateConfig('AllowMemberCreate',postVar('AllowMemberCreate'));
4452 $this->updateConfig('AllowMemberMail', postVar('AllowMemberMail'));
4453 $this->updateConfig('NonmemberMail', postVar('NonmemberMail'));
4454 $this->updateConfig('ProtectMemNames', postVar('ProtectMemNames'));
4455 $this->updateConfig('SiteName', postVar('SiteName'));
4456 $this->updateConfig('NewMemberCanLogon',postVar('NewMemberCanLogon'));
4457 $this->updateConfig('DisableSite', postVar('DisableSite'));
4458 $this->updateConfig('DisableSiteURL', postVar('DisableSiteURL'));
4459 $this->updateConfig('LastVisit', postVar('LastVisit'));
4460 $this->updateConfig('MediaURL', postVar('MediaURL'));
4461 $this->updateConfig('AllowedTypes', postVar('AllowedTypes'));
4462 $this->updateConfig('AllowUpload', postVar('AllowUpload'));
4463 $this->updateConfig('MaxUploadSize', postVar('MaxUploadSize'));
4464 $this->updateConfig('MediaPrefix', postVar('MediaPrefix'));
4465 $this->updateConfig('AllowLoginEdit', postVar('AllowLoginEdit'));
4466 $this->updateConfig('DisableJsTools', postVar('DisableJsTools'));
4467 $this->updateConfig('CookieDomain', postVar('CookieDomain'));
4468 $this->updateConfig('CookiePath', postVar('CookiePath'));
4469 $this->updateConfig('CookieSecure', postVar('CookieSecure'));
4470 $this->updateConfig('URLMode', postVar('URLMode'));
4471 $this->updateConfig('CookiePrefix', postVar('CookiePrefix'));
4473 // load new config and redirect (this way, the new language will be used is necessary)
4474 // note that when changing cookie settings, this redirect might cause the user
4475 // to have to log in again.
4477 redirect($CONF['AdminURL'] . '?action=manage');
4483 function updateConfig($name, $val) {
4484 $name = addslashes($name);
4485 $val = trim(addslashes($val));
4487 $query = 'UPDATE '.sql_table('config')
4488 . " SET value='$val'"
4489 . " WHERE name='$name'";
4491 mysql_query($query) or die("Query error: " . mysql_error());
4492 return mysql_insert_id();
4498 function error($msg) {
4504 echo "<a href='index.php' onclick='history.back()'>"._BACK."</a>";
4509 function disallow() {
4510 ACTIONLOG::add(WARNING, _ACTIONLOG_DISALLOWED . serverVar('REQUEST_URI'));
4512 $this->error(_ERROR_DISALLOWED);
4516 function pagehead($extrahead = '') {
4517 global $member, $nucleus, $CONF, $manager;
4522 'extrahead' => &$extrahead,
4523 'action' => $this->action
4527 $baseUrl = htmlspecialchars($CONF['AdminURL']);
4530 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4531 <html xmlns="http://www.w3.org/1999/xhtml">
4533 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
4534 <title><?php echo htmlspecialchars($CONF['SiteName'])?> - Admin</title>
4535 <link rel="stylesheet" title="Nucleus Admin Default" type="text/css" href="<?php echo $baseUrl?>styles/admin.css" />
4536 <link rel="stylesheet" title="Nucleus Admin Default" type="text/css"
4537 href="<?php echo $baseUrl?>styles/addedit.css" />
4539 <script type="text/javascript" src="<?php echo $baseUrl?>javascript/edit.js"></script>
4540 <script type="text/javascript" src="<?php echo $baseUrl?>javascript/admin.js"></script>
4541 <script type="text/javascript" src="<?php echo $baseUrl?>javascript/compatibility.js"></script>
4543 <meta http-equiv='Pragma' content='no-cache' />
4544 <meta http-equiv='Cache-Control' content='no-cache, must-revalidate' />
4545 <meta http-equiv='Expires' content='-1' />
4547 <?php echo $extrahead?>
4550 <div class="header">
4551 <h1><?php echo htmlspecialchars($CONF['SiteName'])?></h1>
4553 <div id="container">
4555 <div class="loginname">
4556 <?php if ($member->isLoggedIn())
4557 echo _LOGGEDINAS . ' ' . $member->getDisplayName()
4558 ." - <a href='index.php?action=logout'>" . _LOGOUT. "</a>"
4559 . "<br /><a href='index.php?action=overview'>" . _ADMINHOME . "</a> - ";
4561 echo '<a href="index.php?action=showlogin" title="Log in">' , _NOTLOGGEDIN , '</a> <br />';
4563 echo "<a href='".$CONF['IndexURL']."'>"._YOURSITE."</a>";
4567 if ($member->isLoggedIn() && $member->isAdmin())
4568 echo '<a href="http://nucleuscms.org/version.php?v=',getNucleusVersion(),'&pl=',getNucleusPatchLevel(),'" title="Check for upgrade">Nucleus ', $nucleus['version'], '</a>';
4570 echo 'Nucleus ' , $nucleus['version'];
4575 function pagefoot() {
4576 global $action, $member, $manager;
4581 'action' => $this->action
4585 if ($member->isLoggedIn() && ($action != 'showlogin')) {
4587 <h2><?php echo _LOGOUT ?></h2>
4589 <li><a href="index.php?action=overview"><?php echo _BACKHOME?></a></li>
4590 <li><a href='index.php?action=logout'><?php echo _LOGOUT?></a></li>
4595 <a href="http://nucleuscms.org/">Nucleus</a> © 2002-2004 The Nucleus Group
4597 <a href="http://nucleuscms.org/donate.php">Donate!</a>
4600 </div><!-- content -->
4602 <div id="quickmenu">
4604 <?php // ---- user settings ----
4605 if (($action != 'showlogin') && ($member->isLoggedIn())) {
4607 echo '<li><a href="index.php?action=overview">',_QMENU_HOME,'</a></li>';
4610 echo '<h2>',_QMENU_ADD,'</h2>';
4611 echo '<form method="get" action="index.php"><div>';
4612 echo '<input type="hidden" name="action" value="createitem" />';
4614 $showAll = requestVar('showall');
4615 if (($member->isAdmin()) && ($showAll == 'yes')) {
4616 // Super-Admins have access to all blogs! (no add item support though)
4617 $query = 'SELECT bnumber as value, bname as text'
4618 . ' FROM ' . sql_table('blog')
4619 . ' ORDER BY bname';
4621 $query = 'SELECT bnumber as value, bname as text'
4622 . ' FROM ' . sql_table('blog') . ', ' . sql_table('team')
4623 . ' WHERE tblog=bnumber and tmember=' . $member->getID()
4624 . ' ORDER BY bname';
4626 $template['name'] = 'blogid';
4627 $template['tabindex'] = 15000;
4628 $template['extra'] = _QMENU_ADD_SELECT;
4629 $template['selected'] = -1;
4630 $template['shorten'] = 10;
4631 $template['shortenel'] = '';
4632 $template['javascript'] = 'onchange="return form.submit()"';
4633 showlist($query,'select',$template);
4635 echo '</div></form>';
4637 echo '<h2>' . $member->getDisplayName(). '</h2>';
4639 echo '<li><a href="index.php?action=editmembersettings">',_QMENU_USER_SETTINGS,'</a></li>';
4640 echo '<li><a href="index.php?action=browseownitems">',_QMENU_USER_ITEMS,'</a></li>';
4641 echo '<li><a href="index.php?action=browseowncomments">',_QMENU_USER_COMMENTS,'</a></li>';
4647 // ---- general settings ----
4648 if ($member->isAdmin()) {
4650 echo '<h2>',_QMENU_MANAGE,'</h2>';
4653 echo '<li><a href="index.php?action=actionlog">',_QMENU_MANAGE_LOG,'</a></li>';
4654 echo '<li><a href="index.php?action=settingsedit">',_QMENU_MANAGE_SETTINGS,'</a></li>';
4655 echo '<li><a href="index.php?action=usermanagement">',_QMENU_MANAGE_MEMBERS,'</a></li>';
4656 echo '<li><a href="index.php?action=createnewlog">',_QMENU_MANAGE_NEWBLOG,'</a></li>';
4657 echo '<li><a href="index.php?action=backupoverview">',_QMENU_MANAGE_BACKUPS,'</a></li>';
4658 echo '<li><a href="index.php?action=pluginlist">',_QMENU_MANAGE_PLUGINS,'</a></li>';
4661 echo '<h2>',_QMENU_LAYOUT,'</h2>';
4663 echo '<li><a href="index.php?action=skinoverview">',_QMENU_LAYOUT_SKINS,'</a></li>';
4664 echo '<li><a href="index.php?action=templateoverview">',_QMENU_LAYOUT_TEMPL,'</a></li>';
4665 echo '<li><a href="index.php?action=skinieoverview">',_QMENU_LAYOUT_IEXPORT,'</a></li>';
4670 $aPluginExtras = array();
4674 'options' => &$aPluginExtras
4677 if (count($aPluginExtras) > 0)
4679 echo '<h2>', _QMENU_PLUGINS, '</h2>';
4681 foreach ($aPluginExtras as $aInfo)
4683 echo '<li><a href="'.htmlspecialchars($aInfo['url']).'" title="'.htmlspecialchars($aInfo['tooltip']).'">'.htmlspecialchars($aInfo['title']).'</a></li>';
4688 } else if (($action == 'activate') || ($action == 'activatesetpwd')) {
4690 echo '<h2>', _QMENU_ACTIVATE, '</h2>', _QMENU_ACTIVATE_TEXT;
4692 // introduction text on login screen
4693 echo '<h2>', _QMENU_INTRO, '</h2>', _QMENU_INTRO_TEXT;
4698 <!-- content / quickmenu container -->
4707 function action_regfile() {
4708 global $member, $CONF;
4710 $blogid = intRequestVar('blogid');
4712 $member->teamRights($blogid) or $this->disallow();
4714 // header-code stolen from phpMyAdmin
4715 // REGEDIT and bookmarklet code stolen from GreyMatter
4717 $sjisBlogName = getBlogNameFromID($blogid);
4718 $sjisBlogName = mb_convert_encoding($sjisBlogName, "SJIS", "auto");
4720 header('Content-Type: application/octetstream');
4721 header('Content-Disposition: filename="nucleus.reg"');
4722 header('Pragma: no-cache');
4723 header('Expires: 0');
4726 echo "[HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\MenuExt\\Post To &Nucleus (".$sjisBlogName.")]\n";
4727 echo '@="' . $CONF['AdminURL'] . "bookmarklet.php?action=contextmenucode&blogid=".intval($blogid)."\"\n";
4728 echo '"contexts"=hex:31';
4731 function action_bookmarklet() {
4732 global $member, $manager;
4734 $blogid = intRequestVar('blogid');
4736 $member->teamRights($blogid) or $this->disallow();
4738 $blog =& $manager->getBlog($blogid);
4739 $bm = getBookmarklet($blogid);
4743 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
4747 <h2>Bookmarklet<!-- and Right Click Menu --></h2>
4750 Bookmarklet とは、クリック1回で記事の投稿ができるシステムです。 この Bookmarklet をインストールすると、ブラウザのツールバーの'add to weblog'ボタンが利用可能となり、Nucleusの新規アイテムの追加ウィンドウがポップアップします。任意のWebページを開いた状態でこのボタンを押せば、そのWebページのタイトルと、そのページへのリンクタグがすでに埋め込まれた状態でアイテム追加ウィンドウが開き、さらに、そのページ内に引用したい文を選択した状態であればその引用文も自動的に引用します。
4753 <h3>Bookmarklet</h3>
4755 下のリンク部分を「お気に入り」もしくはツールバーにドラッグできます。<small>(その前にテストしてみたい場合は単純に下のリンクをクリックしてみてください)</small>
4758 <a href="<?php echo htmlspecialchars($bm)?>">Add to <?php echo $blog->getShortName()?></a> (ほとんどのブラウザで動作します)
4761 <h3>右クリックメニューにインストール (WindowsでIE使用時)</h3>
4764 $url = 'index.php?action=regfile&blogid=' . intval($blogid);
4765 $url = $manager->addTicketToUrl($url);
4767 あるいは<a href="index.php?action=regfile&blogid=<?php echo $blogid?>">右クリックメニュー</a>にインストールすることもできます (「開く」を選択すれば直接レジストリに登録します)
4771 このインストールした右クリックメニューを表示するためにはIEの再起動が必要です
4776 「お気に入り」もしくはツールバーから消すには、単に削除するだけです。
4780 右クリックメニューから消したい時は、以下の手順を踏んでください:
4784 <li>スタートメニューから「ファイルを指定して実行...」を選択</li>
4785 <li>"regedit" と入力</li>
4786 <li>"OK" ボタンを押す</li>
4787 <li>"\HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt" をツリーの中から検索</li>
4788 <li>"add to weblog" エントリを削除</li>
4797 function action_actionlog() {
4798 global $member, $manager;
4800 $member->isAdmin() or $this->disallow();
4804 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
4806 $url = $manager->addTicketToUrl('index.php?action=clearactionlog');
4809 <h2><?php echo _ACTIONLOG_CLEAR_TITLE?></h2>
4810 <p><a href="<?php echo htmlspecialchars($url)?>"><?php echo _ACTIONLOG_CLEAR_TEXT?></a></p>
4812 echo '<h2>' . _ACTIONLOG_TITLE . '</h2>';
4814 $query = 'SELECT * FROM '.sql_table('actionlog').' ORDER BY timestamp DESC';
4815 $template['content'] = 'actionlist';
4816 $amount = showlist($query,'table',$template);
4823 function action_banlist() {
4824 global $member, $manager;
4826 $blogid = intRequestVar('blogid');
4828 $member->blogAdminRights($blogid) or $this->disallow();
4830 $blog =& $manager->getBlog($blogid);
4834 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
4836 echo '<h2>' . _BAN_TITLE . " '". $this->bloglink($blog) ."'</h2>";
4838 $query = 'SELECT * FROM '.sql_table('ban').' WHERE blogid='.$blogid.' ORDER BY iprange';
4839 $template['content'] = 'banlist';
4840 $amount = showlist($query,'table',$template);
4845 echo '<h2>'._BAN_NEW_TITLE.'</h2>';
4846 echo "<p><a href='index.php?action=banlistnew&blogid=$blogid'>"._BAN_NEW_TEXT."</a></p>";
4854 function action_banlistdelete() {
4855 global $member, $manager;
4857 $blogid = intRequestVar('blogid');
4858 $iprange = requestVar('iprange');
4860 $member->blogAdminRights($blogid) or $this->disallow();
4862 $blog =& $manager->getBlog($blogid);
4866 <h2><?php echo _BAN_REMOVE_TITLE?></h2>
4868 <form method="post" action="index.php">
4870 <h3><?php echo _BAN_IPRANGE?></h3>
4873 <?php echo _CONFIRMTXT_BAN?> <?php echo htmlspecialchars($iprange) ?>
4874 <input name="iprange" type="hidden" value="<?php echo htmlspecialchars($iprange)?>" />
4877 <h3><?php echo _BAN_BLOGS?></h3>
4880 <input type="hidden" name="blogid" value="<?php echo $blogid?>" />
4881 <input name="allblogs" type="radio" value="0" id="allblogs_one" /><label for="allblogs_one">Only blog '<?php echo htmlspecialchars($blog->getName())?>'</label>
4883 <input name="allblogs" type="radio" value="1" checked="checked" id="allblogs_all" /><label for="allblogs_all"><?php echo _BAN_ALLBLOGS?></label>
4886 <h3><?php echo _BAN_DELETE_TITLE?></h3>
4889 <?php $manager->addTicketHidden() ?>
4890 <input type="hidden" name="action" value="banlistdeleteconfirm" />
4891 <input type="submit" value="<?php echo _DELETE_CONFIRM_BTN?>" />
4899 function action_banlistdeleteconfirm() {
4900 global $member, $manager;
4902 $blogid = intPostVar('blogid');
4903 $allblogs = postVar('allblogs');
4904 $iprange = postVar('iprange');
4906 $member->blogAdminRights($blogid) or $this->disallow();
4911 if (BAN::removeBan($blogid, $iprange))
4912 array_push($deleted, $blogid);
4914 // get blogs fot which member has admin rights
4915 $adminblogs = $member->getAdminBlogs();
4916 foreach ($adminblogs as $blogje) {
4917 if (BAN::removeBan($blogje, $iprange))
4918 array_push($deleted, $blogje);
4922 if (sizeof($deleted) == 0)
4923 $this->error(_ERROR_DELETEBAN);
4927 echo '<a href="index.php?action=banlist&blogid=',$blogid,'">(',_BACK,')</a>';
4928 echo '<h2>'._BAN_REMOVED_TITLE.'</h2>';
4929 echo "<p>"._BAN_REMOVED_TEXT."</p>";
4932 foreach ($deleted as $delblog) {
4933 $b =& $manager->getBlog($delblog);
4934 echo "<li>" . htmlspecialchars($b->getName()). "</li>";
4942 function action_banlistnewfromitem() {
4943 $this->action_banlistnew(getBlogIDFromItemID(intRequestVar('itemid')));
4946 function action_banlistnew($blogid = '') {
4947 global $member, $manager;
4950 $blogid = intRequestVar('blogid');
4952 $ip = requestVar('ip');
4954 $member->blogAdminRights($blogid) or $this->disallow();
4956 $blog =& $manager->getBlog($blogid);
4960 <h2><?php echo _BAN_ADD_TITLE?></h2>
4963 <form method="post" action="index.php">
4965 <h3><?php echo _BAN_IPRANGE?></h3>
4967 <p><?php echo _BAN_IPRANGE_TEXT?></p>
4970 <b>An example</b>: "134.58.253.193" will only block one computer, while "134.58.253" will block 256 IP addresses, including the one from the first example.
4976 <input name="iprange" type="radio" value="<?php echo htmlspecialchars($ip)?>" checked="checked" id="ip_fixed" /><label for="ip_fixed"><?php echo htmlspecialchars($ip)?></label>
4978 <input name="iprange" type="radio" value="custom" id="ip_custom" /><label for="ip_custom">Custom: </label><input name='customiprange' value='<?php echo htmlspecialchars($ip)?>' maxlength='15' size='15' />
4980 echo "<input name='iprange' value='custom' type='hidden' />";
4981 echo "<input name='customiprange' value='' maxlength='15' size='15' />";
4986 <h3><?php echo _BAN_BLOGS?></h3>
4988 <p><?php echo _BAN_BLOGS_TEXT?></p>
4991 <input type="hidden" name="blogid" value="<?php echo $blogid?>" />
4992 <input name="allblogs" type="radio" value="0" id="allblogs_one" /><label for="allblogs_one">'<?php echo htmlspecialchars($blog->getName())?>'</label>
4994 <input name="allblogs" type="radio" value="1" checked="checked" id="allblogs_all" /><label for="allblogs_all"><?php echo _BAN_ALLBLOGS?></label>
4997 <h3><?php echo _BAN_REASON_TITLE?></h3>
4999 <p><?php echo _BAN_REASON_TEXT?></p>
5001 <div><textarea name="reason" cols="40" rows="5"></textarea></div>
5003 <h3><?php echo _BAN_ADD_TITLE?></h3>
5006 <input name="action" type="hidden" value="banlistadd" />
5007 <?php $manager->addTicketHidden() ?>
5008 <input type="submit" value="<?php echo _BAN_ADD_BTN?>" />
5013 <?php $this->pagefoot();
5016 function action_banlistadd() {
5019 $blogid = intPostVar('blogid');
5020 $allblogs = postVar('allblogs');
5021 $iprange = postVar('iprange');
5022 if ($iprange == "custom")
5023 $iprange = postVar('customiprange');
5024 $reason = postVar('reason');
5026 $member->blogAdminRights($blogid) or $this->disallow();
5028 // TODO: check IP range validity
5031 if (!BAN::addBan($blogid, $iprange, $reason))
5032 $this->error(_ERROR_ADDBAN);
5034 // get blogs fot which member has admin rights
5035 $adminblogs = $member->getAdminBlogs();
5037 foreach ($adminblogs as $blogje) {
5038 if (!BAN::addBan($blogje, $iprange, $reason))
5042 $this->error(_ERROR_ADDBAN);
5045 $this->action_banlist();
5049 function action_clearactionlog() {
5052 $member->isAdmin() or $this->disallow();
5056 $this->action_manage(_MSG_ACTIONLOGCLEARED);
5059 function action_backupoverview() {
5060 global $member, $manager;
5062 $member->isAdmin() or $this->disallow();
5066 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
5068 <h2><?php echo _BACKUPS_TITLE?></h2>
5070 <h3><?php echo _BACKUP_TITLE?></h3>
5072 <p><?php echo _BACKUP_INTRO?></p>
5074 <form method="post" action="index.php"><p>
5075 <input type="hidden" name="action" value="backupcreate" />
5076 <?php $manager->addTicketHidden() ?>
5078 <input type="radio" name="gzip" value="1" checked="checked" id="gzip_yes" tabindex="10" /><label for="gzip_yes"><?php echo _BACKUP_ZIP_YES?></label>
5080 <input type="radio" name="gzip" value="0" id="gzip_no" tabindex="10" /><label for="gzip_no" ><?php echo _BACKUP_ZIP_NO?></label>
5082 <input type="submit" value="<?php echo _BACKUP_BTN?>" tabindex="20" />
5086 <div class="note"><?php echo _BACKUP_NOTE?></div>
5089 <h3><?php echo _RESTORE_TITLE?></h3>
5091 <div class="note"><?php echo _RESTORE_NOTE?></div>
5093 <p><?php echo _RESTORE_INTRO?></p>
5095 <form method="post" action="index.php" enctype="multipart/form-data"><p>
5096 <input type="hidden" name="action" value="backuprestore" />
5097 <?php $manager->addTicketHidden() ?>
5098 <input name="backup_file" type="file" tabindex="30" />
5100 <input type="submit" value="<?php echo _RESTORE_BTN?>" tabindex="40" />
5101 <br /><input type="checkbox" name="letsgo" value="1" id="letsgo" tabindex="50" /><label for="letsgo"><?php echo _RESTORE_IMSURE?></label>
5102 <br /><?php echo _RESTORE_WARNING?>
5105 <?php $this->pagefoot();
5108 function action_backupcreate() {
5109 global $member, $DIR_LIBS;
5111 $member->isAdmin() or $this->disallow();
5113 // use compression ?
5114 $useGzip = intval(postVar('gzip'));
5116 include($DIR_LIBS . 'backup.php');
5118 // try to extend time limit
5119 // (creating/restoring dumps might take a while)
5120 @set_time_limit(1200);
5122 do_backup($useGzip);
5127 function action_backuprestore() {
5128 global $member, $DIR_LIBS;
5130 $member->isAdmin() or $this->disallow();
5132 if (intPostVar('letsgo') != 1)
5133 $this->error(_ERROR_BACKUP_NOTSURE);
5135 include($DIR_LIBS . 'backup.php');
5137 // try to extend time limit
5138 // (creating/restoring dumps might take a while)
5139 @set_time_limit(1200);
5141 $message = do_restore();
5143 $this->error($message);
5147 <h2><?php echo _RESTORE_COMPLETE?></h2>
5148 <?php $this->pagefoot();
5153 function action_pluginlist() {
5154 global $member, $manager;
5157 $member->isAdmin() or $this->disallow();
5161 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
5163 echo '<h2>' , _PLUGS_TITLE_MANAGE , ' ', help('plugins'), '</h2>';
5165 echo '<h3>' , _PLUGS_TITLE_INSTALLED , '</h3>';
5168 $query = 'SELECT * FROM '.sql_table('plugin').' ORDER BY porder ASC';
5170 $template['content'] = 'pluginlist';
5171 $template['tabindex'] = 10;
5172 showlist($query, 'table', $template);
5175 <h3><?php echo _PLUGS_TITLE_UPDATE?></h3>
5177 <p><?php echo _PLUGS_TEXT_UPDATE?></p>
5179 <form method="post" action="index.php"><div>
5180 <input type="hidden" name="action" value="pluginupdate" />
5181 <?php $manager->addTicketHidden() ?>
5182 <input type="submit" value="<?php echo _PLUGS_BTN_UPDATE ?>" tabindex="20" />
5185 <h3><?php echo _PLUGS_TITLE_NEW?></h3>
5187 <?php // find a list of possibly non-installed plugins
5188 $candidates = array();
5189 global $DIR_PLUGINS;
5190 $dirhandle = opendir($DIR_PLUGINS);
5191 while ($filename = readdir($dirhandle)) {
5192 if (ereg('^NP_(.*)\.php$',$filename,$matches)) {
5193 $name = $matches[1];
5194 // only show in list when not yet installed
5195 if (mysql_num_rows(sql_query('SELECT * FROM '.sql_table('plugin').' WHERE pfile="NP_'.addslashes($name).'"')) == 0)
5196 array_push($candidates,$name);
5199 closedir($dirhandle);
5201 if (sizeof($candidates) > 0) {
5204 <p><?php echo _PLUGS_ADD_TEXT?></p>
5207 <form method='post' action='index.php'><div>
5208 <input type='hidden' name='action' value='pluginadd' />
5209 <?php $manager->addTicketHidden() ?>
5210 <select name="filename" tabindex="30">
5211 <?php foreach($candidates as $name)
5212 echo '<option value="NP_',$name,'">',htmlspecialchars($name),'</option>';
5215 <input type='submit' tabindex="40" value='<?php echo _PLUGS_BTN_INSTALL?>' />
5218 <?php } else { // sizeof(candidates) == 0
5219 echo '<p>',_PLUGS_NOCANDIDATES,'</p>';
5225 function action_pluginhelp() {
5226 global $member, $manager, $DIR_PLUGINS, $CONF;
5229 $member->isAdmin() or $this->disallow();
5231 $plugid = intGetVar('plugid');
5233 if (!$manager->pidInstalled($plugid))
5234 $this->error(_ERROR_NOSUCHPLUGIN);
5236 $plugName = getPluginNameFromPid($plugid);
5240 echo '<p><a href="index.php?action=pluginlist">(',_PLUGS_BACK,')</a></p>';
5242 echo '<h2>',_PLUGS_HELP_TITLE,': ',htmlspecialchars($plugName),'</h2>';
5244 $plug =& $manager->getPlugin($plugName);
5245 $helpFile = $DIR_PLUGINS.$plug->getShortName().'/help.html';
5247 if (($plug->supportsFeature('HelpPage') > 0) && (@file_exists($helpFile))) {
5248 @readfile($helpFile);
5250 echo '<p>Error: ', _ERROR_PLUGNOHELPFILE,'</p>';
5251 echo '<p><a href="index.php?action=pluginlist">(',_BACK,')</a></p>';
5259 function action_pluginadd() {
5260 global $member, $manager, $DIR_PLUGINS;
5263 $member->isAdmin() or $this->disallow();
5265 $name = postVar('filename');
5267 if ($manager->pluginInstalled($name))
5268 $this->error(_ERROR_DUPPLUGIN);
5269 if (!checkPlugin($name))
5270 $this->error(_ERROR_PLUGFILEERROR . ' (' . $name . ')');
5272 // check if the plugin dependency is met
5273 $plugin =& $manager->getPlugin($name);
5274 $pluginList = $plugin->getPluginDep();
5275 foreach ($pluginList as $pluginName)
5278 $res = sql_query('SELECT * FROM '.sql_table('plugin') . ' WHERE pfile="' . $pluginName . '"');
5279 if (mysql_num_rows($res) == 0)
5281 // uninstall plugin again...
5282 $this->deleteOnePlugin($plugin->getID());
5284 $this->error(_ERROR_INSREQPLUGIN . $pluginName);
5288 // get number of currently installed plugins
5289 $numCurrent = mysql_num_rows(sql_query('SELECT * FROM '.sql_table('plugin')));
5291 // plugin will be added as last one in the list
5292 $newOrder = $numCurrent + 1;
5301 // do this before calling getPlugin (in case the plugin id is used there)
5302 $query = 'INSERT INTO '.sql_table('plugin').' (porder, pfile) VALUES ('.$newOrder.',"'.addslashes($name).'")';
5304 $iPid = mysql_insert_id();
5306 // need to update the plugin object's pid since we didn't have it above when it's first create....
5307 $plugin->plugid = $iPid;
5309 $manager->clearCachedInfo('installedPlugins');
5311 // call the install method of the plugin
5314 sql_query('DELETE FROM ' . sql_table('plugin') . ' WHERE pid='. intval($iPid));
5315 $manager->clearCachedInfo('installedPlugins');
5316 $this->error('Plugin could not be loaded, or does not support certain features that are required for it to run on your Nucleus installation (you might want to check the <a href="?action=actionlog">actionlog</a> for more info)');
5319 // check if plugin needs a newer Nucleus version
5320 if (getNucleusVersion() < $plugin->getMinNucleusVersion())
5322 // uninstall plugin again...
5323 $this->deleteOnePlugin($plugin->getID());
5325 // ...and show error
5326 $this->error(_ERROR_NUCLEUSVERSIONREQ . $plugin->getMinNucleusVersion());
5329 // check if plugin needs a newer Nucleus version
5330 if ((getNucleusVersion() == $plugin->getMinNucleusVersion()) && (getNucleusPatchLevel() < $plugin->getMinNucleusPatchLevel()))
5332 // uninstall plugin again...
5333 $this->deleteOnePlugin($plugin->getID());
5335 // ...and show error
5336 $this->error(_ERROR_NUCLEUSVERSIONREQ . $plugin->getMinNucleusVersion() . ' patch ' . $plugin->getMinNucleusPatchLevel());
5344 'plugin' => &$plugin
5348 // update all events
5349 $this->action_pluginupdate();
5352 function action_pluginupdate() {
5353 global $member, $manager;
5356 $member->isAdmin() or $this->disallow();
5358 // delete everything from plugin_events
5359 sql_query('DELETE FROM '.sql_table('plugin_event'));
5361 // loop over all installed plugins
5362 $res = sql_query('SELECT pid, pfile FROM '.sql_table('plugin'));
5363 while($o = mysql_fetch_object($res)) {
5365 $plug =& $manager->getPlugin($o->pfile);
5368 $eventList = $plug->getEventList();
5369 foreach ($eventList as $eventName)
5370 sql_query('INSERT INTO '.sql_table('plugin_event').' (pid, event) VALUES ('.$pid.', \''.addslashes($eventName).'\')');
5374 $this->action_pluginlist();
5377 function action_plugindelete() {
5378 global $member, $manager;
5381 $member->isAdmin() or $this->disallow();
5383 $pid = intGetVar('plugid');
5385 if (!$manager->pidInstalled($pid))
5386 $this->error(_ERROR_NOSUCHPLUGIN);
5390 <h2><?php echo _DELETE_CONFIRM?></h2>
5392 <p><?php echo _CONFIRMTXT_PLUGIN?> <strong><?php echo getPluginNameFromPid($pid)?></strong>?</p>
5394 <form method="post" action="index.php"><div>
5395 <?php $manager->addTicketHidden() ?>
5396 <input type="hidden" name="action" value="plugindeleteconfirm" />
5397 <input type="hidden" name="plugid" value="<?php echo $pid; ?>" />
5398 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
5400 <?php $this->pagefoot();
5403 function action_plugindeleteconfirm() {
5404 global $member, $manager;
5407 $member->isAdmin() or $this->disallow();
5409 $pid = intPostVar('plugid');
5411 $error = $this->deleteOnePlugin($pid, 1);
5413 $this->error($error);
5416 $this->action_pluginlist();
5419 function deleteOnePlugin($pid, $callUninstall = 0) {
5422 $pid = intval($pid);
5424 if (!$manager->pidInstalled($pid))
5425 return _ERROR_NOSUCHPLUGIN;
5427 $name = quickQuery('SELECT pfile as result FROM '.sql_table('plugin').' WHERE pid='.$pid);
5429 // call the unInstall method of the plugin
5430 if ($callUninstall) {
5431 $plugin =& $manager->getPlugin($name);
5432 if ($plugin) $plugin->unInstall();
5435 // check dependency before delete
5436 $res = sql_query('SELECT pfile FROM '.sql_table('plugin'));
5437 while($o = mysql_fetch_object($res)) {
5438 $plug =& $manager->getPlugin($o->pfile);
5441 $depList = $plug->getPluginDep();
5442 foreach ($depList as $depName)
5444 if ($name == $depName)
5446 return _ERROR_DELREQPLUGIN . $o->pfile;
5452 $manager->notify('PreDeletePlugin', array('plugid' => $pid));
5454 // delete all subscriptions
5455 sql_query('DELETE FROM '.sql_table('plugin_event').' WHERE pid=' . $pid);
5457 // delete all options
5458 // get OIDs from plugin_option_desc
5459 $res = sql_query('SELECT oid FROM ' . sql_table('plugin_option_desc') . ' WHERE opid=' . $pid);
5461 while ($o = mysql_fetch_object($res)) {
5462 array_push($aOIDs, $o->oid);
5465 // delete from plugin_option and plugin_option_desc
5466 sql_query('DELETE FROM '.sql_table('plugin_option_desc').' WHERE opid=' . $pid);
5467 if (count($aOIDs) > 0)
5468 sql_query('DELETE FROM '.sql_table('plugin_option').' WHERE oid in ('.implode(',',$aOIDs).')');
5470 // update order numbers
5471 $o = mysql_fetch_object(sql_query('SELECT porder FROM '.sql_table('plugin').' WHERE pid=' . $pid));
5472 sql_query('UPDATE '.sql_table('plugin').' SET porder=(porder - 1) WHERE porder>'.$o->porder);
5475 sql_query('DELETE FROM '.sql_table('plugin').' WHERE pid='.$pid);
5477 $manager->clearCachedInfo('installedPlugins');
5478 $manager->notify('PostDeletePlugin', array('plugid' => $pid));
5483 function action_pluginup() {
5484 global $member, $manager;
5487 $member->isAdmin() or $this->disallow();
5489 $plugid = intGetVar('plugid');
5491 if (!$manager->pidInstalled($plugid))
5492 $this->error(_ERROR_NOSUCHPLUGIN);
5494 // 1. get old order number
5495 $o = mysql_fetch_object(sql_query('SELECT porder FROM '.sql_table('plugin').' WHERE pid='.$plugid));
5496 $oldOrder = $o->porder;
5498 // 2. calculate new order number
5499 $newOrder = ($oldOrder > 1) ? ($oldOrder - 1) : 1;
5501 // 3. update plug numbers
5502 sql_query('UPDATE '.sql_table('plugin').' SET porder='.$oldOrder.' WHERE porder='.$newOrder);
5503 sql_query('UPDATE '.sql_table('plugin').' SET porder='.$newOrder.' WHERE pid='.$plugid);
5505 $this->action_pluginlist();
5508 function action_plugindown() {
5509 global $member, $manager;
5512 $member->isAdmin() or $this->disallow();
5514 $plugid = intGetVar('plugid');
5515 if (!$manager->pidInstalled($plugid))
5516 $this->error(_ERROR_NOSUCHPLUGIN);
5518 // 1. get old order number
5519 $o = mysql_fetch_object(sql_query('SELECT porder FROM '.sql_table('plugin').' WHERE pid='.$plugid));
5520 $oldOrder = $o->porder;
5522 $maxOrder = mysql_num_rows(sql_query('SELECT * FROM '.sql_table('plugin')));
5524 // 2. calculate new order number
5525 $newOrder = ($oldOrder < $maxOrder) ? ($oldOrder + 1) : $maxOrder;
5527 // 3. update plug numbers
5528 sql_query('UPDATE '.sql_table('plugin').' SET porder='.$oldOrder.' WHERE porder='.$newOrder);
5529 sql_query('UPDATE '.sql_table('plugin').' SET porder='.$newOrder.' WHERE pid='.$plugid);
5531 $this->action_pluginlist();
5534 function action_pluginoptions($message = '') {
5535 global $member, $manager;
5538 $member->isAdmin() or $this->disallow();
5540 $pid = intRequestVar('plugid');
5541 if (!$manager->pidInstalled($pid))
5542 $this->error(_ERROR_NOSUCHPLUGIN);
5544 $extrahead = '<script type="text/javascript" src="javascript/numbercheck.js"></script>';
5545 $this->pagehead($extrahead);
5548 <p><a href="index.php?action=pluginlist">(<?php echo _PLUGS_BACK?>)</a></p>
5550 <h2>Options for <?php echo htmlspecialchars(getPluginNameFromPid($pid))?></h2>
5552 <?php if ($message) echo $message?>
5554 <form action="index.php" method="post">
5556 <input type="hidden" name="action" value="pluginoptionsupdate" />
5557 <input type="hidden" name="plugid" value="<?php echo $pid?>" />
5561 $manager->addTicketHidden();
5563 $aOptions = array();
5565 $query = 'SELECT * FROM ' . sql_table('plugin_option_desc') . ' WHERE ocontext=\'global\' and opid=' . $pid . ' ORDER BY oid ASC';
5566 $r = sql_query($query);
5567 while ($o = mysql_fetch_object($r)) {
5568 array_push($aOIDs, $o->oid);
5569 $aOptions[$o->oid] = array(
5571 'value' => $o->odef,
5572 'name' => $o->oname,
5573 'description' => $o->odesc,
5574 'type' => $o->otype,
5575 'typeinfo' => $o->oextra,
5579 // fill out actual values
5580 if (count($aOIDs) > 0) {
5581 $r = sql_query('SELECT oid, ovalue FROM ' . sql_table('plugin_option') . ' WHERE oid in ('.implode(',',$aOIDs).')');
5582 while ($o = mysql_fetch_object($r))
5583 $aOptions[$o->oid]['value'] = $o->ovalue;
5587 $manager->notify('PrePluginOptionsEdit',array('context' => 'global', 'plugid' => $pid, 'options'=>&$aOptions));
5589 $template['content'] = 'plugoptionlist';
5590 $amount = showlist($aOptions,'table',$template);
5592 echo '<p>',_ERROR_NOPLUGOPTIONS,'</p>';
5597 <?php $this->pagefoot();
5603 function action_pluginoptionsupdate() {
5604 global $member, $manager;
5607 $member->isAdmin() or $this->disallow();
5609 $pid = intRequestVar('plugid');
5610 if (!$manager->pidInstalled($pid))
5611 $this->error(_ERROR_NOSUCHPLUGIN);
5613 $aOptions = requestArray('plugoption');
5614 NucleusPlugin::_applyPluginOptions($aOptions);
5616 $manager->notify('PostPluginOptionsUpdate',array('context' => 'global', 'plugid' => $pid));
5618 $this->action_pluginoptions(_PLUGS_OPTIONS_UPDATED);
5624 function _insertPluginOptions($context, $contextid = 0) {
5625 // get all current values for this contextid
5626 // (note: this might contain doubles for overlapping contextids)
5627 $aIdToValue = array();
5628 $res = sql_query('SELECT oid, ovalue FROM ' . sql_table('plugin_option') . ' WHERE ocontextid=' . intval($contextid));
5629 while ($o = mysql_fetch_object($res)) {
5630 $aIdToValue[$o->oid] = $o->ovalue;
5633 // get list of oids per pid
5634 $query = 'SELECT * FROM ' . sql_table('plugin_option_desc') . ',' . sql_table('plugin')
5635 . ' WHERE opid=pid and ocontext=\''.addslashes($context).'\' ORDER BY porder, oid ASC';
5636 $res = sql_query($query);
5637 $aOptions = array();
5638 while ($o = mysql_fetch_object($res)) {
5639 if (in_array($o->oid, array_keys($aIdToValue)))
5640 $value = $aIdToValue[$o->oid];
5644 array_push($aOptions, array(
5646 'pfile' => $o->pfile,
5649 'name' => $o->oname,
5650 'description' => $o->odesc,
5651 'type' => $o->otype,
5652 'typeinfo' => $o->oextra,
5653 'contextid' => $contextid,
5659 $manager->notify('PrePluginOptionsEdit',array('context' => $context, 'contextid' => $contextid, 'options'=>&$aOptions));
5663 foreach ($aOptions as $aOption) {
5666 if ($iPrevPid != $aOption['pid']) {
5667 $iPrevPid = $aOption['pid'];
5669 echo '<tr><th colspan="2">Options for ', htmlspecialchars($aOption['pfile']),'</th></tr>';
5673 listplug_plugOptionRow($aOption);
5681 /* helper functions to create option forms etc. */
5682 function input_yesno($name, $checkedval,$tabindex = 0, $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO) {
5683 $id = htmlspecialchars($name);
5684 $id = str_replace('[','-',$id);
5685 $id = str_replace(']','-',$id);
5686 $id1 = $id . htmlspecialchars($value1);
5687 $id2 = $id . htmlspecialchars($value2);
5689 echo '<input type="radio" name="', htmlspecialchars($name),'" value="', htmlspecialchars($value1),'" ';
5690 if ($checkedval == $value1)
5691 echo "tabindex='$tabindex' checked='checked'";
5692 echo ' id="'.$id1.'" /><label for="'.$id1.'">' . $yesval . '</label>';
5694 echo '<input type="radio" name="', htmlspecialchars($name),'" value="', htmlspecialchars($value2),'" ';
5695 if ($checkedval != $value1)
5696 echo "tabindex='$tabindex' checked='checked'";
5697 echo ' id="'.$id2.'" /><label for="'.$id2.'">' . $noval . '</label>';
5706 * Uses $call to call a function using parameters $params
5707 * This function should return the amount of entries shown.
5708 * When entries are show, batch operation handlers are shown too.
5709 * When no entries were shown, $errormsg is used to display an error
5711 * Passes on the amount of results found (for further encapsulation)
5713 function doEncapsulate($call, $params, $errorMessage = 'No entries') {
5714 // start output buffering
5717 $nbOfRows = call_user_func_array($call, $params);
5719 // get list contents and stop buffering
5720 $list = ob_get_contents();
5723 if ($nbOfRows > 0) {
5737 * A class used to encapsulate a list of some sort inside next/prev buttons
5739 class NAVLIST extends ENCAPSULATE {
5741 function NAVLIST($action, $start, $amount, $minamount, $maxamount, $blogid, $search, $itemid) {
5742 $this->action = $action;
5743 $this->start = $start;
5744 $this->amount = $amount;
5745 $this->minamount = $minamount;
5746 $this->maxamount = $maxamount;
5747 $this->blogid = $blogid;
5748 $this->search = $search;
5749 $this->itemid = $itemid;
5752 function showBatchList($batchtype, $query, $type, $template, $errorMessage = _LISTS_NOMORE) {
5753 $batch =& new BATCH($batchtype);
5755 $this->doEncapsulate(
5756 array(&$batch, 'showlist'),
5757 array(&$query, $type, $template),
5764 function showHead() {
5765 $this->showNavigation();
5767 function showFoot() {
5768 $this->showNavigation();
5772 * Displays a next/prev bar for long tables
5774 function showNavigation() {
5775 $action = $this->action;
5776 $start = $this->start;
5777 $amount = $this->amount;
5778 $minamount = $this->minamount;
5779 $maxamount = $this->maxamount;
5780 $blogid = $this->blogid;
5781 $search = $this->search;
5782 $itemid = $this->itemid;
5784 $prev = $start - $amount;
5785 if ($prev < $minamount) $prev=$minamount;
5787 // maxamount not used yet
5788 // if ($start + $amount <= $maxamount)
5789 $next = $start + $amount;
5794 <table class="navigation">
5796 <form method="post" action="index.php"><div>
5797 <input type="submit" value="<< <?php echo _LISTS_PREV?>" />
5798 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
5799 <input type="hidden" name="itemid" value="<?php echo $itemid; ?>" />
5800 <input type="hidden" name="action" value="<?php echo $action; ?>" />
5801 <input type="hidden" name="amount" value="<?php echo $amount; ?>" />
5802 <input type="hidden" name="search" value="<?php echo $search; ?>" />
5803 <input type="hidden" name="start" value="<?php echo $prev; ?>" />
5806 <form method="post" action="index.php"><div>
5807 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
5808 <input type="hidden" name="itemid" value="<?php echo $itemid; ?>" />
5809 <input type="hidden" name="action" value="<?php echo $action; ?>" />
5810 <input name="amount" size="3" value="<?php echo $amount; ?>" /> <?php echo _LISTS_PERPAGE?>
5811 <input type="hidden" name="start" value="<?php echo $start; ?>" />
5812 <input type="hidden" name="search" value="<?php echo $search; ?>" />
5813 <input type="submit" value="> <?php echo _LISTS_CHANGE?>" />
5816 <form method="post" action="index.php"><div>
5817 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
5818 <input type="hidden" name="itemid" value="<?php echo $itemid; ?>" />
5819 <input type="hidden" name="action" value="<?php echo $action; ?>" />
5820 <input type="hidden" name="amount" value="<?php echo $amount; ?>" />
5821 <input type="hidden" name="start" value="0" />
5822 <input type="text" name="search" value="<?php echo $search; ?>" size="7" />
5823 <input type="submit" value="> <?php echo _LISTS_SEARCH?>" />
5826 <form method="post" action="index.php"><div>
5827 <input type="submit" value="<?php echo _LISTS_NEXT?> > >" />
5828 <input type="hidden" name="search" value="<?php echo $search; ?>" />
5829 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
5830 <input type="hidden" name="itemid" value="<?php echo $itemid; ?>" />
5831 <input type="hidden" name="action" value="<?php echo $action; ?>" />
5832 <input type="hidden" name="amount" value="<?php echo $amount; ?>" />
5833 <input type="hidden" name="start" value="<?php echo $next; ?>" />
5843 * A class used to encapsulate a list of some sort in a batch selection
5845 class BATCH extends ENCAPSULATE {
5846 function BATCH($type) {
5847 $this->type = $type;
5850 function showHead() {
5852 <form method="post" action="index.php">
5854 // TODO: get a list op operations above the list too
5855 // (be careful not to use the same names for the select...)
5856 // $this->showOperationList();
5859 function showFoot() {
5860 $this->showOperationList();
5865 function showOperationList() {
5868 <div class="batchoperations">
5869 <?php echo _BATCH_WITH_SEL ?>
5870 <select name="batchaction">
5871 <?php $options = array();
5872 switch($this->type) {
5875 'delete' => _BATCH_ITEM_DELETE,
5876 'move' => _BATCH_ITEM_MOVE
5881 'delete' => _BATCH_MEMBER_DELETE,
5882 'setadmin' => _BATCH_MEMBER_SET_ADM,
5883 'unsetadmin' => _BATCH_MEMBER_UNSET_ADM
5888 'delete' => _BATCH_TEAM_DELETE,
5889 'setadmin' => _BATCH_TEAM_SET_ADM,
5890 'unsetadmin' => _BATCH_TEAM_UNSET_ADM,
5895 'delete' => _BATCH_CAT_DELETE,
5896 'move' => _BATCH_CAT_MOVE,
5901 'delete' => _BATCH_COMMENT_DELETE,
5905 foreach ($options as $option => $label) {
5906 echo '<option value="',$option,'">',$label,'</option>';
5910 <input type="hidden" name="action" value="batch<?php echo $this->type?>" />
5912 $manager->addTicketHidden();
5914 // add hidden fields for 'team' and 'comment' batchlists
5915 if ($this->type == 'team')
5917 echo '<input type="hidden" name="blogid" value="',intRequestVar('blogid'),'" />';
5919 if ($this->type == 'comment')
5921 echo '<input type="hidden" name="itemid" value="',intRequestVar('itemid'),'" />';
5924 echo '<input type="submit" value="',_BATCH_EXEC,'" />';
5926 <a href="" onclick="if (event && event.preventDefault) event.preventDefault(); return batchSelectAll(1); "><?php echo _BATCH_SELECTALL?></a> -
5927 <a href="" onclick="if (event && event.preventDefault) event.preventDefault(); return batchSelectAll(0); "><?php echo _BATCH_DESELECTALL?></a>
5933 function showList($query, $type, $template, $errorMessage = _LISTS_NOMORE) {
5934 return $this->doEncapsulate( 'showlist',
5935 array($query, $type, $template),
5944 // can take either an array of objects, or an SQL query
5945 function showlist($query, $type, $template) {
5947 if (is_array($query)) {
5948 if (sizeof($query) == 0)
5951 call_user_func('listplug_' . $type, $template, 'HEAD');
5953 foreach ($query as $currentObj) {
5954 $template['current'] = $currentObj;
5955 call_user_func('listplug_' . $type, $template, 'BODY');
5958 call_user_func('listplug_' . $type, $template, 'FOOT');
5960 return sizeof($query);
5963 $res = sql_query($query);
5965 // don't do anything if there are no results
5966 $numrows = mysql_num_rows($res);
5970 call_user_func('listplug_' . $type, $template, 'HEAD');
5972 while($template['current'] = mysql_fetch_object($res))
5973 call_user_func('listplug_' . $type, $template, 'BODY');
5975 call_user_func('listplug_' . $type, $template, 'FOOT');
5977 mysql_free_result($res);
5979 // return amount of results
5984 function listplug_select($template, $type) {
5987 echo '<select name="'.$template['name'].'" tabindex="'.$template['tabindex'].'" '.$template['javascript'].'>';
5989 // add extra row if needed
5990 if ($template['extra']) {
5991 echo '<option value="',$template['extraval'],'">',$template['extra'],'</option>';
5996 $current = $template['current'];
5998 echo '<option value="' . htmlspecialchars($current->value) . '"';
5999 if ($template['selected'] == $current->value)
6000 echo ' selected="selected" ';
6001 if ($template['shorten'] > 0) {
6002 echo ' title="'. htmlspecialchars($current->text).'"';
6003 $current->text = shorten($current->text, $template['shorten'], $template['shortenel']);
6005 echo '>' . htmlspecialchars($current->text) . '</option>';
6013 function listplug_table($template, $type) {
6019 call_user_func("listplug_table_" . $template['content'] , $template, 'HEAD');
6020 echo "</tr></thead><tbody>";
6023 // print tabletype specific thingies
6024 echo "<tr onmouseover='focusRow(this);' onmouseout='blurRow(this);'>";
6025 call_user_func("listplug_table_" . $template['content'] , $template, 'BODY');
6029 call_user_func("listplug_table_" . $template['content'] , $template, 'FOOT');
6030 echo "</tbody></table>";
6035 function listplug_table_memberlist($template, $type) {
6038 echo '<th>' . _LIST_MEMBER_NAME . '</th><th>' . _LIST_MEMBER_RNAME . '</th><th>' . _LIST_MEMBER_URL . '</th><th>' . _LIST_MEMBER_ADMIN;
6040 echo "</th><th>" . _LIST_MEMBER_LOGIN;
6042 echo "</th><th colspan='2'>" . _LISTS_ACTIONS. "</th>";
6045 $current = $template['current'];
6048 $id = listplug_nextBatchId();
6049 echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->mnumber,'" />';
6050 echo '<label for="batch',$id,'">';
6051 echo "<a href='mailto:", htmlspecialchars($current->memail), "' tabindex='".$template['tabindex']."'>", htmlspecialchars($current->mname), "</a>";
6054 echo '<td>', htmlspecialchars($current->mrealname), '</td>';
6055 echo "<td><a href='$current->murl' tabindex='".$template['tabindex']."'>$current->murl</a></td>";
6056 echo '<td>', ($current->madmin ? _YES : _NO),'</td>';
6057 echo '<td>', ($current->mcanlogin ? _YES : _NO), '</td>';
6058 echo "<td><a href='index.php?action=memberedit&memberid=$current->mnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
6059 echo "<td><a href='index.php?action=memberdelete&memberid=$current->mnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
6064 function listplug_table_teamlist($template, $type) {
6068 echo "<th>"._LIST_MEMBER_NAME."</th><th>"._LIST_MEMBER_RNAME."</th><th>"._LIST_TEAM_ADMIN;
6070 echo "</th><th colspan='2'>"._LISTS_ACTIONS."</th>";
6073 $current = $template['current'];
6076 $id = listplug_nextBatchId();
6077 echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->tmember,'" />';
6078 echo '<label for="batch',$id,'">';
6079 echo "<a href='mailto:", htmlspecialchars($current->memail), "' tabindex='".$template['tabindex']."'>", htmlspecialchars($current->mname), "</a>";
6082 echo '<td>', htmlspecialchars($current->mrealname), '</td>';
6083 echo '<td>', ($current->tadmin ? _YES : _NO) , '</td>';
6084 echo "<td><a href='index.php?action=teamdelete&memberid=$current->tmember&blogid=$current->tblog' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
6086 $url = 'index.php?action=teamchangeadmin&memberid=' . intval($current->tmember) . '&blogid=' . intval($current->tblog);
6087 $url = $manager->addTicketToUrl($url);
6088 echo "<td><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LIST_TEAM_CHADMIN."</a></td>";
6093 function encode_desc(&$data)
6094 { //_$to_entities = get_html_translation_table(HTML_ENTITIES);
6095 $to_entities = get_html_translation_table(HTML_SPECIALCHARS);
6096 $from_entities = array_flip($to_entities);
6097 $data = str_replace('<br />','\n',$data); //hack
6098 $data = strtr($data,$from_entities);
6099 $data = strtr($data,$to_entities);
6100 $data = str_replace('\n','<br />',$data); //hack
6104 function listplug_table_pluginlist($template, $type) {
6108 echo '<th>'._LISTS_INFO.'</th><th>'._LISTS_DESC.'</th>';
6109 echo '<th style="white-space:nowrap">'._LISTS_ACTIONS.'</th>';
6112 $current = $template['current'];
6114 $plug =& $manager->getPlugin($current->pfile);
6117 echo '<strong>' , htmlspecialchars($plug->getName()) , '</strong><br />';
6118 echo _LIST_PLUGS_AUTHOR, ' ' , htmlspecialchars($plug->getAuthor()) , '<br />';
6119 echo _LIST_PLUGS_VER, ' ' , htmlspecialchars($plug->getVersion()) , '<br />';
6120 if ($plug->getURL())
6121 echo '<a href="',htmlspecialchars($plug->getURL()),'" tabindex="'.$template['tabindex'].'">',_LIST_PLUGS_SITE,'</a><br />';
6124 echo _LIST_PLUGS_DESC .'<br/>'. encode_desc($plug->getDescription());
6125 if (sizeof($plug->getEventList()) > 0)
6126 echo '<br /><br />',_LIST_PLUGS_SUBS,'<br />',htmlspecialchars(implode($plug->getEventList(),', '));
6127 if (sizeof($plug->getPluginDep()) > 0)
6128 echo '<br /><br />',_LIST_PLUGS_DEP,'<br />',htmlspecialchars(implode($plug->getPluginDep(),', '));
6131 echo '<td colspan="2">Error: plugin file <b>',htmlspecialchars($current->pfile),'.php</b> could not be loaded, or it has been set inactive because it does not support some features (check the <a href="?action=actionlog">actionlog</a> for more info)</td>';
6133 echo '<td style="white-space:nowrap">';
6135 $baseUrl = 'index.php?plugid=' . intval($current->pid) . '&action=';
6136 $url = $manager->addTicketToUrl($baseUrl . 'pluginup');
6137 echo "<a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_UP,"</a>";
6138 $url = $manager->addTicketToUrl($baseUrl . 'plugindown');
6139 echo "<br /><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_DOWN,"</a>";
6140 echo "<br /><a href='index.php?action=plugindelete&plugid=$current->pid' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_UNINSTALL,"</a>";
6141 if ($plug && ($plug->hasAdminArea() > 0))
6142 echo "<br /><a href='".htmlspecialchars($plug->getAdminURL())."' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_ADMIN,"</a>";
6143 if ($plug && ($plug->supportsFeature('HelpPage') > 0))
6144 echo "<br /><a href='index.php?action=pluginhelp&plugid=$current->pid' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_HELP,"</a>";
6145 if (quickQuery('SELECT COUNT(*) AS result FROM '.sql_table('plugin_option_desc').' WHERE ocontext=\'global\' and opid='.$current->pid) > 0)
6146 echo "<br /><a href='index.php?action=pluginoptions&plugid=$current->pid' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_OPTIONS,"</a>";
6152 function listplug_table_plugoptionlist($template, $type) {
6156 echo '<th>'._LISTS_INFO.'</th><th>'._LISTS_VALUE.'</th>';
6159 $current = $template['current'];
6160 listplug_plugOptionRow($current);
6165 <th colspan="2"><?php echo _PLUGS_SAVE?></th>
6167 <td><?php echo _PLUGS_SAVE?></td>
6168 <td><input type="submit" value="<?php echo _PLUGS_SAVE?>" /></td>
6174 function listplug_plugOptionRow($current) {
6175 $varname = 'plugoption['.$current['oid'].']['.$current['contextid'].']';
6176 // retreive the optionmeta
6177 $meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
6179 // only if it is not a hidden option write the controls to the page
6180 if ($meta['access'] != 'hidden') {
6181 echo '<td>',htmlspecialchars($current['description']?$current['description']:$current['name']),'</td>';
6183 switch($current['type']) {
6185 ADMIN::input_yesno($varname, $current['value'], 0, 'yes', 'no');
6188 echo '<input type="password" size="40" maxlength="128" name="',htmlspecialchars($varname),'" value="',htmlspecialchars($current['value']),'" />';
6191 echo '<select name="'.htmlspecialchars($varname).'">';
6192 $aOptions = NucleusPlugin::getOptionSelectValues($current['typeinfo']);
6193 $aOptions = explode('|', $aOptions);
6194 for ($i=0; $i<(count($aOptions)-1); $i+=2) {
6195 echo '<option value="'.htmlspecialchars($aOptions[$i+1]).'"';
6196 if ($aOptions[$i+1] == $current['value'])
6197 echo ' selected="selected"';
6198 echo '>'.htmlspecialchars($aOptions[$i]).'</option>';
6203 //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
6204 echo '<textarea class="pluginoption" cols="30" rows="5" name="',htmlspecialchars($varname),'"';
6205 if ($meta['access'] == 'readonly') {
6206 echo ' readonly="readonly"';
6208 echo '>',htmlspecialchars($current['value']),'</textarea>';
6212 //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
6214 echo '<input type="text" size="40" maxlength="128" name="',htmlspecialchars($varname),'" value="',htmlspecialchars($current['value']),'"';
6215 if ($meta['datatype'] == 'numerical') {
6216 echo ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';
6218 if ($meta['access'] == 'readonly') {
6219 echo ' readonly="readonly"';
6223 echo $current['extra'];
6228 function listplug_table_itemlist($template, $type) {
6231 echo "<th>"._LIST_ITEM_INFO."</th><th>"._LIST_ITEM_CONTENT."</th><th style=\"white-space:nowrap\" colspan='1'>"._LISTS_ACTIONS."</th>";
6234 $current = $template['current'];
6235 $current->itime = strtotime($current->itime); // string -> unix timestamp
6237 if ($current->idraft == 1)
6238 $cssclass = "class='draft'";
6240 // (can't use offset time since offsets might vary between blogs)
6241 if ($current->itime > $template['now'])
6242 $cssclass = "class='future'";
6244 echo "<td $cssclass>",_LIST_ITEM_BLOG,' ', htmlspecialchars($current->bshortname);
6245 echo " <br />",_LIST_ITEM_CAT,' ', htmlspecialchars($current->cname);
6246 echo " <br />",_LIST_ITEM_AUTHOR, ' ', htmlspecialchars($current->mname);
6247 echo " <br />",_LIST_ITEM_DATE," " . date("Y-m-d",$current->itime);
6248 echo "<br />",_LIST_ITEM_TIME," " . date("H:i",$current->itime);
6250 echo "<td $cssclass>";
6252 $id = listplug_nextBatchId();
6254 echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->inumber,'" />';
6255 echo '<label for="batch',$id,'">';
6256 echo "<b>" . htmlspecialchars(strip_tags($current->ititle)) . "</b>";
6261 $current->ibody = strip_tags($current->ibody);
6262 $current->ibody = htmlspecialchars(shorten($current->ibody,300,'...'));
6264 echo "$current->ibody</td>";
6265 echo "<td style=\"white-space:nowrap\" $cssclass>";
6266 echo "<a href='index.php?action=itemedit&itemid=$current->inumber'>"._LISTS_EDIT."</a>";
6267 echo "<br /><a href='index.php?action=itemcommentlist&itemid=$current->inumber'>"._LISTS_COMMENTS."</a>";
6268 echo "<br /><a href='index.php?action=itemmove&itemid=$current->inumber'>"._LISTS_MOVE."</a>";
6269 echo "<br /><a href='index.php?action=itemdelete&itemid=$current->inumber'>"._LISTS_DELETE."</a>";
6275 // for batch operations: generates the index numbers for checkboxes
6276 function listplug_nextBatchId() {
6281 function listplug_table_commentlist($template, $type) {
6284 echo "<th>"._LISTS_INFO."</th><th>"._LIST_COMMENT."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
6287 $current = $template['current'];
6288 $current->ctime = strtotime($current->ctime); // string -> unix timestamp
6291 echo date("Y-m-d@H:i",$current->ctime);
6293 if ($current->mname)
6294 echo htmlspecialchars($current->mname) ,' ', _LIST_COMMENTS_MEMBER;
6296 echo htmlspecialchars($current->cuser);
6300 $current->cbody = strip_tags($current->cbody);
6301 $current->cbody = htmlspecialchars(shorten($current->cbody, 300, '...'));
6304 $id = listplug_nextBatchId();
6305 echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->cnumber,'" />';
6306 echo '<label for="batch',$id,'">';
6307 echo $current->cbody;
6311 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=commentedit&commentid=$current->cnumber'>"._LISTS_EDIT."</a></td>";
6312 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=commentdelete&commentid=$current->cnumber'>"._LISTS_DELETE."</a></td>";
6313 if ($template['canAddBan'])
6314 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=banlistnewfromitem&itemid=$current->citem&ip=", htmlspecialchars($current->cip), "' title='", htmlspecialchars($current->chost), "'>"._LIST_COMMENT_BANIP."</a></td>";
6320 function listplug_table_bloglist($template, $type) {
6323 echo "<th>" . _NAME . "</th><th colspan='7'>" ._LISTS_ACTIONS. "</th>";
6326 $current = $template['current'];
6328 echo "<td title='blogid:$current->bnumber shortname:$current->bshortname'><a href='$current->burl'><img src='images/globe.gif' width='13' height='13' alt='". _BLOGLIST_TT_VISIT."' /></a> " . htmlspecialchars($current->bname) . "</td>";
6329 echo "<td><a href='index.php?action=createitem&blogid=$current->bnumber' title='" . _BLOGLIST_TT_ADD ."'>" . _BLOGLIST_ADD . "</a></td>";
6330 echo "<td><a href='index.php?action=itemlist&blogid=$current->bnumber' title='". _BLOGLIST_TT_EDIT."'>". _BLOGLIST_EDIT."</a></td>";
6331 echo "<td><a href='index.php?action=blogcommentlist&blogid=$current->bnumber' title='". _BLOGLIST_TT_COMMENTS."'>". _BLOGLIST_COMMENTS."</a></td>";
6332 echo "<td><a href='index.php?action=bookmarklet&blogid=$current->bnumber' title='". _BLOGLIST_TT_BMLET."'>". _BLOGLIST_BMLET . "</a></td>";
6334 if ($current->tadmin == 1) {
6335 echo "<td><a href='index.php?action=blogsettings&blogid=$current->bnumber' title='" . _BLOGLIST_TT_SETTINGS . "'>" ._BLOGLIST_SETTINGS. "</a></td>";
6336 echo "<td><a href='index.php?action=banlist&blogid=$current->bnumber' title='" . _BLOGLIST_TT_BANS. "'>". _BLOGLIST_BANS."</a></td>";
6339 if ($template['superadmin']) {
6340 echo "<td><a href='index.php?action=deleteblog&blogid=$current->bnumber' title='". _BLOGLIST_TT_DELETE."'>" ._BLOGLIST_DELETE. "</a></td>";
6349 function listplug_table_shortblognames($template, $type) {
6352 echo "<th>" . _NAME . "</th><th>" . _NAME. "</th>";
6355 $current = $template['current'];
6357 echo '<td>' , htmlspecialchars($current->bshortname) , '</td>';
6358 echo '<td>' , htmlspecialchars($current->bname) , '</td>';
6364 function listplug_table_shortnames($template, $type) {
6367 echo "<th>" . _NAME . "</th><th>" . _LISTS_DESC. "</th>";
6370 $current = $template['current'];
6372 echo '<td>' , htmlspecialchars($current->name) , '</td>';
6373 echo '<td>' , htmlspecialchars($current->description) , '</td>';
6380 function listplug_table_categorylist($template, $type) {
6383 echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='2'>"._LISTS_ACTIONS."</th>";
6386 $current = $template['current'];
6389 $id = listplug_nextBatchId();
6390 echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->catid,'" />';
6391 echo '<label for="batch',$id,'">';
6392 echo htmlspecialchars($current->cname);
6396 echo '<td>', htmlspecialchars($current->cdesc), '</td>';
6397 echo "<td><a href='index.php?action=categorydelete&blogid=$current->cblog&catid=$current->catid' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
6398 echo "<td><a href='index.php?action=categoryedit&blogid=$current->cblog&catid=$current->catid' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
6405 function listplug_table_templatelist($template, $type) {
6409 echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
6412 $current = $template['current'];
6414 echo "<td>" , htmlspecialchars($current->tdname), "</td>";
6415 echo "<td>" , htmlspecialchars($current->tddesc), "</td>";
6416 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=templateedit&templateid=$current->tdnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
6418 $url = $manager->addTicketToUrl('index.php?action=templateclone&templateid=' . intval($current->tdnumber));
6419 echo "<td style=\"white-space:nowrap\"><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LISTS_CLONE."</a></td>";
6420 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=templatedelete&templateid=$current->tdnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
6426 function listplug_table_skinlist($template, $type) {
6427 global $CONF, $DIR_SKINS, $manager;
6430 echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
6433 $current = $template['current'];
6437 // use a special style for the default skin
6438 if ($current->sdnumber == $CONF['BaseSkin']) {
6439 echo '<strong>',htmlspecialchars($current->sdname),'</strong>';
6441 echo htmlspecialchars($current->sdname);
6444 echo '<br /><br />';
6445 echo _LISTS_TYPE ,': ' , htmlspecialchars($current->sdtype);
6446 echo '<br />', _LIST_SKINS_INCMODE , ' ' , (($current->sdincmode=='skindir') ?_PARSER_INCMODE_SKINDIR:_PARSER_INCMODE_NORMAL);
6447 if ($current->sdincpref) echo '<br />' , _LIST_SKINS_INCPREFIX , ' ', htmlspecialchars($current->sdincpref);
6449 // add preview image when present
6450 if ($current->sdincpref && @file_exists($DIR_SKINS . $current->sdincpref . 'preview.png'))
6452 echo '<br /><br />';
6454 $hasEnlargement = @file_exists($DIR_SKINS . $current->sdincpref . 'preview-large.png');
6455 if ($hasEnlargement)
6456 echo '<a href="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview-large.png" title="View larger">';
6458 echo '<img class="skinpreview" src="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview.png" width="100" height="75" alt="Preview for \'',htmlspecialchars($current->sdname),'\' skin" />';
6460 if ($hasEnlargement)
6463 if (@file_exists($DIR_SKINS . $current->sdincpref . 'readme.html'))
6465 echo '<br /><a href="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'readme.html" title="More info on the \'',htmlspecialchars($current->sdname),'\' skin">Readme</a>';
6474 echo "<td>" , htmlspecialchars($current->sddesc);
6475 // show list of defined parts
6476 $r = sql_query('SELECT stype FROM '.sql_table('skin').' WHERE sdesc='.$current->sdnumber . ' ORDER BY stype');
6478 while ($o = mysql_fetch_object($r))
6479 array_push($types,$o->stype);
6480 if (sizeof($types) > 0) {
6481 $friendlyNames = SKIN::getFriendlyNames();
6482 for ($i=0;$i<sizeof($types);$i++) {
6484 $types[$i] = '<li>' . helpHtml('skinpart'.$type) . ' <a href="index.php?action=skinedittype&skinid='.$current->sdnumber.'&type='.$type.'" tabindex="'.$template['tabindex'].'">' . htmlspecialchars($friendlyNames[$type]) . "</a></li>";
6486 echo '<br /><br />',_LIST_SKINS_DEFINED,' <ul>',implode($types,'') ,'</ul>';
6489 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skinedit&skinid=$current->sdnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
6491 $url = $manager->addTicketToUrl('index.php?action=skinclone&skinid=' . intval($current->sdnumber));
6492 echo "<td style=\"white-space:nowrap\"><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LISTS_CLONE."</a></td>";
6493 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skindelete&skinid=$current->sdnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
6499 function listplug_table_draftlist($template, $type) {
6502 echo "<th>"._LISTS_BLOG."</th><th>"._LISTS_TITLE."</th><th colspan='2'>"._LISTS_ACTIONS."</th>";
6505 $current = $template['current'];
6507 echo '<td>', htmlspecialchars($current->bshortname) , '</td>';
6508 echo '<td>', htmlspecialchars(strip_tags($current->ititle)) , '</td>';
6509 echo "<td><a href='index.php?action=itemedit&itemid=$current->inumber'>"._LISTS_EDIT."</a></td>";
6510 echo "<td><a href='index.php?action=itemdelete&itemid=$current->inumber'>"._LISTS_DELETE."</a></td>";
6517 function listplug_table_actionlist($template, $type) {
6520 echo '<th>'._LISTS_TIME.'</th><th>'._LIST_ACTION_MSG.'</th>';
6523 $current = $template['current'];
6525 echo '<td>' , htmlspecialchars($current->timestamp), '</td>';
6526 echo '<td>' , htmlspecialchars($current->message), '</td>';
6532 function listplug_table_banlist($template, $type) {
6535 echo '<th>'._LIST_BAN_IPRANGE.'</th><th>'. _LIST_BAN_REASON.'</th><th>'._LISTS_ACTIONS.'</th>';
6538 $current = $template['current'];
6540 echo '<td>' , htmlspecialchars($current->iprange) , '</td>';
6541 echo '<td>' , htmlspecialchars($current->reason) , '</td>';
6542 echo "<td><a href='index.php?action=banlistdelete&blogid=", intval($current->blogid) , "&iprange=" , htmlspecialchars($current->iprange) , "'>",_LISTS_DELETE,"</a></td>";
6548 * Returns the Javascript code for a bookmarklet that works on most modern browsers
6552 function getBookmarklet($blogid) {
6556 $document = 'document';
6557 $bookmarkletline = "javascript:Q='';x=".$document.";y=window;if(x.selection){Q=x.selection.createRange().text;}else if(y.getSelection){Q=y.getSelection();}else if(x.getSelection){Q=x.getSelection();}wingm=window.open('";
6558 $bookmarkletline .= $CONF['AdminURL'] . "bookmarklet.php?blogid=$blogid";
6559 $bookmarkletline .="&logtext='+escape(Q)+'&loglink='+escape(x.location.href)+'&loglinktitle='+escape(x.title),'nucleusbm','scrollbars=yes,width=600,height=500,left=10,top=10,status=yes,resizable=yes');wingm.focus();";
6561 return $bookmarkletline;