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);
 }
Exemple #2
0
 function create($string, &$vars, &$shAppendString, $shLanguage, $shSaveString = '', &$originalUri)
 {
     $sefConfig =& shRouter::shGetConfig();
     // get DB
     $database =& JFactory::getDBO();
     _log('Calling sef404 create function with ' . $string);
     if ($sefConfig->shInsertGlobalItemidIfNone && !empty($GLOBALS['Itemid'])) {
         // V 1.2.4.t
         $shCurrentItemid = $GLOBALS['Itemid'];
     } else {
         $shCurrentItemid = null;
     }
     _log('CurrentItemid = ' . $shCurrentItemid);
     $index = str_replace($GLOBALS['shConfigLiveSite'], '', $_SERVER['PHP_SELF']);
     $base = dirname($index);
     $base .= $base == '/' ? '' : '/';
     _log('Extracting $vars:', $vars);
     extract($vars);
     if (isset($title)) {
         // V 1.2.4.r : protect against components using 'title' as GET vars (com_jim for instance)
         $sh404SEF_title = $title;
     }
     // means that $sh404SEF_title has to be used in plugins or extensions
     $title = array();
     // V 1.2.4.r
     // get extension plugin
     $extPlugin =& Sh404sefFactory::getExtensionPlugin($option);
     // which plugin file are we supposed to use?
     $extPluginPath = $extPlugin->getSefPluginPath($vars);
     $pluginType = $extPlugin->getPluginType();
     // use Joomla router.php file in extension dir
     switch ($pluginType) {
         case Sh404sefClassBaseextplugin::TYPE_JOOMLA_ROUTER:
             // Load the plug-in file.
             _log('Loading component own router.php file');
             $functionName = ucfirst(str_replace('com_', '', $option)) . 'BuildRoute';
             if (!function_exists($functionName)) {
                 include JPATH_ROOT . DS . 'components' . DS . $option . DS . 'router.php';
             }
             $originalVars = empty($originalUri) ? $vars : $originalUri->getQuery($asArray = true);
             $title = $functionName($originalVars);
             //$title = shRemoveSlugs( $title, $removeWhat = 'removeId');
             global $mainframe;
             $router =& $mainframe->getRouter();
             $title = $router->_encodeSegments($title);
             // manage GET var lists ourselves, as Joomla router.php does not do it
             if (!empty($vars)) {
                 // there are some unused GET vars, we must transfer them to our mechanism, so
                 // that they are eventually appended to the sef url
                 foreach ($vars as $k => $v) {
                     switch ($k) {
                         case 'option':
                         case 'Itemid':
                             shRemoveFromGETVarsList($k);
                             break;
                         default:
                             // if variable has not been used in sef url, add it to list of variables to be
                             // appended to the url as query string elements
                             if (array_key_exists($k, $originalVars)) {
                                 shAddToGETVarsList($k, $v);
                             } else {
                                 shRemoveFromGETVarsList($k);
                             }
                             break;
                     }
                 }
             }
             // special case for search component, as router.php encode the search word in the url
             // wa can't do that, as we are storing each url in the db
             if (isset($originalVars['option']) && $originalVars['option'] == 'com_search' && !empty($vars['searchword'])) {
                 // router.php has encoded that in the url, we need to undo
                 $title = array();
                 $originalVars['searchword'] = $vars['searchword'];
                 shAddToGETVarsList('searchword', $vars['searchword']);
                 if (!empty($vars['view'])) {
                     $vars['view'] = $vars['view'];
                     shAddToGETVarsList('view', $vars['view']);
                 }
             }
             // handle menu items, having only a single Itemid in the url
             // (router.php will return an empty array in that case, even if we have restored
             // the full non-sef url, as we already did)
             /*
              * Build the application route
              */
             $tmp = '';
             if (empty($title) && isset($vars['Itemid']) && !empty($vars['Itemid'])) {
                 $menu =& shRouter::shGetMenu();
                 $item = $menu->getItem($vars['Itemid']);
                 if (is_object($item) && $vars['option'] == $item->component) {
                     $title[] = $item->route;
                 }
             }
             if (empty($title)) {
                 //$title[] = 'comp';
                 $title[] = substr($vars['option'], 4);
             }
             // add user defined prefix
             $prefix = shGetComponentPrefix($option);
             if (!empty($prefix)) {
                 array_unshift($title, $prefix);
             }
             // now process the resulting title string
             $string = shFinalizePlugin($string, $title, $shAppendString, '', isset($limit) ? @$limit : null, isset($limitstart) ? @$limitstart : null, isset($shLangName) ? @$shLangName : null, isset($showall) ? @$showall : null);
             break;
             // use sh404sef plugins, either in ext. dir or in sh404sef dir
         // use sh404sef plugins, either in ext. dir or in sh404sef dir
         case Sh404sefClassBaseextplugin::TYPE_SH404SEF_ROUTER:
             _log('Loading sh404SEF plugin in ' . $extPluginPath);
             include $extPluginPath;
             break;
         case Sh404sefClassBaseextplugin::TYPE_JOOMSEF_ROUTER:
             Sh404sefHelperExtplugins::loadJoomsefCompatLibs();
             include_once $extPluginPath;
             $className = 'SefExt_' . $option;
             $plugin = new $className();
             if (!shIsHomepage($string)) {
                 // make sure the plugin does not try to calculate pagination
                 $params =& SEFTools::GetExtParams('com_content');
                 $params->set('pagination', '1');
                 // ask plugin to build url
                 $plugin->beforeCreate($originalUri);
                 $result = $plugin->create($originalUri);
                 $title = empty($result['title']) ? array() : $result['title'];
                 $plugin->afterCreate($originalUri);
                 // make sure we have a url
                 if (empty($title) && isset($vars['Itemid']) && !empty($vars['Itemid'])) {
                     $menu =& shRouter::shGetMenu();
                     $item = $menu->getItem($vars['Itemid']);
                     if (is_object($item) && $vars['option'] == $item->component) {
                         $title[] = $item->route;
                     }
                 }
                 $prefix = shGetComponentPrefix($option);
                 if (!empty($prefix)) {
                     array_unshift($title, $prefix);
                 }
                 if (empty($title) && !shIsHomepage($string)) {
                     $title[] = substr($vars['option'], 4);
                 }
                 list($usedVars, $ignore) = $plugin->getNonSefVars($result);
                 if (!empty($ignore)) {
                     $usedVars = array_merge($usedVars, $ignore);
                 }
             } else {
                 $string = '';
                 $title[] = '/';
                 $usedVars = array();
             }
             // post process result to adjust to our workflow
             if (!empty($vars)) {
                 foreach ($vars as $key => $value) {
                     if (!array_key_exists($key, $usedVars)) {
                         shRemoveFromGETVarsList($key);
                     }
                 }
             }
             // finalize url
             $string = shFinalizePlugin($string, $title, $shAppendString = '', $shItemidString = '', isset($limit) ? @$limit : null, isset($limitstart) ? @$limitstart : null, isset($shLangName) ? @$shLangName : null, isset($showall) ? @$showall : null);
             break;
         case Sh404sefClassBaseextplugin::TYPE_ACESEF_ROUTER:
             Sh404sefHelperExtplugins::loadAcesefCompatLibs();
             include_once $extPluginPath;
             $className = 'AceSEF_' . $option;
             $plugin = new $className();
             $plugin->AcesefConfig = AcesefFactory::getConfig();
             // some plugins appear to not call the constructor parent, and so AcesefConfig is not set
             $tmp =& JPluginHelper::getPlugin('sh404sefextacesef', $option);
             $params = new JParameter($tmp->params);
             $plugin->setParams($params);
             $segments = array();
             $do_sef = true;
             $metadata = array();
             $item_limitstart = 0;
             $plugin->beforeBuild($originalUri);
             $originalVars = empty($originalUri) ? $vars : $originalUri->getQuery($asArray = true);
             $plugin->build($originalVars, $title, $do_sef, $metadata, $item_limitstart);
             $plugin->afterBuild($originalUri);
             $prefix = shGetComponentPrefix($option);
             if (empty($title) && isset($vars['Itemid']) && !empty($vars['Itemid'])) {
                 $menu =& shRouter::shGetMenu();
                 $item = $menu->getItem($vars['Itemid']);
                 if (is_object($item) && $vars['option'] == $item->component) {
                     $title[] = $item->route;
                 }
             }
             if (!empty($prefix)) {
                 array_unshift($title, $prefix);
             }
             if (empty($title) && !shIsHomepage($string)) {
                 $title[] = substr($vars['option'], 4);
             }
             // acesef plugin don't remove used vars from our GET var manager
             // we'll do it now. Vars used are those not present anymore in
             // $originalVars
             // they will be reappended to the SEF url by shFinalizePlugin
             $usedVars = array_diff($vars, $originalVars);
             if (!empty($usedVars)) {
                 foreach ($usedVars as $key => $value) {
                     shRemoveFromGETVarsList($key);
                 }
             }
             // remove Itemid and option, as these are not unset by plugin
             shRemoveFromGETVarsList('Itemid');
             shRemoveFromGETVarsList('option');
             // finalize url
             $string = shFinalizePlugin($string, $title, $shAppendString = '', $shItemidString = '', isset($limit) ? @$limit : null, isset($limitstart) ? @$limitstart : null, isset($shLangName) ? @$shLangName : null, isset($showall) ? @$showall : null);
             break;
         default:
             _log('Falling back to sefGetLocation');
             if (empty($sefConfig->defaultComponentStringList[str_replace('com_', '', $option)])) {
                 $title[] = getMenuTitle($option, isset($task) ? @$task : null, null, null, $shLanguage);
             } else {
                 $title[] = $sefConfig->defaultComponentStringList[str_replace('com_', '', $option)];
             }
             if ($title[0] != '/') {
                 $title[] = '/';
             }
             // V 1.2.4.q getMenuTitle can now return '/'
             if (count($title) > 0) {
                 // V 1.2.4.q use $shLanguage insted of $lang  (lang name rather than lang code)
                 $string = sef_404::sefGetLocation($string, $title, isset($task) ? @$task : null, isset($limit) ? @$limit : null, isset($limitstart) ? @$limitstart : null, isset($shLanguage) ? @$shLanguage : null);
             }
             break;
     }
     return $string;
 }
Exemple #3
0
}
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');
shRemoveFromGETVarsList('order_by');
$texpricemax = isset($texpricemax) ? @$texpricemax : null;
$texpricemin = isset($texpricemin) ? @$texpricemin : null;
$payment_method_id = isset($payment_method_id) ? @$payment_method_id : null;
$shipping_rate_id = isset($shipping_rate_id) ? @$shipping_rate_id : null;
$sql = "SELECT * FROM #__menu WHERE id = '{$Itemid}' AND link like '%option=com_redshop%' AND link like '%view={$view}%'";
$db->setQuery($sql);
$menu = $db->loadObject();
if (count($menu) == 0) {
    $menu = new stdClass();
    $menu->params = '';
    $menu->title = '';
}
$myparams = new JRegistry($menu->params);
// Set redSHOP prefix
$component_prefix = shGetComponentPrefix('com_redshop');
if (trim($component_prefix) != "") {
    $title[] = $component_prefix;
}
switch ($view) {
    case 'category':
        // If link set From Manufacturer detail Page
        if ($manufacturer_id) {
            $sql = "SELECT sef_url,manufacturer_name FROM #__redshop_manufacturer WHERE manufacturer_id = '{$manufacturer_id}'";
            $db->setQuery($sql);
            $manufacturer = $db->loadObject();
            $title[] = JFilterOutput::stringURLSafe($manufacturer->manufacturer_name);
        }
        if (!$cid) {
            $cid = $myparams->get('categoryid');
        }
// remove common URL from GET vars list, so that they don't show up as query string in the URL
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';
Exemple #6
0
            return false;
        }
    }
}
# Include the config file
require_once sh404SEF_ABS_PATH . 'components/com_mtree/mtree.class.php';
# Inlcude back-end class
require_once sh404SEF_ABS_PATH . 'administrator/components/com_mtree/admin.mtree.class.php';
$task = isset($task) ? $task : null;
$Itemid = isset($Itemid) ? $Itemid : null;
// V 1.2.4.t
$link_id = isset($link_id) ? $link_id : null;
$cat_id = isset($cat_id) ? $cat_id : null;
$user_id = isset($user_id) ? $user_id : null;
// shumisha : insert component name from menu
$shMTreeName = shGetComponentPrefix($option);
$shMTreeName = empty($shMTreeName) ? getMenuTitle($option, null, $Itemid, null, $shLangName) : $shMTreeName;
$shMTreeName = empty($shMTreeName) || $shMTreeName == '/' ? 'Directory' : $shMTreeName;
// V 1.2.4.t
if ($sefConfig->shInsertMTreeName && !empty($shMTreeName)) {
    $title[] = $shMTreeName;
}
switch ($task) {
    # List Categories (listcats)
    case 'listcats':
        if ($cat_id == 0) {
            // V 1.2.4.t 23/08/2007 18:20:20
            if (empty($title)) {
                $title[] = $shMTreeName;
            }
            shRemoveFromGETVarsList('cat_id');
$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('', $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;
}
Exemple #8
0
    shRemoveFromGETVarsList('view');
}
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;
Exemple #9
0
            case 'tags':
                $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));
        }
    }
Exemple #10
0
                                array_unshift($title, $menuRoute);
                            }
                        }
                    }
                }
            }
        }
    }
}
if (!empty($title)) {
    // add shop menu item, if asked to
    if ($sefConfig->shVmInsertShopName) {
        array_unshift($title, $shopName);
    }
    // add user defined prefix
    $prefix = shGetComponentPrefix($option);
    if (!empty($prefix)) {
        array_unshift($title, $prefix);
    }
    $title = empty($title) ? $title : $pageInfo->router->encodeSegments($title);
}
// manage GET var lists ourselves, as Joomla router.php does not do it
if (!empty($vars)) {
    // there are some unused GET vars, we must transfer them to our mechanism, so
    // that they are eventually appended to the sef url
    foreach ($vars as $k => $v) {
        switch ($k) {
            case 'option':
            case 'Itemid':
            case 'lang':
                shRemoveFromGETVarsList($k);
                $catData[$shLangName][$catId]['sec'] = $sec;
            }
        } 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;
Exemple #12
0
// ------------------  standard plugin initialize function - don't change ---------------------------
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) {
Exemple #13
0
 function create($string, &$vars, &$shAppendString, $shLanguage, $shSaveString = '', &$originalUri)
 {
     $sefConfig =& shRouter::shGetConfig();
     // get DB
     $database =& JFactory::getDBO();
     _log('Calling sef404 create function with ' . $string);
     if ($sefConfig->shInsertGlobalItemidIfNone && !empty($GLOBALS['Itemid'])) {
         // V 1.2.4.t
         $shCurrentItemid = $GLOBALS['Itemid'];
     } else {
         $shCurrentItemid = null;
     }
     $index = str_replace($GLOBALS['shConfigLiveSite'], '', $_SERVER['PHP_SELF']);
     $base = dirname($index);
     $base .= $base == '/' ? '' : '/';
     extract($vars);
     if (isset($title)) {
         // V 1.2.4.r : protect against components using 'title' as GET vars (com_jim for instance)
         $sh404SEF_title = $title;
     }
     // means that $sh404SEF_title has to be used in plugins or extensions
     $title = array();
     // V 1.2.4.r
     // Plug-in system.
     $shDoNotOverride = in_array(str_replace('com_', '', $option), $sefConfig->shDoNotOverrideOwnSef);
     // look first in component owndir for a joomla sef router.php file
     if (shFileExists(JPATH_ROOT . DS . 'components' . DS . $option . DS . 'router.php') && ($shDoNotOverride || !$shDoNotOverride && !shFileExists(sh404SEF_ABS_PATH . 'components/com_sh404sef/sef_ext/' . $option . '.php') && !shFileExists(JPATH_ROOT . DS . 'components/' . $option . '/sef_ext/' . $option . '.php'))) {
         // but we don't have a plugin
         // Load the plug-in file.
         _log('Loading component own router.php file');
         $functionName = ucfirst(str_replace('com_', '', $option)) . 'BuildRoute';
         if (!function_exists($functionName)) {
             include JPATH_ROOT . DS . 'components' . DS . $option . DS . 'router.php';
         }
         $originalVars = empty($originalUri) ? $vars : $originalUri->getQuery($asArray = true);
         $title = $functionName($originalVars);
         //$title = shRemoveSlugs( $title, $removeWhat = 'removeId');
         global $mainframe;
         $router =& $mainframe->getRouter();
         $title = $router->_encodeSegments($title);
         // manage GET var lists ourselves, as Joomla router.php does not do it
         if (!empty($vars)) {
             // there are some unused GET vars, we must transfer them to our mechanism, so
             // that they are eventually appended to the sef url
             foreach ($vars as $k => $v) {
                 switch ($k) {
                     case 'option':
                     case 'Itemid':
                         shRemoveFromGETVarsList($k);
                         break;
                     default:
                         // if variable has not been used in sef url, add it to list of variables to be
                         // appended to the url as query string elements
                         if (array_key_exists($k, $originalVars)) {
                             shAddToGETVarsList($k, $v);
                         } else {
                             shRemoveFromGETVarsList($k);
                         }
                         break;
                 }
             }
         }
         // special case for search component, as router.php encode the search word in the url
         // wa can't do that, as we are storing each url in the db
         if (isset($originalVars['option']) && $originalVars['option'] == 'com_search' && !empty($vars['searchword'])) {
             // router.php has encoded that in the url, we need to undo
             $title = array();
             $originalVars['searchword'] = $vars['searchword'];
             shAddToGETVarsList('searchword', $vars['searchword']);
             if (!empty($vars['view'])) {
                 $vars['view'] = $vars['view'];
                 shAddToGETVarsList('view', $vars['view']);
             }
         }
         // handle menu items, having only a single Itemid in the url
         // (router.php will return an empty array in that case, even if we have restored
         // the full non-sef url, as we already did)
         /*
          * Build the application route
          */
         $tmp = '';
         if (empty($title) && isset($vars['Itemid']) && !empty($vars['Itemid'])) {
             $menu =& shRouter::shGetMenu();
             $item = $menu->getItem($vars['Itemid']);
             if (is_object($item) && $vars['option'] == $item->component) {
                 $title[] = $item->route;
             }
         }
         if (empty($title)) {
             //$title[] = 'comp';
             $title[] = substr($vars['option'], 4);
         }
         // add user defined prefix
         $prefix = shGetComponentPrefix($option);
         if (!empty($prefix)) {
             array_unshift($title, $prefix);
         }
         // now process the resulting title string
         $string = shFinalizePlugin($string, $title, $shAppendString, '', isset($limit) ? @$limit : null, isset($limitstart) ? @$limitstart : null, isset($shLangName) ? @$shLangName : null, isset($showall) ? @$showall : null);
     } else {
         // look then in component own /sef_ext/ dir for a com_component_name.php plugin file
         if (shFileExists(sh404SEF_ABS_PATH . 'components/' . $option . '/sef_ext/' . $option . '.php')) {
             // Load the plug-in file.
             _log('Loading component own sh404SEF plugin');
             include sh404SEF_ABS_PATH . 'components/' . $option . '/sef_ext/' . $option . '.php';
         } else {
             if (shFileExists(sh404SEF_ABS_PATH . 'components/com_sh404sef/sef_ext/' . $option . '.php')) {
                 _log('Loading built-in plugin');
                 include sh404SEF_ABS_PATH . 'components/com_sh404sef/sef_ext/' . $option . '.php';
             } else {
                 // no plugin found at all, use Joomla 1.0.x sef
                 _log('Falling back to sefGetLocation');
                 if (empty($sefConfig->defaultComponentStringList[str_replace('com_', '', $option)])) {
                     $title[] = getMenuTitle($option, isset($task) ? @$task : null, null, null, $shLanguage);
                 } else {
                     $title[] = $sefConfig->defaultComponentStringList[str_replace('com_', '', $option)];
                 }
                 if ($title[0] != '/') {
                     $title[] = '/';
                 }
                 // V 1.2.4.q getMenuTitle can now return '/'
                 if (count($title) > 0) {
                     // V 1.2.4.q use $shLanguage insted of $lang  (lang name rather than lang code)
                     $string = sef_404::sefGetLocation($string, $title, isset($task) ? @$task : null, isset($limit) ? @$limit : null, isset($limitstart) ? @$limitstart : null, isset($shLanguage) ? @$shLanguage : null);
                 }
             }
         }
     }
     return $string;
 }
Exemple #14
0
        } else {
            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));
Exemple #15
0
$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_weblinks', $shLangIso, 'COM_SH404SEF_CREATE_NEW_LINK');
// ------------------  load language file - adjust as needed ----------------------------------------
// collect probable url vars
$view = isset($view) ? $view : null;
$task = isset($task) ? $task : null;
$Itemid = isset($Itemid) ? $Itemid : null;
$id = isset($id) ? $id : null;
$catid = isset($catid) ? $catid : null;
// optional prefix
$shWeblinksName = shGetComponentPrefix($option);
if (!empty($shWeblinksName) && $shWeblinksName != '/') {
    $title[] = $shWeblinksName;
}
// joomla content models
$slugsModel = Sh404sefModelSlugs::getInstance();
$menuItemTitle = getMenuTitle(null, $view, isset($Itemid) ? $Itemid : null, '', $shLangName);
$uncategorizedPath = $sefConfig->slugForUncategorizedWeblinks == shSEFConfig::COM_SH404SEF_UNCATEGORIZED_EMPTY ? '' : $menuItemTitle;
$slugsArray = array();
if ($task == 'weblink.go') {
    // jumping to link target
    if (!empty($id)) {
        try {
            $weblinkDetails = ShlDbHelper::selectObject('#__weblinks', array('id', 'title', 'catid'), array('id' => $id));
            $slugsArray[] = $weblinkDetails->title;
        } catch (Exception $e) {
Exemple #16
0
    shAddToGETVarsList('Itemid', $Itemid);
    // 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);
            }
Exemple #17
0
    function shSobi2GetParentCats($catid)
    {
        global $shSobi2CatParents;
        // get DB
        $database =& JFactory::getDBO();
        $query = "SELECT `parentid` from `#__sobi2_cats_relations` WHERE `catid`= {$catid}";
        $database->setQuery($query);
        if ($catid != 1) {
            array_push($shSobi2CatParents, $catid);
        }
        if (sizeof($database->loadResult()) != 0) {
            shSobi2GetParentCats($database->loadResult());
        }
    }
}
$shSobi2Name = shGetComponentPrefix($option);
if (!empty($shSobi2Name)) {
    $title[] = $shSobi2Name;
}
$sobi2Task = isset($sobi2Task) ? @$sobi2Task : null;
/* get the task */
switch ($sobi2Task) {
    case 'addNew':
        $title[] = $sh_LANG[$shLangIso]['_SH404SEF_SOBI2_CREATE_NEW'];
        shRemoveFromGETVarsList('sobi2Task');
        break;
    case 'search':
        $title[] = $sh_LANG[$shLangIso]['_SH404SEF_SOBI2_SEARCH_ENTRY'];
        shRemoveFromGETVarsList('sobi2Task');
        break;
    case 'editSobi':
Exemple #18
0
        }
        // 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;
    }
shRemoveFromGETVarsList('option');
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
Exemple #20
0
    $groups = implode(',', $user->getAuthorisedViewLevels());
    $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)) {