'id_user' => $_SESSION['user']['id'], 'id_like' => $group['gid'], ); dibi::query('INSERT IGNORE INTO [user_like]', $arr); } catch (DibiException $exception) { echo get_class($exception), ': ', $exception->getMessage(); $error = true; } dibi::rollback(); } /* * Parse pages */ $pages = json_decode(Content::getUrl("https://api.facebook.com/method/pages.getinfo?fields=name%2Ccompany_overview%2Cdescription&access_token=".$_SESSION['access_token']."&format=json"), true); foreach ($pages as $page){ //echo $page['page_id'], " : ", $page['name'], " : ", $page['description'], "<br>"; $pDescription = strtolower(strip_tags($page['description'])); $pDescription = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', ' ', $pDescription); /* * Parse words from page name */ $words_tmp = preg_split('/([\s\-_,:;?!\'=\/\(\)\[\]@{}<>\r\n"]|(?<!\d)\.(?!\d))/', $page['name'], null, PREG_SPLIT_NO_EMPTY); foreach ($words_tmp as $word){ $word = $text->prepareWord($word); if (is_numeric($word)) continue; if (strlen($word)<=2) continue; if ($sWords->isStopWord($word)) continue; $words[] = $word;
public function getUrlFromURL($url) { // Get canonical URL from URL $content = new Content(); $content->loadFromUrl($url, false, false); if ($content->getUrl() != $url) { return "#"; } $rootdir = str_replace(dirname(__DIR__ . "/../../nutmouse.php"), "", $_SERVER['DOCUMENT_ROOT']); return "/" . $rootdir . $content->getUrl(); }
public function getFbResult($word){ $result = array(); $content = json_decode(Content::getUrl("https://graph.facebook.com/search?q=".$word."&type=page&limit=200"), true); foreach ($content['data'] as $item) { $item = TextPreparation::prepareWord($item['name']); $result[] = TextPreparation::sentence2Words($item); } return $result; }
public function analyzeUrl() { // Check if URL is set in general if (is_null($this->url)) { throw new Exception("No request URL set!"); return; } // Check for rewrtite rules $rewrite = new Rewrite($this->url); $rewrite->applyRules(); if ($rewrite->getTargetUrl() != $this->url) { if (!$rewrite->transportQueryParameter()) { $_GET = array(); $_POST = array(); } if ($rewrite->isRedirect()) { $this->redirectToUrl($rewrite->getTargetUrl(), $_POST); } $this->setUrl($rewrite->getTargetUrl()); $this->analyzeRequest(!$rewrite->isLastForward()); } // Check access rights to requested content $access = new AccessOfficer("content", $this->content_id, $this->session->getUser(), $this->content_parents); if (!$access->check()) { // Access denied if (!$access->getDeniedContentID()) { // No content to be shown as 403 page set // TODO set up default 403 (and 404) templates throw new Exception("Access denied and no denied content defined!"); return; } // Should parameters be transported through the redirects / rewrites if (!$access->transportQueryParameter()) { $_GET = array(); $_POST = array(); } // Show 403 error page or redirect if neccessary $newcontent = new Content($access->getDeniedContentID()); if ($access->isRedirect() && $newcontent->getID() != $this->content_id) { // Redirect, but keep requested URL as origin parameter // TODO: keep origin request parameters as well! $this->redirectToUrl("/" . $newcontent->getUrl() . "?origin=" . $this->url, $_POST); } $this->setUrl($newcontent->getUrl()); $this->analyzeRequest(!$access->isLastForward()); } // TODO: HookPoints to manipulate this behaviour }
/** * フルURLを取得する * * @param $url * @param bool $useSubDomain */ public function getUrl($url, $full = false, $useSubDomain = false) { return $this->_Content->getUrl($url, $full, $useSubDomain); }
public static function getLikes($token){ return Content::getUrl("https://graph.facebook.com/me/likes?access_token=".$token); }