From 0b2d85891e651bab2c3ddd0c7396d557a052dd18 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Tue, 19 Oct 2010 15:51:56 -0700 Subject: [PATCH] lrdd link on profile page (for salmon m/e), remove dfrn-template, qualify some contact lookups, some cleanup of app/boot --- boot.php | 22 +++++++++------------- mod/dfrn_request.php | 4 ++-- mod/profile.php | 7 ++++--- mod/pubsub.php | 1 + 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/boot.php b/boot.php index b3d116a..d347e60 100644 --- a/boot.php +++ b/boot.php @@ -122,15 +122,11 @@ class App { $this->page = array(); $this->pager= array(); - $this->scheme = ((isset($_SERVER['HTTPS']) - && ($_SERVER['HTTPS'])) ? 'https' : 'http' ); - $this->hostname = str_replace('www.','', - $_SERVER['SERVER_NAME']); - set_include_path("include/$this->hostname" - . PATH_SEPARATOR . 'include' - . PATH_SEPARATOR . '.' ); + $this->scheme = ((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'])) ? 'https' : 'http' ); + $this->hostname = $_SERVER['SERVER_NAME']; + set_include_path("include/$this->hostname" . PATH_SEPARATOR . 'include' . PATH_SEPARATOR . '.' ); - if(substr($_SERVER['QUERY_STRING'],0,2) == "q=") + if(substr($_SERVER['QUERY_STRING'],0,2) == "q=") $_SERVER['QUERY_STRING'] = substr($_SERVER['QUERY_STRING'],2); $this->cmd = trim($_GET['q'],'/'); @@ -157,9 +153,7 @@ class App { if(strlen($this->baseurl)) return $this->baseurl; - $this->baseurl = (($ssl) ? 'https' : $this->scheme) . "://" . $this->hostname - . ((isset($this->path) && strlen($this->path)) - ? '/' . $this->path : '' ); + $this->baseurl = (($ssl) ? 'https' : $this->scheme) . "://" . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' ); return $this->baseurl; } @@ -177,7 +171,7 @@ class App { } function set_path($p) { - $this->path = ltrim(trim($p),'/'); + $this->path = trim(trim($p),'/'); } function get_path() { @@ -1158,4 +1152,6 @@ function load_view_file($s) { if($lang && file_exists("$d/$lang/$b")) return file_get_contents("$d/$lang/$b"); return file_get_contents($s); -}} \ No newline at end of file +}} + + diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index 7a3060f..6e8171d 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -44,7 +44,7 @@ function dfrn_request_post(&$a) { if(x($dfrn_url)) { - $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' LIMIT 1", + $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `self` = 0 LIMIT 1", intval(local_user()), dbesc($dfrn_url) ); @@ -198,7 +198,7 @@ function dfrn_request_post(&$a) { if($network === 'dfrn') { - $ret = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' LIMIT 1", + $ret = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `self` = 0 LIMIT 1", intval($uid), dbesc($url) ); diff --git a/mod/profile.php b/mod/profile.php index 5576b49..8fa25cd 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -61,10 +61,11 @@ function profile_init(&$a) { $profile = $a->argv[1]; } profile_load($a,$which,$profile); - $a->page['htmlhead'] .= '' . "\r\n" ; - - $a->page['htmlhead'] .= '' . "\r\n" ; $a->page['htmlhead'] .= '' . "\r\n" ; + $a->page['htmlhead'] .= '' . "\r\n" ; + $uri = urlencode('acct:' . $a->user['nickname'] . '@' . $a->get_hostname() . (($a->path) ? '/' . $a->path : '')); + $a->page['htmlhead'] .= '' . "\r\n"; + $dfrn_pages = array('request', 'confirm', 'notify', 'poll'); diff --git a/mod/pubsub.php b/mod/pubsub.php index b47b2ee..1b69cc5 100644 --- a/mod/pubsub.php +++ b/mod/pubsub.php @@ -83,6 +83,7 @@ function pubsub_init(&$a) { } } +require_once('include/security.php'); function pubsub_post(&$a) {