Esempio n. 1
0
            $headers = 'From: submission@' . $_SERVER['HTTP_HOST'] . "\n" . 'X-Mailer: PHP/' . phpversion();
            $admins = $userbank->GetAllAdmins();
            $requri = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], ".php") - 5);
            foreach ($admins as $admin) {
                $message = "";
                $message .= "Hello " . $admin['user'] . ",\n\n";
                $message .= "A new ban submission has been posted on your SourceBans page:\n\n";
                $message .= "Player: " . $_POST['PlayerName'] . " (" . $_POST['SteamID'] . ")\nDemo: " . (empty($_FILES['demo_file']['name']) ? 'no' : 'yes (http://' . $_SERVER['HTTP_HOST'] . $requri . 'getdemo.php?type=S&id=' . $subid . ')') . "\n" . $mailserver . "Reason: " . $_POST['BanReason'] . "\n\n";
                $message .= "Click the link below to view the current ban submissions.\n\nhttp://" . $_SERVER['HTTP_HOST'] . $requri . "index.php?p=admin&c=bans#^2";
                if ($userbank->HasAccess(ADMIN_OWNER | ADMIN_BAN_SUBMISSIONS, $admin['aid']) && $userbank->HasAccess(ADMIN_NOTIFY_SUB, $admin['aid'])) {
                    mail($admin['email'], "[SourceBans] Ban Submission Added", $message, $headers);
                }
            }
            CreateGreenBox("Successful", "Your submission has been added into the database, and will be reviewed by one of our admins");
        } else {
            CreateRedBox("Error", "There was an error uploading your demo to the server. Please try again later.");
            $log = new CSystemLog("e", "Demo Upload Failed", "A demo failed to upload for a submission from (" . $Email . ")");
        }
    }
}
//$mod_list = $GLOBALS['db']->GetAssoc("SELECT mid,name FROM ".DB_PREFIX."_mods WHERE `mid` > 0 AND `enabled`= 1 ORDER BY mid ");
require_once INCLUDES_PATH . '/CServerInfo.php';
//serverlist
$server_list = $GLOBALS['db']->Execute("SELECT sid, ip, port FROM `" . DB_PREFIX . "_servers` WHERE enabled = 1 ORDER BY modid, sid");
$servers = array();
while (!$server_list->EOF) {
    $info = array();
    $sinfo = new CServerInfo($server_list->fields[1], $server_list->fields[2]);
    $info = $sinfo->getInfo();
    if (empty($info['hostname'])) {
        $info['hostname'] = "Error Connecting (" . $server_list->fields[1] . ":" . $server_list->fields[2] . ")";
                        unset($_POST['bans_customreason'][$i]);
                    } else {
                        $_POST['bans_customreason'][$i] = htmlspecialchars($_POST['bans_customreason'][$i]);
                    }
                }
                if (sizeof($_POST['bans_customreason']) != 0) {
                    $cureason = serialize($_POST['bans_customreason']);
                } else {
                    $cureason = "";
                }
                $tz_string = $_POST['timezoneoffset'];
                $edit = $GLOBALS['db']->Execute("REPLACE INTO " . DB_PREFIX . "_settings (`value`, `setting`) VALUES\r\n\t\t\t\t\t\t\t\t\t\t\t\t(?, 'template.title'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(?,'template.logo'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(" . (int) $_POST['config_password_minlength'] . ", 'config.password.minlength'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(" . $debugmode . ", 'config.debug'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(?, 'config.dateformat'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(?, 'dash.intro.title'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(" . (int) $_POST['banlist_bansperpage'] . ", 'banlist.bansperpage'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(" . (int) $hideadmname . ", 'banlist.hideadminname'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(" . (int) $hideplayerips . ", 'banlist.hideplayerips'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(" . (int) $nocountryfetch . ", 'banlist.nocountryfetch'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(?, 'dash.intro.text'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(" . (int) $lognopopup . ", 'dash.lognopopup'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(" . (int) $protest . ", 'config.enableprotest'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(" . (int) $submit . ", 'config.enablesubmit'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(" . (int) $onlyinvolved . ", 'protest.emailonlyinvolved'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(?, 'config.timezone'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(?, 'config.summertime'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(?, 'bans.customreasons'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(" . (int) $_POST['default_page'] . ", 'config.defaultpage')", array($_POST['template_title'], $_POST['template_logo'], $_POST['config_dateformat'], $_POST['dash_intro_title'], $_POST['dash_intro_text'], $tz_string, $summertime, $cureason));
                ?>
<script>ShowBox('Настройки обновлены', 'Настройки успешно обновлены', 'green', 'index.php?p=admin&c=settings');</script><?php 
            } else {
                CreateRedBox("Ошибка", $errors);
            }
        }
        if ($_POST['settingsGroup'] == "features") {
            $kickit = isset($_POST['enable_kickit']) && $_POST['enable_kickit'] == "on" ? 1 : 0;
            $exportpub = isset($_POST['export_public']) && $_POST['export_public'] == "on" ? 1 : 0;
            $groupban = isset($_POST['enable_groupbanning']) && $_POST['enable_groupbanning'] == "on" ? 1 : 0;
            $friendsban = isset($_POST['enable_friendsbanning']) && $_POST['enable_friendsbanning'] == "on" ? 1 : 0;
            $adminrehash = isset($_POST['enable_adminrehashing']) && $_POST['enable_adminrehashing'] == "on" ? 1 : 0;
            $edit = $GLOBALS['db']->Execute("REPLACE INTO " . DB_PREFIX . "_settings (`value`, `setting`) VALUES\r\n\t\t\t\t\t\t\t\t\t\t\t(" . (int) $exportpub . ", 'config.exportpublic'),\r\n\t\t\t\t\t\t\t\t\t\t\t(" . (int) $kickit . ", 'config.enablekickit'),\r\n\t\t\t\t\t\t\t\t\t\t\t(" . (int) $groupban . ", 'config.enablegroupbanning'),\r\n\t\t\t\t\t\t\t\t\t\t\t(" . (int) $friendsban . ", 'config.enablefriendsbanning'),\r\n\t\t\t\t\t\t\t\t\t\t\t(" . (int) $adminrehash . ", 'config.enableadminrehashing')");
            ?>
<script>ShowBox('Настройки обновлены', 'Настройки успешно обновлены', 'green', 'index.php?p=admin&c=settings');</script><?php 
        }
    }
    $date_offs = $GLOBALS['config']['config.timezone'];
    #########[Settings Page]###############
                        unset($_POST['bans_customreason'][$i]);
                    } else {
                        $_POST['bans_customreason'][$i] = htmlspecialchars($_POST['bans_customreason'][$i]);
                    }
                }
                if (sizeof($_POST['bans_customreason']) != 0) {
                    $cureason = serialize($_POST['bans_customreason']);
                } else {
                    $cureason = "";
                }
                $tz_string = $_POST['timezoneoffset'];
                $edit = $GLOBALS['db']->Execute("REPLACE INTO " . DB_PREFIX . "_settings (`value`, `setting`) VALUES\r\n\t\t\t\t\t\t\t\t\t\t\t\t(?, 'template.title'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(?,'template.logo'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(" . (int) $_POST['config_password_minlength'] . ", 'config.password.minlength'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(" . $debugmode . ", 'config.debug'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(?, 'config.dateformat'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(?, 'dash.intro.title'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(" . (int) $_POST['banlist_bansperpage'] . ", 'banlist.bansperpage'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(" . (int) $hideadmname . ", 'banlist.hideadminname'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(" . (int) $hideplayerips . ", 'banlist.hideplayerips'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(" . (int) $nocountryfetch . ", 'banlist.nocountryfetch'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(?, 'dash.intro.text'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(" . (int) $lognopopup . ", 'dash.lognopopup'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(" . (int) $protest . ", 'config.enableprotest'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(" . (int) $submit . ", 'config.enablesubmit'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(" . (int) $onlyinvolved . ", 'protest.emailonlyinvolved'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(?, 'config.timezone'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(?, 'config.summertime'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(?, 'bans.customreasons'),\r\n\t\t\t\t\t\t\t\t\t\t\t\t(" . (int) $_POST['default_page'] . ", 'config.defaultpage')", array($_POST['template_title'], $_POST['template_logo'], $_POST['config_dateformat'], $_POST['dash_intro_title'], $_POST['dash_intro_text'], $tz_string, $summertime, $cureason));
                ?>
<script>ShowBox('Settings updated', 'The changes have been successfully updated', 'green', 'index.php?p=admin&c=settings');</script><?php 
            } else {
                CreateRedBox("Error", $errors);
            }
        }
        if ($_POST['settingsGroup'] == "features") {
            $kickit = isset($_POST['enable_kickit']) && $_POST['enable_kickit'] == "on" ? 1 : 0;
            $exportpub = isset($_POST['export_public']) && $_POST['export_public'] == "on" ? 1 : 0;
            $groupban = isset($_POST['enable_groupbanning']) && $_POST['enable_groupbanning'] == "on" ? 1 : 0;
            $friendsban = isset($_POST['enable_friendsbanning']) && $_POST['enable_friendsbanning'] == "on" ? 1 : 0;
            $adminrehash = isset($_POST['enable_adminrehashing']) && $_POST['enable_adminrehashing'] == "on" ? 1 : 0;
            $edit = $GLOBALS['db']->Execute("REPLACE INTO " . DB_PREFIX . "_settings (`value`, `setting`) VALUES\r\n\t\t\t\t\t\t\t\t\t\t\t(" . (int) $exportpub . ", 'config.exportpublic'),\r\n\t\t\t\t\t\t\t\t\t\t\t(" . (int) $kickit . ", 'config.enablekickit'),\r\n\t\t\t\t\t\t\t\t\t\t\t(" . (int) $groupban . ", 'config.enablegroupbanning'),\r\n\t\t\t\t\t\t\t\t\t\t\t(" . (int) $friendsban . ", 'config.enablefriendsbanning'),\r\n\t\t\t\t\t\t\t\t\t\t\t(" . (int) $adminrehash . ", 'config.enableadminrehashing')");
            ?>
<script>ShowBox('Settings updated', 'The changes have been successfully updated', 'green', 'index.php?p=admin&c=settings');</script><?php 
        }
    }
    $date_offs = $GLOBALS['config']['config.timezone'];
    #########[Settings Page]###############
            $headers = 'From: submission@' . $_SERVER['HTTP_HOST'] . "\n" . 'X-Mailer: PHP/' . phpversion();
            $admins = $userbank->GetAllAdmins();
            $requri = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], ".php") - 5);
            foreach ($admins as $admin) {
                $message = "";
                $message .= "Здравствуйте " . $admin['user'] . ",\n\n";
                $message .= "Новая заявка была опубликована на вашей странице SourceBans:\n\n";
                $message .= "Игрок: " . $_POST['PlayerName'] . " (" . $_POST['SteamID'] . ")\nДемо: " . (empty($_FILES['demo_file']['name']) ? 'no' : 'yes (http://' . $_SERVER['HTTP_HOST'] . $requri . 'getdemo.php?type=S&id=' . $subid . ')') . "\n" . $mailserver . "Reason: " . $_POST['BanReason'] . "\n\n";
                $message .= "Нажмите на ссылку выше для просмотра заявки о бане.\n\nhttp://" . $_SERVER['HTTP_HOST'] . $requri . "index.php?p=admin&c=bans#^2";
                if ($userbank->HasAccess(ADMIN_OWNER | ADMIN_BAN_SUBMISSIONS, $admin['aid']) && $userbank->HasAccess(ADMIN_NOTIFY_SUB, $admin['aid'])) {
                    mail($admin['email'], "[SourceBans] Заявка на бан добавлена", $message, $headers);
                }
            }
            CreateGreenBox("Успешно", "Ваше предложение бана было успешно отправлено и будет рассмотрено администрацией");
        } else {
            CreateRedBox("Ошибка", "Ошибка загрузки демо. попробуйте позже.");
            $log = new CSystemLog("e", "Ошибка загрузки демо", "Ошибка загрузки демо для заявки на бан от (" . $Email . ")");
        }
    }
}
//$mod_list = $GLOBALS['db']->GetAssoc("SELECT mid,name FROM ".DB_PREFIX."_mods WHERE `mid` > 0 AND `enabled`= 1 ORDER BY mid ");
require_once INCLUDES_PATH . '/CServerInfo.php';
//serverlist
$server_list = $GLOBALS['db']->Execute("SELECT sid, ip, port FROM `" . DB_PREFIX . "_servers` WHERE enabled = 1 ORDER BY modid, sid");
$servers = array();
while (!$server_list->EOF) {
    $info = array();
    $sinfo = new CServerInfo($server_list->fields[1], $server_list->fields[2]);
    $info = $sinfo->getInfo();
    if (empty($info['hostname'])) {
        $info['hostname'] = "Ошибка соединения (" . $server_list->fields[1] . ":" . $server_list->fields[2] . ")";