]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch '0.8.x' of git@gitorious.org:+laconica-developers/laconica/dev into...
authorRobin Millette <millette@controlyourself.ca>
Sun, 31 May 2009 21:12:04 +0000 (17:12 -0400)
committerRobin Millette <millette@controlyourself.ca>
Sun, 31 May 2009 21:12:04 +0000 (17:12 -0400)
Conflicts:

js/util.js
lib/attachmentlist.php

1  2 
README
js/util.js
lib/attachmentlist.php
lib/common.php
lib/noticelist.php

diff --combined README
index 9207f3e900ddfa8251d530ac44e8c7e782fc6b7c,db912f201616bff07dc0807a088111fe48484818..76b56a52e5a869cddd54539bef9849a0e1decc02
--- 1/README
--- 2/README
+++ b/README
@@@ -694,6 -694,13 +694,13 @@@ to users on a remote site. (Or not... i
  Upgrading
  =========
  
+ IMPORTANT NOTE: Laconica 0.7.4 introduced a fix for some
+ incorrectly-stored international characters ("UTF-8"). For new
+ installations, it will now store non-ASCII characters correctly.
+ However, older installations will have the incorrect storage, and will
+ consequently show up "wrong" in browsers. See below for how to deal
+ with this situation.
  If you've been using Laconica 0.6, 0.5 or lower, or if you've been
  tracking the "git" version of the software, you will probably want
  to upgrade and keep your existing data. There is no automated upgrade
@@@ -783,6 -790,29 +790,29 @@@ problem
  3. When fixup_inboxes is finished, you can set the enabled flag to
     'true'.
  
+ UTF-8 Database
+ --------------
+ Laconica 0.7.4 introduced a fix for some incorrectly-stored
+ international characters ("UTF-8"). This fix is not
+ backwards-compatible; installations from before 0.7.4 will show
+ non-ASCII characters of old notices incorrectly. This section explains
+ what to do.
+ 0. You can disable the new behaviour by setting the 'db''utf8' config
+    option to "false". You should only do this until you're ready to
+    convert your DB to the new format.
+ 1. When you're ready to convert, you can run the fixup_utf8.php script
+    in the scripts/ subdirectory. If you've had the "new behaviour"
+    enabled (probably a good idea), you can give the ID of the first
+    "new" notice as a parameter, and only notices before that one will
+    be converted. Notices are converted in reverse chronological order,
+    so the most recent (and visible) ones will be converted first. The
+    script should work whether or not you have the 'db''utf8' config
+    option enabled.
+ 2. When you're ready, set $config['db']['utf8'] to true, so that
+    new notices will be stored correctly.
  Configuration options
  =====================
  
@@@ -910,6 -940,10 +940,10 @@@ mirror: you can set this to an array o
        and adding the slaves to this array. Note that if you want some
        requests to go to the 'database' (master) server, you'll need
        to include it in this array, too.
+ utf8: whether to talk to the database in UTF-8 mode. This is the default
+       with new installations, but older sites may want to turn it off
+       until they get their databases fixed up. See "UTF-8 database"
+       above for details.
  
  syslog
  ------
@@@ -1162,6 -1196,6 +1196,21 @@@ reporturl: URL to post statistics to. D
             set 'run' to 'never' than to set this value to something
             nonsensical.
  
++
++attachments
++-----------
++
++The software lets users upload files with their notices. You can configure
++the types of accepted files by mime types and a trio of quota options:
++per file, per user (total), per user per month.
++
++supported: an array of mime types you accept to store and distribute,
++           like 'image/gif', 'video/mpeg', 'audio/mpeg', etc.
++file_quota: maximum size for a single file upload in bytes.
++user_quota: total size in bytes a user can store.
++monthly_quota: total size permitted in the current month.
++
++
  Troubleshooting
  ===============
  
diff --combined js/util.js
index 85ab48b4c0887638a20cdaa75967b5ff2fe11100,c710ae839277c053ef6d889b661469dee57feed2..acf44a17c78d9f27fb8cadb76b290652b7dbef9c
   */
  
  $(document).ready(function(){
 +    $('input#notice_data-attach').toggle();
 +    $('label[for=notice_data-attach]').text('Upload a file as an attachment?');
 +    $('label[for=notice_data-attach]').click(function () {
 +        if ('Upload a file as an attachment?' == $(this).text()) {
 +            $(this).text('Upload: ');
 +            $('input#notice_data-attach').slideDown('fast');
 +        } else {
 +            $('input#notice_data-attach').slideUp('fast', function() {$('label[for=notice_data-attach]').text('Upload a file as an attachment?');});
 +        }
 +    });
 +
 +    $('a.attachment').click(function() {$().jOverlay({url: $('address .url')[0].href+'/attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/ajax'}); return false; });
 +    $("a.thumbnail").hover(
 +        function() {
 +            var anchor = $(this);
 +            $("a.thumbnail").children('img').remove();
 +
 +            setTimeout(function() {
 +                anchor.closest(".entry-title").addClass('ov');
 +                $.get($('address .url')[0].href+'/attachment/' + (anchor.attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) {
 +                    anchor.append(data);
 +                });
 +            }, 250);
 +
 +            setTimeout(function() {
 +                anchor.children('img').remove();
 +                anchor.closest(".entry-title").removeClass('ov');
 +            }, 3000);
 +        },
 +        function() {
 +            $(this).children('img').remove();
 +            $(this).closest(".entry-title").removeClass('ov');
 +        }
 +    );
 +
        // count character on keyup
        function counter(event){
                var maxLength = 140;
                                                           }
                                                                                                        }
                                                                                                        $("#notice_data-text").val("");
 +                                                                                              $("#notice_data-attach").val("");
                                                      counter();
                                                                                                }
                                                                                                $("#form_notice").removeClass("processing");
        $("#form_notice").each(addAjaxHidden);
      NoticeHover();
      NoticeReply();
+     NoticeAttachments();
  });
  
  
@@@ -288,3 -253,53 +289,53 @@@ function NoticeReplySet(nick,id) 
        }
        return true;
  }
+ function NoticeAttachments() {
+     $.fn.jOverlay.options = {
+         method : 'GET',
+         data : '',
+         url : '',
+         color : '#000',
+         opacity : '0.6',
+         zIndex : 99,
+         center : true,
+         imgLoading : $('address .url')[0].href+'theme/base/images/illustrations/illu_progress_loading-01.gif',
+         bgClickToClose : true,
+         success : function() {
+             $('#jOverlayContent').append('<button>&#215;</button>');
+             $('#jOverlayContent button').click($.closeOverlay);
+         },
+         timeout : 0
+     };
+     $('a.attachment').click(function() {
+         $().jOverlay({url: $('address .url')[0].href+'/attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/ajax'});
+         return false;
+     });
+     
+     var t;
+     $("body:not(#shownotice) a.thumbnail").hover(
+         function() {
+             var anchor = $(this);
+             $("a.thumbnail").children('img').hide();
+             anchor.closest(".entry-title").addClass('ov');
+             if (anchor.children('img').length == 0) {
+                 t = setTimeout(function() {
+                     $.get($('address .url')[0].href+'/attachment/' + (anchor.attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) {
+                         anchor.append(data);
+                     });
+                 }, 500);
+             }
+             else {
+                 anchor.children('img').show();
+             }
+         },
+         function() {
+             clearTimeout(t);
+             $("a.thumbnail").children('img').hide();
+             $(this).closest(".entry-title").removeClass('ov');
+         }
+     );
+ }
diff --combined lib/attachmentlist.php
index a58a50f6fe9cfa8d109d7559227bcf500d1dc4fc,559962accab60e4614f35773001a22182c5fb734..61749dca578a1cf0688bb2290b26217990b37dd1
@@@ -80,22 -80,20 +80,21 @@@ class AttachmentList extends Widge
  
      function show()
      {
-         $this->out->elementStart('dl', array('id' =>'attachment'));
 +        $atts = new File;
 +        $att = $atts->getAttachments($this->notice->id);
 +        if (empty($att)) return 0;
+         $this->out->elementStart('dl', array('id' =>'attachments'));
          $this->out->element('dt', null, _('Attachments'));
          $this->out->elementStart('dd');
-         $this->out->elementStart('ul', array('class' => 'attachments'));
+         $this->out->elementStart('ol', array('class' => 'attachments'));
  
 -        $atts = new File;
 -        $att = $atts->getAttachments($this->notice->id);
          foreach ($att as $n=>$attachment) {
              $item = $this->newListItem($attachment);
              $item->show();
          }
  
          $this->out->elementEnd('dd');
-         $this->out->elementEnd('ul');
+         $this->out->elementEnd('ol');
          $this->out->elementEnd('dl');
  
          return count($att);
diff --combined lib/common.php
index ede8d6277f2ebab784ccf5c49cf365b37d7f2992,4a98741e8e773e8377453a46ffa55eb7c2311b49..838f52f9d54ab3448b02674a830876c3a5bea7c2
@@@ -163,40 -163,6 +163,40 @@@ $config 
          array('run' => 'web',
                'frequency' => 10000,
                'reporturl' => 'http://laconi.ca/stats/report'),
 +        'attachments' =>
 +        array('supported' => array('image/png',
 +            'image/jpeg',
 +            'image/gif',
 +            'image/svg+xml',
 +            'audio/mpeg',
 +            'application/ogg',
 +            'application/pdf',
 +            'application/vnd.oasis.opendocument.text',
 +            'application/vnd.oasis.opendocument.text-template',
 +            'application/vnd.oasis.opendocument.graphics',
 +            'application/vnd.oasis.opendocument.graphics-template',
 +            'application/vnd.oasis.opendocument.presentation',
 +            'application/vnd.oasis.opendocument.presentation-template',
 +            'application/vnd.oasis.opendocument.spreadsheet',
 +            'application/vnd.oasis.opendocument.spreadsheet-template',
 +            'application/vnd.oasis.opendocument.chart',
 +            'application/vnd.oasis.opendocument.chart-template',
 +            'application/vnd.oasis.opendocument.image',
 +            'application/vnd.oasis.opendocument.image-template',
 +            'application/vnd.oasis.opendocument.formula',
 +            'application/vnd.oasis.opendocument.formula-template',
 +            'application/vnd.oasis.opendocument.text-master',
 +            'application/vnd.oasis.opendocument.text-web',
 +            'application/zip',
 +            'text/plain',
 +            'video/mpeg',
 +            'video/mp4',
 +            'video/quicktime',
 +            'video/mpeg'),
 +        'file_quota' => 5000000,
 +        'user_quota' => 50000000,
 +        'monthly_quota' => 15000000,
 +        ),
          );
  
  $config['db'] = &PEAR::getStaticProperty('DB_DataObject','options');
@@@ -208,6 -174,7 +208,7 @@@ $config['db'] 
          'require_prefix' => 'classes/',
          'class_prefix' => '',
          'mirror' => null,
+         'utf8' => true,
          'db_driver' => 'DB', # XXX: JanRain libs only work with DB
          'quote_identifiers' => false,
          'type' => 'mysql' );
@@@ -257,19 -224,19 +258,19 @@@ if ($_db_name != 'laconica' && !array_k
  
  // XXX: how many of these could be auto-loaded on use?
  
 -require_once('Validate.php');
 -require_once('markdown.php');
 +require_once 'Validate.php';
 +require_once 'markdown.php';
  
 -require_once(INSTALLDIR.'/lib/util.php');
 -require_once(INSTALLDIR.'/lib/action.php');
 -require_once(INSTALLDIR.'/lib/theme.php');
 -require_once(INSTALLDIR.'/lib/mail.php');
 -require_once(INSTALLDIR.'/lib/subs.php');
 -require_once(INSTALLDIR.'/lib/Shorturl_api.php');
 -require_once(INSTALLDIR.'/lib/twitter.php');
 +require_once INSTALLDIR.'/lib/util.php';
 +require_once INSTALLDIR.'/lib/action.php';
 +require_once INSTALLDIR.'/lib/theme.php';
 +require_once INSTALLDIR.'/lib/mail.php';
 +require_once INSTALLDIR.'/lib/subs.php';
 +require_once INSTALLDIR.'/lib/Shorturl_api.php';
 +require_once INSTALLDIR.'/lib/twitter.php';
  
 -require_once(INSTALLDIR.'/lib/clientexception.php');
 -require_once(INSTALLDIR.'/lib/serverexception.php');
 +require_once INSTALLDIR.'/lib/clientexception.php';
 +require_once INSTALLDIR.'/lib/serverexception.php';
  
  // XXX: other formats here
  
diff --combined lib/noticelist.php
index 420272515e1d9d12895eee965d9cbaf88540b517,0e80a9778ef6568a288fa444b4058af9aa46a02f..5513e317e0406fff6b8396444eaf892778b298be
@@@ -86,7 -86,7 +86,7 @@@ class NoticeList extends Widge
      {
          $this->out->elementStart('div', array('id' =>'notices_primary'));
          $this->out->element('h2', null, _('Notices'));
-         $this->out->elementStart('ul', array('class' => 'notices'));
+         $this->out->elementStart('ol', array('class' => 'notices xoxo'));
  
          $cnt = 0;
  
              $item->show();
          }
  
-         $this->out->elementEnd('ul');
+         $this->out->elementEnd('ol');
          $this->out->elementEnd('div');
  
          return $cnt;
@@@ -206,7 -206,6 +206,7 @@@ class NoticeListItem extends Widge
          return 'shownotice' !== $this->out->args['action'];
      }
  
 +/*
      function attachmentCount($discriminant = true) {
          $file_oembed = new File_oembed;
          $query = "select count(*) as c from file_oembed join file_to_post on file_oembed.file_id = file_to_post.file_id where post_id=" . $this->notice->id;
          $file_oembed->fetch();
          return intval($file_oembed->c);
      }
 +*/
 +
 +    function showWithAttachment() {
 +    }
  
      function showNoticeInfo()
      {
          $this->out->elementStart('div', 'entry-content');
          $this->showNoticeLink();
 +//        $this->showWithAttachment();
          $this->showNoticeSource();
          $this->showContext();
          $this->out->elementEnd('div');
          $this->out->element('abbr', array('class' => 'published',
                                            'title' => $dt),
                              common_date_string($this->notice->created));
 +
 +        $f2p = File_to_post::staticGet('post_id', $this->notice->id);
 +        if (!empty($f2p)) {
 +            $this->out->text(_(' (with attachments) '));
 +        }
          $this->out->elementEnd('a');
          $this->out->elementEnd('dd');
          $this->out->elementEnd('dl');