Przeglądaj źródła

Some changes to avoid PHP warnings.

DieFeM 7 lat temu
rodzic
commit
3a8ffec3dc

+ 14 - 31
modules/TS3Admin/ts3webinterface.class.php

@@ -40,10 +40,10 @@ function getAssignedServerUsers()
 		}
 	}
 	$subusers = $db->getUsersSubUsersIds($_SESSION['user_id']);
+	$subusersb = array();
+	$subusers_list = array();
 	if(is_array($subusers))
 	{
-		$subusers_list = array();
-		$subusersb = array();
 		foreach($subusers as $subuser)
 		{
 			if(!in_array($subuser,$users_assigned))
@@ -197,17 +197,6 @@ class TS3webinterface
 	
 	private function loadLanguage($lang=false)
 	{
-		$includeStandardFile = 'lang/English/modules/TS3Admin.php';
-		$includeLangFile = 'lang/'.(($lang != false) ? $lang : TS3WEBINTERFACE_LANG).'/modules/TS3Admin.php';
-
-		if( $includeLangFile != $includeStandardFile && file_exists($includeLangFile) )
-		{
-			require($includeLangFile);// overwrite standard strings
-		}
-		else
-		{
-			require($includeStandardFile);
-		}
 		$constants = get_defined_constants(true);
 		$this->language = $constants['user'];
 	}
@@ -616,24 +605,17 @@ class TS3webinterface
 			
 			if( $this->session['lvserver'] == 0 )
 			{
-				$this->template->assign('title', $this->language['title'].' :: '.$this->language['login']);
 				$this->template->display('header.tpl');
 
 				$addData = array();
-
-				/*if( !isset($_GET['do']) ) $_GET['do'] = '';
-				switch($_GET['do'])
-				{
-				case 'addserver':*/
+				
 				if( isset($_GET['do']) && $_GET['do'] == 'addserver' )
 				{
 					if( isset($_POST['serverAddSubmit']) && !empty($_POST['servername']) && !empty($_POST['serverslots']) )
 					{
 						if( $addData = $this->server->r_servercreate($_POST['servername'], array(array('virtualserver_maxclients', $_POST['serverslots']))) )
 						{
-							//$addData = $this->server->de_escape($addData[0]);
 							$addData = $addData[0];
-
 							array_unshift($addData, 'OK');
 						}
 						else
@@ -647,9 +629,7 @@ class TS3webinterface
 						$addData = array('ERROR', 0, $this->language['e_fill_out']);
 					}
 				}
-					/*break;
-				}*/
-
+				
 				$vServerList = $this->server->r_serverlist();
 				if( !isset($vServerList[0]) )
 				{
@@ -681,7 +661,6 @@ class TS3webinterface
 				if( isset($_GET['liveview']) ) $this->template->assign('liveviewAutoUpdate', true);
 				else $this->template->assign('liveviewAutoUpdate', false);
 				
-				$this->template->assign('title', $this->language['title']);
 				$this->template->display('header.tpl');
 				
 				$updateAvailable = $this->checkForUpdate();
@@ -815,7 +794,8 @@ class TS3webinterface
 					$subusers_installed = $db->isModuleInstalled('subusers');
 					if( $subusers_installed )
 					{
-						$assigned_info = getAssignedServerUsers();
+						if(defined('TS3WEBINTERFACE_VSERVER_ID'))
+							$assigned_info = getAssignedServerUsers();
 						if( isset($_POST['assign_subuser']) and
 							in_array($_POST['user_id'],$assigned_info['subusers']) )
 						{
@@ -841,15 +821,18 @@ class TS3webinterface
 											"';" );
 							$assigned_info = getAssignedServerUsers();
 						}
-						$this->template->assign('subusers_assigned', $assigned_info['subusers_assigned_list']);
-						$this->template->assign('subusers', $assigned_info['subusers_list']);
-						$is_parent_user = is_array($assigned_info['subusers']);
+						if(defined('TS3WEBINTERFACE_VSERVER_ID'))
+						{
+							$this->template->assign('subusers_assigned', $assigned_info['subusers_assigned_list']);
+							$this->template->assign('subusers', $assigned_info['subusers_list']);
+							$is_parent_user = is_array($assigned_info['subusers']);
+						}
 					}
 					$this->template->assign('is_parent_user', $is_parent_user);
 					$this->template->assign('subusers_installed', $subusers_installed);
 
-	                                $getPublicIp = $db->resultQuery("SELECT display_public_ip FROM OGP_DB_PREFIXremote_servers WHERE remote_server_id=".$_SESSION['rserver_id']);
-        	                        $display_ip = checkDisplayPublicIP($getPublicIp[0]['display_public_ip'],$this->serverIP);
+					$getPublicIp = $db->resultQuery("SELECT display_public_ip FROM OGP_DB_PREFIXremote_servers WHERE remote_server_id=".$_SESSION['rserver_id']);
+					$display_ip = checkDisplayPublicIP($getPublicIp[0]['display_public_ip'],$this->serverIP);
 
 					$this->template->assign('display_public_ip', $display_ip);
 

+ 11 - 8
modules/administration/banlist.php

@@ -40,16 +40,19 @@ function exec_ogp_module()
 	$ban_list = $db->resultQuery("SELECT logging_attempts, banned_until, client_ip FROM `OGP_DB_PREFIXban_list`;");
 	$ban_qty = 0;
 	$ban_table = '';
-	foreach($ban_list as $ban)
+	if($ban_list)
 	{
-		if($ban['logging_attempts'] >= $settings["login_attempts_before_banned"])
+		foreach($ban_list as $ban)
 		{
-			$ban_table .= "<tr><td><input type=checkbox name='".$ban_qty."' value='".$ban['client_ip']."' /></td><td>".$ban['client_ip']."</td><td>".date("r",$ban['banned_until'])."</td></tr>\n";
-			$ban_qty++;
-		}
-		else
-		{
-			continue;
+			if($ban['logging_attempts'] >= $settings["login_attempts_before_banned"])
+			{
+				$ban_table .= "<tr><td><input type=checkbox name='".$ban_qty."' value='".$ban['client_ip']."' /></td><td>".$ban['client_ip']."</td><td>".date("r",$ban['banned_until'])."</td></tr>\n";
+				$ban_qty++;
+			}
+			else
+			{
+				continue;
+			}
 		}
 	}
 	if($ban_qty == 0)

+ 1 - 1
modules/gamemanager/server_monitor.php

@@ -226,7 +226,7 @@ function exec_ogp_module() {
 		unset( $_GET['home_id-mod_id-ip-port'] );
 	if ( empty( $_GET['home_id'] ) )
 		unset( $_GET['home_id'] );
-	if ( isset($_GET['home_cfg_id']) and $_GET['home_cfg_id'] ==  game_type  )
+	if ( isset($_GET['home_cfg_id']) and $_GET['home_cfg_id'] ==  get_lang('game_type') )
 		unset( $_GET['home_cfg_id'] );
 
 	create_home_selector_game_type($_GET['m'], $_GET['p'], $show_games_type);

+ 3 - 3
modules/settings/settings.php

@@ -131,7 +131,7 @@ function exec_ogp_module()
 	$tls = (isset($row['smtp_tls']) and $row['smtp_tls'] == 1) ? "checked='checked'" : "";
 	$no = (!isset($row['smtp_ssl']) or $row['smtp_ssl'] == 0 AND !isset($row['smtp_tls']) or ( isset($row['smtp_tls']) and $row['smtp_tls'] == 0)) ? "checked='checked'" : "";
 	$ft->add_custom_field('smtp_secure','<input type=radio name=smtp_secure value=0 '.$no.
-										'>'.no.'&nbsp;&nbsp;<input type=radio name=smtp_secure value=ssl '.$ssl.
+										'>'.get_lang('no').'&nbsp;&nbsp;<input type=radio name=smtp_secure value=ssl '.$ssl.
 										'>SSL&nbsp;&nbsp;<input  type=radio name=smtp_secure value=tls '.$tls.'>TLS');
 	$ft->add_field('string','smtp_login',@$row['smtp_login']);
 	$ft->add_field('password','smtp_passw',@$row['smtp_passw']);
@@ -154,7 +154,7 @@ function exec_ogp_module()
 	$ft->add_field('text','support_widget_content',@$row['support_widget_content'], 38);
 	$ft->add_field('string','support_widget_link',@$row['support_widget_link']);
 	$ft->add_custom_field('check_expiry_by',
-		create_drop_box_from_array(array('once_logged_in' => once_logged_in, 'cron_job' => cron_job),"check_expiry_by",@$row['check_expiry_by'],false));
+		create_drop_box_from_array(array('once_logged_in' => get_lang('once_logged_in'), 'cron_job' => get_lang('cron_job')),"check_expiry_by",@$row['check_expiry_by'],false));
 	$ft->add_field('string','recaptcha_site_key',@$row['recaptcha_site_key']);
 	$ft->add_field('string','recaptcha_secret_key',@$row['recaptcha_secret_key']);
 	$ft->add_field('on_off','recaptcha_use_login',@$row['recaptcha_use_login']);
@@ -172,4 +172,4 @@ function exec_ogp_module()
 	$ft->add_button("submit","update_settings",get_lang('update_settings'));
 	$ft->end_form();
 }
-?>
+?>