Пример #1
0
 function assignVariables()
 {
     if (isset($_POST['recheck'])) {
         $error = '';
         $test = testFileUploads('cksumdat');
         if (isset($test->error)) {
             $error = $test->error;
         } elseif (count($test->files) > 1) {
             $error = ilang('upload_file_multiple');
         } else {
             if (isset($test->files[0]['error_string'])) {
                 $error = $test->files[0]['error_string'];
             } else {
                 $checksum_file = $test->files[0]['tmp_name'];
                 if ($this->debug) {
                     $handle = fopen($checksum_file, 'rb');
                 } else {
                     $handle = @fopen($checksum_file, 'rb');
                 }
                 if (!$handle) {
                     $error = ilang('upload_file_no_readable');
                 }
             }
         }
         if (empty($error)) {
             $results = array();
             while (!feof($handle)) {
                 $line = @fgets($handle, 4096);
                 $line = trim($line);
                 // clean
                 if (empty($line)) {
                     continue;
                 }
                 // skip empty line
                 $pos = strpos($line, '#');
                 if ($pos) {
                     $line = substr($line, 0, $pos);
                 }
                 // strip out comments
                 list($md5sum, $file) = explode(' *./', $line, 2);
                 // split it into fields
                 $md5sum = trim($md5sum);
                 $file = trim($file);
                 $file = str_replace('/', DIRECTORY_SEPARATOR, $file);
                 // avoid windows suck
                 $test_file = CMS_BASE . DIRECTORY_SEPARATOR . $file;
                 $test = testFileChecksum(0, '', $test_file, $md5sum, '', ilang('format_datetime'), $this->debug);
                 if ($test->res == 'green') {
                     continue;
                 }
                 // ok, skip
                 $results[] = $test;
             }
             @fclose($handle);
             if (count($results) > 0) {
                 $this->smarty->assign('results', $results);
                 $this->smarty->assign('error_fragment', 'Checksum_report_errors');
             }
             $this->smarty->assign('try_test', true);
         } else {
             $this->errors[] = $error;
         }
     }
     $this->smarty->assign('errors', $this->errors);
 }
Пример #2
0
}
// INIT
$config_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config.php';
if (file_exists($config_file)) {
    @(include_once $config_file);
    $root_path = $config['root_path'];
}
if (!isset($root_path) || !is_dir($root_path)) {
    $root_path = dirname(__FILE__);
}
/*********************************************
 install/lib/classes/CMSInstallPage1.class.php
 *********************************************/
if (isset($_POST['recheck'])) {
    $error = '';
    $test = testFileUploads('cksumdat');
    if (isset($test->error)) {
        $error = $test->error;
    } elseif (count($test->files) > 1) {
        $error = lang('upload_file_multiple');
    } else {
        if (isset($test->files[0]['error_string'])) {
            $error = $test->files[0]['error_string'];
        } else {
            $checksum_file = $test->files[0]['tmp_name'];
            if ($debug) {
                $handle = fopen($checksum_file, 'rb');
            } else {
                $handle = @fopen($checksum_file, 'rb');
            }
            if (!$handle) {