Advertisement
Guest User

Untitled

a guest
Apr 6th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 3.0.8.0
  8. * @ Author : DeZender
  9. * @ Release on : 25.09.2017
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. namespace App\Libraries;
  15.  
  16. class APIStoreService
  17. {
  18. const SERVER = 'https://portal.cnv.vn/api/';
  19.  
  20. public $client = null;
  21. public $cache = null;
  22.  
  23. public function __construct(\GuzzleHttp\Client $client, \Illuminate\Contracts\Cache\Factory $cache)
  24. {
  25. $this->client = $client;
  26. $this->cache = $cache;
  27. }
  28.  
  29. /**
  30. * @return void
  31. */
  32. public function checkForUpdateForCore()
  33. {
  34. if (!($this->cache->has( 'check_for_update_for_core' ))) {
  35. $url = static::SERVER . 'check-for-update/core.json';
  36. $request = $this->client->request( 'GET', $url );
  37.  
  38. if ($request->getStatusCode( ) == 200) {
  39. app( 'helper' )->load( 'utilities' );
  40. $content = json_decode( $request->getBody( ), true );
  41. Storage::put( 'check_for_update_for_core.db', serialize( $content['data'] ) );
  42. $cfg = config( 'cnv' );
  43. $cfg['latest_version'] = strval( $content['latest_version'] );
  44. $contentCfg = '<?php' . "\n" . 'return ' . var_export_short( $cfg ) . ';';
  45. @file_put_contents( config_path( 'cnv.php' ), $contentCfg );
  46. $this->cache->put( 'check_for_update_for_core', true, 60 * 24 );
  47. }
  48. }
  49. }
  50.  
  51. public function getAllModules($page = 1)
  52. {
  53. $url = static::SERVER . 'modules.json?page=' . $page;
  54. $request = $this->client->request( 'GET', $url );
  55. ........................................................................
  56. ........................................
  57. .............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement