Add php files

This commit is contained in:
2025-05-12 15:44:39 +00:00
parent c951760058
commit 82d5804ac4
9534 changed files with 2638137 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
<?php
require_once 'vendor/autoload.php';
spl_autoload_register(function ($class) {
require_once strtr($class, '\\_', '//').'.php';
});

View File

@@ -0,0 +1,76 @@
<?php
/**
* PHPMailer - language file tests
* Requires PHPUnit 3.3 or later.
*
* PHP version 5.0.0
*
* @package PHPMailer
* @author Andy Prevost
* @author Marcus Bointon <phpmailer@synchromedia.co.uk>
* @copyright 2004 - 2009 Andy Prevost
* @copyright 2010 Marcus Bointon
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
require_once '../PHPMailerAutoload.php';
/**
* PHPMailer - PHP email transport unit test class
* Performs authentication tests
*/
class PHPMailerLangTest extends PHPUnit_Framework_TestCase
{
/**
* Holds a phpmailer instance.
* @private
* @var PHPMailer
*/
public $Mail;
/**
* @var string Default include path
*/
public $INCLUDE_DIR = '../';
/**
* Run before each test is started.
*/
public function setUp()
{
$this->Mail = new PHPMailer;
}
/**
* Test language files for missing and excess translations
* All languages are compared with English
* @group languages
*/
public function testTranslations()
{
$this->Mail->setLanguage('en');
$definedStrings = $this->Mail->getTranslations();
$err = '';
foreach (new DirectoryIterator('../language') as $fileInfo) {
if ($fileInfo->isDot()) {
continue;
}
$matches = array();
//Only look at language files, ignore anything else in there
if (preg_match('/^phpmailer\.lang-([a-z_]{2,})\.php$/', $fileInfo->getFilename(), $matches)) {
$lang = $matches[1]; //Extract language code
$PHPMAILER_LANG = array(); //Language strings get put in here
include $fileInfo->getPathname(); //Get language strings
$missing = array_diff(array_keys($definedStrings), array_keys($PHPMAILER_LANG));
$extra = array_diff(array_keys($PHPMAILER_LANG), array_keys($definedStrings));
if (!empty($missing)) {
$err .= "\nMissing translations in $lang: " . implode(', ', $missing);
}
if (!empty($extra)) {
$err .= "\nExtra translations in $lang: " . implode(', ', $extra);
}
}
}
$this->assertEmpty($err, $err);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,81 @@
<html>
<head>
<title>PHPMailer Lite - DKIM and Callback Function test</title>
</head>
<body>
<?php
/* This is a sample callback function for PHPMailer Lite.
* This callback function will echo the results of PHPMailer processing.
*/
/* Callback (action) function
* boolean $result result of the send action
* string $to email address of the recipient
* string $cc cc email addresses
* string $bcc bcc email addresses
* string $subject the subject
* string $body the email body
* @return boolean
*/
function callbackAction($result, $to, $cc, $bcc, $subject, $body)
{
/*
this callback example echos the results to the screen - implement to
post to databases, build CSV log files, etc., with minor changes
*/
$to = cleanEmails($to, 'to');
$cc = cleanEmails($cc[0], 'cc');
$bcc = cleanEmails($bcc[0], 'cc');
echo $result . "\tTo: " . $to['Name'] . "\tTo: " . $to['Email'] . "\tCc: " . $cc['Name'] .
"\tCc: " . $cc['Email'] . "\tBcc: " . $bcc['Name'] . "\tBcc: " . $bcc['Email'] .
"\t" . $subject . "\n\n". $body . "\n";
return true;
}
require_once '../class.phpmailer.php';
$mail = new PHPMailer();
try {
$mail->isMail();
$mail->setFrom('you@example.com', 'Your Name');
$mail->addAddress('another@example.com', 'John Doe');
$mail->Subject = 'PHPMailer Test Subject';
$mail->msgHTML(file_get_contents('../examples/contents.html'));
// optional - msgHTML will create an alternate automatically
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
$mail->addAttachment('../examples/images/phpmailer.png'); // attachment
$mail->addAttachment('../examples/images/phpmailer_mini.png'); // attachment
$mail->action_function = 'callbackAction';
$mail->send();
echo "Message Sent OK</p>\n";
} catch (phpmailerException $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}
function cleanEmails($str, $type)
{
if ($type == 'cc') {
$addy['Email'] = $str[0];
$addy['Name'] = $str[1];
return $addy;
}
if (!strstr($str, ' <')) {
$addy['Name'] = '';
$addy['Email'] = $addy;
return $addy;
}
$addyArr = explode(' <', $str);
if (substr($addyArr[1], -1) == '>') {
$addyArr[1] = substr($addyArr[1], 0, -1);
}
$addy['Name'] = $addyArr[0];
$addy['Email'] = $addyArr[1];
$addy['Email'] = str_replace('@', '&#64;', $addy['Email']);
return $addy;
}
?>
</body>
</html>

View File

@@ -0,0 +1,7 @@
<?php
$_REQUEST['submitted'] = 1;
$_REQUEST['mail_to'] = 'somebody@example.com';
$_REQUEST['mail_from'] = 'phpunit@example.com';
$_REQUEST['mail_cc'] = 'cc@example.com';
$_REQUEST['mail_host'] = 'localhost';
$_REQUEST['mail_port'] = 2500;