|
From: <and...@us...> - 2007-10-14 15:52:36
|
Revision: 72
http://thevr.svn.sourceforge.net/thevr/?rev=72&view=rev
Author: andrewbelcher
Date: 2007-10-14 08:52:37 -0700 (Sun, 14 Oct 2007)
Log Message:
-----------
Updated to include two new fields, 'user_sites' on `users_table` and 'default_url' on `sites` table.
Also cleaned up the code, lots of ' and " not used according to the coding guidelines.
Modified Paths:
--------------
mods/pms/branches/permissions/thevr_pms_install.php
Modified: mods/pms/branches/permissions/thevr_pms_install.php
===================================================================
--- mods/pms/branches/permissions/thevr_pms_install.php 2007-10-14 15:27:34 UTC (rev 71)
+++ mods/pms/branches/permissions/thevr_pms_install.php 2007-10-14 15:52:37 UTC (rev 72)
@@ -29,13 +29,13 @@
* Create New Tables
**/
/* _site_config */
- $sql = "CREATE TABLE `" . $table_prefix . "site_config` (
+ $sql = 'CREATE TABLE `' . $table_prefix . 'site_config` (
`config_name` varchar(255) character set latin1 collate latin1_general_ci NOT NULL,
`config_value` varchar(255) character set latin1 collate latin1_general_ci NOT NULL,
`is_dynamic` tinyint(1) NOT NULL,
`site_id` mediumint(4) NOT NULL,
`overide` tinyint(1) NOT NULL,
- )";
+ )';
if($db->sql_query($sql))
{
@@ -47,12 +47,12 @@
}
/* _site_urls */
- $sql = "CREATE TABLE `" . $table_prefix . "site_urls` (
+ $sql = 'CREATE TABLE `' . $table_prefix . 'site_urls` (
`id` mediumint(8) NOT NULL auto_increment,
`site_id` mediumint(4) NOT NULL,
`domain` varchar(255) character set utf8 collate utf8_bin NOT NULL,
PRIMARY KEY (`id`)
- )";
+ )';
if($db->sql_query($sql))
{
@@ -65,7 +65,7 @@
/* _sites */
- $sql = "CREATE TABLE `" . $table_prefix . "sites` (
+ $sql = 'CREATE TABLE `' . $table_prefix . "sites` (
`site_id` mediumint(4) NOT NULL auto_increment,
`name` varchar(255) character set utf8 collate utf8_bin NOT NULL,
`description` varchar(255) character set utf8 collate utf8_bin NOT NULL,
@@ -73,6 +73,7 @@
`home` varchar(255) character set utf8 collate utf8_bin NOT NULL default 'index.php',
`default_style` tinyint(4) NOT NULL default '1',
`site_all` tinyint(1) NOT NULL default '0',
+ `default_url` mediumint(8) NOT NULL,
PRIMARY KEY (`site_id`)
)";
@@ -85,12 +86,11 @@
define('ERROR',true);
}
-
if(defined('ERROR'))
{
foreach($success as $i => $table)
{
- $sql = "DROP TABLE " . $table_prefix . $table . " ";
+ $sql = 'DROP TABLE `' . $table_prefix . $table . '`';
@$db->sql_query($sql);
}
@@ -100,7 +100,7 @@
/***
* Insert Permissions
**/
- $sql = "INSERT INTO " . ACL_OPTIONS_TABLE . " ( `auth_option_id` , `auth_option` , `is_global` , `is_local` , `founder_only` )
+ $sql = 'INSERT INTO ' . ACL_OPTIONS_TABLE . " ( `auth_option_id` , `auth_option` , `is_global` , `is_local` , `founder_only` )
VALUES ( NULL , 'a_sites_a', '1', '0', '0' ),
( NULL , 'a_sites_e', '1', '0', '0' ),
( NULL , 'a_sites_d', '1', '0', '0' ),
@@ -111,7 +111,7 @@
{
foreach($success as $i => $table)
{
- $sql = "DROP TABLE " . $table_prefix . $table . " ";
+ $sql = 'DROP TABLE `' . $table_prefix . $table . '`';
@$db->sql_query($sql);
}
@@ -121,13 +121,13 @@
/***
* Update forums table
**/
- $sql = "ALTER TABLE `phpbb_forums` ADD `site_id` MEDIUMINT( 4 ) NOT NULL DEFAULT '0';";
+ $sql = 'ALTER TABLE `' . FORUMS_TABLE . "` ADD `site_id` MEDIUMINT( 4 ) NOT NULL DEFAULT '0'";
if(!$db->sql_query($sql))
{
foreach($success as $i => $table)
{
- $sql = "DROP TABLE " . $table_prefix . $table . " ";
+ $sql = 'DROP TABLE `' . $table_prefix . $table . '`';
@$db->sql_query($sql);
}
$sql = "DELETE
@@ -139,12 +139,35 @@
}
/***
+ * Update users table
+ **/
+ $sql = 'ALTER TABLE `' . USERS_TABLE . '` ADD `user_sites` VARCHAR(255) NOT NULL';
+
+ if(!$db->sql_query($sql))
+ {
+ foreach($success as $i => $table)
+ {
+ $sql = 'DROP TABLE `' . $table_prefix . $table . '`';
+ @$db->sql_query($sql);
+ }
+ $sql = "DELETE
+ FROM " . ACL_OPTIONS_TABLE . "
+ WHERE auth_option_id LIKE 'a_sites_%'";
+ @$db->sql_query($sql);
+
+ $sql = 'ALTER TABLE `' . FORUMS_TABLE . '` DROP `site_id`';
+ @$db->sql_query($sql);
+
+ trigger_error('TheVR Mod :: Failed to alter users table');
+ }
+
+ /***
* Set Up admin Panel Module
**/
$sql = 'SELECT right_id
- FROM ' . MODULES_TABLE . '
- WHERE module_class = \'acp\'
- ORDER BY right_id DESC';
+ FROM ' . MODULES_TABLE . "
+ WHERE module_class = 'acp'
+ ORDER BY right_id DESC";
$result = $db->sql_query($sql);
$posnum = $db->sql_fetchfield('right_id',0,$result) + 1;
@@ -165,17 +188,20 @@
{
foreach($success as $i => $table)
{
- $sql = "DROP TABLE " . $table_prefix . $table . " ";
+ $sql = 'DROP TABLE `' . $table_prefix . $table . '`';
@$db->sql_query($sql);
}
- $sql = "DELETE
- FROM " . ACL_OPTIONS_TABLE . "
+ $sql = 'DELETE
+ FROM ' . ACL_OPTIONS_TABLE . "
WHERE auth_option_id LIKE 'a_sites_%'";
@$db->sql_query($sql);
- $sql = 'ALTER TABLE ' . FORUMS_TABLE . ' DROP COLUMN `site_id`';
+ $sql = 'ALTER TABLE `' . FORUMS_TABLE . '` DROP `site_id`';
@$db->sql_query($sql);
+
+ $sql = 'ALTER TABLE `' . USERS_TABLE . '` DROP `user_sites`';
+ @$db->sql_query($sql);
trigger_error('TheVR Mod :: Failed to add sites category');
}
@@ -242,17 +268,20 @@
{
foreach($success as $i => $table)
{
- $sql = "DROP TABLE " . $table_prefix . $table . " ";
+ $sql = 'DROP TABLE `' . $table_prefix . $table . '`';
@$db->sql_query($sql);
}
$sql = 'DELETE
- FROM ' . ACL_OPTIONS_TABLE . '
- WHERE auth_option_id LIKE \'a_sites_%\'';
+ FROM ' . ACL_OPTIONS_TABLE . "
+ WHERE auth_option_id LIKE 'a_sites_%'";
@$db->sql_query($sql);
$sql = 'ALTER TABLE ' . FORUMS_TABLE . ' DROP COLUMN `site_id`';
@$db->sql_query($sql);
+
+ $sql = 'ALTER TABLE `' . USERS_TABLE . '` DROP `user_sites`';
+ @$db->sql_query($sql);
$sql = 'DELETE
FROM ' . MODULES_TABLE . '
@@ -331,7 +360,7 @@
{
foreach($success as $i => $table)
{
- $sql = "DROP TABLE " . $table_prefix . $table . " ";
+ $sql = 'DROP TABLE ' . $table_prefix . $table . " ";
@$db->sql_query($sql);
}
@@ -343,6 +372,9 @@
$sql = 'ALTER TABLE ' . FORUMS_TABLE . ' DROP COLUMN `site_id`';
@$db->sql_query($sql);
+ $sql = 'ALTER TABLE `' . USERS_TABLE . '` DROP `user_sites`';
+ @$db->sql_query($sql);
+
$sql = 'DELETE
FROM ' . MODULES_TABLE . '
WHERE module_id = ' . $topid;
@@ -400,22 +432,22 @@
}
break;
case 'view':
- echo "<h1>View Changes</h1><br />";
- echo "CREATE TABLE `" . $table_prefix . "site_config` (
+ echo '<h1>View Changes</h1><br />';
+ echo 'CREATE TABLE `' . $table_prefix . "site_config` (
<br /> `config_name` varchar(255) character set latin1 collate latin1_general_ci NOT NULL,
<br /> `config_value` varchar(255) character set latin1 collate latin1_general_ci NOT NULL,
<br /> `is_dynamic` tinyint(1) NOT NULL,
<br /> `site_id` mediumint(4) NOT NULL,
<br /> `overide` tinyint(1) NOT NULL
<br />)";
- echo " <br /><br /> ";
- echo "CREATE TABLE `" . $table_prefix . "site_urls` (
+ echo ' <br /><br /> ';
+ echo 'CREATE TABLE `' . $table_prefix . "site_urls` (
<br /> `id` mediumint(8) NOT NULL auto_increment,
<br /> `site_id` mediumint(4) NOT NULL,
<br /> `domain` varchar(255) character set utf8 collate utf8_bin NOT NULL,
<br />PRIMARY KEY (`id`))";
- echo " <br /><br /> ";
- echo " CREATE TABLE `" . $table_prefix . "sites` (
+ echo ' <br /><br /> ';
+ echo ' CREATE TABLE `' . $table_prefix . "sites` (
<br /> `site_id` mediumint(4) NOT NULL auto_increment,
<br /> `name` varchar(255) character set utf8 collate utf8_bin NOT NULL,
<br /> `description` varchar(255) character set utf8 collate utf8_bin NOT NULL,
@@ -423,18 +455,20 @@
<br /> `home` varchar(255) character set utf8 collate utf8_bin NOT NULL default 'index.php',
<br /> `default_style` tinyint(4) NOT NULL default '1',
<br />PRIMARY KEY (`site_id`))";
- echo " <br /><br /> ";
- echo " INSERT INTO `phpbb_acl_options` ( `auth_option_id` , `auth_option` , `is_global` , `is_local` , `founder_only` ) VALUES ( NULL , 'a_sites_a', '1', '0', '0' );<br />
+ echo ' <br /><br /> ';
+ echo ' INSERT INTO `' . $table_prefix . "acl_options` ( `auth_option_id` , `auth_option` , `is_global` , `is_local` , `founder_only` ) VALUES ( NULL , 'a_sites_a', '1', '0', '0' );<br />
<br />INSERT INTO `phpbb_acl_options` ( `auth_option_id` , `auth_option` , `is_global` , `is_local` , `founder_only` ) VALUES ( NULL , 'a_sites_e', '1', '0', '0' );<br />
<br />INSERT INTO `phpbb_acl_options` ( `auth_option_id` , `auth_option` , `is_global` , `is_local` , `founder_only` ) VALUES ( NULL , 'a_sites_d', '1', '0', '0' );<br />
<br />INSERT INTO `phpbb_acl_options` ( `auth_option_id` , `auth_option` , `is_global` , `is_local` , `founder_only` ) VALUES ( NULL , 'a_sites_ug', '1', '0', '0' );<br />
<br />INSERT INTO `phpbb_acl_options` ( `auth_option_id` , `auth_option` , `is_global` , `is_local` , `founder_only` ) VALUES ( NULL , 'a_sites_f', '1', '0', '0' );";
- echo " <br /><br /> ";
- echo " ALTER TABLE `phpbb_forums` ADD `site_id` MEDIUMINT( 4 ) NOT NULL DEFAULT '0';";
+ echo ' <br /><br /> ';
+ echo " ALTER TABLE `' . $table_prefix . 'forums` ADD `site_id` MEDIUMINT( 4 ) NOT NULL DEFAULT '0';";
+ echo ' <br /><br /> ';
+ echo ' ALTER TABLE `' . $table_prefix . 'users` ADD `user_sites` VARCHAR(255) NOT NULL;';
break;
default:
- echo "<h1>TheVR Pseudo Multi-Site (PMS) Mod </h1><br />";
- echo "<a href=\"thevr_pms_install.php?mode=install\">Fresh Install</a>
+ echo '<h1>TheVR Pseudo Multi-Site (PMS) Mod </h1><br />';
+ echo '<a href="thevr_pms_install.php?mode=install">Fresh Install</a>
<br />
<br />
<b>Upgrade From:</b>
@@ -443,7 +477,7 @@
<li>...</li>
</ul>
<br />
- <a href=\"thevr_pms_install.php?mode=view\">View Changes</a>";
+ <a href="thevr_pms_install.php?mode=view">View Changes</a>';
break;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|