/**
  * Encrypts your mail settings
  *
  * @param $username
  *
  * @param $password
  *
  * @param null $callback
  *
  * @return bool
  */
 public static function EncryptMailSettings($username, $password, $callback = null)
 {
     if (FileMethods::FileExists(PathFinder::RealPath('Json/encrypted/mailer_settings.json'))) {
         /**
          * We already have settings!
          */
         return false;
     }
     /**
      * The decryption key
      */
     $key = Random::RandomMD5();
     /**
      * If not, lets create an array, encrypting each value
      */
     $array = ['decryption_key' => $key, 'mailer_settings' => ['username' => Encryption::EncryptString($username, $key), 'password' => Encryption::EncryptString($password, $key)]];
     /**
      * Write file
      */
     JsonWriter::PathWrite('Json/encrypted/mailer_settings.json', $array);
     /**
      * Is there a callback?
      */
     if ($callback != null) {
         call_user_func($callback);
     }
     /**
      * Return true!
      */
     return true;
 }
 /**
  * Saves the payload
  */
 public function SavePayload()
 {
     if ($this->payload != null) {
         JsonWriter::Write(PathFinder::RealPath("Json/resource/generated_groups.json"), $this->payload);
     }
 }
Example #3
0
 /**
  * Write that log.
  */
 public function WriteLog()
 {
     JsonWriter::Write(PathFinder::RealPath("/Json/resource/install_log.json"), Install::$log);
 }