Exemplo n.º 1
0
 public function __construct(array $properties = null, $loadMappings = DatabaseRecord::MAPPINGS_NO_LAZY)
 {
     parent::__construct($properties, $loadMappings);
     if (is_array($this->Roles)) {
         foreach ($this->Roles as $role) {
             $this->roleTypes[] = $role->Type;
         }
     }
 }
Exemplo n.º 2
0
<?php

define("PHP_EXT", '.php');
define('PROJ_PATH', '/home/artem/server/nginx/www/book/');
define('VIEWS_PATH', PROJ_PATH . 'app/views/');
define('CORE_PATH', PROJ_PATH . 'app/core/');
require_once PROJ_PATH . 'app/config.php';
require_once CORE_PATH . 'exceptions.php';
require_once CORE_PATH . 'base/Model.php';
require_once CORE_PATH . 'base/View.php';
require_once CORE_PATH . 'base/Controller.php';
require_once CORE_PATH . 'base/Router.php';
require_once CORE_PATH . 'db/DatabaseRecord.php';
try {
    $db = new PDO("mysql:" . "dbname=" . $config['db']['name'] . ";host=" . $config['db']['host'], $config['db']['user'], $config['db']['pass']);
    $db->exec("SET NAMES SET" . $config['character']);
    DatabaseRecord::setDatabase($db);
} catch (PDOException $e) {
    echo "PDO error: " . $e->getMessage() . "\n";
}
$router = new Router();
try {
    $router->startRouting();
} catch (NotFoundException $e) {
    Controller::redirectTo404($_SERVER['REQUEST_URI']);
}
Exemplo n.º 3
0
/**
 * Charge dans $_SESSION les valeurs des champs du recordset
 * /!\ Cette fonction ne doit plus être utilisée /!\
 * @deprecated since version 3.0
 * @param string $paramTableName nom de la table dont il faut charger le recordset
 */
function mysql_table_load($paramTableName)
{
    $KeyValue = $_SESSION[DatabaseDescription::getTableKeyName($paramTableName)];
    if ($KeyValue) {
        $recordset = new DatabaseRecord($paramTableName, $KeyValue);
        $fields = $recordset->getFieldsArray();
        foreach ($fields as $key => $value) {
            /**
             * Exportation de la valeur de la variable dans
             * Une variable globale accessible hors de la fonction
             * Formatage des données pour préparation à intégration dans MySQL
             * 
             * TRES TRES SALE !!
             */
            $GLOBALS[$key] = $value;
        }
    }
    return $recordset;
}
Exemplo n.º 4
0
 public static function setDatabase(PDO $db, $charset = self::DEFAULT_CHARSET)
 {
     try {
         self::$db = $db;
     } catch (PDOException $e) {
         echo "Error connect to DB: " . $e->getMessage() . "\n";
     }
     self::setNames($charset);
     self::checkDatabase();
     self::$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
 }
Exemplo n.º 5
0
 public function __construct()
 {
     parent::__construct('ResourceObjectMetaData', DatabaseRecord::INVALID_RECORD_ID);
 }
Exemplo n.º 6
0
<?php

define("PHP_EXT", '.php');
define('APP_PATH', __DIR__ . '/');
define('VIEWS_PATH', APP_PATH . 'views/');
define('CORE_PATH', APP_PATH . 'core/');
define('TOOLS_PATH', CORE_PATH . 'tools/');
require_once APP_PATH . 'config.php';
require_once CORE_PATH . 'exceptions.php';
require_once CORE_PATH . 'systemFunctions.php';
require_once CORE_PATH . 'base/Model.php';
require_once CORE_PATH . 'base/View.php';
require_once CORE_PATH . 'base/Controller.php';
require_once CORE_PATH . 'base/App.php';
require_once CORE_PATH . 'db/DatabaseRecord.php';
try {
    $db = new PDO("mysql:" . "dbname=" . $config['db']['name'] . ';' . "host=" . $config['db']['host'], $config['db']['user'], $config['db']['pass']);
    DatabaseRecord::setDatabase($db, $config['character']);
} catch (PDOException $e) {
    echo "PDO error: " . $e->getMessage() . "\n";
}
$app = new App($config);
try {
    $app->run();
} catch (NotFoundException $e) {
    Controller::redirectTo404(explode('?', $_SERVER['REQUEST_URI'])[0]);
}
Exemplo n.º 7
0
 public function __construct()
 {
     parent::__construct('TextObject', DatabaseRecord::INVALID_RECORD_ID);
 }
Exemplo n.º 8
0
 /**
  * Creates combined record object by relevant database live-record and version-record rows.
  *
  * @param string $table Name of the database table
  * @param array $liveRow The relevant datbase live-record row
  * @param array $versionRow The relevant database version-record row
  * @return \TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord
  */
 public static function createFromArrays($table, array $liveRow, array $versionRow)
 {
     $liveRecord = DatabaseRecord::createFromArray($table, $liveRow);
     $versionRecord = DatabaseRecord::createFromArray($table, $versionRow);
     return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord::class, $table, $liveRecord, $versionRecord);
 }
Exemplo n.º 9
0
 public static function setDatabase(PDO $db)
 {
     try {
         self::$db = $db;
     } catch (PDOException $e) {
         echo "Error connect to DB: " . $e->getMessage() . "\n";
     }
     self::setEncording();
 }
Exemplo n.º 10
0
 public function __construct()
 {
     parent::__construct('ClientApplication', DatabaseRecord::INVALID_RECORD_ID);
 }
Exemplo n.º 11
0
 public function __construct()
 {
     parent::__construct();
 }
Exemplo n.º 12
0
 public function __construct()
 {
     parent::__construct('AccessRights', DatabaseRecord::INVALID_RECORD_ID);
 }