aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Channel_calendar.php191
-rw-r--r--Zotlabs/Module/Like.php6
-rw-r--r--Zotlabs/Module/Register.php12
3 files changed, 54 insertions, 155 deletions
diff --git a/Zotlabs/Module/Channel_calendar.php b/Zotlabs/Module/Channel_calendar.php
index ad748401f..e513a7f6e 100644
--- a/Zotlabs/Module/Channel_calendar.php
+++ b/Zotlabs/Module/Channel_calendar.php
@@ -69,20 +69,15 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
$finish = datetime_convert('UTC','UTC',$finish);
}
-
- // Don't allow the event to finish before it begins.
- // It won't hurt anything, but somebody will file a bug report
- // and we'll waste a bunch of time responding to it. Time that
- // could've been spent doing something else.
-
$summary = escape_tags(trim($_POST['summary']));
$desc = escape_tags(trim($_POST['desc']));
$location = escape_tags(trim($_POST['location']));
$type = escape_tags(trim($_POST['type']));
- require_once('include/text.php');
- linkify_tags($desc, local_channel());
- linkify_tags($location, local_channel());
+ // Don't allow the event to finish before it begins.
+ // It won't hurt anything, but somebody will file a bug report
+ // and we'll waste a bunch of time responding to it. Time that
+ // could've been spent doing something else.
if(strcmp($finish,$start) < 0 && !$nofinish) {
notice( t('Event can not end before it has started.') . EOL);
@@ -131,12 +126,40 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
$post_tags = array();
$channel = \App::get_channel();
$ac = $acl->get();
-
+
+ $str_contact_allow = $ac['allow_cid'];
+ $str_group_allow = $ac['allow_gid'];
+ $str_contact_deny = $ac['deny_cid'];
+ $str_group_deny = $ac['deny_gid'];
+
+ $private = $acl->is_private();
+
+ require_once('include/text.php');
+ $results = linkify_tags($desc, local_channel());
+
+ if($results) {
+ // Set permissions based on tag replacements
+ set_linkified_perms($results, $str_contact_allow, $str_group_allow, local_channel(), false, $private);
+
+ foreach($results as $result) {
+ $success = $result['success'];
+ if($success['replaced']) {
+ $post_tags[] = array(
+ 'uid' => local_channel(),
+ 'ttype' => $success['termtype'],
+ 'otype' => TERM_OBJ_POST,
+ 'term' => $success['term'],
+ 'url' => $success['url']
+ );
+ }
+ }
+ }
+
if(strlen($categories)) {
$cats = explode(',',$categories);
foreach($cats as $cat) {
$post_tags[] = array(
- 'uid' => $profile_uid,
+ 'uid' => local_channel(),
'ttype' => TERM_CATEGORY,
'otype' => TERM_OBJ_POST,
'term' => trim($cat),
@@ -157,11 +180,11 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
$datarray['uid'] = local_channel();
$datarray['account'] = get_account_id();
$datarray['event_xchan'] = $channel['channel_hash'];
- $datarray['allow_cid'] = $ac['allow_cid'];
- $datarray['allow_gid'] = $ac['allow_gid'];
- $datarray['deny_cid'] = $ac['deny_cid'];
- $datarray['deny_gid'] = $ac['deny_gid'];
- $datarray['private'] = (($acl->is_private()) ? 1 : 0);
+ $datarray['allow_cid'] = $str_contact_allow;
+ $datarray['allow_gid'] = $str_group_allow;
+ $datarray['deny_cid'] = $str_contact_deny;
+ $datarray['deny_gid'] = $str_group_deny;
+ $datarray['private'] = intval($private);
$datarray['id'] = $event_id;
$datarray['created'] = $created;
$datarray['edited'] = $edited;
@@ -250,8 +273,6 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
$mode = 'view';
$export = false;
- //$y = 0;
- //$m = 0;
$ignored = ((x($_REQUEST,'ignored')) ? " and dismissed = " . intval($_REQUEST['ignored']) . " " : '');
if(argc() > 1) {
@@ -268,8 +289,6 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
}
if(argc() > 2 && intval(argv(1)) && intval(argv(2))) {
$mode = 'view';
- //$y = intval(argv(1));
- //$m = intval(argv(2));
}
if(argc() <= 2) {
$mode = 'view';
@@ -296,88 +315,6 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
$channel = \App::get_channel();
-/*
- // Passed parameters overrides anything found in the DB
- if(!x($orig_event))
- $orig_event = array();
-
- $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'] : '');
-
- $sdt = ((x($orig_event)) ? $orig_event['dtstart'] : 'now');
-
- $fdt = ((x($orig_event)) ? $orig_event['dtend'] : '+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['etype'] : 'event');
-
- $f = get_config('system','event_input_format');
- if(! $f)
- $f = 'ymd';
-
- $thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
- $thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m');
- if(! $y)
- $y = intval($thisyear);
- if(! $m)
- $m = intval($thismonth);
-
-
- // 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.
-
- if($y < 1901)
- $y = 1900;
- if($y > 2099)
- $y = 2100;
-
- $nextyear = $y;
- $nextmonth = $m + 1;
- if($nextmonth > 12) {
- $nextmonth = 1;
- $nextyear ++;
- }
-
- $prevyear = $y;
- if($m > 1)
- $prevmonth = $m - 1;
- else {
- $prevmonth = 12;
- $prevyear --;
- }
-
- $dim = get_dim($y,$m);
- $start = sprintf('%d-%d-%d %d:%d:%d',$y,$m,1,0,0,0);
- $finish = sprintf('%d-%d-%d %d:%d:%d',$y,$m,$dim,23,59,59);
-*/
-
if (argv(1) === 'json'){
if (x($_GET,'start')) $start = $_GET['start'];
if (x($_GET,'end')) $finish = $_GET['end'];
@@ -422,8 +359,6 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
}
- //$links = [];
-
if($r && ! $export) {
xchan_query($r);
$r = fetch_post_tags($r,true);
@@ -431,28 +366,12 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
$r = sort_by_date($r);
}
-/*
- if($r) {
- foreach($r as $rr) {
- $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], 'j') : datetime_convert('UTC','UTC',$rr['dtstart'],'j'));
- if(! x($links,$j))
- $links[$j] = z_root() . '/' . \App::$cmd . '#link-' . $j;
- }
- }
-*/
-
$events = [];
- //$last_date = '';
- //$fmt = t('l, F j');
-
if($r) {
foreach($r as $rr) {
- //$j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], 'j') : datetime_convert('UTC','UTC',$rr['dtstart'],'j'));
- //$d = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], $fmt) : datetime_convert('UTC','UTC',$rr['dtstart'],$fmt));
- //$d = day_translate($d);
-
+
$start = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['dtstart'], 'c') : datetime_convert('UTC','UTC',$rr['dtstart'],'c'));
if ($rr['nofinish']){
$end = null;
@@ -487,53 +406,29 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
if(strpos($start, 'T00:00:00') && strpos($end, 'T00:00:00'))
$allDay = true;
- //$is_first = ($d !== $last_date);
-
- //$last_date = $d;
-
$edit = ((local_channel() && $rr['author_xchan'] == get_observer_hash()) ? array(z_root().'/events/'.$rr['event_hash'].'?expandform=1',t('Edit event'),'','') : false);
$drop = array(z_root().'/events/drop/'.$rr['event_hash'],t('Delete event'),'','');
- //$title = strip_tags(html_entity_decode(zidify_links(bbcode($rr['summary'])),ENT_QUOTES,'UTF-8'));
- //if(! $title) {
- // list($title, $_trash) = explode("<br",bbcode($rr['desc']),2);
- // $title = strip_tags(html_entity_decode($title,ENT_QUOTES,'UTF-8'));
- //}
- //$html = format_event_html($rr);
- //$rr['desc'] = zidify_links(smilies(bbcode($rr['desc'])));
- //$rr['description'] = htmlentities(html2plain(bbcode($rr['description'])),ENT_COMPAT,'UTF-8',false);
- //$rr['location'] = zidify_links(smilies(bbcode($rr['location'])));
$events[] = array(
'calendar_id' => 'channel_calendar',
'rw' => true,
-
'id'=>$rr['id'],
'uri' => $rr['event_hash'],
'start'=> $start,
'end' => $end,
'drop' => $drop,
'allDay' => $allDay,
- 'title' => htmlentities($rr['summary'], ENT_COMPAT, 'UTF-8'),
-
- //'j' => $j,
- //'d' => $d,
-
+ 'title' => htmlentities($rr['summary'], ENT_COMPAT, 'UTF-8', false),
'editable' => $edit ? true : false,
-
- //'is_first'=>$is_first,
'item'=>$rr,
- //'html'=>$html,
'plink' => [$rr['plink'], t('Link to source')],
-
- 'description' => htmlentities($rr['description'], ENT_COMPAT, 'UTF-8'),
- 'location' => htmlentities($rr['location'], ENT_COMPAT, 'UTF-8'),
-
+ 'description' => htmlentities($rr['description'], ENT_COMPAT, 'UTF-8', false),
+ 'location' => htmlentities($rr['location'], ENT_COMPAT, 'UTF-8', false),
'allow_cid' => expand_acl($rr['allow_cid']),
'allow_gid' => expand_acl($rr['allow_gid']),
'deny_cid' => expand_acl($rr['deny_cid']),
'deny_gid' => expand_acl($rr['deny_gid']),
-
'categories' => $categories
);
}
diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php
index 3d1f503b6..052d51d43 100644
--- a/Zotlabs/Module/Like.php
+++ b/Zotlabs/Module/Like.php
@@ -491,7 +491,7 @@ class Like extends \Zotlabs\Web\Controller {
$arr['item_flags'] = $item_flags;
$arr['item_wall'] = $item_wall;
- $arr['parent_mid'] = (($extended_like) ? $mid : $item['mid']);
+ $arr['parent_mid'] = (($extended_like) ? $arr['mid'] : $item['mid']);
$arr['owner_xchan'] = (($extended_like) ? $ch[0]['xchan_hash'] : $thread_owner['xchan_hash']);
$arr['author_xchan'] = $observer['xchan_hash'];
@@ -546,7 +546,7 @@ class Like extends \Zotlabs\Web\Controller {
dbesc($observer['xchan_hash']),
dbesc($ch[0]['channel_hash']),
intval($post_id),
- dbesc($mid),
+ dbesc($arr['mid']),
dbesc($activity),
dbesc(($tgttype)? $tgttype : $objtype),
dbesc($obj_id),
@@ -555,7 +555,7 @@ class Like extends \Zotlabs\Web\Controller {
$r = q("select * from likes where liker = '%s' and likee = '%s' and i_mid = '%s' and verb = '%s' and target_type = '%s' and target_id = '%s' ",
dbesc($observer['xchan_hash']),
dbesc($ch[0]['channel_hash']),
- dbesc($mid),
+ dbesc($arr['mid']),
dbesc($activity),
dbesc(($tgttype)? $tgttype : $objtype),
dbesc($obj_id)
diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php
index f9d81be0c..bc813f8e1 100644
--- a/Zotlabs/Module/Register.php
+++ b/Zotlabs/Module/Register.php
@@ -1,10 +1,11 @@
<?php
namespace Zotlabs\Module;
-require_once('include/channel.php');
+use Zotlabs\Web\Controller;
+require_once('include/security.php');
-class Register extends \Zotlabs\Web\Controller {
+class Register extends Controller {
function init() {
@@ -39,7 +40,9 @@ class Register extends \Zotlabs\Web\Controller {
function post() {
-
+
+ check_form_security_token_redirectOnErr('/register', 'register');
+
$max_dailies = intval(get_config('system','max_daily_registrations'));
if($max_dailies) {
$r = q("select count(account_id) as total from account where account_created > %s - INTERVAL %s",
@@ -269,7 +272,8 @@ class Register extends \Zotlabs\Web\Controller {
require_once('include/bbcode.php');
$o = replace_macros(get_markup_template('register.tpl'), array(
-
+
+ '$form_security_token' => get_form_security_token("register"),
'$title' => t('Registration'),
'$reg_is' => $registration_is,
'$registertext' => bbcode(get_config('system','register_text')),