$thumbLink = $urlPath . 'thumbsm.' . $upload['name']; $thumbLinkEncoded = $urlPath . 'thumbsm.' . rawurlencode($upload['name']); $thumbLinkExternal = $urlPath . 'thumbnail.' . $upload['name']; $ext = getFileExtension($upload['name']); // get thumbsm if (!file_exists(GSTHUMBNAILPATH . $thumbLink) || isset($_REQUEST['regenthumbsm'])) { $imgSrc = '<img class="' . $ext . '" src="inc/thumb.php?src=' . $urlPath . rawurlencode($upload['name']) . '&dest=' . $thumbLinkEncoded . '&f=1&x=' . $thumbsm_w . '&y=' . $thumbsm_h . '" />'; } else { $imgSrc = '<img class="' . $ext . '" src="' . tsl($SITEURL) . getRelPath(GSTHUMBNAILPATH) . $thumbLinkEncoded . '" />'; } // thumbnail link lightbox echo '<a href="' . tsl($SITEURL) . getRelPath($path) . rawurlencode($upload['name']) . '" title="' . rawurlencode($upload['name']) . '" rel="fancybox_i" >' . $imgSrc . '</a>'; # get external thumbnail link # if not exist generate it if (!file_exists(GSTHUMBNAILPATH . $thumbLinkExternal) || isset($_REQUEST['regenthumbnail'])) { genStdThumb($subPath, $upload['name']); } $thumbnailLink = '<a href="' . tsl($SITEURL) . getRelPath(GSTHUMBNAILPATH) . $thumbLinkExternal . '" class="label label-ghost thumblinkexternal" data-fileurl="' . getRelPath(GSTHUMBNAILPATH) . $thumbLinkExternal . '">' . i18n_r('THUMBNAIL') . '</a>'; } else { // other files $gallery = ''; $controlpanel = ''; $pathlink = tsl($SITEURL) . getRelPath($path) . $upload['name']; } // name column linked echo '</td><td>' . getUploadIcon($upload['name']) . '<a title="' . i18n_r('VIEW_FILE') . ': ' . htmlspecialchars($upload['name']) . '" href="' . $pathlink . '" class="primarylink" data-fileurl="' . $primarylink . '">' . htmlspecialchars($upload['name']) . '</a>' . $thumbnailLink . '</td>'; // size column echo '<td class="file_size right"><span>' . $upload['size'] . '</span></td>'; // file perms column if ($showperms) { $filePerms = substr(sprintf('%o', fileperms($path . $upload['name'])), -4);
$file_loc = $path . $count . '-' . $base; $base = $count . '-' . $base; $count++; } //validate file if (validate_safe_file($_FILES["file"]["tmp_name"][$i], $_FILES["file"]["name"][$i])) { move_uploaded_file($_FILES["file"]["tmp_name"][$i], $file_loc); if (defined('GSCHMOD')) { chmod($file_loc, GSCHMOD); } else { chmod($file_loc, 0644); } exec_action('file-uploaded'); // generate thumbnail require_once 'inc/imagemanipulation.php'; genStdThumb($subFolder, $base); $messages[] = i18n_r('FILE_SUCCESS_MSG') . ': <a href="' . $SITEURL . 'data/uploads/' . $subFolder . $base . '">' . $SITEURL . 'data/uploads/' . $subFolder . $base . '</a>'; } else { $messages[] = $_FILES["file"]["name"][$i] . ' - ' . i18n_r('ERROR_UPLOAD'); } //successfull message } } // after uploading all files process messages if (sizeof($messages) != 0) { foreach ($messages as $msg) { $success = $msg . '<br />'; } } if (sizeof($errors) != 0) { foreach ($errors as $msg) {
if ($objImage->imageok) { $objImage->setCrop($_POST['x'], $_POST['y'], $_POST['w'], $_POST['h']); //$objImage->show(); $objImage->save($thumb_folder . 'thumbnail.' . $src); $success = i18n_r('THUMB_SAVED'); } else { i18n('ERROR'); } } list($imgwidth, $imgheight, $imgtype, $imgattr) = getimagesize($src_folder . $subPath . $src); if (file_exists($thumb_folder . 'thumbnail.' . $src)) { list($thwidth, $thheight, $thtype, $athttr) = getimagesize($thumb_folder . 'thumbnail.' . $src); $thumb_exists = ' | <a href="' . $thumb_folder_rel . 'thumbnail.' . rawurlencode($src) . '" rel="facybox_i" >' . i18n_r('CURRENT_THUMBNAIL') . '</a> <code>' . $thwidth . 'x' . $thheight . '</code>'; } else { require_once 'inc/imagemanipulation.php'; genStdThumb($subPath, $src); list($thwidth, $thheight, $thtype, $athttr) = getimagesize($thumb_folder . 'thumbnail.' . $src); $thumb_exists = ' | <a href="' . $thumb_folder_rel . 'thumbnail.' . rawurlencode($src) . '" rel="facybox_i" >' . i18n_r('CURRENT_THUMBNAIL') . '</a> <code>' . $thwidth . 'x' . $thheight . '</code>'; } get_template('header', cl($SITENAME) . ' » ' . i18n_r('FILE_MANAGEMENT') . ' » ' . i18n_r('IMAGES')); include 'template/include-nav.php'; ?> <div class="bodycontent clearfix"> <div id="maincontent"> <div class="main"> <h3><?php i18n('IMG_CONTROl_PANEL'); ?> </h3>
$tempFile = $_FILES['Filedata']['tmp_name']; $name = clean_img_name(to7bit($_FILES['Filedata']['name'])); $targetPath = isset($_POST['path']) ? GSDATAUPLOADPATH . $_POST['path'] . "/" : GSDATAUPLOADPATH; $targetFile = str_replace('//', '/', $targetPath) . $name; //validate file if (validate_safe_file($tempFile, $_FILES["Filedata"]["name"], $_FILES["Filedata"]["type"])) { move_uploaded_file($tempFile, $targetFile); if (getDef('GSCHMOD')) { chmod($targetFile, GSCHMOD); } else { chmod($targetFile, 0644); } exec_action('file-uploaded'); } else { die(i18n_r('ERROR_UPLOAD') . ' - ' . i18n_r('BAD_FILE')); // invalid file } $path = isset($_POST['path']) ? $_POST['path'] . "/" : ""; $thumbsPath = GSTHUMBNAILPATH . $path; require 'inc/imagemanipulation.php'; genStdThumb(isset($_POST['path']) ? $_POST['path'] . "/" : '', $name); echo 1; } else { die(i18n_r('ERROR_UPLOAD') . ' - ' . i18n_r('MISSING_FILE')); // nothing sent } } else { die(i18n_r('ERROR_UPLOAD') . ' - ' . i18n_r('API_ERR_AUTHFAILED')); // Wrong session hash! } die('END');
$name = pathinfo($file, PATHINFO_FILENAME); $name = clean_img_name(to7bit($name)); $targetPath = isset($_POST['path']) ? GSDATAUPLOADPATH . $_POST['path'] . "/" : GSDATAUPLOADPATH; $targetFile = str_replace('//', '/', $targetPath) . $name . '.' . $extension; //validate file if (validate_safe_file($tempFile, $_FILES["Filedata"]["name"])) { move_uploaded_file($tempFile, $targetFile); if (defined('GSCHMOD')) { chmod($targetFile, GSCHMOD); } else { chmod($targetFile, 0644); } exec_action('file-uploaded'); } else { die(i18n_r('ERROR_UPLOAD') . ' - ' . i18n_r('BAD_FILE')); // invalid file } $path = isset($_POST['path']) ? $_POST['path'] . "/" : ""; require 'inc/imagemanipulation.php'; genStdThumb(isset($_POST['path']) ? $_POST['path'] . "/" : '', $name . '.' . $extension); die('1'); // success } else { die(i18n_r('ERROR_UPLOAD') . ' - ' . i18n_r('MISSING_FILE')); // nothing sent } } else { die(i18n_r('ERROR_UPLOAD') . ' - ' . i18n_r('API_ERR_AUTHFAILED')); // Wrong session hash! } die('END');
$file_base = $count . '-' . $file_base; $count++; } } //validate file if (validate_safe_file($_FILES["file"]["tmp_name"][$i], $_FILES["file"]["name"][$i], $_FILES["file"]["type"][$i])) { move_uploaded_file($_FILES["file"]["tmp_name"][$i], $file_loc); if (getDef('GSCHMOD')) { chmod($file_loc, GSCHMOD); } else { chmod($file_loc, 0644); } exec_action('file-uploaded'); // generate thumbnail require_once 'inc/imagemanipulation.php'; genStdThumb($subFolder, $file_base); $messages[] = i18n_r('FILE_SUCCESS_MSG'); if (requestIsAjax()) { header("HTTP/1.0 200"); die; } } else { $messages[] = $_FILES["file"]["name"][$i] . ' - ' . i18n_r('ERROR_UPLOAD'); if (requestIsAjax()) { header("HTTP/1.0 403"); i18n('ERROR_UPLOAD'); die; } } //successfull message }