Beispiel #1
0
 public function __construct(\Fp\Core\Init $O)
 {
     if ($O->glob('crypt_function')) {
         $this->crypt_function = $O->glob('crypt_function');
     }
     /*
     @TODO delete after Table test validation 
     $tableLoginPassword 	 = $this->table;
     $columnLoginPassword  = array('uid','password','password_tmp');
     $this->tableLoginPassword  = Table::set(Db::get_link(), $tableLoginPassword, $columnLoginPassword);
     $this->tableLoginPassword->setPrimary('uid');
     $this->tableLoginPassword->setUnique(array());
     $this->tableLoginPassword->setSortable(array('uid','password','password_tmp'));
     $this->tableLoginPassword->setSearchable(array (
       'uid' => 'bigint',
       'password' => 'varchar',
       'password_tmp' => 'varchar',
     ));
     $this->tableLoginPassword->setAutoIncrement();	
     */
     $dbLink = Db::get_link();
     $this->table = $O->glob('prefix') . $this->table;
     $shemaPassword = array('table' => $this->table, 'column' => array('uid' => array('type' => 'bigint', 'primary' => 1, 'sortable' => 1, 'searchable' => 1), 'password' => array('type' => 'varchar', 'sortable' => 1, 'searchable' => 1), 'password_tmp' => array('type' => 'varchar', 'sortable' => 1, 'searchable' => 1)));
     $this->tablePassword = Table::setTable($dbLink, $shemaPassword);
     $this->dbLoginPassword = new Query($this->tablePassword, 'LoginPassword');
 }
Beispiel #2
0
 public static function set(\Fp\Core\Init $O)
 {
     self::$O = $O;
     self::$TABLE = $O->glob('prefix') . 'debug';
     self::$DEBUG = $O->glob('debug');
     self::$start_time = microtime(true);
     self::switch_on();
 }
Beispiel #3
0
 /**
  * @param string $prefix
  * @return Auth
  */
 public function __construct(\Fp\Core\Init $O)
 {
     $this->O = $O;
     $this->data = array();
     $this->table = $O->glob('prefix') . $this->table;
     $this->session_key = md5($this->salt_session_key);
     $this->session = $O->session();
     $dbLink = Db::get_link();
     $tableLogin = $O->glob('prefix') . $this->table;
     $shemaLogin = array('table' => $tableLogin, 'options' => array('auto_increment' => 1), 'column' => array('uid' => array('type' => 'bigint', 'primary' => 1, 'sortable' => 1, 'searchable' => 1), 'time' => array('type' => 'datetime', 'sortable' => 1, 'searchable' => 1), 'status' => array('type' => 'int', 'sortable' => 1, 'searchable' => 1)));
     $this->tableLogin = Table::setTable($dbLink, $shemaLogin);
     $this->dbLogin = new Query($this->tableLogin, 'Login');
 }
Beispiel #4
0
 /**
  * @return Cache 
  */
 public static function load(\Fp\Core\Init $O, $cacheType = null)
 {
     if (self::$instance === null) {
         $c = __CLASS__;
         self::$instance = new $c();
         self::$cacheType = $cacheType;
         if (self::$cacheType == 'memcache') {
             self::$memcache = new Memcache();
             if (!self::$memcache->connect('127.0.0.1', 11211)) {
                 throw new Exception(__METHOD__ . ' memcache fails', 500);
             }
             self::$memcache->setCompressThreshold(20000, 0.2);
         } else {
             self::$cacheDir = $O->glob('dir_cache') . 'pool/';
         }
     }
     self::$nocache = $O->glob('cache');
     return self::$instance;
 }
Beispiel #5
0
 public function __construct(\Fp\Core\Init $O)
 {
     $tableLoginFacebook = $O->glob('prefix') . $this->table;
     $columnLoginFacebook = array('uid', 'fb_uid', 'app_id');
     $this->tableLoginFacebook = Table::set(Db::get_link(), $tableLoginFacebook, $columnLoginFacebook);
     $this->tableLoginFacebook->setPrimary('uid');
     $this->tableLoginFacebook->setUnique(array('fb_uid', 'uid'));
     $this->tableLoginFacebook->setSortable(array('uid', 'fb_uid'));
     $this->tableLoginFacebook->setSearchable(array('uid' => 'bigint'));
     $this->tableLoginFacebook->setAutoIncrement();
     $this->dbLoginFacebook = new Table_query($this->tableLoginFacebook, 'LoginFacebook');
 }
Beispiel #6
0
 public function __construct(\Fp\Core\Init $O)
 {
     $tableLoginMail = $O->glob('prefix') . $this->table;
     $columnLoginMail = array('uid', 'mail', 'tmp_mail', 'status');
     $this->tableLoginMail = Table::set(Db::get_link(), $tableLoginMail, $columnLoginMail);
     $this->tableLoginMail->setPrimary('uid');
     $this->tableLoginMail->setUnique(array('mail'));
     $this->tableLoginMail->setSortable(array('uid', 'mail', 'tmp_mail', 'status'));
     $this->tableLoginMail->setSearchable(array('uid' => 'bigint', 'tmp_mail' => 'varchar', 'status' => 'int'));
     $this->tableLoginMail->setAutoIncrement();
     $this->dbLoginMail = new Table_query($this->tableLoginMail, 'LoginMail');
 }
Beispiel #7
0
 public function __construct(\Fp\Core\Init $O)
 {
     $this->table = $O->glob('prefix') . $this->table;
     /*
             session_set_save_handler(
                 array($this, "open"),
                 array($this, "close"),
                 array($this, "read"),
                 array($this, "write"),
                 array($this, "destroy"),
                 array($this, "gc")
             );*/
 }
Beispiel #8
0
 public function __construct(\Fp\Core\Init $O)
 {
     $this->cache_dir = $O->glob('dir_cache') . 'cdn/';
     $this->O = $O;
     $this->noCache = $O->glob('cache');
 }
Beispiel #9
0
 public function __construct(\Fp\Core\Init $O)
 {
     $this->O = $O;
     $this->namespace = $this->type_node = get_called_class();
     $dbLink = $O->db();
     /* Db 2 */
     $tabledbNode = $this->O->glob('prefix') . 'node';
     $columndbNode = array('id_node', 'type_node', 'uid', 'gid', 'zid', 'etat', 'rank', 'data', 'date_creation', 'date_modification', 'date_publication');
     $this->tableNode = Table::set($dbLink, $tabledbNode, $columndbNode);
     $this->tableNode->setPrimary('id_node');
     $this->tableNode->setUnique(array());
     $this->tableNode->setSortable(array('id_node', 'uid', 'gid', 'zid', 'etat', 'rank', 'type_node', 'date_creation', 'date_modification', 'date_publication'));
     $this->tableNode->setSearchable(array('id_node' => 'bigint', 'uid' => 'bigint', 'gid' => 'bigint', 'type_node' => 'varchar', 'date_creation' => 'timestamp', 'date_modification' => 'timestamp', 'date_publication' => 'timestamp'));
     $this->tableNode->setAutoIncrement(true);
     $this->dbNode = new Table_query($this->tableNode, 'n');
     //relation 1:n
     $tableRelation = $this->O->glob('prefix') . 'node_relation';
     $columnRelation = array('id_node_parent', 'id_node_enfant', 'position');
     $this->tableRelation = Table::set($dbLink, $tableRelation, $columnRelation);
     $this->tableRelation->setPrimary('id_node_parent');
     $this->tableRelation->setUnique(array());
     $this->tableRelation->setSortable(array('id_node_parent', 'position', 'id_node_enfant'));
     $this->tableRelation->setSearchable(array('id_node_parent' => 'bigint', 'position' => 'int', 'id_node_enfant' => 'bigint'));
     $this->tableRelation->setAutoIncrement();
     $this->dbNodeRelation = new Table_query($this->tableRelation, 'r');
     $this->dbNodeRelation->innerJoin($this->tableNode, 'n', ' n.id_node=r.id_node_parent ');
     $this->dbNodeRelation->selectColumn("n.*");
     //link 1:1
     $tableLink = $this->O->glob('prefix') . 'node_link';
     $columnLink = array('id_node_1', 'id_node_2', 'position');
     $this->tableLink = Table::set($dbLink, $tableLink, $columnLink);
     $this->tableLink->setPrimary('id_node_1');
     $this->tableLink->setUnique(array());
     $this->tableLink->setSortable(array('id_node_1', 'id_node_2', 'position'));
     $this->tableLink->setSearchable(array('id_node_1' => 'bigint', 'id_node_2' => 'bigint', 'position' => 'int'));
     $this->tableLink->setAutoIncrement();
     $this->dbNodeLink = new Table_query($this->tableLink, 'l');
     $this->dbNodeLink->selectColumn("l.*");
     //table media
     $tableMedia = $this->O->glob('prefix') . 'media_files';
     $columnMedia = array('id_media', 'file_protocol', 'file_name', 'file_type', 'file_subtype', 'file_size', 'file_md5', 'file_date', 'ip', 'uid');
     $this->tableMedia = Table::set($dbLink, $tableMedia, $columnMedia);
     $this->tableMedia->setPrimary('id_media');
     $this->tableMedia->setUnique(array());
     $this->tableMedia->setSortable(array('id_media', 'file_name', 'type', 'subtype', 'date', 'uid', 'size'));
     $this->tableMedia->setSearchable(array('id_media' => 'bigint', 'file_name' => 'varchar', 'type' => 'varchar', 'subtype' => 'varchar', 'date' => 'date', 'uid' => 'bigint', 'size' => 'bigint'));
     $this->tableMedia->setAutoIncrement(true);
     $this->dbMedia = new Table_query($this->tableMedia, 'media');
     $tableMedia = $this->O->glob('prefix') . 'node_media';
     $columnMedia = array('id', 'id_node', 'id_media', 'position');
     $this->tableNodeMedia = Table::set($dbLink, $tableMedia, $columnMedia);
     $this->tableNodeMedia->setPrimary('id');
     $this->tableNodeMedia->setUnique(array('id_node', 'id_media'));
     $this->tableNodeMedia->setSortable(array('id_node', 'position', 'id_media'));
     $this->tableNodeMedia->setSearchable(array('id_node' => 'bigint', 'position' => 'int', 'id_media' => 'bigint'));
     $this->tableNodeMedia->setAutoIncrement();
     $this->dbNodeMedia = new Table_query($this->tableNodeMedia, 'nm');
     $this->dbNodeMedia->innerJoin($this->tableMedia, 'media', ' media.id_media=nm.id_media ');
     // node Tags
     $tableNodeTags = $this->O->glob('prefix') . 'node_tags';
     $columnNodeTags = array('id_node', 'tag', 'priority');
     $this->tableNodeTags = Table::set($dbLink, $tableNodeTags, $columnNodeTags);
     $this->tableNodeTags->setPrimary('tags');
     $this->tableNodeTags->setUnique(array());
     $this->tableNodeTags->setSortable(array('id_node', 'tag'));
     $this->tableNodeTags->setSearchable(array('tag' => 'varchar', 'id_node' => 'bigint', 'priority' => 'int'));
     $this->tableNodeTags->setAutoIncrement();
     $this->dbNodeTags = new Table_query($this->tableNodeTags, 'tags');
     // node revisions
     $table = 'node_revisions';
     $column = array('id_version', 'id_node', 'uid', 'label', 'comment', 'md5', 'date_revision', 'data');
     $this->tableNodeRevisions = Table::set($dbLink, $table, $column);
     $this->tableNodeRevisions->setPrimary('id_version');
     $this->tableNodeRevisions->setUnique(array());
     $this->tableNodeRevisions->setSortable(array('id_version', 'id_node', 'uid', 'label', 'date_revision'));
     $this->tableNodeRevisions->setSearchable(array('id_version' => 'bigint', 'id_node' => 'bigint', 'uid' => 'bigint', 'label' => 'varchar', 'date_revision' => 'timestamp'));
     $this->tableNodeRevisions->setAutoIncrement(true);
     $this->dbNodeRevisions = new Table_query($this->tableNodeRevisions, 'revisions');
     $shemaNodeDataBlob = array('table' => 'node_data_blob', 'column' => array('id_node_data_blob' => array('type' => 'bigint', 'primary' => 1, 'sortable' => 1, 'searchable' => 1), 'id_node' => array('type' => 'bigint', 'sortable' => 1, 'searchable' => 1), 'key_name' => array('type' => 'varchar', 'sortable' => 1, 'searchable' => 1), 'data' => array('type' => 'longblob')));
     $this->tableNodeDataBlob = Table::setTable($dbLink, $shemaNodeDataBlob);
     $this->tableNodeDataBlob->setPrimary('id_node_data_blob');
     $this->tableNodeDataBlob->setAutoIncrement(true);
     $this->dbNodeDataBlob = new Table_query($this->tableNodeDataBlob);
     $shemaNodeDataChar = array('table' => 'node_data_char', 'column' => array('id_node_data_char' => array('type' => 'bigint', 'primary' => 1, 'sortable' => 1, 'searchable' => 1), 'id_node' => array('type' => 'bigint', 'sortable' => 1, 'searchable' => 1), 'key_name' => array('type' => 'varchar', 'sortable' => 1, 'searchable' => 1), 'data' => array('type' => 'varchar', 'sortable' => 1, 'searchable' => 1)));
     $this->tableNodeDataChar = Table::setTable($dbLink, $shemaNodeDataChar);
     $this->tableNodeDataChar->setPrimary('id_node_data_char');
     $this->tableNodeDataChar->setAutoIncrement(true);
     $this->dbNodeDataChar = new Table_query($this->tableNodeDataChar);
     $this->config();
 }
Beispiel #10
0
 public function __construct(\Fp\Core\Init $O)
 {
     $this->table = $O->glob('prefix') . $this->table;
     return $this;
 }
Beispiel #11
0
 public function __construct(\Fp\Core\Init $O)
 {
     $this->O = $O;
     $this->prefix = $O->glob('prefix');
     $dbLink = Db::get_link();
     /*
      * Groupe
      */
     $shema = array('table' => $this->prefix . $this->table_Group, 'options' => array('auto_increment' => 1), 'column' => array('gid' => array('type' => 'bigint', 'primary' => 1, 'sortable' => 1, 'searchable' => 1), 'name' => array('type' => 'varchar', 'unique' => 1, 'sortable' => 1, 'searchable' => 1), 'timestamp' => array('type' => 'timestamp')));
     $this->tableGroup = Table::setTable($dbLink, $shema);
     $this->dbGroup = new Table_query($this->tableGroup, 'g');
     /*
      * Zone
      */
     $shemaZone = array('table' => 'permissions_zone', 'options' => array('auto_increment' => 1), 'column' => array('zid' => array('type' => 'bigint', 'primary' => 1, 'sortable' => 1, 'searchable' => 1), 'name' => array('type' => 'varchar', 'unique' => 1, 'sortable' => 1, 'searchable' => 1), 'timestamp' => array('type' => 'timestamp', 'sortable' => 1, 'searchable' => 1)));
     $this->tableZone = Table::setTable($dbLink, $shemaZone);
     $this->dbZone = new Table_query($this->tableZone, 'z');
     /*
      * GroupUser
      */
     $shemaGroupUser = array('table' => 'permissions_group_user', 'column' => array('gid' => array('type' => 'bigint', 'primary' => 1, 'sortable' => 1, 'searchable' => 1), 'uid' => array('type' => 'bigint', 'sortable' => 1, 'searchable' => 1), 'permission' => array('type' => 'int'), 'timestamp' => array('type' => 'timestamp', 'sortable' => 1, 'searchable' => 1)));
     $this->tableGroupUser = Table::setTable($dbLink, $shemaGroupUser);
     $this->dbGroupUser = new Table_query($this->tableGroupUser, 'gu');
     $this->dbGroupUser->innerJoin($this->tableGroup, 'g', 'gu.gid=g.gid ');
     /*
      * Group Zone
      */
     $shemaGroupZone = array('table' => 'permissions_group_zone', 'column' => array('gid' => array('type' => 'bigint', 'primary' => 1, 'sortable' => 1, 'searchable' => 1), 'zid' => array('type' => 'bigint', 'sortable' => 1, 'searchable' => 1), 'permission' => array('type' => 'int', 'sortable' => 1, 'searchable' => 1), 'timestamp' => array('type' => 'timestamp', 'sortable' => 1, 'searchable' => 1)));
     $this->tableGroupZone = Table::setTable($dbLink, $shemaGroupZone);
     $this->dbGroupZone = new Table_query($this->tableGroupZone, 'gz');
     $this->dbGroupZone->innerJoin($this->tableGroup, 'g', 'gz.gid=g.gid ');
     $this->dbGroupZone->innerJoin($this->tableZone, 'z', 'gz.zid=z.zid ');
 }
Beispiel #12
0
 public function url(\Fp\Core\Init $O, $url, $params)
 {
     foreach ($params as $k => $v) {
         $url = str_replace(":{$k}?", $v, $url);
         // ajouter condition pour ne pas écraser var qui ont le même préfix
         $url = str_replace(":{$k}", $v, $url);
     }
     // append root
     $url = preg_replace('#^\\^#', $O->glob('url'), $url);
     // remove optional parameters
     // @todo not remove url get params (?!\?[^=&?]+)
     $url = preg_replace('#/?:[a-z_0-9]+\\?#', "", $url);
     return $url;
 }