Augmentation vers version 3.3.0
This commit is contained in:
146
install/update/old/ext/phpbb/viglink/acp/viglink_helper.php
Normal file
146
install/update/old/ext/phpbb/viglink/acp/viglink_helper.php
Normal file
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* VigLink extension for the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) 2014 phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\viglink\acp;
|
||||
|
||||
/**
|
||||
* Class to handle allowing or disallowing VigLink services
|
||||
*/
|
||||
class viglink_helper
|
||||
{
|
||||
/** @var \phpbb\cache\driver\driver_interface $cache */
|
||||
protected $cache;
|
||||
|
||||
/** @var \phpbb\config\config $config */
|
||||
protected $config;
|
||||
|
||||
/** @var \phpbb\file_downloader $file_downloader */
|
||||
protected $file_downloader;
|
||||
|
||||
/** @var \phpbb\language\language $language */
|
||||
protected $language;
|
||||
|
||||
/** @var \phpbb\log\log $log */
|
||||
protected $log;
|
||||
|
||||
/** @var \phpbb\user $user */
|
||||
protected $user;
|
||||
|
||||
/** @var bool Use SSL or not */
|
||||
protected $use_ssl = false;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\cache\driver\driver_interface $cache
|
||||
* @param \phpbb\config\config $config
|
||||
* @param \phpbb\file_downloader $file_downloader
|
||||
* @param \phpbb\language\language $language
|
||||
* @param \phpbb\log\log $log
|
||||
* @param \phpbb\user $user
|
||||
*/
|
||||
public function __construct(\phpbb\cache\driver\driver_interface $cache, \phpbb\config\config $config, \phpbb\file_downloader $file_downloader, \phpbb\language\language $language, \phpbb\log\log $log, \phpbb\user $user)
|
||||
{
|
||||
$this->cache = $cache;
|
||||
$this->config = $config;
|
||||
$this->file_downloader = $file_downloader;
|
||||
$this->language = $language;
|
||||
$this->log = $log;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the latest VigLink services information from phpBB
|
||||
*
|
||||
* @param bool $force_update Ignores cached data. Defaults to false.
|
||||
* @param bool $force_cache Force the use of the cache. Override $force_update.
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set_viglink_services($force_update = false, $force_cache = false)
|
||||
{
|
||||
$cache_key = '_versioncheck_viglink_' . $this->use_ssl;
|
||||
|
||||
$info = $this->cache->get($cache_key);
|
||||
|
||||
if ($info === false && $force_cache)
|
||||
{
|
||||
throw new \RuntimeException($this->language->lang('VERSIONCHECK_FAIL'));
|
||||
}
|
||||
else if ($info === false || $force_update)
|
||||
{
|
||||
try
|
||||
{
|
||||
$info = $this->file_downloader->get('www.phpbb.com', '/viglink', 'enabled', 443);
|
||||
}
|
||||
catch (\phpbb\exception\runtime_exception $exception)
|
||||
{
|
||||
$prepare_parameters = array_merge(array($exception->getMessage()), $exception->get_parameters());
|
||||
throw new \RuntimeException(call_user_func_array(array($this->language, 'lang'), $prepare_parameters));
|
||||
}
|
||||
|
||||
if ($info === '0')
|
||||
{
|
||||
$this->set_viglink_configs(array(
|
||||
'allow_viglink_phpbb' => false,
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
$info = '1';
|
||||
$this->set_viglink_configs(array(
|
||||
'allow_viglink_phpbb' => true,
|
||||
));
|
||||
}
|
||||
|
||||
$this->cache->put($cache_key, $info, 86400); // 24 hours
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets VigLink service configs as determined by phpBB
|
||||
*
|
||||
* @param array $data Array of VigLink file data.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function set_viglink_configs($data)
|
||||
{
|
||||
$viglink_configs = array(
|
||||
'allow_viglink_phpbb',
|
||||
'phpbb_viglink_api_key',
|
||||
);
|
||||
|
||||
foreach ($viglink_configs as $cfg_name)
|
||||
{
|
||||
if (array_key_exists($cfg_name, $data) && ($data[$cfg_name] != $this->config[$cfg_name] || !isset($this->config[$cfg_name])))
|
||||
{
|
||||
$this->config->set($cfg_name, $data[$cfg_name]);
|
||||
}
|
||||
}
|
||||
|
||||
$this->config->set('viglink_last_gc', time(), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a VigLink error message to the error log
|
||||
*
|
||||
* @param string $message The error message
|
||||
*/
|
||||
public function log_viglink_error($message)
|
||||
{
|
||||
$user_id = empty($this->user->data) ? ANONYMOUS : $this->user->data['user_id'];
|
||||
$user_ip = empty($this->user->ip) ? '' : $this->user->ip;
|
||||
|
||||
$this->log->add('critical', $user_id, $user_ip, 'LOG_VIGLINK_CHECK_FAIL', false, array($message));
|
||||
}
|
||||
}
|
||||
27
install/update/old/ext/phpbb/viglink/composer.json
Normal file
27
install/update/old/ext/phpbb/viglink/composer.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "phpbb/viglink",
|
||||
"type": "phpbb-extension",
|
||||
"description": "The VigLink extension for phpBB makes it possible to earn revenue, without any change to the user experience, when users post and follow links to commercial sites.",
|
||||
"homepage": "https://www.phpbb.com",
|
||||
"version": "1.0.4",
|
||||
"keywords": ["phpbb", "extension", "viglink"],
|
||||
"license": "GPL-2.0-only",
|
||||
"authors": [
|
||||
{
|
||||
"name": "phpBB Limited",
|
||||
"email": "operations@phpbb.com",
|
||||
"homepage": "https://www.phpbb.com/go/authors"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.4",
|
||||
"phpbb/phpbb": ">=3.2.0-b1",
|
||||
"composer/installers": "~1.0"
|
||||
},
|
||||
"extra": {
|
||||
"display-name": "VigLink",
|
||||
"soft-require": {
|
||||
"phpbb/phpbb": ">=3.2.0-b1,<3.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
115
install/update/old/ext/phpbb/viglink/composer.lock
generated
Normal file
115
install/update/old/ext/phpbb/viglink/composer.lock
generated
Normal file
@@ -0,0 +1,115 @@
|
||||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "155838fcd9206482cc645c3de6a7e8db",
|
||||
"content-hash": "610135270d537f2e8580b747c6b57ce9",
|
||||
"packages": [
|
||||
{
|
||||
"name": "composer/installers",
|
||||
"version": "v1.0.20",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/composer/installers.git",
|
||||
"reference": "1bff8aa77a18f3616f468ed8000cf86a5725bac3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/composer/installers/zipball/1bff8aa77a18f3616f468ed8000cf86a5725bac3",
|
||||
"reference": "1bff8aa77a18f3616f468ed8000cf86a5725bac3",
|
||||
"shasum": ""
|
||||
},
|
||||
"replace": {
|
||||
"roundcube/plugin-installer": "*",
|
||||
"shama/baton": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"composer/composer": "1.0.*@dev",
|
||||
"phpunit/phpunit": "4.1.*"
|
||||
},
|
||||
"type": "composer-installer",
|
||||
"extra": {
|
||||
"class": "Composer\\Installers\\Installer",
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Composer\\Installers\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kyle Robinson Young",
|
||||
"email": "kyle@dontkry.com",
|
||||
"homepage": "https://github.com/shama"
|
||||
}
|
||||
],
|
||||
"description": "A multi-framework Composer library installer",
|
||||
"homepage": "http://composer.github.com/installers/",
|
||||
"keywords": [
|
||||
"Craft",
|
||||
"Dolibarr",
|
||||
"Hurad",
|
||||
"MODX Evo",
|
||||
"OXID",
|
||||
"SMF",
|
||||
"Thelia",
|
||||
"WolfCMS",
|
||||
"agl",
|
||||
"annotatecms",
|
||||
"bitrix",
|
||||
"cakephp",
|
||||
"chef",
|
||||
"codeigniter",
|
||||
"concrete5",
|
||||
"croogo",
|
||||
"dokuwiki",
|
||||
"drupal",
|
||||
"elgg",
|
||||
"fuelphp",
|
||||
"grav",
|
||||
"installer",
|
||||
"joomla",
|
||||
"kohana",
|
||||
"laravel",
|
||||
"lithium",
|
||||
"magento",
|
||||
"mako",
|
||||
"mediawiki",
|
||||
"modulework",
|
||||
"moodle",
|
||||
"phpbb",
|
||||
"piwik",
|
||||
"ppi",
|
||||
"puppet",
|
||||
"roundcube",
|
||||
"shopware",
|
||||
"silverstripe",
|
||||
"symfony",
|
||||
"typo3",
|
||||
"wordpress",
|
||||
"zend",
|
||||
"zikula"
|
||||
],
|
||||
"time": "2015-01-11 03:51:11"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"platform-dev": []
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/* phpBB VigLink Extension Style Sheet
|
||||
------------------------------------------------------------------------
|
||||
Copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
|
||||
For full copyright and license information, please see
|
||||
the docs/CREDITS.txt file.
|
||||
------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
.viglink-header {
|
||||
background: url('images/VigLink_logo.png') no-repeat 0 0;
|
||||
padding-bottom: 18px;
|
||||
padding-left: 142px;
|
||||
}
|
||||
|
||||
.send-stats-tile > .viglink-header-h2 {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
Reference in New Issue
Block a user