Inheritance: extends Gpf_Object, implements Gpf_HttpResponse
Ejemplo n.º 1
0
    public function passthru() {
        $getString = $this->encodeArray($_GET);
        if ($getString != '') {
            $getString = '?' . $getString;
        }

        Gpf_Http::setHeader('Location', $this->getReplicatedSiteRealUrl() . $this->fileName . $getString);
    }
Ejemplo 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;
 }
Ejemplo n.º 3
0
 public function insert()
 {
     $password = $this->get(Gpf_Db_Table_AuthUsers::PASSWORD);
     if (strlen(trim($password)) == 0) {
         $this->set(Gpf_Db_Table_AuthUsers::PASSWORD, Gpf_Common_String::generatePassword(8));
     }
     $this->generateAuthToken();
     $this->setIp(Gpf_Http::getRemoteIp());
     parent::insert();
 }
Ejemplo n.º 4
0
 protected function setVariableValues() {
     $this->setVariable(self::AFF_NAME, trim($this->user->getFirstName()) . ' ' . trim($this->user->getLastName()));
     $this->setVariable(self::AFF_REFID, trim($this->user->getRefId()));
     $this->setVariable(self::AFF_EMAIL, trim($this->user->getEmail()));
     $this->setVariable(self::AFF_IP, Gpf_Http::getRemoteIp());
     
     $this->setVariable(AutoResponsePlus_Config::NAME, $this->getSettingForSubject(AutoResponsePlus_Config::NAME));
     $this->setVariable(AutoResponsePlus_Config::PASSWORD, $this->getSettingForSubject(AutoResponsePlus_Config::PASSWORD));
     $this->setVariable(AutoResponsePlus_Config::AUTORESPONDER_ADDRESS, $this->getSettingForSubject(AutoResponsePlus_Config::AUTORESPONDER_ADDRESS));
     $this->setVariable(AutoResponsePlus_Config::HTML, (Gpf_Settings::get(AutoResponsePlus_Config::HTML) == Gpf::YES ? 'html' : 'plain'));
     $this->setVariable(AutoResponsePlus_Config::TRACKING_TAB, $this->getSettingForSubject(AutoResponsePlus_Config::TRACKING_TAB));
     $this->setVariable(AutoResponsePlus_Config::DROP_RULES, (Gpf_Settings::get(AutoResponsePlus_Config::DROP_RULES) == Gpf::YES ? 'yes' : 'no'));
 }
Ejemplo n.º 5
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()));
     }
 }
Ejemplo n.º 6
0
 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());
 }
Ejemplo n.º 7
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);
        }
    }
Ejemplo n.º 8
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\">";
 }
Ejemplo n.º 9
0
 public function onStart()
 {
     $this->info('HTTP server ' . $this->serverName . ' has been started');
     Gpf_Http::setInstance($this);
 }
Ejemplo n.º 10
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);
    }
Ejemplo n.º 11
0
 protected function insertTransaction($affiliateId, $type, $commissionValue, $status, Gpf_Data_Record $commission = null) {
     if ($affiliateId == null) {
         return;
     }
     $transaction = new Pap_Common_Transaction();
     $transaction->setUserId($affiliateId);
     $transaction->setType($type);
     if ($commission != null) {
         $transaction->setTier($commission->get(Pap_Db_Table_Commissions::TIER));
     } else {
         $transaction->setTier('1');
     }
     $transaction->setStatus($status);
     $transaction->setPayoutStatus('U');
     $transaction->setDateInserted(Gpf_Common_DateUtils::now());
     $transaction->setCommission($commissionValue);
     $transaction->setData5($this->user->getId());
     $transaction->setIp(Gpf_Http::getRemoteIp());
     $transaction->insert();
 }
Ejemplo n.º 12
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');
     }
 }
Ejemplo n.º 13
0
 protected function redirectToLogin()
 {
     Gpf_Http::setHeader(Gpf_Net_Server_Http_Response::LOCATION, 'login.php');
     exit;
 }
Ejemplo n.º 14
0
 public static function sendJavaScriptHeaders() {
     Gpf_Http::setHeader('Content-Type', 'application/x-javascript');
 }
Ejemplo n.º 15
0
 public function passthru() {
     Gpf_Http::setHeader("Content-Type", $this->file->getMimeType());
     $this->file->passthru();
 }
Ejemplo n.º 16
0
 /**
  * 
  * @return Pap_Db_Visit
  */
 protected function createVisit() {
     $visit = new Pap_Db_Visit(Gpf_Settings::get(Pap_Settings::VISITS_TABLE_INPUT));
     $visit->setSaleParams($this->getJSONsale());
     $visit->setCookies($this->getCookieParams());
     $visit->setVisitorId($this->getVisitorId());
     $visit->setAccountId($this->getAccountId());
     $visit->setTrackMethod($this->getTrackMethod());
     $visit->setIp(@Gpf_Http::getRemoteIp());
     $visit->setUserAgent(@$_SERVER['HTTP_USER_AGENT']);
     $visit->setDateVisit(Gpf_Common_DateUtils::now());
     $visit->setReferrerUrl($this->referrer);
     $visit->setVisitorIdHash(sprintf('%u', crc32($this->getVisitorId())) % 255);
     return $visit;
 }
Ejemplo n.º 17
0
    protected function checkBeforeSave($row, Gpf_Rpc_Form $form, $operationType = self::EDIT) {
        $result = parent::checkBeforeSave($row, $form, $operationType);

        if (!$this->isFromApi) {
            Gpf_Plugins_Engine::extensionPoint('Pap_Signup_AffiliateForm.checkBeforeSaveNotApi', $form);
            if ($form->isError()) {
                $result = false; 
            }
        }

        $context = new Pap_Signup_SignupFormContext(Gpf_Http::getRemoteIp(), $form, $row);
        $fraudProtectionObj = new Pap_Signup_FraudProtection();
        $fraudProtectionObj->check($context);

        return $result && $context->isSaveAllowed();
    }
Ejemplo n.º 18
0
 protected function redirectToPanel()
 {
     Gpf_Http::setHeader(Gpf_Net_Server_Http_Response::LOCATION, $this->panelUrl);
     exit;
 }
Ejemplo n.º 19
0
 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;
 }
Ejemplo n.º 20
0
 public function getIP()
 {
     if ($this->getForcedIp() !== '') {
         return $this->getForcedIp();
     }
     return Gpf_Http::getRemoteIp();
 }
Ejemplo n.º 21
0
    public function getDefaultCountry(Gpf_Plugins_ValueContext $valueContext) {
        $ip = Gpf_Http::getRemoteIp();
        if (!strlen($ip) || $ip == '127.0.0.1') {
            return;
        }

        try {
            $location = new GeoIp_Location();
            $location->setIpString($ip);
            $location->load();
            $valueContext->set($location->getCountryCode());
        } catch (Exception $e) {
        }
    }
Ejemplo n.º 22
0
 /**
  * logs message
  *
  * @param string $message
  * @param string $logLevel
  * @param string $logGroup
  */
 public function log($message, $logLevel, $logGroup = null)
 {
     $time = time();
     $group = $logGroup;
     if ($this->group !== null) {
         $group = $this->group;
         if ($logGroup !== null) {
             $group .= ' ' . $logGroup;
         }
     }
     $callingFile = $this->findLogFile();
     $file = $callingFile['file'];
     if (isset($callingFile['classVariables'])) {
         $file .= ' ' . $callingFile['classVariables'];
     }
     $line = $callingFile['line'];
     $ip = Gpf_Http::getRemoteIp();
     if ($ip = '') {
         $ip = '127.0.0.1';
     }
     foreach ($this->loggers as $logger) {
         if (!in_array($logger->getType(), $this->disabledTypes)) {
             $logger->logMessage($time, $message, $logLevel, $group, $ip, $file, $line, $this->type);
         }
     }
 }
Ejemplo n.º 23
0
 public function clearRememberMeCookie()
 {
     Gpf_Http::setCookie($this->getRememberMeCookieName(), false, time() - 72000, '/');
 }
Ejemplo n.º 24
0
 public static function setInstance(Gpf_HttpResponse $instance)
 {
     self::$instance = $instance;
 }
Ejemplo n.º 25
0
 protected function save3rdPartyCookie($name, $value, $expire, $overwrite, $cookieDomainValidity = null)
 {
     if (!$overwrite && isset($_COOKIE[$name]) && $_COOKIE[$name] != '') {
         return;
     }
     if ($cookieDomainValidity == null) {
         Gpf_Http::setCookie($name, $value, $expire, "/");
     } else {
         Gpf_Http::setCookie($name, $value, $expire, "/", $cookieDomainValidity);
     }
 }
Ejemplo n.º 26
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');

?>