------------------------------------------------------------
revno: 853
committer: Roger Martin <[email protected]>
branch nick: aikiframework
timestamp: Wed 2011-06-15 22:00:09 +0200
message:
  Fix bug 797412 pagination break
modified:
  src/libs/widgets.php


--
lp:aikiframework
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk

Your team Aiki Framework Developers is subscribed to branch lp:aikiframework.
To unsubscribe from this branch go to 
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk/+edit-subscription
=== modified file 'src/libs/widgets.php'
--- src/libs/widgets.php	2011-06-15 02:54:01 +0000
+++ src/libs/widgets.php	2011-06-15 20:00:09 +0000
@@ -530,7 +530,7 @@
 				preg_match('/select DISTINCT(.*)from/si', 
 						   $widget->normal_select, $get_DISTINCT);
 
-				preg_match('/select(.*) from /si', 
+				preg_match('/^select(.*) from /Usi', 
 						   $widget->normal_select, $selectionmatch);
 
                 if ( isset($selectionmatch['1']))
@@ -542,17 +542,17 @@
                         $records_num= $db->num_rows;                
                     } else {
                         if (isset ($get_DISTINCT['1'])){
-                            $mysql_count = 
-								' count(DISTINCT('.$get_DISTINCT['1'].')) ';
+                            $mysql_count = ' count(DISTINCT('.$get_DISTINCT['1'].')) ';
                         }else{  
                             $mysql_count = ' count(*) ';
                         }
-                        $records_num_query = 
-							str_replace($selectionmatch['1'], $mysql_count, 
-										$widget->normal_select);
-                        $records_num_query = 
-							preg_replace('/ORDER BY(.*)(DESC|ASC)?/i', '', 
-										 $records_num_query);
+                        $records_num_query = preg_replace (
+                            "/^select.* from /Usi",
+                            "SELECT $mysql_count FROM ",
+							$widget->normal_select);
+                        $records_num_query = preg_replace(
+							'/ORDER BY(.*)(DESC|ASC)?/i', '', 
+							 $records_num_query);
                         $records_num = $db->get_var($records_num_query);
                     }
                 }    

_______________________________________________
Mailing list: https://launchpad.net/~aikiframework-devel
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~aikiframework-devel
More help   : https://help.launchpad.net/ListHelp

Reply via email to