[pLog-svn] r5144 - in plugins/branches/lifetype-1.2: . hotlinkprevention hotlinkprevention/class hotlinkprevention/class/action hotlinkprevention/class/view hotlinkprevention/templates unported
pwestbro at devel.lifetype.net
pwestbro at devel.lifetype.net
Wed Mar 21 04:17:57 EDT 2007
Author: pwestbro
Date: 2007-03-21 04:17:56 -0400 (Wed, 21 Mar 2007)
New Revision: 5144
Added:
plugins/branches/lifetype-1.2/hotlinkprevention/
plugins/branches/lifetype-1.2/hotlinkprevention/class/
plugins/branches/lifetype-1.2/hotlinkprevention/locale/
plugins/branches/lifetype-1.2/hotlinkprevention/pluginhotlinkprevention.class.php
plugins/branches/lifetype-1.2/hotlinkprevention/readme.txt
plugins/branches/lifetype-1.2/hotlinkprevention/templates/
Removed:
plugins/branches/lifetype-1.2/hotlinkprevention/class/
plugins/branches/lifetype-1.2/hotlinkprevention/class/action/pluginglobalhotlinkpreventionconfigaction.class.php
plugins/branches/lifetype-1.2/hotlinkprevention/class/action/pluginglobalhotlinkpreventionupdateconfigaction.class.php
plugins/branches/lifetype-1.2/hotlinkprevention/class/security/
plugins/branches/lifetype-1.2/hotlinkprevention/class/view/pluginglobalhotlinkpreventionconfigview.class.php
plugins/branches/lifetype-1.2/hotlinkprevention/locale/
plugins/branches/lifetype-1.2/hotlinkprevention/pluginhotlinkprevention.class.php
plugins/branches/lifetype-1.2/hotlinkprevention/readme.txt
plugins/branches/lifetype-1.2/hotlinkprevention/templates/
plugins/branches/lifetype-1.2/hotlinkprevention/templates/globalhotlinkprevention.template
plugins/branches/lifetype-1.2/unported/hotlinkprevention/
Modified:
plugins/branches/lifetype-1.2/hotlinkprevention/class/action/pluginhotlinkpreventionupdateconfigaction.class.php
plugins/branches/lifetype-1.2/hotlinkprevention/templates/hotlinkprevention.template
Log:
Ported the hotlinkprevention to LifeType 1.2
Copied: plugins/branches/lifetype-1.2/hotlinkprevention (from rev 5134, plugins/branches/lifetype-1.2/unported/hotlinkprevention)
Copied: plugins/branches/lifetype-1.2/hotlinkprevention/class (from rev 5141, plugins/branches/lifetype-1.2/unported/hotlinkprevention/class)
Deleted: plugins/branches/lifetype-1.2/hotlinkprevention/class/action/pluginglobalhotlinkpreventionconfigaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/unported/hotlinkprevention/class/action/pluginglobalhotlinkpreventionconfigaction.class.php 2007-03-20 18:39:24 UTC (rev 5141)
+++ plugins/branches/lifetype-1.2/hotlinkprevention/class/action/pluginglobalhotlinkpreventionconfigaction.class.php 2007-03-21 08:17:56 UTC (rev 5144)
@@ -1,27 +0,0 @@
-<?php
-
- lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
- lt_include( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
- lt_include( PLOG_CLASS_PATH."plugins/hotlinkprevention/class/view/pluginglobalhotlinkpreventionconfigview.class.php" );
-
- /**
- * shows a form with the current configuration
- */
- class PluginGlobalHotlinkPreventionConfigAction extends AdminAction
- {
-
- function PluginGlobalHotlinkPreventionConfigAction( $actionInfo, $request )
- {
- $this->AdminAction( $actionInfo, $request );
- }
-
- function perform()
- {
- $this->_view = new PluginGlobalHotlinkPreventionConfigView( $this->_blogInfo );
-
- $this->setCommonData();
-
- return true;
- }
- }
-?>
\ No newline at end of file
Deleted: plugins/branches/lifetype-1.2/hotlinkprevention/class/action/pluginglobalhotlinkpreventionupdateconfigaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/unported/hotlinkprevention/class/action/pluginglobalhotlinkpreventionupdateconfigaction.class.php 2007-03-20 18:39:24 UTC (rev 5141)
+++ plugins/branches/lifetype-1.2/hotlinkprevention/class/action/pluginglobalhotlinkpreventionupdateconfigaction.class.php 2007-03-21 08:17:56 UTC (rev 5144)
@@ -1,78 +0,0 @@
-<?php
-
- lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
- lt_include( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
- lt_include( PLOG_CLASS_PATH."plugins/hotlinkprevention/class/view/pluginglobalhotlinkpreventionconfigview.class.php" );
- lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
-
- /**
- * updates the plugin configuration
- */
- class PluginGlobalHotlinkPreventionUpdateConfigAction extends AdminAction
- {
- var $_pluginEnabled;
- var $_allowBlogOwnerOverride;
- var $_fileExtensions;
- var $_blankRefererEnabled;
- var $_allowReferers;
-
- function PluginGlobalHotlinkPreventionUpdateConfigAction( $actionInfo, $request )
- {
- $this->AdminAction( $actionInfo, $request );
-
- // for data validation purposes, fileExtensions can not be empty
- $this->registerFieldValidator( "fileExtensions", new StringValidator());
- $view = new PluginGlobalHotlinkPreventionConfigView( $this->_blogInfo );
- $view->setErrorMessage( $this->_locale->tr("error_hotlinkprevention_fileextensions"));
- $this->setValidationErrorView( $view );
-
- // these fields do not need to be validated but should be there when we show the view once again
- $this->registerField( "pluginEnabled" );
- $this->registerField( "allowBlogOwnerOverride" );
- $this->registerField( "blankRefererEnabled" );
- $this->registerField( "allowReferers" );
- }
-
- function perform()
- {
- $this->_pluginEnabled = $this->_request->getValue( "pluginEnabled" );
- $this->_pluginEnabled = ($this->_pluginEnabled != "" );
- $this->_allowBlogOwnerOverride = $this->_request->getValue( "allowBlogOwnerOverride" );
- $this->_allowBlogOwnerOverride = ($this->_allowBlogOwnerOverride != "" );
- $this->_blankRefererEnabled = $this->_request->getValue( "blankRefererEnabled" );
- $this->_blankRefererEnabled = ($this->_blankRefererEnabled != "" );
- $this->_fileExtensions = $this->_request->getValue( "fileExtensions" );
- $this->_allowReferers = $this->_request->getValue( "allowReferers" );
-
- // update the plugin configurations to config
- $config =& Config::getConfig();
- $config->setValue( "plugin_globalhotlinkprevention_enabled", $this->_pluginEnabled );
- $config->setValue( "plugin_globalhotlinkprevention_allowblogowneroverride", $this->_allowBlogOwnerOverride );
- $config->setValue( "plugin_globalhotlinkprevention_fileextensions", $this->_fileExtensions );
- $config->setValue( "plugin_globalhotlinkprevention_blankrefererenabled", $this->_blankRefererEnabled );
- $config->setValue( "plugin_globalhotlinkprevention_allowreferers", $this->_allowReferers );
-
- // save the config settings
- if( !$config->save() ) {
- $this->_view = new PluginGlobalHotlinkPreventionConfigView( $this->_blogInfo );
- $this->_view->setErrorMessage( $this->_locale->tr("error_updating_settings"));
- $this->setCommonData();
-
- return false;
- }
-
- // if everything went ok...
- $this->_session->setValue( "blogInfo", $this->_blogInfo );
- $this->saveSession();
-
- $this->_view = new PluginGlobalHotlinkPreventionConfigView( $this->_blogInfo );
- $this->_view->setSuccessMessage( $this->_locale->tr("hotlinkprevention_settings_saved_ok"));
- $this->setCommonData();
-
- // clear the cache
- CacheControl::resetBlogCache( $this->_blogInfo->getId());
-
- return true;
- }
- }
-?>
\ No newline at end of file
Modified: plugins/branches/lifetype-1.2/hotlinkprevention/class/action/pluginhotlinkpreventionupdateconfigaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/unported/hotlinkprevention/class/action/pluginhotlinkpreventionupdateconfigaction.class.php 2007-03-20 18:39:24 UTC (rev 5141)
+++ plugins/branches/lifetype-1.2/hotlinkprevention/class/action/pluginhotlinkpreventionupdateconfigaction.class.php 2007-03-21 08:17:56 UTC (rev 5144)
@@ -67,6 +67,12 @@
$this->_view->setSuccessMessage( $this->_locale->tr("hotlinkprevention_settings_saved_ok"));
$this->setCommonData();
+
+ $plugins = $this->_pm->getPlugins();
+
+ $plugin = $plugins["hotlinkprevention"];
+ $plugin->UpdateHtAccess();
+
// clear the cache
CacheControl::resetBlogCache( $this->_blogInfo->getId());
Deleted: plugins/branches/lifetype-1.2/hotlinkprevention/class/view/pluginglobalhotlinkpreventionconfigview.class.php
===================================================================
--- plugins/branches/lifetype-1.2/unported/hotlinkprevention/class/view/pluginglobalhotlinkpreventionconfigview.class.php 2007-03-20 18:39:24 UTC (rev 5141)
+++ plugins/branches/lifetype-1.2/hotlinkprevention/class/view/pluginglobalhotlinkpreventionconfigview.class.php 2007-03-21 08:17:56 UTC (rev 5144)
@@ -1,41 +0,0 @@
-<?php
-
- lt_include( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
-
- /**
- * implements the main view of the feed reader plugin
- */
- class PluginGlobalHotlinkPreventionConfigView extends AdminPluginTemplatedView
- {
-
- function PluginGlobalHotlinkPreventionConfigView( $blogInfo )
- {
- $this->AdminPluginTemplatedView( $blogInfo, "hotlinkprevention", "globalhotlinkprevention" );
- }
-
- function render()
- {
- // load some configuration settings
- $config =& Config::getConfig();
- $pluginEnabled = $config->getValue( "plugin_globalhotlinkprevention_enabled" );
- $allowBlogOwnerOverride = $config->getValue( "plugin_globalhotlinkprevention_allowblogowneroverride" );
- $fileExtensions = $config->getValue( "plugin_globalhotlinkprevention_fileextensions" );
- if ($fileExtensions == "") $fileExtensions = "*.*";
- $blankRefererEnabled = $config->getValue( "plugin_globalhotlinkprevention_blankrefererenabled" );
- $allowReferers = $config->getValue( "plugin_globalhotlinkprevention_allowreferers" );
- if ($allowReferers == "") {
- $rg =& RequestGenerator::getRequestGenerator( $blogInfo );
- $allowReferers = $rg->getBaseUrl();
- }
-
- // create a view and export the settings to the template
- $this->setValue( "pluginEnabled", $pluginEnabled );
- $this->setValue( "allowBlogOwnerOverride", $allowBlogOwnerOverride );
- $this->setValue( "fileExtensions", $fileExtensions );
- $this->setValue( "blankRefererEnabled", $blankRefererEnabled );
- $this->setValue( "allowReferers", $allowReferers );
-
- parent::render();
- }
- }
-?>
\ No newline at end of file
Copied: plugins/branches/lifetype-1.2/hotlinkprevention/locale (from rev 5141, plugins/branches/lifetype-1.2/unported/hotlinkprevention/locale)
Deleted: plugins/branches/lifetype-1.2/hotlinkprevention/pluginhotlinkprevention.class.php
===================================================================
--- plugins/branches/lifetype-1.2/unported/hotlinkprevention/pluginhotlinkprevention.class.php 2007-03-20 09:38:06 UTC (rev 5134)
+++ plugins/branches/lifetype-1.2/hotlinkprevention/pluginhotlinkprevention.class.php 2007-03-21 08:17:56 UTC (rev 5144)
@@ -1,52 +0,0 @@
-<?php
-
- lt_include( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
- lt_include( PLOG_CLASS_PATH."class/plugin/pluginmanager.class.php" );
- lt_include( PLOG_CLASS_PATH."plugins/hotlinkprevention/class/security/hotlinkpreventionfilter.class.php" );
-
- /**
- * Plugin that offers features to return a recent article comments from the current blog
- */
- class PluginHotlinkPrevention extends PluginBase
- {
- var $pluginEnabled;
- var $allowBlogOwnerOverride;
-
- function PluginHotlinkPrevention()
- {
- $this->PluginBase();
-
- $this->id = "hotlinkprevention";
- $this->author = "Mark Wu";
- $this->desc = "This plugin offers the hotlink prevention to resource.";
-
- $config =& Config::getConfig();
- $this->pluginEnabled = $config->getValue( "plugin_globalhotlinkprevention_enabled" );
- $this->allowBlogOwnerOverride = $config->getValue( "plugin_globalhotlinkprevention_allowblogowneroverride" );
-
- $this->locales = Array( "en_UK" , "zh_TW" );
-
- $this->init();
- }
-
- function init()
- {
- // we only need to register a filter
- $this->registerFilter( "HotlinkPreventionFilter" );
-
- $this->registerAdminAction( "globalHotlinkPrevention", "PluginGlobalHotlinkPreventionConfigAction" );
- $this->registerAdminAction( "updateGlobalHotlinkPreventionConfig", "PluginGlobalHotlinkPreventionUpdateConfigAction" );
- $this->registerAdminAction( "hotlinkprevention", "PluginHotlinkPreventionConfigAction" );
- $this->registerAdminAction( "updateHotlinkPreventionConfig", "PluginHotlinkPreventionUpdateConfigAction" );
-
- $this->addMenuEntry( "/menu/adminSettings/GlobalSettings", "globalHotlinkPrevention", "?op=globalHotlinkPrevention", "" );
-
- if($this->pluginEnabled && $this->allowBlogOwnerOverride) {
- $menu =& Menu::getMenu();
- if( !$menu->entryExists( "/menu/controlCenter/manageSecurityPlugins" ))
- $this->addMenuEntry( "/menu/controlCenter", "manageSecurityPlugins", "", "", true, false );
- $this->addMenuEntry( "/menu/controlCenter/manageSecurityPlugins", "HotlinkPrevention", "?op=hotlinkprevention", "" );
- }
- }
- }
-?>
\ No newline at end of file
Copied: plugins/branches/lifetype-1.2/hotlinkprevention/pluginhotlinkprevention.class.php (from rev 5141, plugins/branches/lifetype-1.2/unported/hotlinkprevention/pluginhotlinkprevention.class.php)
===================================================================
--- plugins/branches/lifetype-1.2/hotlinkprevention/pluginhotlinkprevention.class.php (rev 0)
+++ plugins/branches/lifetype-1.2/hotlinkprevention/pluginhotlinkprevention.class.php 2007-03-21 08:17:56 UTC (rev 5144)
@@ -0,0 +1,165 @@
+<?php
+
+ lt_include( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
+ lt_include( PLOG_CLASS_PATH."class/plugin/pluginmanager.class.php" );
+
+ /**
+ * Plugin that offers features to return a recent article comments from the current blog
+ */
+ class PluginHotlinkPrevention extends PluginBase
+ {
+ var $pluginEnabled;
+ var $allowBlogOwnerOverride;
+
+ function PluginHotlinkPrevention( $source = "" )
+ {
+ $this->PluginBase($source);
+
+ $this->id = "hotlinkprevention";
+ $this->author = "Mark Wu";
+ $this->desc = "This plugin offers the hotlink prevention to resource.";
+ $this->version = "20070320";
+
+ $this->locales = Array( "en_UK" , "zh_TW" );
+
+ if( $source == "admin" )
+ $this->initAdmin();
+ }
+
+ function initAdmin()
+ {
+ $this->registerAdminAction( "hotlinkprevention", "PluginHotlinkPreventionConfigAction" );
+ $this->registerAdminAction( "updateHotlinkPreventionConfig", "PluginHotlinkPreventionUpdateConfigAction" );
+
+ $menu =& Menu::getMenu();
+ if( !$menu->entryExists( "/menu/controlCenter/manageSecurityPlugins" ))
+ $this->addMenuEntry( "/menu/controlCenter", "manageSecurityPlugins", "", "", true, false );
+ $this->addMenuEntry( "/menu/controlCenter/manageSecurityPlugins", "HotlinkPrevention", "?op=hotlinkprevention", "" );
+ }
+
+
+ function register()
+ {
+ $blogSettings = $this->blogInfo->getSettings();
+ $this->pluginEnabled = $blogSettings->getValue( "plugin_hotlinkprevention_enabled" );
+
+ }
+
+ function isEnabled()
+ {
+ return $this->pluginEnabled;
+ }
+
+
+ /*
+ * Return cloud of the latest articles
+ */
+ function UpdateHtAccess(){
+ lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" );
+
+ $resourceStorage = new GalleryResourceStorage();
+
+ $resourceFolder = $resourceStorage->getResourcesStorageFolder();
+
+ $blogId = $this->blogInfo->getId();
+ $blogSettings = $this->blogInfo->getSettings();
+
+ // Create the path to the resource .htaccess file for this blog
+ $saveFile = $resourceFolder . $blogId . "/.htaccess";
+
+ if ($blogSettings->getValue( "plugin_hotlinkprevention_enabled" )){
+ $this->CreateHtAccess($saveFile);
+ } else {
+ $this->DeleteHtAccess($saveFile);
+ }
+
+
+ return true;
+ }
+
+ function DeleteHtAccess($htaccessFile){
+ unlink($htaccessFile);
+ }
+
+ function CreateHtAccess($htaccessFile){
+ $blogId = $this->blogInfo->getId();
+ $blogSettings = $this->blogInfo->getSettings();
+
+ $fileExtensions = $blogSettings->getValue( "plugin_hotlinkprevention_fileextensions" );
+ $extArray = explode( " ", $fileExtensions );
+
+ $allowReferers = $blogSettings->getValue( "plugin_hotlinkprevention_allowreferers" );
+
+
+ // Only create the .htaccess if at least one extension has been specified
+ if (count($extArray) > 0)
+ {
+ $fh = fopen( $htaccessFile, "w");
+
+ if ($fh) {
+
+ fwrite($fh, "RewriteEngine on\n");
+ fwrite($fh, "RewriteBase /\n");
+
+ $rewriteExtCond = "RewriteCond %{REQUEST_FILENAME} \.(";
+
+ $count = 0;
+
+ foreach($extArray as $fileExtension ) {
+ trim($fileExtension);
+ if( $fileExtension != "" && $fileExtension != " " ) {
+ if ($count > 0) {
+ $rewriteExtCond .= "|";
+ }
+
+ $rewriteExtCond .= $fileExtension;
+
+ $count++;
+ }
+ }
+
+ $rewriteExtCond .= ")$ [NC]\n";
+
+ fwrite($fh, $rewriteExtCond);
+
+ $blankRefererEnabled = $blogSettings->getValue( "plugin_hotlinkprevention_blankrefererenabled" );
+ if ($blankRefererEnabled) {
+ fwrite($fh, "RewriteCond %{HTTP_REFERER} !^$\n");
+ }
+
+
+ foreach(preg_split("/[\s]+/", $allowReferers ) as $allowReferer ) {
+ trim($allowReferer);
+ if( $allowReferer != "" && $allowReferer != "\r\n" && $allowReferer != "\r" && $allowReferer != "\n" ) {
+ fwrite($fh, "RewriteCond %{HTTP_REFERER} !^" . $allowReferer . " [NC]\n");
+ }
+ }
+
+ fwrite($fh, "RewriteRule ^(.*) - [F]\n");
+
+ fwrite($fh, "ErrorDocument 403 \"Hot linking is not allowed\"\n");
+
+ fclose($fh);
+ File::chMod($htaccessFile, 0644);
+ }
+ } else {
+ $this->DeleteHtAccess($htaccessFile);
+ }
+ }
+
+
+
+ function getPluginConfigurationKeys()
+ {
+ lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
+
+ return( Array(
+ Array( "name" => "plugin_hotlinkprevention_enabled", "type" => "boolean" ),
+ Array( "name" => "plugin_hotlinkprevention_fileextensions", "validator" => new StringValidator(), "type" => "string", "allowEmpty" => true ),
+ Array( "name" => "plugin_hotlinkprevention_blankrefererenabled", "type" => "boolean" ),
+ Array( "name" => "plugin_hotlinkprevention_allowreferers", "validator" => new StringValidator(), "type" => "string", "allowEmpty" => true ),
+ ));
+ }
+
+ }
+?>
\ No newline at end of file
Deleted: plugins/branches/lifetype-1.2/hotlinkprevention/readme.txt
===================================================================
--- plugins/branches/lifetype-1.2/unported/hotlinkprevention/readme.txt 2007-03-20 09:38:06 UTC (rev 5134)
+++ plugins/branches/lifetype-1.2/hotlinkprevention/readme.txt 2007-03-21 08:17:56 UTC (rev 5144)
@@ -1,31 +0,0 @@
-Plugin: Hotlink Prevention
-Author: Mark Wu
-License: Creative Commons Attribution-NonCommercial-ShareAlike 2.5
-Lincese URL: http://creativecommons.org/licenses/by-nc-sa/2.5/deed.en
-Restriction: CAN'T USE THIS PLUGIN IN COMMERCIAL PURPOSE OR ENVIRONMENT. If you want to use this plugin in commercial purpose or environment, just donate US$ 20 to pLog team or me. I'll grant the permission to you after I got the donation.
-Release Date: 2005/09/16
-Version: 1.0
-
-This plugin offers the most powerful hotlink prevention for your resource. Usage as follow:
-
-Install:
-========
-1. Install this plugin to your ./plugins folder
-2. Site owner can reach the control panel through "Admin Settings >> Global Settings >> Hotlink Prevention"
-3. Blog owner can reach the control panel through "Control Center >> Security Management >> Hotlink Prevention"
-
-Hotlink Prevention Algorithm:
-=============================
-1. Check the request referer.
- - If the referer is blank, check the "blankrefererenabled" parameter is enable or not. - If "blankrefererenabled" parameter enabled, go to step 3. if disabled, banned the request.
- - If the referer is not blank, go to step 2.
-2. Check the request referer is available in allow referer list or not.
- - If yes, return the request content to user.
- - If not, go to step 3.
-3. Check the file extension is protected or not.
- - If yes, banned the request.
- - If not, return the request content to user.
-
-Notice:
-=======
-If you found this plugin is useful, please kindly make donation to pLog project or myself (Mark).
\ No newline at end of file
Copied: plugins/branches/lifetype-1.2/hotlinkprevention/readme.txt (from rev 5141, plugins/branches/lifetype-1.2/unported/hotlinkprevention/readme.txt)
===================================================================
--- plugins/branches/lifetype-1.2/hotlinkprevention/readme.txt (rev 0)
+++ plugins/branches/lifetype-1.2/hotlinkprevention/readme.txt 2007-03-21 08:17:56 UTC (rev 5144)
@@ -0,0 +1,31 @@
+Plugin: Hotlink Prevention
+Author: Mark Wu
+License: Creative Commons Attribution-NonCommercial-ShareAlike 2.5
+Lincese URL: http://creativecommons.org/licenses/by-nc-sa/2.5/deed.en
+Restriction: CAN'T USE THIS PLUGIN IN COMMERCIAL PURPOSE OR ENVIRONMENT. If you want to use this plugin in commercial purpose or environment, just donate US$ 20 to pLog team or me. I'll grant the permission to you after I got the donation.
+Release Date: 2005/09/16
+Version: 1.0
+
+This plugin offers the most powerful hotlink prevention for your resource. Usage as follow:
+
+Install:
+========
+1. Install this plugin to your ./plugins folder
+2. Site owner can reach the control panel through "Admin Settings >> Global Settings >> Hotlink Prevention"
+3. Blog owner can reach the control panel through "Control Center >> Security Management >> Hotlink Prevention"
+
+Hotlink Prevention Algorithm:
+=============================
+1. Check the request referer.
+ - If the referer is blank, check the "blankrefererenabled" parameter is enable or not. - If "blankrefererenabled" parameter enabled, go to step 3. if disabled, banned the request.
+ - If the referer is not blank, go to step 2.
+2. Check the request referer is available in allow referer list or not.
+ - If yes, return the request content to user.
+ - If not, go to step 3.
+3. Check the file extension is protected or not.
+ - If yes, banned the request.
+ - If not, return the request content to user.
+
+Notice:
+=======
+If you found this plugin is useful, please kindly make donation to pLog project or myself (Mark).
\ No newline at end of file
Copied: plugins/branches/lifetype-1.2/hotlinkprevention/templates (from rev 5141, plugins/branches/lifetype-1.2/unported/hotlinkprevention/templates)
Deleted: plugins/branches/lifetype-1.2/hotlinkprevention/templates/globalhotlinkprevention.template
===================================================================
--- plugins/branches/lifetype-1.2/unported/hotlinkprevention/templates/globalhotlinkprevention.template 2007-03-20 18:39:24 UTC (rev 5141)
+++ plugins/branches/lifetype-1.2/hotlinkprevention/templates/globalhotlinkprevention.template 2007-03-21 08:17:56 UTC (rev 5144)
@@ -1,55 +0,0 @@
-{include file="$admintemplatepath/header.template"}
-{include file="$admintemplatepath/navigation.template" showOpt=globalHotlinkPrevention title=$locale->tr("hotlinkprevention_plugin")}
-<form name="globalHotlinkPreventionPluginConfig" method="post">
- <fieldset class="inputField">
- <legend>{$locale->tr("label_configuration")}</legend>
- {include file="$admintemplatepath/successmessage.template"}
- {include file="$admintemplatepath/errormessage.template"}
- <div class="field">
- <label for="pluginEnabled">{$locale->tr("label_enable")}</label>
- <span class="required"></span>
- <div class="formHelp">
- <input class="checkbox" type="checkbox" name="pluginEnabled" id="pluginEnabled" {if $pluginEnabled} checked="checked" {/if} value="1" />{$locale->tr("hotlinkprevention_plugin_global_enabled")}
- </div>
- </div>
-
- <div class="field">
- <label for="allowBlogOwnerOverride">{$locale->tr("label_allowblogowneroverride")}</label>
- <span class="required"></span>
- <div class="formHelp">
- <input class="checkbox" type="checkbox" name="allowBlogOwnerOverride" id="allowBlogOwnerOverride" {if $allowBlogOwnerOverride} checked="checked" {/if} value="1" />{$locale->tr("hotlinkprevention_plugin_allowblogowneroverride")}
- </div>
- </div>
-
- <div class="field">
- <label for="blankRefererEnabled">{$locale->tr("label_blankrefererenable")}</label>
- <span class="required"></span>
- <div class="formHelp">
- <input class="checkbox" type="checkbox" name="blankRefererEnabled" id="blankRefererEnabled" {if $blankRefererEnabled} checked="checked" {/if} value="1" />{$locale->tr("hotlinkprevention_blankrefererenabled")}
- </div>
- </div>
-
- <div class="field">
- <label for="allowReferers">{$locale->tr("label_allowreferers")}</label>
- <span class="required">*</span>
- <div class="formHelp">{$locale->tr("hotlinkprevention_allowreferers")}</div>
- <textarea rows="5" id="allowReferers" name="allowReferers" style="width:100%">{$allowReferers}</textarea>
- </div>
-
- <div class="field">
- <label for="fileExtensions">{$locale->tr("label_fileextensions")}</label>
- <span class="required">*</span>
- <div class="formHelp">{$locale->tr("hotlinkprevention_fileextensions")}</div>
- <input class="text" type="text" name="fileExtensions" id="fileExtensions" value="{$fileExtensions}" width="10" />
- </div>
-
- </fieldset>
-
- <div class="buttons">
- <input type="hidden" name="op" value="updateGlobalHotlinkPreventionConfig" />
- <input type="reset" name="{$locale->tr("reset")}" />
- <input type="submit" name="{$locale->tr("update_settings")}" value="{$locale->tr("update")}" />
- </div>
-</form>
-{include file="$admintemplatepath/footernavigation.template"}
-{include file="$admintemplatepath/footer.template"}
Modified: plugins/branches/lifetype-1.2/hotlinkprevention/templates/hotlinkprevention.template
===================================================================
--- plugins/branches/lifetype-1.2/unported/hotlinkprevention/templates/hotlinkprevention.template 2007-03-20 18:39:24 UTC (rev 5141)
+++ plugins/branches/lifetype-1.2/hotlinkprevention/templates/hotlinkprevention.template 2007-03-21 08:17:56 UTC (rev 5144)
@@ -9,7 +9,7 @@
<label for="pluginEnabled">{$locale->tr("label_enable")}</label>
<span class="required"></span>
<div class="formHelp">
- <input class="checkbox" type="checkbox" name="pluginEnabled" id="pluginEnabled" {if $pluginEnabled} checked="checked" {/if} value="1" />{$locale->tr("hotlinkprevention_plugin_enabled")}
+ <input class="checkbox" type="checkbox" name="pluginEnabled" id="pluginEnabled" {if $pluginEnabled} checked="checked" {/if} value="1" {user_cannot_override key=plugin_hotlinkprevention_enabled}disabled="disabled"{/user_cannot_override} />{$locale->tr("hotlinkprevention_plugin_enabled")}
</div>
</div>
@@ -17,7 +17,7 @@
<label for="blankRefererEnabled">{$locale->tr("label_blankrefererenable")}</label>
<span class="required"></span>
<div class="formHelp">
- <input class="checkbox" type="checkbox" name="blankRefererEnabled" id="blankRefererEnabled" {if $blankRefererEnabled} checked="checked" {/if} value="1" />{$locale->tr("hotlinkprevention_blankrefererenabled")}
+ <input class="checkbox" type="checkbox" name="blankRefererEnabled" id="blankRefererEnabled" {if $blankRefererEnabled} checked="checked" {/if} value="1" {user_cannot_override key=plugin_hotlinkprevention_blankrefererenabled}disabled="disabled"{/user_cannot_override} />{$locale->tr("hotlinkprevention_blankrefererenabled")}
</div>
</div>
@@ -25,14 +25,22 @@
<label for="allowReferers">{$locale->tr("label_allowreferers")}</label>
<span class="required">*</span>
<div class="formHelp">{$locale->tr("hotlinkprevention_allowreferers")}</div>
- <textarea rows="5" id="allowReferers" name="allowReferers" style="width:100%">{$allowReferers}</textarea>
+ <textarea rows="5" id="allowReferers" name="allowReferers" style="width:100%">{$allowReferers}
+ {user_cannot_override
+ key=plugin_hotlinkprevention_allowreferers}readonly="readonly"
+ {/user_cannot_override}
+ </textarea>
</div>
<div class="field">
<label for="fileExtensions">{$locale->tr("label_fileextensions")}</label>
<span class="required">*</span>
<div class="formHelp">{$locale->tr("hotlinkprevention_fileextensions")}</div>
- <input class="text" type="text" name="fileExtensions" id="fileExtensions" value="{$fileExtensions}" width="10" />
+ <input class="text" type="text" name="fileExtensions" id="fileExtensions"
+ {user_cannot_override
+ key=plugin_hotlinkprevention_fileextensions}readonly="readonly"
+ {/user_cannot_override}
+ value="{$fileExtensions}" width="10" />
</div>
</fieldset>
More information about the pLog-svn
mailing list