Skip to content

Commit 928fa0b

Browse files
committed
Working through the models. Trying to convert everything to laravel 4
1 parent 799fb01 commit 928fa0b

File tree

843 files changed

+181420
-519
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

843 files changed

+181420
-519
lines changed

app/config/app.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@
158158
'File' => 'Illuminate\Support\Facades\File',
159159
'Form' => 'Illuminate\Support\Facades\Form',
160160
'Hash' => 'Illuminate\Support\Facades\Hash',
161-
'HTML' => 'Illuminate\Support\Facades\HTML',
162161
'Input' => 'Illuminate\Support\Facades\Input',
163162
'Lang' => 'Illuminate\Support\Facades\Lang',
164163
'Log' => 'Illuminate\Support\Facades\Log',

app/config/mail.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
|
1616
*/
1717

18-
'driver' => 'smtp',
18+
'driver' => 'mail',
1919

2020
/*
2121
|--------------------------------------------------------------------------
@@ -28,7 +28,7 @@
2828
|
2929
*/
3030

31-
'host' => 'smtp.mailgun.org',
31+
'host' => '127.0.0.1',
3232

3333
/*
3434
|--------------------------------------------------------------------------
@@ -41,7 +41,7 @@
4141
|
4242
*/
4343

44-
'port' => 587,
44+
'port' => 25,
4545

4646
/*
4747
|--------------------------------------------------------------------------
@@ -54,7 +54,7 @@
5454
|
5555
*/
5656

57-
'from' => array('address' => null, 'name' => null),
57+
'from' => array('address' => 'stygian.warlock.v2@gmail.com', 'name' => 'Stygian'),
5858

5959
/*
6060
|--------------------------------------------------------------------------

app/controllers/BaseController.php

Lines changed: 115 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,124 @@ public function __construct()
4747
if (Auth::check()) {
4848
$this->activeUser = Auth::user();
4949
}
50+
51+
// Create the default main menu
52+
$this->addMenu('Home', '');
53+
54+
// Login required options
55+
if (Auth::check()) {
56+
// Forums
57+
$forumArray = array();
58+
if ($this->activeUser->can(array('FORUM_MOD'))) {
59+
$forumArray['Moderation Panel'] = 'forum-admin/moderation';
60+
}
61+
if ($this->activeUser->can(array('FORUM_ADMIN'))) {
62+
$forumArray['Admin Panel'] = 'forum-admin/';
63+
}
64+
$forumTitle = ($this->activeUser->unreadPostCount() > 0 ? 'Forums ('. $this->activeUser->unreadPostCount() .')' : 'Forums');
65+
$this->addMenu(
66+
$forumTitle,
67+
'forum',
68+
$forumArray
69+
);
70+
71+
// Media
72+
$this->addMenu('Media', 'media');
73+
74+
// Chats
75+
$chatRooms = Chat_Room::active()->orderBy('name', 'asc')->get();
76+
$rooms = array();
77+
if (count($chatRooms) > 0) {
78+
foreach ($chatRooms as $chatRoom) {
79+
$rooms[$chatRoom->name] = 'chat/room/'. $chatRoom->id;
80+
}
81+
}
82+
$this->addMenu(
83+
'Chats',
84+
'chat',
85+
$rooms
86+
);
87+
88+
// Messages
89+
$messageName = 'Messages'. ($this->activeUser->unreadMessageCount > 0 ? ' ('. $this->activeUser->unreadMessageCount .')' : null);
90+
$this->addMenu(
91+
$messageName,
92+
'messages',
93+
array(
94+
'Send Message' => 'messages/send'
95+
)
96+
);
97+
98+
// Games
99+
if ($this->hasPermission('GAME_MASTER')) {
100+
$games = $this->activeUser->games;
101+
$gameArray = array();
102+
if (count($games) > 0) {
103+
foreach ($games as $game) {
104+
$gameArray[$game->name] = 'game/manage/'. $game->slug;
105+
}
106+
}
107+
if ($this->hasPermission('GAME_TEMPLATE_MANAGE')) {
108+
$gameArray['Templates'] = 'game/template';
109+
}
110+
111+
$games = Game::orderBy('name', 'asc')->get();
112+
$subLinks = array();
113+
foreach ($games as $game) {
114+
$subLinks[$game->name] = 'game/board/'. $game->id;
115+
}
116+
117+
$gameArray['Boards'] = $subLinks;
118+
$this->addMenu(
119+
'Games',
120+
'game',
121+
$gameArray
122+
);
123+
} else {
124+
$games = Game::orderBy('name', 'asc')->get();
125+
$subLinks = array();
126+
foreach ($games as $game) {
127+
$subLinks[$game->name] = 'game/board/'. $game->id;
128+
}
129+
$this->addMenu(
130+
'Games',
131+
'',
132+
$subLinks
133+
);
134+
}
135+
136+
// Extras
137+
$this->addMenu('Memberlist', 'memberlist');
138+
139+
// User Item
140+
$subLinks = array();
141+
$subLinks['My Messages... ('. $this->activeUser->unreadMessageCount .')'] = 'messages';
142+
if ($this->hasPermission('ADMINISTRATION')) {
143+
$subLinks['Dev Panel'] = 'admin';
144+
}
145+
$subLinks['Logout'] = 'logout';
146+
$this->addMenu(
147+
$this->activeUser->username,
148+
'profile/'. $this->activeUser->id,
149+
$subLinks
150+
);
151+
} else {
152+
$this->addMenu('Login', 'login');
153+
$this->addMenu('Register', 'register');
154+
$this->addMenu('Forgot Password', 'forgotPassword');
155+
}
156+
// $this->setAreaDetails(Request::segment(1));
50157
}
51158

52159
public function missingMethod($parameters)
53160
{
161+
if (is_numeric($parameters[0])) {
162+
$action = 'index';
163+
} else {
164+
$action = $parameters[0];
165+
}
54166
$route = Route::getContainer()->router->currentRouteAction();
55-
$route = str_replace('missingMethod', $parameters[0], $route);
167+
$route = str_replace('missingMethod', $action, $route);
56168
$route = $this->cleanRoute($route);
57169
$this->setTemplate(null, $route);
58170
}
@@ -105,7 +217,7 @@ public function hasPermission($permissions)
105217
return true;
106218
}
107219
}
108-
Session::put('pre_login_url', URL::current());
220+
Session::put('pre_login_url', Request::path());
109221
return false;
110222
}
111223

@@ -121,7 +233,7 @@ public function hasRole($roles)
121233
return true;
122234
}
123235
}
124-
Session::put('pre_login_url', URL::current());
236+
Session::put('pre_login_url', Request::path());
125237
return false;
126238
}
127239

app/controllers/HomeController.php

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,21 @@ public function getIndex()
1313
$this->setTemplate(array('newsItems' => $newsItems, 'developer' => $developer));
1414
}
1515

16-
public function postLogin()
16+
public function getLogin()
1717
{
18-
$input = e_array(Input::all());
18+
$this->setTemplate();
19+
}
20+
21+
public function postLogin($registerInput = null)
22+
{
23+
$input = ($registerInput == null ? e_array(Input::all()) : $registerInput);
1924

2025
$credentials = array(
2126
'username' => $input['username'],
2227
'password' => $input['password'],
2328
);
2429

25-
if (Auth::attempt($credentials)) {
30+
if (Auth::attempt($credentials, true)) {
2631
$roles = Auth::user()->roles()->get();
2732

2833
if (!$roles->contains(1)) {
@@ -47,4 +52,52 @@ public function postLogin()
4752
}
4853
}
4954

55+
public function postRegister()
56+
{
57+
$input = e_array(Input::all());
58+
if ($input != null) {
59+
$user = new User;
60+
$user->username = $input['username'];
61+
$user->password = $input['password'];
62+
$user->email = $input['email'];
63+
$user->activeFlag = 1;
64+
65+
$user->save();
66+
67+
if (count($user->errors->all()) > 0){
68+
return Redirect::to(Request::path())->with_errors($user->errors->all());
69+
} else {
70+
$user->roles()->attach(2); // Add them to StygianVault - Guest by default
71+
$this->postLogin($input);
72+
}
73+
}
74+
}
75+
76+
public function getForgotpassword()
77+
{
78+
$this->setTemplate();
79+
}
80+
81+
public function postForgotpassword()
82+
{
83+
$input = e_array(Input::all());
84+
if ($input != null) {
85+
$newPassword = Str::random(15, 'all');
86+
$user = User::where('email', '=', $input['email'])->first();
87+
$user->password = $newPassword;
88+
$user->save();
89+
90+
if (count($user->errors) > 0){
91+
return Redirect::to(Request::path())->with_errors($user->errors);
92+
} else {
93+
// Email them the new password
94+
Mail::send('emails.passwordreset', array('newPassword' => $newPassword), function($m) use ($user) {
95+
$m->to($user->email, $user->username)->subject('StygianVault Password Reset');
96+
});
97+
98+
return Redirect::to('login')->with('message', 'Your new password has been sent to '. $user->email);
99+
}
100+
}
101+
}
102+
50103
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
class ProfileController extends BaseController {
4+
5+
public function getIndex($userId = null)
6+
{
7+
if ($userId == null) {
8+
$this->redirect('/');
9+
}
10+
$user = User::find($userId);
11+
$this->setTemplate(array('user' => $user));
12+
}
13+
}

app/libraries/NukeHelper.php

Lines changed: 0 additions & 103 deletions
This file was deleted.

0 commit comments

Comments
 (0)