diff options
| author | 2018-09-02 13:19:58 +0200 | |
|---|---|---|
| committer | 2018-09-02 13:19:58 +0200 | |
| commit | 32d9c3b7905f4e43ffdf4bf2bf37723cfd18390c (patch) | |
| tree | c2ed9eb08533ae795b1b97718223c6bb614a18e3 | |
| parent | 565e34f7bdcc35d946d10a1840f36f40c6804f62 (diff) | |
Use mb_strcut (#1996)
* Use mb_strcut
Avoid cutting in the middle of a multi-byte UTF-8 character
* Forgotten php5-*
* Typo
* Whitespace
* More mb_strcut
36 files changed, 159 insertions, 35 deletions
diff --git a/README.fr.md b/README.fr.md index 78a182d7b..20fbf955d 100644 --- a/README.fr.md +++ b/README.fr.md @@ -37,7 +37,7 @@ Nous sommes une communauté amicale. * Serveur Web Apache2 (recommandé), ou nginx, lighttpd (non testé sur les autres) * PHP 5.3.8+ (PHP 5.4+ recommandé, et PHP 5.5+ pour les performances, et PHP 7+ pour d’encore meilleures performances) * Requis : [cURL](https://secure.php.net/curl), [DOM](https://secure.php.net/dom), [XML](https://secure.php.net/xml), [session](https://secure.php.net/session), [ctype](https://secure.php.net/ctype), et [PDO_MySQL](https://secure.php.net/pdo-mysql) ou [PDO_SQLite](https://secure.php.net/pdo-sqlite) ou [PDO_PGSQL](https://secure.php.net/pdo-pgsql) - * Recommandés : [JSON](https://secure.php.net/json), [GMP](https://secure.php.net/gmp) (pour accès API sur plateformes < 64 bits), [IDN](https://secure.php.net/intl.idn) (pour les noms de domaines internationalisés), [mbstring](https://secure.php.net/mbstring) et/ou [iconv](https://secure.php.net/iconv) (pour conversion d’encodages), [ZIP](https://secure.php.net/zip) (pour import/export), [zlib](https://secure.php.net/zlib) (pour les flux compressés) + * Recommandés : [JSON](https://secure.php.net/json), [GMP](https://secure.php.net/gmp) (pour accès API sur plateformes < 64 bits), [IDN](https://secure.php.net/intl.idn) (pour les noms de domaines internationalisés), [mbstring](https://secure.php.net/mbstring) (pour le texte Unicode), [iconv](https://secure.php.net/iconv) (pour conversion d’encodages), [ZIP](https://secure.php.net/zip) (pour import/export), [zlib](https://secure.php.net/zlib) (pour les flux compressés) * MySQL 5.5.3+ (recommandé), ou SQLite 3.7.4+, ou PostgreSQL 9.2+ * Un navigateur Web récent tel que Firefox / IceCat, Internet Explorer 11 / Edge, Chromium / Chrome, Opera, Safari. * Fonctionne aussi sur mobile @@ -37,7 +37,7 @@ We are a friendly community. * A web server: Apache2 (recommended), nginx, lighttpd (not tested on others) * PHP 5.3.8+ (PHP 5.4+ recommended, and PHP 5.5+ for performance, and PHP 7 for even higher performance) * Required extensions: [cURL](https://secure.php.net/curl), [DOM](https://secure.php.net/dom), [XML](https://secure.php.net/xml), [session](https://secure.php.net/session), [ctype](https://secure.php.net/ctype), and [PDO_MySQL](https://secure.php.net/pdo-mysql) or [PDO_SQLite](https://secure.php.net/pdo-sqlite) or [PDO_PGSQL](https://secure.php.net/pdo-pgsql) - * Recommended extensions: [JSON](https://secure.php.net/json), [GMP](https://secure.php.net/gmp) (for API access on platforms < 64 bits), [IDN](https://secure.php.net/intl.idn) (for Internationalized Domain Names), [mbstring](https://secure.php.net/mbstring) and/or [iconv](https://secure.php.net/iconv) (for charset conversion), [ZIP](https://secure.php.net/zip) (for import/export), [zlib](https://secure.php.net/zlib) (for compressed feeds) + * Recommended extensions: [JSON](https://secure.php.net/json), [GMP](https://secure.php.net/gmp) (for API access on platforms < 64 bits), [IDN](https://secure.php.net/intl.idn) (for Internationalized Domain Names), [mbstring](https://secure.php.net/mbstring) (for Unicode strings), [iconv](https://secure.php.net/iconv) (for charset conversion), [ZIP](https://secure.php.net/zip) (for import/export), [zlib](https://secure.php.net/zlib) (for compressed feeds) * MySQL 5.5.3+ (recommended), or SQLite 3.7.4+, or PostgreSQL 9.2+ * A recent browser like Firefox / IceCat, Internet Explorer 11 / Edge, Chromium / Chrome, Opera, Safari. * Works on mobile diff --git a/app/Models/Category.php b/app/Models/Category.php index 9a44a2d09..197faf942 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -68,7 +68,7 @@ class FreshRSS_Category extends Minz_Model { $this->id = $value; } public function _name($value) { - $this->name = substr(trim($value), 0, 255); + $this->name = mb_strcut(trim($value), 0, 255, 'UTF-8'); } public function _feeds($values) { if (!is_array($values)) { diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php index ef2c402a0..cf6b3bae3 100644 --- a/app/Models/CategoryDAO.php +++ b/app/Models/CategoryDAO.php @@ -9,7 +9,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable $stm = $this->bd->prepare($sql); $values = array( - substr($valuesTmp['name'], 0, 255), + mb_strcut($valuesTmp['name'], 0, 255, 'UTF-8'), ); if ($stm && $stm->execute($values)) { diff --git a/app/Models/Entry.php b/app/Models/Entry.php index 2b6059638..ccbad5724 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -31,6 +31,7 @@ class FreshRSS_Entry extends Minz_Model { $this->_isRead($is_read); $this->_isFavorite($is_favorite); $this->_feedId($feedId); + $tags = mb_strcut($tags, 0, 1023, 'UTF-8'); $this->_tags(preg_split('/[\s#]/', $tags)); $this->_guid($guid); } @@ -123,11 +124,11 @@ class FreshRSS_Entry extends Minz_Model { } public function _title($value) { $this->hash = null; - $this->title = $value; + $this->title = mb_strcut($value, 0, 255, 'UTF-8'); } public function _author($value) { $this->hash = null; - $this->author = $value; + $this->author = mb_strcut($value, 0, 255, 'UTF-8'); } public function _content($value) { $this->hash = null; diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 59f826c3e..73651187f 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -160,9 +160,9 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { $valuesTmp['guid'] = substr($valuesTmp['guid'], 0, 760); $valuesTmp['guid'] = safe_ascii($valuesTmp['guid']); $this->addEntryPrepared->bindParam(':guid', $valuesTmp['guid']); - $valuesTmp['title'] = substr($valuesTmp['title'], 0, 255); + $valuesTmp['title'] = mb_strcut($valuesTmp['title'], 0, 255, 'UTF-8'); $this->addEntryPrepared->bindParam(':title', $valuesTmp['title']); - $valuesTmp['author'] = substr($valuesTmp['author'], 0, 255); + $valuesTmp['author'] = mb_strcut($valuesTmp['author'], 0, 255, 'UTF-8'); $this->addEntryPrepared->bindParam(':author', $valuesTmp['author']); $this->addEntryPrepared->bindParam(':content', $valuesTmp['content']); $valuesTmp['link'] = substr($valuesTmp['link'], 0, 1023); @@ -176,7 +176,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { $valuesTmp['is_favorite'] = $valuesTmp['is_favorite'] ? 1 : 0; $this->addEntryPrepared->bindParam(':is_favorite', $valuesTmp['is_favorite'], PDO::PARAM_INT); $this->addEntryPrepared->bindParam(':id_feed', $valuesTmp['id_feed'], PDO::PARAM_INT); - $valuesTmp['tags'] = substr($valuesTmp['tags'], 0, 1023); + $valuesTmp['tags'] = mb_strcut($valuesTmp['tags'], 0, 1023, 'UTF-8'); $this->addEntryPrepared->bindParam(':tags', $valuesTmp['tags']); if ($this->hasNativeHex()) { @@ -243,9 +243,9 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { $valuesTmp['guid'] = substr($valuesTmp['guid'], 0, 760); $this->updateEntryPrepared->bindParam(':guid', $valuesTmp['guid']); - $valuesTmp['title'] = substr($valuesTmp['title'], 0, 255); + $valuesTmp['title'] = mb_strcut($valuesTmp['title'], 0, 255, 'UTF-8'); $this->updateEntryPrepared->bindParam(':title', $valuesTmp['title']); - $valuesTmp['author'] = substr($valuesTmp['author'], 0, 255); + $valuesTmp['author'] = mb_strcut($valuesTmp['author'], 0, 255, 'UTF-8'); $this->updateEntryPrepared->bindParam(':author', $valuesTmp['author']); $this->updateEntryPrepared->bindParam(':content', $valuesTmp['content']); $valuesTmp['link'] = substr($valuesTmp['link'], 0, 1023); @@ -258,7 +258,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { $this->updateEntryPrepared->bindValue(':is_read', $valuesTmp['is_read'] ? 1 : 0, PDO::PARAM_INT); } $this->updateEntryPrepared->bindParam(':id_feed', $valuesTmp['id_feed'], PDO::PARAM_INT); - $valuesTmp['tags'] = substr($valuesTmp['tags'], 0, 1023); + $valuesTmp['tags'] = mb_strcut($valuesTmp['tags'], 0, 1023, 'UTF-8'); $this->updateEntryPrepared->bindParam(':tags', $valuesTmp['tags']); if ($this->hasNativeHex()) { diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index 9d980c139..285f17193 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -55,9 +55,9 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable { $values = array( substr($valuesTmp['url'], 0, 511), $valuesTmp['category'], - substr($valuesTmp['name'], 0, 255), + mb_strcut($valuesTmp['name'], 0, 255, 'UTF-8'), substr($valuesTmp['website'], 0, 255), - substr($valuesTmp['description'], 0, 1023), + mb_strcut($valuesTmp['description'], 0, 1023, 'UTF-8'), $valuesTmp['lastUpdate'], base64_encode($valuesTmp['httpAuth']), FreshRSS_Feed::KEEP_HISTORY_DEFAULT, diff --git a/app/i18n/cz/admin.php b/app/i18n/cz/admin.php index d414ffd07..78a4a52e4 100644 --- a/app/i18n/cz/admin.php +++ b/app/i18n/cz/admin.php @@ -63,9 +63,13 @@ return array( ), 'files' => 'Instalace souborů', 'json' => array( - 'nok' => 'Nemáte JSON (balíček php5-json).', + 'nok' => 'Nemáte JSON (balíček php-json).', 'ok' => 'Máte rozšíření JSON.', ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', //TODO + 'ok' => 'You have the recommended library mbstring for Unicode.', //TODO + ), 'minz' => array( 'nok' => 'Nemáte framework Minz.', 'ok' => 'Máte framework Minz.', diff --git a/app/i18n/cz/install.php b/app/i18n/cz/install.php index ea4812ea5..acdb48ab6 100644 --- a/app/i18n/cz/install.php +++ b/app/i18n/cz/install.php @@ -68,6 +68,10 @@ return array( 'nok' => 'Pro parsování JSON chybí doporučená knihovna.', 'ok' => 'Máte doporučenou knihovnu pro parsování JSON.', ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', //TODO + 'ok' => 'You have the recommended library mbstring for Unicode.', //TODO + ), 'minz' => array( 'nok' => 'Nemáte framework Minz.', 'ok' => 'Máte framework Minz.', diff --git a/app/i18n/de/admin.php b/app/i18n/de/admin.php index f03e6cdaf..fbeb80296 100644 --- a/app/i18n/de/admin.php +++ b/app/i18n/de/admin.php @@ -63,9 +63,13 @@ return array( ), 'files' => 'Datei-Installation', 'json' => array( - 'nok' => 'Ihnen fehlt die JSON-Erweiterung (Paket php5-json).', + 'nok' => 'Ihnen fehlt die JSON-Erweiterung (Paket php-json).', 'ok' => 'Sie haben die JSON-Erweiterung.', ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', //TODO + 'ok' => 'You have the recommended library mbstring for Unicode.', //TODO + ), 'minz' => array( 'nok' => 'Ihnen fehlt das Minz-Framework.', 'ok' => 'Sie haben das Minz-Framework.', diff --git a/app/i18n/de/install.php b/app/i18n/de/install.php index b747d1551..d28b22840 100644 --- a/app/i18n/de/install.php +++ b/app/i18n/de/install.php @@ -68,6 +68,10 @@ return array( 'nok' => 'Ihnen fehlt eine empfohlene Bibliothek um JSON zu parsen.', 'ok' => 'Sie haben eine empfohlene Bibliothek um JSON zu parsen.', ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', //TODO + 'ok' => 'You have the recommended library mbstring for Unicode.', //TODO + ), 'minz' => array( 'nok' => 'Ihnen fehlt das Minz-Framework.', 'ok' => 'Sie haben das Minz-Framework.', diff --git a/app/i18n/en/admin.php b/app/i18n/en/admin.php index 1f857dbab..9db14978f 100644 --- a/app/i18n/en/admin.php +++ b/app/i18n/en/admin.php @@ -63,9 +63,13 @@ return array( ), 'files' => 'File installation', 'json' => array( - 'nok' => 'Cannot find JSON (php5-json package).', + 'nok' => 'Cannot find JSON (php-json package).', 'ok' => 'You have JSON extension.', ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', + 'ok' => 'You have the recommended library mbstring for Unicode.', + ), 'minz' => array( 'nok' => 'Cannot find the Minz framework.', 'ok' => 'You have the Minz framework.', diff --git a/app/i18n/en/install.php b/app/i18n/en/install.php index 40fff37dd..53d2f9be0 100644 --- a/app/i18n/en/install.php +++ b/app/i18n/en/install.php @@ -68,6 +68,10 @@ return array( 'nok' => 'Cannot find a recommended library to parse JSON.', 'ok' => 'You have a recommended library to parse JSON.', ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', //TODO + 'ok' => 'You have the recommended library mbstring for Unicode.', //TODO + ), 'minz' => array( 'nok' => 'Cannot find the Minz framework.', 'ok' => 'You have the Minz framework.', diff --git a/app/i18n/es/admin.php b/app/i18n/es/admin.php index 2884721c7..db41057bf 100755 --- a/app/i18n/es/admin.php +++ b/app/i18n/es/admin.php @@ -63,9 +63,13 @@ return array( ), 'files' => 'Instalación de Archivos', 'json' => array( - 'nok' => 'No se ha podido localizar JSON (paquete php5-json).', + 'nok' => 'No se ha podido localizar JSON (paquete php-json).', 'ok' => 'Dispones de la extensión JSON.', ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', //TODO + 'ok' => 'You have the recommended library mbstring for Unicode.', //TODO + ), 'minz' => array( 'nok' => 'No se ha podido localizar el entorno Minz.', 'ok' => 'Dispones del entorno Minz.', diff --git a/app/i18n/es/install.php b/app/i18n/es/install.php index cd6f63432..a9be807c7 100755 --- a/app/i18n/es/install.php +++ b/app/i18n/es/install.php @@ -68,6 +68,10 @@ return array( 'nok' => 'No se ha podido localizar la librería para procesar JSON.', 'ok' => 'Dispones de la librería recomendada para procesar JSON.', ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', //TODO + 'ok' => 'You have the recommended library mbstring for Unicode.', //TODO + ), 'minz' => array( 'nok' => 'No se ha podido localizar el entorno Minz.', 'ok' => 'Dispones del entorno Minz.', diff --git a/app/i18n/fr/admin.php b/app/i18n/fr/admin.php index 6c582d719..1874f2c77 100644 --- a/app/i18n/fr/admin.php +++ b/app/i18n/fr/admin.php @@ -63,8 +63,12 @@ return array( ), 'files' => 'Installation des fichiers', 'json' => array( - 'nok' => 'Vous ne disposez pas de JSON (paquet php5-json).', - 'ok' => 'Vous disposez de l’extension JSON.', + 'nok' => 'Vous ne disposez pas de l’extension recommendée JSON (paquet php-json).', + 'ok' => 'Vous disposez de l’extension recommendée JSON.', + ), + 'mbstring' => array( + 'nok' => 'Impossible de trouver la librairie recommandée mbstring pour Unicode.', + 'ok' => 'Vouz disposez de la librairie recommandée mbstring pour Unicode.', ), 'minz' => array( 'nok' => 'Vous ne disposez pas de la librairie Minz.', diff --git a/app/i18n/fr/install.php b/app/i18n/fr/install.php index 09625de78..9f2d90195 100644 --- a/app/i18n/fr/install.php +++ b/app/i18n/fr/install.php @@ -65,8 +65,12 @@ return array( 'ok' => 'Le HTTP REFERER est connu et semble correspondre à votre serveur.', ), 'json' => array( - 'nok' => 'Impossible de trouver une librairie recommandée pour JSON.', - 'ok' => 'Vouz disposez de la librairie recommandée pour JSON.', + 'nok' => 'Vous ne disposez pas de l’extension recommendée JSON (paquet php-json).', + 'ok' => 'Vous disposez de l’extension recommendée JSON.', + ), + 'mbstring' => array( + 'nok' => 'Impossible de trouver la librairie recommandée mbstring pour Unicode.', + 'ok' => 'Vouz disposez de la librairie recommandée mbstring pour Unicode.', ), 'minz' => array( 'nok' => 'Vous ne disposez pas de la librairie Minz.', diff --git a/app/i18n/he/admin.php b/app/i18n/he/admin.php index 2840213c9..71f86357e 100644 --- a/app/i18n/he/admin.php +++ b/app/i18n/he/admin.php @@ -33,7 +33,7 @@ return array( 'ok' => 'הספרייה הנדרשת ל character type checking (ctype) מותקנת', ), 'curl' => array( - 'nok' => 'בURL לא מותקן (php5-curl package)', + 'nok' => 'בURL לא מותקן (php-curl package)', 'ok' => 'You have cURL extension.', // @todo ), 'data' => array( @@ -63,9 +63,13 @@ return array( ), 'files' => 'File installation', // @todo 'json' => array( - 'nok' => 'You lack JSON (php5-json package).', // @todo + 'nok' => 'You lack JSON (php-json package).', // @todo 'ok' => 'You have JSON extension.', // @todo ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', //TODO + 'ok' => 'You have the recommended library mbstring for Unicode.', //TODO + ), 'minz' => array( 'nok' => 'You lack the Minz framework.', // @todo 'ok' => 'יש לכם את תשתית Minz', @@ -97,7 +101,7 @@ return array( 'ok' => 'Permissions on users directory are good.', // @todo ), 'zip' => array( - 'nok' => 'You lack ZIP extension (php5-zip package).', // @todo + 'nok' => 'You lack ZIP extension (php-zip package).', // @todo 'ok' => 'You have ZIP extension.', // @todo ), ), diff --git a/app/i18n/he/install.php b/app/i18n/he/install.php index 6d7cee661..93b8063b3 100644 --- a/app/i18n/he/install.php +++ b/app/i18n/he/install.php @@ -40,7 +40,7 @@ return array( 'ok' => 'הספרייה הנדרשת ל character type checking (ctype) מותקנת', ), 'curl' => array( - 'nok' => 'בURL לא מותקן (php5-curl package)', + 'nok' => 'בURL לא מותקן (php-curl package)', 'ok' => 'יש לכם את גירסת %s של cURL', ), 'data' => array( @@ -59,6 +59,14 @@ return array( 'nok' => 'נא לדבוק שאינך פוגעת ב HTTP REFERER שלך.', 'ok' => 'הHTTP REFERER ידוע ותאם לשרת שלך.', ), + 'json' => array( + 'nok' => 'Cannot find a recommended library to parse JSON.', //TODO + 'ok' => 'You have a recommended library to parse JSON.', //TODO + ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', //TODO + 'ok' => 'You have the recommended library mbstring for Unicode.', //TODO + ), 'minz' => array( 'nok' => 'You lack the Minz framework.', // @todo 'ok' => 'יש לכם את תשתית Minz', diff --git a/app/i18n/it/admin.php b/app/i18n/it/admin.php index a3034777f..5696ed571 100644 --- a/app/i18n/it/admin.php +++ b/app/i18n/it/admin.php @@ -63,9 +63,13 @@ return array( ), 'files' => 'Installazione files', 'json' => array( - 'nok' => 'Manca il supoorto a JSON (pacchetto php5-json).', + 'nok' => 'Manca il supoorto a JSON (pacchetto php-json).', 'ok' => 'Estensione JSON presente.', ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', //TODO + 'ok' => 'You have the recommended library mbstring for Unicode.', //TODO + ), 'minz' => array( 'nok' => 'Manca il framework Minz.', 'ok' => 'Framework Minz presente.', diff --git a/app/i18n/it/install.php b/app/i18n/it/install.php index 18f8cc337..2d0a34885 100644 --- a/app/i18n/it/install.php +++ b/app/i18n/it/install.php @@ -68,6 +68,10 @@ return array( 'nok' => 'You lack a recommended library to parse JSON.', 'ok' => 'You have a recommended library to parse JSON.', ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', //TODO + 'ok' => 'You have the recommended library mbstring for Unicode.', //TODO + ), 'minz' => array( 'nok' => 'Manca il framework Minz.', 'ok' => 'Framework Minz presente.', diff --git a/app/i18n/kr/admin.php b/app/i18n/kr/admin.php index 0c9edb110..bc65b3fa2 100644 --- a/app/i18n/kr/admin.php +++ b/app/i18n/kr/admin.php @@ -63,9 +63,13 @@ return array( ), 'files' => '파일 시스템 설치 요구사항', 'json' => array( - 'nok' => 'JSON 확장 기능을 찾을 수 없습니다 (php5-json 패키지).', + 'nok' => 'JSON 확장 기능을 찾을 수 없습니다 (php-json 패키지).', 'ok' => 'JSON 확장 기능이 설치되어 있습니다.', ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', //TODO + 'ok' => 'You have the recommended library mbstring for Unicode.', //TODO + ), 'minz' => array( 'nok' => 'Minz 프레임워크를 찾을 수 없습니다.', 'ok' => 'Minz 프레임워크가 설치되어 있습니다.', diff --git a/app/i18n/kr/install.php b/app/i18n/kr/install.php index 2eea71ff9..03a8ccdbe 100644 --- a/app/i18n/kr/install.php +++ b/app/i18n/kr/install.php @@ -65,9 +65,13 @@ return array( 'ok' => 'HTTP REFERER가 서버와 일치하는 것을 확인했습니다.', ), 'json' => array( - 'nok' => 'JSON 확장 기능을 찾을 수 없습니다 (php5-json 패키지).', + 'nok' => 'JSON 확장 기능을 찾을 수 없습니다 (php-json 패키지).', 'ok' => 'JSON 확장 기능이 설치되어 있습니다.', ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', //TODO + 'ok' => 'You have the recommended library mbstring for Unicode.', //TODO + ), 'minz' => array( 'nok' => 'Minz 프레임워크를 찾을 수 없습니다.', 'ok' => 'Minz 프레임워크가 설치되어 있습니다.', diff --git a/app/i18n/nl/admin.php b/app/i18n/nl/admin.php index a1d975305..8272e370c 100644 --- a/app/i18n/nl/admin.php +++ b/app/i18n/nl/admin.php @@ -63,9 +63,13 @@ return array( ), 'files' => 'Bestanden installatie', 'json' => array( - 'nok' => 'U mist JSON (php5-json package).', + 'nok' => 'U mist JSON (php-json package).', 'ok' => 'U hebt JSON uitbreiding.', ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', //TODO + 'ok' => 'You have the recommended library mbstring for Unicode.', //TODO + ), 'minz' => array( 'nok' => 'U mist Minz framework.', 'ok' => 'U hebt Minz framework.', diff --git a/app/i18n/nl/install.php b/app/i18n/nl/install.php index 419ee4c9b..c7887bf8e 100644 --- a/app/i18n/nl/install.php +++ b/app/i18n/nl/install.php @@ -68,6 +68,10 @@ return array( 'nok' => 'U mist een benodigede bibliotheek om JSON te gebruiken.', 'ok' => 'U hebt de benodigde bibliotheek om JSON te gebruiken.', ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', //TODO + 'ok' => 'You have the recommended library mbstring for Unicode.', //TODO + ), 'minz' => array( 'nok' => 'U mist het Minz framework.', 'ok' => 'U hebt het Minz framework.', diff --git a/app/i18n/pt-br/admin.php b/app/i18n/pt-br/admin.php index 16aa027a8..51c5d381f 100644 --- a/app/i18n/pt-br/admin.php +++ b/app/i18n/pt-br/admin.php @@ -63,9 +63,13 @@ return array( ), 'files' => 'Instalação de arquivos', 'json' => array( - 'nok' => 'Não foi possível encontrar JSON (php5-json).', + 'nok' => 'Não foi possível encontrar JSON (php-json).', 'ok' => 'Você tem a extensão JSON.', ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', //TODO + 'ok' => 'You have the recommended library mbstring for Unicode.', //TODO + ), 'minz' => array( 'nok' => 'Não foi possível encontrar o framework Minz.', 'ok' => 'Você tem o framework Minz.', diff --git a/app/i18n/pt-br/install.php b/app/i18n/pt-br/install.php index 3ca5fb854..65bddf62c 100644 --- a/app/i18n/pt-br/install.php +++ b/app/i18n/pt-br/install.php @@ -65,9 +65,13 @@ return array( 'ok' => 'Seu HTTP REFERER é conhecido e corresponde ao seu servidor.', ), 'json' => array( - 'nok' => 'Não foi possível encontrar JSON (php5-json).', + 'nok' => 'Não foi possível encontrar JSON (php-json).', 'ok' => 'Você tem a extensão JSON.', ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', //TODO + 'ok' => 'You have the recommended library mbstring for Unicode.', //TODO + ), 'minz' => array( 'nok' => 'Não foi possível encontrar o framework Minz.', 'ok' => 'Você tem o framework Minz.', diff --git a/app/i18n/ru/admin.php b/app/i18n/ru/admin.php index 4f5e937d7..91da8adcf 100644 --- a/app/i18n/ru/admin.php +++ b/app/i18n/ru/admin.php @@ -63,9 +63,13 @@ return array( ), 'files' => 'Установка файлов', 'json' => array( - 'nok' => 'У вас не установлена библиотека для работы с JSON (пакет php5-json).', + 'nok' => 'У вас не установлена библиотека для работы с JSON (пакет php-json).', 'ok' => 'У вас установлена библиотека для работы с JSON.', ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', //TODO + 'ok' => 'You have the recommended library mbstring for Unicode.', //TODO + ), 'minz' => array( 'nok' => 'У вас не установлен фрейворк Minz.', 'ok' => 'У вас установлен фрейворк Minz.', diff --git a/app/i18n/ru/install.php b/app/i18n/ru/install.php index 1dea2cd66..c1d0e81e8 100644 --- a/app/i18n/ru/install.php +++ b/app/i18n/ru/install.php @@ -64,6 +64,10 @@ return array( 'nok' => 'Убедитесь, что вы не изменяете ваш HTTP REFERER.', 'ok' => 'Ваш HTTP REFERER известен и соотвествует вашему серверу.', ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', //TODO + 'ok' => 'You have the recommended library mbstring for Unicode.', //TODO + ), 'minz' => array( 'nok' => 'У вас не установлен фрейворк Minz.', 'ok' => 'У вас установлен фрейворк Minz.', diff --git a/app/i18n/tr/admin.php b/app/i18n/tr/admin.php index f982bf644..f481bb294 100644 --- a/app/i18n/tr/admin.php +++ b/app/i18n/tr/admin.php @@ -63,9 +63,13 @@ return array( ), 'files' => 'Dosya kurulumu', 'json' => array( - 'nok' => 'JSON eklentisi eksik (php5-json package).', + 'nok' => 'JSON eklentisi eksik (php-json package).', 'ok' => 'JSON eklentisi sorunsuz.', ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', //TODO + 'ok' => 'You have the recommended library mbstring for Unicode.', //TODO + ), 'minz' => array( 'nok' => 'Minz framework eksik.', 'ok' => 'Minz framework sorunsuz.', diff --git a/app/i18n/tr/install.php b/app/i18n/tr/install.php index 4ae0ad7e3..f90e43f1d 100644 --- a/app/i18n/tr/install.php +++ b/app/i18n/tr/install.php @@ -68,6 +68,10 @@ return array( 'nok' => 'Tavsiye edilen JSON çözümleme kütüphanesi eksik.', 'ok' => 'Tavsiye edilen JSON çözümleme kütüphanesi sorunsuz.', ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', //TODO + 'ok' => 'You have the recommended library mbstring for Unicode.', //TODO + ), 'minz' => array( 'nok' => 'Minz framework eksik.', 'ok' => 'Minz framework sorunsuz.', diff --git a/app/i18n/zh-cn/admin.php b/app/i18n/zh-cn/admin.php index 1072dc972..1f007f964 100644 --- a/app/i18n/zh-cn/admin.php +++ b/app/i18n/zh-cn/admin.php @@ -63,9 +63,13 @@ return array( ), 'files' => '文件相关', 'json' => array( - 'nok' => '找不到 JSON 扩展 (php5-json ) 。', + 'nok' => '找不到 JSON 扩展 (php-json ) 。', 'ok' => '已找到 JSON 扩展', ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', //TODO + 'ok' => 'You have the recommended library mbstring for Unicode.', //TODO + ), 'minz' => array( 'nok' => '找不到 Minz 框架。', 'ok' => '已找到 Minz 框架。', diff --git a/app/i18n/zh-cn/install.php b/app/i18n/zh-cn/install.php index 1e172f0d5..fe34a44c0 100644 --- a/app/i18n/zh-cn/install.php +++ b/app/i18n/zh-cn/install.php @@ -68,6 +68,10 @@ return array( 'nok' => '找不到推荐的 JSON 解析库。', 'ok' => '已找到推荐的 JSON 解析库。', ), + 'mbstring' => array( + 'nok' => 'Cannot find the recommended library mbstring for Unicode.', //TODO + 'ok' => 'You have the recommended library mbstring for Unicode.', //TODO + ), 'minz' => array( 'nok' => '找不到 Minz 框架。', 'ok' => '已找到 Minz 框架。', diff --git a/app/install.php b/app/install.php index c30f8d583..100360f82 100644 --- a/app/install.php +++ b/app/install.php @@ -462,6 +462,12 @@ function printStep1() { <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.xml.nok'); ?></p> <?php } ?> + <?php if ($res['mbstring'] == 'ok') { ?> + <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.mbstring.ok'); ?></p> + <?php } else { ?> + <p class="alert alert-warn"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.mbstring.nok'); ?></p> + <?php } ?> + <?php if ($res['fileinfo'] == 'ok') { ?> <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.fileinfo.ok'); ?></p> <?php } else { ?> diff --git a/lib/lib_install.php b/lib/lib_install.php index 7305d8e28..d51a37e58 100644 --- a/lib/lib_install.php +++ b/lib/lib_install.php @@ -41,6 +41,7 @@ function checkRequirements($dbType = '') { $dom = class_exists('DOMDocument'); $xml = function_exists('xml_parser_create'); $json = function_exists('json_encode'); + $mbstring = extension_loaded('mbstring'); $data = DATA_PATH && is_writable(DATA_PATH); $cache = CACHE_PATH && is_writable(CACHE_PATH); $users = USERS_PATH && is_writable(USERS_PATH); @@ -61,6 +62,7 @@ function checkRequirements($dbType = '') { 'dom' => $dom ? 'ok' : 'ko', 'xml' => $xml ? 'ok' : 'ko', 'json' => $json ? 'ok' : 'ko', + 'mbstring' => $mbstring ? 'ok' : 'ko', 'data' => $data ? 'ok' : 'ko', 'cache' => $cache ? 'ok' : 'ko', 'users' => $users ? 'ok' : 'ko', diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 5f460862e..60616b3ca 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -21,6 +21,12 @@ if (!function_exists('json_encode')) { defined('JSON_UNESCAPED_UNICODE') or define('JSON_UNESCAPED_UNICODE', 256); //PHP 5.3 +if (!function_exists('mb_strcut')) { + function mb_strcut($str, $start, $length = null, $encoding = 'UTF-8') { + return substr($str, $start, $length); + } +} + /** * Build a directory path by concatenating a list of directory names. * @@ -405,6 +411,7 @@ function check_install_php() { 'fileinfo' => extension_loaded('fileinfo'), 'dom' => class_exists('DOMDocument'), 'json' => extension_loaded('json'), + 'mbstring' => extension_loaded('mbstring'), 'zip' => extension_loaded('zip'), ); } |
