예제 #1
0
파일: Main.php 프로젝트: robyandelluk/FileZ
 public function indexAction()
 {
     // Display the send_us_a_file.html page if the "Send us a file" feature is on and the user is not logged in.
     if (fz_config_get('app', 'send_us_a_file_feature') && false == $this->getUser()) {
         set('start_from', Zend_Date::now()->get(Zend_Date::DATE_SHORT));
         $maxUploadSize = min(Fz_Db::getTable('File')->shorthandSizeToBytes(ini_get('upload_max_filesize')), Fz_Db::getTable('File')->shorthandSizeToBytes(ini_get('post_max_size')));
         set('max_upload_size', $maxUploadSize);
         return html('send_us_a_file.html');
     }
     $this->secure();
     $user = $this->getUser();
     $freeSpaceLeft = max(0, Fz_Db::getTable('File')->getRemainingSpaceForUser($user));
     $maxUploadSize = min(Fz_Db::getTable('File')->shorthandSizeToBytes(ini_get('upload_max_filesize')), Fz_Db::getTable('File')->shorthandSizeToBytes(ini_get('post_max_size')), $freeSpaceLeft);
     $progressMonitor = fz_config_get('app', 'progress_monitor');
     $progressMonitor = new $progressMonitor();
     set('upload_id', md5(uniqid(mt_rand(), true)));
     set('start_from', Zend_Date::now()->get(Zend_Date::DATE_SHORT));
     set('refresh_rate', 1200);
     set('files', Fz_Db::getTable('File')->findByOwnerOrderByUploadDateDesc($user));
     set('use_progress_bar', $progressMonitor->isInstalled());
     set('upload_id_name', $progressMonitor->getUploadIdName());
     set('free_space_left', $freeSpaceLeft);
     set('max_upload_size', $maxUploadSize);
     set('sharing_destinations', fz_config_get('app', 'sharing_destinations', array()));
     set('disk_usage', array('space' => '<b id="disk-usage-value">' . bytesToShorthand(Fz_Db::getTable('File')->getTotalDiskSpaceByUser($user)) . '</b>', 'quota' => fz_config_get('app', 'user_quota')));
     return html('main/index.php');
 }
예제 #2
0
        echo $msg;
        ?>
</pre>
        <?php 
    }
    ?>
        </div>
      <?php 
}
?>

      <?php 
if (isset($user)) {
    ?>
        <p id="disk-usage"><?php 
    echo __r('Using %space% of %quota%', array('space' => '<b id="disk-usage-value">' . bytesToShorthand(Fz_Db::getTable('File')->getTotalDiskSpaceByUser($user)) . '</b>', 'quota' => fz_config_get('app', 'user_quota')));
    ?>
.
        </p>
      <?php 
}
?>

      <div id="support">
        <?php 
if (fz_config_get('looknfeel', 'help_url')) {
    ?>
          <a href="<?php 
    echo url_for(fz_config_get('looknfeel', 'help_url'));
    ?>
" class="help" target="#_blank"><?php 
예제 #3
0
파일: Upload.php 프로젝트: kvenkat971/FileZ
 /**
  * Function called on file upload success, a default message is returned
  * to the user.
  *
  * @param App_Model_File $file
  */
 private function onFileUploadSuccess(App_Model_File $file)
 {
     $user = $this->getUser();
     $response['status'] = 'success';
     $response['statusText'] = __('The file was successfully uploaded');
     $response['html'] = partial('main/_file_row.php', array('file' => $file));
     $response['disk_usage'] = bytesToShorthand(max(0, Fz_Db::getTable('File')->getTotalDiskSpaceByUser($user)));
     return $this->returnData($response);
 }
예제 #4
0
  <form method="POST" enctype="multipart/form-data" action="<?php 
echo url_for('upload');
?>
" id="upload-form">
  <input type="hidden" name="MAX_FILE_SIZE" value="<?php 
echo $max_upload_size;
?>
" />
  <div id="file">
    <label for="file-input"><?php 
echo __r('File (Max size: %size%)', array('size' => bytesToShorthand($max_upload_size)));
?>
 :</label>
    <div id="input-file">
      <input type="file" id="file-input" name="file" value="" alt="<?php 
echo __('File');
?>
" />
    </div>
  </div>
  <div id="lifetime">
    <label for="select-lifetime"><?php 
echo __('Lifetime');
?>
 :</label>
    <select id="select-lifetime" name="lifetime" alt="<?php 
echo __('Select a lifetime');
?>
">
      <?php 
$default = fz_config_get('app', 'default_file_lifetime', 10);
예제 #5
0
파일: User.php 프로젝트: kvenkat971/FileZ
 /**
  * Function used to get the user disk usage
  *
  * @return disk space used by the user
  */
 public function getDiskUsage()
 {
     return bytesToShorthand(Fz_Db::getTable('File')->getTotalDiskSpaceByUser($this));
 }