コード例 #1
0
ファイル: picman.php プロジェクト: Parashutik/ReloadCMS
include RCMS_ROOT_PATH . 'common.php';
global $system, $lightbox_config;
$ins = get('ins');
$form = get('form');
$url_inc = $ins ? '?ins=' . $ins . '&form=' . $form : '?ins=0';
$msg = '';
$insertlink = '';
function user_can_delete($file)
{
    if (!empty($file) && $file != '.' && $file != '..') {
        return true;
    } else {
        return false;
    }
}
if (!user_can_upload_images()) {
    return false;
}
$start_path = realpath(RCMS_ROOT_PATH . 'uploads/');
if (!empty($lightbox_config['distribute_enable'])) {
    if (!cfr('GENERAL')) {
        $start_path .= $system->user['username'];
    }
    if (!@is_dir($start_path)) {
        $msg = __('Nothing founded');
        rcms_mkdir(RCMS_ROOT_PATH . 'uploads/' . $system->user['username']);
        //rcms_redirect('');
    }
}
if (empty($_GET['path'])) {
    $user_path = $start_path;
コード例 #2
0
ファイル: picloader.php プロジェクト: Parashutik/ReloadCMS
<?php

//Preparations
define('RCMS_ROOT_PATH', './');
//define('AJAX', true);
require_once RCMS_ROOT_PATH . 'common.php';
global $lightbox_config, $system;
$folder = FILES_PATH;
$user = $system->user['username'];
//Main process
//Пользователь имеет право на загрузку?
if (!user_can_upload_images() or $user == '_thumb') {
    echo __('Access denied');
    return false;
}
//Загружен файл?
if (empty($_FILES['uploadfile'])) {
    echo __('No file');
    return false;
}
//Это картинка?
if (!($size = getimagesize($_FILES['uploadfile']['tmp_name']))) {
    echo __('Your file is not an image or is corrupted') . ' (' . $_FILES['uploadfile']['name'] . ')';
    return false;
}
//Сохраним данные изображения
$width = $size[0];
$height = $size[1];
switch ($size[2]) {
    case 1:
        $image_type = 'gif';