diff --git a/admin/orders.php b/admin/orders.php index fb89d6e..a16ef02 100644 --- a/admin/orders.php +++ b/admin/orders.php @@ -7,15 +7,19 @@ $q = mysqli_query($conn, "UPDATE orders SET traking = '".$_POST['update_traking']."', status = 'SHIPPED' WHERE id = ".$_POST['id']); } + if(isset($_POST['update_status'])) { + $q = mysqli_query($conn, "UPDATE orders SET status = '".$_POST['update_status']."' + WHERE id = ".$_POST['id']); + } ?>

+
+ |
+
and must not be empty
+ * will look for an image file in $basedir/images/a.png and convert it to inline.
+ * If you don't provide a $basedir, relative paths will be left untouched (and thus probably break in email)
+ * Converts data-uri images into embedded attachments.
+ * If you don't want to apply these transformations to your HTML, just set Body and AltBody directly.
+ *
+ * @param string $message HTML message string
+ * @param string $basedir Absolute path to a base directory to prepend to relative paths to images
+ * @param bool|callable $advanced Whether to use the internal HTML to text converter
+ * or your own custom converter
+ * @return string The transformed message body
+ *
+ * @throws Exception
+ *
+ * @see PHPMailer::html2text()
+ */
+ public function msgHTML($message, $basedir = '', $advanced = false)
+ {
+ preg_match_all('/(? 1 && '/' !== substr($basedir, -1)) {
+ // Ensure $basedir has a trailing /
+ $basedir .= '/';
+ }
+ foreach ($images[2] as $imgindex => $url) {
+ // Convert data URIs into embedded images
+ //e.g. "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
+ $match = [];
+ if (preg_match('#^data:(image/(?:jpe?g|gif|png));?(base64)?,(.+)#', $url, $match)) {
+ if (count($match) === 4 && static::ENCODING_BASE64 === $match[2]) {
+ $data = base64_decode($match[3]);
+ } elseif ('' === $match[2]) {
+ $data = rawurldecode($match[3]);
+ } else {
+ //Not recognised so leave it alone
+ continue;
+ }
+ //Hash the decoded data, not the URL, so that the same data-URI image used in multiple places
+ //will only be embedded once, even if it used a different encoding
+ $cid = substr(hash('sha256', $data), 0, 32) . '@phpmailer.0'; // RFC2392 S 2
+
+ if (!$this->cidExists($cid)) {
+ $this->addStringEmbeddedImage(
+ $data,
+ $cid,
+ 'embed' . $imgindex,
+ static::ENCODING_BASE64,
+ $match[1]
+ );
+ }
+ $message = str_replace(
+ $images[0][$imgindex],
+ $images[1][$imgindex] . '="cid:' . $cid . '"',
+ $message
+ );
+ continue;
+ }
+ if (
+ // Only process relative URLs if a basedir is provided (i.e. no absolute local paths)
+ !empty($basedir)
+ // Ignore URLs containing parent dir traversal (..)
+ && (strpos($url, '..') === false)
+ // Do not change urls that are already inline images
+ && 0 !== strpos($url, 'cid:')
+ // Do not change absolute URLs, including anonymous protocol
+ && !preg_match('#^[a-z][a-z0-9+.-]*:?//#i', $url)
+ ) {
+ $filename = static::mb_pathinfo($url, PATHINFO_BASENAME);
+ $directory = dirname($url);
+ if ('.' === $directory) {
+ $directory = '';
+ }
+ // RFC2392 S 2
+ $cid = substr(hash('sha256', $url), 0, 32) . '@phpmailer.0';
+ if (strlen($basedir) > 1 && '/' !== substr($basedir, -1)) {
+ $basedir .= '/';
+ }
+ if (strlen($directory) > 1 && '/' !== substr($directory, -1)) {
+ $directory .= '/';
+ }
+ if (
+ $this->addEmbeddedImage(
+ $basedir . $directory . $filename,
+ $cid,
+ $filename,
+ static::ENCODING_BASE64,
+ static::_mime_types((string) static::mb_pathinfo($filename, PATHINFO_EXTENSION))
+ )
+ ) {
+ $message = preg_replace(
+ '/' . $images[1][$imgindex] . '=["\']' . preg_quote($url, '/') . '["\']/Ui',
+ $images[1][$imgindex] . '="cid:' . $cid . '"',
+ $message
+ );
+ }
+ }
+ }
+ }
+ $this->isHTML();
+ // Convert all message body line breaks to LE, makes quoted-printable encoding work much better
+ $this->Body = static::normalizeBreaks($message);
+ $this->AltBody = static::normalizeBreaks($this->html2text($message, $advanced));
+ if (!$this->alternativeExists()) {
+ $this->AltBody = 'This is an HTML-only message. To view it, activate HTML in your email application.'
+ . static::$LE;
+ }
+
+ return $this->Body;
+ }
+
+ /**
+ * Convert an HTML string into plain text.
+ * This is used by msgHTML().
+ * Note - older versions of this function used a bundled advanced converter
+ * which was removed for license reasons in #232.
+ * Example usage:
+ *
+ * ```php
+ * // Use default conversion
+ * $plain = $mail->html2text($html);
+ * // Use your own custom converter
+ * $plain = $mail->html2text($html, function($html) {
+ * $converter = new MyHtml2text($html);
+ * return $converter->get_text();
+ * });
+ * ```
+ *
+ * @param string $html The HTML text to convert
+ * @param bool|callable $advanced Any boolean value to use the internal converter,
+ * or provide your own callable for custom conversion
+ *
+ * @return string
+ */
+ public function html2text($html, $advanced = false)
+ {
+ if (is_callable($advanced)) {
+ return call_user_func($advanced, $html);
+ }
+
+ return html_entity_decode(
+ trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/si', '', $html))),
+ ENT_QUOTES,
+ $this->CharSet
+ );
+ }
+
+ /**
+ * Get the MIME type for a file extension.
+ *
+ * @param string $ext File extension
+ *
+ * @return string MIME type of file
+ */
+ public static function _mime_types($ext = '')
+ {
+ $mimes = [
+ 'xl' => 'application/excel',
+ 'js' => 'application/javascript',
+ 'hqx' => 'application/mac-binhex40',
+ 'cpt' => 'application/mac-compactpro',
+ 'bin' => 'application/macbinary',
+ 'doc' => 'application/msword',
+ 'word' => 'application/msword',
+ 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
+ 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
+ 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template',
+ 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
+ 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
+ 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide',
+ 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
+ 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
+ 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12',
+ 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
+ 'class' => 'application/octet-stream',
+ 'dll' => 'application/octet-stream',
+ 'dms' => 'application/octet-stream',
+ 'exe' => 'application/octet-stream',
+ 'lha' => 'application/octet-stream',
+ 'lzh' => 'application/octet-stream',
+ 'psd' => 'application/octet-stream',
+ 'sea' => 'application/octet-stream',
+ 'so' => 'application/octet-stream',
+ 'oda' => 'application/oda',
+ 'pdf' => 'application/pdf',
+ 'ai' => 'application/postscript',
+ 'eps' => 'application/postscript',
+ 'ps' => 'application/postscript',
+ 'smi' => 'application/smil',
+ 'smil' => 'application/smil',
+ 'mif' => 'application/vnd.mif',
+ 'xls' => 'application/vnd.ms-excel',
+ 'ppt' => 'application/vnd.ms-powerpoint',
+ 'wbxml' => 'application/vnd.wap.wbxml',
+ 'wmlc' => 'application/vnd.wap.wmlc',
+ 'dcr' => 'application/x-director',
+ 'dir' => 'application/x-director',
+ 'dxr' => 'application/x-director',
+ 'dvi' => 'application/x-dvi',
+ 'gtar' => 'application/x-gtar',
+ 'php3' => 'application/x-httpd-php',
+ 'php4' => 'application/x-httpd-php',
+ 'php' => 'application/x-httpd-php',
+ 'phtml' => 'application/x-httpd-php',
+ 'phps' => 'application/x-httpd-php-source',
+ 'swf' => 'application/x-shockwave-flash',
+ 'sit' => 'application/x-stuffit',
+ 'tar' => 'application/x-tar',
+ 'tgz' => 'application/x-tar',
+ 'xht' => 'application/xhtml+xml',
+ 'xhtml' => 'application/xhtml+xml',
+ 'zip' => 'application/zip',
+ 'mid' => 'audio/midi',
+ 'midi' => 'audio/midi',
+ 'mp2' => 'audio/mpeg',
+ 'mp3' => 'audio/mpeg',
+ 'm4a' => 'audio/mp4',
+ 'mpga' => 'audio/mpeg',
+ 'aif' => 'audio/x-aiff',
+ 'aifc' => 'audio/x-aiff',
+ 'aiff' => 'audio/x-aiff',
+ 'ram' => 'audio/x-pn-realaudio',
+ 'rm' => 'audio/x-pn-realaudio',
+ 'rpm' => 'audio/x-pn-realaudio-plugin',
+ 'ra' => 'audio/x-realaudio',
+ 'wav' => 'audio/x-wav',
+ 'mka' => 'audio/x-matroska',
+ 'bmp' => 'image/bmp',
+ 'gif' => 'image/gif',
+ 'jpeg' => 'image/jpeg',
+ 'jpe' => 'image/jpeg',
+ 'jpg' => 'image/jpeg',
+ 'png' => 'image/png',
+ 'tiff' => 'image/tiff',
+ 'tif' => 'image/tiff',
+ 'webp' => 'image/webp',
+ 'avif' => 'image/avif',
+ 'heif' => 'image/heif',
+ 'heifs' => 'image/heif-sequence',
+ 'heic' => 'image/heic',
+ 'heics' => 'image/heic-sequence',
+ 'eml' => 'message/rfc822',
+ 'css' => 'text/css',
+ 'html' => 'text/html',
+ 'htm' => 'text/html',
+ 'shtml' => 'text/html',
+ 'log' => 'text/plain',
+ 'text' => 'text/plain',
+ 'txt' => 'text/plain',
+ 'rtx' => 'text/richtext',
+ 'rtf' => 'text/rtf',
+ 'vcf' => 'text/vcard',
+ 'vcard' => 'text/vcard',
+ 'ics' => 'text/calendar',
+ 'xml' => 'text/xml',
+ 'xsl' => 'text/xml',
+ 'wmv' => 'video/x-ms-wmv',
+ 'mpeg' => 'video/mpeg',
+ 'mpe' => 'video/mpeg',
+ 'mpg' => 'video/mpeg',
+ 'mp4' => 'video/mp4',
+ 'm4v' => 'video/mp4',
+ 'mov' => 'video/quicktime',
+ 'qt' => 'video/quicktime',
+ 'rv' => 'video/vnd.rn-realvideo',
+ 'avi' => 'video/x-msvideo',
+ 'movie' => 'video/x-sgi-movie',
+ 'webm' => 'video/webm',
+ 'mkv' => 'video/x-matroska',
+ ];
+ $ext = strtolower($ext);
+ if (array_key_exists($ext, $mimes)) {
+ return $mimes[$ext];
+ }
+
+ return 'application/octet-stream';
+ }
+
+ /**
+ * Map a file name to a MIME type.
+ * Defaults to 'application/octet-stream', i.e.. arbitrary binary data.
+ *
+ * @param string $filename A file name or full path, does not need to exist as a file
+ *
+ * @return string
+ */
+ public static function filenameToType($filename)
+ {
+ // In case the path is a URL, strip any query string before getting extension
+ $qpos = strpos($filename, '?');
+ if (false !== $qpos) {
+ $filename = substr($filename, 0, $qpos);
+ }
+ $ext = static::mb_pathinfo($filename, PATHINFO_EXTENSION);
+
+ return static::_mime_types($ext);
+ }
+
+ /**
+ * Multi-byte-safe pathinfo replacement.
+ * Drop-in replacement for pathinfo(), but multibyte- and cross-platform-safe.
+ *
+ * @see http://www.php.net/manual/en/function.pathinfo.php#107461
+ *
+ * @param string $path A filename or path, does not need to exist as a file
+ * @param int|string $options Either a PATHINFO_* constant,
+ * or a string name to return only the specified piece
+ *
+ * @return string|array
+ */
+ public static function mb_pathinfo($path, $options = null)
+ {
+ $ret = ['dirname' => '', 'basename' => '', 'extension' => '', 'filename' => ''];
+ $pathinfo = [];
+ if (preg_match('#^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^.\\\\/]+?)|))[\\\\/.]*$#m', $path, $pathinfo)) {
+ if (array_key_exists(1, $pathinfo)) {
+ $ret['dirname'] = $pathinfo[1];
+ }
+ if (array_key_exists(2, $pathinfo)) {
+ $ret['basename'] = $pathinfo[2];
+ }
+ if (array_key_exists(5, $pathinfo)) {
+ $ret['extension'] = $pathinfo[5];
+ }
+ if (array_key_exists(3, $pathinfo)) {
+ $ret['filename'] = $pathinfo[3];
+ }
+ }
+ switch ($options) {
+ case PATHINFO_DIRNAME:
+ case 'dirname':
+ return $ret['dirname'];
+ case PATHINFO_BASENAME:
+ case 'basename':
+ return $ret['basename'];
+ case PATHINFO_EXTENSION:
+ case 'extension':
+ return $ret['extension'];
+ case PATHINFO_FILENAME:
+ case 'filename':
+ return $ret['filename'];
+ default:
+ return $ret;
+ }
+ }
+
+ /**
+ * Set or reset instance properties.
+ * You should avoid this function - it's more verbose, less efficient, more error-prone and
+ * harder to debug than setting properties directly.
+ * Usage Example:
+ * `$mail->set('SMTPSecure', static::ENCRYPTION_STARTTLS);`
+ * is the same as:
+ * `$mail->SMTPSecure = static::ENCRYPTION_STARTTLS;`.
+ *
+ * @param string $name The property name to set
+ * @param mixed $value The value to set the property to
+ *
+ * @return bool
+ */
+ public function set($name, $value = '')
+ {
+ if (property_exists($this, $name)) {
+ $this->$name = $value;
+
+ return true;
+ }
+ $this->setError($this->lang('variable_set') . $name);
+
+ return false;
+ }
+
+ /**
+ * Strip newlines to prevent header injection.
+ *
+ * @param string $str
+ *
+ * @return string
+ */
+ public function secureHeader($str)
+ {
+ return trim(str_replace(["\r", "\n"], '', $str));
+ }
+
+ /**
+ * Normalize line breaks in a string.
+ * Converts UNIX LF, Mac CR and Windows CRLF line breaks into a single line break format.
+ * Defaults to CRLF (for message bodies) and preserves consecutive breaks.
+ *
+ * @param string $text
+ * @param string $breaktype What kind of line break to use; defaults to static::$LE
+ *
+ * @return string
+ */
+ public static function normalizeBreaks($text, $breaktype = null)
+ {
+ if (null === $breaktype) {
+ $breaktype = static::$LE;
+ }
+ // Normalise to \n
+ $text = str_replace([self::CRLF, "\r"], "\n", $text);
+ // Now convert LE as needed
+ if ("\n" !== $breaktype) {
+ $text = str_replace("\n", $breaktype, $text);
+ }
+
+ return $text;
+ }
+
+ /**
+ * Remove trailing breaks from a string.
+ *
+ * @param string $text
+ *
+ * @return string The text to remove breaks from
+ */
+ public static function stripTrailingWSP($text)
+ {
+ return rtrim($text, " \r\n\t");
+ }
+
+ /**
+ * Return the current line break format string.
+ *
+ * @return string
+ */
+ public static function getLE()
+ {
+ return static::$LE;
+ }
+
+ /**
+ * Set the line break format string, e.g. "\r\n".
+ *
+ * @param string $le
+ */
+ protected static function setLE($le)
+ {
+ static::$LE = $le;
+ }
+
+ /**
+ * Set the public and private key files and password for S/MIME signing.
+ *
+ * @param string $cert_filename
+ * @param string $key_filename
+ * @param string $key_pass Password for private key
+ * @param string $extracerts_filename Optional path to chain certificate
+ */
+ public function sign($cert_filename, $key_filename, $key_pass, $extracerts_filename = '')
+ {
+ $this->sign_cert_file = $cert_filename;
+ $this->sign_key_file = $key_filename;
+ $this->sign_key_pass = $key_pass;
+ $this->sign_extracerts_file = $extracerts_filename;
+ }
+
+ /**
+ * Quoted-Printable-encode a DKIM header.
+ *
+ * @param string $txt
+ *
+ * @return string
+ */
+ public function DKIM_QP($txt)
+ {
+ $line = '';
+ $len = strlen($txt);
+ for ($i = 0; $i < $len; ++$i) {
+ $ord = ord($txt[$i]);
+ if (((0x21 <= $ord) && ($ord <= 0x3A)) || $ord === 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E))) {
+ $line .= $txt[$i];
+ } else {
+ $line .= '=' . sprintf('%02X', $ord);
+ }
+ }
+
+ return $line;
+ }
+
+ /**
+ * Generate a DKIM signature.
+ *
+ * @param string $signHeader
+ *
+ * @throws Exception
+ *
+ * @return string The DKIM signature value
+ */
+ public function DKIM_Sign($signHeader)
+ {
+ if (!defined('PKCS7_TEXT')) {
+ if ($this->exceptions) {
+ throw new Exception($this->lang('extension_missing') . 'openssl');
+ }
+
+ return '';
+ }
+ $privKeyStr = !empty($this->DKIM_private_string) ?
+ $this->DKIM_private_string :
+ file_get_contents($this->DKIM_private);
+ if ('' !== $this->DKIM_passphrase) {
+ $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
+ } else {
+ $privKey = openssl_pkey_get_private($privKeyStr);
+ }
+ if (openssl_sign($signHeader, $signature, $privKey, 'sha256WithRSAEncryption')) {
+ if (PHP_MAJOR_VERSION < 8) {
+ openssl_pkey_free($privKey);
+ }
+
+ return base64_encode($signature);
+ }
+ if (PHP_MAJOR_VERSION < 8) {
+ openssl_pkey_free($privKey);
+ }
+
+ return '';
+ }
+
+ /**
+ * Generate a DKIM canonicalization header.
+ * Uses the 'relaxed' algorithm from RFC6376 section 3.4.2.
+ * Canonicalized headers should *always* use CRLF, regardless of mailer setting.
+ *
+ * @see https://tools.ietf.org/html/rfc6376#section-3.4.2
+ *
+ * @param string $signHeader Header
+ *
+ * @return string
+ */
+ public function DKIM_HeaderC($signHeader)
+ {
+ //Normalize breaks to CRLF (regardless of the mailer)
+ $signHeader = static::normalizeBreaks($signHeader, self::CRLF);
+ //Unfold header lines
+ //Note PCRE \s is too broad a definition of whitespace; RFC5322 defines it as `[ \t]`
+ //@see https://tools.ietf.org/html/rfc5322#section-2.2
+ //That means this may break if you do something daft like put vertical tabs in your headers.
+ $signHeader = preg_replace('/\r\n[ \t]+/', ' ', $signHeader);
+ //Break headers out into an array
+ $lines = explode(self::CRLF, $signHeader);
+ foreach ($lines as $key => $line) {
+ //If the header is missing a :, skip it as it's invalid
+ //This is likely to happen because the explode() above will also split
+ //on the trailing LE, leaving an empty line
+ if (strpos($line, ':') === false) {
+ continue;
+ }
+ list($heading, $value) = explode(':', $line, 2);
+ //Lower-case header name
+ $heading = strtolower($heading);
+ //Collapse white space within the value, also convert WSP to space
+ $value = preg_replace('/[ \t]+/', ' ', $value);
+ //RFC6376 is slightly unclear here - it says to delete space at the *end* of each value
+ //But then says to delete space before and after the colon.
+ //Net result is the same as trimming both ends of the value.
+ //By elimination, the same applies to the field name
+ $lines[$key] = trim($heading, " \t") . ':' . trim($value, " \t");
+ }
+
+ return implode(self::CRLF, $lines);
+ }
+
+ /**
+ * Generate a DKIM canonicalization body.
+ * Uses the 'simple' algorithm from RFC6376 section 3.4.3.
+ * Canonicalized bodies should *always* use CRLF, regardless of mailer setting.
+ *
+ * @see https://tools.ietf.org/html/rfc6376#section-3.4.3
+ *
+ * @param string $body Message Body
+ *
+ * @return string
+ */
+ public function DKIM_BodyC($body)
+ {
+ if (empty($body)) {
+ return self::CRLF;
+ }
+ // Normalize line endings to CRLF
+ $body = static::normalizeBreaks($body, self::CRLF);
+
+ //Reduce multiple trailing line breaks to a single one
+ return static::stripTrailingWSP($body) . self::CRLF;
+ }
+
+ /**
+ * Create the DKIM header and body in a new message header.
+ *
+ * @param string $headers_line Header lines
+ * @param string $subject Subject
+ * @param string $body Body
+ *
+ * @throws Exception
+ *
+ * @return string
+ */
+ public function DKIM_Add($headers_line, $subject, $body)
+ {
+ $DKIMsignatureType = 'rsa-sha256'; // Signature & hash algorithms
+ $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization methods of header & body
+ $DKIMquery = 'dns/txt'; // Query method
+ $DKIMtime = time();
+ //Always sign these headers without being asked
+ //Recommended list from https://tools.ietf.org/html/rfc6376#section-5.4.1
+ $autoSignHeaders = [
+ 'from',
+ 'to',
+ 'cc',
+ 'date',
+ 'subject',
+ 'reply-to',
+ 'message-id',
+ 'content-type',
+ 'mime-version',
+ 'x-mailer',
+ ];
+ if (stripos($headers_line, 'Subject') === false) {
+ $headers_line .= 'Subject: ' . $subject . static::$LE;
+ }
+ $headerLines = explode(static::$LE, $headers_line);
+ $currentHeaderLabel = '';
+ $currentHeaderValue = '';
+ $parsedHeaders = [];
+ $headerLineIndex = 0;
+ $headerLineCount = count($headerLines);
+ foreach ($headerLines as $headerLine) {
+ $matches = [];
+ if (preg_match('/^([^ \t]*?)(?::[ \t]*)(.*)$/', $headerLine, $matches)) {
+ if ($currentHeaderLabel !== '') {
+ //We were previously in another header; This is the start of a new header, so save the previous one
+ $parsedHeaders[] = ['label' => $currentHeaderLabel, 'value' => $currentHeaderValue];
+ }
+ $currentHeaderLabel = $matches[1];
+ $currentHeaderValue = $matches[2];
+ } elseif (preg_match('/^[ \t]+(.*)$/', $headerLine, $matches)) {
+ //This is a folded continuation of the current header, so unfold it
+ $currentHeaderValue .= ' ' . $matches[1];
+ }
+ ++$headerLineIndex;
+ if ($headerLineIndex >= $headerLineCount) {
+ //This was the last line, so finish off this header
+ $parsedHeaders[] = ['label' => $currentHeaderLabel, 'value' => $currentHeaderValue];
+ }
+ }
+ $copiedHeaders = [];
+ $headersToSignKeys = [];
+ $headersToSign = [];
+ foreach ($parsedHeaders as $header) {
+ //Is this header one that must be included in the DKIM signature?
+ if (in_array(strtolower($header['label']), $autoSignHeaders, true)) {
+ $headersToSignKeys[] = $header['label'];
+ $headersToSign[] = $header['label'] . ': ' . $header['value'];
+ if ($this->DKIM_copyHeaderFields) {
+ $copiedHeaders[] = $header['label'] . ':' . //Note no space after this, as per RFC
+ str_replace('|', '=7C', $this->DKIM_QP($header['value']));
+ }
+ continue;
+ }
+ //Is this an extra custom header we've been asked to sign?
+ if (in_array($header['label'], $this->DKIM_extraHeaders, true)) {
+ //Find its value in custom headers
+ foreach ($this->CustomHeader as $customHeader) {
+ if ($customHeader[0] === $header['label']) {
+ $headersToSignKeys[] = $header['label'];
+ $headersToSign[] = $header['label'] . ': ' . $header['value'];
+ if ($this->DKIM_copyHeaderFields) {
+ $copiedHeaders[] = $header['label'] . ':' . //Note no space after this, as per RFC
+ str_replace('|', '=7C', $this->DKIM_QP($header['value']));
+ }
+ //Skip straight to the next header
+ continue 2;
+ }
+ }
+ }
+ }
+ $copiedHeaderFields = '';
+ if ($this->DKIM_copyHeaderFields && count($copiedHeaders) > 0) {
+ //Assemble a DKIM 'z' tag
+ $copiedHeaderFields = ' z=';
+ $first = true;
+ foreach ($copiedHeaders as $copiedHeader) {
+ if (!$first) {
+ $copiedHeaderFields .= static::$LE . ' |';
+ }
+ //Fold long values
+ if (strlen($copiedHeader) > self::STD_LINE_LENGTH - 3) {
+ $copiedHeaderFields .= substr(
+ chunk_split($copiedHeader, self::STD_LINE_LENGTH - 3, static::$LE . self::FWS),
+ 0,
+ -strlen(static::$LE . self::FWS)
+ );
+ } else {
+ $copiedHeaderFields .= $copiedHeader;
+ }
+ $first = false;
+ }
+ $copiedHeaderFields .= ';' . static::$LE;
+ }
+ $headerKeys = ' h=' . implode(':', $headersToSignKeys) . ';' . static::$LE;
+ $headerValues = implode(static::$LE, $headersToSign);
+ $body = $this->DKIM_BodyC($body);
+ $DKIMb64 = base64_encode(pack('H*', hash('sha256', $body))); // Base64 of packed binary SHA-256 hash of body
+ $ident = '';
+ if ('' !== $this->DKIM_identity) {
+ $ident = ' i=' . $this->DKIM_identity . ';' . static::$LE;
+ }
+ //The DKIM-Signature header is included in the signature *except for* the value of the `b` tag
+ //which is appended after calculating the signature
+ //https://tools.ietf.org/html/rfc6376#section-3.5
+ $dkimSignatureHeader = 'DKIM-Signature: v=1;' .
+ ' d=' . $this->DKIM_domain . ';' .
+ ' s=' . $this->DKIM_selector . ';' . static::$LE .
+ ' a=' . $DKIMsignatureType . ';' .
+ ' q=' . $DKIMquery . ';' .
+ ' t=' . $DKIMtime . ';' .
+ ' c=' . $DKIMcanonicalization . ';' . static::$LE .
+ $headerKeys .
+ $ident .
+ $copiedHeaderFields .
+ ' bh=' . $DKIMb64 . ';' . static::$LE .
+ ' b=';
+ //Canonicalize the set of headers
+ $canonicalizedHeaders = $this->DKIM_HeaderC(
+ $headerValues . static::$LE . $dkimSignatureHeader
+ );
+ $signature = $this->DKIM_Sign($canonicalizedHeaders);
+ $signature = trim(chunk_split($signature, self::STD_LINE_LENGTH - 3, static::$LE . self::FWS));
+
+ return static::normalizeBreaks($dkimSignatureHeader . $signature);
+ }
+
+ /**
+ * Detect if a string contains a line longer than the maximum line length
+ * allowed by RFC 2822 section 2.1.1.
+ *
+ * @param string $str
+ *
+ * @return bool
+ */
+ public static function hasLineLongerThanMax($str)
+ {
+ return (bool) preg_match('/^(.{' . (self::MAX_LINE_LENGTH + strlen(static::$LE)) . ',})/m', $str);
+ }
+
+ /**
+ * If a string contains any "special" characters, double-quote the name,
+ * and escape any double quotes with a backslash.
+ *
+ * @param string $str
+ *
+ * @return string
+ *
+ * @see RFC822 3.4.1
+ */
+ public static function quotedString($str)
+ {
+ if (preg_match('/[ ()<>@,;:"\/\[\]?=]/', $str)) {
+ //If the string contains any of these chars, it must be double-quoted
+ //and any double quotes must be escaped with a backslash
+ return '"' . str_replace('"', '\\"', $str) . '"';
+ }
+
+ //Return the string untouched, it doesn't need quoting
+ return $str;
+ }
+
+ /**
+ * Allows for public read access to 'to' property.
+ * Before the send() call, queued addresses (i.e. with IDN) are not yet included.
+ *
+ * @return array
+ */
+ public function getToAddresses()
+ {
+ return $this->to;
+ }
+
+ /**
+ * Allows for public read access to 'cc' property.
+ * Before the send() call, queued addresses (i.e. with IDN) are not yet included.
+ *
+ * @return array
+ */
+ public function getCcAddresses()
+ {
+ return $this->cc;
+ }
+
+ /**
+ * Allows for public read access to 'bcc' property.
+ * Before the send() call, queued addresses (i.e. with IDN) are not yet included.
+ *
+ * @return array
+ */
+ public function getBccAddresses()
+ {
+ return $this->bcc;
+ }
+
+ /**
+ * Allows for public read access to 'ReplyTo' property.
+ * Before the send() call, queued addresses (i.e. with IDN) are not yet included.
+ *
+ * @return array
+ */
+ public function getReplyToAddresses()
+ {
+ return $this->ReplyTo;
+ }
+
+ /**
+ * Allows for public read access to 'all_recipients' property.
+ * Before the send() call, queued addresses (i.e. with IDN) are not yet included.
+ *
+ * @return array
+ */
+ public function getAllRecipientAddresses()
+ {
+ return $this->all_recipients;
+ }
+
+ /**
+ * Perform a callback.
+ *
+ * @param bool $isSent
+ * @param array $to
+ * @param array $cc
+ * @param array $bcc
+ * @param string $subject
+ * @param string $body
+ * @param string $from
+ * @param array $extra
+ */
+ protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body, $from, $extra)
+ {
+ if (!empty($this->action_function) && is_callable($this->action_function)) {
+ call_user_func($this->action_function, $isSent, $to, $cc, $bcc, $subject, $body, $from, $extra);
+ }
+ }
+
+ /**
+ * Get the OAuth instance.
+ *
+ * @return OAuth
+ */
+ public function getOAuth()
+ {
+ return $this->oauth;
+ }
+
+ /**
+ * Set an OAuth instance.
+ */
+ public function setOAuth(OAuth $oauth)
+ {
+ $this->oauth = $oauth;
+ }
+}
diff --git a/api/vendor/phpmailer/phpmailer/src/POP3.php b/api/vendor/phpmailer/phpmailer/src/POP3.php
new file mode 100644
index 0000000..235e637
--- /dev/null
+++ b/api/vendor/phpmailer/phpmailer/src/POP3.php
@@ -0,0 +1,448 @@
+
+ * @author Jim Jagielski (jimjag) ';
+ foreach ($this->errors as $e) {
+ print_r($e);
+ }
+ echo '';
+ }
+ }
+
+ /**
+ * Get an array of error messages, if any.
+ *
+ * @return array
+ */
+ public function getErrors()
+ {
+ return $this->errors;
+ }
+
+ /**
+ * POP3 connection error handler.
+ *
+ * @param int $errno
+ * @param string $errstr
+ * @param string $errfile
+ * @param int $errline
+ */
+ protected function catchWarning($errno, $errstr, $errfile, $errline)
+ {
+ $this->setError(
+ 'Connecting to the POP3 server raised a PHP warning:' .
+ "errno: $errno errstr: $errstr; errfile: $errfile; errline: $errline"
+ );
+ }
+}
diff --git a/api/vendor/phpmailer/phpmailer/src/SMTP.php b/api/vendor/phpmailer/phpmailer/src/SMTP.php
new file mode 100644
index 0000000..ab7f46e
--- /dev/null
+++ b/api/vendor/phpmailer/phpmailer/src/SMTP.php
@@ -0,0 +1,1431 @@
+
+ * @author Jim Jagielski (jimjag)
-
- = count($_SESSION['CART']);?>
-
+