Location: PHPKode > projects > ANJEL > com_anjel/anjel.php
<?php
/* $Id: anjel.php 44 2005-12-01 03:49:19Z schmalls $ */
/**
 * anjel.php
 * 
 * <p>Main frontend file for ANJEL</p>
 * 
 * @package ANJEL
 * @subpackage frontend
 * @copyright © 2004-2005 Schmalls / Joshua Thompson / All Rights Reserved
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 * @author Schmalls / Joshua Thompson <hide@address.com>
 * @version 0.6.1
 * @since 0.4.3
 * @link http://www.schmalls.com
 */

 /**
  * Makes sure this is included by a parent file
  */
 defined('_VALID_MOS') or die('Direct Access to this location is not allowed.');

 // include required files
 require_once ($mainframe->getPath('front_html'));
 require_once ($mosConfig_absolute_path . '/administrator/components/com_anjel/classes/class.mailing.php');
 require_once ($mosConfig_absolute_path . '/administrator/components/com_anjel/classes/class.subscribers.php');
 require_once ($mosConfig_absolute_path . '/administrator/components/com_anjel/configuration.php');
 require_once ($mosConfig_absolute_path . '/administrator/components/com_anjel/classes/class.phpmailer.php');
 
  /**
  * Replace file_put_contents()
  * 
  * @link        http://php.net/function.file_put_contents
  * @author      Aidan Lister <hide@address.com>
  * @version     $Revision: 1.25 $
  * @internal    resource_context is not supported
  * @since       PHP 5
  * @ignore
  */
 if (!function_exists('file_put_contents')) {
	 function file_put_contents($filename, $content, $flags = null, $resource_context = null) {
		 // If $content is an array, convert it to a string
		 if (is_array($content)) {
			 $content = implode('', $content);
		 }
		 // If we don't have a string, throw an error
		 if (!is_scalar($content)) {
			 user_error('file_put_contents() The 2nd parameter should be either a string or an array', E_USER_WARNING);
			 return false;
		 }
		 // Get the length of data to write
		 $length = strlen($content);
		 // Check what mode we are using
		 $mode = ($flags & FILE_APPEND) ? 'a' : 'w';
		 // Check if we're using the include path
		 $use_inc_path = ($flags & FILE_USE_INCLUDE_PATH) ? true : false;
		 // Open the file for writing
		 if (($fh = @fopen($filename, $mode, $use_inc_path)) === false) {
			 user_error('file_put_contents() failed to open stream: Permission denied', E_USER_WARNING);
			 return false;
		 }
		 // Write to the file
		 $bytes = 0;
		 if (($bytes = @fwrite($fh, $content)) === false) {
			 $errormsg = sprintf('file_put_contents() Failed to write %d bytes to %s', $length, $filename);
			 user_error($errormsg, E_USER_WARNING);
			 return false;
		 }
		 // Close the handle
		 @fclose($fh);
		 // Check all the data was written
		 if ($bytes != $length) {
			 $errormsg = sprintf('file_put_contents() Only %d of %d bytes written, possibly out of free disk space.', $bytes, $length);
			 user_error($errormsg, E_USER_WARNING);
			 return false;
		 }
		 // Return length
		 return $bytes;
	 }
 }
  
 /**
  * Mailing class
  * 
  * @global class $mailing
  */
 $mailing = new mailing();
 
 /**
  * Subscriber class
  * 
  * @global class $subscribers
  */
 $subscribers = new subscribers();
 
 /**
  * The list to work with
  * 
  * @global int $listid
  */ 
 $listid = mosGetParam($_REQUEST, 'listid', 0);
 /**
  * The user's id
  * 
  * @global string $userid
  */
 $userid = $my->id;
 /**
  * The action to perform
  * 
  * @global string $action
  */
 $action = mosGetParam($_REQUEST, 'action', '');
 /**
  * The task to perform
  * 
  * @global string $task
  */
 $task = mosGetParam($_REQUEST, 'task', '');
 /**
  * The mailing to work with
  * 
  * @global string $letterid
  */
 $letterid = mosGetParam($_REQUEST, 'letterid', '');
 /**
  * The user type
  * 
  * @global string $type
  */
 $type = mosGetParam($_REQUEST, 'type', '');
 /**
  * Check for authentication
  * 
  * @global string $test
  */
 $test = mosGetParam($_REQUEST, 'test', '');
 /**
  * Message to be displayed
  * 
  * @global string $message
  */
 $message = mosGetParam($_REQUEST, 'message', '');

 // include language file, or default to english
 if (file_exists ($mosConfig_absolute_path . '/components/com_anjel/languages/' . $mosConfig_lang . '.php')) {
	include_once ($mosConfig_absolute_path . '/components/com_anjel/languages/' . $mosConfig_lang . '.php');
 } else {
	include_once ($mosConfig_absolute_path . '/components/com_anjel/languages/english.php');
 } // end if
 
 // get user's id if not defined
 if ($userid == '' && $test != '') {
	 $userid = mosGetParam($_REQUEST, 'userid', '');
	 if (!(registeredCheck() || unregisteredCheck())) {
		 $userid = '';
		 $action = '';
		 echo '<p>' . _NOT_AUTH . '</p>';
	 } // end if
 } // end if
 if ($action == '') {
	// set type to registered if user is logged in or unregistered if not
	if ($userid != '') {
		$action = 'registered';
		$type = 'registered';
	} else {
		$action = 'unregistered';
		$type = 'unregistered';
		$task = 'showOptions';
	} // end if
 } // end if
 
 // add any new registered users who are not in the anjel table
 $query = 'SELECT M.* FROM `#__users` AS M LEFT JOIN `#__anjel_subscribers` AS N ON M.id = N.subscriber_id WHERE N.subscriber_id IS NULL';
 $database->setQuery($query);
 $rows = $database->loadObjectList();
 $error = $database->getErrorMsg();
 // quit on error
 if (!empty($error)) {
	 echo '<p><b>Error (admin.anjel.php-> line ' . __LINE__ . '):</b> Error getting newly added Joomla users. Database error: <br />' . $error . '</p>';
 } else {
	 foreach ($rows as $row) {
		 $query = 'INSERT INTO `#__anjel_subscribers` (`subscriber_id`, `subscribe_date`) VALUES (\'' . $row->id . '\', NOW())';
		 $database->setQuery($query);
		 $database->query();
		 $error .= $database->getErrorMsg();
	 } // end foreach
	 // output error messages
	 if (!empty($error)) {
		 echo '<p><b>Error (admin.anjel.php-> line ' . __LINE__ . '):</b> Error adding new users to subscribers table. Database error: <br />' . $error . '</p>';
	 } // end if
 } // end if
 
 // delete any deleted registered users who are still in the anjel table
 $query = 'SELECT M.* FROM `#__anjel_subscribers` AS M LEFT JOIN `#__users` AS N ON N.id = M.subscriber_id WHERE N.id IS NULL';
 $database->setQuery($query);
 $rows = $database->loadObjectList();
 $error = $database->getErrorMsg();
 // quit on error
 if (!empty($error)) {
	 echo '<p><b>Error (admin.anjel.php-> line ' . __LINE__ . '):</b> Error getting newly added Joomla users. Database error: <br />' . $error . '</p>';
 } else {
	 foreach ($rows as $row) {
		 $query = 'DELETE FROM `#__anjel_subscribers` WHERE `subscriber_id` = \'' . $row->subscriber_id . '\'';
		 $database->setQuery($query);
		 $database->query();
		 $error .= $database->getErrorMsg();
	 } // end foreach
	 // output error messages
	 if (!empty($error)) {
		 echo '<p><b>Error (admin.anjel.php-> line ' . __LINE__ . '):</b> Error adding new users to subscribers table. Database error: <br />' . $error . '</p>';
	 } // end if
 } // end if
 
 // switch by action
 $displaySubscriptions = true;
 switch ($action) {
	// user is a registered subscriber
	case ('registered') :
		// call registered
		$type = 'registered';
		$displaySubscriptions = registered();
		break;
	// user is an unregistered subscriber
	case ('unregistered') :
		$type = 'unregistered';
		// call unregistered
		$displaySubscriptions = unregistered();
		break;
	// user is an administrator performing administrative tasks
	case ('admin') :
		// call admin and check whether to show subscriptions
		$displaySubscriptions = admin();
		break;
	// letter
	case ('letter') :
		// don't show subscriptions
		$displaySubscriptions = false;
		// call letter
		letter();
		break;
	case ('log') :
		// log statistics
		$displaySubscriptions = false;
		logStatistics();
 } // end switch
 
 // show subscriptions
 if ($displaySubscriptions) {
	showSubscriptions(); 
 } // end if
 
 /** Shows the subscriptions for user
  * 
  * <p>Gets the subscriber's subscriptions from the database and displays a 
  * subscriptions form.</p>
  * 
  * @version 0.6.1
  * @since 0.4.3
  * @global class access to the database
  * @global int the user's id
  * @global string the action to be taken
  * @global string md5 of email to check if here from link in email
  * @global string the user type
  * @uses frontend_html::showSubscriptions()
  * @return boolean to show whether successfull or not
  */
 function showSubscriptions() {
	global $database, $userid, $action, $test, $type;
	
	// get subscriptions from database
	switch ($type) {
		case ('unregistered') :
			$query = 'SELECT M.* FROM `#__anjel_unregistered` AS M WHERE M.unregistered_id = \'' . $userid . '\'';
			break;
		case ('registered') :
			$query = 'SELECT N.name, N.email, M.* FROM `#__anjel_subscribers` AS M, `#__users` AS N WHERE N.id = M.subscriber_id AND M.subscriber_id = \'' . $userid . '\'';
			break;
		default :
			echo '<p align="center"><b>Error (anjel.php->showSubscriptions() line ' . __LINE__ . '):</b> Unknown subscriber type.<p>';
			break;
	} // end switch
	$database->setQuery($query);
	$database->loadObject($subscriptions);
	$error = $database->getErrorMsg();
	// get letters from database
	$query = 'SELECT `id`, `list_name`, `list_desc`, `hidden` FROM `#__anjel_letters`';
	$database->setQuery($query);
	$letters = $database->loadObjectList();
	$error .= $database->getErrorMsg();
	// if error, print error message and stop, else continue
	if ((!empty($error)) && (!empty($subscriptions))) {
		echo '<p align="center"><b>Error (anjel.php->showSubscriptions() line ' . __LINE__ . '):</b> Could not find subscriptions and/or letters. Database error : <br />' . $error . '</p>';
		return false;	
	} else {
		// check if blacklisted
		if ($subscriptions->blacklist != 0) {
			foreach ($letters as $letter) {
				$list_name = 'list_' . $letter->id;
				$subscriptions->$list_name = 0;
			} // end foreach
		} // end if
		// finally show subscriptions
		frontend_html :: showSubscriptions($userid, $action, $subscriptions, $letters, $test, $type);
		return true;	
	} // end if
 } // end function
 
 /**
  * Does registered subscriber functions by task
  * 
  * <p>It can update the user's subscriptions, register a user to the site, 
  * or login the user.</p>
  * 
  * @version 0.6.1
  * @since 0.4.3
  * @global class access to the database
  * @global int the user's id
  * @global string the task to be performed
  * @global string md5 of subscriber email
  * @uses updateRegisteredSubscriptions()
  * @uses frontend_html::registerForm()
  * @uses saveRegistration()
  * @uses frontend_html::showLogin()
  * @return boolean to check whether to display the subscriptions area
  */
 function registered() {
	 global $database, $userid, $task, $test;
 	 
	 // switch by task
	 switch ($task) {
		// update subscriptions 
		case ('updateSubscriptions') :
			$result = updateRegisteredSubscriptions($userid);
			// check if update was successful
			if ($result) {
				echo '<p>' . _UPDATED_SUCCESSFULLY . '</p>';
			} else {
				echo '<p align="center"><b>Error (anjel.php->registered() line ' . __LINE__ . '):</b> Error updating subscriptions.</p>';
				return false;
			} // end if
			return true;
		// show registration form
		case ('register') :
			// get letters
			$query = 'SELECT * FROM `#__anjel_letters` WHERE `hidden` = 0';
			$database->setQuery($query);
			$letters = $database->loadObjectList();
			$error = $database->getErrorMsg();
			// quit on error
			if (!empty($error)) {
				echo '<p align="center"><b>Error (anjel.html.php->registerForm() line 140): Could not load letters. Database error: <br />' . $error . '</p>';
			} else {
				frontend_html :: registerForm($letters);
			} // end if
			return false;
		// register new user to site and add subscriptions
		case ('doRegistration') :
			// register user to Joomla site
			$check = saveRegistration();
			// make sure user was registered
			if (!$check) {
				echo '<p align="center"><b>Error (anjel.php->registered() line ' . __LINE__ . '):</b> User not registered to Joomla site.</p>';
				return false;
			} else {
				// get user's id
				$username = mosGetParam($_REQUEST, 'username', '');
				$query = 'SELECT `id` FROM `#__users` WHERE `username` = \'' . $username . '\'';
				$database->setQuery($query);
				$userid = $database->loadRow();
				$error = $database->getErrorMsg();
				$userid = $userid[0];
				// add user to database
				$query = 'INSERT INTO `#__anjel_subscribers` (`subscriber_id`) VALUES (\'' . $userid . '\')';
				$database->setQuery($query);
				$database->query();
				$error .= $database->getErrorMsg();
				// quit on error
				if (!empty($error)) {
					echo '<p align="center"><b>Error (anjel.php->registered() line ' . __LINE__ . '):</b> Error adding user to database. Database error: <br />' . $error . '</p>';
					return false;
				} else {
					// get letters from database
					$query = 'SELECT `id` FROM `#__anjel_letters`';
					$database->setQuery($query);
					$letters = $database->loadObjectList();
					$error = $database->getErrorMsg();
					// quit on error
					if (!empty($error)) {
						echo '<p align="center"><b>Error (anjel.php->registered() line ' . __LINE__ . '):</b> Could not find letters. Database error : <br />' . $error . '</p>';
						return false;	
					} else {
						// set subscription details
						foreach ($letters as $letter) {
							// get the value of each of the newsletter values (yes or no)
							$letterid = $letter->id;
							$newvalue = mosGetParam( $_REQUEST, 'list_'.$letterid, 0 );
							$query = 'UPDATE `#__anjel_subscribers` SET `list_' . $letterid . '` = \'' . $newvalue . '\' WHERE subscriber_id= \'' . $userid . '\'';
							$database->setQuery($query);
							$database->query();
							$error .= $database->getErrorMsg();
						} // end foreach
						// quit on error
						if (!empty($error)) {
							echo '<p align="center"><b>Error (anjel.php->registered() line ' . __LINE__ . '):</b> Could not add subscriptions to database. Database error: <br />' . $error . '</p>';
							return false;
						} else {
							// set the receive html and subscribe date parameters
							$receivehtml = mosGetParam( $_POST, 'receivehtml', 0);
							$query = 'UPDATE `#__anjel_subscribers` SET `receive_html` = \'' . $receivehtml . '\', `subscribe_date` = NOW() WHERE `subscriber_id` = \'' . $userid . '\'';
							$database->setQuery($query);
							$database->query();
							$error = $database->getErrorMsg();
							// quit on error
							if (!empty($error)) {
								echo '<p align="center"><b>Error (anjel.php->registered() line ' .__LINE__ . '):</b> Could not set receive html in database. Database error: <br />' . $error . '</p>';
								return false;
							} else {
								echo "<p>" . _INFO_UPDATED_SUCCESSFULLY . "</p>";
							} // end if
						} // end if
					} // end if
				} // end if				
			} // end if
			return true;
		// show login form
		case ('login') :
			frontend_html :: showLogin();
			return false;
		// show unsubscribe confirmation
		case ('unsubscribe') :
			// show confirmation screen
			frontend_html :: confirmUnsubscribe($userid, 'registered', $test, 'registered');
			return false;
		// remove subscriber
		case ('remove') :
			$query = 'UPDATE `#__anjel_subscribers` SET `blacklist` = 1 WHERE `subscriber_id` = \'' . $userid . '\'';
			$database->setQuery($query);
			$database->query();
			$error = $database->getErrorMsg();
			// quit on error
			if (!empty($error)) {
				echo '<p align="center"><b>Error (anjel.php->registered() line ' . __LINE__ . '):</b> Error unsubscribing. Database error: <br />' . $error . '</p>';
				return false;
			} else {
				echo '<p>' . _UNSUBSCRIBE_SUBJECT . '</p>';
			} // end if
			return true;
		default :
			// make sure this is actually a registered subscriber
			if ($userid == 0) {
				return false;
			} else {
				return true;
			} // end if
	 } // end switch
 } // end function
 
 /** 
  * Does unregistered subscriber functions by task
  * 
  * <p>It can update the user's subscriptions, add an unregistered 
  * subscriber, confirm a subscriber, and show default options.</p>
  * 
  * @version 0.6.1
  * @since 0.4.3
  * @global class access to the database
  * @global int Itemid to help with the pathway
  * @global array configuration options
  * @global int the user's id
  * @global string the task to be performed
  * @global string md5 of email address to check if user clicked here from email
  * @global class access to mailing functions
  * @global class access to subscriber functions
  * @uses updateUnregisteredsubscriptions()
  * @uses frontend_html::newUnregistered()
  * @uses mailing::send()
  * @uses unregisteredCheck()
  * @uses subscribers::validEmail()
  * @return boolean to see whether to display the subscriptions area
  */
 function unregistered() {
	 global $database, $Itemid, $newsletterConfig, $userid, $task, $test, $mailing, $subscribers;
	 
	 $returnValue = true;
	 // switch by task
	 switch ($task) {
		 // update subscriptions
		 case ('updateSubscriptions') :
		 	$returnValue = unregisteredCheck();
			// make sure clicked on from email
			if ($returnValue) {
			 	$result = updateUnregisteredSubscriptions($userid);
				// check if update was successful
				if ($result) {
					echo '<p>' . _INFO_UPDATED_SUCCESSFULLY . '</p>';
				} else {
					echo '<p align="center"><b>Error (anjel.php->unregistered() line ' . __LINE__ . '):</b> Error updating subscriptions.</p>';
				} // end if
			} else {
				echo '<p>' . _CANNOTCHANGE . '</p>';	
			} // end if
			break;
		// new unregistered
		case ('newUnregistered') : 
			// get letters from database
			$query = 'SELECT `id`, `list_name`, `list_desc` FROM `#__anjel_letters` WHERE `hidden` = 0';
			$database->setQuery($query);
			$letters = $database->loadObjectList();
			$error = $database->getErrorMsg();
			// if error, print error message and stop, else continue
			if (!empty($error)) {
				echo '<p align="center"><b>Error (anjel.php->unregistered() line ' . __LINE__ . '):</b> Could not find letters. Database error : <br />' . $error . '</p>';	
			} else {
				// show form and don't show subscriptions
				frontend_html :: newUnregistered($letters);	
			} // end if
			return false;
		// add new unregistered subscriber
		case ('addUnregistered') :
			// check if unregistered users are allowed
			if ($newsletterConfig['allow_unregistered'] != 0) {
				// if so, get email address
				$email = mosGetParam($_REQUEST, 'email', '');
				// make sure email address was received
				if ($email == '') {
					echo '<p align="center"><b>Error (anjel.php->unregistered() line ' . __LINE__ . '):</b> Email address not received.</p>';
					return false;
				} else {
					// check if email is valid
					if (!$subscribers->validEmail($email)) {
						echo '<p>' . _EMAILINVALID . '</p>';
						return false;
					} else {
						// check if email already in database
						$query = 'SELECT * FROM `#__anjel_unregistered` WHERE `email` = \'' . $email . '\'';
						$database->setQuery($query);
						$database->loadObject($check);
						// quit if address in database
						if ((!empty($check)) && ($check->blacklist == 0)) {
							echo '<p>' . _EMAIL_ALREADY_REGISTERED . '</p>';
							return false;	
						} else {
							// add user to database
							$confirmed = $newsletterConfig['require_confirmation'] ? 0 : 1;
							if (!empty($check)) {
								$query = 'UPDATE `#__anjel_unregistered` SET `blacklist` = 0, `confirmed` = \'' . $confirmed . '\' WHERE `email` = \'' . $email . '\'';
							} else {
								$query = 'INSERT INTO `#__anjel_unregistered` (`email`, `subscribe_date`, `confirmed`) VALUES (\'' . $email . '\', NOW(), ' . $confirmed . ')';
							} // end if
							$database->setQuery($query);
							$database->query();
							$error = $database->getErrorMsg();
							// quit on error
							if (!empty($error)) {
								echo '<p align="center"><b>Error (anjel.php->unregistered() line ' . __LINE__ . '):</b> Could not insert new user into database. Database error: <br />' . $error . '</p>';
								return false;
							} else {
								// get user's new id
								if (!empty($check)) {
									$userid = $check->unregistered_id;
								} else {
									$query = 'SELECT LAST_INSERT_ID()';
									$database->setQuery($query);
									$userid = $database->loadResult();
								} // end if
								$result = updateUnregisteredSubscriptions($userid);
								// check if update was successful
								if ($result) {
									echo '<p>' . _UNREGISTEREDADDED . '</p>';
									if ($newsletterConfig['require_confirmation'] != 0) {
										echo '<p>' . _PLEASECONFIRM . '</p>';
										// get subscriber information
										$name = mosGetParam($_REQUEST, 'name', '');
										$receivehtml = mosGetParam($_REQUEST, 'receivehtml', 0);
										// create content
										$content = $newsletterConfig['confirm_text'];
										// create receivers array
										$receivers = array('subscribe');
										$receivers[1]->id = $userid;
										$receivers[1]->email = $email;
										$receivers[1]->name = $name;
										$receivers[1]->receive_html = $receivehtml;
										$receivers[1]->registered = 0;
										// send the confirm message
										$mailing->send(_WELCOME_SUBJECT, $content, $content, $receivers, $newsletterConfig['confirm_fromname'], $newsletterConfig['confirm_fromemail'], $newsletterConfig['confirm_return'], $newsletterConfig['confirm_html']);
									} // end if
									// update test
									$test = md5($email);
								} else {
									echo '<p align="center"><b>Error (anjel.php->unregistered() line ' . __LINE__ . '):</b> Error adding subscriber.</p>';
									return false;
								} // end if
							} // end if
						} // end if
					} // end if
				} // end if
			} else {
				// if not, display message
				echo '<p>' . _UNREGISTERED_OFF . '</p>';
				$returnValue = false;
			} // end if
			break;
		// confirm subscriber
		case ('confirm') :
			$returnValue = unregisteredCheck();
			// make sure clicked on from email
			if ($returnValue) {
				// update database to confirmed
				$query = 'UPDATE `#__anjel_unregistered` SET `confirmed` = 1 WHERE `unregistered_id` = \'' . $userid . '\'';
				$database->setQuery($query);
				$database->query();
				$error = $database->getErrorMsg();
				// quit on error
				if (!empty($error)) {
					echo '<p align="center"><b>Error (anjel.php->unregistered() line ' . __LINE__ . '):</b> Error confirming subscriptions in database. Database error: <br />' . $error . '</p>';
					return false;
				} else {
					echo '<p>' . _ACCOUNTCONFIRMED . '</p>';
				} // end if
			} else {
				echo '<p>' . _CANNOTCHANGE . '</p>';	
			}// end if
			break;
		// show unsubscribe confirmation
		case ('unsubscribe') :
			$returnValue = unregisteredCheck();
			// make sure clicked on from email
			if ($returnValue) {
				// show confirmation screen
				frontend_html :: confirmUnsubscribe($userid, 'unregistered', $test, 'unregistered');
			} else {
				echo '<p>' . _CANNOTCHANGE . '</p>';	
			}// end if
			$returnValue = false;
			break;
		// remove subscriber
		case ('remove') :
			$returnValue = unregisteredCheck();
			// make sure clicked through email
			if ($returnValue) {
				$query = 'UPDATE `#__anjel_unregistered` SET `blacklist` = 1 WHERE `unregistered_id` = \'' . $userid . '\'';
				$database->setQuery($query);
				$database->query();
				$error = $database->getErrorMsg();
				// quit on error
				if (!empty($error)) {
					echo '<p align="center"><b>Error (anjel.php->unregistered() line ' . __LINE__ . '):</b> Error unsubscribing. Database error: <br />' . $error . '</p>';
					return false;
				} else {
					echo '<p>' . _UNSUBSCRIBE_SUBJECT . '</p>';
				} // end if
			} else {
				echo '<p>' . _CANNOTCHANGE . '</p>';	
			} // end if
			break;
		// show options for unregistered user
		case ('showOptions') :
			// make links
			$options = explode('%', _REGISTERED_OPTIONS);
			$linkedOptions = $options[0] . '<a href="' . sefRelToAbs('index.php?option=com_anjel&Itemid=' . $Itemid . '&action=registered&task=login') . '">' . $options[1] . '</a>' . $options[2] . '<a href="' . sefRelToAbs('index.php?option=com_anjel&Itemid=' . $Itemid . '&action=registered&task=register') . '">' . $options[3] . '</a>' . $options[4];
			// display message
			echo '<div class="componentheading">' . _MODSUBSCRIBE . '</div>';
			echo '<p>' . _WELCOME_MESSAGE . '</p><p>' . $linkedOptions . '</p>';
			// display unregistered option if enabled
			if ($newsletterConfig['allow_unregistered'] == '1') {
				echo '<p>' . _ORUNREGISTERED . ' <a href="' . sefRelToAbs('index.php?option=com_anjel&Itemid=' . $Itemid . '&action=unregistered&task=newUnregistered') . '">' . _HERE . '</a></p>';
			} // end if
			$returnValue = false;
			break;
	 } // end switch
	 return $returnValue;
 } // end function
 
 /**
  * Does administrative functions on the frontend
  * 
  * <p>Gives options to create, publish, preview, and save newsletters, and 
  * also to view the archive for a list.</p>
  * 
  * @version 0.6.1
  * @since 0.4.3
  * @global class access to mailing functions
  * @global int Itemid to help with the pathway
  * @global int the user's id
  * @global string tells whether it is a registered ot unregistered user
  * @global string the task to be performed
  * @global int the list to be viewed
  * @global int the letter to be viewed
  * @global string md5 of email address
  * @global string the action to perform
  * @global class access to the database
  * @global object current user object
  * @uses mailing::getListData()
  * @uses mailing::getLetterData()
  * @uses mailing::getContentItems()
  * @uses frontend_html::createLetter()
  * @uses mailing::publish()
  * @uses mailing::save()
  * @uses frontend_html::previewMailing()
  * @return boolean whether to show subscriptions or not
  */
 function admin() {
	 global $mailing, $Itemid, $userid, $type, $task, $listid, $letterid, $test, $action, $database, $my;
	 
	 // check if user has adequate permissions
	 $permissions = checkPermissions($userid, $type, $listid);
	 if ($permissions < 2) {
	 	echo '<p>' . _NOT_AUTHORIZED . '</p>';
		return false;
	 } // end if
	 // get parameters
	 $senddate = mosGetParam($_REQUEST, 'senddate', 0);
	 // show subscriptions
	 $showSubscriptions = false;
	 // switch by task
	 switch ($task) {
		// create or edit a letter
	 	case ('edit') :
			// get layout for list
			$list_data = $mailing->getListData($listid);
			// get mailing items
			$list = $mailing->getLetterData($listid, $senddate, $new);
			// check if mailing is new
			if($new == 1) {
				$list->fromname = $list_data->sendername;
				$list->fromemail = $list_data->senderemail;
				$list->frombounce = $list_data->bounceadres;
			} // end if
			// show letter editing area
			frontend_html :: createLetter($userid, $listid, $permissions, $list_data, $list, $new, $type, $test);
			// trick editor
			if (!($my->id)) {
				$my->id = true;
			} // end if
			break;
		// publish a letter
		case ('publish') :
			$mailing->publish($listid);
			$action = $type;
			break;
		// preview a letter
		case ('preview') :
			// check if preview needs to be sent or if the preview options need to be displayed
			$emailaddress = mosGetParam($_REQUEST, 'emailaddress', '');
			if(!empty($emailaddress)){
				$check = $mailing->publish($listid, true);
				// see if mailing was sent successfully
				if ($check) {
					$returnMessage = _MESSAGESENTSUCCESSFULLY;
				} else {
					$returnMessage = _MESSAGENOT;
				} // end if
				echo '<p>' . $returnMessage . '</p>';
				$showSubscriptions = true;
				$action = $type;
			} else {
				$mailing->save($senddate);
				frontend_html :: previewMailing($listid, $senddate, $type, $userid, $test);
			} // end if
			break;
		// save a letter
		case ('save') :
			if ($mailing->save($senddate)) {
				echo '<p>' . _MAILINGSAVED . '</p>';
			} // end if
			// show the subscriptions
			$showSubscriptions = true;
			$action = $type;
			break;
		// show mailings to edit
		case ('show') :
			$query = 'SELECT * FROM `#__anjel_mailing` WHERE `list_id` = \'' . $listid . '\'';
			// check if subscriber is an admin
			if ($permissions != 3) {
				// if not, only get this publisher's mailings
				$query .= ' AND `subscriber_id` = \'' . $userid . '\'';
			} // end if
			$database->setQuery($query);
			$mailings = $database->loadObjectList();
			$error = $database->getErrorMsg();
			// quit on error
			if (!empty($error)) {
				echo '<p><b>Error (admin.anjel.php->mailing() line ' . __LINE__ . '):</b> Error getting mailings. Database error: <br />' . $error . '</p>';
			} else {
				frontend_html :: showMailings($userid, $listid, $type, $permissions, $mailings, $test);
			}// end if
			break;
	 } // end switch
	 return $showSubscriptions;
 } // end function
 
 /**
  * Does newsletter functions for the frontend
  * 
  * <p>Displays the archive options and archive mailings.</p>
  * 
  * @version 0.6.1
  * @since 0.4.3
  * @global int the user's id
  * @global string tells whether it is a registered ot unregistered user
  * @global string the task to be performed
  * @global int the list to be viewed
  * @global class access to the database
  * @global class access to mailing functions
  * @global string url to main site
  * @global object information about the currently logged in user
  * @global string md5 of email address
  * @global object the mambot object
  * @uses frontend_html::viewArchive()
  * @uses frontend_html::viewMailing()
  * @return boolean to tell if it was successful
  */
 function letter() {
	 global $userid, $type, $task, $listid, $database, $mailing, $mosConfig_live_site, $my, $test, $_MAMBOTS;
	 
	 // get and check permissions
	 $permissions = checkPermissions($userid, $type, $listid);
	 if (($permissions != 0) || ($my->id != '')) {
		 // switch by task
		 switch ($task) {
			 // view the archive
			 case ('viewarchive') :
			 	 $query = 'SELECT `send_date` as send_date, `list_subject` as list_subject FROM `#__anjel_mailing` WHERE `list_id` = \'' . $listid . '\'';
				 $database->setQuery($query);
				 $mailings = $database->loadObjectList();
				 $error = $database->getErrorMsg();
				 // quit on error
				 if (!empty($error)) {
					 echo '<p align="center"><b>Error (anjel.php->letter() line ' . __LINE__ . '):</b> Error getting mailings from database. Database error: <br />' . $error . '</p>';
					 return false;
				 } else {
					 // make sure we have an array
					 if (!is_array($mailings)) {
						 $mailings = array();
					 } // end if
					 frontend_html :: viewArchive($userid, $listid, $type, $permissions, $mailings, $test);
				 } // end if
				 break;
			 case ('view') :
			 	 $send_date = mosGetParam($_REQUEST, 'send_date', 0);
				 // make sure we have a send date
				 if ($send_date == 0) {
					 echo '<p align="center"><b>Error (anjel.php->letter() line ' . __LINE__ . '):</b> Error send date not found.</p>';
					 return false;
				 } else {
					 // get mailing from database
					 $query = 'SELECT * FROM `#__anjel_mailing` WHERE `list_id` = \'' . $listid . '\' AND `send_date` = \'' . $send_date . '\'';
					 $database->setQuery($query);
					 $database->loadObject($archivemailing);
					 $error = $database->getErrorMsg();
					 // quit on error
					 if (!empty($error)) {
						 echo '<p align="center"><b>Error (anjel.php->letter() line ' . __LINE__ . '):</b> Error getting mailing from database. Database error: <br />' . $error . '</p>';
						 return false;
					 } else {
						 // check if textonly is empty
						 if(!(strlen($archivemailing->list_textonly) > 0)) {
							 $archivemailing->list_textonly = $mailing->htmlToText($archivemailing->list_content);
						 } // end if
						 // run "transform all" bots
						 $_MAMBOTS->loadBotGroup('anjel');
						 $bot_results = $_MAMBOTS->trigger('bot_anjel_transform_all', array(&$archivemailing->list_content, &$archivemailing->list_textonly));
						 frontend_html :: viewMailing($archivemailing, $send_date);
					 } // end if
				 } // end if
				 break;
		 } // end switch
	 } else {
		 echo '<p>' . _NOT_AUTH . '</p>';
		 return false;
	 } // end if
	 return true;
 } // end function
 
 /**
  * Checks the permissions of a user
  * 
  * <p>Gets the user's permissions for the list.
  * 	<ul>
  * 		<li>0: No permissions</li>
  * 		<li>1: Subscribee</li>
  * 		<li>2: Publisher</li>
  * 		<li>3: Admin</li>
  * 	</ul>
  * </p>
  * 
  * @version 0.6.1
  * @since 0.4.3
  * @param int $userid the user's id
  * @param string $type tells whether registered or unregistered
  * @param int $listid the list for which to check
  * @global class access to the database
  * @return int permissions information
  */
 function checkPermissions($userid, $type, $listid) {
	 global $database;
	 
	 // get permissions from database
 	 switch ($type) {
		 case ('unregistered') :
			 $query = 'SELECT `list_' . $listid . '`, `blacklist` FROM `#__anjel_unregistered` WHERE `unregistered_id` = \'' . $userid . '\'';
			 break;
		 case ('registered') :
			 $query = 'SELECT `list_' . $listid . '`, `blacklist` FROM `#__anjel_subscribers` WHERE `subscriber_id` = \'' . $userid . '\'';
			 break;
		 default :
			 echo '<p align="center"><b>Error (anjel.php->checkPermissions() line ' . __LINE__ . '):</b> Unknown subscriber type.';
			 return 0;
	 } // end switch
	 $database->setQuery($query);
	 $permissions = $database->loadRow();
	 $error = $database->getErrorMsg();
	 // check for database error, quit if there is one, otherwise return permissions
	 if(!empty($error)) {
		 echo '<p align="center"><b>Error (anjel.php->checkPermissions() line ' . __LINE__ . '):</b> Could not get permissions. Database error: <br />' . $error . '</p>';
		 return 0;
	 } else {
		 return ($permissions[1] == 0) ? $permissions[0] : 0;
	 } // end if
 } // end function
 
 /**
  * Updates a registered users subscriptions
  * 
  * <p>Updates the database with the new subscription options.</p>
  * 
  * @version 0.6.1
  * @since 0.4.3
  * @param int $userid the user's id
  * @global class access to the database
  * @global class access to subscriber functions
  * @return boolean to tell whether it was successful or not
  */
 function updateRegisteredSubscriptions($userid) {
	 global $database, $subscribers;
	 
	 // get current subscriptions
	 $query = 'SELECT * FROM `#__anjel_subscribers` WHERE `subscriber_id` = \'' . $userid . '\'';
	 $database->setQuery($query);
	 $database->loadObject($current);
	 $error = $database->getErrorMsg();
	 // quit on error
	 if (!empty($error) || empty($current)) {
		 echo '<p align="center"><b>Error (anjel.php->updateRegisteredSubscriptions() line ' . __LINE__ . '):</b> Could not get current subscriptions. Database error: <br />' . $error . '</p>';
		 return false; 
	 } else {
		 // remove subscriber_id, receive_html, confirmed, subscribe_date
		 unset($current->subscriber_id, $current->receive_html, $current->confirmed, $current->subscribe_date);
		 // update subscriptions
		 foreach ($current as $key => $value) {
			 // update database
			 $newValue = mosGetParam($_REQUEST, $key, 0);
			 $query = 'UPDATE `#__anjel_subscribers` SET `' . $key . '` = \'' . $newValue . '\' WHERE `subscriber_id` = \'' . $userid . '\'';			 
			 $database->setQuery($query);
			 $database->query();
			 $error .= $database->getErrorMsg();			 
		 } // end foreach
		 // quit on error
		 if (!empty($error)) {
			 echo '<p align="center"><b>Error (anjel.php->updateRegisteredSubscriptions() line ' . __LINE__ . '):</b> Could not update subscriptions. Database error: <br />' . $error . '</p>';
			 return false;
		 } else {
			 // update name, email, and receive html
			 $newName = mosGetParam($_REQUEST, 'name', '');
			 $newEmail = mosGetParam($_REQUEST, 'email', '');
			 $newReceiveHtml = mosGetParam($_REQUEST, 'receivehtml', 0);
			 // check if email is valid
			 if (!$subscribers->validEmail($newEmail)) {
				 echo '<p>' . _EMAILINVALID . '</p>';
				 return false;
			 } else {
				 $query = 'UPDATE `#__users` SET `name` = \'' . $newName . '\', `email` = \'' . $newEmail . '\' WHERE `id` = \'' . $userid . '\'';
				 $database->setQuery($query);
				 $database->query();
				 $error = $database->getErrorMsg();
				 $query = 'UPDATE `#__anjel_subscribers` SET `receive_html` = \'' . $newReceiveHtml . '\', `blacklist` = 0 WHERE `subscriber_id` = \'' . $userid . '\'';
				 $database->setQuery($query);
				 $database->query();
				 $error .= $database->getErrorMsg();
				 // quit on error
				 if (!empty($error)) {
					echo '<p align="center"><b>Error (anjel.php->updateRegisteredSubscriptions() line ' . __LINE__ . '):</b> Could not update name, email, and/or receive html. Database error: <br />' . $error . '</p>';
					return false;				 
				 } else {
					return true; 
				 } // end if
			 } // end if
		 } // end if
	 } // end if	  
 } // end function
 
 /**
  * Updates an unregistered user's subscriptions
  * 
  * <p>Updates the database with the new subscription options.</p>
  * 
  * @version 0.6.1
  * @since 0.4.3
  * @param int $userid the user's id
  * @global class access to the database
  * @global class access to subscriber functions
  * @return boolean to tell whether it was successful
  */
 function updateUnregisteredSubscriptions($userid) {
	 global $database, $subscribers;
	 
	 // get current subscriptions
	 $query = 'SELECT * FROM `#__anjel_unregistered` WHERE `unregistered_id` = \'' . $userid . '\'';
	 $database->setQuery($query);
	 $database->loadObject($current);
	 $error = $database->getErrorMsg();
	 // quit on error
	 if (!empty($error)) {
		 echo '<p align="center"><b>Error (anjel.php->updateUnregisteredSubscriptions() line ' . __LINE__ . '):</b> Could not get current subscriptions. Database error: <br />' . $error . '</p>';
		 return false; 
	 } else {
		 // remove unregistered_id, receive_html, confirmed, subscribe_date
		 unset($current->unregistered_id, $current->receive_html, $current->confirmed, $current->subscribe_date);
		 // update subscriptions
		 foreach ($current as $key => $value) {
			 // update database
			 $newValue = mosGetParam($_REQUEST, $key, 0);
			 $query = 'UPDATE `#__anjel_unregistered` SET `' . $key . '` = \'' . $newValue . '\' WHERE `unregistered_id` = \'' . $userid . '\'';
			 $database->setQuery($query);
			 $database->query();
			 $error .= $database->getErrorMsg();			 
		 } // end for
		 // quit on error
		 if (!empty($error)) {
			 echo '<p align="center"><b>Error (anjel.php->updateUnregisteredSubscriptions() line ' . __LINE__ . '):</b> Could not update subscriptions. Database error: <br />' . $error . '</p>';
			 return false;
		 } else {
			 // update name, email, and receive html
			 $newName = mosGetParam($_REQUEST, 'name', '');
			 $newEmail = mosGetParam($_REQUEST, 'email', '');
			 $newReceiveHtml = mosGetParam($_REQUEST, 'receivehtml', 0);
			 // check if email is valid
			 if (!$subscribers->validEmail($newEmail)) {
				 echo '<p>' . _EMAILINVALID . '</p>';
				 return false;
			 } else {
				 $query = 'UPDATE `#__anjel_unregistered` SET `name` = \'' . $newName . '\', `email` = \'' . $newEmail . '\', `receive_html` = \'' . $newReceiveHtml . '\', `blacklist` = 0 WHERE `unregistered_id` = \'' . $userid . '\'';
				 $database->setQuery($query);
				 $database->query();
				 $error = $database->getErrorMsg();
				 // quit on error
				 if (!empty($error)) {
					echo '<p align="center"><b>Error (anjel.php->updateUnregisteredSubscriptions() line ' . __LINE__ . '):</b> Could not update name, email, and/or receive html. Database error: <br />' . $error . '</p>';
					return false;				 
				 } else {
					return true; 
				 } // end if
			 } // end if
		 } // end if
	 } // end if	  
 } // end function
 
 /**
  * Registers a new user to Joomla
  * 
  * <p>Updates the database with the new user's information.</p>
  * 
  * @version 0.4.3
  * @since 0.4.3
  * @global class access to the database
  * @global class access to group control information
  * @global string the site's name
  * @global string url to the main site directory
  * @global string check to see whether to use user activation
  * @global string check if user registration is allowed
  * @global string the mail from address
  * @global string the mail from name
  * @return boolean whether it was successful or not
  */
 function saveRegistration() {
	global $database, $acl;
	global $mosConfig_sitename, $mosConfig_live_site, $mosConfig_useractivation, $mosConfig_allowUserRegistration;
	global $mosConfig_mailfrom, $mosConfig_fromname;
	
	if ($mosConfig_allowUserRegistration=="0") {
		mosNotAuth();
		return false;
	} // end if

	$row = new mosUser( $database );

	if (!$row->bind( $_POST, "usertype" )) {
		echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";
		exit();
	} // end if

	mosMakeHtmlSafe($row);

	$row->id = 0;
	$row->usertype = '';
	$row->gid = $acl->get_group_id('Registered','ARO');

	if ($mosConfig_useractivation=="1") {
		$row->activation = md5( mosMakePassword() );
		$row->block = "1";
	} // end if

	if (!$row->check()) {
		echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";
		exit();
	} // end if

	$pwd = $row->password;
	$row->password = md5( $row->password );
	$row->registerDate = date("Y-m-d H:i:s");

	if (!$row->store()) {
		echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";
		exit();
	} // end if
	$row->checkin();

	$name = $row->name;
	$email = $row->email;
	$username = $row->username;

	$subject = sprintf (_SEND_SUB, $name, $mosConfig_sitename);
	$subject = html_entity_decode($subject, ENT_QUOTES);
	if ($mosConfig_useractivation=="1"){
		$message = sprintf (_USEND_MSG_ACTIVATE, $name, $mosConfig_sitename, $mosConfig_live_site."/index.php?option=com_registration&task=activate&activation=".$row->activation, $mosConfig_live_site, $username, $pwd);
	} else {
		$message = sprintf (_USEND_MSG, $name, $mosConfig_sitename, $mosConfig_live_site);
	} // end if

	$message = html_entity_decode($message, ENT_QUOTES);
	// Send email to user
	if ($mosConfig_mailfrom != "" && $mosConfig_fromname != "") {
		$adminName2 = $mosConfig_fromname;
		$adminEmail2 = $mosConfig_mailfrom;
	} else {
		$database->setQuery( "SELECT name, email FROM #__users"
		."\n WHERE usertype='superadministrator'" );
		$rows = $database->loadObjectList();
		$row2 = $rows[0];
		$adminName2 = $row2->name;
		$adminEmail2 = $row2->email;
	} // end if

	mosMail($adminEmail2, $adminName2, $email, $subject, $message);

	// Send notification to all administrators
	$subject2 = sprintf (_SEND_SUB, $name, $mosConfig_sitename);
	$message2 = sprintf (_ASEND_MSG, $adminName2, $mosConfig_sitename, $row->name, $email, $username);
	$subject2 = html_entity_decode($subject2, ENT_QUOTES);
	$message2 = html_entity_decode($message2, ENT_QUOTES);

	// get superadministrators id
	$admins = $acl->get_group_objects( 25, 'ARO' );

	foreach ( $admins['users'] AS $id ) {
		$database->setQuery( "SELECT email, sendEmail FROM #__users"
			."\n WHERE id='$id'" );
		$rows = $database->loadObjectList();

		$row = $rows[0];

		if ($row->sendEmail) {
			mosMail($adminEmail2, $adminName2, $row->email, $subject2, $message2);
		} // end if
	} // end foreach

	if ( $mosConfig_useractivation == "1" ){
		echo _REG_COMPLETE_ACTIVATE;
	} else {
		echo _REG_COMPLETE;
	} // end if
	return true;
 } // end function
 
 /**
  * Check unregistered subscriber
  * 
  * <p>Makes sure user clicked on link from email, just subscribed for the 
  * first time, or is going to subscribe.</p>
  * 
  * @version 0.4.10
  * @since 0.4.3
  * @global class access to the database
  * @global int the user's id
  * @global string md5 of email address
  * @return boolean to tell whether it was successful
  */ 
 function unregisteredCheck() {
	 global $database, $userid, $test;
	 
 	 $query = 'SELECT * FROM `#__anjel_unregistered` WHERE md5(`email`) = \'' . $test . '\' AND `unregistered_id` = \'' . $userid . '\'';
	 $database->setQuery($query);
	 $check = $database->loadRow();
	 $error = $database->getErrorMsg();
	 if (count($check) < 5) {
		return false; 
	 } else {		
		return true; 
	 } // end if
 } // end function
 
 /**
  * Log statistics
  * 
  * <p>Updates the database with the new statistics and outputs an empty 
  * png file.</p>
  * 
  * @version 0.4.3
  * @since 0.4.3
  * @global int the list to work with
  * @global class access to the database
  * @global string filesystem path to main site directory
  * @global string tells whether this is a registered or unregistered user
  */
 function logStatistics() {
	 global $listid, $database, $mosConfig_absolute_path, $type;
	 
	 // get parameters
	 $senddate = mosGetParam($_REQUEST, 'senddate', 0);
	 $subscriber = mosGetParam($_REQUEST, 'subscriber', 0);
	 // check if the subscriber was provided
	 if ($subscriber != 0) {
		 // if so, log detailed statistics
		 // switch by type
		 switch ($type) {
			 case ('unregistered') :
			 	 $query = 'REPLACE INTO `#__anjel_stats_detailed_unregistered` (`listid`, `send_date`, `subscriber_id`, `html`, `read`) VALUES (\'' . $listid . '\', \'' . $senddate . '\', \'' . $subscriber . '\', \'1\', \'1\')';
			 	 break;
			 case ('registered') :
			 	 $query = 'REPLACE INTO `#__anjel_stats_detailed` (`listid`, `send_date`, `subscriber_id`, `html`, `read`) VALUES (\'' . $listid . '\', \'' . $senddate . '\', \'' . $subscriber . '\', \'1\', \'1\')';
				 break;
		 } // end switch
		 $database->setQuery($query);
		 $database->query();
	 } // end if
	 // log views into global table
	 $query = 'UPDATE `#__anjel_stats_overall` SET `html_read` = `html_read` + 1 WHERE `listid` = \'' . $listid . '\' AND `send_date` = \'' . $senddate . '\'';
	 $database->setQuery($query);
	 $database->query();
	 // clear all output
	 ob_end_clean();
	 // open image file
	 $filename = $mosConfig_absolute_path . '/images/blank.png';
	 $handle = fopen($filename, 'r');
	 // get image contents
	 $contents = fread($handle, filesize($filename));
	 // close image file
	 fclose($handle);
	 // output content type
	 header("Content-type: image/png");
	 // print image
	 echo $contents;
	 // exit
	 exit();
 } // end function
 
 /**
  * Check registered subscriber
  * 
  * <p>Makes sure user clicked on link from email.</p>
  * 
  * @version 0.4.10
  * @since 0.4.10
  * @global class access to the database
  * @global int the user's id
  * @global string md5 of email address
  * @return boolean to tell whether it was successful
  */ 
 function registeredCheck() {
	 global $database, $userid, $test;
	 
 	 $query = 'SELECT * FROM `#__users` WHERE md5(`email`) = \'' . $test . '\' AND `id` = \'' . $userid . '\'';
	 $database->setQuery($query);
	 $check = $database->loadRow();
	 $error = $database->getErrorMsg();
	 if (count($check) < 5) {
		return false; 
	 } else {		
		return true; 
	 } // end if
 } // end function
 
 /**
  * Uses the sefRelToAbs function and prepends the site url if needed
  * 
  * @version 0.6.1
  * @since 0.6.1
  * @param string $url the url to be sef'd
  * @global string url of the main site
  * @return string the updated url
  */
 function anjel_sef_rel_to_abs($url) {
	 global $mosConfig_live_site;
	 
	 $result = sefRelToAbs($url);
	 $result = str_replace($mosConfig_live_site . '/' . $mosConfig_live_site, $mosConfig_live_site, $mosConfig_live_site . '/' . $result);
	 return $result;
 } // end function
 
 // show footer if enabled
 if ($newsletterConfig['show_footer'] == 1) {
	echo '<p align="center"><a href="http://anjel.schmalls.com">ANJEL 0.6.1-final</a> component by <a href="mailto:schmalls+hide@address.com">Schmalls</a></p>'; 
 } // end if
 
?>
Return current item: ANJEL