예제 #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');
 }
예제 #2
0
파일: Debug.php 프로젝트: 4Publish/4p_core
 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();
 }
예제 #3
0
파일: Model.php 프로젝트: 4Publish/4p_core
 /** @return $this Description * */
 public static function getInstance(\Fp\Core\Init $O)
 {
     $classname = get_called_class();
     if (!($c = $O->getInstance($classname))) {
         $c = new $classname($O);
         $O->setInstance($classname, $c);
     }
     return $c;
 }
예제 #4
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');
 }
예제 #5
0
파일: Mail.php 프로젝트: 4Publish/4p_core
 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');
 }
예제 #6
0
파일: Login.php 프로젝트: 4Publish/4p_core
 /**
  * @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');
 }
예제 #7
0
 protected function onNodeChange($id_node, $node, $old_node)
 {
     $this->O->event()->trigger($this->namespace . '.node.change');
     $uid = $this->O->auth()->uid();
     $label = Filter::text('node.revision.label', $node, 'revision');
     $comment = Filter::text('node.revision.comment', $node);
     $this->addRevision($id_node, $uid, $label, $comment, Date::fromStrtotime(time())->mysqlDateTime(), $old_node);
 }
예제 #8
0
파일: Cache.php 프로젝트: 4Publish/4p_core
 /**
  * @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;
 }
예제 #9
0
파일: Module.php 프로젝트: 4Publish/4p_core
 public function setUrl($mode = null, $defaultUrl = null)
 {
     if (!$this->url && !$defaultUrl) {
         $this->url = $this->data['url'] = trim($this->O->route()->getRoute(), '/') . '?' . $this->var_module . '=' . trim(preg_replace('#\\\\#', '.', get_called_class()), '\\');
     } else {
         if ($defaultUrl) {
             $this->is_routed = true;
             $this->url = $this->data['url'] = $defaultUrl;
         }
     }
     $m = 0;
     $mode = $mode ? $mode : $this->mode;
     $sp = preg_match("#\\?#", $this->url) ? '&' : '?';
     if ($mode) {
         // si le mode est présent dans l'url on le remplace
         // @TODO l'utilisation des variables-value est déprécié
         if (preg_match("#/(?:{$this->var_mode}-)?{$mode}#", $this->url)) {
             $m = 1;
         }
         if (preg_match("#/(?:{$this->var_mode}=)?{$mode}#", $this->url, $match)) {
             $m = 1;
         }
     }
     foreach ($this->render_mode as $v) {
         if ($m) {
             $this->data["url_" . $v] = $this->{"url_" . $v} = str_replace($mode, $v, $this->url);
         } else {
             if ($v != $mode) {
                 $this->data["url_" . $v] = $this->{"url_" . $v} = $this->url . $sp . $this->var_mode . '=' . $v;
             } else {
                 $this->data["url_" . $v] = $this->{"url_" . $v} = $this->url;
             }
         }
     }
     $this->data['url_static'] = $this->url_static;
     return $this;
 }
예제 #10
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")
             );*/
 }
예제 #11
0
파일: Cdn.php 프로젝트: 4Publish/4p_core
 public function __construct(\Fp\Core\Init $O)
 {
     $this->cache_dir = $O->glob('dir_cache') . 'cdn/';
     $this->O = $O;
     $this->noCache = $O->glob('cache');
 }
예제 #12
0
파일: Pseudo.php 프로젝트: 4Publish/4p_core
 public function __construct(\Fp\Core\Init $O)
 {
     $this->table = $O->glob('prefix') . $this->table;
     return $this;
 }
예제 #13
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 ');
 }
예제 #14
0
파일: Utils.php 프로젝트: 4Publish/4p_core
 public static function getWebPath(\Fp\Core\Init $O, $dir)
 {
     return $O->route()->getWebPath($dir);
 }
예제 #15
0
파일: Router.php 프로젝트: 4Publish/4p_core
 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;
 }
예제 #16
0
 /**
  * @param unknown $t
  * @param unknown $url
  * @return unknown
  * @deprecated
  */
 public static function urlRelativ($t, \Fp\Core\Init $O, $url)
 {
     $c = clone $t;
     $r = $o->glob('url') . '/' . $O->route()->getRoute();
     $c->vars = preg_replace("#{$r}#", '.', $c->vars);
     return $c;
 }