From df8ac668b800ecf64ab2c240678eb87b225cb513 Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 8 Jun 2011 21:06:02 -0700 Subject: [PATCH] more calendar work, undo strict_privacy flag to use different approach --- boot.php | 18 +---- database.sql | 1 + images/calendar.png | Bin 0 -> 853 bytes include/event.php | 106 +++++++++++++++++++++++++----- include/notifier.php | 7 +- mod/dfrn_request.php | 8 +-- mod/follow.php | 3 - mod/salmon.php | 5 -- update.php | 7 +- view/theme/duepuntozero/style.css | 15 +++++ 10 files changed, 119 insertions(+), 51 deletions(-) create mode 100644 images/calendar.png diff --git a/boot.php b/boot.php index 0eccb8498..1c7a15705 100644 --- a/boot.php +++ b/boot.php @@ -4,9 +4,9 @@ set_time_limit(0); 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', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); @@ -527,20 +527,8 @@ function check_config(&$a) { $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; diff --git a/database.sql b/database.sql index fd7ccf87f..fa18c50dc 100644 --- a/database.sql +++ b/database.sql @@ -389,6 +389,7 @@ CREATE TABLE IF NOT EXISTS `user` ( `blockwall` tinyint(1) unsigned NOT NULL DEFAULT '0', `notify-flags` int(11) unsigned NOT NULL DEFAULT '65535', `page-flags` int(11) unsigned NOT NULL DEFAULT '0', + `prvnets` tinyint(1) NOT NULL DEFAULT '0', `pwdreset` char(255) NOT NULL, `maxreq` int(11) NOT NULL DEFAULT '10', `expire` int(11) unsigned NOT NULL DEFAULT '0', diff --git a/images/calendar.png b/images/calendar.png new file mode 100644 index 0000000000000000000000000000000000000000..fbf52933de7f7cf9303e03e4d94f222a4400bca0 GIT binary patch literal 853 zcmV-b1FHOqP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;%Sl8*RCwB?kD2LF4Q*k+~UfHzB0Y2sTFOtMZdc;r++q_F4wK@ zFTSL~<`8epPcuF~PN`Jl(~my@Kost{J{!lmyk#Bofk)#Ahp&r|;JJYg8%oWpyM zs4_b<#jQqWArKJ`?AyWqJ@=ssrP3HKr$JUqS>99Xd=tpU+wlFvcJvsA{Iw;QzH?49xyqjt!C{gl zVdRM;)c#l@-L)%q<0V+d50-Tl1`3=R;-F>k){I%iIoI68Wqv*Yiw zwDcQKKK>Zqd%X7)M~3L!dKWt%Jb(!dk#!#Dm9bN&dFq)H+;ev?)+^Vm3p83n|L%t< zfAl%`_TP^e<(GvjU3Ye~mIx|JB%&O7?ltoH4mxu=0GyXBH0KG!fR0>_j$8yl(oSh5 fDM`DHsPfMM54g5G4Iu5%00000NkvXXu0mjf+&Y7_ literal 0 HcmV?d00001 diff --git a/include/event.php b/include/event.php index 33970efff..9d9717a78 100644 --- a/include/event.php +++ b/include/event.php @@ -1,47 +1,121 @@ '; - $o .= '

' . bbcode($ev['desc']) . '

'; + $o .= '

' . bbcode($ev['desc']) . '

'; - $o .= '

' . t('Starts:') . ' ' . t('Starts:') . ' ' - . (($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))) . '

'; if(! $ev['nofinish']) - $o .= '

' . t('Finishes:') . ' ' . t('Finishes:') . ' ' - . (($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 ))) . '

'; if(strlen($ev['location'])) - $o .= '

' . t('Location:') . '' + $o .= '

' . t('Location:') . '' . bbcode($ev['location']) . '

'; $o .= ''; - return $o; } +function parse_event($h) { + + require_once('include/Scrape.php'); + require_once('library/HTMLPurifier.auto.php'); + require_once('include/html2bbcode'); + + $h = '' . $h . ''; + + $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) { diff --git a/include/notifier.php b/include/notifier.php index 98e38fb11..cb4dfe025 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -27,8 +27,6 @@ function notifier_run($argv, $argc){ $a->set_baseurl(get_config('system','url')); - $prv = get_config('system','strict_privacy'); - logger('notifier: invoked: ' . print_r($argv,true)); $cmd = $argv[1]; @@ -332,9 +330,6 @@ function notifier_run($argv, $argc){ break; case 'stat': - if($prv) - break; - if($followup && $contact['notify']) { logger('notifier: slapdelivery: ' . $contact['name']); $deliver_status = slapper($owner,$contact['notify'],$slap); @@ -465,7 +460,7 @@ function notifier_run($argv, $argc){ if($slap && count($url_recipients) && $followup && $notify_hub && (! $expire)) { foreach($url_recipients as $url) { - if($url && (! $prv)) { + if($url) { logger('notifier: urldelivery: ' . $url); $deliver_status = slapper($owner,$url,$slap); // TODO: redeliver/queue these items on failure, though there is no contact record diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index 338dc9cf1..c9811fa60 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -626,11 +626,9 @@ function dfrn_request_content(&$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'), @@ -638,9 +636,9 @@ function dfrn_request_content(&$a) { '$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'), diff --git a/mod/follow.php b/mod/follow.php index 31cfcfb64..a354b3457 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -34,9 +34,6 @@ function follow_post(&$a) { // NOTREACHED } - elseif(get_config('system','strict_privacy')) { - unset($ret['notify']); - } // do we have enough information? diff --git a/mod/salmon.php b/mod/salmon.php index bf33033d8..c2f76aa0a 100644 --- a/mod/salmon.php +++ b/mod/salmon.php @@ -192,11 +192,6 @@ function salmon_post(&$a) { // NOTREACHED } - // Check if we're allowed to talk to insecure networks - - if(get_config('system','strict_privacy')) - salmon_return(400); - require_once('include/items.php'); // Placeholder for hub discovery. We shouldn't find any hubs diff --git a/update.php b/update.php index dfc5f88c9..e1bc73619 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@