X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=uhremotestorage%2Fuhremotestorage.php;h=a2a8cc3dd107cf4ccdc0ca2e6c5416b82e14eb0d;hb=f9c2e64c8f23a0c2cd74c8435d4f69ae1c723a14;hp=5c1820042b988a7a16c4a26944f2557285892a73;hpb=c3e8c695a8ed94641b7c438bca2047737dace09c;p=friendica-addons.git diff --git a/uhremotestorage/uhremotestorage.php b/uhremotestorage/uhremotestorage.php old mode 100644 new mode 100755 index 5c182004..a2a8cc3d --- a/uhremotestorage/uhremotestorage.php +++ b/uhremotestorage/uhremotestorage.php @@ -25,12 +25,19 @@ function uhremotestorage_uninstall() { } function uhremotestorage_personal_xrd($a, &$b){ + list($user, $host) = explode("@",$_GET['uri']); + $user = str_replace("acct:","",$user); + $r = q("SELECT uid FROM user WHERE nickname='%s'", dbesc($user)); + $uid = $r[0]['uid']; - $davurl = get_pconfig($b['user']['uid'],'uhremotestorage','davurl'); - if ($davurl){ + $url = get_pconfig($uid,'uhremotestorage','unhoestedurl'); + $auth = get_pconfig($uid,'uhremotestorage','unhoestedauth'); + $api = get_pconfig($uid,'uhremotestorage','unhoestedapi'); + + if ($url){ $b['xml'] = str_replace( '', - "\t".''."\n", + "\t".''."\n", $b['xml'] ); } @@ -39,7 +46,9 @@ function uhremotestorage_personal_xrd($a, &$b){ function uhremotestorage_settings_post($a, $post){ if(! local_user()) return; - set_pconfig(local_user(),'uhremotestorage','davurl',$_POST['unhoestedurl']); + set_pconfig(local_user(),'uhremotestorage','unhoestedurl',$_POST['unhoestedurl']); + set_pconfig(local_user(),'uhremotestorage','unhoestedauth',$_POST['unhoestedauth']); + set_pconfig(local_user(),'uhremotestorage','unhoestedapi',$_POST['unhoestedapi']); } function uhremotestorage_settings($a, &$s){ @@ -48,13 +57,35 @@ function uhremotestorage_settings($a, &$s){ $uid = $a->user['nickname'] ."@". $a->get_hostname(); - $davurl = get_pconfig(local_user(),'uhremotestorage','davurl'); + $url = get_pconfig(local_user(),'uhremotestorage','unhoestedurl'); + $auth = get_pconfig(local_user(),'uhremotestorage','unhoestedauth'); + $api = get_pconfig(local_user(),'uhremotestorage','unhoestedapi'); + + $arr_api = array( + 'WebDAV' => "WebDAV", + 'simple' => "simple WebDAV", + 'CouchDB' => "CouchDB", + ); + /* experimental apis */ + /* + $api = array_merge($api, array( + 'git' => "git", + 'tahoe-lafs' => 'tahoe-lafs', + 'camlistore' => 'camlistore', + 'AmazonS3' => 'AmazonS3', + 'GoogleDocs' => 'GoogleDocs', + 'Dropbox' => 'Dropbox', + ); + */ $tpl = file_get_contents(dirname(__file__)."/settings.tpl"); $s .= replace_macros($tpl, array( '$title' => 'Unhosted remote storage', - '$desc' => sprintf( t('Allow to use your friendika id (%s) to connecto to external unhosted-enabled storage (like ownCloud)'), $uid ), - '$url' => array( 'unhoestedurl', t('Unhosted DAV storage url'), $davurl, 'If your are using ownCloud, your unhosted url will be like http://HOST/apps/remoteStorage/compat.php/USER/remoteStorage/'), + '$desc' => sprintf( t('Allow to use your friendica id (%s) to connecto to external unhosted-enabled storage (like ownCloud). See RemoteStorage WebFinger'), $uid ), + '$url' => array( 'unhoestedurl', t('Template URL (with {category})'), $url, 'If your are using ownCloud, your unhosted url will be like http://HOST/apps/remoteStorage/WebDAV.php/USER/remoteStorage/{category}'), + '$auth' => array( 'unhoestedauth', t('OAuth end-point'), $auth, 'If your are using ownCloud, your OAuth endpoint will be like http://HOST/apps/remoteStorage/auth.php/USER'), + '$api' => array( 'unhoestedapi', t('Api'), $api, 'If your are using ownCloud, your api will be WebDAV', $arr_api), + '$submit' => t('Submit'), ));