| 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/ |
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
defined( '_JEXEC' ) or die( 'Restricted access' );
function com_install()
{
jimport('joomla.version');
$version = new JVersion();
if($version->RELEASE>=1.6)
{
echo '<p><font color="red">Install Youtube Gallery for Joomla 2.5 instead.</font></p>';
return false;
}
jimport('joomla.filesystem.file');
copyFiles();
if (file_exists(JPATH_SITE.DS."administrator".DS."components".DS."com_youtubegallery".DS."youtubegallery.php"))
echo '<h1>YouTube Gallery 3.8.3 installed succesfully</h1>';
else
echo '<font color="red">Sorry, something went wrong while installing YouTube Gallery on your web site</font>';
$plugin_found=addPlugin();
addModule();
$db = JFactory::getDBO();
if($plugin_found)
{
//Updates database
//3.8.3
//check if there are already tables created
$db->setQuery( 'SELECT `id` FROM `#__youtubegallery`' );
if ($db->query())
{
echo '<p>Converting Tables to 3.x.x model...</p>';
update_to_135();
update_to_226();
update_to_227();
update_to_300();
}
}
else
{
//plugin not found database update is not necessary
}
update_to_306();
update_to_313();
update_to_315();
update_to_318();
update_to_324();
update_to_327();
update_to_337();
update_to_339();
update_to_348();
update_to_357();
update_to_358();
update_to_360();
update_to_361();
update_to_362();
update_to_370();
echo '<p>All DataBase tables are ready for YoutubeGallery 3.8.3</p>';
addDefaultTheme();
}
function executeUpdateQueries($query_array)
{
$db = JFactory::getDBO();
$i=0;
foreach($query_array as $query)
{
$i++;
$db->setQuery( $query );
if (!$db->query())
{
echo '<span style="color:black;font-weight:bold;">. </span>
<!--
'.$i.'
'.$query.'
'.$db->stderr().
'-->';
}
else
echo '<span style="color:green;font-weight:bold;">. </span>';
}
}
function update_to_370()
{
$query_array=array();
$query_array[]='ALTER TABLE `#__youtubegallery_videos` CHANGE `videoid` `videoid` varchar(128) NOT NULL;';
executeUpdateQueries($query_array);
}
function update_to_362()
{
$query_array=array();
$query_array[]='ALTER TABLE `#__youtubegallery_videos` CHANGE `rawdata` `rawdata` MEDIUMTEXT NOT NULL;';
executeUpdateQueries($query_array);
}
function update_to_361()
{
$query_array=array();
$query_array[]='ALTER TABLE `#__youtubegallery_videos` ADD COLUMN `datalink` varchar(1024) NOT NULL';
executeUpdateQueries($query_array);
}
function update_to_360()
{
$query_array=array();
$query_array[]='ALTER TABLE `#__youtubegallery_videos` ADD COLUMN `rawdata` text NOT NULL;';
executeUpdateQueries($query_array);
}
function update_to_358()
{
$query_array=array();
$query_array[]='ALTER TABLE `#__youtubegallery_videos` ADD COLUMN `alias` varchar(255) NOT NULL;';
executeUpdateQueries($query_array);
}
function update_to_357()
{
$query_array=array();
$query_array[]='ALTER TABLE `#__youtubegallery_themes` ADD COLUMN `allowplaylist` tinyint(1) NOT NULL default 0;';
executeUpdateQueries($query_array);
}
function update_to_348()
{
$query_array=array();
$query_array[]='CREATE TABLE IF NOT EXISTS `#__youtubegallery_settings` (
`option` varchar(50) NOT NULL,
`value` varchar(255),
PRIMARY KEY (`option`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;';
executeUpdateQueries($query_array);
}
function update_to_339()
{
$query_array=array();
$query_array[]='ALTER TABLE `#__youtubegallery_videos` ADD COLUMN `channel_totaluploadviews` int(11) NOT NULL default 0;';
$query_array[]='ALTER TABLE `#__youtubegallery_themes` CHANGE `prepareheadtags` `prepareheadtags` smallint(6) NOT NULL default 0;';
executeUpdateQueries($query_array);
}
function update_to_337()
{
$query_array=array();
$query_array[]='ALTER TABLE `#__youtubegallery_videos` ADD COLUMN `likes` int(11) NOT NULL default 0;';
$query_array[]='ALTER TABLE `#__youtubegallery_videos` ADD COLUMN `dislikes`int(11) NOT NULL default 0;';
$query_array[]='ALTER TABLE `#__youtubegallery_videos` ADD COLUMN `commentcount`int(11) NOT NULL default 0;';
$query_array[]='ALTER TABLE `#__youtubegallery_videos` ADD COLUMN `channel_username` varchar(255) NOT NULL;';
$query_array[]='ALTER TABLE `#__youtubegallery_videos` ADD COLUMN `channel_title` varchar(255) NOT NULL;';
$query_array[]='ALTER TABLE `#__youtubegallery_videos` ADD COLUMN `channel_subscribers` int(11) NOT NULL default 0;';
$query_array[]='ALTER TABLE `#__youtubegallery_videos` ADD COLUMN `channel_subscribed` smallint(6) NOT NULL default 0;';
$query_array[]='ALTER TABLE `#__youtubegallery_videos` ADD COLUMN `channel_location` varchar(5) NOT NULL;';
$query_array[]='ALTER TABLE `#__youtubegallery_videos` ADD COLUMN `channel_commentcount` int(11) NOT NULL default 0;';
$query_array[]='ALTER TABLE `#__youtubegallery_videos` ADD COLUMN `channel_viewcount` int(11) NOT NULL default 0;';
$query_array[]='ALTER TABLE `#__youtubegallery_videos` ADD COLUMN `channel_videocount` int(11) NOT NULL default 0;';
$query_array[]='ALTER TABLE `#__youtubegallery_videos` ADD COLUMN `channel_description` text NOT NULL;';
$query_array[]='ALTER TABLE `#__youtubegallery_videos` CHANGE `imageurl` `imageurl` varchar(1024) NOT NULL;';
executeUpdateQueries($query_array);
}
function update_to_327()
{
$query_array=array();
$query_array[]='ALTER TABLE `#__youtubegallery_videos` CHANGE `link` `link` TEXT NOT NULL;';
executeUpdateQueries($query_array);
}
function update_to_324()
{
$query_array=array();
$query_array[]='ALTER TABLE `#__youtubegallery_videos` CHANGE `statistics_favoriteCount` `statistics_favoriteCount` INT( 11 ) NOT NULL DEFAULT "0";';
$query_array[]='ALTER TABLE `#__youtubegallery_videos` CHANGE `statistics_viewCount` `statistics_viewCount` INT( 11 ) NOT NULL DEFAULT "0";';
executeUpdateQueries($query_array);
}
function update_to_318()
{
$db = JFactory::getDBO();
AddColumnIfNotExist($db->getPrefix().'youtubegallery_videos', 'endsecond', 'smallint(6)', 'NOT NULL default 0');
}
function update_to_315()
{
$db = JFactory::getDBO();
AddColumnIfNotExist($db->getPrefix().'youtubegallery_videos', 'startsecond', 'smallint(6)', 'NOT NULL default 0');
}
function update_to_313()
{
$db = JFactory::getDBO();
AddColumnIfNotExist($db->getPrefix().'youtubegallery_themes', 'changepagetitle', 'smallint(6)', 'NOT NULL default 0');
}
function update_to_306()
{
$db = JFactory::getDBO();
AddColumnIfNotExist($db->getPrefix().'youtubegallery_themes', 'nocookie', 'tinyint(1)', 'NOT NULL default 0');
}
function update_to_300()
{
$db = JFactory::getDBO();
//3.8.3
//check if there are already tables created
$query_array=array();
//Create a Back Up
$query_array[]='CREATE TABLE `#__youtubegallery_backup` LIKE `#__youtubegallery`;';
$query_array[]='INSERT `#__youtubegallery_backup` SELECT * FROM `#__youtubegallery`;';
$query_array[]='CREATE TABLE `#__youtubegallery_videos_backup` LIKE `#__youtubegallery_videos`;';
$query_array[]='INSERT `#__youtubegallery_videos_backup` SELECT * FROM `#__youtubegallery_videos`;';
//Create Video List Table
$query_array[]='CREATE TABLE IF NOT EXISTS `#__youtubegallery_videolists` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`listname` varchar(50) NOT NULL,
`videolist` text,
`catid` int(11) NOT NULL,
`updateperiod` float NOT NULL default 7,
`lastplaylistupdate` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;';
//Copy Data
$query_array[]='INSERT INTO `#__youtubegallery_videolists` (
`id`, `listname`, `videolist`, `catid`, `updateperiod`, `lastplaylistupdate`) SELECT
`id`, `galleryname`, `gallerylist`, `catid`, `updateperiod`, `lastplaylistupdate` FROM `#__youtubegallery`;';
//Alter Gallery Table
$query_array[]='ALTER TABLE `#__youtubegallery` CHANGE `galleryname` `themename` varchar(50) NOT NULL;';
$query_array[]='ALTER TABLE `#__youtubegallery` CHANGE `showgalleryname` `showlistname` tinyint(1) NOT NULL;';
$query_array[]='ALTER TABLE `#__youtubegallery` CHANGE `gallerynamestyle` `listnamestyle` varchar(255) NOT NULL;';
$query_array[]='ALTER TABLE `#__youtubegallery` CHANGE `showactivevideotitle` `showactivevideotitle` tinyint(1) NOT NULL;';
$query_array[]='ALTER TABLE `#__youtubegallery` CHANGE `border` `border` smallint(6) NOT NULL;';
//Delete depricated columns
$query_array[]='ALTER TABLE `#__youtubegallery` DROP COLUMN `gallerylist`';
$query_array[]='ALTER TABLE `#__youtubegallery` DROP COLUMN `catid`';
$query_array[]='ALTER TABLE `#__youtubegallery` DROP COLUMN `updateperiod`';
$query_array[]='ALTER TABLE `#__youtubegallery` DROP COLUMN `randomization`';
$query_array[]='ALTER TABLE `#__youtubegallery` DROP COLUMN `lastplaylistupdate`';
$query_array[]='ALTER TABLE `#__youtubegallery` DROP COLUMN `cache`';
$query_array[]='ALTER TABLE `#__youtubegallery` DROP COLUMN `enablecache`';
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'responsive', 'smallint(6)', 'default 0');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'mediafolder', 'varchar(255)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'readonly', 'tinyint(1)', 'NOT NULL default 0');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'headscript', 'text', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'themedescription', 'text', 'NOT NULL');
//Create Theme Table
$query_array[]=getCreateThemesTableQuery();
$query_array[]='ALTER TABLE `#__youtubegallery_videos` CHANGE `galleryid` `listid` int(11) NOT NULL;'; //
$query_array[]='INSERT `#__youtubegallery_themes` SELECT * FROM `#__youtubegallery`;';
//Drop Table
$query_array[]='DROP TABLE IF EXISTS `#__youtubegallery`;';
$i=0;
foreach($query_array as $query)
{
$i++;
$db->setQuery( $query );
if (!$db->query()){
echo '<span style="color:black;font-weight:bold;">. </span>
<!--
'.$i.'
'.$query.'
'.$db->stderr().
'-->';
if($i==21)
{
//do not drop yg table
break;
}
}
else
echo '<span style="color:green;font-weight:bold;">. </span>';
}
echo '<p>Backup created.</p>';
echo '<p>Done.</p>';
}
function update_to_229()
{
$db = JFactory::getDBO();
//2. 2. 9
AddColumnIfNotExist($db->getPrefix().'youtubegallery_categories', 'parentid', 'int(11)', 'NOT NULL');
}
function update_to_227()
{
$db = JFactory::getDBO();
//2. 2. 7
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'orderby', ' varchar(50)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'customnavlayout', 'text', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery_videos', 'publisheddate', 'datetime', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery_videos', 'duration', 'int(11)', 'NOT NULL default 0');
AddColumnIfNotExist($db->getPrefix().'youtubegallery_videos', 'rating_average', 'float', 'NOT NULL default 0');
AddColumnIfNotExist($db->getPrefix().'youtubegallery_videos', 'rating_max', 'smallint(6)', 'NOT NULL default 0');
AddColumnIfNotExist($db->getPrefix().'youtubegallery_videos', 'rating_min', 'smallint(6)', 'NOT NULL default 0');
AddColumnIfNotExist($db->getPrefix().'youtubegallery_videos', 'rating_numRaters', 'int(11)', 'NOT NULL default 0');
AddColumnIfNotExist($db->getPrefix().'youtubegallery_videos', 'statistics_favoriteCount', 'smallint(6)', 'NOT NULL default 0');
AddColumnIfNotExist($db->getPrefix().'youtubegallery_videos', 'statistics_viewCount', 'smallint(6)', 'NOT NULL default 0');
AddColumnIfNotExist($db->getPrefix().'youtubegallery_videos', 'keywords', 'text', 'NOT NULL');
$db = JFactory::getDBO();
$query='ALTER TABLE `#__youtubegallery` CHANGE `openinnewwindow` `openinnewwindow` smallint(6) NOT NULL;';
$db->setQuery( $query );
if (!$db->query())
echo '<p>'.$db->stderr().'</p>';
$query='ALTER TABLE `#__youtubegallery` CHANGE `updateperiod` `updateperiod` float NOT NULL default 7;';
$db->setQuery( $query );
if (!$db->query())
echo '<p>'.$db->stderr().'</p>';
}
function update_to_226()
{
$db = JFactory::getDBO();
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'useglass', 'tinyint(1)', 'NOT NULL default 0');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'logocover', 'varchar(255)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'cache', 'text', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'customlayout', 'text', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'prepareheadtags', 'tinyint(1)', 'NOT NULL default 0');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'updateperiod', 'float', 'NOT NULL default 7'); //updated to 3.8.3
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'lastplaylistupdate', 'datetime', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'muteonplay', 'tinyint(1)', 'NOT NULL default 0');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'volume', 'smallint(6)', 'NOT NULL default -1');
$db = JFactory::getDBO();
$query='
CREATE TABLE IF NOT EXISTS `#__youtubegallery_videos` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`galleryid` int(11) NOT NULL,
`parentid` int(11) NOT NULL,
`videosource` varchar(30) NOT NULL,
`videoid` varchar(30) NOT NULL,
`imageurl` varchar(255) NOT NULL,
`title` varchar(255) NOT NULL,
`description` text NOT NULL,
`custom_imageurl` varchar(255) NOT NULL,
`custom_title` varchar(255) NOT NULL,
`custom_description` text NOT NULL,
`specialparams` varchar(255) NOT NULL,
`lastupdate` datetime NOT NULL,
`allowupdates` tinyint(1) NOT NULL default 0,
`status` smallint(6) NOT NULL,
`isvideo` tinyint(1) NOT NULL default 0,
`link` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
';
$db->setQuery( $query );
if (!$db->query())
echo '<p>'.$db->stderr().'</p>';
AddColumnIfNotExist($db->getPrefix().'youtubegallery_videos', 'ordering', 'int(11)', 'NOT NULL default 0');
}
function update_to_230()
{
//2. 3. 0
$db = JFactory::getDBO();
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'responsive', 'smallint(6)', 'NOT NULL default 0');
}
function update_to_135()
{
$db = JFactory::getDBO();
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'width', 'int(11)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'height', 'int(11)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'playvideo', 'tinyint(1)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'repeat', 'tinyint(1)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'fullscreen', 'tinyint(1)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'autoplay', 'tinyint(1)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'related', 'tinyint(1)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'showinfo', 'tinyint(1)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'bgcolor', 'varchar(20)', '');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'cols', 'smallint(6)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'showtitle', 'tinyint(1)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'cssstyle', 'varchar(255)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'navbarstyle', 'varchar(255)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'thumbnailstyle', 'varchar(255)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'linestyle', 'varchar(255)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'showgalleryname', 'varchar(255)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'gallerynamestyle', 'varchar(255)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'showactivevideotitle', 'varchar(255)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'activevideotitlestyle', 'varchar(255)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'color1', 'varchar(20)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'color2', 'varchar(20)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'border', 'tinyint(1)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'description', 'tinyint(1)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'descr_position', 'smallint(6)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'descr_style', 'varchar(255)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'openinnewwindow', 'smallint(6)', 'NOT NULL'); //updated to 3.8.3
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'rel', 'varchar(255)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'hrefaddon', 'varchar(255)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'pagination', 'smallint(6)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'customlimit', 'smallint(6)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'catid', 'int(11)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'controls', 'tinyint(1)', 'NOT NULL default 1');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'youtubeparams', 'varchar(450)', 'NOT NULL');
AddColumnIfNotExist($db->getPrefix().'youtubegallery', 'playertype', 'smallint(6)', 'NOT NULL');
$query='
CREATE TABLE IF NOT EXISTS `#__youtubegallery_categories` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`categoryname` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
';
$db->setQuery( $query );
if (!$db->query())
echo '<p>'.$db->stderr().'</p>';
}
function addPlugin()
{
$db = JFactory::getDBO();
//ADD PLUGIN
$query = 'SELECT count(*) FROM #__plugins WHERE `element`="youtubegallery"';
$db->setQuery( $query );
$total_rows = $db->loadResult();
if($total_rows==0)
{
$query ='INSERT `#__plugins` SET `name`="Content - YouTubeGallery", `element`="youtubegallery", `folder`="content", published=1';
$db->setQuery( $query );
if (!$db->query()) die( $db->stderr());
//plugin not found database update is not necessary
return false;
}
else
{
return true;
}
}
function addModule()
{
$db = JFactory::getDBO();
//Add module
$query = 'SELECT count(*) FROM #__modules WHERE `module`="mod_youtubegallery"';
$db->setQuery( $query );
$total_rows = $db->loadResult();
if($total_rows==0)
{
//add module
$query ='INSERT `#__modules` SET '
.' `title`="YouTube Gallery", '
.' `position`="left", '
.' `published`=0, '
.' `module`="mod_youtubegallery", '
.' `params`=""';
$db->setQuery( $query );
if (!$db->query()) die( $db->stderr());
//Check menu Items
$query = 'SELECT id FROM #__modules WHERE '
.' `title`="YouTube Gallery" AND'
.' `module`="mod_youtubegallery" AND'
.' `position`="left" AND'
.' `published`=0'
.' LIMIT 1';
//Add menu Items
$db->setQuery( $query );
$rows = $db->loadObjectList();
if(count($rows)==1)
{
$id=$rows[0]->id;
$query = 'SELECT count(*) FROM #__modules_menu WHERE moduleid='.$id;
$db->setQuery( $query );
$total_rows = $db->loadResult();
if($total_rows==0)
{
$query ='INSERT `#__modules_menu` SET `menuid`=0, `moduleid`='.$id;
$db->setQuery( $query );
if (!$db->query()) die( $db->stderr());
}
}
else
echo '<p>Database error, cannot add module</p>';
}
}
function AddColumnIfNotExist($tablename, $columnname, $fieldtype, $options,$showerror=false)
{
$db =& JFactory::getDBO();
$query="ALTER TABLE `".$tablename."` ADD COLUMN `".$columnname."` ".$fieldtype." ".$options.";";
$db->setQuery( $query );
if (!$db->query())
{
if($showerror)
echo '<p>'.$db->stderr().'</p>';
}
}
function copyFiles()
{
$filestodelete=array();
//Plugin to update
$filestodelete[]=JPATH_SITE.DS.'plugins'.DS.'content'.DS.'youtubegallery.php';
$filestodelete[]=JPATH_SITE.DS.'plugins'.DS.'content'.DS.'youtubegallery.xml';
$filestodelete[]=JPATH_SITE.DS.'components'.DS.'com_youtubegallery'.DS.'plugin'.DS.'index.html';
//Module to update
$filestodelete[]=JPATH_SITE.DS.'modules'.DS.'mod_youtubegallery'.DS.'index.html';
$filestodelete[]=JPATH_SITE.DS.'modules'.DS.'mod_youtubegallery'.DS.'mod_youtubegallery.php';
$filestodelete[]=JPATH_SITE.DS.'modules'.DS.'mod_youtubegallery'.DS.'mod_youtubegallery.xml';
$filestodelete[]=JPATH_SITE.DS.'modules'.DS.'mod_youtubegallery';
foreach($filestodelete as $file)
{
//echo $file;
if(file_exists($file))
{
if(is_dir($file))
{
rmdir($file);
}
else
{
unlink($file);
}
}
}
//plugin
rename(JPATH_SITE.DS.'components'.DS.'com_youtubegallery'.DS.'plugin'.DS.'youtubegallery.php',JPATH_SITE.DS.'plugins'.DS.'content'.DS.'youtubegallery.php');
rename(JPATH_SITE.DS.'components'.DS.'com_youtubegallery'.DS.'plugin'.DS.'youtubegallery.xml',JPATH_SITE.DS.'plugins'.DS.'content'.DS.'youtubegallery.xml');
rmdir(JPATH_SITE.DS.'components'.DS.'com_youtubegallery'.DS.'plugin');
//module
rename(JPATH_SITE.DS.'components'.DS.'com_youtubegallery'.DS.'module',JPATH_SITE.DS.'modules'.DS.'mod_youtubegallery');
}
function getCreateThemesTableQuery()
{
$query_array='CREATE TABLE IF NOT EXISTS `#__youtubegallery_themes` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`themename` varchar(50) NOT NULL,
`showtitle` tinyint(1) NOT NULL,
`playvideo` tinyint(1) NOT NULL,
`repeat` tinyint(1) NOT NULL,
`fullscreen` tinyint(1) NOT NULL,
`autoplay` tinyint(1) NOT NULL,
`related` tinyint(1) NOT NULL,
`showinfo` tinyint(1) NOT NULL,
`bgcolor` varchar(20) NOT NULL,
`cols` smallint(6) NOT NULL,
`width` int(11) NOT NULL,
`height` int(11) NOT NULL,
`cssstyle` varchar(255) NOT NULL,
`navbarstyle` varchar(255) NOT NULL,
`thumbnailstyle` varchar(255) NOT NULL,
`linestyle` varchar(255) NOT NULL,
`showlistname` tinyint(1) NOT NULL,
`listnamestyle` varchar(255) NOT NULL,
`showactivevideotitle` tinyint(1) NOT NULL,
`activevideotitlestyle` varchar(255) NOT NULL,
`color1` varchar(255) NOT NULL,
`color2` varchar(255) NOT NULL,
`border` smallint(6) NOT NULL,
`description` tinyint(1) NOT NULL,
`descr_position` smallint(6) NOT NULL,
`descr_style` varchar(255) NOT NULL,
`openinnewwindow` smallint(6) NOT NULL,
`rel` varchar(255) NOT NULL,
`hrefaddon` varchar(255) NOT NULL,
`pagination` smallint(6) NOT NULL,
`customlimit` smallint(6) NOT NULL,
`controls` tinyint(1) NOT NULL default 1,
`youtubeparams` varchar(450) NOT NULL,
`playertype` smallint(6) NOT NULL,
`useglass` tinyint(1) NOT NULL default 0,
`logocover` varchar(255) NOT NULL,
`customlayout` text NOT NULL,
`prepareheadtags` tinyint(1) NOT NULL default 0,
`muteonplay` tinyint(1) NOT NULL default 0,
`volume` smallint(6) NOT NULL default -1,
`orderby` varchar(50) NOT NULL,
`customnavlayout` text NOT NULL,
`responsive` smallint(6) NOT NULL default 0,
`mediafolder` varchar(255) NOT NULL,
`readonly` tinyint(1) NOT NULL default 0,
`headscript` text NOT NULL,
`themedescription` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;';
return $query_array;
}
function addDefaultTheme()
{
require_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_youtubegallery'.DS.'models'.DS.'themeimport.php');
$ygmti= new YoutubeGalleryModelThemeImport;
if(!$ygmti->checkIfThemenameExist("Simple Grid - Default"))
{
$themecode='O:8:"stdClass":48:{s:9:"themename";s:21:"Simple Grid - Default";s:5:"width";s:3:"605";s:6:"height";s:3:"400";s:9:"playvideo";s:1:"1";s:6:"repeat";s:1:"0";s:10:"fullscreen";s:1:"1";s:8:"autoplay";s:1:"0";s:7:"related";s:1:"0";s:8:"showinfo";s:1:"1";s:7:"bgcolor";s:0:"";s:4:"cols";s:1:"4";s:9:"showtitle";s:1:"1";s:8:"cssstyle";s:0:"";s:11:"navbarstyle";s:0:"";s:14:"thumbnailstyle";s:33:"width:142px;margin:4px;padding:0;";s:9:"linestyle";s:57:"border-color:#E7E7E9;border-style:solid;border-width:1px;";s:12:"showlistname";s:1:"1";s:13:"listnamestyle";s:0:"";s:20:"showactivevideotitle";s:1:"1";s:21:"activevideotitlestyle";s:0:"";s:11:"description";s:1:"1";s:14:"descr_position";s:1:"0";s:11:"descr_style";s:0:"";s:6:"color1";s:6:"DA892E";s:6:"color2";s:6:"141414";s:6:"border";s:1:"1";s:15:"openinnewwindow";s:1:"4";s:3:"rel";s:0:"";s:9:"hrefaddon";s:0:"";s:10:"pagination";s:1:"2";s:11:"customlimit";s:1:"8";s:8:"controls";s:1:"1";s:13:"youtubeparams";s:0:"";s:10:"playertype";s:1:"1";s:8:"useglass";s:1:"0";s:9:"logocover";s:0:"";s:12:"customlayout";s:0:"";s:15:"prepareheadtags";s:1:"1";s:10:"muteonplay";s:1:"0";s:6:"volume";s:1:"5";s:7:"orderby";s:8:"ordering";s:15:"customnavlayout";s:297:"[a][image][/a]<br/>
<div style="width:142px;margin:2px;padding:0;">
<a href="[link]" class="">[title]</a><br/>
[if:duration]
<span style="color: grey;font-size:10px;">[duration] sec.</span>
[endif:duration]<br/>
<span style="color: grey;font-size:10px;">Views: [viewcount]</span>
</div>";s:10:"responsive";s:1:"1";s:11:"mediafolder";s:0:"";s:8:"readonly";s:1:"0";s:10:"headscript";s:0:"";s:8:"nocookie";s:1:"1";s:15:"changepagetitle";s:1:"1";}';
$msg='';
$ygmti->createTheme($themecode, $msg);
if($msg!='')
echo '<p>'.$msg.'</p>';
}
}
?>