| @@ -9,9 +9,9 @@ | ||
| 9 | 9 | public $siteinfo; |
| 10 | 10 | public $bvinfo; |
| 11 | 11 | public $bvapi; |
| 12 | 12 | |
| 13 | - const INFO_WING_VERSION = 1.6; | |
| 13 | + const INFO_WING_VERSION = 2.7; | |
| 14 | 14 | |
| 15 | 15 | public function __construct($callback_handler) { |
| 16 | 16 | $this->db = $callback_handler->db; |
| 17 | 17 | $this->siteinfo = $callback_handler->siteinfo; |
| @@ -44,8 +44,27 @@ | ||
| 44 | 44 | "comments" => get_object_vars(wp_count_comments()) |
| 45 | 45 | ); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | + public function addDBInfoToPlugin($pdata, $plugin_file) { | |
| 49 | + switch ($plugin_file) { | |
| 50 | + case "woocommerce/woocommerce.php": | |
| 51 | + $pdata['current_db_version'] = $this->settings->getOption('woocommerce_db_version'); | |
| 52 | + $pdata['latest_db_version'] = $this->bvinfo->getLatestWooCommerceDBVersion(); | |
| 53 | + break; | |
| 54 | + case "elementor/elementor.php": | |
| 55 | + $pdata['current_db_version'] = $this->settings->getOption('elementor_version'); | |
| 56 | + $pdata['latest_db_version'] = $this->bvinfo->getLatestElementorDBVersion($plugin_file); | |
| 57 | + break; | |
| 58 | + case "elementor-pro/elementor-pro.php": | |
| 59 | + $pdata['current_db_version'] = $this->settings->getOption('elementor_pro_version'); | |
| 60 | + $pdata['latest_db_version'] = $this->bvinfo->getLatestElementorDBVersion($plugin_file); | |
| 61 | + break; | |
| 62 | + } | |
| 63 | + | |
| 64 | + return $pdata; | |
| 65 | + } | |
| 66 | + | |
| 48 | 67 | public function getPlugins() { |
| 49 | 68 | if (!function_exists('get_plugins')) { |
| 50 | 69 | require_once (ABSPATH."wp-admin/includes/plugin.php"); |
| 51 | 70 | } |
| @@ -56,10 +75,15 @@ | ||
| 56 | 75 | 'file' => $plugin_file, |
| 57 | 76 | 'title' => $plugin_data['Title'], |
| 58 | 77 | 'version' => $plugin_data['Version'], |
| 59 | 78 | 'active' => is_plugin_active($plugin_file), |
| 60 | - 'network' => $plugin_data['Network'] | |
| 79 | + 'network' => $plugin_data['Network'], | |
| 80 | + "plugin_uri" => $plugin_data["PluginURI"], | |
| 81 | + "update_uri" => $plugin_data["UpdateURI"], | |
| 82 | + "author_uri" => $plugin_data["AuthorURI"], | |
| 83 | + "author" => $plugin_data["AuthorName"], | |
| 61 | 84 | ); |
| 85 | + $pdata = $this->addDBInfoToPlugin($pdata, $plugin_file); | |
| 62 | 86 | $result["plugins"][] = $pdata; |
| 63 | 87 | } |
| 64 | 88 | return $result; |
| 65 | 89 | } |
| @@ -70,9 +94,13 @@ | ||
| 70 | 94 | 'name' => $theme->Name, |
| 71 | 95 | 'title' => $theme->Title, |
| 72 | 96 | 'stylesheet' => $theme->get_stylesheet(), |
| 73 | 97 | 'template' => $theme->Template, |
| 74 | - 'version' => $theme->Version | |
| 98 | + 'version' => $theme->Version, | |
| 99 | + 'theme_uri' => $theme->get('ThemeURI'), | |
| 100 | + 'author' => $theme->get('Author'), | |
| 101 | + 'author_uri' => $theme->get('AuthorURI'), | |
| 102 | + 'update_uri' => $theme->get('UpdateURI'), | |
| 75 | 103 | ); |
| 76 | 104 | } else { |
| 77 | 105 | $pdata = array( |
| 78 | 106 | 'name' => $theme["Name"], |
| @@ -78,9 +106,11 @@ | ||
| 78 | 106 | 'name' => $theme["Name"], |
| 79 | 107 | 'title' => $theme["Title"], |
| 80 | 108 | 'stylesheet' => $theme["Stylesheet"], |
| 81 | 109 | 'template' => $theme["Template"], |
| 82 | - 'version' => $theme["Version"] | |
| 110 | + 'version' => $theme["Version"], | |
| 111 | + 'author' => $theme['Author'], | |
| 112 | + 'author_uri' => $theme['Author URI'], | |
| 83 | 113 | ); |
| 84 | 114 | } |
| 85 | 115 | return $pdata; |
| 86 | 116 | } |
| @@ -86,15 +116,14 @@ | ||
| 86 | 116 | } |
| 87 | 117 | |
| 88 | 118 | public function getThemes() { |
| 89 | 119 | $result = array(); |
| 90 | - $themes = function_exists('wp_get_themes') ? wp_get_themes() : get_themes(); | |
| 120 | + $themes = wp_get_themes(); | |
| 91 | 121 | foreach($themes as $theme) { |
| 92 | 122 | $pdata = $this->themeToArray($theme); |
| 93 | 123 | $result["themes"][] = $pdata; |
| 94 | 124 | } |
| 95 | - $theme = function_exists('wp_get_theme') ? wp_get_theme() : get_current_theme(); | |
| 96 | - $pdata = $this->themeToArray($theme); | |
| 125 | + $pdata = $this->themeToArray(wp_get_theme()); | |
| 97 | 126 | $result["currenttheme"] = $pdata; |
| 98 | 127 | return $result; |
| 99 | 128 | } |
| 100 | 129 | |
| @@ -99,14 +128,14 @@ | ||
| 99 | 128 | } |
| 100 | 129 | |
| 101 | 130 | public function getSystemInfo() { |
| 102 | 131 | $sys_info = array( |
| 103 | - 'host' => $_SERVER['HTTP_HOST'], | |
| 132 | + 'host' => WPRHelper::getRawParam('SERVER', 'HTTP_HOST'), | |
| 104 | 133 | 'phpversion' => phpversion(), |
| 105 | 134 | 'AF_INET6' => defined('AF_INET6') |
| 106 | 135 | ); |
| 107 | 136 | if (array_key_exists('SERVER_ADDR', $_SERVER)) { |
| 108 | - $sys_info['serverip'] = $_SERVER['SERVER_ADDR']; | |
| 137 | + $sys_info['serverip'] = WPRHelper::getRawParam('SERVER', 'SERVER_ADDR'); | |
| 109 | 138 | } |
| 110 | 139 | if (function_exists('get_current_user')) { |
| 111 | 140 | $sys_info['user'] = get_current_user(); |
| 112 | 141 | } |
| @@ -147,8 +176,10 @@ | ||
| 147 | 176 | 'uploaddir' => wp_upload_dir(), |
| 148 | 177 | 'contentdir' => defined('WP_CONTENT_DIR') ? WP_CONTENT_DIR : null, |
| 149 | 178 | 'contenturl' => defined('WP_CONTENT_URL') ? WP_CONTENT_URL : null, |
| 150 | 179 | 'plugindir' => defined('WP_PLUGIN_DIR') ? WP_PLUGIN_DIR : null, |
| 180 | + 'themedir' => get_stylesheet_directory(), | |
| 181 | + 'templatedir' => get_template_directory(), | |
| 151 | 182 | 'dbcharset' => defined('DB_CHARSET') ? DB_CHARSET : null, |
| 152 | 183 | 'disallow_file_edit' => defined('DISALLOW_FILE_EDIT'), |
| 153 | 184 | 'disallow_file_mods' => defined('DISALLOW_FILE_MODS'), |
| 154 | 185 | 'custom_users' => defined('CUSTOM_USER_TABLE') ? CUSTOM_USER_TABLE : null, |
| @@ -154,9 +185,11 @@ | ||
| 154 | 185 | 'custom_users' => defined('CUSTOM_USER_TABLE') ? CUSTOM_USER_TABLE : null, |
| 155 | 186 | 'custom_usermeta' => defined('CUSTOM_USERMETA_TABLE') ? CUSTOM_USERMETA_TABLE : null, |
| 156 | 187 | 'locale' => get_locale(), |
| 157 | 188 | 'wp_local_string' => $wp_local_package, |
| 158 | - 'charset_collate' => $db->getCharsetCollate() | |
| 189 | + 'charset_collate' => $db->getCharsetCollate(), | |
| 190 | + 'allowed_paths' => ini_get('open_basedir'), | |
| 191 | + 'path_seprator' => PATH_SEPARATOR | |
| 159 | 192 | ); |
| 160 | 193 | return $wp_info; |
| 161 | 194 | } |
| 162 | 195 | |
| @@ -195,8 +228,14 @@ | ||
| 195 | 228 | } |
| 196 | 229 | if (function_exists('openssl_public_decrypt')) { |
| 197 | 230 | $info['openssl_public_decrypt'] = "1"; |
| 198 | 231 | } |
| 232 | + if (function_exists('openssl_encrypt')) { | |
| 233 | + $info['openssl_encrypt'] = "1"; | |
| 234 | + } | |
| 235 | + if (function_exists('openssl_decrypt')) { | |
| 236 | + $info['openssl_decrypt'] = "1"; | |
| 237 | + } | |
| 199 | 238 | $info['sha1'] = "1"; |
| 200 | 239 | $info['apissl'] = "1"; |
| 201 | 240 | if (function_exists('base64_encode')) { |
| 202 | 241 | $info['b64encode'] = true; |
| @@ -243,9 +282,16 @@ | ||
| 243 | 282 | } |
| 244 | 283 | |
| 245 | 284 | public function getHostInfo() { |
| 246 | 285 | $host_info = $_SERVER; |
| 247 | - $host_info['PHP_SERVER_NAME'] = php_uname('\n'); | |
| 286 | + if (function_exists('php_uname')) { | |
| 287 | + $host_info['PHP_SERVER_NAME'] = php_uname(); | |
| 288 | + } | |
| 289 | + | |
| 290 | + if (isset($_SERVER['SERVER_ADDR']) && function_exists('gethostbyaddr')) { | |
| 291 | + $host_info['HOST_FROM_IP'] = gethostbyaddr(WPRHelper::getRawParam('SERVER', 'SERVER_ADDR')); | |
| 292 | + } | |
| 293 | + | |
| 248 | 294 | if (array_key_exists('IS_PRESSABLE', get_defined_constants())) { |
| 249 | 295 | $host_info['IS_PRESSABLE'] = true; |
| 250 | 296 | } |
| 251 | 297 | |
| @@ -256,14 +302,18 @@ | ||
| 256 | 302 | if (defined('WPE_APIKEY')) { |
| 257 | 303 | $host_info['WPE_APIKEY'] = WPE_APIKEY; |
| 258 | 304 | } |
| 259 | 305 | |
| 306 | + if (defined('IS_ATOMIC')) { | |
| 307 | + $host_info['IS_ATOMIC'] = IS_ATOMIC; | |
| 308 | + } | |
| 309 | + | |
| 260 | 310 | return $host_info; |
| 261 | 311 | } |
| 262 | 312 | |
| 263 | 313 | public function serverConfig() { |
| 264 | 314 | return array( |
| 265 | - 'software' => $_SERVER['SERVER_SOFTWARE'], | |
| 315 | + 'software' => WPRHelper::getRawParam('SERVER', 'SERVER_SOFTWARE'), | |
| 266 | 316 | 'sapi' => (function_exists('php_sapi_name')) ? php_sapi_name() : false, |
| 267 | 317 | 'has_apache_get_modules' => function_exists('apache_get_modules'), |
| 268 | 318 | 'posix_getuid' => (function_exists('posix_getuid')) ? posix_getuid() : null, |
| 269 | 319 | 'uid' => (function_exists('getmyuid')) ? getmyuid() : null, |
| @@ -361,8 +411,19 @@ | ||
| 361 | 411 | |
| 362 | 412 | return $result; |
| 363 | 413 | } |
| 364 | 414 | |
| 415 | + function getCoreHandler() { | |
| 416 | + global $wp_db_version, $wp_version; | |
| 417 | + | |
| 418 | + $result = $this->getTransient('update_core'); | |
| 419 | + $result['current_db_version'] = $this->settings->getOption('db_version'); | |
| 420 | + $result['latest_db_version'] = $wp_db_version; | |
| 421 | + $result['wp_version'] = $wp_version; | |
| 422 | + | |
| 423 | + return $result; | |
| 424 | + } | |
| 425 | + | |
| 365 | 426 | function getSiteInfo($args) { |
| 366 | 427 | $result = array(); |
| 367 | 428 | |
| 368 | 429 | if (array_key_exists('pre_refresh_get_options', $args)) { |
| @@ -383,9 +444,9 @@ | ||
| 383 | 444 | if (array_key_exists('themes', $args)) |
| 384 | 445 | $result['themes'] = $this->getThemesHandler($args['themes']); |
| 385 | 446 | |
| 386 | 447 | if (array_key_exists('core', $args)) |
| 387 | - $result['core'] = $this->getTransient('update_core'); | |
| 448 | + $result['core'] = $this->getCoreHandler(); | |
| 388 | 449 | |
| 389 | 450 | if (array_key_exists('sys', $args)) |
| 390 | 451 | $result['sys'] = $this->getSystemInfo(); |
| 391 | 452 | |
| @@ -445,8 +506,31 @@ | ||
| 445 | 506 | |
| 446 | 507 | return $result; |
| 447 | 508 | } |
| 448 | 509 | |
| 510 | + function getPluginFileData($plugin_file) { | |
| 511 | + $result = array(); | |
| 512 | + | |
| 513 | + if (!function_exists('get_plugin_data')) { | |
| 514 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 515 | + } | |
| 516 | + $plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_file); | |
| 517 | + if ($plugin_data && isset($plugin_data['Version'])) { | |
| 518 | + $result['version'] = $plugin_data['Version']; | |
| 519 | + } | |
| 520 | + | |
| 521 | + return $result; | |
| 522 | + } | |
| 523 | + | |
| 524 | + function fetchPluginApiData($slug, $action) { | |
| 525 | + $args = array('slug' => wp_unslash($slug)); | |
| 526 | + $args = (object) $args; | |
| 527 | + $args = apply_filters('plugins_api_args', $args, $action); | |
| 528 | + $data = apply_filters('plugins_api', false, $action, $args); | |
| 529 | + | |
| 530 | + return $data; | |
| 531 | + } | |
| 532 | + | |
| 449 | 533 | public function process($request) { |
| 450 | 534 | $db = $this->db; |
| 451 | 535 | $params = $request->params; |
| 452 | 536 | switch ($request->method) { |
| @@ -465,9 +549,9 @@ | ||
| 465 | 549 | case "gtsts": |
| 466 | 550 | $resp = $this->getStats(); |
| 467 | 551 | break; |
| 468 | 552 | case "gtdbvariables": |
| 469 | - $variable = (array_key_exists('variable', $params)) ? $variable : ""; | |
| 553 | + $variable = (array_key_exists('variable', $params)) ? $params['variable'] : ""; | |
| 470 | 554 | $resp = $this->db->showDbVariables($variable); |
| 471 | 555 | break; |
| 472 | 556 | case "gtplgs": |
| 473 | 557 | $resp = $this->getPlugins(); |
| @@ -502,16 +586,22 @@ | ||
| 502 | 586 | break; |
| 503 | 587 | case "gthost": |
| 504 | 588 | $resp = array('host_info' => $this->getHostInfo()); |
| 505 | 589 | break; |
| 590 | + case "gtplsinfo": | |
| 591 | + $resp = array("plugins_info" => array()); | |
| 592 | + $file_by_slug = $params["file_by_slug"]; | |
| 593 | + foreach ($params['slugs'] as $slug) { | |
| 594 | + $data = $this->fetchPluginApiData($slug, $params['action']); | |
| 595 | + if (is_object($data) && !property_exists($data, 'version') && isset($file_by_slug[$slug])) { | |
| 596 | + $plugin_data = $this->getPluginFileData($file_by_slug[$slug]); | |
| 597 | + $data->version = $plugin_data['version']; | |
| 598 | + } | |
| 599 | + $resp['plugins_info'][$slug] = $data; | |
| 600 | + } | |
| 601 | + break; | |
| 506 | 602 | case "gtplinfo": |
| 507 | - $args = array( | |
| 508 | - 'slug' => wp_unslash($params['slug']) | |
| 509 | - ); | |
| 510 | - $action = $params['action']; | |
| 511 | - $args = (object) $args; | |
| 512 | - $args = apply_filters('plugins_api_args', $args, $action); | |
| 513 | - $data = apply_filters('plugins_api', false, $action, $args); | |
| 603 | + $data = $this->fetchPluginApiData($params['slug'], $params['action']); | |
| 514 | 604 | $resp = array("plugins_info" => $data); |
| 515 | 605 | break; |
| 516 | 606 | case "gtpostactinfo": |
| 517 | 607 | $resp = $this->getPostActivateInfo($params); |