Browse Source

Modify wrong count row function - refs #6715

FraGoTe 11 years ago
parent
commit
62750f0063
1 changed files with 7 additions and 5 deletions
  1. 7 5
      main/inc/lib/plugin.class.php

+ 7 - 5
main/inc/lib/plugin.class.php

@@ -477,7 +477,7 @@ class Plugin
                 AND subkey like 'custom_tab_%'";
         $result = Database::query($sql);
         
-        $customTabsNum = Database::count_rows($result);
+        $customTabsNum = Database::num_rows($result);
         
         $tabNum = $customTabsNum + 1;
         
@@ -523,10 +523,12 @@ class Plugin
         $sql = "SELECT * 
                 FROM settings_current
                 WHERE variable = 'show_tabs'
-                AND subkey <> '$key'";
+                AND subkey <> '$key'
+                AND subkey like 'custom_tab_%'
+                ";
         $resp = $result = Database::query($sql);
-        $customTabsNum = Database::count_rows($result);
-        
+        $customTabsNum = Database::num_rows($result);
+     
         if (!empty($key)) {
             $whereCond = array(
                     'variable = ? AND subkey = ?' => array('show_tabs', $key)
@@ -535,7 +537,7 @@ class Plugin
 
             //if there is more than one tab
             //reenumerate them
-            if ($customTabsNum > 0) {
+            if (!empty($customTabsNum) && $customTabsNum > 0) {
                 $i = 1;
                 while ($row = Database::fetch_assoc($result)) {
                     $attributes = array(