[pLog-svn] r870 - in plugins/trunk/hostblock: class/action
class/view templates
mark at devel.plogworld.net
mark at devel.plogworld.net
Fri Jan 28 09:51:48 GMT 2005
Author: mark
Date: 2005-01-28 09:51:48 +0000 (Fri, 28 Jan 2005)
New Revision: 870
Added:
plugins/trunk/hostblock/class/view/adminblogblockedhostsview.class.php
plugins/trunk/hostblock/class/view/admineditblogblockedhostview.class.php
plugins/trunk/hostblock/class/view/adminnewblogblockedhostview.class.php
Removed:
plugins/trunk/hostblock/class/action/adminupdatblogblockedaction.class.php
Modified:
plugins/trunk/hostblock/class/action/adminaddblockedhostaction.class.php
plugins/trunk/hostblock/class/action/adminaddblogblockedhostaction.class.php
plugins/trunk/hostblock/class/action/adminblogblockedhostsaction.class.php
plugins/trunk/hostblock/class/action/admineditblogblockedhostaction.class.php
plugins/trunk/hostblock/class/action/adminnewblockedhostaction.class.php
plugins/trunk/hostblock/class/action/adminnewblogblockedhostaction.class.php
plugins/trunk/hostblock/class/action/adminupdateblockedhostaction.class.php
plugins/trunk/hostblock/class/action/adminupdateblogblockedhostaction.class.php
plugins/trunk/hostblock/templates/addblogblockedhost.template
plugins/trunk/hostblock/templates/blockedhosts.template
plugins/trunk/hostblock/templates/blogblockedhosts.template
plugins/trunk/hostblock/templates/editblogblockedhost.template
Log:
Modified: plugins/trunk/hostblock/class/action/adminaddblockedhostaction.class.php
===================================================================
--- plugins/trunk/hostblock/class/action/adminaddblockedhostaction.class.php 2005-01-28 08:46:29 UTC (rev 869)
+++ plugins/trunk/hostblock/class/action/adminaddblockedhostaction.class.php 2005-01-28 09:51:48 UTC (rev 870)
@@ -11,15 +11,14 @@
*/
class AdminAddBlockedHostAction extends SiteAdminAction
{
-
var $_ip1;
var $_ip2;
var $_ip3;
var $_ip4;
var $_hostIp;
- var $_reason;
var $_blockType;
var $_mask;
+ var $_reason;
function AdminAddBlockedHostAction( $actionInfo, $request )
{
Modified: plugins/trunk/hostblock/class/action/adminaddblogblockedhostaction.class.php
===================================================================
--- plugins/trunk/hostblock/class/action/adminaddblogblockedhostaction.class.php 2005-01-28 08:46:29 UTC (rev 869)
+++ plugins/trunk/hostblock/class/action/adminaddblogblockedhostaction.class.php 2005-01-28 09:51:48 UTC (rev 870)
@@ -1,57 +1,56 @@
<?php
include_once( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
- include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
- include_once( PLOG_CLASS_PATH."class/view/admin/adminerrorview.class.php" );
- include_once( PLOG_CLASS_PATH."class/view/admin/adminmessageview.class.php" );
include_once( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
include_once( PLOG_CLASS_PATH."plugins/hostblock/class/dao/blockedhosts.class.php" );
+ include_once( PLOG_CLASS_PATH."plugins/hostblock/class/view/adminnewblogblockedhostview.class.php" );
+ include_once( PLOG_CLASS_PATH."plugins/hostblock/class/view/adminblogblockedhostsview.class.php" );
/**
* Adds new blocked content to the blog
*/
class AdminAddBlogBlockedHostAction extends BlogOwnerAdminAction
{
-
var $_ip1;
var $_ip2;
var $_ip3;
var $_ip4;
var $_hostIp;
+ var $_blockType;
var $_mask;
var $_reason;
- var $_blockType;
function AdminAddBlogBlockedHostAction( $actionInfo, $request )
{
$this->BlogOwnerAdminAction( $actionInfo, $request );
- }
- function validate()
- {
- // get the fields
- $this->_ip1 = $this->_request->getValue( "ip1" );
- $this->_ip2 = $this->_request->getValue( "ip2" );
- $this->_ip3 = $this->_request->getValue( "ip3" );
- $this->_ip4 = $this->_request->getValue( "ip4" );
- // and build up the ip address
- $this->_hostIp = $this->_ip1.".".$this->_ip2.".".$this->_ip3.".".$this->_ip4;
+ // set up the data validators
+ // data validation
+ $this->registerFieldValidator( "ip1", new IntegerValidator());
+ $this->registerFieldValidator( "ip2", new IntegerValidator());
+ $this->registerFieldValidator( "ip3", new IntegerValidator());
+ $this->registerFieldValidator( "ip4", new IntegerValidator());
+ $this->_form->registerField( "mask" );
+ $this->_form->registerField( "blockType" );
+ $this->_form->registerField( "reason" );
- // fetch the reason
- $this->_reason = $this->_request->getValue( "reason" );
-
- // and the type
- $this->_blockType = $this->_request->getValue( "blockType" );
-
- // finally, the mask
- $this->_mask = $this->_request->getValue( "mask" );
-
-
- return true;
+ $view = new AdminNewBlogBlockedHostView( $this->_blogInfo, $this->_hostId );
+ $view->setErrorMessage( $this->_locale->tr("error_provide_host_to_block" ));
+ $this->setValidationErrorView( $view );
}
function perform()
{
+ // fetch the data
+ $this->_ip1 = $this->_request->getValue( "ip1" );
+ $this->_ip2 = $this->_request->getValue( "ip2" );
+ $this->_ip3 = $this->_request->getValue( "ip3" );
+ $this->_ip4 = $this->_request->getValue( "ip4" );
+ $this->_hostIp = $this->_ip1.".".$this->_ip2.".".$this->_ip3.".".$this->_ip4;
+ $this->_mask = $this->_request->getValue( "mask" );
+ $this->_blockType = $this->_request->getValue( "blockType" );
+ $this->_reason = $this->_request->getValue( "reason" );
+
// create the dao object and add the info to the db
$blockedHosts = new BlockedHosts();
$t = new Timestamp();
@@ -63,20 +62,17 @@
// and give some feedback to the user
if( !$result ) {
- $message = $this->_locale->tr("error_adding_blocked_host");
- $message .= "<br/><br/><a href=\"javascript:history.go(-1);\">".$this->_locale->tr("back")."</a>";
- $this->_view = new AdminErrorView( $this->_blogInfo );
+ $this->_view = new AdminNewBlogBlockedHostView( $this->_blogInfo );
+ $this->_view->setErrorMessage( $this->_locale->tr("error_adding_blocked_host") );
+ $this->setCommonData();
+
+ return false;
}
- else {
- $message = $this->_locale->pr("blocked_host_added_ok", $this->_hostIp );
- $message .= "<br/><br/><a href=\"admin.php?op=blogBlockedHosts\">".$this->_locale->tr("back")."</a>";
- $this->_view = new AdminMessageView( $this->_blogInfo );
- $this->notifyEvent( EVENT_POST_BLOCK_HOST_ADD, Array( "host" => &$blockedHost ));
- }
+ $this->notifyEvent( EVENT_POST_BLOCK_HOST_ADD, Array( "host" => &$blockedHost ));
+ $this->_view = new AdminBlogBlockedHostsView( $this->_blogInfo );
+ $this->_view->setSuccessMessage( $this->_locale->tr("blocked_host_updated_ok") );
+ $this->setCommonData();
- $this->_view->setMessage( $message );
- $this->setCommonData();
-
return true;
}
}
Modified: plugins/trunk/hostblock/class/action/adminblogblockedhostsaction.class.php
===================================================================
--- plugins/trunk/hostblock/class/action/adminblogblockedhostsaction.class.php 2005-01-28 08:46:29 UTC (rev 869)
+++ plugins/trunk/hostblock/class/action/adminblogblockedhostsaction.class.php 2005-01-28 09:51:48 UTC (rev 870)
@@ -1,8 +1,7 @@
<?php
include_once( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
- include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
- include_once( PLOG_CLASS_PATH."plugins/hostblock/class/dao/blockedhosts.class.php" );
+ include_once( PLOG_CLASS_PATH."plugins/hostblock/class/view/adminblogblockedhostsview.class.php" );
/**
* Shows the list of hosts that have been blocked by the current blog
@@ -20,15 +19,8 @@
*/
function perform()
{
- // get the content that has been filtered by this blog
- $blockedHosts = new BlockedHosts();
- $hostsBlockedFromPosting = $blockedHosts->getBlogBlacklist( $this->_blogInfo->getId(), BLOCK_COMMENT_POSTING );
- $hostsBlocked = $blockedHosts->getBlogBlacklist( $this->_blogInfo->getId(), BLOCK_ACCESS );
+ $this->_view = new AdminBlogBlockedHostsView( $this->_blogInfo );
- $blogBlockedHosts = array_merge( $hostsBlockedFromPosting, $hostsBlocked );
-
- $this->_view = new AdminPluginTemplatedView( $this->_blogInfo, "hostblock", "blogblockedhosts" );
- $this->_view->setValue( "blockedhosts", $blogBlockedHosts );
$this->setCommonData();
// better to return true if everything fine
Modified: plugins/trunk/hostblock/class/action/admineditblogblockedhostaction.class.php
===================================================================
--- plugins/trunk/hostblock/class/action/admineditblogblockedhostaction.class.php 2005-01-28 08:46:29 UTC (rev 869)
+++ plugins/trunk/hostblock/class/action/admineditblogblockedhostaction.class.php 2005-01-28 09:51:48 UTC (rev 870)
@@ -1,10 +1,10 @@
<?php
include_once( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
- include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
- include_once( PLOG_CLASS_PATH."class/view/admin/adminerrorview.class.php" );
- include_once( PLOG_CLASS_PATH."plugins/hostblock/class/dao/blockedhosts.class.php" );
include_once( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
+ include_once( PLOG_CLASS_PATH."plugins/hostblock/class/dao/blockedhosts.class.php" );
+ include_once( PLOG_CLASS_PATH."plugins/hostblock/class/view/admineditblogblockedhostview.class.php" );
+ include_once( PLOG_CLASS_PATH."plugins/hostblock/class/view/adminblogblockedhostsview.class.php" );
/**
* Changes the settings of a blocked host
@@ -21,22 +21,12 @@
function AdminEditBlogBlockedHostAction( $actionInfo, $request )
{
$this->BlogOwnerAdminAction( $actionInfo, $request );
- }
- function validate()
- {
- $this->_hostId = $this->_request->getValue( "hostId" );
-
- $val = new IntegerValidator();
- if( !$val->validate( $this->_hostId )) {
- $this->_view = new AdminErrorView( $this->_blogInfo );
- $this->_view->setMessage( $this->_locale->tr( "error_incorrect_blocked_host_id" ));
- $this->setCommonData();
-
- return false;
- }
-
- return true;
+ // data validation stuff
+ $this->registerFieldValidator( "hostId", new IntegerValidator());
+ $view = new AdminBlogBlockedHostsView( $this->_blogInfo );
+ $view->setErrorMessage( $this->_locale->tr("error_incorrect_blocked_host_id") );
+ $this->setValidationErrorView( $view );
}
/**
@@ -44,29 +34,24 @@
*/
function perform()
{
+ // fetch the data
+ $this->_hostId = $this->_request->getValue( "hostId" );
+
$blockedHosts = new BlockedHosts();
$blockedHost = $blockedHosts->getBlockedHost( $this->_hostId, $this->_blogInfo->getId());
// check if the info about the blocked host is correct
if( !$blockedHost ) {
- $this->_view = new AdminErrorView( $this->_blogInfo );
- $this->_view->setMessage( $this->_locale->tr( "error_fetching_blocked_host" ));
+ $this->_view = new AdminBlogBlockedHostsView( $this->_blogInfo );
+ $this->_view->setErrorMessage( $this->_locale->tr("error_fetching_blocked_host"));
$this->setCommonData();
- return false;
+ return false;
}
// if so, continue
- $this->_view = new AdminPluginTemplatedView( $this->_blogInfo, "hostblock", "editblogblockedhost" );
- $this->_view->setValue( "blockedhost", $blockedHost );
+ $this->_view = new AdminEditBlogBlockedHostView( $this->_blogInfo, $this->_hostId );
- // to make things easier in the template, let's do the following:
- $ipParts = explode( ".", $blockedHost->getHost());
- $this->_view->setValue( "ip1", $ipParts[0] );
- $this->_view->setValue( "ip2", $ipParts[1] );
- $this->_view->setValue( "ip3", $ipParts[2] );
- $this->_view->setValue( "ip4", $ipParts[3] );
-
$this->setCommonData();
// better to return true if everything fine
Modified: plugins/trunk/hostblock/class/action/adminnewblockedhostaction.class.php
===================================================================
--- plugins/trunk/hostblock/class/action/adminnewblockedhostaction.class.php 2005-01-28 08:46:29 UTC (rev 869)
+++ plugins/trunk/hostblock/class/action/adminnewblockedhostaction.class.php 2005-01-28 09:51:48 UTC (rev 870)
@@ -6,7 +6,8 @@
/**
* Shows a form to add a new globally blocked host
*/
- class AdminNewBlockedHostAction extends SiteAdminAction {
+ class AdminNewBlockedHostAction extends SiteAdminAction
+ {
function AdminNewBlockedHostAction( $actionInfo, $request )
{
Modified: plugins/trunk/hostblock/class/action/adminnewblogblockedhostaction.class.php
===================================================================
--- plugins/trunk/hostblock/class/action/adminnewblogblockedhostaction.class.php 2005-01-28 08:46:29 UTC (rev 869)
+++ plugins/trunk/hostblock/class/action/adminnewblogblockedhostaction.class.php 2005-01-28 09:51:48 UTC (rev 870)
@@ -1,7 +1,7 @@
<?php
include_once( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
- include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+ include_once( PLOG_CLASS_PATH."plugins/hostblock/class/view/adminnewblogblockedhostview.class.php" );
/**
* Shows a form to add a new blocked content to the blog
@@ -16,7 +16,8 @@
function perform()
{
- $this->_view = new AdminPluginTemplatedView( $this->_blogInfo, "hostblock", "addblogblockedhost" );
+ $this->_view = new AdminNewBlogBlockedHostView( $this->_blogInfo );
+
$this->setCommonData();
return true;
Deleted: plugins/trunk/hostblock/class/action/adminupdatblogblockedaction.class.php
===================================================================
--- plugins/trunk/hostblock/class/action/adminupdatblogblockedaction.class.php 2005-01-28 08:46:29 UTC (rev 869)
+++ plugins/trunk/hostblock/class/action/adminupdatblogblockedaction.class.php 2005-01-28 09:51:48 UTC (rev 870)
@@ -1,85 +0,0 @@
-<?php
-
- include_once( PLOG_CLASS_PATH."class/action/blogowneradminaction.class.php" );
- include_once( PLOG_CLASS_PATH."class/view/adminerrorview.class.php" );
- include_once( PLOG_CLASS_PATH."class/view/adminmessageview.class.php" );
- include_once( PLOG_CLASS_PATH."plugins/hostblock/class/dao/blockedhosts.class.php" );
-
- /**
- * Changes the settings of a blocked host
- */
- class AdminUpdateBlogBlockedHostAction extends BlogOwnerAdminAction
- {
-
- var $_hostId;
- var $_reason;
- var $_ip1;
- var $_ip2;
- var $_ip3;
- var $_ip4;
- var $_ip;
- var $_mask;
- var $_type;
-
- /**
- * Constructor. If nothing else, it also has to call the constructor of the parent
- * class, BlogAction with the same parameters
- */
- function AdminUpdateBlogBlockedHostAction( $actionInfo, $request )
- {
- $this->BlogOwnerAdminAction( $actionInfo, $request );
- }
-
- function validate()
- {
- $this->_hostId = $this->_request->getValue( "hostId" );
- $this->_ip1 = $this->_request->getValue( "ip1" );
- $this->_ip2 = $this->_request->getValue( "ip2" );
- $this->_ip3 = $this->_request->getValue( "ip3" );
- $this->_ip4 = $this->_request->getValue( "ip4" );
- $this->_ip = $this->_ip1.".".$this->_ip2.".".$this->_ip3.".".$this->_ip4;
- $this->_mask = $this->_request->getValue( "mask" );
- $this->_type = $this->_request->getValue( "type" );
- $this->_reason = $this->_request->getValue( "reason" );
-
- return true;
- }
-
- /**
- * Carries out the specified action
- */
- function perform()
- {
- $blockedHosts = new BlockedHosts();
- $blockedHost = $blockedHosts->getBlockedHost( $this->_hostId, $this->_blogInfo->getId());
-
- // check if the info about the blocked host is correct
- if( !$blockedHost ) {
- $this->_view = new AdminErrorView( $this->_blogInfo );
- $this->_view->setMessage( $this->_locale->tr( "error_fetching_blocked_host" ));
- $this->setCommonData();
-
- return false;
- }
-
- // set the new information
- $blockedHost->setHost( $this->_ip );
- $blockedHost->setReason( $this->_reason );
- $blockedHost->setType( $this->_type );
- $blockedHost->setMask( $this->_mask );
- if( !$blockedHosts->update( $blockedHost )) {
- $this->_view = new AdminErrorView( $this->_blogInfo );
- $this->_view->setMessage( $this->_locale->tr( "error_updating_blocked_host" ));
- $this->setCommonData();
-
- return false;
- }
-
- $this->_view = new AdminMessageView( $this->_blogInfo );
- $this->_view->setMessage( $this->_locale->tr("blocked_host_updated_ok" ));
- $this->setCommonData();
-
- return true;
- }
- }
-?>
\ No newline at end of file
Modified: plugins/trunk/hostblock/class/action/adminupdateblockedhostaction.class.php
===================================================================
--- plugins/trunk/hostblock/class/action/adminupdateblockedhostaction.class.php 2005-01-28 08:46:29 UTC (rev 869)
+++ plugins/trunk/hostblock/class/action/adminupdateblockedhostaction.class.php 2005-01-28 09:51:48 UTC (rev 870)
@@ -32,7 +32,6 @@
// fetch the data
$this->_hostId = $this->_request->getValue( "hostId" );
-
// set up the data validators
// data validation
Modified: plugins/trunk/hostblock/class/action/adminupdateblogblockedhostaction.class.php
===================================================================
--- plugins/trunk/hostblock/class/action/adminupdateblogblockedhostaction.class.php 2005-01-28 08:46:29 UTC (rev 869)
+++ plugins/trunk/hostblock/class/action/adminupdateblogblockedhostaction.class.php 2005-01-28 09:51:48 UTC (rev 870)
@@ -1,9 +1,10 @@
<?php
include_once( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
- include_once( PLOG_CLASS_PATH."class/view/admin/adminerrorview.class.php" );
- include_once( PLOG_CLASS_PATH."class/view/admin/adminmessageview.class.php" );
+ include_once( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
include_once( PLOG_CLASS_PATH."plugins/hostblock/class/dao/blockedhosts.class.php" );
+ include_once( PLOG_CLASS_PATH."plugins/hostblock/class/view/admineditblogblockedhostview.class.php" );
+ include_once( PLOG_CLASS_PATH."plugins/hostblock/class/view/adminblogblockedhostsview.class.php" );
/**
* Changes the settings of a blocked host
@@ -28,11 +29,32 @@
function AdminUpdateBlogBlockedHostAction( $actionInfo, $request )
{
$this->BlogOwnerAdminAction( $actionInfo, $request );
+
+ // fetch the data
+ $this->_hostId = $this->_request->getValue( "hostId" );
+
+ // set up the data validators
+ // data validation
+ $this->registerFieldValidator( "hostId", new IntegerValidator());
+ $this->registerFieldValidator( "ip1", new IntegerValidator());
+ $this->registerFieldValidator( "ip2", new IntegerValidator());
+ $this->registerFieldValidator( "ip3", new IntegerValidator());
+ $this->registerFieldValidator( "ip4", new IntegerValidator());
+ $this->_form->registerField( "mask" );
+ $this->_form->registerField( "blockType" );
+ $this->_form->registerField( "reason" );
+
+ $view = new AdminEditBlogBlockedHostView( $this->_blogInfo, $this->_hostId );
+ $view->setErrorMessage( $this->_locale->tr("error_provide_host_to_block" ));
+ $this->setValidationErrorView( $view );
}
- function validate()
+ /**
+ * Carries out the specified action
+ */
+ function perform()
{
- $this->_hostId = $this->_request->getValue( "hostId" );
+ // fetch the data
$this->_ip1 = $this->_request->getValue( "ip1" );
$this->_ip2 = $this->_request->getValue( "ip2" );
$this->_ip3 = $this->_request->getValue( "ip3" );
@@ -41,27 +63,17 @@
$this->_mask = $this->_request->getValue( "mask" );
$this->_type = $this->_request->getValue( "blockType" );
$this->_reason = $this->_request->getValue( "reason" );
-
- return true;
- }
-
- /**
- * Carries out the specified action
- */
- function perform()
- {
+
$blockedHosts = new BlockedHosts();
- $blockedHost = $blockedHosts->getBlockedHost( $this->_hostId );
+ $blockedHost = $blockedHosts->getBlockedHost( $this->_hostId, $this->_blogInfo->getId() );
// check if the info about the blocked host is correct
if( !$blockedHost ) {
- $this->_view = new AdminErrorView( $this->_blogInfo );
- $message = $this->_locale->tr( "error_fetching_blocked_host" );
- $message .= "<br/><br/><a href=\"javascript:history.go(-1);\">".$this->_locale->tr("back")."</a>";
- $this->_view->setMessage( $message );
+ $this->_view = new AdminBlogBlockedHostsView( $this->_blogInfo );
+ $this->_view->setErrorMessage( $this->_locale->tr("error_fetching_blocked_host") );
$this->setCommonData();
- return false;
+ return false;
}
// set the new information
@@ -71,22 +83,17 @@
$blockedHost->setMask( $this->_mask );
$this->notifyEvent( EVENT_PRE_BLOCK_HOST_UPDATE, Array( "host" => &$blockedHost ));
if( !$blockedHosts->update( $blockedHost )) {
- $this->_view = new AdminErrorView( $this->_blogInfo );
- $message = $this->_locale->tr( "error_updating_blocked_host" );
- $message .= "<br/><br/><a href=\"javascript:history.go(-1);\">".$this->_locale->tr("back")."</a>";
- $this->_view->setMessage( $message );
+ $this->_view = new AdminBlogBlockedHostsView( $this->_blogInfo );
+ $this->_view->setErrorMessage( $this->_locale->tr("error_updating_blocked_host") );
$this->setCommonData();
- return false;
+ return false;
}
$this->notifyEvent( EVENT_POST_BLOCK_HOST_UPDATE, Array( "host" => &$blockedHost ));
-
- $this->_view = new AdminMessageView( $this->_blogInfo );
- $message = $this->_locale->tr("blocked_host_updated_ok" );
- $message .= "<br/><br/><a href=\"admin.php?op=blogBlockedHosts\">".$this->_locale->tr("view")."</a>";
- $this->_view->setMessage( $message );
- $this->setCommonData();
-
+ $this->_view = new AdminBlogBlockedHostsView( $this->_blogInfo );
+ $this->_view->setSuccessMessage( $this->_locale->tr("blocked_host_updated_ok") );
+ $this->setCommonData();
+
return true;
}
}
Added: plugins/trunk/hostblock/class/view/adminblogblockedhostsview.class.php
===================================================================
--- plugins/trunk/hostblock/class/view/adminblogblockedhostsview.class.php 2005-01-28 08:46:29 UTC (rev 869)
+++ plugins/trunk/hostblock/class/view/adminblogblockedhostsview.class.php 2005-01-28 09:51:48 UTC (rev 870)
@@ -0,0 +1,30 @@
+<?php
+
+ include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+ include_once( PLOG_CLASS_PATH."plugins/hostblock/class/dao/blockedhosts.class.php" );
+ /**
+ * implements the main view of the feed reader plugin
+ */
+ class AdminBlogBlockedHostsView extends AdminPluginTemplatedView
+ {
+
+ function AdminBlogBlockedHostsView( $blogInfo )
+ {
+ $this->AdminPluginTemplatedView( $blogInfo, "hostblock", "blogblockedhosts" );
+ }
+
+ function render()
+ {
+ // get the content that has been filtered by this blog
+ $blockedHosts = new BlockedHosts();
+ $hostsBlockedFromPosting = $blockedHosts->getBlogBlacklist( $this->_blogInfo->getId(), BLOCK_COMMENT_POSTING );
+ $hostsBlocked = $blockedHosts->getBlogBlacklist( $this->_blogInfo->getId(), BLOCK_ACCESS );
+
+ $blogBlockedHosts = array_merge( $hostsBlockedFromPosting, $hostsBlocked );
+
+ $this->setValue( "blockedhosts", $blogBlockedHosts );
+
+ parent::render();
+ }
+ }
+?>
\ No newline at end of file
Added: plugins/trunk/hostblock/class/view/admineditblogblockedhostview.class.php
===================================================================
--- plugins/trunk/hostblock/class/view/admineditblogblockedhostview.class.php 2005-01-28 08:46:29 UTC (rev 869)
+++ plugins/trunk/hostblock/class/view/admineditblogblockedhostview.class.php 2005-01-28 09:51:48 UTC (rev 870)
@@ -0,0 +1,36 @@
+<?php
+
+ include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+ include_once( PLOG_CLASS_PATH."plugins/hostblock/class/dao/blockedhosts.class.php" );
+
+ /**
+ * implements the main view of the feed reader plugin
+ */
+ class AdminEditBlogBlockedHostView extends AdminPluginTemplatedView
+ {
+ var $_hostId;
+
+ function AdminEditBlogBlockedHostView( $blogInfo, $hostId )
+ {
+ $this->AdminPluginTemplatedView( $blogInfo, "hostblock", "editblogblockedhost" );
+
+ $this->_hostId = $hostId;
+ }
+
+ function render()
+ {
+ $blockedHosts = new BlockedHosts();
+ $blockedHost = $blockedHosts->getBlockedHost( $this->_hostId, $this->_blogInfo->getId());
+
+ $this->setValue( "blockedhost", $blockedHost );
+ // to make things easier in the template, let's do the following:
+ $ipParts = explode( ".", $blockedHost->getHost());
+ $this->setValue( "ip1", $ipParts[0] );
+ $this->setValue( "ip2", $ipParts[1] );
+ $this->setValue( "ip3", $ipParts[2] );
+ $this->setValue( "ip4", $ipParts[3] );
+
+ parent::render();
+ }
+ }
+?>
\ No newline at end of file
Added: plugins/trunk/hostblock/class/view/adminnewblogblockedhostview.class.php
===================================================================
--- plugins/trunk/hostblock/class/view/adminnewblogblockedhostview.class.php 2005-01-28 08:46:29 UTC (rev 869)
+++ plugins/trunk/hostblock/class/view/adminnewblogblockedhostview.class.php 2005-01-28 09:51:48 UTC (rev 870)
@@ -0,0 +1,22 @@
+<?php
+
+ include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+
+ /**
+ * implements the main view of the feed reader plugin
+ */
+ class AdminNewBlogBlockedHostView extends AdminPluginTemplatedView
+ {
+
+ function AdminNewBlogBlockedHostView( $blogInfo )
+ {
+ $this->AdminPluginTemplatedView( $blogInfo, "hostblock", "addblogblockedhost" );
+ }
+
+ function render()
+ {
+ // get the content that has been filtered by this blog
+ parent::render();
+ }
+ }
+?>
\ No newline at end of file
Modified: plugins/trunk/hostblock/templates/addblogblockedhost.template
===================================================================
--- plugins/trunk/hostblock/templates/addblogblockedhost.template 2005-01-28 08:46:29 UTC (rev 869)
+++ plugins/trunk/hostblock/templates/addblogblockedhost.template 2005-01-28 09:51:48 UTC (rev 870)
@@ -1,47 +1,52 @@
{include file="$admintemplatepath/header.template"}
{include file="$admintemplatepath/navigation.template" showOpt=newBlogBlockedHost title=$locale->tr("newBlogBlockedHost")}
{include file="common.template"}
-<p>
-{$locale->tr("block_host_intro")}
-</p>
<form name="newBlogBlockedHost" action="admin.php" method="post" onSubmit="return checkIpAddress(this);">
- <table width="100%">
- <tr>
- <td class="alignright" width="15%">{$locale->tr("ip_address")}: </td>
- <td>
- <input type="text" size="3" maxlength="3" name="ip1" />.
- <input type="text" size="3" maxlength="3" name="ip2" />.
- <input type="text" size="3" maxlength="3" name="ip3" />.
- <input type="text" size="3" maxlength="3" name="ip4" />
- / <select name="mask">
+ <fieldset class="inputField">
+ <legend>{$locale->tr("addBlogBlockedHost")}</legend>
+ {include file="$admintemplatepath/successmessage.template"}
+ {include file="$admintemplatepath/errormessage.template"}
+ <div class="field">
+ <label for="blockedHost">{$locale->tr("ip_address")}</label>
+ <span class="required">*</span>
+ <div class="formHelp">{$locale->tr("host_to_block_help")}</div>
+ <input style="width:40px;" type="text" size="3" maxlength="3" name="ip1" id="ip1" />.
+ <input style="width:40px;" type="text" size="3" maxlength="3" name="ip2" id="ip2" />.
+ <input style="width:40px;" type="text" size="3" maxlength="3" name="ip3" id="ip3" />.
+ <input style="width:40px;" type="text" size="3" maxlength="3" name="ip4" id="ip4" />
+ / <select name="mask" id="mask" >
<option value="8">8 {$locale->tr("bits")}</option>
<option value="16">16 {$locale->tr("bits")}</option>
<option value="24">24 {$locale->tr("bits")}</option>
<option value="32" selected="selected">32 {$locale->tr("bits")}</option>
</select>
- </td>
- </tr>
- <tr>
- <td class="alignright">{$locale->tr("block_type")}:</td>
- <td>
- <select name="blockType">
+ </div>
+
+ <div class="field">
+ <label for="blockType">{$locale->tr("block_type")}</label>
+ <span class="required"></span>
+ <div class="formHelp">{$locale->tr("block_type_help")}</div>
+ <select name="blockType" id="blockType">
<option value="1">{$locale->tr("access_blocked")}</option>
<option value="2">{$locale->tr("posting_blocked")}</option>
- </select>
- </td>
- </tr>
- <tr>
- <td class="alignright">{$locale->tr("reason")}: </td>
- <td><input type="text" style="width:100%" name="reason" value=""/></td>
- </tr>
- <tr>
- <td> </td>
- <td>
- <input type="hidden" name="op" value="addBlogBlockedHost" />
- <input type="submit" name="Add" value="{$locale->tr("block_this")}"/>
- </td>
- </tr>
- </table>
+ </select>
+ </div>
+
+ <div class="field">
+ <label for="reason">{$locale->tr("reason")}</label>
+ <span class="required"></span>
+ <div class="formHelp">{$locale->tr("reason_help")}</div>
+ <input type="text" name="reason" id="reason" value=""/>
+ </div>
+
+ </fieldset>
+
+ <div class="buttons">
+ <input type="hidden" name="op" value="addBlogBlockedHost" />
+ <input type="reset" value="{$locale->tr("reset")}" name="reset"/>
+ <input type="submit" name="Add" value="{$locale->tr("add")}"/>
+ </div>
+
</form>
{include file="$admintemplatepath/footernavigation.template"}
{include file="$admintemplatepath/footer.template"}
\ No newline at end of file
Modified: plugins/trunk/hostblock/templates/blockedhosts.template
===================================================================
--- plugins/trunk/hostblock/templates/blockedhosts.template 2005-01-28 08:46:29 UTC (rev 869)
+++ plugins/trunk/hostblock/templates/blockedhosts.template 2005-01-28 09:51:48 UTC (rev 870)
@@ -23,7 +23,7 @@
<td>
{if $blockedhost->getType() == 1}{$locale->tr("access_blocked")}{/if}
{if $blockedhost->getType() == 2}{$locale->tr("posting_blocked")}{/if}
- {if $blockedhost->isGlobal()} <b>[{$locale->tr("global")}]</b>{/if}
+ {** {if $blockedhost->isGlobal()} <b>[{$locale->tr("global")}]</b>{/if} **}
</td>
<td>
<div class="list_action_button">
Modified: plugins/trunk/hostblock/templates/blogblockedhosts.template
===================================================================
--- plugins/trunk/hostblock/templates/blogblockedhosts.template 2005-01-28 08:46:29 UTC (rev 869)
+++ plugins/trunk/hostblock/templates/blogblockedhosts.template 2005-01-28 09:51:48 UTC (rev 870)
@@ -1,30 +1,43 @@
{include file="$admintemplatepath/header.template"}
-{include file="$admintemplatepath/navigation.template" showOpt=blogBlockedHost title=$locale->tr("blogBlockedHost")}
+{include file="$admintemplatepath/navigation.template" showOpt=blogBlockedHosts title=$locale->tr("blogBlockedHosts")}
<form name="blogBlockedHosts" action="admin.php" method="post">
-<table width="100%" border="1">
- <tr>
- <th width="40%">{$locale->tr("ip_address")}/{$locale->tr("mask")}</th>
- <th>{$locale->tr("reason")}</th>
- <th>{$locale->tr("date")}</th>
- <th>{$locale->tr("type")}</th>
- <th>{$locale->tr("delete")}</th>
- </tr>
-{foreach from=$blockedhosts item=blockedhost}
- <tr>
- <td valign="top"><a href="admin.php?op=editBlogBlockedHost&hostId={$blockedhost->getId()}">{$blockedhost->getHost()}/{$blockedhost->getMask()}</a></td>
- <td valign="top">{$blockedhost->getReason()}</td>
- {assign var=blockedhostDate value=$blockedhost->getDateObject()}
- <td valign="top">{$locale->formatDate($blockedhostDate,"%d/%m/%Y %H:%M")}</td>
- <td valign="top">
- {if $blockedhost->getType() == 1}{$locale->tr("access_blocked")}{/if}
- {if $blockedhost->getType() == 2}{$locale->tr("posting_blocked")}{/if}
- </td>
- <td valign="top" align="center"><input type="checkbox" name="deleteBlogBlockedHost[{$blockedhost->getId()}]" value="{$blockedhost->getId()}"/></td>
- </tr>
-{/foreach}
-</table>
-<input type="hidden" name="op" value="blogDeleteBlockedHost" />
-<input type="submit" value="{$locale->tr("delete_selected")}" name="deleteSelected" />
+ <div id="list">
+ {include file="$admintemplatepath/successmessage.template"}
+ {include file="$admintemplatepath/errormessage.template"}
+ <table class="info">
+ <tr>
+ <th style="width:10px;"><input class="checkbox" type="checkbox" class="check" name="all" id="all" value="1" onclick="toggleAllChecks('blogBlockedHosts');" /></th>
+ <th style="width:150px;">{$locale->tr("ip_address")}</th>
+ <th style="width:200px;">{$locale->tr("reason")}</th>
+ <th style="width:150px;">{$locale->tr("date")}</th>
+ <th style="width:150px;">{$locale->tr("type")}</th>
+ <th style="width:95px;">{$locale->tr("actions")}</th>
+ </tr>
+ {foreach from=$blockedhosts item=blockedhost}
+ <tr>
+ <td align="center"><input class="checkbox" type="checkbox" name="deleteBlogBlockedHost[{$blockedhost->getId()}]" value="{$blockedhost->getId()}"/></td>
+ <td class="col_highlighted"><a href="admin.php?op=editBlogBlockedHost&hostId={$blockedhost->getId()}">{$blockedhost->getHost()}/{$blockedhost->getMask()}</a></td>
+ <td>{$blockedhost->getReason()}</td>
+ {assign var=blockedhostDate value=$blockedhost->getDateObject()}
+ <td>{$locale->formatDate($blockedhostDate,"%d/%m/%Y %H:%M")}</td>
+ <td>
+ {if $blockedhost->getType() == 1}{$locale->tr("access_blocked")}{/if}
+ {if $blockedhost->getType() == 2}{$locale->tr("posting_blocked")}{/if}
+ </td>
+ <td>
+ <div class="list_action_button">
+ <a href="?op=editBlogBlockedHost&hostId={$blockedhost->getId()}"><img src="imgs/icon_edit-16.png" alt="{$locale->tr("edit")}" /></a>
+ <a href="?op=deleteBlogBlockedHost&hostId={$blockedhost->getId()}"><img src="imgs/icon_delete-16.png" alt="{$locale->tr("delete")}" /></a>
+ </div>
+ </td>
+ </tr>
+ {/foreach}
+ </table>
+ <div id="list_action_bar">
+ <input type="hidden" name="op" value="deleteBlogBlockedHosts" />
+ <input type="submit" value="{$locale->tr("delete")}" name="deleteSelected" />
+ </div>
+ </div>
</form>
{include file="$admintemplatepath/footernavigation.template"}
{include file="$admintemplatepath/footer.template"}
\ No newline at end of file
Modified: plugins/trunk/hostblock/templates/editblogblockedhost.template
===================================================================
--- plugins/trunk/hostblock/templates/editblogblockedhost.template 2005-01-28 08:46:29 UTC (rev 869)
+++ plugins/trunk/hostblock/templates/editblogblockedhost.template 2005-01-28 09:51:48 UTC (rev 870)
@@ -1,45 +1,53 @@
{include file="$admintemplatepath/header.template"}
-{include file="$admintemplatepath/navigation.template" showOpt=blogBlockedHost title=$locale->tr("blogBlockedHost")}
+{include file="$admintemplatepath/navigation.template" showOpt=blogBlockedHosts title=$locale->tr("blogBlockedHosts")}
{include file="common.template"}
-<form name="newBlockedHost" action="admin.php" method="post" onSubmit="return checkIpAddress(this);">
- <table width="100%">
- <tr>
- <td class="alignright" width="15%">{$locale->tr("ip_address")}: </td>
- <td>
- <input type="text" size="3" maxlength="3" name="ip1" value="{$ip1}" />.
- <input type="text" size="3" maxlength="3" name="ip2" value="{$ip2}" />.
- <input type="text" size="3" maxlength="3" name="ip3" value="{$ip3}" />.
- <input type="text" size="3" maxlength="3" name="ip4" value="{$ip4}" />
- / <select name="mask">
+<form name="editBlogBlockedHost" action="admin.php" method="post" onSubmit="return checkIpAddress(this);">
+ <fieldset class="inputField">
+ <legend>{$locale->tr("editBlockedHost")}</legend>
+ {include file="$admintemplatepath/successmessage.template"}
+ {include file="$admintemplatepath/errormessage.template"}
+ <div class="field">
+ <label for="blockedHost">{$locale->tr("ip_address")}</label>
+ <span class="required">*</span>
+ <div class="formHelp">{$locale->tr("host_to_block_help")}</div>
+ <input style="width:40px;" type="text" size="3" maxlength="3" name="ip1" id="ip1" value="{$ip1}" />.
+ <input style="width:40px;" type="text" size="3" maxlength="3" name="ip2" id="ip2" value="{$ip2}" />.
+ <input style="width:40px;" type="text" size="3" maxlength="3" name="ip3" id="ip3" value="{$ip3}" />.
+ <input style="width:40px;" type="text" size="3" maxlength="3" name="ip4" id="ip4" value="{$ip4}" />
+ / <select name="mask" id="mask">
<option value="8" {if $blockedhost->getMask() == 8} selected="selected"{/if}>8 {$locale->tr("bits")}</option>
<option value="16" {if $blockedhost->getMask() == 16} selected="selected"{/if}>16 {$locale->tr("bits")}</option>
<option value="24" {if $blockedhost->getMask() == 24} selected="selected"{/if}>24 {$locale->tr("bits")}</option>
<option value="32" {if $blockedhost->getMask() == 32} selected="selected"{/if}>32 {$locale->tr("bits")}</option>
</select>
- </td>
- </tr>
- <tr>
- <td class="alignright">{$locale->tr("block_type")}:</td>
- <td>
- <select name="blockType">
- <option value="1" {if $blockedhost->getReason() == 1} selected="selected" {/if}>{$locale->tr("access_blocked")}</option>
- <option value="2" {if $blockedhost->getReason() == 2} selected="selected" {/if}>{$locale->tr("posting_blocked")}</option>
- </select>
- </td>
- </tr>
- <tr>
- <td class="alignright">{$locale->tr("reason")}: </td>
- <td><input type="text" style="width:100%" name="reason" value="{$blockedhost->getReason()}"/></td>
- </tr>
- <tr>
- <td> </td>
- <td>
- <input type="hidden" name="op" value="updateBlogBlockedHost" />
- <input type="hidden" name="hostId" value="{$blockedhost->getId()}" />
- <input type="submit" name="Add" value="{$locale->tr("update")}"/>
- </td>
- </tr>
- </table>
+ </div>
+
+ <div class="field">
+ <label for="blockType">{$locale->tr("block_type")}</label>
+ <span class="required"></span>
+ <div class="formHelp">{$locale->tr("block_type_help")}</div>
+ <select name="blockType" id="blockType">
+ <option value="1" {if $blockedhost->getType() == 1} selected="selected" {/if}>{$locale->tr("access_blocked")}</option>
+ <option value="2" {if $blockedhost->getType() == 2} selected="selected" {/if}>{$locale->tr("posting_blocked")}</option>
+ </select>
+ </div>
+
+ <div class="field">
+ <label for="reason">{$locale->tr("reason")}</label>
+ <span class="required"></span>
+ <div class="formHelp">{$locale->tr("reason_help")}</div>
+ <input type="text" name="reason" id="reason" value="{$blockedhost->getReason()}"/>
+ </div>
+
+ </fieldset>
+
+ <div class="buttons">
+ <input type="hidden" name="op" value="updateBlogBlockedHost" />
+ <input type="hidden" name="hostId" value="{$blockedhost->getId()}" />
+ <input type="reset" name="reset" value="{$locale->tr("reset")}" />
+ <input type="submit" name="Add" value="{$locale->tr("update")}"/>
+ </div>
+
</form>
{include file="$admintemplatepath/footernavigation.template"}
{include file="$admintemplatepath/footer.template"}
\ No newline at end of file
More information about the pLog-svn
mailing list