| 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
/**
* Youtube Gallery Joomla! 1.5 Native Component
* @version 3.8.3
* @author Design COmpass corp <support@joomlaboat.com>
* @link http://www.joomlaboat.com
* @GNU General Public License
**/
// no direct access
defined('_JEXEC') or die('Restricted access');
// Import Joomla! libraries
jimport('joomla.application.component.model');
class YouTubeGalleryModelLinksForm extends JModel
{
function __construct()
{
parent::__construct();
$array = JRequest::getVar('cid', 0, '', 'array');
$this->setId((int)$array[0]);
}
function setId($id)
{
// Set id and wipe data
$this->_id = $id;
$this->_data = null;
}
function &getData()
{
$row =& $this->getTable();
$row->load( $this->_id );
return $row;
}
function store()
{
$row =& $this->getTable();
// consume the post data with allow_html
$data = JRequest::get( 'post',JREQUEST_ALLOWRAW);
$post = array();
if (!$row->bind($data))
{
return false;
}
// Make sure the record is valid
if (!$row->check())
{
return false;
}
if($row->id!=0)
{
require_once(JPATH_SITE.DS.'components'.DS.'com_youtubegallery'.DS.'includes'.DS.'misc.php');
$misc=new YouTubeGalleryMisc;
$misc->videolist_row = $row;
$misc->update_cache_table($row,false);
$row->lastplaylistupdate =date( 'Y-m-d H:i:s');
}
// Store
if (!$row->store())
{
return false;
}
if($row->id>0)
{
require_once(JPATH_SITE.DS.'components'.DS.'com_youtubegallery'.DS.'includes'.DS.'misc.php');
$this->RefreshPlaylistRow($row);
}
//Create MySQL Table
$db = $this->getDBO();
return true;
}
function RefreshPlaylist($cids,$update_videolist=true)
{
$where=array();
foreach($cids as $cid)
$where[]= 'id='.$cid;
require_once(JPATH_SITE.DS.'components'.DS.'com_youtubegallery'.DS.'includes'.DS.'misc.php');
// Create a new query object.
$db = JFactory::getDBO();
$query='SELECT * FROM `#__youtubegallery_videolists`';
if(count($where)>0)
$query.=' WHERE '.implode(' OR ',$where);
$db->setQuery($query);
if (!$db->query()) die( $db->stderr());
$linksform_rows=$db->loadObjectList();
if(count($linksform_rows)<1)
return false;
$getinfomethod=YouTubeGalleryMisc::getSettingValue('getinfomethod');
foreach($linksform_rows as $linksform_row)
$this->RefreshPlaylistRow($linksform_row,$getinfomethod,$update_videolist);
return true;
}
function RefreshPlaylistRow($linksform_row,$getinfomethod,$update_videolist)
{
$misc=new YouTubeGalleryMisc;
$misc->videolist_row = &$linksform_row;
$misc->update_cache_table($linksform_row,$update_videolist); //false - refresh
if(!$update_videolist)
{
$db = JFactory::getDBO();
$query='UPDATE #__youtubegallery_videolists SET `lastplaylistupdate`="'.date( 'Y-m-d H:i:s').'" WHERE `id`='.$linksform_row->id;
$db->setQuery($query);
if (!$db->query()) die( $db->stderr());
if($getinfomethod=='js' or $getinfomethod=='jsmanual')
$query='UPDATE #__youtubegallery_videos SET `lastupdate`="0000-00-00 00:00:00", `rawdata`="*youtubegallery_request*" WHERE `isvideo` AND `listid`='.$linksform_row->id;
else
$query='UPDATE #__youtubegallery_videos SET `lastupdate`="0000-00-00 00:00:00", `rawdata`="" WHERE `isvideo` AND `listid`='.$linksform_row->id;
$db->setQuery($query);
if (!$db->query()) die( $db->stderr());
}
}
function ConfirmRemove()
{
JRequest::setVar('hidemainmenu', true);
JToolBarHelper::title(JText::_( 'Youtube Gallery - Delete Video List(s)' ));
$cancellink='index.php?option=com_youtubegallery&controller=linkslist';
$cid = JRequest::getVar( 'cid', array(), 'post', 'array' );
//Get Table Name
$cids = JRequest::getVar( 'cid', array(0), 'post', 'array' );
if (count( $cids ))
{
echo '<p style="font-size:20px;">Video List(s) ID: '.(count($cids)>1 ? implode(',',$cids) : $cids[0] ).'<br/><br/><a href="'.$cancellink.'">No. Cancel.</a></p>
';
echo '
<form action="index.php?option=com_youtubegallery&controller=linkslist" method="post" >
<input type="hidden" name="task" value="remove_confirmed" />
';
$i=0;
foreach($cids as $cid)
{
echo '<input type="hidden" id="cid'.$i.'" name="cid[]" value="'.$cid.'">';
}
echo '
<input type="submit" value="'.JText::_( 'Yes. I want to delete.' ).'" class="button" />
</form>
';
}
else
{
echo '<p><a href="'.$cancellink.'">Select items first</a></p>';
}
}
function delete($cids)
{
$db = & JFactory::getDBO();
$row =& $this->getTable();
if (count( $cids ))
{
foreach($cids as $cid)
{
$query='DELETE FROM `#__youtubegallery_videos` WHERE `listid`='.(int)$cid;
$db->setQuery($query);
if (!$db->query()) die( $db->stderr());
if (!$row->delete( $cid ))
return false;
}
}
return true;
}
function copyItem($cid)
{
$item =& $this->getTable();
foreach( $cid as $id )
{
//echo 'id='.$id.'<br/>';
//die;
$item->load( $id );
$item->id = 0;
$old_title=$item->listname;
$new_title='Copy of '.$old_title;
$item->listname = $new_title;
if (!$item->check()) {
return false;
}
if (!$item->store()) {
return false;
}
//echo 'saved';
//die;
$item->checkin();
}
return true;
}
}
?>