public function __construct()
 {
     if (version_compare(PHP_VERSION, '5.3.0', '>=') && self::$PERSISTENT_CONNECTION) {
         $this->hostPrefix = 'p:';
     }
     parent::__construct();
 }
 public function SQLPrep($value)
 {
     if ($value == '') {
         $value = 'NULL';
     } else {
         if (!TeraWurflDatabase::isNumericSafe($value) || $value[0] == '0') {
             $value = "'" . str_replace("'", "''", $value) . "'";
         }
     }
     //Quote if not integer
     return $value;
 }
Beispiel #3
0
 /**
  * Returns the value of the given setting name
  * @param String Setting value
  */
 public function getSetting($key)
 {
     return $this->db->getSetting($key);
 }
 public function SQLPrep($value)
 {
     if ($value == '') {
         $value = 'NULL';
     } else {
         if (!TeraWurflDatabase::isNumericSafe($value) || $value[0] == '0') {
             $value = $this->dbcon->quote($value);
             //Quote if not integer
         }
     }
     return $value;
 }
 public function __construct()
 {
     parent::__construct();
     self::$MERGE = TeraWurflConfig::$TABLE_PREFIX . 'Merge';
 }
 public function SQLPrep($value)
 {
     if ($value == '') {
         $value = 'NULL';
     } else {
         if (!TeraWurflDatabase::isNumericSafe($value) || $value[0] == '0') {
             $value = "'" . $this->dbcon->real_escape_string($value) . "'";
         }
     }
     //Quote if not integer
     return $value;
 }
 public function __construct()
 {
     parent::__construct();
 }
 /**
  * Returns the matching WURFL ID for a given User Agent
  * @return string WURFL ID
  */
 protected function getDeviceIDFromRequestLoose()
 {
     $this->matcherHistory = array();
     // Return generic UA if userAgent is empty
     if (strlen($this->httpRequest->user_agent) == 0) {
         $this->matchData['matcher'] = "none";
         $this->matchData['match_type'] = "none";
         $this->matchData['match'] = false;
         $this->setMatcherHistory();
         if ($this->httpRequest->uaprof instanceof TeraWurflUserAgentProfile && $this->httpRequest->uaprof->containsValidUrl()) {
             return WurflConstants::GENERIC_MOBILE;
         } else {
             return WurflConstants::NO_MATCH;
         }
     }
     // Check for exact match
     if (TeraWurflConfig::$SIMPLE_DESKTOP_ENGINE_ENABLE && $this->httpRequest->user_agent == WurflConstants::SIMPLE_DESKTOP_UA) {
         // SimpleDesktop UA Matching avoids querying the database here
         $this->matchData['matcher'] = $this->userAgentMatcher->matcherName();
         $this->matchData['match_type'] = "high_performance";
         $this->matchData['match'] = true;
         $this->matcherHistory[] = $this->matchData['matcher'] . "(high_performance)";
         $this->setMatcherHistory();
         return WurflConstants::GENERIC_WEB_BROWSER;
     } else {
         $deviceID = $this->db->getDeviceFromUA($this->httpRequest->user_agent->normalized);
     }
     $this->matcherHistory[] = $this->userAgentMatcher->matcherName() . "(exact)";
     if ($deviceID !== false) {
         $this->matchData['matcher'] = $this->userAgentMatcher->matcherName();
         $this->matchData['match_type'] = "exact";
         $this->matchData['match'] = true;
         $this->setMatcherHistory();
         return $deviceID;
     }
     // Check for a conclusive match
     $deviceID = $this->userAgentMatcher->applyConclusiveMatch($this->httpRequest);
     $this->matcherHistory[] = $this->userAgentMatcher->matcherName() . "(conclusive)";
     if ($deviceID != WurflConstants::NO_MATCH) {
         $this->matchData['matcher'] = $this->userAgentMatcher->matcherName();
         $this->matchData['match_type'] = "conclusive";
         $this->matchData['match'] = true;
         $this->setMatcherHistory();
         return $deviceID;
     }
     /*
     // Check for Vodafone magic
     if ($this->userAgentMatcher->matcherName()!="VodafoneUserAgentMatcher" && $this->httpRequest->user_agent->contains("Vodafone")) {
     	@require_once realpath(dirname(__FILE__).'/UserAgentMatchers/VodafoneUserAgentMatcher.php');
     	$vodafoneUserAgentMatcher = new VodafoneUserAgentMatcher($this);
     	$this->matcherHistory[] = $vodafoneUserAgentMatcher->matcherName() . "(conclusive)";
     	$deviceID = $vodafoneUserAgentMatcher->applyConclusiveMatch($this->httpRequest);
     	if ($deviceID != WurflConstants::NO_MATCH) {
     		$this->matchData['matcher'] = $vodafoneUserAgentMatcher->matcherName();
     		$this->matchData['match_type'] = "conclusive";
     		$this->matchData['match'] = true;
     		$this->setMatcherHistory();
     		return $deviceID;
     	}
     }
     */
     // Check for recovery match
     $deviceID = $this->userAgentMatcher->applyRecoveryMatch($this->httpRequest);
     $this->matcherHistory[] = $this->userAgentMatcher->matcherName() . "(recovery)";
     if ($deviceID != WurflConstants::NO_MATCH) {
         $this->matchData['matcher'] = $this->userAgentMatcher->matcherName();
         $this->matchData['match_type'] = "recovery";
         $this->matchData['match'] = false;
         $this->setMatcherHistory();
         return $deviceID;
     }
     // Check CatchAll if it's not already in use
     if ($this->userAgentMatcher->matcherName() != "CatchAllUserAgentMatcher") {
         $catchAllUserAgentMatcher = new CatchAllUserAgentMatcher($this);
         $this->matcherHistory[] = $catchAllUserAgentMatcher->matcherName() . "(recovery)";
         $deviceID = $catchAllUserAgentMatcher->applyRecoveryMatch($this->httpRequest);
         if ($deviceID != WurflConstants::NO_MATCH) {
             // The CatchAll matcher is intelligent enough to determine the match properties
             $this->matchData['matcher'] = $catchAllUserAgentMatcher->matcher;
             $this->matchData['match_type'] = $catchAllUserAgentMatcher->match_type;
             $this->matchData['match'] = $catchAllUserAgentMatcher->match;
             $this->setMatcherHistory();
             return $deviceID;
         }
     }
     // A matching device still hasn't been found - check HTTP ACCEPT headers
     if ($this->httpRequest->accept->length() > 0) {
         $this->matcherHistory[] = 'http_accept';
         if ($this->httpRequest->accept->contains('application/vnd.wap.xhtml+xml')) {
             $this->matchData['matcher'] = 'http_accept';
             $this->matchData['match_type'] = 'recovery';
             // This isn't really a match, it's a suggestion
             $this->matchData['match'] = false;
             $this->setMatcherHistory();
             return WurflConstants::GENERIC_MOBILE;
         }
     }
     $this->matchData['matcher'] = "none";
     $this->matchData['match_type'] = "none";
     $this->matchData['match'] = false;
     $this->setMatcherHistory();
     if ($this->httpRequest->uaprof instanceof TeraWurflUserAgentProfile && $this->httpRequest->uaprof->containsValidUrl()) {
         return WurflConstants::GENERIC_MOBILE;
     }
     if ($this->httpRequest->isMobileBrowser()) {
         return WurflConstants::GENERIC_MOBILE;
     }
     if ($this->httpRequest->isSmartTV()) {
         return WurflConstants::GENERIC_SMARTTV;
     }
     return WurflConstants::GENERIC;
 }