aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/admin.php5
-rw-r--r--mod/channel.php2
-rw-r--r--mod/dirsearch.php12
-rwxr-xr-xmod/events.php34
-rw-r--r--mod/invite.php2
-rw-r--r--mod/item.php43
-rw-r--r--mod/network.php4
-rw-r--r--mod/profile_photo.php3
-rw-r--r--mod/profiles.php16
-rw-r--r--mod/search.php3
-rw-r--r--mod/search_ac.php5
-rwxr-xr-xmod/subthread.php12
-rw-r--r--mod/tagger.php2
13 files changed, 106 insertions, 37 deletions
diff --git a/mod/admin.php b/mod/admin.php
index 3f1a69ca6..4b7cb3cd9 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -395,9 +395,10 @@ function admin_page_site(&$a) {
}
/* Banner */
+
$banner = get_config('system', 'banner');
- if($banner == false)
- $banner = 'red';
+ if($banner === false)
+ $banner = get_config('system','sitename');
$banner = htmlspecialchars($banner);
diff --git a/mod/channel.php b/mod/channel.php
index 0af2666cc..2b9d0ed89 100644
--- a/mod/channel.php
+++ b/mod/channel.php
@@ -189,7 +189,7 @@ function channel_content(&$a, $update = 0, $load = false) {
$sql_extra .= protect_sprintf(term_query('item', $category, TERM_CATEGORY));
}
if(x($hashtags)) {
- $sql_extra .= protect_sprintf(term_query('item', $hashtags, TERM_HASHTAG));
+ $sql_extra .= protect_sprintf(term_query('item', $hashtags, TERM_HASHTAG, TERM_COMMUNITYTAG));
}
if($datequery) {
diff --git a/mod/dirsearch.php b/mod/dirsearch.php
index 937564a79..548acbd08 100644
--- a/mod/dirsearch.php
+++ b/mod/dirsearch.php
@@ -124,8 +124,6 @@ function dirsearch_content(&$a) {
if($keywords)
$sql_extra .= dir_query_build($joiner,'xprof_keywords',$keywords);
- if($forums)
- $safesql .= dir_flag_build(' AND ','xchan_flags',XCHAN_FLAGS_PUBFORUM, $forums);
// we only support an age range currently. You must set both agege
// (greater than or equal) and agele (less than or equal)
@@ -173,6 +171,9 @@ function dirsearch_content(&$a) {
if($safe < 0)
$safesql = " and ( xchan_censored = 1 OR xchan_selfcensored = 1 ) ";
+ if($forums)
+ $safesql .= " and xchan_pubforum = " . ((intval($forums)) ? '1 ' : '0 ');
+
if($limit)
$qlimit = " LIMIT $limit ";
else {
@@ -185,7 +186,6 @@ function dirsearch_content(&$a) {
}
}
-
if($sort_order == 'normal') {
$order = " order by xchan_name asc ";
@@ -202,6 +202,7 @@ function dirsearch_content(&$a) {
else
$order = " order by xchan_name_date desc ";
+
if($sync) {
$spkt = array('transactions' => array());
$r = q("select * from updates where ud_date >= '%s' and ud_guid != '' order by ud_date desc",
@@ -245,15 +246,20 @@ function dirsearch_content(&$a) {
json_return_and_die($spkt);
}
else {
+
$r = q("SELECT xchan.*, xprof.* from xchan left join xprof on xchan_hash = xprof_hash
where ( $logic $sql_extra ) $hub_query and xchan_network = 'zot' and xchan_hidden = 0 and xchan_orphan = 0 and xchan_deleted = 0
$safesql $order $qlimit "
);
+
+
+
$ret['page'] = $page + 1;
$ret['records'] = count($r);
}
+
if($r) {
$entries = array();
diff --git a/mod/events.php b/mod/events.php
index d76602a33..c3731bf1c 100755
--- a/mod/events.php
+++ b/mod/events.php
@@ -280,22 +280,17 @@ function events_content(&$a) {
// $plaintext = false;
-
$htpl = get_markup_template('event_head.tpl');
$a->page['htmlhead'] .= replace_macros($htpl,array(
'$baseurl' => $a->get_baseurl(),
- '$editselect' => (($plaintext) ? 'none' : 'textareas')
+ '$editselect' => (($plaintext) ? 'none' : 'textareas'),
+ '$lang' => $a->language
));
$o ="";
- // tabs
$channel = $a->get_channel();
- $tabs = profile_tabs($a, True, $channel['channel_address']);
-
-
-
$mode = 'view';
$y = 0;
$m = 0;
@@ -378,10 +373,10 @@ function events_content(&$a) {
if (argv(1) === 'json'){
- if (x($_GET,'start')) $start = date("Y-m-d h:i:s", $_GET['start']);
- if (x($_GET,'end')) $finish = date("Y-m-d h:i:s", $_GET['end']);
+ if (x($_GET,'start')) $start = $_GET['start'];
+ if (x($_GET,'end')) $finish = $_GET['end'];
}
-
+
$start = datetime_convert('UTC','UTC',$start);
$finish = datetime_convert('UTC','UTC',$finish);
@@ -413,18 +408,21 @@ function events_content(&$a) {
$r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan
from event left join item on event_hash = resource_id
- where resource_type = 'event' and event.uid = %d $ignored
- AND (( `adjust` = 0 AND ( `finish` >= '%s' or nofinish = 1 ) AND `start` <= '%s' )
- OR ( `adjust` = 1 AND ( `finish` >= '%s' or nofinish = 1 ) AND `start` <= '%s' )) ",
+ where resource_type = 'event' and event.uid = %d $ignored
+ AND (( adjust = 0 AND ( finish >= '%s' or nofinish = 1 ) AND start <= '%s' )
+ OR ( adjust = 1 AND ( finish >= '%s' or nofinish = 1 ) AND start <= '%s' )) ",
intval(local_channel()),
dbesc($start),
dbesc($finish),
dbesc($adjust_start),
dbesc($adjust_finish)
);
+
}
+
+
$links = array();
if($r && ! $export) {
@@ -500,7 +498,7 @@ function events_content(&$a) {
}
}
-
+
if($export) {
header('Content-type: text/calendar');
header('content-disposition: attachment; filename="' . t('calendar') . '-' . $channel['channel_address'] . '.ics"' );
@@ -522,16 +520,18 @@ function events_content(&$a) {
$o = replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(),
- '$tabs' => $tabs,
'$title' => t('Events'),
- '$new_event'=> array($a->get_baseurl().'/events/new',t('Create New Event'),'',''),
+ '$new_event'=> array($a->get_baseurl().'/events/new',t('New Event'),'',''),
'$previus' => array($a->get_baseurl()."/events/$prevyear/$prevmonth",t('Previous'),'',''),
'$next' => array($a->get_baseurl()."/events/$nextyear/$nextmonth",t('Next'),'',''),
'$export' => array($a->get_baseurl()."/events/$y/$m/export",t('Export'),'',''),
'$calendar' => cal($y,$m,$links, ' eventcal'),
'$events' => $events,
'$upload' => t('Import'),
- '$submit' => t('Submit')
+ '$submit' => t('Submit'),
+ '$prev' => t('Previous'),
+ '$next' => t('Next'),
+ '$today' => t('Today')
));
if (x($_GET,'id')){ echo $o; killme(); }
diff --git a/mod/invite.php b/mod/invite.php
index 46fa7b413..bda808142 100644
--- a/mod/invite.php
+++ b/mod/invite.php
@@ -143,4 +143,4 @@ function invite_content(&$a) {
));
return $o;
-} \ No newline at end of file
+}
diff --git a/mod/item.php b/mod/item.php
index b66d71797..34484eff7 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -651,6 +651,29 @@ function item_post(&$a) {
}
}
+ if($orig_post) {
+ // preserve original tags
+ $t = q("select * from term where oid = %d and otype = %d and uid = %d and type in ( %d, %d, %d )",
+ intval($orig_post['id']),
+ intval(TERM_OBJ_POST),
+ intval($profile_uid),
+ intval(TERM_UNKNOWN),
+ intval(TERM_FILE),
+ intval(TERM_COMMUNITYTAG)
+ );
+ if($t) {
+ foreach($t as $t1) {
+ $post_tags[] = array(
+ 'uid' => $profile_uid,
+ 'type' => $t1['type'],
+ 'otype' => TERM_OBJ_POST,
+ 'term' => $t1['term'],
+ 'url' => $t1['url'],
+ );
+ }
+ }
+ }
+
$item_unseen = ((local_channel() != $profile_uid) ? 1 : 0);
$item_wall = (($post_type === 'wall' || $post_type === 'wall-comment') ? 1 : 0);
@@ -703,6 +726,10 @@ function item_post(&$a) {
$plink = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $mid;
}
+
+
+
+
$datarray['aid'] = $channel['channel_account_id'];
$datarray['uid'] = $profile_uid;
@@ -781,6 +808,22 @@ function item_post(&$a) {
if($orig_post)
$datarray['edit'] = true;
+
+
+ if(feature_enabled($profile_uid,'suppress_duplicates')) {
+
+ $z = q("select created from item where uid = %d and body = '%s'",
+ intval($profile_uid),
+ dbesc($body)
+ );
+
+ if($z && $z[0]['created'] > datetime_convert('UTC','UTC', 'now - 2 minutes')) {
+ $datarray['cancel'] = 1;
+ notice( t('Duplicate post suppressed.') . EOL);
+ logger('Duplicate post. Faking plugin cancel.');
+ }
+ }
+
call_hooks('post_local',$datarray);
if(x($datarray,'cancel')) {
diff --git a/mod/network.php b/mod/network.php
index 53de975a4..9f0604296 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -248,7 +248,7 @@ function network_content(&$a, $update = 0, $load = false) {
$sql_extra .= protect_sprintf(term_query('item', $category, TERM_CATEGORY));
}
if(x($hashtags)) {
- $sql_extra .= protect_sprintf(term_query('item', $hashtags, TERM_HASHTAG));
+ $sql_extra .= protect_sprintf(term_query('item', $hashtags, TERM_HASHTAG, TERM_COMMUNITYTAG));
}
if(! $update) {
@@ -313,7 +313,7 @@ function network_content(&$a, $update = 0, $load = false) {
if(x($_GET,'search')) {
$search = escape_tags($_GET['search']);
if(strpos($search,'#') === 0) {
- $sql_extra .= term_query('item',substr($search,1),TERM_HASHTAG);
+ $sql_extra .= term_query('item',substr($search,1),TERM_HASHTAG,TERM_COMMUNITYTAG);
}
else {
$sql_extra .= sprintf(" AND item.body like '%s' ",
diff --git a/mod/profile_photo.php b/mod/profile_photo.php
index 7067a9f76..2884505f0 100644
--- a/mod/profile_photo.php
+++ b/mod/profile_photo.php
@@ -6,6 +6,7 @@
*/
require_once('include/photo/photo_driver.php');
+require_once('include/identity.php');
/* @brief Function for sync'ing permissions of profile-photos and their profile
*
@@ -195,6 +196,8 @@ function profile_photo_post(&$a) {
);
}
+ profiles_build_sync(local_channel());
+
// We'll set the updated profile-photo timestamp even if it isn't the default profile,
// so that browsers will do a cache update unconditionally
diff --git a/mod/profiles.php b/mod/profiles.php
index 19e5ffc50..282d741ac 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -1,5 +1,6 @@
<?php
+require_once('include/identity.php');
function profiles_init(&$a) {
@@ -37,6 +38,12 @@ function profiles_init(&$a) {
if($r)
info( t('Profile deleted.') . EOL);
+ // @fixme this is a much more complicated sync - add any changed abook entries and
+ // also add deleted flag to profile structure
+ // profiles_build_sync is just here as a placeholder - it doesn't work at all here
+
+ // profiles_build_sync(local_channel());
+
goaway($a->get_baseurl(true) . '/profiles');
return; // NOTREACHED
}
@@ -118,7 +125,10 @@ function profiles_init(&$a) {
dbesc($name)
);
info( t('New profile created.') . EOL);
- if(count($r3) == 1)
+
+ profiles_build_sync(local_channel());
+
+ if(($r3) && (count($r3) == 1))
goaway($a->get_baseurl(true) . '/profiles/' . $r3[0]['id']);
goaway($a->get_baseurl(true) . '/profiles');
@@ -193,7 +203,6 @@ function profiles_post(&$a) {
$namechanged = false;
- call_hooks('profile_post', $_POST);
// import from json export file.
// Only import fields that are allowed on this hub
@@ -220,6 +229,7 @@ function profiles_post(&$a) {
}
}
+ call_hooks('profile_post', $_POST);
if((argc() > 1) && (argv(1) !== "new") && intval(argv(1))) {
@@ -564,8 +574,6 @@ function profiles_post(&$a) {
}
-
-
function profiles_content(&$a) {
$o = '';
diff --git a/mod/search.php b/mod/search.php
index a0085fca9..555d46f6a 100644
--- a/mod/search.php
+++ b/mod/search.php
@@ -75,9 +75,10 @@ function search_content(&$a,$update = 0, $load = false) {
return $o;
if($tag) {
- $sql_extra = sprintf(" AND `item`.`id` IN (select `oid` from term where otype = %d and type = %d and term = '%s') ",
+ $sql_extra = sprintf(" AND `item`.`id` IN (select `oid` from term where otype = %d and type in ( %d , %d) and term = '%s') ",
intval(TERM_OBJ_POST),
intval(TERM_HASHTAG),
+ intval(TERM_COMMUNITYTAG),
dbesc(protect_sprintf($search))
);
}
diff --git a/mod/search_ac.php b/mod/search_ac.php
index e42945d43..19c1dc940 100644
--- a/mod/search_ac.php
+++ b/mod/search_ac.php
@@ -42,8 +42,9 @@ function search_ac_init(&$a){
}
}
- $r = q("select distinct term, tid, url from term where type = %d $tag_sql_extra group by term order by term asc",
- intval(TERM_HASHTAG)
+ $r = q("select distinct term, tid, url from term where type in ( %d, %d ) $tag_sql_extra group by term order by term asc",
+ intval(TERM_HASHTAG),
+ intval(TERM_COMMUNITYTAG)
);
if(count($r)) {
diff --git a/mod/subthread.php b/mod/subthread.php
index 162545a2f..74d742b6a 100755
--- a/mod/subthread.php
+++ b/mod/subthread.php
@@ -11,18 +11,24 @@ function subthread_content(&$a) {
return;
}
+ $item_id = ((argc() > 2) ? notags(trim(argv(2))) : 0);
+
if(argv(1) === 'sub')
$activity = ACTIVITY_FOLLOW;
elseif(argv(1) === 'unsub')
$activity = ACTIVITY_UNFOLLOW;
- $item_id = ((argc() > 2) ? notags(trim(argv(2))) : 0);
- $r = q("SELECT * FROM `item` WHERE `parent` = '%s' OR `parent_mid` = '%s' and parent = id LIMIT 1",
- dbesc($item_id),
+ $r = q("SELECT parent FROM item WHERE id = '%s'",
dbesc($item_id)
);
+ if($r) {
+ $r = q("select * from item where id = parent and id = %d limit 1",
+ dbesc($r[0]['parent'])
+ );
+ }
+
if((! $item_id) || (! $r)) {
logger('subthread: no item ' . $item_id);
return;
diff --git a/mod/tagger.php b/mod/tagger.php
index 9f9855ed8..27a8a15ea 100644
--- a/mod/tagger.php
+++ b/mod/tagger.php
@@ -123,7 +123,7 @@ function tagger_content(&$a) {
$arr['object'] = $obj;
$arr['parent_mid'] = $item['mid'];
- store_item_tag($item['uid'],$item['id'],TERM_OBJ_POST,TERM_HASHTAG,$term,$tagid);
+ store_item_tag($item['uid'],$item['id'],TERM_OBJ_POST,TERM_COMMUNITYTAG,$term,$tagid);
$ret = post_activity_item($arr);
if($ret['success'])