PHP Code:
/*
* The HTML href link wrapper function
*/
function zen_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true, $static = false, $use_dir_ws_catalog = true) {
global $request_type, $session_started, $http_domain, $https_domain, $zco_notifier;
// START alternative URLs patch
global $altURLs;
// END alternative URLs patch
$link = null;
$zco_notifier->notify('NOTIFY_SEFU_INTERCEPT', array(), $link, $page, $parameters, $connection, $add_session_id, $static, $use_dir_ws_catalog);
// START alternative URLs patch
if(isset($altURLs)) {
$link = $altURLs->href_link($page, $parameters, $connection, $add_session_id, $static, $use_dir_ws_catalog);
if($link !== null) return $link;
}
// END alternative URLs patch
if (!zen_not_null($page)) {
die('</td></tr></table></td></tr></table><br /><br /><strong class="note">Error!<br /><br />Unable to determine the page link!</strong><br /><br /><!--' . $page . '<br />' . $parameters . ' -->');
}
if ($connection == 'NONSSL') {
$link = HTTP_SERVER;
} elseif ($connection == 'SSL') {
if (ENABLE_SSL == 'true') {
$link = HTTPS_SERVER ;
} else {
$link = HTTP_SERVER;
}
} else {
die('</td></tr></table></td></tr></table><br /><br /><strong class="note">Error!<br /><br />Unable to determine connection method on a link!<br /><br />Known methods: NONSSL SSL</strong><br /><br />');
}
if ($use_dir_ws_catalog) {
if ($connection == 'SSL' && ENABLE_SSL == 'true') {
$link .= DIR_WS_HTTPS_CATALOG;
} else {
$link .= DIR_WS_CATALOG;
}
}
if (!$static) {
if (zen_not_null($parameters)) {
$link .= 'index.php?main_page='. $page . "&" . zen_output_string($parameters);
} else {
$link .= 'index.php?main_page=' . $page;
}
} else {
if (zen_not_null($parameters)) {
$link .= $page . "?" . zen_output_string($parameters);
} else {
$link .= $page;
}
}
$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 (defined('SID') && zen_not_null(constant('SID'))) {
$sid = constant('SID');
// } elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL_ADMIN == 'true') ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {
} elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL == 'true') ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {
if ($http_domain != $https_domain) {
$sid = zen_session_name() . '=' . zen_session_id();
}
}
}
// clean up the link before processing
while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);
while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);
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);
$link = str_replace('=', '/', $link);
$separator = '?';
}
if (isset($sid)) {
$link .= $separator . zen_output_string($sid);
}
// clean up the link after processing
while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);
$link = preg_replace('/&/', '&', $link);
return $link;
}
Bookmarks