From d48cd0f9a3210c14bb98a502188358982261d9df Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 30 Apr 2012 23:07:52 -0700 Subject: hidden plugins (add .hidden file to dir) --- include/gprobe.php | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 include/gprobe.php (limited to 'include/gprobe.php') diff --git a/include/gprobe.php b/include/gprobe.php new file mode 100644 index 000000000..26254ad28 --- /dev/null +++ b/include/gprobe.php @@ -0,0 +1,60 @@ +set_baseurl(get_config('system','url')); + + load_hooks(); + + if($argc != 2) + return; + + $url = hex2bin($argv[1]); + + $r = q("select * from gcontact where nurl = '%s' limit 1", + dbesc(normalise_link($url)) + ); + + if(count($r)) + return; + + $arr = probe_url($url); + + if(count($arr) && x($arr,'network') && $arr['network'] === NETWORK_DFRN) { + q("insert into `gcontact` (`name`,`url`,`nurl`,`photo`) + values ( '%s', '%s', '%s', '%s') ", + dbesc($arr['name']), + dbesc($arr['url']), + dbesc(normalise_link($arr['url'])), + dbesc($arr['photo']) + ); + } + + return; +} + +if (array_search(__file__,get_included_files())===0){ + gprobe_run($argv,$argc); + killme(); +} -- cgit v1.2.3 From 0ca4fa78c84fb474bf5b86008c4c1ba7b1aa103f Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 1 May 2012 01:34:47 -0700 Subject: link socgraph to zrls --- include/gprobe.php | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'include/gprobe.php') diff --git a/include/gprobe.php b/include/gprobe.php index 26254ad28..fdf786ca8 100644 --- a/include/gprobe.php +++ b/include/gprobe.php @@ -36,21 +36,25 @@ function gprobe_run($argv, $argc){ dbesc(normalise_link($url)) ); - if(count($r)) - return; - - $arr = probe_url($url); + if(! count($r)) { - if(count($arr) && x($arr,'network') && $arr['network'] === NETWORK_DFRN) { - q("insert into `gcontact` (`name`,`url`,`nurl`,`photo`) - values ( '%s', '%s', '%s', '%s') ", - dbesc($arr['name']), - dbesc($arr['url']), - dbesc(normalise_link($arr['url'])), - dbesc($arr['photo']) + $arr = probe_url($url); + if(count($arr) && x($arr,'network') && $arr['network'] === NETWORK_DFRN) { + q("insert into `gcontact` (`name`,`url`,`nurl`,`photo`) + values ( '%s', '%s', '%s', '%s') ", + dbesc($arr['name']), + dbesc($arr['url']), + dbesc(normalise_link($arr['url'])), + dbesc($arr['photo']) + ); + } + $r = q("select * from gcontact where nurl = '%s' limit 1", + dbesc(normalise_link($url)) ); } - + if(count($r)) + poco_load(0,0,$r[0]['id'], str_replace('/profile/','/poco/',$r[0]['url'])); + return; } -- cgit v1.2.3 From 72dbc2faeef26c6cdc749ce8403ebbd77b9b896f Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 1 May 2012 20:11:35 -0700 Subject: fn not found --- include/gprobe.php | 1 + 1 file changed, 1 insertion(+) (limited to 'include/gprobe.php') diff --git a/include/gprobe.php b/include/gprobe.php index fdf786ca8..5ca42729a 100644 --- a/include/gprobe.php +++ b/include/gprobe.php @@ -2,6 +2,7 @@ require_once("boot.php"); require_once('include/Scrape.php'); +require_once('include/socgraph.php'); function gprobe_run($argv, $argc){ global $a, $db; -- cgit v1.2.3 From dd273283900409da66ecc4e9ae5a188d5c2db605 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 1 May 2012 23:15:39 -0700 Subject: perform basic validation --- include/gprobe.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/gprobe.php') diff --git a/include/gprobe.php b/include/gprobe.php index 5ca42729a..b4edbe4db 100644 --- a/include/gprobe.php +++ b/include/gprobe.php @@ -33,6 +33,9 @@ function gprobe_run($argv, $argc){ $url = hex2bin($argv[1]); + if(! validate_url($url)) + return; + $r = q("select * from gcontact where nurl = '%s' limit 1", dbesc(normalise_link($url)) ); -- cgit v1.2.3 From 1b1f56f55625f26d7bc2a5079d385d1c319e2d9a Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 1 May 2012 23:16:58 -0700 Subject: only validate once --- include/gprobe.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'include/gprobe.php') diff --git a/include/gprobe.php b/include/gprobe.php index b4edbe4db..5ca42729a 100644 --- a/include/gprobe.php +++ b/include/gprobe.php @@ -33,9 +33,6 @@ function gprobe_run($argv, $argc){ $url = hex2bin($argv[1]); - if(! validate_url($url)) - return; - $r = q("select * from gcontact where nurl = '%s' limit 1", dbesc(normalise_link($url)) ); -- cgit v1.2.3