public function display($tpl = null) { // Initialize the view $this->setTitle('Users'); // Set toolbar items for the page MageBridgeToolBarHelper::help('magebridge.users'); JToolBarHelper::custom('export', 'export.png', null, 'Export', false); JToolBarHelper::custom('import', 'import.png', null, 'Import', false); // Initialize common variables $application = JFactory::getApplication(); $option = JRequest::getCmd('option') . '-users'; // Handle the filters $filter_type = $application->getUserStateFromRequest($option . 'filter_type', 'filter_type', '', 'word'); $filter_state = $application->getUserStateFromRequest($option . 'filter_state', 'filter_state', '', 'word'); $filter_order = $application->getUserStateFromRequest($option . 'filter_order', 'filter_order', 'p.ordering', 'cmd'); $filter_order_Dir = $application->getUserStateFromRequest($option . 'filter_order_Dir', 'filter_order_Dir', '', 'word'); // Get data from the model $items = $this->get('Data'); $total = $this->get('Total'); $pagination = $this->get('Pagination'); // Table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // Prepare the items for display if (!empty($items)) { // Get a matching user list from the API $musers = $this->getMagentoUsers($items); foreach ($items as $index => $item) { $item->magento_name = null; $item->magento_id = null; if (!empty($musers)) { foreach ($musers as $muser) { if ($muser['email'] == $item->email) { $item->magento_name = $muser['name']; $item->magento_id = $muser['entity_id']; break; } } } // Make sure demo-users are not seeing any sensitive data if (MageBridgeAclHelper::isDemo() == true) { $censored_values = array('name', 'username', 'email', 'magento_name'); foreach ($censored_values as $censored_value) { $item->{$censored_value} = str_repeat('*', strlen($item->{$censored_value})); } } $item->migrate_link = 'index.php?option=com_magebridge&view=user&task=migrate&cid[]=' . $item->id; $items[$index] = $item; } } $user = JFactory::getUser(); $this->assignRef('user', $user); $this->assignRef('lists', $lists); $this->assignRef('items', $items); $this->assignRef('pagination', $pagination); parent::display($tpl); }
protected function _validate($check_token = true, $check_demo = true) { // Check the token if ($check_token == true && (JRequest::checkToken('post') == false && JRequest::checkToken('get') == false)) { $msg = 'Invalid token'; $link = 'index.php?option=com_magebridge&view=home'; $this->setRedirect($link, $msg); return false; } // Check demo-access if ($check_demo == true && MageBridgeAclHelper::isDemo() == true) { $msg = 'No changes made. You are only allowed read-only access to this demo-site.'; $link = 'index.php?option=com_magebridge&view=home'; $this->setRedirect($link, $msg); return false; } return true; }
public function display($tpl = null) { // Load important variables $application = JFactory::getApplication(); $option = JRequest::getCmd('option') . '-connectors'; $layout = JRequest::getCmd('layout'); // Load the import-layout directly if ($layout == 'import') { return parent::display($tpl); } // Load the tabs jimport('joomla.html.pane'); $activeTab = $application->getUserStateFromRequest($option . '.tab', 'tab', 1, 'int'); $pane = JPane::getInstance('tabs', array('startOffset' => $activeTab)); $this->assignRef('pane', $pane); // Page title if (MagebridgeModelConfig::load('advanced') == 1) { $this->setTitle('Configuration (Advanced Mode)'); } else { $this->setTitle('Configuration (Basic Mode)'); } // Deal with the advanced mode if (MagebridgeModelConfig::load('advanced') == 1) { $mode = 'advanced'; $mode_button = 'Basic'; } else { $mode = 'basic'; $mode_button = 'Advanced'; } // Toolbar options if (MageBridgeAclHelper::isDemo() == false) { JToolBarHelper::custom('export', 'export.png', null, 'Export', false); JToolBarHelper::custom('import', 'import.png', null, 'Import', false); } JToolBarHelper::custom('toggleMode', 'mode.png', 'mode.png', $mode_button, false); if (MageBridgeHelper::isJoomla15() == false) { JToolBarHelper::preferences('com_magebridge'); } MageBridgeToolBarHelper::help('magebridge.configuration'); JToolBarHelper::save(); JToolBarHelper::apply(); JToolBarHelper::cancel(); JToolBarHelper::custom('cache', 'preview.png', 'preview_f2.png', 'Empty cache', false); // Extra scripts MageBridgeTemplateHelper::load('jquery'); JHTML::_('script', 'media/com_magebridge/js/backend-config.js', ''); // Before loading anything, we build the bridge $this->preBuildBridge(); // Load the configuration and check it $config = MagebridgeModelConfig::load(); $this->checkConfig(); // Make sure demo-users are not seeing any sensitive data if (MageBridgeAclHelper::isDemo() == true) { $censored_values = array('license', 'api_user', 'api_key'); foreach ($censored_values as $censored_value) { $config[$censored_value]['value'] = str_repeat('*', strlen($config[$censored_value]['value'])); } } // Generate input fields $fields = array(); $fields['disable_css'] = $this->getFieldDisableCss(); $fields['disable_js_mage'] = $this->getFieldDisableJsMage(); $fields['disable_js_all'] = $this->getFieldDisableJsJoomla(); $fields['website'] = $this->getFieldWebsite(); $fields['customer_group'] = $this->getFieldCustomerGroup(); $fields['usergroup'] = $this->getFieldUsergroup(); $fields['show_help'] = JHTML::_('select.booleanlist', 'show_help', null, $config['show_help']['value']); $fields['encryption'] = JHTML::_('select.booleanlist', 'encryption', null, $config['encryption']['value']); $fields['enable_sso'] = JHTML::_('select.booleanlist', 'enable_sso', null, $config['enable_sso']['value']); $fields['enable_usersync'] = JHTML::_('select.booleanlist', 'enable_usersync', null, $config['enable_usersync']['value']); $fields['username_from_email'] = JHTML::_('select.booleanlist', 'username_from_email', null, $config['username_from_email']['value']); $fields['realname_from_firstlast'] = JHTML::_('select.booleanlist', 'realname_from_firstlast', null, $config['realname_from_firstlast']['value']); $fields['enable_auth_backend'] = JHTML::_('select.booleanlist', 'enable_auth_backend', null, $config['enable_auth_backend']['value']); $fields['enable_auth_frontend'] = JHTML::_('select.booleanlist', 'enable_auth_frontend', null, $config['enable_auth_frontend']['value']); $fields['enable_canonical'] = JHTML::_('select.booleanlist', 'enable_canonical', null, $config['enable_canonical']['value']); $fields['protocol'] = $this->getFieldProtocol(); $fields['method'] = $this->getFieldMethod(); $fields['http_auth'] = JHTML::_('select.booleanlist', 'http_auth', null, $config['http_auth']['value']); $fields['http_authtype'] = $this->getFieldHttpAuthType(); $fields['backend'] = $this->getFieldBackend(); $fields['template'] = $this->getFieldTemplate(); $fields['enforce_ssl'] = $this->getFieldEnforceSSL(); $fields['update_format'] = $this->getFieldUpdateFormat(); $fields['update_method'] = $this->getFieldUpdateMethod(); $fields['debug_log'] = $this->getFieldDebugLog(); $fields['debug_level'] = $this->getFieldDebugLevel(); $fields['mobile_magento_theme'] = $this->getFieldMobileMagentoTheme(); $fields['mobile_joomla_theme'] = $this->getFieldMobileJoomlaTheme(); $fields['merge_js'] = $this->getFieldMergeJs(); $fields['users_website_id'] = $this->getFieldUsersWebsiteId(); $fields['users_group_id'] = $this->getFieldUsersGroupId(); $fields['api_type'] = $this->getFieldApiType(); $fields['api_widgets'] = JHTML::_('select.booleanlist', 'api_widgets', null, $config['api_widgets']['value']); $fields['preload_all_modules'] = JHTML::_('select.booleanlist', 'preload_all_modules', null, $config['preload_all_modules']['value']); $fields['advanced'] = JHTML::_('select.booleanlist', 'advanced', null, $config['advanced']['value']); $fields['use_rootmenu'] = JHTML::_('select.booleanlist', 'use_rootmenu', null, $config['use_rootmenu']['value']); $fields['enforce_rootmenu'] = JHTML::_('select.booleanlist', 'enforce_rootmenu', null, $config['enforce_rootmenu']['value']); $fields['enable_cache'] = JHTML::_('select.booleanlist', 'enable_cache', null, $config['enable_cache']['value']); $fields['enable_content_plugins'] = JHTML::_('select.booleanlist', 'enable_content_plugins', null, $config['enable_content_plugins']['value']); $fields['enable_block_rendering'] = JHTML::_('select.booleanlist', 'enable_block_rendering', null, $config['enable_block_rendering']['value']); $fields['enable_jdoc_tags'] = JHTML::_('select.booleanlist', 'enable_jdoc_tags', null, $config['enable_jdoc_tags']['value']); $fields['disable_default_css'] = JHTML::_('select.booleanlist', 'disable_default_css', null, $config['disable_default_css']['value']); $fields['disable_js_mootools'] = JHTML::_('select.booleanlist', 'disable_js_mootools', null, $config['disable_js_mootools']['value']); $fields['disable_js_footools'] = JHTML::_('select.booleanlist', 'disable_js_footools', null, $config['disable_js_footools']['value']); $fields['disable_js_frototype'] = JHTML::_('select.booleanlist', 'disable_js_frototype', null, $config['disable_js_frototype']['value']); $fields['disable_js_jquery'] = JHTML::_('select.booleanlist', 'disable_js_jquery', null, $config['disable_js_jquery']['value']); $fields['disable_js_prototype'] = JHTML::_('select.booleanlist', 'disable_js_prototype', null, $config['disable_js_prototype']['value']); $fields['use_google_api'] = JHTML::_('select.booleanlist', 'use_google_api', null, $config['use_google_api']['value']); $fields['use_protoaculous'] = JHTML::_('select.booleanlist', 'use_protoaculous', null, $config['use_protoaculous']['value']); $fields['use_protoculous'] = JHTML::_('select.booleanlist', 'use_protoculous', null, $config['use_protoculous']['value']); $fields['offline'] = JHTML::_('select.booleanlist', 'offline', null, $config['offline']['value']); $fields['debug'] = JHTML::_('select.booleanlist', 'debug', null, $config['debug']['value']); $fields['debug_bar'] = JHTML::_('select.booleanlist', 'debug_bar', null, $config['debug_bar']['value']); $fields['debug_console'] = JHTML::_('select.booleanlist', 'debug_console', null, $config['debug_console']['value']); $fields['debug_bar_parts'] = JHTML::_('select.booleanlist', 'debug_bar_parts', null, $config['debug_bar_parts']['value']); $fields['debug_bar_request'] = JHTML::_('select.booleanlist', 'debug_bar_request', null, $config['debug_bar_request']['value']); $fields['debug_bar_store'] = JHTML::_('select.booleanlist', 'debug_bar_store', null, $config['debug_bar_store']['value']); $fields['debug_display_errors'] = JHTML::_('select.booleanlist', 'debug_display_errors', null, $config['debug_display_errors']['value']); $fields['enable_messages'] = JHTML::_('select.booleanlist', 'enable_messages', null, $config['enable_messages']['value']); $fields['enable_notfound'] = JHTML::_('select.booleanlist', 'enable_notfound', null, $config['enable_notfound']['value']); $fields['modify_url'] = JHTML::_('select.booleanlist', 'modify_url', null, $config['modify_url']['value']); $fields['link_to_magento'] = JHTML::_('select.booleanlist', 'link_to_magento', null, $config['link_to_magento']['value']); $fields['spoof_browser'] = JHTML::_('select.booleanlist', 'spoof_browser', null, $config['spoof_browser']['value']); $fields['spoof_headers'] = JHTML::_('select.booleanlist', 'spoof_headers', null, $config['spoof_headers']['value']); $fields['curl_post_as_array'] = JHTML::_('select.booleanlist', 'curl_post_as_array', null, $config['curl_post_as_array']['value']); $fields['backend_feed'] = JHTML::_('select.booleanlist', 'backend_feed', null, $config['backend_feed']['value']); $fields['keep_alive'] = JHTML::_('select.booleanlist', 'keep_alive', null, $config['keep_alive']['value']); $fields['filter_content'] = JHTML::_('select.booleanlist', 'filter_content', null, $config['filter_content']['value']); $this->assignRef('mode', $mode); $this->assignRef('config', $config); $this->assignRef('fields', $fields); parent::display($tpl); }
/** * Method to validate a change-request * * @param boolean $check_token * @param boolean $check_demo * * @return boolean */ protected function _validate($check_token = true, $check_demo = true) { // Check the token if ($check_token == true && (JSession::checkToken('post') == false && JSession::checkToken('get') == false)) { $msg = JText::_('JINVALID_TOKEN'); $link = 'index.php?option=com_magebridge&view=home'; $this->setRedirect($link, $msg); return false; } // Check demo-access if ($check_demo == true && MageBridgeAclHelper::isDemo() == true) { $msg = JText::_('LIB_YIREO_CONTROLLER_DEMO_NO_ACTION'); $link = 'index.php?option=com_magebridge&view=home'; $this->setRedirect($link, $msg); return false; } return true; }