Changeset 872
- Timestamp:
- Apr 9, 2017, 3:40:35 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/UpdateTrace.php
r867 r872 2945 2945 } 2946 2946 2947 function UpdateTo872($Manager) 2948 { 2949 // Allow to store IPv6 addresses 2950 $Manager->Execute('ALTER TABLE `UserOnline` CHANGE `IpAddress` `IpAddress` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT "";'); 2951 $Manager->Execute('ALTER TABLE `UserTrace` CHANGE `LastLogin` `LastLogin` DATETIME NULL;'); 2952 $Manager->Execute('ALTER TABLE `UserTrace` CHANGE `LastLogout` `LastLogout` DATETIME NULL;'); 2953 $Manager->Execute('UPDATE `UserTrace` SET LastLogin=NULL WHERE CAST(LastLogin AS CHAR(20))="0000-00-00 00:00:00"'); 2954 $Manager->Execute('UPDATE `UserTrace` SET LastLogout=NULL WHERE CAST(LastLogout AS CHAR(20))="0000-00-00 00:00:00"'); 2955 $Manager->Execute('ALTER TABLE `UserTrace` CHANGE `LastIP` `LastIP` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;'); 2956 } 2957 2947 2958 class Updates 2948 2959 { … … 2982 2993 849 => array('Revision' => 857, 'Function' => 'UpdateTo857'), 2983 2994 857 => array('Revision' => 867, 'Function' => 'UpdateTo867'), 2995 867 => array('Revision' => 872, 'Function' => 'UpdateTo872'), 2984 2996 )); 2985 2997 } -
trunk/Application/Version.php
r869 r872 7 7 8 8 $Version = '1.0'; 9 $Revision = 8 69; // Subversion revision10 $DatabaseRevision = 8 67; // Database structure revision11 $ReleaseDate = strtotime('201 6-02-06');9 $Revision = 872; // Subversion revision 10 $DatabaseRevision = 872; // Database structure revision 11 $ReleaseDate = strtotime('2017-04-09'); -
trunk/includes/Global.php
r862 r872 541 541 } 542 542 543 function GetTranslatNames($Text, $mode,$TablesColumn, $FirstBig = True)543 function GetTranslatNames($Text, $mode, $TablesColumn, $FirstBig = True) 544 544 { 545 545 global $System, $Config; … … 551 551 'areatrigger_teleport' => 'Name', 552 552 'areatrigger_tavern' => 'Name',); */ 553 $buff = array(); 554 555 //change chars by we want to separate 556 $Text = str_replace('$B$B',' ',$Text); 557 $Text = str_replace('$b$b',' ',$Text); 558 $Text = str_replace('$G',' ',$Text); 559 $Text = str_replace('$I',' ',$Text); 560 $Text = str_replace('$N',' ',$Text); 561 $Text = str_replace('$R',' ',$Text); 562 $Text = str_replace('$g',' ',$Text); 563 $Text = str_replace('$i',' ',$Text); 564 $Text = str_replace('$n',' ',$Text); 565 $Text = str_replace('$r',' ',$Text); 566 $Text = str_replace(':',' ',$Text); 567 $Text = str_replace(';',' ',$Text); 568 $Text = str_replace('!',' ',$Text); 569 $Text = str_replace('?',' ',$Text); 570 $Text = str_replace('.',' ',$Text); 571 $Text = str_replace(',',' ',$Text); 572 $Text = str_replace('\'s',' ',$Text); 573 $Text = str_replace('<',' ',$Text); 574 $Text = str_replace('>',' ',$Text); 575 $ArrStr = explode(' ', $Text); 576 $sqlall = ''; 553 $buff = array(); 554 555 // change chars by we want to separate 556 $Text = str_replace('$B$B', ' ', $Text); 557 $Text = str_replace('$b$b', ' ', $Text); 558 $Text = str_replace('$G', ' ', $Text); 559 $Text = str_replace('$I', ' ', $Text); 560 $Text = str_replace('$N', ' ', $Text); 561 $Text = str_replace('$R', ' ', $Text); 562 $Text = str_replace('$g', ' ', $Text); 563 $Text = str_replace('$i', ' ', $Text); 564 $Text = str_replace('$n', ' ', $Text); 565 $Text = str_replace('$r', ' ', $Text); 566 $Text = str_replace(':', ' ', $Text); 567 $Text = str_replace(';', ' ', $Text); 568 $Text = str_replace('!', ' ', $Text); 569 $Text = str_replace('?', ' ', $Text); 570 $Text = str_replace('.', ' ', $Text); 571 $Text = str_replace(',', ' ', $Text); 572 $Text = str_replace('\'s', ' ', $Text); 573 $Text = str_replace('<', ' ', $Text); 574 $Text = str_replace('>', ' ', $Text); 575 $ArrStr = explode(' ', $Text); 576 $sqlall = ''; 577 577 578 foreach($TablesColumn as $Table => $Column) 578 579 { 579 580 $orderinby = ' ORDER BY ID DESC '; 580 $sql = 'SELECT `ID`, (SELECT CONCAT( \''.GetIDbyName($Table).'\' )) AS `GoupId`,`'.$Column.'` AS Orig, (SELECT `'.$Column.'` FROM `'.$Table.'` AS `T` WHERE '. 581 '(`O`.`Entry` = `T`.`Entry`) AND (`Language` <> '.$Config['OriginalLanguage'].') '.$orderinby.' LIMIT 1) AS `Tran` FROM `'.$Table.'` AS `O` WHERE '; 581 $sql = 'SELECT `ID`, (SELECT CONCAT(\''.GetIDbyName($Table).'\' )) AS `GroupId`,`'. 582 $Column.'` AS Orig, (SELECT `'.$Column.'` FROM `'.$Table.'` AS `T` WHERE '. 583 '(`O`.`Entry` = `T`.`Entry`) AND (`Language` <> '.$Config['OriginalLanguage'].') '. 584 $orderinby.' LIMIT 1) AS `Tran` FROM `'.$Table.'` AS `O` WHERE '; 582 585 $groupby = ' GROUP BY `'.$Column.'` '; 583 586 584 587 $where = '(`Language` = '.$Config['OriginalLanguage'].') '; 585 if ($mode == 1) $where .= ' AND EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE (`Sub`.`Language` <> '.$Config['OriginalLanguage'].') AND (`Sub`.`Entry` = `O`.`Entry`))'; 586 if ($mode == 2) $where .= ' AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE (`Sub`.`Language` <> '.$Config['OriginalLanguage'].') AND (`Sub`.`Entry` = `O`.`Entry`))'; 588 if ($mode == 1) $where .= ' AND EXISTS(SELECT 1 FROM `'.$Table. 589 '` AS `Sub` WHERE (`Sub`.`Language` <> '.$Config['OriginalLanguage']. 590 ') AND (`Sub`.`Entry` = `O`.`Entry`))'; 591 if ($mode == 2) $where .= ' AND NOT EXISTS(SELECT 1 FROM `'.$Table. 592 '` AS `Sub` WHERE (`Sub`.`Language` <> '.$Config['OriginalLanguage']. 593 ') AND (`Sub`.`Entry` = `O`.`Entry`))'; 587 594 $where .= ' AND ('; 588 if (array_search('the' 595 if (array_search('the', $ArrStr)) $where .= '(`O`.`'.$Column.'` LIKE "The %") OR '; 589 596 590 597 $SqlOK = false; 591 if (count($ArrStr) > 0) { 592 for($i = 0; $i < count($ArrStr); $i++) 598 if (count($ArrStr) > 0) 599 { 600 for ($i = 0; $i < count($ArrStr); $i++) 593 601 { 594 595 //find word only if is 3 characters and more, and if starts by upper char, and search only once 602 // find word only if is 3 characters and more, and if starts by upper char, and search only once 596 603 if ((strlen($ArrStr[$i]) > 3) or ( ((count($ArrStr) < 6) or ($i == 0)) and (strlen($ArrStr[$i]) > 0) ) ) //length 597 if ((!$FirstBig) or (ctype_upper(substr($ArrStr[$i],0,1))) or (count($ArrStr) < 6) ) //first big 598 if (array_search($ArrStr[$i], $ArrStr) == $i) { //first in array 604 if ((!$FirstBig) or (ctype_upper(substr($ArrStr[$i], 0, 1))) or (count($ArrStr) < 6) ) //first big 605 if (array_search($ArrStr[$i], $ArrStr) == $i) 606 { // first in array 599 607 $where .= '(`O`.`'.$Column.'` LIKE "'.addslashes($ArrStr[$i]).'%") OR '; 600 608 $SqlOK = true; … … 604 612 $where .= ')'; 605 613 } 606 if ($SqlOK) { 614 if ($SqlOK) 615 { 607 616 //$sql.$where.$groupby.$orderby 608 617 // $buff[] = array($Line['ID'], GetIDbyName($Table), $Line['Orig'], $Line['Tran']); 609 618 if ($sqlall <> '') { $sqlall .= ' UNION ALL ( '.$sql.$where.$groupby.' )';} 610 619 else {$sqlall .= ' ( '.$sql.$where.$groupby.' )'; } 611 612 613 }614 if ($SqlOK){615 616 617 620 } 621 } 622 if ($SqlOK) 623 { 624 $orderby = ' ORDER BY LENGTH(Orig) DESC '; 625 // echo $sqlall. $orderby; 626 $DbResult = $System->Database->query($sqlall.$orderby); 618 627 // echo ($sql.'|'.$where.'|'.$groupby); 619 620 621 $buff[] = array($Line['ID'], $Line['GoupId'], $Line['Orig'], $Line['Tran']);622 623 624 628 while($Line = $DbResult->fetch_assoc()) 629 { 630 $buff[] = array($Line['ID'], $Line['GroupId'], $Line['Orig'], $Line['Tran']); 631 } 632 } 633 return $buff; 625 634 } 626 635
Note:
See TracChangeset
for help on using the changeset viewer.