Coder Social home page Coder Social logo

alfredoramos / phpbb-ext-imgur Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 3.0 1.16 MB

Imgur extension for phpBB

License: GNU General Public License v2.0

HTML 13.14% PHP 62.34% CSS 5.89% JavaScript 18.56% SCSS 0.07%
phpbb phpbb-extension imgur imgur-api imgur-uploader

phpbb-ext-imgur's Introduction

About

Imgur extension for phpBB.

Build Status Latest Stable Version Code Quality Translation Progress License

With this extension you can click on the Imgur posting button and select the image(s) you want to upload.

If the upload is successful it will add the image in the topic, private message or signature content. You can choose in the Administration Control Panel to show the uploaded image as plan text or with BBCode as URL, image (default) or thumbnail.

Features

  • Change Imgur API data through ACP
  • Optionally, set an album where all the images will be uploaded to.
  • Compatibility with Advanced BBCode Box extension
  • CSRF protection
  • Administrator log on configuration changes
  • Insert BBCode/text at cursor position
  • Album download link in the ACP for backup
  • Upload progress bar
  • Compatibility with QuickReply Reloaded extension
  • Compatibility with mChat extension
  • Drop-down menu in posting box button
  • Imgur tab in posting box options
  • Drag and drop upload in Imgur tab
  • Save some user preferences using localStorage and sessionStorage
  • ACP settings to enable/disable output types

Requirements

  • PHP 7.1.3 or greater
  • phpBB 3.3 or greater
  • Composer (for development only)
  • Imgur API data (client_id and client_secret)

Support

Donate

If you like or found my work useful and want to show some appreciation, you can consider supporting its development by giving a donation.

Donate with PayPal Donate with Stripe
Donate with PayPal Donate with Stripe

Installation

  • Download the latest release
  • Decompress the *.zip or *.tar.gz file
  • Copy the files and directories inside {PHPBB_ROOT}/ext/alfredoramos/imgur/
  • Run composer install --prefer-dist --no-dev inside {PHPBB_ROOT}/ext/alfredoramos/imgur/
  • Go to your Administration Control Panel > Customize > Manage extensions
  • Click on Enable and confirm

Preview

ACP settings ACP settings API ACP output settings Topic Output menu Output tab

(Click to view in full size)

Imgur API

  • Create an Imgur account, if you don't have one already
  • Register your application at https://api.imgur.com/oauth2/addclient
  • Type an application name
  • Select OAuth 2 authorization with a callback URL
  • Set Authorization callback URL to http://domain.tld/app.php/imgur/authorize, use https:// if you have an SSL certificate
  • Verify that the previous URL works
  • Type your email and a short description
  • After clicking Submit you should get a client_id and client_secret

Configuration

  • Go to your Administration Control Panel > Extensions > Imgur settings
  • Set the Client ID, Client Secret and optionally an Album
  • Click on Submit
  • Once you have the required API data, click on the authorization link shown above
  • A new window will popup to authorize the application
  • Login to your Imgur account and grant access
  • The window will close itself when it's done, or show an error message

To customize the look and feel:

  • Move into {PHPBB_ROOT}/ext/alfredoramos/imgur/
  • Copy the styles/prosilver/ directory to styles/{STYLE}/
  • Edit the file styles/{STYLE}/theme/css/imgur.css as needed

Note: If your style doesn't inherit from prosilver, you should follow the steps above even if you don't want to change any file.

Uninstallation

  • Go to your Administration Control Panel > Customize > Manage extensions
  • Click on Disable and confirm
  • Go back to Manage extensions > Imgur > Delete data and confirm

Upgrade

  • Go to your Administration Control Panel > Customize > Manage extensions
  • Click on Disable and confirm
  • Delete all the files inside {PHPBB_ROOT}/ext/alfredoramos/imgur/
  • Download the new version
  • Upload the new files inside {PHPBB_ROOT}/ext/alfredoramos/imgur/
  • Enable the extension again

phpbb-ext-imgur's People

Contributors

alfredoramos avatar alhitary avatar dependabot[bot] avatar github-actions[bot] avatar imgbotapp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

phpbb-ext-imgur's Issues

Doesn't load pictures after updating extension 1.3.1 to 1.6.0

Doesn't load pictures after updating extension 1.3.1 to 1.6.0

Error 500.
phpBB 3.3.1
Php 7.3.20
In logs:

[31-Aug-2020 16:13:11 Europe/Moscow] PHP Fatal error:  Uncaught Error: Call to undefined function GuzzleHttp\_idn_uri_convert() in /home/n/nosipova/magicclover.ru/public_html/ext/alfredoramos/imgur/vendor/guzzlehttp/guzzle/src/Client.php:220
Stack trace:
#0 /home/n/nosipova/magicclover.ru/public_html/ext/alfredoramos/imgur/vendor/guzzlehttp/guzzle/src/Client.php(155): GuzzleHttp\Client->buildUri(Object(GuzzleHttp\Psr7\Uri), Array)
#1 /home/n/nosipova/magicclover.ru/public_html/ext/alfredoramos/imgur/vendor/guzzlehttp/guzzle/src/Client.php(183): GuzzleHttp\Client->requestAsync('POST', 'image', Array)
#2 /home/n/nosipova/magicclover.ru/public_html/ext/alfredoramos/imgur/vendor/j0k3r/php-imgur-api-client/lib/Imgur/HttpClient/HttpClient.php(115): GuzzleHttp\Client->request('POST', 'image', Array)
#3 /home/n/nosipova/magicclover.ru/public_html/ext/alfredoramos/imgur/vendor/j0k3r/php-imgur-api-client/lib/Imgur/HttpClient/HttpClient.php(85): Imgur\HttpClient\HttpClient->performRequest('image', Array, 'POST')
#4 /home/n/nosipova/magicclover.ru/public_html/ext/alfredoramos/imgur/vendor/j0k3r/php-imgur-api-client/lib/Imgur/Api/AbstractApi.php(64): Imgur\HttpClient\HttpClient->post('image', Array)
#5 /home/n/nosipova/magicclover.ru/public_html/ext/alfredoramos/imgur/vendor/j0k3r/php-imgur-api-client/lib/Imgur/Api/Image.php(55): Imgur\Api\AbstractApi->post('image', Array)
#6 /home/n/nosipova/magicclover.ru/public_html/ext/alfredoramos/imgur/controller/imgur.php(282): Imgur\Api\Image->upload(Array)
#7 /home/n/nosipova/magicclover.ru/public_html/vendor/symfony/http-kernel/HttpKernel.php(151): alfredoramos\imgur\controller\imgur->upload('17477383')
#8 /home/n/nosipova/magicclover.ru/public_html/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(phpbb\symfony_request), 1)
#9 /home/n/nosipova/magicclover.ru/public_html/app.php(35): Symfony\Component\HttpKernel\HttpKernel->handle(Object(phpbb\symfony_request))
#10 {main}
  thrown in /home/n/nosipova/magicclover.ru/public_html/ext/alfredoramos/imgur/vendor/guzzlehttp/guzzle/src/Client.php on line 220

Drag and drop upload

It would be easier for some people to just drag and drop images, just like attachments.

Settings problem with last master

Hi,

I downloaded this morning the last master to test thumbail and to do the french translation.

On my test forum, i have error when i go to the extension settings ? normal as you are currently working on it ?

here the message :

Fatal error: Class 'Imgur\Client' not found in C:\Program Files (x86)\EasyPHP-Devserver-17\eds-www\dowfr\cache\production\container_dbdbe80dc7030ae9bd39ee30cca82130.php on line 435

I have of course clean cache before.

Thanks

New release

Hello,

I don't know if this is the right place to ask this kind of question, but here it goes. Do you plan to do a new release? I've seen that you made new changes to include a progress bar for the upload process, but such a change is not included in the latest release.

Thanks.

Fatal error: Uncaught Error: Class 'Imgur\Client' not found

Hi @AlfredoRamos,

on local environment I tried to test my last FRENCH translation on your last snapshot from GitHub (v1.3.1-dev) and I get two errors:

Fatal error: Uncaught Error: Class 'Imgur\Client' not found in C:\UwAmp\www\quickinstall\boards\phpbb328fr\cache\production\container_dbdbe80dc7030ae9bd39ee30cca82130.php:369
Stack trace: #0
C:\UwAmp\www\quickinstall\boards\phpbb328fr\vendor\symfony\dependency-injection\Container.php(295): phpbb_cache_container->getAlfredoramos_Imgur_J0k3r_Imgur_ClientService() #1
C:\UwAmp\www\quickinstall\boards\phpbb328fr\vendor\symfony\dependency-injection\ContainerBuilder.php(446): Symfony\Component\DependencyInjection\Container->get('alfredoramos.im...', 2) #2
C:\UwAmp\www\quickinstall\boards\phpbb328fr\cache\production\container_dbdbe80dc7030ae9bd39ee30cca82130.php(339): Symfony\Component\DependencyInjection\ContainerBuilder->get('alfredoramos.im...') #3 
C:\UwAmp\www\quickinstall\boards\phpbb328fr\vendor\symfony\dependency-injection\Container.php(295): phpbb_cache_container->getAlfredoramos_Imgur_Acp_ControllerService() #4 
C:\UwAmp\www\quickinstall\boards\phpbb328fr\vendor\symfony\dependency-injection\ContainerBuilder.php(446): Symf in C:\UwAmp\www\quickinstall\boards\phpbb328fr\cache\production\container_dbdbe80dc7030ae9bd39ee30cca82130.php on line 369

And this error just after purged the cache:

Fatal error: Uncaught ReflectionException: Class Imgur\Client does not exist in C:\UwAmp\www\quickinstall\boards\phpbb328fr\vendor\symfony\dependency-injection\ContainerBuilder.php:931 Stack trace: #0
C:\UwAmp\www\quickinstall\boards\phpbb328fr\vendor\symfony\dependency-injection\ContainerBuilder.php(931): ReflectionClass->__construct('Imgur\\Client') #1 
C:\UwAmp\www\quickinstall\boards\phpbb328fr\vendor\symfony\dependency-injection\ContainerBuilder.php(467): Symfony\Component\DependencyInjection\ContainerBuilder->createService(Object(Symfony\Component\DependencyInjection\Definition), Object(SplObjectStorage), 'alfredoramos.im...') #2 
C:\UwAmp\www\quickinstall\boards\phpbb328fr\vendor\symfony\dependency-injection\ContainerBuilder.php(995): Symfony\Component\DependencyInjection\ContainerBuilder->get('alfredoramos.im...', 1) #3 
C:\UwAmp\www\quickinstall\boards\phpbb328fr\vendor\symfony\dependency-injection\ContainerBuilder.php(992): Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices(Object(Symfony\Com in C:\UwAmp\www\quickinstall\boards\phpbb328fr\vendor\symfony\dependency-injection\ContainerBuilder.php on line 931

Could you take a lool, please?

Regards.

Upgrading from 1.5.1 to 1.6/1.7

Hello,
Firstly thank you so much for this great ext.
It works fine in my phpBB 3.3.2 system with 1.5.1.
I've try to update to a newer version but found difficulties:
Run composer install --prefer-dist --no-dev inside {PHPBB_ROOT}/ext/alfredoramos/imgur/
After a research, I understand that this step can be apply only by the host.
Is that mean that I cannot upgrade to the new versions without having composer?
(just to make it clear - when I upgraded I got a blank screen while trying to get to the ext settings on both versions 1.6, 1.7 and caches weren't the issue).

Verify album ID

Adding an album ID verification could reduce reported issues about problems when uploading where the album ID is invalid.

The Imgur API exposes the following endpoint that can be used to get all the albums IDs and then check if it contains the one entered by the administrator in the PCA:

GET Album IDs (Un-Authed / Authed)

https://api.imgur.com/3/account/{{username}}/albums/ids/{{page}}

https://apidocs.imgur.com/?version=latest#c13fe966-0f8f-425d-9247-298e302e1bc0

Error message

I recently used topic locked with Move Topics When Locked.
Now I get this below error message every day
What can I do to solve this?

Een algemene fout is opgetreden: General Error
» SQL ERROR [ mysqli ]

[0]

SQL

No values specified for SQL IN comparison

BACKTRACE

FILE: (not given by php)
LINE: (not given by php)
CALL: msg_handler()

FILE: [ROOT]/phpbb/db/driver/driver.php
LINE: 996
CALL: trigger_error()

FILE: [ROOT]/phpbb/db/driver/driver.php
LINE: 547
CALL: phpbb\db\driver\driver->sql_error()

FILE: [ROOT]/phpbb/db/driver/factory.php
LINE: 441
CALL: phpbb\db\driver\driver->sql_in_set()

FILE: [ROOT]/ext/alfredoramos/autolocktopics/includes/helper.php
LINE: 241
CALL: phpbb\db\driver\factory->sql_in_set()

FILE: [ROOT]/ext/alfredoramos/autolocktopics/includes/helper.php

LINE: 131
CALL: alfredoramos\autolocktopics\includes\helper->lock_topics()

FILE: [ROOT]/ext/alfredoramos/autolocktopics/cron/task/auto_lock_topics.php
LINE: 52
CALL: alfredoramos\autolocktopics\includes\helper->auto_lock()

FILE: (not given by php)
LINE: (not given by php)
CALL: alfredoramos\autolocktopics\cron\task\auto_lock_topics->run()

FILE: [ROOT]/phpbb/cron/task/wrapper.php
LINE: 104
CALL: call_user_func_array()

FILE: [ROOT]/cron.php
LINE: 78
CALL: phpbb\cron\task\wrapper->__call()

Add server-side image validation

It would further improve the security of the extension and also reduce API calls when the image does not met the file size and MIME type requirements.

FormData polyfill is not always loaded from current CDN

I will need to replace the current CDN as sometimes it throws the following warning in the console:

Loading failed for the <script> with source “https://rawcdn.githack.com/jimmywarting/FormData/3.0.19/formdata.min.js”.

Upload controller does not check if user is logged in

Currently the button and file input is only added to the template if the user is logged in, so unless the user modifies the template files, there's no way a guest or bot can upload images, however that's not verified server side.

French Translation

Hi,

here french translation for last github master download (22/11/2017) for your next release.

Thanks

fr.zip

It should load assets only when needed

Currently it loads CSS and JS files when enabled, however they're only used when the user is logged in since the posting buttons are not shown in any other case.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.