own3mall 9 лет назад
Родитель
Сommit
48d13de9ad

+ 5 - 0
index.php

@@ -39,6 +39,11 @@ require_once("includes/html_functions.php");
 // Start the session valid for opengamepanel_web only
 startSession();
 
+// Logged in user settings - access this global variable where needed
+if(hasValue($_SESSION['user_id'])){
+	$loggedInUserInfo = $db->getUserById($_SESSION['user_id']);
+}
+
 // Useful for debugging :)
 // echo "<p>Session ID is " . session_id() . "</p>";
 // echo "<p>Lifetime is: " . $cookie_lifetime . "<br />Dir is " . rtrim(dirname($_SERVER["SCRIPT_NAME"]),"/") . "/" . "<br /> Session cookie domain path is " . $session_cookie_domain_path . "<br />SSL is " . $ssl . "</p>";

+ 7 - 3
modules/administration/watch_logger.php

@@ -26,7 +26,7 @@
  *
  */
 function exec_ogp_module() {
-	global $db;
+	global $db, $loggedInUserInfo;
 	echo "<h2>".get_lang('watch_logger')."</h2>";
 	?>
 	<!-- Search, Empty Logger, and Paging Options Table -->
@@ -68,6 +68,10 @@ function exec_ogp_module() {
 	$p = isset($_GET['page']) ? $_GET['page'] : 1;
 	$l = isset($_GET['limit']) ? $_GET['limit'] : 10;
 	
+	if(hasValue($loggedInUserInfo) && is_array($loggedInUserInfo) && $loggedInUserInfo["users_page_limit"]){
+		$l = $loggedInUserInfo["users_page_limit"];
+	}
+	
 	$logs = $db->read_logger($p,$l);
 	
 	if($logs)
@@ -124,8 +128,8 @@ function exec_ogp_module() {
 			if($page == $p){
 				$pagination .= " <b>$page</b>,";
 			}else{
-				if(isset($_GET['limit'])){
-					$limits = $_GET['limit'];
+				if(isset($l)){
+					$limits = $l;
 					$pagination .= "<a href='?m=administration&p=watch_logger&page=$page&limit=$limits'>$page</a>,";
 				}else{
 					$pagination .= " <a href='?m=administration&p=watch_logger&page=$page' >$page</a>,";

+ 7 - 3
modules/gamemanager/server_monitor.php

@@ -119,7 +119,7 @@ function get_sync_name($server_xml)
 }
 
 function exec_ogp_module() {
-	global $db, $settings;
+	global $db, $settings, $loggedInUserInfo;
 	echo "<h2>". game_monitor ."</h2>";
 	$refresh = new refreshed();
 	set_time_limit(0);
@@ -131,6 +131,10 @@ function exec_ogp_module() {
 	$home_page = isset($_GET['page']) ? $_GET['page'] : 1;
 	$home_limit = isset($_GET['limit']) ? $_GET['limit'] : 10;
 	
+	if(hasValue($loggedInUserInfo) && is_array($loggedInUserInfo) && $loggedInUserInfo["users_page_limit"]){
+		$home_limit = $loggedInUserInfo["users_page_limit"];
+	}
+	
 	$isAdmin = $db->isAdmin( $_SESSION['user_id'] );
 	
 	if ( $isAdmin )
@@ -650,8 +654,8 @@ function exec_ogp_module() {
 				$pagination .= " <b>$page</b>,";
 				if($total_pages <= 1){$pagination = "";}
 			}else{
-				if(isset($_GET['limit'])){
-					$limits = $_GET['limit'];
+				if(isset($home_limit)){
+					$limits = $home_limit;
 					$pagination .= "<a href='?m=gamemanager&p=game_monitor&page=$page&limit=$limits'>$page</a>,";
 				}else{
 					$pagination .= " <a href='?m=gamemanager&p=game_monitor&page=$page' >$page</a>,";

+ 11 - 0
modules/user_admin/edit_user.php

@@ -99,6 +99,7 @@ function exec_ogp_module() {
 		$phone = sanitizeInputStr($_POST['phone_number']);
 		$phone = preg_replace("/[^0-9]/", "", $phone);
 		$theme = sanitizeInputStr($_POST['theme']);
+		$page_limit = sanitizeInputStr($_POST['page_limit']);
 
 		// OGP needs to set the new theme and language in the current session, only if I'm modifying my own user profile.
 		if ( $my_user_id == $user_id )
@@ -148,6 +149,15 @@ function exec_ogp_module() {
 			$fields['users_theme'] = NULL;
 		else
 			$fields['users_theme'] = $theme;
+			
+		if (empty($page_limit) || !is_numeric($page_limit) || $page_limit < 10){
+			$fields['users_page_limit'] = 25;
+		}else{
+			if($page_limit > 9999){
+				$page_limit = 9999;
+			}
+			$fields['users_page_limit'] = $page_limit;
+		}
 
 		if ( isset($_POST['new_password']) && !empty($_POST['new_password']) )
 			$fields['users_passwd'] = md5($_POST['new_password']);
@@ -208,6 +218,7 @@ function exec_ogp_module() {
 	}
 
 	$ft->add_custom_field('theme', get_theme_html_str($theme, $add_empty));
+	$ft->add_field('string','page_limit',$userInfo['users_page_limit']);
 	$ft->add_field('string','first_name',$userInfo['users_fname']);
 	$ft->add_field('string','last_name',$userInfo['users_lname']);
 	$ft->add_field('string','phone_number',$userInfo['users_phone']);

+ 2 - 1
modules/user_admin/module.php

@@ -25,7 +25,7 @@
 // Module general information
 $module_title = "User admin";
 $module_version = "1.1";
-$db_version = 5;
+$db_version = 6;
 $module_required = TRUE;
 $module_menus = array(
     array( 'subpage' => '', 'name'=>'User Admin', 'group'=>'admin' ),
@@ -90,4 +90,5 @@ $install_queries[3] = array(
 	"ALTER TABLE `".OGP_DB_PREFIX."users` ADD UNIQUE `email` (`users_email`);");
 $install_queries[4] = array("UPDATE ".OGP_DB_PREFIX."users SET users_email = DEFAULT WHERE users_email = '';");
 $install_queries[5] = array("ALTER TABLE `".OGP_DB_PREFIX."user_groups` MODIFY group_id int(11) NOT NULL;");
+$install_queries[6] = array("ALTER TABLE `".OGP_DB_PREFIX."users` ADD `users_page_limit` int(11) NULL DEFAULT 25;");
 ?>

+ 7 - 3
modules/user_admin/show_users.php

@@ -45,11 +45,15 @@ td.actions{
  *
  */
 function exec_ogp_module() {
-    global $db;
+    global $db, $loggedInUserInfo;
 	
 	$page_user = isset($_GET['page']) ? $_GET['page'] : 1;
 	$limit_user = isset($_GET['limit']) ? $_GET['limit'] : 10;
 	
+	if(hasValue($loggedInUserInfo) && is_array($loggedInUserInfo) && $loggedInUserInfo["users_page_limit"]){
+		$limit_user = $loggedInUserInfo["users_page_limit"];
+	}
+	
     echo '<h2>'.get_lang('users')."</h2>";
 	echo "<p><a href='?m=user_admin&amp;p=add'>".get_lang('add_new_user')."</a></p>";
     echo '<table class="userListTable center" style="width: 100%;">';
@@ -106,8 +110,8 @@ function exec_ogp_module() {
 			if($page == $page_user){
 				$pagination .= " <b>$page</b>,";
 			}else{
-				if(isset($_GET['limit'])){
-					$limits = $_GET['limit'];
+				if(isset($limit_user)){
+					$limits = $limit_user;
 					$pagination .= "<a href='?m=user_admin&page=$page&limit=$limits'>$page</a>,";
 				}else{
 					$pagination .= " <a href='?m=user_admin&page=$page' >$page</a>,";

+ 7 - 3
modules/user_games/show_homes.php

@@ -25,11 +25,15 @@
 
 function exec_ogp_module()
 {
-	global $db;
+	global $db, $loggedInUserInfo;
 
 	$page_GameHomes = isset($_GET['page']) ? $_GET['page'] : 1;
 	$limit_GameHomes = isset($_GET['limit']) ? $_GET['limit'] : 10;
 	
+	if(hasValue($loggedInUserInfo) && is_array($loggedInUserInfo) && $loggedInUserInfo["users_page_limit"]){
+		$limit_GameHomes = $loggedInUserInfo["users_page_limit"];
+	}
+	
 	echo "<h2>".get_lang('game_servers')."</h2>";
 	echo "<p><a href='?m=user_games&amp;p=add'>".get_lang('add_new_game_home')."</a></p>";
 
@@ -82,8 +86,8 @@ function exec_ogp_module()
 				$pagination .= " <b>$page</b>,";
 				if($total_pages <= 1){$pagination = "";}
 			}else{
-				if(isset($_GET['limit'])){
-					$limits = $_GET['limit'];
+				if(isset($limit_GameHomes)){
+					$limits = $limit_GameHomes;
 					$pagination .= "<a href='?m=user_games&page=$page&limit=$limits'>$page</a>,";
 				}else{
 					$pagination .= " <a href='?m=user_games&page=$page' >$page</a>,";