Changeset 615 for trunk/includes/global.php
- Timestamp:
- Nov 28, 2013, 7:49:39 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/global.php
r614 r615 538 538 $Text = str_replace('>',' ',$Text); 539 539 $ArrStr = explode(' ', $Text); 540 540 $sqlall = ''; 541 541 foreach($TablesColumn as $Table => $Column) 542 542 { 543 $sql = 'SELECT `ID`,`'.$Column.'` , (SELECT `'.$Column.'` FROM `'.$Table.'` AS `T` WHERE '.543 $sql = 'SELECT `ID`,`'.$Column.'` AS Orig, (SELECT `'.$Column.'` FROM `'.$Table.'` AS `T` WHERE '. 544 544 '(`O`.`Entry` = `T`.`Entry`) AND (`Language` <> '.$Config['OriginalLanguage'].') LIMIT 1) AS `Tran` FROM `'.$Table.'` AS `O` WHERE '; 545 $groupby = ' GROUP BY `'.$Column.'` ';546 545 $groupby = ' GROUP BY `'.$Column.'` '; 546 // ORDER BY LENGTH('.$Column.') DESC 547 547 548 548 $where = '(`Language` = '.$Config['OriginalLanguage'].') '; … … 565 565 $where = substr($where, 0, strlen($where) - 4); 566 566 $where .= ')'; 567 } 568 if ($sqlall <> '') { $sqlall .= ' UNION ALL ( '.$sql.$where.$groupby.' )';} 569 else {$sqlall .= ' ( '.$sql.$where.$groupby.' )'; } 570 } 567 571 if ($SqlOK) { 568 $DbResult = $System->Database->query($sql .$where.$groupby);572 $DbResult = $System->Database->query($sqlall.' ORDER BY LENGTH(Orig) DESC'); 569 573 // echo ($sql.'|'.$where.'|'.$groupby); 570 574 while($Line = $DbResult->fetch_assoc()) 571 575 { 572 $buff[] = array($Line['ID'], GetIDbyName($Table), $Line[ $Column], $Line['Tran']);576 $buff[] = array($Line['ID'], GetIDbyName($Table), $Line['Orig'], $Line['Tran']); 573 577 } 574 578 } 575 }576 }577 579 return $buff; 578 580 }
Note:
See TracChangeset
for help on using the changeset viewer.