/** * @param $edit_page * @param $obsolete_flag */ function print_versions($edit_page, $obsolete_flag) { $specmanagement_database_api = new specmanagement_database_api(); $specmanagement_print_api = new specmanagement_print_api(); $obsolote = false; if ($obsolete_flag) { $obsolote = null; } if ($edit_page) { $versions = version_get_all_rows_with_subs(helper_get_current_project(), null, null); } else { $versions = version_get_all_rows_with_subs(helper_get_current_project(), null, $obsolote); } for ($version_index = 0; $version_index < count($versions); $version_index++) { $version = $versions[$version_index]; $current_type = $specmanagement_database_api->get_type_string($specmanagement_database_api->get_type_by_version($version['id'])); $specmanagement_print_api->printRow(); echo '<input type="hidden" name="version_ids[]" value="' . $version['id'] . '"/>'; print_name($edit_page, $version); print_released($edit_page, $version_index, $version); print_obsolete($edit_page, $version_index, $version); print_date($edit_page, $version); print_type($edit_page, $current_type, $version); print_description($edit_page, $version); print_action($edit_page, $version); echo '</tr>'; } }
/** * @param $edit_page */ function print_types($edit_page) { $specmanagement_database_api = new specmanagement_database_api(); $specmanagement_print_api = new specmanagement_print_api(); $types = $specmanagement_database_api->get_full_types(); for ($type_index = 0; $type_index < count($types); $type_index++) { $type = $types[$type_index]; $type_id = $type[0]; $type_string = $type[1]; $type_options_set = $type[2]; $type_options = explode(';', $type_options_set); $option_show_duration = $type_options[0]; $option_show_expenses_overview = $type_options[1]; $option_show_directory = $type_options[2]; $specmanagement_print_api->printRow(); echo '<input type="hidden" name="type_ids[]" value="' . $type_id . '"/>'; print_name($type_string); print_duration($edit_page, $type_index, $option_show_duration); print_expoverview($edit_page, $type_index, $option_show_expenses_overview); print_dictionary($edit_page, $type_index, $option_show_directory); echo '</tr>'; } }
</div> <div class="col-md-3 portfolio-item"> <a href="<?php pic_location(11); ?> "> <img class="img-responsive" src="<?php pic_location(11); ?> " alt=""> </a> <h3><a href="<?php pic_location(11); ?> "><?php print_name(11); ?> </a></h3> <p><?php print_date(11); ?> </p> </div> </div> <!-- /.row --> <!-- Footer --> <footer> <div class="row">
$planet_listing = dbr(1); } $out .= "</table>"; print_page("Planet List", $out); } else { $out .= "There are no planets in the game.<p />"; } //give listing of all players in game to admin, and some of their details. } elseif (isset($_GET['player_list'])) { db("select login_id, cash, turns, turns_run, tech, game_login_count, genesis, one_brob, alpha, gamma, delta from {$db_name}_users where login_id > 5"); while ($player_info = dbr(1)) { db2("select count(planet_id), sum(fighters), sum(cash), sum(tech), sum(colon), sum(mining_drones), sum(metal), sum(fuel), sum(elect) from {$db_name}_planets where login_id = '{$player_info['login_id']}'"); $planet_info = dbr2(1); db2("select count(ship_id), sum(fighters), sum(shields), sum(armour), sum(cargo_bays), sum(metal), sum(fuel), sum(elect), sum(colon), sum(point_value), count(distinct location) from {$db_name}_ships where login_id = '{$player_info['login_id']}'"); $ship_info = dbr2(1); $out .= "<center><hr width = '200'></center><table cellspacing='1' cellpadding='2' border='0' bgcolor='#111111'><tr><th align='left'>" . print_name($player_info) . "</th></tr><tr><td>"; unset($player_info['login_id']); $player_info['one_brob'] = num_flagships($player_info['one_brob']); //player info $out .= make_table(array("Account Cash", "Turns", "Turns Run", "Account Tech", "Logins to game", "Genesis", "Flagship Count", "Alphas", "Gammas", "Delta")); $out .= make_row($player_info); //planet info $out .= "</table><br />Planets<br />" . make_table(array("Planet Count", "Planet Fighters", "Planet Cash", "Tech", "Colonists", "Mining Drones", "Metal", "Fuel", "Electronics")); $out .= make_row($planet_info); //ship info $out .= "</table><br />Ships<br />" . make_table(array("Ship<br />Count", "Ship<br />Fighters", "Shields", "Armour", "Cargo<br />Bays", "Metal", "Fuel", "Electronics", "Colonists", "Point<br />Value", "# Systems <br />with ships")); $out .= make_row($ship_info); $out .= "</table></td></tr></table>"; } print_page("Player Info", $out); //change intro message
//same clan as target //target still in safe turns if ($can_attack == 0 || $ships['login_id'] == 1 || $user['clan_id'] == $ships['clan_id'] && $user['clan_id'] > 0 || $ships['turns_run'] < $GAME_VARS['turns_safe']) { $error_str .= "<br />"; } else { db("select ship_id from {$db_name}_ships where login_id = '{$ships['login_id']}' && location='{$user['location']}' && config NOT REGEXP 'ls|hs' limit 1"); $to_attack = dbr(1); $error_str .= " - <a href='attack.php?target={$to_attack['ship_id']}'>" . $cw['attack'] . "</a><br />"; } //show cloaked ships if //is admin //is in same clan as ships //target in safe turns //has scanner and targets are only ls } elseif ($user['login_id'] == 1 || $ships['clan_id'] == $user['clan_id'] && $user['clan_id'] > 0 || $ships['turns_run'] < $GAME_VARS['turns_safe'] || config_check("ls", $ships) && config_check("sc", $ships)) { $error_str .= print_name($ships); if (config_check("ls", $ships)) { $error_str .= sprintf($st[64], $ships[total], $ships[fighters]); } else { $error_str .= sprintf($st[65], $ships[total], $ships[fighters]); } //don't show attack link if: //target is admin //player can't attack //target is in same clan //target in safe turns if ($user['login_id'] == 1 || $ships['clan_id'] == $user['clan_id'] && $user['clan_id'] > 0 || $ships['turns_run'] < $GAME_VARS['turns_safe']) { $error_str .= "<br />"; } else { db("select ship_id from {$db_name}_ships where login_id = '{$ships['login_id']}' && location='{$user['location']}' && config REGEXP 'ls' limit 1"); $to_attack = dbr(1);
function print_name_now($name) { $entry['name'] = $name; $entry['year'] = date('Y'); $entry['term'] = "Trinity"; if (date('n') > 9) { $entry['term'] = "Michaelmas"; } if (date('n') < 4) { $entry['term'] = "Hilary"; } print_name($entry); }
print_page($cw['send_clan_message'], $st[896]); } elseif ($target_id == -2 && $user['clan_id'] < 1) { print_page($cw['send_clan_message'], $st[897]); } elseif ($target_id == -4 && $user['login_id'] != 1 && $user['login_id'] != OWNER_ID) { print_page($cw['send_mass_message'], $st[898]); } elseif ($target_id == -5 && $user['clan_id'] < 1 && $user['login_id'] != 1 && $user['login_id'] != OWNER_ID) { print_page("Clan Forum", $cw[899]); } elseif ($target_id == -99 && $user['login_id'] != 1 && $user['login_id'] != OWNER_ID) { print_page($cw['admin_forum'], $st[898]); } elseif (empty($_POST['text']) || isset($_POST['preview'])) { $people_can_mess = $cw['enter_your_message_to'] . ' '; if ($target_id > 0) { //message to another player. db("select login_name,login_id,clan_sym,clan_sym_color from {$db_name}_users where login_id = '{$target_id}'"); $rec = dbr(1); $people_can_mess .= print_name($rec); } elseif ($target_id == -1) { $people_can_mess .= $st[900]; } elseif ($target_id == -2) { $people_can_mess .= $st[901]; } elseif ($target_id == -4) { $people_can_mess .= $st[902]; } elseif ($target_id == -5) { $people_can_mess .= $st[903]; } elseif ($target_id == -50) { $people_can_mess .= $st[904]; } elseif ($target_id == -99) { $people_can_mess .= $cw['admin_forum']; } else { #user has not specified a target, so list all the players who can be messaged $people_can_mess = $st[905] . "<p />\n<select name=target_id>";
function print_messages($target_id, $permissions, $clan_id, $col_arr) { global $db_name, $user, $user_options, $game_info, $last_time, $cw, $st; $clan_string_sql = ""; $clan_forum_str = ""; $ret_str = ""; if ($target_id < 0) { //forums $last_access = $user['last_access_forum']; if ($target_id == -5) { //clan forum $clan_string_sql = " && clan_id = '{$clan_id}' "; $clan_forum_str = "&clan_id={$clan_id}"; $last_access = $user['last_access_clan_forum']; } if (empty($last_time)) { //not set time to go back to $forum_time = time() - $user_options['forum_back'] * 3600; } else { $forum_time = (int) $last_time; } } else { //user messages $forum_time = 0; db("select count(message_id) from {$db_name}_messages where login_id = '{$target_id}'"); $counted = dbr(); $last_access = $user['last_access_msg']; } //central forum, different table. - external from game if ($target_id == -99 || $target_id == -50) { db("select *, sender_id as login_id from se_central_messages where timestamp > {$forum_time} && forum_id = '{$target_id}' order by timestamp desc"); $user_options['show_sigs'] = 0; //don't try to show sigs in these forums } else { //in-game message table. //note: due to the fact there is no user -1, this has to cheat and select the sig of user id 1 (admin who is always in game) to ensure messages are loaded. admin sig is not actually show though. db("select *, sender_id as login_id from {$db_name}_messages where login_id = '{$target_id}' and timestamp > {$forum_time} {$clan_string_sql} order by timestamp desc"); } $sig_array = array(); $i = 0; while ($messages = dbr(1)) { $printed_name = ""; //undeclare to next entry $no_reply = 0; //whether can reply $cols = 2; //num of cols within this post. //no sig, or not showing if ($user_options['show_sigs'] == 0 || $messages['login_id'] == -1) { $messages['sig'] = ""; //sig already loaded from previous message } elseif (isset($sig_array[$messages['login_id']])) { $messages['sig'] = $sig_array[$messages['login_id']]; //load the players sig } else { db2("select sig from {$db_name}_users where login_id = '{$messages['login_id']}'"); $temp_sig = dbr2(); $sig_array[$messages['login_id']] = mcit(stripslashes("\n\n" . $temp_sig['sig'])); $messages['sig'] = $sig_array[$messages['login_id']]; } $coul_fond = $messages['timestamp'] > $last_access ? $col_arr[3] : $col_arr[0]; $ret_str .= "\n<table border='0' cellpadding='5'>\n<tr bgcolor='{$coul_fond}'>"; //time and date of message. $ret_str .= "\n<td width='100'>\n<b>" . date("M d - H:i", $messages['timestamp']) . "</b></td>\n<td width='250'>"; if ($messages['login_id'] >= 1 && $target_id > -50) { //message by a player for in-game $printed_name = print_name($messages); } elseif (!empty($messages['forum_id'])) { //a central forum $no_reply = 1; $printed_name = "\n{$messages['sender_name']}"; } if (empty($printed_name)) { //message by an automated entity, or retired player $no_reply = 1; $printed_name = "\n<b class='b1'>{$messages['sender_name']}</b>"; } if ($target_id == -1) { $no_reply = 1; } $ret_str .= $printed_name; $ret_str .= "</td>\n"; //player link to delete messages (with checkboxes) if ($target_id > -50) { //can't do these things with the central forums $cols = 3; $ret_str .= "<td align='right' width='230'>"; if ($no_reply == 0) { //no reply link for certain messages $ret_str .= "<a href='message.php?target_id={$messages['sender_id']}&reply_to={$messages['message_id']}'>" . $cw['reply'] . "</a> - "; } $ret_str .= "<a href='message.php?forward={$messages['message_id']}'>" . $cw['forward'] . "</a> - <a href='diary.php?log_ent={$messages['message_id']}'>" . $cw['log'] . "</a>"; if ($target_id > 0 && $counted[0] > 1) { $ret_str .= " - <a href='{$_SERVER['PHP_SELF']}?killmsg={$messages['message_id']}'>" . $cw['delete'] . "</a> - <input type='checkbox' name='del_mess[{$messages['message_id']}]' value='{$messages['message_id']}' />"; //admin link to delete messages in forum } elseif ($permissions == 1) { $ret_str .= " - <a href='{$_SERVER['PHP_SELF']}?target_id={$target_id}&killmsg={$messages['message_id']}{$clan_forum_str}'>" . $cw['delete'] . "</a>"; } $ret_str .= "</td>"; } $ret_str .= "</tr>\n<tr>\n<td colspan='{$cols}' bgcolor='{$col_arr['1']}'><blockquote>{$messages['text']}</blockquote></td></tr>"; if (!empty($messages['sig'])) { $ret_str .= "<tr><td colspan='{$cols}' bgcolor='{$col_arr['2']}'>{$messages['sig']}</td></tr>"; } $ret_str .= "\n</table><p />"; $i++; } return $ret_str; }
$entry['term'] = "Michaelmas"; } if (date('n') < 4) { $entry['term'] = "Hilary"; } while ($line = mysql_fetch_array($result)) { $entry['name'] = "=" . $line['id']; if ($oldlevel == $line['level']) { print "<br>\n"; print_name($entry); } else { if ($oldlevel != -1) { print "</td></tr>\n"; } print '<tr><td class="login_head">' . $user_class[$line['level']] . 's</td></tr>'; print '<tr><td class="login">'; print_name($entry); } $oldlevel = $line['level']; } print "</td></tr>\n"; } print '<tr><td class="login">'; if ($num_mem > 0) { print "...and "; } print "{$num_guests} guest"; if ($num_guests != 1) { print "s"; } print ".</td></tr>\n";
$clan_ship = dbr(1); } $error_str .= "</table><p />"; $error_str .= $st[562] . " <input type=text name=join_fleet_id_2 value='' max=3 size=3 />"; $error_str .= "<input TYPE='hidden' name=fleet_type value=1 />"; $error_str .= " - <input type='submit' name=join_fleet_button value=" . $cw['change_fleet'] . " />"; $error_str .= " - <a href=javascript:TickAll(\"fleet_maint\")>" . $cw['invert_ship_selection'] . "</a><p /></form>"; /************* * Summary of Clan ships **************/ } else { db("select login_id, count(ship_id) as total, sum(fighters) as fighters from {$db_name}_ships where clan_id = {$user['clan_id']} group by login_id order by fighters desc, ship_name desc"); $clan_ship = dbr(1); $error_str .= "<br /><br /><a href='clan.php?show_clan_ships=1'>" . $cw['show_all_clan_ships'] . "</a><p />"; while ($clan_ship) { $error_str .= print_name($clan_ship) . " has <b>{$clan_ship['total']}</b> " . $cw['ship(s)'] . " w/ <b>{$clan_ship['fighters']}</b> " . $cw['total_fighters'] . "<br />"; $clan_ship = dbr(1); } $error_str .= "<br /><br />"; } $error_str .= "<a href='clan.php?ranking=1'>" . $cw['clan_rankings'] . "</a>"; $error_str .= "<br /><a href='clan.php?clan_info=1&target={$user['clan_id']}'>" . $cw['clan_information'] . "</a><br /><br />"; if ($user['login_id'] == $clan['leader_id'] || $user['login_id'] == 1) { $error_str .= "<a href='clan.php?changepass=1'>" . $cw['change_clan_password'] . "</a><br />"; if ($clan_member_count[$clan['clan_id']] > 1) { $error_str .= "<a href='clan.php?lead_change=1'>" . $cw['change_clan_leader'] . "</a><br />"; $error_str .= "<a href='message.php?target_id=-2&clan_id={$user['clan_id']}'>" . $cw['message_clan'] . "</a><br />"; } if ($user['login_id'] == 1 && $user['login_id'] != $clan['leader_id']) { $error_str .= "<a href='clan.php?leave=1'>" . $cw['leave_clan'] . "</a><br />"; }
$full = 0; } } elseif ($target == $user['login_id'] || $target == 1 || $user['clan_id'] == $player['clan_id'] && $user['clan_id'] > 0 || $user['login_id'] == 1 || $user['login_id'] == OWNER_ID) { #admin can see all, but not aliens/pirates $full = 1; } else { #if none of the above are true, then a more limited view is given. $full = 0; } //keep track of who admin is looking at. if ($user['login_id'] == 1) { insert_history($user['login_id'], $st[1511] . " {$player['login_name']}"); } $text .= "<a href='message.php?target_id={$target}'>" . $cw['send_message_to'] . " {$player['login_name']}</a><br /><br />"; $text .= make_table(array("", "")); $text .= quick_row($cw['game_name'], print_name($player)); if ($full == 1 || isset($special_show)) { $text .= quick_row($cw['login_name'], $player['generic_l_name']); if (isset($special_show)) { $text .= quick_row($st[875], $player['real_name']); $text .= quick_row($cw['purpose'], "{$player['email_address']}"); } else { $text .= quick_row($cw['real_name'], $player['real_name']); $text .= quick_row($cw['email_address'], "<a href='mailto:{$player['email_address']}'>{$player['email_address']}</a>"); } if ($user['login_id'] == OWNER_ID && OWNER_ID != 0) { $text .= quick_row(" ", ""); $text .= quick_row($st[1512], $player['login_count']); $text .= quick_row($st[1513], $player['page_views']); } $text .= quick_row(" ", "");
$messages = $output_str; #sets the largest span distance. Allows for quicker manipulation of the page. $span_dist = 2; $output_str = "<table width=90%>"; $r_name_txt = ""; #determine if user can re-name planet. if ($has_pass == 1) { $r_name_txt .= " - <a href='planet.php?planet_id={$planet_id}&rename=1'>" . $cw['rename'] . "</a>"; } // begin printing of page $output_str .= quick_row($cw['planet_name'], "<b class='b1'>{$planet['planet_name']}</b>{$r_name_txt}"); #print no name if the owner has none if ($planet['login_id'] == 0) { $output_str .= quick_row($cw['owner_by'], $cw['noone']); } else { $output_str .= quick_row($cw['owner_by'], $st[1676] . ": <b class='b1'>" . print_name(array('login_id' => $planet['login_id'])) . "</b>"); } #show the planetary picture if ($user_options['show_pics']) { $output_str .= "<tr><td colspan={$span_dist}><center><img src={$directories['images']}/planets/" . $planet['planet_img'] . ".jpg border=0 alt='Image of the planet' /></center></td></tr>"; } if (!empty($messages)) { $output_str .= "<tr><td colspan={$span_dist}><center>{$messages}</center></td></tr>"; } $output_str .= "</table><p />"; #players may only view planetary data when they have the planet as their own. if ($has_pass == 1) { $output_str .= "<table>"; if (empty($planet['pass'])) { $temp_str = ""; if ($user['login_id'] == $planet['login_id']) {
$ct1 = $ct2; } } if ($table != 2) { $player['cash'] = $ct1; } if (!isset($player['last_attack_by']) && $table == 2) { $player['last_attack_by'] = "~"; } if (isset($player['clan_sym']) && $table == 2) { $player['clan_sym'] = "<font color=#{$player['clan_sym_color']}>{$player['clan_sym']}</font>"; $player['clan_sym_color'] = ""; } elseif (isset($table) && $table == 2) { $player['clan_sym'] = "~"; } if (isset($player['last_attack']) && $player['last_attack'] == 1) { $player['last_attack'] = "~"; } elseif (isset($player['last_attack'])) { $player['last_attack'] = date("M d - H:i", $player['last_attack']); } if (isset($player['joined_game'])) { $player['joined_game'] = date("M d - H:i", $player['joined_game']); } $dis_name = print_name($player); $player['login_name'] = $dis_name; unset($player['login_id'], $player['clan_sym_color']); $text .= make_row($player); $ct2++; } $text .= "</table><br />"; print_page($cw['player_ranking'], $text);
<?php function print_name($array) { $number_of_keys = count($array); foreach ($array as $key => $value) { echo "There are " . $number_of_keys . " keys in this array: " . $key . ", " . $key; foreach ($array as $key => $value) { echo "<br>The value in the key " . $key . " is " . $value; } } } $users['first_name'] = "Sourabh"; $users['last_name'] = "Pal"; print_name($users);
function add_user_to_users_array(&$players_array, &$ships_involved_str, &$name_str, $data_array, $friend_or_foe) { //player already in the array, so skip adding again. if (array_key_exists($data_array['login_id'], $players_array)) { return (int) 0; } $players_array[$data_array['login_id']] = array('login_id' => $data_array['login_id'], 'clan_id' => $data_array['clan_id'], 'login_name' => $data_array['login_name'], 'location' => $data_array['location'], 'login_name_link' => print_name($data_array), 'player_ship_count' => 0, 'total_fighters' => 0, 'ship_points_killed' => 0, 'ship_points_lost' => 0, 'friend_foe' => $friend_or_foe, 'fighters_lost' => 0, 'fighters_killed' => 0, 'ships_lost' => 0, 'ships_killed' => 0, 'ship_id' => $data_array['ship_id'], 'replacement_ship' => ""); //thinking a long way ahead. :) $ships_involved_str[$data_array['login_id']] = array('lost' => "", 'survived' => ""); !empty($name_str) ? $name_str .= "," : 1; $name_str .= " " . $players_array[$data_array['login_id']]['login_name_link']; }
} } elseif ($view) { #Show all items in a particular catagory. $text .= $st[358] . "<p />"; db2("select item_name,descr,timestamp,going_price,bidder_id,item_id from {$db_name}_bilkos where item_type = {$view} && active=1 && timestamp + '{$bilkos_seconds}' > " . time() . " order by timestamp asc, item_name asc"); $items = dbr2(1); if (!$items) { $text .= $st[359]; } else { $text .= make_table(array($cw['item_name'], $cw['description'], $cw['open_till'], $cw['present_price'], $cw['present_bidder'])); while ($items) { $items['going_price'] = $items['going_price']; if ($items['bidder_id'] > 0) { db("select login_name,login_id,clan_sym,clan_sym_color from {$db_name}_users where login_id = {$items['bidder_id']}"); $bidder = dbr(1); $items['bidder_id'] = print_name($bidder); $items['timestamp'] = date("M d - H:i", $items['timestamp'] + $bilkos_seconds); } else { $items['bidder_id'] = "None Yet"; $items['timestamp'] = date("M d - H:i", $items['timestamp'] + $bilkos_seconds * 2); } $items['item_id'] = " - <a href='bilkos.php?bid={$items['item_id']}'>" . $cw['bid'] . "</a>"; $text .= make_row($items); $items = dbr2(1); } $text .= "</table>"; } } if ($show_won) { #Show items user has won. db2("select item_name,item_type,item_id from {$db_name}_bilkos where active=0 && bidder_id='{$user['login_id']}'");