function planet_show_planet($planet_id) { assert(!empty($planet_id)); global $_GALAXY; global $_CONFIG; global $_RUN; if (!anomaly_is_planet($planet_id)) { return; } $planet = anomaly_get_anomaly($planet_id); $result = sql_query("SELECT * FROM g_ores WHERE planet_id=" . $planet_id); $ore = sql_fetchrow($result); $stock_ore = ore_csl_to_list($ore['stock_ores']); $race = user_get_race($planet['user_id']); $sector = sector_get_sector($planet['sector_id']); $result = sql_query("SELECT * FROM s_state WHERE id=" . $planet['state_id']); $state = sql_fetchrow($result); if ($race == "") { $race = "-"; } $extra_attack = 0; $extra_defense = 0; $attack = $planet['cur_attack']; $defense = $planet['cur_attack']; // Count all ships and their attack/defense currently in orbit around the planet $result = sql_query("SELECT COUNT(*) FROM g_vessels AS g, s_vessels AS s WHERE g.planet_id=" . $planet_id . " AND s.id = g.vessel_id AND s.type='" . VESSEL_TYPE_BATTLE . "' AND status='ORBIT' AND created=1"); $tmp = sql_fetchrow($result); $battle_vessels = $tmp[0]; $result = sql_query("SELECT COUNT(*) FROM g_vessels AS g, s_vessels AS s WHERE g.planet_id=" . $planet_id . " AND s.id = g.vessel_id AND s.type='" . VESSEL_TYPE_TRADE . "' AND status='ORBIT' AND created=1"); $tmp = sql_fetchrow($result); $trade_vessels = $tmp[0]; $result = sql_query("SELECT COUNT(*) FROM g_vessels AS g, s_vessels AS s WHERE g.planet_id=" . $planet_id . " AND s.id = g.vessel_id AND s.type='" . VESSEL_TYPE_EXPLORE . "' AND status='ORBIT' AND created=1"); $tmp = sql_fetchrow($result); $explore_vessels = $tmp[0]; $result = sql_query("SELECT SUM(cur_attack) AS CA, SUM(cur_defense) AS CD FROM g_vessels AS g WHERE g.planet_id=" . $planet_id . " AND status='ORBIT' AND created=1"); $tmp = sql_fetchrow($result); if (isset($tmp['CA'])) { $extra_attack = $extra_attack + $tmp['CA']; } if (isset($tmp['CD'])) { $extra_defense = $extra_defense + $tmp['CD']; } $template = new Smarty(); $template->debugging = true; $template->assign("sector_name", $sector['name']); $template->assign("planet_name", $planet['name']); $template->assign("image", $_CONFIG['IMAGE_URL'] . $_GALAXY['image_dir'] . "/planets/" . $planet['image'] . ".jpg"); if ($planet['unknown'] == 1) { $template->assign("cmd", encrypt_get_vars("claim")); $template->assign("formid", generate_form_id()); $template->assign("aid", encrypt_get_vars($planet_id)); $template->assign("rename_form_visible", "true"); } else { $template->assign("rename_form_visible", "false"); } $template->assign("class", $planet['class']); $template->assign("race", $race); $template->assign("state", $state['name']); $template->assign("happieness", planet_get_happy_string($planet['happieness'])); $template->assign("healtieness", planet_get_healty_string($planet['sickness'])); $template->assign("population", $planet['population']); $template->assign("radius", $planet['radius']); $template->assign("distance", $planet['distance']); $template->assign("water", $planet['water']); $template->assign("temperature", $planet['temperature']); for ($i = 0; $i != ore_get_ore_count(); $i++) { $tmp = array(); $tmp['name'] = ore_get_ore_name($i); $tmp['stock'] = $stock_ore[$i]; $tmpvar[] = $tmp; } $template->assign("ores", $tmpvar); $template->assign("attack", $attack); $template->assign("extra_attack", $extra_attack); $template->assign("defense", $defense); $template->assign("extra_defense", $extra_defense); $template->assign("strength", $planet['cur_strength']); $template->assign("orbit_battle", $trade_vessels); $template->assign("orbit_trade", $battle_vessels); $template->assign("orbit_explore", $explore_vessels); $template->assign("description", convert_px_to_html_tags($planet['description'])); $template->display($_RUN['theme_path'] . "/planet-details.tpl"); $commands = array(); // If we have at least 1 ship in orbit, we can view them here... if ($explore_vessels + $trade_vessels + $battle_vessels > 0) { $commands['View Vessels'] = "vessel.php?cmd=" . encrypt_get_vars("showaid") . "&aid=" . encrypt_get_vars($planet_id); } // If it's a solid-class planet (lower than M), we can view the surface. if (planet_is_habitable($planet_id) or planet_is_minable($planet_id)) { $commands['View Surface'] = "surface.php?cmd=" . encrypt_get_vars("show") . "&aid=" . encrypt_get_vars($planet_id); } // If it's our planet we might construct and manufacture,.. if (anomaly_am_i_owner($planet['id'])) { $commands['Change Description'] = "anomaly.php?cmd=" . encrypt_get_vars("description") . "&aid=" . encrypt_get_vars($planet_id); // Only minable or habitable or lower can construct if (planet_is_habitable($planet_id) or planet_is_minable($planet_id)) { $commands['Construct'] = "construct.php?cmd=" . encrypt_get_vars("show") . "&aid=" . encrypt_get_vars($planet_id); $commands['Manufacture'] = "manufacture.php?cmd=" . encrypt_get_vars("show") . "&aid=" . encrypt_get_vars($planet_id); } if (planet_has_vesselbuilding_capability($planet_id)) { $commands['Create Vessel'] = "vesselcreate.php?cmd=" . encrypt_get_vars("showaid") . "&aid=" . encrypt_get_vars($planet_id); } } create_submenu($commands); }
function message_show_alliance($user_id) { assert(is_numeric($user_id)); global $_CONFIG; $user = user_get_user($user_id); $result = sql_query("SELECT * FROM m_alliance WHERE deleted=0 AND alliance_id = " . $user['alliance_id'] . " ORDER BY DATETIME DESC"); while ($message = sql_fetchrow($result)) { if ($message['from_uid'] == UID_NOBODY) { $from_user['avatar'] = "default.gif"; } else { $from_user = user_get_perihelion_user($message['from_uid']); } $template = new Smarty(); $template->debugging = true; $template->assign("from", $message['msg_from']); $template->assign("datetime", $message['datetime']); $template->assign("subject", $message['msg_subject']); $template->assign("image", $_CONFIG['IMAGE_URL'] . '/users/' . $from_user['avatar']); $template->assign("body", convert_px_to_html_tags($message['text'])); $template->display($_RUN['theme_path'] . "/messages-alliance-msg.tpl"); } }
<?php // Include Files include "includes.inc.php"; // Session Identification //session_identification (); session_start(); // We don't need to be logged in to use the help system i think... print_header(); print_title("Help", "Here we will try to tell you everything you need to know about Perihelion."); $topic = decrypt_get_vars($_REQUEST['hid']); $template = new Smarty(); $result = sql_query("SELECT * FROM perihelion.help WHERE id LIKE '{$topic}'"); if (sql_countrows($result) == 0) { $template->assign("help", ""); } else { $row = sql_fetchrow($result); $template->assign("topic", $topic); $template->assign("help", convert_px_to_html_tags($row['help'])); } $template->display($_RUN['theme_path'] . "/help.tpl"); print_footer(); exit;