iliaa           Wed May 26 11:57:29 2004 EDT

  Modified files:              
    /livedocs   livedoc_funcs.php 
  Log:
  More tuneup.
  
  
http://cvs.php.net/diff.php/livedocs/livedoc_funcs.php?r1=1.7&r2=1.8&ty=u
Index: livedocs/livedoc_funcs.php
diff -u livedocs/livedoc_funcs.php:1.7 livedocs/livedoc_funcs.php:1.8
--- livedocs/livedoc_funcs.php:1.7      Wed May 26 10:24:55 2004
+++ livedocs/livedoc_funcs.php  Wed May 26 11:57:28 2004
@@ -155,26 +155,19 @@
 function bind_entities($data) {
 
        global $idx;
-       
-       static $entity_cache = array();
-       
-       $entities = array();
+
        $sanity = 0;
 
        while (($ent_count = preg_match_all('/&([a-zA-Z0-9.-]+);/sm', $data, 
$matches)) && $sanity++ < 5) {
-               $q = sqlite_query($idx, "SELECT entid, value from ents where is_file=0 
and entid in ('" .  implode("','", $matches[1]) . "') GROUP BY entid");
-               if (!$q) {
+               $r = sqlite_array_query($idx, "SELECT '&'||entid||';', value from ents 
where is_file=0 and entid in ('" .  implode("','", $matches[1]) . "') GROUP BY entid", 
SQLITE_NUM);
+               if (empty($r)) {
                        break;
                }
                $src = $dst = array();
 
-               while ($r = sqlite_fetch_array($q, SQLITE_NUM)) {
-                       $src[] = '&' . $r[0] . ';';
-                       $dst[] = $r[1];
-               }
-
-               if (empty($src)) {
-                       break;
+               foreach ($r as $row) {
+                       $src[] = $row[0];
+                       $dst[] = $row[1];
                }
 
                $data = str_replace($src, $dst, $data);

Reply via email to