Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
DZywolf committed Dec 11, 2022
0 parents commit 3a41724
Show file tree
Hide file tree
Showing 23 changed files with 502 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.gitattributes export-ignore
/.github export-ignore
43 changes: 43 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: 🐛 Bug Report
description: Create a Bug Report
title: "🐛 [Bug Report]: "
labels: ['bug']
body:
- type: markdown
attributes:
value: |
Hello, thanks for taking the time to fill out this bug report!
Before you begin, **please ensure there is no existing open or closed issue related to your report**.
---
- type: input
id: module-version
attributes:
label: Module Version
description: e.g. 1.0.0
validations:
required: true

- type: textarea
id: what-happened
attributes:
label: What happened?
description: Describe the issue in detail.
validations:
required: true

- type: textarea
id: issue-reproduce
attributes:
label: How can the issue be reproduced?
description: Describe steps to reproduce the behavior.
validations:
required: true

- type: textarea
id: issue-screenshots
attributes:
label: Screenshots
description: Provide screenshots here or share links.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: WoW-CMS Community Support
url: https://discord.wow-cms.com
about: Join our community! Here you can get a faster responses about an issue.
18 changes: 18 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# _Status Module_

[![Version](https://img.shields.io/github/v/release/wow-cms/bc-status?color=green&include_prereleases&logo=github&sort=semver&style=flat-square)](https://github.com/WoW-CMS/bc-status/releases)
[![License](https://img.shields.io/github/license/wow-cms/bc-status?color=blue&style=flat-square)](../LICENSE)

## Requirements

1. **BlizzCMS version** 2.0.0+

## Contributors

Thanks to everyone who has contributed!

[![Contributors](https://contrib.rocks/image?repo=wow-cms/bc-status)](https://github.com/WoW-CMS/bc-status/graphs/contributors)

## License

This module is released under the [MIT License](../LICENSE).
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2

updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-minor", "version-update:semver-patch"]
22 changes: 22 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
changelog:
exclude:
authors:
- dependabot
categories:
- title: 🚨 Breaking Changes
labels:
- 'breaking change'
- title: 🐛 Bug Fixes
labels:
- bug
- title: ✨ New Features
labels:
- 'new feature'
- title: 🚀 Enhancements
labels:
- enhancement
- refactor
- 'missing feature'
- title: ⚙️ Dependency updates
labels:
- dependencies
9 changes: 9 additions & 0 deletions .github/scripts/build-zip
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

# Variables
NAME=$1

# Create zip archive
zip -r ${NAME}.zip . -x \
*.git* \
.github/\*
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release

on:
push:
tags:
- "v*.*.*"

jobs:
build:
name: Build release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Get tag version
id: get_version
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_OUTPUT

- name: Run script
run: |
chmod +x ./.github/scripts/build-zip
./.github/scripts/build-zip status-${{ steps.get_version.outputs.RELEASE_VERSION }}
- name: Release
uses: softprops/action-gh-release@v1
with:
files: status-${{ steps.get_version.outputs.RELEASE_VERSION }}.zip
67 changes: 67 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#-------------------------
# Operating Specific Junk Files
#-------------------------

# OS X
.DS_Store
.AppleDouble
.LSOverride

# OS X Thumbnails
._*

# Windows image file caches
Thumbs.db
ehthumbs.db
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

# Linux
*~

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

#-------------------------
# IDE / Development Files
#-------------------------

# Jetbrains editors (PHPStorm, etc)
.idea/
*.iml

# Netbeans
nbproject/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml
.nb-gradle/

# Sublime Text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
*.sublime-workspace
*.sublime-project
.phpintel
/api/

# Visual Studio Code
.vscode/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 - 2022, WoW-CMS

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
35 changes: 35 additions & 0 deletions config/migration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

/*
|--------------------------------------------------------------------------
| Migrations Status
|--------------------------------------------------------------------------
|
| Status of the module's migration functionality.
| Disabled by default for security reasons.
|
*/
$config['migration_enabled'] = true;

/*
|--------------------------------------------------------------------------
| Migrations Version
|--------------------------------------------------------------------------
|
| Parameter set as the maximum limit to proceed with the
| migration in the module.
| The version use timestamp format: YYYYMMDDHHIISS
|
*/
$config['migration_version'] = 20220920120000;

/*
|--------------------------------------------------------------------------
| Migrations Path
|--------------------------------------------------------------------------
|
| Path to the module migrations folder.
|
*/
$config['migration_path'] = '../migrations/';
13 changes: 13 additions & 0 deletions config/module.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

return [
'name' => 'Status',
'description' => 'Page with the list of online players for each realm',
'version' => '1.0.0',
'author' => [
'name' => 'WoW-CMS',
'website' => 'https://wow-cms.com'
],
'dashboard' => ''
];
4 changes: 4 additions & 0 deletions config/routes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

$route['status']['get'] = 'status/index';
36 changes: 36 additions & 0 deletions controllers/Status.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/**
* BlizzCMS
*
* @author WoW-CMS
* @copyright Copyright (c) 2019 - 2022, WoW-CMS (https://wow-cms.com)
* @license https://opensource.org/licenses/MIT MIT License
*/
defined('BASEPATH') OR exit('No direct script access allowed');

class Status extends BS_Controller
{
public function __construct()
{
parent::__construct();

is_module_installed('status', true);

$this->load->model('status_model');

$this->load->language('status');
}

public function index()
{
require_permission('view.status');

$data = [
'realms' => $this->realm_model->find_all()
];

$this->template->title(lang('online_players'), config_item('app_name'));

$this->template->build('index', $data);
}
}
9 changes: 9 additions & 0 deletions controllers/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
9 changes: 9 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
4 changes: 4 additions & 0 deletions language/english/status_lang.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

$lang['online_players'] = 'Online players';
4 changes: 4 additions & 0 deletions language/spanish/status_lang.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

$lang['online_players'] = 'Jugadores en linea';
35 changes: 35 additions & 0 deletions migrations/20220920120000_add_permissions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Migration_Add_permissions extends CI_Migration
{
public function up()
{
$this->permission_model->insert_batch([
['key' => 'view.status', 'module' => 'status', 'description' => 'Can view status page']
]);

$permissions = $this->permission_model->find_all(['module' => 'status']);
$permsLinked = [];

foreach ($permissions as $permission) {
$permsLinked[] = ['role_id' => '1', 'permission_id' => $permission->id];
$permsLinked[] = ['role_id' => '2', 'permission_id' => $permission->id];
$permsLinked[] = ['role_id' => '3', 'permission_id' => $permission->id];
$permsLinked[] = ['role_id' => '4', 'permission_id' => $permission->id];
$permsLinked[] = ['role_id' => '5', 'permission_id' => $permission->id];
}

$this->role_permission_model->insert_batch($permsLinked);
}

public function down()
{
$permissions = $this->permission_model->find_all(['module' => 'status'], 'array');
$permissionsIds = array_column($permissions, 'id');

if ($permissionsIds !== []) {
$this->permission_model->delete_in('id', $permissionsIds);
}
}
}
Loading

0 comments on commit 3a41724

Please sign in to comment.