Advertisement
Guest User

Untitled

a guest
Jul 1st, 2022
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP7 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 4.1.0.1
  8. * @ Author : DeZender
  9. * @ Release on : 29.08.2020
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. function plog($rText)
  15. {
  16. echo '[' . date('Y-m-d h:i:s') . '] ' . $rText . "\n";
  17. }
  18.  
  19. function getProcessCount()
  20. {
  21. exec('pgrep -u mini_cs | wc -l 2>&1', $rOutput, $rRet);
  22. return intval($rOutput[0]);
  23. }
  24.  
  25. function getKeyCache($rKey)
  26. {
  27. if (file_exists(MAIN_DIR . 'cache/keystore/' . $rKey . '.key')) {
  28. return file_get_contents(MAIN_DIR . 'cache/keystore/' . $rKey . '.key');
  29. }
  30.  
  31. return NULL;
  32. }
  33.  
  34. function setKeyCache($rKey, $rValue)
  35. {
  36. file_put_contents(MAIN_DIR . 'cache/keystore/' . $rKey . '.key', $rValue);
  37.  
  38. if (file_exists(MAIN_DIR . 'cache/keystore/' . $rKey . '.key')) {
  39. return true;
  40. }
  41.  
  42. return false;
  43. }
  44.  
  45. function openCache($rChannel)
  46. {
  47. if (file_exists(MAIN_DIR . 'cache/' . $rChannel . '.db')) {
  48. return json_decode(file_get_contents(MAIN_DIR . 'cache/' . $rChannel . '.db'), true);
  49. }
  50.  
  51. return [];
  52. }
  53.  
  54. function deleteCache($rChannel)
  55. {
  56. if (file_exists(MAIN_DIR . 'cache/' . $rChannel . '.db')) {
  57. unlink(MAIN_DIR . 'cache/' . $rChannel . '.db');
  58. }
  59.  
  60. return [];
  61. }
  62.  
  63. function clearCache($rDatabase, $rID)
  64. {
  65. unset($rDatabase[$rID]);
  66. return $rDatabase;
  67. }
  68.  
  69. function getCache($rDatabase, $rID)
  70. {
  71. if (isset($rDatabase[$rID])) {
  72. return $rDatabase[$rID]['value'];
  73. }
  74.  
  75. return NULL;
  76. }
  77.  
  78. function setCache($rDatabase, $rID, $rValue)
  79. {
  80. global $rCacheTime;
  81. $rDatabase[$rID] = ['value' => $rValue, 'expires' => time() + $rCacheTime];
  82. return $rDatabase;
  83. }
  84.  
  85. function saveCache($rChannel, $rDatabase)
  86. {
  87. file_put_contents(MAIN_DIR . 'cache/' . $rChannel . '.db', json_encode($rDatabase));
  88. }
  89.  
  90. function getPersistence()
  91. {
  92. if (file_exists(MAIN_DIR . 'config/persistence.db')) {
  93. $rPersistence = json_decode(file_get_contents(MAIN_DIR . 'config/persistence.db'), true);
  94. }
  95. else {
  96. $rPersistence = [];
  97. }
  98.  
  99. return $rPersistence;
  100. }
  101.  
  102. function addPersistence($rScript, $rChannel)
  103. {
  104. $rPersistence = getpersistence();
  105.  
  106. if (!in_array($rChannel, $rPersistence[$rScript])) {
  107. $rPersistence[$rScript][] = $rChannel;
  108. }
  109.  
  110. file_put_contents(MAIN_DIR . 'config/persistence.db', json_encode($rPersistence));
  111. }
  112.  
  113. function removePersistence($rScript, $rChannel)
  114. {
  115. $rPersistence = getpersistence();
  116.  
  117. if (($rKey = array_search($rChannel, $rPersistence[$rScript])) !== false) {
  118. unset($rPersistence[$rScript][$rKey]);
  119. .................................................................
  120. ..................................
  121. ............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement