Просмотр исходного кода

Updated where predicate with native Dibi modifier

Daniel Metcalf 6 лет назад
Родитель
Сommit
c27afcff33
1 измененных файлов с 6 добавлено и 6 удалено
  1. 6 6
      api/functions/organizr-functions.php

+ 6 - 6
api/functions/organizr-functions.php

@@ -1653,13 +1653,13 @@ function auth()
     {
         try {
             $connect = new Dibi\Connection([
-                                               'driver'   => 'sqlite3',
-                                               'database' => $GLOBALS['dbLocation'] . $GLOBALS['dbName'],
-                                           ]);
-            $all = $connect->fetch("SELECT group_id FROM tabs WHERE name = '%?%'", $tab);
-            return $all ? $all['group_id'] : 0;
+			    'driver' => 'sqlite3',
+			    'database' => $GLOBALS['dbLocation'] . $GLOBALS['dbName'],
+		    ]);
+            $row = $connect->fetch('SELECT group_id FROM tabs WHERE name = %~like~', $tab);
+            return $row ? $row['group_id'] : 0;
         } catch (\Dibi\Exception $e) {
-            writeLog('error', 'Tab Group Function - Error Fetching Tab Alias', $tab);
+            writeLog('error', 'Tab Group Function - Error Fetching Tab Group', $tab);
             return 0;
         }