Changeset 873 for trunk/Modules/File


Ignore:
Timestamp:
Apr 6, 2020, 11:17:40 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Improved code format.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/File/File.php

    r738 r873  
    1616  {
    1717    $DbResult = $this->Database->select('File', 'Name', 'Id='.$Id);
    18     if($DbResult->num_rows > 0)
     18    if ($DbResult->num_rows > 0)
    1919    {
    2020      $DbRow = $DbResult->fetch_assoc();
     
    2828    // Submited form with file input have to be enctype="multipart/form-data"
    2929    $Result = 0;
    30     if(array_key_exists($Name, $_FILES) and ($_FILES[$Name]['name'] != ''))
     30    if (array_key_exists($Name, $_FILES) and ($_FILES[$Name]['name'] != ''))
    3131    {
    32       if(file_exists($_FILES[$Name]['tmp_name']))
     32      if (file_exists($_FILES[$Name]['tmp_name']))
    3333      {
    3434        $FileName = substr($_FILES[$Name]['name'], strrpos($_FILES[$Name]['name'], '/'));
    3535        $this->Database->query('INSERT INTO File (`Name`, `Size`) VALUES ("'.$FileName.'", '.filesize($_FILES[$Name]['tmp_name']).')');
    3636        $InsertId = $this->Database->insert_id;
    37         if(move_uploaded_file($_FILES[$Name]['tmp_name'], $this->FilesDir.'/'.$InsertId.'_'.$FileName)) $Result = $InsertId;
     37        if (move_uploaded_file($_FILES[$Name]['tmp_name'], $this->FilesDir.'/'.$InsertId.'_'.$FileName)) $Result = $InsertId;
    3838      }
    3939    }
    40     return($Result);
     40    return ($Result);
    4141  }
    4242
     
    4646
    4747    $Result = $MimeTypes[pathinfo($FileName, PATHINFO_EXTENSION)][0];
    48     return($Result);
     48    return ($Result);
    4949  }
    5050
     
    5252  {
    5353    $DbResult = $this->Database->select('File', '*', 'Id='.addslashes($Id));
    54     if($DbResult->num_rows > 0)
     54    if ($DbResult->num_rows > 0)
    5555    {
    5656      $DbRow = $DbResult->fetch_assoc();
    57       if($DbRow['Directory'] != '') $FileName = $this->GetDir($DbRow['Directory']);
     57      if ($DbRow['Directory'] != '') $FileName = $this->GetDir($DbRow['Directory']);
    5858        else $FileName = $this->FilesDir;
    5959      $FileName .= $DbRow['Name'];
    60       if(file_exists($FileName))
     60      if (file_exists($FileName))
    6161      {
    6262        Header('Content-Type: '.$this->DetectMimeType($FileName));
     
    7171    $DbResult = $this->Database->select('FileDirectory', '*', 'Id='.$Id);
    7272    $DbRow = $DbResult->fetch_assoc();
    73     if($DbRow['Parent'] != '') $Result = $this->GetDir($DbRow['Parent']);
     73    if ($DbRow['Parent'] != '') $Result = $this->GetDir($DbRow['Parent']);
    7474      else $Result = $this->FilesDir;
    7575    $Result .= $DbRow['Name'].'/';
    76     return($Result);
     76    return ($Result);
    7777  }
    7878}
     
    8383  function Show()
    8484  {
    85     if(array_key_exists('id', $_GET)) $Id = $_GET['id'];
    86     else if(array_key_exists('i', $_GET)) $Id = $_GET['i'];
    87     else return($this->SystemMessage('Chyba', 'Nezadáno id souboru'));
     85    if (array_key_exists('id', $_GET)) $Id = $_GET['id'];
     86    else if (array_key_exists('i', $_GET)) $Id = $_GET['i'];
     87    else return ($this->SystemMessage('Chyba', 'Nezadáno id souboru'));
    8888    $this->ClearPage = true;
    8989    $Output = $this->System->Modules['File']->Download($Id);
    90     return($Output);
     90    return ($Output);
    9191  }
    9292}
Note: See TracChangeset for help on using the changeset viewer.