Merge remote-tracking branch 'upstream/master'
authorMichael Vogel <icarus@dabo.de>
Sun, 17 Feb 2013 11:35:40 +0000 (12:35 +0100)
committerMichael Vogel <icarus@dabo.de>
Sun, 17 Feb 2013 11:35:40 +0000 (12:35 +0100)
Conflicts:
boot.php
database.sql
library/fancybox/jquery.fancybox-1.3.4.css
mod/search.php
update.php

16 files changed:
1  2 
boot.php
database.sql
include/api.php
include/conversation.php
include/items.php
include/plugin.php
include/text.php
index.php
mod/admin.php
mod/item.php
mod/network.php
mod/photo.php
mod/photos.php
mod/search.php
object/Item.php
update.php

diff --cc boot.php
+++ b/boot.php
@@@ -12,9 -12,10 +12,9 @@@ require_once('library/Mobile_Detect/Mob
  require_once('include/features.php');
  
  define ( 'FRIENDICA_PLATFORM',     'Friendica');
- define ( 'FRIENDICA_VERSION',      '3.1.1589' );
+ define ( 'FRIENDICA_VERSION',      '3.1.1612' );
  define ( 'DFRN_PROTOCOL_VERSION',  '2.23'    );
--define ( 'DB_UPDATE_VERSION',      1159      );
 -
++define ( 'DB_UPDATE_VERSION',      1161      );
  define ( 'EOL',                    "<br />\r\n"     );
  define ( 'ATOM_TIME',              'Y-m-d\TH:i:s\Z' );
  
diff --cc database.sql
@@@ -590,8 -589,7 +590,9 @@@ CREATE TABLE IF NOT EXISTS `item` 
    KEY `uid_commented` (`uid`, `commented`),
    KEY `uid_created` (`uid`, `created`),
    KEY `uid_unseen` (`uid`, `unseen`),
 +  KEY `mention` (`mention`),
 +  KEY `resource-id` (`resource-id`),
+   KEY `event_id` (`event-id`),
    FULLTEXT KEY `title` (`title`),
    FULLTEXT KEY `body` (`body`),
    FULLTEXT KEY `allow_cid` (`allow_cid`),
diff --cc include/api.php
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc index.php
Simple merge
diff --cc mod/admin.php
Simple merge
diff --cc mod/item.php
Simple merge
diff --cc mod/network.php
Simple merge
diff --cc mod/photo.php
@@@ -169,13 -169,13 +169,16 @@@ function photo_init(&$a) 
                }
        }
  
-       $ph = new Photo($data, $mimetype);
-       if($ph->is_valid()) {
-               if(isset($customres) && $customres > 0 && $customres < 500) {
-                       $ph->scaleImageSquare($customres);
 -      if(isset($customres) && $customres > 0 && $customres < 500) {
++      // Resize only if its not a GIF
++      if ($mime != "image/gif") {
+               $ph = new Photo($data, $mimetype);
+               if($ph->is_valid()) {
 -                      $ph->scaleImageSquare($customres);
++                      if(isset($customres) && $customres > 0 && $customres < 500) {
++                              $ph->scaleImageSquare($customres);
++                      }
+                       $data = $ph->imageString();
+                       $mimetype = $ph->getType();
                }
-               $data = $ph->imageString();
-               $mimetype = $ph->getType();
        }
  
        if(function_exists('header_remove')) {
diff --cc mod/photos.php
Simple merge
diff --cc mod/search.php
@@@ -159,15 -146,14 +159,15 @@@ function search_content(&$a) 
  
        if( (! get_config('alt_pager', 'global')) && (! get_pconfig(local_user(),'system','alt_pager')) ) {
                $r = q("SELECT distinct(`item`.`uri`) as `total`
 -                      FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`
 +                      FROM $sql_table LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`
                        WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
                        AND (( `item`.`allow_cid` = ''  AND `item`.`allow_gid` = '' AND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = '' AND `item`.`private` = 0 AND `user`.`hidewall` = 0) 
-                               OR `item`.`uid` = %d )
+                               OR ( `item`.`uid` = %d ))
                        AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
 -                      $sql_extra group by `item`.`uri` ", 
 +                      $sql_extra ",
                        intval(local_user())
                );
 +//                    $sql_extra group by `item`.`uri` ",
  
                if(count($r))
                        $a->set_pager_total(count($r));
                `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`,
                `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`, 
                `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`,
-               `user`.`nickname`
+               `user`.`nickname`, `user`.`uid`, `user`.`hidewall`
 -              FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
 +              FROM $sql_table LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
                LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`
                WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
                AND (( `item`.`allow_cid` = ''  AND `item`.`allow_gid` = '' AND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = '' AND `item`.`private` = 0 AND `user`.`hidewall` = 0 ) 
-                       OR `item`.`uid` = %d )
+                       OR ( `item`.`uid` = %d ))
                AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
                $sql_extra
 -              group by `item`.`uri`   
                ORDER BY `received` DESC LIMIT %d , %d ",
                intval(local_user()),
                intval($a->pager['start']),
diff --cc object/Item.php
Simple merge
diff --cc update.php
@@@ -1390,25 -1380,25 +1380,53 @@@ function update_1157() 
          ) ENGINE=MyISAM DEFAULT CHARSET=utf8"
        );
  
 -
 -      return UPDATE_FAILED;
+       if($r)
+               return UPDATE_SUCCESS;
+ }
+ function update_1158() {
+       set_config('system', 'maintenance', 1);
+       // Wait for 15 seconds for current requests to
+       // clear before locking up the database
+       sleep(15);
+       $r = q("CREATE INDEX event_id ON item(`event-id`)");
+       set_config('system', 'maintenance', 0);
        if($r)
                return UPDATE_SUCCESS;
  
        return UPDATE_FAILED;
  }
  
-       if(!$r) return UPDATE_FAILED;
 +function update_1159() {
 +      $r = q("ALTER TABLE `term` ADD `aid` int(10) unsigned NOT NULL DEFAULT '0',
 +              ADD `uid` int(10) unsigned NOT NULL DEFAULT '0',
 +              ADD INDEX (`uid`),
 +              ADD INDEX (`aid`)");
 +
- // KEY `mention` (`mention`)
-       if(!$r) return UPDATE_FAILED;
++      if(!$r)
++              return UPDATE_FAILED;
++
++      require_once('include/tags.php');
++      update_items();
++
 +      return UPDATE_SUCCESS;
 +}
 +
 +function update_1160() {
++      set_config('system', 'maintenance', 1);
++
++      // Wait for 15 seconds for current requests to
++      // clear before locking up the database
++      sleep(15);
++
 +      $r = q("ALTER TABLE `item` ADD `mention` TINYINT(1) NOT NULL DEFAULT '0', ADD INDEX (`mention`)");
++      set_config('system', 'maintenance', 0);
++
++      if(!$r)
++              return UPDATE_FAILED;
++
 +      return UPDATE_SUCCESS;
 +}