Advertisement
Guest User

Untitled

a guest
Aug 12th, 2019
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.08 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.5.0.0
  8. * @ Author : DeZender
  9. * @ Release on : 22.06.2018
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. define('CRONS_PAGE', true);
  15. require_once 'load.php';
  16.  
  17. if (PHP_SAPI !== 'cli' && (empty($_REQUEST['key']) || $_REQUEST['key'] !== $_OPTIONS['system']['cron_tasks_key'])) {
  18. do_deny_access();
  19. }
  20.  
  21. $_OPTIONS['inline']['base_url'] = $_OPTIONS['system']['website_url'];
  22. $_OPTIONS['crontasks'] = $db->where('option_name', 'crontasks')->getValue('options', 'option_value');
  23. $_OPTIONS['crontasks'] = (empty($_OPTIONS['crontasks']) ? array() : json_decode($_OPTIONS['crontasks'], true));
  24.  
  25. foreach ($_OPTIONS['crontasks'] as $key => $value) {
  26. if (substr($key, strlen($key) - 7, strlen($key)) !== '_period') {
  27. continue;
  28. }
  29.  
  30. $cronP = array('val' => 1, 'unit' => 'minutes');
  31. $_process = do_fetch_period($value);
  32.  
  33. if ($_process) {
  34. $cronP = array('val' => $_process['RV'], 'unit' => $_process['RU']);
  35. }
  36.  
  37. $cronP['gm_value'] = (string) $cronP['val'] . ' ' . $cronP['unit'];
  38. $cronP['date_next'] = do_gmdate_format($cronP['gm_value']);
  39. $cronP['seconds'] = do_convert_period($cronP['val'], $cronP['unit']);
  40. $_OPTIONS['crontasks'][$key] = $cronP;
  41. }
  42. $helpDate = $_OPTIONS['inline']['date_now'];
  43. $taskList = $db->where('is_run', 0)->where("(`date_next` IS NULL OR `date_next` <= '" . $helpDate . "')")->get('tasks', null, array('task_id', 'system_slug', 'is_system', 'date_run', 'date_next', 'date_update'));
  44.  
  45. if (!empty($taskList)) {
  46. foreach ($taskList as $key => $value) {
  47. $upData = array('is_run' => 1, 'date_run' => $_OPTIONS['inline']['date_now'], 'date_update' => $_OPTIONS['inline']['date_now']);
  48.  
  49. if (!empty($value['is_system']) && isset($_OPTIONS['crontasks'][$value['system_slug'] . '_period'])) {
  50. $upData['date_next'] = $_OPTIONS['crontasks'][(string) $value['system_slug'] . '_period']['date_next'];
  51. } else {
  52. $upData['date_next'] = null;
  53. }
  54.  
  55. $db->where('task_id', $value['task_id'])->update('tasks', $upData, 1);
  56. }
  57. }
  58.  
  59. $systemTasks = $db->where('is_system', 1)->where('is_run', 1)->get('tasks');
  60.  
  61. if (!empty($systemTasks)) {
  62. foreach ($systemTasks as $key => $taskData) {
  63. $_process = false;
  64.  
  65. switch ($taskData['system_slug']) {
  66. case 'new_badge_reset':
  67. if (!isset($_OPTIONS['crontasks']['new_badge_reset_period'])) {
  68. break;
  69. }
  70.  
  71. $helpDate = do_gmdate_format('- ' . $_OPTIONS['crontasks']['new_badge_reset_period']['gm_value']);
  72.  
  73. foreach (array('articles', 'folders', 'files', 'products') as $tableName) {
  74. $_process = $db->where('is_new', 1)->where("(`date_new` IS NULL OR `date_new` <= '" . $helpDate . "')")->update($tableName, array('is_new' => 0, 'date_new' => null));
  75.  
  76. if (!$_process) {
  77. break 2;
  78. }
  79. }
  80.  
  81. break;
  82.  
  83. case 'download_link_expire':
  84. $helpDate = $_OPTIONS['inline']['date_now'];
  85. $_process = $db->where('is_active', 1)->where("(`date_expire` IS NULL OR `date_expire` <= '" . $helpDate . "')")->update('udownloads', array('is_active' => 0));
  86.  
  87. break;
  88.  
  89. case 'users_temporary':
  90. if (!isset($_OPTIONS['crontasks']['users_temporary_period'])) {
  91. break;
  92. }
  93.  
  94. $helpDate = do_gmdate_format('- ' . $_OPTIONS['crontasks']['users_temporary_period']['gm_value']);
  95. $_process = $db->where('is_verified', 0)->where('date_create', $helpDate, '<=')->delete('users');
  96.  
  97. break;
  98.  
  99. case 'package_expire_check':
  100. $helpDate = $_OPTIONS['inline']['date_now'];
  101. $_process = $db->where('is_active', 1)->where('`date_expire` IS NOT NULL')->where("`date_expire` <= '" . $helpDate . "'")->update('upackages', array('is_active' => 0));
  102.  
  103. break;
  104.  
  105. case 'package_extra_reset':
  106. $_process = $db->update('upackages', array('extra' => 0, 'extra_files' => 0));
  107.  
  108. break;
  109.  
  110. case 'package_fair_reset':
  111. $_process = $db->update('upackages', array('fair' => 0, 'fair_files' => 0));
  112. ...........................................................................
  113. .............................................
  114. ...................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement