[pLog-svn] r4954 - in plugins/branches/lifetype-1.1: . subscribe

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Sat Mar 3 17:12:18 EST 2007


Author: jondaley
Date: 2007-03-03 17:12:18 -0500 (Sat, 03 Mar 2007)
New Revision: 4954

Added:
   plugins/branches/lifetype-1.1/subscribe/
   plugins/branches/lifetype-1.1/subscribe/class/
   plugins/branches/lifetype-1.1/subscribe/locale/
   plugins/branches/lifetype-1.1/subscribe/pluginsubscribe.class.php
   plugins/branches/lifetype-1.1/subscribe/templates/
Removed:
   plugins/branches/lifetype-1.1/class/
   plugins/branches/lifetype-1.1/locale/
   plugins/branches/lifetype-1.1/pluginsubscribe.class.php
   plugins/branches/lifetype-1.1/templates/
Log:
fix up last checkin to put the files where they belong

Deleted: plugins/branches/lifetype-1.1/pluginsubscribe.class.php
===================================================================
--- plugins/branches/lifetype-1.1/pluginsubscribe.class.php	2007-03-03 21:59:09 UTC (rev 4953)
+++ plugins/branches/lifetype-1.1/pluginsubscribe.class.php	2007-03-03 22:12:18 UTC (rev 4954)
@@ -1,215 +0,0 @@
-<?php
-    include_once( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
-    include_once( PLOG_CLASS_PATH."plugins/subscribe/class/dao/subscriptions.class.php" );
-    include_once( PLOG_CLASS_PATH."plugins/subscribe/class/security/subscribefilter.class.php" );	
-
-    /**
-     * Sends notifications to visitors if they sign up for them, such as
-     * new comments to a post, new post to a particular category, etc.
-     */
-    class PluginSubscribe extends PluginBase
-    {
-        var $_pluginEnabled;
-        
-        function PluginSubscribe(){
-            $this->PluginBase();
-            
-            $this->id = "subscribe";
-            $this->desc = "Sends email notifications to visitors if they ".
-                "sign up for them.";
-            $this->author = "Jon Daley";
-            $this->locales = Array("en_UK");
-            
-                // register our actions
-            $this->registerAdminAction("subscribe",
-                                       "PluginSubscribeShowConfigAction");
-            $this->registerAdminAction("subscribeUpdate",
-                                       "PluginSubscribeUpdateConfigAction");
-			$this->registerBlogAction("subscribe",
-                                      "PluginSubscribeShowAction");
-			$this->registerBlogAction("subscribeRegister",
-                                      "PluginSubscribeRegisterAction");
-			$this->registerBlogAction("subscribeConfirm",
-                                      "PluginSubscribeConfirmAction");
-			$this->registerBlogAction("subscribeRemove",
-                                      "PluginSubscribeRemoveAction");
-            
-                // register our menu options
-			include_once(PLOG_CLASS_PATH."class/template/menu/menu.class.php");
-            
-			$menu =& Menu::getMenu();
-			if(!$menu->entryExists("/menu/controlCenter/manageRecentPlugins"))
-				$this->addMenuEntry("/menu/controlCenter",
-                                    "manageRecentPlugins", "", "",
-                                    true, false);
-            $this->addMenuEntry("/menu/controlCenter/manageRecentPlugins",
-                                "subscribe_subscriptions",
-                                "?op=subscribe", "");
-
-                // we care about when posts and comments are posted
-            $this->registerNotification(EVENT_POST_POST_ADD);
-            $this->registerNotification(EVENT_POST_COMMENT_ADD);
-                // We need a filter because the email address is required
-                // if the subscribe checkbox is checked.
-			$this->registerFilter("SubscribeFilter");
-        }
-
-	    function isEnabled(){
-	        return $this->_pluginEnabled;
-	    }
-
-        function register(){
-            $this->_pluginEnabled = $this->blogSettings->getValue("plugin_subscribe_enabled");
-            return true;
-        }
-        
-            // create the sql table
-        function install(){
-            include_once( PLOG_CLASS_PATH."class/database/db.class.php" );
-            
-            $fields = "objid INT(10) UNSIGNED NOTNULL,
-                  active TINYINT(1) DEFAULT 0,
-                  type TINYINT(1) NOTNULL,
-                  address VARCHAR(255) NOTNULL,
-                  confirm VARCHAR(32)";
-
-            $db =& Db::getDb();
-            $dbPrefix = Db::getPrefix();
-            $tableName = $dbPrefix."subscribe";
-            
-                // create the data dictionary and create
-                // the table if necessary
-            $dict = NewPDbDataDictionary($db);
-            $sqlArray = $dict->ChangeTableSQL($tableName, $fields);
-            $result = $dict->ExecuteSQLArray($sqlArray);
-            if(!$result)
-                die("There was an error creating the tables ".
-                    "for the subscribe plugin!");
-
-            $sqlArray = $dict->CreateIndexSQL("id_type_address",
-                                              $tableName,
-                                              array("objid","type","address"),
-                                              array("REPLACE", "UNIQUE"));
-                // create the primary key
-            $result = $dict->ExecuteSQLArray($sqlArray);
-            if(!$result)
-                die("There was an error creating the index ".
-                    "for the subscribe plugin!");
-
-                // In the early stages of this plugin, the
-                // confirmation codes were erased.  This will
-                // recalculate them, though you shouldn't ever
-                // need this any more.
-                // Subscriptions::resetConfirmationCodes();
-            
-            return true;
-        }
-
-        
-        /**
-         * This method processes our event notifications
-         */        
-        function process($eventType, $params){        
-            include_once(PLOG_CLASS_PATH."class/data/textfilter.class.php");
-            include_once(PLOG_CLASS_PATH."class/dao/article.class.php");
-
-            $locale = $this->blogInfo->getLocale();
-            
-            switch($eventType){
-              case EVENT_POST_POST_ADD:
-                $article = $params["article"];
-                if($article->getStatus() != POST_STATUS_PUBLISHED)
-                    return;
-
-                    // don't send notifications for future posts
-                $now = new Timestamp();
-                if($article->getDateObject() > $now)
-                    return;
-                
-                $rg = RequestGenerator::getRequestGenerator($this->blogInfo);
-                $arr = Subscriptions::getSubscriptions($article->getCategoryIds(),
-                                        SUBSCRIBE_POSTS_IN_CATEGORY);
-                foreach($arr as $email){
-                        // TODO: provide a templating
-                        // mechanism for the body of the email
-                    Subscriptions::sendMessage($email,
-                                               $locale->pr("subscribe_article_published",
-                                                           $article->getTopic()),
-                                               Textfilter::htmlDecode(
-                                                   Textfilter::filterAllHTML(
-                                                       $article->getIntroText())) .
-                                               "\n\n".$rg->postPermalink($article).
-                                               "\n\n".
-                                               $locale->pr("subscribe_email_removal",
-                                                           Subscriptions::generateConfirmUrl(
-                                                               $this->blogInfo,
-                                                               "subscribeRemove",
-                                                               $email)));
-                }
-                break;
-
-              case EVENT_POST_COMMENT_ADD:
-                include_once(PLOG_CLASS_PATH.
-                             "class/dao/usercomment.class.php");
-                include_once(PLOG_CLASS_PATH.
-                             "class/net/requestgenerator.class.php");
-                $comment = $params["comment"];
-                if($comment->getStatus() != COMMENT_STATUS_NONSPAM)
-                    return;
-                $article = $comment->getArticle();
-
-                $rg = RequestGenerator::getRequestGenerator($this->blogInfo);
-                $arr = Subscriptions::getSubscriptions(
-                    array($comment->getArticleId()),
-                    SUBSCRIBE_COMMENTS_IN_POST);
-
-                foreach($arr as $email){
-                        // TODO: provide a templating
-                        // mechanism for the body of the email
-                    Subscriptions::sendMessage($email,
-                                               $locale->pr("subscribe_comment_on",
-                                                           $article->getTopic()),
-                                               $locale->pr("subscribe_posted_by",
-                                                           $comment->getUserName())."\n".
-                                               Textfilter::htmlDecode(
-                                                   Textfilter::filterAllHTML(
-                                                       $comment->getText())) .
-                                               "\n\n".$rg->postPermalink($article).
-                                               "\n\n".
-                                               $locale->pr("subscribe_email_removal",
-                                                           Subscriptions::generateConfirmUrl(
-                                                               $this->blogInfo,
-                                                               "subscribeRemove",
-                                                               $email)));
-                }
-
-                $request = HttpVars::getRequest();
-
-                    // Now check to see if this guy wants to receive
-                    // future notifications of comments
-                if(isset($request["subscribe"])){
-                        // We already validated this
-                    $emailAddress = $request["userEmail"];
-                        // save subscription info to database
-                    if(Subscriptions::addSubscriptions(array($comment->getArticleId()),
-                                                        SUBSCRIBE_COMMENTS_IN_POST,
-                                                        $emailAddress))
-                    {
-                            // send confirmation email
-                        if(!Subscriptions::sendConfirmationEmail($this->blogInfo,
-                                                                 $emailAddress)){
-                                // TODO: can we do anything if there was an error?
-                        }
-                    }
-                    else{
-                            // TODO: can we do anything if there was an error?
-                    }
-                }
-                
-                break;
-              default:
-                return;
-            }
-        }
-    }
-?>
\ No newline at end of file

Copied: plugins/branches/lifetype-1.1/subscribe/class (from rev 4953, plugins/branches/lifetype-1.1/class)

Copied: plugins/branches/lifetype-1.1/subscribe/locale (from rev 4953, plugins/branches/lifetype-1.1/locale)

Copied: plugins/branches/lifetype-1.1/subscribe/pluginsubscribe.class.php (from rev 4953, plugins/branches/lifetype-1.1/pluginsubscribe.class.php)
===================================================================
--- plugins/branches/lifetype-1.1/subscribe/pluginsubscribe.class.php	                        (rev 0)
+++ plugins/branches/lifetype-1.1/subscribe/pluginsubscribe.class.php	2007-03-03 22:12:18 UTC (rev 4954)
@@ -0,0 +1,215 @@
+<?php
+    include_once( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
+    include_once( PLOG_CLASS_PATH."plugins/subscribe/class/dao/subscriptions.class.php" );
+    include_once( PLOG_CLASS_PATH."plugins/subscribe/class/security/subscribefilter.class.php" );	
+
+    /**
+     * Sends notifications to visitors if they sign up for them, such as
+     * new comments to a post, new post to a particular category, etc.
+     */
+    class PluginSubscribe extends PluginBase
+    {
+        var $_pluginEnabled;
+        
+        function PluginSubscribe(){
+            $this->PluginBase();
+            
+            $this->id = "subscribe";
+            $this->desc = "Sends email notifications to visitors if they ".
+                "sign up for them.";
+            $this->author = "Jon Daley";
+            $this->locales = Array("en_UK");
+            
+                // register our actions
+            $this->registerAdminAction("subscribe",
+                                       "PluginSubscribeShowConfigAction");
+            $this->registerAdminAction("subscribeUpdate",
+                                       "PluginSubscribeUpdateConfigAction");
+			$this->registerBlogAction("subscribe",
+                                      "PluginSubscribeShowAction");
+			$this->registerBlogAction("subscribeRegister",
+                                      "PluginSubscribeRegisterAction");
+			$this->registerBlogAction("subscribeConfirm",
+                                      "PluginSubscribeConfirmAction");
+			$this->registerBlogAction("subscribeRemove",
+                                      "PluginSubscribeRemoveAction");
+            
+                // register our menu options
+			include_once(PLOG_CLASS_PATH."class/template/menu/menu.class.php");
+            
+			$menu =& Menu::getMenu();
+			if(!$menu->entryExists("/menu/controlCenter/manageRecentPlugins"))
+				$this->addMenuEntry("/menu/controlCenter",
+                                    "manageRecentPlugins", "", "",
+                                    true, false);
+            $this->addMenuEntry("/menu/controlCenter/manageRecentPlugins",
+                                "subscribe_subscriptions",
+                                "?op=subscribe", "");
+
+                // we care about when posts and comments are posted
+            $this->registerNotification(EVENT_POST_POST_ADD);
+            $this->registerNotification(EVENT_POST_COMMENT_ADD);
+                // We need a filter because the email address is required
+                // if the subscribe checkbox is checked.
+			$this->registerFilter("SubscribeFilter");
+        }
+
+	    function isEnabled(){
+	        return $this->_pluginEnabled;
+	    }
+
+        function register(){
+            $this->_pluginEnabled = $this->blogSettings->getValue("plugin_subscribe_enabled");
+            return true;
+        }
+        
+            // create the sql table
+        function install(){
+            include_once( PLOG_CLASS_PATH."class/database/db.class.php" );
+            
+            $fields = "objid INT(10) UNSIGNED NOTNULL,
+                  active TINYINT(1) DEFAULT 0,
+                  type TINYINT(1) NOTNULL,
+                  address VARCHAR(255) NOTNULL,
+                  confirm VARCHAR(32)";
+
+            $db =& Db::getDb();
+            $dbPrefix = Db::getPrefix();
+            $tableName = $dbPrefix."subscribe";
+            
+                // create the data dictionary and create
+                // the table if necessary
+            $dict = NewPDbDataDictionary($db);
+            $sqlArray = $dict->ChangeTableSQL($tableName, $fields);
+            $result = $dict->ExecuteSQLArray($sqlArray);
+            if(!$result)
+                die("There was an error creating the tables ".
+                    "for the subscribe plugin!");
+
+            $sqlArray = $dict->CreateIndexSQL("id_type_address",
+                                              $tableName,
+                                              array("objid","type","address"),
+                                              array("REPLACE", "UNIQUE"));
+                // create the primary key
+            $result = $dict->ExecuteSQLArray($sqlArray);
+            if(!$result)
+                die("There was an error creating the index ".
+                    "for the subscribe plugin!");
+
+                // In the early stages of this plugin, the
+                // confirmation codes were erased.  This will
+                // recalculate them, though you shouldn't ever
+                // need this any more.
+                // Subscriptions::resetConfirmationCodes();
+            
+            return true;
+        }
+
+        
+        /**
+         * This method processes our event notifications
+         */        
+        function process($eventType, $params){        
+            include_once(PLOG_CLASS_PATH."class/data/textfilter.class.php");
+            include_once(PLOG_CLASS_PATH."class/dao/article.class.php");
+
+            $locale = $this->blogInfo->getLocale();
+            
+            switch($eventType){
+              case EVENT_POST_POST_ADD:
+                $article = $params["article"];
+                if($article->getStatus() != POST_STATUS_PUBLISHED)
+                    return;
+
+                    // don't send notifications for future posts
+                $now = new Timestamp();
+                if($article->getDateObject() > $now)
+                    return;
+                
+                $rg = RequestGenerator::getRequestGenerator($this->blogInfo);
+                $arr = Subscriptions::getSubscriptions($article->getCategoryIds(),
+                                        SUBSCRIBE_POSTS_IN_CATEGORY);
+                foreach($arr as $email){
+                        // TODO: provide a templating
+                        // mechanism for the body of the email
+                    Subscriptions::sendMessage($email,
+                                               $locale->pr("subscribe_article_published",
+                                                           $article->getTopic()),
+                                               Textfilter::htmlDecode(
+                                                   Textfilter::filterAllHTML(
+                                                       $article->getIntroText())) .
+                                               "\n\n".$rg->postPermalink($article).
+                                               "\n\n".
+                                               $locale->pr("subscribe_email_removal",
+                                                           Subscriptions::generateConfirmUrl(
+                                                               $this->blogInfo,
+                                                               "subscribeRemove",
+                                                               $email)));
+                }
+                break;
+
+              case EVENT_POST_COMMENT_ADD:
+                include_once(PLOG_CLASS_PATH.
+                             "class/dao/usercomment.class.php");
+                include_once(PLOG_CLASS_PATH.
+                             "class/net/requestgenerator.class.php");
+                $comment = $params["comment"];
+                if($comment->getStatus() != COMMENT_STATUS_NONSPAM)
+                    return;
+                $article = $comment->getArticle();
+
+                $rg = RequestGenerator::getRequestGenerator($this->blogInfo);
+                $arr = Subscriptions::getSubscriptions(
+                    array($comment->getArticleId()),
+                    SUBSCRIBE_COMMENTS_IN_POST);
+
+                foreach($arr as $email){
+                        // TODO: provide a templating
+                        // mechanism for the body of the email
+                    Subscriptions::sendMessage($email,
+                                               $locale->pr("subscribe_comment_on",
+                                                           $article->getTopic()),
+                                               $locale->pr("subscribe_posted_by",
+                                                           $comment->getUserName())."\n".
+                                               Textfilter::htmlDecode(
+                                                   Textfilter::filterAllHTML(
+                                                       $comment->getText())) .
+                                               "\n\n".$rg->postPermalink($article).
+                                               "\n\n".
+                                               $locale->pr("subscribe_email_removal",
+                                                           Subscriptions::generateConfirmUrl(
+                                                               $this->blogInfo,
+                                                               "subscribeRemove",
+                                                               $email)));
+                }
+
+                $request = HttpVars::getRequest();
+
+                    // Now check to see if this guy wants to receive
+                    // future notifications of comments
+                if(isset($request["subscribe"])){
+                        // We already validated this
+                    $emailAddress = $request["userEmail"];
+                        // save subscription info to database
+                    if(Subscriptions::addSubscriptions(array($comment->getArticleId()),
+                                                        SUBSCRIBE_COMMENTS_IN_POST,
+                                                        $emailAddress))
+                    {
+                            // send confirmation email
+                        if(!Subscriptions::sendConfirmationEmail($this->blogInfo,
+                                                                 $emailAddress)){
+                                // TODO: can we do anything if there was an error?
+                        }
+                    }
+                    else{
+                            // TODO: can we do anything if there was an error?
+                    }
+                }
+                
+                break;
+              default:
+                return;
+            }
+        }
+    }
+?>
\ No newline at end of file

Copied: plugins/branches/lifetype-1.1/subscribe/templates (from rev 4953, plugins/branches/lifetype-1.1/templates)



More information about the pLog-svn mailing list