]> git.mxchange.org Git - friendica.git/blobdiff - mod/events.php
Merge pull request #1067 from Beanow/feature/noscrape
[friendica.git] / mod / events.php
index 61f16b50fc75dcd1ea9381f0f731bdeb3b76f3d2..94e2ba6b40b597fde1f8a4e99d0d13406972009c 100755 (executable)
@@ -28,7 +28,7 @@ function events_post(&$a) {
        $adjust   = intval($_POST['adjust']);
        $nofinish = intval($_POST['nofinish']);
 
-       // The default setting for the `private` field in event_store() is false, so mirror that        
+       // The default setting for the `private` field in event_store() is false, so mirror that
        $private_event = false;
 
 
@@ -142,25 +142,35 @@ function events_content(&$a) {
        }
 
        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",
+               $r = q("update event set ignore = 1 where id = %d and uid = %d",
                        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",
+               $r = q("update event set ignore = 0 where id = %d and uid = %d",
                        intval($a->argv[2]),
                        intval(local_user())
                );
        }
 
 
+       $editselect = 'none';
+       if( feature_enabled(local_user(), 'richtext') )
+               $editselect = 'textareas';
+
        $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(),
+               '$editselect' => $editselect
+       ));
 
        $etpl = get_markup_template('event_end.tpl');
-       $a->page['end'] .= replace_macros($etpl,array('$baseurl' => $a->get_baseurl()));
+       $a->page['end'] .= replace_macros($etpl,array(
+               '$baseurl' => $a->get_baseurl(),
+               '$editselect' => $editselect
+       ));
 
        $o ="";
        // tabs
@@ -250,13 +260,15 @@ function events_content(&$a) {
                        $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` 
                                WHERE `event`.`uid` = %d and event.ignore = %d
-                               AND (( `adjust` = 0 AND `finish` >= '%s' AND `start` <= '%s' ) 
-                               OR  (  `adjust` = 1 AND `finish` >= '%s' AND `start` <= '%s' )) ",
+                               AND (( `adjust` = 0 AND ( `finish` >= '%s' OR ( nofinish AND start >= '%s' ) ) AND `start` <= '%s' ) 
+                               OR  (  `adjust` = 1 AND ( `finish` >= '%s' OR ( nofinish AND start >= '%s' ) ) AND `start` <= '%s' )) ",
                                intval(local_user()),
                                intval($ignored),
                                dbesc($start),
+                               dbesc($start),
                                dbesc($finish),
                                dbesc($adjust_start),
+                               dbesc($adjust_start),
                                dbesc($adjust_finish)
                        );
                }
@@ -360,16 +372,16 @@ function events_content(&$a) {
                        '$previus'      => array($a->get_baseurl()."/events/$prevyear/$prevmonth",t('Previous'),'',''),
                        '$next'         => array($a->get_baseurl()."/events/$nextyear/$nextmonth",t('Next'),'',''),
                        '$calendar' => cal($y,$m,$links, ' eventcal'),
-                       
+
                        '$events'       => $events,
-                       
-                       
+
+
                ));
-               
+
                if (x($_GET,'id')){ echo $o; killme(); }
-               
+
                return $o;
-               
+
        }
 
        if($mode === 'edit' && $event_id) {