Exemple #1
0
<?php

include_once 'hal.php';
$parse_main['{content}'] = '';
//страница просмотра
if (isset($_REQUEST['v']) and !$_POST) {
    if (preg_match('/(\\d{4}-\\d{2})-(\\d{2})_(.*)/', $_REQUEST['v'], $matches)) {
        $date = $matches[1];
        $day = $matches[2];
        $filename = $matches[3];
        if (file_exists($config['uploaddir'] . $date . "/" . $day . "/" . $filename)) {
            make_img_code($filename, $date, $day);
        }
    }
}
if (isset($images_array)) {
    $urls_quantity = count($images_array);
} else {
    $urls_quantity = 0;
}
if ($urls_quantity >= 1) {
    $view_one_template = get_template('view_one');
    foreach ($images_array as $img_filename => $img) {
        if ($img['error']) {
            $parse_main['{content}'] .= parse_template(get_template('info'), array("{type}" => 'error', "{title}" => "Ошибка!", "{text}" => "Изображение не загружено. " . $img['error']));
        } else {
            $info = getimagesize($img['local_path']);
            $stat = stat($img['local_path']);
            $width = $info['0'];
            $height = $info['1'];
            $size = formatfilesize($stat['size']);
Exemple #2
0
                        make_img_code($final_filename, false, false, $returned_error);
                    }
                }
            }
        }
        if (isset($_FILES['local_uploadfile'])) {
            $local_up = $_FILES['local_uploadfile'];
            foreach ($local_up['name'] as $key => $check) {
                if (empty($check)) {
                    foreach ($local_up as $type => $value) {
                        unset($local_up[$type][$key]);
                    }
                }
            }
            // Local uploading
            if (isset($local_up['size'][0]) and $local_up['size'][0] == !null) {
                foreach ($local_up['tmp_name'] as $key => $up) {
                    $filename = $local_up['name'][$key];
                    if (!@copy($up, "{$config['working_dir']}{$filename}")) {
                        $returned_error = "Ошибка загрузки изображения.";
                        $final_filename = $filename;
                    } else {
                        list($final_filename, $returned_error) = check_and_move($filename);
                    }
                    unset($up);
                    make_img_code($final_filename, false, false, $returned_error);
                }
            }
        }
    }
}