Beispiel #1
0
 function saveContentPrep(&$row)
 {
     // Get submitted text from the request variables
     $text = JRequest::getVar('text', '', 'post', 'string', JREQUEST_ALLOWRAW);
     // Clean text for xhtml transitional compliance
     $text = str_replace('<br>', '<br />', $text);
     // Search for the {readmore} tag and split the text up accordingly.
     $pattern = '#<hr\\s+id=("|\')system-readmore("|\')\\s*\\/*>#i';
     $tagPos = preg_match($pattern, $text);
     if ($tagPos == 0) {
         $row->introtext = $text;
     } else {
         list($row->introtext, $row->fulltext) = preg_split($pattern, $text, 2);
     }
     // Filter settings
     jimport('joomla.application.component.helper');
     $config = JComponentHelper::getParams('com_content');
     $user =& JFactory::getUser();
     $gid = $user->get('gid');
     $filterGroups = $config->get('filter_groups');
     // convert to array if one group selected
     if (!is_array($filterGroups) && (int) $filterGroups > 0) {
         $filterGroups = array($filterGroups);
     }
     if (is_array($filterGroups) && in_array($gid, $filterGroups)) {
         $filterType = $config->get('filter_type');
         $filterTags = preg_split('#[,\\s]+#', trim($config->get('filter_tags')));
         $filterAttrs = preg_split('#[,\\s]+#', trim($config->get('filter_attritbutes')));
         switch ($filterType) {
             case 'NH':
                 $filter = new JFilterInput();
                 break;
             case 'WL':
                 $filter = new JFilterInput($filterTags, $filterAttrs, 0, 0, 0);
                 // turn off xss auto clean
                 break;
             case 'BL':
             default:
                 $filter = new JFilterInput($filterTags, $filterAttrs, 1, 1);
                 break;
         }
         $row->introtext = $filter->clean($row->introtext);
         $row->fulltext = $filter->clean($row->fulltext);
     } elseif (empty($filterGroups) && $gid != '25') {
         // no default filtering for super admin (gid=25)
         $filter = new JFilterInput(array(), array(), 1, 1);
         $row->introtext = $filter->clean($row->introtext);
         $row->fulltext = $filter->clean($row->fulltext);
     }
     return true;
 }
 function search()
 {
     $post['searchword'] = JRequest::getString('searchword', null, 'post');
     $post['ordering'] = JRequest::getWord('ordering', null, 'post');
     $post['searchphrase'] = JRequest::getWord('searchphrase', 'all', 'post');
     $post['limit'] = JRequest::getInt('limit', null, 'post');
     if ($post['limit'] === null) {
         unset($post['limit']);
     }
     $areas = JRequest::getVar('areas', null, 'post', 'array');
     if ($areas) {
         foreach ($areas as $area) {
             $post['areas'][] = JFilterInput::clean($area, 'cmd');
         }
     }
     // set Itemid id for links
     $menu =& JSite::getMenu();
     $items = $menu->getItems('link', 'index.php?option=com_search_lucene&view=search');
     if (isset($items[0])) {
         $post['Itemid'] = $items[0]->id;
     }
     unset($post['task']);
     unset($post['submit']);
     $uri = JURI::getInstance();
     $uri->setQuery($post);
     $uri->setVar('option', 'com_search_lucene');
     $this->setRedirect(JRoute::_('index.php' . $uri->toString(array('query', 'fragment')), false));
 }
 public function __construct($config = array())
 {
     parent::__construct($config);
     $app = JFactory::getApplication();
     /** @var $app JApplicationSite */
     // Get project id.
     $this->projectId = $this->input->getUint("pid");
     // Prepare log object
     $registry = JRegistry::getInstance("com_crowdfunding");
     /** @var  $registry Joomla\Registry\Registry */
     $fileName = $registry->get("logger.file");
     $tableName = $registry->get("logger.table");
     $file = JPath::clean(JFactory::getApplication()->get("log_path") . DIRECTORY_SEPARATOR . $fileName);
     $this->log = new ITPrismLog();
     $this->log->addWriter(new ITPrismLogWriterDatabase(JFactory::getDbo(), $tableName));
     $this->log->addWriter(new ITPrismLogWriterFile($file));
     // Create an object that contains a data used during the payment process.
     $this->paymentProcessContext = CrowdFundingConstants::PAYMENT_SESSION_CONTEXT . $this->projectId;
     $this->paymentProcess = $app->getUserState($this->paymentProcessContext);
     // Prepare context
     $filter = new JFilterInput();
     $paymentService = JString::trim(JString::strtolower($this->input->getCmd("payment_service")));
     $paymentService = $filter->clean($paymentService, "ALNUM");
     $this->context = !empty($paymentService) ? 'com_crowdfunding.notify.' . $paymentService : 'com_crowdfunding.notify';
     // Prepare params
     $this->params = JComponentHelper::getParams("com_crowdfunding");
 }
Beispiel #4
0
 /**
  * Gets an array of values from the request.
  *
  * @param   array  $vars        Associative array of keys and filter types to apply.
  *                              If empty and datasource is null, all the input data will be returned
  *                              but filtered using the default case in JFilterInput::clean.
  * @param   mixed  $datasource  Array to retrieve data from, or null
  *
  * @return  mixed  The filtered input data.
  *
  * @since   11.1
  */
 public function getArray(array $vars = array(), $datasource = null)
 {
     if (empty($vars) && is_null($datasource)) {
         $vars = $this->data;
     }
     $results = array();
     foreach ($vars as $k => $v) {
         if (is_array($v)) {
             if (is_null($datasource)) {
                 $results[$k] = $this->getArray($v, $this->get($k, null, 'array'));
             } else {
                 $results[$k] = $this->getArray($v, $datasource[$k]);
             }
         } else {
             if (is_null($datasource)) {
                 $results[$k] = $this->get($k, null, $v);
             } elseif (isset($datasource[$k])) {
                 $results[$k] = $this->filter->clean($datasource[$k], $v);
             } else {
                 $results[$k] = $this->filter->clean(null, $v);
             }
         }
     }
     return $results;
 }
Beispiel #5
0
 /**
  * do the plugin action
  *
  */
 function process(&$data, &$tableModel)
 {
     $params =& $this->getParams();
     $file = JFilterInput::clean($params->get('cronphp_file'), 'CMD');
     eval($params->get('cronphp_params'));
     require_once COM_FABRIK_FRONTEND . DS . 'plugins' . DS . 'cron' . DS . 'cronphp' . DS . 'scripts' . DS . $file;
 }
 public function __construct($config = array())
 {
     parent::__construct($config);
     $this->app = JFactory::getApplication();
     // Get project ID.
     $this->projectId = $this->input->getUint('pid');
     // Prepare log object.
     $this->log = new Prism\Log\Log();
     // Set database log adapter if Joomla! debug is enabled.
     if ($this->logTable !== null and $this->logTable !== '' and JDEBUG) {
         $this->log->addAdapter(new Prism\Log\Adapter\Database(\JFactory::getDbo(), $this->logTable));
     }
     // Set file log adapter.
     if ($this->logFile !== null and $this->logFile !== '') {
         $file = \JPath::clean($this->app->get('log_path') . DIRECTORY_SEPARATOR . basename($this->logFile));
         $this->log->addAdapter(new Prism\Log\Adapter\File($file));
     }
     // Prepare context
     $filter = new JFilterInput();
     $paymentService = $filter->clean(trim(strtolower($this->input->getCmd('payment_service'))), 'ALNUM');
     $this->context = Joomla\String\StringHelper::strlen($paymentService) > 0 ? 'com_crowdfunding.notify.' . $paymentService : 'com_crowdfunding.notify';
     // Prepare params
     $this->params = JComponentHelper::getParams('com_crowdfunding');
     // Prepare container and some of the most used objects.
     $this->container = Prism\Container::getContainer();
     $this->prepareCurrency($this->container, $this->params);
     $this->prepareMoneyFormatter($this->container, $this->params);
 }
Beispiel #7
0
 /**
  * if new elements found in the CSV file and user decided to
  * add them to the table then do it here
  * @param object import model
  * @param array existing headings
  * @return unknown_type
  */
 protected function addElements($model, $headings)
 {
     $user =& JFactory::getUser();
     $c = 0;
     $tableModel =& $this->getModel('Table');
     $tableModel->setId(JRequest::getInt('fabrik_table'));
     $tableModel->getTable();
     $formModel =& $tableModel->getForm();
     $groupId = current(array_keys($formModel->getGroupsHiarachy()));
     $plugins = JRequest::getVar('plugin');
     $elementModel =& $this->getModel('element');
     $element =& $elementModel->getElement();
     $elementsCreated = 0;
     $newElements = JRequest::getVar('createElements', array());
     $dataRemoved = false;
     foreach ($newElements as $elname => $add) {
         if ($add) {
             $element->id = 0;
             $element->name = JFilterInput::clean($elname);
             $element->label = strtolower($elname);
             $element->plugin = $plugins[$c];
             $element->group_id = $groupId;
             $element->eval = 0;
             $element->state = 1;
             $element->width = 255;
             $element->created = date('Y-m-d');
             $element->created_by = $user->get('id');
             $element->created_by_alias = $user->get('username');
             $element->checked_out = 0;
             $element->show_in_table_summary = 1;
             $element->ordering = 0;
             $headings[] = $element->name;
             $element->store();
             $where = " group_id = '" . $element->group_id . "'";
             $element->move(1, $where);
             $elementModel->addToDBTable();
             $elementsCreated++;
         } else {
             //need to remove none selected element's (that dont already appear in the table structure
             // data from the csv data
             $session =& JFactory::getSession();
             $allHeadings = $session->get('com_fabrik.csvheadings');
             $index = array_search($elname, $allHeadings);
             if ($index !== false) {
                 $dataRemoved = true;
                 foreach ($model->data as &$d) {
                     unset($d[$index]);
                 }
             }
         }
         $c++;
     }
     if ($dataRemoved) {
         //reindex data array
         foreach ($model->data as $k => $d) {
             $model->data[$k] = array_reverse(array_reverse($d));
         }
     }
     return $headings;
 }
Beispiel #8
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     $this->app = JFactory::getApplication();
     // Get project id.
     $this->projectId = $this->input->getUint('pid');
     // Prepare log object
     $registry = Joomla\Registry\Registry::getInstance('com_crowdfunding');
     /** @var  $registry Joomla\Registry\Registry */
     $fileName = $registry->get('logger.file');
     $tableName = $registry->get('logger.table');
     $file = JPath::clean($this->app->get('log_path') . DIRECTORY_SEPARATOR . $fileName);
     $this->log = new Prism\Log\Log();
     $this->log->addAdapter(new Prism\Log\Adapter\Database(JFactory::getDbo(), $tableName));
     $this->log->addAdapter(new Prism\Log\Adapter\File($file));
     // Create an object that contains a data used during the payment process.
     $this->paymentProcessContext = Crowdfunding\Constants::PAYMENT_SESSION_CONTEXT . $this->projectId;
     $this->paymentProcess = $this->app->getUserState($this->paymentProcessContext);
     // Prepare context
     $filter = new JFilterInput();
     $paymentService = JString::trim(JString::strtolower($this->input->getCmd('payment_service')));
     $paymentService = $filter->clean($paymentService, 'ALNUM');
     $this->context = JString::strlen($paymentService) > 0 ? 'com_crowdfunding.notify.' . $paymentService : 'com_crowdfunding.notify';
     // Prepare params
     $this->params = JComponentHelper::getParams('com_crowdfunding');
 }
Beispiel #9
0
 protected function _getSearchData()
 {
     // clean html tags
     $filter = new JFilterInput();
     $value = $filter->clean($this->_data->get('value', ''));
     return empty($value) ? null : $value;
 }
Beispiel #10
0
 function requestSent()
 {
     $jfbcRequestId = JRequest::getInt('jfbcId');
     $fbRequestId = JRequest::getString('requestId');
     $inToList = JRequest::getVar('to');
     // Get the from user id from the request
     $to = $inToList[0];
     $requestInfo = JFBCFactory::provider('facebook')->api('/' . $fbRequestId . "_" . $to);
     $fbFrom = $requestInfo['from']['id'];
     // Not using the model, as we're doing a simple store.
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_jfbconnect/tables');
     $data = array();
     $data['fb_request_id'] = $fbRequestId;
     $data['fb_user_from'] = $fbFrom;
     $data['jfbc_request_id'] = $jfbcRequestId;
     $data['created'] = JFactory::getDate()->toSql();
     $data['modified'] = null;
     //        $data['destination_url'] = JRequest::getString('destinationUrl');
     foreach ($inToList as $fbTo) {
         $row =& JTable::getInstance('JFBConnectNotification', 'Table');
         $to = JFilterInput::clean($fbTo, 'ALNUM');
         $data['fb_user_to'] = $to;
         $row->save($data);
         $point = new JFBConnectPoint();
         $point->set('name', 'facebook.request.create');
         $point->set('key', $to);
         $point->award();
     }
     $app = JFactory::getApplication();
     $app->close();
 }
Beispiel #11
0
 /**
  * @return boolean
  */
 function check()
 {
     $this->menutype = JFilterInput::clean($this->menutype, 'menutype');
     if (empty($this->menutype)) {
         $this->setError("Cannot save: Empty menu type");
         return false;
     }
     // correct spurious data
     if (trim($this->title) == '') {
         $this->title = $this->menutype;
     }
     $db =& JFactory::getDBO();
     // check for unique menutype for new menu copy
     $query = 'SELECT menutype' . ' FROM #__menu_types';
     if ($this->id) {
         $query .= ' WHERE id != ' . (int) $this->id;
     }
     $db->setQuery($query);
     $menus = $db->loadResultArray();
     foreach ($menus as $menutype) {
         if ($menutype == $this->menutype) {
             $this->setError("Cannot save: Duplicate menu type '{$this->menutype}'");
             return false;
         }
     }
     return true;
 }
 /**
  * Here starts the processing
  *
  * @copyright
  * @author 		RolandD
  * @todo
  * @see
  * @access 		public
  * @param
  * @return
  * @since 		3.0
  */
 public function getStart()
 {
     $jinput = JFactory::getApplication()->input;
     // Load the data
     $this->loadData();
     // Load the helper
     $this->helper = new Com_VirtueMart();
     // Get the logger
     $csvilog = $jinput->get('csvilog', null, null);
     $this->virtuemart_vendor_id = $this->helper->getVendorId();
     // Process data
     foreach ($this->csvi_data as $name => $value) {
         // Check if the field needs extra treatment
         switch ($name) {
             case 'name':
                 $this->{$name} = strtolower(JFilterInput::clean($value, 'alnum'));
                 break;
             default:
                 $this->{$name} = $value;
                 break;
         }
     }
     // Check if we have a field ID
     if (empty($this->virtuemart_userfield_id)) {
         $this->_getFieldId();
     }
     // All is good
     return true;
 }
Beispiel #13
0
 /**
  * Load the editor
  *
  * @access	private
  * @param	array	Associative array of editor config paramaters
  * @since	1.5
  */
 function _loadEditor($config = array())
 {
     //check if editor is already loaded
     if (!is_null($this->_editor)) {
         return;
     }
     jimport('joomla.filesystem.file');
     // Build the path to the needed editor plugin
     $name = JFilterInput::clean($this->_name, 'cmd');
     $path = JPATH_SITE . DS . 'plugins' . DS . 'editors' . DS . $name . '.php';
     if (!JFile::exists($path)) {
         $message = JText::_('Cannot load the editor');
         JCKHelper::error($message);
         return false;
     }
     // Require plugin file
     require_once $path;
     // Build editor plugin classname
     $name = 'plgEditor' . $this->_name;
     if ($this->_editor = new $name($this, $config)) {
         // load plugin parameters
         $this->initialise();
         JPluginHelper::importPlugin('editors-xtd');
     }
 }
Beispiel #14
0
 /**
  * Render the document
  *
  * @access public
  * @param boolean 	$cache		If true, cache the output
  * @param array		$params		Associative array of attributes
  */
 function render($cache = false, $params = array())
 {
     // If no error object is set return null
     if (!isset($this->_error)) {
         return;
     }
     //Set the status header
     JResponse::setHeader('status', $this->_error->code . ' ' . str_replace("\n", ' ', $this->_error->message));
     $file = 'error.php';
     // check template
     $directory = isset($params['directory']) ? $params['directory'] : 'templates';
     $template = isset($params['template']) ? JFilterInput::clean($params['template'], 'cmd') : 'system';
     if (!file_exists($directory . DS . $template . DS . $file)) {
         $template = 'system';
     }
     //set variables
     $this->baseurl = JURI::base(true);
     $this->template = $template;
     $this->debug = isset($params['debug']) ? $params['debug'] : false;
     $this->error = $this->_error;
     // load
     $data = $this->_loadTemplate($directory . DS . $template, $file);
     parent::render();
     return $data;
 }
Beispiel #15
0
 /**
  * Gets an array of values from the request.
  *
  * @param   array   $vars           Associative array of keys and filter types to apply.
  *                                  If empty and datasource is null, all the input data will be returned
  *                                  but filtered using the filter given by the parameter defaultFilter in
  *                                  JFilterInput::clean.
  * @param   mixed   $datasource     Array to retrieve data from, or null.
  * @param   string  $defaultFilter  Default filter used in JFilterInput::clean if vars is empty and
  *                                  datasource is null. If 'unknown', the default case is used in
  *                                  JFilterInput::clean.
  * @param   bool    $recursion      Flag to indicate a recursive function call.
  *
  * @return  mixed  The filtered input data.
  *
  * @since   3.4.2
  */
 protected function getArrayRecursive(array $vars = array(), $datasource = null, $defaultFilter = 'unknown', $recursion = false)
 {
     if (empty($vars) && is_null($datasource)) {
         $vars = $this->data;
     } else {
         if (!$recursion) {
             $defaultFilter = null;
         }
     }
     $results = array();
     foreach ($vars as $k => $v) {
         if (is_array($v)) {
             if (is_null($datasource)) {
                 $results[$k] = $this->getArrayRecursive($v, $this->get($k, null, 'array'), $defaultFilter, true);
             } else {
                 $results[$k] = $this->getArrayRecursive($v, $datasource[$k], $defaultFilter, true);
             }
         } else {
             $filter = isset($defaultFilter) ? $defaultFilter : $v;
             if (is_null($datasource)) {
                 $results[$k] = $this->get($k, null, $filter);
             } elseif (isset($datasource[$k])) {
                 $results[$k] = $this->filter->clean($datasource[$k], $filter);
             } else {
                 $results[$k] = $this->filter->clean(null, $filter);
             }
         }
     }
     return $results;
 }
Beispiel #16
0
 function search()
 {
     // Captcha Controller Patch rev. 4.5.0 Stable
     $dispatcher =& JDispatcher::getInstance();
     $results = $dispatcher->trigger('onCaptchaRequired', array('user.search'));
     if ($results[0]) {
         $captchaparams = array(JRequest::getVar('captchacode', '', 'post'), JRequest::getVar('captchasuffix', '', 'post'), JRequest::getVar('captchasessionid', '', 'post'));
         $results = $dispatcher->trigger('onCaptchaVerify', $captchaparams);
         if (!$results[0]) {
             JError::raiseWarning('CAPTHCA', JText::_('CAPTCHACODE_DO_NOT_MATCH'));
         }
     }
     // slashes cause errors, <> get stripped anyway later on. # causes problems.
     $badchars = array('#', '>', '<', '\\');
     $searchword = trim(str_replace($badchars, '', JRequest::getString('searchword', null, 'post')));
     // Captcha Controller Patch rev. 4.5.0 Stable
     if (!$results[0]) {
         $searchword = '';
     }
     // if searchword enclosed in double quotes, strip quotes and do exact match
     if (substr($searchword, 0, 1) == '"' && substr($searchword, -1) == '"') {
         $post['searchword'] = substr($searchword, 1, -1);
         JRequest::setVar('searchphrase', 'exact');
     } else {
         $post['searchword'] = $searchword;
     }
     $post['ordering'] = JRequest::getWord('ordering', null, 'post');
     $post['searchphrase'] = JRequest::getWord('searchphrase', 'all', 'post');
     $post['limit'] = JRequest::getInt('limit', null, 'post');
     if ($post['limit'] === null) {
         unset($post['limit']);
     }
     $areas = JRequest::getVar('areas', null, 'post', 'array');
     if ($areas) {
         foreach ($areas as $area) {
             $post['areas'][] = JFilterInput::clean($area, 'cmd');
         }
     }
     // No need to guess Itemid if it's already present in the URL
     if (JRequest::getInt('Itemid') > 0) {
         $post['Itemid'] = JRequest::getInt('Itemid');
     } else {
         // set Itemid id for links
         $menu =& JSite::getMenu();
         $items = $menu->getItems('link', 'index.php?option=com_search&view=search');
         if (isset($items[0])) {
             $post['Itemid'] = $items[0]->id;
         }
     }
     unset($post['task']);
     unset($post['submit']);
     $uri = JURI::getInstance();
     $uri->setQuery($post);
     $uri->setVar('option', 'com_search');
     $this->setRedirect(JRoute::_('index.php' . $uri->toString(array('query', 'fragment')), false));
 }
Beispiel #17
0
 function storeMenu()
 {
     $this->_getMenuType_ID();
     $menuType = JTable::getInstance('menutype');
     $menuType->id = $this->id;
     $this->menutype = $menuType->menutype = JFilterInput::clean($this->title, 'username');
     $menuType->title = $this->title;
     $menuType->store();
     $this->storeMenuModule();
 }
Beispiel #18
0
 public function onImportCSVRow(&$params, &$listModel)
 {
     $file = JFilterInput::clean($params->get('listcsv_import_php_file'), 'CMD');
     if ($file == -1 || $file == '') {
         $code = @eval($params->get('listcsv_import_php_code'));
         FabrikWorker::logEval($code, 'Caught exception on eval in onImportCSVRow : %s');
     } else {
         @(require JPATH_ROOT . '/plugins/fabrik_list/listcsv/scripts/' . $file);
     }
     return true;
 }
Beispiel #19
0
 function getInstance()
 {
     if (!isset($this->gateway)) {
         $params =& $this->getParams();
         $gateway = JFilterInput::clean($params->get('sms-gateway', 'Kapow'), 'CMD');
         require_once JPATH_ROOT . DS . 'plugins' . DS . 'fabrik_form' . DS . 'sms' . DS . 'gateway' . DS . strtolower($gateway);
         $this->gateway = new $gateway();
         $this->gateway->params =& $params;
     }
     return $this->gateway;
 }
Beispiel #20
0
 /**
  * do the plug-in action
  * @param object parameters
  * @param object table model
  * @param array custom options
  */
 function process(&$params, &$model, $opts = array())
 {
     $file = JFilterInput::clean($params->get('table_php_file'), 'CMD');
     if ($file == -1 || $file == '') {
         $code = $params->get('table_php_code');
         @eval($code);
     } else {
         require_once JPATH_ROOT . DS . 'plugins' . DS . 'fabrik_list' . DS . 'scripts' . DS . $file;
     }
     return true;
 }
Beispiel #21
0
 public function onImportCSVRow(&$params, &$tableModel)
 {
     $file = JFilterInput::clean($params->get('tablecsv_import_php_file'), 'CMD');
     if ($file == -1 || $file == '') {
         $code = @eval($params->get('tablecsv_import_php_code'));
         FabrikWorker::logEval($code, 'Caught exception on eval in onImportCSVRow : %s');
     } else {
         @(require COM_FABRIK_FRONTEND . DS . 'plugins' . DS . 'table' . DS . 'tablecsv' . DS . 'scripts' . DS . $file);
     }
     return true;
 }
Beispiel #22
0
 /**
  * Get specific SMS gateway instance
  *
  * @return  object  gateway
  */
 private function getInstance()
 {
     if (!isset($this->gateway)) {
         $params = $this->getParams();
         $gateway = JFilterInput::clean($params->get('sms-gateway', 'kapow.php'), 'CMD');
         require_once JPATH_ROOT . '/plugins/fabrik_form/sms/gateway/' . JString::strtolower($gateway);
         $gateway = JFile::stripExt($gateway);
         $this->gateway = new $gateway();
         $this->gateway->params = $params;
     }
     return $this->gateway;
 }
Beispiel #23
0
 /**
  * do the plug-in action
  * @param object parameters
  * @param object table model
  * @param array custom options
  */
 function process(&$params, &$model, $opts = array())
 {
     $file = JFilterInput::clean($params->get('table_php_file'), 'CMD');
     if ($file == -1 || $file == '') {
         $code = $params->get('table_php_code');
         $code = @eval($code);
         FabrikWorker::logEval($code, 'Caught exception on eval in tablephp::process() : %s');
     } else {
         require_once COM_FABRIK_FRONTEND . DS . 'plugins' . DS . 'table' . DS . 'tablephp' . DS . 'scripts' . DS . $file;
     }
     return true;
 }
Beispiel #24
0
 /**
  * @param        $name
  * @param   null   $default
  * @param   string $hash
  * @param   string $type
  *
  * @return mixed
  */
 protected function getVar($name, $default = null, $hash = 'request', $type = 'none')
 {
     // If we are not in embedded mode, get variable from request
     if (!$this->embedded) {
         if ($hash == 'request') {
             return $this->input->get($name, $default, $type);
         } else {
             return $this->input->{$hash}->get($name, $default, $type);
         }
     }
     return $this->filter->clean($this->params->get($name, $default), $type);
 }
Beispiel #25
0
 /**
  * do the plug-in action
  * @param object parameters
  * @param object table model
  * @param array custom options
  */
 function observe(&$params, &$model, $opts = array())
 {
     $method = $opts[1];
     if ($method == $params->get('php_observe_method', 'process')) {
         $file = JFilterInput::clean($params->get('php_observer_file'), 'CMD');
         $file = COM_FABRIK_FRONTEND . DS . 'plugins' . DS . 'table' . DS . 'php_observer' . DS . 'scripts' . DS . $file;
         if (JFile::exists($file)) {
             require $file;
         }
     }
     return true;
 }
Beispiel #26
0
 /**
  * Method to display the view
  *
  * @access	public
  * @author RickG, Max Milbers
  */
 public function __construct()
 {
     parent::__construct();
     $stateModel = VmModel::getModel('state');
     $states = array();
     //retrieving countries id
     $countries = JRequest::getString('virtuemart_country_id');
     $countries = explode(',', $countries);
     foreach ($countries as $country) {
         $states[$country] = $stateModel->getStates(JFilterInput::clean($country, 'INTEGER'), true);
     }
     echo json_encode($states);
     jExit();
 }
Beispiel #27
0
 /**
  * Do the plug-in action
  *
  * @param   object  $params  plugin parameters
  * @param   object  &$model  list model
  * @param   array   $opts    custom options
  *
  * @return  bool
  */
 public function process($params, &$model, $opts = array())
 {
     $file = JFilterInput::clean($params->get('table_php_file'), 'CMD');
     if ($file == -1 || $file == '') {
         $code = $params->get('table_php_code');
         @eval($code);
     } else {
         require_once JPATH_ROOT . '/plugins/fabrik_list/php/scripts/' . $file;
     }
     if (isset($statusMsg) && !empty($statusMsg)) {
         $this->msg = $statusMsg;
     }
     return true;
 }
 /**
  * Catch the response from PayPal and store data about transaction/
  *
  * @todo Move sending mail functionality to plugins.
  */
 public function notify()
 {
     $app = JFactory::getApplication();
     /** @var $app JApplicationSite * */
     $params = $app->getParams("com_virtualcurrency");
     // Check for disabled payment functionality
     if ($params->get("debug_payment_disabled", 0)) {
         $error = JText::_("COM_VIRTUALCURRENCY_ERROR_PAYMENT_HAS_BEEN_DISABLED");
         $error .= "\n" . JText::sprintf("COM_VIRTUALCURRENCY_TRANSACTION_DATA", var_export($_POST, true));
         JLog::add($error);
         return null;
     }
     // Clear the name of the payment gateway.
     $filter = new JFilterInput();
     $paymentService = $filter->clean(JString::trim(JString::strtolower($this->input->getCmd("payment_service"))));
     $context = !empty($paymentService) ? 'com_virtualcurrency.notify.' . $paymentService : 'com_crowdfunding.notify';
     // Save data
     try {
         // Events
         $dispatcher = JEventDispatcher::getInstance();
         // Event Notify
         JPluginHelper::importPlugin('virtualcurrencypayment');
         $results = $dispatcher->trigger('onPaymenNotify', array($context, &$params));
         $transaction = null;
         $currency = null;
         if (!empty($results)) {
             foreach ($results as $result) {
                 if (!empty($result) and isset($result["transaction"])) {
                     $transaction = JArrayHelper::getValue($result, "transaction");
                     $currency = JArrayHelper::getValue($result, "currency");
                     break;
                 }
             }
         }
         // If there is no transaction data, the status might be pending or another one.
         // So, we have to stop the script execution.
         if (empty($transaction)) {
             return;
         }
         // Event After Payment
         $dispatcher->trigger('onAfterPayment', array($context, &$transaction, &$params, &$currency));
     } catch (Exception $e) {
         JLog::add($e->getMessage());
         $input = "INPUT:" . var_export($app->input, true) . "\n";
         JLog::add($input);
         // Send notification about the error to the administrator.
         $model = $this->getModel();
         $model->sendMailToAdministrator();
     }
 }
Beispiel #29
0
 /**
  * Get specific SMS gateway instance
  *
  * @return  object  gateway
  */
 private function getInstance()
 {
     if (!isset($this->gateway)) {
         $params = $this->getParams();
         $gateway = $params->get('sms-gateway', 'kapow.php');
         $input = new JFilterInput();
         $gateway = $input->clean($gateway, 'CMD');
         require_once JPATH_ROOT . '/components/com_fabrik/helpers/sms_gateways/' . JString::strtolower($gateway);
         $gateway = JFile::stripExt($gateway);
         $this->gateway = new $gateway();
         $this->gateway->params = $params;
     }
     return $this->gateway;
 }
Beispiel #30
0
 /**
  * Do the plugin action
  *
  * @param   array   &$data       array data to process
  * @param   object  &$listModel  plugin's list model
  *
  * @return  int  number of records run, you can set this by setting the varaible $processed
  * in either your included script in php code.
  */
 public function process(&$data, &$listModel)
 {
     $params = $this->getParams();
     $file = JFilterInput::clean($params->get('cronphp_file'), 'CMD');
     eval($params->get('cronphp_params'));
     $file = JPATH_ROOT . '/plugins/fabrik_cron/php/scripts/' . $file;
     if (JFile::exists($file)) {
         require_once $file;
     }
     if (isset($processed)) {
         return (int) $processed;
     }
     return 0;
 }