0 ) if( stristr($GLOBALS[SERVER_NAME],$h) ) return true; } return false; } //----------------------------------------------------- // HideHost($hosts) // - - - - - - - - - // Returns false if any of the hosts match the host as // requested in the HTTP header. // // $hosts - a string containing partial host names // seperated by spaces: "host1 host2 ..." //----------------------------------------------------- function HideHost( $hosts ) { return !ShowHost($hosts); } //----------------------------------------------------- // InsertHeader() // - - - - - - - // Print all of the HTTP header information. //----------------------------------------------------- function InsertHeader() { print "$REQUEST_METHOD $REQUEST_URI $SERVER_PROTOCOL\n"; $h=getallheaders(); while( list($key,$value) = each($h) ) print "$key: $value\n"; print "\n"; } //----------------------------------------------------- // ShowHeader($text) // - - - - - - - - - // Returns true if the text is anywhere in the header. // // $text - a string. //----------------------------------------------------- function ShowHeader( $text ) { return stristr(GetHeader(),$text); } //----------------------------------------------------- // HideHeader($text) // - - - - - - - - - // Returns false if the text is anywhere in the header. // // $text - a string. //----------------------------------------------------- function HideHeader( $text ) { return !ShowHeader($text); } //----------------------------------------------------- // InsertReferrer() // - - - - - - - // Print the URL of the referring page. //----------------------------------------------------- function InsertReferrer() { print $GLOBALS[HTTP_REFERER]; } function InsertReferer() { return InsertReferrer(); } //----------------------------------------------------- // ShowReferrer($referrers) // - - - - - - - - - - - - // Returns true if any of the elements in $referrers // are part of the referring page. // // $referrers - a string containing partial path names // seperated by spaces: // "referrer1 referrer2 ..." //----------------------------------------------------- function ShowReferrer( $referrers = 0 ) { if( empty($referrers) ) return !empty($GLOBALS[HTTP_REFERER]); if( !is_array($referrers) ) $referrers = explode(" ",trim($referrers)); while( $referrer = each($referrers) ) { $r = trim($referrer[value]); if( strlen($r) > 0 ) if( stristr($GLOBALS[HTTP_REFERER],$r) ) return true; } return false; } function ShowReferer($r = 0) { return ShowReferrer($r); } //----------------------------------------------------- // HideReferrer($referrers) // - - - - - - - - - - - - // Returns false if any of the elements in $referrers // are part of the referring page. // // $referrers - a string containing partial path names // seperated by spaces: // "referrer1 referrer2 ..." //----------------------------------------------------- function HideReferrer( $referrers ) { return !ShowReferrer($referrers); } function HideReferer($r = 0) { return HideReferrer($r); } //----------------------------------------------------- // InsertThisURL() // - - - - - - - - // Print the URL of this page. //----------------------------------------------------- function InsertThisURL() { print $GLOBALS[SCRIPT_NAME]; } //----------------------------------------------------- // ShowThisURL($urls) // - - - - - - - - - // Returns true if any of the elements in $urls // are part of this page's URL. // // $urls - a string containing partial url paths // seperated by spaces: "url1 url2 ..." //----------------------------------------------------- function ShowThisURL( $urls ) { if( !is_array($urls) ) $urls = explode(" ",trim($urls)); while( $url = each($urls) ) { $u = trim($url[value]); if( strlen($u) > 0 ) if( stristr($GLOBALS[SCRIPT_NAME],$u) ) return true; } return false; } //----------------------------------------------------- // HideThisURL($urls) // - - - - - - - - - // Returns false if any of the elements in $urls // are part of this page's URL. // // $urls - a string containing partial url paths // seperated by spaces: "url1 url2 ..." //----------------------------------------------------- function HideThisURL( $urls ) { return !ShowThisURL($urls); } //----------------------------------------------------- // InsertPath() // - - - - - - // Print the path appended to the URL. The path is the // text following $ but before ? in the URL request. // // See GetPath(). //----------------------------------------------------- function InsertPath() { print GetPath(); } //----------------------------------------------------- // GetPath() // - - - - - // Returns a string containing the path. The path is // the text following $ but before ? in the request. //----------------------------------------------------- function GetPath() { strtok($REQUEST_URI,"$"); return stripslashes(rawurldecode(strtok("?"))); } //----------------------------------------------------- // ShowPath($paths) // - - - - - - - - // Returns true if any of the elements in $paths // are part of the path for this page. // // $paths - a string containing text phrases seperated // by spaces: "path1 path2 ..." // // See: GetPath(). //----------------------------------------------------- function ShowPath( $paths = 0 ) { if( empty($paths) ) return empty(GetPath()); if( !is_array($paths) ) $paths = explode(" ",trim($paths)); while( $path = each($paths) ) { $p = trim($path[value]); if( strlen($p) > 0 ) if( stristr(GetPath(),$p) ) return true; } return false; } //----------------------------------------------------- // HidePath($paths) // - - - - - - - - // Returns true if any of the elements in $paths // are part of the path for this page. // // $paths - a string containing text phrases seperated // by spaces: "path1 path2 ..." // // See: ShowPath(). //----------------------------------------------------- function HidePath( $paths = 0 ) { return !ShowPath($paths); } //----------------------------------------------------- // InsertSearch() // - - - - - - // Print the search appended to the URL. The search is // the text following ? in the URL request. // // See GetSearch(). //----------------------------------------------------- function InsertSearch() { print GetSearch(); } //----------------------------------------------------- // GetSearch() // - - - - - // Returns the search appended to the URL. The search // is the text following ? in the URL request. //----------------------------------------------------- function GetSearch() { return strtr(stripSlashes(rawurldecode($GLOBALS[QUERY_STRING])),"+"," "); } //----------------------------------------------------- // ShowSearch($search) // - - - - - - - - - - // Returns true if any of the elements in $search are // part of the search for this page. // // $search - a string containing text phrases seperated // by spaces: "search1 search2 ..." // // See: GetSearch(). //----------------------------------------------------- function ShowSearch( $search = 0 ) { if( empty($search) ) return empty(GetSearch); if( !is_array($search) ) $search = explode(" ",trim($search)); while( $theSearch = each($search) ) { $s = trim($theSearch[value]); if( strlen($s) > 0 ) if( stristr(GetSearch(),$s) ) return true; } return false; } //----------------------------------------------------- // HideSearch($search) // - - - - - - - - - - // Returns false if any of the elements in $search are // part of the search for this page. // // $search - a string containing text phrases seperated // by spaces: "search1 search2 ..." // // See: ShowSearch(). //----------------------------------------------------- function HideSearch( $search = 0 ) { return !ShowSearch($search); } ?>