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 = '?';
}
/* ===== BEGIN Fix for zenid =====*/
// set "$separator" to "?" if URL ends with ".php" or ".html"
if (ereg('\.php$', $link)) {
$separator = '?';
}
if (ereg('\.html$', $link)) {
$separator = '?';
}
/* ===== END Fix for zenid ===== */
if (isset($sid)) {
$link .= $separator . zen_output_string($sid);
}
// clean up the link after processing
while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);
$link = ereg_replace('&', '&', $link);
return $link;
}