diff --git a/composer.json b/composer.json index 739fa846ce..ef054aa308 100644 --- a/composer.json +++ b/composer.json @@ -29,10 +29,7 @@ "bondas83/mdb2_driver_mysqli": "^1.5", "mobiledetect/mobiledetectlib": "^2.8", "nanasess/mdb2_driver_pgsql": "^1.5", - "nanasess/net_useragent_mobile": "*", - "nanasess/services_json": "*", "pear/archive_tar": "^1.4.3", - "pear/cache_lite": "*", "pear/mail": "*", "pear/pear-core-minimal": "^1.10", "pear/text_password": "*", diff --git a/composer.lock b/composer.lock index c9cff8f41b..eb628801e3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "896ee1a2746c1914f664080e494019e0", + "content-hash": "a880c19c82773600ed49e9fa8a175e07", "packages": [ { "name": "bondas83/mdb2_driver_mysqli", @@ -160,97 +160,6 @@ "description": "This is the PostgreSQL MDB2 driver.", "time": "2019-02-05T06:25:36+00:00" }, - { - "name": "nanasess/net_useragent_mobile", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/nanasess/Net_UserAgent_Mobile.git", - "reference": "aea2235359a0c4f32d3b329a6cdff5e2a78e9042" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nanasess/Net_UserAgent_Mobile/zipball/aea2235359a0c4f32d3b329a6cdff5e2a78e9042", - "reference": "aea2235359a0c4f32d3b329a6cdff5e2a78e9042", - "shasum": "" - }, - "require": { - "pear/pear-core-minimal": "*" - }, - "require-dev": { - "pear/pear": "*" - }, - "type": "library", - "autoload": { - "psr-0": { - "Net": "./" - } - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "./" - ], - "license": [ - "BSD-2-Clause" - ], - "authors": [ - { - "name": "KUBO Atsuhiro", - "email": "kubo@iteman.jp" - }, - { - "name": "Kentaro Ohkouchi", - "email": "nanasess@fsm.ne.jp" - } - ], - "description": "Net_UserAgent_Mobile parses HTTP_USER_AGENT strings of (mainly Japanese) mobile HTTP user agents. It'll be useful in page dispatching by user agents. This package was ported from Perl's HTTP::MobileAgent. See http://search.cpan.org/search?mode=module&query=HTTP-MobileAgent", - "time": "2019-02-05T08:25:51+00:00" - }, - { - "name": "nanasess/services_json", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/nanasess/Services_JSON.git", - "reference": "8bc15c1fe5eb1d696be700d9b8ce51492bac534f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nanasess/Services_JSON/zipball/8bc15c1fe5eb1d696be700d9b8ce51492bac534f", - "reference": "8bc15c1fe5eb1d696be700d9b8ce51492bac534f", - "shasum": "" - }, - "require": { - "pear/pear_exception": "*" - }, - "require-dev": { - "phpunit/phpunit": "*" - }, - "type": "library", - "autoload": { - "classmap": [ - "./" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD" - ], - "authors": [ - { - "name": "Michal Migurski", - "email": "migurski@php.net", - "role": "Lead" - }, - { - "name": "Alan Knowles", - "email": "alan@akbkhome.com", - "role": "Lead" - } - ], - "description": "More info available on: http://pear.php.net/package/Services_JSON", - "time": "2019-02-05T02:36:13+00:00" - }, { "name": "pear/archive_tar", "version": "1.4.3", @@ -317,56 +226,6 @@ ], "time": "2017-06-11T17:28:11+00:00" }, - { - "name": "pear/cache_lite", - "version": "v1.8.2", - "source": { - "type": "git", - "url": "https://github.com/pear/Cache_Lite.git", - "reference": "df78fc57b5f4a7dbd7f1ad73079ba757e8e62fbe" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/pear/Cache_Lite/zipball/df78fc57b5f4a7dbd7f1ad73079ba757e8e62fbe", - "reference": "df78fc57b5f4a7dbd7f1ad73079ba757e8e62fbe", - "shasum": "" - }, - "require": { - "php": ">=4.0.0" - }, - "require-dev": { - "phpunit/phpunit": "*" - }, - "type": "library", - "autoload": { - "classmap": [ - "Cache/Lite.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "./" - ], - "license": [ - "LGPL-2.1-or-later" - ], - "authors": [ - { - "name": "Markus Tacker", - "homepage": "http://pear.php.net/user/tacker" - }, - { - "name": "Fabien Marty", - "homepage": "http://pear.php.net/user/fab" - } - ], - "description": "Fast and safe little cache system", - "homepage": "https://github.com/pear/Cache_Lite", - "keywords": [ - "cache" - ], - "time": "2018-02-13T13:25:49+00:00" - }, { "name": "pear/console_getopt", "version": "v1.4.1", diff --git a/data/class/SC_Cache.php b/data/class/SC_Cache.php deleted file mode 100644 index fb3f4ff458..0000000000 --- a/data/class/SC_Cache.php +++ /dev/null @@ -1,122 +0,0 @@ - SC_Cache_Ex::CACHEDIR, - 'lifeTime' => SC_Cache_Ex::LIFETIME, - 'automaticSerialization' => TRUE - ); - SC_Cache_Ex::$_instance = new Cache_Lite($options); - } - - /** - * Get Cache_Lite object. - * - * @return void - */ - public static function getInstance() - { - is_null(SC_Cache_Ex::$_instance) and SC_Cache_Ex::forge(); - - return SC_Cache_Ex::$_instance; - } - - /** - * Get data from cache. - * - * @param string $id cache id - * @param string $group name of the cache group - * @param int $lifeTime custom lifetime - * @return mixed data of cache (else : false) - */ - public static function get($id, $group = 'default', $lifeTime = NULL) - { - $processor = SC_Cache_Ex::getInstance(); - - // set custom lifetime. - !is_null($lifeTime) and $processor->setOption('lifeTime', $lifeTime); - - $cache = $processor->get($id, $group); - - // set back to default lifetime. - !is_null($lifeTime) and $processor->setOption('lifeTime', SC_Cache_Ex::$_lifetime); - - return $cache; - } - - /** - * Save data into cache. - * - * @param mixed $data data of cache - * @param string $id cache id - * @param string $group name of the cache group - * @return void - */ - public static function save($data, $id, $group = 'default') - { - $processor = SC_Cache_Ex::getInstance(); - - $processor->save($data, $id, $group); - } - - /** - * Clean cache. - * - * @param string $group name of the cache group - * @return void - */ - public static function clean($group = FALSE) - { - $processor = SC_Cache_Ex::getInstance(); - - $processor->clean($group); - } -} diff --git a/data/class/SC_Display.php b/data/class/SC_Display.php index d844f6f747..91438f821f 100644 --- a/data/class/SC_Display.php +++ b/data/class/SC_Display.php @@ -153,9 +153,7 @@ public static function detectDevice($reset = FALSE) if (is_null(SC_Display_Ex::$device) || $reset) { //$nu = new Net_UserAgent_Mobile(); $su = new SC_SmartphoneUserAgent_Ex(); - /*if ($nu->isMobile()) { - SC_Display_Ex::$device = DEVICE_TYPE_MOBILE; - } else*/if ($su->isSmartphone()) { + if ($su->isSmartphone()) { SC_Display_Ex::$device = DEVICE_TYPE_SMARTPHONE; } else { SC_Display_Ex::$device = DEVICE_TYPE_PC; diff --git a/data/class/SC_MobileUserAgent.php b/data/class/SC_MobileUserAgent.php index 9c5d1215d9..bfb9e0b491 100644 --- a/data/class/SC_MobileUserAgent.php +++ b/data/class/SC_MobileUserAgent.php @@ -26,6 +26,7 @@ * * 対象とする携帯端末は $_SERVER から決定する。 * 全てのメソッドはクラスメソッド。 + * @deprecated */ class SC_MobileUserAgent { @@ -36,26 +37,12 @@ class SC_MobileUserAgent * * @return string|false 携帯端末のキャリアを表す文字列を返す。 * 携帯端末ではない場合は false を返す。 + * @deprecated */ public function getCarrier() { - $objAgent =& Net_UserAgent_Mobile::singleton(); - if (Net_UserAgent_Mobile::isError($objAgent)) { - return false; - } - - switch ($objAgent->getCarrierShortName()) { - case 'I': - return 'docomo'; - case 'E': - return 'ezweb'; - case 'V': - return 'softbank'; - case 'S': - return 'softbank'; - default: - return false; - } + trigger_error(E_USER_DEPRECATED, 'Net_UserAgent_Mobile is deprecated'); + return false; } /** @@ -66,20 +53,13 @@ public function getCarrier() * + ezweb ... EZ番号 * + softbank ... 端末シリアル番号 * + * @deprecated * @return string|false 取得したIDを返す。取得できなかった場合は false を返す。 */ public function getId() { - $objAgent =& Net_UserAgent_Mobile::singleton(); - if (Net_UserAgent_Mobile::isError($objAgent)) { - return false; - } elseif ($objAgent->isDoCoMo() || $objAgent->isVodafone()) { - $id = $objAgent->getSerialNumber(); - } elseif ($objAgent->isEZweb()) { - $id = @$_SERVER['HTTP_X_UP_SUBNO']; - } - - return isset($id) ? $id : false; + trigger_error(E_USER_DEPRECATED, 'Net_UserAgent_Mobile is deprecated'); + return false; } /** @@ -90,14 +70,8 @@ public function getId() */ public function getModel() { - $objAgent =& Net_UserAgent_Mobile::singleton(); - if (Net_UserAgent_Mobile::isError($objAgent)) { - return 'Unknown'; - } elseif ($objAgent->isNonMobile()) { - return $objAgent->getName(); - } else { - return $objAgent->getModel(); - } + trigger_error(E_USER_DEPRECATED, 'Net_UserAgent_Mobile is deprecated'); + return false; } /** @@ -114,28 +88,8 @@ public function getModel() */ public function isSupported() { - $objAgent =& Net_UserAgent_Mobile::singleton(); - - // 携帯端末だと認識されたが、User-Agent の形式が未知の場合 - if (Net_UserAgent_Mobile::isError($objAgent)) { - GC_Utils_Ex::gfPrintLog($objAgent->toString()); - - return false; - } - - if ($objAgent->isDoCoMo()) { - $arrUnsupportedSeries = array('501i', '502i', '209i', '210i'); - $arrUnsupportedModels = array('SH821i', 'N821i', 'P821i ', 'P651ps', 'R691i', 'F671i', 'SH251i', 'SH251iS'); - - return !in_array($objAgent->getSeries(), $arrUnsupportedSeries) && !in_array($objAgent->getModel(), $arrUnsupportedModels); - } elseif ($objAgent->isEZweb()) { - return $objAgent->isWAP2(); - } elseif ($objAgent->isVodafone()) { - return $objAgent->isPacketCompliant(); - } else { - // 携帯端末ではない場合はサポートしていることにする。 - return true; - } + trigger_error(E_USER_DEPRECATED, 'Net_UserAgent_Mobile is deprecated'); + return false; } /** @@ -147,11 +101,7 @@ public function isSupported() */ public function isMobile() { - $objAgent =& Net_UserAgent_Mobile::singleton(); - if (Net_UserAgent_Mobile::isError($objAgent)) { - return false; - } else { - return $objAgent->isDoCoMo() || $objAgent->isEZweb() || $objAgent->isVodafone(); - } + trigger_error(E_USER_DEPRECATED, 'Net_UserAgent_Mobile is deprecated'); + return false; } } diff --git a/data/class/pages/upgrade/helper/LC_Upgrade_Helper_Json.php b/data/class/pages/upgrade/helper/LC_Upgrade_Helper_Json.php index 576cb41ada..8eb64a914b 100644 --- a/data/class/pages/upgrade/helper/LC_Upgrade_Helper_Json.php +++ b/data/class/pages/upgrade/helper/LC_Upgrade_Helper_Json.php @@ -3,7 +3,7 @@ * Enter description here... * */ -class LC_Upgrade_Helper_Json extends Services_JSON +class LC_Upgrade_Helper_Json { /** */ public $arrData = array( @@ -20,7 +20,6 @@ class LC_Upgrade_Helper_Json extends Services_JSON */ public function __construct() { - parent::Services_JSON(); } /** @@ -77,7 +76,7 @@ public function setSuccess($data = array(), $msg = '') public function display() { header('Content-Type: text/javascript; charset=UTF-8'); - echo $this->encode($this->arrData); + echo json_encode($this->arrData); } /** @@ -93,6 +92,6 @@ public function display() */ public function decode($str) { - return SC_Utils_Ex::jsonDecode($str); + return json_decode($str); } } diff --git a/data/class/util/SC_Utils.php b/data/class/util/SC_Utils.php index 6004d1c818..c2f191883b 100755 --- a/data/class/util/SC_Utils.php +++ b/data/class/util/SC_Utils.php @@ -1764,9 +1764,7 @@ public static function sfGetSearchPageMax($search_page_max) /** * 値を JSON 形式にして返す. * - * この関数は, json_encode() 又は Services_JSON::encode() のラッパーです. - * json_encode() 関数が使用可能な場合は json_encode() 関数を使用する. - * 使用できない場合は, Services_JSON::encode() 関数を使用する. + * この関数は, json_encode() のラッパーです. * * @param mixed $value JSON 形式にエンコードする値 * @return string JSON 形式にした文字列 @@ -1775,22 +1773,13 @@ public static function sfGetSearchPageMax($search_page_max) */ public static function jsonEncode($value) { - if (function_exists('json_encode')) { - return json_encode($value); - } else { - GC_Utils_Ex::gfPrintLog(' *use Services_JSON::encode(). faster than using the json_encode!'); - $objJson = new Services_JSON(); - - return $objJson->encode($value); - } + return json_encode($value); } /** * JSON 文字列をデコードする. * - * この関数は, json_decode() 又は Services_JSON::decode() のラッパーです. - * json_decode() 関数が使用可能な場合は json_decode() 関数を使用する. - * 使用できない場合は, Services_JSON::decode() 関数を使用する. + * この関数は, json_decode() のラッパーです. * * @param string $json JSON 形式にエンコードされた文字列 * @return mixed デコードされた PHP の型 @@ -1799,14 +1788,7 @@ public static function jsonEncode($value) */ public static function jsonDecode($json) { - if (function_exists('json_decode')) { - return json_decode($json); - } else { - GC_Utils_Ex::gfPrintLog(' *use Services_JSON::decode(). faster than using the json_decode!'); - $objJson = new Services_JSON(); - - return $objJson->decode($json); - } + return json_decode($json); } /** diff --git a/tests/class/module/Net_UserAgent_Mobile/Net_UserAgent_MobileTest.php b/tests/class/module/Net_UserAgent_Mobile/Net_UserAgent_MobileTest.php deleted file mode 100644 index 52178167f2..0000000000 --- a/tests/class/module/Net_UserAgent_Mobile/Net_UserAgent_MobileTest.php +++ /dev/null @@ -1,32 +0,0 @@ - - * @license - */ -class Net_UserAgent_MobileTest extends Common_TestCase -{ - public function testConstructorSetsDefaults() - { - $nu = new Net_UserAgent_Mobile(); - $this->assertEquals(false, $nu->isMobile()); - } - - public function testMobile() - { - $ua = $_SERVER['HTTP_USER_AGENT']; - $_SERVER['HTTP_USER_AGENT'] = 'DoCoMo/2.0 F901iC(c100;TB;W23H12)'; - - $nu = new Net_UserAgent_Mobile(); - $this->assertEquals(true, $nu->isMobile()); - $this->assertEquals(true, $nu->isDocomo()); - - // 念のため戻す - $_SERVER['HTTP_USER_AGENT'] = $ua; - } -}