1
0
Fork 0

more infrastructure for ignored events

This commit is contained in:
friendica 2012-09-18 22:49:05 -07:00
parent 66081201bc
commit 0b59d30e34

View file

@ -141,6 +141,20 @@ function events_content(&$a) {
return; return;
} }
if(($a->argc > 2) && ($a->argv[1] === 'ignore') && intval($a->argv[2])) {
$r = q("update event set ignore = 1 where id = %d and uid = %d limit 1",
intval($a->argv[2]),
intval(local_user())
);
}
if(($a->argc > 2) && ($a->argv[1] === 'unignore') && intval($a->argv[2])) {
$r = q("update event set ignore = 0 where id = %d and uid = %d limit 1",
intval($a->argv[2]),
intval(local_user())
);
}
$htpl = get_markup_template('event_head.tpl'); $htpl = get_markup_template('event_head.tpl');
$a->page['htmlhead'] .= replace_macros($htpl,array('$baseurl' => $a->get_baseurl())); $a->page['htmlhead'] .= replace_macros($htpl,array('$baseurl' => $a->get_baseurl()));
@ -157,6 +171,7 @@ function events_content(&$a) {
$mode = 'view'; $mode = 'view';
$y = 0; $y = 0;
$m = 0; $m = 0;
$ignored = ((x($_REQUEST,'ignored')) ? intval($_REQUEST['ignored']) : 0);
if($a->argc > 1) { if($a->argc > 1) {
if($a->argc > 2 && $a->argv[1] == 'event') { if($a->argc > 2 && $a->argv[1] == 'event') {
@ -234,10 +249,11 @@ function events_content(&$a) {
} else { } else {
$r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`, $r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`,
`item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event` LEFT JOIN `item` ON `item`.`event-id` = `event`.`id` `item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event` LEFT JOIN `item` ON `item`.`event-id` = `event`.`id`
WHERE `event`.`uid` = %d WHERE `event`.`uid` = %d and ignore = %d
AND (( `adjust` = 0 AND `finish` >= '%s' AND `start` <= '%s' ) AND (( `adjust` = 0 AND `finish` >= '%s' AND `start` <= '%s' )
OR ( `adjust` = 1 AND `finish` >= '%s' AND `start` <= '%s' )) ", OR ( `adjust` = 1 AND `finish` >= '%s' AND `start` <= '%s' )) ",
intval(local_user()), intval(local_user()),
intval($ignored),
dbesc($start), dbesc($start),
dbesc($finish), dbesc($finish),
dbesc($adjust_start), dbesc($adjust_start),