aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authormarijus <mario@mariovavti.com>2014-03-04 14:52:12 +0100
committermarijus <mario@mariovavti.com>2014-03-04 14:52:12 +0100
commitffb791968e48b5699dc99fffccc562f198f86c5d (patch)
tree4b53eeae5f9236f76f6ba4baee00b0a08adafe50 /include
parent636a52d001be9bce66f5b2fd7313ffa6540a97e4 (diff)
parent5b33d98f0814a2fcb23ad78d2442ebecc85d4fb5 (diff)
downloadvolse-hubzilla-ffb791968e48b5699dc99fffccc562f198f86c5d.tar.gz
volse-hubzilla-ffb791968e48b5699dc99fffccc562f198f86c5d.tar.bz2
volse-hubzilla-ffb791968e48b5699dc99fffccc562f198f86c5d.zip
Merge branch 'master' of https://github.com/friendica/red
Diffstat (limited to 'include')
-rw-r--r--include/comanche.php2
-rw-r--r--include/dir_fns.php3
-rwxr-xr-xinclude/items.php50
-rw-r--r--include/nav.php2
-rw-r--r--include/poller.php9
-rw-r--r--include/widgets.php27
-rw-r--r--include/zot.php16
7 files changed, 70 insertions, 39 deletions
diff --git a/include/comanche.php b/include/comanche.php
index 83e9af438..13146ded4 100644
--- a/include/comanche.php
+++ b/include/comanche.php
@@ -201,7 +201,7 @@ function comanche_region(&$a,$s) {
$cnt = preg_match_all("/\[menu=(.*?)\](.*?)\[\/menu\]/ism", $s, $matches, PREG_SET_ORDER);
if($cnt) {
foreach($matches as $mtch) {
- $s = str_replace($mtch[0],comanche_menu(trim($mtch[2]),$match[1]),$s);
+ $s = str_replace($mtch[0],comanche_menu(trim($mtch[2]),$mtch[1]),$s);
}
}
$cnt = preg_match_all("/\[block\](.*?)\[\/block\]/ism", $s, $matches, PREG_SET_ORDER);
diff --git a/include/dir_fns.php b/include/dir_fns.php
index c2e614831..aeee8492f 100644
--- a/include/dir_fns.php
+++ b/include/dir_fns.php
@@ -101,6 +101,9 @@ function sync_directories($dirmode) {
$ud_flags = 0;
if(is_array($t['flags']) && in_array('deleted',$t['flags']))
$ud_flags |= UPDATE_FLAGS_DELETED;
+ if(is_array($t['flags']) && in_array('forced',$t['flags']))
+ $ud_flags |= UPDATE_FLAGS_FORCED;
+
$z = q("insert into updates ( ud_hash, ud_guid, ud_date, ud_flags, ud_addr )
values ( '%s', '%s', '%s', %d, '%s' ) ",
dbesc($t['hash']),
diff --git a/include/items.php b/include/items.php
index d380a7939..6ff984370 100755
--- a/include/items.php
+++ b/include/items.php
@@ -3409,8 +3409,11 @@ function item_expire($uid,$days) {
// $expire_network_only = save your own wall posts
// and just expire conversations started by others
+ // do not enable this until we can pass bulk delete messages through zot
+ // $expire_network_only = get_pconfig($uid,'expire','network_only');
+
+ $expire_network_only = 1;
- $expire_network_only = get_pconfig($uid,'expire','network_only');
$sql_extra = ((intval($expire_network_only)) ? " AND not (item_flags & " . intval(ITEM_WALL) . ") " : "");
$r = q("SELECT * FROM `item`
@@ -3418,14 +3421,11 @@ function item_expire($uid,$days) {
AND `created` < UTC_TIMESTAMP() - INTERVAL %d DAY
AND `id` = `parent`
$sql_extra
- AND NOT (item_restrict & %d )
- AND NOT (item_restrict & %d )
- AND NOT (item_restrict & %d ) ",
+ AND NOT ( item_flags & %d )
+ AND (item_restrict = 0 ) ",
intval($uid),
intval($days),
- intval(ITEM_DELETED),
- intval(ITEM_WEBPAGE),
- intval(ITEM_BUILDBLOCK)
+ intval(ITEM_RETAINED)
);
if(! $r)
@@ -3433,44 +3433,40 @@ function item_expire($uid,$days) {
$r = fetch_post_tags($r,true);
- $expire_items = get_pconfig($uid, 'expire','items');
- $expire_items = (($expire_items===false)?1:intval($expire_items)); // default if not set: 1
-
- $expire_notes = get_pconfig($uid, 'expire','notes');
- $expire_notes = (($expire_notes===false)?1:intval($expire_notes)); // default if not set: 1
-
- $expire_starred = get_pconfig($uid, 'expire','starred');
- $expire_starred = (($expire_starred===false)?1:intval($expire_starred)); // default if not set: 1
-
- $expire_photos = get_pconfig($uid, 'expire','photos');
- $expire_photos = (($expire_photos===false)?0:intval($expire_photos)); // default if not set: 0
-
- logger('expire: # items=' . count($r). "; expire items: $expire_items, expire notes: $expire_notes, expire starred: $expire_starred, expire photos: $expire_photos");
-
foreach($r as $item) {
-
-
// don't expire filed items
$terms = get_terms_oftype($item['term'],TERM_FILE);
- if($terms)
+ if($terms) {
+ retain_item($item['id']);
continue;
+ }
// Only expire posts, not photos and photo comments
- if($expire_photos==0 && ($item['resource_type'] === 'photo'))
+ if($item['resource_type'] === 'photo') {
+ retain_item($item['id']);
continue;
- if($expire_starred==0 && ($item['item_flags'] & ITEM_STARRED))
+ }
+ if($item['item_flags'] & ITEM_STARRED) {
+ retain_item($item['id']);
continue;
+ }
drop_item($item['id'],false);
}
- proc_run('php',"include/notifier.php","expire","$uid");
+// proc_run('php',"include/notifier.php","expire","$uid");
}
+function retain_item($id) {
+ $r = q("update item set item_flags = (item_flags | %d ) where id = %d limit 1",
+ intval(ITEM_RETAINED),
+ intval($id)
+ );
+}
function drop_items($items) {
$uid = 0;
diff --git a/include/nav.php b/include/nav.php
index 4e3d9fbec..ab0eaa855 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -134,7 +134,7 @@ EOT;
if(($a->config['system']['register_policy'] == REGISTER_OPEN) && (! local_user()) && (! remote_user()))
$nav['register'] = array('register',t('Register'), "", t('Create an account'));
- $help_url = z_root() . '/help';
+ $help_url = z_root() . '/help?f=&cmd=' . $a->cmd;
if(! get_config('system','hide_help'))
$nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'));
diff --git a/include/poller.php b/include/poller.php
index 77452cafa..649da30f6 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -96,9 +96,13 @@ function poller_run($argv, $argc){
$dirmode = get_config('system','directory_mode');
+ /**
+ * Cron Daily
+ *
+ * Actions in the following block are executed once per day, not on every poller run
+ *
+ */
- // Actions in the following block are executed once per day, not on every poller run
-
if($d2 != intval($d1)) {
// expire any read notifications over a month old
@@ -121,6 +125,7 @@ function poller_run($argv, $argc){
set_config('system','last_expire_day',$d2);
+ proc_run('php','include/expire.php');
proc_run('php','include/cli_suggest.php');
}
diff --git a/include/widgets.php b/include/widgets.php
index 8d5ab77e3..8d8eef160 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -623,3 +623,30 @@ function widget_suggestedchats($arr) {
));
}
+function widget_item($arr) {
+ $uid = $a->profile['profile_uid'];
+ if((! $uid) || (! $arr['mid']))
+ return '';
+
+ if(! perm_is_allowed($uid,get_observer_hash(),'view_pages'))
+ return '';
+
+ require_once('include/security.php');
+ $sql_extra = item_permissions_sql($uid);
+
+
+ $r = q("select * from item where mid = '%s' and uid = %d and item_restrict = " . intval(ITEM_WEBPAGE) . " $sql_extra limit 1",
+ dbesc($arr['mid']),
+ intval($uid)
+ );
+
+ if(! $r)
+ return '';
+
+ xchan_query($r);
+ $r = fetch_post_tags($r,true);
+
+ $o .= prepare_page($r[0]);
+ return $o;
+
+} \ No newline at end of file
diff --git a/include/zot.php b/include/zot.php
index a52abfecd..e80dabed9 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -305,7 +305,7 @@ function zot_refresh($them,$channel = null, $force = false) {
return false;
}
- $x = import_xchan($j,(($force) ? (-1) : 1));
+ $x = import_xchan($j,(($force) ? UPDATE_FLAGS_FORCED : UPDATE_FLAGS_UPDATED));
if(! $x['success'])
return false;
@@ -538,14 +538,14 @@ function zot_register_hub($arr) {
/**
- * @function import_xchan($arr,$ud_flags = 1)
+ * @function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED)
* Takes an associative array of a fetched discovery packet and updates
* all internal data structures which need to be updated as a result.
*
* @param array $arr => json_decoded discovery packet
* @param int $ud_flags
- * Determines whether to create a directory update record if any changes occur, default 1 or true
- * $ud_flags = (-1) indicates a forced refresh where we unconditionally create a directory update record
+ * Determines whether to create a directory update record if any changes occur, default is UPDATE_FLAGS_UPDATED (true)
+ * $ud_flags = UPDATE_FLAGS_FORCED indicates a forced refresh where we unconditionally create a directory update record
* this typically occurs once a month for each channel as part of a scheduled ping to notify the directory
* that the channel still exists
*
@@ -553,7 +553,7 @@ function zot_register_hub($arr) {
* 'message' (optional error string only if success is false)
*/
-function import_xchan($arr,$ud_flags = 1) {
+function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED) {
call_hooks('import_xchan', $arr);
@@ -912,7 +912,7 @@ function import_xchan($arr,$ud_flags = 1) {
}
}
- if(($changed) || ($ud_flags == (-1))) {
+ if(($changed) || ($ud_flags == UPDATE_FLAGS_FORCED)) {
$guid = random_string() . '@' . get_app()->get_hostname();
update_modtime($xchan_hash,$guid,$arr['address'],$ud_flags);
logger('import_xchan: changed: ' . $what,LOGGER_DEBUG);
@@ -1644,7 +1644,7 @@ function process_profile_delivery($sender,$arr,$deliveries) {
dbesc($sender['hash'])
);
if($r)
- import_directory_profile($sender['hash'],$arr,$r[0]['xchan_addr'], 1, 0);
+ import_directory_profile($sender['hash'],$arr,$r[0]['xchan_addr'], UPDATE_FLAGS_UPDATED, 0);
}
@@ -1655,7 +1655,7 @@ function process_profile_delivery($sender,$arr,$deliveries) {
*
*/
-function import_directory_profile($hash,$profile,$addr,$ud_flags = 1, $suppress_update = 0) {
+function import_directory_profile($hash,$profile,$addr,$ud_flags = UPDATE_FLAGS_UPDATED, $suppress_update = 0) {
logger('import_directory_profile', LOGGER_DEBUG);
if(! $hash)