Really need help with Strict Standards

Hello all,

An anticipated thank you for your responses. I am getting a lot of strict standards error and i am kinda out of know-how on this. Please any helpful suggestion will be appreciated.

Strict Standards: Non-static method languages::getcurrent() should not be called statically in C:\xampp\htdocs\Maluu\include\include.php on line 61

The code is below. Thanks


<?php 
$path=dirname(__FILE__); 
global $minimal; 
if(!file_exists($path.'/../config.php')) header("Location: install/"); 
require_once($path.'/../config.php'); 
if(!isset($config_abs_path) || !isset($config_live_site))  header("Location: install/"); 
require_once($config_abs_path.'/include/tables.php'); 
require_once($config_abs_path.'/classes/mysql.php'); 
require_once($config_abs_path.'/include/form.php'); 
require_once($config_abs_path.'/classes/languages.php'); 
require_once($config_abs_path.'/classes/common.php'); 
require_once($config_abs_path.'/classes/settings.php'); 
require_once($config_abs_path.'/include/seo.php'); 
require_once $config_abs_path."/include/vars.php"; 

if(!$minimal) { 
require_once($config_abs_path.'/include/util.php'); 
require_once($config_abs_path.'/classes/listings.php'); 
require_once($config_abs_path.'/classes/auth.php'); 
require_once($config_abs_path.'/classes/categories.php'); 
require_once($config_abs_path.'/classes/fields.php'); 
require_once($config_abs_path.'/classes/depending_fields.php'); 
require_once($config_abs_path.'/classes/fieldsets.php'); 
require_once($config_abs_path.'/classes/banners.php'); 
} 

global $db; 
$db = new db_mysql(); 

if($db->error!='') header("Location: $config_live_site/offline.php"); 

global $crt_lang; 
global $crt_lang_name; 
global $crt_lang_flag; 


// set main domain  
global $main_domain; 
$main_domain = str_replace("http://www.", "", $config_live_site); 
$main_domain = str_replace("http://", "", $main_domain); 
if( (!strstr($main_domain, ".co.uk") && substr_count($main_domain, ".")>=2) || (strstr($main_domain, ".co.uk") && substr_count($main_domain, ".")>=3)) { 
    $arr = explode(".", $main_domain, 2); 
    $main_domain = $arr[1]; 
} 
if(substr_count($main_domain, "/")>=1) { 
    $arr = explode("/",$main_domain,2); 
    $main_domain = $arr[0]; 
} 

// set language using GET method 
if(isset($_GET['lang'])) { 
    $get_lang = escape(urldecode($_GET['lang'])); 
    if($get_lang != $_COOKIE['default_lang']) { 
        $expire = time() + 60*60*24*365; 
        setcookie("default_lang", $get_lang, $expire, "/", ".".$main_domain); 
        $crt_lang = $get_lang; 
    } 
} 

// get current language 
$crt_lang = languages::getCurrent(); 
$lang=$config_abs_path.'/lang/'.$crt_lang.'.php'; 
if($crt_lang) { 
    $lang_arr = languages::getLanguage($crt_lang); 
    $crt_lang_name = $lang_arr['name']; 
    $crt_lang_flag = $lang_arr['image']; 
} 

// get modules list 
global $modules_array; 
$modules_array = common::getModulesList(); 

require_once $config_abs_path."/add_hooks.php"; 

// get settings 
global $appearance_settings, $ads_settings, $settings, $seo_settings; 
$appearance_settings=settings::getAppearance(); 
$ads_settings=settings::getAdsSettings(); 
$settings=settings::getSettings(); 
$seo_settings = settings::getSeoSettings(); 

// current location 
if($settings['enable_locations']) { 
    require_once($config_abs_path.'/classes/locations.php'); 
    $lclass = new locations(); 
    $lclass->init(); 
} 

// set default timezone 
if($appearance_settings['timezone'] && function_exists('date_default_timezone_set')) 
    date_default_timezone_set($appearance_settings['timezone']); 

// include language file 
require_once($lang); 

// do include actions 
do_action("include"); 

// ******** simulate scheduler ********** 
// run once a day, first time when the script is accessed 
// and the value of LAST_DAY in last.php is not today date. 
// 
if($settings['cron_simulator']) { 

require_once($config_abs_path.'/last.php'); 

$day=date('d'); 
if(LAST_DAY!=$day) 
{ 
    write_last($day); 
    require_once($config_abs_path.'/periodic.php'); 
} 

} 

?>

Can you show us your Language class?

As the notice is stating your getcurrent() method is not marked as a static method. Which means you shouldn’t use the syntax language::getcurrent(), but rather use

$lang = new language();
$crt_lang = $lang::getCurrent();

I believe you mean to use $crt_lang = $lang->getCurrent(); No, cpradio? :stuck_out_tongue:

If I were you, I’d start by removing all global variables and learning about auto loading to remove those nasty require once statements.

sigh, yes, I got distracted while writing that (kids do that to you, I guess…).:blush: