function send_email($config = false, $email = false) { $config = config_check($config); $email = email_check($email); if ($config && $email) { // require_once("phpmailer/class.phpmailer.php"); require 'phpmailer/PHPMailerAutoload.php'; $mail = new PHPMailer(); log_message('error', 'nohtml.' . print_r($email->nohtml, true)); if ($email->nohtml) { $mail->IsHTML(false); } else { $mail->IsHTML(true); } $mail->IsSMTP(); // enable SMTP // $mail->SMTPDebug = 2; // debugging: 1 = errors and messages, 2 = messages only $mail->SMTPAuth = true; // authentication enabled if ($config->ssl) { if (trim($config->host) == 'smtp.live.com') { $mail->SMTPSecure = 'tls'; // secure transfer enabled REQUIRED for GMail } else { if (preg_match('/amazonaws.com/', $config->host)) { $mail->SMTPSecure = 'tls'; // secure transfer enabled REQUIRED for GMail } else { $mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail } } } $mail->Host = $config->host; $mail->Port = $config->port; $mail->Username = $config->username; $mail->Password = $config->password; if ($email->reply) { $mail->AddReplyTo($email->reply, $email->reply_name); } if ($email->bcc) { if (count($email->bcc) > 1) { foreach ($email->bcc as $rowbcc) { $mail->AddBCC($rowbcc); } } else { $mail->AddBCC($email->bcc); } } if ($email->attachment) { foreach ($email->attachment as $row) { $mail->AddAttachment($row); } } $mail->SetFrom($email->from, $email->from_name); $mail->Subject = $email->subject; $mail->Body = $email->message; $mail->AddAddress($email->to, $email->to); if ($mail->Send()) { return 1; } else { return $mail->ErrorInfo; } } return 0; }
$file_rand = ""; } else { $file_rand = "_" . $game_info['random_filename']; } $error_str .= "<table border=1 bordercolor=#808080 cellspacing=0 cellpadding=0>\n<tr>\n<td>\n<img src={$directories['images']}/{$db_name}_maps/sm{$user['location']}{$file_rand}.png border=0 width=300 height=300 alt=\"Mini-carte des systèmes autour de #{$user['location']}\" usemap='#system_map' />"; } //map for the mini-map: $error_str .= "<map name='system_map'>\n"; //get location of each star linked to db("select star_id, x_loc, y_loc from {$db_name}_stars where star_id = '" . implode('\' || `star_id` = \'', $star_links) . "'"); if (!empty($star_links)) { //compensate for present star location. Note: -100 is half of mini-map size. while ($loop_stars = dbr()) { $loop_stars['x_loc'] -= $star['x_loc'] - 150; $loop_stars['y_loc'] -= $star['y_loc'] - 150; $linkInfo[(int) $loop_stars['star_id']] = $loop_stars; } //create html foreach ($linkInfo as $id => $s) { $error_str .= "<area shape='rect' coords='" . ($s['x_loc'] - 10) . "," . ($s['y_loc'] - 10) . "," . ($s['x_loc'] + 10) . "," . ($s['y_loc'] + 10) . "' href='location.php?toloc={$id}' alt='Système #{$id}' />\n"; } } $error_str .= "</map></td></tr></table><a href='location.php?minimap=1'>Basculer en affichage 3D</a>"; } if (config_check("sj", $user_ship)) { $error_str .= "<p />" . make_table2(array($cw['subspace_jump']), "s_funcs"); $error_str .= q_row("<form name='subspace_form' action='location.php' method='POST'><center>" . $cw['set_destination_jump'] . "<br /><input type='text' size='4' maxlength='4' name='subspace' class='inputtext' /> - <input type='submit' value='" . $cw['jump'] . "' />", "l_col"); } //close the table that seperates the minimap $error_str .= "</td></tr></table>"; print_page($header, $error_str);
$output_str .= strtolower($st[577]) . " <input type='text' name='fleet_id' value='' max='3' size='3' class='inputtext' /><br />"; $output_str .= "<input type='radio' name='fleet_manip' value='2' id='destruction2' /> <label for='destruction2'>" . $cw['self_destruct'] . "</label> " . $st[1984] . "<br /><br /> "; if ($user['clan_id'] > 0 && $GAME_VARS['clan_fleet_attacking'] == 1) { $output_str .= $cw['clan_fleet'] . "<input TYPE='radio' NAME='fleet_manip' value=1 />"; } $output_str .= "<input type='submit' value=" . $cw['process'] . " /><br />"; $output_str .= "</form><p />"; } } else { $output_str .= $st[578]; } $ship_stuff = ""; if ($user_ship['empty_bays'] != $user_ship['cargo_bays']) { $ship_stuff .= q_row("<a href='location.php?jettison=1'>" . $cw['jettison_cargo'] . "</a>", "l_col"); } if (config_check("er", $user_ship)) { $ship_stuff .= q_row("<a href='location.php?emergency_return=1'>" . $cw['emergency_return'] . "!</a>", "l_col"); } if ($user['genesis'] > 0) { $ship_stuff .= q_row("<a href='planet_build.php?location={$user['location']}'>" . $cw['use_genesis_device'] . "</a> (<b>{$user['genesis']}</b>)", "l_col"); } if ($user['gdt'] > 0) { $ship_stuff .= q_row("<a href='location.php?tempo=1'>" . $cw['deployer_bulle_tempo'] . "</a> (<b>" . $user['gdt'] . "</b>)", "l_col"); } if ($user['alpha'] > 0) { $ship_stuff .= q_row("<a href='bombs.php?alpha=1'>" . $cw['deploy_alpha_bomb'] . "</a> (<b>{$user['alpha']}</b>)", "l_col"); } if ($user['gamma'] > 0) { $ship_stuff .= q_row("<a href='bombs.php?bomb_type=1'>" . $cw['detonate_gamma_bomb'] . "</a> (<b>{$user['gamma']}</b>)", "l_col"); } if ($user['delta'] > 0) {
$transfer_counter = 0; //loops through the ships. foreach ($do_ship as $ship_id) { if ($ship_id == 1) { //safety check. Don't want to transfer an SD. continue; } db("select config REGEXP 'bs' as is_warship, ship_name, login_id, config from {$db_name}_ships where ship_id = '{$ship_id}'"); $this_ship = dbr(1); if (empty($this_ship)) { $loop_txt .= "{$ship_id} {$st['740']}<br />"; } elseif ($this_ship['login_id'] != $user['login_id']) { //not users ship $loop_txt .= "{$this_ship['ship_name']} {$st['741']}<br />"; continue; } elseif (config_check("oo", $this_ship)) { //trying to transfer a flagship $loop_txt .= $st[742] . "<br />"; continue; } elseif ($target_ship_count['warships'] >= $GAME_VARS['max_warships'] && $this_ship['is_warship'] == 1) { $loop_txt .= "{$target['login_name']} {$st['743']}<br />"; continue; } elseif ($target_ship_count['other_ships'] >= $GAME_VARS['max_other_ships'] && $this_ship['is_warship'] == 0) { $loop_txt .= "{$target['login_name']} {$st['744']}<br />"; continue; } elseif ($ship_id == $user_ship['ship_id']) { $loop_txt .= $st[745]; } else { $loop_txt .= "<b class='b1'>{$this_ship['ship_name']}</b> {$st['746']}<br />"; dbn("update {$db_name}_ships set login_id = '{$target['login_id']}', fleet_id = '1', clan_id = {$target['clan_id']}, metal=0, fuel=0, elect=0, colon=0 where ship_id = '{$ship_id}'"); //ensure don't go over the limit
*/ list($badges, $files) = config_load(); /* |-------------------------------------------------------------------------- | Login |-------------------------------------------------------------------------- | */ $current_user = Sentinel::attempt($files); /* |-------------------------------------------------------------------------- | Check configuration |-------------------------------------------------------------------------- | */ $errors = config_check($files); if ($errors === false) { $title = __('Oups!'); $message = '<br/>'; $message .= __('Your access is disabled, you cannot view any log file.'); $message .= '<br/>'; $message .= __('Please contact your administrator.'); $message .= '<br/><br/>'; $link_url = '?signout&l=' . $locale; $link_msg = __('Sign out'); include_once 'inc/error.inc.php'; die; } if (is_array($errors)) { $title = __('Oups!'); $message = '<br/>';
//skip the EP and SD, as well as BM ships. continue; } else { $buy_many_link = "<a href='ship_build.php?mass={$type_id}'>" . $cw['buy_many'] . "</a>"; if ($ship_stats['type'] == "Cargo") { $type = "Cargo"; } elseif ($ship_stats['type'] == "Bataille" || $ship_stats['type'] == 'Flagship') { $type = "Bataille"; } elseif ($ship_stats['type'] == "Modulaire") { $type = "Modulaires"; } elseif (eregi("Transport", $ship_stats['type'])) { $type = "Transport"; } else { $type = "Autres"; //A special ship if (config_check("oo", $ship_stats)) { $buy_many_link = ""; //had a brob before, so this one costs more. if ($user['one_brob'] > 0) { $ship_stats['cost'] = $ship_stats['cost'] * $user['one_brob']; } } } $ship_stats['cost'] = nombre($ship_stats['cost'], 0, ',', ' '); $array_ships[$type] .= "\n" . make_row(array("<a href='ship_build.php?ship_type={$type_id}'>{$ship_stats['name']}</a>", "{$ship_stats['class_abbr']}", "<b>{$ship_stats['cost']}</b>", "<a href='ship_build.php?ship_type={$type_id}'>" . $cw['buy_one'] . "</a>", $buy_many_link, popup_help("help.php?popup=1&ship_info={$type_id}&db_name={$db_name}", 300, 600) . "<b></b></a>")); } } foreach ($array_ships as $type => $content) { if ($type == 'Bataille' || $type == 'Transport') { $out .= " Vaisseaux de <b class='b1'>{$type}</b>" . make_table(array($cw['ship_name'], $cw['abbrv'], $cw['cost'])); } else {
function make_standard_upgrade($upgrade_str, $config_addon, $cost, $developement_id, $tech_cost = 0) { global $user, $user_ship, $db_name, $cw, $st; if ($user['cash'] < $cost) { return sprintf($st[197], $upgrade_str); } elseif ($user['tech'] < $tech_cost && $tech_cost > 0) { return $st[198]; } elseif (!avail_check($developement_id)) { return sprintf($st[199], $upgrade_str); } elseif (config_check($config_addon, $user_ship)) { return sprintf($st[600], $upgrade_str); } elseif ($user_ship['upgrade_slots'] < 1) { return ""; } else { take_cash($cost); take_tech($tech_cost); $user_ship['config'] .= "," . $config_addon; dbn("update {$db_name}_ships set config = '{$user_ship['config']} ', upgrade_slots = upgrade_slots - 1 where ship_id = '{$user['ship_id']}'"); $user_ship['upgrade_slots']--; return "<b class='b1'>{$upgrade_str}</b>, " . sprintf($st[601], $user_ship[ship_name], $cost) . "<p />"; } }
} elseif (!avail_check(1000)) { $error_str .= $st[411]; } elseif (!isset($sure)) { get_var($cw['purchase_terra_emploder'], $filename, $st[412], 'sure', ''); } else { $error_str .= sprintf($st[413], $terra_i_c, $terra_i_t); take_cash($terra_i_c); take_tech($terra_i_t); $user['terra_imploder']++; dbn("update {$db_name}_users set terra_imploder = terra_imploder + 1 where login_id = '{$user['login_id']}'"); } } elseif ($buy == 9) { //Advanced Engine Upgrade if ($user_ship['move_turn_cost'] < 3) { $error_str .= $st[414]; } elseif (config_check("e1", $user_ship)) { $error_str .= $st[415]; } elseif (!isset($sure)) { get_var($cw['purchase_advanced_engine_upgrade'], $filename, $st[416] . "<b class='b1'>{$user_ship['ship_name']}</b>?", 'sure', ''); } else { $error_str .= make_standard_upgrade($cw['advanced_engine_upgrade'], "e2", $advanced_engine_c, 5003, $advanced_engine_t); $user_ship['move_turn_cost'] = $user_ship['move_turn_cost'] - 2; dbn("update {$db_name}_ships set move_turn_cost = move_turn_cost - 2 where ship_id = '{$user['ship_id']}'"); } } $error_str .= sprintf($st[417], $upgrade_pods[upgrade_slots]); $error_str .= $st[418]; $error_str .= $st[419]; $error_str .= make_table(array($cw['item_name'], $cw['notes'], $cw['credits_cost'], $cw['tech_cost']), "75%"); if (avail_check(5000)) { $buy_many = "";
$target_group['armour'] += $target_ships[$ship_id]['armour']; $target_group['speed'] += $target_ships[$ship_id]['move_turn_cost']; $target_group['size'] += $target_ships[$ship_id]['size']; $target_group['exp'] += $target_ships[$ship_id]['points_killed']; $target_group['config'] .= ":" . $target_ships[$ship_id]['config']; //if ship has figs/shields/armour, increase count of that type by 1 (for damage distro later) $target_ships[$ship_id]['fighters'] > 0 ? $target_group['fighters_ship_count']++ : 1; $target_ships[$ship_id]['shields'] > 0 ? $target_group['shields_ship_count']++ : 1; $target_ships[$ship_id]['armour'] > 0 ? $target_group['armour_ship_count']++ : 1; $t_bonus['num_ot'] += $target_ships[$ship_id]['num_ot']; $t_bonus['num_dt'] += $target_ships[$ship_id]['num_dt']; $t_bonus['num_pc'] += $target_ships[$ship_id]['num_pc']; $t_bonus['num_ew'] += $target_ships[$ship_id]['num_ew']; if (config_check("po", $target_ships[$ship_id])) { $po_ship_figs_foes += $target_ships[$ship_id]['fighters']; } elseif (config_check("so", $target_ships[$ship_id])) { $po_ship_figs_foes += $target_ships[$ship_id]['fighters']; } } } //end foreach for ships dumping ships into groups //remember how many fighters had in each group at start of combat. This copy is used for fig kills calculations. $user_fighters = $user_group['fighters']; $target_fighters = $target_group['fighters']; //make sure neither side has 0 ships. if ($target_group['ship_count'] == 0 && $target_group['planets'] == 0 || $user_group['ship_count'] == 0) { write_to_error_log(sprintf($st[281], $target_group[ship_count], $user_group[ship_count], $gen_tactic_to_use)); } //work out the averages of stuff $user_group['speed'] = average_finder($user_group['speed'], $user_group['ship_count']); if ($planet_attack == 0) {
$num = $max_dt - $user_ship['num_dt']; if ($user_ship['upgrade_slots'] > 1 && $num > 1) { $buy_many .= "<a href='{$filename}?buy=11&many_dt={$num}'>" . $cw['buy'] . " {$num}</a>"; } $turret_str .= make_row(array($cw['defensive_turrets'], sprintf($st[652], $max_dt), $defensive_turret, "<a href='{$filename}?buy=11'>" . $cw['buy'] . "</a>", $buy_many, popup_help("help.php?upgrades=1&popup=1&chosen=dt", 350, 315))); } if (!empty($turret_str)) { $error_str .= "<br /><br />" . $cw['turrets']; $error_str .= make_table(array($cw['item_name'], $cw['notes'], $cw['item_cost']), "75%"); $error_str .= $turret_str . "</table>"; } /************************** * Propulsion Upgrades **************************/ $eng_text = ""; if (config_check("sj", $user_ship) && avail_check(2006)) { $cost_temp = get_cost("ws"); $eng_text .= make_row(array($st[617], $st[653], $cost_temp['cost'], "<a href='{$filename}?buy=6'>" . $cw['buy'] . "</a>", popup_help("help.php?upgrades=1&popup=1&chosen=ws", 350, 315))); } if (avail_check(2007)) { $engine_changes = ""; if ($GAME_VARS['ship_warp_cost'] == -1) { $engine_changes = $st[654]; } $eng_text .= make_row(array($st[636], sprintf($st[655], $engine_changes), $engine_upgrade, "<a href='{$filename}?buy=12'>" . $cw['buy'] . "</a>", popup_help("help.php?upgrades=1&popup=1&chosen=e1", 350, 315))); } if (!empty($eng_text)) { $error_str .= "<br /><br />" . $st[656]; $error_str .= make_table(array($cw['item_name'], $cw['notes'], $cw['item_cost']), "75%"); $error_str .= $eng_text . "</table>"; }
} } elseif ($item[item_code] == "fig1500") { #1500 fig cap if ($user_ship[max_fighters] + 1500 > $max_non_warship_fighters && !config_check("bs", $user_ship)) { $text .= sprintf($st[337], $max_non_warship_fighters); } else { $text .= "Here's 1500 more Fighter Capacity."; $user_ship[max_fighters] = $user_ship[max_fighters] + 1500; dbn("update {$db_name}_ships set max_fighters = '{$user_ship['max_fighters']}', upgrade_slots = upgrade_slots -1 where ship_id = '{$user_ship['ship_id']}'"); $all_done = 1; } } elseif ($item[item_code] == "attack_pack") { #attack pack if (config_check("sj", $user_ship)) { $text .= $st[338]; } elseif ($user_ship[max_fighters] + 600 > $max_non_warship_fighters && !config_check("bs", $user_ship)) { $text .= sprintf($st[339], $max_non_warship_fighters); } else { $text .= $st[340]; $user_ship[max_fighters] = $user_ship[max_fighters] + 600; $user_ship[max_shields] = $user_ship[max_shields] + 200; dbn("update {$db_name}_ships set max_fighters = '{$user_ship['max_fighters']}',max_shields = '{$user_ship['max_shields']}', upgrade_slots = upgrade_slots -1 where ship_id = '{$user_ship['ship_id']}'"); $all_done = 1; } } } elseif ($item[item_type] == 2) { #equipment if ($item[item_code] == "warpack") { $text .= $st[341]; dbn("update {$db_name}_users set gamma = gamma+'4', alpha=alpha+2 where login_id = '{$item['bidder_id']}'"); $all_done = 1;