Codice:
<?php
/**
*
* @package install
* @version 3.0.5.0822
* @license GNU Public License
* @author draghetto
*
*/
/**
* @ignore
*/
define('IN_PHPBB',true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'),1);
include($phpbb_root_path . 'common.'.$phpEx);
define('TB_TABLE', $table_prefix . 'tag_board');
// Tb version
$tb_version = '3.0.5.0822';
// Grab data
$mode = request_var('mode','');
$action = request_var('action','');
function add_modules()
{
global $db, $phpbb_root_path, $phpEx;
if (!class_exists('acp_modules'))
{
include($phpbb_root_path . 'includes/acp/acp_modules.'.$phpEx);
}
$module = new acp_modules();
$sql = 'SELECT module_id FROM ' . MODULES_TABLE . "
WHERE module_langname = 'Tag Board'";
$result = $db->sql_query($sql);
if (!$db->sql_fetchrow($result))
{
// Insert Category Module
$cat_module_data = array(
'module_enabled' => 1,
'module_display' => 1,
'module_class' => 'acp',
'parent_id' => 0,
'module_langname' => 'Tag Board',
'module_auth' => '',
);
$module->update_module_data($cat_module_data, true);
// Insert Parent Module
$parent_module_data = array(
'module_enabled' => 1,
'module_display' => 1,
'module_class' => 'acp',
'parent_id' => $cat_module_data['module_id'],
'module_langname' => 'Tag Board',
);
$module->update_module_data($parent_module_data, true);
// Settings Module
$front_module_data = array(
'module_enabled' => 1,
'module_display' => 1,
'module_class' => 'acp',
'parent_id' => $parent_module_data['module_id'],
'module_langname' => 'Tag Board settings',
'module_basename' => 'tag_board',
'module_mode' => 'settings',
'module_auth' => '',
);
$module->update_module_data($front_module_data, true);
}
}
switch($mode){
case 'install':
$sql = 'DROP TABLE IF EXISTS ' . TB_TABLE;
$db->sql_query($sql);
$sql = 'CREATE TABLE ' . TB_TABLE . " (
tb_post_id mediumint(8) UNSIGNED NOT NULL auto_increment,
tb_poster_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
tb_post_time int(11) UNSIGNED DEFAULT '0' NOT NULL,
tb_post_username varchar(255) DEFAULT '' NOT NULL,
tb_post_text mediumtext NOT NULL,
tb_bbcode_bitfield varchar(255) DEFAULT '' NOT NULL,
tb_bbcode_uid varchar(8) DEFAULT '' NOT NULL,
tb_flags int(1) UNSIGNED DEFAULT '3' NOT NULL,
PRIMARY KEY (tb_post_id)
) CHARACTER SET utf8 COLLATE utf8_bin";
$db->sql_query($sql);
set_config('tb_version',$tb_version);
set_config('tb_null','');
set_config('tb_auth','STANDARD');
set_config('tb_groups','');
set_config('tb_denied','');
set_config('tb_guest','');
set_config('tb_limit','20');
set_config('tb_heigth','150');
set_config('tb_maxlength','500');
set_config('tb_bbcode','1');
set_config('tb_custom','0');
set_config('tb_fsize','1');
set_config('tb_img','0');
set_config('tb_flash','0');
set_config('tb_smilies','1');
set_config('tb_urls','1');
set_config('tb_buttons','1');
set_config('tb_delete','1');
set_config('tb_edit','1');
set_config('tb_edit_time','1');
set_config('tb_purge','0');
set_config('tb_flood','0');
set_config('tb_refresh','10');
set_config('tb_history','0');
set_config('tb_deleteall','0');
add_modules();
header("Location: ".append_sid("{$phpbb_root_path}tb_install.$phpEx", 'mode=result&action=Install'));
break;
case 'update':
if($config['tb_version'] == '3.0.5.0821')
{
set_config('tb_version',$tb_version);
set_config('tb_denied','');
}
elseif($config['tb_version'] == '3.0.5.0817c' || $config['tb_version'] == '3.0.5.0818' || $config['tb_version'] == '3.0.5.0820')
{
set_config('tb_version',$tb_version);
set_config('tb_groups','');
set_config('tb_denied','');
}
else
{
set_config('tb_version',$tb_version);
set_config('tb_null','');
set_config('tb_auth','STANDARD');
set_config('tb_groups','');
set_config('tb_denied','');
set_config('tb_guest','');
set_config('tb_limit','20');
set_config('tb_heigth','150');
set_config('tb_maxlength','500');
set_config('tb_bbcode','1');
set_config('tb_custom','0');
set_config('tb_fsize','1');
set_config('tb_img','0');
set_config('tb_flash','0');
set_config('tb_smilies','1');
set_config('tb_urls','1');
set_config('tb_buttons','1');
set_config('tb_delete','1');
set_config('tb_edit','1');
set_config('tb_edit_time','1');
set_config('tb_purge','0');
set_config('tb_flood','0');
set_config('tb_refresh','10');
set_config('tb_history','0');
set_config('tb_deleteall','0');
add_modules();
}
header("Location: ".append_sid("{$phpbb_root_path}tb_install.$phpEx", 'mode=result&action=Update'));
break;
case 'result':
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
echo '<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">';
echo '<head>';
echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
echo '<title>TAG BOARD 4 phpBB3 - '.$action.'</title>';
echo '<style type="text/css">' . "\n" . '/* <![CDATA[ */' . "\n";
echo '* { margin: 0; padding: 0; } html { font-size: 100%; height: 100%; margin-bottom: 1px; background-color: #E4EDF0; } body { font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; color: #536482; background: #E4EDF0; font-size: 62.5%; margin: 0; } ';
echo 'a:link, a:active, a:visited { color: #006699; text-decoration: none; } a:hover { color: #DD6900; text-decoration: underline; } ';
echo '#wrap { padding: 0 20px 15px 20px; min-width: 615px; } #page-header { text-align: right; height: 40px; } #page-footer { clear: both; font-size: 1em; text-align: center; } ';
echo '.panel { margin: 4px 0; background-color: #FFFFFF; border: solid 1px #A9B8C2; } ';
echo '#errorpage #page-header a { font-weight: bold; line-height: 6em; } #errorpage #content { padding: 10px; } #errorpage #content h1 { line-height: 1.2em; margin-bottom: 0; color: #DF075C; } ';
echo '#errorpage #content div { margin-top: 20px; margin-bottom: 5px; border-bottom: 1px solid #CCCCCC; padding-bottom: 5px; color: #333333; font: bold 1.2em "Lucida Grande", Arial, Helvetica, sans-serif; text-decoration: none; line-height: 120%; text-align: left; } ';
echo "\n" . '/* ]]> */' . "\n";
echo '</style>';
echo '</head>';
echo '<body id="errorpage">';
echo '<div id="wrap">';
echo '<div id="page-header">';
echo '<a href='.$phpbb_root_path.'>Return to index page</a>';
echo '</div>';
echo '<div id="acp">';
echo '<div class="panel">';
echo '<div id="content">';
echo '<h1>TAG BOARD 4 phpBB3 - '.$action.'</h1>';
echo '<div>Successfully!<br /><br />Please delete this file (tb_install.php).</div>';
echo '</div>';
echo '</div>';
echo '</div>';
echo '</div>';
echo '</body>';
echo '</html>';
break;
default:
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
echo '<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">';
echo '<head>';
echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
echo '<title>TAG BOARD 4 phpBB3 v'.$tb_version.'</title>';
echo '<style type="text/css">' . "\n" . '/* <![CDATA[ */' . "\n";
echo '* { margin: 0; padding: 0; } html { font-size: 100%; height: 100%; margin-bottom: 1px; background-color: #E4EDF0; } body { font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; color: #536482; background: #E4EDF0; font-size: 62.5%; margin: 0; } ';
echo 'a:link, a:active, a:visited { color: #006699; text-decoration: none; } a:hover { color: #DD6900; text-decoration: underline; } ';
echo '#wrap { padding: 0 20px 15px 20px; min-width: 615px; } #page-header { text-align: right; height: 40px; } #page-footer { clear: both; font-size: 1em; text-align: center; } ';
echo '.panel { margin: 4px 0; background-color: #FFFFFF; border: solid 1px #A9B8C2; } ';
echo '#errorpage #page-header a { font-weight: bold; line-height: 6em; } #errorpage #content { padding: 10px; } #errorpage #content h1 { line-height: 1.2em; margin-bottom: 0; color: #DF075C; } ';
echo '#errorpage #content div { margin-top: 20px; margin-bottom: 5px; border-bottom: 1px solid #CCCCCC; padding-bottom: 5px; color: #333333; font: bold 1.2em "Lucida Grande", Arial, Helvetica, sans-serif; text-decoration: none; line-height: 120%; text-align: left; } ';
echo "\n" . '/* ]]> */' . "\n";
echo '</style>';
echo '</head>';
echo '<body id="errorpage">';
echo '<div id="wrap">';
echo '<div id="page-header">';
echo '<a href='.$phpbb_root_path.'>Return to index page</a>';
echo '</div>';
echo '<div id="acp">';
echo '<div class="panel">';
echo '<div id="content">';
echo '<h1>TAG BOARD 4 phpBB3 v'.$tb_version.'</h1>';
echo '<div><form method="post"><select name="mode"><option value="install">Install</option><option value="update">Update</option></select> <input name="submit" type="submit" value="Next"></form></div>';
echo '</div>';
echo '</div>';
echo '</div>';
echo '</div>';
echo '</body>';
echo '</html>';
break;
}
?>