[pLog-svn] r6017 - plugins/branches/lifetype-1.2

reto at devel.lifetype.net reto at devel.lifetype.net
Sun Oct 28 18:35:24 EDT 2007


Author: reto
Date: 2007-10-28 18:35:24 -0400 (Sun, 28 Oct 2007)
New Revision: 6017

Modified:
   plugins/branches/lifetype-1.2/moblog.php
   plugins/branches/lifetype-1.2/moblogbatch.php
Log:
Part 2 of Commit 6061

Modified: plugins/branches/lifetype-1.2/moblog.php
===================================================================
--- plugins/branches/lifetype-1.2/moblog.php	2007-10-28 22:34:02 UTC (rev 6016)
+++ plugins/branches/lifetype-1.2/moblog.php	2007-10-28 22:35:24 UTC (rev 6017)
@@ -6,8 +6,7 @@
     }
     
     //
-    // comment this out if you don't want this script to log
-    // its steps
+    // set this to false if you want logging enabled
     //
     define( "MOBLOG_DEBUG", true );
     
@@ -35,7 +34,7 @@
     
     // initialize the logging system
     MoblogLogger::log( "-- Initialized");
-    
+
     // get the request
     $request = HttpVars::getRequest();
 	isset( $request["message"] ) ? $message = $request["message"] : $message = "";
@@ -52,7 +51,7 @@
     
     MoblogLogger::log("-- message --");
     MoblogLogger::log($message);
-    MoblogLogger::log("-- end --");
+    MoblogLogger::log("-- message end --");
     
     // parse the message
     $request = new MoblogRequest( $request );
@@ -208,18 +207,24 @@
     $attachments = $request->getAttachments();
     $res = new GalleryResources();
     $resourceIds = Array();
-    foreach( $attachments as $attachment ) {
-        MoblogLogger::log( "-- Processing attachment ".$attachment->getFileName()." - tmp filename = ".$attachment->getTmpName());
-        $result = $res->addResourceFromDisk( $blogInfo->getId(), $albumId, $attachment->getFileName(), $attachment->getTmpName());
-        MoblogLogger::log( "   Completed: result = $result" );
-        if( $result ) {
-            // keep this for later
-            array_push( $resourceIds, $result );
+    
+    if ( count($attachments) > 0) {
+        foreach( $attachments as $attachment ) {
+            MoblogLogger::log( "-- Processing attachment ".$attachment->getFileName()." - tmp filename = ".$attachment->getTmpName());
+            $result = $res->addResourceFromDisk( $blogInfo->getId(), $albumId, $attachment->getFileName(), $attachment->getTmpName());
+            MoblogLogger::log( "   Completed: result = $result" );
+            if( $result ) {
+                // keep this for later
+                array_push( $resourceIds, $result );
+            }
+    		else {
+    			MoblogLogger::log("false???");
+    		}
         }
-		else {
-			MoblogLogger::log("false???");
-		}
     }
+    else {
+        MoblogLogger::log( "  No Attachments found" );
+    }
     
     //
     // if everything went fine, we can now proceed and publish the post, finally!!!! :)
@@ -296,12 +301,16 @@
         MoblogLogger::log( "There was an error adding the post to the database.");
     }
     else {
-        $responseBody = "Post was successfully added to the database with topic '".$request->getTopic()."\n\n";
+        lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );	
+        $config =& Config::getConfig();
+        $locale =& Locales::getLocale( $config->getValue("default_locale" ));
+        
+        $responseBody = $locale->pr("moblog_body",$request->getTopic());
         if( count($request->getAttachments()) > 0 ) {
-            $responseBody .= "The following attachments have been added:\n\n";
+            $responseBody .= $locale->tr("moblog_attachments");
             $responseBody .= $resNames;
         }
-        $response = new MoblogResponse( $request->getReplyTo(), "pLog Moblog: Success", $responseBody ); 
+        $response = new MoblogResponse( $request->getReplyTo(), $locale->tr("moblog_mailsubject"), $responseBody ); 
         MoblogLogger::log( "Post was successfully added to the database." );
     }
     $response->send();

Modified: plugins/branches/lifetype-1.2/moblogbatch.php
===================================================================
--- plugins/branches/lifetype-1.2/moblogbatch.php	2007-10-28 22:34:02 UTC (rev 6016)
+++ plugins/branches/lifetype-1.2/moblogbatch.php	2007-10-28 22:35:24 UTC (rev 6017)
@@ -63,4 +63,4 @@
 			$response = $req->getResponseBody();
 		}
     }
-?>
\ No newline at end of file
+?>



More information about the pLog-svn mailing list