on = 'playstation'; var $deviceNintendoDs = 'nitro'; var $deviceNintendo = 'nintendo'; var $deviceWii = 'wii'; var $deviceXbox = 'xbox'; var $deviceArchos = 'archos'; var $engineOpera = 'opera'; //Popular browser var $engineNetfront = 'netfront'; //Common embedded OS browser var $engineUpBrowser = 'up.browser'; //common on some phones var $engineOpenWeb = 'openweb'; //Transcoding by OpenWave server var $deviceMidp = 'midp'; //a mobile Java technology var $uplink = 'up.link'; var $engineTelecaQ = 'teleca q'; //a modern feature phone browser var $devicePda = 'pda'; //some devices report themselves as PDAs var $mini = 'mini'; //Some mobile browsers put 'mini' in their names. var $mobile = 'mobile'; //Some mobile browsers put 'mobile' in their user agent strings. var $mobi = 'mobi'; //Some mobile browsers put 'mobi' in their user agent strings. //Use Maemo, Tablet, and Linux to test for Nokia's Internet Tablets. var $maemo = 'maemo'; var $linux = 'linux'; var $qtembedded = 'qt embedded'; //for Sony Mylo and others var $mylocom2 = 'com2'; //for Sony Mylo also //In some UserAgents, the only clue is the manufacturer. var $manuSonyEricsson = "sonyericsson"; var $manuericsson = "ericsson"; var $manuSamsung1 = "sec-sgh"; var $manuSony = "sony"; var $manuHtc = "htc"; //Popular Android and WinMo manufacturer //In some UserAgents, the only clue is the operator. var $svcDocomo = "docomo"; var $svcKddi = "kddi"; var $svcVodafone = "vodafone"; //Disambiguation strings. var $disUpdate = "update"; //pda vs. update //************************** //The constructor. Allows the latest PHP (5.0+) to locate a constructor object and initialize the object. function __construct() { $this->uagent_info(); } //************************** //The object initializer. Initializes several default variables. function uagent_info() { $this->useragent = isset($_SERVER['HTTP_USER_AGENT'])?strtolower($_SERVER['HTTP_USER_AGENT']):''; $this->httpaccept = isset($_SERVER['HTTP_ACCEPT'])?strtolower($_SERVER['HTTP_ACCEPT']):''; //Let's initialize some values to save cycles later. $this->InitDeviceScan(); } //************************** // Initialize Key Stored Values. function InitDeviceScan() { global $isIphone, $isAndroidPhone, $isTierTablet, $isTierIphone; //We'll use these 4 variables to speed other processing. They're super common. $this->isIphone = $this->DetectIphoneOrIpod(); $this->isAndroidPhone = $this->DetectAndroidPhone(); $this->isTierIphone = $this->DetectTierIphone(); $this->isTierTablet = $this->DetectTierTablet(); //Optional: Comment these out if you don't need them. global $isTierRichCss, $isTierGenericMobile; $this->isTierRichCss = $this->DetectTierRichCss(); $this->isTierGenericMobile = $this->DetectTierOtherPhones(); } //************************** //Returns the contents of the User Agent value, in lower case. function Get_Uagent() { return $this->useragent; } //************************** //Returns the contents of the HTTP Accept value, in lower case. function Get_HttpAccept() { return $this->httpaccept; } //************************** // Detects if the current device is an iPhone. function DetectIphone() { if (stripos($this->useragent, $this->deviceIphone) > -1) { //The iPad and iPod Touch say they're an iPhone. So let's disambiguate. if ($this->DetectIpad() == $this->true || $this->DetectIpod() == $this->true) return $this->false; //Yay! It's an iPhone! else return $this->true; } else return $this->false; } //************************** // Detects if the current device is an iPod Touch. function DetectIpod() { if (stripos($this->useragent, $this->deviceIpod) > -1) return $this->true; else return $this->false; } //************************** // Detects if the current device is an iPad tablet. function DetectIpad() { if (stripos($this->useragent, $this->deviceIpad) > -1 && $this->DetectWebkit() == $this->true) return $this->true; else return $this->false; } //************************** // Detects if the current device is an iPhone or iPod Touch. function DetectIphoneOrIpod() { //We repeat the searches here because some iPods may report themselves as an iPhone, which would be okay. if (stripos($this->useragent, $this->deviceIphone) > -1 || stripos($this->useragent, $this->deviceIpod) > -1) return $this->true; else return $this->false; } //************************** // Detects *any* iOS device: iPhone, iPod Touch, iPad. function DetectIos() { if (($this->DetectIphoneOrIpod() == $this->true) || ($this->DetectIpad() == $this->true)) return $this->true; else return $this->false; } //************************** // Detects *any* Android OS-based device: phone, tablet, and multi-media player. // Also detects Google TV. function DetectAndroid() { if ((stripos($this->useragent, $this->deviceAndroid) > -1) || ($this->DetectGoogleTV() == $this->true)) return $this->true; //Special check for the HTC Flyer 7" tablet if ((stripos($this->useragent, $this->deviceHtcFlyer) > -1)) return $this->true; else return $this->false; } //************************** // Detects if the current device is a (small-ish) Android OS-based device // used for calling and/or multi-media (like a Samsung Galaxy Player). // Google says these devices will have 'Android' AND 'mobile' in user agent. // Ignores tablets (Honeycomb and later). function DetectAndroidPhone() { if (($this->DetectAndroid() == $this->true) && (stripos($this->useragent, $this->mobile) > -1)) return $this->true; //Special check for Android phones with Opera Mobile. They should report here. if (($this->DetectOperaAndroidPhone() == $this->true)) return $this->true; //Special check for the HTC Flyer 7" tablet. It should report here. if ((stripos($this->useragent, $this->deviceHtcFlyer) > -1)) return $this->true; else return $this->false; } //************************** // Detects if the current device is a (self-reported) Android tablet. // Google says these devices will have 'Android' and NOT 'mobile' in their user agent. function DetectAndroidTablet() { //First, let's make sure we're on an Android device. if ($this->DetectAndroid() == $this->false) return $this->false; //Special check for Opera Android Phones. They should NOT report here. if ($this->DetectOperaMobile() == $this->true) return $this->false; //Special check for the HTC Flyer 7" tablet. It should NOT report here. if ((stripos($this->useragent, $this->deviceHtcFlyer) > -1)) return $this->false; //Otherwise, if it's Android and does NOT have 'mobile' in it, Google says it's a tablet. if (stripos($this->useragent, $this->mobile) > -1) return $this->false; else return $this->true; } //************************** // Detects if the current device is an Android OS-based device and // the browser is based on WebKit. function DetectAndroidWebKit() { if (($this->DetectAndroid() == $this->true) && ($this->DetectWebkit() == $this->true)) return $this->true; else return $this->false; } //************************** // Detects if the current device is a GoogleTV. function DetectGoogleTV() { if (stripos($this->useragent, $this->deviceGoogleTV) > -1) return $this->true; else return $this- if (($this->isIphone == $this->true) || ($this->isAndroidPhone == $this->true) || ($this->isTierIphone == $this->true) || ($this->DetectS60OssBrowser() == $this->true) || ($this->DetectSymbianOS() == $this->true) || ($this->DetectWindowsMobile() == $this->true) || ($this->DetectWindowsPhone7() == $this->true) || ($this->DetectBlackBerry() == $this->true) || ($this->DetectPalmWebOS() == $this->true) || ($this->DetectPalmOS() == $this->true) || ($this->DetectGarminNuvifone() == $this->true)) return $this->true; else return $this->false; } //************************** // Detects whether the device is a Brew-powered device. function DetectBrewDevice() { if (stripos($this->useragent, $this->deviceBrew) > -1) return $this->true; else return $this->false; } //************************** // Detects the Danger Hiptop device. function DetectDangerHiptop() { if (stripos($this->useragent, $this->deviceDanger) > -1 || stripos($this->useragent, $this->deviceHiptop) > -1) return $this->true; else return $this->false; } //************************** // Detects if the current browser is Opera Mobile or Mini. function DetectOperaMobile() { if (stripos($this->useragent, $this->engineOpera) > -1) { if ((stripos($this->useragent, $this->mini) > -1) || (stripos($this->useragent, $this->mobi) > -1)) return $this->true; else return $this->false; } else return $this->false; } //************************** // Detects if the current browser is Opera Mobile // running on an Android phone. function DetectOperaAndroidPhone() { if ((stripos($this->useragent, $this->engineOpera) > -1) && (stripos($this->useragent, $this->deviceAndroid) > -1) && (stripos($this->useragent, $this->mobi) > -1)) return $this->true; else return $this->false; } //************************** // Detects if the current browser is Opera Mobile // running on an Android tablet. function DetectOperaAndroidTablet() { if ((stripos($this->useragent, $this->engineOpera) > -1) && (stripos($this->useragent, $this->deviceAndroid) > -1) && (stripos($this->useragent, $this->deviceTablet) > -1)) return $this->true; else return $this->false; } //************************** // Detects whether the device supports WAP or WML. function DetectWapWml() { if (stripos($this->httpaccept, $this->vndwap) > -1 || stripos($this->httpaccept, $this->wml) > -1) return $this->true; else return $this->false; } //************************** // Detects if the current device is an Amazon Kindle (eInk devices only). // Note: For the Kindle Fire, use the normal Android methods. function DetectKindle() { if (stripos($this->useragent, $this->deviceKindle) > -1 && $this->DetectAndroid() == $this->false) return $this->true; else return $this->false; } //************************** // Detects if the current Amazon device is using the Silk Browser. // Note: Typically used by the the Kindle Fire. function DetectAmazonSilk() { if (stripos($this->useragent, $this->engineSilk) > -1) return $this->true; else return $this->false; } //************************** // The quick way to detect for a mobile device. // Will probably detect most recent/current mid-tier Feature Phones // as well as smartphone-class devices. Excludes Apple iPads and other modern tablets. function DetectMobileQuick() { //Let's exclude tablets if ($this->isTierTablet == $this->true) return $this->false; //Most mobile browsing is done on smartphones if ($this->DetectSmartphone() == $this->true) return $this->true; if (($this->DetectWapWml() == $this->true) || ($this->DetectBrewDevice() == $this->true) || ($this->DetectOperaMobile() == $this->true)) return $this->true; if ((stripos($this->useragent, $this->engineNetfront) > -1) || (stripos($this->useragent, $this->engineUpBrowser) > -1) || (stripos($this->useragent, $this->engineOpenWeb) > -1)) return $this->true; if (($this->DetectDangerHiptop() == $this->true) || ($this->DetectMidpCapable() == $this->true) || ($this->DetectMaemoTablet() == $this->true) || ($this->DetectArchos() == $this->true)) return $this->true; if ((stripos($this->useragent, $this->devicePda) > -1) && !(stripos($this->useragent, $this->disUpdate) > -1)) return $this->true; if (stripos($this->useragent, $this->mobile) > -1) return $this->true; //We also look for Kindle devices if ($this->DetectKindle() == $this->true || $this->DetectAmazonSilk() == $this->true) return $this->true; else return $this->false; } //************************** // Detects if the current device is a Sony Playstation. function DetectSonyPlaystation() { if (stripos($this->useragent, $this->devicePlaystation) > -1) return $this->true; else return $this->false; } //************************** // Detects if the current device is a Nintendo game device. function DetectNintendo() { if (stripos($this->useragent, $this->deviceNintendo) > -1 || stripos($this->useragent, $this->deviceWii) > -1 || stripos($this->useragent, $this->deviceNintendoDs) > -1) return $this->true; else return $this->false; } //************************** // Detects if the current device is a Microsoft Xbox. function DetectXbox() { if (stripos($this->useragent, $this->deviceXbox) > -1) return $this->true; else return $this->false; } //************************** // Detects if the current device is an Internet-capable game console. function DetectGameConsole() { if ($this->DetectSonyPlaystation() == $this->true) return $this->true; else if ($this->DetectNintendo() == $this->true) return $this->true; else if ($this->DetectXbox() == $this->true) return $this->true; else return $this->false; } //************************** // Detects if the current device supports MIDP, a mobile Java technology. function DetectMidpCapable() { if (stripos($this->useragent, $this->deviceMidp) > -1 || stripos($this->httpaccept, $this->deviceMidp) > -1) return $this->true; else return $this->false; } //************************** // Detects if the current device is on one of the Maemo-based Nokia Internet Tablets. function DetectMaemoTablet() { if (stripos($this->useragent, $this->maemo) > -1) return $this->true; //For Nokia N810, must be Linux + Tablet, or else it could be something else. if ((stripos($this->useragent, $this->linux) > -1) && (stripos($this->useragent, $this->deviceTablet) > -1) && ($this->DetectWebOSTablet() == $this->false) && ($this->DetectAndroid() == $this->false)) return $this->true; else return $this->false; } //************************** // Detects if the current device is an Archos media player/Internet tablet. function DetectArchos() { if (stripos($this->useragent, $this->deviceArchos) > -1) return $this->true; else return $this->false; } //************************** // Detects if the current browser is a Sony Mylo device. function DetectSonyMylo() { if (stripos($this->useragent, $this->manuSony) > -1) { if ((stripos($this->useragent, $this->qtembedded) > -1) || (stripos($this->useragent, $this->mylocom2) > -1)) { return $this->true; } else return $this->false; } else return $this->false; } //************************** // The longer and more thorough way to detect for a mobile device. // Will probably detect most feature phones, // smartphone-class devices, Internet Tablets, // Internet-enabled game consoles, etc. // This ought to catch a lot of the more obscure and older devices, also -- // but no promises on thoroughness! function DetectMobileLong() { if ($this->DetectMobileQuick() == $this->true) return $this->true; if ($this->DetectGameConsole() == $this->true) return $this->true; if ($this->DetectSonyMylo() == $this->true) return $this->true; //Detect older phones from certain manufacturers and operators. if (stripos($this->useragent, $this->uplink) > -1) return $this->true; if (stripos($this->useragent, $this->manuSonyEricsson) > -1) return $this->true; if (stripos($this->useragent, $this->manuericsson) > -1) return $this->true; if (stripos($this->useragent, $this->manuSamsung1) > -1) return $this->true; if (stripos($this->useragent, $this->svcDocomo) > -1) return $this->true; if (stripos($this->useragent, $this->svcKddi) > -1) return $this->true; if (stripos($this->useragent, $this->svcVodafone) > -1) return $this->true; else return $this->false; } //***************************** // For Mobile Web Site Design //***************************** //************************** // The quick way to detect for a tier of devices. // This method detects for the new generation of // HTML 5 capable, larger screen tablets. // Includes iPad, Android (e.g., Xoom), BB Playbook, WebOS, etc. function DetectTierTablet() { if (($this->DetectIpad() == $this->true) || ($this->DetectAndroidTablet() == $this->true) || ($this->DetectBlackBerryTablet() == $this->true) || ($this->DetectWebOSTablet() == $this->true)) return $this->true; else return $this->false; } //************************** // The quick way to detect for a tier of devices. // This method detects for devices which can // display iPhone-optimized web content. // Includes iPhone, iPod Touch, Android, Windows Phone 7, WebOS, etc. function DetectTierIphone() { if (($this->isIphone == $this->true) || ($this->isAndroidPhone == $this->true)) return $this->true; if (($this->DetectBlackBerryWebKit() == $this->true) && ($this->DetectBlackBerryTouch() == $this->true)) return $this->true; if ($this->DetectWindowsPhone7() == $this->true) return $this->true; if ($this->DetectPalmWebOS() == $this->true) return $this->true; if ($this->DetectGarminNuvifone() == $this->true) return $this->true; else return $this->false; } //************************** // The quick way to detect for a tier of devices. // This method detects for devices which are likely to be capable // of viewing CSS content optimized for the iPhone, // but may not necessarily support JavaScript. // Excludes all iPhone Tier devices. function DetectTierRichCss() { if ($this->DetectMobileQuick() == $this->true) { //Exclude iPhone Tier and e-Ink Kindle devices if (($this->DetectTierIphone() == $this->true) || ($this->DetectKindle() == $this->true)) return $this->false; //The following devices are explicitly ok. if ($this->DetectWebkit() == $this->true) //Any WebKit return $this->true; if ($this->DetectS60OssBrowser() == $this->true) return $this->true; //Note: 'High' BlackBerry devices ONLY if ($this->DetectBlackBerryHigh() == $this->true) return $this->true; //Older Windows 'Mobile' isn't good enough for iPhone Tier. if ($this->DetectWindowsMobile() == $this->true) return $this->true; if (stripos($this->useragent, $this->engineTelecaQ) > -1) return $this->true; //default else return $this->false; } else return $this->false; } //************************** // The quick way to detect for a tier of devices. // This method detects for all other types of phones, // but excludes the iPhone and RichCSS Tier devices. function DetectTierOtherPhones() { //Exclude devices in the other 2 categories if (($this->DetectMobileLong() == $this->true) && ($this->DetectTierIphone() == $this->false) && ($this->DetectTierRichCss() == $this->false)) return $this->true; else return $this->false; } //Was informed by a MobileESP user that it's a best practice // to omit the closing ?> marks here. They can sometimes // cause errors with HTML headers. } $this->UTILS = new cs_utils(); $this->UTILS->_PATH = C_PATH.'/'.cs_utils; $this->UTILS->PATH = C_PATH.'/'.cs_utils; $this->UTILS->_DIR = C_DIR.'/'.cs_utils; $this->UTILS->DIR = C_DIR.'/'.cs_utils; ?>IN ('.$option_id_array.')'; $CS->DB->query(' DELETE FROM '.$config['table'].' WHERE '.$config['key'].'="'.$config['key_value'].'" '.$if_in.' '); } public function __construct() { global $CONF; $this->HOST = $CONF->DB_HOST; $this->USER = $CONF->DB_USER; $this->PASS = $CONF->DB_PASS; $this->DB_NAME = $CONF->DB_DB_NAME; $this->NAMES = $CONF->DB_NAMES; $this->TYPE = $CONF->DB_TYPE; $this->DB_CON = $CONF->DB_CON; $this->connect(); } public function connect() { //echo $conn; if(!empty($this->NAMES)) $aft_comm = array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES {$this->NAMES}"); $this->POLACZENIE = new PDO($this->DB_CON, $this->USER, $this->PASS, $aft_comm); $this->POLACZENIE->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); } public function disconnect() { return $this->close(); } public function __destruct() { return $this->close(); } public function close() {} public function query($query) { global $CONF, $SQL_QU; try { if($CONF->SHOW_SQL) $SQL_QU[]=$query; $ret=$this->POLACZENIE->prepare($query); $ret->execute(); if($ret==false) throw new Exception('sql_error'); } catch (Exception $e) { $mysql_error=$e->getMessage(); if(stristr($mysql_error, 'marked as crashed') && $this->AFTER_REPAIR!=true) { $this->repair_tables(); $this->AFTER_REPAIR=true; return $this->query($query); } $err=$e->getTrace(); $errstr='Blad zapytania SQL
'.$query.'

'.$mysql_error.''; $msg='
Code-Trace:
'.nl2br($e->getTraceAsString()); // if(!empty($err[1]['file'])) $errorek=$err[0]; else $errorek=$err[0]; $errorek=$err[0]; error_handler(-4096, $errstr, $errorek['file'], $errorek['line'], $msg); } return $ret; } public function fetch_array($sql) { return $sql->fetch(PDO::FETCH_BOTH); } public function fetch_assoc($sql) { return $sql->fetch(PDO::FETCH_ASSOC); } public function fetch_object($sql) { return $sql->fetch(PDO::FETCH_OBJ); } public function num_rows($sql) { return $sql->rowCount(); } public function num_cols($sql) { return $sql->columnCount();} public function affected_rows() { return $sql->rowCount(); } public function inserted_id($tbl) { $dane=$this->fetch_array($this->query(' SELECT id FROM '.$tbl.' ORDER BY id DESC LIMIT 1 ')); return $dane['id']; } public function prepare($query, $arguments=array()) { return $this->POLACZENIE->prepare($query,$arguments); } public function repair_tables() { $sql=$this->query(' SHOW TABLES '); while($fetch=$this->far($sql)) $tables[]=$fetch[0]; if(count($tables)==0) return false; $this->query(' REPAIR TABLE '.@implode(',', $tables).' '); } public function mysql_real_escape_string($string) { return $this->POLACZENIE->quote($string); } public function optimize_tables() { $sql=$this->query(' SHOW TABLES '); while($fetch=$this->far($sql)) $tables[]=$fetch[0]; if(count($tables)==0) return false; $this->query(' OPTIMIZE TABLE '.@implode(',', $tables).' '); } //aliases public function q($query) { return $this->query($query); } public function fa($sql) { return $this->fetch_assoc($sql); } public function far($sql) { return $this->fetch_array($sql); } public function fo($sql) { return $this->fetch_object($sql); } public function nr($sql) { return $this->num_rows($sql); } public function nc($sql) { return $this->num_cols($sql); } public function ar() { return $this->affected_rows(); } public function ii($table) { return $this->inserted_id($table); } public function ls($table) { return $this->list_fields($table); } public function lf($table, $ext=false) { return $this->list_fields($table,$ext); } public function walk($query) { $sql=$this->query($query); $num_rows=$this->num_rows($sql); while($fetch=$this->fa($sql)) $rows[]=$fetch; if($num_rows==0) return array(); return $rows; } public function get_array($query) { $sql=$this->query($query); $num_rows=$this->num_rows($sql); while($fetch=$this->far($sql)) $rows[]=$fetch[0]; if($num_rows==0) return false; return $rows; } public function get_twin_array($query) { $sql=$this->query($query); $num_rows=$this->num_rows($sql); while($fetch=$this->far($sql)) $rows[$fetch[0]]=$fetch[1]; if($num_rows==0) return array(); return $rows; } public function single($query) { $sql=$this->query($query); $dane=$this->fetch_array($sql); if($this->num_cols($sql)==1) { return $dane[0]; } else { return $dane; } } public function db_update_array() { for($i=0;$iDB = new cs_db(); $this->DB->_PATH = C_PATH.'/'.cs_db; $this->DB->PATH = C_PATH.'/'.cs_db; $this->DB->_DIR = C_DIR.'/'.cs_db; $this->DB->DIR = C_DIR.'/'.cs_db; ?>
Fatal error: Call to a member function query() on a non-object in /components/load.php on line 184