}
public function table_row_encrypt(&$table,&$row) {
+ if (!empty($table->update_parse)) {
+ $fct = $table->update_parse;
+ $row = $fct($row,$table);
+ }
+
if (0
or empty($this->encrypt)
or empty($this->encrypt['secret'])
],$opt));
}
+ public function ssha_password($password='') {
+ if (empty($password)) return $password;
+ $salt = substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',4)),0,4);
+ $password = '{SSHA}' . base64_encode(sha1( $password.$salt, TRUE ). $salt);
+ return $password;
+ }
#public function default_table() { return $this->default_table; }
} # < Class
public $rows = []; # array inserted into temporary table
public $row_parse_pre; # Function to call in rows()
public $row_parse_post; # Function to call in rows()
+ public $update_parse; # Function to call in update, replace, insert
public $count;
public $engine;
public $created;
#return $ex;
}
+
+ public function ssha_password($password='') {
+ return $this->db->ssha_password($password);
+ }
} # < Class
__table_define();
?>
}
public function ssha_password($password='') {
- if ($password=='') $password = $this->params['table'];
- if ($password=='' and !empty($_POST['password'])) $password = $_POST['password'];
- if ($this->db->is_html) echo <<<EOF
+ if ($password=='') {
+ if ($password=='') $password = $this->params['table'];
+ if ($password=='' and !empty($_POST['password'])) $password = $_POST['password'];
+ if ($this->db->is_html) echo <<<EOF
<form action="$this->uri" method="post">
<label>Password</label><input type="text" name="password" value="$password" />
<input type="submit" />
</form>
EOF;
- if (!$password) return [];
- $salt = substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',4)),0,4);
- $password = '{SSHA}' . base64_encode(sha1( $password.$salt, TRUE ). $salt);
- return [ 'SSHA' => $password ];
+ }
+ return $this->db->ssha_password($password);
}
public function status() { #$this->perm--;