Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu.../PHPMaile...
File: PHPMailer.php
$body .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_ALTERNATIVE . ';');
[3000] Fix | Delete
$body .= $this->textLine(' boundary="' . $this->boundary[2] . '"');
[3001] Fix | Delete
$body .= static::$LE;
[3002] Fix | Delete
$body .= $this->getBoundary(
[3003] Fix | Delete
$this->boundary[2],
[3004] Fix | Delete
$altBodyCharSet,
[3005] Fix | Delete
static::CONTENT_TYPE_PLAINTEXT,
[3006] Fix | Delete
$altBodyEncoding
[3007] Fix | Delete
);
[3008] Fix | Delete
$body .= $this->encodeString($this->AltBody, $altBodyEncoding);
[3009] Fix | Delete
$body .= static::$LE;
[3010] Fix | Delete
$body .= $this->getBoundary(
[3011] Fix | Delete
$this->boundary[2],
[3012] Fix | Delete
$bodyCharSet,
[3013] Fix | Delete
static::CONTENT_TYPE_TEXT_HTML,
[3014] Fix | Delete
$bodyEncoding
[3015] Fix | Delete
);
[3016] Fix | Delete
$body .= $this->encodeString($this->Body, $bodyEncoding);
[3017] Fix | Delete
$body .= static::$LE;
[3018] Fix | Delete
if (!empty($this->Ical)) {
[3019] Fix | Delete
$method = static::ICAL_METHOD_REQUEST;
[3020] Fix | Delete
foreach (static::$IcalMethods as $imethod) {
[3021] Fix | Delete
if (stripos($this->Ical, 'METHOD:' . $imethod) !== false) {
[3022] Fix | Delete
$method = $imethod;
[3023] Fix | Delete
break;
[3024] Fix | Delete
}
[3025] Fix | Delete
}
[3026] Fix | Delete
$body .= $this->getBoundary(
[3027] Fix | Delete
$this->boundary[2],
[3028] Fix | Delete
'',
[3029] Fix | Delete
static::CONTENT_TYPE_TEXT_CALENDAR . '; method=' . $method,
[3030] Fix | Delete
''
[3031] Fix | Delete
);
[3032] Fix | Delete
$body .= $this->encodeString($this->Ical, $this->Encoding);
[3033] Fix | Delete
}
[3034] Fix | Delete
$body .= $this->endBoundary($this->boundary[2]);
[3035] Fix | Delete
$body .= static::$LE;
[3036] Fix | Delete
$body .= $this->attachAll('attachment', $this->boundary[1]);
[3037] Fix | Delete
break;
[3038] Fix | Delete
case 'alt_inline_attach':
[3039] Fix | Delete
$body .= $mimepre;
[3040] Fix | Delete
$body .= $this->textLine('--' . $this->boundary[1]);
[3041] Fix | Delete
$body .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_ALTERNATIVE . ';');
[3042] Fix | Delete
$body .= $this->textLine(' boundary="' . $this->boundary[2] . '"');
[3043] Fix | Delete
$body .= static::$LE;
[3044] Fix | Delete
$body .= $this->getBoundary(
[3045] Fix | Delete
$this->boundary[2],
[3046] Fix | Delete
$altBodyCharSet,
[3047] Fix | Delete
static::CONTENT_TYPE_PLAINTEXT,
[3048] Fix | Delete
$altBodyEncoding
[3049] Fix | Delete
);
[3050] Fix | Delete
$body .= $this->encodeString($this->AltBody, $altBodyEncoding);
[3051] Fix | Delete
$body .= static::$LE;
[3052] Fix | Delete
$body .= $this->textLine('--' . $this->boundary[2]);
[3053] Fix | Delete
$body .= $this->headerLine('Content-Type', static::CONTENT_TYPE_MULTIPART_RELATED . ';');
[3054] Fix | Delete
$body .= $this->textLine(' boundary="' . $this->boundary[3] . '";');
[3055] Fix | Delete
$body .= $this->textLine(' type="' . static::CONTENT_TYPE_TEXT_HTML . '"');
[3056] Fix | Delete
$body .= static::$LE;
[3057] Fix | Delete
$body .= $this->getBoundary(
[3058] Fix | Delete
$this->boundary[3],
[3059] Fix | Delete
$bodyCharSet,
[3060] Fix | Delete
static::CONTENT_TYPE_TEXT_HTML,
[3061] Fix | Delete
$bodyEncoding
[3062] Fix | Delete
);
[3063] Fix | Delete
$body .= $this->encodeString($this->Body, $bodyEncoding);
[3064] Fix | Delete
$body .= static::$LE;
[3065] Fix | Delete
$body .= $this->attachAll('inline', $this->boundary[3]);
[3066] Fix | Delete
$body .= static::$LE;
[3067] Fix | Delete
$body .= $this->endBoundary($this->boundary[2]);
[3068] Fix | Delete
$body .= static::$LE;
[3069] Fix | Delete
$body .= $this->attachAll('attachment', $this->boundary[1]);
[3070] Fix | Delete
break;
[3071] Fix | Delete
default:
[3072] Fix | Delete
//Catch case 'plain' and case '', applies to simple `text/plain` and `text/html` body content types
[3073] Fix | Delete
//Reset the `Encoding` property in case we changed it for line length reasons
[3074] Fix | Delete
$this->Encoding = $bodyEncoding;
[3075] Fix | Delete
$body .= $this->encodeString($this->Body, $this->Encoding);
[3076] Fix | Delete
break;
[3077] Fix | Delete
}
[3078] Fix | Delete
[3079] Fix | Delete
if ($this->isError()) {
[3080] Fix | Delete
$body = '';
[3081] Fix | Delete
if ($this->exceptions) {
[3082] Fix | Delete
throw new Exception($this->lang('empty_message'), self::STOP_CRITICAL);
[3083] Fix | Delete
}
[3084] Fix | Delete
} elseif ($this->sign_key_file) {
[3085] Fix | Delete
try {
[3086] Fix | Delete
if (!defined('PKCS7_TEXT')) {
[3087] Fix | Delete
throw new Exception($this->lang('extension_missing') . 'openssl');
[3088] Fix | Delete
}
[3089] Fix | Delete
[3090] Fix | Delete
$file = tempnam(sys_get_temp_dir(), 'srcsign');
[3091] Fix | Delete
$signed = tempnam(sys_get_temp_dir(), 'mailsign');
[3092] Fix | Delete
file_put_contents($file, $body);
[3093] Fix | Delete
[3094] Fix | Delete
//Workaround for PHP bug https://bugs.php.net/bug.php?id=69197
[3095] Fix | Delete
if (empty($this->sign_extracerts_file)) {
[3096] Fix | Delete
$sign = @openssl_pkcs7_sign(
[3097] Fix | Delete
$file,
[3098] Fix | Delete
$signed,
[3099] Fix | Delete
'file://' . realpath($this->sign_cert_file),
[3100] Fix | Delete
['file://' . realpath($this->sign_key_file), $this->sign_key_pass],
[3101] Fix | Delete
[]
[3102] Fix | Delete
);
[3103] Fix | Delete
} else {
[3104] Fix | Delete
$sign = @openssl_pkcs7_sign(
[3105] Fix | Delete
$file,
[3106] Fix | Delete
$signed,
[3107] Fix | Delete
'file://' . realpath($this->sign_cert_file),
[3108] Fix | Delete
['file://' . realpath($this->sign_key_file), $this->sign_key_pass],
[3109] Fix | Delete
[],
[3110] Fix | Delete
PKCS7_DETACHED,
[3111] Fix | Delete
$this->sign_extracerts_file
[3112] Fix | Delete
);
[3113] Fix | Delete
}
[3114] Fix | Delete
[3115] Fix | Delete
@unlink($file);
[3116] Fix | Delete
if ($sign) {
[3117] Fix | Delete
$body = file_get_contents($signed);
[3118] Fix | Delete
@unlink($signed);
[3119] Fix | Delete
//The message returned by openssl contains both headers and body, so need to split them up
[3120] Fix | Delete
$parts = explode("\n\n", $body, 2);
[3121] Fix | Delete
$this->MIMEHeader .= $parts[0] . static::$LE . static::$LE;
[3122] Fix | Delete
$body = $parts[1];
[3123] Fix | Delete
} else {
[3124] Fix | Delete
@unlink($signed);
[3125] Fix | Delete
throw new Exception($this->lang('signing') . openssl_error_string());
[3126] Fix | Delete
}
[3127] Fix | Delete
} catch (Exception $exc) {
[3128] Fix | Delete
$body = '';
[3129] Fix | Delete
if ($this->exceptions) {
[3130] Fix | Delete
throw $exc;
[3131] Fix | Delete
}
[3132] Fix | Delete
}
[3133] Fix | Delete
}
[3134] Fix | Delete
[3135] Fix | Delete
return $body;
[3136] Fix | Delete
}
[3137] Fix | Delete
[3138] Fix | Delete
/**
[3139] Fix | Delete
* Get the boundaries that this message will use
[3140] Fix | Delete
* @return array
[3141] Fix | Delete
*/
[3142] Fix | Delete
public function getBoundaries()
[3143] Fix | Delete
{
[3144] Fix | Delete
if (empty($this->boundary)) {
[3145] Fix | Delete
$this->setBoundaries();
[3146] Fix | Delete
}
[3147] Fix | Delete
return $this->boundary;
[3148] Fix | Delete
}
[3149] Fix | Delete
[3150] Fix | Delete
/**
[3151] Fix | Delete
* Return the start of a message boundary.
[3152] Fix | Delete
*
[3153] Fix | Delete
* @param string $boundary
[3154] Fix | Delete
* @param string $charSet
[3155] Fix | Delete
* @param string $contentType
[3156] Fix | Delete
* @param string $encoding
[3157] Fix | Delete
*
[3158] Fix | Delete
* @return string
[3159] Fix | Delete
*/
[3160] Fix | Delete
protected function getBoundary($boundary, $charSet, $contentType, $encoding)
[3161] Fix | Delete
{
[3162] Fix | Delete
$result = '';
[3163] Fix | Delete
if ('' === $charSet) {
[3164] Fix | Delete
$charSet = $this->CharSet;
[3165] Fix | Delete
}
[3166] Fix | Delete
if ('' === $contentType) {
[3167] Fix | Delete
$contentType = $this->ContentType;
[3168] Fix | Delete
}
[3169] Fix | Delete
if ('' === $encoding) {
[3170] Fix | Delete
$encoding = $this->Encoding;
[3171] Fix | Delete
}
[3172] Fix | Delete
$result .= $this->textLine('--' . $boundary);
[3173] Fix | Delete
$result .= sprintf('Content-Type: %s; charset=%s', $contentType, $charSet);
[3174] Fix | Delete
$result .= static::$LE;
[3175] Fix | Delete
//RFC1341 part 5 says 7bit is assumed if not specified
[3176] Fix | Delete
if (static::ENCODING_7BIT !== $encoding) {
[3177] Fix | Delete
$result .= $this->headerLine('Content-Transfer-Encoding', $encoding);
[3178] Fix | Delete
}
[3179] Fix | Delete
$result .= static::$LE;
[3180] Fix | Delete
[3181] Fix | Delete
return $result;
[3182] Fix | Delete
}
[3183] Fix | Delete
[3184] Fix | Delete
/**
[3185] Fix | Delete
* Return the end of a message boundary.
[3186] Fix | Delete
*
[3187] Fix | Delete
* @param string $boundary
[3188] Fix | Delete
*
[3189] Fix | Delete
* @return string
[3190] Fix | Delete
*/
[3191] Fix | Delete
protected function endBoundary($boundary)
[3192] Fix | Delete
{
[3193] Fix | Delete
return static::$LE . '--' . $boundary . '--' . static::$LE;
[3194] Fix | Delete
}
[3195] Fix | Delete
[3196] Fix | Delete
/**
[3197] Fix | Delete
* Set the message type.
[3198] Fix | Delete
* PHPMailer only supports some preset message types, not arbitrary MIME structures.
[3199] Fix | Delete
*/
[3200] Fix | Delete
protected function setMessageType()
[3201] Fix | Delete
{
[3202] Fix | Delete
$type = [];
[3203] Fix | Delete
if ($this->alternativeExists()) {
[3204] Fix | Delete
$type[] = 'alt';
[3205] Fix | Delete
}
[3206] Fix | Delete
if ($this->inlineImageExists()) {
[3207] Fix | Delete
$type[] = 'inline';
[3208] Fix | Delete
}
[3209] Fix | Delete
if ($this->attachmentExists()) {
[3210] Fix | Delete
$type[] = 'attach';
[3211] Fix | Delete
}
[3212] Fix | Delete
$this->message_type = implode('_', $type);
[3213] Fix | Delete
if ('' === $this->message_type) {
[3214] Fix | Delete
//The 'plain' message_type refers to the message having a single body element, not that it is plain-text
[3215] Fix | Delete
$this->message_type = 'plain';
[3216] Fix | Delete
}
[3217] Fix | Delete
}
[3218] Fix | Delete
[3219] Fix | Delete
/**
[3220] Fix | Delete
* Format a header line.
[3221] Fix | Delete
*
[3222] Fix | Delete
* @param string $name
[3223] Fix | Delete
* @param string|int $value
[3224] Fix | Delete
*
[3225] Fix | Delete
* @return string
[3226] Fix | Delete
*/
[3227] Fix | Delete
public function headerLine($name, $value)
[3228] Fix | Delete
{
[3229] Fix | Delete
return $name . ': ' . $value . static::$LE;
[3230] Fix | Delete
}
[3231] Fix | Delete
[3232] Fix | Delete
/**
[3233] Fix | Delete
* Return a formatted mail line.
[3234] Fix | Delete
*
[3235] Fix | Delete
* @param string $value
[3236] Fix | Delete
*
[3237] Fix | Delete
* @return string
[3238] Fix | Delete
*/
[3239] Fix | Delete
public function textLine($value)
[3240] Fix | Delete
{
[3241] Fix | Delete
return $value . static::$LE;
[3242] Fix | Delete
}
[3243] Fix | Delete
[3244] Fix | Delete
/**
[3245] Fix | Delete
* Add an attachment from a path on the filesystem.
[3246] Fix | Delete
* Never use a user-supplied path to a file!
[3247] Fix | Delete
* Returns false if the file could not be found or read.
[3248] Fix | Delete
* Explicitly *does not* support passing URLs; PHPMailer is not an HTTP client.
[3249] Fix | Delete
* If you need to do that, fetch the resource yourself and pass it in via a local file or string.
[3250] Fix | Delete
*
[3251] Fix | Delete
* @param string $path Path to the attachment
[3252] Fix | Delete
* @param string $name Overrides the attachment name
[3253] Fix | Delete
* @param string $encoding File encoding (see $Encoding)
[3254] Fix | Delete
* @param string $type MIME type, e.g. `image/jpeg`; determined automatically from $path if not specified
[3255] Fix | Delete
* @param string $disposition Disposition to use
[3256] Fix | Delete
*
[3257] Fix | Delete
* @throws Exception
[3258] Fix | Delete
*
[3259] Fix | Delete
* @return bool
[3260] Fix | Delete
*/
[3261] Fix | Delete
public function addAttachment(
[3262] Fix | Delete
$path,
[3263] Fix | Delete
$name = '',
[3264] Fix | Delete
$encoding = self::ENCODING_BASE64,
[3265] Fix | Delete
$type = '',
[3266] Fix | Delete
$disposition = 'attachment'
[3267] Fix | Delete
) {
[3268] Fix | Delete
try {
[3269] Fix | Delete
if (!static::fileIsAccessible($path)) {
[3270] Fix | Delete
throw new Exception($this->lang('file_access') . $path, self::STOP_CONTINUE);
[3271] Fix | Delete
}
[3272] Fix | Delete
[3273] Fix | Delete
//If a MIME type is not specified, try to work it out from the file name
[3274] Fix | Delete
if ('' === $type) {
[3275] Fix | Delete
$type = static::filenameToType($path);
[3276] Fix | Delete
}
[3277] Fix | Delete
[3278] Fix | Delete
$filename = (string) static::mb_pathinfo($path, PATHINFO_BASENAME);
[3279] Fix | Delete
if ('' === $name) {
[3280] Fix | Delete
$name = $filename;
[3281] Fix | Delete
}
[3282] Fix | Delete
if (!$this->validateEncoding($encoding)) {
[3283] Fix | Delete
throw new Exception($this->lang('encoding') . $encoding);
[3284] Fix | Delete
}
[3285] Fix | Delete
[3286] Fix | Delete
$this->attachment[] = [
[3287] Fix | Delete
0 => $path,
[3288] Fix | Delete
1 => $filename,
[3289] Fix | Delete
2 => $name,
[3290] Fix | Delete
3 => $encoding,
[3291] Fix | Delete
4 => $type,
[3292] Fix | Delete
5 => false, //isStringAttachment
[3293] Fix | Delete
6 => $disposition,
[3294] Fix | Delete
7 => $name,
[3295] Fix | Delete
];
[3296] Fix | Delete
} catch (Exception $exc) {
[3297] Fix | Delete
$this->setError($exc->getMessage());
[3298] Fix | Delete
$this->edebug($exc->getMessage());
[3299] Fix | Delete
if ($this->exceptions) {
[3300] Fix | Delete
throw $exc;
[3301] Fix | Delete
}
[3302] Fix | Delete
[3303] Fix | Delete
return false;
[3304] Fix | Delete
}
[3305] Fix | Delete
[3306] Fix | Delete
return true;
[3307] Fix | Delete
}
[3308] Fix | Delete
[3309] Fix | Delete
/**
[3310] Fix | Delete
* Return the array of attachments.
[3311] Fix | Delete
*
[3312] Fix | Delete
* @return array
[3313] Fix | Delete
*/
[3314] Fix | Delete
public function getAttachments()
[3315] Fix | Delete
{
[3316] Fix | Delete
return $this->attachment;
[3317] Fix | Delete
}
[3318] Fix | Delete
[3319] Fix | Delete
/**
[3320] Fix | Delete
* Attach all file, string, and binary attachments to the message.
[3321] Fix | Delete
* Returns an empty string on failure.
[3322] Fix | Delete
*
[3323] Fix | Delete
* @param string $disposition_type
[3324] Fix | Delete
* @param string $boundary
[3325] Fix | Delete
*
[3326] Fix | Delete
* @throws Exception
[3327] Fix | Delete
*
[3328] Fix | Delete
* @return string
[3329] Fix | Delete
*/
[3330] Fix | Delete
protected function attachAll($disposition_type, $boundary)
[3331] Fix | Delete
{
[3332] Fix | Delete
//Return text of body
[3333] Fix | Delete
$mime = [];
[3334] Fix | Delete
$cidUniq = [];
[3335] Fix | Delete
$incl = [];
[3336] Fix | Delete
[3337] Fix | Delete
//Add all attachments
[3338] Fix | Delete
foreach ($this->attachment as $attachment) {
[3339] Fix | Delete
//Check if it is a valid disposition_filter
[3340] Fix | Delete
if ($attachment[6] === $disposition_type) {
[3341] Fix | Delete
//Check for string attachment
[3342] Fix | Delete
$string = '';
[3343] Fix | Delete
$path = '';
[3344] Fix | Delete
$bString = $attachment[5];
[3345] Fix | Delete
if ($bString) {
[3346] Fix | Delete
$string = $attachment[0];
[3347] Fix | Delete
} else {
[3348] Fix | Delete
$path = $attachment[0];
[3349] Fix | Delete
}
[3350] Fix | Delete
[3351] Fix | Delete
$inclhash = hash('sha256', serialize($attachment));
[3352] Fix | Delete
if (in_array($inclhash, $incl, true)) {
[3353] Fix | Delete
continue;
[3354] Fix | Delete
}
[3355] Fix | Delete
$incl[] = $inclhash;
[3356] Fix | Delete
$name = $attachment[2];
[3357] Fix | Delete
$encoding = $attachment[3];
[3358] Fix | Delete
$type = $attachment[4];
[3359] Fix | Delete
$disposition = $attachment[6];
[3360] Fix | Delete
$cid = $attachment[7];
[3361] Fix | Delete
if ('inline' === $disposition && array_key_exists($cid, $cidUniq)) {
[3362] Fix | Delete
continue;
[3363] Fix | Delete
}
[3364] Fix | Delete
$cidUniq[$cid] = true;
[3365] Fix | Delete
[3366] Fix | Delete
$mime[] = sprintf('--%s%s', $boundary, static::$LE);
[3367] Fix | Delete
//Only include a filename property if we have one
[3368] Fix | Delete
if (!empty($name)) {
[3369] Fix | Delete
$mime[] = sprintf(
[3370] Fix | Delete
'Content-Type: %s; name=%s%s',
[3371] Fix | Delete
$type,
[3372] Fix | Delete
static::quotedString($this->encodeHeader($this->secureHeader($name))),
[3373] Fix | Delete
static::$LE
[3374] Fix | Delete
);
[3375] Fix | Delete
} else {
[3376] Fix | Delete
$mime[] = sprintf(
[3377] Fix | Delete
'Content-Type: %s%s',
[3378] Fix | Delete
$type,
[3379] Fix | Delete
static::$LE
[3380] Fix | Delete
);
[3381] Fix | Delete
}
[3382] Fix | Delete
//RFC1341 part 5 says 7bit is assumed if not specified
[3383] Fix | Delete
if (static::ENCODING_7BIT !== $encoding) {
[3384] Fix | Delete
$mime[] = sprintf('Content-Transfer-Encoding: %s%s', $encoding, static::$LE);
[3385] Fix | Delete
}
[3386] Fix | Delete
[3387] Fix | Delete
//Only set Content-IDs on inline attachments
[3388] Fix | Delete
if ((string) $cid !== '' && $disposition === 'inline') {
[3389] Fix | Delete
$mime[] = 'Content-ID: <' . $this->encodeHeader($this->secureHeader($cid)) . '>' . static::$LE;
[3390] Fix | Delete
}
[3391] Fix | Delete
[3392] Fix | Delete
//Allow for bypassing the Content-Disposition header
[3393] Fix | Delete
if (!empty($disposition)) {
[3394] Fix | Delete
$encoded_name = $this->encodeHeader($this->secureHeader($name));
[3395] Fix | Delete
if (!empty($encoded_name)) {
[3396] Fix | Delete
$mime[] = sprintf(
[3397] Fix | Delete
'Content-Disposition: %s; filename=%s%s',
[3398] Fix | Delete
$disposition,
[3399] Fix | Delete
static::quotedString($encoded_name),
[3400] Fix | Delete
static::$LE . static::$LE
[3401] Fix | Delete
);
[3402] Fix | Delete
} else {
[3403] Fix | Delete
$mime[] = sprintf(
[3404] Fix | Delete
'Content-Disposition: %s%s',
[3405] Fix | Delete
$disposition,
[3406] Fix | Delete
static::$LE . static::$LE
[3407] Fix | Delete
);
[3408] Fix | Delete
}
[3409] Fix | Delete
} else {
[3410] Fix | Delete
$mime[] = static::$LE;
[3411] Fix | Delete
}
[3412] Fix | Delete
[3413] Fix | Delete
//Encode as string attachment
[3414] Fix | Delete
if ($bString) {
[3415] Fix | Delete
$mime[] = $this->encodeString($string, $encoding);
[3416] Fix | Delete
} else {
[3417] Fix | Delete
$mime[] = $this->encodeFile($path, $encoding);
[3418] Fix | Delete
}
[3419] Fix | Delete
if ($this->isError()) {
[3420] Fix | Delete
return '';
[3421] Fix | Delete
}
[3422] Fix | Delete
$mime[] = static::$LE;
[3423] Fix | Delete
}
[3424] Fix | Delete
}
[3425] Fix | Delete
[3426] Fix | Delete
$mime[] = sprintf('--%s--%s', $boundary, static::$LE);
[3427] Fix | Delete
[3428] Fix | Delete
return implode('', $mime);
[3429] Fix | Delete
}
[3430] Fix | Delete
[3431] Fix | Delete
/**
[3432] Fix | Delete
* Encode a file attachment in requested format.
[3433] Fix | Delete
* Returns an empty string on failure.
[3434] Fix | Delete
*
[3435] Fix | Delete
* @param string $path The full path to the file
[3436] Fix | Delete
* @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
[3437] Fix | Delete
*
[3438] Fix | Delete
* @return string
[3439] Fix | Delete
*/
[3440] Fix | Delete
protected function encodeFile($path, $encoding = self::ENCODING_BASE64)
[3441] Fix | Delete
{
[3442] Fix | Delete
try {
[3443] Fix | Delete
if (!static::fileIsAccessible($path)) {
[3444] Fix | Delete
throw new Exception($this->lang('file_open') . $path, self::STOP_CONTINUE);
[3445] Fix | Delete
}
[3446] Fix | Delete
$file_buffer = file_get_contents($path);
[3447] Fix | Delete
if (false === $file_buffer) {
[3448] Fix | Delete
throw new Exception($this->lang('file_open') . $path, self::STOP_CONTINUE);
[3449] Fix | Delete
}
[3450] Fix | Delete
$file_buffer = $this->encodeString($file_buffer, $encoding);
[3451] Fix | Delete
[3452] Fix | Delete
return $file_buffer;
[3453] Fix | Delete
} catch (Exception $exc) {
[3454] Fix | Delete
$this->setError($exc->getMessage());
[3455] Fix | Delete
$this->edebug($exc->getMessage());
[3456] Fix | Delete
if ($this->exceptions) {
[3457] Fix | Delete
throw $exc;
[3458] Fix | Delete
}
[3459] Fix | Delete
[3460] Fix | Delete
return '';
[3461] Fix | Delete
}
[3462] Fix | Delete
}
[3463] Fix | Delete
[3464] Fix | Delete
/**
[3465] Fix | Delete
* Encode a string in requested format.
[3466] Fix | Delete
* Returns an empty string on failure.
[3467] Fix | Delete
*
[3468] Fix | Delete
* @param string $str The text to encode
[3469] Fix | Delete
* @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
[3470] Fix | Delete
*
[3471] Fix | Delete
* @throws Exception
[3472] Fix | Delete
*
[3473] Fix | Delete
* @return string
[3474] Fix | Delete
*/
[3475] Fix | Delete
public function encodeString($str, $encoding = self::ENCODING_BASE64)
[3476] Fix | Delete
{
[3477] Fix | Delete
$encoded = '';
[3478] Fix | Delete
switch (strtolower($encoding)) {
[3479] Fix | Delete
case static::ENCODING_BASE64:
[3480] Fix | Delete
$encoded = chunk_split(
[3481] Fix | Delete
base64_encode($str),
[3482] Fix | Delete
static::STD_LINE_LENGTH,
[3483] Fix | Delete
static::$LE
[3484] Fix | Delete
);
[3485] Fix | Delete
break;
[3486] Fix | Delete
case static::ENCODING_7BIT:
[3487] Fix | Delete
case static::ENCODING_8BIT:
[3488] Fix | Delete
$encoded = static::normalizeBreaks($str);
[3489] Fix | Delete
//Make sure it ends with a line break
[3490] Fix | Delete
if (substr($encoded, -(strlen(static::$LE))) !== static::$LE) {
[3491] Fix | Delete
$encoded .= static::$LE;
[3492] Fix | Delete
}
[3493] Fix | Delete
break;
[3494] Fix | Delete
case static::ENCODING_BINARY:
[3495] Fix | Delete
$encoded = $str;
[3496] Fix | Delete
break;
[3497] Fix | Delete
case static::ENCODING_QUOTED_PRINTABLE:
[3498] Fix | Delete
$encoded = $this->encodeQP($str);
[3499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function