Merge branch 'dev' into sabre32
This commit is contained in:
commit
0324bc5cf0
@ -423,6 +423,8 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
|
|||||||
|
|
||||||
$observer = array();
|
$observer = array();
|
||||||
|
|
||||||
|
$dosync = ((array_key_exists('nosync',$arr) && $arr['nosync']) ? 0 : 1);
|
||||||
|
|
||||||
if($observer_hash) {
|
if($observer_hash) {
|
||||||
$x = q("select * from xchan where xchan_hash = '%s' limit 1",
|
$x = q("select * from xchan where xchan_hash = '%s' limit 1",
|
||||||
dbesc($observer_hash)
|
dbesc($observer_hash)
|
||||||
@ -829,6 +831,8 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
|
|||||||
if($arr['description'])
|
if($arr['description'])
|
||||||
$args['description'] = $arr['description'];
|
$args['description'] = $arr['description'];
|
||||||
|
|
||||||
|
$args['deliver'] = $dosync;
|
||||||
|
|
||||||
$p = photo_upload($channel,$observer,$args);
|
$p = photo_upload($channel,$observer,$args);
|
||||||
if($p['success']) {
|
if($p['success']) {
|
||||||
$ret['body'] = $p['body'];
|
$ret['body'] = $p['body'];
|
||||||
@ -865,10 +869,12 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
|
|||||||
call_hooks('photo_upload_end',$ret);
|
call_hooks('photo_upload_end',$ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sync = attach_export_data($channel,$hash);
|
if($dosync) {
|
||||||
|
$sync = attach_export_data($channel,$hash);
|
||||||
|
|
||||||
if($sync)
|
if($sync)
|
||||||
build_sync_packet($channel['channel_id'],array('file' => array($sync)));
|
build_sync_packet($channel['channel_id'],array('file' => array($sync)));
|
||||||
|
}
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,8 @@ function get_capath() {
|
|||||||
* * \b nobody => only return the header
|
* * \b nobody => only return the header
|
||||||
* * \b filep => stream resource to write body to. header and body are not returned when using this option.
|
* * \b filep => stream resource to write body to. header and body are not returned when using this option.
|
||||||
* * \b custom => custom request method: e.g. 'PUT', 'DELETE'
|
* * \b custom => custom request method: e.g. 'PUT', 'DELETE'
|
||||||
|
* * \b cookiejar => cookie file (write)
|
||||||
|
* * \B cookiefile => cookie file (read)
|
||||||
*
|
*
|
||||||
* @return array an associative array with:
|
* @return array an associative array with:
|
||||||
* * \e int \b return_code => HTTP return code or 0 if timeout or failure
|
* * \e int \b return_code => HTTP return code or 0 if timeout or failure
|
||||||
@ -60,6 +62,8 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
|
|||||||
@curl_setopt($ch, CURLOPT_HEADER, $false);
|
@curl_setopt($ch, CURLOPT_HEADER, $false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(x($opts,'headers'))
|
if(x($opts,'headers'))
|
||||||
@curl_setopt($ch, CURLOPT_HTTPHEADER, $opts['headers']);
|
@curl_setopt($ch, CURLOPT_HTTPHEADER, $opts['headers']);
|
||||||
|
|
||||||
@ -82,6 +86,11 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
|
|||||||
@curl_setopt($ch, CURLOPT_USERPWD, $opts['http_auth']);
|
@curl_setopt($ch, CURLOPT_USERPWD, $opts['http_auth']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(x($opts,'cookiejar'))
|
||||||
|
@curl_setopt($ch, CURLOPT_COOKIEJAR, $opts['cookiejar']);
|
||||||
|
if(x($opts,'cookiefile'))
|
||||||
|
@curl_setopt($ch, CURLOPT_COOKIEFILE, $opts['cookiefile']);
|
||||||
|
|
||||||
@curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,
|
@curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,
|
||||||
((x($opts,'novalidate') && intval($opts['novalidate'])) ? false : true));
|
((x($opts,'novalidate') && intval($opts['novalidate'])) ? false : true));
|
||||||
|
|
||||||
@ -228,6 +237,12 @@ logger('headers: ' . print_r($opts['headers'],true) . 'redir: ' . $redirects);
|
|||||||
@curl_setopt($ch, CURLOPT_USERPWD, $opts['http_auth']);
|
@curl_setopt($ch, CURLOPT_USERPWD, $opts['http_auth']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(x($opts,'cookiejar'))
|
||||||
|
@curl_setopt($ch, CURLOPT_COOKIEJAR, $opts['cookiejar']);
|
||||||
|
if(x($opts,'cookiefile'))
|
||||||
|
@curl_setopt($ch, CURLOPT_COOKIEFILE, $opts['cookiefile']);
|
||||||
|
|
||||||
@curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,
|
@curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,
|
||||||
((x($opts,'novalidate') && intval($opts['novalidate'])) ? false : true));
|
((x($opts,'novalidate') && intval($opts['novalidate'])) ? false : true));
|
||||||
|
|
||||||
|
@ -41,6 +41,10 @@ function photo_upload($channel, $observer, $args) {
|
|||||||
else
|
else
|
||||||
$visible = 0;
|
$visible = 0;
|
||||||
|
|
||||||
|
$deliver = true;
|
||||||
|
if(array_key_exists('deliver',$args))
|
||||||
|
$deliver = intval($args['deliver']);
|
||||||
|
|
||||||
// Set to default channel permissions. If the parent directory (album) has permissions set,
|
// Set to default channel permissions. If the parent directory (album) has permissions set,
|
||||||
// use those instead. If we have specific permissions supplied, they take precedence over
|
// use those instead. If we have specific permissions supplied, they take precedence over
|
||||||
// all other settings. 'allow_cid' being passed from an external source takes priority over channel settings.
|
// all other settings. 'allow_cid' being passed from an external source takes priority over channel settings.
|
||||||
@ -330,7 +334,7 @@ function photo_upload($channel, $observer, $args) {
|
|||||||
|
|
||||||
if($item['mid'] === $item['parent_mid']) {
|
if($item['mid'] === $item['parent_mid']) {
|
||||||
|
|
||||||
$item['body'] = $args['body'];
|
$item['body'] = $summary;
|
||||||
$item['obj_type'] = ACTIVITY_OBJ_PHOTO;
|
$item['obj_type'] = ACTIVITY_OBJ_PHOTO;
|
||||||
$item['obj'] = json_encode($object);
|
$item['obj'] = json_encode($object);
|
||||||
|
|
||||||
@ -355,14 +359,14 @@ function photo_upload($channel, $observer, $args) {
|
|||||||
if(($item['edited'] > $r[0]['edited']) || $force) {
|
if(($item['edited'] > $r[0]['edited']) || $force) {
|
||||||
$item['id'] = $r[0]['id'];
|
$item['id'] = $r[0]['id'];
|
||||||
$item['uid'] = $channel['channel_id'];
|
$item['uid'] = $channel['channel_id'];
|
||||||
item_store_update($item);
|
item_store_update($item,false,$deliver);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$item['aid'] = $channel['channel_account_id'];
|
$item['aid'] = $channel['channel_account_id'];
|
||||||
$item['uid'] = $channel['channel_id'];
|
$item['uid'] = $channel['channel_id'];
|
||||||
$item_result = item_store($item);
|
$item_result = item_store($item,false,$deliver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -414,10 +418,10 @@ function photo_upload($channel, $observer, $args) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
$result = item_store($arr);
|
$result = item_store($arr,false,$deliver);
|
||||||
$item_id = $result['item_id'];
|
$item_id = $result['item_id'];
|
||||||
|
|
||||||
if($visible)
|
if($visible && $deliver)
|
||||||
Zotlabs\Daemon\Master::Summon(array('Notifier', 'wall-new', $item_id));
|
Zotlabs\Daemon\Master::Summon(array('Notifier', 'wall-new', $item_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2899,6 +2899,11 @@ function text_highlight($s,$lang) {
|
|||||||
$tag_added = false;
|
$tag_added = false;
|
||||||
$s = trim(html_entity_decode($s,ENT_COMPAT));
|
$s = trim(html_entity_decode($s,ENT_COMPAT));
|
||||||
$s = str_replace(" ","\t",$s);
|
$s = str_replace(" ","\t",$s);
|
||||||
|
|
||||||
|
// The highlighter library insists on an opening php tag for php code blocks. If
|
||||||
|
// it isn't present, nothing is highlighted. So we're going to see if it's present.
|
||||||
|
// If not, we'll add it, and then quietly remove it after we get the processed output back.
|
||||||
|
|
||||||
if($lang === 'php') {
|
if($lang === 'php') {
|
||||||
if(strpos('<?php',$s) !== 0) {
|
if(strpos('<?php',$s) !== 0) {
|
||||||
$s = '<?php' . "\n" . $s;
|
$s = '<?php' . "\n" . $s;
|
||||||
|
Reference in New Issue
Block a user