コード例 #1
0
 function decode($data, $decode_parms)
 {
     $data = decompress($data);
     $predictor = 1;
     if ($decode_parms) {
         $predictor = $decode_parms['/Predictor'];
     }
     if (!$predictor) {
         $predictor = 1;
     }
     if ($predictor != 1) {
         $columns = $decode_parms['/Columns'];
         if ($predictor >= 10 && $predictor <= 15) {
             $output = '';
             $rowlength = $columns + 1;
             assert(strlen($data) % $rowlength == 0);
             $prev_rowdata = array_fill(0, $rowlength, 0);
             for ($row = 0; $row < strlen($data) / $rowlength; $row++) {
                 $rowdata = array();
                 $k = 0;
                 for ($j = $row * $rowlength; $j < ($row + 1) * $rowlength; $j++) {
                     $rowdata[$k] = ord($data[$j]);
                     $k += 1;
                 }
                 $filter_byte = $rowdata[0];
                 if ($filter_byte == 0) {
                 } else {
                     if ($filter_byte == 1) {
                         for ($j = 2; $j < $rowlength; $j++) {
                             $rowdata[$j] = ($rowdata[$j] + $rowdata[$j - 1]) % 256;
                         }
                     } else {
                         if ($filter_byte == 2) {
                             for ($j = 1; $j < $rowlength; $j++) {
                                 $rowdata[$j] = ($rowdata[$j] + $prev_rowdata[$j]) % 256;
                             }
                         } else {
                             die("Error reading PDF: unsupported PNG filter {$filter_byte}.");
                         }
                     }
                 }
                 $prev_rowdata = $rowdata;
                 for ($j = 1; $j < count($rowdata); $j++) {
                     $output .= chr($rowdata[$j]);
                 }
             }
             $data = $output;
         } else {
             die("Error reading PDF: unsupported flatedecode predictor {$predictor}.");
         }
     }
     return $data;
 }
コード例 #2
0
/**
 * Checks an extension with a given MD5 checksum file.
 *
 * @param string $path Path to md5 file
 * @param array $extensionPaths Indexed array: First folder in md5 file path as key - extension path as value
 *
 * @return array Array of errors
 */
function checkMD5File($path, $extensionPaths)
{
    jimport('joomla.filesystem.file');
    $lines = explode("\n", JFile::read($path));
    $errors = array();
    $errors[0] = 0;
    //counter..
    foreach ($lines as $line) {
        if (!trim($line)) {
            continue;
        }
        list($md5, $subPath) = explode(' ', $line);
        $pos = strpos($subPath, '@');
        $path = $subPath;
        $file = '';
        if ($pos !== false) {
            $compressed = substr($subPath, 0, $pos);
            $file = substr($subPath, $pos + 1);
            $path = decompress($compressed) . '/' . $file;
        }
        $parts = explode(DS, $path);
        if (!array_key_exists($parts[0], $extensionPaths)) {
            continue;
        }
        $path = $extensionPaths[$parts[0]] . DS . substr($path, strlen($parts[0]) + 1);
        echo JDEBUG ? $path . '...' : '';
        $errors[0]++;
        if (!JFile::exists($path)) {
            $errors[] = JText::sprintf('File not found: %s', $path);
            echo JDEBUG ? 'not found<br />' : '';
            continue;
        }
        if (md5_file($path) != $md5) {
            $errors[] = sprintf(jgettext('MD5 check failed on file: %s'), $path);
            echo JDEBUG ? 'md5 check failed<br />' : '';
            continue;
        }
        echo JDEBUG ? 'OK<br />' : '';
    }
    //foreach
    return $errors;
}
コード例 #3
0
         $counter++;
         touch($dest, $preserveTimestamp);
     }
 } elseif ($massType == 'copy') {
     $dest = $massPath . basename($path);
     if (is_dir($path)) {
         if (copys($path, $dest) > 0) {
             $counter++;
         }
     } elseif (is_file($path)) {
         if (copy($path, $dest)) {
             $counter++;
         }
     }
 } elseif ($massType == 'untar' || $massType == 'untargz' || $massType == 'unzip') {
     if (decompress($massType, $path, $massValue)) {
         $counter++;
         return $counter;
     }
 } elseif (!empty($massValue)) {
     if ($massType == 'chmod') {
         if (chmod($path, octdec($massValue))) {
             $counter++;
         }
     } elseif ($massType == 'chown') {
         if (chown($path, $massValue)) {
             $counter++;
         }
     } elseif ($massType == 'touch') {
         if (touch($path, strtotime($massValue))) {
             $counter++;
コード例 #4
0
ファイル: install.php プロジェクト: uiDeveloper116/webstore
function zipAndFolders()
{
    if (isset($_POST['debug'])) {
        error_log(__FUNCTION__, 3, "error.txt");
    }
    //if we've already downloaded and extracted, don't do it twice
    if (!file_exists('core') && file_exists("webstore.zip")) {
        if (isset($_POST['debug'])) {
            error_log("decompressing webstore.zip", 3, "error.txt");
        }
        decompress("webstore.zip");
        if (isset($_POST['debug'])) {
            error_log("removing webstore.zip", 3, "error.txt");
        }
        if (!isset($_POST['debug'])) {
            @unlink("webstore.zip");
        }
    }
    // Verify the cache folders exist and if not, create them
    // These may fail if cache isn't yet writable, so we ignore errors
    // and will get them again after fixing cache
    if (!file_exists('assets')) {
        @mkdir('assets');
    }
    if (!file_exists('runtime')) {
        @mkdir('runtime');
    }
    if (!file_exists('runtime/cache')) {
        @mkdir('runtime/cache');
    }
    if (!file_exists('themes')) {
        @mkdir('themes');
    }
}
コード例 #5
0
     if (!db_truncate_table($table)) {
         $success = 2;
     }
     $table_cleared[$prefix . $table] = true;
     set_time_limit(60);
 }
 $row = substr($string, $sep + strlen(TABLE_SEPARATOR));
 $row = unserialize($row);
 $items = '';
 $values = '';
 foreach ($row as $key => $element) {
     if (array_search($key, $tables[$prefix . $table]) === false) {
         $missing_element[] = $table . '->' . $key;
     } else {
         if (!empty($element)) {
             $element = decompress($element);
         }
         $items .= '`' . $key . '`,';
         if (is_null($element)) {
             $values .= 'NULL,';
         } else {
             $values .= db_quote($element) . ',';
         }
     }
 }
 if (!empty($items)) {
     if ($table != 'options' || strpos($values, 'zenphoto_release') === false) {
         $items = substr($items, 0, -1);
         $values = substr($values, 0, -1);
         $sql = 'INSERT INTO ' . prefix($table) . ' (' . $items . ') VALUES (' . $values . ')';
         if (!query($sql, false)) {
コード例 #6
0
ファイル: auae.php プロジェクト: dapfru/gladiators
            }
            if (isset($_POST['newdirperms'])) {
                $new_dir_perms_on = TRUE;
                $new_dir_perms = $_POST['cmodmodedirs'];
                $new_dir_perms = preg_replace('/[^0-7]*/', '', $new_dir_perms);
                $new_dir_perms = substr($new_dir_perms, 0, 3);
            } else {
                $new_dir_perms_on = FALSE;
            }
            if (isset($_POST['overwrite'])) {
                $fileoverwrite = TRUE;
            } else {
                $fileoverwrite = FALSE;
            }
        }
        $path_result = decompress($site_root, $selarchive);
        _gettpl('decompress');
        break;
    default:
        $conf['step_id'] = 'testserver';
        _gettpl('welcome');
}
function pattern($matches)
{
    global $conf;
    return $conf[$matches[1]];
}
function _gettpl($install_step)
{
    global $conf, $used_langs, $site_root, $path_result, $this_script_dir;
    switch ($install_step) {