Commit 270253a7 authored by François Billioud's avatar François Billioud

Remove storage server

parent 147ede8a
AuthType "Basic"
AuthName "nom"
AuthUserFile "http://localhost/dav/.htpasswd"
Header always set Access-Control-Allow-Methods "GET, POST, DELETE, OPTIONS, PUT"
Header always set Access-Control-Allow-Headers "Content-Type, X-Requested-With, X-HTTP-Method-Override, Accept, Authorization"
Header always set Access-Control-Allow-Credentials "true"
Header always set Access-Control-Allow-Origin "*"
CSQdhQSKD
QSDFSDKJGQ
SDFJGSKDJ
djflsjfdghsl </br>
sdfgmj
\ No newline at end of file
{"author":"test","title":"test","content":"<div align=\"center\">\u000a <h1>Test</h1>\u000a <h2 align=\"left\"><u style=\"color: #ff1f1f;\">Mon site HTML</u></h2>\u000a <h5 align=\"left\"><font face=\"wingdings\">C'est moche, mais ça marche !</font><br /></h5>\u000a </div>\u000a <div align=\"center\"> </div>","creation":"Mon, 06 Jun 2011 15:27:08 GMT","lastModif":"Tue, 07 Jun 2011 12:26:31 GMT"}
\ No newline at end of file
<?xml version='1.0' encoding='UTF-8'?>
<Document>
<Auth></Auth>
<LastMod></LastMod>
<Title></Title>
<Content>test</Content>
</Document>
/**
* Editors
*/
var Xinha = function() {
this.name = "Xinha";
this.load = function() {
_editor_url = "http://www.ungproject.com/xinha/";
getCurrentPage().include("xinha/XinhaCore.js","script");
getCurrentPage().include("xinha/config.js","script");
xinha_init();
}
this.saveEdition = function() {
var textArea = getCurrentPage().getHTML().getElementById("input_area");
getCurrentDocument().setContent(textArea.content);
//saveCurrentDocument(); : JIO function
}
this.loadContent = function() {
var textArea = getCurrentPage().getHTML().getElementById("input_area");
textArea.content = getCurrentDocument().getContent();
}
this.load();
}
/** /**
* Text documents * Text documents
...@@ -40,6 +16,7 @@ JSONTextDocument.prototype.saveEdition = function(content) { ...@@ -40,6 +16,7 @@ JSONTextDocument.prototype.saveEdition = function(content) {
this.setLastModification(currentTime()); this.setLastModification(currentTime());
setCurrentDocument(this); setCurrentDocument(this);
} }
JSONTextDocument.prototype.setAsCurrentDocument = function() { JSONTextDocument.prototype.setAsCurrentDocument = function() {
getCurrentPage().displayDocumentTitle(this); getCurrentPage().displayDocumentTitle(this);
getCurrentPage().displayDocumentState(this); getCurrentPage().displayDocumentState(this);
...@@ -53,10 +30,32 @@ getCurrentDocument = function() { ...@@ -53,10 +30,32 @@ getCurrentDocument = function() {
doc.__proto__ = JSONTextDocument.prototype; doc.__proto__ = JSONTextDocument.prototype;
return doc; return doc;
} }
new JSONTextDocument();//load the document (it's just for testing)
/**
* Editors
*/
var Xinha = function() {
this.name = "Xinha";
this.load = function() {
_editor_url = "http://www.ungproject.com/xinha/";
getCurrentPage().include("xinha/XinhaCore.js","script");
getCurrentPage().include("xinha/config.js","script");
xinha_init();
}
this.saveEdition = function() {
var textArea = getCurrentPage().getHTML().getElementById("input_area");
getCurrentDocument().setContent(textArea.content);
//saveCurrentDocument(); : JIO function
}
this.loadContent = function() {
var textArea = getCurrentPage().getHTML().getElementById("input_area");
textArea.content = getCurrentDocument().getContent();
}
this.load();
}
/* /*
// save // save
......
/* /*
* global variables * global variables
*/ */
...@@ -39,7 +40,7 @@ Page.prototype = { ...@@ -39,7 +40,7 @@ Page.prototype = {
type: "GET", type: "GET",
url: source, url: source,
dataType: "html", dataType: "html",
async: false, async: true,
success: function(data) { success: function(data) {
currentPage.setXML(data); currentPage.setXML(data);
} }
...@@ -93,7 +94,9 @@ Page.prototype = { ...@@ -93,7 +94,9 @@ Page.prototype = {
} }
this.getHTML().getElementById("available_languages").innerHTML = avLang; this.getHTML().getElementById("available_languages").innerHTML = avLang;
}, },
displayUserName: function(user) {this.getHTML().getElementById("userName").innerHTML = user.getName();}, displayUserName: function(user) {
//alert($(this.getHTML()).find("html").html());
this.getHTML().getElementById("user_name").innerHTML = user.getName();},
//document information //document information
displayAuthorName: function(doc) {this.getHTML().getElementById("author").innerHTML = doc.getAuthor();}, displayAuthorName: function(doc) {this.getHTML().getElementById("author").innerHTML = doc.getAuthor();},
...@@ -128,8 +131,6 @@ var User = function() { ...@@ -128,8 +131,6 @@ var User = function() {
this.language = "en"; this.language = "en";
this.storage = "http://www.unhosted-dav.com"; this.storage = "http://www.unhosted-dav.com";
this.identityProvider = "http://www.webfinger.com"; this.identityProvider = "http://www.webfinger.com";
this.setAsCurrentUser();
} }
User.prototype = { User.prototype = {
getName: function() {return this.name;}, getName: function() {return this.name;},
...@@ -147,7 +148,6 @@ User.prototype = { ...@@ -147,7 +148,6 @@ User.prototype = {
setAsCurrentUser: function() { setAsCurrentUser: function() {
getCurrentPage().displayUserName(this); getCurrentPage().displayUserName(this);
getCurrentPage().displayLanguages(this); getCurrentPage().displayLanguages(this);
setCurrentUser(this);
} }
} }
getCurrentUser = function() { getCurrentUser = function() {
...@@ -155,8 +155,11 @@ getCurrentUser = function() { ...@@ -155,8 +155,11 @@ getCurrentUser = function() {
user.__proto__ = User.prototype; user.__proto__ = User.prototype;
return user; return user;
} }
setCurrentUser = function(user) {localStorage.setItem("currentUser", JSON.stringify(user));} setCurrentUser = function(user) {
localStorage.setItem("currentUser", JSON.stringify(user));
user.setAsCurrentUser();
}
//setCurrentUser(new User());
/** /**
...@@ -172,8 +175,6 @@ var JSONDocument = function() { ...@@ -172,8 +175,6 @@ var JSONDocument = function() {
this.creation=currentTime(); this.creation=currentTime();
this.lastModification=currentTime(); this.lastModification=currentTime();
this.state=Document.states.draft; this.state=Document.states.draft;
this.setAsCurrentDocument();//temp
} }
JSONDocument.prototype = { JSONDocument.prototype = {
//type //type
...@@ -220,10 +221,7 @@ setCurrentDocument = function(doc) {localStorage.setItem("currentDocument",JSON. ...@@ -220,10 +221,7 @@ setCurrentDocument = function(doc) {localStorage.setItem("currentDocument",JSON.
/* /*
* tools * tools
*/ */
currentTime = function() {return (new Date()).toUTCString();}
cancel_sharing = function() {alert("cancel");} cancel_sharing = function() {alert("cancel");}
translate = function() {alert("translate");} translate = function() {alert("translate");}
submit = function() {alert("submit");} submit = function() {alert("submit");}
\ No newline at end of file
//test = new User();
\ No newline at end of file
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
<script type="text/javascript"></script> <script type="text/javascript"></script>
<script type="text/javascript" src="js/base64.js"></script> <script type="text/javascript" src="js/base64.js"></script>
<script type="text/javascript" src="js/tools.js"></script>
<script type="text/javascript" src="js/theme.js"></script> <script type="text/javascript" src="js/theme.js"></script>
<script type="text/javascript"> <script type="text/javascript">
...@@ -33,8 +34,10 @@ ...@@ -33,8 +34,10 @@
init = function() { init = function() {
setCurrentPage("editor"); setCurrentPage("editor");
new User(); new User();
doc = new document.JSONTextDocument();//load the document (it's just for testing)
//doc.setAsCurrentDocument();
} }
window.onload=init; $(document).ready(init);
</script> </script>
</head> </head>
......
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
This the unhosted hive for $protocol://$domain. Please contact superman@$domain for more info about your unhosted account.
</body>
</html>
Options MultiViews
<?php
require_once('../../unhosted/unhosted.php');
function getString($paramName) {
if(!isset($_POST[$paramName])) {
die("Parameter $paramName not specified");
}
return $_POST[$paramName];
}
function getDomain($paramName) {
$domain = getString($paramName);
if(!preg_match('|^[a-z0-9-]+(\.[a-z0-9-]+)*$|i', $domain)) {
die("Parameter $paramName should be a valid domain");
}
return $domain;
}
function getUserAddress($paramName) {
$userAddress = getString($paramName);
if(!preg_match('|^[a-z0-9-]+(\.[a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$|i', $userAddress)) {
die("Parameter $paramName is '$userAddress' but should be a valid user address");
}
return $userAddress;
}
if(count($_POST)) {
$unhostedAccount = new UnhostedAccount(getUserAddress("user_address"), getString("pwd"));
$token = $unhostedAccount->addAPP(getDomain("scope"));
if($token) {
header("Location:".$_POST["redirect_uri"]."?token=".$token);
echo "redirecting you back to the application.\n";
} else {
echo "Wrong password!";
}
} else {
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script src="/html5.js"></script><!-- this is the javascript allowing html5 to run in older browsers -->
<title>My Unhosted node</title>
<link rel="stylesheet" href="/css/uncompressed/reset.css" />
<link rel="stylesheet" href="/css/uncompressed/text.css" />
<link rel="stylesheet" href="/general.css" />
<link rel="stylesheet" href="/css/uncompressed/login.css" />
</head>
<header>
<h1><strong><?php echo UnhostedSettings::domain ?> </strong>Unhosted storage node</h1>
</header>
<body>
<div class="content">
<h2>The app '<?=$_GET["client_id"] ?>' wants to read and write the <?=$_GET["scope"]?> data in your unhosted account</h2>
<form method="post" action="">
<label>User address:</label><span class="username"><?=$_GET["user_address"]?></span>
<label for="password">Password:</label>
<div id="passAllow">
<form method="POST" action="?">
<input type="password" name="pwd" value="" />
<input type="submit" name="submit" value="Allow" />
<input type="hidden" value="<?=$_GET["user_address"]?>" name="user_address">
<input type="hidden" value="<?=$_GET["scope"]?>" name="scope">
<input type="hidden" value="<?=$_GET["redirect_uri"]?>" name="redirect_uri">
</form>
</div>
</form>
</div>
</body>
</html>
<?
}
?>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment