No changes

This commit is contained in:
Frank Harris 2025-09-11 13:29:15 -04:00
parent 8680a02b13
commit b6b398f5bf
17374 changed files with 2475441 additions and 0 deletions

View file

@ -0,0 +1,12 @@
.left {
margin-left:auto;
margin-right:auto;
text-align:left;
}
.right
{
margin-left:auto;
margin-right:auto;
text-align:right;
}

View file

@ -0,0 +1,103 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
//Open Game Panel Subusers Addon By
// OwN-3m-All
require_once("includes/functions.php");
function exec_ogp_module()
{
global $db,$view;
$errmsg_arr = array();
//Array to store input values
$input = array();
//Validation error flag
$errflag = false;
//Function to sanitize values received from the form. Prevents SQL injection
function clean($str) {
$str = @trim($str);
if(get_magic_quotes_gpc()) {
$str = stripslashes($str);
}
return $str;
}
//Sanitize the POST values
$users_login = sanitizeInputStr($_POST['users_login']);
$users_passwd = clean($_POST['users_passwd']);
$users_cpasswd = clean($_POST['users_cpasswd']);
$parent_user = clean($_SESSION['user_id']);
if( !empty($users_login) ) {
$input['users_login'] = $users_login;
}
//Input Validations
if($users_login == '') {
$errmsg_arr[] = get_lang('err_login_name');
$errflag = true;
}
if($users_passwd == '') {
$errmsg_arr[] = get_lang('err_password');
$errflag = true;
}
if($users_cpasswd == '') {
$errmsg_arr[] = get_lang('err_confirm_password');
$errflag = true;
}
if( strcmp($users_passwd, $users_cpasswd) != 0 ) {
$errmsg_arr[] = get_lang('err_password_mismatch');
$errflag = true;
}
if(empty($parent_user)){
$errmsg_arr[] = get_lang('err_parent_user');
$errflag = true;
}
//Create INSERT query
if( !$errflag )
{
if(!$db->addUser($users_login,$users_passwd,"subuser",NULL,$parent_user))
{
$errmsg_arr[] = get_lang('err_login_name');
$errflag = true;
}
echo "<p>" . get_lang_f('subuser_added',$users_login) . "</p>";
$view->refresh("?m=subusers&p=submanage", 5);
}
//If there are input validations, redirect back to the registration form
if($errflag) {
$_SESSION['ERRMSG_ARR'] = $errmsg_arr;
$_SESSION['INPUT'] = $input;
$view->refresh("home.php?m=subusers&p=add",0);
}
}
?>

View file

@ -0,0 +1,86 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
//Open Game Panel Sub User Registration Add On By
// own3mall
function exec_ogp_module()
{
global $db,$view;
if( isset($_SESSION['ERRMSG_ARR']) && is_array($_SESSION['ERRMSG_ARR']) && count($_SESSION['ERRMSG_ARR']) >0 )
{
$errmsg = '<table>';
foreach($_SESSION['ERRMSG_ARR'] as $msg)
{
$errmsg .= "<tr><td><img width='8px' src='images/offline.png'/></td><td style='text-align:left;color:red;'>".$msg.'</td></tr>';
}
$errmsg .= '</table><br>';
unset($_SESSION['ERRMSG_ARR']);
}
echo "<h2>".get_lang('create_sub_user')."</h2>";
if(isset($errmsg))
{
echo $errmsg;
$input = $_SESSION['INPUT'];
}
?>
<form name="loginForm" method="post" action="?m=subusers&p=adduser">
<table>
<tr>
<td class="right">
<?php echo get_lang('login_name'); ?>
</td>
<td class="left">
<input name="users_login" type="text" size="25" id="users_login" value="<?php if(isset($input['users_login'])) echo $input['users_login']; ?>" />
</td>
</tr>
<tr>
<td class="right">
<?php echo get_lang('subuser_password'); ?>
</td>
<td class="left">
<input name="users_passwd" type="password" size="25" id="users_passwd" />
</td>
</tr>
<tr>
<td class="right">
<?php echo get_lang('confirm_password'); ?>
</td>
<td class="left">
<input name="users_cpasswd" type="password" size="25" id="users_cpasswd" />
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="left">
<input type="submit" name="Submit" value="<?php echo get_lang('create_sub_user'); ?>" />
</td>
</tr>
</table>
</form>
<?php
}
?>

View file

@ -0,0 +1,128 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
//Open Game Panel Sub User Add On By
// own3mall
function exec_ogp_module() {
require_once ("includes/functions.php");
global $db;
global $view;
startSession();
// Unset refer session used to redirect back to subusers page after editing account information
if(isset($_SESSION['REFER'])){
unset($_SESSION['REFER']);
}
if (isset($_SESSION['ERRMSG_ARR']) && is_array($_SESSION['ERRMSG_ARR']) && count($_SESSION['ERRMSG_ARR']) > 0) {
$errmsg = '<table>';
foreach ($_SESSION['ERRMSG_ARR'] as $msg) {
$errmsg.= "<tr><td><img width='8px' src='images/offline.png'/></td><td style='text-align:left;color:red;'>" . $msg . '</td></tr>';
}
$errmsg.= '</table><br>';
unset($_SESSION['ERRMSG_ARR']);
}
echo "<h2>" . get_lang('delete_sub_user') . "</h2>";
if (isset($errmsg)) {
echo $errmsg;
}
// Subuser Delete Check
if(isset($_POST['editUser'])){
$_SESSION['REFER']="?m=subusers&p=del";
$userID = $_POST['user_id'];
unset($_POST['editUser']);
$view->refresh("?m=user_admin&p=edit_user&user_id=" . $userID,0);
}else{
if (isset($_POST['delUser'])) {
// Does user have permissions to delete this user?
$isAdmin = $db->isAdmin($_SESSION['user_id']);
$mySubUsers = $db->getUsersSubUsersIds($_SESSION['user_id']);
if ( $mySubUsers === false || (!$isAdmin && @!in_array($_POST['user_id'], $mySubUsers)) || $_POST['user_id'] == $_SESSION['user_id'] ){
print_failure(get_lang('no_rights'));
return;
}
if (!isset($_POST['del_check'])) {
$user_info = $db->getUserById($_POST['user_id']);
echo "<table class='center' style='width:100%;' ><tr>\n" . "<td>" . get_lang_f('del_subuser_conf') . " " . $user_info['users_login'] . "?</td>" . "</tr><tr><td>" . '<form method="post" >' . "\n" . '<input type="hidden" name="user_id" value="' . $_POST['user_id'] . '">' . "\n" . '<input type="hidden" name="delUser" value="' . $_POST['delUser'] . '">' . "\n" . '<button name="del_check" value="yes" >' . get_lang('yes') . "</button>\n" . '<button name="del_check" value="no" >' . get_lang('no') . "</button>\n" . "</form>\n" . "</td>\n" . "</tr>\n" . "</table><br>\n";
} elseif($_POST['del_check'] == "yes") {
$userID = $_POST['user_id'];
$user_info = $db->getUserById($userID);
$errflag = false;
if (!$db->delUser($userID)) {
$errmsg_arr[] = get_lang('err_parent_user');
$errflag = true;
}
//If there are input validations, redirect back to the registration form
if ($errflag) {
$_SESSION['ERRMSG_ARR'] = $errmsg_arr;
} else {
echo "<p>" . get_lang_f('subuser_deleted',$user_info['users_login']) . "</p>";
}
}
}
$results = listAllSubUsers();
echo $results;
}
}
function listAllSubUsers() {
global $db;
// echo $_SESSION['user_id'];
$htmlCode = "";
$subusers = $db->getUsersSubUsersIds($_SESSION['user_id']);
if (is_array($subusers)) {
$htmlCode.= "<table style=\"margin-left: 1em;\"><tr><th>" . get_lang('your_subusers') . "</th><th></th></tr>";
if (count($subusers) > 0) {
foreach ($subusers as $subuser) {
$user_info = $db->getUserById($subuser);
$htmlCode.= '<tr><td>' . $user_info['users_login'] . '</td><td><form method="post"><input type="hidden" name="user_id" value="' . $subuser . '" /><input type="submit" value="Edit" name="editUser" /><input type="submit" value="Delete" name="delUser" /></form></td></tr>';
}
} else {
$htmlCode.= "<p>" . get_lang('no_subusers') . "</p>";
}
$htmlCode.= "</table>";
} else {
$htmlCode.= "<p>" . get_lang('no_subusers') . "</p>";
}
return $htmlCode;
}
?>

View file

@ -0,0 +1,30 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
// Module general information
$module_title = "subusers";
$module_version = "1.0";
$db_version = 0;
$module_required = TRUE;
?>

View file

@ -0,0 +1,6 @@
<navigation>
<page key="add" file="add_subuser.php" access="user" />
<page key="del" file="del_subuser.php" access="user" />
<page key="adduser" file="add_subuser-exec.php" access="user" />
<page key="submanage" file="submanage.php" access="user" />
</navigation>

View file

@ -0,0 +1,66 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
//Open Game Panel Sub User Registration Add On By
// own3mall
function exec_ogp_module()
{
global $db;
global $view;
startSession();
if( isset($_SESSION['ERRMSG_ARR']) && is_array($_SESSION['ERRMSG_ARR']) && count($_SESSION['ERRMSG_ARR']) >0 )
{
$errmsg = '<table>';
foreach($_SESSION['ERRMSG_ARR'] as $msg)
{
$errmsg .= "<tr><td><img width='8px' src='images/offline.png'/></td><td style='text-align:left;color:red;'>".$msg.'</td></tr>';
}
$errmsg .= '</table><br>';
unset($_SESSION['ERRMSG_ARR']);
}
echo "<h2>".get_lang('subuser_man')."</h2>";
if(isset($errmsg))
{
echo $errmsg;
$input = $_SESSION['INPUT'];
}
$lang_switch = ( isset( $_GET['lang'] ) AND $_GET['lang'] != "-" ) ? "&amp;lang=" . $_GET['lang'] : "";
if( !isset($_GET['lang']) )
{
$panel_settings = $db->getSettings();
$lang = $panel_settings['panel_language'];
}
else
{
$lang = $_GET['lang'];
}
?>
<p><a href="?m=subusers&p=add"><?php echo get_lang('create_sub_user'); ?></a></p>
<p><a href="?m=subusers&p=del"><?php echo get_lang('listdel_sub_user'); ?></a></p>
<?php
}
?>