Your IP : 216.73.216.54


Current Path : /var/www/html/components/com_jvld/models/
Upload File :
Current File : /var/www/html/components/com_jvld/models/advertise.php

<?php
/**
 * @version		$Id$
 * @package		JV-LinkDirectory
 * @subpackage	com_jvld
 * @copyright	Copyright 2008-2013 JV-Extensions. All rights reserved
 * @license		GNU General Public License version 3 or later
 * @author		JV-Extensions
 * @link		http://www.jv-extensions.com
 */

// No direct access
defined('_JEXEC') or die('Restricted access');

class JvldModelAdvertise extends JvldFendModel
{
	public function getForm($data = array(), $loadData = true)
	{
		$form = $this->loadForm('com_jvld.advertise', 'advertise', array('control' => 'jform', 'load_data' => $loadData), true);
		if (empty($form))
			return false;

		return $form;
	}

	public function getItem()
	{
		$revid = JFactory::getApplication()->input->getInt('revid', 0);
		$revrec = JvldDb::getRow("select * from #__jvld_revenue where id = ".(int)$revid);
		return JvldDb::getRow("select * from #__jvld_ads where refid = '".JvldSecure::defendSQL($revrec->refid)."' and custemail = '".JvldSecure::defendSQL($revrec->payer_email)."'");
	}

	protected function loadFormData()
	{
		return $this->getItem();
	}

	public function process()
	{
		try
		{
			parent::preProcess();

			$refid = JvldDb::getValue("select refid from #__jvld_ads where id = ".(int)$this->id);
			JvldDb::update("update #__jvld_ads set custadcode = '".JvldSecure::defendSQL($this->custadcode)."', status = "._JVLD_AD_PENDING_APPROVAL." where id = ".(int)$this->id);

			$em = new JvldEmail('FNA_PAID_ADVERTISE_PENDING_APPROVAL');
			$em->setTag('{REFID}', $refid);
			$em->send($this->cfg->get('site_email'));

			JvldMsg::display(JText::_("COM_JVLD_ADVERTISE_UPDATE_DONE"));
			return;
		}
		catch (Exception $ex)
		{
			JvldMsg::display($ex->getMessage(), _JVLD_NEXT_PAGE_GO_BACK);
			return;
		}
	}
}
?>