]> git.mxchange.org Git - friendica.git/commitdiff
Merge branch 'master' of git://github.com/friendika/friendika
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Thu, 9 Jun 2011 08:20:47 +0000 (10:20 +0200)
committerTobias Diekershoff <tobias.diekershoff@gmx.net>
Thu, 9 Jun 2011 08:20:47 +0000 (10:20 +0200)
13 files changed:
boot.php
database.sql
images/calendar.png [new file with mode: 0644]
include/event.php
include/notifier.php
mod/apps.php
mod/dfrn_request.php
mod/events.php
mod/follow.php
mod/photos.php
mod/salmon.php
update.php
view/theme/duepuntozero/style.css

index 0eccb8498ec7c1b4d2fd5effb7ca3165af315eb3..1c7a1570526cfb88f5c4b19012d30ae31fed0f2b 100644 (file)
--- 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',                    "<br />\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;
 
index fd7ccf87ff8502a2fda4b7eed976317474cfb78c..fa18c50dca7f9a0b4b1efaac643d102b0e685d7a 100644 (file)
@@ -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 (file)
index 0000000..fbf5293
Binary files /dev/null and b/images/calendar.png differ
index 33970efff9cc44e696695e50f9e3ddf5886abf7d..6962a2f1b8f94e5b973c49229941576301e88843 100644 (file)
 <?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) {
 
index 98e38fb115ea0ea24b4ef4af5471c4f8873022ae..cb4dfe025fccd819118903b0efc69f39c622bb92 100644 (file)
@@ -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
index 58752de32231fbaf90b76ae3d84c2f9e16d2ed37..f25722df785ac6942353c74579ba5fc14a967cce 100644 (file)
@@ -5,10 +5,20 @@ function apps_content(&$a) {
 
        $o .= '<h3>' . t('Applications') . '</h3>';
 
-       $o .= '<div class="app-title"><a href="notes">' . t('Private Notes') . '</a></div>';
+       $apps = false;
 
-       if($a->apps)
+       if(local_user()) {
+               $apps = true;
+               $o .= '<div class="app-title"><a href="notes">' . t('Private Notes') . '</a></div>';
+       }
+
+       if($a->apps) {
+               $apps = true;
                $o .= $a->apps;
+       }
+
+       if(! $apps)
+               notice( t('No installed applications.') . EOL);
 
        return $o;
 
index 338dc9cf1d5e2c21222da5f97760ca59894d6a51..c9811fa60c46c28d5fd51da27e0ec725954fedea 100644 (file)
@@ -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'),
index f19a438fdd2b75574ae87f86d6ecb659e74f5e03..af829c28df6f64d52bd4c640ad8f35370374a9ee 100644 (file)
@@ -54,6 +54,9 @@ function events_post(&$a) {
        $str_contact_deny  = perms2str($_POST['contact_deny']);
 
 
+       // until publishing is ready
+       $str_contact_allow = '<' . local_user() . '>';
+
        if($event_id) {
                $r = q("UPDATE `event` SET
                        `edited` = '%s',
@@ -169,7 +172,7 @@ function events_content(&$a) {
                        $prevyear --;
                }
                        
-
+               $o .= '<div id="new-event-link"><a href="' . $a->get_baseurl() . '/events/new' . '" >' . t('Create New Event') . '</a></div>';
                $o .= '<a href="' . $a->get_baseurl() . '/events/' . $prevyear . '/' . $prevmonth . '" class="prevcal">' . t('&lt;&lt; Previous') . '</a> | <a href="' . $a->get_baseurl() . '/events/' . $nextyear . '/' . $nextmonth . '" class="nextcal">' . t('Next &gt;&gt;') . '</a>'; 
                $o .= cal($y,$m,false, ' eventcal');
 
index 31cfcfb64c1f20d4faec0b34dfcee986dc14db7e..a354b345751a7b934ed88ea9fe832fb5f35acf84 100644 (file)
@@ -34,9 +34,6 @@ function follow_post(&$a) {
                
                // NOTREACHED
        }
-       elseif(get_config('system','strict_privacy')) {
-               unset($ret['notify']);
-       }
 
        // do we have enough information?
        
index f1a2d635cb158655c269d8cae872dbc9b2bee395..18fff703ef0e7ade8d663534cc288d40186aafcd 100644 (file)
@@ -510,8 +510,15 @@ foreach($_FILES AS $key => $val) {
                                        $arr['target'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . '" />' . "\n" . '<link rel="preview" type="image/jpeg" href="' . $a->get_baseurl() . "/photo/" . $p[0]['resource-id'] . '-' . $best . '.jpg' . '" />') . '</link></target>';
 
                                        $item_id = item_store($arr);
-                                       if($item_id)
+                                       if($item_id) {
+                                               q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1",
+                                                       dbesc($a->get_baseurl() . '/display/' . $owner_record['nickname'] . '/' . $item_id),
+                                                       intval($page_owner_uid),
+                                                       intval($item_id)
+                                               );
+
                                                proc_run('php',"include/notifier.php","tag","$item_id");
+                                       }
                                }
 
                        }
@@ -1106,9 +1113,10 @@ function photos_content(&$a) {
                                $tag_str .= bbcode($t);
                        } 
                        $tags = array(t('Tags: '), $tag_str);
-                       if($cmd === 'edit')
+                       if($cmd === 'edit') {
                                $tags[] = $a->get_baseurl() . '/tagrm/' . $link_item['id'];
                                $tags[] = t('[Remove any tag]');
+                       }
                }
 
 
index bf33033d810c84615b72aeae40ba14238c9bbd13..c2f76aa0a641889f583aa0b93e38b5c22f22b739 100644 (file)
@@ -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
index dfc5f88c958d28519eb98c6d999e1b4067a39af9..e1bc736191c49ff1e373279b74fe86fabd26503a 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-define( 'UPDATE_VERSION' , 1062 );
+define( 'UPDATE_VERSION' , 1063 );
 
 /**
  *
@@ -513,3 +513,8 @@ function update_1060() {
 function update_1061() {
        q("ALTER TABLE `event` ADD `nofinish` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `type` ");
 }
+
+function update_1062() {
+       q("ALTER TABLE `user` ADD `prvnets` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `page-flags` ");
+}
+
index c5e441bfd63bf2c534023d19d14d37074df82c62..68edd02b9474f17fd4bef80f7a5ba9482fab055f 100644 (file)
@@ -2227,6 +2227,25 @@ a.mail-list-link {
        font-size: 24px;
 }
 
+#new-event-link {
+       margin-bottom: 10px;
+}
+
+.event-description:before {
+       content: url('../../../images/calendar.png');
+       margin-right: 15px;
+}
+
+.event-start, .event-end {
+       margin-left: 10px;
+       width: 330px;
+       clear: both;
+}
+
+.event-start .dtstart, .event-end .dtend {
+       float: right;
+}
 .calendar {
        font-family: Courier, monospace;
 }