public function termSearchByUrl(Request $request) { $url = $request['url']; $connection = getSiteName(getDomain($url)); $path_alias = getUri($url); if (empty($connection) || empty($path_alias)) { return AJAX::argumentError(); } $termModule = new TermModule($connection); $result = $termModule->getTermInfo(array('path_alias' => $path_alias)); if (count($result) > 0) { return AJAX::success(array('info' => $result)); } else { return AJAX::notExist(); } }
/** * Parse attachments * @return array Returns array with failed or success data * (See parser-common/src/Parser.php) for more info. */ public function parse() { $xml = simplexml_load_string($this->parsedMail->getMessageBody()); $timestamp = strtotime($xml->attributes()->date); foreach ($xml->list as $reports) { $this->feedName = (string) $reports->attributes()->type; // If feed is known and enabled, validate data and save report if ($this->isKnownFeed() && $this->isEnabledFeed()) { foreach ($reports->url_info as $url_info) { $url = (string) $url_info->attributes()->url; $ip = (string) $url_info->attributes()->ip; $urlData = getUrlData($url); if (filter_var($ip, FILTER_VALIDATE_IP) === false) { // No IP supplied by Google if (!empty($urlData['host']) && !filter_var($urlData['host'], FILTER_VALIDATE_IP) === false) { // Hostname is an IP address $ip = $urlData['host']; } else { // We have no IP address, try to get the IP address by resolving the domain $ip = @gethostbyname($urlData['host']); // If it fails, set to localhost $ip = $ip == $urlData['host'] ? '127.0.0.1' : $ip; } } $report = ['domain' => getDomain($url), 'uri' => getUri($url), 'category' => config("{$this->configBase}.feeds.{$this->feedName}.category")]; // Sanity check if ($this->hasRequiredFields($report) === true) { // incident has all requirements met, filter and add! $report = $this->applyFilters($report); $incident = new Incident(); $incident->source = config("{$this->configBase}.parser.name"); $incident->source_id = false; $incident->ip = $ip; $incident->domain = $report['domain']; $incident->class = config("{$this->configBase}.feeds.{$this->feedName}.class"); $incident->type = config("{$this->configBase}.feeds.{$this->feedName}.type"); $incident->timestamp = $timestamp; $incident->information = json_encode(array_merge($urlData, $report)); $this->incidents[] = $incident; } } } } return $this->success(); }
function deleteArticle($papi, $mid) { $papi->deleteDocument(getUri($mid)); }
function getUriSegment($n) { $segs = getUri(); return count($segs) > 0 && count($segs) >= $n - 1 ? $segs[$n] : ''; }
} if(count($_POST)) { $unhostedAccount = new UnhostedAccount(getUserAddress("user_address", $_POST), getString("pwd", $_POST)); $token = $unhostedAccount->addAPP(getDomain("scope", $_POST)); if($token) { header("Location:".getUri("redirect_uri", $_POST)."#access_token=".$token."&token_type=unhosted"); echo "redirecting you back to the application.\n"; } else { echo "Wrong password!"; } } else { $userAddress = getUserAddress('user_address', $_GET); $clientId = getDomain('client_id', $_GET); $dataScope = getDomain('scope', $_GET); $redirectUri = getUri('redirect_uri', $_GET); ?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <script src="/jQuery/jquery-1.6.1.min.js"></script> <script src="/css/html5.js"></script><!-- this is the javascript allowing html5 to run in older browsers --> <title>My Unhosted node</title> <link rel="stylesheet" href="/css/uncompressed/reset.css" /> <link rel="stylesheet" href="/css/uncompressed/text.css" /> <link rel="stylesheet" href="/css/general.css" /> <link rel="stylesheet" href="/css/uncompressed/login.css" /> </head>
/** * 网页授权 */ public function Oauth() { try { $this->user = cookie("weixin_user"); if (empty($this->user)) { $appid = $this->model_config->val("appid"); $code = I("get.code"); if (empty($code)) { $url = getUri(); $url = urlencode($url); $url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$appid}&redirect_uri={$url}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"; header("Location:" . $url); exit; } else { $this->access_token($appid, $code); } $this->user = $this->model_user->where("openid='{$this->openid}' and is_subscribe=1")->find(); if (!$this->user) { E("请关注我们"); } $this->user['score'] = D("Users")->where("openid='{$this->openid}'")->getField("score"); $this->user['uid'] = D("Users")->where("openid='{$this->openid}'")->getField("id"); } } catch (\Exception $e) { $this->layer_alert($e->getMessage()); } }
public static function extractClaims($ICschema, $nodeList) { //Returns the Uri attribute from an attribute list function getUri($attrList) { $uri = null; $end = false; $i = 0; do { if ($i > $attrList->length) { $end = true; } else { if (strcmp($attrList->item($i)->name, 'Uri') == 0) { $end = true; $uri = $attrList->item($i)->value; } else { $i++; } } } while (!$end); return $uri; } $requiredClaims = array(); $schema = $ICschema . "/claims/"; SimpleSAML_Logger::debug("schema: " . $schema); $pattern = '/\\//'; $replacement = '\\/'; $schema = '/' . preg_replace($pattern, $replacement, $schema) . '/'; for ($i = 0; $i < $nodeList->length; $i++) { $replacement = ''; $uri = getUri($nodeList->item($i)->attributes); $claim = preg_replace($schema, $replacement, $uri); $requiredClaims[$i] = $claim; SimpleSAML_Logger::debug("uri: " . $uri); SimpleSAML_Logger::debug("claim: " . $claim); } return $requiredClaims; }
/** function getHostelRegistrarUrl - ? * * @return $uri */ function getHostelRegistrarUrl() { global $wayfURL, $lang, $hostelRegistrarURL; $uri = $hostelRegistrarURL . "?"; foreach ($_GET as $key => $value) { $uri .= $key . "="; if ($key == "return") { $uri .= urlencode($wayfURL . getUri($lang) . "fromHostel=true"); } else { $uri .= urlencode($value) . "&"; } } return $uri; }
/** * Adds a source description to the current collection. * * @param SourceDescription $source * @param StateTransitionOption $option,... * * @throws GedcomxApplicationException * @return SourceDescriptionState|null */ public function addSourceDescription(SourceDescription $source, StateTransitionOption $option = null) { $link = $this->getLink(Rel::SOURCE_DESCRIPTIONS); if ($link == null || $link->getHref() == null) { throw new GedcomxApplicationException(sprintf("Collection at %s doesn't support adding source descriptions.", getUri())); } $entity = new Gedcomx(); $entity->addSourceDescription($source); $request = $this->createAuthenticatedGedcomxRequest('POST', $link->getHref(), [], null, $entity->toJson()); return $this->stateFactory->createState("SourceDescriptionState", $this->client, $request, $this->passOptionsTo('invoke', array($request), func_get_args()), $this->accessToken); }
<?php /* ********************************************************************* *\ MAIN SERVER \* ********************************************************************* */ //setup session session_start(); //setup database connection require 'dbConfig.php'; //setup global object $USER = new stdClass(); $PAGE = new stdClass(); //get path to a service $service = getRoute(getUri()); //set the debug flag $SERVERDEBUG = setDebug(); //exit with msg if path doesnt exist if ($service == false) { return errorHandler('Invalid Path', 501); } //if path was valid, load service require $service; //if debug, dump server response if ($SERVERDEBUG) { echo "\r\n page:"; echo json_encode($PAGE); return; } //at the end of it all, close db $DB->close(); /* ********************************************************************* *\
function path($uri) { // todo escape module, controller, action $module = $controller = $action = ''; $parts = explode('/', $uri); $parts_size = count($parts); if ($parts_size >= 1 && $parts[0] === $this->get('adminString')) { if ($parts_size >= 2) { $module = $parts[1]; } if ($parts_size >= 3) { $controller = $parts[2]; } if ($parts_size >= 4) { $action = $parts[3]; } } return [$module, $controller, $action]; $uriRemain = ''; if (strpos($uri, '?')) { $uri = substr($uri, 0, strpos($uri, '?')); } if (strpos($uri, '#')) { $uri = substr($uri, 0, strpos($uri, '#')); $uriRemain = substr($uri, strpos($uri, '#')); } // figure out the language, remove part from uri $lang = null; $langs = $this->get('langUris'); $urimap = $this->get('urimap'); // check aliases if ($urimap) { $urirec = $urimap->getByAlias($uri); if ($urirec) { $uri = $urirec . getUri(); $lang = $urirec . getLang(); } } if (!$lang) { $lang = $this->get('mainLang'); } $this->action = $this->getActionFromURL($this->uri); if ($this->action) { // frameworks own actions $this->page = $this->settings->getByData($this->params['uri'], $this->params['lang'], 'slug'); $this->pageFile = $this->params['uri']; } else { // check aliases // get page identified with an alias $this->page = $this->settings->getByData($this->uri, $this->lang, 'slug'); // page's unique name (a file in {$this->pageDir}/curr_lang dir) if (is_dir("{$this->pageDir}/{$this->lang}")) { $this->pageFile = discoverFiles("{$this->pageDir}/{$this->lang}", array($this->page->getKey()), true); } else { $this->pageFile = array(); } if (count($this->pageFile) > 0) { $this->pageFile = $this->pageFile[0]; } else { if (!is_dir($this->params['pageDir'])) { die("Put your pages in {$this->params['pageDir']} directory"); } // page's unique name (a file in {$this->pageDir} dir) $this->pageFile = discoverFiles($this->pageDir, array($this->page->getKey()), true); if (count($this->pageFile) > 0 && substr(basename($this->pageFile[0]), 0, 1) != '_') { // found in {$this->pageDir} dir, doesn't start with _ $this->pageFile = $this->pageFile[0]; } else { $this->page = $this->settings->get("site.notfound", $this->lang, 'notfound.html', 'admin'); $this->pageFile = discoverFiles($this->pageDir, array($this->page->getData()), true); if (count($this->pageFile) > 0) { $this->pageFile = $this->pageFile[0]; } else { die("Create dir {$this->pageDir} and the files\n index.html and notfound.html inside it."); } } } } // check language uris $this->params['langURIs'] = array(); if ($langURIs[0] != 'langsURI') { $i = 0; foreach ($langURIs as $l) { $this->langURIs[$this->params['langs'][$i]] = $l; $pos = strpos($this->params['uri'], '/' . $l . '/'); if ($pos === 0 || $this->params['uri'] === '/' . $l) { $this->params['lang'] = $this->params['langs'][$i]; $this->params['langURI'] = $l; $this->params['uri'] = substr($this->params['uri'], strlen($l) + 1); } $i++; } } // entrance uri from settings $defURI = $this->settings->get('site.defURI', '', 'index.html'); if (strpos($this->params['uri'], '/') === 0) { $this->params['uri'] = substr($this->params['uri'], 1); } if (!$this->params['uri']) { $this->params['uri'] = $defURI == 'site.defURI' ? 'index.html' : $defURI; } $this->params['uri'] = strval($this->params['uri']); }
Respuesta correcta: <select name="correcta"> <option value="1" '; if ($correcta == "1") { echo "selected"; } echo '>1</option> <option value="2" '; if ($correcta == "2") { echo "selected"; } echo '>2</option> <option value="3" '; if ($correcta == "3") { echo "selected"; } echo '>3</option> <option value="4" '; if ($correcta == "4") { echo "selected"; } echo '>4</option> </select> </p> <p> <input type="submit" name="guardar" value="GUARDAR"/> </p> </form>'; echo '<p><a href="' . preg_replace("/&preg=?\\d*/", "", getUri()) . '">CERRAR</a></p>'; echo "</div>"; echo "</div>"; }