From 68e2c868bb65bfdf1f1ae35c3acb5e1a9fcdeccd Mon Sep 17 00:00:00 2001
From: "Bill St. Clair"
Date: Sun, 27 Jan 2008 07:44:55 -0500
Subject: [PATCH] Add Logout
---
LoomClient.php | 19 +++++++++++++------
ip.php | 30 +++++++++++++++++++++++-------
2 files changed, 36 insertions(+), 13 deletions(-)
diff --git a/LoomClient.php b/LoomClient.php
index 031ebf8..6925c25 100644
--- a/LoomClient.php
+++ b/LoomClient.php
@@ -370,13 +370,20 @@ class LoomClient
// I'll wait for Patrick to make a KV-returning version,
// instead of attempting to parse the returned HTML
function renameFolderLocation($session, $oldname, $newname) {
- $res = $this->rawget(array('function' => 'folder_locations',
- 'session' => $session,
- 'old_name' => $oldname,
- 'new_name' => $newname,
- 'save' => 'Save'),
+ return $this->rawget(array('function' => 'folder_locations',
+ 'session' => $session,
+ 'old_name' => $oldname,
+ 'new_name' => $newname,
+ 'save' => 'Save'),
+ $url);
+ }
+
+ // Logout from Loom, destroying the old session
+ function logout($session) {
+ return $this->rawget(array('function' => 'folder',
+ 'logout' => '1',
+ 'session' => $session),
$url);
- return $res;
}
function parsekv($kv, $recursive=FALSE) {
diff --git a/ip.php b/ip.php
index 1517a27..c47c3de 100644
--- a/ip.php
+++ b/ip.php
@@ -90,6 +90,7 @@ $title = "Loom Folder";
if ($page == 'main') doMain();
elseif ($page == 'locations') doLocations();
+elseif ($page == 'logout') doLogout();
drawHead();
@@ -195,6 +196,16 @@ function makeCiphers() {
}
}
+function doLogout() {
+ global $page, $folderkv, $valueskv;
+ global $client, $session;
+
+ $page = 'login';
+ $folderkv = '';
+ $valueskv = '';
+ $client->logout($session);
+}
+
function drawHead() {
global $title, $onload;
?>
@@ -313,7 +324,8 @@ function drawTail() {
function drawLogin() {
?>
-Welcome to Loom for iPhone. Note that in order to use this
+
Welcome to
+Loom for iPhone. Note that in order to use this
confidently, you must trust that the PHP scripts at billstclair.com do
not steal your passphrase. I promise that unless somebody hacks my
site, the code running is what you can download from
@@ -332,9 +344,11 @@ me.
Because my SSL certificate is from
-CAcert.org, a free certificate authority (CA), you'll see a warning message on your iPhone when you come here: "The certificate for this website is invalid..." Click the "Continue" button to go ahead. Your regular browser should allow you to easily add the CA certificate to eliminate warnings, but the iPhone browser does not.
+CAcert.org, a free certificate authority (CA), you'll see a warning message on your iPhone when you come here: "The certificate for this website is invalid..." Click the "Continue" button to go ahead. Your regular browser should allow you to easily add the CA certificate to eliminate warnings, but the iPhone browser does not.
-One way to use this, without giving me the keys to your kingdom, is to create a separate "Mobile" folder in Loom. Transfer assets that you think you might need on the road to a drop-point shared between your main folder and the "Mobile" folder, and only aim this page at the "Mobile" folder. You can always login to your main folder directly via loom.cc, if you need something there. The regular interface isn't as convenient as this one, but it works on the mobile browser.
+One way to use this, without giving me the keys to your kingdom, is to create a separate "Mobile" folder in Loom. Transfer assets that you think you might need on the road to a drop-point shared between your main folder and the "Mobile" folder, and only aim this page at the "Mobile" folder. You can always login to your main folder directly via
+
+loom.cc, if you need something there. The regular interface isn't as convenient as this one, but it works on the mobile browser.
}
@@ -400,8 +414,9 @@ function drawMain() {
Refresh
Locations
- |
+
+Logout
+
@@ -481,8 +496,9 @@ function drawLocations() {
Folder
Locations
- |
+
+Logout
+