Multiple changes everywhere
This commit is contained in:
parent
40af9e6304
commit
2f98035ac1
|
@ -1 +1,4 @@
|
|||
includes/config.php
|
||||
rain/cache/*.php
|
||||
rain/template/footer.html
|
||||
public/files
|
||||
|
|
1
LICENSE
1
LICENSE
|
@ -1,5 +1,6 @@
|
|||
The MIT License (MIT)
|
||||
Copyright (c) 2015 nokonoko
|
||||
Copyright (c) 2016 PA BANDINELLI, HéliApps SAS
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
|
|
9
api.php
9
api.php
|
@ -1,14 +1,17 @@
|
|||
<?php
|
||||
//Loading configuration file
|
||||
require_once "includes/config.php";
|
||||
|
||||
//If the value d doesn't exist, redirect back to front page *1
|
||||
if(isset($_GET['d'])) {
|
||||
//Include the core file with the functions
|
||||
include_once('includes/core.php');
|
||||
include_once(CONFIG_ROOT_PATH.'includes/core.php');
|
||||
switch ($_GET['d']) {
|
||||
//Uploading with HTML response and errors
|
||||
case 'upload':
|
||||
//If no file is being posted, show the error page and exit.
|
||||
if(empty($_FILES['file']['name'])){
|
||||
include_once('error.php');
|
||||
include_once(CONFIG_ROOT_PATH.'error.php');
|
||||
exit(0);
|
||||
}
|
||||
//Set the name value to the original filename
|
||||
|
@ -47,7 +50,7 @@ if(isset($_GET['d'])) {
|
|||
break;
|
||||
default:
|
||||
//If no correct valid argument for the api to perform on, tell them to enter a valid one
|
||||
exit('Please provide a valid argument. Example: curl -i -F name=test.jpg -F file=@localfile.jpg http://uguu.se/api.php?d=upload-tool');
|
||||
exit('Please provide a valid argument. Example: curl -i -F name=test.jpg -F file=@localfile.jpg '.CONFIG_ROOT_URL.'/api.php?d=upload-tool');
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
|
|
|
@ -13,6 +13,5 @@ $tpl->assign("title", $title);
|
|||
$tpl->draw("header");
|
||||
$tpl->draw("error");
|
||||
|
||||
|
||||
$tpl->draw("footer");
|
||||
?>
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
#This is the configuration file for Uguu Temp File Sharing system
|
||||
define('CONFIG_ROOT_URL', "http://path.to.uguu");
|
||||
define('CONFIG_FILES_PATH', "/path/to/uguu/public/files/");
|
||||
define('CONFIG_ROOT_PATH', "/path/to/uguu/");
|
||||
define('CONFIG_RANDOM_LENGTH', "10");
|
|
@ -1,24 +1,25 @@
|
|||
<?php
|
||||
//Loading configuration file
|
||||
require_once "config.php";
|
||||
|
||||
//Saving the file on the server
|
||||
function save_file ($file, $name, $arg, $type){
|
||||
//Where to save
|
||||
$path='/home/neku/www/files/';
|
||||
$block = array('exe', 'scr', 'rar', 'zip', 'com', 'vbs', 'bat', 'cmd', 'html', 'htm', 'msi');
|
||||
//Generate name depending on arg
|
||||
switch($arg){
|
||||
case 'random':
|
||||
$ext = pathinfo($file.$name, PATHINFO_EXTENSION);
|
||||
$ext = strtolower($ext);
|
||||
if(in_array($ext, $block)){
|
||||
if($type==='normal'){
|
||||
include_once('error_meow.php');
|
||||
if(in_array($ext, unserialize(CONFIG_BLOCKED_EXTENSIONS))){
|
||||
if($type==='normal'){
|
||||
include_once(CONFIG_ROOT_PATH.'error_meow.php');
|
||||
exit(0);
|
||||
}else{
|
||||
exit('File type not allowed.');
|
||||
}
|
||||
}
|
||||
}else{
|
||||
exit('File type not allowed.');
|
||||
}
|
||||
}
|
||||
$file_name = gen_name('random', $ext);
|
||||
while(file_exists($path.$file_name)){
|
||||
$file_name = gen_name('random', $ext);
|
||||
while(file_exists(CONFIG_FILES_PATH.$file_name)){
|
||||
$file_name = gen_name('random', $ext);
|
||||
}
|
||||
break;
|
||||
case 'custom_original':
|
||||
|
@ -27,38 +28,40 @@ function save_file ($file, $name, $arg, $type){
|
|||
$file_name = gen_name('custom_original', $name);
|
||||
$ext = pathinfo($file_name, PATHINFO_EXTENSION);
|
||||
$ext = strtolower($ext);
|
||||
if(in_array($ext, $block)){
|
||||
if($type==='normal'){
|
||||
include_once('error_meow.php');
|
||||
exit(0);
|
||||
}else{
|
||||
exit('File type not allowed.');
|
||||
if(in_array($ext, unserialize(CONFIG_BLOCKED_EXTENSIONS))){
|
||||
if($type==='normal'){
|
||||
include_once(CONFIG_ROOT_PATH.'error_meow.php');
|
||||
exit(0);
|
||||
}else{
|
||||
exit('File type not allowed.');
|
||||
}
|
||||
}
|
||||
}
|
||||
while(file_exists($path.$file_name)){
|
||||
while(file_exists(CONFIG_FILES_PATH.$file_name)){
|
||||
$file_name = gen_name('custom_original', $name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
//Move the file to the above location with said filename
|
||||
move_uploaded_file($file,$path.$file_name);
|
||||
move_uploaded_file($file,CONFIG_FILES_PATH.$file_name);
|
||||
//Check if html or plain text should be returned
|
||||
if($type==='tool'){
|
||||
//Return url+filename to the user (plain text)
|
||||
echo 'http://a.uguu.se/'.urlencode($file_name);
|
||||
echo CONFIG_ROOT_URL.'/files/'.urlencode($file_name);
|
||||
exit(0);
|
||||
}elseif($type==='normal'){
|
||||
//Return url+filename to the user (HTML)
|
||||
$n=urlencode($file_name);
|
||||
include_once('/home/neku/www/page/public/upload-done.php');
|
||||
include_once(CONFIG_ROOT_PATH.'upload-done.php');
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
#Generate a random name for the uploaded file
|
||||
function gen_name($arg, $in){
|
||||
$chars = 'abcdefghijklmnopqrstuvwxyz';
|
||||
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
||||
$name = '';
|
||||
for ($i = 0; $i < 6; $i++) {
|
||||
$name .= $chars[mt_rand(0, 25)];
|
||||
for ($i = 0; $i < CONFIG_RANDOM_LENGTH; $i++) {
|
||||
$name .= $chars[mt_rand(0, 60)];
|
||||
}
|
||||
switch($arg){
|
||||
case 'random':
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
//Loading configuration file
|
||||
require_once "includes/config.php";
|
||||
|
||||
require_once "rain/rain.tpl.class.php";
|
||||
|
||||
raintpl::configure( 'path_replace', false);
|
||||
|
@ -15,6 +18,7 @@ $tpl->assign("title", $title);
|
|||
$tpl->draw("header");
|
||||
|
||||
if(isset($_GET['info'])) {
|
||||
$tpl->assign("url_filename", CONFIG_ROOT_URL);
|
||||
$tpl->draw("info");
|
||||
} else {
|
||||
$tpl->draw("upload");
|
||||
|
|
|
@ -2,15 +2,10 @@
|
|||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col l6 s12">
|
||||
<h5 class="white-text">Pomf</h5>
|
||||
<p class="grey-text text-lighten-4">If you need to store files for a longer time, please use <a style="color: #bbdefb" href="http://pomf.se">Pomf.se</a> or wait until Uguu offers longer time.</p>
|
||||
<h5 class="white-text">Limitations</h5>
|
||||
<p class="grey-text text-lighten-4">If you need to store files for a longer time, you can deploy your own version of Uguu, the sources are available on Github.</p>
|
||||
</div>
|
||||
<div class="col l4 offset-l2 s12">
|
||||
<h5 class="white-text">Contact</h5>
|
||||
<ul>
|
||||
<li><a class="grey-text text-lighten-3" href="https://twitter.com/nekunekus">@nekunekus</a></li>
|
||||
<li><a class="grey-text text-lighten-3" href="mailto:neku@pomf.se">neku@pomf.se</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<footer class="page-footer blue-grey darken-1" style="position: absolute; bottom: 0; width: 100%">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col l6 s12">
|
||||
<h5 class="white-text">Pomf</h5>
|
||||
<p class="grey-text text-lighten-4">If you need to store files for a longer time, please use <a style="color: #bbdefb" href="http://pomf.se">Pomf.se</a> or wait until Uguu offers longer time.</p>
|
||||
</div>
|
||||
<div class="col l4 offset-l2 s12">
|
||||
<h5 class="white-text">Contact</h5>
|
||||
<ul>
|
||||
<li><a class="grey-text text-lighten-3" href="https://twitter.com/nekunekus">@nekunekus</a></li>
|
||||
<li><a class="grey-text text-lighten-3" href="mailto:neku@pomf.se">neku@pomf.se</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -4,8 +4,8 @@
|
|||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="Temp file hosting, Up to 150MB for 1 hour.">
|
||||
<title>Uguu.se · {$title}</title>
|
||||
<meta name="description" content="Temp file hosting, up to 150MB.">
|
||||
<title>Uguu · {$title}</title>
|
||||
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon">
|
||||
<!-- materialize -->
|
||||
<link type="text/css" rel="stylesheet" href="css/materialize.min.css" media="screen,projection"/>
|
||||
|
@ -25,15 +25,13 @@
|
|||
<div class="nav-wrapper blue-grey darken-1">
|
||||
<div class="container">
|
||||
<div class="col s12">
|
||||
<a href="/" class="brand-logo">Uguu.se</a>
|
||||
<a href="/" class="brand-logo">Uguu</a>
|
||||
<a href="#" data-activates="mobile-demo" class="button-collapse"><i class="mdi-navigation-menu"></i></a>
|
||||
<ul class="right hide-on-med-and-down">
|
||||
<li><a href="/?info">Info</a></li>
|
||||
<li><a href="https://github.com/nokonoko/uguu">Github</a></li>
|
||||
</ul>
|
||||
<ul class="side-nav" id="mobile-demo">
|
||||
<li><a href="/?info">Info</a></li>
|
||||
<li><a href="https://github.com/nokonoko/uguu">Github</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -3,16 +3,14 @@
|
|||
<div class="col s12">
|
||||
<div class="card-panel blue-grey darken-1">
|
||||
<div class="card-content white-text">
|
||||
<span class="card-title">Info</span>
|
||||
<span class="card-title"><b>Info</b></span>
|
||||
<p>Store any filetype with a size up to 150MB for up to 1 hour.
|
||||
Uguu cares about your privacy and stores NO logs.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you would like to upload using ShareX read <a style="color: #bbdefb" href="https://github.com/ShareX/ShareX/wiki/Custom-Uploader-examples#uguuse">this</a>.<br />
|
||||
To upload using curl or make a tool you can post using:<br />
|
||||
<code>curl -i -F name=test.jpg -F file=@localfile.jpg http://uguu.se/api.php?d=upload</code> (HTML Response)<br />
|
||||
<code>curl -i -F name=test.jpg -F file=@localfile.jpg http://uguu.se/api.php?d=upload-tool</code> (Plain text Response)</p>
|
||||
<code>curl -i -F name=test.jpg -F file=@localfile.jpg {$url_filename}/api.php?d=upload</code> (HTML Response)<br />
|
||||
<code>curl -i -F name=test.jpg -F file=@localfile.jpg {$url_filename}/api.php?d=upload-tool</code> (Plain text Response)</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
<div class="col s12">
|
||||
<div class="card-panel blue-grey darken-1">
|
||||
<div class="card-content white-text">
|
||||
<span class="card-title" style="color: #FF9999"><h3>File uploaded!</h3></span>
|
||||
<p><a href="http://a.uguu.se/{$filename}">http://a.uguu.se/{$filename}</a></p>
|
||||
<span class="card-title" style="color: #00FF99"><h3>File uploaded!</h3></span>
|
||||
<p><a href="{$url_filename}">{$url_filename}</a></p>
|
||||
<p>Your file will be available for download during 24 hours.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<?php
|
||||
require_once "/home/neku/www/page/public/rain/rain.tpl.class.php";
|
||||
require_once "rain/rain.tpl.class.php";
|
||||
raintpl::configure( 'path_replace', false);
|
||||
raintpl::configure( 'tpl_dir', '/home/neku/www/page/public/rain/template/');
|
||||
raintpl::configure( 'cache_dir', '/home/neku/www/page/public/rain/cache/' );
|
||||
raintpl::configure( 'tpl_dir', 'rain/template/');
|
||||
raintpl::configure( 'cache_dir', 'rain/cache/' );
|
||||
$tpl = new RainTPL;
|
||||
$title = "Temp File Hosting";
|
||||
$tpl->assign("title", $title);
|
||||
$tpl->draw("header");
|
||||
$tpl->assign("filename", $n);
|
||||
$tpl->assign("url_filename", CONFIG_ROOT_URL.'/files/'.$n);
|
||||
$tpl->draw("upload-done");
|
||||
$tpl->draw("footer");
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue