/*
****************************************************************************
198450
function Map(editable, edit, config, root, size) {
    this._editable = editable;
    this._edit = edit;
    this._config = config;
    this._root = root;
    this._size = size;
}
277510
public function create()
    {
        $autoIncrementField = $this->getAutoIncrementField();
        if ($autoIncrementField && $this->$autoIncrementField === null) {
            $this->$autoIncrementField = $this->getNextAutoIncrementId();
        }

        $fields = $this->getFields();
        foreach ($this->getAutoFilledData(self::OP_CREATE) as $field => $value) {
            /** @noinspection NotOptimalIfConditionsInspection */
            if (!in_array($field, $fields, true) || $this->$field !== null) {
                continue;
            }
            $this->$field = $value;
        }

        $this->validate($fields);

        $this->eventsManager->fireEvent('model:beforeSave', $this);
        $this->eventsManager->fireEvent('model:beforeCreate', $this);

        $fieldValues = [];
        $defaultValueFields = [];
        foreach ($fields as $field) {
            if ($this->$field !== null) {
                $fieldValues[$field] = $this->$field;
            } elseif ($field !== $autoIncrementField) {
                $defaultValueFields[] = $field;
            }
        }

        foreach ($this->getJsonFields() as $field) {
            if (is_array($this->$field)) {
                $fieldValues[$field] = json_encode($this->$field, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
            }
        }

        /**
         * @var \ManaPHP\DbInterface $connection
         */
        $connection = $this->_di->getShared($this->getDb($this));

        if ($autoIncrementField && $this->$autoIncrementField === null) {
            $this->$autoIncrementField = (int)$connection->insert($this->getSource($this), $fieldValues, true);
        } else {
            $connection->insert($this->getSource($this), $fieldValues);
        }

        if ($defaultValueFields) {
            if ($r = static::query(null, $this)->select($defaultValueFields)->where($this->_getPrimaryKeyValuePairs())->fetch(true)) {
                foreach ($r[0] as $field => $value) {
                    $this->$field = $value;
                }
            }
        }

        $this->_snapshot = $this->toArray();

        $this->eventsManager->fireEvent('model:afterCreate', $this);
        $this->eventsManager->fireEvent('model:afterSave', $this);

        return $this;
    }
205372
public function execute()
    {
        $data = $this->getData();

        /*
         * Step 1) Apply sorting
         *
         * @see http://php.net/manual/de/function.array-multisort.php
         * @see example number 3
         */
        if (!empty($this->getSortConditions())) {
            $data = $this->sortArrayMultiple($data, $this->getSortConditions());
        }

        /*
         * Step 2) Apply filters
         */
        foreach ($this->getFilters() as $filter) {
            /* @var $filter \ZfcDatagrid\Filter */
            if ($filter->isColumnFilter() === true) {
                $data = array_filter($data, [
                    new PhpArray\Filter($filter),
                    'applyFilter',
                ]);
            }
        }

        /**
         * Step 3) Remove unneeded columns.
         *
         * @todo ? Better performance or let it be?
         */
        $selectedColumns = [];
        foreach ($this->getColumns() as $col) {
            if (! $col instanceof Column\Select) {
                continue;
            }

            $colString = $col->getSelectPart1();
            if ($col->getSelectPart2() != '') {
                $colString = $col->getSelectPart1().'_'.$col->getSelectPart2();
            }

            $selectedColumns[] = $colString;
        }

        foreach ($data as &$row) {
            foreach ($row as $keyRowCol => $rowCol) {
                if (! in_array($keyRowCol, $selectedColumns)) {
                    unset($row[$keyRowCol]);
                }
            }
        }

        /*
         * Step 4) Pagination
         */
        $this->setPaginatorAdapter(new PaginatorAdapter($data));
    }
1154558
function init()
    {
        // overiddable variables
        $this->file_new_name_body   = null;     // replace the name body
        $this->file_name_body_add   = null;     // append to the name body
        $this->file_name_body_pre   = null;     // prepend to the name body
        $this->file_new_name_ext    = null;     // replace the file extension
        $this->file_safe_name       = true;     // format safely the filename
        $this->file_force_extension = true;     // forces extension if there isn't one
        $this->file_overwrite       = false;    // allows overwritting if the file already exists
        $this->file_auto_rename     = true;     // auto-rename if the file already exists
        $this->dir_auto_create      = true;     // auto-creates directory if missing
        $this->dir_auto_chmod       = true;     // auto-chmod directory if not writeable
        $this->dir_chmod            = 0777;     // default chmod to use

        $this->no_script  = true;     // turns scripts into test files
        $this->mime_check = true;     // checks the mime type against the allowed list

        // these are the different MIME detection methods. if one of these method doesn't work on your
        // system, you can deactivate it here; just set it to false
        $this->mime_fileinfo     = true;     // MIME detection with Fileinfo PECL extension
        $this->mime_file         = true;     // MIME detection with UNIX file() command
        $this->mime_magic        = true;     // MIME detection with mime_magic (mime_content_type())
        $this->mime_getimagesize = true;     // MIME detection with getimagesize()

        // get the default max size from php.ini
        $this->file_max_size_raw = trim(ini_get('upload_max_filesize'));
        $this->file_max_size     = $this->getsize($this->file_max_size_raw);

        $this->image_resize  = false;    // resize the image
        $this->image_convert = '';       // convert. values :''; 'png'; 'jpeg'; 'gif'; 'bmp'

        $this->image_x                 = 150;
        $this->image_y                 = 150;
        $this->image_ratio             = false;    // keeps aspect ratio with x and y dimensions
        $this->image_ratio_crop        = false;    // keeps aspect ratio with x and y dimensions, filling the space
        $this->image_ratio_fill        = false;    // keeps aspect ratio with x and y dimensions, fitting the image in the space, and coloring the rest
        $this->image_ratio_pixels      = false;    // keeps aspect ratio, calculating x and y so that the image is approx the set number of pixels
        $this->image_ratio_no_zoom_in  = false;
        $this->image_ratio_no_zoom_out = false;
        $this->image_ratio_x           = false;    // calculate the $image_x if true
        $this->image_ratio_y           = false;    // calculate the $image_y if true
        $this->png_compression         = null;
        $this->jpeg_quality            = 85;
        $this->jpeg_size               = null;
        $this->image_interlace         = false;
        $this->preserve_transparency   = false;
        $this->image_is_transparent    = false;
        $this->image_transparent_color = null;
        $this->image_background_color  = null;
        $this->image_default_color     = '#ffffff';
        $this->image_is_palette        = false;

        $this->image_max_width  = null;
        $this->image_max_height = null;
        $this->image_max_pixels = null;
        $this->image_max_ratio  = null;
        $this->image_min_width  = null;
        $this->image_min_height = null;
        $this->image_min_pixels = null;
        $this->image_min_ratio  = null;

        $this->image_brightness        = null;
        $this->image_contrast          = null;
        $this->image_opacity           = null;
        $this->image_threshold         = null;
        $this->image_tint_color        = null;
        $this->image_overlay_color     = null;
        $this->image_overlay_opacity   = null;
        $this->image_overlay_percent   = null;
        $this->image_negative          = false;
        $this->image_greyscale         = false;
        $this->image_pixelate          = null;
        $this->image_unsharp           = false;
        $this->image_unsharp_amount    = 80;
        $this->image_unsharp_radius    = 0.5;
        $this->image_unsharp_threshold = 1;

        $this->image_text                    = null;
        $this->image_text_direction          = null;
        $this->image_text_color              = '#FFFFFF';
        $this->image_text_opacity            = 100;
        $this->image_text_percent            = 100;
        $this->image_text_background         = null;
        $this->image_text_background_opacity = 100;
        $this->image_text_background_percent = 100;
        $this->image_text_font               = 5;
        $this->image_text_x                  = null;
        $this->image_text_y                  = null;
        $this->image_text_position           = null;
        $this->image_text_padding            = 0;
        $this->image_text_padding_x          = null;
        $this->image_text_padding_y          = null;
        $this->image_text_alignment          = 'C';
        $this->image_text_line_spacing       = 0;

        $this->image_reflection_height  = null;
        $this->image_reflection_space   = 2;
        $this->image_reflection_color   = '#ffffff';
        $this->image_reflection_opacity = 60;

        $this->image_watermark             = null;
        $this->image_watermark_x           = null;
        $this->image_watermark_y           = null;
        $this->image_watermark_position    = null;
        $this->image_watermark_no_zoom_in  = true;
        $this->image_watermark_no_zoom_out = false;

        $this->image_flip        = null;
        $this->image_auto_rotate = true;
        $this->image_rotate      = null;
        $this->image_crop        = null;
        $this->image_precrop     = null;

        $this->image_bevel              = null;
        $this->image_bevel_color1       = '#FFFFFF';
        $this->image_bevel_color2       = '#000000';
        $this->image_border             = null;
        $this->image_border_color       = '#FFFFFF';
        $this->image_border_opacity     = 100;
        $this->image_border_transparent = null;
        $this->image_frame              = null;
        $this->image_frame_colors       = '#FFFFFF #999999 #666666 #000000';
        $this->image_frame_opacity      = 100;

        $this->forbidden = [];
        $this->allowed   = [
            'application/arj',
            'application/excel',
            'application/gnutar',
            'application/mspowerpoint',
            'application/msword',
            'application/octet-stream',
            'application/onenote',
            'application/pdf',
            'application/plain',
            'application/postscript',
            'application/powerpoint',
            'application/rar',
            'application/rtf',
            'application/vnd.ms-excel',
            'application/vnd.ms-excel.addin.macroEnabled.12',
            'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
            'application/vnd.ms-excel.sheet.macroEnabled.12',
            'application/vnd.ms-excel.template.macroEnabled.12',
            'application/vnd.ms-office',
            'application/vnd.ms-officetheme',
            'application/vnd.ms-powerpoint',
            'application/vnd.ms-powerpoint.addin.macroEnabled.12',
            'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
            'application/vnd.ms-powerpoint.slide.macroEnabled.12',
            'application/vnd.ms-powerpoint.slideshow.macroEnabled.12',
            'application/vnd.ms-powerpoint.template.macroEnabled.12',
            'application/vnd.ms-word',
            'application/vnd.ms-word.document.macroEnabled.12',
            'application/vnd.ms-word.template.macroEnabled.12',
            'application/vnd.oasis.opendocument.chart',
            'application/vnd.oasis.opendocument.database',
            'application/vnd.oasis.opendocument.formula',
            'application/vnd.oasis.opendocument.graphics',
            'application/vnd.oasis.opendocument.graphics-template',
            'application/vnd.oasis.opendocument.image',
            'application/vnd.oasis.opendocument.presentation',
            'application/vnd.oasis.opendocument.presentation-template',
            'application/vnd.oasis.opendocument.spreadsheet',
            'application/vnd.oasis.opendocument.spreadsheet-template',
            'application/vnd.oasis.opendocument.text',
            'application/vnd.oasis.opendocument.text-master',
            'application/vnd.oasis.opendocument.text-template',
            'application/vnd.oasis.opendocument.text-web',
            'application/vnd.openofficeorg.extension',
            'application/vnd.openxmlformats-officedocument.presentationml.presentation',
            'application/vnd.openxmlformats-officedocument.presentationml.slide',
            'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
            'application/vnd.openxmlformats-officedocument.presentationml.template',
            'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
            'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
            'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
            'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
            'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
            'application/vocaltec-media-file',
            'application/wordperfect',
            'application/x-bittorrent',
            'application/x-bzip',
            'application/x-bzip2',
            'application/x-compressed',
            'application/x-excel',
            'application/x-gzip',
            'application/x-latex',
            'application/x-midi',
            'application/xml',
            'application/x-msexcel',
            'application/x-rar',
            'application/x-rar-compressed',
            'application/x-rtf',
            'application/x-shockwave-flash',
            'application/x-sit',
            'application/x-stuffit',
            'application/x-troff-msvideo',
            'application/x-zip',
            'application/x-zip-compressed',
            'application/zip',
            'audio/*',
            'image/*',
            'multipart/x-gzip',
            'multipart/x-zip',
            'text/plain',
            'text/rtf',
            'text/richtext',
            'text/xml',
            'video/*',
            'text/csv',
        ];

        $this->mime_types = [
            'jpg'     => 'image/jpeg',
            'jpeg'    => 'image/jpeg',
            'jpe'     => 'image/jpeg',
            'gif'     => 'image/gif',
            'png'     => 'image/png',
            'bmp'     => 'image/bmp',
            'flv'     => 'video/x-flv',
            'js'      => 'application/x-javascript',
            'json'    => 'application/json',
            'tiff'    => 'image/tiff',
            'css'     => 'text/css',
            'xml'     => 'application/xml',
            'doc'     => 'application/msword',
            'docx'    => 'application/msword',
            'xls'     => 'application/vnd.ms-excel',
            'xlt'     => 'application/vnd.ms-excel',
            'xlm'     => 'application/vnd.ms-excel',
            'xld'     => 'application/vnd.ms-excel',
            'xla'     => 'application/vnd.ms-excel',
            'xlc'     => 'application/vnd.ms-excel',
            'xlw'     => 'application/vnd.ms-excel',
            'xll'     => 'application/vnd.ms-excel',
            'ppt'     => 'application/vnd.ms-powerpoint',
            'pps'     => 'application/vnd.ms-powerpoint',
            'rtf'     => 'application/rtf',
            'pdf'     => 'application/pdf',
            'html'    => 'text/html',
            'htm'     => 'text/html',
            'php'     => 'text/html',
            'txt'     => 'text/plain',
            'mpeg'    => 'video/mpeg',
            'mpg'     => 'video/mpeg',
            'mpe'     => 'video/mpeg',
            'mp3'     => 'audio/mpeg3',
            'wav'     => 'audio/wav',
            'aiff'    => 'audio/aiff',
            'aif'     => 'audio/aiff',
            'avi'     => 'video/msvideo',
            'wmv'     => 'video/x-ms-wmv',
            'mov'     => 'video/quicktime',
            'zip'     => 'application/zip',
            'tar'     => 'application/x-tar',
            'swf'     => 'application/x-shockwave-flash',
            'odt'     => 'application/vnd.oasis.opendocument.text',
            'ott'     => 'application/vnd.oasis.opendocument.text-template',
            'oth'     => 'application/vnd.oasis.opendocument.text-web',
            'odm'     => 'application/vnd.oasis.opendocument.text-master',
            'odg'     => 'application/vnd.oasis.opendocument.graphics',
            'otg'     => 'application/vnd.oasis.opendocument.graphics-template',
            'odp'     => 'application/vnd.oasis.opendocument.presentation',
            'otp'     => 'application/vnd.oasis.opendocument.presentation-template',
            'ods'     => 'application/vnd.oasis.opendocument.spreadsheet',
            'ots'     => 'application/vnd.oasis.opendocument.spreadsheet-template',
            'odc'     => 'application/vnd.oasis.opendocument.chart',
            'odf'     => 'application/vnd.oasis.opendocument.formula',
            'odb'     => 'application/vnd.oasis.opendocument.database',
            'odi'     => 'application/vnd.oasis.opendocument.image',
            'oxt'     => 'application/vnd.openofficeorg.extension',
            'docx'    => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
            'docm'    => 'application/vnd.ms-word.document.macroEnabled.12',
            'dotx'    => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
            'dotm'    => 'application/vnd.ms-word.template.macroEnabled.12',
            'xlsx'    => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
            'xlsm'    => 'application/vnd.ms-excel.sheet.macroEnabled.12',
            'xltx'    => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
            'xltm'    => 'application/vnd.ms-excel.template.macroEnabled.12',
            'xlsb'    => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
            'xlam'    => 'application/vnd.ms-excel.addin.macroEnabled.12',
            'pptx'    => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
            'pptm'    => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
            'ppsx'    => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
            'ppsm'    => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12',
            'potx'    => 'application/vnd.openxmlformats-officedocument.presentationml.template',
            'potm'    => 'application/vnd.ms-powerpoint.template.macroEnabled.12',
            'ppam'    => 'application/vnd.ms-powerpoint.addin.macroEnabled.12',
            'sldx'    => 'application/vnd.openxmlformats-officedocument.presentationml.slide',
            'sldm'    => 'application/vnd.ms-powerpoint.slide.macroEnabled.12',
            'thmx'    => 'application/vnd.ms-officetheme',
            'onetoc'  => 'application/onenote',
            'onetoc2' => 'application/onenote',
            'onetmp'  => 'application/onenote',
            'onepkg'  => 'application/onenote',
            'csv'     => 'text/csv',
        ];
    }
838092
public function execute() {
        $this->log
            ->printAsMessage()
            ->info($this->getDescription())
            ->printEmptyLine()
            ->printAsOutput();

        $appName = $this->config['composer']['extra']['name'];

        $configDir = '.';

        switch (strtolower(substr(PHP_OS, 0, 3))) {
            case 'win':
                if (array_key_exists('LOCALAPPDATA', $_SERVER) &&
                    is_string($_SERVER['LOCALAPPDATA']) &&
                    strlen($_SERVER['LOCALAPPDATA']) > 0) {
                    $configDir = sprintf('%s\\%s', $_SERVER['LOCALAPPDATA'], $appName);
                }
                break;
            default:
                if (array_key_exists('USER', $_SERVER) &&
                    $_SERVER['USER'] !== 'root' &&
                    array_key_exists('HOME', $_SERVER) &&
                    is_string($_SERVER['HOME']) &&
                    strlen($_SERVER['HOME']) > 0) {
                    $configDir = sprintf('%s/.%s', $_SERVER['HOME'], $appName);
                } elseif (array_key_exists('USER', $_SERVER) &&
                    $_SERVER['USER'] === 'root') {
                    $configDir = sprintf('/etc/%s', $appName);
                }
                break;
        }

        $configFile = $configDir . DIRECTORY_SEPARATOR . 'config.json';

        $schemaFile = $this->config['appDir'] . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'schema.json';

        $this->log->notice('This command will ask you several questions.');
        $this->log->notice(
            'After that a configuration file will be written to %s.',
            $configFile
        );
        $this->log->notice('If you are unsure what to do please refer to the documentation.');

        if (file_exists($configFile)) {
            $this->log->notice('Configuration file already exists.');

            if (!$this->askForPermission('Do you want to overwrite it?')) {
                $this->log->notice('Skipping');
                return $this;
            }

            $this->log->debug('Create backup of old configuration file…');
        }

        $rules = JSONFile::read($schemaFile);

        $config = $this->walk($rules, $this->config);

        $this->createDir($configDir);

        if (file_exists($configFile)) {
            $backupFile = sprintf(
                '%s%sconfig_%s.json',
                DIRECTORY_SEPARATOR,
                $configDir,
                date('Y-m-d_His')
            );

            $this->log->info(
                'Create backup of old configuration file and write it to "%s"…',
                $backupFile
            );

            $this->copyFile($configFile, $backupFile);
        }

        $this->log->info('Write configuration settings to file…');

        JSONFile::write($configFile, $config);

        $this->log->info(
            'All configuration steps completed. Your settings are stored to:

    %1$s

Validate your configuration settings with:

    %2$s configtest',
            $configFile,
            $this->config['args'][0]
        );

        return $this;
    }
439120
public function main()
    {
        try {
            // Initialize page and all elements from here
            $this->initLayout();
        } catch (Exception $e) {
            if (!($e instanceof Exception_Stop)) {
                return $this->caughtException($e);
            }
            //$this->caughtException($e);
        }

        try {
            $this->hook('post-init');
            $this->hook('afterInit');

            $this->hook('pre-exec');
            $this->hook('beforeExec');

            if (isset($_GET['submit']) && $_POST) {
                $this->hook('submitted');
            }

            $this->hook('post-submit');
            $this->hook('afterSubmit');

            $this->execute();
        } catch (Exception $e) {
            $this->caughtException($e);
        }
        $this->hook('saveDelayedModels');
    }
1011647
public function execute()
    {
        $to_compare = func_get_arg(0);
        
        if (is_string($this->value) && is_string($to_compare)) {
            $result = strlen($this->value) >= strlen($to_compare) ? true : false;
        }
        elseif ((is_int($this->value) && is_int($to_compare)) || (is_float($this->value) && is_float($to_compare))) {
            $result = $this->value >= $to_compare ? true : false;
        }
        else {
            $result = false;
        }
        
        if (!$result) {
            $this->msg = 'validator.rule.bigger_or_equal';
        }
    }
935544
public function process()
    {
        // {{{ defines the xhtml template

        static $xhtml_template = '';

        if ($xhtml_template == '') {
            $doctype =
                '<!DOCTYPE html PUBLIC ' .
                '"-//W3C//DTD XHTML 1.0 Strict//EN" ' .
                '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' .
                "\n";

            $xhtml_template =
                $doctype .
                <<<XHTML
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
		<title>SwatXHTMLTextarea Content</title>
	</head>
	<body>
		<div>
		%s
		</div>
	</body>
</html>

XHTML;
        }

        // }}}

        parent::process();

        $ignore_validation_errors =
            $this->allow_ignore_validation_errors &&
            $this->ignore_errors_checkbox->value;

        $xhtml_content = sprintf($xhtml_template, $this->getXHTMLContent());

        $errors = libxml_use_internal_errors(true);

        $document = new DOMDocument();
        $document->loadXML(
            $xhtml_content,
            LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_DTDVALID
        );

        $xml_errors = libxml_get_errors();
        libxml_clear_errors();
        libxml_use_internal_errors($errors);

        if (count($xml_errors) > 0 && !$ignore_validation_errors) {
            $this->addMessage($this->getValidationErrorMessage($xml_errors));
            $this->has_validation_errors = true;
        }
    }
435107
public function process()
    {
        parent::process();

        if ($this->value === null) {
            return;
        }

        $this->value = trim($this->value);

        if ($this->value == '') {
            $this->value = null;
            return;
        }

        if (!$this->validateUri($this->value)) {
            if (
                $this->validateUri($this->default_scheme . '://' . $this->value)
            ) {
                if ($this->scheme_required) {
                    $this->addMessage(
                        $this->getValidationMessage('scheme-required')
                    );
                } else {
                    $this->value = $this->default_scheme . '://' . $this->value;
                }
            } else {
                $this->addMessage($this->getValidationMessage('invalid-uri'));
            }
        }
    }
1335945
static int isNewLine(int[] chars)
  {
    checkArgument(chars.length > 1);
    // nl \n|\r\n|\r|\f
    if (chars[0] == '\r' && chars[1] == '\n')
    {
      return 2;
    }
    else if (chars[0] == '\n' || chars[0] == '\r' || chars[0] == '\f')
    {
      return 1;
    }
    return 0;
  }
241093
public function input($input) {
        if(isset($this->inputs->$input)) 
            return $this->inputs->$input;
        return null;
    }
455772
@Override
    String sourceContentFor(String aSource, Boolean nullOnMissing) {
        if (this.sourcesContent == null) {
            return null;
        }

        if (this.sourceRoot != null) {
            aSource = Util.relative(this.sourceRoot, aSource);
        }

        if (this._sources.has(aSource)) {
            return this.sourcesContent.get(this._sources.indexOf(aSource));
        }

        ParsedUrl url;
        if (this.sourceRoot != null && ((url = Util.urlParse(this.sourceRoot)) != null)) {
            // XXX: file:// URIs and absolute paths lead to unexpected behavior for
            // many users. We can help them out when they expect file:// URIs to
            // behave like it would if they were running a local HTTP server. See
            // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
            String fileUriAbsPath = aSource.replaceAll("^file://", "");
            if (url.scheme.equals("file") && this._sources.has(fileUriAbsPath)) {
                return this.sourcesContent.get(this._sources.indexOf(fileUriAbsPath));
            }

            if ((url.path == null || url.path.equals("/")) && this._sources.has("/" + aSource)) {
                return this.sourcesContent.get(this._sources.indexOf("/" + aSource));
            }
        }

        // This function is used recursively from
        // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we
        // don't want to throw if we can't find the source - we just want to
        // return null, so we provide a flag to exit gracefully.
        if (nullOnMissing != null && nullOnMissing) {
            return null;
        } else {
            throw new RuntimeException("\"" + aSource + "\" is not in the SourceMap.");
        }
    }
1033482
public function process()
    {
        parent::process();

        if ($this->value === null) {
            return;
        }

        try {
            $integer_value = $this->getNumericValue($this->value);

            if ($integer_value === null) {
                $this->addMessage($this->getValidationMessage('integer'));
            } else {
                $this->value = $integer_value;
            }
        } catch (SwatIntegerOverflowException $e) {
            if ($e->getSign() > 0) {
                $this->addMessage(
                    $this->getValidationMessage('integer-maximum')
                );
            } else {
                $this->addMessage(
                    $this->getValidationMessage('integer-minimum')
                );
            }

            $integer_value = null;
        }
    }
3113
public function execute($n)
    {
        $stack = array();
        $i = 0;
        $total = count($this->tokens);
        while ($i < $total) {
            $next = $this->tokens[$i];
            $i++;
            if ($next[0] === 'var') {
                $stack[] = $n;
                continue;
            } elseif ($next[0] === 'value') {
                $stack[] = $next[1];
                continue;
            }

            // Only operators left.
            switch ($next[1]) {
                case '%':
                    $v2 = array_pop($stack);
                    $v1 = array_pop($stack);
                    $stack[] = $v1 % $v2;
                    break;

                case '||':
                    $v2 = array_pop($stack);
                    $v1 = array_pop($stack);
                    $stack[] = $v1 || $v2;
                    break;

                case '&&':
                    $v2 = array_pop($stack);
                    $v1 = array_pop($stack);
                    $stack[] = $v1 && $v2;
                    break;

                case '<':
                    $v2 = array_pop($stack);
                    $v1 = array_pop($stack);
                    $stack[] = $v1 < $v2;
                    break;

                case '<=':
                    $v2 = array_pop($stack);
                    $v1 = array_pop($stack);
                    $stack[] = $v1 <= $v2;
                    break;

                case '>':
                    $v2 = array_pop($stack);
                    $v1 = array_pop($stack);
                    $stack[] = $v1 > $v2;
                    break;

                case '>=':
                    $v2 = array_pop($stack);
                    $v1 = array_pop($stack);
                    $stack[] = $v1 >= $v2;
                    break;

                case '!=':
                    $v2 = array_pop($stack);
                    $v1 = array_pop($stack);
                    $stack[] = $v1 != $v2;
                    break;

                case '==':
                    $v2 = array_pop($stack);
                    $v1 = array_pop($stack);
                    $stack[] = $v1 == $v2;
                    break;

                case '?:':
                    $v3 = array_pop($stack);
                    $v2 = array_pop($stack);
                    $v1 = array_pop($stack);
                    $stack[] = $v1 ? $v2 : $v3;
                    break;

                default:
                    throw new Exception(sprintf('Unknown operator "%s"', $next[1]));
            }
        }

        if (count($stack) !== 1) {
            throw new Exception('Too many values remaining on the stack');
        }

        return (int) $stack[0];
    }
749251
public function send() {
        $content = '';

        foreach ($this->_message as $message) {
            $content .= $message;
        }

        foreach ($this->_receiver as $receiver) {
            $this->_backline = $this->_setBackLine($receiver);

            //Create the header
            $header = "From: \"" . $this->_sender[0] . "\" <" . $this->_sender[1] . ">" . $this->_backline;
            $header .= "Reply-to: \"" . $this->_reply[0] . "\" <" . $this->_reply[1] . ">" . $this->_backline;
            $header .= "MIME-Version: 1.0" . $this->_backline;

            foreach ($this->_cc as $cc) {
                $header .= "Cc: " . $cc . "" . $this->_backline;
            }

            foreach ($this->_bcc as $bcc) {
                $header .= "Bcc: " . $bcc . "" . $this->_backline;
            }

            foreach ($this->_reception as $reception) {
                $header .= "DispositionNotificationTo: " . $reception . "" . $this->_backline;
            }

            $header .= "Content-Type: " . $this->_fileTransfert . ";" . $this->_backline . " boundary=\"" . $this->_boundary . "\"" . $this->_backline;

            //Create the message
            $message = $this->_backline . "--" . $this->_boundary . $this->_backline;
            $message .= "Content-Type: multipart/alternative;" . $this->_backline . " boundary=\"" . $this->_boundaryAlt . "\"" . $this->_backline;
            $message .= $this->_backline . "--" . $this->_boundaryAlt . $this->_backline;

            if ($this->_formatHtml == self::FORMAT_HTML) {
                $message .= "Content-Type: text/html; charset=\"" . $this->_charset . "\"" . $this->_backline;
                $message .= "Content-Transfer-Encoding: 8bit" . $this->_backline;
                $message .= $this->_backline . $content . $this->_backline;
            }
            elseif ($this->_formatHtml == self::FORMAT_TEXT) {
                $message .= "Content-Type: text/plain; charset=\"" . $this->_charset . "\"" . $this->_backline;
                $message .= "Content-Transfer-Encoding: 8bit" . $this->_backline;
                $message .= $this->_backline . $content . $this->_backline;
            }

            //We close the boundaries
            $message .= $this->_backline . "--" . $this->_boundaryAlt . "--" . $this->_backline;

            foreach ($this->_attachments as $key => $value) {
                $message .= $this->_backline . "--" . $this->_boundary . $this->_backline;
                $message .= "Content-Type: " . $value[1] . "; name=\"" . $key . "\"" . $this->_backline;
                $message .= "Content-Transfer-Encoding: base64" . $this->_backline;
                $message .= "Content-Disposition: attachment; filename=\"" . $key . "\"" . $this->_backline;
                $message .= $this->_backline . $value[0] . $this->_backline . $this->_backline;
            }

            $message .= $this->_backline . "--" . $this->_boundary . "--" . $this->_backline;

            if (Config::config()['user']['mail']['enabled']) {
                mail($receiver, $this->_subject, $message, $header);
            }
        }
    }
500489
static function basic($string, $filterIn = array("Tidy","Dom","Striptags"), $filterOut = "none") {
        $string = self::tidyUp($string, $filterIn);
        $string = str_replace(array("&amp;", "&lt;", "&gt;"), array("&amp;amp;", "&amp;lt;", "&amp;gt;"), $string);
        
        // fix &entitiy\n;
        $string = preg_replace('#(&\#*\w+)[\x00-\x20]+;#u', "$1;", $string);
        $string = preg_replace('#(&\#x*)([0-9A-F]+);*#iu', "$1$2;", $string);

        $string = html_entity_decode($string, ENT_COMPAT, "UTF-8");
        
        // remove any attribute starting with "on" or xmlns
        $string = preg_replace('#(<[^>]+[\x00-\x20\"\'\/])(on|xmlns)[^>]*>#iUu', "$1>", $string);
        
        // remove javascript: and vbscript: protocol
        $string = preg_replace('#([a-z]*)[\x00-\x20\/]*=[\x00-\x20\/]*([\`\'\"]*)[\x00-\x20\/]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iUu', '$1=$2nojavascript...', $string);
        $string = preg_replace('#([a-z]*)[\x00-\x20\/]*=[\x00-\x20\/]*([\`\'\"]*)[\x00-\x20\/]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iUu', '$1=$2novbscript...', $string);
        $string = preg_replace('#([a-z]*)[\x00-\x20\/]*=[\x00-\x20\/]*([\`\'\"]*)[\x00-\x20\/]*-moz-binding[\x00-\x20]*:#Uu', '$1=$2nomozbinding...', $string);
        $string = preg_replace('#([a-z]*)[\x00-\x20\/]*=[\x00-\x20\/]*([\`\'\"]*)[\x00-\x20\/]*data[\x00-\x20]*:#Uu', '$1=$2nodata...', $string);
        
        //remove any style attributes, IE allows too much stupid things in them, eg.
        //<span style="width: expression(alert('Ping!'));"></span> 
        // and in general you really don't want style declarations in your UGC

        $string = preg_replace('#(<[^>]+[\x00-\x20\"\'\/])style[^>]*>#iUu', "$1>", $string);

        //remove namespaced elements (we do not need them...)
        $string = preg_replace('#</*\w+:\w[^>]*>#i', "", $string);
        
        //remove really unwanted tags
        do {
            $oldstring = $string;
            $string = preg_replace('#</*(applet|meta|xml|blink|link|style|script|embed|object|iframe|frame|frameset|ilayer|layer|bgsound|title|base)[^>]*>#i', "", $string);
        } while ($oldstring != $string);
        
        return self::tidyUp($string, $filterOut);
    }
951710
public function execute()
    {
        if (count($this->_filecontent)>0) {
            foreach ($this->prog_items as $item) if (isset($this->_filecontent[$item])) {
                if ($item !== 'idrac') {
                    if (!is_null($buffer = $this->_filecontent[$item]) && (($buffer = trim($buffer)) != "")) {
                        switch ($item) {
                            case 'mdstat':
                                $this->execute_mdstat($buffer);
                                break;
                            case 'dmraid':
                                $this->execute_dmraid($buffer);
                                break;
                            case 'megactl':
                                $this->execute_megactl($buffer, false);
                                break;
                            case 'megasasctl':
                                $this->execute_megactl($buffer, true);
                                break;
                            case 'graid':
                                $this->execute_graid($buffer);
                                break;
                            case 'zpool':
                                $this->execute_zpool($buffer);
                                break;
                        }
                    }
                } else {
                    if (is_array($this->_filecontent[$item])) {
                        foreach ($this->_filecontent[$item] as $device=>$buffer) if (($buffer = trim($buffer)) != "") {
                            $this->execute_idrac($buffer, /*'idrac-'.*/$device);
                        }
                    }
                }
            }
        }
    }