merge app api

This commit is contained in:
Schneider Roland 2023-01-19 17:43:10 +01:00
commit 7adaf34677
570 changed files with 81491 additions and 1263 deletions

6
.gitignore vendored
View File

@ -52,7 +52,13 @@ phpunit.phar
/customerapi/web/assets/**
!/customerapi/web/assets/.gitkeep
/mobileapi/web/assets/**
!/mobileapi/web/assets/.gitkeep
/customerapi/config/*-local.php
/customerapi/runtime/logs/**
!/customerapi/runtime/.gitkeep
environments/cutlergyor/apache2/data

View File

@ -1,6 +1,32 @@
## Start the app
```bash
fitness_web/environments/cutlergyor/apache2
docker-compose up -d
```
Frontend
http://localhost:42001/cutler/frontend/web/index.php?r=site%2Flogin
Backend
http://localhost:42001/cutler/backend/web/index.php?r=site%2Flogin
Rest
[rest.http](rest.http)
## Craete a cutlergyor deployment
See [environments/cutlergyor/apache2/readme.md](environments/cutlergyor/apache2/readme.md)
Yii 2 Advanced Project Template
===============================
Yii 2 Advanced Project Template is a skeleton [Yii 2](http://www.yiiframework.com/) application best for
developing complex Web applications with multiple tiers.

View File

@ -2,6 +2,7 @@
namespace backend\controllers;
use Mpdf\Mpdf;
use Yii;
use common\models\AccountState;
use backend\models\AccountStateSearch;
@ -11,6 +12,7 @@ use yii\filters\VerbFilter;
use common\models\Account;
use common\models\User;
use common\components\DailyListing;
use common\components\MpdfUtil;
/**
* AccountStateController implements the CRUD actions for AccountState model.
@ -35,7 +37,7 @@ class AccountStateController extends \backend\controllers\BackendController
],
];
}
/**
* Lists all AccountState models.
* @return mixed
@ -47,8 +49,8 @@ class AccountStateController extends \backend\controllers\BackendController
$accounts = Account::read();
$users = User::read();
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
@ -73,7 +75,7 @@ class AccountStateController extends \backend\controllers\BackendController
$output = Yii::$app->getRequest ()->getQueryParam ( 'output' );
$details = null;
if ($accountState->isTypeClose ()) {
$prev;
if ($accountState->type == AccountState::TYPE_CLOSE) {
if (isset ( $accountState->prev_state )) {
@ -85,38 +87,38 @@ class AccountStateController extends \backend\controllers\BackendController
}
$details = new DailyListing();
$details->loadAccountState ( $accountState );
$details->readTotalEasy ();
$details->readTotalDetailed ();
$details->readTotalMedium ();
}
if ($output == 'pdf') {
$user = User::findOne(\Yii::$app->user->id);
$mpdf=new \mPDF('utf-8', 'A4-L');
$mpdf= MpdfUtil::createMpdfWith6XConstructor('utf-8', 'A4-L');
$mpdf->useSubstitutions=false;
$mpdf->simpleTables = true;
$mpdf->SetHeader( \Yii::$app->params[ "company_name" ] . " - Létrehozva: " .$user->username . ", ".\Yii::$app->formatter->asDatetime(time()) );
$mpdf->setFooter('{PAGENO} / {nb}');
$stylesheet = file_get_contents( \Yii::getAlias('@vendor'.'/bower/bootstrap/dist/css/bootstrap.css')); // external css
$mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML($this->renderPartial("@common/views/account-state/account_state_pdf", [
'model' => $accountState,
'details' => $details
'details' => $details
]));
$type = $accountState->isTypeOpen() ? "kassza_nyitas" : "kassza_zaras";
$dt= "_letrehozva_".date("Ymd_His"). "_" . $user->username;
$dt= "_letrehozva_".date("Ymd_His"). "_" . $user->username;
$fn= $type .$dt.".pdf";
$mpdf->Output($fn, 'D');
} else {
return $this->render ( 'view', [
return $this->render ( 'view', [
'model' => $accountState,
'details' => $details
'details' => $details
] );
}
}
@ -158,7 +160,7 @@ class AccountStateController extends \backend\controllers\BackendController
}
}
/**
* Deletes an existing AccountState model.
* If deletion is successful, the browser will be redirected to the 'index' page.
@ -168,27 +170,27 @@ class AccountStateController extends \backend\controllers\BackendController
*/
public function actionDelete($id) {
$model = $this->findModel ( $id );
$delete = true;
if ( $model->isTypeOpen() ){
$closeStates = AccountState::find()->andWhere( ['prev_state' => $model->id_account_state] )->all();
if ( count($closeStates) > 0){
$delete = false;
\Yii::$app->session->setFlash('error', ['Nem lehet törölni a nyitást, mert van kapcsolódó zárás!']);
throw new \Exception('Nem lehet törölni a nyitást, mert van kapcsolódó zárás!');
}
}
}
if ( $delete == true ){
$model->delete();
\Yii::$app->session->setFlash ( 'success', 'Kassza művelet törölve' );
}
}
return $this->redirect ( ["index"] );
}
/**
* Deletes an existing AccountState model.
* If deletion is successful, the browser will be redirected to the 'index' page.

View File

@ -8,7 +8,6 @@ use backend\models\CitySearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\base\Object;
use yii\db\Query;
use yii\helpers\Json;
@ -36,5 +35,5 @@ class BackendController extends Controller
];
}
}

View File

@ -8,7 +8,6 @@ use backend\models\CitySearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\base\Object;
use yii\db\Query;
use yii\helpers\Json;
@ -34,7 +33,7 @@ class CityController extends \backend\controllers\BackendController
],
];
}
/**
* Lists all City models.
@ -128,14 +127,14 @@ class CityController extends \backend\controllers\BackendController
throw new NotFoundHttpException('The requested page does not exist.');
}
}
/**
* Your controller action to fetch the list
*/
public function actionNameList($search = null) {
$query = new Query();
$query->select ( [
'name',
'min(zip) as zip',
@ -158,7 +157,7 @@ class CityController extends \backend\controllers\BackendController
*/
public function actionZipList($search = null) {
$query = new Query();
$query->select ( [
'name',
'min(zip) as zip',

View File

@ -12,7 +12,6 @@ use yii\filters\AccessControl;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\base\Object;
use backend\models\CustomerUpdate;
use backend\models\CustomerNewsLetterModel;
use yii\db\Query;
@ -24,7 +23,7 @@ use yii\data\ActiveDataProvider;
class CustomerController extends \backend\controllers\BackendController
{
public function behaviors()
{
@ -130,10 +129,10 @@ class CustomerController extends \backend\controllers\BackendController
public function actionCreate()
{
$model = new CustomerCreate();
$model->country = "Magyarország";
$model->id_user = Yii::$app->user->id;
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_customer]);
@ -157,9 +156,9 @@ class CustomerController extends \backend\controllers\BackendController
if (($model = CustomerUpdate::findOne($id)) == null) {
throw new NotFoundHttpException('The requested page does not exist.');
}
$model->birthdate= isset($model->birthdate ) ? Yii::$app->formatter->asDate($model->birthdate) :'';
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_customer]);
@ -198,24 +197,24 @@ class CustomerController extends \backend\controllers\BackendController
throw new NotFoundHttpException('The requested page does not exist.');
}
}
public function actionMail(){
$model = new CustomerNewsLetterModel();
$query = new Query();
$query->distinct();
$query->select([ 'email']);
$query->from("customer");
$query->andWhere(['newsletter' => 1]);
$query->andWhere(['status' => Customer::STATUS_ACTIVE]);
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
$message = \Yii::$app->mailer->compose ( );
$message
->setFrom ( "noreply@fitnessadmin.hu" )
->setBcc(['rocho02@gmail.com',"rocho02@freemail.hu"])
@ -225,9 +224,9 @@ class CustomerController extends \backend\controllers\BackendController
->send ();
return $this->redirect(['customer/mail']);
}
return $this->render('mail', [ 'model' => $model ]);
}
}

View File

@ -4,6 +4,7 @@ namespace backend\controllers;
use common\models\Log;
use common\models\Transfer;
use Mpdf\Mpdf;
use Yii;
use common\models\Ticket;
use backend\models\TicketSearch;
@ -27,19 +28,20 @@ use yii\helpers\VarDumper;
use backend\models\TicketUpdate;
use yii\helpers\Url;
use common\components\Helper;
use common\components\MpdfUtil;
/**
* TicketController implements the CRUD actions for Ticket model.
*/
class TicketController extends \backend\controllers\BackendController {
public function behaviors() {
return [
'access' => [
return [
'access' => [
'class' => \yii\filters\AccessControl::className (),
'rules' => [
// allow authenticated users
[
'actions' => [
[
'actions' => [
'create',
'index',
'view',
@ -49,22 +51,22 @@ class TicketController extends \backend\controllers\BackendController {
'test'
],
'allow' => true,
'roles' => [
'roles' => [
'admin',
'employee',
'reception'
]
]
'reception'
]
]
]
// everything else is denied
]
]
];
}
/**
* Lists all Ticket models.
*
*
* @return mixed
*/
public function actionIndex() {
@ -82,10 +84,10 @@ class TicketController extends \backend\controllers\BackendController {
}else if ( $searchModel->output == 'xls'){
return $this->downloadIndexXls($searchModel,$dataProvider);
}
return $this->render ( 'index', [
return $this->render ( 'index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider
'dataProvider' => $dataProvider
] );
}
@ -292,7 +294,7 @@ class TicketController extends \backend\controllers\BackendController {
$fileName = "berletek";
$fileName .= "_" . date ( "Ymd_His" );
$fileName .= ".pdf";
$mpdf = new \mPDF ( 'utf-8', 'A4' );
$mpdf = MpdfUtil::createMpdfWith6XConstructor( 'utf-8', 'A4' );
$mpdf->useSubstitutions = false;
$mpdf->simpleTables = true;
@ -316,24 +318,24 @@ class TicketController extends \backend\controllers\BackendController {
] );
*/
}
/**
* Lists all Ticket models.
*
*
* @return mixed
*/
public function actionStatistics() {
$searchModel = new TicketSearchStatisitcs();
$searchModel->search ( Yii::$app->request->queryParams );
$searchModel->searchTotals ();
$searchModel->users = User::read ();
$searchModel->accounts = Account::read ();
$searchModel->ticketTypes = TicketType::read ();
if ($searchModel->output == 'pdf') {
$user = User::findOne ( \Yii::$app->user->id );
$mpdf = new \mPDF ( 'utf-8', 'A4-L' );
$mpdf = MpdfUtil::createMpdfWith6XConstructor ( 'utf-8', 'A4-L' );
$fn = "";
$ov = '_total_content_pdf';
$dt = "_letrehozva_" . date ( "Ymd_His" ) . "_" . $user->username;
@ -341,24 +343,24 @@ class TicketController extends \backend\controllers\BackendController {
$account = "";
$currentUser = "";
$fn = $fn . $interval . $dt . $account . $currentUser . ".pdf";
$mpdf->useSubstitutions = false;
$mpdf->simpleTables = true;
$mpdf->SetHeader ( \Yii::$app->params ["company_name"] . " - Létrehozva: " . $user->username . ", " . \Yii::$app->formatter->asDatetime ( time () ) );
$mpdf->setFooter ( '{PAGENO} / {nb}' );
$stylesheet = file_get_contents ( \Yii::getAlias ( '@vendor' . '/bower/bootstrap/dist/css/bootstrap.css' ) ); // external css
$mpdf->WriteHTML ( $stylesheet, 1 );
$mpdf->WriteHTML ( $this->renderPartial ( 'statistics_pdf', [
'searchModel' => $searchModel
$mpdf->WriteHTML ( $this->renderPartial ( 'statistics_pdf', [
'searchModel' => $searchModel
] ) );
$mpdf->Output ( $fn, 'D' );
exit ();
} else {
return $this->render ( 'statistics', [
'searchModel' => $searchModel
return $this->render ( 'statistics', [
'searchModel' => $searchModel
] );
}
}
@ -373,91 +375,91 @@ class TicketController extends \backend\controllers\BackendController {
public function actionIndexCustomer($id) {
$customer = Customer::findOne ( $id );
$card = Card::findOne ( $id );
if ($customer == null) {
throw new NotFoundHttpException ( 'The requested page does not exist.' );
}
$searchModel = new TicketSearchCustomer(['customer' => $customer]);
$searchModel->id_card = $customer->id_customer_card;
$dataProvider = $searchModel->search ( Yii::$app->request->queryParams );
//$searchModel->searchTotals ();
$searchModel->users = User::read ();
$searchModel->accounts = Account::read ();
$searchModel->ticketTypes = TicketType::read ();
Url::remember(Url::current(),"ticket_index_customer");
return $this->render ( 'index_customer', [
return $this->render ( 'index_customer', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
'customer' => $customer,
'card' => $card
'card' => $card
] );
}
/**
* Displays a single Ticket model.
*
* @param integer $id
*
* @param integer $id
* @return mixed
*/
public function actionView($id) {
return $this->render ( 'view', [
'model' => $this->findModel ( $id )
return $this->render ( 'view', [
'model' => $this->findModel ( $id )
] );
}
/**
* Creates a new Ticket model.
* If creation is successful, the browser will be redirected to the 'view' page.
*
*
* @return mixed
*/
public function actionCreate() {
$model = new Ticket ();
$discounts = Discount::read ();
$ticketTypes = TicketType::read ();
$accounts = Account::readAccounts ();
if ($model->load ( Yii::$app->request->post () ) && $model->save ()) {
return $this->redirect ( [
return $this->redirect ( [
'view',
'id' => $model->id_ticket
'id' => $model->id_ticket
] );
} else {
return $this->render ( 'create', [
return $this->render ( 'create', [
'model' => $model,
'discounts' => $discounts,
'ticketTypes' => $ticketTypes,
'accounts' => $accounts
'accounts' => $accounts
] );
}
}
/**
* Updates an existing Ticket model.
* If update is successful, the browser will be redirected to the 'view' page.
*
* @param integer $id
*
* @param integer $id
* @return mixed
*/
public function actionUpdate($id) {
$model = TicketUpdate::findOne( $id );
$model->startDate = substr( $model->start ,0 ,10 );
$model->endDate = substr( $model->end ,0 ,10 );
$model->startDate = \Yii::$app->formatter->asDate($model->startDate);
$model->endDate = \Yii::$app->formatter->asDate($model->endDate);
if ($model->load ( Yii::$app->request->post () ) && $model->save ()) {
@ -468,66 +470,66 @@ class TicketController extends \backend\controllers\BackendController {
]);
Helper::flash("success", "Bérlet sikeresen módosítva");
$url = Url::previous("ticket_index_customer");
if ( isset($url) ){
return $this->redirect($url);
}
return $this->redirect ( [
return $this->redirect ( [
'view',
'id' => $model->id_ticket
'id' => $model->id_ticket
] );
} else {
return $this->render ( 'update', [
'model' => $model
return $this->render ( 'update', [
'model' => $model
] );
}
}
/**
* Deletes an existing Ticket model.
* If deletion is successful, the browser will be redirected to the 'index' page.
*
* @param integer $id
*
* @param integer $id
* @return mixed
*/
public function actionDelete($id) {
$this->findModel ( $id )->delete ();
return $this->redirect ( [
'index'
return $this->redirect ( [
'index'
] );
}
public function actionTest(){
// $this->doTestTicketSale();
$this->doTestDetstaProcess();
return $this->render('test');
}
protected function doTestDetstaProcess(){
$contract = Contract::findOne(19);
$megbizas = $contract->requests[0];
$tetel = new GiroDETSTATetel();
$tetel->visszajelzesInformacio = "02";
$tp = new DetStatTetelProcessor([
'megbizas' => $megbizas,
'tetel' => $tetel
]);
$tp->run();
}
protected function doTestTicketSale(){
$ticketType = TicketType::findOne(1);
$customer = Customer::findOne(1);
@ -536,9 +538,9 @@ class TicketController extends \backend\controllers\BackendController {
$discount = null;
$contract = Contract::findOne(19);
$megbizas = $contract->requests[0];
$ticketSale = new TicketSale(
[
'ticketType'=> $ticketType,
@ -550,15 +552,15 @@ class TicketController extends \backend\controllers\BackendController {
'ticketInstallmentRequest' => $megbizas
]
);
$ticketSale->doSale();
}
/**
* Finds the Ticket model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
*
* @param integer $id
*
* @param integer $id
* @return Ticket the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/

View File

@ -17,7 +17,7 @@ use backend\models\GiroKotegForm;
/**
* TicketInstallmentRequestController implements the CRUD actions for TicketInstallmentRequest model.
*
*
* TODO: FIX ACCESS
*/
class TicketInstallmentRequestController extends Controller
@ -47,7 +47,6 @@ class TicketInstallmentRequestController extends Controller
]
]
// everything else is denied
]
];
}
@ -66,18 +65,19 @@ class TicketInstallmentRequestController extends Controller
'dataProvider' => $dataProvider,
]);
}
/**
* Lists pending TicketInstallmentRequest models.
* @return mixed
*/
public function actionPending()
{
\Yii::info("Showing pending");
$model = new TicketInstallmentMarkForSendForm();
if ($model->load(Yii::$app->request->post()) ) {
$model->markForSend();
}
$searchModel = new TicketInstallmentRequestSearchPending();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
@ -102,7 +102,7 @@ class TicketInstallmentRequestController extends Controller
\Yii::$app->session->setFlash('success',"Megbízás teljesítve");
}
return $this->redirect(['ticket-installment-request/view',
return $this->redirect(['ticket-installment-request/view',
'id' => $model->id_ticket_installment_request,
]);
}
@ -115,15 +115,15 @@ class TicketInstallmentRequestController extends Controller
public function actionDownloadGiro()
{
$model = new GiroKotegForm();
if ($model->load(Yii::$app->request->post()) && $model->validate() ) {
$model->createKoteg();
return $this->redirect(['ugiro/view', 'id' => $model->koteg->id_ugiro]);
}
$searchModel = new TicketInstallmentRequestSearchDownloadGiro();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$model->action = "create";
return $this->render('index_download_giro', [
'searchModel' => $searchModel,
@ -197,7 +197,7 @@ class TicketInstallmentRequestController extends Controller
return $this->redirect(['index']);
}
public function actionTest( )
{
return $this->render('test');

View File

@ -21,6 +21,7 @@ use backend\models\TransferListUserGroupedSearch;
use backend\models\TransferLaterSearch;
use yii\helpers\Url;
use common\components\Helper;
use common\components\MpdfUtil;
/**
* TransferController implements the CRUD actions for Transfer model.
@ -66,23 +67,23 @@ class TransferController extends \backend\controllers\BackendController
],
];
}
public function actionPaymentLater(){
$searchModel = new TransferLaterSearch();
if ( \Yii::$app->request->isPost){
$searchModel->load(Yii::$app->request->post());
if ( $searchModel->doPayout()) {
return $this->redirect(['transfer/payment-later' ]);
}
}
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
if ( $searchModel->output =='pdf'){
$this->downloadPaymentLaterPDF($dataProvider);
}else if ( $searchModel->output =='xls'){
@ -91,9 +92,9 @@ class TransferController extends \backend\controllers\BackendController
$accounts = Account::read();
$users = User::read();
Url::remember("payment_later",Url::current());
return $this->render('payment_later', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
@ -245,31 +246,31 @@ class TransferController extends \backend\controllers\BackendController
exit ();
}
protected function downloadPaymentLaterPDF($dataProvider) {
// $mpdf = new \mPDF ( 'utf-8', 'A4' );
$mpdf = new \mPDF ( 'utf-8', 'A4-L' );
$mpdf = MpdfUtil::createMpdfWith6XConstructor ( 'utf-8', 'A4-L' );
$fn = "utolagos_fizetesek.pdf";
$mpdf->useSubstitutions = false;
$mpdf->simpleTables = true;
$mpdf->SetHeader ( "" );
$mpdf->setFooter ( '{PAGENO} / {nb}' );
$stylesheet = file_get_contents ( \Yii::getAlias ( '@vendor' . '/bower/bootstrap/dist/css/bootstrap.css' ) ); // external css
$mpdf->WriteHTML ( $stylesheet, 1 );
$mpdf->WriteHTML ( $this->renderPartial ( '_pdf_payment_later.php', [
'dataProvider' => $dataProvider
] ) );
$mpdf->Output ( $fn, 'D' );
exit ();
}
/**
* Lists all Transfer models.
* @return mixed
@ -278,7 +279,7 @@ class TransferController extends \backend\controllers\BackendController
{
$searchModel = new TransferSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$accounts = Account::read();
$searchModel->totalsTransfers();
$users = User::read();
@ -293,7 +294,7 @@ class TransferController extends \backend\controllers\BackendController
'accounts' => $accounts,
'users' => $users,
]);
}
/**
@ -446,23 +447,23 @@ class TransferController extends \backend\controllers\BackendController
$searchModel = new TransferListSearch();
$searchModel->accounts = Account::read();
$searchModel->users = User::read();
$searchModel->search(Yii::$app->request->queryParams);
if ( $searchModel->output === 'pdf'){
$user = User::findOne(\Yii::$app->user->id);
$mpdf=new \mPDF('utf-8', 'A4-L');
$mpdf= MpdfUtil::createMpdfWith6XConstructor('utf-8', 'A4-L');
$fn = "";
$ov = '_total_content_pdf';
$dt= "_letrehozva_".date("Ymd_His"). "_" . $user->username;
$dt= "_letrehozva_".date("Ymd_His"). "_" . $user->username;
$interval="";
$account = "";
$currentUser= "";
if ( isset($searchModel->currentAccount) ){
$account =( "_kassza_".$searchModel->currentAccount->name);
}
if ( isset($searchModel->currentUser) ){
$currentUser = ( "_felhasznalo_".$searchModel->currentUser->username);
}
@ -486,15 +487,15 @@ class TransferController extends \backend\controllers\BackendController
$fn="napi_bevetelek.teljes";
}
$fn = $fn. $interval . $dt .$account .$currentUser. ".pdf";
$mpdf->useSubstitutions=false;
$mpdf->simpleTables = true;
$mpdf->SetHeader( \Yii::$app->params[ "company_name" ] . " - Létrehozva: " .$user->username . ", ".\Yii::$app->formatter->asDatetime(time()) );
$mpdf->setFooter('{PAGENO} / {nb}');
$stylesheet = file_get_contents( \Yii::getAlias('@vendor'.'/bower/bootstrap/dist/css/bootstrap.css')); // external css
$mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML($this->renderPartial($ov, [
'searchModel' => $searchModel,
]));
@ -505,10 +506,10 @@ class TransferController extends \backend\controllers\BackendController
'searchModel' => $searchModel,
]);
}
}
/**
* Lists all Transfer models.
* @return mixed
@ -518,16 +519,16 @@ class TransferController extends \backend\controllers\BackendController
$searchModel = new TransferListUserGroupedSearch();
$searchModel->accounts = Account::read();
$searchModel->users = User::read();
$searchModel->search(Yii::$app->request->queryParams);
return $this->render('list_user_grouped', [
'searchModel' => $searchModel,
]);
}
/**
* Lists all Transfer models.
* @return mixed
@ -540,16 +541,16 @@ class TransferController extends \backend\controllers\BackendController
$searchModel->users = User::read();
$searchModel->productCategories = ProductCategory::read();
$searchModel->productOptions = Product::read();
$searchModel->search(Yii::$app->request->queryParams);
return $this->render('sale', [
'searchModel' => $searchModel,
]);
}
public function actionSalePdf(){
$searchModel = new TransferSaleSearch();
$searchModel->mode = 'admin';
@ -557,11 +558,11 @@ class TransferController extends \backend\controllers\BackendController
$searchModel->users = User::read();
$searchModel->productCategories = ProductCategory::read();
$searchModel->productOptions = Product::read();
$searchModel->search(Yii::$app->request->queryParams);
$mpdf=new \mPDF('utf-8', 'A4-L');
$mpdf= MpdfUtil::createMpdfWith6XConstructor('utf-8', 'A4-L');
$stylesheet = file_get_contents( \Yii::getAlias('@vendor'.'/bower/bootstrap/dist/css/bootstrap.css')); // external css
$mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML($this->renderPartial('_result_sale', [
@ -569,9 +570,9 @@ class TransferController extends \backend\controllers\BackendController
]));
$mpdf->Output('MyPDF.pdf', 'D');
exit;
}
/**
* Lists all Transfer models.
* @return mixed
@ -580,11 +581,11 @@ class TransferController extends \backend\controllers\BackendController
{
$searchModel = new TransferSummarySearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$accounts = Account::read();
$users = User::read();
return $this->render('summary', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
@ -592,7 +593,7 @@ class TransferController extends \backend\controllers\BackendController
'users' => $users,
]);
}
/**
* Displays a single Transfer model.
* @param integer $id
@ -604,16 +605,16 @@ class TransferController extends \backend\controllers\BackendController
'model' => $this->findModel($id),
]);
}
public function actionUnstorno($id)
{
$model = $this->findModel($id);
$model->unstorono();
Helper::flash("success", "Bérlet visszaállítva");
return $this->redirect( ['view' ,'id' => $model->id_transfer]);
}

View File

@ -10,6 +10,7 @@ use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use common\components\DetStatProcessor;
use common\components\MpdfUtil;
use backend\models\DestaUploadForm;
use yii\web\UploadedFile;
use yii\data\ArrayDataProvider;
@ -23,71 +24,71 @@ use common\models\MessageDetsta;
*/
class UgiroController extends Controller {
public function behaviors() {
return [
'verbs' => [
return [
'verbs' => [
'class' => VerbFilter::className (),
'actions' => [
'delete' => [
'post'
]
]
'actions' => [
'delete' => [
'post'
]
]
],
'access' => [
'access' => [
'class' => \yii\filters\AccessControl::className (),
'rules' => [
// allow authenticated users
[
[
'actions' => [ ],
'allow' => true,
'roles' => [
'roles' => [
'admin',
'employee',
'reception'
]
]
]
'reception'
]
]
]
]
// everything else is denied
];
}
/**
* Lists all Ugiro models.
*
*
* @return mixed
*/
public function actionIndex() {
$searchModel = new UgiroSearch ();
$dataProvider = $searchModel->search ( Yii::$app->request->queryParams );
return $this->render ( 'index', [
return $this->render ( 'index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider
'dataProvider' => $dataProvider
] );
}
/**
* Lists all Ugiro models.
*
*
* @return mixed
*/
public function actionItems($id) {
$searchModel = new UgiroSearch ();
$dataProvider = $searchModel->search ( Yii::$app->request->queryParams );
return $this->render ( 'index', [
return $this->render ( 'index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider
'dataProvider' => $dataProvider
] );
}
public function actionActivate() {
}
/**
* Displays a single Ugiro model.
*
* @param integer $id
*
* @param integer $id
* @return mixed
*/
public function actionView($id) {
@ -95,8 +96,8 @@ class UgiroController extends Controller {
if (Yii::$app->request->isPost) {
if ($model->status == Ugiro::$STATUS_RECIEVED) {
set_time_limit ( 1200 ); // 20 perc
$processor = new DetStatProcessor ( [
'koteg' => $model
$processor = new DetStatProcessor ( [
'koteg' => $model
] );
$processor->run ();
$this->redirect(['view', 'id' => $model->id_ugiro]);
@ -107,7 +108,7 @@ class UgiroController extends Controller {
} else {
if (isset ( $_GET ['output'] )) {
$output = $_GET ['output'];
if ($output == 'pdf') {
$this->downloadUgiroPdf ( $model );
}else if ($output == 'xls') {
@ -115,18 +116,18 @@ class UgiroController extends Controller {
}
}
}
$query = MessageDetsta::find();
$query->andWhere(['id_ugiro' => $model->id_ugiro]);
$query->orderBy([ 'created_at' => SORT_ASC ]);
$detstaDp = new ActiveDataProvider([
'query' => $query,
'pagination' => false,
'sort' => false
]);
return $this->render ( 'view', [
return $this->render ( 'view', [
'model' => $this->findModel ( $id ) ,
'detstaDp' => $detstaDp
] );
@ -136,7 +137,7 @@ class UgiroController extends Controller {
* @param \common\models\Ugiro $model
*/
protected function downloadUgiroXls($model) {
$fn = "köteg.". $model->id_ugiro . ".xls";
$query = new Query();
@ -159,7 +160,7 @@ class UgiroController extends Controller {
$dataProvider = new ActiveDataProvider(
[
'query' => $query,
'query' => $query,
'sort' => false,
'pagination' => false
]
@ -278,11 +279,11 @@ class UgiroController extends Controller {
exit ();
}
protected function downloadUgiroPdf($model) {
$mpdf = new \mPDF ( 'utf-8', 'A4-L' );
$mpdf = MpdfUtil::createMpdfWith6XConstructor ( 'utf-8', 'A4-L' );
$fn = "köteg.". $model->id_ugiro . ".pdf";
$mpdf->useSubstitutions = false;
@ -325,99 +326,99 @@ class UgiroController extends Controller {
/**
* Creates a new Ugiro model.
* If creation is successful, the browser will be redirected to the 'view' page.
*
*
* @return mixed
*/
public function actionCreate() {
$model = new Ugiro ();
if ($model->load ( Yii::$app->request->post () ) && $model->save ()) {
return $this->redirect ( [
return $this->redirect ( [
'view',
'id' => $model->id_ugiro
'id' => $model->id_ugiro
] );
} else {
return $this->render ( 'create', [
'model' => $model
return $this->render ( 'create', [
'model' => $model
] );
}
}
/**
* Updates an existing Ugiro model.
* If update is successful, the browser will be redirected to the 'view' page.
*
* @param integer $id
*
* @param integer $id
* @return mixed
*/
public function actionUpdate($id) {
$model = $this->findModel ( $id );
if ($model->load ( Yii::$app->request->post () ) && $model->save ()) {
return $this->redirect ( [
return $this->redirect ( [
'view',
'id' => $model->id_ugiro
'id' => $model->id_ugiro
] );
} else {
return $this->render ( 'update', [
'model' => $model
return $this->render ( 'update', [
'model' => $model
] );
}
}
/**
* Deletes an existing Ugiro model.
* If deletion is successful, the browser will be redirected to the 'index' page.
*
* @param integer $id
*
* @param integer $id
* @return mixed
*/
public function actionDelete($id) {
$this->findModel ( $id )->delete ();
return $this->redirect ( [
'index'
return $this->redirect ( [
'index'
] );
}
public function actionDetsta() {
$ugiro = Ugiro::findOne ( 31 );
$model = new DetStatProcessor ( [
'koteg' => $ugiro
$model = new DetStatProcessor ( [
'koteg' => $ugiro
] );
return $this->render ( 'detsta', [
'model' => $model
return $this->render ( 'detsta', [
'model' => $model
] );
}
public function actionUpload() {
$model = new DestaUploadForm ();
if (Yii::$app->request->isPost) {
$model->destaFile = UploadedFile::getInstance ( $model, 'destaFile' );
if ($model->upload ()) {
// file is uploaded successfully
return $this->redirect ( [
return $this->redirect ( [
'view',
'id' => $model->koteg->id_ugiro
'id' => $model->koteg->id_ugiro
] );
}
}
return $this->render ( 'upload', [
'model' => $model
return $this->render ( 'upload', [
'model' => $model
] );
}
public function actionGenerateDetsta() {
}
/**
* Finds the Ugiro model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
*
* @param integer $id
*
* @param integer $id
* @return Ugiro the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/

View File

@ -12,7 +12,6 @@ use yii\web\BadRequestHttpException;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\base\Object;
use backend\models\UserUpdate;
use common\models\Account;
use common\models\UserAccountAssignment;
@ -109,6 +108,8 @@ class UserController extends \backend\controllers\BackendController
public function updateAccountAssignments($model){
echo "saving accounts";
UserAccountAssignment::deleteAll(['id_user' => $model->id]);
foreach ( $model->selected_accounts as $id_account ){
$uaa = new UserAccountAssignment();

View File

@ -8,7 +8,7 @@ use backend\models\WarehouseSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\base\Object;
use yii\base\BaseObject;
/**
* WarehouseController implements the CRUD actions for Warehouse model.

View File

@ -2,6 +2,7 @@
namespace backend\models;
use common\models\HuBankAccountValidator;
use Yii;
use yii\base\Model;
use common\models\Card;
@ -16,25 +17,48 @@ use common\models\TicketInstallmentRequest;
* @property \Yii\web\UploadedFile $file
*/
class TicketInstallmentMarkForSendForm extends Model{
public $items;
public function rules(){
return [
['items', 'each', 'rule' => ['integer']],
['items', 'validateBankAccount'],
];
}
public function validateBankAccount($attribute, $params){
$items = TicketInstallmentRequest::find()->andWhere([
'in', 'id_ticket_installment_request' , $this->items
])->all();
\Yii::info("validateBankAccount:". count($items));
$validator = new HuBankAccountValidator();
foreach($items as $item){
\Yii::info("validateBankAccount2:". $item->id_ticket_installment_request);
/** @var Customer $customer */
$customer = $item->customer;
\Yii::info("validateBankAccount3:". $customer->username);
$isBankAccountValid = $validator->validate($customer->bank_account);
if (!$isBankAccountValid){
$errorMessage = "";
$errorMessage .= "Vendég=".$customer->name;
$errorMessage .= "; Kártya=".$customer->card->number;
$errorMessage .= "; Megbízás=".$item->id_ticket_installment_request;
$this->addError('items', "Hibás bankszámlaszám:" .$errorMessage );
}
}
}
public function markForSend(){
\Yii::info("mark for send");
if ( $this->validate() && isset($this->items ) && is_array($this->items ) ){
$updated = 0;
$updated = TicketInstallmentRequest::updateAll(['status' => TicketInstallmentRequest::$STATUS_MARKED_TO_SEND ],['in', 'id_ticket_installment_request' , $this->items]);
\Yii::$app->session->setFlash('success', $updated . " megbízás küldésre jelölve " );
}else{
\Yii::$app->session->setFlash('success', " Nem történt küldésre jelölés! " );
\Yii::$app->session->setFlash('error', " Nem történt küldésre jelölés! " . $this->getFirstError('items') );
}
}
}

View File

@ -7,7 +7,7 @@ use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Transfer;
use yii\db\Expression;
use yii\base\Object;
use yii\base\BaseObject;
use yii\db\Query;
use yii\helpers\ArrayHelper;
use common\components\Helper;

View File

@ -6,7 +6,7 @@ use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Transfer;
use yii\base\Object;
use yii\base\BaseObject;
use yii\db\Query;
use yii\db\Expression;
use common\models\Account;

View File

@ -7,7 +7,7 @@ use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Transfer;
use yii\db\Expression;
use yii\base\Object;
use yii\base\BaseObject;
use yii\db\Query;
use yii\helpers\ArrayHelper;
use common\models\Account;

View File

@ -49,31 +49,31 @@ class UserUpdate extends User {
];
}
public function validateEmail($attribute, $params){
/** @var User $user */
$user = User::find()
->andWhere(['email' => $this->email])->one();
if (isset($user)){
if ( $user->id != $this->id ){
$this->addError($attribute,'Az email cím már használatban van!');
}
}
}
public function validateUsername($attribute, $params){
/** @var User $user */
$user = User::find()
->andWhere(['username' => $this->username])->one();
if (isset($user)){
if ( $user->id != $this->id ){
$this->addError($attribute,'A felhasználónév már használatban van!');
}
}
}
// public function validateEmail($attribute, $params){
// /** @var User $user */
// $user = User::find()
// ->andWhere(['email' => $this->email])->one();
//
// if (isset($user)){
// if ( $user->id != $this->id ){
// $this->addError($attribute,'Az email cím már használatban van!');
// }
// }
//
// }
//
// public function validateUsername($attribute, $params){
// /** @var User $user */
// $user = User::find()
// ->andWhere(['username' => $this->username])->one();
//
// if (isset($user)){
// if ( $user->id != $this->id ){
// $this->addError($attribute,'A felhasználónév már használatban van!');
// }
// }
//
// }
/**
* @formatter:on
@ -87,6 +87,28 @@ class UserUpdate extends User {
}
}
}
public function validateEmail($attribute, $params) {
if (! $this->hasErrors ()) {
if ( !empty($this->email) ){
$user = User::findOne(['email' => $this->email]);
if ( isset($user) && $user->id != $this->id){
$this->addError ( $attribute, "Az email már használatban van (".$user->username.")");
}
}
}
}
public function validateUsername($attribute, $params) {
if (! $this->hasErrors ()) {
if ( !empty($this->email) ){
$user = User::findOne(['username' => $this->username]);
if ( isset($user) && $user->id != $this->id){
$this->addError ( $attribute, "A felhasználónév már használatban van (".$user->username.")");
}
}
}
}
public function attributeLabels() {
return [

View File

@ -4,7 +4,7 @@ use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\DetailView;
use yii\base\Widget;
use yii\base\Object;
use yii\base\BaseObject;
use yii\data\ArrayDataProvider;
use common\components\AccountStatisticWidget;
use common\components\DataProviderTotal;

View File

@ -4,7 +4,7 @@ use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\DetailView;
use yii\base\Widget;
use yii\base\Object;
use yii\base\BaseObject;
use yii\data\ArrayDataProvider;
use common\components\AccountStatisticWidget;
use common\components\DataProviderTotal;

View File

@ -18,6 +18,12 @@ use yii\i18n\Formatter;
class DateUtil
{
public static function fromUnixTimeStamp($timestamp){
$dt = DateUtil::utcDate();
$dt->setTimestamp($timestamp);
return $dt;
}
/**
* Get UTC today @00:00:00 .
* Helper method to generate date for mysql
@ -25,13 +31,49 @@ class DateUtil
* @return DateTime
* @throws Exception
*/
public static function todayStart( ){
$d2 = new DateTime();
public static function todayStart(){
$d2 = new DateTime();
return DateUtil::utcDate($d2);
}
/**
* @param $date \DateTime optional. The date to set as utc date. If not set, new DateTime() will be used
* @return DateTime the datetime object with time reset and utc timezone
*/
public static function utcDate($date = null){
$d2 = isset($date ) ? $date : new DateTime();
$d2 = DateUtil::withTimeZoneUTC($d2);
return DateUtil::resetTime($d2);
}
/**
* @param $date \DateTime optional. If not set,defaults to : new DateTime() .
* @return DateTime
*/
public static function utcDateTime($date = null){
$d2 = isset($date ) ? $date : new DateTime();
return DateUtil::withTimeZoneUTC($d2);
}
/**
* @param $date \DateTime
* @return DateTime
*/
public static function withTimeZoneUTC( $date = null){
$d2 = isset($date ) ? $date : new DateTime();
$d2->setTimezone( new DateTimeZone('UTC') );
$d2->setTime(0, 0);
return $d2;
}
/**
* @param $dateTime \DateTime
* @return \DateTime
*/
public static function resetTime($dateTime){
$dateTime->setTime(0, 0);
return $dateTime;
}
/**
* Get UTC t @00:00:00 .
* Helper method to generate date for mysql
@ -39,16 +81,12 @@ class DateUtil
* @return DateTime
* @throws Exception
*/
public static function tomorrowStart( ){
$d2 = new DateTime();
public static function tomorrowStart( $date = null){
$d2 = isset($date) ? $date : new DateTime();
$d2->add(new DateInterval('P1D'));
$d2->setTimezone( new DateTimeZone('UTC') );
$d2->setTime(0, 0);
return $d2;
return DateUtil::utcDate($d2);
}
public static function addMonth($timestamp, $monthCount = 1)
{
@ -99,7 +137,7 @@ class DateUtil
* @return string
* @throws InvalidConfigException
*/
public static function formatUtc($dateTimeObject)
public static function formatDateTimeUtc($dateTimeObject)
{
$formatter = new Formatter;
$formatter->datetimeFormat = 'php:Y-m-d H:i:s';
@ -127,6 +165,10 @@ class DateUtil
return $date;
}
public static function parseDateTime($dateTimeString){
return DateTime::createFromFormat('Y-m-d H:i:s', $dateTimeString, new DateTimeZone( 'UTC'));
}
/**
* @param integer $weekDay Numeric representation of the day of the week. @See https://www.php.net/manual/en/function.date.php
* @return string

View File

@ -4,7 +4,7 @@ namespace common\components;
use common\models\Transfer;
use yii\base\Object;
use yii\base\BaseObject;
use common\models\MessageDetstaLab;
use common\models\MessageDetstaTetel;
use common\models\MessageDetsta;
@ -12,13 +12,13 @@ use common\models\MessageDetstaFej;
use common\models\TicketInstallmentRequest;
/**
* Detstat üzenet mentése adatbázisba
*
*
* @property common\models\Ugiro $koteg
* @property common\models\giro\GiroDETSTA $giroDETSTA
*/
class DetStaDBSave extends Object
class DetStaDBSave extends BaseObject
{
/**
* giro köteg
* */
@ -35,21 +35,21 @@ class DetStaDBSave extends Object
public $messageFej;
/**messagedetsta lab*/
public $messageLab;
public $path;
/**messagedetsta tetelek*/
public $messageTetelek = [];
public function run(){
$this->saveMessageDetsta();
$this->saveMessageDetstaFej( );
$this->saveMessageDetstaLab();
$this->saveMessageDetstaTetelek();
}
/**
*
* */
@ -60,17 +60,17 @@ class DetStaDBSave extends Object
if ( isset( $this->koteg ) ){
$this->message->id_ugiro = $this->koteg->id_ugiro;
}
if ( !$this->message->save() ){
\Yii::error("Nem sikerült menteni a detsta üzenet fájlt");
throw new \Exception("Nem sikerült menteni a detsta üzenet fájtl");
}
\Yii::info("detsta üzenet mentve");
}
protected function readDate($date){
$date = trim($date);
if ( empty($date))
@ -81,7 +81,7 @@ class DetStaDBSave extends Object
}
return $dtime->format('Y-m-d');
}
/**
*
* */
@ -89,9 +89,9 @@ class DetStaDBSave extends Object
$this->messageFej = new MessageDetstaFej();
$fej = $this->giroDETSTA->fej;
/** @var common\components\giro\GiroDETSTAFej $fej */
$dtime = \DateTime::createFromFormat("yyyyMMdd","");
$this->messageFej->id_message = $this->message->id_message;
$this->messageFej->record_tipus = $fej->recordTipus;
$this->messageFej->uzenet_tipus = $fej->uzenetTipus;
@ -108,7 +108,7 @@ class DetStaDBSave extends Object
}
\Yii::info("detsta fej üzenet mentve");
}
protected function saveMessageDetstaLab( ){
$this->messageLab = new MessageDetstaLab();
$lab = $this->giroDETSTA->lab;
@ -120,25 +120,25 @@ class DetStaDBSave extends Object
$this->messageLab->visszautasitott_tetelek_osszerteke = $lab->visszautasitottTetelekSzama;
$this->messageLab->megnemvalaszolt_tetelek_szama = $lab->megNemValaszoltTetelekSzama;
$this->messageLab->megnemvalaszolt_tetelek_osszerteke = $lab->megNemValaszoltTetelekOsszerteke;
if ( !$this->messageLab->save(false)){
\Yii::error("Nem sikerült menteni a detsta üzenet lab fájlt");
throw new \Exception("Nem sikerült menteni a detsta üzenet lab fájlt");
}
\Yii::info("detsta lab üzenet mentve");
}
protected function saveMessageDetstaTetelek( ){
$tetelek = $this->giroDETSTA->tetelek;
foreach ($tetelek as $tetel){
$this->saveMessageDetstaTetel($tetel);
}
}
protected function saveMessageDetstaTetel($tetel ){
$mt = new MessageDetstaTetel();
$mt->id_message = $this->message->id_message;
$mt->record_tipus = $tetel->recordTipus ;
$mt->tetel_sorszam= $tetel->tetelSorszam ;
$mt->osszeg= $tetel->osszeg ;
@ -149,22 +149,22 @@ class DetStaDBSave extends Object
$mt->valasz_hivatkozasi_kod= $tetel->valaszHivatkozasiKod ;
$mt->eredeti_hivatkozasi_kod= $tetel->eredetiHivatkozasiKod ;
$mt->ugyfel_azonosito= $tetel->ugyfelAzonosito ;
$request = $this->readRequest($mt->tetel_sorszam);
if ( isset($request) ){
$mt->id_ticket_installment_request = $request->id_ticket_installment_request;
}
if ( !$mt->save(false)){
\Yii::error("Nem sikerült menteni a detsta üzenet tetelt");
throw new \Exception("Nem sikerült menteni a detsta üzenet tetelt");
}
\Yii::info("detsta tetel üzenet mentve");
$this->messageTetelek[] = $mt;
}
protected function readRequest($tetel_sorszam){
$query = TicketInstallmentRequest::find();
$query->innerJoin("ugiro_request_assignment","ugiro_request_assignment.id_request = ticket_installment_request.id_ticket_installment_request");
@ -173,6 +173,6 @@ class DetStaDBSave extends Object
$query->andWhere(['ticket_installment_request.number' => $tetel_sorszam]);
return $query->one();
}
}
}

View File

@ -2,7 +2,7 @@
namespace common\components;
use yii\base\Object;
use yii\base\BaseObject;
use common\models\Ugiro;
use common\components\giro\GiroDETSTA;
@ -14,7 +14,7 @@ use common\components\giro\GiroDETSTA;
* @property \common\models\UGiro $koteg
*
* */
class DetStatProcessor extends Object{
class DetStatProcessor extends BaseObject{
/**aktuális koteg, config paraméterként kapju*/
@ -154,4 +154,4 @@ class DetStatProcessor extends Object{
}
}
}

View File

@ -3,7 +3,7 @@
namespace common\components;
use common\models\Transfer;
use yii\base\Object;
use yii\base\BaseObject;
use common\models\TicketInstallmentRequest;
use common\components\giro\GiroDETSTATetel;
use common\models\Account;
@ -19,7 +19,7 @@ use common\models\Contract;
*
*
*/
class DetStatTetelProcessor extends Object {
class DetStatTetelProcessor extends BaseObject {
/**
* A válasz tétel . Ha nincs megadva, automatikus visszautasítjuk a megbízást
* */
@ -320,4 +320,4 @@ class DetStatTetelProcessor extends Object {
public function hasError() {
return false;
}
}
}

View File

@ -4,7 +4,7 @@ namespace common\components;
use common\models\Card;
class FreeUniqueCardNumberGenerator extends \yii\base\Object {
class FreeUniqueCardNumberGenerator extends \yii\base\BaseObject {
public $count;
public $keyset = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
public $length = 6;
@ -37,4 +37,4 @@ class FreeUniqueCardNumberGenerator extends \yii\base\Object {
protected function checkCacheUnique($number) {
return array_search ( $number, $this->cache ) === false;
}
}
}

View File

@ -147,6 +147,7 @@ class GD
public function save($file, $quality = 90)
{
try{
switch($this->_mime) {
case 'image/jpeg':
return imagejpeg($this->_image, $file, $quality);
@ -159,6 +160,9 @@ class GD
return imagegif($this->_image, $file);
break;
}
}catch (\Exception $e){
\Yii::error("Failed to save image image:", $e->getMessage());
}
return false;
}
}

View File

@ -538,4 +538,9 @@ class Helper {
return $result;
}
public static function isRestAllowVerifyOnly() {
return \Yii::$app->params ['rest_allow_verify_only'] == true;
}
}

View File

@ -1,4 +1,5 @@
<?php
namespace common\components;
use Yii;
@ -9,14 +10,15 @@ use common\components\GD;
class Image
{
/**
* @param UploadedFile $fileInstance
* @param string $dir relative dir from upload dir
* @param unknown $resizeWidth
* @param unknown $resizeHeight
* @param bool $resizeCrop
* @throws HttpException*/
/**
* @param UploadedFile $fileInstance
* @param string $dir relative dir from upload dir
* @param unknown $resizeWidth
* @param unknown $resizeHeight
* @param bool $resizeCrop
* @throws HttpException
*/
public static function upload(UploadedFile $fileInstance, $dir = '', $resizeWidth = null, $resizeHeight = null, $resizeCrop = false)
{
$fileName = Upload::getUploadPath($dir) . DIRECTORY_SEPARATOR . Upload::getFileName($fileInstance);
@ -25,29 +27,29 @@ class Image
? self::copyResizedImage($fileInstance->tempName, $fileName, $resizeWidth, $resizeHeight, $resizeCrop)
: $fileInstance->saveAs($fileName);
if(!$uploaded){
throw new HttpException(500, 'Cannot upload file "'.$fileName.'". Please check write permissions.');
if (!$uploaded) {
throw new HttpException(500, 'Cannot upload file "' . $fileName . '". Please check write permissions.');
}
return Upload::getLink($fileName);
}
public static function saveBinary($binary_data, $dir = '')
{
$fileName = Upload::getUploadPath($dir) . DIRECTORY_SEPARATOR . Upload::genFileName("jpg");
$uploaded = file_put_contents( $fileName, $binary_data );
$uploaded = file_put_contents($fileName, $binary_data);
if(!$uploaded){
throw new HttpException(500, 'Cannot upload file "'.$fileName.'". Please check write permissions.');
if (!$uploaded) {
throw new HttpException(500, 'Cannot upload file "' . $fileName . '". Please check write permissions.');
}
return Upload::getLink($fileName);
}
/**
*
*
* @param unknown $filename
* @param unknown $width
* @param unknown $height
@ -56,16 +58,14 @@ class Image
*/
static function thumb($filename, $width = null, $height = null, $crop = true)
{
if($filename && file_exists(($filename = Yii::getAlias('@frontend/web') . $filename)))
{
if ($filename && file_exists(($filename = Yii::getAlias('@frontend/web') . $filename))) {
$info = pathinfo($filename);
$thumbName = $info['filename'] . '-' . md5( filemtime($filename) . (int)$width . (int)$height . (int)$crop ) . '.' . $info['extension'];
$thumbName = $info['filename'] . '-' . md5(filemtime($filename) . (int)$width . (int)$height . (int)$crop) . '.' . $info['extension'];
$thumbFile = Yii::getAlias('@frontend/web') . DIRECTORY_SEPARATOR . Upload::$UPLOADS_DIR . DIRECTORY_SEPARATOR . 'thumbs' . DIRECTORY_SEPARATOR . $thumbName;
$thumbWebFile = '/' . Upload::$UPLOADS_DIR . '/thumbs/' . $thumbName;
if(file_exists($thumbFile)){
if (file_exists($thumbFile)) {
return $thumbWebFile;
}
elseif(FileHelper::createDirectory(dirname($thumbFile), 0777) && self::copyResizedImage($filename, $thumbFile, $width, $height, $crop)){
} elseif (FileHelper::createDirectory(dirname($thumbFile), 0777) && self::copyResizedImage($filename, $thumbFile, $width, $height, $crop)) {
return $thumbWebFile;
}
}
@ -74,39 +74,38 @@ class Image
static function copyResizedImage($inputFile, $outputFile, $width, $height = null, $crop = true)
{
if (extension_loaded('gd'))
{
$image = new GD($inputFile);
if (extension_loaded('gd')) {
try {
$image = new GD($inputFile);
if($height) {
if($width && $crop){
$image->cropThumbnail($width, $height);
if ($height) {
if ($width && $crop) {
$image->cropThumbnail($width, $height);
} else {
$image->resize($width, $height);
}
} else {
$image->resize($width, $height);
$image->resize($width);
}
} else {
$image->resize($width);
return $image->save($outputFile);
} catch (\Exception $e) {
\Yii::error("Failed to create thumbnail: ". $e->getMessage());
}
return $image->save($outputFile);
}
elseif(extension_loaded('imagick'))
{
} elseif (extension_loaded('imagick')) {
$image = new \Imagick($inputFile);
if($height && !$crop) {
if ($height && !$crop) {
$image->resizeImage($width, $height, \Imagick::FILTER_LANCZOS, 1, true);
}
else{
} else {
$image->resizeImage($width, null, \Imagick::FILTER_LANCZOS, 1);
}
if($height && $crop){
if ($height && $crop) {
$image->cropThumbnailImage($width, $height);
}
return $image->writeImage($outputFile);
}
else {
} else {
throw new HttpException(500, 'Please install GD or Imagick extension');
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace common\components;
use Mpdf\Mpdf;
use yii\base\BaseObject;
class MpdfUtil extends BaseObject
{
// mpdf version 6 constructor
//function mPDF($mode='',$format='A4',$default_font_size=0,$default_font='',$mgl=15,$mgr=15,$mgt=16,$mgb=16,$mgh=9,$mgf=9, $orientation='P') {
public static function createMpdfWith6XConstructor($mode = '', $format = 'A4', $default_font_size = 0, $default_font = '', $mgl = 15, $mgr = 15, $mgt = 16, $mgb = 16, $mgh = 9, $mgf = 9, $orientation = 'P')
{
return self::createMpdf([
'mode' => $mode,
'format' => $format,
'default_font_size' => $default_font_size,
'default_font' => $default_font,
'margin_left' => $mgl,
'margin_right' => $mgr,
'margin_top' => $mgt,
'margin_bottom' => $mgb,
'margin_header' => $mgh,
'margin_footer' => $mgf,
'orientation' => $orientation
]);
}
public static function createMpdf($options = [])
{
$mpdf = new Mpdf(
array_merge([
'mode' => 'utf-8',
'format' => 'A4'
], $options)
);
return $mpdf;
}
}

View File

@ -2,7 +2,7 @@
namespace common\components;
use yii\base\Object;
use yii\base\BaseObject;
use yii\db\Query;
use common\models\Product;
use yii\data\ActiveDataProvider;
@ -14,7 +14,7 @@ use common\models\Transfer;
* @property common\models\Account $account a kassza
* @property common\models\Product[] $products a termékek
* */
class ProductInventory extends Object{
class ProductInventory extends BaseObject{
@ -110,4 +110,4 @@ class ProductInventory extends Object{
}
?>
?>

View File

@ -0,0 +1,72 @@
<?php
namespace common\components;
class StopWatch
{
public $start;
public $splits = [];
public $stop;
// public function _(){
// $this->start();
// }
public function __construct()
{
$this->start();
}
public function start()
{
$this->start = $this->time();
}
public function split()
{
$this->splits[] = $this->time();
return $this->getSplit();
}
public function stop()
{
$this->stop = $this->time();
}
function time()
{
return time();
}
function diff($start, $end)
{
if (!isset($start) || !isset($end)) {
return -1;
}
return $end - $start;
}
function getSplit()
{
$lastSplit = null;
if (isset($this->stop)) {
$lastSplit = $this->stop;
} else {
$count = count($this->splits);
if ($count > 0) {
$lastSplit = $this->splits[$count - 1];
}
}
return $this->diff($this->start, $lastSplit);
}
function getTotal(){
return $this->diff($this->start, $this->stop);
}
}

File diff suppressed because one or more lines are too long

View File

@ -11,7 +11,7 @@ use common\models\Ticket;
class TransferPayout extends \yii\base\Object{
class TransferPayout extends \yii\base\BaseObject{
/**Current user*/
public $idUser = null;
@ -136,4 +136,4 @@ class TransferPayout extends \yii\base\Object{
}
}
}

View File

@ -2,34 +2,35 @@
namespace common\components\accountstate;
use yii\base\Object;
use common\models\User;
use common\models\Account;
use common\models\AccountState;
use common\components\DailyListing;
use common\components\MpdfUtil;
use yii\base\BaseObject;
/**
* @property common\models\AccountState $model
* */
class AccountStateMail extends Object {
class AccountStateMail extends BaseObject {
public $controller;
public $model;
public $user;
public $account;
public $message;
public $details;
public function init(){
$this->user = User::findOne($this->model->id_user);
$this->account = Account::findOne($this->model->id_account);
$this->details = null;
if ($this->model ->isTypeClose ()) {
$prev;
if ($this->model->type == AccountState::TYPE_CLOSE) {
if (isset ( $this->model->prev_state )) {
@ -41,28 +42,28 @@ class AccountStateMail extends Object {
}
$this->details = new DailyListing();
$this->details->loadAccountState ( $this->model );
$this->details->readModeAccountState();
// $this->details->readTotalEasy ();
// $this->details->readTotalDetailed ();
// $this->details->readTotalMedium ();
}
}
public function sednMail(){
$subject = $this->model->isTypeOpen() ? "Kassza nyitás " : "Kassza zárás";
$subject .= " - " . $this->user->username ." - ". $this->account->name;
$this->message = \Yii::$app->mailer->compose('account_state', [
'model' => $this->model,
'details' => $this->details
]);
$this->attachPdf();
try{
$this->message->setFrom(\Yii::$app->params['infoEmail'])
->setTo( \Yii::$app->params['notify_mail'] )
@ -71,21 +72,21 @@ class AccountStateMail extends Object {
}catch (\Exception $e){
\Yii::error("Nem sikerült elküldeni a kassza müvelet emailt");
}
}
protected function attachPdf(){
$mpdf=new \mPDF('utf-8', 'A4-L');
$mpdf= MpdfUtil::createMpdfWith6XConstructor('utf-8', 'A4-L');
$mpdf->useSubstitutions=false;
$mpdf->simpleTables = true;
$mpdf->SetHeader( \Yii::$app->params[ "company_name" ] . " - Létrehozva: " .$user->username . ", ".\Yii::$app->formatter->asDatetime(time()) );
$mpdf->setFooter('{PAGENO} / {nb}');
$stylesheet = file_get_contents( \Yii::getAlias('@vendor'.'/bower/bootstrap/dist/css/bootstrap.css')); // external css
$mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML($this->controller->renderPartial("@common/views/account-state/account_state_pdf", [
'model' => $this->model,
'details' => $this->details
@ -94,11 +95,11 @@ class AccountStateMail extends Object {
$dt= "_letrehozva_".date("Ymd_His"). "_" . $this->user->username;
$fn= $type .$dt.".pdf";
$content = $mpdf->Output($fn, 'S');
$this->message->attachContent($content, ['fileName' => $fn, 'contentType' => 'application/pdf']);
}
}
}

View File

@ -5,3 +5,4 @@ Yii::setAlias('backend', dirname(dirname(__DIR__)) . '/backend');
Yii::setAlias('console', dirname(dirname(__DIR__)) . '/console');
Yii::setAlias('rest', dirname(dirname(__DIR__)) . '/rest');
Yii::setAlias('customerapi', dirname(dirname(__DIR__)) . '/customerapi');
Yii::setAlias('mobileapi', dirname(dirname(__DIR__)) . '/mobileapi');

View File

@ -0,0 +1,582 @@
<?php
namespace common\manager;
use common\components\DateUtil;
use common\components\Helper;
use common\components\StopWatch;
use common\models\Card;
use common\models\CardKeyAssignment;
use common\models\DoorLog;
use common\models\DoorLogForTest;
use common\models\Key;
use common\models\Log;
use common\models\Ticket;
use common\models\VirtualKey;
use frontend\models\KeyToggleForm;
use yii\base\BaseObject;
use yii\base\InvalidConfigException;
use yii\db\Exception;
use yii\web\BadRequestHttpException;
use yii\web\ServerErrorHttpException;
/**
* Created by IntelliJ IDEA.
* User: rocho
* Date: 2018.12.17.
* Time: 6:12
*/
class DoorManager extends BaseObject
{
/**
* @param $identifier 00000000: nyomogombos nyitás
* @param $device string B(gomb)|Q(qrcode)|C(nfc),E(emergency)
* @param $direction string IN|OUT
* @param $verifyOnly boolean true: akkor csak lekerdezés, false: megtörtént a mozgás (ilyenkor vonunk le egy alkalmat)
* @param $createdAt number unix timestamp , override createdAt for doorLogs
* @param $date number unix timestamp, override date for validation check 'now'
* @return void
* @throws BadRequestHttpException
* @throws ServerErrorHttpException
* @throws \yii\base\InvalidConfigException
* @throws \yii\db\Exception
*/
public function move($identifier, $device, $direction, $verifyOnly, $createdAt = null, $date = null)
{
$requestId = uniqid("",false);
$stopWatch = new StopWatch();
// for testing purposes
if ( Helper::isRestAllowVerifyOnly() === false ){
\Yii::info("$requestId: verifyonly not allowed");
$verifyOnly = false;
}
\Yii::info("$requestId: move with next parameers:" . ";identifier" . $identifier . ";device" . $device . ";direction" . $direction . ";verifyOnly" . $verifyOnly . ";createdAt" . print_r($createdAt,true) . ";date" . print_r($date,true));
\Yii::info("$requestId: move get request: " . print_r($_GET, true));
\Yii::info("$requestId: move post request: " . print_r($_GET, true));
if (isset($createdAt)) {
$createdAt = DateUtil::parseDateTime($createdAt);
} else {
$createdAt = DateUtil::utcDateTime();
}
if (isset($date)) {
$date = DateUtil::parseDateTime($date);
} else {
$date = DateUtil::utcDate();
}
if ($device === 'E') {
$this->moveEmergency($requestId,$identifier, $device, $direction, $verifyOnly, $createdAt, $date);
return;
}
$cardNumber = $identifier;
$virtualKey = null;
switch ($direction) {
case 'IN':
$direction = DoorLog::$DIRECTION_IN;
break;
case 'OUT':
$direction = DoorLog::$DIRECTION_OUT;
break;
default:
throw new BadRequestHttpException("$requestId: Direction not supported: " . $direction);
}
// if device is qr code
if ($device == 'Q') {
// allow only virtual key
$virtualKey = VirtualKey::findOne(['number' => $identifier]);
if (!isset($virtualKey)) {
throw new BadRequestHttpException("$requestId: Virtual key not found: " . $identifier);
}
$card = Card::findOne($virtualKey->id_card);
if ($card != null) {
$card = Card::readCard($card->number);
}
if ($card == null) {
throw new BadRequestHttpException("$requestId: Card not found by virtual key: " . $identifier . '/' . $virtualKey->id_card);
}
$cardNumber = $card->number;
\Yii::info("$requestId: virtual key and card loaded in sec " . $stopWatch->split());
} else {
// load by rfid or card number
$card = Card::readCard(Helper::fixAsciiChars($identifier));
\Yii::info("$requestId: Card loaded in sec " . $stopWatch->split());
if (!isset($card)) {
throw new BadRequestHttpException("$requestId: Card not found with number: " . $identifier);
}
\Yii::info("$requestId: card loaded in sec " . $stopWatch->split());
$virtualKey = VirtualKey::findOne(['id_card' => $card->id_card]);
\Yii::info("$requestId: virtual key for card loaded in sec " . $stopWatch->split());
}
\Yii::info("$requestId: Card number " . $card->number);
if ($card->type == Card::TYPE_EMPLOYEE) {
$this->moveEmployee($identifier, $device, $direction, $verifyOnly, $createdAt, $date, $card, $cardNumber, $virtualKey);
return;
}
$this->moveCustomer($requestId, $identifier, $device, $direction, $verifyOnly, $createdAt, $date, $card, $cardNumber, $virtualKey);
}
function moveEmergency($requestId,$identifier, $device, $direction, $verifyOnly, $createdAt, $date)
{
\Yii::info("$requestId: emergency move");
try {
$createdAtStr = DateUtil::formatDateTimeUtc($createdAt);
\Yii::$app->db->beginTransaction();
$doorLog = new DoorLog();
$doorLog->version = 2;
$doorLog->direction = DoorLog::$DIRECTION_ALL_EMERGENCY;
$doorLog->source_app = $device;
$doorLog->created_at = $createdAtStr;
$doorLog->save(false);
Log::log(
[
'type' => Log::$TYPE_INFO,
'message' => 'Ajtó nyitás: vészhelyzet',
'id_door_log' => $doorLog->id_door_log
]
);
\Yii::$app->db->transaction->commit();
} catch (\Exception $e) {
\Yii::$app->db->transaction->rollBack();
throw $e;
}
}
function moveEmployee($identifier, $device, $direction, $verifyOnly, $createdAt, $date, $card, $cardNumber, $virtualKey)
{
/**
* if the card type is employee, neither customer nor ticket is needed.
* Free to enter/leave
*/
\Yii::info("employee move");
try {
$createdAtStr = DateUtil::formatDateTimeUtc($createdAt);
\Yii::$app->db->beginTransaction();
$doorLog = new DoorLog();
$doorLog->version = 2;
$doorLog->direction = $direction;
$doorLog->source_app = $device;
$doorLog->created_at = $createdAtStr;
$doorLog->id_card = $card->id_card;
$doorLog->card_flag = $card->flag;
if (!$verifyOnly) {
$doorLog->save(false);
Log::log(
[
'type' => Log::$TYPE_INFO,
'message' => 'Ajtó nyitás: munkatárs',
'id_door_log' => $doorLog->id_door_log
]
);
}
\Yii::$app->db->transaction->commit();
} catch (\Exception $e) {
\Yii::$app->db->transaction->rollBack();
throw $e;
}
}
/**
* @param $requestId
* @param $identifier string virtual key id, card rfid or card number
* @param $device string device
* @param $direction number direction
* @param $verifyOnly boolean only check or real move
* @param $createdAt
* @param $date
* @param $card
* @param $cardNumber
* @param $virtualKey
* @return void
* @throws BadRequestHttpException
* @throws ServerErrorHttpException
* @throws InvalidConfigException
* @throws Exception
*/
function moveCustomer($requestId, $identifier, $device, $direction, $verifyOnly, $createdAt, $date, $card, $cardNumber, $virtualKey)
{
\Yii::info("$requestId: move customer");
$stopWatch = new StopWatch();
try {
$createdAtStr = DateUtil::formatDateTimeUtc($createdAt);
\Yii::info("$requestId: crated at str: ". $createdAtStr);
\Yii::$app->db->beginTransaction();
$doorLog = new DoorLog();
$doorLog->version = 2;
$doorLog->direction = $direction;
$doorLog->source_app = $device;
$doorLog->created_at = $createdAtStr;
$doorLog->id_card = $card->id_card;
$doorLog->card_flag = $card->flag;
$activeTickets = Ticket::readActive($card, clone $date);
\Yii::info("$requestId: active ticket count:" . count($activeTickets));
/** @var Ticket $ticket */
$ticket = null;
if (isset($activeTickets) && count($activeTickets) > 0) {
$ticket = $activeTickets[0];
}
if (!isset($ticket)) {
throw new BadRequestHttpException("$requestId: No active ticket found for:" . $card->number);
}
\Yii::info("$requestId: ticket {$ticket->id_ticket} loaded in sec " . $stopWatch->split());
$doorLog->id_ticket_current = $ticket->id_ticket;
// customer is also required
$customer = $card->customer;
if (!isset($customer)) {
throw new BadRequestHttpException("$requestId: Customer not found for:" . $card->number);
}
$doorLog->id_customer = $customer->id_customer;
\Yii::info("$requestId: customer {$customer->id_customer} loaded in sec " . $stopWatch->split());
if (!$verifyOnly) {
// save the door log
$doorLog->save(false);
}
\Yii::info("$requestId: door log {$doorLog->id_door_log} saved in sec " . $stopWatch->split());
// if direction is in
if ($direction == DoorLog::$DIRECTION_IN) {
if ($card->isFlagDoor()) {
throw new BadRequestHttpException("$requestId: Card already 'IN': " . $card->id_card);
}
if ($card->isFlagKey()) {
throw new BadRequestHttpException("$requestId: Key required: " . $card->id_card);
}
if ($card->isFlagStatus()) {
throw new BadRequestHttpException("$requestId: Card has no active status: " . $card->id_card);
}
if (isset($virtualKey)) {
if (isset($virtualKey->direction_in_at)) {
throw new BadRequestHttpException("$requestId: Virtual key - already moved in: " . $identifier . '/' . $virtualKey->id_card);
}
$virtualKey->direction_in_at = Helper::getDateTimeString();
\Yii::info("$requestId: Setting virtual key direction_in_at");
if (!$verifyOnly) {
\Yii::info("$requestId: Updating virtual key");
$virtualKey->save(false);
}
}
// detect if need to increase usage count for ticket
if (!$verifyOnly) {
// if not verifyonly, check, if ticket usage count must be increased
$countDoorLogsForTicketSince = $this->getCountDoorLogsForTicketSince($ticket->id_ticket, DateUtil::utcDate(clone $date));
\Yii::info("$requestId: getCountDoorLogsForTicketSince: " . $countDoorLogsForTicketSince);
if (!isset($countDoorLogsForTicketSince)) {
$countDoorLogsForTicketSince = 0;
}
\Yii::info("$requestId: count of door logs '{$countDoorLogsForTicketSince}' loaded in sec " . $stopWatch->split());
// if the current event is the first door log today
if ($countDoorLogsForTicketSince == 1) {
// increase the ticket usage count with 1
$usageCount = $ticket->usage_count;
$ticket->usage_count += 1;
$ticket->save(false);
\Yii::info("$requestId: First ticket usage today, increasing usage count for card: " . $card->id_card);
Log::log(
[
'type' => Log::$TYPE_TICKET_USAGE_FIRST,
'message' => 'Bérlet használat(előtte: ' . $usageCount . ' -> utána: ' . $ticket->usage_count,
'id_ticket' => $ticket->id_ticket,
'id_door_log' => $doorLog->id_door_log
]
);
\Yii::info("$requestId: Ticket usage count increased after first doorlog of day in sec " . $stopWatch->split());
} else {
\Yii::info("$requestId: more then one door log today for card: " . $card->id_card);
// we have already a door log for today, other than this
// Now we split the day into 3hour intervalls, starting with the createdAt value of the first event.
// If the actual event happens in an interval, in which still now doorlog event happend, we increase
// the usage count with 1
// 3 óránként 1-et levonunk
$startOfDay = DateUtil::utcDate(clone $date);
$startOfTomorrow = DateUtil::tomorrowStart(clone $date);
$allDoorLogToday = DoorLog::find()
->andWhere(['>=', 'door_log.created_at', DateUtil::formatDateUtc($startOfDay)])
->andWhere(['<', 'door_log.created_at', DateUtil::formatDateUtc($startOfTomorrow)])
->andWhere(['id_ticket_current' => $ticket->id_ticket])
->andWhere(['in', 'direction', [DoorLog::$DIRECTION_IN_WITHOUT_MOVE, DoorLog::$DIRECTION_IN]])
->orderBy(['door_log.created_at' => SORT_ASC])
->all();
\Yii::info("$requestId: All door logs for today loaded in sec " . $stopWatch->split());
\Yii::info("$requestId: allDoorLogToday", print_r($allDoorLogToday, true));
if (isset($allDoorLogToday) && count($allDoorLogToday) > 0) {
$firstInToday = $allDoorLogToday[0];
}
if (isset($firstInToday)) {
\Yii::info("$requestId: first in today for card: " . $card->id_card . " was at " . $firstInToday->created_at);
$firstEntryDateTimeToday = DateUtil::parseDateTime($firstInToday->created_at);
$interval = \DateInterval::createFromDateString('3 hours');
$daterange = new \DatePeriod($firstEntryDateTimeToday, $interval, $startOfTomorrow);
$intervals = [];
$intervalStart = null;
foreach ($daterange as $intervalEnd) {
if (isset($intervalStart)) {
$intervals[] = $this->createTicketUsageInterval($intervalStart, $intervalEnd, $allDoorLogToday, $doorLog);
}
$intervalStart = clone $intervalEnd;
}
if ($intervalStart < $startOfTomorrow) {
$intervals[] = $this->createTicketUsageInterval($intervalStart, $startOfTomorrow, $allDoorLogToday, $doorLog);
}
$activeInterval = $this->getActiveInterval($intervals, $createdAt);
if (!isset($activeInterval)) {
throw new ServerErrorHttpException("$requestId: Active Interval not found");
}
$logCountInActiveInterval = count($activeInterval['logs']);
if ($logCountInActiveInterval == 1) {
$ticket->usage_count = $ticket->usage_count + 1;
$ticket->save(false);
\Yii::info("$requestId: Ticket usage count increased after first IN after first door_log in interval in sec " . $stopWatch->split());
}
}
}
}
}
if ($direction == DoorLog::$DIRECTION_OUT || $direction == DoorLog::$DIRECTION_OUT_WITHOUT_MOVE) {
if ($card->isFlagOutKey()) {
throw new BadRequestHttpException("$requestId: Can't exit with card has a key assigned");
}
if ($card->isFlagStatus()) {
throw new BadRequestHttpException("$requestId: Can't exit with card has inactive status");
}
$keyAssigned = CardKeyAssignment::findOne(['id_card' => $card->id_card]);
if (isset($keyAssigned)) {
throw new BadRequestHttpException("$requestId: Can't exit with card has a key assigned");
}
if (isset($virtualKey)) {
if (!isset($virtualKey->direction_in_at)) {
throw new BadRequestHttpException("$requestId: Virtual key: move out without move in");
}
if (isset($virtualKey->direction_out_at)) {
throw new BadRequestHttpException("$requestId: Virtual key: already move out");
}
$virtualKey->direction_out_at = Helper::getDateTimeString();
if (!$verifyOnly) {
$virtualKey->save(false);
}
}
$ticket->count_move_out = $ticket->usage_count;
if (!$verifyOnly) {
$ticket->save(false);
}
\Yii::info("$requestId: direction_out: ticket count_move_out set after direction_out in sec " . $stopWatch->split());
}
if (!$verifyOnly) {
Card::updateCardFlagTicket($ticket->id_ticket);
\Yii::info("$requestId: updateCardFlagTicket: card flag updated in sec " . $stopWatch->split());
// reload card after flag is set
$card = Card::readCard($cardNumber);
if ($direction == DoorLog::$DIRECTION_OUT_WITHOUT_MOVE || $direction == DoorLog::$DIRECTION_OUT) {
$card->flag_out = Helper::setBit($card->flag_out, Card::$FLAG_DOOR, true);
$card->flag = Helper::setBit($card->flag, Card::$FLAG_DOOR, false);
$card->save(false);
\Yii::info("$requestId: direction_out: Door flag updated in sec " . $stopWatch->split());
} else if ($direction == DoorLog::$DIRECTION_IN || $direction == DoorLog::$DIRECTION_IN_WITHOUT_MOVE) {
$card->flag_out = Helper::setBit($card->flag_out, Card::$FLAG_DOOR, false);
$card->flag = Helper::setBit($card->flag, Card::$FLAG_DOOR, true);
$card->save(false);
\Yii::info("$requestId: direction_in: Card flag updated in sec " . $stopWatch->split());
}
}
$stopWatch->stop();
\Yii::info("$requestId: finished in sec " . $stopWatch->getTotal());
\Yii::$app->db->transaction->commit();
\Yii::info("$requestId: Commited");
} catch (\Exception $e) {
\Yii::$app->db->transaction->rollBack();
\Yii::info("$requestId: rollbacked");
throw $e;
}
}
function getActiveInterval($intervals, $date)
{
foreach ($intervals as $interval) {
$start = $interval['start'];
$end = $interval['end'];
if ($start <= $date && $date < $end) {
return $interval;
}
}
return null;
}
function createTicketUsageInterval($start, $end, $allLogs, $actualDoorLog)
{
$result = ['start' => $start, 'end' => $end, 'logs' => []];
foreach ($allLogs as $log) {
$createdAt = DateUtil::parseDateTime($log->created_at);
if ($createdAt >= $start && $createdAt < $end) {
$result['logs'][] = $log;
}
}
return $result;
}
function getCountDoorLogsForTicketSince($idTicket, $since)
{
\Yii::info("getting door log count for today");
return DoorLog::find()
->innerJoinWith('card')
->andWhere(['card.id_ticket_current' => $idTicket])
->andWhere(['in', 'door_log.direction', [DoorLog::$DIRECTION_IN, DoorLog::$DIRECTION_IN_WITHOUT_MOVE]])
->andWhere(['>=', 'door_log.created_at', DateUtil::formatDateUtc($since)])
->count();
}
public function readActive($cardNumber)
{
$card = Card::readCard($cardNumber);
return Ticket::readActive($card);
}
public function resetLogs($cardNumber)
{
$card = Card::readCard($cardNumber);
$card->flag = 0;
$card->flag_out = 0;
$card->save(false);
Card::updateCardFlagTicket($card->id_card);
DoorLog::deleteAll(
['id_card' => $card->id_card]
);
// todo: revoke all assigned key
$this->revokeKey($cardNumber, "f100");
}
public function getLogs($cardNumber)
{
return DoorLog::findAll(
['id_card' => $cardNumber]
);
}
public function getInfo($cardNumber)
{
$card = Card::readCard($cardNumber);
return [
'card' => $card,
'customer' => $card->customer,
'tickets' => Ticket::readActive($card),
'doorLogs' => DoorLog::findAll(
['id_card' => $card->id_card]
),
'lastDoorLog' => DoorLog::find()->orderBy(['id_door_log' => SORT_DESC])->limit(1)->one(),
'doorLogCount' => DoorLog::find()->count()
];
}
public function createLog()
{
\Yii::info("Post create log:" . \Yii::$app->request->method);
if (\Yii::$app->request->isPost) {
$log = new DoorLogForTest();
if ($log->load(\Yii::$app->request->post(), "")) {
if ($log->validate()) {
\Yii::info("Door log saving:" . $log->created_at);
$log->save(false);
return $log;
} else {
throw new BadRequestHttpException(print_r($log->getErrors(), true));
}
} else {
\Yii::info("validated" . print_r($log->errors, true));
throw new BadRequestHttpException();
}
}
throw new BadRequestHttpException('Not a Post');
}
function checkoutKey($cardNumber, $keyNumber)
{
$model = new KeyToggleForm();
$model->card = Card::readCard($cardNumber);
$model->customer = $model->card->customer;
$model->keyCard = $model->card;
$model->keyModel = $model->readKey($keyNumber);
$model->assign();
}
function revokeKey($cardNumber, $keyNumber)
{
$model = new KeyToggleForm();
$model->card = Card::readCard($cardNumber);
$model->customer = $model->card->customer;
$model->keyCard = $model->card;
$model->keyModel = $model->readKey($keyNumber);
$model->revoke();
}
}

View File

@ -0,0 +1,122 @@
<?php
namespace common\manager;
use common\models\Card;
use common\models\CardEventRegistrationForm;
use common\models\Customer;
use common\models\Event;
use common\models\EventRegistration;
use common\models\MobileDevice;
use common\models\Ticket;
use customerapi\models\available\EventInterval;
use customerapi\models\registrations\EventRegistrationAvailable;
use customerapi\models\details\EventRegistrationView;
use Exception;
use Yii;
use yii\base\BaseObject;
use yii\db\ActiveRecord;
use yii\db\Query;
use yii\web\BadRequestHttpException;
use yii\web\NotFoundHttpException;
use yii\web\ServerErrorHttpException;
/**
* Created by IntelliJ IDEA.
* User: rocho
* Date: 2018.12.17.
* Time: 6:12
*/
class MobileDeviceManager extends BaseObject
{
public function login($cardNumber, $deviceIdentifier)
{
$card = Card::find()->andWhere(
['number' => $cardNumber]
)->one();
if ( $card == null ){
throw new NotFoundHttpException();
}
$device = MobileDevice::find()
->andWhere(
[
'id_card' => $card->id_card,
'device_identifier' => $deviceIdentifier
]
)->one();
if ( $device === null ){
throw new NotFoundHttpException();
}
// if (
// in_array($device->status, [MobileDevice::STATUS_ACTIVE, MobileDevice::STATUS_INACTIVE], true) === false ){
// throw new NotFoundHttpException();
// }
return $device;
}
public function create($cardNumber, $deviceIdentifier, $deviceName)
{
$card = Card::find()->andWhere(
['number' => $cardNumber]
)->one();
if ( $card == null ){
throw new NotFoundHttpException();
}
// do not allow registering cards without customer
$customer = Customer::find()->andWhere(['id_customer_card' => $card->id_card])->one();
if ( $customer == null ){
throw new NotFoundHttpException();
}
$device = MobileDevice::find()
->andWhere(
[
'id_card' => $card->id_card,
'device_identifier' => $deviceIdentifier
]
)->one();
if ( $device ){
throw new BadRequestHttpException("Device already exists, can't create");
}
$device = new MobileDevice();
$device->device_identifier = $deviceIdentifier;
$device->id_card = $card->id_card;
$device->status = MobileDevice::STATUS_INACTIVE;
$device->device_name = $deviceName;
$device->save(false);
return $device;
}
/**
* @param $cardNumber
* @param $deviceIdentifier
* @return array|MobileDevice|ActiveRecord
* @throws BadRequestHttpException
* @throws NotFoundHttpException
*/
public function loginOrCreate($cardNumber, $deviceIdentifier, $deviceName)
{
try {
return $this->login($cardNumber, $deviceIdentifier);
} catch (\Exception $e) {
return $this->create($cardNumber, $deviceIdentifier, $deviceName);
}
}
}

View File

@ -34,6 +34,7 @@ class Card extends \common\models\BaseFitnessActiveRecord
const TYPE_BARCODE = 30;
const TYPE_OLD = 40;
const TYPE_EMPLOYEE = 50;
const TYPE_REVIEW = 60;
public static $FLAG_TICKET = 0; //has valid ticket
@ -164,6 +165,7 @@ class Card extends \common\models\BaseFitnessActiveRecord
self::TYPE_BARCODE => Yii::t('common/card', 'BARCODE'),
self::TYPE_OLD => Yii::t('common/card', 'OLD'),
self::TYPE_EMPLOYEE => Yii::t('common/card', 'Munkatárs'),
self::TYPE_REVIEW => Yii::t('common/card', 'Review'),
];
}

View File

@ -12,6 +12,7 @@ use yii\behaviors\TimestampBehavior;
* @property integer $id_card
* @property integer $id_key
* @property integer $id_user
* @property string $virtual_key
* @property string $created_at
* @property string $updated_at
*/

View File

@ -6,6 +6,7 @@ use Yii;
use yii\base\Exception;
use yii\base\InvalidConfigException;
use yii\base\NotSupportedException;
use yii\filters\RateLimitInterface;
use yii\web\IdentityInterface;
/**
@ -42,7 +43,7 @@ use yii\web\IdentityInterface;
* @property string password_hash
* @property string auth_key
*/
class Customer extends BaseFitnessActiveRecord implements IdentityInterface
class Customer extends BaseFitnessActiveRecord implements IdentityInterface, RateLimitInterface
{
const STATUS_DELETED = 0;
@ -339,4 +340,23 @@ class Customer extends BaseFitnessActiveRecord implements IdentityInterface
}
}
public function getRateLimit($request, $action)
{
return [1000,3600];
// TODO: Implement getRateLimit() method.
}
public function loadAllowance($request, $action)
{
// TODO: Implement loadAllowance() method.
return [1000,3600];
}
public function saveAllowance($request, $action, $allowance, $timestamp)
{
// TODO: Implement saveAllowance() method.
return [1000,3600];
}
}

View File

@ -22,12 +22,29 @@ use yii\helpers\ArrayHelper;
* @property integer id_ticket_current
* @property integer card_flag
* @property integer flag_out
* @property integer version
*/
class DoorLog extends \yii\db\ActiveRecord
{
public static $SOURCE_APP_FORGO_VILLA = "forgo_villa";
public static $SOURCE_APP_FITNESS_ADMIN = "fitness_admin";
public static $SOURCE_APP_FORGO_VILLA = "forgo_villa";
public static $SOURCE_APP_FITNESS_ADMIN = "fitness_admin";
public static $DIRECTION_OUT_MANUAL_READ_KEY_ASSIGNED = -2; // "Kézi olvasás/Kulcs ki",
public static $DIRECTION_IN_MANUAL_READ_KEY_UNASSIGNED = -1; // "Kézi olvasás/Kulcs vissza",
public static $DIRECTION_ALL_MANUAL_READ = 0; // "Kézi olvasás",
public static $DIRECTION_OUT_WITHOUT_MOVE = 1; // "KI olvastatás mozgás nélkül",
public static $DIRECTION_IN_WITHOUT_MOVE = 3; // "BE olvastatás mozgás nélkül",
public static $DIRECTION_OUT = 5; // "KI mozgás",
public static $DIRECTION_IN = 7; // "BE mozgás",
public static $DIRECTION_OUT_ERROR_KEY_ASSIGNED = 9; // "KI olvastatás, van érvényes öltöző kulcs (nem enged)",
public static $DIRECTION_IN_ERROR_KEY_MISSING = 11; // "BE olvastatás, nincs érvényes öltöző kulcs (nem enged)",
public static $DIRECTION_OUT_NO_TICKET = 17; // "Bérlet érvényességi időn kívüli KI olvastatás (nem enged)",
public static $DIRECTION_IN_NO_TICKET = 19; // "Bérlet érvényességi időn kívüli BE olvastatás (nem enged)",
public static $DIRECTION_ALL_EMERGENCY = 128; // "Vésznyitás",
public static $DIRECTION_ALL_CARD_BLOCKED = 256; // "Kártya tiltva -> információ mező",
/**
* @inheritdoc
*/
@ -35,16 +52,21 @@ class DoorLog extends \yii\db\ActiveRecord
{
return 'door_log';
}
public function behaviors()
{
return ArrayHelper::merge( [
[
'class' => TimestampBehavior::className(),
'value' => function(){ return date('Y-m-d H:i:s' ); },
'updatedAtAttribute' => false,
]
], parent::behaviors());
return ArrayHelper::merge([
[
'class' => TimestampBehavior::className(),
'value' => function ($event) {
if ( isset($event->sender->created_at) ){
return $event->sender->created_at;
}
return date('Y-m-d H:i:s');
},
'updatedAtAttribute' => false,
]
], parent::behaviors());
}
/**
@ -75,133 +97,147 @@ class DoorLog extends \yii\db\ActiveRecord
'source_app' => Yii::t('common/door_log', 'Eszköz'),
];
}
public function getCustomer(){
return $this->hasOne( Customer::className(), ["id_customer" =>"id_customer" ] );
}
public function getCustomerName(){
$result = "";
if (isset($this->customer)){
$result = $this->customer->name;
}
return $result;
}
public function getCard(){
return $this->hasOne( Card::className(), ["id_card" =>"id_card" ] );
}
public function getCardNumber(){
$result = "";
if (isset($this->card)){
$result = $this->card->number;
}
return $result;
}
public function getKey(){
return $this->hasOne( Key::className(), ["id_key" =>"id_key" ] );
}
public function getKeyNumber(){
$result = "";
if (isset($this->key)){
$result = $this->key->number;
}
return $result;
}
public function getDirectionName(){
$result = "";
if ( $this->source_app == 'forgo_villa'){
if (isset($this->direction)){
$result = Helper::getArrayValue(self::getDirectionTypes() , $this->direction, "-");
}
}else{
$result = "Kézi olvasás";
}
return $result;
}
public static function getSourceAppName($source_app){
$result = "";
switch ($source_app){
case self::$SOURCE_APP_FITNESS_ADMIN :
$result = "Recepciós alkalmazás";
break;
case self::$SOURCE_APP_FORGO_VILLA:
$result = "Forgó villa";
break;
}
return $result;
}
public static function getDirectionTypes( ){
return [
-2 => "Kézi olvasás/Kulcs ki",
-1 => "Kézi olvasás/Kulcs vissza",
0 => "Kézi olvasás",
1 => "KI olvastatás mozgás nélkül",
3 => "BE olvastatás mozgás nélkül",
5 => "KI mozgás",
7 => "BE mozgás",
9 => "KI olvastatás, van érvényes öltöző kulcs (nem enged)",
11 => "BE olvastatás, nincs érvényes öltöző kulcs (nem enged)",
17 => "Bérlet érvényességi időn kívüli KI olvastatás (nem enged)",
19 => "Bérlet érvényességi időn kívüli BE olvastatás (nem enged)",
128 => "Vésznyitás",
256 => "Kártya tiltva -> információ mező",
];
}
public static function getCardFlagTexts( ){
return [
0 => "Kártya érvényes bérlettel",
1 => "Nincs érvényes bérlet",
2 => "Kártya inaktív/Érvényes bérlet",
3 => "Kártya inaktív/Nincs érvényes bérlet"
];
}
public function getCustomer()
{
return $this->hasOne(Customer::className(), ["id_customer" => "id_customer"]);
}
public static function mkDoorLog($direction,$card,$customer = null,$key = null){
public function getCustomerName()
{
$result = "";
if (isset($this->customer)) {
$result = $this->customer->name;
}
return $result;
}
if ( !Helper::isKeyToggleDoorLogEnabled() ){
return;
public function getCard()
{
return $this->hasOne(Card::className(), ["id_card" => "id_card"]);
}
public function getCardNumber()
{
$result = "";
if (isset($this->card)) {
$result = $this->card->number;
}
return $result;
}
public function getKey()
{
return $this->hasOne(Key::className(), ["id_key" => "id_key"]);
}
public function getKeyNumber()
{
$result = "";
if (isset($this->key)) {
$result = $this->key->number;
}
return $result;
}
public function getDirectionName()
{
$result = "";
if ($this->source_app == 'forgo_villa') {
if (isset($this->direction)) {
$result = Helper::getArrayValue(self::getDirectionTypes(), $this->direction, "-");
}
} else {
$result = "Kézi olvasás";
}
return $result;
}
public static function getSourceAppName($source_app)
{
$result = "";
switch ($source_app) {
case self::$SOURCE_APP_FITNESS_ADMIN :
$result = "Recepciós alkalmazás";
break;
case self::$SOURCE_APP_FORGO_VILLA:
$result = "Forgó villa";
break;
}
return $result;
}
public static function getDirectionTypes()
{
return [
-2 => "Kézi olvasás/Kulcs ki",
-1 => "Kézi olvasás/Kulcs vissza",
0 => "Kézi olvasás",
1 => "KI olvastatás mozgás nélkül",
3 => "BE olvastatás mozgás nélkül",
5 => "KI mozgás",
7 => "BE mozgás",
9 => "KI olvastatás, van érvényes öltöző kulcs (nem enged)",
11 => "BE olvastatás, nincs érvényes öltöző kulcs (nem enged)",
17 => "Bérlet érvényességi időn kívüli KI olvastatás (nem enged)",
19 => "Bérlet érvényességi időn kívüli BE olvastatás (nem enged)",
128 => "Vésznyitás",
256 => "Kártya tiltva -> információ mező",
];
}
public static function getCardFlagTexts()
{
return [
0 => "Kártya érvényes bérlettel",
1 => "Nincs érvényes bérlet",
2 => "Kártya inaktív/Érvényes bérlet",
3 => "Kártya inaktív/Nincs érvényes bérlet"
];
}
public static function mkDoorLog($direction, $card, $customer = null, $key = null)
{
if (!Helper::isKeyToggleDoorLogEnabled()) {
return;
}
$dlog = new DoorLog();
$dlog->id_card = $card->id_card;
$dlog = new DoorLog();
$dlog->id_card = $card->id_card;
if ( isset($customer)){
$dlog->id_customer = $customer->id_customer;
}
if (isset($customer)) {
$dlog->id_customer = $customer->id_customer;
}
if ( isset($key)){
$dlog->id_key = $key->id_key;
}
$dlog->direction = $direction;
$dlog->type = $card->type;
$dlog->source_app = DoorLog::$SOURCE_APP_FITNESS_ADMIN;
if (isset($key)) {
$dlog->id_key = $key->id_key;
}
$dlog->direction = $direction;
$dlog->type = $card->type;
$dlog->source_app = DoorLog::$SOURCE_APP_FITNESS_ADMIN;
$dlog->id_account = Account::readDefault();
$dlog->id_account = Account::readDefault();
if ( $dlog->direction == 0){
$dlog->card_flag = $card->validity;
}else{
$dlog->card_flag = -1;
}
if ($dlog->direction == 0) {
$dlog->card_flag = $card->validity;
} else {
$dlog->card_flag = -1;
}
$dlog->created_at = date('Y-m-d H:i:s');
$dlog->save(false);
}
$dlog->created_at = date('Y-m-d H:i:s');
$dlog->save(false);
}
}

View File

@ -0,0 +1,49 @@
<?php
namespace common\models;
use Yii;
use common\components\Helper;
use yii\behaviors\TimestampBehavior;
use yii\helpers\ArrayHelper;
/**
* This is the model class for table "door_log".
*
* @property integer $id_door_log
* @property integer $id_card
* @property integer $id_customer
* @property integer $id_key
* @property integer $direction
* @property integer $type
* @property integer $id_account
* @property string $created_at
* @property string $source_app
* @property integer id_ticket_current
* @property integer card_flag
* @property integer flag_out
*/
class DoorLogForTest extends DoorLog
{
public function behaviors()
{
return [];
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[
['id_card', 'id_customer', 'id_key', 'direction', 'type', 'id_ticket_current'], 'integer'
],
[['created_at'], 'string'],
[['created_at'], 'required'],
];
}
}

View File

@ -0,0 +1,42 @@
<?php
namespace common\models;
class HuBankAccountValidator
{
public function validate($bankAccount){
if ( !isset($bankAccount)){
// \Yii::error("HuBankAccountValidator: bank account is null");
return false;
}
$stripedBankAccount = preg_replace('/\s+/', '', $bankAccount);
if ( !(strlen($stripedBankAccount) == 24 || strlen($stripedBankAccount) == 16)){
// \Yii::error("HuBankAccountValidator: bank account length is invalid");
return false;
}
$arrayOfNumbers = str_split($stripedBankAccount);
$multipliers = [9,7,3,1];
$groups = [0,0,0];
for ( $i = 0; $i < count($arrayOfNumbers); $i++ ) {
$number = $arrayOfNumbers[$i];
$multiplier = $multipliers[$i % 4];
$total = $multiplier * $number;
$groups[intval($i / 8)] += $total ;
}
$sumOfGroups = 0;
foreach ($groups as $group){
$sumOfGroups += $group;
}
$mod = $sumOfGroups % 10;
if ( $mod > 0 ){
// \Yii::error("HuBankAccountValidator: bank account groups are invalid: " . $groups[0] .",". $groups[1] . "," . $groups[2],true);
return false;
}
return true;
}
}

View File

@ -33,67 +33,71 @@ use yii\helpers\Console;
*/
class Log extends BaseFitnessActiveRecord
{
public static $TYPE_INFO = 10;
public static $TYPE_ERR = 20;
public static $TYPE_TICKET_USAGE_FIRST = 30;
public static $TYPE_TICKET_USAGE_MULTIPLE = 40;
public static $TYPE_LOGIN = 50;
public static $TYPE_DEFAULT_ACCOUNT= 60;
public static $TYPE_CREATE_CUSTOMER= 70;
public static $TYPE_PROCUREMENT_UPDATE = 80;
public static $TYPE_TICKET_COUNT_MOVE_OUT = 90;
public static $TYPE_WASTE = 100;
public static $TYPE_NEWSLETTER_SUBSCRIBE = 110;
public static $TYPE_NEWSLETTER_UNSUBSCRIBE = 120;
public static $TYPE_NEWSLETTER_SENT = 130;
public static $TYPE_TICKET_EXPIRE_SENT = 140;
public static $TYPE_NEWSLETTER_SEND_START = 150;
public static $TYPE_NEWSLETTER_SEND_END = 160;
public static $TYPE_KEY_ASSIGN = 170;
public static $TYPE_KEY_UNASSIGN = 180;
public static $TYPE_TOWEL_IN = 190;
public static $TYPE_TOWEL_OUT = 200;
public static $TYPE_CRUD = 210;
public static $TYPE_TICKET_UPDATED_BY_ADMIN = 220;
public static $TYPE_INFO = 10;
public static $TYPE_ERR = 20;
public static $TYPE_TICKET_USAGE_FIRST = 30;
public static $TYPE_TICKET_USAGE_MULTIPLE = 40;
public static $TYPE_LOGIN = 50;
public static $TYPE_DEFAULT_ACCOUNT = 60;
public static $TYPE_CREATE_CUSTOMER = 70;
public static $TYPE_PROCUREMENT_UPDATE = 80;
public static $TYPE_TICKET_COUNT_MOVE_OUT = 90;
public static $TYPE_WASTE = 100;
public static $TYPE_NEWSLETTER_SUBSCRIBE = 110;
public static $TYPE_NEWSLETTER_UNSUBSCRIBE = 120;
public static $TYPE_NEWSLETTER_SENT = 130;
public static $TYPE_TICKET_EXPIRE_SENT = 140;
public static $TYPE_NEWSLETTER_SEND_START = 150;
public static $TYPE_NEWSLETTER_SEND_END = 160;
public static $TYPE_KEY_ASSIGN = 170;
public static $TYPE_KEY_UNASSIGN = 180;
public static $TYPE_TOWEL_IN = 190;
public static $TYPE_TOWEL_OUT = 200;
public static $TYPE_CRUD = 210;
public static $TYPE_TICKET_UPDATED_BY_ADMIN = 220;
public static $TYPE_MOBILE_DEVICE_STATUS = 230;
public static function getTypes(){
return [
Log::$TYPE_INFO => "Info",
Log::$TYPE_ERR => "Hiba",
Log::$TYPE_TICKET_USAGE_FIRST => "Bérlet használat",
Log::$TYPE_TICKET_USAGE_MULTIPLE => "Többszöri bérlet használat",
Log::$TYPE_LOGIN => "Bejelentkezés",
Log::$TYPE_DEFAULT_ACCOUNT=> "Alapértelmezett kassza",
Log::$TYPE_CREATE_CUSTOMER=> "Új vendég",
Log::$TYPE_PROCUREMENT_UPDATE => "Beszerzés módosítás",
Log::$TYPE_TICKET_COUNT_MOVE_OUT => "Ki mozgás",
Log::$TYPE_WASTE => "Selejt",
Log::$TYPE_NEWSLETTER_SUBSCRIBE => "Feliratkozás hirlevélre",
Log::$TYPE_NEWSLETTER_UNSUBSCRIBE => "Leiratkozás hírlevélről",
Log::$TYPE_NEWSLETTER_SENT => "Hirlevél elküldve",
Log::$TYPE_TICKET_EXPIRE_SENT => "Bérlet lejáart figyelmeztetés elküldve",
Log::$TYPE_NEWSLETTER_SEND_START => "Hirlevél küldés start",
Log::$TYPE_NEWSLETTER_SEND_END => "Hirlevél küldés vége",
Log::$TYPE_KEY_ASSIGN => "Kulcs kiadás",
Log::$TYPE_KEY_UNASSIGN => "Kulcs visszaadás",
Log::$TYPE_TOWEL_IN => "Törölköző ki",
Log::$TYPE_TOWEL_OUT => "Törölköző vissza",
Log::$TYPE_CRUD => "CRUD",
Log::$TYPE_TICKET_UPDATED_BY_ADMIN => "Bérlet módosítás"
public static function getTypes()
{
return [
Log::$TYPE_INFO => "Info",
Log::$TYPE_ERR => "Hiba",
Log::$TYPE_TICKET_USAGE_FIRST => "Bérlet használat",
Log::$TYPE_TICKET_USAGE_MULTIPLE => "Többszöri bérlet használat",
Log::$TYPE_LOGIN => "Bejelentkezés",
Log::$TYPE_DEFAULT_ACCOUNT => "Alapértelmezett kassza",
Log::$TYPE_CREATE_CUSTOMER => "Új vendég",
Log::$TYPE_PROCUREMENT_UPDATE => "Beszerzés módosítás",
Log::$TYPE_TICKET_COUNT_MOVE_OUT => "Ki mozgás",
Log::$TYPE_WASTE => "Selejt",
Log::$TYPE_NEWSLETTER_SUBSCRIBE => "Feliratkozás hirlevélre",
Log::$TYPE_NEWSLETTER_UNSUBSCRIBE => "Leiratkozás hírlevélről",
Log::$TYPE_NEWSLETTER_SENT => "Hirlevél elküldve",
Log::$TYPE_TICKET_EXPIRE_SENT => "Bérlet lejáart figyelmeztetés elküldve",
Log::$TYPE_NEWSLETTER_SEND_START => "Hirlevél küldés start",
Log::$TYPE_NEWSLETTER_SEND_END => "Hirlevél küldés vége",
Log::$TYPE_KEY_ASSIGN => "Kulcs kiadás",
Log::$TYPE_KEY_UNASSIGN => "Kulcs visszaadás",
Log::$TYPE_TOWEL_IN => "Törölköző ki",
Log::$TYPE_TOWEL_OUT => "Törölköző vissza",
Log::$TYPE_CRUD => "CRUD",
Log::$TYPE_TICKET_UPDATED_BY_ADMIN => "Bérlet módosítás",
Log::$TYPE_MOBILE_DEVICE_STATUS => "Mobil eszköz státusz"
];
}
public function getTypeName(){
$types = Log::getTypes();
return Helper::getArrayValue($types,$this->type,null);
}
/**
public function getTypeName()
{
$types = Log::getTypes();
return Helper::getArrayValue($types, $this->type, null);
}
/**
* @inheritdoc
*/
public static function tableName()
@ -134,79 +138,89 @@ class Log extends BaseFitnessActiveRecord
'id_door_log' => Yii::t('common/log', 'Kapu log'),
'created_at' => Yii::t('common/log', 'Dátum idő'),
'updated_at' => Yii::t('common/log', 'Módosítás'),
'start' => 'Időszak kezdete',
'end' => 'Időszak vége'
'start' => 'Időszak kezdete',
'end' => 'Időszak vége'
];
}
public static function info($message ){
self::log(['type' =>self::$TYPE_INFO, 'message' => $message]);
public static function info($message)
{
self::log(['type' => self::$TYPE_INFO, 'message' => $message]);
}
/**
* example
* Log::log([
'type' =>Log::$TYPE_LOGIN,
'message' => $message
]);
* 'type' =>Log::$TYPE_LOGIN,
* 'message' => $message
* ]);
* @param array $config
*/
public static function log( $config ){
$model = new Log($config);
$model->app = \Yii::$app->name;
$model->url = Url::canonical();
$model->id_user = \Yii::$app->user->id;
$model->save(false);
public static function log($config)
{
$model = new Log($config);
$model->app = \Yii::$app->name;
$model->url = Url::canonical();
$model->id_user = \Yii::$app->user->id;
$model->save(false);
}
/**
* create a log from the console app
* */
public static function logC( $config ){
$model = new Log($config);
$model->app = "Fitness rendszer";
$model->url = "console";
$model->id_user = 1;
$model->save(false);
public static function logC($config)
{
$model = new Log($config);
$model->app = "Fitness rendszer";
$model->url = "console";
$model->id_user = 1;
$model->save(false);
}
public function getUser(){
return $this->hasOne( User::className(), ["id" =>"id_user" ] );
public function getUser()
{
return $this->hasOne(User::className(), ["id" => "id_user"]);
}
public function getTicket(){
return $this->hasOne( Ticket::className(), ["id_ticket" =>"id_ticket" ] );
public function getTicket()
{
return $this->hasOne(Ticket::className(), ["id_ticket" => "id_ticket"]);
}
public function getCustomer(){
return $this->hasOne( Customer::className(), ["id_customer" =>"id_customer" ] );
public function getCustomer()
{
return $this->hasOne(Customer::className(), ["id_customer" => "id_customer"]);
}
public function getMoneyMovement(){
return $this->hasOne( MoneyMovement::className(), ["id_money_movement" =>"id_money_movement" ] );
public function getMoneyMovement()
{
return $this->hasOne(MoneyMovement::className(), ["id_money_movement" => "id_money_movement"]);
}
public function getUserName(){
public function getUserName()
{
$user = $this->user;
if ( isset($user)){
if (isset($user)) {
return $user->username;
}
return null;
}
public function getCustomerName(){
public function getCustomerName()
{
$customer = $this->customer;
if ( isset($customer)){
if (isset($customer)) {
return $customer->name;
}
return null;
}
public function getTicketName(){
public function getTicketName()
{
$ticket = $this->ticket;
if ( isset($ticket)){
if (isset($ticket)) {
return $ticket->ticketTypeName;
}
return null;

View File

@ -0,0 +1,134 @@
<?php
namespace common\models;
use Yii;
use yii\base\NotSupportedException;
use yii\behaviors\TimestampBehavior;
use yii\helpers\ArrayHelper;
use yii\web\IdentityInterface;
/**
* This is the model class for table "mobile_device".
*
* @property integer $id
* @property integer $id_card
* @property string $status
* @property string $device_identifier
* @property string $device_name
* @property string $activated_at
* @property string $created_at
* @property string $updated_at
*/
class MobileDevice extends \yii\db\ActiveRecord implements IdentityInterface
{
const STATUS_ACTIVE = 'active';
const STATUS_INACTIVE = 'inactive';
const STATUS_DELETED_MANUAL = 'deleted_manual';
const STATUS_DELETED_SYSTEM = 'deleted_system';
/**
* @inheritdoc
*/
public static function tableName()
{
return 'mobile_device';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
// [['id_card'], 'integer'],
// [['activated_at', 'created_at', 'updated_at'], 'safe'],
// [['created_at', 'updated_at'], 'required'],
// [['status'], 'string', 'max' => 20],
// [['device_identifier'], 'string', 'max' => 255]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => Yii::t('common/mobiledevice', 'ID'),
'id_card' => Yii::t('common/mobiledevice', 'Id Card'),
'status' => Yii::t('common/mobiledevice', 'Status'),
'device_identifier' => Yii::t('common/mobiledevice', 'Device Identifier'),
'device_name' => Yii::t('common/mobiledevice', 'Device Name'),
'activated_at' => Yii::t('common/mobiledevice', 'Activated At'),
'created_at' => Yii::t('common/mobiledevice', 'Created At'),
'updated_at' => Yii::t('common/mobiledevice', 'Updated At'),
];
}
public function behaviors()
{
return ArrayHelper::merge( [
[
'class' => TimestampBehavior::className(),
'value' => function(){ return date('Y-m-d H:i:s' ); }
]
],
parent::behaviors());
}
public static function toStatusHumanReadable($status){
$result = "";
switch ($status){
case self::STATUS_ACTIVE:
$result ='Aktív';
break;
case self::STATUS_DELETED_MANUAL:
$result ='Törölve (m)';
break;
case self::STATUS_DELETED_SYSTEM:
$result ='Törölve (r)';
break;
case self::STATUS_INACTIVE:
$result ='Inaktív';
break;
}
return $result;
}
public static function findIdentity($id)
{
self::findOne(['id' => $id]);
}
public static function findIdentityByAccessToken($token, $type = null)
{
throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.');
}
public function getId()
{
return $this->id;
}
public function getAuthKey()
{
throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.');
}
public function validateAuthKey($authKey)
{
throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.');
}
public function getCard()
{
return $this->hasOne(Card::class, [
'id_card' => 'id_card'
]);
}
}

View File

@ -7,7 +7,7 @@ use yii\helpers\ArrayHelper;
use yii\behaviors\TimestampBehavior;
use common\components\AccountAwareBehavior;
use common\components\UserAwareBehavior;
use yii\base\Object;
use yii\base\BaseObject;
use common\models\Transfer;
/**

View File

@ -6,7 +6,7 @@ use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Transfer;
use yii\base\Object;
use yii\base\BaseObject;
use yii\db\Query;
use yii\db\Expression;
use common\models\Account;

View File

@ -6,7 +6,7 @@ use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Transfer;
use yii\base\Object;
use yii\base\BaseObject;
use yii\db\Query;
use yii\db\Expression;
use common\models\Account;

View File

@ -0,0 +1,71 @@
<?php
namespace common\models;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\helpers\ArrayHelper;
/**
* This is the model class for table "virtual_key".
*
* @property integer $id
* @property integer $id_card
* @property integer $id_key
* @property integer $number
* @property string $direction_in_at
* @property string $direction_out_at
* @property string $created_at
* @property string $updated_at
*/
class VirtualKey extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'virtual_key';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_card', 'id_key'], 'integer'],
[[ 'created_at', 'updated_at'], 'required'],
[[ 'direction_in_at', 'created_at', 'updated_at'], 'safe']
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => Yii::t('common/virtualkey', 'ID'),
'id_card' => Yii::t('common/virtualkey', 'Id Card'),
'id_key' => Yii::t('common/virtualkey', 'Id Key'),
'direction_in_at' => Yii::t('common/virtualkey', 'Direction In At'),
'direction_out_at' => Yii::t('common/virtualkey', 'Direction Out At'),
'created_at' => Yii::t('common/virtualkey', 'Created At'),
'updated_at' => Yii::t('common/virtualkey', 'Updated At'),
];
}
public function behaviors()
{
return ArrayHelper::merge([
[
'class' => TimestampBehavior::className(),
'value' => function () {
return date('Y-m-d H:i:s');
}
]
],
parent::behaviors());
}
}

View File

@ -27,7 +27,7 @@
"dmstr/yii2-adminlte-asset": "2.*",
"bassjobsen/bootstrap-3-typeahead": "^4.0",
"bower-asset/webcamjs": "^1.0",
"mpdf/mpdf": "^6.0",
"mpdf/mpdf": "^8.1",
"os/php-excel": "^2.1",
"phpoffice/phpexcel": "^1.8",
"2amigos/yii2-tinymce-widget": "~1.1",
@ -35,7 +35,7 @@
"yiisoft/yii2-composer": "2.0.4",
"sizeg/yii2-jwt": "^2.0",
"fxp/composer-asset-plugin": "dev-master",
"ext-http": "*"
"endroid/qr-code": "^2.5"
},
"require-dev": {
"yiisoft/yii2-codeception": "*",

744
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "62617dd27b81a8c6428c875f01cf0dd8",
"content-hash": "138d862466e8a155a65957524deabe0f",
"packages": [
{
"name": "2amigos/yii2-tinymce-widget",
@ -106,6 +106,52 @@
],
"time": "2015-10-23T14:50:49+00:00"
},
{
"name": "bacon/bacon-qr-code",
"version": "1.0.3",
"source": {
"type": "git",
"url": "https://github.com/Bacon/BaconQrCode.git",
"reference": "5a91b62b9d37cee635bbf8d553f4546057250bee"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/5a91b62b9d37cee635bbf8d553f4546057250bee",
"reference": "5a91b62b9d37cee635bbf8d553f4546057250bee",
"shasum": ""
},
"require": {
"ext-iconv": "*",
"php": "^5.4|^7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8"
},
"suggest": {
"ext-gd": "to generate QR code images"
},
"type": "library",
"autoload": {
"psr-0": {
"BaconQrCode": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-2-Clause"
],
"authors": [
{
"name": "Ben Scholzen 'DASPRiD'",
"email": "mail@dasprids.de",
"homepage": "http://www.dasprids.de",
"role": "Developer"
}
],
"description": "BaconQrCode is a QR code generator for PHP.",
"homepage": "https://github.com/Bacon/BaconQrCode",
"time": "2017-10-17T09:59:25+00:00"
},
{
"name": "bassjobsen/bootstrap-3-typeahead",
"version": "v4.0.0",
@ -703,6 +749,75 @@
],
"time": "2015-11-06T10:35:36+00:00"
},
{
"name": "endroid/qr-code",
"version": "2.5.1",
"source": {
"type": "git",
"url": "https://github.com/endroid/qr-code.git",
"reference": "6062677d3404e0ded40647b8f62ec55ff9722eb7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/endroid/qr-code/zipball/6062677d3404e0ded40647b8f62ec55ff9722eb7",
"reference": "6062677d3404e0ded40647b8f62ec55ff9722eb7",
"shasum": ""
},
"require": {
"bacon/bacon-qr-code": "^1.0.3",
"ext-gd": "*",
"khanamiryan/qrcode-detector-decoder": "1",
"myclabs/php-enum": "^1.5",
"php": ">=5.6",
"symfony/options-resolver": "^2.7",
"symfony/property-access": "^2.7"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
"symfony/asset": "^2.7",
"symfony/browser-kit": "^2.7",
"symfony/finder": "^2.7",
"symfony/framework-bundle": "^2.7",
"symfony/http-kernel": "^2.7",
"symfony/templating": "^2.7",
"symfony/twig-bundle": "^2.7",
"symfony/yaml": "^2.7"
},
"type": "symfony-bundle",
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
}
},
"autoload": {
"psr-4": {
"Endroid\\QrCode\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jeroen van den Enden",
"email": "info@endroid.nl",
"homepage": "http://endroid.nl/"
}
],
"description": "Endroid QR Code",
"homepage": "https://github.com/endroid/QrCode",
"keywords": [
"bundle",
"code",
"endroid",
"flex",
"qr",
"qrcode",
"symfony"
],
"time": "2018-05-09T20:26:30+00:00"
},
{
"name": "ezyang/htmlpurifier",
"version": "v4.11.0",
@ -1978,6 +2093,56 @@
],
"time": "2014-11-09T19:54:17+00:00"
},
{
"name": "khanamiryan/qrcode-detector-decoder",
"version": "1",
"source": {
"type": "git",
"url": "https://github.com/khanamiryan/php-qrcode-detector-decoder.git",
"reference": "96d5f80680b04803c4f1b69d6e01735e876b80c7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/khanamiryan/php-qrcode-detector-decoder/zipball/96d5f80680b04803c4f1b69d6e01735e876b80c7",
"reference": "96d5f80680b04803c4f1b69d6e01735e876b80c7",
"shasum": ""
},
"require": {
"php": "^5.6|^7.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7"
},
"type": "library",
"autoload": {
"classmap": [
"lib/"
],
"files": [
"lib/common/customFunctions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ashot Khanamiryan",
"email": "a.khanamiryan@gmail.com",
"homepage": "https://github.com/khanamiryan",
"role": "Developer"
}
],
"description": "QR code decoder / reader",
"homepage": "https://github.com/khanamiryan/php-qrcode-detector-decoder",
"keywords": [
"barcode",
"qr",
"zxing"
],
"time": "2017-01-13T09:11:46+00:00"
},
{
"name": "lcobucci/jwt",
"version": "3.3.1",
@ -2035,46 +2200,69 @@
},
{
"name": "mpdf/mpdf",
"version": "v6.0.0",
"version": "v8.1.4",
"source": {
"type": "git",
"url": "https://github.com/mpdf/mpdf.git",
"reference": "a15743d030ce3b5b7be36c6e83f76589b27c3f2c"
"reference": "add590e93b7502efafd9839a68cff99f3497b318"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mpdf/mpdf/zipball/a15743d030ce3b5b7be36c6e83f76589b27c3f2c",
"reference": "a15743d030ce3b5b7be36c6e83f76589b27c3f2c",
"url": "https://api.github.com/repos/mpdf/mpdf/zipball/add590e93b7502efafd9839a68cff99f3497b318",
"reference": "add590e93b7502efafd9839a68cff99f3497b318",
"shasum": ""
},
"require": {
"ext-gd": "*",
"ext-mbstring": "*",
"php": ">=4.3.10"
"myclabs/deep-copy": "^1.7",
"paragonie/random_compat": "^1.4|^2.0|^9.99.99",
"php": "^5.6 || ^7.0 || ~8.0.0 || ~8.1.0 || ~8.2.0",
"php-http/message-factory": "^1.0",
"psr/http-message": "^1.0",
"psr/log": "^1.0 || ^2.0",
"setasign/fpdi": "^2.1"
},
"require-dev": {
"mockery/mockery": "^1.3.0",
"mpdf/qrcode": "^1.1.0",
"squizlabs/php_codesniffer": "^3.5.0",
"tracy/tracy": "~2.5",
"yoast/phpunit-polyfills": "^1.0"
},
"suggest": {
"ext-bcmath": "Needed for generation of some types of barcodes",
"ext-xml": "Needed mainly for SVG manipulation",
"ext-zlib": "Needed for compression of embedded resources, such as fonts"
},
"type": "library",
"autoload": {
"classmap": [
"mpdf.php",
"classes"
]
"psr-4": {
"Mpdf\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-1.0+"
"GPL-2.0-only"
],
"authors": [
{
"name": "Ian Back"
"name": "Matěj Humpál",
"role": "Developer, maintainer"
},
{
"name": "Ian Back",
"role": "Developer (retired)"
}
],
"description": "A PHP class to generate PDF files from HTML with Unicode/UTF-8 and CJK support",
"homepage": "http://www.mpdf1.com/mpdf/index.php",
"description": "PHP library generating PDF files from UTF-8 encoded HTML",
"homepage": "https://mpdf.github.io",
"keywords": [
"pdf",
"php",
"utf-8"
],
"time": "2015-03-01T10:27:49+00:00"
"time": "2022-12-15T11:24:39+00:00"
},
{
"name": "mrclay/minify",
@ -2121,6 +2309,100 @@
"homepage": "http://code.google.com/p/minify/",
"time": "2016-03-08T11:49:57+00:00"
},
{
"name": "myclabs/deep-copy",
"version": "1.11.0",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614",
"reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"conflict": {
"doctrine/collections": "<1.6.8",
"doctrine/common": "<2.13.3 || >=3,<3.2.2"
},
"require-dev": {
"doctrine/collections": "^1.6.8",
"doctrine/common": "^2.13.3 || ^3.2.2",
"phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13"
},
"type": "library",
"autoload": {
"files": [
"src/DeepCopy/deep_copy.php"
],
"psr-4": {
"DeepCopy\\": "src/DeepCopy/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Create deep copies (clones) of your objects",
"keywords": [
"clone",
"copy",
"duplicate",
"object",
"object graph"
],
"time": "2022-03-03T13:19:32+00:00"
},
{
"name": "myclabs/php-enum",
"version": "1.6.6",
"source": {
"type": "git",
"url": "https://github.com/myclabs/php-enum.git",
"reference": "32c4202886c51fbe5cc3a7c34ec5c9a4a790345e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/php-enum/zipball/32c4202886c51fbe5cc3a7c34ec5c9a4a790345e",
"reference": "32c4202886c51fbe5cc3a7c34ec5c9a4a790345e",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": ">=5.4"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35|^5.7|^6.0",
"squizlabs/php_codesniffer": "1.*"
},
"type": "library",
"autoload": {
"psr-4": {
"MyCLabs\\Enum\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP Enum contributors",
"homepage": "https://github.com/myclabs/php-enum/graphs/contributors"
}
],
"description": "PHP Enum implementation",
"homepage": "http://github.com/myclabs/php-enum",
"keywords": [
"enum"
],
"time": "2019-02-04T21:18:49+00:00"
},
{
"name": "natxet/CssMin",
"version": "v3.0.4",
@ -2205,6 +2487,101 @@
],
"time": "2012-05-02T20:42:37+00:00"
},
{
"name": "paragonie/random_compat",
"version": "v9.99.100",
"source": {
"type": "git",
"url": "https://github.com/paragonie/random_compat.git",
"reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a",
"reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a",
"shasum": ""
},
"require": {
"php": ">= 7"
},
"require-dev": {
"phpunit/phpunit": "4.*|5.*",
"vimeo/psalm": "^1"
},
"suggest": {
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
},
"type": "library",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com",
"homepage": "https://paragonie.com"
}
],
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
"keywords": [
"csprng",
"polyfill",
"pseudorandom",
"random"
],
"time": "2020-10-15T08:29:30+00:00"
},
{
"name": "php-http/message-factory",
"version": "v1.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-http/message-factory.git",
"reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/message-factory/zipball/a478cb11f66a6ac48d8954216cfed9aa06a501a1",
"reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1",
"shasum": ""
},
"require": {
"php": ">=5.4",
"psr/http-message": "^1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
}
],
"description": "Factory interfaces for PSR-7 HTTP Message",
"homepage": "http://php-http.org",
"keywords": [
"factory",
"http",
"message",
"stream",
"uri"
],
"time": "2015-12-19T14:08:53+00:00"
},
{
"name": "phpoffice/phpexcel",
"version": "1.8.1",
@ -2263,6 +2640,103 @@
"abandoned": "phpoffice/phpspreadsheet",
"time": "2015-05-01T07:00:55+00:00"
},
{
"name": "psr/http-message",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
"homepage": "https://github.com/php-fig/http-message",
"keywords": [
"http",
"http-message",
"psr",
"psr-7",
"request",
"response"
],
"time": "2016-08-06T14:39:51+00:00"
},
{
"name": "psr/log",
"version": "1.1.4",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "d49695b909c3b7628b6289db5479a1c204601f11"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
"reference": "d49695b909c3b7628b6289db5479a1c204601f11",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Log\\": "Psr/Log/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"homepage": "https://github.com/php-fig/log",
"keywords": [
"log",
"psr",
"psr-3"
],
"time": "2021-05-03T11:20:27+00:00"
},
{
"name": "rmrevin/yii2-fontawesome",
"version": "2.12.2",
@ -2315,6 +2789,68 @@
],
"time": "2015-11-20T09:17:45+00:00"
},
{
"name": "setasign/fpdi",
"version": "v2.3.6",
"source": {
"type": "git",
"url": "https://github.com/Setasign/FPDI.git",
"reference": "6231e315f73e4f62d72b73f3d6d78ff0eed93c31"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Setasign/FPDI/zipball/6231e315f73e4f62d72b73f3d6d78ff0eed93c31",
"reference": "6231e315f73e4f62d72b73f3d6d78ff0eed93c31",
"shasum": ""
},
"require": {
"ext-zlib": "*",
"php": "^5.6 || ^7.0 || ^8.0"
},
"conflict": {
"setasign/tfpdf": "<1.31"
},
"require-dev": {
"phpunit/phpunit": "~5.7",
"setasign/fpdf": "~1.8",
"setasign/tfpdf": "1.31",
"squizlabs/php_codesniffer": "^3.5",
"tecnickcom/tcpdf": "~6.2"
},
"suggest": {
"setasign/fpdf": "FPDI will extend this class but as it is also possible to use TCPDF or tFPDF as an alternative. There's no fixed dependency configured."
},
"type": "library",
"autoload": {
"psr-4": {
"setasign\\Fpdi\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jan Slabon",
"email": "jan.slabon@setasign.com",
"homepage": "https://www.setasign.com"
},
{
"name": "Maximilian Kresse",
"email": "maximilian.kresse@setasign.com",
"homepage": "https://www.setasign.com"
}
],
"description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.",
"homepage": "https://www.setasign.com/fpdi",
"keywords": [
"fpdf",
"fpdi",
"pdf"
],
"time": "2021-02-11T11:37:01+00:00"
},
{
"name": "sizeg/yii2-jwt",
"version": "v2.0.0",
@ -2410,8 +2946,186 @@
"mail",
"mailer"
],
"abandoned": "symfony/mailer",
"time": "2015-06-06T14:19:39+00:00"
},
{
"name": "symfony/options-resolver",
"version": "v2.8.52",
"source": {
"type": "git",
"url": "https://github.com/symfony/options-resolver.git",
"reference": "7aaab725bb58f0e18aa12c61bdadd4793ab4c32b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/7aaab725bb58f0e18aa12c61bdadd4793ab4c32b",
"reference": "7aaab725bb58f0e18aa12c61bdadd4793ab4c32b",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.8-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\OptionsResolver\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony OptionsResolver Component",
"homepage": "https://symfony.com",
"keywords": [
"config",
"configuration",
"options"
],
"time": "2018-11-11T11:18:13+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.19.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "aed596913b70fae57be53d86faa2e9ef85a2297b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/aed596913b70fae57be53d86faa2e9ef85a2297b",
"reference": "aed596913b70fae57be53d86faa2e9ef85a2297b",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-ctype": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.19-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"ctype",
"polyfill",
"portable"
],
"time": "2020-10-23T09:01:57+00:00"
},
{
"name": "symfony/property-access",
"version": "v2.8.52",
"source": {
"type": "git",
"url": "https://github.com/symfony/property-access.git",
"reference": "c8f10191183be9bb0d5a1b8364d3891f1bde07b6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/property-access/zipball/c8f10191183be9bb0d5a1b8364d3891f1bde07b6",
"reference": "c8f10191183be9bb0d5a1b8364d3891f1bde07b6",
"shasum": ""
},
"require": {
"php": ">=5.3.9",
"symfony/polyfill-ctype": "~1.8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.8-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\PropertyAccess\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony PropertyAccess Component",
"homepage": "https://symfony.com",
"keywords": [
"access",
"array",
"extraction",
"index",
"injection",
"object",
"property",
"property path",
"reflection"
],
"time": "2018-11-11T11:18:13+00:00"
},
{
"name": "tedivm/jshrink",
"version": "v1.1.0",

View File

@ -1,162 +0,0 @@
sanya@sanyigep ~/public_html/fitness-web $ php composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
- Installing yiisoft/yii2-composer (2.0.3)
Loading from cache
- Installing bower-asset/accounting (v0.3.2)
Loading from cache
- Installing bower-asset/jquery (2.1.4)
Loading from cache
- Installing bower-asset/jquery.inputmask (3.1.63)
Loading from cache
- Installing bower-asset/moment (2.10.6)
Loading from cache
- Installing bower-asset/punycode (v1.3.2)
Loading from cache
- Installing bower-asset/bootstrap (v3.3.5)
Loading from cache
- Installing bower-asset/remarkable-bootstrap-notify (3.1.3)
Loading from cache
- Installing bower-asset/yii2-pjax (v2.0.4)
Loading from cache
- Installing cebe/markdown (1.1.0)
Loading from cache
- Installing ezyang/htmlpurifier (v4.6.0)
Loading from cache
- Installing yiisoft/yii2 (2.0.6)
Loading from cache
- Installing yiisoft/yii2-bootstrap (2.0.5)
Loading from cache
- Installing bower-asset/fontawesome (v4.4.0)
Loading from cache
- Installing rmrevin/yii2-fontawesome (2.12.2)
Loading from cache
- Installing cebe/yii2-gravatar (1.1)
Loading from cache
- Installing almasaeed2010/adminlte (v2.3.2)
Loading from cache
- Installing dmstr/yii2-adminlte-asset (2.2.4)
Loading from cache
- Installing kartik-v/bootstrap-fileinput (v4.2.7)
Loading from cache
- Installing kartik-v/bootstrap-star-rating (v3.5.4)
Loading from cache
- Installing kartik-v/dependent-dropdown (v1.4.3)
Loading from cache
- Installing kartik-v/yii2-krajee-base (v1.7.7)
Loading from cache
- Installing kartik-v/yii2-widget-typeahead (v1.0.1)
Loading from cache
- Installing kartik-v/yii2-widget-touchspin (v1.2.0)
Loading from cache
- Installing kartik-v/yii2-widget-timepicker (v1.0.0)
Loading from cache
- Installing kartik-v/yii2-widget-switchinput (v1.3.0)
Loading from cache
- Installing kartik-v/yii2-widget-spinner (v1.0.0)
Loading from cache
- Installing kartik-v/yii2-widget-sidenav (v1.0.0)
Loading from cache
- Installing kartik-v/yii2-widget-select2 (v2.0.3)
Loading from cache
- Installing kartik-v/yii2-widget-rating (v1.0.0)
Loading from cache
- Installing kartik-v/yii2-widget-rangeinput (v1.0.0)
Loading from cache
- Installing kartik-v/yii2-widget-growl (v1.1.1)
Loading from cache
- Installing kartik-v/yii2-widget-fileinput (v1.0.3)
Loading from cache
- Installing kartik-v/yii2-widget-depdrop (v1.0.2)
Loading from cache
- Installing kartik-v/yii2-widget-datetimepicker (v1.4.0)
Loading from cache
- Installing kartik-v/yii2-widget-datepicker (v1.3.3)
Loading from cache
- Installing kartik-v/yii2-widget-colorinput (v1.0.0)
Loading from cache
- Installing kartik-v/yii2-widget-alert (v1.1.0)
Loading from cache
- Installing kartik-v/yii2-widget-affix (v1.0.0)
Loading from cache
- Installing kartik-v/yii2-widget-activeform (v1.4.5)
Loading from cache
- Installing kartik-v/yii2-widgets (v3.4.0)
Loading from cache
- Installing bower-asset/jquery-ui (1.11.4)
Loading from cache
- Installing yiisoft/yii2-jui (2.0.4)
Loading from cache
- Installing swiftmailer/swiftmailer (v5.4.1)
Loading from cache
- Installing yiisoft/yii2-swiftmailer (2.0.4)
Loading from cache
- Installing yiisoft/yii2-codeception (2.0.4)
Loading from cache
- Installing yiisoft/yii2-debug (2.0.5)
Loading from cache
- Installing fzaninotto/faker (v1.5.0)
Loading from cache
- Installing yiisoft/yii2-faker (2.0.3)
Loading from cache
- Installing phpspec/php-diff (v1.0.2)
Loading from cache
- Installing bower-asset/typeahead.js (v0.10.5)
Loading from cache
- Installing yiisoft/yii2-gii (2.0.4)
Loading from cache
fzaninotto/faker suggests installing ext-intl (*)
Generating autoload files

View File

@ -0,0 +1,68 @@
<?php
use yii\db\Migration;
/**
* Class m220213_134539_add_table_mobile_device
*/
class m220213_134539_add_table_mobile_device extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
}
$this->createTable('{{%mobile_device}}', [
'id' => $this->primaryKey(),
'id_card' => $this->integer(11),
'status' => $this->string(20),
'device_identifier' => $this->string(255),
'activated_at' => $this->dateTime(),
'created_at' => $this->dateTime()->notNull(),
'updated_at' => $this->dateTime()->notNull(),
], $tableOptions);
$this->createTable('{{%virtual_key}}', [
'id' => $this->primaryKey(),
'id_card' => $this->integer(11),
'id_key' => $this->integer(11),
'valid_until' => $this->dateTime()->notNull(),
'direction_in_at' => $this->dateTime(),
'direction_out_at' => $this->dateTime(),
'created_at' => $this->dateTime()->notNull(),
'updated_at' => $this->dateTime()->notNull(),
], $tableOptions);
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
echo "m220213_134539_add_table_mobile_device cannot be reverted.\n";
return false;
}
/*
// Use up()/down() to run migration code without a transaction.
public function up()
{
}
public function down()
{
echo "m220213_134539_add_table_mobile_device cannot be reverted.\n";
return false;
}
*/
}

View File

@ -0,0 +1,43 @@
<?php
use yii\db\Migration;
/**
* Class m220218_192423_alter_table_mobile_device_add_column_device_name
*/
class m220218_192423_alter_table_mobile_device_add_column_device_name extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('mobile_device', 'device_name', $this->string() );
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
echo "m220218_192423_alter_table_mobile_device_add_column_device_name cannot be reverted.\n";
return false;
}
/*
// Use up()/down() to run migration code without a transaction.
public function up()
{
}
public function down()
{
echo "m220218_192423_alter_table_mobile_device_add_column_device_name cannot be reverted.\n";
return false;
}
*/
}

View File

@ -0,0 +1,44 @@
<?php
use yii\db\Migration;
/**
* Class m220220_190302_add_virtual_key_field_for_card_key_assignment_table
*/
class m220220_190302_add_virtual_key_field_for_card_key_assignment_table extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('card_key_assignment','virtual_key', $this->string());
$this->addColumn('card_key_assignment','direction_in_at', 'datetime');
$this->addColumn('card_key_assignment','direction_out_at', 'datetime');
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
echo "m220220_190302_add_virtual_key_field_for_card_key_assignment_table cannot be reverted.\n";
return false;
}
/*
// Use up()/down() to run migration code without a transaction.
public function up()
{
}
public function down()
{
echo "m220220_190302_add_virtual_key_field_for_card_key_assignment_table cannot be reverted.\n";
return false;
}
*/
}

View File

@ -0,0 +1,42 @@
<?php
use yii\db\Migration;
/**
* Class m220803_190701_alter_table_door_log_add_version
*/
class m220803_190701_alter_table_door_log_add_version extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('door_log', 'version', $this->integer( )->notNull()->defaultValue(1) );
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
echo "m220803_190701_alter_table_door_log_add_version cannot be reverted.\n";
return false;
}
/*
// Use up()/down() to run migration code without a transaction.
public function up()
{
}
public function down()
{
echo "m220803_190701_alter_table_door_log_add_version cannot be reverted.\n";
return false;
}
*/
}

View File

@ -0,0 +1,217 @@
<?php
use yii\db\Migration;
/**
* Class m220928_165551_update_trigger
*/
class m220928_165551_update_trigger extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$sql = "
drop trigger if exists trigger_inc_ticket_usage_count;
CREATE TRIGGER trigger_inc_ticket_usage_count
AFTER INSERT
ON `door_log`
FOR EACH ROW
begin
DECLARE p_count_all Integer;
DECLARE p_count_all_2 Integer;
DECLARE p_from DATETIME;
DECLARE p_usage_count Integer;
DECLARE p_max_usage_count Integer;
DECLARE p_mo_ticket_id Integer;
DECLARE p_mo_ticket_max_usage_count Integer;
DECLARE p_allow_multiple_enter boolean;
DECLARE p_allow_enter boolean;
delete from devlog;
IF NEW.version = 1
THEN
IF NEW.id_customer is not null and NEW.id_card is not null
THEN
IF (NEW.direction = 7 or New.direction = 3) and NEW.id_ticket_current is not null
then
INSERT INTO devlog (msg) values ('belepes feldoglozas indit');
select count(*)
into @p_count_all
from door_log
where created_at >= CURDATE()
and id_ticket_current = New.id_ticket_current
and (direction = 7 or direction = 3);
INSERT INTO devlog (msg) values (concat('count all', @p_count_all));
IF @p_count_all = 1
THEN
select usage_count, max_usage_count
into @p_usage_count ,@p_max_usage_count
from ticket
where id_ticket = NEW.id_ticket_current;
update ticket set usage_count = usage_count + 1 where id_ticket = NEW.id_ticket_current;
INSERT INTO log (type, message, app, id_ticket, id_door_log, created_at, updated_at)
values (30, concat('Bérlet használat (elotte: ', @p_usage_count, ' > utana: ', @p_usage_count + 1,
' max: ', @p_max_usage_count, ')'), ' trigger_inc_ticket', New.id_ticket_current,
New.id_door_log, now(), now());
else
select min(created_at) +
INTERVAL (3 * FLOOR(((HOUR(TIMEDIFF(min(created_at), now())) / 3)))) hour as last_date
into @p_from
from door_log
where created_at > CURDATE()
and id_customer is not null
and id_ticket_current = NEW.id_ticket_current
and (direction = 7 or direction = 3);
select count(*)
into @p_count_all_2
from door_log
where created_at >= @p_from
and id_ticket_current = New.id_ticket_current
and (direction = 7 or direction = 3);
INSERT INTO devlog (msg)
values (CONCAT('Belépések száma az aktuális 3 órás intervalumban: ', @p_count_all_2));
IF @p_count_all_2 = 1
THEN
INSERT INTO devlog (msg)
values ('Az aktuális intervallumban ez az első belépés, usage_count növelése');
select usage_count, max_usage_count
into @p_usage_count ,@p_max_usage_count
from ticket
where id_ticket = NEW.id_ticket_current;
update ticket set usage_count = usage_count + 1 where id_ticket = New.id_ticket_current;
INSERT INTO log (type, message, app, id_ticket, id_door_log, created_at, updated_at)
values (40, concat('Bérlet használat/egy nap tobbszori (elotte: ', @p_usage_count, ' > utana: ',
@p_usage_count + 1, ' max: ', @p_max_usage_count, ')'),
' trigger_inc_ticket', New.id_ticket_current, New.id_door_log, now(), now());
END IF;
END IF;
End IF;
IF NEW.direction = 5 or New.direction = 1
then
INSERT INTO devlog (msg) values ('Kilépés van folyamatban, kilépések számának beállítása');
update ticket set count_move_out = usage_count where id_ticket = NEW.id_ticket_current;
END IF;
INSERT INTO devlog (msg) values ('Kártya validáció módosítása');
UPDATE card as c1
left JOIN (select ticket.id_card as id_card, max(ticket.id_ticket) as id_ticket
from ticket
where ticket.start <= CURDATE()
and ticket.end >= curdate()
and ticket.status = 10
and ticket.count_move_out < ticket.max_usage_count
and ticket.id_card = New.id_card
group by id_card
order by id_card desc) as t
on t.id_card = c1.id_card
SET c1.validity = case
when t.id_card is null then (c1.validity | 1 << 0)
else (c1.validity & ~(1 << 0)) end
, c1.flag = case
when t.id_card is null then (c1.flag | 1 << 0)
else (c1.flag & ~(1 << 0)) end
, c1.id_ticket_current = case when t.id_ticket is null then null else t.id_ticket end
WHERE c1.type <> 50
and c1.id_card = New.id_card;
IF NEW.direction = 5 or New.direction = 1
then
select max(ticket.id_ticket)
into @p_mo_ticket_id
from ticket
where ticket.start <= CURDATE()
and ticket.end >= curdate()
and ticket.status = 10
and ticket.count_move_out < ticket.max_usage_count
and ticket.id_card = New.id_card
group by id_card
order by id_card desc;
set @p_allow_enter = true;
update card
set flag_out = (flag_out | 1 << 1),
flag = case when @p_allow_enter then (flag & ~(1 << 1)) else (flag | 1 << 1) end
WHERE type <> 50
and id_card = New.id_card;
END IF;
IF (NEW.direction = 7 or New.direction = 3) and NEW.id_ticket_current is not null
THEN
update card
set flag_out = (flag_out & ~(1 << 1)),
flag = (flag | 1 << 1)
WHERE type <> 50
and id_card = New.id_card;
END IF;
END IF;
END IF;
END
";
$this->execute($sql);
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
echo "m220928_165551_update_trigger cannot be reverted.\n";
return true;
}
/*
// Use up()/down() to run migration code without a transaction.
public function up()
{
}
public function down()
{
echo "m220928_165551_update_trigger cannot be reverted.\n";
return false;
}
*/
}

View File

@ -0,0 +1,43 @@
<?php
use yii\db\Migration;
/**
* Class m221023_173829_add_table_virtual_key
*/
class m221023_173829_add_table_virtual_key extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->dropColumn("virtual_key",'valid_until');
$this->dropColumn("virtual_key",'direction_out_at');
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
echo "m221023_173829_add_table_virtual_key cannot be reverted.\n";
return false;
}
/*
// Use up()/down() to run migration code without a transaction.
public function up()
{
}
public function down()
{
echo "m221023_173829_add_table_virtual_key cannot be reverted.\n";
return false;
}
*/
}

View File

@ -0,0 +1,42 @@
<?php
use yii\db\Migration;
/**
* Class m221024_203742_alter_table_virtual_key_add_column_number
*/
class m221024_203742_alter_table_virtual_key_add_column_number extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn("virtual_key","number", $this->string(23));
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
echo "m221024_203742_alter_table_virtual_key_add_column_number cannot be reverted.\n";
return false;
}
/*
// Use up()/down() to run migration code without a transaction.
public function up()
{
}
public function down()
{
echo "m221024_203742_alter_table_virtual_key_add_column_number cannot be reverted.\n";
return false;
}
*/
}

View File

@ -0,0 +1,27 @@
<?php
use yii\db\Migration;
/**
* Class m221026_111439_alter_table_virtual_key_add_column_direction_out_at
*/
class m221026_111439_alter_table_virtual_key_add_column_direction_out_at extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn("virtual_key", "direction_out_at", $this->dateTime() );
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
echo "m221026_111439_alter_table_virtual_key_add_column_direction_out_at cannot be reverted.\n";
return false;
}
}

View File

@ -35,6 +35,7 @@ class LoginController extends CustomerApiController
public function actionLogin()
{
$form = new LoginForm();
$form->scenario = "default";
$form->load(\Yii::$app->request->post(), '');

33
doc/composer.md Normal file
View File

@ -0,0 +1,33 @@
# Composer Knowledge base
## upgrade packages
[upgrade.txt](./upgrade.txt)
## use newer github tokens
Edit the composer authentication configuration file ~/.composer/auth.json.
```bash
nano ~/.composer/auth.json
```
Then replace the following.
```json
{
"github-oauth": {
"github.com": "ghp_[YOUR-PERSONAL-TOKEN]"
}
}
```
With this (basic auth):
```json
{
"http-basic": {
"github.com": {
"username": "[YOUR-GITHUB-USERNAME]",
"password": "ghp_[YOUR-PERSONAL-TOKEN]"
}
}
}
```

BIN
doc/image-036276f377.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

174
doc/trigger.sql Normal file
View File

@ -0,0 +1,174 @@
CREATE TRIGGER trigger_inc_ticket_usage_count
AFTER INSERT
ON `door_log`
FOR EACH ROW
begin
DECLARE p_count_all Integer;
DECLARE p_count_all_2 Integer;
DECLARE p_from DATETIME;
DECLARE p_usage_count Integer;
DECLARE p_max_usage_count Integer;
DECLARE p_mo_ticket_id Integer;
DECLARE p_mo_ticket_max_usage_count Integer;
DECLARE p_allow_multiple_enter boolean;
DECLARE p_allow_enter boolean;
delete from devlog;
if NEW.version = 1
then
IF NEW.id_customer is not null and NEW.id_card is not null
THEN
IF (NEW.direction = 7 or New.direction = 3) and NEW.id_ticket_current is not null
then
INSERT INTO devlog (msg) values ('belepes feldoglozas indit');
select count(*)
into @p_count_all
from door_log
where created_at >= CURDATE()
and id_ticket_current = New.id_ticket_current
and (direction = 7 or direction = 3);
INSERT INTO devlog (msg) values (concat('count all', @p_count_all));
IF @p_count_all = 1
THEN
select usage_count, max_usage_count
into @p_usage_count ,@p_max_usage_count
from ticket
where id_ticket = NEW.id_ticket_current;
update ticket set usage_count = usage_count + 1 where id_ticket = NEW.id_ticket_current;
INSERT INTO log (type, message, app, id_ticket, id_door_log, created_at, updated_at)
values (30, concat('Bérlet használat (elotte: ', @p_usage_count, ' > utana: ', @p_usage_count + 1,
' max: ', @p_max_usage_count, ')'), ' trigger_inc_ticket', New.id_ticket_current,
New.id_door_log, now(), now());
else
-- deltaElsoBelépés a napi első door log és 'most' között eltelt órák
-- HOUR( TIMEDIFF( min(created_at) , now() ) )
-- hány darab 3 órás intervallum telt el
-- floor : 2.75 -> 2
-- FLOOR( ( ( HOUR( TIMEDIFF( min(created_at) , now() ) ) /3 ) ) )
-- a napi első belépés után kiszámoljuk az aktuális n-edik 3órás intervallum kezdetét
select min(created_at) +
INTERVAL (3 * FLOOR(((HOUR(TIMEDIFF(min(created_at), now())) / 3)))) hour as last_date
into @p_from
from door_log
where created_at > CURDATE()
and id_customer is not null
and id_ticket_current = NEW.id_ticket_current
and (direction = 7 or direction = 3);
select count(*)
into @p_count_all_2
from door_log
where created_at >= @p_from
and id_ticket_current = New.id_ticket_current
and (direction = 7 or direction = 3);
INSERT INTO devlog (msg)
values (CONCAT('Belépések száma az aktuális 3 órás intervalumban: ', @p_count_all_2));
IF @p_count_all_2 = 1
THEN
INSERT INTO devlog (msg)
values ('Az aktuális intervallumban ez az első belépés, usage_count növelése');
select usage_count, max_usage_count
into @p_usage_count ,@p_max_usage_count
from ticket
where id_ticket = NEW.id_ticket_current;
update ticket set usage_count = usage_count + 1 where id_ticket = New.id_ticket_current;
INSERT INTO log (type, message, app, id_ticket, id_door_log, created_at, updated_at)
values (40, concat('Bérlet használat/egy nap tobbszori (elotte: ', @p_usage_count, ' > utana: ',
@p_usage_count + 1, ' max: ', @p_max_usage_count, ')'), ' trigger_inc_ticket',
New.id_ticket_current, New.id_door_log, now(), now());
END IF;
END IF;
End IF;
IF NEW.direction = 5 or New.direction = 1
then
INSERT INTO devlog (msg) values ('Kilépés van folyamatban, kilépések számának beállítása');
update ticket set count_move_out = usage_count where id_ticket = NEW.id_ticket_current;
END IF;
INSERT INTO devlog (msg) values ('Kártya validáció módosítása');
UPDATE card as c1
left JOIN (select ticket.id_card as id_card, max(ticket.id_ticket) as id_ticket
from ticket
where ticket.start <= CURDATE()
and ticket.end >= curdate()
and ticket.status = 10
and ticket.count_move_out < ticket.max_usage_count
and ticket.id_card = New.id_card
group by id_card
order by id_card desc) as t
on t.id_card = c1.id_card
SET c1.validity = case
when t.id_card is null then (c1.validity | 1 << 0)
else (c1.validity & ~(1 << 0)) end
, c1.flag = case when t.id_card is null then (c1.flag | 1 << 0) else (c1.flag & ~(1 << 0)) end
, c1.id_ticket_current = case when t.id_ticket is null then null else t.id_ticket end
WHERE c1.type <> 50
and c1.id_card = New.id_card;
IF NEW.direction = 5 or New.direction = 1
then
select max(ticket.id_ticket)
into @p_mo_ticket_id
from ticket
where ticket.start <= CURDATE()
and ticket.end >= curdate()
and ticket.status = 10
and ticket.count_move_out < ticket.max_usage_count
and ticket.id_card = New.id_card
group by id_card
order by id_card desc;
set @p_allow_enter = true;
update card
set flag_out = (flag_out | 1 << 1),
flag = case when @p_allow_enter then (flag & ~(1 << 1)) else (flag | 1 << 1) end
WHERE type <> 50
and id_card = New.id_card;
END IF;
IF (NEW.direction = 7 or New.direction = 3) and NEW.id_ticket_current is not null
THEN
update card
set flag_out = (flag_out & ~(1 << 1)),
flag = (flag | 1 << 1)
WHERE type <> 50
and id_card = New.id_card;
END IF;
END IF;
END IF;
END

View File

@ -1,4 +0,0 @@
version: '2'
services:
fitness-ub-php-7:
build: ./service/ub-php

1
docker/fitness/.env Normal file
View File

@ -0,0 +1 @@
FITNESS_REST_ALLOW_VERIFY_ONLY=true

View File

@ -0,0 +1,54 @@
version: '3'
services:
cutlerweb:
build: ./service/apache2
stdin_open: true # docker run -i
tty: true # docker run -t
networks:
cutler_network:
ports:
- "42001:80"
- "42002:443"
volumes:
- ../../:/var/www/html/cutler
environment:
FITNESS_DB_HOST: cutlerdb
FITNESS_DB_NAME: cutler_prod2
FITNESS_DB_PORT:
FITNESS_DB_USERNAME: cutler_prod
FITNESS_DB_PASSWORD: cutler_prod
FITNESS_MAIL_HOST: cutlermail
FITNESS_MAIL_PORT: 1025
FITNESS_MAIL_USERNAME: test
FITNESS_MAIL_PASSWORD: test
FITNESS_REST_ALLOW_VERIFY_ONLY: $FITNESS_REST_ALLOW_VERIFY_ONLY
cutlerdb:
image: mariadb:10.1
networks:
cutler_network:
volumes:
- cutler_mariadb:/var/lib/mysql
- ./service/mariadb/init.sql:/docker-entrypoint-initdb.d/init.sql
environment:
MYSQL_ROOT_PASSWORD: cutler
MYSQL_DATABASE: cutler_prod2
MYSQL_USER: cutler_prod
MYSQL_PASSWORD: cutler_prod
ports:
- "42003:3306"
cutlermail:
image: reachfive/fake-smtp-server
networks:
cutler_network:
volumes:
cutler_photos: {}
cutler_mariadb: {}
networks:
cutler_network:

View File

@ -0,0 +1,42 @@
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
# Always set these headers.
#Header always set Access-Control-Allow-Origin "*"
#Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
#Header always set Access-Control-Max-Age "1000"
#Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"
# Added a rewrite to respond with a 200 SUCCESS on every OPTIONS request.
# RewriteEngine On
# RewriteCond %{REQUEST_METHOD} OPTIONS
# RewriteRule ^(.*)$ $1 [R=200,L]
</VirtualHost>

View File

@ -0,0 +1,56 @@
FROM ubuntu:20.04
MAINTAINER rocho02@gmail.com
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Budapest
# apt-get
RUN apt-get update \
&& apt-get -y install bzip2 git nano wget zip unzip curl vim \
&& apt-get -y install libmcrypt-dev libzzip-dev zziplib-bin zlib1g-dev \
&& apt-get -y install apache2 build-essential
# && ufw allow in "Apache Full" \o
RUN apt-get install -y php php-pear php-dev libmcrypt-dev
RUN apt-get -y install php \
libapache2-mod-php \
php-mysql \
php-xml \
php-gd \
php-mbstring \
php-zip \
php-soap \
php-curl \
php-pear \
php-dev \
libmcrypt-dev
RUN pecl channel-update pecl.php.net
RUN pecl update-channels
RUN pecl install mcrypt
RUN apt-get -y install \
# Required by composr
git \
zlib1g-dev \
--no-install-recommends
RUN a2enmod headers
RUN a2enmod rewrite
COPY 000-default.conf /etc/apache2/sites-available/
COPY index.html /var/www/html/
COPY apache2.conf /etc/apache2/
RUN #apt-get install -y certbot python3-certbot-apache
# Ports
EXPOSE 80
# Default command
CMD ["apachectl", "-D", "FOREGROUND"]

Binary file not shown.

View File

@ -0,0 +1,221 @@
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.4/ for detailed information about
# the directives and /usr/share/doc/apache2/README.Debian about Debian specific
# hints.
#
#
# Summary of how the Apache 2 configuration works in Debian:
# The Apache 2 web server configuration in Debian is quite different to
# upstream's suggested way to configure the web server. This is because Debian's
# default Apache2 installation attempts to make adding and removing modules,
# virtual hosts, and extra configuration directives as flexible as possible, in
# order to make automating the changes and administering the server as easy as
# possible.
# It is split into several files forming the configuration hierarchy outlined
# below, all located in the /etc/apache2/ directory:
#
# /etc/apache2/
# |-- apache2.conf
# | `-- ports.conf
# |-- mods-enabled
# | |-- *.load
# | `-- *.conf
# |-- conf-enabled
# | `-- *.conf
# `-- sites-enabled
# `-- *.conf
#
#
# * apache2.conf is the main configuration file (this file). It puts the pieces
# together by including all remaining configuration files when starting up the
# web server.
#
# * ports.conf is always included from the main configuration file. It is
# supposed to determine listening ports for incoming connections which can be
# customized anytime.
#
# * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/
# directories contain particular configuration snippets which manage modules,
# global configuration fragments, or virtual host configurations,
# respectively.
#
# They are activated by symlinking available configuration files from their
# respective *-available/ counterparts. These should be managed by using our
# helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf. See
# their respective man pages for detailed information.
#
# * The binary is called apache2. Due to the use of environment variables, in
# the default configuration, apache2 needs to be started/stopped with
# /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not
# work with the default configuration.
# Global configuration
#
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE! If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the Mutex documentation (available
# at <URL:http://httpd.apache.org/docs/2.4/mod/core.html#mutex>);
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
#ServerRoot "/etc/apache2"
#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
Mutex file:${APACHE_LOCK_DIR} default
#
# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars
#
PidFile ${APACHE_PID_FILE}
#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On
#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 5
# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog ${APACHE_LOG_DIR}/error.log
#
# LogLevel: Control the severity of messages logged to the error_log.
# Available values: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the log level for particular modules, e.g.
# "LogLevel info ssl:warn"
#
LogLevel warn
# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
# Include list of ports to listen on
Include ports.conf
# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
#<Directory /srv/>
# Options Indexes FollowSymLinks
# AllowOverride None
# Require all granted
#</Directory>
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives. See also the AllowOverride
# directive.
#
AccessFileName .htaccess
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
#
# The following directives define some format nicknames for use with
# a CustomLog directive.
#
# These deviate from the Common Log Format definitions in that they use %O
# (the actual bytes sent including headers) instead of %b (the size of the
# requested file), because the latter makes it impossible to detect partial
# requests.
#
# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
# Use mod_remoteip instead.
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.
# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf
# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

View File

@ -0,0 +1 @@
docker build -t cutler:v2 ../../../

View File

@ -0,0 +1,2 @@
docker build --tag apache .

Binary file not shown.

View File

@ -0,0 +1,221 @@
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.4/ for detailed information about
# the directives and /usr/share/doc/apache2/README.Debian about Debian specific
# hints.
#
#
# Summary of how the Apache 2 configuration works in Debian:
# The Apache 2 web server configuration in Debian is quite different to
# upstream's suggested way to configure the web server. This is because Debian's
# default Apache2 installation attempts to make adding and removing modules,
# virtual hosts, and extra configuration directives as flexible as possible, in
# order to make automating the changes and administering the server as easy as
# possible.
# It is split into several files forming the configuration hierarchy outlined
# below, all located in the /etc/apache2/ directory:
#
# /etc/apache2/
# |-- apache2.conf
# | `-- ports.conf
# |-- mods-enabled
# | |-- *.load
# | `-- *.conf
# |-- conf-enabled
# | `-- *.conf
# `-- sites-enabled
# `-- *.conf
#
#
# * apache2.conf is the main configuration file (this file). It puts the pieces
# together by including all remaining configuration files when starting up the
# web server.
#
# * ports.conf is always included from the main configuration file. It is
# supposed to determine listening ports for incoming connections which can be
# customized anytime.
#
# * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/
# directories contain particular configuration snippets which manage modules,
# global configuration fragments, or virtual host configurations,
# respectively.
#
# They are activated by symlinking available configuration files from their
# respective *-available/ counterparts. These should be managed by using our
# helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf. See
# their respective man pages for detailed information.
#
# * The binary is called apache2. Due to the use of environment variables, in
# the default configuration, apache2 needs to be started/stopped with
# /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not
# work with the default configuration.
# Global configuration
#
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE! If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the Mutex documentation (available
# at <URL:http://httpd.apache.org/docs/2.4/mod/core.html#mutex>);
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
#ServerRoot "/etc/apache2"
#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
Mutex file:${APACHE_LOCK_DIR} default
#
# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars
#
PidFile ${APACHE_PID_FILE}
#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On
#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 5
# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog ${APACHE_LOG_DIR}/error.log
#
# LogLevel: Control the severity of messages logged to the error_log.
# Available values: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the log level for particular modules, e.g.
# "LogLevel info ssl:warn"
#
LogLevel warn
# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
# Include list of ports to listen on
Include ports.conf
# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
#<Directory /srv/>
# Options Indexes FollowSymLinks
# AllowOverride None
# Require all granted
#</Directory>
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives. See also the AllowOverride
# directive.
#
AccessFileName .htaccess
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
#
# The following directives define some format nicknames for use with
# a CustomLog directive.
#
# These deviate from the Common Log Format definitions in that they use %O
# (the actual bytes sent including headers) instead of %b (the size of the
# requested file), because the latter makes it impossible to detect partial
# requests.
#
# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
# Use mod_remoteip instead.
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.
# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf
# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

View File

@ -0,0 +1,8 @@
# Read the documentation before enabling AddDefaultCharset.
# In general, it is only a good idea if you know that all your files
# have this encoding. It will override any encoding given in the files
# in meta http-equiv or xml encoding tags.
#AddDefaultCharset UTF-8
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

View File

@ -0,0 +1,81 @@
# Customizable error responses come in three flavors:
# 1) plain text
# 2) local redirects
# 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# Putting this all together, we can internationalize error responses.
#
# We use Alias to redirect any /error/HTTP_<error>.html.var response to
# our collection of by-error message multi-language collections. We use
# includes to substitute the appropriate text.
#
# You can modify the messages' appearance without changing any of the
# default HTTP_<error>.html.var files by adding the line:
#
#Alias /error/include/ "/your/include/path/"
#
# which allows you to create your own set of files by starting with the
# /usr/share/apache2/error/include/ files and copying them to /your/include/path/,
# even on a per-VirtualHost basis. If you include the Alias in the global server
# context, is has to come _before_ the 'Alias /error/ ...' line.
#
# The default include files will display your Apache version number and your
# ServerAdmin email address regardless of the setting of ServerSignature.
#
# WARNING: The configuration below will NOT work out of the box if you have a
# SetHandler directive in a <Location /> context somewhere. Adding
# the following three lines AFTER the <Location /> context should
# make it work in most cases:
# <Location /error/>
# SetHandler none
# </Location>
#
# The internationalized error documents require mod_alias, mod_include
# and mod_negotiation. To activate them, uncomment the following 37 lines.
#<IfModule mod_negotiation.c>
# <IfModule mod_include.c>
# <IfModule mod_alias.c>
#
# Alias /error/ "/usr/share/apache2/error/"
#
# <Directory "/usr/share/apache2/error">
# Options IncludesNoExec
# AddOutputFilter Includes html
# AddHandler type-map var
# Order allow,deny
# Allow from all
# LanguagePriority en cs de es fr it nl sv pt-br ro
# ForceLanguagePriority Prefer Fallback
# </Directory>
#
# ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
# ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
# ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
# ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
# ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
# ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
# ErrorDocument 410 /error/HTTP_GONE.html.var
# ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
# ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
# ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
# ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
# ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
# ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
# ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
# ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
# ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
# ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var
# </IfModule>
# </IfModule>
#</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

View File

@ -0,0 +1,4 @@
# Define an access log for VirtualHosts that don't define their own logfile
CustomLog ${APACHE_LOG_DIR}/other_vhosts_access.log vhost_combined
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

View File

@ -0,0 +1,73 @@
#
# Disable access to the entire file system except for the directories that
# are explicitly allowed later.
#
# This currently breaks the configurations that come with some web application
# Debian packages.
#
#<Directory />
# AllowOverride None
# Require all denied
#</Directory>
# Changing the following options will not really affect the security of the
# server, but might make attacks slightly more difficult in some cases.
#
# ServerTokens
# This directive configures what you return as the Server HTTP response
# Header. The default is 'Full' which sends information about the OS-Type
# and compiled in modules.
# Set to one of: Full | OS | Minimal | Minor | Major | Prod
# where Full conveys the most information, and Prod the least.
#ServerTokens Minimal
ServerTokens OS
#ServerTokens Full
#
# Optionally add a line containing the server version and virtual host
# name to server-generated pages (internal error documents, FTP directory
# listings, mod_status and mod_info output etc., but not CGI generated
# documents or custom error documents).
# Set to "EMail" to also include a mailto: link to the ServerAdmin.
# Set to one of: On | Off | EMail
#ServerSignature Off
ServerSignature On
#
# Allow TRACE method
#
# Set to "extended" to also reflect the request body (only for testing and
# diagnostic purposes).
#
# Set to one of: On | Off | extended
TraceEnable Off
#TraceEnable On
#
# Forbid access to version control directories
#
# If you use version control systems in your document root, you should
# probably deny access to their directories. For example, for subversion:
#
#<DirectoryMatch "/\.svn">
# Require all denied
#</DirectoryMatch>
#
# Setting this header will prevent MSIE from interpreting files as something
# else than declared by the content type in the HTTP headers.
# Requires mod_headers to be enabled.
#
#Header set X-Content-Type-Options: "nosniff"
#
# Setting this header will prevent other sites from embedding pages from this
# site as frames. This defends against clickjacking attacks.
# Requires mod_headers to be enabled.
#
#Header set X-Frame-Options: "sameorigin"
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

View File

@ -0,0 +1,20 @@
<IfModule mod_alias.c>
<IfModule mod_cgi.c>
Define ENABLE_USR_LIB_CGI_BIN
</IfModule>
<IfModule mod_cgid.c>
Define ENABLE_USR_LIB_CGI_BIN
</IfModule>
<IfDefine ENABLE_USR_LIB_CGI_BIN>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Require all granted
</Directory>
</IfDefine>
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

View File

@ -0,0 +1,47 @@
# envvars - default environment variables for apache2ctl
# this won't be correct after changing uid
unset HOME
# for supporting multiple apache2 instances
if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
else
SUFFIX=
fi
# Since there is no sane way to get the parsed apache2 config in scripts, some
# settings are defined via environment variables and then used in apache2ctl,
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
# temporary state file location. This might be changed to /run in Wheezy+1
export APACHE_PID_FILE=/var/run/apache2/apache2$SUFFIX.pid
export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
# Only /var/log/apache2 is handled by /etc/logrotate.d/apache2.
export APACHE_LOG_DIR=/var/log/apache2$SUFFIX
## The locale used by some modules like mod_dav
export LANG=C
## Uncomment the following line to use the system default locale instead:
#. /etc/default/locale
export LANG
## The command to get the status for 'apache2ctl status'.
## Some packages providing 'www-browser' need '--dump' instead of '-dump'.
#export APACHE_LYNX='www-browser -dump'
## If you need a higher file descriptor limit, uncomment and adjust the
## following line (default is 8192):
#APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'
## If you would like to pass arguments to the web server, add them below
## to the APACHE_ARGUMENTS environment.
#export APACHE_ARGUMENTS=''
## Enable the debug mode for maintainer scripts.
## This will produce a verbose output on package installations of web server modules and web application
## installations which interact with Apache
#export APACHE2_MAINTSCRIPT_DEBUG=1

View File

@ -0,0 +1,935 @@
# Magic data for mod_mime_magic (originally for file(1) command)
#
# The format is 4-5 columns:
# Column #1: byte number to begin checking from, ">" indicates continuation
# Column #2: type of data to match
# Column #3: contents of data to match
# Column #4: MIME type of result
# Column #5: MIME encoding of result (optional)
#------------------------------------------------------------------------------
# Localstuff: file(1) magic for locally observed files
# Add any locally observed files here.
# Real Audio (Magic .ra\0375)
0 belong 0x2e7261fd audio/x-pn-realaudio
0 string .RMF application/vnd.rn-realmedia
#video/x-pn-realvideo
#video/vnd.rn-realvideo
#application/vnd.rn-realmedia
# sigh, there are many mimes for that but the above are the most common.
# Taken from magic, converted to magic.mime
# mime types according to http://www.geocities.com/nevilo/mod.htm:
# audio/it .it
# audio/x-zipped-it .itz
# audio/xm fasttracker modules
# audio/x-s3m screamtracker modules
# audio/s3m screamtracker modules
# audio/x-zipped-mod mdz
# audio/mod mod
# audio/x-mod All modules (mod, s3m, 669, mtm, med, xm, it, mdz, stm, itz, xmz, s3z)
# Taken from loader code from mikmod version 2.14
# by Steve McIntyre (stevem@chiark.greenend.org.uk)
# <doj@cubic.org> added title printing on 2003-06-24
0 string MAS_UTrack_V00
>14 string >/0 audio/x-mod
#audio/x-tracker-module
#0 string UN05 MikMod UNI format module sound data
0 string Extended\ Module: audio/x-mod
#audio/x-tracker-module
##>17 string >\0 Title: "%s"
21 string/c \!SCREAM! audio/x-mod
#audio/x-screamtracker-module
21 string BMOD2STM audio/x-mod
#audio/x-screamtracker-module
1080 string M.K. audio/x-mod
#audio/x-protracker-module
#>0 string >\0 Title: "%s"
1080 string M!K! audio/x-mod
#audio/x-protracker-module
#>0 string >\0 Title: "%s"
1080 string FLT4 audio/x-mod
#audio/x-startracker-module
#>0 string >\0 Title: "%s"
1080 string FLT8 audio/x-mod
#audio/x-startracker-module
#>0 string >\0 Title: "%s"
1080 string 4CHN audio/x-mod
#audio/x-fasttracker-module
#>0 string >\0 Title: "%s"
1080 string 6CHN audio/x-mod
#audio/x-fasttracker-module
#>0 string >\0 Title: "%s"
1080 string 8CHN audio/x-mod
#audio/x-fasttracker-module
#>0 string >\0 Title: "%s"
1080 string CD81 audio/x-mod
#audio/x-oktalyzer-tracker-module
#>0 string >\0 Title: "%s"
1080 string OKTA audio/x-mod
#audio/x-oktalyzer-tracker-module
#>0 string >\0 Title: "%s"
# Not good enough.
#1082 string CH
#>1080 string >/0 %.2s-channel Fasttracker "oktalyzer" module sound data
1080 string 16CN audio/x-mod
#audio/x-taketracker-module
#>0 string >\0 Title: "%s"
1080 string 32CN audio/x-mod
#audio/x-taketracker-module
#>0 string >\0 Title: "%s"
# Impuse tracker module (it)
0 string IMPM audio/x-mod
#>4 string >\0 "%s"
#>40 leshort !0 compatible w/ITv%x
#>42 leshort !0 created w/ITv%x
#------------------------------------------------------------------------------
# end local stuff
#------------------------------------------------------------------------------
# xml based formats!
# svg
0 string \<?xml
# text/xml
>38 string \<\!DOCTYPE\040svg image/svg+xml
# xml
0 string \<?xml text/xml
#------------------------------------------------------------------------------
# Java
0 short 0xcafe
>2 short 0xbabe application/java
#------------------------------------------------------------------------------
# audio: file(1) magic for sound formats
#
# from Jan Nicolai Langfeldt <janl@ifi.uio.no>,
#
# Sun/NeXT audio data
0 string .snd
>12 belong 1 audio/basic
>12 belong 2 audio/basic
>12 belong 3 audio/basic
>12 belong 4 audio/basic
>12 belong 5 audio/basic
>12 belong 6 audio/basic
>12 belong 7 audio/basic
>12 belong 23 audio/x-adpcm
# DEC systems (e.g. DECstation 5000) use a variant of the Sun/NeXT format
# that uses little-endian encoding and has a different magic number
# (0x0064732E in little-endian encoding).
0 lelong 0x0064732E
>12 lelong 1 audio/x-dec-basic
>12 lelong 2 audio/x-dec-basic
>12 lelong 3 audio/x-dec-basic
>12 lelong 4 audio/x-dec-basic
>12 lelong 5 audio/x-dec-basic
>12 lelong 6 audio/x-dec-basic
>12 lelong 7 audio/x-dec-basic
# compressed (G.721 ADPCM)
>12 lelong 23 audio/x-dec-adpcm
# Bytes 0-3 of AIFF, AIFF-C, & 8SVX audio files are "FORM"
# AIFF audio data
8 string AIFF audio/x-aiff
# AIFF-C audio data
8 string AIFC audio/x-aiff
# IFF/8SVX audio data
8 string 8SVX audio/x-aiff
# Creative Labs AUDIO stuff
# Standard MIDI data
0 string MThd audio/unknown
#>9 byte >0 (format %d)
#>11 byte >1 using %d channels
# Creative Music (CMF) data
0 string CTMF audio/unknown
# SoundBlaster instrument data
0 string SBI audio/unknown
# Creative Labs voice data
0 string Creative\ Voice\ File audio/unknown
## is this next line right? it came this way...
#>19 byte 0x1A
#>23 byte >0 - version %d
#>22 byte >0 \b.%d
# [GRR 950115: is this also Creative Labs? Guessing that first line
# should be string instead of unknown-endian long...]
#0 long 0x4e54524b MultiTrack sound data
#0 string NTRK MultiTrack sound data
#>4 long x - version %ld
# Microsoft WAVE format (*.wav)
# [GRR 950115: probably all of the shorts and longs should be leshort/lelong]
# Microsoft RIFF
0 string RIFF
# - WAVE format
>8 string WAVE audio/x-wav
>8 string/B AVI video/x-msvideo
#
>8 string CDRA image/x-coreldraw
# AAC (aka MPEG-2 NBC)
0 beshort&0xfff6 0xfff0 audio/X-HX-AAC-ADTS
0 string ADIF audio/X-HX-AAC-ADIF
0 beshort&0xffe0 0x56e0 audio/MP4A-LATM
0 beshort 0x4De1 audio/MP4A-LATM
# MPEG Layer 3 sound files
0 beshort&0xfffe =0xfffa audio/mpeg
#MP3 with ID3 tag
0 string ID3 audio/mpeg
# Ogg/Vorbis
0 string OggS application/ogg
#------------------------------------------------------------------------------
# c-lang: file(1) magic for C programs or various scripts
#
# XPM icons (Greg Roelofs, newt@uchicago.edu)
# ideally should go into "images", but entries below would tag XPM as C source
0 string /*\ XPM image/x-xpmi 7bit
# 3DS (3d Studio files)
#16 beshort 0x3d3d image/x-3ds
# this first will upset you if you're a PL/1 shop... (are there any left?)
# in which case rm it; ascmagic will catch real C programs
# C or REXX program text
#0 string /* text/x-c
# C++ program text
#0 string // text/x-c++
#------------------------------------------------------------------------------
# commands: file(1) magic for various shells and interpreters
#
#0 string :\ shell archive or commands for antique kernel text
0 string #!/bin/sh application/x-shellscript
0 string #!\ /bin/sh application/x-shellscript
0 string #!/bin/csh application/x-shellscript
0 string #!\ /bin/csh application/x-shellscript
# korn shell magic, sent by George Wu, gwu@clyde.att.com
0 string #!/bin/ksh application/x-shellscript
0 string #!\ /bin/ksh application/x-shellscript
0 string #!/bin/tcsh application/x-shellscript
0 string #!\ /bin/tcsh application/x-shellscript
0 string #!/usr/local/tcsh application/x-shellscript
0 string #!\ /usr/local/tcsh application/x-shellscript
0 string #!/usr/local/bin/tcsh application/x-shellscript
0 string #!\ /usr/local/bin/tcsh application/x-shellscript
# bash shell magic, from Peter Tobias (tobias@server.et-inf.fho-emden.de)
0 string #!/bin/bash application/x-shellscript
0 string #!\ /bin/bash application/x-shellscript
0 string #!/usr/local/bin/bash application/x-shellscript
0 string #!\ /usr/local/bin/bash application/x-shellscript
#
# zsh/ash/ae/nawk/gawk magic from cameron@cs.unsw.oz.au (Cameron Simpson)
0 string #!/bin/zsh application/x-shellscript
0 string #!/usr/bin/zsh application/x-shellscript
0 string #!/usr/local/bin/zsh application/x-shellscript
0 string #!\ /usr/local/bin/zsh application/x-shellscript
0 string #!/usr/local/bin/ash application/x-shellscript
0 string #!\ /usr/local/bin/ash application/x-shellscript
#0 string #!/usr/local/bin/ae Neil Brown's ae
#0 string #!\ /usr/local/bin/ae Neil Brown's ae
0 string #!/bin/nawk application/x-nawk
0 string #!\ /bin/nawk application/x-nawk
0 string #!/usr/bin/nawk application/x-nawk
0 string #!\ /usr/bin/nawk application/x-nawk
0 string #!/usr/local/bin/nawk application/x-nawk
0 string #!\ /usr/local/bin/nawk application/x-nawk
0 string #!/bin/gawk application/x-gawk
0 string #!\ /bin/gawk application/x-gawk
0 string #!/usr/bin/gawk application/x-gawk
0 string #!\ /usr/bin/gawk application/x-gawk
0 string #!/usr/local/bin/gawk application/x-gawk
0 string #!\ /usr/local/bin/gawk application/x-gawk
#
0 string #!/bin/awk application/x-awk
0 string #!\ /bin/awk application/x-awk
0 string #!/usr/bin/awk application/x-awk
0 string #!\ /usr/bin/awk application/x-awk
# update to distinguish from *.vcf files by Joerg Jenderek: joerg dot jenderek at web dot de
#0 regex BEGIN[[:space:]]*[{] application/x-awk
# For Larry Wall's perl language. The ``eval'' line recognizes an
# outrageously clever hack for USG systems.
# Keith Waclena <keith@cerberus.uchicago.edu>
0 string #!/bin/perl application/x-perl
0 string #!\ /bin/perl application/x-perl
0 string eval\ "exec\ /bin/perl application/x-perl
0 string #!/usr/bin/perl application/x-perl
0 string #!\ /usr/bin/perl application/x-perl
0 string eval\ "exec\ /usr/bin/perl application/x-perl
0 string #!/usr/local/bin/perl application/x-perl
0 string #!\ /usr/local/bin/perl application/x-perl
0 string eval\ "exec\ /usr/local/bin/perl application/x-perl
#------------------------------------------------------------------------------
# compress: file(1) magic for pure-compression formats (no archives)
#
# compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, whap, etc.
#
# Formats for various forms of compressed data
# Formats for "compress" proper have been moved into "compress.c",
# because it tries to uncompress it to figure out what's inside.
# standard unix compress
#0 string \037\235 application/x-compress
# gzip (GNU zip, not to be confused with [Info-ZIP/PKWARE] zip archiver)
#0 string \037\213 application/x-gzip
0 string PK\003\004 application/x-zip
# RAR archiver (Greg Roelofs, newt@uchicago.edu)
0 string Rar! application/x-rar
# According to gzip.h, this is the correct byte order for packed data.
0 string \037\036 application/octet-stream
#
# This magic number is byte-order-independent.
#
0 short 017437 application/octet-stream
# XXX - why *two* entries for "compacted data", one of which is
# byte-order independent, and one of which is byte-order dependent?
#
# compacted data
0 short 0x1fff application/octet-stream
0 string \377\037 application/octet-stream
# huf output
0 short 0145405 application/octet-stream
# Squeeze and Crunch...
# These numbers were gleaned from the Unix versions of the programs to
# handle these formats. Note that I can only uncrunch, not crunch, and
# I didn't have a crunched file handy, so the crunch number is untested.
# Keith Waclena <keith@cerberus.uchicago.edu>
#0 leshort 0x76FF squeezed data (CP/M, DOS)
#0 leshort 0x76FE crunched data (CP/M, DOS)
# Freeze
#0 string \037\237 Frozen file 2.1
#0 string \037\236 Frozen file 1.0 (or gzip 0.5)
# lzh?
#0 string \037\240 LZH compressed data
257 string ustar\0 application/x-tar posix
257 string ustar\040\040\0 application/x-tar gnu
0 short 070707 application/x-cpio
0 short 0143561 application/x-cpio swapped
0 string =<ar> application/x-archive
0 string \!<arch> application/x-archive
>8 string debian application/x-debian-package
#------------------------------------------------------------------------------
#
# RPM: file(1) magic for Red Hat Packages Erik Troan (ewt@redhat.com)
#
0 beshort 0xedab
>2 beshort 0xeedb application/x-rpm
0 lelong&0x8080ffff 0x0000081a application/x-arc lzw
0 lelong&0x8080ffff 0x0000091a application/x-arc squashed
0 lelong&0x8080ffff 0x0000021a application/x-arc uncompressed
0 lelong&0x8080ffff 0x0000031a application/x-arc packed
0 lelong&0x8080ffff 0x0000041a application/x-arc squeezed
0 lelong&0x8080ffff 0x0000061a application/x-arc crunched
0 leshort 0xea60 application/x-arj
# LHARC/LHA archiver (Greg Roelofs, newt@uchicago.edu)
2 string -lh0- application/x-lharc lh0
2 string -lh1- application/x-lharc lh1
2 string -lz4- application/x-lharc lz4
2 string -lz5- application/x-lharc lz5
# [never seen any but the last; -lh4- reported in comp.compression:]
2 string -lzs- application/x-lha lzs
2 string -lh\ - application/x-lha lh
2 string -lhd- application/x-lha lhd
2 string -lh2- application/x-lha lh2
2 string -lh3- application/x-lha lh3
2 string -lh4- application/x-lha lh4
2 string -lh5- application/x-lha lh5
2 string -lh6- application/x-lha lh6
2 string -lh7- application/x-lha lh7
# Shell archives
10 string #\ This\ is\ a\ shell\ archive application/octet-stream x-shell
#------------------------------------------------------------------------------
# frame: file(1) magic for FrameMaker files
#
# This stuff came on a FrameMaker demo tape, most of which is
# copyright, but this file is "published" as witness the following:
#
0 string \<MakerFile application/x-frame
0 string \<MIFFile application/x-frame
0 string \<MakerDictionary application/x-frame
0 string \<MakerScreenFon application/x-frame
0 string \<MML application/x-frame
0 string \<Book application/x-frame
0 string \<Maker application/x-frame
#------------------------------------------------------------------------------
# html: file(1) magic for HTML (HyperText Markup Language) docs
#
# from Daniel Quinlan <quinlan@yggdrasil.com>
#
0 string/cB \<!DOCTYPE\ html text/html
0 string/cb \<head text/html
0 string/cb \<title text/html
0 string/bc \<html text/html
0 string \<!-- text/html
0 string/c \<h1 text/html
0 string \<?xml text/xml
#------------------------------------------------------------------------------
# images: file(1) magic for image formats (see also "c-lang" for XPM bitmaps)
#
# originally from jef@helios.ee.lbl.gov (Jef Poskanzer),
# additions by janl@ifi.uio.no as well as others. Jan also suggested
# merging several one- and two-line files into here.
#
# XXX - byte order for GIF and TIFF fields?
# [GRR: TIFF allows both byte orders; GIF is probably little-endian]
#
# [GRR: what the hell is this doing in here?]
#0 string xbtoa btoa'd file
# PBMPLUS
# PBM file
0 string P1 image/x-portable-bitmap 7bit
# PGM file
0 string P2 image/x-portable-greymap 7bit
# PPM file
0 string P3 image/x-portable-pixmap 7bit
# PBM "rawbits" file
0 string P4 image/x-portable-bitmap
# PGM "rawbits" file
0 string P5 image/x-portable-greymap
# PPM "rawbits" file
0 string P6 image/x-portable-pixmap
# NIFF (Navy Interchange File Format, a modification of TIFF)
# [GRR: this *must* go before TIFF]
0 string IIN1 image/x-niff
# TIFF and friends
# TIFF file, big-endian
0 string MM image/tiff
# TIFF file, little-endian
0 string II image/tiff
# possible GIF replacements; none yet released!
# (Greg Roelofs, newt@uchicago.edu)
#
# GRR 950115: this was mine ("Zip GIF"):
# ZIF image (GIF+deflate alpha)
0 string GIF94z image/unknown
#
# GRR 950115: this is Jeremy Wohl's Free Graphics Format (better):
# FGF image (GIF+deflate beta)
0 string FGF95a image/unknown
#
# GRR 950115: this is Thomas Boutell's Portable Bitmap Format proposal
# (best; not yet implemented):
# PBF image (deflate compression)
0 string PBF image/unknown
# GIF
0 string GIF image/gif
# JPEG images
0 beshort 0xffd8 image/jpeg
# PC bitmaps (OS/2, Windoze BMP files) (Greg Roelofs, newt@uchicago.edu)
0 string BM image/x-ms-bmp
#>14 byte 12 (OS/2 1.x format)
#>14 byte 64 (OS/2 2.x format)
#>14 byte 40 (Windows 3.x format)
#0 string IC icon
#0 string PI pointer
#0 string CI color icon
#0 string CP color pointer
#0 string BA bitmap array
# CDROM Filesystems
32769 string CD001 application/x-iso9660
# Newer StuffIt archives (grant@netbsd.org)
0 string StuffIt application/x-stuffit
#>162 string >0 : %s
# BinHex is the Macintosh ASCII-encoded file format (see also "apple")
# Daniel Quinlan, quinlan@yggdrasil.com
11 string must\ be\ converted\ with\ BinHex\ 4 application/mac-binhex40
##>41 string x \b, version %.3s
#------------------------------------------------------------------------------
# lisp: file(1) magic for lisp programs
#
# various lisp types, from Daniel Quinlan (quinlan@yggdrasil.com)
0 string ;; text/plain 8bit
# Emacs 18 - this is always correct, but not very magical.
0 string \012( application/x-elc
# Emacs 19
0 string ;ELC\023\000\000\000 application/x-elc
#------------------------------------------------------------------------------
# mail.news: file(1) magic for mail and news
#
# There are tests to ascmagic.c to cope with mail and news.
0 string Relay-Version: message/rfc822 7bit
0 string #!\ rnews message/rfc822 7bit
0 string N#!\ rnews message/rfc822 7bit
0 string Forward\ to message/rfc822 7bit
0 string Pipe\ to message/rfc822 7bit
0 string Return-Path: message/rfc822 7bit
0 string Received: message/rfc822
0 string Path: message/news 8bit
0 string Xref: message/news 8bit
0 string From: message/rfc822 7bit
0 string Article message/news 8bit
#------------------------------------------------------------------------------
# msword: file(1) magic for MS Word files
#
# Contributor claims:
# Reversed-engineered MS Word magic numbers
#
0 string \376\067\0\043 application/msword
0 string \320\317\021\340\241\261 application/msword
0 string \333\245-\0\0\0 application/msword
#------------------------------------------------------------------------------
# printer: file(1) magic for printer-formatted files
#
# PostScript
0 string %! application/postscript
0 string \004%! application/postscript
# Acrobat
# (due to clamen@cs.cmu.edu)
0 string %PDF- application/pdf
#------------------------------------------------------------------------------
# sc: file(1) magic for "sc" spreadsheet
#
38 string Spreadsheet application/x-sc
#------------------------------------------------------------------------------
# tex: file(1) magic for TeX files
#
# XXX - needs byte-endian stuff (big-endian and little-endian DVI?)
#
# From <conklin@talisman.kaleida.com>
# Although we may know the offset of certain text fields in TeX DVI
# and font files, we can't use them reliably because they are not
# zero terminated. [but we do anyway, christos]
0 string \367\002 application/x-dvi
#0 string \367\203 TeX generic font data
#0 string \367\131 TeX packed font data
#0 string \367\312 TeX virtual font data
#0 string This\ is\ TeX, TeX transcript text
#0 string This\ is\ METAFONT, METAFONT transcript text
# There is no way to detect TeX Font Metric (*.tfm) files without
# breaking them apart and reading the data. The following patterns
# match most *.tfm files generated by METAFONT or afm2tfm.
2 string \000\021 application/x-tex-tfm
2 string \000\022 application/x-tex-tfm
#>34 string >\0 (%s)
# Texinfo and GNU Info, from Daniel Quinlan (quinlan@yggdrasil.com)
0 string \\input\ texinfo text/x-texinfo
0 string This\ is\ Info\ file text/x-info
# correct TeX magic for Linux (and maybe more)
# from Peter Tobias (tobias@server.et-inf.fho-emden.de)
#
0 leshort 0x02f7 application/x-dvi
# RTF - Rich Text Format
0 string {\\rtf text/rtf
#------------------------------------------------------------------------------
# animation: file(1) magic for animation/movie formats
#
# animation formats, originally from vax@ccwf.cc.utexas.edu (VaX#n8)
# MPEG file
# MPEG sequences
0 belong 0x000001BA
>4 byte &0x40 video/mp2p
>4 byte ^0x40 video/mpeg
0 belong 0x000001BB video/mpeg
0 belong 0x000001B0 video/mp4v-es
0 belong 0x000001B5 video/mp4v-es
0 belong 0x000001B3 video/mpv
0 belong&0xFF5FFF1F 0x47400010 video/mp2t
0 belong 0x00000001
>4 byte&0x1F 0x07 video/h264
# FLI animation format
0 leshort 0xAF11 video/fli
# FLC animation format
0 leshort 0xAF12 video/flc
#
# SGI and Apple formats
# Added ISO mimes
0 string MOVI video/sgi
4 string moov video/quicktime
4 string mdat video/quicktime
4 string wide video/quicktime
4 string skip video/quicktime
4 string free video/quicktime
4 string idsc image/x-quicktime
4 string idat image/x-quicktime
4 string pckg application/x-quicktime
4 string/B jP image/jp2
4 string ftyp
>8 string isom video/mp4
>8 string mp41 video/mp4
>8 string mp42 video/mp4
>8 string/B jp2 image/jp2
>8 string 3gp video/3gpp
>8 string avc1 video/3gpp
>8 string mmp4 video/mp4
>8 string/B M4A audio/mp4
>8 string/B qt video/quicktime
# The contributor claims:
# I couldn't find a real magic number for these, however, this
# -appears- to work. Note that it might catch other files, too,
# so BE CAREFUL!
#
# Note that title and author appear in the two 20-byte chunks
# at decimal offsets 2 and 22, respectively, but they are XOR'ed with
# 255 (hex FF)! DL format SUCKS BIG ROCKS.
#
# DL file version 1 , medium format (160x100, 4 images/screen)
0 byte 1 video/unknown
0 byte 2 video/unknown
#
# Databases
#
# GDBM magic numbers
# Will be maintained as part of the GDBM distribution in the future.
# <downsj@teeny.org>
0 belong 0x13579ace application/x-gdbm
0 lelong 0x13579ace application/x-gdbm
0 string GDBM application/x-gdbm
#
0 belong 0x061561 application/x-dbm
#
# Executables
#
0 string \177ELF
>16 leshort 0 application/octet-stream
>16 leshort 1 application/x-object
>16 leshort 2 application/x-executable
>16 leshort 3 application/x-sharedlib
>16 leshort 4 application/x-coredump
>16 beshort 0 application/octet-stream
>16 beshort 1 application/x-object
>16 beshort 2 application/x-executable
>16 beshort 3 application/x-sharedlib
>16 beshort 4 application/x-coredump
#
# DOS
0 string MZ application/x-dosexec
#
# KDE
0 string [KDE\ Desktop\ Entry] application/x-kdelnk
0 string \#\ KDE\ Config\ File application/x-kdelnk
# xmcd database file for kscd
0 string \#\ xmcd text/xmcd
#------------------------------------------------------------------------------
# pkgadd: file(1) magic for SysV R4 PKG Datastreams
#
0 string #\ PaCkAgE\ DaTaStReAm application/x-svr4-package
#PNG Image Format
0 string \x89PNG image/png
# MNG Video Format, <URL:http://www.libpng.org/pub/mng/spec/>
0 string \x8aMNG video/x-mng
0 string \x8aJNG video/x-jng
#------------------------------------------------------------------------------
# Hierarchical Data Format, used to facilitate scientific data exchange
# specifications at http://hdf.ncsa.uiuc.edu/
#Hierarchical Data Format (version 4) data
0 belong 0x0e031301 application/x-hdf
#Hierarchical Data Format (version 5) data
0 string \211HDF\r\n\032 application/x-hdf
# Adobe Photoshop
0 string 8BPS image/x-photoshop
# Felix von Leitner <felix-file@fefe.de>
0 string d8:announce application/x-bittorrent
# lotus 1-2-3 document
0 belong 0x00001a00 application/x-123
0 belong 0x00000200 application/x-123
# MS Access database
4 string Standard\ Jet\ DB application/msaccess
## magic for XBase files
#0 byte 0x02
#>8 leshort >0
#>>12 leshort 0 application/x-dbf
#
#0 byte 0x03
#>8 leshort >0
#>>12 leshort 0 application/x-dbf
#
#0 byte 0x04
#>8 leshort >0
#>>12 leshort 0 application/x-dbf
#
#0 byte 0x05
#>8 leshort >0
#>>12 leshort 0 application/x-dbf
#
#0 byte 0x30
#>8 leshort >0
#>>12 leshort 0 application/x-dbf
#
#0 byte 0x43
#>8 leshort >0
#>>12 leshort 0 application/x-dbf
#
#0 byte 0x7b
#>8 leshort >0
#>>12 leshort 0 application/x-dbf
#
#0 byte 0x83
#>8 leshort >0
#>>12 leshort 0 application/x-dbf
#
#0 byte 0x8b
#>8 leshort >0
#>>12 leshort 0 application/x-dbf
#
#0 byte 0x8e
#>8 leshort >0
#>>12 leshort 0 application/x-dbf
#
#0 byte 0xb3
#>8 leshort >0
#>>12 leshort 0 application/x-dbf
#
#0 byte 0xf5
#>8 leshort >0
#>>12 leshort 0 application/x-dbf
#
#0 leshort 0x0006 application/x-dbt
# Debian has entries for the old PGP formats:
# pgp: file(1) magic for Pretty Good Privacy
# see http://lists.gnupg.org/pipermail/gnupg-devel/1999-September/016052.html
#text/PGP key public ring
0 beshort 0x9900 application/pgp
#text/PGP key security ring
0 beshort 0x9501 application/pgp
#text/PGP key security ring
0 beshort 0x9500 application/pgp
#text/PGP encrypted data
0 beshort 0xa600 application/pgp-encrypted
#text/PGP armored data
##public key block
2 string ---BEGIN\ PGP\ PUBLIC\ KEY\ BLOCK- application/pgp-keys
0 string -----BEGIN\040PGP\40MESSAGE- application/pgp
0 string -----BEGIN\040PGP\40SIGNATURE- application/pgp-signature
#
# GnuPG Magic:
#
#
#text/GnuPG key public ring
0 beshort 0x9901 application/pgp
#text/OpenPGP data
0 beshort 0x8501 application/pgp-encrypted
# flash: file(1) magic for Macromedia Flash file format
#
# See
#
# http://www.macromedia.com/software/flash/open/
#
0 string FWS
>3 byte x application/x-shockwave-flash
# The following paramaters are created for Namazu.
# <http://www.namazu.org/>
#
# 1999/08/13
#0 string \<!--\ MHonArc text/html; x-type=mhonarc
0 string BZh application/x-bzip2
# 1999/09/09
# VRML (suggested by Masao Takaku)
0 string #VRML\ V1.0\ ascii model/vrml
0 string #VRML\ V2.0\ utf8 model/vrml
#------------------------------------------------------------------------------
# ichitaro456: file(1) magic for Just System Word Processor Ichitaro
#
# Contributor kenzo-:
# Reversed-engineered JS Ichitaro magic numbers
#
0 string DOC
>43 byte 0x14 application/ichitaro4
>144 string JDASH application/ichitaro4
0 string DOC
>43 byte 0x15 application/ichitaro5
0 string DOC
>43 byte 0x16 application/ichitaro6
#------------------------------------------------------------------------------
# office97: file(1) magic for MicroSoft Office files
#
# Contributor kenzo-:
# Reversed-engineered MS Office magic numbers
#
#0 string \320\317\021\340\241\261\032\341
#>48 byte 0x1B application/excel
2080 string Microsoft\ Excel\ 5.0\ Worksheet application/excel
2114 string Biff5 application/excel
0 string \224\246\056 application/msword
0 belong 0x31be0000 application/msword
0 string PO^Q` application/msword
0 string \320\317\021\340\241\261\032\341
>546 string bjbj application/msword
>546 string jbjb application/msword
512 string R\0o\0o\0t\0\ \0E\0n\0t\0r\0y application/msword
2080 string Microsoft\ Word\ 6.0\ Document application/msword
2080 string Documento\ Microsoft\ Word\ 6 application/msword
2112 string MSWordDoc application/msword
#0 string \320\317\021\340\241\261\032\341 application/powerpoint
0 string \320\317\021\340\241\261\032\341 application/msword
0 string #\ PaCkAgE\ DaTaStReAm application/x-svr4-package
# WinNT/WinCE PE files (Warner Losh, imp@village.org)
#
128 string PE\000\000 application/octet-stream
0 string PE\000\000 application/octet-stream
# miscellaneous formats
0 string LZ application/octet-stream
# .EXE formats (Greg Roelofs, newt@uchicago.edu)
#
0 string MZ
>24 string @ application/octet-stream
0 string MZ
>30 string Copyright\ 1989-1990\ PKWARE\ Inc. application/x-zip
0 string MZ
>30 string PKLITE\ Copr. application/x-zip
0 string MZ
>36 string LHa's\ SFX application/x-lha
0 string MZ application/octet-stream
# LHA archiver
2 string -lh
>6 string - application/x-lha
# Zoo archiver
20 lelong 0xfdc4a7dc application/x-zoo
# ARC archiver
0 lelong&0x8080ffff 0x0000081a application/x-arc
0 lelong&0x8080ffff 0x0000091a application/x-arc
0 lelong&0x8080ffff 0x0000021a application/x-arc
0 lelong&0x8080ffff 0x0000031a application/x-arc
0 lelong&0x8080ffff 0x0000041a application/x-arc
0 lelong&0x8080ffff 0x0000061a application/x-arc
# Microsoft Outlook's Transport Neutral Encapsulation Format (TNEF)
0 lelong 0x223e9f78 application/ms-tnef
# From: stephane.loeuillet@tiscali.f
# http://www.djvuzone.org/
0 string AT&TFORM image/x.djvu
# Danny Milosavljevic <danny.milo@gmx.net>
# this are adrift (adventure game standard) game files, extension .taf
# depending on version magic continues with 0x93453E6139FA (V 4.0)
# 0x9445376139FA (V 3.90)
# 0x9445366139FA (V 3.80)
# this is from source (http://www.adrift.org.uk/) and I have some taf
# files, and checked them.
#0 belong 0x3C423FC9
#>4 belong 0x6A87C2CF application/x-adrift
#0 string \000\000\001\000 image/x-ico
# Quark Xpress 3 Files:
# (made the mimetype up)
0 string \0\0MMXPR3\0 application/x-quark-xpress-3
# EET archive
# From: Tilman Sauerbeck <tilman@code-monkey.de>
0 belong 0x1ee7ff00 application/x-eet
# From: Denis Knauf, via gentoo.
0 string fLaC audio/x-flac
0 string CWS application/x-shockwave-flash
# Gnumeric spreadsheet
# This entry is only semi-helpful, as Gnumeric compresses its files, so
# they will ordinarily reported as "compressed", but at least -z helps
39 string =<gmr:Workbook application/x-gnumeric

View File

@ -0,0 +1,2 @@
# Depends: authn_core
LoadModule access_compat_module /usr/lib/apache2/modules/mod_access_compat.so

View File

@ -0,0 +1,11 @@
# a2enmod-note: needs-configuration
#
# Action lets you define media types that will execute a script whenever
# a matching file is called. This eliminates the need for repeated URL
# pathnames for oft-used CGI file processors.
# Format: Action media/type /cgi-script/location
# Format: Action handler-name /cgi-script/location
#
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

View File

@ -0,0 +1 @@
LoadModule actions_module /usr/lib/apache2/modules/mod_actions.so

View File

@ -0,0 +1,24 @@
<IfModule alias_module>
# Aliases: Add here as many aliases as you need (with no limit). The format is
# Alias fakename realname
#
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL. So "/icons" isn't aliased in this
# example, only "/icons/". If the fakename is slash-terminated, then the
# realname must also be slash terminated, and if the fakename omits the
# trailing slash, the realname must also omit it.
#
# We include the /icons/ alias for FancyIndexed directory listings. If
# you do not use FancyIndexing, you may comment this out.
Alias /icons/ "/usr/share/apache2/icons/"
<Directory "/usr/share/apache2/icons">
Options FollowSymlinks
AllowOverride None
Require all granted
</Directory>
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

View File

@ -0,0 +1 @@
LoadModule alias_module /usr/lib/apache2/modules/mod_alias.so

View File

@ -0,0 +1 @@
LoadModule allowmethods_module /usr/lib/apache2/modules/mod_allowmethods.so

View File

@ -0,0 +1,2 @@
# Depends: mime
LoadModule asis_module /usr/lib/apache2/modules/mod_asis.so

View File

@ -0,0 +1,2 @@
# Depends: authn_core
LoadModule auth_basic_module /usr/lib/apache2/modules/mod_auth_basic.so

View File

@ -0,0 +1,2 @@
# Depends: authn_core
LoadModule auth_digest_module /usr/lib/apache2/modules/mod_auth_digest.so

View File

@ -0,0 +1,2 @@
# Depends: session authn_core
LoadModule auth_form_module /usr/lib/apache2/modules/mod_auth_form.so

View File

@ -0,0 +1 @@
LoadModule authn_anon_module /usr/lib/apache2/modules/mod_authn_anon.so

View File

@ -0,0 +1 @@
LoadModule authn_core_module /usr/lib/apache2/modules/mod_authn_core.so

View File

@ -0,0 +1,2 @@
# Depends: dbd
LoadModule authn_dbd_module /usr/lib/apache2/modules/mod_authn_dbd.so

View File

@ -0,0 +1 @@
LoadModule authn_dbm_module /usr/lib/apache2/modules/mod_authn_dbm.so

View File

@ -0,0 +1 @@
LoadModule authn_file_module /usr/lib/apache2/modules/mod_authn_file.so

View File

@ -0,0 +1 @@
LoadModule authn_socache_module /usr/lib/apache2/modules/mod_authn_socache.so

View File

@ -0,0 +1 @@
LoadModule authnz_fcgi_module /usr/lib/apache2/modules/mod_authnz_fcgi.so

View File

@ -0,0 +1,2 @@
# Depends: ldap
LoadModule authnz_ldap_module /usr/lib/apache2/modules/mod_authnz_ldap.so

View File

@ -0,0 +1 @@
LoadModule authz_core_module /usr/lib/apache2/modules/mod_authz_core.so

Some files were not shown because too many files have changed in this diff Show More