Changeset 28161 for extensions/rv_autocomplete
- Timestamp:
- Apr 12, 2014, 8:13:46 PM (10 years ago)
- Location:
- extensions/rv_autocomplete
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/rv_autocomplete/admin/functions.inc.php
r28153 r28161 22 22 $q = substr($q, 0, $pos); 23 23 } 24 $invalid = '&()".:;,'; 25 $q = strtr($q, $invalid, str_repeat(' ', strlen($invalid))); 26 for($i=0; $i<3; $i++) 27 $q = str_replace(' ', ' ', $q); 24 28 } 25 29 elseif (strncmp($url,'q=',2)==0) … … 35 39 if (isset($q)) 36 40 { 37 if ( ($pos=strpos($q,' ')) !== false )38 {39 $q = '"'.$q.'"';40 }41 41 $url = get_root_url().'qsearch.php?q='.rawurlencode($q); 42 42 } … … 198 198 $results = $rule['out']; 199 199 $processed = array(); 200 if ('a' == $rule['type']) 201 $processed[$in_word_t] = 1; 202 200 203 for ($i=0; $i<count($results); $i++) 201 204 { … … 247 250 file_put_contents($file, $save); 248 251 } 249 @file_put_contents($file.'.txt', var_export($res,true) ); 252 $file=PHPWG_ROOT_PATH.$conf['data_location'].'tmp/autocomplete_variants.txt'; 253 if ($fh = @fopen($file, 'w')) 254 { 255 fputcsv($fh, array("Type", "In", "Out"), "\t"); 256 foreach($rmap as $in => $words) 257 fputcsv($fh, array("r", $in, implode(',', $words)), "\t"); 258 foreach($amap as $in => $words) 259 fputcsv($fh, array("r", $in, implode(',', $words)), "\t"); 260 fclose($fh); 261 } 250 262 } 251 263 … … 282 294 sort($in_trans); 283 295 $key = implode(',', $in_trans); 284 if (strlen($key)> 16)296 if (strlen($key)>24) 285 297 $key = md5($key); 286 298 … … 308 320 ); 309 321 if (!empty($params['comment'])) 310 $rule['comment'] = $params['comment'];322 $rule['comment'] = stripslashes($params['comment']); 311 323 $rules[$key] = $rule; 312 324 -
extensions/rv_autocomplete/functions.inc.php
r28153 r28161 37 37 function rvac_normalize($name) 38 38 { 39 $invalid = '&() .,-';39 $invalid = '&()".,:;-'; 40 40 $name = strtr($name, $invalid, str_repeat(' ', strlen($invalid))); 41 41 $name = transliterate($name); … … 238 238 } 239 239 240 $ in_list = $processed = array();240 $processed = array(); 241 241 for ($i=0; $i<count($all); $i++) 242 242 { … … 244 244 $in_t = transliterate($in); 245 245 246 if (isset($ in_list[$in_t]))246 if (isset($processed[$in_t])) 247 247 { 248 248 array_splice($all, $i, 1); … … 250 250 continue; 251 251 } 252 253 if (isset($processed[$in_t]))254 continue;255 252 $processed[$in_t] = 1; 256 253 257 254 if (isset($amap[$in_t])) 258 255 { 259 array_splice($all, $i, 0, $amap[$in_t]);256 $all = array_merge($all, $amap[$in_t]); 260 257 } 261 258 }
Note: See TracChangeset
for help on using the changeset viewer.