'sanitize_search_string')); $page = str_replace('.html', '.md', get_request_var('page')); $fgc_contextoption = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true, 'timeout' => 2, 'ignore_errors' => true ) ); if (read_config_option('local_documentation') != 'on') { $fgc_context = stream_context_create($fgc_contextoption); $contents = @file_get_contents('https://docs.cacti.net/' . $page, false, $fgc_context); $response_code = http_response_code(); } else { $contents = ''; $response_code = 200; } if ($response_code != 200) { print json_encode( array( 'status' => 'Not Reachable', 'message' => __('The Document page \'%s\' count not be reached. The Cacti Documentation site is not reachable. The http error was \'%s\'. Consider downloading an official release to obtain the latest documentation and hosting the documentation locally.', $page, $response_code) ) ); } elseif ($contents != '' && !preg_match('/does not appear to exist/i', $contents)) { print json_encode( array( 'status' => 'Success', 'location' => 'https://docs.cacti.net/' . $page ) ); } elseif ($contents != '' && preg_match('/does not appear to exist/i', $contents)) { print json_encode( array( 'status' => 'Not Found', 'location' => __esc('The Help File %s was not located on the Cacti Documentation Website.', $page) . '

' . __esc('Open a ticket at ') . '' . __esc('Cacti GitHub Site') . '.' ) ); } elseif (file_exists($config['base_path'] . '/docs/' . $page)) { print json_encode( array( 'status' => 'Success', 'location' => $config['url_path'] . '/docs/' . $page ) ); } else { print json_encode( array( 'status' => 'Not Reachable', 'message' => __('The Document page \'%s\' count not be reached locally.', $page, $response_code) ) ); } }