setHeader() public static method

public static setHeader ( $name, $value, $httpResponseCode = null )
    public function passthru() {
        $getString = $this->encodeArray($_GET);
        if ($getString != '') {
            $getString = '?' . $getString;
        }

        Gpf_Http::setHeader('Location', $this->getReplicatedSiteRealUrl() . $this->fileName . $getString);
    }
Esempio n. 2
0
 private function printHeaders()
 {
     Gpf_Http::setHeader(Gpf_Net_Server_Http_Response::CONTENT_TYPE, $this->file->get('filetype'));
     if ($this->isAttachment()) {
         Gpf_Http::setHeader(Gpf_Net_Server_Http_Response::CONTENT_DISPOSITION, 'attachment; filename="' . htmlspecialchars($this->file->get('filename')) . '"');
     }
     Gpf_Http::setHeader(Gpf_Net_Server_Http_Response::CONTENT_LENGTH, $this->file->get('filesize'));
     return true;
 }
Esempio n. 3
0
 protected function setError(Exception $e)
 {
     $this->gwtModuleName = '';
     try {
         $template = new Gpf_Templates_Template('start_error.tpl');
         $template->assign('errorMessage', $e->getMessage());
         $this->body = $template->getHTML();
     } catch (Gpf_ResourceNotFoundException $e) {
         Gpf_Http::setHeader(Gpf_Net_Server_Http_Response::LOCATION, Gpf_Paths::getInstance()->getInstallDirectoryPath());
     } catch (Exception $outerException) {
         die(sprintf("Fatal startup error: %s (%s)", $e->getMessage(), $outerException->getMessage()));
     }
 }
 protected function printHeaders()
 {
     Gpf_Http::setHeader("Content-Type", $this->getType());
     if ($this->isAttachment()) {
         Gpf_Http::setHeader('Cache-Control', 'private, must-revalidate');
         Gpf_Http::setHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT');
         Gpf_Http::setHeader('Last-Modified', gmdate("D, d M Y H:i:s") . " GMT");
         Gpf_Http::setHeader("Content-Transfer-Encoding", 'binary');
         Gpf_Http::setHeader('Content-Description', 'File Transfer');
         Gpf_Http::setHeader('Content-Type', 'application/force-download');
         Gpf_Http::setHeader(Gpf_Net_Server_Http_Response::CONTENT_DISPOSITION, 'attachment; filename="' . htmlspecialchars($this->getFileName()) . '"');
     }
     Gpf_Http::setHeader(Gpf_Net_Server_Http_Response::CONTENT_LENGTH, $this->getSize());
 }
Esempio n. 5
0
    public function __construct() {
        $this->request = new Pap_Tracking_Request();
        $this->site = $this->loadSite($this->request->getRequestParameter('a_bid'));
        $userId = $this->request->getRequestParameter('a_aid');
        $fileName = $this->request->getRequestParameter('a_file');

        $this->checkIfTestCall($userId, $fileName);
        $this->user = $this->loadUser($userId);

        if ($this->request->getRequestParameter('a_redir') == Gpf::YES) {
            Gpf_Http::setHeader(Gpf_Net_Server_Http_Response::LOCATION, $this->site->getUrl($this->user));
            exit();
        }

        if ($this->site->getSourceType() == Pap_Features_SiteReplication_Site::SOURCE_EXTERNAL_URL) {
            $this->driver = new Pap_Features_SiteReplication_Driver_ExternalUrl($this->sanitizeFileName($fileName), $this->site);
        } else {
            $this->driver = new Pap_Features_SiteReplication_Driver_LocalFiles($this->sanitizeFileName($fileName), $this->site);
        }
    }
Esempio n. 6
0
 /**
  * @return Gpf_Rpc_Serializable
  */
 public function execute($request = '')
 {
     try {
         if (isset($_REQUEST[self::BODY_DATA_NAME])) {
             $request = $this->parseRequestDataFromPost($_REQUEST[self::BODY_DATA_NAME]);
         }
         if ($this->isStandardRequestUsed($_REQUEST)) {
             $request = $this->setStandardRequest();
         }
         $this->setDecoder($request);
         $params = new Gpf_Rpc_Params($this->decodeRequest($request));
         $this->setEncoder($params);
         $response = $this->executeRequest($params);
     } catch (Exception $e) {
         return new Gpf_Rpc_ExceptionResponse($e);
     }
     if (!$this->isFormRequest($request)) {
         Gpf_Http::setHeader('Content-Type', 'application/json; charset=utf-8');
     }
     return $response;
 }
Esempio n. 7
0
 public function redirectTo($url)
 {
     Gpf_Http::setHeader(Gpf_Net_Server_Http_Response::LOCATION, $url, 301);
     //echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;URL=$url\">";
 }
Esempio n. 8
0
 protected function redirectToLogin()
 {
     Gpf_Http::setHeader(Gpf_Net_Server_Http_Response::LOCATION, 'login.php');
     exit;
 }
 public function generate()
 {
     $this->image = $this->createImage();
     $backgroundColor = $this->createColor($this->image, Gpf_Common_Captcha_RgbColor::createRandomColor(224, 255));
     imagefilledrectangle($this->image, 0, 0, $this->width, $this->height, $backgroundColor);
     $this->fillWithNoiseOrGrid();
     $this->generateText();
     Gpf_Http::setHeader(Gpf_Net_Server_Http_Response::CONTENT_TYPE, 'image/jpeg');
     ob_start();
     imagejpeg($this->image, null, $this->jpegQuality);
     $imageText = ob_get_contents();
     ob_end_clean();
     imagedestroy($this->image);
     return $imageText;
 }
Esempio n. 10
0
 protected function redirectToPanel()
 {
     Gpf_Http::setHeader(Gpf_Net_Server_Http_Response::LOCATION, $this->panelUrl);
     exit;
 }
Esempio n. 11
0
    private function sendP3PHeader() {
        $p3pPolicy = Gpf_Settings::get(Pap_Settings::URL_TO_P3P);
        $compactPolicy = Gpf_Settings::get(Pap_Settings::P3P_POLICY_COMPACT);

        if($p3pPolicy == '' && $compactPolicy == '') {
            return;
        }
        $p3pHeader = ($p3pPolicy == '' ? '' : 'policyref="'.$p3pPolicy.'"').
        ($compactPolicy != '' && $p3pPolicy != '' ? ', ' : '').($compactPolicy == '' ? '' : 'CP="'.$compactPolicy.'"');
         
        Gpf_Http::setHeader('P3P', $p3pHeader);
    }
Esempio n. 12
0
 public function passthru() {
     Gpf_Http::setHeader("Content-Type", $this->file->getMimeType());
     $this->file->passthru();
 }
Esempio n. 13
0
 /**
  *
  * @service authentication logout
  * @return Gpf_Rpc_Action
  */
 public function logoutByURL(Gpf_Rpc_Params $params)
 {
     try {
         $panelName = Gpf_Session::getModule()->getPanelName();
         Gpf_Session::getAuthUser()->logout();
         Gpf_Http::setHeader('Location', Gpf_Paths::getInstance()->getTopPath() . $panelName . '/login.php');
     } catch (Exception $e) {
         echo $this->_('Logout was not successful');
     }
 }
Esempio n. 14
0
 public static function sendJavaScriptHeaders() {
     Gpf_Http::setHeader('Content-Type', 'application/x-javascript');
 }
Esempio n. 15
0
'data1' => @$_GET[$settings->get('param_name_extra_data1')],
'data2' => @$_GET[$settings->get('param_name_extra_data2')],
);

require_once 'bootstrap.php';
@include_once('../include/Compiled/Impression.php');

Gpf_Session::create(new Pap_Tracking_ModuleBase(), null, false);

$impression = new Pap_Db_RawImpression(0);
foreach ($impParams as $key => $value) {
    $impression->set($key, $value);
}
$processor = new Pap_Tracking_Impression_ImpressionProcessor();
$processor->runOnline($impression);

try {
    $banner = $processor->getBanner($bannerId);
    if ($banner != null && $banner->getBannerType() == Pap_Common_Banner_Factory::BannerTypeImage) {
        Gpf_Http::setHeader(Gpf_Net_Server_Http_Response::LOCATION, $banner->getImageUrl(), 301);
        exit();
    }
} catch (Gpf_Exception $e) {
}

setcookie('PAPCookie_Imp_'.$bannerId, 'pap', time() + 315569260);
header('Content-Type: image/gif', true, null);
readfile('scripts/pix.gif');

?>