Intial revision.
This commit is contained in:
commit
f87492d73e
19 changed files with 607 additions and 0 deletions
34
README
Normal file
34
README
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
___ __ _ __ ___ __ ___ __
|
||||||
|
/ | ____/ /___ ___ (_)___ / |/ /_ _______/ /_/__ \/ /
|
||||||
|
/ /| |/ __ / __ `__ \/ / __ \ / /|_/ / / / / ___/ __ \/ _/ /
|
||||||
|
/ ___ / /_/ / / / / / / / / / / / / / / /_/ / /__/ / / /_//_/
|
||||||
|
/_/ |_\__,_/_/ /_/ /_/_/_/ /_/ /_/ /_/\__,_/\___/_/ /_(_)(_)
|
||||||
|
==================================================================
|
||||||
|
|
||||||
|
About
|
||||||
|
-----
|
||||||
|
|
||||||
|
Admin Much?! is a bad ass PHP back-end system for quickly and easily
|
||||||
|
administering submission-based photo sites running a WordPress front-end.
|
||||||
|
|
||||||
|
Intentions
|
||||||
|
----------
|
||||||
|
|
||||||
|
Hone the system and release it to the masses.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
* WordPress - http://www.wordpress.com
|
||||||
|
|
||||||
|
* PICKLES - http://www.phpwithpickles.org
|
||||||
|
|
||||||
|
Who's using it?
|
||||||
|
---------------
|
||||||
|
|
||||||
|
Sites currently using Admin Much?! include:
|
||||||
|
|
||||||
|
* ParkMuch.com:
|
||||||
|
Photos of Bad Parking Jobs and other Automotive Shortcomings
|
||||||
|
|
||||||
|
* COMING SOON - LitterMuch.com
|
9
TODO
Normal file
9
TODO
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
* Port system to run on the LATEST version of PICKLES.
|
||||||
|
|
||||||
|
* Move all hardcoded / site specific values to the config file.
|
||||||
|
|
||||||
|
* Add better spam detection to the check email script.
|
||||||
|
|
||||||
|
* Build set up scripts possibly automatically downloading WordPress.
|
||||||
|
|
||||||
|
* Add Geocoding support.
|
19
config.xml
Normal file
19
config.xml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<config>
|
||||||
|
<database>
|
||||||
|
<hostname>localhost</hostname>
|
||||||
|
<username>**********</username>
|
||||||
|
<password>**********</password>
|
||||||
|
<database>parkmuch</database>
|
||||||
|
</database>
|
||||||
|
<modules>
|
||||||
|
<display>Smarty</display>
|
||||||
|
</modules>
|
||||||
|
<templates>
|
||||||
|
<main>index.tpl</main>
|
||||||
|
</templates>
|
||||||
|
<admin>
|
||||||
|
<username>**********</username>
|
||||||
|
<password>********************************</password>
|
||||||
|
<salt>**********</salt>
|
||||||
|
</admin>
|
||||||
|
</config>
|
1
incoming/README
Normal file
1
incoming/README
Normal file
|
@ -0,0 +1 @@
|
||||||
|
This is where images that are picked up by the check email script are stored before being promoted.
|
12
modules/admin.php
Normal file
12
modules/admin.php
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class admin extends Module
|
||||||
|
{
|
||||||
|
protected $authentication = true;
|
||||||
|
|
||||||
|
public function __default() {
|
||||||
|
$this->setPublic('messages', $this->db->getArray('SELECT * FROM incoming ORDER BY received_at'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
26
modules/expunge.php
Normal file
26
modules/expunge.php
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class expunge extends admin
|
||||||
|
{
|
||||||
|
public function __default()
|
||||||
|
{
|
||||||
|
$this->db->execute('DELETE FROM incoming WHERE id = "' . $_REQUEST['id'] . '";');
|
||||||
|
|
||||||
|
$path = getcwd() . '/../incoming/' . $_REQUEST['id'] . '/';
|
||||||
|
$files = scandir($path);
|
||||||
|
|
||||||
|
foreach ($files as $file)
|
||||||
|
{
|
||||||
|
if ($file != '.' && $file != '..')
|
||||||
|
{
|
||||||
|
unlink($path . $file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rmdir($path);
|
||||||
|
|
||||||
|
header('Location: /admin');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
18
modules/file.php
Normal file
18
modules/file.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class file extends admin
|
||||||
|
{
|
||||||
|
public function __default()
|
||||||
|
{
|
||||||
|
$path = getcwd() . '/../incoming/' . $_REQUEST['id'] . '/';
|
||||||
|
$files = scandir($path);
|
||||||
|
$file = $path . $files[2];
|
||||||
|
|
||||||
|
header('Content-Type: ' . mime_content_type($file));
|
||||||
|
$handle = fopen($file, 'rb');
|
||||||
|
fpassthru($handle);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
11
modules/home.php
Normal file
11
modules/home.php
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class home extends Module
|
||||||
|
{
|
||||||
|
public function __default()
|
||||||
|
{
|
||||||
|
header('Location: http://parkmuch.com');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
28
modules/message.php
Normal file
28
modules/message.php
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class message extends admin
|
||||||
|
{
|
||||||
|
public function __default()
|
||||||
|
{
|
||||||
|
$message = $this->db->getRow('SELECT * FROM incoming WHERE id = "' . $_REQUEST['id'] . '";');
|
||||||
|
$path = getcwd() . '/../incoming/' . $_REQUEST['id'] . '/';
|
||||||
|
$files = scandir($path);
|
||||||
|
|
||||||
|
foreach ($files as $file)
|
||||||
|
{
|
||||||
|
if ($file != '.' && $file != '..')
|
||||||
|
{
|
||||||
|
$filename = $path . $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$size = @getimagesize($filename);
|
||||||
|
|
||||||
|
$message['attachment'] = $files[2];
|
||||||
|
$message['details'] = $size;
|
||||||
|
|
||||||
|
$this->setPublic('message', $message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
11
modules/post.php
Normal file
11
modules/post.php
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class post extends message
|
||||||
|
{
|
||||||
|
public function __default()
|
||||||
|
{
|
||||||
|
parent::__default();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
61
modules/promote.php
Normal file
61
modules/promote.php
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class promote extends expunge
|
||||||
|
{
|
||||||
|
public function __default()
|
||||||
|
{
|
||||||
|
// Inserts the post into the database as a draft
|
||||||
|
$data = array(
|
||||||
|
'post_author' => '1',
|
||||||
|
'post_date' => date('Y-m-d H:i:s'),
|
||||||
|
'post_date_gmt' => gmdate('Y-m-d H:i:s'),
|
||||||
|
'post_title' => $_REQUEST['title'],
|
||||||
|
'post_status' => 'draft',
|
||||||
|
'post_name' => str_replace(' ' , '-', strtolower($_REQUEST['title'])),
|
||||||
|
'post_modified' => date('Y-m-d H:i:s'),
|
||||||
|
'post_modified_gmt' => gmdate('Y-m-d H:i:s')
|
||||||
|
);
|
||||||
|
|
||||||
|
$id = $this->db->insert('wp_posts', $data);
|
||||||
|
|
||||||
|
// Finds the image and extract the extension
|
||||||
|
$path = getcwd() . '/../incoming/' . $_REQUEST['id'] . '/';
|
||||||
|
$files = scandir($path);
|
||||||
|
|
||||||
|
foreach ($files as $file)
|
||||||
|
{
|
||||||
|
if ($file != '.' && $file != '..')
|
||||||
|
{
|
||||||
|
$filename = $path . $file;
|
||||||
|
$parts = explode('.', $file);
|
||||||
|
end($parts);
|
||||||
|
$extension = current($parts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creates the directory for the image and moves the original
|
||||||
|
$public_path = '/submissions/' . date('Y/m/') . $id . '/';
|
||||||
|
$new_path = getcwd() . $public_path;
|
||||||
|
$original = $new_path . 'original' . $extension;
|
||||||
|
mkdir($new_path, 0777, true);
|
||||||
|
copy($filename, $original);
|
||||||
|
|
||||||
|
// Scales the image down to 500px wide
|
||||||
|
$thumb = new Imagick($original);
|
||||||
|
$thumb->thumbnailImage(500, 500, true);
|
||||||
|
$thumb->writeImage($new_path . 'scaled_500.' . $extension);
|
||||||
|
|
||||||
|
// Updates the post content and marks it as published
|
||||||
|
$data = array(
|
||||||
|
'post_content' => '<img src="http://images.parkmuch.com' . $public_path . 'scaled_500.' . $extension . '" /><br /><br />' . $_REQUEST['content'],
|
||||||
|
'post_status' => 'publish',
|
||||||
|
'guid' => 'http://parkmuch.com/?p=' . $id
|
||||||
|
);
|
||||||
|
$this->db->update('wp_posts', $data, array('ID' => $id));
|
||||||
|
|
||||||
|
// Expunges the data
|
||||||
|
parent::__default();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
43
public/.htaccess
Normal file
43
public/.htaccess
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
# Sets up ETags
|
||||||
|
FileETag MTime Size
|
||||||
|
|
||||||
|
# Sets up the mod_rewrite engine
|
||||||
|
RewriteEngine on
|
||||||
|
|
||||||
|
#RewriteCond %{REQUEST_FILENAME}/$ -f [NC,OR]
|
||||||
|
#RewriteCond %{REQUEST_FILENAME}/$ -d [NC]
|
||||||
|
#RewriteRule .* - [L]
|
||||||
|
|
||||||
|
# Sets the base path (document root)
|
||||||
|
RewriteBase /
|
||||||
|
|
||||||
|
# Strips the trailing slash
|
||||||
|
RewriteRule ^(.+)/$ $1 [R]
|
||||||
|
|
||||||
|
#RewriteCond %{HTTP_HOST} ^(admin).thatgirljen.com$ [NC]
|
||||||
|
#RewriteRule ^(.*)$ http://thatgirljen.com/admin [R=301,L]
|
||||||
|
|
||||||
|
# Strips the preceeding subdomain
|
||||||
|
#RewriteCond %{HTTP_HOST} ^(.+).thatgirljen.com$ [NC]
|
||||||
|
#RewriteRule ^(.*)$ http://thatgirljen.com/$1 [R=301,L]
|
||||||
|
|
||||||
|
# Rewrite Rules for the PICKLES Quaternity
|
||||||
|
RewriteRule ^(template/edit)/([a-z-/]+)$ index.php?module=$1&template=$2 [NC,QSA]
|
||||||
|
RewriteRule ^(weblog)/([0-9]+)$ index.php?module=$1&page=$2 [NC,QSA]
|
||||||
|
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
|
||||||
|
RewriteRule ^([a-z-/]+)/([0-9/]{10})/([a-z-]+)$ index.php?module=$1&date=$2&title=$3 [NC,QSA]
|
||||||
|
RewriteRule ^([a-z-/]+)/([0-9]+)$ index.php?module=$1&id=$2 [NC,QSA]
|
||||||
|
RewriteRule ^([a-z-/]+)$ index.php?module=$1 [NC,QSA]
|
||||||
|
|
||||||
|
# Set up the error documents
|
||||||
|
ErrorDocument 400 /
|
||||||
|
ErrorDocument 401 /
|
||||||
|
ErrorDocument 403 /
|
||||||
|
ErrorDocument 404 /
|
||||||
|
ErrorDocument 500 /
|
||||||
|
|
||||||
|
# Blocks access to .htaccess
|
||||||
|
<Files .htaccess>
|
||||||
|
order allow,deny
|
||||||
|
deny from all
|
||||||
|
</Files>
|
6
public/index.php
Normal file
6
public/index.php
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once 'pickles.php';
|
||||||
|
new Controller();
|
||||||
|
|
||||||
|
?>
|
1
public/submissions/README
Normal file
1
public/submissions/README
Normal file
|
@ -0,0 +1 @@
|
||||||
|
This is where images that are promoted from the upcoming directory are stored.
|
227
scripts/check_mail.php
Normal file
227
scripts/check_mail.php
Normal file
|
@ -0,0 +1,227 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Sets the server name manually as the value isn't present from the CLI
|
||||||
|
$_SERVER['SERVER_NAME'] = 'parkmuch.com';
|
||||||
|
|
||||||
|
$path = '/home/gravityboulevard/domains/images.parkmuch.com/';
|
||||||
|
|
||||||
|
// Sets up our PICKLES environment
|
||||||
|
require '/usr/share/pickles/pickles.php';
|
||||||
|
$config = new Config($path . 'config.xml');
|
||||||
|
$error = new Error();
|
||||||
|
$db = new DB($config, $error);
|
||||||
|
|
||||||
|
Logger::write('check_mail', 'Check mail job has started');
|
||||||
|
|
||||||
|
// Connects to the mail bo
|
||||||
|
$mailbox = imap_open('{mail.parkmuch.com:143/novalidate-cert}INBOX', 'submission@parkmuch.com', '**********');
|
||||||
|
|
||||||
|
// Pulls the number of messages
|
||||||
|
$count = imap_num_msg($mailbox);
|
||||||
|
|
||||||
|
$thin_line = "\n" . '----------------------------------------------------------------' . "\n";
|
||||||
|
$thick_line = "\n" . '================================================================' . "\n";
|
||||||
|
|
||||||
|
$alerted = false;
|
||||||
|
|
||||||
|
// Loops through the messages
|
||||||
|
for ($i = 1; $i <= $count; $i++)
|
||||||
|
{
|
||||||
|
echo "\n" . $thick_line . 'Message ' . $i . ' of ' . $count . ': ' . $thin_line;
|
||||||
|
|
||||||
|
// Pulls information from the message header
|
||||||
|
$header = imap_headerinfo($mailbox, $i);
|
||||||
|
$time = date('Y-m-d H:i:s', strtotime($header->date));
|
||||||
|
$from = $header->fromaddress;
|
||||||
|
$subject = $header->subject;
|
||||||
|
|
||||||
|
// Gets the message structure
|
||||||
|
$structure = imap_fetchstructure($mailbox, $i);
|
||||||
|
|
||||||
|
// Pulls the plain text and HTML message body
|
||||||
|
$message = get_part($mailbox, $i, 'TEXT/PLAIN', $structure);
|
||||||
|
|
||||||
|
// Pulls the attachment if any
|
||||||
|
$attachments = array();
|
||||||
|
if (isset($structure->parts) && count($structure->parts))
|
||||||
|
{
|
||||||
|
$part_count = count($structure->parts);
|
||||||
|
|
||||||
|
for ($j = 0; $j < $part_count; $j++)
|
||||||
|
{
|
||||||
|
if ($structure->parts[$j]->ifdparameters)
|
||||||
|
{
|
||||||
|
foreach ($structure->parts[$j]->dparameters as $object)
|
||||||
|
{
|
||||||
|
if (strtolower($object->attribute) == 'filename')
|
||||||
|
{
|
||||||
|
$attachments[$j]['is_attachment'] = true;
|
||||||
|
$attachments[$j]['filename'] = $object->value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($structure->parts[$j]->ifparameters)
|
||||||
|
{
|
||||||
|
foreach ($structure->parts[$j]->parameters as $object)
|
||||||
|
{
|
||||||
|
if (strtolower($object->attribute) == 'name')
|
||||||
|
{
|
||||||
|
$attachments[$j]['is_attachment'] = true;
|
||||||
|
$attachments[$j]['name'] = $object->value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($attachments[$j]['is_attachment'])
|
||||||
|
{
|
||||||
|
$attachments[$j]['attachment'] = imap_fetchbody($mailbox, $i, $j + 1);
|
||||||
|
|
||||||
|
// 3 = BASE64
|
||||||
|
if ($structure->parts[$j]->encoding == 3)
|
||||||
|
{
|
||||||
|
$attachments[$j]['attachment'] = base64_decode($attachments[$j]['attachment']);
|
||||||
|
}
|
||||||
|
// 4 = QUOTED-PRINTABLE
|
||||||
|
elseif ($structure->parts[$j]->encoding == 4)
|
||||||
|
{
|
||||||
|
$attachments[$j]['attachment'] = quoted_printable_decode($attachments[$j]['attachment']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo 'Time: ' . $time . "\n";
|
||||||
|
echo 'From: ' . $from . "\n";
|
||||||
|
echo 'Subject: ' . $subject;
|
||||||
|
echo $thin_line . 'Message: ' . $thin_line . "\n" . $message;
|
||||||
|
|
||||||
|
if (count($attachments) > 0)
|
||||||
|
{
|
||||||
|
$displayed = false;
|
||||||
|
foreach ($attachments as $attachment)
|
||||||
|
{
|
||||||
|
if ($displayed == false)
|
||||||
|
{
|
||||||
|
echo $thin_line . 'Attachments:';
|
||||||
|
|
||||||
|
$displayed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'sender' => $from,
|
||||||
|
'subject' => $subject,
|
||||||
|
'message' => $message,
|
||||||
|
'received_at' => $time
|
||||||
|
);
|
||||||
|
|
||||||
|
$id = $db->insert('incoming', $data);
|
||||||
|
$incoming_path = $path . 'incoming/' . $id . '/';
|
||||||
|
|
||||||
|
if (!file_exists($incoming_path))
|
||||||
|
{
|
||||||
|
mkdir($incoming_path, 0777, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Places each attachment in the appropriate location
|
||||||
|
file_put_contents($incoming_path . $attachment['filename'], $attachment['attachment']);
|
||||||
|
|
||||||
|
//chmod($incoming_path, 0777);
|
||||||
|
chgrp($incoming_path, 'www-data');
|
||||||
|
chown($incoming_path, 'www-data');
|
||||||
|
|
||||||
|
//chmod($incoming_path . $attachment['filename'], 0777);
|
||||||
|
chgrp($incoming_path . $attachment['filename'], 'www-data');
|
||||||
|
chown($incoming_path . $attachment['filename'], 'www-data');
|
||||||
|
|
||||||
|
echo "\n" . $attachment['name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Marks the message for deletion
|
||||||
|
imap_delete($mailbox, $i);
|
||||||
|
|
||||||
|
// Sends an alert if one hasn't been sent already
|
||||||
|
if ($alerted == false)
|
||||||
|
{
|
||||||
|
mail('8134952668@tmomail.net', 'NEW PARK MUCH?! SUBMISSION', 'Get on that shit!');
|
||||||
|
$alerted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo $thick_line;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Closes the mail box
|
||||||
|
imap_expunge($mailbox);
|
||||||
|
imap_close($mailbox);
|
||||||
|
|
||||||
|
Logger::write('check_mail', 'Check mail job has completed');
|
||||||
|
|
||||||
|
function get_mime_type($structure)
|
||||||
|
{
|
||||||
|
$primary_mime_type = array('TEXT', 'MULTIPART','MESSAGE', 'APPLICATION', 'AUDIO','IMAGE', 'VIDEO', 'OTHER');
|
||||||
|
|
||||||
|
if ($structure->subtype)
|
||||||
|
{
|
||||||
|
return $primary_mime_type[(int)$structure->type] . '/' . $structure->subtype;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'TEXT/PLAIN';
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_part($stream, $msg_number, $mime_type, $structure = false, $part_number = false)
|
||||||
|
{
|
||||||
|
if (!$structure)
|
||||||
|
{
|
||||||
|
$structure = imap_fetchstructure($stream, $msg_number);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($structure)
|
||||||
|
{
|
||||||
|
if ($mime_type == get_mime_type($structure))
|
||||||
|
{
|
||||||
|
if(!$part_number)
|
||||||
|
{
|
||||||
|
$part_number = "1";
|
||||||
|
}
|
||||||
|
|
||||||
|
$text = imap_fetchbody($stream, $msg_number, $part_number);
|
||||||
|
|
||||||
|
if ($structure->encoding == 3)
|
||||||
|
{
|
||||||
|
return imap_base64($text);
|
||||||
|
}
|
||||||
|
elseif ($structure->encoding == 4)
|
||||||
|
{
|
||||||
|
return imap_qprint($text);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Multi-part
|
||||||
|
if($structure->type == 1)
|
||||||
|
{
|
||||||
|
while (list($index, $sub_structure) = each($structure->parts))
|
||||||
|
{
|
||||||
|
if ($part_number)
|
||||||
|
{
|
||||||
|
$prefix = $part_number . '.';
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = get_part($stream, $msg_number, $mime_type, $sub_structure, $prefix . ($index + 1));
|
||||||
|
|
||||||
|
if ($data)
|
||||||
|
{
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
20
templates/admin.tpl
Normal file
20
templates/admin.tpl
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{foreach from=$module.messages item=message name=messages}
|
||||||
|
{if $smarty.foreach.messages.first}
|
||||||
|
<table border="1">
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>From</th>
|
||||||
|
<th>Subject</th>
|
||||||
|
<th>Received At</th>
|
||||||
|
</tr>
|
||||||
|
{/if}
|
||||||
|
<tr>
|
||||||
|
<td><a href="/message/{$message.id}">{$message.id}</a></td>
|
||||||
|
<td>{$message.sender|htmlentities}</td>
|
||||||
|
<td>{$message.subject}</td>
|
||||||
|
<td>{$message.received_at}</td>
|
||||||
|
</tr>
|
||||||
|
{if $smarty.foreach.messages.last}</table>{/if}
|
||||||
|
{foreachelse}
|
||||||
|
<em>No incoming submissions at this time</em>
|
||||||
|
{/foreach}
|
9
templates/index.tpl
Normal file
9
templates/index.tpl
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Park Much?! Admin</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Park Much?! Admin</h1>
|
||||||
|
{include file="$template"}
|
||||||
|
</body>
|
||||||
|
</html>
|
36
templates/message.tpl
Normal file
36
templates/message.tpl
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
{literal}<style>th { text-align: right; vertical-align: top }</style>{/literal}
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>Received At:</th>
|
||||||
|
<td>{$module.message.received_at}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>From:</th>
|
||||||
|
<td>{$module.message.sender|htmlentities}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Subject:</th>
|
||||||
|
<td>{$module.message.subject}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Message:</th>
|
||||||
|
<td>{$module.message.message|nl2br}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Attachment:</th>
|
||||||
|
<td>
|
||||||
|
<a href="/file/{$module.message.id}" target="_blank">{$module.message.attachment}</a>
|
||||||
|
{if $module.message.details !== false}
|
||||||
|
<br />
|
||||||
|
<img src="/file/{$module.message.id}" width="200" />
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<br />
|
||||||
|
<button onclick="if (confirm('Are you sure? Seriously, there\'s no undo')) document.location.href='/expunge/{$module.message.id}';">Expunge</button>
|
||||||
|
<button onclick="document.location.href='/post/{$module.message.id}'">Promote</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
35
templates/post.tpl
Normal file
35
templates/post.tpl
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
{literal}<style>th { text-align: right; vertical-align: top }</style>{/literal}
|
||||||
|
<form method="post" action="/promote" onsubmit="if (!confirm('Did you double-check everything? Are you sure??')) return false;">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>Title:</th>
|
||||||
|
<td><input type="text" name="title" value="{$module.message.subject}" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Content:</th>
|
||||||
|
<td>
|
||||||
|
<textarea name="content" cols="100" rows="10">
|
||||||
|
{$module.message.message}<br /><br />
|
||||||
|
Submitted by {$module.message.sender}
|
||||||
|
</textarea>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Attachment:</th>
|
||||||
|
<td>
|
||||||
|
<a href="/file/{$module.message.id}" target="_blank">{$module.message.attachment}</a>
|
||||||
|
{if $module.message.details !== false}
|
||||||
|
<br />
|
||||||
|
<img src="/file/{$module.message.id}" width="200" />
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<br />
|
||||||
|
<input type="hidden" name="id" value="{$module.message.id}" />
|
||||||
|
<button>Promote!</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
Loading…
Add table
Add a link
Reference in a new issue