Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. curl_setopt($ch, CURLOPT_URL, Configure::read('TMSWebServices.Url').'getSystemSetting.json');
  2. curl_setopt($ch, CURLOPT_POST, true);
  3. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  4. curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
  5.  
  6. $result_json = curl_exec($ch);
  7. curl_close($ch);
  8. $result = json_decode($result_json, true);
  9. debug($result); exit;
  10.  
  11. App::uses('AuthComponent', 'Controller/Component');
  12. App::uses('UsersController', 'Controller');
  13. App::uses('Security','Utility');
  14.  
  15. class WebServicesController extends AppController {
  16. public $name = 'WebServices';
  17. public $uses = array('Tenant', 'TbNextId', 'ReportMaster' );
  18. public $components = array('RequestHandler');
  19.  
  20. public function getSystemSetting(){
  21. $this->loadModel('SystemSetting');
  22. $results = $this->SystemSetting->find($type, $params);
  23. $return_value = array();
  24. $return_value[] = $results['SystemSetting'];
  25. foreach($return_value['Config'] as $key=>$value){
  26. if ($value['ENCRYPT_IND'] == 'Y'){
  27. $encryptedValue = $return_value['Config'][$key]['SYSTEM_SETTING_VALUE'];
  28. //decrypt the value
  29. $decryptedValue = Security::cipher($encryptedValue,
  30. Configure::read('Security.salt')); // the problem starts here
  31. $return_value['Config'][$key]['SYSTEM_SETTING_VALUE'] = $decryptedValue;
  32. }
  33. }
  34.  
  35. }
  36.  
  37. }
  38. $this->set(array(
  39. 'return_value' => $return_value,
  40. '_serialize' => array('return_value')
  41. ));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement