Exemplo n.º 1
0
 /**
  * Generate directory
  *
  * @param $directory
  * @param int $length
  * @return string
  */
 public static function generateDir($directory, $length = 8)
 {
     do {
         $name = \Extlib\Generator::generate($length);
         $filepath = rtrim($directory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $name;
     } while (is_dir($filepath));
     return $name;
 }
Exemplo n.º 2
0
 /** 
  * @ORM\PrePersist 
  */
 public function preInsert()
 {
     if ($this->fileExists()) {
         $this->setSize(filesize($this->getFullFilePath()));
         $this->setFileMd5(md5_file($this->getFullFilePath()));
         $this->setMimeType(finfo_file(finfo_open(FILEINFO_MIME_TYPE), $this->getFullFilePath()));
     }
     $this->dateCreate = new \Zend_Date();
     $this->hash = \Extlib\Generator::generateDoctrine2($this->getEm(), get_class($this), 'hash', self::HASH_LEN);
 }
Exemplo n.º 3
0
 /**
  * Set password
  *
  * @param string $password
  * @return User
  */
 public function setPassword($password)
 {
     $this->salt = \Extlib\Generator::generateDoctrine2($this->getEm(), get_class($this), 'salt', self::SALT_LEN);
     $this->password = \hash(self::PASSWORD_HASH_ALGORITHM, $password . $this->salt);
     return $this;
 }
Exemplo n.º 4
0
 /** 
  * @ORM\PrePersist 
  */
 public function preInsert()
 {
     $this->dateCreate = new \Zend_Date();
     $this->hash = \Extlib\Generator::generateDoctrine2($this->getEm(), get_class($this), 'hash', self::HASH_LEN);
 }