Add missed checks for the failed file openings

This commit is contained in:
Fedor A. Fetisov 2013-10-28 17:42:52 +04:00
parent a2bfeb72a7
commit b2f43076aa
2 changed files with 6 additions and 0 deletions

View File

@ -202,6 +202,9 @@ function read_locale_file($path) {
$messages = array();
$fp = fopen($path, "r");
if ($fp === FALSE) {
die("unable to read locale file $path");
}
while (!feof($fp)) {
$line = fgets($fp, 4096);
// Try to get key and value from locale file line

View File

@ -58,6 +58,9 @@ function save_message($locale, $key, $value)
$added = false;
$current_encoding = $mibew_encoding;
$fp = fopen(dirname(dirname(__FILE__))."/locales/$locale/properties", "r");
if ($fp === FALSE) {
die("unable to open properties for locale $locale");
}
while (!feof($fp)) {
$line = fgets($fp, 4096);
$keyval = preg_split("/=/", $line, 2);