Explorar o código

http://opengamepanel.org/forum/viewthread.php?thread_id=5115#post_24475

OwN-3m-All %!s(int64=9) %!d(string=hai) anos
pai
achega
db7b5ddc19
Modificáronse 1 ficheiros con 15 adicións e 10 borrados
  1. 15 10
      modules/user_games/assign_home.php

+ 15 - 10
modules/user_games/assign_home.php

@@ -38,9 +38,20 @@ function exec_ogp_module()
 	
 	
 	$isAdmin = $db->isAdmin($_SESSION['user_id']);
 	$isAdmin = $db->isAdmin($_SESSION['user_id']);
 	
 	
-	if(empty($_REQUEST['group_id']) === true || $db->getGroupById($_REQUEST['group_id']) === null)
-	{
-		print_failure(get_lang('valid_group'));
+	if(isset($_REQUEST['user_id'])){
+		if(empty($_REQUEST['user_id']) || $db->getUserById($_REQUEST['user_id']) == null)
+		{
+			print_failure(get_lang('valid_user'));
+			return;
+		}
+	}else if(isset($_REQUEST['group_id'])){
+		if(empty($_REQUEST['group_id']) || $db->getGroupById($_REQUEST['group_id']) == null)
+		{
+			print_failure(get_lang('valid_group'));
+			return;
+		}
+	}else{
+		print_failure(get_lang('invalid_url'));
 		return;
 		return;
 	}
 	}
 	
 	
@@ -67,12 +78,6 @@ function exec_ogp_module()
 		echo "<p class='note'>".get_lang('not_available')."</p>";
 		echo "<p class='note'>".get_lang('not_available')."</p>";
 		return;
 		return;
 	}
 	}
-	
-	if ( !isset($_REQUEST['user_id']) && !isset($_REQUEST['group_id']) )
-	{
-		print_failure(get_lang("invalid_url"));
-		return;
-	}
 
 
 	/// \todo We might want to save this information to XML file?
 	/// \todo We might want to save this information to XML file?
 	$selections = array( "allow_updates" => "u",
 	$selections = array( "allow_updates" => "u",
@@ -282,4 +287,4 @@ function exec_ogp_module()
 	else 
 	else 
 		echo create_back_button('user_admin');
 		echo create_back_button('user_admin');
 }
 }
-?>
+?>