3 * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
\r
4 * Copyright (C) 2002-2004 The Nucleus Group
\r
6 * This program is free software; you can redistribute it and/or
\r
7 * modify it under the terms of the GNU General Public License
\r
8 * as published by the Free Software Foundation; either version 2
\r
9 * of the License, or (at your option) any later version.
\r
10 * (see nucleus/documentation/index.html#license for more info)
\r
12 * The code for the Nucleus admin area
\r
17 // action currently being executed ($action=xxxx -> action_xxxx method)
\r
25 * Executes an action
\r
28 * action to be performed
\r
30 function action($action) {
\r
31 // list of action aliases
\r
33 'login' => 'overview',
\r
37 if ($alias[$action])
\r
38 $action = $alias[$action];
\r
40 $methodName = 'action_' . $action;
\r
42 $this->action = $action;
\r
44 if (method_exists($this, $methodName))
\r
45 call_user_func(array(&$this, $methodName));
\r
47 $this->error(_BADACTION . " ($action)");
\r
52 function action_showlogin() {
\r
54 $this->action_login($error);
\r
57 function action_login($msg = '', $passvars = 1) {
\r
60 // skip to overview when allowed
\r
61 if ($member->isLoggedIn() && $member->canLogin()) {
\r
62 $this->action_overview();
\r
68 echo '<h2>', _LOGIN ,'</h2>';
\r
69 if ($msg) echo _MESSAGE , ': ', htmlspecialchars($msg);
\r
72 <form action="index.php" method="post"><p>
\r
73 <?php echo _LOGIN_NAME?>: <br /><input name="login" tabindex="10" />
\r
75 <?php echo _LOGIN_PASSWORD?>: <br /><input name="password" tabindex="20" type="password" />
\r
77 <input name="action" value="login" type="hidden" />
\r
79 <input type="submit" value="<?php echo _LOGIN?>" tabindex="30" />
\r
82 <input type="checkbox" value="1" name="shared" tabindex="40" id="shared" /><label for="shared"><?php echo _LOGIN_SHARED?></label>
\r
83 <br /><a href="forgotpassword.html"><?php echo _LOGIN_FORGOT?></a>
\r
85 <?php // pass through vars
\r
87 $oldaction = postVar('oldaction');
\r
88 if ( ($oldaction != 'logout') && ($oldaction != 'login') && $passvars ) {
\r
95 <?php $this->pagefoot();
\r
100 * provides a screen with the overview of the actions available
\r
102 function action_overview($msg = '') {
\r
108 echo _MESSAGE , ': ', $msg;
\r
110 /* ---- add items ---- */
\r
111 echo '<h2>' . _OVERVIEW_YRBLOGS . '</h2>';
\r
113 $showAll = requestVar('showall');
\r
115 if (($member->isAdmin()) && ($showAll == 'yes')) {
\r
116 // Super-Admins have access to all blogs! (no add item support though)
\r
117 $query = 'SELECT bnumber, bname, 1 as tadmin, burl, bshortname'
\r
118 . ' FROM ' . sql_table('blog')
\r
119 . ' ORDER BY bname';
\r
121 $query = 'SELECT bnumber, bname, tadmin, burl, bshortname'
\r
122 . ' FROM ' . sql_table('blog') . ', ' . sql_table('team')
\r
123 . ' WHERE tblog=bnumber and tmember=' . $member->getID()
\r
124 . ' ORDER BY bname';
\r
126 $template['content'] = 'bloglist';
\r
127 $template['superadmin'] = $member->isAdmin();
\r
128 $amount = showlist($query,'table',$template);
\r
130 if (($showAll != 'yes') && ($member->isAdmin())) {
\r
131 $total = quickQuery('SELECT COUNT(*) as result FROM ' . sql_table('blog'));
\r
132 if ($total > $amount)
\r
133 echo '<p><a href="index.php?action=overview&showall=yes">Show all blogs</a></p>';
\r
137 echo _OVERVIEW_NOBLOGS;
\r
139 if ($amount != 0) {
\r
140 echo '<h2>' . _OVERVIEW_YRDRAFTS . '</h2>';
\r
141 $query = 'SELECT ititle, inumber, bshortname'
\r
142 . ' FROM ' . sql_table('item'). ', ' . sql_table('blog')
\r
143 . ' WHERE iauthor='.$member->getID().' and iblog=bnumber and idraft=1';
\r
144 $template['content'] = 'draftlist';
\r
145 $amountdrafts = showlist($query, 'table', $template);
\r
146 if ($amountdrafts == 0)
\r
147 echo _OVERVIEW_NODRAFTS;
\r
150 /* ---- user settings ---- */
\r
151 echo '<h2>' . _OVERVIEW_YRSETTINGS . '</h2>';
\r
153 echo '<li><a href="index.php?action=editmembersettings">' . _OVERVIEW_EDITSETTINGS. '</a></li>';
\r
154 echo '<li><a href="index.php?action=browseownitems">' . _OVERVIEW_BROWSEITEMS.'</a></li>';
\r
155 echo '<li><a href="index.php?action=browseowncomments">'._OVERVIEW_BROWSECOMM.'</a></li>';
\r
158 /* ---- general settings ---- */
\r
159 if ($member->isAdmin()) {
\r
160 echo '<h2>' . _OVERVIEW_MANAGEMENT. '</h2>';
\r
162 echo '<li><a href="index.php?action=manage">',_OVERVIEW_MANAGE,'</a></li>';
\r
170 // returns a link to a weblog (takes BLOG object as parameter)
\r
171 function bloglink(&$blog) {
\r
172 return '<a href="'.htmlspecialchars($blog->getURL()).'" title="'._BLOGLIST_TT_VISIT.'">'.$blog->getName() .'</a>';
\r
175 function action_manage($msg = '') {
\r
178 $member->isAdmin() or $this->disallow();
\r
182 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
\r
185 echo '<p>' , _MESSAGE , ': ', $msg , '</p>';
\r
188 echo '<h2>' . _MANAGE_GENERAL. '</h2>';
\r
191 echo '<li><a href="index.php?action=createnewlog">'._OVERVIEW_NEWLOG.'</a></li>';
\r
192 echo '<li><a href="index.php?action=settingsedit">'._OVERVIEW_SETTINGS.'</a></li>';
\r
193 echo '<li><a href="index.php?action=usermanagement">'._OVERVIEW_MEMBERS.'</a></li>';
\r
194 echo '<li><a href="index.php?action=actionlog">'._OVERVIEW_VIEWLOG.'</a></li>';
\r
197 echo '<h2>' . _MANAGE_SKINS . '</h2>';
\r
199 echo '<li><a href="index.php?action=skinoverview">'._OVERVIEW_SKINS.'</a></li>';
\r
200 echo '<li><a href="index.php?action=templateoverview">'._OVERVIEW_TEMPLATES.'</a></li>';
\r
201 echo '<li><a href="index.php?action=skinieoverview">'._OVERVIEW_SKINIMPORT.'</a></li>';
\r
204 echo '<h2>' . _MANAGE_EXTRA . '</h2>';
\r
206 echo '<li><a href="index.php?action=backupoverview">'._OVERVIEW_BACKUP.'</a></li>';
\r
207 echo '<li><a href="index.php?action=pluginlist">'._OVERVIEW_PLUGINS.'</a></li>';
\r
210 $this->pagefoot();
\r
213 function action_itemlist($blogid = '') {
\r
214 global $member, $manager;
\r
217 $blogid = intRequestVar('blogid');
\r
219 $member->teamRights($blogid) or $member->isAdmin() or $this->disallow();
\r
222 $blog =& $manager->getBlog($blogid);
\r
224 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
\r
225 echo '<h2>' . _ITEMLIST_BLOG . ' ' . $this->bloglink($blog) . '</h2>';
\r
228 if (postVar('start'))
\r
229 $start = intPostVar('start');
\r
234 echo '<p><a href="index.php?action=createitem&blogid='.$blogid.'">',_ITEMLIST_ADDNEW,'</a></p>';
\r
236 // amount of items to show
\r
237 if (postVar('amount'))
\r
238 $amount = intPostVar('amount');
\r
242 $search = postVar('search'); // search through items
\r
244 $query = 'SELECT bshortname, cname, mname, ititle, ibody, inumber, idraft, itime'
\r
245 . ' FROM ' . sql_table('item') . ', ' . sql_table('blog') . ', ' . sql_table('member') . ', ' . sql_table('category')
\r
246 . ' WHERE iblog=bnumber and iauthor=mnumber and icat=catid and iblog=' . $blogid;
\r
249 $query .= ' and ((ititle LIKE "%' . addslashes($search) . '%") or (ibody LIKE "%' . addslashes($search) . '%") or (imore LIKE "%' . addslashes($search) . '%"))';
\r
251 // non-blog-admins can only edit/delete their own items
\r
252 if (!$member->blogAdminRights($blogid))
\r
253 $query .= ' and iauthor=' . $member->getID();
\r
256 $query .= ' ORDER BY itime DESC'
\r
257 . " LIMIT $start,$amount";
\r
259 $template['content'] = 'itemlist';
\r
260 $template['now'] = $blog->getCorrectTime(time());
\r
263 $navList = new NAVLIST('itemlist', $start, $amount, 0, 1000, $blogid, $search, 0);
\r
264 $navList->showBatchList('item',$query,'table',$template);
\r
271 function action_batchitem() {
\r
272 global $member, $manager;
\r
274 // check if logged in
\r
275 $member->isLoggedIn() or $this->disallow();
\r
277 // more precise check will be done for each performed operation
\r
279 // get array of itemids from request
\r
280 $selected = requestIntArray('batch');
\r
281 $action = requestVar('batchaction');
\r
283 // Show error when no items were selected
\r
284 if (!is_array($selected) || sizeof($selected) == 0)
\r
285 $this->error(_BATCH_NOSELECTION);
\r
287 // On move: when no destination blog/category chosen, show choice now
\r
288 $destCatid = intRequestVar('destcatid');
\r
289 if (($action == 'move') && (!$manager->existsCategory($destCatid)))
\r
290 $this->batchMoveSelectDestination('item',$selected);
\r
292 // On delete: check if confirmation has been given
\r
293 if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
\r
294 $this->batchAskDeleteConfirmation('item',$selected);
\r
298 echo '<a href="index.php?action=overview">(',_BACKHOME,')</a>';
\r
299 echo '<h2>',_BATCH_ITEMS,'</h2>';
\r
300 echo '<p>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b></p>';
\r
304 // walk over all itemids and perform action
\r
305 foreach ($selected as $itemid) {
\r
306 $itemid = intval($itemid);
\r
307 echo '<li>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b> ',_BATCH_ONITEM,' <b>', $itemid, '</b>...';
\r
309 // perform action, display errors if needed
\r
312 $error = $this->deleteOneItem($itemid);
\r
315 $error = $this->moveOneItem($itemid, $destCatid);
\r
318 $error = _BATCH_UNKNOWN . $action;
\r
321 echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
\r
326 echo '<b>',_BATCH_DONE,'</b>';
\r
333 function action_batchcomment() {
\r
336 // check if logged in
\r
337 $member->isLoggedIn() or $this->disallow();
\r
339 // more precise check will be done for each performed operation
\r
341 // get array of itemids from request
\r
342 $selected = requestIntArray('batch');
\r
343 $action = requestVar('batchaction');
\r
345 // Show error when no items were selected
\r
346 if (!is_array($selected) || sizeof($selected) == 0)
\r
347 $this->error(_BATCH_NOSELECTION);
\r
349 // On delete: check if confirmation has been given
\r
350 if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
\r
351 $this->batchAskDeleteConfirmation('comment',$selected);
\r
355 echo '<a href="index.php?action=overview">(',_BACKHOME,')</a>';
\r
356 echo '<h2>',_BATCH_COMMENTS,'</h2>';
\r
357 echo '<p>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b></p>';
\r
360 // walk over all itemids and perform action
\r
361 foreach ($selected as $commentid) {
\r
362 $commentid = intval($commentid);
\r
363 echo '<li>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b> ',_BATCH_ONCOMMENT,' <b>', $commentid, '</b>...';
\r
365 // perform action, display errors if needed
\r
368 $error = $this->deleteOneComment($commentid);
\r
371 $error = _BATCH_UNKNOWN . $action;
\r
374 echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
\r
379 echo '<b>',_BATCH_DONE,'</b>';
\r
386 function action_batchmember() {
\r
389 // check if logged in and admin
\r
390 ($member->isLoggedIn() && $member->isAdmin()) or $this->disallow();
\r
392 // get array of itemids from request
\r
393 $selected = requestIntArray('batch');
\r
394 $action = requestVar('batchaction');
\r
396 // Show error when no members selected
\r
397 if (!is_array($selected) || sizeof($selected) == 0)
\r
398 $this->error(_BATCH_NOSELECTION);
\r
400 // On delete: check if confirmation has been given
\r
401 if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
\r
402 $this->batchAskDeleteConfirmation('member',$selected);
\r
406 echo '<a href="index.php?action=usermanagement">(',_MEMBERS_BACKTOOVERVIEW,')</a>';
\r
407 echo '<h2>',_BATCH_MEMBERS,'</h2>';
\r
408 echo '<p>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b></p>';
\r
411 // walk over all itemids and perform action
\r
412 foreach ($selected as $memberid) {
\r
413 $memberid = intval($memberid);
\r
414 echo '<li>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b> ',_BATCH_ONMEMBER,' <b>', $memberid, '</b>...';
\r
416 // perform action, display errors if needed
\r
419 $error = $this->deleteOneMember($memberid);
\r
423 sql_query('UPDATE ' . sql_table('member') . ' SET madmin=1 WHERE mnumber='.$memberid);
\r
427 // there should always remain at least one super-admin
\r
428 $r = sql_query('SELECT * FROM '.sql_table('member'). ' WHERE madmin=1 and mcanlogin=1');
\r
429 if (mysql_num_rows($r) < 2)
\r
430 $error = _ERROR_ATLEASTONEADMIN;
\r
432 sql_query('UPDATE ' . sql_table('member') .' SET madmin=0 WHERE mnumber='.$memberid);
\r
435 $error = _BATCH_UNKNOWN . $action;
\r
438 echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
\r
443 echo '<b>',_BATCH_DONE,'</b>';
\r
451 function action_batchteam() {
\r
454 $blogid = intRequestVar('blogid');
\r
456 // check if logged in and admin
\r
457 ($member->isLoggedIn() && $member->blogAdminRights($blogid)) or $this->disallow();
\r
459 // get array of itemids from request
\r
460 $selected = requestIntArray('batch');
\r
461 $action = requestVar('batchaction');
\r
463 // Show error when no members selected
\r
464 if (!is_array($selected) || sizeof($selected) == 0)
\r
465 $this->error(_BATCH_NOSELECTION);
\r
467 // On delete: check if confirmation has been given
\r
468 if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
\r
469 $this->batchAskDeleteConfirmation('team',$selected);
\r
473 echo '<p><a href="index.php?action=manageteam&blogid=',$blogid,'">(',_BACK,')</a></p>';
\r
475 echo '<h2>',_BATCH_TEAM,'</h2>';
\r
476 echo '<p>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b></p>';
\r
479 // walk over all itemids and perform action
\r
480 foreach ($selected as $memberid) {
\r
481 $memberid = intval($memberid);
\r
482 echo '<li>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b> ',_BATCH_ONTEAM,' <b>', $memberid, '</b>...';
\r
484 // perform action, display errors if needed
\r
487 $error = $this->deleteOneTeamMember($blogid, $memberid);
\r
491 sql_query('UPDATE '.sql_table('team').' SET tadmin=1 WHERE tblog='.$blogid.' and tmember='.$memberid);
\r
495 // there should always remain at least one admin
\r
496 $r = sql_query('SELECT * FROM '.sql_table('team').' WHERE tadmin=1 and tblog='.$blogid);
\r
497 if (mysql_num_rows($r) < 2)
\r
498 $error = _ERROR_ATLEASTONEBLOGADMIN;
\r
500 sql_query('UPDATE '.sql_table('team').' SET tadmin=0 WHERE tblog='.$blogid.' and tmember='.$memberid);
\r
503 $error = _BATCH_UNKNOWN . $action;
\r
506 echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
\r
511 echo '<b>',_BATCH_DONE,'</b>';
\r
520 function action_batchcategory() {
\r
521 global $member, $manager;
\r
523 // check if logged in
\r
524 $member->isLoggedIn() or $this->disallow();
\r
526 // more precise check will be done for each performed operation
\r
528 // get array of itemids from request
\r
529 $selected = requestIntArray('batch');
\r
530 $action = requestVar('batchaction');
\r
532 // Show error when no items were selected
\r
533 if (!is_array($selected) || sizeof($selected) == 0)
\r
534 $this->error(_BATCH_NOSELECTION);
\r
536 // On move: when no destination blog chosen, show choice now
\r
537 $destBlogId = intRequestVar('destblogid');
\r
538 if (($action == 'move') && (!$manager->existsBlogID($destBlogId)))
\r
539 $this->batchMoveCategorySelectDestination('category',$selected);
\r
541 // On delete: check if confirmation has been given
\r
542 if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
\r
543 $this->batchAskDeleteConfirmation('category',$selected);
\r
547 echo '<a href="index.php?action=overview">(',_BACKHOME,')</a>';
\r
548 echo '<h2>',BATCH_CATEGORIES,'</h2>';
\r
549 echo '<p>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b></p>';
\r
552 // walk over all itemids and perform action
\r
553 foreach ($selected as $catid) {
\r
554 $catid = intval($catid);
\r
555 echo '<li>',_BATCH_EXECUTING,' <b>',htmlspecialchars($action),'</b> ',_BATCH_ONCATEGORY,' <b>', $catid, '</b>...';
\r
557 // perform action, display errors if needed
\r
560 $error = $this->deleteOneCategory($catid);
\r
563 $error = $this->moveOneCategory($catid, $destBlogId);
\r
566 $error = _BATCH_UNKNOWN . $action;
\r
569 echo '<b>',($error ? 'Error: '.$error : _BATCH_SUCCESS),'</b>';
\r
574 echo '<b>',_BATCH_DONE,'</b>';
\r
580 function batchMoveSelectDestination($type, $ids) {
\r
583 <h2><?php echo _MOVE_TITLE?></h2>
\r
584 <form method="post" action="index.php"><div>
\r
586 <input type="hidden" name="action" value="batch<?php echo $type?>" />
\r
587 <input type="hidden" name="batchaction" value="move" />
\r
588 <?php // insert selected item numbers
\r
590 foreach ($ids as $id)
\r
591 echo '<input type="hidden" name="batch[',($idx++),']" value="',intval($id),'" />';
\r
593 // show blog/category selection list
\r
594 $this->selectBlogCategory('destcatid');
\r
599 <input type="submit" value="<?php echo _MOVE_BTN?>" onclick="return checkSubmit();" />
\r
602 <?php $this->pagefoot();
\r
606 function batchMoveCategorySelectDestination($type, $ids) {
\r
609 <h2><?php echo _MOVECAT_TITLE?></h2>
\r
610 <form method="post" action="index.php"><div>
\r
612 <input type="hidden" name="action" value="batch<?php echo $type?>" />
\r
613 <input type="hidden" name="batchaction" value="move" />
\r
614 <?php // insert selected item numbers
\r
616 foreach ($ids as $id)
\r
617 echo '<input type="hidden" name="batch[',($idx++),']" value="',intval($id),'" />';
\r
619 // show blog/category selection list
\r
620 $this->selectBlog('destblogid');
\r
625 <input type="submit" value="<?php echo _MOVECAT_BTN?>" onclick="return checkSubmit();" />
\r
628 <?php $this->pagefoot();
\r
632 function batchAskDeleteConfirmation($type, $ids) {
\r
635 <h2><?php echo _BATCH_DELETE_CONFIRM?></h2>
\r
636 <form method="post" action="index.php"><div>
\r
638 <input type="hidden" name="action" value="batch<?php echo $type?>" />
\r
639 <input type="hidden" name="batchaction" value="delete" />
\r
640 <input type="hidden" name="confirmation" value="yes" />
\r
641 <?php // insert selected item numbers
\r
643 foreach ($ids as $id)
\r
644 echo '<input type="hidden" name="batch[',($idx++),']" value="',intval($id),'" />';
\r
646 // add hidden vars for team & comment
\r
647 if ($type == 'team')
\r
649 echo '<input type="hidden" name="blogid" value="',intRequestVar('blogid'),'" />';
\r
651 if ($type == 'comment')
\r
653 echo '<input type="hidden" name="itemid" value="',intRequestVar('itemid'),'" />';
\r
658 <input type="submit" value="<?php echo _BATCH_DELETE_CONFIRM_BTN?>" onclick="return checkSubmit();" />
\r
661 <?php $this->pagefoot();
\r
667 * Inserts a HTML select element with choices for all categories to which the current
\r
668 * member has access
\r
670 function selectBlogCategory($name, $selected = 0, $tabindex = 0, $showNewCat = 0, $iForcedBlogInclude = -1) {
\r
671 ADMIN::selectBlog($name, 'category', $selected, $tabindex, $showNewCat, $iForcedBlogInclude);
\r
675 * Inserts a HTML select element with choices for all blogs to which the user has access
\r
676 * mode = 'blog' => shows blognames and values are blogids
\r
677 * mode = 'category' => show category names and values are catids
\r
679 * @param $iForcedBlogInclude
\r
680 * ID of a blog that always needs to be included, without checking if the member is on the blog team (-1 = none)
\r
682 function selectBlog($name, $mode='blog', $selected = 0, $tabindex = 0, $showNewCat = 0, $iForcedBlogInclude = -1) {
\r
683 global $member, $CONF;
\r
685 // 0. get IDs of blogs to which member can post items (+ forced blog)
\r
686 $aBlogIds = array();
\r
687 if ($iForcedBlogInclude != -1)
\r
688 $aBlogIds[] = intval($iForcedBlogInclude);
\r
690 if (($member->isAdmin()) && ($CONF['ShowAllBlogs']))
\r
691 $queryBlogs = 'SELECT bnumber FROM '.sql_table('blog').' ORDER BY bname';
\r
693 $queryBlogs = 'SELECT bnumber FROM '.sql_table('blog').', '.sql_table('team').' WHERE tblog=bnumber and tmember=' . $member->getID();
\r
694 $rblogids = sql_query($queryBlogs);
\r
695 while ($o = mysql_fetch_object($rblogids))
\r
696 if ($o->bnumber != $iForcedBlogInclude)
\r
697 $aBlogIds[] = intval($o->bnumber);
\r
699 if (count($aBlogIds) == 0)
\r
702 echo '<select name="',$name,'" tabindex="',$tabindex,'">';
\r
704 // 1. select blogs (we'll create optiongroups)
\r
705 // (only select those blogs that have the user on the team)
\r
706 $queryBlogs = 'SELECT bnumber, bname FROM '.sql_table('blog').' WHERE bnumber in ('.implode(',',$aBlogIds).') ORDER BY bname';
\r
707 $blogs = sql_query($queryBlogs);
\r
708 if ($mode == 'category') {
\r
709 if (mysql_num_rows($blogs) > 1)
\r
710 $multipleBlogs = 1;
\r
712 while ($oBlog = mysql_fetch_object($blogs)) {
\r
713 if ($multipleBlogs)
\r
714 echo '<optgroup label="',htmlspecialchars($oBlog->bname),'">';
\r
716 // show selection to create new category when allowed/wanted
\r
718 // check if allowed to do so
\r
719 if ($member->blogAdminRights($oBlog->bnumber))
\r
720 echo '<option value="newcat-',$oBlog->bnumber,'">',_ADD_NEWCAT,'</option>';
\r
723 // 2. for each category in that blog
\r
724 $categories = sql_query('SELECT cname, catid FROM '.sql_table('category').' WHERE cblog=' . $oBlog->bnumber . ' ORDER BY cname ASC');
\r
725 while ($oCat = mysql_fetch_object($categories)) {
\r
726 if ($oCat->catid == $selected)
\r
727 $selectText = ' selected="selected" ';
\r
730 echo '<option value="',$oCat->catid,'" ', $selectText,'>',htmlspecialchars($oCat->cname),'</option>';
\r
733 if ($multipleBlogs)
\r
734 echo '</optgroup>';
\r
738 while ($oBlog = mysql_fetch_object($blogs)) {
\r
739 echo '<option value="',$oBlog->bnumber,'"';
\r
740 if ($oBlog->bnumber == $selected)
\r
741 echo ' selected="selected"';
\r
742 echo'>',htmlspecialchars($oBlog->bname),'</option>';
\r
749 function action_browseownitems() {
\r
754 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
\r
755 echo '<h2>' . _ITEMLIST_YOUR. '</h2>';
\r
758 if (postVar('start'))
\r
759 $start = postVar('start');
\r
763 // amount of items to show
\r
764 if (postVar('amount'))
\r
765 $amount = postVar('amount');
\r
769 $search = postVar('search'); // search through items
\r
771 $query = 'SELECT bshortname, cname, mname, ititle, ibody, idraft, inumber, itime'
\r
772 . ' FROM '.sql_table('item').', '.sql_table('blog') . ', '.sql_table('member') . ', '.sql_table('category')
\r
773 . ' WHERE iauthor='. $member->getID() .' and iauthor=mnumber and iblog=bnumber and icat=catid';
\r
776 $query .= ' and ((ititle LIKE "%' . addslashes($search) . '%") or (ibody LIKE "%' . addslashes($search) . '%") or (imore LIKE "%' . addslashes($search) . '%"))';
\r
778 $query .= ' ORDER BY itime DESC'
\r
779 . " LIMIT $start,$amount";
\r
781 $template['content'] = 'itemlist';
\r
782 $template['now'] = time();
\r
784 $navList = new NAVLIST('browseownitems', $start, $amount, 0, 1000, $blogid, $search, 0);
\r
785 $navList->showBatchList('item',$query,'table',$template);
\r
787 $this->pagefoot();
\r
792 * Show all the comments for a given item
\r
794 function action_itemcommentlist($itemid = '') {
\r
798 $itemid = intRequestVar('itemid');
\r
800 // only allow if user is allowed to alter item
\r
801 $member->canAlterItem($itemid) or $this->disallow();
\r
803 $blogid = getBlogIdFromItemId($itemid);
\r
808 if (postVar('start'))
\r
809 $start = postVar('start');
\r
813 // amount of items to show
\r
814 if (postVar('amount'))
\r
815 $amount = postVar('amount');
\r
819 $search = postVar('search');
\r
821 echo '<p>(<a href="index.php?action=itemlist&blogid=',$blogid,'">',_BACKTOOVERVIEW,'</a>)</p>';
\r
822 echo '<h2>',_COMMENTS,'</h2>';
\r
824 $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;
\r
827 $query .= ' and cbody LIKE "%' . addslashes($search) . '%"';
\r
829 $query .= ' ORDER BY ctime ASC'
\r
830 . " LIMIT $start,$amount";
\r
832 $template['content'] = 'commentlist';
\r
833 $template['canAddBan'] = $member->blogAdminRights(getBlogIDFromItemID($itemid));
\r
835 $navList = new NAVLIST('itemcommentlist', $start, $amount, 0, 1000, 0, $search, $itemid);
\r
836 $navList->showBatchList('comment',$query,'table',$template,_NOCOMMENTS);
\r
842 * Browse own comments
\r
844 function action_browseowncomments() {
\r
848 if (postVar('start'))
\r
849 $start = postVar('start');
\r
853 // amount of items to show
\r
854 if (postVar('amount'))
\r
855 $amount = postVar('amount');
\r
859 $search = postVar('search');
\r
862 $query = 'SELECT cbody, cuser, cmail, mname, ctime, chost, cnumber, cip, citem FROM '.sql_table('comment').' LEFT OUTER JOIN '.sql_table('member').' ON mnumber=cmember WHERE cmember=' . $member->getID();
\r
865 $query .= ' and cbody LIKE "%' . addslashes($search) . '%"';
\r
867 $query .= ' ORDER BY ctime DESC'
\r
868 . " LIMIT $start,$amount";
\r
872 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
\r
873 echo '<h2>', _COMMENTS_YOUR ,'</h2>';
\r
875 $template['content'] = 'commentlist';
\r
876 $template['canAddBan'] = 0; // doesn't make sense to allow banning yourself
\r
878 $navList = new NAVLIST('browseowncomments', $start, $amount, 0, 1000, 0, $search, 0);
\r
879 $navList->showBatchList('comment',$query,'table',$template,_NOCOMMENTS_YOUR);
\r
885 * Browse all comments for a weblog
\r
887 function action_blogcommentlist($blogid = '')
\r
889 global $member, $manager;
\r
892 $blogid = intRequestVar('blogid');
\r
894 $blogid = intval($blogid);
\r
896 $member->teamRights($blogid) or $member->isAdmin() or $this->disallow();
\r
899 if (postVar('start'))
\r
900 $start = postVar('start');
\r
904 // amount of items to show
\r
905 if (postVar('amount'))
\r
906 $amount = postVar('amount');
\r
910 $search = postVar('search'); // search through comments
\r
913 $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);
\r
915 if ($search != '')
\r
916 $query .= ' and cbody LIKE "%' . addslashes($search) . '%"';
\r
919 $query .= ' ORDER BY ctime DESC'
\r
920 . " LIMIT $start,$amount";
\r
923 $blog =& $manager->getBlog($blogid);
\r
927 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
\r
928 echo '<h2>', _COMMENTS_BLOG , ' ' , $this->bloglink($blog), '</h2>';
\r
930 $template['content'] = 'commentlist';
\r
931 $template['canAddBan'] = $member->blogAdminRights($blogid);
\r
933 $navList =& new NAVLIST('blogcommentlist', $start, $amount, 0, 1000, $blogid, $search, 0);
\r
934 $navList->showBatchList('comment',$query,'table',$template, 'No comments were made on items of this blog');
\r
940 * Provide a page to item a new item to the given blog
\r
942 function action_createitem() {
\r
943 global $member, $manager;
\r
945 $blogid = intRequestVar('blogid');
\r
947 // check if allowed
\r
948 $member->teamRights($blogid) or $this->disallow();
\r
950 $memberid = $member->getID();
\r
952 $blog =& $manager->getBlog($blogid);
\r
956 // generate the add-item form
\r
957 $formfactory = new PAGEFACTORY($blogid);
\r
958 $formfactory->createAddForm('admin');
\r
960 $this->pagefoot();
\r
963 function action_itemedit() {
\r
964 global $member, $manager;
\r
966 $itemid = intRequestVar('itemid');
\r
968 // only allow if user is allowed to alter item
\r
969 $member->canAlterItem($itemid) or $this->disallow();
\r
971 $item =& $manager->getItem($itemid,1,1);
\r
972 $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
\r
974 $manager->notify('PrepareItemForEdit', array('item' => &$item));
\r
976 if ($blog->convertBreaks()) {
\r
977 $item['body'] = removeBreaks($item['body']);
\r
978 $item['more'] = removeBreaks($item['more']);
\r
981 // form to edit blog items
\r
983 $formfactory = new PAGEFACTORY($blog->getID());
\r
984 $formfactory->createEditForm('admin',$item);
\r
985 $this->pagefoot();
\r
988 function action_itemupdate() {
\r
989 global $member, $manager, $CONF;
\r
991 $itemid = intRequestVar('itemid');
\r
992 $catid = postVar('catid');
\r
994 // only allow if user is allowed to alter item
\r
995 $member->canUpdateItem($itemid, $catid) or $this->disallow();
\r
997 $actiontype = postVar('actiontype');
\r
999 // delete actions are handled by itemdelete (which has confirmation)
\r
1000 if ($actiontype == 'delete') {
\r
1001 $this->action_itemdelete();
\r
1005 $body = postVar('body');
\r
1006 $title = postVar('title');
\r
1007 $more = postVar('more');
\r
1008 $closed = intPostVar('closed');
\r
1010 // default action = add now
\r
1011 if (!$actiontype)
\r
1012 $actiontype='addnow';
\r
1014 // create new category if needed
\r
1015 if (strstr($catid,'newcat')) {
\r
1017 list($blogid) = sscanf($catid,"newcat-%d");
\r
1020 $blog =& $manager->getBlog($blogid);
\r
1021 $catid = $blog->createNewCategory();
\r
1023 // show error when sth goes wrong
\r
1025 $this->doError(_ERROR_CATCREATEFAIL);
\r
1029 set some variables based on actiontype
\r
1032 draft items -> addnow, addfuture, adddraft, delete
\r
1033 non-draft items -> edit, changedate, delete
\r
1036 $timestamp: set to a nonzero value for future dates or date changes
\r
1037 $wasdraft: set to 1 when the item used to be a draft item
\r
1038 $publish: set to 1 when the edited item is not a draft
\r
1040 switch ($actiontype) {
\r
1049 $timestamp = mktime(postVar('hour'), postVar('minutes'), 0, postVar('month'), postVar('day'), postVar('year'));
\r
1056 case 'changedate':
\r
1057 $timestamp = mktime(postVar('hour'), postVar('minutes'), 0, postVar('month'), postVar('day'), postVar('year'));
\r
1068 // edit the item for real
\r
1069 ITEM::update($itemid, $catid, $title, $body, $more, $closed, $wasdraft, $publish, $timestamp);
\r
1071 // show category edit window when we created a new category
\r
1072 // ($catid will then be a new category ID, while postVar('catid') will be 'newcat-x')
\r
1073 if ($catid != intPostVar('catid')) {
\r
1074 $this->action_categoryedit(
\r
1077 $CONF['AdminURL'] . 'index.php?action=itemlist&blogid=' . getBlogIDFromItemID($itemid)
\r
1080 // TODO: set start item correctly for itemlist
\r
1081 $this->action_itemlist(getBlogIDFromItemID($itemid));
\r
1085 function action_itemdelete() {
\r
1086 global $member, $manager;
\r
1088 $itemid = intRequestVar('itemid');
\r
1090 // only allow if user is allowed to alter item
\r
1091 $member->canAlterItem($itemid) or $this->disallow();
\r
1093 if (!$manager->existsItem($itemid,1,1))
\r
1094 $this->error(_ERROR_NOSUCHITEM);
\r
1096 $item =& $manager->getItem($itemid,1,1);
\r
1097 $title = htmlspecialchars(strip_tags($item['title']));
\r
1098 $body = strip_tags($item['body']);
\r
1099 $body = htmlspecialchars(shorten($body,300,'...'));
\r
1101 $this->pagehead();
\r
1103 <h2><?php echo _DELETE_CONFIRM?></h2>
\r
1105 <p><?php echo _CONFIRMTXT_ITEM?></p>
\r
1107 <div class="note">
\r
1108 <b>"<?php echo $title ?>"</b>
\r
1110 <?php echo $body?>
\r
1113 <form method="post" action="index.php"><div>
\r
1114 <input type="hidden" name="action" value="itemdeleteconfirm" />
\r
1115 <input type="hidden" name="itemid" value="<?php echo $itemid; ?>" />
\r
1116 <input type="submit" value="<?php echo _DELETE_CONFIRM_BTN?>" tabindex="10" />
\r
1119 $this->pagefoot();
\r
1122 function action_itemdeleteconfirm() {
\r
1125 $itemid = intRequestVar('itemid');
\r
1127 // only allow if user is allowed to alter item
\r
1128 $member->canAlterItem($itemid) or $this->disallow();
\r
1130 // get blogid first
\r
1131 $blogid = getBlogIdFromItemId($itemid);
\r
1133 // delete item (note: some checks will be performed twice)
\r
1134 $this->deleteOneItem($itemid);
\r
1136 $this->action_itemlist($blogid);
\r
1139 // deletes one item and returns error if something goes wrong
\r
1140 function deleteOneItem($itemid) {
\r
1141 global $member, $manager;
\r
1143 // only allow if user is allowed to alter item (also checks if itemid exists)
\r
1144 if (!$member->canAlterItem($itemid))
\r
1145 return _ERROR_DISALLOWED;
\r
1147 $manager->loadClass('ITEM');
\r
1148 ITEM::delete($itemid);
\r
1151 function action_itemmove() {
\r
1152 global $member, $manager;
\r
1154 $itemid = intRequestVar('itemid');
\r
1156 // only allow if user is allowed to alter item
\r
1157 $member->canAlterItem($itemid) or $this->disallow();
\r
1159 $item =& $manager->getItem($itemid,1,1);
\r
1161 $this->pagehead();
\r
1163 <h2><?php echo _MOVE_TITLE?></h2>
\r
1164 <form method="post" action="index.php"><div>
\r
1165 <input type="hidden" name="action" value="itemmoveto" />
\r
1166 <input type="hidden" name="itemid" value="<?php echo $itemid; ?>" />
\r
1168 <?php $this->selectBlogCategory('catid',$item['catid'],10,1);?>
\r
1170 <input type="submit" value="<?php echo _MOVE_BTN?>" tabindex="10000" onclick="return checkSubmit();" />
\r
1173 $this->pagefoot();
\r
1176 function action_itemmoveto() {
\r
1177 global $member, $manager;
\r
1179 $itemid = intRequestVar('itemid');
\r
1180 $catid = requestVar('catid');
\r
1182 // create new category if needed
\r
1183 if (strstr($catid,'newcat')) {
\r
1185 list($blogid) = sscanf($catid,'newcat-%d');
\r
1188 $blog =& $manager->getBlog($blogid);
\r
1189 $catid = $blog->createNewCategory();
\r
1191 // show error when sth goes wrong
\r
1193 $this->doError(_ERROR_CATCREATEFAIL);
\r
1196 // only allow if user is allowed to alter item
\r
1197 $member->canUpdateItem($itemid, $catid) or $this->disallow();
\r
1199 ITEM::move($itemid, $catid);
\r
1201 if ($catid != intRequestVar('catid'))
\r
1202 $this->action_categoryedit($catid, $blog->getID());
\r
1204 $this->action_itemlist(getBlogIDFromCatID($catid));
\r
1208 * Moves one item to a given category (category existance should be checked by caller)
\r
1209 * errors are returned
\r
1211 function moveOneItem($itemid, $destCatid) {
\r
1214 // only allow if user is allowed to move item
\r
1215 if (!$member->canUpdateItem($itemid, $destCatid))
\r
1216 return _ERROR_DISALLOWED;
\r
1218 ITEM::move($itemid, $destCatid);
\r
1222 * Adds a item to the chosen blog
\r
1224 function action_additem() {
\r
1225 global $member, $manager, $CONF;
\r
1227 $manager->loadClass('ITEM');
\r
1229 $result = ITEM::createFromRequest();
\r
1231 if ($result['status'] == 'error')
\r
1232 $this->error($result['message']);
\r
1234 $blogid = getBlogIDFromItemID($result['itemid']);
\r
1235 $blog =& $manager->getBlog($blogid);
\r
1237 if ($result['status'] == 'newcategory')
\r
1238 $this->action_categoryedit(
\r
1241 $blog->pingUserland() ? $CONF['AdminURL'] . 'index.php?action=sendping&blogid=' . intval($blogid) : ''
\r
1243 elseif ((postVar('actiontype') == 'addnow') && $blog->pingUserland())
\r
1244 $this->action_sendping($blogid);
\r
1246 $this->action_itemlist($blogid);
\r
1250 * Shows a window that says we're about to ping weblogs.com.
\r
1251 * immediately refresh to the real pinging page, which will
\r
1252 * show an error, or redirect to the blog.
\r
1254 * @param $blogid ID of blog for which ping needs to be sent out
\r
1256 function action_sendping($blogid = -1) {
\r
1259 if ($blogid == -1)
\r
1260 $blogid = intRequestVar('blogid');
\r
1262 $member->isLoggedIn() or $this->disallow();
\r
1264 $this->pagehead('<meta http-equiv="refresh" content="1; url=index.php?action=rawping&blogid=' . $blogid . '" />');
\r
1266 <h2>Site Updated, Now pinging weblogs.com</h2>
\r
1269 Pinging weblogs.com! This can a while...
\r
1271 When the ping is complete (and successfull), your weblog will show up in the weblogs.com updates list.
\r
1275 If you aren't automatically passed through, <a href="index.php?action=rawping&blogid=<?php echo $blogid?>">try again</a>
\r
1277 <?php $this->pagefoot();
\r
1280 // ping to Weblogs.com
\r
1281 // sends the real ping (can take up to 10 seconds!)
\r
1282 function action_rawping() {
\r
1286 $blogid = intRequestVar('blogid');
\r
1287 $blog =& $manager->getBlog($blogid);
\r
1289 $result = $blog->sendUserlandPing();
\r
1291 $this->pagehead();
\r
1295 <h2>Ping Results</h2>
\r
1297 <p>The following message was returned by weblogs.com:</p>
\r
1299 <div class='note'><?php echo $result ?></div>
\r
1302 <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>
\r
1303 <li><a href="<?php echo $blog->getURL()?>">Visit your own site</a></li>
\r
1306 <?php $this->pagefoot();
\r
1310 * Allows to edit previously made comments
\r
1312 function action_commentedit() {
\r
1313 global $member, $manager;
\r
1315 $commentid = intRequestVar('commentid');
\r
1317 $member->canAlterComment($commentid) or $this->disallow();
\r
1319 $comment = COMMENT::getComment($commentid);
\r
1321 $manager->notify('PrepareCommentForEdit',array('comment' => &$comment));
\r
1323 // change <br /> to \n
\r
1324 $comment['body'] = str_replace('<br />','',$comment['body']);
\r
1326 $comment['body'] = eregi_replace("<a href=['\"]([^'\"]+)['\"]>[^<]*</a>","\\1",$comment['body']);
\r
1328 $this->pagehead();
\r
1331 <h2><?php echo _EDITC_TITLE?></h2>
\r
1333 <form action="index.php" method="post"><div>
\r
1335 <input type="hidden" name="action" value="commentupdate" />
\r
1336 <input type="hidden" name="commentid" value="<?php echo $commentid; ?>" />
\r
1338 <th colspan="2"><?php echo _EDITC_TITLE?></th>
\r
1340 <td><?php echo _EDITC_WHO?></td>
\r
1342 <?php if ($comment['member'])
\r
1343 echo $comment['member'] . " (" . _EDITC_MEMBER . ")";
\r
1345 echo $comment['user'] . " (" . _EDITC_NONMEMBER . ")";
\r
1349 <td><?php echo _EDITC_WHEN?></td>
\r
1350 <td><?php echo date("Y-m-d @ H:i",$comment['timestamp']); ?></td>
\r
1352 <td><?php echo _EDITC_HOST?></td>
\r
1353 <td><?php echo $comment['host']; ?></td>
\r
1355 <td><?php echo _EDITC_TEXT?></td>
\r
1357 <textarea name="body" tabindex="10" rows="10" cols="50"><?php // htmlspecialchars not needed (things should be escaped already)
\r
1358 echo $comment['body'];
\r
1362 <td><?php echo _EDITC_EDIT?></td>
\r
1363 <td><input type="submit" tabindex="20" value="<?php echo _EDITC_EDIT?>" onclick="return checkSubmit();" /></td>
\r
1368 $this->pagefoot();
\r
1371 function action_commentupdate() {
\r
1372 global $member, $manager;
\r
1374 $commentid = intRequestVar('commentid');
\r
1376 $member->canAlterComment($commentid) or $this->disallow();
\r
1378 $body = postVar('body');
\r
1380 // intercept words that are too long
\r
1381 if (eregi("[a-zA-Z0-9|\.,;:!\?=\/\\]{90,90}",$body) != false)
\r
1382 $this->error(_ERROR_COMMENT_LONGWORD);
\r
1385 if (strlen($body)<3)
\r
1386 $this->error(_ERROR_COMMENT_NOCOMMENT);
\r
1387 if (strlen($body)>5000)
\r
1388 $this->error(_ERROR_COMMENT_TOOLONG);
\r
1392 $body = COMMENT::prepareBody($body);
\r
1395 $manager->notify('PreUpdateComment',array('body' => &$body));
\r
1397 $query = 'UPDATE '.sql_table('comment')
\r
1398 . " SET cbody='" .addslashes($body). "'"
\r
1399 . " WHERE cnumber=" . $commentid;
\r
1400 sql_query($query);
\r
1403 $res = sql_query('SELECT citem FROM '.sql_table('comment').' WHERE cnumber=' . $commentid);
\r
1404 $o = mysql_fetch_object($res);
\r
1405 $itemid = $o->citem;
\r
1407 if ($member->canAlterItem($itemid))
\r
1408 $this->action_itemcommentlist($itemid);
\r
1410 $this->action_browseowncomments();
\r
1414 function action_commentdelete() {
\r
1417 $commentid = intRequestVar('commentid');
\r
1419 $member->canAlterComment($commentid) or $this->disallow();
\r
1421 $comment = COMMENT::getComment($commentid);
\r
1423 $body = strip_tags($comment['body']);
\r
1424 $body = htmlspecialchars(shorten($body, 300, '...'));
\r
1426 if ($comment['member'])
\r
1427 $author = $comment['member'];
\r
1429 $author = $comment['user'];
\r
1431 $this->pagehead();
\r
1434 <h2><?php echo _DELETE_CONFIRM?></h2>
\r
1436 <p><?php echo _CONFIRMTXT_COMMENT?></p>
\r
1438 <div class="note">
\r
1439 <b><?php echo _EDITC_WHO?>:</b> <?php echo $author ?>
\r
1441 <b><?php echo _EDITC_TEXT?>:</b> <?php echo $body ?>
\r
1444 <form method="post" action="index.php"><div>
\r
1445 <input type="hidden" name="action" value="commentdeleteconfirm" />
\r
1446 <input type="hidden" name="commentid" value="<?php echo $commentid; ?>" />
\r
1447 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
\r
1450 $this->pagefoot();
\r
1453 function action_commentdeleteconfirm() {
\r
1456 $commentid = intRequestVar('commentid');
\r
1458 // get item id first
\r
1459 $res = sql_query('SELECT citem FROM '.sql_table('comment') .' WHERE cnumber=' . $commentid);
\r
1460 $o = mysql_fetch_object($res);
\r
1461 $itemid = $o->citem;
\r
1463 $error = $this->deleteOneComment($commentid);
\r
1465 $this->doError($error);
\r
1467 if ($member->canAlterItem($itemid))
\r
1468 $this->action_itemcommentlist($itemid);
\r
1470 $this->action_browseowncomments();
\r
1473 function deleteOneComment($commentid) {
\r
1474 global $member, $manager;
\r
1476 $commentid = intval($commentid);
\r
1478 if (!$member->canAlterComment($commentid))
\r
1479 return _ERROR_DISALLOWED;
\r
1481 $manager->notify('PreDeleteComment', array('commentid' => $commentid));
\r
1483 // delete the comments associated with the item
\r
1484 $query = 'DELETE FROM '.sql_table('comment').' WHERE cnumber=' . $commentid;
\r
1485 sql_query($query);
\r
1487 $manager->notify('PostDeleteComment', array('commentid' => $commentid));
\r
1493 * Usermanagement main
\r
1495 function action_usermanagement() {
\r
1498 // check if allowed
\r
1499 $member->isAdmin() or $this->disallow();
\r
1501 $this->pagehead();
\r
1503 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
\r
1505 echo '<h2>' . _MEMBERS_TITLE .'</h2>';
\r
1507 echo '<h3>' . _MEMBERS_CURRENT .'</h3>';
\r
1509 // show list of members with actions
\r
1510 $query = 'SELECT *'
\r
1511 . ' FROM '.sql_table('member');
\r
1512 $template['content'] = 'memberlist';
\r
1513 $template['tabindex'] = 10;
\r
1515 $batch = new BATCH('member');
\r
1516 $batch->showlist($query,'table',$template);
\r
1518 echo '<h3>' . _MEMBERS_NEW .'</h3>';
\r
1520 <form method="post" action="index.php"><div>
\r
1522 <input type="hidden" name="action" value="memberadd" />
\r
1526 <th colspan="2"><?php echo _MEMBERS_NEW?></th>
\r
1528 <td><?php echo _MEMBERS_DISPLAY?> <?php help('shortnames');?>
\r
1529 <br /><small>(This is the name used to logon)</small>
\r
1531 <td><input tabindex="10010" name="name" size="16" maxlength="16" /></td>
\r
1533 <td><?php echo _MEMBERS_REALNAME?></td>
\r
1534 <td><input name="realname" tabindex="10020" size="40" maxlength="60" /></td>
\r
1536 <td><?php echo _MEMBERS_PWD?></td>
\r
1537 <td><input name="password" tabindex="10030" size="16" maxlength="40" type="password" /></td>
\r
1539 <td><?php echo _MEMBERS_REPPWD?></td>
\r
1540 <td><input name="repeatpassword" tabindex="10035" size="16" maxlength="40" type="password" /></td>
\r
1542 <td><?php echo _MEMBERS_EMAIL?></td>
\r
1543 <td><input name="email" tabindex="10040" size="40" maxlength="60" /></td>
\r
1545 <td><?php echo _MEMBERS_URL?></td>
\r
1546 <td><input name="url" tabindex="10050" size="40" maxlength="100" /></td>
\r
1548 <td><?php echo _MEMBERS_SUPERADMIN?> <?php help('superadmin'); ?></td>
\r
1549 <td><?php $this->input_yesno('admin',0,10060); ?> </td>
\r
1551 <td><?php echo _MEMBERS_CANLOGIN?> <?php help('canlogin'); ?></td>
\r
1552 <td><?php $this->input_yesno('canlogin',1,10070); ?></td>
\r
1554 <td><?php echo _MEMBERS_NOTES?></td>
\r
1555 <td><input name="notes" maxlength="100" size="40" tabindex="10080" /></td>
\r
1557 <td><?php echo _MEMBERS_NEW?></td>
\r
1558 <td><input type="submit" value="<?php echo _MEMBERS_NEW_BTN?>" tabindex="10090" onclick="return checkSubmit();" /></td>
\r
1563 $this->pagefoot();
\r
1567 * Edit member settings
\r
1569 function action_memberedit() {
\r
1570 $this->action_editmembersettings(intRequestVar('memberid'));
\r
1572 function action_editmembersettings($memberid = '') {
\r
1573 global $member, $manager, $CONF;
\r
1575 if ($memberid == '')
\r
1576 $memberid = $member->getID();
\r
1578 // check if allowed
\r
1579 ($member->getID() == $memberid) or $member->isAdmin() or $this->disallow();
\r
1581 $this->pagehead();
\r
1583 // show message to go back to member overview (only for admins)
\r
1584 if ($member->isAdmin())
\r
1585 echo '<a href="index.php?action=usermanagement">(' ._MEMBERS_BACKTOOVERVIEW. ')</a>';
\r
1587 echo '<a href="index.php?action=overview">(' ._BACKHOME. ')</a>';
\r
1589 echo '<h2>' . _MEMBERS_EDIT . '</h2>';
\r
1591 $mem = MEMBER::createFromID($memberid);
\r
1594 <form method="post" action="index.php"><div>
\r
1596 <input type="hidden" name="action" value="changemembersettings" />
\r
1597 <input type="hidden" name="memberid" value="<?php echo $memberid; ?>" />
\r
1599 <th colspan="2"><?php echo _MEMBERS_EDIT?></th>
\r
1601 <td><?php echo _MEMBERS_DISPLAY?> <?php help('shortnames');?>
\r
1602 <br /><small><?php echo _MEMBERS_DISPLAY_INFO?></small>
\r
1605 <?php if ($CONF['AllowLoginEdit'] || $member->isAdmin()) { ?>
\r
1606 <input name="name" tabindex="10" maxlength="16" size="16" value="<?php echo htmlspecialchars($mem->getDisplayName()); ?>" />
\r
1608 echo htmlspecialchars($member->getDisplayName());
\r
1613 <td><?php echo _MEMBERS_REALNAME?></td>
\r
1614 <td><input name="realname" tabindex="20" maxlength="60" size="40" value="<?php echo htmlspecialchars($mem->getRealName()); ?>" /></td>
\r
1616 <?php if ($CONF['AllowLoginEdit'] || $member->isAdmin()) { ?>
\r
1617 <td><?php echo _MEMBERS_PWD?></td>
\r
1618 <td><input type="password" tabindex="30" maxlength="40" size="16" name="password" /></td>
\r
1620 <td><?php echo _MEMBERS_REPPWD?></td>
\r
1621 <td><input type="password" tabindex="35" maxlength="40" size="16" name="repeatpassword" /></td>
\r
1624 <td><?php echo _MEMBERS_EMAIL?>
\r
1625 <br /><small><?php echo _MEMBERS_EMAIL_EDIT?></small>
\r
1627 <td><input name="email" tabindex="40" size="40" maxlength="60" value="<?php echo htmlspecialchars($mem->getEmail()); ?>" /></td>
\r
1629 <td><?php echo _MEMBERS_URL?></td>
\r
1630 <td><input name="url" tabindex="50" size="40" maxlength="100" value="<?php echo htmlspecialchars($mem->getURL()); ?>" /></td>
\r
1631 <?php // only allow to change this by super-admins
\r
1632 // we don't want normal users to 'upgrade' themselves to super-admins, do we? ;-)
\r
1633 if ($member->isAdmin()) {
\r
1636 <td><?php echo _MEMBERS_SUPERADMIN?> <?php help('superadmin'); ?></td>
\r
1637 <td><?php $this->input_yesno('admin',$mem->isAdmin(),60); ?></td>
\r
1639 <td><?php echo _MEMBERS_CANLOGIN?> <?php help('canlogin'); ?></td>
\r
1640 <td><?php $this->input_yesno('canlogin',$mem->canLogin(),70); ?></td>
\r
1643 <td><?php echo _MEMBERS_NOTES?></td>
\r
1644 <td><input name="notes" tabindex="80" size="40" maxlength="100" value="<?php echo htmlspecialchars($mem->getNotes()); ?>" /></td>
\r
1646 <td><?php echo _MEMBERS_DEFLANG?> <?php help('language'); ?>
\r
1650 <select name="deflang" tabindex="85">
\r
1651 <option value=""><?php echo _MEMBERS_USESITELANG?></option>
\r
1652 <?php // show a dropdown list of all available languages
\r
1654 $dirhandle = opendir($DIR_LANG);
\r
1655 while ($filename = readdir($dirhandle)) {
\r
1656 if (ereg("^(.*)\.php$",$filename,$matches)) {
\r
1657 $name = $matches[1];
\r
1658 echo "<option value='$name'";
\r
1659 if ($name == $mem->getLanguage())
\r
1660 echo " selected='selected'";
\r
1661 echo ">$name</option>";
\r
1664 closedir($dirhandle);
\r
1673 $this->_insertPluginOptions('member',$memberid);
\r
1676 <th colspan="2"><?php echo _MEMBERS_EDIT ?></th>
\r
1678 <td><?php echo _MEMBERS_EDIT?></td>
\r
1679 <td><input type="submit" tabindex="90" value="<?php echo _MEMBERS_EDIT_BTN?>" onclick="return checkSubmit();" /></td>
\r
1686 echo '<h3>', _PLUGINS_EXTRA , '</h3>';
\r
1688 'MemberSettingsFormExtras',
\r
1694 $this->pagefoot();
\r
1698 function action_changemembersettings() {
\r
1699 global $member, $CONF, $manager;
\r
1701 $memberid = intRequestVar('memberid');
\r
1703 // check if allowed
\r
1704 ($member->getID() == $memberid) or $member->isAdmin() or $this->disallow();
\r
1706 $name = trim(postVar('name'));
\r
1707 $realname = trim(postVar('realname'));
\r
1708 $password = postVar('password');
\r
1709 $repeatpassword = postVar('repeatpassword');
\r
1710 $email = postVar('email');
\r
1711 $url = postVar('url');
\r
1713 // Sometimes user didn't prefix the URL with http://, this cause a malformed URL. Let's fix it.
\r
1714 if (!eregi("^https?://", $url))
\r
1715 $url = "http://".$url;
\r
1717 $admin = postVar('admin');
\r
1718 $canlogin = postVar('canlogin');
\r
1719 $notes = postVar('notes');
\r
1720 $deflang = postVar('deflang');
\r
1722 $mem = MEMBER::createFromID($memberid);
\r
1724 if ($CONF['AllowLoginEdit'] || $member->isAdmin()) {
\r
1726 if (!isValidDisplayName($name))
\r
1727 $this->error(_ERROR_BADNAME);
\r
1729 if (($name != $mem->getDisplayName()) && MEMBER::exists($name))
\r
1730 $this->error(_ERROR_NICKNAMEINUSE);
\r
1732 if ($password != $repeatpassword)
\r
1733 $this->error(_ERROR_PASSWORDMISMATCH);
\r
1735 if ($password && (strlen($password) < 6))
\r
1736 $this->error(_ERROR_PASSWORDTOOSHORT);
\r
1739 if (!isValidMailAddress($email))
\r
1740 $this->error(_ERROR_BADMAILADDRESS);
\r
1744 $this->error(_ERROR_REALNAMEMISSING);
\r
1746 if (($deflang != '') && (!checkLanguage($deflang)))
\r
1747 $this->error(_ERROR_NOSUCHLANGUAGE);
\r
1749 // check if there will remain at least one site member with both the logon and admin rights
\r
1750 // (check occurs when taking away one of these rights from such a member)
\r
1751 if ( (!$admin && $mem->isAdmin() && $mem->canLogin())
\r
1752 || (!$canlogin && $mem->isAdmin() && $mem->canLogin())
\r
1755 $r = sql_query('SELECT * FROM '.sql_table('member').' WHERE madmin=1 and mcanlogin=1');
\r
1756 if (mysql_num_rows($r) < 2)
\r
1757 $this->error(_ERROR_ATLEASTONEADMIN);
\r
1761 // if email changed, generate new password
\r
1762 if ($email != $mem->getEmail())
\r
1764 $password = genPassword(10);
\r
1770 if ($CONF['AllowLoginEdit'] || $member->isAdmin()) {
\r
1771 $mem->setDisplayName($name);
\r
1773 $mem->setPassword($password);
\r
1777 $mem->setPassword($password);
\r
1779 $mem->setRealName($realname);
\r
1780 $mem->setEmail($email);
\r
1781 $mem->setURL($url);
\r
1782 $mem->setNotes($notes);
\r
1783 $mem->setLanguage($deflang);
\r
1786 // only allow super-admins to make changes to the admin status
\r
1787 if ($member->isAdmin()) {
\r
1788 $mem->setAdmin($admin);
\r
1789 $mem->setCanLogin($canlogin);
\r
1795 // store plugin options
\r
1796 $aOptions = requestArray('plugoption');
\r
1797 NucleusPlugin::_applyPluginOptions($aOptions);
\r
1798 $manager->notify('PostPluginOptionsUpdate',array('context' => 'member', 'memberid' => $memberid, 'member' => &$mem));
\r
1800 // if new password was generated, send out mail message and logout
\r
1802 $mem->sendPassword($password);
\r
1804 if ( ( $mem->getID() == $member->getID() )
\r
1805 && ( $newpass || ( $mem->getDisplayName() != $member->getDisplayName() ) )
\r
1807 $member->logout();
\r
1808 $this->action_login(_MSG_LOGINAGAIN, 0);
\r
1810 $this->action_overview(_MSG_SETTINGSCHANGED);
\r
1814 function action_memberadd() {
\r
1817 // check if allowed
\r
1818 $member->isAdmin() or $this->disallow();
\r
1820 if (postVar('password') != postVar('repeatpassword'))
\r
1821 $this->error(_ERROR_PASSWORDMISMATCH);
\r
1822 if (strlen(postVar('password')) < 6)
\r
1823 $this->error(_ERROR_PASSWORDTOOSHORT);
\r
1825 $res = MEMBER::create(postVar('name'), postVar('realname'), postVar('password'), postVar('email'), postVar('url'), postVar('admin'), postVar('canlogin'), postVar('notes'));
\r
1827 $this->error($res);
\r
1829 $this->action_usermanagement();
\r
1835 function action_manageteam() {
\r
1838 $blogid = intRequestVar('blogid');
\r
1840 // check if allowed
\r
1841 $member->blogAdminRights($blogid) or $this->disallow();
\r
1843 $this->pagehead();
\r
1845 echo "<p><a href='index.php?action=blogsettings&blogid=$blogid'>(",_BACK_TO_BLOGSETTINGS,")</a></p>";
\r
1847 echo '<h2>' . _TEAM_TITLE . getBlogNameFromID($blogid) . '</h2>';
\r
1849 echo '<h3>' . _TEAM_CURRENT . '</h3>';
\r
1853 $query = 'SELECT tblog, tmember, mname, mrealname, memail, tadmin'
\r
1854 . ' FROM '.sql_table('member').', '.sql_table('team')
\r
1855 . ' WHERE tmember=mnumber and tblog=' . $blogid;
\r
1857 $template['content'] = 'teamlist';
\r
1858 $template['tabindex'] = 10;
\r
1860 $batch = new BATCH('team');
\r
1861 $batch->showlist($query, 'table', $template);
\r
1864 <h3><?php echo _TEAM_ADDNEW?></h3>
\r
1866 <form method='post' action='index.php'><div>
\r
1868 <input type='hidden' name='action' value='teamaddmember' />
\r
1869 <input type='hidden' name='blogid' value='<?php echo $blogid; ?>' />
\r
1872 <td><?php echo _TEAM_CHOOSEMEMBER?></td>
\r
1873 <td><?php // TODO: try to make it so only non-team-members are listed
\r
1874 $query = 'SELECT mname as text, mnumber as value'
\r
1875 . ' FROM '.sql_table('member');
\r
1877 $template['name'] = 'memberid';
\r
1878 $template['tabindex'] = 10000;
\r
1879 showlist($query,'select',$template);
\r
1882 <td><?php echo _TEAM_ADMIN?><?php help('teamadmin'); ?></td>
\r
1883 <td><?php $this->input_yesno('admin',0,10020); ?></td>
\r
1885 <td><?php echo _TEAM_ADD?></td>
\r
1886 <td><input type='submit' value='<?php echo _TEAM_ADD_BTN?>' tabindex="10030" /></td>
\r
1891 $this->pagefoot();
\r
1895 * Add member tot tram
\r
1897 function action_teamaddmember() {
\r
1898 global $member, $manager;
\r
1900 $memberid = intPostVar('memberid');
\r
1901 $blogid = intPostVar('blogid');
\r
1902 $admin = intPostVar('admin');
\r
1904 // check if allowed
\r
1905 $member->blogAdminRights($blogid) or $this->disallow();
\r
1907 $blog =& $manager->getBlog($blogid);
\r
1908 if (!$blog->addTeamMember($memberid, $admin))
\r
1909 $this->error(_ERROR_ALREADYONTEAM);
\r
1911 $this->action_manageteam();
\r
1915 function action_teamdelete() {
\r
1916 global $member, $manager;
\r
1918 $memberid = intRequestVar('memberid');
\r
1919 $blogid = intRequestVar('blogid');
\r
1921 // check if allowed
\r
1922 $member->blogAdminRights($blogid) or $this->disallow();
\r
1924 $teammem = MEMBER::createFromID($memberid);
\r
1925 $blog =& $manager->getBlog($blogid);
\r
1927 $this->pagehead();
\r
1929 <h2><?php echo _DELETE_CONFIRM?></h2>
\r
1931 <p><?php echo _CONFIRMTXT_TEAM1?><b><?php echo $teammem->getDisplayName() ?></b><?php echo _CONFIRMTXT_TEAM2?><b><?php echo htmlspecialchars(strip_tags($blog->getName())) ?></b>
\r
1935 <form method="post" action="index.php"><div>
\r
1936 <input type="hidden" name="action" value="teamdeleteconfirm" />
\r
1937 <input type="hidden" name="memberid" value="<?php echo $memberid; ?>" />
\r
1938 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
\r
1939 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
\r
1942 $this->pagefoot();
\r
1945 function action_teamdeleteconfirm() {
\r
1948 $memberid = intRequestVar('memberid');
\r
1949 $blogid = intRequestVar('blogid');
\r
1951 $error = $this->deleteOneTeamMember($blogid, $memberid);
\r
1954 $this->action_manageteam();
\r
1957 function deleteOneTeamMember($blogid, $memberid) {
\r
1958 global $member, $manager;
\r
1960 $blogid = intval($blogid);
\r
1961 $memberid = intval($memberid);
\r
1963 // check if allowed
\r
1964 if (!$member->blogAdminRights($blogid))
\r
1965 return _ERROR_DISALLOWED;
\r
1967 // check if: - there remains at least one blog admin
\r
1968 // - (there remains at least one team member)
\r
1969 $tmem = MEMBER::createFromID($memberid);
\r
1971 $manager->notify('PreDeleteTeamMember', array('member' => &$mem, 'blogid' => $blogid));
\r
1973 if ($tmem->isBlogAdmin($blogid)) {
\r
1974 // check if there are more blog members left and at least one admin
\r
1975 // (check for at least two admins before deletion)
\r
1976 $query = 'SELECT * FROM '.sql_table('team') . ' WHERE tblog='.$blogid.' and tadmin=1';
\r
1977 $r = sql_query($query);
\r
1978 if (mysql_num_rows($r) < 2)
\r
1979 return _ERROR_ATLEASTONEBLOGADMIN;
\r
1982 $query = 'DELETE FROM '.sql_table('team')." WHERE tblog=$blogid and tmember=$memberid";
\r
1983 sql_query($query);
\r
1985 $manager->notify('PostDeleteTeamMember', array('member' => &$mem, 'blogid' => $blogid));
\r
1990 function action_teamchangeadmin() {
\r
1993 $blogid = intRequestVar('blogid');
\r
1994 $memberid = intRequestVar('memberid');
\r
1996 // check if allowed
\r
1997 $member->blogAdminRights($blogid) or $this->disallow();
\r
1999 $mem = MEMBER::createFromID($memberid);
\r
2001 // don't allow when there is only one admin at this moment
\r
2002 if ($mem->isBlogAdmin($blogid)) {
\r
2003 $r = sql_query('SELECT * FROM '.sql_table('team') . " WHERE tblog=$blogid and tadmin=1");
\r
2004 if (mysql_num_rows($r) == 1)
\r
2005 $this->error(_ERROR_ATLEASTONEBLOGADMIN);
\r
2008 if ($mem->isBlogAdmin($blogid))
\r
2013 $query = 'UPDATE '.sql_table('team') ." SET tadmin=$newval WHERE tblog=$blogid and tmember=$memberid";
\r
2014 sql_query($query);
\r
2016 // only show manageteam if member did not change its own admin privileges
\r
2017 if ($member->isBlogAdmin($blogid))
\r
2018 $this->action_manageteam();
\r
2020 $this->action_overview(_MSG_ADMINCHANGED);
\r
2023 function action_blogsettings() {
\r
2024 global $member, $manager;
\r
2026 $blogid = intRequestVar('blogid');
\r
2028 // check if allowed
\r
2029 $member->blogAdminRights($blogid) or $this->disallow();
\r
2031 $blog =& $manager->getBlog($blogid);
\r
2033 $this->pagehead();
\r
2035 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
\r
2037 <h2><?php echo _EBLOG_TITLE?>: '<?php echo $this->bloglink($blog)?>'</h2>
\r
2039 <h3><?php echo _EBLOG_TEAM_TITLE?></h3>
\r
2041 <p>Members currently on your team:
\r
2043 $res = sql_query('SELECT mname, mrealname FROM ' . sql_table('member') . ',' . sql_table('team') . ' WHERE mnumber=tmember AND tblog=' . intval($blogid));
\r
2044 $aMemberNames = array();
\r
2045 while ($o = mysql_fetch_object($res))
\r
2046 array_push($aMemberNames, htmlspecialchars($o->mname) . ' (' . htmlspecialchars($o->mrealname). ')');
\r
2047 echo implode(',', $aMemberNames);
\r
2054 <a href="index.php?action=manageteam&blogid=<?php echo $blogid?>"><?php echo _EBLOG_TEAM_TEXT?></a>
\r
2057 <h3><?php echo _EBLOG_SETTINGS_TITLE?></h3>
\r
2059 <form method="post" action="index.php"><div>
\r
2061 <input type="hidden" name="action" value="blogsettingsupdate" />
\r
2062 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
\r
2064 <td><?php echo _EBLOG_NAME?></td>
\r
2065 <td><input name="name" tabindex="10" size="40" maxlength="60" value="<?php echo htmlspecialchars($blog->getName()) ?>" /></td>
\r
2067 <td><?php echo _EBLOG_SHORTNAME?> <?php help('shortblogname'); ?>
\r
2068 <?php echo _EBLOG_SHORTNAME_EXTRA?>
\r
2070 <td><input name="shortname" tabindex="20" maxlength="15" size="15" value="<?php echo htmlspecialchars($blog->getShortName()) ?>" /></td>
\r
2072 <td><?php echo _EBLOG_DESC?></td>
\r
2073 <td><input name="desc" tabindex="30" maxlength="200" size="40" value="<?php echo htmlspecialchars($blog->getDescription()) ?>" /></td>
\r
2075 <td><?php echo _EBLOG_URL?></td>
\r
2076 <td><input name="url" tabindex="40" size="40" maxlength="100" value="<?php echo htmlspecialchars($blog->getURL()) ?>" /></td>
\r
2078 <td><?php echo _EBLOG_DEFSKIN?>
\r
2079 <?php help('blogdefaultskin'); ?>
\r
2083 $query = 'SELECT sdname as text, sdnumber as value'
\r
2084 . ' FROM '.sql_table('skin_desc');
\r
2085 $template['name'] = 'defskin';
\r
2086 $template['selected'] = $blog->getDefaultSkin();
\r
2087 $template['tabindex'] = 50;
\r
2088 showlist($query,'select',$template);
\r
2093 <td><?php echo _EBLOG_LINEBREAKS?> <?php help('convertbreaks'); ?>
\r
2095 <td><?php $this->input_yesno('convertbreaks',$blog->convertBreaks(),55); ?></td>
\r
2097 <td><?php echo _EBLOG_ALLOWPASTPOSTING?> <?php help('allowpastposting'); ?>
\r
2099 <td><?php $this->input_yesno('allowpastposting',$blog->allowPastPosting(),57); ?></td>
\r
2101 <td><?php echo _EBLOG_DISABLECOMMENTS?>
\r
2103 <td><?php $this->input_yesno('comments',$blog->commentsEnabled(),60); ?></td>
\r
2105 <td><?php echo _EBLOG_ANONYMOUS?>
\r
2107 <td><?php $this->input_yesno('public',$blog->isPublic(),70); ?></td>
\r
2109 <td><?php echo _EBLOG_NOTIFY?> <?php help('blognotify'); ?></td>
\r
2110 <td><input name="notify" tabindex="80" maxlength="60" size="40" value="<?php echo htmlspecialchars($blog->getNotifyAddress()); ?>" /></td>
\r
2112 <td><?php echo _EBLOG_NOTIFY_ON?></td>
\r
2114 <input name="notifyComment" value="3" type="checkbox" tabindex="81" id="notifyComment"
\r
2115 <?php if ($blog->notifyOnComment()) echo "checked='checked'" ?>
\r
2116 /><label for="notifyComment"><?php echo _EBLOG_NOTIFY_COMMENT?></label>
\r
2118 <input name="notifyVote" value="5" type="checkbox" tabindex="82" id="notifyVote"
\r
2119 <?php if ($blog->notifyOnVote()) echo "checked='checked'" ?>
\r
2120 /><label for="notifyVote"><?php echo _EBLOG_NOTIFY_KARMA?></label>
\r
2122 <input name="notifyNewItem" value="7" type="checkbox" tabindex="83" id="notifyNewItem"
\r
2123 <?php if ($blog->notifyOnNewItem()) echo "checked='checked'" ?>
\r
2124 /><label for="notifyNewItem"><?php echo _EBLOG_NOTIFY_ITEM?></label>
\r
2127 <td><?php echo _EBLOG_PING?> <?php help('pinguserland'); ?></td>
\r
2128 <td><?php $this->input_yesno('pinguserland',$blog->pingUserland(),85); ?></td>
\r
2130 <td><?php echo _EBLOG_MAXCOMMENTS?> <?php help('blogmaxcomments'); ?></td>
\r
2131 <td><input name="maxcomments" tabindex="90" size="3" value="<?php echo htmlspecialchars($blog->getMaxComments()); ?>" /></td>
\r
2133 <td><?php echo _EBLOG_UPDATE?> <?php help('blogupdatefile'); ?></td>
\r
2134 <td><input name="update" tabindex="100" size="40" maxlength="60" value="<?php echo htmlspecialchars($blog->getUpdateFile()) ?>" /></td>
\r
2136 <td><?php echo _EBLOG_DEFCAT?></td>
\r
2139 $query = 'SELECT cname as text, catid as value'
\r
2140 . ' FROM '.sql_table('category')
\r
2141 . ' WHERE cblog=' . $blog->getID();
\r
2142 $template['name'] = 'defcat';
\r
2143 $template['selected'] = $blog->getDefaultCategory();
\r
2144 $template['tabindex'] = 110;
\r
2145 showlist($query,'select',$template);
\r
2149 <td><?php echo _EBLOG_OFFSET?> <?php help('blogtimeoffset'); ?>
\r
2150 <br /><?php echo _EBLOG_STIME?> <b><?php echo strftime("%H:%M",time()); ?></b>
\r
2151 <br /><?php echo _EBLOG_BTIME?> <b><?php echo strftime("%H:%M",$blog->getCorrectTime()); ?></b>
\r
2153 <td><input name="timeoffset" tabindex="120" size="3" value="<?php echo htmlspecialchars($blog->getTimeOffset()); ?>" /></td>
\r
2155 <td><?php echo _EBLOG_SEARCH?> <?php help('blogsearchable'); ?></td>
\r
2156 <td><?php $this->input_yesno('searchable',$blog->getSearchable(),122); ?></td>
\r
2160 $this->_insertPluginOptions('blog',$blogid);
\r
2163 <th colspan="2"><?php echo _EBLOG_CHANGE?></th>
\r
2165 <td><?php echo _EBLOG_CHANGE?></td>
\r
2166 <td><input type="submit" tabindex="130" value="<?php echo _EBLOG_CHANGE_BTN?>" onclick="return checkSubmit();" /></td>
\r
2171 <h3><?php echo _EBLOG_CAT_TITLE?></h3>
\r
2175 $query = 'SELECT * FROM '.sql_table('category').' WHERE cblog='.$blog->getID().' ORDER BY cname';
\r
2176 $template['content'] = 'categorylist';
\r
2177 $template['tabindex'] = 200;
\r
2179 $batch = new BATCH('category');
\r
2180 $batch->showlist($query,'table',$template);
\r
2185 <form action="index.php" method="post"><div>
\r
2186 <input name="action" value="categorynew" type="hidden" />
\r
2187 <input name="blogid" value="<?php echo $blog->getID()?>" type="hidden" />
\r
2190 <th colspan="2"><?php echo _EBLOG_CAT_CREATE?></th>
\r
2192 <td><?php echo _EBLOG_CAT_NAME?></td>
\r
2193 <td><input name="cname" size="40" maxlength="40" tabindex="300" /></td>
\r
2195 <td><?php echo _EBLOG_CAT_DESC?></td>
\r
2196 <td><input name="cdesc" size="40" maxlength="200" tabindex="310" /></td>
\r
2198 <td><?php echo _EBLOG_CAT_CREATE?></td>
\r
2199 <td><input type="submit" value="<?php echo _EBLOG_CAT_CREATE?>" tabindex="320" /></td>
\r
2205 echo '<h3>', _PLUGINS_EXTRA , '</h3>';
\r
2208 'BlogSettingsFormExtras',
\r
2214 $this->pagefoot();
\r
2217 function action_categorynew() {
\r
2218 global $member, $manager;
\r
2220 $blogid = intRequestVar('blogid');
\r
2222 $member->blogAdminRights($blogid) or $this->disallow();
\r
2224 $cname = postVar('cname');
\r
2225 $cdesc = postVar('cdesc');
\r
2227 if (!isValidCategoryName($cname))
\r
2228 $this->error(_ERROR_BADCATEGORYNAME);
\r
2230 $query = 'SELECT * FROM '.sql_table('category') . ' WHERE cname=\'' . addslashes($cname).'\' and cblog=' . intval($blogid);
\r
2231 $res = sql_query($query);
\r
2232 if (mysql_num_rows($res) > 0)
\r
2233 $this->error(_ERROR_DUPCATEGORYNAME);
\r
2235 $blog =& $manager->getBlog($blogid);
\r
2236 $newCatID = $blog->createNewCategory($cname, $cdesc);
\r
2238 $this->action_blogsettings();
\r
2242 function action_categoryedit($catid = '', $blogid = '', $desturl = '') {
\r
2245 if ($blogid == '')
\r
2246 $blogid = intGetVar('blogid');
\r
2248 $blogid = intval($blogid);
\r
2250 $catid = intGetVar('catid');
\r
2252 $catid = intval($catid);
\r
2254 $member->blogAdminRights($blogid) or $this->disallow();
\r
2256 $res = sql_query('SELECT * FROM '.sql_table('category')." WHERE cblog=$blogid AND catid=$catid");
\r
2257 $obj = mysql_fetch_object($res);
\r
2259 $cname = $obj->cname;
\r
2260 $cdesc = $obj->cdesc;
\r
2262 $this->pagehead();
\r
2265 <h2><?php echo _EBLOG_CAT_UPDATE?> '<?php echo htmlspecialchars($cname)?>'</h2>
\r
2266 <form method='post' action='index.php'><div>
\r
2267 <input name="blogid" type="hidden" value="<?php echo $blogid?>" />
\r
2268 <input name="catid" type="hidden" value="<?php echo $catid?>" />
\r
2269 <input name="desturl" type="hidden" value="<?php echo htmlspecialchars($desturl) ?>" />
\r
2270 <input name="action" type="hidden" value="categoryupdate" />
\r
2273 <th colspan="2"><?php echo _EBLOG_CAT_UPDATE ?></th>
\r
2275 <td><?php echo _EBLOG_CAT_NAME?></td>
\r
2276 <td><input type="text" name="cname" value="<?php echo htmlspecialchars($cname)?>" size="40" maxlength="40" /></td>
\r
2278 <td><?php echo _EBLOG_CAT_DESC?></td>
\r
2279 <td><input type="text" name="cdesc" value="<?php echo htmlspecialchars($cdesc)?>" size="40" maxlength="200" /></td>
\r
2282 // insert plugin options
\r
2283 $this->_insertPluginOptions('category',$catid);
\r
2286 <th colspan="2"><?php echo _EBLOG_CAT_UPDATE ?></th>
\r
2288 <td><?php echo _EBLOG_CAT_UPDATE?></td>
\r
2289 <td><input type="submit" value="<?php echo _EBLOG_CAT_UPDATE_BTN?>" /></td>
\r
2294 $this->pagefoot();
\r
2298 function action_categoryupdate() {
\r
2299 global $member, $manager;
\r
2301 $blogid = intPostVar('blogid');
\r
2302 $catid = intPostVar('catid');
\r
2303 $cname = postVar('cname');
\r
2304 $cdesc = postVar('cdesc');
\r
2305 $desturl = postVar('desturl');
\r
2307 $member->blogAdminRights($blogid) or $this->disallow();
\r
2309 if (!isValidCategoryName($cname))
\r
2310 $this->error(_ERROR_BADCATEGORYNAME);
\r
2312 $query = 'SELECT * FROM '.sql_table('category').' WHERE cname=\'' . addslashes($cname).'\' and cblog=' . intval($blogid) . " and not(catid=$catid)";
\r
2313 $res = sql_query($query);
\r
2314 if (mysql_num_rows($res) > 0)
\r
2315 $this->error(_ERROR_DUPCATEGORYNAME);
\r
2317 $query = 'UPDATE '.sql_table('category').' SET'
\r
2318 . " cname='" . addslashes($cname) . "',"
\r
2319 . " cdesc='" . addslashes($cdesc) . "'"
\r
2320 . " WHERE catid=" . $catid;
\r
2322 sql_query($query);
\r
2324 // store plugin options
\r
2325 $aOptions = requestArray('plugoption');
\r
2326 NucleusPlugin::_applyPluginOptions($aOptions);
\r
2327 $manager->notify('PostPluginOptionsUpdate',array('context' => 'category', 'catid' => $catid));
\r
2331 redirect($desturl);
\r
2334 $this->action_blogsettings();
\r
2338 function action_categorydelete() {
\r
2339 global $member, $manager;
\r
2341 $blogid = intRequestVar('blogid');
\r
2342 $catid = intRequestVar('catid');
\r
2344 $member->blogAdminRights($blogid) or $this->disallow();
\r
2346 $blog =& $manager->getBlog($blogid);
\r
2348 // check if the category is valid
\r
2349 if (!$blog->isValidCategory($catid))
\r
2350 $this->error(_ERROR_NOSUCHCATEGORY);
\r
2352 // don't allow deletion of default category
\r
2353 if ($blog->getDefaultCategory() == $catid)
\r
2354 $this->error(_ERROR_DELETEDEFCATEGORY);
\r
2356 // check if catid is the only category left for blogid
\r
2357 $query = 'SELECT catid FROM '.sql_table('category').' WHERE cblog=' . $blogid;
\r
2358 $res = sql_query($query);
\r
2359 if (mysql_num_rows($res) == 1)
\r
2360 $this->error(_ERROR_DELETELASTCATEGORY);
\r
2363 $this->pagehead();
\r
2365 <h2><?php echo _DELETE_CONFIRM?></h2>
\r
2368 <?php echo _CONFIRMTXT_CATEGORY?><b><?php echo $blog->getCategoryName($catid)?></b>
\r
2371 <form method="post" action="index.php"><div>
\r
2372 <input type="hidden" name="action" value="categorydeleteconfirm" />
\r
2373 <input type="hidden" name="blogid" value="<?php echo $blogid?>" />
\r
2374 <input type="hidden" name="catid" value="<?php echo $catid?>" />
\r
2375 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
\r
2378 $this->pagefoot();
\r
2381 function action_categorydeleteconfirm() {
\r
2382 global $member, $manager;
\r
2384 $blogid = intRequestVar('blogid');
\r
2385 $catid = intRequestVar('catid');
\r
2387 $member->blogAdminRights($blogid) or $this->disallow();
\r
2389 $error = $this->deleteOneCategory($catid);
\r
2391 $this->error($error);
\r
2393 $this->action_blogsettings();
\r
2396 function deleteOneCategory($catid) {
\r
2397 global $manager, $member;
\r
2399 $catid = intval($catid);
\r
2401 $manager->notify('PreDeleteCategory', array('catid' => $catid));
\r
2403 $blogid = getBlogIDFromCatID($catid);
\r
2405 if (!$member->blogAdminRights($blogid))
\r
2406 return ERROR_DISALLOWED;
\r
2409 $blog =& $manager->getBlog($blogid);
\r
2411 // check if the category is valid
\r
2412 if (!$blog || !$blog->isValidCategory($catid))
\r
2413 return _ERROR_NOSUCHCATEGORY;
\r
2415 $destcatid = $blog->getDefaultCategory();
\r
2417 // don't allow deletion of default category
\r
2418 if ($blog->getDefaultCategory() == $catid)
\r
2419 return _ERROR_DELETEDEFCATEGORY;
\r
2421 // check if catid is the only category left for blogid
\r
2422 $query = 'SELECT catid FROM '.sql_table('category').' WHERE cblog=' . $blogid;
\r
2423 $res = sql_query($query);
\r
2424 if (mysql_num_rows($res) == 1)
\r
2425 return _ERROR_DELETELASTCATEGORY;
\r
2427 // change category for all items to the default category
\r
2428 $query = 'UPDATE '.sql_table('item')." SET icat=$destcatid WHERE icat=$catid";
\r
2429 sql_query($query);
\r
2431 // delete all associated plugin options
\r
2432 NucleusPlugin::_deleteOptionValues('category', $catid);
\r
2434 // delete category
\r
2435 $query = 'DELETE FROM '.sql_table('category').' WHERE catid=' .$catid;
\r
2436 sql_query($query);
\r
2438 $manager->notify('PostDeleteCategory', array('catid' => $catid));
\r
2442 function moveOneCategory($catid, $destblogid) {
\r
2443 global $manager, $member;
\r
2445 $catid = intval($catid);
\r
2446 $destblogid = intval($destblogid);
\r
2448 $blogid = getBlogIDFromCatID($catid);
\r
2450 // mover should have admin rights on both blogs
\r
2451 if (!$member->blogAdminRights($blogid))
\r
2452 return _ERROR_DISALLOWED;
\r
2453 if (!$member->blogAdminRights($destblogid))
\r
2454 return _ERROR_DISALLOWED;
\r
2456 // cannot move to self
\r
2457 if ($blogid == $destblogid)
\r
2458 return _ERROR_MOVETOSELF;
\r
2461 $blog =& $manager->getBlog($blogid);
\r
2462 $destblog =& $manager->getBlog($destblogid);
\r
2464 // check if the category is valid
\r
2465 if (!$blog || !$blog->isValidCategory($catid))
\r
2466 return _ERROR_NOSUCHCATEGORY;
\r
2468 // don't allow default category to be moved
\r
2469 if ($blog->getDefaultCategory() == $catid)
\r
2470 return _ERROR_MOVEDEFCATEGORY;
\r
2473 'PreMoveCategory',
\r
2475 'catid' => &$catid,
\r
2476 'sourceblog' => &$blog,
\r
2477 'destblog' => &$destblog
\r
2481 // update comments table (cblog)
\r
2482 $query = 'SELECT inumber FROM '.sql_table('item').' WHERE icat='.$catid;
\r
2483 $items = sql_query($query);
\r
2484 while ($oItem = mysql_fetch_object($items)) {
\r
2485 sql_query('UPDATE '.sql_table('comment').' SET cblog='.$destblogid.' WHERE citem='.$oItem->inumber);
\r
2488 // update items (iblog)
\r
2489 $query = 'UPDATE '.sql_table('item').' SET iblog='.$destblogid.' WHERE icat='.$catid;
\r
2490 sql_query($query);
\r
2493 $query = 'UPDATE '.sql_table('category').' SET cblog='.$destblogid.' WHERE catid='.$catid;
\r
2494 sql_query($query);
\r
2497 'PostMoveCategory',
\r
2499 'catid' => &$catid,
\r
2500 'sourceblog' => &$blog,
\r
2501 'destblog' => $destblog
\r
2507 function action_blogsettingsupdate() {
\r
2508 global $member, $manager;
\r
2510 $blogid = intRequestVar('blogid');
\r
2512 $member->blogAdminRights($blogid) or $this->disallow();
\r
2514 $blog =& $manager->getBlog($blogid);
\r
2516 $notify = trim(postVar('notify'));
\r
2517 $shortname = trim(postVar('shortname'));
\r
2518 $updatefile = trim(postVar('update'));
\r
2520 $notifyComment = intPostVar('notifyComment');
\r
2521 $notifyVote = intPostVar('notifyVote');
\r
2522 $notifyNewItem = intPostVar('notifyNewItem');
\r
2524 if ($notifyComment == 0) $notifyComment = 1;
\r
2525 if ($notifyVote == 0) $notifyVote = 1;
\r
2526 if ($notifyNewItem == 0) $notifyNewItem = 1;
\r
2528 $notifyType = $notifyComment * $notifyVote * $notifyNewItem;
\r
2532 $not = new NOTIFICATION($notify);
\r
2533 if (!$not->validAddresses())
\r
2534 $this->error(_ERROR_BADNOTIFY);
\r
2538 if (!isValidShortName($shortname))
\r
2539 $this->error(_ERROR_BADSHORTBLOGNAME);
\r
2541 if (($blog->getShortName() != $shortname) && $manager->existsBlog($shortname))
\r
2542 $this->error(_ERROR_DUPSHORTBLOGNAME);
\r
2544 // check if update file is writable
\r
2545 if ($updatefile && !is_writeable($updatefile))
\r
2546 $this->error(_ERROR_UPDATEFILE);
\r
2548 $blog->setName(trim(postVar('name')));
\r
2549 $blog->setShortName($shortname);
\r
2550 $blog->setNotifyAddress($notify);
\r
2551 $blog->setNotifyType($notifyType);
\r
2552 $blog->setMaxComments(postVar('maxcomments'));
\r
2553 $blog->setCommentsEnabled(postVar('comments'));
\r
2554 $blog->setTimeOffset(postVar('timeoffset'));
\r
2555 $blog->setUpdateFile($updatefile);
\r
2556 $blog->setURL(trim(postVar('url')));
\r
2557 $blog->setDefaultSkin(intPostVar('defskin'));
\r
2558 $blog->setDescription(trim(postVar('desc')));
\r
2559 $blog->setPublic(postVar('public'));
\r
2560 $blog->setPingUserland(postVar('pinguserland'));
\r
2561 $blog->setConvertBreaks(intPostVar('convertbreaks'));
\r
2562 $blog->setAllowPastPosting(intPostVar('allowpastposting'));
\r
2563 $blog->setDefaultCategory(intPostVar('defcat'));
\r
2564 $blog->setSearchable(intPostVar('searchable'));
\r
2566 $blog->writeSettings();
\r
2568 // store plugin options
\r
2569 $aOptions = requestArray('plugoption');
\r
2570 NucleusPlugin::_applyPluginOptions($aOptions);
\r
2571 $manager->notify('PostPluginOptionsUpdate',array('context' => 'blog', 'blogid' => $blogid, 'blog' => &$blog));
\r
2574 $this->action_overview(_MSG_SETTINGSCHANGED);
\r
2577 function action_deleteblog() {
\r
2578 global $member, $CONF, $manager;
\r
2580 $blogid = intRequestVar('blogid');
\r
2582 $member->blogAdminRights($blogid) or $this->disallow();
\r
2584 // check if blog is default blog
\r
2585 if ($CONF['DefaultBlog'] == $blogid)
\r
2586 $this->error(_ERROR_DELDEFBLOG);
\r
2588 $blog =& $manager->getBlog($blogid);
\r
2590 $this->pagehead();
\r
2592 <h2><?php echo _DELETE_CONFIRM?></h2>
\r
2594 <p><?php echo _WARNINGTXT_BLOGDEL?>
\r
2598 <?php echo _CONFIRMTXT_BLOG?><b><?php echo htmlspecialchars($blog->getName())?></b>
\r
2601 <form method="post" action="index.php"><div>
\r
2602 <input type="hidden" name="action" value="deleteblogconfirm" />
\r
2603 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
\r
2604 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
\r
2607 $this->pagefoot();
\r
2610 function action_deleteblogconfirm() {
\r
2611 global $member, $CONF, $manager;
\r
2613 $blogid = intRequestVar('blogid');
\r
2615 $manager->notify('PreDeleteBlog', array('blogid' => $blogid));
\r
2617 $member->blogAdminRights($blogid) or $this->disallow();
\r
2619 // check if blog is default blog
\r
2620 if ($CONF['DefaultBlog'] == $blogid)
\r
2621 $this->error(_ERROR_DELDEFBLOG);
\r
2623 // delete all comments
\r
2624 $query = 'DELETE FROM '.sql_table('comment').' WHERE cblog='.$blogid;
\r
2625 sql_query($query);
\r
2627 // delete all items
\r
2628 $query = 'DELETE FROM '.sql_table('item').' WHERE iblog='.$blogid;
\r
2629 sql_query($query);
\r
2631 // delete all team members
\r
2632 $query = 'DELETE FROM '.sql_table('team').' WHERE tblog='.$blogid;
\r
2633 sql_query($query);
\r
2635 // delete all bans
\r
2636 $query = 'DELETE FROM '.sql_table('ban').' WHERE blogid='.$blogid;
\r
2637 sql_query($query);
\r
2639 // delete all categories
\r
2640 $query = 'DELETE FROM '.sql_table('category').' WHERE cblog='.$blogid;
\r
2641 sql_query($query);
\r
2643 // delete all associated plugin options
\r
2644 NucleusPlugin::_deleteOptionValues('blog', $blogid);
\r
2646 // delete the blog itself
\r
2647 $query = 'DELETE FROM '.sql_table('blog').' WHERE bnumber='.$blogid;
\r
2648 sql_query($query);
\r
2650 $manager->notify('PostDeleteBlog', array('blogid' => $blogid));
\r
2652 $this->action_overview(_DELETED_BLOG);
\r
2655 function action_memberdelete() {
\r
2658 $memberid = intRequestVar('memberid');
\r
2660 ($member->getID() == $memberid) or $member->isAdmin() or $this->disallow();
\r
2662 $mem = MEMBER::createFromID($memberid);
\r
2664 $this->pagehead();
\r
2666 <h2><?php echo _DELETE_CONFIRM?></h2>
\r
2668 <p><?php echo _CONFIRMTXT_MEMBER?><b><?php echo $mem->getDisplayName() ?></b>
\r
2672 Please note that media files will <b>NOT</b> be deleted. (At least not in this Nucleus version)
\r
2675 <form method="post" action="index.php"><div>
\r
2676 <input type="hidden" name="action" value="memberdeleteconfirm" />
\r
2677 <input type="hidden" name="memberid" value="<?php echo $memberid; ?>" />
\r
2678 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
\r
2681 $this->pagefoot();
\r
2684 function action_memberdeleteconfirm() {
\r
2687 $memberid = intRequestVar('memberid');
\r
2689 ($member->getID() == $memberid) or $member->isAdmin() or $this->disallow();
\r
2691 $error = $this->deleteOneMember($memberid);
\r
2693 $this->error($error);
\r
2695 if ($member->isAdmin())
\r
2696 $this->action_usermanagement();
\r
2698 $this->action_overview(_DELETED_MEMBER);
\r
2701 function deleteOneMember($memberid) {
\r
2704 $memberid = intval($memberid);
\r
2705 $mem = MEMBER::createFromID($memberid);
\r
2707 if (!$mem->canBeDeleted())
\r
2708 return _ERROR_DELETEMEMBER;
\r
2710 $manager->notify('PreDeleteMember', array('member' => &$mem));
\r
2712 $query = 'DELETE FROM '.sql_table('member').' WHERE mnumber='.$memberid;
\r
2713 sql_query($query);
\r
2715 $query = 'DELETE FROM '.sql_table('team').' WHERE tmember='.$memberid;
\r
2716 sql_query($query);
\r
2718 // delete all associated plugin options
\r
2719 NucleusPlugin::_deleteOptionValues('member', $memberid);
\r
2721 $manager->notify('PostDeleteMember', array('member' => &$mem));
\r
2726 function action_createnewlog() {
\r
2727 global $member, $CONF;
\r
2729 // Only Super-Admins can do this
\r
2730 $member->isAdmin() or $this->disallow();
\r
2732 $this->pagehead();
\r
2734 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
\r
2736 <h2><?php echo _EBLOG_CREATE_TITLE?></h2>
\r
2740 <p>作成にあたって、下記の<strong>注意事項</strong> をまずお読み下さい</p>
\r
2742 <p>新しいweblogを作成した後に、このblogにアクセスするための方法を紹介しておきます。方法は2つあります:</p>
\r
2745 <li><strong>簡単な方法:</strong> <code>index.php</code>の複製を作り、新しいblogを表示するように変更を加えます。 この変更の詳細は、作成後に表示されます。Further instructions on how to do this will be provided after you've submitted this first form.</li>
\r
2746 <li><strong>高度な方法:</strong> 現在のblogで使用しているスキンに<code>otherblog</code>というコードを使った記述を加えます。この方法では、同じページ内で複数のblogを展開することが可能となります。</li>
\r
2749 <h3>Weblogの作成</h3>
\r
2752 <?php echo _EBLOG_CREATE_TEXT?>
\r
2755 <form method="post" action="index.php"><div>
\r
2757 <input type="hidden" name="action" value="addnewlog" />
\r
2759 <td><?php echo _EBLOG_NAME?></td>
\r
2760 <td><input name="name" tabindex="10" size="40" maxlength="60" /></td>
\r
2762 <td><?php echo _EBLOG_SHORTNAME?>
\r
2763 <?php help('shortblogname'); ?>
\r
2765 <td><input name="shortname" tabindex="20" maxlength="15" size="15" /></td>
\r
2767 <td><?php echo _EBLOG_DESC?></td>
\r
2768 <td><input name="desc" tabindex="30" maxlength="200" size="40" /></td>
\r
2770 <td><?php echo _EBLOG_DEFSKIN?>
\r
2771 <?php help('blogdefaultskin'); ?>
\r
2775 $query = 'SELECT sdname as text, sdnumber as value'
\r
2776 . ' FROM '.sql_table('skin_desc');
\r
2777 $template['name'] = 'defskin';
\r
2778 $template['tabindex'] = 50;
\r
2779 $template['selected'] = $CONF['BaseSkin']; // set default selected skin to be globally defined base skin
\r
2780 showlist($query,'select',$template);
\r
2784 <td><?php echo _EBLOG_OFFSET?>
\r
2785 <?php help('blogtimeoffset'); ?>
\r
2786 <br /><?php echo _EBLOG_STIME?> <b><?php echo strftime("%H:%M",time()); ?></b>
\r
2788 <td><input name="timeoffset" tabindex="110" size="3" value="0" /></td>
\r
2790 <td><?php echo _EBLOG_ADMIN?>
\r
2791 <?php help('blogadmin'); ?>
\r
2793 <td><?php echo _EBLOG_ADMIN_MSG?></td>
\r
2795 <td><?php echo _EBLOG_CREATE?></td>
\r
2796 <td><input type="submit" tabindex="120" value="<?php echo _EBLOG_CREATE_BTN?>" onclick="return checkSubmit();" /></td>
\r
2801 $this->pagefoot();
\r
2804 function action_addnewlog() {
\r
2805 global $member, $manager, $CONF;
\r
2807 // Only Super-Admins can do this
\r
2808 $member->isAdmin() or $this->disallow();
\r
2810 $bname = trim(postVar('name'));
\r
2811 $bshortname = trim(postVar('shortname'));
\r
2812 $btimeoffset = postVar('timeoffset');
\r
2813 $bdesc = trim(postVar('desc'));
\r
2814 $bdefskin = postVar('defskin');
\r
2816 if (!isValidShortName($bshortname))
\r
2817 $this->error(_ERROR_BADSHORTBLOGNAME);
\r
2819 if ($manager->existsBlog($bshortname))
\r
2820 $this->error(_ERROR_DUPSHORTBLOGNAME);
\r
2825 'name' => &$bname,
\r
2826 'shortname' => &$bshortname,
\r
2827 'timeoffset' => &$btimeoffset,
\r
2828 'description' => &$bdescription,
\r
2829 'defaultskin' => &$bdefskin
\r
2834 // add slashes for sql queries
\r
2835 $bname = addslashes($bname);
\r
2836 $bshortname = addslashes($bshortname);
\r
2837 $btimeoffset = addslashes($btimeoffset);
\r
2838 $bdesc = addslashes($bdesc);
\r
2839 $bdefskin = addslashes($bdefskin);
\r
2842 $query = 'INSERT INTO '.sql_table('blog')." (bname, bshortname, bdesc, btimeoffset, bdefskin) VALUES ('$bname', '$bshortname', '$bdesc', '$btimeoffset', '$bdefskin')";
\r
2843 sql_query($query);
\r
2844 $blogid = mysql_insert_id();
\r
2845 $blog =& $manager->getBlog($blogid);
\r
2847 // create new category
\r
2848 sql_query('INSERT INTO '.sql_table('category')." (cblog, cname, cdesc) VALUES ($blogid, 'General','Items that do not fit in other categories')");
\r
2849 $catid = mysql_insert_id();
\r
2851 // set as default category
\r
2852 $blog->setDefaultCategory($catid);
\r
2853 $blog->writeSettings();
\r
2855 // create team member
\r
2856 $memberid = $member->getID();
\r
2857 $query = 'INSERT INTO '.sql_table('team')." (tmember, tblog, tadmin) VALUES ($memberid, $blogid, 1)";
\r
2858 sql_query($query);
\r
2861 $blog->additem($blog->getDefaultCategory(),'First Item','これはあなたのweblogにおける最初のアイテムです。自由に削除していただいてかまいません。','',$blogid, $memberid,$blog->getCorrectTime(),0,0,0);
\r
2871 'PostAddCategory',
\r
2877 $this->pagehead();
\r
2879 <h2>新しいweblogが作成されました</h2>
\r
2881 <p>新しいweblog 「<?php echo htmlspecialchars($bname)?>」が作成されました。続けて、これにアクセスするために以下のどちらかの手順に進んでください。</p>
\r
2884 <li><a href="#index_php">簡単な方法: 下のコードを貼付けた <code><?php echo htmlspecialchars($bshortname)?>.php</code> というファイルを作成する</a></li>
\r
2885 <li><a href="#skins">高度な方法: 現在使用しているスキンに新しいweblogを展開させるための記述を加える</a></li>
\r
2888 <h3><a id="index_php">方法 1: <code><?php echo htmlspecialchars($bshortname)?>.php</code> というファイルを作成</a></h3>
\r
2890 <p><code><?php echo htmlspecialchars($bshortname)?>.php</code> というファイルを作成して、中身に以下のコードを貼り付ける:</p>
\r
2891 <pre><code><?php
\r
2893 $CONF['Self'] = '<b><?php echo htmlspecialchars($bshortname)?>.php</b>';
\r
2895 include('<i>./config.php</i>');
\r
2897 selectBlog('<b><?php echo htmlspecialchars($bshortname)?></b>');
\r
2900 ?></code></pre>
\r
2902 <p>すでにある<code>index.php</code>と同じディレクトリにアップロードします。</p>
\r
2904 <p>新しいweblogの作成を完了するためには、下にこのファイルのURLを入力してください。 (すでに用意した値で合っているとは思いますが保証はしません):</p>
\r
2906 <form action="index.php" method="post"><div>
\r
2907 <input type="hidden" name="action" value="addnewlog2" />
\r
2908 <input type="hidden" name="blogid" value="<?php echo intval($blogid)?>" />
\r
2910 <td><?php echo _EBLOG_URL?></td>
\r
2911 <td><input name="url" maxlength="100" size="40" value="<?php echo htmlspecialchars($CONF['IndexURL'].$bshortname.'.php')?>" /></td>
\r
2913 <td><?php echo _EBLOG_CREATE?></td>
\r
2914 <td><input type="submit" value="<?php echo _EBLOG_CREATE_BTN?>" onclick="return checkSubmit();" /></td>
\r
2918 <h3><a id="skins">方法 2: 現在使用しているスキンに新しいweblogを展開する記述を加える</a></h3>
\r
2920 <p>新しいweblogの作成を完了するためには、下にURLを入力してください。 (大抵は既存blogと同じURL)</p>
\r
2922 <form action="index.php" method="post"><div>
\r
2923 <input type="hidden" name="action" value="addnewlog2" />
\r
2924 <input type="hidden" name="blogid" value="<?php echo intval($blogid)?>" />
\r
2926 <td><?php echo _EBLOG_URL?></td>
\r
2927 <td><input name="url" maxlength="100" size="40" /></td>
\r
2929 <td><?php echo _EBLOG_CREATE?></td>
\r
2930 <td><input type="submit" value="<?php echo _EBLOG_CREATE_BTN?>" onclick="return checkSubmit();" /></td>
\r
2934 <?php $this->pagefoot();
\r
2938 function action_addnewlog2() {
\r
2939 global $member, $manager;
\r
2941 $member->blogAdminRights($blogid) or $this->disallow();
\r
2943 $burl = requestVar('url');
\r
2944 $blogid = intRequestVar('blogid');
\r
2946 $blog =& $manager->getBlog($blogid);
\r
2947 $blog->setURL(trim($burl));
\r
2948 $blog->writeSettings();
\r
2950 $this->action_overview(_MSG_NEWBLOG);
\r
2953 function action_skinieoverview() {
\r
2954 global $member, $DIR_LIBS;
\r
2956 $member->isAdmin() or $this->disallow();
\r
2958 // load skinie class
\r
2959 include_once($DIR_LIBS . 'skinie.php');
\r
2961 $this->pagehead();
\r
2963 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
\r
2966 <h2><?php echo _SKINIE_TITLE_IMPORT?></h2>
\r
2968 <p><label for="skinie_import_local"><?php echo _SKINIE_LOCAL?></label>
\r
2969 <?php global $DIR_SKINS;
\r
2971 $candidates = SKINIMPORT::searchForCandidates($DIR_SKINS);
\r
2973 if (sizeof($candidates) > 0) {
\r
2975 <form method="post" action="index.php"><div>
\r
2976 <input type="hidden" name="action" value="skinieimport" />
\r
2977 <input type="hidden" name="mode" value="file" />
\r
2978 <select name="skinfile" id="skinie_import_local">
\r
2979 <?php foreach ($candidates as $skinname => $skinfile) {
\r
2980 $html = htmlspecialchars($skinfile);
\r
2981 echo '<option value="',$html,'">',$skinname,'</option>';
\r
2985 <input type="submit" value="<?php echo _SKINIE_BTN_IMPORT?>" />
\r
2988 echo _SKINIE_NOCANDIDATES;
\r
2993 <p><em><?php echo _OR?></em></p>
\r
2995 <form method="post" action="index.php"><p>
\r
2996 <input type="hidden" name="action" value="skinieimport" />
\r
2997 <input type="hidden" name="mode" value="url" />
\r
2998 <label for="skinie_import_url"><?php echo _SKINIE_FROMURL?></label>
\r
2999 <input type="text" name="skinfile" id="skinie_import_url" size="60" value="http://" />
\r
3000 <input type="submit" value="<?php echo _SKINIE_BTN_IMPORT?>" />
\r
3004 <h2><?php echo _SKINIE_TITLE_EXPORT?></h2>
\r
3005 <form method="post" action="index.php"><div>
\r
3006 <input type="hidden" name="action" value="skinieexport" />
\r
3008 <p><?php echo _SKINIE_EXPORT_INTRO?></p>
\r
3011 <th colspan="2"><?php echo _SKINIE_EXPORT_SKINS?></th>
\r
3013 <?php // show list of skins
\r
3014 $res = sql_query('SELECT * FROM '.sql_table('skin_desc'));
\r
3015 while ($skinObj = mysql_fetch_object($res)) {
\r
3016 $id = 'skinexp' . $skinObj->sdnumber;
\r
3017 echo '<td><input type="checkbox" name="skin[',$skinObj->sdnumber,']" id="',$id,'" />';
\r
3018 echo '<label for="',$id,'">',htmlspecialchars($skinObj->sdname),'</label></td>';
\r
3019 echo '<td>',htmlspecialchars($skinObj->sddesc),'</td>';
\r
3023 echo '<th colspan="2">',_SKINIE_EXPORT_TEMPLATES,'</th></tr><tr>';
\r
3025 // show list of templates
\r
3026 $res = sql_query('SELECT * FROM '.sql_table('template_desc'));
\r
3027 while ($templateObj = mysql_fetch_object($res)) {
\r
3028 $id = 'templateexp' . $templateObj->tdnumber;
\r
3029 echo '<td><input type="checkbox" name="template[',$templateObj->tdnumber,']" id="',$id,'" />';
\r
3030 echo '<label for="',$id,'">',htmlspecialchars($templateObj->tdname),'</label></td>';
\r
3031 echo '<td>',htmlspecialchars($templateObj->tddesc),'</td>';
\r
3036 <th colspan="2"><?php echo _SKINIE_EXPORT_EXTRA?></th>
\r
3038 <td colspan="2"><textarea cols="40" rows="5" name="info"></textarea></td>
\r
3040 <th colspan="2"><?php echo _SKINIE_TITLE_EXPORT?></th>
\r
3042 <td colspan="2"><input type="submit" value="<?php echo _SKINIE_BTN_EXPORT?>" /></td>
\r
3047 $this->pagefoot();
\r
3051 function action_skinieimport() {
\r
3052 global $member, $DIR_LIBS, $DIR_SKINS;
\r
3054 $member->isAdmin() or $this->disallow();
\r
3056 // load skinie class
\r
3057 include_once($DIR_LIBS . 'skinie.php');
\r
3059 $skinFileRaw= postVar('skinfile');
\r
3060 $mode = postVar('mode');
\r
3062 $importer = new SKINIMPORT();
\r
3064 // get full filename
\r
3065 if ($mode == 'file')
\r
3067 $skinFile = $DIR_SKINS . $skinFileRaw . '/skinbackup.xml';
\r
3069 // backwards compatibilty (in v2.0, exports were saved as skindata.xml)
\r
3070 if (!file_exists($skinFile))
\r
3071 $skinFile = $DIR_SKINS . $skinFileRaw . '/skindata.xml';
\r
3073 $skinFile = $skinFileRaw;
\r
3076 // read only metadata
\r
3077 $error = $importer->readFile($skinFile, 1);
\r
3080 if ($error) $this->error($error);
\r
3082 $this->pagehead();
\r
3084 echo '<p><a href="index.php?action=skinieoverview">(',_BACK,')</a></p>';
\r
3086 <h2><?php echo _SKINIE_CONFIRM_TITLE?></h2>
\r
3089 <li><p><strong><?php echo _SKINIE_INFO_GENERAL?></strong> <?php echo htmlspecialchars($importer->getInfo())?></p></li>
\r
3090 <li><p><strong><?php echo _SKINIE_INFO_SKINS?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->getSkinNames())?></p></li>
\r
3091 <li><p><strong><?php echo _SKINIE_INFO_TEMPLATES?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->getTemplateNames())?></p></li>
\r
3092 <li><p><strong style="color: red;"><?php echo _SKINIE_INFO_SKINCLASH?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->checkSkinNameClashes())?></p></li>
\r
3093 <li><p><strong style="color: red;"><?php echo _SKINIE_INFO_TEMPLCLASH?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->checkTemplateNameClashes())?></p></li>
\r
3096 <form method="post" action="index.php"><div>
\r
3097 <input type="hidden" name="action" value="skiniedoimport" />
\r
3098 <input type="hidden" name="skinfile" value="<?php echo htmlspecialchars(postVar('skinfile'))?>" />
\r
3099 <input type="hidden" name="mode" value="<?php echo htmlspecialchars($mode)?>" />
\r
3100 <input type="submit" value="<?php echo _SKINIE_CONFIRM_IMPORT?>" />
\r
3102 <input type="checkbox" name="overwrite" value="1" id="cb_overwrite" /><label for="cb_overwrite"><?php echo _SKINIE_CONFIRM_OVERWRITE?></label>
\r
3107 $this->pagefoot();
\r
3110 function action_skiniedoimport() {
\r
3111 global $member, $DIR_LIBS, $DIR_SKINS;
\r
3113 $member->isAdmin() or $this->disallow();
\r
3115 // load skinie class
\r
3116 include_once($DIR_LIBS . 'skinie.php');
\r
3118 $skinFileRaw= postVar('skinfile');
\r
3119 $mode = postVar('mode');
\r
3121 $allowOverwrite = intPostVar('overwrite');
\r
3123 // get full filename
\r
3124 if ($mode == 'file')
\r
3126 $skinFile = $DIR_SKINS . $skinFileRaw . '/skinbackup.xml';
\r
3128 // backwards compatibilty (in v2.0, exports were saved as skindata.xml)
\r
3129 if (!file_exists($skinFile))
\r
3130 $skinFile = $DIR_SKINS . $skinFileRaw . '/skindata.xml';
\r
3133 $skinFile = $skinFileRaw;
\r
3136 $importer = new SKINIMPORT();
\r
3138 $error = $importer->readFile($skinFile);
\r
3141 $this->error($error);
\r
3143 $error = $importer->writeToDatabase($allowOverwrite);
\r
3146 $this->error($error);
\r
3148 $this->pagehead();
\r
3150 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
\r
3152 <h2><?php echo _SKINIE_DONE?></h2>
\r
3155 <li><p><strong><?php echo _SKINIE_INFO_GENERAL?></strong> <?php echo htmlspecialchars($importer->getInfo())?></p></li>
\r
3156 <li><p><strong><?php echo _SKINIE_INFO_IMPORTEDSKINS?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->getSkinNames())?></p></li>
\r
3157 <li><p><strong><?php echo _SKINIE_INFO_IMPORTEDTEMPLS?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->getTemplateNames())?></p></li>
\r
3160 <?php $this->pagefoot();
\r
3164 function action_skinieexport() {
\r
3165 global $member, $DIR_LIBS;
\r
3167 $member->isAdmin() or $this->disallow();
\r
3169 // load skinie class
\r
3170 include_once($DIR_LIBS . 'skinie.php');
\r
3172 $aSkins = requestIntArray('skin');
\r
3173 $aTemplates = requestIntArray('template');
\r
3175 if (!is_array($aTemplates)) $aTemplates = array();
\r
3176 if (!is_array($aSkins)) $aSkins = array();
\r
3178 $skinList = array_keys($aSkins);
\r
3179 $templateList = array_keys($aTemplates);
\r
3181 $info = postVar('info');
\r
3183 $exporter = new SKINEXPORT();
\r
3184 foreach ($skinList as $skinId) {
\r
3185 $exporter->addSkin($skinId);
\r
3187 foreach ($templateList as $templateId) {
\r
3188 $exporter->addTemplate($templateId);
\r
3190 $exporter->setInfo($info);
\r
3192 $exporter->export();
\r
3195 function action_templateoverview() {
\r
3198 $member->isAdmin() or $this->disallow();
\r
3200 $this->pagehead();
\r
3202 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
\r
3204 echo '<h2>' . _TEMPLATE_TITLE . '</h2>';
\r
3205 echo '<h3>' . _TEMPLATE_AVAILABLE_TITLE . '</h3>';
\r
3207 $query = 'SELECT * FROM '.sql_table('template_desc').' ORDER BY tdname';
\r
3208 $template['content'] = 'templatelist';
\r
3209 $template['tabindex'] = 10;
\r
3210 showlist($query,'table',$template);
\r
3212 echo '<h3>' . _TEMPLATE_NEW_TITLE . '</h3>';
\r
3215 <form method="post" action="index.php"><div>
\r
3217 <input name="action" value="templatenew" type="hidden" />
\r
3219 <td><?php echo _TEMPLATE_NAME?> <?php help('shortnames');?></td>
\r
3220 <td><input name="name" tabindex="10010" maxlength="20" size="20" /></td>
\r
3222 <td><?php echo _TEMPLATE_DESC?></td>
\r
3223 <td><input name="desc" tabindex="10020" maxlength="200" size="50" /></td>
\r
3225 <td><?php echo _TEMPLATE_CREATE?></td>
\r
3226 <td><input type="submit" tabindex="10030" value="<?php echo _TEMPLATE_CREATE_BTN?>" onclick="return checkSubmit();" /></td>
\r
3232 $this->pagefoot();
\r
3235 function action_templateedit($msg = '') {
\r
3238 $templateid = intRequestVar('templateid');
\r
3240 $member->isAdmin() or $this->disallow();
\r
3242 $extrahead = '<script type="text/javascript" src="javascript/templateEdit.js"></script>';
\r
3243 $extrahead .= '<script type="text/javascript">setTemplateEditText("'.addslashes(_EDITTEMPLATE_EMPTY).'");</script>';
\r
3245 $this->pagehead($extrahead);
\r
3247 $templatename = TEMPLATE::getNameFromId($templateid);
\r
3248 $templatedescription = TEMPLATE::getDesc($templateid);
\r
3249 $template = TEMPLATE::read($templatename);
\r
3253 <a href="index.php?action=templateoverview">(<?php echo _TEMPLATE_BACK?>)</a>
\r
3256 <h2><?php echo _TEMPLATE_EDIT_TITLE?> '<?php echo $templatename; ?>'</h2>
\r
3258 <?php if ($msg) echo "<p>"._MESSAGE.": $msg</p>";
\r
3261 <p><?php echo _TEMPLATE_EDIT_MSG?></p>
\r
3263 <form method="post" action="index.php">
\r
3266 <input type="hidden" name="action" value="templateupdate" />
\r
3267 <input type="hidden" name="templateid" value="<?php echo $templateid; ?>" />
\r
3270 <th colspan="2"><?php echo _TEMPLATE_SETTINGS?></th>
\r
3272 <td><?php echo _TEMPLATE_NAME?> <?php help('shortnames');?></td>
\r
3273 <td><input name="tname" tabindex="4" size="20" maxlength="20" value="<?php echo htmlspecialchars($templatename) ?>" /></td>
\r
3275 <td><?php echo _TEMPLATE_DESC?></td>
\r
3276 <td><input name="tdesc" tabindex="5" size="50" maxlength="200" value="<?php echo htmlspecialchars($templatedescription) ?>" /></td>
\r
3278 <th colspan="2"><?php echo _TEMPLATE_UPDATE?></th>
\r
3280 <td><?php echo _TEMPLATE_UPDATE?></td>
\r
3282 <input type="submit" tabindex="6" value="<?php echo _TEMPLATE_UPDATE_BTN?>" onclick="return checkSubmit();" />
\r
3283 <input type="reset" tabindex="7" value="<?php echo _TEMPLATE_RESET_BTN?>" />
\r
3286 <th colspan="2"><?php echo _TEMPLATE_ITEMS?> <?php help('templateitems'); ?></th>
\r
3287 <?php $this->_templateEditRow($template, _TEMPLATE_ITEMHEADER, 'ITEM_HEADER', '', 8);
\r
3288 $this->_templateEditRow($template, _TEMPLATE_ITEMBODY, 'ITEM', '', 9, 1);
\r
3289 $this->_templateEditRow($template, _TEMPLATE_ITEMFOOTER, 'ITEM_FOOTER', '', 10);
\r
3290 $this->_templateEditRow($template, _TEMPLATE_MORELINK, 'MORELINK', 'morelink', 20);
\r
3291 $this->_templateEditRow($template, _TEMPLATE_EDITLINK, 'EDITLINK', 'editlink', 25);
\r
3292 $this->_templateEditRow($template, _TEMPLATE_NEW, 'NEW', 'new', 30);
\r
3295 <th colspan="2"><?php echo _TEMPLATE_COMMENTS_ANY?> <?php help('templatecomments'); ?></th>
\r
3296 <?php $this->_templateEditRow($template, _TEMPLATE_CHEADER, 'COMMENTS_HEADER', 'commentheaders', 40);
\r
3297 $this->_templateEditRow($template, _TEMPLATE_CBODY, 'COMMENTS_BODY', 'commentbody', 50, 1);
\r
3298 $this->_templateEditRow($template, _TEMPLATE_CFOOTER, 'COMMENTS_FOOTER', 'commentheaders', 60);
\r
3299 $this->_templateEditRow($template, _TEMPLATE_CONE, 'COMMENTS_ONE', 'commentwords', 70);
\r
3300 $this->_templateEditRow($template, _TEMPLATE_CMANY, 'COMMENTS_MANY', 'commentwords', 80);
\r
3301 $this->_templateEditRow($template, _TEMPLATE_CMORE, 'COMMENTS_CONTINUED', 'commentcontinued', 90);
\r
3302 $this->_templateEditRow($template, _TEMPLATE_CMEXTRA, 'COMMENTS_AUTH', 'memberextra', 100);
\r
3305 <th colspan="2"><?php echo _TEMPLATE_COMMENTS_NONE?> <?php help('templatecomments'); ?></th>
\r
3307 $this->_templateEditRow($template, _TEMPLATE_CNONE, 'COMMENTS_NONE', '', 110);
\r
3310 <th colspan="2"><?php echo _TEMPLATE_COMMENTS_TOOMUCH?> <?php help('templatecomments'); ?></th>
\r
3311 <?php $this->_templateEditRow($template, _TEMPLATE_CTOOMUCH, 'COMMENTS_TOOMUCH', '', 120);
\r
3314 <th colspan="2"><?php echo _TEMPLATE_ARCHIVELIST?> <?php help('templatearchivelists'); ?></th>
\r
3315 <?php $this->_templateEditRow($template, _TEMPLATE_AHEADER, 'ARCHIVELIST_HEADER', '', 130);
\r
3316 $this->_templateEditRow($template, _TEMPLATE_AITEM, 'ARCHIVELIST_LISTITEM', '', 140);
\r
3317 $this->_templateEditRow($template, _TEMPLATE_AFOOTER, 'ARCHIVELIST_FOOTER', '', 150);
\r
3320 <th colspan="2"><?php echo _TEMPLATE_CATEGORYLIST?> <?php help('templatecategorylists'); ?></th>
\r
3321 <?php $this->_templateEditRow($template, _TEMPLATE_CATHEADER, 'CATLIST_HEADER', '', 160);
\r
3322 $this->_templateEditRow($template, _TEMPLATE_CATITEM, 'CATLIST_LISTITEM', '', 170);
\r
3323 $this->_templateEditRow($template, _TEMPLATE_CATFOOTER, 'CATLIST_FOOTER', '', 180);
\r
3326 <th colspan="2"><?php echo _TEMPLATE_DATETIME?></th>
\r
3327 <?php $this->_templateEditRow($template, _TEMPLATE_DHEADER, 'DATE_HEADER', 'dateheads', 190);
\r
3328 $this->_templateEditRow($template, _TEMPLATE_DFOOTER, 'DATE_FOOTER', 'dateheads', 200);
\r
3329 $this->_templateEditRow($template, _TEMPLATE_DFORMAT, 'FORMAT_DATE', 'datetime', 210);
\r
3330 $this->_templateEditRow($template, _TEMPLATE_TFORMAT, 'FORMAT_TIME', 'datetime', 220);
\r
3331 $this->_templateEditRow($template, _TEMPLATE_LOCALE, 'LOCALE', 'locale', 230);
\r
3334 <th colspan="2"><?php echo _TEMPLATE_IMAGE?> <?php help('templatepopups'); ?></th>
\r
3335 <?php $this->_templateEditRow($template, _TEMPLATE_PCODE, 'POPUP_CODE', '', 240);
\r
3336 $this->_templateEditRow($template, _TEMPLATE_ICODE, 'IMAGE_CODE', '', 250);
\r
3337 $this->_templateEditRow($template, _TEMPLATE_MCODE, 'MEDIA_CODE', '', 260);
\r
3340 <th colspan="2"><?php echo _TEMPLATE_SEARCH?></th>
\r
3341 <?php $this->_templateEditRow($template, _TEMPLATE_SHIGHLIGHT, 'SEARCH_HIGHLIGHT', 'highlight',270);
\r
3342 $this->_templateEditRow($template, _TEMPLATE_SNOTFOUND, 'SEARCH_NOTHINGFOUND', 'nothingfound',280);
\r
3345 <th colspan="2"><?php echo _TEMPLATE_UPDATE?></th>
\r
3347 <td><?php echo _TEMPLATE_UPDATE?></td>
\r
3349 <input type="submit" tabindex="290" value="<?php echo _TEMPLATE_UPDATE_BTN?>" onclick="return checkSubmit();" />
\r
3350 <input type="reset" tabindex="300" value="<?php echo _TEMPLATE_RESET_BTN?>" />
\r
3357 $this->pagefoot();
\r
3360 function _templateEditRow(&$template, $description, $name, $help = '', $tabindex = 0, $big = 0) {
\r
3361 static $count = 1;
\r
3364 <td><?php echo $description?> <?php if ($help) help('template'.$help); ?></td>
\r
3365 <td id="td<?php echo $count?>"><textarea class="templateedit" name="<?php echo $name?>" tabindex="<?php echo $tabindex?>" cols="50" rows="<?php echo $big?10:5?>" id="textarea<?php echo $count?>"><?php echo htmlspecialchars($template[$name]); ?></textarea></td>
\r
3369 function action_templateupdate() {
\r
3372 $templateid = intRequestVar('templateid');
\r
3374 $member->isAdmin() or $this->disallow();
\r
3376 $name = postVar('tname');
\r
3377 $desc = postVar('tdesc');
\r
3379 if (!isValidTemplateName($name))
\r
3380 $this->error(_ERROR_BADTEMPLATENAME);
\r
3382 if ((TEMPLATE::getNameFromId($templateid) != $name) && TEMPLATE::exists($name))
\r
3383 $this->error(_ERROR_DUPTEMPLATENAME);
\r
3386 $name = addslashes($name);
\r
3387 $desc = addslashes($desc);
\r
3389 // 1. Remove all template parts
\r
3390 $query = 'DELETE FROM '.sql_table('template').' WHERE tdesc=' . $templateid;
\r
3391 sql_query($query);
\r
3393 // 2. Update description
\r
3394 $query = 'UPDATE '.sql_table('template_desc').' SET'
\r
3395 . " tdname='" . $name . "',"
\r
3396 . " tddesc='" . $desc . "'"
\r
3397 . " WHERE tdnumber=" . $templateid;
\r
3398 sql_query($query);
\r
3400 // 3. Add non-empty template parts
\r
3401 $this->addToTemplate($templateid, 'ITEM_HEADER', postVar('ITEM_HEADER'));
\r
3402 $this->addToTemplate($templateid, 'ITEM', postVar('ITEM'));
\r
3403 $this->addToTemplate($templateid, 'ITEM_FOOTER', postVar('ITEM_FOOTER'));
\r
3404 $this->addToTemplate($templateid, 'MORELINK', postVar('MORELINK'));
\r
3405 $this->addToTemplate($templateid, 'EDITLINK', postVar('EDITLINK'));
\r
3406 $this->addToTemplate($templateid, 'NEW', postVar('NEW'));
\r
3407 $this->addToTemplate($templateid, 'COMMENTS_HEADER', postVar('COMMENTS_HEADER'));
\r
3408 $this->addToTemplate($templateid, 'COMMENTS_BODY', postVar('COMMENTS_BODY'));
\r
3409 $this->addToTemplate($templateid, 'COMMENTS_FOOTER', postVar('COMMENTS_FOOTER'));
\r
3410 $this->addToTemplate($templateid, 'COMMENTS_CONTINUED', postVar('COMMENTS_CONTINUED'));
\r
3411 $this->addToTemplate($templateid, 'COMMENTS_TOOMUCH', postVar('COMMENTS_TOOMUCH'));
\r
3412 $this->addToTemplate($templateid, 'COMMENTS_AUTH', postVar('COMMENTS_AUTH'));
\r
3413 $this->addToTemplate($templateid, 'COMMENTS_ONE', postVar('COMMENTS_ONE'));
\r
3414 $this->addToTemplate($templateid, 'COMMENTS_MANY', postVar('COMMENTS_MANY'));
\r
3415 $this->addToTemplate($templateid, 'COMMENTS_NONE', postVar('COMMENTS_NONE'));
\r
3416 $this->addToTemplate($templateid, 'ARCHIVELIST_HEADER', postVar('ARCHIVELIST_HEADER'));
\r
3417 $this->addToTemplate($templateid, 'ARCHIVELIST_LISTITEM', postVar('ARCHIVELIST_LISTITEM'));
\r
3418 $this->addToTemplate($templateid, 'ARCHIVELIST_FOOTER', postVar('ARCHIVELIST_FOOTER'));
\r
3419 $this->addToTemplate($templateid, 'CATLIST_HEADER', postVar('CATLIST_HEADER'));
\r
3420 $this->addToTemplate($templateid, 'CATLIST_LISTITEM', postVar('CATLIST_LISTITEM'));
\r
3421 $this->addToTemplate($templateid, 'CATLIST_FOOTER', postVar('CATLIST_FOOTER'));
\r
3422 $this->addToTemplate($templateid, 'DATE_HEADER', postVar('DATE_HEADER'));
\r
3423 $this->addToTemplate($templateid, 'DATE_FOOTER', postVar('DATE_FOOTER'));
\r
3424 $this->addToTemplate($templateid, 'FORMAT_DATE', postVar('FORMAT_DATE'));
\r
3425 $this->addToTemplate($templateid, 'FORMAT_TIME', postVar('FORMAT_TIME'));
\r
3426 $this->addToTemplate($templateid, 'LOCALE', postVar('LOCALE'));
\r
3427 $this->addToTemplate($templateid, 'SEARCH_HIGHLIGHT', postVar('SEARCH_HIGHLIGHT'));
\r
3428 $this->addToTemplate($templateid, 'SEARCH_NOTHINGFOUND', postVar('SEARCH_NOTHINGFOUND'));
\r
3429 $this->addToTemplate($templateid, 'POPUP_CODE', postVar('POPUP_CODE'));
\r
3430 $this->addToTemplate($templateid, 'MEDIA_CODE', postVar('MEDIA_CODE'));
\r
3431 $this->addToTemplate($templateid, 'IMAGE_CODE', postVar('IMAGE_CODE'));
\r
3434 // jump back to template edit
\r
3435 $this->action_templateedit(_TEMPLATE_UPDATED);
\r
3439 function addToTemplate($id, $partname, $content) {
\r
3440 $partname = addslashes($partname);
\r
3441 $content = addslashes($content);
\r
3443 $id = intval($id);
\r
3445 // don't add empty parts:
\r
3446 if (!trim($content)) return -1;
\r
3448 $query = 'INSERT INTO '.sql_table('template')." (tdesc, tpartname, tcontent) "
\r
3449 . "VALUES ($id, '$partname', '$content')";
\r
3450 mysql_query($query) or die("Query error: " . mysql_error());
\r
3451 return mysql_insert_id();
\r
3454 function action_templatedelete() {
\r
3457 $member->isAdmin() or $this->disallow();
\r
3459 $templateid = intRequestVar('templateid');
\r
3460 // TODO: check if template can be deleted
\r
3462 $this->pagehead();
\r
3464 $name = TEMPLATE::getNameFromId($templateid);
\r
3465 $desc = TEMPLATE::getDesc($templateid);
\r
3468 <h2><?php echo _DELETE_CONFIRM?></h2>
\r
3471 <?php echo _CONFIRMTXT_TEMPLATE?><b><?php echo $name?></b> (<?php echo htmlspecialchars($desc) ?>)
\r
3474 <form method="post" action="index.php"><div>
\r
3475 <input type="hidden" name="action" value="templatedeleteconfirm" />
\r
3476 <input type="hidden" name="templateid" value="<?php echo $templateid ?>" />
\r
3477 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
\r
3480 $this->pagefoot();
\r
3483 function action_templatedeleteconfirm() {
\r
3484 global $member, $manager;
\r
3486 $templateid = intRequestVar('templateid');
\r
3488 $member->isAdmin() or $this->disallow();
\r
3490 $manager->notify('PreDeleteTemplate', array('templateid' => $templateid));
\r
3492 // 1. delete description
\r
3493 sql_query('DELETE FROM '.sql_table('template_desc').' WHERE tdnumber=' . $templateid);
\r
3495 // 2. delete parts
\r
3496 sql_query('DELETE FROM '.sql_table('template').' WHERE tdesc=' . $templateid);
\r
3498 $manager->notify('PostDeleteTemplate', array('templateid' => $templateid));
\r
3500 $this->action_templateoverview();
\r
3503 function action_templatenew() {
\r
3506 $member->isAdmin() or $this->disallow();
\r
3508 $name = postVar('name');
\r
3509 $desc = postVar('desc');
\r
3511 if (!isValidTemplateName($name))
\r
3512 $this->error(_ERROR_BADTEMPLATENAME);
\r
3514 if (TEMPLATE::exists($name))
\r
3515 $this->error(_ERROR_DUPTEMPLATENAME);
\r
3517 $newTemplateId = TEMPLATE::createNew($name, $desc);
\r
3519 $this->action_templateoverview();
\r
3522 function action_templateclone() {
\r
3525 $templateid = intRequestVar('templateid');
\r
3527 $member->isAdmin() or $this->disallow();
\r
3529 // 1. read old template
\r
3530 $name = TEMPLATE::getNameFromId($templateid);
\r
3531 $desc = TEMPLATE::getDesc($templateid);
\r
3533 // 2. create desc thing
\r
3534 $name = "cloned" . $name;
\r
3536 // if a template with that name already exists:
\r
3537 if (TEMPLATE::exists($name)) {
\r
3539 while (TEMPLATE::exists($name . $i))
\r
3544 $newid = TEMPLATE::createNew($name, $desc);
\r
3546 // 3. create clone
\r
3547 // go through parts of old template and add them to the new one
\r
3548 $res = sql_query('SELECT tpartname, tcontent FROM '.sql_table('template').' WHERE tdesc=' . $templateid);
\r
3549 while ($o = mysql_fetch_object($res)) {
\r
3550 $this->addToTemplate($newid, $o->tpartname, $o->tcontent);
\r
3553 $this->action_templateoverview();
\r
3556 function action_skinoverview() {
\r
3559 $member->isAdmin() or $this->disallow();
\r
3561 $this->pagehead();
\r
3563 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
\r
3565 echo '<h2>' . _SKIN_EDIT_TITLE . '</h2>';
\r
3567 echo '<h3>' . _SKIN_AVAILABLE_TITLE . '</h3>';
\r
3569 $query = 'SELECT * FROM '.sql_table('skin_desc').' ORDER BY sdname';
\r
3570 $template['content'] = 'skinlist';
\r
3571 $template['tabindex'] = 10;
\r
3572 showlist($query,'table',$template);
\r
3574 echo '<h3>' . _SKIN_NEW_TITLE . '</h3>';
\r
3577 <form method="post" action="index.php">
\r
3580 <input name="action" value="skinnew" type="hidden" />
\r
3582 <td><?php echo _SKIN_NAME?> <?php help('shortnames');?></td>
\r
3583 <td><input name="name" tabindex="10010" maxlength="20" size="20" /></td>
\r
3585 <td><?php echo _SKIN_DESC?></td>
\r
3586 <td><input name="desc" tabindex="10020" maxlength="200" size="50" /></td>
\r
3588 <td><?php echo _SKIN_CREATE?></td>
\r
3589 <td><input type="submit" tabindex="10030" value="<?php echo _SKIN_CREATE_BTN?>" onclick="return checkSubmit();" /></td>
\r
3596 $this->pagefoot();
\r
3599 function action_skinnew() {
\r
3602 $member->isAdmin() or $this->disallow();
\r
3604 $name = trim(postVar('name'));
\r
3605 $desc = trim(postVar('desc'));
\r
3607 if (!isValidSkinName($name))
\r
3608 $this->error(_ERROR_BADSKINNAME);
\r
3610 if (SKIN::exists($name))
\r
3611 $this->error(_ERROR_DUPSKINNAME);
\r
3613 $newId = SKIN::createNew($name, $desc);
\r
3615 $this->action_skinoverview();
\r
3618 function action_skinedit() {
\r
3621 $skinid = intRequestVar('skinid');
\r
3623 $member->isAdmin() or $this->disallow();
\r
3625 $skin = new SKIN($skinid);
\r
3627 $this->pagehead();
\r
3630 <a href="index.php?action=skinoverview">(<?php echo _SKIN_BACK?>)</a>
\r
3632 <h2><?php echo _SKIN_EDITONE_TITLE?> '<?php echo $skin->getName() ?>'</h2>
\r
3634 <h3><?php echo _SKIN_PARTS_TITLE?></h3>
\r
3635 <?php echo _SKIN_PARTS_MSG?>
\r
3637 <li><a tabindex="10" href="index.php?action=skinedittype&skinid=<?php echo $skinid ?>&type=index"><?php echo _SKIN_PART_MAIN?></a> <?php help('skinpartindex')?></li>
\r
3638 <li><a tabindex="20" href="index.php?action=skinedittype&skinid=<?php echo $skinid ?>&type=item"><?php echo _SKIN_PART_ITEM?></a> <?php help('skinpartitem')?></li>
\r
3639 <li><a tabindex="30" href="index.php?action=skinedittype&skinid=<?php echo $skinid ?>&type=archivelist"><?php echo _SKIN_PART_ALIST?></a> <?php help('skinpartarchivelist')?></li>
\r
3640 <li><a tabindex="40" href="index.php?action=skinedittype&skinid=<?php echo $skinid ?>&type=archive"><?php echo _SKIN_PART_ARCHIVE?></a> <?php help('skinpartarchive')?></li>
\r
3641 <li><a tabindex="50" href="index.php?action=skinedittype&skinid=<?php echo $skinid ?>&type=search"><?php echo _SKIN_PART_SEARCH?></a> <?php help('skinpartsearch')?></li>
\r
3642 <li><a tabindex="60" href="index.php?action=skinedittype&skinid=<?php echo $skinid ?>&type=error"><?php echo _SKIN_PART_ERROR?></a> <?php help('skinparterror')?></li>
\r
3643 <li><a tabindex="70" href="index.php?action=skinedittype&skinid=<?php echo $skinid ?>&type=member"><?php echo _SKIN_PART_MEMBER?></a> <?php help('skinpartmember')?></li>
\r
3644 <li><a tabindex="75" href="index.php?action=skinedittype&skinid=<?php echo $skinid ?>&type=imagepopup"><?php echo _SKIN_PART_POPUP?></a> <?php help('skinpartimagepopup')?></li>
\r
3647 <h3><?php echo _SKIN_GENSETTINGS_TITLE?></h3>
\r
3648 <form method="post" action="index.php">
\r
3651 <input type="hidden" name="action" value="skineditgeneral" />
\r
3652 <input type="hidden" name="skinid" value="<?php echo $skinid ?>" />
\r
3654 <td><?php echo _SKIN_NAME?> <?php help('shortnames');?></td>
\r
3655 <td><input name="name" tabindex="90" value="<?php echo htmlspecialchars($skin->getName()) ?>" maxlength="20" size="20" /></td>
\r
3657 <td><?php echo _SKIN_DESC?></td>
\r
3658 <td><input name="desc" tabindex="100" value="<?php echo htmlspecialchars($skin->getDescription()) ?>" maxlength="200" size="50" /></td>
\r
3660 <td><?php echo _SKIN_TYPE?></td>
\r
3661 <td><input name="type" tabindex="110" value="<?php echo htmlspecialchars($skin->getContentType()) ?>" maxlength="40" size="20" /></td>
\r
3663 <td><?php echo _SKIN_INCLUDE_MODE?> <?php help('includemode')?></td>
\r
3664 <td><?php $this->input_yesno('inc_mode',$skin->getIncludeMode(),120,'skindir','normal',_PARSER_INCMODE_SKINDIR,_PARSER_INCMODE_NORMAL);?></td>
\r
3666 <td><?php echo _SKIN_INCLUDE_PREFIX?> <?php help('includeprefix')?></td>
\r
3667 <td><input name="inc_prefix" tabindex="130" value="<?php echo htmlspecialchars($skin->getIncludePrefix()) ?>" maxlength="40" size="20" /></td>
\r
3669 <td><?php echo _SKIN_CHANGE?></td>
\r
3670 <td><input type="submit" tabindex="140" value="<?php echo _SKIN_CHANGE_BTN?>" onclick="return checkSubmit();" /></td>
\r
3677 <?php $this->pagefoot();
\r
3680 function action_skineditgeneral() {
\r
3683 $skinid = intRequestVar('skinid');
\r
3685 $member->isAdmin() or $this->disallow();
\r
3687 $name = postVar('name');
\r
3688 $desc = postVar('desc');
\r
3689 $type = postVar('type');
\r
3690 $inc_mode = postVar('inc_mode');
\r
3691 $inc_prefix = postVar('inc_prefix');
\r
3693 $skin = new SKIN($skinid);
\r
3696 if (!isValidSkinName($name))
\r
3697 $this->error(_ERROR_BADSKINNAME);
\r
3699 if (($skin->getName() != $name) && SKIN::exists($name))
\r
3700 $this->error(_ERROR_DUPSKINNAME);
\r
3702 if (!$type) $type = 'text/html';
\r
3703 if (!$inc_mode) $inc_mode = 'normal';
\r
3705 // 2. Update description
\r
3706 $skin->updateGeneralInfo($name, $desc, $type, $inc_mode, $inc_prefix);
\r
3708 $this->action_skinedit();
\r
3712 function action_skinedittype($msg = '') {
\r
3715 $skinid = intRequestVar('skinid');
\r
3716 $type = requestVar('type');
\r
3718 $member->isAdmin() or $this->disallow();
\r
3720 $skin = new SKIN($skinid);
\r
3722 $friendlyNames = SKIN::getFriendlyNames();
\r
3724 $this->pagehead();
\r
3726 <p>(<a href="index.php?action=skinoverview"><?php echo _SKIN_GOBACK?></a>)</p>
\r
3728 <h2><?php echo _SKIN_EDITPART_TITLE?> '<?php echo $skin->getName() ?>': <?php echo $friendlyNames[$type] ?></h2>
\r
3730 <?php if ($msg) echo "<p>"._MESSAGE.": $msg</p>";
\r
3734 <form method="post" action="index.php">
\r
3737 <input type="hidden" name="action" value="skinupdate" />
\r
3738 <input type="hidden" name="skinid" value="<?php echo $skinid ?>" />
\r
3739 <input type="hidden" name="type" value="<?php echo $type ?>" />
\r
3741 <input type="submit" value="<?php echo _SKIN_UPDATE_BTN?>" onclick="return checkSubmit();" />
\r
3742 <input type="reset" value="<?php echo _SKIN_RESET_BTN?>" />
\r
3743 (skin type: <?php echo $friendlyNames[$type] ?>)
\r
3744 <?php help('skinpart' . $type);?>
\r
3747 <textarea class="skinedit" tabindex="10" rows="20" cols="80" name="content"><?php echo htmlspecialchars($skin->getContent($type)) ?></textarea>
\r
3750 <input type="submit" tabindex="20" value="<?php echo _SKIN_UPDATE_BTN?>" onclick="return checkSubmit();" />
\r
3751 <input type="reset" value="<?php echo _SKIN_RESET_BTN?>" />
\r
3752 (skin type: <?php echo $friendlyNames[$type] ?>)
\r
3755 <?php echo _SKIN_ALLOWEDVARS?>
\r
3756 <?php $actions = SKIN::getAllowedActionsForType($type);
\r
3760 while ($current = array_shift($actions)) {
\r
3761 // skip deprecated vars
\r
3762 if ($current == 'ifcat') continue;
\r
3763 if ($current == 'imagetext') continue;
\r
3764 if ($current == 'vars') continue;
\r
3766 echo helplink('skinvar-' . $current) . "$current</a>";
\r
3767 if (count($actions) != 0) echo ", ";
\r
3772 <?php $query = 'SELECT bshortname, bname FROM '.sql_table('blog');
\r
3773 showlist($query,'table',array('content'=>'shortblognames'));
\r
3778 <?php $query = 'SELECT tdname as name, tddesc as description FROM '.sql_table('template_desc');
\r
3779 showlist($query,'table',array('content'=>'shortnames'));
\r
3787 <?php $this->pagefoot();
\r
3790 function action_skinupdate() {
\r
3793 $skinid = intRequestVar('skinid');
\r
3794 $content = trim(postVar('content'));
\r
3795 $type = postVar('type');
\r
3797 $member->isAdmin() or $this->disallow();
\r
3799 $skin = new SKIN($skinid);
\r
3800 $skin->update($type, $content);
\r
3802 $this->action_skinedittype(_SKIN_UPDATED);
\r
3805 function action_skindelete() {
\r
3806 global $member, $CONF;
\r
3808 $skinid = intRequestVar('skinid');
\r
3810 $member->isAdmin() or $this->disallow();
\r
3812 // don't allow default skin to be deleted
\r
3813 if ($skinid == $CONF['BaseSkin'])
\r
3814 $this->error(_ERROR_DEFAULTSKIN);
\r
3816 // don't allow deletion of default skins for blogs
\r
3817 $query = 'SELECT bname FROM '.sql_table('blog').' WHERE bdefskin=' . $skinid;
\r
3818 $r = sql_query($query);
\r
3819 if ($o = mysql_fetch_object($r))
\r
3820 $this->error(_ERROR_SKINDEFDELETE . $o->bname);
\r
3822 $this->pagehead();
\r
3824 $skin = new SKIN($skinid);
\r
3825 $name = $skin->getName();
\r
3826 $desc = $skin->getDescription();
\r
3829 <h2><?php echo _DELETE_CONFIRM?></h2>
\r
3832 <?php echo _CONFIRMTXT_SKIN?><b><?php echo $name ?></b> (<?php echo htmlspecialchars($desc)?>)
\r
3835 <form method="post" action="index.php"><div>
\r
3836 <input type="hidden" name="action" value="skindeleteconfirm" />
\r
3837 <input type="hidden" name="skinid" value="<?php echo $skinid ?>" />
\r
3838 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
\r
3841 $this->pagefoot();
\r
3844 function action_skindeleteconfirm() {
\r
3845 global $member, $CONF, $manager;
\r
3847 $skinid = intRequestVar('skinid');
\r
3849 $member->isAdmin() or $this->disallow();
\r
3851 // don't allow default skin to be deleted
\r
3852 if ($skinid == $CONF['BaseSkin'])
\r
3853 $this->error(_ERROR_DEFAULTSKIN);
\r
3855 // don't allow deletion of default skins for blogs
\r
3856 $query = 'SELECT bname FROM '.sql_table('blog').' WHERE bdefskin=' . $skinid;
\r
3857 $r = sql_query($query);
\r
3858 if ($o = mysql_fetch_object($r))
\r
3859 $this->error(_ERROR_SKINDEFDELETE .$o->bname);
\r
3861 $manager->notify('PreDeleteSkin', array('skinid' => $skinid));
\r
3863 // 1. delete description
\r
3864 sql_query('DELETE FROM '.sql_table('skin_desc').' WHERE sdnumber=' . $skinid);
\r
3866 // 2. delete parts
\r
3867 sql_query('DELETE FROM '.sql_table('skin').' WHERE sdesc=' . $skinid);
\r
3869 $manager->notify('PostDeleteSkin', array('skinid' => $skinid));
\r
3871 $this->action_skinoverview();
\r
3874 function action_skinclone() {
\r
3877 $skinid = intRequestVar('skinid');
\r
3879 $member->isAdmin() or $this->disallow();
\r
3881 // 1. read skin to clone
\r
3882 $skin = new SKIN($skinid);
\r
3884 $name = "clone_" . $skin->getName();
\r
3886 // if a skin with that name already exists:
\r
3887 if (SKIN::exists($name)) {
\r
3889 while (SKIN::exists($name . $i))
\r
3894 // 2. create skin desc
\r
3895 $newid = SKIN::createNew(
\r
3897 $skin->getDescription(),
\r
3898 $skin->getContentType(),
\r
3899 $skin->getIncludeMode(),
\r
3900 $skin->getIncludePrefix()
\r
3905 $this->skinclonetype($skin, $newid, 'index');
\r
3906 $this->skinclonetype($skin, $newid, 'item');
\r
3907 $this->skinclonetype($skin, $newid, 'archivelist');
\r
3908 $this->skinclonetype($skin, $newid, 'archive');
\r
3909 $this->skinclonetype($skin, $newid, 'search');
\r
3910 $this->skinclonetype($skin, $newid, 'error');
\r
3911 $this->skinclonetype($skin, $newid, 'member');
\r
3912 $this->skinclonetype($skin, $newid, 'imagepopup');
\r
3914 $this->action_skinoverview();
\r
3918 function skinclonetype($skin, $newid, $type) {
\r
3919 $newid = intval($newid);
\r
3920 $content = $skin->getContent($type);
\r
3922 $query = 'INSERT INTO '.sql_table('skin')." (sdesc, scontent, stype) VALUES ($newid,'". addslashes($content)."', '". addslashes($type)."')";
\r
3923 sql_query($query);
\r
3927 function action_settingsedit() {
\r
3928 global $member, $manager, $CONF, $DIR_NUCLEUS, $DIR_MEDIA;
\r
3930 $member->isAdmin() or $this->disallow();
\r
3932 $this->pagehead();
\r
3934 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
\r
3937 <h2><?php echo _SETTINGS_TITLE?></h2>
\r
3939 <form action="index.php" method="post">
\r
3942 <input type="hidden" name="action" value="settingsupdate" />
\r
3945 <th colspan="2"><?php echo _SETTINGS_SUB_GENERAL?></th>
\r
3947 <td><?php echo _SETTINGS_DEFBLOG?> <?php help('defaultblog'); ?></td>
\r
3950 $query = 'SELECT bname as text, bnumber as value'
\r
3951 . ' FROM '.sql_table('blog');
\r
3952 $template['name'] = 'DefaultBlog';
\r
3953 $template['selected'] = $CONF['DefaultBlog'];
\r
3954 $template['tabindex'] = 10;
\r
3955 showlist($query,'select',$template);
\r
3959 <td><?php echo _SETTINGS_BASESKIN?> <?php help('baseskin'); ?></td>
\r
3962 $query = 'SELECT sdname as text, sdnumber as value'
\r
3963 . ' FROM '.sql_table('skin_desc');
\r
3964 $template['name'] = 'BaseSkin';
\r
3965 $template['selected'] = $CONF['BaseSkin'];
\r
3966 $template['tabindex'] = 1;
\r
3967 showlist($query,'select',$template);
\r
3971 <td><?php echo _SETTINGS_ADMINMAIL?></td>
\r
3972 <td><input name="AdminEmail" tabindex="10010" size="40" value="<?php echo htmlspecialchars($CONF['AdminEmail']) ?>" /></td>
\r
3974 <td><?php echo _SETTINGS_SITENAME?></td>
\r
3975 <td><input name="SiteName" tabindex="10020" size="40" value="<?php echo htmlspecialchars($CONF['SiteName']) ?>" /></td>
\r
3977 <td><?php echo _SETTINGS_SITEURL?></td>
\r
3978 <td><input name="IndexURL" tabindex="10030" size="40" value="<?php echo htmlspecialchars($CONF['IndexURL']) ?>" /></td>
\r
3980 <td><?php echo _SETTINGS_ADMINURL?></td>
\r
3981 <td><input name="AdminURL" tabindex="10040" size="40" value="<?php echo htmlspecialchars($CONF['AdminURL']) ?>" /></td>
\r
3983 <td><?php echo _SETTINGS_PLUGINURL?> <?php help('pluginurl');?></td>
\r
3984 <td><input name="PluginURL" tabindex="10045" size="40" value="<?php echo htmlspecialchars($CONF['PluginURL']) ?>" /></td>
\r
3986 <td><?php echo _SETTINGS_SKINSURL?> <?php help('skinsurl');?></td>
\r
3987 <td><input name="SkinsURL" tabindex="10046" size="40" value="<?php echo htmlspecialchars($CONF['SkinsURL']) ?>" /></td>
\r
3989 <td><?php echo _SETTINGS_ACTIONSURL?> <?php help('actionurl');?></td>
\r
3990 <td><input name="ActionURL" tabindex="10047" size="40" value="<?php echo htmlspecialchars($CONF['ActionURL']) ?>" /></td>
\r
3992 <td><?php echo _SETTINGS_LANGUAGE?> <?php help('language'); ?>
\r
3996 <select name="Language" tabindex="10050">
\r
3997 <?php // show a dropdown list of all available languages
\r
3999 $dirhandle = opendir($DIR_LANG);
\r
4000 while ($filename = readdir($dirhandle)) {
\r
4001 if (ereg("^(.*)\.php$",$filename,$matches)) {
\r
4002 $name = $matches[1];
\r
4003 echo "<option value='$name'";
\r
4004 if ($name == $CONF['Language'])
\r
4005 echo " selected='selected'";
\r
4006 echo ">$name</option>";
\r
4009 closedir($dirhandle);
\r
4016 <td><?php echo _SETTINGS_DISABLESITE?> <?php help('disablesite'); ?>
\r
4018 <td><?php $this->input_yesno('DisableSite',$CONF['DisableSite'],10060); ?>
\r
4020 URL: <input name="DisableSiteURL" tabindex="10070" size="40" value="<?php echo htmlspecialchars($CONF['DisableSiteURL'])?>" />
\r
4023 <td><?php echo _SETTINGS_DIRS?></td>
\r
4024 <td><?php echo htmlspecialchars($DIR_NUCLEUS) ?>
\r
4025 <i><?php echo _SETTINGS_SEECONFIGPHP?></i></td>
\r
4027 <td><?php echo _SETTINGS_DBLOGIN?></td>
\r
4028 <td><i><?php echo _SETTINGS_SEECONFIGPHP?></i></td>
\r
4031 <?php echo _SETTINGS_JSTOOLBAR;
\r
4032 /* =_SETTINGS_DISABLEJS
\r
4036 I temporary changed the meaning of DisableJsTools, until I can find a good
\r
4037 way to select the javascript version to use
\r
4041 1 : all javascript disabled
\r
4042 2 : 'simpler' javascript (for mozilla/opera/mac)
\r
4046 <td><?php /* $this->input_yesno('DisableJsTools',$CONF['DisableJsTools'],10075); */?>
\r
4047 <select name="DisableJsTools" tabindex="10075">
\r
4048 <?php $extra = ($CONF['DisableJsTools'] == 1) ? 'selected="selected"' : '';
\r
4049 echo "<option $extra value='1'>",_SETTINGS_JSTOOLBAR_NONE,"</option>";
\r
4050 $extra = ($CONF['DisableJsTools'] == 2) ? 'selected="selected"' : '';
\r
4051 echo "<option $extra value='2'>",_SETTINGS_JSTOOLBAR_SIMPLE,"</option>";
\r
4052 $extra = ($CONF['DisableJsTools'] == 0) ? 'selected="selected"' : '';
\r
4053 echo "<option $extra value='0'>",_SETTINGS_JSTOOLBAR_FULL,"</option>";
\r
4058 <td><?php echo _SETTINGS_URLMODE?> <?php help('urlmode');?></td>
\r
4059 <td><?php $this->input_yesno('URLMode',$CONF['URLMode'],10077,
\r
4060 'normal','pathinfo',_SETTINGS_URLMODE_NORMAL,_SETTINGS_URLMODE_PATHINFO);
\r
4062 echo ' ', _SETTINGS_URLMODE_HELP;
\r
4067 <th colspan="2"><?php echo _SETTINGS_MEDIA?> <?php help('media'); ?></th>
\r
4069 <td><?php echo _SETTINGS_MEDIADIR?></td>
\r
4070 <td><?php echo htmlspecialchars($DIR_MEDIA) ?>
\r
4071 <i><?php echo _SETTINGS_SEECONFIGPHP?></i>
\r
4072 <?php if (!is_dir($DIR_MEDIA))
\r
4073 echo "<br /><b>" . _WARNING_NOTADIR . "</b>";
\r
4074 if (!is_readable($DIR_MEDIA))
\r
4075 echo "<br /><b>" . _WARNING_NOTREADABLE . "</b>";
\r
4076 if (!is_writeable($DIR_MEDIA))
\r
4077 echo "<br /><b>" . _WARNING_NOTWRITABLE . "</b>";
\r
4081 <td><?php echo _SETTINGS_MEDIAURL?></td>
\r
4083 <input name="MediaURL" tabindex="10080" size="40" value="<?php echo htmlspecialchars($CONF['MediaURL']) ?>" />
\r
4086 <td><?php echo _SETTINGS_ALLOWUPLOAD?></td>
\r
4087 <td><?php $this->input_yesno('AllowUpload',$CONF['AllowUpload'],10090); ?></td>
\r
4089 <td><?php echo _SETTINGS_ALLOWUPLOADTYPES?></td>
\r
4091 <input name="AllowedTypes" tabindex="10100" size="40" value="<?php echo htmlspecialchars($CONF['AllowedTypes']) ?>" />
\r
4094 <td><?php echo _SETTINGS_MAXUPLOADSIZE?></td>
\r
4096 <input name="MaxUploadSize" tabindex="10105" size="40" value="<?php echo htmlspecialchars($CONF['MaxUploadSize']) ?>" />
\r
4099 <td><?php echo _SETTINGS_MEDIAPREFIX?></td>
\r
4100 <td><?php $this->input_yesno('MediaPrefix',$CONF['MediaPrefix'],10110); ?></td>
\r
4103 <th colspan="2"><?php echo _SETTINGS_MEMBERS?></th>
\r
4105 <td><?php echo _SETTINGS_CHANGELOGIN?></td>
\r
4106 <td><?php $this->input_yesno('AllowLoginEdit',$CONF['AllowLoginEdit'],10120); ?></td>
\r
4108 <td><?php echo _SETTINGS_ALLOWCREATE?>
\r
4109 <?php help('allowaccountcreation'); ?>
\r
4111 <td><?php $this->input_yesno('AllowMemberCreate',$CONF['AllowMemberCreate'],10130); ?>
\r
4114 <td><?php echo _SETTINGS_NEWLOGIN?> <?php help('allownewmemberlogin'); ?>
\r
4115 <br /><?php echo _SETTINGS_NEWLOGIN2?>
\r
4117 <td><?php $this->input_yesno('NewMemberCanLogon',$CONF['NewMemberCanLogon'],10140); ?>
\r
4120 <td><?php echo _SETTINGS_MEMBERMSGS?>
\r
4121 <?php help('messageservice'); ?>
\r
4123 <td><?php $this->input_yesno('AllowMemberMail',$CONF['AllowMemberMail'],10150); ?>
\r
4126 <td><?php echo _SETTINGS_NONMEMBERMSGS?>
\r
4127 <?php help('messageservice'); ?>
\r
4129 <td><?php $this->input_yesno('NonmemberMail',$CONF['NonmemberMail'],10155); ?>
\r
4132 <td><?php echo _SETTINGS_PROTECTMEMNAMES?>
\r
4133 <?php help('protectmemnames'); ?>
\r
4135 <td><?php $this->input_yesno('ProtectMemNames',$CONF['ProtectMemNames'],10156); ?>
\r
4141 <th colspan="2"><?php echo _SETTINGS_COOKIES_TITLE?> <?php help('cookies'); ?></th>
\r
4143 <td><?php echo _SETTINGS_COOKIEDOMAIN?></td>
\r
4144 <td><input name="CookieDomain" tabindex="10160" size="40" value="<?php echo htmlspecialchars($CONF['CookieDomain'])?>" /></td>
\r
4146 <td><?php echo _SETTINGS_COOKIEPATH?></td>
\r
4147 <td><input name="CookiePath" tabindex="10170" size="40" value="<?php echo htmlspecialchars($CONF['CookiePath'])?>" /></td>
\r
4149 <td><?php echo _SETTINGS_COOKIESECURE?></td>
\r
4150 <td><?php $this->input_yesno('CookieSecure',$CONF['CookieSecure'],10180); ?></td>
\r
4152 <td><?php echo _SETTINGS_COOKIELIFE?></td>
\r
4153 <td><?php $this->input_yesno('SessionCookie',$CONF['SessionCookie'],10190,
\r
4154 1,0,_SETTINGS_COOKIESESSION,_SETTINGS_COOKIEMONTH); ?>
\r
4157 <td><?php echo _SETTINGS_LASTVISIT?></td>
\r
4158 <td><?php $this->input_yesno('LastVisit',$CONF['LastVisit'],10200); ?></td>
\r
4163 <th colspan="2"><?php echo _SETTINGS_UPDATE?></th>
\r
4165 <td><?php echo _SETTINGS_UPDATE?></td>
\r
4166 <td><input type="submit" tabindex="10210" value="<?php echo _SETTINGS_UPDATE_BTN?>" onclick="return checkSubmit();" /></td>
\r
4173 echo '<h2>',_PLUGINS_EXTRA,'</h2>';
\r
4176 'GeneralSettingsFormExtras',
\r
4180 $this->pagefoot();
\r
4183 function action_settingsupdate() {
\r
4184 global $member, $CONF;
\r
4186 $member->isAdmin() or $this->disallow();
\r
4188 // check if email address for admin is valid
\r
4189 if (!isValidMailAddress(postVar('AdminEmail')))
\r
4190 $this->error(_ERROR_BADMAILADDRESS);
\r
4194 $this->updateConfig('DefaultBlog', postVar('DefaultBlog'));
\r
4195 $this->updateConfig('BaseSkin', postVar('BaseSkin'));
\r
4196 $this->updateConfig('IndexURL', postVar('IndexURL'));
\r
4197 $this->updateConfig('AdminURL', postVar('AdminURL'));
\r
4198 $this->updateConfig('PluginURL', postVar('PluginURL'));
\r
4199 $this->updateConfig('SkinsURL', postVar('SkinsURL'));
\r
4200 $this->updateConfig('ActionURL', postVar('ActionURL'));
\r
4201 $this->updateConfig('Language', postVar('Language'));
\r
4202 $this->updateConfig('AdminEmail', postVar('AdminEmail'));
\r
4203 $this->updateConfig('SessionCookie', postVar('SessionCookie'));
\r
4204 $this->updateConfig('AllowMemberCreate',postVar('AllowMemberCreate'));
\r
4205 $this->updateConfig('AllowMemberMail', postVar('AllowMemberMail'));
\r
4206 $this->updateConfig('NonmemberMail', postVar('NonmemberMail'));
\r
4207 $this->updateConfig('ProtectMemNames', postVar('ProtectMemNames'));
\r
4208 $this->updateConfig('SiteName', postVar('SiteName'));
\r
4209 $this->updateConfig('NewMemberCanLogon',postVar('NewMemberCanLogon'));
\r
4210 $this->updateConfig('DisableSite', postVar('DisableSite'));
\r
4211 $this->updateConfig('DisableSiteURL', postVar('DisableSiteURL'));
\r
4212 $this->updateConfig('LastVisit', postVar('LastVisit'));
\r
4213 $this->updateConfig('MediaURL', postVar('MediaURL'));
\r
4214 $this->updateConfig('AllowedTypes', postVar('AllowedTypes'));
\r
4215 $this->updateConfig('AllowUpload', postVar('AllowUpload'));
\r
4216 $this->updateConfig('MaxUploadSize', postVar('MaxUploadSize'));
\r
4217 $this->updateConfig('MediaPrefix', postVar('MediaPrefix'));
\r
4218 $this->updateConfig('AllowLoginEdit', postVar('AllowLoginEdit'));
\r
4219 $this->updateConfig('DisableJsTools', postVar('DisableJsTools'));
\r
4220 $this->updateConfig('CookieDomain', postVar('CookieDomain'));
\r
4221 $this->updateConfig('CookiePath', postVar('CookiePath'));
\r
4222 $this->updateConfig('CookieSecure', postVar('CookieSecure'));
\r
4223 $this->updateConfig('URLMode', postVar('URLMode'));
\r
4225 // load new config and redirect (this way, the new language will be used is necessary)
\r
4226 // note that when changing cookie settings, this redirect might cause the user
\r
4227 // to have to log in again.
\r
4229 redirect($CONF['AdminURL'] . '?action=manage');
\r
4235 function updateConfig($name, $val) {
\r
4236 $name = addslashes($name);
\r
4237 $val = trim(addslashes($val));
\r
4239 $query = 'UPDATE '.sql_table('config')
\r
4240 . " SET value='$val'"
\r
4241 . " WHERE name='$name'";
\r
4243 mysql_query($query) or die("Query error: " . mysql_error());
\r
4244 return mysql_insert_id();
\r
4250 function error($msg) {
\r
4251 $this->pagehead();
\r
4256 echo "<a href='index.php' onclick='history.back()'>"._BACK."</a>";
\r
4257 $this->pagefoot();
\r
4261 function disallow() {
\r
4262 ACTIONLOG::add(WARNING, _ACTIONLOG_DISALLOWED . serverVar('REQUEST_URI'));
\r
4264 $this->error(_ERROR_DISALLOWED);
\r
4268 function pagehead($extrahead = '') {
\r
4269 global $member, $nucleus, $CONF, $manager;
\r
4272 'AdminPrePageHead',
\r
4274 'extrahead' => &$extrahead,
\r
4275 'action' => $this->action
\r
4279 $baseUrl = htmlspecialchars($CONF['AdminURL']);
\r
4282 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
\r
4283 <html xmlns="http://www.w3.org/1999/xhtml">
\r
4285 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo _CHARSET ?>" />
\r
4286 <title><?php echo htmlspecialchars($CONF['SiteName'])?> - Admin</title>
\r
4287 <link rel="stylesheet" title="Nucleus Admin Default" type="text/css" href="<?php echo $baseUrl?>styles/admin.css" />
\r
4288 <link rel="stylesheet" title="Nucleus Admin Default" type="text/css"
\r
4289 href="<?php echo $baseUrl?>styles/addedit.css" />
\r
4291 <script type="text/javascript" src="<?php echo $baseUrl?>javascript/edit.js"></script>
\r
4292 <script type="text/javascript" src="<?php echo $baseUrl?>javascript/admin.js"></script>
\r
4293 <script type="text/javascript" src="<?php echo $baseUrl?>javascript/compatibility.js"></script>
\r
4295 <meta http-equiv='Pragma' content='no-cache' />
\r
4296 <meta http-equiv='Cache-Control' content='no-cache, must-revalidate' />
\r
4297 <meta http-equiv='Expires' content='-1' />
\r
4299 <?php echo $extrahead?>
\r
4302 <div class="header">
\r
4303 <h1><?php echo htmlspecialchars($CONF['SiteName'])?></h1>
\r
4305 <div id="container">
\r
4306 <div id="content">
\r
4307 <div class="loginname">
\r
4308 <?php if ($member->isLoggedIn())
\r
4309 echo _LOGGEDINAS . ' ' . $member->getDisplayName()
\r
4310 ." - <a href='index.php?action=logout'>" . _LOGOUT. "</a>"
\r
4311 . "<br /><a href='index.php?action=overview'>" . _ADMINHOME . "</a> - ";
\r
4313 echo _NOTLOGGEDIN . ' <br />';
\r
4315 echo "<a href='".$CONF['IndexURL']."'>"._YOURSITE."</a>";
\r
4319 if ($member->isLoggedIn() && $member->isAdmin())
\r
4320 echo '<a href="http://nucleuscms.org/version.php?v=',getNucleusVersion(),'&pl=',getNucleusPatchLevel(),'" title="Check for upgrade">Nucleus ', $nucleus['version'], '</a>';
\r
4322 echo 'Nucleus ' , $nucleus['version'];
\r
4327 function pagefoot() {
\r
4328 global $action, $member, $manager;
\r
4331 'AdminPrePageFoot',
\r
4333 'action' => $this->action
\r
4337 if ($action != 'showlogin') {
\r
4339 <h2><?php echo _LOGOUT ?></h2>
\r
4341 <li><a href="index.php?action=overview"><?php echo _BACKHOME?></a></li>
\r
4342 <li><a href='index.php?action=logout'><?php echo _LOGOUT?></a></li>
\r
4346 <div class="foot">
\r
4347 <a href="http://nucleuscms.org/">Nucleus</a> © 2002-2004 The Nucleus Group
\r
4349 <a href="http://nucleuscms.org/donate.php">Donate!</a>
\r
4352 </div><!-- content -->
\r
4354 <div id="quickmenu">
\r
4356 <?php // ---- user settings ----
\r
4357 if (($action != 'showlogin') && ($member->isLoggedIn())) {
\r
4359 echo '<li><a href="index.php?action=overview">',_QMENU_HOME,'</a></li>';
\r
4362 echo '<h2>',_QMENU_ADD,'</h2>';
\r
4363 echo '<form method="get" action="index.php"><div>';
\r
4364 echo '<input type="hidden" name="action" value="createitem" />';
\r
4366 $showAll = requestVar('showall');
\r
4367 if (($member->isAdmin()) && ($showAll == 'yes')) {
\r
4368 // Super-Admins have access to all blogs! (no add item support though)
\r
4369 $query = 'SELECT bnumber as value, bname as text'
\r
4370 . ' FROM ' . sql_table('blog')
\r
4371 . ' ORDER BY bname';
\r
4373 $query = 'SELECT bnumber as value, bname as text'
\r
4374 . ' FROM ' . sql_table('blog') . ', ' . sql_table('team')
\r
4375 . ' WHERE tblog=bnumber and tmember=' . $member->getID()
\r
4376 . ' ORDER BY bname';
\r
4378 $template['name'] = 'blogid';
\r
4379 $template['tabindex'] = 15000;
\r
4380 $template['extra'] = _QMENU_ADD_SELECT;
\r
4381 $template['selected'] = -1;
\r
4382 $template['shorten'] = 10;
\r
4383 $template['shortenel'] = '';
\r
4384 $template['javascript'] = 'onchange="return form.submit()"';
\r
4385 showlist($query,'select',$template);
\r
4387 echo '</div></form>';
\r
4389 echo '<h2>' . $member->getDisplayName(). '</h2>';
\r
4391 echo '<li><a href="index.php?action=editmembersettings">',_QMENU_USER_SETTINGS,'</a></li>';
\r
4392 echo '<li><a href="index.php?action=browseownitems">',_QMENU_USER_ITEMS,'</a></li>';
\r
4393 echo '<li><a href="index.php?action=browseowncomments">',_QMENU_USER_COMMENTS,'</a></li>';
\r
4399 // ---- general settings ----
\r
4400 if ($member->isAdmin()) {
\r
4402 echo '<h2>',_QMENU_MANAGE,'</h2>';
\r
4405 echo '<li><a href="index.php?action=actionlog">',_QMENU_MANAGE_LOG,'</a></li>';
\r
4406 echo '<li><a href="index.php?action=settingsedit">',_QMENU_MANAGE_SETTINGS,'</a></li>';
\r
4407 echo '<li><a href="index.php?action=usermanagement">',_QMENU_MANAGE_MEMBERS,'</a></li>';
\r
4408 echo '<li><a href="index.php?action=createnewlog">',_QMENU_MANAGE_NEWBLOG,'</a></li>';
\r
4409 echo '<li><a href="index.php?action=backupoverview">',_QMENU_MANAGE_BACKUPS,'</a></li>';
\r
4410 echo '<li><a href="index.php?action=pluginlist">',_QMENU_MANAGE_PLUGINS,'</a></li>';
\r
4413 echo '<h2>',_QMENU_LAYOUT,'</h2>';
\r
4415 echo '<li><a href="index.php?action=skinoverview">',_QMENU_LAYOUT_SKINS,'</a></li>';
\r
4416 echo '<li><a href="index.php?action=templateoverview">',_QMENU_LAYOUT_TEMPL,'</a></li>';
\r
4417 echo '<li><a href="index.php?action=skinieoverview">',_QMENU_LAYOUT_IEXPORT,'</a></li>';
\r
4422 $aPluginExtras = array();
\r
4426 'options' => &$aPluginExtras
\r
4429 if (count($aPluginExtras) > 0)
\r
4431 echo '<h2>', _QMENU_PLUGINS, '</h2>';
\r
4433 foreach ($aPluginExtras as $aInfo)
\r
4435 echo '<li><a href="'.htmlspecialchars($aInfo['url']).'" title="'.htmlspecialchars($aInfo['tooltip']).'">'.htmlspecialchars($aInfo['title']).'</a></li>';
\r
4442 echo '<h2>', _QMENU_INTRO, '</h2>', _QMENU_INTRO_TEXT;
\r
4448 <!-- content / quickmenu container -->
\r
4457 function action_regfile() {
\r
4458 global $member, $CONF;
\r
4460 $blogid = intRequestVar('blogid');
\r
4462 $member->teamRights($blogid) or $this->disallow();
\r
4464 // header-code stolen from phpMyAdmin
\r
4465 // REGEDIT and bookmarklet code stolen from GreyMatter
\r
4467 $sjisBlogName = getBlogNameFromID($blogid);
\r
4468 $sjisBlogName = mb_convert_encoding($sjisBlogName, "SJIS", "auto");
\r
4470 header('Content-Type: application/octetstream');
\r
4471 header('Content-Disposition: filename="nucleus.reg"');
\r
4472 header('Pragma: no-cache');
\r
4473 header('Expires: 0');
\r
4475 echo "REGEDIT4\n";
\r
4476 echo "[HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\MenuExt\\Post To &Nucleus (".$sjisBlogName.")]\n";
\r
4477 echo '@="' . $CONF['AdminURL'] . "bookmarklet.php?action=contextmenucode&blogid=".intval($blogid)."\"\n";
\r
4478 echo '"contexts"=hex:31';
\r
4481 function action_bookmarklet() {
\r
4482 global $member, $manager;
\r
4484 $blogid = intRequestVar('blogid');
\r
4486 $member->teamRights($blogid) or $this->disallow();
\r
4488 $blog =& $manager->getBlog($blogid);
\r
4489 $bm = getBookmarklet($blogid);
\r
4491 $this->pagehead();
\r
4493 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
\r
4497 <h2>Bookmarklet<!-- and Right Click Menu --></h2>
\r
4500 Bookmarklet とは、クリック1回で記事の投稿ができるシステムです。 この Bookmarklet をインストールすると、ブラウザのツールバーの'add to weblog'ボタンが利用可能となり、Nucleusの新規アイテムの追加ウィンドウがポップアップします。任意のWebページを開いた状態でこのボタンを押せば、そのWebページのタイトルと、そのページへのリンクタグがすでに埋め込まれた状態でアイテム追加ウィンドウが開き、さらに、そのページ内に引用したい文を選択した状態であればその引用文も自動的に引用します。
\r
4503 <h3>Bookmarklet</h3>
\r
4505 下のリンク部分を「お気に入り」もしくはツールバーにドラッグできます。<small>(その前にテストしてみたい場合は単純に下のリンクをクリックしてみてください)</small>
\r
4508 <a href="<?php echo htmlspecialchars($bm)?>">Add to <?php echo $blog->getShortName()?></a> (ほとんどのブラウザで動作します)
\r
4511 <h3>右クリックメニューにインストール (WindowsでIE使用時)</h3>
\r
4513 あるいは<a href="index.php?action=regfile&blogid=<?php echo $blogid?>">右クリックメニュー</a>にインストールすることもできます (「開く」を選択すれば直接レジストリに登録します)
\r
4517 このインストールした右クリックメニューを表示するためにはIEの再起動が必要です
\r
4522 「お気に入り」もしくはツールバーから消すには、単に削除するだけです。
\r
4526 右クリックメニューから消したい時は、以下の手順を踏んでください:
\r
4530 <li>スタートメニューから「ファイルを指定して実行...」を選択</li>
\r
4531 <li>"regedit" と入力</li>
\r
4532 <li>"OK" ボタンを押す</li>
\r
4533 <li>"\HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt" をツリーの中から検索</li>
\r
4534 <li>"add to weblog" エントリを削除</li>
\r
4538 $this->pagefoot();
\r
4543 function action_actionlog() {
\r
4546 $member->isAdmin() or $this->disallow();
\r
4548 $this->pagehead();
\r
4550 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
\r
4553 <h2><?php echo _ACTIONLOG_CLEAR_TITLE?></h2>
\r
4554 <p><a href="index.php?action=clearactionlog"><?php echo _ACTIONLOG_CLEAR_TEXT?></a></p>
\r
4556 echo '<h2>' . _ACTIONLOG_TITLE . '</h2>';
\r
4558 $query = 'SELECT * FROM '.sql_table('actionlog').' ORDER BY timestamp DESC';
\r
4559 $template['content'] = 'actionlist';
\r
4560 $amount = showlist($query,'table',$template);
\r
4562 $this->pagefoot();
\r
4567 function action_banlist() {
\r
4568 global $member, $manager;
\r
4570 $blogid = intRequestVar('blogid');
\r
4572 $member->blogAdminRights($blogid) or $this->disallow();
\r
4574 $blog =& $manager->getBlog($blogid);
\r
4576 $this->pagehead();
\r
4578 echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
\r
4580 echo '<h2>' . _BAN_TITLE . " '". $this->bloglink($blog) ."'</h2>";
\r
4582 $query = 'SELECT * FROM '.sql_table('ban').' WHERE blogid='.$blogid.' ORDER BY iprange';
\r
4583 $template['content'] = 'banlist';
\r
4584 $amount = showlist($query,'table',$template);
\r
4589 echo '<h2>'._BAN_NEW_TITLE.'</h2>';
\r
4590 echo "<p><a href='index.php?action=banlistnew&blogid=$blogid'>"._BAN_NEW_TEXT."</a></p>";
\r
4593 $this->pagefoot();
\r
4598 function action_banlistdelete() {
\r
4599 global $member, $manager;
\r
4601 $blogid = intRequestVar('blogid');
\r
4602 $iprange = requestVar('iprange');
\r
4604 $member->blogAdminRights($blogid) or $this->disallow();
\r
4606 $blog =& $manager->getBlog($blogid);
\r
4608 $this->pagehead();
\r
4610 <h2><?php echo _BAN_REMOVE_TITLE?></h2>
\r
4612 <form method="post" action="index.php">
\r
4614 <h3><?php echo _BAN_IPRANGE?></h3>
\r
4617 <?php echo _CONFIRMTXT_BAN?> <?php echo htmlspecialchars($iprange) ?>
\r
4618 <input name="iprange" type="hidden" value="<?php echo htmlspecialchars($iprange)?>" />
\r
4621 <h3><?php echo _BAN_BLOGS?></h3>
\r
4624 <input type="hidden" name="blogid" value="<?php echo $blogid?>" />
\r
4625 <input name="allblogs" type="radio" value="0" id="allblogs_one" /><label for="allblogs_one">Only blog '<?php echo htmlspecialchars($blog->getName())?>'</label>
\r
4627 <input name="allblogs" type="radio" value="1" checked="checked" id="allblogs_all" /><label for="allblogs_all"><?php echo _BAN_ALLBLOGS?></label>
\r
4630 <h3><?php echo _BAN_DELETE_TITLE?></h3>
\r
4633 <input type="hidden" name="action" value="banlistdeleteconfirm" />
\r
4634 <input type="submit" value="<?php echo _DELETE_CONFIRM_BTN?>" />
\r
4639 $this->pagefoot();
\r
4642 function action_banlistdeleteconfirm() {
\r
4643 global $member, $manager;
\r
4645 $blogid = intPostVar('blogid');
\r
4646 $allblogs = postVar('allblogs');
\r
4647 $iprange = postVar('iprange');
\r
4649 $member->blogAdminRights($blogid) or $this->disallow();
\r
4651 $deleted = array();
\r
4654 if (BAN::removeBan($blogid, $iprange))
\r
4655 array_push($deleted, $blogid);
\r
4657 // get blogs fot which member has admin rights
\r
4658 $adminblogs = $member->getAdminBlogs();
\r
4659 foreach ($adminblogs as $blogje) {
\r
4660 if (BAN::removeBan($blogje, $iprange))
\r
4661 array_push($deleted, $blogje);
\r
4665 if (sizeof($deleted) == 0)
\r
4666 $this->error(_ERROR_DELETEBAN);
\r
4668 $this->pagehead();
\r
4670 echo '<a href="index.php?action=banlist&blogid=',$blogid,'">(',_BACK,')</a>';
\r
4671 echo '<h2>'._BAN_REMOVED_TITLE.'</h2>';
\r
4672 echo "<p>"._BAN_REMOVED_TEXT."</p>";
\r
4675 foreach ($deleted as $delblog) {
\r
4676 $b =& $manager->getBlog($delblog);
\r
4677 echo "<li>" . htmlspecialchars($b->getName()). "</li>";
\r
4681 $this->pagefoot();
\r
4685 function action_banlistnewfromitem() {
\r
4686 $this->action_banlistnew(getBlogIDFromItemID(intRequestVar('itemid')));
\r
4689 function action_banlistnew($blogid = '') {
\r
4690 global $member, $manager;
\r
4692 if ($blogid == '')
\r
4693 $blogid = intRequestVar('blogid');
\r
4695 $ip = requestVar('ip');
\r
4697 $member->blogAdminRights($blogid) or $this->disallow();
\r
4699 $blog =& $manager->getBlog($blogid);
\r
4701 $this->pagehead();
\r
4703 <h2><?php echo _BAN_ADD_TITLE?></h2>
\r
4706 <form method="post" action="index.php">
\r
4708 <h3><?php echo _BAN_IPRANGE?></h3>
\r
4710 <p><?php echo _BAN_IPRANGE_TEXT?></p>
\r
4712 <div class="note">
\r
4713 <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.
\r
4719 <input name="iprange" type="radio" value="<?php echo htmlspecialchars($ip)?>" checked="checked" id="ip_fixed" /><label for="ip_fixed"><?php echo htmlspecialchars($ip)?></label>
\r
4721 <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' />
\r
4723 echo "<input name='iprange' value='custom' type='hidden' />";
\r
4724 echo "<input name='customiprange' value='' maxlength='15' size='15' />";
\r
4729 <h3><?php echo _BAN_BLOGS?></h3>
\r
4731 <p><?php echo _BAN_BLOGS_TEXT?></p>
\r
4734 <input type="hidden" name="blogid" value="<?php echo $blogid?>" />
\r
4735 <input name="allblogs" type="radio" value="0" id="allblogs_one" /><label for="allblogs_one">'<?php echo htmlspecialchars($blog->getName())?>'</label>
\r
4737 <input name="allblogs" type="radio" value="1" checked="checked" id="allblogs_all" /><label for="allblogs_all"><?php echo _BAN_ALLBLOGS?></label>
\r
4740 <h3><?php echo _BAN_REASON_TITLE?></h3>
\r
4742 <p><?php echo _BAN_REASON_TEXT?></p>
\r
4744 <div><textarea name="reason" cols="40" rows="5"></textarea></div>
\r
4746 <h3><?php echo _BAN_ADD_TITLE?></h3>
\r
4749 <input name="action" type="hidden" value="banlistadd" />
\r
4750 <input type="submit" value="<?php echo _BAN_ADD_BTN?>" />
\r
4755 <?php $this->pagefoot();
\r
4758 function action_banlistadd() {
\r
4761 $blogid = intPostVar('blogid');
\r
4762 $allblogs = postVar('allblogs');
\r
4763 $iprange = postVar('iprange');
\r
4764 if ($iprange == "custom")
\r
4765 $iprange = postVar('customiprange');
\r
4766 $reason = postVar('reason');
\r
4768 $member->blogAdminRights($blogid) or $this->disallow();
\r
4770 // TODO: check IP range validity
\r
4773 if (!BAN::addBan($blogid, $iprange, $reason))
\r
4774 $this->error(_ERROR_ADDBAN);
\r
4776 // get blogs fot which member has admin rights
\r
4777 $adminblogs = $member->getAdminBlogs();
\r
4779 foreach ($adminblogs as $blogje) {
\r
4780 if (!BAN::addBan($blogje, $iprange, $reason))
\r
4784 $this->error(_ERROR_ADDBAN);
\r
4787 $this->action_banlist();
\r
4791 function action_clearactionlog() {
\r
4794 $member->isAdmin() or $this->disallow();
\r
4796 ACTIONLOG::clear();
\r
4798 $this->action_manage(_MSG_ACTIONLOGCLEARED);
\r
4801 function action_backupoverview() {
\r
4804 $member->isAdmin() or $this->disallow();
\r
4806 $this->pagehead();
\r
4808 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
\r
4810 <h2><?php echo _BACKUPS_TITLE?></h2>
\r
4812 <h3><?php echo _BACKUP_TITLE?></h3>
\r
4814 <p><?php echo _BACKUP_INTRO?></p>
\r
4816 <form method="post" action="index.php"><p>
\r
4817 <input type="hidden" name="action" value="backupcreate" />
\r
4819 <input type="radio" name="gzip" value="1" checked="checked" id="gzip_yes" tabindex="10" /><label for="gzip_yes"><?php echo _BACKUP_ZIP_YES?></label>
\r
4821 <input type="radio" name="gzip" value="0" id="gzip_no" tabindex="10" /><label for="gzip_no" ><?php echo _BACKUP_ZIP_NO?></label>
\r
4823 <input type="submit" value="<?php echo _BACKUP_BTN?>" tabindex="20" />
\r
4827 <div class="note"><?php echo _BACKUP_NOTE?></div>
\r
4830 <h3><?php echo _RESTORE_TITLE?></h3>
\r
4832 <div class="note"><?php echo _RESTORE_NOTE?></div>
\r
4834 <p><?php echo _RESTORE_INTRO?></p>
\r
4836 <form method="post" action="index.php" enctype="multipart/form-data"><p>
\r
4837 <input type="hidden" name="action" value="backuprestore" />
\r
4838 <input name="backup_file" type="file" tabindex="30" />
\r
4840 <input type="submit" value="<?php echo _RESTORE_BTN?>" tabindex="40" />
\r
4841 <br /><input type="checkbox" name="letsgo" value="1" id="letsgo" tabindex="50" /><label for="letsgo"><?php echo _RESTORE_IMSURE?></label>
\r
4842 <br /><?php echo _RESTORE_WARNING?>
\r
4845 <?php $this->pagefoot();
\r
4848 function action_backupcreate() {
\r
4849 global $member, $DIR_LIBS;
\r
4851 $member->isAdmin() or $this->disallow();
\r
4853 // use compression ?
\r
4854 $useGzip = intval(postVar('gzip'));
\r
4856 include($DIR_LIBS . 'backup.php');
\r
4858 // try to extend time limit
\r
4859 // (creating/restoring dumps might take a while)
\r
4860 @set_time_limit(1200);
\r
4862 do_backup($useGzip);
\r
4867 function action_backuprestore() {
\r
4868 global $member, $DIR_LIBS;
\r
4870 $member->isAdmin() or $this->disallow();
\r
4872 if (intPostVar('letsgo') != 1)
\r
4873 $this->error(_ERROR_BACKUP_NOTSURE);
\r
4875 include($DIR_LIBS . 'backup.php');
\r
4877 // try to extend time limit
\r
4878 // (creating/restoring dumps might take a while)
\r
4879 @set_time_limit(1200);
\r
4881 $message = do_restore();
\r
4882 if ($message != '')
\r
4883 $this->error($message);
\r
4885 $this->pagehead();
\r
4887 <h2><?php echo _RESTORE_COMPLETE?></h2>
\r
4888 <?php $this->pagefoot();
\r
4893 function action_pluginlist() {
\r
4896 // check if allowed
\r
4897 $member->isAdmin() or $this->disallow();
\r
4899 $this->pagehead();
\r
4901 echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
\r
4903 echo '<h2>' , _PLUGS_TITLE_MANAGE , ' ', help('plugins'), '</h2>';
\r
4905 echo '<h3>' , _PLUGS_TITLE_INSTALLED , '</h3>';
\r
4908 $query = 'SELECT * FROM '.sql_table('plugin').' ORDER BY porder ASC';
\r
4910 $template['content'] = 'pluginlist';
\r
4911 $template['tabindex'] = 10;
\r
4912 showlist($query, 'table', $template);
\r
4915 <h3><?php echo _PLUGS_TITLE_UPDATE?></h3>
\r
4917 <p><?php echo _PLUGS_TEXT_UPDATE?></p>
\r
4919 <form method="post" action="index.php"><div>
\r
4920 <input type="hidden" name="action" value="pluginupdate" />
\r
4921 <input type="submit" value="<?php echo _PLUGS_BTN_UPDATE ?>" tabindex="20" />
\r
4924 <h3><?php echo _PLUGS_TITLE_NEW?></h3>
\r
4926 <?php // find a list of possibly non-installed plugins
\r
4927 $candidates = array();
\r
4928 global $DIR_PLUGINS;
\r
4929 $dirhandle = opendir($DIR_PLUGINS);
\r
4930 while ($filename = readdir($dirhandle)) {
\r
4931 if (ereg('^NP_(.*)\.php$',$filename,$matches)) {
\r
4932 $name = $matches[1];
\r
4933 // only show in list when not yet installed
\r
4934 if (mysql_num_rows(sql_query('SELECT * FROM '.sql_table('plugin').' WHERE pfile="NP_'.addslashes($name).'"')) == 0)
\r
4935 array_push($candidates,$name);
\r
4938 closedir($dirhandle);
\r
4940 if (sizeof($candidates) > 0) {
\r
4943 <p><?php echo _PLUGS_ADD_TEXT?></p>
\r
4946 <form method='post' action='index.php'><div>
\r
4947 <input type='hidden' name='action' value='pluginadd' />
\r
4948 <select name="filename" tabindex="30">
\r
4949 <?php foreach($candidates as $name)
\r
4950 echo '<option value="NP_',$name,'">',htmlspecialchars($name),'</option>';
\r
4953 <input type='submit' tabindex="40" value='<?php echo _PLUGS_BTN_INSTALL?>' />
\r
4956 <?php } else { // sizeof(candidates) == 0
\r
4957 echo '<p>',_PLUGS_NOCANDIDATES,'</p>';
\r
4960 $this->pagefoot();
\r
4964 function action_pluginadd() {
\r
4965 global $member, $manager, $DIR_PLUGINS;
\r
4967 // check if allowed
\r
4968 $member->isAdmin() or $this->disallow();
\r
4970 $name = postVar('filename');
\r
4972 if ($manager->pluginInstalled($name))
\r
4973 $this->error(_ERROR_DUPPLUGIN);
\r
4974 if (!checkPlugin($name))
\r
4975 $this->error(_ERROR_PLUGFILEERROR . ' (' . $name . ')');
\r
4977 // get number of currently installed plugins
\r
4978 $numCurrent = mysql_num_rows(sql_query('SELECT * FROM '.sql_table('plugin')));
\r
4980 // plugin will be added as last one in the list
\r
4981 $newOrder = $numCurrent + 1;
\r
4990 // do this before calling getPlugin (in case the plugin id is used there)
\r
4991 $query = 'INSERT INTO '.sql_table('plugin').' (porder, pfile) VALUES ('.$newOrder.',"'.addslashes($name).'")';
\r
4992 sql_query($query);
\r
4993 $iPid = mysql_insert_id();
\r
4995 $manager->clearCachedInfo('installedPlugins');
\r
4997 // call the install method of the plugin
\r
4998 $plugin =& $manager->getPlugin($name);
\r
5002 sql_query('DELETE FROM ' . sql_table('plugin') . ' WHERE pid='. intval($iPid));
\r
5003 $manager->clearCachedInfo('installedPlugins');
\r
5004 $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)');
\r
5007 // check if plugin needs a newer Nucleus version
\r
5008 if (getNucleusVersion() < $plugin->getMinNucleusVersion())
\r
5010 // uninstall plugin again...
\r
5011 $this->deleteOnePlugin($plugin->getID());
\r
5013 // ...and show error
\r
5014 $this->error(_ERROR_NUCLEUSVERSIONREQ . $plugin->getMinNucleusVersion());
\r
5017 // check if plugin needs a newer Nucleus version
\r
5018 if ((getNucleusVersion() == $plugin->getMinNucleusVersion()) && (getNucleusPatchLevel() < $plugin->getMinNucleusPatchLevel()))
\r
5020 // uninstall plugin again...
\r
5021 $this->deleteOnePlugin($plugin->getID());
\r
5023 // ...and show error
\r
5024 $this->error(_ERROR_NUCLEUSVERSIONREQ . $plugin->getMinNucleusVersion() . ' patch ' . $plugin->getMinNucleusPatchLevel());
\r
5027 $plugin->install();
\r
5032 'plugin' => &$plugin
\r
5036 // update all events
\r
5037 $this->action_pluginupdate();
\r
5040 function action_pluginupdate() {
\r
5041 global $member, $manager;
\r
5043 // check if allowed
\r
5044 $member->isAdmin() or $this->disallow();
\r
5046 // delete everything from plugin_events
\r
5047 sql_query('DELETE FROM '.sql_table('plugin_event'));
\r
5049 // loop over all installed plugins
\r
5050 $res = sql_query('SELECT pid, pfile FROM '.sql_table('plugin'));
\r
5051 while($o = mysql_fetch_object($res)) {
\r
5053 $plug =& $manager->getPlugin($o->pfile);
\r
5056 $eventList = $plug->getEventList();
\r
5057 foreach ($eventList as $eventName)
\r
5058 sql_query('INSERT INTO '.sql_table('plugin_event').' (pid, event) VALUES ('.$pid.', \''.addslashes($eventName).'\')');
\r
5062 $this->action_pluginlist();
\r
5065 function action_plugindelete() {
\r
5066 global $member, $manager;
\r
5068 // check if allowed
\r
5069 $member->isAdmin() or $this->disallow();
\r
5071 $pid = intGetVar('plugid');
\r
5073 if (!$manager->pidInstalled($pid))
\r
5074 $this->error(_ERROR_NOSUCHPLUGIN);
\r
5076 $this->pagehead();
\r
5078 <h2><?php echo _DELETE_CONFIRM?></h2>
\r
5080 <p><?php echo _CONFIRMTXT_PLUGIN?> <strong><?php echo getPluginNameFromPid($pid)?></strong>?</p>
\r
5082 <form method="post" action="index.php"><div>
\r
5083 <input type="hidden" name="action" value="plugindeleteconfirm" />
\r
5084 <input type="hidden" name="plugid" value="<?php echo $pid; ?>" />
\r
5085 <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
\r
5087 <?php $this->pagefoot();
\r
5090 function action_plugindeleteconfirm() {
\r
5091 global $member, $manager;
\r
5093 // check if allowed
\r
5094 $member->isAdmin() or $this->disallow();
\r
5096 $pid = intPostVar('plugid');
\r
5098 $error = $this->deleteOnePlugin($pid, 1);
\r
5100 $this->error($error);
\r
5103 $this->action_pluginlist();
\r
5106 function deleteOnePlugin($pid, $callUninstall = 0) {
\r
5109 $pid = intval($pid);
\r
5111 if (!$manager->pidInstalled($pid))
\r
5112 return _ERROR_NOSUCHPLUGIN;
\r
5114 // call the unInstall method of the plugin
\r
5115 if ($callUninstall) {
\r
5116 $name = quickQuery('SELECT pfile as result FROM '.sql_table('plugin').' WHERE pid='.$pid);
\r
5117 $plugin =& $manager->getPlugin($name);
\r
5118 if ($plugin) $plugin->unInstall();
\r
5121 $manager->notify('PreDeletePlugin', array('plugid' => $pid));
\r
5123 // delete all subscriptions
\r
5124 sql_query('DELETE FROM '.sql_table('plugin_event').' WHERE pid=' . $pid);
\r
5126 // delete all options
\r
5127 // get OIDs from plugin_option_desc
\r
5128 $res = sql_query('SELECT oid FROM ' . sql_table('plugin_option_desc') . ' WHERE opid=' . $pid);
\r
5130 while ($o = mysql_fetch_object($res)) {
\r
5131 array_push($aOIDs, $o->oid);
\r
5134 // delete from plugin_option and plugin_option_desc
\r
5135 sql_query('DELETE FROM '.sql_table('plugin_option_desc').' WHERE opid=' . $pid);
\r
5136 if (count($aOIDs) > 0)
\r
5137 sql_query('DELETE FROM '.sql_table('plugin_option').' WHERE oid in ('.implode(',',$aOIDs).')');
\r
5139 // update order numbers
\r
5140 $o = mysql_fetch_object(sql_query('SELECT porder FROM '.sql_table('plugin').' WHERE pid=' . $pid));
\r
5141 sql_query('UPDATE '.sql_table('plugin').' SET porder=(porder - 1) WHERE porder>'.$o->porder);
\r
5144 sql_query('DELETE FROM '.sql_table('plugin').' WHERE pid='.$pid);
\r
5146 $manager->clearCachedInfo('installedPlugins');
\r
5147 $manager->notify('PostDeletePlugin', array('plugid' => $pid));
\r
5152 function action_pluginup() {
\r
5153 global $member, $manager;
\r
5155 // check if allowed
\r
5156 $member->isAdmin() or $this->disallow();
\r
5158 $plugid = intGetVar('plugid');
\r
5160 if (!$manager->pidInstalled($plugid))
\r
5161 $this->error(_ERROR_NOSUCHPLUGIN);
\r
5163 // 1. get old order number
\r
5164 $o = mysql_fetch_object(sql_query('SELECT porder FROM '.sql_table('plugin').' WHERE pid='.$plugid));
\r
5165 $oldOrder = $o->porder;
\r
5167 // 2. calculate new order number
\r
5168 $newOrder = ($oldOrder > 1) ? ($oldOrder - 1) : 1;
\r
5170 // 3. update plug numbers
\r
5171 sql_query('UPDATE '.sql_table('plugin').' SET porder='.$oldOrder.' WHERE porder='.$newOrder);
\r
5172 sql_query('UPDATE '.sql_table('plugin').' SET porder='.$newOrder.' WHERE pid='.$plugid);
\r
5174 $this->action_pluginlist();
\r
5177 function action_plugindown() {
\r
5178 global $member, $manager;
\r
5180 // check if allowed
\r
5181 $member->isAdmin() or $this->disallow();
\r
5183 $plugid = intGetVar('plugid');
\r
5184 if (!$manager->pidInstalled($plugid))
\r
5185 $this->error(_ERROR_NOSUCHPLUGIN);
\r
5187 // 1. get old order number
\r
5188 $o = mysql_fetch_object(sql_query('SELECT porder FROM '.sql_table('plugin').' WHERE pid='.$plugid));
\r
5189 $oldOrder = $o->porder;
\r
5191 $maxOrder = mysql_num_rows(sql_query('SELECT * FROM '.sql_table('plugin')));
\r
5193 // 2. calculate new order number
\r
5194 $newOrder = ($oldOrder < $maxOrder) ? ($oldOrder + 1) : $maxOrder;
\r
5196 // 3. update plug numbers
\r
5197 sql_query('UPDATE '.sql_table('plugin').' SET porder='.$oldOrder.' WHERE porder='.$newOrder);
\r
5198 sql_query('UPDATE '.sql_table('plugin').' SET porder='.$newOrder.' WHERE pid='.$plugid);
\r
5200 $this->action_pluginlist();
\r
5203 function action_pluginoptions($message = '') {
\r
5204 global $member, $manager;
\r
5206 // check if allowed
\r
5207 $member->isAdmin() or $this->disallow();
\r
5209 $pid = intRequestVar('plugid');
\r
5210 if (!$manager->pidInstalled($pid))
\r
5211 $this->error(_ERROR_NOSUCHPLUGIN);
\r
5213 $this->pagehead();
\r
5216 <p><a href="index.php?action=pluginlist">(<?php echo _PLUGS_BACK?>)</a></p>
\r
5218 <h2>Options for <?php echo htmlspecialchars(getPluginNameFromPid($pid))?></h2>
\r
5220 <?php if ($message) echo $message?>
\r
5222 <form action="index.php" method="post">
\r
5224 <input type="hidden" name="action" value="pluginoptionsupdate" />
\r
5225 <input type="hidden" name="plugid" value="<?php echo $pid?>" />
\r
5228 $aOptions = array();
\r
5230 $query = 'SELECT * FROM ' . sql_table('plugin_option_desc') . ' WHERE ocontext=\'global\' and opid=' . $pid . ' ORDER BY oid ASC';
\r
5231 $r = sql_query($query);
\r
5232 while ($o = mysql_fetch_object($r)) {
\r
5233 array_push($aOIDs, $o->oid);
\r
5234 $aOptions[$o->oid] = array(
\r
5236 'value' => $o->odef,
\r
5237 'name' => $o->oname,
\r
5238 'description' => $o->odesc,
\r
5239 'type' => $o->otype,
\r
5240 'typeinfo' => $o->oextra,
\r
5244 // fill out actual values
\r
5245 if (count($aOIDs) > 0) {
\r
5246 $r = sql_query('SELECT oid, ovalue FROM ' . sql_table('plugin_option') . ' WHERE oid in ('.implode(',',$aOIDs).')');
\r
5247 while ($o = mysql_fetch_object($r))
\r
5248 $aOptions[$o->oid]['value'] = $o->ovalue;
\r
5252 $manager->notify('PrePluginOptionsEdit',array('context' => 'global', 'plugid' => $pid, 'options'=>&$aOptions));
\r
5254 $template['content'] = 'plugoptionlist';
\r
5255 $amount = showlist($aOptions,'table',$template);
\r
5257 echo '<p>',_ERROR_NOPLUGOPTIONS,'</p>';
\r
5262 <?php $this->pagefoot();
\r
5268 function action_pluginoptionsupdate() {
\r
5269 global $member, $manager;
\r
5271 // check if allowed
\r
5272 $member->isAdmin() or $this->disallow();
\r
5274 $pid = intRequestVar('plugid');
\r
5275 if (!$manager->pidInstalled($pid))
\r
5276 $this->error(_ERROR_NOSUCHPLUGIN);
\r
5278 $aOptions = requestArray('plugoption');
\r
5279 NucleusPlugin::_applyPluginOptions($aOptions);
\r
5281 $manager->notify('PostPluginOptionsUpdate',array('context' => 'global', 'plugid' => $pid));
\r
5283 $this->action_pluginoptions(_PLUGS_OPTIONS_UPDATED);
\r
5287 function _insertPluginOptions($context, $contextid = 0) {
\r
5288 // get all current values for this contextid
\r
5289 // (note: this might contain doubles for overlapping contextids)
\r
5290 $aIdToValue = array();
\r
5291 $res = sql_query('SELECT oid, ovalue FROM ' . sql_table('plugin_option') . ' WHERE ocontextid=' . intval($contextid));
\r
5292 while ($o = mysql_fetch_object($res)) {
\r
5293 $aIdToValue[$o->oid] = $o->ovalue;
\r
5296 // get list of oids per pid
\r
5297 $query = 'SELECT * FROM ' . sql_table('plugin_option_desc') . ',' . sql_table('plugin')
\r
5298 . ' WHERE opid=pid and ocontext=\''.addslashes($context).'\' ORDER BY porder, oid ASC';
\r
5299 $res = sql_query($query);
\r
5300 $aOptions = array();
\r
5301 while ($o = mysql_fetch_object($res)) {
\r
5302 if (in_array($o->oid, array_keys($aIdToValue)))
\r
5303 $value = $aIdToValue[$o->oid];
\r
5305 $value = $o->odef;
\r
5307 array_push($aOptions, array(
\r
5309 'pfile' => $o->pfile,
\r
5311 'value' => $value,
\r
5312 'name' => $o->oname,
\r
5313 'description' => $o->odesc,
\r
5314 'type' => $o->otype,
\r
5315 'typeinfo' => $o->oextra,
\r
5316 'contextid' => $contextid
\r
5321 $manager->notify('PrePluginOptionsEdit',array('context' => $context, 'contextid' => $contextid, 'options'=>&$aOptions));
\r
5325 foreach ($aOptions as $aOption) {
\r
5328 if ($iPrevPid != $aOption['pid']) {
\r
5329 $iPrevPid = $aOption['pid'];
\r
5331 echo '<tr><th colspan="2">Options for ', htmlspecialchars($aOption['pfile']),'</th></tr>';
\r
5335 listplug_plugOptionRow($aOption);
\r
5343 /* helper functions to create option forms etc. */
\r
5344 function input_yesno($name, $checkedval,$tabindex = 0, $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO) {
\r
5345 $id = htmlspecialchars($name);
\r
5346 $id = str_replace('[','-',$id);
\r
5347 $id = str_replace(']','-',$id);
\r
5348 $id1 = $id . htmlspecialchars($value1);
\r
5349 $id2 = $id . htmlspecialchars($value2);
\r
5351 echo '<input type="radio" name="', htmlspecialchars($name),'" value="', htmlspecialchars($value1),'" ';
\r
5352 if ($checkedval == $value1)
\r
5353 echo "tabindex='$tabindex' checked='checked'";
\r
5354 echo ' id="'.$id1.'" /><label for="'.$id1.'">' . $yesval . '</label>';
\r
5356 echo '<input type="radio" name="', htmlspecialchars($name),'" value="', htmlspecialchars($value2),'" ';
\r
5357 if ($checkedval != $value1)
\r
5358 echo "tabindex='$tabindex' checked='checked'";
\r
5359 echo ' id="'.$id2.'" /><label for="'.$id2.'">' . $noval . '</label>';
\r
5366 class ENCAPSULATE {
\r
5368 * Uses $call to call a function using parameters $params
\r
5369 * This function should return the amount of entries shown.
\r
5370 * When entries are show, batch operation handlers are shown too.
\r
5371 * When no entries were shown, $errormsg is used to display an error
\r
5373 * Passes on the amount of results found (for further encapsulation)
\r
5375 function doEncapsulate($call, $params, $errorMessage = 'No entries') {
\r
5376 // start output buffering
\r
5379 $nbOfRows = call_user_func_array($call, $params);
\r
5381 // get list contents and stop buffering
\r
5382 $list = ob_get_contents();
\r
5385 if ($nbOfRows > 0) {
\r
5386 $this->showHead();
\r
5388 $this->showFoot();
\r
5390 echo $errorMessage;
\r
5399 * A class used to encapsulate a list of some sort inside next/prev buttons
\r
5401 class NAVLIST extends ENCAPSULATE {
\r
5403 function NAVLIST($action, $start, $amount, $minamount, $maxamount, $blogid, $search, $itemid) {
\r
5404 $this->action = $action;
\r
5405 $this->start = $start;
\r
5406 $this->amount = $amount;
\r
5407 $this->minamount = $minamount;
\r
5408 $this->maxamount = $maxamount;
\r
5409 $this->blogid = $blogid;
\r
5410 $this->search = $search;
\r
5411 $this->itemid = $itemid;
\r
5414 function showBatchList($batchtype, $query, $type, $template, $errorMessage = _LISTS_NOMORE) {
\r
5415 $batch = new BATCH($batchtype);
\r
5417 $this->doEncapsulate(
\r
5418 array(&$batch, 'showlist'),
\r
5419 array(&$query, $type, $template),
\r
5426 function showHead() {
\r
5427 $this->showNavigation();
\r
5429 function showFoot() {
\r
5430 $this->showNavigation();
\r
5434 * Displays a next/prev bar for long tables
\r
5436 function showNavigation() {
\r
5437 $action = $this->action;
\r
5438 $start = $this->start;
\r
5439 $amount = $this->amount;
\r
5440 $minamount = $this->minamount;
\r
5441 $maxamount = $this->maxamount;
\r
5442 $blogid = $this->blogid;
\r
5443 $search = $this->search;
\r
5444 $itemid = $this->itemid;
\r
5446 $prev = $start - $amount;
\r
5447 if ($prev < $minamount) $prev=$minamount;
\r
5449 // maxamount not used yet
\r
5450 // if ($start + $amount <= $maxamount)
\r
5451 $next = $start + $amount;
\r
5453 // $next = $start;
\r
5456 <table class="navigation">
\r
5458 <form method="post" action="index.php"><div>
\r
5459 <input type="submit" value="<< <?php echo _LISTS_PREV?>" />
\r
5460 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
\r
5461 <input type="hidden" name="itemid" value="<?php echo $itemid; ?>" />
\r
5462 <input type="hidden" name="action" value="<?php echo $action; ?>" />
\r
5463 <input type="hidden" name="amount" value="<?php echo $amount; ?>" />
\r
5464 <input type="hidden" name="search" value="<?php echo $search; ?>" />
\r
5465 <input type="hidden" name="start" value="<?php echo $prev; ?>" />
\r
5468 <form method="post" action="index.php"><div>
\r
5469 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
\r
5470 <input type="hidden" name="itemid" value="<?php echo $itemid; ?>" />
\r
5471 <input type="hidden" name="action" value="<?php echo $action; ?>" />
\r
5472 <input name="amount" size="3" value="<?php echo $amount; ?>" /> <?php echo _LISTS_PERPAGE?>
\r
5473 <input type="hidden" name="start" value="<?php echo $start; ?>" />
\r
5474 <input type="hidden" name="search" value="<?php echo $search; ?>" />
\r
5475 <input type="submit" value="> <?php echo _LISTS_CHANGE?>" />
\r
5478 <form method="post" action="index.php"><div>
\r
5479 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
\r
5480 <input type="hidden" name="itemid" value="<?php echo $itemid; ?>" />
\r
5481 <input type="hidden" name="action" value="<?php echo $action; ?>" />
\r
5482 <input type="hidden" name="amount" value="<?php echo $amount; ?>" />
\r
5483 <input type="hidden" name="start" value="0" />
\r
5484 <input type="text" name="search" value="<?php echo $search; ?>" size="7" />
\r
5485 <input type="submit" value="> <?php echo _LISTS_SEARCH?>" />
\r
5488 <form method="post" action="index.php"><div>
\r
5489 <input type="submit" value="<?php echo _LISTS_NEXT?> > >" />
\r
5490 <input type="hidden" name="search" value="<?php echo $search; ?>" />
\r
5491 <input type="hidden" name="blogid" value="<?php echo $blogid; ?>" />
\r
5492 <input type="hidden" name="itemid" value="<?php echo $itemid; ?>" />
\r
5493 <input type="hidden" name="action" value="<?php echo $action; ?>" />
\r
5494 <input type="hidden" name="amount" value="<?php echo $amount; ?>" />
\r
5495 <input type="hidden" name="start" value="<?php echo $next; ?>" />
\r
5505 * A class used to encapsulate a list of some sort in a batch selection
\r
5507 class BATCH extends ENCAPSULATE {
\r
5508 function BATCH($type) {
\r
5509 $this->type = $type;
\r
5512 function showHead() {
\r
5514 <form method="post" action="index.php">
\r
5516 // TODO: get a list op operations above the list too
\r
5517 // (be careful not to use the same names for the select...)
\r
5518 // $this->showOperationList();
\r
5521 function showFoot() {
\r
5522 $this->showOperationList();
\r
5527 function showOperationList() {
\r
5529 <div class="batchoperations">
\r
5530 <?php echo _BATCH_WITH_SEL ?>
\r
5531 <select name="batchaction">
\r
5532 <?php $options = array();
\r
5533 switch($this->type) {
\r
5536 'delete' => _BATCH_ITEM_DELETE,
\r
5537 'move' => _BATCH_ITEM_MOVE
\r
5542 'delete' => _BATCH_MEMBER_DELETE,
\r
5543 'setadmin' => _BATCH_MEMBER_SET_ADM,
\r
5544 'unsetadmin' => _BATCH_MEMBER_UNSET_ADM
\r
5549 'delete' => _BATCH_TEAM_DELETE,
\r
5550 'setadmin' => _BATCH_TEAM_SET_ADM,
\r
5551 'unsetadmin' => _BATCH_TEAM_UNSET_ADM,
\r
5556 'delete' => _BATCH_CAT_DELETE,
\r
5557 'move' => _BATCH_CAT_MOVE,
\r
5562 'delete' => _BATCH_COMMENT_DELETE,
\r
5566 foreach ($options as $option => $label) {
\r
5567 echo '<option value="',$option,'">',$label,'</option>';
\r
5571 <input type="hidden" name="action" value="batch<?php echo $this->type?>" />
\r
5572 <?php // add hidden fields for 'team' and 'comment' batchlists
\r
5573 if ($this->type == 'team')
\r
5575 echo '<input type="hidden" name="blogid" value="',intRequestVar('blogid'),'" />';
\r
5577 if ($this->type == 'comment')
\r
5579 echo '<input type="hidden" name="itemid" value="',intRequestVar('itemid'),'" />';
\r
5584 <input type="submit" value="Execute" />
\r
5586 <a href="" onclick="if (event && event.preventDefault) event.preventDefault(); return batchSelectAll(1); "><?php echo _BATCH_SELECTALL?></a> -
\r
5587 <a href="" onclick="if (event && event.preventDefault) event.preventDefault(); return batchSelectAll(0); "><?php echo _BATCH_DESELECTALL?></a>
\r
5593 function showList($query, $type, $template, $errorMessage = _LISTS_NOMORE) {
\r
5594 return $this->doEncapsulate( 'showlist',
\r
5595 array($query, $type, $template),
\r
5604 // can take either an array of objects, or an SQL query
\r
5605 function showlist($query, $type, $template) {
\r
5607 if (is_array($query)) {
\r
5608 if (sizeof($query) == 0)
\r
5611 call_user_func('listplug_' . $type, $template, 'HEAD');
\r
5613 // add extra row if needed
\r
5614 if ($template['extra']) {
\r
5615 echo '<option value="',$template['extraval'],'">',$template['extra'],'</option>';
\r
5618 foreach ($query as $currentObj) {
\r
5619 $template['current'] = $currentObj;
\r
5620 call_user_func('listplug_' . $type, $template, 'BODY');
\r
5623 call_user_func('listplug_' . $type, $template, 'FOOT');
\r
5625 return sizeof($query);
\r
5628 $res = sql_query($query);
\r
5630 // don't do anything if there are no results
\r
5631 $numrows = mysql_num_rows($res);
\r
5632 if ($numrows == 0)
\r
5635 call_user_func('listplug_' . $type, $template, 'HEAD');
\r
5637 // add extra row if needed
\r
5638 if ($template['extra']) {
\r
5639 echo '<option value="',$template['extraval'],'">',$template['extra'],'</option>';
\r
5642 while($template['current'] = mysql_fetch_object($res))
\r
5643 call_user_func('listplug_' . $type, $template, 'BODY');
\r
5645 call_user_func('listplug_' . $type, $template, 'FOOT');
\r
5647 mysql_free_result($res);
\r
5649 // return amount of results
\r
5654 function listplug_select($template, $type) {
\r
5657 echo '<select name="'.$template['name'].'" tabindex="'.$template['tabindex'].'" '.$template['javascript'].'>';
\r
5660 $current = $template['current'];
\r
5662 echo '<option value="' . htmlspecialchars($current->value) . '"';
\r
5663 if ($template['selected'] == $current->value)
\r
5664 echo ' selected="selected" ';
\r
5665 if ($template['shorten'] > 0) {
\r
5666 echo ' title="'. htmlspecialchars($current->text).'"';
\r
5667 $current->text = shorten($current->text, $template['shorten'], $template['shortenel']);
\r
5669 echo '>' . htmlspecialchars($current->text) . '</option>';
\r
5677 function listplug_table($template, $type) {
\r
5681 echo "<thead><tr>";
\r
5683 call_user_func("listplug_table_" . $template['content'] , $template, 'HEAD');
\r
5684 echo "</tr></thead><tbody>";
\r
5687 // print tabletype specific thingies
\r
5688 echo "<tr onmouseover='focusRow(this);' onmouseout='blurRow(this);'>";
\r
5689 call_user_func("listplug_table_" . $template['content'] , $template, 'BODY');
\r
5693 call_user_func("listplug_table_" . $template['content'] , $template, 'FOOT');
\r
5694 echo "</tbody></table>";
\r
5699 function listplug_table_memberlist($template, $type) {
\r
5702 echo '<th>' . _LIST_MEMBER_NAME . '</th><th>' . _LIST_MEMBER_RNAME . '</th><th>' . _LIST_MEMBER_URL . '</th><th>' . _LIST_MEMBER_ADMIN;
\r
5703 help('superadmin');
\r
5704 echo "</th><th>" . _LIST_MEMBER_LOGIN;
\r
5706 echo "</th><th colspan='2'>" . _LISTS_ACTIONS. "</th>";
\r
5709 $current = $template['current'];
\r
5712 $id = listplug_nextBatchId();
\r
5713 echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->mnumber,'" />';
\r
5714 echo '<label for="batch',$id,'">';
\r
5715 echo "<a href='mailto:", htmlspecialchars($current->memail), "' tabindex='".$template['tabindex']."'>", htmlspecialchars($current->mname), "</a>";
\r
5718 echo '<td>', htmlspecialchars($current->mrealname), '</td>';
\r
5719 echo "<td><a href='$current->murl' tabindex='".$template['tabindex']."'>$current->murl</a></td>";
\r
5720 echo '<td>', ($current->madmin ? _YES : _NO),'</td>';
\r
5721 echo '<td>', ($current->mcanlogin ? _YES : _NO), '</td>';
\r
5722 echo "<td><a href='index.php?action=memberedit&memberid=$current->mnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
\r
5723 echo "<td><a href='index.php?action=memberdelete&memberid=$current->mnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
\r
5728 function listplug_table_teamlist($template, $type) {
\r
5731 echo "<th>"._LIST_MEMBER_NAME."</th><th>"._LIST_MEMBER_RNAME."</th><th>"._LIST_TEAM_ADMIN;
\r
5732 help('teamadmin');
\r
5733 echo "</th><th colspan='2'>"._LISTS_ACTIONS."</th>";
\r
5736 $current = $template['current'];
\r
5739 $id = listplug_nextBatchId();
\r
5740 echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->tmember,'" />';
\r
5741 echo '<label for="batch',$id,'">';
\r
5742 echo "<a href='mailto:", htmlspecialchars($current->memail), "' tabindex='".$template['tabindex']."'>", htmlspecialchars($current->mname), "</a>";
\r
5745 echo '<td>', htmlspecialchars($current->mrealname), '</td>';
\r
5746 echo '<td>', ($current->tadmin ? _YES : _NO) , '</td>';
\r
5747 echo "<td><a href='index.php?action=teamdelete&memberid=$current->tmember&blogid=$current->tblog' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
\r
5748 echo "<td><a href='index.php?action=teamchangeadmin&memberid=$current->tmember&blogid=$current->tblog' tabindex='".$template['tabindex']."'>"._LIST_TEAM_CHADMIN."</a></td>";
\r
5752 function encode_desc(&$data)
\r
5753 { //_$to_entities = get_html_translation_table(HTML_ENTITIES);
\r
5754 $to_entities = get_html_translation_table(HTML_SPECIALCHARS);
\r
5755 $from_entities = array_flip($to_entities);
\r
5756 $data = str_replace('<br />','\n',$data); //hack
\r
5757 $data = strtr($data,$from_entities);
\r
5758 $data = strtr($data,$to_entities);
\r
5759 $data = str_replace('\n','<br />',$data); //hack
\r
5762 function listplug_table_pluginlist($template, $type) {
\r
5766 echo '<th>'._LISTS_INFO.'</th><th>'._LISTS_DESC.'</th>';
\r
5767 echo '<th>'._LISTS_ACTIONS.'</th>';
\r
5770 $current = $template['current'];
\r
5772 $plug =& $manager->getPlugin($current->pfile);
\r
5775 echo '<strong>' , htmlspecialchars($plug->getName()) , '</strong><br />';
\r
5776 echo _LIST_PLUGS_AUTHOR, ' ' , htmlspecialchars($plug->getAuthor()) , '<br />';
\r
5777 echo _LIST_PLUGS_VER, ' ' , htmlspecialchars($plug->getVersion()) , '<br />';
\r
5778 if ($plug->getURL())
\r
5779 echo '<a href="',htmlspecialchars($plug->getURL()),'" tabindex="'.$template['tabindex'].'">',_LIST_PLUGS_SITE,'</a><br />';
\r
5782 echo _LIST_PLUGS_DESC .'<br/>'. encode_desc($plug->getDescription());
\r
5783 if (sizeof($plug->getEventList()) > 0)
\r
5784 echo '<br /><br />',_LIST_PLUGS_SUBS,'<br />',htmlspecialchars(implode($plug->getEventList(),', '));
\r
5788 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>';
\r
5791 echo "<a href='index.php?action=pluginup&plugid=$current->pid' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_UP,"</a>";
\r
5792 echo "<br /><a href='index.php?action=plugindown&plugid=$current->pid' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_DOWN,"</a>";
\r
5793 echo "<br /><a href='index.php?action=plugindelete&plugid=$current->pid' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_UNINSTALL,"</a>";
\r
5794 if ($plug && ($plug->hasAdminArea() > 0))
\r
5795 echo "<br /><a href='".htmlspecialchars($plug->getAdminURL())."' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_ADMIN,"</a>";
\r
5796 if (quickQuery('SELECT COUNT(*) AS result FROM '.sql_table('plugin_option_desc').' WHERE ocontext=\'global\' and opid='.$current->pid) > 0)
\r
5797 echo "<br /><a href='index.php?action=pluginoptions&plugid=$current->pid' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_OPTIONS,"</a>";
\r
5803 function listplug_table_plugoptionlist($template, $type) {
\r
5807 echo '<th>'._LISTS_INFO.'</th><th>'._LISTS_VALUE.'</th>';
\r
5810 $current = $template['current'];
\r
5811 listplug_plugOptionRow($current);
\r
5816 <th colspan="2"><?php echo _PLUGS_SAVE?></th>
\r
5818 <td><?php echo _PLUGS_SAVE?></td>
\r
5819 <td><input type="submit" value="<?php echo _PLUGS_SAVE?>" /></td>
\r
5825 function listplug_plugOptionRow($current) {
\r
5826 $varname = 'plugoption['.$current['oid'].']['.$current['contextid'].']';
\r
5828 echo '<td>',htmlspecialchars($current['description']?$current['description']:$current['name']),'</td>';
\r
5830 switch($current['type']) {
\r
5832 ADMIN::input_yesno($varname, $current['value'], 0, 'yes', 'no');
\r
5835 echo '<input type="password" size="40" maxlength="128" name="',htmlspecialchars($varname),'" value="',htmlspecialchars($current['value']),'" />';
\r
5838 echo '<select name="'.htmlspecialchars($varname).'">';
\r
5839 $aOptions = explode('|', $current['typeinfo']);
\r
5840 for ($i=0; $i<(count($aOptions)-1); $i+=2) {
\r
5841 echo '<option value="'.htmlspecialchars($aOptions[$i+1]).'"';
\r
5842 if ($aOptions[$i+1] == $current['value'])
\r
5843 echo ' selected="selected"';
\r
5844 echo '>'.htmlspecialchars($aOptions[$i]).'</option>';
\r
5849 echo '<textarea class="pluginoption" cols="30" rows="5" name="',htmlspecialchars($varname),'">',htmlspecialchars($current['value']),'</textarea>';
\r
5853 echo '<input type="text" size="40" maxlength="128" name="',htmlspecialchars($varname),'" value="',htmlspecialchars($current['value']),'" />';
\r
5858 function listplug_table_itemlist($template, $type) {
\r
5861 echo "<th>"._LIST_ITEM_INFO."</th><th>"._LIST_ITEM_CONTENT."</th><th style=\"white-space:nowrap\" colspan='1'>"._LISTS_ACTIONS."</th>";
\r
5864 $current = $template['current'];
\r
5865 $current->itime = strtotime($current->itime); // string -> unix timestamp
\r
5867 if ($current->idraft == 1)
\r
5868 $cssclass = "class='draft'";
\r
5870 // (can't use offset time since offsets might vary between blogs)
\r
5871 if ($current->itime > $template['now'])
\r
5872 $cssclass = "class='future'";
\r
5874 echo "<td $cssclass>",_LIST_ITEM_BLOG," ", htmlspecialchars($current->bshortname);
\r
5875 echo " <br />",_LIST_ITEM_CAT," ", htmlspecialchars($current->cname);
\r
5876 echo " <br />",_LIST_ITEM_AUTHOR, " ", htmlspecialchars($current->mname);
\r
5877 echo " <br />",_LIST_ITEM_DATE," " . date("Y-m-d",$current->itime);
\r
5878 echo "<br />",_LIST_ITEM_TIME," " . date("H:i",$current->itime);
\r
5880 echo "<td $cssclass>";
\r
5882 $id = listplug_nextBatchId();
\r
5884 echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->inumber,'" />';
\r
5885 echo '<label for="batch',$id,'">';
\r
5886 echo "<b>" . htmlspecialchars(strip_tags($current->ititle)) . "</b>";
\r
5891 $current->ibody = strip_tags($current->ibody);
\r
5892 $current->ibody = htmlspecialchars(shorten($current->ibody,300,'...'));
\r
5894 echo "$current->ibody</td>";
\r
5895 echo "<td style=\"white-space:nowrap\" $cssclass>";
\r
5896 echo "<a href='index.php?action=itemedit&itemid=$current->inumber'>"._LISTS_EDIT."</a>";
\r
5897 echo "<br /><a href='index.php?action=itemcommentlist&itemid=$current->inumber'>"._LISTS_COMMENTS."</a>";
\r
5898 echo "<br /><a href='index.php?action=itemmove&itemid=$current->inumber'>"._LISTS_MOVE."</a>";
\r
5899 echo "<br /><a href='index.php?action=itemdelete&itemid=$current->inumber'>"._LISTS_DELETE."</a>";
\r
5905 // for batch operations: generates the index numbers for checkboxes
\r
5906 function listplug_nextBatchId() {
\r
5911 function listplug_table_commentlist($template, $type) {
\r
5914 echo "<th>"._LISTS_INFO."</th><th>"._LIST_COMMENT."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
\r
5917 $current = $template['current'];
\r
5918 $current->ctime = strtotime($current->ctime); // string -> unix timestamp
\r
5921 echo date("Y-m-d@H:i",$current->ctime);
\r
5923 if ($current->mname)
\r
5924 echo htmlspecialchars($current->mname), ' ', _LIST_COMMENTS_MEMBER;
\r
5926 echo htmlspecialchars($current->cuser);
\r
5930 $current->cbody = strip_tags($current->cbody);
\r
5931 $current->cbody = htmlspecialchars(shorten($current->cbody, 300, '...'));
\r
5934 $id = listplug_nextBatchId();
\r
5935 echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->cnumber,'" />';
\r
5936 echo '<label for="batch',$id,'">';
\r
5937 echo $current->cbody;
\r
5941 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=commentedit&commentid=$current->cnumber'>"._LISTS_EDIT."</a></td>";
\r
5942 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=commentdelete&commentid=$current->cnumber'>"._LISTS_DELETE."</a></td>";
\r
5943 if ($template['canAddBan'])
\r
5944 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>";
\r
5950 function listplug_table_bloglist($template, $type) {
\r
5953 echo "<th>" . _NAME . "</th><th colspan='7'>" ._LISTS_ACTIONS. "</th>";
\r
5956 $current = $template['current'];
\r
5958 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>";
\r
5959 echo "<td><a href='index.php?action=createitem&blogid=$current->bnumber' title='" . _BLOGLIST_TT_ADD ."'>" . _BLOGLIST_ADD . "</a></td>";
\r
5960 echo "<td><a href='index.php?action=itemlist&blogid=$current->bnumber' title='". _BLOGLIST_TT_EDIT."'>". _BLOGLIST_EDIT."</a></td>";
\r
5961 echo "<td><a href='index.php?action=blogcommentlist&blogid=$current->bnumber'>". _BLOGLIST_COMMENTS."</a></td>";
\r
5962 echo "<td><a href='index.php?action=bookmarklet&blogid=$current->bnumber' title='". _BLOGLIST_TT_BMLET."'>". _BLOGLIST_BMLET . "</a></td>";
\r
5964 if ($current->tadmin == 1) {
\r
5965 echo "<td><a href='index.php?action=blogsettings&blogid=$current->bnumber' title='" . _BLOGLIST_TT_SETTINGS . "'>" ._BLOGLIST_SETTINGS. "</a></td>";
\r
5966 echo "<td><a href='index.php?action=banlist&blogid=$current->bnumber' title='" . _BLOGLIST_TT_BANS. "'>". _BLOGLIST_BANS."</a></td>";
\r
5969 if ($template['superadmin']) {
\r
5970 echo "<td><a href='index.php?action=deleteblog&blogid=$current->bnumber' title='". _BLOGLIST_TT_DELETE."'>" ._BLOGLIST_DELETE. "</a></td>";
\r
5979 function listplug_table_shortblognames($template, $type) {
\r
5982 echo "<th>" . _NAME . "</th><th>" . _NAME. "</th>";
\r
5985 $current = $template['current'];
\r
5987 echo '<td>' , htmlspecialchars($current->bshortname) , '</td>';
\r
5988 echo '<td>' , htmlspecialchars($current->bname) , '</td>';
\r
5994 function listplug_table_shortnames($template, $type) {
\r
5997 echo "<th>" . _NAME . "</th><th>" . _LISTS_DESC. "</th>";
\r
6000 $current = $template['current'];
\r
6002 echo '<td>' , htmlspecialchars($current->name) , '</td>';
\r
6003 echo '<td>' , htmlspecialchars($current->description) , '</td>';
\r
6010 function listplug_table_categorylist($template, $type) {
\r
6013 echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='2'>"._LISTS_ACTIONS."</th>";
\r
6016 $current = $template['current'];
\r
6019 $id = listplug_nextBatchId();
\r
6020 echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->catid,'" />';
\r
6021 echo '<label for="batch',$id,'">';
\r
6022 echo htmlspecialchars($current->cname);
\r
6026 echo '<td>', htmlspecialchars($current->cdesc), '</td>';
\r
6027 echo "<td><a href='index.php?action=categorydelete&blogid=$current->cblog&catid=$current->catid' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
\r
6028 echo "<td><a href='index.php?action=categoryedit&blogid=$current->cblog&catid=$current->catid' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
\r
6035 function listplug_table_templatelist($template, $type) {
\r
6038 echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
\r
6041 $current = $template['current'];
\r
6043 echo "<td>" , htmlspecialchars($current->tdname), "</td>";
\r
6044 echo "<td>" , htmlspecialchars($current->tddesc), "</td>";
\r
6045 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=templateedit&templateid=$current->tdnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
\r
6046 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=templateclone&templateid=$current->tdnumber' tabindex='".$template['tabindex']."'>"._LISTS_CLONE."</a></td>";
\r
6047 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=templatedelete&templateid=$current->tdnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
\r
6053 function listplug_table_skinlist($template, $type) {
\r
6054 global $CONF, $DIR_SKINS;
\r
6057 echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
\r
6060 $current = $template['current'];
\r
6064 // use a special style for the default skin
\r
6065 if ($current->sdnumber == $CONF['BaseSkin']) {
\r
6066 echo '<strong>',htmlspecialchars($current->sdname),'</strong>';
\r
6068 echo htmlspecialchars($current->sdname);
\r
6071 echo '<br /><br />';
\r
6072 echo _LISTS_TYPE ,': ' , htmlspecialchars($current->sdtype);
\r
6073 echo '<br />', _LIST_SKINS_INCMODE , ' ' , (($current->sdincmode=='skindir') ?_PARSER_INCMODE_SKINDIR:_PARSER_INCMODE_NORMAL);
\r
6074 if ($current->sdincpref) echo '<br />' , _LIST_SKINS_INCPREFIX , ' ', htmlspecialchars($current->sdincpref);
\r
6076 // add preview image when present
\r
6077 if ($current->sdincpref && @file_exists($DIR_SKINS . $current->sdincpref . 'preview.png'))
\r
6079 echo '<br /><br />';
\r
6081 $hasEnlargement = @file_exists($DIR_SKINS . $current->sdincpref . 'preview-large.png');
\r
6082 if ($hasEnlargement)
\r
6083 echo '<a href="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview-large.png" title="View larger">';
\r
6085 echo '<img class="skinpreview" src="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview.png" width="100" height="75" alt="Preview for \'',htmlspecialchars($current->sdname),'\' skin" />';
\r
6087 if ($hasEnlargement)
\r
6090 if (@file_exists($DIR_SKINS . $current->sdincpref . 'readme.html'))
\r
6092 echo '<br /><a href="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'readme.html" title="More info on the \'',htmlspecialchars($current->sdname),'\' skin">Readme</a>';
\r
6101 echo "<td>" , htmlspecialchars($current->sddesc);
\r
6102 // show list of defined parts
\r
6103 $r = sql_query('SELECT stype FROM '.sql_table('skin').' WHERE sdesc='.$current->sdnumber . ' ORDER BY stype');
\r
6105 while ($o = mysql_fetch_object($r))
\r
6106 array_push($types,$o->stype);
\r
6107 if (sizeof($types) > 0) {
\r
6108 $friendlyNames = SKIN::getFriendlyNames();
\r
6109 for ($i=0;$i<sizeof($types);$i++) {
\r
6110 $type = $types[$i];
\r
6111 $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>";
\r
6113 echo '<br /><br />',_LIST_SKINS_DEFINED,' <ul>',implode($types,'') ,'</ul>';
\r
6116 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skinedit&skinid=$current->sdnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
\r
6117 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skinclone&skinid=$current->sdnumber' tabindex='".$template['tabindex']."'>"._LISTS_CLONE."</a></td>";
\r
6118 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skindelete&skinid=$current->sdnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
\r
6124 function listplug_table_draftlist($template, $type) {
\r
6127 echo "<th>"._LISTS_BLOG."</th><th>"._LISTS_TITLE."</th><th colspan='2'>"._LISTS_ACTIONS."</th>";
\r
6130 $current = $template['current'];
\r
6132 echo '<td>', htmlspecialchars($current->bshortname) , '</td>';
\r
6133 echo '<td>', htmlspecialchars(strip_tags($current->ititle)) , '</td>';
\r
6134 echo "<td><a href='index.php?action=itemedit&itemid=$current->inumber'>"._LISTS_EDIT."</a></td>";
\r
6135 echo "<td><a href='index.php?action=itemdelete&itemid=$current->inumber'>"._LISTS_DELETE."</a></td>";
\r
6142 function listplug_table_actionlist($template, $type) {
\r
6145 echo '<th>'._LISTS_TIME.'</th><th>'._LIST_ACTION_MSG.'</th>';
\r
6148 $current = $template['current'];
\r
6150 echo '<td>' , htmlspecialchars($current->timestamp), '</td>';
\r
6151 echo '<td>' , htmlspecialchars($current->message), '</td>';
\r
6157 function listplug_table_banlist($template, $type) {
\r
6160 echo '<th>'._LIST_BAN_IPRANGE.'</th><th>'. _LIST_BAN_REASON.'</th><th>'._LISTS_ACTIONS.'</th>';
\r
6163 $current = $template['current'];
\r
6165 echo '<td>' , htmlspecialchars($current->iprange) , '</td>';
\r
6166 echo '<td>' , htmlspecialchars($current->reason) , '</td>';
\r
6167 echo "<td><a href='index.php?action=banlistdelete&blogid=", intval($current->blogid) , "&iprange=" , htmlspecialchars($current->iprange) , "'>",_LISTS_DELETE,"</a></td>";
\r
6173 * Returns the Javascript code for a bookmarklet that works on most modern browsers
\r
6177 function getBookmarklet($blogid) {
\r
6181 $document = 'document';
\r
6182 $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('";
\r
6183 $bookmarkletline .= $CONF['AdminURL'] . "bookmarklet.php?blogid=$blogid";
\r
6184 $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();";
\r
6186 return $bookmarkletline;
\r