3 * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4 * Copyright (C) 2002-2006 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)
13 * The code for the Nucleus admin area
15 * @license http://nucleuscms.org/license.txt GNU General Public License
16 * @copyright Copyright (C) 2002-2006 The Nucleus Group
17 * @version $Id: ADMIN.php,v 1.7 2006-07-12 07:11:47 kimitake Exp $
22 // action currently being executed ($action=xxxx -> action_xxxx method)
33 * action to be performed
35 function action($action) {
36 global $CONF, $manager;
38 // list of action aliases
40 'login' => 'overview',
45 $action = $alias[$action];
47 $methodName = 'action_' . $action;
49 $this->action = strtolower($action);
51 // check ticket. All actions need a ticket, unless they are considered to be safe (a safe action
52 // is an action that requires user interaction before something is actually done)
53 // all safe actions are in this array:
54 $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');
56 // the rest of the actions needs to be checked
57 $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');
59 if (!in_array($this->action, $aActionsNotToCheck))
61 if (!$manager->checkTicket())
62 $this->error(_ERROR_BADTICKET);
65 if (method_exists($this, $methodName))
66 call_user_func(array(&$this, $methodName));
68 $this->error(_BADACTION . " ($action)");
73 function action_showlogin() {
75 $this->action_login($error);
78 function action_login($msg = '', $passvars = 1) {
81 // skip to overview when allowed
82 if ($member->isLoggedIn() && $member->canLogin()) {
83 $this->action_overview();
89 echo '<h2>', _LOGIN ,'</h2>';
90 if ($msg) echo _MESSAGE , ': ', htmlspecialchars($msg);
93 <form action="index.php" method="post"><p>
94 <?php echo _LOGIN_NAME?>: <br /><input name="login" tabindex="10" />
96 <?php echo _LOGIN_PASSWORD?>: <br /><input name="password" tabindex="20" type="password" />
98 <input name="action" value="login" type="hidden" />
100 <input type="submit" value="<?php echo _LOGIN?>" tabindex="30" />
103 <input type="checkbox" value="1" name="shared" tabindex="40" id="shared" /><label for="shared"><?php echo _LOGIN_SHARED?></label>
104 <br /><a href="forgotpassword.html"><?php echo _LOGIN_FORGOT?></a>
106 <?php // pass through vars
108 $oldaction = postVar('oldaction');
109 if ( ($oldaction != 'logout') && ($oldaction != 'login') && $passvars ) {
116 <?php $this->pagefoot();
121 * provides a screen with the overview of the actions available
123 function action_overview($msg = '') {
129 echo _MESSAGE , ': ', $msg;
131 /* ---- add items ---- */
132 echo '<h2>' . _OVERVIEW_YRBLOGS . '</h2>';
134 $showAll = requestVar('showall');
136 if (($member->isAdmin()) && ($showAll == 'yes')) {
137 // Super-Admins have access to all blogs! (no add item support though)
138 $query = 'SELECT bnumber, bname, 1 as tadmin, burl, bshortname'
139 . ' FROM ' . sql_table('blog')
142 $query = 'SELECT bnumber, bname, tadmin, burl, bshortname'
143 . ' FROM ' . sql_table('blog') . ', ' . sql_table('team')
144 . ' WHERE tblog=bnumber and tmember=' . $member->getID()
147 $template['content'] = 'bloglist';
148 $template['superadmin'] = $member->isAdmin();
149 $amount = showlist($query,'table',$template);
151 if (($showAll != 'yes') && ($member->isAdmin())) {
152 $total = quickQuery('SELECT COUNT(*) as result FROM ' . sql_table('blog'));
153 if ($total > $amount)
154 echo '<p><a href="index.php?action=overview&showall=yes">Show all blogs</a></p>';
158 echo _OVERVIEW_NOBLOGS;
161 echo '<h2>' . _OVERVIEW_YRDRAFTS . '</h2>';
162 $query = 'SELECT ititle, inumber, bshortname'
163 . ' FROM ' . sql_table('item'). ', ' . sql_table('blog')
164 . ' WHERE iauthor='.$member->getID().' and iblog=bnumber and idraft=1';
165 $template['content'] = 'draftlist';
166 $amountdrafts = showlist($query, 'table', $template);
167 if ($amountdrafts == 0)
168 echo _OVERVIEW_NODRAFTS;
171 /* ---- user settings ---- */
172 echo '<h2>' . _OVERVIEW_YRSETTINGS . '</h2>';
174 echo '<li><a href="index.php?action=editmembersettings">' . _OVERVIEW_EDITSETTINGS. '</a></li>';
175 echo '<li><a href="index.php?action=browseownitems">' . _OVERVIEW_BROWSEITEMS.'</a></li>';
176 echo '<li><a href="index.php?action=browseowncomments">'._OVERVIEW_BROWSECOMM.'</a></li>';
179 /* ---- general settings ---- */
180 if ($member->isAdmin()) {
181 echo '<h2>' . _OVERVIEW_MANAGEMENT. '</h2>';
183 echo '<li><a href="index.php?action=manage">',_OVERVIEW_MANAGE,'</a></li>';
191 // returns a link to a weblog (takes BLOG object as parameter)
192 function bloglink(&$blog) {
193 return '<a href="'.htmlspecialchars($blog->getURL()).'" title="'._BLOGLIST_TT_VISIT.'">'.$blog->getName() .'</a>';
196 function action_manage($msg = '') {
199 $member->isAdmin() or $this->disallow();
203 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
206 echo '<p>' , _MESSAGE , ': ', $msg , '</p>';
209 echo '<h2>' . _MANAGE_GENERAL. '</h2>';
212 echo '<li><a href="index.php?action=createnewlog">'._OVERVIEW_NEWLOG.'</a></li>';
213 echo '<li><a href="index.php?action=settingsedit">'._OVERVIEW_SETTINGS.'</a></li>';
214 echo '<li><a href="index.php?action=usermanagement">'._OVERVIEW_MEMBERS.'</a></li>';
215 echo '<li><a href="index.php?action=actionlog">'._OVERVIEW_VIEWLOG.'</a></li>';
218 echo '<h2>' . _MANAGE_SKINS . '</h2>';
220 echo '<li><a href="index.php?action=skinoverview">'._OVERVIEW_SKINS.'</a></li>';
221 echo '<li><a href="index.php?action=templateoverview">'._OVERVIEW_TEMPLATES.'</a></li>';
222 echo '<li><a href="index.php?action=skinieoverview">'._OVERVIEW_SKINIMPORT.'</a></li>';
225 echo '<h2>' . _MANAGE_EXTRA . '</h2>';
227 echo '<li><a href="index.php?action=backupoverview">'._OVERVIEW_BACKUP.'</a></li>';
228 echo '<li><a href="index.php?action=pluginlist">'._OVERVIEW_PLUGINS.'</a></li>';
234 function action_itemlist($blogid = '') {
235 global $member, $manager;
238 $blogid = intRequestVar('blogid');
240 $member->teamRights($blogid) or $member->isAdmin() or $this->disallow();
243 $blog =& $manager->getBlog($blogid);
245 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
246 echo '<h2>' . _ITEMLIST_BLOG . ' ' . $this->bloglink($blog) . '</h2>';
249 if (postVar('start'))
250 $start = intPostVar('start');
255 echo '<p><a href="index.php?action=createitem&blogid='.$blogid.'">',_ITEMLIST_ADDNEW,'</a></p>';
257 // amount of items to show
258 if (postVar('amount'))
259 $amount = intPostVar('amount');
263 $search = postVar('search'); // search through items
265 $query = 'SELECT bshortname, cname, mname, ititle, ibody, inumber, idraft, itime'
266 . ' FROM ' . sql_table('item') . ', ' . sql_table('blog') . ', ' . sql_table('member') . ', ' . sql_table('category')
267 . ' WHERE iblog=bnumber and iauthor=mnumber and icat=catid and iblog=' . $blogid;
270 $query .= ' and ((ititle LIKE "%' . addslashes($search) . '%") or (ibody LIKE "%' . addslashes($search) . '%") or (imore LIKE "%' . addslashes($search) . '%"))';
272 // non-blog-admins can only edit/delete their own items
273 if (!$member->blogAdminRights($blogid))
274 $query .= ' and iauthor=' . $member->getID();
277 $query .= ' ORDER BY itime DESC'
278 . " LIMIT $start,$amount";
280 $template['content'] = 'itemlist';
281 $template['now'] = $blog->getCorrectTime(time());
284 $navList =& new NAVLIST('itemlist', $start, $amount, 0, 1000, $blogid, $search, 0);
285 $navList->showBatchList('item',$query,'table',$template);
292 function action_batchitem() {
293 global $member, $manager;
295 // check if logged in
296 $member->isLoggedIn() or $this->disallow();
298 // more precise check will be done for each performed operation
300 // get array of itemids from request
301 $selected = requestIntArray('batch');
302 $action = requestVar('batchaction');
304 // Show error when no items were selected
305 if (!is_array($selected) || sizeof($selected) == 0)
306 $this->error(_BATCH_NOSELECTION);
308 // On move: when no destination blog/category chosen, show choice now
309 $destCatid = intRequestVar('destcatid');
310 if (($action == 'move') && (!$manager->existsCategory($destCatid)))
311 $this->batchMoveSelectDestination('item',$selected);
313 // On delete: check if confirmation has been given
314 if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
315 $this->batchAskDeleteConfirmation('item',$selected);
319 echo '<a href="index.php?action=overview">(',_BACKHOME,')</a>';
320 echo '<h2>',_BATCH_ITEMS,'</h2>';
321 echo '<p>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b></p>';
325 // walk over all itemids and perform action
326 foreach ($selected as $itemid) {
327 $itemid = intval($itemid);
328 echo '<li>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b> ',_BATCH_ONITEM,' <b>', $itemid, '</b>...';
330 // perform action, display errors if needed
333 $error = $this->deleteOneItem($itemid);
336 $error = $this->moveOneItem($itemid, $destCatid);
339 $error = _BATCH_UNKNOWN . $action;
342 echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
347 echo '<b>',_BATCH_DONE,'</b>';
354 function action_batchcomment() {
357 // check if logged in
358 $member->isLoggedIn() or $this->disallow();
360 // more precise check will be done for each performed operation
362 // get array of itemids from request
363 $selected = requestIntArray('batch');
364 $action = requestVar('batchaction');
366 // Show error when no items were selected
367 if (!is_array($selected) || sizeof($selected) == 0)
368 $this->error(_BATCH_NOSELECTION);
370 // On delete: check if confirmation has been given
371 if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
372 $this->batchAskDeleteConfirmation('comment',$selected);
376 echo '<a href="index.php?action=overview">(',_BACKHOME,')</a>';
377 echo '<h2>',_BATCH_COMMENTS,'</h2>';
378 echo '<p>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b></p>';
381 // walk over all itemids and perform action
382 foreach ($selected as $commentid) {
383 $commentid = intval($commentid);
384 echo '<li>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b> ',_BATCH_ONCOMMENT,' <b>', $commentid, '</b>...';
386 // perform action, display errors if needed
389 $error = $this->deleteOneComment($commentid);
392 $error = _BATCH_UNKNOWN . $action;
395 echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
400 echo '<b>',_BATCH_DONE,'</b>';
407 function action_batchmember() {
410 // check if logged in and admin
411 ($member->isLoggedIn() && $member->isAdmin()) or $this->disallow();
413 // get array of itemids from request
414 $selected = requestIntArray('batch');
415 $action = requestVar('batchaction');
417 // Show error when no members selected
418 if (!is_array($selected) || sizeof($selected) == 0)
419 $this->error(_BATCH_NOSELECTION);
421 // On delete: check if confirmation has been given
422 if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
423 $this->batchAskDeleteConfirmation('member',$selected);
427 echo '<a href="index.php?action=usermanagement">(',_MEMBERS_BACKTOOVERVIEW,')</a>';
428 echo '<h2>',_BATCH_MEMBERS,'</h2>';
429 echo '<p>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b></p>';
432 // walk over all itemids and perform action
433 foreach ($selected as $memberid) {
434 $memberid = intval($memberid);
435 echo '<li>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b> ',_BATCH_ONMEMBER,' <b>', $memberid, '</b>...';
437 // perform action, display errors if needed
440 $error = $this->deleteOneMember($memberid);
444 sql_query('UPDATE ' . sql_table('member') . ' SET madmin=1 WHERE mnumber='.$memberid);
448 // there should always remain at least one super-admin
449 $r = sql_query('SELECT * FROM '.sql_table('member'). ' WHERE madmin=1 and mcanlogin=1');
450 if (mysql_num_rows($r) < 2)
451 $error = _ERROR_ATLEASTONEADMIN;
453 sql_query('UPDATE ' . sql_table('member') .' SET madmin=0 WHERE mnumber='.$memberid);
456 $error = _BATCH_UNKNOWN . $action;
459 echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
464 echo '<b>',_BATCH_DONE,'</b>';
472 function action_batchteam() {
475 $blogid = intRequestVar('blogid');
477 // check if logged in and admin
478 ($member->isLoggedIn() && $member->blogAdminRights($blogid)) or $this->disallow();
480 // get array of itemids from request
481 $selected = requestIntArray('batch');
482 $action = requestVar('batchaction');
484 // Show error when no members selected
485 if (!is_array($selected) || sizeof($selected) == 0)
486 $this->error(_BATCH_NOSELECTION);
488 // On delete: check if confirmation has been given
489 if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
490 $this->batchAskDeleteConfirmation('team',$selected);
494 echo '<p><a href="index.php?action=manageteam&blogid=',$blogid,'">(',_BACK,')</a></p>';
496 echo '<h2>',_BATCH_TEAM,'</h2>';
497 echo '<p>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b></p>';
500 // walk over all itemids and perform action
501 foreach ($selected as $memberid) {
502 $memberid = intval($memberid);
503 echo '<li>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b> ',_BATCH_ONTEAM,' <b>', $memberid, '</b>...';
505 // perform action, display errors if needed
508 $error = $this->deleteOneTeamMember($blogid, $memberid);
512 sql_query('UPDATE '.sql_table('team').' SET tadmin=1 WHERE tblog='.$blogid.' and tmember='.$memberid);
516 // there should always remain at least one admin
517 $r = sql_query('SELECT * FROM '.sql_table('team').' WHERE tadmin=1 and tblog='.$blogid);
518 if (mysql_num_rows($r) < 2)
519 $error = _ERROR_ATLEASTONEBLOGADMIN;
521 sql_query('UPDATE '.sql_table('team').' SET tadmin=0 WHERE tblog='.$blogid.' and tmember='.$memberid);
524 $error = _BATCH_UNKNOWN . $action;
527 echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
532 echo '<b>',_BATCH_DONE,'</b>';
541 function action_batchcategory() {
542 global $member, $manager;
544 // check if logged in
545 $member->isLoggedIn() or $this->disallow();
547 // more precise check will be done for each performed operation
549 // get array of itemids from request
550 $selected = requestIntArray('batch');
551 $action = requestVar('batchaction');
553 // Show error when no items were selected
554 if (!is_array($selected) || sizeof($selected) == 0)
555 $this->error(_BATCH_NOSELECTION);
557 // On move: when no destination blog chosen, show choice now
558 $destBlogId = intRequestVar('destblogid');
559 if (($action == 'move') && (!$manager->existsBlogID($destBlogId)))
560 $this->batchMoveCategorySelectDestination('category',$selected);
562 // On delete: check if confirmation has been given
563 if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
564 $this->batchAskDeleteConfirmation('category',$selected);
568 echo '<a href="index.php?action=overview">(',_BACKHOME,')</a>';
569 echo '<h2>',BATCH_CATEGORIES,'</h2>';
570 echo '<p>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b></p>';
573 // walk over all itemids and perform action
574 foreach ($selected as $catid) {
575 $catid = intval($catid);
576 echo '<li>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b> ',_BATCH_ONCATEGORY,' <b>', $catid, '</b>...';
578 // perform action, display errors if needed
581 $error = $this->deleteOneCategory($catid);
584 $error = $this->moveOneCategory($catid, $destBlogId);
587 $error = _BATCH_UNKNOWN . $action;
590 echo '<b>',($error ? 'Error: '.$error : _BATCH_SUCCESS),'</b>';
595 echo '<b>',_BATCH_DONE,'</b>';
601 function batchMoveSelectDestination($type, $ids) {
605 <h2><?php echo _MOVE_TITLE?></h2>
606 <form method="post" action="index.php"><div>
608 <input type="hidden" name="action" value="batch<?php echo $type?>" />
609 <input type="hidden" name="batchaction" value="move" />
611 $manager->addTicketHidden();
613 // insert selected item numbers
615 foreach ($ids as $id)
616 echo '<input type="hidden" name="batch[',($idx++),']" value="',intval($id),'" />';
618 // show blog/category selection list
619 $this->selectBlogCategory('destcatid');
624 <input type="submit" value="<?php echo _MOVE_BTN?>" onclick="return checkSubmit();" />
627 <?php $this->pagefoot();
631 function batchMoveCategorySelectDestination($type, $ids) {
635 <h2><?php echo _MOVECAT_TITLE?></h2>
636 <form method="post" action="index.php"><div>
638 <input type="hidden" name="action" value="batch<?php echo $type?>" />
639 <input type="hidden" name="batchaction" value="move" />
641 $manager->addTicketHidden();
643 // insert selected item numbers
645 foreach ($ids as $id)
646 echo '<input type="hidden" name="batch[',($idx++),']" value="',intval($id),'" />';
648 // show blog/category selection list
649 $this->selectBlog('destblogid');
654 <input type="submit" value="<?php echo _MOVECAT_BTN?>" onclick="return checkSubmit();" />
657 <?php $this->pagefoot();
661 function batchAskDeleteConfirmation($type, $ids) {
666 <h2><?php echo _BATCH_DELETE_CONFIRM?></h2>
667 <form method="post" action="index.php"><div>
669 <input type="hidden" name="action" value="batch<?php echo $type?>" />
670 <?php $manager->addTicketHidden() ?>
671 <input type="hidden" name="batchaction" value="delete" />
672 <input type="hidden" name="confirmation" value="yes" />
673 <?php // insert selected item numbers
675 foreach ($ids as $id)
676 echo '<input type="hidden" name="batch[',($idx++),']" value="',intval($id),'" />';
678 // add hidden vars for team & comment
681 echo '<input type="hidden" name="blogid" value="',intRequestVar('blogid'),'" />';
683 if ($type == 'comment')
685 echo '<input type="hidden" name="itemid" value="',intRequestVar('itemid'),'" />';
690 <input type="submit" value="<?php echo _BATCH_DELETE_CONFIRM_BTN?>" onclick="return checkSubmit();" />
693 <?php $this->pagefoot();
699 * Inserts a HTML select element with choices for all categories to which the current
702 function selectBlogCategory($name, $selected = 0, $tabindex = 0, $showNewCat = 0, $iForcedBlogInclude = -1) {
703 ADMIN::selectBlog($name, 'category', $selected, $tabindex, $showNewCat, $iForcedBlogInclude);
707 * Inserts a HTML select element with choices for all blogs to which the user has access
708 * mode = 'blog' => shows blognames and values are blogids
709 * mode = 'category' => show category names and values are catids
711 * @param $iForcedBlogInclude
712 * ID of a blog that always needs to be included, without checking if the member is on the blog team (-1 = none)
714 function selectBlog($name, $mode='blog', $selected = 0, $tabindex = 0, $showNewCat = 0, $iForcedBlogInclude = -1) {
715 global $member, $CONF;
717 // 0. get IDs of blogs to which member can post items (+ forced blog)
719 if ($iForcedBlogInclude != -1)
720 $aBlogIds[] = intval($iForcedBlogInclude);
722 if (($member->isAdmin()) && ($CONF['ShowAllBlogs']))
723 $queryBlogs = 'SELECT bnumber FROM '.sql_table('blog').' ORDER BY bname';
725 $queryBlogs = 'SELECT bnumber FROM '.sql_table('blog').', '.sql_table('team').' WHERE tblog=bnumber and tmember=' . $member->getID();
726 $rblogids = sql_query($queryBlogs);
727 while ($o = mysql_fetch_object($rblogids))
728 if ($o->bnumber != $iForcedBlogInclude)
729 $aBlogIds[] = intval($o->bnumber);
731 if (count($aBlogIds) == 0)
734 echo '<select name="',$name,'" tabindex="',$tabindex,'">';
736 // 1. select blogs (we'll create optiongroups)
737 // (only select those blogs that have the user on the team)
738 $queryBlogs = 'SELECT bnumber, bname FROM '.sql_table('blog').' WHERE bnumber in ('.implode(',',$aBlogIds).') ORDER BY bname';
739 $blogs = sql_query($queryBlogs);
740 if ($mode == 'category') {
741 if (mysql_num_rows($blogs) > 1)
744 while ($oBlog = mysql_fetch_object($blogs)) {
746 echo '<optgroup label="',htmlspecialchars($oBlog->bname),'">';
748 // show selection to create new category when allowed/wanted
750 // check if allowed to do so
751 if ($member->blogAdminRights($oBlog->bnumber))
752 echo '<option value="newcat-',$oBlog->bnumber,'">',_ADD_NEWCAT,'</option>';
755 // 2. for each category in that blog
756 $categories = sql_query('SELECT cname, catid FROM '.sql_table('category').' WHERE cblog=' . $oBlog->bnumber . ' ORDER BY cname ASC');
757 while ($oCat = mysql_fetch_object($categories)) {
758 if ($oCat->catid == $selected)
759 $selectText = ' selected="selected" ';
762 echo '<option value="',$oCat->catid,'" ', $selectText,'>',htmlspecialchars($oCat->cname),'</option>';
770 while ($oBlog = mysql_fetch_object($blogs)) {
771 echo '<option value="',$oBlog->bnumber,'"';
772 if ($oBlog->bnumber == $selected)
773 echo ' selected="selected"';
774 echo'>',htmlspecialchars($oBlog->bname),'</option>';
781 function action_browseownitems() {
786 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
787 echo '<h2>' . _ITEMLIST_YOUR. '</h2>';
790 if (postVar('start'))
791 $start = postVar('start');
795 // amount of items to show
796 if (postVar('amount'))
797 $amount = postVar('amount');
801 $search = postVar('search'); // search through items
803 $query = 'SELECT bshortname, cname, mname, ititle, ibody, idraft, inumber, itime'
804 . ' FROM '.sql_table('item').', '.sql_table('blog') . ', '.sql_table('member') . ', '.sql_table('category')
805 . ' WHERE iauthor='. $member->getID() .' and iauthor=mnumber and iblog=bnumber and icat=catid';
808 $query .= ' and ((ititle LIKE "%' . addslashes($search) . '%") or (ibody LIKE "%' . addslashes($search) . '%") or (imore LIKE "%' . addslashes($search) . '%"))';
810 $query .= ' ORDER BY itime DESC'
811 . " LIMIT $start,$amount";
813 $template['content'] = 'itemlist';
814 $template['now'] = time();
816 $navList =& new NAVLIST('browseownitems', $start, $amount, 0, 1000, $blogid, $search, 0);
817 $navList->showBatchList('item',$query,'table',$template);
824 * Show all the comments for a given item
826 function action_itemcommentlist($itemid = '') {
830 $itemid = intRequestVar('itemid');
832 // only allow if user is allowed to alter item
833 $member->canAlterItem($itemid) or $this->disallow();
835 $blogid = getBlogIdFromItemId($itemid);
840 if (postVar('start'))
841 $start = postVar('start');
845 // amount of items to show
846 if (postVar('amount'))
847 $amount = postVar('amount');
851 $search = postVar('search');
853 echo '<p>(<a href="index.php?action=itemlist&blogid=',$blogid,'">',_BACKTOOVERVIEW,'</a>)</p>';
854 echo '<h2>',_COMMENTS,'</h2>';
856 $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;
859 $query .= ' and cbody LIKE "%' . addslashes($search) . '%"';
861 $query .= ' ORDER BY ctime ASC'
862 . " LIMIT $start,$amount";
864 $template['content'] = 'commentlist';
865 $template['canAddBan'] = $member->blogAdminRights(getBlogIDFromItemID($itemid));
867 $navList =& new NAVLIST('itemcommentlist', $start, $amount, 0, 1000, 0, $search, $itemid);
868 $navList->showBatchList('comment',$query,'table',$template,_NOCOMMENTS);
874 * Browse own comments
876 function action_browseowncomments() {
880 if (postVar('start'))
881 $start = postVar('start');
885 // amount of items to show
886 if (postVar('amount'))
887 $amount = postVar('amount');
891 $search = postVar('search');
894 $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();
897 $query .= ' and cbody LIKE "%' . addslashes($search) . '%"';
899 $query .= ' ORDER BY ctime DESC'
900 . " LIMIT $start,$amount";
904 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
905 echo '<h2>', _COMMENTS_YOUR ,'</h2>';
907 $template['content'] = 'commentlist';
908 $template['canAddBan'] = 0; // doesn't make sense to allow banning yourself
910 $navList =& new NAVLIST('browseowncomments', $start, $amount, 0, 1000, 0, $search, 0);
911 $navList->showBatchList('comment',$query,'table',$template,_NOCOMMENTS_YOUR);
917 * Browse all comments for a weblog
919 function action_blogcommentlist($blogid = '')
921 global $member, $manager;
924 $blogid = intRequestVar('blogid');
926 $blogid = intval($blogid);
928 $member->teamRights($blogid) or $member->isAdmin() or $this->disallow();
931 if (postVar('start'))
932 $start = postVar('start');
936 // amount of items to show
937 if (postVar('amount'))
938 $amount = postVar('amount');
942 $search = postVar('search'); // search through comments
945 $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);
948 $query .= ' and cbody LIKE "%' . addslashes($search) . '%"';
951 $query .= ' ORDER BY ctime DESC'
952 . " LIMIT $start,$amount";
955 $blog =& $manager->getBlog($blogid);
959 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
960 echo '<h2>', _COMMENTS_BLOG , ' ' , $this->bloglink($blog), '</h2>';
962 $template['content'] = 'commentlist';
963 $template['canAddBan'] = $member->blogAdminRights($blogid);
965 $navList =& new NAVLIST('blogcommentlist', $start, $amount, 0, 1000, $blogid, $search, 0);
966 $navList->showBatchList('comment',$query,'table',$template, _NOCOMMENTS_BLOG);
972 * Provide a page to item a new item to the given blog
974 function action_createitem() {
975 global $member, $manager;
977 $blogid = intRequestVar('blogid');
980 $member->teamRights($blogid) or $this->disallow();
982 $memberid = $member->getID();
984 $blog =& $manager->getBlog($blogid);
988 // generate the add-item form
989 $formfactory =& new PAGEFACTORY($blogid);
990 $formfactory->createAddForm('admin');
995 function action_itemedit() {
996 global $member, $manager;
998 $itemid = intRequestVar('itemid');
1000 // only allow if user is allowed to alter item
1001 $member->canAlterItem($itemid) or $this->disallow();
1003 $item =& $manager->getItem($itemid,1,1);
1004 $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
1006 $manager->notify('PrepareItemForEdit', array('item' => &$item));
1008 if ($blog->convertBreaks()) {
1009 $item['body'] = removeBreaks($item['body']);
1010 $item['more'] = removeBreaks($item['more']);
1013 // form to edit blog items
1015 $formfactory =& new PAGEFACTORY($blog->getID());
1016 $formfactory->createEditForm('admin',$item);
1020 function action_itemupdate() {
1021 global $member, $manager, $CONF;
1023 $itemid = intRequestVar('itemid');
1024 $catid = postVar('catid');
1026 // only allow if user is allowed to alter item
1027 $member->canUpdateItem($itemid, $catid) or $this->disallow();
1029 $actiontype = postVar('actiontype');
1031 // delete actions are handled by itemdelete (which has confirmation)
1032 if ($actiontype == 'delete') {
1033 $this->action_itemdelete();
1037 $body = postVar('body');
1038 $title = postVar('title');
1039 $more = postVar('more');
1040 $closed = intPostVar('closed');
1042 // default action = add now
1044 $actiontype='addnow';
1046 // create new category if needed
1047 if (strstr($catid,'newcat')) {
1049 list($blogid) = sscanf($catid,"newcat-%d");
1052 $blog =& $manager->getBlog($blogid);
1053 $catid = $blog->createNewCategory();
1055 // show error when sth goes wrong
1057 $this->doError(_ERROR_CATCREATEFAIL);
1061 set some variables based on actiontype
1064 draft items -> addnow, addfuture, adddraft, delete
1065 non-draft items -> edit, changedate, delete
1068 $timestamp: set to a nonzero value for future dates or date changes
1069 $wasdraft: set to 1 when the item used to be a draft item
1070 $publish: set to 1 when the edited item is not a draft
1072 switch ($actiontype) {
1081 $timestamp = mktime(postVar('hour'), postVar('minutes'), 0, postVar('month'), postVar('day'), postVar('year'));
1089 $timestamp = mktime(postVar('hour'), postVar('minutes'), 0, postVar('month'), postVar('day'), postVar('year'));
1100 // edit the item for real
1101 ITEM::update($itemid, $catid, $title, $body, $more, $closed, $wasdraft, $publish, $timestamp);
1103 $blogid = getBlogIDFromItemID($itemid);
1104 $blog =& $manager->getBlog($blogid);
1105 if (!$closed && $publish && $wasdraft && $blog->pingUserland()) {
1106 $this->action_sendping($blogid);
1110 // show category edit window when we created a new category
1111 // ($catid will then be a new category ID, while postVar('catid') will be 'newcat-x')
1112 if ($catid != intPostVar('catid')) {
1113 $this->action_categoryedit(
1116 $CONF['AdminURL'] . 'index.php?action=itemlist&blogid=' . getBlogIDFromItemID($itemid)
1119 // TODO: set start item correctly for itemlist
1120 $this->action_itemlist(getBlogIDFromItemID($itemid));
1124 function action_itemdelete() {
1125 global $member, $manager;
1127 $itemid = intRequestVar('itemid');
1129 // only allow if user is allowed to alter item
1130 $member->canAlterItem($itemid) or $this->disallow();
1132 if (!$manager->existsItem($itemid,1,1))
1133 $this->error(_ERROR_NOSUCHITEM);
1135 $item =& $manager->getItem($itemid,1,1);
1136 $title = htmlspecialchars(strip_tags($item['title']));
1137 $body = strip_tags($item['body']);
1138 $body = htmlspecialchars(shorten($body,300,'...'));
1142 <h2><?php echo _DELETE_CONFIRM?></h2>
1144 <p><?php echo _CONFIRMTXT_ITEM?></p>
1147 <b>"<?php echo $title ?>"</b>
1152 <form method="post" action="index.php"><div>
1153 <input type="hidden" name="action" value="itemdeleteconfirm" />
1154 <?php $manager->addTicketHidden() ?>
1155 <input type="hidden" name="itemid" value="<?php echo $itemid; ?>" />
1156 <input type="submit" value="<?php echo _DELETE_CONFIRM_BTN?>" tabindex="10" />
1162 function action_itemdeleteconfirm() {
1165 $itemid = intRequestVar('itemid');
1167 // only allow if user is allowed to alter item
1168 $member->canAlterItem($itemid) or $this->disallow();
1171 $blogid = getBlogIdFromItemId($itemid);
1173 // delete item (note: some checks will be performed twice)
1174 $this->deleteOneItem($itemid);
1176 $this->action_itemlist($blogid);
1179 // deletes one item and returns error if something goes wrong
1180 function deleteOneItem($itemid) {
1181 global $member, $manager;
1183 // only allow if user is allowed to alter item (also checks if itemid exists)
1184 if (!$member->canAlterItem($itemid))
1185 return _ERROR_DISALLOWED;
1187 $manager->loadClass('ITEM');
1188 ITEM::delete($itemid);
1191 function action_itemmove() {
1192 global $member, $manager;
1194 $itemid = intRequestVar('itemid');
1196 // only allow if user is allowed to alter item
1197 $member->canAlterItem($itemid) or $this->disallow();
1199 $item =& $manager->getItem($itemid,1,1);
1203 <h2><?php echo _MOVE_TITLE?></h2>
1204 <form method="post" action="index.php"><div>
1205 <input type="hidden" name="action" value="itemmoveto" />
1206 <input type="hidden" name="itemid" value="<?php echo $itemid; ?>" />
1210 $manager->addTicketHidden();
1211 $this->selectBlogCategory('catid',$item['catid'],10,1);
1214 <input type="submit" value="<?php echo _MOVE_BTN?>" tabindex="10000" onclick="return checkSubmit();" />
1220 function action_itemmoveto() {
1221 global $member, $manager;
1223 $itemid = intRequestVar('itemid');
1224 $catid = requestVar('catid');
1226 // create new category if needed
1227 if (strstr($catid,'newcat')) {
1229 list($blogid) = sscanf($catid,'newcat-%d');
1232 $blog =& $manager->getBlog($blogid);
1233 $catid = $blog->createNewCategory();
1235 // show error when sth goes wrong
1237 $this->doError(_ERROR_CATCREATEFAIL);
1240 // only allow if user is allowed to alter item
1241 $member->canUpdateItem($itemid, $catid) or $this->disallow();
1243 ITEM::move($itemid, $catid);
1245 if ($catid != intRequestVar('catid'))
1246 $this->action_categoryedit($catid, $blog->getID());
1248 $this->action_itemlist(getBlogIDFromCatID($catid));
1252 * Moves one item to a given category (category existance should be checked by caller)
1253 * errors are returned
1255 function moveOneItem($itemid, $destCatid) {
1258 // only allow if user is allowed to move item
1259 if (!$member->canUpdateItem($itemid, $destCatid))
1260 return _ERROR_DISALLOWED;
1262 ITEM::move($itemid, $destCatid);
1266 * Adds a item to the chosen blog
1268 function action_additem() {
1269 global $member, $manager, $CONF;
1271 $manager->loadClass('ITEM');
1273 $result = ITEM::createFromRequest();
1275 if ($result['status'] == 'error')
1276 $this->error($result['message']);
1278 $blogid = getBlogIDFromItemID($result['itemid']);
1279 $blog =& $manager->getBlog($blogid);
1281 $pingUrl = $manager->addTicketToUrl($CONF['AdminURL'] . 'index.php?action=sendping&blogid=' . intval($blogid));
1283 if ($result['status'] == 'newcategory')
1284 $this->action_categoryedit(
1287 $blog->pingUserland() ? $pingUrl : ''
1289 elseif ((postVar('actiontype') == 'addnow') && $blog->pingUserland())
1290 $this->action_sendping($blogid);
1292 $this->action_itemlist($blogid);
1296 * Shows a window that says we're about to ping weblogs.com.
1297 * immediately refresh to the real pinging page, which will
1298 * show an error, or redirect to the blog.
1300 * @param $blogid ID of blog for which ping needs to be sent out
1302 function action_sendping($blogid = -1) {
1303 global $member, $manager;
1306 $blogid = intRequestVar('blogid');
1308 $member->isLoggedIn() or $this->disallow();
1310 $rawPingUrl = $manager->addTicketToUrl('index.php?action=rawping&blogid=' . intval($blogid));
1312 $this->pagehead('<meta http-equiv="refresh" content="1; url='.htmlspecialchars($rawPingUrl).'" />');
1314 <h2>Site Updated, Now pinging weblogs.com</h2>
1317 Pinging weblogs.com! This can a while...
1319 When the ping is complete (and successfull), your weblog will show up in the weblogs.com updates list.
1323 If you aren't automatically passed through, <a href="index.php?action=rawping&blogid=<?php echo $blogid?>">try again</a>
1325 <?php $this->pagefoot();
1328 // ping to Weblogs.com
1329 // sends the real ping (can take up to 10 seconds!)
1330 function action_rawping() {
1334 $blogid = intRequestVar('blogid');
1335 $blog =& $manager->getBlog($blogid);
1337 $result = $blog->sendUserlandPing();
1343 <h2>Ping Results</h2>
1345 <p>The following message was returned by weblogs.com:</p>
1347 <div class='note'><?php echo $result ?></div>
1350 <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>
1351 <li><a href="<?php echo $blog->getURL()?>">Visit your own site</a></li>
1354 <?php $this->pagefoot();
1358 * Allows to edit previously made comments
1360 function action_commentedit() {
1361 global $member, $manager;
1363 $commentid = intRequestVar('commentid');
1365 $member->canAlterComment($commentid) or $this->disallow();
1367 $comment = COMMENT::getComment($commentid);
1369 $manager->notify('PrepareCommentForEdit',array('comment' => &$comment));
1371 // change <br /> to \n
1372 $comment['body'] = str_replace('<br />','',$comment['body']);
1374 $comment['body'] = eregi_replace("<a href=['\"]([^'\"]+)['\"]( rel=\"nofollow\")?>[^<]*</a>","\\1",$comment['body']);
1379 <h2><?php echo _EDITC_TITLE?></h2>
1381 <form action="index.php" method="post"><div>
1383 <input type="hidden" name="action" value="commentupdate" />
1384 <?php $manager->addTicketHidden(); ?>
1385 <input type="hidden" name="commentid" value="<?php echo $commentid; ?>" />
1387 <th colspan="2"><?php echo _EDITC_TITLE?></th>
1389 <td><?php echo _EDITC_WHO?></td>
1391 <?php if ($comment['member'])
1392 echo $comment['member'] . " (" . _EDITC_MEMBER . ")";
1394 echo $comment['user'] . " (" . _EDITC_NONMEMBER . ")";
1398 <td><?php echo _EDITC_WHEN?></td>
1399 <td><?php echo date("Y-m-d @ H:i",$comment['timestamp']); ?></td>
1401 <td><?php echo _EDITC_HOST?></td>
1402 <td><?php echo $comment['host']; ?></td>
1404 <td><?php echo _EDITC_TEXT?></td>
1406 <textarea name="body" tabindex="10" rows="10" cols="50"><?php // htmlspecialchars not needed (things should be escaped already)
1407 echo $comment['body'];
1411 <td><?php echo _EDITC_EDIT?></td>
1412 <td><input type="submit" tabindex="20" value="<?php echo _EDITC_EDIT?>" onclick="return checkSubmit();" /></td>
1420 function action_commentupdate() {
1421 global $member, $manager;
1423 $commentid = intRequestVar('commentid');
1425 $member->canAlterComment($commentid) or $this->disallow();
1427 $body = postVar('body');
1429 // intercept words that are too long
1430 if (eregi("[a-zA-Z0-9|\.,;:!\?=\/\\]{90,90}",$body) != false)
1431 $this->error(_ERROR_COMMENT_LONGWORD);
1434 if (strlen($body)<3)
1435 $this->error(_ERROR_COMMENT_NOCOMMENT);
1436 if (strlen($body)>5000)
1437 $this->error(_ERROR_COMMENT_TOOLONG);
1441 $body = COMMENT::prepareBody($body);
1444 $manager->notify('PreUpdateComment',array('body' => &$body));
1446 $query = 'UPDATE '.sql_table('comment')
1447 . " SET cbody='" .addslashes($body). "'"
1448 . " WHERE cnumber=" . $commentid;
1452 $res = sql_query('SELECT citem FROM '.sql_table('comment').' WHERE cnumber=' . $commentid);
1453 $o = mysql_fetch_object($res);
1454 $itemid = $o->citem;
1456 if ($member->canAlterItem($itemid))
1457 $this->action_itemcommentlist($itemid);
1459 $this->action_browseowncomments();
1463 function action_commentdelete() {
1464 global $member, $manager;
1466 $commentid = intRequestVar('commentid');
1468 $member->canAlterComment($commentid) or $this->disallow();
1470 $comment = COMMENT::getComment($commentid);
1472 $body = strip_tags($comment['body']);
1473 $body = htmlspecialchars(shorten($body, 300, '...'));
1475 if ($comment['member'])
1476 $author = $comment['member'];
1478 $author = $comment['user'];
1483 <h2><?php echo _DELETE_CONFIRM?></h2>
1485 <p><?php echo _CONFIRMTXT_COMMENT?></p>
1488 <b><?php echo _EDITC_WHO?>:</b> <?php echo $author ?>
1490 <b><?php echo _EDITC_TEXT?>:</b> <?php echo $body ?>
1493 <form method="post" action="index.php"><div>
1494 <input type="hidden" name="action" value="commentdeleteconfirm" />
1495 <?php $manager->addTicketHidden() ?>
1496 <input type="hidden" name="commentid" value="<?php echo $commentid; ?>" />
1497 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
1503 function action_commentdeleteconfirm() {
1506 $commentid = intRequestVar('commentid');
1508 // get item id first
1509 $res = sql_query('SELECT citem FROM '.sql_table('comment') .' WHERE cnumber=' . $commentid);
1510 $o = mysql_fetch_object($res);
1511 $itemid = $o->citem;
1513 $error = $this->deleteOneComment($commentid);
1515 $this->doError($error);
1517 if ($member->canAlterItem($itemid))
1518 $this->action_itemcommentlist($itemid);
1520 $this->action_browseowncomments();
1523 function deleteOneComment($commentid) {
1524 global $member, $manager;
1526 $commentid = intval($commentid);
1528 if (!$member->canAlterComment($commentid))
1529 return _ERROR_DISALLOWED;
1531 $manager->notify('PreDeleteComment', array('commentid' => $commentid));
1533 // delete the comments associated with the item
1534 $query = 'DELETE FROM '.sql_table('comment').' WHERE cnumber=' . $commentid;
1537 $manager->notify('PostDeleteComment', array('commentid' => $commentid));
1543 * Usermanagement main
1545 function action_usermanagement() {
1546 global $member, $manager;
1549 $member->isAdmin() or $this->disallow();
1553 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
1555 echo '<h2>' . _MEMBERS_TITLE .'</h2>';
1557 echo '<h3>' . _MEMBERS_CURRENT .'</h3>';
1559 // show list of members with actions
1561 . ' FROM '.sql_table('member');
1562 $template['content'] = 'memberlist';
1563 $template['tabindex'] = 10;
1565 $batch =& new BATCH('member');
1566 $batch->showlist($query,'table',$template);
1568 echo '<h3>' . _MEMBERS_NEW .'</h3>';
1570 <form method="post" action="index.php"><div>
1572 <input type="hidden" name="action" value="memberadd" />
1573 <?php $manager->addTicketHidden() ?>
1577 <th colspan="2"><?php echo _MEMBERS_NEW?></th>
1579 <td><?php echo _MEMBERS_DISPLAY?> <?php help('shortnames');?>
1580 <br /><small>(This is the name used to logon)</small>
1582 <td><input tabindex="10010" name="name" size="16" maxlength="16" /></td>
1584 <td><?php echo _MEMBERS_REALNAME?></td>
1585 <td><input name="realname" tabindex="10020" size="40" maxlength="60" /></td>
1587 <td><?php echo _MEMBERS_PWD?></td>
1588 <td><input name="password" tabindex="10030" size="16" maxlength="40" type="password" /></td>
1590 <td><?php echo _MEMBERS_REPPWD?></td>
1591 <td><input name="repeatpassword" tabindex="10035" size="16" maxlength="40" type="password" /></td>
1593 <td><?php echo _MEMBERS_EMAIL?></td>
1594 <td><input name="email" tabindex="10040" size="40" maxlength="60" /></td>
1596 <td><?php echo _MEMBERS_URL?></td>
1597 <td><input name="url" tabindex="10050" size="40" maxlength="100" /></td>
1599 <td><?php echo _MEMBERS_SUPERADMIN?> <?php help('superadmin'); ?></td>
1600 <td><?php $this->input_yesno('admin',0,10060); ?> </td>
1602 <td><?php echo _MEMBERS_CANLOGIN?> <?php help('canlogin'); ?></td>
1603 <td><?php $this->input_yesno('canlogin',1,10070); ?></td>
1605 <td><?php echo _MEMBERS_NOTES?></td>
1606 <td><input name="notes" maxlength="100" size="40" tabindex="10080" /></td>
1608 <td><?php echo _MEMBERS_NEW?></td>
1609 <td><input type="submit" value="<?php echo _MEMBERS_NEW_BTN?>" tabindex="10090" onclick="return checkSubmit();" /></td>
1618 * Edit member settings
1620 function action_memberedit() {
1621 $this->action_editmembersettings(intRequestVar('memberid'));
1623 function action_editmembersettings($memberid = '') {
1624 global $member, $manager, $CONF;
1626 if ($memberid == '')
1627 $memberid = $member->getID();
1630 ($member->getID() == $memberid) or $member->isAdmin() or $this->disallow();
1632 $extrahead = '<script type="text/javascript" src="javascript/numbercheck.js"></script>';
1633 $this->pagehead($extrahead);
1635 // show message to go back to member overview (only for admins)
1636 if ($member->isAdmin())
1637 echo '<a href="index.php?action=usermanagement">(' ._MEMBERS_BACKTOOVERVIEW. ')</a>';
1639 echo '<a href="index.php?action=overview">(' ._BACKHOME. ')</a>';
1641 echo '<h2>' . _MEMBERS_EDIT . '</h2>';
1643 $mem = MEMBER::createFromID($memberid);
1646 <form method="post" action="index.php"><div>
1648 <input type="hidden" name="action" value="changemembersettings" />
1649 <input type="hidden" name="memberid" value="<?php echo $memberid; ?>" />
1650 <?php $manager->addTicketHidden() ?>
1653 <th colspan="2"><?php echo _MEMBERS_EDIT?></th>
1655 <td><?php echo _MEMBERS_DISPLAY?> <?php help('shortnames');?>
1656 <br /><small><?php echo _MEMBERS_DISPLAY_INFO?></small>
1659 <?php if ($CONF['AllowLoginEdit'] || $member->isAdmin()) { ?>
1660 <input name="name" tabindex="10" maxlength="16" size="16" value="<?php echo htmlspecialchars($mem->getDisplayName()); ?>" />
1662 echo htmlspecialchars($member->getDisplayName());
1667 <td><?php echo _MEMBERS_REALNAME?></td>
1668 <td><input name="realname" tabindex="20" maxlength="60" size="40" value="<?php echo htmlspecialchars($mem->getRealName()); ?>" /></td>
1670 <?php if ($CONF['AllowLoginEdit'] || $member->isAdmin()) { ?>
1671 <td><?php echo _MEMBERS_PWD?></td>
1672 <td><input type="password" tabindex="30" maxlength="40" size="16" name="password" /></td>
1674 <td><?php echo _MEMBERS_REPPWD?></td>
1675 <td><input type="password" tabindex="35" maxlength="40" size="16" name="repeatpassword" /></td>
1678 <td><?php echo _MEMBERS_EMAIL?>
1679 <br /><small><?php echo _MEMBERS_EMAIL_EDIT?></small>
1681 <td><input name="email" tabindex="40" size="40" maxlength="60" value="<?php echo htmlspecialchars($mem->getEmail()); ?>" /></td>
1683 <td><?php echo _MEMBERS_URL?></td>
1684 <td><input name="url" tabindex="50" size="40" maxlength="100" value="<?php echo htmlspecialchars($mem->getURL()); ?>" /></td>
1685 <?php // only allow to change this by super-admins
1686 // we don't want normal users to 'upgrade' themselves to super-admins, do we? ;-)
1687 if ($member->isAdmin()) {
1690 <td><?php echo _MEMBERS_SUPERADMIN?> <?php help('superadmin'); ?></td>
1691 <td><?php $this->input_yesno('admin',$mem->isAdmin(),60); ?></td>
1693 <td><?php echo _MEMBERS_CANLOGIN?> <?php help('canlogin'); ?></td>
1694 <td><?php $this->input_yesno('canlogin',$mem->canLogin(),70); ?></td>
1697 <td><?php echo _MEMBERS_NOTES?></td>
1698 <td><input name="notes" tabindex="80" size="40" maxlength="100" value="<?php echo htmlspecialchars($mem->getNotes()); ?>" /></td>
1700 <td><?php echo _MEMBERS_DEFLANG?> <?php help('language'); ?>
1704 <select name="deflang" tabindex="85">
1705 <option value=""><?php echo _MEMBERS_USESITELANG?></option>
1706 <?php // show a dropdown list of all available languages
1708 $dirhandle = opendir($DIR_LANG);
1709 while ($filename = readdir($dirhandle)) {
1710 if (ereg("^(.*)\.php$",$filename,$matches)) {
1711 $name = $matches[1];
1712 echo "<option value='$name'";
1713 if ($name == $mem->getLanguage())
1714 echo " selected='selected'";
1715 echo ">$name</option>";
1718 closedir($dirhandle);
1727 $this->_insertPluginOptions('member',$memberid);
1730 <th colspan="2"><?php echo _MEMBERS_EDIT ?></th>
1732 <td><?php echo _MEMBERS_EDIT?></td>
1733 <td><input type="submit" tabindex="90" value="<?php echo _MEMBERS_EDIT_BTN?>" onclick="return checkSubmit();" /></td>
1739 echo '<h3>',_PLUGINS_EXTRA,'</h3>';
1742 'MemberSettingsFormExtras',
1752 function action_changemembersettings() {
1753 global $member, $CONF, $manager;
1755 $memberid = intRequestVar('memberid');
1758 ($member->getID() == $memberid) or $member->isAdmin() or $this->disallow();
1760 $name = trim(postVar('name'));
1761 $realname = trim(postVar('realname'));
1762 $password = postVar('password');
1763 $repeatpassword = postVar('repeatpassword');
1764 $email = postVar('email');
1765 $url = postVar('url');
1767 // Sometimes user didn't prefix the URL with http://, this cause a malformed URL. Let's fix it.
1768 if (!eregi("^https?://", $url))
1769 $url = "http://".$url;
1771 $admin = postVar('admin');
1772 $canlogin = postVar('canlogin');
1773 $notes = postVar('notes');
1774 $deflang = postVar('deflang');
1776 $mem = MEMBER::createFromID($memberid);
1778 if ($CONF['AllowLoginEdit'] || $member->isAdmin()) {
1780 if (!isValidDisplayName($name))
1781 $this->error(_ERROR_BADNAME);
1783 if (($name != $mem->getDisplayName()) && MEMBER::exists($name))
1784 $this->error(_ERROR_NICKNAMEINUSE);
1786 if ($password != $repeatpassword)
1787 $this->error(_ERROR_PASSWORDMISMATCH);
1789 if ($password && (strlen($password) < 6))
1790 $this->error(_ERROR_PASSWORDTOOSHORT);
1793 if (!isValidMailAddress($email))
1794 $this->error(_ERROR_BADMAILADDRESS);
1798 $this->error(_ERROR_REALNAMEMISSING);
1800 if (($deflang != '') && (!checkLanguage($deflang)))
1801 $this->error(_ERROR_NOSUCHLANGUAGE);
1803 // check if there will remain at least one site member with both the logon and admin rights
1804 // (check occurs when taking away one of these rights from such a member)
1805 if ( (!$admin && $mem->isAdmin() && $mem->canLogin())
1806 || (!$canlogin && $mem->isAdmin() && $mem->canLogin())
1809 $r = sql_query('SELECT * FROM '.sql_table('member').' WHERE madmin=1 and mcanlogin=1');
1810 if (mysql_num_rows($r) < 2)
1811 $this->error(_ERROR_ATLEASTONEADMIN);
1814 if ($CONF['AllowLoginEdit'] || $member->isAdmin()) {
1815 $mem->setDisplayName($name);
1817 $mem->setPassword($password);
1821 $mem->setPassword($password);
1823 $oldEmail = $mem->getEmail();
1825 $mem->setRealName($realname);
1826 $mem->setEmail($email);
1828 $mem->setNotes($notes);
1829 $mem->setLanguage($deflang);
1832 // only allow super-admins to make changes to the admin status
1833 if ($member->isAdmin()) {
1834 $mem->setAdmin($admin);
1835 $mem->setCanLogin($canlogin);
1841 // if email changed, generate new password
1842 if ($oldEmail != $mem->getEmail())
1844 $mem->sendActivationLink('addresschange', $oldEmail);
1846 $mem->newCookieKey();
1848 $this->action_login(_MSG_ACTIVATION_SENT, 0);
1853 // store plugin options
1854 $aOptions = requestArray('plugoption');
1855 NucleusPlugin::_applyPluginOptions($aOptions);
1856 $manager->notify('PostPluginOptionsUpdate',array('context' => 'member', 'memberid' => $memberid, 'member' => &$mem));
1858 if ( ( $mem->getID() == $member->getID() )
1859 && ( $newpass || ( $mem->getDisplayName() != $member->getDisplayName() ) )
1861 $mem->newCookieKey();
1863 $this->action_login(_MSG_LOGINAGAIN, 0);
1865 $this->action_overview(_MSG_SETTINGSCHANGED);
1869 function action_memberadd() {
1873 $member->isAdmin() or $this->disallow();
1875 if (postVar('password') != postVar('repeatpassword'))
1876 $this->error(_ERROR_PASSWORDMISMATCH);
1877 if (strlen(postVar('password')) < 6)
1878 $this->error(_ERROR_PASSWORDTOOSHORT);
1880 $res = MEMBER::create(postVar('name'), postVar('realname'), postVar('password'), postVar('email'), postVar('url'), postVar('admin'), postVar('canlogin'), postVar('notes'));
1884 $this->action_usermanagement();
1888 * Account activation
1892 function action_activate() {
1894 $key = getVar('key');
1895 $this->_showActivationPage($key);
1898 function _showActivationPage($key, $message = '')
1902 // clean up old activation keys
1903 MEMBER::cleanupActivationTable();
1905 // get activation info
1906 $info = MEMBER::getActivationInfo($key);
1909 $this->error(_ERROR_ACTIVATE);
1911 $mem = MEMBER::createFromId($info->vmember);
1914 $this->error(_ERROR_ACTIVATE);
1918 $bNeedsPasswordChange = true;
1920 switch ($info->vtype)
1923 $title = _ACTIVATE_FORGOT_TITLE;
1924 $text = _ACTIVATE_FORGOT_TEXT;
1927 $title = _ACTIVATE_REGISTER_TITLE;
1928 $text = _ACTIVATE_REGISTER_TEXT;
1930 case 'addresschange':
1931 $title = _ACTIVATE_CHANGE_TITLE;
1932 $text = _ACTIVATE_CHANGE_TEXT;
1933 $bNeedsPasswordChange = false;
1934 MEMBER::activate($key);
1939 'memberName' => htmlspecialchars($mem->getDisplayName())
1941 $title = TEMPLATE::fill($title, $aVars);
1942 $text = TEMPLATE::fill($text, $aVars);
1946 echo '<h2>' , $title, '</h2>';
1947 echo '<p>' , $text, '</p>';
1951 echo '<p class="error">',$message,'</p>';
1954 if ($bNeedsPasswordChange)
1957 <div><form action="index.php" method="post">
1959 <input type="hidden" name="action" value="activatesetpwd" />
1960 <?php $manager->addTicketHidden() ?>
1961 <input type="hidden" name="key" value="<?php echo htmlspecialchars($key) ?>" />
1964 <td><?php echo _MEMBERS_PWD?></td>
1965 <td><input type="password" maxlength="40" size="16" name="password" /></td>
1967 <td><?php echo _MEMBERS_REPPWD?></td>
1968 <td><input type="password" maxlength="40" size="16" name="repeatpassword" /></td>
1972 $manager->notify('FormExtra', array('type' => 'activation', 'member' => $mem));
1976 <td><?php echo _MEMBERS_SETPWD ?></td>
1977 <td><input type='submit' value='<?php echo _MEMBERS_SETPWD_BTN ?>' /></td>
1992 * Account activation - set password part
1996 function action_activatesetpwd() {
1998 $key = postVar('key');
2000 // clean up old activation keys
2001 MEMBER::cleanupActivationTable();
2003 // get activation info
2004 $info = MEMBER::getActivationInfo($key);
2006 if (!$info || ($info->type == 'addresschange'))
2007 return $this->_showActivationPage($key, _ERROR_ACTIVATE);
2009 $mem = MEMBER::createFromId($info->vmember);
2012 return $this->_showActivationPage($key, _ERROR_ACTIVATE);
2014 $password = postVar('password');
2015 $repeatpassword = postVar('repeatpassword');
2017 if ($password != $repeatpassword)
2018 return $this->_showActivationPage($key, _ERROR_PASSWORDMISMATCH);
2020 if ($password && (strlen($password) < 6))
2021 return $this->_showActivationPage($key, _ERROR_PASSWORDTOOSHORT);
2025 $manager->notify('ValidateForm', array('type' => 'activation', 'member' => $mem, 'error' => &$error));
2027 return $this->_showActivationPage($key, $error);
2031 $mem->setPassword($password);
2034 // do the activation
2035 MEMBER::activate($key);
2038 echo '<h2>',_ACTIVATE_SUCCESS_TITLE,'</h2>';
2039 echo '<p>',_ACTIVATE_SUCCESS_TEXT,'</p>';
2046 function action_manageteam() {
2047 global $member, $manager;
2049 $blogid = intRequestVar('blogid');
2052 $member->blogAdminRights($blogid) or $this->disallow();
2056 echo "<p><a href='index.php?action=blogsettings&blogid=$blogid'>(",_BACK_TO_BLOGSETTINGS,")</a></p>";
2058 echo '<h2>' . _TEAM_TITLE . getBlogNameFromID($blogid) . '</h2>';
2060 echo '<h3>' . _TEAM_CURRENT . '</h3>';
2064 $query = 'SELECT tblog, tmember, mname, mrealname, memail, tadmin'
2065 . ' FROM '.sql_table('member').', '.sql_table('team')
2066 . ' WHERE tmember=mnumber and tblog=' . $blogid;
2068 $template['content'] = 'teamlist';
2069 $template['tabindex'] = 10;
2071 $batch =& new BATCH('team');
2072 $batch->showlist($query, 'table', $template);
2075 <h3><?php echo _TEAM_ADDNEW?></h3>
2077 <form method='post' action='index.php'><div>
2079 <input type='hidden' name='action' value='teamaddmember' />
2080 <input type='hidden' name='blogid' value='<?php echo $blogid; ?>' />
2081 <?php $manager->addTicketHidden() ?>
2084 <td><?php echo _TEAM_CHOOSEMEMBER?></td>
2085 <td><?php // TODO: try to make it so only non-team-members are listed
2086 $query = 'SELECT mname as text, mnumber as value'
2087 . ' FROM '.sql_table('member');
2089 $template['name'] = 'memberid';
2090 $template['tabindex'] = 10000;
2091 showlist($query,'select',$template);
2094 <td><?php echo _TEAM_ADMIN?><?php help('teamadmin'); ?></td>
2095 <td><?php $this->input_yesno('admin',0,10020); ?></td>
2097 <td><?php echo _TEAM_ADD?></td>
2098 <td><input type='submit' value='<?php echo _TEAM_ADD_BTN?>' tabindex="10030" /></td>
2107 * Add member tot tram
2109 function action_teamaddmember() {
2110 global $member, $manager;
2112 $memberid = intPostVar('memberid');
2113 $blogid = intPostVar('blogid');
2114 $admin = intPostVar('admin');
2117 $member->blogAdminRights($blogid) or $this->disallow();
2119 $blog =& $manager->getBlog($blogid);
2120 if (!$blog->addTeamMember($memberid, $admin))
2121 $this->error(_ERROR_ALREADYONTEAM);
2123 $this->action_manageteam();
2127 function action_teamdelete() {
2128 global $member, $manager;
2130 $memberid = intRequestVar('memberid');
2131 $blogid = intRequestVar('blogid');
2134 $member->blogAdminRights($blogid) or $this->disallow();
2136 $teammem = MEMBER::createFromID($memberid);
2137 $blog =& $manager->getBlog($blogid);
2141 <h2><?php echo _DELETE_CONFIRM?></h2>
2143 <p><?php echo _CONFIRMTXT_TEAM1?><b><?php echo $teammem->getDisplayName() ?></b><?php echo _CONFIRMTXT_TEAM2?><b><?php echo htmlspecialchars(strip_tags($blog->getName())) ?></b>
2147 <form method="post" action="index.php"><div>
2148 <input type="hidden" name="action" value="teamdeleteconfirm" />
2149 <?php $manager->addTicketHidden() ?>
2150 <input type="hidden" name="memberid" value="<?php echo $memberid; ?>" />
2151 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
2152 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
2158 function action_teamdeleteconfirm() {
2161 $memberid = intRequestVar('memberid');
2162 $blogid = intRequestVar('blogid');
2164 $error = $this->deleteOneTeamMember($blogid, $memberid);
2166 $this->error($error);
2169 $this->action_manageteam();
2172 function deleteOneTeamMember($blogid, $memberid) {
2173 global $member, $manager;
2175 $blogid = intval($blogid);
2176 $memberid = intval($memberid);
2179 if (!$member->blogAdminRights($blogid))
2180 return _ERROR_DISALLOWED;
2182 // check if: - there remains at least one blog admin
2183 // - (there remains at least one team member)
2184 $tmem = MEMBER::createFromID($memberid);
2186 $manager->notify('PreDeleteTeamMember', array('member' => &$mem, 'blogid' => $blogid));
2188 if ($tmem->isBlogAdmin($blogid)) {
2189 // check if there are more blog members left and at least one admin
2190 // (check for at least two admins before deletion)
2191 $query = 'SELECT * FROM '.sql_table('team') . ' WHERE tblog='.$blogid.' and tadmin=1';
2192 $r = sql_query($query);
2193 if (mysql_num_rows($r) < 2)
2194 return _ERROR_ATLEASTONEBLOGADMIN;
2197 $query = 'DELETE FROM '.sql_table('team')." WHERE tblog=$blogid and tmember=$memberid";
2200 $manager->notify('PostDeleteTeamMember', array('member' => &$mem, 'blogid' => $blogid));
2205 function action_teamchangeadmin() {
2208 $blogid = intRequestVar('blogid');
2209 $memberid = intRequestVar('memberid');
2212 $member->blogAdminRights($blogid) or $this->disallow();
2214 $mem = MEMBER::createFromID($memberid);
2216 // don't allow when there is only one admin at this moment
2217 if ($mem->isBlogAdmin($blogid)) {
2218 $r = sql_query('SELECT * FROM '.sql_table('team') . " WHERE tblog=$blogid and tadmin=1");
2219 if (mysql_num_rows($r) == 1)
2220 $this->error(_ERROR_ATLEASTONEBLOGADMIN);
2223 if ($mem->isBlogAdmin($blogid))
2228 $query = 'UPDATE '.sql_table('team') ." SET tadmin=$newval WHERE tblog=$blogid and tmember=$memberid";
2231 // only show manageteam if member did not change its own admin privileges
2232 if ($member->isBlogAdmin($blogid))
2233 $this->action_manageteam();
2235 $this->action_overview(_MSG_ADMINCHANGED);
2238 function action_blogsettings() {
2239 global $member, $manager;
2241 $blogid = intRequestVar('blogid');
2244 $member->blogAdminRights($blogid) or $this->disallow();
2246 $blog =& $manager->getBlog($blogid);
2248 $extrahead = '<script type="text/javascript" src="javascript/numbercheck.js"></script>';
2249 $this->pagehead($extrahead);
2251 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
2253 <h2><?php echo _EBLOG_TITLE?>: '<?php echo $this->bloglink($blog)?>'</h2>
2255 <h3><?php echo _EBLOG_TEAM_TITLE?></h3>
2257 <p>Members currently on your team:
2259 $res = sql_query('SELECT mname, mrealname FROM ' . sql_table('member') . ',' . sql_table('team') . ' WHERE mnumber=tmember AND tblog=' . intval($blogid));
2260 $aMemberNames = array();
2261 while ($o = mysql_fetch_object($res))
2262 array_push($aMemberNames, htmlspecialchars($o->mname) . ' (' . htmlspecialchars($o->mrealname). ')');
2263 echo implode(',', $aMemberNames);
2270 <a href="index.php?action=manageteam&blogid=<?php echo $blogid?>"><?php echo _EBLOG_TEAM_TEXT?></a>
2273 <h3><?php echo _EBLOG_SETTINGS_TITLE?></h3>
2275 <form method="post" action="index.php"><div>
2277 <input type="hidden" name="action" value="blogsettingsupdate" />
2278 <?php $manager->addTicketHidden() ?>
2279 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
2281 <td><?php echo _EBLOG_NAME?></td>
2282 <td><input name="name" tabindex="10" size="40" maxlength="60" value="<?php echo htmlspecialchars($blog->getName()) ?>" /></td>
2284 <td><?php echo _EBLOG_SHORTNAME?> <?php help('shortblogname'); ?>
2285 <?php echo _EBLOG_SHORTNAME_EXTRA?>
2287 <td><input name="shortname" tabindex="20" maxlength="15" size="15" value="<?php echo htmlspecialchars($blog->getShortName()) ?>" /></td>
2289 <td><?php echo _EBLOG_DESC?></td>
2290 <td><input name="desc" tabindex="30" maxlength="200" size="40" value="<?php echo htmlspecialchars($blog->getDescription()) ?>" /></td>
2292 <td><?php echo _EBLOG_URL?></td>
2293 <td><input name="url" tabindex="40" size="40" maxlength="100" value="<?php echo htmlspecialchars($blog->getURL()) ?>" /></td>
2295 <td><?php echo _EBLOG_DEFSKIN?>
2296 <?php help('blogdefaultskin'); ?>
2300 $query = 'SELECT sdname as text, sdnumber as value'
2301 . ' FROM '.sql_table('skin_desc');
2302 $template['name'] = 'defskin';
2303 $template['selected'] = $blog->getDefaultSkin();
2304 $template['tabindex'] = 50;
2305 showlist($query,'select',$template);
2310 <td><?php echo _EBLOG_LINEBREAKS?> <?php help('convertbreaks'); ?>
2312 <td><?php $this->input_yesno('convertbreaks',$blog->convertBreaks(),55); ?></td>
2314 <td><?php echo _EBLOG_ALLOWPASTPOSTING?> <?php help('allowpastposting'); ?>
2316 <td><?php $this->input_yesno('allowpastposting',$blog->allowPastPosting(),57); ?></td>
2318 <td><?php echo _EBLOG_DISABLECOMMENTS?>
2320 <td><?php $this->input_yesno('comments',$blog->commentsEnabled(),60); ?></td>
2322 <td><?php echo _EBLOG_ANONYMOUS?>
2324 <td><?php $this->input_yesno('public',$blog->isPublic(),70); ?></td>
2326 <td><?php echo _EBLOG_NOTIFY?> <?php help('blognotify'); ?></td>
2327 <td><input name="notify" tabindex="80" maxlength="60" size="40" value="<?php echo htmlspecialchars($blog->getNotifyAddress()); ?>" /></td>
2329 <td><?php echo _EBLOG_NOTIFY_ON?></td>
2331 <input name="notifyComment" value="3" type="checkbox" tabindex="81" id="notifyComment"
2332 <?php if ($blog->notifyOnComment()) echo "checked='checked'" ?>
2333 /><label for="notifyComment"><?php echo _EBLOG_NOTIFY_COMMENT?></label>
2335 <input name="notifyVote" value="5" type="checkbox" tabindex="82" id="notifyVote"
2336 <?php if ($blog->notifyOnVote()) echo "checked='checked'" ?>
2337 /><label for="notifyVote"><?php echo _EBLOG_NOTIFY_KARMA?></label>
2339 <input name="notifyNewItem" value="7" type="checkbox" tabindex="83" id="notifyNewItem"
2340 <?php if ($blog->notifyOnNewItem()) echo "checked='checked'" ?>
2341 /><label for="notifyNewItem"><?php echo _EBLOG_NOTIFY_ITEM?></label>
2344 <td><?php echo _EBLOG_PING?> <?php help('pinguserland'); ?></td>
2345 <td><?php $this->input_yesno('pinguserland',$blog->pingUserland(),85); ?></td>
2347 <td><?php echo _EBLOG_MAXCOMMENTS?> <?php help('blogmaxcomments'); ?></td>
2348 <td><input name="maxcomments" tabindex="90" size="3" value="<?php echo htmlspecialchars($blog->getMaxComments()); ?>" /></td>
2350 <td><?php echo _EBLOG_UPDATE?> <?php help('blogupdatefile'); ?></td>
2351 <td><input name="update" tabindex="100" size="40" maxlength="60" value="<?php echo htmlspecialchars($blog->getUpdateFile()) ?>" /></td>
2353 <td><?php echo _EBLOG_DEFCAT?></td>
2356 $query = 'SELECT cname as text, catid as value'
2357 . ' FROM '.sql_table('category')
2358 . ' WHERE cblog=' . $blog->getID();
2359 $template['name'] = 'defcat';
2360 $template['selected'] = $blog->getDefaultCategory();
2361 $template['tabindex'] = 110;
2362 showlist($query,'select',$template);
2366 <td><?php echo _EBLOG_OFFSET?> <?php help('blogtimeoffset'); ?>
2367 <br /><?php echo _EBLOG_STIME?> <b><?php echo strftime("%H:%M",time()); ?></b>
2368 <br /><?php echo _EBLOG_BTIME?> <b><?php echo strftime("%H:%M",$blog->getCorrectTime()); ?></b>
2370 <td><input name="timeoffset" tabindex="120" size="3" value="<?php echo htmlspecialchars($blog->getTimeOffset()); ?>" /></td>
2372 <td><?php echo _EBLOG_SEARCH?> <?php help('blogsearchable'); ?></td>
2373 <td><?php $this->input_yesno('searchable',$blog->getSearchable(),122); ?></td>
2377 $this->_insertPluginOptions('blog',$blogid);
2380 <th colspan="2"><?php echo _EBLOG_CHANGE?></th>
2382 <td><?php echo _EBLOG_CHANGE?></td>
2383 <td><input type="submit" tabindex="130" value="<?php echo _EBLOG_CHANGE_BTN?>" onclick="return checkSubmit();" /></td>
2388 <h3><?php echo _EBLOG_CAT_TITLE?></h3>
2392 $query = 'SELECT * FROM '.sql_table('category').' WHERE cblog='.$blog->getID().' ORDER BY cname';
2393 $template['content'] = 'categorylist';
2394 $template['tabindex'] = 200;
2396 $batch =& new BATCH('category');
2397 $batch->showlist($query,'table',$template);
2402 <form action="index.php" method="post"><div>
2403 <input name="action" value="categorynew" type="hidden" />
2404 <?php $manager->addTicketHidden() ?>
2405 <input name="blogid" value="<?php echo $blog->getID()?>" type="hidden" />
2408 <th colspan="2"><?php echo _EBLOG_CAT_CREATE?></th>
2410 <td><?php echo _EBLOG_CAT_NAME?></td>
2411 <td><input name="cname" size="40" maxlength="40" tabindex="300" /></td>
2413 <td><?php echo _EBLOG_CAT_DESC?></td>
2414 <td><input name="cdesc" size="40" maxlength="200" tabindex="310" /></td>
2416 <td><?php echo _EBLOG_CAT_CREATE?></td>
2417 <td><input type="submit" value="<?php echo _EBLOG_CAT_CREATE?>" tabindex="320" /></td>
2424 echo '<h3>',_PLUGINS_EXTRA,'</h3>';
2427 'BlogSettingsFormExtras',
2436 function action_categorynew() {
2437 global $member, $manager;
2439 $blogid = intRequestVar('blogid');
2441 $member->blogAdminRights($blogid) or $this->disallow();
2443 $cname = postVar('cname');
2444 $cdesc = postVar('cdesc');
2446 if (!isValidCategoryName($cname))
2447 $this->error(_ERROR_BADCATEGORYNAME);
2449 $query = 'SELECT * FROM '.sql_table('category') . ' WHERE cname=\'' . addslashes($cname).'\' and cblog=' . intval($blogid);
2450 $res = sql_query($query);
2451 if (mysql_num_rows($res) > 0)
2452 $this->error(_ERROR_DUPCATEGORYNAME);
2454 $blog =& $manager->getBlog($blogid);
2455 $newCatID = $blog->createNewCategory($cname, $cdesc);
2457 $this->action_blogsettings();
2461 function action_categoryedit($catid = '', $blogid = '', $desturl = '') {
2462 global $member, $manager;
2465 $blogid = intGetVar('blogid');
2467 $blogid = intval($blogid);
2469 $catid = intGetVar('catid');
2471 $catid = intval($catid);
2473 $member->blogAdminRights($blogid) or $this->disallow();
2475 $res = sql_query('SELECT * FROM '.sql_table('category')." WHERE cblog=$blogid AND catid=$catid");
2476 $obj = mysql_fetch_object($res);
2478 $cname = $obj->cname;
2479 $cdesc = $obj->cdesc;
2481 $extrahead = '<script type="text/javascript" src="javascript/numbercheck.js"></script>';
2482 $this->pagehead($extrahead);
2485 <h2><?php echo _EBLOG_CAT_UPDATE?> '<?php echo htmlspecialchars($cname)?>'</h2>
2486 <form method='post' action='index.php'><div>
2487 <input name="blogid" type="hidden" value="<?php echo $blogid?>" />
2488 <input name="catid" type="hidden" value="<?php echo $catid?>" />
2489 <input name="desturl" type="hidden" value="<?php echo htmlspecialchars($desturl) ?>" />
2490 <input name="action" type="hidden" value="categoryupdate" />
2491 <?php $manager->addTicketHidden(); ?>
2494 <th colspan="2"><?php echo _EBLOG_CAT_UPDATE ?></th>
2496 <td><?php echo _EBLOG_CAT_NAME?></td>
2497 <td><input type="text" name="cname" value="<?php echo htmlspecialchars($cname)?>" size="40" maxlength="40" /></td>
2499 <td><?php echo _EBLOG_CAT_DESC?></td>
2500 <td><input type="text" name="cdesc" value="<?php echo htmlspecialchars($cdesc)?>" size="40" maxlength="200" /></td>
2503 // insert plugin options
2504 $this->_insertPluginOptions('category',$catid);
2507 <th colspan="2"><?php echo _EBLOG_CAT_UPDATE ?></th>
2509 <td><?php echo _EBLOG_CAT_UPDATE?></td>
2510 <td><input type="submit" value="<?php echo _EBLOG_CAT_UPDATE_BTN?>" /></td>
2519 function action_categoryupdate() {
2520 global $member, $manager;
2522 $blogid = intPostVar('blogid');
2523 $catid = intPostVar('catid');
2524 $cname = postVar('cname');
2525 $cdesc = postVar('cdesc');
2526 $desturl = postVar('desturl');
2528 $member->blogAdminRights($blogid) or $this->disallow();
2530 if (!isValidCategoryName($cname))
2531 $this->error(_ERROR_BADCATEGORYNAME);
2533 $query = 'SELECT * FROM '.sql_table('category').' WHERE cname=\'' . addslashes($cname).'\' and cblog=' . intval($blogid) . " and not(catid=$catid)";
2534 $res = sql_query($query);
2535 if (mysql_num_rows($res) > 0)
2536 $this->error(_ERROR_DUPCATEGORYNAME);
2538 $query = 'UPDATE '.sql_table('category').' SET'
2539 . " cname='" . addslashes($cname) . "',"
2540 . " cdesc='" . addslashes($cdesc) . "'"
2541 . " WHERE catid=" . $catid;
2545 // store plugin options
2546 $aOptions = requestArray('plugoption');
2547 NucleusPlugin::_applyPluginOptions($aOptions);
2548 $manager->notify('PostPluginOptionsUpdate',array('context' => 'category', 'catid' => $catid));
2555 $this->action_blogsettings();
2559 function action_categorydelete() {
2560 global $member, $manager;
2562 $blogid = intRequestVar('blogid');
2563 $catid = intRequestVar('catid');
2565 $member->blogAdminRights($blogid) or $this->disallow();
2567 $blog =& $manager->getBlog($blogid);
2569 // check if the category is valid
2570 if (!$blog->isValidCategory($catid))
2571 $this->error(_ERROR_NOSUCHCATEGORY);
2573 // don't allow deletion of default category
2574 if ($blog->getDefaultCategory() == $catid)
2575 $this->error(_ERROR_DELETEDEFCATEGORY);
2577 // check if catid is the only category left for blogid
2578 $query = 'SELECT catid FROM '.sql_table('category').' WHERE cblog=' . $blogid;
2579 $res = sql_query($query);
2580 if (mysql_num_rows($res) == 1)
2581 $this->error(_ERROR_DELETELASTCATEGORY);
2586 <h2><?php echo _DELETE_CONFIRM?></h2>
2589 <?php echo _CONFIRMTXT_CATEGORY?><b><?php echo $blog->getCategoryName($catid)?></b>
2592 <form method="post" action="index.php"><div>
2593 <input type="hidden" name="action" value="categorydeleteconfirm" />
2594 <?php $manager->addTicketHidden() ?>
2595 <input type="hidden" name="blogid" value="<?php echo $blogid?>" />
2596 <input type="hidden" name="catid" value="<?php echo $catid?>" />
2597 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
2603 function action_categorydeleteconfirm() {
2604 global $member, $manager;
2606 $blogid = intRequestVar('blogid');
2607 $catid = intRequestVar('catid');
2609 $member->blogAdminRights($blogid) or $this->disallow();
2611 $error = $this->deleteOneCategory($catid);
2613 $this->error($error);
2615 $this->action_blogsettings();
2618 function deleteOneCategory($catid) {
2619 global $manager, $member;
2621 $catid = intval($catid);
2623 $manager->notify('PreDeleteCategory', array('catid' => $catid));
2625 $blogid = getBlogIDFromCatID($catid);
2627 if (!$member->blogAdminRights($blogid))
2628 return ERROR_DISALLOWED;
2631 $blog =& $manager->getBlog($blogid);
2633 // check if the category is valid
2634 if (!$blog || !$blog->isValidCategory($catid))
2635 return _ERROR_NOSUCHCATEGORY;
2637 $destcatid = $blog->getDefaultCategory();
2639 // don't allow deletion of default category
2640 if ($blog->getDefaultCategory() == $catid)
2641 return _ERROR_DELETEDEFCATEGORY;
2643 // check if catid is the only category left for blogid
2644 $query = 'SELECT catid FROM '.sql_table('category').' WHERE cblog=' . $blogid;
2645 $res = sql_query($query);
2646 if (mysql_num_rows($res) == 1)
2647 return _ERROR_DELETELASTCATEGORY;
2649 // change category for all items to the default category
2650 $query = 'UPDATE '.sql_table('item')." SET icat=$destcatid WHERE icat=$catid";
2653 // delete all associated plugin options
2654 NucleusPlugin::_deleteOptionValues('category', $catid);
2657 $query = 'DELETE FROM '.sql_table('category').' WHERE catid=' .$catid;
2660 $manager->notify('PostDeleteCategory', array('catid' => $catid));
2664 function moveOneCategory($catid, $destblogid) {
2665 global $manager, $member;
2667 $catid = intval($catid);
2668 $destblogid = intval($destblogid);
2670 $blogid = getBlogIDFromCatID($catid);
2672 // mover should have admin rights on both blogs
2673 if (!$member->blogAdminRights($blogid))
2674 return _ERROR_DISALLOWED;
2675 if (!$member->blogAdminRights($destblogid))
2676 return _ERROR_DISALLOWED;
2678 // cannot move to self
2679 if ($blogid == $destblogid)
2680 return _ERROR_MOVETOSELF;
2683 $blog =& $manager->getBlog($blogid);
2684 $destblog =& $manager->getBlog($destblogid);
2686 // check if the category is valid
2687 if (!$blog || !$blog->isValidCategory($catid))
2688 return _ERROR_NOSUCHCATEGORY;
2690 // don't allow default category to be moved
2691 if ($blog->getDefaultCategory() == $catid)
2692 return _ERROR_MOVEDEFCATEGORY;
2698 'sourceblog' => &$blog,
2699 'destblog' => &$destblog
2703 // update comments table (cblog)
2704 $query = 'SELECT inumber FROM '.sql_table('item').' WHERE icat='.$catid;
2705 $items = sql_query($query);
2706 while ($oItem = mysql_fetch_object($items)) {
2707 sql_query('UPDATE '.sql_table('comment').' SET cblog='.$destblogid.' WHERE citem='.$oItem->inumber);
2710 // update items (iblog)
2711 $query = 'UPDATE '.sql_table('item').' SET iblog='.$destblogid.' WHERE icat='.$catid;
2715 $query = 'UPDATE '.sql_table('category').' SET cblog='.$destblogid.' WHERE catid='.$catid;
2722 'sourceblog' => &$blog,
2723 'destblog' => $destblog
2729 function action_blogsettingsupdate() {
2730 global $member, $manager;
2732 $blogid = intRequestVar('blogid');
2734 $member->blogAdminRights($blogid) or $this->disallow();
2736 $blog =& $manager->getBlog($blogid);
2738 $notify = trim(postVar('notify'));
2739 $shortname = trim(postVar('shortname'));
2740 $updatefile = trim(postVar('update'));
2742 $notifyComment = intPostVar('notifyComment');
2743 $notifyVote = intPostVar('notifyVote');
2744 $notifyNewItem = intPostVar('notifyNewItem');
2746 if ($notifyComment == 0) $notifyComment = 1;
2747 if ($notifyVote == 0) $notifyVote = 1;
2748 if ($notifyNewItem == 0) $notifyNewItem = 1;
2750 $notifyType = $notifyComment * $notifyVote * $notifyNewItem;
2754 $not =& new NOTIFICATION($notify);
2755 if (!$not->validAddresses())
2756 $this->error(_ERROR_BADNOTIFY);
2760 if (!isValidShortName($shortname))
2761 $this->error(_ERROR_BADSHORTBLOGNAME);
2763 if (($blog->getShortName() != $shortname) && $manager->existsBlog($shortname))
2764 $this->error(_ERROR_DUPSHORTBLOGNAME);
2766 // check if update file is writable
2767 if ($updatefile && !is_writeable($updatefile))
2768 $this->error(_ERROR_UPDATEFILE);
2770 $blog->setName(trim(postVar('name')));
2771 $blog->setShortName($shortname);
2772 $blog->setNotifyAddress($notify);
2773 $blog->setNotifyType($notifyType);
2774 $blog->setMaxComments(postVar('maxcomments'));
2775 $blog->setCommentsEnabled(postVar('comments'));
2776 $blog->setTimeOffset(postVar('timeoffset'));
2777 $blog->setUpdateFile($updatefile);
2778 $blog->setURL(trim(postVar('url')));
2779 $blog->setDefaultSkin(intPostVar('defskin'));
2780 $blog->setDescription(trim(postVar('desc')));
2781 $blog->setPublic(postVar('public'));
2782 $blog->setPingUserland(postVar('pinguserland'));
2783 $blog->setConvertBreaks(intPostVar('convertbreaks'));
2784 $blog->setAllowPastPosting(intPostVar('allowpastposting'));
2785 $blog->setDefaultCategory(intPostVar('defcat'));
2786 $blog->setSearchable(intPostVar('searchable'));
2788 $blog->writeSettings();
2790 // store plugin options
2791 $aOptions = requestArray('plugoption');
2792 NucleusPlugin::_applyPluginOptions($aOptions);
2793 $manager->notify('PostPluginOptionsUpdate',array('context' => 'blog', 'blogid' => $blogid, 'blog' => &$blog));
2796 $this->action_overview(_MSG_SETTINGSCHANGED);
2799 function action_deleteblog() {
2800 global $member, $CONF, $manager;
2802 $blogid = intRequestVar('blogid');
2804 $member->blogAdminRights($blogid) or $this->disallow();
2806 // check if blog is default blog
2807 if ($CONF['DefaultBlog'] == $blogid)
2808 $this->error(_ERROR_DELDEFBLOG);
2810 $blog =& $manager->getBlog($blogid);
2814 <h2><?php echo _DELETE_CONFIRM?></h2>
2816 <p><?php echo _WARNINGTXT_BLOGDEL?>
2820 <?php echo _CONFIRMTXT_BLOG?><b><?php echo htmlspecialchars($blog->getName())?></b>
2823 <form method="post" action="index.php"><div>
2824 <input type="hidden" name="action" value="deleteblogconfirm" />
2825 <?php $manager->addTicketHidden() ?>
2826 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
2827 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
2833 function action_deleteblogconfirm() {
2834 global $member, $CONF, $manager;
2836 $blogid = intRequestVar('blogid');
2838 $manager->notify('PreDeleteBlog', array('blogid' => $blogid));
2840 $member->blogAdminRights($blogid) or $this->disallow();
2842 // check if blog is default blog
2843 if ($CONF['DefaultBlog'] == $blogid)
2844 $this->error(_ERROR_DELDEFBLOG);
2846 // delete all comments
2847 $query = 'DELETE FROM '.sql_table('comment').' WHERE cblog='.$blogid;
2851 $query = 'DELETE FROM '.sql_table('item').' WHERE iblog='.$blogid;
2854 // delete all team members
2855 $query = 'DELETE FROM '.sql_table('team').' WHERE tblog='.$blogid;
2859 $query = 'DELETE FROM '.sql_table('ban').' WHERE blogid='.$blogid;
2862 // delete all categories
2863 $query = 'DELETE FROM '.sql_table('category').' WHERE cblog='.$blogid;
2866 // delete all associated plugin options
2867 NucleusPlugin::_deleteOptionValues('blog', $blogid);
2869 // delete the blog itself
2870 $query = 'DELETE FROM '.sql_table('blog').' WHERE bnumber='.$blogid;
2873 $manager->notify('PostDeleteBlog', array('blogid' => $blogid));
2875 $this->action_overview(_DELETED_BLOG);
2878 function action_memberdelete() {
2879 global $member, $manager;
2881 $memberid = intRequestVar('memberid');
2883 ($member->getID() == $memberid) or $member->isAdmin() or $this->disallow();
2885 $mem = MEMBER::createFromID($memberid);
2889 <h2><?php echo _DELETE_CONFIRM?></h2>
2891 <p><?php echo _CONFIRMTXT_MEMBER?><b><?php echo $mem->getDisplayName() ?></b>
2895 Please note that media files will <b>NOT</b> be deleted. (At least not in this Nucleus version)
2898 <form method="post" action="index.php"><div>
2899 <input type="hidden" name="action" value="memberdeleteconfirm" />
2900 <?php $manager->addTicketHidden() ?>
2901 <input type="hidden" name="memberid" value="<?php echo $memberid; ?>" />
2902 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
2908 function action_memberdeleteconfirm() {
2911 $memberid = intRequestVar('memberid');
2913 ($member->getID() == $memberid) or $member->isAdmin() or $this->disallow();
2915 $error = $this->deleteOneMember($memberid);
2917 $this->error($error);
2919 if ($member->isAdmin())
2920 $this->action_usermanagement();
2922 $this->action_overview(_DELETED_MEMBER);
2926 function deleteOneMember($memberid) {
2929 $memberid = intval($memberid);
2930 $mem = MEMBER::createFromID($memberid);
2932 if (!$mem->canBeDeleted())
2933 return _ERROR_DELETEMEMBER;
2935 $manager->notify('PreDeleteMember', array('member' => &$mem));
2937 $query = 'DELETE FROM '.sql_table('member').' WHERE mnumber='.$memberid;
2940 $query = 'DELETE FROM '.sql_table('team').' WHERE tmember='.$memberid;
2943 $query = 'DELETE FROM '.sql_table('activation').' WHERE vmember='.$memberid;
2946 // delete all associated plugin options
2947 NucleusPlugin::_deleteOptionValues('member', $memberid);
2949 $manager->notify('PostDeleteMember', array('member' => &$mem));
2954 function action_createnewlog() {
2955 global $member, $CONF, $manager;
2957 // Only Super-Admins can do this
2958 $member->isAdmin() or $this->disallow();
2962 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
2964 <h2><?php echo _EBLOG_CREATE_TITLE?></h2>
2966 <h3>_ADMIN_NOTABILIA</h3>
2968 <p>_ADMIN_PLEASE_READ</p>
2970 <p>_ADMIN_HOW_TO_ACCESS</p>
2973 <li>_ADMIN_SIMPLE_WAY</li>
2974 <li>_ADMIN_DIFFICULT_WAY</li>
2977 <h3>_ADMIN_HOW_TO_CREATE</h3>
2980 <?php echo _EBLOG_CREATE_TEXT?>
2983 <form method="post" action="index.php"><div>
2985 <input type="hidden" name="action" value="addnewlog" />
2986 <?php $manager->addTicketHidden() ?>
2990 <td><?php echo _EBLOG_NAME?></td>
2991 <td><input name="name" tabindex="10" size="40" maxlength="60" /></td>
2993 <td><?php echo _EBLOG_SHORTNAME?>
2994 <?php help('shortblogname'); ?>
2996 <td><input name="shortname" tabindex="20" maxlength="15" size="15" /></td>
2998 <td><?php echo _EBLOG_DESC?></td>
2999 <td><input name="desc" tabindex="30" maxlength="200" size="40" /></td>
3001 <td><?php echo _EBLOG_DEFSKIN?>
3002 <?php help('blogdefaultskin'); ?>
3006 $query = 'SELECT sdname as text, sdnumber as value'
3007 . ' FROM '.sql_table('skin_desc');
3008 $template['name'] = 'defskin';
3009 $template['tabindex'] = 50;
3010 $template['selected'] = $CONF['BaseSkin']; // set default selected skin to be globally defined base skin
3011 showlist($query,'select',$template);
3015 <td><?php echo _EBLOG_OFFSET?>
3016 <?php help('blogtimeoffset'); ?>
3017 <br /><?php echo _EBLOG_STIME?> <b><?php echo strftime("%H:%M",time()); ?></b>
3019 <td><input name="timeoffset" tabindex="110" size="3" value="0" /></td>
3021 <td><?php echo _EBLOG_ADMIN?>
3022 <?php help('blogadmin'); ?>
3024 <td><?php echo _EBLOG_ADMIN_MSG?></td>
3026 <td><?php echo _EBLOG_CREATE?></td>
3027 <td><input type="submit" tabindex="120" value="<?php echo _EBLOG_CREATE_BTN?>" onclick="return checkSubmit();" /></td>
3035 function action_addnewlog() {
3036 global $member, $manager, $CONF;
3038 // Only Super-Admins can do this
3039 $member->isAdmin() or $this->disallow();
3041 $bname = trim(postVar('name'));
3042 $bshortname = trim(postVar('shortname'));
3043 $btimeoffset = postVar('timeoffset');
3044 $bdesc = trim(postVar('desc'));
3045 $bdefskin = postVar('defskin');
3047 if (!isValidShortName($bshortname))
3048 $this->error(_ERROR_BADSHORTBLOGNAME);
3050 if ($manager->existsBlog($bshortname))
3051 $this->error(_ERROR_DUPSHORTBLOGNAME);
3057 'shortname' => &$bshortname,
3058 'timeoffset' => &$btimeoffset,
3059 'description' => &$bdescription,
3060 'defaultskin' => &$bdefskin
3065 // add slashes for sql queries
3066 $bname = addslashes($bname);
3067 $bshortname = addslashes($bshortname);
3068 $btimeoffset = addslashes($btimeoffset);
3069 $bdesc = addslashes($bdesc);
3070 $bdefskin = addslashes($bdefskin);
3073 $query = 'INSERT INTO '.sql_table('blog')." (bname, bshortname, bdesc, btimeoffset, bdefskin) VALUES ('$bname', '$bshortname', '$bdesc', '$btimeoffset', '$bdefskin')";
3075 $blogid = mysql_insert_id();
3076 $blog =& $manager->getBlog($blogid);
3078 // create new category
3079 sql_query('INSERT INTO '.sql_table('category')." (cblog, cname, cdesc) VALUES ($blogid, 'General','Items that do not fit in other categories')");
3080 $catid = mysql_insert_id();
3082 // set as default category
3083 $blog->setDefaultCategory($catid);
3084 $blog->writeSettings();
3086 // create team member
3087 $memberid = $member->getID();
3088 $query = 'INSERT INTO '.sql_table('team')." (tmember, tblog, tadmin) VALUES ($memberid, $blogid, 1)";
3092 $blog->additem($blog->getDefaultCategory(),'First Item','ã
\81\93ã
\82\8cã
\81¯ã
\81\82ã
\81ªã
\81\9fã
\81Eweblogã
\81«ã
\81\8aã
\81\91ã
\82\8bæ
\9c\80å
\88\9dã
\81Eã
\82¢ã
\82¤ã
\83\81E
\83 ã
\81§ã
\81\99ã
\80\82è
\81Eç
\94±ã
\81«å
\89\8aé
\99¤ã
\81\97ã
\81¦ã
\81\81E
\81\9fã
\81 ã
\81\81E
\81¦ã
\81\8bã
\81¾ã
\81\81E
\81¾ã
\81\9bã
\82\93ã
\80\81E,'',$blogid, $memberid,$blog->getCorrectTime(),0,0,0);
3110 <h2>æ
\96°ã
\81\97ã
\81\84weblogã
\81\8cä½
\9cæ
\81Eã
\81\95ã
\82\8cã
\81¾ã
\81\97ã
\81\9f</h2>
3112 <p>æ
\96°ã
\81\97ã
\81\84weblog ã
\80\81E?php echo htmlspecialchars($bname)?>ã
\80\8dã
\81\8cä½
\9cæ
\81Eã
\81\95ã
\82\8cã
\81¾ã
\81\97ã
\81\9fã
\80\82ç¶
\9aã
\81\91ã
\81¦ã
\80\81ã
\81\93ã
\82\8cã
\81«ã
\82¢ã
\82¯ã
\82ȋ
\82¹ã
\81\99ã
\82\8bã
\81\9fã
\82\81ã
\81«ä»¥ä¸
\8bã
\81Eã
\81©ã
\81¡ã
\82\89ã
\81\8bã
\81®æ
\89\8bé
\81E
\81«é
\80²ã
\82\93ã
\81§ã
\81\8fã
\81 ã
\81\95ã
\81\84ã
\80\81E/p>
3115 <li><a href="#index_php">ç°¡å
\8d\98ã
\81ªæ
\96¹æ³
\81E ä¸
\8bã
\81Eã
\82³ã
\83¼ã
\83\89ã
\82\92è²¼ä»
\98ã
\81\91ã
\81\81E<code><?php echo htmlspecialchars($bshortname)?>.php</code> ã
\81¨ã
\81\81E
\81\86ã
\83\95ã
\82¡ã
\82¤ã
\83«ã
\82\92ä½
\9cæ
\81Eã
\81\99ã
\82\8b</a></li>
3116 <li><a href="#skins">é«
\98度ã
\81ªæ
\96¹æ³
\81E ç
\8f¾å
\9c¨ä½¿ç
\94¨ã
\81\97ã
\81¦ã
\81\81E
\82\8bã
\82¹ã
\82ã
\83³ã
\81«æ
\96°ã
\81\97ã
\81\84weblogã
\82\92å±
\95é
\96\8bã
\81\95ã
\81\9bã
\82\8bã
\81\9fã
\82\81ã
\81Eè¨
\98è¿°ã
\82\92å
\8a ã
\81\88ã
\82\8b</a></li>
3119 <h3><a id="index_php">æ
\96¹æ³
\81E1: <code><?php echo htmlspecialchars($bshortname)?>.php</code> ã
\81¨ã
\81\81E
\81\86ã
\83\95ã
\82¡ã
\82¤ã
\83«ã
\82\92ä½
\9cæ
\81E</a></h3>
3121 <p><code><?php echo htmlspecialchars($bshortname)?>.php</code> ã
\81¨ã
\81\81E
\81\86ã
\83\95ã
\82¡ã
\82¤ã
\83«ã
\82\92ä½
\9cæ
\81Eã
\81\97ã
\81¦ã
\80\81ä¸èº«ã
\81«ä»¥ä¸
\8bã
\81Eã
\82³ã
\83¼ã
\83\89ã
\82\92è²¼ã
\82\8aä»
\98ã
\81\91ã
\82\81E</p>
3124 $CONF['Self'] = '<b><?php echo htmlspecialchars($bshortname)?>.php</b>';
3126 include('<i>./config.php</i>');
3128 selectBlog('<b><?php echo htmlspecialchars($bshortname)?></b>');
3133 <p>ã
\81\99ã
\81§ã
\81«ã
\81\82ã
\82\8b<code>index.php</code>ã
\81¨å
\90\8cã
\81\98ã
\83\81E
\82£ã
\83‹
\82¯ã
\83\88ã
\83ªã
\81«ã
\82¢ã
\83\81E
\81Eã
\83ã
\83¼ã
\83\89ã
\81\97ã
\81¾ã
\81\99ã
\80\81E/p>
3135 <p>æ
\96°ã
\81\97ã
\81\84weblogã
\81®ä½
\9cæ
\81Eã
\82\92å®
\8cäº
\81E
\81\99ã
\82\8bã
\81\9fã
\82\81ã
\81«ã
\81¯ã
\80\81ä¸
\8bã
\81«ã
\81\93ã
\81Eã
\83\95ã
\82¡ã
\82¤ã
\83«ã
\81®URLã
\82\92å
\81Eå
\8a\9bã
\81\97ã
\81¦ã
\81\8fã
\81 ã
\81\95ã
\81\84ã
\80\81E(ã
\81\99ã
\81§ã
\81«ç
\94¨æ
\84\8fã
\81\97ã
\81\9få
\80¤ã
\81§å
\90\88ã
\81£ã
\81¦ã
\81\81E
\82\8bã
\81¨ã
\81¯æ
\80\9dã
\81\84ã
\81¾ã
\81\99ã
\81\8cä¿
\9d証ã
\81¯ã
\81\97ã
\81¾ã
\81\9bã
\82\93):</p>
3138 <form action="index.php" method="post"><div>
3139 <input type="hidden" name="action" value="addnewlog2" />
3140 <?php $manager->addTicketHidden() ?>
3141 <input type="hidden" name="blogid" value="<?php echo intval($blogid)?>" />
3143 <td><?php echo _EBLOG_URL?></td>
3144 <td><input name="url" maxlength="100" size="40" value="<?php echo htmlspecialchars($CONF['IndexURL'].$bshortname.'.php')?>" /></td>
3146 <td><?php echo _EBLOG_CREATE?></td>
3147 <td><input type="submit" value="<?php echo _EBLOG_CREATE_BTN?>" onclick="return checkSubmit();" /></td>
3151 <h3><a id="skins">æ
\96¹æ³
\81E2: ç
\8f¾å
\9c¨ä½¿ç
\94¨ã
\81\97ã
\81¦ã
\81\81E
\82\8bã
\82¹ã
\82ã
\83³ã
\81«æ
\96°ã
\81\97ã
\81\84weblogã
\82\92å±
\95é
\96\8bã
\81\99ã
\82\8bè¨
\98è¿°ã
\82\92å
\8a ã
\81\88ã
\82\8b</a></h3>
3153 <p>æ
\96°ã
\81\97ã
\81\84weblogã
\81®ä½
\9cæ
\81Eã
\82\92å®
\8cäº
\81E
\81\99ã
\82\8bã
\81\9fã
\82\81ã
\81«ã
\81¯ã
\80\81ä¸
\8bã
\81«URLã
\82\92å
\81Eå
\8a\9bã
\81\97ã
\81¦ã
\81\8fã
\81 ã
\81\95ã
\81\84ã
\80\81E(大æ
\8aµã
\81¯æ
\97¢å
\98blogã
\81¨å
\90\8cã
\81\98URL)</p>
3156 <form action="index.php" method="post"><div>
3157 <input type="hidden" name="action" value="addnewlog2" />
3158 <?php $manager->addTicketHidden() ?>
3159 <input type="hidden" name="blogid" value="<?php echo intval($blogid)?>" />
3161 <td><?php echo _EBLOG_URL?></td>
3162 <td><input name="url" maxlength="100" size="40" /></td>
3164 <td><?php echo _EBLOG_CREATE?></td>
3165 <td><input type="submit" value="<?php echo _EBLOG_CREATE_BTN?>" onclick="return checkSubmit();" /></td>
3169 <?php $this->pagefoot();
3173 function action_addnewlog2() {
3174 global $member, $manager;
3176 $member->blogAdminRights($blogid) or $this->disallow();
3178 $burl = requestVar('url');
3179 $blogid = intRequestVar('blogid');
3181 $blog =& $manager->getBlog($blogid);
3182 $blog->setURL(trim($burl));
3183 $blog->writeSettings();
3185 $this->action_overview(_MSG_NEWBLOG);
3188 function action_skinieoverview() {
3189 global $member, $DIR_LIBS, $manager;
3191 $member->isAdmin() or $this->disallow();
3193 // load skinie class
3194 include_once($DIR_LIBS . 'skinie.php');
3198 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
3201 <h2><?php echo _SKINIE_TITLE_IMPORT?></h2>
3203 <p><label for="skinie_import_local"><?php echo _SKINIE_LOCAL?></label>
3204 <?php global $DIR_SKINS;
3206 $candidates = SKINIMPORT::searchForCandidates($DIR_SKINS);
3208 if (sizeof($candidates) > 0) {
3210 <form method="post" action="index.php"><div>
3211 <input type="hidden" name="action" value="skinieimport" />
3212 <?php $manager->addTicketHidden() ?>
3213 <input type="hidden" name="mode" value="file" />
3214 <select name="skinfile" id="skinie_import_local">
3215 <?php foreach ($candidates as $skinname => $skinfile) {
3216 $html = htmlspecialchars($skinfile);
3217 echo '<option value="',$html,'">',$skinname,'</option>';
3221 <input type="submit" value="<?php echo _SKINIE_BTN_IMPORT?>" />
3224 echo _SKINIE_NOCANDIDATES;
3229 <p><em><?php echo _OR?></em></p>
3231 <form method="post" action="index.php"><p>
3232 <?php $manager->addTicketHidden() ?>
3233 <input type="hidden" name="action" value="skinieimport" />
3234 <input type="hidden" name="mode" value="url" />
3235 <label for="skinie_import_url"><?php echo _SKINIE_FROMURL?></label>
3236 <input type="text" name="skinfile" id="skinie_import_url" size="60" value="http://" />
3237 <input type="submit" value="<?php echo _SKINIE_BTN_IMPORT?>" />
3241 <h2><?php echo _SKINIE_TITLE_EXPORT?></h2>
3242 <form method="post" action="index.php"><div>
3243 <input type="hidden" name="action" value="skinieexport" />
3244 <?php $manager->addTicketHidden() ?>
3246 <p><?php echo _SKINIE_EXPORT_INTRO?></p>
3249 <th colspan="2"><?php echo _SKINIE_EXPORT_SKINS?></th>
3251 <?php // show list of skins
3252 $res = sql_query('SELECT * FROM '.sql_table('skin_desc'));
3253 while ($skinObj = mysql_fetch_object($res)) {
3254 $id = 'skinexp' . $skinObj->sdnumber;
3255 echo '<td><input type="checkbox" name="skin[',$skinObj->sdnumber,']" id="',$id,'" />';
3256 echo '<label for="',$id,'">',htmlspecialchars($skinObj->sdname),'</label></td>';
3257 echo '<td>',htmlspecialchars($skinObj->sddesc),'</td>';
3261 echo '<th colspan="2">',_SKINIE_EXPORT_TEMPLATES,'</th></tr><tr>';
3263 // show list of templates
3264 $res = sql_query('SELECT * FROM '.sql_table('template_desc'));
3265 while ($templateObj = mysql_fetch_object($res)) {
3266 $id = 'templateexp' . $templateObj->tdnumber;
3267 echo '<td><input type="checkbox" name="template[',$templateObj->tdnumber,']" id="',$id,'" />';
3268 echo '<label for="',$id,'">',htmlspecialchars($templateObj->tdname),'</label></td>';
3269 echo '<td>',htmlspecialchars($templateObj->tddesc),'</td>';
3274 <th colspan="2"><?php echo _SKINIE_EXPORT_EXTRA?></th>
3276 <td colspan="2"><textarea cols="40" rows="5" name="info"></textarea></td>
3278 <th colspan="2"><?php echo _SKINIE_TITLE_EXPORT?></th>
3280 <td colspan="2"><input type="submit" value="<?php echo _SKINIE_BTN_EXPORT?>" /></td>
3289 function action_skinieimport() {
3290 global $member, $DIR_LIBS, $DIR_SKINS, $manager;
3292 $member->isAdmin() or $this->disallow();
3294 // load skinie class
3295 include_once($DIR_LIBS . 'skinie.php');
3297 $skinFileRaw= postVar('skinfile');
3298 $mode = postVar('mode');
3300 $importer =& new SKINIMPORT();
3302 // get full filename
3303 if ($mode == 'file')
3305 $skinFile = $DIR_SKINS . $skinFileRaw . '/skinbackup.xml';
3307 // backwards compatibilty (in v2.0, exports were saved as skindata.xml)
3308 if (!file_exists($skinFile))
3309 $skinFile = $DIR_SKINS . $skinFileRaw . '/skindata.xml';
3311 $skinFile = $skinFileRaw;
3314 // read only metadata
3315 $error = $importer->readFile($skinFile, 1);
3318 if ($error) $this->error($error);
3322 echo '<p><a href="index.php?action=skinieoverview">(',_BACK,')</a></p>';
3324 <h2><?php echo _SKINIE_CONFIRM_TITLE?></h2>
3327 <li><p><strong><?php echo _SKINIE_INFO_GENERAL?></strong> <?php echo htmlspecialchars($importer->getInfo())?></p></li>
3328 <li><p><strong><?php echo _SKINIE_INFO_SKINS?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->getSkinNames())?></p></li>
3329 <li><p><strong><?php echo _SKINIE_INFO_TEMPLATES?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->getTemplateNames())?></p></li>
3330 <li><p><strong style="color: red;"><?php echo _SKINIE_INFO_SKINCLASH?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->checkSkinNameClashes())?></p></li>
3331 <li><p><strong style="color: red;"><?php echo _SKINIE_INFO_TEMPLCLASH?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->checkTemplateNameClashes())?></p></li>
3334 <form method="post" action="index.php"><div>
3335 <input type="hidden" name="action" value="skiniedoimport" />
3336 <?php $manager->addTicketHidden() ?>
3337 <input type="hidden" name="skinfile" value="<?php echo htmlspecialchars(postVar('skinfile'))?>" />
3338 <input type="hidden" name="mode" value="<?php echo htmlspecialchars($mode)?>" />
3339 <input type="submit" value="<?php echo _SKINIE_CONFIRM_IMPORT?>" />
3341 <input type="checkbox" name="overwrite" value="1" id="cb_overwrite" /><label for="cb_overwrite"><?php echo _SKINIE_CONFIRM_OVERWRITE?></label>
3349 function action_skiniedoimport() {
3350 global $member, $DIR_LIBS, $DIR_SKINS;
3352 $member->isAdmin() or $this->disallow();
3354 // load skinie class
3355 include_once($DIR_LIBS . 'skinie.php');
3357 $skinFileRaw= postVar('skinfile');
3358 $mode = postVar('mode');
3360 $allowOverwrite = intPostVar('overwrite');
3362 // get full filename
3363 if ($mode == 'file')
3365 $skinFile = $DIR_SKINS . $skinFileRaw . '/skinbackup.xml';
3367 // backwards compatibilty (in v2.0, exports were saved as skindata.xml)
3368 if (!file_exists($skinFile))
3369 $skinFile = $DIR_SKINS . $skinFileRaw . '/skindata.xml';
3372 $skinFile = $skinFileRaw;
3375 $importer =& new SKINIMPORT();
3377 $error = $importer->readFile($skinFile);
3380 $this->error($error);
3382 $error = $importer->writeToDatabase($allowOverwrite);
3385 $this->error($error);
3389 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
3391 <h2><?php echo _SKINIE_DONE?></h2>
3394 <li><p><strong><?php echo _SKINIE_INFO_GENERAL?></strong> <?php echo htmlspecialchars($importer->getInfo())?></p></li>
3395 <li><p><strong><?php echo _SKINIE_INFO_IMPORTEDSKINS?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->getSkinNames())?></p></li>
3396 <li><p><strong><?php echo _SKINIE_INFO_IMPORTEDTEMPLS?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->getTemplateNames())?></p></li>
3399 <?php $this->pagefoot();
3403 function action_skinieexport() {
3404 global $member, $DIR_LIBS;
3406 $member->isAdmin() or $this->disallow();
3408 // load skinie class
3409 include_once($DIR_LIBS . 'skinie.php');
3411 $aSkins = requestIntArray('skin');
3412 $aTemplates = requestIntArray('template');
3414 if (!is_array($aTemplates)) $aTemplates = array();
3415 if (!is_array($aSkins)) $aSkins = array();
3417 $skinList = array_keys($aSkins);
3418 $templateList = array_keys($aTemplates);
3420 $info = postVar('info');
3422 $exporter =& new SKINEXPORT();
3423 foreach ($skinList as $skinId) {
3424 $exporter->addSkin($skinId);
3426 foreach ($templateList as $templateId) {
3427 $exporter->addTemplate($templateId);
3429 $exporter->setInfo($info);
3431 $exporter->export();
3434 function action_templateoverview() {
3435 global $member, $manager;
3437 $member->isAdmin() or $this->disallow();
3441 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
3443 echo '<h2>' . _TEMPLATE_TITLE . '</h2>';
3444 echo '<h3>' . _TEMPLATE_AVAILABLE_TITLE . '</h3>';
3446 $query = 'SELECT * FROM '.sql_table('template_desc').' ORDER BY tdname';
3447 $template['content'] = 'templatelist';
3448 $template['tabindex'] = 10;
3449 showlist($query,'table',$template);
3451 echo '<h3>' . _TEMPLATE_NEW_TITLE . '</h3>';
3454 <form method="post" action="index.php"><div>
3456 <input name="action" value="templatenew" type="hidden" />
3457 <?php $manager->addTicketHidden() ?>
3459 <td><?php echo _TEMPLATE_NAME?> <?php help('shortnames');?></td>
3460 <td><input name="name" tabindex="10010" maxlength="20" size="20" /></td>
3462 <td><?php echo _TEMPLATE_DESC?></td>
3463 <td><input name="desc" tabindex="10020" maxlength="200" size="50" /></td>
3465 <td><?php echo _TEMPLATE_CREATE?></td>
3466 <td><input type="submit" tabindex="10030" value="<?php echo _TEMPLATE_CREATE_BTN?>" onclick="return checkSubmit();" /></td>
3475 function action_templateedit($msg = '') {
3476 global $member, $manager;
3478 $templateid = intRequestVar('templateid');
3480 $member->isAdmin() or $this->disallow();
3482 $extrahead = '<script type="text/javascript" src="javascript/templateEdit.js"></script>';
3483 $extrahead .= '<script type="text/javascript">setTemplateEditText("'.addslashes(_EDITTEMPLATE_EMPTY).'");</script>';
3485 $this->pagehead($extrahead);
3487 $templatename = TEMPLATE::getNameFromId($templateid);
3488 $templatedescription = TEMPLATE::getDesc($templateid);
3489 $template =& $manager->getTemplate($templatename);
3493 <a href="index.php?action=templateoverview">(<?php echo _TEMPLATE_BACK?>)</a>
3496 <h2><?php echo _TEMPLATE_EDIT_TITLE?> '<?php echo $templatename; ?>'</h2>
3498 <?php if ($msg) echo "<p>"._MESSAGE.": $msg</p>";
3501 <p><?php echo _TEMPLATE_EDIT_MSG?></p>
3503 <form method="post" action="index.php">
3506 <input type="hidden" name="action" value="templateupdate" />
3507 <?php $manager->addTicketHidden() ?>
3508 <input type="hidden" name="templateid" value="<?php echo $templateid; ?>" />
3511 <th colspan="2"><?php echo _TEMPLATE_SETTINGS?></th>
3513 <td><?php echo _TEMPLATE_NAME?> <?php help('shortnames');?></td>
3514 <td><input name="tname" tabindex="4" size="20" maxlength="20" value="<?php echo htmlspecialchars($templatename) ?>" /></td>
3516 <td><?php echo _TEMPLATE_DESC?></td>
3517 <td><input name="tdesc" tabindex="5" size="50" maxlength="200" value="<?php echo htmlspecialchars($templatedescription) ?>" /></td>
3519 <th colspan="2"><?php echo _TEMPLATE_UPDATE?></th>
3521 <td><?php echo _TEMPLATE_UPDATE?></td>
3523 <input type="submit" tabindex="6" value="<?php echo _TEMPLATE_UPDATE_BTN?>" onclick="return checkSubmit();" />
3524 <input type="reset" tabindex="7" value="<?php echo _TEMPLATE_RESET_BTN?>" />
3527 <th colspan="2"><?php echo _TEMPLATE_ITEMS?> <?php help('templateitems'); ?></th>
3528 <?php $this->_templateEditRow($template, _TEMPLATE_ITEMHEADER, 'ITEM_HEADER', '', 8);
3529 $this->_templateEditRow($template, _TEMPLATE_ITEMBODY, 'ITEM', '', 9, 1);
3530 $this->_templateEditRow($template, _TEMPLATE_ITEMFOOTER, 'ITEM_FOOTER', '', 10);
3531 $this->_templateEditRow($template, _TEMPLATE_MORELINK, 'MORELINK', 'morelink', 20);
3532 $this->_templateEditRow($template, _TEMPLATE_EDITLINK, 'EDITLINK', 'editlink', 25);
3533 $this->_templateEditRow($template, _TEMPLATE_NEW, 'NEW', 'new', 30);
3536 <th colspan="2"><?php echo _TEMPLATE_COMMENTS_ANY?> <?php help('templatecomments'); ?></th>
3537 <?php $this->_templateEditRow($template, _TEMPLATE_CHEADER, 'COMMENTS_HEADER', 'commentheaders', 40);
3538 $this->_templateEditRow($template, _TEMPLATE_CBODY, 'COMMENTS_BODY', 'commentbody', 50, 1);
3539 $this->_templateEditRow($template, _TEMPLATE_CFOOTER, 'COMMENTS_FOOTER', 'commentheaders', 60);
3540 $this->_templateEditRow($template, _TEMPLATE_CONE, 'COMMENTS_ONE', 'commentwords', 70);
3541 $this->_templateEditRow($template, _TEMPLATE_CMANY, 'COMMENTS_MANY', 'commentwords', 80);
3542 $this->_templateEditRow($template, _TEMPLATE_CMORE, 'COMMENTS_CONTINUED', 'commentcontinued', 90);
3543 $this->_templateEditRow($template, _TEMPLATE_CMEXTRA, 'COMMENTS_AUTH', 'memberextra', 100);
3546 <th colspan="2"><?php echo _TEMPLATE_COMMENTS_NONE?> <?php help('templatecomments'); ?></th>
3548 $this->_templateEditRow($template, _TEMPLATE_CNONE, 'COMMENTS_NONE', '', 110);
3551 <th colspan="2"><?php echo _TEMPLATE_COMMENTS_TOOMUCH?> <?php help('templatecomments'); ?></th>
3552 <?php $this->_templateEditRow($template, _TEMPLATE_CTOOMUCH, 'COMMENTS_TOOMUCH', '', 120);
3555 <th colspan="2"><?php echo _TEMPLATE_ARCHIVELIST?> <?php help('templatearchivelists'); ?></th>
3556 <?php $this->_templateEditRow($template, _TEMPLATE_AHEADER, 'ARCHIVELIST_HEADER', '', 130);
3557 $this->_templateEditRow($template, _TEMPLATE_AITEM, 'ARCHIVELIST_LISTITEM', '', 140);
3558 $this->_templateEditRow($template, _TEMPLATE_AFOOTER, 'ARCHIVELIST_FOOTER', '', 150);
3561 <th colspan="2"><?php echo _TEMPLATE_CATEGORYLIST?> <?php help('templatecategorylists'); ?></th>
3562 <?php $this->_templateEditRow($template, _TEMPLATE_CATHEADER, 'CATLIST_HEADER', '', 160);
3563 $this->_templateEditRow($template, _TEMPLATE_CATITEM, 'CATLIST_LISTITEM', '', 170);
3564 $this->_templateEditRow($template, _TEMPLATE_CATFOOTER, 'CATLIST_FOOTER', '', 180);
3567 <th colspan="2"><?php echo _TEMPLATE_DATETIME?></th>
3568 <?php $this->_templateEditRow($template, _TEMPLATE_DHEADER, 'DATE_HEADER', 'dateheads', 190);
3569 $this->_templateEditRow($template, _TEMPLATE_DFOOTER, 'DATE_FOOTER', 'dateheads', 200);
3570 $this->_templateEditRow($template, _TEMPLATE_DFORMAT, 'FORMAT_DATE', 'datetime', 210);
3571 $this->_templateEditRow($template, _TEMPLATE_TFORMAT, 'FORMAT_TIME', 'datetime', 220);
3572 $this->_templateEditRow($template, _TEMPLATE_LOCALE, 'LOCALE', 'locale', 230);
3575 <th colspan="2"><?php echo _TEMPLATE_IMAGE?> <?php help('templatepopups'); ?></th>
3576 <?php $this->_templateEditRow($template, _TEMPLATE_PCODE, 'POPUP_CODE', '', 240);
3577 $this->_templateEditRow($template, _TEMPLATE_ICODE, 'IMAGE_CODE', '', 250);
3578 $this->_templateEditRow($template, _TEMPLATE_MCODE, 'MEDIA_CODE', '', 260);
3581 <th colspan="2"><?php echo _TEMPLATE_SEARCH?></th>
3582 <?php $this->_templateEditRow($template, _TEMPLATE_SHIGHLIGHT, 'SEARCH_HIGHLIGHT', 'highlight',270);
3583 $this->_templateEditRow($template, _TEMPLATE_SNOTFOUND, 'SEARCH_NOTHINGFOUND', 'nothingfound',280);
3586 <th colspan="2"><?php echo _TEMPLATE_UPDATE?></th>
3588 <td><?php echo _TEMPLATE_UPDATE?></td>
3590 <input type="submit" tabindex="290" value="<?php echo _TEMPLATE_UPDATE_BTN?>" onclick="return checkSubmit();" />
3591 <input type="reset" tabindex="300" value="<?php echo _TEMPLATE_RESET_BTN?>" />
3601 function _templateEditRow(&$template, $description, $name, $help = '', $tabindex = 0, $big = 0) {
3605 <td><?php echo $description?> <?php if ($help) help('template'.$help); ?></td>
3606 <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>
3610 function action_templateupdate() {
3613 $templateid = intRequestVar('templateid');
3615 $member->isAdmin() or $this->disallow();
3617 $name = postVar('tname');
3618 $desc = postVar('tdesc');
3620 if (!isValidTemplateName($name))
3621 $this->error(_ERROR_BADTEMPLATENAME);
3623 if ((TEMPLATE::getNameFromId($templateid) != $name) && TEMPLATE::exists($name))
3624 $this->error(_ERROR_DUPTEMPLATENAME);
3627 $name = addslashes($name);
3628 $desc = addslashes($desc);
3630 // 1. Remove all template parts
3631 $query = 'DELETE FROM '.sql_table('template').' WHERE tdesc=' . $templateid;
3634 // 2. Update description
3635 $query = 'UPDATE '.sql_table('template_desc').' SET'
3636 . " tdname='" . $name . "',"
3637 . " tddesc='" . $desc . "'"
3638 . " WHERE tdnumber=" . $templateid;
3641 // 3. Add non-empty template parts
3642 $this->addToTemplate($templateid, 'ITEM_HEADER', postVar('ITEM_HEADER'));
3643 $this->addToTemplate($templateid, 'ITEM', postVar('ITEM'));
3644 $this->addToTemplate($templateid, 'ITEM_FOOTER', postVar('ITEM_FOOTER'));
3645 $this->addToTemplate($templateid, 'MORELINK', postVar('MORELINK'));
3646 $this->addToTemplate($templateid, 'EDITLINK', postVar('EDITLINK'));
3647 $this->addToTemplate($templateid, 'NEW', postVar('NEW'));
3648 $this->addToTemplate($templateid, 'COMMENTS_HEADER', postVar('COMMENTS_HEADER'));
3649 $this->addToTemplate($templateid, 'COMMENTS_BODY', postVar('COMMENTS_BODY'));
3650 $this->addToTemplate($templateid, 'COMMENTS_FOOTER', postVar('COMMENTS_FOOTER'));
3651 $this->addToTemplate($templateid, 'COMMENTS_CONTINUED', postVar('COMMENTS_CONTINUED'));
3652 $this->addToTemplate($templateid, 'COMMENTS_TOOMUCH', postVar('COMMENTS_TOOMUCH'));
3653 $this->addToTemplate($templateid, 'COMMENTS_AUTH', postVar('COMMENTS_AUTH'));
3654 $this->addToTemplate($templateid, 'COMMENTS_ONE', postVar('COMMENTS_ONE'));
3655 $this->addToTemplate($templateid, 'COMMENTS_MANY', postVar('COMMENTS_MANY'));
3656 $this->addToTemplate($templateid, 'COMMENTS_NONE', postVar('COMMENTS_NONE'));
3657 $this->addToTemplate($templateid, 'ARCHIVELIST_HEADER', postVar('ARCHIVELIST_HEADER'));
3658 $this->addToTemplate($templateid, 'ARCHIVELIST_LISTITEM', postVar('ARCHIVELIST_LISTITEM'));
3659 $this->addToTemplate($templateid, 'ARCHIVELIST_FOOTER', postVar('ARCHIVELIST_FOOTER'));
3660 $this->addToTemplate($templateid, 'CATLIST_HEADER', postVar('CATLIST_HEADER'));
3661 $this->addToTemplate($templateid, 'CATLIST_LISTITEM', postVar('CATLIST_LISTITEM'));
3662 $this->addToTemplate($templateid, 'CATLIST_FOOTER', postVar('CATLIST_FOOTER'));
3663 $this->addToTemplate($templateid, 'DATE_HEADER', postVar('DATE_HEADER'));
3664 $this->addToTemplate($templateid, 'DATE_FOOTER', postVar('DATE_FOOTER'));
3665 $this->addToTemplate($templateid, 'FORMAT_DATE', postVar('FORMAT_DATE'));
3666 $this->addToTemplate($templateid, 'FORMAT_TIME', postVar('FORMAT_TIME'));
3667 $this->addToTemplate($templateid, 'LOCALE', postVar('LOCALE'));
3668 $this->addToTemplate($templateid, 'SEARCH_HIGHLIGHT', postVar('SEARCH_HIGHLIGHT'));
3669 $this->addToTemplate($templateid, 'SEARCH_NOTHINGFOUND', postVar('SEARCH_NOTHINGFOUND'));
3670 $this->addToTemplate($templateid, 'POPUP_CODE', postVar('POPUP_CODE'));
3671 $this->addToTemplate($templateid, 'MEDIA_CODE', postVar('MEDIA_CODE'));
3672 $this->addToTemplate($templateid, 'IMAGE_CODE', postVar('IMAGE_CODE'));
3675 // jump back to template edit
3676 $this->action_templateedit(_TEMPLATE_UPDATED);
3680 function addToTemplate($id, $partname, $content) {
3681 $partname = addslashes($partname);
3682 $content = addslashes($content);
3686 // don't add empty parts:
3687 if (!trim($content)) return -1;
3689 $query = 'INSERT INTO '.sql_table('template')." (tdesc, tpartname, tcontent) "
3690 . "VALUES ($id, '$partname', '$content')";
3691 mysql_query($query) or die("Query error: " . mysql_error());
3692 return mysql_insert_id();
3695 function action_templatedelete() {
3696 global $member, $manager;
3698 $member->isAdmin() or $this->disallow();
3700 $templateid = intRequestVar('templateid');
3701 // TODO: check if template can be deleted
3705 $name = TEMPLATE::getNameFromId($templateid);
3706 $desc = TEMPLATE::getDesc($templateid);
3709 <h2><?php echo _DELETE_CONFIRM?></h2>
3712 <?php echo _CONFIRMTXT_TEMPLATE?><b><?php echo $name?></b> (<?php echo htmlspecialchars($desc) ?>)
3715 <form method="post" action="index.php"><div>
3716 <input type="hidden" name="action" value="templatedeleteconfirm" />
3717 <?php $manager->addTicketHidden() ?>
3718 <input type="hidden" name="templateid" value="<?php echo $templateid ?>" />
3719 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
3725 function action_templatedeleteconfirm() {
3726 global $member, $manager;
3728 $templateid = intRequestVar('templateid');
3730 $member->isAdmin() or $this->disallow();
3732 $manager->notify('PreDeleteTemplate', array('templateid' => $templateid));
3734 // 1. delete description
3735 sql_query('DELETE FROM '.sql_table('template_desc').' WHERE tdnumber=' . $templateid);
3738 sql_query('DELETE FROM '.sql_table('template').' WHERE tdesc=' . $templateid);
3740 $manager->notify('PostDeleteTemplate', array('templateid' => $templateid));
3742 $this->action_templateoverview();
3745 function action_templatenew() {
3748 $member->isAdmin() or $this->disallow();
3750 $name = postVar('name');
3751 $desc = postVar('desc');
3753 if (!isValidTemplateName($name))
3754 $this->error(_ERROR_BADTEMPLATENAME);
3756 if (TEMPLATE::exists($name))
3757 $this->error(_ERROR_DUPTEMPLATENAME);
3759 $newTemplateId = TEMPLATE::createNew($name, $desc);
3761 $this->action_templateoverview();
3764 function action_templateclone() {
3767 $templateid = intRequestVar('templateid');
3769 $member->isAdmin() or $this->disallow();
3771 // 1. read old template
3772 $name = TEMPLATE::getNameFromId($templateid);
3773 $desc = TEMPLATE::getDesc($templateid);
3775 // 2. create desc thing
3776 $name = "cloned" . $name;
3778 // if a template with that name already exists:
3779 if (TEMPLATE::exists($name)) {
3781 while (TEMPLATE::exists($name . $i))
3786 $newid = TEMPLATE::createNew($name, $desc);
3789 // go through parts of old template and add them to the new one
3790 $res = sql_query('SELECT tpartname, tcontent FROM '.sql_table('template').' WHERE tdesc=' . $templateid);
3791 while ($o = mysql_fetch_object($res)) {
3792 $this->addToTemplate($newid, $o->tpartname, $o->tcontent);
3795 $this->action_templateoverview();
3798 function action_skinoverview() {
3799 global $member, $manager;
3801 $member->isAdmin() or $this->disallow();
3805 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
3807 echo '<h2>' . _SKIN_EDIT_TITLE . '</h2>';
3809 echo '<h3>' . _SKIN_AVAILABLE_TITLE . '</h3>';
3811 $query = 'SELECT * FROM '.sql_table('skin_desc').' ORDER BY sdname';
3812 $template['content'] = 'skinlist';
3813 $template['tabindex'] = 10;
3814 showlist($query,'table',$template);
3816 echo '<h3>' . _SKIN_NEW_TITLE . '</h3>';
3819 <form method="post" action="index.php">
3822 <input name="action" value="skinnew" type="hidden" />
3823 <?php $manager->addTicketHidden() ?>
3825 <td><?php echo _SKIN_NAME?> <?php help('shortnames');?></td>
3826 <td><input name="name" tabindex="10010" maxlength="20" size="20" /></td>
3828 <td><?php echo _SKIN_DESC?></td>
3829 <td><input name="desc" tabindex="10020" maxlength="200" size="50" /></td>
3831 <td><?php echo _SKIN_CREATE?></td>
3832 <td><input type="submit" tabindex="10030" value="<?php echo _SKIN_CREATE_BTN?>" onclick="return checkSubmit();" /></td>
3842 function action_skinnew() {
3845 $member->isAdmin() or $this->disallow();
3847 $name = trim(postVar('name'));
3848 $desc = trim(postVar('desc'));
3850 if (!isValidSkinName($name))
3851 $this->error(_ERROR_BADSKINNAME);
3853 if (SKIN::exists($name))
3854 $this->error(_ERROR_DUPSKINNAME);
3856 $newId = SKIN::createNew($name, $desc);
3858 $this->action_skinoverview();
3861 function action_skinedit() {
3862 global $member, $manager;
3864 $skinid = intRequestVar('skinid');
3866 $member->isAdmin() or $this->disallow();
3868 $skin =& new SKIN($skinid);
3873 <a href="index.php?action=skinoverview">(<?php echo _SKIN_BACK?>)</a>
3875 <h2><?php echo _SKIN_EDITONE_TITLE?> '<?php echo $skin->getName() ?>'</h2>
3877 <h3><?php echo _SKIN_PARTS_TITLE?></h3>
3878 <?php echo _SKIN_PARTS_MSG?>
3880 <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>
3881 <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>
3882 <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>
3883 <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>
3884 <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>
3885 <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>
3886 <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>
3887 <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>
3890 <h3><?php echo _SKIN_GENSETTINGS_TITLE?></h3>
3891 <form method="post" action="index.php">
3894 <input type="hidden" name="action" value="skineditgeneral" />
3895 <?php $manager->addTicketHidden() ?>
3896 <input type="hidden" name="skinid" value="<?php echo $skinid ?>" />
3898 <td><?php echo _SKIN_NAME?> <?php help('shortnames');?></td>
3899 <td><input name="name" tabindex="90" value="<?php echo htmlspecialchars($skin->getName()) ?>" maxlength="20" size="20" /></td>
3901 <td><?php echo _SKIN_DESC?></td>
3902 <td><input name="desc" tabindex="100" value="<?php echo htmlspecialchars($skin->getDescription()) ?>" maxlength="200" size="50" /></td>
3904 <td><?php echo _SKIN_TYPE?></td>
3905 <td><input name="type" tabindex="110" value="<?php echo htmlspecialchars($skin->getContentType()) ?>" maxlength="40" size="20" /></td>
3907 <td><?php echo _SKIN_INCLUDE_MODE?> <?php help('includemode')?></td>
3908 <td><?php $this->input_yesno('inc_mode',$skin->getIncludeMode(),120,'skindir','normal',_PARSER_INCMODE_SKINDIR,_PARSER_INCMODE_NORMAL);?></td>
3910 <td><?php echo _SKIN_INCLUDE_PREFIX?> <?php help('includeprefix')?></td>
3911 <td><input name="inc_prefix" tabindex="130" value="<?php echo htmlspecialchars($skin->getIncludePrefix()) ?>" maxlength="40" size="20" /></td>
3913 <td><?php echo _SKIN_CHANGE?></td>
3914 <td><input type="submit" tabindex="140" value="<?php echo _SKIN_CHANGE_BTN?>" onclick="return checkSubmit();" /></td>
3921 <?php $this->pagefoot();
3924 function action_skineditgeneral() {
3927 $skinid = intRequestVar('skinid');
3929 $member->isAdmin() or $this->disallow();
3931 $name = postVar('name');
3932 $desc = postVar('desc');
3933 $type = postVar('type');
3934 $inc_mode = postVar('inc_mode');
3935 $inc_prefix = postVar('inc_prefix');
3937 $skin =& new SKIN($skinid);
3940 if (!isValidSkinName($name))
3941 $this->error(_ERROR_BADSKINNAME);
3943 if (($skin->getName() != $name) && SKIN::exists($name))
3944 $this->error(_ERROR_DUPSKINNAME);
3946 if (!$type) $type = 'text/html';
3947 if (!$inc_mode) $inc_mode = 'normal';
3949 // 2. Update description
3950 $skin->updateGeneralInfo($name, $desc, $type, $inc_mode, $inc_prefix);
3952 $this->action_skinedit();
3956 function action_skinedittype($msg = '') {
3957 global $member, $manager;
3959 $skinid = intRequestVar('skinid');
3960 $type = requestVar('type');
3962 $member->isAdmin() or $this->disallow();
3964 $skin =& new SKIN($skinid);
3966 $friendlyNames = SKIN::getFriendlyNames();
3970 <p>(<a href="index.php?action=skinoverview"><?php echo _SKIN_GOBACK?></a>)</p>
3972 <h2><?php echo _SKIN_EDITPART_TITLE?> '<?php echo $skin->getName() ?>': <?php echo $friendlyNames[$type] ?></h2>
3974 <?php if ($msg) echo "<p>"._MESSAGE.": $msg</p>";
3978 <form method="post" action="index.php">
3981 <input type="hidden" name="action" value="skinupdate" />
3982 <?php $manager->addTicketHidden() ?>
3983 <input type="hidden" name="skinid" value="<?php echo $skinid ?>" />
3984 <input type="hidden" name="type" value="<?php echo $type ?>" />
3986 <input type="submit" value="<?php echo _SKIN_UPDATE_BTN?>" onclick="return checkSubmit();" />
3987 <input type="reset" value="<?php echo _SKIN_RESET_BTN?>" />
3988 (skin type: <?php echo $friendlyNames[$type] ?>)
3989 <?php help('skinpart' . $type);?>
3992 <textarea class="skinedit" tabindex="10" rows="20" cols="80" name="content"><?php echo htmlspecialchars($skin->getContent($type)) ?></textarea>
3995 <input type="submit" tabindex="20" value="<?php echo _SKIN_UPDATE_BTN?>" onclick="return checkSubmit();" />
3996 <input type="reset" value="<?php echo _SKIN_RESET_BTN?>" />
3997 (skin type: <?php echo $friendlyNames[$type] ?>)
4000 <?php echo _SKIN_ALLOWEDVARS?>
4001 <?php $actions = SKIN::getAllowedActionsForType($type);
4005 while ($current = array_shift($actions)) {
4006 // skip deprecated vars
4007 if ($current == 'ifcat') continue;
4008 if ($current == 'imagetext') continue;
4009 if ($current == 'vars') continue;
4011 echo helplink('skinvar-' . $current) . "$current</a>";
4012 if (count($actions) != 0) echo ", ";
4017 <?php $query = 'SELECT bshortname, bname FROM '.sql_table('blog');
4018 showlist($query,'table',array('content'=>'shortblognames'));
4023 <?php $query = 'SELECT tdname as name, tddesc as description FROM '.sql_table('template_desc');
4024 showlist($query,'table',array('content'=>'shortnames'));
4032 <?php $this->pagefoot();
4035 function action_skinupdate() {
4038 $skinid = intRequestVar('skinid');
4039 $content = trim(postVar('content'));
4040 $type = postVar('type');
4042 $member->isAdmin() or $this->disallow();
4044 $skin =& new SKIN($skinid);
4045 $skin->update($type, $content);
4047 $this->action_skinedittype(_SKIN_UPDATED);
4050 function action_skindelete() {
4051 global $member, $manager, $CONF;
4053 $skinid = intRequestVar('skinid');
4055 $member->isAdmin() or $this->disallow();
4057 // don't allow default skin to be deleted
4058 if ($skinid == $CONF['BaseSkin'])
4059 $this->error(_ERROR_DEFAULTSKIN);
4061 // don't allow deletion of default skins for blogs
4062 $query = 'SELECT bname FROM '.sql_table('blog').' WHERE bdefskin=' . $skinid;
4063 $r = sql_query($query);
4064 if ($o = mysql_fetch_object($r))
4065 $this->error(_ERROR_SKINDEFDELETE . $o->bname);
4069 $skin =& new SKIN($skinid);
4070 $name = $skin->getName();
4071 $desc = $skin->getDescription();
4074 <h2><?php echo _DELETE_CONFIRM?></h2>
4077 <?php echo _CONFIRMTXT_SKIN?><b><?php echo $name ?></b> (<?php echo htmlspecialchars($desc)?>)
4080 <form method="post" action="index.php"><div>
4081 <input type="hidden" name="action" value="skindeleteconfirm" />
4082 <?php $manager->addTicketHidden() ?>
4083 <input type="hidden" name="skinid" value="<?php echo $skinid ?>" />
4084 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
4090 function action_skindeleteconfirm() {
4091 global $member, $CONF, $manager;
4093 $skinid = intRequestVar('skinid');
4095 $member->isAdmin() or $this->disallow();
4097 // don't allow default skin to be deleted
4098 if ($skinid == $CONF['BaseSkin'])
4099 $this->error(_ERROR_DEFAULTSKIN);
4101 // don't allow deletion of default skins for blogs
4102 $query = 'SELECT bname FROM '.sql_table('blog').' WHERE bdefskin=' . $skinid;
4103 $r = sql_query($query);
4104 if ($o = mysql_fetch_object($r))
4105 $this->error(_ERROR_SKINDEFDELETE .$o->bname);
4107 $manager->notify('PreDeleteSkin', array('skinid' => $skinid));
4109 // 1. delete description
4110 sql_query('DELETE FROM '.sql_table('skin_desc').' WHERE sdnumber=' . $skinid);
4113 sql_query('DELETE FROM '.sql_table('skin').' WHERE sdesc=' . $skinid);
4115 $manager->notify('PostDeleteSkin', array('skinid' => $skinid));
4117 $this->action_skinoverview();
4120 function action_skinclone() {
4123 $skinid = intRequestVar('skinid');
4125 $member->isAdmin() or $this->disallow();
4127 // 1. read skin to clone
4128 $skin =& new SKIN($skinid);
4130 $name = "clone_" . $skin->getName();
4132 // if a skin with that name already exists:
4133 if (SKIN::exists($name)) {
4135 while (SKIN::exists($name . $i))
4140 // 2. create skin desc
4141 $newid = SKIN::createNew(
4143 $skin->getDescription(),
4144 $skin->getContentType(),
4145 $skin->getIncludeMode(),
4146 $skin->getIncludePrefix()
4151 $this->skinclonetype($skin, $newid, 'index');
4152 $this->skinclonetype($skin, $newid, 'item');
4153 $this->skinclonetype($skin, $newid, 'archivelist');
4154 $this->skinclonetype($skin, $newid, 'archive');
4155 $this->skinclonetype($skin, $newid, 'search');
4156 $this->skinclonetype($skin, $newid, 'error');
4157 $this->skinclonetype($skin, $newid, 'member');
4158 $this->skinclonetype($skin, $newid, 'imagepopup');
4160 $this->action_skinoverview();
4164 function skinclonetype($skin, $newid, $type) {
4165 $newid = intval($newid);
4166 $content = $skin->getContent($type);
4168 $query = 'INSERT INTO '.sql_table('skin')." (sdesc, scontent, stype) VALUES ($newid,'". addslashes($content)."', '". addslashes($type)."')";
4173 function action_settingsedit() {
4174 global $member, $manager, $CONF, $DIR_NUCLEUS, $DIR_MEDIA;
4176 $member->isAdmin() or $this->disallow();
4180 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
4183 <h2><?php echo _SETTINGS_TITLE?></h2>
4185 <form action="index.php" method="post">
4188 <input type="hidden" name="action" value="settingsupdate" />
4189 <?php $manager->addTicketHidden() ?>
4192 <th colspan="2"><?php echo _SETTINGS_SUB_GENERAL?></th>
4194 <td><?php echo _SETTINGS_DEFBLOG?> <?php help('defaultblog'); ?></td>
4197 $query = 'SELECT bname as text, bnumber as value'
4198 . ' FROM '.sql_table('blog');
4199 $template['name'] = 'DefaultBlog';
4200 $template['selected'] = $CONF['DefaultBlog'];
4201 $template['tabindex'] = 10;
4202 showlist($query,'select',$template);
4206 <td><?php echo _SETTINGS_BASESKIN?> <?php help('baseskin'); ?></td>
4209 $query = 'SELECT sdname as text, sdnumber as value'
4210 . ' FROM '.sql_table('skin_desc');
4211 $template['name'] = 'BaseSkin';
4212 $template['selected'] = $CONF['BaseSkin'];
4213 $template['tabindex'] = 1;
4214 showlist($query,'select',$template);
4218 <td><?php echo _SETTINGS_ADMINMAIL?></td>
4219 <td><input name="AdminEmail" tabindex="10010" size="40" value="<?php echo htmlspecialchars($CONF['AdminEmail']) ?>" /></td>
4221 <td><?php echo _SETTINGS_SITENAME?></td>
4222 <td><input name="SiteName" tabindex="10020" size="40" value="<?php echo htmlspecialchars($CONF['SiteName']) ?>" /></td>
4224 <td><?php echo _SETTINGS_SITEURL?></td>
4225 <td><input name="IndexURL" tabindex="10030" size="40" value="<?php echo htmlspecialchars($CONF['IndexURL']) ?>" /></td>
4227 <td><?php echo _SETTINGS_ADMINURL?></td>
4228 <td><input name="AdminURL" tabindex="10040" size="40" value="<?php echo htmlspecialchars($CONF['AdminURL']) ?>" /></td>
4230 <td><?php echo _SETTINGS_PLUGINURL?> <?php help('pluginurl');?></td>
4231 <td><input name="PluginURL" tabindex="10045" size="40" value="<?php echo htmlspecialchars($CONF['PluginURL']) ?>" /></td>
4233 <td><?php echo _SETTINGS_SKINSURL?> <?php help('skinsurl');?></td>
4234 <td><input name="SkinsURL" tabindex="10046" size="40" value="<?php echo htmlspecialchars($CONF['SkinsURL']) ?>" /></td>
4236 <td><?php echo _SETTINGS_ACTIONSURL?> <?php help('actionurl');?></td>
4237 <td><input name="ActionURL" tabindex="10047" size="40" value="<?php echo htmlspecialchars($CONF['ActionURL']) ?>" /></td>
4239 <td><?php echo _SETTINGS_LANGUAGE?> <?php help('language'); ?>
4243 <select name="Language" tabindex="10050">
4244 <?php // show a dropdown list of all available languages
4246 $dirhandle = opendir($DIR_LANG);
4247 while ($filename = readdir($dirhandle)) {
4248 if (ereg("^(.*)\.php$",$filename,$matches)) {
4249 $name = $matches[1];
4250 echo "<option value='$name'";
4251 if ($name == $CONF['Language'])
4252 echo " selected='selected'";
4253 echo ">$name</option>";
4256 closedir($dirhandle);
4263 <td><?php echo _SETTINGS_DISABLESITE?> <?php help('disablesite'); ?>
4265 <td><?php $this->input_yesno('DisableSite',$CONF['DisableSite'],10060); ?>
4267 URL: <input name="DisableSiteURL" tabindex="10070" size="40" value="<?php echo htmlspecialchars($CONF['DisableSiteURL'])?>" />
4270 <td><?php echo _SETTINGS_DIRS?></td>
4271 <td><?php echo htmlspecialchars($DIR_NUCLEUS) ?>
4272 <i><?php echo _SETTINGS_SEECONFIGPHP?></i></td>
4274 <td><?php echo _SETTINGS_DBLOGIN?></td>
4275 <td><i><?php echo _SETTINGS_SEECONFIGPHP?></i></td>
4279 echo _SETTINGS_JSTOOLBAR
4280 /* =_SETTINGS_DISABLEJS
4282 I temporary changed the meaning of DisableJsTools, until I can find a good
4283 way to select the javascript version to use
4287 1 : all javascript disabled
4288 2 : 'simpler' javascript (for mozilla/opera/mac)
4292 <td><?php /* $this->input_yesno('DisableJsTools',$CONF['DisableJsTools'],10075); */?>
4293 <select name="DisableJsTools" tabindex="10075">
4294 <?php $extra = ($CONF['DisableJsTools'] == 1) ? 'selected="selected"' : '';
4295 echo "<option $extra value='1'>",_SETTINGS_JSTOOLBAR_NONE,"</option>";
4296 $extra = ($CONF['DisableJsTools'] == 2) ? 'selected="selected"' : '';
4297 echo "<option $extra value='2'>",_SETTINGS_JSTOOLBAR_SIMPLE,"</option>";
4298 $extra = ($CONF['DisableJsTools'] == 0) ? 'selected="selected"' : '';
4299 echo "<option $extra value='0'>",_SETTINGS_JSTOOLBAR_FULL,"</option>";
4304 <td><?php echo _SETTINGS_URLMODE?> <?php help('urlmode');?></td>
4307 $this->input_yesno('URLMode',$CONF['URLMode'],10077,
4308 'normal','pathinfo',_SETTINGS_URLMODE_NORMAL,_SETTINGS_URLMODE_PATHINFO);
4310 echo ' ', _SETTINGS_URLMODE_HELP;
4316 <th colspan="2"><?php echo _SETTINGS_MEDIA?> <?php help('media'); ?></th>
4318 <td><?php echo _SETTINGS_MEDIADIR?></td>
4319 <td><?php echo htmlspecialchars($DIR_MEDIA) ?>
4320 <i><?php echo _SETTINGS_SEECONFIGPHP?></i>
4321 <?php if (!is_dir($DIR_MEDIA))
4322 echo "<br /><b>" . _WARNING_NOTADIR . "</b>";
4323 if (!is_readable($DIR_MEDIA))
4324 echo "<br /><b>" . _WARNING_NOTREADABLE . "</b>";
4325 if (!is_writeable($DIR_MEDIA))
4326 echo "<br /><b>" . _WARNING_NOTWRITABLE . "</b>";
4330 <td><?php echo _SETTINGS_MEDIAURL?></td>
4332 <input name="MediaURL" tabindex="10080" size="40" value="<?php echo htmlspecialchars($CONF['MediaURL']) ?>" />
4335 <td><?php echo _SETTINGS_ALLOWUPLOAD?></td>
4336 <td><?php $this->input_yesno('AllowUpload',$CONF['AllowUpload'],10090); ?></td>
4338 <td><?php echo _SETTINGS_ALLOWUPLOADTYPES?></td>
4340 <input name="AllowedTypes" tabindex="10100" size="40" value="<?php echo htmlspecialchars($CONF['AllowedTypes']) ?>" />
4343 <td><?php echo _SETTINGS_MAXUPLOADSIZE?></td>
4345 <input name="MaxUploadSize" tabindex="10105" size="40" value="<?php echo htmlspecialchars($CONF['MaxUploadSize']) ?>" />
4348 <td><?php echo _SETTINGS_MEDIAPREFIX?></td>
4349 <td><?php $this->input_yesno('MediaPrefix',$CONF['MediaPrefix'],10110); ?></td>
4352 <th colspan="2"><?php echo _SETTINGS_MEMBERS?></th>
4354 <td><?php echo _SETTINGS_CHANGELOGIN?></td>
4355 <td><?php $this->input_yesno('AllowLoginEdit',$CONF['AllowLoginEdit'],10120); ?></td>
4357 <td><?php echo _SETTINGS_ALLOWCREATE?>
4358 <?php help('allowaccountcreation'); ?>
4360 <td><?php $this->input_yesno('AllowMemberCreate',$CONF['AllowMemberCreate'],10130); ?>
4363 <td><?php echo _SETTINGS_NEWLOGIN?> <?php help('allownewmemberlogin'); ?>
4364 <br /><?php echo _SETTINGS_NEWLOGIN2?>
4366 <td><?php $this->input_yesno('NewMemberCanLogon',$CONF['NewMemberCanLogon'],10140); ?>
4369 <td><?php echo _SETTINGS_MEMBERMSGS?>
4370 <?php help('messageservice'); ?>
4372 <td><?php $this->input_yesno('AllowMemberMail',$CONF['AllowMemberMail'],10150); ?>
4375 <td><?php echo _SETTINGS_NONMEMBERMSGS?>
4376 <?php help('messageservice'); ?>
4378 <td><?php $this->input_yesno('NonmemberMail',$CONF['NonmemberMail'],10155); ?>
4381 <td><?php echo _SETTINGS_PROTECTMEMNAMES?>
4382 <?php help('protectmemnames'); ?>
4384 <td><?php $this->input_yesno('ProtectMemNames',$CONF['ProtectMemNames'],10156); ?>
4390 <th colspan="2"><?php echo _SETTINGS_COOKIES_TITLE?> <?php help('cookies'); ?></th>
4392 <td><?php echo _SETTINGS_COOKIEPREFIX?></td>
4393 <td><input name="CookiePrefix" tabindex="10159" size="40" value="<?php echo htmlspecialchars($CONF['CookiePrefix'])?>" /></td>
4395 <td><?php echo _SETTINGS_COOKIEDOMAIN?></td>
4396 <td><input name="CookieDomain" tabindex="10160" size="40" value="<?php echo htmlspecialchars($CONF['CookieDomain'])?>" /></td>
4398 <td><?php echo _SETTINGS_COOKIEPATH?></td>
4399 <td><input name="CookiePath" tabindex="10170" size="40" value="<?php echo htmlspecialchars($CONF['CookiePath'])?>" /></td>
4401 <td><?php echo _SETTINGS_COOKIESECURE?></td>
4402 <td><?php $this->input_yesno('CookieSecure',$CONF['CookieSecure'],10180); ?></td>
4404 <td><?php echo _SETTINGS_COOKIELIFE?></td>
4405 <td><?php $this->input_yesno('SessionCookie',$CONF['SessionCookie'],10190,
4406 1,0,_SETTINGS_COOKIESESSION,_SETTINGS_COOKIEMONTH); ?>
4409 <td><?php echo _SETTINGS_LASTVISIT?></td>
4410 <td><?php $this->input_yesno('LastVisit',$CONF['LastVisit'],10200); ?></td>
4415 <th colspan="2"><?php echo _SETTINGS_UPDATE?></th>
4417 <td><?php echo _SETTINGS_UPDATE?></td>
4418 <td><input type="submit" tabindex="10210" value="<?php echo _SETTINGS_UPDATE_BTN?>" onclick="return checkSubmit();" /></td>
4425 echo '<h2>',_PLUGINS_EXTRA,'</h2>';
4428 'GeneralSettingsFormExtras',
4435 function action_settingsupdate() {
4436 global $member, $CONF;
4438 $member->isAdmin() or $this->disallow();
4440 // check if email address for admin is valid
4441 if (!isValidMailAddress(postVar('AdminEmail')))
4442 $this->error(_ERROR_BADMAILADDRESS);
4446 $this->updateConfig('DefaultBlog', postVar('DefaultBlog'));
4447 $this->updateConfig('BaseSkin', postVar('BaseSkin'));
4448 $this->updateConfig('IndexURL', postVar('IndexURL'));
4449 $this->updateConfig('AdminURL', postVar('AdminURL'));
4450 $this->updateConfig('PluginURL', postVar('PluginURL'));
4451 $this->updateConfig('SkinsURL', postVar('SkinsURL'));
4452 $this->updateConfig('ActionURL', postVar('ActionURL'));
4453 $this->updateConfig('Language', postVar('Language'));
4454 $this->updateConfig('AdminEmail', postVar('AdminEmail'));
4455 $this->updateConfig('SessionCookie', postVar('SessionCookie'));
4456 $this->updateConfig('AllowMemberCreate',postVar('AllowMemberCreate'));
4457 $this->updateConfig('AllowMemberMail', postVar('AllowMemberMail'));
4458 $this->updateConfig('NonmemberMail', postVar('NonmemberMail'));
4459 $this->updateConfig('ProtectMemNames', postVar('ProtectMemNames'));
4460 $this->updateConfig('SiteName', postVar('SiteName'));
4461 $this->updateConfig('NewMemberCanLogon',postVar('NewMemberCanLogon'));
4462 $this->updateConfig('DisableSite', postVar('DisableSite'));
4463 $this->updateConfig('DisableSiteURL', postVar('DisableSiteURL'));
4464 $this->updateConfig('LastVisit', postVar('LastVisit'));
4465 $this->updateConfig('MediaURL', postVar('MediaURL'));
4466 $this->updateConfig('AllowedTypes', postVar('AllowedTypes'));
4467 $this->updateConfig('AllowUpload', postVar('AllowUpload'));
4468 $this->updateConfig('MaxUploadSize', postVar('MaxUploadSize'));
4469 $this->updateConfig('MediaPrefix', postVar('MediaPrefix'));
4470 $this->updateConfig('AllowLoginEdit', postVar('AllowLoginEdit'));
4471 $this->updateConfig('DisableJsTools', postVar('DisableJsTools'));
4472 $this->updateConfig('CookieDomain', postVar('CookieDomain'));
4473 $this->updateConfig('CookiePath', postVar('CookiePath'));
4474 $this->updateConfig('CookieSecure', postVar('CookieSecure'));
4475 $this->updateConfig('URLMode', postVar('URLMode'));
4476 $this->updateConfig('CookiePrefix', postVar('CookiePrefix'));
4478 // load new config and redirect (this way, the new language will be used is necessary)
4479 // note that when changing cookie settings, this redirect might cause the user
4480 // to have to log in again.
4482 redirect($CONF['AdminURL'] . '?action=manage');
4488 function updateConfig($name, $val) {
4489 $name = addslashes($name);
4490 $val = trim(addslashes($val));
4492 $query = 'UPDATE '.sql_table('config')
4493 . " SET value='$val'"
4494 . " WHERE name='$name'";
4496 mysql_query($query) or die("Query error: " . mysql_error());
4497 return mysql_insert_id();
4503 function error($msg) {
4509 echo "<a href='index.php' onclick='history.back()'>"._BACK."</a>";
4514 function disallow() {
4515 ACTIONLOG::add(WARNING, _ACTIONLOG_DISALLOWED . serverVar('REQUEST_URI'));
4517 $this->error(_ERROR_DISALLOWED);
4521 function pagehead($extrahead = '') {
4522 global $member, $nucleus, $CONF, $manager;
4527 'extrahead' => &$extrahead,
4528 'action' => $this->action
4532 $baseUrl = htmlspecialchars($CONF['AdminURL']);
4535 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4536 <html xmlns="http://www.w3.org/1999/xhtml">
4538 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo _CHARSET ?>" />
4539 <title><?php echo htmlspecialchars($CONF['SiteName'])?> - Admin</title>
4540 <link rel="stylesheet" title="Nucleus Admin Default" type="text/css" href="<?php echo $baseUrl?>styles/admin.css" />
4541 <link rel="stylesheet" title="Nucleus Admin Default" type="text/css"
4542 href="<?php echo $baseUrl?>styles/addedit.css" />
4544 <script type="text/javascript" src="<?php echo $baseUrl?>javascript/edit.js"></script>
4545 <script type="text/javascript" src="<?php echo $baseUrl?>javascript/admin.js"></script>
4546 <script type="text/javascript" src="<?php echo $baseUrl?>javascript/compatibility.js"></script>
4548 <meta http-equiv='Pragma' content='no-cache' />
4549 <meta http-equiv='Cache-Control' content='no-cache, must-revalidate' />
4550 <meta http-equiv='Expires' content='-1' />
4552 <?php echo $extrahead?>
4555 <div class="header">
4556 <h1><?php echo htmlspecialchars($CONF['SiteName'])?></h1>
4558 <div id="container">
4560 <div class="loginname">
4561 <?php if ($member->isLoggedIn())
4562 echo _LOGGEDINAS . ' ' . $member->getDisplayName()
4563 ." - <a href='index.php?action=logout'>" . _LOGOUT. "</a>"
4564 . "<br /><a href='index.php?action=overview'>" . _ADMINHOME . "</a> - ";
4566 echo '<a href="index.php?action=showlogin" title="Log in">' , _NOTLOGGEDIN , '</a> <br />';
4568 echo "<a href='".$CONF['IndexURL']."'>"._YOURSITE."</a>";
4572 if ($member->isLoggedIn() && $member->isAdmin())
4573 echo '<a href="http://nucleuscms.org/version.php?v=',getNucleusVersion(),'&pl=',getNucleusPatchLevel(),'" title="Check for upgrade">Nucleus CMS ', $nucleus['version'], '</a>';
4575 echo 'Nucleus CMS ' , $nucleus['version'];
4580 function pagefoot() {
4581 global $action, $member, $manager;
4586 'action' => $this->action
4590 if ($member->isLoggedIn() && ($action != 'showlogin')) {
4592 <h2><?php echo _LOGOUT ?></h2>
4594 <li><a href="index.php?action=overview"><?php echo _BACKHOME?></a></li>
4595 <li><a href='index.php?action=logout'><?php echo _LOGOUT?></a></li>
4600 <a href="http://nucleuscms.org/">Nucleus CMS</a> © 2002-2005 The Nucleus Group
4602 <a href="http://nucleuscms.org/donate.php">Donate!</a>
4605 </div><!-- content -->
4607 <div id="quickmenu">
4609 <?php // ---- user settings ----
4610 if (($action != 'showlogin') && ($member->isLoggedIn())) {
4612 echo '<li><a href="index.php?action=overview">',_QMENU_HOME,'</a></li>';
4615 echo '<h2>',_QMENU_ADD,'</h2>';
4616 echo '<form method="get" action="index.php"><div>';
4617 echo '<input type="hidden" name="action" value="createitem" />';
4619 $showAll = requestVar('showall');
4620 if (($member->isAdmin()) && ($showAll == 'yes')) {
4621 // Super-Admins have access to all blogs! (no add item support though)
4622 $query = 'SELECT bnumber as value, bname as text'
4623 . ' FROM ' . sql_table('blog')
4624 . ' ORDER BY bname';
4626 $query = 'SELECT bnumber as value, bname as text'
4627 . ' FROM ' . sql_table('blog') . ', ' . sql_table('team')
4628 . ' WHERE tblog=bnumber and tmember=' . $member->getID()
4629 . ' ORDER BY bname';
4631 $template['name'] = 'blogid';
4632 $template['tabindex'] = 15000;
4633 $template['extra'] = _QMENU_ADD_SELECT;
4634 $template['selected'] = -1;
4635 $template['shorten'] = 10;
4636 $template['shortenel'] = '';
4637 $template['javascript'] = 'onchange="return form.submit()"';
4638 showlist($query,'select',$template);
4640 echo '</div></form>';
4642 echo '<h2>' . $member->getDisplayName(). '</h2>';
4644 echo '<li><a href="index.php?action=editmembersettings">',_QMENU_USER_SETTINGS,'</a></li>';
4645 echo '<li><a href="index.php?action=browseownitems">',_QMENU_USER_ITEMS,'</a></li>';
4646 echo '<li><a href="index.php?action=browseowncomments">',_QMENU_USER_COMMENTS,'</a></li>';
4652 // ---- general settings ----
4653 if ($member->isAdmin()) {
4655 echo '<h2>',_QMENU_MANAGE,'</h2>';
4658 echo '<li><a href="index.php?action=actionlog">',_QMENU_MANAGE_LOG,'</a></li>';
4659 echo '<li><a href="index.php?action=settingsedit">',_QMENU_MANAGE_SETTINGS,'</a></li>';
4660 echo '<li><a href="index.php?action=usermanagement">',_QMENU_MANAGE_MEMBERS,'</a></li>';
4661 echo '<li><a href="index.php?action=createnewlog">',_QMENU_MANAGE_NEWBLOG,'</a></li>';
4662 echo '<li><a href="index.php?action=backupoverview">',_QMENU_MANAGE_BACKUPS,'</a></li>';
4663 echo '<li><a href="index.php?action=pluginlist">',_QMENU_MANAGE_PLUGINS,'</a></li>';
4666 echo '<h2>',_QMENU_LAYOUT,'</h2>';
4668 echo '<li><a href="index.php?action=skinoverview">',_QMENU_LAYOUT_SKINS,'</a></li>';
4669 echo '<li><a href="index.php?action=templateoverview">',_QMENU_LAYOUT_TEMPL,'</a></li>';
4670 echo '<li><a href="index.php?action=skinieoverview">',_QMENU_LAYOUT_IEXPORT,'</a></li>';
4675 $aPluginExtras = array();
4679 'options' => &$aPluginExtras
4682 if (count($aPluginExtras) > 0)
4684 echo '<h2>', _QMENU_PLUGINS, '</h2>';
4686 foreach ($aPluginExtras as $aInfo)
4688 echo '<li><a href="'.htmlspecialchars($aInfo['url']).'" title="'.htmlspecialchars($aInfo['tooltip']).'">'.htmlspecialchars($aInfo['title']).'</a></li>';
4693 } else if (($action == 'activate') || ($action == 'activatesetpwd')) {
4695 echo '<h2>', _QMENU_ACTIVATE, '</h2>', _QMENU_ACTIVATE_TEXT;
4697 // introduction text on login screen
4698 echo '<h2>', _QMENU_INTRO, '</h2>', _QMENU_INTRO_TEXT;
4703 <!-- content / quickmenu container -->
4712 function action_regfile() {
4713 global $member, $CONF;
4715 $blogid = intRequestVar('blogid');
4717 $member->teamRights($blogid) or $this->disallow();
4719 // header-code stolen from phpMyAdmin
4720 // REGEDIT and bookmarklet code stolen from GreyMatter
4722 $sjisBlogName = getBlogNameFromID($blogid);
4723 $sjisBlogName = mb_convert_encoding($sjisBlogName, "SJIS", "auto");
4725 header('Content-Type: application/octetstream');
4726 header('Content-Disposition: filename="nucleus.reg"');
4727 header('Pragma: no-cache');
4728 header('Expires: 0');
4731 echo "[HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\MenuExt\\Post To &Nucleus (".$sjisBlogName.")]\n";
4732 echo '@="' . $CONF['AdminURL'] . "bookmarklet.php?action=contextmenucode&blogid=".intval($blogid)."\"\n";
4733 echo '"contexts"=hex:31';
4736 function action_bookmarklet() {
4737 global $member, $manager;
4739 $blogid = intRequestVar('blogid');
4741 $member->teamRights($blogid) or $this->disallow();
4743 $blog =& $manager->getBlog($blogid);
4744 $bm = getBookmarklet($blogid);
4748 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
4752 <h2>Bookmarklet<!-- and Right Click Menu --></h2>
4755 Bookmarklet ã
\81¨ã
\81¯ã
\80\81ã
\82¯ã
\83ªã
\83\81E
\82¯1å
\9b\9eã
\81§è¨
\98äº
\8bã
\81Eæ
\8a\95稿ã
\81\8cã
\81§ã
\81\8dã
\82\8bã
\82·ã
\82¹ã
\83\81E
\83 ã
\81§ã
\81\99ã
\80\81Eã
\81\93ã
\81E Bookmarklet ã
\82\92ã
\82¤ã
\83³ã
\82¹ã
\83\88ã
\81Eã
\83«ã
\81\99ã
\82\8bã
\81¨ã
\80\81ã
\83\96ã
\83©ã
\82¦ã
\82¶ã
\81®ã
\83\81E
\81Eã
\83«ã
\83\90ã
\81Eã
\81®'add to weblog'ã
\83\9cã
\82¿ã
\83³ã
\81\8cå
\88©ç
\94¨å
\8f¯è
\83½ã
\81¨ã
\81ªã
\82\8aã
\80\81Nucleusã
\81®æ
\96°è¦
\8fã
\82¢ã
\82¤ã
\83\81E
\83 ã
\81®è¿½å
\8a ã
\82¦ã
\82£ã
\83³ã
\83\89ã
\82¦ã
\81\8cã
\81Eã
\83\81E
\81Eã
\82¢ã
\83\81E
\81Eã
\81\97ã
\81¾ã
\81\99ã
\80\82ä»»æ
\84\8fã
\81EWebã
\83\9aã
\81Eã
\82¸ã
\82\92é
\96\8bã
\81\81E
\81\9fç
\8a¶æ
\85\8bã
\81§ã
\81\93ã
\81Eã
\83\9cã
\82¿ã
\83³ã
\82\92æ
\8a¼ã
\81\9bã
\81Eã
\80\81ã
\81\9dã
\81®Webã
\83\9aã
\81Eã
\82¸ã
\81®ã
\82¿ã
\82¤ã
\83\88ã
\83«ã
\81¨ã
\80\81ã
\81\9dã
\81®ã
\83\9aã
\81Eã
\82¸ã
\81¸ã
\81®ã
\83ªã
\83³ã
\82¯ã
\82¿ã
\82°ã
\81\8cã
\81\99ã
\81§ã
\81«å
\9f\8bã
\82\81è¾¼ã
\81¾ã
\82\8cã
\81\9fç
\8a¶æ
\85\8bã
\81§ã
\82¢ã
\82¤ã
\83\81E
\83 追å
\8a ã
\82¦ã
\82£ã
\83³ã
\83\89ã
\82¦ã
\81\8cé
\96\8bã
\81\8dã
\80\81ã
\81\95ã
\82\89ã
\81«ã
\80\81ã
\81\9dã
\81®ã
\83\9aã
\81Eã
\82¸å
\86\81E
\81«å¼
\95ç
\94¨ã
\81\97ã
\81\9fã
\81\81E
\96\87ã
\82\92é
\81¸æ
\8a\9eã
\81\97ã
\81\9fç
\8a¶æ
\85\8bã
\81§ã
\81\82ã
\82\8cã
\81°ã
\81\9dã
\81Eå¼
\95ç
\94¨æ
\96\81E
\82\82è
\87ªå
\8b\95ç
\9a\84ã
\81«å¼
\95ç
\94¨ã
\81\97ã
\81¾ã
\81\99ã
\80
4758 <h3>Bookmarklet</h3>
4760 ä¸
\8bã
\81Eã
\83ªã
\83³ã
\82¯é
\83¨å
\88\81E
\82\92ã
\80\8cã
\81\8aæ°
\97ã
\81«å
\85¥ã
\82\8aã
\80\8dã
\82\82ã
\81\97ã
\81\8fã
\81¯ã
\83\81E
\81Eã
\83«ã
\83\90ã
\81Eã
\81«ã
\83\89ã
\83©ã
\83\81E
\82°ã
\81§ã
\81\8dã
\81¾ã
\81\99ã
\80\81Esmall>(ã
\81\9dã
\81Eå
\89\8dã
\81«ã
\83\81E
\82¹ã
\83\88ã
\81\97ã
\81¦ã
\81¿ã
\81\9fã
\81\84å ´å
\90\88ã
\81Eå
\8d\98ç´
\94ã
\81«ä¸
\8bã
\81Eã
\83ªã
\83³ã
\82¯ã
\82\92ã
\82¯ã
\83ªã
\83\81E
\82¯ã
\81\97ã
\81¦ã
\81¿ã
\81¦ã
\81\8fã
\81 ã
\81\95ã
\81\84)</small>
4763 <a href="<?php echo htmlspecialchars($bm)?>">Add to <?php echo $blog->getShortName()?></a> (ほとんどのブラウザで動作しまぁE
4766 <h3>å
\8f³ã
\82¯ã
\83ªã
\83\81E
\82¯ã
\83¡ã
\83\8bã
\83¥ã
\83¼ã
\81«ã
\82¤ã
\83³ã
\82¹ã
\83\88ã
\81Eã
\83« (Windowsã
\81§IE使ç
\94¨æ
\99\81E</h3>
4769 $url = 'index.php?action=regfile&blogid=' . intval($blogid);
4770 $url = $manager->addTicketToUrl($url);
4772 ã
\81\82ã
\82\8bã
\81\81E
\81E<a href="<?php echo htmlspecialchars($url) ?>">å
\8f³ã
\82¯ã
\83ªã
\83\81E
\82¯ã
\83¡ã
\83\8bã
\83¥ã
\83¼</a>ã
\81«ã
\82¤ã
\83³ã
\82¹ã
\83\88ã
\81Eã
\83«ã
\81\99ã
\82\8bã
\81\93ã
\81¨ã
\82\82ã
\81§ã
\81\8dã
\81¾ã
\81\81E(ã
\80\8cé
\96\8bã
\81\8fã
\80\8dã
\82\92é
\81¸æ
\8a\9eã
\81\99ã
\82\8cã
\81Eç
\9b´æ
\8e¥ã
\83‹
\82¸ã
\82¹ã
\83\88ã
\83ªã
\81«ç
\99Ȏ
\8c²ã
\81\97ã
\81¾ã
\81\81E
4776 ã
\81\93ã
\81Eã
\82¤ã
\83³ã
\82¹ã
\83\88ã
\81Eã
\83«ã
\81\97ã
\81\9få
\8f³ã
\82¯ã
\83ªã
\83\81E
\82¯ã
\83¡ã
\83\8bã
\83¥ã
\83¼ã
\82\92表示ã
\81\99ã
\82\8bã
\81\9fã
\82\81ã
\81«ã
\81¯IEã
\81®å
\86\8dèµ·å
\8b\95ã
\81\8cå¿
\81E¦
\81ã
\81§ã
\81\99ã
\80
4779 <h3>ã
\82¢ã
\83³ã
\82¤ã
\83³ã
\82¹ã
\83\88ã
\81Eã
\83«</h3>
4781 ã
\80\8cã
\81\8aæ°
\97ã
\81«å
\85¥ã
\82\8aã
\80\8dã
\82\82ã
\81\97ã
\81\8fã
\81¯ã
\83\81E
\81Eã
\83«ã
\83\90ã
\81Eã
\81\8bã
\82\89æ¶
\88ã
\81\99ã
\81«ã
\81¯ã
\80\81å
\8d\98ã
\81«å
\89\8aé
\99¤ã
\81\99ã
\82\8bã
\81 ã
\81\91ã
\81§ã
\81\99ã
\80
4785 å
\8f³ã
\82¯ã
\83ªã
\83\81E
\82¯ã
\83¡ã
\83\8bã
\83¥ã
\83¼ã
\81\8bã
\82\89æ¶
\88ã
\81\97ã
\81\9fã
\81\84æ
\99\82ã
\81Eã
\80\81以ä¸
\8bã
\81Eæ
\89\8bé
\81E
\82\92è¸
\8fã
\82\93ã
\81§ã
\81\8fã
\81 ã
\81\95ã
\81\84:
4789 <li>スタートメニューから「ファイルを指定して実衁E..」を選抁E/li>
4790 <li>"regedit" と入劁E/li>
4791 <li>"OK" ボタンを押ぁE/li>
4792 <li>"\HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt" をツリーの中から検索</li>
4793 <li>"add to weblog" エントリを削除</li>
4802 function action_actionlog() {
4803 global $member, $manager;
4805 $member->isAdmin() or $this->disallow();
4809 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
4811 $url = $manager->addTicketToUrl('index.php?action=clearactionlog');
4814 <h2><?php echo _ACTIONLOG_CLEAR_TITLE?></h2>
4815 <p><a href="<?php echo htmlspecialchars($url)?>"><?php echo _ACTIONLOG_CLEAR_TEXT?></a></p>
4817 echo '<h2>' . _ACTIONLOG_TITLE . '</h2>';
4819 $query = 'SELECT * FROM '.sql_table('actionlog').' ORDER BY timestamp DESC';
4820 $template['content'] = 'actionlist';
4821 $amount = showlist($query,'table',$template);
4828 function action_banlist() {
4829 global $member, $manager;
4831 $blogid = intRequestVar('blogid');
4833 $member->blogAdminRights($blogid) or $this->disallow();
4835 $blog =& $manager->getBlog($blogid);
4839 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
4841 echo '<h2>' . _BAN_TITLE . " '". $this->bloglink($blog) ."'</h2>";
4843 $query = 'SELECT * FROM '.sql_table('ban').' WHERE blogid='.$blogid.' ORDER BY iprange';
4844 $template['content'] = 'banlist';
4845 $amount = showlist($query,'table',$template);
4850 echo '<h2>'._BAN_NEW_TITLE.'</h2>';
4851 echo "<p><a href='index.php?action=banlistnew&blogid=$blogid'>"._BAN_NEW_TEXT."</a></p>";
4859 function action_banlistdelete() {
4860 global $member, $manager;
4862 $blogid = intRequestVar('blogid');
4863 $iprange = requestVar('iprange');
4865 $member->blogAdminRights($blogid) or $this->disallow();
4867 $blog =& $manager->getBlog($blogid);
4871 <h2><?php echo _BAN_REMOVE_TITLE?></h2>
4873 <form method="post" action="index.php">
4875 <h3><?php echo _BAN_IPRANGE?></h3>
4878 <?php echo _CONFIRMTXT_BAN?> <?php echo htmlspecialchars($iprange) ?>
4879 <input name="iprange" type="hidden" value="<?php echo htmlspecialchars($iprange)?>" />
4882 <h3><?php echo _BAN_BLOGS?></h3>
4885 <input type="hidden" name="blogid" value="<?php echo $blogid?>" />
4886 <input name="allblogs" type="radio" value="0" id="allblogs_one" /><label for="allblogs_one">Only blog '<?php echo htmlspecialchars($blog->getName())?>'</label>
4888 <input name="allblogs" type="radio" value="1" checked="checked" id="allblogs_all" /><label for="allblogs_all"><?php echo _BAN_ALLBLOGS?></label>
4891 <h3><?php echo _BAN_DELETE_TITLE?></h3>
4894 <?php $manager->addTicketHidden() ?>
4895 <input type="hidden" name="action" value="banlistdeleteconfirm" />
4896 <input type="submit" value="<?php echo _DELETE_CONFIRM_BTN?>" />
4904 function action_banlistdeleteconfirm() {
4905 global $member, $manager;
4907 $blogid = intPostVar('blogid');
4908 $allblogs = postVar('allblogs');
4909 $iprange = postVar('iprange');
4911 $member->blogAdminRights($blogid) or $this->disallow();
4916 if (BAN::removeBan($blogid, $iprange))
4917 array_push($deleted, $blogid);
4919 // get blogs fot which member has admin rights
4920 $adminblogs = $member->getAdminBlogs();
4921 foreach ($adminblogs as $blogje) {
4922 if (BAN::removeBan($blogje, $iprange))
4923 array_push($deleted, $blogje);
4927 if (sizeof($deleted) == 0)
4928 $this->error(_ERROR_DELETEBAN);
4932 echo '<a href="index.php?action=banlist&blogid=',$blogid,'">(',_BACK,')</a>';
4933 echo '<h2>'._BAN_REMOVED_TITLE.'</h2>';
4934 echo "<p>"._BAN_REMOVED_TEXT."</p>";
4937 foreach ($deleted as $delblog) {
4938 $b =& $manager->getBlog($delblog);
4939 echo "<li>" . htmlspecialchars($b->getName()). "</li>";
4947 function action_banlistnewfromitem() {
4948 $this->action_banlistnew(getBlogIDFromItemID(intRequestVar('itemid')));
4951 function action_banlistnew($blogid = '') {
4952 global $member, $manager;
4955 $blogid = intRequestVar('blogid');
4957 $ip = requestVar('ip');
4959 $member->blogAdminRights($blogid) or $this->disallow();
4961 $blog =& $manager->getBlog($blogid);
4965 <h2><?php echo _BAN_ADD_TITLE?></h2>
4968 <form method="post" action="index.php">
4970 <h3><?php echo _BAN_IPRANGE?></h3>
4972 <p><?php echo _BAN_IPRANGE_TEXT?></p>
4975 <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.
4981 <input name="iprange" type="radio" value="<?php echo htmlspecialchars($ip)?>" checked="checked" id="ip_fixed" /><label for="ip_fixed"><?php echo htmlspecialchars($ip)?></label>
4983 <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' />
4985 echo "<input name='iprange' value='custom' type='hidden' />";
4986 echo "<input name='customiprange' value='' maxlength='15' size='15' />";
4991 <h3><?php echo _BAN_BLOGS?></h3>
4993 <p><?php echo _BAN_BLOGS_TEXT?></p>
4996 <input type="hidden" name="blogid" value="<?php echo $blogid?>" />
4997 <input name="allblogs" type="radio" value="0" id="allblogs_one" /><label for="allblogs_one">'<?php echo htmlspecialchars($blog->getName())?>'</label>
4999 <input name="allblogs" type="radio" value="1" checked="checked" id="allblogs_all" /><label for="allblogs_all"><?php echo _BAN_ALLBLOGS?></label>
5002 <h3><?php echo _BAN_REASON_TITLE?></h3>
5004 <p><?php echo _BAN_REASON_TEXT?></p>
5006 <div><textarea name="reason" cols="40" rows="5"></textarea></div>
5008 <h3><?php echo _BAN_ADD_TITLE?></h3>
5011 <input name="action" type="hidden" value="banlistadd" />
5012 <?php $manager->addTicketHidden() ?>
5013 <input type="submit" value="<?php echo _BAN_ADD_BTN?>" />
5018 <?php $this->pagefoot();
5021 function action_banlistadd() {
5024 $blogid = intPostVar('blogid');
5025 $allblogs = postVar('allblogs');
5026 $iprange = postVar('iprange');
5027 if ($iprange == "custom")
5028 $iprange = postVar('customiprange');
5029 $reason = postVar('reason');
5031 $member->blogAdminRights($blogid) or $this->disallow();
5033 // TODO: check IP range validity
5036 if (!BAN::addBan($blogid, $iprange, $reason))
5037 $this->error(_ERROR_ADDBAN);
5039 // get blogs fot which member has admin rights
5040 $adminblogs = $member->getAdminBlogs();
5042 foreach ($adminblogs as $blogje) {
5043 if (!BAN::addBan($blogje, $iprange, $reason))
5047 $this->error(_ERROR_ADDBAN);
5050 $this->action_banlist();
5054 function action_clearactionlog() {
5057 $member->isAdmin() or $this->disallow();
5061 $this->action_manage(_MSG_ACTIONLOGCLEARED);
5064 function action_backupoverview() {
5065 global $member, $manager;
5067 $member->isAdmin() or $this->disallow();
5071 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
5073 <h2><?php echo _BACKUPS_TITLE?></h2>
5075 <h3><?php echo _BACKUP_TITLE?></h3>
5077 <p><?php echo _BACKUP_INTRO?></p>
5079 <form method="post" action="index.php"><p>
5080 <input type="hidden" name="action" value="backupcreate" />
5081 <?php $manager->addTicketHidden() ?>
5083 <input type="radio" name="gzip" value="1" checked="checked" id="gzip_yes" tabindex="10" /><label for="gzip_yes"><?php echo _BACKUP_ZIP_YES?></label>
5085 <input type="radio" name="gzip" value="0" id="gzip_no" tabindex="10" /><label for="gzip_no" ><?php echo _BACKUP_ZIP_NO?></label>
5087 <input type="submit" value="<?php echo _BACKUP_BTN?>" tabindex="20" />
5091 <div class="note"><?php echo _BACKUP_NOTE?></div>
5094 <h3><?php echo _RESTORE_TITLE?></h3>
5096 <div class="note"><?php echo _RESTORE_NOTE?></div>
5098 <p><?php echo _RESTORE_INTRO?></p>
5100 <form method="post" action="index.php" enctype="multipart/form-data"><p>
5101 <input type="hidden" name="action" value="backuprestore" />
5102 <?php $manager->addTicketHidden() ?>
5103 <input name="backup_file" type="file" tabindex="30" />
5105 <input type="submit" value="<?php echo _RESTORE_BTN?>" tabindex="40" />
5106 <br /><input type="checkbox" name="letsgo" value="1" id="letsgo" tabindex="50" /><label for="letsgo"><?php echo _RESTORE_IMSURE?></label>
5107 <br /><?php echo _RESTORE_WARNING?>
5110 <?php $this->pagefoot();
5113 function action_backupcreate() {
5114 global $member, $DIR_LIBS;
5116 $member->isAdmin() or $this->disallow();
5118 // use compression ?
5119 $useGzip = intval(postVar('gzip'));
5121 include($DIR_LIBS . 'backup.php');
5123 // try to extend time limit
5124 // (creating/restoring dumps might take a while)
5125 @set_time_limit(1200);
5127 do_backup($useGzip);
5132 function action_backuprestore() {
5133 global $member, $DIR_LIBS;
5135 $member->isAdmin() or $this->disallow();
5137 if (intPostVar('letsgo') != 1)
5138 $this->error(_ERROR_BACKUP_NOTSURE);
5140 include($DIR_LIBS . 'backup.php');
5142 // try to extend time limit
5143 // (creating/restoring dumps might take a while)
5144 @set_time_limit(1200);
5146 $message = do_restore();
5148 $this->error($message);
5152 <h2><?php echo _RESTORE_COMPLETE?></h2>
5153 <?php $this->pagefoot();
5158 function action_pluginlist() {
5159 global $member, $manager;
5162 $member->isAdmin() or $this->disallow();
5166 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
5168 echo '<h2>' , _PLUGS_TITLE_MANAGE , ' ', help('plugins'), '</h2>';
5170 echo '<h3>' , _PLUGS_TITLE_INSTALLED , '</h3>';
5173 $query = 'SELECT * FROM '.sql_table('plugin').' ORDER BY porder ASC';
5175 $template['content'] = 'pluginlist';
5176 $template['tabindex'] = 10;
5177 showlist($query, 'table', $template);
5180 <h3><?php echo _PLUGS_TITLE_UPDATE?></h3>
5182 <p><?php echo _PLUGS_TEXT_UPDATE?></p>
5184 <form method="post" action="index.php"><div>
5185 <input type="hidden" name="action" value="pluginupdate" />
5186 <?php $manager->addTicketHidden() ?>
5187 <input type="submit" value="<?php echo _PLUGS_BTN_UPDATE ?>" tabindex="20" />
5190 <h3><?php echo _PLUGS_TITLE_NEW?></h3>
5192 <?php // find a list of possibly non-installed plugins
5193 $candidates = array();
5194 global $DIR_PLUGINS;
5195 $dirhandle = opendir($DIR_PLUGINS);
5196 while ($filename = readdir($dirhandle)) {
5197 if (ereg('^NP_(.*)\.php$',$filename,$matches)) {
5198 $name = $matches[1];
5199 // only show in list when not yet installed
5200 if (mysql_num_rows(sql_query('SELECT * FROM '.sql_table('plugin').' WHERE pfile="NP_'.addslashes($name).'"')) == 0)
5201 array_push($candidates,$name);
5204 closedir($dirhandle);
5206 if (sizeof($candidates) > 0) {
5209 <p><?php echo _PLUGS_ADD_TEXT?></p>
5212 <form method='post' action='index.php'><div>
5213 <input type='hidden' name='action' value='pluginadd' />
5214 <?php $manager->addTicketHidden() ?>
5215 <select name="filename" tabindex="30">
5216 <?php foreach($candidates as $name)
5217 echo '<option value="NP_',$name,'">',htmlspecialchars($name),'</option>';
5220 <input type='submit' tabindex="40" value='<?php echo _PLUGS_BTN_INSTALL?>' />
5223 <?php } else { // sizeof(candidates) == 0
5224 echo '<p>',_PLUGS_NOCANDIDATES,'</p>';
5230 function action_pluginhelp() {
5231 global $member, $manager, $DIR_PLUGINS, $CONF;
5234 $member->isAdmin() or $this->disallow();
5236 $plugid = intGetVar('plugid');
5238 if (!$manager->pidInstalled($plugid))
5239 $this->error(_ERROR_NOSUCHPLUGIN);
5241 $plugName = getPluginNameFromPid($plugid);
5245 echo '<p><a href="index.php?action=pluginlist">(',_PLUGS_BACK,')</a></p>';
5247 echo '<h2>',_PLUGS_HELP_TITLE,': ',htmlspecialchars($plugName),'</h2>';
5249 $plug =& $manager->getPlugin($plugName);
5250 $helpFile = $DIR_PLUGINS.$plug->getShortName().'/help.html';
5252 if (($plug->supportsFeature('HelpPage') > 0) && (@file_exists($helpFile))) {
5253 @readfile($helpFile);
5255 echo '<p>Error: ', _ERROR_PLUGNOHELPFILE,'</p>';
5256 echo '<p><a href="index.php?action=pluginlist">(',_BACK,')</a></p>';
5264 function action_pluginadd() {
5265 global $member, $manager, $DIR_PLUGINS;
5268 $member->isAdmin() or $this->disallow();
5270 $name = postVar('filename');
5272 if ($manager->pluginInstalled($name))
5273 $this->error(_ERROR_DUPPLUGIN);
5274 if (!checkPlugin($name))
5275 $this->error(_ERROR_PLUGFILEERROR . ' (' . $name . ')');
5277 // check if the plugin dependency is met
5278 $plugin =& $manager->getPlugin($name);
5279 $pluginList = $plugin->getPluginDep();
5280 foreach ($pluginList as $pluginName)
5283 $res = sql_query('SELECT * FROM '.sql_table('plugin') . ' WHERE pfile="' . $pluginName . '"');
5284 if (mysql_num_rows($res) == 0)
5286 // uninstall plugin again...
5287 $this->deleteOnePlugin($plugin->getID());
5289 $this->error(_ERROR_INSREQPLUGIN . $pluginName);
5293 // get number of currently installed plugins
5294 $numCurrent = mysql_num_rows(sql_query('SELECT * FROM '.sql_table('plugin')));
5296 // plugin will be added as last one in the list
5297 $newOrder = $numCurrent + 1;
5306 // do this before calling getPlugin (in case the plugin id is used there)
5307 $query = 'INSERT INTO '.sql_table('plugin').' (porder, pfile) VALUES ('.$newOrder.',"'.addslashes($name).'")';
5309 $iPid = mysql_insert_id();
5311 // need to update the plugin object's pid since we didn't have it above when it's first create....
5312 $plugin->plugid = $iPid;
5314 $manager->clearCachedInfo('installedPlugins');
5316 // call the install method of the plugin
5319 sql_query('DELETE FROM ' . sql_table('plugin') . ' WHERE pid='. intval($iPid));
5320 $manager->clearCachedInfo('installedPlugins');
5321 $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)');
5324 // check if plugin needs a newer Nucleus version
5325 if (getNucleusVersion() < $plugin->getMinNucleusVersion())
5327 // uninstall plugin again...
5328 $this->deleteOnePlugin($plugin->getID());
5330 // ...and show error
5331 $this->error(_ERROR_NUCLEUSVERSIONREQ . $plugin->getMinNucleusVersion());
5334 // check if plugin needs a newer Nucleus version
5335 if ((getNucleusVersion() == $plugin->getMinNucleusVersion()) && (getNucleusPatchLevel() < $plugin->getMinNucleusPatchLevel()))
5337 // uninstall plugin again...
5338 $this->deleteOnePlugin($plugin->getID());
5340 // ...and show error
5341 $this->error(_ERROR_NUCLEUSVERSIONREQ . $plugin->getMinNucleusVersion() . ' patch ' . $plugin->getMinNucleusPatchLevel());
5349 'plugin' => &$plugin
5353 // update all events
5354 $this->action_pluginupdate();
5357 function action_pluginupdate() {
5358 global $member, $manager;
5361 $member->isAdmin() or $this->disallow();
5363 // delete everything from plugin_events
5364 sql_query('DELETE FROM '.sql_table('plugin_event'));
5366 // loop over all installed plugins
5367 $res = sql_query('SELECT pid, pfile FROM '.sql_table('plugin'));
5368 while($o = mysql_fetch_object($res)) {
5370 $plug =& $manager->getPlugin($o->pfile);
5373 $eventList = $plug->getEventList();
5374 foreach ($eventList as $eventName)
5375 sql_query('INSERT INTO '.sql_table('plugin_event').' (pid, event) VALUES ('.$pid.', \''.addslashes($eventName).'\')');
5379 $this->action_pluginlist();
5382 function action_plugindelete() {
5383 global $member, $manager;
5386 $member->isAdmin() or $this->disallow();
5388 $pid = intGetVar('plugid');
5390 if (!$manager->pidInstalled($pid))
5391 $this->error(_ERROR_NOSUCHPLUGIN);
5395 <h2><?php echo _DELETE_CONFIRM?></h2>
5397 <p><?php echo _CONFIRMTXT_PLUGIN?> <strong><?php echo getPluginNameFromPid($pid)?></strong>?</p>
5399 <form method="post" action="index.php"><div>
5400 <?php $manager->addTicketHidden() ?>
5401 <input type="hidden" name="action" value="plugindeleteconfirm" />
5402 <input type="hidden" name="plugid" value="<?php echo $pid; ?>" />
5403 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
5405 <?php $this->pagefoot();
5408 function action_plugindeleteconfirm() {
5409 global $member, $manager;
5412 $member->isAdmin() or $this->disallow();
5414 $pid = intPostVar('plugid');
5416 $error = $this->deleteOnePlugin($pid, 1);
5418 $this->error($error);
5421 $this->action_pluginlist();
5424 function deleteOnePlugin($pid, $callUninstall = 0) {
5427 $pid = intval($pid);
5429 if (!$manager->pidInstalled($pid))
5430 return _ERROR_NOSUCHPLUGIN;
5432 $name = quickQuery('SELECT pfile as result FROM '.sql_table('plugin').' WHERE pid='.$pid);
5434 // call the unInstall method of the plugin
5435 if ($callUninstall) {
5436 $plugin =& $manager->getPlugin($name);
5437 if ($plugin) $plugin->unInstall();
5440 // check dependency before delete
5441 $res = sql_query('SELECT pfile FROM '.sql_table('plugin'));
5442 while($o = mysql_fetch_object($res)) {
5443 $plug =& $manager->getPlugin($o->pfile);
5446 $depList = $plug->getPluginDep();
5447 foreach ($depList as $depName)
5449 if ($name == $depName)
5451 return _ERROR_DELREQPLUGIN . $o->pfile;
5457 $manager->notify('PreDeletePlugin', array('plugid' => $pid));
5459 // delete all subscriptions
5460 sql_query('DELETE FROM '.sql_table('plugin_event').' WHERE pid=' . $pid);
5462 // delete all options
5463 // get OIDs from plugin_option_desc
5464 $res = sql_query('SELECT oid FROM ' . sql_table('plugin_option_desc') . ' WHERE opid=' . $pid);
5466 while ($o = mysql_fetch_object($res)) {
5467 array_push($aOIDs, $o->oid);
5470 // delete from plugin_option and plugin_option_desc
5471 sql_query('DELETE FROM '.sql_table('plugin_option_desc').' WHERE opid=' . $pid);
5472 if (count($aOIDs) > 0)
5473 sql_query('DELETE FROM '.sql_table('plugin_option').' WHERE oid in ('.implode(',',$aOIDs).')');
5475 // update order numbers
5476 $o = mysql_fetch_object(sql_query('SELECT porder FROM '.sql_table('plugin').' WHERE pid=' . $pid));
5477 sql_query('UPDATE '.sql_table('plugin').' SET porder=(porder - 1) WHERE porder>'.$o->porder);
5480 sql_query('DELETE FROM '.sql_table('plugin').' WHERE pid='.$pid);
5482 $manager->clearCachedInfo('installedPlugins');
5483 $manager->notify('PostDeletePlugin', array('plugid' => $pid));
5488 function action_pluginup() {
5489 global $member, $manager;
5492 $member->isAdmin() or $this->disallow();
5494 $plugid = intGetVar('plugid');
5496 if (!$manager->pidInstalled($plugid))
5497 $this->error(_ERROR_NOSUCHPLUGIN);
5499 // 1. get old order number
5500 $o = mysql_fetch_object(sql_query('SELECT porder FROM '.sql_table('plugin').' WHERE pid='.$plugid));
5501 $oldOrder = $o->porder;
5503 // 2. calculate new order number
5504 $newOrder = ($oldOrder > 1) ? ($oldOrder - 1) : 1;
5506 // 3. update plug numbers
5507 sql_query('UPDATE '.sql_table('plugin').' SET porder='.$oldOrder.' WHERE porder='.$newOrder);
5508 sql_query('UPDATE '.sql_table('plugin').' SET porder='.$newOrder.' WHERE pid='.$plugid);
5510 $this->action_pluginlist();
5513 function action_plugindown() {
5514 global $member, $manager;
5517 $member->isAdmin() or $this->disallow();
5519 $plugid = intGetVar('plugid');
5520 if (!$manager->pidInstalled($plugid))
5521 $this->error(_ERROR_NOSUCHPLUGIN);
5523 // 1. get old order number
5524 $o = mysql_fetch_object(sql_query('SELECT porder FROM '.sql_table('plugin').' WHERE pid='.$plugid));
5525 $oldOrder = $o->porder;
5527 $maxOrder = mysql_num_rows(sql_query('SELECT * FROM '.sql_table('plugin')));
5529 // 2. calculate new order number
5530 $newOrder = ($oldOrder < $maxOrder) ? ($oldOrder + 1) : $maxOrder;
5532 // 3. update plug numbers
5533 sql_query('UPDATE '.sql_table('plugin').' SET porder='.$oldOrder.' WHERE porder='.$newOrder);
5534 sql_query('UPDATE '.sql_table('plugin').' SET porder='.$newOrder.' WHERE pid='.$plugid);
5536 $this->action_pluginlist();
5539 function action_pluginoptions($message = '') {
5540 global $member, $manager;
5543 $member->isAdmin() or $this->disallow();
5545 $pid = intRequestVar('plugid');
5546 if (!$manager->pidInstalled($pid))
5547 $this->error(_ERROR_NOSUCHPLUGIN);
5549 $extrahead = '<script type="text/javascript" src="javascript/numbercheck.js"></script>';
5550 $this->pagehead($extrahead);
5553 <p><a href="index.php?action=pluginlist">(<?php echo _PLUGS_BACK?>)</a></p>
5555 <h2>Options for <?php echo htmlspecialchars(getPluginNameFromPid($pid))?></h2>
5557 <?php if ($message) echo $message?>
5559 <form action="index.php" method="post">
5561 <input type="hidden" name="action" value="pluginoptionsupdate" />
5562 <input type="hidden" name="plugid" value="<?php echo $pid?>" />
5566 $manager->addTicketHidden();
5568 $aOptions = array();
5570 $query = 'SELECT * FROM ' . sql_table('plugin_option_desc') . ' WHERE ocontext=\'global\' and opid=' . $pid . ' ORDER BY oid ASC';
5571 $r = sql_query($query);
5572 while ($o = mysql_fetch_object($r)) {
5573 array_push($aOIDs, $o->oid);
5574 $aOptions[$o->oid] = array(
5576 'value' => $o->odef,
5577 'name' => $o->oname,
5578 'description' => $o->odesc,
5579 'type' => $o->otype,
5580 'typeinfo' => $o->oextra,
5584 // fill out actual values
5585 if (count($aOIDs) > 0) {
5586 $r = sql_query('SELECT oid, ovalue FROM ' . sql_table('plugin_option') . ' WHERE oid in ('.implode(',',$aOIDs).')');
5587 while ($o = mysql_fetch_object($r))
5588 $aOptions[$o->oid]['value'] = $o->ovalue;
5592 $manager->notify('PrePluginOptionsEdit',array('context' => 'global', 'plugid' => $pid, 'options'=>&$aOptions));
5594 $template['content'] = 'plugoptionlist';
5595 $amount = showlist($aOptions,'table',$template);
5597 echo '<p>',_ERROR_NOPLUGOPTIONS,'</p>';
5602 <?php $this->pagefoot();
5608 function action_pluginoptionsupdate() {
5609 global $member, $manager;
5612 $member->isAdmin() or $this->disallow();
5614 $pid = intRequestVar('plugid');
5615 if (!$manager->pidInstalled($pid))
5616 $this->error(_ERROR_NOSUCHPLUGIN);
5618 $aOptions = requestArray('plugoption');
5619 NucleusPlugin::_applyPluginOptions($aOptions);
5621 $manager->notify('PostPluginOptionsUpdate',array('context' => 'global', 'plugid' => $pid));
5623 $this->action_pluginoptions(_PLUGS_OPTIONS_UPDATED);
5629 function _insertPluginOptions($context, $contextid = 0) {
5630 // get all current values for this contextid
5631 // (note: this might contain doubles for overlapping contextids)
5632 $aIdToValue = array();
5633 $res = sql_query('SELECT oid, ovalue FROM ' . sql_table('plugin_option') . ' WHERE ocontextid=' . intval($contextid));
5634 while ($o = mysql_fetch_object($res)) {
5635 $aIdToValue[$o->oid] = $o->ovalue;
5638 // get list of oids per pid
5639 $query = 'SELECT * FROM ' . sql_table('plugin_option_desc') . ',' . sql_table('plugin')
5640 . ' WHERE opid=pid and ocontext=\''.addslashes($context).'\' ORDER BY porder, oid ASC';
5641 $res = sql_query($query);
5642 $aOptions = array();
5643 while ($o = mysql_fetch_object($res)) {
5644 if (in_array($o->oid, array_keys($aIdToValue)))
5645 $value = $aIdToValue[$o->oid];
5649 array_push($aOptions, array(
5651 'pfile' => $o->pfile,
5654 'name' => $o->oname,
5655 'description' => $o->odesc,
5656 'type' => $o->otype,
5657 'typeinfo' => $o->oextra,
5658 'contextid' => $contextid,
5664 $manager->notify('PrePluginOptionsEdit',array('context' => $context, 'contextid' => $contextid, 'options'=>&$aOptions));
5668 foreach ($aOptions as $aOption) {
5671 if ($iPrevPid != $aOption['pid']) {
5672 $iPrevPid = $aOption['pid'];
5674 echo '<tr><th colspan="2">Options for ', htmlspecialchars($aOption['pfile']),'</th></tr>';
5678 listplug_plugOptionRow($aOption);
5686 /* helper functions to create option forms etc. */
5687 function input_yesno($name, $checkedval,$tabindex = 0, $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO) {
5688 $id = htmlspecialchars($name);
5689 $id = str_replace('[','-',$id);
5690 $id = str_replace(']','-',$id);
5691 $id1 = $id . htmlspecialchars($value1);
5692 $id2 = $id . htmlspecialchars($value2);
5694 echo '<input type="radio" name="', htmlspecialchars($name),'" value="', htmlspecialchars($value1),'" ';
5695 if ($checkedval == $value1)
5696 echo "tabindex='$tabindex' checked='checked'";
5697 echo ' id="'.$id1.'" /><label for="'.$id1.'">' . $yesval . '</label>';
5699 echo '<input type="radio" name="', htmlspecialchars($name),'" value="', htmlspecialchars($value2),'" ';
5700 if ($checkedval != $value1)
5701 echo "tabindex='$tabindex' checked='checked'";
5702 echo ' id="'.$id2.'" /><label for="'.$id2.'">' . $noval . '</label>';
5711 * Uses $call to call a function using parameters $params
5712 * This function should return the amount of entries shown.
5713 * When entries are show, batch operation handlers are shown too.
5714 * When no entries were shown, $errormsg is used to display an error
5716 * Passes on the amount of results found (for further encapsulation)
5718 function doEncapsulate($call, $params, $errorMessage = 'No entries') {
5719 // start output buffering
5722 $nbOfRows = call_user_func_array($call, $params);
5724 // get list contents and stop buffering
5725 $list = ob_get_contents();
5728 if ($nbOfRows > 0) {
5742 * A class used to encapsulate a list of some sort inside next/prev buttons
5744 class NAVLIST extends ENCAPSULATE {
5746 function NAVLIST($action, $start, $amount, $minamount, $maxamount, $blogid, $search, $itemid) {
5747 $this->action = $action;
5748 $this->start = $start;
5749 $this->amount = $amount;
5750 $this->minamount = $minamount;
5751 $this->maxamount = $maxamount;
5752 $this->blogid = $blogid;
5753 $this->search = $search;
5754 $this->itemid = $itemid;
5757 function showBatchList($batchtype, $query, $type, $template, $errorMessage = _LISTS_NOMORE) {
5758 $batch =& new BATCH($batchtype);
5760 $this->doEncapsulate(
5761 array(&$batch, 'showlist'),
5762 array(&$query, $type, $template),
5769 function showHead() {
5770 $this->showNavigation();
5772 function showFoot() {
5773 $this->showNavigation();
5777 * Displays a next/prev bar for long tables
5779 function showNavigation() {
5780 $action = $this->action;
5781 $start = $this->start;
5782 $amount = $this->amount;
5783 $minamount = $this->minamount;
5784 $maxamount = $this->maxamount;
5785 $blogid = $this->blogid;
5786 $search = $this->search;
5787 $itemid = $this->itemid;
5789 $prev = $start - $amount;
5790 if ($prev < $minamount) $prev=$minamount;
5792 // maxamount not used yet
5793 // if ($start + $amount <= $maxamount)
5794 $next = $start + $amount;
5799 <table class="navigation">
5801 <form method="post" action="index.php"><div>
5802 <input type="submit" value="<< <?php echo _LISTS_PREV?>" />
5803 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
5804 <input type="hidden" name="itemid" value="<?php echo $itemid; ?>" />
5805 <input type="hidden" name="action" value="<?php echo $action; ?>" />
5806 <input type="hidden" name="amount" value="<?php echo $amount; ?>" />
5807 <input type="hidden" name="search" value="<?php echo $search; ?>" />
5808 <input type="hidden" name="start" value="<?php echo $prev; ?>" />
5811 <form method="post" action="index.php"><div>
5812 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
5813 <input type="hidden" name="itemid" value="<?php echo $itemid; ?>" />
5814 <input type="hidden" name="action" value="<?php echo $action; ?>" />
5815 <input name="amount" size="3" value="<?php echo $amount; ?>" /> <?php echo _LISTS_PERPAGE?>
5816 <input type="hidden" name="start" value="<?php echo $start; ?>" />
5817 <input type="hidden" name="search" value="<?php echo $search; ?>" />
5818 <input type="submit" value="> <?php echo _LISTS_CHANGE?>" />
5821 <form method="post" action="index.php"><div>
5822 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
5823 <input type="hidden" name="itemid" value="<?php echo $itemid; ?>" />
5824 <input type="hidden" name="action" value="<?php echo $action; ?>" />
5825 <input type="hidden" name="amount" value="<?php echo $amount; ?>" />
5826 <input type="hidden" name="start" value="0" />
5827 <input type="text" name="search" value="<?php echo $search; ?>" size="7" />
5828 <input type="submit" value="> <?php echo _LISTS_SEARCH?>" />
5831 <form method="post" action="index.php"><div>
5832 <input type="submit" value="<?php echo _LISTS_NEXT?> > >" />
5833 <input type="hidden" name="search" value="<?php echo $search; ?>" />
5834 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
5835 <input type="hidden" name="itemid" value="<?php echo $itemid; ?>" />
5836 <input type="hidden" name="action" value="<?php echo $action; ?>" />
5837 <input type="hidden" name="amount" value="<?php echo $amount; ?>" />
5838 <input type="hidden" name="start" value="<?php echo $next; ?>" />
5848 * A class used to encapsulate a list of some sort in a batch selection
5850 class BATCH extends ENCAPSULATE {
5851 function BATCH($type) {
5852 $this->type = $type;
5855 function showHead() {
5857 <form method="post" action="index.php">
5859 // TODO: get a list op operations above the list too
5860 // (be careful not to use the same names for the select...)
5861 // $this->showOperationList();
5864 function showFoot() {
5865 $this->showOperationList();
5870 function showOperationList() {
5873 <div class="batchoperations">
5874 <?php echo _BATCH_WITH_SEL ?>
5875 <select name="batchaction">
5876 <?php $options = array();
5877 switch($this->type) {
5880 'delete' => _BATCH_ITEM_DELETE,
5881 'move' => _BATCH_ITEM_MOVE
5886 'delete' => _BATCH_MEMBER_DELETE,
5887 'setadmin' => _BATCH_MEMBER_SET_ADM,
5888 'unsetadmin' => _BATCH_MEMBER_UNSET_ADM
5893 'delete' => _BATCH_TEAM_DELETE,
5894 'setadmin' => _BATCH_TEAM_SET_ADM,
5895 'unsetadmin' => _BATCH_TEAM_UNSET_ADM,
5900 'delete' => _BATCH_CAT_DELETE,
5901 'move' => _BATCH_CAT_MOVE,
5906 'delete' => _BATCH_COMMENT_DELETE,
5910 foreach ($options as $option => $label) {
5911 echo '<option value="',$option,'">',$label,'</option>';
5915 <input type="hidden" name="action" value="batch<?php echo $this->type?>" />
5917 $manager->addTicketHidden();
5919 // add hidden fields for 'team' and 'comment' batchlists
5920 if ($this->type == 'team')
5922 echo '<input type="hidden" name="blogid" value="',intRequestVar('blogid'),'" />';
5924 if ($this->type == 'comment')
5926 echo '<input type="hidden" name="itemid" value="',intRequestVar('itemid'),'" />';
5929 echo '<input type="submit" value="',_BATCH_EXEC,'" />';
5931 <a href="" onclick="if (event && event.preventDefault) event.preventDefault(); return batchSelectAll(1); "><?php echo _BATCH_SELECTALL?></a> -
5932 <a href="" onclick="if (event && event.preventDefault) event.preventDefault(); return batchSelectAll(0); "><?php echo _BATCH_DESELECTALL?></a>
5938 function showList($query, $type, $template, $errorMessage = _LISTS_NOMORE) {
5939 return $this->doEncapsulate( 'showlist',
5940 array($query, $type, $template),
5949 // can take either an array of objects, or an SQL query
5950 function showlist($query, $type, $template) {
5952 if (is_array($query)) {
5953 if (sizeof($query) == 0)
5956 call_user_func('listplug_' . $type, $template, 'HEAD');
5958 foreach ($query as $currentObj) {
5959 $template['current'] = $currentObj;
5960 call_user_func('listplug_' . $type, $template, 'BODY');
5963 call_user_func('listplug_' . $type, $template, 'FOOT');
5965 return sizeof($query);
5968 $res = sql_query($query);
5970 // don't do anything if there are no results
5971 $numrows = mysql_num_rows($res);
5975 call_user_func('listplug_' . $type, $template, 'HEAD');
5977 while($template['current'] = mysql_fetch_object($res))
5978 call_user_func('listplug_' . $type, $template, 'BODY');
5980 call_user_func('listplug_' . $type, $template, 'FOOT');
5982 mysql_free_result($res);
5984 // return amount of results
5989 function listplug_select($template, $type) {
5992 echo '<select name="'.$template['name'].'" tabindex="'.$template['tabindex'].'" '.$template['javascript'].'>';
5994 // add extra row if needed
5995 if ($template['extra']) {
5996 echo '<option value="',$template['extraval'],'">',$template['extra'],'</option>';
6001 $current = $template['current'];
6003 echo '<option value="' . htmlspecialchars($current->value) . '"';
6004 if ($template['selected'] == $current->value)
6005 echo ' selected="selected" ';
6006 if ($template['shorten'] > 0) {
6007 echo ' title="'. htmlspecialchars($current->text).'"';
6008 $current->text = shorten($current->text, $template['shorten'], $template['shortenel']);
6010 echo '>' . htmlspecialchars($current->text) . '</option>';
6018 function listplug_table($template, $type) {
6024 call_user_func("listplug_table_" . $template['content'] , $template, 'HEAD');
6025 echo "</tr></thead><tbody>";
6028 // print tabletype specific thingies
6029 echo "<tr onmouseover='focusRow(this);' onmouseout='blurRow(this);'>";
6030 call_user_func("listplug_table_" . $template['content'] , $template, 'BODY');
6034 call_user_func("listplug_table_" . $template['content'] , $template, 'FOOT');
6035 echo "</tbody></table>";
6040 function listplug_table_memberlist($template, $type) {
6043 echo '<th>' . _LIST_MEMBER_NAME . '</th><th>' . _LIST_MEMBER_RNAME . '</th><th>' . _LIST_MEMBER_URL . '</th><th>' . _LIST_MEMBER_ADMIN;
6045 echo "</th><th>" . _LIST_MEMBER_LOGIN;
6047 echo "</th><th colspan='2'>" . _LISTS_ACTIONS. "</th>";
6050 $current = $template['current'];
6053 $id = listplug_nextBatchId();
6054 echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->mnumber,'" />';
6055 echo '<label for="batch',$id,'">';
6056 echo "<a href='mailto:", htmlspecialchars($current->memail), "' tabindex='".$template['tabindex']."'>", htmlspecialchars($current->mname), "</a>";
6059 echo '<td>', htmlspecialchars($current->mrealname), '</td>';
6060 echo "<td><a href='$current->murl' tabindex='".$template['tabindex']."'>$current->murl</a></td>";
6061 echo '<td>', ($current->madmin ? _YES : _NO),'</td>';
6062 echo '<td>', ($current->mcanlogin ? _YES : _NO), '</td>';
6063 echo "<td><a href='index.php?action=memberedit&memberid=$current->mnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
6064 echo "<td><a href='index.php?action=memberdelete&memberid=$current->mnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
6069 function listplug_table_teamlist($template, $type) {
6073 echo "<th>"._LIST_MEMBER_NAME."</th><th>"._LIST_MEMBER_RNAME."</th><th>"._LIST_TEAM_ADMIN;
6075 echo "</th><th colspan='2'>"._LISTS_ACTIONS."</th>";
6078 $current = $template['current'];
6081 $id = listplug_nextBatchId();
6082 echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->tmember,'" />';
6083 echo '<label for="batch',$id,'">';
6084 echo "<a href='mailto:", htmlspecialchars($current->memail), "' tabindex='".$template['tabindex']."'>", htmlspecialchars($current->mname), "</a>";
6087 echo '<td>', htmlspecialchars($current->mrealname), '</td>';
6088 echo '<td>', ($current->tadmin ? _YES : _NO) , '</td>';
6089 echo "<td><a href='index.php?action=teamdelete&memberid=$current->tmember&blogid=$current->tblog' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
6091 $url = 'index.php?action=teamchangeadmin&memberid=' . intval($current->tmember) . '&blogid=' . intval($current->tblog);
6092 $url = $manager->addTicketToUrl($url);
6093 echo "<td><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LIST_TEAM_CHADMIN."</a></td>";
6098 function encode_desc(&$data)
6099 { //_$to_entities = get_html_translation_table(HTML_ENTITIES);
6100 $to_entities = get_html_translation_table(HTML_SPECIALCHARS);
6101 $from_entities = array_flip($to_entities);
6102 $data = str_replace('<br />','\n',$data); //hack
6103 $data = strtr($data,$from_entities);
6104 $data = strtr($data,$to_entities);
6105 $data = str_replace('\n','<br />',$data); //hack
6109 function listplug_table_pluginlist($template, $type) {
6113 echo '<th>'._LISTS_INFO.'</th><th>'._LISTS_DESC.'</th>';
6114 echo '<th style="white-space:nowrap">'._LISTS_ACTIONS.'</th>';
6117 $current = $template['current'];
6119 $plug =& $manager->getPlugin($current->pfile);
6122 echo '<strong>' , htmlspecialchars($plug->getName()) , '</strong><br />';
6123 echo _LIST_PLUGS_AUTHOR, ' ' , htmlspecialchars($plug->getAuthor()) , '<br />';
6124 echo _LIST_PLUGS_VER, ' ' , htmlspecialchars($plug->getVersion()) , '<br />';
6125 if ($plug->getURL())
6126 echo '<a href="',htmlspecialchars($plug->getURL()),'" tabindex="'.$template['tabindex'].'">',_LIST_PLUGS_SITE,'</a><br />';
6129 echo _LIST_PLUGS_DESC .'<br/>'. encode_desc($plug->getDescription());
6130 if (sizeof($plug->getEventList()) > 0) {
6131 echo '<br /><br />',_LIST_PLUGS_SUBS,'<br />',htmlspecialchars(implode($plug->getEventList(),', '));
6132 // check the database to see if it is up-to-date and notice the user if not
6134 if (!$plug->subscribtionListIsUptodate()) {
6135 echo '<br /><br /><strong>',_LIST_PLUG_SUBS_NEEDUPDATE,'</strong>';
6137 if (sizeof($plug->getPluginDep()) > 0)
6138 echo '<br /><br />',_LIST_PLUGS_DEP,'<br />',htmlspecialchars(implode($plug->getPluginDep(),', '));
6141 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>';
6145 $baseUrl = 'index.php?plugid=' . intval($current->pid) . '&action=';
6146 $url = $manager->addTicketToUrl($baseUrl . 'pluginup');
6147 echo "<a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_UP,"</a>";
6148 $url = $manager->addTicketToUrl($baseUrl . 'plugindown');
6149 echo "<br /><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_DOWN,"</a>";
6150 echo "<br /><a href='index.php?action=plugindelete&plugid=$current->pid' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_UNINSTALL,"</a>";
6151 if ($plug && ($plug->hasAdminArea() > 0))
6152 echo "<br /><a href='".htmlspecialchars($plug->getAdminURL())."' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_ADMIN,"</a>";
6153 if ($plug && ($plug->supportsFeature('HelpPage') > 0))
6154 echo "<br /><a href='index.php?action=pluginhelp&plugid=$current->pid' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_HELP,"</a>";
6155 if (quickQuery('SELECT COUNT(*) AS result FROM '.sql_table('plugin_option_desc').' WHERE ocontext=\'global\' and opid='.$current->pid) > 0)
6156 echo "<br /><a href='index.php?action=pluginoptions&plugid=$current->pid' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_OPTIONS,"</a>";
6162 function listplug_table_plugoptionlist($template, $type) {
6166 echo '<th>'._LISTS_INFO.'</th><th>'._LISTS_VALUE.'</th>';
6169 $current = $template['current'];
6170 listplug_plugOptionRow($current);
6175 <th colspan="2"><?php echo _PLUGS_SAVE?></th>
6177 <td><?php echo _PLUGS_SAVE?></td>
6178 <td><input type="submit" value="<?php echo _PLUGS_SAVE?>" /></td>
6184 function listplug_plugOptionRow($current) {
6185 $varname = 'plugoption['.$current['oid'].']['.$current['contextid'].']';
6186 // retreive the optionmeta
6187 $meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
6189 // only if it is not a hidden option write the controls to the page
6190 if ($meta['access'] != 'hidden') {
6191 echo '<td>',htmlspecialchars($current['description']?$current['description']:$current['name']),'</td>';
6193 switch($current['type']) {
6195 ADMIN::input_yesno($varname, $current['value'], 0, 'yes', 'no');
6198 echo '<input type="password" size="40" maxlength="128" name="',htmlspecialchars($varname),'" value="',htmlspecialchars($current['value']),'" />';
6201 echo '<select name="'.htmlspecialchars($varname).'">';
6202 $aOptions = NucleusPlugin::getOptionSelectValues($current['typeinfo']);
6203 $aOptions = explode('|', $aOptions);
6204 for ($i=0; $i<(count($aOptions)-1); $i+=2) {
6205 echo '<option value="'.htmlspecialchars($aOptions[$i+1]).'"';
6206 if ($aOptions[$i+1] == $current['value'])
6207 echo ' selected="selected"';
6208 echo '>'.htmlspecialchars($aOptions[$i]).'</option>';
6213 //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
6214 echo '<textarea class="pluginoption" cols="30" rows="5" name="',htmlspecialchars($varname),'"';
6215 if ($meta['access'] == 'readonly') {
6216 echo ' readonly="readonly"';
6218 echo '>',htmlspecialchars($current['value']),'</textarea>';
6222 //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
6224 echo '<input type="text" size="40" maxlength="128" name="',htmlspecialchars($varname),'" value="',htmlspecialchars($current['value']),'"';
6225 if ($meta['datatype'] == 'numerical') {
6226 echo ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';
6228 if ($meta['access'] == 'readonly') {
6229 echo ' readonly="readonly"';
6233 echo $current['extra'];
6238 function listplug_table_itemlist($template, $type) {
6241 echo "<th>"._LIST_ITEM_INFO."</th><th>"._LIST_ITEM_CONTENT."</th><th style=\"white-space:nowrap\" colspan='1'>"._LISTS_ACTIONS."</th>";
6244 $current = $template['current'];
6245 $current->itime = strtotime($current->itime); // string -> unix timestamp
6247 if ($current->idraft == 1)
6248 $cssclass = "class='draft'";
6250 // (can't use offset time since offsets might vary between blogs)
6251 if ($current->itime > $template['now'])
6252 $cssclass = "class='future'";
6254 echo "<td $cssclass>",_LIST_ITEM_BLOG,' ', htmlspecialchars($current->bshortname);
6255 echo " <br />",_LIST_ITEM_CAT,' ', htmlspecialchars($current->cname);
6256 echo " <br />",_LIST_ITEM_AUTHOR, ' ', htmlspecialchars($current->mname);
6257 echo " <br />",_LIST_ITEM_DATE," " . date("Y-m-d",$current->itime);
6258 echo "<br />",_LIST_ITEM_TIME," " . date("H:i",$current->itime);
6260 echo "<td $cssclass>";
6262 $id = listplug_nextBatchId();
6264 echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->inumber,'" />';
6265 echo '<label for="batch',$id,'">';
6266 echo "<b>" . htmlspecialchars(strip_tags($current->ititle)) . "</b>";
6271 $current->ibody = strip_tags($current->ibody);
6272 $current->ibody = htmlspecialchars(shorten($current->ibody,300,'...'));
6274 echo "$current->ibody</td>";
6275 echo "<td style=\"white-space:nowrap\" $cssclass>";
6276 echo "<a href='index.php?action=itemedit&itemid=$current->inumber'>"._LISTS_EDIT."</a>";
6277 echo "<br /><a href='index.php?action=itemcommentlist&itemid=$current->inumber'>"._LISTS_COMMENTS."</a>";
6278 echo "<br /><a href='index.php?action=itemmove&itemid=$current->inumber'>"._LISTS_MOVE."</a>";
6279 echo "<br /><a href='index.php?action=itemdelete&itemid=$current->inumber'>"._LISTS_DELETE."</a>";
6285 // for batch operations: generates the index numbers for checkboxes
6286 function listplug_nextBatchId() {
6291 function listplug_table_commentlist($template, $type) {
6294 echo "<th>"._LISTS_INFO."</th><th>"._LIST_COMMENT."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
6297 $current = $template['current'];
6298 $current->ctime = strtotime($current->ctime); // string -> unix timestamp
6301 echo date("Y-m-d@H:i",$current->ctime);
6303 if ($current->mname)
6304 echo htmlspecialchars($current->mname) ,' ', _LIST_COMMENTS_MEMBER;
6306 echo htmlspecialchars($current->cuser);
6310 $current->cbody = strip_tags($current->cbody);
6311 $current->cbody = htmlspecialchars(shorten($current->cbody, 300, '...'));
6314 $id = listplug_nextBatchId();
6315 echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->cnumber,'" />';
6316 echo '<label for="batch',$id,'">';
6317 echo $current->cbody;
6321 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=commentedit&commentid=$current->cnumber'>"._LISTS_EDIT."</a></td>";
6322 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=commentdelete&commentid=$current->cnumber'>"._LISTS_DELETE."</a></td>";
6323 if ($template['canAddBan'])
6324 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>";
6330 function listplug_table_bloglist($template, $type) {
6333 echo "<th>" . _NAME . "</th><th colspan='7'>" ._LISTS_ACTIONS. "</th>";
6336 $current = $template['current'];
6338 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>";
6339 echo "<td><a href='index.php?action=createitem&blogid=$current->bnumber' title='" . _BLOGLIST_TT_ADD ."'>" . _BLOGLIST_ADD . "</a></td>";
6340 echo "<td><a href='index.php?action=itemlist&blogid=$current->bnumber' title='". _BLOGLIST_TT_EDIT."'>". _BLOGLIST_EDIT."</a></td>";
6341 echo "<td><a href='index.php?action=blogcommentlist&blogid=$current->bnumber' title='". _BLOGLIST_TT_COMMENTS."'>". _BLOGLIST_COMMENTS."</a></td>";
6342 echo "<td><a href='index.php?action=bookmarklet&blogid=$current->bnumber' title='". _BLOGLIST_TT_BMLET."'>". _BLOGLIST_BMLET . "</a></td>";
6344 if ($current->tadmin == 1) {
6345 echo "<td><a href='index.php?action=blogsettings&blogid=$current->bnumber' title='" . _BLOGLIST_TT_SETTINGS . "'>" ._BLOGLIST_SETTINGS. "</a></td>";
6346 echo "<td><a href='index.php?action=banlist&blogid=$current->bnumber' title='" . _BLOGLIST_TT_BANS. "'>". _BLOGLIST_BANS."</a></td>";
6349 if ($template['superadmin']) {
6350 echo "<td><a href='index.php?action=deleteblog&blogid=$current->bnumber' title='". _BLOGLIST_TT_DELETE."'>" ._BLOGLIST_DELETE. "</a></td>";
6359 function listplug_table_shortblognames($template, $type) {
6362 echo "<th>" . _NAME . "</th><th>" . _NAME. "</th>";
6365 $current = $template['current'];
6367 echo '<td>' , htmlspecialchars($current->bshortname) , '</td>';
6368 echo '<td>' , htmlspecialchars($current->bname) , '</td>';
6374 function listplug_table_shortnames($template, $type) {
6377 echo "<th>" . _NAME . "</th><th>" . _LISTS_DESC. "</th>";
6380 $current = $template['current'];
6382 echo '<td>' , htmlspecialchars($current->name) , '</td>';
6383 echo '<td>' , htmlspecialchars($current->description) , '</td>';
6390 function listplug_table_categorylist($template, $type) {
6393 echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='2'>"._LISTS_ACTIONS."</th>";
6396 $current = $template['current'];
6399 $id = listplug_nextBatchId();
6400 echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->catid,'" />';
6401 echo '<label for="batch',$id,'">';
6402 echo htmlspecialchars($current->cname);
6406 echo '<td>', htmlspecialchars($current->cdesc), '</td>';
6407 echo "<td><a href='index.php?action=categorydelete&blogid=$current->cblog&catid=$current->catid' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
6408 echo "<td><a href='index.php?action=categoryedit&blogid=$current->cblog&catid=$current->catid' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
6415 function listplug_table_templatelist($template, $type) {
6419 echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
6422 $current = $template['current'];
6424 echo "<td>" , htmlspecialchars($current->tdname), "</td>";
6425 echo "<td>" , htmlspecialchars($current->tddesc), "</td>";
6426 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=templateedit&templateid=$current->tdnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
6428 $url = $manager->addTicketToUrl('index.php?action=templateclone&templateid=' . intval($current->tdnumber));
6429 echo "<td style=\"white-space:nowrap\"><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LISTS_CLONE."</a></td>";
6430 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=templatedelete&templateid=$current->tdnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
6436 function listplug_table_skinlist($template, $type) {
6437 global $CONF, $DIR_SKINS, $manager;
6440 echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
6443 $current = $template['current'];
6447 // use a special style for the default skin
6448 if ($current->sdnumber == $CONF['BaseSkin']) {
6449 echo '<strong>',htmlspecialchars($current->sdname),'</strong>';
6451 echo htmlspecialchars($current->sdname);
6454 echo '<br /><br />';
6455 echo _LISTS_TYPE ,': ' , htmlspecialchars($current->sdtype);
6456 echo '<br />', _LIST_SKINS_INCMODE , ' ' , (($current->sdincmode=='skindir') ?_PARSER_INCMODE_SKINDIR:_PARSER_INCMODE_NORMAL);
6457 if ($current->sdincpref) echo '<br />' , _LIST_SKINS_INCPREFIX , ' ', htmlspecialchars($current->sdincpref);
6459 // add preview image when present
6460 if ($current->sdincpref && @file_exists($DIR_SKINS . $current->sdincpref . 'preview.png'))
6462 echo '<br /><br />';
6464 $hasEnlargement = @file_exists($DIR_SKINS . $current->sdincpref . 'preview-large.png');
6465 if ($hasEnlargement)
6466 echo '<a href="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview-large.png" title="View larger">';
6468 echo '<img class="skinpreview" src="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview.png" width="100" height="75" alt="Preview for \'',htmlspecialchars($current->sdname),'\' skin" />';
6470 if ($hasEnlargement)
6473 if (@file_exists($DIR_SKINS . $current->sdincpref . 'readme.html'))
6475 echo '<br /><a href="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'readme.html" title="More info on the \'',htmlspecialchars($current->sdname),'\' skin">Readme</a>';
6484 echo "<td>" , htmlspecialchars($current->sddesc);
6485 // show list of defined parts
6486 $r = sql_query('SELECT stype FROM '.sql_table('skin').' WHERE sdesc='.$current->sdnumber . ' ORDER BY stype');
6488 while ($o = mysql_fetch_object($r))
6489 array_push($types,$o->stype);
6490 if (sizeof($types) > 0) {
6491 $friendlyNames = SKIN::getFriendlyNames();
6492 for ($i=0;$i<sizeof($types);$i++) {
6494 $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>";
6496 echo '<br /><br />',_LIST_SKINS_DEFINED,' <ul>',implode($types,'') ,'</ul>';
6499 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skinedit&skinid=$current->sdnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
6501 $url = $manager->addTicketToUrl('index.php?action=skinclone&skinid=' . intval($current->sdnumber));
6502 echo "<td style=\"white-space:nowrap\"><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LISTS_CLONE."</a></td>";
6503 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skindelete&skinid=$current->sdnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
6509 function listplug_table_draftlist($template, $type) {
6512 echo "<th>"._LISTS_BLOG."</th><th>"._LISTS_TITLE."</th><th colspan='2'>"._LISTS_ACTIONS."</th>";
6515 $current = $template['current'];
6517 echo '<td>', htmlspecialchars($current->bshortname) , '</td>';
6518 echo '<td>', htmlspecialchars(strip_tags($current->ititle)) , '</td>';
6519 echo "<td><a href='index.php?action=itemedit&itemid=$current->inumber'>"._LISTS_EDIT."</a></td>";
6520 echo "<td><a href='index.php?action=itemdelete&itemid=$current->inumber'>"._LISTS_DELETE."</a></td>";
6527 function listplug_table_actionlist($template, $type) {
6530 echo '<th>'._LISTS_TIME.'</th><th>'._LIST_ACTION_MSG.'</th>';
6533 $current = $template['current'];
6535 echo '<td>' , htmlspecialchars($current->timestamp), '</td>';
6536 echo '<td>' , htmlspecialchars($current->message), '</td>';
6542 function listplug_table_banlist($template, $type) {
6545 echo '<th>'._LIST_BAN_IPRANGE.'</th><th>'. _LIST_BAN_REASON.'</th><th>'._LISTS_ACTIONS.'</th>';
6548 $current = $template['current'];
6550 echo '<td>' , htmlspecialchars($current->iprange) , '</td>';
6551 echo '<td>' , htmlspecialchars($current->reason) , '</td>';
6552 echo "<td><a href='index.php?action=banlistdelete&blogid=", intval($current->blogid) , "&iprange=" , htmlspecialchars($current->iprange) , "'>",_LISTS_DELETE,"</a></td>";
6558 * Returns the Javascript code for a bookmarklet that works on most modern browsers
6562 function getBookmarklet($blogid) {
6566 $document = 'document';
6567 $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('";
6568 $bookmarkletline .= $CONF['AdminURL'] . "bookmarklet.php?blogid=$blogid";
6569 $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();";
6571 return $bookmarkletline;