Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Haakon Meland Eriksen 2015-11-05 16:54:39 +01:00
commit 91f751d105
9 changed files with 58 additions and 26 deletions

View File

@ -50,7 +50,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'H'); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'H');
define ( 'ZOT_REVISION', 1 ); define ( 'ZOT_REVISION', 1 );
define ( 'DB_UPDATE_VERSION', 1158 ); define ( 'DB_UPDATE_VERSION', 1159 );
/** /**
* @brief Constant with a HTML line break. * @brief Constant with a HTML line break.

View File

@ -660,26 +660,30 @@ require_once('include/attach.php');
dbesc($_REQUEST['file_id']) dbesc($_REQUEST['file_id'])
); );
if($r) { if($r) {
if($r[0]['is_dir']) $ptr = $r[0];
$r[0]['data'] = ''; if($length === 0)
$length = intval($ptr['filesize']);
if($ptr['is_dir'])
$ptr['data'] = '';
elseif(! intval($r[0]['os_storage'])) { elseif(! intval($r[0]['os_storage'])) {
$r[0]['start'] = $start; $ptr['start'] = $start;
$x = substr(dbunescbin($r[0]['data'],$start,$length)); $x = substr(dbunescbin($ptr['data'],$start,$length));
$r[0]['length'] = strlen($x); $ptr['length'] = strlen($x);
$r[0]['data'] = base64_encode($x); $ptr['data'] = base64_encode($x);
} }
else { else {
$fp = fopen(dbunescbin($r[0]['data'],'r')); $fp = fopen(dbunescbin($ptr['data']),'r');
if($fp) { if($fp) {
$seek = fseek($fp,$start,SEEK_SET); $seek = fseek($fp,$start,SEEK_SET);
$x = fread($fp,$length); $x = fread($fp,$length);
$r[0]['start'] = $start; $ptr['start'] = $start;
$r[0]['length'] = strlen($x); $ptr['length'] = strlen($x);
$r[0]['data'] = base64_encode($x); $ptr['data'] = base64_encode($x);
} }
} }
$ret = array('attach' => $r[0]); $ret = array('attach' => $ptr);
json_return_and_die($ret); json_return_and_die($ret);
} }
killme(); killme();

View File

@ -722,7 +722,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
intval($filesize), intval($filesize),
intval(1), intval(1),
intval($is_photo), intval($is_photo),
dbesc($os_relpath), dbesc($os_basepath . $os_relpath),
dbesc($created), dbesc($created),
intval($existing_id), intval($existing_id),
intval($channel_id) intval($channel_id)
@ -742,7 +742,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
intval($x[0]['revision'] + 1), intval($x[0]['revision'] + 1),
intval(1), intval(1),
intval($is_photo), intval($is_photo),
dbesc($os_relpath), dbesc($os_basepath . $os_relpath),
dbesc($created), dbesc($created),
dbesc($created), dbesc($created),
dbesc($x[0]['allow_cid']), dbesc($x[0]['allow_cid']),
@ -783,7 +783,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
intval(0), intval(0),
intval(1), intval(1),
intval($is_photo), intval($is_photo),
dbesc($os_relpath), dbesc($os_basepath . $os_relpath),
dbesc($created), dbesc($created),
dbesc($created), dbesc($created),
dbesc(($arr && array_key_exists('allow_cid',$arr)) ? $arr['allow_cid'] : $str_contact_allow), dbesc(($arr && array_key_exists('allow_cid',$arr)) ? $arr['allow_cid'] : $str_contact_allow),

View File

@ -1,6 +1,6 @@
<?php <?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;
}

View File

@ -55,10 +55,10 @@ function activate(node) {
} }
</script> </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; EOT;
return $s; return $s;
} }

View File

@ -1102,12 +1102,13 @@ function settings_content(&$a) {
'$expert' => feature_enabled(local_channel(),'expert'), '$expert' => feature_enabled(local_channel(),'expert'),
'$hint' => t('Please enable expert mode (in <a href="settings/features">Settings > Additional features</a>) to adjust!'), '$hint' => t('Please enable expert mode (in <a href="settings/features">Settings > Additional features</a>) to adjust!'),
'$lbl_misc' => t('Miscellaneous Settings'), '$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'), '$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'), '%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, '$menus' => $menu,
'$menu_desc' => t('Personal menu to display in your channel pages'), '$menu_desc' => t('Personal menu to display in your channel pages'),
'$removeme' => t('Remove Channel'), '$removeme' => t('Remove Channel'),
'$removechannel' => t('Remove this channel.'), '$removechannel' => t('Remove this channel.'),
'$firefoxshare' => t('Firefox Share $Projectname provider'),
)); ));
call_hooks('settings_form',$o); call_hooks('settings_form',$o);

View File

@ -1 +1 @@
2015-11-04.1206 2015-11-05.1207

View File

@ -1,3 +1,11 @@
.group { .group {
margin-left: 10px; margin-left: 10px;
} }
.ffsapilink {
margin: 10px 0;
}
.channel-menu {
margin-top: 24px;
}

View File

@ -136,7 +136,7 @@
</div> </div>
</div> </div>
</div> </div>
{{if $menus}}
<div class="panel"> <div class="panel">
<div class="section-subtitle-wrapper" role="tab" id="miscellaneous-settings"> <div class="section-subtitle-wrapper" role="tab" id="miscellaneous-settings">
<h3> <h3>
@ -146,8 +146,12 @@
</h3> </h3>
</div> </div>
<div id="miscellaneous-settings-collapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="miscellaneous-settings"> <div id="miscellaneous-settings-collapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="miscellaneous-settings">
<div class="section-content-wrapper"> <div class="section-content-tools-wrapper">
<div class="form-group"> <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> <label for="channel_menu">{{$menu_desc}}</label>
<select name="channel_menu" class="form-control"> <select name="channel_menu" class="form-control">
{{foreach $menus as $menu }} {{foreach $menus as $menu }}
@ -156,12 +160,12 @@
</select> </select>
</div> </div>
<div class="settings-submit-wrapper" > <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>
</div> </div>
{{/if}}
</div> </div>
</div> </div>
{{/if}}
</div> </div>
</form> </form>
</div> </div>