summaryrefslogtreecommitdiff
path: root/static/upload.php
diff options
context:
space:
mode:
authorPeter Lejeck <peter.lejeck@gmail.com>2014-01-18 06:33:03 +0100
committerPeter Lejeck <peter.lejeck@gmail.com>2014-01-18 06:33:03 +0100
commitd3d88f49dcfee5cb0801d2f066b12be722410fc3 (patch)
tree1fecb11f7942ab312b3160bacdfccdeef23ed8b2 /static/upload.php
parentfd2c9a710dcb2dac821cbde1e80033837c47044f (diff)
Fix indentation in upload.php
Please, neku, learn to use tabs, okay?
Diffstat (limited to 'static/upload.php')
-rw-r--r--static/upload.php28
1 files changed, 14 insertions, 14 deletions
diff --git a/static/upload.php b/static/upload.php
index c6b9dc3..3da7174 100644
--- a/static/upload.php
+++ b/static/upload.php
@@ -21,11 +21,11 @@ function generate_name ($file) {
// TODO: come up with a better name generating algorithm
$newname = ''; // Filename Generator:
- $newname .= chr(mt_rand(ord("a"), ord("z"))); // + random lowercase letter
- $newname .= chr(mt_rand(ord("a"), ord("z"))); // + random lowercase letter
- $newname .= chr(mt_rand(ord("a"), ord("z"))); // + random lowercase letter
- $newname .= chr(mt_rand(ord("a"), ord("z"))); // + random lowercase letter
- $newname .= chr(mt_rand(ord("a"), ord("z"))); // + random lowercase letter
+ $newname .= chr(mt_rand(ord("a"), ord("z"))); // + random lowercase letter
+ $newname .= chr(mt_rand(ord("a"), ord("z"))); // + random lowercase letter
+ $newname .= chr(mt_rand(ord("a"), ord("z"))); // + random lowercase letter
+ $newname .= chr(mt_rand(ord("a"), ord("z"))); // + random lowercase letter
+ $newname .= chr(mt_rand(ord("a"), ord("z"))); // + random lowercase letter
$newname .= chr(mt_rand(ord("a"), ord("z"))); // + random lowercase letter
// To add a dot or not after a file which has no extension
if ($ext != '') $newname .= '.' . $ext;
@@ -72,15 +72,15 @@ function upload_file ($file) {
// Attempt to move it to the static directory
if (move_uploaded_file($file->tempfile, POMF_FILES_ROOT . $newname)) {
// Add it to the database
- $q = $db->prepare('INSERT INTO files (hash, orginalname, filename, size, date, expire, delid)' .
- 'VALUES (:hash, :orig, :name, :size, :date, :expires, :delid)');
- $q->bindValue(':hash', $file->get_sha1());
- $q->bindValue(':orig', $file->name);
- $q->bindValue(':name', $newname);
- $q->bindValue(':size', $file->size);
- $q->bindValue(':date', date('Y-m-d'));
- $q->bindValue(':expires', null);
- $q->bindValue(':delid', sha1($file->tempfile));
+ $q = $db->prepare('INSERT INTO files (hash, orginalname, filename, size, date, expire, delid)' .
+ 'VALUES (:hash, :orig, :name, :size, :date, :expires, :delid)');
+ $q->bindValue(':hash', $file->get_sha1());
+ $q->bindValue(':orig', $file->name);
+ $q->bindValue(':name', $newname);
+ $q->bindValue(':size', $file->size);
+ $q->bindValue(':date', date('Y-m-d'));
+ $q->bindValue(':expires', null);
+ $q->bindValue(':delid', sha1($file->tempfile));
$q->execute();
return array(
'hash' => $file->get_sha1(),