Ignore:
Timestamp:
Jun 9, 2009, 8:04:54 AM (15 years ago)
Author:
george
Message:
  • Opraveno: Ve funkcích exportu opraveny odkazy na obecné označení jazyků z formuláře dle id namísto dle textu jako cz a sk.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/export/export.php

    r180 r200  
    33function ExportToMangosSQL($Setting)
    44{
    5   global $Database, $Config, $TranslationTree;
     5  global $Database, $Config, $TranslationTree, $LanguageList;
    66 
    77  $AnoNe = array('Ne', 'Ano');
    88  if($_SESSION['UserID'] != '')
    99  {
    10     $DbResult = $Database->SQLCommand("SELECT user FROM `user` WHERE ID=".$_SESSION['UserID']);
    11     $User = mysql_fetch_assoc($DbResult);
    12   } else $User = array('user' => 'Neznámý');
    13 
    14   $WhereLang = '';
    15   if($Setting['language-cz']) $WhereLang .= " OR (Language = 1)";
    16   if($Setting['language-sk']) $WhereLang .= " OR (Language = 2)";
    17   if($Setting['language-other']) $WhereLang .= " OR (Language = 3)";
     10    $DbResult = $Database->SQLCommand('SELECT user FROM `user` WHERE ID='.$_SESSION['UserID']);
     11    $User = mysql_fetch_assoc($DbResult);
     12  } else $User = array('user' => 'Neznámý');
     13
     14  $WhereLang = '';
     15  foreach($LanguageList as $Language)
     16    if($Language['Enabled'] == 1)
     17      if(isset($Setting['language'.$Language['Id']]))  $WhereLang .= ' OR (Language = '.$Language['Id'].')';
    1818  if($WhereLang == '') $WhereLang = 1;
    1919    else $WhereLang = '('.substr($WhereLang, 4).')';
     
    8181}
    8282 
    83 function ExportToAoWoWSQL($Setting) {
    84   global $Database, $Config, $TranslationTree,$AoWoWconf;
    85                 require_once('../aowow/configs/config.php');
     83function ExportToAoWoWSQL($Setting)
     84{
     85  global $Database, $Config, $TranslationTree, $AoWoWconf, $LanguageList;
     86 
     87        require_once('../aowow/configs/config.php');
    8688       
    87     $Buffer = ExportToMangosSQL($Setting);
     89  $Buffer = ExportToMangosSQL($Setting);
    8890 
    89    $AnoNe = array('Ne', 'Ano');
    90   if($_SESSION['UserID'] != '')
    91   {
    92     $DbResult = $Database->SQLCommand("SELECT user FROM `user` WHERE ID=".$_SESSION['UserID']);
    93     $User = mysql_fetch_assoc($DbResult);
    94   } else $User = array('user' => 'Neznámý');
    95 
    96   $WhereLang = '';
    97   if($Setting['language-cz']) $WhereLang .= " OR (Language = 1)";
    98   if($Setting['language-sk']) $WhereLang .= " OR (Language = 2)";
    99   if($Setting['language-other']) $WhereLang .= " OR (Language = 3)";
     91  $AnoNe = array('Ne', 'Ano');
     92  if($_SESSION['UserID'] != '')
     93  {
     94    $DbResult = $Database->SQLCommand('SELECT user FROM `user` WHERE ID='.$_SESSION['UserID']);
     95    $User = mysql_fetch_assoc($DbResult);
     96  } else $User = array('user' => 'Neznámý');
     97
     98  $WhereLang = '';
     99  foreach($LanguageList as $Language)
     100    if($Language['Enabled'] == 1)
     101      if(isset($Setting['language'.$Language['Id']]))  $WhereLang .= ' OR (Language = '.$Language['Id'].')';
    100102  if($WhereLang == '') $WhereLang = 1;
    101103    else $WhereLang = '('.substr($WhereLang, 4).')';
     
    118120    else $WhereUsers = '(User IN ('.$SelectedUsers.'))';
    119121
    120         //data to aowow
     122        // Data to aowow
    121123
    122124        $Database->SelectDatabase($AoWoWconf['mangos']['db']);   
    123125        $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']);
    124     $AoWoWTables = array('aowow_resistances' => 'Id', 'aowow_spelldispeltype' => 'Id', 'aowow_skill' => 'skillID');
    125         foreach($AoWoWTables as $AoWoWTable => $IndexColum) {
    126         $Buffer .= '--'.$AoWoWTable.', ';
    127                 $Buffer .= "\n\n"; 
    128             $Query = 'SELECT name,'.$IndexColum.' FROM '.$AoWoWTable;
    129         $ID = $Database->SQLCommand($Query);
    130                 while($Line = mysql_fetch_assoc($ID)) {
     126  $AoWoWTables = array('aowow_resistances' => 'Id', 'aowow_spelldispeltype' => 'Id', 'aowow_skill' => 'skillID');
     127        foreach($AoWoWTables as $AoWoWTable => $IndexColum)
     128  {
     129        $Buffer .= '--'.$AoWoWTable.', ';
     130    $Buffer .= "\n\n"; 
     131          $Query = 'SELECT name,'.$IndexColum.' FROM '.$AoWoWTable;
     132    $ID = $Database->SQLCommand($Query);
     133                while($Line = mysql_fetch_assoc($ID))
     134    {
    131135                        $Ori_text = $Line['name'];
    132                 $Tran = mysql_fetch_assoc($Database->SQLCommand('SELECT text as en,
     136                $Tran = mysql_fetch_assoc($Database->SQLCommand('SELECT text as en,
    133137                (SELECT text FROM '.$Config['Database']['Database'].'.global_strings as tabletran
    134138                 WHERE tableen.entry = tabletran.entry AND (Complete = 1) AND '.$WhereLang.'
     
    137141                  text = "'.addslashes($Ori_text).'" LIMIT 1'));
    138142                        //echo ($Line['name'].'='.$Tran['tran']);
    139                         if ($Tran['tran'] <> '') {} else {
    140                         $Tran = mysql_fetch_assoc($Database->SQLCommand('SELECT OptionText as en,
     143                        if ($Tran['tran'] == '')
     144      {
     145                        $Tran = mysql_fetch_assoc($Database->SQLCommand('SELECT OptionText as en,
    141146                        (SELECT OptionText FROM '.$Config['Database']['Database'].'.npc_option as tabletran
    142147                         WHERE tableen.entry = tabletran.entry AND (Complete = 1) AND '.$WhereLang.'
     
    144149                        FROM '.$Config['Database']['Database'].'.npc_option as tableen WHERE
    145150                        OptionText = "'.addslashes($Ori_text).'" LIMIT 1'));
    146                         }
    147                         if ($Tran['tran'] <> '')
    148                                 $Buffer .= 'UPDATE `'.$AoWoWTable.'` SET name = "'.addslashes($Tran['tran']).'" WHERE '.$IndexColum.' = '.$Line[$IndexColum].' ;'."\n";
    149                 }
    150                 $Buffer .= "\n\n"; 
     151      }
     152                  if ($Tran['tran'] <> '')
     153                          $Buffer .= 'UPDATE `'.$AoWoWTable.'` SET name = "'.addslashes($Tran['tran']).'" WHERE '.$IndexColum.' = '.$Line[$IndexColum].' ;'."\n";
     154    }
     155        $Buffer .= "\n\n"; 
    151156        }
    152157        if($Setting['Diacritics'] != 1) $Buffer = utf2ascii($Buffer);
     
    157162function ExportToXML($Setting)
    158163{
    159   global $Database, $Config, $TranslationTree;
     164  global $Database, $Config, $TranslationTree, $LanguageList;
    160165 
    161166  $AnoNe = array('Ne', 'Ano');
    162167  if($_SESSION['UserID'] != '')
    163168  {
    164     $DbResult = $Database->SQLCommand("SELECT user FROM `user` WHERE ID=".$_SESSION['UserID']);
    165     $User = mysql_fetch_assoc($DbResult);
    166   } else $User = array('user' => 'Neznámý');
    167 
    168   $WhereLang = '';
    169   if($Setting['language-cz']) $WhereLang .= " OR (Language = 1)";
    170   if($Setting['language-sk']) $WhereLang .= " OR (Language = 2)";
    171   if($Setting['language-other']) $WhereLang .= " OR (Language = 3)";
     169    $DbResult = $Database->SQLCommand('SELECT user FROM `user` WHERE ID='.$_SESSION['UserID']);
     170    $User = mysql_fetch_assoc($DbResult);
     171  } else $User = array('user' => 'Neznámý');
     172
     173  $WhereLang = '';
     174  foreach($LanguageList as $Language)
     175    if($Language['Enabled'] == 1)
     176      if(isset($Setting['language'.$Language['Id']]))  $WhereLang .= ' OR (Language = '.$Language['Id'].')';
    172177  if($WhereLang == '') $WhereLang = 1;
    173178    else $WhereLang = '('.substr($WhereLang, 4).')';
     
    239244function ExportToDBC($Setting)
    240245{
    241   global $Database, $Config, $TranslationTree;
     246  global $Database, $Config, $TranslationTree, $LanguageList;
    242247 
    243248  $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/dbc/';
     
    246251  if($_SESSION['UserID'] != '')
    247252  {
    248     $DbResult = $Database->SQLCommand("SELECT user FROM `user` WHERE ID=".$_SESSION['UserID']);
    249     $User = mysql_fetch_assoc($DbResult);
    250   } else $User = array('user' => 'Neznámý');
    251 
    252   $WhereLang = '';
    253   if($Setting['language-cz']) $WhereLang .= " OR (Language = 1)";
    254   if($Setting['language-sk']) $WhereLang .= " OR (Language = 2)";
    255   if($Setting['language-other']) $WhereLang .= " OR (Language = 3)";
     253    $DbResult = $Database->SQLCommand('SELECT user FROM `user` WHERE ID='.$_SESSION['UserID']);
     254    $User = mysql_fetch_assoc($DbResult);
     255  } else $User = array('user' => 'Neznámý');
     256
     257  $WhereLang = '';
     258  foreach($LanguageList as $Language)
     259    if($Language['Enabled'] == 1)
     260      if(isset($Setting['language'.$Language['Id']]))  $WhereLang .= ' OR (Language = '.$Language['Id'].')';
    256261  if($WhereLang == '') $WhereLang = 1;
    257262    else $WhereLang = '('.substr($WhereLang, 4).')';
     
    311316function ExportToLua($Setting)
    312317{
    313   global $Database, $Config, $TranslationTree;
     318  global $Database, $Config, $TranslationTree, $LanguageList;
    314319 
    315320  $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/lua/';
     
    323328
    324329  $WhereLang = '';
    325   if($Setting['language-cz']) $WhereLang .= " OR (Language = 1)";
    326   if($Setting['language-sk']) $WhereLang .= " OR (Language = 2)";
    327   if($Setting['language-other']) $WhereLang .= " OR (Language = 3)";
     330  foreach($LanguageList as $Language)
     331    if($Language['Enabled'] == 1)
     332      if(isset($Setting['language'.$Language['Id']]))  $WhereLang .= ' OR (Language = '.$Language['Id'].')';
    328333  if($WhereLang == '') $WhereLang = 1;
    329334    else $WhereLang = '('.substr($WhereLang, 4).')';
Note: See TracChangeset for help on using the changeset viewer.