Beispiel #1
0
 * (at your option) 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, see <http://www.gnu.org/licenses/>.
 *
 * @package 2Moons
 * @author Slaver <*****@*****.**>
 * @copyright 2009 Lucky <*****@*****.**> (XGProyecto)
 * @copyright 2011 Slaver <*****@*****.**> (Fork/2Moons)
 * @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License
 * @version 1.3 (2011-01-21)
 * @link http://code.google.com/p/2moons/
 */
define('INSIDE', true);
define('INSTALL', false);
define('LOGIN', true);
define('ROOT_PATH', './');
require_once ROOT_PATH . 'includes/config.php';
require_once ROOT_PATH . 'includes/constants.php';
require_once ROOT_PATH . 'includes/classes/class.MySQLi.php';
$db = new DB_MySQLi();
$CONF = $db->uniquequery("SELECT HIGH_PRIORITY * FROM `" . CONFIG . "`;");
$db->query("DROP TABLE " . CONFIG . ";");
$db->query("CREATE TABLE `" . CONFIG . "` (\r\n `uni` int(11) NOT NULL,\r\n `VERSION` varchar(8) NOT NULL,\r\n `users_amount` int(11) NOT NULL,\r\n `game_speed` int(11) NOT NULL,\r\n `fleet_speed` int(11) NOT NULL,\r\n `resource_multiplier` int(11) NOT NULL,\r\n `halt_speed` int(11) NOT NULL,\r\n `Fleet_Cdr` int(11) NOT NULL,\r\n `Defs_Cdr` int(11) NOT NULL,\r\n `initial_fields` int(11) NOT NULL,\r\n `bgm_active` int(11) NOT NULL,\r\n `bgm_file` varchar(100) NOT NULL,\r\n `game_name` varchar(30) NOT NULL,\r\n `game_disable` int(11) NOT NULL,\r\n `close_reason` text NOT NULL,\r\n `metal_basic_income` int(11) NOT NULL,\r\n `crystal_basic_income` int(11) NOT NULL,\r\n `deuterium_basic_income` int(11) NOT NULL,\r\n `energy_basic_income` int(11) NOT NULL,\r\n `LastSettedGalaxyPos` int(11) NOT NULL,\r\n `LastSettedSystemPos` int(11) NOT NULL,\r\n `LastSettedPlanetPos` int(11) NOT NULL,\r\n `noobprotection` int(11) NOT NULL,\r\n `noobprotectiontime` int(11) NOT NULL,\r\n `noobprotectionmulti` int(11) NOT NULL,\r\n `forum_url` varchar(40) NOT NULL,\r\n `adm_attack` int(11) NOT NULL,\r\n `debug` int(11) NOT NULL,\r\n `lang` varchar(10) NOT NULL,\r\n `stat` int(11) NOT NULL,\r\n `stat_level` int(11) NOT NULL,\r\n `stat_last_update` int(11) NOT NULL,\r\n `stat_settings` int(11) NOT NULL,\r\n `stat_update_time` int(11) NOT NULL,\r\n `stat_last_db_update` int(11) NOT NULL,\r\n `stats_fly_lock` int(11) NOT NULL,\r\n `stat_last_banner_update` int(11) NOT NULL,\r\n `stat_banner_update_time` int(11) NOT NULL,\r\n `cron_lock` int(11) NOT NULL,\r\n `ts_modon` int(11) NOT NULL,\r\n `ts_server` int(11) NOT NULL,\r\n `ts_tcpport` int(11) NOT NULL,\r\n `ts_udpport` int(11) NOT NULL,\r\n `ts_timeout` int(11) NOT NULL,\r\n `ts_version` int(11) NOT NULL,\r\n `reg_closed` int(11) NOT NULL,\r\n `OverviewNewsFrame` int(11) NOT NULL,\r\n `OverviewNewsText` text NOT NULL,\r\n `capaktiv` int(11) NOT NULL,\r\n `cappublic` varchar(42) NOT NULL,\r\n `capprivate` varchar(42) NOT NULL,\r\n `min_build_time` int(11) NOT NULL,\r\n `smtp_host` int(11) NOT NULL,\r\n `smtp_port` int(11) NOT NULL,\r\n `smtp_user` int(11) NOT NULL,\r\n `smtp_pass` int(11) NOT NULL,\r\n `smtp_ssl` int(11) NOT NULL,\r\n `smtp_sendmail` int(11) NOT NULL,\r\n `user_valid` int(11) NOT NULL,\r\n `ftp_server` int(11) NOT NULL,\r\n `ftp_user_name` int(11) NOT NULL,\r\n `ftp_user_pass` int(11) NOT NULL,\r\n `ftp_root_path` int(11) NOT NULL,\r\n `fb_on` int(11) NOT NULL,\r\n `fb_apikey` varchar(42) NOT NULL,\r\n `fb_skey` varchar(42) NOT NULL,\r\n `ga_active` varchar(42) NOT NULL,\r\n `ga_key` varchar(42) NOT NULL,\r\n `moduls` varchar(100) NOT NULL,\r\n PRIMARY KEY (`uni`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
$db->query("INSERT INTO " . CONFIG . " (`uni`, `VERSION`, `users_amount`, `game_speed`, `fleet_speed`, `resource_multiplier`, `halt_speed`, `Fleet_Cdr`, `Defs_Cdr`, `initial_fields`, `bgm_active`, `bgm_file`, `game_name`, `game_disable`, `close_reason`, `metal_basic_income`, `crystal_basic_income`, `deuterium_basic_income`, `energy_basic_income`, `LastSettedGalaxyPos`, `LastSettedSystemPos`, `LastSettedPlanetPos`, `noobprotection`, `noobprotectiontime`, `noobprotectionmulti`, `forum_url`, `adm_attack`, `debug`, `lang`, `stat`, `stat_level`, `stat_last_update`, `stat_settings`, `stat_update_time`, `stat_last_db_update`, `stats_fly_lock`, `stat_last_banner_update`, `stat_banner_update_time`, `cron_lock`, `ts_modon`, `ts_server`, `ts_tcpport`, `ts_udpport`, `ts_timeout`, `ts_version`, `reg_closed`, `OverviewNewsFrame`, `OverviewNewsText`, `capaktiv`, `cappublic`, `capprivate`, `min_build_time`, `smtp_host`, `smtp_port`, `smtp_user`, `smtp_pass`, `smtp_ssl`, `smtp_sendmail`, `user_valid`, `ftp_server`, `ftp_user_name`, `ftp_user_pass`, `ftp_root_path`, `fb_on`, `fb_apikey`, `fb_skey`, `ga_active`, `ga_key`, `moduls`) VALUES \r\n('1', '" . $CONF['VERSION'] . "', '" . $CONF['users_amount'] . "', '" . $CONF['game_speed'] . "', '" . $CONF['fleet_speed'] . "', '" . $CONF['resource_multiplier'] . "', '" . $CONF['halt_speed'] . "', '" . $CONF['Fleet_Cdr'] . "', '" . $CONF['Defs_Cdr'] . "', '" . $CONF['initial_fields'] . "', '" . $CONF['bgm_active'] . "', '" . $CONF['bgm_file'] . "', '" . $CONF['game_name'] . "', '" . $CONF['game_disable'] . "', '" . $CONF['close_reason'] . "', '" . $CONF['metal_basic_income'] . "', '" . $CONF['crystal_basic_income'] . "', '" . $CONF['deuterium_basic_income'] . "', '" . $CONF['energy_basic_income'] . "', '" . $CONF['LastSettedGalaxyPos'] . "', '" . $CONF['LastSettedSystemPos'] . "', \r\n'" . $CONF['LastSettedPlanetPos'] . "', '" . $CONF['noobprotection'] . "', '" . $CONF['noobprotectiontime'] . "', '" . $CONF['noobprotectionmulti'] . "', '" . $CONF['forum_url'] . "', '" . $CONF['adm_attack'] . "', '" . $CONF['debug'] . "', '" . $CONF['lang'] . "', '" . $CONF['stat'] . "', '" . $CONF['stat_level'] . "', '" . $CONF['stat_last_update'] . "', '" . $CONF['stat_settings'] . "', '" . $CONF['stat_last_update'] . "', '" . $CONF['stat_last_db_update'] . "', '" . $CONF['stats_fly_lock'] . "', '" . $CONF['stat_last_banner_update'] . "', '" . $CONF['stat_banner_update_time'] . "', '" . $CONF['cron_lock'] . "', '" . $CONF['ts_modon'] . "', '" . $CONF['ts_server'] . "', '" . $CONF['ts_tcpport'] . "', '" . $CONF['ts_udpport'] . "', '" . $CONF['ts_timeout'] . "', '" . $CONF['ts_version'] . "', '" . $CONF['reg_closed'] . "', '" . $CONF['OverviewNewsFrame'] . "', '" . $CONF['OverviewNewsText'] . "', '" . $CONF['capaktiv'] . "', '" . $CONF['cappublic'] . "', '" . $CONF['capprivate'] . "', '" . $CONF['min_build_time'] . "', '" . $CONF['smtp_host'] . "', '" . $CONF['smtp_port'] . "', '" . $CONF['smtp_user'] . "', '" . $CONF['smtp_pass'] . "', '" . $CONF['smtp_ssl'] . "', '" . $CONF['smtp_sendmail'] . "', '" . $CONF['user_valid'] . "', '" . $CONF['ftp_server'] . "', '" . $CONF['ftp_user_name'] . "', '" . $CONF['ftp_user_pass'] . "', '" . $CONF['ftp_root_path'] . "', '" . $CONF['fb_on'] . "', '" . $CONF['fb_apikey'] . "', '" . $CONF['fb_skey'] . "', '" . $CONF['ga_active'] . "', '" . $CONF['ga_key'] . "', '" . $CONF['moduls'] . "');");
exit('OK');
Beispiel #2
0
ini_set('session.bug_compat_42', '0');
ini_set('session.cookie_httponly', true);
ini_set('error_log', ROOT_PATH . '/includes/error.log');
if (!defined('LOGIN')) {
    session_start();
}
if (!function_exists('bcadd')) {
    require_once ROOT_PATH . 'includes/bcmath.php';
}
require_once ROOT_PATH . 'includes/GeneralFunctions.php';
set_exception_handler('exception_handler');
require_once ROOT_PATH . 'includes/classes/class.MySQLi.php';
require_once ROOT_PATH . 'includes/classes/class.Lang.php';
require_once ROOT_PATH . 'includes/classes/class.theme.php';
require_once ROOT_PATH . 'includes/classes/class.Session.php';
$db = new DB_MySQLi();
$THEME = new Theme();
$LANG = new Language();
unset($database);
// Say Browsers to Allow ThirdParty Cookies (Thanks to morktadela)
header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
$UNI = getUniverse();
if (UNIS_MULTIVARS) {
    require_once ROOT_PATH . 'includes/vars_uni' . $UNI . '.php';
} else {
    require_once ROOT_PATH . 'includes/vars.php';
}
$CONF = $db->uniquequery("SELECT HIGH_PRIORITY * FROM `" . CONFIG . "` WHERE `uni` = '" . $UNI . "';");
$CONF['moduls'] = explode(";", $CONF['moduls']);
$LANG->setDefault($CONF['lang']);
if (!defined('CLI') && !defined('LOGIN') && !defined('IN_CRON') && !defined('AJAX')) {
Beispiel #3
0
/**
 * Delete all alerts.
 *
 * @param MyBB               $mybb MyBB core object.
 * @param DB_MySQL|DB_MySQLi $db   database object.
 * @param MyLanguage         $lang MyBB language system.
 */
function myalerts_delete_all_alerts($mybb, $db, $lang)
{
    verify_post_check($mybb->get_input('my_post_key'));
    $userId = (int) $mybb->user['uid'];
    $db->delete_query('alerts', "uid = {$userId}");
    if (($retLink = $mybb->get_input('ret_link', MyBB::INPUT_STRING)) !== '') {
        redirect($retLink, $lang->myalerts_delete_all, $lang->myalerts_delete_mass_deleted);
    } else {
        redirect('alerts.php?action=alerts', $lang->myalerts_delete_all, $lang->myalerts_delete_mass_deleted);
    }
}
Beispiel #4
0
 case 2:
     $template->assign_vars(array('step3_create_admin' => $LNG['step3_create_admin'], 'step3_admin_name' => $LNG['step3_admin_name'], 'step3_admin_pass' => $LNG['step3_admin_pass'], 'step3_admin_mail' => $LNG['step3_admin_mail'], 'continue' => $LNG['continue']));
     $template->show('install/ins_acc.tpl');
     break;
 case 3:
     $adm_user = $_POST['adm_user'];
     $adm_pass = $_POST['adm_pass'];
     $adm_email = $_POST['adm_email'];
     $md5pass = md5($adm_pass);
     if (empty($_POST['adm_user']) && empty($_POST['adm_pas']) && empty($_POST['adm_email'])) {
         exit($template->message($LNG['step4_need_fields'], "?mode=ins&page=3&lang=" . $LANG->GetUser(), 3, true));
     }
     require_once ROOT_PATH . 'includes/config.php';
     require_once ROOT_PATH . 'includes/constants.php';
     require_once ROOT_PATH . 'includes/classes/class.MySQLi.php';
     $db = new DB_MySQLi();
     $SQL = "INSERT INTO " . USERS . " SET ";
     $SQL .= "`id`                = '1', ";
     $SQL .= "`username`          = '" . $adm_user . "', ";
     $SQL .= "`email`             = '" . $adm_email . "', ";
     $SQL .= "`email_2`           = '" . $adm_email . "', ";
     $SQL .= "`ip_at_reg`         = '" . $_SERVER['REMOTE_ADDR'] . "', ";
     $SQL .= "`lang` \t         = '" . $LANG->GetUser() . "', ";
     $SQL .= "`authlevel`         = '3', ";
     $SQL .= "`rights` \t\t\t = '', ";
     $SQL .= "`id_planet`         = '1', ";
     $SQL .= "`universe`          = '1', ";
     $SQL .= "`galaxy`            = '1', ";
     $SQL .= "`system`            = '1', ";
     $SQL .= "`planet`            = '1', ";
     $SQL .= "`register_time`     = '" . TIMESTAMP . "', ";
Beispiel #5
0
     }
     $template->assign_vars(array('safemode' => $safemode, 'dir' => $dirs, 'json' => $json, 'done' => $done, 'config' => $config, 'gdlib' => $gdlib, 'PHP' => $PHP, 'req_php_need' => $LNG['req_php_need'], 'req_smode_active' => $LNG['req_smode_active'], 'reg_gd_need' => $LNG['reg_gd_need'], 'reg_json_need' => $LNG['reg_json_need']));
     $template->show('install/ins_req.tpl');
     break;
 case 'ins':
     if ($Page == 1) {
         $template->assign_vars(array('step1_notice_chmod' => $LNG['step1_notice_chmod'], 'step1_mysql_server' => $LNG['step1_mysql_server'], 'step1_mysql_port' => $LNG['step1_mysql_port'], 'step1_mysql_dbname' => $LNG['step1_mysql_dbname'], 'step1_mysql_dbuser' => $LNG['step1_mysql_dbuser'], 'step1_mysql_dbpass' => $LNG['step1_mysql_dbpass'], 'step1_mysql_prefix' => $LNG['step1_mysql_prefix'], 'continue' => $LNG['continue']));
         $template->show('install/ins_form.tpl');
     } elseif ($Page == 2) {
         $GLOBALS['database']['host'] = request_var('host', '');
         $GLOBALS['database']['port'] = request_var('port', 0);
         $GLOBALS['database']['user'] = request_var('user', '', true);
         $GLOBALS['database']['userpw'] = request_var('passwort', '', true);
         $prefix = request_var('prefix', '', true);
         $GLOBALS['database']['databasename'] = request_var('db', '', true);
         $connection = new DB_MySQLi(true);
         if (mysqli_connect_errno()) {
             exit($template->message(sprintf($LNG['step2_db_con_fail'], mysqli_connect_error()), "?mode=ins&page=1&lang=" . $LANG, 3, true));
         }
         @chmod("../includes/config.php", 0777);
         if (!is_writable('../includes/config.php')) {
             exit($template->message($LNG['step2_conf_op_fail'], "?mode=ins&page=1&lang=" . $LANG, 3, true));
         }
         $first = "Verbindung zur Datenbank erfolgreich...";
         $connection->multi_query(str_replace("prefix_", $prefix, file_get_contents('install.sql')));
         $second = $LNG['step2_db_ok'];
         file_put_contents("../includes/config.php", "<?php\n" . "//### Database access ###//\n\n" . "\$database['host']          = '" . $GLOBALS['database']['host'] . "';\n" . "\$database['port']          = '" . $GLOBALS['database']['port'] . "';\n" . "\$database['user']          = '******'database']['user'] . "';\n" . "\$database['userpw']        = '" . $GLOBALS['database']['userpw'] . "';\n" . "\$database['databasename']  = '" . $GLOBALS['database']['databasename'] . "';\n" . "\$database['tableprefix']   = '" . $prefix . "';\n" . "\$dbsettings['secretword']  = '2Moons_" . mt_rand(1000, 9999999999) . "';\n\n" . "//### Do not change beyond here ###//\n" . "?>");
         @chmod("../includes/config.php", 0444);
         $third = "config.php erfolgreich erstellt...";
         $template->assign_vars(array('first' => $first, 'second' => $second, 'third' => $third, 'continue' => $LNG['continue']));
         $template->show('install/ins_form_done.tpl');
Beispiel #6
0
ini_set('session.gc_probability', '1');
ini_set('session.gc_divisor', '1000');
if (!defined('LOGIN')) {
    session_start();
}
if (!function_exists('bcadd')) {
    require_once ROOT_PATH . 'includes/bcmath.' . PHP_EXT;
}
require_once ROOT_PATH . 'includes/classes/class.MySQLi.' . PHP_EXT;
require_once ROOT_PATH . 'includes/classes/class.Session.' . PHP_EXT;
require_once ROOT_PATH . 'includes/GeneralFunctions.' . PHP_EXT;
require_once ROOT_PATH . 'includes/vars.' . PHP_EXT;
set_error_handler('msg_handler', E_ALL);
set_exception_handler('exception_handler');
if ($database) {
    $db = new DB_MySQLi();
} elseif (INSTALL != true) {
    redirectTo("install/");
}
unset($database);
if (INSTALL != true) {
    $cfgresult = $db->query("SELECT HIGH_PRIORITY * FROM `" . CONFIG . "`;");
    while ($row = $db->fetch_array($cfgresult)) {
        $CONF[$row['config_name']] = $row['config_value'];
    }
    $db->free_result($cfgresult);
    $CONF['moduls'] = explode(";", $CONF['moduls']);
    define('VERSION', $CONF['VERSION']);
    if (!defined('LOGIN') && !defined('IN_CRON') && !defined('AJAX')) {
        $SESSION = new Session();
        if (!$SESSION->IsUserLogin()) {