]> git.mxchange.org Git - friendica.git/commitdiff
added comments, make typo checker work with redefined plural string functions
authorFriendika <info@friendika.com>
Tue, 29 Mar 2011 00:24:11 +0000 (17:24 -0700)
committerFriendika <info@friendika.com>
Tue, 29 Mar 2011 00:24:11 +0000 (17:24 -0700)
mod/network.php
util/typo.php
util/typohelper.php [new file with mode: 0644]

index 17d36dfb28d4609316c8091cfe315b5473cf33c4..8e8fe8d1e5e3b4edaa43f8a177c326ccea58f137 100644 (file)
@@ -114,7 +114,7 @@ function network_content(&$a, $update = 0) {
                        '$lockstate' => $lockstate,
                        '$acl' => populate_acl((($group) ? $group_acl : $a->user), $celeb),
                        '$bang' => (($group) ? '!' : ''),
-                       '$profile_uid' => $_SESSION['uid']
+                       '$profile_uid' => local_user()
                ));
 
 
@@ -190,6 +190,9 @@ function network_content(&$a, $update = 0) {
 
 
        if($nouveau) {
+
+               // "New Item View" - show all items unthreaded in reverse created date order
+
                $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, 
                        `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
                        `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
@@ -206,6 +209,10 @@ function network_content(&$a, $update = 0) {
                );
        }
        else {
+
+               // Normal conversation view
+               // First fetch a known number of parent items
+
                $r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact_uid`
                        FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
                        WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
@@ -218,6 +225,9 @@ function network_content(&$a, $update = 0) {
                        intval($a->pager['itemspage'])
                );
 
+
+               // Then fetch all the children of the parents that are on this page
+
                $parents_arr = array();
                $parents_str = '';
 
@@ -243,6 +253,10 @@ function network_content(&$a, $update = 0) {
                }
        }
 
+       // find all the authors involved in remote conversations
+       // We will use a local profile photo if they are one of our contacts
+       // otherwise we have to get the photo from the item owner's site
+
        $author_contacts = extract_item_authors($r,local_user());
 
        $cmnt_tpl = load_view_file('view/comment_item.tpl');
@@ -258,6 +272,8 @@ function network_content(&$a, $update = 0) {
 
                if($nouveau) {
 
+                       // "New Item View" - just loop through the items and format them minimally for display
+
                        $tpl = load_view_file('view/search_item.tpl');
                        $droptpl = load_view_file('view/wall_fake_drop.tpl');
 
@@ -325,6 +341,12 @@ function network_content(&$a, $update = 0) {
 
                }
 
+               // Normal View
+
+
+               // Figure out how many comments each parent has
+               // (Comments all have gravity of 6)
+               // Store the result in the $comments array
 
                $comments = array();
                foreach($r as $rr) {
@@ -336,6 +358,9 @@ function network_content(&$a, $update = 0) {
                        }
                }
 
+               // map all the like/dislike activities for each parent item 
+               // Store these in the $alike and $dlike arrays
+
                foreach($r as $item) {
                        like_puller($a,$item,$alike,'like');
                        like_puller($a,$item,$dlike,'dislike');
@@ -353,9 +378,18 @@ function network_content(&$a, $update = 0) {
                        $sparkle = '';
                        $owner_url = $owner_photo = $owner_name = '';
 
-                       if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) && ($item['id'] != $item['parent']))
+
+                       // We've already parsed out like/dislike for special treatment. We can ignore them now
+
+                       if(((activity_match($item['verb'],ACTIVITY_LIKE)) 
+                               || (activity_match($item['verb'],ACTIVITY_DISLIKE))) 
+                               && ($item['id'] != $item['parent']))
                                continue;
 
+                       // Take care of author collapsing and comment collapsing
+                       // If a single author has more than 3 consecutive top-level posts, squash the remaining ones.
+                       // If there are more than two comments, squash all but the last 2.
+
                        if($item['id'] == $item['parent']) {
                                if($blowhard == $item['cid'] && (! $item['self'])) {
                                        $blowhard_count ++;
@@ -388,6 +422,8 @@ function network_content(&$a, $update = 0) {
                                $o .= '</div>';
                        }
 
+
+
                        $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
 
                        $lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) 
@@ -546,6 +582,9 @@ function network_content(&$a, $update = 0) {
        }
 
        if(! $update) {
+
+               // if author collapsing is in force but didn't get closed, close it off now.
+
                if($blowhard_count > 3)
                        $o .= '</div>';
 
index 84a50e15e236b0d68b6c08557d94884cb609b618..e20cce86a5a3c68cc74ef7b7399b1d8abecaaca5 100644 (file)
                }
        }
 
+       if(x($a->config,'php_path'))
+               $phpath = $a->config['php_path'];
+       else
+               $phpath = 'php';
+
        echo "String files\n";
 
        echo 'util/strings.php' . "\n";
@@ -47,5 +52,6 @@
 
        foreach($files as $file) {
                echo $file . "\n";
-               include_once($file);
+       passthru($phpath . ' util/typohelper.php ' . $file);
+//             include_once($file);
        }
diff --git a/util/typohelper.php b/util/typohelper.php
new file mode 100644 (file)
index 0000000..589702a
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+
+$str = <<< EOT
+       error_reporting(E_ERROR | E_WARNING | E_PARSE );
+       ini_set('display_errors', '1');
+       ini_set('log_errors','0');
+EOT;
+
+       $str .= str_replace('<?php', '', file_get_contents($argv[1]));
+       
+       eval($str);