Esempio n. 1
0
 /**
  * determine if the table plugin is a button and can be activated only when rows are selected
  *
  * @return bol
  */
 function canSelectRows()
 {
     $params =& $this->getParams();
     $access = $params->get('updatecol_access');
     $name = $this->_getButtonName();
     $canuse = FabrikWorker::getACL($access, $name);
     return $canuse;
 }
Esempio n. 2
0
 protected function getButton()
 {
     $params = $this->getParams();
     $access = $params->get('emailtable_access');
     $canuse = FabrikWorker::getACL($access, $name);
     $name = $this->_getButtonName();
     if ($canuse) {
         return "<a href=\"#\" class=\"listplugin {$name}\"/>" . $params->get('email_button_label', JText::_('PLG_LIST_EMAIL_EMAIL')) . "</a>";
     }
     return '';
 }
Esempio n. 3
0
 function canUse(&$model = null, $location = null, $event = null)
 {
     $aclParam = $this->getAclParam();
     if ($aclParam == '') {
         return true;
     }
     $params =& $this->getParams();
     $access = $params->get($aclParam);
     $name = $this->_getButtonName();
     return FabrikWorker::getACL($access, $name);
 }
Esempio n. 4
0
 /**
  * check to see if prefilter should be applied
  * Kind of an inverse access lookup
  * @param int group id to check against
  * @param string ref for filter
  * @return bol must apply filter - true, ignore filter (user has enough access rights) false;
  */
 function mustApplyWhere($gid, $ref)
 {
     // $$$ hugh - adding 'where when' so can control whether to apply WHERE either on
     // new, edit or both (1, 2 or 3)
     $params = $this->getParams();
     $wherewhen = $params->get('database_join_where_when', '3');
     $isnew = JRequest::getInt('rowid', 0) === 0;
     if ($isnew && $wherewhen == '2') {
         return false;
     } else {
         if (!$isnew && $wherewhen == '1') {
             return false;
         }
     }
     // prefilters with JACL are applied to a single group only
     // not a group and groups beneath them (think author, registered)
     // so if JACL on then prefilters work in the inverse in that they are only applied
     // to the group selected
     if (defined('_JACL')) {
         return FabrikWorker::getACL($gid, 'dbjoinwhere' . $ref);
     } else {
         return FabrikWorker::getACL($gid, 'dbjoinwhere' . $ref, '<=');
     }
 }
Esempio n. 5
0
 /**
  * not really an AJAX call, we just use the pluginAjax method so we can run this
  * method for handling scripted downloads.
  */
 function onAjax_download()
 {
     $app = JFactory::getApplication();
     $url = JRequest::getVar('HTTP_REFERER', '', 'server');
     $lang =& JFactory::getLanguage();
     $lang->load('com_fabrik.plg.element.fabrikfileupload', JPATH_ADMINISTRATOR);
     if (!$this->canView()) {
         $app->enqueueMessage(JText::_('PLG_ELEMENT_FILEUPLOAD_DOWNLOAD_NO_PERMISSION'));
         $app->redirect($url);
         exit;
     }
     $rowid = JRequest::getInt('rowid', 0);
     if (empty($rowid)) {
         $app->enqueueMessage(JText::_('PLG_ELEMENT_FILEUPLOAD_DOWNLOAD_NO_SUCH_FILE'));
         $app->redirect($url);
         exit;
     }
     $repeatcount = JRequest::getInt('repeatcount', 0);
     $listModel = $this->getListModel();
     $row = $listModel->getRow($rowid, false);
     if (empty($row)) {
         $app->enqueueMessage(JText::_('PLG_ELEMENT_FILEUPLOAD_DOWNLOAD_NO_SUCH_FILE'));
         $app->redirect($url);
         exit;
     }
     $aclEl = str_replace('.', '___', $params->get('fu_download_acl', ''));
     if (!empty($aclEl)) {
         $canDownload = FabrikWorker::getACL($row->{$aclEl}, 'filedownload');
         if (!$canDownload) {
             $app->enqueueMessage(JText::_('DOWNLOAD NO PERMISSION'));
             $app->redirect($url);
         }
     }
     //$element = $this->getElement();
     $storage = $this->getStorage();
     $elName = $this->getFullName(false, true, false);
     //$elName .= '_raw';
     $filepath = $row->{$elName};
     //$filepath = explode(GROUPSPLITTER,$filepath);
     $filepath = FabrikWorker::JSONtoData($filepath, true);
     $filepath = JArrayHelper::getValue($filepath, $repeatcount);
     $filepath = $storage->getFullPath($filepath);
     $filecontent = $storage->read($filepath);
     if ($filecontent !== false) {
         /*
          // $$$ hugh - turn of E_DEPRECATED to avoid warnings about eregi() in getid3
         $current_level = error_reporting();
         error_reporting($current_level & ~E_DEPRECATED);
         
         require_once(COM_FABRIK_FRONTEND.DS.'libs'.DS.'getid3'.DS.'getid3'.DS.'getid3.php');
         require_once(COM_FABRIK_FRONTEND.DS.'libs'.DS.'getid3'.DS.'getid3'.DS.'getid3.lib.php');
         
         getid3_lib::IncludeDependency(COM_FABRIK_FRONTEND.DS.'libs'.DS.'getid3'.DS.'getid3'.DS.'extension.cache.mysql.php', __FILE__, true);
         $config =& JFactory::getConfig();
         $host =  $config->getValue('host');
         $database = $config->getValue('db');
         $username = $config->getValue('user');
         $password = $config->getValue('password');
         $getID3 = new getID3_cached_mysql($host, $database, $username, $password);
         // Analyze file and store returned data in $ThisFileInfo
         $thisFileInfo = $getID3->analyze($filepath);
         */
         $thisFileInfo = $storage->getFileInfo($filepath);
         if ($thisFileInfo === false) {
             $app->enqueueMessage(JText::_('DOWNLOAD NO SUCH FILE'));
             $app->redirect($url);
             exit;
         }
         header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
         // Some time in the past
         header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
         header("Cache-Control: no-store, no-cache, must-revalidate");
         header("Cache-Control: post-check=0, pre-check=0", false);
         header("Pragma: no-cache");
         header('Accept-Ranges: bytes');
         header('Content-Length: ' . $thisFileInfo['filesize']);
         header('Content-Type: ' . $thisFileInfo['mime_type']);
         header('Content-Disposition: attachment; filename="' . $thisFileInfo['filename'] . '"');
         // ... serve up the image ...
         echo $filecontent;
         $this->downloadEmail($row, $filepath);
         $this->downloadHit($rowid, $repeatcount);
         $this->downloadLog($row, $filepath);
         // ... and we're done.
         exit;
     } else {
         $app->enqueueMessage(JText::_('PLG_ELEMENT_FILEUPLOAD_DOWNLOAD_NO_SUCH_FILE'));
         $app->redirect($url);
         exit;
     }
 }
Esempio n. 6
0
 /**
 	 * $$$ rob if the filter should not be applied due to its acl level then set its condition so that it
 	 will always return true. Do this rather than unsetting the filter - as this removes the selected option
 	 from the filter forms field. Can be used in conjunction with a list filter plugin to override a normal fiters option with the
 plugins option, e.g. load all univertisties courses OR [plugin option] load remote courses run by selected university
 e.g http://www.epics-ve.eu/index.php?option=com_fabrik&view=list&listid=5
 */
 public function checkAccess(&$filters)
 {
     $access = JArrayHelper::getValue($filters, 'access', array());
     foreach ($access as $key => $selAccess) {
         $i = $filters['key'][$key];
         if (!FabrikWorker::getACL($selAccess, $i)) {
             $filters['sqlCond'][$key] = '1=1';
         }
     }
     FabrikHelperHTML::debug($filters, 'filter array: after access taken into account');
 }
Esempio n. 7
0
 /**
  * Defines if the user can use the filter related to the element
  *
  * @return bol true if you can use
  */
 function canUseFilter()
 {
     $params =& $this->getParams();
     $element =& $this->getElement();
     if (!is_object($this->_access) || !array_key_exists('filter', $this->_access)) {
         $this->_access->filter = FabrikWorker::getACL($params->get('filter_access'), 'filterElement' . $element->name);
     }
     return $this->_access->filter;
 }
Esempio n. 8
0
	protected function downloadLink($value)
	{
		$params = $this->getParams();
		$storage = $this->getStorage();
		$formModel = $this->getFormModel();
		if (empty($value) || !$storage->exists(COM_FABRIK_BASE.$value)) {
			return "";
		}
		$aclEl = str_replace('.', '___', $params->get('fu_download_acl', ''));
		if (!empty($aclEl)) {
			$canDownload = FabrikWorker::getACL($data[$aclEl], 'filedownload');
			if (!$canDownload) {
				$img = $params->get('fu_download_noaccess_image');
				return $img == '' ? '' : "<img src=\"images/stories/$img\" alt=\"".JText::_('DOWNLOAD NO PERMISSION')."\" />";
			}
		}

		$rowid = JRequest::getVar('rowid', '0');
		$elementid = $this->_id;
		$title = basename($value);
		if ($params->get('fu_title_element') == '') {
			$title_name = $this->getFullName(true, true, false ) . '__title';
		} else {
			$title_name = str_replace('.', '___', $params->get('fu_title_element'));
		}
		$title_name .= '_raw';
		if (is_array($formModel->_data)) {
			if (array_key_exists($title_name, $formModel->_data)) {
				if (!empty($formModel->_data[$title_name])) {
					$title = $formModel->_data[$title_name];
					$titles = FabrikWorker::JSONtoData($title, true);
					$title = JArrayHelper::getValue($titles, $repeatCounter, $title);
				}
			}
		}
		if ($params->get('fu_download_access_image') !== '') {
			$title = "<img src=\"images/stories/".$params->get('fu_download_access_image')."\" alt=\"$title\" />";
		}
		$link = COM_FABRIK_LIVESITE . "index.php?option=com_fabrik&task=plugin.pluginAjax&plugin=fileupload&method=ajax_download&element_id=$elementid&formid=$formid&rowid=$rowid&repeatcount=$repeatCounter";
		$url = "<a href=\"$link\">$title</a>";
		return $url;
	}
Esempio n. 9
0
 /**
  * check to see if prefilter should be applied
  * Kind of an inverse access lookup
  * @param int group id to check against
  * @param string ref for filter
  * @return bol must apply filter - true, ignore filter (user has enough access rights) false;
  */
 function mustApplyFilter($gid, $ref)
 {
     // prefilters with JACL are applied to a single group only
     // not a group and groups beneath them (think author, registered)
     // so if JACL on then prefilters work in the inverse in that they are only applied
     // to the group selected
     if (defined('_JACL')) {
         return FabrikWorker::getACL($gid, 'prefilter' . $ref);
     } else {
         return FabrikWorker::getACL($gid, 'prefilter' . $ref, '<=');
     }
 }