[pLog-svn] r2059 - plugins/trunk/authimage
ork at devel.plogworld.net
ork at devel.plogworld.net
Mon May 23 16:08:25 GMT 2005
Author: ork
Date: 2005-05-23 16:08:24 +0000 (Mon, 23 May 2005)
New Revision: 2059
Modified:
plugins/trunk/authimage/pluginauthimage.class.php
Log:
some minor changes, i think we should remove the auth via file writing, maybe we can just place an authimage string in the session? might be faster and more robust
Modified: plugins/trunk/authimage/pluginauthimage.class.php
===================================================================
--- plugins/trunk/authimage/pluginauthimage.class.php 2005-05-23 16:04:23 UTC (rev 2058)
+++ plugins/trunk/authimage/pluginauthimage.class.php 2005-05-23 16:08:24 UTC (rev 2059)
@@ -2,7 +2,6 @@
include_once( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
include_once( PLOG_CLASS_PATH."class/plugin/pluginmanager.class.php" );
- include_once( PLOG_CLASS_PATH."class/dao/model.class.php" );
include_once( PLOG_CLASS_PATH."class/net/rawrequestgenerator.class.php" );
include_once( PLOG_CLASS_PATH."class/misc/glob.class.php" );
include_once( PLOG_CLASS_PATH."plugins/authimage/class/security/authimagefilter.class.php" );
@@ -25,17 +24,20 @@
{
$this->PluginBase();
- $this->id = "authimage";
- $this->author = "Mark Wu";
- $this->desc = 'This plugin offers extra comment authentication for pLog. The idea is inspired by <a href="http://www.gudlyf.com/index.php?p=376">WordPress AuthImage Plugin</a> written by Gudlyf.';
+ $this->id = "authimage";
+ $this->author = "Mark Wu";
+ $this->desc = 'This plugin offers extra comment authentication for pLog. The idea is inspired by <a href="http://www.gudlyf.com/index.php?p=376">WordPress AuthImage Plugin</a> written by Gudlyf.';
+ $this->version = '1.0.1';
- $this->locales = Array( "en_UK" , "zh_TW" , "zh_CN", "es_ES" );
+ $this->locales = Array( "en_UK" , "zh_TW" , "zh_CN", "es_ES", "de_DE" );
$this->init();
}
function init()
{
+ include_once( PLOG_CLASS_PATH."class/template/menu/menu.class.php" );
+
// register the filter
$this->registerFilter( "AuthImageFilter" );
@@ -70,22 +72,29 @@
return $this->pluginEnabled;
}
- function pluginTemplatePage( $template )
+ function generateImageUrl()
{
$rg = new RawRequestGenerator($this->blogInfo);
$rg->addParameter( "op", "AuthImageShow" );
$rg->addParameter( "blogId", $this->blogInfo->getId());
- $templatePage = $rg->getIndexUrl().$rg->getRequest();
+ $imageUrl = $rg->getIndexUrl().$rg->getRequest();
- return $templatePage;
+ if ( !function_exists ('gd_info') ) {
+ // We don't have gd support compiled in, lets inform the user about it
+ return false;
+ }
+
+ return $imageUrl;
}
function show() {
- $authImage = $this->pluginTemplatePage( "authimage" );
- $authImageUrl = '<img src="'.$authImage.'" style="vertical-align:middle;" width="70px" height="20px" alt="authimage" />';
- return $authImageUrl;
+ $authImageUrl = $this->generateImageUrl();
+ if ( $authImageUrl )
+ return '<img src="'.$authImageUrl.'" style="vertical-align:middle;" width="70px" height="20px" alt="authimage" />';
+ else
+ return 'You don\'t have GD support compiled in, we cannot create an authimage. Please activate GD Support.';
}
function showImage() {
@@ -140,20 +149,24 @@
return $code;
}
- function deleteExpiredAuthImage( $expiretime ) {
- $path = PLOG_CLASS_PATH . $this->cacheFolder;
- if ( is_dir($path) )
- {
- $handle=opendir($path);
- while (false!==($file = readdir($handle))) {
- if ($file != "." && $file != ".." && $file != "index.htm") {
- $diff = time() - filectime("$path/$file");
- if ($diff > $expiretime) unlink("$path/$file");
- }
- }
- closedir($handle);
- }
- }
+// currently not used
+//
+// -- 2005-05-23 (ork at devel.plogworld.net)
+//
+// function deleteExpiredAuthImage( $expiretime ) {
+// $path = PLOG_CLASS_PATH . $this->cacheFolder;
+// if ( is_dir($path) )
+// {
+// $handle=opendir($path);
+// while (false!==($file = readdir($handle))) {
+// if ($file != "." && $file != ".." && $file != "index.htm") {
+// $diff = time() - filectime("$path/$file");
+// if ($diff > $expiretime) unlink("$path/$file");
+// }
+// }
+// closedir($handle);
+// }
+// }
}
?>
More information about the pLog-svn
mailing list