[pLog-svn] r5167 - in plugins/branches/lifetype-1.2/unported/secretblog: . class/action class/security class/view templates
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Fri Mar 23 08:28:24 EDT 2007
Author: oscar
Date: 2007-03-23 08:28:24 -0400 (Fri, 23 Mar 2007)
New Revision: 5167
Modified:
plugins/branches/lifetype-1.2/unported/secretblog/class/action/adminsecretblogpluginsettingsaction.class.php
plugins/branches/lifetype-1.2/unported/secretblog/class/action/adminsecretblogpluginupdatesettingsaction.class.php
plugins/branches/lifetype-1.2/unported/secretblog/class/security/secretblogfilter.class.php
plugins/branches/lifetype-1.2/unported/secretblog/class/view/adminsecretblogpluginsettingsview.class.php
plugins/branches/lifetype-1.2/unported/secretblog/pluginsecretblog.class.php
plugins/branches/lifetype-1.2/unported/secretblog/templates/passwordform.template
plugins/branches/lifetype-1.2/unported/secretblog/templates/pluginsettings.template
Log:
Secretblog plugin ported to LT 1.2, based on the version provided at http://omar.spollo.com/blog.php/2007/03/22/secret-blog-plugin-for-lifetype-1.2/
Modified: plugins/branches/lifetype-1.2/unported/secretblog/class/action/adminsecretblogpluginsettingsaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/unported/secretblog/class/action/adminsecretblogpluginsettingsaction.class.php 2007-03-23 11:56:15 UTC (rev 5166)
+++ plugins/branches/lifetype-1.2/unported/secretblog/class/action/adminsecretblogpluginsettingsaction.class.php 2007-03-23 12:28:24 UTC (rev 5167)
@@ -1,9 +1,10 @@
<?php
- lt_include( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
- lt_include( PLOG_CLASS_PATH."plugins/secretblog/class/view/adminsecretblogpluginsettingsview.class.php" );
+// include_once( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
+ include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+ include_once( PLOG_CLASS_PATH."plugins/secretblog/class/view/adminsecretblogpluginsettingsview.class.php" );
- class AdminSecretBlogPluginSettingsAction extends BlogOwnerAdminAction
+ class AdminSecretBlogPluginSettingsAction extends AdminAction
{
/**
@@ -12,7 +13,8 @@
*/
function AdminSecretBlogPluginSettingsAction( $actionInfo, $request )
{
- $this->BlogOwnerAdminAction( $actionInfo, $request );
+ $this->AdminAction( $actionInfo, $request );
+ $this->requirePermission( "manage_plugins" );
}
/**
Modified: plugins/branches/lifetype-1.2/unported/secretblog/class/action/adminsecretblogpluginupdatesettingsaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/unported/secretblog/class/action/adminsecretblogpluginupdatesettingsaction.class.php 2007-03-23 11:56:15 UTC (rev 5166)
+++ plugins/branches/lifetype-1.2/unported/secretblog/class/action/adminsecretblogpluginupdatesettingsaction.class.php 2007-03-23 12:28:24 UTC (rev 5167)
@@ -1,10 +1,11 @@
<?php
- lt_include( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
- lt_include( PLOG_CLASS_PATH."plugins/secretblog/class/view/adminsecretblogpluginsettingsview.class.php" );
- lt_include( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
+ include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+// include_once( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
+ include_once( PLOG_CLASS_PATH."plugins/secretblog/class/view/adminsecretblogpluginsettingsview.class.php" );
+ include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
- class AdminSecretBlogPluginUpdateSettingsAction extends BlogOwnerAdminAction
+ class AdminSecretBlogPluginUpdateSettingsAction extends AdminAction
{
var $_pluginEnabled;
@@ -16,7 +17,8 @@
*/
function AdminSecretBlogPluginUpdateSettingsAction( $actionInfo, $request )
{
- $this->BlogOwnerAdminAction( $actionInfo, $request );
+ $this->AdminAction( $actionInfo, $request );
+ $this->requirePermission( "manage_plugins" );
}
function validate()
@@ -67,4 +69,4 @@
return true;
}
}
-?>
+?>
\ No newline at end of file
Modified: plugins/branches/lifetype-1.2/unported/secretblog/class/security/secretblogfilter.class.php
===================================================================
--- plugins/branches/lifetype-1.2/unported/secretblog/class/security/secretblogfilter.class.php 2007-03-23 11:56:15 UTC (rev 5166)
+++ plugins/branches/lifetype-1.2/unported/secretblog/class/security/secretblogfilter.class.php 2007-03-23 12:28:24 UTC (rev 5167)
@@ -1,8 +1,9 @@
<?php
- lt_include( PLOG_CLASS_PATH."class/security/pipelinefilter.class.php" );
- lt_include( PLOG_CLASS_PATH . 'class/template/template.class.php' );
+ include_once( PLOG_CLASS_PATH."class/security/pipelinefilter.class.php" );
+ include_once( PLOG_CLASS_PATH . 'class/template/template.class.php' );
+
class SecretBlogFilter extends PipelineFilter
{
@@ -24,18 +25,21 @@
$result = new PipelineResult( true );
return( $result );
}
+
// if this is already rejected, there is no reason to do anything here
if ( $this->_pipelineRequest->getRejectedState() )
return new PipelineResult();
-
+
+
// there are three possible situations:
// - user not authenticated
// - user not authenticated but blogPassword parameter in the request
// - user authenticated
+
if( $this->isUserAuthenticated( $blogInfo )) {
- $result = new PipelineResult( true );
+ $result = new PipelineResult( true );
return( $result );
}
else {
@@ -46,9 +50,8 @@
$blogSettings = $blogInfo->getSettings();
$blogPassword = $blogSettings->getValue( "plugin_secretblog_password" );
if( $blogPassword == md5( $password )) {
- // set the password in the session
- $session["blogPassword"] = md5( $password );
- HttpVars::setSession( $session );
+ // set the password in a cookie
+ setcookie("blogPassword", md5( $password ));
// and return everything ok...
$result = new PipelineResult( true );
return( $result );
@@ -73,10 +76,9 @@
*/
function isUserAuthenticated( $blogInfo )
{
- // retrieve the session
- $session = HttpVars::getSession();
- // and look for our information
- $sessionPassword = $session["blogPassword"];
+ // Get the password from the cookie
+ $sessionPassword = $_COOKIE["blogPassword"];
+
if( $sessionPassword ) {
$blogSettings = $blogInfo->getSettings();
$blogPassword = $blogSettings->getValue( "plugin_secretblog_password" );
@@ -85,7 +87,8 @@
else
return false;
}
- else
+
+ else
return false;
}
@@ -95,7 +98,7 @@
*/
function renderPasswordForm( $blogInfo )
{
- lt_include( PLOG_CLASS_PATH."class/template/templateservice.class.php" );
+ include_once( PLOG_CLASS_PATH."class/template/templateservice.class.php" );
$ts = new TemplateService();
$t = $ts->PluginTemplate( "secretblog", "passwordform" );
$t->assign( "locale", $blogInfo->getLocale() );
Modified: plugins/branches/lifetype-1.2/unported/secretblog/class/view/adminsecretblogpluginsettingsview.class.php
===================================================================
--- plugins/branches/lifetype-1.2/unported/secretblog/class/view/adminsecretblogpluginsettingsview.class.php 2007-03-23 11:56:15 UTC (rev 5166)
+++ plugins/branches/lifetype-1.2/unported/secretblog/class/view/adminsecretblogpluginsettingsview.class.php 2007-03-23 12:28:24 UTC (rev 5167)
@@ -1,6 +1,6 @@
<?php
- lt_include( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+ include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
class AdminSecretBlogPluginSettingsView extends AdminPluginTemplatedView
{
Modified: plugins/branches/lifetype-1.2/unported/secretblog/pluginsecretblog.class.php
===================================================================
--- plugins/branches/lifetype-1.2/unported/secretblog/pluginsecretblog.class.php 2007-03-23 11:56:15 UTC (rev 5166)
+++ plugins/branches/lifetype-1.2/unported/secretblog/pluginsecretblog.class.php 2007-03-23 12:28:24 UTC (rev 5167)
@@ -1,31 +1,44 @@
<?php
- lt_include( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
+ include_once( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
+ include_once( PLOG_CLASS_PATH."plugins/secretblog/class/security/secretblogfilter.class.php" );
+ include_once( PLOG_CLASS_PATH."class/template/menu/menu.class.php" );
class PluginSecretBlog extends PluginBase
{
- function PluginSecretBlog()
+ function PluginSecretBlog( $source )
{
- $this->PluginBase();
+ $this->PluginBase( $source );
$this->id = "secretblog";
$this->author = "The LifeType Project";
+ $this->version = "20030723";
- lt_include( PLOG_CLASS_PATH."plugins/secretblog/class/security/secretblogfilter.class.php" );
// we only need to register a filter
$this->registerFilter( "SecretBlogFilter" );
-
- // register our own actions
- // register our action and menu entry
- $this->registerAdminAction( "pluginSecretBlogSettings", "AdminSecretBlogPluginSettingsAction" );
- $this->registerAdminAction( "pluginSecretBlogUpdateSettings", "AdminSecretBlogPluginUpdateSettingsAction" );
-
- // register our action and menu entry
- $menu =& Menu::getMenu();
- if( !$menu->entryExists( "/menu/controlCenter/manageSecurityPlugins" ))
- $this->addMenuEntry( "/menu/controlCenter", "manageSecurityPlugins", "", "", true, false );
- $this->addMenuEntry( "/menu/controlCenter/manageSecurityPlugins", "pluginSecretBlogSettings", "admin.php?op=pluginSecretBlogSettings", "", true, false );
- }
+
+ if( $this->getSource() == "admin" ) {
+ // register our own actions
+ // register our action and menu entry
+ $this->registerAdminAction( "pluginSecretBlogSettings", "AdminSecretBlogPluginSettingsAction" );
+ $this->registerAdminAction( "pluginSecretBlogUpdateSettings", "AdminSecretBlogPluginUpdateSettingsAction" );
+
+ // register our action and menu entry
+ $menu =& Menu::getMenu();
+ if( !$menu->entryExists( "/menu/controlCenter/manageSecurityPlugins" ))
+ $this->addMenuEntry( "/menu/controlCenter", "manageSecurityPlugins", "", "", true, false );
+ $this->addMenuEntry( "/menu/controlCenter/manageSecurityPlugins", "pluginSecretBlogSettings", "admin.php?op=pluginSecretBlogSettings", "", true, false );
+
+ }
+ }
+
+ /**
+ * export the list of globally configurable items
+ */
+ function getPluginConfigurationKeys()
+ {
+ return( Array( Array( "name" => "plugin_secretblog_enabled", "type" => "boolean" )));
+ }
}
?>
\ No newline at end of file
Modified: plugins/branches/lifetype-1.2/unported/secretblog/templates/passwordform.template
===================================================================
--- plugins/branches/lifetype-1.2/unported/secretblog/templates/passwordform.template 2007-03-23 11:56:15 UTC (rev 5166)
+++ plugins/branches/lifetype-1.2/unported/secretblog/templates/passwordform.template 2007-03-23 12:28:24 UTC (rev 5167)
@@ -1,26 +1,26 @@
-<!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" xml:lang="{$locale->getLanguageId()}" lang="{$locale->getLanguageId()}" dir="{$locale->getDirection()}">
- <head>
- <title>{$blog->getBlog()}</title>
- <style>
- {literal}
- .secretBlogTitle {
- font-size: 18px;
- font-weight: bold;
- }
- {/literal}
- </style>
- </head>
- <body>
-<span class="secretBlogTitle">{$locale->tr("secretblog_enter_password")}</span>
-<p>
-{$locale->tr("secretblog_blog_is_password_protected")}
-</p>
-<form name="password" action="{$url->getIndexUrl()}" method="post">
- {$locale->tr("password")}: <input type="password" name="blogPassword" value="" />
- <input type="hidden" name="blogId" value="{$blog->getId()}" />
- <input type="submit" name="Send" value="{$locale->tr("secretblog_send")}" />
- <input type="hidden" name="op" value="Default" />
-</form>
- </body>
+<!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" xml:lang="{$locale->getLanguageId()}" lang="{$locale->getLanguageId()}" dir="{$locale->getDirection()}">
+ <head>
+ <title>{$blog->getBlog()}</title>
+ <style>
+ {literal}
+ .secretBlogTitle {
+ font-size: 18px;
+ font-weight: bold;
+ }
+ {/literal}
+ </style>
+ </head>
+ <body>
+<span class="secretBlogTitle">{$locale->tr("secretblog_enter_password")}</span>
+<p>
+{$locale->tr("secretblog_blog_is_password_protected")}
+</p>
+<form name="password" action="{$url->getIndexUrl()}" method="post">
+ {$locale->tr("password")}: <input type="password" name="blogPassword" value="" />
+ <input type="hidden" name="blogId" value="{$blog->getId()}" />
+ <input type="submit" name="Send" value="{$locale->tr("secretblog_send")}" />
+ <input type="hidden" name="op" value="Default" />
+</form>
+ </body>
</html>
\ No newline at end of file
Modified: plugins/branches/lifetype-1.2/unported/secretblog/templates/pluginsettings.template
===================================================================
--- plugins/branches/lifetype-1.2/unported/secretblog/templates/pluginsettings.template 2007-03-23 11:56:15 UTC (rev 5166)
+++ plugins/branches/lifetype-1.2/unported/secretblog/templates/pluginsettings.template 2007-03-23 12:28:24 UTC (rev 5167)
@@ -8,7 +8,9 @@
<div class="field">
<label for="pluginEnabled">{$locale->tr("secretblog_plugin_enabled")}</label>
<div class="formHelp">
- <input class="checkbox" type="checkbox" name="pluginEnabled" id="pluginEnabled" {if $pluginEnabled} checked="checked" {/if} value="1" />{$locale->tr("secretblog_plugin_enabled_help")}
+ <input class="checkbox" type="checkbox" name="pluginEnabled"
+ id="pluginEnabled" {if $pluginEnabled} checked="checked" {/if}
+ value="1" {user_cannot_override key=plugin_secretblog_enabled}disabled="disabled"{/user_cannot_override}/>{$locale->tr("secretblog_plugin_enabled_help")}
</div>
</div>
@@ -29,4 +31,4 @@
</div>
</form>
{include file="$admintemplatepath/footernavigation.template"}
-{include file="$admintemplatepath/footer.template"}
\ No newline at end of file
+{include file="$admintemplatepath/footer.template"}
More information about the pLog-svn
mailing list