aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/acl.php2
-rw-r--r--mod/admin.php12
-rw-r--r--mod/channel.php2
-rw-r--r--mod/directory.php2
-rw-r--r--mod/dirsearch.php16
-rw-r--r--mod/dreport.php5
-rw-r--r--mod/editpost.php16
-rwxr-xr-xmod/events.php363
-rw-r--r--mod/feed.php1
-rw-r--r--mod/import.php8
-rw-r--r--mod/invite.php4
-rw-r--r--mod/item.php46
-rw-r--r--mod/mail.php3
-rw-r--r--mod/network.php4
-rw-r--r--mod/page.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
-rw-r--r--mod/settings.php5
-rwxr-xr-xmod/setup.php2
-rw-r--r--mod/siteinfo.php102
-rw-r--r--mod/siteinfo_json.php8
-rwxr-xr-xmod/subthread.php12
-rw-r--r--mod/tagger.php2
-rw-r--r--mod/update_channel.php2
-rw-r--r--mod/update_display.php4
-rw-r--r--mod/update_home.php4
-rw-r--r--mod/update_network.php4
-rw-r--r--mod/update_public.php4
-rw-r--r--mod/update_search.php4
31 files changed, 327 insertions, 341 deletions
diff --git a/mod/acl.php b/mod/acl.php
index dc29e3eff..aaf056b60 100644
--- a/mod/acl.php
+++ b/mod/acl.php
@@ -1,6 +1,6 @@
<?php
-/* ACL selector json backend */
+/* ACL selector json backend */
require_once("include/acl_selectors.php");
function acl_init(&$a){
diff --git a/mod/admin.php b/mod/admin.php
index a884b7658..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);
@@ -1042,7 +1043,12 @@ function admin_page_plugins(&$a){
}
$admin_form = '';
- if (is_array($a->plugins_admin) && in_array($plugin, $a->plugins_admin)){
+
+ $r = q("select * from addon where plugin_admin = 1 and name = '%s' limit 1",
+ dbesc($plugin)
+ );
+
+ if($r) {
@require_once("addon/$plugin/$plugin.php");
if(function_exists($plugin.'_plugin_admin')) {
$func = $plugin.'_plugin_admin';
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/directory.php b/mod/directory.php
index 3c230e173..4ab118b17 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -121,6 +121,8 @@ function directory_content(&$a) {
}
if(! $url) {
$directory = find_upstream_directory($dirmode);
+ if((! $directory) || (! array_key_exists('url',$directory)) || (! $directory['url']))
+ logger('CRITICAL: No directory server URL');
$url = $directory['url'] . '/dirsearch';
}
diff --git a/mod/dirsearch.php b/mod/dirsearch.php
index 937564a79..388e5f3ac 100644
--- a/mod/dirsearch.php
+++ b/mod/dirsearch.php
@@ -26,8 +26,8 @@ function dirsearch_content(&$a) {
$token = get_config('system','realm_token');
if($token && $access_token != $token) {
- $result['message'] = t('This directory server requires an access token');
- return;
+ $ret['message'] = t('This directory server requires an access token');
+ json_return_and_die($ret);
}
@@ -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/dreport.php b/mod/dreport.php
index c320bf0e6..1ad1eca7c 100644
--- a/mod/dreport.php
+++ b/mod/dreport.php
@@ -56,7 +56,7 @@ function dreport_content(&$a) {
return;
}
-
+ $o .= '<div class="generic-content-wrapper-styled">';
$o .= '<h2>' . sprintf( t('Delivery report for %1$s'),substr($mid,0,32)) . '...' . '</h2>';
$o .= '<table>';
@@ -121,6 +121,7 @@ function dreport_content(&$a) {
$o .= '<tr><td width="40%">' . $rr['name'] . '</td><td width="20%">' . escape_tags($rr['dreport_result']) . '</td><td width="20%">' . escape_tags($rr['dreport_time']) . '</td></tr>';
}
$o .= '</table>';
+ $o .= '</div>';
return $o;
@@ -135,4 +136,4 @@ function dreport_gravity_sort($a,$b) {
return strcmp($a['name'],$b['name']);
}
return (($a['gravity'] > $b['gravity']) ? 1 : (-1));
-} \ No newline at end of file
+}
diff --git a/mod/editpost.php b/mod/editpost.php
index 2f999858f..030d8d671 100644
--- a/mod/editpost.php
+++ b/mod/editpost.php
@@ -21,9 +21,9 @@ function editpost_content(&$a) {
return;
}
- $itm = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d and author_xchan = '%s' LIMIT 1",
+ $itm = q("SELECT * FROM `item` WHERE `id` = %d AND ( owner_xchan = '%s' OR author_xchan = '%s' ) LIMIT 1",
intval($post_id),
- intval(local_channel()),
+ dbesc(get_observer_hash()),
dbesc(get_observer_hash())
);
@@ -33,10 +33,12 @@ function editpost_content(&$a) {
}
if($itm[0]['resource_type'] === 'event' && $itm[0]['resource_id']) {
- goaway(z_root() . '/events/event/' . $itm[0]['resource_id']);
+ goaway(z_root() . '/events/' . $itm[0]['resource_id'] . '?expandform=1');
}
+ $owner_uid = $itm[0]['uid'];
+
$plaintext = true;
// if(feature_enabled(local_channel(),'richtext'))
@@ -71,14 +73,12 @@ function editpost_content(&$a) {
call_hooks('jot_tool', $jotplugins);
call_hooks('jot_networks', $jotnets);
- $channel = $a->get_channel();
-
//$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
- $voting = feature_enabled(local_channel(),'consensus_tools');
+ $voting = feature_enabled($owner_uid,'consensus_tools');
$category = '';
- $catsenabled = ((feature_enabled(local_channel(),'categories')) ? 'categories' : '');
+ $catsenabled = ((feature_enabled($owner_uid,'categories')) ? 'categories' : '');
if ($catsenabled){
$itm = fetch_post_tags($itm);
@@ -145,7 +145,7 @@ function editpost_content(&$a) {
'$lockstate' => $lockstate,
'$acl' => '',
'$bang' => '',
- '$profile_uid' => local_channel(),
+ '$profile_uid' => $owner_uid,
'$preview' => t('Preview'),
'$jotplugins' => $jotplugins,
'$sourceapp' => t($a->sourcename),
diff --git a/mod/events.php b/mod/events.php
index d76602a33..74b44906c 100755
--- a/mod/events.php
+++ b/mod/events.php
@@ -90,8 +90,12 @@ function events_post(&$a) {
linkify_tags($a, $desc, local_channel());
linkify_tags($a, $location, local_channel());
- $action = ($event_hash == '') ? 'new' : "event/" . $event_hash;
- $onerror_url = $a->get_baseurl() . "/events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish&type=$type";
+ //$action = ($event_hash == '') ? 'new' : "event/" . $event_hash;
+
+ //fixme: this url gives a wsod if there is a linebreak detected in one of the variables ($desc or $location)
+ //$onerror_url = $a->get_baseurl() . "/events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish&type=$type";
+ $onerror_url = $a->get_baseurl() . "/events";
+
if(strcmp($finish,$start) < 0 && !$nofinish) {
notice( t('Event can not end before it has started.') . EOL);
if(intval($_REQUEST['preview'])) {
@@ -166,7 +170,7 @@ function events_post(&$a) {
'otype' => TERM_OBJ_POST,
'term' => trim($cat),
'url' => $channel['xchan_url'] . '?f=&cat=' . urlencode(trim($cat))
- );
+ );
}
}
@@ -273,39 +277,26 @@ function events_content(&$a) {
);
}
-
- $plaintext = true;
-
-// if(feature_enabled(local_channel(),'richtext'))
-// $plaintext = false;
-
-
+ $first_day = get_pconfig(local_channel(),'system','cal_first_day');
+ $first_day = (($first_day) ? $first_day : 0);
$htpl = get_markup_template('event_head.tpl');
$a->page['htmlhead'] .= replace_macros($htpl,array(
'$baseurl' => $a->get_baseurl(),
- '$editselect' => (($plaintext) ? 'none' : 'textareas')
+ '$lang' => $a->language,
+ '$first_day' => $first_day
));
- $o ="";
- // tabs
+ $o = '';
$channel = $a->get_channel();
- $tabs = profile_tabs($a, True, $channel['channel_address']);
-
-
-
$mode = 'view';
$y = 0;
$m = 0;
$ignored = ((x($_REQUEST,'ignored')) ? " and ignored = " . intval($_REQUEST['ignored']) . " " : '');
if(argc() > 1) {
- if(argc() > 2 && argv(1) == 'event') {
- $mode = 'edit';
- $event_id = argv(2);
- }
if(argc() > 2 && argv(1) === 'add') {
$mode = 'add';
$item_id = intval(argv(2));
@@ -314,15 +305,15 @@ function events_content(&$a) {
$mode = 'drop';
$event_id = argv(2);
}
- if(argv(1) === 'new') {
- $mode = 'new';
- $event_id = '';
- }
if(argc() > 2 && intval(argv(1)) && intval(argv(2))) {
$mode = 'view';
$y = intval(argv(1));
$m = intval(argv(2));
}
+ if(argc() <= 2) {
+ $mode = 'view';
+ $event_id = argv(1);
+ }
}
if($mode === 'add') {
@@ -330,13 +321,149 @@ function events_content(&$a) {
killme();
}
+ if($mode == 'view') {
+ /* edit/create form */
+ if($event_id) {
+ $r = q("SELECT * FROM `event` WHERE event_hash = '%s' AND `uid` = %d LIMIT 1",
+ dbesc($event_id),
+ intval(local_channel())
+ );
+ if(count($r))
+ $orig_event = $r[0];
+ }
+ $channel = $a->get_channel();
+ // Passed parameters overrides anything found in the DB
+ if(!x($orig_event))
+ $orig_event = array();
+
+ // In case of an error the browser is redirected back here, with these parameters filled in with the previous values
+ /*
+ if(x($_REQUEST,'nofinish')) $orig_event['nofinish'] = $_REQUEST['nofinish'];
+ if(x($_REQUEST,'adjust')) $orig_event['adjust'] = $_REQUEST['adjust'];
+ if(x($_REQUEST,'summary')) $orig_event['summary'] = $_REQUEST['summary'];
+ if(x($_REQUEST,'description')) $orig_event['description'] = $_REQUEST['description'];
+ if(x($_REQUEST,'location')) $orig_event['location'] = $_REQUEST['location'];
+ if(x($_REQUEST,'start')) $orig_event['start'] = $_REQUEST['start'];
+ if(x($_REQUEST,'finish')) $orig_event['finish'] = $_REQUEST['finish'];
+ if(x($_REQUEST,'type')) $orig_event['type'] = $_REQUEST['type'];
+ */
+
+ $n_checked = ((x($orig_event) && $orig_event['nofinish']) ? ' checked="checked" ' : '');
+ $a_checked = ((x($orig_event) && $orig_event['adjust']) ? ' checked="checked" ' : '');
+ $t_orig = ((x($orig_event)) ? $orig_event['summary'] : '');
+ $d_orig = ((x($orig_event)) ? $orig_event['description'] : '');
+ $l_orig = ((x($orig_event)) ? $orig_event['location'] : '');
+ $eid = ((x($orig_event)) ? $orig_event['id'] : 0);
+ $event_xchan = ((x($orig_event)) ? $orig_event['event_xchan'] : $channel['channel_hash']);
+ $mid = ((x($orig_event)) ? $orig_event['mid'] : '');
+
+ if(! x($orig_event))
+ $sh_checked = '';
+ else
+ $sh_checked = ((($orig_event['allow_cid'] === '<' . $channel['channel_hash'] . '>' || (! $orig_event['allow_cid'])) && (! $orig_event['allow_gid']) && (! $orig_event['deny_cid']) && (! $orig_event['deny_gid'])) ? '' : ' checked="checked" ' );
+
+ if($orig_event['event_xchan'])
+ $sh_checked .= ' disabled="disabled" ';
+
+ $sdt = ((x($orig_event)) ? $orig_event['start'] : 'now');
+
+ $fdt = ((x($orig_event)) ? $orig_event['finish'] : '+1 hour');
+
+ $tz = date_default_timezone_get();
+ if(x($orig_event))
+ $tz = (($orig_event['adjust']) ? date_default_timezone_get() : 'UTC');
+
+ $syear = datetime_convert('UTC', $tz, $sdt, 'Y');
+ $smonth = datetime_convert('UTC', $tz, $sdt, 'm');
+ $sday = datetime_convert('UTC', $tz, $sdt, 'd');
+ $shour = datetime_convert('UTC', $tz, $sdt, 'H');
+ $sminute = datetime_convert('UTC', $tz, $sdt, 'i');
+
+ $stext = datetime_convert('UTC',$tz,$sdt);
+ $stext = substr($stext,0,14) . "00:00";
+
+ $fyear = datetime_convert('UTC', $tz, $fdt, 'Y');
+ $fmonth = datetime_convert('UTC', $tz, $fdt, 'm');
+ $fday = datetime_convert('UTC', $tz, $fdt, 'd');
+ $fhour = datetime_convert('UTC', $tz, $fdt, 'H');
+ $fminute = datetime_convert('UTC', $tz, $fdt, 'i');
+
+ $ftext = datetime_convert('UTC',$tz,$fdt);
+ $ftext = substr($ftext,0,14) . "00:00";
+
+ $type = ((x($orig_event)) ? $orig_event['type'] : 'event');
+
+ $f = get_config('system','event_input_format');
+ if(! $f)
+ $f = 'ymd';
+
+ $catsenabled = feature_enabled(local_channel(),'categories');
+
+ $category = '';
+
+ if($catsenabled && x($orig_event)){
+ $itm = q("select * from item where resource_type = 'event' and resource_id = '%s' and uid = %d limit 1",
+ dbesc($orig_event['event_hash']),
+ intval(local_channel())
+ );
+ $itm = fetch_post_tags($itm);
+ if($itm) {
+ $cats = get_terms_oftype($itm[0]['term'], TERM_CATEGORY);
+ foreach ($cats as $cat) {
+ if(strlen($category))
+ $category .= ', ';
+ $category .= $cat['term'];
+ }
+ }
+ }
+
+ require_once('include/acl_selectors.php');
+
+ $acl = new AccessList($channel);
+ $perm_defaults = $acl->get();
+
+ $tpl = get_markup_template('event_form.tpl');
+
+ $form = replace_macros($tpl,array(
+ '$post' => $a->get_baseurl() . '/events',
+ '$eid' => $eid,
+ '$type' => $type,
+ '$xchan' => $event_xchan,
+ '$mid' => $mid,
+ '$event_hash' => $event_id,
+ '$summary' => array('summary', (($event_id) ? t('Edit event titel') : t('Event titel')), $t_orig, t('Required'), '*'),
+ '$catsenabled' => $catsenabled,
+ '$placeholdercategory' => t('Categories (comma-separated list)'),
+ '$c_text' => (($event_id) ? t('Edit Category') : t('Category')),
+ '$category' => $category,
+ '$required' => '<span class="required" title="' . t('Required') . '">*</span>',
+ '$s_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$syear+5),DateTime::createFromFormat('Y-m-d H:i',"$syear-$smonth-$sday $shour:$sminute"), (($event_id) ? t('Edit start date and time') : t('Start date and time')), 'start_text',true,true,'','',true,$first_day),
+ '$n_text' => t('Finish date and time are not known or not relevant'),
+ '$n_checked' => $n_checked,
+ '$f_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$fyear+5),DateTime::createFromFormat('Y-m-d H:i',"$fyear-$fmonth-$fday $fhour:$fminute"), (($event_id) ? t('Edit finish date and time') : t('Finish date and time')),'finish_text',true,true,'start_text','',false,$first_day),
+ '$nofinish' => array('nofinish', t('Finish date and time are not known or not relevant'), $n_checked, '', array(t('No'),t('Yes')), 'onclick="enableDisableFinishDate();"'),
+ '$adjust' => array('adjust', t('Adjust for viewer timezone'), $a_checked, t('Important for events that happen in a particular place. Not practical for global holidays.'), array(t('No'),t('Yes'))),
+ '$a_text' => t('Adjust for viewer timezone'),
+ '$d_text' => (($event_id) ? t('Edit Description') : t('Description')),
+ '$d_orig' => $d_orig,
+ '$l_text' => (($event_id) ? t('Edit Location') : t('Location')),
+ '$l_orig' => $l_orig,
+ '$t_orig' => $t_orig,
+ '$sh_text' => t('Share this event'),
+ '$sh_checked' => $sh_checked,
+ '$share' => array('share', t('Share this event'), $sh_checked, '', array(t('No'),t('Yes'))),
+ '$preview' => t('Preview'),
+ '$permissions' => t('Permission settings'),
+ '$acl' => (($orig_event['event_xchan']) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $perm_defaults),false)),
+ '$submit' => t('Submit'),
+ '$advanced' => t('Advanced Options')
+
+ ));
+ /* end edit/create form */
- if($mode == 'view') {
-
-
$thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
$thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m');
if(! $y)
@@ -348,7 +475,6 @@ function events_content(&$a) {
if(argc() === 4 && argv(3) === 'export')
$export = true;
-
// Put some limits on dates. The PHP date functions don't seem to do so well before 1900.
// An upper limit was chosen to keep search engines from exploring links millions of years in the future.
@@ -378,10 +504,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,17 +539,17 @@ 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();
@@ -467,7 +593,7 @@ function events_content(&$a) {
$last_date = $d;
- $edit = (intval($rr['item_wall']) ? array($a->get_baseurl().'/events/event/'.$rr['event_hash'],t('Edit event'),'','') : null);
+ $edit = ((local_channel() && $rr['author_xchan'] == get_observer_hash()) ? array($a->get_baseurl().'/events/'.$rr['event_hash'].'?expandform=1',t('Edit event'),'','') : false);
$drop = array($a->get_baseurl().'/events/drop/'.$rr['event_hash'],t('Delete event'),'','');
@@ -500,7 +626,7 @@ function events_content(&$a) {
}
}
-
+
if($export) {
header('Content-type: text/calendar');
header('content-disposition: attachment; filename="' . t('calendar') . '-' . $channel['channel_address'] . '.ics"' );
@@ -522,22 +648,24 @@ 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',(($event_id) ? t('Edit Event') : t('Create 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'),
+ '$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')
+ '$upload' => t('Import'),
+ '$submit' => t('Submit'),
+ '$prev' => t('Previous'),
+ '$next' => t('Next'),
+ '$today' => t('Today'),
+ '$form' => $form,
+ '$expandform' => ((x($_GET,'expandform')) ? true : false),
));
if (x($_GET,'id')){ echo $o; killme(); }
return $o;
-
}
if($mode === 'drop' && $event_id) {
@@ -570,147 +698,4 @@ function events_content(&$a) {
}
}
- if($mode === 'edit' && $event_id) {
- $r = q("SELECT * FROM `event` WHERE event_hash = '%s' AND `uid` = %d LIMIT 1",
- dbesc($event_id),
- intval(local_channel())
- );
- if(count($r))
- $orig_event = $r[0];
- }
-
- $channel = $a->get_channel();
-
- // Passed parameters overrides anything found in the DB
- if($mode === 'edit' || $mode === 'new') {
- if(!x($orig_event)) $orig_event = array();
- // In case of an error the browser is redirected back here, with these parameters filled in with the previous values
- if(x($_REQUEST,'nofinish')) $orig_event['nofinish'] = $_REQUEST['nofinish'];
- if(x($_REQUEST,'adjust')) $orig_event['adjust'] = $_REQUEST['adjust'];
- if(x($_REQUEST,'summary')) $orig_event['summary'] = $_REQUEST['summary'];
- if(x($_REQUEST,'description')) $orig_event['description'] = $_REQUEST['description'];
- if(x($_REQUEST,'location')) $orig_event['location'] = $_REQUEST['location'];
- if(x($_REQUEST,'start')) $orig_event['start'] = $_REQUEST['start'];
- if(x($_REQUEST,'finish')) $orig_event['finish'] = $_REQUEST['finish'];
- if(x($_REQUEST,'type')) $orig_event['type'] = $_REQUEST['type'];
-
- $n_checked = ((x($orig_event) && $orig_event['nofinish']) ? ' checked="checked" ' : '');
- $a_checked = ((x($orig_event) && $orig_event['adjust']) ? ' checked="checked" ' : '');
- $t_orig = ((x($orig_event)) ? $orig_event['summary'] : '');
- $d_orig = ((x($orig_event)) ? $orig_event['description'] : '');
- $l_orig = ((x($orig_event)) ? $orig_event['location'] : '');
- $eid = ((x($orig_event)) ? $orig_event['id'] : 0);
- $event_xchan = ((x($orig_event)) ? $orig_event['event_xchan'] : $channel['channel_hash']);
- $mid = ((x($orig_event)) ? $orig_event['mid'] : '');
-
- if(! x($orig_event))
- $sh_checked = '';
- else
- $sh_checked = ((($orig_event['allow_cid'] === '<' . $channel['channel_hash'] . '>' || (! $orig_event['allow_cid'])) && (! $orig_event['allow_gid']) && (! $orig_event['deny_cid']) && (! $orig_event['deny_gid'])) ? '' : ' checked="checked" ' );
-
- if($orig_event['event_xchan'])
- $sh_checked .= ' disabled="disabled" ';
-
- $sdt = ((x($orig_event)) ? $orig_event['start'] : 'now');
- $fdt = ((x($orig_event)) ? $orig_event['finish'] : 'now');
-
- $tz = date_default_timezone_get();
- if(x($orig_event))
- $tz = (($orig_event['adjust']) ? date_default_timezone_get() : 'UTC');
-
- $syear = datetime_convert('UTC', $tz, $sdt, 'Y');
- $smonth = datetime_convert('UTC', $tz, $sdt, 'm');
- $sday = datetime_convert('UTC', $tz, $sdt, 'd');
-
-
- $shour = ((x($orig_event)) ? datetime_convert('UTC', $tz, $sdt, 'H') : 0);
- $sminute = ((x($orig_event)) ? datetime_convert('UTC', $tz, $sdt, 'i') : 0);
- $stext = datetime_convert('UTC',$tz,$sdt);
- $stext = substr($stext,0,14) . "00:00";
-
- $fyear = datetime_convert('UTC', $tz, $fdt, 'Y');
- $fmonth = datetime_convert('UTC', $tz, $fdt, 'm');
- $fday = datetime_convert('UTC', $tz, $fdt, 'd');
-
- $fhour = ((x($orig_event)) ? datetime_convert('UTC', $tz, $fdt, 'H') : 0);
- $fminute = ((x($orig_event)) ? datetime_convert('UTC', $tz, $fdt, 'i') : 0);
- $ftext = datetime_convert('UTC',$tz,$fdt);
- $ftext = substr($ftext,0,14) . "00:00";
- $type = ((x($orig_event)) ? $orig_event['type'] : 'event');
-
- $f = get_config('system','event_input_format');
- if(! $f)
- $f = 'ymd';
-
- $catsenabled = feature_enabled(local_channel(),'categories');
-
- $category = '';
-
- if($catsenabled && x($orig_event)){
- $itm = q("select * from item where resource_type = 'event' and resource_id = '%s' and uid = %d limit 1",
- dbesc($orig_event['event_hash']),
- intval(local_channel())
- );
- $itm = fetch_post_tags($itm);
- if($itm) {
- $cats = get_terms_oftype($itm[0]['term'], TERM_CATEGORY);
- foreach ($cats as $cat) {
- if(strlen($category))
- $category .= ', ';
- $category .= $cat['term'];
- }
- }
- }
-
- require_once('include/acl_selectors.php');
-
- $acl = new AccessList($channel);
- $perm_defaults = $acl->get();
-
-
- $tpl = get_markup_template('event_form.tpl');
-
- $o .= replace_macros($tpl,array(
- '$post' => $a->get_baseurl() . '/events',
- '$eid' => $eid,
- '$type' => $type,
- '$xchan' => $event_xchan,
- '$mid' => $mid,
- '$event_hash' => $event_id,
-
- '$title' => t('Event details'),
- '$desc' => t('Starting date and Title are required.'),
- '$catsenabled' => $catsenabled,
- '$placeholdercategory' => t('Categories (comma-separated list)'),
- '$category' => $category,
- '$s_text' => t('Event Starts:'),
- '$stext' => $stext,
- '$ftext' => $ftext,
- '$required' => '<span class="required" title="' . t('Required') . '">*</span>',
- '$ModalCANCEL' => t('Cancel'),
- '$ModalOK' => t('OK'),
- '$s_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$syear+5),DateTime::createFromFormat('Y-m-d H:i',"$syear-$smonth-$sday $shour:$sminute"),'start_text',true,true,'','',true),
- '$n_text' => t('Finish date/time is not known or not relevant'),
- '$n_checked' => $n_checked,
- '$f_text' => t('Event Finishes:'),
- '$f_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$fyear+5),DateTime::createFromFormat('Y-m-d H:i',"$fyear-$fmonth-$fday $fhour:$fminute"),'finish_text',true,true,'start_text'),
- '$adjust' => array('adjust', t('Adjust for viewer timezone'), $a_checked, t('Important for events that happen in a particular place. Not practical for global holidays.'),),
- '$a_text' => t('Adjust for viewer timezone'),
- '$d_text' => t('Description:'),
- '$d_orig' => $d_orig,
- '$l_text' => t('Location:'),
- '$l_orig' => $l_orig,
- '$t_text' => t('Title:'),
- '$t_orig' => $t_orig,
- '$sh_text' => t('Share this event'),
- '$sh_checked' => $sh_checked,
- '$preview' => t('Preview'),
- '$permissions' => t('Permissions'),
- '$acl' => (($orig_event['event_xchan']) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $perm_defaults),false)),
- '$submit' => t('Submit')
-
- ));
-
- return $o;
- }
}
diff --git a/mod/feed.php b/mod/feed.php
index 3b622fc17..eb72af9cf 100644
--- a/mod/feed.php
+++ b/mod/feed.php
@@ -15,6 +15,7 @@ function feed_init(&$a) {
$params['start'] = ((x($params,'start')) ? intval($params['start']) : 0);
$params['records'] = ((x($params,'records')) ? intval($params['records']) : 40);
$params['direction'] = ((x($params,'direction')) ? dbesc($params['direction']) : 'desc');
+ $params['cat'] = ((x($_REQUEST,'cat')) ? escape_tags($_REQUEST['cat']) : '');
$channel = '';
if(argc() > 1) {
diff --git a/mod/import.php b/mod/import.php
index a33cf339b..02e71233a 100644
--- a/mod/import.php
+++ b/mod/import.php
@@ -123,12 +123,12 @@ function import_account(&$a, $account_id) {
if(array_key_exists('channel',$data)) {
if($completed < 1) {
- $channel = import_channel($data['channel']);
+ $channel = import_channel($data['channel'], $account_id);
}
else {
$r = q("select * from channel where channel_account_id = %d and channel_guid = '%s' limit 1",
- intval(get_account_id()),
+ intval($account_id),
dbesc($channel['channel_guid'])
);
if($r)
@@ -166,7 +166,7 @@ function import_account(&$a, $account_id) {
if($data['photo']) {
require_once('include/photo/photo_driver.php');
- import_channel_photo(base64url_decode($data['photo']['data']),$data['photo']['type'],get_account_id(),$channel['channel_id']);
+ import_channel_photo(base64url_decode($data['photo']['data']),$data['photo']['type'],$account_id,$channel['channel_id']);
}
if(is_array($data['profile']))
@@ -335,7 +335,7 @@ function import_account(&$a, $account_id) {
unset($abook['abook_id']);
unset($abook['abook_rating']);
unset($abook['abook_rating_text']);
- $abook['abook_account'] = get_account_id();
+ $abook['abook_account'] = $account_id;
$abook['abook_channel'] = $channel['channel_id'];
if(! array_key_exists('abook_blocked',$abook)) {
$abook['abook_blocked'] = (($abook['abook_flags'] & 0x0001 ) ? 1 : 0);
diff --git a/mod/invite.php b/mod/invite.php
index 46fa7b413..1af5fc1f8 100644
--- a/mod/invite.php
+++ b/mod/invite.php
@@ -51,7 +51,7 @@ function invite_post(&$a) {
}
if($invonly && ($x || is_site_admin())) {
- $code = autoname(8) . srand(1000,9999);
+ $code = autoname(8) . rand(1000,9999);
$nmessage = str_replace('$invite_code',$code,$message);
$r = q("INSERT INTO `register` (`hash`,`created`) VALUES ('%s', '%s') ",
@@ -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 5f45a248b..f32ff8844 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -473,8 +473,9 @@ function item_post(&$a) {
require_once('include/text.php');
if($uid && $uid == $profile_uid && feature_enabled($uid,'markdown')) {
require_once('include/bb2diaspora.php');
- $body = escape_tags($body);
+ $body = escape_tags(trim($body));
$body = str_replace("\n",'<br />', $body);
+
$body = preg_replace_callback('/\[share(.*?)\]/ism','share_shield',$body);
$body = diaspora2bb($body,true);
$body = preg_replace_callback('/\[share(.*?)\]/ism','share_unshield',$body);
@@ -650,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);
@@ -702,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;
@@ -780,6 +808,22 @@ function item_post(&$a) {
if($orig_post)
$datarray['edit'] = true;
+
+
+ if(feature_enabled($profile_uid,'suppress_duplicates') && (! $orig_post)) {
+
+ $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/mail.php b/mod/mail.php
index 536149a28..44c4b479d 100644
--- a/mod/mail.php
+++ b/mod/mail.php
@@ -329,7 +329,8 @@ function mail_content(&$a) {
'to_url' => chanlink_hash($message['to_xchan']),
'to_photo' => $message['to']['xchan_photo_s'],
'subject' => $message['title'],
- 'body' => smilies(bbcode($message['body']) . $s),
+ 'body' => smilies(bbcode($message['body'])),
+ 'attachments' => $s,
'delete' => t('Delete message'),
'dreport' => t('Delivery report'),
'recall' => t('Recall message'),
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/page.php b/mod/page.php
index b635a60f2..ae572ca1e 100644
--- a/mod/page.php
+++ b/mod/page.php
@@ -131,6 +131,10 @@ function page_content(&$a) {
xchan_query($r);
$r = fetch_post_tags($r,true);
+
+ if($r[0]['mimetype'] === 'application/x-pdl')
+ $a->page['pdl_content'] = true;
+
$o .= prepare_page($r[0]);
return $o;
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/settings.php b/mod/settings.php
index 9a18d8e48..339f83cfe 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -405,7 +405,6 @@ function settings_post(&$a) {
$allow_location = (((x($_POST,'allow_location')) && (intval($_POST['allow_location']) == 1)) ? 1: 0);
-
$blocktags = (((x($_POST,'blocktags')) && (intval($_POST['blocktags']) == 1)) ? 0: 1); // this setting is inverted!
$unkmail = (((x($_POST,'unkmail')) && (intval($_POST['unkmail']) == 1)) ? 1: 0);
$cntunkmail = ((x($_POST,'cntunkmail')) ? intval($_POST['cntunkmail']) : 0);
@@ -416,6 +415,8 @@ function settings_post(&$a) {
$post_profilechange = (($_POST['post_profilechange'] == 1) ? 1: 0);
$adult = (($_POST['adult'] == 1) ? 1 : 0);
+ $cal_first_day = (((x($_POST,'first_day')) && (intval($_POST['first_day']) == 1)) ? 1: 0);
+
$channel = $a->get_channel();
$pageflags = $channel['channel_pageflags'];
$existing_adult = (($pageflags & PAGE_ADULT) ? 1 : 0);
@@ -503,6 +504,7 @@ function settings_post(&$a) {
set_pconfig(local_channel(),'system','evdays',$evdays);
set_pconfig(local_channel(),'system','photo_path',$photo_path);
set_pconfig(local_channel(),'system','attach_path',$attach_path);
+ set_pconfig(local_channel(),'system','cal_first_day',$cal_first_day);
$r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d $set_perms where channel_id = %d",
dbesc($username),
@@ -1110,6 +1112,7 @@ function settings_content(&$a) {
'$removeme' => t('Remove Channel'),
'$removechannel' => t('Remove this channel.'),
'$firefoxshare' => t('Firefox Share $Projectname provider'),
+ '$cal_first_day' => array('first_day', t('Start calendar week on monday'), ((get_pconfig(local_channel(),'system','cal_first_day')) ? 1 : ''), '', $yes_no),
));
call_hooks('settings_form',$o);
diff --git a/mod/setup.php b/mod/setup.php
index e5ac25965..5c9e988d9 100755
--- a/mod/setup.php
+++ b/mod/setup.php
@@ -14,7 +14,7 @@ $install_wizard_pass = 1;
*
* @param[in,out] App &$a
*/
-function setup_init(&$a){
+function setup_init(&$a) {
// Ensure that if somebody hasn't read the install documentation and doesn't have all
// the required modules or has a totally borked shared hosting provider and they can't
diff --git a/mod/siteinfo.php b/mod/siteinfo.php
index 2fffccc73..52d014de1 100644
--- a/mod/siteinfo.php
+++ b/mod/siteinfo.php
@@ -1,104 +1,8 @@
<?php
function siteinfo_init(&$a) {
- global $db;
-
- if ($a->argv[1]=="json"){
- $register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN');
- $directory_mode = Array('DIRECTORY_MODE_NORMAL', 'DIRECTORY_MODE_SECONDARY','DIRECTORY_MODE_PRIMARY', 'DIRECTORY_MODE_STANDALONE');
-
- $sql_extra = '';
-
- $r = q("select * from channel left join account on account_id = channel_account_id where ( account_roles & 4096 )>0 and account_default_channel = channel_id");
-
-
- if($r) {
- $admin = array();
- foreach($r as $rr) {
- if($rr['channel_pageflags'] & PAGE_HUBADMIN)
- $admin[] = array( 'name' => $rr['channel_name'], 'address' => $rr['channel_address'] . '@' . get_app()->get_hostname(), 'channel' => z_root() . '/channel/' . $rr['channel_address']);
- }
- if(! $admin) {
- foreach($r as $rr) {
- $admin[] = array( 'name' => $rr['channel_name'], 'address' => $rr['channel_address'] . '@' . get_app()->get_hostname(), 'channel' => z_root() . '/channel/' . $rr['channel_address']);
- }
- }
- }
- else {
- $admin = false;
- }
-
- $def_service_class = get_config('system','default_service_class');
- if($def_service_class)
- $service_class = get_config('service_class',$def_service_class);
- else
- $service_class = false;
-
- $visible_plugins = array();
- if(is_array($a->plugins) && count($a->plugins)) {
- $r = q("select * from addon where hidden = 0");
- if(count($r))
- foreach($r as $rr)
- $visible_plugins[] = $rr['name'];
- }
- sort($visible_plugins);
-
- if(@is_dir('.git') && function_exists('shell_exec'))
- $commit = trim(@shell_exec('git log -1 --format="%h"'));
- if(! isset($commit) || strlen($commit) > 16)
- $commit = '';
-
- $site_info = get_config('system','info');
- $site_name = get_config('system','sitename');
- if(! get_config('system','hidden_version_siteinfo')) {
- $version = RED_VERSION;
- if(@is_dir('.git') && function_exists('shell_exec')) {
- $commit = trim( @shell_exec('git log -1 --format="%h"'));
- if(! get_config('system','hidden_tag_siteinfo'))
- $tag = trim( @shell_exec('git describe --tags --abbrev=0'));
- else
- $tag = '';
- }
- if(! isset($commit) || strlen($commit) > 16)
- $commit = '';
- }
- else {
- $version = $commit = '';
- }
-
- //Statistics
- $channels_total_stat = intval(get_config('system','channels_total_stat'));
- $channels_active_halfyear_stat = intval(get_config('system','channels_active_halfyear_stat'));
- $channels_active_monthly_stat = intval(get_config('system','channels_active_monthly_stat'));
- $local_posts_stat = intval(get_config('system','local_posts_stat'));
- $hide_in_statistics = intval(get_config('system','hide_in_statistics'));
- $site_expire = intval(get_config('system', 'default_expire_days'));
-
-
- $data = Array(
- 'version' => $version,
- 'version_tag' => $tag,
- 'commit' => $commit,
- 'url' => z_root(),
- 'plugins' => $visible_plugins,
- 'register_policy' => $register_policy[$a->config['system']['register_policy']],
- 'directory_mode' => $directory_mode[$a->config['system']['directory_mode']],
- 'language' => get_config('system','language'),
- 'rss_connections' => get_config('system','feed_contacts'),
- 'expiration' => $site_expire,
- 'default_service_restrictions' => $service_class,
- 'admin' => $admin,
- 'site_name' => (($site_name) ? $site_name : ''),
- 'platform' => PLATFORM_NAME,
- 'dbdriver' => $db->getdriver(),
- 'lastpoll' => get_config('system','lastpoll'),
- 'info' => (($site_info) ? $site_info : ''),
- 'channels_total' => $channels_total_stat,
- 'channels_active_halfyear' => $channels_active_halfyear_stat,
- 'channels_active_monthly' => $channels_active_monthly_stat,
- 'local_posts' => $local_posts_stat,
- 'hide_in_statistics' => $hide_in_statistics
- );
+ if (argv(1) === 'json') {
+ $data = get_site_info();
json_return_and_die($data);
}
}
@@ -111,7 +15,7 @@ function siteinfo_content(&$a) {
$version = sprintf( t('Version %s'), RED_VERSION );
if(@is_dir('.git') && function_exists('shell_exec')) {
$commit = @shell_exec('git log -1 --format="%h"');
- $tag = @shell_exec('git describe --tags --abbrev=0');
+ $tag = get_std_version(); // @shell_exec('git describe --tags --abbrev=0');
}
if(! isset($commit) || strlen($commit) > 16)
$commit = '';
diff --git a/mod/siteinfo_json.php b/mod/siteinfo_json.php
new file mode 100644
index 000000000..35697917c
--- /dev/null
+++ b/mod/siteinfo_json.php
@@ -0,0 +1,8 @@
+<?php
+
+function siteinfo_json_init(&$a) {
+
+ $data = get_site_info();
+ json_return_and_die($data);
+
+}
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'])
diff --git a/mod/update_channel.php b/mod/update_channel.php
index 5f4436d59..63a3735ea 100644
--- a/mod/update_channel.php
+++ b/mod/update_channel.php
@@ -39,6 +39,7 @@ function update_channel_content(&$a) {
$replace = "<img\${1} dst=\"\${2}\"";
// $text = preg_replace($pattern, $replace, $text);
+/*
if(! $load) {
$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
@@ -50,6 +51,7 @@ function update_channel_content(&$a) {
$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
$text = preg_replace($pattern, $replace, $text);
}
+*/
/**
* reportedly some versions of MSIE don't handle tabs in XMLHttpRequest documents very well
diff --git a/mod/update_display.php b/mod/update_display.php
index d41e2e5cb..b448c76ee 100644
--- a/mod/update_display.php
+++ b/mod/update_display.php
@@ -20,7 +20,7 @@ function update_display_content(&$a) {
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
$replace = "<img\${1} dst=\"\${2}\"";
// $text = preg_replace($pattern, $replace, $text);
-
+/*
if(! $load) {
$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
@@ -32,7 +32,7 @@ function update_display_content(&$a) {
$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
$text = preg_replace($pattern, $replace, $text);
}
-
+*/
echo str_replace("\t",' ',$text);
echo (($_GET['msie'] == 1) ? '</div>' : '</section>');
echo "</body></html>\r\n";
diff --git a/mod/update_home.php b/mod/update_home.php
index 80ae2438f..4a8000bdb 100644
--- a/mod/update_home.php
+++ b/mod/update_home.php
@@ -16,7 +16,7 @@ function update_home_content(&$a) {
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
$replace = "<img\${1} dst=\"\${2}\"";
// $text = preg_replace($pattern, $replace, $text);
-
+/*
if(! $load) {
$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
@@ -28,7 +28,7 @@ function update_home_content(&$a) {
$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
$text = preg_replace($pattern, $replace, $text);
}
-
+*/
echo str_replace("\t",' ',$text);
echo ((array_key_exists('msie',$_GET) && $_GET['msie'] == 1) ? '</div>' : '</section>');
echo "</body></html>\r\n";
diff --git a/mod/update_network.php b/mod/update_network.php
index acd5ccdc8..03c12312c 100644
--- a/mod/update_network.php
+++ b/mod/update_network.php
@@ -18,7 +18,7 @@ function update_network_content(&$a) {
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
$replace = "<img\${1} dst=\"\${2}\"";
// $text = preg_replace($pattern, $replace, $text);
-
+/*
if(! $load) {
$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
@@ -30,7 +30,7 @@ function update_network_content(&$a) {
$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
$text = preg_replace($pattern, $replace, $text);
}
-
+*/
echo str_replace("\t",' ',$text);
echo ((array_key_exists('msie',$_GET) && $_GET['msie'] == 1) ? '</div>' : '</section>');
echo "</body></html>\r\n";
diff --git a/mod/update_public.php b/mod/update_public.php
index bac1ccf15..fcec792f6 100644
--- a/mod/update_public.php
+++ b/mod/update_public.php
@@ -16,7 +16,7 @@ function update_public_content(&$a) {
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
$replace = "<img\${1} dst=\"\${2}\"";
// $text = preg_replace($pattern, $replace, $text);
-
+/*
if(! $load) {
$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
@@ -28,7 +28,7 @@ function update_public_content(&$a) {
$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
$text = preg_replace($pattern, $replace, $text);
}
-
+*/
echo str_replace("\t",' ',$text);
echo ((array_key_exists('msie',$_GET) && $_GET['msie'] == 1) ? '</div>' : '</section>');
echo "</body></html>\r\n";
diff --git a/mod/update_search.php b/mod/update_search.php
index de29e89bd..25bcffcb6 100644
--- a/mod/update_search.php
+++ b/mod/update_search.php
@@ -41,7 +41,7 @@ function update_search_content(&$a) {
$pattern = "/<img([^>]*) src=\"([^\"]*)\"/";
$replace = "<img\${1} dst=\"\${2}\"";
// $text = preg_replace($pattern, $replace, $text);
-
+/*
if(! $load) {
$replace = '<br />' . t('[Embedded content - reload page to view]') . '<br />';
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
@@ -53,7 +53,7 @@ function update_search_content(&$a) {
$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
$text = preg_replace($pattern, $replace, $text);
}
-
+*/
/**
* reportedly some versions of MSIE don't handle tabs in XMLHttpRequest documents very well
*/