Revision: 53730
Author:   demon
Date:     2009-07-24 22:30:07 +0000 (Fri, 24 Jul 2009)

Log Message:
-----------
(bug 17601) Fix the wrong linked message, add the missing header, make 
phpFlickr path configurable so that also other versions of phpFlickr can be 
used. Based on patch by DaSch.

Modified Paths:
--------------
    trunk/extensions/ImportFreeImages/ImportFreeImages.body.php
    trunk/extensions/ImportFreeImages/ImportFreeImages.i18n.php
    trunk/extensions/ImportFreeImages/ImportFreeImages.php

Modified: trunk/extensions/ImportFreeImages/ImportFreeImages.body.php
===================================================================
--- trunk/extensions/ImportFreeImages/ImportFreeImages.body.php 2009-07-24 
22:15:23 UTC (rev 53729)
+++ trunk/extensions/ImportFreeImages/ImportFreeImages.body.php 2009-07-24 
22:30:07 UTC (rev 53730)
@@ -21,12 +21,18 @@
        public function execute( $par ) {
                global $wgUser, $wgOut, $wgRequest, $wgIFI_FlickrAPIKey, 
$wgEnableUploads;
                global $wgIFI_ResultsPerPage, $wgIFI_FlickrSort, 
$wgIFI_FlickrLicense, $wgIFI_ResultsPerRow;
-               global $wgIFI_PromptForFilename, $wgIFI_FlickrSearchBy, 
$wgIFI_ThumbType;
+               global $wgIFI_PromptForFilename, $wgIFI_FlickrSearchBy, 
$wgIFI_ThumbType, $wgIFphpFlickr;
 
                wfLoadExtensionMessages( 'ImportFreeImages' );
 
+               $this->setHeaders();
+
                wfSetupSession();
-               require_once("phpFlickr-2.2.0/phpFlickr.php");
+               if( !is_readable( $wgIFphpFlickr ) ) {
+                       $wgOut->errorpage( 'error', 
'importfreeimages_nophpflickr' );
+                       return;
+               }
+               require_once( $wgIFphpFlickr );
 
                $importPage = SpecialPage::getTitleFor( 'ImportFreeImages' );
 
@@ -77,7 +83,7 @@
                $q = $wgRequest->getText( 'q' );
 
                global $wgScript;
-               $wgOut->addHTML( wfMsg( 'importfreeimages-description' ) . "<br 
/><br />
+               $wgOut->addHTML( wfMsg( 'importfreeimages_description' ) . "<br 
/><br />
                        <form method=GET action=\"$wgScript\">".wfMsg('search').
                        Xml::hidden( 'title', $importPage->getPrefixedDBkey() ) 
.
                        ": <input type=text name=q value='" . 
htmlspecialchars($q) . "'><input type=submit 
value=".wfMsg('search')."></form>");

Modified: trunk/extensions/ImportFreeImages/ImportFreeImages.i18n.php
===================================================================
--- trunk/extensions/ImportFreeImages/ImportFreeImages.i18n.php 2009-07-24 
22:15:23 UTC (rev 53729)
+++ trunk/extensions/ImportFreeImages/ImportFreeImages.i18n.php 2009-07-24 
22:30:07 UTC (rev 53730)
@@ -16,7 +16,7 @@
        'importfreeimages-desc'           => 'Provides a way of 
[[Special:ImportFreeImages|importing properly licensed photos]] from 
[http://www.flickr.com flickr]',
        'importfreeimages_description'    => 'This page allows you to search 
properly licensed photos from flickr and import them into your wiki.',
        'importfreeimages_noapikey'       => 'You have not configured your 
Flickr API Key.
-To do so, please obtain a API key from  
[http://www.flickr.com/services/api/misc.api_keys.html here] and set 
wgFlickrAPIKey in ImportFreeImages.php.',
+To do so, please obtain a API key from  
[http://www.flickr.com/services/api/misc.api_keys.html here] and set 
$wgFlickrAPIKey in ImportFreeImages.php.',
        'importfreeimages_nophotosfound'  => 'No photos were found for your 
search criteria \'$1\', please try again.',
        'importfreeimages_invalidurl'     => 'The URL "$1" is not a valid 
Flickr image.',
        'importfreeimages_owner'          => 'Author',
@@ -25,6 +25,7 @@
        'importfreeimages_filefromflickr' => '$1 by user <b>[$2]</b> from 
flickr. Original URL',
        'importfreeimages_promptuserforfilename' => 'Please enter a destination 
filename:',
        'importfreeimages_returntoform'   => 'Or, click <a href=\'$1\'>here</a> 
to return to your search results',
+       'importfreeimages_nophpflickr' => 'You have not installed phpFlickr, 
please set $wgIFphpFlickr in your LocalSettings.php.',
 );
 
 /** Message documentation (Message documentation)

Modified: trunk/extensions/ImportFreeImages/ImportFreeImages.php
===================================================================
--- trunk/extensions/ImportFreeImages/ImportFreeImages.php      2009-07-24 
22:15:23 UTC (rev 53729)
+++ trunk/extensions/ImportFreeImages/ImportFreeImages.php      2009-07-24 
22:30:07 UTC (rev 53730)
@@ -17,6 +17,7 @@
 $wgIFI_CreditsTemplate = 'flickr'; // use this to format the image content 
with some key parameters
 $wgIFI_GetOriginal = true; // import the original version of the photo
 $wgIFI_PromptForFilename = true;  // prompt the user through javascript for 
the destination filename
+$wgIFphpFlickr = 'phpFlickr-2.2.0/phpFlickr.php'; // Path to your phpFlickr 
file
 
 $wgIFI_ResultsPerPage = 20;
 $wgIFI_ResultsPerRow = 4;
@@ -34,7 +35,7 @@
        'path' => __FILE__,
        'name' => 'ImportFreeImages',
        'author' => 'Travis Derouin',
-       'version' => '1.0',
+       'version' => '1.1',
        'description' => 'Provides a way of importing properly licensed photos 
from flickr.',
        'descriptionmsg' => 'importfreeimages-desc',
        'url' => 'http://www.mediawiki.org/wiki/Extension:ImportFreeImages',



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to