mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-07-27 03:17 am

[dw-free] remove all references to scrapbook/fotobilder

[commit: http://hg.dwscoalition.org/dw-free/rev/f10d98c9b5a6]

http://bugs.dwscoalition.org/show_bug.cgi?id=1463

Oops, I broke ljemailgateway by leaving this code in, thanks to Jen for
catching/fixing.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/ljemailgateway.pl
--------------------------------------------------------------------------------
diff -r ff5ca9a82eb2 -r f10d98c9b5a6 cgi-bin/ljemailgateway.pl
--- a/cgi-bin/ljemailgateway.pl	Mon Jul 27 03:15:33 2009 +0000
+++ b/cgi-bin/ljemailgateway.pl	Mon Jul 27 03:17:53 2009 +0000
@@ -18,7 +18,6 @@ require 'ljlib.pl';
 require 'ljlib.pl';
 require 'ljemailgateway-web.pl';
 require 'ljprotocol.pl';
-require 'fbupload.pl';
 use HTML::Entities;
 use IO::Handle;
 use MIME::Words ();
@@ -45,7 +44,7 @@ sub process {
         $format, $tent,
 
         # pict upload vars
-        $fb_upload, $fb_upload_errstr,
+#       $fb_upload, $fb_upload_errstr,
     );
 
     $head = $entity->head;
@@ -443,45 +442,45 @@ sub process {
 
     # upload picture attachments to fotobilder.
     # undef return value? retry posting for later.
-    $fb_upload = upload_images(
-        $entity, $u,
-        \$fb_upload_errstr,
-        {
-            imgsec  => $lj_headers{'imgsecurity'},
-            galname => $lj_headers{'gallery'} || $u->{'emailpost_gallery'}
-        }
-      ) || return $err->( $fb_upload_errstr, { retry => 1 } );
-
-    # if we found and successfully uploaded some images...
-    if (ref $fb_upload eq 'ARRAY') {
-        my $fb_html = LJ::FBUpload::make_html( $u, $fb_upload, \%lj_headers );
-        ##
-        ## A problem was here: 
-        ## $body is utf-8 text without utf-8 flag (see Unicode::MapUTF8::to_utf8),
-        ## $fb_html is ASCII with utf-8 flag on (because uploaded image description
-        ## is parsed by XML::Simple, see cgi-bin/fbupload.pl, line 153).
-        ## When 2 strings are concatenated, $body is auto-converted (incorrectly)
-        ## from Latin-1 to UTF-8.
-        ##
-        $fb_html = Encode::encode("utf8", $fb_html) if Encode::is_utf8($fb_html);
-        $body .= $fb_html;
-    }
-
-    # at this point, there are either no images in the message ($fb_upload == 1)
-    # or we had some error during upload that we may or may not want to retry
-    # from.  $fb_upload contains the http error code.
-    if (   $fb_upload == 400   # bad http request
-        || $fb_upload == 1401  # user has exceeded the fb quota
-        || $fb_upload == 1402  # user has exceeded the fb quota
-    ) {
-        # don't retry these errors, go ahead and post the body
-        # to the journal, postfixed with the remote error.
-        $body .= "\n";
-        $body .= "(Your picture was not posted: $fb_upload_errstr)";
-    }
-
-    # Fotobilder server error.  Retry.
-    return $err->( $fb_upload_errstr, { retry => 1 } ) if $fb_upload == 500;
+#     $fb_upload = upload_images(
+#         $entity, $u,
+#         \$fb_upload_errstr,
+#         {
+#             imgsec  => $lj_headers{'imgsecurity'},
+#             galname => $lj_headers{'gallery'} || $u->{'emailpost_gallery'}
+#         }
+#       ) || return $err->( $fb_upload_errstr, { retry => 1 } );
+# 
+#     # if we found and successfully uploaded some images...
+#     if (ref $fb_upload eq 'ARRAY') {
+#         my $fb_html = LJ::FBUpload::make_html( $u, $fb_upload, \%lj_headers );
+#         ##
+#         ## A problem was here: 
+#         ## $body is utf-8 text without utf-8 flag (see Unicode::MapUTF8::to_utf8),
+#         ## $fb_html is ASCII with utf-8 flag on (because uploaded image description
+#         ## is parsed by XML::Simple, see cgi-bin/fbupload.pl, line 153).
+#         ## When 2 strings are concatenated, $body is auto-converted (incorrectly)
+#         ## from Latin-1 to UTF-8.
+#         ##
+#         $fb_html = Encode::encode("utf8", $fb_html) if Encode::is_utf8($fb_html);
+#         $body .= $fb_html;
+#     }
+# 
+#     # at this point, there are either no images in the message ($fb_upload == 1)
+#     # or we had some error during upload that we may or may not want to retry
+#     # from.  $fb_upload contains the http error code.
+#     if (   $fb_upload == 400   # bad http request
+#         || $fb_upload == 1401  # user has exceeded the fb quota
+#         || $fb_upload == 1402  # user has exceeded the fb quota
+#     ) {
+#         # don't retry these errors, go ahead and post the body
+#         # to the journal, postfixed with the remote error.
+#         $body .= "\n";
+#         $body .= "(Your picture was not posted: $fb_upload_errstr)";
+#     }
+# 
+#     # Fotobilder server error.  Retry.
+#     return $err->( $fb_upload_errstr, { retry => 1 } ) if $fb_upload == 500;
 
     # build lj entry
     $req = {
@@ -672,59 +671,59 @@ sub check_sig {
 # undef - failure during upload
 # http_code - failure during upload w/ code
 # hashref - { title => url } for each image uploaded
-sub upload_images
-{
-    my ($entity, $u, $rv, $opts) = @_;
-    return 1 unless LJ::get_cap($u, 'fb_can_upload') && $LJ::FB_SITEROOT;
-
-    my @imgs = get_entity($entity, 'image');
-    return 1 unless scalar @imgs;
-
-    my @images;
-    foreach my $img_entity (@imgs) {
-        my $img     = $img_entity->bodyhandle;
-        my $path    = $img->path;
-
-        my $result = LJ::FBUpload::do_upload(
-            $u, $rv,
-            {
-                path    => $path,
-                rawdata => \$img->as_string,
-                imgsec  => $opts->{'imgsec'},
-                galname => $opts->{'galname'},
-            }
-        );
-
-        # do upload() returned undef?  This is a posting error
-        # that should most likely be retried, due to something
-        # wrong on our side of things.
-        return if ! defined $result && $$rv;
-
-        # http error during upload attempt
-        # decide retry based on error type in caller
-        return $result unless ref $result;
-
-        # examine $result for errors
-        if ($result->{Error}->{code}) {
-            $$rv = $result->{Error}->{content};
-
-            # add 1000 to error code, so we can easily tell the
-            # difference between fb protocol error and
-            # http error when checking results.
-            return $result->{Error}->{code} + 1000;
-        }
-
-        push @images, {
-            url     => $result->{URL},
-            width   => $result->{Width},
-            height  => $result->{Height},
-            title   => $result->{Title},
-        };
-    }
-
-    return \@images if scalar @images;
-    return;
-}
+# sub upload_images
+# {
+#     my ($entity, $u, $rv, $opts) = @_;
+#     return 1 unless LJ::get_cap($u, 'fb_can_upload') && $LJ::FB_SITEROOT;
+# 
+#     my @imgs = get_entity($entity, 'image');
+#     return 1 unless scalar @imgs;
+# 
+#     my @images;
+#     foreach my $img_entity (@imgs) {
+#         my $img     = $img_entity->bodyhandle;
+#         my $path    = $img->path;
+# 
+#         my $result = LJ::FBUpload::do_upload(
+#             $u, $rv,
+#             {
+#                 path    => $path,
+#                 rawdata => \$img->as_string,
+#                 imgsec  => $opts->{'imgsec'},
+#                 galname => $opts->{'galname'},
+#             }
+#         );
+# 
+#         # do upload() returned undef?  This is a posting error
+#         # that should most likely be retried, due to something
+#         # wrong on our side of things.
+#         return if ! defined $result && $$rv;
+# 
+#         # http error during upload attempt
+#         # decide retry based on error type in caller
+#         return $result unless ref $result;
+# 
+#         # examine $result for errors
+#         if ($result->{Error}->{code}) {
+#             $$rv = $result->{Error}->{content};
+# 
+#             # add 1000 to error code, so we can easily tell the
+#             # difference between fb protocol error and
+#             # http error when checking results.
+#             return $result->{Error}->{code} + 1000;
+#         }
+# 
+#         push @images, {
+#             url     => $result->{URL},
+#             width   => $result->{Width},
+#             height  => $result->{Height},
+#             title   => $result->{Title},
+#         };
+#     }
+# 
+#     return \@images if scalar @images;
+#     return;
+# }
 
 sub dblog
 {
--------------------------------------------------------------------------------