Fix #6628 - searching on notification history
[Pman.Core] / DataObjects / Core_template.php
index 03f9b97..23f885b 100644 (file)
@@ -411,12 +411,12 @@ WHERE (
         
 
         if (!empty($done[$clsname.':'.$lang])) {
-            return; // already sent headers and everything.
+            return true; // already sent headers and everything.
         }
         
         putenv("LANGUAGE=$lang");
-        if ($lang != 'en' && !setlocale(LC_ALL, $lang)) {
-            if (!setlocale(LC_ALL, $lang.'.UTF8')) {
+        if ($lang != 'en') {
+            if (!setlocale(LC_ALL, $lang.'.UTF-8')) {
                 $ff->page->jerr("Language is not available {$lang}");
             }
         }
@@ -435,7 +435,7 @@ WHERE (
         $d->filetype = 'php';
         if (! $d->find(true) ){
             $done[$clsname.':'.$lang] = true;
-            return;
+            return false;
         }
         $user = 'www-data'; // ?? do we need other ones
         $compileDir = ini_get('session.save_path') .'/' . 
@@ -470,10 +470,10 @@ WHERE (
         $ts->template_id = $d->id;
         if (!$ts->find(true)) {
             // then in theory there are no translations
-            return;
+            return false;
         }
         if (file_exists($fname) && strtotime($ts->updated) < filemtime($fname)) {
-            return; // file exists and is newer than our updated line.
+            return $fname; // file exists and is newer than our updated line.
         }
         //DB_DataObject::debugLevel(1);
 
@@ -482,6 +482,7 @@ WHERE (
         $ts->selectAdd('join_src_id_id.txt as src_id_txt, core_templatestr.txt as txt');
         $ts->lang = $lang;
         $ts->template_id = $d->id;
+        $ts->whereAdd("LENGTH(join_src_id_id.txt) > 0 AND LENGTH(core_templatestr.txt) > 0");
         $words = $ts->fetchAll('src_id_txt', 'txt' );
                
         if (!file_exists($fdir)) {
@@ -518,7 +519,7 @@ WHERE (
         
          
         
-        return;
+        return $fname;
         
         require_once 'File/Gettext.php';
         $gt = File_Gettext::factory('MO', $fname);