PageRenderTime 70ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/cubi/modules/websvc/form/WebsvcForm.php

http://openbiz-cubi.googlecode.com/
PHP | 45 lines | 23 code | 7 blank | 15 comment | 0 complexity | b7905bb28896d9ce457a3931b8271ca7 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-3.0
  1. <?php
  2. /**
  3. * Openbiz Cubi Application Platform
  4. *
  5. * LICENSE http://code.google.com/p/openbiz-cubi/wiki/CubiLicense
  6. *
  7. * @package cubi.websvc.form
  8. * @copyright Copyright (c) 2005-2011, Openbiz Technology LLC
  9. * @license http://code.google.com/p/openbiz-cubi/wiki/CubiLicense
  10. * @link http://code.google.com/p/openbiz-cubi/
  11. * @version $Id: WebsvcForm.php 3376 2012-05-31 06:23:51Z rockyswen@gmail.com $
  12. */
  13. class WebSvcForm extends EasyForm
  14. {
  15. protected function _doInsert($inputRecord)
  16. {
  17. // gen key
  18. $key = $this->genKey();
  19. // get secret
  20. $secret = $this->genSecret();
  21. $inputRecord['api_key'] = $key;
  22. $inputRecord['secret'] = $secret;
  23. parent::_doInsert($inputRecord);
  24. }
  25. protected function genKey()
  26. {
  27. // generate api key
  28. $key = md5(uniqid());
  29. return $key;
  30. }
  31. protected function genSecret()
  32. {
  33. // generate secret
  34. $secret = sha1(uniqid());
  35. return $secret;
  36. }
  37. }
  38. ?>