echo '</table>'; echo '</fieldset>'; echo JHtmlJoomDOC::endSlide(); } echo JHtmlJoomDOC::endSlides(); echo '</div>'; echo '<div class="clr"></div>'; if (JoomDOCAccess::admin()) { echo '<div>'; echo JHtmlJoomDOC::startSliders('permissions-sliders-' . $this->document->id, 'access-rules'); echo JHtmlJoomDOC::addSlide('permissions-sliders-' . $this->document->id, 'JOOMDOC_FIELDSET_RULES', 'access-rules'); echo '<fieldset class="panelform">'; echo $this->form->getLabel('rules'); echo $this->form->getInput('rules'); echo '</fieldset>'; echo JHtmlJoomDOC::endSlide(); echo JHtmlJoomDOC::endSlides(); echo '</div>'; } echo '<div>'; echo '<input type="hidden" name="Itemid" value="' . JoomDOCMenu::getMenuItemID($this->form->getValue('path')) . '" />'; echo '<input type="hidden" name="task" value="" />'; echo '<input type="hidden" name="id" value="' . $this->document->id . '" />'; echo '<input type="hidden" name="option" value="' . JOOMDOC_OPTION . '" />'; echo '<input type="hidden" name="return" value="' . JRequest::getCmd('return') . '" />'; echo JHtml::_('form.token'); echo '</div>'; echo '</form>'; echo JHtmlJoomDOC::endTab(); echo JHtmlJoomDOC::endTabs(); echo '</div>';
public static function frontend(&$path, $alias, &$itemID) { static $isSite; if (is_null($isSite)) { $isSite = JFactory::getApplication()->isSite(); } if (!$isSite) { return $path; } // if alias is false on site search for document alias by path if ($alias === false) { static $model; /* @var $model JoomDOCModelDocument */ if (is_null($model)) { $model = JModelLegacy::getInstance(JOOMDOC_DOCUMENT, JOOMDOC_MODEL_PREFIX); } $alias = $model->searchFullAliasByPath($path); } $itemID = JoomDOCMenu::getMenuItemID($path); $path = $alias ? $alias : $path; $path = JoomDOCFileSystem::getVirtualPath($path); }
/** * Create object and load JoomDOC configuration. * * @return void */ public function __construct($path = null) { $params = JComponentHelper::getParams(JOOMDOC_OPTION); /* @var $params JRegistry */ $mainframe = JFactory::getApplication(); /* @var $mainframe JApplication */ $defaultDocRoot = JPATH_ROOT . DIRECTORY_SEPARATOR . 'documents'; $maskDocRoot = '[%DOCROOT%]'; $this->docroot = JPath::clean(JString::trim($params->get('docroot', $defaultDocRoot))); if (JFile::exists(JOOMDOC_CONFIG) && is_writable(JOOMDOC_CONFIG)) { $content = JFile::read(JOOMDOC_CONFIG); if (JString::strpos($content, $maskDocRoot) !== false) { $content = str_replace($maskDocRoot, $defaultDocRoot, $content); JFile::write(JOOMDOC_CONFIG, $content); } } $this->docrootrel = str_replace(JPATH_ROOT . DIRECTORY_SEPARATOR, '', $this->docroot); if (!JFolder::exists($this->docroot)) { if (!JFolder::create($this->docroot)) { if ($mainframe->isAdmin()) { JError::raiseWarning(21, JText::sprintf('JOOMDOC_UNABLE_CREATE_DOCROOT', $this->docroot)); } $this->docroot = false; } elseif ($mainframe->isAdmin()) { $mainframe->enqueueMessage(JText::sprintf('JOOMDOC_DOCROOT_CREATED', $this->docroot)); } } $this->downloadId = JString::trim($params->get('download_id', '')); AUpdateHelper::setUpdateLink('ARTIO JoomDOC Updates', $this->downloadId); $this->defaultTitle = JString::trim($params->get('default_title')); $this->defaultDescription = JString::trim($params->get('default_description')); $this->defaultMetakeywords = JString::trim($params->get('default_metakeywords')); $this->defaultMetadescription = JString::trim($params->get('default_metadescription')); $this->versionFile = 0; $this->versionDocument = 0; $this->versionFileFrontend = 0; $this->versionRequired = 0; $this->displayFavorite = (int) $params->get('display_favorite', 1); $this->webdavAllow = (int) $params->get('webdav_allow', 25); $this->displaySignature = (int) $params->get('display_signature', 1); $this->path = $this->docroot; $this->documentOrdering = JOOMDOC_ORDER_ORDERING; $this->fileOrdering = JOOMDOC_ORDER_PATH; $this->orderingDirection = JString::trim($params->get('ordering_direction')) == 'asc' ? JOOMDOC_ORDER_ASC : JOOMDOC_ORDER_DESC; $this->foldersFirstSite = (bool) $params->get('folders_first_site', 0); $this->foldersFirstAdmin = (bool) $params->get('folders_first_admin', 0); if (!($this->iconTheme = JString::trim($params->get('icon_theme', 'default')))) { $this->iconTheme = 'default'; } //fallback if (!($this->iconThemeBackend = JString::trim($params->get('icon_theme_backend', 'default')))) { $this->iconThemeBackend = 'default'; } //fallback $this->docLayout = JString::trim($params->get('document_layout', 0)); $this->docLayout = 0; //not done now $this->useWebdav = (int) $params->get('use_webdav', 0); $this->webdavType = (int) $params->get('webdav_type', 1); $this->accessHandling = (int) $params->get('access_handling', 1); $this->fileDeleting = (int) $params->get('file_deleting', 1); $this->fileDocumentAutomatically = (int) $params->get('file_document_automatically', 0); $this->editDocumentImmediately = (int) $params->get('edit_document_immediately', 0); $this->useSearch = (int) $params->get('use_search', 0); $this->searchShowParent = (int) $params->get('search_show_parent', 1); $this->searchKeyword = (int) $params->get('search_keyword', 1); $this->searchShowTitle = (int) $params->get('search_show_title', 1); $this->searchShowText = (int) $params->get('search_show_text', 1); $this->searchShowMetadata = (int) $params->get('search_show_metadata', 1); $this->searchShowFulltext = (int) $params->get('search_show_fulltext', 1); $this->searchShowType = (int) $params->get('search_show_type', 1); $this->searchTypes = (array) $params->get('search_types', array(JOOMDOC_SEARCH_ANYKEY, JOOMDOC_SEARCH_ALLKEY, JOOMDOC_SEARCH_PHRASE, JOOMDOC_SEARCH_REGEXP)); $this->searchTypeAnykey = in_array(JOOMDOC_SEARCH_ANYKEY, $this->searchTypes); $this->searchTypeAllkey = in_array(JOOMDOC_SEARCH_ALLKEY, $this->searchTypes); $this->searchTypePhrase = in_array(JOOMDOC_SEARCH_PHRASE, $this->searchTypes); $this->searchTypeRegexp = in_array(JOOMDOC_SEARCH_REGEXP, $this->searchTypes); $this->searchDefaultType = (int) $params->get('search_default_type', JOOMDOC_SEARCH_ANYKEY); $this->searchShowOrder = (int) $params->get('search_show_order', 1); $this->searchOrders = (array) $params->get('search_orders', array(JOOMDOC_ORDER_NEWEST, JOOMDOC_ORDER_OLDEST, JOOMDOC_ORDER_HITS, JOOMDOC_ORDER_TITLE)); $this->searchOrderNewest = in_array(JOOMDOC_ORDER_NEWEST, $this->searchOrders); $this->searchOrderOldest = in_array(JOOMDOC_ORDER_OLDEST, $this->searchOrders); $this->searchOrderHits = in_array(JOOMDOC_ORDER_HITS, $this->searchOrders); $this->searchOrderTitle = in_array(JOOMDOC_ORDER_TITLE, $this->searchOrders); $this->searchDefaultOrder = $params->get('search_default_order', JOOMDOC_ORDER_NEWEST); $this->useExplorer = (int) $params->get('use_explorer', 1); $this->explorerRoot = JString::trim($params->get('explorer_root', 'Documents')); $this->documentAccess = (int) $params->get('document_access', 1); $this->edocsList = (int) $params->get('edocs_list', 0); $this->edocsDetail = (int) $params->get('edocs_detail', 0); if ($mainframe->isSite()) { $menu = $mainframe->getMenu(); /* @var $menu JMenuSite */ $itemID = $path ? JoomDOCMenu::getMenuItemID($path) : null; $itemID = $itemID ? $itemID : JRequest::getInt('Itemid'); $item = $itemID ? $menu->getItem($itemID) : $menu->getActive(); if (is_object($item)) { if (isset($item->query['path'])) { // get start folder from menu item URL (param path) $path = JString::trim($item->query['path']); if ($path) { $path = JPath::clean($this->docroot . DIRECTORY_SEPARATOR . $path); if (JFolder::exists($path) || JFile::exists($path)) { $this->path = $path; } else { $this->path = false; } } } $params->merge($item->params); // get display options from menu item setting $this->showSubfolders = (int) $params->get('show_subfolders', 1); $this->filesWithoutDoc = (int) $params->get('files_without_doc', 1); $this->documentOrdering = $params->get('document_ordering', JOOMDOC_ORDER_ORDERING); $this->orderingDirection = JString::trim($params->get('ordering_direction')) == 'asc' ? JOOMDOC_ORDER_ASC : JOOMDOC_ORDER_DESC; $this->fileOrdering = $params->get('file_ordering', JOOMDOC_ORDER_PATH); $this->showFileicon = (int) $params->get('show_fileicon', 1); $this->showFilesize = (int) $params->get('show_filesize', 1); $this->showCreated = (int) $params->get('show_created', 1); $this->showModified = (int) $params->get('show_modified', 1); $this->showHits = (int) $params->get('show_hits', 1); $this->showOpenFile = (int) $params->get('show_open_file', 1); $this->showDownloadFile = (int) $params->get('show_download_file', 1); $this->showOpenFolder = (int) $params->get('show_open_folder', 1); $this->showFileDesc = (int) $params->get('show_file_desc', 1); $this->showFolderDesc = (int) $params->get('show_folder_desc', 1); $this->showLicense = (int) $params->get('show_license', 1); $this->virtualFolder = (int) $params->get('virtual_folder', 0); } } }