* Status: Unsupported */ function uhremotestorage_install() { register_hook('personal_xrd', 'addon/uhremotestorage/uhremotestorage.php', 'uhremotestorage_personal_xrd'); register_hook('plugin_settings', 'addon/uhremotestorage/uhremotestorage.php', 'uhremotestorage_settings'); register_hook('plugin_settings_post', 'addon/uhremotestorage/uhremotestorage.php', 'uhremotestorage_settings_post'); logger("installed uhremotestorage"); } function uhremotestorage_uninstall() { unregister_hook('personal_xrd', 'addon/uhremotestorage/uhremotestorage.php', 'uhremotestorage_personal_xrd'); unregister_hook('plugin_settings', 'addon/uhremotestorage/uhremotestorage.php', 'uhremotestorage_settings'); unregister_hook('plugin_settings_post', 'addon/uhremotestorage/uhremotestorage.php', 'uhremotestorage_settings_post'); logger("removed uhremotestorage"); } 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']; $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", $b['xml'] ); } } function uhremotestorage_settings_post($a, $post){ if(! local_user()) return; 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){ if(! local_user()) return; $uid = $a->user['nickname'] ."@". $a->get_hostname(); $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 = get_markup_template("settings.tpl", "addon/uhremotestorage/"); $s .= replace_macros($tpl, array( '$title' => 'Unhosted remote storage', '$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('Save Settings'), )); }