ini_set('pcre.backtrack_limit', 250000);
-define ( 'FRIENDIKA_VERSION', '2.2.1004' );
+define ( 'FRIENDIKA_VERSION', '2.2.1005' );
define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
-define ( 'DB_UPDATE_VERSION', 1062 );
+define ( 'DB_UPDATE_VERSION', 1063 );
define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
$plugins = get_config('system','addon');
$plugins_arr = array();
- if($plugins) {
+ if($plugins)
$plugins_arr = explode(',',str_replace(' ', '',$plugins));
- if(get_config('system','strict_privacy')) {
- unset($a->config['system']['huburl']);
- for($x = 0; $x < count($plugins_arr); $x ++) {
- if( $plugins_arr[$x] === 'facebook'
- || $plugins_arr[$x] === 'twitter'
- || $plugins_arr[$x] === 'statusnet') {
- unset($plugins_arr[$x]);
- }
- }
- }
- }
-
$a->plugins = $plugins_arr;
<?php
-function format_event_html($ev) {
+function format_event_html($ev,$pre = '') {
require_once('include/bbcode.php');
if(! ((is_array($ev)) && count($ev)))
return '';
+ $bd_format = t('l F d, Y \@ g A') ; // Friday January 18, 2011 @ 8 AM
+
$o = '<div class="vevent">';
- $o .= '<p class="description">' . bbcode($ev['desc']) . '</p>';
+ $o .= '<p class="description event-description">' . bbcode($ev['desc']) . '</p>';
- $o .= '<p>' . t('Starts:') . ' <abbr class="dtstart" title="'
- . datetime_convert('UTC','UTC',$ev['start'], $ev['adjust'] ? ATOM_TIME : 'Y-m-d\TH:i:s' )
+ $o .= '<p class="event-start">' . t('Starts:') . ' <abbr class="dtstart" title="'
+ . datetime_convert('UTC','UTC',$ev['start'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
. '" >'
- . (($ev['adjust']) ? datetime_convert('UTC', date_default_timezone_get(),
- $ev['start'] /*, format */ )
- : datetime_convert('UTC', 'UTC',
- $ev['start'] /*, format */ ))
+ . (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
+ $ev['start'] , $bd_format ))
+ : day_translate(datetime_convert('UTC', 'UTC',
+ $ev['start'] , $bd_format)))
. '</abbr></p>';
if(! $ev['nofinish'])
- $o .= '<p>' . t('Finishes:') . ' <abbr class="dtend" title="'
- . datetime_convert('UTC','UTC',$ev['finish'], $ev['adjust'] ? ATOM_TIME : 'Y-m-d\TH:i:s' )
+ $o .= '<p class="event-end" >' . t('Finishes:') . ' <abbr class="dtend" title="'
+ . datetime_convert('UTC','UTC',$ev['finish'], (($ev['adjust']) ? ATOM_TIME : 'Y-m-d\TH:i:s' ))
. '" >'
- . (($ev['adjust']) ? datetime_convert('UTC', date_default_timezone_get(),
- $ev['finish'] /*, format */ )
- : datetime_convert('UTC', 'UTC',
- $ev['finish'] /*, format */ ))
+ . (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(),
+ $ev['finish'] , $bd_format ))
+ : day_translate(datetime_convert('UTC', 'UTC',
+ $ev['finish'] , $bd_format )))
. '</abbr></p>';
if(strlen($ev['location']))
- $o .= '<p> ' . t('Location:') . '<span class="location">'
+ $o .= '<p class="event-location"> ' . t('Location:') . '<span class="location">'
. bbcode($ev['location'])
. '</span></p>';
$o .= '</div>';
-
return $o;
}
+function parse_event($h) {
+
+ require_once('include/Scrape.php');
+ require_once('library/HTMLPurifier.auto.php');
+ require_once('include/html2bbcode');
+
+ $h = '<html><body>' . $h . '</body></html>';
+
+ $ret = array();
+
+ $dom = HTML5_Parser::parse($h);
+
+ if(! $dom)
+ return $ret;
+
+ $items = $dom->getElementsByTagName('*');
+
+ foreach($items as $item) {
+ if(attribute_contains($item->getAttribute('class'), 'vevent')) {
+ $level2 = $item->getElementsByTagName('*');
+ foreach($level2 as $x) {
+ if(attribute_contains($x->getAttribute('class'),'dtstart') && $x->getAttribute('title')) {
+ $ret['start'] = $x->getAttribute('title');
+ if(! strpos($ret['start'],'Z'))
+ $ret['adjust'] = true;
+ }
+ if(attribute_contains($x->getAttribute('class'),'dtend') && $x->getAttribute('title'))
+ $ret['finish'] = $x->getAttribute('title');
+
+ if(attribute_contains($x->getAttribute('class'),'description'))
+ $ret['desc'] = $x->textContent;
+ if(attribute_contains($x->getAttribute('class'),'location'))
+ $ret['location'] = $x->textContent;
+ }
+ }
+ }
+
+ // sanitise
+
+ if((x($ret,'desc')) && ((strpos($ret['desc'],'<') !== false) || (strpos($ret['desc'],'>') !== false))) {
+ $config = HTMLPurifier_Config::createDefault();
+ $config->set('Cache.DefinitionImpl', null);
+ $purifier = new HTMLPurifier($config);
+ $ret['desc'] = html2bbcode($purifier->purify($ret['desc']));
+ }
+
+ if((x($ret,'location')) && ((strpos($ret['location'],'<') !== false) || (strpos($ret['location'],'>') !== false))) {
+ $config = HTMLPurifier_Config::createDefault();
+ $config->set('Cache.DefinitionImpl', null);
+ $purifier = new HTMLPurifier($config);
+ $ret['location'] = html2bbcode($purifier->purify($ret['location']));
+ }
+
+ if(x($ret,'start'))
+ $ret['start'] = datetime_convert('UTC','UTC',$ret['start']);
+ if(x($ret,'finish'))
+ $ret['finish'] = datetime_convert('UTC','UTC',$ret['finish']);
+
+ return $ret;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
function sort_by_date($a) {
else
$tpl = get_markup_template('auto_request.tpl');
- $prv = get_config('system','strict_privacy');
-
$o .= replace_macros($tpl,array(
'$header' => t('Friend/Connection Request'),
- '$desc' => t('Examples: jojo@demo.friendika.com, http://demo.friendika.com/profile/jojo') . (($prv) ? ', testuser@identi.ca' : ''),
+ '$desc' => t('Examples: jojo@demo.friendika.com, http://demo.friendika.com/profile/jojo, testuser@identi.ca'),
'$pls_answer' => t('Please answer the following:'),
'$does_know' => sprintf( t('Does %s know you?'),$a->profile['name']),
'$yes' => t('Yes'),
'$add_note' => t('Add a personal note:'),
'$page_desc' => t("Please enter your 'Identity Address' from one of the following supported social networks:"),
'$friendika' => t('Friendika'),
- '$statusnet' => (($prv) ? t('StatusNet/Federated Social Web') : ''),
+ '$statusnet' => t('StatusNet/Federated Social Web'),
'$private_net' => t("Private \x28secure\x29 network"),
- '$public_net' => (($prv) ? t("Public \x28insecure\x29 network") : ''),
+ '$public_net' => t("Public \x28insecure\x29 network"),
'$your_address' => t('Your Identity Address:'),
'$submit' => t('Submit Request'),
'$cancel' => t('Cancel'),