aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-09-20 17:04:22 -0700
committerfriendica <info@friendica.com>2012-09-20 17:04:22 -0700
commit6c92b5ab86d7f0fee775c2c485f5264ac2b206be (patch)
tree8d0782f0b2582e0b06fda370afcc435e5c4a6fad /mod
parentc8957b36ea11a41604330c8f87c0fc0611ef18e6 (diff)
downloadvolse-hubzilla-6c92b5ab86d7f0fee775c2c485f5264ac2b206be.tar.gz
volse-hubzilla-6c92b5ab86d7f0fee775c2c485f5264ac2b206be.tar.bz2
volse-hubzilla-6c92b5ab86d7f0fee775c2c485f5264ac2b206be.zip
separate the public feed from everything else
Diffstat (limited to 'mod')
-rwxr-xr-xmod/events.php18
-rw-r--r--mod/feed.php39
-rw-r--r--mod/parse_url.php26
3 files changed, 74 insertions, 9 deletions
diff --git a/mod/events.php b/mod/events.php
index bf02f8309..f950b5adc 100755
--- a/mod/events.php
+++ b/mod/events.php
@@ -141,6 +141,20 @@ function events_content(&$a) {
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');
$a->page['htmlhead'] .= replace_macros($htpl,array('$baseurl' => $a->get_baseurl()));
@@ -154,6 +168,7 @@ function events_content(&$a) {
$mode = 'view';
$y = 0;
$m = 0;
+ $ignored = ((x($_REQUEST,'ignored')) ? intval($_REQUEST['ignored']) : 0);
if($a->argc > 1) {
if($a->argc > 2 && $a->argv[1] == 'event') {
@@ -231,10 +246,11 @@ function events_content(&$a) {
} else {
$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
+ WHERE `event`.`uid` = %d and ignore = %d
AND (( `adjust` = 0 AND `finish` >= '%s' AND `start` <= '%s' )
OR ( `adjust` = 1 AND `finish` >= '%s' AND `start` <= '%s' )) ",
intval(local_user()),
+ intval($ignored),
dbesc($start),
dbesc($finish),
dbesc($adjust_start),
diff --git a/mod/feed.php b/mod/feed.php
new file mode 100644
index 000000000..69d8fdb05
--- /dev/null
+++ b/mod/feed.php
@@ -0,0 +1,39 @@
+<?php
+
+
+require_once('include/items.php');
+
+function feed_init(&$a) {
+
+ $params = array();
+
+ $params['begin'] = ((x($_REQUEST,'date_begin')) ? $_REQUEST['date_begin'] : '0000-00-00 00:00:00');
+ $params['end'] = ((x($_REQUEST,'date_end')) ? $_REQUEST['date_end'] : '');
+ $params['type'] = ((stristr(argv(0),'json')) ? 'json' : 'xml');
+
+ $channel = '';
+ if(argc() > 1) {
+ $r = q("select * from entity where entity_address = '%s' limit 1",
+ dbesc(argv(1))
+ );
+ if(!($r && count($r)))
+ killme();
+
+ $channel = $r[0];
+
+ // check site and channel permissions
+
+ if(!($channel['entity_r_stream'] & PERMS_PUBLIC))
+ killme();
+
+ if((intval(get_config('system','block_public'))) && (! get_account_id()))
+ killme();
+
+ logger('mod_feed: public feed request from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $channel['entity_address']);
+ echo get_public_feed($channel,$params);
+ killme();
+ }
+
+}
+
+
diff --git a/mod/parse_url.php b/mod/parse_url.php
index 083a39b55..9adee8f65 100644
--- a/mod/parse_url.php
+++ b/mod/parse_url.php
@@ -307,16 +307,26 @@ function parse_url_content(&$a) {
$image = "";
- if(sizeof($siteinfo["images"]) > 0){
- /*
- Execute below code only if image is present in siteinfo
- */
- foreach ($siteinfo["images"] as $imagedata)
- if($textmode)
- $image .= '[img='.$imagedata["width"].'x'.$imagedata["height"].']'.$imagedata["src"].'[/img]';
+ if(sizeof($siteinfo["images"]) > 0){
+ /* Execute below code only if image is present in siteinfo */
+
+ $total_images = 0;
+ $max_images = get_config('system','max_bookmark_images');
+ if($max_images === false)
+ $max_images = 2;
else
- $image .= '<img height="'.$imagedata["height"].'" width="'.$imagedata["width"].'" src="'.$imagedata["src"].'" alt="photo" />';
+ $max_images = intval($max_images);
+
+ foreach ($siteinfo["images"] as $imagedata) {
+ if($textmode)
+ $image .= '[img='.$imagedata["width"].'x'.$imagedata["height"].']'.$imagedata["src"].'[/img]' . "\n";
+ else
+ $image .= '<img height="'.$imagedata["height"].'" width="'.$imagedata["width"].'" src="'.$imagedata["src"].'" alt="photo" /><br />';
+ $total_images ++;
+ if($max_images && $max_images >= $total_images)
+ break;
}
+ }
if(strlen($text)) {
if($textmode)