S('class/uploader')->sendToSae() S('class/uploader')->sendToKupan() S('class/uploader')->sendToQiniu() S('class/uploader')->sendToTietu()
저자: suconghou
 public function run()
 {
     Yii::import('ext.editMe.vendors.kcfinder.core.*');
     Yii::import('ext.editMe.vendors.kcfinder.lib.*');
     $uploader = new uploader();
     $uploader->upload();
 }
예제 #2
0
 public function __construct()
 {
     parent::__construct();
     if (isset($this->post['dir'])) {
         $dir = $this->checkInputDir($this->post['dir'], true, false);
         if ($dir === false) {
             unset($this->post['dir']);
         }
         $this->post['dir'] = $dir;
     }
     if (isset($this->get['dir'])) {
         $dir = $this->checkInputDir($this->get['dir'], true, false);
         if ($dir === false) {
             unset($this->get['dir']);
         }
         $this->get['dir'] = $dir;
     }
     $thumbsDir = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'];
     $this->initThumbsDir($thumbsDir);
     $this->thumbsDir = $thumbsDir;
     $this->thumbsTypeDir = "{$thumbsDir}/{$this->type}";
     // Remove temporary zip downloads if exists
     $files = dir::content($this->config['uploadDir'], array('types' => "file", 'pattern' => '/^.*\\.zip$/i'));
     if (is_array($files) && count($files)) {
         $time = time();
         foreach ($files as $file) {
             if (is_file($file) && $time - filemtime($file) > 3600) {
                 unlink($file);
             }
         }
     }
     if (isset($this->get['theme']) && $this->get['theme'] == $this->my_basename($this->get['theme']) && is_dir("themes/{$this->get['theme']}")) {
         $this->config['theme'] = $this->get['theme'];
     }
 }
예제 #3
0
파일: browser.php 프로젝트: unisexx/adf16
 public function __construct()
 {
     parent::__construct();
     if (isset($this->post['dir'])) {
         $dir = $this->checkInputDir($this->post['dir'], true, false);
         if ($dir === false) {
             unset($this->post['dir']);
         }
         $this->post['dir'] = $dir;
     }
     if (isset($this->get['dir'])) {
         $dir = $this->checkInputDir($this->get['dir'], true, false);
         if ($dir === false) {
             unset($this->get['dir']);
         }
         $this->get['dir'] = $dir;
     }
     $thumbsDir = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'];
     if (!is_dir($thumbsDir) && !@mkdir($thumbsDir, $this->config['dirPerms']) || !is_readable($thumbsDir) || !dir::isWritable($thumbsDir) || !is_dir("{$thumbsDir}/{$this->type}") && !@mkdir("{$thumbsDir}/{$this->type}", $this->config['dirPerms'])) {
         $this->errorMsg("Cannot access or create thumbnails folder.");
     }
     $this->thumbsDir = $thumbsDir;
     $this->thumbsTypeDir = "{$thumbsDir}/{$this->type}";
     // Remove temporary zip downloads if exists
     $files = dir::content($this->config['uploadDir'], array('types' => "file", 'pattern' => '/^.*\\.zip$/i'));
     if (is_array($files) && count($files)) {
         $time = time();
         foreach ($files as $file) {
             if (is_file($file) && $time - filemtime($file) > 3600) {
                 unlink($file);
             }
         }
     }
 }
예제 #4
0
function UploadFoto()
{
    require "modulos/fileupload/fileupload-class.php";
    $full = "productos_img/";
    //$mini = "productos_img/";
    $my_uploader = new uploader();
    $success = $my_uploader->upload("file", "", ".jpg");
    if ($success) {
        $modo = 2;
        $success = $my_uploader->save_file($full, $modo);
        if (!$success) {
            return false;
        }
        return $my_uploader->file['name'];
    }
    return false;
}
예제 #5
0
파일: newsEdit.php 프로젝트: btbj/wechat
 private function uploadImg()
 {
     if (isset($_POST['upfile']) || $_FILES['upfile']) {
         header("Content-Type:text/html;charset=utf-8");
         error_reporting(E_ERROR | E_WARNING);
         $config = array("savePath" => imgPath, "maxSize" => maxSize, "allowFiles" => array(".gif", ".png", ".jpg", ".jpeg", ".bmp"));
         $up = new uploader($_SESSION['weixinId'], $this->newsId, "upfile", $config);
         $type = $_REQUEST['type'];
         $callback = $_GET['callback'];
         $info = $up->getFileInfo();
         wxlog(json_encode($info));
         /**
          * 返回数据
          */
         if ($callback) {
             echo '<script>' . $callback . '(' . json_encode($info) . ')</script>';
         } else {
             echo json_encode($info);
         }
     }
 }
예제 #6
0
 public function __construct()
 {
     parent::__construct();
     // SECURITY CHECK INPUT DIRECTORY
     if (isset($_REQUEST['dir'])) {
         $dir = $this->checkInputDir($_REQUEST['dir'], true, false);
         if ($dir === false) {
             unset($_REQUEST['dir']);
         }
         // Support the POST.dir
         if (isset($_POST['dir'])) {
             $_POST['dir'] = $dir;
         }
         // Support the GET.dir
         if (isset($_GET['dir'])) {
             $_GET['dir'] = $dir;
         }
         // Support the REQUEST.dir
         if (isset($_REQUEST['dir'])) {
             $_REQUEST['dir'] = $dir;
         }
     }
     $thumbsDir = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'];
     if (!$this->config['disabled'] && (!is_dir($thumbsDir) && !@mkdir($thumbsDir, $this->config['dirPerms']) || !is_readable($thumbsDir) || !dir::isWritable($thumbsDir) || !is_dir("{$thumbsDir}/{$this->type}") && !@mkdir("{$thumbsDir}/{$this->type}", $this->config['dirPerms']))) {
         $this->errorMsg("Cannot access or create thumbnails folder.");
     }
     $this->thumbsDir = $thumbsDir;
     $this->thumbsTypeDir = "{$thumbsDir}/{$this->type}";
     // Remove temporary zip downloads if exists
     if (!$this->config['disabled']) {
         $files = dir::content($this->config['uploadDir'], array('types' => "file", 'pattern' => '/^.*\\.zip$/i'));
         if (is_array($files) && count($files)) {
             $time = time();
             foreach ($files as $file) {
                 if (is_file($file) && $time - filemtime($file) > 3600) {
                     unlink($file);
                 }
             }
         }
     }
     if (isset($_GET['theme']) && $this->checkFilename($_GET['theme']) && is_dir("themes/{$_GET['theme']}")) {
         $this->config['theme'] = $_GET['theme'];
     }
 }
예제 #7
0
    } else {
        $data = $my->about;
    }
    $chars = numbers($config['maxaboutlength']);
    $bbcode = initBBCodes();
    $inner['bbhtml'] = $bbcode->getbbhtml();
    $inner['smileys'] = $bbcode->getsmileyhtml($config['smileysperrow']);
    $mymodules->load('editprofile_about_top');
    echo $tpl->parse("editprofile/about");
} elseif ($_GET['action'] == "pic2") {
    $pic = $gpc->get('pic', none);
    if ($my->p['usepic'] == 0) {
        errorLogin($lang->phrase('not_allowed'), "editprofile.php");
    } elseif (isset($_FILES) && is_array($_FILES['upload']) && !empty($_FILES['upload']['name'])) {
        require "classes/class.upload.php";
        $my_uploader = new uploader();
        $my_uploader->max_filesize($config['avfilesize']);
        $my_uploader->max_image_size($config['avwidth'], $config['avheight']);
        if ($my_uploader->upload('upload', explode('|', $config['avfiletypes']))) {
            $my_uploader->save_file('uploads/pics/', '2');
        }
        if ($my_uploader->return_error()) {
            error($my_uploader->return_error(), 'editprofile.php?action=pic');
        } else {
            if (file_exists($my->pic)) {
                @unlink($my->pic);
            }
            $ext = $my_uploader->rename_file('uploads/pics/', $my_uploader->file['name'], $my->id);
        }
        $my->pic = 'uploads/pics/' . $my->id . $ext;
    } elseif (!empty($pic) && preg_match('/^(http:\\/\\/|www.)([\\wהצ�ִײ�@\\-_\\.]+)\\:?([0-9]*)\\/(.*)$/', $pic, $url_ary)) {
예제 #8
0
    if ($my->p['usepic'] == 0) {
        errorLogin($lang->phrase('not_allowed'), "editprofile.php");
    }
    removeOldImages('uploads/pics/', $my->id);
    $db->query("UPDATE {$db->pre}user SET pic = '' WHERE id = '{$my->id}' LIMIT 1");
    ($code = $plugins->load('editprofile_pic3_end')) ? eval($code) : null;
    ok($lang->phrase('editprofile_pic_success'), "editprofile.php?action=pic" . SID2URL_x);
} elseif ($_GET['action'] == "pic2") {
    $pic = $gpc->get('pic', none);
    if ($my->p['usepic'] == 0) {
        errorLogin($lang->phrase('not_allowed'), "editprofile.php");
    }
    $error = array();
    if (isset($_FILES) && is_array($_FILES['upload']) && !empty($_FILES['upload']['name'])) {
        require "classes/class.upload.php";
        $my_uploader = new uploader();
        $my_uploader->max_filesize($config['avfilesize']);
        $my_uploader->max_image_size($config['avwidth'], $config['avheight']);
        $my_uploader->file_types(explode(',', $config['avfiletypes']));
        $my_uploader->set_path('uploads/pics/');
        $my_uploader->rename_file($my->id);
        if ($my_uploader->upload('upload')) {
            removeOldImages('uploads/pics/', $my->id);
            if ($my_uploader->save_file()) {
                $my->pic = 'uploads/pics/' . $my_uploader->fileinfo('filename');
            }
        }
        if ($my_uploader->upload_failed()) {
            $error[] = $my_uploader->get_error();
        }
    } elseif (!empty($pic) && preg_match(URL_REGEXP, $pic)) {
예제 #9
0
 $filesize *= 1024;
 $filetypes = explode('|', $filetypes);
 foreach ($filetypes as $key => $value) {
     if (empty($value)) {
         unset($filetypes[$key]);
     }
 }
 $insertuploads = array();
 $inserterrors = array();
 require "classes/class.upload.php";
 $success = 0;
 for ($i = 0; $i < $ups; $i++) {
     if (empty($_FILES['upload_' . $i]['name'])) {
         continue;
     }
     $my_uploader = new uploader();
     $my_uploader->max_filesize($filesize);
     $my_uploader->file_types($filetypes);
     $my_uploader->set_path($dir . DIRECTORY_SEPARATOR);
     if (isset($imgwidth) && isset($imgheight)) {
         $my_uploader->max_image_size($imgwidth, $imgheight);
     }
     if ($my_uploader->upload('upload_' . $i)) {
         $my_uploader->save_file();
     }
     if ($my_uploader->upload_failed()) {
         array_push($inserterrors, $my_uploader->get_error());
     }
     $file = $dir . DIRECTORY_SEPARATOR . $my_uploader->fileinfo('filename');
     if (!file_exists($file)) {
         $inserterrors[] = $lang->phrase('admin_explorer_file_does_not_exist');
예제 #10
0
 </table>
</form>
	<?php 
    echo foot();
} elseif ($job == 'import2') {
    $overwrite = $gpc->get('overwrite', int);
    $server = $gpc->get('server', none);
    $del = $gpc->get('delete', int);
    $inserterrors = array();
    if (!empty($_FILES['upload']['name'])) {
        $filesize = 1024 * 1024;
        $filetypes = array('.zip');
        $dir = realpath('temp/');
        $insertuploads = array();
        require "classes/class.upload.php";
        $my_uploader = new uploader();
        $my_uploader->max_filesize($filesize);
        if ($my_uploader->upload('upload', $filetypes)) {
            $my_uploader->save_file($dir, 2);
            if ($my_uploader->return_error()) {
                array_push($inserterrors, $my_uploader->return_error());
            }
        } else {
            array_push($inserterrors, $my_uploader->return_error());
        }
        $file = $dir . '/' . $my_uploader->file['name'];
        if (!file_exists($file)) {
            $inserterrors[] = 'File (' . $file . ') does not exist.';
        }
    } elseif (file_exists($server)) {
        $ext = get_extension($server, true);
예제 #11
0
 /**
  * recursive file name incrementation untill no file with exsiting name
  * exists
  * @param string intial file name
  * @param string this recursions file name
  * @param int file version
  * @return string new file name
  */
 function incrementFileName($origFileName, $newFileName, $version)
 {
     if (JFile::exists($newFileName)) {
         $bits = explode('.', $newFileName);
         $ext = array_pop($bits);
         $f = implode('.', $bits);
         $f = rtrim($f, $version - 1);
         $newFileName = $f . $version . "." . $ext;
         $version++;
         $newFileName = uploader::incrementFileName($origFileName, $newFileName, $version);
     }
     return $newFileName;
 }
예제 #12
0
             if (file_exists('uploads/topics/' . $row[0])) {
                 @unlink('uploads/topics/' . $row[0]);
             }
         }
         $db->query('DELETE FROM ' . $db->pre . 'uploads WHERE mid = "' . $upinfo['name'] . '" AND id IN (' . implode(',', $ids) . ')', __LINE__, __FILE__);
         viscacha_header('Location: attachments.php?type=' . $_GET['type'] . '&id=' . $_GET['id'] . SID2URL_JS_x);
     }
 } else {
     $insertuploads = array();
     $inserterrors = array();
     require "classes/class.upload.php";
     for ($i = 0; $i < $config['tpcmaxuploads']; $i++) {
         if (empty($_FILES['upload_' . $i]['name'])) {
             continue;
         }
         $my_uploader = new uploader();
         $my_uploader->max_filesize($config['tpcfilesize']);
         $my_uploader->max_image_size($config['tpcwidth'], $config['tpcheight']);
         if ($my_uploader->upload('upload_' . $i, explode('|', $config['tpcfiletypes']), 1)) {
             $my_uploader->save_file('uploads/topics/', '2');
         }
         if ($my_uploader->return_error()) {
             array_push($inserterrors, $my_uploader->return_error());
         }
         array_push($insertuploads, $my_uploader->file['name']);
     }
     if (count($inserterrors) > 0) {
         error($inserterrors, 'attachments.php?type=' . $_GET['type'] . '&amp;id=' . $_GET['id'] . SID2URL_x);
     }
     if ($_GET['type'] == 'edit' && ($my->mp[0] == 1 || $upinfo['name'] == $my->id)) {
         $upper = $upinfo['name'];
예제 #13
0
<?php

/** This file is part of KCFinder project
 *
 *      @desc Upload calling script
 *   @package KCFinder
 *   @version 2.51
 *    @author Pavel Tzonkov <*****@*****.**>
 * @copyright 2010, 2011 KCFinder Project
 *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
 *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
 *      @link http://kcfinder.sunhater.com
 */
require "core/autoload.php";
$uploader = new uploader($modx);
$uploader->upload();
예제 #14
0
  <tr> 
   <td class="mbox" width="50%">Packed Component:<br><span class="stext">Compressed file containing the component (.zip). You should install only components from confidential sources!</td>
   <td class="mbox" width="50%"><input type="file" name="upload" size="60" /></td> 
  </tr>
  <tr> 
   <td class="ubox" width="100%" colspan="2" align="center"><input type="submit" name="Submit" value="Upload"></td> 
  </tr>
 </table>
</form> 
	<?php 
    echo foot();
} elseif ($job == 'com_add2') {
    echo head();
    if (isset($_FILES) && is_array($_FILES['upload']) && $_FILES['upload']['name']) {
        require "classes/class.upload.php";
        $my_uploader = new uploader();
        if ($my_uploader->upload('upload', array('.zip'))) {
            $my_uploader->save_file('temp/', '2');
        }
        if ($my_uploader->return_error()) {
            error('admin.php?action=cms&job=com_add', $my_uploader->return_error());
        } else {
            $tdir = "temp/" . time();
            $filesystem->mkdir($tdir);
            if (!is_dir($tdir)) {
                error('admin.php?action=cms&job=com_add', 'Directory could not be created for extraction.');
            }
            include 'classes/class.zip.php';
            $archive = new PclZip('temp/' . $my_uploader->file['name']);
            if ($archive->extract(PCLZIP_OPT_PATH, $tdir) == 0) {
                error('admin.php?action=cms&job=com_add', $archive->errorInfo(true));
예제 #15
0
} elseif ($job == 'query') {
    echo head();
    exec_query_form();
    echo foot();
} elseif ($job == 'query2') {
    echo head();
    $type = $gpc->get('type', int);
    if ($type == 1) {
        $filetypes = array('zip', 'sql');
        $dir = 'temp/';
        $inserterrors = array();
        require "classes/class.upload.php";
        if (empty($_FILES['upload']['name'])) {
            $inserterrors[] = 'No file specified.';
        }
        $my_uploader = new uploader();
        $my_uploader->max_filesize(ini_maxupload());
        $my_uploader->file_types($filetypes);
        $my_uploader->set_path($dir);
        if ($my_uploader->upload('upload')) {
            if ($my_uploader->save_file()) {
                $file = $dir . $my_uploader->fileinfo('filename');
                if (!file_exists($file)) {
                    $inserterrors[] = 'File (' . $file . ') does not exist.';
                }
            }
        }
        if ($my_uploader->upload_failed()) {
            array_push($inserterrors, $my_uploader->get_error());
        }
        if (count($inserterrors) > 0) {
예제 #16
0
<!DOCTYPE HTML>
<html>
<head>
<title>Загрузка и обработка изображения</title>
<?php 
require_once "functions.php";
$menu = new menu();
if (!empty($_FILES)) {
    $uploader = new uploader();
    $uploader->checkAndMove();
}
if (!empty($_SESSION['filename'])) {
    $image = new image();
    $image->getDimensions();
    if (!empty($_POST['imageCrop'])) {
        $image->cropImage();
    }
}
?>
</head>
<body>
<center>
<h1>Загрузка и обработка изображения</h1>
<?php 
$menu->showUploadMenu();
if (!empty($_SESSION['filename'])) {
    $menu->showCropMenu();
    $image->checkCrop($menu);
    $menu->showSepia();
    if (!empty($_GET['sepia']) and $_GET['sepia'] == 'yes') {
        $image->applySepia();
예제 #17
0
<?php

include_once "act.portfolio.php";
// Файл для обработки логики
if ($user->login == $_SESSION['login']) {
    uploader::init(array(), $templates, 'portfolio');
}
?>
<script type="text/javascript">
    var categoryList = new Object();
    var currencyList = {0:"USD", 1:"Евро", 2:"Руб"}
    var timeTypeList = {0:"в часах", 1:"в днях", 2:"в месяцах", 3:"в минутах"}
</script>

<?php 
if ($_SESSION['login'] == $user->login) {
    ?>
    <?php 
    if ($user->is_pro != 't' && (int) $user->spec == 0) {
        ?>
        <div class="b-fon b-fon_pad_20">
            <div class="b-fon__body b-fon__body_pad_10 b-fon__body_padleft_30 b-fon__body_fontsize_13 b-fon__body_bg_ffeeeb">
                <span class="b-icon b-icon_sbr_rattent b-icon_margleft_-25"></span><a class="b-layout__link" href="/users/<?php 
        echo $user->login;
        ?>
/setup/specsetup/">Выберите специализацию</a>. Это небходимо, чтобы попасть в каталог фрилансеров, в котором вас найдут заказчики
            </div>
        </div>
    <?php 
    } elseif ($user->is_pro != 't' && (int) $user->spec != 0) {
        ?>
예제 #18
0
session_start();
// included files
include "../../../connection/phpmysqlconnect.php";
include "../../../library/CRUD_lib.php";
include "../../../library/miss_lib.php";
// post data
$user_id = $_POST['user_id'];
$month = $_POST['month'];
$year = $_POST['year'];
$modifier = $_SESSION["user"];
// File processing
$ext_array = array("xls", "csv", "xlsx");
$mime_array = array("application/vnd.ms-excel", "text/csv", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
$location = "../../media/performance-sheet/";
$file = new uploader();
if (is_uploaded_file($_FILES['file']['tmp_name'])) {
    if ($file->upload_validate($_FILES['file'], $ext_array, $mime_array) == true) {
        $file_name = $file->upload($_FILES['file'], $location);
        // insertion
        $column = array('performance_sheet', 'user_id', 'month', 'year', 'uploaded_by', 'modified_by');
        $value = array("{$file_name}", "{$user_id}", "{$month}", "{$year}", "{$modifier}", "{$modifier}");
        $insert = new crud($conn, 'employee_performance', $column, $value);
        $insert->insert();
        $move = new alert_redirect();
        $move->moveWithAlert('New Performance Sheet has been added', '../pages/addperformance.php');
    } else {
        $move = new alert_redirect();
        $move->moveWithAlert('File Extension not valid', '../pages/addperformance.php');
    }
    $move = new alert_redirect();
예제 #19
0
         $slog->updatelogged();
         $db->close();
         viscacha_header('Location: attachments.php?type=' . $_GET['type'] . '&id=' . $_GET['id'] . SID2URL_JS_x);
         exit;
     }
 } else {
     $insertuploads = array();
     $inserterrors = array();
     require "classes/class.upload.php";
     ($code = $plugins->load('attachments_upload_save_add_start')) ? eval($code) : null;
     for ($i = 0; $i < $config['tpcmaxuploads']; $i++) {
         $field = "upload_{$i}";
         if (empty($_FILES[$field]['name'])) {
             continue;
         }
         $my_uploader = new uploader();
         $my_uploader->max_filesize($config['tpcfilesize']);
         $my_uploader->max_image_size($config['tpcwidth'], $config['tpcheight']);
         $my_uploader->file_types(explode(',', $config['tpcfiletypes']));
         $my_uploader->set_path('uploads/topics/');
         ($code = $plugins->load('attachments_upload_add_prepare')) ? eval($code) : null;
         if ($my_uploader->upload($field)) {
             if ($my_uploader->save_file()) {
                 array_push($insertuploads, array('file' => $my_uploader->fileinfo('name'), 'source' => $my_uploader->fileinfo('filename')));
             }
         }
         if ($my_uploader->upload_failed()) {
             array_push($inserterrors, $my_uploader->get_error());
         }
     }
     if ($_GET['type'] == 'edit' && ($my->mp[0] == 1 || $upinfo['name'] == $my->id)) {
예제 #20
0
<?php

if (hasPermissions('articles')) {
    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/uploader/uploader.php";
    $templates = array(uploader::getTemplate('uploader', 'wysiwyg/'), uploader::getTemplate('uploader.file', 'wysiwyg/'), uploader::getTemplate('uploader.popup'));
    uploader::init(array(), $templates, 'wysiwyg');
}
?>
<script>
    window.addEvent('domready', function() {

        $$('.ai-form input[type=file]').each( function (el) {
            articlesFileInput(el);
        });
        <?php 
if (hasPermissions('articles')) {
    ?>
CKEDITOR.config.customConfig = '/scripts/ckedit/config_admin.js';<?php 
}
?>
        CKEDITOR.replace('msgtext', {
            toolbar : 'Articles',
//            enterMode : CKEDITOR.ENTER_BR,
//            shiftEnterMode : CKEDITOR.ENTER_P,
            format_tags : 'p;h1;h2;h3;h4;h5;h6',
            width: '',
            linkShowAdvancedTab: false,
            linkShowTargetTab: false
        });
//        CKEDITOR.replace('short', {
//            toolbar : 'Articles',
예제 #21
0
            }
            $n[] = implode('|', $row);
        }
        $filesystem->file_put_contents('data/feedcreator.inc.php', implode("\n", $n));
    }
    viscacha_header('Location: admin.php?action=misc&job=feedcreator');
} elseif ($job == 'feedcreator_add') {
    echo head();
    $name = $gpc->get('name', str);
    $class = $gpc->get('class', str);
    $active = $gpc->get('active', str);
    $dl = $gpc->get('dl', str);
    $dir = realpath('./classes/feedcreator/');
    $inserterrors = array();
    require "classes/class.upload.php";
    $my_uploader = new uploader();
    $my_uploader->max_filesize(200 * 1024);
    if ($my_uploader->upload('upload', array('.php'))) {
        if (strlen($my_uploader->return_error()) > 0) {
            array_push($inserterrors, $my_uploader->return_error());
        }
        $my_uploader->save_file($dir, 2);
        $file = $my_uploader->file['name'];
    } else {
        if (strlen($my_uploader->return_error()) > 0) {
            array_push($inserterrors, $my_uploader->return_error());
        } else {
            if (count($inserterrors) == 0) {
                array_push($inserterrors, 'An unexpected error occurred');
            }
        }
예제 #22
0
 protected function backMsg($message)
 {
     $act = isset($this->get['act']) ? $this->get['act'] : "browser";
     if (!method_exists($this, "act_{$act}")) {
         $act = "browser";
     }
     if ($act == "browser") {
         parent::backMsg($message);
     } else {
         die($message);
     }
 }
예제 #23
0
<?php

chdir('../../');
include 'pv_core.php';
CheckLogin();
LoadUserlanguage();
if (isset($_FILES) && count($_FILES) > 0) {
    $path = '../' . $Cfg['upload_path'];
    require_once 'includes/fileupload-class.php';
    $lang = str_replace("_utf8", "", $Users[$Pivot_Vars['user']]['language']);
    $my_uploader = new uploader($lang);
    // OPTIONAL: set the max filesize of uploadable files in bytes
    $my_uploader->max_filesize($Cfg['max_filesize']);
    // UPLOAD the file
    if ($my_uploader->upload('userfile', $Cfg['upload_accept'], $Cfg['upload_extension'])) {
        $success = $my_uploader->save_file($path, $Cfg['upload_save_mode'], 1);
    }
}
if (isset($_GET['f_target'])) {
    $target = $_GET['f_target'];
} else {
    $target = $_POST['f_target'];
}
if (isset($_GET['f_text'])) {
    $text = urldecode($_GET['f_text']);
} else {
    $text = $_POST['f_text'];
}
if (!isset($Users[$Pivot_Vars['user']]['wysiwyg'])) {
    $useWysiwyg = $Cfg['wysiwyg_editor'] == 1 ? TRUE : FALSE;
} else {
<?php

include "../../connection/phpmysqlconnect.php";
include "../../lib/CRUD_lib.php";
include "../../lib/miss_lib.php";
// post data
// File processing
$ext_array = array("jpeg", "jpg", "png");
$mime_array = array("image/jpeg", "image/jpg", "image/png");
$location = "../../media/featured_product/";
$image = new uploader();
if ($image->upload_validate($_FILES['files'], $ext_array, $mime_array) == true) {
    $image_name = $image->upload($_FILES['files'], $location);
    $column = array('logo');
    $value = array($image_name);
    $insert = new crud($conn, 'featured-product', $column, $value);
    $insert->insert();
    $move = new alert_redirect();
    $move->moveWithAlert('Logo has been added', '../../pages/distributor-logo.php');
}
$move->moveWithAlert('Error in uploading image', '../../pages/distributor-logo.php');
예제 #25
0
            }
            $n[] = implode('|', $row);
        }
        $filesystem->file_put_contents('data/feedcreator.inc.php', implode("\n", $n));
    }
    viscacha_header('Location: admin.php?action=misc&job=feedcreator');
} elseif ($job == 'feedcreator_add') {
    echo head();
    $name = $gpc->get('name', str);
    $class = $gpc->get('class', str);
    $active = $gpc->get('active', str);
    $dl = $gpc->get('dl', str);
    $dir = realpath('./classes/feedcreator/') . DIRECTORY_SEPARATOR;
    $inserterrors = array();
    require "classes/class.upload.php";
    $my_uploader = new uploader();
    $my_uploader->max_filesize(200 * 1024);
    $my_uploader->file_types(array('php'));
    $my_uploader->set_path($dir);
    if ($my_uploader->upload('upload')) {
        if ($my_uploader->save_file()) {
            $file = $my_uploader->fileinfo('filename');
        }
    }
    if ($my_uploader->upload_failed()) {
        array_push($inserterrors, $my_uploader->get_error());
    }
    if (empty($file)) {
        array_push($inserterrors, 'File does not exist!');
    }
    if (count($inserterrors) > 0) {
    if ($width && $height && $cfile->image_size['type'] != 13 && $cfile->image_size['type'] != 4) {
        print view_image_file($work['pict'], $_SESSION['login'], "upload", array('max_dim' => 200, 'class' => 'b-prev__pic', 'id' => 'work_image'));
    } else {
        ?>
                                                                <div id="work_image" class="b-layout b-layout_padtop_20 b-layout_padlr_10">
                                                                    <table cellspacing="0" cellpadding="0" border="0" class="b-layout__table b-layout__table_width_full">
                                                                            <tr class="b-layout__tr">
                                                                                <td class="b-icon-layout__icon"><i class="b-icon b-icon_attach_<?php 
        echo getICOFile($cfile->getext());
        ?>
"></i></td>
                                                                                <td class="b-icon-layout__files"><div class="b-layout__txt b-layout__txt_padtop_5"><a href="<?php 
        echo WDCPREFIX . '/' . $cfile->path . $cfile->name;
        ?>
" class="b-icon-layout__link b-icon-layout__link_fontsize_13"><?php 
        echo uploader::cutNameFile($cfile->original_name, portfolio::FILE_NAME_LENGTH_EDIT);
        ?>
</a></div></td>
                                                                                <td class="b-icon-layout__size" style="padding-right:0;"><div class="b-layout__txt b-layout__txt_padtop_5">,<?php 
        echo ConvertBtoMB($cfile->size);
        ?>
</div></td>
                                                                            </tr>
                                                                    </table>
                                                                      <div id="swf_params" class="b-select b-select_padtop_10 b-select_center" <?php 
        echo strtolower(preg_replace("#.*(\\.[a-zA-Z0-9]*)\$#", '$1', $cfile->name)) != ".swf" ? 'style="display:none"' : '';
        ?>
>
                                                                          <label for="wmode" class="b-select__label b-select__label_inline-block b-select__label_fontsize_11">wmode: </label>
                                                                          <select id="wmode" class="b-select__select b-select__select_width_70" name="wmode">
                                                                              <option>window</option>
예제 #27
0
파일: video.php 프로젝트: rogeriocc/fabrik
 /**
  *
  */
 function _processIndUpload(&$oUploader, $myFileName, $tmpFile, $arrayInc, $myFileDir = '', $file)
 {
     $params = $this->getParams();
     if ($params->get('ul_file_types') == '') {
         $params->set('ul_file_types', implode(',', $this->_aDefaultFileTypes));
     }
     $folder = $params->get('ul_directory');
     if ($myFileDir != '') {
         $folder .= JPath::clean(JPATH_SITE . '/' . $myFileDir);
     }
     $oUploader->_makeRecursiveFolders($folder);
     $folder = JPath::clean(JPATH_SITE . '/' . $folder);
     $err = null;
     // Set FTP credentials, if given
     jimport('joomla.client.helper');
     JClientHelper::setCredentialsFromRequest('ftp');
     if ($myFileName != '') {
         $filepath = JPath::clean($folder . '/' . JString::strtolower($myFileName));
         if (!uploader::canUpload($file, $err, $params)) {
             return JError::raiseNotice(100, JText::_($err));
         }
         if (JFile::exists($filepath)) {
             if ($params->get('ul_file_increment', 0)) {
                 $filepath = uploader::incrementFileName($filepath, $filepath, 1);
             } else {
                 return JError::raiseNotice(100, JText::_('A file of that name already exists'));
             }
         }
         if (!JFile::upload($tmpFile, $filepath)) {
             $oUploader->moveError = true;
             JError::raiseWarning(100, JText::_("Error. Unable to upload file (from {$tmpFile} to {$destFile})"));
         } else {
             jimport('joomla.filesystem.path');
             JPath::setPermissions($destFile);
             //resize main image
             $oImage = FabimageHelper::loadLib($params->get('image_library'));
             $mainWidth = $params->get('fu_main_max_width');
             $mainHeight = $params->get('fu_main_max_height');
             if ($params->get('make_thumbnail') == '1') {
                 $thumbPath = JPath::clean($params->get('thumb_dir') . '/' . $myFileDir . '/');
                 $thumbPrefix = $params->get('thumb_prefix');
                 $maxWidth = $params->get('thumb_max_width');
                 $maxHeight = $params->get('thumb_max_height');
                 if ($thumbPath != '') {
                     $oUploader->_makeRecursiveFolders($thumbPath);
                 }
                 $destThumbFile = JPath::clean(JPATH_SITE . '/' . $thumbPath . '/' . $thumbPrefix . basename($filepath));
                 $msg = $oImage->resize($maxWidth, $maxHeight, $filepath, $destThumbFile);
             }
             if ($mainWidth != '' || $mainHeight != '') {
                 $msg = $oImage->resize($mainWidth, $mainHeight, $filepath, $filepath);
             }
             $res = str_replace(JPATH_SITE, '', $filepath);
             return $res;
         }
     }
 }
예제 #28
0
/**
* Добавляет жалобу на проект.
*
* @param    integer     $project_id     ID проекта
* @param    integer     $user_id        ID пользователя
* @param    integer     $type           тип жалобы
* @param    string      $msg            текст жалобы
* @param    string      $files          имена загруженных скриншотов
*
* @return                               xajax responce
*/
function SendComplain($project_id, $type, $msg, $files)
{
    global $session;
    session_start();
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/uploader/uploader.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/projects_complains.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/userecho.php';
    $objResponse = new xajaxResponse();
    $project_id = (int) $project_id;
    $user_id = get_uid(false);
    $type = (int) $type;
    $msg = __paramValue('htmltext', $msg);
    $error = false;
    $project = new projects();
    $prj = $project->GetPrj(0, $project_id, 1);
    $file_list = array();
    if ($files != '') {
        $files = uploader::sgetFiles($files);
        if (!empty($files)) {
            $emp = new users();
            $emp->GetUser($emp->GetField($prj['user_id'], $ee, 'login'));
            $dir = 'users/' . substr($emp->login, 0, 2) . '/' . $emp->login . '/upload/';
            foreach ($files as $file) {
                $copy = uploader::remoteCopy($file['id'], 'file_projects', $dir);
                $rfiles[] = $copy->name;
                $file_list[] = array('name' => $copy->original_name, 'link' => WDCPREFIX . '/' . $copy->path . $copy->name);
            }
            $files = implode(',', $rfiles);
        } else {
            $files = '';
        }
    }
    if (!$files) {
        $files = '';
    }
    if (projects::IsHaveComplainType($project_id, $user_id, $type)) {
        // Уже жаловался
        return $objResponse;
    }
    $projects_complains = new projects_complains();
    $type_name = $projects_complains->GetComplainType($type);
    $project_url = getAbsUrl(getFriendlyURL('project', $project_id));
    $is_moder = $projects_complains->isComplainTypeModer($type);
    if ($is_moder) {
        $userEcho = new UserEcho();
        $topic_message = $userEcho->constructMessage($project_url, $prj['name'], $msg, $file_list);
        $topicUrl = $userEcho->newTopicComplain($type_name, $topic_message, $file_list);
        if ($topicUrl) {
            messages::sendProjectComplain($user_id, $project_url, $prj['name'], $msg, $topicUrl);
        } else {
            $error = true;
        }
    }
    if (!$error) {
        $error = projects::AddComplain($project_id, $user_id, $type, $msg, $files, $is_moder && $topicUrl);
    }
    if ($error) {
        $objResponse->script("\$('abuse_project_popup').toggleClass('b-shadow_hide');");
        if ($is_moder) {
            $objResponse->script("\$('abuse-cause-error').removeClass('b-layout__txt_hide'); abuseResetSelection();");
        } else {
            $objResponse->script("\$\$('.abuse-btn-send').removeClass('b-button_rectangle_color_disable')");
        }
    } else {
        $upl = array('umask' => uploader::umask('prj_abuse'), 'validation' => array('allowedExtensions' => array('jpg', 'gif', 'png', 'jpeg'), 'restrictedExtensions' => array()), 'text' => array('uploadButton' => iconv('cp1251', 'utf8', 'Прикрепить файлы')));
        $objResponse->script("\n            \$('abuse{$type}').addClass('abuse-checked');\n            \$('abuse{$type}').getChildren().each(function(el) { \$(el).addClass('abuse-checked'); });\n        ");
        $objResponse->script("uploader.create('abuse_uploader', " . json_encode($upl) . ');');
        $objResponse->script("\$('prj_abuse_msg').set('value', '')");
        $objResponse->script("\$\$('.abuse-btn-send').removeClass('b-button_disabled')");
        $objResponse->script("\$('abuse_project_popup').toggleClass('b-shadow_hide');");
        $objResponse->script("\$('project_abuse_success').removeClass('b-layout__txt_hide');");
        $objResponse->script("\$('form_abuse').hide();");
        $objResponse->script("setTimeout(\"\$('project_abuse_success').addClass('b-layout__txt_hide')\", 5000);");
        if ($is_moder) {
            $objResponse->script("\$('abuse-cause-error').addClass('b-layout__txt_hide');");
        }
    }
    return $objResponse;
}
예제 #29
0
 if (!empty($_FILES['file']['name'])) {
     $path = $leadon;
     $qdir = $gpc->get('dir', none);
     $ndir = $gpc->get('newdir', none);
     if ($qdir == '#') {
         if (!preg_match('/[^\\w\\d\\-\\.]/i', $qdir) || empty($ndir)) {
             $error = $lang->phrase('admin_wysiwyg_folder_restrictions');
         } else {
             if ($filesystem->mkdir($leadon . $ndir, 0777)) {
                 $path = $leadon . $ndir;
             }
         }
     }
     if ($error === null) {
         require "classes/class.upload.php";
         $my_uploader = new uploader();
         $my_uploader->max_filesize(ini_maxupload());
         $my_uploader->file_types($supportedextentions);
         $my_uploader->set_path($path);
         if ($my_uploader->upload('file')) {
             $my_uploader->save_file();
         }
         if ($my_uploader->upload_failed()) {
             $error = $my_uploader->get_error();
         }
         $image_file = $path . $my_uploader->fileinfo('filename');
         if (!file_exists($image_file)) {
             $error = $lang->phrase('admin_cms_file_does_not_exist');
         }
         $image_file = str_replace(realpath($config['fpath']) . DIRECTORY_SEPARATOR, '', $image_file);
         $image_file = str_replace(DIRECTORY_SEPARATOR, '/', $image_file);
예제 #30
0
파일: drafts.php 프로젝트: amage/fl-ru-damp
 /**
  * Сохранение проекта в черновики (новый шаблон)
  *
  * @param   array     $prj    Информация о проекте
  * @return  array             ['id'] - ID черновика, ['date'] - дата сохранения черновика
  */
 function SaveProjectNew($prj, $attachedfiles_files = false)
 {
     global $DB;
     require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/attachedfiles.php";
     $categories = "";
     $check = array();
     for ($i = 0; $i <= 2; $i++) {
         $catID = __paramValue('int', $prj['project_profession' . $i . '_columns'][0]);
         $subcatID = __paramValue('int', $prj['project_profession' . $i . '_spec_columns'][0]);
         if ($catID || $subcatID) {
             $categories .= $catID . '|' . $subcatID . ',';
         }
     }
     $categories = preg_replace("/,\$/", "", $categories);
     if ($prj['name'] === false) {
         $prj['name'] = '';
     }
     if ($prj['descr'] === false) {
         $prj['descr'] = '';
     }
     if (!$prj['end_date']) {
         $prj['end_date'] = NULL;
     }
     if (!$prj['win_date']) {
         $prj['win_date'] = NULL;
     }
     $prj['budget_type'] = intval($prj['budget_type']);
     if (!intval($prj['draft_prj_id'])) {
         $prj['prj_id'] = NULL;
     } else {
         $prj['prj_id'] = $prj['draft_prj_id'];
     }
     $prj['draft_id'] = intval($prj['draft_id']);
     if (!isset($prj['kind'])) {
         $prj['kind'] = 7;
     }
     $prj['cost'] = $prj['agreement'] ? 0 : floatval($prj['cost']);
     $date = date("Y-m-d H:i:s");
     $prj['strong_top'] = hasPermissions('projects') ? (int) $prj['strong_top'] : 0;
     $prj['verify_only'] = (bool) $prj['verify_only'];
     // платные опции
     $prj['urgent'] = (bool) $prj['urgent'];
     $prj['hide'] = (bool) $prj['hide'];
     $topDays = $prj['top_ok'] ? $prj['top_days'] : 0;
     if ($prj['logo_ok']) {
         $logoAttach = new attachedfiles($prj['logo_attachedfiles_session']);
         $logoFiles = $logoAttach->getFiles();
         if (is_array($logoFiles) && count($logoFiles)) {
             $logoFile = array_pop($logoFiles);
             // файлов может быть несколько, берем последний
             $logoAttach->setStatusTo3($logoFile['id']);
             $logoFileID = $logoFile['id'];
         } elseif ($prj['logo_file_id']) {
             $logoFileID = $prj['logo_file_id'];
         }
         $logoLink = $prj['link'];
     }
     if (self::isDraftExists($prj['draft_id'], $prj['uid'], 1, $prj['prj_id'])) {
         $sql = "UPDATE draft_projects SET \n                            name = ?u,\n                            descr = ?u,\n                            cost = ?,\n                            currency = ?i,\n                            kind = ?i,\n                            pro_only = ?,\n                            strong_top = ?i,\n                            end_date = ?,\n                            win_date = ?,\n                            country = ?i,\n                            city = ?i,\n                            categories = ?,\n                            date = ?,\n                            prj_id = ?,\n                            priceby = ?i,\n                            prefer_sbr = ?,\n                            budget_type = ?i,\n                            verify_only = ?,\n                            urgent = ?,\n                            hide = ?,\n                            top_days = ?i,\n                            logo_id = ?,\n                            logo_link = ?,\n                            contacts = ?\n                    WHERE (id=? OR prj_id=?)AND uid=?i";
         $DB->query($sql, $prj['name'], $prj['descr'], $prj['cost'], $prj['currency_db_id'], $prj['kind'], $prj['pro_only'] == 1 ? 't' : 'f', $prj['strong_top'], $prj['end_date'], $prj['win_date'], (int) $prj['project_location_columns'][0], (int) $prj['project_location_columns'][1], $categories, $date, $prj['prj_id'], intval($prj['priceby_db_id']), $prj['prefer_sbr'] == 1 ? 't' : 'f', $prj['budget_type'], $prj['verify_only'], $prj['urgent'], $prj['hide'], $topDays, $logoFileID, $logoLink, $prj['contacts'], $prj['draft_id'], $prj['prj_id'], $prj['uid']);
         $id = $prj['draft_id'];
     } else {
         $new_draft = true;
         $sql = "INSERT INTO draft_projects (\n                            name,\n                            descr,\n                            cost,\n                            currency,\n                            kind,\n                            pro_only,\n                            end_date,\n                            win_date,\n                            country,\n                            city,\n                            categories,\n                            date,\n                            uid,\n                            prj_id,\n                            priceby,\n                            prefer_sbr,\n                            budget_type,\n                            strong_top,\n                            verify_only,\n                            urgent,\n                            hide, \n                            top_days,\n                            logo_id,\n                            logo_link,\n                            contacts\n                        ) VALUES (\n                            ?u,\n                            ?u,\n                            ?,\n                            ?i,\n                            ?i,\n                            ?,\n                            ?,\n                            ?,\n                            ?i,\n                            ?i,\n                            ?,\n                            ?,\n                            ?i,\n                            ?,\n                            ?i,\n                            ?,\n                            ?i,\n                            ?i,\n                            ?,\n                            ?,\n                            ?,\n                            ?i,\n                            ?,\n                            ?,\n                            ?\n                        ) RETURNING id;";
         $id = $DB->val($sql, $prj['name'], $prj['descr'], $prj['cost'], $prj['currency_db_id'], $prj['kind'], $prj['pro_only'] == 1 ? 't' : 'f', $prj['end_date'], $prj['win_date'], (int) $prj['project_location_columns'][0], (int) $prj['project_location_columns'][1], $categories, $date, $prj['uid'], $prj['prj_id'], intval($prj['priceby_db_id']), $prj['prefer_sbr'] == 1 ? 't' : 'f', $prj['budget_type'], (int) $prj['strong_top'], $prj['verify_only'], $prj['urgent'], $prj['hide'], $topDays, $logoFileID, $logoLink, $prj['contacts']);
     }
     // - BEGIN атачи
     if (!$attachedfiles_files) {
         require_once $_SERVER['DOCUMENT_ROOT'] . "/classes//uploader/uploader.php";
         $mask_files = array(1, 3);
         $uploader = new uploader(current($prj['IDResource']));
         $attachedfiles_files = $uploader->getFiles($mask_files);
     }
     $file_id = array();
     // массив с ID файлов которые не надо удалять
     $noDeletedFiles = array();
     foreach ($attachedfiles_files as $attachedfiles_file) {
         $noDeletedFiles[] = $attachedfiles_file['id'];
         // старые файлы не трогаем
         if ($attachedfiles_file['status'] == 3) {
             continue;
         }
         if (in_array($f->id, $file_id)) {
             continue;
         }
         // Чтобы не было дублей
         $file_id[] = $f->id;
         $f = new CFile($attachedfiles_file['id']);
         $f->table = 'file';
         $f->makeLink();
         $sql = "INSERT INTO draft_attaches(draft_id, draft_type, file_id) VALUES(?i, 4, ?i)";
         $DB->hold()->query($sql, $id, $f->id);
     }
     if ($DB->sqls) {
         $DB->query();
     }
     if ($uploader && $attachedfiles_files) {
         $uploader->setStatusFiles(uploader::STATUS_CREATE, uploader::STATUS_ADDED);
     }
     $sqlNoDeletedFiles = count($noDeletedFiles) ? $DB->parse('AND file_id NOT IN (?l)', $noDeletedFiles) : '';
     $sql = "SELECT * FROM draft_attaches WHERE draft_id = ?i AND draft_type = 4 {$sqlNoDeletedFiles};";
     $files = $DB->rows($sql, $id, $noDeletedFiles);
     if ($files) {
         foreach ($files as $f) {
             $cf = new CFile($f['file_id']);
             $cf->table = 'file';
             $cf->Delete($cf->id);
         }
     }
     $sql = "DELETE FROM draft_attaches WHERE draft_id = ?i AND draft_type = 4 {$sqlNoDeletedFiles};";
     $DB->query($sql, $id, array());
     // - END атачи
     $_SESSION['drafts_count'] = drafts::getCount($msg['uid']);
     return array('id' => $id, 'date' => $date);
 }