Beispiel #1
0
 function __construct($file, $comptype = TarLib::COMPRESS_AUTO, $complevel = 9)
 {
     dbg_deprecated('class Tar');
     if (!$file) {
         $this->error('__construct', '$file');
     }
     $this->file = $file;
     switch ($comptype) {
         case TarLib::COMPRESS_AUTO:
         case TarLib::COMPRESS_DETECT:
             $comptype = Tar::COMPRESS_AUTO;
             break;
         case TarLib::COMPRESS_GZIP:
             $comptype = Tar::COMPRESS_GZIP;
             break;
         case TarLib::COMPRESS_BZIP:
             $comptype = Tar::COMPRESS_BZIP;
             break;
         default:
             $comptype = Tar::COMPRESS_NONE;
     }
     $this->complevel = $complevel;
     try {
         $this->tar = new Tar();
         $this->tar->open($file, $comptype);
     } catch (Exception $e) {
         $this->_result = false;
     }
 }
Beispiel #2
0
/**
 * Encodes an email address header
 *
 * Unicode characters will be deaccented and encoded
 * quoted_printable for headers.
 * Addresses may not contain Non-ASCII data!
 *
 * Example:
 *   mail_encode_address("föö <*****@*****.**>, me@somewhere.com","TBcc");
 *
 * @param string  $string Multiple adresses separated by commas
 * @param string  $header Name of the header (To,Bcc,Cc,...)
 * @param boolean $names  Allow named Recipients?
 *
 * @deprecated User the Mailer:: class instead
 */
function mail_encode_address($string, $header = '', $names = true)
{
    dbg_deprecated('class Mailer::');
    $headers = '';
    $parts = explode(',', $string);
    foreach ($parts as $part) {
        $part = trim($part);
        // parse address
        if (preg_match('#(.*?)<(.*?)>#', $part, $matches)) {
            $text = trim($matches[1]);
            $addr = $matches[2];
        } else {
            $addr = $part;
        }
        // skip empty ones
        if (empty($addr)) {
            continue;
        }
        // FIXME: is there a way to encode the localpart of a emailaddress?
        if (!utf8_isASCII($addr)) {
            msg(htmlspecialchars("E-Mail address <{$addr}> is not ASCII"), -1);
            continue;
        }
        if (!mail_isvalid($addr)) {
            msg(htmlspecialchars("E-Mail address <{$addr}> is not valid"), -1);
            continue;
        }
        // text was given
        if (!empty($text) && $names) {
            // add address quotes
            $addr = "<{$addr}>";
            if (defined('MAILHEADER_ASCIIONLY')) {
                $text = utf8_deaccent($text);
                $text = utf8_strip($text);
            }
            if (!utf8_isASCII($text)) {
                // put the quotes outside as in =?UTF-8?Q?"Elan Ruusam=C3=A4e"?= vs "=?UTF-8?Q?Elan Ruusam=C3=A4e?="
                if (preg_match('/^"(.+)"$/', $text, $matches)) {
                    $text = '"=?UTF-8?Q?' . mail_quotedprintable_encode($matches[1], 0) . '?="';
                } else {
                    $text = '=?UTF-8?Q?' . mail_quotedprintable_encode($text, 0) . '?=';
                }
                // additionally the space character should be encoded as =20 (or each
                // word QP encoded separately).
                // however this is needed only in mail headers, not globally in mail_quotedprintable_encode().
                $text = str_replace(" ", "=20", $text);
            }
        } else {
            $text = '';
        }
        // add to header comma seperated
        if ($headers != '') {
            $headers .= ',';
            if ($header) {
                $headers .= MAILHEADER_EOL . ' ';
            }
            // avoid overlong mail headers
        }
        $headers .= $text . ' ' . $addr;
    }
    if (empty($headers)) {
        return null;
    }
    //if headername was given add it and close correctly
    if ($header) {
        $headers = $header . ': ' . $headers . MAILHEADER_EOL;
    }
    return $headers;
}
Beispiel #3
0
/**
 * Compatibility wrapper around Subscription:notifyaddresses
 *
 * for plugins emitting COMMON_NOTIFY_ADDRESSLIST themselves and relying on on this to
 * be the default handler
 *
 * @param array $data event data for
 *
 * @deprecated 2012-12-07
 */
function subscription_addresslist(&$data)
{
    dbg_deprecated('class Subscription');
    $sub = new Subscription();
    $sub->notifyaddresses($data);
}
 /**
  * This function adjust the length string $value for ODT and returns the adjusted string:
  * - If there are only digits in the string, the unit 'pt' is appended
  * - If the unit is 'px' it is replaced by 'pt'
  *   (the OpenDocument specification only optionally supports 'px' and it seems that at
  *   least LibreOffice is not supporting it)
  *
  * @author LarsDW223
  *
  * @param string|int|float $value
  * @return string
  */
 function adjustLengthValueForODT($value)
 {
     dbg_deprecated('_odtOpenTextBoxUseProperties');
     // If there are only digits, append 'pt' to it
     if (ctype_digit($value) === true) {
         $value = $value . 'pt';
     } else {
         // Replace px with pt (px does not seem to be supported by ODT)
         $length = strlen($value);
         if ($length > 2 && $value[$length - 2] == 'p' && $value[$length - 1] == 'x') {
             $value[$length - 1] = 't';
         }
     }
     return $value;
 }
Beispiel #5
0
 /**
  * A fallback to provide access to the old render() method
  *
  * Since syntax plugins provide their own render method with a different signature and they now
  * inherit from Doku_Plugin we can no longer have a render() method here (Strict Standards Violation).
  * Instead use render_text()
  *
  * @deprecated 2014-01-22
  * @param $name
  * @param $arguments
  * @return null|string
  */
 function __call($name, $arguments)
 {
     if ($name == 'render') {
         dbg_deprecated('render_text()');
         if (!isset($arguments[1])) {
             $arguments[1] = 'xhtml';
         }
         return $this->render_text($arguments[0], $arguments[1]);
     }
     trigger_error("no such method {$name}", E_USER_ERROR);
     return null;
 }
Beispiel #6
0
/**
 * Return a list of page revisions numbers
 * Does not guarantee that the revision exists in the attic,
 * only that a line with the date exists in the changelog.
 * By default the current revision is skipped.
 *
 * The current revision is automatically skipped when the page exists.
 * See $INFO['meta']['last_change'] for the current revision.
 *
 * For efficiency, the log lines are parsed and cached for later
 * calls to getRevisionInfo. Large changelog files are read
 * backwards in chunks until the requested number of changelog
 * lines are recieved.
 *
 * @deprecated 2013-11-20
 *
 * @author Ben Coburn <*****@*****.**>
 * @author Kate Arzamastseva <*****@*****.**>
 *
 * @param string $id          the page of interest
 * @param int    $first       skip the first n changelog lines
 * @param int    $num         number of revisions to return
 * @param int    $chunk_size
 * @param bool   $media
 * @return array
 */
function getRevisions($id, $first, $num, $chunk_size = 8192, $media = false)
{
    dbg_deprecated('class PageChangeLog or class MediaChangelog');
    if ($media) {
        $changelog = new MediaChangeLog($id, $chunk_size);
    } else {
        $changelog = new PageChangeLog($id, $chunk_size);
    }
    return $changelog->getRevisions($first, $num);
}
 /**
  * @param $value
  * @param int $emValue
  * @return string
  */
 public function adjustValueForODT($value, $emValue = 0)
 {
     // ODT specific function. Shouldn't be used anymore.
     // Call the ODT renderer's function instead.
     dbg_deprecated('renderer_plugin_odt_page::adjustValueForODT');
     $values = preg_split('/\\s+/', $value);
     $value = '';
     foreach ($values as $part) {
         // Replace it if necessary
         $part = trim($part);
         $rep = $this->getReplacement($part);
         if (!empty($rep)) {
             $part = $rep;
         }
         $length = strlen($part);
         // If it is a short color value (#xxx) then convert it to long value (#xxxxxx)
         // (ODT does not support the short form)
         if ($part[0] == '#' && $length == 4) {
             $part = '#' . $part[1] . $part[1] . $part[2] . $part[2] . $part[3] . $part[3];
         } else {
             // If it is a CSS color name, get it's real color value
             /** @var helper_plugin_odt_csscolors $odt_colors */
             $odt_colors = plugin_load('helper', 'odt_csscolors');
             $color = $odt_colors->getColorValue($part);
             if ($part == 'black' || $color != '#000000') {
                 $part = $color;
             }
         }
         if ($length > 2 && $part[$length - 2] == 'e' && $part[$length - 1] == 'm') {
             $number = substr($part, 0, $length - 2);
             if (is_numeric($number) && !empty($emValue)) {
                 $part = $number * $emValue . 'pt';
             }
         }
         // Replace px with pt (px does not seem to be supported by ODT)
         if ($length > 2 && $part[$length - 2] == 'p' && $part[$length - 1] == 'x') {
             $part[$length - 1] = 't';
         }
         $value .= ' ' . $part;
     }
     $value = trim($value);
     return $value;
 }