diff --git a/admin.php b/admin.php index 11abc6b..10f7d7d 100644 --- a/admin.php +++ b/admin.php @@ -9,8 +9,8 @@ foreach (glob('components/admin/*.php') as $file) include_once 'components/head.php'; if (!isset($_SESSION['role_id'])) - header('Location: user.php'); -else if ($_SESSION['role_id'] >= 3) + header('Location: user.php?view=login'); +else if ($_SESSION['role_id'] >= contributor) header('Location: user.php?action=view&user_id=' . $_SESSION['user_id']); include_once 'functions/admin_functions.php'; diff --git a/articles.php b/articles.php index e0b50b5..261f097 100644 --- a/articles.php +++ b/articles.php @@ -76,7 +76,7 @@ switch ($view) { break; } -if (($view == 'list' || $view == 'sort') && (isset($_SESSION['role_id']) && $_SESSION['role_id'] <= 3)) { +if (($view == 'list' || $view == 'sort') && (isset($_SESSION['role_id']) && $_SESSION['role_id'] <= contributor)) { echo '
diff --git a/components/admin/article_view.php b/components/admin/article_view.php index 88c1c9a..cb201e8 100644 --- a/components/admin/article_view.php +++ b/components/admin/article_view.php @@ -1,16 +1,16 @@ -
+

Articles

View Users
-
+
'; - return $display; + return $display; } diff --git a/components/admin/user_view.php b/components/admin/user_view.php index 665294a..f4a58a6 100644 --- a/components/admin/user_view.php +++ b/components/admin/user_view.php @@ -1,16 +1,16 @@ -
+
-
+
'; - return $display; + return $display; } diff --git a/components/article/article.php b/components/article/article.php index c1880df..78dd10d 100644 --- a/components/article/article.php +++ b/components/article/article.php @@ -17,12 +17,12 @@ function article_page_from_markdown($article_id) $html = '
-
+

' . $article['title'] . '

' . (isset($_SESSION['user_id']) && $_SESSION['user_id'] == $article['author_id'] ? '' : '') . '
-
-
+
+
Written by ' . $author['username'] . '

Published on ' . $article['published_at'] . '
diff --git a/components/article/card.php b/components/article/card.php index 0609998..e403915 100644 --- a/components/article/card.php +++ b/components/article/card.php @@ -23,7 +23,7 @@ function article_card($article_id) $card = '

-
+

' . $article['title'] . '

@@ -38,7 +38,7 @@ function article_card($article_id)

' . $article['excerpt'] . '

-
+
Read More
' . $tags_html . '
diff --git a/components/article/list.php b/components/article/list.php index 962fd8a..39b9bb1 100644 --- a/components/article/list.php +++ b/components/article/list.php @@ -5,7 +5,7 @@ function article_list($list = null) $filters = '
-
+
'; if (!isset($_GET['sort']) || $_GET['sort'] == 'newest') { diff --git a/components/foot.php b/components/foot.php index 7703e35..e16c808 100644 --- a/components/foot.php +++ b/components/foot.php @@ -24,27 +24,27 @@ if (isset($args['view'])) { if ($args['view'] == 'signup') { echo ' - - - '; + + + '; } else if ($args['view'] == 'display') { echo ' - - - '; + + + '; } } } else if ($_SERVER['SCRIPT_NAME'] == '/admin.php') { echo ' - - '; + +'; $args = get_args_from_url(); if (isset($args['view'])) { if ($args['view'] == 'users') { echo ' - - '; + + '; } } } else if ($_SERVER['SCRIPT_NAME'] == '/articles.php') { @@ -53,15 +53,17 @@ if (isset($args['view'])) { if ($args['view'] == 'compose') { echo ' - - '; + + '; } } + } else if ($_SERVER['SCRIPT_NAME'] == '/todo.php') { + echo ''; } echo ' - - '; + +'; ?> diff --git a/components/head.php b/components/head.php index 41fd79c..5f00ff6 100644 --- a/components/head.php +++ b/components/head.php @@ -3,6 +3,7 @@ + -
+
+ '; + + return $actions; +} diff --git a/components/todo/category.php b/components/todo/category.php new file mode 100644 index 0000000..2fbd456 --- /dev/null +++ b/components/todo/category.php @@ -0,0 +1,13 @@ + +

' . ucwords($category) . '

+
+ ' . todo_list($todos) . ' +
+ '; + + return $category; +} diff --git a/components/todo/display.php b/components/todo/display.php new file mode 100644 index 0000000..3969013 --- /dev/null +++ b/components/todo/display.php @@ -0,0 +1,66 @@ +fetch_assoc()) + $categories[$row['category']][] = $row; + + foreach ($categories as $c) + uasort($c, 'sort_by_completion'); + + $display = ' +
+ ' . todo_actions() . ' +
+ '; + + foreach ($categories as $c) + $c = array_reverse($c); + + foreach (array_keys($categories) as $key) + $display .= todo_category($key, $categories[$key]); + + $display .= ' +
+
+ '; + + return $display; +} diff --git a/components/todo/item.php b/components/todo/item.php new file mode 100644 index 0000000..4e0af1e --- /dev/null +++ b/components/todo/item.php @@ -0,0 +1,28 @@ + +
+
+ +
+
+ ' . $todo['task'] . ' +
+
+
+ + + '; + + return $item; +} diff --git a/components/todo/list.php b/components/todo/list.php new file mode 100644 index 0000000..3d56982 --- /dev/null +++ b/components/todo/list.php @@ -0,0 +1,17 @@ + + '; + + foreach ($todos as $todo) + $list .= todo_item($todo); + + $list .= ' +
+ '; + + return $list; +} diff --git a/components/todo/modal.php b/components/todo/modal.php new file mode 100644 index 0000000..c1ca647 --- /dev/null +++ b/components/todo/modal.php @@ -0,0 +1,2 @@ + -
-
+
+

' . $user['username'] . '

'; - if ($_SESSION['user_id'] != $user_id && !$following) { + if ($_SESSION['user_id'] != $user_id && isset($following) && !$following) { $view .= '
'; - } else if ($following) { + } else if (isset($following) && $following) { $view .= '
@@ -55,7 +55,7 @@ function user_view($user_id) // TODO: Allow user to update profile picture. // // - if ((isset($_SESSION['user_id']) && $_SESSION['user_id'] == $user_id) || (isset($_SESSION['role_id']) && $_SESSION['role_id'] <= 2)) { + if ((isset($_SESSION['user_id']) && $_SESSION['user_id'] == $user_id) || (isset($_SESSION['role_id']) && $_SESSION['role_id'] <= admin)) { $view .= '

User Actions