[pLog-svn] r725 - in plugins/trunk/atom/class: . logger xml/atom

oscar at devel.plogworld.net oscar at devel.plogworld.net
Mon Jan 10 18:20:03 GMT 2005


Author: oscar
Date: 2005-01-10 18:20:03 +0000 (Mon, 10 Jan 2005)
New Revision: 725

Added:
   plugins/trunk/atom/class/logger/
   plugins/trunk/atom/class/logger/atomlogger.class.php
Modified:
   plugins/trunk/atom/class/xml/atom/atomDom.php
   plugins/trunk/atom/class/xml/atom/atomFunc.php
   plugins/trunk/atom/class/xml/atom/atomabstractservice.class.php
   plugins/trunk/atom/class/xml/atom/atomrequest.class.php
   plugins/trunk/atom/class/xml/atom/editservice.class.php
   plugins/trunk/atom/class/xml/atom/plogatomabstractservice.class.php
   plugins/trunk/atom/class/xml/atom/plogatomauthentication.class.php
   plugins/trunk/atom/class/xml/atom/postservice.class.php
   plugins/trunk/atom/class/xml/atom/wsseauthentication.class.php
Log:
added AtomLogger because the old Logger class is not used anymore. Replaced all occurences in the files plus all the includes.

Added: plugins/trunk/atom/class/logger/atomlogger.class.php
===================================================================
--- plugins/trunk/atom/class/logger/atomlogger.class.php	2005-01-10 18:12:10 UTC (rev 724)
+++ plugins/trunk/atom/class/logger/atomlogger.class.php	2005-01-10 18:20:03 UTC (rev 725)
@@ -0,0 +1,25 @@
+<?php
+
+	include_once( PLOG_CLASS_PATH."class/object/object.class.php" );
+	include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
+	
+	/**
+	 * simple class that logs a message to the standard log file, but only if enabled
+	 *
+	 * @see LoggerManager
+	 */
+	class AtomLogger extends Object
+	{
+		/**
+		 * logs a simple message to the log file, using the "debug" priority"
+		 */
+		function Log( $message ) 
+		{
+			$config =& Config::getConfig();
+			if( $config->getValue( "atom_logging_enabled" )) {
+				$logger =& LoggerManager::getLogger( "atom.php" );
+				$logger->debug( $message );		
+			}
+		}
+	}
+?>
\ No newline at end of file

Modified: plugins/trunk/atom/class/xml/atom/atomDom.php
===================================================================
--- plugins/trunk/atom/class/xml/atom/atomDom.php	2005-01-10 18:12:10 UTC (rev 724)
+++ plugins/trunk/atom/class/xml/atom/atomDom.php	2005-01-10 18:20:03 UTC (rev 725)
@@ -3,260 +3,260 @@
 /**
  * this was integrated from isoTope with very few changes... it's not very
  * OOP but it works so let's leave it as it is for the time being :)
- */
-
-/**********************************************************************
- * isoTope: an Atom-powered web framework                             *
- *                                                                    *
- * atomDom.php - Atom / DOM related functions                         *
- *               atom classes -> DOM                                  *
- *               DOM -> atom classes                                  *
- *               atom feed -> DOM                                     *
- * Copyright (c) 2004  Michael Davies (Isofarro).                     *
- *                                                                    *
- **********************************************************************
- *                                                                    *
- * This program is free software; you can redistribute it and/or      *
- * modify it under the terms of the GNU General Public License as     *
- * published by the Free Software Foundation; either version 2 of the *
- * License, or (at your option) any later version.                    *
- *                                                                    *
- * This program is distributed in the hope that it will be useful,    *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of     *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *
- * GNU General Public License for more details.                       *
- *                                                                    *
- * You should have received a copy of the GNU General Public License  *
- * along with this program; if not, write to the                      *
- *     Free Software Foundation, Inc.                                 *
- *     59 Temple Place, Suite 330                                     *
- *     Boston, MA 02111-1307 USA                                      *
- *                                                                    *
- *********************************************************************/
-
- 
-
-/**************************************************
- *
- * DOM -> atom classes
- *
- *************************************************/
- 
-/*
- * XML-Dom to Atom classes related functions
- */
-function createAtomEntry(&$dom) {
-	global $req, $ns, $atomNS;
-	Logger::Log("createAtomEntry: Creating an Atom entry from the received XML");
-	$root = $dom->firstChild;
-	
-	$atomNS = "";
-	
-	// Look at the root attributes and extract anything that looks like
-	// a namespace reference or declaration.
+ */
+
+/**********************************************************************
+ * isoTope: an Atom-powered web framework                             *
+ *                                                                    *
+ * atomDom.php - Atom / DOM related functions                         *
+ *               atom classes -> DOM                                  *
+ *               DOM -> atom classes                                  *
+ *               atom feed -> DOM                                     *
+ * Copyright (c) 2004  Michael Davies (Isofarro).                     *
+ *                                                                    *
+ **********************************************************************
+ *                                                                    *
+ * This program is free software; you can redistribute it and/or      *
+ * modify it under the terms of the GNU General Public License as     *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version.                    *
+ *                                                                    *
+ * This program is distributed in the hope that it will be useful,    *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of     *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *
+ * GNU General Public License for more details.                       *
+ *                                                                    *
+ * You should have received a copy of the GNU General Public License  *
+ * along with this program; if not, write to the                      *
+ *     Free Software Foundation, Inc.                                 *
+ *     59 Temple Place, Suite 330                                     *
+ *     Boston, MA 02111-1307 USA                                      *
+ *                                                                    *
+ *********************************************************************/
+
+ 
+
+/**************************************************
+ *
+ * DOM -> atom classes
+ *
+ *************************************************/
+ 
+/*
+ * XML-Dom to Atom classes related functions
+ */
+function createAtomEntry(&$dom) {
+	global $req, $ns, $atomNS;
+	AtomLogger::Log("createAtomEntry: Creating an Atom entry from the received XML");
+	$root = $dom->firstChild;
+	
+	$atomNS = "";
+	
+	// Look at the root attributes and extract anything that looks like
+	// a namespace reference or declaration.
 	findNamespace($root);
 	
-    $atom = new AtomEntry();	
-
-	// Figure out whether atom entry is using a name-space by looking at the 
-	// root element - which should be "entry" and deriving the namespace
-	// from that element name. Not sure whether there has to be an xmlns:atom attribute
-	// so we may be able to check for that -- but won't that mean the URL has to
-	// be exactly right for the atom namespace?
-	if (!(strpos($root->nodeName, "entry") === false)) {
-		if($root->nodeName=="entry") {
-			Logger::Log("createAtomEntry: Found a non-namespaced entry element");
-			$atomNS="";
-		} else {
-			Logger::Log("createAtomEntry: Found a NAMESPACED entry element: (" . $root->nodeName . ")");
-			$temp = explode(":", $root->nodeName);
-			$atomNS=$temp[0] . ":";
-		}
-		Logger::Log("createAtomEntry: possible atom namespace: " . $atomNS);
-		
-	} else {
-		Logger::Log("createAtomEntry: Didn't find an entry element");	
+    $atom = new AtomEntry();	
+
+	// Figure out whether atom entry is using a name-space by looking at the 
+	// root element - which should be "entry" and deriving the namespace
+	// from that element name. Not sure whether there has to be an xmlns:atom attribute
+	// so we may be able to check for that -- but won't that mean the URL has to
+	// be exactly right for the atom namespace?
+	if (!(strpos($root->nodeName, "entry") === false)) {
+		if($root->nodeName=="entry") {
+			AtomLogger::Log("createAtomEntry: Found a non-namespaced entry element");
+			$atomNS="";
+		} else {
+			AtomLogger::Log("createAtomEntry: Found a NAMESPACED entry element: (" . $root->nodeName . ")");
+			$temp = explode(":", $root->nodeName);
+			$atomNS=$temp[0] . ":";
+		}
+		AtomLogger::Log("createAtomEntry: possible atom namespace: " . $atomNS);
+		
+	} else {
+		AtomLogger::Log("createAtomEntry: Didn't find an entry element");	
 		//returnDataError("No root element called entry could be found.");
 		$atom->isError = true;
-		$atom->errorMessage = "No root element called entry could be found.";
-	}
-	
-	if ($root->nodeName== $atomNS . "entry") {
-		Logger::Log("createAtomEntry: Found node: entry");		
-		$item = $root->firstChild;
-		while ($item) {
-			Logger::Log("* Found entry element: " . $item->nodeName);
-			
-			switch($item->nodeName) {
-				case $atomNS . "title":
+		$atom->errorMessage = "No root element called entry could be found.";
+	}
+	
+	if ($root->nodeName== $atomNS . "entry") {
+		AtomLogger::Log("createAtomEntry: Found node: entry");		
+		$item = $root->firstChild;
+		while ($item) {
+			AtomLogger::Log("* Found entry element: " . $item->nodeName);
+			
+			switch($item->nodeName) {
+				case $atomNS . "title":
 					$title=createRichText($item);
-					Logger::Log( "* * title: " . $title );
-					$atom->title=$title;
-					break;
-				case $atomNS . "summary":
-					$summary=createRichText($item);
-					Logger::Log("* * summary: " . $summary);
-					$atom->summary=$summary;
-					break;
-				case $atomNS . "created":
-					$created=$item->firstChild->nodeValue;
-					Logger::Log("* * created: " . $created);
-					$atom->created=$created;
-					break;
-				case $atomNS . "issued":
-					$issued=$item->firstChild->nodeValue;
-					Logger::Log("* * issued: " . $issued);
-					$atom->issued=$issued;
-					break;
-
-				case $atomNS . "modified":
-					$modified=$item->firstChild->nodeValue;
-					Logger::Log("* * modified: " . $modified);
-					$atom->modified=$modified;
-					break;
-
-				case $atomNS . "author":
-					Logger::Log("* * author: ");
-					$authObj = createAtomPerson($item);
-					$atom->author=$authObj;
-					break;
-				
-				case $atomNS . "contributor":
-					Logger::Log("* * contributor: ");
-					$contrib = createAtomPerson($item);
-					array_push($atom->contributor, $contrib);
-					break;
-					
-				case $atomNS . "content":
-					Logger::Log("* * content: ");
-					$cont = createAtomContent($item); 
-					array_push($atom->content, $cont);
-					break;
-				
-				case $atomNS . "generator":
-					Logger::Log("* * generator: ");
-					$generator = createAtomGenerator($item);
-					$atom->generator = $generator;
-					break;
-					
-				case $atomNS . "link":
-					Logger::Log("* * link: ");
-					$link = createAtomLink($item);
-					array_push($atom->link, $link);
-					break;
-					
-				case $atomNS . "id":
-					$id = $item->firstChild->nodeValue;
-					Logger::Log("* * id: " . $id);
-					$atom->id = $id;
-					break;
-					
-				default:
-					Logger::Log("createAtomEntry: WARN: Unsupported element: " . $item->nodeName);
-					break;
-			}
-			
-			$item = $item->nextSibling;
-		}
-		
-	} else {
-		Logger::Log("createAtomEntry: ERROR: found root node called " . $root->nodeName . " was expecting entry");
+					AtomLogger::Log( "* * title: " . $title );
+					$atom->title=$title;
+					break;
+				case $atomNS . "summary":
+					$summary=createRichText($item);
+					AtomLogger::Log("* * summary: " . $summary);
+					$atom->summary=$summary;
+					break;
+				case $atomNS . "created":
+					$created=$item->firstChild->nodeValue;
+					AtomLogger::Log("* * created: " . $created);
+					$atom->created=$created;
+					break;
+				case $atomNS . "issued":
+					$issued=$item->firstChild->nodeValue;
+					AtomLogger::Log("* * issued: " . $issued);
+					$atom->issued=$issued;
+					break;
+
+				case $atomNS . "modified":
+					$modified=$item->firstChild->nodeValue;
+					AtomLogger::Log("* * modified: " . $modified);
+					$atom->modified=$modified;
+					break;
+
+				case $atomNS . "author":
+					AtomLogger::Log("* * author: ");
+					$authObj = createAtomPerson($item);
+					$atom->author=$authObj;
+					break;
+				
+				case $atomNS . "contributor":
+					AtomLogger::Log("* * contributor: ");
+					$contrib = createAtomPerson($item);
+					array_push($atom->contributor, $contrib);
+					break;
+					
+				case $atomNS . "content":
+					AtomLogger::Log("* * content: ");
+					$cont = createAtomContent($item); 
+					array_push($atom->content, $cont);
+					break;
+				
+				case $atomNS . "generator":
+					AtomLogger::Log("* * generator: ");
+					$generator = createAtomGenerator($item);
+					$atom->generator = $generator;
+					break;
+					
+				case $atomNS . "link":
+					AtomLogger::Log("* * link: ");
+					$link = createAtomLink($item);
+					array_push($atom->link, $link);
+					break;
+					
+				case $atomNS . "id":
+					$id = $item->firstChild->nodeValue;
+					AtomLogger::Log("* * id: " . $id);
+					$atom->id = $id;
+					break;
+					
+				default:
+					AtomLogger::Log("createAtomEntry: WARN: Unsupported element: " . $item->nodeName);
+					break;
+			}
+			
+			$item = $item->nextSibling;
+		}
+		
+	} else {
+		AtomLogger::Log("createAtomEntry: ERROR: found root node called " . $root->nodeName . " was expecting entry");
 		//returnDataError("No root element called entry could be found.");
 		$atom->isError = true;
-		$atom->errorMessage = "No root element called entry could be found.";
-	}
-	return $atom;
-}
-
-function createAtomPerson(&$pers) {
-	global $req, $ns, $atomNS;
-	
-	$person = new AtomPerson();
-	$persItem = $pers->firstChild;
-	while ($persItem) {
-		Logger::Log("* * Found person element: " . $persItem->nodeName);
-		switch($persItem->nodeName) {
-			case $atomNS . "name":
-				$name = $persItem->firstChild->nodeValue;
-				Logger::Log("* * * name: " . $name);
-				$person->name = $name;
-				break;
-			case $atomNS . "email":
-				$email = $persItem->firstChild->nodeValue;
-				Logger::Log("* * * email: " . $email);
-				$person->email = $email;
-				break;
-			case $atomNS . "url":
-				$url = $persItem->firstChild->nodeValue;
-				Logger::Log("* * * url: " . $url);
-				$person->url = $url;
-				break;
-		}
-		$persItem = $persItem->nextSibling;
-	}
-	return $person;
-}
-
-
-function createAtomGenerator(&$gen) {
-	global $req, $ns, $atomNS;
-	
-	$generator = new AtomGenerator();
-
-	$name = $gen->firstChild->nodeValue;
-	Logger::Log("* * name: " . $name);
-	$generator->generator = $name;
-
-	$version = $gen->attributes["version"];
-	Logger::Log("* * @version: " . $version);
-	$generator->version = $version;	
-
-	$url = $gen->attributes["url"];
-	Logger::Log("* * @url: " . $url);
-	$generator->url = $url;	
-
-	return $generator;	
-}
-
-function createRichText(&$text) {
-	global $req;
-	
-	$richText = new AtomContent();
-	
-	$type = $text->attributes["type"];
-	$richText->type = $type;
-
-	$mode = $text->attributes["mode"];
-	$richText->mode = $mode;
-
-	if (empty($richText->type)) { $richText->type="text/plain"; }
-	if (empty($richText->mode)) { $richText->mode="xml"; }
-
-		
-	$textNode = $text->firstChild;
-	$textBuffer = "";
-	while ($textNode) {
-		$rawText="";
-		switch ($textNode->nodeType) {
-			case 1:
-				$rawText = $textNode->toString();
-				break;
-			case 3:
-				$rawText = $textNode->nodeValue;
-				break;
-			case 4:
-				$rawText = $textNode->nodeValue;
-				break;
-		}
-		$textBuffer .= $rawText;
-	
-		$textNode = $textNode->nextSibling;
-	}
-	$richText->text = $textBuffer;
-
-	return $richText;
+		$atom->errorMessage = "No root element called entry could be found.";
+	}
+	return $atom;
 }
 
+function createAtomPerson(&$pers) {
+	global $req, $ns, $atomNS;
+	
+	$person = new AtomPerson();
+	$persItem = $pers->firstChild;
+	while ($persItem) {
+		AtomLogger::Log("* * Found person element: " . $persItem->nodeName);
+		switch($persItem->nodeName) {
+			case $atomNS . "name":
+				$name = $persItem->firstChild->nodeValue;
+				AtomLogger::Log("* * * name: " . $name);
+				$person->name = $name;
+				break;
+			case $atomNS . "email":
+				$email = $persItem->firstChild->nodeValue;
+				AtomLogger::Log("* * * email: " . $email);
+				$person->email = $email;
+				break;
+			case $atomNS . "url":
+				$url = $persItem->firstChild->nodeValue;
+				AtomLogger::Log("* * * url: " . $url);
+				$person->url = $url;
+				break;
+		}
+		$persItem = $persItem->nextSibling;
+	}
+	return $person;
+}
+
+
+function createAtomGenerator(&$gen) {
+	global $req, $ns, $atomNS;
+	
+	$generator = new AtomGenerator();
+
+	$name = $gen->firstChild->nodeValue;
+	AtomLogger::Log("* * name: " . $name);
+	$generator->generator = $name;
+
+	$version = $gen->attributes["version"];
+	AtomLogger::Log("* * @version: " . $version);
+	$generator->version = $version;	
+
+	$url = $gen->attributes["url"];
+	AtomLogger::Log("* * @url: " . $url);
+	$generator->url = $url;	
+
+	return $generator;	
+}
+
+function createRichText(&$text) {
+	global $req;
+	
+	$richText = new AtomContent();
+	
+	$type = $text->attributes["type"];
+	$richText->type = $type;
+
+	$mode = $text->attributes["mode"];
+	$richText->mode = $mode;
+
+	if (empty($richText->type)) { $richText->type="text/plain"; }
+	if (empty($richText->mode)) { $richText->mode="xml"; }
+
+		
+	$textNode = $text->firstChild;
+	$textBuffer = "";
+	while ($textNode) {
+		$rawText="";
+		switch ($textNode->nodeType) {
+			case 1:
+				$rawText = $textNode->toString();
+				break;
+			case 3:
+				$rawText = $textNode->nodeValue;
+				break;
+			case 4:
+				$rawText = $textNode->nodeValue;
+				break;
+		}
+		$textBuffer .= $rawText;
+	
+		$textNode = $textNode->nextSibling;
+	}
+	$richText->text = $textBuffer;
+
+	return $richText;
+}
+
 function unhtmlentities ($string)
 { 
    $trans_tbl = get_html_translation_table (HTML_ENTITIES);
@@ -282,313 +282,313 @@
     }
     
     return $content;
-}
-
-// New DOM based method of storing content
-function createAtomContent(&$node) {
-	global $req, $atomNS;
-
-	$content = new AtomContent();
-
-	$type = $node->attributes["type"];
-	Logger::Log("createAtomContent: * @type: " . $type);
-	$content->type = $type;
-
-	$mode = $node->attributes["mode"];
-	Logger::Log("createAtomContent: * @mode: " . $mode);
+}
+
+// New DOM based method of storing content
+function createAtomContent(&$node) {
+	global $req, $atomNS;
+
+	$content = new AtomContent();
+
+	$type = $node->attributes["type"];
+	AtomLogger::Log("createAtomContent: * @type: " . $type);
+	$content->type = $type;
+
+	$mode = $node->attributes["mode"];
+	AtomLogger::Log("createAtomContent: * @mode: " . $mode);
 	$content->mode = $mode;
 	
 	// take care of the data inside the node
 	$content->text = convertData( $content->mode, $node->firstChild->nodeValue );
-	
-	// Depending on whether the mode above is xml, escaped or base64 treat the
-	// following nodes accordingly:
-
-	$contDom = new XML();
-	$root = $contDom->createElement('content');
-
-	copyAllDescendants($node, $root);
-	$contDom->appendChild($root);
-	
-	$content->container = $contDom;		//->toString();
-	$content->containerType = "dom"; 	//String";
-	return $content;
-}
-
-function createAtomLink(&$node) {
-	global $req;
-	
-	Logger::Log("createAtomLink: [" . $node->attributes["rel"] . "][" . $node->attributes["type"] . "][" . $node->attributes["href"] . "][" . $node->attributes["title"] . "]");
-	$link = new AtomLink();
-	
-	$rel = $node->attributes["rel"];
-	$link->rel = $rel;
-	
-	$type = $node->attributes["type"];
-	$link->type = $type;
-	
-	$href = $node->attributes["href"];
-	$link->href = $href;
-	
-	$title = $node->attributes["title"];
-	$link->title = $title;
-	
-	return $link;
-}
-
-
-
-/**************************************************
- *
- * Atom classes -> DOM
- *
- *************************************************/
- 
- 
-function atomEntryToXml(&$atomEntry) {
-	global $req, $atomNamespace, $atomVersion;
-
-	$atomDom = new XML();
-	$atomDom->xmlDecl = '<?xml version="1.0" encoding="iso-8859-1" ?>';
-
-	// Create entry element
-	$entry = $atomDom->createElement('entry');
-	$entry->attributes['version'] = $atomVersion;
-	$entry->attributes['xmlns'] = $atomNamespace;
-
-	// Create title element
-	$title = atomRichTextToXml($atomDom, $atomEntry->title, 'title');
-	$entry->appendChild($title);
-	
-	// Create link element	
-	foreach($atomEntry->link as $link) {
-		$entry->appendChild(atomLinkToXml($link, $atomDom));
-	}
-	
-	// Create id element
-	$id = $atomDom->createElement('id');
-	$id->appendChild($atomDom->createTextNode($atomEntry->id));
-	$entry->appendChild($id);
-
-	// Create created element - if available
-	if ($atomEntry->created) {
-		$created = $atomDom->createElement('created');
-		$created->appendChild($atomDom->createTextNode($atomEntry->created));
-		$entry->appendChild($created);
-	}
-
-	// Create issued element
-	$issued = $atomDom->createElement('issued');
-	$issued->appendChild($atomDom->createTextNode($atomEntry->issued));
-	$entry->appendChild($issued);
-
-	// Create modified element - if available
-	#Logger::Log("atomEntryToXml: ModifiedDate: " . $atomEntry->modified);
-	if ($atomEntry->modified) {
-		$modified = $atomDom->createElement('modified');
-		$modified->appendChild($atomDom->createTextNode($atomEntry->modified));
-		$entry->appendChild($modified);
-	}
-
-	// Create author element - if available
-	if (!empty($atomEntry->author)) {
-		$author = $atomDom->createElement('author');
-		atomPersonToXml($atomEntry->author, $author);
-		$entry->appendChild($author);
-	}
-	
-	// Create contributor element - if available
-	if (!empty($atomEntry->contributor)) {
-		foreach($atomEntry->contributor as $contrib) {
-			$contributor = $atomDom->createElement('contributor');
-			atomPersonToXml($contrib, $contributor);
-			$entry->appendChild($contributor);
-		}
-	}
-
-	// Create a summary if available
-	#Logger::Log("atomEntryToXml: Summary: ");
-	if (!empty($atomEntry->summary)) {
-		$summary = atomRichTextToXml($atomDom, $atomEntry->summary, 'summary');
-		$entry->appendChild($summary);
-	}
-	
-	// Create a content element if available
-	#Logger::Log("atomEntryToXml: Content: ");
-	if (!empty($atomEntry->content)) {
-		foreach($atomEntry->content as $cont) {
-			$contentNode = atomContentToXml($cont, $atomDom);
-			$entry->appendChild($contentNode);
-		}
-	}
-
-	$atomDom->appendChild($entry);
-
-	Logger::Log("atomEntryToXml: Transforming into an XML string");
-	Logger::Log($atomDom->toString());
-	
-	return $atomDom;
-}
-
-function atomPersonToXml(&$atomPerson, &$atomDom) {
-	global $req;
-	
-	Logger::Log("atomPersonToXml: "  . $atomPerson->name);
-	$name = $atomDom->createElement('name');
-	$name->appendChild($atomDom->createTextNode($atomPerson->name));
-	$atomDom->appendChild($name);
-
-	if ($atomPerson->url) {
-		$url = $atomDom->createElement('url');
-		$url->appendChild($atomDom->createTextNode($atomPerson->url));
-		$atomDom->appendChild($url);
-	}
-	if ($atomPerson->email) {
-		$email = $atomDom->createElement('email');
-		$email->appendChild($atomDom->createTextNode($atomPerson->email));
-		$atomDom->appendChild($email);
-	}
-}
-
-
-function atomContentToXml(&$atomContent, &$atomDom) {
-	global $req;
-	
-	$content = $atomDom->createElement('content');
-	if ($atomContent->type) {
-		$content->attributes['type'] = $atomContent->type;
-	}
-	if ($atomContent->mode) {
-		$content->attributes['mode'] = $atomContent->mode;
-	}
-
-	copyAllDescendants($atomContent->container->firstChild, $content);
-
-	return $content;
-}
-
-
-function atomRichTextToXml(&$atomDom, &$atomContainer, $elName) {
-	global $req;
-
-	$node = $atomDom->createElement($elName);
-	if ($atomContainer->type) {
-		$node->attributes['type'] = $atomContainer->type;
-	}
-	if ($atomContainer->mode) {
-		$node->attributes['mode'] = $atomContainer->mode;
-	}
-	
-	// Be a little smarter about this way of inserting content
-	$node->appendChild($node->createTextNode($atomContainer->text));
-	
-	return $node;
-}
-
-function atomLinkToXml(&$atomLink, &$atomDom) {
-	global $req;
-	
-	$link = $atomDom->createElement('link');
-	$link->attributes['rel'] = $atomLink->rel;
-	if ($atomLink->type) {
-		$link->attributes['type'] = $atomLink->type;
-	}
-	$link->attributes['href'] = $atomLink->href;
-	if ($atomLink->title) {
-		$link->attributes['title'] = $atomLink->title;
-	}
-	
-	return $link;
-}
-
-
-/**************************************************
- *
- * Atom feed -> DOM
- *
- *************************************************/
-
-function atomFeedAsXml(&$atomFeed) {
-	global $req, $atomVersion, $atomNamespace, $siteName, $services;
-	
-	$feedDom = new XML();
-	$feedDom->xmlDecl = '<?xml version="1.0" encoding="iso-8859-1" ?>';
-	
-	$feed = $feedDom->createElement('feed');
-	$feed->attributes['version'] = htmlspecialchars($atomVersion);
-	$feed->attributes['xmlns'] = htmlspecialchars($atomNamespace);
-	
-	foreach($atomFeed->link as $link) {
-		$feed->appendChild(atomLinkToXml($link, $feedDom));
-	}
-	
-	$title = $feedDom->createElement('title');
-	$title->appendChild($feedDom->createTextNode($siteName . " " . $services[$req->service]["title"]));
-	$feed->appendChild($title);
-	
-	if ($atomFeed->modified) {
-		$modified = $feedDom->createElement('modified');
-		$modified->appendChild($feedDom->createTextNode(timestampToW3Date($atomFeed->modified)));
-		$feed->appendChild($modified);
-	}
-	
-	foreach($atomFeed->entries as $entry) {
-		$feed->appendChild(atomFeedEntryAsXml($entry, $feedDom));
-	}
-	
-	$feedDom->appendChild($feed);
-	return $feedDom;
-}
-
-function atomFeedEntryAsXml(&$atomEntry, &$feedDom) {
-	global $req, $mimeType;
-	
-	$entry = $feedDom->createElement('entry');
-	
-	$title = $feedDom->createElement('title');
-	$title->appendChild($title->createTextNode($atomEntry->title));
-	$entry->appendChild($title);
-	
-	$id = $feedDom->createElement('id');
-	$id->appendChild($id->createTextNode($atomEntry->id));
-	$entry->appendChild($id);
-	
-	$link = $feedDom->createElement('link');
-	$link->attributes["rel"]  = "service.edit";
-	$link->attributes["type"] = $mimeType["atom"];
-	$link->attributes["href"] = $atomEntry->link;
-	$entry->appendChild($link);
-
-	$link2 = $feedDom->createElement('link');
-	$link2->attributes["rel"]  = "alternate";
-	$link2->attributes["type"] = $mimeType["html"];
-	$link2->attributes["href"] = $atomEntry->link . ".html";
-	$entry->appendChild($link2);
-
-	if ($atomEntry->author) {
-		$author = $feedDom->createElement('author');
-		atomPersonToXml($atomEntry->author, $author);
-		$entry->appendChild($author);
-	}
-
-	$issued = $feedDom->createElement('issued');
-	$issued->appendChild($issued->createTextNode($atomEntry->issued));
-	$entry->appendChild($issued);
-	
-	if ($atomEntry->created) {
-		$created = $feedDom->createElement('created');
-		$created->appendChild($created->createTextNode($atomEntry->created));
-		$entry->appendChild($created);
-	}
-
-	if ($atomEntry->modified) {
-		$modDate = $feedDom->createElement('modified');
-		$modDate->appendChild($modDate->createTextNode($atomEntry->modified));
-		$entry->appendChild($modDate);
-	}
-	
-	return $entry;
-}
-
-
+	
+	// Depending on whether the mode above is xml, escaped or base64 treat the
+	// following nodes accordingly:
+
+	$contDom = new XML();
+	$root = $contDom->createElement('content');
+
+	copyAllDescendants($node, $root);
+	$contDom->appendChild($root);
+	
+	$content->container = $contDom;		//->toString();
+	$content->containerType = "dom"; 	//String";
+	return $content;
+}
+
+function createAtomLink(&$node) {
+	global $req;
+	
+	AtomLogger::Log("createAtomLink: [" . $node->attributes["rel"] . "][" . $node->attributes["type"] . "][" . $node->attributes["href"] . "][" . $node->attributes["title"] . "]");
+	$link = new AtomLink();
+	
+	$rel = $node->attributes["rel"];
+	$link->rel = $rel;
+	
+	$type = $node->attributes["type"];
+	$link->type = $type;
+	
+	$href = $node->attributes["href"];
+	$link->href = $href;
+	
+	$title = $node->attributes["title"];
+	$link->title = $title;
+	
+	return $link;
+}
+
+
+
+/**************************************************
+ *
+ * Atom classes -> DOM
+ *
+ *************************************************/
+ 
+ 
+function atomEntryToXml(&$atomEntry) {
+	global $req, $atomNamespace, $atomVersion;
+
+	$atomDom = new XML();
+	$atomDom->xmlDecl = '<?xml version="1.0" encoding="iso-8859-1" ?>';
+
+	// Create entry element
+	$entry = $atomDom->createElement('entry');
+	$entry->attributes['version'] = $atomVersion;
+	$entry->attributes['xmlns'] = $atomNamespace;
+
+	// Create title element
+	$title = atomRichTextToXml($atomDom, $atomEntry->title, 'title');
+	$entry->appendChild($title);
+	
+	// Create link element	
+	foreach($atomEntry->link as $link) {
+		$entry->appendChild(atomLinkToXml($link, $atomDom));
+	}
+	
+	// Create id element
+	$id = $atomDom->createElement('id');
+	$id->appendChild($atomDom->createTextNode($atomEntry->id));
+	$entry->appendChild($id);
+
+	// Create created element - if available
+	if ($atomEntry->created) {
+		$created = $atomDom->createElement('created');
+		$created->appendChild($atomDom->createTextNode($atomEntry->created));
+		$entry->appendChild($created);
+	}
+
+	// Create issued element
+	$issued = $atomDom->createElement('issued');
+	$issued->appendChild($atomDom->createTextNode($atomEntry->issued));
+	$entry->appendChild($issued);
+
+	// Create modified element - if available
+	#AtomLogger::Log("atomEntryToXml: ModifiedDate: " . $atomEntry->modified);
+	if ($atomEntry->modified) {
+		$modified = $atomDom->createElement('modified');
+		$modified->appendChild($atomDom->createTextNode($atomEntry->modified));
+		$entry->appendChild($modified);
+	}
+
+	// Create author element - if available
+	if (!empty($atomEntry->author)) {
+		$author = $atomDom->createElement('author');
+		atomPersonToXml($atomEntry->author, $author);
+		$entry->appendChild($author);
+	}
+	
+	// Create contributor element - if available
+	if (!empty($atomEntry->contributor)) {
+		foreach($atomEntry->contributor as $contrib) {
+			$contributor = $atomDom->createElement('contributor');
+			atomPersonToXml($contrib, $contributor);
+			$entry->appendChild($contributor);
+		}
+	}
+
+	// Create a summary if available
+	#AtomLogger::Log("atomEntryToXml: Summary: ");
+	if (!empty($atomEntry->summary)) {
+		$summary = atomRichTextToXml($atomDom, $atomEntry->summary, 'summary');
+		$entry->appendChild($summary);
+	}
+	
+	// Create a content element if available
+	#AtomLogger::Log("atomEntryToXml: Content: ");
+	if (!empty($atomEntry->content)) {
+		foreach($atomEntry->content as $cont) {
+			$contentNode = atomContentToXml($cont, $atomDom);
+			$entry->appendChild($contentNode);
+		}
+	}
+
+	$atomDom->appendChild($entry);
+
+	AtomLogger::Log("atomEntryToXml: Transforming into an XML string");
+	AtomLogger::Log($atomDom->toString());
+	
+	return $atomDom;
+}
+
+function atomPersonToXml(&$atomPerson, &$atomDom) {
+	global $req;
+	
+	AtomLogger::Log("atomPersonToXml: "  . $atomPerson->name);
+	$name = $atomDom->createElement('name');
+	$name->appendChild($atomDom->createTextNode($atomPerson->name));
+	$atomDom->appendChild($name);
+
+	if ($atomPerson->url) {
+		$url = $atomDom->createElement('url');
+		$url->appendChild($atomDom->createTextNode($atomPerson->url));
+		$atomDom->appendChild($url);
+	}
+	if ($atomPerson->email) {
+		$email = $atomDom->createElement('email');
+		$email->appendChild($atomDom->createTextNode($atomPerson->email));
+		$atomDom->appendChild($email);
+	}
+}
+
+
+function atomContentToXml(&$atomContent, &$atomDom) {
+	global $req;
+	
+	$content = $atomDom->createElement('content');
+	if ($atomContent->type) {
+		$content->attributes['type'] = $atomContent->type;
+	}
+	if ($atomContent->mode) {
+		$content->attributes['mode'] = $atomContent->mode;
+	}
+
+	copyAllDescendants($atomContent->container->firstChild, $content);
+
+	return $content;
+}
+
+
+function atomRichTextToXml(&$atomDom, &$atomContainer, $elName) {
+	global $req;
+
+	$node = $atomDom->createElement($elName);
+	if ($atomContainer->type) {
+		$node->attributes['type'] = $atomContainer->type;
+	}
+	if ($atomContainer->mode) {
+		$node->attributes['mode'] = $atomContainer->mode;
+	}
+	
+	// Be a little smarter about this way of inserting content
+	$node->appendChild($node->createTextNode($atomContainer->text));
+	
+	return $node;
+}
+
+function atomLinkToXml(&$atomLink, &$atomDom) {
+	global $req;
+	
+	$link = $atomDom->createElement('link');
+	$link->attributes['rel'] = $atomLink->rel;
+	if ($atomLink->type) {
+		$link->attributes['type'] = $atomLink->type;
+	}
+	$link->attributes['href'] = $atomLink->href;
+	if ($atomLink->title) {
+		$link->attributes['title'] = $atomLink->title;
+	}
+	
+	return $link;
+}
+
+
+/**************************************************
+ *
+ * Atom feed -> DOM
+ *
+ *************************************************/
+
+function atomFeedAsXml(&$atomFeed) {
+	global $req, $atomVersion, $atomNamespace, $siteName, $services;
+	
+	$feedDom = new XML();
+	$feedDom->xmlDecl = '<?xml version="1.0" encoding="iso-8859-1" ?>';
+	
+	$feed = $feedDom->createElement('feed');
+	$feed->attributes['version'] = htmlspecialchars($atomVersion);
+	$feed->attributes['xmlns'] = htmlspecialchars($atomNamespace);
+	
+	foreach($atomFeed->link as $link) {
+		$feed->appendChild(atomLinkToXml($link, $feedDom));
+	}
+	
+	$title = $feedDom->createElement('title');
+	$title->appendChild($feedDom->createTextNode($siteName . " " . $services[$req->service]["title"]));
+	$feed->appendChild($title);
+	
+	if ($atomFeed->modified) {
+		$modified = $feedDom->createElement('modified');
+		$modified->appendChild($feedDom->createTextNode(timestampToW3Date($atomFeed->modified)));
+		$feed->appendChild($modified);
+	}
+	
+	foreach($atomFeed->entries as $entry) {
+		$feed->appendChild(atomFeedEntryAsXml($entry, $feedDom));
+	}
+	
+	$feedDom->appendChild($feed);
+	return $feedDom;
+}
+
+function atomFeedEntryAsXml(&$atomEntry, &$feedDom) {
+	global $req, $mimeType;
+	
+	$entry = $feedDom->createElement('entry');
+	
+	$title = $feedDom->createElement('title');
+	$title->appendChild($title->createTextNode($atomEntry->title));
+	$entry->appendChild($title);
+	
+	$id = $feedDom->createElement('id');
+	$id->appendChild($id->createTextNode($atomEntry->id));
+	$entry->appendChild($id);
+	
+	$link = $feedDom->createElement('link');
+	$link->attributes["rel"]  = "service.edit";
+	$link->attributes["type"] = $mimeType["atom"];
+	$link->attributes["href"] = $atomEntry->link;
+	$entry->appendChild($link);
+
+	$link2 = $feedDom->createElement('link');
+	$link2->attributes["rel"]  = "alternate";
+	$link2->attributes["type"] = $mimeType["html"];
+	$link2->attributes["href"] = $atomEntry->link . ".html";
+	$entry->appendChild($link2);
+
+	if ($atomEntry->author) {
+		$author = $feedDom->createElement('author');
+		atomPersonToXml($atomEntry->author, $author);
+		$entry->appendChild($author);
+	}
+
+	$issued = $feedDom->createElement('issued');
+	$issued->appendChild($issued->createTextNode($atomEntry->issued));
+	$entry->appendChild($issued);
+	
+	if ($atomEntry->created) {
+		$created = $feedDom->createElement('created');
+		$created->appendChild($created->createTextNode($atomEntry->created));
+		$entry->appendChild($created);
+	}
+
+	if ($atomEntry->modified) {
+		$modDate = $feedDom->createElement('modified');
+		$modDate->appendChild($modDate->createTextNode($atomEntry->modified));
+		$entry->appendChild($modDate);
+	}
+	
+	return $entry;
+}
+
+
 ?>
\ No newline at end of file

Modified: plugins/trunk/atom/class/xml/atom/atomFunc.php
===================================================================
--- plugins/trunk/atom/class/xml/atom/atomFunc.php	2005-01-10 18:12:10 UTC (rev 724)
+++ plugins/trunk/atom/class/xml/atom/atomFunc.php	2005-01-10 18:20:03 UTC (rev 725)
@@ -1,613 +1,613 @@
-<?php
-
-/**********************************************************************
- * isoTope: an Atom-powered web framework                             *
- *                                                                    *
- * atomFunc.php - Common functions.                                   *
- *                HTTP Functions                                      *
- *                W3C Date functions                                  *
- *                Logging - atomLog()                                 *
- *                DOM Functions                                       *
- *                Common Atom functions                               *
- *                Common Atom Object Factories                        *
- * Copyright (c) 2004  Michael Davies (Isofarro).                     *
- *                                                                    *
- **********************************************************************
- *                                                                    *
- * This program is free software; you can redistribute it and/or      *
- * modify it under the terms of the GNU General Public License as     *
- * published by the Free Software Foundation; either version 2 of the *
- * License, or (at your option) any later version.                    *
- *                                                                    *
- * This program is distributed in the hope that it will be useful,    *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of     *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *
- * GNU General Public License for more details.                       *
- *                                                                    *
- * You should have received a copy of the GNU General Public License  *
- * along with this program; if not, write to the                      *
- *     Free Software Foundation, Inc.                                 *
- *     59 Temple Place, Suite 330                                     *
- *     Boston, MA 02111-1307 USA                                      *
- *                                                                    *
- *********************************************************************/
-
- 
-
-/**************************************
- *
- * Common HTTP functions
- *
- **************************************/
-
-// Create and send back the location redirect to the edit URL of the new entry
-function redirectNewAtomEntry(&$entry) {
-	global $req, $mimeType;
-
-	// Get the edit link for the Location return
-	$link = getAtomLink($entry, "service.edit", $mimeType["atom"]);
-	$location = $link->href;
-	Logger::Log("Location redirect: [" . $link . "][" . $link->href . "]");
-
-	setStatusCode("303");
-	setLocation($location);
-}
-
-
-function returnStatusCode($statuscode, $msg="") {
-	global $req;
-	if ($statuscode) {
-		//header("HTTP/1.0 " . $statuscode, true);
-	} else {
-		//header("HTTP/1.0 520 Status Code Undefined", true);
-	}
-
-	if ($msg) {
-		setContentType("text/plain");
-		Logger::Log("returnStatusCode: Halting processing, returning " . $statuscode . " with message: " . $msg);	
-		
-		print $msg;
-	} else {
-		Logger::Log("returnStatusCode: Halting processing, returning only an HTTP header");	
-	}
-	
-	atomLog();
-	// Short-circuit any further processing
-	exit(0);
-}
-
-function setStatusCode($statuscode) {
-	global $req;
-	if ($statuscode) {
-		Logger::Log("setStatusCode: Setting " . $statuscode);	
-		//header("HTTP/1.0 " . $statuscode, true);
-	}
-}
-
-function returnMethodNotAllowed($msg="") {
-	global $req;
-	Logger::Log("returnMethodNotAllowed: 405 Method Not Allowed");
-	$err = "The " . $req->method . " method is not permitted for this URL.\n\n";
-	
-	if ($msg) {
-		$err .= "Further information about this error:\n";
-		$err .= "\t" . $msg . "\n\n";
-	}
-	returnStatusCode("405 Method Not Allowed", $err);
-}
-
-function returnPageNotFound($msg="") {
-	global $req;
-	Logger::Log("returnPageNotFound: 404 Not Found [" . $msg . "]");
-	$err = "The page requested could not be found.\n\n";
-	
-	if ($msg) {
-		$err .= "Further information about this error:\n";
-		$err .= "\t" . $msg . "\n\n";
-	}
-	returnStatusCode("404 Not Found", $err);
-}
-
-function returnDataError($msg) {
-	global $req;
-	Logger::Log("returnDataError: 400 Invalid request");
-	$err = "There was a data error in the received Atom request that could not be handled.\n\n";
-	
-	if ($msg) {
-		$err .= "Further information about this error:\n";
-		$err .= "\t" . $msg . "\n\n";
-	}
-	returnStatusCode("400 Invalid request", $err);
-}
-
-function returnServerError($msg) {
-	global $req;
-	Logger::Log("returnServerError: 500 Internal Server Error");
-	$err = "An Atom server or configuration error occurred.\n\n";
-	
-	if ($msg) {
-		$err .= "Further information about this error:\n";
-		$err .= "\t" . $msg . "\n\n";
-	}
-	returnStatusCode("500 Internal Server Error", $err);
-}
-
-function setContentType($contType) {
-	global $req;
-	Logger::Log("setContentType: " . $contType);
-
-	//header ("Content-Type: " . $contType, true);
-}
-
-function setLocation($url) {
-	global $req;
-	Logger::Log("setLocation: " . $url);
-
-	//header ("Location: " . $url, true);
-}
-
-
-/**************************************
- *
- * Date conversion routines
- *
- **************************************/
- 
-// W3Date:        2003-07-22T07:11-05:00
-// SQL Timestamp: 20030722071100
- 
-function dateW3DateToSql($w3Date) {
-	if ($w3Date) {
-		preg_match("/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})-(\d{2}):(\d{2})$/", $w3Date, $bits);
-		#print "["; foreach($bits as $bit) { print $bit . "|"; };
-		return $bits[1] . $bits[2] . $bits[3] . $bits[4] . $bits[5] . "00";
-	}
-}
-
-function dateW3DateToHtml($w3Date) {
-	if ($w3Date) {
-		preg_match("/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})/", $w3Date, $bits);
-		#print "["; foreach($bits as $bit) { print $bit . "|"; };
-		return $bits[3] . "/" . $bits[2] . "/" . $bits[1] . " " . $bits[4] . ":" . $bits[5];
-	}
-}
-
-function dateSqlToW3Date($sqlDate) {
-	if($sqlDate) {
-		preg_match("/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/", $sqlDate, $bits);
-		#print "["; foreach($bits as $bit) { print $bit . "|"; };
-		return $bits[1] ."-". $bits[2] ."-". $bits[3] ."T". $bits[4] .":". $bits[5] ."+01:00";		
-	}
-}
-
-function timestampToW3Date($timestamp=0) {
-	global $timezone;
-	if (empty($timestamp)) {
-		$timestamp = time();
-	}
-	
-	$date = date("Y-m-d\TH:i:s" ,$timestamp);
-
-	return $date . $timezone;
-}
-
-function toTagDate($timestamp=0) {
-	if (empty($timestamp)) {
-		$timestamp = time();
-	}
-	
-	$date = date("Y-m-d", $timestamp);
-	return $date;
-}
-
-/**************************************
- *
- * Logging - atomLog
- *
- **************************************/
-
-function atomLog() {
-	global $req, $logging, $logFile, $logDelim;
-	
-	$buffer = "";
-
-
-	$buffer .= "\n\nRequest Details:\n";
-	$buffer .= " * service       : " . $req->service . "\n";
-	$buffer .= " * method        : " . $req->method . "\n";
-	$buffer .= " * Content-Type  : " . $req->contentType . "\n";
-	$buffer .= " * Extension     : " . $req->extension . "\n";
-	$buffer .= " * Response-Type : " . $req->responseType . "\n";
-	$buffer .= " * urlPrefix     : " . $req->urlPrefix . "\n";
-	$buffer .= " * rootUri       : " . $req->rootUri . "\n";
-
-	$buffer .= " * serviceRoot : " . $req->serviceRoot . "\n";
-	
-	$buffer .= " * breadcrumb  : ";
-	foreach ($req->breadcrumb as $res) {
-		$buffer .= "[" . $res . "] ";
-	}
-	$buffer .= "\n";
-
-	$buffer .= " * atomResource: \n";
-	if ($req->atomResource) {
-		foreach ($req->atomResource as $key => $value) {
-			$buffer .= "\t" . $key . "\t=> " . $value . "\n";
-		}
-	}
-	$buffer .= " * pageUri     : " . $req->pageUri . "\n";
-	$buffer .= "\n";
-
-
-	$buffer .= "Acceptable mime-types:\n";
-	foreach ($req->accept as $res => $val) {
-		$buffer .= "[" . $res . " - " . $val . "] ";
-	}
-	$buffer .= "\n\n";
-
-	if (!empty($req->dom)) {
-		$buffer .= "Dom representation of received XML file:\n";
-		$buffer .= $req->dom->toString();
-		$buffer .= "\n";
-	}
-
-	#$buffer .= dateW3DateToSql("2003-07-22T07:11-05:00");
-
-	$buffer .= "\nMessages:\n";
-
-	foreach($req->msg as $msg) {
-		$buffer .= " * " . $msg . "\n";
-	}
-	
-	// Check whether file logging is enabled
-	if ($logging=="ON") {
-		$handle = fopen($logFile, "a");
-		fwrite($handle, $buffer . $logDelim);
-		fclose($handle);
-	} else {
-		echo $buffer;
-	}
-}
-
-
-
-/**************************************
- *
- * Common DOM functions
- *
- **************************************/
-
-
-/*
- * Search through the received node looking for namespace declarations
- * and add them to our list of found namespace declarations
- */
-function findNamespace(&$node) {
+<?php
+
+/**********************************************************************
+ * isoTope: an Atom-powered web framework                             *
+ *                                                                    *
+ * atomFunc.php - Common functions.                                   *
+ *                HTTP Functions                                      *
+ *                W3C Date functions                                  *
+ *                Logging - atomLog()                                 *
+ *                DOM Functions                                       *
+ *                Common Atom functions                               *
+ *                Common Atom Object Factories                        *
+ * Copyright (c) 2004  Michael Davies (Isofarro).                     *
+ *                                                                    *
+ **********************************************************************
+ *                                                                    *
+ * This program is free software; you can redistribute it and/or      *
+ * modify it under the terms of the GNU General Public License as     *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version.                    *
+ *                                                                    *
+ * This program is distributed in the hope that it will be useful,    *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of     *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *
+ * GNU General Public License for more details.                       *
+ *                                                                    *
+ * You should have received a copy of the GNU General Public License  *
+ * along with this program; if not, write to the                      *
+ *     Free Software Foundation, Inc.                                 *
+ *     59 Temple Place, Suite 330                                     *
+ *     Boston, MA 02111-1307 USA                                      *
+ *                                                                    *
+ *********************************************************************/
+
+ 
+
+/**************************************
+ *
+ * Common HTTP functions
+ *
+ **************************************/
+
+// Create and send back the location redirect to the edit URL of the new entry
+function redirectNewAtomEntry(&$entry) {
+	global $req, $mimeType;
+
+	// Get the edit link for the Location return
+	$link = getAtomLink($entry, "service.edit", $mimeType["atom"]);
+	$location = $link->href;
+	AtomLogger::Log("Location redirect: [" . $link . "][" . $link->href . "]");
+
+	setStatusCode("303");
+	setLocation($location);
+}
+
+
+function returnStatusCode($statuscode, $msg="") {
+	global $req;
+	if ($statuscode) {
+		//header("HTTP/1.0 " . $statuscode, true);
+	} else {
+		//header("HTTP/1.0 520 Status Code Undefined", true);
+	}
+
+	if ($msg) {
+		setContentType("text/plain");
+		AtomLogger::Log("returnStatusCode: Halting processing, returning " . $statuscode . " with message: " . $msg);	
+		
+		print $msg;
+	} else {
+		AtomLogger::Log("returnStatusCode: Halting processing, returning only an HTTP header");	
+	}
+	
+	atomLog();
+	// Short-circuit any further processing
+	exit(0);
+}
+
+function setStatusCode($statuscode) {
+	global $req;
+	if ($statuscode) {
+		AtomLogger::Log("setStatusCode: Setting " . $statuscode);	
+		//header("HTTP/1.0 " . $statuscode, true);
+	}
+}
+
+function returnMethodNotAllowed($msg="") {
+	global $req;
+	AtomLogger::Log("returnMethodNotAllowed: 405 Method Not Allowed");
+	$err = "The " . $req->method . " method is not permitted for this URL.\n\n";
+	
+	if ($msg) {
+		$err .= "Further information about this error:\n";
+		$err .= "\t" . $msg . "\n\n";
+	}
+	returnStatusCode("405 Method Not Allowed", $err);
+}
+
+function returnPageNotFound($msg="") {
+	global $req;
+	AtomLogger::Log("returnPageNotFound: 404 Not Found [" . $msg . "]");
+	$err = "The page requested could not be found.\n\n";
+	
+	if ($msg) {
+		$err .= "Further information about this error:\n";
+		$err .= "\t" . $msg . "\n\n";
+	}
+	returnStatusCode("404 Not Found", $err);
+}
+
+function returnDataError($msg) {
+	global $req;
+	AtomLogger::Log("returnDataError: 400 Invalid request");
+	$err = "There was a data error in the received Atom request that could not be handled.\n\n";
+	
+	if ($msg) {
+		$err .= "Further information about this error:\n";
+		$err .= "\t" . $msg . "\n\n";
+	}
+	returnStatusCode("400 Invalid request", $err);
+}
+
+function returnServerError($msg) {
+	global $req;
+	AtomLogger::Log("returnServerError: 500 Internal Server Error");
+	$err = "An Atom server or configuration error occurred.\n\n";
+	
+	if ($msg) {
+		$err .= "Further information about this error:\n";
+		$err .= "\t" . $msg . "\n\n";
+	}
+	returnStatusCode("500 Internal Server Error", $err);
+}
+
+function setContentType($contType) {
+	global $req;
+	AtomLogger::Log("setContentType: " . $contType);
+
+	//header ("Content-Type: " . $contType, true);
+}
+
+function setLocation($url) {
+	global $req;
+	AtomLogger::Log("setLocation: " . $url);
+
+	//header ("Location: " . $url, true);
+}
+
+
+/**************************************
+ *
+ * Date conversion routines
+ *
+ **************************************/
+ 
+// W3Date:        2003-07-22T07:11-05:00
+// SQL Timestamp: 20030722071100
+ 
+function dateW3DateToSql($w3Date) {
+	if ($w3Date) {
+		preg_match("/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})-(\d{2}):(\d{2})$/", $w3Date, $bits);
+		#print "["; foreach($bits as $bit) { print $bit . "|"; };
+		return $bits[1] . $bits[2] . $bits[3] . $bits[4] . $bits[5] . "00";
+	}
+}
+
+function dateW3DateToHtml($w3Date) {
+	if ($w3Date) {
+		preg_match("/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})/", $w3Date, $bits);
+		#print "["; foreach($bits as $bit) { print $bit . "|"; };
+		return $bits[3] . "/" . $bits[2] . "/" . $bits[1] . " " . $bits[4] . ":" . $bits[5];
+	}
+}
+
+function dateSqlToW3Date($sqlDate) {
+	if($sqlDate) {
+		preg_match("/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/", $sqlDate, $bits);
+		#print "["; foreach($bits as $bit) { print $bit . "|"; };
+		return $bits[1] ."-". $bits[2] ."-". $bits[3] ."T". $bits[4] .":". $bits[5] ."+01:00";		
+	}
+}
+
+function timestampToW3Date($timestamp=0) {
+	global $timezone;
+	if (empty($timestamp)) {
+		$timestamp = time();
+	}
+	
+	$date = date("Y-m-d\TH:i:s" ,$timestamp);
+
+	return $date . $timezone;
+}
+
+function toTagDate($timestamp=0) {
+	if (empty($timestamp)) {
+		$timestamp = time();
+	}
+	
+	$date = date("Y-m-d", $timestamp);
+	return $date;
+}
+
+/**************************************
+ *
+ * Logging - atomLog
+ *
+ **************************************/
+
+function atomLog() {
+	global $req, $logging, $logFile, $logDelim;
+	
+	$buffer = "";
+
+
+	$buffer .= "\n\nRequest Details:\n";
+	$buffer .= " * service       : " . $req->service . "\n";
+	$buffer .= " * method        : " . $req->method . "\n";
+	$buffer .= " * Content-Type  : " . $req->contentType . "\n";
+	$buffer .= " * Extension     : " . $req->extension . "\n";
+	$buffer .= " * Response-Type : " . $req->responseType . "\n";
+	$buffer .= " * urlPrefix     : " . $req->urlPrefix . "\n";
+	$buffer .= " * rootUri       : " . $req->rootUri . "\n";
+
+	$buffer .= " * serviceRoot : " . $req->serviceRoot . "\n";
+	
+	$buffer .= " * breadcrumb  : ";
+	foreach ($req->breadcrumb as $res) {
+		$buffer .= "[" . $res . "] ";
+	}
+	$buffer .= "\n";
+
+	$buffer .= " * atomResource: \n";
+	if ($req->atomResource) {
+		foreach ($req->atomResource as $key => $value) {
+			$buffer .= "\t" . $key . "\t=> " . $value . "\n";
+		}
+	}
+	$buffer .= " * pageUri     : " . $req->pageUri . "\n";
+	$buffer .= "\n";
+
+
+	$buffer .= "Acceptable mime-types:\n";
+	foreach ($req->accept as $res => $val) {
+		$buffer .= "[" . $res . " - " . $val . "] ";
+	}
+	$buffer .= "\n\n";
+
+	if (!empty($req->dom)) {
+		$buffer .= "Dom representation of received XML file:\n";
+		$buffer .= $req->dom->toString();
+		$buffer .= "\n";
+	}
+
+	#$buffer .= dateW3DateToSql("2003-07-22T07:11-05:00");
+
+	$buffer .= "\nMessages:\n";
+
+	foreach($req->msg as $msg) {
+		$buffer .= " * " . $msg . "\n";
+	}
+	
+	// Check whether file logging is enabled
+	if ($logging=="ON") {
+		$handle = fopen($logFile, "a");
+		fwrite($handle, $buffer . $logDelim);
+		fclose($handle);
+	} else {
+		echo $buffer;
+	}
+}
+
+
+
+/**************************************
+ *
+ * Common DOM functions
+ *
+ **************************************/
+
+
+/*
+ * Search through the received node looking for namespace declarations
+ * and add them to our list of found namespace declarations
+ */
+function findNamespace(&$node) {
 	global $req, $ns;
 	
 	if( !is_array($node->attributes)) {
-	   Logger::Log( "findNamespace: can't find attributes for nodes because node->attributes is not an array!" );
+	   AtomLogger::Log( "findNamespace: can't find attributes for nodes because node->attributes is not an array!" );
 	   return false;
-	}
-
-	foreach(array_keys($node->attributes) as $attr) {
-		Logger::Log("findNamespace: Attr: " . $attr);
-		$pos = strpos("xmlns", $attr);
-		if ($pos === false) {} elseif($pos==0) {
-			$temp = explode(":", $attr);
-			if (count($temp)==1) {
-				// its a default namespace
-				$temp[1] = "DEFAULT";
-			}
-			Logger::Log("findNamespace: Namespace defined: " . $attr . " -- xmlns:" . $temp[1] . "=\"" . $node->attributes[$attr] . "\"");
-			$ns[$temp[1]] = $node->attributes[$attr];
-		}
-	}
-}
-
-/*
- * Take a node and copy all of its descendants into a new starting node
- */
-function copyAllDescendants($fromNode, &$toNode) {
-	global $req;
-	
-	#Logger::Log("Old Node: " . $fromNode->toString());
-	$len = count($fromNode->childNodes);
-	for($i=0; $i<$len; $i++) {
-		$toNode->appendChild($fromNode->childNodes[$i]);
-	}
-	#Logger::Log("New Node: " . $toNode->toString());
-}
-
-
-/**************************************
- *
- * Common Atom functions
- *
- **************************************/
-
-/*
- * Remove a link with a specific rel and type
- */
-function removeAtomLink(&$atomEntry, $rel, $type) {
-	global $req;
-	
-	$linkArr = $atomEntry->link;
-	
-	$linkPos=-1;
-	Logger::Log("removeAtomLink: Link: --[" . $rel . "][" . $type . "]");
-	##Logger::Log("removeAtomLink: \n" . var_export($linkArr, TRUE));
-	foreach ($linkArr as $idx => $link) {
-		#Logger::Log("Link: " . $idx . "-[" . $link->rel . "][" . $link->type . "]");
-		if (($link->rel==$rel) && ($link->type==$type)) {
-			$linkPos=$idx;
-			#Logger::Log("removeAtomLink: Link entry found at: $idx");
-		}
-	}
-	if ($linkPos!=-1) {
-		unset($atomEntry->link[$linkPos]);
-	}
-}
-
-/*
- * Get a particular link from an Atom Entry given its rel and type
- */
-function getAtomLink(&$atomEntry, $rel, $type) {
-	global $req;
-	
-	$linkArr = $atomEntry->link;
-	$linkPos=-1;
-	Logger::Log("getAtomLink: Link: --[" . $rel . "][" . $type . "]");
-	foreach ($linkArr as $idx => $link) {
-		Logger::Log("Link: " . $idx . "-[" . $link->rel . "][" . $link->type . "]");
-		if (($link->rel==$rel) && ($link->type==$type)) {
-			$linkPos=$idx;
-			Logger::Log("getAtomLink: Link entry found at: $idx [" . $atomEntry->link[$linkPos]->href . "]");
-		}
-	}
-	if ($linkPos!=-1) {
-		return $atomEntry->link[$linkPos];
-	}
-}
-
-/*
- * Get the main atom feed for this website
- */
-function getAtomFeedLink() {
-	global $req, $mimeType, $urlPrefix, $rootUri;
-
-	$feedLink = new AtomLink();
-	$feedLink->rel   = "service.feed";
-	$feedLink->type  = $mimeType["atom"];
-	$feedLink->href  = $urlPrefix . $rootUri;
-	$feedLink->title = "Atom Feed for this website";
-	
-	return $feedLink;
-}
-
-/*
- * 
- */
-function mergeAtomEntry($oldEntry, &$newEntry) {
-	global $req;
-	
-	// Update title, summary and content items:
-	Logger::Log("mergeAtomEntry: Updating title");
-	$oldEntry->title   = $newEntry->title;
-	
-	if (!empty($newEntry->summary)) {
-		Logger::Log("mergeAtomEntry: Updating summary");
-		$oldEntry->summary = $newEntry->summary;
-	}
-	
-	if (!empty($newEntry->content)) {
-		Logger::Log("mergeAtomEntry: Updating content");
-		$oldEntry->content = $newEntry->content;
-	}
-	
-	if (!empty($newEntry->author)) {
-		Logger::Log("mergeAtomEntry: Updating author");
-		$oldEntry->author = $newEntry->author;
-	}
-	
-	if (!empty($newEntry->contributor)) {
-		Logger::Log("mergeAtomEntry: Updating contributor");
-		$oldEntry->contributor = $newEntry->contributor;
-	}
-	
-	$timestamp = time();
-	$oldEntry->timestamp = $timestamp;
-	Logger::Log("mergeAtomEntry: Entry Timestamp: " . $oldEntry->timestamp);
-	$currentDate = timestampToW3Date($timestamp);
-
-	if (!empty($newEntry->modified)) {
-		Logger::Log("mergeAtomEntry: Updating modified date");
-		$oldEntry->modified = $newEntry->modified;
-	} else {
-		Logger::Log("mergeAtomEntry: Creating new modified date");
-		$oldEntry->modified = $currentDate;
-	}
-	
-	if (!empty($newEntry->issued)) {
-		Logger::Log("mergeAtomEntry: Updating issued date");
-		$oldEntry->issued = $newEntry->issued;
-	}
-
-	return $oldEntry;
-}
-
-/*
- * Creates a unique id using the tag: uri.
- */
-function createIdTag($identifier) {
-	global $atomDomain, $req;
-	
-	$service = $req->service;
-	if ($service) {
-		$service .= ".";
-	}
-	
-	return "tag:" . $atomDomain . "," . toTagDate() . ":" . $service . $identifier;
-}
-
-
-/**************************************
- *
- * Common Atom Object Factories
- *
- **************************************/
-
-
-function getContentHandler(&$content) {
-	global $req, $mimeTypeR, $mimeTypeHandler;
-
-	// Populate the type and mode with default values if they are empty
-	if (empty($content->type)) { $content->type = "text/plain"; }
-	if (empty($content->mode)) { $content->mode = "xml"; }
-
-	// Look at the content @type.
-	
-	// If its text/xml then
-	//  * do an element check to identify the vocabulary
-	// else
-	// Do a mime-type lookup.
-
-	$mimeId         = "";
-	$contentHandler = "";
-
-	if ($content->type=="text/xml") {
-		// Use the element structure to identify XML vocab
-		Logger::Log("getContentHandler: text/xml content");
-		$mimeId         = getXmlHandler($content->container);
-		$contentHandler = $mimeTypeHandler[$mimeId];
-	} else {
-		// Use the type to determine the mime-type handler:
-		Logger::Log("getContentHandler: non xml content");
-		$mimeId         = $mimeTypeR[$content->type];
-		$contentHandler = $mimeTypeHandler[$mimeId];
-	}
-
-
-	if ($contentHandler) {
-		Logger::Log("getContentHandler: [" . $mimeId . "][" . $content->type . "][" . $contentHandler . "]");
-
-		include_once("handler" . $contentHandler . ".php");
-		Logger::Log("getContentHandler: included mimeHandler: handler" . $contentHandler . ".php" );
-
-		// Creating the class name
-		$mimeHandlerClass = $contentHandler . "Handler";
-
-		// Instantiating an object using a dynamic class name	
-		$handler = new $mimeHandlerClass();
-
-		if (is_subclass_of($handler, "BaseClassHandler")) {
-			Logger::Log("getContentHandler: instantiated class is a subclass of BaseClassHandler");
-
-			// Call the generic parseContent function
-			$handler->parseContent($content->container);
-			return $handler;
-
-		} else {
-			Logger::Log("getContentHandler ERROR: Instantiated class not a subclass of BaseClassHandler");
-			returnServerError("Atom content handler " . $contentHandler . " is not a valid content handler.");
-		}
-	} else {
-		Logger::Log("getContentHandler ERROR: no content handler specified for XML vocab: " . $mimeId);
-		$msg = "No Atom content handler specified for ";
-		if ($content->type=="text/xml") {
-			$msg .= "xml root element " . $content->container->firstChild->firstChild->nodeName;
-		} else {
-			$msg .= $content->type;
-		}
-		returnServerError($msg);
-	}
-	
-	return null;
-}
-
-/*
- * Given a content-enveloped node identify the XML vocab being used
- */
-function getXmlHandler(&$cont) {
-	global $req, $hierXml;
-
-	$node = $cont->firstChild->firstChild;
-	Logger::Log("getXmlHandler: " . $node->toString());
-	Logger::Log("getXmlHandler: [" . $node->nodeName . "]");
-
-	$nodeName = $node->nodeName;
-	$nodeNamespace = "";
-	if (strstr($nodeName, ':') === false) {
-		// Element isn't namespaced
-	} else {
-		$tmpArray      = explode(':', $nodeName);
-		$nodeNamespace = $tmpArray[0];
-		$nodeName      = $tmpArray[1];
-	}
-	
-	if($hierXml[$nodeName]) {
-		// If the value is not an array then return the value
-		// If it is an array, then we need to go down to the child of this element
-		if (is_array($hierXml[$nodeName])) {
-			Logger::Log("getXmlHandler: Element [" . $nodeName . "] requires child eval.");
-			atomLog();
-			exit(0);
-		} else {
-			Logger::Log("getXmlHandler: Handler found [" . $nodeName . "][" . $hierXml[$nodeName] . "]");
-			atomLog();
-			return $hierXml[$nodeName];
-		}
-	}
-
-	returnServerError("No XML handler found for " . $node->nodeName);	
-}
-
-function getAtomStorageHandler($storage) {
-	global $req;
-
-	Logger::Log("getAtomStorageHandler: Storage mechanism: store" . $storage . ".php");
-	include_once("store" . $storage . ".php");
-
-	// Creating the class name
-	$storageHandlerClass = $storage . "Storage";
-
-	// Instantiating an object using a dynamic class name	
-	$handler = new $storageHandlerClass();
-
-	if (is_subclass_of($handler, "BaseClassStorage")) {
-		Logger::Log("getAtomStorageHandler: instantiated class is a subclass of BaseClassStorage");
-
-		return $handler;
-		
-	} else {
-		Logger::Log("ERROR getAtomStorageHandler: Instantiated class not a subclass of BaseClassStorage");
-	}
-	
-	returnServerError("No storage handler called " . $storage . " defined");
-
-}
-
-function getAtomServiceHandler($service) {
-	global $req, $services;
-	
-	Logger::Log("getAtomServiceHandler: Service: service" . $services[$service]["class"] . ".php");
-
-	include_once("service" . $services[$service]["class"] . ".php");
-
-	// Creating the class name
-	$serviceHandlerClass = $services[$service]["class"] . "Service";
-
-	// Instantiating an object using a dynamic class name	
-	$handler = new $serviceHandlerClass();
-
-	if (is_subclass_of($handler, "BaseClassService")) {
-		Logger::Log("getAtomServiceHandler: Instantiated class is a subclass of BaseClassService");
-		return $handler;
-	} else {
-		Logger::Log("getAtomServiceHandler: ERROR: Instantiated class not a subclass of BaseClassService");
-	}
-
-	returnServerError("No service handler called " . $service . " defined");
-}
-
+	}
+
+	foreach(array_keys($node->attributes) as $attr) {
+		AtomLogger::Log("findNamespace: Attr: " . $attr);
+		$pos = strpos("xmlns", $attr);
+		if ($pos === false) {} elseif($pos==0) {
+			$temp = explode(":", $attr);
+			if (count($temp)==1) {
+				// its a default namespace
+				$temp[1] = "DEFAULT";
+			}
+			AtomLogger::Log("findNamespace: Namespace defined: " . $attr . " -- xmlns:" . $temp[1] . "=\"" . $node->attributes[$attr] . "\"");
+			$ns[$temp[1]] = $node->attributes[$attr];
+		}
+	}
+}
+
+/*
+ * Take a node and copy all of its descendants into a new starting node
+ */
+function copyAllDescendants($fromNode, &$toNode) {
+	global $req;
+	
+	#AtomLogger::Log("Old Node: " . $fromNode->toString());
+	$len = count($fromNode->childNodes);
+	for($i=0; $i<$len; $i++) {
+		$toNode->appendChild($fromNode->childNodes[$i]);
+	}
+	#AtomLogger::Log("New Node: " . $toNode->toString());
+}
+
+
+/**************************************
+ *
+ * Common Atom functions
+ *
+ **************************************/
+
+/*
+ * Remove a link with a specific rel and type
+ */
+function removeAtomLink(&$atomEntry, $rel, $type) {
+	global $req;
+	
+	$linkArr = $atomEntry->link;
+	
+	$linkPos=-1;
+	AtomLogger::Log("removeAtomLink: Link: --[" . $rel . "][" . $type . "]");
+	##AtomLogger::Log("removeAtomLink: \n" . var_export($linkArr, TRUE));
+	foreach ($linkArr as $idx => $link) {
+		#AtomLogger::Log("Link: " . $idx . "-[" . $link->rel . "][" . $link->type . "]");
+		if (($link->rel==$rel) && ($link->type==$type)) {
+			$linkPos=$idx;
+			#AtomLogger::Log("removeAtomLink: Link entry found at: $idx");
+		}
+	}
+	if ($linkPos!=-1) {
+		unset($atomEntry->link[$linkPos]);
+	}
+}
+
+/*
+ * Get a particular link from an Atom Entry given its rel and type
+ */
+function getAtomLink(&$atomEntry, $rel, $type) {
+	global $req;
+	
+	$linkArr = $atomEntry->link;
+	$linkPos=-1;
+	AtomLogger::Log("getAtomLink: Link: --[" . $rel . "][" . $type . "]");
+	foreach ($linkArr as $idx => $link) {
+		AtomLogger::Log("Link: " . $idx . "-[" . $link->rel . "][" . $link->type . "]");
+		if (($link->rel==$rel) && ($link->type==$type)) {
+			$linkPos=$idx;
+			AtomLogger::Log("getAtomLink: Link entry found at: $idx [" . $atomEntry->link[$linkPos]->href . "]");
+		}
+	}
+	if ($linkPos!=-1) {
+		return $atomEntry->link[$linkPos];
+	}
+}
+
+/*
+ * Get the main atom feed for this website
+ */
+function getAtomFeedLink() {
+	global $req, $mimeType, $urlPrefix, $rootUri;
+
+	$feedLink = new AtomLink();
+	$feedLink->rel   = "service.feed";
+	$feedLink->type  = $mimeType["atom"];
+	$feedLink->href  = $urlPrefix . $rootUri;
+	$feedLink->title = "Atom Feed for this website";
+	
+	return $feedLink;
+}
+
+/*
+ * 
+ */
+function mergeAtomEntry($oldEntry, &$newEntry) {
+	global $req;
+	
+	// Update title, summary and content items:
+	AtomLogger::Log("mergeAtomEntry: Updating title");
+	$oldEntry->title   = $newEntry->title;
+	
+	if (!empty($newEntry->summary)) {
+		AtomLogger::Log("mergeAtomEntry: Updating summary");
+		$oldEntry->summary = $newEntry->summary;
+	}
+	
+	if (!empty($newEntry->content)) {
+		AtomLogger::Log("mergeAtomEntry: Updating content");
+		$oldEntry->content = $newEntry->content;
+	}
+	
+	if (!empty($newEntry->author)) {
+		AtomLogger::Log("mergeAtomEntry: Updating author");
+		$oldEntry->author = $newEntry->author;
+	}
+	
+	if (!empty($newEntry->contributor)) {
+		AtomLogger::Log("mergeAtomEntry: Updating contributor");
+		$oldEntry->contributor = $newEntry->contributor;
+	}
+	
+	$timestamp = time();
+	$oldEntry->timestamp = $timestamp;
+	AtomLogger::Log("mergeAtomEntry: Entry Timestamp: " . $oldEntry->timestamp);
+	$currentDate = timestampToW3Date($timestamp);
+
+	if (!empty($newEntry->modified)) {
+		AtomLogger::Log("mergeAtomEntry: Updating modified date");
+		$oldEntry->modified = $newEntry->modified;
+	} else {
+		AtomLogger::Log("mergeAtomEntry: Creating new modified date");
+		$oldEntry->modified = $currentDate;
+	}
+	
+	if (!empty($newEntry->issued)) {
+		AtomLogger::Log("mergeAtomEntry: Updating issued date");
+		$oldEntry->issued = $newEntry->issued;
+	}
+
+	return $oldEntry;
+}
+
+/*
+ * Creates a unique id using the tag: uri.
+ */
+function createIdTag($identifier) {
+	global $atomDomain, $req;
+	
+	$service = $req->service;
+	if ($service) {
+		$service .= ".";
+	}
+	
+	return "tag:" . $atomDomain . "," . toTagDate() . ":" . $service . $identifier;
+}
+
+
+/**************************************
+ *
+ * Common Atom Object Factories
+ *
+ **************************************/
+
+
+function getContentHandler(&$content) {
+	global $req, $mimeTypeR, $mimeTypeHandler;
+
+	// Populate the type and mode with default values if they are empty
+	if (empty($content->type)) { $content->type = "text/plain"; }
+	if (empty($content->mode)) { $content->mode = "xml"; }
+
+	// Look at the content @type.
+	
+	// If its text/xml then
+	//  * do an element check to identify the vocabulary
+	// else
+	// Do a mime-type lookup.
+
+	$mimeId         = "";
+	$contentHandler = "";
+
+	if ($content->type=="text/xml") {
+		// Use the element structure to identify XML vocab
+		AtomLogger::Log("getContentHandler: text/xml content");
+		$mimeId         = getXmlHandler($content->container);
+		$contentHandler = $mimeTypeHandler[$mimeId];
+	} else {
+		// Use the type to determine the mime-type handler:
+		AtomLogger::Log("getContentHandler: non xml content");
+		$mimeId         = $mimeTypeR[$content->type];
+		$contentHandler = $mimeTypeHandler[$mimeId];
+	}
+
+
+	if ($contentHandler) {
+		AtomLogger::Log("getContentHandler: [" . $mimeId . "][" . $content->type . "][" . $contentHandler . "]");
+
+		include_once("handler" . $contentHandler . ".php");
+		AtomLogger::Log("getContentHandler: included mimeHandler: handler" . $contentHandler . ".php" );
+
+		// Creating the class name
+		$mimeHandlerClass = $contentHandler . "Handler";
+
+		// Instantiating an object using a dynamic class name	
+		$handler = new $mimeHandlerClass();
+
+		if (is_subclass_of($handler, "BaseClassHandler")) {
+			AtomLogger::Log("getContentHandler: instantiated class is a subclass of BaseClassHandler");
+
+			// Call the generic parseContent function
+			$handler->parseContent($content->container);
+			return $handler;
+
+		} else {
+			AtomLogger::Log("getContentHandler ERROR: Instantiated class not a subclass of BaseClassHandler");
+			returnServerError("Atom content handler " . $contentHandler . " is not a valid content handler.");
+		}
+	} else {
+		AtomLogger::Log("getContentHandler ERROR: no content handler specified for XML vocab: " . $mimeId);
+		$msg = "No Atom content handler specified for ";
+		if ($content->type=="text/xml") {
+			$msg .= "xml root element " . $content->container->firstChild->firstChild->nodeName;
+		} else {
+			$msg .= $content->type;
+		}
+		returnServerError($msg);
+	}
+	
+	return null;
+}
+
+/*
+ * Given a content-enveloped node identify the XML vocab being used
+ */
+function getXmlHandler(&$cont) {
+	global $req, $hierXml;
+
+	$node = $cont->firstChild->firstChild;
+	AtomLogger::Log("getXmlHandler: " . $node->toString());
+	AtomLogger::Log("getXmlHandler: [" . $node->nodeName . "]");
+
+	$nodeName = $node->nodeName;
+	$nodeNamespace = "";
+	if (strstr($nodeName, ':') === false) {
+		// Element isn't namespaced
+	} else {
+		$tmpArray      = explode(':', $nodeName);
+		$nodeNamespace = $tmpArray[0];
+		$nodeName      = $tmpArray[1];
+	}
+	
+	if($hierXml[$nodeName]) {
+		// If the value is not an array then return the value
+		// If it is an array, then we need to go down to the child of this element
+		if (is_array($hierXml[$nodeName])) {
+			AtomLogger::Log("getXmlHandler: Element [" . $nodeName . "] requires child eval.");
+			atomLog();
+			exit(0);
+		} else {
+			AtomLogger::Log("getXmlHandler: Handler found [" . $nodeName . "][" . $hierXml[$nodeName] . "]");
+			atomLog();
+			return $hierXml[$nodeName];
+		}
+	}
+
+	returnServerError("No XML handler found for " . $node->nodeName);	
+}
+
+function getAtomStorageHandler($storage) {
+	global $req;
+
+	AtomLogger::Log("getAtomStorageHandler: Storage mechanism: store" . $storage . ".php");
+	include_once("store" . $storage . ".php");
+
+	// Creating the class name
+	$storageHandlerClass = $storage . "Storage";
+
+	// Instantiating an object using a dynamic class name	
+	$handler = new $storageHandlerClass();
+
+	if (is_subclass_of($handler, "BaseClassStorage")) {
+		AtomLogger::Log("getAtomStorageHandler: instantiated class is a subclass of BaseClassStorage");
+
+		return $handler;
+		
+	} else {
+		AtomLogger::Log("ERROR getAtomStorageHandler: Instantiated class not a subclass of BaseClassStorage");
+	}
+	
+	returnServerError("No storage handler called " . $storage . " defined");
+
+}
+
+function getAtomServiceHandler($service) {
+	global $req, $services;
+	
+	AtomLogger::Log("getAtomServiceHandler: Service: service" . $services[$service]["class"] . ".php");
+
+	include_once("service" . $services[$service]["class"] . ".php");
+
+	// Creating the class name
+	$serviceHandlerClass = $services[$service]["class"] . "Service";
+
+	// Instantiating an object using a dynamic class name	
+	$handler = new $serviceHandlerClass();
+
+	if (is_subclass_of($handler, "BaseClassService")) {
+		AtomLogger::Log("getAtomServiceHandler: Instantiated class is a subclass of BaseClassService");
+		return $handler;
+	} else {
+		AtomLogger::Log("getAtomServiceHandler: ERROR: Instantiated class not a subclass of BaseClassService");
+	}
+
+	returnServerError("No service handler called " . $service . " defined");
+}
+
 ?>

Modified: plugins/trunk/atom/class/xml/atom/atomabstractservice.class.php
===================================================================
--- plugins/trunk/atom/class/xml/atom/atomabstractservice.class.php	2005-01-10 18:12:10 UTC (rev 724)
+++ plugins/trunk/atom/class/xml/atom/atomabstractservice.class.php	2005-01-10 18:20:03 UTC (rev 725)
@@ -2,7 +2,7 @@
 
 	include_once( PLOG_CLASS_PATH."class/object/object.class.php" );
 	include_once( PLOG_CLASS_PATH."plugins/atom/class/xml/atom/atomrequest.class.php" );
-	include_once( PLOG_CLASS_PATH."class/logger/logger.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/atom/class/logger/atomlogger.class.php" );
 
 	/**
 	 * encapsulates an atom service

Modified: plugins/trunk/atom/class/xml/atom/atomrequest.class.php
===================================================================
--- plugins/trunk/atom/class/xml/atom/atomrequest.class.php	2005-01-10 18:12:10 UTC (rev 724)
+++ plugins/trunk/atom/class/xml/atom/atomrequest.class.php	2005-01-10 18:20:03 UTC (rev 725)
@@ -104,9 +104,9 @@
 			$this->_query   = $get;
 			$this->_type    = $this->_getRequestTypeId( $server["REQUEST_METHOD"] );
 			if ($this->_type == ATOM_REQUEST_POST || $this->_type == ATOM_REQUEST_PUT ) {
-				Logger::log( "AtomRequest: handling POST/PUT request" );
+				AtomLogger::Log( "AtomRequest: handling POST/PUT request" );
 				$xmlstring = file_get_contents("php://input");
-				Logger::log( "Contents of php://input:" );
+				AtomLogger::Log( "Contents of php://input:" );
 				if (!empty($xmlstring)) {
 					// ecto for windows likes to send the UTF-8 BOM in the first three bytes
 					// of the message, but we don't like it so let's remove it
@@ -118,7 +118,7 @@
 					$this->_dom->parseXML($xmlstring);
 				}
 				$this->_payload = $xmlstring;
-				Logger::log( $this->_payload );
+				AtomLogger::Log( $this->_payload );
 
 				// now, extract the information from the Atom document
 				$this->parseAtomDocument();
@@ -132,7 +132,7 @@
 		 */
 		function parseAtomDocument()
 		{
-			Logger::Log( "Parsing the Atom document..." );
+			AtomLogger::Log( "Parsing the Atom document..." );
 			$this->_atomDocument = createAtomEntry( $this->_dom );
 			
 			return true;		
@@ -246,10 +246,10 @@
 			// and the post id, if any, is the third
 			$this->_articleId = $parts[2];
 			
-			Logger::log( "-- Incoming request: $path" );
-			Logger::log( "   Service: ".$this->_service );
-			Logger::log( "   Blog id: ".$this->_blogId );
-			Logger::log( "   Article id: ".$this->_articleId );
+			AtomLogger::Log( "-- Incoming request: $path" );
+			AtomLogger::Log( "   Service: ".$this->_service );
+			AtomLogger::Log( "   Blog id: ".$this->_blogId );
+			AtomLogger::Log( "   Article id: ".$this->_articleId );
 			
 			return true;
 		}

Modified: plugins/trunk/atom/class/xml/atom/editservice.class.php
===================================================================
--- plugins/trunk/atom/class/xml/atom/editservice.class.php	2005-01-10 18:12:10 UTC (rev 724)
+++ plugins/trunk/atom/class/xml/atom/editservice.class.php	2005-01-10 18:20:03 UTC (rev 725)
@@ -59,11 +59,11 @@
 		{
 		      // get the article id
 		      $articleId = $this->_request->getArticleId();
-		      Logger::Log( "Removing article with id $articleId" );
+		      AtomLogger::Log( "Removing article with id $articleId" );
 		      
 		      $articles = new Articles();
 		      if( !$articles->deleteArticle( $articleId, $this->_userInfo->getId(), $this->_blogInfo->getId())) {
-		          Logger::Log( "There was an error removing the article" );
+		          AtomLogger::Log( "There was an error removing the article" );
 		          $response = new AtomErrorResponse( "Error removing article with identifier $articleId",
 		                                             HTTP_ERROR_500 );
 		          $this->setResponse( $response );
@@ -71,7 +71,7 @@
 		      }
 		      
 		      // a response only needs an HTTP 200 OK to acknowledge that the post was removed successfully
-		      Logger::Log( "Article removed successfully" );
+		      AtomLogger::Log( "Article removed successfully" );
 		      $response = new AtomResponse( "Article deleted OK", Array( HTTP_OK_200 ));
 		      $this->setResponse( $response );
 		      
@@ -85,13 +85,13 @@
 		{
 			$articleId = $this->_request->getArticleId();
 			$blogId = $this->_blogInfo->getId();			
-			Logger::Log( "Attempting to update article $articleId in blog $blogId" );
+			AtomLogger::Log( "Attempting to update article $articleId in blog $blogId" );
 			
 			// load the article
 			$articles = new Articles();
 			$article = $articles->getBlogArticle( $articleId, $blogId );
 			if( !$article ) {
-				Logger::Log( "There was an error loading article $articleId for updating!" );
+				AtomLogger::Log( "There was an error loading article $articleId for updating!" );
 				$response = new AtomErrorResponse( "Article not found", HTTP_ERROR_400 );
 				$this->setResponse( $response );
 				
@@ -102,15 +102,15 @@
 		    $document = $this->_request->getAtomDocument();
 		    $contents = $document->content;					
 		    $text  = $contents[0]->text;
-		    Logger::Log( "updating to contents = $text" );
+		    AtomLogger::Log( "updating to contents = $text" );
 		    $title = $document->title->text;
-		    Logger::Log( "updating to title = $title" );
+		    AtomLogger::Log( "updating to title = $title" );
 			
 			$article->setTopic( $title );
 			$article->setText( $text );
 			
 			if( !$articles->updateArticle( $article )) {
-				Logger::Log( "There was an error updating $articleId!" );
+				AtomLogger::Log( "There was an error updating $articleId!" );
 				$response = new AtomErrorResponse( "Error updating article", HTTP_ERROR_500 );
 				$this->setResponse( $response );
 				
@@ -118,7 +118,7 @@
 			}
 			
 			// if everythign went fine, then just say so :)
-			Logger::Log( "Article updated successfully!" );
+			AtomLogger::Log( "Article updated successfully!" );
 			$response = new AtomResponse( "Article updated OK", Array( HTTP_OK_200 ));
 			$this->setResponse( $response );
 			

Modified: plugins/trunk/atom/class/xml/atom/plogatomabstractservice.class.php
===================================================================
--- plugins/trunk/atom/class/xml/atom/plogatomabstractservice.class.php	2005-01-10 18:12:10 UTC (rev 724)
+++ plugins/trunk/atom/class/xml/atom/plogatomabstractservice.class.php	2005-01-10 18:20:03 UTC (rev 725)
@@ -32,13 +32,13 @@
 			
 			// first, get the username from the authentication layer
 			$userName = $this->_request->getUsernameFromAuthentication();
-			Logger::Log( "PlogAtomAbstractService:_loadInfo: username = $userName" );
+			AtomLogger::Log( "PlogAtomAbstractService:_loadInfo: username = $userName" );
 
 			// load user information for the user
 			$users = new Users();
 			$this->_userInfo = $users->getUserInfoFromUsername( $userName );
 			if( !$this->_userInfo ) {
-				Logger::Log( "Error loading the user information" );
+				AtomLogger::Log( "Error loading the user information" );
 				$response = new AtomErrorResponse( "Error loading user information",
                                                                     HTTP_ERROR_500 );
 				$this->setResponse( $response );
@@ -50,11 +50,11 @@
 			$blogId = $this->_request->getBlogId();
 			$userId = $this->_userInfo->getId();
 			if( $blogId == ATOM_NO_BLOG) {
-				Logger::Log( "Loading all blogs for user ".$this->_userInfo->getUsername());
+				AtomLogger::Log( "Loading all blogs for user ".$this->_userInfo->getUsername());
 				$this->_blogInfos = $users->getUsersBlogs( $userId );
 			}
 			else {
-				Logger::Log( "Loading blog with id = ".$blogId );
+				AtomLogger::Log( "Loading blog with id = ".$blogId );
 				$this->_blogInfo = $blogs->getBlogInfo( $blogId );
 			}
 

Modified: plugins/trunk/atom/class/xml/atom/plogatomauthentication.class.php
===================================================================
--- plugins/trunk/atom/class/xml/atom/plogatomauthentication.class.php	2005-01-10 18:12:10 UTC (rev 724)
+++ plugins/trunk/atom/class/xml/atom/plogatomauthentication.class.php	2005-01-10 18:20:03 UTC (rev 725)
@@ -36,7 +36,7 @@
             $passwords = new AtomPasswords();
             $userPassword = $passwords->getPassword( $userInfo->getId());
             
-            Logger::Log( "PlogAtomAuthentication: using password = $userPassword" );
+            AtomLogger::Log( "PlogAtomAuthentication: using password = $userPassword" );
 				
 			// otherwise, fetch the information we need
 			$result = Array ( "username" => $userInfo->getUsername(),

Modified: plugins/trunk/atom/class/xml/atom/postservice.class.php
===================================================================
--- plugins/trunk/atom/class/xml/atom/postservice.class.php	2005-01-10 18:12:10 UTC (rev 724)
+++ plugins/trunk/atom/class/xml/atom/postservice.class.php	2005-01-10 18:20:03 UTC (rev 725)
@@ -82,15 +82,15 @@
 		{
 		    // get the atom document and its contents so that we can fill in the gaps
 		    // in the Article object
-		    Logger::Log( "POSTing an article to the site!" );
+		    AtomLogger::Log( "POSTing an article to the site!" );
 		    
 		    $document = $this->_request->getAtomDocument();
 		    $contents = $document->content;		
 		
 		    $text  = $contents[0]->text;
-		    Logger::Log( "contents = $text" );
+		    AtomLogger::Log( "contents = $text" );
 		    $title = $document->title->text;
-		    Logger::Log( "title = $title" );
+		    AtomLogger::Log( "title = $title" );
 		    
 		    // process all the possible links that there could be in the document, potentially
 		    $text = $this->atomLinksToHtml( $document->link ).$text;
@@ -102,7 +102,7 @@
 												HTTP_ERROR_500 );
 		        $this->setResponse( $response );
 		    }
-		    Logger::Log( "Using category with id = ".$categoryId );
+		    AtomLogger::Log( "Using category with id = ".$categoryId );
 		    $categories = Array( $categoryId );
 		    		    
 		    // what we're doing here is add articles to the db based on what came from the atom
@@ -123,14 +123,14 @@
 				$t = new Timestamp();
 				$t->setDate( $document->issued, DATE_FORMAT_ISO_EXTENDED );
 				$article->setDateObject( $t );
-				Logger::Log( "Article will be published ".$t->getTimestamp());
+				AtomLogger::Log( "Article will be published ".$t->getTimestamp());
 			}
 			
 		    // check if it went fine and if not, quit  
 		    $articles = new Articles();
 		    $articleId = $articles->addArticle( $article );
 		    if( !$articleId ) {
-		          Logger::Log( "there was an error adding the article to the database!" );
+		          AtomLogger::Log( "there was an error adding the article to the database!" );
 		          $response = new AtomErrorResponse( "Error adding article to the database", HTTP_ERROR_500 );
 		          $this->setResponse( $response );
 		          
@@ -195,7 +195,7 @@
 		{
 		    // if there are no links, then return nothing  
             if ( !is_array( $links )) {
-                Logger::Log( "No links to parse!" );
+                AtomLogger::Log( "No links to parse!" );
                 return "";
             }
                 
@@ -203,26 +203,26 @@
                 
             // otherwise, go through them...
             foreach( $links as $link ) {
-                Logger::Log( "-- atomLinksToHtml: Parsing link with href = ".$link->href );
+                AtomLogger::Log( "-- atomLinksToHtml: Parsing link with href = ".$link->href );
                 $localResData = $this->isLocalResourceTag( $link->href );
                 if( !$localResData ) {
                     // if it's an external resource, just add a link to it
-                    Logger::Log( "  it is an external link!" );
+                    AtomLogger::Log( "  it is an external link!" );
                     $result .= "<a href=\"".$link->href."\">".$link->title."</a><br />\n";
                 }
                 else {
                     // if it's a local resource, then we should load it from the database and see what it is...
-                    Logger::Log( "  It is an internal resource with id = ".$localResData["id"] );
+                    AtomLogger::Log( "  It is an internal resource with id = ".$localResData["id"] );
                     $resource  = $resources->getResource( $localResData["id"] );
                     if( $resource->isImage()) {
-                        Logger::Log( "  It is an image!" );
+                        AtomLogger::Log( "  It is an image!" );
                         $url =& RequestGenerator::getRequestGenerator( $this->_blogInfo );
                         $result .= "<a href=\"".$url->resourceLink( $resource )."\">
                                      <img class=\"resource-image\" src=\"".$url->resourcePreviewLink( $resource )."\" alt=\"".$resource->getFileName()."\" />
                                     </a><br />";
                     }
                     else {
-                        Logger::Log( "  It is something else!" );
+                        AtomLogger::Log( "  It is something else!" );
                         $result = "<a href=\"".$url->resourceLink( $resource )."\">".$resource->getFileName()."</a><br />\n";
                     }
                 }
@@ -249,8 +249,8 @@
 		      $mimeTypes = new MimeType();
               $fileMimeType = $content->type;
               $fileExtension = $mimeTypes->getExtension( $fileMimeType );
-              Logger::Log( "doBinaryObjectPost: mime type = $fileMimeType" );
-              Logger::Log( "doBinaryObjectPost: file extension = $fileExtension " );
+              AtomLogger::Log( "doBinaryObjectPost: mime type = $fileMimeType" );
+              AtomLogger::Log( "doBinaryObjectPost: file extension = $fileExtension " );
               
               // also, come up with a name based on the contents of the <summary>...</summary> tags, which
               // are unfortunately not mandatory. If there is no summary (for instance Nokia's lifeblog uses
@@ -268,13 +268,13 @@
                 $fileName = $tf->urlize( $fileName ).".$fileExtension";
               }
                 
-              Logger::Log( "doBinaryObjectPost: file name = ".$fileName );
+              AtomLogger::Log( "doBinaryObjectPost: file name = ".$fileName );
               
               // next step is to save the file in some temporary place
               $config =& Config::getConfig();
               $tempFolder = $config->getTempFolder();
               $filePath = $tempFolder."/".$fileName;
-              Logger::Log( "doBinaryPostObject: saving data to $filePath" );
+              AtomLogger::Log( "doBinaryPostObject: saving data to $filePath" );
               $file = new File( $filePath );
               if( !$file->open( "w+" )) {
                     // if we had an error trying to save the file, then we quit...
@@ -302,17 +302,17 @@
               $resourceId = $resources->addResourceFromDisk( $this->_blogInfo->getId(), $albumId, $summary, $filePath );
             
               if( !$resourceId ) {
-                    Logger::Log( "There was an error saving the resource. Error code = $resourceId" );
+                    AtomLogger::Log( "There was an error saving the resource. Error code = $resourceId" );
                     $response = new AtomErrorResponse( "Error saving resource", HTTP_ERROR_500 );
                     $this->setResponse( $response );
                     
                     return false;
               }
 
-            Logger::Log( "Resource was saved with resource id = $resourceId" );
+            AtomLogger::Log( "Resource was saved with resource id = $resourceId" );
 		    $newResource = $resources->getResource( $resourceId );
 		    if( !$newResource ) {
-                    Logger::Log( "There was an error loading the new resource" );
+                    AtomLogger::Log( "There was an error loading the new resource" );
                     $response = new AtomErrorResponse( "Error loading resource", HTTP_ERROR_500 );
                     $this->setResponse( $response );
                     return false;		    
@@ -344,15 +344,15 @@
 		      $albums = new GalleryAlbums();
 		      $album = $albums->getAlbum( $albumId );
 		      if( !$album ) {
-				Logger::Log( "checkMoblogAlbum: album does not exist! Creating a new one..." );
+				AtomLogger::Log( "checkMoblogAlbum: album does not exist! Creating a new one..." );
 				$albumId = $this->getDefaultMoblogAlbum();
 		      }
 		      else {
-				Logger::Log( "checkMoblogAlbum: Album exists, using album id = $albumId" );
+				AtomLogger::Log( "checkMoblogAlbum: Album exists, using album id = $albumId" );
 				$albumId = $album->getId();
 		      }	
 	
-		      Logger::Log( "using album with id $albumId" );
+		      AtomLogger::Log( "using album with id $albumId" );
 		      
 		      return $albumId;
 		} 
@@ -369,12 +369,12 @@
 		      // there is no method to load the albums by
 		      $tf = new Textfilter();
 		      $mangledAlbumName = $tf->urlize( $albumName );
-		      Logger::Log( "getDefaultMoblogAlbum: Locating album $mangledAlbumName" );
+		      AtomLogger::Log( "getDefaultMoblogAlbum: Locating album $mangledAlbumName" );
 		      $album = $albums->getAlbumByName( $mangledAlbumName, $this->_blogInfo->getId());
 		      
 		      // if it doesn't exist, then we have to create it
 		      if( !$album ) {
-		          Logger::Log( "getDefaultMoblogAlbum: Album does not exist, creating it..." );
+		          AtomLogger::Log( "getDefaultMoblogAlbum: Album does not exist, creating it..." );
 		          $t = new Timestamp();
 		          $album = new GalleryAlbum( $this->_blogInfo->getId(),   // blog (owner) id
 		                                     $albumName,   // name

Modified: plugins/trunk/atom/class/xml/atom/wsseauthentication.class.php
===================================================================
--- plugins/trunk/atom/class/xml/atom/wsseauthentication.class.php	2005-01-10 18:12:10 UTC (rev 724)
+++ plugins/trunk/atom/class/xml/atom/wsseauthentication.class.php	2005-01-10 18:20:03 UTC (rev 725)
@@ -38,36 +38,36 @@
 			$authHeader = $this->getWSSEHeader();
 			$this->parseWSSEHeader( $authHeader );
 
-			Logger::Log( "** WSSE Authentication data" );
-            Logger::Log( "   Header = $authHeader" );
-			Logger::Log( "   Username = ".$this->userName );
-			Logger::Log( "   Password Digest = ".$this->passwordDigest );
-			Logger::Log( "   Nonce = ".$this->nonce );
-			Logger::Log( "   Created = ".$this->created );
+			AtomLogger::Log( "** WSSE Authentication data" );
+            AtomLogger::Log( "   Header = $authHeader" );
+			AtomLogger::Log( "   Username = ".$this->userName );
+			AtomLogger::Log( "   Password Digest = ".$this->passwordDigest );
+			AtomLogger::Log( "   Nonce = ".$this->nonce );
+			AtomLogger::Log( "   Created = ".$this->created );
 			
 			// use the app-specific hook for loading application data
 			$userData = $this->getUserData( $this->userName );
 			if( !$userData ) {
 				// if there is no user information in the WSSE header, then we quit
-				Logger::Log( "Missing or incorrect username in WSSE header" );
+				AtomLogger::Log( "Missing or incorrect username in WSSE header" );
 				return false;
 			}
 			$password = $userData["password"];
-			Logger::Log( "Using password = $password" );
+			AtomLogger::Log( "Using password = $password" );
 
 			// no authentication... everybody is happy :)
 			if( !WSSE_AUTHENTICATION_DISABLED ) {
-			     Logger::Log( "WARNING: authentication disabled!" );
+			     AtomLogger::Log( "WARNING: authentication disabled!" );
 			     return true;		
 			 }
 
 			// and compute the wsse password digest
 			$body = $this->nonce.$this->created.$password;
-			Logger::Log( "body = $body" );
+			AtomLogger::Log( "body = $body" );
 			//$passwordDigest = base64_encode(pack("H*", sha1($body)));
 			$passwordDigest = base64_encode(pack("H*", sha1($body)));
 		
-			Logger::Log( "pLog's computed password digest: $passwordDigest" );
+			AtomLogger::Log( "pLog's computed password digest: $passwordDigest" );
 
 			// finally, compare if they are the same or not...
 			if( $passwordDigest == $this->passwordDigest )
@@ -95,7 +95,7 @@
 			     $wsseHeader = stripslashes($_SERVER["HTTP_X_WSSE"]);
 			 }
 
-			Logger::Log( $wsseHeader );
+			AtomLogger::Log( $wsseHeader );
 
 			return $wsseHeader;
 		}
@@ -141,7 +141,7 @@
 		 */
 		function getUsernameFromAuthentication()
 		{
-			Logger::Log( "WSSEAuthentication:getUsernameFromAuthentication username = $this->userName" );
+			AtomLogger::Log( "WSSEAuthentication:getUsernameFromAuthentication username = $this->userName" );
 			return $this->userName;
 		}
 	}




More information about the pLog-svn mailing list