| Server IP : 180.180.241.3 / Your IP : 216.73.216.216 Web Server : Microsoft-IIS/7.5 System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586 User : IUSR ( 0) PHP Version : 5.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/AppServ/www/news/administrator/components/com_youtubegallery/models/ |
Upload File : |
<?php
/**
* YoutubeGallery Joomla! 1.5 Native Component
* @version 3.8.3
* @author DesignCompass corp< <support@joomlaboat.com>
* @link http://www.joomlaboat.com
* @GNU General Public License
**/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla modelform library
jimport('joomla.application.component.model');
if(!defined('DS'))
define('DS',DIRECTORY_SEPARATOR);
/**
* YoutubeGallery - Settings Model
*/
class YoutubeGalleryModelSettings extends JModel
{
/**
* Returns a reference to the a Table object, always creating it.
*
* @param type The table type to instantiate
* @param string A prefix for the table class name. Optional.
* @param array Configuration array for model. Optional.
* @return JTable A database object
*/
public $id;
public function getTable($type = 'Settings', $prefix = 'YoutubeGalleryTable', $config = array())
{
return JTable::getInstance($type, $prefix, $config);
}
/**
* Method to get the record form.
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @return mixed A JForm object on success, false on failure
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_youtubegallery.settings', 'settings', array('control' => 'jform', 'load_data' => $loadData)); //$loadData
if (empty($form))
{
return false;
}
return $form;
}
/**
* Method to get the script that have to be included on the form
*
* @return string Script files
*/
/*
public function getScript()
{
return 'administrator/components/com_youtubegallery/models/forms/linksform.js';
}
*/
/**
* Method to get the data that should be injected in the form.
*
* @return mixed The data for the form.
*/
/*
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = JFactory::getApplication()->getUserState('com_youtubegallery.edit.linksform.data', array());
if (empty($data))
{
$data = $this->getItem();
}
return $data;
}
*/
static protected function makeQueryLine($field,$value)
{
return 'INSERT INTO `#__youtubegallery_settings` (`option`, `value`)
VALUES ("'.$field.'", "'.$value.'")
ON DUPLICATE KEY UPDATE `option`="'.$field.'", `value`="'.$value.'"';
}
function store()
{
$allowsef=JRequest::getInt('allowsef');
$getinfomethod=JRequest::getCmd('getinfomethod');
$vimeo_api_client_id=trim(preg_replace("/[^a-zA-Z0-9_]/", "", JRequest::getVar('vimeo_api_client_id')));
$vimeo_api_client_secret=trim(preg_replace("/[^a-zA-Z0-9_]/", "", JRequest::getVar('vimeo_api_client_secret')));
$soundcloud_api_client_id=trim(preg_replace("/[^a-zA-Z0-9_]/", "", JRequest::getVar('soundcloud_api_client_id')));
$soundcloud_api_client_secret=trim(preg_replace("/[^a-zA-Z0-9_]/", "", JRequest::getVar('soundcloud_api_client_secret')));
$db = JFactory::getDBO();
$query=array();
$query[] = YoutubeGalleryModelSettings::makeQueryLine('allowsef',$allowsef);
$query[] = YoutubeGalleryModelSettings::makeQueryLine('getinfomethod',$getinfomethod);
$query[] = YoutubeGalleryModelSettings::makeQueryLine('vimeo_api_client_id',$vimeo_api_client_id);
$query[] = YoutubeGalleryModelSettings::makeQueryLine('vimeo_api_client_secret',$vimeo_api_client_secret);
$query[] = YoutubeGalleryModelSettings::makeQueryLine('soundcloud_api_client_id',$soundcloud_api_client_id);
$query[] = YoutubeGalleryModelSettings::makeQueryLine('soundcloud_api_client_secret',$soundcloud_api_client_secret);
foreach($query as $q)
{
$db->setQuery($q);
if (!$db->query()) die ( $db->stderr());
}
return true;
}
}