diff options
author | marijus <mario@mariovavti.com> | 2014-03-05 17:03:38 +0100 |
---|---|---|
committer | marijus <mario@mariovavti.com> | 2014-03-05 17:03:38 +0100 |
commit | 6cdc25ade96c4451e87af475a6e4f0490b591c36 (patch) | |
tree | 474ebb0f31063805d8b95dcddc22d4345c989936 /include | |
parent | ffb791968e48b5699dc99fffccc562f198f86c5d (diff) | |
parent | d58abc0230e07663ce543088c186639d36f82f02 (diff) | |
download | volse-hubzilla-6cdc25ade96c4451e87af475a6e4f0490b591c36.tar.gz volse-hubzilla-6cdc25ade96c4451e87af475a6e4f0490b591c36.tar.bz2 volse-hubzilla-6cdc25ade96c4451e87af475a6e4f0490b591c36.zip |
Merge branch 'master' of https://github.com/friendica/red
Diffstat (limited to 'include')
-rw-r--r-- | include/api.php | 48 | ||||
-rw-r--r-- | include/identity.php | 2 | ||||
-rwxr-xr-x | include/items.php | 4 | ||||
-rw-r--r-- | include/nav.php | 1 | ||||
-rw-r--r-- | include/onepoll.php | 7 | ||||
-rw-r--r-- | include/poller.php | 9 | ||||
-rw-r--r-- | include/widgets.php | 56 | ||||
-rw-r--r-- | include/zot.php | 15 |
8 files changed, 122 insertions, 20 deletions
diff --git a/include/api.php b/include/api.php index dc270167b..47c78113a 100644 --- a/include/api.php +++ b/include/api.php @@ -533,6 +533,12 @@ require_once('include/items.php'); api_register_func('api/red/channel/export/basic','api_export_basic', true); + + + + + + function api_channel_stream(&$a, $type) { if(api_user() === false) { logger('api_channel_stream: no user'); @@ -691,6 +697,48 @@ require_once('include/items.php'); api_register_func('api/statuses/update','api_statuses_update', true); + function red_item_new(&$a, $type) { + + if (api_user() === false) { + logger('api_statuses_update: no user'); + return false; + } + + logger('api_statuses_update: REQUEST ' . print_r($_REQUEST,true)); + logger('api_statuses_update: FILES ' . print_r($_FILES,true)); + + + // set this so that the item_post() function is quiet and doesn't redirect or emit json + + $_REQUEST['api_source'] = true; + $_REQUEST['profile_uid'] = api_user(); + + if(x($_FILES,'media')) { + $_FILES['userfile'] = $_FILES['media']; + // upload the image if we have one + $_REQUEST['silent']='1'; //tell wall_upload function to return img info instead of echo + require_once('mod/wall_upload.php'); + $media = wall_upload_post($a); + if(strlen($media)>0) + $_REQUEST['body'] .= "\n\n".$media; + } + + require_once('mod/item.php'); + $x = item_post($a); + json_return_and_die($x); + } + + api_register_func('api/red/item/new','red_item_new', true); + + + + + + + + + + function api_status_show(&$a, $type){ $user_info = api_get_user($a); diff --git a/include/identity.php b/include/identity.php index 93174031c..ed6920e67 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1223,4 +1223,4 @@ function get_channel_by_nick($nick) { ); return(($r) ? $r[0] : false); -}
\ No newline at end of file +} diff --git a/include/items.php b/include/items.php index 6ff984370..70e098415 100755 --- a/include/items.php +++ b/include/items.php @@ -1548,7 +1548,7 @@ function item_store($arr,$allow_exec = false) { $allow_exec = $d['allow_exec']; - $ret = array('result' => false, 'item_id' => 0); + $ret = array('success' => false, 'item_id' => 0); if(! $arr['uid']) { logger('item_store: no uid'); @@ -1933,7 +1933,7 @@ function item_store_update($arr,$allow_exec = false) { - $ret = array('result' => false, 'item_id' => 0); + $ret = array('success' => false, 'item_id' => 0); if(! intval($arr['uid'])) { logger('item_store_update: no uid'); $ret['message'] = 'no uid.'; diff --git a/include/nav.php b/include/nav.php index ab0eaa855..3aa50226d 100644 --- a/include/nav.php +++ b/include/nav.php @@ -59,7 +59,6 @@ EOT; $a->page['header'] .= replace_macros(get_markup_template('hdr.tpl'), array( '$baseurl' => $a->get_baseurl(), '$sitelocation' => $sitelocation, - '$langselector' => ((get_config('system','select_language')) ? lang_selector() : ''), '$banner' => $banner )); diff --git a/include/onepoll.php b/include/onepoll.php index a821b76cf..e81d8bcf7 100644 --- a/include/onepoll.php +++ b/include/onepoll.php @@ -29,19 +29,16 @@ function onepoll_run($argv, $argc){ return; } - $d = datetime_convert(); - $contacts = q("SELECT abook.*, xchan.*, account.* FROM abook LEFT JOIN account on abook_account = account_id left join xchan on xchan_hash = abook_xchan where abook_id = %d - AND (( abook_flags = %d ) OR ( abook_flags = %d ) OR ( abook_flags & %d )) + AND (( abook_flags & %d ) OR ( abook_flags = %d )) AND (( account_flags = %d ) OR ( account_flags = %d )) limit 1", intval($contact_id), - intval(ABOOK_FLAG_HIDDEN), + intval(ABOOK_FLAG_HIDDEN|ABOOK_FLAG_PENDING|ABOOK_FLAG_UNCONNECTED), intval(0), - intval(ABOOK_FLAG_PENDING), intval(ACCOUNT_OK), intval(ACCOUNT_UNVERIFIED) ); diff --git a/include/poller.php b/include/poller.php index 649da30f6..423ee46c1 100644 --- a/include/poller.php +++ b/include/poller.php @@ -184,9 +184,7 @@ function poller_run($argv, $argc){ if(! $restart) proc_run('php','include/cronhooks.php'); - // Only poll from those with suitable relationships, - // and which have a polling address and ignore Diaspora since - // we are unable to match those posts with a Diaspora GUID and prevent duplicates. + // Only poll from those with suitable relationships $abandon_sql = (($abandon_days) ? sprintf(" AND account_lastlog > UTC_TIMESTAMP() - INTERVAL %d DAY ", intval($abandon_days)) @@ -197,10 +195,9 @@ function poller_run($argv, $argc){ $contacts = q("SELECT abook_id, abook_flags, abook_updated, abook_connected, abook_closeness, abook_channel FROM abook LEFT JOIN account on abook_account = account_id where 1 $sql_extra - AND (( abook_flags = %d ) OR ( abook_flags = %d )) + AND (( abook_flags & %d ) OR ( abook_flags = %d )) AND (( account_flags = %d ) OR ( account_flags = %d )) $abandon_sql ORDER BY RAND()", - - intval(ABOOK_FLAG_HIDDEN), + intval(ABOOK_FLAG_HIDDEN|ABOOK_FLAG_PENDING|ABOOK_FLAG_UNCONNECTED), intval(0), intval(ACCOUNT_OK), intval(ACCOUNT_UNVERIFIED) // FIXME diff --git a/include/widgets.php b/include/widgets.php index 8d8eef160..90586397f 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -649,4 +649,60 @@ function widget_item($arr) { $o .= prepare_page($r[0]); return $o; +} + +function widget_clock($arr) { + + $miltime = 0; + if(isset($arr['military']) && $arr['military']) + $miltime = 1; + +$o = <<< EOT +<div class="widget"> +<h3 class="clockface"></h3> +<script> + +var timerID = null +var timerRunning = false + +function stopclock(){ + if(timerRunning) + clearTimeout(timerID) + timerRunning = false +} + +function startclock(){ + stopclock() + showtime() +} + +function showtime(){ + var now = new Date() + var hours = now.getHours() + var minutes = now.getMinutes() + var seconds = now.getSeconds() + var military = $miltime + var timeValue = "" + if(military) + timeValue = hours + else + timeValue = ((hours > 12) ? hours - 12 : hours) + timeValue += ((minutes < 10) ? ":0" : ":") + minutes +// timeValue += ((seconds < 10) ? ":0" : ":") + seconds + if(! military) + timeValue += (hours >= 12) ? " P.M." : " A.M." + $('.clockface').html(timeValue) + timerID = setTimeout("showtime()",1000) + timerRunning = true +} + +$(document).ready(function() { + startclock(); +}); + +</script> +</div> +EOT; +return $o; + }
\ No newline at end of file diff --git a/include/zot.php b/include/zot.php index e80dabed9..cfabbae2e 100644 --- a/include/zot.php +++ b/include/zot.php @@ -351,7 +351,10 @@ function zot_refresh($them,$channel = null, $force = false) { intval(ABOOK_FLAG_SELF) ); - if($r) { + if($r) { + + $current_abook_connected = (($r[0]['abook_flags'] & ABOOK_FLAG_UNCONNECTED) ? 0 : 1); + $y = q("update abook set abook_their_perms = %d where abook_xchan = '%s' and abook_channel = %d and not (abook_flags & %d) limit 1", @@ -360,14 +363,16 @@ function zot_refresh($them,$channel = null, $force = false) { intval($channel['channel_id']), intval(ABOOK_FLAG_SELF) ); - if($connected_set === 0) { - // if they are in your address book but you aren't in theirs, mark their address book entry hidden. + if(($connected_set === 0 || $connected_set === 1) && ($connected_set !== $current_abook_unconnected)) { + + // if they are in your address book but you aren't in theirs, and/or this does not + // match your current connected state setting, toggle it. - $y1 = q("update abook set abook_flags = (abook_flags | %d) + $y1 = q("update abook set abook_flags = (abook_flags ^ %d) where abook_xchan = '%s' and abook_channel = %d and not (abook_flags & %d) limit 1", - intval(ABOOK_FLAG_HIDDEN), + intval(ABOOK_FLAG_UNCONNECTED), dbesc($x['hash']), intval($channel['channel_id']), intval(ABOOK_FLAG_SELF) |