From 83bbbd1fe3d75a62f27462250ebe7632ecea0a75 Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Sun, 29 Oct 2017 06:49:43 +0000
Subject: [PATCH] Issue 3828: Better handling if query doesn't return a value

---
 include/pgettext.php | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/include/pgettext.php b/include/pgettext.php
index f6f26a8cc4..da47b8b6c1 100644
--- a/include/pgettext.php
+++ b/include/pgettext.php
@@ -106,13 +106,11 @@ function load_translation_table($lang) {
 
 	$a->strings = array();
 	// load enabled plugins strings
-	$plugins = q("SELECT name FROM addon WHERE installed=1;");
-	if ($plugins!==false) {
-		foreach ($plugins as $p) {
-			$name = $p['name'];
-			if (file_exists("addon/$name/lang/$lang/strings.php")) {
-				include("addon/$name/lang/$lang/strings.php");
-			}
+	$plugins = dba::select('addon', array('name'), array('installed' => true));
+	while ($p = dba::fetch($plugins)) {
+		$name = $p['name'];
+		if (file_exists("addon/$name/lang/$lang/strings.php")) {
+			include("addon/$name/lang/$lang/strings.php");
 		}
 	}