aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2016-09-08 09:52:35 +0200
committerMario Vavti <mario@mariovavti.com>2016-09-08 09:52:35 +0200
commit35f1055739f133cdeda290aa3a45992f97bb32fa (patch)
tree188798d75af9eedaa7884cb4522ada748eb3f4a7 /include
parent98d5ae91f5a716d415fa3dd639e9819ae7003202 (diff)
parent83b89b9576655c11a9beaaf2261b3a9013a52da5 (diff)
downloadvolse-hubzilla-35f1055739f133cdeda290aa3a45992f97bb32fa.tar.gz
volse-hubzilla-35f1055739f133cdeda290aa3a45992f97bb32fa.tar.bz2
volse-hubzilla-35f1055739f133cdeda290aa3a45992f97bb32fa.zip
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev
Diffstat (limited to 'include')
-rw-r--r--include/attach.php48
-rw-r--r--include/zot.php16
2 files changed, 59 insertions, 5 deletions
diff --git a/include/attach.php b/include/attach.php
index 137d2b11c..237b06217 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -2165,3 +2165,51 @@ function attach_move($channel_id,$resource_id,$new_folder_hash) {
}
+function attach_folder_select_list($channel_id) {
+
+ $r = q("select * from attach where is_dir = 1 and uid = %d",
+ intval($channel_id)
+ );
+
+ $out = [];
+ $out[''] = '/';
+
+ if($r) {
+ foreach($r as $rv) {
+ $x = attach_folder_rpaths($r,$rv);
+ if($x)
+ $out[$x[0]] = $x[1];
+ }
+ }
+ return $out;
+}
+
+function attach_folder_rpaths($all_folders,$that_folder) {
+
+ $path = '/' . $that_folder['filename'];
+ $current_hash = $that_folder['hash'];
+ $parent_hash = $that_folder['folder'];
+ $error = false;
+ $found = false;
+
+ if($parent_hash) {
+ do {
+ foreach($all_folders as $selected) {
+ if(! $selected['is_dir'])
+ continue;
+ if($selected['hash'] == $parent_hash) {
+ $path = '/' . $selected['filename'] . $path;
+ $current_hash = $selected['hash'];
+ $parent_hash = $selected['folder'];
+ $found = true;
+ break;
+ }
+ }
+ if(! $found)
+ $error = true;
+ }
+ while((! $found) && (! $error) && ($parent_hash != ''));
+ }
+ return (($error) ? false : [ $current_hash , $path ]);
+
+} \ No newline at end of file
diff --git a/include/zot.php b/include/zot.php
index 6187e8a61..7093a255b 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -2844,6 +2844,7 @@ function import_site($arr, $pubkey) {
$site_location = htmlspecialchars($arr['location'],ENT_COMPAT,'UTF-8',false);
$site_realm = htmlspecialchars($arr['realm'],ENT_COMPAT,'UTF-8',false);
$site_project = htmlspecialchars($arr['project'],ENT_COMPAT,'UTF-8',false);
+ $site_version = ((array_key_exists('version',$arr)) ? htmlspecialchars($arr['version'],ENT_COMPAT,'UTF-8',false) : '');
// You can have one and only one primary directory per realm.
// Downgrade any others claiming to be primary. As they have
@@ -2863,14 +2864,16 @@ function import_site($arr, $pubkey) {
|| ($siterecord['site_location'] != $site_location)
|| ($siterecord['site_register'] != $register_policy)
|| ($siterecord['site_project'] != $site_project)
- || ($siterecord['site_realm'] != $site_realm)) {
+ || ($siterecord['site_realm'] != $site_realm)
+ || ($siterecord['site_version'] != $site_version) ) {
+
$update = true;
// logger('import_site: input: ' . print_r($arr,true));
// logger('import_site: stored: ' . print_r($siterecord,true));
- $r = q("update site set site_dead = 0, site_location = '%s', site_flags = %d, site_access = %d, site_directory = '%s', site_register = %d, site_update = '%s', site_sellpage = '%s', site_realm = '%s', site_type = %d, site_project = '%s'
+ $r = q("update site set site_dead = 0, site_location = '%s', site_flags = %d, site_access = %d, site_directory = '%s', site_register = %d, site_update = '%s', site_sellpage = '%s', site_realm = '%s', site_type = %d, site_project = '%s', site_version = '%s'
where site_url = '%s'",
dbesc($site_location),
intval($site_directory),
@@ -2882,6 +2885,7 @@ function import_site($arr, $pubkey) {
dbesc($site_realm),
intval(SITE_TYPE_ZOT),
dbesc($site_project),
+ dbesc($site_version),
dbesc($url)
);
if(! $r) {
@@ -2899,8 +2903,8 @@ function import_site($arr, $pubkey) {
else {
$update = true;
- $r = q("insert into site ( site_location, site_url, site_access, site_flags, site_update, site_directory, site_register, site_sellpage, site_realm, site_type, site_project )
- values ( '%s', '%s', %d, %d, '%s', '%s', %d, '%s', '%s', %d, '%s' )",
+ $r = q("insert into site ( site_location, site_url, site_access, site_flags, site_update, site_directory, site_register, site_sellpage, site_realm, site_type, site_project, site_version )
+ values ( '%s', '%s', %d, %d, '%s', '%s', %d, '%s', '%s', %d, '%s', '%s' )",
dbesc($site_location),
dbesc($url),
intval($access_policy),
@@ -2911,7 +2915,8 @@ function import_site($arr, $pubkey) {
dbesc($sellpage),
dbesc($site_realm),
intval(SITE_TYPE_ZOT),
- dbesc($site_project)
+ dbesc($site_project),
+ dbesc($site_version)
);
if(! $r) {
logger('import_site: record create failed. ' . print_r($arr,true));
@@ -3978,6 +3983,7 @@ function zotinfo($arr) {
$ret['site']['location'] = get_config('system','site_location');
$ret['site']['realm'] = get_directory_realm();
$ret['site']['project'] = Zotlabs\Lib\System::get_platform_name() . ' ' . Zotlabs\Lib\System::get_server_role();
+ $ret['site']['version'] = Zotlabs\Lib\System::get_project_version();
}