From e121bbebe3ccd990b66a7b04289adf481a4aa2af Mon Sep 17 00:00:00 2001
From: Jesse Morgan
Date: Tue, 30 Aug 2011 12:29:19 -0700
Subject: Working on the moderation schedule iterator
---
htdocs/moderate/schedule/editor.php | 144 ++++++++++++++++++++++++++++++++++++
1 file changed, 144 insertions(+)
create mode 100644 htdocs/moderate/schedule/editor.php
(limited to 'htdocs/moderate/schedule/editor.php')
diff --git a/htdocs/moderate/schedule/editor.php b/htdocs/moderate/schedule/editor.php
new file mode 100644
index 0000000..fe715f7
--- /dev/null
+++ b/htdocs/moderate/schedule/editor.php
@@ -0,0 +1,144 @@
+
+ *
+ */
+
+require_once('../../src/base.inc.php');
+
+// Verify User is admin
+if (!isset($_SESSION['currentUser']) or !$_SESSION['currentUser']->isAdmin()) {
+ header('Location: ' . buildUrl('moderate/'));
+ exit;
+}
+
+$error = '';
+
+// Get the current user object.
+$user = new User();
+if (isset($_GET['id']) and is_numeric($_GET['id'])) {
+ $user = User::getById($_GET['id']);
+}
+
+// Save changes?
+if ($_SERVER['REQUEST_METHOD'] == 'POST') {
+ // Name
+ if (isset($_POST['name']) and trim($_POST['name']) != '') {
+ $user->setName($_POST['name']);
+
+ } else {
+ $error .= 'Name is a required field.
';
+ }
+
+ // Email
+ if (isset($_POST['email']) and trim($_POST['email']) != '') {
+ $user->setEmail($_POST['email']);
+
+ } else {
+ $error .= 'Email is a required field.
';
+ }
+
+ // Source
+ if (isset($_POST['source']) and trim($_POST['source']) != '') {
+ $user->setSource($_POST['source']);
+
+ } else {
+ $error .= 'Source is a required field.
';
+ }
+
+ // Set Admin
+ $admin = isset($_POST['admin']) and $_POST['admin'] == '1';
+ $user->setAdmin($admin);
+
+ // Set Notify
+ $notify = isset($_POST['notify']) and $_POST['notify'] == '1';
+ $user->setNotify($notify);
+
+ // Send new password
+ if (isset($_POST['newpass']) and $_POST['newpass'] == '1') {
+ $user->sendNewPassword();
+ }
+
+ // Save the user
+ if ($error == '') {
+ if ($user->save()) {
+ // Return to users list
+ header("Location: index.php");
+
+ } else {
+ $error .= 'An error has occured.
';
+ }
+ }
+}
+
+require_once('../src/header.inc.php');
+
+echo "Edit User
";
+
+if ($error != '') {
+ echo "$error
";
+}
+
+$url = "editor.php";
+
+if (isset($_GET['id'])) {
+ $url .= '?id=' . $_GET['id'];
+}
+
+echo "
";
+ }
+?>
+
+
+
+Cancel
+
+
+
+
+
+";
+
+ foreach(Source::getSources() as $source) {
+ if ($source->getId() == $select) {
+ echo "";
+
+ } else {
+ echo "";
+ }
+ }
+
+ echo "";
+}
+
+require_once('../src/footer.inc.php');
+
+?>
+
--
cgit v1.2.3