aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xboot.php2
-rw-r--r--include/api.php26
-rw-r--r--include/attach.php6
-rw-r--r--install/update.php17
-rw-r--r--mod/ffsapi.php4
-rw-r--r--mod/settings.php5
-rw-r--r--version.inc2
-rw-r--r--view/css/mod_settings.css8
-rwxr-xr-xview/tpl/settings.tpl14
9 files changed, 58 insertions, 26 deletions
diff --git a/boot.php b/boot.php
index dafe20b83..1faeaf15a 100755
--- a/boot.php
+++ b/boot.php
@@ -50,7 +50,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'H');
define ( 'ZOT_REVISION', 1 );
-define ( 'DB_UPDATE_VERSION', 1158 );
+define ( 'DB_UPDATE_VERSION', 1159 );
/**
* @brief Constant with a HTML line break.
diff --git a/include/api.php b/include/api.php
index 3862ba7eb..b51bcc5f0 100644
--- a/include/api.php
+++ b/include/api.php
@@ -660,26 +660,30 @@ require_once('include/attach.php');
dbesc($_REQUEST['file_id'])
);
if($r) {
- if($r[0]['is_dir'])
- $r[0]['data'] = '';
+ $ptr = $r[0];
+ if($length === 0)
+ $length = intval($ptr['filesize']);
+
+ if($ptr['is_dir'])
+ $ptr['data'] = '';
elseif(! intval($r[0]['os_storage'])) {
- $r[0]['start'] = $start;
- $x = substr(dbunescbin($r[0]['data'],$start,$length));
- $r[0]['length'] = strlen($x);
- $r[0]['data'] = base64_encode($x);
+ $ptr['start'] = $start;
+ $x = substr(dbunescbin($ptr['data'],$start,$length));
+ $ptr['length'] = strlen($x);
+ $ptr['data'] = base64_encode($x);
}
else {
- $fp = fopen(dbunescbin($r[0]['data'],'r'));
+ $fp = fopen(dbunescbin($ptr['data']),'r');
if($fp) {
$seek = fseek($fp,$start,SEEK_SET);
$x = fread($fp,$length);
- $r[0]['start'] = $start;
- $r[0]['length'] = strlen($x);
- $r[0]['data'] = base64_encode($x);
+ $ptr['start'] = $start;
+ $ptr['length'] = strlen($x);
+ $ptr['data'] = base64_encode($x);
}
}
- $ret = array('attach' => $r[0]);
+ $ret = array('attach' => $ptr);
json_return_and_die($ret);
}
killme();
diff --git a/include/attach.php b/include/attach.php
index 1bba88c63..8a568d8e1 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -722,7 +722,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
intval($filesize),
intval(1),
intval($is_photo),
- dbesc($os_relpath),
+ dbesc($os_basepath . $os_relpath),
dbesc($created),
intval($existing_id),
intval($channel_id)
@@ -742,7 +742,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
intval($x[0]['revision'] + 1),
intval(1),
intval($is_photo),
- dbesc($os_relpath),
+ dbesc($os_basepath . $os_relpath),
dbesc($created),
dbesc($created),
dbesc($x[0]['allow_cid']),
@@ -783,7 +783,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
intval(0),
intval(1),
intval($is_photo),
- dbesc($os_relpath),
+ dbesc($os_basepath . $os_relpath),
dbesc($created),
dbesc($created),
dbesc(($arr && array_key_exists('allow_cid',$arr)) ? $arr['allow_cid'] : $str_contact_allow),
diff --git a/install/update.php b/install/update.php
index d6b543466..38e76afda 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1158 );
+define( 'UPDATE_VERSION' , 1159 );
/**
*
@@ -1917,3 +1917,18 @@ function update_r1157() {
}
+function update_r1158() {
+ $r = q("select attach.id, attach.data, channel_address from attach left join channel on attach.uid = channel_id where os_storage = 1 and not attach.data like '%%store%%' ");
+ if($r) {
+ foreach($r as $rr) {
+ $has_slash = ((substr($rr['data'],0,1) === '/') ? true : false);
+ q("update attach set data = '%s' where id = %d",
+ dbesc('store/' . $rr['channel_address']. (($has_slash) ? '' : '/' . $rr['data'])),
+ dbesc($rr['id'])
+ );
+ }
+ }
+ return UPDATE_SUCCESS;
+}
+
+
diff --git a/mod/ffsapi.php b/mod/ffsapi.php
index a75e60bcc..de47408bd 100644
--- a/mod/ffsapi.php
+++ b/mod/ffsapi.php
@@ -55,10 +55,10 @@ function activate(node) {
}
</script>
-<button onclick="activate(this)" title="activate the demo provider">$activate</button>
+<button onclick="activate(this)" title="activate the demo provider" class="btn btn-primary">$activate</button>
EOT;
return $s;
-} \ No newline at end of file
+}
diff --git a/mod/settings.php b/mod/settings.php
index 8bfff3765..18bfaeb08 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -1102,12 +1102,13 @@ function settings_content(&$a) {
'$expert' => feature_enabled(local_channel(),'expert'),
'$hint' => t('Please enable expert mode (in <a href="settings/features">Settings > Additional features</a>) to adjust!'),
'$lbl_misc' => t('Miscellaneous Settings'),
- '$photo_path' => array('photo_path', t('Default photo upload folder'), get_pconfig(local_channel(),'system','photo_path'), '%Y - current year, %m - current month'),
- '$attach_path' => array('attach_path', t('Default file upload folder'), get_pconfig(local_channel(),'system','attach_path'), '%Y - current year, %m - current month'),
+ '$photo_path' => array('photo_path', t('Default photo upload folder'), get_pconfig(local_channel(),'system','photo_path'), t('%Y - current year, %m - current month')),
+ '$attach_path' => array('attach_path', t('Default file upload folder'), get_pconfig(local_channel(),'system','attach_path'), t('%Y - current year, %m - current month')),
'$menus' => $menu,
'$menu_desc' => t('Personal menu to display in your channel pages'),
'$removeme' => t('Remove Channel'),
'$removechannel' => t('Remove this channel.'),
+ '$firefoxshare' => t('Firefox Share $Projectname provider'),
));
call_hooks('settings_form',$o);
diff --git a/version.inc b/version.inc
index d0eb99d9c..b1085e3d5 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2015-11-04.1206
+2015-11-05.1207
diff --git a/view/css/mod_settings.css b/view/css/mod_settings.css
index 7eff8e45b..e81d115d4 100644
--- a/view/css/mod_settings.css
+++ b/view/css/mod_settings.css
@@ -1,3 +1,11 @@
.group {
margin-left: 10px;
}
+
+.ffsapilink {
+ margin: 10px 0;
+}
+
+.channel-menu {
+ margin-top: 24px;
+}
diff --git a/view/tpl/settings.tpl b/view/tpl/settings.tpl
index ab62ede45..7c1f4578d 100755
--- a/view/tpl/settings.tpl
+++ b/view/tpl/settings.tpl
@@ -136,7 +136,7 @@
</div>
</div>
</div>
- {{if $menus}}
+
<div class="panel">
<div class="section-subtitle-wrapper" role="tab" id="miscellaneous-settings">
<h3>
@@ -146,8 +146,12 @@
</h3>
</div>
<div id="miscellaneous-settings-collapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="miscellaneous-settings">
- <div class="section-content-wrapper">
- <div class="form-group">
+ <div class="section-content-tools-wrapper">
+ <div class="ffsapilink">
+ <a type="button" class="btn btn-default" href="/ffsapi">{{$firefoxshare}}</a>
+ </div>
+ {{if $menus}}
+ <div class="form-group channel-menu">
<label for="channel_menu">{{$menu_desc}}</label>
<select name="channel_menu" class="form-control">
{{foreach $menus as $menu }}
@@ -156,12 +160,12 @@
</select>
</div>
<div class="settings-submit-wrapper" >
- <input type="submit" name="submit" class="settings-submit" value="{{$submit}}"{{if !$expert}} onclick="$('select').prop('disabled', false);"{{/if}} />
+ <button type="submit" name="submit" class="btn btn-primary">{{$submit}}</button>
</div>
</div>
+ {{/if}}
</div>
</div>
- {{/if}}
</div>
</form>
</div>