Merge https://github.com/redmatrix/redmatrix into pending_merge
Conflicts: install/update.php
This commit is contained in:
commit
f8b612a2c0
@ -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();
|
||||
|
@ -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),
|
||||
|
@ -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) {
|
||||
$hash_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;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user