Skip to content
This repository
Browse code

more updates

  • Loading branch information...
commit 32d60d4a3f233913898444a3ae5fc0f8f6c3586f 1 parent 939f821
Kieron authored September 06, 2012

Showing 107 changed files with 1,663 additions and 2,796 deletions. Show diff stats Hide diff stats

  1. 0  .gitignore
  2. 0  readme.md
  3. 4  roar/config/database.php
  4. 0  roar/config/strings.php
  5. 35  roar/functions/category.php
  6. 95  roar/functions/discussion.php
  7. 39  roar/functions/forum.php
  8. 8  roar/functions/helpers.php
  9. 5  roar/functions/misc.php
  10. 4  roar/functions/post.php
  11. 0  roar/functions/search.php
  12. 91  roar/functions/topic.php
  13. 4  roar/functions/user.php
  14. 23  roar/language/en_GB/common.php
  15. 29  roar/language/en_GB/metadata.php
  16. 47  roar/language/en_GB/pages.php
  17. 82  roar/language/en_GB/posts.php
  18. 72  roar/language/en_GB/users.php
  19. 0  roar/libraries/date.php
  20. 0  roar/libraries/language.php
  21. 0  roar/libraries/markdown.php
  22. 0  roar/libraries/notify.php
  23. 0  roar/libraries/rss.php
  24. 0  roar/libraries/template.php
  25. 0  roar/libraries/twitter.php
  26. 23  roar/models/category.php
  27. 13  roar/models/discussion.php
  28. 7  roar/models/forum.php
  29. 0  roar/models/post.php
  30. 7  roar/models/topic.php
  31. 0  roar/routes/admin/admin.php
  32. 0  roar/routes/admin/dashboard.php
  33. 0  roar/routes/admin/extend.php
  34. 42  roar/routes/{forum.php → category.php}
  35. 201  roar/routes/discussion.php
  36. 0  roar/routes/filters.php
  37. 5  roar/routes/post.php
  38. 4  roar/routes/profile.php
  39. 25  roar/routes/search.php
  40. 0  roar/routes/sign-in-with-twitter.php
  41. 167  roar/routes/topic.php
  42. 0  roar/views/dashboard.php
  43. 0  roar/views/error/404.php
  44. 0  roar/views/extend/index.php
  45. 0  roar/views/login.php
  46. 0  roar/views/partials/footer.php
  47. 0  roar/views/posts/edit.php
  48. 1  system
  49. 63  system/autoload.php
  50. 112  system/bootstrap.php
  51. 46  system/config.php
  52. 29  system/cookie.php
  53. 31  system/csrf.php
  54. 36  system/database.php
  55. 92  system/database/connection.php
  56. 273  system/database/query.php
  57. 33  system/error.php
  58. 206  system/form.php
  59. 26  system/hash.php
  60. 140  system/helpers.php
  61. 43  system/input.php
  62. 40  system/json.php
  63. 98  system/model.php
  64. 51  system/paginator.php
  65. 13  system/request.php
  66. 138  system/response.php
  67. 58  system/route.php
  68. 100  system/router.php
  69. 11  system/routing/filters.php
  70. 46  system/session.php
  71. 23  system/session/drivers/cookie.php
  72. 36  system/session/drivers/database.php
  73. 43  system/session/drivers/driver.php
  74. 90  system/session/payload.php
  75. 88  system/str.php
  76. 40  system/uri.php
  77. 105  system/validator.php
  78. 39  system/view.php
  79. 88  themes/debug/assets/css/grid.css
  80. 375  themes/debug/assets/css/normalize.css
  81. 261  themes/debug/assets/css/styles.css
  82. 9  themes/debug/assets/img/noun_project_187.svg
  83. 50  themes/debug/assets/img/noun_project_187_inverted.svg
  84. 12  themes/debug/assets/img/noun_project_2780.svg
  85. 18  themes/debug/assets/img/noun_project_421.svg
  86. 44  themes/debug/category.php
  87. 87  themes/debug/discussion.php
  88. 21  themes/debug/discussion_create.php
  89. 42  themes/debug/index.php
  90. 19  themes/debug/login.php
  91. 9  themes/debug/partials/footer.php
  92. 43  themes/debug/partials/header.php
  93. 29  themes/debug/profile.php
  94. 25  themes/debug/register.php
  95. 36  themes/debug/search.php
  96. 0  themes/default/assets/css/styles.css
  97. 0  themes/default/assets/js/roar.js
  98. 28  themes/default/category.php
  99. 14  themes/default/{topic.php → discussion.php}
  100. 6  themes/default/{topic_create.php → discussion_create.php}
  101. 28  themes/default/forum.php
  102. 27  themes/default/index.php
  103. 0  themes/default/login.php
  104. 6  themes/default/partials/header.php
  105. 0  themes/default/profile.php
  106. 0  themes/default/register.php
  107. 0  themes/default/search.php
0  .gitignore 100755 → 100644
File mode changed
0  readme.md 100755 → 100644
Source Rendered
File mode changed
4  roar/config/database.php
@@ -12,8 +12,8 @@
12 12
 			'driver' => 'mysql',
13 13
 			'hostname' => 'localhost',
14 14
 			'username' => 'root',
15  
-			'password' => '',
16  
-			'database' => '',
  15
+			'password' => 'bottle',
  16
+			'database' => 'roar',
17 17
 			'charset' => 'utf8'
18 18
 		)
19 19
 
0  roar/config/strings.php 100755 → 100644
File mode changed
35  roar/functions/category.php
... ...
@@ -0,0 +1,35 @@
  1
+<?php
  2
+
  3
+function categories() {
  4
+	$items = Registry::get('categories');
  5
+
  6
+	if($item = $items->valid()) {	
  7
+		// register single post
  8
+		Registry::set('category', $items->current());
  9
+		
  10
+		// move to next
  11
+		$items->next();
  12
+	}
  13
+
  14
+	return $item;
  15
+}
  16
+
  17
+function category_id() {
  18
+	return Registry::get('category')->id;
  19
+}
  20
+
  21
+function category_title() {
  22
+	return Registry::get('category')->title;
  23
+}
  24
+
  25
+function category_description() {
  26
+	return Registry::get('category')->description;
  27
+}
  28
+
  29
+function category_slug() {
  30
+	return Registry::get('category')->slug;
  31
+}
  32
+
  33
+function category_url() {
  34
+	return base_url() . 'category/' . category_slug();
  35
+}
95  roar/functions/discussion.php
... ...
@@ -0,0 +1,95 @@
  1
+<?php
  2
+
  3
+function discussions() {
  4
+	$items = Registry::get('discussions');
  5
+
  6
+	if($item = $items->valid()) {	
  7
+		// register single post
  8
+		Registry::set('discussion', $items->current());
  9
+		
  10
+		// move to next
  11
+		$items->next();
  12
+	}
  13
+
  14
+	return $item;
  15
+}
  16
+
  17
+function discussion_id() {
  18
+	return Registry::get('discussion')->id;
  19
+}
  20
+
  21
+function discussion_votes() {
  22
+	return Registry::get('discussion')->votes;
  23
+}
  24
+
  25
+function discussion_vote_url() {
  26
+	return base_url() . 'vote/' . discussion_id();
  27
+}
  28
+
  29
+function discussion_replies() {
  30
+	return Registry::get('discussion')->replies;
  31
+}
  32
+
  33
+function discussion_views() {
  34
+	return Registry::get('discussion')->views;
  35
+}
  36
+
  37
+function discussion_unread() {
  38
+	if(Auth::guest()) return false;
  39
+
  40
+	$discussion = Registry::get('discussion');
  41
+
  42
+	if( ! is_null($discussion->viewed)) {
  43
+		return strtotime($discussion->viewed) < strtotime($discussion->lastpost);
  44
+	}
  45
+
  46
+	return true;
  47
+}
  48
+
  49
+function discussion_created_by() {
  50
+	return User::find(Registry::get('discussion')->created_by)->username;
  51
+}
  52
+
  53
+function discussion_created_by_url() {
  54
+	return base_url() . 'profiles/' . discussion_created_by();
  55
+}
  56
+
  57
+function discussion_created() {
  58
+	return Date::format(Registry::get('discussion')->created);
  59
+}
  60
+
  61
+function discussion_lastpost_by() {
  62
+	return User::find(Registry::get('discussion')->lastpost_by)->username;
  63
+}
  64
+
  65
+function discussion_lastpost_by_url() {
  66
+	return base_url() . 'profiles/' . discussion_lastpost_by();
  67
+}
  68
+
  69
+function discussion_lastpost() {
  70
+	return Date::format(Registry::get('discussion')->lastpost);
  71
+}
  72
+
  73
+function discussion_title() {
  74
+	return Registry::get('discussion')->title;
  75
+}
  76
+
  77
+function discussion_description() {
  78
+	return Registry::get('discussion')->description;
  79
+}
  80
+
  81
+function discussion_slug() {
  82
+	return Registry::get('discussion')->slug;
  83
+}
  84
+
  85
+function discussion_url() {
  86
+	return base_url() . 'discussion/' . discussion_slug();
  87
+}
  88
+
  89
+function discussion_create_url() {
  90
+	return base_url() . 'discussion/create';
  91
+}
  92
+
  93
+function discussion_paging() {
  94
+	return Registry::get('paginator');
  95
+}
39  roar/functions/forum.php
... ...
@@ -1,39 +0,0 @@
1  
-<?php
2  
-
3  
-function forums() {
4  
-	$items = Registry::get('forums');
5  
-
6  
-	if($item = $items->valid()) {	
7  
-		// register single post
8  
-		Registry::set('forum', $items->current());
9  
-		
10  
-		// move to next
11  
-		$items->next();
12  
-	}
13  
-
14  
-	return $item;
15  
-}
16  
-
17  
-function forum_name() {
18  
-	return Config::get('settings.forum_name');
19  
-}
20  
-
21  
-function forum_id() {
22  
-	return Registry::get('forum')->id;
23  
-}
24  
-
25  
-function forum_title() {
26  
-	return Registry::get('forum')->title;
27  
-}
28  
-
29  
-function forum_description() {
30  
-	return Registry::get('forum')->description;
31  
-}
32  
-
33  
-function forum_slug() {
34  
-	return Registry::get('forum')->slug;
35  
-}
36  
-
37  
-function forum_url() {
38  
-	return base_url() . 'forum/' . forum_id() . '-' . forum_slug();
39  
-}
8  roar/functions/helpers.php
@@ -22,10 +22,4 @@ function theme_include($file) {
22 22
 	if(is_readable($path = PATH . 'themes' . DS . Config::get('settings.theme') . DS . ltrim($file, '/') . '.php')) {
23 23
 		return require $path;
24 24
 	}
25  
-}
26  
-
27  
-function parse_slug($str) {
28  
-	$parts = explode('-', $str);
29  
-
30  
-	return array(array_shift($parts), implode('-', $parts));
31  
-}
  25
+}
5  roar/functions/misc.php
... ...
@@ -0,0 +1,5 @@
  1
+<?php
  2
+
  3
+function site_name() {
  4
+	return Config::get('settings.site_name');
  5
+}
4  roar/functions/post.php 100755 → 100644
@@ -36,10 +36,10 @@ function post_url() {
36 36
 	$perpage = 10;
37 37
 	$post = Registry::get('post');
38 38
 
39  
-	$count = Post::where('topic', '=', $post->topic)->where('id', '<', post_id())->count();
  39
+	$count = Post::where('discussion', '=', $post->discussion)->where('id', '<', post_id())->count();
40 40
 	$page = ceil(++$count / $perpage);
41 41
 
42  
-	return base_url() . 'topic/' . $post->topic . '-' . $post->slug . '/' . $page . '/#post-' . post_id();
  42
+	return base_url() . 'discussion/' . $post->slug . '/' . $page . '/#post-' . post_id();
43 43
 }
44 44
 
45 45
 function post_user_url() {
0  roar/functions/search.php 100755 → 100644
File mode changed
91  roar/functions/topic.php
... ...
@@ -1,91 +0,0 @@
1  
-<?php
2  
-
3  
-function topics() {
4  
-	$items = Registry::get('topics');
5  
-
6  
-	if($item = $items->valid()) {	
7  
-		// register single post
8  
-		Registry::set('topic', $items->current());
9  
-		
10  
-		// move to next
11  
-		$items->next();
12  
-	}
13  
-
14  
-	return $item;
15  
-}
16  
-
17  
-function topic_id() {
18  
-	return Registry::get('topic')->id;
19  
-}
20  
-
21  
-function topic_votes() {
22  
-	return Registry::get('topic')->votes;
23  
-}
24  
-
25  
-function topic_vote_url() {
26  
-	return base_url() . 'vote/' . topic_id();
27  
-}
28  
-
29  
-function topic_replies() {
30  
-	return Registry::get('topic')->replies;
31  
-}
32  
-
33  
-function topic_views() {
34  
-	return Registry::get('topic')->views;
35  
-}
36  
-
37  
-function topic_created_by() {
38  
-	return User::find(Registry::get('topic')->created_by)->username;
39  
-}
40  
-
41  
-function topic_created_by_url() {
42  
-	return base_url() . 'profiles/' . topic_created_by();
43  
-}
44  
-
45  
-function topic_created() {
46  
-	return Date::format(Registry::get('topic')->created);
47  
-}
48  
-
49  
-function topic_lastpost_by() {
50  
-	return User::find(Registry::get('topic')->lastpost_by)->username;
51  
-}
52  
-
53  
-function topic_lastpost_by_url() {
54  
-	return base_url() . 'profiles/' . topic_lastpost_by();
55  
-}
56  
-
57  
-function topic_lastpost() {
58  
-	return Date::format(Registry::get('topic')->lastpost);
59  
-}
60  
-
61  
-function topic_title() {
62  
-	return Registry::get('topic')->title;
63  
-}
64  
-
65  
-function topic_description() {
66  
-	return Registry::get('topic')->description;
67  
-}
68  
-
69  
-function topic_slug() {
70  
-	return Registry::get('topic')->slug;
71  
-}
72  
-
73  
-function topic_url() {
74  
-	return base_url() . 'topic/' . topic_id() . '-' . topic_slug();
75  
-}
76  
-
77  
-function topic_create_url() {
78  
-	return base_url() . 'topic/create/' . forum_id();
79  
-}
80  
-
81  
-function topic_paging() {
82  
-	return Registry::get('paginator');
83  
-}
84  
-
85  
-function topic_has_tags() {
86  
-	return false;
87  
-}
88  
-
89  
-function topic_tags() {
90  
-	return '';
91  
-}
4  roar/functions/user.php 100755 → 100644
@@ -38,4 +38,8 @@ function user_total_posts() {
38 38
 
39 39
 function user_registered() {
40 40
 	return Date::format(Registry::get('user')->registered);
  41
+}
  42
+
  43
+function user_guest() {
  44
+	return Auth::guest();
41 45
 }
23  roar/language/en_GB/common.php
... ...
@@ -1,23 +0,0 @@
1  
-<?php
2  
-
3  
-return array(
4  
-
5  
-	'manage' => 'Manage',
6  
-	'logout' => 'Logout',
7  
-	'logged_in_as' => 'Logged in as',
8  
-
9  
-	'posts' => 'Posts',
10  
-	'pages' => 'Pages',
11  
-	'users' => 'Users',
12  
-	'metadata' => 'Metadata',
13  
-
14  
-	'status_check' => 'Status check',
15  
-	'found_a_problem' => 'Oh no, we found a problem',
16  
-	'found_some_problems' => 'Oh no, we found some problems',
17  
-	'nice_job' => 'Nice job, keep on going!',
18  
-	'visit_your_site' => 'Visit your site',
19  
-	'show_database_profile' => 'Show database profile',
20  
-	'powered_by_anchor' => 'Powered by Anchor, version ',
21  
-	'make_blogging_beautiful' => 'Make blogging beautiful.'
22  
-
23  
-);
29  roar/language/en_GB/metadata.php
... ...
@@ -1,29 +0,0 @@
1  
-<?php
2  
-
3  
-return array(
4  
-
5  
-	'metadata' => 'Site metadata',
6  
-
7  
-	'sitename' => 'Site name',
8  
-	'sitename_explain' => 'Your site&rsquo;s name.',
9  
-	'sitedescription' => 'Site description',
10  
-	'sitedescription_explain' => 'A short paragraph to describe your site.',
11  
-	'homepage' => 'Home Page',
12  
-	'homepage_explain' => 'Your current home page.',
13  
-	'postspage' => 'Posts Page',
14  
-	'postspage_explain' => 'Your page that will show your posts.',
15  
-	'posts_per_page' => 'Posts per page',
16  
-	'posts_per_page_explain' => 'The number of posts to display per page.',
17  
-	'current_theme' => 'Current theme',
18  
-	'current_theme_explain' => 'Your current theme.',
19  
-	'auto_publish_comments' => 'Auto publish comments',
20  
-	'twitter' => 'Twitter',
21  
-	'twitter_explain' => 'Your twitter account.',
22  
-	'save' => 'Save changes',
23  
-
24  
-	'missing_sitename' => 'You need a site sitename',
25  
-	'missing_sitedescription' => 'You need a site description',
26  
-	'missing_theme' => 'You need a theme',
27  
-	'meta_success_updated' => 'Your metadata has been updated'
28  
-
29  
-);
47  roar/language/en_GB/pages.php
... ...
@@ -1,47 +0,0 @@
1  
-<?php
2  
-
3  
-return array(
4  
-
5  
-	'pages' => 'Pages',
6  
-	'create_page' => 'Create a new page',
7  
-	'no_pages' => 'No pages just yet. Why not write a new one?',
8  
-	'add_page' => 'Add a Page',
9  
-	'editing' => 'Editing',
10  
-	'editing_explain' => 'Some useful links.',
11  
-	'view_page' => 'View this page on your site',
12  
-
13  
-	'name' => 'Name',
14  
-	'name_explain' => 'The name of your page. This gets shown in the navigation.',
15  
-	'title' => 'Title',
16  
-	'title_explain' => 'The title of your page, which gets shown in the <code>&lt;title&gt;</code>.',
17  
-	'slug' => 'Slug',
18  
-	'slug_explain' => 'The slug for your post.',
19  
-	'content' => 'Content',
20  
-	'content_explain' => 'Your page\'s content. Accepts valid HTML.',
21  
-	'redirect_option' => 'This page triggers a redirect to another url',
22  
-	'redirect_url' => 'Redirect Url',
23  
-	'status' => 'Status',
24  
-	'status_explain' => 'Do you want your page to be live (published), pending (draft), or hidden (archived)?',
25  
-
26  
-	'draft' => 'Draft',
27  
-	'archived' => 'Archived',
28  
-	'published' => 'Published',
29  
-
30  
-	'create' => 'Create',
31  
-	'delete' => 'Delete',
32  
-	'save' => 'Save',
33  
-	'return_pages' => 'Return to pages',
34  
-
35  
-	'delete_confirm' => 'Are you sure you would like to delete this page?', 
36  
-	'delete_confirm_submit' => 'Yes, I understand this will be permanently deleted', 
37  
-	'delete_confirm_cancel' => 'No, keep this page',
38  
-
39  
-	'missing_name' => 'Please enter a name',
40  
-	'missing_title' => 'Please enter a title',
41  
-	'duplicate_slug' => 'A pages with the same slug already exists, please change your page slug.',
42  
-	'page_success_created' => 'Your new page has been added',
43  
-	'page_success_updated' => 'Your page has been updated',
44  
-	'page_success_delete' => 'Your page has been deleted',
45  
-	'page_error_delete' => 'Sorry, you can not delete your home page or posts page.'
46  
-
47  
-);
82  roar/language/en_GB/posts.php
... ...
@@ -1,82 +0,0 @@
1  
-<?php
2  
-
3  
-return array(
4  
-
5  
-	'posts' => 'Posts',
6  
-	'create_post' => 'Create a new post',
7  
-	'created' => 'Created',
8  
-	'create' => 'Create',
9  
-	'by' => 'by',
10  
-	'noposts' => 'No posts just yet. Why not write a new one?',
11  
-	'return_posts' => 'Return to posts',
12  
-
13  
-	'add_post' => 'Add a Post',
14  
-	'post' => 'Post',
15  
-	'customise' => 'Customise',
16  
-	'customise_explain' => 'Here, you can customise your posts. This section is optional.',
17  
-	'custom_fields' => 'Custom Fields',
18  
-	'custom_fields_explain' => 'Create custom fields here.',
19  
-	'create_custom_field' => 'Create a custom field',
20  
-	'comments' => 'Comments',
21  
-	'comments_explain' => 'Here, you can moderate your comments.',
22  
-	'no_comments' => 'No comments yet.',
23  
-	'edit_comment' => 'Edit Comment',
24  
-	'edit_comment_explain' => 'Update the comment text here.',
25  
-
26  
-	'publish' => 'Publish',
27  
-	'edit' => 'Edit',
28  
-	'delete' => 'Delete',
29  
-	'save' => 'Save',
30  
-	'label' => 'Label',
31  
-	'key' => 'Key',
32  
-	'editing' => 'Editing',
33  
-	'editing_explain' => 'Some useful links.',
34  
-	'view_post' => 'View this post on your site',
35  
-
36  
-	'draft' => 'Draft',
37  
-	'archived' => 'Archived',
38  
-	'published' => 'Published',
39  
-	'pending' => 'Pending',
40  
-	'spam' => 'Spam',
41  
-	'update' => 'Update',
42  
-	'close' => 'Close',
43  
-
44  
-	'custom_field' => 'Custom Field',
45  
-	'custom_field_explain' => 'Please enter the label and the key for your field.',
46  
-	'missing_label' => 'Please enter a field label',
47  
-	'missing_key' => 'Please enter a field key',
48  
-
49  
-	'title' => 'Title',
50  
-	'title_explain' => 'Your post&rsquo;s title.',
51  
-	'date' => 'Date',
52  
-	'date_explain' => 'The &ldquo;published&rdquo; date for your post. Uses <code><a href="http://php.net/manual/en/function.strtotime.php">strtotime()</a></code>.',
53  
-	'slug' => 'Slug',
54  
-	'slug_explain' => 'The slug for your post.',
55  
-	'description' => 'Description',
56  
-	'description_explain' => 'A brief outline of what your post is about. Used in the RSS feed.',
57  
-	'content' => 'Content',
58  
-	'content_explain' => 'Your post\'s main content. Enjoys a healthy dose of valid HTML.',
59  
-	'status' => 'Status',
60  
-	'status_explain' => 'Statuses: live (published), pending (draft), or hidden (archived).',
61  
-	'allow_comments' => 'Allow Comments',
62  
-	'allow_comments_explain' => 'This will allow users to comment on your posts.',
63  
-	'custom_css' => 'Custom CSS',
64  
-	'custom_css_explain' => 'Custom CSS. Will be wrapped in a <code>&lt;style&gt;</code> block.',
65  
-	'custom_js' => 'Custom JS',
66  
-	'custom_js_explain' => 'Custom Javascript. Will be wrapped in a <code>&lt;script&gt;</code> block.',
67  
-
68  
-	'delete_confirm' => 'Are you sure you would like to delete this post?', 
69  
-	'delete_confirm_submit' => 'Yes, I understand this will be permanently deleted', 
70  
-	'delete_confirm_cancel' => 'No, keep this post',
71  
-
72  
-	'invalid_date' => 'Please enter a valid date.',
73  
-	'missing_title' => 'Please enter a title',
74  
-	'missing_description' => 'Please enter a description',
75  
-	'missing_html' => 'Please enter your html',
76  
-
77  
-	'duplicate_slug' => 'A post with the same slug already exists, please change your post slug.',
78  
-	'post_success_created' => 'Your new post has been added.',
79  
-	'post_success_updated' => 'Your post has been updated.',
80  
-	'post_success_deleted' => 'Your post has been deleted.'
81  
-
82  
-);
72  roar/language/en_GB/users.php
... ...
@@ -1,73 +1,3 @@
1 1
 <?php
2 2
 
3  
-return array(
4  
-
5  
-	'add_user' => 'Add a new user',
6  
-	'recover_password' => 'Recover Password',
7  
-	'users' => 'Users',
8  
-	'create_user' => 'Create a new user',
9  
-	'reset_password' => 'Reset Password',
10  
-	'reset_password_for' => 'Password reset for ',
11  
-	'reset_password_explain' => 'Please enter a new password that you won&rsquo;t forget this time.',
12  
-	'back_to' => 'Back to ',
13  
-
14  
-	// english spelling confusion
15  
-	'log_in' => 'Log in', // verb
16  
-	'login' => 'Login', // noun
17  
-
18  
-	'forgotten_password' => 'Forgotten your password?',
19  
-
20  
-	'recover' => 'Recover',
21  
-	'editing' => 'Editing',
22  
-	'profile' => 'profile',
23  
-
24  
-	'real_name' => 'Real name',
25  
-	'real_name_explain' => 'The user&rsquo;s real name. Used in author bylines (visible to public).',
26  
-	'bio' => 'Biography',
27  
-	'bio_explain' => 'A short biography for your user. Accepts valid HTML.',
28  
-	'status' => 'Status',
29  
-	'inactive' => 'Inactive',
30  
-	'active' => 'Active',
31  
-	'status_explain' => 'If inactive, the user will not be able to log in.',
32  
-	'role' => 'Role',
33  
-	'administrator' => 'Administrator',
34  
-	'editor' => 'Editor',
35  
-	'user' => 'User',
36  
-	'role_explain' => 'The user&rsquo;s role. See <a href="//anchorcms.com/docs/roles">here</a> for more info.',
37  
-	'user_details' => 'User details',
38  
-	'user_details_explain' => 'Create the details for your new user to log in to Anchor.',
39  
-	'username' => 'Username',
40  
-	'username_explain' => 'The desired username. Can be changed later.',
41  
-	'password' => 'Password',
42  
-	'password_blank' => 'Leave blank for no change.',
43  
-	'email' => 'Email',
44  
-	'email_explain' => 'The user&rsquo;s email address. Needed if the user forgets their password.',
45  
-
46  
-	'create' => 'Create',
47  
-	'update' => 'Update',
48  
-	'delete' => 'Delete',
49  
-	'submit' => 'Submit',
50  
-	'return_users' => 'Return to Users',
51  
-
52  
-	'delete_confirm' => 'Are you sure you would like to delete this user?', 
53  
-	'delete_confirm_submit' => 'Yes, I understand this will be permanently deleted', 
54  
-	'delete_confirm_cancel' => 'No, keep this user',
55  
-
56  
-	'username_exists' => 'Username is already being used',
57  
-	'missing_password' => 'Please enter a password',
58  
-	'password_too_short' => 'Your password must be at least %s characters long',
59  
-	'invalid_email' => 'Please enter a valid email address',
60  
-	'missing_name' => 'Please enter a display name',
61  
-	'missing_username' => 'Please enter a username',
62  
-	'user_success_created' => 'A new user has been added',
63  
-	'user_success_updated' => 'User has been updated',
64  
-	'user_success_deleted' => 'User has been deleted',
65  
-	'user_success_password' => 'Your new password has been set. Go and login now!',
66  
-	'user_notice_recover' => 'We have sent you an email to confirm your password change.',
67  
-	'user_email_recover' => 'You have requested to reset your password. To continue follow the link below.',
68  
-	'user_subject_recover' => 'Password Reset',
69  
-	'invalid_account' => 'Account not found',
70  
-	'missing_login_username' => 'Please enter your username',
71  
-	'missing_login_password' => 'Please enter your password'
72  
-
73  
-);
  3
+return array();
0  roar/libraries/date.php 100755 → 100644
File mode changed
0  roar/libraries/language.php 100755 → 100644
File mode changed
0  roar/libraries/markdown.php 100755 → 100644
File mode changed
0  roar/libraries/notify.php 100755 → 100644
File mode changed
0  roar/libraries/rss.php 100755 → 100644
File mode changed
0  roar/libraries/template.php 100755 → 100644
File mode changed
0  roar/libraries/twitter.php 100755 → 100644
File mode changed
23  roar/models/category.php
... ...
@@ -0,0 +1,23 @@
  1
+<?php
  2
+
  3
+class Category extends Model {
  4
+
  5
+	public static $table = 'categories';
  6
+
  7
+	public static function slug($str) {
  8
+		if($itm = static::where('slug', '=', $str)->fetch()) {
  9
+			return new static($itm->id);
  10
+		}
  11
+	}
  12
+
  13
+	public static function dropdown() {
  14
+		$options = array();
  15
+
  16
+		foreach(static::all() as $itm) {
  17
+			$options[$itm->id] = $itm->title;
  18
+		}
  19
+
  20
+		return $options;
  21
+	}
  22
+
  23
+}
13  roar/models/discussion.php
... ...
@@ -0,0 +1,13 @@
  1
+<?php
  2
+
  3
+class Discussion extends Model {
  4
+
  5
+	public static $table = 'discussions';
  6
+
  7
+	public static function slug($str) {
  8
+		if($itm = static::where('slug', '=', $str)->fetch()) {
  9
+			return new static($itm->id);
  10
+		}
  11
+	}
  12
+
  13
+}
7  roar/models/forum.php
... ...
@@ -1,7 +0,0 @@
1  
-<?php
2  
-
3  
-class Forum extends Model {
4  
-
5  
-	public static $table = 'forums';
6  
-
7  
-}
0  roar/models/post.php 100755 → 100644
File mode changed
7  roar/models/topic.php
... ...
@@ -1,7 +0,0 @@
1  
-<?php
2  
-
3  
-class Topic extends Model {
4  
-
5  
-	public static $table = 'topics';
6  
-
7  
-}
0  roar/routes/admin/admin.php 100755 → 100644
File mode changed
0  roar/routes/admin/dashboard.php 100755 → 100644
File mode changed
0  roar/routes/admin/extend.php 100755 → 100644
File mode changed
42  roar/routes/forum.php → roar/routes/category.php
@@ -3,37 +3,55 @@
3 3
 /*
4 4
 	View Index
5 5
 */
6  
-Route::get('/', function() {
7  
-	Registry::set('forums', new Items(Forum::all()));
  6
+Route::get(array('/', '/(:any)'), function($page = 1) {
  7
+	Registry::set('categories', new Items(Category::all()));
  8
+
  9
+	$user = Auth::user();
  10
+	$perpage = 10;
  11
+
  12
+	$query = Query::table(Discussion::$table);
  13
+	$get = array('discussions.*');
  14
+
  15
+	if($user) {
  16
+		$get[] = 'user_discussions.viewed';
  17
+
  18
+		$query->left_join('user_discussions', 'user_discussions.discussion', '=', 'discussions.id')
  19
+			->where('user_discussions.user', '=', $user->id)
  20
+			->or_where_is_null('user_discussions.user');
  21
+	}
  22
+
  23
+	$discussions = $query->take($perpage)->skip(--$page * $perpage)
  24
+			->order_by('votes', 'desc')->order_by('lastpost', 'desc')
  25
+			->get($get);
  26
+
  27
+	Registry::set('discussions', new Items($discussions));
8 28
 	
9 29
 	return new Template('index');
10 30
 });
11 31
 
12 32
 /*
13  
-	View forum
  33
+	View category
14 34
 */
15  
-Route::get(array('forum/(:any)', 'forum/(:any)/(:num)'), function($slug, $page = 1) {
16  
-
17  
-	list($id, $slug) = parse_slug($slug);
18  
-
19  
-	if( ! $forum = Forum::find($id)) {
  35
+Route::get(array('category/(:any)', 'category/(:any)/(:num)'), function($slug, $page = 1) {
  36
+	if( ! $category = Category::slug($slug)) {
20 37
 		return Response::error(404);
21 38
 	}
22 39
 
23  
-	Registry::set('forum', $forum);
  40
+	Registry::set('categories', new Items(Category::all()));
  41
+	Registry::set('category', $category);
24 42
 	
25 43
 	$perpage = 10;
26 44
 
27  
-	$topics = Topic::where('forum', '=', $forum->id)
  45
+	$discussions = Discussion::where('category', '=', $category->id)
28 46
 		->order_by('votes', 'desc')
29 47
 		->order_by('lastpost', 'desc')
30 48
 		->take($perpage)
31 49
 		->skip(--$page * $perpage)
32 50
 		->get();
33 51
 		
34  
-	Registry::set('topics', new Items($topics));
  52
+	Registry::set('discussions', new Items($discussions));
35 53
 	
36  
-	return new Template('forum');
  54
+	return new Template('category');
37 55
 });
38 56
 
39 57
 /*
201  roar/routes/discussion.php
... ...
@@ -0,0 +1,201 @@
  1
+<?php
  2
+
  3
+/*
  4
+	Create topic
  5
+*/
  6
+Route::get('discussion/create', array('before' => 'auth-user', 'do' => function() {
  7
+	Registry::set('categories', new Items(Category::all()));
  8
+	$vars['categories'] = Category::dropdown();
  9
+	return new Template('discussion_create', $vars);
  10
+}));
  11
+
  12
+Route::post('discussion/create', array('before' => 'auth-user', 'do' => function() {
  13
+	$markdown = new Markdown;
  14
+	$post = $markdown->transform(Input::get('post'));
  15
+
  16
+	$category = Input::get('category');
  17
+	$title = Input::get('title');
  18
+	$description = Input::get('description');
  19
+
  20
+	$slug = Str::slug($title);
  21
+	$now = date('c');
  22
+
  23
+	if(Discussion::slug($slug)) {
  24
+		Input::flash();
  25
+
  26
+		Notify::notice('Discussion already exists');
  27
+
  28
+		return Response::redirect('discussion/create');
  29
+	}
  30
+
  31
+	// get authed user
  32
+	$user = User::find(Auth::user()->id);
  33
+
  34
+	$id = Discussion::create(array(
  35
+		'category' => $category,
  36
+		'slug' => $slug,
  37
+
  38
+		'created_by' => $user->id,
  39
+		'lastpost_by' => $user->id,
  40
+
  41
+		'created' => $now,
  42
+		'lastpost' => $now,
  43
+
  44
+		'replies' => 1,
  45
+
  46
+		'title' => $title,
  47
+		'description' => $description
  48
+	));
  49
+
  50
+	Post::create(array(
  51
+		'discussion' => $id,
  52
+		'user' => $user->id,
  53
+		'date' => $now,
  54
+		'body' => $post
  55
+	));
  56
+
  57
+	// increment user post count
  58
+	$user->posts += 1;
  59
+	$user->save();
  60
+
  61
+	return Response::redirect('discussion/' . $slug);
  62
+}));
  63
+
  64
+/*
  65
+	View discussion
  66
+*/
  67
+Route::get(array('discussion/(:any)', 'discussion/(:any)/(:num)'), function($slug, $page = 1) {
  68
+	if( ! $discussion = Discussion::slug($slug)) {
  69
+		return Response::error(404);
  70
+	}
  71
+
  72
+	// get session for logged in users
  73
+	$user = Auth::user();
  74
+
  75
+	// increment view count
  76
+	$discussion->views += 1;
  77
+	$discussion->save();
  78
+
  79
+	// mark discussion viewed or set the viewed date
  80
+	if($user) {
  81
+		$query = Query::table('user_discussions')->where('user', '=', $user->id)->where('discussion', '=', $discussion->id);
  82
+
  83
+		if($query->count()) {
  84
+			$query->update(array(
  85
+				'viewed' => date('c')
  86
+			));
  87
+		}
  88
+		else {
  89
+			$query->insert(array(
  90
+				'user' => $user->id,
  91
+				'discussion' => $discussion->id,
  92
+				'viewed' => date('c')
  93
+			));
  94
+		}
  95
+	}
  96
+
  97
+	// paginate posts
  98
+	$perpage = 10;
  99
+
  100
+	$query = Post::where('discussion', '=', $discussion->id);
  101
+	$count = $query->count();
  102
+	$posts = $query->order_by('date')->take($perpage)->skip(($page - 1) * $perpage)->get();
  103
+
  104
+	$url = Uri::make('discussion/' . $discussion->slug);
  105
+	$paginator = new Paginator($posts, $count, $page, $perpage, $url);
  106
+
  107
+	// set data for theme functions
  108
+	Registry::set('categories', new Items(Category::all()));
  109
+	Registry::set('discussion', $discussion);
  110
+	Registry::set('category', Category::find($discussion->category));
  111
+	Registry::set('posts', new Items($paginator->results));
  112
+	Registry::set('paginator', $paginator->links());
  113
+	
  114
+	return new Template('discussion');
  115
+});
  116
+
  117
+/*
  118
+	Post a reply
  119
+*/
  120
+Route::post('discussion/(:any)', array('before' => 'auth-user', 'do' => function($slug) {
  121
+	if( ! $discussion = Discussion::slug($slug)) {
  122
+		return Response::error(404);
  123
+	}
  124
+
  125
+	$reply = Input::get('reply');
  126
+
  127
+	if(empty($reply)) {
  128
+		Notify::error('Please enter your reply');
  129
+
  130
+		// get last page
  131
+		$perpage = 10;
  132
+		$count = Post::where('discussion', '=', $discussion->id)->count();
  133
+		$page = ceil($count / $perpage);
  134
+
  135
+		return Response::redirect('discussion/' . $discussion->slug . '/' . $page);
  136
+	}
  137
+
  138
+	$markdown = new Markdown;
  139
+	$reply = $markdown->transform($reply);
  140
+
  141
+	// get authed user
  142
+	$user = User::find(Auth::user()->id);
  143
+
  144
+	$now = date('c');
  145
+
  146
+	$id = Post::create(array(
  147
+		'discussion' => $discussion->id,
  148
+		'user' => $user->id,
  149
+		'date' => $now,
  150
+		'body' => $reply
  151
+	));
  152
+
  153
+	// set last post info
  154
+	$discussion->lastpost_by = $user->id;
  155
+	$discussion->lastpost = $now;
  156
+
  157
+	// increment reply count
  158
+	$discussion->replies += 1;
  159
+
  160
+	// update discussion
  161
+	$discussion->save();
  162
+
  163
+	// increment user post count
  164
+	$user->posts += 1;
  165
+	$user->save();
  166
+
  167
+	// get last page
  168
+	$perpage = 10;
  169
+	$count = Post::where('discussion', '=', $discussion->id)->count();
  170
+	$page = ceil($count / $perpage);
  171
+
  172
+	return Response::redirect('discussion/' . $discussion->slug . '/' . $page . '#post-' . $id);
  173
+}));
  174
+
  175
+/*
  176
+	Up Vote a discussion
  177
+*/
  178
+Route::get('vote/(:num)', array('before' => 'auth-user', 'do' => function($id) {
  179
+	if( ! $discussion = Discussion::find($id)) {
  180
+		return Response::error(404);
  181
+	}
  182
+
  183
+	// get authed user
  184
+	$user = Auth::user();
  185
+	$voted = Query::table('user_votes')->where('user', '=', $user->id)->where('discussion', '=', $discussion->id)->count();
  186
+
  187
+	// check if user hasnt voted
  188
+	if( ! $voted) {
  189
+		// increment votes
  190
+		$discussion->votes += 1;
  191
+		$discussion->save();
  192
+
  193
+		// add user to votes to stop users voting multiple times
  194
+		Query::table('user_votes')->insert(array('user' => $user->id, 'discussion' => $discussion->id));
  195
+	}
  196
+	else {
  197
+		Notify::notice('You have already voted on this discussion');
  198
+	}
  199
+
  200
+	return Response::redirect('discussion/' . $discussion->slug);
  201
+}));
0  roar/routes/filters.php 100755 → 100644
File mode changed
5  roar/routes/post.php
@@ -24,10 +24,11 @@
24 24
 
25 25
 	$perpage = 10;
26 26
 
27  
-	$count = Post::where('topic', '=', $post->topic)->where('id', '<', $post->id)->count();
  27
+	$count = Post::where('discussion', '=', $post->discussion)->where('id', '<', $post->id)->count();
28 28
 	$page = ceil(++$count / $perpage);
29 29
 
30  
-	$uri = 'topic/' . $post->topic . '-' . $post->slug . '/' . $page;
  30
+	$slug = Discussion::find($post->discussion)->slug;
  31
+	$uri = 'discussion/' . $slug . '/' . $page;
31 32
 
32 33
 	return Response::redirect($uri);
33 34
 }));
4  roar/routes/profile.php
@@ -10,10 +10,10 @@
10 10
 
11 11
 	// get last 4 posts
12 12
 	$posts = Post::where('user', '=', $user->id)
13  
-		->join('topics', 'topics.id', '=', 'posts.topic')
  13
+		->join('discussions', 'discussions.id', '=', 'posts.discussion')
14 14
 		->order_by('date', 'desc')
15 15
 		->take(4)
16  
-		->get(array('posts.*', 'topics.slug', 'topics.title'));
  16
+		->get(array('posts.*', 'discussions.slug', 'discussions.title'));
17 17
 
18 18
 	Registry::set('user', $user);
19 19
 	
25  roar/routes/search.php
@@ -46,22 +46,21 @@
46 46
 
47 47
 	$perpage = 10;
48 48
 
49  
-	$sql = 'select posts.*, topics.title, topics.slug from posts 
50  
-		join topics on (topics.id = posts.topic) 
51  
-		where posts.id in (' . implode(',', $results) . ')
52  
-		limit ' . $perpage . ' offset ' . (($page - 1) * $perpage);
53  
-
54  
-	$query = DB::query($sql);
55  
-
56  
-	$sql = 'select count(*) from posts 
57  
-		join topics on (topics.id = posts.topic) 
58  
-		where posts.id in (' . implode(',', $results) . ')';
59  
-
60  
-	$count = DB::query($sql);
  49
+	$posts = Query::table('posts')
  50
+		->join('discussions', 'discussions.id', '=', 'posts.discussion')
  51
+		->where_in('posts.id', $results)
  52
+		->take($perpage)
  53
+		->skip(($page - 1) * $perpage)
  54
+		->get(array('posts.*', 'discussions.title', 'discussions.slug'));
  55
+
  56
+	$count = Query::table('posts')
  57
+		->join('discussions', 'discussions.id', '=', 'posts.discussion')
  58
+		->where_in('posts.id', $results)
  59
+		->count();
61 60
 
62 61
 	$url = Uri::make('search/' . $id);
63 62
 
64  
-	$paginator = new Paginator($query->fetchAll(), $count->fetchColumn(), $page, $perpage, $url);
  63
+	$paginator = new Paginator($posts, $count, $page, $perpage, $url);
65 64
 
66 65
 	Registry::set('search_results', new Items($paginator->results));
67 66
 
0  roar/routes/sign-in-with-twitter.php 100755 → 100644
File mode changed
167  roar/routes/topic.php
... ...
@@ -1,167 +0,0 @@
1  
-<?php
2  
-
3  
-/*
4  
-	Create topic
5  
-*/
6  
-Route::get('topic/create/(:num)', array('before' => 'auth-user', 'do' => function($id) {
7  
-	if( ! $forum = Forum::find($id)) {
8  
-		return Response::error(404);
9  
-	}
10  
-
11  
-	Registry::set('forum', $forum);
12  
-
13  
-	return new Template('topic_create');
14  
-}));
15  
-
16  
-Route::post('topic/create/(:num)', array('before' => 'auth-user', 'do' => function($id) {
17  
-	if( ! $forum = Forum::find($id)) {
18  
-		return Response::error(404);
19  
-	}
20  
-
21  
-	$markdown = new Markdown;
22  
-	$post = $markdown->transform(Input::get('post'));
23  
-
24  
-	$title = Input::get('title');
25  
-	$description = Input::get('description');
26  
-
27  
-	$slug = Str::slug($title);
28  
-	$now = date('c');
29  
-
30  
-	// get authed user
31  
-	$user = User::find(Auth::user()->id);
32  
-
33  
-	$id = Topic::create(array(
34  
-		'forum' => $forum->id,
35  
-		'slug' => $slug,
36  
-
37  
-		'created_by' => $user->id,
38  
-		'lastpost_by' => $user->id,
39  
-
40  
-		'created' => $now,
41  
-		'lastpost' => $now,
42  
-
43  
-		'replies' => 1,
44  
-
45  
-		'title' => $title,
46  
-		'description' => $description
47  
-	));
48  
-
49  
-	Post::create(array(
50  
-		'topic' => $id,
51  
-		'user' => $user->id,
52  
-		'date' => $now,
53  
-		'body' => $post
54  
-	));
55  
-
56  
-	// increment user post count
57  
-	$user->posts += 1;
58  
-	$user->save();
59  
-
60  
-	return Response::redirect('topic/' . $id . '-' . $slug);
61  
-}));
62  
-
63  
-/*
64  
-	View topic
65  
-*/
66  
-Route::get(array('topic/(:any)', 'topic/(:any)/(:num)'), function($slug, $page = 1) {
67  
-
68  
-	list($id, $slug) = parse_slug($slug);
69  
-
70  
-	if( ! $topic = Topic::find($id)) {
71  
-		return Response::error(404);
72  
-	}
73  
-
74  
-	// increment view count
75  
-	$topic->views += 1;
76  
-	$topic->save();
77  
-
78  
-	// paginate posts
79  
-	$perpage = 10;
80  
-
81  
-	$query = Post::where('topic', '=', $topic->id);
82  
-	$count = $query->count();
83  
-	$posts = $query->order_by('date')->take($perpage)->skip(($page - 1) * $perpage)->get();
84  
-
85  
-	$url = Uri::make('topic/' . $topic->id . '-' . $topic->slug);
86  
-	$paginator = new Paginator($posts, $count, $page, $perpage, $url);
87  
-
88  
-	// set data for theme functions
89  
-	Registry::set('topic', $topic);
90  
-	Registry::set('forum', Forum::find($topic->forum));
91  
-	Registry::set('posts', new Items($paginator->results));
92  
-	Registry::set('paginator', $paginator->links());
93  
-	
94  
-	return new Template('topic');
95  
-});
96  
-
97  
-/*
98  
-	Post a reply
99  
-*/
100  
-Route::post('topic/(:any)', array('before' => 'auth-user', 'do' => function($slug) {
101  
-
102  
-	list($id, $slug) = parse_slug($slug);
103  
-
104  
-	if( ! $topic = Topic::find($id)) {
105