global $doubledots;
// We start at N retries, and --N until we give up
- $tries = POMF_FILES_RETRIES;
- $length = POMF_FILES_LENGTH;
+ $tries = UGUU_FILES_RETRIES;
+ $length = UGUU_FILES_LENGTH;
//Get EXT
$ext = pathinfo($file->name, PATHINFO_EXTENSION);
//Get mime
exit(0);
}
-
//Check if EXT is blacklisted
if (in_array($ext, unserialize(CONFIG_BLOCKED_EXTENSIONS))) {
http_response_code(415);
exit(0);
}
- // Check blacklist DB
- $q = $db->prepare('SELECT hash, COUNT(*) AS count FROM blacklistedfiles WHERE hash = (:hash)');
- $q->bindValue(':hash', $file->getSha1(), PDO::PARAM_STR);
- $q->execute();
- $result = $q->fetch();
- if ($result['count'] > 0) {
- http_response_code(415);
- throw new UploadException(UPLOAD_ERR_BLACKLISTED);
- exit(0);
- }
-
// Check if a file with the same name does already exist in the database
$q = $db->prepare('SELECT COUNT(filename) FROM files WHERE filename = (:name)');
$q->bindValue(':name', $name, PDO::PARAM_STR);
$ip = $_SERVER['REMOTE_ADDR'];
// Store the file's full file path in memory
- $uploadFile = POMF_FILES_ROOT . $newname;
+ $uploadFile = UGUU_FILES_ROOT . $newname;
// Attempt to move it to the static directory
if (!move_uploaded_file($file->tempfile, $uploadFile)) {
if(LOG_IP == 'yes'){
$q = $db->prepare('INSERT INTO files (hash, originalname, filename, size, date, ip) VALUES (:hash, :orig, :name, :size, :date, :ip)');
}else{
- $q = $db->prepare('INSERT INTO files (hash, originalname, filename, size, date) VALUES (:hash, :orig, :name, :size, :date)');
+ $ip = '0';
+ $q = $db->prepare('INSERT INTO files (hash, originalname, filename, size, date, ip) VALUES (:hash, :orig, :name, :size, :date, :ip)');
}
// Common parameters binding
$q->bindValue(':hash', $file->getSha1(), PDO::PARAM_STR);
return array(
'hash' => $file->getSha1(),
'name' => $file->name,
- 'url' => POMF_URL.rawurlencode($newname),
+ 'url' => UGUU_URL.rawurlencode($newname),
'size' => $file->size,
);
}