revised openid patch, added fix for Windows servers, make "is now friends with" commentable, fix settings form hook to be inside form
This commit is contained in:
parent
68868fd74b
commit
c55cb45855
7 changed files with 27 additions and 41 deletions
6
boot.php
6
boot.php
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
|
||||||
define ( 'BUILD_ID', 1028 );
|
define ( 'BUILD_ID', 1029 );
|
||||||
define ( 'DFRN_PROTOCOL_VERSION', '2.0' );
|
define ( 'DFRN_PROTOCOL_VERSION', '2.0' );
|
||||||
|
|
||||||
define ( 'EOL', "<br />\r\n" );
|
define ( 'EOL', "<br />\r\n" );
|
||||||
|
@ -211,14 +211,14 @@ class App {
|
||||||
if((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'],0,2) === "q=")
|
if((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'],0,2) === "q=")
|
||||||
$this->query_string = substr($_SERVER['QUERY_STRING'],2);
|
$this->query_string = substr($_SERVER['QUERY_STRING'],2);
|
||||||
if(x($_GET,'q'))
|
if(x($_GET,'q'))
|
||||||
$this->cmd = trim($_GET['q'],'/');
|
$this->cmd = trim($_GET['q'],'/\\');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Figure out if we are running at the top of a domain
|
* Figure out if we are running at the top of a domain
|
||||||
* or in a sub-directory and adjust accordingly
|
* or in a sub-directory and adjust accordingly
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$path = trim(dirname($_SERVER['SCRIPT_NAME']),'/');
|
$path = trim(dirname($_SERVER['SCRIPT_NAME']),'/\\');
|
||||||
if(isset($path) && strlen($path) && ($path != $this->path))
|
if(isset($path) && strlen($path) && ($path != $this->path))
|
||||||
$this->path = $path;
|
$this->path = $path;
|
||||||
|
|
||||||
|
|
|
@ -432,6 +432,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
||||||
$arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $contact['url'] . '" />' . "\n");
|
$arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $contact['url'] . '" />' . "\n");
|
||||||
$arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $contact['thumb'] . '" />' . "\n");
|
$arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $contact['thumb'] . '" />' . "\n");
|
||||||
$arr['object'] .= '</link></object>' . "\n";
|
$arr['object'] .= '</link></object>' . "\n";
|
||||||
|
$arr['last-child'] = 1;
|
||||||
|
|
||||||
$i = item_store($arr);
|
$i = item_store($arr);
|
||||||
|
|
||||||
|
|
|
@ -18,38 +18,19 @@ function profile_init(&$a) {
|
||||||
|
|
||||||
profile_load($a,$which,$profile);
|
profile_load($a,$which,$profile);
|
||||||
|
|
||||||
if (!get_config('system','no_openid') && $a->profile['openid']!=""){
|
if(x($a->profile,'openidserver'))
|
||||||
if (!isset($a->profile['openidserver'])){
|
|
||||||
logger('friendika user table must be updated. `openidserver` field is missing');
|
|
||||||
} else {
|
|
||||||
if ($a->profile['openidserver']==''){
|
|
||||||
require_once('library/openid.php');
|
|
||||||
$openid = new LightOpenID;
|
|
||||||
$openid->identity = $a->profile['openid'];
|
|
||||||
$a->profile['openidserver'] = $openid->discover($openid->identity);
|
|
||||||
|
|
||||||
q("UPDATE `user` SET `openidserver` = '%s' WHERE `uid` = %d LIMIT 1",
|
|
||||||
dbesc($a->profile['openidserver']),
|
|
||||||
intval($a->profile['uid'])
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$a->page['htmlhead'] .= '<link rel="openid.server" href="' . $a->profile['openidserver'] . '" />' . "\r\n";
|
$a->page['htmlhead'] .= '<link rel="openid.server" href="' . $a->profile['openidserver'] . '" />' . "\r\n";
|
||||||
$a->page['htmlhead'] .= '<link rel="openid.delegate" href="'.$a->profile['openid'].'" />'. "\r\n";
|
if(x($a->profile,'openid')) {
|
||||||
|
$delegate = ((strstr($a->profile['openid'],'://')) ? $a->profile['openid'] : 'http://' . $a->profile['openid']);
|
||||||
|
$a->page['htmlhead'] .= '<link rel="openid.delegate" href="' . $delegate . '" />' . "\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . (($a->profile['net-publish']) ? 'true' : 'false') . '" />' . "\r\n" ;
|
$a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . (($a->profile['net-publish']) ? 'true' : 'false') . '" />' . "\r\n" ;
|
||||||
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/dfrn_poll/' . $which .'" />' . "\r\n" ;
|
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/dfrn_poll/' . $which .'" />' . "\r\n" ;
|
||||||
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . (($a->path) ? '/' . $a->path : ''));
|
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . (($a->path) ? '/' . $a->path : ''));
|
||||||
$a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . $a->get_baseurl() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
|
$a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . $a->get_baseurl() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
|
||||||
header('Link: <' . $a->get_baseurl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
|
header('Link: <' . $a->get_baseurl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
|
||||||
|
|
||||||
|
|
||||||
$dfrn_pages = array('request', 'confirm', 'notify', 'poll');
|
$dfrn_pages = array('request', 'confirm', 'notify', 'poll');
|
||||||
foreach($dfrn_pages as $dfrn)
|
foreach($dfrn_pages as $dfrn)
|
||||||
$a->page['htmlhead'] .= "<link rel=\"dfrn-{$dfrn}\" href=\"".$a->get_baseurl()."/dfrn_{$dfrn}/{$which}\" />\r\n";
|
$a->page['htmlhead'] .= "<link rel=\"dfrn-{$dfrn}\" href=\"".$a->get_baseurl()."/dfrn_{$dfrn}/{$which}\" />\r\n";
|
||||||
|
|
|
@ -109,12 +109,17 @@ function settings_post(&$a) {
|
||||||
$str_group_deny = perms2str($_POST['group_deny']);
|
$str_group_deny = perms2str($_POST['group_deny']);
|
||||||
$str_contact_deny = perms2str($_POST['contact_deny']);
|
$str_contact_deny = perms2str($_POST['contact_deny']);
|
||||||
|
|
||||||
$openidserver="";
|
$openidserver = $a->user['openidserver'];
|
||||||
if ($openid != $a->user['openid'] && isset($a->user['openidserver'])){
|
|
||||||
$openidserver = ", `openidserver` = ''";
|
if($openid != $a->user['openid']) {
|
||||||
|
logger('updating openidserver');
|
||||||
|
require_once('library/openid.php');
|
||||||
|
$open_id_obj = new LightOpenID;
|
||||||
|
$open_id_obj->identity = $openid;
|
||||||
|
$openidserver = $open_id_obj->discover($open_id_obj->identity);
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `theme` = '%s', `maxreq` = %d".$openidserver." WHERE `uid` = %d LIMIT 1",
|
$r = q("UPDATE `user` SET `username` = '%s', `email` = '%s', `openid` = '%s', `timezone` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `notify-flags` = %d, `page-flags` = %d, `default-location` = '%s', `allow_location` = %d, `theme` = '%s', `maxreq` = %d, `openidserver` = '%s' WHERE `uid` = %d LIMIT 1",
|
||||||
dbesc($username),
|
dbesc($username),
|
||||||
dbesc($email),
|
dbesc($email),
|
||||||
dbesc($openid),
|
dbesc($openid),
|
||||||
|
@ -129,6 +134,7 @@ function settings_post(&$a) {
|
||||||
intval($allow_location),
|
intval($allow_location),
|
||||||
dbesc($theme),
|
dbesc($theme),
|
||||||
intval($maxreq),
|
intval($maxreq),
|
||||||
|
dbesc($openidserver),
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
if($r)
|
if($r)
|
||||||
|
@ -306,7 +312,9 @@ function settings_content(&$a) {
|
||||||
'$pagetype' => $pagetype
|
'$pagetype' => $pagetype
|
||||||
));
|
));
|
||||||
|
|
||||||
call_hooks('settings_page',$o);
|
call_hooks('settings_form',$o);
|
||||||
|
|
||||||
|
$o .= '</form>' . "\r\n";
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
|
|
||||||
|
|
|
@ -270,3 +270,7 @@ function update_1027() {
|
||||||
) ENGINE = MYISAM DEFAULT CHARSET=utf8 ");
|
) ENGINE = MYISAM DEFAULT CHARSET=utf8 ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_1028() {
|
||||||
|
q("ALTER TABLE `user` ADD `openidserver` text NOT NULL AFTER `deny_gid` ");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,3 @@ $pagetype
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</form>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,3 @@ $pagetype
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</form>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue