| Server IP : 180.180.241.3 / Your IP : 216.73.216.25 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/plugins/content/ |
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
**/
defined('_JEXEC') or die('Restricted access');
$mainframe->registerEvent('onPrepareContent', 'plgContentYouTubeGallery');
function plgContentYouTubeGallery(&$row, &$params, $page=0)
{
if (is_object($row)) {
plgYouTubeGallery($row->text, $params);
plgYouTubeGalleryByID($row->text, $params);
}
else
{
plgYouTubeGallery($row, $params);
plgYouTubeGalleryByID($row, $params);
}
}
///////////////////
function plgYouTubeGallery(&$text, &$params)
{
$yg=new YouTubeGalleryClass;
$options=array();
$fList=$yg->getListToReplace('youtubegallery',$options,$text);
if(count($fList)>0)
{
require_once(JPATH_SITE.DS.'components'.DS.'com_youtubegallery'.DS.'includes'.DS.'misc.php');
require_once(JPATH_SITE.DS.'components'.DS.'com_youtubegallery'.DS.'includes'.DS.'render.php');
}
for($i=0; $i<count($fList);$i++)
{
$replaceWith=$yg->getYouTubeGallery($options[$i],$i,false);
$text=str_replace($fList[$i],$replaceWith,$text);
}
return true;
}
function plgYouTubeGalleryByID(&$text, &$params)
{
$yg=new YouTubeGalleryClass;
$options=array();
$fList=$yg->getListToReplace('youtubegalleryid',$options,$text);
if(count($fList)>0)
{
require_once(JPATH_SITE.DS.'components'.DS.'com_youtubegallery'.DS.'includes'.DS.'misc.php');
require_once(JPATH_SITE.DS.'components'.DS.'com_youtubegallery'.DS.'includes'.DS.'render.php');
}
for($i=0; $i<count($fList);$i++)
{
$replaceWith=$yg->getYouTubeGallery($options[$i],$i,true);
$text=str_replace($fList[$i],$replaceWith,$text);
}
return true;
}
class YouTubeGalleryClass
{
function getListToReplace($par,&$options,&$text)
{
$fList=array();
$l=strlen($par)+2;
$offset=0;
do{
if($offset>=strlen($text))
break;
$ps=strpos($text, '{'.$par.'=', $offset);
if($ps===false)
break;
if($ps+$l>=strlen($text))
break;
$pe=strpos($text, '}', $ps+$l);
if($pe===false)
break;
$notestr=substr($text,$ps,$pe-$ps+1);
$options[]=substr($text,$ps+$l,$pe-$ps-$l);
$fList[]=$notestr;
$offset=$ps+$l;
}while(!($pe===false));
return $fList;
}
function getYoutubeGallery($galleryparams,$count,$byId)
{
$result='';
$opt=explode(',',$galleryparams);
if(count($opt)<2)
return '<p>YoutubeGallery Theme Not Set</p>';
$db = & JFactory::getDBO();
if($byId)
{
$listid=(int)$opt[0];
$themeid=(int)$opt[1];
$query_list = 'SELECT * FROM #__youtubegallery_videolists WHERE id='.$listid.' LIMIT 1';
$query_theme = 'SELECT * FROM #__youtubegallery_themes WHERE id='.$themeid.' LIMIT 1';
}
else
{
$listname=trim($opt[0]);
$themename=trim($opt[1]);
$query_list = 'SELECT * FROM #__youtubegallery_videolists WHERE listname="'.$listname.'" LIMIT 1';
$query_theme = 'SELECT * FROM #__youtubegallery_themes WHERE themename="'.$themename.'" LIMIT 1';
}
//Video List data
$db->setQuery($query_list);
if (!$db->query()) die ( $db->stderr());
$videolist_rows = $db->loadObjectList();
if(count($videolist_rows)==0)
return '<p>Video list not found</p>';
$videolist_row=$videolist_rows[0];
//Theme data
$db->setQuery($query_theme);
if (!$db->query()) die ( $db->stderr());
$theme_rows = $db->loadObjectList();
if(count($theme_rows)==0)
return '<p>Theme not found</p>';
$theme_row=$theme_rows[0];
$custom_itemid=0;
if(isset($opt[2]))
$custom_itemid=(int)$opt[2];
$misc=new YouTubeGalleryMisc;
$misc->videolist_row=$videolist_row;
$misc->theme_row=$theme_row;
$total_number_of_rows=0;
$misc->update_playlist();
$videoid=JRequest::getVar('videoid');
if(!isset($videoid))
{
$video=JRequest::getVar('video');
if(isset($video))
$videoid=YouTubeGalleryMisc::getVideoIDbyAlias($video);
}
if($theme_row->playvideo==1 and $videoid!='')
$theme_row->autoplay=1;
$videoid_new=$videoid;
$videolist=$misc->getVideoList_FromCache_From_Table($videoid_new,$total_number_of_rows);
if($videoid=='')
{
if($theme_row->playvideo==1 and $videoid_new!='')
$videoid=$videoid_new;
}
$renderer= new YouTubeGalleryRenderer;
$result.=$renderer->render(
$videolist,
$videolist_row,
$theme_row,
$total_number_of_rows,
$videoid,
$custom_itemid
);
return $result;
}
}
?>