Example #1
0
 function init(&$DIALOG)
 {
     global $EDITOR;
     $DIALOG->title = str_replace('...', '', $DIALOG->langEngine->get('editor', 'emoticon'));
     $DIALOG->reloadInFrame();
     $DIALOG->bodyInclude = WPRO_DIR . 'core/plugins/wproCore_emoticons/dialog.tpl.php';
     $DIALOG->headContent->add('<link rel="stylesheet" href="core/plugins/wproCore_emoticons/dialog.css" type="text/css" />');
     $DIALOG->headContent->add('<script type="text/javascript" src="core/plugins/wproCore_emoticons/dialog_src.js"></script>');
     $DIALOG->template->assign('emoticonDir', $EDITOR->emoticonDir);
     $DIALOG->template->assign('emoticonURL', $EDITOR->emoticonURL);
     if (WPRO_EMOTICON_DIR && $EDITOR->emoticonDir != WPRO_EMOTICON_DIR) {
         // load from custom directory
         $DIALOG->template->assign('custom', true);
         require_once WPRO_DIR . 'core/libs/wproFilesystem.class.php';
         $fs = new wproFilesystem();
         $DIALOG->template->assign('files', $fs->getFilesInDir($EDITOR->emoticonDir, 'name', 'asc', array('.gif', '.png', '.jpg', '.jpeg')));
     } else {
         // load local smilies
         $emoticonDir = $EDITOR->emoticonDir;
         $emoticonURL = $EDITOR->emoticonURL;
         require WPRO_DIR . 'conf/emoticons.inc.php';
         $DIALOG->template->assign('emoticons', $emoticons);
         $DIALOG->template->assign('custom', false);
     }
     $DIALOG->options = array(array('type' => 'submit', 'name' => 'ok', 'disabled' => 'disabled', 'value' => $DIALOG->langEngine->get('core', 'insert')), array('onclick' => 'dialog.close()', 'type' => 'button', 'name' => 'close', 'value' => $DIALOG->langEngine->get('core', 'cancel')));
 }
Example #2
0
 function processRequests()
 {
     if (isset($_SERVER['QUERY_STRING']) && (!isset($_GET) || !count($_GET) && strlen($_SERVER['QUERY_STRING']))) {
         // we might be in a framework such as CodeIgniter that deletes the $_GET vars.
         // re-create $_GET from the query string
         $matches = array();
         preg_match_all('#(^|[\\?&])([a-z0-9\\-_]+)=([^&]*)#si', $_SERVER['QUERY_STRING'], $matches, PREG_SET_ORDER);
         for ($i = 0; $i < count($matches); $i++) {
             // Because WysiwygPro will remove slashes from $_GET if magic_quotes_gpc is on we should add some slashes in so the array is the same as the PHP generated $_GET would have been
             if (get_magic_quotes_gpc()) {
                 $_GET[$matches[$i][2]] = addslashes(urldecode($matches[$i][3]));
             } else {
                 $_GET[$matches[$i][2]] = urldecode($matches[$i][3]);
             }
         }
     }
     // get the requested file
     $req_path = isset($_GET['wproroutelink']) ? $_GET['wproroutelink'] : '';
     if (!empty($req_path)) {
         $wpro_path = WPRO_DIR;
         // cannot include if IN_WPRO is defined for security purposes
         // this prevents out of order execution attacks
         // and makes this process no more dangerous than someone browsing the WysiwygPro directory
         if (defined('IN_WPRO')) {
             exit('WysiwygPro. Route request could not be performed. Please ensure that the WysiwygPro class (or any other WysiwygPro scripts) are included AFTER the call to wproRoute::processRequests().');
         }
         // validate path by removing all dangerous characters, and since we know that all valid WPro files match this
         $req_path = preg_replace("/[^A-Za-z0-9_\\-]/si", '', $req_path);
         // create path
         $req_path = str_replace('-', '/', $req_path) . '.php';
         // extra out of order execution protection just to be on the safe side.
         if (stristr($req_path, '.class.php') || stristr($req_path, '.inc.php') || stristr($req_path, '.tpl.php')) {
             exit;
         }
         // initiate global vars
         global $EDITOR, $DIALOG, $WPRO_SESS, $wpro_inDialog;
         $EDITOR = NULL;
         $DIALOG = NULL;
         $WPRO_SESS = NULL;
         $wpro_inDialog = NULL;
         // validate and include file, prevent directory traversal.
         if (!defined('WPRO_IN_ROUTE')) {
             define('WPRO_IN_ROUTE', true);
         }
         // deleting globals might break the parent application, we have to trust the parent application is secure?!
         if (!defined('WPRO_ALLOW_GLOBALS')) {
             define('WPRO_ALLOW_GLOBALS', true);
         }
         // this is OK since the only global vars used by WPro have been initiated above
         // check for directory traversal and that file exists
         include_once $wpro_path . 'core/libs/wproFilesystem.class.php';
         $fs = new wproFilesystem();
         if ($fs->folderNameOK($req_path) && is_file($wpro_path . $req_path)) {
             include_once $wpro_path . $req_path;
             exit;
         }
     }
 }
Example #3
0
if (!defined('IN_WPRO')) {
    exit;
}
global $EDITOR, $DIALOG, $WPRO_SESS;
//if (!$response) {
$response = $DIALOG->createAjaxResponse();
//}
// initial var check...
if (!isset($moveCopyID) || !is_string($moveCopyID)) {
    $response->addAlert('Datatype error.');
    $response->addScriptCall("FB.onFolderNotFound", "");
    $response->addScriptCall("dialog.hideLoadMessage", '');
    $response->addScriptCall("hideMessageBox", '');
    return $response;
}
$fs = new wproFilesystem();
$failed = array();
$succeeded = array();
$moved = array();
if (isset($WPRO_SESS->data['move-copy'])) {
    if (isset($WPRO_SESS->data['move-copy'][$moveCopyID])) {
        $moved = isset($WPRO_SESS->data['move-copy'][$moveCopyID]['succeeded']) ? $WPRO_SESS->data['move-copy'][$moveCopyID]['succeeded'] : array();
        $srcFolderID = isset($WPRO_SESS->data['move-copy'][$moveCopyID]['srcFolderID']) ? $WPRO_SESS->data['move-copy'][$moveCopyID]['srcFolderID'] : '';
        $srcFolderPath = isset($WPRO_SESS->data['move-copy'][$moveCopyID]['srcFolderPath']) ? $WPRO_SESS->data['move-copy'][$moveCopyID]['srcFolderPath'] : '';
        $destFolderID = isset($WPRO_SESS->data['move-copy'][$moveCopyID]['destFolderID']) ? $WPRO_SESS->data['move-copy'][$moveCopyID]['destFolderID'] : '';
        $destFolderPath = isset($WPRO_SESS->data['move-copy'][$moveCopyID]['destFolderPath']) ? $WPRO_SESS->data['move-copy'][$moveCopyID]['destFolderPath'] : '';
        $folderID = $srcFolderID;
        $folderPath = $srcFolderPath;
        $action = $WPRO_SESS->data['move-copy'][$moveCopyID]['action'];
        $x = null;
        if ($srcArr = $this->getFolder($srcFolderID, $srcFolderPath, $x)) {
Example #4
0
<?php

if (!defined('IN_WPRO')) {
    exit;
}
global $EDITOR, $DIALOG, $WPRO_SESS;
//if (!$response) {
$response = $DIALOG->createAjaxResponse();
//}
// initial var check...
if (!isset($folderId, $folderPath, $editorID, $task) || !is_string($folderId) && !is_int($folderId) || !is_string($folderPath) || !is_string($editorID) || !is_string($task)) {
    $response->addAlert('Datatype error.');
    $response->addScriptCall("dialog.hideLoadMessage", '');
    return $response;
}
$fs = new wproFilesystem();
require_once WPRO_DIR . 'core/libs/wproImageEditor.class.php';
$im = new wproImageEditor();
$failed = array();
if ($arr = $this->getFolder($folderId, $folderPath, $response)) {
    $directory = $arr['directory'];
    $URL = $arr['URL'];
    $dir = $arr['dir'];
    if (!$dir->editImages) {
        $response->addAlert($DIALOG->langEngine->get('wproCore_fileBrowser', 'JSEditPermissionsError'));
        $response->addScriptCall("dialog.close", '');
        $response->addScriptCall("dialog.hideLoadMessage", '');
        return $response;
    }
    if (isset($WPRO_SESS->data['imageEditor'])) {
        /*ob_start();
Example #5
0
if (!isset($folderId, $folderPath, $files, $nonce) || !is_string($folderId) && !is_int($folderId) || !is_string($folderPath) || !is_array($files)) {
    $response->addAlert('Datatype error.');
    $response->addScriptCall("FB.onFolderNotFound", "");
    $response->addScriptCall("dialog.hideLoadMessage", '');
    $response->addScriptCall("hideMessageBox", '');
    return $response;
}
// validate nonce token
if (!$WPRO_SESS->checkNonce($nonce)) {
    $response->addAlert('Invalid transaction.');
    $response->addScriptCall("FB.onFolderNotFound", "");
    $response->addScriptCall("dialog.hideLoadMessage", '');
    $response->addScriptCall("hideMessageBox", '');
    return $response;
}
$fs = new wproFilesystem();
$failed = array();
$succeeded = array();
$failed2 = array();
$failed3 = array();
$html = '';
$folderMsg = false;
$fileMsg = false;
if ($arr = $this->getFolder($folderId, $folderPath, $response)) {
    $directory = $arr['directory'];
    $URL = $arr['URL'];
    $dir = $arr['dir'];
    if (!$dir->renameFiles && !$dir->renameFolders) {
        $response->addAlert($DIALOG->langEngine->get('wproCore_fileBrowser', 'JSRenamePermissionsError'));
        $response->addScriptCall("dialog.hideLoadMessage", '');
        $response->addScriptCall("hideMessageBox", '');
Example #6
0
if (!defined('IN_WPRO')) {
    exit;
}
// check vars
if (!isset($params['folderID']) || !isset($params['folderPath']) || empty($params['file'])) {
    exit;
}
ini_set('display_errors', false);
$params['folderPath'] = base64_decode($params['folderPath']);
// display a dynamic thumbnail...
$x = null;
if ($arr = $this->getFolder($params['folderID'], $params['folderPath'], $x)) {
    $directory = $arr['directory'];
    $file = $params['file'];
    $fs = new wproFilesystem();
    if ($fs->fileNameOK($file)) {
        if (is_file($directory . $file)) {
            // if the thumbnail folder exists & is  writable lets cache the thumbnail
            if (file_exists($directory . $EDITOR->thumbnailFolderName) && $fs->fileNameOk($EDITOR->thumbnailFolderName) && is_writable($directory . $EDITOR->thumbnailFolderName)) {
                $savePath = $directory . $EDITOR->thumbnailFolderName . '/' . $file;
                // do not create if it already exists
                if (is_file($savePath)) {
                    $savePath = '';
                }
            } else {
                $savePath = '';
            }
            require_once WPRO_DIR . 'core/libs/wproImageEditor.class.php';
            $imageEditor = new wproImageEditor();
            if (!$imageEditor->proportionalResize($directory . $file, '', 94, 94)) {
Example #7
0
if (!isset($folderId, $folderPath, $files, $nonce) || !is_string($folderId) && !is_int($folderId) || !is_string($folderPath) || !is_array($files)) {
    $response->addAlert('Datatype error.');
    $response->addScriptCall("FB.onFolderNotFound", "");
    $response->addScriptCall("dialog.hideLoadMessage", '');
    $response->addScriptCall("hideMessageBox", '');
    return $response;
}
// validate nonce token
if (!$WPRO_SESS->checkNonce($nonce)) {
    $response->addAlert('Invalid transaction.');
    $response->addScriptCall("FB.onFolderNotFound", "");
    $response->addScriptCall("dialog.hideLoadMessage", '');
    $response->addScriptCall("hideMessageBox", '');
    return $response;
}
$fs = new wproFilesystem();
$failed = array();
$succeeded = array();
$folderMsg = false;
$fileMsg = false;
if ($arr = $this->getFolder($folderId, $folderPath, $response)) {
    $directory = $arr['directory'];
    $URL = $arr['URL'];
    $dir = $arr['dir'];
    if (!$dir->deleteFiles && !$dir->deleteFolders) {
        $this->displayFolderList($folderId, $folderPath, $page, $sortBy, $sortDir, $view, array(), $history, $response);
        $response->addAlert($DIALOG->langEngine->get('wproCore_fileBrowser', 'JSDeletePermissionsError'));
        $response->addScriptCall("dialog.hideLoadMessage", '');
        $response->addScriptCall("hideMessageBox", '');
        return $response;
    }
Example #8
0
 $canGif = false;
 if (function_exists('imagecreate')) {
     //if (!(imagetypes() & IMG_PNG)) return false;
     //$canJpeg = function_exists("imagejpeg") ? true : false;
     //$canPng = function_exists("imagepng") ? true : false;
     if (!function_exists('imagegif') && (!function_exists('imagecreatefromgif') || !function_exists('imagepng'))) {
         $canGif = false;
     } else {
         $canGif = true;
     }
 } else {
     return false;
 }
 $GDExtensions = array('.jpg', '.jpeg', '.gif', '.png');
 // filetypes that can be resized with GD
 $fs = new wproFilesystem();
 require_once WPRO_DIR . 'core/libs/wproImageEditor.class.php';
 $imageEditor = new wproImageEditor();
 //$imageEditor->adjustMemoryLimit = false; // we want to prevent time outs so we won't create thumbnails on huge images.
 $imageEditor->fileCHMOD = $EDITOR->fileCHMOD;
 // mode for new thumbnails
 // initiate variables
 $dirWritable = is_writable($directory);
 $thumb_src = '';
 $thumbDirExists = false;
 // create thumb cache folder
 if (file_exists($directory . $EDITOR->thumbnailFolderName) && $fs->fileNameOk($EDITOR->thumbnailFolderName)) {
     //$thumbDirCreated = true;
     $thumbDirExists = true;
 } else {
     // create thumb cache dir
Example #9
0
 $DIALOG->assign('srcFolderType', $srcDir->type);
 $DIALOG->assign('destFolderType', $destDir->type);
 $DIALOG->assign('srcFolderID', $params['srcFolderID']);
 $DIALOG->assign('srcFolderPath', $params['srcFolderPath']);
 $DIALOG->assign('destFolderID', $params['destFolderID']);
 $DIALOG->assign('destFolderPath', $params['destFolderPath']);
 $DIALOG->assign('goToDest', isset($params['goToDest']) ? $params['goToDest'] : false);
 $DIALOG->assign('overwrite', $overwrite);
 // move/copy the files if need be and then display confirmation if need be.
 if (isset($params['ok']) && !empty($params['files'])) {
     $moveCopyID = isset($params['moveCopyID']) ? $params['moveCopyID'] : '';
     // check for a valid move/copy id.
     if (isset($WPRO_SESS->data['move-copy'])) {
         if (isset($WPRO_SESS->data['move-copy'][$moveCopyID])) {
             $DIALOG->bodyInclude = WPRO_DIR . 'core/plugins/wproCore_fileBrowser/tpl/move-copyFinished.tpl.php';
             $fs = new wproFilesystem();
             $duplicate = array();
             $succeeded = array();
             $failed = array();
             // create array of files and folders
             if (!is_array($params['files'])) {
                 $files = explode('/', $params['files']);
             } else {
                 $files = $params['files'];
             }
             if ($action == 'move' && $srcDirectory == $destDirectory) {
                 $succeeded = $files;
             } else {
                 /* now actually move/copy the files */
                 foreach ($files as $file) {
                     if ($fs->fileNameOk($file)) {
Example #10
0
 function _imageResizeGif($file, $output, $origwidth, $origheight, $width, $height, $cropX = 0, $cropY = 0)
 {
     if (!function_exists('imagegif') && (!function_exists('imagecreatefromgif') || !function_exists('imagepng'))) {
         return false;
     }
     $canGif = true;
     // more robust gif support check for PHP > 4.0.2
     if (function_exists('imagetypes')) {
         if (!(imagetypes() & IMG_GIF)) {
             $canGif = false;
             if (!(imagetypes() & IMG_PNG)) {
                 return false;
             }
         }
     }
     //$extension = strrchr(strtolower($file),'.');
     // check and set required memory to process this image
     if (!$this->_setMemoryForImage($file)) {
         return false;
     }
     //create the blank limited-palette image
     if (!($base_image = $this->_imageCreateBase($width, $height))) {
         return false;
     }
     // get the image pointer to the original image
     if (!($imageToResize = @imagecreatefromgif($file))) {
         return false;
     }
     if (function_exists('imagecopyresampled')) {
         if (!@imagecopyresampled($base_image, $imageToResize, 0, 0, $cropX, $cropY, $width, $height, $origwidth, $origheight)) {
             @imagecopyresized($base_image, $imageToResize, 0, 0, $cropX, $cropY, $width, $height, $origwidth, $origheight);
         }
     } else {
         @imagecopyresized($base_image, $imageToResize, 0, 0, $cropX, $cropY, $width, $height, $origwidth, $origheight);
     }
     if (!function_exists('imagegif') || !$canGif) {
         $outputFunction = 'imagepng';
         $header = 'Content-type: image/x-png';
         //$output = str_replace($extension, '.png', $output);
     } else {
         $outputFunction = 'imagegif';
         $header = 'Content-type: image/gif';
     }
     $return = false;
     $doIt = true;
     $deleteOrig = false;
     if (empty($output)) {
         header($header, true);
         if (@$outputFunction($base_image)) {
             $return = array($width, $height, $output);
         }
     } else {
         if ($outputFunction == 'imagepng') {
             // extension on the output file must be changed
             //$name = substr($output, 0, strlen($output) - strlen($extension));
             $name = $output . '.png';
             if (file_exists($name)) {
                 $return = false;
                 $doIt = false;
             } else {
                 if ($file == $output) {
                     $deleteOrig = true;
                 }
                 $output = $name;
             }
         }
         $fh = @fopen($output, 'w');
         @fclose($fh);
         if ($doIt) {
             if (@$outputFunction($base_image, $output)) {
                 //image destination
                 if ($outputFunction == 'imagepng') {
                     if ($deleteOrig) {
                         @unlink($file);
                     }
                 }
                 $return = array($width, $height, $output);
                 if (!empty($this->fileCHMOD)) {
                     $fs = new wproFilesystem();
                     $fs->chmod($output, $this->fileCHMOD);
                 }
             }
         }
     }
     @imagedestroy($base_image);
     @imagedestroy($imageToResize);
     return $return;
 }
Example #11
0
 function displayFolderDetails($folderId = 0, $folderPath = '', $folder = '')
 {
     global $EDITOR, $DIALOG;
     $response = $DIALOG->createAjaxResponse();
     // initial var check...
     if (!isset($folderId, $folderPath, $folder) || !is_string($folderId) && !is_int($folderId) || !is_string($folderPath) || !is_string($folder)) {
         return $response;
     }
     if ($arr = $this->getFolder($folderId, $folderPath, $response)) {
         $directory = $arr['directory'];
         $URL = $arr['URL'];
         $dir = $arr['directory'];
         $size = 0;
         $fs = new wproFilesystem();
         if ($fs->fileNameOk($folder)) {
             $size = $fs->dirSize($directory . $folder);
         }
         $response->addAssign('displayFolderSize', 'innerHTML', '<strong>' . $EDITOR->langEngine->get('wproCore_fileBrowser', 'size') . '</strong> ' . $fs->convertByteSize($size));
     }
     return $response;
 }
Example #12
0
if (!defined('IN_WPRO')) {
    exit;
}
global $EDITOR, $DIALOG, $WPRO_SESS;
//if (!$response) {
$response = $DIALOG->createAjaxResponse();
//}
// initial var check...
if (!isset($folderId, $folderPath, $uploadID) || !is_string($folderId) && !is_int($folderId) || !is_string($folderPath) || !is_string($uploadID) || !is_array($overwrite)) {
    $response->addAlert('Datatype error.');
    $response->addScriptCall("FB.onFolderNotFound", "");
    $response->addScriptCall("dialog.hideLoadMessage", '');
    $response->addScriptCall("hideMessageBox", '');
    return $response;
}
$fs = new wproFilesystem();
$failed = array();
$succeeded = array();
$uploaded = array();
if ($arr = $this->getFolder($folderId, $folderPath, $response)) {
    $directory = $arr['directory'];
    $URL = $arr['URL'];
    $dir = $arr['dir'];
    if (!$dir->upload) {
        $response->addAlert($DIALOG->langEngine->get('wproCore_fileBrowser', 'JSUploadPermissionsError'));
        $this->displayFolderList($folderId, $folderPath, $page, $sortBy, $sortDir, $view, array(), $history, $response);
        $response->addScriptCall("dialog.hideLoadMessage", '');
        return $response;
    }
    if (isset($WPRO_SESS->data['uploads'])) {
        if (isset($WPRO_SESS->data['uploads'][$uploadID])) {
Example #13
0
 function loadPlugin($name, $default = false)
 {
     require_once WPRO_DIR . 'core/libs/wproFilesystem.class.php';
     $files = new wproFilesystem();
     $name = $this->makeVarOk($name);
     if (!isset($this->plugins[$name])) {
         $baseDir = WPRO_DIR . '/plugins/';
         if (substr($name, 0, 9) == 'wproCore_') {
             $baseDir = WPRO_DIR . 'core/plugins/';
         } else {
             $baseDir = WPRO_DIR . 'plugins/';
         }
         // load componant file
         if (!wpro_class_exists("wproDialogPlugin_{$name}")) {
             if ($files->includeFileOnce($name, $baseDir, '/dialog.php')) {
                 $this->EDITOR->langEngine->loadFile('wysiwygpro/includes/' . $name . '.inc.php');
                 //
             } else {
                 return false;
             }
         }
         // create componant object
         if (wpro_class_exists("wproDialogPlugin_{$name}")) {
             @eval('$this->plugins["' . $name . '"] = & new wproDialogPlugin_' . $name . '();');
             if (method_exists($this->plugins[$name], 'init')) {
                 $this->plugins[$name]->init($this);
             }
             if ($default) {
                 $this->dialogName = $name;
             }
             return true;
         }
     } else {
         if ($default) {
             $this->dialogName = $name;
         }
         return true;
     }
     if ($default) {
         // do exit
         require_once WPRO_DIR . 'core/libs/wproMessageExit.class.php';
         $msg = new wproMessageExit();
         $msg->msgCode = WPRO_CRITICAL;
         $msg->msg = 'No dialog or incorrect dialog specified.';
         $msg->alert();
         exit;
     } else {
         return false;
     }
 }
Example #14
0
    $msg->msgCode = WPRO_CRITICAL;
    $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;
Example #15
0
							height: 150px;
							overflow: auto;
						}
						#uploadMessage {
							display: none;
							text-align: center;
						}	
						</style>');
        $DIALOG->bodyInclude = WPRO_DIR . 'core/plugins/wproCore_fileBrowser/tpl/upload.tpl.php';
        $DIALOG->formTags = false;
        //if ($EDITOR->_browserType == 'safari') $DIALOG->formOnSubmit = false;
        //$DIALOG->formEnctype = 'multipart/form-data';
        $DIALOG->template->assign('mode', $dir->type);
        $DIALOG->template->assign('dir', $dir);
        $DIALOG->options = array(array('onclick' => 'doUpload()', 'type' => 'button', 'name' => 'ok', 'value' => $DIALOG->langEngine->get('wproCore_fileBrowser', 'upload')), array('onclick' => 'dialog.close()', 'type' => 'button', 'name' => 'close', 'value' => $DIALOG->langEngine->get('core', 'cancel')));
        $fs = new wproFilesystem();
        switch ($dir->type) {
            case 'image':
                /* extensions and file sizes */
                $sizeLimit = $fs->returnBytes($EDITOR->maxImageSize);
                $extensions = $EDITOR->allowedImageExtensions;
                break;
            case 'document':
                $sizeLimit = $fs->returnBytes($EDITOR->maxDocSize);
                $extensions = $EDITOR->allowedDocExtensions;
                break;
            case 'media':
                $sizeLimit = $fs->returnBytes($EDITOR->maxMediaSize);
                $extensions = $EDITOR->allowedMediaExtensions;
                break;
        }
Example #16
0
	var forms = new wproForms();
	if (document.dialogForm.files) {
		overwriteDone = true;
		var overwrite = forms.getSelectedCheckboxValue(document.dialogForm.files);
		parentWindow.FB.uploadFinished(overwrite, uploadID, dialog);
	} else {
		parentWindow.FB.uploadFinished([], uploadID, dialog);
		dialog.close();
	}
	return false;
}
/* ]]>*/
</script>
<div id="errors">
<?php 
$fs = new wproFilesystem();
if (!empty($errors['fatal'])) {
    echo '<div class="smallWarning"><image src="' . $EDITOR->themeFolderURL . $EDITOR->theme . '/wysiwygpro/misc/warning16.gif" width="16" height="16" alt="" /> ' . $langEngine->get('wproCore_fileBrowser', 'uploadErrorsOccurred') . '<br /><br /><ul>';
    foreach ($errors['fatal'] as $file => $reason) {
        $extension = strrchr(strtolower($file), '.');
        if (!$extension) {
            $icon = 'folder';
        } else {
            $file_info = $fs->getFileInfo($extension);
            $icon = $file_info['icon'];
        }
        switch ($reason) {
            case 'badDimensions':
                if ($canGD) {
                    echo '<li><img align="middle" alt="" src="' . htmlspecialchars($themeURL) . 'icons/' . htmlspecialchars($icon) . '.gif" width="16" height="16" /> <em>' . htmlspecialchars($file) . '</em>: ' . $this->varReplace($langEngine->get('wproCore_fileBrowser', 'dimensionsTooLarge'), array('maxwidth' => $maxWidth, 'maxheight' => $maxHeight)) . '<br /><br /></li>';
                } else {
Example #17
0
	dialog.showLoadMessage();
	var forms = new wproForms();
	if (document.dialogForm.files) {
		overwriteDone = true;
		var overwrite = forms.getSelectedCheckboxValue(document.dialogForm.files);
		parentWindow.FB.moveCopyFinished(overwrite, moveCopyID, dialog);
	} else {
		dialog.close();
	}
	return false;
}
/* ]]>*/
</script>
<div id="errors">
<?php 
$fs = new wproFilesystem();
if (!empty($failed)) {
    echo '<div class="smallWarning"><image src="' . $EDITOR->themeFolderURL . $EDITOR->theme . '/wysiwygpro/misc/warning16.gif" width="16" height="16" alt="" /> ' . $langEngine->get('wproCore_fileBrowser', 'moveErrorsOccurred') . '<br /><br /><ul>';
    foreach ($failed as $file => $reason) {
        $extension = strrchr(strtolower($file), '.');
        if (!$extension) {
            $icon = 'folder';
        } else {
            $file_info = $fs->getFileInfo($extension);
            $icon = $file_info['icon'];
        }
        switch ($reason) {
            case 'notExist':
                echo '<li><img align="middle" alt="" src="' . htmlspecialchars($themeURL) . 'icons/' . htmlspecialchars($icon) . '.gif" width="16" height="16" /> <em>' . htmlspecialchars($file) . '</em>: ' . $langEngine->get('wproCore_fileBrowser', 'fileNotExistError') . '<br /><br /></li>';
                break;
            case 'destInsideSrc':
Example #18
0
if (!isset($folderId, $folderPath, $name, $nonce) || !is_string($folderId) && !is_int($folderId) || !is_string($folderPath) || !is_string($name)) {
    $response->addAlert('Datatype error.');
    $response->addScriptCall("FB.onFolderNotFound", "");
    $response->addScriptCall("dialog.hideLoadMessage", '');
    $response->addScriptCall("hideMessageBox", '');
    return $response;
}
// validate nonce token
if (!$WPRO_SESS->checkNonce($nonce)) {
    $response->addAlert('Invalid transaction.');
    $response->addScriptCall("FB.onFolderNotFound", "");
    $response->addScriptCall("dialog.hideLoadMessage", '');
    $response->addScriptCall("hideMessageBox", '');
    return $response;
}
$fs = new wproFilesystem();
$name = trim($name);
if ($arr = $this->getFolder($folderId, $folderPath, $response)) {
    $directory = $arr['directory'];
    $URL = $arr['URL'];
    $dir = $arr['dir'];
    if (!$dir->createFolders) {
        $this->displayFolderList($folderId, $folderPath, $page, $sortBy, $sortDir, $view, array(), $history, $response);
        $response->addAlert($DIALOG->langEngine->get('wproCore_fileBrowser', 'JSNewFolderPermissionsError'));
        $response->addScriptCall("dialog.hideLoadMessage", '');
        $response->addScriptCall("hideMessageBox", '');
        return $response;
    }
    if (!$fs->fileNameOK($name)) {
        $this->displayFolderList($folderId, $folderPath, $page, $sortBy, $sortDir, $view, array(), $history, $response);
        $response->addAlert($DIALOG->langEngine->get('wproCore_fileBrowser', 'JSFileNameError'));