Changeset 22


Ignore:
Timestamp:
Jun 12, 2009, 8:56:03 PM (15 years ago)
Author:
george
Message:
  • Opraveno: Obnovena funkčnost formulářové položky typu PointerOneToOne a možnost volby databáze serveru.
Location:
trunk/www
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/form_classes.php

    r21 r22  
    8080    'Items' => array(
    8181      'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
    82       'UserName' => array('Type' => 'String', 'Caption' => 'Správce', 'Default' => ''),
    8382      'NetworkPortRealmd' => array('Type' => 'Integer', 'Caption' => 'Realmlist', 'Default' => ''),
    8483      'Version' => array('Type' => 'Integer', 'Caption' => 'Verze', 'Default' => 0),
     
    8786      'AccountCount' => array('Type' => 'Integer', 'Caption' => 'Účtů', 'Default' => 0),
    8887      'CharacterCount' => array('Type' => 'Integer', 'Caption' => 'Postav', 0),
     88      'UserName' => array('Type' => 'String', 'Caption' => 'Správce', 'Default' => ''),
    8989    ),
    9090  ),
     
    117117RegisterType('ServerType', 'Enumeration', array('Normální', 'PvP', 'RP', 'RPPvP'));
    118118RegisterType('OnlineState', 'Enumeration', array('Neaktivní', 'Aktivní'));
    119 
    120 //RegisterType('Database', 'PointerOneToOne', array('Table' => 'Database', 'Id' => 'Id', 'Name' => 'CONCAT(Name, " ", Version, " r", Revision)'));
     119RegisterType('Database', 'PointerOneToOne', array('Table' => 'Database', 'Id' => 'Id', 'Name' => 'CONCAT(Name, " ", Version, " r", Revision)'));
    121120
    122121?>
  • trunk/www/page.php

    r21 r22  
    5757    $Time = round(GetMicrotime() - $ScriptTimeStart, 2);
    5858    $Output = '<div id="Footer">
    59    <i>| Projekt: WoW hosting | Správce: '.$this->System->Config['Web']['Admin'].' | E-mail: '.$this->System->Config['Web']['AdminEmail'].' | <a href="http://svn.zdechov.net/trac/wowhosting/browser">Zdrojové kódy</a> |';
     59   <i>| Projekt: WoW hosting | Správce: '.$this->System->Config['Web']['Admin'].' | E-mail: '.$this->System->Config['Web']['AdminEmail'].' | <a href="http://svn.zdechov.net/trac/wowhosting/browser">Zdrojové kódy</a> | <a href="http://svn.zdechov.net/trac/wowhosting/log?verbose=on">Změny</a>|';
    6060    if($this->System->Config['Web']['ShowRuntimeInfo'] == true) $Output .= ' Doba generování: '.$Time.' s / '.ini_get('max_execution_time').' s | Použitá paměť: '.HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B |';
    6161        $Output .= '</i></div></body></html>';
  • trunk/www/task.php

    r20 r22  
    2626    {
    2727      $this->Database->query('UPDATE Task SET State="Running" WHERE Id='.$Task['Id']);
    28       echo('Provádím '.$Task['Title']."...\n");
     28      echo('Provádím úlohu '.$Task['Id'].': '.$Task['Title']."...\n");
    2929      $Task['CommandList'] = "#!/bin/sh\n".$Task['CommandList'];
    3030      file_put_contents($this->TempScript, $Task['CommandList']);
  • trunk/www/types/PointerOneToOne.php

    r11 r22  
    33class TypePointerOneToOne extends TypeBase
    44{
    5   function GetTablePointerName($Type, $Item)
    6   {
    7     global $Database;
    8 
    9     //print_r($Item);
    10     $Columns = '';
    11     $List = GetListDefinition($Type['Parameters'][0]);
    12     $TargetTable = $List['TableName'];
    13     //echo($TargetTable.'<');
    14     //print_r($List);
    15     foreach($List['Items'] as $Index => $ListItem)
    16     {
    17       //echo('ListItem');
    18       //print_r($ListItem);
    19       $Type = GetTypeDefinition($ListItem['Type']);
    20       if($ListItem['VisibleInPointer'] == 1)
    21       {
    22         if($Type['ParentType'] == TypePointerOneToOneId)
    23         {
    24           //print_r($Type);
    25           $DbResult = $Database->select(array('Database' => $List['Database'], 'Table' => $List['TableName'], 'Condition' => $List['IdName'].'='.$Item['Value']));
    26           $DbRow = $DbResult->fetch_assoc();
    27           $DefinitionItem = array('Name' => $Index, 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'], 'Value' => $DbRow[$Index], 'SourceTable' => $List['Id'], 'SourceItemId' => 0);
    28           $SubTarget = $this->GetTablePointerName($Type, $DefinitionItem);
    29           $Columns .= '"'.$SubTarget['Name'].' ",';
    30         } else $Columns .= '`'.$ListItem['Name'].'`," ",';
    31       }
    32     }
    33     $Columns = substr($Columns, 0, -1);
    34     if($Columns == '') $Columns = '`'.$List['IdName'].'` AS `Name`, `'.$List['IdName'].'`';
    35       else $Columns = 'CONCAT('.$Columns.') AS `Name`, `'.$List['IdName'].'`';
    36     $DbResult = $Database->select(array('Database' => $List['Database'], 'Table' => $TargetTable, 'Columns' => $Columns, 'Condition' => $List['IdName'].'='.$Item['Value']));
    37     //echo($Database->LastQuery);
    38     if($DbResult->num_rows > 0)
    39     {
    40       return($DbResult->fetch_assoc());
    41     } else return('');
    42   }
    43 
    44   function GetTablePointerNameList($Type, $Item)
    45   {
    46     global $Database;
    47 
    48     $Columns = '';
    49     $List = GetListDefinition($Type['Parameters'][0]);
    50     $TargetTable = $List['TableName'];
    51     foreach($List['Items'] as $ListItem)
    52       if($ListItem['VisibleInPointer'] == 1) $Columns .= '`'.$ListItem['Name'].'`," ",';
    53     $Columns = 'CONCAT('.substr($Columns, 0, -1).') AS Name, `'.$List['IdName'].'`';
    54     $DbResult = $Database->select(array('Database' => $List['Database'], 'Table' => $TargetTable, 'Columns' => $Columns));
    55     //echo($Database->LastQuery);
    56     if($DbResult->num_rows > 0)
    57     {
    58 
    59       $Result = array(array('Name' => 'Žádný', 'Id' => 0));
    60       while($DbRow = $DbResult->fetch_assoc())
    61         $Result[] = $DbRow;
    62       return($Result);
    63     } else return(array());
    64   }
    65 
    665  function OnView($Item)
    676  {
    68     global $Database;
     7    global $Database, $TypeDefinitionList;
    698
    70     $Type = GetTypeDefinition($Item['Type']);
     9    $Type = $TypeDefinitionList[$Item['Type']];
     10    $DbResult = $Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name FROM `'.$Type['Parameters']['Table'].'` WHERE `'.$Type['Parameters']['Id'].'`='.$Item['Value']);
     11    $DbRow = $DbResult->fetch_assoc();
     12    $Output = $DbRow['Name'];
     13   
     14/*    $Type = GetTypeDefinition($Item['Type']);
    7115    $List = GetListDefinition($Type['Parameters'][0]);
    7216    $TargetTable = $Type['Parameters'][0];
     
    7418    if($TargetName != '') $Output = '<a href="?Action=ViewItem&amp;Table='.$TargetTable.'&amp;Item='.$TargetName[$List['IdName']].'">'.$TargetName['Name'].'</a>';
    7519    else $Output = '';
     20    */
    7621    return($Output);
    7722  }
     
    7924  function OnEdit($Item)
    8025  {
    81     global $Database, $Types;
     26    global $Database, $TypeDefinitionList;
    8227
    83     $Type = $Types[$Item['Type']];
    84     $List = GetListDefinition($Type['Parameters'][0]);
    8528    $Output = '<select name="'.$Item['Name'].'">';
    86     $TargetNameList = $this->GetTablePointerNameList($Type, $Item);
    87     //echo($Database->LastQuery);
    88     foreach($TargetNameList as $TargetName)
     29    $Type = $TypeDefinitionList[$Item['Type']];
     30    $DbResult = $Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name,'.$Type['Parameters']['Id'].' AS Id FROM `'.$Type['Parameters']['Table'].'`');
     31    while($DbRow = $DbResult->fetch_assoc())
    8932    {
    90       if($Item['Value'] == $TargetName[$List['IdName']]) $Selected = ' selected="1"'; else $Selected = '';
    91       $Output .= '<option value="'.$TargetName[$List['IdName']].'"'.$Selected.'>'.$TargetName['Name'].'</option>';
     33      if($Item['Value'] == $DbRow['Id']) $Selected = ' selected="1"'; else $Selected = '';
     34      $Output .= '<option value="'.$DbRow['Id'].'"'.$Selected.'>'.$DbRow['Name'].'</option>';
    9235    }
    9336    $Output .= '</select>';
  • trunk/www/user.php

    r20 r22  
    102102          else
    103103          {
    104             $this->Database->insert('User', array('Name' => $Name, 'Login' => $Login, 'Password' => sha1($Password), 'Email' => $Email, 'RegistrationTime' => 'NOW()', 'Locked' => 1, 'Role' => 2));
     104            $this->Database->insert('User', array('Name' => $Name, 'Login' => $Login, 'Password' => $Password, 'Email' => $Email, 'RegistrationTime' => 'NOW()', 'Locked' => 1, 'Role' => 2));
    105105            $UserId = $this->Database->insert_id;
    106106           
    107107            $Subject = FromUTF8('Registrace nového účtu', 'iso2');
    108             $Message = 'Provedli jste registraci nového účtu na serveru <a href="http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'">http://'.$Config['Web']['Host'].$Config['Web']['RootFolder']."</a>.<br>\nPokud jste tak neučinili, měli by jste tento email ignorovat.<br><br>\n\nVáš účet je: ".$Login."\n<br>Pro dokončení registrace klikněte na tento odkaz: ".'<a href="http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'/?Action=UserRegisterConfirm&User='.$UserId.'&H='.sha1($Password).'">http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'/?Action=UserRegisterConfirm&User='.$UserId.'&H='.sha1($Password).'</a>.'."\n<br> \n\n<br><br>Na tento email neodpovídejte.";
     108            $Message = 'Provedli jste registraci nového účtu na serveru <a href="http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'/">http://'.$Config['Web']['Host'].$Config['Web']['RootFolder']."/</a>.<br>\nPokud jste tak neučinili, měli by jste tento email ignorovat.<br><br>\n\nVáš účet je: ".$Login."\n<br>Pro dokončení registrace klikněte na tento odkaz: ".'<a href="http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'/?Action=UserRegisterConfirm&User='.$UserId.'&H='.$Password.'">http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'/?Action=UserRegisterConfirm&User='.$UserId.'&H='.$Password.'</a>.'."\n<br> \n\n<br><br>Na tento email neodpovídejte.";
    109109            $AdditionalHeaders = "To: ".$Name." <".$Email.">\n"."From: ".FromUTF8($Config['Web']['Title'], 'iso2')." <noreplay@zdechov.net>\n"."MIME-Version: 1.0\n"."Content-type: text/html; charset=utf-8";
    110110            mail($Email, $Subject, $Message, $AdditionalHeaders);
Note: See TracChangeset for help on using the changeset viewer.