OSDN Git Service

merged from v3.31sp1
[nucleus-jp/nucleus-jp-ancient.git] / utf8 / nucleus / libs / ADMIN.php
index e784017..8278da3 100755 (executable)
@@ -1,7 +1,7 @@
 <?php
 /*
  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2006 The Nucleus Group
+ * Copyright (C) 2002-2007 The Nucleus Group
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * The code for the Nucleus admin area
  *
  * @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2006 The Nucleus Group
- * @version $Id: ADMIN.php,v 1.12 2007-01-31 10:02:58 kimitake Exp $
- * @version $NucleusJP: ADMIN.php,v 1.11 2006/11/13 00:43:07 kimitake Exp $
+ * @copyright Copyright (C) 2002-2007 The Nucleus Group
+ * @version $Id: ADMIN.php,v 1.24 2008-02-08 09:31:22 kimitake Exp $
+ * @version $NucleusJP: ADMIN.php,v 1.21.2.4 2007/10/30 19:04:24 kmorimatsu Exp $
  */
 
-require_once "showlist.php";
+if ( !function_exists('requestVar') ) exit;
+require_once dirname(__FILE__) . '/showlist.php';
 
 /**
  * Builds the admin area and executes admin actions
@@ -75,7 +76,7 @@ class ADMIN {
                if (method_exists($this, $methodName))
                        call_user_func(array(&$this, $methodName));
                else
-                       $this->error(_BADACTION . " ($action)");
+                       $this->error(_BADACTION . htmlspecialchars(" ($action)"));
 
        }
 
@@ -209,7 +210,7 @@ class ADMIN {
         * @param object BLOG
         */
        function bloglink(&$blog) {
-               return '<a href="'.htmlspecialchars($blog->getURL()).'" title="'._BLOGLIST_TT_VISIT.'">'.$blog->getName() .'</a>';
+               return '<a href="'.htmlspecialchars($blog->getURL()).'" title="'._BLOGLIST_TT_VISIT.'">'. htmlspecialchars( $blog->getName() ) .'</a>';
        }
 
        /**
@@ -363,7 +364,7 @@ class ADMIN {
                                        $error = $this->moveOneItem($itemid, $destCatid);
                                        break;
                                default:
-                                       $error = _BATCH_UNKNOWN . $action;
+                                       $error = _BATCH_UNKNOWN . htmlspecialchars($action);
                        }
 
                        echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
@@ -419,7 +420,7 @@ class ADMIN {
                                        $error = $this->deleteOneComment($commentid);
                                        break;
                                default:
-                                       $error = _BATCH_UNKNOWN . $action;
+                                       $error = _BATCH_UNKNOWN . htmlspecialchars($action);
                        }
 
                        echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
@@ -486,7 +487,7 @@ class ADMIN {
                                                sql_query('UPDATE ' . sql_table('member') .' SET madmin=0 WHERE mnumber='.$memberid);
                                        break;
                                default:
-                                       $error = _BATCH_UNKNOWN . $action;
+                                       $error = _BATCH_UNKNOWN . htmlspecialchars($action);
                        }
 
                        echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
@@ -556,7 +557,7 @@ class ADMIN {
                                                sql_query('UPDATE '.sql_table('team').' SET tadmin=0 WHERE tblog='.$blogid.' and tmember='.$memberid);
                                        break;
                                default:
-                                       $error = _BATCH_UNKNOWN . $action;
+                                       $error = _BATCH_UNKNOWN . htmlspecialchars($action);
                        }
 
                        echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
@@ -620,7 +621,7 @@ class ADMIN {
                                        $error = $this->moveOneCategory($catid, $destBlogId);
                                        break;
                                default:
-                                       $error = _BATCH_UNKNOWN . $action;
+                                       $error = _BATCH_UNKNOWN . htmlspecialchars($action);
                        }
 
                        echo '<b>',($error ? 'Error: '.$error : _BATCH_SUCCESS),'</b>';
@@ -839,13 +840,13 @@ class ADMIN {
 
                // start index
                if (postVar('start'))
-                       $start = postVar('start');
+                       $start = intPostVar('start');
                else
                        $start = 0;
 
                // amount of items to show
                if (postVar('amount'))
-                       $amount = postVar('amount');
+                       $amount = intPostVar('amount');
                else
                        $amount = 10;
 
@@ -891,13 +892,13 @@ class ADMIN {
 
                // start index
                if (postVar('start'))
-                       $start = postVar('start');
+                       $start = intPostVar('start');
                else
                        $start = 0;
 
                // amount of items to show
                if (postVar('amount'))
-                       $amount = postVar('amount');
+                       $amount = intPostVar('amount');
                else
                        $amount = 10;
 
@@ -932,13 +933,13 @@ class ADMIN {
 
                // start index
                if (postVar('start'))
-                       $start = postVar('start');
+                       $start = intPostVar('start');
                else
                        $start = 0;
 
                // amount of items to show
                if (postVar('amount'))
-                       $amount = postVar('amount');
+                       $amount = intPostVar('amount');
                else
                        $amount = 10;
 
@@ -985,13 +986,13 @@ class ADMIN {
 
                // start index
                if (postVar('start'))
-                       $start = postVar('start');
+                       $start = intPostVar('start');
                else
                        $start = 0;
 
                // amount of items to show
                if (postVar('amount'))
-                       $amount = postVar('amount');
+                       $amount = intPostVar('amount');
                else
                        $amount = 10;
 
@@ -1164,13 +1165,21 @@ class ADMIN {
                // edit the item for real
                ITEM::update($itemid, $catid, $title, $body, $more, $closed, $wasdraft, $publish, $timestamp);
 
-               if ($draftid > 0) {
+               $blogid = getBlogIDFromItemID($itemid);
+               $blog =& $manager->getBlog($blogid);
+
+               $isFuture = 0;
+               if ($timestamp > $blog->getCorrectTime(time())) {
+                       $isFuture = 1;
+               }
+
+               $this->updateFuturePosted($blogid);
+
+               if ($draftid > 0 && $member->canAlterItem($draftid)) {
                        ITEM::delete($draftid);
                }
 
-               $blogid = getBlogIDFromItemID($itemid);
-               $blog =& $manager->getBlog($blogid);
-               if (!$closed && $publish && $wasdraft && $blog->pingUserland()) {
+               if (!$closed && $publish && $wasdraft && $blog->sendPing() && numberOfEventSubscriber('SendPing') > 0 && !$isFuture) {
                        $this->action_sendping($blogid);
                        return;
                }
@@ -1261,8 +1270,33 @@ class ADMIN {
                if (!$member->canAlterItem($itemid))
                        return _ERROR_DISALLOWED;
 
+               // need to get blogid before the item is deleted
+               $blogid = getBlogIDFromItemId($itemid);
+
                $manager->loadClass('ITEM');
                ITEM::delete($itemid);
+
+               // update blog's futureposted
+               $this->updateFuturePosted($blogid);
+       }
+
+       /**
+        * Update a blog's future posted flag
+        * @param int $blogid
+        */
+       function updateFuturePosted($blogid) {
+               global $manager;
+
+               $blog =& $manager->getBlog($blogid);
+               $currenttime = $blog->getCorrectTime(time());
+               $result = sql_query("SELECT * FROM ".sql_table('item').
+                       " WHERE iblog='".$blogid."' AND iposted=0 AND itime>".mysqldate($currenttime));
+               if (mysql_num_rows($result) > 0) {
+                               $blog->setFuturePost();
+               }
+               else {
+                               $blog->clearFuturePost();
+               }
        }
 
        /**
@@ -1323,8 +1357,16 @@ class ADMIN {
                // only allow if user is allowed to alter item
                $member->canUpdateItem($itemid, $catid) or $this->disallow();
 
+               $old_blogid = getBlogIDFromItemId($itemid);
+
                ITEM::move($itemid, $catid);
 
+               // set the futurePosted flag on the blog
+               $this->updateFuturePosted(getBlogIDFromItemId($itemid));
+
+               // reset the futurePosted in case the item is moved from one blog to another
+               $this->updateFuturePosted($old_blogid);
+
                if ($catid != intRequestVar('catid'))
                        $this->action_categoryedit($catid, $blog->getID());
                else
@@ -1369,16 +1411,16 @@ class ADMIN {
                        $this->action_categoryedit(
                                $result['catid'],
                                $blogid,
-                               $blog->pingUserland() ? $pingUrl : ''
+                               $blog->sendPing() && numberOfEventSubscriber('SendPing') > 0 ? $pingUrl : ''
                        );
-               elseif ((postVar('actiontype') == 'addnow') && $blog->pingUserland())
+               elseif ((postVar('actiontype') == 'addnow') && $blog->sendPing() && numberOfEventSubscriber('SendPing') > 0)
                        $this->action_sendping($blogid);
                else
                        $this->action_itemlist($blogid);
        }
 
        /**
-        * Shows a window that says we're about to ping weblogs.com.
+        * Shows a window that says we're about to ping.
         * immediately refresh to the real pinging page, which will
         * show an error, or redirect to the blog.
         *
@@ -1396,12 +1438,10 @@ class ADMIN {
 
                $this->pagehead('<meta http-equiv="refresh" content="1; url='.htmlspecialchars($rawPingUrl).'" />');
                ?>
-               <h2>Site Updated, Now pinging weblogs.com</h2>
+               <h2>Site Updated, Now pinging various weblog listing services...</h2>
 
                <p>
-                       Pinging weblogs.com! This can a while...
-                       <br />
-                       When the ping is complete (and successfull), your weblog will show up in the weblogs.com updates list.
+                       This can take a while...
                </p>
 
                <p>
@@ -1411,7 +1451,6 @@ class ADMIN {
        }
 
        /**
-        * Ping to Weblogs.com
         * Sends the real ping (can take up to 10 seconds!)
         */
        function action_rawping() {
@@ -1421,17 +1460,19 @@ class ADMIN {
                $blogid = intRequestVar('blogid');
                $blog =& $manager->getBlog($blogid);
 
-               $result = $blog->sendUserlandPing();
-
                $this->pagehead();
 
                ?>
 
-               <h2>Ping Results</h2>
+               <h2>Pinging services, please wait...</h2>
+               <div class='note'>
+                <?php
 
-               <p>The following message was returned by weblogs.com:</p>
+               // send sendPing event
+               $manager->notify('SendPing', array('blogid' => $blogid));
 
-               <div class='note'><?php echo  $result ?></div>
+                ?>
+                </div>
 
                <ul>
                        <li><a href="index.php?action=itemlist&amp;blogid=<?php echo $blog->getID()?>">View list of recent items for <?php echo htmlspecialchars($blog->getName())?></a></li>
@@ -1667,7 +1708,7 @@ class ADMIN {
 
                echo '<h3>' . _MEMBERS_NEW .'</h3>';
                ?>
-                       <form method="post" action="index.php"><div>
+                       <form method="post" action="index.php" name="memberedit"><div>
 
                        <input type="hidden" name="action" value="memberadd" />
                        <?php $manager->addTicketHidden() ?>
@@ -1677,7 +1718,7 @@ class ADMIN {
                                <th colspan="2"><?php echo _MEMBERS_NEW?></th>
                        </tr><tr>
                                <td><?php echo _MEMBERS_DISPLAY?> <?php help('shortnames');?>
-                                       <br /><small>(This is the name used to logon)</small>
+                               <br /><small><?php echo _MEMBERS_DISPLAY_INFO?></small>
                                </td>
                                <td><input tabindex="10010" name="name" size="16" maxlength="16" /></td>
                        </tr><tr>
@@ -1747,7 +1788,7 @@ class ADMIN {
                $mem = MEMBER::createFromID($memberid);
 
                ?>
-               <form method="post" action="index.php"><div>
+               <form method="post" action="index.php" name="memberedit"><div>
 
                <input type="hidden" name="action" value="changemembersettings" />
                <input type="hidden" name="memberid" value="<?php echo  $memberid; ?>" />
@@ -1795,7 +1836,7 @@ class ADMIN {
                                <td><?php $this->input_yesno('admin',$mem->isAdmin(),60); ?></td>
                        </tr><tr>
                                <td><?php echo _MEMBERS_CANLOGIN?> <?php help('canlogin'); ?></td>
-                               <td><?php $this->input_yesno('canlogin',$mem->canLogin(),70); ?></td>
+                               <td><?php $this->input_yesno('canlogin',$mem->canLogin(),70,1,0,_YES,_NO,$mem->isAdmin()); ?></td>
                <?php } ?>
                </tr><tr>
                        <td><?php echo _MEMBERS_NOTES?></td>
@@ -2261,7 +2302,7 @@ class ADMIN {
                ?>
                        <h2><?php echo _DELETE_CONFIRM?></h2>
 
-                       <p><?php echo _CONFIRMTXT_TEAM1?><b><?php echo  $teammem->getDisplayName() ?></b><?php echo _CONFIRMTXT_TEAM2?><b><?php echo  htmlspecialchars(strip_tags($blog->getName())) ?></b>
+                       <p><?php echo _CONFIRMTXT_TEAM1?><b><?php echo  htmlspecialchars($teammem->getDisplayName()) ?></b><?php echo _CONFIRMTXT_TEAM2?><b><?php echo  htmlspecialchars(strip_tags($blog->getName())) ?></b>
                        </p>
 
 
@@ -2308,11 +2349,11 @@ class ADMIN {
 
                // check if: - there remains at least one blog admin
                //           - (there remains at least one team member)
-               $tmem = MEMBER::createFromID($memberid);
+               $mem = MEMBER::createFromID($memberid);
 
                $manager->notify('PreDeleteTeamMember', array('member' => &$mem, 'blogid' => $blogid));
 
-               if ($tmem->isBlogAdmin($blogid)) {
+               if ($mem->isBlogAdmin($blogid)) {
                        // check if there are more blog members left and at least one admin
                        // (check for at least two admins before deletion)
                        $query = 'SELECT * FROM '.sql_table('team') . ' WHERE tblog='.$blogid.' and tadmin=1';
@@ -2478,9 +2519,15 @@ class ADMIN {
                                /><label for="notifyNewItem"><?php echo _EBLOG_NOTIFY_ITEM?></label>
                        </td>
                </tr><tr>
-                       <td><?php echo _EBLOG_PING?> <?php help('pinguserland'); ?></td>
-                       <td><?php $this->input_yesno('pinguserland',$blog->pingUserland(),85); ?></td>
+               <?php
+               if (numberOfEventSubscriber('SendPing') > 0) {
+               ?>
+                       <td><?php echo _EBLOG_PING?> <?php help('sendping'); ?></td>
+                       <td><?php $this->input_yesno('sendping',$blog->sendPing(),85); ?></td>
                </tr><tr>
+               <?php
+               }
+               ?>
                        <td><?php echo _EBLOG_MAXCOMMENTS?> <?php help('blogmaxcomments'); ?></td>
                        <td><input name="maxcomments" tabindex="90" size="3" value="<?php echo  htmlspecialchars($blog->getMaxComments()); ?>" /></td>
                </tr><tr>
@@ -2736,7 +2783,7 @@ class ADMIN {
                        <h2><?php echo _DELETE_CONFIRM?></h2>
 
                        <div>
-                       <?php echo _CONFIRMTXT_CATEGORY?><b><?php echo  $blog->getCategoryName($catid)?></b>
+                       <?php echo _CONFIRMTXT_CATEGORY?><b><?php echo  htmlspecialchars($blog->getCategoryName($catid))?></b>
                        </div>
 
                        <form method="post" action="index.php"><div>
@@ -2941,7 +2988,7 @@ class ADMIN {
                $blog->setDefaultSkin(intPostVar('defskin'));
                $blog->setDescription(trim(postVar('desc')));
                $blog->setPublic(postVar('public'));
-               $blog->setPingUserland(postVar('pinguserland'));
+               $blog->setPingUserland(postVar('sendping'));
                $blog->setConvertBreaks(intPostVar('convertbreaks'));
                $blog->setAllowPastPosting(intPostVar('allowpastposting'));
                $blog->setDefaultCategory(intPostVar('defcat'));
@@ -3060,7 +3107,7 @@ class ADMIN {
                ?>
                        <h2><?php echo _DELETE_CONFIRM?></h2>
 
-                       <p><?php echo _CONFIRMTXT_MEMBER?><b><?php echo  $mem->getDisplayName() ?></b>
+                       <p><?php echo _CONFIRMTXT_MEMBER?><b><?php echo htmlspecialchars($mem->getDisplayName()) ?></b>
                        </p>
 
                        <p>
@@ -3205,7 +3252,7 @@ class ADMIN {
                        <td><input name="timeoffset" tabindex="110" size="3" value="0" /></td>
                </tr><tr>
                        <td><?php echo _EBLOG_ADMIN?>
-                               <?php help('blogadmin'); ?>
+                               <?php help('teamadmin'); ?>
                        </td>
                        <td><?php echo _EBLOG_ADMIN_MSG?></td>
                </tr><tr>
@@ -3245,7 +3292,7 @@ class ADMIN {
                                'name' => &$bname,
                                'shortname' => &$bshortname,
                                'timeoffset' => &$btimeoffset,
-                               'description' => &$bdescription,
+                               'description' => &$bdesc,
                                'defaultskin' => &$bdefskin
                        )
                );
@@ -3290,6 +3337,9 @@ class ADMIN {
                $manager->notify(
                        'PostAddCategory',
                        array(
+                               'blog' => &$blog,
+                               'name' => 'General',
+                               'description' => 'Items that do not fit in other categories',
                                'catid' => $catid
                        )
                );
@@ -3719,7 +3769,7 @@ selector();
                <a href="index.php?action=templateoverview">(<?php echo _TEMPLATE_BACK?>)</a>
                </p>
 
-               <h2><?php echo _TEMPLATE_EDIT_TITLE?> '<?php echo  $templatename; ?>'</h2>
+               <h2><?php echo _TEMPLATE_EDIT_TITLE?> '<?php echo  htmlspecialchars($templatename); ?>'</h2>
 
                <?php                                   if ($msg) echo "<p>"._MESSAGE.": $msg</p>";
                ?>
@@ -3784,6 +3834,12 @@ selector();
        $this->_templateEditRow($template, _TEMPLATE_AFOOTER, 'ARCHIVELIST_FOOTER', '', 150);
 ?>
                </tr><tr>
+                       <th colspan="2"><?php echo _TEMPLATE_BLOGLIST?> <?php help('templatebloglists'); ?></th>
+<?php  $this->_templateEditRow($template, _TEMPLATE_BLOGHEADER, 'BLOGLIST_HEADER', '', 160);
+       $this->_templateEditRow($template, _TEMPLATE_BLOGITEM, 'BLOGLIST_LISTITEM', '', 170);
+       $this->_templateEditRow($template, _TEMPLATE_BLOGFOOTER, 'BLOGLIST_FOOTER', '', 180);
+?>
+               </tr><tr>
                        <th colspan="2"><?php echo _TEMPLATE_CATEGORYLIST?> <?php help('templatecategorylists'); ?></th>
 <?php  $this->_templateEditRow($template, _TEMPLATE_CATHEADER, 'CATLIST_HEADER', '', 160);
        $this->_templateEditRow($template, _TEMPLATE_CATITEM, 'CATLIST_LISTITEM', '', 170);
@@ -3889,6 +3945,9 @@ selector();
                $this->addToTemplate($templateid, 'ARCHIVELIST_HEADER', postVar('ARCHIVELIST_HEADER'));
                $this->addToTemplate($templateid, 'ARCHIVELIST_LISTITEM', postVar('ARCHIVELIST_LISTITEM'));
                $this->addToTemplate($templateid, 'ARCHIVELIST_FOOTER', postVar('ARCHIVELIST_FOOTER'));
+               $this->addToTemplate($templateid, 'BLOGLIST_HEADER', postVar('BLOGLIST_HEADER'));
+               $this->addToTemplate($templateid, 'BLOGLIST_LISTITEM', postVar('BLOGLIST_LISTITEM'));
+               $this->addToTemplate($templateid, 'BLOGLIST_FOOTER', postVar('BLOGLIST_FOOTER'));
                $this->addToTemplate($templateid, 'CATLIST_HEADER', postVar('CATLIST_HEADER'));
                $this->addToTemplate($templateid, 'CATLIST_LISTITEM', postVar('CATLIST_LISTITEM'));
                $this->addToTemplate($templateid, 'CATLIST_FOOTER', postVar('CATLIST_FOOTER'));
@@ -3947,7 +4006,7 @@ selector();
                        <h2><?php echo _DELETE_CONFIRM?></h2>
 
                        <p>
-                       <?php echo _CONFIRMTXT_TEMPLATE?><b><?php echo $name?></b> (<?php echo  htmlspecialchars($desc) ?>)
+                       <?php echo _CONFIRMTXT_TEMPLATE?><b><?php echo htmlspecialchars($name)?></b> (<?php echo  htmlspecialchars($desc) ?>)
                        </p>
 
                        <form method="post" action="index.php"><div>
@@ -4161,7 +4220,7 @@ selector();
                        $tabstart = 75;
 
                        while ($row = mysql_fetch_assoc($res)) {
-                               echo '<li><a tabindex="' . ($tabstart++) . '" href="index.php?action=skinedittype&amp;skinid=' . $skinid . '&amp;type=' . strtolower($row['stype']) . '">' . ucfirst($row['stype']) . '</a> (<a tabindex="' . ($tabstart++) . '" href="index.php?action=skinremovetype&amp;skinid=' . $skinid . '&amp;type=' . strtolower($row['stype']) . '">remove</a>)</li>';
+                               echo '<li><a tabindex="' . ($tabstart++) . '" href="index.php?action=skinedittype&amp;skinid=' . $skinid . '&amp;type=' . htmlspecialchars(strtolower($row['stype'])) . '">' . htmlspecialchars(ucfirst($row['stype'])) . '</a> (<a tabindex="' . ($tabstart++) . '" href="index.php?action=skinremovetype&amp;skinid=' . $skinid . '&amp;type=' . htmlspecialchars(strtolower($row['stype'])) . '">remove</a>)</li>';
                        }
 
                        echo '</ul>';
@@ -4264,7 +4323,7 @@ selector();
                ?>
                <p>(<a href="index.php?action=skinoverview"><?php echo _SKIN_GOBACK?></a>)</p>
 
-               <h2><?php echo _SKIN_EDITPART_TITLE?> '<?php echo  $skin->getName() ?>': <?php echo (isset($friendlyNames[$type]) ? $friendlyNames[$type] : ucfirst($type)); ?></h2>
+               <h2><?php echo _SKIN_EDITPART_TITLE?> '<?php echo htmlspecialchars($skin->getName()) ?>': <?php echo htmlspecialchars(isset($friendlyNames[$type]) ? $friendlyNames[$type] : ucfirst($type)); ?></h2>
 
                <?php                   if ($msg) echo "<p>"._MESSAGE.": $msg</p>";
                ?>
@@ -4280,8 +4339,12 @@ selector();
 
                <input type="submit" value="<?php echo _SKIN_UPDATE_BTN?>" onclick="return checkSubmit();" />
                <input type="reset" value="<?php echo _SKIN_RESET_BTN?>" />
-               (skin type: <?php echo (isset($friendlyNames[$type]) ? $friendlyNames[$type] : ucfirst($type)); ?>)
-               <?php help('skinpart' . $type);?>
+               (skin type: <?php echo htmlspecialchars(isset($friendlyNames[$type]) ? $friendlyNames[$type] : ucfirst($type)); ?>)
+               <?php if (in_array($type, array('index', 'item', 'archivelist', 'archive', 'search', 'error', 'member', 'imagepopup'))) {
+                       help('skinpart' . $type);
+               } else {
+                       help('skinpartspecial');
+               }?>
                <br />
 
                <textarea class="skinedit" tabindex="10" rows="20" cols="80" name="content"><?php echo  htmlspecialchars($skin->getContent($type)) ?></textarea>
@@ -4289,7 +4352,7 @@ selector();
                <br />
                <input type="submit" tabindex="20" value="<?php echo _SKIN_UPDATE_BTN?>" onclick="return checkSubmit();" />
                <input type="reset" value="<?php echo _SKIN_RESET_BTN?>" />
-               (skin type: <?php echo (isset($friendlyNames[$type]) ? $friendlyNames[$type] : ucfirst($type)); ?>)
+               (skin type: <?php echo htmlspecialchars(isset($friendlyNames[$type]) ? $friendlyNames[$type] : ucfirst($type)); ?>)
 
                <br /><br />
                <?php echo _SKIN_ALLOWEDVARS?>
@@ -4363,7 +4426,7 @@ selector();
                $query = 'SELECT bname FROM '.sql_table('blog').' WHERE bdefskin=' . $skinid;
                $r = sql_query($query);
                if ($o = mysql_fetch_object($r))
-                       $this->error(_ERROR_SKINDEFDELETE . $o->bname);
+                       $this->error(_ERROR_SKINDEFDELETE . htmlspecialchars($o->bname));
 
                $this->pagehead();
 
@@ -4375,7 +4438,7 @@ selector();
                        <h2><?php echo _DELETE_CONFIRM?></h2>
 
                        <p>
-                               <?php echo _CONFIRMTXT_SKIN?><b><?php echo  $name ?></b> (<?php echo  htmlspecialchars($desc)?>)
+                               <?php echo _CONFIRMTXT_SKIN?><b><?php echo htmlspecialchars($name) ?></b> (<?php echo  htmlspecialchars($desc)?>)
                        </p>
 
                        <form method="post" action="index.php"><div>
@@ -4451,14 +4514,14 @@ selector();
                        <h2><?php echo _DELETE_CONFIRM?></h2>
 
                        <p>
-                               <?php echo _CONFIRMTXT_SKIN_PARTS_SPECIAL; ?> <b><?php echo $skintype; ?> (<?php echo $name; ?>)</b> (<?php echo  htmlspecialchars($desc)?>)
+                               <?php echo _CONFIRMTXT_SKIN_PARTS_SPECIAL; ?> <b><?php echo htmlspecialchars($skintype); ?> (<?php echo htmlspecialchars($name); ?>)</b> (<?php echo  htmlspecialchars($desc)?>)
                        </p>
 
                        <form method="post" action="index.php"><div>
                                <input type="hidden" name="action" value="skinremovetypeconfirm" />
                                <?php $manager->addTicketHidden() ?>
                                <input type="hidden" name="skinid" value="<?php echo $skinid; ?>" />
-                               <input type="hidden" name="type" value="<?php echo $skintype; ?>" />
+                               <input type="hidden" name="type" value="<?php echo htmlspecialchars($skintype); ?>" />
                                <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN?>" />
                        </div></form>
                <?php
@@ -5730,7 +5793,7 @@ selector();
                if ($manager->pluginInstalled($name))
                        $this->error(_ERROR_DUPPLUGIN);
                if (!checkPlugin($name))
-                       $this->error(_ERROR_PLUGFILEERROR . ' (' . $name . ')');
+                       $this->error(_ERROR_PLUGFILEERROR . ' (' . htmlspecialchars($name) . ')');
 
                // get number of currently installed plugins
                $res = sql_query('SELECT * FROM '.sql_table('plugin'));
@@ -5771,7 +5834,7 @@ selector();
                        $this->deleteOnePlugin($plugin->getID());
 
                        // ...and show error
-                       $this->error(_ERROR_NUCLEUSVERSIONREQ . $plugin->getMinNucleusVersion());
+                       $this->error(_ERROR_NUCLEUSVERSIONREQ . htmlspecialchars($plugin->getMinNucleusVersion()));
                }
 
                // check if plugin needs a newer Nucleus version
@@ -5781,7 +5844,7 @@ selector();
                        $this->deleteOnePlugin($plugin->getID());
 
                        // ...and show error
-                       $this->error(_ERROR_NUCLEUSVERSIONREQ . $plugin->getMinNucleusVersion() . ' patch ' . $plugin->getMinNucleusPatchLevel());
+                       $this->error(_ERROR_NUCLEUSVERSIONREQ . htmlspecialchars( $plugin->getMinNucleusVersion() . ' patch ' . $plugin->getMinNucleusPatchLevel() ) );
                }
 
                $pluginList = $plugin->getPluginDep();
@@ -5794,7 +5857,7 @@ selector();
                                // uninstall plugin again...
                                $this->deleteOnePlugin($plugin->getID());
 
-                               $this->error(_ERROR_INSREQPLUGIN . $pluginName);
+                               $this->error(_ERROR_INSREQPLUGIN . htmlspecialchars($pluginName));
                        }
                }
 
@@ -5982,7 +6045,9 @@ selector();
                sql_query('UPDATE '.sql_table('plugin').' SET porder='.$oldOrder.' WHERE porder='.$newOrder);
                sql_query('UPDATE '.sql_table('plugin').' SET porder='.$newOrder.' WHERE pid='.$plugid);
 
-               $this->action_pluginlist();
+               //$this->action_pluginlist();
+               // To avoid showing ticket in the URL, redirect to pluginlist, instead.
+               redirect('?action=pluginlist');
        }
 
        /**
@@ -6013,7 +6078,9 @@ selector();
                sql_query('UPDATE '.sql_table('plugin').' SET porder='.$oldOrder.' WHERE porder='.$newOrder);
                sql_query('UPDATE '.sql_table('plugin').' SET porder='.$newOrder.' WHERE pid='.$plugid);
 
-               $this->action_pluginlist();
+               //$this->action_pluginlist();
+               // To avoid showing ticket in the URL, redirect to pluginlist, instead.
+               redirect('?action=pluginlist');
        }
 
        /**
@@ -6174,21 +6241,32 @@ selector();
         * Helper functions to create option forms etc.
         * @todo document parameters
         */
-       function input_yesno($name, $checkedval,$tabindex = 0, $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO) {
+       function input_yesno($name, $checkedval,$tabindex = 0, $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO, $isAdmin = 0) {
                $id = htmlspecialchars($name);
                $id = str_replace('[','-',$id);
                $id = str_replace(']','-',$id);
                $id1 = $id . htmlspecialchars($value1);
                $id2 = $id . htmlspecialchars($value2);
 
-               echo '<input type="radio" name="', htmlspecialchars($name),'" value="', htmlspecialchars($value1),'" ';
+               if ($name=="admin") {
+                       echo '<input onclick="selectCanLogin(true);" type="radio" name="', htmlspecialchars($name),'" value="', htmlspecialchars($value1),'" ';
+               } else {
+                       echo '<input type="radio" name="', htmlspecialchars($name),'" value="', htmlspecialchars($value1),'" ';
+               }
+
                        if ($checkedval == $value1)
                                echo "tabindex='$tabindex' checked='checked'";
                        echo ' id="'.$id1.'" /><label for="'.$id1.'">' . $yesval . '</label>';
                echo ' ';
-               echo '<input type="radio" name="', htmlspecialchars($name),'" value="', htmlspecialchars($value2),'" ';
+               if ($name=="admin") {
+                       echo '<input onclick="selectCanLogin(false);" type="radio" name="', htmlspecialchars($name),'" value="', htmlspecialchars($value2),'" ';
+               } else {
+                       echo '<input type="radio" name="', htmlspecialchars($name),'" value="', htmlspecialchars($value2),'" ';
+               }
                        if ($checkedval != $value1)
                                echo "tabindex='$tabindex' checked='checked'";
+                       if ($isAdmin && $name=="canlogin")
+                               echo " disabled='true'";
                        echo ' id="'.$id2.'" /><label for="'.$id2.'">' . $noval . '</label>';
        }