aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-01-03 01:44:25 -0800
committerfriendica <info@friendica.com>2014-01-03 01:44:25 -0800
commit475b24ca9e758b257bde6f81c727178ae8b64bec (patch)
tree127d1e97b72dd41d79e3605b920934f25664efb5
parentd2d071029f38942496aa52e42048ae53c5d04d48 (diff)
downloadvolse-hubzilla-475b24ca9e758b257bde6f81c727178ae8b64bec.tar.gz
volse-hubzilla-475b24ca9e758b257bde6f81c727178ae8b64bec.tar.bz2
volse-hubzilla-475b24ca9e758b257bde6f81c727178ae8b64bec.zip
more dav work
-rw-r--r--include/reddav.php79
-rwxr-xr-xindex.php2
-rw-r--r--mod/cloud.php2
-rw-r--r--util/messages.po172
-rw-r--r--version.inc2
5 files changed, 170 insertions, 87 deletions
diff --git a/include/reddav.php b/include/reddav.php
index 97903edb2..79c68a000 100644
--- a/include/reddav.php
+++ b/include/reddav.php
@@ -3,6 +3,8 @@
use Sabre\DAV;
require_once('vendor/autoload.php');
+require_once('include/attach.php');
+
class RedInode implements DAV\INode {
private $attach;
@@ -149,15 +151,56 @@ class RedDirectory extends DAV\Node implements DAV\ICollection {
function createFile($name,$data = null) {
+ logger('RedDirectory::createFile : ' . $name);
+ logger('RedDirectory::createFile : ' . print_r($this,true));
+
+ logger('createFile():' . stream_get_contents($data));
+
+
if(! perm_is_allowed($this->auth->channel_id,$this->auth->observer,'write_storage')) {
+ logger('createFile: permission denied');
throw new DAV\Exception\Forbidden('Permission denied.');
return;
}
+ $mimetype = z_mime_content_type($name);
+
+
+ $c = q("select * from channel where channel_id = %d limit 1",
+ intval($this->auth->channel_id)
+ );
+
+
+ $filesize = 0;
+ $hash = random_string();
+dbg(1);
+
+ $r = q("INSERT INTO attach ( aid, uid, hash, filename, filetype, filesize, revision, data, created, edited )
+ VALUES ( %d, %d, '%s', '%s', '%s', %d, %d, '%s', '%s', '%s' ) ",
+ intval($c[0]['channel_account_id']),
+ intval($c[0]['channel_id']),
+ dbesc($hash),
+ dbesc($name),
+ dbesc($mimetype),
+ intval($filesize),
+ intval(0),
+ dbesc(stream_get_contents($data)),
+ dbesc(datetime_convert()),
+ dbesc(datetime_convert())
+ );
+
+ $r = q("update attach set filesize = length(data) where hash = '%s' and uid = %d limit 1",
+ dbesc($hash),
+ intval($c[0]['channel_id'])
+ );
+
+dbg(0);
+
}
+
function createDirectory($name) {
if(! perm_is_allowed($this->auth->channel_id,$this->auth->observer,'write_storage')) {
throw new DAV\Exception\Forbidden('Permission denied.');
@@ -166,6 +209,12 @@ class RedDirectory extends DAV\Node implements DAV\ICollection {
+
+
+
+
+
+
}
@@ -174,10 +223,11 @@ class RedDirectory extends DAV\Node implements DAV\ICollection {
logger('RedDirectory::childExists : ' . print_r($this->auth,true));
if($this->red_path === '/' && $name === 'cloud') {
+ logger('RedDirectory::childExists /cloud: true');
return true;
}
- $x = RedFileData($this->ext_path . '/' . $name, $this->auth);
+ $x = RedFileData($this->ext_path . '/' . $name, $this->auth,true);
logger('RedFileData returns: ' . print_r($x,true));
if($x)
return true;
@@ -232,11 +282,20 @@ class RedFile extends DAV\Node implements DAV\IFile {
function put($data) {
logger('RedFile::put: ' . basename($this->name));
+ logger('put():' . stream_get_contents($data));
+
+dbg(1);
$r = q("update attach set data = '%s' where hash = '%s' and uid = %d limit 1",
- dbesc($data),
+ dbesc(stream_get_contents($data)),
dbesc($this->data['hash']),
intval($this->data['uid'])
);
+ $r = q("update attach set filesize = length(data) where hash = '%s' and uid = %d limit 1",
+ dbesc($this->data['hash']),
+ intval($this->data['uid'])
+ );
+dbg(0);
+
}
@@ -376,7 +435,7 @@ logger('dbg2: ' . print_r($r,true));
}
-function RedFileData($file, &$auth) {
+function RedFileData($file, &$auth,$test = false) {
logger('RedFileData:' . $file);
@@ -463,15 +522,19 @@ dbg(0);
}
if($errors) {
+ if($test)
+ return false;
throw new DAV\Exception\Forbidden('Permission denied.');
return;
}
- if($r[0]['flags'] & ATTACH_FLAG_DIR)
- return new RedDirectory('/cloud' . $path . '/' . $r[0]['filename'],$auth);
- else
- return new RedFile('/cloud' . $path . '/' . $r[0]['filename'],$r[0],$auth);
-
+ if($r) {
+ if($r[0]['flags'] & ATTACH_FLAG_DIR)
+ return new RedDirectory('/cloud' . $path . '/' . $r[0]['filename'],$auth);
+ else
+ return new RedFile('/cloud' . $path . '/' . $r[0]['filename'],$r[0],$auth);
+ }
+ return false;
}
diff --git a/index.php b/index.php
index adfa6534f..640a2b6a1 100755
--- a/index.php
+++ b/index.php
@@ -62,8 +62,6 @@ else {
}
-
-
/**
*
* Important stuff we always need to do.
diff --git a/mod/cloud.php b/mod/cloud.php
index 3880c1fd5..106379785 100644
--- a/mod/cloud.php
+++ b/mod/cloud.php
@@ -81,7 +81,7 @@ class RedBasicAuth extends Sabre\DAV\Auth\Backend\AbstractBasic {
logger('(DAV) RedBasicAuth: password verified for ' . $username);
$this->channel_name = $r[0]['channel_address'];
$this->channel_id = $r[0]['channel_id'];
- $this->channel_hash = $r[0]['channel_hash'];
+ $this->channel_hash = $this->observer = $r[0]['channel_hash'];
return true;
}
}
diff --git a/util/messages.po b/util/messages.po
index a309e9e82..d603ef3c4 100644
--- a/util/messages.po
+++ b/util/messages.po
@@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: 2013-12-27.539\n"
+"Project-Id-Version: 2014-01-03.546\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-12-27 00:04-0800\n"
+"POT-Creation-Date: 2014-01-03 00:02-0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -803,7 +803,7 @@ msgstr ""
msgid "Stored post could not be verified."
msgstr ""
-#: ../../include/photo/photo_driver.php:609 ../../include/photos.php:51
+#: ../../include/photo/photo_driver.php:637 ../../include/photos.php:51
#: ../../mod/photos.php:91 ../../mod/photos.php:767 ../../mod/photos.php:789
#: ../../mod/profile_photo.php:78 ../../mod/profile_photo.php:225
#: ../../mod/profile_photo.php:336
@@ -1111,9 +1111,9 @@ msgid "Select"
msgstr ""
#: ../../include/conversation.php:632 ../../include/ItemObject.php:107
-#: ../../mod/connedit.php:356 ../../mod/admin.php:693 ../../mod/group.php:176
-#: ../../mod/photos.php:1132 ../../mod/filestorage.php:82
-#: ../../mod/settings.php:570
+#: ../../mod/thing.php:230 ../../mod/connedit.php:356 ../../mod/admin.php:693
+#: ../../mod/group.php:176 ../../mod/photos.php:1132
+#: ../../mod/filestorage.php:82 ../../mod/settings.php:570
msgid "Delete"
msgstr ""
@@ -1516,7 +1516,8 @@ msgstr ""
#: ../../include/attach.php:251 ../../include/attach.php:272
#: ../../include/attach.php:464 ../../include/attach.php:539
#: ../../include/items.php:3437 ../../mod/common.php:35
-#: ../../mod/events.php:140 ../../mod/invite.php:13 ../../mod/invite.php:104
+#: ../../mod/events.php:140 ../../mod/thing.php:241 ../../mod/thing.php:257
+#: ../../mod/thing.php:291 ../../mod/invite.php:13 ../../mod/invite.php:104
#: ../../mod/connedit.php:179 ../../mod/webpages.php:40 ../../mod/api.php:26
#: ../../mod/api.php:31 ../../mod/page.php:30 ../../mod/page.php:80
#: ../../mod/setup.php:200 ../../mod/viewconnections.php:22
@@ -1534,10 +1535,10 @@ msgstr ""
#: ../../mod/editwebpage.php:83 ../../mod/notifications.php:66
#: ../../mod/blocks.php:29 ../../mod/blocks.php:44 ../../mod/editpost.php:13
#: ../../mod/poke.php:128 ../../mod/channel.php:86 ../../mod/fsuggest.php:78
-#: ../../mod/editblock.php:48 ../../mod/item.php:181 ../../mod/item.php:189
-#: ../../mod/suggest.php:26 ../../mod/message.php:16 ../../mod/register.php:68
-#: ../../mod/regmod.php:18 ../../mod/authtest.php:13 ../../mod/mood.php:114
-#: ../../index.php:178 ../../index.php:346
+#: ../../mod/editblock.php:48 ../../mod/suggest.php:26
+#: ../../mod/message.php:16 ../../mod/register.php:68 ../../mod/regmod.php:18
+#: ../../mod/authtest.php:13 ../../mod/item.php:181 ../../mod/item.php:189
+#: ../../mod/mood.php:114 ../../index.php:176 ../../index.php:344
msgid "Permission denied."
msgstr ""
@@ -2240,10 +2241,11 @@ msgid "New Page"
msgstr ""
#: ../../include/page_widgets.php:8 ../../include/ItemObject.php:95
-#: ../../mod/webpages.php:118 ../../mod/menu.php:55 ../../mod/layouts.php:102
-#: ../../mod/settings.php:569 ../../mod/editlayout.php:100
-#: ../../mod/editwebpage.php:143 ../../mod/blocks.php:93
-#: ../../mod/editpost.php:97 ../../mod/editblock.php:114
+#: ../../mod/thing.php:229 ../../mod/webpages.php:118 ../../mod/menu.php:55
+#: ../../mod/layouts.php:102 ../../mod/settings.php:569
+#: ../../mod/editlayout.php:100 ../../mod/editwebpage.php:143
+#: ../../mod/blocks.php:93 ../../mod/editpost.php:97
+#: ../../mod/editblock.php:114
msgid "Edit"
msgstr ""
@@ -2679,7 +2681,7 @@ msgstr ""
msgid "Default"
msgstr ""
-#: ../../include/identity.php:29 ../../mod/item.php:1152
+#: ../../include/identity.php:29 ../../mod/item.php:1162
msgid "Unable to obtain identity information from database"
msgstr ""
@@ -2727,7 +2729,7 @@ msgstr ""
msgid "Requested profile is not available."
msgstr ""
-#: ../../include/identity.php:639 ../../mod/profiles.php:613
+#: ../../include/identity.php:639 ../../mod/profiles.php:615
msgid "Change profile photo"
msgstr ""
@@ -2739,7 +2741,7 @@ msgstr ""
msgid "Manage/edit profiles"
msgstr ""
-#: ../../include/identity.php:646 ../../mod/profiles.php:614
+#: ../../include/identity.php:646 ../../mod/profiles.php:616
msgid "Create New Profile"
msgstr ""
@@ -2747,15 +2749,15 @@ msgstr ""
msgid "Edit Profile"
msgstr ""
-#: ../../include/identity.php:660 ../../mod/profiles.php:625
+#: ../../include/identity.php:660 ../../mod/profiles.php:627
msgid "Profile Image"
msgstr ""
-#: ../../include/identity.php:663 ../../mod/profiles.php:628
+#: ../../include/identity.php:663 ../../mod/profiles.php:630
msgid "visible to everybody"
msgstr ""
-#: ../../include/identity.php:664 ../../mod/profiles.php:629
+#: ../../include/identity.php:664 ../../mod/profiles.php:631
msgid "Edit visibility"
msgstr ""
@@ -2808,7 +2810,7 @@ msgstr ""
msgid "Events this week:"
msgstr ""
-#: ../../include/identity.php:893 ../../include/identity.php:1004
+#: ../../include/identity.php:893 ../../include/identity.php:975
#: ../../mod/profperm.php:103
msgid "Profile"
msgstr ""
@@ -2989,12 +2991,12 @@ msgid "This is you"
msgstr ""
#: ../../include/ItemObject.php:531 ../../mod/events.php:470
-#: ../../mod/thing.php:190 ../../mod/invite.php:156 ../../mod/connedit.php:434
-#: ../../mod/setup.php:302 ../../mod/setup.php:345 ../../mod/connect.php:92
-#: ../../mod/sources.php:97 ../../mod/sources.php:131 ../../mod/admin.php:420
-#: ../../mod/admin.php:686 ../../mod/admin.php:826 ../../mod/admin.php:1025
-#: ../../mod/admin.php:1112 ../../mod/group.php:81 ../../mod/photos.php:677
-#: ../../mod/photos.php:782 ../../mod/photos.php:1042
+#: ../../mod/thing.php:276 ../../mod/thing.php:318 ../../mod/invite.php:156
+#: ../../mod/connedit.php:434 ../../mod/setup.php:302 ../../mod/setup.php:345
+#: ../../mod/connect.php:92 ../../mod/sources.php:97 ../../mod/sources.php:131
+#: ../../mod/admin.php:420 ../../mod/admin.php:686 ../../mod/admin.php:826
+#: ../../mod/admin.php:1025 ../../mod/admin.php:1112 ../../mod/group.php:81
+#: ../../mod/photos.php:677 ../../mod/photos.php:782 ../../mod/photos.php:1042
#: ../../mod/photos.php:1082 ../../mod/photos.php:1169
#: ../../mod/profiles.php:518 ../../mod/import.php:387
#: ../../mod/settings.php:507 ../../mod/settings.php:619
@@ -3060,11 +3062,11 @@ msgid ""
msgstr ""
#: ../../include/items.php:201 ../../mod/like.php:55 ../../mod/group.php:68
-#: ../../mod/profperm.php:19 ../../index.php:345
+#: ../../mod/profperm.php:19 ../../index.php:343
msgid "Permission denied"
msgstr ""
-#: ../../include/items.php:3375 ../../mod/admin.php:150
+#: ../../include/items.php:3375 ../../mod/thing.php:74 ../../mod/admin.php:150
#: ../../mod/admin.php:730 ../../mod/admin.php:933 ../../mod/viewsrc.php:18
#: ../../mod/home.php:63 ../../mod/display.php:32
msgid "Item not found."
@@ -3173,45 +3175,57 @@ msgstr ""
msgid "Share this event"
msgstr ""
-#: ../../mod/thing.php:109
+#: ../../mod/thing.php:94
+msgid "Thing updated"
+msgstr ""
+
+#: ../../mod/thing.php:153
msgid "Object store: failed"
msgstr ""
-#: ../../mod/thing.php:113
-msgid "thing/stuff added"
+#: ../../mod/thing.php:157
+msgid "Thing added"
msgstr ""
-#: ../../mod/thing.php:129
+#: ../../mod/thing.php:175
#, php-format
msgid "OBJ: %1$s %2$s %3$s"
msgstr ""
-#: ../../mod/thing.php:175
-msgid "not yet implemented."
+#: ../../mod/thing.php:228
+msgid "Show Thing"
msgstr ""
-#: ../../mod/thing.php:181
-msgid "Add Stuff to your Profile"
+#: ../../mod/thing.php:235
+msgid "item not found."
msgstr ""
-#: ../../mod/thing.php:183
+#: ../../mod/thing.php:263
+msgid "Edit Thing"
+msgstr ""
+
+#: ../../mod/thing.php:265 ../../mod/thing.php:311
msgid "Select a profile"
msgstr ""
-#: ../../mod/thing.php:185
+#: ../../mod/thing.php:267 ../../mod/thing.php:313
msgid "Select a category of stuff. e.g. I ______ something"
msgstr ""
-#: ../../mod/thing.php:187
-msgid "Name of thing or stuff e.g. something"
+#: ../../mod/thing.php:270 ../../mod/thing.php:315
+msgid "Name of thing e.g. something"
+msgstr ""
+
+#: ../../mod/thing.php:272 ../../mod/thing.php:316
+msgid "URL of thing (optional)"
msgstr ""
-#: ../../mod/thing.php:188
-msgid "URL of thing or stuff (optional)"
+#: ../../mod/thing.php:274 ../../mod/thing.php:317
+msgid "URL for photo of thing (optional)"
msgstr ""
-#: ../../mod/thing.php:189
-msgid "URL for photo of thing or stuff (optional)"
+#: ../../mod/thing.php:309
+msgid "Add Thing to your Profile"
msgstr ""
#: ../../mod/invite.php:25
@@ -3666,7 +3680,7 @@ msgid "Channel not found."
msgstr ""
#: ../../mod/page.php:83 ../../mod/help.php:71 ../../mod/display.php:100
-#: ../../index.php:229
+#: ../../index.php:227
msgid "Page not found."
msgstr ""
@@ -5239,7 +5253,7 @@ msgstr ""
msgid "Help:"
msgstr ""
-#: ../../mod/help.php:68 ../../index.php:226
+#: ../../mod/help.php:68 ../../index.php:224
msgid "Not Found"
msgstr ""
@@ -5550,6 +5564,14 @@ msgstr ""
msgid "Edit/Manage Profiles"
msgstr ""
+#: ../../mod/profiles.php:613
+msgid "Add profile things"
+msgstr ""
+
+#: ../../mod/profiles.php:614
+msgid "Include desirable objects in your profile"
+msgstr ""
+
#: ../../mod/new_channel.php:107
msgid "Add a Channel"
msgstr ""
@@ -6418,7 +6440,7 @@ msgstr ""
msgid "Make this post private"
msgstr ""
-#: ../../mod/wall_upload.php:41 ../../mod/item.php:1078
+#: ../../mod/wall_upload.php:41 ../../mod/item.php:1088
msgid "Wall Photos"
msgstr ""
@@ -6491,32 +6513,6 @@ msgstr ""
msgid "All Contacts (with secure profile access)"
msgstr ""
-#: ../../mod/item.php:144
-msgid "Unable to locate original post."
-msgstr ""
-
-#: ../../mod/item.php:342
-msgid "Empty post discarded."
-msgstr ""
-
-#: ../../mod/item.php:384
-msgid "Executable content type not permitted to this channel."
-msgstr ""
-
-#: ../../mod/item.php:794
-msgid "System error. Post not saved."
-msgstr ""
-
-#: ../../mod/item.php:1157
-#, php-format
-msgid "You have reached your limit of %1$.0f top level posts."
-msgstr ""
-
-#: ../../mod/item.php:1163
-#, php-format
-msgid "You have reached your limit of %1$.0f webpages."
-msgstr ""
-
#: ../../mod/siteinfo.php:57
#, php-format
msgid "Version %s"
@@ -6709,6 +6705,32 @@ msgstr ""
msgid "Remove My Account"
msgstr ""
+#: ../../mod/item.php:144
+msgid "Unable to locate original post."
+msgstr ""
+
+#: ../../mod/item.php:342
+msgid "Empty post discarded."
+msgstr ""
+
+#: ../../mod/item.php:384
+msgid "Executable content type not permitted to this channel."
+msgstr ""
+
+#: ../../mod/item.php:806
+msgid "System error. Post not saved."
+msgstr ""
+
+#: ../../mod/item.php:1167
+#, php-format
+msgid "You have reached your limit of %1$.0f top level posts."
+msgstr ""
+
+#: ../../mod/item.php:1173
+#, php-format
+msgid "You have reached your limit of %1$.0f webpages."
+msgstr ""
+
#: ../../mod/mood.php:133
msgid "Mood"
msgstr ""
diff --git a/version.inc b/version.inc
index 1ccd4beb1..7312c7541 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2014-01-02.545
+2014-01-03.546