Version 0.10a
This commit is contained in:
parent
b9c240c781
commit
e391f66774
201 changed files with 5182 additions and 8158 deletions
278
Class/class.combat.php
Normal file
278
Class/class.combat.php
Normal file
|
|
@ -0,0 +1,278 @@
|
||||||
|
<?php
|
||||||
|
/***************************************************************************
|
||||||
|
* class.combat.php
|
||||||
|
* -------------------
|
||||||
|
* begin : Samedi 26 janvier 2008
|
||||||
|
* email : nemunaire@gmail.com
|
||||||
|
*
|
||||||
|
*
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
class Combat {
|
||||||
|
var $refflotte = 0;
|
||||||
|
var $ATvais = array();
|
||||||
|
var $ENvais = array();
|
||||||
|
var $ENdef = array();
|
||||||
|
var $Ntour = 0;
|
||||||
|
var $ATtactique = 0;
|
||||||
|
var $ENtactique = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructeur
|
||||||
|
* @param array $flotteAT tableau SQL des vaisseaux envoyés par l'attaquant
|
||||||
|
* @param array $flotteEN tableau SQL de la planète du défenseur
|
||||||
|
* @param array $defEN tableau SQL de la planète du défenseur
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function Combat($flotteAT, $flotteEN, $defEN) {
|
||||||
|
include('includes/vars.php');
|
||||||
|
//Génération des vaisseaux attaquants
|
||||||
|
for ($i=1 ; $i<=12 ; $i++) {
|
||||||
|
if ($flotteAT['vaisseau'.$i] >= 1) {
|
||||||
|
$this->ATvais[] = array($i, $flotteAT['vaisseau'.$i], array(array($nomvais_pv[$i-1], $flotteAT['vaisseau'.$i])), array(array($nomvais_bc[$i-1], $flotteAT['vaisseau'.$i])));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Génération des vaisseaux défenseurs
|
||||||
|
for ($i=1 ; $i<=12 ; $i++) {
|
||||||
|
if ($flotteEN['vaisseau_'.$i] >= 1) {
|
||||||
|
$this->ENvais[] = array($i, $flotteEN['vaisseau_'.$i], array(array($nomvais_pv[$i-1], $flotteEN['vaisseau_'.$i])), array(array($nomvais_bc[$i-1], $flotteEN['vaisseau_'.$i])));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Génération des défenses défenseurs
|
||||||
|
for ($i=1 ; $i<=5 ; $i++) {
|
||||||
|
if ($defEN['def_'.$i] >= 1) {
|
||||||
|
$this->ENdef[] = array($i, $defEN['def_'.$i], array(array($nomvais_pv[$i-1], $defEN['def_'.$i])), array(array($nomvais_bc[$i-1], $defEN['def_'.$i])));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change la tactique de l'attaquant
|
||||||
|
* @param int $tactique numéro de la tactique choisie
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function changerTactiqueAT($tactique) {
|
||||||
|
$this->ATtactique = ceil($tactique);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change la tactique du défenseur
|
||||||
|
* @param int $tactique numéro de la tactique choisie
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function changerTactiqueEN($tactique) {
|
||||||
|
$this->ENtactique = ceil($tactique);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Régénére les boucliers
|
||||||
|
* @param int $pourcentage pourcentage de régénération
|
||||||
|
* @param bool $attaquant régénére le bouclier de l'attaquant si true, sinon régénrére celui du défenseur
|
||||||
|
* @param bool $retour si true, renvoie true ou false si !le pourcentage a été consommé ou non, si false, retrourne ne nombre de pourcentage restant
|
||||||
|
*
|
||||||
|
* @return float pourcentage non utilisé
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function regenereBC($pourcentage, $attaquant, $retour = false) {
|
||||||
|
include('includes/vars.php');
|
||||||
|
if ($attaquant) {
|
||||||
|
$count = count($this->ATvais);
|
||||||
|
$enplus = 0;
|
||||||
|
$norm = 0;
|
||||||
|
for ($i=0 ; $i<$count ; $i++) {
|
||||||
|
$type = $this->ATvais[$i][0]-1;
|
||||||
|
$maxbc = $nomvais_bc[$type];
|
||||||
|
$ajout = $maxbc*$pourcentage/100;
|
||||||
|
$norm += $maxbc * $this->ATvais[$i][1];
|
||||||
|
|
||||||
|
$cntbc = count($this->ATvais[$i][3]);
|
||||||
|
for ($j=0 ; $j<$cntbc ; $j++) {
|
||||||
|
if ($this->ATvais[$i][3][$j][0] < $maxbc) {
|
||||||
|
$this->ATvais[$i][3][$j][0] += $ajout;
|
||||||
|
}
|
||||||
|
else $enplus += $ajout * $this->ATvais[$i][3][$j][1];
|
||||||
|
if ($this->ATvais[$i][3][$j][0] > $maxbc) {
|
||||||
|
$enplus += ($this->ATvais[$i][3][$j][0] - $maxbc)*$this->ATvais[$i][3][$j][1];
|
||||||
|
$this->ATvais[$i][3][$j][0] = $maxbc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($retour) {
|
||||||
|
if($enplus/$norm == 1) return true;
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
else return $enplus/$norm;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$count = count($this->ENvais);
|
||||||
|
$enplus = 0;
|
||||||
|
$norm = 0;
|
||||||
|
for ($i=0 ; $i<$count ; $i++) {
|
||||||
|
$type = $this->ENvais[$i][0]-1;
|
||||||
|
$maxbc = $nomvais_bc[$type];
|
||||||
|
$ajout = $maxbc*$pourcentage/100;
|
||||||
|
$norm += $maxbc * $this->ENvais[$i][1];
|
||||||
|
|
||||||
|
$cntbc = count($this->ENvais[$i][3]);
|
||||||
|
for ($j=0 ; $j<$cntbc ; $j++) {
|
||||||
|
if ($this->ENvais[$i][3][$j][0] < $maxbc) {
|
||||||
|
$this->ENvais[$i][3][$j][0] += $ajout;
|
||||||
|
}
|
||||||
|
else $enplus += $ajout * $this->ENvais[$i][3][$j][1];
|
||||||
|
if ($this->ENvais[$i][3][$j][0] > $maxbc) {
|
||||||
|
$enplus += ($this->ENvais[$i][3][$j][0] - $maxbc)*$this->ENvais[$i][3][$j][1];
|
||||||
|
$this->ENvais[$i][3][$j][0] = $maxbc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$return = $enplus/$norm;
|
||||||
|
|
||||||
|
//Défenses
|
||||||
|
$count = count($this->ENdef);
|
||||||
|
$enplus = 0;
|
||||||
|
$norm = 0;
|
||||||
|
for ($i=0 ; $i<$count ; $i++) {
|
||||||
|
$type = $this->ENdef[$i][0]-1;
|
||||||
|
$maxbc = $defense_bc[$type];
|
||||||
|
$ajout = $maxbc*$pourcentage/100;
|
||||||
|
$norm += $maxbc * $this->ENdef[$i][1];
|
||||||
|
|
||||||
|
$cntbc = count($this->ENdef[$i][3]);
|
||||||
|
for ($j=0 ; $j<$cntbc ; $j++) {
|
||||||
|
if ($this->ENdef[$i][3][$j][0] < $maxbc) {
|
||||||
|
$this->ENdef[$i][3][$j][0] += $ajout;
|
||||||
|
}
|
||||||
|
else $enplus += $ajout * $this->ENdef[$i][3][$j][1];
|
||||||
|
if ($this->ENdef[$i][3][$j][0] > $maxbc) {
|
||||||
|
$enplus += ($this->ENdef[$i][3][$j][0] - $maxbc)*$this->ENdef[$i][3][$j][1];
|
||||||
|
$this->ENdef[$i][3][$j][0] = $maxbc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$return += $enplus/$norm;
|
||||||
|
return $return/2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calcul la puissance d'attaque disponible
|
||||||
|
* @param int $pourcentage pourcentage de régénération
|
||||||
|
* @param bool $attaquant calcul les points de l'attaquant si true, sinon calcul pour le défenseur
|
||||||
|
*
|
||||||
|
* @return int points disponibles
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function calcAttaque($pourcentage, $attaquant) {
|
||||||
|
include('includes/vars.php');
|
||||||
|
if ($attaquant) {
|
||||||
|
$puissance = 0;
|
||||||
|
$count = count($this->ATvais);
|
||||||
|
for ($i=0 ; $i<$count ; $i++) {
|
||||||
|
$maxat = $nomvais_at[$this->ATvais[$i][0]-1];
|
||||||
|
$puissance += $maxat * $pourcentage/100 * $this->ATvais[$i][1];
|
||||||
|
}
|
||||||
|
return $puissance;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$puissance = 0;
|
||||||
|
$count = count($this->ENvais);
|
||||||
|
for ($i=0 ; $i<$count ; $i++) {
|
||||||
|
$maxat = $nomvais_at[$this->ENvais[$i][0]-1];
|
||||||
|
$puissance += $maxat * $pourcentage/100 * $this->ENvais[$i][1];
|
||||||
|
}
|
||||||
|
|
||||||
|
//Défenses
|
||||||
|
$count = count($this->ENdef);
|
||||||
|
for ($i=0 ; $i<$count ; $i++) {
|
||||||
|
$maxat = $defense_at[$this->ENdef[$i][0]-1];
|
||||||
|
$puissance += $maxat * $pourcentage/100 * $this->ENdef[$i][1];
|
||||||
|
}
|
||||||
|
return $puissance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attaque les vaisseaux adverses
|
||||||
|
* @param int $points points d'attaque disponible pour l'attaque
|
||||||
|
* @param bool $attaquant attaque le défenseur si true, sinon attaque l'attaquant
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function attaquerVais($points, $attaquant) {
|
||||||
|
if ($attaquant) {
|
||||||
|
while($points > 0) {
|
||||||
|
// Calcul du nombre de vaisseaux et défenses à attaquer
|
||||||
|
$nbvais = 0;
|
||||||
|
$nb = count($this->ENvais);
|
||||||
|
for ($i=0 ; $i<$nb ; $i++) {
|
||||||
|
$nbvais += $this->ENvais[$i][1];
|
||||||
|
}
|
||||||
|
$nb = count($this->ENdef);
|
||||||
|
for ($i=0 ; $i<$nb ; $i++) {
|
||||||
|
$nbvais += $this->ENdef[$i][1];
|
||||||
|
}
|
||||||
|
|
||||||
|
//S'il ne reste plus de vaisseaux et de défenses, on arrête la boucle
|
||||||
|
if ($nbvais < 0 || $points < 0) break;
|
||||||
|
|
||||||
|
//Calcul du nombre de points qui sera enlevé par vaisseau ou défense
|
||||||
|
$ppv = $points / $nbvais;
|
||||||
|
|
||||||
|
//On lance l'attaque
|
||||||
|
$nb = count($this->ENvais);
|
||||||
|
for ($i=0 ; $i<$nb ; $i++) {
|
||||||
|
$persage = 0; //Initialisation du nombre de point restant pour attaquer les PV
|
||||||
|
$nbpersage = 0; //Initialisation du nombre de vaisseaux affectuer par le persage
|
||||||
|
$nbj = count($this->ENvais[$i][3]); //Nombre de vaisseaux dans le groupe
|
||||||
|
|
||||||
|
//Attaque des boucliers
|
||||||
|
for ($j=0 ; $j<$nbj ; $j++) {
|
||||||
|
$this->ENvais[$i][3][$j][0] -= $ppv;
|
||||||
|
if ($this->ENvais[$i][3][$j][0] <= 0) {
|
||||||
|
$persage += abs($this->ENvais[$i][3][$j][0]);
|
||||||
|
$nbpersage += $this->ENvais[$i][3][$j][1];
|
||||||
|
$this->ENvais[$i][3][$j][0] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Attaque des PV
|
||||||
|
while($persage > 0) {
|
||||||
|
$j = count($this->ENvais[$i][2])-1; //Nombre de vaisseaux dans le groupe
|
||||||
|
if ($this->ENvais[$i][2][$j][0] * $this->ENvais[$i][2][$j][1] < $persage * $nbpersage) { //Si il y a suffisament de point de persage pour détruire tous les vaisseaux de cette ligne
|
||||||
|
//On efface les vaisseaux du nombre total
|
||||||
|
$nbvais -= $this->ENvais[$i][2][$j][1];
|
||||||
|
$this->ENvais[$i][1] -= $this->ENvais[$i][2][$j][1];
|
||||||
|
|
||||||
|
//On efface le groupe
|
||||||
|
unset($this->ENvais[$i][2][$j]);
|
||||||
|
|
||||||
|
//S'il ne reste aucun vaisseaux du type, on le supprime
|
||||||
|
if ($j == 0 || $this->ENvais[$i][1] == 0) {
|
||||||
|
unset($this->ENvais[$i]);
|
||||||
|
$persage = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { //Attaque vaisseau par vaisseau dans le groupe
|
||||||
|
$nbmod = floor(($this->ENvais[$i][2][$j][0] * $this->ENvais[$i][2][$j][1])/($persage * $nbpersage));
|
||||||
|
$this->ENvais[$i][1] -= $nbmod;
|
||||||
|
$nbvais -= $nbmod;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
1530
Class/class.phpmailer.php
Normal file
1530
Class/class.phpmailer.php
Normal file
File diff suppressed because it is too large
Load diff
1039
Class/class.smtp.php
Normal file
1039
Class/class.smtp.php
Normal file
File diff suppressed because it is too large
Load diff
23
Class/phpmailer.lang-en.php
Normal file
23
Class/phpmailer.lang-en.php
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPMailer language file.
|
||||||
|
* English Version
|
||||||
|
*/
|
||||||
|
|
||||||
|
$PHPMAILER_LANG = array();
|
||||||
|
|
||||||
|
$PHPMAILER_LANG["provide_address"] = 'You must provide at least one ' .
|
||||||
|
'recipient email address.';
|
||||||
|
$PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.';
|
||||||
|
$PHPMAILER_LANG["execute"] = 'Could not execute: ';
|
||||||
|
$PHPMAILER_LANG["instantiate"] = 'Could not instantiate mail function.';
|
||||||
|
$PHPMAILER_LANG["authenticate"] = 'SMTP Error: Could not authenticate.';
|
||||||
|
$PHPMAILER_LANG["from_failed"] = 'The following From address failed: ';
|
||||||
|
$PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: The following ' .
|
||||||
|
'recipients failed: ';
|
||||||
|
$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data not accepted.';
|
||||||
|
$PHPMAILER_LANG["connect_host"] = 'SMTP Error: Could not connect to SMTP host.';
|
||||||
|
$PHPMAILER_LANG["file_access"] = 'Could not access file: ';
|
||||||
|
$PHPMAILER_LANG["file_open"] = 'File Error: Could not open file: ';
|
||||||
|
$PHPMAILER_LANG["encoding"] = 'Unknown encoding: ';
|
||||||
|
?>
|
||||||
355
Class/test/message.txt
Normal file
355
Class/test/message.txt
Normal file
|
|
@ -0,0 +1,355 @@
|
||||||
|
Received: from phpmailer ([127.0.0.1])
|
||||||
|
by 127.0.0.1 with HTTP (PHPMailer);
|
||||||
|
Tue, 22 Jan 2008 23:56:42 +0100
|
||||||
|
Date: Tue, 22 Jan 2008 23:56:42 +0100
|
||||||
|
Return-Path: nobody@example.com
|
||||||
|
To: Test User <admin@localhost>
|
||||||
|
Cc: Carbon User <newuser@localhost>
|
||||||
|
From: Unit Tester <unit_test@phpmailer.sf.net>
|
||||||
|
Reply-to: Reply Guy <no_reply@phpmailer.sf.net>
|
||||||
|
Subject: Unit Test: AltBody + Attachment
|
||||||
|
Message-ID: <a0169dc7929d1c609a827b4d1a0c3f74@127.0.0.1>
|
||||||
|
X-Priority: 3
|
||||||
|
X-Mailer: PHPMailer [version 1.71]
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: multipart/mixed;
|
||||||
|
boundary="b1_a0169dc7929d1c609a827b4d1a0c3f74"
|
||||||
|
|
||||||
|
|
||||||
|
--b1_a0169dc7929d1c609a827b4d1a0c3f74
|
||||||
|
Content-Type: multipart/alternative;
|
||||||
|
boundary="b2_a0169dc7929d1c609a827b4d1a0c3f74"
|
||||||
|
|
||||||
|
--b2_a0169dc7929d1c609a827b4d1a0c3f74
|
||||||
|
Content-Type: text/plain; charset = "iso-8859-1"
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
|
||||||
|
This is the text part of the email.
|
||||||
|
|
||||||
|
|
||||||
|
--b2_a0169dc7929d1c609a827b4d1a0c3f74
|
||||||
|
Content-Type: text/html; charset = "iso-8859-1"
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
|
||||||
|
This is the <b>HTML</b> part of the email.<br/><br/>---------------------<br/>Unit Test Information<br/>---------------------<br/>phpmailer version: 1.71<br/>Content Type: text/html<br/>Host: localhost<br/>Attachments:<br/><ul><li>Name: phpmailer_test.php, Encoding: base64, Type: application/octet-stream<br/></ul><br/>Changes<br/>-------<br/><ul><li>Sender was changed to [nobody@example.com]<br/><li>Mailer was changed to [smtp]<br/></ul><br/><br/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--b2_a0169dc7929d1c609a827b4d1a0c3f74--
|
||||||
|
--b1_a0169dc7929d1c609a827b4d1a0c3f74
|
||||||
|
Content-Type: application/octet-stream; name="test_attach.txt"
|
||||||
|
Content-Transfer-Encoding: base64
|
||||||
|
Content-Disposition: attachment; filename="test_attach.txt"
|
||||||
|
|
||||||
|
PD9waHANCi8qKioqKioqKioqKioqKioqKioqDQogIFVuaXQgVGVzdA0KICBUeXBlOiBwaHBtYWls
|
||||||
|
ZXIgY2xhc3MNCioqKioqKioqKioqKioqKioqKioqLw0KDQokSU5DTFVERV9ESVIgPSAiLi4vIjsN
|
||||||
|
Cg0KcmVxdWlyZSgicGhwdW5pdC5waHAiKTsNCnJlcXVpcmUoJElOQ0xVREVfRElSIC4gImNsYXNz
|
||||||
|
LnBocG1haWxlci5waHAiKTsNCmVycm9yX3JlcG9ydGluZyhFX0FMTCk7DQoNCi8qKg0KICogUGVy
|
||||||
|
Zm9ybXMgYXV0aGVudGljYXRpb24gdGVzdHMNCiAqLw0KY2xhc3MgcGhwbWFpbGVyVGVzdCBleHRl
|
||||||
|
bmRzIFRlc3RDYXNlDQp7DQogICAgLyoqDQogICAgICogSG9sZHMgdGhlIGRlZmF1bHQgcGhwbWFp
|
||||||
|
bGVyIGluc3RhbmNlLg0KICAgICAqIEBwcml2YXRlDQogICAgICogQHR5cGUgb2JqZWN0DQogICAg
|
||||||
|
ICovDQogICAgdmFyICRNYWlsID0gZmFsc2U7DQoNCiAgICAvKioNCiAgICAgKiBIb2xkcyB0aGUg
|
||||||
|
U01UUCBtYWlsIGhvc3QuDQogICAgICogQHB1YmxpYw0KICAgICAqIEB0eXBlIHN0cmluZw0KICAg
|
||||||
|
ICAqLw0KICAgIHZhciAkSG9zdCA9ICIiOw0KDQogICAgLyoqDQogICAgICogSG9sZHMgdGhlIGNo
|
||||||
|
YW5nZSBsb2cuDQogICAgICogQHByaXZhdGUNCiAgICAgKiBAdHlwZSBzdHJpbmcgYXJyYXkNCiAg
|
||||||
|
ICAgKi8NCiAgICB2YXIgJENoYW5nZUxvZyA9IGFycmF5KCk7DQoNCiAgICAgLyoqDQogICAgICog
|
||||||
|
SG9sZHMgdGhlIG5vdGUgbG9nLg0KICAgICAqIEBwcml2YXRlDQogICAgICogQHR5cGUgc3RyaW5n
|
||||||
|
IGFycmF5DQogICAgICovDQogICAgdmFyICROb3RlTG9nID0gYXJyYXkoKTsNCg0KICAgIC8qKg0K
|
||||||
|
ICAgICAqIENsYXNzIGNvbnN0dWN0b3IuDQogICAgICovDQogICAgZnVuY3Rpb24gcGhwbWFpbGVy
|
||||||
|
VGVzdCgkbmFtZSkgew0KICAgICAgICAvKiBtdXN0IGRlZmluZSB0aGlzIGNvbnN0cnVjdG9yICov
|
||||||
|
DQogICAgICAgICR0aGlzLT5UZXN0Q2FzZSggJG5hbWUgKTsNCiAgICB9DQoNCiAgICAvKioNCiAg
|
||||||
|
ICAgKiBSdW4gYmVmb3JlIGVhY2ggdGVzdCBpcyBzdGFydGVkLg0KICAgICAqLw0KICAgIGZ1bmN0
|
||||||
|
aW9uIHNldFVwKCkgew0KICAgICAgICBnbG9iYWwgJGdsb2JhbF92YXJzOw0KICAgICAgICBnbG9i
|
||||||
|
YWwgJElOQ0xVREVfRElSOw0KDQogICAgICAgICR0aGlzLT5NYWlsID0gbmV3IFBIUE1haWxlcigp
|
||||||
|
Ow0KDQogICAgICAgICR0aGlzLT5NYWlsLT5Qcmlvcml0eSA9IDM7DQogICAgICAgICR0aGlzLT5N
|
||||||
|
YWlsLT5FbmNvZGluZyA9ICI4Yml0IjsNCiAgICAgICAgJHRoaXMtPk1haWwtPkNoYXJTZXQgPSAi
|
||||||
|
aXNvLTg4NTktMSI7DQogICAgICAgICR0aGlzLT5NYWlsLT5Gcm9tID0gInVuaXRfdGVzdEBwaHBt
|
||||||
|
YWlsZXIuc2YubmV0IjsNCiAgICAgICAgJHRoaXMtPk1haWwtPkZyb21OYW1lID0gIlVuaXQgVGVz
|
||||||
|
dGVyIjsNCiAgICAgICAgJHRoaXMtPk1haWwtPlNlbmRlciA9ICIiOw0KICAgICAgICAkdGhpcy0+
|
||||||
|
TWFpbC0+U3ViamVjdCA9ICJVbml0IFRlc3QiOw0KICAgICAgICAkdGhpcy0+TWFpbC0+Qm9keSA9
|
||||||
|
ICIiOw0KICAgICAgICAkdGhpcy0+TWFpbC0+QWx0Qm9keSA9ICIiOw0KICAgICAgICAkdGhpcy0+
|
||||||
|
TWFpbC0+V29yZFdyYXAgPSAwOw0KICAgICAgICAkdGhpcy0+TWFpbC0+SG9zdCA9ICRnbG9iYWxf
|
||||||
|
dmFyc1sibWFpbF9ob3N0Il07DQogICAgICAgICR0aGlzLT5NYWlsLT5Qb3J0ID0gMjU7DQogICAg
|
||||||
|
ICAgICR0aGlzLT5NYWlsLT5IZWxvID0gImxvY2FsaG9zdC5sb2NhbGRvbWFpbiI7DQogICAgICAg
|
||||||
|
ICR0aGlzLT5NYWlsLT5TTVRQQXV0aCA9IGZhbHNlOw0KICAgICAgICAkdGhpcy0+TWFpbC0+VXNl
|
||||||
|
cm5hbWUgPSAiIjsNCiAgICAgICAgJHRoaXMtPk1haWwtPlBhc3N3b3JkID0gIiI7DQogICAgICAg
|
||||||
|
ICR0aGlzLT5NYWlsLT5QbHVnaW5EaXIgPSAkSU5DTFVERV9ESVI7DQoJCSR0aGlzLT5NYWlsLT5B
|
||||||
|
ZGRSZXBseVRvKCJub19yZXBseUBwaHBtYWlsZXIuc2YubmV0IiwgIlJlcGx5IEd1eSIpOw0KICAg
|
||||||
|
ICAgICAkdGhpcy0+TWFpbC0+U2VuZGVyID0gIm5vYm9keUBleGFtcGxlLmNvbSI7DQoNCiAgICAg
|
||||||
|
ICAgaWYoc3RybGVuKCR0aGlzLT5NYWlsLT5Ib3N0KSA+IDApDQogICAgICAgICAgICAkdGhpcy0+
|
||||||
|
TWFpbC0+TWFpbGVyID0gInNtdHAiOw0KICAgICAgICBlbHNlDQogICAgICAgIHsNCiAgICAgICAg
|
||||||
|
ICAgICR0aGlzLT5NYWlsLT5NYWlsZXIgPSAibWFpbCI7DQogICAgICAgICAgICAkdGhpcy0+U2Vu
|
||||||
|
ZGVyID0gInVuaXRfdGVzdEBwaHBtYWlsZXIuc2YubmV0IjsNCiAgICAgICAgfQ0KDQogICAgICAg
|
||||||
|
IGdsb2JhbCAkZ2xvYmFsX3ZhcnM7DQogICAgICAgICR0aGlzLT5TZXRBZGRyZXNzKCRnbG9iYWxf
|
||||||
|
dmFyc1sibWFpbF90byJdLCAiVGVzdCBVc2VyIik7DQogICAgICAgIGlmKHN0cmxlbigkZ2xvYmFs
|
||||||
|
X3ZhcnNbIm1haWxfY2MiXSkgPiAwKQ0KICAgICAgICAgICAgJHRoaXMtPlNldEFkZHJlc3MoJGds
|
||||||
|
b2JhbF92YXJzWyJtYWlsX2NjIl0sICJDYXJib24gVXNlciIsICJjYyIpOw0KICAgIH0NCg0KICAg
|
||||||
|
IC8qKg0KICAgICAqIFJ1biBhZnRlciBlYWNoIHRlc3QgaXMgY29tcGxldGVkLg0KICAgICAqLw0K
|
||||||
|
ICAgIGZ1bmN0aW9uIHRlYXJEb3duKCkgew0KICAgICAgICAvLyBDbGVhbiBnbG9iYWwgdmFyaWFi
|
||||||
|
bGVzDQogICAgICAgICR0aGlzLT5NYWlsID0gTlVMTDsNCiAgICAgICAgJHRoaXMtPkNoYW5nZUxv
|
||||||
|
ZyA9IGFycmF5KCk7DQogICAgICAgICR0aGlzLT5Ob3RlTG9nID0gYXJyYXkoKTsNCiAgICB9DQoN
|
||||||
|
Cg0KICAgIC8qKg0KICAgICAqIEJ1aWxkIHRoZSBib2R5IG9mIHRoZSBtZXNzYWdlIGluIHRoZSBh
|
||||||
|
cHByb3ByaWF0ZSBmb3JtYXQuDQogICAgICogQHByaXZhdGUNCiAgICAgKiBAcmV0dXJucyB2b2lk
|
||||||
|
DQogICAgICovDQogICAgZnVuY3Rpb24gQnVpbGRCb2R5KCkgew0KICAgICAgICAkdGhpcy0+Q2hl
|
||||||
|
Y2tDaGFuZ2VzKCk7DQoNCiAgICAgICAgLy8gRGV0ZXJtaW5lIGxpbmUgZW5kaW5ncyBmb3IgbWVz
|
||||||
|
c2FnZQ0KICAgICAgICBpZigkdGhpcy0+TWFpbC0+Q29udGVudFR5cGUgPT0gInRleHQvaHRtbCIg
|
||||||
|
fHwgc3RybGVuKCR0aGlzLT5NYWlsLT5BbHRCb2R5KSA+IDApDQogICAgICAgIHsNCiAgICAgICAg
|
||||||
|
ICAgICRlb2wgPSAiPGJyLz4iOw0KICAgICAgICAgICAgJGJ1bGxldCA9ICI8bGk+IjsNCiAgICAg
|
||||||
|
ICAgICAgICRidWxsZXRfc3RhcnQgPSAiPHVsPiI7DQogICAgICAgICAgICAkYnVsbGV0X2VuZCA9
|
||||||
|
ICI8L3VsPiI7DQogICAgICAgIH0NCiAgICAgICAgZWxzZQ0KICAgICAgICB7DQogICAgICAgICAg
|
||||||
|
ICAkZW9sID0gIlxuIjsNCiAgICAgICAgICAgICRidWxsZXQgPSAiIC0gIjsNCiAgICAgICAgICAg
|
||||||
|
ICRidWxsZXRfc3RhcnQgPSAiIjsNCiAgICAgICAgICAgICRidWxsZXRfZW5kID0gIiI7DQogICAg
|
||||||
|
ICAgIH0NCg0KICAgICAgICAkUmVwb3J0Qm9keSA9ICIiOw0KDQogICAgICAgICRSZXBvcnRCb2R5
|
||||||
|
IC49ICItLS0tLS0tLS0tLS0tLS0tLS0tLS0iIC4gJGVvbDsNCiAgICAgICAgJFJlcG9ydEJvZHkg
|
||||||
|
Lj0gIlVuaXQgVGVzdCBJbmZvcm1hdGlvbiIgLiAkZW9sOw0KICAgICAgICAkUmVwb3J0Qm9keSAu
|
||||||
|
PSAiLS0tLS0tLS0tLS0tLS0tLS0tLS0tIiAuICRlb2w7DQogICAgICAgICRSZXBvcnRCb2R5IC49
|
||||||
|
ICJwaHBtYWlsZXIgdmVyc2lvbjogIiAuICR0aGlzLT5NYWlsLT5WZXJzaW9uIC4gJGVvbDsNCiAg
|
||||||
|
ICAgICAgJFJlcG9ydEJvZHkgLj0gIkNvbnRlbnQgVHlwZTogIiAuICR0aGlzLT5NYWlsLT5Db250
|
||||||
|
ZW50VHlwZSAuICRlb2w7DQoNCiAgICAgICAgaWYoc3RybGVuKCR0aGlzLT5NYWlsLT5Ib3N0KSA+
|
||||||
|
IDApDQogICAgICAgICAgICAkUmVwb3J0Qm9keSAuPSAiSG9zdDogIiAuICR0aGlzLT5NYWlsLT5I
|
||||||
|
b3N0IC4gJGVvbDsNCg0KICAgICAgICAvLyBJZiBhdHRhY2htZW50cyB0aGVuIGNyZWF0ZSBhbiBh
|
||||||
|
dHRhY2htZW50IGxpc3QNCiAgICAgICAgaWYoY291bnQoJHRoaXMtPk1haWwtPmF0dGFjaG1lbnQp
|
||||||
|
ID4gMCkNCiAgICAgICAgew0KICAgICAgICAgICAgJFJlcG9ydEJvZHkgLj0gIkF0dGFjaG1lbnRz
|
||||||
|
OiIgLiAkZW9sOw0KICAgICAgICAgICAgJFJlcG9ydEJvZHkgLj0gJGJ1bGxldF9zdGFydDsNCiAg
|
||||||
|
ICAgICAgICAgIGZvcigkaSA9IDA7ICRpIDwgY291bnQoJHRoaXMtPk1haWwtPmF0dGFjaG1lbnQp
|
||||||
|
OyAkaSsrKQ0KICAgICAgICAgICAgew0KICAgICAgICAgICAgICAgICRSZXBvcnRCb2R5IC49ICRi
|
||||||
|
dWxsZXQgLiAiTmFtZTogIiAuICR0aGlzLT5NYWlsLT5hdHRhY2htZW50WyRpXVsxXSAuICIsICI7
|
||||||
|
DQogICAgICAgICAgICAgICAgJFJlcG9ydEJvZHkgLj0gIkVuY29kaW5nOiAiIC4gJHRoaXMtPk1h
|
||||||
|
aWwtPmF0dGFjaG1lbnRbJGldWzNdIC4gIiwgIjsNCiAgICAgICAgICAgICAgICAkUmVwb3J0Qm9k
|
||||||
|
eSAuPSAiVHlwZTogIiAuICR0aGlzLT5NYWlsLT5hdHRhY2htZW50WyRpXVs0XSAuICRlb2w7DQog
|
||||||
|
ICAgICAgICAgICB9DQogICAgICAgICAgICAkUmVwb3J0Qm9keSAuPSAkYnVsbGV0X2VuZCAuICRl
|
||||||
|
b2w7DQogICAgICAgIH0NCg0KICAgICAgICAvLyBJZiB0aGVyZSBhcmUgY2hhbmdlcyB0aGVuIGxp
|
||||||
|
c3QgdGhlbQ0KICAgICAgICBpZihjb3VudCgkdGhpcy0+Q2hhbmdlTG9nKSA+IDApDQogICAgICAg
|
||||||
|
IHsNCiAgICAgICAgICAgICRSZXBvcnRCb2R5IC49ICJDaGFuZ2VzIiAuICRlb2w7DQogICAgICAg
|
||||||
|
ICAgICAkUmVwb3J0Qm9keSAuPSAiLS0tLS0tLSIgLiAkZW9sOw0KDQogICAgICAgICAgICAkUmVw
|
||||||
|
b3J0Qm9keSAuPSAkYnVsbGV0X3N0YXJ0Ow0KICAgICAgICAgICAgZm9yKCRpID0gMDsgJGkgPCBj
|
||||||
|
b3VudCgkdGhpcy0+Q2hhbmdlTG9nKTsgJGkrKykNCiAgICAgICAgICAgIHsNCiAgICAgICAgICAg
|
||||||
|
ICAgICAkUmVwb3J0Qm9keSAuPSAkYnVsbGV0IC4gJHRoaXMtPkNoYW5nZUxvZ1skaV1bMF0gLiAi
|
||||||
|
IHdhcyBjaGFuZ2VkIHRvIFsiIC4NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkdGhp
|
||||||
|
cy0+Q2hhbmdlTG9nWyRpXVsxXSAuICJdIiAuICRlb2w7DQogICAgICAgICAgICB9DQogICAgICAg
|
||||||
|
ICAgICAkUmVwb3J0Qm9keSAuPSAkYnVsbGV0X2VuZCAuICRlb2wgLiAkZW9sOw0KICAgICAgICB9
|
||||||
|
DQoNCiAgICAgICAgLy8gSWYgdGhlcmUgYXJlIG5vdGVzIHRoZW4gbGlzdCB0aGVtDQogICAgICAg
|
||||||
|
IGlmKGNvdW50KCR0aGlzLT5Ob3RlTG9nKSA+IDApDQogICAgICAgIHsNCiAgICAgICAgICAgICRS
|
||||||
|
ZXBvcnRCb2R5IC49ICJOb3RlcyIgLiAkZW9sOw0KICAgICAgICAgICAgJFJlcG9ydEJvZHkgLj0g
|
||||||
|
Ii0tLS0tIiAuICRlb2w7DQoNCiAgICAgICAgICAgICRSZXBvcnRCb2R5IC49ICRidWxsZXRfc3Rh
|
||||||
|
cnQ7DQogICAgICAgICAgICBmb3IoJGkgPSAwOyAkaSA8IGNvdW50KCR0aGlzLT5Ob3RlTG9nKTsg
|
||||||
|
JGkrKykNCiAgICAgICAgICAgIHsNCiAgICAgICAgICAgICAgICAkUmVwb3J0Qm9keSAuPSAkYnVs
|
||||||
|
bGV0IC4gJHRoaXMtPk5vdGVMb2dbJGldIC4gJGVvbDsNCiAgICAgICAgICAgIH0NCiAgICAgICAg
|
||||||
|
ICAgICRSZXBvcnRCb2R5IC49ICRidWxsZXRfZW5kOw0KICAgICAgICB9DQoNCiAgICAgICAgLy8g
|
||||||
|
UmUtYXR0YWNoIHRoZSBvcmlnaW5hbCBib2R5DQogICAgICAgICR0aGlzLT5NYWlsLT5Cb2R5IC49
|
||||||
|
ICRlb2wgLiAkZW9sIC4gJFJlcG9ydEJvZHk7DQogICAgfQ0KDQogICAgLyoqDQogICAgICogQ2hl
|
||||||
|
Y2sgd2hpY2ggZGVmYXVsdCBzZXR0aW5ncyBoYXZlIGJlZW4gY2hhbmdlZCBmb3IgdGhlIHJlcG9y
|
||||||
|
dC4NCiAgICAgKiBAcHJpdmF0ZQ0KICAgICAqIEByZXR1cm5zIHZvaWQNCiAgICAgKi8NCiAgICBm
|
||||||
|
dW5jdGlvbiBDaGVja0NoYW5nZXMoKSB7DQogICAgICAgIGlmKCR0aGlzLT5NYWlsLT5Qcmlvcml0
|
||||||
|
eSAhPSAzKQ0KICAgICAgICAgICAgJHRoaXMtPkFkZENoYW5nZSgiUHJpb3JpdHkiLCAkdGhpcy0+
|
||||||
|
TWFpbC0+UHJpb3JpdHkpOw0KICAgICAgICBpZigkdGhpcy0+TWFpbC0+RW5jb2RpbmcgIT0gIjhi
|
||||||
|
aXQiKQ0KICAgICAgICAgICAgJHRoaXMtPkFkZENoYW5nZSgiRW5jb2RpbmciLCAkdGhpcy0+TWFp
|
||||||
|
bC0+RW5jb2RpbmcpOw0KICAgICAgICBpZigkdGhpcy0+TWFpbC0+Q2hhclNldCAhPSAiaXNvLTg4
|
||||||
|
NTktMSIpDQogICAgICAgICAgICAkdGhpcy0+QWRkQ2hhbmdlKCJDaGFyU2V0IiwgJHRoaXMtPk1h
|
||||||
|
aWwtPkNoYXJTZXQpOw0KICAgICAgICBpZigkdGhpcy0+TWFpbC0+U2VuZGVyICE9ICIiKQ0KICAg
|
||||||
|
ICAgICAgICAgJHRoaXMtPkFkZENoYW5nZSgiU2VuZGVyIiwgJHRoaXMtPk1haWwtPlNlbmRlcik7
|
||||||
|
DQogICAgICAgIGlmKCR0aGlzLT5NYWlsLT5Xb3JkV3JhcCAhPSAwKQ0KICAgICAgICAgICAgJHRo
|
||||||
|
aXMtPkFkZENoYW5nZSgiV29yZFdyYXAiLCAkdGhpcy0+TWFpbC0+V29yZFdyYXApOw0KICAgICAg
|
||||||
|
ICBpZigkdGhpcy0+TWFpbC0+TWFpbGVyICE9ICJtYWlsIikNCiAgICAgICAgICAgICR0aGlzLT5B
|
||||||
|
ZGRDaGFuZ2UoIk1haWxlciIsICR0aGlzLT5NYWlsLT5NYWlsZXIpOw0KICAgICAgICBpZigkdGhp
|
||||||
|
cy0+TWFpbC0+UG9ydCAhPSAyNSkNCiAgICAgICAgICAgICR0aGlzLT5BZGRDaGFuZ2UoIlBvcnQi
|
||||||
|
LCAkdGhpcy0+TWFpbC0+UG9ydCk7DQogICAgICAgIGlmKCR0aGlzLT5NYWlsLT5IZWxvICE9ICJs
|
||||||
|
b2NhbGhvc3QubG9jYWxkb21haW4iKQ0KICAgICAgICAgICAgJHRoaXMtPkFkZENoYW5nZSgiSGVs
|
||||||
|
byIsICR0aGlzLT5NYWlsLT5IZWxvKTsNCiAgICAgICAgaWYoJHRoaXMtPk1haWwtPlNNVFBBdXRo
|
||||||
|
KQ0KICAgICAgICAgICAgJHRoaXMtPkFkZENoYW5nZSgiU01UUEF1dGgiLCAidHJ1ZSIpOw0KICAg
|
||||||
|
IH0NCg0KICAgIC8qKg0KICAgICAqIEFkZHMgYSBjaGFuZ2UgZW50cnkuDQogICAgICogQHByaXZh
|
||||||
|
dGUNCiAgICAgKiBAcmV0dXJucyB2b2lkDQogICAgICovDQogICAgZnVuY3Rpb24gQWRkQ2hhbmdl
|
||||||
|
KCRzTmFtZSwgJHNOZXdWYWx1ZSkgew0KICAgICAgICAkY3VyID0gY291bnQoJHRoaXMtPkNoYW5n
|
||||||
|
ZUxvZyk7DQogICAgICAgICR0aGlzLT5DaGFuZ2VMb2dbJGN1cl1bMF0gPSAkc05hbWU7DQogICAg
|
||||||
|
ICAgICR0aGlzLT5DaGFuZ2VMb2dbJGN1cl1bMV0gPSAkc05ld1ZhbHVlOw0KICAgIH0NCg0KICAg
|
||||||
|
IC8qKg0KICAgICAqIEFkZHMgYSBzaW1wbGUgbm90ZSB0byB0aGUgbWVzc2FnZS4NCiAgICAgKiBA
|
||||||
|
cHVibGljDQogICAgICogQHJldHVybnMgdm9pZA0KICAgICAqLw0KICAgIGZ1bmN0aW9uIEFkZE5v
|
||||||
|
dGUoJHNWYWx1ZSkgew0KICAgICAgICAkdGhpcy0+Tm90ZUxvZ1tdID0gJHNWYWx1ZTsNCiAgICB9
|
||||||
|
DQoNCiAgICAvKioNCiAgICAgKiBBZGRzIGFsbCBvZiB0aGUgYWRkcmVzc2VzDQogICAgICogQHB1
|
||||||
|
YmxpYw0KICAgICAqIEByZXR1cm5zIHZvaWQNCiAgICAgKi8NCiAgICBmdW5jdGlvbiBTZXRBZGRy
|
||||||
|
ZXNzKCRzQWRkcmVzcywgJHNOYW1lID0gIiIsICRzVHlwZSA9ICJ0byIpIHsNCiAgICAgICAgc3dp
|
||||||
|
dGNoKCRzVHlwZSkNCiAgICAgICAgew0KICAgICAgICAgICAgY2FzZSAidG8iOg0KICAgICAgICAg
|
||||||
|
ICAgICAgICR0aGlzLT5NYWlsLT5BZGRBZGRyZXNzKCRzQWRkcmVzcywgJHNOYW1lKTsNCiAgICAg
|
||||||
|
ICAgICAgICAgICBicmVhazsNCiAgICAgICAgICAgIGNhc2UgImNjIjoNCiAgICAgICAgICAgICAg
|
||||||
|
ICAkdGhpcy0+TWFpbC0+QWRkQ0MoJHNBZGRyZXNzLCAkc05hbWUpOw0KICAgICAgICAgICAgICAg
|
||||||
|
IGJyZWFrOw0KICAgICAgICAgICAgY2FzZSAiYmNjIjoNCiAgICAgICAgICAgICAgICAkdGhpcy0+
|
||||||
|
TWFpbC0+QWRkQkNDKCRzQWRkcmVzcywgJHNOYW1lKTsNCiAgICAgICAgICAgICAgICBicmVhazsN
|
||||||
|
CiAgICAgICAgfQ0KICAgIH0NCg0KICAgIC8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8v
|
||||||
|
Ly8vLy8vLy8vLy8vLy8vLy8NCiAgICAvLyBVTklUIFRFU1RTDQogICAgLy8vLy8vLy8vLy8vLy8v
|
||||||
|
Ly8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLw0KDQogICAgLyoqDQogICAgICogVHJ5
|
||||||
|
IGEgcGxhaW4gbWVzc2FnZS4NCiAgICAgKi8NCiAgICBmdW5jdGlvbiB0ZXN0X1dvcmRXcmFwKCkg
|
||||||
|
ew0KDQogICAgICAgICR0aGlzLT5NYWlsL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SAiIC4NCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAiYSByZXBseSB0byBh
|
||||||
|
ZGRyZXNzIGluIHRoaXMgbWVzc2FnZS4iOw0KICAgICAgICAkdGhpcy0+TWFpbC0+U3ViamVjdCAu
|
||||||
|
PSAiOiBMb3cgUHJpb3JpdHkiOw0KICAgICAgICAkdGhpcy0+TWFpbC0+QWRkUmVwbHlUbygibm9i
|
||||||
|
b2R5QG5vYm9keS5jb20iLCAiTm9ib2R5IChVbml0IFRlc3QpIik7DQoNCiAgICAgICAgJHRoaXMt
|
||||||
|
PkJ1aWxkQm9keSgpOw0KICAgICAgICAkdGhpcy0+YXNzZXJ0KCR0aGlzLT5NYWlsLT5TZW5kKCks
|
||||||
|
ICR0aGlzLT5NYWlsLT5FcnJvckluZm8pOw0KICAgIH0NCg0KICAgIC8qKg0KICAgICAqIFNpbXBs
|
||||||
|
ZSBwbGFpbiBmaWxlIGF0dGFjaG1lbnQgdGVzdC4NCiAgICAgKi8NCiAgICBmdW5jdGlvbiB0ZXN0
|
||||||
|
X011bHRpcGxlX1BsYWluX0ZpbGVBdHRhY2htZW50KCkgew0KDQogICAgICAgICR0aGlzLT5NYWls
|
||||||
|
LT5Cb2R5ID0gIkhlcmUgaXMgdGhlIHRleHQgYm9keSI7DQogICAgICAgICR0aGlzLT5NYWlsLT5T
|
||||||
|
dWJqZWN0IC49ICI6IFBsYWluICsgTXVsdGlwbGUgRmlsZUF0dGFjaG1lbnRzIjsNCg0KICAgICAg
|
||||||
|
ICBpZighJHRoaXMtPk1haWwtPkFkZEF0dGFjaG1lbnQoInJvY2tzLnBuZyIpKQ0KICAgICAgICB7
|
||||||
|
DQogICAgICAgICAgICAkdGhpcy0+YXNzZXJ0KGZhbHNlLCAkdGhpcy0+TWFpbC0+RXJyb3JJbmZv
|
||||||
|
KTsNCiAgICAgICAgICAgIHJldHVybjsNCiAgICAgICAgfQ0KDQogICAgICAgIGlmKCEkdGhpcy0+
|
||||||
|
TWFpbC0+QWRkQXR0YWNobWVudCgicGhwbWFpbGVyX3Rlc3QucGhwIiwgInRlc3QudHh0IikpDQog
|
||||||
|
ICAgICAgIHsNCiAgICAgICAgICAgICR0aGlzLT5hc3NlcnQoZmFsc2UsICR0aGlzLT5NYWlsLT5F
|
||||||
|
cnJvckluZm8pOw0KICAgICAgICAgICAgcmV0dXJuOw0KICAgICAgICB9DQoNCiAgICAgICAgJHRo
|
||||||
|
aXMtPkJ1aWxkQm9keSgpOw0KICAgICAgICAkdGhpcy0+YXNzZXJ0KCR0aGlzLT5NYWlsLT5TZW5k
|
||||||
|
KCksICR0aGlzLT5NYWlsLT5FcnJvckluZm8pOw0KICAgIH0NCg0KICAgIC8qKg0KICAgICAqIFNp
|
||||||
|
bXBsZSBwbGFpbiBzdHJpbmcgYXR0YWNobWVudCB0ZXN0Lg0KICAgICAqLw0KICAgIGZ1bmN0aW9u
|
||||||
|
IHRlc3RfUGxhaW5fU3RyaW5nQXR0YWNobWVudCgpIHsNCg0KICAgICAgICAkdGhpcy0+TWFpbC0+
|
||||||
|
Qm9keSA9ICJIZXJlIGlzIHRoZSB0ZXh0IGJvZHkiOw0KICAgICAgICAkdGhpcy0+TWFpbC0+U3Vi
|
||||||
|
amVjdCAuPSAiOiBQbGFpbiArIFN0cmluZ0F0dGFjaG1lbnQiOw0KDQogICAgICAgICRzQXR0YWNo
|
||||||
|
bWVudCA9ICJUaGVzZSBjaGFyYWN0ZXJzIGFyZSB0aGUgY29udGVudCBvZiB0aGUgIiAuDQogICAg
|
||||||
|
ICAgICAgICAgICAgICAgICAgICJzdHJpbmcgYXR0YWNobWVudC5cblRoaXMgbWlnaHQgYmUgdGFr
|
||||||
|
ZW4gZnJvbSBhICIuDQogICAgICAgICAgICAgICAgICAgICAgICJkYXRhYmFzZSBvciBzb21lIG90
|
||||||
|
aGVyIHN1Y2ggdGhpbmcuICI7DQoNCiAgICAgICAgJHRoaXMtPk1haWwtPkFkZFN0cmluZ0F0dGFj
|
||||||
|
aG1lbnQoJHNBdHRhY2htZW50LCAic3RyaW5nX2F0dGFjaC50eHQiKTsNCg0KICAgICAgICAkdGhp
|
||||||
|
cy0+QnVpbGRCb2R5KCk7DQogICAgICAgICR0aGlzLT5hc3NlcnQoJHRoaXMtPk1haWwtPlNlbmQo
|
||||||
|
KSwgJHRoaXMtPk1haWwtPkVycm9ySW5mbyk7DQogICAgfQ0KDQogICAgLyoqDQogICAgICogUGxh
|
||||||
|
aW4gcXVvdGVkLXByaW50YWJsZSBtZXNzYWdlLg0KICAgICAqLw0KICAgIGZ1bmN0aW9uIHRlc3Rf
|
||||||
|
UXVvdGVkX1ByaW50YWJsZSgpIHsNCg0KICAgICAgICAkdGhpcy0+TWFpbC0+Qm9keSA9ICJIZXJl
|
||||||
|
IGlzIHRoZSBtYWluIGJvZHkiOw0KICAgICAgICAkdGhpcy0+TWFpbC0+U3ViamVjdCAuPSAiOiBQ
|
||||||
|
bGFpbiArIFF1b3RlZC1wcmludGFibGUiOw0KICAgICAgICAkdGhpcy0+TWFpbC0+RW5jb2Rpbmcg
|
||||||
|
PSAicXVvdGVkLXByaW50YWJsZSI7DQoNCiAgICAgICAgJHRoaXMtPkJ1aWxkQm9keSgpOw0KICAg
|
||||||
|
ICAgICAkdGhpcy0+YXNzZXJ0KCR0aGlzLT5NYWlsLT5TZW5kKCksICR0aGlzLT5NYWlsLT5FcnJv
|
||||||
|
ckluZm8pOw0KICAgIH0NCg0KICAgIC8qKg0KICAgICAqIFRyeSBhIHBsYWluIG1lc3NhZ2UuDQog
|
||||||
|
ICAgICovDQogICAgZnVuY3Rpb24gdGVzdF9IdG1sKCkgew0KDQogICAgICAgICR0aGlzLT5NYWls
|
||||||
|
LT5Jc0hUTUwodHJ1ZSk7DQogICAgICAgICR0aGlzLT5NYWlsLT5TdWJqZWN0IC49ICI6IEhUTUwg
|
||||||
|
b25seSI7DQoNCiAgICAgICAgJHRoaXMtPk1haWwtPkJvZHkgPSAiVGhpcyBpcyBhIDxiPnRlc3Qg
|
||||||
|
bWVzc2FnZTwvYj4gd3JpdHRlbiBpbiBIVE1MLiA8L2JyPiIgLg0KICAgICAgICAgICAgICAgICAg
|
||||||
|
ICAgICAgICAgICJHbyB0byA8YSBocmVmPVwiaHR0cDovL3BocG1haWxlci5zb3VyY2Vmb3JnZS5u
|
||||||
|
ZXQvXCI+IiAuDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgImh0dHA6Ly9waHBtYWlsZXIu
|
||||||
|
c291cmNlZm9yZ2UubmV0LzwvYT4gZm9yIG5ldyB2ZXJzaW9ucyBvZiAiIC4NCiAgICAgICAgICAg
|
||||||
|
ICAgICAgICAgICAgICAgICAicGhwbWFpbGVyLiAgPHAvPiBUaGFuayB5b3UhIjsNCg0KICAgICAg
|
||||||
|
ICAkdGhpcy0+QnVpbGRCb2R5KCk7DQogICAgICAgICR0aGlzLT5hc3NlcnQoJHRoaXMtPk1haWwt
|
||||||
|
PlNlbmQoKSwgJHRoaXMtPk1haWwtPkVycm9ySW5mbyk7DQogICAgfQ0KDQogICAgLyoqDQogICAg
|
||||||
|
ICogU2ltcGxlIEhUTUwgYW5kIGF0dGFjaG1lbnQgdGVzdA0KICAgICAqLw0KICAgIGZ1bmN0aW9u
|
||||||
|
IHRlc3RfSFRNTF9BdHRhY2htZW50KCkgew0KDQogICAgICAgICR0aGlzLT5NYWlsLT5Cb2R5ID0g
|
||||||
|
IlRoaXMgaXMgdGhlIDxiPkhUTUw8L2I+IHBhcnQgb2YgdGhlIGVtYWlsLiI7DQogICAgICAgICR0
|
||||||
|
aGlzLT5NYWlsLT5TdWJqZWN0IC49ICI6IEhUTUwgKyBBdHRhY2htZW50IjsNCiAgICAgICAgJHRo
|
||||||
|
aXMtPk1haWwtPklzSFRNTCh0cnVlKTsNCg0KICAgICAgICBpZighJHRoaXMtPk1haWwtPkFkZEF0
|
||||||
|
dGFjaG1lbnQoInBocG1haWxlcl90ZXN0LnBocCIsICJ0ZXN0X2F0dGFjaC50eHQiKSkNCiAgICAg
|
||||||
|
ICAgew0KICAgICAgICAgICAgJHRoaXMtPmFzc2VydChmYWxzZSwgJHRoaXMtPk1haWwtPkVycm9y
|
||||||
|
SW5mbyk7DQogICAgICAgICAgICByZXR1cm47DQogICAgICAgIH0NCg0KICAgICAgICAkdGhpcy0+
|
||||||
|
QnVpbGRCb2R5KCk7DQogICAgICAgICR0aGlzLT5hc3NlcnQoJHRoaXMtPk1haWwtPlNlbmQoKSwg
|
||||||
|
JHRoaXMtPk1haWwtPkVycm9ySW5mbyk7DQogICAgfQ0KDQogICAgLyoqDQogICAgICogQW4gZW1i
|
||||||
|
ZWRkZWQgYXR0YWNobWVudCB0ZXN0Lg0KICAgICAqLw0KICAgIGZ1bmN0aW9uIHRlc3RfRW1iZWRk
|
||||||
|
ZWRfSW1hZ2UoKSB7DQoNCiAgICAgICAgJHRoaXMtPk1haWwtPkJvZHkgPSAiRW1iZWRkZWQgSW1h
|
||||||
|
Z2U6IDxpbWcgYWx0PVwicGhwbWFpbGVyXCIgc3JjPVwiY2lkOm15LWF0dGFjaFwiPiIgLg0KICAg
|
||||||
|
ICAgICAgICAgICAgICAgICAgIkhlcmUgaXMgYW4gaW1hZ2UhPC9hPiI7DQogICAgICAgICR0aGlz
|
||||||
|
LT5NYWlsLT5TdWJqZWN0IC49ICI6IEVtYmVkZGVkIEltYWdlIjsNCiAgICAgICAgJHRoaXMtPk1h
|
||||||
|
aWwtPklzSFRNTCh0cnVlKTsNCg0KICAgICAgICBpZighJHRoaXMtPk1haWwtPkFkZEVtYmVkZGVk
|
||||||
|
SW1hZ2UoInJvY2tzLnBuZyIsICJteS1hdHRhY2giLCAicm9ja3MucG5nIiwNCiAgICAgICAgICAg
|
||||||
|
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJiYXNlNjQiLCAiaW1hZ2UvcG5nIikpDQog
|
||||||
|
ICAgICAgIHsNCiAgICAgICAgICAgICR0aGlzLT5hc3NlcnQoZmFsc2UsICR0aGlzLT5NYWlsLT5F
|
||||||
|
cnJvckluZm8pOw0KICAgICAgICAgICAgcmV0dXJuOw0KICAgICAgICB9DQoNCiAgICAgICAgJHRo
|
||||||
|
aXMtPkJ1aWxkQm9keSgpOw0KICAgICAgICAkdGhpcy0+YXNzZXJ0KCR0aGlzLT5NYWlsLT5TZW5k
|
||||||
|
KCksICR0aGlzLT5NYWlsLT5FcnJvckluZm8pOw0KICAgIH0NCg0KICAgIC8qKg0KICAgICAqIEFu
|
||||||
|
IGVtYmVkZGVkIGF0dGFjaG1lbnQgdGVzdC4NCiAgICAgKi8NCiAgICBmdW5jdGlvbiB0ZXN0X011
|
||||||
|
bHRpX0VtYmVkZGVkX0ltYWdlKCkgew0KDQogICAgICAgICR0aGlzLT5NYWlsLT5Cb2R5ID0gIkVt
|
||||||
|
YmVkZGVkIEltYWdlOiA8aW1nIGFsdD1cInBocG1haWxlclwiIHNyYz1cImNpZDpteS1hdHRhY2hc
|
||||||
|
Ij4iIC4NCiAgICAgICAgICAgICAgICAgICAgICJIZXJlIGlzIGFuIGltYWdlITwvYT4iOw0KICAg
|
||||||
|
ICAgICAkdGhpcy0+TWFpbC0+U3ViamVjdCAuPSAiOiBFbWJlZGRlZCBJbWFnZSArIEF0dGFjaG1l
|
||||||
|
bnQiOw0KICAgICAgICAkdGhpcy0+TWFpbC0+SXNIVE1MKHRydWUpOw0KDQogICAgICAgIGlmKCEk
|
||||||
|
dGhpcy0+TWFpbC0+QWRkRW1iZWRkZWRJbWFnZSgicm9ja3MucG5nIiwgIm15LWF0dGFjaCIsICJy
|
||||||
|
b2Nrcy5wbmciLA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImJh
|
||||||
|
c2U2NCIsICJpbWFnZS9wbmciKSkNCiAgICAgICAgew0KICAgICAgICAgICAgJHRoaXMtPmFzc2Vy
|
||||||
|
dChmYWxzZSwgJHRoaXMtPk1haWwtPkVycm9ySW5mbyk7DQogICAgICAgICAgICByZXR1cm47DQog
|
||||||
|
ICAgIC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kIGNhdXNlIGFuIGVycm9yDQogICAgICAgICR0aGlzLT5hc3NlcnQoJHRoaXMtPk1haWwtPklz
|
||||||
|
RXJyb3IoKSA9PSBmYWxzZSwgIkVycm9yIGZvdW5kIik7DQogICAgICAgICR0aGlzLT5hc3NlcnQo
|
||||||
|
JHRoaXMtPk1haWwtPlNlbmQoKSA9PSBmYWxzZSwgIlNlbmQgc3VjY2VlZGVkIik7DQogICAgICAg
|
||||||
|
ICR0aGlzLT5hc3NlcnQoJHRoaXMtPk1haWwtPklzRXJyb3IoKSwgIk5vIGVycm9yIGZvdW5kIik7
|
||||||
|
DQogICAgICAgICR0aGlzLT5hc3NlcnRFcXVhbHMoJ1lvdSBtdXN0IHByb3ZpZGUgYXQgbGVhc3Qg
|
||||||
|
b25lICcgLg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICdyZWNpcGllbnQgZW1haWwgYWRk
|
||||||
|
cmVzcy4nLCAkdGhpcy0+TWFpbC0+RXJyb3JJbmZvKTsNCiAgICB9DQp9DQoNCi8qKg0KICogQ3Jl
|
||||||
|
YXRlIGFuZCBydW4gdGVzdCBpbnN0YW5jZS4NCiAqLw0KDQppZihpc3NldCgkSFRUUF9HRVRfVkFS
|
||||||
|
UykpDQogICAgJGdsb2JhbF92YXJzID0gJEhUVFBfR0VUX1ZBUlM7DQplbHNlDQogICAgJGdsb2Jh
|
||||||
|
bF92YXJzID0gJF9SRVFVRVNUOw0KDQppZihpc3NldCgkZ2xvYmFsX3ZhcnNbInN1Ym1pdHRlZCJd
|
||||||
|
KSkNCnsNCiAgICBlY2hvICJUZXN0IHJlc3VsdHM6PGJyPiI7DQogICAgJHN1aXRlID0gbmV3IFRl
|
||||||
|
c3RTdWl0ZSggInBocG1haWxlclRlc3QiICk7DQoNCiAgICAkdGVzdFJ1bm5lciA9IG5ldyBUZXN0
|
||||||
|
UnVubmVyOw0KICAgICR0ZXN0UnVubmVyLT5ydW4oJHN1aXRlKTsNCiAgICBlY2hvICI8aHIgbm9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CIgdmFsdWU9Ijw/cGhwIGVjaG8gZ2V0KCJtYWlsX2hvc3QiKTsgPz4iLz4NCjxw
|
||||||
|
Lz4NCjxpbnB1dCB0eXBlPSJzdWJtaXQiIHZhbHVlPSJSdW4gVGVzdCIvPg0KDQo8L2Zvcm0+DQo8
|
||||||
|
L2JvZHk+DQo8L2h0bWw+DQo=
|
||||||
|
|
||||||
|
|
||||||
|
--b1_a0169dc7929d1c609a827b4d1a0c3f74--
|
||||||
558
Class/test/phpmailer_test.php
Normal file
558
Class/test/phpmailer_test.php
Normal file
|
|
@ -0,0 +1,558 @@
|
||||||
|
<?php
|
||||||
|
/*******************
|
||||||
|
Unit Test
|
||||||
|
Type: phpmailer class
|
||||||
|
********************/
|
||||||
|
|
||||||
|
$INCLUDE_DIR = "../";
|
||||||
|
|
||||||
|
require("phpunit.php");
|
||||||
|
require($INCLUDE_DIR . "class.phpmailer.php");
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs authentication tests
|
||||||
|
*/
|
||||||
|
class phpmailerTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Holds the default phpmailer instance.
|
||||||
|
* @private
|
||||||
|
* @type object
|
||||||
|
*/
|
||||||
|
var $Mail = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds the SMTP mail host.
|
||||||
|
* @public
|
||||||
|
* @type string
|
||||||
|
*/
|
||||||
|
var $Host = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds the change log.
|
||||||
|
* @private
|
||||||
|
* @type string array
|
||||||
|
*/
|
||||||
|
var $ChangeLog = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds the note log.
|
||||||
|
* @private
|
||||||
|
* @type string array
|
||||||
|
*/
|
||||||
|
var $NoteLog = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constuctor.
|
||||||
|
*/
|
||||||
|
function phpmailerTest($name) {
|
||||||
|
/* must define this constructor */
|
||||||
|
$this->TestCase( $name );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run before each test is started.
|
||||||
|
*/
|
||||||
|
function setUp() {
|
||||||
|
global $global_vars;
|
||||||
|
global $INCLUDE_DIR;
|
||||||
|
|
||||||
|
$this->Mail = new PHPMailer();
|
||||||
|
|
||||||
|
$this->Mail->Priority = 3;
|
||||||
|
$this->Mail->Encoding = "8bit";
|
||||||
|
$this->Mail->CharSet = "iso-8859-1";
|
||||||
|
$this->Mail->From = "unit_test@phpmailer.sf.net";
|
||||||
|
$this->Mail->FromName = "Unit Tester";
|
||||||
|
$this->Mail->Sender = "";
|
||||||
|
$this->Mail->Subject = "Unit Test";
|
||||||
|
$this->Mail->Body = "";
|
||||||
|
$this->Mail->AltBody = "";
|
||||||
|
$this->Mail->WordWrap = 0;
|
||||||
|
$this->Mail->Host = $global_vars["mail_host"];
|
||||||
|
$this->Mail->Port = 25;
|
||||||
|
$this->Mail->Helo = "localhost.localdomain";
|
||||||
|
$this->Mail->SMTPAuth = false;
|
||||||
|
$this->Mail->Username = "";
|
||||||
|
$this->Mail->Password = "";
|
||||||
|
$this->Mail->PluginDir = $INCLUDE_DIR;
|
||||||
|
$this->Mail->AddReplyTo("no_reply@phpmailer.sf.net", "Reply Guy");
|
||||||
|
$this->Mail->Sender = "nobody@example.com";
|
||||||
|
|
||||||
|
if(strlen($this->Mail->Host) > 0)
|
||||||
|
$this->Mail->Mailer = "smtp";
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->Mail->Mailer = "mail";
|
||||||
|
$this->Sender = "unit_test@phpmailer.sf.net";
|
||||||
|
}
|
||||||
|
|
||||||
|
global $global_vars;
|
||||||
|
$this->SetAddress($global_vars["mail_to"], "Test User");
|
||||||
|
if(strlen($global_vars["mail_cc"]) > 0)
|
||||||
|
$this->SetAddress($global_vars["mail_cc"], "Carbon User", "cc");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run after each test is completed.
|
||||||
|
*/
|
||||||
|
function tearDown() {
|
||||||
|
// Clean global variables
|
||||||
|
$this->Mail = NULL;
|
||||||
|
$this->ChangeLog = array();
|
||||||
|
$this->NoteLog = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the body of the message in the appropriate format.
|
||||||
|
* @private
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
function BuildBody() {
|
||||||
|
$this->CheckChanges();
|
||||||
|
|
||||||
|
// Determine line endings for message
|
||||||
|
if($this->Mail->ContentType == "text/html" || strlen($this->Mail->AltBody) > 0)
|
||||||
|
{
|
||||||
|
$eol = "<br/>";
|
||||||
|
$bullet = "<li>";
|
||||||
|
$bullet_start = "<ul>";
|
||||||
|
$bullet_end = "</ul>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$eol = "\n";
|
||||||
|
$bullet = " - ";
|
||||||
|
$bullet_start = "";
|
||||||
|
$bullet_end = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
$ReportBody = "";
|
||||||
|
|
||||||
|
$ReportBody .= "---------------------" . $eol;
|
||||||
|
$ReportBody .= "Unit Test Information" . $eol;
|
||||||
|
$ReportBody .= "---------------------" . $eol;
|
||||||
|
$ReportBody .= "phpmailer version: " . $this->Mail->Version . $eol;
|
||||||
|
$ReportBody .= "Content Type: " . $this->Mail->ContentType . $eol;
|
||||||
|
|
||||||
|
if(strlen($this->Mail->Host) > 0)
|
||||||
|
$ReportBody .= "Host: " . $this->Mail->Host . $eol;
|
||||||
|
|
||||||
|
// If attachments then create an attachment list
|
||||||
|
if(count($this->Mail->attachment) > 0)
|
||||||
|
{
|
||||||
|
$ReportBody .= "Attachments:" . $eol;
|
||||||
|
$ReportBody .= $bullet_start;
|
||||||
|
for($i = 0; $i < count($this->Mail->attachment); $i++)
|
||||||
|
{
|
||||||
|
$ReportBody .= $bullet . "Name: " . $this->Mail->attachment[$i][1] . ", ";
|
||||||
|
$ReportBody .= "Encoding: " . $this->Mail->attachment[$i][3] . ", ";
|
||||||
|
$ReportBody .= "Type: " . $this->Mail->attachment[$i][4] . $eol;
|
||||||
|
}
|
||||||
|
$ReportBody .= $bullet_end . $eol;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there are changes then list them
|
||||||
|
if(count($this->ChangeLog) > 0)
|
||||||
|
{
|
||||||
|
$ReportBody .= "Changes" . $eol;
|
||||||
|
$ReportBody .= "-------" . $eol;
|
||||||
|
|
||||||
|
$ReportBody .= $bullet_start;
|
||||||
|
for($i = 0; $i < count($this->ChangeLog); $i++)
|
||||||
|
{
|
||||||
|
$ReportBody .= $bullet . $this->ChangeLog[$i][0] . " was changed to [" .
|
||||||
|
$this->ChangeLog[$i][1] . "]" . $eol;
|
||||||
|
}
|
||||||
|
$ReportBody .= $bullet_end . $eol . $eol;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there are notes then list them
|
||||||
|
if(count($this->NoteLog) > 0)
|
||||||
|
{
|
||||||
|
$ReportBody .= "Notes" . $eol;
|
||||||
|
$ReportBody .= "-----" . $eol;
|
||||||
|
|
||||||
|
$ReportBody .= $bullet_start;
|
||||||
|
for($i = 0; $i < count($this->NoteLog); $i++)
|
||||||
|
{
|
||||||
|
$ReportBody .= $bullet . $this->NoteLog[$i] . $eol;
|
||||||
|
}
|
||||||
|
$ReportBody .= $bullet_end;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-attach the original body
|
||||||
|
$this->Mail->Body .= $eol . $eol . $ReportBody;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check which default settings have been changed for the report.
|
||||||
|
* @private
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
function CheckChanges() {
|
||||||
|
if($this->Mail->Priority != 3)
|
||||||
|
$this->AddChange("Priority", $this->Mail->Priority);
|
||||||
|
if($this->Mail->Encoding != "8bit")
|
||||||
|
$this->AddChange("Encoding", $this->Mail->Encoding);
|
||||||
|
if($this->Mail->CharSet != "iso-8859-1")
|
||||||
|
$this->AddChange("CharSet", $this->Mail->CharSet);
|
||||||
|
if($this->Mail->Sender != "")
|
||||||
|
$this->AddChange("Sender", $this->Mail->Sender);
|
||||||
|
if($this->Mail->WordWrap != 0)
|
||||||
|
$this->AddChange("WordWrap", $this->Mail->WordWrap);
|
||||||
|
if($this->Mail->Mailer != "mail")
|
||||||
|
$this->AddChange("Mailer", $this->Mail->Mailer);
|
||||||
|
if($this->Mail->Port != 25)
|
||||||
|
$this->AddChange("Port", $this->Mail->Port);
|
||||||
|
if($this->Mail->Helo != "localhost.localdomain")
|
||||||
|
$this->AddChange("Helo", $this->Mail->Helo);
|
||||||
|
if($this->Mail->SMTPAuth)
|
||||||
|
$this->AddChange("SMTPAuth", "true");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a change entry.
|
||||||
|
* @private
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
function AddChange($sName, $sNewValue) {
|
||||||
|
$cur = count($this->ChangeLog);
|
||||||
|
$this->ChangeLog[$cur][0] = $sName;
|
||||||
|
$this->ChangeLog[$cur][1] = $sNewValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a simple note to the message.
|
||||||
|
* @public
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
function AddNote($sValue) {
|
||||||
|
$this->NoteLog[] = $sValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds all of the addresses
|
||||||
|
* @public
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
function SetAddress($sAddress, $sName = "", $sType = "to") {
|
||||||
|
switch($sType)
|
||||||
|
{
|
||||||
|
case "to":
|
||||||
|
$this->Mail->AddAddress($sAddress, $sName);
|
||||||
|
break;
|
||||||
|
case "cc":
|
||||||
|
$this->Mail->AddCC($sAddress, $sName);
|
||||||
|
break;
|
||||||
|
case "bcc":
|
||||||
|
$this->Mail->AddBCC($sAddress, $sName);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////
|
||||||
|
// UNIT TESTS
|
||||||
|
/////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Try a plain message.
|
||||||
|
*/
|
||||||
|
function test_WordWrap() {
|
||||||
|
|
||||||
|
$this->Mail->WordWrap = 40;
|
||||||
|
$my_body = "Here is the main body of this message. It should " .
|
||||||
|
"be quite a few lines. It should be wrapped at the " .
|
||||||
|
"40 characters. Make sure that it is.";
|
||||||
|
$nBodyLen = strlen($my_body);
|
||||||
|
$my_body .= "\n\nThis is the above body length: " . $nBodyLen;
|
||||||
|
|
||||||
|
$this->Mail->Body = $my_body;
|
||||||
|
$this->Mail->Subject .= ": Wordwrap";
|
||||||
|
|
||||||
|
$this->BuildBody();
|
||||||
|
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Try a plain message.
|
||||||
|
*/
|
||||||
|
function test_Low_Priority() {
|
||||||
|
|
||||||
|
$this->Mail->Priority = 5;
|
||||||
|
$this->Mail->Body = "Here is the main body. There should be " .
|
||||||
|
"a reply to address in this message.";
|
||||||
|
$this->Mail->Subject .= ": Low Priority";
|
||||||
|
$this->Mail->AddReplyTo("nobody@nobody.com", "Nobody (Unit Test)");
|
||||||
|
|
||||||
|
$this->BuildBody();
|
||||||
|
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple plain file attachment test.
|
||||||
|
*/
|
||||||
|
function test_Multiple_Plain_FileAttachment() {
|
||||||
|
|
||||||
|
$this->Mail->Body = "Here is the text body";
|
||||||
|
$this->Mail->Subject .= ": Plain + Multiple FileAttachments";
|
||||||
|
|
||||||
|
if(!$this->Mail->AddAttachment("rocks.png"))
|
||||||
|
{
|
||||||
|
$this->assert(false, $this->Mail->ErrorInfo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$this->Mail->AddAttachment("phpmailer_test.php", "test.txt"))
|
||||||
|
{
|
||||||
|
$this->assert(false, $this->Mail->ErrorInfo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->BuildBody();
|
||||||
|
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple plain string attachment test.
|
||||||
|
*/
|
||||||
|
function test_Plain_StringAttachment() {
|
||||||
|
|
||||||
|
$this->Mail->Body = "Here is the text body";
|
||||||
|
$this->Mail->Subject .= ": Plain + StringAttachment";
|
||||||
|
|
||||||
|
$sAttachment = "These characters are the content of the " .
|
||||||
|
"string attachment.\nThis might be taken from a ".
|
||||||
|
"database or some other such thing. ";
|
||||||
|
|
||||||
|
$this->Mail->AddStringAttachment($sAttachment, "string_attach.txt");
|
||||||
|
|
||||||
|
$this->BuildBody();
|
||||||
|
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plain quoted-printable message.
|
||||||
|
*/
|
||||||
|
function test_Quoted_Printable() {
|
||||||
|
|
||||||
|
$this->Mail->Body = "Here is the main body";
|
||||||
|
$this->Mail->Subject .= ": Plain + Quoted-printable";
|
||||||
|
$this->Mail->Encoding = "quoted-printable";
|
||||||
|
|
||||||
|
$this->BuildBody();
|
||||||
|
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Try a plain message.
|
||||||
|
*/
|
||||||
|
function test_Html() {
|
||||||
|
|
||||||
|
$this->Mail->IsHTML(true);
|
||||||
|
$this->Mail->Subject .= ": HTML only";
|
||||||
|
|
||||||
|
$this->Mail->Body = "This is a <b>test message</b> written in HTML. </br>" .
|
||||||
|
"Go to <a href=\"http://phpmailer.sourceforge.net/\">" .
|
||||||
|
"http://phpmailer.sourceforge.net/</a> for new versions of " .
|
||||||
|
"phpmailer. <p/> Thank you!";
|
||||||
|
|
||||||
|
$this->BuildBody();
|
||||||
|
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple HTML and attachment test
|
||||||
|
*/
|
||||||
|
function test_HTML_Attachment() {
|
||||||
|
|
||||||
|
$this->Mail->Body = "This is the <b>HTML</b> part of the email.";
|
||||||
|
$this->Mail->Subject .= ": HTML + Attachment";
|
||||||
|
$this->Mail->IsHTML(true);
|
||||||
|
|
||||||
|
if(!$this->Mail->AddAttachment("phpmailer_test.php", "test_attach.txt"))
|
||||||
|
{
|
||||||
|
$this->assert(false, $this->Mail->ErrorInfo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->BuildBody();
|
||||||
|
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An embedded attachment test.
|
||||||
|
*/
|
||||||
|
function test_Embedded_Image() {
|
||||||
|
|
||||||
|
$this->Mail->Body = "Embedded Image: <img alt=\"phpmailer\" src=\"cid:my-attach\">" .
|
||||||
|
"Here is an image!</a>";
|
||||||
|
$this->Mail->Subject .= ": Embedded Image";
|
||||||
|
$this->Mail->IsHTML(true);
|
||||||
|
|
||||||
|
if(!$this->Mail->AddEmbeddedImage("rocks.png", "my-attach", "rocks.png",
|
||||||
|
"base64", "image/png"))
|
||||||
|
{
|
||||||
|
$this->assert(false, $this->Mail->ErrorInfo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->BuildBody();
|
||||||
|
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An embedded attachment test.
|
||||||
|
*/
|
||||||
|
function test_Multi_Embedded_Image() {
|
||||||
|
|
||||||
|
$this->Mail->Body = "Embedded Image: <img alt=\"phpmailer\" src=\"cid:my-attach\">" .
|
||||||
|
"Here is an image!</a>";
|
||||||
|
$this->Mail->Subject .= ": Embedded Image + Attachment";
|
||||||
|
$this->Mail->IsHTML(true);
|
||||||
|
|
||||||
|
if(!$this->Mail->AddEmbeddedImage("rocks.png", "my-attach", "rocks.png",
|
||||||
|
"base64", "image/png"))
|
||||||
|
{
|
||||||
|
$this->assert(false, $this->Mail->ErrorInfo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$this->Mail->AddAttachment("phpmailer_test.php", "test.txt"))
|
||||||
|
{
|
||||||
|
$this->assert(false, $this->Mail->ErrorInfo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->BuildBody();
|
||||||
|
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple multipart/alternative test.
|
||||||
|
*/
|
||||||
|
function test_AltBody() {
|
||||||
|
|
||||||
|
$this->Mail->Body = "This is the <b>HTML</b> part of the email.";
|
||||||
|
$this->Mail->AltBody = "Here is the text body of this message. " .
|
||||||
|
"It should be quite a few lines. It should be wrapped at the " .
|
||||||
|
"40 characters. Make sure that it is.";
|
||||||
|
$this->Mail->WordWrap = 40;
|
||||||
|
$this->AddNote("This is a mulipart alternative email");
|
||||||
|
$this->Mail->Subject .= ": AltBody + Word Wrap";
|
||||||
|
|
||||||
|
$this->BuildBody();
|
||||||
|
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple HTML and attachment test
|
||||||
|
*/
|
||||||
|
function test_AltBody_Attachment() {
|
||||||
|
|
||||||
|
$this->Mail->Body = "This is the <b>HTML</b> part of the email.";
|
||||||
|
$this->Mail->AltBody = "This is the text part of the email.";
|
||||||
|
$this->Mail->Subject .= ": AltBody + Attachment";
|
||||||
|
$this->Mail->IsHTML(true);
|
||||||
|
|
||||||
|
if(!$this->Mail->AddAttachment("phpmailer_test.php", "test_attach.txt"))
|
||||||
|
{
|
||||||
|
$this->assert(false, $this->Mail->ErrorInfo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->BuildBody();
|
||||||
|
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
|
||||||
|
|
||||||
|
$fp = fopen("message.txt", "w");
|
||||||
|
fwrite($fp, $this->Mail->CreateHeader() . $this->Mail->CreateBody());
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_MultipleSend() {
|
||||||
|
$this->Mail->Body = "Sending two messages without keepalive";
|
||||||
|
$this->BuildBody();
|
||||||
|
$subject = $this->Mail->Subject;
|
||||||
|
|
||||||
|
$this->Mail->Subject = $subject . ": SMTP 1";
|
||||||
|
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
|
||||||
|
|
||||||
|
$this->Mail->Subject = $subject . ": SMTP 2";
|
||||||
|
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_SmtpKeepAlive() {
|
||||||
|
$this->Mail->Body = "This was done using the SMTP keep-alive.";
|
||||||
|
$this->BuildBody();
|
||||||
|
$subject = $this->Mail->Subject;
|
||||||
|
|
||||||
|
$this->Mail->SMTPKeepAlive = true;
|
||||||
|
$this->Mail->Subject = $subject . ": SMTP keep-alive 1";
|
||||||
|
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
|
||||||
|
|
||||||
|
$this->Mail->Subject = $subject . ": SMTP keep-alive 2";
|
||||||
|
$this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);
|
||||||
|
$this->Mail->SmtpClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_Error() {
|
||||||
|
$this->BuildBody();
|
||||||
|
$this->Mail->Subject .= ": This should not be sent";
|
||||||
|
$this->Mail->ClearAllRecipients(); // no addresses should cause an error
|
||||||
|
$this->assert($this->Mail->IsError() == false, "Error found");
|
||||||
|
$this->assert($this->Mail->Send() == false, "Send succeeded");
|
||||||
|
$this->assert($this->Mail->IsError(), "No error found");
|
||||||
|
$this->assertEquals('You must provide at least one ' .
|
||||||
|
'recipient email address.', $this->Mail->ErrorInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create and run test instance.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(isset($HTTP_GET_VARS))
|
||||||
|
$global_vars = $HTTP_GET_VARS;
|
||||||
|
else
|
||||||
|
$global_vars = $_REQUEST;
|
||||||
|
|
||||||
|
if(isset($global_vars["submitted"]))
|
||||||
|
{
|
||||||
|
echo "Test results:<br>";
|
||||||
|
$suite = new TestSuite( "phpmailerTest" );
|
||||||
|
|
||||||
|
$testRunner = new TestRunner;
|
||||||
|
$testRunner->run($suite);
|
||||||
|
echo "<hr noshade/>";
|
||||||
|
}
|
||||||
|
|
||||||
|
function get($sName) {
|
||||||
|
global $global_vars;
|
||||||
|
if(isset($global_vars[$sName]))
|
||||||
|
return $global_vars[$sName];
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<h3>phpmailer Unit Test</h3>
|
||||||
|
By entering a SMTP hostname it will automatically perform tests with SMTP.
|
||||||
|
|
||||||
|
<form name="phpmailer_unit" action="phpmailer_test.php" method="get">
|
||||||
|
<input type="hidden" name="submitted" value="1"/>
|
||||||
|
To Address: <input type="text" size="50" name="mail_to" value="<?php echo get("mail_to"); ?>"/>
|
||||||
|
<br/>
|
||||||
|
Cc Address: <input type="text" size="50" name="mail_cc" value="<?php echo get("mail_cc"); ?>"/>
|
||||||
|
<br/>
|
||||||
|
SMTP Hostname: <input type="text" size="50" name="mail_host" value="<?php echo get("mail_host"); ?>"/>
|
||||||
|
<p/>
|
||||||
|
<input type="submit" value="Run Test"/>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
376
Class/test/phpunit.php
Normal file
376
Class/test/phpunit.php
Normal file
|
|
@ -0,0 +1,376 @@
|
||||||
|
<?php
|
||||||
|
//
|
||||||
|
// PHP framework for testing, based on the design of "JUnit".
|
||||||
|
//
|
||||||
|
// Written by Fred Yankowski <fred@ontosys.com>
|
||||||
|
// OntoSys, Inc <http://www.OntoSys.com>
|
||||||
|
//
|
||||||
|
// $Id: phpunit.php,v 1.1 2002/03/30 19:32:17 bmatzelle Exp $
|
||||||
|
|
||||||
|
// Copyright (c) 2000 Fred Yankowski
|
||||||
|
|
||||||
|
// Permission is hereby granted, free of charge, to any person
|
||||||
|
// obtaining a copy of this software and associated documentation
|
||||||
|
// files (the "Software"), to deal in the Software without
|
||||||
|
// restriction, including without limitation the rights to use, copy,
|
||||||
|
// modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
// of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be
|
||||||
|
// included in all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||||
|
// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
|
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
//
|
||||||
|
/*error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE |
|
||||||
|
E_CORE_ERROR | E_CORE_WARNING);*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
interface Test {
|
||||||
|
function run(&$aTestResult);
|
||||||
|
function countTestCases();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function trace($msg) {
|
||||||
|
return;
|
||||||
|
print($msg);
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*class Exception {
|
||||||
|
/* Emulate a Java exception, sort of... */
|
||||||
|
/*var $message;
|
||||||
|
function Exception($message) {
|
||||||
|
$this->message = $message;
|
||||||
|
}
|
||||||
|
function getMessage() {
|
||||||
|
return $this->message;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
class Assert {
|
||||||
|
function assert($boolean, $message=0) {
|
||||||
|
if (! $boolean)
|
||||||
|
$this->fail($message);
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertEquals($expected, $actual, $message=0) {
|
||||||
|
if ($expected != $actual) {
|
||||||
|
$this->failNotEquals($expected, $actual, "expected", $message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertRegexp($regexp, $actual, $message=false) {
|
||||||
|
if (! preg_match($regexp, $actual)) {
|
||||||
|
$this->failNotEquals($regexp, $actual, "pattern", $message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function failNotEquals($expected, $actual, $expected_label, $message=0) {
|
||||||
|
// Private function for reporting failure to match.
|
||||||
|
$str = $message ? ($message . ' ') : '';
|
||||||
|
$str .= "($expected_label/actual)<br>";
|
||||||
|
$htmlExpected = htmlspecialchars($expected);
|
||||||
|
$htmlActual = htmlspecialchars($actual);
|
||||||
|
$str .= sprintf("<pre>%s\n--------\n%s</pre>",
|
||||||
|
$htmlExpected, $htmlActual);
|
||||||
|
$this->fail($str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TestCase extends Assert /* implements Test */ {
|
||||||
|
/* Defines context for running tests. Specific context -- such as
|
||||||
|
instance variables, global variables, global state -- is defined
|
||||||
|
by creating a subclass that specializes the setUp() and
|
||||||
|
tearDown() methods. A specific test is defined by a subclass
|
||||||
|
that specializes the runTest() method. */
|
||||||
|
var $fName;
|
||||||
|
var $fResult;
|
||||||
|
var $fExceptions = array();
|
||||||
|
|
||||||
|
function TestCase($name) {
|
||||||
|
$this->fName = $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
function run($testResult=0) {
|
||||||
|
/* Run this single test, by calling the run() method of the
|
||||||
|
TestResult object which will in turn call the runBare() method
|
||||||
|
of this object. That complication allows the TestResult object
|
||||||
|
to do various kinds of progress reporting as it invokes each
|
||||||
|
test. Create/obtain a TestResult object if none was passed in.
|
||||||
|
Note that if a TestResult object was passed in, it must be by
|
||||||
|
reference. */
|
||||||
|
if (! $testResult)
|
||||||
|
$testResult = $this->_createResult();
|
||||||
|
$this->fResult = $testResult;
|
||||||
|
$testResult->run(&$this);
|
||||||
|
$this->fResult = 0;
|
||||||
|
return $testResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
function countTestCases() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function runTest() {
|
||||||
|
$name = $this->name();
|
||||||
|
// Since isset($this->$name) is false, no way to run defensive checks
|
||||||
|
$this->$name();
|
||||||
|
}
|
||||||
|
|
||||||
|
function setUp() /* expect override */ {
|
||||||
|
//print("TestCase::setUp()<br>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
function tearDown() /* possible override */ {
|
||||||
|
//print("TestCase::tearDown()<br>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
function _createResult() /* protected */ {
|
||||||
|
/* override this to use specialized subclass of TestResult */
|
||||||
|
return new TestResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
function fail($message=0) {
|
||||||
|
//printf("TestCase::fail(%s)<br>\n", ($message) ? $message : '');
|
||||||
|
/* JUnit throws AssertionFailedError here. We just record the
|
||||||
|
failure and carry on */
|
||||||
|
$this->fExceptions[] = new Exception(&$message);
|
||||||
|
}
|
||||||
|
|
||||||
|
function error($message) {
|
||||||
|
/* report error that requires correction in the test script
|
||||||
|
itself, or (heaven forbid) in this testing infrastructure */
|
||||||
|
printf('<b>ERROR: ' . $message . '</b><br>');
|
||||||
|
$this->fResult->stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
function failed() {
|
||||||
|
return count($this->fExceptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getExceptions() {
|
||||||
|
return $this->fExceptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
function name() {
|
||||||
|
return $this->fName;
|
||||||
|
}
|
||||||
|
|
||||||
|
function runBare() {
|
||||||
|
$this->setup();
|
||||||
|
$this->runTest();
|
||||||
|
$this->tearDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class TestSuite /* implements Test */ {
|
||||||
|
/* Compose a set of Tests (instances of TestCase or TestSuite), and
|
||||||
|
run them all. */
|
||||||
|
var $fTests = array();
|
||||||
|
|
||||||
|
function TestSuite($classname=false) {
|
||||||
|
if ($classname) {
|
||||||
|
// Find all methods of the given class whose name starts with
|
||||||
|
// "test" and add them to the test suite. We are just _barely_
|
||||||
|
// able to do this with PHP's limited introspection... Note
|
||||||
|
// that PHP seems to store method names in lower case, and we
|
||||||
|
// have to avoid the constructor function for the TestCase class
|
||||||
|
// superclass. This will fail when $classname starts with
|
||||||
|
// "Test" since that will have a constructor method that will
|
||||||
|
// get matched below and then treated (incorrectly) as a test
|
||||||
|
// method. So don't name any TestCase subclasses as "Test..."!
|
||||||
|
if (floor(phpversion()) >= 4) {
|
||||||
|
// PHP4 introspection, submitted by Dylan Kuhn
|
||||||
|
$names = get_class_methods($classname);
|
||||||
|
while (list($key, $method) = each($names)) {
|
||||||
|
if (preg_match('/^test/', $method) && $method != "testcase") {
|
||||||
|
$this->addTest(new $classname($method));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$dummy = new $classname("dummy");
|
||||||
|
$names = (array) $dummy;
|
||||||
|
while (list($key, $value) = each($names)) {
|
||||||
|
$type = gettype($value);
|
||||||
|
if ($type == "user function" && preg_match('/^test/', $key)
|
||||||
|
&& $key != "testcase") {
|
||||||
|
$this->addTest(new $classname($key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addTest($test) {
|
||||||
|
/* Add TestCase or TestSuite to this TestSuite */
|
||||||
|
$this->fTests[] = $test;
|
||||||
|
}
|
||||||
|
|
||||||
|
function run(&$testResult) {
|
||||||
|
/* Run all TestCases and TestSuites comprising this TestSuite,
|
||||||
|
accumulating results in the given TestResult object. */
|
||||||
|
reset($this->fTests);
|
||||||
|
while (list($na, $test) = each($this->fTests)) {
|
||||||
|
if ($testResult->shouldStop())
|
||||||
|
break;
|
||||||
|
$test->run(&$testResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function countTestCases() {
|
||||||
|
/* Number of TestCases comprising this TestSuite (including those
|
||||||
|
in any constituent TestSuites) */
|
||||||
|
$count = 0;
|
||||||
|
reset($fTests);
|
||||||
|
while (list($na, $test_case) = each($this->fTests)) {
|
||||||
|
$count += $test_case->countTestCases();
|
||||||
|
}
|
||||||
|
return $count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class TestFailure {
|
||||||
|
/* Record failure of a single TestCase, associating it with the
|
||||||
|
exception(s) that occurred */
|
||||||
|
var $fFailedTestName;
|
||||||
|
var $fExceptions;
|
||||||
|
|
||||||
|
function TestFailure(&$test, &$exceptions) {
|
||||||
|
$this->fFailedTestName = $test->name();
|
||||||
|
$this->fExceptions = $exceptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getExceptions() {
|
||||||
|
return $this->fExceptions;
|
||||||
|
}
|
||||||
|
function getTestName() {
|
||||||
|
return $this->fFailedTestName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class TestResult {
|
||||||
|
/* Collect the results of running a set of TestCases. */
|
||||||
|
var $fFailures = array();
|
||||||
|
var $fRunTests = 0;
|
||||||
|
var $fStop = false;
|
||||||
|
|
||||||
|
function TestResult() { }
|
||||||
|
|
||||||
|
function _endTest($test) /* protected */ {
|
||||||
|
/* specialize this for end-of-test action, such as progress
|
||||||
|
reports */
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFailures() {
|
||||||
|
return $this->fFailures;
|
||||||
|
}
|
||||||
|
|
||||||
|
function run($test) {
|
||||||
|
/* Run a single TestCase in the context of this TestResult */
|
||||||
|
$this->_startTest($test);
|
||||||
|
$this->fRunTests++;
|
||||||
|
|
||||||
|
$test->runBare();
|
||||||
|
|
||||||
|
/* this is where JUnit would catch AssertionFailedError */
|
||||||
|
$exceptions = $test->getExceptions();
|
||||||
|
if ($exceptions)
|
||||||
|
$this->fFailures[] = new TestFailure(&$test, &$exceptions);
|
||||||
|
$this->_endTest($test);
|
||||||
|
}
|
||||||
|
|
||||||
|
function countTests() {
|
||||||
|
return $this->fRunTests;
|
||||||
|
}
|
||||||
|
|
||||||
|
function shouldStop() {
|
||||||
|
return $this->fStop;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _startTest($test) /* protected */ {
|
||||||
|
/* specialize this for start-of-test actions */
|
||||||
|
}
|
||||||
|
|
||||||
|
function stop() {
|
||||||
|
/* set indication that the test sequence should halt */
|
||||||
|
$fStop = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function countFailures() {
|
||||||
|
return count($this->fFailures);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class TextTestResult extends TestResult {
|
||||||
|
/* Specialize TestResult to produce text/html report */
|
||||||
|
function TextTestResult() {
|
||||||
|
$this->TestResult(); // call superclass constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
function report() {
|
||||||
|
/* report result of test run */
|
||||||
|
$nRun = $this->countTests();
|
||||||
|
$nFailures = $this->countFailures();
|
||||||
|
printf("<p>%s test%s run<br>", $nRun, ($nRun == 1) ? '' : 's');
|
||||||
|
printf("%s failure%s.<br>\n", $nFailures, ($nFailures == 1) ? '' : 's');
|
||||||
|
if ($nFailures == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
print("<ol>\n");
|
||||||
|
$failures = $this->getFailures();
|
||||||
|
while (list($i, $failure) = each($failures)) {
|
||||||
|
$failedTestName = $failure->getTestName();
|
||||||
|
printf("<li>%s\n", $failedTestName);
|
||||||
|
|
||||||
|
$exceptions = $failure->getExceptions();
|
||||||
|
print("<ul>");
|
||||||
|
while (list($na, $exception) = each($exceptions))
|
||||||
|
printf("<li>%s\n", $exception->getMessage());
|
||||||
|
print("</ul>");
|
||||||
|
}
|
||||||
|
print("</ol>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
function _startTest($test) {
|
||||||
|
printf("%s ", $test->name());
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
function _endTest($test) {
|
||||||
|
$outcome = $test->failed()
|
||||||
|
? "<font color=\"red\">FAIL</font>"
|
||||||
|
: "<font color=\"green\">ok</font>";
|
||||||
|
printf("$outcome<br>\n");
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class TestRunner {
|
||||||
|
/* Run a suite of tests and report results. */
|
||||||
|
function run($suite) {
|
||||||
|
$result = new TextTestResult;
|
||||||
|
$suite->run($result);
|
||||||
|
$result->report();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
1
Class/test/rocks.png
Normal file
1
Class/test/rocks.png
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
‰PNG
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
// Définition des paramètres de fermeture du serveur
|
// Définition des paramètres de fermeture du serveur
|
||||||
$fermerServeur_auth = 9;
|
$fermerServeur_auth = 9;
|
||||||
$fermerServeur_causeR = 1;
|
$fermerServeur_causeR = 0;
|
||||||
$fermerServeur_timeS = 1195643200;
|
$fermerServeur_timeS = 1200840191;
|
||||||
$duree = 20*60;
|
$duree = 5*60;
|
||||||
$fermerServeur_timeE = $fermerServeur_timeS + $duree;
|
$fermerServeur_timeE = $fermerServeur_timeS + $duree;
|
||||||
$fermerServeur_ouverture = ''; // ... jusqu'à environ %c heure de Paris. DEFINIR PLUTÔT LES TIMEE ET TIMES
|
$fermerServeur_ouverture = ''; // ... jusqu'à environ %c heure de Paris. DEFINIR PLUTÔT LES TIMEE ET TIMES
|
||||||
$fermerServeur_lien = '';
|
$fermerServeur_lien = '';
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,6 @@ function txtmission($mission){
|
||||||
elseif ($mission == 3) return 'Coloniser';
|
elseif ($mission == 3) return 'Coloniser';
|
||||||
elseif ($mission == 4) return 'Recycler';
|
elseif ($mission == 4) return 'Recycler';
|
||||||
elseif ($mission == 5) return 'Espionner';
|
elseif ($mission == 5) return 'Espionner';
|
||||||
elseif ($mission == 6) return 'Retour forcé';
|
|
||||||
else return 'Erreur';
|
else return 'Erreur';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
30
header.php
30
header.php
|
|
@ -1,30 +0,0 @@
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title><?php
|
|
||||||
if (defined('TITLE')) echo TITLE;
|
|
||||||
else print 'Halo Battle';
|
|
||||||
?></title>
|
|
||||||
<meta http-equiv="Content-Language" content="fr">
|
|
||||||
<meta http-equiv="Content-Script-Type" content="text/javascript">
|
|
||||||
<meta name="Description" lang="fr" content="Jeu en php de simulation de guerre spatiale">
|
|
||||||
<meta name="Abstract" content="Jeu en php de simulation de guerre spatiale">
|
|
||||||
<meta name="Category" content="Jeu php">
|
|
||||||
<meta name="Date-Creation-yyyymmdd" content="20070621">
|
|
||||||
<meta name="Author" content="Halo Battle">
|
|
||||||
<meta name="Distribution" content="Global">
|
|
||||||
<meta name="Rating" content="General">
|
|
||||||
<meta name="Robots" content="noindex, follow">
|
|
||||||
<meta name="Revisit-After" content="10 days">
|
|
||||||
<meta http-equiv="Cache-Control" content="no-cache">
|
|
||||||
<meta http-equiv="Pragma" content="no-cache">
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
|
|
||||||
<?php
|
|
||||||
if (defined('DESIGN')) echo '<link rel="stylesheet" media="screen" type="text/css" href="'.DESIGN.'">';
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
if (defined('HEAD')) echo HEAD;
|
|
||||||
?>
|
|
||||||
</head>
|
|
||||||
13
info.php
13
info.php
|
|
@ -1,13 +0,0 @@
|
||||||
<?php
|
|
||||||
exit;
|
|
||||||
require('connectBDD.php');
|
|
||||||
|
|
||||||
for ($i=1 ; $i < 125 ; $i++) {
|
|
||||||
$req = mysql_query("SELECT temps_b, bat FROM planete WHERE `id` = '$i'");
|
|
||||||
$resultat = mysql_fetch_array($req);
|
|
||||||
if ($resultat['temps_b'] != '') {
|
|
||||||
$res = $resultat['temps_b'];
|
|
||||||
mysql_query("UPDATE `halobattle`.`planete` SET `temps_b` = '$res 1' WHERE `planete`.`id` = $i LIMIT 1 ;");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
@ -1,260 +0,0 @@
|
||||||
<?php
|
|
||||||
if (!isset($race)) $race = $_SESSION['race'];
|
|
||||||
if (!isset($auth_level)) $auth_level = $_SESSION['auth_level'];
|
|
||||||
//require_once('flotte_dep.php');
|
|
||||||
|
|
||||||
if ($race == 'covenant') {
|
|
||||||
$ressourc = array('Métal','Cristal','Ions','Energie');
|
|
||||||
$casernen = array('Grunt','Jackal','Drone','Elite','Sniper','Hunter','Médecin','Ingénieur','Brute');
|
|
||||||
$casernde = array( 'Formant l\'unité d\'infanterie de base des Covenants, les Grunt se révèlent dangereux en groupe, mais ne représentent individuellement qu\'une faible menace. Petits, trapus et relativement lents, ils paniquent souvent lorsqu\'ils affrontent des ennemis qui leurs sont supérieurs ; cependant, s\'ils sont menés par un Sangheili, ils se battront jusqu\'au bout.',
|
|
||||||
'Tireurs efficaces, les jackals sont généralement employés comme mercenaires, on les trouve souvent en positions défensives, se battant protégés par les boucliers à énergie qui les caractérisent. Un bouclier bien utilisé fait d\'un Jackal une cible difficile à atteindre, mais celui-ci doit l\'écarter pour faire feu, ce qui lui confère un point faible exploitable.',
|
|
||||||
'Tout comme les Brutes, les Drones semblent avoir été intégrés depuis peu aux forces d\'assaut covenantes et sont déployés en masse. Apparemment d\'origine insectoïde, ce sont les gardes des vaisseaux covenants. Ils ont également la capacité - limitée - de voler et font d\'excellents tireurs, très intelligents.',
|
|
||||||
'Les Elites constituent l\'ossature des armées covenantes. Excellents soldats, tacticiens émérites et disciplinés, combattants agressifs, ils représentent la principale force des covenants. Plus rapides, plus forts et plus résistants que les humains, ils combattent en groupes restreints et dirigent souvent des escouades de Grunts. La couleur de leur armure indique leur rang.',
|
|
||||||
'Le sniper est une classe des jackals. Excellents tireurs de nature, les Jackals qui se sont spécialisés dans ce domaine bénéficient d\'un rang plus élevé que leurs congénères. Ils sont très destructeurs de loin mais assez peu de près. Ils ne possèdent cependant pas de bouclier de protection comme leurs frères.',
|
|
||||||
'Les Hunters sont des ennemis incroyablement dangereux qui sont déployés plus comme du matériel que comme des soldats. Ils sont utilisés pour des tâches de démolitions ou de défense lourde et se battent toujours par deux. Ces créatures massives portent une armure quasiment impénétrable et une arme à combustible redoutable au combat.',
|
|
||||||
'Les médecins sont sur le champ de bataille pour aider les soldats blessés par des tirs lors des affrontements. Ils peuvent réduire le nombre de morts lorsqu\'ils sont bien utilisés, et donc peuvent peut être changer l’issue de la bataille.',
|
|
||||||
'Les ingénieurs, appelés Huragok en langage covenant, forment la seule unité non-combattante connue des forces covenantes. Celle-ci répare vos unités et véhicules sur le champ de bataille ; plus vous en recrutez, plus vos unités et véhicules au sol auront une chance de survivre.',
|
|
||||||
'Moins bien connus que les Elites, les Brutes combattent en groupes et sont physiquement plus forts que leurs congénères. Les Brutes démontrent les mêmes aptitudes au combat que les Elites et leur nombre s\'est considérablement accru depuis le début du conflit. Ils portent une arme balistique explosive à laquelle est fixée une baïonnette.');
|
|
||||||
$casernea = array('grunt(s)','jackal(s)','drone(s)','élite(s)','sniper(s)','hunter(s)','médecin(s)','ingénieur(s)','brute(s)');
|
|
||||||
$casernei = array('grunt1.jpg','jackal.jpg','drone.jpg','elite.jpg','jackalsniper.jpg','hunter1.jpg','medecin_c.jpg','ingenieur_c.jpg','brute.jpg');
|
|
||||||
$batimend = array('purificateur_m','purificateur_c','ionisateur','centrale_s','centrale_fusion','oeil','recherches','chantier_terrestre','???','caserne','silo','centre_info');
|
|
||||||
$batimeni = array('purificateurdemtalhb3.jpg','cristaloo3.png','ioniseurdn4.jpg','solaire.jpg','sanstitrevi7.jpg','oeilduprophetewj6.jpg','covielabocn5.jpg','chantierterrestrehg1.jpg','sanstitretruecolor09zn6.jpg','caserncov0ry.jpg','stockagebasement1cs10bl.jpg','ordianteur_hologramme.jpg');
|
|
||||||
$batiment = array('Purificateur de métal','Purificateur de cristal','Ionisateur','Centrale solaire','Centrale de fusion','Oeil des prophètes','Centre de recherches','Chantier terrestre','Chantier spatial','Caserne','Entrepôt','Centrale informatique');
|
|
||||||
$batimede = array( 'Le purificateur de métal vous fournie les matières premières pour la construction de vos infrastructures et de vos unités. Plus vous développerez vos purificateurs, plus ils produiront de ressources. Les purificateurs les plus développés ont aussi besoin de plus d\'énergie.',
|
|
||||||
'Le purificateur de cristal vous fournie les ressources pour vos installations électroniques et pour les alliages. Le purificateur de cristal consomme deux fois plus d\'énergie que celui de métal. Tous les vaisseaux et bâtiments ont besoin de cristal pour leur bouclier ou encore leurs composants électroniques. La production augmente avec le développement de l’usine.',
|
|
||||||
'L\'ionisateur utilise des ions négatifs et positifs d\'hydrogène pour créer une source conventionnelle de courant stable, servant à alimenter les bâtiments covenants qui nécessitent une arrivée massive de cette "ressource" pour actionner les divers éléments matériels des contrôles. La centrale de fusion à besoin de beaucoup d\'hydrogène pour fonctionner.',
|
|
||||||
'Pour assurer l\'approvisionnement des purificateurs, des centrales solaires sont nécessaires. Plus ces installations sont développées, plus vous obtiendrez d’énergie pour vos purificateurs. Les centrales solaires sont la base de l\'approvisionnement pour votre planète en énergie. Elles sont composées d’un recueilleur sur le haut de sa structure qui capte en grandes quantités l’énergie solaire.',
|
|
||||||
'La centrale à fusion vous permet de créer l’énergie nécessaire à vos purificateurs. Elles est constitué d’un réacteur à fusion qui en tournant produit de l’énergie. Sa production reste nettement inférieure à celle d’une centrale solaire.',
|
|
||||||
'Les grands prophètes ont partagé leur savoir pour construire ces structures qui permettent de repérer les éléments s’approchants de votre planète. Le système est constitué de deux grands arcs qui envoient des signaux électriques dans l’espace et captent ceux qui reviennent présageant ainsi l’arrivée d’un vaisseau.',
|
|
||||||
'Le centre de recherches, l\'un des bâtiments les plus importants de votre colonie, vous permet de vous accaparer des technologies aliens aujourd’hui disparues ou des technologies en cours de développement dans d’autres factions. Le niveau du centre détermine la vitesse de la recherche. Chaque planète que vous coloniserez devra être équipée d’un centre d\'étude des artefacts et des technologies.',
|
|
||||||
'Le chantier terrestre vous permet de construire tous les véhicules atmosphériques du type ghosts, spectres ou autres. Il permet ainsi à vos armées d’accéder plus rapidement à un endroit et d’avoir un avantage avec l’armement de ces véhicules.',
|
|
||||||
'Ce bâtiment permet la création de toutes vos unités spatiales ou volantes. La force des covenants a souvent été due à ses grandes avancées technologiques en matière d’aéronautique. Un grand chantier spatial permet de créer des unités de plus en plus fortes et de surcroît de les créer de plus en plus rapidement.',
|
|
||||||
'Le Temple de la Guerre vous permet de créer l’élite des forces d’infanterie. Des soldats y sont fanatisés puis entraînés au maniement des armes et à la stratégie militaire. Plus vous développez le temple, plus la vitesse de production sera rapide.',
|
|
||||||
'Les ressources qui ne sont pas encore traitées sont mises en stock dans ces entrepôts géants. Un entrepôt plus grand permet le stockage d\'une plus grande quantité de ressources. Lorsque l’entrepôt est plein, l\'extraction est stoppée. Il est grandement conseillé de développer ce genre d’infrastructure.',
|
|
||||||
'La centrale informatique est le coeur de votre planète, le cerveau de votre territoire, analysant chaque particule détectée avec grand soin. Plus votre centrale est améliorée, plus rapidement et aisément les données seront traitées.');
|
|
||||||
$technolo = array('Informatique','Detection','Armement','Bouclier','Maitrise de l\'énergie','Réacteur à antigravité','Réacteur à fusion','Réacteur à fusion Forerunner','Médecine','Commandement militaire',0);
|
|
||||||
$technode = array( 'L’informatique vous permet de traiter les informations de façon très rapide réduisant ainsi les temps de réactions qui dans les combats peuvent s’avérer fatales.',
|
|
||||||
'La détection est cruciale pour préserver sa flotte et ses planètes. Développer cette technologie vous permet de construire une base « œil des prophètes » qui repèrera les vaisseaux s’approchant de votre planète.',
|
|
||||||
'Un soldat n\'est rien sans son arme, et qu\'est-ce qu\'un soldat démuni face aux assauts féroces adverses ? Cette technologie vous permettra de rechercher de nouveaux systèmes d\'armements afin de rendre vos outils de guerre plus précis et mortels.',
|
|
||||||
'Le bouclier est un champ de force qui entoure vos vaisseaux et les protège. Ainsi il permet à vos vaisseaux de tenir plus longtemps face aux missiles adverses, ceci s\'avérant peut être décisif dans l’issue de la bataille.',
|
|
||||||
'L\'énergie est la base de tout. Sans énergie, pas de voyages stellaires ni même de quoi faire marcher vos installations. C\'est pourquoi l\'étude de nouvelles façons de produire de l\'énergie est vitale pour vos planètes et vaisseaux ; vos chercheurs vous permettront également d\'accéder à de nouveaux types d\'énergies, beaucoup plus intéressants.',
|
|
||||||
'Les réacteurs à antigravité sont les moteurs basiques covenant. Ils utilisent une technologie complexe projetant des particules quantiques créant un champ gravitationnel inverse annulant ainsi la gravité présente. Le principe fonctionne également dans l\'espace puisque l\'absence de gravité dans l\'espace, sans compter les étoiles et les autres anomalies spatiales, permet une projection plus puissante du champ.',
|
|
||||||
'Après la combustion, voici la fusion. Ce type de réacteur est beaucoup plus puissant que la combustion utilisée depuis déjà des centaines d\'années. Il génère une énergie cinétique de grande envergure. Aucun dirigeant politique désirant voyager dans le cosmos ne pourrait s’en passer.',
|
|
||||||
'Les covenants ont découvert d’anciens réacteurs à fusion utilisant la technologie d’hyperpropulsion Forerunner. Cette technologie, beaucoup plus puissante que le réacteur conventionnel au Plasma, autorise des sauts dans le sous-espace ultra précis. Ce type de réacteur est le plus cher mais aussi le plus rapide et puissant de toute la flotte covenante.',
|
|
||||||
'La médecine vous permet d’avoir moins de pertes au combat et ainsi d’avoir une force de frappe qui résiste plus longtemps. Au lieu de laisser mourir les soldats blessés, le médecin les soigne pour les remettre sur pied et les rendre de nouveau aptes au combat.',
|
|
||||||
'En tant que général, vous devez avoir un esprit fin pour gagner vos batailles terrestres aussi bien que les affrontements spatiaux. C\'est pourquoi il vous faudra toujours innover en matière de stratégie, vous montrer toujours plus rusé que votre impitoyable adversaire, aussi feriez-vous bien d\'étudier de nouvelles tactiques de combat pour vous assurer une franche victoire.');
|
|
||||||
$technoli = array('informatique1.jpg','detection.jpg','sanstitretruecolor04no6.jpg','boucliervaiseaucovenantey4.jpg','energie.jpg','reacteurantigravyd1.jpg','reacteur_f.jpg','reacteurfusionforerunnewu0.jpg','medecine.JPG','commandement.jpg');
|
|
||||||
$nomvaisa = array('cargos de classe Inquisitor','grand(s) transporteur(s)','vaisseau(x) de colonisation','sonde(s)','recycleur(s)','séraphin(s)','frégate(s)','croiseur(s) de classe CCS','croiseur(s) de classe Reverence','porte-vaisseaux','station(s) orbitale','super(s) porte-vaisseaux');
|
|
||||||
$nomvaisi = array('cargosparabola.jpg','cargosladen.jpg','coviecolobv3.jpg','sonde_despionnage1.jpg','charognard.jpg','chasseurlourd7id.jpg','croiseur8er.jpg','fregate2ky.jpg','croiseur.jpg','pv.jpg','citecovenant.jpg','.jpg');
|
|
||||||
$nomvaisn = array('Cargos de classe Inquisitor','Cargos de classe Interdictor','Vaisseau de colonisation de classe Returning','Sonde de reconnaissance de classe Perception','Charognard','Séraphin','Frégate','Croiseur de classe CCS','Croiseur de classe Reverence','Porte vaisseaux','Station orbitale covenant','Super porte vaisseaux');
|
|
||||||
$nomvaisd = array( 'Les cargos Inquisitor sont la base du transport de troupes et de ressources covenantes, capables de transporter un grand nombre de ressources sur une grande distance. Pratiquement sans armement, le cargo est sans défense et nécessite une défense rapprochée pour les trajets de grande distance.',
|
|
||||||
'Les cargos Interdictor sont une évolution du transport de classe Inquisitor. Ayant une capacité de transport nettement supérieure à sa version précédente. Ce transport, quoique plus récent et disposant d\'un plus grand fret, dispose du même genre de défense que le modèle antérieur, une escorte est donc fortement recommandée lors de l\'utilisation de celui-ci.',
|
|
||||||
'Tout comme les humains, les covenants ont besoins d\'espace pour étendre leur empire et c\'est pourquoi ces vaisseaux ont été pensés et conçus. Capable de transfor | |||||||