function shAkeebasubsMenuName($task, $Itemid, $option, $shLangName) { $sefConfig =& shRouter::shGetConfig(); $shArsDownloadName = shGetComponentPrefix($option); if (empty($shArsDownloadName)) { $shArsDownloadName = getMenuTitle($option, $task, $Itemid, null, $shLangName); } if (empty($shArsDownloadName) || $shArsDownloadName == '/') { $shArsDownloadName = 'AkeebaReleaseSystem'; } return str_replace('.', $sefConfig->replacement, $shArsDownloadName); }
$shLangIso = ''; $title = array(); $shItemidString = ''; $dosef = shInitializePlugin($lang, $shLangName, $shLangIso, $option); if ($dosef == false) { return; } // ------------------ standard plugin initialize function - don't change --------------------------- // ------------------ load language file - adjust as needed ---------------------------------------- $shLangIso = shLoadPluginLanguage('', $shLangIso, ''); // ------------------ load language file - adjust as needed ---------------------------------------- // shumisha : insert component name from menu $task = isset($task) ? @$task : null; $Itemid = isset($Itemid) ? @$Itemid : null; $shRsGallery2Name = shGetComponentPrefix($option); $shRsGallery2Name = empty($shRsGallery2Name) ? getMenuTitle($option, $task, $Itemid, null, $shLangName) : $shRsGallery2Name; $shRsGallery2Name = empty($shRsGallery2Name) || $shRsGallery2Name == '/' ? 'RSGallery1' : $shRsGallery2Name; if ($sefConfig->shInsertRsGallery2Name && !empty($shRsGallery2Name)) { $title[] = $shRsGallery2Name; } //load gallery name if (isset($catid)) { $query_gal = "\r\n\t\tSELECT `name`\r\n\t\tFROM `#__rsgallery2_galleries`\r\n\t\tWHERE `id` = '{$catid}'\r\n\t\t"; $database->setQuery($query_gal); $gallery = $database->loadResult(); } //load imagename if (isset($limitstart)) { $order = $limitstart + 1; } if (isset($order) && isset($catid)) {
} if (!empty($Itemid)) { shRemoveFromGETVarsList('Itemid'); } if (!empty($limit)) { shRemoveFromGETVarsList('limit'); } if (isset($limitstart)) { shRemoveFromGETVarsList('limitstart'); } // limitstart can be zero // start by inserting the menu element title (just an idea, this is not required at all) $view = isset($view) ? @$view : null; $Itemid = isset($Itemid) ? @$Itemid : null; $shName = shGetComponentPrefix($option); $shName = empty($shName) ? getMenuTitle($option, '', $Itemid, null, $shLangName) : $shName; $shName = empty($shName) || $shName == '/' ? 'jea' : $shName; switch ($view) { case 'properties': if (!empty($id)) { shRemoveFromGETVarsList('id'); } $title[] = $shName; if (!empty($id)) { $q = 'SELECT p.id AS id, ttype.value AS type, ttown.value AS town FROM #__jea_properties AS p' . PHP_EOL . 'LEFT JOIN #__jea_types as ttype ON ttype.id = p.type_id' . PHP_EOL . 'LEFT JOIN #__jea_towns as ttown ON ttown.id = p.town_id' . PHP_EOL . 'WHERE p.id = ' . intval($id); $database->setQuery($q); $property = $database->loadObject(); $title[] = $id . '-' . $property->type . '--' . $property->town; } break; case 'manage':
// V 1.2.4.m } $task = isset($task) ? $task : null; $id = isset($id) ? $id : null; $agent_id = isset($agent_id) ? $agent_id : null; $limit = isset($limit) ? $limit : null; $limitstart = isset($limitstart) ? $limitstart : null; // $search // not processed, passed as GET var // $type // not processed, passed as GET var // $search_id // not processed, passed as GET var // shumisha : insert component name from menu // Configuration variable $shInsertHotPropName = true; // if yes, name is inserted $shHotPropName = shGetComponentPrefix($option); $shHotPropName = empty($shHotPropName) ? getMenuTitle($option, null, $Itemid, null, $shLangName) : $shHotPropName; //$shHotPropName = (empty($shHotPropName) || $shHotPropName == '/') ? 'Directory':$shHotPropName; // V 1.2.4.t if ($shInsertHotPropName && !empty($shHotPropName)) { $title[] = $shHotPropName; } switch ($task) { # View Property case 'view': if (is_numeric($id)) { $database->setQuery("SELECT t.id,t.name AS type_name, p.id, p.name AS property_name FROM #__hp_properties AS p" . "\nLEFT JOIN #__hp_prop_types AS t ON p.type = t.id" . "\nWHERE p.id = " . $database->Quote($id) . "\nLIMIT 1"); if (shTranslateUrl($option, $shLangName)) { $row = $database->loadObject(); } else { $row = $database->loadObject(false); } $title[] = $sh_LANG[$shLangIso]['_HP_SEF_PROPERTY'];
function xmapShowNavigatorLinks($config) { require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'XmapNav.php'; require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'XmapPlugins.php'; require_once JPATH_SITE . DS . 'includes' . DS . 'application.php'; # DEBUG ini_set('display_errors', 1); error_reporting(E_ALL); # DEBUG $sitemapid = JRequest::getInt('sitemap', 0); $link = urldecode(JRequest::getVar('link', '')); $name = JRequest::getCmd('e_name', ''); $Itemid = JRequest::getInt('Itemid'); if (!$sitemapid) { $sitemapid = $config->sitemap_default; } $sitemap = new XmapSitemap($database); if (!$sitemap->load($sitemapid)) { echo _XMAP_INVALID_SITEMAP; return false; } $menus = $sitemap->getMenus(); $list = array(); // Show the menu items if (!$link && !$Itemid) { foreach ($menus as $menutype => $menu) { $node = new stdclass(); $menu->id = 0; $menu->menutype = $menutype; $node->uid = $menu->uid = "menu" . $menu->id; $node->menutype = $menutype; $node->ordering = $menu->ordering; $node->priority = $menu->priority; $node->changefreq = $menu->changefreq; $node->browserNav = 3; $node->type = 'separator'; if (!($node->name = getMenuTitle($menutype, @$menu->module))) { $node->name = $menutype; } $node->link = '-menu-' . $menutype; $node->expandible = true; $node->selectable = false; //$node->name = $this->getMenuTitle($menutype,@$menu->module); // get the mod_mainmenu title from modules table $list[] = $node; } } else { $nav = new XmapNav($config, $sitemap); $extensions = XmapPlugins::loadAvailablePlugins(); $parent = new stdClass(); if ($Itemid) { $items =& JSite::getMenu(); $item =& $items->getItem($Itemid); if (isset($menus[$item->menutype])) { $parent->name = $item->name; $parent->id = $item->id; $parent->uid = 'itemid' . $item->id; $parent->link = $link; $parent->type = $item->type; $parent->browserNav = $item->browserNav; $parent->priority = $menus[$item->menutype]->priority; $parent->changefreq = $menus[$item->menutype]->changefreq; $parent->menutype = $item->menutype; $parent->selectable = false; $parent->expandible = true; } } else { $parent->id = 0; $parent->link = $link; } $list = $nav->expandLink($parent, $extensions); } XmapAdminHtml::showNavigatorLinks($sitemapid, $list, $name); }
function getContentTitles($view, $id, $layout, $Itemid = 0, $shLang = null, $sefConfig = null) { global $shMosConfig_locale; // if config is not injected, get default one if (is_null($sefConfig)) { $sefConfig =& shRouter::shGetConfig(); } $id = empty($id) ? 0 : intval($id); // get DB $database =& JFactory::getDBO(); $title = array(); $shLang = empty($shLang) ? $shMosConfig_locale : $shLang; $sql = ''; $catField = $sefConfig->useCatAlias ? 'alias' : 'title'; $secField = $sefConfig->useSecAlias ? 'alias' : 'title'; switch ($view) { case 'section': if (empty($layout) || $layout != 'blog') { $shTemp = getMenuTitle(null, $view, isset($Itemid) ? @$Itemid : null, '', $shLang); if ($sefConfig->shInsertContentTableName) { if (!empty($sefConfig->shContentTableName)) { $title[] = $sefConfig->shContentTableName; } else { if (!empty($shTemp)) { $title[] = $shTemp; } } } if (!empty($id)) { $sql = "SELECT " . $secField . " AS section" . (shTranslateURL('com_content', $shLang) ? ',id' : '') . " FROM #__sections WHERE id={$id}"; if ($secField != 'title') { $database->setQuery($sql); $sa = $database->loadResult(); if (empty($sa)) { $secField = 'title'; } } } else { if (!$sefConfig->shInsertContentTableName || !empty($sefConfig->shContentTableName)) { if (!empty($shTemp)) { $title[] = $shTemp; } } } } else { // blog section $shTemp = getMenuTitle(null, $view, isset($Itemid) ? @$Itemid : null, '', $shLang); // v 1.2.4.t if ($sefConfig->shInsertContentBlogName) { if (!empty($sefConfig->shContentBlogName)) { $title[] = $sefConfig->shContentBlogName; } else { if (!empty($shTemp)) { $title[] = $shTemp; } } } if (!empty($id)) { $sql = "SELECT " . $secField . " AS section" . (shTranslateURL('com_content', $shLang) ? ',id' : '') . " FROM #__sections WHERE id={$id}"; if ($secField != 'title') { $database->setQuery($sql); $sa = $database->loadResult(); if (empty($sa)) { $secField = 'title'; } } } else { if (!$sefConfig->shInsertContentBlogName || !empty($sefConfig->shContentBlogName)) { if (!empty($shTemp)) { $title[] = $shTemp; } } } } break; case 'category': // V 1.2.4.s added instead of inserting /Table if (empty($layout) || $layout != 'blog') { $shTemp = getMenuTitle(null, $view, isset($Itemid) ? @$Itemid : null, '', $shLang); if ($sefConfig->shInsertContentTableName) { if (!empty($sefConfig->shContentTableName)) { $title[] = $sefConfig->shContentTableName; } else { if (!empty($shTemp)) { $title[] = $shTemp; } } } if (!empty($id)) { // V x : apply ShowSection param if ($sefConfig->ShowSection == true && SH404SEF_COMPAT_SHOW_SECTION_IN_CAT_LINKS) { // V 1.2.4.m if displaying a category or a category blog $sql = 'SELECT s.' . $secField . ' AS section' . (shTranslateURL('com_content', $shLang) ? ',s.id AS secid ' : '') . ', c.' . $catField . ' AS category' . (shTranslateURL('com_content', $shLang) ? ',c.id as catid' : '') . ' FROM #__categories as c ' . 'LEFT JOIN #__sections AS s ' . 'ON c.section=s.id ' . 'WHERE c.id=' . $id; } else { $sql = "SELECT " . $catField . " AS category" . (shTranslateURL('com_content', $shLang) ? ',id' : '') . " FROM #__categories WHERE id={$id}"; if ($catField != 'title') { $database->setQuery($sql); $sa = $database->loadResult(); if (empty($sa)) { $catField = 'title'; } } } } else { if (!$sefConfig->shInsertContentTableName || !empty($sefConfig->shContentTableName)) { if (!empty($shTemp)) { $title[] = $shTemp; } } } } else { // blog category $shTemp = getMenuTitle(null, $view, isset($Itemid) ? @$Itemid : null, '', $shLang); // V 1.2.4.t if ($sefConfig->shInsertContentBlogName) { if (!empty($sefConfig->shContentBlogName)) { $title[] = $sefConfig->shContentBlogName; } else { if (!empty($shTemp)) { $title[] = $shTemp; } } } if (!empty($id)) { // if several cat in blogcategory, then id==0, so we don't get in here // V 1.2.4.m if displaying a category or a category blog, we now disregard the // $sefConfig->ShowCat param, as this would cause issue if set to false if ($sefConfig->ShowSection == true) { // V 1.2.4.m if displaying a category or a category blog $sql = "SELECT s." . $secField . " AS section" . (shTranslateURL('com_content', $shLang) ? ',s.id AS secid ' : '') . ", c." . $catField . " AS category" . (shTranslateURL('com_content', $shLang) ? ',c.id as catid' : '') . " FROM #__categories as c " . "LEFT JOIN #__sections AS s " . "ON c.section=s.id " . "WHERE c.id={$id}"; } else { $sql = "SELECT " . $catField . " AS category" . (shTranslateURL('com_content', $shLang) ? ',id' : '') . " FROM #__categories WHERE id={$id}"; if ($catField != 'title') { $database->setQuery($sql); $sa = $database->loadResult(); if (empty($sa)) { $catField = 'title'; } } } } else { // V 1.2.4.m if blogcategory with more than one category, then use getMenuTitle() instead if (!$sefConfig->shInsertContentBlogName || !empty($sefConfig->shContentBlogName)) { if (!empty($shTemp)) { $title[] = $shTemp; } } } } break; case 'article': if (!empty($id)) { if ($sefConfig->UseAlias == true) { // verify title alias is not empty $database->setQuery("SELECT alias" . (shTranslateURL('com_content', $shLang) ? ',id' : '') . " FROM #__content WHERE id={$id}"); if ($ta = $database->loadResult()) { $title_field = "alias"; } else { $title_field = "title"; } } else { $title_field = "title"; } if ($sefConfig->ShowSection == true || $sefConfig->ShowCat == false) { $sql = "SELECT " . ($sefConfig->ShowSection == true ? "s." . $secField . " AS section" . (shTranslateURL('com_content', $shLang) ? ',s.id AS secid, ' : ', ') : "") . " " . ($sefConfig->ShowCat == false ? "" : "c." . $catField . " AS category" . (shTranslateURL('com_content', $shLang) ? ',c.id AS catid' : '') . ', ') . " a." . $title_field . " AS title" . (shTranslateURL('com_content', $shLang) ? ',a.id as id' : '') . " FROM #__content as a " . "LEFT JOIN #__sections AS s " . "ON a.sectionid=s.id " . "LEFT JOIN #__categories AS c " . "ON a.catid=c.id " . "WHERE a.id={$id}"; } else { $sql = "SELECT " . ($sefConfig->ShowCat == false ? "" : "c." . $catField . " AS category" . (shTranslateURL('com_content', $shLang) ? ',c.id AS catid' : '') . ", ") . " a." . $title_field . " AS title" . (shTranslateURL('com_content', $shLang) ? ',a.id as id' : '') . " FROM #__content as a " . "LEFT JOIN #__categories AS c " . "ON a.catid=c.id " . "WHERE a.id={$id}"; } } break; case 'frontpage': // J 1.5 new view, com_frontpage deprecated. Processed in com_content SEF plugin // J 1.5 new view, com_frontpage deprecated. Processed in com_content SEF plugin default: $sql = ''; } if ($sql) { $row = null; $database->setQuery($sql); $shLangCode = $shLang; if (isset($shLang) && shIsMultilingual()) { // V 1.2.4.q can force language $row = $database->loadObject(true, $shLangCode); } else { $row = $database->loadObject(); } if (isset($row->section)) { $title[] = $row->section; } if (isset($row->category)) { $title[] = $row->category; } if (isset($row->title)) { $title[] = $row->title; } } if ($view == 'section') { $title[] = "/"; } if ($view == 'category') { $title[] = "/"; } return $title; }
function shSefRelToAbs($string, $shLanguageParam, &$uri, &$originalUri) { global $_SEF_SPACE, $shMosConfig_lang, $shMosConfig_locale, $mainframe, $shGETVars, $shRebuildNonSef, $shHomeLink; _log('Entering shSefRelToAbs with ' . $string . ' | Lang = ' . $shLanguageParam); // if superadmin, display non-sef URL, for testing/setting up purposes if (sh404SEF_NON_SEF_IF_SUPERADMIN) { $user = JFactory::getUser(); if ($user->usertype == 'Super Administrator') { _log('Returning non-sef because superadmin said so.'); return 'index.php'; } } // return unmodified anchors if (JString::substr($string, 0, 1) == '#') { // V 1.2.4.t return $string; } $sefConfig =& shRouter::shGetConfig(); $shPageInfo =& shRouter::shPageInfo(); // Quick fix for shared SSL server : if https, switch to non sef $id = shGetURLVar($string, 'Itemid', JRequest::getInt('Itemid')); $secure = !empty($shPageInfo->shHttpsSave) || 'yes' == shGetMenuItemSsl($id); if ($secure && $sefConfig->shForceNonSefIfHttps) { _log('Returning shSefRelToAbs : Forced non sef if https'); return shFinalizeURL($string); } $database =& JFactory::getDBO(); $shOrigString = $string; $shMosMsg = shGetMosMsg($string); // V x 01/09/2007 22:45:52 $string = shCleanUpMosMsg($string); // V x 01/09/2007 22:45:52 // V x : removed shJoomfish module. Now we set $mosConfi_lang here $shOrigLang = $shMosConfig_locale; // save current language $shLanguage = shGetURLLang($string); // target language in URl is always first choice if (empty($shLanguage)) { $shLanguage = !empty($shLanguageParam) ? $shLanguageParam : $shMosConfig_locale; } // V 1.3.1 protect against those drop down lists if (strpos($string, 'this.options[selectedIndex].value') !== false) { $string .= '&lang=' . shGetIsoCodeFromName($shLanguage); return $string; } $shMosConfig_locale = $shLanguage; _log('Language used : ' . $shLanguage); // V 1.2.4.t workaround for old links like option=compName instead of option=com_compName if (strpos(strtolower($string), 'option=login') === false && strpos(strtolower($string), 'option=logout') === false && strpos(strtolower($string), 'option=&') === false && JString::substr(strtolower($string), -7) != 'option=' && strpos(strtolower($string), 'option=cookiecheck') === false && strpos(strtolower($string), 'option=') !== false && strpos(strtolower($string), 'option=com_') === false) { $string = str_replace('option=', 'option=com_', $string); } // V 1.2.4.k added homepage check : needed in case homepage is not com_frontpage if (empty($shHomeLink)) { // first, find out about homepage link, from DB. homepage is not always /index.php or similar // it can be a link to anything, a page, a component,... $menu =& shRouter::shGetMenu(); $shHomePage =& $menu->getDefault(); if ($shHomePage) { if (JString::substr($shHomePage->link, 0, 9) == 'index.php' && !preg_match('/Itemid=[0-9]*/', $shHomePage->link)) { // and it does not have an Itemid $shHomePage->link .= ($shHomePage->link == 'index.php' ? '?' : '&') . 'Itemid=' . $shHomePage->id; // then add itemid } $shHomeLink = $shHomePage->link; if (!strpos($shHomeLink, 'lang=')) { // V 1.2.4.q protect against not existing $shDefaultIso = shGetIsoCodeFromName(shGetDefaultLang()); $shSepString = JString::substr($shHomeLink, -9) == 'index.php' ? '?' : '&'; $shHomeLink .= $shSepString . 'lang=' . $shDefaultIso; } $shHomeLink = shSortUrl($shHomeLink); // $shHomeLink has lang info, whereas $homepage->link may or may not } _log('HomeLink = ' . $shHomeLink); } // V 1.2.4.j string to be appended to URL, but not saved to DB $shAppendString = ''; $shRebuildNonSef = array(); $shComponentType = ''; // V w initialize var to avoid notices if ($shHomeLink) { // now check URL against our homepage, so as to always return / if homepage $v1 = JString::ltrim(str_replace($GLOBALS['shConfigLiveSite'], '', $string), '/'); // V 1.2.4.m : remove anchor if any $v2 = explode('#', $v1); $v1 = $v2[0]; $shAnchor = isset($v2[1]) ? '#' . $v2[1] : ''; $shSepString = JString::substr($v1, -9) == 'index.php' ? '?' : '&'; $shLangString = $shSepString . 'lang=' . shGetIsoCodeFromName($shLanguage); if (!strpos($v1, 'lang=')) { $v1 .= $shLangString; } $v1 = str_replace('&', '&', shSortURL($v1)); // V 1.2.4.t check also without pagination info if (strpos($v1, 'limitstart=0') !== false) { // the page has limitstart=0 $stringNoPag = shCleanUpPag($v1); // remove paging info to be sure this is not homepage } else { $stringNoPag = null; } if ($v1 == $shHomeLink || $v1 == 'index.php' . $shLangString || $stringNoPag == $shHomeLink) { // V 1.2.4.t 24/08/2007 11:07:49 $shTemp = $v1 == $shHomeLink || shIsDefaultLang($shLanguage) ? '' : shGetIsoCodeFromName($shLanguage) . '/'; //10/08/2007 17:28:14 if (!empty($shMosMsg)) { // V x 01/09/2007 22:48:01 $shTemp .= '?' . $shMosMsg; } if (!empty($sefConfig->shForcedHomePage)) { // V 1.2.4.t $shTmp = $shTemp . $shAnchor; $ret = shFinalizeURL($sefConfig->shForcedHomePage . (empty($shTmp) ? '' : '/' . $shTmp)); if (empty($uri)) { // if no URI, append remaining vars directly to the string $ret .= $shAppendString; } else { shRebuildVars($shAppendString, $uri); } $shMosConfig_locale = $shOrigLang; _log('Returning shSefRelToAbs 1 with ' . $ret); return $ret; } else { $shRewriteBit = shIsDefaultLang($shLanguage) ? '/' : $sefConfig->shRewriteStrings[$sefConfig->shRewriteMode]; $ret = shFinalizeURL($GLOBALS['shConfigLiveSite'] . $shRewriteBit . $shTemp . $shAnchor); if (empty($uri)) { // if no URI, append remaining vars directly to the string $ret .= $shAppendString; } else { shRebuildVars($shAppendString, $uri); } $shMosConfig_locale = $shOrigLang; _log('Returning shSefRelToAbs 2 with ' . $ret); return $ret; } } } $newstring = str_replace($GLOBALS['shConfigLiveSite'] . '/', '', $string); // check for url to same site, but with SSL : Joomla 1.5 does not allow it yet //$liveSiteSsl = str_replace('http://', 'https://', $GLOBALS['shConfigLiveSite']); //$newStringSsl = str_replace($liveSiteSsl.'/', '', $string); $letsGo = JString::substr($newstring, 0, 9) == 'index.php' && strpos($newstring, 'this.options[selectedIndex\\].value') === false; $letsGoSsl = false; if ($letsGo || $letsGoSsl) { // Replace & character variations. $string = str_replace(array('&', '&'), array('&', '&'), $letsGo ? $newstring : $newStringSsl); $newstring = $string; // V 1.2.4.q $shSaveString = $string; // warning : must add &lang=xx (only if it does not exists already), so as to be able to recognize the SefURL in the db if it's there if (!strpos($string, 'lang=')) { $shSepString = JString::substr($string, -9) == 'index.php' ? '?' : '&'; $anchorTable = explode('#', $string); // V 1.2.4.m remove anchor before adding language $string = $anchorTable[0]; $string .= $shSepString . 'lang=' . shGetIsoCodeFromName($shLanguage) . (!empty($anchorTable[1]) ? '#' . $anchorTable[1] : ''); // V 1.2.4.m then stitch back anchor } $URI = new sh_Net_URL($string); // V 1.2.4.l need to save unsorted URL if (count($URI->querystring) > 0) { // Import new vars here. $option = null; $task = null; //$sid = null; V 1.2.4.s // sort GET parameters to avoid some issues when same URL is produced with options not // in the same order, ie index.php?option=com_virtuemart&category_id=3&Itemid=2&lang=fr // Vs index.php?category_id=3&option=com_virtuemart&Itemid=2&lang=fr ksort($URI->querystring); // sort URL array $string = shSortUrl($string); // now we are ready to extract vars $shGETVars = $URI->querystring; extract($URI->querystring, EXTR_REFS); } if (empty($option)) { // V 1.2.4.r protect against empty $option : we won't know what to do $shMosConfig_locale = $shOrigLang; _log('Returning shSefRelToAbs 3 with ' . $shOrigString); return $shOrigString; } // get plugin associated with the extension $extPlugin =& Sh404sefFactory::getExtensionPlugin($option); // get component type $shComponentType = $extPlugin->getComponentType(); $shOption = str_replace('com_', '', $option); //list of extension we always skip $alwaysSkip = array('jce', 'akeeba'); if (in_array($shOption, $alwaysSkip)) { $shComponentType = Sh404sefClassBaseextplugin::TYPE_SKIP; } // V 1.2.4.s : fallback to to JoomlaSEF if no extension available // V 1.2.4.t : this is too early ; it prevents manual custom redirect to be checked agains the requested non-sef URL _log('Component type = ' . $shComponentType); // is there a named anchor attached to $string? If so, strip it off, we'll put it back later. if ($URI->anchor) { $string = str_replace('#' . $URI->anchor, '', $string); } // V 1.2.4.m // shumisha special homepage processing (in other than default language) if (shIsHomePage($string) || $string == 'index.php') { $sefstring = ''; $urlType = shGetSefURLFromCacheOrDB($string, $sefstring); // still use it so we need it both ways if (($urlType == sh404SEF_URLTYPE_NONE || $urlType == sh404SEF_URLTYPE_404) && empty($showall) && (!empty($limit) || !isset($limit) && !empty($limitstart))) { $urlType = shGetSefURLFromCacheOrDB(shCleanUpPag($string), $sefstring); // V 1.2.4.t check also without page info //to be able to add pagination on custom //redirection or multi-page homepage if ($urlType != sh404SEF_URLTYPE_NONE && $urlType != sh404SEF_URLTYPE_404) { $sefstring = shAddPaginationInfo(@$limit, @$limitstart, @showall, 1, $string, $sefstring, null); // a special case : com_content does not calculate pagination right // for frontpage and blog, they include links shown at the bottom in the calculation of number of items // For instance, with joomla sample data, the frontpage has only 5 articles // but the view sets $limit to 9 !!! if ($option == 'com_content' && isset($layout) && $layout == 'blog' || $option == 'com_content' && isset($view) && $view == 'frontpage') { $listLimit = shGetDefaultDisplayNumFromURL($string, $includeBlogLinks = true); $string = shSetURLVar($string, 'limit', $listLimit); $string = shSortUrl($string); } // that's a new URL, so let's add it to DB and cache shAddSefUrlToDBAndCache($string, $sefstring, 0, $urlType); // created url must be of same type as original } if ($urlType == sh404SEF_URLTYPE_NONE || $urlType == sh404SEF_URLTYPE_404) { require_once sh404SEF_FRONT_ABS_PATH . 'sef_ext.php'; $sef_ext = new sef_404(); // Rewrite the URL now. // a special case : com_content does not calculate pagination right // for frontpage and blog, they include links shown at the bottom in the calculation of number of items // For instance, with joomla sample data, the frontpage has only 5 articles // but the view sets $limit to 9 !!! if ($option == 'com_content' && isset($layout) && $layout == 'blog' || $option == 'com_content' && isset($view) && $view == 'frontpage') { $listLimit = shGetDefaultDisplayNumFromURL($string, $includeBlogLinks = true); $string = shSetURLVar($string, 'limit', $listLimit); $string = shSortUrl($string); //$URI->addQueryString( 'limit', $listLimit); } $urlVars = is_array($URI->querystring) ? array_map('urldecode', $URI->querystring) : $URI->querystring; $sefstring = $sef_ext->create($string, $urlVars, $shAppendString, $shLanguage, $shOrigString, $originalUri); // V 1.2.4.s added original string } } else { if ($urlType == sh404SEF_URLTYPE_NONE || $urlType == sh404SEF_URLTYPE_404) { // not found but no $limit or $limitstart $sefstring = shGetIsoCodeFromName($shLanguage) . '/'; shAddSefUrlToDBAndCache($string, $sefstring, 0, sh404SEF_URLTYPE_AUTO); // create it } } // V 1.2.4.j : added $shAppendString to pass non sef parameters. For use with parameters that won't be stored in DB $ret = $GLOBALS['shConfigLiveSite'] . (empty($sefstring) ? '' : $sefConfig->shRewriteStrings[$sefConfig->shRewriteMode] . $sefstring); // not valid with 1.5 anymore ; //if (!empty($shMosMsg)) // V x 01/09/2007 22:48:01 // $ret .= (empty($shAppendString) || $sefConfig->shRewriteStrings[$sefConfig->shRewriteMode] == '/index.php?/' ? '?':'&').$shMosMsg; $ret = shFinalizeURL($ret); if (empty($uri)) { // if no URI, append remaining vars directly to the string $ret .= $shAppendString; } else { shRebuildVars($shAppendString, $uri); } $shMosConfig_locale = $shOrigLang; _log('Returning shSefRelToAbs 4 with ' . $ret); return $ret; } if (isset($option) && !($option == 'com_content' && @$task == 'edit') && strtolower($option) != 'com_sh404sef') { // V x 29/08/2007 23:19:48 // check also that option = com_content, otherwise, breaks some comp switch ($shComponentType) { case Sh404sefClassBaseextplugin::TYPE_SKIP: $sefstring = $shSaveString; // V 1.2.4.q : restore untouched URL, except anchor // which will be added later break; case Sh404sefClassBaseextplugin::TYPE_SIMPLE: /* case 'sh404SEFFallback': // v 1.2.4.t*/ // check for custom urls $sefstring = ''; $urlType = shGetSefURLFromCacheOrDB($string, $sefstring); // if no custom found, then build default url if ($urlType != sh404SEF_URLTYPE_CUSTOM) { // if not found then fall back to Joomla! SEF if (isset($URI)) { unset($URI); } $sefstring = 'component/'; $URI = new sh_Net_URL(shSortUrl($shSaveString)); if (count($URI->querystring) > 0) { foreach ($URI->querystring as $key => $value) { if (is_array($value)) { foreach ($value as $k => $v) { // fix for arrays, thanks doorknob $sefstring .= $key . '[' . $k . '],' . $v . '/'; } } else { $sefstring .= $key . ',' . $value . '/'; } } $sefstring = str_replace('option/', '', $sefstring); } } break; default: $sefstring = ''; // base case: $urlType = shGetSefURLFromCacheOrDB($string, $sefstring); // first special case. User may have customized paginated urls // this will be picked up by the line above, except if we're talking about // a category or section blog layout, where Joomla does not uses the correct // value for limit if (($urlType == sh404SEF_URLTYPE_NONE || $urlType == sh404SEF_URLTYPE_404) && empty($showall) && (!empty($limit) || !isset($limit) && !empty($limitstart))) { if ($option == 'com_content' && isset($layout) && $layout == 'blog' || $option == 'com_content' && isset($view) && $view == 'frontpage') { $listLimit = shGetDefaultDisplayNumFromURL($string, $includeBlogLinks = true); $tmpString = shSetURLVar($string, 'limit', $listLimit); $tmpString = shSortUrl($tmpString); $urlType = shGetSefURLFromCacheOrDB($tmpString, $sefstring); if ($urlType != sh404SEF_URLTYPE_NONE && $urlType != sh404SEF_URLTYPE_404) { // we found a match with pagination info! $string = $tmpString; } } } // now let's try again without any pagination at all if (($urlType == sh404SEF_URLTYPE_NONE || $urlType == sh404SEF_URLTYPE_404) && empty($showall) && (!empty($limit) || !isset($limit) && !empty($limitstart))) { $urlType = shGetSefURLFromCacheOrDB(shCleanUpPag($string), $sefstring); // search without pagination info if ($urlType != sh404SEF_URLTYPE_NONE && $urlType != sh404SEF_URLTYPE_404) { $sefstring = shAddPaginationInfo(@$limit, @$limitstart, @showall, 1, $string, $sefstring, null); // a special case : com_content does not calculate pagination right // for frontpage and blog, they include links shown at the bottom in the calculation of number of items // For instance, with joomla sample data, the frontpage has only 5 articles // but the view sets $limit to 9 !!! if ($option == 'com_content' && isset($layout) && $layout == 'blog' || $option == 'com_content' && isset($view) && $view == 'frontpage') { $listLimit = shGetDefaultDisplayNumFromURL($string, $includeBlogLinks = true); $string = shSetURLVar($string, 'limit', $listLimit); $string = shSortUrl($string); } // that's a new URL, so let's add it to DB and cache _log('Created url based on non paginated base url:' . $string); shAddSefUrlToDBAndCache($string, $sefstring, 0, $urlType); } } if ($urlType == sh404SEF_URLTYPE_NONE) { // If component has its own sef_ext plug-in included. $shDoNotOverride = in_array($shOption, $sefConfig->shDoNotOverrideOwnSef); if (shFileExists(sh404SEF_ABS_PATH . 'components/' . $option . '/sef_ext.php') && ($shDoNotOverride || !$shDoNotOverride && (!shFileExists(sh404SEF_ABS_PATH . 'components/com_sh404sef/sef_ext/' . $option . '.php') && !shFileExists(sh404SEF_ABS_PATH . 'components/' . $option . '/sef_ext/' . $option . '.php')))) { // Load the plug-in file. V 1.2.4.s changed require_once to include include_once sh404SEF_ABS_PATH . 'components/' . $option . '/sef_ext.php'; $_SEF_SPACE = $sefConfig->replacement; $comp_name = str_replace('com_', '', $option); $className = 'sef_' . $comp_name; $sef_ext = new $className(); // V x : added default string in params if (empty($sefConfig->defaultComponentStringList[$comp_name])) { $title[] = getMenuTitle($option, null, isset($Itemid) ? @$Itemid : null, null, $shLanguage); } else { $title[] = $sefConfig->defaultComponentStringList[$comp_name]; } // V 1.2.4.r : clean up URL BEFORE sending it to sef_ext files, to have control on what they do // remove lang information, we'll put it back ourselves later //$shString = preg_replace( '/(&|\?)lang=[a-zA-Z]{2,3}/iU' ,'', $string); // V 1.2.4.t use original non-sef string. Some sef_ext files relies on order of params, which may // have been changed by sh404SEF $shString = preg_replace('/(&|\\?)lang=[a-zA-Z]{2,3}/iU', '', $shSaveString); $finalstrip = explode("|", $sefConfig->stripthese); $shString = str_replace('&', '&', $shString); _log('Sending to own sef_ext.php plugin : ' . $shString); $sefstring = $sef_ext->create($shString); _log('Created by sef_ext.php plugin : ' . $sefstring); $sefstring = str_replace("%10", "%2F", $sefstring); $sefstring = str_replace("%11", $sefConfig->replacement, $sefstring); $sefstring = rawurldecode($sefstring); if ($sefstring == $string) { if (!empty($shMosMsg)) { // V x 01/09/2007 22:48:01 $string .= '?' . $shMosMsg; } $ret = shFinalizeURL($string); $shMosConfig_locale = $shOrigLang; _log('Returning shSefRelToAbs 5 with ' . $ret); return $ret; } else { // V 1.2.4.p : sef_ext extensions for opensef/SefAdvance do not always replace ' $sefstring = str_replace('\'', $sefConfig->replacement, $sefstring); // some ext. seem to html_special_chars URL ? $sefstring = str_replace(''', $sefConfig->replacement, $sefstring); // V w 27/08/2007 13:23:56 $sefstring = str_replace(' ', $_SEF_SPACE, $sefstring); $sefstring = str_replace(' ', '', (shInsertIsoCodeInUrl($option, $shLanguage) ? shGetIsoCodeFromName($shLanguage) . '/' : '') . titleToLocation($title[0]) . '/' . $sefstring . ($sefstring != '' ? $sefConfig->suffix : '')); if (!empty($sefConfig->suffix)) { $sefstring = str_replace('/' . $sefConfig->suffix, $sefConfig->suffix, $sefstring); } //$finalstrip = explode("|", $sefConfig->stripthese); $sefstring = str_replace($finalstrip, $sefConfig->replacement, $sefstring); $sefstring = str_replace($sefConfig->replacement . $sefConfig->replacement . $sefConfig->replacement, $sefConfig->replacement, $sefstring); $sefstring = str_replace($sefConfig->replacement . $sefConfig->replacement, $sefConfig->replacement, $sefstring); $suffixthere = 0; if (!empty($sefConfig->suffix) && strpos($sefstring, $sefConfig->suffix) !== false) { // V 1.2.4.s $suffixthere = strlen($sefConfig->suffix); } $takethese = str_replace("|", "", $sefConfig->friendlytrim); $sefstring = JString::trim(JString::substr($sefstring, 0, strlen($sefstring) - $suffixthere), $takethese); $sefstring .= $suffixthere == 0 ? '' : $sefConfig->suffix; // version u 26/08/2007 17:27:16 // V 1.2.4.m store it in DB so as to be able to use sef_ext plugins really ! $string = str_replace('&', '&', $string); // V 1.2.4.r without mod_rewrite $shSefString = shAdjustToRewriteMode($sefstring); // V 1.2.4.p check for various URL for same content $dburl = ''; // V 1.2.4.t prevent notice error $urlType = sh404SEF_URLTYPE_NONE; if ($sefConfig->shUseURLCache) { $urlType = Sh404sefHelperCache::getNonSefUrlFromCache($shSefString, $dburl); } $newMaxRank = 0; // V 1.2.4.s $shDuplicate = false; if ($sefConfig->shRecordDuplicates || $urlType == sh404SEF_URLTYPE_NONE) { // V 1.2.4.q + V 1.2.4.s+t $sql = "SELECT newurl, rank, dateadd FROM #__redirection WHERE oldurl = " . $database->Quote($shSefString) . " ORDER BY rank ASC"; $database->setQuery($sql); $dbUrlList = $database->loadObjectList(); if (count($dbUrlList) > 0) { $dburl = $dbUrlList[0]->newurl; $newMaxRank = $dbUrlList[count($dbUrlList) - 1]->rank + 1; $urlType = $dbUrlList[0]->dateadd == '0000-00-00' ? sh404SEF_URLTYPE_AUTO : sh404SEF_URLTYPE_CUSTOM; } } if ($urlType != sh404SEF_URLTYPE_NONE && $dburl != $string) { $shDuplicate = true; } $urlType = $urlType == sh404SEF_URLTYPE_NONE ? sh404SEF_URLTYPE_AUTO : $urlType; _log('Adding from sef_ext to DB : ' . $shSefString . ' | rank = ' . ($shDuplicate ? $newMaxRank : 0)); shAddSefUrlToDBAndCache($string, $shSefString, $shDuplicate ? $newMaxRank : 0, $urlType); } } else { $string = JString::trim($string, "&?"); // V 1.2.4.q a trial in better handling homepage articles if (shIsCurrentPageHome() && $option == 'com_content' && isset($task) && $task == 'view' && $sefConfig->guessItemidOnHomepage) { $string = preg_replace('/(&|\\?)Itemid=[^&]*/i', '', $string); // we remove Itemid, as com_content plugin $Itemid = null; // will hopefully do a better job at finding the right one unset($URI->querystring['Itemid']); unset($shGETVars['Itemid']); } require_once sh404SEF_FRONT_ABS_PATH . 'sef_ext.php'; $sef_ext = new sef_404(); // Rewrite the URL now. // V 1.2.4.s added original string // a special case : com_content does not calculate pagination right // for frontpage and blog, they include links shown at the bottom in the calculation of number of items // For instance, with joomla sample data, the frontpage has only 5 articles // but the view sets $limit to 9 !!! if ($option == 'com_content' && isset($layout) && $layout == 'blog' || $option == 'com_content' && isset($view) && $view == 'frontpage') { $listLimit = shGetDefaultDisplayNumFromURL($string, $includeBlogLinks = true); $string = shSetURLVar($string, 'limit', $listLimit); $string = shSortUrl($string); //$URI->addQueryString( 'limit', $listLimit); } $sefstring = $sef_ext->create($string, $URI->querystring, $shAppendString, $shLanguage, $shOrigString, $originalUri); _log('Created sef url from default plugin: ' . $sefstring); } } } // end of cache check shumisha if (isset($sef_ext)) { unset($sef_ext); } // V 1.2.4.j // V 1.2.4.r : checked for double // // V 1.2.4.r try sef without mod_rewrite $shRewriteBit = $shComponentType == Sh404sefClassBaseextplugin::TYPE_SKIP ? '/' : $sefConfig->shRewriteStrings[$sefConfig->shRewriteMode]; if (strpos($sefstring, 'index.php') === 0) { $shRewriteBit = '/'; } // V 1.2.4.t bug #119 $string = $GLOBALS['shConfigLiveSite'] . $shRewriteBit . JString::ltrim($sefstring, '/') . ($URI->anchor ? "#" . $URI->anchor : ''); } else { // V x 03/09/2007 13:47:37 editing content $shComponentType = Sh404sefClassBaseextplugin::TYPE_SKIP; // will prevent turning & into & _log('shSefrelfToAbs: option not set, skipping'); } $ret = $string; // $ret = str_replace('itemid', 'Itemid', $ret); // V 1.2.4.t bug #125 _log('(1) Setting shSefRelToAbs return string as: ' . $ret); } if (!isset($ret)) { $ret = $string; _log('(2) Setting shSefRelToAbs return string as: ' . $ret); } //if (!empty($shMosMsg) && strpos($ret, $shMosMsg) === false) // V x 01/09/2007 23:02:00 // $ret .= (strpos( $ret, '?') === false || $sefConfig->shRewriteStrings[$sefConfig->shRewriteMode] == '/index.php?/'? '?':'&').$shMosMsg; $ret = $shComponentType == Sh404sefClassBaseextplugin::TYPE_DEFAULT ? shFinalizeURL($ret) : $ret; // V w 27/08/2007 13:21:28 _log('(3) shSefRelToAbs return string after shFinalize: ' . $ret); if (empty($uri) || $shComponentType == Sh404sefClassBaseextplugin::TYPE_SKIP) { // we don't have a uri : we must be doing a redirect from non-sef to sef or similar $ret .= $shAppendString; // append directly to url _log('(4) shSefRelToAbs return string after appendString: ' . $ret); } else { if (empty($sefstring) || !empty($sefstring) && strpos($sefstring, 'index.php') !== 0) { shRebuildVars($shAppendString, $uri); // instead, add to uri. Joomla will put everything together. Only do this if we have a sef url, and not if we have a non-sef _log('(5) shSefRelToAbs no sefstring, adding rebuild vars : ' . $shAppendString); } } $shMosConfig_locale = $shOrigLang; _log('shSefRelToAbs: finally returning: ' . $ret); return $ret; }
shRemoveFromGETVarsList('option'); shRemoveFromGETVarsList('lang'); if (!empty($Itemid)) { shRemoveFromGETVarsList('Itemid'); } if (!empty($limit)) { shRemoveFromGETVarsList('limit'); } if (isset($limitstart)) { shRemoveFromGETVarsList('limitstart'); } // start by inserting the menu element title (just an idea, this is not required at all) $task = isset($task) ? $task : null; $Itemid = isset($Itemid) ? $Itemid : null; $shJCommentsName = shGetComponentPrefix($option); $shJCommentsName = empty($shJCommentsName) ? getMenuTitle($option, null, $Itemid, null, $shLangName) : $shJCommentsName; $shJCommentsName = empty($shJCommentsName) || $shJCommentsName == '/' ? 'Comments' : $shJCommentsName; switch ($task) { case 'captcha': $title[] = $shJCommentsName; $title[] = 'captcha'; break; case 'rss': $title[] = $shJCommentsName; $title[] = 'rss'; break; case 'rss_full': $title[] = $shJCommentsName; $title[] = 'feed'; $title[] = 'full'; break;
defined('_JEXEC') or die('Direct Access to this location is not allowed.'); // ------------------ standard plugin initialize function - don't change --------------------------- global $sh_LANG; $sefConfig =& shRouter::shGetConfig(); $shLangName = ''; $shLangIso = ''; $title = array(); $shItemidString = ''; $dosef = shInitializePlugin($lang, $shLangName, $shLangIso, $option); if ($dosef == false) { return; } // ------------------ standard plugin initialize function - don't change --------------------------- shRemoveFromGETVarsList('option'); shRemoveFromGETVarsList('view'); if (!empty($lang)) { shRemoveFromGETVarsList('lang'); } if (isset($Itemid)) { shRemoveFromGETVarsList('Itemid'); } $shTemp = getMenuTitle($option, null, $Itemid, null, $shLangName); if (!empty($shTemp) && $shTemp != '/') { $title[] = $shTemp; } // V 1.2.4.t // ------------------ standard plugin finalize function - don't change --------------------------- if ($dosef) { $string = shFinalizePlugin($string, $title, $shAppendString, $shItemidString, isset($limit) ? @$limit : null, isset($limitstart) ? @$limitstart : null, isset($shLangName) ? @$shLangName : null); } // ------------------ standard plugin finalize function - don't change ---------------------------
} } else { $cat = $catData[$shLangName][$catId]['cat']; $sec = $catData[$shLangName][$catId]['sec']; } return !empty($cat); } } $task = isset($task) ? $task : null; $id = isset($id) ? $id : null; $Itemid = isset($Itemid) ? $Itemid : null; $limit = isset($limit) ? $limit : null; $limitstart = isset($limitstart) ? $limitstart : null; // shumisha : insert news portal name from menu $shNewsPortalName = shGetComponentPrefix($option); $shNewsPortalName = empty($shNewsPortalName) ? getMenuTitle($option, @$task, $Itemid, '', $shLangName) : $shNewsPortalName; $shNewsPortalName = empty($shNewsPortalName) || $shNewsPortalName == '/' ? 'News' : $shNewsPortalName; // V 1.2.4.t switch ($task) { case 'section': if ($sefConfig->shInsertNewsPortalName) { $title[] = $shNewsPortalName; } $sectionTitle = shGetNEWSPSection($id, $option, $shLangName); if (!empty($sectionTitle)) { $title[] = $sectionTitle; $title[] = '/'; shRemoveFromGETVarsList('section'); } else { $dosef = false; }
case 'archive': $dosef = false; break; case 'frontpage': // new in J 1.5 : we already know this is not a real homepage, as otherwise the test on // $shHomePageFlag would have been triggered. So this is a view=frontpage used on // another page than home. If so, use menu title as a link if (!empty($format) && $format == 'feed') { // exception is rss feed $title[] = $format; if (!empty($type) && $format != $type) { $title[] = $type; } } else { $Itemid = empty($Itemid) ? null : $Itemid; $title[] = getMenuTitle($option, 'frontpage', $Itemid, '', $shLangName); shMustCreatePageId('set', true); } break; default: if (sh404SEF_PDF_DIR && $view == 'article' && !empty($format) && $format == 'pdf') { $title[] = sh404SEF_PDF_DIR; // insert pdf directory shMustCreatePageId('set', true); } if ($view == 'article' && !empty($layout) && $layout == 'form') { // submit new article $title[] = $sh_LANG[$shLangIso]['COM_SH404SEF_CREATE_NEW']; if (!empty($sectionid)) { $q = 'SELECT id, title FROM #__sections WHERE id = ' . $database->Quote($sectionid); $database->setQuery($q);
global $sh_LANG; $sefConfig =& Sh404sefFactory::getConfig(); $shLangName = ''; $shLangIso = ''; $title = array(); $shItemidString = ''; $dosef = shInitializePlugin($lang, $shLangName, $shLangIso, $option); if ($dosef == false) { return; } // ------------------ standard plugin initialize function - don't change --------------------------- // ------------------ load language file - adjust as needed ---------------------------------------- $shLangIso = shLoadPluginLanguage('com_newsfeeds', $shLangIso, 'COM_SH404SEF_CREATE_NEW_NEWSFEED'); // ------------------ load language file - adjust as needed ---------------------------------------- $shNewsfeedName = shGetComponentPrefix($option); $shNewsfeedName = empty($shNewsfeedName) ? getMenuTitle($option, isset($view) ? $view : null, isset($Itemid) ? $Itemid : null, null, $shLangName) : $shNewsfeedName; $shNewsfeedName = empty($shNewsfeedName) || $shNewsfeedName == '/' ? 'Newsfeed' : $shNewsfeedName; if (!empty($shNewsfeedName)) { $title[] = $shNewsfeedName; } // V 1.2.4.t $view = isset($view) ? $view : null; $slugsModel = Sh404sefModelSlugs::getInstance(); switch ($view) { case 'newsfeed': if (!empty($catid)) { // V 1.2.4.q try { $title = $slugsModel->getCategorySlugArray('com_newsfeeds', $catid, shSEFConfig::CAT_ALL_NESTED_CAT, $useAlias = false, $insertId = false, $menuItemTitle = '', $shLangName); } catch (Exception $e) { ShlSystem_Log::error('sh404sef', '%s::%s::%d: %s', __CLASS__, __METHOD__, __LINE__, $e->getMessage());
do { // all categories and subcategories. We don't really need id, as path $title[] = ($sefConfig->shDMInsertCategoryId ? $DMtree[$shMosConfig_locale][$category_id]->id . $sefConfig->replacement : '') . $DMtree[$shMosConfig_locale][$category_id]->title; // will always be unique $category_id = $DMtree[$shMosConfig_locale][$category_id]->parent_id; } while ($category_id != 0); } return array_reverse($title); } } $task = isset($task) ? @$task : null; $Itemid = isset($Itemid) ? @$Itemid : null; // V 1.2.4.t // shumisha : insert component name from menu $shDocmanName = shGetComponentPrefix($option); $shDocmanName = empty($shDocmanName) ? getMenuTitle($option, null, $Itemid, null, $shLangName) : $shDocmanName; $shDocmanName = empty($shDocmanName) || $shDocmanName == '/' ? 'Files' : $shDocmanName; // V 1.2.4.t if ($sefConfig->shInsertDocmanName && !empty($shDocmanName)) { $title[] = $shDocmanName; } if (!empty($gid) && (strpos($task, 'doc_') !== false || $task == 'license_result')) { $docName = shDocmanDocumentName($gid, $option, $shLangName); } else { $docName = ''; } switch ($task) { case 'cat_view': if (!empty($gid)) { $title = array_merge($title, dm_sef_get_category_array($gid, $option, $shLangName)); }
// if Itemid in non-sef URL $shItemidString = $sefConfig->shAlwaysInsertItemid ? JText::_('COM_SH404SEF_ALWAYS_INSERT_ITEMID_PREFIX') . $sefConfig->replacement . $Itemid : ''; } // collect probable url vars $view = isset($view) ? $view : null; $Itemid = isset($Itemid) ? $Itemid : null; $id = isset($id) ? $id : null; $catid = isset($catid) ? $catid : null; // optional prefix $shName = shGetComponentPrefix($option); if (!empty($shName) && $shName != '/') { $title[] = $shName; } // joomla content models $slugsModel = Sh404sefModelSlugs::getInstance(); $menuItemTitle = getMenuTitle(null, $view, isset($Itemid) ? $Itemid : null, '', $shLangName); $uncategorizedPath = $sefConfig->slugForUncategorizedContact == shSEFConfig::COM_SH404SEF_UNCATEGORIZED_EMPTY ? '' : $menuItemTitle; $slugsArray = array(); switch ($view) { case 'featured': if (!empty($menuItemTitle)) { $title[] = $menuItemTitle; $title[] = '/'; } else { $dosef = false; } shMustCreatePageId('set', true); break; case 'category': // fetch cat name if (!empty($id)) {
shRemoveFromGETVarsList('lang'); if (!empty($Itemid)) { shRemoveFromGETVarsList('Itemid'); } if (!empty($limit)) { shRemoveFromGETVarsList('limit'); } if (!empty($limitstart)) { shRemoveFromGETVarsList('limitstart'); } // start by inserting the menu element title (just an idea, this is not required at all) $task = isset($task) ? $task : null; $Itemid = isset($Itemid) ? $Itemid : null; // Get the component prefix that is configured in SH404 $prefix = shGetComponentPrefix($option); $prefix = empty($prefix) ? getMenuTitle($option, $task, $Itemid, null, $shLangName) : $prefix; $prefix = empty($prefix) || $prefix == '/' ? JText::_('COM_EASYSOCIAL_SH404_DEFAULT_ALIAS') : $prefix; // Add the prefix addPrefix($title, $prefix); // If view is set, pass the url builders to the view if (isset($view)) { $adapter = dirname(__FILE__) . '/' . strtolower($view) . '.php'; // Probably the view has some custom stuffs to perform. if (JFile::exists($adapter)) { include $adapter; } else { // Add the view to the list of titles addView($title, $view); // If layout is set, pass the url builders to the view if (isset($layout)) { addLayout($title, $view, $layout);
$title[] = $shShopName; } if ($shVmCChk) { $title[] = 'vmchk'; } $title[] = $sh_LANG[$shLangIso]['_PHPSHOP_VIEW'] . $sefConfig->replacement . $sh_LANG[$shLangIso]['_PHPSHOP_ORDER_ITEM'] . ($order_id ? $sefConfig->replacement . 'id' . strval($order_id) : ''); if (isset($order_id)) { // V 1.2.4.r shRemoveFromGETVarsList('order_id'); } break; case '': // this is main menu link, let's fetch menu title // this is main menu link, let's fetch menu title case 'shop.index': $title[] = getMenuTitle($option, isset($task) ? @$task : null, $Itemid, '', $shLangName); if ($shVmCChk) { $title[] = 'vmchk'; } // process filter hack $shFilterType = isset($shFilterType) ? @$shFilterType : null; $shFilterValue = isset($shFilterValue) ? @$shFilterValue : null; switch ($shFilterType) { case '': break; case 'minStock': $title[] = 'dispo'; if (!empty($shFilterValue)) { $title[] = $shFilterValue; } shRemoveFromGETVarsList('shFilterType');
$query = "select id from #__menu where type='component' and link like '%index.php?option=com_bt_portfolio&view=portfolios&catid=" . $catid . "%' and published = 1 and access in(" . $groups . ") order by lft limit 1"; $db->setQuery($query); $Itemid2 = $db->loadResult(); if (!$Itemid2 && $catid) { $query = 'select parent_id from #__bt_portfolio_categories where id = ' . $catid; $db->setQuery($query); $catid = intval($db->loadResult()); $Itemid2 = BTFindItemID($catid); } if ($Itemid2) { $Itemid = $Itemid2; $string .= '&Itemid=' . $Itemid; } } $shPortfolio = shGetComponentPrefix($option); $shPortfolio = empty($shPortfolio) ? getMenuTitle($option, $task, $Itemid, null, $shLangName) : $shPortfolio; $title[] = empty($shPortfolio) || $shPortfolio == '/' ? 'portfolios' : $shPortfolio; switch ($view) { case 'portfolios': case 'featured': if (!empty($catid)) { $database = JFactory::getDbo(); $q = "SELECT id,parent_id, title FROM #__bt_portfolio_categories where id ='{$catid}' and published = 1"; $database->setQuery($q); if (shTranslateUrl($option, $shLangName)) { $result = $database->loadObject(); } else { $result = $database->loadObject(false); } if (!empty($result)) { if ($result->parent_id == 0) {
$dosef = shInitializePlugin($lang, $shLangName, $shLangIso, $option); // ------------------ standard plugin initialize function - don't change --------------------------- $database = JFactory::getDBO(); shRemoveFromGETVarsList('option'); shRemoveFromGETVarsList('lang'); if (!empty($Itemid)) { shRemoveFromGETVarsList('Itemid'); } if (!empty($limit)) { shRemoveFromGETVarsList('limit'); } if (isset($limitstart)) { shRemoveFromGETVarsList('limitstart'); } $shName = shGetComponentPrefix($option); $shName = empty($shName) ? getMenuTitle($option, isset($controller) ? @$controller : (isset($view) ? @$view : null), $Itemid) : $shName; if (!empty($shName) && $shName != '/') { $title[] = $shName; } // V x if (isset($task)) { $title[] = $task; } switch ($view) { case 'profile': if (isset($id)) { $query = 'select alias from #__users where id = ' . $id; $title[] = ''; } break; }
if (!empty($lang)) { shRemoveFromGETVarsList('lang'); } if (!empty($Itemid)) { shRemoveFromGETVarsList('Itemid'); } // start IJoomla specific stuff $func = isset($func) ? @$func : null; if (!empty($func)) { shRemoveFromGETVarsList('func'); } $task = isset($task) ? @$task : null; $Itemid = isset($Itemid) ? @$Itemid : null; // shumisha : insert magazine name from menu $shIJoomlaMagName = shGetComponentPrefix($option); $shIJoomlaMagName = empty($shIJoomlaMagName) ? getMenuTitle($option, isset($task) ? @$task : null, $Itemid, '', $shLangName) : $shIJoomlaMagName; $shIJoomlaMagName = empty($shIJoomlaMagName) || $shIJoomlaMagName == '/' ? 'Magazine' : $shIJoomlaMagName; // V 1.2.4.t switch ($func) { case 'author_articles': if ($sefConfig->shInsertIJoomlaMagName) { $title[] = $shIJoomlaMagName; } if (!empty($authorid)) { try { $result = ShlDbHelper::selectObject('#__users', array('id', 'name'), array('id' => $authorid)); $shRef = empty($result) ? $sh_LANG[$shLangIso]['_SH404SEF_IJOOMLA_MAG_AUTHOR'] . $sefConfig->replacement . $authorid : ($sefConfig->shInsertAuthorId ? $authorid . $sefConfig->replacement : ''); // if name, put ID only if requested $title[] = $shRef . (empty($result) ? '' : $result->name); shRemoveFromGETVarsList('authorid'); $title[] = $sh_LANG[$shLangIso]['_SH404SEF_IJOOMLA_MAG_VIEW_ALL_ARTICLES'];
// ------------------ load language file - adjust as needed ---------------------------------------- $shLangIso = shLoadPluginLanguage('com_registration', $shLangIso, 'COM_SH404SEF_LOST_PASSWORD'); // ------------------ load language file - adjust as needed ---------------------------------------- // do something about that Itemid thing if (!preg_match('/Itemid=[0-9]+/i', $string)) { // if no Itemid in non-sef URL //global $Itemid; if ($sefConfig->shInsertGlobalItemidIfNone && !empty($shCurrentItemid)) { $string .= '&Itemid=' . $shCurrentItemid; // append current Itemid $Itemid = $shCurrentItemid; shAddToGETVarsList('Itemid', $Itemid); // V 1.2.4.m } if ($sefConfig->shInsertTitleIfNoItemid) { $title[] = $sefConfig->shDefaultMenuItemName ? $sefConfig->shDefaultMenuItemName : getMenuTitle($option, isset($task) ? @$task : null, $shCurrentItemid, null, $shLangName); } $shItemidString = $sefConfig->shAlwaysInsertItemid ? JText::_('COM_SH404SEF_ALWAYS_INSERT_ITEMID_PREFIX') . $sefConfig->replacement . $shCurrentItemid : ''; } else { // if Itemid in non-sef URL $shItemidString = $sefConfig->shAlwaysInsertItemid ? JText::_('COM_SH404SEF_ALWAYS_INSERT_ITEMID_PREFIX') . $sefConfig->replacement . $Itemid : ''; } // optional first part of URL, to be set in language file if (!empty($sh_LANG[$shLangIso]['COM_SH404SEF_REGISTRATION'])) { $title[] = $sh_LANG[$shLangIso]['COM_SH404SEF_REGISTRATION']; } $task = isset($task) ? @$task : null; switch ($task) { case 'register': $title[] = $sh_LANG[$shLangIso]['COM_SH404SEF_REGISTER']; break;
// ------------------ standard plugin initialize function - don't change --------------------------- global $sh_LANG, $sefConfig, $shGETVars; $shLangName = ''; $shLangIso = ''; $title = array(); $shItemidString = ''; $dosef = shInitializePlugin($lang, $shLangName, $shLangIso, $option); if ($dosef == false) { return; } // ------------------ standard plugin initialize function - don't change --------------------------- // ------------------ load language file - adjust as needed ---------------------------------------- //$shLangIso = shLoadPluginLanguage( 'com_XXXXX', $shLangIso, '_SEF_SAMPLE_TEXT_STRING'); // ------------------ load language file - adjust as needed ---------------------------------------- // start by inserting the menu element title (just an idea, this is not required at all) $menu = getMenuTitle($option, null, @$Itemid, null, $shLangName); $_PARAM_CHAR = '*@*'; $newUrl = ''; $url = isset($url) ? urldecode($url) : ''; // It's a JReviews link if (isset($url) && $url != '' && strpos($url, 'menu') === false) { // You can change the value below to anything you want, but it is important to distinguish jReviews urls if (!isset($Itemid)) { $title[] = 'reviews'; } else { $title[] = $menu; } $urlParams = explode('/', $url); foreach ($urlParams as $urlParam) { // Segments if (false === strpos($urlParam, $_PARAM_CHAR)) {
public static function getContentSlugsArray($view, $id, $layout, $Itemid = 0, $shLang = null, $sefConfig = null) { $slugsArray = array(); // if config is not injected, get default one if (is_null($sefConfig)) { $sefConfig =& Sh404sefFactory::getConfig(); } $id = empty($id) ? 0 : intval($id); // TODO: this will not work when we have Joomfish (probably). With JF, default should be // $shLang = empty($shLang) ? $shPageInfo->currentLanguageTag : $shLang; ?? $requestedLanguage = empty($shLang) ? '*' : $shLang; try { $slugsModel = Sh404sefModelSlugs::getInstance(); $menuItemTitle = getMenuTitle(null, $view, isset($Itemid) ? $Itemid : null, '', $shLang); $uncategorizedPath = $sefConfig->slugForUncategorizedContent == shSEFConfig::COM_SH404SEF_UNCATEGORIZED_EMPTY ? '' : $menuItemTitle; switch ($view) { case 'category': if (empty($layout) || $layout != 'blog') { if ($sefConfig->shInsertContentTableName) { $prefix = empty($sefConfig->shContentTableName) ? $menuItemTitle : $sefConfig->shContentTableName; if (!empty($prefix)) { $prefixArray[] = $prefix; } } if (!empty($id)) { // we have a category id $slugsArray = $slugsModel->getCategorySlugArray('com_content', $id, $sefConfig->includeContentCatCategories, $sefConfig->useCatAlias, $insertId = false, $menuItemTitle, $requestedLanguage); } else { // no category id, use menu item title if (!$sefConfig->shInsertContentTableName || empty($sefConfig->shContentTableName)) { if (!empty($menuItemTitle)) { $slugsArray[] = $menuItemTitle; } } } } else { // blog category if ($sefConfig->shInsertContentBlogName) { $prefix = empty($sefConfig->shContentBlogName) ? $menuItemTitle : $sefConfig->shContentBlogName; if (!empty($prefix)) { $prefixArray[] = $prefix; } } if (!empty($id)) { $slugsArray = $slugsModel->getCategorySlugArray('com_content', $id, $sefConfig->includeContentCatCategories, $sefConfig->useCatAlias, $insertId = false, $menuItemTitle, $requestedLanguage); } else { // this should not happen, probably a malformed url if (!$sefConfig->shInsertContentBlogName || empty($sefConfig->shContentBlogName)) { if (!empty($menuItemTitle)) { $slugsArray[] = $menuItemTitle; } } } } if (!empty($prefixArray)) { $slugsArray = array_merge($prefixArray, $slugsArray); } $slugsArray[] = '/'; break; case 'categories': // now get category(ies) path if (!empty($id)) { $slugsArray = $slugsModel->getCategorySlugArray('com_content', $id, $sefConfig->includeContentCatCategories, $sefConfig->useCatAlias, $insertId = false, $menuItemTitle, $requestedLanguage); // insert a suffix to distinguish from normal category listing if (!empty($sefConfig->contentCategoriesSuffix)) { $slugsArray[] = $sefConfig->contentCategoriesSuffix; } // end with a directory sign $slugsArray[] = '/'; } else { if (!empty($menuItemTitle)) { $slugsArray[] = $menuItemTitle; } } break; case 'featured': if (!empty($menuItemTitle)) { $slugsArray[] = $menuItemTitle; } break; case 'article': $article = $slugsModel->getArticle($id); $language = $requestedLanguage; if (empty($article[$requestedLanguage])) { $language = '*'; } // still no luck, use whatever is available if (empty($article[$language])) { $languages = array_keys($article); $language = array_shift($languages); } // get category(ies) $slugsArray = $slugsModel->getCategorySlugArray('com_content', $article[$language]->catid, $sefConfig->includeContentCat, $sefConfig->useCatAlias, $insertId = false, $uncategorizedPath, $requestedLanguage); // get article slug, optionnally including article id inurl $insertIdCatList = $sefConfig->ContentTitleInsertArticleId ? $sefConfig->shInsertContentArticleIdCatList : array(); $articleSlug = $slugsModel->getArticleSlug($id, $sefConfig->UseAlias, $sefConfig->ContentTitleInsertArticleId, $insertIdCatList, $requestedLanguage); $slugsArray[] = $articleSlug; break; default: break; } } catch (Exception $e) { ShlSystem_Log::error('sh404sef', '%s::%s::%d: %s', __CLASS__, __METHOD__, __LINE__, $e->getMessage()); } return $slugsArray; }
} if (!empty($cid)) { shRemoveFromGETVarsList('cid'); } } elseif ($task == 'edit') { $title[] = $sh_LANG[$shLangIso]['_SH404SEF_FLEXICONTENT_EDIT']; } } else { return; //echo $Itemid."<br>"; //echo $shCurrentItemid."<br>"; //$shCurrentItemid = $Itemid; //shAddToGETVarsList('Itemid', $Itemid); // V 1.2.4.m //$dosef = false; $shName = shGetComponentPrefix($option); $shName = empty($shName) ? getMenuTitle($option, isset($view) ? @$view : null, $Itemid) : $shName; if (!empty($shName) && $shName != '/') { echo $title[] = $shName; } else { echo $title[] = $sh_LANG[$shLangIso]['_SH404SEF_FLEXICONTENT_ADD']; } // Remove the vars from the url shRemoveFromGETVarsList('layout'); shRemoveFromGETVarsList('typeid'); } break; case 'category': if (!empty($cid) && empty($id)) { if (@$globalcats[$cid]->ancestorsarray) { $ancestors = $globalcats[$cid]->ancestorsarray; $cat_titles = array();
break; } } if (!$match) { $match = $items[0]; } $Itemid = $match->id; } } switch ($view) { case 'xml': $title[] = 'sitemap-xml' . (!empty($sitemap) && $sitemap > 1 ? "-{$sitemap}" : ''); //$sefConfig->suffix='.xml'; break; default: $shXmapName = getMenuTitle($option, isset($view) ? @$view : null, $Itemid, '', $shLangName); $shXmapName = empty($shXmapName) || $shXmapName == '/' ? 'Site Map' : $shXmapName; // V 1.2.4.t $title[] = $shXmapName . (!empty($sitemap) ? "-{$sitemap}" : ''); break; } shRemoveFromGETVarsList('option'); shRemoveFromGETVarsList('Itemid'); shRemoveFromGETVarsList('lang'); if (!empty($view)) { shRemoveFromGETVarsList('view'); } if (!empty($sitemap) && $view != 'xml') { shRemoveFromGETVarsList('sitemap'); } // ------------------ standard plugin finalize function - don't change ---------------------------
if ($sefConfig->shInsertTitleIfNoItemid) { $title[] = $sefConfig->shDefaultMenuItemName ? $sefConfig->shDefaultMenuItemName : getMenuTitle($option, isset($view) ? $view : null, $shCurrentItemid, null, $shLangName); } // V 1.2.4.q added forced language $shItemidString = ''; if ($sefConfig->shAlwaysInsertItemid && (!empty($Itemid) || !empty($shCurrentItemid))) { $shItemidString = JText::_('COM_SH404SEF_ALWAYS_INSERT_ITEMID_PREFIX') . $sefConfig->replacement . (empty($Itemid) ? $shCurrentItemid : $Itemid); } } else { // if Itemid in non-sef URL $shItemidString = $sefConfig->shAlwaysInsertItemid ? JText::_('COM_SH404SEF_ALWAYS_INSERT_ITEMID_PREFIX') . $sefConfig->replacement . $Itemid : ''; if ($sefConfig->shAlwaysInsertMenuTitle) { //global $Itemid; V 1.2.4.g we want the string option, not current page ! if ($sefConfig->shDefaultMenuItemName) { $title[] = $sefConfig->shDefaultMenuItemName; } elseif ($menuTitle = getMenuTitle($option, isset($view) ? $view : null, $Itemid, '', $shLangName)) { if ($menuTitle != '/') { $title[] = $menuTitle; } } } } // V 1.2.4.m shRemoveFromGETVarsList('option'); shRemoveFromGETVarsList('lang'); if (!empty($Itemid)) { shRemoveFromGETVarsList('Itemid'); } if (!empty($limit)) { shRemoveFromGETVarsList('limit'); }
$idname = EasyBlogRouter::getTagPermalink($id); break; case 'teamblog': $idname = EasyBlogRouter::getTeamBlogPermalink($id); break; default: $idname = ''; } } if (empty($Itemid)) { $Itemid = EasyBlogRouter::getItemId($view); shAddToGETVarsList('Itemid', $Itemid); } } $easyblogName = shGetComponentPrefix($option); $easyblogName = empty($easyblogName) ? getMenuTitle($option, $task, $Itemid, null, $shLangName) : $easyblogName; $easyblogName = empty($easyblogName) || $easyblogName == '/' ? 'EasyBlog' : $easyblogName; $title[] = $easyblogName; $validViews = array('archive', 'blogger', 'categories', 'dashboard', 'entry', 'featured', 'images', 'latest', 'login', 'myblog', 'ratings', 'search', 'subscription', 'tags', 'teamblog', 'trackback'); $add_idname = true; if (isset($view) && $view == 'entry') { unset($view); shRemoveFromGETVarsList('view'); } if (isset($view)) { if ($config->get('main_sef') != 'simple' || $view != 'entry') { if (in_array($view, $validViews)) { $title[] = JText::_('COM_EASYBLOG_SH404_VIEW_' . JString::strtoupper($view)); } } shRemoveFromGETVarsList('view');
* Websites: http://www.bang2joom.com ------------------------------------------------------------------------ */ global $sh_LANG; $sefConfig =& shRouter::shGetConfig(); $shLangName = ''; $shLangIso = ''; $title = array(); $shItemidString = ''; $dosef = shInitializePlugin($lang, $shLangName, $shLangIso, $option); if ($dosef == false) { return; } if (isset($Itemid)) { shRemoveFromGETVarsList('Itemid'); } else { $Itemid = null; } shRemoveFromGETVarsList('lang'); shRemoveFromGETVarsList('option'); shRemoveFromGETVarsList('bid'); if (strpos($string, "view=loader") === false) { shRemoveFromGETVarsList("view"); } if (!isset($task)) { $task = ''; } $title[] = getMenuTitle($option, $task, $Itemid, null, $shLangName); if ($dosef) { $string = shFinalizePlugin($string, $title, $shAppendString, $shItemidString, isset($limit) ? @$limit : null, isset($limitstart) ? @$limitstart : null, isset($shLangName) ? @$shLangName : null); }
// get DB $database =& JFactory::getDBO(); $sql = 'SELECT contentid from #__myblog_permalinks WHERE permalink = \'' . $show . '\''; $database->setQuery($sql); if (shTranslateUrl($option, $shLangName)) { $postId = $database->loadResult(); } else { $postId = $database->loadResult(false); } return isset($postId) ? $postId : ''; } } //echo 'string = '.$string.'<br />'; // shumisha : insert component name from menu $shMyBlogName = shGetComponentPrefix($option); $shMyBlogName = empty($shMyBlogName) ? getMenuTitle($option, null, @$Itemid, null, $shLangName) : $shMyBlogName; $shMyBlogName = $shMyBlogName == '/' ? 'myBlog' : $shMyBlogName; // V 1.2.4.t if ($sefConfig->shInsertMyBlogName && !empty($shMyBlogName)) { $title[] = $shMyBlogName; } if (isset($blogger)) { // blogger url rewrite if ($sefConfig->shMyBlogInsertBloggerId) { $userId = shFetchUserId($blogger); $title[] = (!empty($userId) ? $userId . $sefConfig->replacement : '') . $blogger; //append blogger name to url. } else { $title[] = $blogger; } $title[] = "/";
shRemoveFromGETVarsList('lang'); if (!empty($Itemid)) { shRemoveFromGETVarsList('Itemid'); } if (!empty($limit)) { shRemoveFromGETVarsList('limit'); } if (isset($limitstart)) { shRemoveFromGETVarsList('limitstart'); } // limitstart can be zero // start by inserting the menu element title (just an idea, this is not required at all) $task = isset($task) ? $task : null; $Itemid = isset($Itemid) ? $Itemid : null; $shSampleName = shGetComponentPrefix($option); $shSampleName = empty($shSampleName) ? getMenuTitle($option, $task, $Itemid, null, $shLangName) : $shSampleName; $shSampleName = empty($shSampleName) || $shSampleName == '/' ? 'SampleCom' : $shSampleName; switch ($task) { case 'task1': case 'task2': $dosef = false; // these tasks do not require SEF URL break; default: $title[] = $sh_LANG[$shLangIso]['COM_SH404SEF_VIEW_SAMPLE']; // insert a 'View sample' string, // according to language // only if you have defined the if (!empty($sampleId)) { // fetch some data about the content try {
return; } if (isset($view)) { if (!in_array($view, $acysefview)) { $dosef = false; } shRemoveFromGETVarsList('view'); } if (isset($ctrl)) { if (!in_array($ctrl, $acysefview)) { $dosef = false; } shRemoveFromGETVarsList('ctrl'); } $title = array(); $title[] = getMenuTitle($option, isset($view) ? $view : null, isset($Itemid) ? $Itemid : null, null, $shLangName); if (isset($layout)) { $title[] = $layout; shRemoveFromGETVarsList('layout'); } if (isset($task)) { $title[] = $task; shRemoveFromGETVarsList('task'); } if (isset($listid)) { $title[] = $listid; shRemoveFromGETVarsList('listid'); } if (isset($mailid) && !(isset($task) && $task == 'edit' && isset($ctrl) && $ctrl == 'frontnewsletter')) { $title[] = $mailid; shRemoveFromGETVarsList('mailid');