| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) exit; |
| 3 |
if (!class_exists('BVSecurityCallback')) : |
| 4 |
class BVSecurityCallback extends BVCallbackBase { |
| 5 |
function getCrontab() { |
| 6 |
$resp = array(); |
| 7 |
|
| 8 |
if (function_exists('exec')) { |
| 9 |
$output = array(); |
| 10 |
$retval = -1; |
| 11 |
$execRes = exec('crontab -l', $output, $retval); |
| 12 |
if ($execRes !== false && $execRes !== null) { |
| 13 |
$resp["content"] = implode("\n", $output); |
| 14 |
$resp["status"] = "success"; |
| 15 |
$resp["code"] = $retval; |
| 16 |
} |
| 17 |
} |
| 18 |
if (empty($resp) && function_exists('popen')) { |
| 19 |
$handle = popen('crontab -l', 'rb'); |
| 20 |
if ($handle) { |
| 21 |
$output = ''; |
| 22 |
while (!feof($handle)) { |
| 23 |
$output .= fread($handle, 8192); |
| 24 |
} |
| 25 |
$resp["content"] = $output; |
| 26 |
$resp["status"] = "success"; |
| 27 |
pclose($handle); |
| 28 |
} else { |
| 29 |
$resp["status"] = "failed"; |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
return $resp; |
| 34 |
} |
| 35 |
|
| 36 |
public function process($request) { |
| 37 |
switch ($request->method) { |
| 38 |
case "gtcrntb": |
| 39 |
$resp = $this->getCrontab(); |
| 40 |
break; |
| 41 |
default: |
| 42 |
$resp = false; |
| 43 |
} |
| 44 |
|
| 45 |
return $resp; |
| 46 |
} |
| 47 |
} |
| 48 |
endif; |
| 49 |
|