コード例 #1
0
ファイル: connection.php プロジェクト: keverage/adminserv
                        AdminServ::error(Utils::t('Connection error: invalid session.'));
                    }
                }
            }
        } else {
            if (OnlineConfig::ACTIVATE === true) {
                Utils::redirection(false, './config/');
            } else {
                AdminServ::info(Utils::t('No server available. To add one, configure "config/servers.cfg.php" file.'));
            }
        }
    } else {
        if (OnlineConfig::ACTIVATE === true && !isset($_GET['error'])) {
            Utils::redirection(false, './config/');
        } else {
            AdminServ::error(Utils::t('The servers configuration file isn\'t recognized by AdminServ.'));
        }
    }
} else {
    if (isset($_SESSION['adminserv']['get_password'])) {
        AdminServ::info(Utils::t('It\'s your first connection and no server configured. Choose a password to configure your servers.'));
    }
}
// HTML
if (isset($_GET['error'])) {
    AdminServ::error($_GET['error']);
} else {
    if (isset($_GET['info'])) {
        AdminServ::info($_GET['info']);
    }
}
コード例 #2
0
<?php

// ENREGISTREMENT
if (isset($_POST['savepassword'])) {
    $current = md5($_POST['changePasswordCurrent']);
    $new = md5($_POST['changePasswordNew']);
    if (isset($_SESSION['adminserv']['path'])) {
        $adminservPath = $_SESSION['adminserv']['path'];
    } else {
        $adminservPath = null;
    }
    $pathConfig = $adminservPath . 'config/';
    if (OnlineConfig::PASSWORD !== $current) {
        AdminServ::error(Utils::t('The current password doesn\'t match.'));
    } else {
        if (($result = AdminServServerConfig::savePasswordConfig($pathConfig . 'adminserv.cfg.php', $new)) !== true) {
            AdminServ::error(Utils::t('Unable to save password.') . ' (' . $result . ')');
        } else {
            $info = Utils::t('The password has been changed.');
            AdminServ::info($info);
            AdminServLogs::add('action', $info);
        }
    }
    Utils::redirection(false, '?p=' . USER_PAGE);
}
コード例 #3
0
<?php

// SESSION
if (!isset($_SESSION['adminserv']['allow_config_servers'])) {
    AdminServ::error(Utils::t('You are not allowed to configure the servers'));
    Utils::redirection();
}
// VERIFICATION
if (class_exists('ServerConfig')) {
    // Si on n'autorise pas la configuration en ligne
    if (OnlineConfig::ACTIVATE !== true) {
        AdminServ::info(Utils::t('No server available. To add one, configure "config/servers.cfg.php" file.'));
        Utils::redirection();
    } elseif (USER_PAGE != 'config-addserver') {
        if (OnlineConfig::ADD_ONLY === true) {
            Utils::redirection(false, './?p=addserver');
        }
    }
} else {
    AdminServ::error(Utils::t('The servers configuration file isn\'t recognized by AdminServ.'));
    Utils::redirection();
}
コード例 #4
0
ファイル: config-servers.php プロジェクト: keverage/adminserv
    // SET
    $setServerData = array('name' => trim(htmlspecialchars(addslashes($_POST['server'][0] . ' - ' . Utils::t('copy')))), 'address' => trim($getServerData['address']), 'port' => intval($getServerData['port']), 'matchsettings' => trim($getServerData['matchsettings']), 'adminlevel' => array('SuperAdmin' => $getServerData['adminlevel']['SuperAdmin'], 'Admin' => $getServerData['adminlevel']['Admin'], 'User' => $getServerData['adminlevel']['User']));
    if (AdminServServerConfig::saveServerConfig($setServerData)) {
        $action = Utils::t('This server has been duplicated.');
        AdminServ::info($action);
        AdminServLogs::add('action', $action);
        Utils::redirection(false, '?p=' . USER_PAGE);
    } else {
        AdminServ::error(Utils::t('Unable to duplicate server.'));
    }
}
// SUPPRESSION
if (isset($_POST['deleteserver'])) {
    $servers = ServerConfig::$SERVERS;
    unset($servers[$_POST['server'][0]]);
    if (($result = AdminServServerConfig::saveServerConfig(array(), -1, $servers)) !== true) {
        AdminServ::error(Utils::t('Unable to delete server.') . ' (' . $result . ')');
    } else {
        $action = Utils::t('The "!serverName" server has been deleted.', array('!serverName' => $_POST['server'][0]));
        AdminServ::info($action);
        AdminServLogs::add('action', $action);
        Utils::redirection(false, '?p=' . USER_PAGE);
    }
}
// SERVERLIST
$data['servers'] = array();
if (is_array(ServerConfig::$SERVERS) && !empty(ServerConfig::$SERVERS)) {
    $data['servers'] = ServerConfig::$SERVERS;
}
$data['count'] = count($data['servers']);
$data['adminLevelsType'] = AdminServAdminLevel::getDefaultType();
コード例 #5
0
ファイル: index.php プロジェクト: keverage/adminserv
                }
            } else {
                AdminServ::error(Utils::t('You are not allowed to configure the servers'));
                Utils::redirection(false, '..');
            }
        } else {
            if (isset($_POST['configsavepassword'])) {
                $password = md5($_POST['savePassword']);
                if (($result = AdminServServerConfig::savePasswordConfig('./adminserv.cfg.php', $password)) !== true) {
                    AdminServ::error(Utils::t('Unable to save password.') . ' (' . $result . ')');
                    Utils::redirection(false, '..');
                } else {
                    session_unset();
                    session_destroy();
                    session_start();
                    $_SESSION['adminserv']['allow_config_servers'] = true;
                    Utils::redirection(false, '../?p=config-addserver');
                }
            } else {
                // Création du mot de passe
                $_SESSION['adminserv']['get_password'] = true;
                Utils::redirection(false, '..');
            }
        }
    } else {
        AdminServ::info(Utils::t('The online configuration is disabled. Use "./config/servers.cfg.php" file.'));
        Utils::redirection(false, '..');
    }
} else {
    Utils::redirection(false, '../?error=' . urlencode(Utils::t('The servers configuration file isn\'t recognized by AdminServ.')));
}
コード例 #6
0
ファイル: srvopts.php プロジェクト: keverage/adminserv
 $struct = AdminServ::getServerOptionsStruct();
 $ChangeAuthPassword = null;
 if (isset($_POST['ChangeAuthPassword']) && $_POST['ChangeAuthPassword'] != null) {
     $ChangeAuthLevel = $_POST['ChangeAuthLevel'];
     $ChangeAuthPassword = trim($_POST['ChangeAuthPassword']);
 }
 $srvoptsImportExport = false;
 if (array_key_exists('srvoptsImportExport', $_POST)) {
     $srvoptsImportExport = $_POST['srvoptsImportExport'];
 }
 // Enregistrement
 if ($ChangeAuthPassword) {
     if (USER_ADMINLEVEL === $ChangeAuthLevel) {
         $_SESSION['adminserv']['password'] = $ChangeAuthPassword;
     }
     AdminServ::info(Utils::t('You changed the password "!authLevel", remember it at the next connection!', array('!authLevel' => $ChangeAuthLevel)));
     AdminServLogs::add('action', 'Change authentication password for ' . $ChangeAuthLevel . ' level');
 } elseif ($srvoptsImportExport) {
     // Import
     if ($srvoptsImportExport == 'Import') {
         $srvoptsImportName = $_POST['srvoptsImportName'];
         if ($srvoptsImportName != 'none') {
             $struct = AdminServ::importServerOptions($srvoptsConfigDirectory . $srvoptsImportName);
             if (AdminServ::setServerOptions($struct)) {
                 AdminServLogs::add('action', 'Import server options from ' . $srvoptsConfigDirectory . $srvoptsImportName);
             }
         }
     } elseif ($srvoptsImportExport == 'Export') {
         $srvoptsExportName = Str::replaceChars($_POST['srvoptsExportName']);
         AdminServ::exportServerOptions($srvoptsConfigDirectory . $srvoptsExportName . '.txt', $struct);
     }