aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Scrape.php7
-rw-r--r--include/email.php25
-rw-r--r--include/event.php34
3 files changed, 57 insertions, 9 deletions
diff --git a/include/Scrape.php b/include/Scrape.php
index 1a9c03c8e..505d2bf99 100644
--- a/include/Scrape.php
+++ b/include/Scrape.php
@@ -446,9 +446,16 @@ function probe_url($url) {
$feed = new SimplePie();
$xml = fetch_url($poll);
+ logger('probe_url: fetch feed: ' . $poll . ' returns: ' . $xml, LOGGER_DATA);
+ $a = get_app();
+
+ logger('probe_url: scrape_feed: headers: ' . $a->get_curl_headers(), $LOGGER_DATA);
+
$feed->set_raw_data($xml);
$feed->init();
+ if($feed->error())
+ logger('probe_url: scrape_feed: Error parsing XML: ' . $feed->error());
if(! x($vcard,'photo'))
$vcard['photo'] = $feed->get_image_url();
diff --git a/include/email.php b/include/email.php
index 7e0351e94..1f485e430 100644
--- a/include/email.php
+++ b/include/email.php
@@ -12,20 +12,27 @@ function email_connect($mailbox,$username,$password) {
function email_poll($mbox,$email_addr) {
if(! ($mbox && $email_addr))
- return array();;
+ return array();
- $search = imap_search($mbox,'FROM "' . $email_addr . '"', SE_UID);
+ $search1 = imap_search($mbox,'FROM "' . $email_addr . '"', SE_UID);
+ if(! $search1)
+ $search1 = array();
$search2 = imap_search($mbox,'TO "' . $email_addr . '"', SE_UID);
+ if(! $search2)
+ $search2 = array();
- if($search && $search2)
- $res = array_merge($search,$search2);
- elseif($search)
- $res = $search;
- else
- $res = $search2;
+ $search3 = imap_search($mbox,'CC "' . $email_addr . '"', SE_UID);
+ if(! $search3)
+ $search3 = array();
- return (($res) ? $res : array());
+ $search4 = imap_search($mbox,'BCC "' . $email_addr . '"', SE_UID);
+ if(! $search4)
+ $search4 = array();
+
+ $res = array_unique(array_merge($search1,$search2,$search3,$search4));
+
+ return $res;
}
diff --git a/include/event.php b/include/event.php
new file mode 100644
index 000000000..06239b2ab
--- /dev/null
+++ b/include/event.php
@@ -0,0 +1,34 @@
+<?php
+
+
+function format_event_html($ev) {
+
+ if(! ((is_array($ev)) && count($ev)))
+ return '';
+
+ $o = '<div class="vevent">';
+
+ $o .= '<p class="description">' . $ev['desc'] . '</p>';
+
+ $o .= '<p>' . t('Starts: ') . '<abbr class="dtstart" title="'
+ . datetime_convert('UTC','UTC',$ev['start'], ATOM_TIME)
+ . '" >'
+ . datetime_convert('UTC', date_default_timezone_get(),
+ $ev['start'] /*, format */ )
+ . '</abbr></p>';
+
+ $o .= '<p>' . t('Ends: ') . '<abbr class="dtend" title="'
+ . datetime_convert('UTC','UTC',$ev['finish'], ATOM_TIME)
+ . '" >'
+ . datetime_convert('UTC', date_default_timezone_get(),
+ $ev['finish'] /*, format */ )
+ . '</abbr></p>';
+
+ $o .= '<p> ' . t('Location:') . '<span class="location">'
+ . $ev['location']
+ . '</span></p>';
+
+ $o .= '</div>';
+
+return $o;
+} \ No newline at end of file