Example #1
3
 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 #2
2
 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 #3
1
 /**
  * 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');
     }
 }
 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 #5
1
 private function _getAllEvents()
 {
     $mainframe = JFactory::getApplication();
     $rows = $this->model->getEvents();
     $items = array();
     foreach ($rows as $row) {
         $item = new stdClass();
         $table =& JTable::getInstance('Event', 'CTable');
         $table->bind($row);
         $table->thumbnail = $table->getThumbAvatar();
         $table->avatar = $table->getAvatar();
         $author = CFactory::getUser($table->creator);
         $item->id = $row->id;
         $item->created = $row->created;
         $item->creator = CStringHelper::escape($author->getDisplayname());
         $item->title = $row->title;
         $item->description = CStringHelper::escape($row->description);
         $item->location = CStringHelper::escape($row->location);
         $tiem->startdate = $row->startdate;
         $item->enddate = $row->enddate;
         $item->thumbnail = $table->thumbnail;
         $tiem->avatar = $table->avatar;
         $item->ticket = $row->ticket;
         $item->invited = $row->invitedcount;
         $item->confirmed = $row->confirmedcount;
         $item->declined = $row->declinedcount;
         $item->maybe = $row->maybecount;
         $item->latitude = $row->latitude;
         $item->longitude = $row->longitude;
         $items[] = $item;
     }
     return $items;
 }
 /**
  * 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 #7
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 #8
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 #9
0
 /**
  * Returns multi profiles
  *
  **/
 public function getMultiProfiles()
 {
     $mainframe = JFactory::getApplication();
     static $fields;
     if (isset($fields)) {
         return $fields;
     }
     // Initialize variables
     $db = JFactory::getDBO();
     // Get the limit / limitstart
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest('com_community.multiprofile.limitstart', 'limitstart', 0, 'int');
     // In case limit has been changed, adjust limitstart accordingly
     $limitstart = $limit != 0 ? $limitstart / $limit * $limit : 0;
     // Get the total number of records for pagination
     $query = 'SELECT COUNT(*) FROM ' . $db->quoteName('#__community_profiles');
     $db->setQuery($query);
     $total = $db->loadResult();
     jimport('joomla.html.pagination');
     // Get the pagination object
     $this->_pagination = new JPagination($total, $limitstart, $limit);
     $query = 'SELECT * FROM ' . $db->quoteName('#__community_profiles') . ' ' . 'ORDER BY ' . $db->quoteName('ordering');
     $db->setQuery($query, $this->_pagination->limitstart, $this->_pagination->limit);
     $fields = $db->loadObjectList();
     return $fields;
 }
 /**
  * Method to get the field input markup.
  *
  * @return  string  The field input markup.
  * @since   1.6
  */
 protected function getInput()
 {
     JHtml::_('jquery.framework');
     $itemid = JFactory::getApplication()->input->getInt('id', 0);
     $document = JFactory::getDocument();
     $document->addScript(JUri::root() . 'administrator/components/com_dzproduct/assets/js/customfield.js');
     JText::script('COM_DZPRODUCT_FIELD_CUSTOM_FIELD_ERROR_NO_FIELDS');
     JText::script('COM_DZPRODUCT_FIELD_CUSTOM_FIELD_ERROR_LOAD_FIELDS');
     JText::script('COM_DZPRODUCT_FIELD_CUSTOM_FIELD_BTN_EDIT_GROUP');
     $html = '<div 
                 id="' . $this->id . '" 
                 class="form-horizontal customfield" 
                 data-fieldname="' . $this->fieldname . '" 
                 data-controller="' . $this->element['controller'] . '" 
                 data-itemid="' . $itemid . '">
                 <div class="form-container"></div>
                 <img class="img-loading" src="' . JUri::root() . '/media/system/images/modal/spinner.gif" />
                 <div class="control-group">
                     <div class="controls">
                         <button class="btn btn-primary btn-reload"><span class="icon-refresh"></span>&nbsp;' . JText::_('COM_DZPRODUCT_RELOAD_FIELDS') . '</button>
                     </div>
                 </div>
             </div>';
     return $html;
 }
Example #11
0
 /**
  * Method to auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  *
  * @param   string  $ordering   An optional ordering field.
  * @param   string  $direction  An optional direction (asc|desc).
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function populateState($ordering = null, $direction = null)
 {
     $app = JFactory::getApplication();
     // Adjust the context to support modal layouts.
     if ($layout = $app->input->get('layout')) {
         $this->context .= '.' . $layout;
     }
     $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
     $this->setState('filter.search', $search);
     $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
     $this->setState('filter.access', $access);
     $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
     $this->setState('filter.published', $published);
     $categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id');
     $this->setState('filter.category_id', $categoryId);
     $language = $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', '');
     $this->setState('filter.language', $language);
     // Force a language.
     $forcedLanguage = $app->input->get('forcedLanguage');
     if (!empty($forcedLanguage)) {
         $this->setState('filter.language', $forcedLanguage);
         $this->setState('filter.forcedLanguage', $forcedLanguage);
     }
     $tag = $this->getUserStateFromRequest($this->context . '.filter.tag', 'filter_tag', '');
     $this->setState('filter.tag', $tag);
     // List state information.
     parent::populateState('a.name', 'asc');
 }
Example #12
0
 /**
  * Add the page title and toolbar.
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $checkedOut = !true;
     // Since we don't track these assets at the item level, use the category id.
     JToolbarHelper::title(JText::_('COM_HTRAININGLOGS_MANAGER_H_TR_SESSION'), 'link h_tr_sessions');
     // If not checked out, can save the item.
     if (!$checkedOut || count($user->getAuthorisedCategories('com_htraininglogs', 'core.create'))) {
         JToolbarHelper::apply('h_tr_session.apply');
         JToolbarHelper::save('h_tr_session.save');
     }
     if (!$checkedOut && count($user->getAuthorisedCategories('com_htraininglogs', 'core.create'))) {
         JToolbarHelper::save2new('h_tr_session.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && count($user->getAuthorisedCategories('com_htraininglogs', 'core.create')) > 0) {
         JToolbarHelper::save2copy('h_tr_session.save2copy');
     }
     if (empty($this->item->id)) {
         JToolbarHelper::cancel('h_tr_session.cancel');
     } else {
         if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit')) {
             JToolbarHelper::versions('com_htraininglogs.h_tr_session', $this->item->id);
         }
         JToolbarHelper::cancel('h_tr_session.cancel', 'JTOOLBAR_CLOSE');
     }
     JToolbarHelper::divider();
     JToolbarHelper::help('JHELP_COMPONENTS_H_tr_sessionS_LINKS_EDIT');
 }
Example #13
0
 function tag()
 {
     $doc = JFactory::getDocument();
     $doc->addStyleSheet(ACYMAILING_CSS . 'frontendedition.css?v=' . filemtime(ACYMAILING_MEDIA . 'css' . DS . 'frontendedition.css'));
     JPluginHelper::importPlugin('acymailing');
     $dispatcher = JDispatcher::getInstance();
     $tagsfamilies = $dispatcher->trigger('acymailing_getPluginType');
     $defaultFamily = reset($tagsfamilies);
     $app = JFactory::getApplication();
     $fctplug = $app->getUserStateFromRequest(ACYMAILING_COMPONENT . ".tag", 'fctplug', $defaultFamily->function, 'cmd');
     ob_start();
     $defaultContents = $dispatcher->trigger($fctplug);
     $defaultContent = ob_get_clean();
     $js = 'function insertTag(){if(window.parent.insertTag(window.document.getElementById(\'tagstring\').value)) {acymailing_js.closeBox(true);}}';
     $js .= 'function setTag(tagvalue){window.document.getElementById(\'tagstring\').value = tagvalue;}';
     $js .= 'function showTagButton(){window.document.getElementById(\'insertButton\').style.display = \'inline\'; window.document.getElementById(\'tagstring\').style.display=\'inline\';}';
     $js .= 'function hideTagButton(){}';
     $js .= 'try{window.parent.previousSelection = window.parent.getPreviousSelection(); }catch(err){window.parent.previousSelection=false; }';
     $doc->addScriptDeclaration($js);
     $this->assignRef('fctplug', $fctplug);
     $type = JRequest::getString('type', 'news');
     $this->assignRef('type', $type);
     $this->assignRef('defaultContent', $defaultContent);
     $this->assignRef('tagsfamilies', $tagsfamilies);
     $app = JFactory::getApplication();
     $this->assignRef('app', $app);
     $ctrl = JRequest::getString('ctrl');
     $this->assignRef('ctrl', $ctrl);
 }
Example #14
0
 /**
  * Add the page title and toolbar.
  *
  * @since   1.6
  */
 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'));
     // Built the actions for new and existing records.
     $canDo = JHelperContent::getActions('com_testyourself');
     JToolBarHelper::title(JText::_('COM_TESTYOURSELF_MANAGER_QUESTION'), 'question questions');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolBarHelper::apply('question.apply');
         JToolBarHelper::save('question.save');
     }
     if (!$checkedOut && $canDo->get('core.create')) {
         JToolbarHelper::save2new('question.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolbarHelper::save2copy('question.save2copy');
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('question.cancel');
     } else {
         JToolBarHelper::cancel('question.cancel', 'JTOOLBAR_CLOSE');
     }
 }
Example #15
0
 /**
  * Display the view
  *
  * @return  string  The rendered view.
  *
  * @since   3.2
  */
 public function render()
 {
     $lang = JFactory::getApplication()->getLanguage();
     $lang->load('', JPATH_ADMINISTRATOR, $lang->getTag());
     $lang->load('com_modules', JPATH_ADMINISTRATOR, $lang->getTag());
     return parent::render();
 }
Example #16
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 #17
0
 /**
  * Create toolbar for default layout view
  *
  * @param midxed $params
  */
 private function _makeToolbarDefaultJ2($params = null)
 {
     // add title
     $title = Sh404sefHelperGeneral::makeToolbarTitle(JText::_('COM_SH404SEF_PAGEIDS_MANAGER'), $icon = 'sh404sef', $class = 'sh404sef-toolbar-title');
     JFactory::getApplication()->JComponentTitle = $title;
     // get toolbar object
     $bar = JToolBar::getInstance('toolbar');
     $bar->addButtonPath(JPATH_COMPONENT . '/' . 'classes');
     // add import button
     $params['class'] = 'modaltoolbar';
     $params['size'] = array('x' => 500, 'y' => 400);
     unset($params['onClose']);
     $url = 'index.php?option=com_sh404sef&c=wizard&task=start&tmpl=component&optype=import&opsubject=pageids';
     $bar->appendButton('Shpopuptoolbarbutton', 'import', $url, JText::_('COM_SH404SEF_IMPORT_BUTTON'), $msg = '', $task = 'import', $list = false, $hidemenu = true, $params);
     // add import button
     $params['class'] = 'modaltoolbar';
     $params['size'] = array('x' => 500, 'y' => 380);
     unset($params['onClose']);
     $url = 'index.php?option=com_sh404sef&c=wizard&task=start&tmpl=component&optype=export&opsubject=pageids';
     $bar->appendButton('Shpopuptoolbarbutton', 'export', $url, JText::_('COM_SH404SEF_EXPORT_BUTTON'), $msg = '', $task = 'export', $list = false, $hidemenu = true, $params);
     // separator
     JToolBarHelper::divider();
     // add delete button as an ajax call
     $params['class'] = 'modaltoolbar';
     $params['size'] = array('x' => 500, 'y' => 300);
     unset($params['onClose']);
     $url = 'index.php?option=com_sh404sef&c=pageids&task=confirmdelete&tmpl=component';
     $bar->appendButton('Shpopuptoolbarbutton', 'delete', $url, JText::_('Delete'), $msg = JText::_('VALIDDELETEITEMS', true), $task = 'purgeselected', $list = true, $hidemenu = true, $params);
     // separator
     JToolBarHelper::divider();
 }
Example #18
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;
 }
 /**
  * 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 #20
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();
 }
Example #21
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 #22
0
 /**
  * Setting the toolbar
  */
 public function addToolbar()
 {
     $input = JFactory::getApplication()->input;
     $input->set('hidemainmenu', true);
     $user = JFactory::getUser();
     $userId = $user->id;
     $isNew = $this->item->id == 0;
     JToolbarHelper::title($isNew ? JText::_('COM_HELLOWORLD_MANAGER_HELLOWORLD_NEW') : JText::_('COM_HELLOWORLD_MANAGER_HELLOWORLD_EDIT'));
     if ($isNew) {
         if ($this->canDo->get('core.create')) {
             JToolBarHelper::apply('helloworld.apply', 'JTOOLBAR_APPLY');
             JToolBarHelper::save('helloworld.save', 'JTOOLBAR_SAVE');
             JToolBarHelper::custom('helloworld.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
         }
         JToolBarHelper::cancel('helloworld.cancel', 'JTOOLBAR_CANCEL');
         JToolbarHelper::save('helloworld.save');
         JToolbarHelper::cancel('helloworld.cancel', $isNew ? 'JTOOLBAR_CANCEL' : 'JTOOLBAR_CLOSE');
     } else {
         if ($this->canDo->get('core.edit')) {
             // We can save the new record
             JToolBarHelper::apply('helloworld.apply', 'JTOOLBAR_APPLY');
             JToolBarHelper::save('helloworld.save', 'JTOOLBAR_SAVE');
             // We can save this record, but check the create permission to see
             // if we can return to make a new one.
             if ($this->canDo->get('core.create')) {
                 JToolBarHelper::custom('helloworld.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
             }
         }
         if ($this->canDo->get('core.create')) {
             JToolBarHelper::custom('helloworld.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
         }
         JToolBarHelper::cancel('helloworld.cancel', 'JTOOLBAR_CLOSE');
     }
 }
Example #23
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 #24
0
 function onBeforeRender()
 {
     $app = JFactory::getApplication();
     if ($app->isAdmin()) {
         return;
     }
     $option = $app->input->get('option');
     $view = $app->input->get('view');
     $layout = $app->input->get('layout');
     $ajax = $app->input->get('ajax');
     $blog_selector = $this->params->get('blog_selector', '.blog');
     $featured_selector = $this->params->get('featured_selector', '.blog-featured');
     if ($option == 'com_content' && $view == 'category' && $layout == 'blog') {
         $this->_prepareOutput($blog_selector, $ajax);
         if (!$ajax) {
             $this->_infiniteScroll($blog_selector);
         }
     } else {
         if ($option == 'com_content' && $view == 'featured') {
             $this->_prepareOutput($featured_selector, $ajax);
             if (!$ajax) {
                 $this->_infiniteScroll($featured_selector);
             }
         }
     }
 }
Example #25
0
 /**
  * Method to get shipping rates from the USPS
  *
  * @param string $element
  * @param object $order
  * @return an array of shopping rates
  */
 function onJ2StoreGetShippingRates($element, $order)
 {
     $rates = array();
     //initialise system variables
     $app = JFactory::getApplication();
     $db = JFactory::getDbo();
     // Check if this is the right plugin
     if (!$this->_isMe($element)) {
         return $rates;
     }
     //set the address
     $order->setAddress();
     //get the shipping address
     $address = $order->getShippingAddress();
     $geozone_id = $this->params->get('usps_geozone', 0);
     //get the geozones
     $query = $db->getQuery(true);
     $query->select('gz.*,gzr.*')->from('#__j2store_geozones AS gz')->leftJoin('#__j2store_geozonerules AS gzr ON gzr.geozone_id = gz.geozone_id')->where('gz.geozone_id=' . $geozone_id)->where('gzr.country_id=' . $db->q($address['country_id']) . ' AND (gzr.zone_id=0 OR gzr.zone_id=' . $db->q($address['zone_id']) . ')');
     $db->setQuery($query);
     $grows = $db->loadObjectList();
     if (!$geozone_id) {
         $status = true;
     } elseif ($grows) {
         $status = true;
     } else {
         $status = false;
     }
     if ($status) {
         $rates = $this->getRates($address);
     }
     //print_r($rates);
     return $rates;
 }
Example #26
0
 /**
  * Helper method to return button list.
  *
  * This method returns the array by reference so it can be
  * used to add custom buttons or remove default ones.
  *
  * @param	JRegistry	The module parameters.
  *
  * @return	array	An array of buttons
  * @since	1.6
  */
 public static function &getButtons($params)
 {
     $key = (string) $params;
     if (!isset(self::$buttons[$key])) {
         $context = $params->get('context', 'mod_quickicon');
         if ($context == 'mod_quickicon') {
             // Load mod_quickicon language file in case this method is called before rendering the module
             JFactory::getLanguage()->load('mod_quickicon');
             self::$buttons[$key] = array(array('link' => JRoute::_('index.php?option=com_content&task=article.add'), 'image' => 'header/icon-48-article-add.png', 'text' => JText::_('MOD_QUICKICON_ADD_NEW_ARTICLE'), 'access' => array('core.manage', 'com_content', 'core.create', 'com_content')), array('link' => JRoute::_('index.php?option=com_content'), 'image' => 'header/icon-48-article.png', 'text' => JText::_('MOD_QUICKICON_ARTICLE_MANAGER'), 'access' => array('core.manage', 'com_content')), array('link' => JRoute::_('index.php?option=com_categories&extension=com_content'), 'image' => 'header/icon-48-category.png', 'text' => JText::_('MOD_QUICKICON_CATEGORY_MANAGER'), 'access' => array('core.manage', 'com_content')), array('link' => JRoute::_('index.php?option=com_media'), 'image' => 'header/icon-48-media.png', 'text' => JText::_('MOD_QUICKICON_MEDIA_MANAGER'), 'access' => array('core.manage', 'com_media')), array('link' => JRoute::_('index.php?option=com_menus'), 'image' => 'header/icon-48-menumgr.png', 'text' => JText::_('MOD_QUICKICON_MENU_MANAGER'), 'access' => array('core.manage', 'com_menus')), array('link' => JRoute::_('index.php?option=com_users'), 'image' => 'header/icon-48-user.png', 'text' => JText::_('MOD_QUICKICON_USER_MANAGER'), 'access' => array('core.manage', 'com_users')), array('link' => JRoute::_('index.php?option=com_modules'), 'image' => 'header/icon-48-module.png', 'text' => JText::_('MOD_QUICKICON_MODULE_MANAGER'), 'access' => array('core.manage', 'com_modules')), array('link' => JRoute::_('index.php?option=com_installer'), 'image' => 'header/icon-48-extension.png', 'text' => JText::_('MOD_QUICKICON_EXTENSION_MANAGER'), 'access' => array('core.manage', 'com_installer')), array('link' => JRoute::_('index.php?option=com_languages'), 'image' => 'header/icon-48-language.png', 'text' => JText::_('MOD_QUICKICON_LANGUAGE_MANAGER'), 'access' => array('core.manage', 'com_languages')), array('link' => JRoute::_('index.php?option=com_config'), 'image' => 'header/icon-48-config.png', 'text' => JText::_('MOD_QUICKICON_GLOBAL_CONFIGURATION'), 'access' => array('core.manage', 'com_config', 'core.admin', 'com_config')), array('link' => JRoute::_('index.php?option=com_templates'), 'image' => 'header/icon-48-themes.png', 'text' => JText::_('MOD_QUICKICON_TEMPLATE_MANAGER'), 'access' => array('core.manage', 'com_templates')), array('link' => JRoute::_('index.php?option=com_admin&task=profile.edit&id=' . JFactory::getUser()->id), 'image' => 'header/icon-48-user-profile.png', 'text' => JText::_('MOD_QUICKICON_PROFILE'), 'access' => true));
         } else {
             self::$buttons[$key] = array();
         }
         // Include buttons defined by published quickicon plugins
         JPluginHelper::importPlugin('quickicon');
         $app = JFactory::getApplication();
         $arrays = (array) $app->triggerEvent('onGetIcons', array($context));
         foreach ($arrays as $response) {
             foreach ($response as $icon) {
                 $default = array('link' => null, 'image' => 'header/icon-48-config.png', 'text' => null, 'access' => true);
                 $icon = array_merge($default, $icon);
                 if (!is_null($icon['link']) && !is_null($icon['text'])) {
                     self::$buttons[$key][] = $icon;
                 }
             }
         }
     }
     return self::$buttons[$key];
 }
Example #27
0
 public function preflight($type, $parent)
 {
     if ($type == 'uninstall') {
         return true;
     }
     try {
         $source = $parent->getParent()->getPath('source');
         $jversion = new JVersion();
         if (!$jversion->isCompatible('2.5.5')) {
             throw new Exception('Please upgrade to at least Joomla! 2.5.5 before continuing!');
         }
         if (!file_exists(JPATH_ADMINISTRATOR . '/components/com_rsform/helpers/rsform.php')) {
             throw new Exception('Please install the RSForm! Pro component before continuing.');
         }
         if (!file_exists(JPATH_ADMINISTRATOR . '/components/com_rsform/helpers/version.php')) {
             throw new Exception('Please upgrade RSForm! Pro to at least R45 before continuing!');
         }
         // Copy needed files
         $this->copyFiles($source);
         // Update? Run our SQL file
         if ($type == 'update') {
             $this->runSQL($source, 'install');
         }
     } catch (Exception $e) {
         JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error');
         return false;
     }
     return true;
 }
Example #28
-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 #29
-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);
 }
Example #30
-1
 protected function populateState($ordering = null, $direction = null)
 {
     // Initialise variables.
     $app = JFactory::getApplication();
     $session = JFactory::getSession();
     $jinput = new Jinput();
     // Adjust the context to support modal layouts.
     if ($layout = $jinput->get('layout')) {
         $this->context .= '.' . $layout;
     }
     $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
     $this->setState('filter.search', $search);
     $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published');
     $this->setState('filter.published', $published);
     $fieldtype = $this->getUserStateFromRequest($this->context . '.filter.fieldtype', 'filter_fieldtype', '');
     $this->setState('filter.fieldtype', $fieldtype);
     $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
     $this->setState('filter.access', $access);
     $level = $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level', 0, 'int');
     $this->setState('filter.level', $level);
     $language = $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', '');
     $this->setState('filter.language', $language);
     // List state information.
     parent::populateState('u.ordering', 'asc');
 }