/** * Shows the configuration page for this two factor authentication method. * * @param object $otpConfig The two factor auth configuration object * @param integer $user_id The numeric user ID of the user whose form we'll display * * @return boolean|string False if the method is not ours, the HTML of the configuration page otherwise * * @see UsersModelUser::getOtpConfig * @since 3.2 */ public function onUserTwofactorShowConfiguration($otpConfig, $user_id = null) { // Create a new TOTP class with Google Authenticator compatible settings $totp = new FOFEncryptTotp(30, 6, 10); if ($otpConfig->method == $this->methodName) { // This method is already activated. Reuse the same secret key. $secret = $otpConfig->config['code']; } else { // This methods is not activated yet. Create a new secret key. $secret = $totp->generateSecret(); } // These are used by Google Authenticator to tell accounts apart $username = JFactory::getUser($user_id)->username; $hostname = JFactory::getUri()->getHost(); // This is the URL to the QR code for Google Authenticator $url = $totp->getUrl($username, $hostname, $secret); // Is this a new TOTP setup? If so, we'll have to show the code validation field. $new_totp = $otpConfig->method != 'totp'; // Start output buffering @ob_start(); // Include the form.php from a template override. If none is found use the default. $path = FOFPlatform::getInstance()->getTemplateOverridePath('plg_twofactorauth_totp', true); JLoader::import('joomla.filesystem.file'); if (JFile::exists($path . '/form.php')) { include_once $path . '/form.php'; } else { include_once __DIR__ . '/tmpl/form.php'; } // Stop output buffering and get the form contents $html = @ob_get_clean(); // Return the form contents return array('method' => $this->methodName, 'form' => $html); }
function display($tpl = null) { $option = JRequest::getCmd('option'); $mainframe = JFactory::getApplication(); $uri = JFactory::getUri(); // Get data from the model $items = $this->get('Items'); $this->assignRef('items', $items); foreach ($this->items as $item) { $item->count_projectdivisions = 0; $mdlProjectDivisions = JModel::getInstance("divisions", "JoomleagueModel"); $item->count_projectdivisions = $mdlProjectDivisions->getProjectDivisionsCount($item->id); $item->count_projectpositions = 0; $mdlProjectPositions = JModel::getInstance("Projectposition", "JoomleagueModel"); $item->count_projectpositions = $mdlProjectPositions->getProjectPositionsCount($item->id); $item->count_projectreferees = 0; $mdlProjectReferees = JModel::getInstance("Projectreferees", "JoomleagueModel"); $item->count_projectreferees = $mdlProjectReferees->getProjectRefereesCount($item->id); $item->count_projectteams = 0; $mdlProjecteams = JModel::getInstance("Projectteams", "JoomleagueModel"); $item->count_projectteams = $mdlProjecteams->getProjectTeamsCount($item->id); $item->count_matchdays = 0; $mdlRounds = JModel::getInstance("Rounds", "JoomleagueModel"); $item->count_matchdays = $mdlRounds->getRoundsCount($item->id); } $this->addToolbar(); parent::display($tpl); }
function onAfterRoute() { // init vars $app =& JFactory::getApplication(); $uri =& JFactory::getUri(); $option = JRequest::getCmd('option'); $task = JRequest::getCmd('task'); $check = false; $redirect = $uri->toString(); // assign check to true for matching conditions if ($this->params->get('enabled_site_contact', 1) && $app->isSite() && $option == 'com_contact' && $task == 'submit') { $check = true; } if ($this->params->get('enabled_site_registration', 1) && $app->isSite() && $option == 'com_user' && $task == 'register_save') { $redirect = JRoute::_('index.php?option=com_user&view=register'); $check = true; } if ($this->params->get('enabled_administrator_login', 0) && $app->isAdmin() && $option == 'com_login' && $task == 'login') { $check = true; } if ($check) { if (!$this->onCaptchaFormSubmit()) { $app->redirect($redirect); die; } } }
function display($tpl = null) { $option = JRequest::getCmd('option'); $mainframe = JFactory::getApplication(); $uri = JFactory::getUri(); $filter_state = $mainframe->getUserStateFromRequest($option . 'a_filter_state', 'filter_state', '', 'word'); $filter_order = $mainframe->getUserStateFromRequest($option . 'a_filter_order', 'filter_order', 'a.ordering', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . 'a_filter_order_Dir', 'filter_order_Dir', '', 'word'); $search = $mainframe->getUserStateFromRequest($option . 'a_search', 'search', '', 'string'); $search_mode = $mainframe->getUserStateFromRequest($option . 'a_search_mode', 'search_mode', '', 'string'); $search = JString::strtolower($search); $items =& $this->get('Data'); $total =& $this->get('Total'); $pagination =& $this->get('Pagination'); // state filter $lists['state'] = JHtml::_('grid.state', $filter_state); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // search filter $lists['search'] = $search; $lists['search_mode'] = $search_mode; $this->assignRef('user', JFactory::getUser()); $this->assignRef('config', JFactory::getConfig()); $this->assignRef('lists', $lists); $this->assignRef('items', $items); $this->assignRef('pagination', $pagination); $this->assignRef('request_url', $uri->toString()); $this->addToolbar(); parent::display($tpl); }
function display($tpl = null) { $option = JRequest::getCmd('option'); $mainframe = JFactory::getApplication(); $uri = JFactory::getUri(); $filter_league = $mainframe->getUserStateFromRequest($option . '.' . $this->get('identifier') . '.filter_league', 'filter_league', '', 'int'); $filter_sports_type = $mainframe->getUserStateFromRequest($option . '.' . $this->get('identifier') . '.filter_sports_type', 'filter_sports_type', '', 'int'); $filter_season = $mainframe->getUserStateFromRequest($option . '.' . $this->get('identifier') . '.filter_season', 'filter_season', '', 'int'); $filter_state = $mainframe->getUserStateFromRequest($option . '.' . $this->get('identifier') . '.filter_state', 'filter_state', '', 'word'); $filter_order = $mainframe->getUserStateFromRequest($option . '.' . $this->get('identifier') . '.filter_order', 'filter_order', 'p.ordering', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . '.' . $this->get('identifier') . '.filter_order_Dir', 'filter_order_Dir', '', 'word'); $search = $mainframe->getUserStateFromRequest($option . '.' . $this->get('identifier') . '.search', 'search', '', 'string'); $search = JString::strtolower($search); // Get data from the model $items = $this->get('Data'); $total = $this->get('Total'); $pagination = $this->get('Pagination'); $javascript = "onchange=\"\$('adminForm').submit();\""; // state filter $lists['state'] = JHtml::_('grid.state', $filter_state); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // search filter $lists['search'] = $search; //build the html select list for leagues $leagues[] = JHtml::_('select.option', '0', JText::_('COM_JOOMLEAGUE_ADMIN_PROJECTS_LEAGUES_FILTER'), 'id', 'name'); $mdlLeagues = JModel::getInstance('Leagues', 'JoomleagueModel'); $allLeagues = $mdlLeagues->getLeagues(); $leagues = array_merge($leagues, $allLeagues); $lists['leagues'] = JHtml::_('select.genericList', $leagues, 'filter_league', 'class="inputbox" onChange="this.form.submit();" style="width:120px"', 'id', 'name', $filter_league); unset($leagues); //build the html select list for sportstypes $sportstypes[] = JHtml::_('select.option', '0', JText::_('COM_JOOMLEAGUE_ADMIN_PROJECTS_SPORTSTYPE_FILTER'), 'id', 'name'); $mdlSportsTypes = JModel::getInstance('SportsTypes', 'JoomleagueModel'); $allSportstypes = $mdlSportsTypes->getSportsTypes(); $sportstypes = array_merge($sportstypes, $allSportstypes); $lists['sportstypes'] = JHtml::_('select.genericList', $sportstypes, 'filter_sports_type', 'class="inputbox" onChange="this.form.submit();" style="width:120px"', 'id', 'name', $filter_sports_type); unset($sportstypes); //build the html select list for seasons $seasons[] = JHtml::_('select.option', '0', JText::_('COM_JOOMLEAGUE_ADMIN_PROJECTS_SEASON_FILTER'), 'id', 'name'); if ($res = $this->get('Seasons')) { $seasons = array_merge($seasons, $res); } $lists['seasons'] = JHtml::_('select.genericList', $seasons, 'filter_season', 'class="inputbox" onChange="this.form.submit();" style="width:120px"', 'id', 'name', $filter_season); unset($seasons); $user = JFactory::getUser(); $this->assignRef('user', $user); $this->assignRef('lists', $lists); $this->assignRef('items', $items); $this->assignRef('pagination', $pagination); $url = $uri->toString(); $this->assignRef('request_url', $url); $this->addToolbar(); parent::display($tpl); }
protected function getInput() { $db = JFactory::getDBO(); $user = JFactory::getUser(JRequest::getInt('cat_user_id')); $section_id = JRequest::getInt('section_id'); $sql = "SELECT id AS value, name AS text FROM `#__js_res_category_user`\n\t\t\t\tWHERE published = 1 AND user_id = {$user->get('id')} AND section_id = {$section_id}\n\t\t\t\tORDER BY ordering"; $db->setQuery($sql); $categories = $db->loadObjectList(); $html = '<div class="form-inline">'; $html .= JHtml::_('select.genericlist', $categories, $this->name, 'class="inputbox"', 'value', 'text', $this->value, $this->id); if ($this->required) { $uri = JFactory::getUri(); $return = base64_encode($uri); $html .= '<a class="btn" href="' . JRoute::_('index.php?option=com_cobalt&view=category§ion_id=' . JRequest::getInt('section_id') . '&task=usercategory.add&return=' . $return) . '"> <img src="' . JURI::root() . 'media/mint/icons/16/plus-button.png" align="absmiddle" alt="' . JText::_('Add New') . '" /> ' . JText::_('Add New') . ' </a></div>'; } return $html; }
/** * Creates the output * * @since 0.5 * @param int $tpl */ function display($tpl = null) { $params = JComponentHelper::getParams('com_redevent'); if (!$params->get('enable_moreinfo', 1)) { echo Jtext::_('COM_REDEVENT_MOREINFO_ERROR_DISABLED_BY_ADMIN'); return; } if ($this->getLayout() == 'final') { return $this->_displayFinal($tpl); } $xref = JRequest::getInt('xref'); $uri =& JFactory::getUri(); $document = JFactory::getDocument(); $user =& Jfactory::getUser(); if (!$xref) { echo JText::_('COM_REDEVENT_MOREINFO_ERROR_MISSING_XREF'); } $document->addStyleSheet($this->baseurl . '/components/com_redevent/assets/css/moreinfo.css'); $this->assign('xref', $xref); $this->assign('action', JRoute::_(RedeventHelperRoute::getMoreInfoRoute($xref))); $this->assignRef('user', $user); parent::display($tpl); }
/** * Collect all data to show on the template * * @author RolandD, Max Milbers */ function display($tpl = null) { $user = JFactory::getUser(); $app = JFactory::getApplication(); if (!$user->id) { $uri = JFactory::getUri(); $current_link = $uri->toString(); $current_link = base64_encode($current_link); $app->redirect('index.php?option=com_virtuemart&view=user&layout=login&return=' . $current_link); return false; } $input = $app->input; $order_id = $input->get('id', 0); $order_mode = tmsModel::getModel('orders'); $orderTable = $order_mode->getTable('orders'); $orderTable->load($order_id); $this->order = $orderTable->getProperties(); $this->order = JArrayHelper::toObject($this->order); $order_data = $this->order->order_data; $this->order_data = json_decode($order_data); require_once JPATH_ROOT . '/libraries/php-loremipsum-master/src/LoremIpsum.php'; $this->lipsum = new joshtronic\LoremIpsum(); parent::display($tpl); }
function display($tpl = null) { $option = JRequest::getCmd('option'); $mainframe = JFactory::getApplication(); $uri = JFactory::getUri(); $filter_sports_type = $mainframe->getUserStateFromRequest($option . '.' . $this->get('identifier') . '.filter_sports_type', 'filter_sports_type', '', 'int'); $filter_state = $mainframe->getUserStateFromRequest($option . '.' . $this->get('identifier') . '.filter_state', 'filter_state', '', 'word'); $filter_order = $mainframe->getUserStateFromRequest($option . '.' . $this->get('identifier') . '.filter_order', 'filter_order', 'obj.ordering', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . '.' . $this->get('identifier') . '.filter_order_Dir', 'filter_order_Dir', '', 'word'); $search = $mainframe->getUserStateFromRequest($option . '.' . $this->get('identifier') . '.search', 'search', '', 'string'); $search = JString::strtolower($search); $items =& $this->get('Data'); $total =& $this->get('Total'); $pagination =& $this->get('Pagination'); // state filter $lists['state'] = JHtml::_('grid.state', $filter_state); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // search filter $lists['search'] = $search; //build the html select list for sportstypes $sportstypes[] = JHtml::_('select.option', '0', JText::_('COM_JOOMLEAGUE_ADMIN_EVENTS_SPORTSTYPE_FILTER'), 'id', 'name'); $allSportstypes =& JoomleagueModelSportsTypes::getSportsTypes(); $sportstypes = array_merge($sportstypes, $allSportstypes); $lists['sportstypes'] = JHtml::_('select.genericList', $sportstypes, 'filter_sports_type', 'class="inputbox" onChange="this.form.submit();" style="width:120px"', 'id', 'name', $filter_sports_type); unset($sportstypes); $this->assignRef('user', JFactory::getUser()); $this->assignRef('config', JFactory::getConfig()); $this->assignRef('lists', $lists); $this->assignRef('items', $items); $this->assignRef('pagination', $pagination); $this->assignRef('request_url', $uri->toString()); $this->addToolbar(); parent::display($tpl); }
} } }).send(); } <?php if ($params->get('preloader', 0) == 1) { ?> window.addEvent('domready',function() { var preloader=new Element('div',{ 'id':'preloader' }); document.getElementsByTagName('body')[0].appendChild(preloader); var img=new Element('img',{ 'src':'<?php echo JFactory::getUri()->base(); ?> plugins/system/onepage/images/loader.gif', 'id':'preloader_img' }); preloader.grab(img); preloader.setStyle('display','none'); }); <?php } ?> function create_preloader() { <?php if ($params->get('preloader', 0) == 1) { ?>
public static function getSocialBookMarkUri($uri = null) { if ($uri === null) { $uri = JFactory::getUri()->toString(); } static $cached_uri = array(); $type = Tienda::getInstance()->get('display_bookmark_uri', 0); switch ($type) { case 0: return $uri; case 1: if (!isset($cached_uri[$type][$uri])) { $key = Tienda::getInstance()->get('bitly_key', ''); $logn = Tienda::getInstance()->get('bitly_login', ''); $link = 'http://api.bit.ly/v3/shorten?apiKey=' . $key . '&login='******'&longURL=' . urlencode($uri); $c = curl_init(); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_URL, $link); $request = curl_exec($c); curl_close($c); $uri_short = json_decode($request)->data->url; $cached_uri[$type][$uri] = $uri_short; } return $cached_uri[$type][$uri]; } }
/** * Preparing template parameters for the template * * @return void */ private function _prepare($loadTemplateCSS, $loadTemplateJS) { $this->_loadTemplateCSS = $loadTemplateCSS; $this->_loadTemplateJS = $loadTemplateJS; $templateParams = isset($this->_document->params) ? $this->_document->params : null; $templateName = isset($this->_document->template) ? $this->_document->template : null; if (empty($templateParams) or empty($templateName) or $templateName == 'system') { $templateDetails = JFactory::getApplication()->getTemplate(true); $templateParams = $templateDetails->params; $templateName = $templateDetails->template; } // Update show content on frontpage parameter $app = JFactory::getApplication(); $menu = $app->getMenu()->getActive(); $lang = JFactory::getLanguage(); $lang->load('plg_system_jsntplframework', JPATH_ADMINISTRATOR); $manifest = JSNTplHelper::getManifest($templateName); $this->_document->app = JFactory::getApplication(); $this->_document->template = $templateName; $this->_document->version = JSNTplHelper::getTemplateVersion($templateName); $this->_document->isFree = !isset($manifest->edition) || $manifest->edition == 'FREE'; $this->_document->uri = JFactory::getUri(); $this->_document->rootUrl = $this->_document->uri->root(true); $this->_document->templateUrl = $this->_document->rootUrl . '/templates/' . $this->_document->template; $columns = array('columnPromoLeft', 'columnPromoRight', 'columnLeft', 'columnRight', 'columnInnerleft', 'columnInnerright'); // Find customizable columns $customColumns = $manifest->xpath('//fieldset[@name="jsn-columns-size"]'); if (count($customColumns) > 0) { $columns = array(); foreach (end($customColumns)->children() as $column) { $columns[] = (string) $column['name']; } } // Add columns to overriable parameter list foreach ($columns as $column) { $className = $column; if (strpos($column, 'column') === 0) { $className = substr($column, 6); } $this->_overrideAttributes[strtolower($className . 'width')] = array('type' => 'integer', 'name' => $column); } // Load template parameters $params = $this->loadParams($templateParams->toArray(), $templateName, true); // Detect browser information $this->_document->browserInfo = JSNTplUtils::getInstance()->getBrowserInfo(); $this->_document->isIE = @$this->_document->browserInfo['browser'] == 'msie'; $this->_document->isIE7 = @$this->_document->browserInfo['browser'] == 'msie' && (int) @$this->_document->browserInfo['version'] == 7; // Custom direction from url parameter $direction = JFactory::getApplication()->input->getCmd('jsn_setdirection', $this->_document->direction); $this->_document->direction = $direction; // Apply custom params $params = $this->_overrideCustomParams($params); $params['showFrontpage'] = is_object($menu) && $menu->home == 1 ? $params['showFrontpage'] == 1 : true; if ($this->_document->isFree === true) { $params['mobileSupport'] = false; $params['useCSS3Effect'] = false; } // Prepare logo parameter if ($params['logoColored']) { $params['logoFile'] = "templates/{$templateName}/images/colors/{$params['templateColor']}/logo.png"; } if ($params['mobileSupport'] == false) { $params['desktopSwitcher'] = false; } if (!preg_match('/^[a-zA-Z]+:\\/\\//i', $params['logoFile'])) { $params['logoFile'] = JUri::root(true) . '/' . $params['logoFile']; } // Prepare color variation to show in site tool if ($params['colorSelector'] and !@count($params['sitetoolsColorsItems'])) { $params['sitetoolsColorsItems'] = $manifest->xpath('//*[@name="sitetoolsColors"]/option'); if (!$params['sitetoolsColorsItems'] or !@count($params['sitetoolsColorsItems'])) { $xml = simplexml_load_file(JSN_PATH_TPLFRAMEWORK . '/libraries/joomlashine/template/params.xml'); $params['sitetoolsColorsItems'] = $xml->xpath('//*[@name="sitetoolsColors"]/option'); } foreach ($params['sitetoolsColorsItems'] as &$color) { $color = (string) $color['value']; } } // Prepare Google Analytics code $params['codeAnalytic'] = trim($params['codeAnalytic']); if (!empty($params['codeAnalytic'])) { if (strpos($params['codeAnalytic'], '<script') === false) { $params['codeAnalytic'] = '<script type="text/javascript">' . $params['codeAnalytic']; } if (strpos($params['codeAnalytic'], '</script>') === false) { $params['codeAnalytic'] = $params['codeAnalytic'] . '</script>'; } } // Binding parameters to document object $this->_document->params = new JRegistry(); foreach ($params as $key => $value) { $this->_document->params->set($key, $value); $this->_document->{$key} = $value; } // Assign helper object $this->_document->helper = $this; $this->_document->attributes = $this->_overrideAttributes; $this->_document->templatePrefix = $this->_document->template . '_'; // Prepare body class $this->_prepareBodyClass(); // Prepare template styles $this->_prepareHead(); }
/** * _forceRelativeUrl * * @param string $site_url Param * * @return string */ private function _forceRelativeUrl($site_url) { $pattern = '//' . JFactory::getUri($this->root_url)->getHost(); // If starts with '//qqq.com', avoid '//qqq.com/qqq' if (JString::strpos($site_url, $pattern) === 0) { $site_url = str_replace($pattern, '', $site_url); } if ($this->hasPath($site_url)) { $path = $this->root_url_path; $l = JString::strlen($path); $site_url = JString::substr($site_url, $l); } // Just in case if (JString::strpos($site_url, '/administrator') === 0) { $site_url = JString::substr($site_url, 14); } // If starts with '//', avoid 'qqq.com///qqq' if (JString::substr($site_url, 0, 2) == '//') { $site_url = JString::substr($site_url, 2); } // If starts with '/', avoid 'qqq.com//qqq' if (JString::substr($site_url, 0, 1) == '/') { $site_url = JString::substr($site_url, 1); } return $site_url; }
function getLists() { $db =& JFactory::getDBO(); $sefConfig = SEFConfig::getConfig(); $std_opt = 'class="inputbox" size="2"'; $lists['enabled'] = $this->booleanRadio('enabled', $std_opt, $sefConfig->enabled); $lists['professionalMode'] = $this->booleanRadio('professionalMode', $std_opt, $sefConfig->professionalMode); $lists['lowerCase'] = $this->booleanRadio('lowerCase', $std_opt, $sefConfig->lowerCase); $lists['disableNewSEF'] = $this->booleanRadio('disableNewSEF', $std_opt, $sefConfig->disableNewSEF); $lists['dontRemoveSid'] = $this->booleanRadio('dontRemoveSid', $std_opt, $sefConfig->dontRemoveSid); $lists['setQueryString'] = $this->booleanRadio('setQueryString', $std_opt, $sefConfig->setQueryString); $lists['parseJoomlaSEO'] = $this->booleanRadio('parseJoomlaSEO', $std_opt, $sefConfig->parseJoomlaSEO); $lists['checkJunkUrls'] = $this->booleanRadio('checkJunkUrls', $std_opt, $sefConfig->checkJunkUrls); $lists['preventNonSefOverwrite'] = $this->booleanRadio('preventNonSefOverwrite', $std_opt, $sefConfig->preventNonSefOverwrite); $basehrefs[] = JHTML::_('select.option', _COM_SEF_BASE_HOMEPAGE, JText::_('COM_SEF_ONLY_BASE_URL')); $basehrefs[] = JHTML::_('select.option', _COM_SEF_BASE_CURRENT, JText::_('COM_SEF_FULL_SEO_URL')); $basehrefs[] = JHTML::_('select.option', _COM_SEF_BASE_NONE, JText::_('COM_SEF_DISABLE_BASE_HREF')); $basehrefs[] = JHTML::_('select.option', _COM_SEF_BASE_IGNORE, JText::_('COM_SEF_LEAVE_ORIGINAL')); $lists['check_base_href'] = JHTML::_('select.genericlist', $basehrefs, 'check_base_href', 'class="inputbox" size="1"', 'value', 'text', $sefConfig->check_base_href); // www and non-www handling $wwws[] = JHTML::_('select.option', _COM_SEF_WWW_NONE, JText::_('COM_SEF_DONT_HANDLE')); $wwws[] = JHTML::_('select.option', _COM_SEF_WWW_USE_WWW, JText::_('COM_SEF_USE_WWW')); $wwws[] = JHTML::_('select.option', _COM_SEF_WWW_USE_NONWWW, JText::_('COM_SEF_USE_NON_WWW')); $lists['wwwHandling'] = JHTML::_('select.genericlist', $wwws, 'wwwHandling', 'class="inputbox" size="1"', 'value', 'text', $sefConfig->wwwHandling); $lists['langEnable'] = $this->booleanRadio('langEnable', $std_opt, $sefConfig->langEnable); $langPlacement = array(); $langPlacement[] = JHTML::_('select.option', _COM_SEF_LANG_PATH, JText::_('COM_SEF_INCLUDE_IN_PATH')); //$langPlacement[] = JHTML::_('select.option', _COM_SEF_LANG_SUFFIX, JText::_('COM_SEF_ADD_AS_SUFFIX')); $langPlacement[] = JHTML::_('select.option', _COM_SEF_LANG_DOMAIN, JText::_('COM_SEF_USE_DIFFERENT_DOMAINS')); $lists['langPlacementJoomla'] = JHTML::_('select.genericlist', $langPlacement, 'langPlacementJoomla', 'class="inputbox" size="1"', 'value', 'text', $sefConfig->langPlacementJoomla); $lists['alwaysUseLangJoomla'] = $this->booleanRadio('alwaysUseLangJoomla', $std_opt, $sefConfig->alwaysUseLangJoomla); $lists['alwaysUseLangHomeJoomla'] = $this->booleanRadio('alwaysUseLangHomeJoomla', $std_opt, $sefConfig->alwaysUseLangHomeJoomla); $lists['addLangMulti'] = $this->booleanRadio('addLangMulti', $std_opt, $sefConfig->addLangMulti); $lists['translateItems'] = $this->booleanRadio('translateItems', $std_opt, $sefConfig->translateItems); $lists['browserLangJoomla'] = $this->booleanRadio('browserLangJoomla', $std_opt, $sefConfig->browserLangJoomla); $lists['langCookieJoomla'] = $this->booleanRadio('langCookieJoomla', $std_opt, $sefConfig->langCookieJoomla); $langs = JLanguageHelper::getLanguages(); $subdomains = array(); $sitemaps = array(); $mainlangs = array(); foreach ($langs as $lang) { $l = new stdClass(); $l->title = $lang->title; $l->sef = $lang->sef; $l->value = isset($sefConfig->subDomainsJoomla[$l->sef]) ? $sefConfig->subDomainsJoomla[$l->sef] : JFactory::getUri()->getHost(); $subdomains[] = $l; $mainlangs[] = JHTML::_('select.option', $lang->sef, $lang->title, 'id', 'title'); $s = new stdClass(); $s->title = $lang->title; $s->sef = $lang->sef; $s->value = isset($sefConfig->multipleSitemapsFilenames[$lang->sef]) ? $sefConfig->multipleSitemapsFilenames[$lang->sef] : 'sitemap_' . $lang->sef; $sitemaps[] = $s; } $lists['mainLanguageJoomla'] = JHTML::_('select.genericlist', $mainlangs, 'mainLanguageJoomla', 'class="inputbox"', 'id', 'title', $sefConfig->mainLanguageJoomla); $lists['subdomainsJoomla'] = $subdomains; $lists['multipleSitemapsFilenames'] = $sitemaps; // Options for automatic VM currency selection according to language if (JFolder::exists(JPATH_ADMINISTRATOR . '/components/com_virtuemart')) { $lists['vm_installed'] = true; $lists['vmCurrencyEnable'] = $this->booleanRadio('vmCurrencyEnable', $std_opt, $sefConfig->vmCurrencyEnable); // Prepare array of available currencies (used modified SQL from mod_virtuemart_currencies) try { $query = "SELECT `vendor_accepted_currencies`, `vendor_currency` FROM `#__virtuemart_vendors` LIMIT 1"; $db->setQuery($query); $vendor_currency = $db->loadAssoc(); } catch (RuntimeException $e) { $vendor_currency = null; } if (!is_array($vendor_currency)) { $lists['vm_installed'] = false; } else { $accepted = trim($vendor_currency['vendor_accepted_currencies']); $currency = trim($vendor_currency['vendor_currency']); $allCurrencies = $accepted; if ($currency) { $allCurrencies .= ($allCurrencies ? ',' : '') . $currency; } try { $query = "SELECT `virtuemart_currency_id` AS `id`, CONCAT_WS(' ', `currency_name`, `currency_symbol`) AS `title`" . " FROM `#__virtuemart_currencies` WHERE `virtuemart_currency_id` IN (" . $allCurrencies . ") AND published = '1' ORDER BY `ordering`, `currency_name`"; $db->setQuery($query); $currencies = $db->loadObjectList(); } catch (RuntimeException $e) { $currencies = null; } if (!is_array($currencies)) { $lists['vm_installed'] = false; } else { $lists['vmCurrency'] = array(); foreach ($langs as $lang) { $obj = new stdClass(); $def = isset($sefConfig->vmCurrency[$lang->sef]) ? $sefConfig->vmCurrency[$lang->sef] : null; $obj->list = JHTML::_('select.genericlist', $currencies, 'vmCurrency[' . $lang->sef . ']', 'class="inputbox"', 'id', 'title', $def); $obj->lang = $lang->title; $lists['vmCurrency'][] = $obj; } } } } else { $lists['vm_installed'] = false; } // Options to handle domain and SEF URL languages mismatch $opts = array(); $opts[] = JHTML::_('select.option', _COM_SEF_WRONG_DOMAIN_REDIRECT, JText::_('COM_SEF_WRONG_DOMAIN_REDIRECT')); $opts[] = JHTML::_('select.option', _COM_SEF_WRONG_DOMAIN_404, JText::_('COM_SEF_WRONG_DOMAIN_SHOW_404')); $opts[] = JHTML::_('select.option', _COM_SEF_WRONG_DOMAIN_DO_NOTHING, JText::_('COM_SEF_WRONG_DOMAIN_DO_NOTHING')); $lists['wrongDomainHandling'] = JHTML::_('select.genericlist', $opts, 'wrongDomainHandling', 'class="inputbox" size="1"', 'value', 'text', $sefConfig->wrongDomainHandling); // Options to handle language and Itemid mismatch $disabled = JPluginHelper::isEnabled('system', 'falangdriver') ? ' disabled="disabled"' : ''; $opts = array(); $opts[] = JHTML::_('select.option', _COM_SEF_MISMATCHED_LANG_DONT_HANDLE, JText::_('COM_SEF_MISMATCHED_LANG_DONT_HANDLE')); $opts[] = JHTML::_('select.option', _COM_SEF_MISMATCHED_LANG_DONT_SEF, JText::_('COM_SEF_MISMATCHED_LANG_DONT_SEF')); $opts[] = JHTML::_('select.option', _COM_SEF_MISMATCHED_LANG_FIX, JText::_('COM_SEF_MISMATCHED_LANG_FIX')); $lists['mismatchedLangHandling'] = JHTML::_('select.genericlist', $opts, 'mismatchedLangHandling', 'class="inputbox" size="1"' . $disabled, 'value', 'text', $sefConfig->mismatchedLangHandling); $lists['record404'] = $this->booleanRadio('record404', $std_opt, $sefConfig->record404); $lists['msg404'] = $this->booleanRadio('showMessageOn404', $std_opt, $sefConfig->showMessageOn404); $lists['use404itemid'] = $this->booleanRadio('use404itemid', $std_opt, $sefConfig->use404itemid); $lists['nonSefRedirect'] = $this->booleanRadio('nonSefRedirect', $std_opt, $sefConfig->nonSefRedirect); $lists['useMoved'] = $this->booleanRadio('useMoved', $std_opt, $sefConfig->useMoved); $lists['useMovedAsk'] = $this->booleanRadio('useMovedAsk', $std_opt, $sefConfig->useMovedAsk); $lists['alwaysUseLang'] = $this->booleanRadio('alwaysUseLang', $std_opt, $sefConfig->alwaysUseLang); $lists['translateNames'] = $this->booleanRadio('translateNames', $std_opt, $sefConfig->translateNames); $lists['contentUseIndex'] = $this->booleanRadio('contentUseIndex', $std_opt, $sefConfig->contentUseIndex); $lists['allowUTF'] = $this->booleanRadio('allowUTF', $std_opt, $sefConfig->allowUTF); $lists['excludeSource'] = $this->booleanRadio('excludeSource', $std_opt, $sefConfig->excludeSource); $lists['reappendSource'] = $this->booleanRadio('reappendSource', $std_opt, $sefConfig->reappendSource); $lists['ignoreSource'] = $this->booleanRadio('ignoreSource', $std_opt, $sefConfig->ignoreSource); $lists['appendNonSef'] = $this->booleanRadio('appendNonSef', $std_opt, $sefConfig->appendNonSef); $lists['transitSlash'] = $this->booleanRadio('transitSlash', $std_opt, $sefConfig->transitSlash); $lists['redirectSlash'] = $this->booleanRadio('redirectSlash', $std_opt, $sefConfig->redirectSlash); $lists['useCache'] = $this->booleanRadio('useCache', $std_opt, $sefConfig->useCache); $lists['numberDuplicates'] = $this->booleanRadio('numberDuplicates', $std_opt, $sefConfig->numberDuplicates); $lists['autoCanonical'] = $this->booleanRadio('autoCanonical', $std_opt, $sefConfig->autoCanonical); $lists['cacheRecordHits'] = $this->booleanRadio('cacheRecordHits', $std_opt, $sefConfig->cacheRecordHits); $lists['cacheShowErr'] = $this->booleanRadio('cacheShowErr', $std_opt, $sefConfig->cacheShowErr); $lists['sefComponentUrls'] = $this->booleanRadio('sefComponentUrls', $std_opt, $sefConfig->sefComponentUrls); $lists['versionChecker'] = $this->booleanRadio('versionChecker', $std_opt, $sefConfig->versionChecker); $lists['artioFeedDisplay'] = $this->booleanRadio('artioFeedDisplay', $std_opt, $sefConfig->artioFeedDisplay); $lists['fixIndexPhp'] = $this->booleanRadio('fixIndexPhp', $std_opt, $sefConfig->fixIndexPhp); $lists['fixDocumentFormat'] = $this->booleanRadio('fixDocumentFormat', $std_opt, $sefConfig->fixDocumentFormat); $lists['nonSefQueryVariables'] = $this->booleanRadio('nonSefQueryVariables', $std_opt, $sefConfig->nonSefQueryVariables); $lists['autolock_urls'] = $this->booleanRadio('autolock_urls', $std_opt, $sefConfig->autolock_urls); $lists['update_urls'] = $this->booleanRadio('update_urls', $std_opt, $sefConfig->update_urls); $lists['rootLangRedirect303'] = $this->booleanRadio('rootLangRedirect303', $std_opt, $sefConfig->rootLangRedirect303); $lists['indexPhpCurrentMenu'] = $this->booleanRadio('indexPhpCurrentMenu', $std_opt, $sefConfig->indexPhpCurrentMenu); $lists['langMenuAssociations'] = $this->booleanRadio('langMenuAssociations', $std_opt, $sefConfig->langMenuAssociations); $lists['homePageHits'] = $this->booleanRadio('homePageHits', $std_opt, $sefConfig->homePageHits); $lists['canonicalsRemove'] = $this->booleanRadio('canonicalsRemove', $std_opt, $sefConfig->canonicalsRemove); $lists['canonicalsFix'] = $this->booleanRadio('canonicalsFix', $std_opt, $sefConfig->canonicalsFix); $lists['cacheSize'] = '<input type="text" name="cacheSize" size="10" class="inputbox" value="' . $sefConfig->cacheSize . '" />'; $lists['cacheMinHits'] = '<input type="text" name="cacheMinHits" size="10" class="inputbox" value="' . $sefConfig->cacheMinHits . '" />'; $lists['junkWords'] = '<input type="text" name="junkWords" size="40" class="inputbox" value="' . $sefConfig->junkWords . '" />'; $lists['junkExclude'] = '<input type="text" name="junkExclude" size="40" class="inputbox" value="' . $sefConfig->junkExclude . '" />'; $lists['tag_generator'] = '<input type="text" name="tag_generator" size="60" class="inputbox" value="' . $sefConfig->tag_generator . '" />'; $lists['tag_googlekey'] = '<input type="text" name="tag_googlekey" size="60" class="inputbox" value="' . $sefConfig->tag_googlekey . '" />'; $lists['tag_livekey'] = '<input type="text" name="tag_livekey" size="60" class="inputbox" value="' . $sefConfig->tag_livekey . '" />'; $lists['tag_yahookey'] = '<input type="text" name="tag_yahookey" size="60" class="inputbox" value="' . $sefConfig->tag_yahookey . '" />'; $lists['artioUserName'] = '******' . $sefConfig->artioUserName . '" />'; $lists['artioPassword'] = '******' . $sefConfig->artioPassword . '" />'; $lists['artioDownloadId'] = '<input type="text" name="artioDownloadId" size="60" class="inputbox" value="' . $sefConfig->artioDownloadId . '" />'; $lists['logErrors'] = $this->booleanRadio('logErrors', $std_opt, $sefConfig->logErrors); $lists['trace'] = $this->booleanRadio('trace', $std_opt, $sefConfig->trace); $lists['traceLevel'] = '<input type="text" name="traceLevel" size="2" class="inputbox" value="' . $sefConfig->traceLevel . '" />'; $useSitenameOpts[] = JHTML::_('select.option', _COM_SEF_SITENAME_BEFORE, JText::_('COM_SEF_BEFORE_PAGE_TITLE')); $useSitenameOpts[] = JHTML::_('select.option', _COM_SEF_SITENAME_AFTER, JText::_('COM_SEF_AFTER_PAGE_TITLE')); $useSitenameOpts[] = JHTML::_('select.option', _COM_SEF_SITENAME_NO, JText::_('COM_SEF_NO')); $lists['use_sitename'] = JHTML::_('select.genericlist', $useSitenameOpts, 'use_sitename', 'class="inputbox" size="1"', 'value', 'text', $sefConfig->use_sitename); // metadata $lists['enable_metadata'] = $this->booleanRadio('enable_metadata', $std_opt, $sefConfig->enable_metadata); $metadataGenerateOpts[] = JHTML::_('select.option', _COM_SEF_META_GEN_EMPTY, JText::_('COM_SEF_ONLY_IF_ORIGINAL_EMPTY')); $metadataGenerateOpts[] = JHTML::_('select.option', _COM_SEF_META_GEN_ALWAYS, JText::_('COM_SEF_ALWAYS')); $metadataGenerateOpts[] = JHTML::_('select.option', _COM_SEF_META_GEN_NEVER, JText::_('COM_SEF_NEVER')); $lists['metadata_auto'] = JHTML::_('select.genericlist', $metadataGenerateOpts, 'metadata_auto', 'class="inputbox" size="1"', 'value', 'text', $sefConfig->metadata_auto); $metadataPriorityOpts[] = JHTML::_('select.option', _COM_SEF_META_PR_ORIGINAL, JText::_('COM_SEF_PREFER_ORIGINAL')); $metadataPriorityOpts[] = JHTML::_('select.option', _COM_SEF_META_PR_JOOMSEF, JText::_('COM_SEF_PREFER_JOOMSEF')); $metadataPriorityOpts[] = JHTML::_('select.option', _COM_SEF_META_PR_JOIN, JText::_('COM_SEF_JOIN_BOTH')); $lists['rewrite_keywords'] = JHTML::_('select.genericlist', $metadataPriorityOpts, 'rewrite_keywords', 'class="inputbox" size="1"', 'value', 'text', $sefConfig->rewrite_keywords); $lists['rewrite_description'] = JHTML::_('select.genericlist', $metadataPriorityOpts, 'rewrite_description', 'class="inputbox" size="1"', 'value', 'text', $sefConfig->rewrite_description); $lists['prefer_joomsef_title'] = $this->booleanRadio('prefer_joomsef_title', $std_opt, $sefConfig->prefer_joomsef_title); $lists['sitename_sep'] = '<input type="text" name="sitename_sep" size="10" class="inputbox" value="' . $sefConfig->sitename_sep . '" />'; //$lists['rewrite_keywords'] = $this->booleanRadio('rewrite_keywords', $std_opt, $sefConfig->rewrite_keywords); //$lists['rewrite_description'] = $this->booleanRadio('rewrite_description', $std_opt, $sefConfig->rewrite_description); $lists['prevent_dupl'] = $this->booleanRadio('prevent_dupl', $std_opt, $sefConfig->prevent_dupl); $aliases[] = JHTML::_('select.option', '0', JText::_('COM_SEF_FULL_TITLE')); $aliases[] = JHTML::_('select.option', '1', JText::_('COM_SEF_TITLE_ALIAS')); $lists['useAlias'] = JHTML::_('select.genericlist', $aliases, 'useAlias', 'class="inputbox" size="1"', 'value', 'text', $sefConfig->useAlias); // get a list of the static content items for 404 page $query = "SELECT id, title" . "\n FROM #__content" . "\n WHERE title != '404'" . "\n AND catid = 0" . "\n ORDER BY ordering"; $db->setQuery($query); $items = $db->loadObjectList(); $options = array(JHTML::_('select.option', _COM_SEF_404_DEFAULT, '(' . JText::_('COM_SEF_CUSTOM_404_PAGE') . ')')); $options[] = JHTML::_('select.option', _COM_SEF_404_FRONTPAGE, '(' . JText::_('COM_SEF_FRONT_PAGE') . ')'); $options[] = JHTML::_('select.option', _COM_SEF_404_JOOMLA, '(' . JText::_('COM_SEF_404_JOOMLA') . ')'); // assemble menu items to the array foreach ($items as $item) { $options[] = JHTML::_('select.option', $item->id, $item->title); } $lists['page404'] = JHTML::_('select.genericlist', $options, 'page404', 'class="inputbox" size="1"', 'value', 'text', $sefConfig->page404); // Get the menu selection list $selections = $this->linkoptions(); $lists['itemid404'] = JHTML::_('select.genericlist', $selections, 'itemid404', 'class="inputbox" size="1"', 'value', 'text', $sefConfig->itemid404); $sql = "SELECT `id`, `introtext` FROM `#__content` WHERE `title` = '404'"; $row = null; $db->setQuery($sql); $row = $db->loadObject(); $lists['txt404'] = isset($row->introtext) ? $row->introtext : JText::_('COM_SEF_ERROR_DEFAULT_404'); $lists["google_email"] = $sefConfig->google_email; $lists["google_password"] = $sefConfig->google_password; $lists["google_id"] = $sefConfig->google_id; $lists["google_apikey"] = $sefConfig->google_apikey; $lists["google_enable"] = $this->booleanRadio('google_enable', $std_opt, $sefConfig->google_enable); $lists["google_demographic_reports"] = $this->booleanRadio('google_demographic_reports', $std_opt, $sefConfig->google_demographic_reports); $lists["google_link_attribution"] = $this->booleanRadio('google_link_attribution', $std_opt, $sefConfig->google_link_attribution); $lists["google_exclude_ip"] = $sefConfig->google_exclude_ip; $lists["google_exclude_level"] = JHTML::_('access.usergroup', 'google_exclude_level[]', $sefConfig->google_exclude_level, 'class="inputbox" multiple="multiple" size="10"', false); foreach ($this->getLangs() as $sef => $lang) { $lists['subdomains_menus'][$sef] = JHTML::_('select.genericlist', $this->_getMenuItems($lang->lang_code), 'subdomain_Itemid'); } $lists['subdomains_remove'] = '<input class="button" type="button" onclick="remove_subdomain(this);" value="' . Jtext::_('COM_SEF_REMOVE_SUBDOMAIN') . '" />'; // Joomla cache info $conf = JFactory::getConfig(); if ($conf->get('caching', '0') != '0') { $state = '<span style="color: green;">' . JText::_('COM_SEF_ENABLED') . '</span>'; } else { $state = '<span style="color: red;">' . JText::_('COM_SEF_DISABLED') . '</span>'; } $lists['cache_info'] = JText::sprintf('COM_SEF_CACHE_INFO', $state); $this->_lists = $lists; return $this->_lists; }
/** * Tests the JFactory::getURI method. * * @return void * * @since 12.1 */ public function testGetUri() { $this->assertInstanceOf('JUri', JFactory::getUri('https://www.joomla.org'), 'Line: ' . __LINE__); }
?> <div id="j-sidebar-container" class="span2"> <?php echo $this->sidebar; ?> </div> <div id="j-main-container" class="span10"> <?php } else { ?> <div id="j-main-container"> <?php } ?> <form action="<?php echo JRoute::_(JFactory::getUri()); ?> " method="post" name="adminForm" id="adminForm" class=""> <div class="page-header"> <h1><?php echo JText::_('COM_MARKETPLACE_TEXT_PURCHASES'); ?> </h1> <div class="input-append"> <input type="text" value="<?php echo $this->escape($this->state->get('filter.search')); ?> " id="filter_search" placeholder="<?php echo JText::_('COM_MARKETPLACE_' . $this->getName() . '_FILTER_SEARCH_DESC'); ?> " name="filter_search" class="input-xxlarge">
/** * Preparing template parameters for the template * * @return void */ private function _prepare($loadTemplateCSS, $loadTemplateJS) { $this->_loadTemplateCSS = $loadTemplateCSS; $this->_loadTemplateJS = $loadTemplateJS; $templateParams = isset($this->_document->params) ? $this->_document->params : null; $templateName = isset($this->_document->template) ? $this->_document->template : null; if (empty($templateParams) or empty($templateName) or $templateName == 'system') { $templateDetails = JFactory::getApplication()->getTemplate(true); $templateParams = $templateDetails->params; $templateName = $templateDetails->template; } // Get template information $this->_template = JSNTplTemplateRecognization::detect($templateName); // Update show content on frontpage parameter $app = JFactory::getApplication(); $menu = $app->getMenu()->getActive(); $lang = JFactory::getLanguage(); $lang->load('plg_system_jsntplframework', JPATH_ADMINISTRATOR); $manifest = JSNTplHelper::getManifest($templateName); $this->_document->app = JFactory::getApplication(); $this->_document->template = $templateName; $this->_document->version = JSNTplHelper::getTemplateVersion($templateName); $this->_document->isFree = empty($manifest->edition) || $manifest->edition == 'FREE'; $this->_document->uri = JFactory::getUri(); $this->_document->rootUrl = $this->_document->uri->root(true); $this->_document->templateUrl = $this->_document->rootUrl . '/templates/' . $this->_document->template; $columns = array('columnPromoLeft', 'columnPromoRight', 'columnLeft', 'columnRight', 'columnInnerleft', 'columnInnerright'); // Find customizable columns $customColumns = $manifest->xpath('//fieldset[@name="jsn-columns-size"]'); if (count($customColumns) > 0) { $columns = array(); foreach (end($customColumns)->children() as $column) { $columns[] = (string) $column['name']; } } // Add columns to overriable parameter list foreach ($columns as $column) { $className = $column; if (strpos($column, 'column') === 0) { $className = substr($column, 6); } $this->_overrideAttributes[strtolower($className . 'width')] = array('type' => 'string', 'name' => $column); } // Load template parameters $params = $this->loadParams($templateParams->toArray(), $templateName, true); // Detect browser information $this->_document->browserInfo = JSNTplUtils::getInstance()->getBrowserInfo(); $this->_document->isIE = @$this->_document->browserInfo['browser'] == 'msie'; $this->_document->isIE7 = @$this->_document->browserInfo['browser'] == 'msie' && (int) @$this->_document->browserInfo['version'] == 7; // Custom direction from url parameter $direction = JFactory::getApplication()->input->getCmd('jsn_setdirection', $this->_document->direction); $this->_document->direction = $direction; // Apply custom params $params = $this->_overrideCustomParams($params); $params['showFrontpage'] = is_object($menu) && $menu->home == 1 ? $params['showFrontpage'] == 1 : true; // Prepare logo parameter if ($params['logoColored']) { $params['logoFile'] = "templates/{$templateName}/images/colors/{$params['templateColor']}/logo.png"; } if (!empty($params['logoFile']) and !preg_match('/^[a-zA-Z]+:\\/\\//i', $params['logoFile'])) { $params['logoFile'] = JUri::root(true) . '/' . $params['logoFile']; } // Prepare color variation to show in site tool if (!isset($params['sitetoolsColorsItems']) and $colorSettings = json_decode($params['sitetoolsColors'])) { if (!count($colorSettings->colors)) { $params['sitetoolsColorsItems'] = array(); } } if ($params['sitetoolsColors'] and !isset($params['sitetoolsColorsItems'])) { $params['sitetoolsColorsItems'] = $manifest->xpath('//*[@name="sitetoolsColors"]/option'); if (!$params['sitetoolsColorsItems'] or !@count($params['sitetoolsColorsItems'])) { $xml = simplexml_load_file(JSN_PATH_TPLFRAMEWORK . '/libraries/joomlashine/template/params.xml'); $params['sitetoolsColorsItems'] = $xml->xpath('//*[@name="sitetoolsColors"]/option'); } if ($params['sitetoolsColorsItems']) { foreach ($params['sitetoolsColorsItems'] as &$color) { $color = (string) $color['value']; } } $params['sitetoolsColorsItems'] != false or $params['sitetoolsColorsItems'] = array(); } $params['colorSelector'] = count($params['sitetoolsColorsItems']) ? true : false; // Check if site tools has tool to show if ($params['sitetoolStyle']) { $visible = count($params['sitetoolsColorsItems']); if (!$visible) { $params['sitetoolStyle'] = false; } } // Prepare Google Analytics code $params['codeAnalytic'] = trim($params['codeAnalytic']); if (!empty($params['codeAnalytic'])) { if (strpos($params['codeAnalytic'], '<script') === false) { $params['codeAnalytic'] = '<script type="text/javascript">' . $params['codeAnalytic']; } if (strpos($params['codeAnalytic'], '</script>') === false) { $params['codeAnalytic'] = $params['codeAnalytic'] . '</script>'; } } // Check if user specified custom width for any column foreach ($columns as $column) { if (isset($params[$column])) { // Re-generate column name $columnName = str_replace('column-', '', strtolower(preg_replace('/([A-Z])/', '-\\1', $column))); foreach (array('promoColumns', 'mainColumns', 'contentColumns') as $row) { foreach ($params[$row] as $id => $class) { // Re-fine ID $realId = preg_replace('/^\\d+:/', '', $id); if (str_replace('-', '', $realId) == str_replace('-', '', $columnName)) { if (strcasecmp(substr($params[$column], 0, 4), 'span') != 0) { // Convert framework v1 value type to compatible with framework v2 $span = round($params[$column] / (100 / 12)); } else { $span = intval(substr($params[$column], 4)); } // Alter current parameter value $currentSpan = intval(substr($class, 4)); if ($currentSpan != $span) { $params[$row][$id] = "span{$span}"; foreach ($params[$row] as $id => $class) { if (preg_match('/(\\d+:)?(promo|content|component)/', $id)) { $params[$row][$id] = 'span' . (intval(substr($class, 4)) + ($currentSpan - $span)); // Done altering break; } } } // Done altering break 2; } } } } } // Process column width if (strcasecmp(get_class($this->_document), 'JDocumentHTML') == 0) { $utils = JSNTplUtils::getInstance(); foreach (array('promoColumns', 'mainColumns', 'contentColumns', 'userColumns') as $row) { $visible = count($params[$row]); $spacing = 0; $columns = array(); foreach ($params[$row] as $id => $class) { // Re-fine ID $realId = preg_replace('/^\\d+:/', '', $id); // Detect the visibility of this column if (!in_array($realId, array('content', 'component')) and !$utils->countModules($realId)) { $visible--; $spacing += intval(str_replace('span', '', $class)); $columns[$id] = 0; } else { $columns[$id] = 1; } } // Expand visible columns if neccessary if ($visible < count($params[$row])) { foreach ($columns as $id => $status) { if (!$status) { // Column is invisible, unset data unset($params[$row][$id]); } elseif ($visible > 0) { // Alter column spanning if (count($columns) > 3) { $params[$row][$id] = preg_replace('/span\\d+/i', 'span' . 12 / $visible, $params[$row][$id]); } elseif ($visible == 1) { $params[$row][$id] = preg_replace('/span\\d+/i', 'span12', $params[$row][$id]); } } } if (count($columns) == 3 and $visible == 2) { // Sort columns to ensure correct source code order ksort($columns); $ordering = array_keys($columns); // Always expand main column if left or right is invisible if ($columns[$ordering[0]] and $row != 'userColumns') { $span = intval(str_replace('span', '', $params[$row][$ordering[0]])); $params[$row][$ordering[0]] = preg_replace('/span\\d+/i', 'span' . ($span + $spacing), $params[$row][$ordering[0]]); } else { foreach ($ordering as $key) { if ($columns[$key]) { $params[$row][$key] = preg_replace('/span\\d+/i', 'span6', $params[$row][$key]); } } } } } // Set visual column ordering $columns = array(); $ordering = 0; foreach ($params[$row] as $id => $class) { // Add class to indicate the order of this column $params[$row][$id] .= ' order' . $ordering++; } // Sort columns for correct source code ordering ksort($params[$row]); foreach ($params[$row] as $id => $class) { // Store data for processing visual ordering later $columns[] = array('id' => $id, 'class' => $class); } // Process visual ordering for visible columns foreach ($columns as $ordering => $column) { $visualOrdering = intval(preg_replace('/^.*order(\\d+).*$/', '\\1', $column['class'])); $offset = 0; if ($ordering < $visualOrdering) { for ($i = $ordering + 1; $i < $visible; $i++) { $nextOrdering = intval(preg_replace('/^.*order(\\d+).*$/', '\\1', $columns[$i]['class'])); if (($ordering == 0 or $nextOrdering > 0) and $nextOrdering < $visualOrdering) { $offset += intval(preg_replace('/^.*span(\\d+).*$/', '\\1', $columns[$i]['class'])); } } } elseif ($ordering > 0 and $ordering == $visualOrdering and $ordering + 1 < $visible) { for ($i = 0; $i < $ordering; $i++) { if (preg_match('/offset\\d+/', $columns[$i]['class'])) { $offset -= intval(preg_replace('/^.*span(\\d+).*$/', '\\1', $columns[$i]['class'])); } } if ($offset < 0) { $offset -= intval(preg_replace('/^.*span(\\d+).*$/', '\\1', $columns[$ordering]['class'])); } } elseif ($ordering > $visualOrdering) { for ($i = 0; $i < $ordering; $i++) { $prevOrdering = intval(preg_replace('/^.*order(\\d+).*$/', '\\1', $columns[$i]['class'])); if ($prevOrdering > $visualOrdering) { if (preg_match('/offset\\d+/', $columns[$i]['class'])) { $offset -= intval(preg_replace('/^.*span(\\d+).*$/', '\\1', $columns[$i]['class'])); $offset -= intval(preg_replace('/^.*offset(\\d+).*$/', '\\1', $columns[$i]['class'])); } elseif (strpos($columns[$i]['class'], 'offset-') === false) { $offset -= intval(preg_replace('/^.*span(\\d+).*$/', '\\1', $columns[$i]['class'])); } } elseif ($i > 0 and $prevOrdering < $visualOrdering) { $offset += intval(preg_replace('/^.*span(\\d+).*$/', '\\1', $columns[$i]['class'])); } } } // Set offset so the column display in correct visual ordering if ($offset != 0) { $columns[$ordering]['class'] = preg_replace('/(order\\d+)/', "\\1 offset{$offset}", $columns[$ordering]['class']); } } // Update column IDs and classes foreach ($columns as $column) { unset($params[$row][$column['id']]); // Re-fine ID $realId = preg_replace('/^\\d+:/', '', $column['id']); // Re-fine column order $ordering = intval(preg_replace('/^.*order(\\d+).*$/', '\\1', $column['class'])) + 1; // Split classes to span, order and offset $classes = explode(' ', preg_replace('/order\\d+/', "order{$ordering}", $column['class'])); // Reset column data $params[$row][$realId] = array('span' => $classes[0], 'order' => isset($classes[1]) ? $classes[1] : '', 'offset' => isset($classes[2]) ? $classes[2] : ''); } } // Prepare social icons $socialIcons = array(); foreach ((array) @$params['socialIcons']['status'] as $channel) { // Set default value if (@empty($params['socialIcons'][$channel]['link']) and in_array($channel, array('facebook', 'twitter', 'youtube'))) { if (!@isset($params['socialIcons'][$channel]['title'])) { $params['socialIcons'][$channel]['title'] = JText::_('JSN_TPLFW_SOCIAL_NETWORK_INTEGRATION_' . strtoupper($channel)); } $params['socialIcons'][$channel]['link'] = "http://www.{$channel}.com/joomlashine"; } if (!@empty($params['socialIcons'][$channel]['link'])) { $socialIcons[$channel] = $params['socialIcons'][$channel]; } } } $params['socialIcons'] = $socialIcons; // Backward compatible: set templateStyle parameter as it still be used in component output only template file $params['templateStyle'] = $params['fontStyle']['style']; // Binding parameters to document object $this->_document->params = new JRegistry(); foreach ($params as $key => $value) { $this->_document->params->set($key, $value); $this->_document->{$key} = $value; } // Assign helper object $this->_document->helper = $this; $this->_document->attributes = $this->_overrideAttributes; $this->_document->templatePrefix = $this->_document->template . '_'; // Prepare body class $this->_prepareBodyClass(); // Prepare template styles $this->_prepareHead(); }
/** * Find existing or create new SEO URL. * * @param array $data * @return string */ function _storeLocation(&$data, $check = false, $removeItemid = false) { $mainframe =& JFactory::getApplication(); $db =& JFactory::getDBO(); $sefConfig =& SEFConfig::getConfig(); $cache =& SEFCache::getInstance(); // Extract variables $defaults = array('uri' => null, 'title' => null, 'task' => null, 'limit' => null, 'limitstart' => null, 'lang' => null, 'nonSefVars' => null, 'ignoreSefVars' => null, 'metadata' => null, 'priority' => null, 'pageHandled' => false, 'host' => false, 'sitemapParams' => null); foreach ($defaults as $varName => $value) { if (is_array($data) && isset($data[$varName])) { ${$varName} = $data[$varName]; } else { ${$varName} = $value; } } // Original object is stored in origUri $origUri = $uri; $uri = clone $origUri; // Get the default priority if not set if (is_null($priority)) { $priority = JoomSEF::_getPriorityDefault($uri); } // Get the parameters for this component if (!is_null($uri->getVar('option'))) { $params =& SEFTools::getExtParams($uri->getVar('option')); } // remove the menu title if set to for this component if (isset($params) && $params->get('showMenuTitle', '1') == '0') { if (count($title) > 1 && (count($title) != 2 || $title[1] != '/') && $title[0] == JoomSEF::_getMenuTitle(@$uri->getVar('option'), null, @$uri->getVar('Itemid'))) { array_shift($title); } } // remove the Itemid if set to if ($removeItemid) { $uri->delVar('Itemid'); } // add the page number if the extension does not handle it if (!$pageHandled && !is_null($uri->getVar('limitstart'))) { $limit = $uri->getVar('limit'); if (is_null($limit)) { if (!is_null($uri->getVar('option'))) { $limit = intval($params->get('pageLimit', '')); if ($limit == 0) { $limit = 5; } } else { $limit = 5; } } $pageNum = intval($uri->getVar('limitstart') / $limit) + 1; $pagetext = strval($pageNum); if ($cnfPageText = $sefConfig->getPageText()) { $pagetext = str_replace('%s', $pageNum, $cnfPageText); } $title[] = $pagetext; } // get all the titles ready for urls. $location = array(); foreach ($title as $titlePart) { if (strlen($titlePart) == 0) { continue; } $location[] = JoomSEF::_titleToLocation($titlePart); } // remove unwanted characters. $finalstrip = explode('|', $sefConfig->stripthese); $takethese = str_replace('|', '', $sefConfig->friendlytrim); if (strstr($takethese, $sefConfig->replacement) === FALSE) { $takethese .= $sefConfig->replacement; } $imptrim = implode('/', $location); if (!is_null($task)) { $task = str_replace($sefConfig->replacement . '-' . $sefConfig->replacement, $sefConfig->replacement, $task); $task = str_replace($finalstrip, '', $task); $task = trim($task, $takethese); } $imptrim = str_replace($sefConfig->replacement . '-' . $sefConfig->replacement, $sefConfig->replacement, $imptrim); $suffixthere = 0; $regexSuffix = str_replace('.', '\\.', $sefConfig->suffix); $pregSuffix = addcslashes($regexSuffix, '/'); //if (eregi($regexSuffix.'$', $imptrim)) { if (preg_match('/' . $pregSuffix . '$/i', $imptrim)) { $suffixthere = strlen($sefConfig->suffix); } $imptrim = str_replace($finalstrip, $sefConfig->replacement, substr($imptrim, 0, strlen($imptrim) - $suffixthere)); $imptrim = str_replace($sefConfig->replacement . $sefConfig->replacement, $sefConfig->replacement, $imptrim); $suffixthere = 0; //if (eregi($regexSuffix.'$', $imptrim)) { if (preg_match('/' . $pregSuffix . '$/i', $imptrim)) { $suffixthere = strlen($sefConfig->suffix); } $imptrim = trim(substr($imptrim, 0, strlen($imptrim) - $suffixthere), $takethese); // add the task if set $imptrim .= !is_null($task) ? '/' . $task . $sefConfig->suffix : ''; // remove all the -/ $imptrim = SEFTools::ReplaceAll($sefConfig->replacement . '/', '/', $imptrim); // remove all the /- $imptrim = SEFTools::ReplaceAll('/' . $sefConfig->replacement, '/', $imptrim); // Remove all the // $location = SEFTools::ReplaceAll('//', '/', $imptrim); // check if the location isn't too long for database storage and truncate it in that case $suffixthere = 0; //if (eregi($regexSuffix.'$', $location)) { if (preg_match('/' . $pregSuffix . '$/i', $location)) { $suffixthere = strlen($sefConfig->suffix); } $suffixLen = strlen($sefConfig->suffix); $maxlen = 240 + $suffixthere - $suffixLen; // Leave some space for language and numbers if (strlen($location) > $maxlen) { // Temporarily remove the suffix //$location = ereg_replace($regexSuffix.'$', '', $location); $location = preg_replace('/' . $pregSuffix . '$/', '', $location); // Explode the location to parts $parts = explode('/', $location); do { // Find the key of the longest part $key = 0; $len = strlen($parts[0]); for ($i = 1, $n = count($parts); $i < $n; $i++) { $tmpLen = strlen($parts[$i]); if ($tmpLen > $len) { $key = $i; $len = $tmpLen; } } // Truncate the longest part $truncBy = strlen($location) - $maxlen; if ($truncBy > 10) { $truncBy = 10; } $parts[$key] = substr($parts[$key], 0, -$truncBy); // Implode to location again $location = implode('/', $parts); // Add suffix if was there if ($suffixthere > 0) { $location .= $sefConfig->suffix; } } while (strlen($location) > $maxlen); } // remove variables we don't want to be included in non-SEF URL // and build the non-SEF part of our SEF URL $nonSefUrl = ''; // load the nonSEF vars from option parameters $paramNonSef = array(); if (isset($params)) { $nsef = $params->get('customNonSef', ''); if (!empty($nsef)) { // Some variables are set, let's explode them $paramNonSef = explode(';', $nsef); } } // get globally configured nonSEF vars $configNonSef = array(); if (!empty($sefConfig->customNonSef)) { $configNonSef = explode(';', $sefConfig->customNonSef); } // combine all the nonSEF vars arrays $nsefvars = array_merge($paramNonSef, $configNonSef); if (!empty($nsefvars)) { foreach ($nsefvars as $nsefvar) { // add each variable, that isn't already set, and that is present in our URL if (!isset($nonSefVars[$nsefvar]) && !is_null($uri->getVar($nsefvar))) { $nonSefVars[$nsefvar] = $uri->getVar($nsefvar); } } } // nonSefVars - variables to exclude only if set to in configuration if ($sefConfig->appendNonSef && isset($nonSefVars)) { $vars = array_keys($nonSefVars); $q = SEFTools::RemoveVariables($uri, $vars); if ($q != '') { if ($nonSefUrl == '') { $nonSefUrl = '?' . $q; } else { $nonSefUrl .= '&' . $q; } } // if $nonSefVars mixes with $GLOBALS['JOOMSEF_NONSEFVARS'], exclude the mixed vars // this is important to prevent duplicating params by adding JOOMSEF_NONSEFVARS to // $ignoreSefVars $gNonSef = JoomSEF::get('sef.global.nonsefvars'); if (!empty($gNonSef)) { foreach (array_keys($gNonSef) as $key) { if (in_array($key, array_keys($nonSefVars))) { unset($gNonSef[$key]); } } JoomSEF::set('sef.global.nonsefvars', $gNonSef); } } // if there are global variables to exclude, add them to ignoreSefVars array $gNonSef = JoomSEF::get('sef.global.nonsefvars'); if (!empty($gNonSef)) { if (!empty($ignoreSefVars)) { $ignoreSefVars = array_merge($gNonSef, $ignoreSefVars); } else { $ignoreSefVars = $gNonSef; } } // ignoreSefVars - variables to exclude allways if (isset($ignoreSefVars)) { $vars = array_keys($ignoreSefVars); $q = SEFTools::RemoveVariables($uri, $vars); if ($q != '') { if ($nonSefUrl == '') { $nonSefUrl = '?' . $q; } else { $nonSefUrl .= '&' . $q; } } } // If the component requests strict accept variables filtering, remove the ones that don't match if (isset($params) && $params->get('acceptStrict', '0') == '1') { $acceptVars =& SEFTools::getExtAcceptVars($uri->getVar('option')); $uriVars = $uri->getQuery(true); if (count($acceptVars) > 0 && count($uriVars) > 0) { foreach ($uriVars as $name => $value) { // Standard Joomla variables if (in_array($name, $sefConfig->globalAcceptVars)) { continue; } // Accepted variables if (in_array($name, $acceptVars)) { continue; } // Variable not accepted, add it to non-SEF part of the URL $value = urlencode($value); if (strlen($nonSefUrl) > 0) { $nonSefUrl .= '&' . $name . '=' . $value; } else { $nonSefUrl = '?' . $name . '=' . $value; } $uri->delVar($name); } } } // always remove Itemid and store it in a separate column if (!is_null($uri->getVar('Itemid'))) { $Itemid = $uri->getVar('Itemid'); $uri->delVar('Itemid'); } // check for non-sef url first and avoid repeative lookups // we only want to look for title variations when adding new // this should also help eliminate duplicates. // David (284): ignore Itemid if set to if (isset($params)) { $extIgnore = $params->get('ignoreSource', 2); } else { $extIgnore = 2; } $ignoreSource = $extIgnore == 2 ? $sefConfig->ignoreSource : $extIgnore; // If Itemid is set as ignored for the component, set ignoreSource to 1 $itemidIgnored = false; if (isset($Itemid) && !is_null($uri->getVar('option'))) { $itemidIgnored = SEFTools::isItemidIgnored($uri->getVar('option'), $Itemid); if ($itemidIgnored) { $ignoreSource = 1; } } $where = ''; if (!$ignoreSource && isset($Itemid)) { $where .= " AND (`Itemid` = '" . $Itemid . "' OR `Itemid` IS NULL)"; } $url = JoomSEF::_uriToUrl($uri); // if cache is activated, search in cache first $realloc = false; if ($sefConfig->useCache) { if (!$check) { $realloc = $cache->GetSefUrl($url, @$Itemid); } } // search if URL exists, if we do not use cache or URL was not cached if (!$sefConfig->useCache || !$realloc) { $query = "SELECT * FROM `#__sefurls` WHERE `origurl` = '" . addslashes(html_entity_decode(urldecode($url))) . "'" . $where . ' LIMIT 2'; $db->setQuery($query); $sefurls = $db->loadObjectList('Itemid'); if (!$ignoreSource && isset($Itemid)) { if (isset($sefurls[$Itemid])) { $realloc = $sefurls[$Itemid]; } else { if (isset($sefurls[''])) { // We've found one of the ignored Itemids, update it with the current and return $realloc = $sefurls['']; $realloc->Itemid = $Itemid; $query = "UPDATE `#__sefurls` SET `Itemid` = '{$Itemid}' WHERE `id` = '{$realloc->id}' LIMIT 1"; $db->setQuery($query); $db->query(); } else { $realloc = reset($sefurls); } } } else { $realloc = reset($sefurls); } /* // removed - causing problems, ignore multiple sources not working correctly // test if current Itemid record exists, if YES, use it, if NO, use first found $curId = isset($Itemid) ? $Itemid : ''; $active = isset($sefurls[$curId]) ? $sefurls[$curId] : reset($sefurls); $realloc = $active; */ } // if not found, try to find the url without lang variable if (!$realloc && $sefConfig->langPlacement == _COM_SEF_LANG_DOMAIN) { $url = JoomSEF::_uriToUrl($uri, 'lang'); if ($sefConfig->useCache) { $realloc = $cache->GetSefUrl($url, @$Itemid); } if (!$sefConfig->useCache || !$realloc) { $query = "SELECT * FROM `#__sefurls` WHERE `origurl` = '" . addslashes(html_entity_decode(urldecode($url))) . "'" . $where . ' LIMIT 2'; $db->setQuery($query); $sefurls = $db->loadObjectList('Itemid'); if (!$ignoreSource && isset($Itemid)) { if (isset($sefurls[$Itemid])) { $realloc = $sefurls[$Itemid]; } else { if (isset($sefurls[''])) { // We've found one of the ignored Itemids, update it with the current and return $realloc = $sefurls['']; $realloc->Itemid = $Itemid; $query = "UPDATE `#__sefurls` SET `Itemid` = '{$Itemid}' WHERE `id` = '{$realloc->id}' LIMIT 1"; $db->setQuery($query); $db->query(); } else { $realloc = reset($sefurls); } } } else { $realloc = reset($sefurls); } /* // removed - causing problems, ignore multiple sources not working correctly // test if current Itemid record exists, if YES, use it, if NO, use first found $curId = isset($Itemid) ? $Itemid : ''; $active = isset($sefurls[$curId]) ? $sefurls[$curId] : reset($sefurls); $realloc = $active; */ } } // found a match, so we are done if (is_object($realloc) && !$check) { // return the original URL if SEF is disabled if (!$realloc->sef) { return $origUri; } // return found URL with non-SEF part appended if ($nonSefUrl != '' && strstr($realloc->sefurl, '?')) { $nonSefUrl = str_replace('?', '&', $nonSefUrl); } if (!strlen($host)) { $root = JFactory::getURI()->getHost(); } else { $root = $host; } $url = JFactory::getURI()->getScheme() . "://" . $root; if (substr($url, -1) != '/') { $url .= '/'; } $url .= $realloc->sefurl . $nonSefUrl; $fragment = $uri->getFragment(); if (!empty($fragment)) { $url .= '#' . $fragment; } JoomSefUri::updateUri($origUri, $url); return $origUri; } else { if (!is_object($realloc) || $check) { // return the original URL if we don't want to save new URLs if ($sefConfig->disableNewSEF) { return $origUri; } $realloc = null; $suffixMust = false; if (!isset($suffix)) { $suffix = $sefConfig->suffix; } $addFile = $sefConfig->addFile; if (($pos = strrpos($addFile, '.')) !== false) { $addFile = substr($addFile, 0, $pos); } // in case the created SEF URL is already in database for different non-SEF URL, // we need to distinguish them by using numbers, so let's find the first unused URL $leftPart = ''; // string to be searched before page number $rightPart = ''; // string to be searched after page number if (substr($location, -1) == '/' || strlen($location) == 0) { if ($pagetext = $sefConfig->getPageText()) { // use global limit if NULL and set in globals if (is_null($limit) && isset($_REQUEST['limit']) && $_REQUEST['limit'] > 0) { $limit = $_REQUEST['limit']; } // if we are using pagination, try to calculate page number if (!is_null($limitstart) && $limitstart > 0) { // make sure limit is not 0 if ($limit == 0) { $config =& JFactory::getConfig(); $listLimit = $config->get('list_limit'); $limit = $listLimit > 0 ? $listLimit : 20; } $pagenum = $limitstart / $limit; $pagenum++; } else { $pagenum = 1; } if (strpos($pagetext, '%s') !== false) { $page = str_replace('%s', $pagenum == 1 ? $addFile : $pagenum, $pagetext) . $suffix; $pages = explode('%s', $pagetext); $leftPart = $location . $pages[0]; $rightPart = $pages[1] . $suffix; } else { $page = $pagetext . ($pagenum == 1 ? $addFile : $sefConfig->pagerep . $pagenum) . $suffix; $leftPart = $location . $pagetext . $sefConfig->pagerep; $rightPart = $suffix; } $temploc = $location . ($pagenum == 1 && !$suffixMust ? '' : $page); } else { $temploc = $location . ($suffixMust ? $sefConfig->pagerep . $suffix : ''); $leftPart = $location . $sefConfig->pagerep; $rightPart = $suffix; } } elseif ($suffix) { if ($sefConfig->suffix != '/') { //if (eregi($regexSuffix, $location)) { if (preg_match('/' . $pregSuffix . '/i', $location)) { $temploc = preg_replace('/' . $pregSuffix . '/', '', $location) . $suffix; $leftPart = preg_replace('/' . $pregSuffix . '/', '', $location) . $sefConfig->pagerep; $rightPart = $suffix; } else { $temploc = $location . $suffix; $leftPart = $location . $sefConfig->pagerep; $rightPart = $suffix; } } else { $temploc = $location . $suffix; $leftPart = $location . $sefConfig->pagerep; $rightPart = $suffix; } } else { $temploc = $location . ($suffixMust ? $sefConfig->pagerep . $suffix : ''); $leftPart = $location . $sefConfig->pagerep; $rightPart = $suffix; } // add language to path if ($sefConfig->langEnable && isset($lang) && $sefConfig->langPlacementJoomla == _COM_SEF_LANG_PATH) { if ($sefConfig->alwaysUseLang || $lang != $sefConfig->mainLanguageJoomla) { $slash = $temploc != '' && $temploc[0] == '/'; $temploc = $lang . ($slash || strlen($temploc) > 0 ? '/' : '') . $temploc; $leftPart = $lang . '/' . $leftPart; } } if ($sefConfig->addFile) { //if (!eregi($regexSuffix . '$', $temploc) && substr($temploc, -1) == '/') { if (!preg_match('/' . $pregSuffix . '$/i', $temploc) && substr($temploc, -1) == '/') { $temploc .= $sefConfig->addFile; } } // convert to lowercase if set to if ($sefConfig->lowerCase) { $temploc = JoomSEF::_toLowerCase($temploc); $leftPart = JoomSEF::_toLowerCase($leftPart); $rightPart = JoomSEF::_toLowerCase($rightPart); } $url = JoomSEF::_uriToUrl($uri); // see if we have a result for this location $sql = "SELECT `id`, `origurl`, `Itemid`, `sefurl` FROM `#__sefurls` WHERE `sefurl` = '{$temploc}' AND `origurl` != ''"; $db->setQuery($sql); $row = $db->loadObject(); if ($itemidIgnored) { $Itemid = null; } $realloc = JoomSEF::_checkRow($row, $ignoreSource, @$Itemid, $url, $metadata, $temploc, $priority, $uri->getVar('option'), $check, $host, $sitemapParams); // the correct URL could not be used, we must find the first free number if (is_null($realloc)) { // let's get all the numbered pages $sql = "SELECT `id`, `origurl`, `Itemid`, `sefurl` FROM `#__sefurls` WHERE `sefurl` LIKE '{$leftPart}%{$rightPart}'"; $db->setQuery($sql); $pages = $db->loadObjectList(); // create associative array of form number => URL info $urls = array(); if (!empty($pages)) { $leftLen = strlen($leftPart); $rightLen = strlen($rightPart); foreach ($pages as $page) { $sefurl = $page->sefurl; // separate URL number $urlnum = substr($sefurl, $leftLen, strlen($sefurl) - $leftLen - $rightLen); // use only if it's really numeric if (is_numeric($urlnum)) { $urls[intval($urlnum)] = $page; } } } $i = 2; do { $temploc = $leftPart . $i . $rightPart; $row = null; if (isset($urls[$i])) { $row = $urls[$i]; } $realloc = JoomSEF::_checkRow($row, $ignoreSource, @$Itemid, $url, $metadata, $temploc, $priority, $uri->getVar('option'), false, $host, $sitemapParams); $i++; } while (is_null($realloc)); } } } // return found URL with non-SEF part appended if ($nonSefUrl != '' && strstr($realloc, '?')) { $nonSefUrl = str_replace('?', '&', $nonSefUrl); } if (!strlen($host)) { $root = JFactory::getUri()->toString(array('host', 'port')); } else { $root = $host; } $url = JFactory::getURI()->getScheme() . "://" . $root . JURI::root(true); if (substr($url, -1) != '/') { $url .= '/'; } $url .= $realloc . $nonSefUrl; $fragment = $uri->getFragment(); if (!empty($fragment)) { $url .= '#' . $fragment; } JoomSefUri::updateUri($origUri, $url); return $origUri; }
private function _replaceLink($matches) { $host = JFactory::getUri()->getHost(); $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select('Itemid')->from('#__sefurls')->where('sefurl=' . $db->quote(ltrim(str_replace(JFactory::getUri()->base(true), "", $matches[3]), "/"))); $db->setQuery($query); $Itemid = $db->loadResult(); //echo $matches[3]."\t".$Itemid."<br>"; if (strlen($Itemid)) { $query = $db->getQuery(true); $query->select('subdomain')->from('#__sef_subdomains')->where('Itemid=' . $Itemid); $db->setQuery($query); $subdomain = $db->loadResult(); if (strlen($subdomain)) { $host = $subdomain . "." . $host; } } switch ($matches[1]) { case 'a': return '<a' . $matches[2] . 'href="http://' . $host . $matches[3] . '"' . $matches[4] . '>'; break; case 'form': return '<form' . $matches[2] . 'action="http://' . $host . $matches[3] . '"' . $matches[4] . '>'; break; } }
/** * _getDirectory. * * @return string */ public static function getDirectory() { $uri = JFactory::getUri(); $host = $uri->getHost(); $root = $uri->root(); $parts = explode($host, $root); $path = $parts[1]; return $path; }
$width = $params->get('width', 470); $num_posts = $params->get('num_posts', 10); $colorscheme = $params->get('colorscheme', 'light'); if ($params->get('load_sdk', 1) && !defined('_MOD_JOOMFACEBOOKCOMMENTS_SDK_LOADED')) { ?> <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; <?php echo ' js.src = "//connect.facebook.net/' . str_replace("-", "_", $lang->getTag()) . '/all.js#xfbml=1' . $fb_app_id_url . '";'; ?> fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script><?php define('_MOD_JOOMFACEBOOKCOMMENTS_SDK_LOADED', true); } // Ensure that the correct host and path is prepended $current_uri = JURI::getInstance(JURI::base()); $current_host = $current_uri->toString(array('scheme', 'host', 'port')); $uri = JFactory::getUri($url); $uri->setHost($current_host); $url = $uri->toString(); ?> <div class="fb-comments" <?php echo "data-href=\"{$url}\" data-width=\"{$width}\" data-num-posts=\"{$num_posts}\" data-colorscheme=\"{$colorscheme}\" "; ?> > </div>
/** * HTML view display method * * @param string $tpl The name of the template file to parse * @return void * @since 1.5.5 */ public function display($tpl = null) { if (!$this->_user->get('id') && !$this->_config->get('jg_showdetailpage')) { $this->_mainframe->redirect(JRoute::_('index.php?view=gallery', false), JText::_('COM_JOOMGALLERY_COMMON_MSG_NOT_ALLOWED_VIEW_IMAGE'), 'notice'); } if ((!is_numeric($this->_config->get('jg_detailpic_open')) || $this->_config->get('jg_detailpic_open') > 0) && $this->_config->get('jg_disabledetailpage')) { $this->_mainframe->redirect(JRoute::_('index.php?view=gallery', false), JText::_('COM_JOOMGALLERY_DETAIL_MSG_NOT_ALLOWED_VIEW_DEFAULT_DETAIL_VIEW'), 'notice'); } $images = $this->get('Images'); $image = $this->get('Image'); $slideshow = JRequest::getInt('slideshow'); $params = $this->_mainframe->getParams(); // Breadcrumbs if ($this->_config->get('jg_completebreadcrumbs') || $this->_config->get('jg_showpathway') || $this->_config->get('jg_pagetitle_detail')) { $parents = JoomHelper::getAllParentCategories($image->catid, true); } $menus = $this->_mainframe->getMenu(); $menu = $menus->getActive(); if ($menu && isset($menu->query['view']) && $menu->query['view'] != 'detail' && $this->_config->get('jg_completebreadcrumbs')) { $breadcrumbs = $this->_mainframe->getPathway(); switch ($menu->query['view']) { case '': case 'gallery': foreach ($parents as $parent) { $breadcrumbs->addItem($parent->name, 'index.php?view=category&catid=' . $parent->cid); } $breadcrumbs->addItem($image->imgtitle); break; case 'category': $skip = true; foreach ($parents as $key => $parent) { if ($skip) { if ($key == $menu->query['catid']) { $skip = false; } } else { $breadcrumbs->addItem($parent->name, 'index.php?view=category&catid=' . $parent->cid); } } if (!$skip) { $breadcrumbs->addItem($image->imgtitle); } break; } } // JoomGallery Pathway $pathway = null; if ($this->_config->get('jg_showpathway')) { $pathway = '<a href="' . JRoute::_('index.php?view=gallery') . '" class="jg_pathitem">' . JText::_('COM_JOOMGALLERY_COMMON_HOME') . '</a> » '; foreach ($parents as $parent) { $pathway .= '<a href="' . JRoute::_('index.php?view=category&catid=' . $parent->cid) . '" class="jg_pathitem">' . $parent->name . '</a> » '; } $pathway .= $image->imgtitle; } // Page Title if ($this->_config->get('jg_pagetitle_detail')) { $pagetitle = JoomHelper::createPagetitle($this->_config->get('jg_pagetitle_detail'), $parents[$image->catid]->name, $image->imgtitle, $params->get('page_title') ? $params->get('page_title') : JText::_('COM_JOOMGALLERY_COMMON_GALLERY')); $this->_doc->setTitle($pagetitle); } // Header and footer JoomHelper::prepareParams($params); // Generate the backlink if ($this->_config->get('jg_skipcatview')) { $allsubcats = JoomHelper::getAllSubCategories($image->catid, false); // Link to category view if it include subcategories if (count($allsubcats)) { $backtarget = JRoute::_('index.php?view=category&catid=' . $image->catid); $backtext = JText::_('COM_JOOMGALLERY_COMMON_BACK_TO_CATEGORY'); } else { // Get the parents including category itself if not read before if (!isset($parents)) { $parents = JoomHelper::getAllParentCategories($image->catid, true); } if (count($parents) == 1) { // Link to gallery view $backtarget = JRoute::_('index.php?view=gallery'); $backtext = JText::_('COM_JOOMGALLERY_COMMON_BACK_TO_GALLERY'); } else { // Link to parent of category $backtarget = JRoute::_('index.php?view=category&catid=' . $parents[$image->catid]->parent_id); $backtext = JText::_('COM_JOOMGALLERY_COMMON_BACK_TO_CATEGORY'); } } } else { $backtarget = JRoute::_('index.php?view=category&catid=' . $image->catid); $backtext = JText::_('COM_JOOMGALLERY_COMMON_BACK_TO_CATEGORY'); } // Get number of images and hits in gallery $numbers = JoomHelper::getNumberOfImgHits(); // Load modules at position 'top' $modules['top'] = JoomHelper::getRenderedModules('top'); if (count($modules['top'])) { $params->set('show_top_modules', 1); } // Load modules at position 'btm' $modules['btm'] = JoomHelper::getRenderedModules('btm'); if (count($modules['btm'])) { $params->set('show_btm_modules', 1); } // Load modules at position 'detailbtm' $modules['detailbtm'] = JoomHelper::getRenderedModules('detailbtm'); if (count($modules['detailbtm'])) { $params->set('show_detailbtm_modules', 1); } // Check whether this is the active menu item. This is a // special case in addition to code in constructor of parent class // because here we have to check the image ID, too. $active = $this->_mainframe->getMenu()->getActive(); if (!$active || strpos($active->link, '&id=' . JRequest::getInt('id')) === false) { // Get the default layout from the configuration if ($layout = $this->_config->get('jg_alternative_layout')) { $this->setLayout($layout); } } // Meta data if ($image->metadesc) { $this->_doc->setDescription($image->metadesc); } elseif ($image->catmetadesc) { $this->_doc->setDescription($image->catmetadesc); } if ($image->metakey) { $this->_doc->setMetadata('keywords', $image->metakey); } elseif ($image->catmetakey) { $this->_doc->setMetadata('keywords', $image->catmetakey); } if ($this->_mainframe->getCfg('MetaAuthor') == '1' && $image->author && strcmp(JText::_('COM_JOOMGALLERY_COMMON_NO_DATA'), $image->author) != 0) { $this->_doc->setMetaData('author', $image->author); } // Set the title attribute in a tag with title and/or description of image // if a box is activated if ((!is_numeric($this->_config->get('jg_bigpic_open')) || $this->_config->get('jg_bigpic_open') > 1) && !$slideshow) { $image->atagtitle = JHTML::_('joomgallery.getTitleforATag', $image); } else { // Set the imgtitle by default $image->atagtitle = 'title="' . $image->imgtitle . '"'; } // Accordion if ($this->_config->get('jg_showdetailaccordion')) { $toggler = 'class="joomgallery-toggler"'; $slider = 'class="joomgallery-slider"'; JHtml::_('behavior.framework', true); $accordionscript = 'window.addEvent(\'domready\', function(){ new Fx.Accordion ( $$(\'h4.joomgallery-toggler\'), $$(\'div.joomgallery-slider\'), { onActive: function(toggler, i) { toggler.addClass(\'joomgallery-toggler-down\'); toggler.removeClass(\'joomgallery-toggler\'); }, onBackground: function(toggler, i) { toggler.addClass(\'joomgallery-toggler\'); toggler.removeClass(\'joomgallery-toggler-down\'); }, duration : ' . $this->_config->get('jg_accordionduration') . ', display : ' . ($this->_config->get('jg_accordiondisplay') - 1) . ', initialDisplayFx : ' . $this->_config->get('jg_accordioninitialeffect') . ', opacity : ' . $this->_config->get('jg_accordionopacity') . ', alwaysHide : ' . $this->_config->get('jg_accordionalwayshide') . ' }); });'; $this->_doc->addScriptDeclaration($accordionscript); } else { $toggler = ''; $slider = ''; } // Linked if (($this->_config->get('jg_bigpic') == 1 && $this->_user->get('id') || $this->_config->get('jg_bigpic_unreg') == 1 && !$this->_user->get('id')) && !$slideshow && $image->bigger_orig && (!$this->_config->get('jg_nameshields') || !$this->_config->get('jg_show_nameshields_unreg') && !$this->_user->get('id'))) { $params->set('image_linked', 1); } // Original size if ($image->orig_exists && $this->_config->get('jg_showoriginalfilesize') && !$slideshow) { $params->set('show_original_size', 1); } // Pagination if (isset($images[$image->position - 1]) && !$slideshow) { $params->set('show_previous_link', 1); $pagination['previous']['link'] = JRoute::_('index.php?view=detail&id=' . $images[$image->position - 1]->id) . JHTML::_('joomgallery.anchor'); if ($this->_config->get('jg_showdetailnumberofpics')) { $params->set('show_previous_text', 1); $pagination['previous']['text'] = JText::sprintf('COM_JOOMGALLERY_DETAIL_IMG_IMAGE_OF_IMAGES', $image->position, count($images)); } } if (isset($images[$image->position + 1]) && !$slideshow) { $params->set('show_next_link', 1); $pagination['next']['link'] = JRoute::_('index.php?view=detail&id=' . $images[$image->position + 1]->id) . JHTML::_('joomgallery.anchor'); if ($this->_config->get('jg_showdetailnumberofpics')) { $params->set('show_next_text', 1); $pagination['next']['text'] = JText::sprintf('COM_JOOMGALLERY_DETAIL_IMG_IMAGE_OF_IMAGES', $image->position + 2, count($images)); } } // Nametags if (!$slideshow && ($this->_config->get('jg_nameshields') && $this->_user->get('id') || $this->_config->get('jg_nameshields_unreg') && !$this->_user->get('id'))) { $nametags = $this->get('Nametags'); if ($this->_user->get('id') || $nametags) { $params->set('show_nametags', 1); $this->assignRef('nametags', $nametags); } $already_tagged = false; foreach ($nametags as $nametag) { if ($nametag->nuserid == $this->_user->get('id')) { $already_tagged = true; break; } } if ($this->_config->get('jg_nameshields') && $this->_user->get('id') && !$slideshow && (!$already_tagged || $this->_config->get('jg_nameshields_others'))) { $params->set('show_movable_nametag', 1); $length = strlen($this->_user->get('username')) * $this->_config->get('jg_nameshields_width'); $nametag = array(); $nametag['length'] = $length; $nametag['name'] = $this->_user->get('username'); $nametag['link'] = JRoute::_('index.php?task=nametags.save'); $this->assignRef('nametag', $nametag); JHtml::_('behavior.framework'); if ($this->_config->get('jg_nameshields_others')) { JHTML::_('behavior.modal'); } } } $script = ''; // Slideshow if ($this->_config->get('jg_slideshow')) { $params->set('slideshow_enabled', 1); if ($slideshow) { JHtml::_('behavior.framework', true); $this->_doc->addStyleSheet($this->_ambit->getScript('smoothgallery/css/jd.gallery.css')); $this->_doc->addScript($this->_ambit->getScript('smoothgallery/scripts/jd.gallery.js')); // No include if standard effects 'fade/crossfade/fadebg' chosen switch ($this->_config->get('jg_slideshow_transition')) { case 0: $transition = 'fade'; break; case 1: $transition = 'fadeslideleft'; $this->_doc->addScript($this->_ambit->getScript('smoothgallery/scripts/jd.gallery.transitions.js')); break; case 2: $transition = 'crossfade'; break; case 3: $transition = 'continuoushorizontal'; $this->_doc->addScript($this->_ambit->getScript('smoothgallery/scripts/jd.gallery.transitions.js')); break; case 4: $transition = 'continuousvertical'; $this->_doc->addScript($this->_ambit->getScript('smoothgallery/scripts/jd.gallery.transitions.js')); break; case 5: $transition = 'fadebg'; break; default: $transition = 'fade'; break; } // The slideshow needs an array of objects $script .= 'var photo = new Array(); function joom_createphotoobject(image,thumbnail,linkTitle,link,title,description,number,date,hits,downloads,rating,filesizedtl,filesizeorg,author,detaillink) { this.image = image; this.thumbnail = thumbnail; this.linkTitle = linkTitle; this.link =link; this.title = title; this.description = description; this.transition="' . $transition . '"; this.number=number; this.date=date, this.hits=hits, this.downloads=downloads, this.rating=rating, this.filesizedtl=filesizedtl, this.filesizeorg=filesizeorg, this.author=author, this.detaillink=detaillink }'; $number = 0; $maxwidth = 0; $maxheight = 0; $imgstartidx = 0; foreach ($images as $row) { // Description if ($row->imgtext != '') { $description = JoomHelper::fixForJS($row->imgtext); } else { $description = ' '; } // Date if ($row->imgdate != '') { $date = JHTML::_('date', $row->imgdate, JText::_('DATE_FORMAT_LC1')); } else { $date = ''; } // Rating $rating = addslashes(JHTML::_('joomgallery.rating', $row, true, 'jg_starrating_detail')); // File size of detail image if ($this->_config->get('jg_showdetailfilesize')) { $filesizedtlhw = @filesize($this->_ambit->getImg('img_path', $row)); $filesizedtlhw = number_format($filesizedtlhw / 1024, 2, JText::_('COM_JOOMGALLERY_COMMON_DECIMAL_SEPARATOR'), JText::_('COM_JOOMGALLERY_COMMON_THOUSANDS_SEPARATOR')); list($width, $height) = @getimagesize($this->_ambit->getImg('img_path', $row)); $filesizedtl = JText::sprintf('COM_JOOMGALLERY_COMMON_IMG_HW', $filesizedtlhw, $width, $height); } else { $filesizedtl = ' '; } // File size of original image if ($this->_config->get('jg_showoriginalfilesize')) { $filesizeorghw = @filesize($this->_ambit->getImg('orig_path', $row)); $filesizeorghw = number_format($filesizeorghw / 1024, 2, JText::_('COM_JOOMGALLERY_COMMON_DECIMAL_SEPARATOR'), JText::_('COM_JOOMGALLERY_COMMON_THOUSANDS_SEPARATOR')); list($width, $height) = @getimagesize($this->_ambit->getImg('orig_path', $row)); $filesizeorg = JText::sprintf('COM_JOOMGALLERY_COMMON_IMG_HW', $filesizeorghw, $width, $height); } else { $filesizeorg = ' '; } // Author-owner if ($this->_config->get('jg_showdetailauthor')) { if ($row->imgauthor) { $author = $row->imgauthor; } else { if ($this->_config->get('jg_showowner')) { $author = JHTML::_('joomgallery.displayname', $row->imgowner, 'detail'); } else { $author = JText::_('COM_JOOMGALLERY_COMMON_NO_DATA'); } } } else { $author = ''; } if ($this->_config->get('jg_slideshow_maxdimauto')) { // Get dimensions of image for calculating the max. width/height // of all images $dimensions = getimagesize($this->_ambit->getImg('img_path', $row)); if ($dimensions[0] > $maxwidth) { $maxwidth = $dimensions[0]; } if ($dimensions[1] > $maxheight) { $maxheight = $dimensions[1]; } } $script .= ' photo[' . $number . '] = new joom_createphotoobject( "' . str_replace('&', '&', $this->_ambit->getImg('img_url', $row)) . '",//image "' . $this->_ambit->getImg('thumb_url', $row) . '",//thumbnail "' . JoomHelper::fixForJS($row->imgtitle) . '",//linkTitle "' . str_replace('&', '&', $this->_ambit->getImg('img_url', $row)) . '",//link "' . JoomHelper::fixForJS($row->imgtitle) . '",//title "' . $description . '", ' . $number . ', "' . $date . '", "' . $row->hits . '", "' . $row->downloads . '", "' . $rating . '", "' . $filesizedtl . '", "' . $filesizeorg . '", "' . str_replace(array("\r\n", "\r", "\n"), '', addcslashes($author, '"')) . '", "' . JHTML::_('joomgallery.openimage', 0, $row) . '" );'; // set start image index for slideshow if ($row->id == $image->id) { $imgstartidx = $number; } $number++; } if (!$this->_config->get('jg_slideshow_maxdimauto')) { $maxwidth = $this->_config->get('jg_slideshow_width'); $maxheight = $this->_config->get('jg_slideshow_heigth'); } $script .= 'var joom_slideshow=null; function startGallery() { joom_slideshow = new gallery($(\'jg_dtl_photo\'), { timed: true, delay: ' . $this->_config->get('jg_slideshow_timer') . ', fadeDuration: ' . $this->_config->get('jg_slideshow_transtime') . ', showArrows: ' . $this->_config->get('jg_slideshow_arrows') . ', showCarousel: ' . $this->_config->get('jg_slideshow_carousel') . ', textShowCarousel: \'' . JText::_('COM_JOOMGALLERY_DETAIL_SLIDESHOW_IMAGES', true) . '\', showInfopane: ' . $this->_config->get('jg_slideshow_infopane') . ', embedLinks: false, manualData:photo, preloader:false, populateData:false, maxWidth:' . $maxwidth . ', maxHeight:' . $maxheight . ', imgstartidx:' . $imgstartidx . ', repeat: ' . $this->_config->get('jg_slideshow_repeat') . ', repeattxt: \'' . JText::_('COM_JOOMGALLERY_DETAIL_SLIDESHOW_REPEAT', true) . '\' }); } window.addEvent(\'domready\', startGallery); function joom_stopslideshow() { var url = photo[joom_slideshow.getCurrentIter()].detaillink + \'' . JHTML::_('joomgallery.anchor') . '\'; location.href = url.replace(/\\&/g,\'&\'); } '; } else { $script .= "function joom_startslideshow() {\n" . " document.jg_slideshow_form.submit();\n" . "}\n"; } } // Rightclick / Cursor navigation if ($this->_config->get('jg_disable_rightclick_detail')) { $script .= ' var jg_photo_hover = 0; document.oncontextmenu = function() { if(jg_photo_hover==1) { return false; } else { return true; } } function joom_hover() { jg_photo_hover = (jg_photo_hover==1) ? 0 : 1; }'; } if ($this->_config->get('jg_cursor_navigation') == 1) { $script .= 'document.onkeydown = joom_cursorchange;'; } if ($script) { $this->_doc->addScriptDeclaration($script); } // MotionGallery if ($this->_config->get('jg_minis') && $this->_config->get('jg_motionminis') == 2) { $this->_doc->addScript($this->_ambit->getScript('motiongallery.js')); $script = "\n" . " /***********************************************\n" . " * CMotion Image Gallery- © Dynamic Drive DHTML code library (www.dynamicdrive.com)\n" . " * Visit http://www.dynamicDrive.com for hundreds of DHTML scripts\n" . " * This notice must stay intact for legal use\n" . " * Modified by Jscheuer1 for autowidth and optional starting positions\n" . " ***********************************************/"; $this->_doc->addScriptDeclaration($script); $custom = " <!-- Do not edit IE conditional style below -->" . "\n" . " <!--[if gte IE 5.5]>" . "\n" . " <style type=\"text/css\">\n" . " #motioncontainer {\n" . " width:expression(Math.min(this.offsetWidth, maxwidth)+'px');\n" . " }\n" . " </style>\n" . " <![endif]-->" . "\n" . " <!-- End Conditional Style -->"; $this->_doc->addCustomTag($custom); } // Icons if (!$slideshow) { // Zoom if ($image->bigger_orig) { if ($this->_config->get('jg_bigpic') == 1 && $this->_user->get('id') || $this->_config->get('jg_bigpic_unreg') == 1 && !$this->_user->get('id')) { $params->set('show_zoom_icon', 1); } else { if ($this->_config->get('jg_bigpic') == 1 && !$this->_user->get('id')) { $params->set('show_zoom_icon', -1); } } } // Download icon if ($this->_config->get('jg_download') && $this->_config->get('jg_showdetaildownload') && ($image->orig_exists || $this->_config->get('jg_downloadfile') != 1)) { if ($this->_user->get('id') || $this->_config->get('jg_download_unreg')) { $params->set('show_download_icon', 1); $params->set('download_link', JRoute::_('index.php?task=download&id=' . $image->id)); } else { if ($this->_config->get('jg_download_hint')) { $params->set('show_download_icon', -1); } } } // Nametags if ($this->_config->get('jg_nameshields') && $this->_user->get('id')) { if (!$this->_config->get('jg_nameshields_others')) { if (!$already_tagged) { $params->set('show_nametag_icon', 1); } else { $params->set('show_nametag_icon', 2); $params->set('nametag_link', JRoute::_('index.php?task=nametags.remove&id=' . $image->id, false)); } } else { $params->set('show_nametag_icon', 3); } } else { if ($this->_config->get('jg_nameshields') && !$this->_user->get('id') && $this->_config->get('jg_show_nameshields_unreg')) { $params->set('show_nametag_icon', -1); } } // Favourites if (!$params->get('disable_global_info') && $this->_config->get('jg_favourites')) { if ($this->_user->get('id') || $this->_config->get('jg_usefavouritesforpubliczip') == 1 && !$this->_user->get('id')) { $params->set('favourites_link', JRoute::_('index.php?task=favourites.addimage&id=' . $image->id)); if ($this->_config->get('jg_usefavouritesforzip') == 1 || $this->_config->get('jg_usefavouritesforpubliczip') == 1 && !$this->_user->get('id')) { $params->set('show_favourites_icon', 2); } else { $params->set('show_favourites_icon', 1); } } else { if ($this->_config->get('jg_favouritesshownotauth') == 1) { if ($this->_config->get('jg_usefavouritesforzip') == 1) { $params->set('show_favourites_icon', -2); } else { $params->set('show_favourites_icon', -1); } } } } // Report if ($this->_config->get('jg_report_images') && $this->_config->get('jg_detail_report_images')) { if ($this->_user->get('id') || $this->_config->get('jg_report_unreg')) { $params->set('show_report_icon', 1); JHTML::_('behavior.modal'); } else { if ($this->_config->get('jg_report_hint')) { $params->set('show_report_icon', -1); } } } // Show editor links for that image if ($this->_config->get('jg_showdetaileditorlinks') == 1 && $this->_config->get('jg_userspace') == 1) { if ($this->_user->authorise('core.edit', _JOOM_OPTION . '.image.' . $image->id) || $this->_user->authorise('core.edit.own', _JOOM_OPTION . '.image.' . $image->id) && $image->imgowner && $image->imgowner == $this->_user->get('id')) { $params->set('show_edit_icon', 1); } if ($this->_user->authorise('core.delete', _JOOM_OPTION . '.image.' . $image->id)) { $params->set('show_delete_icon', 1); } } } $extra = ''; if ($this->_config->get('jg_disable_rightclick_detail') == 1) { $extra = 'onmouseover="javascript:joom_hover();" onmouseout="javascript:joom_hover();"'; } $event = new stdClass(); if (!$slideshow) { if ($this->_config->get('jg_lightbox_slide_all')) { $params->set('show_all_in_popup', 1); $popup = array(); $popup['before'] = JHTML::_('joomgallery.popup', $images, 0, $image->position, $params->get('image_linked') ? 'joomgalleryIcon' : null); $popup['after'] = JHTML::_('joomgallery.popup', $images, $image->position + 1, null, $params->get('image_linked') ? 'joomgalleryIcon' : null); $this->assignRef('popup', $popup); } // Pane // Load modules at position 'detailpane' $modules['detailpane'] = JoomHelper::getRenderedModules('detailpane'); if (count($modules['detailpane'])) { $params->set('show_detailpane_modules', 1); } // Exif data if ($this->_config->get('jg_showexifdata') && $image->orig_exists && extension_loaded('exif') && function_exists('exif_read_data')) { $exifdata = $this->get('Exifdata'); if ($exifdata) { $params->set('show_exifdata', 1); $this->assignRef('exifdata', $exifdata); } } // GeoTagging data if ($this->_config->get('jg_showgeotagging') && $image->orig_exists && extension_loaded('exif') && function_exists('exif_read_data')) { $mapdata_array = $this->get('Mapdata'); if ($mapdata_array) { $mapdata = ''; if (isset($mapdata_array['N'])) { $mapdata .= $mapdata_array['N']; } else { if (isset($mapdata_array['S'])) { $mapdata .= '-' . $mapdata_array['S']; } } $mapdata .= ', '; if (isset($mapdata_array['E'])) { $mapdata .= $mapdata_array['E']; } else { if (isset($mapdata_array['W'])) { $mapdata .= '-' . $mapdata_array['W']; } } if ($mapdata) { $params->set('show_map', 1); $this->assignRef('mapdata', $mapdata); $apikey = $this->_config->get('jg_geotaggingkey'); $this->_doc->addScript('http' . (JUri::getInstance()->isSSL() ? 's' : '') . '://maps.google.com/maps/api/js?sensor=false' . (!empty($apikey) ? '&key=' . $apikey : '')); JText::script('COM_JOOMGALLERY_DETAIL_MAPS_BROWSER_IS_INCOMPATIBLE'); } } } // IPTC data if ($this->_config->get('jg_showiptcdata') && $image->orig_exists) { $iptcdata = $this->get('Iptcdata'); if ($iptcdata) { $params->set('show_iptcdata', 1); $this->assignRef('iptcdata', $iptcdata); } } // Rating if ($this->_config->get('jg_showrating')) { if ($this->_config->get('jg_votingonlyreg') && !$this->_user->get('id')) { // Set voting_area to 3 to show only the message in template $params->set('show_voting_area', 3); $params->set('voting_message', JText::_('COM_JOOMGALLERY_DETAIL_LOGIN_FIRST')); } else { if ($this->_config->get('jg_votingonlyreg') && $image->owner == $this->_user->get('id')) { // Set voting_area to 3 to show only the message in template $params->set('show_voting_area', 3); $params->set('voting_message', JText::_('COM_JOOMGALLERY_DETAIL_RATING_NOT_ON_OWN_IMAGES')); } else { // Set to 1 will show the voting area JHtml::_('behavior.framework'); $params->set('show_voting_area', 1); $params->set('ajaxvoting', $this->_config->get('jg_ajaxrating')); if ($this->_config->get('jg_ratingdisplaytype') == 0) { // Set to 0 will show textual voting bar with radio buttons $params->set('voting_display_type', 0); $selected = floor($this->_config->get('jg_maxvoting') / 2) + 1; $voting = ''; $options = array(); for ($i = 1; $i <= $this->_config->get('jg_maxvoting'); $i++) { $options[] = JHTML::_('select.option', $i); // Delete options text manually, because it defaults to the value in JHTML::_('select.option'... ) if left empty $options[$i - 1]->text = ''; } $voting .= JHTML::_('select.radiolist', $options, 'imgvote', null, 'value', 'text', $selected); $maxvoting = $i - 1; $this->assignRef('voting', $voting); $this->assignRef('maxvoting', $maxvoting); } else { if ($this->_config->get('jg_ratingdisplaytype') == 1) { // Set to 1 will show graphical voting bar with stars $params->set('voting_display_type', 1); $maxvoting = $this->_config->get('jg_maxvoting'); $this->assignRef('maxvoting', $maxvoting); } } } } } if ($this->_config->get('jg_bbcodelink')) { $current_uri = JURI::getInstance(JURI::base()); $current_host = $current_uri->toString(array('scheme', 'host', 'port')); $params->set('show_bbcode', 1); if ($this->_config->get('jg_bbcodelink') == 1 || $this->_config->get('jg_bbcodelink') == 3) { // Ensure that the correct host and path is prepended $uri = JFactory::getUri($image->img_src); $uri->setHost($current_host); $params->set('bbcode_img', str_replace(array('&', 'http://http://'), array('&', 'http://'), $uri->toString())); } if ($this->_config->get('jg_bbcodelink') == 2 || $this->_config->get('jg_bbcodelink') == 3) { $url = JRoute::_('index.php?view=detail&id=' . $image->id) . JHTML::_('joomgallery.anchor'); // Ensure that the correct host and path is prepended $uri = JFactory::getUri($url); $uri->setHost($current_host); $params->set('bbcode_url', str_replace('&', '&', $uri->toString())); } } if ($this->_config->get('jg_showcomment')) { $params->set('show_comments_block', 1); // Check whether user is allowed to comment if ($this->_config->get('jg_anoncomment') || !$this->_config->get('jg_anoncomment') && $this->_user->get('id')) { $params->set('commenting_allowed', 1); $plugins = $this->_mainframe->triggerEvent('onJoomGetCaptcha'); $event->captchas = implode('', $plugins); $this->_doc->addScriptDeclaration(' var jg_use_code = ' . $params->get('use_easycaptcha', 0) . ';'); if ($this->_config->get('jg_bbcodesupport')) { $params->set('bbcode_status', JText::_('COM_JOOMGALLERY_DETAIL_BBCODE_ON')); } else { $params->set('bbcode_status', JText::_('COM_JOOMGALLERY_DETAIL_BBCODE_OFF')); } if ($this->_config->get('jg_smiliesupport')) { $params->set('smiley_support', 1); $smileys = JoomHelper::getSmileys(); $this->assignRef('smileys', $smileys); } JText::script('COM_JOOMGALLERY_DETAIL_SENDTOFRIEND_ALERT_ENTER_NAME_EMAIL'); JText::script('COM_JOOMGALLERY_DETAIL_COMMENTS_ALERT_ENTER_COMMENT'); JText::script('COM_JOOMGALLERY_DETAIL_COMMENTS_ALERT_ENTER_CODE'); } // Check whether user is allowed to read comments if ($this->_user->get('username') || !$this->_user->get('username') && $this->_config->get('jg_showcommentsunreg') == 0) { $comments = $this->get('Comments'); if (!$comments) { $params->set('no_comments_message', JText::_('COM_JOOMGALLERY_DETAIL_COMMENTS_NOT_EXISTING')); if ($params->get('commenting_allowed')) { $params->set('no_comments_message2', JText::_('COM_JOOMGALLERY_DETAIL_COMMENTS_WRITE_FIRST')); } } else { $params->set('show_comments', 1); // Manager logged? if ($this->_user->authorise('core.manage', _JOOM_OPTION)) { $params->set('manager_logged', 1); } foreach ($comments as $key => $comment) { // Display author name or notice that the author is a guest if ($comment->userid) { $comments[$key]->author = JHTML::_('joomgallery.displayname', $comment->userid, 'comment'); } else { if ($this->_config->get('jg_namedanoncomment')) { if ($comment->cmtname != JText::_('COM_JOOMGALLERY_COMMON_GUEST')) { $comments[$key]->author = JText::sprintf('COM_JOOMGALLERY_DETAIL_COMMENTS_GUEST_NAME', $comment->cmtname); } else { $comments[$key]->author = $comment->cmtname; } } else { $comments[$key]->author = JText::_('COM_JOOMGALLERY_COMMON_GUEST'); } } // Process comment text $text = $comment->cmttext; $text = JoomHelper::processText($text); if ($this->_config->get('jg_bbcodesupport')) { $text = JHTML::_('joomgallery.bbdecode', $text); } if ($this->_config->get('jg_smiliesupport')) { $smileys = JoomHelper::getSmileys(); foreach ($smileys as $i => $sm) { $text = str_replace($i, '<img src="' . $sm . '" border="0" alt="' . $i . '" title="' . $i . '" />', $text); } } $comments[$key]->text = $text; } $this->assignRef('comments', $comments); } } else { $params->set('no_comments_message', JText::_('COM_JOOMGALLERY_DETAIL_COMMENTS_NOT_FOR_UNREG')); } } if ($this->_config->get('jg_send2friend')) { $params->set('show_send2friend_block', 1); if ($this->_user->get('id')) { $params->set('show_send2friend_form', 1); } else { $params->set('send2friend_message', JText::_('COM_JOOMGALLERY_DETAIL_LOGIN_FIRST')); } } } $icons = $this->_mainframe->triggerEvent('onJoomDisplayIcons', array('detail.image', $image)); $event->icons = implode('', $icons); $afterDisplay = $this->_mainframe->triggerEvent('onJoomAfterDisplayDetailImage', array($image)); $event->afterDisplay = implode('', $afterDisplay); // Set redirect url used in editor links to redirect back to favourites view after edit/delete $redirect = '&redirect=' . base64_encode(JFactory::getURI()->toString()); $this->assignRef('params', $params); $this->assignRef('pagination', $pagination); $this->assignRef('image', $image); $this->assignRef('images', $images); $this->assignRef('extra', $extra); $this->assignRef('slideshow', $slideshow); $this->assignRef('slider', $slider); $this->assignRef('toggler', $toggler); $this->assignRef('pathway', $pathway); $this->assignRef('modules', $modules); $this->assignRef('event', $event); $this->assignRef('backtarget', $backtarget); $this->assignRef('backtext', $backtext); $this->assignRef('numberofpics', $numbers[0]); $this->assignRef('numberofhits', $numbers[1]); $this->assignRef('redirect', $redirect); $this->_doc->addScript($this->_ambit->getScript('detail.js')); parent::display($tpl); }
/** * Method to send a report * * @param string $redirect_url Internal URL to the page on which the report was send * @return boolean Redirect URL on success, false otherwise * @since 2.1 */ public function send($redirect_url = 'index.php') { $id = JRequest::getInt('id'); if (!$id) { $this->setError(JText::_('COM_JOOMGALLERY_COMMON_NO_IMAGE_SPECIFIED')); return false; } // Do some security checks if (!$this->_config->get('jg_report_images') || !$this->_config->get('jg_report_unreg') && !$this->_user->get('id')) { $msg = JText::_('JERROR_ALERTNOAUTHOR'); if (!$this->_user->get('id')) { $msg .= JText::_('COM_JOOMGALLERY_COMMON_MSG_YOU_ARE_NOT_LOGGED'); } $this->setError($msg); return false; } if (!$this->_user->get('id')) { $fromname = $this->_mainframe->getUserStateFromRequest('report.image.name', 'name', '', 'post'); $from = $this->_mainframe->getUserStateFromRequest('report.image.email', 'email', '', 'post'); } else { $fromname = $this->_config->get('jg_realname') ? $this->_user->get('name') : $this->_user->get('username'); $from = $this->_user->get('id'); } $report = $this->_mainframe->getUserStateFromRequest('report.image.report', 'report', '', 'post'); if (!$report || !$fromname || !$from) { $this->setError(JText::_('COM_JOOMGALLERY_COMMON_MSG_FORM_NOT_FILLED')); return false; } // Captcha $valid = true; $msg = ''; $plugins = $this->_mainframe->triggerEvent('onJoomCheckCaptcha'); foreach ($plugins as $key => $result) { if (is_array($result) && isset($result['valid']) && !$result['valid']) { $valid = false; if (isset($result['error']) && $result['error']) { $msg = $result['error']; } else { $msg = JText::_('COM_JOOMGALLERY_COMMON_MSG_SECURITY_CODE_WRONG'); } break; } } if (!$valid) { $this->setError($msg); return false; } // Prepare links $image = $this->_ambit->getImgObject($id); $link = JRoute::_($redirect_url); $img_src = JRoute::_($this->_ambit->getImg('img_url', $image)); $current_uri = JURI::getInstance(JURI::base()); $current_host = $current_uri->toString(array('scheme', 'host', 'port')); // Ensure that the correct host and path is prepended $uri = JFactory::getUri($link); $uri->setHost($current_host); $link = $uri->toString(); $uri = JFactory::getUri($img_src); $uri->setHost($current_host); $img_src = $uri->toString(); $text = JText::sprintf('COM_JOOMGALLERY_REPORT_IMAGE_BODY', $image->id, $image->imgtitle, $fromname, $from, $link, $img_src, $report); $subject = JText::sprintf('COM_JOOMGALLERY_REPORT_IMAGE_SUBJECT', $this->_mainframe->getCfg('sitename')); // Create the message require_once JPATH_COMPONENT . '/helpers/messenger.php'; $messenger = new JoomMessenger(); $message = array('from' => $from, 'fromname' => $fromname, 'subject' => $subject, 'body' => $text, 'mode' => 'report'); // Message to image owner if ($this->_config->get('jg_msg_report_toowner')) { $messenger->addRecipients($image->owner); } // Send the message if (!$messenger->send($message)) { $this->setError(JText::_('COM_JOOMGALLERY_COMMON_REPORT_NOT_SENT')); return false; } // Delete data in session $this->_mainframe->setUserState('report.image', null); $this->_mainframe->triggerEvent('onJoomAfterReport', array($message)); return true; }
/** * getApp * * @return string */ protected function getApp() { $root = JFactory::getUri()->root(); $platform = F0FPlatform::getInstance(); $key = $this->getAppKey(); $file = $platform->getCache($key); $cached = true; $expiration = EParameter::getExpiration(); if (empty($file) || !file_exists($file) || filectime($file) < $expiration) { $cached = false; $file = $this->_getOptimizedApp($this->appDependencies, $this->appPaths); } $url = $root . str_replace(JPATH_ROOT . DIRECTORY_SEPARATOR, '', $file); $jsapp = '<script src="' . $root . 'media/lib_extly/js/require/require.min.js"></script>' . "\n"; $jsapp .= '<script src="' . $url . ($this->version ? '?' . $this->version : '') . '" ></script>' . "\n"; $jsapp .= $this->_generateRequire($key); $this->addPostRequireHook($jsapp); if (!$cached) { $platform->setCache($key, $file); } return $jsapp; }
/** * Utility Function: * Force backend specific redirestions like joomla category management and joomla article management to the * respective managers of FLEXIcontent. Some configured exclusions and special case exceptions are checked here * * @access public * @return void */ function redirectAdminComContent() { $jinput = JFactory::getApplication()->input; $app = JFactory::getApplication(); $user = JFactory::getUser(); $option = $jinput->get('option', '', 'cmd'); $view = $jinput->get('view', '', 'cmd'); $task = $jinput->get('task', '', 'string'); $_ct = explode('.', $task); $task = $_ct[count($_ct) - 1]; if (count($_ct) > 1) { $controller = $_ct[0]; } // NOTE: in J1.6+, a user can be assigned multiple groups, so we need to retrieve them $usergroups = $user->get('groups'); $usergroups = is_array($usergroups) ? $usergroups : array(); $usergroups = array_keys($usergroups); // Get user groups excluded from redirection $exclude_cats = $this->params->get('exclude_redirect_cats', array()); $exclude_arts = $this->params->get('exclude_redirect_articles', array()); // Get URLs excluded from redirection $excluded_urls = $this->params->get('excluded_redirect_urls'); $excluded_urls = preg_split("/[\\s]*%%[\\s]*/", $excluded_urls); if (empty($excluded_urls[count($excluded_urls) - 1])) { unset($excluded_urls[count($excluded_urls) - 1]); } // Get current URL $uri = JFactory::getUri(); // First check excluded urls foreach ($excluded_urls as $excluded_url) { $quoted = preg_quote($excluded_url, "#"); if (preg_match("#{$quoted}#", $uri)) { return false; } } if (!empty($option)) { // if try to access com_content you get redirected to Flexicontent items if ($option == 'com_content') { // Check if a user group is groups, that are excluded from article redirection if (count(array_intersect($usergroups, $exclude_arts))) { return false; } // Default (target) redirection url $redirectURL = 'index.php?option=' . $this->extension; // Get request variables used to determine whether to apply redirection $layout = $jinput->get('layout', '', 'cmd'); $function = $jinput->get('function', '', 'cmd'); // *** Specific Redirect Exclusions *** //--. (J2.5 only) Selecting Joomla article for menu item if ($layout == "modal" && ($function = "jSelectArticle_jform_request_id")) { return false; } //--. JA jatypo (editor-xtd plugin button for text style selecting) if ($jinput->get('jatypo', '', 'cmd') != "" && $layout == "edit") { return false; } //--. Allow listing featured backend management if ($view == "featured") { return false; } //return false; // for testing if ($task == 'add') { $redirectURL .= '&task=items.add'; } else { if ($task == 'edit') { $cid = JRequest::getVar('id'); $cid = $cid ? $cid : JRequest::getVar('cid'); $redirectURL .= '&task=items.edit&cid=' . intval(is_array($cid) ? $cid[0] : $cid); } else { if ($task == 'element') { $redirectURL .= '&view=itemelement&tmpl=component&object=' . JRequest::getVar('object', ''); } else { $redirectURL .= '&view=items'; } } } // Apply redirection $app->redirect($redirectURL, ''); return false; } elseif ($option == 'com_categories') { // Check if a user group is groups, that are excluded from category redirection if (count(array_intersect($usergroups, $exclude_cats))) { return false; } // Get request variables used to determine whether to apply redirection $category_scope = JRequest::getVar('extension'); // Apply redirection if in com_categories is in content scope if ($category_scope == 'com_content') { if ($task == 'add') { $redirectURL .= 'index.php?option=' . $this->extension . '&task=category.add&extension=' . $this->extension; } else { if ($task == 'edit') { $cid = JRequest::getVar('id'); $cid = $cid ? $cid : JRequest::getVar('cid'); $redirectURL .= 'index.php?option=' . $this->extension . '&task=category.edit&cid=' . intval(is_array($cid) ? $cid[0] : $cid); } else { $redirectURL = 'index.php?option=' . $this->extension . '&view=categories'; } } $app->redirect($redirectURL, ''); } return false; } } }
</tr> <?php for ($i = 0; $i < count($this->subdomains); $i++) { ?> <tr class="row<?php echo $i % 2; ?> "> <td valign="top"><input class="inputbox" type="text" name="subdomain_title[<?php echo $i; ?> ]" size="10" value="<?php echo $this->subdomains[$i]->subdomain; ?> "/>.<?php echo JFactory::getUri()->getHost(); ?> <td valign="top"><?php echo $this->subdomains[$i]->Itemid; ?> </td> <td valign="top"><?php echo $this->subdomains[$i]->Itemid_titlepage; ?> </td> <td valign="top"><?php echo $this->lists['subdomains_remove']; ?> </td> </tr> <?php
protected static function _link($link, &$field, &$config) { $app = JFactory::getApplication(); $custom = $link->get('custom', ''); $form = $link->get('form', ''); $edit = $link->get('form_edition', 1); $edit = !$form && $edit ? '&id=' . $config['pk'] : ''; $form = $form ? $form : $config['type']; $itemId = $link->get('itemid', $app->input->getInt('Itemid', 0)); $redirection = $link->get('redirection', ''); $uri = (string) JFactory::getUri(); if (strpos($uri, 'format=raw&infinite=1') !== false) { $return = $app->input->get('return'); } else { $return = base64_encode($uri); } if (!$form) { return; } // Check if ($edit != '') { static $cache = array(); $stage = $link->get('form_edition_stage', ''); if ($stage != '') { $edit .= '&stage=' . (int) $stage; } $user = JCck::getUser(); $canEdit = $user->authorise('core.edit', 'com_cck.form.' . $config['type_id']); // if ( $user->id && !$user->guest ) { $canEditOwn = $user->authorise('core.edit.own', 'com_cck.form.' . $config['type_id']); // } else { // $canEditOwn = false; // todo: guest // } $canEditOwnContent = ''; // canEditOwnContent jimport('cck.joomla.access.access'); $canEditOwnContent = CCKAccess::check($user->id, 'core.edit.own.content', 'com_cck.form.' . $config['type_id']); if ($canEditOwnContent) { $field2 = JCckDatabaseCache::loadObject('SELECT storage, storage_table, storage_field FROM #__cck_core_fields WHERE name = "' . $canEditOwnContent . '"'); $canEditOwnContent = false; if (is_object($field2) && $field2->storage == 'standard') { $pks = isset($config['pks']) ? $config['pks'] : $config['pk']; $query = 'SELECT ' . $field2->storage_field . ' as map, id FROM ' . $field2->storage_table . ' WHERE id IN (' . $pks . ')'; $index = md5($query); if (!isset($cache[$index])) { $cache[$index . '_pks'] = JCckDatabase::loadObjectList($query, 'id'); $values = array(); if (count($cache[$index . '_pks'])) { foreach ($cache[$index . '_pks'] as $p) { $values[] = $p->map; } } $values = count($values) ? implode(',', $values) : '0'; $cache[$index] = JCckDatabase::loadObjectList('SELECT author_id, pk FROM #__cck_core WHERE storage_location = "joomla_article" AND pk IN ( ' . $values . ' )', 'pk'); } if (isset($cache[$index . '_pks'][$config['pk']]) && isset($cache[$index][$cache[$index . '_pks'][$config['pk']]->map]) && $cache[$index][$cache[$index . '_pks'][$config['pk']]->map]->author_id == $user->get('id')) { $canEditOwnContent = true; } } } else { $canEditOwnContent = ''; } // Check Permissions if (!($canEdit && $canEditOwn || $canEdit && !$canEditOwn && $config['author'] != $user->get('id') || $canEditOwn && $config['author'] == $user->get('id') || $canEditOwnContent)) { if (!$link->get('no_access', 0)) { $field->display = 0; } return; } } elseif ($form != '') { $user = JCck::getUser(); $type_id = (int) JCckDatabase::loadResult('SELECT id FROM #__cck_core_types WHERE name = "' . $form . '"'); $canCreate = $type_id ? $user->authorise('core.create', 'com_cck.form.' . $type_id) : false; // Check Permissions if (!$canCreate) { return; } } // Prepare $link_class = $link->get('class', ''); $link_rel = $link->get('rel', ''); $link_target = $link->get('target', ''); $link_title = $link->get('title', ''); $link_title2 = $link->get('title_custom', ''); $tmpl = $link->get('tmpl', ''); $tmpl = $tmpl ? '&tmpl=' . $tmpl : ''; $vars = $tmpl; // + live /* if ( $config['client'] == 'admin' || $config['client'] == 'site' || $config['client'] == 'search' ) { $redirection = '-1'; // todo } */ // Set if (is_array($field->value)) { foreach ($field->value as $f) { $c = $custom; $c = parent::g_getCustomSelfVars(self::$type, $f, $c, $config); $c = $c ? '&' . $c : ''; $f->link = 'index.php?option=com_cck&view=form&layout=edit&type=' . $form . $edit . $vars . '&Itemid=' . $itemId . $c; if ($redirection != '-1') { $f->link .= '&return=' . $return; } $f->link = JRoute::_($f->link); $f->link_class = $link_class ? $link_class : (isset($f->link_class) ? $f->link_class : ''); $f->link_rel = $link_rel ? $link_rel : (isset($f->link_rel) ? $f->link_rel : ''); $f->link_state = $link->get('state', 1); $f->link_target = $link_target ? $link_target : (isset($f->link_target) ? $f->link_target : ''); $f->link_title = $link_title ? $link_title == '2' ? $link_title2 : (isset($f->link_title) ? $f->link_title : '') : ''; } $field->link = '#'; //todo } else { $custom = parent::g_getCustomVars(self::$type, $field, $custom, $config); $field->link = JRoute::_('index.php?option=com_cck&view=form&layout=edit&type=' . $form . $edit . $vars . '&Itemid=' . $itemId); $separator = strpos($field->link, '?') !== false ? '&' : '?'; if ($custom) { $field->link .= $separator . $custom; $separator = '&'; } if ($redirection != '-1') { $field->link .= $separator . 'return=' . $return; } $field->link_class = $link_class ? $link_class : (isset($field->link_class) ? $field->link_class : ''); $field->link_rel = $link_rel ? $link_rel : (isset($field->link_rel) ? $field->link_rel : ''); $field->link_state = $link->get('state', 1); $field->link_target = $link_target ? $link_target : (isset($field->link_target) ? $field->link_target : ''); $field->link_title = $link_title ? $link_title == '2' ? $link_title2 : (isset($field->link_title) ? $field->link_title : '') : ''; } }
protected function _opengraph() { $app =& JFactory::getApplication(); $document =& Jfactory::getDocument(); $uri =& JFactory::getUri(); $params = $app->getParams('com_redevent'); $row = $this->row; if ($params->get('fbadmin')) { $document->addCustomTag('<meta property="fb:admins" content="' . $params->get('fbadmin') . '"/>'); } $document->addScript('http://connect.facebook.net/en_US/all.js#xfbml=1'); }
<?php /** * @package Joomla.Administrator * @subpackage Template.hathor * * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; // Include the component HTML helpers. JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); // Load the tooltip behavior. JHtml::_('behavior.tooltip'); JHtml::_('behavior.multiselect'); $uri = JFactory::getUri(); $return = base64_encode($uri); $user = JFactory::getUser(); $userId = $user->get('id'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); ?> <script type="text/javascript"> Joomla.submitbutton = function(task) { if (task != 'menus.delete' || confirm('<?php echo JText::_('COM_MENUS_MENU_CONFIRM_DELETE', true); ?> ')) { Joomla.submitform(task); } }
/** * Moderate new user */ private function moderateUser() { // Call function only for guests // Call only for $_POST with variables if (JFactory::getUser()->id || $_SERVER['REQUEST_METHOD'] != 'POST') { return false; } $post = $_POST; $ver = new JVersion(); if (strcmp($ver->RELEASE, '1.5') <= 0) { $post_name = isset($post['name']) ? $post['name'] : null; $post_username = isset($post['username']) ? $post['username'] : null; $post_email = isset($post['email']) ? $post['email'] : null; } else { $post_name = isset($post['name']) ? $post['name'] : (isset($post['jform']['name']) ? $post['jform']['name'] : null); $post_username = isset($post['username']) ? $post['username'] : (isset($post['jform']['username']) ? $post['jform']['username'] : null); $post_email = isset($post['email']) ? $post['email'] : (isset($post['jform']['email1']) ? $post['jform']['email1'] : null); } $session = JFactory::getSession(); $submit_time = $this->submit_time_test(); $checkjs = $this->get_ct_checkjs(); $sender_info = $this->get_sender_info(); $sender_info = json_encode($sender_info); if ($sender_info === false) { $sender_info = ''; } self::getCleantalk(); $ctResponse = self::ctSendRequest('check_newuser', array('sender_ip' => self::$CT->ct_session_ip($_SERVER['REMOTE_ADDR']), 'sender_email' => $post_email, 'sender_nickname' => $post_username, 'submit_time' => $submit_time, 'js_on' => $checkjs, 'sender_info' => $sender_info)); if (!empty($ctResponse) && is_array($ctResponse)) { if ($ctResponse['allow'] == 0) { if ($ctResponse['errno'] != 0) { $this->sendAdminEmail("CleanTalk plugin", $ctResponse['comment']); } else { $session->set('ct_register_form_data', $post); $app =& JFactory::getApplication(); $app->enqueueMessage($ctResponse['comment'], 'error'); $uri =& JFactory::getUri(); $redirect = $uri->toString(); // OPC if (isset($_POST['return'])) { $redirect_opc = base64_decode($_POST['return']); $u =& JURI::getInstance($redirect); $u_opc =& JURI::getInstance($redirect_opc); if ($u->getHost() == $u_opc->getHost()) { $app->redirect(base64_decode($_POST['return'])); die; } } $redirect = str_replace('?task=registration.register', '', $redirect); $app->redirect($redirect); die; } } else { $comment = self::$CT->addCleantalkComment("", $ctResponse['comment']); $hash = self::$CT->getCleantalkCommentHash($comment); $session->set('register_username', $post_username); $session->set('register_email', $post_email); $session->set('ct_request_id', $hash); } } }