New "Invite" feature implemented

This commit is contained in:
Exodus4D
2015-08-30 23:25:02 +02:00
parent 67bab61fd3
commit 9c6ed24704
25 changed files with 577 additions and 134 deletions

View File

@@ -256,4 +256,39 @@ class Controller {
return $data;
}
/**
* function is called on each error
* @param $f3
*/
public function showError($f3){
// set HTTP status
if(!empty($f3->get('ERROR.code'))){
$f3->status($f3->get('ERROR.code'));
}
if($f3->get('AJAX')){
header('Content-type: application/json');
// error on ajax call
$errorData = [
'status' => $f3->get('ERROR.status'),
'code' => $f3->get('ERROR.code'),
'text' => $f3->get('ERROR.text')
];
// append stack trace for greater debug level
if( $f3->get('DEBUG') === 3){
$errorData['trace'] = $f3->get('ERROR.trace');
}
echo json_encode($errorData);
}else{
echo $f3->get('ERROR.text');
}
die();
}
}