Skip to content
This repository has been archived by the owner on Oct 14, 2023. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
fbraem committed Dec 26, 2019
2 parents 75cabf0 + 8110117 commit f85d3b4
Show file tree
Hide file tree
Showing 318 changed files with 582 additions and 37,823 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
/tmp/
/files/
*.key
/index.html
100 changes: 81 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,87 @@
Kwai
====
Kwai-api
========

Kwai is a club/content management system. At the moment it's main focus is a
judo club (kwai means club), but in the future it may be possible to support
Kwai-api is a part of the kwai system. The ultimate goal of Kwai is to manage a (sports)club. The focus is currently on judo sport (Kwai means club in Japanese), but in the future it may be possible to support
other sports.

High level
==========

- club website
- news
- events
- information
- membership management
- team management
- team membership management
- training calendar
- absence / presence registration
The frontend of kwai can be found in the [kwai-ui](https://github.com/fbraem/kwai-ui) repository.

API
===
Kwai-api is the REST api for Kwai. It's written in PHP and it tries to follow the [JSONAPI](http://jsonapi.org) standard.

Currently the following api's are already available:

- news
- pages
- members
- teams
- trainings

Although there is still a lot to do, kwai is already used in production for our club.

TODO
====

There is still a lot to do:

- tournament management
- member follow-up system
- events
- ...

Kwai is already used in production but it is still a work in progress and
contains some club specific data which needs to be standardized... It's usable
but you will need to do some work to adopt it to your club ...
Kwai is currently more CRUD then domain oriented. This api must evolve from an anemic model to real DDD.

Installation
============

Clone this repository and run `composer install` in the `src` as current directory. When all goes well, create a `config.php` in the `api` directory. This PHP file must return an array with some configuration:

return [
'database' => [
'development' => [
'adapter' => 'mysql',
'host' => '',
'user' => '',
'pass' => '',
'name' => '',
'charset' => 'utf8',
'prefix' => ''
]
],
'default_database' => 'development',
'files' => '',
'oauth2' => [
'private_key' => 'file:///',
'public_key' => 'file:///',
'encryption_key' => '',
'client' => [
'name' => '',
'identifier' => '',
'secret' => '',
'redirect' => ''
]
],
'mail' => [
'host' => '',
'user' => '',
'pass' => '',
'port' => 2525,
'from' => [ ],
'subject' => ''
],
'website' => [
'url' => '',
'email' => ''
]
];

Create a public and private key as explained on [league/oauth2-server](https://oauth2.thephpleague.com/installation/).

When the configuration is finished, run the database migrations from the `src` directory:

./vendor/bin/phinx migrate -c phinx.php

On shared hosting:

php ./vendor/robmorgan/phinx/phinx.php migrate -c phinx.php
2 changes: 1 addition & 1 deletion api/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
RewriteRule ^pages(/.*)?$ /api/pages.php?$1 [QSA,L]
RewriteRule ^persons(/.*)?$ /api/persons.php?$1 [QSA,L]
RewriteRule ^seasons(/.*)?$ /api/seasons.php?$1 [QSA,L]
RewriteRule ^team_types(/.*)?$ /api/team_types.php?$1 [QSA,L]
RewriteRule ^team_categories(/.*)?$ /api/team_categories.php?$1 [QSA,L]
RewriteRule ^teams(/.*)?$ /api/teams.php?$1 [QSA,L]
RewriteRule ^events(/.*)?$ /api/events.php?$1 [QSA,L]
RewriteRule ^trainings(/.*)?$ /api/trainings.php?$1 [QSA,L]
Expand Down
25 changes: 25 additions & 0 deletions api/team_categories.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
require '../src/vendor/autoload.php';

$app = \Core\Clubman::getApplication();

$app->group('/team_categories', function () {
$this->get('', \REST\Teams\Actions\TeamCategoryBrowseAction::class)
->setName('team_categories.browse')
->setArgument('auth', true)
;
$this->get('/{id:[0-9]+}', \REST\Teams\Actions\TeamCategoryReadAction::class)
->setName('team_categories.read')
->setArgument('auth', true)
;
$this->post('', \REST\Teams\Actions\TeamCategoryCreateAction::class)
->setName('team_categories.create')
->setArgument('auth', true)
;
$this->patch('/{id:[0-9]+}', \REST\Teams\Actions\TeamCategoryUpdateAction::class)
->setName('team_categories.update')
->setArgument('auth', true)
;
});

$app->run();
25 changes: 0 additions & 25 deletions api/team_types.php

This file was deleted.

17 changes: 12 additions & 5 deletions facebook.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,24 @@

if ($facebook) {
// This is the Facebook crawler ...
$images = $this->filesystem->listContents('images/news/' . $story->id);
$meta = [];
$meta['og:url'] = $uri->__toString();
$meta['og:type'] = 'article';
$meta['og:title'] = $story->contents[0]['title'];
$meta['og:description'] = $story->contents[0]['social_media'] ?? '';
foreach ($images as $image) {
if (isset($image['filename']) && $image['filename'] == 'header_detail_crop') {

$images = $this->filesystem->listContents('images/news/' . $story->id);
$image = array_search('header_detail_crop', array_column($images, 'filename'));
if ($image) {
$meta['og:image'] = $uri->withPath('/files/' . $image['path'])->__toString();
$meta['og:image:width'] = 800;
$meta['og:image:height'] = 300;
} else {
$image = array_search('header_overview_crop', array_column($images, 'filename'));
if ($image) {
$meta['og:image'] = $uri->withPath('/files/' . $image['path'])->__toString();
$meta['og:image:width'] = 800;
$meta['og:image:height'] = 300;
$meta['og:image:width'] = 500;
$meta['og:image:height'] = 500;
}
}

Expand Down
25 changes: 14 additions & 11 deletions src/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,24 @@
"require": {
"php" : ">=7.0",
"league/fractal": "0.18.*",
"nesbot/carbon": "2.18.*",
"nesbot/carbon": "2.25.3",
"mtdowling/jmespath.php": "^2.4",
"robmorgan/phinx": "0.10.*",
"league/flysystem": "^1.0",
"intervention/image": "^2.4",
"league/oauth2-server": "7.4.*",
"league/commonmark": "0.18.*",
"webuni/commonmark-table-extension": "0.9.*",
"league/csv": "^9.0",
"cakephp/orm": "^3.5",
"cakephp/i18n": "^3.5",
"robmorgan/phinx": "0.11.1",
"league/flysystem": "1.0.57",
"intervention/image": "2.5.0",
"league/oauth2-server": "8.0.0",
"league/commonmark": "1.1.0",
"league/csv": "9.4.1",
"cakephp/i18n": "3.8.5",
"slim/slim": "^3.0",
"league/plates": "^3.3",
"phpmailer/phpmailer": "^6.0",
"respect/validation": "^1.1"
"respect/validation": "1.1.31",
"league/commonmark-ext-table": "^2.1",
"cakephp/orm": "^3.8",
"cakephp/chronos": "1.2.8",
"lcobucci/jwt": "3.3.1",
"guzzlehttp/psr7": "1.6.1"
},
"require-dev": {
},
Expand Down
Loading

0 comments on commit f85d3b4

Please sign in to comment.