예제 #1
1
 /**
  * Create objects for the options
  *
  * @return  array  The array of option objects
  */
 protected function getOptions()
 {
     $options = array();
     // Initialize some field attributes.
     $key = $this->element['key_field'] ? (string) $this->element['key_field'] : 'value';
     $value = $this->element['value_field'] ? (string) $this->element['value_field'] : (string) $this->element['name'];
     $translate = $this->element['translate'] ? (string) $this->element['translate'] : false;
     $query = (string) $this->element['query'];
     // Get the database object.
     $db = F0FPlatform::getInstance()->getDbo();
     // Set the query and get the result list.
     $db->setQuery($query);
     $items = $db->loadObjectlist();
     // Build the field options.
     if (!empty($items)) {
         foreach ($items as $item) {
             if ($translate == true) {
                 $options[] = JHtml::_('select.option', $item->{$key}, JText::_($item->{$value}));
             } else {
                 $options[] = JHtml::_('select.option', $item->{$key}, $item->{$value});
             }
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
예제 #2
0
 /**
  * Is this feature enabled?
  *
  * @return bool
  */
 public function isEnabled()
 {
     if (!F0FPlatform::getInstance()->isFrontend()) {
         return false;
     }
     return $this->cparams->getValue('urlredirection', 1) == 1;
 }
예제 #3
0
파일: abstract.php 프로젝트: enjoy2000/smcd
 /**
  * Checks if a non logged in user is trying to access the administrator application
  *
  * @param bool $onlySubmit bool Return true only if the login form is submitted
  *
  * @return bool
  */
 protected function isAdminAccessAttempt($onlySubmit = false)
 {
     // Not back-end at all. Bail out.
     if (!F0FPlatform::getInstance()->isBackend()) {
         return false;
     }
     // If the user is already logged in we don't have a login attempt
     $user = JFactory::getUser();
     if (!$user->guest) {
         return false;
     }
     // If we have option=com_login&task=login then the user is submitting the login form. Otherwise Joomla! is
     // just displaying the login form.
     $input = JFactory::getApplication()->input;
     $option = $input->getCmd('option', null);
     $task = $input->getCmd('task', null);
     $isPostingLoginForm = $option == 'com_login' && $task == 'login';
     // If the user is submitting the login form we return depending on whether we are asked for posting access
     // or not.
     if ($isPostingLoginForm) {
         return $onlySubmit;
     }
     // This is a regular admin access attempt
     if ($onlySubmit) {
         // Since we were asked to only return true for login form posting and this is not the case we have to
         // return false (the login form is not being posted)
         return false;
     }
     // In any other case we return true.
     return true;
 }
예제 #4
0
	/**
	 * Is this feature enabled?
	 *
	 * @return bool
	 */
	public function isEnabled()
	{
		// We only use this feature in the front-end
		if (F0FPlatform::getInstance()->isBackend())
		{
			return false;
		}

		// The feature must be enabled
		if ($this->cparams->getValue('httpsizer', 0) != 1)
		{
			return false;
		}

		// Make sure we're accessed over SSL (HTTPS)
		$uri = JURI::getInstance();
		$protocol = $uri->toString(array('scheme'));

		if ($protocol != 'https://')
		{
			return false;
		}


		return true;
	}
예제 #5
0
 /**
  * Is this feature enabled?
  *
  * @return bool
  */
 public function isEnabled()
 {
     if (!F0FPlatform::getInstance()->isFrontend()) {
         return false;
     }
     return $this->cparams->getValue('httpblenable', 0) == 1;
 }
예제 #6
0
 public function onCreate($tpl = null)
 {
     $document = F0FPlatform::getInstance()->getDocument();
     if ($document instanceof JDocument) {
         if ($this->useHypermedia) {
             $document->setMimeEncoding('application/hal+json');
         } else {
             $document->setMimeEncoding('application/json');
         }
     }
     $key = $this->input->getCmd('key', '');
     $pwd = $this->input->getCmd('pwd', '');
     $json = $this->getModel()->createCoupon($key, $pwd);
     $json = json_encode($json);
     // JSONP support
     $callback = $this->input->get('callback', null);
     if (!empty($callback)) {
         echo $callback . '(' . $json . ')';
     } else {
         $defaultName = $this->input->getCmd('view', 'joomla');
         $filename = $this->input->getCmd('basename', $defaultName);
         $document->setName($filename);
         echo $json;
     }
     return false;
 }
예제 #7
0
 /**
  * Is this feature enabled?
  *
  * @return bool
  */
 public function isEnabled()
 {
     if (!F0FPlatform::getInstance()->isFrontend()) {
         return false;
     }
     return $this->cparams->getValue('custgenerator', 0) != 0;
 }
예제 #8
0
 /**
  * Is this feature enabled?
  *
  * @return bool
  */
 public function isEnabled()
 {
     if (!F0FPlatform::getInstance()->isBackend()) {
         return false;
     }
     return $this->cparams->getValue('nonewadmins', 0) == 1;
 }
예제 #9
0
 public function cron($cachable = false)
 {
     // Makes sure SiteGround's SuperCache doesn't cache the CRON view
     JResponse::setHeader('X-Cache-Control', 'False', true);
     require_once F0FTemplateUtils::parsePath('admin://components/com_akeebasubs/helpers/cparams.php', true);
     $configuredSecret = AkeebasubsHelperCparams::getParam('secret', '');
     if (empty($configuredSecret)) {
         header('HTTP/1.1 503 Service unavailable due to configuration');
         JFactory::getApplication()->close();
     }
     $secret = $this->input->get('secret', null, 'raw');
     if ($secret != $configuredSecret) {
         header('HTTP/1.1 403 Forbidden');
         JFactory::getApplication()->close();
     }
     $command = $this->input->get('command', null, 'raw');
     $command = trim(strtolower($command));
     if (empty($command)) {
         header('HTTP/1.1 501 Not implemented');
         JFactory::getApplication()->close();
     }
     F0FPlatform::getInstance()->importPlugin('system');
     F0FPlatform::getInstance()->runPlugins('onAkeebasubsCronTask', array($command, array('time_limit' => 10)));
     echo "{$command} OK";
     JFactory::getApplication()->close();
 }
예제 #10
0
	/**
	 * Is this feature enabled?
	 *
	 * @return bool
	 */
	public function isEnabled()
	{
		// We only use this feature in the front-end
		if (F0FPlatform::getInstance()->isBackend())
		{
			return false;
		}

		// The feature must be enabled
		if ($this->cparams->getValue('linkmigration', 0) != 1)
		{
			return false;
		}

		// Populate the old domains array
		$this->populateOldDomains();

		// If there are no old domains to migrate from, what exactly am I doing here?
		if (empty($this->oldDomains))
		{
			return false;
		}

		return true;
	}
예제 #11
0
 /**
  * Is this feature enabled?
  *
  * @return bool
  */
 public function isEnabled()
 {
     if (!F0FPlatform::getInstance()->isBackend()) {
         return false;
     }
     $password = $this->cparams->getValue('adminpw', '');
     return !empty($password);
 }
예제 #12
0
 /**
  * A method for getting the form from the model.
  *
  * @param   array    $data      Data for the form.
  * @param   boolean  $loadData  True if the form is to load its own data (default case), false if not.
  * @param   boolean  $source    The name of the form. If not set we'll try the form_name state variable or fall back to default.
  *
  * @return  mixed  A F0FForm object on success, false on failure
  */
 public function getForm($data = array(), $loadData = true, $source = null)
 {
     $f0fPlatform = F0FPlatform::getInstance();
     $isFrontend = $f0fPlatform->isFrontend();
     $this->input->set('option', 'com_content');
     $this->input->set('view', $isFrontend ? 'form' : 'article');
     return parent::getForm($data, $loadData, $source);
 }
예제 #13
0
파일: tag.php 프로젝트: kidaa30/lojinha
 /**
  * Method to get a list of tags
  *
  * @return  array  The field option objects.
  *
  * @since   3.1
  */
 protected function getOptions()
 {
     $options = array();
     $published = $this->element['published'] ? $this->element['published'] : array(0, 1);
     $db = F0FPlatform::getInstance()->getDbo();
     $query = $db->getQuery(true)->select('a.id AS value, a.path, a.title AS text, a.level, a.published')->from('#__tags AS a')->join('LEFT', $db->quoteName('#__tags') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt');
     if ($this->item instanceof F0FTable) {
         $item = $this->item;
     } else {
         $item = $this->form->getModel()->getItem();
     }
     if ($item instanceof F0FTable) {
         // Fake value for selected tags
         $keyfield = $item->getKeyName();
         $content_id = $item->{$keyfield};
         $type = $item->getContentType();
         $selected_query = $db->getQuery(true);
         $selected_query->select('tag_id')->from('#__contentitem_tag_map')->where('content_item_id = ' . (int) $content_id)->where('type_alias = ' . $db->quote($type));
         $db->setQuery($selected_query);
         $this->value = $db->loadColumn();
     }
     // Ajax tag only loads assigned values
     if (!$this->isNested()) {
         // Only item assigned values
         $values = (array) $this->value;
         F0FUtilsArray::toInteger($values);
         $query->where('a.id IN (' . implode(',', $values) . ')');
     }
     // Filter language
     if (!empty($this->element['language'])) {
         $query->where('a.language = ' . $db->quote($this->element['language']));
     }
     $query->where($db->quoteName('a.alias') . ' <> ' . $db->quote('root'));
     // Filter to only load active items
     // Filter on the published state
     if (is_numeric($published)) {
         $query->where('a.published = ' . (int) $published);
     } elseif (is_array($published)) {
         F0FUtilsArray::toInteger($published);
         $query->where('a.published IN (' . implode(',', $published) . ')');
     }
     $query->group('a.id, a.title, a.level, a.lft, a.rgt, a.parent_id, a.published, a.path')->order('a.lft ASC');
     // Get the options.
     $db->setQuery($query);
     try {
         $options = $db->loadObjectList();
     } catch (RuntimeException $e) {
         return false;
     }
     // Prepare nested data
     if ($this->isNested()) {
         $this->prepareOptionsNested($options);
     } else {
         $options = JHelperTags::convertPathsToNames($options);
     }
     return $options;
 }
예제 #14
0
 /**
  * Is this feature enabled?
  *
  * @return bool
  */
 public function isEnabled()
 {
     if (!F0FPlatform::getInstance()->isBackend()) {
         return false;
     }
     if (!$this->cparams->getValue('awayschedule_from') || !$this->cparams->getValue('awayschedule_to')) {
         return false;
     }
     return true;
 }
예제 #15
0
 /**
  * Is this feature enabled?
  *
  * @return bool
  */
 public function isEnabled()
 {
     if (!F0FPlatform::getInstance()->isFrontend()) {
         return false;
     }
     if ($this->skipFiltering) {
         return false;
     }
     return $this->cparams->getValue('xssshield', 0) == 1;
 }
예제 #16
0
파일: abstract.php 프로젝트: JozefAB/neoacu
 /**
  * Returns a new database query class
  *
  * @param   JDatabaseDriver  $db  The DB driver which will provide us with a query object
  *
  * @return F0FQueryAbstract
  */
 public static function &getNew($db = null)
 {
     F0FPlatform::getInstance()->logDeprecated('F0FQueryAbstract is deprecated. Use JDatabaseQuery instead.');
     if (is_null($db)) {
         $ret = F0FPlatform::getInstance()->getDbo()->getQuery(true);
     } else {
         $ret = $db->getQuery(true);
     }
     return $ret;
 }
예제 #17
0
 /**
  * Is this feature enabled?
  *
  * @return bool
  */
 public function isEnabled()
 {
     if (!F0FPlatform::getInstance()->isFrontend()) {
         return false;
     }
     if ($this->cparams->getValue('nofesalogin', 0) != 1) {
         return false;
     }
     return true;
 }
예제 #18
0
 /**
  * Create objects for the options
  *
  * @return  array  The array of option objects
  */
 protected function getOptions()
 {
     $options = array();
     // Get the field $options
     foreach ($this->element->children() as $option) {
         // Only add <option /> elements.
         if ($option->getName() != 'option') {
             continue;
         }
         // Create a new option object based on the <option /> element.
         $options[] = JHtml::_('select.option', (string) $option['value'], JText::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)), 'value', 'text', (string) $option['disabled'] == 'true');
     }
     // Do we have a class and method source for our options?
     $source_file = empty($this->element['source_file']) ? '' : (string) $this->element['source_file'];
     $source_class = empty($this->element['source_class']) ? '' : (string) $this->element['source_class'];
     $source_method = empty($this->element['source_method']) ? '' : (string) $this->element['source_method'];
     $source_key = empty($this->element['source_key']) ? '*' : (string) $this->element['source_key'];
     $source_value = empty($this->element['source_value']) ? '*' : (string) $this->element['source_value'];
     $source_translate = empty($this->element['source_translate']) ? 'true' : (string) $this->element['source_translate'];
     $source_translate = in_array(strtolower($source_translate), array('true', 'yes', '1', 'on')) ? true : false;
     $source_format = empty($this->element['source_format']) ? '' : (string) $this->element['source_format'];
     if ($source_class && $source_method) {
         // Maybe we have to load a file?
         if (!empty($source_file)) {
             $source_file = F0FTemplateUtils::parsePath($source_file, true);
             if (F0FPlatform::getInstance()->getIntegrationObject('filesystem')->fileExists($source_file)) {
                 include_once $source_file;
             }
         }
         // Make sure the class exists
         if (class_exists($source_class, true)) {
             // ...and so does the option
             if (in_array($source_method, get_class_methods($source_class))) {
                 // Get the data from the class
                 if ($source_format == 'optionsobject') {
                     $options = array_merge($options, $source_class::$source_method());
                 } else {
                     $source_data = $source_class::$source_method();
                     // Loop through the data and prime the $options array
                     foreach ($source_data as $k => $v) {
                         $key = empty($source_key) || $source_key == '*' ? $k : $v[$source_key];
                         $value = empty($source_value) || $source_value == '*' ? $v : $v[$source_value];
                         if ($source_translate) {
                             $value = JText::_($value);
                         }
                         $options[] = JHtml::_('select.option', $key, $value, 'value', 'text');
                     }
                 }
             }
         }
     }
     reset($options);
     return $options;
 }
예제 #19
0
 /**
  * onBeforeDispatch.
  *
  * @return	void
  */
 public function onBeforeDispatch()
 {
     $result = parent::onBeforeDispatch();
     if ($result && !F0FPlatform::getInstance()->isCli()) {
         $view = $this->input->getCmd('view');
         Extly::loadStyle(false, $view != 'composer');
         $document = JFactory::getDocument();
         $document->addStyleSheet(JUri::root() . 'media/com_autotweet/css/style.css?version=' . CAUTOTWEETNG_VERSION);
     }
     return $result;
 }
예제 #20
0
 /**
  * Is this feature enabled?
  *
  * @return bool
  */
 public function isEnabled()
 {
     if (!F0FPlatform::getInstance()->isFrontend()) {
         return false;
     }
     $domains = $this->cparams->getValue('blockedemaildomains', '');
     if (empty($domains)) {
         return false;
     }
     return true;
 }
예제 #21
0
 /**
  * Method to get the list of access levels
  *
  * @return  array	A list of access levels.
  *
  * @since   2.0
  */
 protected function getOptions()
 {
     $db = F0FPlatform::getInstance()->getDbo();
     $query = $db->getQuery(true);
     $query->select('a.id AS value, a.title AS text');
     $query->from('#__viewlevels AS a');
     $query->group('a.id, a.title, a.ordering');
     $query->order('a.ordering ASC');
     $query->order($query->qn('title') . ' ASC');
     // Get the options.
     $db->setQuery($query);
     $options = $db->loadObjectList();
     return $options;
 }
예제 #22
0
 /**
  * whereOwnership
  *
  * @param   object  &$query  Param
  * @param   string  $asset   Param
  *
  * @return  void
  */
 public static function whereOwnership(&$query, $asset = 'com_autotweet')
 {
     $platform = F0FPlatform::getInstance();
     // Not able to edit anything
     if (!$platform->authorise('core.edit', $asset)) {
         // Ok, just owned assets
         // Ups nothing can be edited or browsed
         if ($platform->authorise('core.edit.own', $asset) || !defined('AUTOTWEET_CRONJOB_RUNNING') && !defined('AUTOTWEET_AUTOMATOR_RUNNING')) {
             $db = JFactory::getDbo();
             $owner_id = $platform->getUser()->id;
             $query->where($db->qn('created_by') . ' = ' . $owner_id);
         }
     }
 }
예제 #23
0
 /**
  * Checks if a non logged in user is trying to access the administrator application
  *
  * @param bool $onlySubmit bool Return true only if the form is submitted
  *
  * @return bool
  */
 protected function isAdminAccessAttempt($onlySubmit = false)
 {
     // Not back-end at all. Bail out.
     if (!F0FPlatform::getInstance()->isBackend()) {
         return false;
     }
     // If the user is already logged in we don't have a login attempt
     $user = JFactory::getUser();
     if (!$user->guest) {
         return false;
     }
     $input = JFactory::getApplication()->input;
     $option = $input->getCmd('option', null);
     $task = $input->getCmd('task', null);
     if (!($option == 'com_login' && $task == 'login')) {
         // Back-end login attempt
         if ($onlySubmit) {
             return false;
         }
         return true;
     }
     // Check for malicious direct post without a valid token
     // In this case, we "cheat" by pretending that it is a
     // login attempt we need to filter. If it's a legitimate
     // login request (username & password posted) we stop
     // filtering so as to allow Joomla! to parse the login
     // request.
     JLoader::import('joomla.utiltiites.utility');
     $token = null;
     if (class_exists('JUtility')) {
         if (method_exists('JUtility', 'getToken')) {
             $token = JUtility::getToken();
         }
     }
     if (is_null($token)) {
         $token = JFactory::getSession()->getToken();
     }
     $token = JFactory::getApplication()->input->get($token, false, 'raw');
     if (!$onlySubmit) {
         if ($token === false && method_exists('JSession', 'checkToken')) {
             return !JSession::checkToken('request');
         }
         return $token === false;
     }
     if ($token === false && method_exists('JSession', 'checkToken')) {
         return JSession::checkToken('request');
     }
     return $token !== false;
 }
예제 #24
0
 /**
  * Is this feature enabled?
  *
  * @return bool
  */
 public function isEnabled()
 {
     if (!F0FPlatform::getInstance()->isFrontend()) {
         return false;
     }
     if ($this->cparams->getValue('resetjoomlatfa', 0) != 1) {
         return false;
     }
     $option = $this->input->getCmd('option', 'com_foobar');
     $task = $this->input->getCmd('task', 'default');
     if (!($option == 'com_users' && $task == 'complete')) {
         return false;
     }
     return true;
 }
예제 #25
0
 /**
  * Is this feature enabled?
  *
  * @return bool
  */
 public function isEnabled()
 {
     if ($this->cparams->getValue('trackfailedlogins', 0) == 1) {
         // When track failed logins is enabled we don't send emails through this feature
         return false;
     }
     if (!F0FPlatform::getInstance()->isBackend()) {
         return false;
     }
     $emailonfailedadmin = $this->cparams->getValue('emailonfailedadminlogin', '');
     if (empty($emailonfailedadmin)) {
         return false;
     }
     return true;
 }
예제 #26
0
 /**
  * Is this feature enabled?
  *
  * @return bool
  */
 public function isEnabled()
 {
     if (!F0FPlatform::getInstance()->isFrontend()) {
         return false;
     }
     if ($this->skipFiltering) {
         return false;
     }
     if ($this->cparams->getValue('template', 0) != 1) {
         return false;
     }
     JLoader::import('joomla.filesystem.folder');
     self::$siteTemplates = JFolder::folders(JPATH_SITE . '/templates');
     return true;
 }
예제 #27
0
 /**
  * Is this feature enabled?
  *
  * @return bool
  */
 public function isEnabled()
 {
     if (!F0FPlatform::getInstance()->isBackend()) {
         return false;
     }
     if ($this->isAdminAccessAttempt()) {
         return false;
     }
     $user = JFactory::getUser();
     if ($user->guest) {
         return false;
     }
     $email = $this->cparams->getValue('emailonadminlogin', '');
     return !empty($email);
 }
예제 #28
0
 public function display($cachable = false, $urlparams = array(), $tpl = null)
 {
     $document = F0FPlatform::getInstance()->getDocument();
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     if ($document instanceof JDocument) {
         $viewType = $document->getType();
     } else {
         $viewType = $this->input->getCmd('format', 'html');
     }
     $view = $this->getThisView();
     // Get/Create the model
     if ($model = $this->getThisModel()) {
         // Push the model into the view (as default)
         $view->setModel($model, true);
     }
     // Set the layout
     $view->setLayout(is_null($this->layout) ? 'default' : $this->layout);
     $isLogged = 0;
     if ($user->id) {
         $isLogged = 1;
     }
     $view->assign('logged', $isLogged);
     $order = F0FModel::getTmpInstance('Orders', 'J2StoreModel')->initOrder()->getOrder();
     $items = $order->getItems();
     if (count($items) < 1) {
         $app->enqueueMessage(JText::_('J2STORE_CART_NO_ITEMS'), 'notice');
         $app->redirect(JRoute::_('index.php?option=com_j2store&view=carts'));
     }
     //validate stock
     if ($order->validate_order_stock() == false) {
         $app->redirect(JRoute::_('index.php?option=com_j2store&view=carts'));
     }
     //prepare shipping
     // Checking whether shipping is required
     $showShipping = false;
     if (J2Store::config()->get('show_shipping_address', 0)) {
         $showShipping = true;
     }
     if ($isShippingEnabled = $order->isShippingEnabled()) {
         $showShipping = true;
     }
     $view->assign('showShipping', $showShipping);
     //trigger on before checkout event
     J2Store::plugin()->event('BeforeCheckout', array($order));
     // Display without caching
     $view->display();
 }
예제 #29
0
파일: access.php 프로젝트: esorone/efcpw
 /**
  * The event runs after F0FModel has called F0FTable and retrieved a single
  * item from the database. It is used to apply automatic filters.
  *
  * @param   F0FModel  &$model   The model which was called
  * @param   F0FTable  &$record  The record loaded from the databae
  *
  * @return  void
  */
 public function onAfterGetItem(&$model, &$record)
 {
     if ($record instanceof F0FTable) {
         $fieldName = $record->getColumnAlias('access');
         // Make sure the field actually exists
         if (!in_array($fieldName, $record->getKnownFields())) {
             return;
         }
         // Get the user
         $user = F0FPlatform::getInstance()->getUser();
         // Filter by authorised access levels
         if (!in_array($record->{$fieldName}, $user->getAuthorisedViewLevels())) {
             $record = null;
         }
     }
 }
예제 #30
0
 /**
  * Public constructor
  *
  * @param   array  $config  The configuration array
  */
 public function __construct($config = array())
 {
     // Make sure $config is an array
     if (is_object($config)) {
         $config = (array) $config;
     } elseif (!is_array($config)) {
         $config = array();
     }
     // Get the input
     if (array_key_exists('input', $config)) {
         if ($config['input'] instanceof F0FInput) {
             $this->input = $config['input'];
         } else {
             $this->input = new F0FInput($config['input']);
         }
     } else {
         $this->input = new F0FInput();
     }
     // Set the database object
     if (array_key_exists('dbo', $config)) {
         $this->db = $config['dbo'];
     } else {
         $this->db = F0FPlatform::getInstance()->getDbo();
     }
     // Set the $name/$_name variable
     $component = $this->input->getCmd('option', 'com_foobar');
     if (array_key_exists('option', $config)) {
         $component = $config['option'];
     }
     // Figure out where the XML schema files are stored
     if (array_key_exists('dbinstaller_directory', $config)) {
         $this->xmlDirectory = $config['dbinstaller_directory'];
     } else {
         // Nothing is defined, assume the files are stored in the sql/xml directory inside the component's administrator section
         $directories = F0FPlatform::getInstance()->getComponentBaseDirs($component);
         $this->setXmlDirectory($directories['admin'] . '/sql/xml');
     }
     // Do we have a set of XML files to look for?
     if (array_key_exists('dbinstaller_files', $config)) {
         $files = $config['dbinstaller_files'];
         if (!is_array($files)) {
             $files = explode(',', $files);
         }
         $this->xmlFiles = $files;
     }
 }