1
0
Fork 0
forked from blallo/rss-bridge

Warn when accessing a private page.

This commit is contained in:
Teromene 2017-06-15 11:51:11 +01:00
parent 18c6f0126f
commit 9c78362fd7

View file

@ -80,6 +80,11 @@ class FB2Bridge extends BridgeAbstract {
if($pageID === null){ if($pageID === null){
echo <<<EOD echo <<<EOD
Unable to get the page id. You should consider getting the ID by hand, then importing it into FB2Bridge Unable to get the page id. You should consider getting the ID by hand, then importing it into FB2Bridge
EOD;
die();
} elseif($pageID == -1) {
echo <<<EOD
This page is not accessible without being logged in.
EOD; EOD;
die(); die();
} }
@ -97,18 +102,18 @@ EOD;
$html = $this->buildContent($fileContent); $html = $this->buildContent($fileContent);
$author = $this->getInput('u'); $author = $this->getInput('u');
foreach($html->find("article") as $content){ foreach($html->find("article") as $content){
$item = array(); $item = array();
$item['uri'] = "http://touch.facebook.com" $item['uri'] = "http://touch.facebook.com"
. $content->find("div[class='_52jc _5qc4 _24u0 _36xo']", 0)->find("a", 0)->getAttribute("href"); . $content->find("div[class='_52jc _5qc4 _24u0 _36xo']", 0)->find("a", 0)->getAttribute("href");
if($content->find("header", 0) !== null) { if($content->find("header", 0) !== null) {
$content->find("header", 0)->innertext = ""; $content->find("header", 0)->innertext = "";
} }
if($content->find("footer", 0) !== null) { if($content->find("footer", 0) !== null) {
$content->find("footer", 0)->innertext = ""; $content->find("footer", 0)->innertext = "";
} }
@ -242,6 +247,10 @@ EOD;
$pageContent = file_get_contents($page, 0, $context); $pageContent = file_get_contents($page, 0, $context);
if(strpos($pageContent, "signup-button") != false) {
return -1;
}
//Get the page ID if we don't have a captcha //Get the page ID if we don't have a captcha
$regex = "/page_id=([0-9]*)&/"; $regex = "/page_id=([0-9]*)&/";
preg_match($regex, $pageContent, $matches); preg_match($regex, $pageContent, $matches);