UBB.Dev
Posted By: Cola table prefix hack for BETA 6 - 04/27/2002 3:01 PM
// TablePrefix Addon (C) 27.4.2002 C. Gogoll
// This hack is for running more than one forum under one domain and one
// database. Please read the license information from your original ubbthreads.
// Only for testing other hacks without the risk of destroying tables!!!
// I´m not responisble for any use of this hack, e.g lost databases etc !!!!!!!
// It´s allways a good idea to backup your database before you modify any script !!!
// For right use do the following steps ONLY in this order:
//
// 1. make sure ubbthreads runs in its orginal configuration.
// Lets say it is installed in /home/httpd/forum/
// 2. Make a new directory like /home/httpd/forum-test/
// 3. Copy your complete install version to the dir created in step 2
// 4. run the install script: /home/httpd/forum-test/install.php
// DON´T klick on the link to thee createtable script !!!!
// 5. make the following changes manualy to the createtable script:
// check for the following line in the script: "// Let's see if this has already been run"
// after this line add these 2 lines without the // at the beginnig:
// $CheckTable = "w3t_Posts";
// if (isset($config['TblNme_w3t_Posts'])) {$CheckTable = $config['TblNme_w3t_Posts']};
// 6. replace the "do_query" function in the mysql.inc.php script with these one:
// // #######################################################################
// // Do the query
// // #######################################################################
// function do_query($query) {
// global $querycount;
// $querycount++;
//
// global $config;
// if (isset($config['TblNme_w3t_AdressBook'])) {$query = str_replace("w3t_AdressBook", $config['TblNme_w3t_AdressBook'],$query);}
// if (isset($config['TblNme_w3t_Banned'])) {$query = str_replace("w3t_Banned", $config['TblNme_w3t_Banned'] ,$query);}
// if (isset($config['TblNme_w3t_Boards'])) {$query = str_replace("w3t_Boards", $config['TblNme_w3t_Boards'] ,$query);}
// if (isset($config['TblNme_w3t_Category'])) {$query = str_replace("w3t_Category", $config['TblNme_w3t_Category'] ,$query);}
// if (isset($config['TblNme_w3t_Favorites'])) {$query = str_replace("w3t_Favorites", $config['TblNme_w3t_Favorites'] ,$query);}
// if (isset($config['TblNme_w3t_Groups'])) {$query = str_replace("w3t_Groups", $config['TblNme_w3t_Groups'] ,$query);}
// if (isset($config['TblNme_w3t_Last'])) {$query = str_replace("w3t_Last", $config['TblNme_w3t_Last'] ,$query);}
// if (isset($config['TblNme_w3t_Messages'])) {$query = str_replace("w3t_Messages", $config['TblNme_w3t_Messages'] ,$query);}
// if (isset($config['TblNme_w3t_ModNotify'])) {$query = str_replace("w3t_ModNotify", $config['TblNme_w3t_ModNotify'] ,$query);}
// if (isset($config['TblNme_w3t_Moderators'])) {$query = str_replace("w3t_Moderators", $config['TblNme_w3t_Moderators'],$query);}
// if (isset($config['TblNme_w3t_Online'])) {$query = str_replace("w3t_Online", $config['TblNme_w3t_Online'] ,$query);}
// if (isset($config['TblNme_w3t_PollData'])) {$query = str_replace("w3t_PollData", $config['TblNme_w3t_PollData'] ,$query);}
// if (isset($config['TblNme_w3t_Polls'])) {$query = str_replace("w3t_Polls", $config['TblNme_w3t_Polls'] ,$query);}
// if (isset($config['TblNme_w3t_Posts'])) {$query = str_replace("w3t_Posts", $config['TblNme_w3t_Posts'] ,$query);}
// if (isset($config['TblNme_w3t_Subscribe'])) {$query = str_replace("w3t_Subscribe", $config['TblNme_w3t_Subscribe'] ,$query);}
// if (isset($config['TblNme_w3t_Users'])) {$query = str_replace("w3t_Users", $config['TblNme_w3t_Users'] ,$query);}
//
// $this->sth = mysql_query($query,$this->dbh);
// if (!$this->sth) {
// $this->not_right("Unable to do_query: $query");
// }
// return $this->sth;
// }
// 7. add the following lines to config.inc.php at the end:
// $config['TblNme_w3t_AdressBook'] = "w3t_AdressBook";
// $config['TblNme_w3t_Banned'] = "w3t_Banned";
// $config['TblNme_w3t_Boards'] = "w3t_Boards";
// $config['TblNme_w3t_Category'] = "w3t_Category";
// $config['TblNme_w3t_Favorites'] = "w3t_Favorites";
// $config['TblNme_w3t_Groups'] = "w3t_Groups";
// $config['TblNme_w3t_Last'] = "w3t_Last";
// $config['TblNme_w3t_Messages'] = "w3t_Messages";
// $config['TblNme_w3t_ModNotify'] = "w3t_ModNotify";
// $config['TblNme_w3t_Moderators'] = "w3t_Moderators";
// $config['TblNme_w3t_Online'] = "w3t_Online";
// $config['TblNme_w3t_PollData'] = "w3t_PollData";
// $config['TblNme_w3t_Polls'] = "w3t_Polls";
// $config['TblNme_w3t_Posts'] = "w3t_Posts";
// $config['TblNme_w3t_Subscribe'] = "w3t_Subscribe";
// $config['TblNme_w3t_Users'] = "w3t_Users";
// 8. change any table name to the table name you want.
// 9. depending on what you wanna do there are 2 way:
// 1.) install a new forum with no data in it: run createtable.php and enjoy []/forum/images/icons/wink.gif[/]
// 2.) if you wanna get a copy of one or more database tables in the new install,you have to create
// the new table manualy (select dump in PHPmyAdmin (only structure) and send the generated
// output back as a command to PHPmyAdmin where you edit the table name. Then make
// a table copy like 'INSERT INTO YYY_AddressBook SELECT * FROM w3t_AddressBook;' in PhpMyAdmin
// for ALL tables and the run the needed update script which are descriped in update.html
//


so long

Cola
Posted By: AllenAyres Re: table prefix hack for BETA 6 - 08/21/2002 8:16 PM
I believe soemthing like this is standard in 6.1 now
© UBB.Developers