Example #1
0
try {
    require_once APPROOT . '/application/loginwebpage.class.inc.php';
    LoginWebPage::DoLogin();
    // Check user rights and prompt if needed
    ApplicationContext::SetUrlMakerClass('iTopStandardURLMaker');
    // Main parameters
    $sExpression = utils::ReadParam('expression', null, true, 'raw_data');
    $sQueryId = utils::ReadParam('query', null, true, 'raw_data');
    $sFormat = utils::ReadParam('format', null, true);
    $sFileName = utils::ReadParam('filename', '', true, 'string');
    $bInteractive = utils::ReadParam('interactive', false);
    $sMode = utils::ReadParam('mode', '');
    if ($bInteractive) {
        InteractiveShell($sExpression, $sQueryId, $sFormat, $sFileName, $sMode);
    } else {
        $oExporter = CheckParameters($sExpression, $sQueryId, $sFormat);
        $sMimeType = $oExporter->GetMimeType();
        if ($sMimeType == 'text/html') {
            $oP = new NiceWebPage('iTop export');
            $oP->add_style("body { overflow: auto; }");
            $oP->add_ready_script("\$('table.listResults').tablesorter({widgets: ['MyZebra']});");
        } else {
            $oP = new ajax_page('iTop export');
            $oP->SetContentType($oExporter->GetMimeType());
        }
        DoExport($oP, $oExporter, false);
        $oP->output();
    }
} catch (BulkExportMissingParameterException $e) {
    $oP = new ajax_page('iTop Export');
    $oP->add($e->getMessage());
Example #2
0
$tab_buildqueue = array('id' => 'INT AUTO_INCREMENT PRIMARY KEY', 'owner_id' => 'INT', 'planet_id' => 'INT', 'list_id' => 'INT', 'tech_id' => 'INT', 'level' => 'INT', 'destroy' => 'INT', 'start' => 'INT UNSIGNED', 'end' => 'INT UNSIGNED');
$tab_fleet = array('fleet_id' => 'INT AUTO_INCREMENT PRIMARY KEY', 'owner_id' => 'INT', 'union_id' => 'INT', 'm' => 'DOUBLE', 'k' => 'DOUBLE', 'd' => 'DOUBLE', 'fuel' => 'INT', 'mission' => 'INT', 'start_planet' => 'INT', 'target_planet' => 'INT', 'flight_time' => 'INT', 'deploy_time' => 'INT', 'ipm_amount' => 'INT', 'ipm_target' => 'INT', 'ship202' => 'INT', 'ship203' => 'INT', 'ship204' => 'INT', 'ship205' => 'INT', 'ship206' => 'INT', 'ship207' => 'INT', 'ship208' => 'INT', 'ship209' => 'INT', 'ship210' => 'INT', 'ship211' => 'INT', 'ship212' => 'INT', 'ship213' => 'INT', 'ship214' => 'INT', 'ship215' => 'INT');
$tab_union = array('union_id' => 'INT AUTO_INCREMENT PRIMARY KEY', 'fleet_id' => 'INT', 'target_player' => 'INT', 'name' => 'CHAR(20)', 'players' => 'TEXT');
$tab_battledata = array('battle_id' => 'INT AUTO_INCREMENT PRIMARY KEY', 'source' => 'TEXT', 'title' => 'TEXT', 'report' => 'TEXT', 'date' => 'INT UNSIGNED');
$tab_fleetlogs = array('log_id' => 'INT AUTO_INCREMENT PRIMARY KEY', 'owner_id' => 'INT', 'target_id' => 'INT', 'union_id' => 'INT', 'pm' => 'DOUBLE', 'pk' => 'DOUBLE', 'pd' => 'DOUBLE', 'm' => 'DOUBLE', 'k' => 'DOUBLE', 'd' => 'DOUBLE', 'fuel' => 'INT', 'mission' => 'INT', 'flight_time' => 'INT', 'deploy_time' => 'INT', 'start' => 'INT UNSIGNED', 'end' => 'INT UNSIGNED', 'origin_g' => 'INT', 'origin_s' => 'INT', 'origin_p' => 'INT', 'origin_type' => 'INT', 'target_g' => 'INT', 'target_s' => 'INT', 'target_p' => 'INT', 'target_type' => 'INT', 'ipm_amount' => 'INT', 'ipm_target' => 'INT', 'ship202' => 'INT', 'ship203' => 'INT', 'ship204' => 'INT', 'ship205' => 'INT', 'ship206' => 'INT', 'ship207' => 'INT', 'ship208' => 'INT', 'ship209' => 'INT', 'ship210' => 'INT', 'ship211' => 'INT', 'ship212' => 'INT', 'ship213' => 'INT', 'ship214' => 'INT', 'ship215' => 'INT');
$tab_iplogs = array('log_id' => 'INT AUTO_INCREMENT PRIMARY KEY', 'ip' => 'CHAR(16)', 'user_id' => 'INT', 'reg' => 'INT', 'date' => 'INT UNSIGNED');
$tab_pranger = array('ban_id' => 'INT AUTO_INCREMENT PRIMARY KEY', 'admin_name' => 'CHAR(20)', 'user_name' => 'CHAR(20)', 'admin_id' => 'INT', 'user_id' => 'INT', 'ban_when' => 'INT UNSIGNED', 'ban_until' => 'INT UNSIGNED', 'reason' => 'TEXT');
$tab_exptab = array('chance_success' => 'INT', 'depleted_min' => 'INT', 'depleted_med' => 'INT', 'depleted_max' => 'INT', 'chance_depleted_min' => 'INT', 'chance_depleted_med' => 'INT', 'chance_depleted_max' => 'INT', 'chance_alien' => 'INT', 'chance_pirates' => 'INT', 'chance_dm' => 'INT', 'chance_lost' => 'INT', 'chance_delay' => 'INT', 'chance_accel' => 'INT', 'chance_res' => 'INT', 'chance_fleet' => 'INT');
$tab_template = array('id' => 'INT AUTO_INCREMENT PRIMARY KEY', 'owner_id' => 'INT', 'name' => 'CHAR(30)', 'date' => 'INT UNSIGNED', 'ship202' => 'INT', 'ship203' => 'INT', 'ship204' => 'INT', 'ship205' => 'INT', 'ship206' => 'INT', 'ship207' => 'INT', 'ship208' => 'INT', 'ship209' => 'INT', 'ship210' => 'INT', 'ship211' => 'INT', 'ship212' => 'INT', 'ship213' => 'INT', 'ship214' => 'INT', 'ship215' => 'INT');
$tab_botvars = array('id' => 'INT AUTO_INCREMENT PRIMARY KEY', 'owner_id' => 'INT', 'var' => 'TEXT', 'value' => 'TEXT');
$tab_userlogs = array('id' => 'INT AUTO_INCREMENT PRIMARY KEY', 'owner_id' => 'INT', 'date' => 'INT UNSIGNED', 'type' => 'TEXT', 'text' => 'TEXT');
$tab_botstrat = array('id' => 'INT AUTO_INCREMENT PRIMARY KEY', 'name' => 'TEXT', 'source' => 'TEXT');
$tabs = array('uni' => &$tab_uni, 'users' => &$tab_users, 'planets' => &$tab_planets, 'ally' => &$tab_ally, 'allyranks' => &$tab_allyranks, 'allyapps' => &$tab_allyapps, 'buddy' => &$tab_buddy, 'messages' => &$tab_messages, 'notes' => &$tab_notes, 'errors' => &$tab_errors, 'debug' => &$tab_debug, 'browse' => &$tab_browse, 'queue' => &$tab_queue, 'buildqueue' => &$tab_buildqueue, 'fleet' => &$tab_fleet, 'union' => &$tab_union, 'battledata' => &$tab_battledata, 'fleetlogs' => &$tab_fleetlogs, 'iplogs' => &$tab_iplogs, 'pranger' => &$tab_pranger, 'exptab' => &$tab_exptab, 'template' => &$tab_template, 'botvars' => &$tab_botvars, 'userlogs' => &$tab_userlogs, 'botstrat' => &$tab_botstrat);
// -------------------------------------------------------------------------------------------------------------------------
// Сохранить настройки.
if (key_exists("install", $_POST) && CheckParameters()) {
    $now = time();
    //print_r ($_POST);
    // Удалить все таблицы и создать новые пустые.
    dbconnect($_POST["db_host"], $_POST["db_user"], $_POST["db_pass"], $_POST["db_name"]);
    dbquery("SET NAMES 'utf8';");
    dbquery("SET CHARACTER SET 'utf8';");
    dbquery("SET SESSION collation_connection = 'utf8_general_ci';");
    foreach ($tabs as $tabname => $tab) {
        $opt = " (";
        $first = true;
        foreach ($tab as $row => $type) {
            if (!$first) {
                $opt .= ", ";
            }
            if ($first) {