http://www.fsf.org/ or write * to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. * */ /* Simple HTTP relocator for CMSDAM */ Class CmsDam_HTTP_relocator { var $HTTP_olduri; var $HTTP_newuri; function CmsDam_HTTP_relocator() { // CmsDam_HTTP_relocator Constructor // $this->$HTTP_olduri = $_SERVER['PHP_SELF']; Global $_SERVER_VARS, $_SERVER; $this->HTTP_olduri = "http://".$_SERVER_VARS['HTTP_HOST'] ."/".$_SERVER_VARS['PHP_SELF'] .$_SERVER['QUERY_STRING']; return true; } function CmsDam_HTTP_relocator_SetUri($new_uri) { // Use this method to set up the new URI to redirect the user if (isset ($new_uri) && strlen($new_uri) > 0) { if ($this->HTTP_newuri != "") { // Set old uri $this->HTTP_olduri = $this->HTTP_newuri; } $this->HTTP_newuri = $new_uri; } return true; } function CmsDam_HTTP_relocator_GetOldUri() { // Use this method to return old uri return $this->HTTP_olduri; } function CmsDam_HTTP_relocator_GetNewUri() { // Use this method to return new uri return $this->HTTP_newuri; } function CmsDam_HTTP_relocator_SendToUri($new_uri) { $this->CmsDam_HTTP_relocator_SetUri($new_uri); // Clean PHP output buffer // I have to turn off output buffering because of a PHP bug in ob_clean()! ob_end_clean(); // Make the external redirection and exit header("Location: " . $this->HTTP_newuri); exit(); } function CmsDam_HTTP_relocator_SendToSection($newsection, $uri_parameters="") { $new_uri = '?section=' . $newsection; if ($uri_parameters != "") { // URI parameters passed $new_uri .= "&" . htmlentities(urlencode($uri_parameters)); } $this->CmsDam_HTTP_relocator_SetUri($new_uri); // Clean PHP output buffer // I have to turn off output buffering because of a PHP bug in ob_clean()! ob_end_clean(); // die ("DEBUG: " . "Location: " . $this->HTTP_newuri); // Make the external redirection and exit header("Location: " . $this->HTTP_newuri); exit(); } function CmsDam_HTTP_relocator_SendToSectionNOCache($newsection, $uri_parameters="") { $new_uri = '?n_c=1§ion=' . $newsection; if ($uri_parameters != "") { // URI parameters passed $new_uri .= "&" . htmlentities(urlencode($uri_parameters)); } $this->CmsDam_HTTP_relocator_SetUri($new_uri); // Clean PHP output buffer // I have to turn off output buffering because of a PHP bug in ob_clean()! ob_end_clean(); // die ("DEBUG: " . "Location: " . $this->HTTP_newuri); // Make the external redirection and exit header("Location: " . $this->HTTP_newuri); exit(); } } // Last things after plugin inclusion // People can use courieradm classes $this->included->http_relocator->api = new CmsDam_HTTP_relocator; ?>