Пример #1
0
 /**
  * set database
  * @param string $database
  * @return SQL
  */
 public function setDB($database = 'PF')
 {
     $f3 = \Base::instance();
     // "Hive" Key for DB storage
     $dbHiveKey = $this->getDbHiveKey($database);
     if ($database === 'CCP') {
         // CCP DB
         $dns = Controller\Controller::getEnvironmentData('DB_CCP_DNS');
         $name = Controller\Controller::getEnvironmentData('DB_CCP_NAME');
         $user = Controller\Controller::getEnvironmentData('DB_CCP_USER');
         $password = Controller\Controller::getEnvironmentData('DB_CCP_PASS');
     } else {
         // Pathfinder(PF) DB
         $dns = Controller\Controller::getEnvironmentData('DB_DNS');
         $name = Controller\Controller::getEnvironmentData('DB_NAME');
         $user = Controller\Controller::getEnvironmentData('DB_USER');
         $password = Controller\Controller::getEnvironmentData('DB_PASS');
     }
     // check if DB connection already exists
     if (!$f3->exists($dbHiveKey) || $name !== $f3->get($dbHiveKey)->name()) {
         $db = $this->connect($dns, $name, $user, $password);
         // set DB timezone to UTC +00:00 (eve server time)
         $db->exec('SET @@session.time_zone = "+00:00";');
         // disable innoDB schema (relevant vor MySql 5.5)
         // not necessary for MySql > v.5.6
         // $db->exec('SET GLOBAL innodb_stats_on_metadata = OFF;');
         // store DB object
         $f3->set($dbHiveKey, $db);
         return $db;
     } else {
         return $f3->get($dbHiveKey);
     }
 }
Пример #2
0
 /**
  * set database
  * @param string $database
  */
 public function setDB($database = 'PF')
 {
     $f3 = \Base::instance();
     if ($database === 'CCP') {
         // CCP DB
         $dns = Controller\Controller::getEnvironmentData('DB_CCP_DNS');
         $name = Controller\Controller::getEnvironmentData('DB_CCP_NAME');
         $user = Controller\Controller::getEnvironmentData('DB_CCP_USER');
         $password = Controller\Controller::getEnvironmentData('DB_CCP_PASS');
     } else {
         // Pathfinder DB
         $dns = Controller\Controller::getEnvironmentData('DB_DNS');
         $name = Controller\Controller::getEnvironmentData('DB_NAME');
         $user = Controller\Controller::getEnvironmentData('DB_USER');
         $password = Controller\Controller::getEnvironmentData('DB_PASS');
     }
     // check for DB switch. If current DB equal new DB -> no switch needed
     if (!$f3->exists('DB') || $name !== $f3->get('DB')->name()) {
         $db = $this->connect($dns, $name, $user, $password);
         $f3->set('DB', $db);
         // set DB timezone to UTC +00:00 (eve server time)
         $f3->get('DB')->exec('SET @@session.time_zone = "+00:00";');
         // disable innoDB schema (relevant vor MySql 5.5)
         // not necessary for MySql > v.5.6
         //$f3->get('DB')->exec('SET GLOBAL innodb_stats_on_metadata = OFF;');
     }
 }
Пример #3
0
 public function callEndpoint($options, $params)
 {
     if (is_string($options)) {
         $actionArray = explode("::", $options);
         $controller = $actionArray[0];
         $action = $actionArray[1];
     } else {
         if (is_array($options)) {
             $controller = $options["controller"];
             $action = $options["action"];
         }
     }
     Controller::autoload($controller);
     $c = new $controller();
     $c->action = $action;
     $this->runFilters($c, $action, $params, $c->beforeFilters, $c->skipBeforeFilters);
     if (count($c->aroundFilters) == 0) {
         call_user_method_array($action, $c, $params);
     } else {
         $count = $this->runFilters($c, $action, $params, $c->aroundFilters, $c->skipAroundFilters);
         if (!$count) {
             call_user_method_array($action, $c, $params);
         }
     }
     $this->runFilters($c, $action, $params, $c->afterFilters, $c->skipAfterFilters);
 }
Пример #4
0
 /**
  * set database
  * @param string $database
  * @return SQL
  */
 public function setDB($database = 'PF')
 {
     $f3 = \Base::instance();
     // "Hive" Key for DB storage
     $dbHiveKey = $this->getDbHiveKey($database);
     // check if DB connection already exists
     if (!$f3->exists($dbHiveKey)) {
         if ($database === 'CCP') {
             // CCP DB
             $dns = Controller\Controller::getEnvironmentData('DB_CCP_DNS');
             $name = Controller\Controller::getEnvironmentData('DB_CCP_NAME');
             $user = Controller\Controller::getEnvironmentData('DB_CCP_USER');
             $password = Controller\Controller::getEnvironmentData('DB_CCP_PASS');
         } else {
             // Pathfinder(PF) DB
             $dns = Controller\Controller::getEnvironmentData('DB_DNS');
             $name = Controller\Controller::getEnvironmentData('DB_NAME');
             $user = Controller\Controller::getEnvironmentData('DB_USER');
             $password = Controller\Controller::getEnvironmentData('DB_PASS');
         }
         $db = $this->connect($dns, $name, $user, $password);
         if (!is_null($db)) {
             // set DB timezone to UTC +00:00 (eve server time)
             $db->exec('SET @@session.time_zone = "+00:00";');
             // set default storage engine
             $db->exec('SET @@session.default_storage_engine = "' . Controller\Controller::getRequiredMySqlVariables('DEFAULT_STORAGE_ENGINE') . '"');
             // store DB object
             $f3->set($dbHiveKey, $db);
         }
         return $db;
     } else {
         return $f3->get($dbHiveKey);
     }
 }
Пример #5
0
 /**
  * event handler after routing
  * @param \Base $f3
  */
 public function afterroute(\Base $f3)
 {
     parent::afterroute($f3);
     // clear all SSO related temp data
     if ($f3->exists(Ccp\Sso::SESSION_KEY_SSO)) {
         $f3->clear(Ccp\Sso::SESSION_KEY_SSO);
     }
 }
Пример #6
0
 /**
  * event handler
  * @param $f3
  */
 function beforeroute($f3)
 {
     $loginCheck = $this->_checkLogIn();
     if (!$loginCheck) {
         // no user found or LogIn timer expired
         $this->logOut($f3);
     }
     parent::beforeroute($f3);
 }
Пример #7
0
 /**
  * event handler
  * @param $f3
  */
 function beforeroute($f3)
 {
     parent::beforeroute($f3);
     // Any CMS route of a child class of this one, requires a
     // valid logged in user!
     $loginCheck = $this->_checkLogIn();
     if (!$loginCheck) {
         // no user found or LogIn timer expired
         $this->logOut($f3);
     }
 }
Пример #8
0
 /**
  * event handler
  * @param \Base $f3
  */
 function beforeroute(\Base $f3)
 {
     parent::beforeroute($f3);
     // Any route/endpoint of a child class of this one,
     // requires a valid logged in user!
     $loginCheck = $this->checkLogTimer($f3);
     if (!$loginCheck) {
         // no user found or login timer expired
         $this->logout($f3);
         if ($f3->get('AJAX')) {
             // unauthorized request
             $f3->status(403);
         } else {
             // redirect to landing page
             $f3->reroute('@login');
         }
         // die() triggers unload() function
         die;
     }
 }
Пример #9
0
 /**
  * get the current active character for this user
  * -> EITHER - the current active one for the current user
  * -> OR - get the first active one
  * @return null|CharacterModel
  */
 public function getActiveCharacter()
 {
     $activeCharacter = null;
     $controller = new Controller\Controller();
     $currentActiveCharacter = $controller->getCharacter();
     if (!is_null($currentActiveCharacter) && $currentActiveCharacter->getUser()->_id === $this->id) {
         $activeCharacter =& $currentActiveCharacter;
     } else {
         // set "first" found as active for this user
         if ($activeCharacters = $this->getActiveCharacters()) {
             $activeCharacter = $activeCharacters[0];
         }
     }
     return $activeCharacter;
 }
 public function __construct()
 {
     parent::__construct();
     $this->access_token = $this->app->get('access_token');
 }
Пример #11
0
 /** ROUTER
  * @param $request
  * @throws DatabaseException
  * @throws TableException
  */
 private static function router($request)
 {
     if (self::check_login() == 1) {
         if (isset($request["run"])) {
             $controller = new Controller();
             if ($request["run"] == "logout") {
                 $controller->logout(isset($request['arg']) ? $request['arg'] : NULL);
             } else {
                 if ($request["run"] == "showDB") {
                     $controller->showDB($request["value"]);
                 } else {
                     if ($request["run"] == "showTableStruct") {
                         $controller->showTableStruct($request["dbname"], $request['tName']);
                     } else {
                         if ($request["run"] == "indexAction") {
                             $controller->indexAction();
                         } else {
                             if ($request["run"] == "formNewDB") {
                                 $controller->formNewDB();
                             } else {
                                 if ($request["run"] == "make_query") {
                                     $controller->make_query($request['query']);
                                 } else {
                                     if ($request["run"] == "addDB") {
                                         $controller->addDB($request["nameDB"]);
                                     } else {
                                         if ($request["run"] == "renameDB") {
                                             $controller->renameDB($request["nameDB"], $request["newDBName"]);
                                         } else {
                                             if ($request["run"] == "deleteDB") {
                                                 $controller->drop_db($request["nameDB"]);
                                             } else {
                                                 if ($request["run"] == "delete_table") {
                                                     $controller->delete_table($request["name_db"], $request["name_table"]);
                                                 } else {
                                                     if ($request["run"] == "rename_table") {
                                                         $controller->rename_table($request["name_db"], $request["table_name"], $request["new_name_table"]);
                                                     } else {
                                                         if ($request["run"] == "delete_field") {
                                                             $controller->delete_field($request["name_db"], $request["table_name"], $request["name_field"]);
                                                         } else {
                                                             if ($request["run"] == "content_table") {
                                                                 $controller->showTableData($request["dbname"], $request["t_name"]);
                                                             } else {
                                                                 if ($request["run"] == "add_table") {
                                                                     $controller->add_table($request);
                                                                 } else {
                                                                     if ($request["run"] == "add_field") {
                                                                         $controller->add_field($request);
                                                                     } else {
                                                                         if ($request["run"] == "delete_data") {
                                                                             $controller->drop_data($request["name_db"], $request["table_name"], $request["id_col_name"], $request["id_field"]);
                                                                         } else {
                                                                             if ($request["run"] == "add_data") {
                                                                                 $controller->add_data($request["name_db"], $request["table_name"], $request["field_name"], $request["new_data"]);
                                                                             } else {
                                                                                 if ($request["run"] == "edit_field") {
                                                                                     $controller->edit_field($request);
                                                                                 } else {
                                                                                     if ($request["run"] == "edit_data") {
                                                                                         /// FUNCTION HAVE A LOT OF PARAMETERS
                                                                                         $controller->edit_data($request["name_db"], $request["table_name"], $request["id_col_name"], $request["col_name_edit"], $request["id_value"], $request["value"]);
                                                                                     } else {
                                                                                         echo $_SESSION['twig']->render("error.html.twig", array("error" => "Mauvais paramètres !"));
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             unset($controller);
         } else {
             echo $_SESSION['twig']->render("error.html.twig", array("error" => "Aucune action"));
         }
     } else {
         echo $_SESSION['twig']->render("login.html.twig", array("error" => "Vous n'êtes pas connecté!"));
     }
 }
Пример #12
0
 public function initialize()
 {
     parent::initialize();
 }
Пример #13
0
 public function __construct()
 {
     parent::__construct();
     $this->model = new Mapper($this->db, 'search_logs');
 }
Пример #14
0
 /**
  * check if new user registration is allowed
  * @return bool
  * @throws Exception\RegistrationException
  */
 public function beforeInsertEvent()
 {
     $registrationStatus = Controller\Controller::getRegistrationStatus();
     switch ($registrationStatus) {
         case 0:
             $f3 = self::getF3();
             throw new Exception\RegistrationException($f3->get('PATHFINDER.REGISTRATION.MSG_DISABLED'));
             return false;
             break;
         case 1:
             return true;
             break;
         default:
             return false;
     }
 }
Пример #15
0
 /**
  * get database connection information
  * @param $f3
  * @param bool|false $exec
  * @return array
  */
 protected function checkDatabase($f3, $exec = false)
 {
     foreach ($this->databases as $dbKey => $dbData) {
         $dbLabel = '';
         $dbName = '';
         $dbUser = '';
         $dbConfig = [];
         // DB connection status
         $dbConnected = false;
         // DB type (e.g. MySql,..)
         $dbDriver = 'unknown';
         // enable database ::setup() function in UI
         $dbSetupEnable = false;
         // check  of everything is OK (connection, tables, columns, indexes,..)
         $dbStatusCheckCount = 0;
         // db queries for column fixes (types, indexes, unique)
         $dbColumnQueries = [];
         // tables that should exist in this DB
         $requiredTables = [];
         // check DB for valid connection
         $db = DB\Database::instance()->getDB($dbKey);
         switch ($dbKey) {
             case 'PF':
                 $dbLabel = 'Pathfinder';
                 $dbName = Controller::getEnvironmentData('DB_NAME');
                 $dbUser = Controller::getEnvironmentData('DB_USER');
                 // enable (table) setup for this DB
                 $dbSetupEnable = true;
                 // get table data from model
                 foreach ($dbData['models'] as $model) {
                     $tableConfig = call_user_func($model . '::resolveConfiguration');
                     $requiredTables[$tableConfig['table']] = ['model' => $model, 'name' => $tableConfig['table'], 'fieldConf' => $tableConfig['fieldConf'], 'exists' => false, 'empty' => true, 'foreignKeys' => []];
                 }
                 break;
             case 'CCP':
                 $dbLabel = 'EVE-Online [SDE]';
                 $dbName = Controller::getEnvironmentData('DB_CCP_NAME');
                 $dbUser = Controller::getEnvironmentData('DB_CCP_USER');
                 // get table model from static table array
                 foreach ($dbData['tables'] as $tableName) {
                     $requiredTables[$tableName] = ['exists' => false, 'empty' => true];
                 }
                 break;
         }
         if ($db) {
             // db connect was successful
             $dbConnected = true;
             $dbDriver = $db->driver();
             $dbConfig = $this->checkDBConfig($f3, $db);
             // get tables
             $schema = new SQL\Schema($db);
             $currentTables = $schema->getTables();
             // check each table for changes
             foreach ($requiredTables as $requiredTableName => $data) {
                 $tableExists = false;
                 $tableEmpty = true;
                 // Check if table status is OK (no errors/warnings,..)
                 $tableStatusCheckCount = 0;
                 $currentColumns = [];
                 if (in_array($requiredTableName, $currentTables)) {
                     // Table exists
                     $tableExists = true;
                     // get existing table columns and column related constraints (if exists)
                     $tableModifierTemp = new MySQL\TableModifier($requiredTableName, $schema);
                     $currentColumns = $tableModifierTemp->getCols(true);
                     // get row count
                     $countRes = $db->exec("SELECT COUNT(*) `num` FROM " . $db->quotekey($requiredTableName));
                     $tableEmpty = $countRes[0]['num'] > 0 ? false : true;
                 } else {
                     // table missing
                     $dbStatusCheckCount++;
                     $tableStatusCheckCount++;
                 }
                 foreach ((array) $data['fieldConf'] as $columnName => $fieldConf) {
                     $columnStatusCheck = true;
                     $foreignKeyStatusCheck = true;
                     $requiredTables[$requiredTableName]['fieldConf'][$columnName]['requiredType'] = $fieldConf['type'];
                     $requiredTables[$requiredTableName]['fieldConf'][$columnName]['requiredIndex'] = $fieldConf['index'] ? '1' : '0';
                     $requiredTables[$requiredTableName]['fieldConf'][$columnName]['requiredUnique'] = $fieldConf['unique'] ? '1' : '0';
                     if (array_key_exists($columnName, $currentColumns)) {
                         // column exists
                         // get tableModifier -> possible column update
                         $tableModifier = new MySQL\TableModifier($requiredTableName, $schema);
                         // get new column and copy Schema from existing column
                         $col = new MySQL\Column($columnName, $tableModifier);
                         $col->copyfrom($currentColumns[$columnName]);
                         $currentColType = $currentColumns[$columnName]['type'];
                         $currentColIndexData = call_user_func($data['model'] . '::indexExists', [$columnName]);
                         $currentColIndex = is_array($currentColIndexData);
                         $hasIndex = $currentColIndex ? '1' : '0';
                         $hasUnique = $currentColIndexData['unique'] ? '1' : '0';
                         $changedType = false;
                         $changedUnique = false;
                         $changedIndex = false;
                         // set (new) column information -------------------------------------------------------
                         $requiredTables[$requiredTableName]['fieldConf'][$columnName]['exists'] = true;
                         $requiredTables[$requiredTableName]['fieldConf'][$columnName]['currentType'] = $currentColType;
                         $requiredTables[$requiredTableName]['fieldConf'][$columnName]['currentIndex'] = $hasIndex;
                         $requiredTables[$requiredTableName]['fieldConf'][$columnName]['currentUnique'] = $hasUnique;
                         // check constraint -------------------------------------------------------------------
                         if (isset($fieldConf['constraint'])) {
                             // add or update constraints
                             foreach ((array) $fieldConf['constraint'] as $constraintData) {
                                 $constraint = $col->newConstraint($constraintData);
                                 $foreignKeyExists = $col->constraintExists($constraint);
                                 $requiredTables[$requiredTableName]['foreignKeys'][] = ['exists' => $foreignKeyExists, 'keyName' => $constraint->getConstraintName()];
                                 $col->addConstraint($constraint);
                                 if (!$foreignKeyExists) {
                                     $tableStatusCheckCount++;
                                     $foreignKeyStatusCheck = false;
                                 }
                             }
                         }
                         // check type changed -----------------------------------------------------------------
                         if ($fieldConf['type'] !== 'JSON' && !$schema->isCompatible($fieldConf['type'], $currentColType)) {
                             // column type has changed
                             $changedType = true;
                             $columnStatusCheck = false;
                             $tableStatusCheckCount++;
                         }
                         // check if column unique changed -----------------------------------------------------
                         $indexUpdate = false;
                         $indexKey = (bool) $hasIndex;
                         $indexUnique = (bool) $hasUnique;
                         if ($currentColIndexData['unique'] != $fieldConf['unique']) {
                             $changedUnique = true;
                             $columnStatusCheck = false;
                             $tableStatusCheckCount++;
                             $indexUpdate = true;
                             $indexUnique = (bool) $fieldConf['unique'];
                         }
                         // check if column index changed ------------------------------------------------------
                         if ($currentColIndex != $fieldConf['index']) {
                             $changedIndex = true;
                             $columnStatusCheck = false;
                             $tableStatusCheckCount++;
                             $indexUpdate = true;
                             $indexKey = (bool) $fieldConf['index'];
                         }
                         // build table with changed columns ---------------------------------------------------
                         if (!$columnStatusCheck || !$foreignKeyStatusCheck) {
                             if (!$columnStatusCheck) {
                                 // IMPORTANT: setType is always required! Even if type has not changed
                                 $col->type($fieldConf['type']);
                                 // update/change/delete index/unique keys
                                 if ($indexUpdate) {
                                     if ($hasIndex) {
                                         $tableModifier->dropIndex($columnName);
                                     }
                                     if ($indexKey) {
                                         $tableModifier->addIndex($columnName, $indexUnique);
                                     }
                                 }
                                 $tableModifier->updateColumn($columnName, $col);
                             }
                             $buildStatus = $tableModifier->build($exec);
                             if (is_array($buildStatus) || is_string($buildStatus)) {
                                 // query strings for change available
                                 $dbColumnQueries = array_merge($dbColumnQueries, (array) $buildStatus);
                             }
                         }
                         // set (new) column information -------------------------------------------------------
                         $requiredTables[$requiredTableName]['fieldConf'][$columnName]['changedType'] = $changedType;
                         $requiredTables[$requiredTableName]['fieldConf'][$columnName]['changedUnique'] = $changedUnique;
                         $requiredTables[$requiredTableName]['fieldConf'][$columnName]['changedIndex'] = $changedIndex;
                     } elseif (!isset($fieldConf['has-manny']) && isset($fieldConf['type'])) {
                         // column not exists but it is required!
                         // columns that do not match this criteria ("mas-manny") are "virtual" fields
                         // and can be ignored
                         $requiredTables[$requiredTableName]['fieldConf'][$columnName]['currentType'] = '';
                         $columnStatusCheck = false;
                         $tableStatusCheckCount++;
                     }
                     $requiredTables[$requiredTableName]['fieldConf'][$columnName]['statusCheck'] = $columnStatusCheck;
                 }
                 $dbStatusCheckCount += $tableStatusCheckCount;
                 $requiredTables[$requiredTableName]['empty'] = $tableEmpty;
                 $requiredTables[$requiredTableName]['exists'] = $tableExists;
                 $requiredTables[$requiredTableName]['statusCheckCount'] = $tableStatusCheckCount;
             }
         } else {
             // DB connection failed
             $dbStatusCheckCount++;
         }
         if ($exec) {
             $f3->reroute('@setup');
         }
         $this->databases[$dbKey]['info'] = ['db' => $db, 'label' => $dbLabel, 'driver' => $dbDriver, 'name' => $dbName, 'user' => $dbUser, 'dbConfig' => $dbConfig, 'setupEnable' => $dbSetupEnable, 'connected' => $dbConnected, 'statusCheckCount' => $dbStatusCheckCount, 'columnQueries' => $dbColumnQueries, 'tableData' => $requiredTables];
     }
     return $this->databases;
 }
Пример #16
0
<?php

require_once 'vendor/autoload.php';
use Controller\Controller;
$controller = new Controller();
$controller->invoke();
Пример #17
0
 /**
  * log the current user out + clear character system log data
  * @param \Base $f3
  */
 public function logout(\Base $f3)
 {
     $this->deleteLog($f3);
     parent::logout($f3);
     $return = (object) [];
     $return->reroute = rtrim(self::getEnvironmentData('URL'), '/') . $f3->alias('login');
     echo json_encode($return);
 }
 public function __construct()
 {
     parent::__construct();
     $this->auth = new Auth(new Mapper($this->db, 'users'), ['id' => 'username', 'pw' => 'password']);
 }
Пример #19
0
 /**
  * update session data for active character
  * @param int $systemId
  */
 protected function updateCharacterSessionLocation($systemId)
 {
     $controller = new Controller();
     $f3 = $this->getF3();
     $systemId = (int) $systemId;
     if (($activeCharacter = $controller->getCharacter()) && $activeCharacter->_id === $this->characterId->_id) {
         $prevSystemId = (int) $f3->get(User::SESSION_KEY_CHARACTER_PREV_SYSTEM_ID);
         if ($prevSystemId === 0) {
             $f3->set(User::SESSION_KEY_CHARACTER_PREV_SYSTEM_ID, $systemId);
         } else {
             $f3->set(User::SESSION_KEY_CHARACTER_PREV_SYSTEM_ID, (int) $this->systemId);
         }
     }
 }
Пример #20
0
<?php

$f3 = (require 'app/lib/base.php');
// load main config
$f3->config('app/config.ini');
// load route config
$f3->config('app/routes.ini');
// load pathfinder config
$f3->config('app/pathfinder.ini');
// load cron config
$f3->config('app/cron.ini');
// set base dir
$f3->set('BASE', \Controller\Controller::getEnvironmentData('BASE'));
// set debug  level (stacktrace)
$f3->set('DEBUG', \Controller\Controller::getEnvironmentData('DEBUG'));
// set debug  level (stacktrace)
$f3->set('URL', \Controller\Controller::getEnvironmentData('URL'));
// initiate cron-jobs
Cron::instance();
$f3->run();
Пример #21
0
<?php

error_reporting(E_ALL);
ini_set("display_errors", 1);
require_once 'vendor/autoload.php';
define('root', dirname(__FILE__));
use Controller\Controller;
use Domain\Common\Communication\Request;
use Domain\Context\Report\Aggregate\ReportAggregate;
use Domain\Context\Task\Aggregate\TaskAggregate;
use Domain\Context\Task\Entity\EntityFactory as TaskEntityFactory;
use Domain\Context\Report\Entity\EntityFactory as ReportEntityFactory;
/**
 * Controller setup
 */
$controller = new Controller();
$controller->set404(function () {
    return require_once root . '/public/404.html';
});
$controller->add('/', function () {
    return require_once root . '/public/index.html';
});
$controller->add('/task/create', function () {
    $factory = new TaskEntityFactory();
    $taskAggregate = new TaskAggregate();
    $taskAggregate->setFactory($factory);
    $request = new Request();
    $response = $taskAggregate->saveTask($request);
    echo $response->getJSON();
});
$controller->add('/task/delete', function () {
Пример #22
0
 /**
  * get "Authorization:" Header data
  * -> This header is required for any Auth-required endpoints!
  * @return string
  */
 private function getAuthorizationHeader()
 {
     return base64_encode(Controller::getEnvironmentData('SSO_CCP_CLIENT_ID') . ':' . Controller::getEnvironmentData('SSO_CCP_SECRET_KEY'));
 }
Пример #23
0
 /**
  * log the current user out + clear character system log data
  * @param $f3
  */
 public function logOut($f3)
 {
     $this->deleteLog($f3);
     return parent::logOut($f3);
 }
Пример #24
0
 public function __construct()
 {
     parent::__construct();
 }
Пример #25
0
<?php

require_once __DIR__ . "/core/init.php";
use plugin\Plugin;
use controller\Controller;
$scriptDir = dirname($_SERVER["SCRIPT_FILENAME"]);
Controller::addControllersDir($scriptDir . "/app/controllers");
Plugin::activate("doctrine1");
$router = new \router\Router();
require_once $scriptDir . "/config/routes.php";
$router->dispatch($_SERVER["REQUEST_URI"]);
Пример #26
0
 /**
  * load view from parent construct
  */
 public function __construct()
 {
     parent::__construct();
     $this->model = new IndexModel();
 }
Пример #27
0
        break;
}
/**
 * Set Path
 */
$path = isset($_GET['path']) ? rtrim($_GET['path'], '/') : 'index';
$index = explode('/', $path);
try {
    /**
     * Get Config
     */
    require_once APP_DIR . '/config.php';
    /**
     * Instantiate Controller & theme
     */
    $controller = new Controller($path, $index);
    $theme = new Theme($path, $index);
    /**
     * Include functions & classes
     */
    require_once APP_DIR . '/core/includes.php';
    if (ENVIRONMENT === 'development') {
        $theme->setDebug(true);
    }
    /**
     * Get template file
     */
    $template = $theme->load($path);
    /**
     * Load Controller file
     */
Пример #28
0
 /** edit a field
  * @param $request
  * @return PDOStatement|string
  */
 public function edit_field($request)
 {
     $controller = new Controller();
     try {
         $str = "ALTER TABLE " . $request['name_db'] . "." . $request['table_name'] . " CHANGE ";
         $str = $str . $request['odl_field_name'] . " " . $request['new_field_name'] . " " . $request['new_type_field'] . "(" . $request['new_size_field'] . ")";
         $str = $request['new_isNull_field'] == "NO" ? $str . " NOT NULL" : $str . " NULL";
         if ($request['new_default_field'] == "NULL") {
             $str = $str . " DEFAULT NULL";
         } else {
             if ($request['new_default_field'] == "CURRENT_TIMESTAMP") {
                 $str = $str . " DEFAULT CURRENT_TIMESTAMP";
             } else {
                 if ($request['new_default_field'] == "Aucune") {
                     $str = $str . "";
                 } else {
                     $str . " DEFAULT '" . $request['new_default_field'] . "'";
                 }
             }
         }
         $controller->write_log_sql($str);
         $result = Connector::prepare($str, NULL);
         return $result;
     } catch (PDOException $e) {
         return $e->getMessage();
     }
     unset($controller);
 }