From f46cb42bededb64c7f2b95665f565f4b29379f9c Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 6 Sep 2014 00:35:28 +0200 Subject: [PATCH] Create shard admin user in setup --- .../private_php/setup/sql/nel_tool_00001.sql | 9 +---- .../{todo_cfg => public_php}/admin/config.php | 32 ++++++++-------- code/web/public_php/setup/header.php | 2 + code/web/public_php/setup/install.php | 37 ++++++++++++++++++- 4 files changed, 55 insertions(+), 25 deletions(-) rename code/web/{todo_cfg => public_php}/admin/config.php (71%) diff --git a/code/web/private_php/setup/sql/nel_tool_00001.sql b/code/web/private_php/setup/sql/nel_tool_00001.sql index 12ae695ad..a01a1c4a5 100644 --- a/code/web/private_php/setup/sql/nel_tool_00001.sql +++ b/code/web/private_php/setup/sql/nel_tool_00001.sql @@ -595,14 +595,7 @@ CREATE TABLE IF NOT EXISTS `neltool_users` ( UNIQUE KEY `user_login` (`user_name`), KEY `user_group_id` (`user_group_id`), KEY `user_active` (`user_active`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; - --- --- Dumping data for table `neltool_users` --- - -INSERT INTO `neltool_users` (`user_id`, `user_name`, `user_password`, `user_group_id`, `user_created`, `user_active`, `user_logged_last`, `user_logged_count`, `user_menu_style`) VALUES -(1, 'guest', '084e0343a0486ff05530df6c705c8bb4', 1, 1405357395, 1, 0, 0, 0); +) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -------------------------------------------------------- diff --git a/code/web/todo_cfg/admin/config.php b/code/web/public_php/admin/config.php similarity index 71% rename from code/web/todo_cfg/admin/config.php rename to code/web/public_php/admin/config.php index 530adcb43..0a43d798a 100644 --- a/code/web/todo_cfg/admin/config.php +++ b/code/web/public_php/admin/config.php @@ -1,30 +1,32 @@ 0, 'level_name' => 'Normal'), @@ -70,6 +72,6 @@ 'level_name' => 'Administrator'), ); - $restart_notification_emails = array('vl@ryzom.com'); + $restart_notification_emails = array('support@ryzomcore.org'); ?> diff --git a/code/web/public_php/setup/header.php b/code/web/public_php/setup/header.php index 1c7b4cda0..317637ef8 100644 --- a/code/web/public_php/setup/header.php +++ b/code/web/public_php/setup/header.php @@ -112,6 +112,8 @@ function update_database_structure($continue_r, $con, $file) { admin/common.php"); + $continue = false; + } + } + if ($continue) { + try { + require_once('functions_tool_administration.php'); + } catch (Exception $e) { + printalert("danger", "Failed to include NeL admin/functions_tool_administration.php"); + $continue = false; + } + } + if ($continue) { + $adminGroup = 1; + $result = tool_admin_users_add($_POST["toolsAdminUsername"], $_POST["toolsAdminPassword"], (string)$adminGroup, (string)1); + if ($result == "") { + printalert("success", "Added shard admin to NeL tools database"); + } else { + printalert("danger", "Failed to add shard admin to NeL tools database
" . htmlentities($result)); + $continue = false; + } + } + if (!chdir("../")) { + printalert("danger", "Cannot change to public PHP root directory"); + $continue = false; + } } if ($roleSupport) {