/**
*
* Send weblog updates ping
- * plugin for NucleusCMS(version 3.30 or lator)
- * Note: based on NP_PingPong, adapt for the new ping mechanism
+ * plugin for NucleusCMS(version 3.30 or lator)
+ * Note: based on NP_PingPong, adapt for the new ping mechanism
* PHP versions 4 and 5
*
* This program is free software; you can redistribute it and/or
* of the License, or (at your option) any later version.
* (see nucleus/documentation/index.html#license for more info)
*
- * @author admun (Edmond Hui)
+ * @author admun (Edmond Hui)
* @license http://www.gnu.org/licenses/gpl.txt GNU GENERAL PUBLIC LICENSE Version 2, June 1991
* @version 1.8
- * @link http://edmondhui.homeip.net/nudn
+ * @link http://edmondhui.homeip.net/nudn
* $id$
* History
* v1.0 - Initial version
* v1.5 - remove arg1 in exec() call
* v1.6 - move send update ping override option to plugin
* v1.7 - move send ping option from blog to plugin/blog level
- * - remove ping override option
+ * - remove ping override option
* v1.8 - remove sendPing event handle, switch to use PostAddItem and PostUpdateItem event for new item ping
* v1.81 - fix bug in _sendPingCheck() where ITEM class not found when creating new weblog
*/
-class NP_Ping extends NucleusPlugin
-{
-
- function getName()
- {
- return 'Ping';
- }
-
- function getAuthor()
- {
- return 'admun (Edmond Hui)';
- }
-
- function getURL()
- {
- return 'http://edmondhui.homeip.net/nudn';
- }
-
- function getVersion()
- {
- return '1.81';
- }
-
- function getMinNucleusVersion()
- {
- return '330';
- }
-
- function getDescription()
- {
- return _PING_DESC;
- }
-
- function supportsFeature($what)
- {
- switch($what) {
- case 'SqlTablePrefix':
- return 1;
- default:
- return 0;
- }
- }
-
- function init()
- {
-// $language = ereg_replace( '[\\|/]', '', getLanguageName());
- $language = preg_replace( '@\\|/@', '', getLanguageName());
- if (file_exists($this->getDirectory() . $language . '.php')) {
- include_once($this->getDirectory() . $language . '.php');
- } else {
- include_once($this->getDirectory() . 'english.php');
- }
- }
-
- function install()
- {
- // Default, http://pingomatic.com
- $this->createOption('pingpong_pingomatic', _PING_PINGOM, 'yesno', 'yes');
- // http://weblogs.com
- $this->createOption('pingpong_weblogs', _PING_WEBLOGS, 'yesno', 'no');
- // http://www.technorati.com
- $this->createOption('pingpong_technorati', _PING_TECHNOR, 'yesno', 'no');
- // http://www.blogrolling.com
- $this->createOption('pingpong_blogrolling', _PING_BLOGR, 'yesno', 'no');
- // http://blo.gs
- $this->createOption('pingpong_blogs', _PING_BLOGS, 'yesno', 'no');
- // http://weblogues.com/
- $this->createOption('pingpong_weblogues', _PING_WEBLOGUES, 'yesno', 'no');
- // http://blogg.de
- $this->createOption('pingpong_bloggde', _PING_BLOGGDE, 'yesno', 'no');
-
- // Pinging on background
- $this->createOption('ping_background', _PING_BG, 'yesno', 'no');
-
- $this->createBlogOption('ping_sendping', _PING_SENDPING, 'yesno', 'yes');
- }
-
- function getEventList()
- {
- return array(
- 'JustPosted',
- 'PostAddItem',
- 'PostUpdateItem'
- );
- }
-
- function event_JustPosted($data)
- {
- global $DIR_PLUGINS, $DIR_NUCLEUS;
-
- // exit is another plugin already send ping
- if ($data['pinged'] == true) {
- return;
- }
-
- $bid = intval($data['blogid']);
- if ($this->getBlogOption($bid, 'ping_sendping') == "yes") {
- if ($this->getOption('ping_background') == "yes") {
- exec("php $DIR_PLUGINS/ping/ping.php " . $data['blogid'] . " &");
- } else {
- $this->sendPings($data['blogid']);
- }
- }
- // mark the ping has been sent
- $data['pinged'] = true;
- }
-
- function event_PostAddItem($data)
- {
-// global $manager;
-// $blogId = getBlogIDFromItemID($data['itemid']);
-// $item =& ITEM::getitem($data['itemid'], 0, 0); // draft or future post return 0
-// if ($item != 0) {
-// if ($this->getBlogOption($blogId, 'ping_sendping') == "yes") {
-// $this->sendPings(array('blogid' => $blogId));
-// }
-// }
- $this->_sendPingCheck($data['itemid']);
- }
-
- function event_PostUpdateItem($data)
- {
-// global $manager;
-// $blogId = getBlogIDFromItemID($data['itemid']);
-// $blog =& $manager->getBlog($blogId); // <- why?
-// $item =& ITEM::getitem($data['itemid'], 0, 0); // draft or future post return 0
-// if ($item != 0) {
-// if ($this->getBlogOption($blogId,'ping_sendping') == "yes" ) {
-// $this->sendPings(array('blogid' => $blogId));
-// }
-// }
- $this->_sendPingCheck($data['itemid']);
- }
-
- function _sendPingCheck($itemid)
- {
- $iid = intval($itemid);
- global $manager;
+class NP_Ping extends NucleusPlugin {
+ public function getName() { return 'Ping'; }
+ public function getAuthor() { return 'admun (Edmond Hui)'; }
+ public function getURL() { return 'http://edmondhui.homeip.net/nudn'; }
+ public function getVersion() { return '1.81'; }
+ public function getMinNucleusVersion() { return '330'; }
+ public function getDescription() { return _PING_DESC; }
+ public function supportsFeature($feature) { return in_array ($feature, array ('SqlTablePrefix', 'SqlApi'));}
+ public function getEventList() { return array('JustPosted', 'PostAddItem', 'PostUpdateItem'); }
+
+ public function init() {
+ $language = preg_replace( '#\\\\|/#', '', getLanguageName());
+ if (file_exists($this->getDirectory() . $language . '.php')) {
+ include_once($this->getDirectory() . $language . '.php');
+ } else {
+ include_once($this->getDirectory() . 'english.php');
+ }
+ return;
+ }
+
+ public function install() {
+ // Default, http://pingomatic.com
+ $this->createOption('pingpong_pingomatic', _PING_PINGOM, 'yesno', 'yes');
+ // http://weblogs.com
+ $this->createOption('pingpong_weblogs', _PING_WEBLOGS, 'yesno', 'no');
+ // http://www.technorati.com
+ $this->createOption('pingpong_technorati', _PING_TECHNOR, 'yesno', 'no');
+ // http://www.blogrolling.com
+ $this->createOption('pingpong_blogrolling', _PING_BLOGR, 'yesno', 'no');
+ // http://blo.gs
+ $this->createOption('pingpong_blogs', _PING_BLOGS, 'yesno', 'no');
+ // http://weblogues.com/
+ $this->createOption('pingpong_weblogues', _PING_WEBLOGUES, 'yesno', 'no');
+ // http://blogg.de
+ $this->createOption('pingpong_bloggde', _PING_BLOGGDE, 'yesno', 'no');
+
+ // Pinging on background
+ $this->createOption('ping_background', _PING_BG, 'yesno', 'no');
+
+ $this->createBlogOption('ping_sendping', _PING_SENDPING, 'yesno', 'yes');
+ return;
+ }
+
+ public function unInstall {
+ return;
+ }
+
+ public function event_JustPosted($data) {
+ global $DIR_PLUGINS, $DIR_NUCLEUS;
+
+ if ($data['pinged'] == true) {
+ return;
+ }
+
+ $bid = intval($data['blogid']);
+ if ($this->getBlogOption($bid, 'ping_sendping') == "yes") {
+ if ($this->getOption('ping_background') == "yes") {
+ exec("php $DIR_PLUGINS/ping/ping.php " . $data['blogid'] . " &");
+ } else {
+ $this->sendPings($data['blogid']);
+ }
+ }
+ // mark the ping has been sent
+ $data['pinged'] = true;
+ return;
+ }
+
+ public function event_PostAddItem($data) {
+// global $manager;
+// $blogId = getBlogIDFromItemID($data['itemid']);
+// $item =& ITEM::getitem($data['itemid'], 0, 0); // draft or future post return 0
+// if ($item != 0) {
+// if ($this->getBlogOption($blogId, 'ping_sendping') == "yes") {
+// $this->sendPings(array('blogid' => $blogId));
+// }
+// }
+ $this->_sendPingCheck($data['itemid']);
+ return;
+ }
+
+ public function event_PostUpdateItem($data) {
+// global $manager;
+// $blogId = getBlogIDFromItemID($data['itemid']);
+// $blog =& $manager->getBlog($blogId); // <- why?
+// $item =& ITEM::getitem($data['itemid'], 0, 0); // draft or future post return 0
+// if ($item != 0) {
+// if ($this->getBlogOption($blogId,'ping_sendping') == "yes" ) {
+// $this->sendPings(array('blogid' => $blogId));
+// }
+// }
+ $this->_sendPingCheck($data['itemid']);
+ return;
+ }
+
+ private function _sendPingCheck($itemid) {
+ $iid = intval($itemid);
+ global $manager;
$item = $manager->getItem($iid,0,0);
- if ($item) {
- $bid = intval(getBlogIDFromItemID($iid));
- if ($this->getBlogOption($bid, 'ping_sendping') == "yes" ) {
- $this->sendPings(array('blogid' => $bid));
- }
- }
- }
-
- function sendPings($data) {
-
- if (!class_exists('xmlrpcmsg')) {
- include_libs('xmlrpc.inc.php');
- }
- $this->myBlogId = $data['blogid'];
-
- $ping_result = '';
-
- if ($this->getOption('pingpong_pingomatic') == 'yes') {
- $ping_result .= _PINGING . "Ping-o-matic:\n";
- $ping_result .= $this->pingPingomatic();
- $ping_result .= " | ";
- }
-
- if ($this->getOption('pingpong_weblogs') == 'yes') {
- $ping_result .= _PINGING . "Weblogs.com:\n";
- $ping_result .= $this->pingWeblogs();
- $ping_result .= " | ";
- }
-
- if ($this->getOption('pingpong_technorati') == 'yes') {
- $ping_result .= _PINGING . "Technorati:\n";
- $ping_result .= $this->pingTechnorati();
- $ping_result .= " | ";
- }
-
- if ($this->getOption('pingpong_blogrolling') == 'yes') {
- $ping_result .= _PINGING . "Blogrolling.com:\n";
- $ping_result .= $this->pingBlogRollingDotCom();
- $ping_result .= " | ";
- }
-
- if ($this->getOption('pingpong_blogs') == 'yes') {
- $ping_result .= _PINGING . "Blog.gs:\n";
- $ping_result .= $this->pingBloGs();
- $ping_result .= " | ";
- }
-
- if ($this->getOption('pingpong_weblogues') == 'yes') {
- $ping_result .= _PINGING . "Weblogues.com:\n";
- $ping_result .= $this->pingWebloguesDotCom();
- $ping_result .= " | ";
- }
-
- if ($this->getOption('pingpong_bloggde') == 'yes') {
- $ping_result .= _PINGING . "Blog.de:\n";
- $ping_result .= $this->pingBloggDe();
- $ping_result .= " | ";
- }
-
- ACTIONLOG::add(INFO, $ping_result);
- }
-
- function pingPingomatic() {
- $b = new BLOG($this->myBlogId);
- $message = new xmlrpcmsg(
- 'weblogUpdates.ping',
- array(
- new xmlrpcval($b->getName(), 'string'),
- new xmlrpcval($b->getURL(), 'string')
- )
- );
-
- $c = new xmlrpc_client('/', 'rpc.pingomatic.com', 80);
- //$c->setDebug(1);
-
- $r = $c->send($message,30); // 30 seconds timeout...
- return $this->processPingResult($r);
- }
-
- function pingWeblogs() {
- $b = new BLOG($this->myBlogId);
- $message = new xmlrpcmsg(
- 'weblogupdates.ping',
- array(
- new xmlrpcval($b->getName(), 'string'),
- new xmlrpcval($b->getURL(), 'string')
- )
- );
-
- $c = new xmlrpc_client('/rpc2', 'rpc.weblogs.com', 80);
- //$c->setdebug(1);
-
- $r = $c->send($message,30); // 30 seconds timeout...
- return $this->processPingResult($r);
- }
-
- function pingTechnorati() {
- $b = new BLOG($this->myBlogId);
- $message = new xmlrpcmsg(
- 'weblogUpdates.ping',
- array(
- new xmlrpcval($b->getName(),'string'),
- new xmlrpcval($b->getURL(),'string')
- )
- );
-
- $c = new xmlrpc_client('/rpc/ping/', 'rpc.technorati.com', 80);
- //$c->setDebug(1);
-
- $r = $c->send($message,30); // 30 seconds timeout...
- return $this->processPingResult($r);
- }
-
- function pingBlogRollingDotCom() {
- $b = new BLOG($this->myBlogId);
- $message = new xmlrpcmsg(
- 'weblogUpdates.ping',
- array(
- new xmlrpcval($b->getName(),'string'),
- new xmlrpcval($b->getURL(),'string')
- )
- );
-
- $c = new xmlrpc_client('/pinger/', 'rpc.blogrolling.com', 80);
- //$c->setDebug(1);
-
- $r = $c->send($message,30); // 30 seconds timeout...
- return $this->processPingResult($r);
- }
-
- function pingBloGs() {
- $b = new BLOG($this->myBlogId);
- $message = new xmlrpcmsg(
- 'weblogUpdates.extendedPing',
- array(
- new xmlrpcval($b->getName(),'string'),
- new xmlrpcval($b->getURL(),'string')
- )
- );
-
- $c = new xmlrpc_client('/', 'ping.blo.gs', 80);
- //$c->setDebug(1);
-
- $r = $c->send($message,30); // 30 seconds timeout...
- return $this->processPingResult($r);
- }
-
- function pingWebloguesDotCom() {
- $b = new BLOG($this->myBlogId);
- $message = new xmlrpcmsg(
- 'weblogUpdates.extendedPing',
- array(
- new xmlrpcval($b->getName(),'string'),
- new xmlrpcval($b->getURL(),'string')
- )
- );
-
- $c = new xmlrpc_client('/RPC/', 'www.weblogues.com', 80);
- //$c->setDebug(1);
-
- $r = $c->send($message,30); // 30 seconds timeout...
- return $this->processPingResult($r);
- }
-
- function pingBloggDe() {
- $b = new BLOG($this->myBlogId);
- $message = new xmlrpcmsg(
- 'bloggUpdates.ping',
- array(
- new xmlrpcval($b->getName(),'string'),
- new xmlrpcval($b->getURL(),'string')
- )
- );
-
- $c = new xmlrpc_client('/', 'xmlrpc.blogg.de', 80);
- //$c->setDebug(1);
-
- $r = $c->send($message,30); // 30 seconds timeout...
- return $this->processPingResult($r);
- }
-
- function processPingResult($r) {
- global $php_errormsg;
-
- if (($r == 0) && ($r->errno || $r->errstring)) {
- return _PING_ERROR . " " . $r->errno . ' : ' . $r->errstring;
- } elseif (($r == 0) && ($php_errormsg)) {
- return _PING_PHP_ERROR . $php_errormsg;
- } elseif ($r == 0) {
- return _PING_PHP_PING_ERROR;
- } elseif ($r->faultCode() != 0) {
- return _PING_ERROR . ': ' . $r->faultString();
- } else {
- $r = $r->value(); // get response struct
-
- // get values
- $flerror = $r->structmem('flerror');
- $flerror = $flerror->scalarval();
-
- $message = $r->structmem('message');
- $message = $message->scalarval();
-
- if ($flerror != 0) {
- return _PING_ERROR . ' (flerror=1): ' . $message;
- } else {
- return _PING_SUCCESS . ': ' . $message;
- }
- }
- }
+ if ($item) {
+ $bid = intval(getBlogIDFromItemID($iid));
+ if ($this->getBlogOption($bid, 'ping_sendping') == "yes" ) {
+ $this->sendPings(array('blogid' => $bid));
+ }
+ }
+ return;
+ }
+
+ public function sendPings($data) {
+ if (!class_exists('xmlrpcmsg')) {
+ include_libs('xmlrpc.inc.php');
+ }
+
+ $this->myBlogId = $data['blogid'];
+
+ $ping_result = '';
+
+ if ($this->getOption('pingpong_pingomatic') == 'yes') {
+ $ping_result .= _PINGING . "Ping-o-matic:\n";
+ $ping_result .= $this->pingPingomatic();
+ $ping_result .= " | ";
+ }
+
+ if ($this->getOption('pingpong_weblogs') == 'yes') {
+ $ping_result .= _PINGING . "Weblogs.com:\n";
+ $ping_result .= $this->pingWeblogs();
+ $ping_result .= " | ";
+ }
+
+ if ($this->getOption('pingpong_technorati') == 'yes') {
+ $ping_result .= _PINGING . "Technorati:\n";
+ $ping_result .= $this->pingTechnorati();
+ $ping_result .= " | ";
+ }
+
+ if ($this->getOption('pingpong_blogrolling') == 'yes') {
+ $ping_result .= _PINGING . "Blogrolling.com:\n";
+ $ping_result .= $this->pingBlogRollingDotCom();
+ $ping_result .= " | ";
+ }
+
+ if ($this->getOption('pingpong_blogs') == 'yes') {
+ $ping_result .= _PINGING . "Blog.gs:\n";
+ $ping_result .= $this->pingBloGs();
+ $ping_result .= " | ";
+ }
+
+ if ($this->getOption('pingpong_weblogues') == 'yes') {
+ $ping_result .= _PINGING . "Weblogues.com:\n";
+ $ping_result .= $this->pingWebloguesDotCom();
+ $ping_result .= " | ";
+ }
+
+ if ($this->getOption('pingpong_bloggde') == 'yes') {
+ $ping_result .= _PINGING . "Blog.de:\n";
+ $ping_result .= $this->pingBloggDe();
+ $ping_result .= " | ";
+ }
+
+ ACTIONLOG::add(INFO, $ping_result);
+ return;
+ }
+
+ public function pingPingomatic() {
+ $b = new BLOG($this->myBlogId);
+ $message = new xmlrpcmsg(
+ 'weblogUpdates.ping',
+ array(
+ new xmlrpcval($b->getName(), 'string'),
+ new xmlrpcval($b->getURL(), 'string')
+ )
+ );
+
+ $c = new xmlrpc_client('/', 'rpc.pingomatic.com', 80);
+ //$c->setDebug(1);
+
+ // 30 seconds timeout...
+ $r = $c->send($message,30);
+ return $this->processPingResult($r);
+ }
+
+ public function pingWeblogs() {
+ $b = new BLOG($this->myBlogId);
+ $message = new xmlrpcmsg(
+ 'weblogupdates.ping',
+ array(
+ new xmlrpcval($b->getName(), 'string'),
+ new xmlrpcval($b->getURL(), 'string')
+ )
+ );
+
+ $c = new xmlrpc_client('/rpc2', 'rpc.weblogs.com', 80);
+ //$c->setdebug(1);
+
+ // 30 seconds timeout...
+ $r = $c->send($message,30);
+ return $this->processPingResult($r);
+ }
+
+ public function pingTechnorati() {
+ $b = new BLOG($this->myBlogId);
+ $message = new xmlrpcmsg(
+ 'weblogUpdates.ping',
+ array(
+ new xmlrpcval($b->getName(),'string'),
+ new xmlrpcval($b->getURL(),'string')
+ )
+ );
+
+ $c = new xmlrpc_client('/rpc/ping/', 'rpc.technorati.com', 80);
+ //$c->setDebug(1);
+
+ // 30 seconds timeout...
+ $r = $c->send($message,30);
+ return $this->processPingResult($r);
+ }
+
+ public function pingBlogRollingDotCom() {
+ $b = new BLOG($this->myBlogId);
+ $message = new xmlrpcmsg(
+ 'weblogUpdates.ping',
+ array(
+ new xmlrpcval($b->getName(),'string'),
+ new xmlrpcval($b->getURL(),'string')
+ )
+ );
+
+ $c = new xmlrpc_client('/pinger/', 'rpc.blogrolling.com', 80);
+ //$c->setDebug(1);
+
+ // 30 seconds timeout...
+ $r = $c->send($message,30);
+ return $this->processPingResult($r);
+ }
+
+ public function pingBloGs() {
+ $b = new BLOG($this->myBlogId);
+ $message = new xmlrpcmsg(
+ 'weblogUpdates.extendedPing',
+ array(
+ new xmlrpcval($b->getName(),'string'),
+ new xmlrpcval($b->getURL(),'string')
+ )
+ );
+
+ $c = new xmlrpc_client('/', 'ping.blo.gs', 80);
+ //$c->setDebug(1);
+
+ // 30 seconds timeout...
+ $r = $c->send($message,30);
+ return $this->processPingResult($r);
+ }
+
+ public function pingWebloguesDotCom() {
+ $b = new BLOG($this->myBlogId);
+ $message = new xmlrpcmsg(
+ 'weblogUpdates.extendedPing',
+ array(
+ new xmlrpcval($b->getName(),'string'),
+ new xmlrpcval($b->getURL(),'string')
+ )
+ );
+
+ $c = new xmlrpc_client('/RPC/', 'www.weblogues.com', 80);
+ //$c->setDebug(1);
+
+ // 30 seconds timeout...
+ $r = $c->send($message,30);
+ return $this->processPingResult($r);
+ }
+
+ public function pingBloggDe() {
+ $b = new BLOG($this->myBlogId);
+ $message = new xmlrpcmsg(
+ 'bloggUpdates.ping',
+ array(
+ new xmlrpcval($b->getName(),'string'),
+ new xmlrpcval($b->getURL(),'string')
+ )
+ );
+
+ $c = new xmlrpc_client('/', 'xmlrpc.blogg.de', 80);
+ //$c->setDebug(1);
+
+ // 30 seconds timeout...
+ $r = $c->send($message,30);
+ return $this->processPingResult($r);
+ }
+
+ public function processPingResult($r) {
+ global $php_errormsg;
+
+ if (($r == 0) && ($r->errno || $r->errstring)) {
+ return _PING_ERROR . " " . $r->errno . ' : ' . $r->errstring;
+ } elseif (($r == 0) && ($php_errormsg)) {
+ return _PING_PHP_ERROR . $php_errormsg;
+ } elseif ($r == 0) {
+ return _PING_PHP_PING_ERROR;
+ } elseif ($r->faultCode() != 0) {
+ return _PING_ERROR . ': ' . $r->faultString();
+ } else {
+ // get response struct
+ $r = $r->value();
+
+ // get values
+ $flerror = $r->structmem('flerror');
+ $flerror = $flerror->scalarval();
+
+ $message = $r->structmem('message');
+ $message = $message->scalarval();
+
+ if ($flerror != 0) {
+ return _PING_ERROR . ' (flerror=1): ' . $message;
+ } else {
+ return _PING_SUCCESS . ': ' . $message;
+ }
+ }
+ return;
+ }
}
-
-?>
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * Attach plugin for Nucleus CMS
+ * Version 0.9.5 (1.0 RC) for PHP5
+ * Written by Cacher, Jan.16, 2011
+ * Original code was written by Frank Truscott, Nov. 01, 2009
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ */
+
+class NP_SecurityEnforcer extends NucleusPlugin {
+ public function getName() { return 'SecurityEnforcer'; }
+ public function getAuthor() { return 'Frank Truscott + Cacher'; }
+ public function getURL() { return 'http://revcetera.com/ftruscot'; }
+ public function getVersion() { return '1.02JP'; }
+ public function getDescription() { return _SECURITYENFORCER_DESCRIPTION;}
+ public function getTableList() { return array(sql_table('plug_securityenforcer')); }
+ public function hasAdminArea() { return 1; }
+ public function getMinNucleusVersion() { return 350; }
+ public function supportsFeature($feature) { return in_array ($feature, array ('SqlTablePrefix', 'SqlApi'));}
+ public function getEventList() { return array('QuickMenu','PrePasswordSet','CustomLogin','LoginSuccess','LoginFailed','PostRegister','PrePluginOptionsEdit'); }
+
+ public function install() {
+ global $CONF;
+ $this->createOption('quickmenu', '_SECURITYENFORCER_OPT_QUICKMENU', 'yesno', 'yes');
+ $this->createOption('del_uninstall_data', '_SECURITYENFORCER_OPT_DEL_UNINSTALL_DATA', 'yesno','no');
+ $this->createOption('enable_security', '_SECURITYENFORCER_OPT_ENABLE', 'yesno','yes');
+ $this->createOption('pwd_min_length', '_SECURITYENFORCER_OPT_PWD_MIN_LENGTH', 'text','8');
+ //$this->createOption('pwd_complexity', _SECURITYENFORCER_OPT_PWD_COMPLEXITY, 'select','0',_SECURITYENFORCER_OPT_SELECT_OFF_COMP.'|0|'._SECURITYENFORCER_OPT_SELECT_ONE_COMP.'|1|'._SECURITYENFORCER_OPT_SELECT_TWO_COMP.'|2|'._SECURITYENFORCER_OPT_SELECT_THREE_COMP.'|3|'._SECURITYENFORCER_OPT_SELECT_FOUR_COMP.'|4');
+ $this->createOption('pwd_complexity', '_SECURITYENFORCER_OPT_PWD_COMPLEXITY', 'select','0','_SECURITYENFORCER_OPT_SELECT');
+ $this->createOption('max_failed_login', '_SECURITYENFORCER_OPT_MAX_FAILED_LOGIN', 'text', '5');
+ $this->createOption('login_lockout', '_SECURITYENFORCER_OPT_LOGIN_LOCKOUT', 'text', '15');
+
+ $query = "CREATE TABLE IF NOT EXISTS ". sql_table('plug_securityenforcer').
+ " (
+ `login` varchar(255),
+ `fails` int(11) NOT NULL default '0',
+ `lastfail` bigint NOT NULL default '0',
+ KEY `login` (`login`)) TYPE=MyISAM");
+ sql_query($query);
+ return;
+ }
+
+ public function unInstall() {
+ if ($this->getOption('del_uninstall_data') == 'yes') {
+ sql_query('DROP TABLE '.sql_table('plug_securityenforcer'));
+ }
+ return;
+ }
+
+ public function init() {
+ $language = preg_replace( '#\\\\|/#', '', getLanguageName());
+ if (file_exists($this->getDirectory().$language.'.php')){
+ include_once($this->getDirectory().$language.'.php');
+ } else {
+ include_once($this->getDirectory().'english.php');
+ }
+
+ $this->enable_security = $this->getOption('enable_security');
+ $this->pwd_min_length = intval($this->getOption('pwd_min_length'));
+ $this->pwd_complexity = intval($this->getOption('pwd_complexity'));
+ $this->max_failed_login = intval($this->getOption('max_failed_login'));
+ $this->login_lockout = intval($this->getOption('login_lockout'));
+ return;
+ }
+
+ public function event_QuickMenu(&$data) {
+ global $member;
+ if ($this->getOption('quickmenu') != 'yes' || !$member->isAdmin()) {
+ return;
+ }
+ if (!($member->isLoggedIn())) {
+ return;
+ }
+ array_push($data['options'],
+ array('title' => 'Security Enforcer',
+ 'url' => $this->getAdminURL(),
+ 'tooltip' => _SECURITYENFORCER_ADMIN_TOOLTIP)
+ );
+ return;
+ }
+
+ public function event_PrePasswordSet(&$data) {
+ if ($this->enable_security == 'yes') {
+ $password = $data['password'];
+ if (postVar('action') == 'changemembersettings'){
+ $emptyAllowed = true;
+ } else {
+ $emptyAllowed = false;
+ }
+ if ((!$emptyAllowed)||$password) {
+ $message = $this->_validate_and_messsage($password,$this->pwd_min_length, $this->pwd_complexity);
+ if ($message) {
+ $data['errormessage'] = _SECURITYENFORCER_INSUFFICIENT_COMPLEXITY . $message. "<br /><br />\n";
+ $data['valid'] = false;
+ }
+ }
+ }
+ return;
+ }
+
+ public function event_PostRegister(&$data) {
+ if ($this->enable_security == 'yes') {
+ $password = postVar('password');
+ if(postVar('action') == 'memberadd'){
+ $message = $this->_validate_and_messsage($password,$this->pwd_min_length, $this->pwd_complexity);
+ if ($message) {
+ $errormessage = _SECURITYENFORCER_ACCOUNT_CREATED. $message. "<br /><br />\n";
+ global $admin;
+ $admin->error($errormessage);
+ }
+ }
+ }
+ return;
+ }
+
+ public function event_CustomLogin(&$data) {
+ if ($this->enable_security == 'yes' && $this->max_failed_login > 0) {
+ global $_SERVER;
+ $login = $data['login'];
+ $ip = $_SERVER['REMOTE_ADDR'];
+ sql_query("DELETE FROM ".sql_table('plug_securityenforcer')." WHERE lastfail < ".(time() - ($this->login_lockout * 60)));
+ $query = "SELECT fails as result FROM ".sql_table('plug_securityenforcer')." ";
+ $query .= "WHERE login='".sql_real_escape_string($login)."'";
+ $flogin = quickQuery($query);
+ $query = "SELECT fails as result FROM ".sql_table('plug_securityenforcer')." ";
+ $query .= "WHERE login='".sql_real_escape_string($ip)."'";
+ $fip = quickQuery($query);
+ if ($flogin >= $this->max_failed_login || $fip >= $this->max_failed_login) {
+ $data['success'] = 0;
+ $data['allowlocal'] = 0;
+ $info = sprintf(_SECURITYENFORCER_LOGIN_DISALLOWED, htmlspecialchars($login), htmlspecialchars($ip));
+ ACTIONLOG::add(INFO, $info);
+ }
+ }
+ return;
+ }
+
+ public function event_LoginSuccess(&$data) {
+ if ($this->enable_security == 'yes' && $this->max_failed_login > 0) {
+ global $_SERVER;
+ $login = $data['username'];
+ $ip = $_SERVER['REMOTE_ADDR'];
+ sql_query("DELETE FROM ".sql_table('plug_securityenforcer')." WHERE login='".sql_real_escape_string($login)."'");
+ sql_query("DELETE FROM ".sql_table('plug_securityenforcer')." WHERE login='".sql_real_escape_string($ip)."'");
+ }
+ return;
+ }
+
+ function event_LoginFailed(&$data) {
+ if ($this->enable_security == 'yes' && $this->max_failed_login > 0) {
+ global $_SERVER;
+ $login = $data['username'];
+ $ip = $_SERVER['REMOTE_ADDR'];
+ $lres = sql_query("SELECT * FROM ".sql_table('plug_securityenforcer')." WHERE login='".sql_real_escape_string($login)."'");
+ if (sql_num_rows($lres)) {
+ sql_query("UPDATE ".sql_table('plug_securityenforcer')." SET fails=fails+1, lastfail=".time()." WHERE login='".sql_real_escape_string($login)."'");
+ }
+ else {
+ sql_query("INSERT INTO ".sql_table('plug_securityenforcer')." (login,fails,lastfail) VALUES ('".sql_real_escape_string($login)."',1,".time().")");
+ }
+ $lres = sql_query("SELECT * FROM ".sql_table('plug_securityenforcer')." WHERE login='".sql_real_escape_string($ip)."'");
+ if (sql_num_rows($lres)) {
+ sql_query("UPDATE ".sql_table('plug_securityenforcer')." SET fails=fails+1, lastfail=".time()." WHERE login='".sql_real_escape_string($ip)."'");
+ }
+ else {
+ sql_query("INSERT INTO ".sql_table('plug_securityenforcer')." (login,fails,lastfail) VALUES ('".sql_real_escape_string($ip)."',1,".time().")");
+ }
+ }
+ return;
+ }
+
+ public function event_PrePluginOptionsEdit($data) {
+ if ($data['plugid'] === $this->getID()) {
+ foreach($data['options'] as $key => $value){
+ if (defined($value['description'])) {
+ $data['options'][$key]['description'] = constant($value['description']);
+ }
+ if (!strcmp($value['type'], 'select') && defined($value['typeinfo'])) {
+ $data['options'][$key]['typeinfo'] = constant($value['typeinfo']);
+ }
+ }
+ }
+ return;
+ }
+
+ /* Helper Functions */
+
+ private function _validate_passwd($passwd,$minlength = 6,$complexity = 0) {
+ $minlength = intval($minlength);
+ $complexity = intval($complexity);
+
+ if ($minlength < 6 ) {
+ $minlength = 6;
+ }
+ if (strlen($passwd) < $minlength) {
+ return false;
+ }
+
+ if ($complexity > 4) $complexity = 4;
+ $ucchars = "[A-Z]";
+ $lcchars = "[a-z]";
+ $numchars = "[0-9]";
+ $ochars = "[-~!@#$%^&*()_+=,.<>?:;|]";
+ $chartypes = array($ucchars, $lcchars, $numchars, $ochars);
+ $tot = array(0,0,0,0);
+ $i = 0;
+ foreach ($chartypes as $value) {
+ $tot[$i] = preg_match("/".$value."/", $passwd);
+ $i = $i + 1;
+ }
+
+ if (array_sum($tot) >= $complexity) {
+ return true;
+ }
+ else return false;
+ }
+
+ private function _validate_and_messsage($passwd,$minlength = 6,$complexity = 0) {
+ $minlength = intval($minlength);
+ $complexity = intval($complexity);
+
+ if ($minlength < 6 ) {
+ $minlength = 6;
+ }
+ if (strlen($passwd) < $minlength) {
+ $message = _SECURITYENFORCER_MIN_PWD_LENGTH . $this->pwd_min_length;
+ }
+
+ if ($complexity > 4) {
+ $complexity = 4;
+ }
+ $ucchars = "[A-Z]";
+ $lcchars = "[a-z]";
+ $numchars = "[0-9]";
+ $ochars = "[-~!@#$%^&*()_+=,.<>?:;|]";
+ $chartypes = array($ucchars, $lcchars, $numchars, $ochars);
+ $tot = array(0,0,0,0);
+ $i = 0;
+ foreach ($chartypes as $value) {
+ $tot[$i] = preg_match("/".$value."/", $passwd);
+ $i = $i + 1;
+ }
+
+ if (array_sum($tot) < $complexity) {
+ $message .= _SECURITYENFORCER_PWD_COMPLEXITY . $this->pwd_complexity;
+ }
+ return $message;
+ }
+}
<?php
+/* ==========================================================================================
+ * Nucleus SkinFiles Plugin
+ *
+ * Copyright 2005-2009 by Jeff MacMichael and Niels Leenheer
+ *
+ * @version $Id$
+ * @version $NucleusJP: NP_SkinFiles.php,v 1.4 2007/02/04 06:28:46 kimitake Exp $
+ *
+ * ==========================================================================================
+ * This program is free software and open source software; you can redistribute
+ * it and/or modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit
+ * http://www.gnu.org/licenses/gpl.html
+ * ==========================================================================================
+ *
+ * Changes:
+ * v0.91 ged - added ICO, PHPx files, fixed/added some icons
+ * - changed perms on file or folder creation or upload to 0755 from 0640
+ * - changed 'cancel' links for delete actions to $parent dir from http_referer
+ * - changed order of links next to files... moved 'del' over a bit. ;)
+ * v0.92 ged - changed order of links next to dirs
+ * - $privateskins = FALSE by default
+ * v1.0 ged - fixed security catch so it actually quits the script
+ * - "columnated" the files & dirs display for easier viewing
+ * - Made the edit cancel link more intuitive
+ * v1.01 ged - fixed event_QuickMenu to properly skip for non-admins
+ * - lined up columns for directories & added <tr> highlights
+ * v2.00 rakaz - Almost complete rewrite
+ * v2.01 yama - modified form button for IE
+ * v2.02 kimitake - multilingual support, modified form button for IE
+ * v2.03 yama - CSS out source. and textarea width bug fix for IE. And some lang add.And add routine empty file delete.
+ * cacher - replace function 'basename' (PHP BUG)
+ * - add help
+ * Mocchi - arrange codes for PHP5
+ */
class NP_SkinFiles extends NucleusPlugin {
-
- /* ==========================================================================================
- * Nucleus SkinFiles Plugin
- *
- * Copyright 2005-2009 by Jeff MacMichael and Niels Leenheer
- *
- * @version $Id$
- * @version $NucleusJP: NP_SkinFiles.php,v 1.4 2007/02/04 06:28:46 kimitake Exp $
- *
- * ==========================================================================================
- * This program is free software and open source software; you can redistribute
- * it and/or modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the License,
- * or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or visit
- * http://www.gnu.org/licenses/gpl.html
- * ==========================================================================================
- *
- * Changes:
- * v0.91 ged - added ICO, PHPx files, fixed/added some icons
- * - changed perms on file or folder creation or upload to 0755 from 0640
- * - changed 'cancel' links for delete actions to $parent dir from http_referer
- * - changed order of links next to files... moved 'del' over a bit. ;)
- * v0.92 ged - changed order of links next to dirs
- * $privateskins = FALSE by default
- * v1.0 ged - fixed security catch so it actually quits the script
- * "columnated" the files & dirs display for easier viewing
- * Made the edit cancel link more intuitive
- * v1.01 ged - fixed event_QuickMenu to properly skip for non-admins
- * lined up columns for directories & added <tr> highlights
- * v2.00 rakaz - Almost complete rewrite
- * v2.01 yama - modified form button for IE
- * v2.02 kimitake - multilingual support, modified form button for IE
- * v2.03 yama - CSS out source. and textarea width bug fix for IE. And some lang add.And add routine empty file delete.
- * v2.031 cacher - replace function 'basename' (PHP BUG)
- add help
- */
-
-
- function getName() {
- return 'SkinFiles';
- }
-
- function getAuthor() {
- return 'Misc authors';
- }
-
- function getURL() {
- return 'http://wakka.xiffy.nl/skinfiles';
- }
-
- function getVersion() {
- return '2.031';
- }
-
- function getDescription() {
- return _SKINFILES_01;
- }
-
- function supportsFeature($what) {
- switch($what) {
- case 'SqlTablePrefix':
- case 'HelpPage':
- return 1;
- default:
- return 0;
- }
- }
-
- function install() {
- $this->createOption(
- 'generate_backup',
+ public function getName() { return 'SkinFiles'; }
+ public function getAuthor() { return 'Misc authors'; }
+ public function getURL() { return 'http://wakka.xiffy.nl/skinfiles'; }
+ public function getVersion() { return '2.031'; }
+ public function getDescription() { return _SKINFILES_01; }
+ public function supportsFeature($feature) { return in_array ($feature, array ('SqlTablePrefix', 'SqlApi', 'HelpPage'));}
+ public function hasAdminArea() { return 1; }
+
+ public function install() {
+ $this->createOption(
+ 'generate_backup',
'_SKINFILES_OPT_GENBACKUP',
- 'yesno',
- 'no'
- );
- $this->createOption(
- 'backup_prefix',
+ 'yesno',
+ 'no'
+ );
+ $this->createOption(
+ 'backup_prefix',
'_SKINFILES_OPT_BACKUPPREFIX',
- 'text',
- 'bkup_'
- );
- }
-
- function unInstall() {
- }
-
- function getEventList() {
- return array(
- 'QuickMenu',
+ 'text',
+ 'bkup_'
+ );
+ return;
+ }
+
+ public function unInstall() {
+ return;
+ }
+
+ public function getEventList() {
+ return array(
+ 'QuickMenu',
'AdminPrePageHead',
'PrePluginOptionsEdit'
- );
- }
-
- function hasAdminArea() {
- return 1;
- }
-
- function init() {
- // include language file for this plugin
- $language = preg_replace( '@\\|/@', '', getLanguageName());
- if (file_exists($this->getDirectory().$language.'.php'))
- include_once($this->getDirectory().$language.'.php');
- else
- include_once($this->getDirectory().'english.php');
- }
-
- function event_QuickMenu(&$data) {
- global $member;
-
- // only show to admins
- if (!($member->isLoggedIn() && $member->isAdmin())) return;
-
- array_push(
- $data['options'],
- array(
- 'title' => _SKINFILES_TITLE,
- 'url' => $this->getAdminURL(),
- 'tooltip' => _SKINFILES_TOOLTIP
- )
- );
- }
-
-
-// start add yama.kyms
- function event_AdminPrePageHead(&$data) {
- global $CONF;
- $path = $CONF['PluginURL'];
- if ($data['action'] != 'plugin_SkinFiles') return;
-
- $data['extrahead'] .= <<< EOS
-<link rel="stylesheet" type="text/css" href="{$path}skinfiles/style.css" />
-EOS;
- }
-
-// end add yama.kyms
-
- function event_PrePluginOptionsEdit($data)
- {
- if ($data['plugid'] === $this->getID()) {
- foreach($data['options'] as $key => $value){
- if (defined($value['description'])) {
- $data['options'][$key]['description'] = constant($value['description']);
- }
+ );
+ }
+
+ public function init() {
+ $language = preg_replace( '#\\\\|/#', '', getLanguageName());
+ if (file_exists($this->getDirectory().$language.'.php')) {
+ include_once($this->getDirectory().$language.'.php');
+ } else {
+ include_once($this->getDirectory().'english.php');
+ }
+ return;
+ }
+
+ public function event_QuickMenu(&$data) {
+ global $member;
+
+ if (!($member->isLoggedIn() && $member->isAdmin())) {
+ return;
+ }
+
+ array_push(
+ $data['options'],
+ array(
+ 'title' => _SKINFILES_TITLE,
+ 'url' => $this->getAdminURL(),
+ 'tooltip' => _SKINFILES_TOOLTIP
+ )
+ );
+ return;
+ }
+
+ public function event_AdminPrePageHead(&$data) {
+ global $CONF;
+ $path = $CONF['PluginURL'];
+ if ($data['action'] != 'plugin_SkinFiles') {
+ return;
+ }
+
+ $data['extrahead'] .= '<link rel="stylesheet" type="text/css" href="{$path}skinfiles/style.css" />';
+ }
+
+ public function event_PrePluginOptionsEdit($data) {
+ if ($data['plugid'] !== $this->getID()) {
+ return;
+ }
+ foreach($data['options'] as $key => $value){
+ if (defined($value['description'])) {
+ $data['options'][$key]['description'] = constant($value['description']);
}
}
+ return;
}
}
-
-?>
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * Text plugin for Nucleus CMS
+ * Version 0.53JP for PHP5
+ * Written By Cacher, Jan.16, 2011
+ * Original was written by Armon Toubman, Jan.18, 2007
+ * This plugin depends needs PHP mbstring extension or mb_emurator scripts Andy Matsubara released.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ */
+
+class NP_Text extends NucleusPlugin {
+ private $incModePref = array();
+ private $constantPrefix = "SL_";
+
+ public function getEventList() { return array('PreSkinParse'); }
+ public function getName() { return 'Text'; }
+ public function getAuthor() { return 'Armon Toubman'; }
+ public function getURL() { return 'http://forum.nucleuscms.org/viewtopic.php?t=14904'; }
+ public function getVersion() { return '0.53JP'; }
+ public function getDescription() {
+ $desc = '言語ファイル中の定数を表示します。: <%Text(定数名)%>';
+ switch (preg_replace( '#\\\\|/#', '', getLanguageName())) {
+ case 'japanese-utf8':\r
+ break;
+ case 'japanese-euc':\r
+ $desc = mb_convert_encoding($desc,'EUC-JP','UTF-8');\r
+ break;\r
+ default:\r
+ $desc ='Display constants from language files: <%Text(CONSTANT)%>';\r
+ break;\r
+ }
+ return $desc;
+ }
+ public function supportsFeature($feature) { return in_array ($feature, array ('SqlTablePrefix', 'SqlApi'));}
+ public function install() { return; }
+ public function uninstall() { return; }
+
+ public function init() {
+ $this->incModePref = $this->skin_incmodepref();
+ return;
+ }
+
+ public function event_PreSkinParse() {
+ global $member;
+ if( !$member->isLoggedIn() and isset($_GET['lang']) ) {
+ // 3 months
+ setcookie('NP_Text', getVar('lang'), time()+60*60*24*90);
+ }
+ return;
+ }
+
+ public function doSkinVar($skinType, $constant) {
+ global $member, $CONF;
+
+ $language = getLanguageName();
+ $getLanguage = isset($_GET['lang']) ? getVar('lang') : false;
+ $cookieLanguage = isset($_COOKIE['NP_Text']) ? cookieVar('NP_Text') : false;
+
+ if ( $getLanguage ) {
+ $this->use_lang($getLanguage, $constant);
+ }
+ elseif ( $cookieLanguage ) {
+ $this->use_lang($cookieLanguage, $constant);
+ }
+ else {
+ $this->use_lang($language, $constant);
+ }
+ }
+
+ public function doTemplateVar(&$item, $constant) {
+ global $member, $CONF;
+
+ $language = getLanguageName();
+ $getLanguage = isset($_GET['lang']) ? getVar('lang') : false;
+ $cookieLanguage = isset($_COOKIE['NP_Text']) ? cookieVar('NP_Text') : false;
+
+ if ($getLanguage) {
+ $this->use_lang($getLanguage, $constant);
+ } elseif( $cookieLanguage ) {
+ $this->use_lang($cookieLanguage, $constant);
+ } else {
+ $this->use_lang($language, $constant);
+ }
+ }
+
+ public function use_lang($language, $constant) {
+ global $DIR_SKINS;
+
+ $filename = '';
+
+ if ( $this->incModePref[0] == "normal" ) {
+ $filename = $filename.$this->incModePref[1];
+ $filename = $filename."language/";
+ $filename = $filename.$language;
+ $filename = $filename.".php";
+ } elseif ( $this->incModePref[0] == "skindir" ) {
+ $filename = $filename.$DIR_SKINS;
+ $filename = $filename.$this->incModePref[1];
+ $filename = $filename."language/";
+ $filename = $filename.$language;
+ $filename = $filename.".php";
+ }
+
+ if (is_file($filename)) {
+ include($filename);
+ } else {
+ addToLog(1, "NP_Text cannot find ".$filename);
+ }
+
+ if ( defined($this->constantPrefix.$constant) ) {
+ echo constant($this->constantPrefix.$constant);
+ } else {
+ echo $this->constantPrefix.$constant;
+ if( is_file($filename) ) {
+ addToLog(1, "NP_Text cannot find definition for ".$this->constantPrefix.$constant." in ".$filename);
+ }
+ }
+ return;
+ }
+
+ public function skin_incmodepref() {
+ global $currentSkinName;
+ $sql = "SELECT * FROM ".sql_table("skin_desc")." WHERE sdname = '".$currentSkinName."'";
+ $result = sql_query($sql);
+ $row = sql_fetch_array($result, MYSQL_ASSOC);
+ return array($row['sdincmode'], $row['sdincpref']);
+ }
+}
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="ja-JP" xml:lang="ja-JP">
<head>
- <title>Nothing Here</title>
+ <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
+ <title>なにもない</title>
</head>
<body>
-<h1>Nothing to see here</h1>
+<h1>なんにもありませんが</h1>
</body>
</html>
\ No newline at end of file
--- /dev/null
+<?php
+/** English language file for NP_SECURITYENFORCER Plugin
+*/
+
+// Plugin Options
+define('_SECURITYENFORCER_OPT_QUICKMENU', 'Show Admin Area in quick menu?');
+define('_SECURITYENFORCER_OPT_DEL_UNINSTALL_DATA', 'Delete NP_SecurityEnforcer data table on uninstall?');
+define('_SECURITYENFORCER_OPT_ENABLE', 'Enable NP_SecurityEnforcer password and login checks?');
+define('_SECURITYENFORCER_OPT_PWD_MIN_LENGTH', 'Minimum Length in characters of a user password. Integer. 8 is the default and 6 the minimum value:');
+define('_SECURITYENFORCER_OPT_PWD_COMPLEXITY', 'Password Complexity Check. (How many character types should be present out of a-z, A-Z, 0-9, punctuation marks?):');
+//define('_SECURITYENFORCER_OPT_SELECT_OFF_COMP', 'Off');
+//define('_SECURITYENFORCER_OPT_SELECT_ONE_COMP', 'One character type');
+//define('_SECURITYENFORCER_OPT_SELECT_TWO_COMP', 'Two character types');
+//define('_SECURITYENFORCER_OPT_SELECT_THREE_COMP', 'Three character types');
+//define('_SECURITYENFORCER_OPT_SELECT_FOUR_COMP', 'Four character types');
+define('_SECURITYENFORCER_OPT_SELECT', 'Off|0|One character type|1|Two character types|2|Three character types|3|Four character types|4');
+define('_SECURITYENFORCER_OPT_MAX_FAILED_LOGIN', 'How many failed login attempts before locking the user account?');
+define('_SECURITYENFORCER_OPT_LOGIN_LOCKOUT', 'After how many minutes should a locked account be released?');
+
+//QuickMenu
+define('_SECURITYENFORCER_ADMIN_TOOLTIP', 'Manage NP_SecurityEnforcer Plugin');
+define('_SECURITYENFORCER_ADMIN_UNLOCKED', ' has been unlocked. Remember to unlock the corresponding IP or Login Name.');
+define('_SECURITYENFORCER_ADMIN_NONE_LOCKED', 'No Records Found.');
+
+// ERRORS
+define('_SECURITYENFORCER_ACCOUNT_CREATED', 'Account has been created,but that password does not meet site requirements for length or complexity. <br />');
+define('_SECURITYENFORCER_INSUFFICIENT_COMPLEXITY', 'This password does not meet site requirements for length or complexity. <br />');
+define('_SECURITYENFORCER_MIN_PWD_LENGTH', '<br />Minimum password length:');
+define('_SECURITYENFORCER_PWD_COMPLEXITY', '<br />Minimum number of character types ([a-z], [A-Z], [0-9], [-~!@#$%^&*()_+=,.<>?:;|]):');
+
+//random words
+define('_SECURITYENFORCER_UNLOCK', 'Unlock');
+define('_SECURITYENFORCER_ENTITY', 'Entity');
+define('_SECURITYENFORCER_LOCKED_ENTITIES', 'Currently Locked Entities');
+
+// Plugin desc
+define('_SECURITYENFORCER_DESCRIPTION', 'Enforces some password complexity rules and sets a maximum number of failed logins.');
+
+// Log info
+define('_SECURITYENFORCER_LOGIN_DISALLOWED', 'login disallowed by NP_SecurityEnforcer. login: %1$s, ip: %2$s');
+
+// QuickMenu title
+define('_SECURITYENFORCER_ADMIN_TITLE', 'Security Enforcer Administration');
+
+?>
\ No newline at end of file
--- /dev/null
+<?php\r
+\r
+/*\r
+\r
+Admin area for NP_SecurityEnforcer\r
+\r
+*/\r
+\r
+ // if your 'plugin' directory is not in the default location,\r
+ // edit this variable to point to your site directory\r
+ // (where config.php is)\r
+ $strRel = '../../../';\r
+\r
+ include($strRel . 'config.php');\r
+ if (!$member->isAdmin())\r
+ doError('Insufficient Permissions.');\r
+ \r
+ include_libs('PLUGINADMIN.php');\r
+\r
+ // some functions\r
+ \r
+ function SE_unlockLogin($login) {\r
+ sql_query("DELETE FROM ".sql_table('plug_securityenforcer')." WHERE login='".sql_real_escape_string($login)."'");\r
+ }\r
+ \r
+ \r
+ // checks\r
+ \r
+\r
+ \r
+ // create the admin area page\r
+ $oPluginAdmin = new PluginAdmin('SecurityEnforcer');\r
+ // add styles to the <HEAD>\r
+ $oPluginAdmin->start('');\r
+ \r
+ // if form to unlock is posted\r
+ if(postVar('action') == 'unlock') {\r
+ if (!$manager->checkTicket()) \r
+ doError('Invalid Ticket');\r
+ $logins = postVar('unlock');\r
+ $message = '';\r
+ if(is_array($logins)) {\r
+ foreach ($logins as $entity) {\r
+ SE_unlockLogin($entity);\r
+ $message .= '<br />' . $entity . _SECURITYENFORCER_ADMIN_UNLOCKED;\r
+ }\r
+ }\r
+ } \r
+ $plug =& $oPluginAdmin->plugin;\r
+\r
+ // page title\r
+ echo '<h2>'._SECURITYENFORCER_ADMIN_TITLE.'</h2>';\r
+ \r
+ // error output\r
+ if($message) { echo "<p><strong>"; echo $message; echo "</strong></p>"; }\r
+ \r
+ // generate table from all entries in the database\r
+ echo '<h3>'._SECURITYENFORCER_LOCKED_ENTITIES.'</h3>';\r
+ echo '<form action="' . $oPluginAdmin->plugin->getAdminURL() . '" method="POST">';\r
+ echo '<input type="hidden" name="action" value="unlock" />';\r
+ $manager->addTicketHidden();\r
+ echo '<table>';\r
+ echo '<tr><th>'._SECURITYENFORCER_ENTITY.'</th><th>'._SECURITYENFORCER_UNLOCK.'?</th></tr>';\r
+ echo '<tr><td colspan="2" class="submit"><input type="submit" value="'._SECURITYENFORCER_UNLOCK.'" /></td></tr>';\r
+ // do query to get all entries, loop\r
+ $result = sql_query("SELECT * FROM ".sql_table("plug_securityenforcer")." WHERE fails >= ".$plug->max_failed_login);\r
+ if(sql_num_rows($result)) {\r
+ while($row = sql_fetch_assoc($result)) {\r
+ echo '<tr>';\r
+ echo '<td>'.htmlspecialchars($row['login']).'</td>';\r
+ echo '<td><input type="checkbox" name="unlock[]" value="'.htmlspecialchars($row['login']).'" />'._SECURITYENFORCER_UNLOCK.'</td>';\r
+ echo '</tr>';\r
+ }\r
+ }\r
+ else {\r
+ echo '<tr><td colspan="2"><strong>'._SECURITYENFORCER_ADMIN_NONE_LOCKED.'</strong></td></tr>';\r
+ }\r
+ echo '<tr><td colspan="2" class="submit"><input type="submit" value="'._SECURITYENFORCER_UNLOCK.'" /></td></tr>';\r
+ echo '</table>';\r
+ echo '</form>';\r
+ \r
+ $oPluginAdmin->end();\r
+\r
+?>\r
--- /dev/null
+<?php
+/** Japanese-EUC language file for NP_SECURITYENFORCER Plugin
+*/
+
+// Plugin Options
+define('_SECURITYENFORCER_OPT_QUICKMENU', '¥¯¥¤¥Ã¥¯¥á¥Ë¥å¡¼¤Ëɽ¼¨¤·¤Þ¤¹¤«¡©');
+define('_SECURITYENFORCER_OPT_DEL_UNINSTALL_DATA', '¥¢¥ó¥¤¥ó¥¹¥È¡¼¥ë»þ¤Ë¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î¥Æ¡¼¥Ö¥ë¤òºï½ü¤·¤Þ¤¹¤«¡©');
+define('_SECURITYENFORCER_OPT_ENABLE', '¥Ñ¥¹¥ï¡¼¥É¤È¥í¥°¥¤¥ó¥Á¥§¥Ã¥¯»þ¤ËSecurityEnforcer¤ò͸ú¤Ë¤·¤Þ¤¹¤«¡©');
+define('_SECURITYENFORCER_OPT_PWD_MIN_LENGTH', '¥Ñ¥¹¥ï¡¼¥É¤ÎºÇ¾®Ê¸»ú¿ô(¥Ç¥Õ¥©¥ë¥È¤Ï8ʸ»ú¡£6ʸ»ṳ́Ëþ¤Ë¤Ï»ØÄê¤Ç¤¤Þ¤»¤ó¡§');
+define('_SECURITYENFORCER_OPT_PWD_COMPLEXITY', '¥Ñ¥¹¥ï¡¼¥É¶¯Å٤ΥÁ¥§¥Ã¥¯(a-z, A-Z, 0-9, Ⱦ³Ñµ¹æ¤«¤é²¿¼ïÎà¤Îʸ»ú¥¿¥¤¥×¤¬Â¸ºß¤¹¤ë¤Ù¤¤Ç¤¹¤«?):');
+//define('_SECURITYENFORCER_OPT_SELECT_OFF_COMP', 'Off');
+//define('_SECURITYENFORCER_OPT_SELECT_ONE_COMP', '°ì¼ïÎà¤Îʸ»ú¥¿¥¤¥×');
+//define('_SECURITYENFORCER_OPT_SELECT_TWO_COMP', 'Æó¼ïÎà¤Îʸ»ú¥¿¥¤¥×');
+//define('_SECURITYENFORCER_OPT_SELECT_THREE_COMP', '»°¼ïÎà¤Îʸ»ú¥¿¥¤¥×');
+//define('_SECURITYENFORCER_OPT_SELECT_FOUR_COMP', '»Í¼ïÎà¤Îʸ»ú¥¿¥¤¥×');
+define('_SECURITYENFORCER_OPT_SELECT', '¥ª¥Õ|0|1¼ïÎà¤Îʸ»ú¥¿¥¤¥×|1|2¼ïÎà¤Îʸ»ú¥¿¥¤¥×|2|3¼ïÎà¤Îʸ»ú¥¿¥¤¥×|3|4¼ïÎà¤Îʸ»ú¥¿¥¤¥×|4');
+define('_SECURITYENFORCER_OPT_MAX_FAILED_LOGIN', '²¿ÅÙÌÜ¤Î¥í¥°¥¤¥ó¼ºÇԤǥ¢¥«¥¦¥ó¥È¤ò¥í¥Ã¥¯¤·¤Þ¤¹¤«¡©');
+define('_SECURITYENFORCER_OPT_LOGIN_LOCKOUT', '¥¢¥«¥¦¥ó¥È¤ò¥í¥Ã¥¯¤·¤Æ¤«¤é²¿Ê¬¤Ç¥í¥Ã¥¯²ò½ü¤·¤Þ¤¹¤«¡©');
+
+// QuickMenu
+define('_SECURITYENFORCER_ADMIN_TOOLTIP', 'SecurityEnforcer¥×¥é¥°¥¤¥ó¤Î´ÉÍý');
+define('_SECURITYENFORCER_ADMIN_UNLOCKED', '¥í¥Ã¥¯²ò½ü¤µ¤ì¤Þ¤·¤¿¡£Âбþ¤¹¤ëIP¥¢¥É¥ì¥¹¡¢¤Þ¤¿¤Ï¥í¥°¥¤¥ó̾¤Î¥í¥Ã¥¯¤ò²ò½ü¤¹¤ë¤Î¤ò˺¤ì¤Ê¤¤¤Ç¤¯¤À¤µ¤¤¡£');
+define('_SECURITYENFORCER_ADMIN_NONE_LOCKED', '³ºÅö¤Ê¤·');
+
+// ERRORS
+define('_SECURITYENFORCER_ACCOUNT_CREATED', '¥¢¥«¥¦¥ó¥È¤ÏºîÀ®¤µ¤ì¤Þ¤·¤¿¤¬¡¢¥Ñ¥¹¥ï¡¼¥É¤¬¤³¤Î¥µ¥¤¥È¤ÇÍ׵ᤵ¤ì¤ëʸ»ú¿ô¡¢¤Þ¤¿¤Ï¶¯ÅÙ¤òËþ¤¿¤·¤Æ¤¤¤Þ¤»¤ó¡£<br />');
+define('_SECURITYENFORCER_INSUFFICIENT_COMPLEXITY', 'ÆþÎϤµ¤ì¤¿¥Ñ¥¹¥ï¡¼¥É¤Ï¡¢¤³¤Î¥µ¥¤¥È¤ÇÍ׵ᤵ¤ì¤ëʸ»ú¿ô¡¢¤Þ¤¿¤Ï¶¯ÅÙ¤òËþ¤¿¤·¤Æ¤¤¤Þ¤»¤ó¡£<br />');
+define('_SECURITYENFORCER_MIN_PWD_LENGTH', '<br />ºÇ¾®Ê¸»ú¿ô: ');
+define('_SECURITYENFORCER_PWD_COMPLEXITY', '<br />ºÇ¾®Ê¸»ú¥¿¥¤¥×¿ô([a-z], [A-Z], [0-9], [-~!@#$%^&*()_+=,.<>?:;|]): ');
+
+// random words
+define('_SECURITYENFORCER_UNLOCK', '¥¢¥ó¥í¥Ã¥¯');
+define('_SECURITYENFORCER_ENTITY', '¥¨¥ó¥Æ¥£¥Æ¥£');
+define('_SECURITYENFORCER_LOCKED_ENTITIES', '¸½ºß¥í¥Ã¥¯Ãæ¤Î¥¨¥ó¥Æ¥£¥Æ¥£');
+
+// Plugin desc
+define('_SECURITYENFORCER_DESCRIPTION', '¥Ñ¥¹¥ï¡¼¥É¤ÎºÇ¾®Ê¸»ú¿ô¤ä¶¯ÅÙ¤ÎÀ©¸Â¡¢¥í¥°¥¤¥ó¼ºÇÔ²Äǽ²ó¿ô¤Ê¤É¤òÀßÄꤷ¤Þ¤¹');
+
+// Log info
+define('_SECURITYENFORCER_LOGIN_DISALLOWED', 'SecurityEnforcer¤Ë¤è¤Ã¤Æ¥í¥°¥¤¥ó¤¬µñÀ䤵¤ì¤Þ¤·¤¿¡£login: %1$s, ip: %2$s');
+
+// QuickMenu title
+define('_SECURITYENFORCER_ADMIN_TITLE', 'SecurityEnforcer¥×¥é¥°¥¤¥ó¤Î´ÉÍý');
+
+?>
\ No newline at end of file
--- /dev/null
+<?php
+/** Japanese-UTF8 language file for NP_SECURITYENFORCER Plugin
+*/
+
+// Plugin Options
+define('_SECURITYENFORCER_OPT_QUICKMENU', 'クイックメニューに表示しますか?');
+define('_SECURITYENFORCER_OPT_DEL_UNINSTALL_DATA', 'アンインストール時にデータベースのテーブルを削除しますか?');
+define('_SECURITYENFORCER_OPT_ENABLE', 'パスワードとログインチェック時にSecurityEnforcerを有効にしますか?');
+define('_SECURITYENFORCER_OPT_PWD_MIN_LENGTH', 'パスワードの最小文字数(デフォルトは8文字。6文字未満には指定できません:');
+define('_SECURITYENFORCER_OPT_PWD_COMPLEXITY', 'パスワード強度のチェック(a-z, A-Z, 0-9, 半角記号から何種類の文字タイプが存在するべきですか?):');
+//define('_SECURITYENFORCER_OPT_SELECT_OFF_COMP', 'Off');
+//define('_SECURITYENFORCER_OPT_SELECT_ONE_COMP', '一種類の文字タイプ');
+//define('_SECURITYENFORCER_OPT_SELECT_TWO_COMP', '二種類の文字タイプ');
+//define('_SECURITYENFORCER_OPT_SELECT_THREE_COMP', '三種類の文字タイプ');
+//define('_SECURITYENFORCER_OPT_SELECT_FOUR_COMP', '四種類の文字タイプ');
+define('_SECURITYENFORCER_OPT_SELECT', 'オフ|0|1種類の文字タイプ|1|2種類の文字タイプ|2|3種類の文字タイプ|3|4種類の文字タイプ|4');
+define('_SECURITYENFORCER_OPT_MAX_FAILED_LOGIN', '何度目のログイン失敗でアカウントをロックしますか?');
+define('_SECURITYENFORCER_OPT_LOGIN_LOCKOUT', 'アカウントをロックしてから何分でロック解除しますか?');
+
+// QuickMenu
+define('_SECURITYENFORCER_ADMIN_TOOLTIP', 'SecurityEnforcerプラグインの管理');
+define('_SECURITYENFORCER_ADMIN_UNLOCKED', 'ロック解除されました。対応するIPアドレス、またはログイン名のロックを解除するのを忘れないでください。');
+define('_SECURITYENFORCER_ADMIN_NONE_LOCKED', '該当なし');
+
+// ERRORS
+define('_SECURITYENFORCER_ACCOUNT_CREATED', 'アカウントは作成されましたが、パスワードがこのサイトで要求される文字数、または強度を満たしていません。<br />');
+define('_SECURITYENFORCER_INSUFFICIENT_COMPLEXITY', '入力されたパスワードは、このサイトで要求される文字数、または強度を満たしていません。<br />');
+define('_SECURITYENFORCER_MIN_PWD_LENGTH', '<br />最小文字数: ');
+define('_SECURITYENFORCER_PWD_COMPLEXITY', '<br />最小文字タイプ数([a-z], [A-Z], [0-9], [-~!@#$%^&*()_+=,.<>?:;|]): ');
+
+// random words
+define('_SECURITYENFORCER_UNLOCK', 'アンロック');
+define('_SECURITYENFORCER_ENTITY', 'エンティティ');
+define('_SECURITYENFORCER_LOCKED_ENTITIES', '現在ロック中のエンティティ');
+
+// Plugin desc
+define('_SECURITYENFORCER_DESCRIPTION', 'パスワードの最小文字数や強度の制限、ログイン失敗可能回数などを設定します');
+
+// Log info
+define('_SECURITYENFORCER_LOGIN_DISALLOWED', 'SecurityEnforcerによってログインが拒絶されました。login: %1$s, ip: %2$s');
+
+// QuickMenu title
+define('_SECURITYENFORCER_ADMIN_TITLE', 'SecurityEnforcerプラグインの管理');
+
+?>
\ No newline at end of file