Skip to content

Commit

Permalink
pollish
Browse files Browse the repository at this point in the history
  • Loading branch information
fenimore committed Nov 18, 2015
1 parent 545726b commit dd77bc4
Show file tree
Hide file tree
Showing 15 changed files with 125 additions and 82 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ for file in *.JPG; do
mv "$file" "`basename $file .JPG`.jpg"
done
```
Uploading through php can be a bit slow (this can be changed by configuring the server php init file). Using a FTP client might be much faster.


###TODO
- Errors
- add pgn/gif support
- Genre/Subfolders
- select for directory uploads
- select input for directory uploads
- Not really safe, is it?
- make uploads and deletion/creation directories safe
12 changes: 6 additions & 6 deletions admin.php → auth/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="style.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen"/>
</head>
<body>

<div class="container">
<div class="row">
<div class="row" style="margin-top:10%">
<div class="col-md-4">
<h1>Create Directory</h1>
<form action="create.php" method="post">
<form action="../rest/create.php" method="post">
<label for="dirname">Directory name: </label>
<input class="form-control" type="text" name="dirname">
<br>
Expand All @@ -39,7 +39,7 @@
</div>
<div class="col-md-4">
<h1>Upload</h1>
<form action="upload.php" method="post" enctype="multipart/form-data">
<form action="../rest/upload.php" method="post" enctype="multipart/form-data">
<label for="photos">Select Photographs: </label>
<input class="btn btn-default" type="file" name="files[]" multiple>
<label for="photos">Directory: </label>
Expand All @@ -50,7 +50,7 @@
</div>
<div class="col-md-4">
<h1>Delete Directory</h1>
<form action="delete.php" method="post">
<form action="../rest/delete.php" method="post">
<label for="dirname">Directory name: </label>
<input class="form-control" type="text" name="dirname">
<br>
Expand All @@ -60,7 +60,7 @@
</div>
<div class="row">
<hr>
<a href=index.php><span class="glyphicon glyphicon-home" aria-hidden="true"></span> Index</a>
<a href=../index.php><span class="glyphicon glyphicon-home" aria-hidden="true"></span> Index</a>
<a href=logout.php><span class="glyphicon glyphicon-road" aria-hidden="true"></span> Logout</a>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion authenticate.php → auth/authenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
session_start();
$_SESSION['loggedin'] = true;
header('Location: admin.php');
//die();
die();
} else {
header('Location: login.php');
echo 'not authenticated';
Expand Down
8 changes: 4 additions & 4 deletions login.php → auth/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="style.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen"/>
</head>
<body>

Expand All @@ -30,16 +30,16 @@
<form class="form-inline" action="authenticate.php" method="post">
<div class=form-group">
<label for="pssword" style="display:none;">Password: </label>
<input class="form-control" type="password" name="password">
<button class="btn btn-default" type="submit">login
<input class="pssword form-control" type="password" name="password" autofocus>
<button class="pssword btn btn-default" type="submit">login
</button>
</div>
</form>
</div>
</div>
<div class="row">
<hr>
<a href=index.php><span class="glyphicon glyphicon-home" aria-hidden="true"></span> Index</a>
<a href=../index.php><span class="glyphicon glyphicon-home" aria-hidden="true"></span> Index</a>
</div>
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion logout.php → auth/logout.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

session_start();
unset($_SESSION["loggedin"]);
header("Location: index.php");
header("Location: ../index.php");

?>
27 changes: 0 additions & 27 deletions create.php

This file was deleted.

5 changes: 5 additions & 0 deletions style.css → css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ a, a:hover {
height: auto;
}

.pssword {
background: transparent;
border: medium 0;
}


.title {
color: #52ADDA;
Expand Down
34 changes: 0 additions & 34 deletions delete.php

This file was deleted.

2 changes: 1 addition & 1 deletion gallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="style.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen"/>
<style>
</style>
</head>
Expand Down
10 changes: 6 additions & 4 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
<title>Wink</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<meta name="description" content="Photo Gallery">
<meta name="keywords" content="PHP, Photography">
<meta name="author" content="Fenimore">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- jQuery library -->
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="style.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen"/>
</head>
<body>

Expand All @@ -28,7 +30,7 @@
echo '<ul class="photo-index list-unstyled">';
foreach($reverted as $gallery) {
$gallery = substr($gallery, 6);
echo '<li><a href=wink.php?gallery='.$gallery.' ><span class="glyphicon glyphicon-th" aria-hidden="true"></span></a> | <a href=gallery.php?gallery='.$gallery.' > '. ucfirst($gallery) .' </a></li>';
echo '<li><a href=thumbnail.php?gallery='.$gallery.' ><span class="glyphicon glyphicon-th" aria-hidden="true"></span></a> | <a href=gallery.php?gallery='.$gallery.' > '. ucfirst($gallery) .' </a></li>';
}
echo '</ul>'
// Add another set of gallery
Expand All @@ -40,7 +42,7 @@

<footer class="footer">
<div class="container">
<p class="text-muted"><a href="http://another.workingagenda.com">Fenimore Love</a> | <a href=login.php><span class="glyphicon glyphicon-cloud-upload" aria-hidden="true"></span></a> | <a href="https://github.com/polypmer/wink">Source Code</a></p>
<p class="text-muted"><a href="http://another.workingagenda.com">Fenimore Love</a> | <a href=auth/login.php><span class="glyphicon glyphicon-cloud-upload" aria-hidden="true"></span></a> | <a href="https://github.com/polypmer/wink">Source Code</a></p>
</div>
</footer>

Expand Down
File renamed without changes.
38 changes: 38 additions & 0 deletions rest/create.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
$directoryerr = "directory already exists";

if ( !empty($_POST) ) {
$dirname = $_POST['dirname'];
$dir = '../media/' . $dirname; // change (carefully) to $path


if(!is_dir($dir)) {
mkdir($dir);
header("Location: ../index.php");
} else {
echo '<script type="text/javascript">alert("'. $directoryerr . '" );</script>';
}
}

?>
<!DOCTYPE html>
<html>
<head>
<title>Wink - Error</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Photo Gallery">
<meta name="keywords" content="PHP, Photography">
<meta name="author" content="Fenimore">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- jQuery library -->
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen"/>
</head>
<body>
<a href="../auth/admin.php">Return to Admin</a>
</body>
</html>
45 changes: 45 additions & 0 deletions rest/delete.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
// errors
$directoryerr = "directory does not exist";

if ( !empty($_POST) ) {
$dirname = $_POST['dirname'];
$path = '../media/' . $dirname;



if(is_dir($path)) {
$files = glob($path . "/*");
foreach($files as $file){
if(is_file($file)){
unlink($file); //delete file
}
}
rmdir($path);
// Flash message?
header("Location: ../index.php");
}
}

?>
<!DOCTYPE html>
<html>
<head>
<title>Wink - Error</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Photo Gallery">
<meta name="keywords" content="PHP, Photography">
<meta name="author" content="Fenimore">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- jQuery library -->
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen"/>
</head>
<body>
<a href="../auth/admin.php">Return to Admin</a>
</body>
</html>
17 changes: 14 additions & 3 deletions upload.php → rest/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
extract($_POST); //What even does this doo...
$dirname = $_POST['dirname'];
$dir = 'media/' . $dirname;
$dir = '../media/' . $dirname;
$extension=array("jpeg","jpg","png","gif");

if( is_dir($dir)) {
Expand All @@ -22,7 +22,7 @@
}
}
}
header("Location: gallery.php?gallery=" . $dirname);
header("Location: ../gallery.php?gallery=" . $dirname);
}
}

Expand All @@ -32,9 +32,20 @@
<head>
<title>Wink - Error</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Photo Gallery">
<meta name="keywords" content="PHP, Photography">
<meta name="author" content="Fenimore">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- jQuery library -->
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen"/>
</head>
<body>
<a href="admin.php">Return to Admin</a>
<a href="../auth/admin.php">Return to Admin</a>
Different kinds of errors:
not jpg (TODO)
too big of file (TODO)
Expand Down
File renamed without changes.

0 comments on commit dd77bc4

Please sign in to comment.