Exemplo n.º 1
0
        $log_coordy = $lb_arr["y"] == "" ? "" : $lb_arr["y"];
        $log_coordz = $lb_arr["z"] == "" ? "" : $lb_arr["z"];
    }
    if (valid_coordinates($log_coordx, $log_coordy, $log_coordz)) {
        $log_date = $log_row["stardate"];
        $date = date_create($log_date);
        $log_added = date_modify($date, "+1286 years");
        $text = $log_row["log_entry"];
        if (mb_strlen($text) > 40) {
            $text = "" . substr($text, 0, 40) . "...";
        }
        $cat = ',"cat":[11]';
        $info .= '<div class="map_info"><span class="map_info_title">Logged System</span><br />';
        $info .= '<strong>Log entry</strong><br /><a href="/log.php?system=' . urlencode($log_system) . '" style="color:inherit;font-weight:bold" title="View the log for this system">' . $text . ' </a><br /><br />';
        $info .= '<strong>Added</strong><br />' . date_format($log_added, "j M Y, H:i") . '';
        $info .= '</div>';
        $data = '{"name":"' . $log_system . '"' . $cat . ',"coords":{"x":' . $log_coordx . ',"y":' . $log_coordy . ',"z":' . $log_coordz . '},"infos":' . json_encode($info) . '}' . $last_row . '';
        $last_row = "," . $data . "";
    }
}
//$info = '</div>';
$cur_sys_data = "";
if (strtolower($last_system_name) == strtolower($curSys["name"]) && valid_coordinates($curSys["x"], $curSys["y"], $curSys["z"])) {
    $comma = !empty($data) ? "," : "";
    $cur_sys_data = $comma . '{"name":"' . $curSys["name"] . '","cat":[5],"coords":{"x":' . $curSys["x"] . ',"y":' . $curSys["y"] . ',"z":' . $curSys["z"] . '}}';
}
$data = $data_start . $data . $cur_sys_data . "]}";
$map_json = $_SERVER["DOCUMENT_ROOT"] . "/map_points.json";
file_put_contents($map_json, $data);
edtb_common("last_map_update", "unixtime", true, time());
Exemplo n.º 2
0
*  (C) 1984 - 2016 Frontier Developments Plc.
*  ED ToolBox or its creator are not affiliated with Frontier Developments Plc.
*
*  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 (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, write to the Free Software
*  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
*/
/**
 * Set ignore version flag
 *
 * @author Mauri Kujala <*****@*****.**>
 * @copyright Copyright (C) 2016, Mauri Kujala
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 */
require_once "" . $_SERVER["DOCUMENT_ROOT"] . "/source/functions.php";
if (isset($_GET["ignore_version"])) {
    $ignore = $_GET["ignore_version"];
    edtb_common("last_update_check", "value", true, $ignore);
    is_null($___mysqli_res = mysqli_close($link)) ? false : $___mysqli_res;
    exit;
}
Exemplo n.º 3
0
    // run update script
    if (file_exists($curl_exe)) {
        //
        exec("\"" . $curl_exe . "\" -b \"" . $cookie_file . "\" -c \"" . $cookie_file . "\" -H \"User-Agent: " . $agent . "\" \"https://companion.orerve.net/profile\" -k", $out);
        if (!empty($out)) {
            if (!file_put_contents("" . $_SERVER["DOCUMENT_ROOT"] . "/profile.json", $out)) {
                $error = error_get_last();
                write_log("Error: " . $error["message"] . "", __FILE__, __LINE__);
            }
        } else {
            write_log("Error: no output", __FILE__, __LINE__);
        }
        /*
         *	update last_api_request value
         */
        edtb_common("last_api_request", "unixtime", true, time());
    } else {
        write_log("Error: last_api_request error");
    }
}
/*
*	parse data from companion json
*/
$profile_file = "" . $_SERVER["DOCUMENT_ROOT"] . "/profile.json";
if (file_exists($profile_file)) {
    $profile_file = file_get_contents($profile_file);
    $profile = json_decode($profile_file, true);
    $api["commander"] = $profile["commander"];
    $api["ship"] = $profile["ship"];
    $api["stored_ships"] = $profile["ships"];
}
Exemplo n.º 4
0
                $new_file = "-1";
                if (file_exists($newfile)) {
                    $new_file = file_get_contents($newfile);
                }
                if ($new_file != $old_file) {
                    mysqli_query($GLOBALS["___mysqli_ston"], "\tUPDATE edtb_common\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSET unixtime = UNIX_TIMESTAMP()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE name = 'last_galnet_new'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1") or write_log(mysqli_error($GLOBALS["___mysqli_ston"]), __FILE__, __LINE__);
                }
            }
            $in++;
        }
    }
    /*
     *	update last_update time
     */
    mysqli_query($GLOBALS["___mysqli_ston"], "\tUPDATE edtb_common\n\t\t\t\t\t\t\t\t\t\t\t\tSET unixtime = UNIX_TIMESTAMP()\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE name = 'last_galnet_update'\n\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1") or write_log(mysqli_error($GLOBALS["___mysqli_ston"]), __FILE__, __LINE__);
}
/*
*	fetch last check time and last new article time
*/
$last_galnet_check = edtb_common("last_galnet_check", "unixtime");
$last_galnet_new = edtb_common("last_galnet_new", "unixtime");
if ($last_galnet_new < $last_galnet_check) {
    echo "No new GalNet articles have been published since you last asked " . get_timeago($last_galnet_check, false) . ".";
} else {
    echo "New GalNet articles have been published since you last asked. Would you like me to read them to you?";
}
/*
*	 update last check time
*/
mysqli_query($GLOBALS["___mysqli_ston"], "\tUPDATE edtb_common\n\t\t\t\t\t\t\t\t\t\t\tSET unixtime = UNIX_TIMESTAMP()\n\t\t\t\t\t\t\t\t\t\t\tWHERE name = 'last_galnet_check'\n\t\t\t\t\t\t\t\t\t\t\tLIMIT 1") or write_log(mysqli_error($GLOBALS["___mysqli_ston"]), __FILE__, __LINE__);
is_null($___mysqli_res = mysqli_close($link)) ? false : $___mysqli_res;
Exemplo n.º 5
0
                    $rows = mysqli_query($GLOBALS["___mysqli_ston"], "\tSELECT system_name\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM user_visited_systems\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tDESC LIMIT 1") or write_log(mysqli_error($GLOBALS["___mysqli_ston"]), __FILE__, __LINE__);
                    $vs_arr = mysqli_fetch_assoc($rows);
                    $visited_on = date("Y-m-d") . " " . $visited_time;
                    if ($vs_arr["system_name"] != $curSys["name"] && !empty($curSys["name"])) {
                        mysqli_query($GLOBALS["___mysqli_ston"], "\tINSERT INTO user_visited_systems (system_name, visit)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t('" . mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $curSys["name"]) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $visited_on . "')") or write_log(mysqli_error($GLOBALS["___mysqli_ston"]), __FILE__, __LINE__);
                        // export to EDSM
                        if ($settings["edsm_api_key"] != "" && $settings["edsm_export"] == "true" && $settings["edsm_cmdr_name"] != "") {
                            $visited_on_utc = date("Y-m-d H:i:s");
                            $export = file_get_contents("http://www.edsm.net/api-logs-v1/set-log?commanderName=" . urlencode($settings["edsm_cmdr_name"]) . "&apiKey=" . $settings["edsm_api_key"] . "&systemName=" . urlencode($curSys["name"]) . "&dateVisited=" . urlencode($visited_on_utc) . "");
                            $exports = json_decode($export, true);
                            if ($exports["msgnum"] != "100") {
                                write_log($export, __FILE__, __LINE__);
                            }
                        }
                        $newSystem = true;
                        //write_log($prev_system . " new: " . $cssystemname);
                    }
                    // update latest system
                    edtb_common("last_system", "value", true, $curSys["name"]);
                    $newSystem = true;
                } else {
                    $newSystem = false;
                }
                global $curSys, $newSystem;
                break;
            }
        }
    }
} else {
    write_log("Error: " . $settings["log_dir"] . " doesn't exist or is not readable", __FILE__, __LINE__);
}
Exemplo n.º 6
0
 $time_frame = time() - 6 * 60 * 60;
 if ($last_update < $time_frame) {
     // run update script
     if (file_exists("" . $settings["install_path"] . "/bin/UpdateData/updatedata_bg.bat")) {
         $handle = popen("start \"UpdateData\" /b \"" . $settings["install_path"] . "/bin/UpdateData/updatedata_bg.bat\"", "r");
         pclose($handle);
     } else {
         write_log("Error: update error");
     }
 }
 /*
  *	update galmap json if system is new or file doesn't exist
  *	or if last update was more than an hour ago
  */
 $data['update_map'] = "false";
 $last_map_update = edtb_common("last_map_update", "unixtime");
 $map_update_time_frame = time() - 1 * 60 * 60;
 if ($newSystem !== false || !file_exists("" . $_SERVER["DOCUMENT_ROOT"] . "/map_points.json") || $last_map_update < $map_update_time_frame) {
     $data['update_map'] = "true";
 }
 $data['new_sys'] = "false";
 if ($newSystem !== false) {
     $data['new_sys'] = "true";
 }
 $data['current_system_name'] = $curSys["name"];
 $data['current_coordinates'] = $curSys["coordinates"];
 /*
  *	Data for the left column
  */
 require_once "" . $_SERVER["DOCUMENT_ROOT"] . "/get/getData_leftColumn.php";
 /*
Exemplo n.º 7
0
    }
    // update last_update_check time
    edtb_common("last_update_check", "unixtime", true, time());
}
$newest_version = edtb_common("latest_version", "value");
if (version_compare($current_version, $newest_version) < 0) {
    // get last_update_check value
    $ignore_version = edtb_common("last_update_check", "value");
    if ($newest_version != $ignore_version) {
        if ($json_file = file_get_contents("http://data.edtb.xyz/version.json")) {
            $json_data = json_decode($json_file, true);
            $short_desc = $json_data["short"];
            $long_desc = $json_data["versionInformation"];
            $data['notifications'] .= '<a href="javascript:void(0)" title="New version available" onclick="$(\'#notice_new\').fadeToggle(\'fast\')"><img src="/style/img/upgrade.png" style="height:26px;width:26px;margin-right:6px" alt="Upgrade" /></a>';
            $data['notifications_data'] = $short_desc . '<br /><br /><br />' . $long_desc;
            $data['notifications_data'] .= '<br /><br /><strong><a href="javascript:void(0)" onclick="ignore_version(\'' . $newest_version . '\')">Click here if you want to ignore this version</a></strong>';
        }
    }
}
/*
*	Display notification if user hasn't updated data in a while
*/
$last_update = edtb_common("last_data_update", "unixtime");
$now = time() - 7 * 24 * 60 * 60;
// 7 days
if ($now > $last_update) {
    $data['notifications'] .= '<a href="javascript:void(0)" title="Notice" onclick="$(\'#notice\').fadeToggle(\'fast\')"><img src="/style/img/notice.png" style="height:26px;width:26px" alt="Notice" /></a>';
}
if ($data['notifications'] == "") {
    $data['notifications'] = 'false';
}
Exemplo n.º 8
0
    if ($json_file = file_get_contents("http://data.edtb.xyz/version.json")) {
        $json_data = json_decode($json_file, true);
        $newest_version = $json_data["currentVersion"];
        // update latest_version value
        edtb_common("latest_version", "value", true, $newest_version);
    } else {
        $error = error_get_last();
        write_log("Error: " . $error["message"], __FILE__, __LINE__);
    }
    // update last_update_check time
    edtb_common("last_update_check", "unixtime", true, time());
}
$newest_version = edtb_common("latest_version", "value");
if (version_compare($current_version, $newest_version) < 0) {
    // get last_update_check value
    $ignore_version = edtb_common("last_update_check", "value");
    if ($newest_version != $ignore_version) {
        if ($json_file = file_get_contents("http://data.edtb.xyz/version.json")) {
            $json_data = json_decode($json_file, true);
            $short_desc = $json_data["short"];
            $long_desc = $json_data["versionInformation"];
            $data['notifications'] .= '<a href="javascript:void(0)" title="New version available" onclick="$(\'#notice_new\').fadeToggle(\'fast\')"><img src="/style/img/upgrade.png" class="icon26" alt="Upgrade" /></a>';
            $data['notifications_data'] = $short_desc . '<br /><br /><br />' . $long_desc;
            $data['notifications_data'] .= '<br /><br /><strong><a href="javascript:void(0)" onclick="ignore_version(\'' . $newest_version . '\')">Click here if you want to ignore this version</a></strong>';
        }
    }
}
/**
 * Display notification if user hasn't updated data in a while
 */
/*$last_update = edtb_common("last_data_update", "unixtime");
Exemplo n.º 9
0
                $new_file = "-1";
                if (file_exists($newfile)) {
                    $new_file = file_get_contents($newfile);
                }
                if ($new_file != $old_file) {
                    edtb_common("last_galnet_new", "unixtime", true, time());
                }
            }
            $in++;
        }
    }
    /**
     * update last_update time
     */
    edtb_common("last_galnet_update", "unixtime", true, time());
}
/**
 * fetch last check time and last new article time
 */
$last_galnet_check = edtb_common("last_galnet_check", "unixtime");
$last_galnet_new = edtb_common("last_galnet_new", "unixtime");
if ($last_galnet_new < $last_galnet_check) {
    echo "No new GalNet articles have been published since you last asked " . get_timeago($last_galnet_check, false) . ".";
} else {
    echo "New GalNet articles have been published since you last asked. Would you like me to read them to you?";
}
/**
 *  update last check time
 */
edtb_common("last_galnet_check", "unixtime", true, time());