Skip to content
This repository has been archived by the owner on Jul 13, 2018. It is now read-only.

Commit

Permalink
Unnamed CMS v.0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
WoWTech committed Jul 26, 2017
0 parents commit feba6d5
Show file tree
Hide file tree
Showing 6,329 changed files with 707,402 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
55 changes: 55 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
APP_NAME="Unnamed CMS"
APP_ENV=local
APP_KEY=base64:o4ir7OYRnbqcVAZrQK8GZvFJvWJMHQAvbbNGOE2MjCg=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

DB_AUTH_CONNECTION=mysql
DB_AUTH_HOST=127.0.0.1
DB_AUTH_PORT=3306
DB_AUTH_DATABASE=auth
DB_AUTH_USERNAME=root
DB_AUTH_PASSWORD=

DB_CHARACTERS_CONNECTION=mysql
DB_CHARACTERS_HOST=127.0.0.1
DB_CHARACTERS_PORT=3306
DB_CHARACTERS_DATABASE=characters
DB_CHARACTERS_USERNAME=root
DB_CHARACTERS_PASSWORD=

DB_WORLD_CONNECTION=mysql
DB_WORLD_HOST=127.0.0.1
DB_WORLD_PORT=3306
DB_WORLD_DATABASE=world
DB_WORLD_USERNAME=root
DB_WORLD_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
DEBUGBAR_ENABLED=false
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Unnamed CMS
This repository serves for storing temporary public releases of Unnamed CMS and NOT for development. To develop this CMS we are using private repository with limited access.
## Installation
**1)** Edit ```.env``` file located in the root folder.
```
DB_CONNECTION=mysql
DB_HOST=127.0.0.1 // Database host
DB_PORT=3306 // Database port
DB_DATABASE=laravel // Database name
DB_USERNAME=root // Database User
DB_PASSWORD= // Database User password
```
First connection will be used to store tables related to the CMS.

After configuring first connection, you need to edit config details for other 3 connections ```DB_WORLD_CONNECTION```, ```DB_CHARACTERS_CONNECTION``` and ```DB_AUTH_CONNECTION``` (```world```, ```characters``` and ```auth```) in the same file below.

**2)** Edit ```config/server.php``` file like so:
```
'realms' => array(
[
'name' => 'Realm name',
'ip' => 'Realm IP (default: 127.0.0.1)', // Convention
'port' => port (default: 8085)
]
)
```
**3)** Create database with the name you specified in ```.env``` file ```DB_DATABASE``` option (database name is ```laravel``` in this example above). Import ```sql\database.sql``` into the this database.

**4)** Set your ```Apache```, ```WampServer``` or ```OpenServer``` site directory to ```public``` folder.

DONE. If you have any trouble with installing, configuring or using CMS, please create an [Issue](https://github.com/WoWTech/unnamed-cms-releases/issues/new)
64 changes: 64 additions & 0 deletions app/Account.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Laratrust\Traits\LaratrustUserTrait;

class Account extends Authenticatable
{
use LaratrustUserTrait, Notifiable;

protected $connection = 'auth';

protected $table = 'account';

protected $fillable = [
'username', 'password', 'email', 'expansion'
];

protected $hidden = [
'sha_pass_hash',
];
protected $dates = ['joindate'];

public $timestamps = false;

public function comments()
{
return $this->hasMany(Comment::class);
}

public static function boot()
{
parent::boot();

static::creating( function ($model) {
$model->attributes['joindate'] = $model->freshTimestamp();
});
}

// Accounts table doesn't have remember_token column
// according to the trinity documentation.

public function getRememberTokenName()
{
return null;
}

protected function setPasswordAttribute($value)
{
$this->attributes['sha_pass_hash'] = strtoupper(sha1(strtoupper($this->attributes['username']).':'.strtoupper($value)));
}

// This is the TEMPORARY method to somehow authorize user
// permissions wich will be REPLACED with full ACL system
// using roles and permissions.

public function isStuffMember()
{
return \DB::connection('auth')->table('account_access')->whereId($this->id)->where('gmlevel', '>=', 3)->first() === null ? false : true;
}

}
38 changes: 38 additions & 0 deletions app/Auth/Hashing/ShaHasher.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

namespace App\Auth\Hashing;

use RuntimeException;
use Illuminate\Contracts\Hashing\Hasher as HasherContract;

class ShaHasher implements HasherContract
{

public function make($data, array $options = [])
{
$hash = strtoupper(SHA1(strtoupper($data[0]).':'.strtoupper($data[1])));

if ($hash === false) {
throw new RuntimeException('SHA Hasher is not available');
}

return $hash;
}

public function check($data, $hashedValue, array $options = [])
{
if (strlen($hashedValue) == 0) {
return false;
}

$hash = $this->make($data);

return $hash === $hashedValue;
}

public function needsRehash($hashedValue, array $options = [])
{
return false;
}

}
24 changes: 24 additions & 0 deletions app/Auth/ServiceProviders/HasherServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace App\Auth\ServiceProviders;

use App\Auth\Hashing\ShaHasher;

use Illuminate\Support\ServiceProvider;

class HasherServiceProvider extends ServiceProvider
{
protected $defer = true;

public function register()
{
$this->app->singleton('shaHash', function () {
return new ShaHasher;
});
}

public function provides()
{
return ['shaHash'];
}
}
32 changes: 32 additions & 0 deletions app/Auth/ServiceProviders/WoWAuthServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace App\Auth\ServiceProviders;

use Auth;
use App\Auth\ShaUserProvider;
use Illuminate\Support\ServiceProvider;

class WoWAuthServiceProvider extends ServiceProvider
{
/**
* Perform post-registration booting of services.
*
* @return void
*/
public function boot()
{
Auth::provider('sha', function($app, array $config) {
return new ShaUserProvider($this->app['shaHash'], $config['model']);
});
}

/**
* Register bindings in the container.
*
* @return void
*/
public function register()
{
//
}
}
18 changes: 18 additions & 0 deletions app/Auth/ShaUserProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace App\Auth;

use Illuminate\Auth\EloquentUserProvider;
use Illuminate\Support\Str;
use Illuminate\Contracts\Auth\UserProvider;
use Illuminate\Contracts\Hashing\Hasher as HasherContract;
use Illuminate\Contracts\Auth\Authenticatable as UserContract;

class ShaUserProvider extends EloquentUserProvider
{
public function validateCredentials(UserContract $user, array $credentials)
{
$plain = $credentials['password'];
return $this->hasher->check([$user->username, $plain], $user->sha_pass_hash);
}
}
25 changes: 25 additions & 0 deletions app/Comment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use App\Traits\StringManipulation;

class Comment extends Model
{
use StringManipulation;

protected $fillable = ['content', 'account_id', 'post_id'];

protected $connection = 'mysql';

public function post()
{
return $this->belongsTo(Post::class);
}

public function account()
{
return $this->belongsTo(Account::class);
}
}
40 changes: 40 additions & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];

/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
}

/**
* Register the Closure based commands for the application.
*
* @return void
*/
protected function commands()
{
require base_path('routes/console.php');
}
}
Loading

0 comments on commit feba6d5

Please sign in to comment.