Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 4 Articles
Managing a development area
Carnage
Join Date: Jan 2005
Posts: 760

 

uk
Show Printable Version Email this Page Subscription
Carnage Carnage is offline 01-30-2010, 10:00 PM

This is a little something I came up with to deal with having somewhere to develop mods and somewhere to test things like install code. It also deals with the password protected requirement for development areas in one nice little package.

Edit config.php, at the bottom of the file above the ?> add:

PHP Code:

if (!isset($_SERVER['PHP_AUTH_USER'])) 
{
    
header('WWW-Authenticate: Basic realm="Vbulletin Development site"');
    
header('HTTP/1.0 401 Unauthorized');
    echo 
'You must login to access this resource';
    exit;

else 
{
    if(
$_SERVER['PHP_AUTH_PW'] == $config['SpecialUsers']['htaccess'][$_SERVER['PHP_AUTH_USER']]['password'])
    {
        
$config['Database']['tableprefix'] = $config['SpecialUsers']['htaccess'][$_SERVER['PHP_AUTH_USER']]['prefix'];
        
$config['Misc']['debug'] = $config['SpecialUsers']['htaccess'][$_SERVER['PHP_AUTH_USER']]['debug'];
        if(
$config['SpecialUsers']['htaccess'][$_SERVER['PHP_AUTH_USER']]['demo'])
        {
            
define('DEMO_MODE',true);
        }
    }

Anyone who is sufficiently astute will realise that that is performing http authentification AND setting debug mode and table prefix based on the username. All you need now is an array of settings for the users that are allowed to visit your dev area.

PHP Code:
$config['SpecialUsers']['htaccess']['carnage_test1'] = array('password'=>'mypassword','prefix'=>'test1','debug'=>true,'demo'=>false);
$config['SpecialUsers']['htaccess']['carnage_test2'] = array('password'=>'mypassword','prefix'=>'test2','debug'=>true,'demo'=>false); 
Placing that array above the code from the top of this post defines two users, each of the users accesses a different database. You can then make two installs of vbulletin, sharing the same codebase. Once you've written a product, export it. Switch user (generally closing your browser is required; some browsers offer a htaccess logout button/method).

It gets better. Say you are working for two clients; developing a mod for one and a skin for another. During develoment you have two isntalls, one for each project with the prefixes above. If you want to show your client the work in progress and get some feedback you can set them up a login like this:

PHP Code:
$config['SpecialUsers']['htaccess']['clientx'] = array('password'=>'theirpassword','prefix'=>'test1','debug'=>false,'demo'=>true);
$config['SpecialUsers']['htaccess']['clienty'] = array('password'=>'theirpassword','prefix'=>'test2','debug'=>false,'demo'=>true); 
neither will be able to access the other install and the demo mode setting will prevent them from messing around with sensitive admincp controls. You should set them their own admin account up as well and don't give it any permissions such as the ability to run sql queries.

Disclaimer:
This dosn't provide 100% security as it relies upon an unsupported, undocumented feature of vb: demo mode. You should make your own tests to ensure that its secure enough for your needs.

Some uses of the information contained above may require multiple vbulletin liscenses. It is your responsibility to ensure you have enough liscenses to cover your dev installs.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:50 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08452 seconds
  • Memory Usage 2,195KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete