function privDisableMagicQuotes() { $v_result = 1; // ----- Look if function exists if (!function_exists("get_magic_Quotes_runtime") || !function_exists("set_magic_Quotes_runtime")) { return $v_result; } // ----- Look if already done if ($this->magic_Quotes_status != -1) { return $v_result; } // ----- Get and memorize the magic_Quote value $this->magic_Quotes_status = @get_magic_Quotes_runtime(); // ----- Disable magic_Quotes if ($this->magic_Quotes_status == 1) { @set_magic_Quotes_runtime(0); } // ----- Return return $v_result; }
/** * Encodes attachment in requested format. * Returns an empty string on failure. * @param string $path The full path to the file * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'Quoted-printable' * @see EncodeFile() * @access private * @return string */ private function EncodeFile($path, $encoding = 'base64') { try { if (!is_readable($path)) { throw new phpmailerException($this->Lang('file_open') . $path, self::STOP_CONTINUE); } if (function_exists('get_magic_Quotes')) { function get_magic_Quotes() { return false; } } if (PHP_VERSION < 5.3) { $magic_Quotes = get_magic_Quotes_runtime(); set_magic_Quotes_runtime(0); } $file_buffer = file_get_contents($path); $file_buffer = $this->EncodeString($file_buffer, $encoding); if (PHP_VERSION < 5.3) { set_magic_Quotes_runtime($magic_Quotes); } return $file_buffer; } catch (Exception $e) { $this->SetError($e->getMessage()); return ''; } }