PHP JFactory Examples

PHP JFactory - 30 examples found. These are the top rated real world PHP examples of JFactory extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
1
 function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('COM_REDSOCIALSTREAM_CONFIGURE'), 'configure.png');
     JToolBarHelper::apply();
     JToolBarHelper::cancel('cancel', 'COM_REDSOCIALSTREAM_CLOSE');
     //DEVNOTE: set document title
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_REDSOCIALSTREAM_REDSOCIALSTREAMS'));
     $mainframe = JFactory::getApplication();
     $context = "config";
     $model = $this->getModel('configure');
     $db = JFactory::getDbo();
     $q = "SELECT * FROM #__redsocialstream_settings";
     $db->setQuery($q);
     $this->settingsrows = $db->loadObjectList();
     $typelist = $this->get('type_list_sorted');
     $pagination = $this->get('Pagination');
     //DEVNOTE:give me ordering from request
     $filter_order = $mainframe->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'ordering');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '');
     $this->assignRef('lists', $lists);
     $this->assignRef("typelist", $typelist);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
Example #2
1
 function save()
 {
     $mainframe =& JFactory::getApplication();
     $row =& JTable::getInstance('K2UserGroup', 'Table');
     if (!$row->bind(JRequest::get('post'))) {
         $mainframe->redirect('index.php?option=com_k2&view=userGroups', $row->getError(), 'error');
     }
     if (!$row->check()) {
         $mainframe->redirect('index.php?option=com_k2&view=userGroup&cid=' . $row->id, $row->getError(), 'error');
     }
     if (!$row->store()) {
         $mainframe->redirect('index.php?option=com_k2&view=userGroups', $row->getError(), 'error');
     }
     $cache =& JFactory::getCache('com_k2');
     $cache->clean();
     switch (JRequest::getCmd('task')) {
         case 'apply':
             $msg = JText::_('Changes to User Group saved');
             $link = 'index.php?option=com_k2&view=userGroup&cid=' . $row->id;
             break;
         case 'save':
         default:
             $msg = JText::_('User Group Saved');
             $link = 'index.php?option=com_k2&view=userGroups';
             break;
     }
     $mainframe->redirect($link, $msg);
 }
Example #3
1
 protected function getInput()
 {
     if (!NNFrameworkFunctions::extensionInstalled('virtuemart')) {
         return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>';
     }
     $this->params = $this->element->attributes();
     $this->db = JFactory::getDBO();
     $group = $this->get('group', 'categories');
     $tables = $this->db->getTableList();
     if (!in_array($this->db->getPrefix() . 'virtuemart_' . $group, $tables)) {
         return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>';
     }
     $parameters = NNParameters::getInstance();
     $params = $parameters->getPluginParams('nnframework');
     $this->max_list_count = $params->max_list_count;
     if (!is_array($this->value)) {
         $this->value = explode(',', $this->value);
     }
     $options = $this->{'get' . $group}();
     $size = (int) $this->get('size');
     $multiple = $this->get('multiple');
     if ($group == 'categories') {
         require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
         return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
     }
     $attr = '';
     $attr .= ' size="' . (int) $size . '"';
     $attr .= $multiple ? ' multiple="multiple"' : '';
     return JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
 }
 /**
  * Make sure the slug is unique
  *
  * This function checks if the slug already exists and if so appends a number to the slug to make it unique. The
  * slug will get the form of slug-x.
  *
  * If the slug is empty it returns the current date in the format Y-m-d-H-i-s
  *
  * @return void
  */
 protected function _canonicalizeSlug()
 {
     if (trim(str_replace($this->_separator, '', $this->slug)) == '') {
         $this->slug = JFactory::getDate()->format('Y-m-d-H-i-s');
     }
     parent::_canonicalizeSlug();
 }
 public function delete()
 {
     // Check for request forgeries
     JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
     // Get items to remove from the request.
     $cid = JFactory::getApplication()->input->get('cid', array(), 'array');
     if (!is_array($cid) || count($cid) < 1) {
         JLog::add(JText::_($this->text_prefix . '_NO_ITEM_SELECTED'), JLog::WARNING, 'jerror');
     } else {
         // Get the model.
         $model = $this->getModel();
         // Make sure the item ids are integers
         jimport('joomla.utilities.arrayhelper');
         JArrayHelper::toInteger($cid);
         // Remove the items.
         if ($model->delete($cid)) {
             $this->setMessage(JText::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid)));
         } else {
             $this->setMessage($model->getError());
         }
     }
     $version = new JVersion();
     if ($version->isCompatible('3.0')) {
         // Invoke the postDelete method to allow for the child class to access the model.
         $this->postDeleteHook($model, $cid);
     }
     $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
 }
Example #6
0
 /**
  * Do our custom ACL checks for the back-end views
  *
  * @return boolean
  */
 private function akeebaACLCheck()
 {
     // Get the view
     $view = $this->input->getCmd('view', '');
     // Fetch the privilege to check, or use the default (akeeba.configure)
     // privilege.
     if (array_key_exists($view, self::$viewACLMap)) {
         $privilege = self::$viewACLMap[$view];
     } else {
         $privilege = 'akeeba.configure';
     }
     // If an empty privileve is defined do not do any ACL check
     if (empty($privilege)) {
         return true;
     }
     // Throw an error if we are not allowed access to the view
     if (!JFactory::getUser()->authorise($privilege, 'com_akeeba')) {
         $this->setRedirect('index.php?option=com_akeeba&view=cpanel');
         JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
         $this->redirect();
         return false;
     } else {
         return true;
     }
 }
Example #7
0
 /**
  * Method to get the field input markup for a generic list.
  * Use the multiple attribute to enable multiselect.
  *
  * @return  string  The field input markup.
  *
  * @since   11.1
  */
 protected function getInput()
 {
     $document = JFactory::getDocument();
     $jsPath = JURI::root(true) . '/modules/mod_currentdatetime/js';
     $joomlaVersion = new JVersion();
     if ($joomlaVersion->isCompatible('3')) {
         JHtml::_('jquery.ui', array('core', 'sortable'));
     } else {
         $document->addStyleSheet($jsPath . '/25/css/chosen.min.css');
         $document->addScript($jsPath . '/25/jquery.min.js');
         $document->addScript($jsPath . '/25/jquery-noconflict.js');
         $document->addScript($jsPath . '/25/chosen.jquery.min.js');
         $document->addScript($jsPath . '/25/jquery.ui.core.min.js');
         $document->addScript($jsPath . '/25/jquery.ui.widget.min.js');
         $document->addScript($jsPath . '/25/jquery.ui.mouse.min.js');
         $document->addScript($jsPath . '/25/jquery.ui.sortable.min.js');
     }
     $document->addScript($jsPath . '/jquery-chosen-sortable.min.js');
     $script = 'jQuery(function(){jQuery(".chzn-sortable").chosen().chosenSortable();});';
     $document->addScriptDeclaration($script);
     if (!is_array($this->value)) {
         $this->value = explode(',', $this->value);
     }
     $html = parent::getInput();
     return $html;
 }
Example #8
0
 public function saveOrder($pks = array(), $lft = array())
 {
     JPluginHelper::importPlugin('cck_storage_location');
     if (!count($pks)) {
         return false;
     }
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('a.id, a.pk, a.storage_location, b.id AS type_id')->from('#__cck_core AS a')->join('LEFT', '#__cck_core_types AS b ON b.name = a.cck')->where('a.id IN (' . implode(',', $pks) . ')');
     $db->setQuery($query);
     $results = $db->loadAssocList('id');
     if (!empty($results)) {
         $ids = array();
         $location = null;
         $user = JCck::getUser();
         $user_id = $user->get('id');
         foreach ($pks as $i => $pk) {
             $canEdit = $user->authorise('core.edit', 'com_cck.form.' . $results[$pk]['type_id']);
             $canEditOwn = $user->authorise('core.edit.own', 'com_cck.form.' . $results[$pk]['type_id']);
             // Check Permissions
             if (!($canEdit && $canEditOwn || $canEdit && !$canEditOwn && $results[$pk]['author_id'] != $user_id || $canEditOwn && $results[$pk]['author_id'] == $user_id)) {
                 unset($lft[$i]);
                 continue;
             }
             $ids[] = $results[$pk]['pk'];
             if (null === $location) {
                 $location = $results[$pk]['storage_location'];
             }
         }
         if ($location && count($ids)) {
             return JCck::callFunc_Array('plgCCK_Storage_Location' . $location, 'onCCK_Storage_LocationSaveOrder', array($ids, $lft));
         }
     }
     return false;
 }
 /**
  * Add the page title and toolbar.
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     if (isset($this->item->checked_out)) {
         $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     } else {
         $checkedOut = false;
     }
     $canDo = SomosmaestrosHelper::getActions();
     JToolBarHelper::title(JText::_('COM_SOMOSMAESTROS_TITLE_FORMACION'), 'formacion.png');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolBarHelper::apply('formacion.apply', 'JTOOLBAR_APPLY');
         JToolBarHelper::save('formacion.save', 'JTOOLBAR_SAVE');
     }
     if (!$checkedOut && $canDo->get('core.create')) {
         JToolBarHelper::custom('formacion.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolBarHelper::custom('formacion.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('formacion.cancel', 'JTOOLBAR_CANCEL');
     } else {
         JToolBarHelper::cancel('formacion.cancel', 'JTOOLBAR_CLOSE');
     }
 }
Example #10
0
 /**
  * Add the page title and toolbar.
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     $canDo = SibdietHelper::getActions();
     JToolBarHelper::title(JText::_('COM_SIBDIET_MANAGER_ERRAND'), 'database errands');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolBarHelper::apply('errand.apply');
         JToolBarHelper::save('errand.save');
     }
     if (!$checkedOut && $canDo->get('core.create')) {
         JToolbarHelper::save2new('errand.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolbarHelper::save2copy('errand.save2copy');
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('errand.cancel');
     } else {
         JToolBarHelper::cancel('errand.cancel', 'JTOOLBAR_CLOSE');
     }
 }
 function getObjectOwner($id)
 {
     $db =& JFactory::getDBO();
     $db->setQuery('SELECT created_by, id FROM #__jcp_polls WHERE id = ' . $id);
     $userid = $db->loadResult();
     return $userid;
 }
Example #12
0
 public function delete()
 {
     // Get items to remove from the request and reverse the order to delete child albums first
     $cid = JFactory::getApplication()->input->get('cid', array(), 'array');
     JFactory::getApplication()->input->set('cid', array_reverse($cid));
     parent::delete();
 }
Example #13
0
 /**
  * Constructor.
  *
  * @param   Registry         $options      JOAuth2Client options object
  * @param   JHttp            $http         The HTTP client object
  * @param   JInput           $input        The input object
  * @param   JApplicationWeb  $application  The application object
  *
  * @since   12.3
  */
 public function __construct(Registry $options = null, JHttp $http = null, JInput $input = null, JApplicationWeb $application = null)
 {
     $this->options = isset($options) ? $options : new Registry();
     $this->http = isset($http) ? $http : new JHttp($this->options);
     $this->input = isset($input) ? $input : JFactory::getApplication()->input;
     $this->application = isset($application) ? $application : new JApplicationWeb();
 }
Example #14
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     JRequest::setVar('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     $canDo = NewsfeedsHelper::getActions($this->state->get('filter.category_id'), $this->item->id);
     JToolBarHelper::title(JText::_('COM_NEWSFEEDS_MANAGER_NEWSFEED'), 'newsfeeds.png');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0)) {
         JToolBarHelper::apply('newsfeed.apply', 'JTOOLBAR_APPLY');
         JToolBarHelper::save('newsfeed.save', 'JTOOLBAR_SAVE');
     }
     if (!$checkedOut && count($user->getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0) {
         JToolBarHelper::custom('newsfeed.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolBarHelper::custom('newsfeed.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('newsfeed.cancel', 'JTOOLBAR_CANCEL');
     } else {
         JToolBarHelper::cancel('newsfeed.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolBarHelper::divider();
     JToolBarHelper::help('JHELP_COMPONENTS_NEWSFEEDS_FEEDS_EDIT');
 }
Example #15
0
 /**
  * Method override to check if you can edit an existing record.
  *
  * @param   array   $data  An array of input data.
  * @param   string  $key   The name of the key for the primary key.
  *
  * @return  boolean
  *
  * @since   1.6
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $user = JFactory::getUser();
     $userId = $user->get('id');
     // If we get a deny at the component level, we cannot override here.
     if (!parent::allowEdit($data, $key)) {
         return false;
     }
     // Check general edit permission first.
     if ($user->authorise('core.edit', 'com_content.article.' . $recordId)) {
         return true;
     }
     // Fallback on edit.own.
     // First test if the permission is available.
     if ($user->authorise('core.edit.own', 'com_content.article.' . $recordId)) {
         // Now test the owner is the user.
         $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
         if (empty($ownerId) && $recordId) {
             // Need to do a lookup from the model.
             $record = $this->getModel()->getItem($recordId);
             if (empty($record)) {
                 return false;
             }
             $ownerId = $record->created_by;
         }
         // If the owner matches 'me' then permission is granted.
         if ($ownerId == $userId) {
             return true;
         }
     }
     return false;
 }
Example #16
0
 function display($map, $values, $type = 'discount')
 {
     $id = $type . '_' . $map;
     $js = 'window.hikashop.ready( function(){ updateSubscription(\'' . $id . '\'); });';
     if (!HIKASHOP_PHP5) {
         $doc =& JFactory::getDocument();
     } else {
         $doc = JFactory::getDocument();
     }
     $doc->addScriptDeclaration($js);
     if (empty($values)) {
         $values = 'none';
     }
     $choiceValue = $values == 'none' ? $values : 'special';
     $return = JHTML::_('hikaselect.radiolist', $this->choice, "choice_" . $id, 'onchange="updateSubscription(\'' . $id . '\');"', 'value', 'text', $choiceValue);
     $return .= '<input type="hidden" name="data[' . $type . '][' . $map . ']" id="hidden_' . $id . '" value="' . $values . '"/>';
     $valuesArray = explode(',', $values);
     $listAccess = '<div style="display:none" id="div_' . $id . '"><table>';
     foreach ($this->groups as $oneGroup) {
         $listAccess .= '<tr><td>';
         if (version_compare(JVERSION, '1.6.0', '>=') || !in_array($oneGroup->value, array(29, 30))) {
             $listAccess .= '<input type="radio" onchange="updateSubscription(\'' . $id . '\');" value="' . $oneGroup->value . '" ' . (in_array($oneGroup->value, $valuesArray) ? 'checked' : '') . ' name="special_' . $id . '" id="special_' . $id . '_' . $oneGroup->value . '"/>';
         }
         $listAccess .= '</td><td><label for="special_' . $id . '_' . $oneGroup->value . '">' . $oneGroup->text . '</label></td></tr>';
     }
     $listAccess .= '</table></div>';
     $return .= $listAccess;
     return $return;
 }
Example #17
0
 /**
  * Update method to register message sending events.
  *
  * @access	public
  * @param $args['news_id'] Newsletter identifier refferring to the event.
  * * @param $args['msg_id'] Message identifier refferring to the event.
  * @return  false if something wrong.
  * @since	0.6
  */
 function update(&$args)
 {
     jincimport('utility.servicelocator');
     $servicelocator = ServiceLocator::getInstance();
     $logger = $servicelocator->getLogger();
     if (!isset($args['news_id']) || !isset($args['msg_id'])) {
         return false;
     }
     $news_id = (int) $args['news_id'];
     $msg_id = (int) $args['msg_id'];
     $dbo =& JFactory::getDBO();
     $query = 'UPDATE #__jinc_newsletter SET lastsent = now() ' . 'WHERE id = ' . (int) $news_id;
     $dbo->setQuery($query);
     $logger->debug('SentMsgEvent: executing query: ' . $query);
     if (!$dbo->query()) {
         $logger->error('SentMsgEvent: error updating last newsletter dispatch date');
         return false;
     }
     $query = 'UPDATE #__jinc_message SET datasent = now() ' . 'WHERE id = ' . (int) $msg_id;
     $dbo->setQuery($query);
     $logger->debug('SentMsgEvent: executing query: ' . $query);
     if (!$dbo->query()) {
         $logger->error('SentMsgEvent: error updating last message dispatch date');
         return false;
     }
     return true;
 }
Example #18
0
 /**
  * Check that the user has sufficient permissions, or die in error
  *
  */
 private function _checkPermissions()
 {
     // Is frontend backup enabled?
     $febEnabled = Platform::getInstance()->get_platform_configuration_option('failure_frontend_enable', 0) != 0;
     // Is the Secret Key strong enough?
     $validKey = Platform::getInstance()->get_platform_configuration_option('frontend_secret_word', '');
     if (!\Akeeba\Engine\Util\Complexify::isStrongEnough($validKey, false)) {
         $febEnabled = false;
     }
     if (!$febEnabled) {
         @ob_end_clean();
         echo '403 ' . JText::_('ERROR_NOT_ENABLED');
         flush();
         JFactory::getApplication()->close();
     }
     // Is the key good?
     $key = $this->input->get('key', '', 'none', 2);
     $validKeyTrim = trim($validKey);
     if ($key != $validKey || empty($validKeyTrim)) {
         @ob_end_clean();
         echo '403 ' . JText::_('ERROR_INVALID_KEY');
         flush();
         JFactory::getApplication()->close();
     }
 }
Example #19
0
 protected function getInput()
 {
     JHTML::_('behavior.framework');
     $document =& JFactory::getDocument();
     if (!version_compare(JVERSION, '3.0', 'ge')) {
         $checkJqueryLoaded = false;
         $header = $document->getHeadData();
         foreach ($header['scripts'] as $scriptName => $scriptData) {
             if (substr_count($scriptName, '/jquery')) {
                 $checkJqueryLoaded = true;
             }
         }
         //Add js
         if (!$checkJqueryLoaded) {
             $document->addScript(JURI::root() . $this->element['path'] . 'js/jquery.min.js');
         }
         $document->addScript(JURI::root() . $this->element['path'] . 'js/chosen.jquery.min.js');
         $document->addStyleSheet(JURI::root() . $this->element['path'] . 'css/chosen.css');
     }
     $document->addScript(JURI::root() . $this->element['path'] . 'js/colorpicker/colorpicker.js');
     $document->addScript(JURI::root() . $this->element['path'] . 'js/jquery.lightbox-0.5.min.js');
     $document->addScript(JURI::root() . $this->element['path'] . 'js/btbase64.min.js');
     $document->addScript(JURI::root() . $this->element['path'] . 'js/bt.js');
     $document->addScript(JURI::root() . $this->element['path'] . 'js/script.js');
     //Add css
     $document->addStyleSheet(JURI::root() . $this->element['path'] . 'css/bt.css');
     $document->addStyleSheet(JURI::root() . $this->element['path'] . 'js/colorpicker/colorpicker.css');
     $document->addStyleSheet(JURI::root() . $this->element['path'] . 'css/jquery.lightbox-0.5.css');
     return null;
 }
 /**
  * Method to auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  *
  * @since   1.6
  */
 protected function populateState()
 {
     // Get the application object.
     $params = JFactory::getApplication()->getParams('com_users');
     // Load the parameters.
     $this->setState('params', $params);
 }
Example #21
0
 /**
  * Removes an item.
  *
  * @return  void
  *
  * @since   1.6
  */
 public function delete()
 {
     // Check for request forgeries
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $user = JFactory::getUser();
     $ids = $this->input->get('cid', array(), 'array');
     // Access checks.
     foreach ($ids as $i => $id) {
         if (!$user->authorise('core.delete', 'com_content.article.' . (int) $id)) {
             // Prune items that you can't delete.
             unset($ids[$i]);
             JError::raiseNotice(403, JText::_('JERROR_CORE_DELETE_NOT_PERMITTED'));
         }
     }
     if (empty($ids)) {
         JError::raiseWarning(500, JText::_('JERROR_NO_ITEMS_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         // Remove the items.
         if (!$model->featured($ids, 0)) {
             JError::raiseWarning(500, $model->getError());
         }
     }
     $this->setRedirect('index.php?option=com_content&view=featured');
 }
Example #22
0
 /**
  * Prepares the document
  *
  * @return void
  *
  * @throws Exception
  */
 protected function _prepareDocument()
 {
     $app = JFactory::getApplication();
     $menus = $app->getMenu();
     $title = null;
     // Because the application sets a default page title,
     // we need to get it from the menu item itself
     $menu = $menus->getActive();
     if ($menu) {
         $this->params->def('page_heading', $this->params->get('page_title', $menu->title));
     } else {
         $this->params->def('page_heading', JText::_('COM_AKRECIPES_DEFAULT_PAGE_TITLE'));
     }
     $title = $this->params->get('page_title', '');
     if (empty($title)) {
         $title = $app->get('sitename');
     } elseif ($app->get('sitename_pagetitles', 0) == 1) {
         $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
     } elseif ($app->get('sitename_pagetitles', 0) == 2) {
         $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
     }
     $this->document->setTitle($title);
     if ($this->params->get('menu-meta_description')) {
         $this->document->setDescription($this->params->get('menu-meta_description'));
     }
     if ($this->params->get('menu-meta_keywords')) {
         $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
     }
     if ($this->params->get('robots')) {
         $this->document->setMetadata('robots', $this->params->get('robots'));
     }
 }
Example #23
0
 static function getList(&$params)
 {
     //get database
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('MONTH(created) AS created_month, created, id, title, YEAR(created) AS created_year');
     $query->from('#__content');
     $query->where('state = 2 AND checked_out = 0');
     $query->group('created_year DESC, created_month DESC');
     // Filter by language
     if (JFactory::getApplication()->getLanguageFilter()) {
         $query->where('language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')');
     }
     $db->setQuery($query, 0, intval($params->get('count')));
     $rows = (array) $db->loadObjectList();
     $app = JFactory::getApplication();
     $menu = $app->getMenu();
     $item = $menu->getItems('link', 'index.php?option=com_content&view=archive', true);
     $itemid = isset($item) && !empty($item->id) ? '&Itemid=' . $item->id : '';
     $i = 0;
     $lists = array();
     foreach ($rows as $row) {
         $date = JFactory::getDate($row->created);
         $created_month = $date->format('n');
         $created_year = $date->format('Y');
         $created_year_cal = JHTML::_('date', $row->created, 'Y');
         $month_name_cal = JHTML::_('date', $row->created, 'F');
         $lists[$i] = new stdClass();
         $lists[$i]->link = JRoute::_('index.php?option=com_content&view=archive&year=' . $created_year . '&month=' . $created_month . $itemid);
         $lists[$i]->text = JText::sprintf('MOD_ARTICLES_ARCHIVE_DATE', $month_name_cal, $created_year_cal);
         $i++;
     }
     return $lists;
 }
Example #24
0
 function _save_templateinvite($apply = 0)
 {
     $app = JFactory::getApplication();
     // initialize variables
     $db = JFactory::getDBO();
     //$post = $_POST;
     $post = JFactory::getApplication()->input->getArray(array());
     $row = JTable::getInstance('template_invite');
     $id = JFactory::getApplication()->input->get('id', 0, 'int');
     if (!$row->bind($post)) {
         echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
         exit;
     }
     if (!$row->store()) {
         echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
         exit;
     }
     $msg = JText::_('AUP_TEMPLATESAVED');
     if (!$apply) {
         JControllerLegacy::setRedirect('index.php?option=com_alphauserpoints&task=templateinvite', $msg);
     } else {
         JControllerLegacy::setRedirect('index.php?option=com_alphauserpoints&task=edittemplateinvite&cid[]=' . $id, $msg);
     }
     JControllerLegacy::redirect();
 }
 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  *
  * @since   11.1
  */
 protected function getOptions()
 {
     $options = array();
     $options[] = JHtml::_('select.option', 'id', JText::_('COM_VISFORMS_ID'), 'value', 'text', false);
     $options[] = JHtml::_('select.option', 'created', JText::_('COM_VISFORMS_SUBMISSIONDATE'), 'value', 'text', false);
     $options[] = JHtml::_('select.option', 'ismfd', JText::_('COM_VISFORMS_MODIFIED'), 'value', 'text', false);
     $id = 0;
     //extract form id
     $form = $this->form;
     $link = $form->getValue('link');
     if (isset($link) && $link != "") {
         $parts = array();
         parse_str($link, $parts);
         if (isset($parts['id']) && is_numeric($parts['id'])) {
             $id = $parts['id'];
         }
     }
     // Create options according to visfield settings
     $db = JFactory::getDbo();
     $query = ' SELECT c.id , c.label from #__visfields as c where c.fid=' . $id . ' AND c.published = 1 AND (c.frontdisplay is null or c.frontdisplay = 1 or c.frontdisplay = 2) ' . "and !(c.typefield = 'reset') and !(c.typefield = 'submit') and !(c.typefield = 'image') and !(c.typefield = 'fieldsep') and !(c.typefield = 'hidden')";
     $db->setQuery($query);
     $fields = $db->loadObjectList();
     if ($fields) {
         foreach ($fields as $field) {
             $tmp = JHtml::_('select.option', $field->id, $field->label, 'value', 'text', false);
             // Add the option object to the result set.
             $options[] = $tmp;
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Example #26
0
 static function setMessage($file, $name)
 {
     jimport('joomla.filesystem.file');
     $file = str_replace('\\', '/', $file);
     if (strpos($file, '/administrator') === 0) {
         $file = str_replace('/administrator', JPATH_ADMINISTRATOR, $file);
     } else {
         $file = JPATH_SITE . '/' . $file;
     }
     $file = str_replace('//', '/', $file);
     $file_alt = preg_replace('#(com|mod)_([a-z-_]+\\.)#', '\\2', $file);
     if (!JFile::exists($file) && !JFile::exists($file_alt)) {
         $msg = JText::sprintf('NN_THIS_EXTENSION_NEEDS_THE_MAIN_EXTENSION_TO_FUNCTION', JText::_($name));
         $message_set = 0;
         $messageQueue = JFactory::getApplication()->getMessageQueue();
         foreach ($messageQueue as $queue_message) {
             if ($queue_message['type'] == 'error' && $queue_message['message'] == $msg) {
                 $message_set = 1;
                 break;
             }
         }
         if (!$message_set) {
             JFactory::getApplication()->enqueueMessage($msg, 'error');
         }
     }
 }
Example #27
0
	/**
	 * Add the page title and toolbar.
	 *
	 * @return  void
	 */
	protected function addToolbar()
	{
		
		$canDo = TagnyilvantartasHelper::getActions();
		$user = JFactory::getUser();
		JToolBarHelper::title( JText::_( 'Cimkek' ), 'generic.png' );
		if ($canDo->get('core.create')) {
			JToolBarHelper::addNew('cimkek.add');
		}	
		
		if (($canDo->get('core.edit')))
		{
			JToolBarHelper::editList('cimkek.edit');
		}
		
				
				

		if ($canDo->get('core.delete'))
		{
			JToolbarHelper::deleteList('COM_TAGNYILVANTARTAS_SURE_DELETE', 'cimkeks.delete', 'JACTION_DELETE');
		}
				
		
		JToolBarHelper::preferences('com_tagnyilvantartas', '550');  
		if(!version_compare(JVERSION,'3','<')){		
			JHtmlSidebar::setAction('index.php?option=com_tagnyilvantartas&view=cimkeks');
		}
				
					
	}	
Example #28
0
 /**
  * RETURN PAY HTML FORM
  * */
 function onTP_GetHTML($vars)
 {
     $vars = $this->preFormatingData($vars);
     $plgPaymentEpaydkHelper = new plgPaymentEpaydkHelper();
     // Split the name in first and last name
     $user = JFactory::getUser();
     $nameParts = $user->name;
     // explode(' ', $user->name, 2);
     $firstName = $user->name;
     $lastName = $user->name;
     // Get the base URL without the path
     $rootURL = rtrim(JURI::base(), '/');
     $subpathURL = JURI::base(true);
     if (!empty($subpathURL) && $subpathURL != '/') {
         $rootURL = substr($rootURL, 0, -1 * strlen($subpathURL));
     }
     // Separate URL variable as it cannot be a part of the md5 checksum
     $url = $this->getPaymentURL();
     $data = array('merchant' => $this->getMerchantID(), 'success' => $vars->return, 'cancel' => $vars->cancel_return, 'postback' => $vars->notify_url, 'orderid' => $vars->order_id, 'currency' => strtoupper($vars->currency_code), 'amount' => $vars->amount * 100, 'cardtypes' => implode(',', $this->params->get('cardtypes', array())), 'instantcapture' => '1', 'instantcallback' => '1', 'language' => $this->params->get('language', '0'), 'ordertext' => 'Order id' . ' - [ ' . $vars->order_id . ' ]', 'windowstate' => '3', 'ownreceipt' => '0', 'md5' => $this->params->get('secret', ''));
     if ($this->params->get('md5', 1)) {
         // Security hash - must be compiled from ALL inputs sent
         $data['md5'] = md5(implode('', $data));
     } else {
         $data['md5'] = '';
     }
     $data['actionURL'] = $url;
     // dont make md5
     $data['submiturl'] = $vars->submiturl;
     // Set array as object for compatability
     $data = (object) $data;
     $html = $this->buildLayout($data);
     return $html;
 }
Example #29
-1
 function onLoginUser($user, $options)
 {
     $device = JRequest::getVar('device', '');
     if ($_SERVER['REMOTE_ADDR'] == '174.111.57.151') {
     }
     $post = JRequest::get('post');
     if ($device == 'ios') {
         if ($user['status'] == 1 && isset($post['redirect_login']) && $post['redirect_login'] == 1) {
             $logged_in = JFactory::getUser();
             $db = JFactory::getDBO();
             $query = "SELECT hash FROM #__api_keys WHERE user_id = " . $db->Quote($logged_in->id);
             $db->setQuery($query);
             $apikey = $db->loadResult();
             if (!$apikey) {
                 jimport('joomla.application.component.model');
                 JTable::addIncludePath(JPATH_SITE . '/components/com_api/tables');
                 JModel::addIncludePath(JPATH_SITE . '/components/com_api/models');
                 JLoader::register('ApiModel', JPATH_SITE . '/components/com_api/libraries/model.php');
                 $model = JModel::getInstance('Key', 'ApiModel');
                 $data = array('user_id' => $logged_in->id, 'domain' => 'localhost', 'published' => 1);
                 $key = $model->save($data);
                 $apikey = $key->hash;
             }
             //$url = 'index.php?option=com_api&app=community&resource=user&data=1&key='.$apikey;
             $url = 'hooked://' . $apikey;
             //JFactory::getApplication()->redirect($url);
             header("Location: " . $url);
             exit;
         } else {
             JFactory::getApplication()->redirect($_SERVER['HTTP_REFERER'], JText::_('INCORRECT LOGIN'));
             exit;
         }
     }
     return true;
 }
Example #30
-1
 /**
  * Displays the form
  *
  * @param   string  $tpl  - The tmpl
  *
  * @return  mixed|void
  */
 public function display($tpl = null)
 {
     if (MatukioHelperSettings::getSettings('rss_feed', 1) == 0) {
         JError::raiseError(403, JText::_("ALERTNOTAUTH"));
     }
     $database = JFactory::getDBO();
     $neudatum = MatukioHelperUtilsDate::getCurrentDate();
     $where = array();
     $database->setQuery("SELECT id, access FROM #__categories WHERE extension='" . JFactory::getApplication()->input->get('option') . "'");
     $cats = $database->loadObjectList();
     $allowedcat = array();
     foreach ($cats as $cat) {
         if ($cat->access < 1) {
             $allowedcat[] = $cat->id;
         }
     }
     if (count($allowedcat) > 0) {
         $allowedcat = implode(',', $allowedcat);
         $where[] = "a.catid IN ({$allowedcat})";
     }
     $where[] = "a.published = '1'";
     $where[] = "a.end > '{$neudatum}'";
     $where[] = "a.booked > '{$neudatum}'";
     $database->setQuery("SELECT a.*, r.*, cat.title AS category FROM #__matukio_recurring AS r\r\n\t\t LEFT JOIN #__matukio AS a ON r.event_id = a.id\r\n\t\t LEFT JOIN #__categories AS cat ON cat.id = a.catid" . (count($where) ? "\nWHERE " . implode(' AND ', $where) : "") . "\nORDER BY r.begin ASC" . "\nLIMIT 0, 1000");
     $rows = $database->loadObjectList();
     $this->rows = $rows;
     parent::display($tpl);
 }