Exemple #1
0
 function display()
 {
     contentbuilder::checkPermissions('listaccess', JText::_('COM_CONTENTBUILDER_PERMISSIONS_LISTACCESS_NOT_ALLOWED'), class_exists('cbFeMarker') ? '_fe' : '');
     JRequest::setVar('tmpl', JRequest::getWord('tmpl', null));
     JRequest::setVar('layout', JRequest::getWord('layout', null) == 'latest' ? null : JRequest::getWord('layout', null));
     JRequest::setVar('view', 'list');
     parent::display();
 }
 function onContentPrepare($context, &$article, &$params, $limitstart = 0)
 {
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.folder');
     if (!JFile::exists(JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_contentbuilder' . DS . 'classes' . DS . 'contentbuilder.php')) {
         return true;
     }
     if (isset($article->id) && $article->id) {
         $frontend = true;
         if (JFactory::getApplication()->isAdmin()) {
             $frontend = false;
         }
         $db = JFactory::getDBO();
         $db->setQuery("Select form.`reference_id`,article.`record_id`,article.`form_id`,form.`type`,form.`published_only`,form.`own_only`,form.`own_only_fe` From #__contentbuilder_articles As article, #__contentbuilder_forms As form Where form.`published` = 1 And form.id = article.`form_id` And article.`article_id` = " . $article->id);
         $data = $db->loadAssoc();
         require_once JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_contentbuilder' . DS . 'classes' . DS . 'contentbuilder.php';
         $form = contentbuilder::getForm($data['type'], $data['reference_id']);
         if (!$form || !$form->exists) {
             return true;
         }
         if ($form && !(JRequest::getVar('option', '') == 'com_contentbuilder' && JRequest::getVar('controller', '') == 'edit')) {
             JFactory::getLanguage()->load('com_contentbuilder');
             contentbuilder::setPermissions($data['form_id'], $data['record_id'], $frontend ? '_fe' : '');
             if (JRequest::getCmd('view') == 'article') {
                 contentbuilder::checkPermissions('view', JText::_('COM_CONTENTBUILDER_PERMISSIONS_VIEW_NOT_ALLOWED'), $frontend ? '_fe' : '');
             } else {
                 if ($frontend) {
                     if (!contentbuilder::authorizeFe('view')) {
                         $article->text = JText::_('COM_CONTENTBUILDER_PERMISSIONS_VIEW_NOT_ALLOWED');
                     }
                 } else {
                     if (!contentbuilder::authorize('view')) {
                         $article->text = JText::_('COM_CONTENTBUILDER_PERMISSIONS_VIEW_NOT_ALLOWED');
                     }
                 }
             }
         }
     }
     return true;
 }
Exemple #3
0
 function display()
 {
     contentbuilder::checkPermissions('view', JText::_('COM_CONTENTBUILDER_PERMISSIONS_VIEW_NOT_ALLOWED'), class_exists('cbFeMarker') ? '_fe' : '');
     JRequest::setVar('tmpl', JRequest::getWord('tmpl', null));
     JRequest::setVar('layout', JRequest::getWord('layout', null) == 'latest' ? null : JRequest::getWord('layout', null));
     if (JRequest::getWord('view', '') == 'latest') {
         JRequest::setVar('cb_latest', 1);
     }
     JRequest::setVar('view', 'details');
     parent::display();
 }
 function cbCheckPermissions()
 {
     // CONTENTBUILDER BEGIN
     jimport('joomla.filesystem.file');
     $cbData = null;
     $cbForm = null;
     $cbRecord = null;
     $cbFrontend = true;
     $cbFull = false;
     if (JFile::exists(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_contentbuilder' . DS . 'contentbuilder.xml')) {
         if (JFactory::getApplication()->isAdmin()) {
             $cbFrontend = false;
         }
         if ($cbFrontend) {
             JFactory::getLanguage()->load('com_contentbuilder');
         } else {
             JFactory::getLanguage()->load('com_contentbuilder', JPATH_SITE . DS . 'administrator');
         }
         $db = JFactory::getDBO();
         require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_contentbuilder' . DS . 'classes' . DS . 'contentbuilder.php';
         $db->setQuery("Select `id` From #__contentbuilder_forms Where `type` = 'com_breezingforms' And `reference_id` = " . intval($this->form) . " And published = 1");
         jimport('joomla.version');
         $version = new JVersion();
         if (version_compare($version->getShortVersion(), '3.0', '<')) {
             $cbForms = $db->loadResultArray();
         } else {
             $cbForms = $db->loadColumn();
         }
         // if no BF form is associated with contentbuilder, we don't need no further checks
         if (!count($cbForms)) {
             return array('form' => $cbForm, 'record' => $cbRecord, 'frontend' => $cbFrontend, 'data' => $cbData, 'full' => $cbFull);
         }
         // test if there is any published contentbuilder view that allows to create new submissions
         if (!JRequest::getInt('cb_record_id', 0) || !JRequest::getInt('cb_form_id', 0)) {
             $cbAuth = false;
             foreach ($cbForms as $cbFormId) {
                 contentbuilder::setPermissions($cbFormId, 0, $cbFrontend ? '_fe' : '');
                 if ($cbFrontend) {
                     $cbAuth = contentbuilder::authorizeFe('new');
                 } else {
                     $cbAuth = contentbuilder::authorize('new');
                 }
                 if ($cbAuth) {
                     break;
                 }
             }
             if (count($cbForms) && !$cbAuth) {
                 JError::raiseError(403, JText::_('COM_CONTENTBUILDER_PERMISSIONS_NEW_NOT_ALLOWED'));
             }
         }
         if (JRequest::getInt('cb_form_id', 0)) {
             // test the permissions of given record
             if (JRequest::getInt('cb_record_id', 0)) {
                 contentbuilder::setPermissions(JRequest::getInt('cb_form_id', 0), JRequest::getInt('cb_record_id', 0), $cbFrontend ? '_fe' : '');
                 contentbuilder::checkPermissions('edit', JText::_('COM_CONTENTBUILDER_PERMISSIONS_EDIT_NOT_ALLOWED'), $cbFrontend ? '_fe' : '');
             } else {
                 contentbuilder::setPermissions(JRequest::getInt('cb_form_id', 0), 0, $cbFrontend ? '_fe' : '');
                 contentbuilder::checkPermissions('new', JText::_('COM_CONTENTBUILDER_PERMISSIONS_NEW_NOT_ALLOWED'), $cbFrontend ? '_fe' : '');
             }
             $db->setQuery("Select * From #__contentbuilder_forms Where id = " . JRequest::getInt('cb_form_id', 0) . " And published = 1");
             $cbData = $db->loadAssoc();
             if (is_array($cbData)) {
                 $cbFull = $cbFrontend ? contentbuilder::authorizeFe('fullarticle') : contentbuilder::authorize('fullarticle');
                 $cbForm = contentbuilder::getForm('com_breezingforms', $cbData['reference_id']);
                 $cbRecord = $cbForm->getRecord(JRequest::getInt('cb_record_id', 0), $cbData['published_only'], $cbFrontend ? $cbData['own_only_fe'] ? JFactory::getUser()->get('id', 0) : -1 : ($cbData['own_only'] ? JFactory::getUser()->get('id', 0) : -1), $cbFrontend ? $cbData['show_all_languages_fe'] : true);
                 if (!count($cbRecord) && !JRequest::getBool('cbIsNew')) {
                     JError::raiseError(404, JText::_('COM_CONTENTBUILDER_RECORD_NOT_FOUND'));
                 }
             }
         }
     }
     return array('form' => $cbForm, 'record' => $cbRecord, 'frontend' => $cbFrontend, 'data' => $cbData, 'full' => $cbFull);
     // CONTENTBUILDER END
 }
Exemple #5
0
 function display()
 {
     if (JRequest::getCmd('record_id', '')) {
         contentbuilder::checkPermissions('edit', JText::_('COM_CONTENTBUILDER_PERMISSIONS_EDIT_NOT_ALLOWED'), class_exists('cbFeMarker') ? '_fe' : '');
     } else {
         contentbuilder::checkPermissions('new', JText::_('COM_CONTENTBUILDER_PERMISSIONS_NEW_NOT_ALLOWED'), class_exists('cbFeMarker') ? '_fe' : '');
     }
     JRequest::setVar('tmpl', JRequest::getWord('tmpl', null));
     JRequest::setVar('layout', JRequest::getWord('layout', null) == 'latest' ? null : JRequest::getWord('layout', null));
     JRequest::setVar('view', 'edit');
     parent::display();
 }