Example #1
0
/**
 * Make items
 *
 * @param array $arr
 * @param string $type
 * @param int $i
 * @return string
 * @author Mauri Kujala <*****@*****.**>
 */
function makeitem($arr, $type, &$i)
{
    global $usex, $usey, $usez;
    $item_id = $arr["id"];
    $item_text = $arr["text"];
    $item_name = $arr["item_name"];
    $item_system_name = $arr["system_name"];
    $item_system_id = $arr["system_id"];
    $item_cat_name = $arr["catname"];
    $item_coordx = $arr["item_coordx"];
    $item_coordy = $arr["item_coordy"];
    $item_coordz = $arr["item_coordz"];
    if (valid_coordinates($item_coordx, $item_coordy, $item_coordz)) {
        $distance = number_format(sqrt(pow($item_coordx - $usex, 2) + pow($item_coordy - $usey, 2) + pow($item_coordz - $usez, 2)), 1) . " ly";
    } else {
        $distance = "n/a";
    }
    // if visited, change border color
    $visited = mysqli_num_rows(mysqli_query($GLOBALS["___mysqli_ston"], "\tSELECT id\n\t\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\t\tWHERE system_name = '" . mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $item_system_name) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1"));
    $style_override = $visited ? ' style="border-left: 3px solid #3DA822"' : "";
    $tdclass = $i % 2 ? "dark" : "light";
    // check if system has screenshots
    $screenshots = has_screenshots($item_system_name) ? '<a href="/Gallery.php?spgmGal=' . urlencode($item_system_name) . '" title="View image gallery"><img src="/style/img/image.png" class="icon" alt="Gallery" style="margin-left:5px;margin-right:0;vertical-align:top" /></a>' : "";
    // check if system is logged
    $loglink = is_logged($item_system_name) ? '<a href="log.php?system=' . urlencode($item_system_name) . '" style="color:inherit" title="System has log entries"><img src="/style/img/log.png" class="icon" style="margin-left:5px;margin-right:0;vertical-align:top" /></a>' : "";
    echo '<tr>
			<td class="' . $tdclass . '" style="min-width:420px;max-width:500px">
				<div class="poi"' . $style_override . '>
					<a href="javascript:void(0)" onclick="update_values(\'/get/get' . $type . 'EditData.php?' . $type . '_id=' . $item_id . '\',\'' . $item_id . '\');tofront(\'add' . $type . '\')" style="color:inherit" title="Click to edit entry">';
    echo '(' . $distance . ')';
    if (!empty($item_system_id)) {
        echo '</a>&nbsp;<a title="System information" href="/System.php?system_id=' . $item_system_id . '" style="color:inherit">';
    } elseif ($item_system_name != "") {
        echo '</a>&nbsp;<a title="System information" href="/System.php?system_name=' . urlencode($item_system_name) . '" style="color:inherit">';
    } else {
        echo '</a>&nbsp;<a href="#" style="color:inherit">';
    }
    if (empty($item_name)) {
        echo $item_system_name;
    } else {
        echo $item_name;
    }
    echo '</a>' . $loglink . $screenshots . '<span class="right" style="margin-left:5px">' . $item_cat_name . '</span><br />';
    echo nl2br($item_text);
    echo '		</div>';
    echo '	</td>';
    echo '</tr>';
    $i++;
}
Example #2
0
*  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
*/
/** require functions */
require_once "" . $_SERVER["DOCUMENT_ROOT"] . "/source/functions.php";
$system = $_GET["system"];
/*
*	check if system has screenshots
*/
$screenshots = has_screenshots($system) ? '<a href="/Gallery.php?spgmGal=' . urlencode($system) . '" title="View image gallery"><img src="/style/img/image.png" alt="Gallery" style="margin-left:5px;vertical-align:top" /></a>' : "";
/*
*	check if system is in the bookmarks
*/
$ress2 = mysqli_query($GLOBALS["___mysqli_ston"], "\tSELECT user_bookmarks.comment, user_bookmarks.added_on\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM user_bookmarks\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE user_bookmarks.system_name = '" . mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $system) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1") or write_log(mysqli_error($GLOBALS["___mysqli_ston"]), __FILE__, __LINE__);
$count2 = mysqli_num_rows($ress2);
if ($count2 > 0) {
    $arras = mysqli_fetch_assoc($ress2);
    $comment = $arras["comment"];
    $added_on = $arras["added_on"];
    if ($comment != "") {
        echo 'Bookmark comment: ' . $comment . ' - ';
    }
    echo 'Bookmark added: ' . get_timeago($added_on, false) . '';
    echo '<br />';
}
Example #3
0
/**
 * Make items
 *
 * @param array $arr
 * @param string $type
 * @param int $i
 * @return string
 * @author Mauri Kujala <*****@*****.**>
 */
function makeitem($arr, $type, &$i)
{
    global $usex, $usey, $usez;
    $item_id = $arr["id"];
    $item_text = $arr["text"];
    $item_name = $arr["item_name"];
    $item_system_name = $arr["system_name"];
    $item_system_id = $arr["system_id"];
    $item_cat_name = $arr["catname"];
    $item_coordx = $arr["item_coordx"];
    $item_coordy = $arr["item_coordy"];
    $item_coordz = $arr["item_coordz"];
    if (valid_coordinates($item_coordx, $item_coordy, $item_coordz)) {
        $distance = number_format(sqrt(pow($item_coordx - $usex, 2) + pow($item_coordy - $usey, 2) + pow($item_coordz - $usez, 2)), 1) . " ly";
    } else {
        $distance = "n/a";
    }
    // if visited, change border color
    $style_override = "";
    $visited = mysqli_num_rows(mysqli_query($GLOBALS["___mysqli_ston"], "\tSELECT id\n\t\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\t\tWHERE system_name = '" . mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $item_system_name) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1"));
    if ($visited) {
        $style_override = ' style="border-left: 3px solid #3DA822"';
    }
    if ($i % 2) {
        $tdclass = "dark";
    } else {
        $tdclass = "light";
    }
    // check if system has screenshots
    $screenshots = has_screenshots($item_system_name) ? '<a href="/Gallery.php?spgmGal=' . urlencode($item_system_name) . '" title="View image gallery"><img src="/style/img/image.png" alt="Gallery" style="margin-left:5px;vertical-align:top" /></a>' : "";
    // check if system is logged
    $loglink = is_logged($item_system_name) ? '<a href="log.php?system=' . urlencode($item_system_name) . '" style="color:inherit" title="System has log entries"><img src="/style/img/log.png" style="margin-left:5px;vertical-align:top" /></a>' : "";
    echo '<tr>
			<td class="' . $tdclass . '" style="min-width:420px;max-width:500px">
				<div class="poi"' . $style_override . '>
					<a href="javascript:void(0)" onclick="update_values(\'/get/get' . $type . 'EditData.php?' . $type . '_id=' . $item_id . '\',\'' . $item_id . '\');tofront(\'add' . $type . '\')" style="color:inherit" title="Click to edit entry">';
    echo '(' . $distance . ')';
    if (!empty($item_system_id)) {
        echo '</a>&nbsp;<a title="System information" href="/System.php?system_id=' . $item_system_id . '" style="color:inherit">';
    } elseif ($item_system_name != "") {
        echo '</a>&nbsp;<a title="System information" href="/System.php?system_name=' . urlencode($item_system_name) . '" style="color:inherit">';
    } else {
        echo '</a>&nbsp;<a href="#" style="color:inherit">';
    }
    if (empty($item_name)) {
        echo $item_system_name;
    } else {
        echo $item_name;
    }
    echo '</a>' . $loglink . $screenshots . '<span class="right" style="margin-left:5px">' . $item_cat_name . '</span><br />';
    // make a link if text includes url
    /*$reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";
    
    	if (preg_match($reg_exUrl, $item_text, $url))
    	{
    		if (mb_strlen($item_text) >= 60)
    		{
    			$urli = "" . substr($item_text, 0, 60) . "...";
    		}
    		else
    		{
    			$urli = $item_text;
    		}
    		$item_text = preg_replace($reg_exUrl, "<a href='" . $url[0] . "' target='_BLANK'>" . $urli . "</a> ", $item_text);
    	}*/
    echo nl2br($item_text);
    echo '</div></td></tr>';
    $i++;
}
Example #4
0
/**
 * Parse data for Data Point
 *
 * @param string $key field name
 * @param string $value field value
 * @param float $d_x x coordinate
 * @param float $d_y y coordinate
 * @param float $d_z z coordinate
 * @param bool $dist
 * @param string $table table name
 * @param bool $enum
 * @return string $this_row parsed html td tag
 * @author Mauri Kujala <*****@*****.**>
 */
function set_data($key, $value, $d_x, $d_y, $d_z, &$dist, $table, $enum)
{
    global $curSys;
    $distance = "";
    $this_row = "";
    // Regular Expression filter for links
    $reg_exUrl = "/(http|https|ftp|ftps)\\:\\/\\/[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(\\/\\S*)?/";
    if ($value == "") {
        $value = "n/a";
    }
    if ($dist !== false) {
        // figure out what coords to calculate from
        $usable_coords = usable_coords();
        $usex = $usable_coords["x"];
        $usey = $usable_coords["y"];
        $usez = $usable_coords["z"];
        $exact = $usable_coords["current"] === true ? "" : " *";
        if (valid_coordinates($d_x, $d_y, $d_z)) {
            $distance = number_format(sqrt(pow($d_x - $usex, 2) + pow($d_y - $usey, 2) + pow($d_z - $usez, 2)), 2);
            $this_row .= '<td style="padding:10px;white-space:nowrap;vertical-align:middle">' . $distance . '' . $exact . '</td>';
        } else {
            $this_row .= '<td style="padding:10px;vertical-align:middle">n/a</td>';
        }
        $dist = false;
    }
    // make a link for systems with an id
    if ($key == "system_id" && $value != "0") {
        $this_row .= '<td style="padding:10px;vertical-align:middle"><a href="/System.php?system_id=' . $value . '">' . $value . '</a></td>';
    } elseif (strpos($key, "system_name") !== false && $value != "0" || $key == "name" && $table == "edtb_systems") {
        // check if system has screenshots
        $screenshots = has_screenshots($value) ? '<a href="/Gallery.php?spgmGal=' . urlencode($value) . '" title="View image gallery"><img src="/style/img/image.png" class="icon" alt="Gallery" style="vertical-align:top;margin-left:5px;margin-right:0" /></a>' : "";
        // check if system is logged
        $loglink = is_logged($value) ? '<a href="log.php?system=' . urlencode($value) . '" style="color:inherit" title="System has log entries"><img src="/style/img/log.png" class="icon" alt="Log" style="vertical-align:top;margin-left:5px;margin-right:0" /></a>' : "";
        $this_row .= '<td style="padding:10px;vertical-align:middle"><a href="/System.php?system_name=' . urlencode($value) . '">' . $value . '' . $loglink . $screenshots . '</a></td>';
    } elseif (strpos($key, "price") !== false || strpos($key, "ls") !== false || strpos($key, "population") !== false || strpos($key, "distance") !== false) {
        if (is_numeric($value) && $value != null) {
            $this_row .= '<td style="padding:10px;vertical-align:middle">' . number_format($value) . '</td>';
        } else {
            $this_row .= '<td style="padding:10px;vertical-align:middle">n/a</td>';
        }
    } elseif (preg_match($reg_exUrl, $value, $url)) {
        if (mb_strlen($value) >= 80) {
            $urli = substr($value, 0, 80) . "...";
        } else {
            $urli = $value;
        }
        $this_row .= '<td style="padding:10px;vertical-align:middle">' . preg_replace($reg_exUrl, "<a href='" . $url[0] . "' target='_BLANK'>" . $urli . "</a> ", $value) . '</td>';
    } elseif ($enum !== false) {
        $real_value = "n/a";
        if ($value == "0") {
            $real_value = "<span class='enum_no'>&#10799;</span>";
        }
        if ($value == "1") {
            $real_value = "<span class='enum_yes'>&#10003;</span>";
        }
        $this_row .= '<td style="padding:10px;text-align:center;vertical-align:middle">' . $real_value . '</td>';
    } else {
        $this_row .= '<td style="padding:10px;vertical-align:middle">' . substr(strip_tags($value), 0, 100) . '</td>';
    }
    // parse log entries
    if ($key == "log_entry") {
        if (mb_strlen($value) >= 100) {
            $this_row = '<td style="padding:10px;vertical-align:middle">' . substr(strip_tags($value), 0, 100) . '...</td>';
        } else {
            $this_row = '<td style="padding:10px;vertical-align:middle">' . $value . '</td>';
        }
    }
    return $this_row;
}
Example #5
0
?>
						</tr>
						<?php 
if ($count > 0) {
    $last_system = "";
    while ($arr = mysqli_fetch_assoc($res)) {
        $system = $arr["system"];
        $system_id = $arr["system_id"];
        $sys_population = number_format($arr["population"]);
        $sys_economy = $arr["economy"];
        $sys_government = $arr["government"];
        $sys_security = $arr["security"];
        $allegiance = $arr["allegiance"];
        $station_name = $arr["station_name"];
        // check if system has screenshots
        $screenshots = has_screenshots($system) ? '<a href="/Gallery.php?spgmGal=' . urlencode($system) . '" title="View image gallery"><img src="/style/img/image.png" class="icon" alt="Gallery" style="margin-left:0" /></a>' : "";
        // check if system is logged
        $loglink = is_logged($system_id, true) ? '<a href="log.php?system=' . urlencode($system) . '" style="color:inherit" title="System has log entries"><img src="/style/img/log.png" class="icon" style="margin-left:0" /></a>' : "";
        $ss_coordx = $arr["coordx"];
        $ss_coordy = $arr["coordy"];
        $ss_coordz = $arr["coordz"];
        $distance = sqrt(pow($ss_coordx - $usex, 2) + pow($ss_coordy - $usey, 2) + pow($ss_coordz - $usez, 2));
        // get allegiance icon
        $pic = get_allegiance_icon($allegiance);
        if ($system != $last_system) {
            ?>
									<tr>
										<td class="transparent" style="text-align:center">
											<img src="style/img/<?php 
            echo $pic;
            ?>