public static function fileBrowser($type) { $tinyMCE = new TinyMCE(); global $smarty; $smarty->assign('type', $type); if (@(!is_null($_POST['uploadsubmit']))) { if (!empty($_FILES['filebrowser_uploadedfile']['name'])) { if ($_POST['uploadtype'] == 'image') { $newFile = new Image(); $newFile->insert($_FILES['filebrowser_uploadedfile']); $smarty->assign('type', 'image'); } else { $newFile = new DataStorage(); $newFile->insert($_FILES['filebrowser_uploadedfile']); $newFile->save(); } } } $smarty->template_dir = SITE_ROOT . '/cms/templates'; $smarty->addJS($tinyMCE->basepath . '/tiny_mce/tiny_mce_popup.js'); $smarty->addJS($tinyMCE->basepath . '/tiny_mce/utils/mctabs.js'); $smarty->addCSS($tinyMCE->basepath . '/tiny_mce/themes/advanced/skins/default/dialog.css'); $smarty->addCSS('/css/tiny_mce_filebrowser.css'); switch ($type) { case 'file': $smarty->assign('files', DataStorage::search()); break; default: $smarty->assign('images', DataStorage::getImagesList()); break; } return $smarty->render('filebrowser.tpl'); }