예제 #1
0
파일: default.php 프로젝트: unlight/LoadUp
 public function PluginController_LoadUp_Create(&$Sender)
 {
     $Sender->AddSideMenu('dashboard/plugin/loadup');
     $Sender->Permission('Plugins.Garden.LoadUp.Allow');
     if (!property_exists($Sender, 'Form')) {
         $Sender->Form = Gdn::Factory('Form');
     }
     $Sender->AddJsFile('jquery.livequery.js');
     $Sender->AddJsFile('jquery.autogrow.js');
     $Sender->AddJsFile('plugins/LoadUp/loadup.js');
     $Session = Gdn::Session();
     if ($Sender->Form->AuthenticatedPostBack() != False) {
         $UploadTo = $Sender->Form->GetFormValue('UploadTo');
         if (!$UploadTo) {
             $UploadTo = 'uploads/i/' . date('Y') . '/' . date('m');
         }
         $bOverwrite = $Sender->Form->GetFormValue('Overwrite') && $Session->CheckPermission('Plugins.Garden.LoadUp.Overwrite');
         $Options = array('Overwrite' => $bOverwrite, 'WebTarget' => True);
         $UploadedFiles = UploadFile($UploadTo, 'Files', $Options);
         $Sender->Form->SetFormValue('RawData', implode("\n", $UploadedFiles));
         $Sender->Form->SetFormValue('AbsoluteURL', 1);
     }
     $Sender->UploadTo = array('uploads/tmp' => 'uploads/tmp');
     $Sender->View = $this->GetView('index.php');
     $Sender->Title(T('Upload File'));
     $Sender->Render();
 }
예제 #2
0
 /**
  *上传活动封面图
  *
  */
 public function upload()
 {
     $userinfo = ACPopedom::getUserInfo();
     $subName = substr(md5($userinfo['userid']), -1);
     $result = UploadFile($subName, "/Attachment/", 'upload/');
     $this->ajaxReturn($result);
 }
예제 #3
0
 public function upload()
 {
     $i = I('post.i');
     $id = ACPopedom::getID() ? ACPopedom::getID() : 43543;
     $subName = substr(md5($id), -1);
     $result = UploadFile($subName, "/Attachment/", '/upload/');
     $result['i'] = $i;
     $this->ajaxReturn($result);
 }
예제 #4
0
function HandlePostAttachments($postid, $final)
{
    $targetdir = DATA_DIR . 'uploads';
    if (!Settings::get('postAttach')) {
        return array();
    }
    $attachs = array();
    if (isset($_POST['files']) && !empty($_POST['files'])) {
        foreach ($_POST['files'] as $fileid => $blarg) {
            if (isset($_POST['deletefile']) && $_POST['deletefile'][$fileid]) {
                $todelete = Query("SELECT physicalname, user FROM {uploadedfiles} WHERE id={0}", $fileid);
                DeleteUpload($targetdir . '/' . $entry['physicalname'], $entry['user']);
                Query("DELETE FROM {uploadedfiles} WHERE id={0}", $fileid);
            } else {
                if ($final) {
                    Query("UPDATE {uploadedfiles} SET parentid={0}, deldate=0 WHERE id={1}", $postid, $fileid);
                }
                $attachs[$fileid] = FetchResult("SELECT filename FROM {uploadedfiles} WHERE id={0}", $fileid);
            }
        }
    }
    foreach ($_FILES as $file => $data) {
        if (in_array($data['name'], $attachs)) {
            continue;
        }
        $res = UploadFile($file, 'post_attachment', $postid, POST_ATTACHMENT_CAP, '', !$final);
        if ($res === false) {
            return $res;
        }
        if ($res === true) {
            continue;
        }
        $attachs[$res] = $data['name'];
    }
    return $attachs;
}
예제 #5
0
     Showmsg('upload_close');
 } elseif ($foruminfo['allowupload'] && !allowcheck($foruminfo['allowupload'], $groupid, $winddb['groups'])) {
     Showmsg('upload_forum_right');
 } elseif (!$foruminfo['allowupload'] && $_G['allowupload'] == 0) {
     Showmsg('upload_group_right');
 }
 if ($winddb['uploadtime'] < $tdtime) {
     $winddb['uploadnum'] = 0;
 }
 if (is_array($flashatt)) {
     $filenum += count($flashatt);
 }
 if ($winddb['uploadnum'] + $filenum >= $_G['allownum']) {
     Showmsg('upload_num_error');
 }
 $uploaddb = UploadFile($winduid);
 if ($flashatt && is_array($flashatt)) {
     $flattids = array_keys($flashatt);
     $query = $db->query("SELECT * FROM pw_attachs WHERE tid='0' AND pid='0' AND uid=" . pwEscape($winduid) . " AND aid IN(" . pwImplode($flattids) . ')');
     while ($rt = $db->fetch_array($query)) {
         $value = $flashatt[$rt['aid']];
         $attach_ext = strtolower(substr(strrchr($rt['name'], '.'), 1));
         $savedir = '';
         if ($db_attachdir) {
             if ($db_attachdir == 2) {
                 $savedir = "Type_{$attach_ext}";
             } elseif ($db_attachdir == 3) {
                 $savedir = 'Mon_' . date('ym');
             } elseif ($db_attachdir == 4) {
                 $savedir = 'Day_' . date('ymd');
             } else {
예제 #6
0
<?php

require_once dirname(__FILE__) . '/../../inc/config.inc.php';
/*
**************************
(C)2010-2015 phpMyWind.com
update: 2012-7-24 11:16:02
person: Feng
**************************
*/
require_once 'JSON.php';
//有上传文件时
if (!empty($_FILES)) {
    //引入上传类
    require_once PHPMYWIND_DATA . '/httpfile/upload.class.php';
    $upload_info = UploadFile('imgFile', 'true');
    /*
     * 返回上传状态,是数组则表示上传成功
     * 非数组则是直接返回发生的问题
     */
    if (!is_array($upload_info)) {
        alert($upload_info);
        exit;
    } else {
        $file_url = '../' . $upload_info[2];
        header('Content-type: text/html; charset=UTF-8');
        $json = new Services_JSON();
        echo $json->encode(array('error' => 0, 'url' => $file_url));
        exit;
    }
}
include "../../../config/library.php";
include "../../../config/fungsi_thumb.php";
$module = $_GET[module];
$act = $_GET[act];
// Hapus download
if ($module == 'download' and $act == 'hapus') {
    mysql_query("DELETE FROM download WHERE id_download='{$_GET['id']}'");
    header('location:../../../adminweb/media.php?module=' . $module);
} elseif ($module == 'download' and $act == 'input') {
    $lokasi_file = $_FILES['fupload']['tmp_name'];
    $nama_file = $_FILES['fupload']['name'];
    // Apabila ada gambar yang diupload
    if (!empty($lokasi_file)) {
        UploadFile($nama_file);
        mysql_query("INSERT INTO download(judul,\n                                      tgl_posting,\n                                      nama_file) \n                              VALUES('{$_POST['judul']}',\n                                     '{$tgl_sekarang}',\n                                     '{$nama_file}')");
    } else {
        mysql_query("INSERT INTO download(judul,\n                                    tgl_posting) \n                            VALUES('{$_POST['judul']}',\n                                   '{$tgl_sekarang}')");
    }
    header('location:../../../adminweb/media.php?module=' . $module);
} elseif ($module == 'download' and $act == 'update') {
    $lokasi_file = $_FILES['fupload']['tmp_name'];
    $nama_file = $_FILES['fupload']['name'];
    // Apabila gambar tidak diganti
    if (empty($lokasi_file)) {
        mysql_query("UPDATE download SET judul     = '{$_POST['judul']}'\n                             WHERE id_download = '{$_POST['id']}'");
    } else {
        UploadFile($nama_file);
        mysql_query("UPDATE download SET judul     = '{$_POST['judul']}',\n                                     nama_file = '{$nama_file}'   \n                             WHERE id_download = '{$_POST['id']}'");
    }
    header('location:../../../adminweb/media.php?module=' . $module);
}
예제 #8
0
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
$settings_file = __DIR__ . '/../settings/s3installers.ini';
$dat_files = array();
if (is_file($settings_file)) {
    $settings = parse_ini_file($settings_file, true);
    if (isset($settings) && is_array($settings)) {
        $files = array();
        BuildFileList(__DIR__, $files);
        echo count($files) . " installer files found\r\n";
        if (isset($settings['buckets'])) {
            foreach ($settings['buckets'] as $region => $bucket) {
                echo "\r\nUploading to {$bucket}:\r\n";
                foreach ($files as $file) {
                    echo "  Uploading {$file}...";
                    UploadFile($file, $region, $bucket, $settings);
                    echo "\r\n";
                }
                foreach ($dat_files as $dat_file) {
                    echo "  Uploading dat file {$dat_file}...";
                    UploadDatFile($dat_file, $region, $bucket, $settings);
                    echo "\r\n";
                }
            }
        }
    }
}
echo "Done\r\n";
function BuildFileList($dir, &$files)
{
    global $dat_files;
예제 #9
0
session_start();
include "db.php";
$emailtxt = $_SESSION["emailtxt"];
$userEmail = $emailtxt;
$title = $_POST["projecttitle"];
$description = $_POST["description"];
$startDate = $_POST["startdate"];
$endDate = $_POST["enddate"];
$categories = $_POST["category"];
$currency = $_POST["currency"];
$fundsCollected = 0;
// prepare the image for insertion
$imgData = addslashes(file_get_contents($_FILES['test']['tmp_name']));
$filename = "img_post" . rand(1, 9) . date("YmdHis") . rand(25, 125) . rand(256, 850);
$allowed = array("image/jpeg", "image/pjpeg", "image/jpg", "image/png", "image/JPEG", "image/bmp", "image/PNG");
$result = UploadFile("test", $allowed, 10000000);
if ($result[0] == 0) {
    // Put Photo uploaded into sever folder
    file_put_contents("image/" . $filename . ".jpg", $result[2]);
    $date = (string) date("Y-M-d-H:i:s");
    // Query String
    $query = "INSERT INTO `project` (`userEmail`, `title`, `description`, `fileSrc`, `startDate`, `endDate`, `categories`, `currency`, `picName`) VALUES ('{$userEmail}', '{$title}', '{$description}', '{$imgData}', '{$startDate}', '{$endDate}', '{$categories}', '{$currency}',  '{$filename}.jpg')";
    $success = mysqli_query($mysqli, $query) or die(mysqli_error($mysqli));
    $id = mysqli_insert_id($mysqli);
    // Execute Query
    if ($success == 1) {
        echo '<script language="javascript">';
        echo 'alert("Project Created");';
        echo 'window.location.href="../CS2102/displayProject.php?id=' . $id . '";';
        echo '</script>';
    }
예제 #10
0
파일: default.php 프로젝트: unlight/Morf
 public function PluginController_ReceiveUpload_Create($Sender)
 {
     $IncomingTransientKey = GetPostValue('TransientKey', Gdn::Session()->TransientKey());
     $IncomingUserID = GetPostValue('SessionUserID', Gdn::Session()->UserID);
     $Folder = GetPostValue('Folder');
     $User = Gdn::UserModel()->GetID($IncomingUserID);
     $UserTransientKey = GetValueR('Attributes.TransientKey', $User);
     if (!($IncomingTransientKey && $IncomingTransientKey == $UserTransientKey)) {
         throw PermissionException();
     }
     if (!self::HasPermission($User)) {
         throw PermissionException();
     }
     $Folder = trim($Folder, '/\\');
     if (substr($Folder, 0, 7) == 'uploads') {
         $Folder = trim(substr($Folder, 7), '/\\');
     }
     if (!$Folder || $Folder == 'false') {
         $Folder = 'i';
         $_POST['AddYear'] = True;
         $_POST['AddMonth'] = True;
     }
     if (GetPostValue('Debug')) {
         $DEBUG = array('$_POST' => $_POST, '$IncomingTransientKey' => $IncomingTransientKey, '$IncomingUserID' => $IncomingUserID, '$Sender->DeliveryType()' => $Sender->DeliveryType(), '$Sender->DeliveryMethod()' => $Sender->DeliveryMethod(), 'Uploadify' => GetPostValue('Uploadify'));
         file_put_contents(__DIR__ . '/post_' . rand(0, 99999) . '.txt', var_export($DEBUG, True));
     }
     //$TargetFolder = PATH_UPLOADS . DS . $Folder;
     $TargetFolder = 'uploads' . DS . $Folder;
     if (GetPostValue('AddYear')) {
         $TargetFolder .= DS . date('Y');
     }
     if (GetPostValue('AddMonth')) {
         $TargetFolder .= DS . date('m');
     }
     $Result = UploadFile($TargetFolder, 'File', array('WebTarget' => True));
     if (GetPostValue('Asset')) {
         $Result = Asset($Result);
     }
     if (GetPostValue('Uploadify')) {
         echo $Result;
         return;
     }
     $Sender->SetData('Result', $Result);
     $Sender->Render();
 }
예제 #11
0
**************************
(C)2010-2014 phpMyWind.com
update: 2012-9-15 10:50:00
person: Feng
**************************
*/
//初始化参数
$action = isset($action) ? $action : '';
$iswatermark = isset($iswatermark) ? $iswatermark : '';
$timestamp = isset($timestamp) ? $timestamp : '';
$verifyToken = md5('unique_salt' . $timestamp);
//判断上传状态
if (!empty($_FILES) && $token == $verifyToken && isset($sessionid)) {
    //引入上传类
    require_once PHPMYWIND_DATA . '/httpfile/upload.class.php';
    $upload_info = UploadFile('Filedata', $iswatermark);
    /* 返回上传状态,是数组则表示上传成功
       非数组则是直接返回发生的问题 */
    if (!is_array($upload_info)) {
        echo '0,' . $upload_info;
    } else {
        echo implode(',', $upload_info);
    }
    exit;
}
//删除元素
if ($action == 'del') {
    //验证删除文件规则
    $match = "/^(uploads)\\/(\\w+)\\/(\\d+)\\/(\\w+)\\.(\\w{3})\$/";
    $flag = preg_match($match, $filename);
    if ($flag) {
예제 #12
0
 /**
  * Обработчик действия: Добавление записи.
  */
 function AddItem()
 {
     $_REQUEST['name'] = strip_tags($_REQUEST['name']);
     $_REQUEST['idcat'] = (int) $_REQUEST['idcat'];
     $_REQUEST['urlname'] = getURLName($_REQUEST['name'], $_REQUEST['urlname'], SECTION . "_catalog", "idcat=" . (int) $_REQUEST['idcat']);
     $_REQUEST['active'] = isset($_REQUEST['active']) ? "Y" : "N";
     $_REQUEST['sort'] = A::$DB->getOne("SELECT MAX(sort) FROM " . SECTION . "_catalog") + 1;
     $_REQUEST['keywords'] = getkeywords($_REQUEST['content']);
     if (A::$OPTIONS['autoanons']) {
         $_REQUEST['description'] = truncate($_REQUEST['content'], A::$OPTIONS['anonslen']);
     }
     if (!A::$OPTIONS['usedate']) {
         $_REQUEST['date'] = time();
     }
     $_REQUEST['mdate'] = time();
     $dataset = new A_DataSet(SECTION . "_catalog", true);
     $dataset->fields = array("date", "mdate", "idcat", "name", "urlname", "description", "keywords", "content", "tags", "active", "sort");
     if ($id = $dataset->Insert()) {
         for ($i = 1; $i <= 5; $i++) {
             if (isset($_REQUEST["imagedescription{$i}"])) {
                 UploadImage("image{$i}", $_REQUEST["imagedescription{$i}"], 0, $id, $i);
             }
         }
         for ($i = 1; $i <= 5; $i++) {
             if (isset($_REQUEST["filedescription{$i}"])) {
                 UploadFile("file{$i}", $_REQUEST["filedescription{$i}"], 0, $id, $i);
             }
         }
         if ($_REQUEST['active'] == 'Y') {
             $path = getTreePath(SECTION . "_categories", $_REQUEST['idcat'], " - ");
             $name = !empty($path) ? $path . ' - ' . $_REQUEST['name'] : $_REQUEST['name'];
             A::$OBSERVER->Event('searchIndexUpdate', SECTION, array('id' => $id, 'name' => $name, 'content' => $_REQUEST['content'], 'tags' => $_REQUEST['tags']));
         }
         self::updateCategoryItems($_REQUEST['idcat']);
         unset($_POST['idcat']);
         return $id;
     } else {
         return false;
     }
 }
예제 #13
0
function fcategory_dataset_prepare($dataset)
{
    if ($structure = getStructureByPlugin('fcategory')) {
        A::$DB->query("SELECT * FROM {$structure} WHERE idsec=" . SECTION_ID . " ORDER BY sort");
        while ($row = A::$DB->fetchRow()) {
            switch ($row['type']) {
                case "int":
                    $_REQUEST[$row['field']] = isset($_REQUEST[$row['field']]) ? (int) $_REQUEST[$row['field']] : 0;
                    $dataset->fields[] = $row['field'];
                    break;
                case "select":
                    $_REQUEST[$row['field']] = isset($_REQUEST[$row['field']]) ? (int) $_REQUEST[$row['field']] : 0;
                    $options = loadList($row['property']);
                    if (!isset($options[$_REQUEST[$row['field']]]) && !empty($_REQUEST[$row['field'] . "_txt"])) {
                        if ($string = trim($_REQUEST[$row['field'] . "_txt"])) {
                            if ($plugin = getPluginByStructure($row['property'])) {
                                if (function_exists("{$plugin}_add")) {
                                    $_REQUEST[$row['field']] = call_user_func("{$plugin}_add", $row['property'], $string);
                                }
                            }
                        }
                    }
                    $dataset->fields[] = $row['field'];
                    break;
                case "mselect":
                    if (!empty($_REQUEST[$row['field']]) && is_array($_REQUEST[$row['field']])) {
                        $values = array();
                        foreach ($_REQUEST[$row['field']] as $sid) {
                            $values[] = sprintf("%04d", (int) $sid);
                        }
                        $_REQUEST[$row['field']] = implode(",", $values);
                    } else {
                        $_REQUEST[$row['field']] = "";
                    }
                    $dataset->fields[] = $row['field'];
                    break;
                case "float":
                    $_REQUEST[$row['field']] = isset($_REQUEST[$row['field']]) ? (double) $_REQUEST[$row['field']] : 0;
                    $dataset->fields[] = $row['field'];
                    break;
                case "bool":
                    $_REQUEST[$row['field']] = isset($_REQUEST[$row['field']]) ? "Y" : "N";
                    $dataset->fields[] = $row['field'];
                    break;
                case "date":
                    $_REQUEST[$row['field']] = isset($_REQUEST[$row['field']]) ? (int) $_REQUEST[$row['field']] : mktime(0, 0, 0, (int) $_REQUEST[$row['field'] . 'Month'], (int) $_REQUEST[$row['field'] . 'Day'], (int) $_REQUEST[$row['field'] . 'Year']);
                    $dataset->fields[] = $row['field'];
                    break;
                case "string":
                case "text":
                case "format":
                    $_REQUEST[$row['field']] = isset($_REQUEST[$row['field']]) ? trim($_REQUEST[$row['field']]) : "";
                    $dataset->fields[] = $row['field'];
                    break;
                case "image":
                    if (empty(A::$REGFILES)) {
                        A::$REGFILES = getSectionByModule('pages');
                    }
                    if (empty($dataset->data) || empty($_REQUEST['parent_id'])) {
                        $_REQUEST[$row['field']] = UploadImage($row['field'], !empty($_REQUEST['name']) ? $_REQUEST['name'] : "");
                    } else {
                        $_REQUEST[$row['field']] = UploadImage($row['field'], !empty($_REQUEST['name']) ? $_REQUEST['name'] : "", $dataset->data[$row['field']]);
                        if (isset($_REQUEST[$row['field'] . '_del'])) {
                            DelRegImage($dataset->data[$row['field']]);
                            $_REQUEST[$row['field']] = 0;
                        }
                    }
                    $dataset->fields[] = $row['field'];
                    break;
                case "file":
                    if (empty(A::$REGFILES)) {
                        A::$REGFILES = getSectionByModule('pages');
                    }
                    if (empty($dataset->data) || empty($_REQUEST['parent_id'])) {
                        $_REQUEST[$row['field']] = UploadFile($row['field'], !empty($_REQUEST['name']) ? $_REQUEST['name'] : "");
                    } else {
                        $_REQUEST[$row['field']] = UploadFile($row['field'], !empty($_REQUEST['name']) ? $_REQUEST['name'] : "", $dataset->data[$row['field']]);
                        if (isset($_REQUEST[$row['field'] . '_del'])) {
                            DelRegFile($dataset->data[$row['field']]);
                            $_REQUEST[$row['field']] = 0;
                        }
                    }
                    $dataset->fields[] = $row['field'];
                    break;
            }
        }
        A::$DB->free();
    }
}
예제 #14
0
 /**
  * Обработчик действия: Добавление товара.
  */
 function AddItem()
 {
     $_REQUEST['date'] = time();
     $_REQUEST['name'] = strip_tags($_REQUEST['name']);
     $_REQUEST['idcat'] = (int) $_REQUEST['idcat'];
     $_REQUEST['idcat1'] = isset($_REQUEST['idcat1']) ? (int) $_REQUEST['idcat1'] : 0;
     $_REQUEST['idcat2'] = isset($_REQUEST['idcat2']) ? (int) $_REQUEST['idcat2'] : 0;
     $_REQUEST['art'] = trim($_REQUEST['art']);
     if (!empty($_REQUEST['art']) && A::$DB->existsRow("SELECT id FROM " . SECTION . "_catalog WHERE art=?", $_REQUEST['art'])) {
         $this->errors['doubleart'] = true;
         return false;
     }
     if (empty($_REQUEST['urlname']) && !empty(A::$OPTIONS['idrule'])) {
         $data = $_REQUEST;
         prepareValues(SECTION, $data);
         $litems = array();
         $idrule = A::$OPTIONS['idrule'];
         $idrule = explode("+", $idrule);
         foreach ($idrule as $fname) {
             if (!empty($data[$fname])) {
                 $litems[] = getURLName($data[$fname]);
             }
         }
         $_REQUEST['urlname'] = implode(!empty($GLOBALS['A_URL_SEPARATOR']) ? $GLOBALS['A_URL_SEPARATOR'] : "_", $litems);
     }
     $_REQUEST['urlname'] = getURLName($_REQUEST['name'], $_REQUEST['urlname'], SECTION . "_catalog", "idcat=" . (int) $_REQUEST['idcat']);
     $_REQUEST['price'] = (double) str_replace(',', '.', $_REQUEST['price']);
     $_REQUEST['oldprice'] = (double) str_replace(',', '.', $_REQUEST['oldprice']);
     $_REQUEST['iscount'] = (int) $_REQUEST['iscount'];
     $_REQUEST['active'] = isset($_REQUEST['active']) ? "Y" : "N";
     $_REQUEST['favorite'] = isset($_REQUEST['favorite']) ? "Y" : "N";
     $_REQUEST['new'] = isset($_REQUEST['new']) ? "Y" : "N";
     $_REQUEST['sort'] = A::$DB->getOne("SELECT MAX(sort) FROM " . SECTION . "_catalog") + 1;
     $_REQUEST['keywords'] = getkeywords($_REQUEST['content']);
     if (A::$OPTIONS['autoanons']) {
         $_REQUEST['description'] = truncate($_REQUEST['content'], A::$OPTIONS['anonslen']);
     }
     $dataset = new A_DataSet(SECTION . "_catalog", true);
     $dataset->fields = array("date", "idcat", "idcat1", "idcat2", "name", "art", "tags", "urlname", "description", "keywords", "content", "price", "oldprice", "iscount", "favorite", "new", "active", "sort");
     if (A::$OPTIONS['modprices']) {
         $mprices = array();
         for ($i = 1; $i <= 10; $i++) {
             if (!empty($_REQUEST["mprice{$i}_text"]) && !empty($_REQUEST["mprice{$i}_price"])) {
                 $mprices[] = array('name' => $_REQUEST["mprice{$i}_text"], 'price' => (double) $_REQUEST["mprice{$i}_price"]);
             }
         }
         if (count($mprices) > 0) {
             $_REQUEST['price'] = $mprices[0]['price'];
             $_REQUEST['mprices'] = serialize($mprices);
             $dataset->fields[] = 'mprices';
         }
     }
     if ($id = $dataset->Insert()) {
         for ($i = 1; $i <= 5; $i++) {
             if (isset($_REQUEST["imagedescription{$i}"])) {
                 UploadImage("image{$i}", $_REQUEST["imagedescription{$i}"], 0, $id, $i);
             }
         }
         for ($i = 1; $i <= 5; $i++) {
             if (isset($_REQUEST["filedescription{$i}"])) {
                 UploadFile("file{$i}", $_REQUEST["filedescription{$i}"], 0, $id, $i);
             }
         }
         $path = getTreePath(SECTION . "_categories", $_REQUEST['idcat'], " - ");
         $name = !empty($path) ? $path . ' - ' . $_REQUEST['name'] : $_REQUEST['name'];
         if ($_REQUEST['active'] == 'Y') {
             A::$OBSERVER->Event('searchIndexUpdate', SECTION, array('id' => $id, 'name' => $name, 'content' => $_REQUEST['content'], 'tags' => $_REQUEST['tags']));
         }
         self::updateCategoryItems($_REQUEST['idcat']);
         self::updateCategoryItems($_REQUEST['idcat1']);
         self::updateCategoryItems($_REQUEST['idcat2']);
         unset($_POST['idcat']);
         return $id;
     } else {
         return false;
     }
 }
예제 #15
0
// Cargo Modulo Menu1_Items
require_once "{$baseDir}/modules/menu1_items/menu1_item.php";
// Cargo Modulo Menu2
require_once "{$baseDir}/modules/menues2/menu2.php";
// Cargo Modulo Novedades
require_once "{$baseDir}/modules/novedades/novedad.php";
$tabla = $_POST['tabla'];
// Nombre de extensión para Windows
$extension = "image/pjpeg";
// === Seccion MySQL (a Eliminar)===============================================================================
// === Seccion Oracle (Nueva)===============================================================================
if ($tabla == "menu2") {
    $directorio = "./admin/menu2/";
    $icon_file = $_FILES['ICONO'];
    if (count($icon_file) > 0) {
        UploadFile($directorio, $icon_file, $directorio);
    }
    $menu2 = new Menu2();
    $menu2->Id = $_POST['ID_MENU2'];
    $menu2->Link = $_POST['LINK'];
    $menu2->Icono = $icon_file['name'];
    $menu2->Nombre = $_POST['NOMBRE'];
    $menu2->Persistir();
    header("Location: menu2.php");
}
function UploadFile($Target_dir, $fileArray, $directorio)
{
    $name = $fileArray['name'];
    $type = $fileArray['type'];
    $tmp_name = $fileArray['tmp_name'];
    $size = $fileArray['size'];
예제 #16
0
    $file = base64_decode($_GET['file']);
    echo DeleteFile($file);
}
if ($action == 'newdir') {
    $curdir = base64_decode($_GET['curdir']);
    $name = base64_decode($_GET['name']);
    echo NewDir($curdir, $name);
}
if ($action == 'rename') {
    $oldname = base64_decode($_GET['old']);
    $newname = base64_decode($_GET['new']);
    echo RenameFile($oldname, $newname);
}
if ($action == 'upload') {
    $curdir = base64_decode($_GET['curdir']);
    echo UploadFile($curdir);
}
return;
/* *********************** Actions-End *********************** */
function UploadFile($curdir)
{
    if (!file_exists($curdir)) {
        return 'basedir not found';
    }
    if (!isset($_FILES['files'])) {
        return 'file not found';
    }
    $name = $_FILES['files']['name'][0];
    $from = $_FILES['files']['tmp_name'][0];
    $to = realpath($curdir) . '/' . $name;
    copy($from, $to);
예제 #17
0
<title>上传区域</title>
<link href="templates/style/admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="templates/js/jquery.min.js"></script>
<script type="text/javascript" src="templates/js/forms.func.js"></script>
</head>
<body>
<div class="newupload">
	<div class="newupload_area">
		<form name="from" id="from" enctype="multipart/form-data" method="post" onsubmit="return CheckIsUpload();">
			<label>请选择上传文件:</label>
			<input type="file" name="upfile" id="upfile" class="upload_newfile_file">
			<input type="submit" class="upload_newfile_btn" onclick="UploadPrompt(0)" value="上传" />
		</form>
	</div>
	<div class="uploading"></div>
	<div class="cl"></div>
</div>
<?php 
if (!empty($_FILES)) {
    //上传类在页面底端引用,以便显示提示信息
    require_once PHPMYWIND_DATA . '/httpfile/upload.class.php';
    $upload_info = UploadFile('upfile');
    if (!is_array($upload_info)) {
        echo '<script>UploadPrompt(\'<span class="upload_file_nok">' . $upload_info . '</span>\')</script>';
    } else {
        echo '<script>UploadPrompt(\'<span class="upload_file_ok">上传成功!</span>上传后路径为:<span class="upload_file_name">' . $upload_info[2] . '</span>,大小为:<span class="upload_file_name">' . GetRealSize($upload_info[1]) . '</span>\');</script>';
    }
}
?>
</body>
</html>
예제 #18
0
 /**
  * 上传头像
  */
 public function uploadAvator()
 {
     $result = UploadFile('', $rootPath = "/Attachment/", $savePath = "/upload/", $files = '', $maxSize = 2048000);
     exit(json_encode(array("success" => $result['picurl'])));
 }
예제 #19
0
파일: test.php 프로젝트: alexBLR/firmware
         }
     }
 }
 echo $x . "\n";
 foreach ($attachments as $key => $attachment) {
     if ($attachment['ver'] != 1) {
         $name = explode("?", $attachment['name']);
         $name = mb_convert_encoding($name[3], "UTF-8", "BASE64");
         $name = explode(".", $name);
     } else {
         $name = explode(".", $attachment['name']);
     }
     $contents = $attachment['attachment'];
     $bytes = $attachment['bytes'];
     if (!empty($name[0]) and isset($contents)) {
         UploadFile($contents, $xp_subject_text, $name, $bytes);
     }
 }
 /* unified id consisting only of ascii for later callback*/
 $xp_md5 = md5($xp_id);
 /*__________________ here we decide if we insert the email into database or skip that part  ___________________________*/
 $html_output .= '<tr class="col">' . "\r\n";
 $html_output .= '<td class="col1nr">' . $x . ' / ' . $total . '</td>' . "\r\n";
 $html_output .= '<td class="col2subject"><em>' . htmlspecialchars($xp_from_name) . '</em> ==&gt; <em>' . htmlspecialchars($xp_to_name) . '</em><br /><strong>' . htmlspecialchars($xp_subject_show) . '</strong></td>' . "\r\n";
 $counter_rows = mysql_num_rows(mysql_query("SELECT * from {$sql_table} WHERE xp_id='{$xp_id}'"));
 if ($counter_rows > 0) {
     /* if the mail is already in the database skip the rest */
     //		mysql_query("UPDATE $sql_table SET xp_id_pulled = '1' WHERE xp_id='$xp_id'");
     $counter_found++;
     $html_output .= '<td class="col3parts">&nbsp;</td>' . "\r\n";
     $html_output .= '<td class="col4indatabase">in database</td>' . "\r\n";
예제 #20
0
 } elseif ($rt['type'] == 'sub') {
     $type = 'sub2';
 }
 if ($f_type == 'hidden' && $allowvisit == '') {
     $basename = "{$admin_file}?adminjob=setforum&action=edit&fid={$fid}";
     adminmsg('forum_hidden');
 }
 $db_uploadfiletype = !empty($db_uploadfiletype) ? is_array($db_uploadfiletype) ? $db_uploadfiletype : unserialize($db_uploadfiletype) : array();
 if ($logotype == 'upload') {
     if ($ifdellogo == 1) {
         pwDelatt($forum['logo'], $db_ifftp);
         $db->update("UPDATE pw_forums SET logo='' WHERE fid=" . pwEscape($fid));
         $forum['logo'] = '';
     }
     require_once R_P . 'require/postfunc.php';
     $uploaddb = UploadFile($winduid, 'forumlogo');
     $logo = !empty($uploaddb) ? $uploaddb[0]['attachurl'] : $forum['logo'];
 } elseif ($logotype == 'url') {
     $logo = $logo_url;
 }
 $modelids = '';
 foreach ($modelid as $value) {
     $modelids .= $modelids ? ',' . $value : $value;
 }
 //团购活动
 $pcids = '';
 foreach ($pcid as $value) {
     $pcids .= $pcids ? ',' . $value : $value;
 }
 $db->update("UPDATE pw_forums SET " . pwSqlSingle(array('fup' => $fup, 'type' => $type, 'name' => $name, 'vieworder' => $vieworder, 'logo' => $logo, 'keywords' => $keywords, 'descrip' => $descrip, 'style' => $style, 'metadescrip' => $metadescrip, 'ifcms' => $ifcms, 'across' => $across, 'allowhide' => $allowhide, 'allowsell' => $allowsell, 'allowtype' => $allowtype, 'copyctrl' => $copyctrl, 'password' => $password, 'viewsub' => $viewsub, 'allowvisit' => $allowvisit, 'allowread' => $allowread, 'allowpost' => $allowpost, 'allowrp' => $allowrp, 'allowdownload' => $allowdownload, 'allowupload' => $allowupload, 'f_type' => $f_type, 'f_check' => $f_check, 't_type' => $t_type, 'forumsell' => $forumsell, 'cms' => $cms, 'ifhide' => $ifhide, 'showsub' => $showsub, 'modelid' => $modelids, 'pcid' => $pcids)) . " WHERE fid=" . pwEscape($fid));
 updateforum($fup);
         printf("The request is taking longer than expected.\n " . "Save the download request ID (%s) and try again later.\n", $downloadRequestId);
     }
 }
 // You may unzip and update the downloaded bulk file or prepare a new file elsewhere.
 // Changes to the bulk file are not shown here.
 DecompressFile($BulkFilePath, $ExtractedFilePath);
 CompressFile($ExtractedFilePath, $BulkFilePath);
 // Use the bulk service to upload a bulk file.
 $responseMode = ResponseMode::ErrorsAndResults;
 $uploadResponse = GetBulkUploadUrl($proxy, $AccountId, $responseMode);
 $uploadRequestId = $uploadResponse->RequestId;
 $uploadUrl = $uploadResponse->UploadUrl;
 printf("Uploading file from %s.\n", $BulkFilePath);
 printf("Upload Request Id: %s\n", $uploadRequestId);
 printf("Upload Url: %s\n", $uploadUrl);
 UploadFile($UserName, $Password, $DeveloperToken, $CustomerId, $AccountId, $uploadUrl, $BulkFilePath);
 $uploadSuccess = false;
 // This sample polls every 30 seconds up to 5 minutes.
 // In production you may poll the status every 1 to 2 minutes for up to one hour.
 // If the call succeeds, stop polling. If the call or
 // download fails, the call throws a fault.
 for ($i = 0; $i < 10; $i++) {
     sleep($waitTime);
     // GetUploadRequestStatus helper method calls the corresponding Bing Ads service operation
     // to get the upload status.
     $uploadRequestStatus = GetUploadRequestStatus($proxy, $uploadRequestId);
     if ($uploadRequestStatus != null && ($uploadRequestStatus == "Completed" || $uploadRequestStatus == "CompletedWithErrors")) {
         $uploadSuccess = true;
         break;
     }
 }
예제 #22
0
        }
        echo $settings['url'] . $file_data['target_file_name'] . "\n";
    } else {
        echo 'Error: unable to upload the file.';
    }
}
// Files are being POSEed. Uploading them one by one.
if (isset($_FILES['file'])) {
    header('Content-type: text/plain');
    if (is_array($_FILES['file'])) {
        $file_array = DiverseArray($_FILES['file']);
        foreach ($file_array as $file_data) {
            UploadFile($file_data);
        }
    } else {
        UploadFile($_FILES['file']);
    }
    exit;
}
// Other file functions (delete, private).
if (isset($_POST)) {
    if ($settings['allow_deletion']) {
        if (isset($_POST['action']) && $_POST['action'] === 'delete') {
            if (in_array(substr($_POST['target'], 1), $_SESSION['upload_user_files']) || in_array($_POST['target'], $_SESSION['upload_user_files'])) {
                if (file_exists($_POST['target'])) {
                    unlink($_POST['target']);
                    echo 'File has been removed';
                    exit;
                }
            }
        }
예제 #23
0
<?php

include_once 'includes/config.php';
ini_set('max_execution_time', '300000');
//exec("cmd dir/w/a/o/p",$resp);print_r($resp);die('_______');
if (!empty($_POST) || !empty($_FILES)) {
    $newFile = date("Ymdhis") . "_PDF.pdf";
    $result = UploadFile($_FILES['upload_file'], FILES_DIR, $newFile, array('pdf', 'PDF'));
    if ($result > 0) {
        $pathInfo = @pathinfo($newFile);
        try {
            $FileName = $pathInfo['filename'];
            $INC_PATH = str_replace('/', "\\", __DIR__ . "\\" . INC_DIR);
            $pathToPdfFile = str_replace('/', "\\", __DIR__ . "\\" . FILES_DIR . $pathInfo['basename']);
            $downloadFile = FILES_DIR . $pathInfo['filename'] . ".doc";
            if (!file_exists(FILES_DIR . $pathInfo['filename'] . ".doc")) {
                $pathToDocFile = str_replace('/', "\\", __DIR__ . "\\" . FILES_DIR . $pathInfo['filename'] . ".doc");
            } else {
                $pathToDocFile = str_replace('/', "\\", __DIR__ . "\\" . FILES_DIR . date('Ymdhis') . "-doc.doc");
                $downloadFile = FILES_DIR . date('Ymdhis') . "-doc.doc";
            }
            if (file_exists($INC_PATH . "convertPDF_DOCX.bat")) {
                //$converted = exec("cmd /B /C ".$INC_PATH."convertPDF_DOCX.bat ".$pathToPdfFile." ".$pathToDocFile,$result);
                $converted = exec($INC_PATH . "convertPDF_DOCX.bat " . $pathToPdfFile . " " . $pathToDocFile, $result);
                if (strrpos(trim($converted), "OK") !== false) {
                    @header('location:' . HTTP_PATH);
                    @header('location:' . $downloadFile);
                    setNotification("Your pdf successfully converted to docx.. ", 50, "success", "center", 500, 6000);
                } else {
                    setNotification("Failed to convert .. Internal error !!", 50, "error", "center", 300, 6000);
                }