/**
  * Create the uri link string for this module
  * 
  * @param string $page - base file name
  * @param string $text - uri link text
  * @param string $seperator - e.g. -p- or -c- etc.
  * @param string $value - integer or string if a path like 44_22_2
  * @see includes/usu_general_functions.php usu5_multi_language()
  * 
  * @access public
  * @return string - uri link string
  */
 public function createLinkString($page, $text, $seperator, $value)
 {
     return $page . '/' . usu5_multi_language($separator = 'right') . $text . $seperator . $value;
 }
/**
 * Standard osCommerce tep_href_link() link wrapper function
 * @uses die()
 * @uses substr()
 * @uses strstr()
 * @uses str_replace()
 * 
 * 
 * @param string $page - base file name or sometimes a path
 * @param string $parameters - querystring parameters
 * @param string $connection - SSL / NONSSL
 * @param bool $add_session_id
 * @param bool $search_engine_safe
 * @return string - URL
 */
function osc_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true)
{
    global $request_type, $session_started, $SID;
    if (!tep_not_null($page)) {
        die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine the page link!<br><br>');
    }
    if ($connection == 'NONSSL') {
        $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
    } elseif ($connection == 'SSL') {
        if (ENABLE_SSL == true) {
            $link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG;
        } else {
            $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
        }
    } else {
        die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine connection method on a link!<br><br>Known methods: NONSSL SSL</b><br><br>');
    }
    $multi_language_valid = true;
    if (false !== strpos($page, '/') || substr($page, -4, strlen($page)) != '.php') {
        $multi_language_valid = false;
    }
    if (tep_not_null($parameters)) {
        $link .= $page;
        $link .= ($multi_language_valid ? usu5_multi_language('left') : null) . '?' . tep_output_string($parameters);
        $separator = '&';
    } else {
        $link .= $page;
        $link .= $multi_language_valid ? usu5_multi_language('left') : null;
        $separator = '?';
    }
    while (substr($link, -1) == '&' || substr($link, -1) == '?') {
        $link = substr($link, 0, -1);
    }
    // Add the session ID when moving from different HTTP and HTTPS servers, or when SID is defined
    if ($add_session_id == true && $session_started == true && SESSION_FORCE_COOKIE_USE == 'False') {
        if (tep_not_null($SID)) {
            $_sid = $SID;
        } elseif ($request_type == 'NONSSL' && $connection == 'SSL' && ENABLE_SSL == true || $request_type == 'SSL' && $connection == 'NONSSL') {
            if (HTTP_COOKIE_DOMAIN != HTTPS_COOKIE_DOMAIN) {
                $_sid = tep_session_name() . '=' . tep_session_id();
            }
        }
    }
    if (SEARCH_ENGINE_FRIENDLY_URLS == 'true' && $search_engine_safe == true) {
        while (strstr($link, '&&')) {
            $link = str_replace('&&', '&', $link);
        }
        $link = str_replace('?', '/', $link);
        $link = str_replace('&', '/', $link);
        $link = str_replace('=', '/', $link);
        $separator = '?';
    }
    if (isset($_sid)) {
        $link .= $separator . tep_output_string($_sid);
    }
    // Remove index.php from the link when it is www.mysite.com/index.php
    if (false !== do_homepage_redirect($link)) {
        $link = str_replace(FILENAME_DEFAULT, '', $link);
    }
    if (Usu_Main::monitorPerformance()) {
        Usu_Main::$performance['std_urls']++;
        Usu_Main::$performance['std_url_array'][] = $link;
    }
    switch (defined('USU5_USE_W3C_VALID') && USU5_USE_W3C_VALID == 'true') {
        case true:
            return htmlspecialchars(utf8_encode($link));
            break;
        default:
            return $link;
            break;
    }
    return $link;
}