mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
WIP
This commit is contained in:
parent
91592f9437
commit
a27a5af25f
@ -6,6 +6,7 @@ CREATE TABLE `state_users` (
|
||||
`email` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
||||
`first_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
||||
`last_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
||||
`user_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `public_key` (`public_key`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
@ -33,7 +33,7 @@ use Cake\I18n\I18n;
|
||||
*/
|
||||
class AppController extends Controller
|
||||
{
|
||||
|
||||
|
||||
var $loginServerUrl = '';
|
||||
/**
|
||||
* Initialization hook method.
|
||||
@ -44,104 +44,124 @@ class AppController extends Controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
parent::initialize();
|
||||
public function initialize()
|
||||
{
|
||||
parent::initialize();
|
||||
|
||||
$this->loadComponent('RequestHandler', [
|
||||
'enableBeforeRedirect' => false,
|
||||
]);
|
||||
$this->loadComponent('Flash');
|
||||
$this->loadComponent('RequestHandler', [
|
||||
'enableBeforeRedirect' => false,
|
||||
]);
|
||||
$this->loadComponent('Flash');
|
||||
|
||||
$this->loadComponent('Auth', [
|
||||
'loginAction' => [
|
||||
'controller' => 'ServerUsers',
|
||||
'action' => 'login'
|
||||
],
|
||||
'loginRedirect' => [
|
||||
'controller' => 'Transactions',
|
||||
'action' => 'index'
|
||||
],
|
||||
'logoutRedirect' => [
|
||||
'controller' => 'Pages',
|
||||
'action' => 'display',
|
||||
'gradido'
|
||||
],
|
||||
'authenticate' => [
|
||||
'all' => ['userModel' => 'ServerUsers'],
|
||||
'Form' => [
|
||||
'userModel' => 'ServerUsers',
|
||||
]
|
||||
]
|
||||
]);
|
||||
$this->loadComponent('Auth', [
|
||||
<<<<<<< Updated upstream
|
||||
'loginAction' => [
|
||||
'controller' => 'ServerUsers',
|
||||
'action' => 'login'
|
||||
],
|
||||
'loginRedirect' => [
|
||||
'controller' => 'Transactions',
|
||||
'action' => 'index'
|
||||
],
|
||||
'logoutRedirect' => [
|
||||
'controller' => 'Pages',
|
||||
'action' => 'display',
|
||||
'gradido'
|
||||
],
|
||||
'authenticate' => [
|
||||
'all' => ['userModel' => 'ServerUsers'],
|
||||
'Form' => [
|
||||
'userModel' => 'ServerUsers',
|
||||
]
|
||||
]
|
||||
|
||||
$this->Auth->deny(['index']);
|
||||
=======
|
||||
'loginAction' => [
|
||||
'controller' => 'ServerUsers',
|
||||
'action' => 'login'
|
||||
],
|
||||
'loginRedirect' => [
|
||||
'controller' => 'Transactions',
|
||||
'action' => 'index'
|
||||
],
|
||||
'logoutRedirect' => [
|
||||
'controller' => 'Pages',
|
||||
'action' => 'display',
|
||||
'gradido'
|
||||
],
|
||||
'authenticate' => [
|
||||
'all' => ['userModel' => 'ServerUsers'],
|
||||
'Form' => [
|
||||
'userModel' => 'ServerUsers',
|
||||
]
|
||||
]
|
||||
]);
|
||||
|
||||
/*
|
||||
* Enable the following component for recommended CakePHP security settings.
|
||||
* see https://book.cakephp.org/3.0/en/controllers/components/security.html
|
||||
*/
|
||||
//$this->loadComponent('Security');
|
||||
$this->Auth->deny(['index']);
|
||||
|
||||
/*
|
||||
* Enable the following component for recommended CakePHP security settings.
|
||||
* see https://book.cakephp.org/3.0/en/controllers/components/security.html
|
||||
*/
|
||||
//$this->loadComponent('Security');
|
||||
|
||||
|
||||
// load current balance
|
||||
$session = $this->getRequest()->getSession();
|
||||
$state_user_id = $session->read('StateUser.id');
|
||||
if($state_user_id) {
|
||||
$stateBalancesTable = TableRegistry::getTableLocator()->get('stateBalances');
|
||||
$stateBalanceQuery = $stateBalancesTable
|
||||
->find('all')
|
||||
->select('amount')
|
||||
->contain(false)
|
||||
->where(['state_user_id' => $state_user_id]);
|
||||
if($stateBalanceQuery->count() == 1) {
|
||||
//var_dump($stateBalanceEntry->first());
|
||||
// load current balance
|
||||
$session = $this->getRequest()->getSession();
|
||||
$state_user_id = $session->read('StateUser.id');
|
||||
if ($state_user_id) {
|
||||
$stateBalancesTable = TableRegistry::getTableLocator()->get('stateBalances');
|
||||
$stateBalanceQuery = $stateBalancesTable
|
||||
->find('all')
|
||||
->select('amount')
|
||||
->contain(false)
|
||||
->where(['state_user_id' => $state_user_id]);
|
||||
if ($stateBalanceQuery->count() == 1) {
|
||||
//var_dump($stateBalanceEntry->first());
|
||||
$session->write('StateUser.balance', $stateBalanceQuery->first()->amount);
|
||||
//echo "stateUser.balance: " . $session->read('StateUser.balance');
|
||||
}
|
||||
//echo "stateUser.balance: " . $session->read('StateUser.balance');
|
||||
}
|
||||
|
||||
// load error count
|
||||
if($state_user_id) {
|
||||
$stateErrorsTable = TableRegistry::getTableLocator()->get('stateErrors');
|
||||
$stateErrorQuery = $stateErrorsTable
|
||||
->find('all')
|
||||
->select('id')
|
||||
->contain(false)
|
||||
->where(['state_user_id' => $state_user_id]);
|
||||
$session->write('StateUser.errorCount', $stateErrorQuery->count());
|
||||
}
|
||||
//echo "initialize";
|
||||
|
||||
|
||||
// put current page into global for navi
|
||||
$GLOBALS["passed"] = null;
|
||||
$side = $this->request->getParam('controller');
|
||||
$GLOBALS["side"] = $side;
|
||||
$subside = $this->request->getParam('action');
|
||||
$passedArguments = $this->request->getParam('pass');
|
||||
if($passedArguments) {
|
||||
$GLOBALS["passed"] = $passedArguments[0];
|
||||
}
|
||||
$GLOBALS["subside"] = $subside;
|
||||
|
||||
// server login
|
||||
if($this->Auth->user('id')) {
|
||||
$GLOBALS['ServerUser'] = $this->Auth->user();
|
||||
}
|
||||
|
||||
// login server url
|
||||
$loginServer = Configure::read('LoginServer');
|
||||
if($loginServer && isset($loginServer['url'])) {
|
||||
$this->loginServerUrl = $loginServer['url'] . '/';
|
||||
} else {
|
||||
$this->loginServerUrl = Router::url('/', true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function requestLogin()
|
||||
// load error count
|
||||
if ($state_user_id) {
|
||||
$stateErrorsTable = TableRegistry::getTableLocator()->get('stateErrors');
|
||||
$stateErrorQuery = $stateErrorsTable
|
||||
->find('all')
|
||||
->select('id')
|
||||
->contain(false)
|
||||
->where(['state_user_id' => $state_user_id]);
|
||||
$session->write('StateUser.errorCount', $stateErrorQuery->count());
|
||||
}
|
||||
//echo "initialize";
|
||||
|
||||
|
||||
// put current page into global for navi
|
||||
$GLOBALS["passed"] = null;
|
||||
$side = $this->request->getParam('controller');
|
||||
$GLOBALS["side"] = $side;
|
||||
$subside = $this->request->getParam('action');
|
||||
$passedArguments = $this->request->getParam('pass');
|
||||
if ($passedArguments) {
|
||||
$GLOBALS["passed"] = $passedArguments[0];
|
||||
}
|
||||
$GLOBALS["subside"] = $subside;
|
||||
|
||||
// server login
|
||||
if ($this->Auth->user('id')) {
|
||||
$GLOBALS['ServerUser'] = $this->Auth->user();
|
||||
}
|
||||
|
||||
// login server url
|
||||
$loginServer = Configure::read('LoginServer');
|
||||
if ($loginServer && isset($loginServer['url'])) {
|
||||
$this->loginServerUrl = $loginServer['url'] . '/';
|
||||
} else {
|
||||
$this->loginServerUrl = Router::url('/', true);
|
||||
}
|
||||
}
|
||||
|
||||
protected function requestLogin()
|
||||
{
|
||||
$session = $this->getRequest()->getSession();
|
||||
// check login
|
||||
@ -149,118 +169,121 @@ class AppController extends Controller
|
||||
//$this->Cookie->configKey('User', 'encryption', false);
|
||||
$session_id = intval($this->request->getCookie('GRADIDO_LOGIN', ''));
|
||||
$ip = $this->request->clientIp();
|
||||
if(!$session->check('client_ip')) {
|
||||
$session->write('client_ip', $ip);
|
||||
}
|
||||
if (!$session->check('client_ip')) {
|
||||
$session->write('client_ip', $ip);
|
||||
}
|
||||
// login server cannot detect host ip
|
||||
// TODO: update login server, recognize nginx real ip header
|
||||
$loginServer = Configure::read('LoginServer');
|
||||
|
||||
if($session_id != 0) {
|
||||
$userStored = $session->read('StateUser');
|
||||
|
||||
$transactionPendings = $session->read('Transactions.pending');
|
||||
$transactionExecutings = $session->read('Transaction.executing');
|
||||
if($session->read('session_id') != $session_id ||
|
||||
( $userStored && (!isset($userStored['id']) || !$userStored['email_checked'])) ||
|
||||
intval($transactionPendings) > 0 ||
|
||||
intval($transactionExecutings) > 0 ) {
|
||||
|
||||
if ($session_id != 0) {
|
||||
$userStored = $session->read('StateUser');
|
||||
$transactionPendings = $session->read('Transactions.pending');
|
||||
$transactionExecutings = $session->read('Transaction.executing');
|
||||
if ($session->read('session_id') != $session_id ||
|
||||
( $userStored && (!isset($userStored['id']) || !$userStored['email_checked'])) ||
|
||||
intval($transactionPendings) > 0 ||
|
||||
intval($transactionExecutings) > 0) {
|
||||
$http = new Client();
|
||||
|
||||
try {
|
||||
$url = $loginServer['host'] . ':' . $loginServer['port'];
|
||||
( $userStored && !isset($userStored['id'])) ||
|
||||
intval($transactionPendings) > 0 ||
|
||||
intval($transactionExecutings) > 0) {
|
||||
$http = new Client();
|
||||
|
||||
|
||||
try {
|
||||
$url = $loginServer['host'] . ':' . $loginServer['port'];
|
||||
$url = $loginServer['host'] . ':' . $loginServer['port'];
|
||||
$response = $http->get($url . '/login', ['session_id' => $session_id]);
|
||||
$json = $response->getJson();
|
||||
|
||||
$response = $http->get($url . '/login', ['session_id' => $session_id]);
|
||||
$json = $response->getJson();
|
||||
if (isset($json) && count($json) > 0) {
|
||||
if ($json['state'] === 'success') {
|
||||
//echo "email checked: " . $json['user']['email_checked'] . "; <br>";
|
||||
if ($session->read('session_id') != $session_id ||
|
||||
( $userStored && !isset($userStored['id']))) {
|
||||
$session->destroy();
|
||||
}
|
||||
foreach ($json['user'] as $key => $value) {
|
||||
$session->write('StateUser.' . $key, $value);
|
||||
}
|
||||
//var_dump($json);
|
||||
$transactionPendings = $json['Transaction.pending'];
|
||||
$transactionExecuting = $json['Transaction.executing'];
|
||||
//echo "read transaction pending: $transactionPendings<br>";
|
||||
$session->write('Transactions.pending', $transactionPendings);
|
||||
$session->write('Transaction.executing', $transactionExecuting);
|
||||
$session->write('session_id', $session_id);
|
||||
$stateUserTable = TableRegistry::getTableLocator()->get('StateUsers');
|
||||
|
||||
if(isset($json) && count($json) > 0) {
|
||||
|
||||
if($json['state'] === 'success') {
|
||||
//echo "email checked: " . $json['user']['email_checked'] . "; <br>";
|
||||
if($session->read('session_id') != $session_id ||
|
||||
( $userStored && !isset($userStored['id']))) {
|
||||
$session->destroy();
|
||||
}
|
||||
foreach($json['user'] as $key => $value) {
|
||||
$session->write('StateUser.' . $key, $value );
|
||||
}
|
||||
//var_dump($json);
|
||||
$transactionPendings = $json['Transaction.pending'];
|
||||
$transactionExecuting = $json['Transaction.executing'];
|
||||
//echo "read transaction pending: $transactionPendings<br>";
|
||||
$session->write('Transactions.pending', $transactionPendings);
|
||||
$session->write('Transaction.executing', $transactionExecuting);
|
||||
$session->write('session_id', $session_id);
|
||||
$stateUserTable = TableRegistry::getTableLocator()->get('StateUsers');
|
||||
|
||||
if(isset($json['user']['public_hex']) && $json['user']['public_hex'] != '') {
|
||||
$public_key_bin = hex2bin($json['user']['public_hex']);
|
||||
$stateUserQuery = $stateUserTable
|
||||
if (isset($json['user']['public_hex']) && $json['user']['public_hex'] != '') {
|
||||
$public_key_bin = hex2bin($json['user']['public_hex']);
|
||||
$stateUserQuery = $stateUserTable
|
||||
->find('all')
|
||||
->where(['public_key' => $public_key_bin])
|
||||
->contain(['StateBalances']);
|
||||
if($stateUserQuery->count() == 1) {
|
||||
$stateUser = $stateUserQuery->first();
|
||||
if($stateUser->first_name != $json['user']['first_name'] ||
|
||||
$stateUser->last_name != $json['user']['last_name'] ||
|
||||
$stateUser->email != $json['user']['email']) {
|
||||
$stateUser->first_name = $json['user']['first_name'];
|
||||
$stateUser->last_name = $json['user']['last_name'];
|
||||
$stateUser->email = $json['user']['email'];
|
||||
if(!$stateUserTable->save($stateUser)) {
|
||||
$this->Flash->error(__('error updating state user ' . json_encode($stateUser->errors())));
|
||||
if ($stateUserQuery->count() == 1) {
|
||||
$stateUser = $stateUserQuery->first();
|
||||
if ($stateUser->first_name != $json['user']['first_name'] ||
|
||||
$stateUser->last_name != $json['user']['last_name'] ||
|
||||
$stateUser->email != $json['user']['email']) {
|
||||
$stateUser->first_name = $json['user']['first_name'];
|
||||
$stateUser->last_name = $json['user']['last_name'];
|
||||
$stateUser->email = $json['user']['email'];
|
||||
if (!$stateUserTable->save($stateUser)) {
|
||||
$this->Flash->error(__('error updating state user ' . json_encode($stateUser->errors())));
|
||||
}
|
||||
}
|
||||
//var_dump($stateUser);
|
||||
if (count($stateUser->state_balances) > 0) {
|
||||
$session->write('StateUser.balance', $stateUser->state_balances[0]->amount);
|
||||
}
|
||||
$session->write('StateUser.id', $stateUser->id);
|
||||
//echo $stateUser['id'];
|
||||
} else {
|
||||
$newStateUser = $stateUserTable->newEntity();
|
||||
$newStateUser->public_key = $public_key_bin;
|
||||
$newStateUser->first_name = $json['user']['first_name'];
|
||||
$newStateUser->last_name = $json['user']['last_name'];
|
||||
$newStateUser->email = $json['user']['email'];
|
||||
if (!$stateUserTable->save($newStateUser)) {
|
||||
$this->Flash->error(__('error saving state user ' . json_encode($newStateUser->errors())));
|
||||
}
|
||||
$session->write('StateUser.id', $newStateUser->id);
|
||||
//echo $newStateUser->id;
|
||||
}
|
||||
} else {
|
||||
// we haven't get a pubkey? something seems to gone wrong on the login-server
|
||||
$this->Flash->error(__('no pubkey'));
|
||||
//var_dump($json);
|
||||
return $this->redirect($this->loginServerUrl . 'account/error500/noPubkey', 303);
|
||||
}
|
||||
}
|
||||
//var_dump($stateUser);
|
||||
if(count($stateUser->state_balances) > 0) {
|
||||
$session->write('StateUser.balance', $stateUser->state_balances[0]->amount);
|
||||
}
|
||||
$session->write('StateUser.id', $stateUser->id);
|
||||
//echo $stateUser['id'];
|
||||
} else {
|
||||
$newStateUser = $stateUserTable->newEntity();
|
||||
$newStateUser->public_key = $public_key_bin;
|
||||
$newStateUser->first_name = $json['user']['first_name'];
|
||||
$newStateUser->last_name = $json['user']['last_name'];
|
||||
$newStateUser->email = $json['user']['email'];
|
||||
if(!$stateUserTable->save($newStateUser)) {
|
||||
$this->Flash->error(__('error saving state user ' . json_encode($newStateUser->errors())));
|
||||
}
|
||||
$session->write('StateUser.id', $newStateUser->id);
|
||||
//echo $newStateUser->id;
|
||||
if ($json['state'] === 'not found') {
|
||||
$this->Flash->error(__('invalid session'));
|
||||
} else {
|
||||
$this->Flash->error(__('Konto ist nicht aktiviert!'));
|
||||
}
|
||||
//die(json_encode($json));
|
||||
return $this->redirect($this->loginServerUrl . 'account/', 303);
|
||||
}
|
||||
} else {
|
||||
// we haven't get a pubkey? something seems to gone wrong on the login-server
|
||||
$this->Flash->error(__('no pubkey'));
|
||||
//var_dump($json);
|
||||
return $this->redirect($this->loginServerUrl . 'account/error500/noPubkey', 303);
|
||||
}
|
||||
} else {
|
||||
if($json['state'] === 'not found' ) {
|
||||
$this->Flash->error(__('invalid session'));
|
||||
} else {
|
||||
$this->Flash->error(__('Konto ist nicht aktiviert!'));
|
||||
}
|
||||
//die(json_encode($json));
|
||||
return $this->redirect($this->loginServerUrl . 'account/', 303);
|
||||
}
|
||||
}
|
||||
} catch(\Exception $e) {
|
||||
$msg = $e->getMessage();
|
||||
$this->Flash->error(__('error http request: ') . $msg);
|
||||
return $this->redirect(['controller' => 'Dashboard', 'action' => 'errorHttpRequest']);
|
||||
} catch (\Exception $e) {
|
||||
$msg = $e->getMessage();
|
||||
$this->Flash->error(__('error http request: ') . $msg);
|
||||
return $this->redirect(['controller' => 'Dashboard', 'action' => 'errorHttpRequest']);
|
||||
//continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// no login
|
||||
//die("no login");
|
||||
if(isset($loginServer['path'])) {
|
||||
return $this->redirect($loginServer['path'], 303);
|
||||
} else {
|
||||
return $this->redirect($this->loginServerUrl . 'account/', 303);
|
||||
}
|
||||
if (isset($loginServer['path'])) {
|
||||
return $this->redirect($loginServer['path'], 303);
|
||||
} else {
|
||||
return $this->redirect($this->loginServerUrl . 'account/', 303);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -268,64 +291,67 @@ class AppController extends Controller
|
||||
/*
|
||||
public function beforeFilter(Event $event)
|
||||
{
|
||||
//$this->Auth->allow(['display']);
|
||||
//$this->Auth->allow(['display']);
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
||||
public function addAdminError($controller, $action, array $returnTable, $state_user_id) {
|
||||
if(!is_array($returnTable)) {
|
||||
$this->addAdminError('AppController', 'addAdminError', ['state' => 'error', 'msg' => 'returnTable isn\'t array', 'details' => gettype($returnTable)], $state_user_id);
|
||||
return false;
|
||||
}
|
||||
$adminErrorTable = TableRegistry::getTableLocator()->get('AdminErrors');
|
||||
$adminErrorEntity = $adminErrorTable->newEntity();
|
||||
$adminErrorEntity->state_user_id = $state_user_id;
|
||||
$adminErrorEntity->controller = $controller;
|
||||
$adminErrorEntity->action = $action;
|
||||
$adminErrorEntity->state = $returnTable['state'];
|
||||
if(isset($returnTable['msg'])) {
|
||||
$adminErrorEntity->msg = $returnTable['msg'];
|
||||
} else {
|
||||
$adminErrorEntity->msg = __('(Leere Message)');
|
||||
}
|
||||
if(isset($returnTable['details'])) {
|
||||
$adminErrorEntity->details = $returnTable['details'];
|
||||
} else {
|
||||
$adminErrorEntity->details = __('(Leere Details)');
|
||||
}
|
||||
if(!$adminErrorTable->save($adminErrorEntity)) {
|
||||
$this->Flash->error(
|
||||
public function addAdminError($controller, $action, array $returnTable, $state_user_id)
|
||||
{
|
||||
if (!is_array($returnTable)) {
|
||||
$this->addAdminError('AppController', 'addAdminError', ['state' => 'error', 'msg' => 'returnTable isn\'t array', 'details' => gettype($returnTable)], $state_user_id);
|
||||
return false;
|
||||
}
|
||||
$adminErrorTable = TableRegistry::getTableLocator()->get('AdminErrors');
|
||||
$adminErrorEntity = $adminErrorTable->newEntity();
|
||||
$adminErrorEntity->state_user_id = $state_user_id;
|
||||
$adminErrorEntity->controller = $controller;
|
||||
$adminErrorEntity->action = $action;
|
||||
$adminErrorEntity->state = $returnTable['state'];
|
||||
if (isset($returnTable['msg'])) {
|
||||
$adminErrorEntity->msg = $returnTable['msg'];
|
||||
} else {
|
||||
$adminErrorEntity->msg = __('(Leere Message)');
|
||||
}
|
||||
if (isset($returnTable['details'])) {
|
||||
$adminErrorEntity->details = $returnTable['details'];
|
||||
} else {
|
||||
$adminErrorEntity->details = __('(Leere Details)');
|
||||
}
|
||||
if (!$adminErrorTable->save($adminErrorEntity)) {
|
||||
$this->Flash->error(
|
||||
__('Serious error, couldn\'t save to db, please write the admin: ' . $this->getAdminEmailLink()),
|
||||
['escape' => false]);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getAdminEmailLink($text = '') {
|
||||
$serverAdminEmail = Configure::read('ServerAdminEmail');
|
||||
return '<a href="mailto:' . $serverAdminEmail . '">'. $serverAdminEmail . '</a>';
|
||||
['escape' => false]
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function returnJsonEncoded($json) {
|
||||
$this->autoRender = false;
|
||||
$response = $this->response->withType('application/json');
|
||||
return $response->withStringBody($json);
|
||||
public function getAdminEmailLink($text = '')
|
||||
{
|
||||
$serverAdminEmail = Configure::read('ServerAdminEmail');
|
||||
return '<a href="mailto:' . $serverAdminEmail . '">'. $serverAdminEmail . '</a>';
|
||||
}
|
||||
|
||||
public function returnJson($array) {
|
||||
$this->autoRender = false;
|
||||
$response = $this->response->withType('application/json');
|
||||
return $response->withStringBody(json_encode($array));
|
||||
public function returnJsonEncoded($json)
|
||||
{
|
||||
$this->autoRender = false;
|
||||
$response = $this->response->withType('application/json');
|
||||
return $response->withStringBody($json);
|
||||
}
|
||||
|
||||
public function returnJson($array)
|
||||
{
|
||||
$this->autoRender = false;
|
||||
$response = $this->response->withType('application/json');
|
||||
return $response->withStringBody(json_encode($array));
|
||||
}
|
||||
|
||||
public function getStartEndForMonth($month, $year)
|
||||
{
|
||||
$timeString = $year . '-' . $month . '-01 00:00';
|
||||
$firstDay = new Time($timeString);
|
||||
$lastDay = new Time($timeString);
|
||||
$lastDay = $lastDay->addMonth(1);
|
||||
return [$firstDay, $lastDay];
|
||||
$timeString = $year . '-' . $month . '-01 00:00';
|
||||
$firstDay = new Time($timeString);
|
||||
$lastDay = new Time($timeString);
|
||||
$lastDay = $lastDay->addMonth(1);
|
||||
return [$firstDay, $lastDay];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@ class StateUser extends Entity
|
||||
'email' => true,
|
||||
'first_name' => true,
|
||||
'last_name' => true,
|
||||
'user_name' => true,
|
||||
'index' => true,
|
||||
'state_group' => true,
|
||||
'state_balances' => true,
|
||||
@ -43,12 +44,14 @@ class StateUser extends Entity
|
||||
'transaction_creations' => true,
|
||||
'transaction_send_coins' => true
|
||||
];
|
||||
|
||||
public function getEmailWithName() {
|
||||
return $this->first_name . ' ' . $this->last_name . ' <' . $this->email . '>';
|
||||
|
||||
public function getEmailWithName()
|
||||
{
|
||||
return $this->first_name . ' ' . $this->last_name . ' <' . $this->email . '>';
|
||||
}
|
||||
|
||||
public function getNames() {
|
||||
return $this->first_name . ' ' . $this->last_name;
|
||||
|
||||
public function getNames()
|
||||
{
|
||||
return $this->first_name . ' ' . $this->last_name;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,140 +0,0 @@
|
||||
<?php
|
||||
use Cake\Routing\Router;
|
||||
/**
|
||||
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||
* @link https://cakephp.org CakePHP(tm) Project
|
||||
* @since 0.10.0
|
||||
* @license https://opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$cakeDescription = 'Gradido';
|
||||
$GLOBALS["self"] = $this;
|
||||
|
||||
//echo "balance: $balance<br>";
|
||||
//echo "transactions pending: " . $transactionPendings;
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<?= $this->Html->charset() ?>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>
|
||||
<?= $cakeDescription ?>:
|
||||
<?= $this->fetch('title') ?>
|
||||
</title>
|
||||
<?= $this->Html->meta('icon') ?>
|
||||
<?= $this->Html->css(['rippleUI/style.css', 'materialdesignicons.min.css']) ?>
|
||||
<?= $this->Html->script(['basic']) ?>
|
||||
<!--<?= $this->Html->css(['main.css']) ?>-->
|
||||
<?= $this->fetch('meta') ?>
|
||||
<?= $this->fetch('css') ?>
|
||||
<?= $this->fetch('script') ?>
|
||||
</head>
|
||||
<body class="header-fixed">
|
||||
<div class="versionstring dev-info">
|
||||
<p class="grd_small"><?= __("Community Server in Entwicklung") ?></p>
|
||||
<p class="grd_small">Alpha 0.20.KW13.03</p>
|
||||
</div>
|
||||
<nav class="t-header">
|
||||
<div class="t-header-brand-wrapper">
|
||||
<a href="/">
|
||||
<picture class="logo">
|
||||
<source srcset="/img/logo_schrift_half.webp" type="image/webp">
|
||||
<source srcset="/img/logo_schrift_half.png" type="image/png">
|
||||
<img src="/img/logo_schrift_half.png" class="logo" alt="Logo">
|
||||
</picture>
|
||||
<picture class="logo-mini">
|
||||
<source srcset="/img/logo_half.webp" type="image/webp">
|
||||
<source srcset="/img/logo_half.png" type="image/png">
|
||||
<img src="/img/logo_half.png" class="logo-mini" alt="Logo">
|
||||
</picture>
|
||||
</a>
|
||||
<button class="t-header-toggler t-header-desk-toggler d-none d-lg-block">
|
||||
<svg class="logo" viewBox="0 0 200 200">
|
||||
<path class="top" d="
|
||||
M 40, 80
|
||||
C 40, 80 120, 80 140, 80
|
||||
C180, 80 180, 20 90, 80
|
||||
C 60,100 30,120 30,120
|
||||
"></path>
|
||||
<path class="middle" d="
|
||||
M 40,100
|
||||
L140,100
|
||||
"></path>
|
||||
<path class="bottom" d="
|
||||
M 40,120
|
||||
C 40,120 120,120 140,120
|
||||
C180,120 180,180 90,120
|
||||
C 60,100 30, 80 30, 80
|
||||
"></path>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="t-header-content-wrapper">
|
||||
<div class="t-header-content">
|
||||
<button class="t-header-toggler t-header-mobile-toggler d-block d-lg-none">
|
||||
<i class="mdi mdi-menu"></i>
|
||||
</button>
|
||||
<div class="flash-messages" style="margin-left:20px; margin-top:30px;">
|
||||
<?= $this->Flash->render() ?>
|
||||
</div>
|
||||
<?= $this->element('navi_header'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="page-body">
|
||||
<!-- partial:partials/_sidebar.html -->
|
||||
<div class="sidebar">
|
||||
<?= $this->element('navi'); ?>
|
||||
</div>
|
||||
<div class="page-content-wrapper">
|
||||
<div class="page-content-wrapper-inner">
|
||||
<div class="viewport-header">
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb has-arrow">
|
||||
<li class="breadcrumb-item">
|
||||
<?= $this->Html->link(__('Startseite'), ['controller' => 'Dashboard']); ?>
|
||||
</li>
|
||||
<li class="breadcrumb-item active" aria-current="page"><?= $this->fetch('title') ?></li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="content-viewport">
|
||||
<?= $this->fetch('content') ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- content viewport ends -->
|
||||
<!-- partial:partials/_footer.html -->
|
||||
<footer class="footer">
|
||||
<div class="row">
|
||||
<div class="col-sm-6 text-center text-sm-right order-sm-1">
|
||||
<ul class="text-gray">
|
||||
<li><a href="https://gradido.net/de/datenschutz/" target="_blank"><?= __("Datenschutzerklärung") ?></a></li>
|
||||
<li><a href="https://gradido.net/de/impressum/" target="_blank"><?= __("Impressum") ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-sm-6 text-center text-sm-left mt-3 mt-sm-0">
|
||||
<small class="text-muted d-block">Copyright © 2019 Gradido</small>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
<!-- partial -->
|
||||
</div>
|
||||
<!-- page content ends -->
|
||||
</div>
|
||||
<?php if(isset($timeUsed)) : ?>
|
||||
<div class="grd-time-used dev-info">
|
||||
<?= round($timeUsed * 1000.0, 4) ?> ms
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</body>
|
||||
</html>
|
||||
@ -29,13 +29,17 @@ $this->assign(
|
||||
<span class="fact label">E-Mail Adresse:</span>
|
||||
<span class="fact"><?=$user['email']?></span>
|
||||
</li>
|
||||
<li class="fact">
|
||||
<span class="fact label">Benutzername:</span>
|
||||
<span class="fact"><?=$user['user_name']?></span><!-- xxx editable -->
|
||||
</li>
|
||||
<li class="fact">
|
||||
<span class="fact label">Vorname:</span>
|
||||
<span class="fact"><?=$user['first_name']?></span>
|
||||
<span class="fact"><?=$user['first_name']?></span><!-- xxx editable -->
|
||||
</li>
|
||||
<li class="fact">
|
||||
<span class="fact label">Nachname:</span>
|
||||
<span class="fact"><?=$user['last_name']?></span>
|
||||
<span class="fact"><?=$user['last_name']?></span><!-- xxx editable -->
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user