function matchUrls($content) { if (!session_is_registered("owsproxyUrls")) { $_SESSION["owsproxyUrls"] = array(); $_SESSION["owsproxyUrls"]["id"] = array(); $_SESSION["owsproxyUrls"]["url"] = array(); } $pattern = "/[\"|\\'](https*:\\/\\/[^\"|^\\']*)[\"|\\']/"; preg_match_all($pattern, $content, $matches); for ($i = 0; $i < count($matches[1]); $i++) { $req = $matches[1][$i]; $notice = new mb_notice("owsproxy found URL " . $i . ": " . $req); #$notice = new mb_notice("owsproxy id:".$req); $id = registerURL($req); $extReq = setExternalRequest($id); $notice = new mb_notice("MD5 URL " . $id . " - external link: " . $extReq); $content = str_replace($req, $extReq, $content); } return $content; }
$case = 'findURL'; } elseif ($_REQUEST['Did'] != '' && in_array('newUrl', array_keys($_REQUEST))) { $case = 'updateURL'; } else { echo 's3rl.php is a function to retrieve the url of a specific Did. For documentation and usage please refer to <a href="http://s3db.org/">s3db.org</a>'; } $url = $_REQUEST['url']; $publicKey = urldecode($_REQUEST['publicKey']); $Did = $_REQUEST['s3rl'] != '' ? $_REQUEST['s3rl'] : $_REQUEST['Did']; $newUrl = $_REQUEST['newUrl']; $message = $_REQUEST['message']; $name = $_REQUEST['name']; $_REQUEST['description'] = is_base64_encoded($_REQUEST['description']) ? base64_decode($_REQUEST['description']) : $_REQUEST['description']; $description = $_REQUEST['description']; $format = $_REQUEST['format']; list($regValid, $msg) = registerURL(compact('url', 'publicKey', 'Did', 's3rl', 'newUrl', 'case', 'message', 'name', 'format')); if ($regValid) { $Did = $msg['deployment_id']; $finName = $msg['name']; if ($case == 'registernewURL') { echo formatReturn('0', 'URL registered', $_REQUEST['format'], array('deployment_id' => $Did, 'name' => $finName)); } elseif ($case == 'findURL') { $cols = array_keys($regs[1]); $data[0] = $regs[1]; $format = $_REQUEST['format'] == '' ? 'html' : $_REQUEST['format']; $z = compact('data', 'cols', 'format'); echo outputFormat($z); } elseif ($case == 'updateURL') { echo formatReturn($GLOBALS['error_codes']['success'], $msg, $format, array('newUrl' => $newUrl)); } exit;