file_put_contents("{$dir}/pub.key",$pub_key);
file_put_contents("{$dir}/pri.key",$pri_key);
file_put_contents("{$dir}/pub.key",$pub_key);
file_put_contents("{$dir}/pri.key",$pri_key);
'module' => $a['module'],
'name' => $a['name'],
'description' => $a['description'],
'val' => (!isset($a['is_encrypt']) || $a['is_encrypt'] == 1) ?
$this->encrypt($a['val']) : $a['val'],
'module' => $a['module'],
'name' => $a['name'],
'description' => $a['description'],
'val' => (!isset($a['is_encrypt']) || $a['is_encrypt'] == 1) ?
$this->encrypt($a['val']) : $a['val'],
- $key_dir = "{$this->getKeyDirectory()}/pri.key";
+ $dir = $this->getKeyDirectory();
+
+ if(!$dir) {
+ return false;
+ }
+
+ if(empty($this->val)) {
+ return false;
+ }
+
+ if(empty($this->is_encrypt)) {
+ return $this->val;
+ }
+
+ $key_dir = "{$dir}/pri.key";
- function checkWritable($cls_name,$func_name,$dir)
- {
- if(!is_writable($dir)) {
- print_r("Cannot run {$cls_name} :: {$func_name}\n");
- print_r("Directory: {$dir} is not writable by current user\n");
- exit;
- }
-
- return true;
- }