Browse Source

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
Alexandre Alapetite 7 years ago
parent
commit
32d9c3b790

+ 1 - 1
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

+ 1 - 1
README.md

@@ -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

+ 1 - 1
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)) {

+ 1 - 1
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)) {

+ 3 - 2
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;

+ 6 - 6
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()) {

+ 2 - 2
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,

+ 5 - 1
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.',

+ 4 - 0
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.',

+ 5 - 1
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.',

+ 4 - 0
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.',

+ 5 - 1
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.',

+ 4 - 0
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.',

+ 5 - 1
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.',

+ 4 - 0
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.',

+ 6 - 2
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.',

+ 6 - 2
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.',

+ 7 - 3
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
 		),
 	),

+ 9 - 1
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',

+ 5 - 1
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.',

+ 4 - 0
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.',

+ 5 - 1
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 프레임워크가 설치되어 있습니다.',

+ 5 - 1
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 프레임워크가 설치되어 있습니다.',

+ 5 - 1
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.',

+ 4 - 0
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.',

+ 5 - 1
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.',

+ 5 - 1
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.',

+ 5 - 1
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.',

+ 4 - 0
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.',

+ 5 - 1
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.',

+ 4 - 0
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.',

+ 5 - 1
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 框架。',

+ 4 - 0
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 框架。',

+ 6 - 0
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 { ?>

+ 2 - 0
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',

+ 7 - 0
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'),
 	);
 }