Example #1
0
 function displayFileDetails($folderId = 0, $folderPath = '', $file = '', $fromPlugin = true)
 {
     global $EDITOR, $DIALOG;
     $response = $DIALOG->createAjaxResponse();
     $response->addScriptCall('FB.displayExtraDetails', NULL);
     // initial var check...
     if (!isset($folderId, $folderPath, $file) || !is_string($folderId) && !is_int($folderId) || !is_string($folderPath) || !is_string($file)) {
         return $response;
     }
     $this->loadEmbedPlugins();
     if ($arr = $this->getFolder($folderId, $folderPath, $response)) {
         $directory = $arr['directory'];
         $URL = $arr['URL'];
         $dir = $arr['dir'];
         $fs = new wproFilesystem();
         if ($fs->fileNameOk($file) && is_file($directory . $file)) {
             $extension = strrchr($file, '.');
             foreach ($this->embedPlugins as $name => $plugin) {
                 if ($plugin->local) {
                     if ($fs->extensionOK($extension, $plugin->extensions)) {
                         if ($fromPlugin) {
                             $response->addScriptCall('FB.populateLocalOptions', $name, $plugin->getDetails($directory . $file, $response));
                         }
                         $response->addScriptCall('FB.displayExtraDetails', $plugin->displayDetails($directory . $file, $response));
                         break;
                     }
                 }
             }
             if (!$fromPlugin || $fromPlugin == 'false') {
                 $arr = $fs->getFileInfo($extension);
                 $arr['size'] = $fs->fileSize($directory . $file);
                 $arr['description'] = $DIALOG->langEngine->get('files', $arr['description']);
                 $response->addScriptCall('FB.linksPopulateLocalOptions', $arr);
             }
         }
     }
     return $response;
 }
Example #2
0
     $failed3[$old]['new'] = $new . $extension;
     continue;
 }
 // check extensions
 switch ($dir->type) {
     case 'image':
         $extensions = $EDITOR->allowedImageExtensions;
         break;
     case 'document':
         $extensions = $EDITOR->allowedDocExtensions;
         break;
     case 'media':
         $extensions = $EDITOR->allowedMediaExtensions;
         break;
 }
 if ($isFile && !$fs->extensionOK($extension, $extensions)) {
     array_push($failed2, $old);
     $failed3[$old]['reason'] = 'illegal';
     $failed3[$old]['extension'] = $extension;
     $failed3[$old]['name'] = substr($old, 0, strlen($old) - strlen($extension));
     $failed3[$old]['new'] = $new . $extension;
     continue;
 }
 // check filters
 if ($fs->filterMatch($new . $extension, $dir->filters)) {
     array_push($failed2, $old);
     $failed3[$old]['reason'] = 'reserved';
     $failed3[$old]['extension'] = $extension;
     $failed3[$old]['name'] = substr($old, 0, strlen($old) - strlen($extension));
     $failed3[$old]['new'] = $new . $extension;
     continue;
Example #3
0
 $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');
     $msg->alert();
 }
 // check filters
 // filter check
 if ($fs->filterMatch($image, $dir->filters)) {
     require_once WPRO_DIR . 'core/libs/wproMessageExit.class.php';
     $msg = new wproMessageExit();
     $msg->msgCode = WPRO_CRITICAL;
     $msg->msg = $DIALOG->langEngine->get('wproCore_fileBrowser', 'Bad name');
     $msg->alert();
 }