<?php
/**
* Tube Video Gallery Plugin for MyBB
* Copyright © 2007 Vitadin.Net
* By: FiKa
* Website: http://www.vitadin.net/
* Version: 1.0.0
*/
$plugins->add_hook('global_start', 'tubegallery_toplink_lang');
// $plugins->add_hook('admin_index_home', 'tubegallery_admin_index');
// $plugins->add_hook('admin_index_navigation_end', 'tubegallery_admin_nav');
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
//All the information about the plugin. These will appear in the plugins list.
function tubegallery_info()
{
return array(
"name" => "Tube Video Gallery",
"description" => "You can embed lots videos to your forum",
"website" => "http://chat.vitadin.net",
"author" => "FiKa",
"authorsite" => "http://forum.vitadin.net",
"version" => "1.3.2",
"guid" => "1d4da60d789ee903d2258a6bcb0502c8",
);
}
//All the activation processes go here
function tubegallery_activate()
{
global $config, $db;
// Create `tube_video` table
$db->query("
CREATE TABLE IF NOT EXISTS tube_video (
id int(5) NOT NULL auto_increment,
date date NOT NULL default '0000-00-00',
title varchar(100) NOT NULL default '',
text text NOT NULL,
sender varchar(50) default NULL,
hits int(6) NOT NULL default '0',
voter int(6) NOT NULL default '0',
vote int(6) NOT NULL default '0',
cid int(11) NOT NULL default '0',
type varchar(50) NOT NULL default 'youtube',
PRIMARY KEY (id),
KEY id (id)
) TYPE=MyISAM AUTO_INCREMENT=24 ;
");
// Create `tube_video_add` table
$db->query("
CREATE TABLE IF NOT EXISTS tube_video_add (
id int(5) NOT NULL auto_increment,
date date NOT NULL default '0000-00-00',
title varchar(100) NOT NULL default '',
text text NOT NULL,
sender varchar(50) NOT NULL default '',
cid int(5) NOT NULL default '0',
type varchar(50) NOT NULL default 'youtube',
PRIMARY KEY (id),
KEY id (id)
) TYPE=MyISAM AUTO_INCREMENT=1 ;
");
// Create 'tube_video_cat' table
$db->query("
CREATE TABLE IF NOT EXISTS tube_video_cat (
cid int(5) NOT NULL auto_increment,
cname varchar(250) NOT NULL default '',
PRIMARY KEY (`cid`)
) Type=MyISAM AUTO_INCREMENT=8 ;
");
$db->query("INSERT IGNORE INTO tube_video_cat VALUES (1, 'Default');");
// Create `tube_video_comment` table
$db->query("
CREATE TABLE IF NOT EXISTS tube_video_comment (
id int(5) NOT NULL auto_increment,
sid int(5) NOT NULL default '0',
uname varchar(50) NOT NULL default '',
date datetime default NULL,
comments text,
score tinyint(5) NOT NULL default '0',
active tinyint(1) NOT NULL default '0',
PRIMARY KEY (id),
KEY cid (id),
KEY rid (sid),
KEY userid (uname)
) TYPE=MyISAM AUTO_INCREMENT=1 ;
");
// Create `tube_video_config` table
$db->query("
CREATE TABLE IF NOT EXISTS tube_video_config (
sitename varchar(10) NOT NULL default '',
index_page_items tinyint(2) NOT NULL default '0',
list_page_items tinyint(2) NOT NULL default '0',
top_page_items tinyint(2) NOT NULL default '0',
isset_theme tinyint(1) NOT NULL default '0',
allow_anonymous tinyint(1) NOT NULL default '0',
allow_direct tinyint(1) NOT NULL default '0',
less_vote tinyint(2) NOT NULL default '0'
) TYPE=MyISAM;
");
// Create a version table
$db->query("
CREATE TABLE IF NOT EXISTS tube_video_version (
version varchar(250) NOT NULL default ''
) Type=MyISAM
");
// Insert version
$db->query("
INSERT IGNORE INTO tube_video_version VALUES ('1.3.1');
");
// insert tube video gallery configurations into db
$db->query("
INSERT INTO tube_video_config VALUES ('vitadin', 15, 25, 10, 0, 0, 1, 5);
");
$new_template = array(
"sid" => "NULL",
"title" => "tubegallery_index",
"template" => $db->escape_string('
<html>
<head>
<title>$put_title - Video Gallery</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9">
$headerinclude
</head>
<body>
$header
<div id="video_content">
<table cellspacing="0" cellpadding="0" border="0" width="100%" align="center">
<tr>
<td class="tborder">
<table cellspacing="1" cellpadding="4" width="100%">
<tr>
<td class="thead"><strong>{$lang->tube_name} - {$lang->tube_welcome}!</strong></td>
<tr><td colspan="2" valign="top" class="trow1">
<table width="100%" border="0">
<tr><td width="100%">
<center><img src="vgallery/images/videolarindex.gif"></center><br>
$hm_links
$hm_index
<br>
<br>
{$lang->tube_intext}
</td></tr></table></td></tr></table></td></tr></table>
</div>
$footer
</body>
</html>
'),
"sid" => "-1",
"version" => "100.07",
"status" => "0",
"dateline" => time(),
);
$db->insert_query(TABLE_PREFIX."templates", $new_template);
// Add the tube video gallery section link to the forum header
require MYBB_ROOT.'/inc/adminfunctions_templates.php';
find_replace_templatesets("header", '#toplinks_help}</a></li>#', "toplinks_help}</a></li>\n<li><a href=\"{\$mybb->settings['bburl']}/vgallery.php\">Tube Video Gallery</a></li>");
}
//All deactivation processes go here
function tubegallery_deactivate()
{
global $db, $mybb;
// remove tables created by plugin
// $db->query("DROP TABLE tube_video");
// $db->query("DROP TABLE tube_video_add");
// $db->query("DROP TABLE tube_video_comment");
$db->query("DROP TABLE tube_video_config");
// $db->query("DROP TABLE tube_video_cat");
$db->query("DROP TABLE tube_video_version");
// delete templates created by plugin
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title ='tubegallery_index'");
// Remove the gallery link from the forum header
require MYBB_ROOT.'/inc/adminfunctions_templates.php';
find_replace_templatesets("header", '#\n<li><a href=\"{\$mybb->settings[\'bburl\']}/vgallery.php\">Tube Video Gallery</a></li>#', '', 0);
}
function tubegallery_toplink_lang()
{
global $mybb, $lang;
if(!isset($mybb->settings['bblanguage']))
{
$mybb->settings['bblanguage'] = 'english';
}
$lang->set_language($mybb->settings['bblanguage']);
$lang->load('tubegallery');
}
// Admin CP administration will be done later
// function tubegallery_admin_nav()
// {
// global $lang, $menu, $mybb;
//
// $lang->load('tubegallery');
//
// $menu[40]['items'][] = array('title' => $lang->nav_tubegallery, 'url' => 'vgallery.php');
//
// $menu[] = array(
// 'title' => $lang->nav_tubegallery,
// 'items' => array(
// 10 => array('title' => $lang->nav_add_video, 'url' => 'vgallery.php?&op=write_text'),
// 20 => array('title' => $lang->nav_list_videos, 'url' => 'vgallery.php?&op=text_list')
// )
// );
// }
?>