PluginProbe
The WP Remote WordPress Plugin / 4.76
The WP Remote WordPress Plugin v4.76
6.72 6.69 6.65 6.62 6.48 6.47 4.87 4.97 5.05 5.09 5.16 5.22 5.24 5.25 5.38 5.41 5.42 5.45 5.47 5.53 5.56 5.65 5.68 5.72 5.73 All 53 releases
wpremote / callback / handler.php

handler.php in The WP Remote WordPress Plugin 4.76, at callback/handler.php

119 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('ABSPATH')) exit;
4 if (!class_exists('BVCallbackHandler')) :
5
6 class BVCallbackHandler {
7 public $db;
8 public $settings;
9 public $siteinfo;
10 public $request;
11 public $account;
12 public $response;
13 public $bvinfo;
14
15 public function __construct($db, $settings, $siteinfo, $request, $account, $response) {
16 $this->db = $db;
17 $this->settings = $settings;
18 $this->siteinfo = $siteinfo;
19 $this->request = $request;
20 $this->account = $account;
21 $this->response = $response;
22 $this->bvinfo = new WPRInfo($this->settings);
23 }
24
25 public function bvAdmExecuteWithoutUser() {
26 $this->execute(array("bvadmwithoutuser" => true));
27 }
28
29 public function bvAdmExecuteWithUser() {
30 $this->execute(array("bvadmwithuser" => true));
31 }
32
33 public function execute($resp = array()) {
34 $this->routeRequest();
35 $resp = array(
36 "request_info" => $this->request->info(),
37 "site_info" => $this->siteinfo->info(),
38 "account_info" => $this->account->info(),
39 "bvinfo" => $this->bvinfo->info(),
40 "api_pubkey" => substr(WPRAccount::getApiPublicKey($this->settings), 0, 8)
41 );
42 $this->response->terminate($resp);
43 }
44
45 public function routeRequest() {
46 switch ($this->request->wing) {
47 case 'manage':
48 require_once dirname( __FILE__ ) . '/wings/manage.php';
49 $module = new BVManageCallback($this);
50 break;
51 case 'fs':
52 require_once dirname( __FILE__ ) . '/wings/fs.php';
53 $module = new BVFSCallback($this);
54 break;
55 case 'db':
56 require_once dirname( __FILE__ ) . '/wings/db.php';
57 $module = new BVDBCallback($this);
58 break;
59 case 'info':
60 require_once dirname( __FILE__ ) . '/wings/info.php';
61 $module = new BVInfoCallback($this);
62 break;
63 case 'dynsync':
64 require_once dirname( __FILE__ ) . '/wings/dynsync.php';
65 $module = new BVDynSyncCallback($this);
66 break;
67 case 'ipstr':
68 require_once dirname( __FILE__ ) . '/wings/ipstore.php';
69 $module = new BVIPStoreCallback($this);
70 break;
71 case 'wtch':
72 require_once dirname( __FILE__ ) . '/wings/watch.php';
73 $module = new BVWatchCallback($this);
74 break;
75 case 'brand':
76 require_once dirname( __FILE__ ) . '/wings/brand.php';
77 $module = new BVBrandCallback($this);
78 break;
79 case 'pt':
80 require_once dirname( __FILE__ ) . '/wings/protect.php';
81 $module = new BVProtectCallback($this);
82 break;
83 case 'act':
84 require_once dirname( __FILE__ ) . '/wings/account.php';
85 $module = new BVAccountCallback($this);
86 break;
87 case 'fswrt':
88 require_once dirname( __FILE__ ) . '/wings/fs_write.php';
89 $module = new BVFSWriteCallback();
90 break;
91 case 'actlg':
92 require_once dirname( __FILE__ ) . '/wings/actlog.php';
93 $module = new BVActLogCallback($this);
94 break;
95 case 'speed':
96 require_once dirname( __FILE__ ) . '/wings/speed.php';
97 $module = new BVSpeedCallback($this);
98 break;
99 default:
100 require_once dirname( __FILE__ ) . '/wings/misc.php';
101 $module = new BVMiscCallback($this);
102 break;
103 }
104 $resp = $module->process($this->request);
105 if ($resp === false) {
106 $resp = array(
107 "statusmsg" => "Bad Command",
108 "status" => false);
109 }
110 $resp = array(
111 $this->request->wing => array(
112 $this->request->method => $resp
113 )
114 );
115 $this->response->addStatus("callbackresponse", $resp);
116 return 1;
117 }
118 }
119 endif;