Location: PHPKode > projects > Katyshop > katyshop_ro_0.3.2.1/classes/logic/ContactMessage.php
<?php

/**
 * Product: Katyshop
 * @version 0.3.2.1
 * @author Catalin Hulea - hide@address.com
 * @copyright Copyright (C) 2007 Catalin Hulea
 * @license GNU General Public License version 3
 * 			You can find a copy of GNU GPL v3 at this path: /docs/LICENSE
 * @link https://sourceforge.net/projects/katyshop
 *
 * 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 3 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, see <http://www.gnu.org/licenses/>.
 *
 */

class ContactMessage extends LogicObject
{
	var $id = 0;
	var $id_user = 0;
	var $user_details = "";

	var $sender_name = "";
	var $sender_email = "";
	var $subject = "";
	var $message = "";
	var $date_sent = "";

	function ContactMessage()
	{
		$this->date_sent = date("Y-m-d H:i:s");
	}

	function getInstanceProps($myClass = "")
	{
		if(empty($myClass))
			$myClass = __CLASS__;
		return parent::getInstanceProps($myClass);
	}

	function validate()
	{
		$errors = array();
		if(strlen($this->sender_name) < 3 || strlen($this->sender_name) > 255)
			$errors[] = "Numele trebuie sa aiba intre 3 si 255 caractere";
		if(strlen($this->sender_email) < 3 || strlen($this->sender_email) > 255)
			$errors[] = "Adresa de email trebuie sa aiba intre 3 si 255 caractere";
		if(!Tools::validateEmail($this->sender_email))
			$errors[] = "Adresa de email nu este valida";
		if(strlen($this->subject) < 3 || strlen($this->subject) > 255)
			$errors[] = "Subiectul trebuie sa aiba intre 3 si 255 caractere";
		if(strlen($this->message) < 3 || strlen($this->message) > 1000)
			$errors[] = "Mesajul trebuie sa aiba intre 3 si 1000 caractere";

		Application::appendErrors($errors);
		return (count($errors) == 0);
	}
}

?>
Return current item: Katyshop