Example #1
0
 function buildModel($t)
 {
     if (!ctype_alnum($t)) {
         throw BaseException('invalid table name');
     }
     $o = '';
     $data = $this->api->db->getAll("describe {$t}");
     var_dump($data);
     foreach ($data as $row) {
         $dd[$row[0]] = $row[0];
     }
 }
Example #2
0
 /** Perform password encryption with selected cypher */
 function encryptPassword($password, $salt = null)
 {
     if ($this->password_encryption) {
         $this->debug("Encrypting password: '******' with salt '{$salt}'");
     }
     switch ($this->password_encryption) {
         case null:
             return $password;
         case 'sha256/salt':
             if (!$salt) {
                 throw $this->exception('sha256 requires salt (2nd argument to encryptPassword and is normaly an email)');
             }
             if ($this->password_encryption) {
                 $this->debug("Using password key: '" . $this->api->getConfig('auth/key') . "'");
             }
             return hash_hmac('sha256', $password . $salt, $this->api->getConfig('auth/key'));
         case 'sha1':
             return sha1($password);
         case 'md5':
             return md5($password);
         case 'rot13':
             return str_rot13($password);
         default:
             throw BaseException('No such encryption method: ' . $this->password_encryption);
     }
 }