argosback / bnpanel

Automatically exported from code.google.com/p/bnpanel
Other
0 stars 0 forks source link

$db is not defined in class_style.php #13

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Clone the latest available in repository 
2. Upload to a webserver
3. Navigate to site

What is the expected output? What do you see instead?
I'm expecting to be sent to install/ but I get a blank page with the following 
error:
PHP Fatal error:  Call to a member function config() on a non-object in 
/media/sf_Workspace/THT1.3/bnpanel/includes/class_style.php on line 172

What version of the product are you using? On what operating system?
The latest.

Please provide any additional information below.

More Info:

I took the time to review the code, it appears that $db is never defined only 
if conf.inc.php is created first. Code snippet below: 

//Grab DB First
require INCLUDES."class_db.php"; # Get the file

if (file_exists(INCLUDES."conf.inc.php")) {
    require INCLUDES."conf.inc.php"; # Get the config
    define("NOCONFIG", false);
} else {
    define("NOCONFIG", true);
}

if (isset($sql) && $sql['install']) {   
    define('INSTALL', 1);   
    $db = new db();     
    global $db;
    $db->getSystemConfigList();

    define('SERVER_STATUS', $db->config('server_status')); # Set the default theme  
} else {
    //Default constants
    define('SERVER_STATUS', 'test');
    define("INSTALL", 0);
}

but you make a call to style with the following:

$available_classes = array('addon', 'billing', 'currency', 'email', 'invoice', 
'order', 'style','package', 'server', 'staff', 'ticket', 'type','user', 
'extrafield','controller');

foreach($available_classes as $class_item) {
    ${$class_item} = new $class_item();
    global ${$class_item};      
}

Original issue reported on code.google.com by ad...@bombshellz.net on 2 Apr 2012 at 1:01