Beispiel #1
0
 /**
  * Display browse table of file versions with extended filter.
  *
  * @param string $tpl used template
  */
 public function display($tpl = null)
 {
     $mainframe = JFactory::getApplication();
     /* @var $mainframe JAdministrator */
     $modelFile = $this->getModel();
     /* @var $modelFile JoomDOCModelFile */
     $this->filter = new JObject();
     $this->filter->path = JoomDOCRequest::getPath();
     $this->item = new JoomDOCFile(JoomDOCFileSystem::getFullPath($this->filter->path));
     $sessionPrefix = JoomDOCRequest::getSessionPrefix(true);
     $this->filter->offset = $mainframe->getUserStateFromRequest($sessionPrefix . 'offset', 'limitstart', 0, 'int');
     //var_dump($sessionPrefix);
     $this->filter->limit = $mainframe->getUserStateFromRequest($sessionPrefix . 'limit', 'limit', 10, 'int');
     //var_dump($this->filter->limit);
     $this->filter->listOrder = $mainframe->getUserStateFromRequest($sessionPrefix . 'listOrder', 'filter_order', 'version', 'string');
     //var_dump($this->filter->listOrder);
     $this->filter->listDirn = $mainframe->getUserStateFromRequest($sessionPrefix . 'listDirn', 'filter_order_Dir', 'asc', 'string');
     //var_dump($this->filter->listDirn);
     $this->filter->uploader = $mainframe->getUserStateFromRequest($sessionPrefix . 'uploader', 'uploader', '', 'string');
     //var_dump($this->filter->uploader);
     $this->filter->state = $mainframe->getUserStateFromRequest($sessionPrefix . 'state', 'state', 0, 'int');
     //var_dump($this->filter->state);
     $this->data = $modelFile->getData($this->filter);
     $this->document = $modelFile->getDocument($this->filter);
     $this->item->document = $this->document;
     $this->maxVersion = $modelFile->getMaxVersion($this->filter->path);
     $this->access = new JoomDOCAccessHelper($this->item);
     if (!JoomDOCAccessFileSystem::viewFileInfo($this->document ? $this->document->id : null, $this->filter->path)) {
         JError::raiseError(403, JText::sprintf('JOOMDOC_VIEW_FILE_INFO_NOT_ALLOW'));
     }
     $this->addToolbar();
     parent::display($tpl);
 }
Beispiel #2
0
 /**
  * Get Prefix for Variables stored in Joomla session storage (database, file, APC etc.).
  * Prefix is unique for concrete component and view.
  * For example: com_joomdoc_documents_
  *
  * @param boolean $usePath add into session Prefix Variable Path
  * @return string
  */
 public static function getSessionPrefix($usePath = false)
 {
     $pieces = array(JRequest::getString('option'), JRequest::getString('view'), JRequest::getString('layout'));
     if ($usePath) {
         $pieces[] = JoomDOCRequest::getPath();
     }
     return implode('.', array_filter($pieces, 'JString::trim')) . '.';
 }
Beispiel #3
0
 /**
  * Create new subfolder in current parent folder.
  *
  * @return void
  */
 public function newFolder()
 {
     $app = JFactory::getApplication();
     $success = JoomDOCFileSystem::newFolder();
     if ($success && JRequest::getInt('doccreate')) {
         $this->setRedirect(JoomDOCRoute::addDocument($app->getUserState('com_joomdoc.new.folder')));
     } else {
         $this->setRedirect(JoomDOCRoute::viewDocuments(JoomDOCRequest::getPath(), false));
     }
 }
 /**
  * Allow save document.
  */
 protected function allowSave($data, $key = 'id')
 {
     $document = $this->getModel()->getItem(JRequest::getInt('id'));
     // can create new document
     if (!$document->id && JoomDOCAccessDocument::create(JoomDOCRequest::getPath())) {
         return true;
     }
     // can edit exists document
     if ($document->id && JoomDOCAccessDocument::canEdit($document)) {
         return true;
     }
     return false;
 }
Beispiel #5
0
 function webdav()
 {
     /* webdav list URL */
     // session id
     $session = JRequest::getString('s');
     // parent folder path
     $path = JoomDOCRequest::getPath();
     if (!$session) {
         /* webdav edit url */
         // file path
         $file = JRequest::getString('file');
         // file path segments
         $segments = explode('/', $file);
         // cleanup
         $segments = array_map('JString::trim', $segments);
         $segments = array_filter($segments);
         // reindexing
         $segments = array_merge($segments);
         // session id is first file path segment
         $session = $segments[0];
         // remove session id
         unset($segments[0]);
         // file path in JoomDOC standard
         $path = implode(DIRECTORY_SEPARATOR, $segments);
         //$model = JModelLegacy::getInstance(JOOMDOC_FILE, JOOMDOC_MODEL_PREFIX);
         /* @var $model JoomDOCSiteModelFile */
         //$path = $model->getPathById($path); // since 4.0.3 is path as ID
         //$segments = explode(DIRECTORY_SEPARATOR, $path);
         // file path in webdav framework usage (with slash on the begin)
         $file = '/' . implode('/', $segments);
         // set file param in get for webdav framework
         JRequest::setVar('path', $file, 'get');
     }
     $webDavUser = JFactory::getUser(JoomDOCUser::getUserIdBySessionId($session));
     if (JoomDOCAccessFileSystem::editWebDav(null, JoomDOCFileSystem::clean($path), $session)) {
         if (!JRequest::getVar('path')) {
             JRequest::setVar('path', '/');
         }
         require_once JOOMDOC_WEBDAV . DIRECTORY_SEPARATOR . 'index.php';
     } else {
         die('{"error":"","files":""}');
     }
 }
Beispiel #6
0
 /**
  * Get param from search form (module or component).
  *
  * @param string $name field name from component (module prefix is tested automaticaly)
  * @param mixed $default default value if field isn't neither in request nor session
  * @param string $type data type int/string/bool
  * @param booelan $checkbox field is checkbox
  * @param string $tester field to test if form is submited
  * @return mixed request, session or default value
  */
 function getSearchParam($name, $default, $type, $checkbox = false, $tester = '')
 {
     $mainframe = JFactory::getApplication();
     /* @var $mainframe JApplication */
     /* first look for value from module
        module field has prefix mod_ to prevent colision */
     $module = JRequest::getVar('mod_' . $name, null, 'default', $type);
     if (!is_null($module)) {
         $mainframe->setUserState($name, $module);
         return $module;
     }
     // search for value from component
     if ($checkbox) {
         return JoomDOCRequest::getCheckbox($name, $tester, $default);
     }
     return $mainframe->getUserStateFromRequest($name, $name, $default, $type);
 }
Beispiel #7
0
 /**
  * Revert selected Version as last Version.
  *
  * @return void
  */
 public function revert()
 {
     $path = JoomDOCRequest::getPath();
     $result = false;
     if (JoomDOCAccessFileSystem::manageVersions(false, $path)) {
         JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
         $cid = JRequest::getVar('cid', array(), 'default', 'array');
         $id = reset($cid);
         $model = $this->getModel();
         $result = $model->revert($id, $path);
     }
     $msg = $result ? JText::sprintf('JOOMDOC_REVERT_SUCCESS', $result->revertVersion, $result->newLastVersion, $result->oldLastVersion) : JText::_('JOOMDOC_REVERT_UNSUCCESS');
     $type = $result ? 'message' : 'error';
     $this->setRedirect(JoomDOCRoute::viewFileInfo($path), $msg, $type);
 }
Beispiel #8
0
    /**
     * Folders navigator with MooTree.
     * 
     * @param array $folders data in this format: JObject('ident' => 'relative path', 'route' => 'URL to open folder', 'title' => 'Folder name', 'entry' => 'Is accessible')
     * @param string $parent root folder 
     * @param bool $expandable if tree is hide-able (only for J2.5 admin layout)
     * @param bool $ajax generate one tree list only
     * @return string source of tree
     */
    public static function mooTree($folders = null, $parent = '', $expandable = false, $ajax = false)
    {
        $config = JoomDOCConfig::getInstance();
        $document = JFactory::getDocument();
        $mainframe = JFactory::getApplication();
        $document->addScript(JURI::root(true) . '/media/system/js/mootree' . (JDEBUG ? '-uncompressed' : '') . '.js');
        $document->addStyleSheet(JURI::root(true) . '/media/system/css/mootree.css');
        $path = JoomDOCRequest::getPath();
        $code = '';
        if (!$ajax) {
            $code .= '<div id="MooTree" style="position: relative; overflow: visible;"></div>';
            // here MooTree will draw tree
            $code .= '<ul id="MooTreeSrc">';
            // start of source of tree
        }
        if (is_null($folders)) {
            $folders = JoomDOCFileSystem::getNonTrashedParents($parent, 1, $ajax ? null : $path);
            if (empty($folders)) {
                return '';
            }
            // nothing to do
            foreach ($folders as $i => $item) {
                $folder = new JObject();
                $folder->set('ident', $item);
                $folder->set('route', JoomDOCRoute::viewDocuments($item));
                $folder->set('title', basename($item));
                $folder->set('entry', JoomDOCAccessFileSystem::enterFolder(false, $item));
                $folders[$i] = $folder;
            }
        }
        foreach ($folders as $i => $folder) {
            // all folders into deep
            $currentLevel = count(explode(DIRECTORY_SEPARATOR, $folder->get('ident')));
            // level of folder deep (folders in doc root have 1)
            if (!empty($lastLevel)) {
                // not for root folder
                if ($currentLevel > $lastLevel) {
                    $code .= '<ul>';
                } elseif ($currentLevel < $lastLevel) {
                    $code .= str_repeat('</li></ul>', $lastLevel - $currentLevel) . '</li>';
                    // end of subfolder, close previous subfolders
                } else {
                    $code .= '</li>';
                }
                // at the same level as previous
            }
            if ($folder->get('entry')) {
                $code .= '<li id="' . str_replace(DIRECTORY_SEPARATOR, '-', $folder->get('ident')) . '"' . ($folder->get('ident') == $path ? ' class="selected"' : '') . '>
						<a href="' . JRoute::_($folder->get('route')) . '" target="folderframe" name="' . $folder->get('ident') . '">' . $folder->get('title') . '</a>';
            }
            // current item, tag leave open to append subfolder
            $lastLevel = $currentLevel;
        }
        if (empty($lastLevel)) {
            $lastLevel = 0;
        }
        $code .= str_repeat('</li></ul>', $lastLevel);
        // end of source tree
        if ($ajax) {
            ob_clean();
            die($code);
        }
        // start MooTree after completely loading page
        $js = "\n\t\t\twindow.addEvent('domready', function() {\n\t\t\t\tvar tree = new MooTreeControl(\n\t\t\t\t{\n\t\t\t\t\tdiv: 'MooTree', \n\t\t\t\t\tmode: 'folders', \n\t\t\t\t\tgrid: true, \n\t\t\t\t\ttheme: '" . htmlspecialchars(JURI::root(true), ENT_QUOTES) . "/media/system/images/mootree.gif', \n\t\t\t\t\tloader: { // set up Ajax loader\n\t\t\t\t\t\ticon: null, \n\t\t\t\t\t\ttext: '" . JText::_('JOOMDOC_LOADING', true) . "', \n\t\t\t\t\t\tcolor:'#FF0000'\n    \t\t\t\t},\n\t\t\t\t\tonClick: function(node) { // event after click on folder\n\t\t\t\t\t\twindow.location = node.data.url; \n\t\t\t\t\t},\n\t\t\t\t\tonExpand: function(node, state) { // event after expand tree node\n\t\t\t\t\t\tif (state && treeLoading < 0) { // opening\n\t\t\t\t\t\t\tnode.loading = true;\n\t\t\t\t\t\t\tnode.clear(); // clear the node to append loader\n\t\t\t\t\t\t\tnode.insert(node.control.loader); // insert loader into the node\n\t\t\t\t\t\t\tnew Request({\n\t\t\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t\t\t\turl: '" . JRoute::_(JoomDOCRoute::updatemootree(), false) . "',\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\tpath: node.data.name\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tonSuccess: function(html, xml) {\n\t\t\t\t\t\t\t\t\tnode.clear(); // clear loader from the node\n\t\t\t\t\t\t\t\t\tnode.loading = false;\n\t\t\t\t\t\t\t\t\tvar ul = new Element('ul#MooTreeSrc');\n\t\t\t\t\t\t\t\t\tul.set('html', html);\n\t\t\t\t\t\t\t\t\t\$\$('body').adopt(ul);\n\t\t\t\t\t\t\t\t\ttree.adopt('MooTreeSrc', node);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}).send();\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttreeLoading --;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttext: '" . ($parent ? $parent : $config->explorerRoot) . "', \n\t\t\t\t \topen: true, \n\t\t\t\t \tdata: {\n\t\t\t\t\t\turl: '" . JRoute::_(JoomDOCRoute::viewDocuments($mainframe->isSite() ? $parent : 'JoomDOC'), false) . "', \n\t\t\t\t\t\ttarget: 'folderframe'\n    \t\t\t\t}\n    \t\t\t}\n\t\t\t);\n\t\t\ttree.adopt('MooTreeSrc'); // load source in ul structure\n\t\t\ttree.selected = tree.get('node_" . htmlspecialchars(str_replace(DIRECTORY_SEPARATOR, '-', $path), ENT_QUOTES) . "');\n\t\t";
        //make current folder highlighted
        if ($path) {
            $toSelect = JoomDOCFileSystem::getFullPath($path);
            if (JFile::exists($toSelect)) {
                $toSelect = JoomDOCFileSystem::getParentPath($toSelect);
            }
            // select parent folder if file is selected
            $toSelect = JoomDOCFileSystem::getRelativePath($toSelect);
            $js .= "\n\t\t\t\ttree.get('node_" . htmlspecialchars(str_replace(DIRECTORY_SEPARATOR, '-', $toSelect), ENT_QUOTES) . "').selected = true;\n\t\t\t";
        }
        // open actual folder path
        $breadCrumbs = JoomDOCFileSystem::getPathBreadCrumbs($path);
        foreach ($breadCrumbs as $i => $breadCrumb) {
            if ($i) {
                $js .= "\n\t\t\t\t\tvar node = tree.get('node_" . htmlspecialchars(str_replace(DIRECTORY_SEPARATOR, '-', $breadCrumb->path), ENT_QUOTES) . "');\n\t\t\t\t\tif (node) node.toggle(false, true);\n\t\t\t\t";
            }
        }
        $js .= '});
			var treeLoading = ' . (count($breadCrumbs) - 2) . ';';
        //tree expandable - only in admin view and J2.5. In joomla 3.0, tree is fixed part of sidebar
        if ($expandable) {
            $js .= "window.addEvent('domready', function() {\n\n                \t\t\t//add show/hide button to pathway\n                \t\t\tels = Elements.from('<span class=\"hideMooTree\">" . JText::_('JOOMDOC_SHOW_HIDE_TREE') . "</span>');\n                \t\t\tels.inject(\$('pathway'), 'bottom');\n\n                \t\t\t//add own wrapper for fx.Slide, so we can set float and wifth by css\n                \t\t\tmyWrapper = new Element('div', {id: 'MooTreeWrap'}).wraps(\$('MooTree'), 'top');\n                \t\t\n                \t\t\t//create fx.Slide instance and store it inside element 'storage' (MooTools)\n                \t\t\t\$('MooTree').store('slide', new Fx.Slide(\$('MooTree'), {\n                \t\t\t\tmode: 'horizontal', \n                \t\t\t\tduration: 1000, \n                \t\t\t\ttransition: Fx.Transitions.Pow.easeOut, \n                \t\t\t\tresetHeight: true, \n    \t\t\t\t\t\t\twrapper: myWrapper}).show());\n\n                \t\t\t//hide MooTree, if stored so in HTML5 localstorage\n                \t\t\tif (window.localStorage && localStorage.getItem('hidden')=='true')\n\t\t\t\t\t\t\t\t\$('MooTree').retrieve('slide').hide();\n\n                \t\t\t//add event to remember opened/closed state in localStorage\n                            els.addEvent('click', function() {\n\t\n                \t\t\t\tif (\$('MooTree').retrieve('slide').open){ \n                \t\t\t\t\t\$('MooTree').retrieve('slide').slideOut();\n                \t\t\t\t\tlocalStorage.setItem('hidden', 'true'); } \n                \t\t\t\telse {\n                \t\t\t\t\t\$('MooTree').retrieve('slide').slideIn();\n                \t\t\t\t\tlocalStorage.setItem('hidden', 'false');}\n\n                            });\n                \t\t\t\t\t\n                        });";
        }
        $document->addScriptDeclaration($js);
        return $code;
    }
Beispiel #9
0
 public static function copyMove($move = false)
 {
     $mainframe = JFactory::getApplication();
     /* @var $mainframe JApplication */
     $tableFile = JTable::getInstance(JOOMDOC_FILE, JOOMDOC_TABLE_PREFIX);
     /* @var $tableFile JoomDOCTableFile */
     // current folder copy into
     $folder = JoomDOCRequest::getPath();
     $folderAbsolutePath = JoomDOCFileSystem::getFullPath($folder);
     // current folder acces
     $folderCanCreateSubfolders = JoomDOCAccessFileSystem::newFolder(false, $folder);
     $folderCanUploadFiles = JoomDOCAccessFileSystem::uploadFile(false, $folder);
     // items to copy
     $paths = JoomDOCFileSystem::getOperationPaths();
     foreach ($paths as $path) {
         $absolutePath = JoomDOCFileSystem::getFullPath($path);
         $parent = JoomDOCFileSystem::getParentPath($absolutePath);
         $parentLength = JString::strlen($parent);
         $items = array($absolutePath);
         if (JFolder::exists($absolutePath)) {
             if (!$folderCanCreateSubfolders) {
                 // copied/moved item is folder and current folder aren't allowed to create subfolders
                 $mainframe->enqueueMessage(JText::sprintf('JOOMDOC_CPMV_UNABLE_SUBFOLDERS', $folder, $path), 'notice');
                 continue;
             }
             // unable copy/move folder into own subfolder
             if (JoomDOCFileSystem::isSubFolder($folderAbsolutePath, $absolutePath)) {
                 $mainframe->enqueueMessage(JText::sprintf('JOOMDOC_CPMV_UNABLE_INTO_SELF', $folder, $path), 'notice');
                 continue;
             }
             $items = array_merge($items, JFolder::folders($absolutePath, '', true, true, array('.svn', 'CVS', '.DS_Store', '__MACOSX', JOOMDOC_VERSION_DIR)));
             $items = array_merge($items, JFolder::files($absolutePath, '', true, true));
         } elseif (!JFile::exists($absolutePath)) {
             continue;
         }
         foreach ($items as $item) {
             $itemRelativePath = JoomDOCFileSystem::getRelativePath($item);
             if (!JoomDOCAccessFileSystem::copyMove(false, $itemRelativePath)) {
                 $mainframe->enqueueMessage(JText::sprintf('JOOMDOC_CPMV_UNABLE', $itemRelativePath), 'notice');
                 continue;
             }
             // get relative path from copied path parent
             $relativePath = JString::substr($item, $parentLength);
             // destination is current folder + relative path
             $destination = $folderAbsolutePath . $relativePath;
             $destinationRelativePath = JoomDOCFileSystem::getRelativePath($destination);
             if (JFolder::exists($item)) {
                 // is folder only create
                 if (JFolder::exists($destination)) {
                     $mainframe->enqueueMessage(JText::sprintf('JOOMDOC_CPMV_FOLDER_EXISTS', $destinationRelativePath), 'notice');
                     continue;
                 }
                 JFolder::create($destination);
             }
             if (JFile::exists($item)) {
                 if (!$folderCanUploadFiles) {
                     // copied/moved item is file or contain files and current folder aren't allowed to upload files
                     $mainframe->enqueueMessage(JText::sprintf('JOOMDOC_CPMV_UNABLE_UPLOAD', $itemRelativePath, $folder), 'notice');
                     continue;
                 }
                 if (JFile::exists($destination)) {
                     $mainframe->enqueueMessage(JText::sprintf('JOOMDOC_CPMV_FILE_EXISTS', $destinationRelativePath), 'notice');
                     continue;
                 }
                 JFile::copy($item, $destination);
                 // get file versions
             }
             // copy/move table rows
             $tableFile->copyMove($itemRelativePath, $destinationRelativePath, $move);
         }
         if ($move) {
             // move item delete source after copy
             JoomDOCFileSystem::deleteItem($absolutePath);
         }
     }
     JoomDOCFileSystem::resetOperation();
 }
Beispiel #10
0
 /**
  * Reset operation from clipboard.
  */
 public function reset()
 {
     JoomDOCFileSystem::resetOperation();
     $this->setRedirect(JoomDOCRoute::viewDocuments(JoomDOCRequest::getPath(), false));
 }
Beispiel #11
0
 /**
  * Display page with folder content.
  *
  * @param $tpl used template
  * @return void
  */
 public function display($tpl = null)
 {
     $mainframe = JFactory::getApplication();
     /* @var $mainframe JAdministrator */
     $config = JoomDOCConfig::getInstance();
     /* @var $config JoomDOCConfig */
     $model = $this->getModel();
     /* @var $model JoomDOCModelDocuments */
     $document = JFactory::getDocument();
     /* @var $document JDocumentHTML */
     if ($this->getLayout() != 'modal') {
         //$mainframe->enqueueMessage(JText::_('JOOMDOC_KEEP_FLAT'));
     }
     // relative path from request or user session
     $path = JoomDOCRequest::getPath();
     if ($path == JText::_('JOOMDOC_ROOT')) {
         $path = '';
     }
     // convert to absolute path
     $path = JoomDOCFileSystem::getFullPath($path);
     //if folder not exists (e.g. was renamed), fallback to root
     if (!JFolder::exists($path)) {
         $path = JoomDOCFileSystem::getFullPath('');
     }
     $this->filter = $mainframe->getUserStateFromRequest(JoomDOCRequest::getSessionPrefix() . 'filter', 'filter', '', 'string');
     $this->root = JoomDOCFileSystem::getFolderContent($path, '');
     // control if select folder is subfolder of docroot
     if ((!JoomDOCFileSystem::isSubFolder($path, $config->docroot) || $this->root === false) && $config->docroot !== false) {
         JError::raiseError(403, JText::_('JOOMDOC_UNABLE_ACCESS_FOLDER'));
     }
     // search filter setting
     $this->search = new JObject();
     $this->search->keywords = $this->filter;
     // search areas (search everywhere - don't use frontend detail setting)
     $this->search->areaTitle = $this->search->areaText = $this->search->areaFull = true;
     $this->search->areaMeta = false;
     // looking for any word
     $this->search->type = JOOMDOC_SEARCH_ANYKEY;
     $model->setState(JoomDOCView::getStateName(JOOMDOC_FILTER_PATHS), $this->root->getPaths());
     $model->setState(JoomDOCView::getStateName(JOOMDOC_FILTER_SEARCH), $this->search);
     $model->setState(JOOMDOC_FILTER_STATE, $mainframe->getUserStateFromRequest(JoomDOCRequest::getSessionPrefix() . 'state', 'state', JOOMDOC_STATE_PUBLISHED, 'int'));
     $this->documents = $model->getItems();
     $this->state = $model->getState();
     $this->pagination = new JPagination($model->getTotal(), $this->state->get(JOOMDOC_FILTER_START), $this->state->get(JOOMDOC_FILTER_LIMIT));
     $this->access = new JoomDOCAccessHelper($this->root);
     $this->root->setDocuments($this->documents);
     $this->root->reorder($this->state->get(JOOMDOC_FILTER_ORDERING), $this->state->get(JOOMDOC_FILTER_ORDERING), $this->state->get(JOOMDOC_FILTER_DIRECTION), $this->pagination->limitstart, $this->pagination->limit, $this->pagination->total, $config->foldersFirstAdmin);
     // control permissions to access folder
     if (!$this->access->canEnterFolder) {
         $mainframe->setUserState('joomdoc_documents_path', null);
         JError::raiseError(403, JText::_('JOOMDOC_UNABLE_ACCESS_FOLDER'));
     }
     $this->addToolbar();
     JoomDOCHelper::setSubmenu(JOOMDOC_DOCUMENTS, true);
     JoomDOCHelper::clipboardInfo();
     JoomDOCHelper::folderInfo($this->access->absolutePath);
     parent::display($tpl);
 }
JModelLegacy::addIncludePath(JOOMDOC_SITE_MODELS);
JTable::addIncludePath(JOOMDOC_TABLES);
$document = JFactory::getDocument();
/* @var $document JDocument */
$document->addStyleSheet(JOOMDOC_ASSETS . 'css/general.css?' . JOOMDOC_VERSION_ALIAS);
// Module and JoomDOC comfiguration.
$moduleConfig = JoomDOCModuleExplorerConfig::getInstance($params, $module->id);
$globalConfig = JoomDOCConfig::getInstance();
$modelDocuments = JModelLegacy::getInstance(JOOMDOC_DOCUMENTS, JOOMDOC_MODEL_SITE_PREFIX);
/* @var $modelDocuments JoomDOCSiteModelDocuments */
// Only folders are loaded.
$parent = $moduleConfig->parent ? JoomDOCFileSystem::getFullPath($moduleConfig->parent) : $globalConfig->docroot;
if (!JFolder::exists($parent)) {
    // invalid or expired module config
    $parent = '';
}
// reset to root
$path = JoomDOCRequest::getPath();
// on file detail get parent folder path
if (JFile::exists(JoomDOCFileSystem::getFullPath($path)) && JFolder::exists(JoomDOCFileSystem::getFullPath(JoomDOCFileSystem::getParentPath($path)))) {
    $path = JoomDOCFileSystem::getParentPath($path);
}
$root = JoomDOCFileSystem::getFolderContent($parent, '', 1, true, false, $path);
// Model searchs in database for founded paths.
$modelDocuments->setState(JoomDOCView::getStateName(JOOMDOC_FILTER_PATHS), $root->getPaths());
// Filesystem extends items informations from documents.
$root->setDocuments($modelDocuments->getItems());
// Filesystem reordes items for given setting.
$root->reorder(null, JOOMDOC_ORDER_PATH, JOOMDOC_ORDER_ASC, 0, PHP_INT_MAX);
// Active module template displayed.
require JModuleHelper::getLayoutPath('mod_joomdoc_explorer', $moduleConfig->layout);
Beispiel #13
0
<?php

/**
 * @version		$Id$
 * @package		Joomla.Administrator
 * @subpackage	JoomDOC
 * @author      ARTIO s.r.o., info@artio.net, http:://www.artio.net
 * @copyright	Copyright (C) 2011 Artio s.r.o.. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;
/* @var $this JoomDOCViewLicense */
// test if property realy exist in request
$path = JRequest::getVar('path', false) !== false ? JoomDOCRequest::getPath() : null;
echo '<h1>' . $this->license->title . '</h1>';
if ($path) {
    echo '<h2>' . JText::_('JOOMDOC_MUST_CONFIRM') . '</h2>';
}
echo JoomDOCHelper::applyContentPlugins($this->license->text);
if ($path) {
    echo '<div class="confirm">';
    echo '<input type="checkbox" name="confirm" id="confirm" value="1" onclick="JoomDOC.confirmLicense(this)" />';
    echo '<label for="confirm">' . JText::_('JOOMDOC_CONFIRM') . '</label>';
    echo '<a id="download" class="blind" href="' . JRoute::_(JoomDOCRoute::download($path)) . '" title="">' . JText::_('JOOMDOC_DOWNLOAD_FILE') . '</a>';
    echo '</div>';
}