Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$db is not defined in class_style.php #13

Open
GoogleCodeExporter opened this issue Jul 15, 2015 · 0 comments
Open

$db is not defined in class_style.php #13

GoogleCodeExporter opened this issue Jul 15, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

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 [email protected] on 2 Apr 2012 at 1:01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant