Пример #1
0
 		$response->addAlert(ob_get_contents());
 		ob_end_clean();
 		//return $response;*/
 if (isset($WPRO_SESS->data['imageEditor'][$editorID])) {
     $file = isset($WPRO_SESS->data['imageEditor'][$editorID]['file']) ? $WPRO_SESS->data['imageEditor'][$editorID]['file'] : '';
     $temp = isset($WPRO_SESS->data['imageEditor'][$editorID]['temp']) ? $WPRO_SESS->data['imageEditor'][$editorID]['temp'] : '';
     if (empty($temp)) {
         $extension = strrchr(strtolower($file), '.');
         $temp = $fs->resolveDuplicate(uniqid('_WPROTEMP_') . $extension, $directory);
         $imageToEdit = $file;
         $canSave = false;
     } else {
         $imageToEdit = $temp;
         $canSave = true;
     }
     $file = $fs->makeFileNameOK($file);
     $imageToEdit = $fs->makeFileNameOK($imageToEdit);
     $temp = $fs->makeFileNameOK($temp);
     // check memory limit
     if (!stristr($task, 'sav') && !strstr($task, 'next') && !strstr($task, 'prev')) {
         // check memory limit
         if (!$im->_setMemoryForImage($directory . $imageToEdit)) {
             $response->addAlert($DIALOG->langEngine->get('wproCore_fileBrowser', 'JSEditMemoryError'));
             list($origwidth, $origheight) = getimagesize($directory . $imageToEdit);
             $response->addScriptCall('editFinished', $file, $file, $origwidth, $origheight, false);
             return $response;
         }
     }
     if (!empty($file) && !empty($temp) && is_file($directory . $imageToEdit)) {
         if ($task == 'rotate') {
             if ($options == 90 || $options == 270) {
Пример #2
0
 $uploaded = isset($WPRO_SESS->data['uploads'][$uploadID]['succeeded']) ? $WPRO_SESS->data['uploads'][$uploadID]['succeeded'] : array();
 if (isset($WPRO_SESS->data['uploads'][$uploadID]['overwrite'])) {
     if (count($WPRO_SESS->data['uploads'][$uploadID]['overwrite'])) {
         if (!$dir->overwrite) {
             $response->addAlert($DIALOG->langEngine->get('wproCore_fileBrowser', 'JSOverwritePermissionsError'));
             $this->displayFolderList($folderId, $folderPath, $page, $sortBy, $sortDir, $view, array(), $history, $response);
             $response->addScriptCall("dialog.hideLoadMessage", '');
             unset($WPRO_SESS->data['uploads'][$uploadID]);
             $WPRO_SESS->doSave = true;
             return $response;
         } else {
             foreach ($overwrite as $file) {
                 if (isset($WPRO_SESS->data['uploads'][$uploadID]['overwrite'][$file])) {
                     $temp = $WPRO_SESS->data['uploads'][$uploadID]['overwrite'][$file];
                     //if ($fs->fileNameOk($file)) {
                     if (!($file = $fs->makeFileNameOK($file)) || !($temp = $fs->makeFileNameOK($temp))) {
                         array_push($failed, $file);
                         continue;
                     }
                     //$isFile = is_file($directory.$file);
                     // if it doesn't exist, who cares? we were going to delete it anyway!
                     if (!file_exists($directory . $temp)) {
                         continue;
                     }
                     if ($fs->delete($directory . $file) && $fs->rename($directory . $temp, $directory . $file)) {
                         unset($WPRO_SESS->data['uploads'][$uploadID]['overwrite'][$file]);
                         // delete thumbnails
                         if ($fs->fileNameOk($EDITOR->thumbnailFolderName)) {
                             if (is_file($directory . $EDITOR->thumbnailFolderName . '/' . $file)) {
                                 $fs->delete($directory . $EDITOR->thumbnailFolderName . '/' . $file);
                             } else {
Пример #3
0
 function displayEmbedPluginsJS()
 {
     global $EDITOR, $DIALOG;
     $this->loadEmbedPlugins();
     $fs = new wproFilesystem();
     if (WPRO_COMPILE_JS_INCLUDES) {
         $s = '';
         foreach ($this->embedPlugins as $name => $plugin) {
             $s .= ',' . $fs->makeVarOK($name) . '/' . $fs->makeFileNameOK($plugin->jsFile);
         }
         $DIALOG->headContent->add('<script type="text/javascript" src="' . htmlspecialchars($EDITOR->editorLink('core/plugins/wproCore_fileBrowser/compileFilePluginsJS.php?plugins=' . base64_encode($s) . '&v=' . $EDITOR->version)) . '"></script>');
     } else {
         foreach ($this->embedPlugins as $name => $plugin) {
             $DIALOG->headContent->add('<script type="text/javascript" src="plugins/mediaPlugins/' . $fs->makeVarOK($name) . '/' . $plugin->jsFile . '"></script>');
         }
     }
 }
Пример #4
0
    $msg->msg = 'Sorry not enough parameters.';
    $msg->alert();
}
$params['folderPath'] = base64_decode($params['folderPath']);
$DIALOG->title = str_replace('...', '', $DIALOG->langEngine->get('editor', 'image'));
$DIALOG->bodyInclude = WPRO_DIR . 'core/plugins/wproCore_fileBrowser/tpl/imageEditor.tpl.php';
$DIALOG->headContent->add('<link rel="stylesheet" href="core/plugins/wproCore_fileBrowser/css/imageEditor.css" type="text/css" />');
$DIALOG->headContent->add('<script type="text/javascript" src="core/plugins/wproCore_fileBrowser/js/imageEditor_src.js"></script>');
$x = null;
if ($arr = $this->getFolder($params['folderID'], $params['folderPath'], $x)) {
    $editorID = md5(uniqid(rand(), true));
    $directory = $arr['directory'];
    $URL = $arr['URL'];
    $dir = $arr['dir'];
    $fs = new wproFilesystem();
    $image = $fs->makeFileNameOK($params['image']);
    if (!file_exists($directory . $image) || !$image) {
        require_once WPRO_DIR . 'core/libs/wproMessageExit.class.php';
        $msg = new wproMessageExit();
        $msg->msgCode = WPRO_CRITICAL;
        $msg->msg = $DIALOG->langEngine->get('wproCore_fileBrowser', 'fileNotExistError');
        $msg->alert();
    }
    // check extension
    // check file extension
    $extension = strrchr($image, '.');
    if (!$fs->extensionOK($extension, array('.jpg', '.jpeg', '.gif', '.png'))) {
        require_once WPRO_DIR . 'core/libs/wproMessageExit.class.php';
        $msg = new wproMessageExit();
        $msg->msgCode = WPRO_CRITICAL;
        $msg->msg = $DIALOG->langEngine->get('wproCore_fileBrowser', 'editImageExtensionError');