Your IP : 216.73.216.240


Current Path : /home/juvelize/www/libraries/tsgrabber/
Upload File :
Current File : /home/juvelize/www/libraries/tsgrabber/settings.php

<?php
/*
 * TsGrabber - Grabber RSS feeds/Грабер RSS-лент.
 * Site/Сайт: http://tsiba.net
 * E-mail/Э-почта: info@tsiba.net
 * © 2012 tsiba.net
 */
?>
<?php
// Check to ensure this file is within the rest of the framework
defined('JPATH_BASE') or die();

class TSSettings extends JObject {
    
	public $update;
	public $minutes;
	public $block;
	public $lastupdate;
	public $updatefeeds;
	
	
	function __construct($identifier = 0)
	{
		$this->load($identifier);
	}
	
	public function load($id)
	{
		$db =& JFactory::getDBO();
		$query = "SELECT * FROM #__tsgrabber_settings WHERE 1";
		$db->setQuery($query);
		list($rec) = $db->loadObjectList();
		
                $this->update = $rec->update;
                $this->minutes = $rec->minutes;
		$this->block = $rec->block;
		$this->lastupdate = $rec->lastupdate;
		$this->updatefeeds = $rec->updatefeeds;
                
	}
	
	public function save()
	{
		$db =& JFactory::getDBO();

                $query = "DELETE FROM #__tsgrabber_settings WHERE 1";

		$db->setQuery($query);
                $db->query();
                
		$query = 'INSERT INTO';
		
		$query .= ' `#__tsgrabber_settings` SET'
			. " `update` = '{$db->getEscaped($this->update)}', "
			. " `minutes` = '{$db->getEscaped($this->minutes)}', "
			. " `block` = '{$db->getEscaped($this->block)}', "
			. " `lastupdate` = '{$db->getEscaped($this->lastupdate)}',"
			. " `updatefeeds` = '{$db->getEscaped($this->updatefeeds)}'";
			
		$db->setQuery($query);
		
		if (!$db->query()) {
			return false;
		}
		

		return true;
	}
	
	public function bind($data)
	{
		$this->name 	= $data['name'];
                $this->update = $data['update'];
                $this->minutes = $data['minutes'];
		$this->block = ($data['block']=='on') ? "1" : "0";
                if($data['lastupdate']==''){
                    $this->lastupdate = $this->lastupdate;
                }else{
                    $this->lastupdate = $data['lastupdate'];
                }
                if($data['updatefeeds']==''){
                    $this->updatefeeds = $this->updatefeeds;
                }else{
                    $this->updatefeeds = $data['updatefeeds'];
                }
                              

	}
	
}