summaryrefslogtreecommitdiff
path: root/htdocs
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2011-08-30 10:37:35 -0700
committerJesse Morgan <jesse@jesterpm.net ; true>2011-08-30 10:37:35 -0700
commit558684e32769d9dbd0d27a6feb3bbb9cf9aa22d7 (patch)
treefe3bb494162e238e59a9a2f1b013dfa317e946b8 /htdocs
parent273112695da89b8d0d6ac54a5f4f068969c0bd70 (diff)
Abstracted source name code and added a source name listing to the moderation index. (Eventum #33).HEADmaster
Diffstat (limited to 'htdocs')
-rw-r--r--htdocs/moderate/index.php5
-rw-r--r--htdocs/postings.php25
-rw-r--r--htdocs/src/Post.inc.php16
3 files changed, 24 insertions, 22 deletions
diff --git a/htdocs/moderate/index.php b/htdocs/moderate/index.php
index 908c43b..7d35eb0 100644
--- a/htdocs/moderate/index.php
+++ b/htdocs/moderate/index.php
@@ -28,12 +28,13 @@ $posts->query();
if ($posts->valid()) {
foreach ($posts as $id => $post) {
printf("<div class=\"post\"><p><a href=\"%s/postings/%s.html?moderate\">%s</a></p>"
- . "%s <a href=\"mailto:%s\">%s</a></div>",
+ . "%s <a href=\"mailto:%s\">%s</a> - %s</div>",
$GLOBALS['CONFIG']['urlroot'],
$id, $post->getName(),
$post->getCreated(),
- $post->getEmail(), $post->getEmail());
+ $post->getEmail(), $post->getEmail(),
+ $post->getSourceName());
}
} else {
diff --git a/htdocs/postings.php b/htdocs/postings.php
index 15d3d5f..0440ab0 100644
--- a/htdocs/postings.php
+++ b/htdocs/postings.php
@@ -49,7 +49,8 @@ if (isset($_SESSION['currentUser'])) {
, $post->getid(), $post->getid());
// Print Source information
- printSourceInfo($post);
+ printf("<p>This post was posted by %s from %s.</p>",
+ $post->getEmail(), $post->getSourceName());
echo "<p><a href=\"../moderate/index.php\">return to moderation</a></p>";
echo "</div>";
@@ -63,7 +64,9 @@ if (isset($_SESSION['currentUser'])) {
. "<a href=\"../moderate/moderate.php?id=%s&action=reject\">reject post</a>",
$post->getid(), $post->getid());
- printSourceInfo($post);
+ // Print source info.
+ printf("<p>This post was posted by %s from %s.</p>",
+ $post->getEmail(), $post->getSourceName());
echo "</div>";
}
@@ -98,24 +101,6 @@ foreach ($post->getImages() as $imgid) {
require_once "src/footer.inc.php";
-function printSourceInfo($post) {
- // Print Source information
- $source = $post->getSource();
-
- if ($source !== false) {
- // Get source from source id
- $sourceObj = Source::getById($source);
- $source = $sourceObj->getName();
-
-
- } else {
- // Get other
- $source = $post->getOtherSource();
- }
-
- printf("<p>This post was posted by %s from %s.</p>",
- $post->getEmail(), $source);
-}
function errorNotFound() {
// Get the 404 page
diff --git a/htdocs/src/Post.inc.php b/htdocs/src/Post.inc.php
index 906778e..eaad6b3 100644
--- a/htdocs/src/Post.inc.php
+++ b/htdocs/src/Post.inc.php
@@ -155,6 +155,22 @@ class Post {
}
}
+ public function getSourceName() {
+ $source = $this->getSource();
+
+ if ($source !== false) {
+ // Get source from source id
+ $sourceObj = Source::getById($source);
+ $source = $sourceObj->getName();
+
+ } else {
+ // Get other
+ $source = "Other: " . $post->getOtherSource();
+ }
+
+ return $source;
+ }
+
public function getOtherSource() {
return $this->info['reason'];
}