Jump to content

Search the Community

Showing results for tags 'systemencrypt'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • News
    • The Lounge
  • Community
    • Pre-Sales Questions
    • Support
    • The Marketplace
    • Contribute
    • Show Off
    • Feature Requests
    • Bugs
    • Contests
  • Developer Corner
    • General
    • Extensions
  • BlestaStore's Forum
  • BlestaStore's BlestaCMS
  • BlestaStore's Resellers
  • BlestaStore's BlestaForums
  • BlestaStore's Promotions
  • CubeData's Official Announcements From CubeData
  • CubeData's Peer Support
  • CubeData's Resellers
  • ModulesGarden Club's Topics
  • Blesta Addons's Topics

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Found 1 result

  1. Hey all, Just wondering if there's a Right Way™ to access the systemEncrypt/systemDecrypt methods from within a module (specifically, a forked version of the Plesk service module). I've hacked it in for now, but it feels dirty and though it works I was wondering if there's a better way. Current 'solution': /** * Wrapper around systemEncrypt function * * @param string $string The string to encrypt * @return string The encrypted version of input string */ protected function encryptString($string) { if (!isset($this->Clients)) Loader::loadModels($this, array("Clients")); return $this->Clients->systemEncrypt($string); } /** * Wrapper around systemDecrypt function * * @param string $string The string to decrypt * @return string The decrypted version of input string */ protected function decryptString($string) { if (!isset($this->Clients)) Loader::loadModels($this, array("Clients")); return $this->Clients->systemDecrypt($string); } I don't actually use the Clients model anywhere, just load it so that I can have access to the systemEncrypt/systemDecrypt methods that are attached. I suppose the real question would be is it possible to add a bonafide custom Model to a module, as I'm storing the encrypted values in a table the module is creating for itself during install/upgrade. ie public function upgrade($current_version) { if (version_compare($this->getVersion(), $current_version, ">")) { // Upgrade to v1.0.2 if (version_compare($current_version, "0.2.3", "<")) { $this->Record-> setField("id", array('type' => "int",'size' => 10,'unsigned' => true,'auto_increment' => true))-> setField("client_id", array('type' => "int", 'size' => 10))-> setField("encrypted_field", array('type' => "varchar", 'size' => 255))-> ... setKey(array("id"), "primary")-> ... create("my_custom_table"); } } } $some_data = $this->Record->select()->from("my_custom_table") ->where("client_id", "=", $service->client_id) ->fetch(); $some_data->encrypted_field = $this->decryptString($some_data->encrypted_field); Not sure how I could wrap this up and have $this->MyModel->foo(), but I assume if it's possible it'd extend some base model class which would give me the encryption methods 'For Free'.
  • Create New...