setQuery($query);
$shSectionId = $database->loadResult();
} else $shSectionId = $sectionid;
//echo '$shSectionId = '.$shSectionId.'
';
// retrieve Itemid
if (empty($mainframe)) { // V 1.2.4.t ! bug #122
$shMainFrame = new mosMainFrame( $database, $option, '.' );
} else $shMainFrame = $mainframe;
if ( !empty($shSectionId) ) { // has section, so regular content !!! we need to cache this !!
$shItemid = $shMainFrame->getItemid( $id, 0, 1);
//echo 'shItemid getitemid = '.$shItemid.'
';
} else { // does not have section, so static
// V 1.2.4.t better use Joomla built in function !
$shItemid = $shMainFrame->getItemid( $id, 1, 1);
//echo 'shItemid selec id = '.$shItemid.'
';
}
// V 1.2.4.q last possibility : content item is only displayed through com_frontpage
if (empty($shItemid)) {
$query = 'SELECT count(content_id) from #__content_frontpage WHERE content_id = '.$id;
$database->setQuery($query);
$isOnFrontPage = $database->loadResult();
if (!empty($isOnFrontPage)) { // it is on frontpage, let's find out about com_frontpage Itemid
$query = 'SELECT id,link FROM #__menu WHERE link LIKE "%com_frontpage%"'; // we don't mind if it's not published
//$database->setQuery($query, 0, 1);
$database->setQuery($query); // 10/08/2007 22:12:40 mambo compat
$database->loadObject($shComFrontpage);
if (!empty($shComFrontpage)) { // if on frontpage, let's see if com_frontpage
global $shHomeLink; //is actually frontpage
if (strpos($shHomeLink, 'com_frontpage') === false) {
if (!shIsMultilingual() || shIsDefaultLang( $shLangName))
$string = '';
else $string = $shLangIso;
$shHomePageFlag = true;
} else
$shItemid = $shComFrontpage->id; // content is in com_frontpage, but com_frontpage is not home
}
}
}
// integrate found Itemid
if (!empty($shItemid)) {
$string .= '&Itemid='.$shItemid; ; // append current Itemid
$Itemid = $shItemid;
shAddToGETVarsList('Itemid', $Itemid); // V 1.2.4.m
}
}
$shHomePageFlag = !$shHomePageFlag ? shIsHomepage ($string): $shHomePageFlag;
if (!$shHomePageFlag) { // we may have found that this is homepage, so we msut return an empty string
// do something about that Itemid thing
if (eregi('Itemid=[0-9]+', $string) === false) { // if no Itemid in non-sef URL
// V 1.2.4.t moved back here
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 ); // V 1.2.4.q added forced language
$shItemidString = '';
if ($sefConfig->shAlwaysInsertItemid && (!empty($Itemid) || !empty($shCurrentItemid)))
$shItemidString = _COM_SEF_SH_ALWAYS_INSERT_ITEMID_PREFIX.$sefConfig->replacement
.(empty($Itemid)? $shCurrentItemid :$Itemid);
} else { // if Itemid in non-sef URL
$shItemidString = $sefConfig->shAlwaysInsertItemid ?
_COM_SEF_SH_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;// V 1.2.4.q added force language
elseif ($menuTitle = getMenuTitle($option, (isset($task) ? @$task : null), $Itemid, '',$shLangName )) {
//echo 'Menutitle = '.$menuTitle.'
';
if ($menuTitle != '/') $title[] = $menuTitle;
}
}
}
// V 1.2.4.m
shRemoveFromGETVarsList('option');
shRemoveFromGETVarsList('lang');
if (!empty($Itemid))
shRemoveFromGETVarsList('Itemid');
if (!empty($limit))
shRemoveFromGETVarsList('limit');
if (isset($limitstart))
shRemoveFromGETVarsList('limitstart');
$task = isset($task) ? @$task : null;
switch ($task) {
case 'archivecategory':
case 'archivesection' : /* Rodax Software */ case 'remove' :
$dosef = false;
break;
case 'new' :
$title[] = $sh_LANG[$shLangIso]['_COM_SEF_SH_CREATE_NEW'];
if (!empty($sectionid)) {
$q = 'SELECT id, title FROM #__sections WHERE id = '.$sectionid;
$database->setQuery($q);
if (shTranslateUrl($option, $shLangName)) // V 1.2.4.m
$database->loadObject( $sectionTitle);
else $database->loadObject( $sectionTitle, false);
if ($sectionTitle) {
$title[] = $sectionTitle->title;
shRemoveFromGETVarsList('sectionid');
}
}
shRemoveFromGETVarsList('task');
break;
default:
// V 1.2.4.j 2007/04/11 : numerical ID, on some categories only
if ($sefConfig->shInsertNumericalId && isset($sefConfig->shInsertNumericalIdCatList)
&& !empty($id) && ($task == 'view')) {
$q = 'SELECT id, catid, created FROM #__content WHERE id = '.$id;
$database->setQuery($q);
if (shTranslateUrl($option, $shLangName)) // V 1.2.4.m
$database->loadObject( $contentElement);
else $database->loadObject( $contentElement, false);
if ($contentElement) {
$foundCat = array_search($contentElement->catid, $sefConfig->shInsertNumericalIdCatList);
if (($foundCat !== null && $foundCat !== false)
|| ($sefConfig->shInsertNumericalIdCatList[0] == '')) { // test both in case PHP < 4.2.0
$shTemp = explode(' ', $contentElement->created);
$title[] = str_replace('-','', $shTemp[0]).$contentElement->id;
}
}
}
// V 1.2.4.k 2007/04/25 : if activated, insert edition id and name from iJoomla magazine
if (!empty($ed) && $sefConfig->shActivateIJoomlaMagInContent && $id && ($task == 'view')) {
$q = 'SELECT id, title FROM #__magazine_categories WHERE id = '.$ed;
$database->setQuery($q);
if (shTranslateUrl($option, $shLangName)) // V 1.2.4.m
$database->loadObject( $issueName, false);
else $database->loadObject( $issueName);
if ($issueName) {
$title[] = ($sefConfig->shInsertIJoomlaMagIssueId ? $ed.$sefConfig->replacement:'')
.$issueName->title;
}
shRemoveFromGETVarsList('ed');
}
// end of edition id insertion
//$shTemp = sef_404::getContentTitles($task,$id, $Itemid, $shLangName);
//echo '
getContentTitle in com_content
';
//var_dump($shTemp);
//echo '
Title
';
//var_dump($title);
//echo '
';
if (!empty($title))
// V 1.2.4.m : we now pass Itemid to getContentTitles(), so as to be able to find menu item name
// if blogcategory with several categories (because we don't know which category name to use)
$title = array_merge($title, sef_404::getContentTitles($task,$id, (isset($Itemid) ? @$Itemid : null), $shLangName)); // V 1.2.4.q added forced language
else $title = sef_404::getContentTitles($task,$id,(isset($Itemid) ? @$Itemid : null), $shLangName); // V 1.2.4.q added forced language
// V 1.2.4.q
shRemoveFromGETVarsList('task');
if (isset($id))
shRemoveFromGETVarsList('id');
if (!empty($sectionid))
shRemoveFromGETVarsList('sectionid'); // V 1.2.4.m
if (!empty($catid))
shRemoveFromGETVarsList('catid'); // V 1.2.4.m
}
// ------------------ 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 { // this is multipage homepage
$title[] = '/';
$string = sef_404::sefGetLocation( $string, $title, null, (isset($limit) ? @$limit : null), (isset($limitstart) ? @$limitstart : null), (isset($shLangName) ? @$shLangName : null));
}
?>