Location: PHPKode > projects > Kwalbum > kwalbum/pages/AddDescriptionItemPage.php
<?php
/**
 * @version 2.1.1
 * @package kwalbum
 * @since 2.0 2008-09-10
 */
require_once 'include/IPage.php';

class AddDescriptionItemPage implements IPage
{
	private $msg;

	function GetHead(& $title)
	{
		if (!USER_CAN_ADD)
			return null;
		global $URLP, $DB, $P;

		if (!empty($P['words']))
		{
			require_once('include/ItemAdder.php');
			$IA = new ItemAdder();

			$hidden = (int)$P['hidden'];
			if (!USER_IS_ADMIN)
				$max = 2;
			else
				$max = 3;
			if ($hidden > $max or $hidden < 0)
				$hidden = 0;
			$location = $DB->FilterString($P['loc']);
			if (empty($location))
				$location = 'unknown location';
			$location = trim($location);
			$tags = trim($DB->FilterString($P['tags']));
			$words = $DB->FilterString($P['words'], true);
			if ($IA->AddItem('', '', $location, $tags, date('Y-m-d H:i:s'), $hidden, $words))
				$this->msg = 'Added successfully.';

		}
		$title = 'Add Description Item';
		return '<script type="text/javascript" language="javascript" SRC="ajax/scriptaculous/prototype.js"></script>'.
				'<script type="text/javascript" language="javascript" src="ajax/scriptaculous/scriptaculous.js"></script>'.
				'<link href="styles/edit.css" rel="stylesheet" type="text/css" />';
	}

	function ShowBody()
	{
		if (!USER_CAN_ADD)
			return null;
		global $URLP;

		require 'AddDescriptionItemPage.html.php';
	}

	private function GetUserName()
	{
		global $DB;
		$query = "SELECT UserTitle FROM ".USER_TABLE.
		" WHERE UserId=".USER_ID;
		$result = $DB->Query($query);
		$row = $result->fetch_array();
		return $row[0];
	}
}
?>
Return current item: Kwalbum