diff --git a/acpcleanup/acp/main_info.php b/acpcleanup/acp/main_info.php index bb5f85eeb..54427c17a 100644 --- a/acpcleanup/acp/main_info.php +++ b/acpcleanup/acp/main_info.php @@ -12,21 +12,29 @@ namespace phpbbgallery\acpcleanup\acp; +/** + * ACP Module Info class + */ class main_info { - function module() + /** + * Returns module information + * + * @return array Module information + */ + public function module(): array { - return array( - 'filename' => 'main_module', - 'title' => 'PHPBB_GALLERY', - 'version' => '1.0.0', - 'modes' => array( - 'cleanup' => array( - 'title' => 'ACP_GALLERY_CLEANUP', - 'auth' => 'acl_a_gallery_cleanup && ext_phpbbgallery/acpcleanup', - 'cat' => array('PHPBB_GALLERY') - ), - ), - ); + return [ + 'filename' => '\phpbbgallery\acpcleanup\acp\main_module', + 'title' => 'PHPBB_GALLERY', + 'version' => '1.0.0', + 'modes' => [ + 'cleanup' => [ + 'title' => 'ACP_GALLERY_CLEANUP', + 'auth' => 'acl_a_gallery_cleanup && ext_phpbbgallery/acpcleanup', + 'cat' => ['PHPBB_GALLERY'], + ], + ], + ]; } } diff --git a/acpcleanup/acp/main_module.php b/acpcleanup/acp/main_module.php index ea16a3e28..c60f95ecb 100644 --- a/acpcleanup/acp/main_module.php +++ b/acpcleanup/acp/main_module.php @@ -14,28 +14,42 @@ class main_module { - var $u_action; + public string $u_action; - function main($id, $mode) + public function main(string $id, string $mode): void { - global $auth, $cache, $config, $db, $template, $user, $phpEx, $phpbb_root_path, $phpbb_ext_gallery; + global $auth, $cache, $config, $db, $template, $request, $user, $phpEx, $phpbb_root_path, $phpbb_ext_gallery; $user->add_lang_ext('phpbbgallery/core', array('gallery_acp', 'gallery')); - //$user->add_lang_ext('phpbbgallery/acpcleanup', 'cleanup'); $this->tpl_name = 'gallery_cleanup'; + add_form_key('acp_gallery'); + $submit = $request->is_set_post('submit'); + + if ($submit && !check_form_key('acp_gallery')) + { + trigger_error($user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING); + } + $this->page_title = $user->lang['ACP_GALLERY_CLEANUP']; - $this->cleanup(); + $this->cleanup($submit); } - function cleanup() + /** + * Cleanup gallery files and database entries + * + * @param array $missing_entries Files to clean + * @param bool $move_to_import Whether to move files to import dir + * @return array Messages about cleanup results + * @throws \RuntimeException On file operation errors + */ + public function cleanup(bool $submit = false): void { global $auth, $cache, $db, $template, $user, $phpbb_ext_gallery, $table_prefix, $phpbb_container, $request; - $delete = (isset($_POST['delete'])) ? true : false; - $prune = (isset($_POST['prune'])) ? true : false; - $submit = (isset($_POST['submit'])) ? true : false; + $delete = $request->is_set_post('delete'); + $prune = $request->is_set_post('prune'); $missing_sources = $request->variable('source', array(0)); $missing_entries = $request->variable('entry', array(''), true); diff --git a/acpcleanup/adm/style/gallery_cleanup.html b/acpcleanup/adm/style/gallery_cleanup.html index cc9cf728f..a9f43f608 100644 --- a/acpcleanup/adm/style/gallery_cleanup.html +++ b/acpcleanup/adm/style/gallery_cleanup.html @@ -147,21 +147,10 @@

{ACP_GALLERY_TITLE}

+ {S_FORM_TOKEN}

-

{S_FORM_TOKEN}

- diff --git a/acpcleanup/composer.json b/acpcleanup/composer.json index 244487263..70589f649 100644 --- a/acpcleanup/composer.json +++ b/acpcleanup/composer.json @@ -26,12 +26,12 @@ } ], "require": { - "php": ">=5.3" + "php": ">=7.1" }, "extra": { "display-name": "phpBB Gallery Add-on: ACP Cleanup", "soft-require": { - "phpbb/phpbb": ">=3.1.0-RC2,<3.3.0@dev" + "phpbb/phpbb": ">=3.2.0,<4.0.0@dev" } }, "version-check": { diff --git a/acpcleanup/config/services.yml b/acpcleanup/config/services.yml index 0ef56a9a1..f2c0d6f82 100644 --- a/acpcleanup/config/services.yml +++ b/acpcleanup/config/services.yml @@ -1,6 +1,6 @@ parameters: - tables.phpbbgallery.albums: '%core.table_prefix%gallery_albums' - tables.phpbbgallery.images: '%core.table_prefix%gallery_images' + phpbbgallery.tables.gallery_albums: '%core.table_prefix%gallery_albums' + phpbbgallery.tables.gallery_images: '%core.table_prefix%gallery_images' services: phpbbgallery.acpcleanup.cleanup: @@ -16,5 +16,5 @@ services: - '@phpbbgallery.core.config' - '@phpbbgallery.core.log' - '@phpbbgallery.core.moderate' - - '%tables.phpbbgallery.albums%' - - '%tables.phpbbgallery.images%' \ No newline at end of file + - '%phpbbgallery.tables.gallery_albums%' + - '%phpbbgallery.tables.gallery_images%' \ No newline at end of file diff --git a/acpcleanup/ext.php b/acpcleanup/ext.php index 7fd37f24e..ade3dfa8f 100644 --- a/acpcleanup/ext.php +++ b/acpcleanup/ext.php @@ -8,12 +8,59 @@ * @license GPL-2.0-only */ -// this file is not really needed, when empty it can be omitted -// however you can override the default methods and add custom -// installation logic - namespace phpbbgallery\acpcleanup; class ext extends \phpbb\extension\base { + /** + * Check whether or not the extension can be enabled. + * Checks dependencies and requirements. + * + * @return bool + */ + public function is_enableable() + { + $manager = $this->container->get('ext.manager'); + $user = $this->container->get('user'); + + $core_ext = 'phpbbgallery/core'; + + // Check if core is installed (enabled or disabled) + $is_enabled = $manager->is_enabled($core_ext); + $is_disabled = $manager->is_disabled($core_ext); + + if (!$is_enabled && !$is_disabled) + { + // Core not installed at all + $user->add_lang_ext('phpbbgallery/acpcleanup', 'info_acp_gallery_cleanup'); + trigger_error($user->lang('GALLERY_CORE_NOT_FOUND'), E_USER_WARNING); + return false; + } + + if ($is_disabled) + { + // Core installed but disabled — enable it automatically + $manager->enable($core_ext); + } + + // If here, core is either enabled or just enabled now + return true; + } + + /** + * Perform additional tasks on extension enable + * + * @param mixed $old_state State returned by previous call of this method + * @return mixed Returns false after last step, otherwise temporary state + */ + public function enable_step($old_state) + { + if (empty($old_state)) + { + $this->container->get('user')->add_lang_ext('phpbbgallery/acpcleanup', 'info_acp_gallery_cleanup'); + $this->container->get('template')->assign_var('L_EXTENSION_ENABLE_SUCCESS', $this->container->get('user')->lang['EXTENSION_ENABLE_SUCCESS']); + } + + return parent::enable_step($old_state); + } } diff --git a/exif/language/en/index copy.htm b/acpcleanup/language/bg/index.htm similarity index 100% rename from exif/language/en/index copy.htm rename to acpcleanup/language/bg/index.htm diff --git a/acpcleanup/language/bg/info_acp_gallery_cleanup.php b/acpcleanup/language/bg/info_acp_gallery_cleanup.php index e69491a6e..2618cc0c3 100644 --- a/acpcleanup/language/bg/info_acp_gallery_cleanup.php +++ b/acpcleanup/language/bg/info_acp_gallery_cleanup.php @@ -21,10 +21,10 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACP_GALLERY_CLEANUP' => 'Почистване на галерия', 'ACP_GALLERY_CLEANUP_EXPLAIN' => 'Тук можете да изтриете малко останки.', @@ -78,4 +78,7 @@ 'MOVE_TO_USER' => 'Премести при потребител', 'MOVE_TO_USER_EXP' => 'Изображенията и коментарите ще бъдат преместеи като такива на посочения потребител. Ако не посочите потребител - Гост е зададен по-подразбиране', 'CLEAN_USER_NOT_FOUND' => 'Желаният от вас потребител не е открит!', -)); + + 'GALLERY_CORE_NOT_FOUND' => 'Първо трябва да бъде инсталирано и активирано разширението phpBB Gallery Core.', + 'EXTENSION_ENABLE_SUCCESS' => 'Разширението е активирано успешно.', +]); diff --git a/acpcleanup/language/de/index.htm b/acpcleanup/language/de/index.htm new file mode 100644 index 000000000..e69de29bb diff --git a/acpcleanup/language/de/info_acp_gallery_cleanup.php b/acpcleanup/language/de/info_acp_gallery_cleanup.php index 5a9051ecb..09524687d 100644 --- a/acpcleanup/language/de/info_acp_gallery_cleanup.php +++ b/acpcleanup/language/de/info_acp_gallery_cleanup.php @@ -21,10 +21,10 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACP_GALLERY_CLEANUP' => 'Galerie bereinigen', 'ACP_GALLERY_CLEANUP_EXPLAIN' => 'Hier kannst Du einige Reste löschen.', @@ -79,4 +79,7 @@ 'MOVE_TO_USER' => 'Wechseln zu Benutzer', 'MOVE_TO_USER_EXP' => 'Bilder und Kommentare werden als diejenigen des Benutzers verschoben werden, die Du definiert hast. Wenn Keine ausgewählt wird - wird Gast verwendet.', 'CLEAN_USER_NOT_FOUND' => 'Der von Ihnen ausgewählte Benutzer existiert nicht!', -)); + + 'GALLERY_CORE_NOT_FOUND' => 'Die phpBB Gallery Core-Erweiterung muss zuerst installiert und aktiviert werden.', + 'EXTENSION_ENABLE_SUCCESS' => 'Die Erweiterung wurde erfolgreich aktiviert.', +]); diff --git a/acpcleanup/language/en/index.htm b/acpcleanup/language/en/index.htm new file mode 100644 index 000000000..e69de29bb diff --git a/acpcleanup/language/en/info_acp_gallery_cleanup.php b/acpcleanup/language/en/info_acp_gallery_cleanup.php index 8d585777b..0c0867089 100644 --- a/acpcleanup/language/en/info_acp_gallery_cleanup.php +++ b/acpcleanup/language/en/info_acp_gallery_cleanup.php @@ -20,10 +20,10 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACP_GALLERY_CLEANUP' => 'Cleanup gallery', 'ACP_GALLERY_CLEANUP_EXPLAIN' => 'Here you can delete some remains.', @@ -78,4 +78,7 @@ 'MOVE_TO_USER' => 'Move to user', 'MOVE_TO_USER_EXP' => 'Images and comments will be moved as those of user you have defined. If none is selected - Anonymous will be used.', 'CLEAN_USER_NOT_FOUND' => 'The user you selected does not exists!', -)); + + 'GALLERY_CORE_NOT_FOUND' => 'phpBB Gallery Core extension must be installed and enabled first.', + 'EXTENSION_ENABLE_SUCCESS' => 'The extension has been enabled successfully.', +]); diff --git a/acpcleanup/language/fr/index.htm b/acpcleanup/language/fr/index.htm new file mode 100644 index 000000000..e69de29bb diff --git a/acpcleanup/language/fr/info_acp_gallery_cleanup.php b/acpcleanup/language/fr/info_acp_gallery_cleanup.php index 18700e6d7..4573f30b5 100644 --- a/acpcleanup/language/fr/info_acp_gallery_cleanup.php +++ b/acpcleanup/language/fr/info_acp_gallery_cleanup.php @@ -21,10 +21,10 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACP_GALLERY_CLEANUP' => 'Nettoyage de la galerie', 'ACP_GALLERY_CLEANUP_EXPLAIN' => 'Ici vous pouvez nettoyer la Galerie.', @@ -79,4 +79,7 @@ 'MOVE_TO_USER' => 'Attribuer à l’utilisateur', 'MOVE_TO_USER_EXP' => 'Les images et les commentaires seront attribués à l’utilisateur que vous avez défini. Si aucun n’est sélectionné - “Anonyme“ sera utilisé.', 'CLEAN_USER_NOT_FOUND' => 'L’utilisateur sélectionné n’existe pas!', -)); + + 'GALLERY_CORE_NOT_FOUND' => 'L’extension phpBB Gallery Core doit d’abord être installée et activée.', + 'EXTENSION_ENABLE_SUCCESS' => 'L’extension a été activée avec succès.', +]); diff --git a/acpcleanup/language/it/index.htm b/acpcleanup/language/it/index.htm new file mode 100644 index 000000000..e69de29bb diff --git a/acpcleanup/language/it/info_acp_gallery_cleanup.php b/acpcleanup/language/it/info_acp_gallery_cleanup.php index 67404cb8b..a392dad2f 100644 --- a/acpcleanup/language/it/info_acp_gallery_cleanup.php +++ b/acpcleanup/language/it/info_acp_gallery_cleanup.php @@ -21,10 +21,10 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACP_GALLERY_CLEANUP' => 'Pulisci galleria', 'ACP_GALLERY_CLEANUP_EXPLAIN' => 'Puoi cancellare alcuni rimasugli, da qui.', @@ -79,4 +79,7 @@ 'MOVE_TO_USER' => 'Sposta all\'utente', 'MOVE_TO_USER_EXP' => 'Immagini e commenti verranno spostati come fossero dell\'utente che hai definito. Se non ne vengono selezionati verra\' usato l\'utente anonimo.', 'CLEAN_USER_NOT_FOUND' => 'L\'utente selezionato non esiste!', -)); + + 'GALLERY_CORE_NOT_FOUND' => 'L\'estensione phpBB Gallery Core deve essere prima installata e abilitata.', + 'EXTENSION_ENABLE_SUCCESS' => 'L\'estensione è stata abilitata con successo.', +]); diff --git a/acpcleanup/language/ru/index.htm b/acpcleanup/language/ru/index.htm new file mode 100644 index 000000000..e69de29bb diff --git a/acpcleanup/language/ru/info_acp_gallery_cleanup.php b/acpcleanup/language/ru/info_acp_gallery_cleanup.php index 451ba9f28..4c5800b43 100644 --- a/acpcleanup/language/ru/info_acp_gallery_cleanup.php +++ b/acpcleanup/language/ru/info_acp_gallery_cleanup.php @@ -21,10 +21,10 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACP_GALLERY_CLEANUP' => 'Очистить галерею', 'ACP_GALLERY_CLEANUP_EXPLAIN' => 'Здесь вы можете удалить некоторые остатки.', @@ -79,4 +79,7 @@ 'MOVE_TO_USER' => 'Move to user', 'MOVE_TO_USER_EXP' => 'Images and comments will be moved as those of user you have defined. If none is selected - Anonymous will be used.', 'CLEAN_USER_NOT_FOUND' => 'The user you selected does not exists!', - )); + + 'GALLERY_CORE_NOT_FOUND' => 'Сначала необходимо установить и включить расширение phpBB Gallery Core.', + 'EXTENSION_ENABLE_SUCCESS' => 'Расширение успешно включено.', +]); diff --git a/acpcleanup/migrations/m1_init.php b/acpcleanup/migrations/m1_init.php index 5a3dfeb9b..17b741e76 100644 --- a/acpcleanup/migrations/m1_init.php +++ b/acpcleanup/migrations/m1_init.php @@ -12,27 +12,29 @@ namespace phpbbgallery\acpcleanup\migrations; -class m1_init extends \phpbb\db\migration\migration +use phpbb\db\migration\migration; + +class m1_init extends migration { static public function depends_on() { - return array('\phpbbgallery\core\migrations\release_1_2_0'); + return ['\phpbbgallery\core\migrations\release_1_2_0']; } public function update_data() { - return array( - array('permission.add', array('a_gallery_cleanup', true, 'a_board')), - array('module.add', array( - 'acp', - 'PHPBB_GALLERY', - array( - 'module_basename' => '\phpbbgallery\acpcleanup\acp\main_module', - 'module_langname' => 'ACP_GALLERY_CLEANUP', - 'module_mode' => 'cleanup', - 'module_auth' => 'ext_phpbbgallery/acpcleanup && acl_a_gallery_cleanup', - ) - )), - ); + return [ + ['permission.add', ['a_gallery_cleanup', true, 'a_board']], + ['module.add', [ + 'acp', + 'PHPBB_GALLERY', + [ + 'module_basename' => '\phpbbgallery\acpcleanup\acp\main_module', + 'module_langname' => 'ACP_GALLERY_CLEANUP', + 'module_mode' => 'cleanup', + 'module_auth' => 'ext_phpbbgallery/acpcleanup && acl_a_gallery_cleanup', + ] + ]], + ]; } } diff --git a/acpimport/acp/main_info.php b/acpimport/acp/main_info.php index 96fac1344..28899f156 100644 --- a/acpimport/acp/main_info.php +++ b/acpimport/acp/main_info.php @@ -12,21 +12,29 @@ namespace phpbbgallery\acpimport\acp; +/** + * ACP Module Info class for Gallery Import + */ class main_info { - function module() + /** + * Returns module information + * + * @return array Module configuration + */ + public function module(): array { - return array( - 'filename' => 'main_module', - 'title' => 'PHPBB_GALLERY', - 'version' => '1.0.0', - 'modes' => array( - 'import_images' => array( - 'title' => 'ACP_IMPORT_ALBUMS', - 'auth' => 'acl_a_gallery_import && ext_phpbbgallery/acpimport', - 'cat' => array('PHPBB_GALLERY') - ), - ), - ); + return [ + 'filename' => '\phpbbgallery\acpimport\acp\main_module', + 'title' => 'PHPBB_GALLERY', + 'version' => '1.0.0', + 'modes' => [ + 'import_images' => [ + 'title' => 'ACP_IMPORT_ALBUMS', + 'auth' => 'ext_phpbbgallery/acpimport && acl_a_gallery_import', + 'cat' => ['PHPBB_GALLERY'], + ], + ], + ]; } } diff --git a/acpimport/adm/style/gallery_acpimport.html b/acpimport/adm/style/gallery_acpimport.html index 8577b566c..f64596297 100644 --- a/acpimport/adm/style/gallery_acpimport.html +++ b/acpimport/adm/style/gallery_acpimport.html @@ -47,15 +47,4 @@

{ACP_GALLERY_TITLE}

- diff --git a/acpimport/adm/style/index.htm b/acpimport/adm/style/index.htm new file mode 100644 index 000000000..e69de29bb diff --git a/acpimport/composer.json b/acpimport/composer.json index b06345ea3..5d12efdf6 100644 --- a/acpimport/composer.json +++ b/acpimport/composer.json @@ -26,12 +26,12 @@ } ], "require": { - "php": ">=5.3" + "php": ">=7.1" }, "extra": { "display-name": "phpBB Gallery Add-on: ACP Import", "soft-require": { - "phpbb/phpbb": ">=3.1.0-RC2,<3.3.0@dev" + "phpbb/phpbb": ">=3.2.0,<4.0.0@dev" } }, "version-check": { diff --git a/acpimport/ext.php b/acpimport/ext.php index d6260017f..63f00c26c 100644 --- a/acpimport/ext.php +++ b/acpimport/ext.php @@ -8,12 +8,59 @@ * @license GPL-2.0-only */ -// this file is not really needed, when empty it can be ommitted -// however you can override the default methods and add custom -// installation logic - namespace phpbbgallery\acpimport; class ext extends \phpbb\extension\base { + /** + * Check whether or not the extension can be enabled. + * Checks dependencies and requirements. + * + * @return bool + */ + public function is_enableable() + { + $manager = $this->container->get('ext.manager'); + $user = $this->container->get('user'); + + $core_ext = 'phpbbgallery/core'; + + // Check if core is installed (enabled or disabled) + $is_enabled = $manager->is_enabled($core_ext); + $is_disabled = $manager->is_disabled($core_ext); + + if (!$is_enabled && !$is_disabled) + { + // Core not installed at all + $user->add_lang_ext('phpbbgallery/acpimport', 'info_acp_gallery_import'); + trigger_error($user->lang('GALLERY_CORE_NOT_FOUND'), E_USER_WARNING); + return false; + } + + if ($is_disabled) + { + // Core installed but disabled — enable it automatically + $manager->enable($core_ext); + } + + // If here, core is either enabled or just enabled now + return true; + } + + /** + * Perform additional tasks on extension enable + * + * @param mixed $old_state State returned by previous call of this method + * @return mixed Returns false after last step, otherwise temporary state + */ + public function enable_step($old_state) + { + if (empty($old_state)) + { + $this->container->get('user')->add_lang_ext('phpbbgallery/acpimport', 'info_acp_gallery_import'); + $this->container->get('template')->assign_var('L_EXTENSION_ENABLE_SUCCESS', $this->container->get('user')->lang['EXTENSION_ENABLE_SUCCESS']); + } + + return parent::enable_step($old_state); + } } diff --git a/acpimport/language/bg/index.htm b/acpimport/language/bg/index.htm new file mode 100644 index 000000000..e69de29bb diff --git a/acpimport/language/bg/info_acp_gallery_acpimport.php b/acpimport/language/bg/info_acp_gallery_import.php similarity index 89% rename from acpimport/language/bg/info_acp_gallery_acpimport.php rename to acpimport/language/bg/info_acp_gallery_import.php index 5119f0864..7734722e8 100644 --- a/acpimport/language/bg/info_acp_gallery_acpimport.php +++ b/acpimport/language/bg/info_acp_gallery_import.php @@ -21,10 +21,10 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACP_IMPORT_ALBUMS' => 'Вкарване на изображения', 'ACP_IMPORT_ALBUMS_EXPLAIN' => 'Тук можете да вкарате голямо количество изображения от файловата система. Преди да вкарате изображенията, моля оразмерете ги на ръка.', @@ -43,4 +43,7 @@ 'MISSING_IMPORT_SCHEMA' => 'Избраната таблица за вкарване (%s) не може да бъде открита.', 'NO_FILE_SELECTED' => 'Трябва да изберете поне един фаил.', -)); + + 'GALLERY_CORE_NOT_FOUND' => 'Първо трябва да бъде инсталирано и активирано разширението phpBB Gallery Core.', + 'EXTENSION_ENABLE_SUCCESS' => 'Разширението е активирано успешно.', +]); diff --git a/acpimport/language/de/index.htm b/acpimport/language/de/index.htm new file mode 100644 index 000000000..e69de29bb diff --git a/acpimport/language/de/info_acp_gallery_acpimport.php b/acpimport/language/de/info_acp_gallery_import.php similarity index 89% rename from acpimport/language/de/info_acp_gallery_acpimport.php rename to acpimport/language/de/info_acp_gallery_import.php index dbacd4701..934b69150 100644 --- a/acpimport/language/de/info_acp_gallery_acpimport.php +++ b/acpimport/language/de/info_acp_gallery_import.php @@ -21,10 +21,10 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACP_IMPORT_ALBUMS' => 'Neue Bilder importieren', 'ACP_IMPORT_ALBUMS_EXPLAIN' => 'Hier kannst Du die Anzahl von Bilder eingeben, die importiert werden sollen. Bevor Du die Bilder importierst, ändere die Größe von Hand mit einer Bildbearbeitungssoftware.', @@ -43,4 +43,7 @@ 'MISSING_IMPORT_SCHEMA' => 'Das Import-Schema (%s) konnte nicht gefunden werden.', 'NO_FILE_SELECTED' => 'Du musst mindestens eine Datei auswählen.', -)); + + 'GALLERY_CORE_NOT_FOUND' => 'Die phpBB Gallery Core-Erweiterung muss zuerst installiert und aktiviert werden.', + 'EXTENSION_ENABLE_SUCCESS' => 'Die Erweiterung wurde erfolgreich aktiviert.', +]); diff --git a/acpimport/language/en/index.htm b/acpimport/language/en/index.htm new file mode 100644 index 000000000..e69de29bb diff --git a/acpimport/language/en/info_acp_gallery_acpimport.php b/acpimport/language/en/info_acp_gallery_import.php similarity index 88% rename from acpimport/language/en/info_acp_gallery_acpimport.php rename to acpimport/language/en/info_acp_gallery_import.php index 16169b754..7ea1b7a58 100644 --- a/acpimport/language/en/info_acp_gallery_acpimport.php +++ b/acpimport/language/en/info_acp_gallery_import.php @@ -20,10 +20,10 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACP_IMPORT_ALBUMS' => 'Import Images', 'ACP_IMPORT_ALBUMS_EXPLAIN' => 'Here you can bulk import images from the file system. Before importing images, please be sure to resize them by hand.', @@ -42,4 +42,7 @@ 'MISSING_IMPORT_SCHEMA' => 'The specified import-schema (%s) could not be found.', 'NO_FILE_SELECTED' => 'You need to select at least one file.', -)); + + 'GALLERY_CORE_NOT_FOUND' => 'phpBB Gallery Core extension must be installed and enabled first.', + 'EXTENSION_ENABLE_SUCCESS' => 'The extension has been enabled successfully.', +]); diff --git a/acpimport/language/fr/index.htm b/acpimport/language/fr/index.htm new file mode 100644 index 000000000..e69de29bb diff --git a/acpimport/language/fr/info_acp_gallery_acpimport.php b/acpimport/language/fr/info_acp_gallery_import.php similarity index 89% rename from acpimport/language/fr/info_acp_gallery_acpimport.php rename to acpimport/language/fr/info_acp_gallery_import.php index 466eb4837..1e742af47 100644 --- a/acpimport/language/fr/info_acp_gallery_acpimport.php +++ b/acpimport/language/fr/info_acp_gallery_import.php @@ -21,10 +21,10 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACP_IMPORT_ALBUMS' => 'Importer des images', 'ACP_IMPORT_ALBUMS_EXPLAIN' => 'Vous pouvez importer ici des images à partir du système de fichier. Avant d’importer des images, n’oubliez pas de les redimensionner manuellement.', @@ -43,4 +43,7 @@ 'MISSING_IMPORT_SCHEMA' => 'Le schéma d’importation spécifié (%s) n’a pas pu être trouvé.', 'NO_FILE_SELECTED' => 'Vous devez sélectionner au moins un fichier.', -)); + + 'GALLERY_CORE_NOT_FOUND' => 'L’extension phpBB Gallery Core doit d’abord être installée et activée.', + 'EXTENSION_ENABLE_SUCCESS' => 'L’extension a été activée avec succès.', +]); diff --git a/acpimport/language/it/index.htm b/acpimport/language/it/index.htm new file mode 100644 index 000000000..e69de29bb diff --git a/acpimport/language/it/info_acp_gallery_acpimport.php b/acpimport/language/it/info_acp_gallery_import.php similarity index 88% rename from acpimport/language/it/info_acp_gallery_acpimport.php rename to acpimport/language/it/info_acp_gallery_import.php index 1c9cfc620..0bd1e26b0 100644 --- a/acpimport/language/it/info_acp_gallery_acpimport.php +++ b/acpimport/language/it/info_acp_gallery_import.php @@ -21,10 +21,10 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACP_IMPORT_ALBUMS' => 'Importa Immagini', 'ACP_IMPORT_ALBUMS_EXPLAIN' => 'Da qui puoi importare in massa immagini dal file system. Prima di importare le immagini assicurati di ridimensionarle manualmente.', @@ -43,4 +43,7 @@ 'MISSING_IMPORT_SCHEMA' => 'Lo schema di importazione specificato (%s) non e\' stato trovato.', 'NO_FILE_SELECTED' => 'Devi selezionare almeno un file.', -)); + + 'GALLERY_CORE_NOT_FOUND' => 'L\'estensione phpBB Gallery Core deve essere prima installata e abilitata.', + 'EXTENSION_ENABLE_SUCCESS' => 'L\'estensione è stata abilitata con successo.', +]); diff --git a/acpimport/language/ru/index.htm b/acpimport/language/ru/index.htm new file mode 100644 index 000000000..e69de29bb diff --git a/acpimport/language/ru/info_acp_gallery_acpimport.php b/acpimport/language/ru/info_acp_gallery_import.php similarity index 91% rename from acpimport/language/ru/info_acp_gallery_acpimport.php rename to acpimport/language/ru/info_acp_gallery_import.php index 20aceab55..d5103360c 100644 --- a/acpimport/language/ru/info_acp_gallery_acpimport.php +++ b/acpimport/language/ru/info_acp_gallery_import.php @@ -21,10 +21,10 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'ACP_IMPORT_ALBUMS' => 'Импорт новых изображений', 'ACP_IMPORT_ALBUMS_EXPLAIN' => 'Здесь вы можете ввести количество изображений, которые будут импортированы. Перед тем, как импортировать изображения, измените размер вручную, используя программное обеспечение для редактирования изображений', @@ -43,4 +43,7 @@ 'MISSING_IMPORT_SCHEMA' => 'Схема импорта (%s) не могла быть найдена', 'NO_FILE_SELECTED' => 'Вы должны выбрать минимум один файл', -)); + + 'GALLERY_CORE_NOT_FOUND' => 'Сначала необходимо установить и включить расширение phpBB Gallery Core.', + 'EXTENSION_ENABLE_SUCCESS' => 'Расширение успешно включено.', +]); diff --git a/acpimport/migrations/m1_init.php b/acpimport/migrations/m1_init.php index 84bbf526c..7a09fa5b8 100644 --- a/acpimport/migrations/m1_init.php +++ b/acpimport/migrations/m1_init.php @@ -12,72 +12,118 @@ namespace phpbbgallery\acpimport\migrations; -class m1_init extends \phpbb\db\migration\migration +use phpbb\db\migration\migration; + +class m1_init extends migration { - static public function depends_on() + /** + * Migration dependencies + * + * @return array Array of migration dependencies + */ + public static function depends_on(): array { - return array('\phpbbgallery\core\migrations\release_1_2_0'); + return ['\phpbbgallery\core\migrations\release_1_2_0']; } - public function revert_data() + /** + * Revert the changes + * + * @return array Array of update data + */ + public function revert_data(): array { - return array( - array('custom', array(array(&$this, 'remove_file_system'))), - ); + return [ + ['custom', [[&$this, 'remove_file_system']]], + ]; } - public function update_data() + /** + * Update data + * + * @return array Array of update data + */ + public function update_data(): array { - return array( - array('permission.add', array('a_gallery_import', true, 'a_board')), - array('module.add', array( - 'acp', - 'PHPBB_GALLERY', - array( - 'module_basename' => '\phpbbgallery\acpimport\acp\main_module', - 'module_langname' => 'ACP_IMPORT_ALBUMS', - 'module_mode' => 'import_images', - 'module_auth' => 'ext_phpbbgallery/acpimport && acl_a_gallery_import', - ) - )), - array('custom', array(array(&$this, 'create_file_system'))), - ); + return [ + ['permission.add', ['a_gallery_import', true, 'a_board']], + ['module.add', [ + 'acp', + 'PHPBB_GALLERY', + [ + 'module_basename' => '\phpbbgallery\acpimport\acp\main_module', + 'module_langname' => 'ACP_IMPORT_ALBUMS', + 'module_mode' => 'import_images', + 'module_auth' => 'ext_phpbbgallery/acpimport && acl_a_gallery_import', + ] + ]], + ['custom', [[&$this, 'create_file_system']]], + ]; } - public function create_file_system() + /** + * Create import directory + * + * @return void + */ + public function create_file_system(): void { global $phpbb_root_path; - $phpbbgallery_core_file_import = $phpbb_root_path . 'files/phpbbgallery/import'; + $phpbbgallery_import_file = $phpbb_root_path . 'files/phpbbgallery/import'; - if (is_writable($phpbb_root_path . 'files')) + if (!is_dir($phpbbgallery_import_file)) { - @mkdir($phpbbgallery_core_file_import, 0755, true); + if (is_writable($phpbb_root_path . 'files')) + { + @mkdir($phpbbgallery_import_file, 0755, true); + } } } - public function remove_file_system() + /** + * Remove import directory + * + * @return void + */ + public function remove_file_system(): void { global $phpbb_root_path; - $phpbbgallery_core_file_import = $phpbb_root_path . 'files/phpbbgallery/import'; + $phpbbgallery_import_file = $phpbb_root_path . 'files/phpbbgallery/import'; // Clean dirs - $this->recursiveRemoveDirectory($phpbbgallery_core_file_import); + if (is_dir($phpbbgallery_import_file)) + { + $this->recursiveRemoveDirectory($phpbbgallery_import_file); + } } - function recursiveRemoveDirectory($directory) + + /** + * Recursively remove a directory + * + * @param string $directory Directory path + * @return void + */ + private function recursiveRemoveDirectory(string $directory): void { - foreach (glob("{$directory}/*") as $file) + if (!is_dir($directory)) { - if (is_dir($file)) - { - recursiveRemoveDirectory($file); - } - else - { - unlink($file); - } + return; + } + + $files = new \FilesystemIterator($directory); + foreach ($files as $file) + { + if ($file->isDir()) + { + $this->recursiveRemoveDirectory($file->getPathname()); + } + else + { + @unlink($file->getPathname()); + } } - rmdir($directory); + @rmdir($directory); } } diff --git a/core/acp/config_module.php b/core/acp/config_module.php index 7162ded98..e54477c0c 100644 --- a/core/acp/config_module.php +++ b/core/acp/config_module.php @@ -215,10 +215,15 @@ public function main($id, $mode) if (strpos($config_key, 'legend') !== false) { - $template->assign_block_vars('options', array( - 'S_LEGEND' => true, - 'LEGEND' => ($this->language->is_set($vars)) ? $this->language->lang($vars) : $vars) - ); + $legend_text = ($this->language->is_set($vars)) ? $this->language->lang($vars) : $vars; + + if (!empty($legend_text)) + { + $template->assign_block_vars('options', array( + 'S_LEGEND' => true, + 'LEGEND' => $legend_text + )); + } continue; } diff --git a/core/acp/main_module.php b/core/acp/main_module.php index 044b366ae..b237648ba 100644 --- a/core/acp/main_module.php +++ b/core/acp/main_module.php @@ -571,7 +571,7 @@ function overview() 'IMAGES_PER_DAY' => $images_per_day, 'TOTAL_ALBUMS' => $num_albums, 'TOTAL_PERSONALS' => $config['phpbb_gallery_num_pegas'], - 'GUPLOAD_DIR_SIZE' => get_formatted_filesize($dir_sizes['stat']), + 'GUPLOAD_DIR_SIZE' => get_formatted_filesize($dir_sizes['stat']), 'MEDIUM_DIR_SIZE' => get_formatted_filesize($dir_sizes['stat_medium']), 'CACHE_DIR_SIZE' => get_formatted_filesize($dir_sizes['stat_cache']), 'GALLERY_VERSION' => $config['phpbb_gallery_version'], diff --git a/core/adm/style/gallery_logs.html b/core/adm/style/gallery_logs.html index 008858146..58bd6a692 100644 --- a/core/adm/style/gallery_logs.html +++ b/core/adm/style/gallery_logs.html @@ -1,6 +1,6 @@ - +

{L_TITLE}

diff --git a/core/adm/style/gallery_main.html b/core/adm/style/gallery_main.html index 14897cdf4..98324db40 100644 --- a/core/adm/style/gallery_main.html +++ b/core/adm/style/gallery_main.html @@ -7,7 +7,6 @@

{ACP_GALLERY_TITLE}

-
{L_VERSION_CHECK}

{mods.UP_TO_DATE}

diff --git a/core/block.bkp b/core/block.bkp index ec6cb77f9..a58f4cd26 100644 --- a/core/block.bkp +++ b/core/block.bkp @@ -630,7 +630,7 @@ class block 'U_DELETE' => (phpbb_gallery::$auth->acl_check('m_comments', $album_id) || (phpbb_gallery::$auth->acl_check('c_delete', $album_id) && ($row['comment_user_id'] == $user->data['user_id']) && $user->data['is_registered'])) ? phpbb_gallery_url::append_sid('comment', "album_id=$album_id&image_id=$image_id&mode=delete&comment_id=" . $row['comment_id']) : '', 'U_QUOTE' => (phpbb_gallery::$auth->acl_check('c_post', $album_id)) ? phpbb_gallery_url::append_sid('comment', "album_id=$album_id&image_id=$image_id&mode=add&comment_id=" . $row['comment_id']) : '', 'U_EDIT' => (phpbb_gallery::$auth->acl_check('m_comments', $album_id) || (phpbb_gallery::$auth->acl_check('c_edit', $album_id) && ($row['comment_user_id'] == $user->data['user_id']) && $user->data['is_registered'])) ? phpbb_gallery_url::append_sid('comment', "album_id=$album_id&image_id=$image_id&mode=edit&comment_id=" . $row['comment_id']) : '', - 'U_INFO' => ($auth->acl_get('a_')) ? phpbb_gallery_url::append_sid('mcp', 'mode=whois&ip=' . $row['comment_user_ip']) : '', + 'U_WHOIS' => ($auth->acl_get('a_')) ? phpbb_gallery_url::append_sid('mcp', 'mode=whois&ip=' . $row['comment_user_ip']) : '', 'UC_THUMBNAIL' => phpbb_gallery_image::generate_link('thumbnail', phpbb_gallery_config::get('link_thumbnail'), $row['image_id'], $row['image_name'], $row['image_album_id']), 'UC_IMAGE_NAME' => phpbb_gallery_image::generate_link('image_name', phpbb_gallery_config::get('link_image_name'), $row['image_id'], $row['image_name'], $row['image_album_id']), diff --git a/core/comment.php b/core/comment.php index efad73962..a6583798e 100644 --- a/core/comment.php +++ b/core/comment.php @@ -174,8 +174,8 @@ public function sync_image_comments($image_ids = false) $sql = 'SELECT comment_image_id, COUNT(comment_id) AS num_comments, MAX(comment_id) AS last_comment FROM ' . $this->comments_table . ' ' . $sql_where . ' - GROUP BY comment_image_id, comment_id - ORDER BY comment_id DESC'; + GROUP BY comment_image_id + ORDER BY last_comment DESC'; $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) diff --git a/core/composer.json b/core/composer.json index 28f007b33..452e2aa38 100644 --- a/core/composer.json +++ b/core/composer.json @@ -31,7 +31,7 @@ "extra": { "display-name": "phpBB Gallery", "soft-require": { - "phpbb/phpbb": ">=3.3.0@dev" + "phpbb/phpbb": ">=3.3.0,<4.0.0@dev" } }, "version-check": { diff --git a/core/config.php b/core/config.php index 1cd9866ea..f534bc65d 100644 --- a/core/config.php +++ b/core/config.php @@ -64,6 +64,8 @@ class config 'hotlinking_domains' => 'anavaro.com', + 'items_per_page' => 15, + 'jpg_quality' => 100, 'link_thumbnail' => 'image_page', @@ -98,7 +100,6 @@ class config 'pegas_index_rnd_count' => 4, //'pegas_index_recent' => true, 'pegas_index_rct_count' => 4, - 'items_per_page' => 15, 'profile_user_images' => true, 'profile_pega' => true, 'prune_orphan_time' => 0, @@ -108,8 +109,8 @@ class config 'rrc_gindex_display' => 173, 'rrc_gindex_mode' => 7, 'rrc_gindex_pegas' => true, - 'rrc_profile_items' => 4, 'rrc_profile_display' => 141, + 'rrc_profile_items' => 4, 'rrc_profile_mode' => 3, //'rrc_profile_pegas' => true, @@ -121,7 +122,6 @@ class config 'thumbnail_quality' => 50, 'thumbnail_width' => 240, - 'version' => '', //'viewtopic_icon' => true, //'viewtopic_images' => true, //'viewtopic_link' => false, @@ -132,6 +132,8 @@ class config 'watermark_position' => 20, 'watermark_source' => 'gallery/images/watermark.png', 'watermark_width' => 200, + + 'version' => '', ); /** diff --git a/core/config/services.yml b/core/config/services.yml index bac3cd6e9..cbbaa6677 100644 --- a/core/config/services.yml +++ b/core/config/services.yml @@ -17,10 +17,10 @@ services: - '@phpbbgallery.core.cache' - '@phpbbgallery.core.block' - '@phpbbgallery.core.config' - - '%tables.phpbbgallery.albums%' - - '%tables.phpbbgallery.images%' - - '%tables.phpbbgallery.watch%' - - '%tables.phpbbgallery.contests%' + - '%phpbbgallery.tables.gallery_albums%' + - '%phpbbgallery.tables.gallery_images%' + - '%phpbbgallery.tables.gallery_watch%' + - '%phpbbgallery.tables.gallery_contests%' phpbbgallery.core.album.display: class: phpbbgallery\core\album\display arguments: @@ -38,17 +38,17 @@ services: - '@phpbbgallery.core.misc' - '%core.root_path%' - '%core.php_ext%' - - '%tables.phpbbgallery.albums%' - - '%tables.phpbbgallery.contests%' - - '%tables.phpbbgallery.tracking%' - - '%tables.phpbbgallery.moderators%' + - '%phpbbgallery.tables.gallery_albums%' + - '%phpbbgallery.tables.gallery_contests%' + - '%phpbbgallery.tables.gallery_tracking%' + - '%phpbbgallery.tables.gallery_moderators%' phpbbgallery.core.album.loader: class: phpbbgallery\core\album\loader arguments: - '@dbal.conn' - '@user' - '@phpbbgallery.core.contest' - - '%tables.phpbbgallery.albums%' + - '%phpbbgallery.tables.gallery_albums%' phpbbgallery.core.album.manage: class: phpbbgallery\core\album\manage arguments: @@ -68,12 +68,12 @@ services: - '@phpbbgallery.core.report' - '@phpbbgallery.core.log' - '@phpbbgallery.core.notification' - - '%tables.phpbbgallery.albums%' - - '%tables.phpbbgallery.images%' - - '%tables.phpbbgallery.comments%' - - '%tables.phpbbgallery.permissions%' - - '%tables.phpbbgallery.moderators%' - - '%tables.phpbbgallery.contests%' + - '%phpbbgallery.tables.gallery_albums%' + - '%phpbbgallery.tables.gallery_images%' + - '%phpbbgallery.tables.gallery_comments%' + - '%phpbbgallery.tables.gallery_permissions%' + - '%phpbbgallery.tables.gallery_moderators%' + - '%phpbbgallery.tables.gallery_contests%' phpbbgallery.core.misc: class: phpbbgallery\core\misc arguments: @@ -84,7 +84,7 @@ services: - '@phpbbgallery.core.config' - '@phpbbgallery.core.user' - '@phpbbgallery.core.url' - - '%tables.phpbbgallery.tracking%' + - '%phpbbgallery.tables.gallery_tracking%' phpbbgallery.core.auth: class: phpbbgallery\core\auth\auth arguments: @@ -93,10 +93,10 @@ services: - '@phpbbgallery.core.user' - '@user' - '@auth' - - '%tables.phpbbgallery.permissions%' - - '%tables.phpbbgallery.roles%' - - '%tables.phpbbgallery.users%' - - '%tables.phpbbgallery.albums%' + - '%phpbbgallery.tables.gallery_permissions%' + - '%phpbbgallery.tables.gallery_roles%' + - '%phpbbgallery.tables.gallery_users%' + - '%phpbbgallery.tables.gallery_albums%' phpbbgallery.core.auth.level: class: phpbbgallery\core\auth\level arguments: @@ -110,8 +110,8 @@ services: arguments: - '@cache' - '@dbal.conn' - - '%tables.phpbbgallery.albums%' - - '%tables.phpbbgallery.images%' + - '%phpbbgallery.tables.gallery_albums%' + - '%phpbbgallery.tables.gallery_images%' phpbbgallery.core.file.tool: class: phpbbgallery\core\file\file arguments: @@ -139,7 +139,7 @@ services: - '@phpbbgallery.core.user' - '@phpbbgallery.core.contest' - '@phpbbgallery.core.file.tool' - - '%tables.phpbbgallery.images%' + - '%phpbbgallery.tables.gallery_images%' phpbbgallery.core.user: class: phpbbgallery\core\user arguments: @@ -149,7 +149,7 @@ services: - '@profilefields.manager' - '@config' - '@auth' - - '%tables.phpbbgallery.users%' + - '%phpbbgallery.tables.gallery_users%' - '%core.root_path%' - '%core.php_ext%' phpbbgallery.core.config: @@ -171,8 +171,8 @@ services: - '@phpbbgallery.core.config' - '@pagination' - '@phpbbgallery.core.notification.helper' - - '%tables.phpbbgallery.images%' - - '%tables.phpbbgallery.reports%' + - '%phpbbgallery.tables.gallery_images%' + - '%phpbbgallery.tables.gallery_reports%' phpbbgallery.core.comment: class: phpbbgallery\core\comment arguments: @@ -181,8 +181,8 @@ services: - '@phpbbgallery.core.config' - '@phpbbgallery.core.auth' - '@phpbbgallery.core.block' - - '%tables.phpbbgallery.comments%' - - '%tables.phpbbgallery.images%' + - '%phpbbgallery.tables.gallery_comments%' + - '%phpbbgallery.tables.gallery_images%' phpbbgallery.core.url: class: phpbbgallery\core\url arguments: @@ -209,7 +209,7 @@ services: - '@phpbbgallery.core.config' - '@phpbbgallery.core.notification' - '@phpbbgallery.core.rating' - - '%tables.phpbbgallery.images%' + - '%phpbbgallery.tables.gallery_images%' phpbbgallery.core.search: class: phpbbgallery\core\search arguments: @@ -224,15 +224,15 @@ services: - '@phpbbgallery.core.image' - '@pagination' - '@user_loader' - - '%tables.phpbbgallery.images%' - - '%tables.phpbbgallery.albums%' - - '%tables.phpbbgallery.comments%' + - '%phpbbgallery.tables.gallery_images%' + - '%phpbbgallery.tables.gallery_albums%' + - '%phpbbgallery.tables.gallery_comments%' phpbbgallery.core.notification: class: phpbbgallery\core\notification arguments: - '@dbal.conn' - '@user' - - '%tables.phpbbgallery.watch%' + - '%phpbbgallery.tables.gallery_watch%' phpbbgallery.core.notification.helper: class: phpbbgallery\core\notification\helper arguments: @@ -248,7 +248,7 @@ services: - '@service_container' - '%core.root_path%' - '%core.php_ext%' - - '%tables.phpbbgallery.watch%' + - '%phpbbgallery.tables.gallery_watch%' calls: - [set_image, ['@phpbbgallery.core.image']] phpbbgallery.core.log: @@ -263,8 +263,8 @@ services: - '@pagination' - '@phpbbgallery.core.auth' - '@phpbbgallery.core.config' - - '%tables.phpbbgallery.log%' - - '%tables.phpbbgallery.images%' + - '%phpbbgallery.tables.gallery_log%' + - '%phpbbgallery.tables.gallery_images%' phpbbgallery.core.block: class: phpbbgallery\core\block phpbbgallery.core.contest: @@ -272,8 +272,8 @@ services: arguments: - '@dbal.conn' - '@phpbbgallery.core.config' - - '%tables.phpbbgallery.images%' - - '%tables.phpbbgallery.contests%' + - '%phpbbgallery.tables.gallery_images%' + - '%phpbbgallery.tables.gallery_contests%' phpbbgallery.core.upload: class: phpbbgallery\core\upload arguments: @@ -288,7 +288,7 @@ services: - '@phpbbgallery.core.url' - '@phpbbgallery.core.block' - '@phpbbgallery.core.file.tool' - - '%tables.phpbbgallery.images%' + - '%phpbbgallery.tables.gallery_images%' - '%core.root_path%' - '%core.php_ext%' phpbbgallery.core.rating: @@ -301,9 +301,9 @@ services: - '@request' - '@phpbbgallery.core.config' - '@phpbbgallery.core.auth' - - '%tables.phpbbgallery.images%' - - '%tables.phpbbgallery.albums%' - - '%tables.phpbbgallery.rates%' + - '%phpbbgallery.tables.gallery_images%' + - '%phpbbgallery.tables.gallery_albums%' + - '%phpbbgallery.tables.gallery_rates%' ####################### #### Define event ##### ####################### @@ -317,8 +317,8 @@ services: - '@phpbbgallery.core.search' - '@phpbbgallery.core.config' - '@dbal.conn' - - '%tables.phpbbgallery.albums%' - - '%tables.phpbbgallery.users%' + - '%phpbbgallery.tables.gallery_albums%' + - '%phpbbgallery.tables.gallery_users%' - '%core.php_ext%' tags: - { name: event.listener } diff --git a/core/config/services_controller.yml b/core/config/services_controller.yml index 550bb476c..eb97b2836 100644 --- a/core/config/services_controller.yml +++ b/core/config/services_controller.yml @@ -26,7 +26,7 @@ services: - '@phpbbgallery.core.upload' - '@phpbbgallery.core.block' - '@phpbbgallery.core.contest' - - '%tables.phpbbgallery.images%' + - '%phpbbgallery.tables.gallery_images%' - '%core.root_path%' phpbbgallery.core.controller.album: class: phpbbgallery\core\controller\album @@ -48,7 +48,7 @@ services: - '@phpbbgallery.core.image' - '@request' - '@phpbbgallery.core.contest' - - '%tables.phpbbgallery.images%' + - '%phpbbgallery.tables.gallery_images%' phpbbgallery.core.controller.file: class: phpbbgallery\core\controller\file arguments: @@ -63,8 +63,8 @@ services: - '%phpbbgallery.core.file.medium%' - '%phpbbgallery.core.file.mini%' - '%phpbbgallery.core.file.watermark%' - - '%tables.phpbbgallery.albums%' - - '%tables.phpbbgallery.images%' + - '%phpbbgallery.tables.gallery_albums%' + - '%phpbbgallery.tables.gallery_images%' phpbbgallery.core.controller.image: class: phpbbgallery\core\controller\image arguments: @@ -97,10 +97,10 @@ services: - '@phpbbgallery.core.rating' - '@phpbbgallery.core.block' - '@service_container' - - '%tables.phpbbgallery.albums%' - - '%tables.phpbbgallery.images%' - - '%tables.phpbbgallery.users%' - - '%tables.phpbbgallery.comments%' + - '%phpbbgallery.tables.gallery_albums%' + - '%phpbbgallery.tables.gallery_images%' + - '%phpbbgallery.tables.gallery_users%' + - '%phpbbgallery.tables.gallery_comments%' - '%core.root_path%' - '%core.php_ext%' phpbbgallery.core.controller.index: @@ -142,9 +142,9 @@ services: - '@phpbbgallery.core.image' - '@phpbbgallery.core.url' - '@phpbbgallery.core.search' - - '%tables.phpbbgallery.images%' - - '%tables.phpbbgallery.albums%' - - '%tables.phpbbgallery.comments%' + - '%phpbbgallery.tables.gallery_images%' + - '%phpbbgallery.tables.gallery_albums%' + - '%phpbbgallery.tables.gallery_comments%' - '%core.root_path%' - '%core.php_ext%' phpbbgallery.core.controller.comment: @@ -173,7 +173,7 @@ services: - '@phpbbgallery.core.notification' - '@phpbbgallery.core.rating' - '@service_container' - - '%tables.phpbbgallery.comments%' + - '%phpbbgallery.tables.gallery_comments%' - '%core.root_path%' - '%core.php_ext%' phpbbgallery.core.controller.moderate: diff --git a/core/config/services_files.yml b/core/config/services_files.yml index fa6ee4c4a..597230468 100644 --- a/core/config/services_files.yml +++ b/core/config/services_files.yml @@ -2,7 +2,7 @@ #### Define file Types ##### ######################################## services: - phpbbgallery.core.files.type.multiform: + phpbbgallery.core.files.types.multiform: class: phpbbgallery\core\file\types\multiform shared: false arguments: diff --git a/core/config/tables.yml b/core/config/tables.yml index 2491cd5ad..90f46d4bb 100644 --- a/core/config/tables.yml +++ b/core/config/tables.yml @@ -1,19 +1,21 @@ parameters: - phpbbgallery.core.file.source: '%core.root_path%files/phpbbgallery/core/source/' - phpbbgallery.core.file.medium: '%core.root_path%files/phpbbgallery/core/medium/' - phpbbgallery.core.file.mini: '%core.root_path%files/phpbbgallery/core/mini/' - phpbbgallery.core.file.watermark: '%core.root_path%ext/phpbbgallery/core/images/watermark.png' + phpbbgallery.core: + file.source: '%core.root_path%files/phpbbgallery/core/source/' + file.medium: '%core.root_path%files/phpbbgallery/core/medium/' + file.mini: '%core.root_path%files/phpbbgallery/core/mini/' + file.watermark: '%core.root_path%ext/phpbbgallery/core/images/watermark.png' - tables.phpbbgallery.albums: '%core.table_prefix%gallery_albums' - tables.phpbbgallery.contests: '%core.table_prefix%gallery_contests' - tables.phpbbgallery.images: '%core.table_prefix%gallery_images' - tables.phpbbgallery.moderators: '%core.table_prefix%gallery_modscache' - tables.phpbbgallery.permissions: '%core.table_prefix%gallery_permissions' - tables.phpbbgallery.roles: '%core.table_prefix%gallery_roles' - tables.phpbbgallery.tracking: '%core.table_prefix%gallery_albums_track' - tables.phpbbgallery.users: '%core.table_prefix%gallery_users' - tables.phpbbgallery.comments: '%core.table_prefix%gallery_comments' - tables.phpbbgallery.reports: '%core.table_prefix%gallery_reports' - tables.phpbbgallery.rates: '%core.table_prefix%gallery_rates' - tables.phpbbgallery.log: '%core.table_prefix%gallery_log' - tables.phpbbgallery.watch: '%core.table_prefix%gallery_watch' + phpbbgallery.tables: + gallery_albums: '%core.table_prefix%gallery_albums' + gallery_contests: '%core.table_prefix%gallery_contests' + gallery_images: '%core.table_prefix%gallery_images' + gallery_moderators: '%core.table_prefix%gallery_modscache' + gallery_permissions: '%core.table_prefix%gallery_permissions' + gallery_roles: '%core.table_prefix%gallery_roles' + gallery_tracking: '%core.table_prefix%gallery_albums_track' + gallery_users: '%core.table_prefix%gallery_users' + gallery_comments: '%core.table_prefix%gallery_comments' + gallery_reports: '%core.table_prefix%gallery_reports' + gallery_rates: '%core.table_prefix%gallery_rates' + gallery_log: '%core.table_prefix%gallery_log' + gallery_watch: '%core.table_prefix%gallery_watch' diff --git a/core/controller/album.php b/core/controller/album.php index b906364de..b050f140f 100644 --- a/core/controller/album.php +++ b/core/controller/album.php @@ -332,7 +332,6 @@ protected function display_images($album_id, $album_data, $start, $limit) $result = $this->db->sql_query_limit($sql, $limit, $start); // Now let's get display options - $show_ip = $show_ratings = $show_username = $show_views = $show_time = $show_imagename = $show_comments = $show_album = false; $show_options = (int) $this->gallery_config->get('album_display'); $show_ip = ($show_options & self::ALBUM_SHOW_IP) !== 0; $show_ratings = ($show_options & self::ALBUM_SHOW_RATINGS) !== 0; diff --git a/core/controller/comment.php b/core/controller/comment.php index 8520fc6f8..6312818bb 100644 --- a/core/controller/comment.php +++ b/core/controller/comment.php @@ -697,7 +697,9 @@ public function delete($image_id, $comment_id) // Build smilies array generate_smilies('inline', 0); - $s_hide_comment_input = (time() < ($album_data['contest_start'] + $album_data['contest_end'])) ? true : false; + $contest_start = $album_data['contest_start'] ?? 0; + $contest_end = $album_data['contest_end'] ?? 0; + $s_hide_comment_input = (time() < ($contest_start + $contest_end)) ? true : false; $this->template->assign_vars(array( 'BBCODE_STATUS' => ($bbcode_status) ? sprintf($this->language->lang('BBCODE_IS_ON'), '', '') : sprintf($this->language->lang('BBCODE_IS_OFF'), '', ''), diff --git a/core/controller/image.php b/core/controller/image.php index 9b1e0eabd..3d894851f 100644 --- a/core/controller/image.php +++ b/core/controller/image.php @@ -484,8 +484,8 @@ public function base($image_id, $page = 0) 'POSTER_WARNINGS' => $user_data['warnings'] ?? 0, 'POSTER_AGE' => $user_data['age'] ?? '', - 'POSTER_ONLINE_IMG' => ($user_id == ANONYMOUS || !$this->config['load_onlinetrack']) ? '' : (($user_data['online'] ?? false) ? $this->user->img('icon_user_online', 'ONLINE') : $this->user->img('icon_user_offline', 'OFFLINE')), - 'S_POSTER_ONLINE' => ($user_id == ANONYMOUS || !$this->config['load_onlinetrack']) ? false : (($user_data['online'] ?? false) ? true : false), + 'POSTER_ONLINE_IMG' => ($user_id == ANONYMOUS || !$this->config['load_onlinetrack']) ? '' : ($user_data['online'] ? $this->user->img('icon_user_online', 'ONLINE') : $this->user->img('icon_user_offline', 'OFFLINE')), + 'S_POSTER_ONLINE' => ($user_id == ANONYMOUS || !$this->config['load_onlinetrack']) ? false : $user_data['online'], //'U_POSTER_PROFILE' => $user_data['profile'] ?? '', 'U_POSTER_SEARCH' => $user_data['search'] ?? '', @@ -655,41 +655,24 @@ protected function display_comments($image_id, $image_data, $album_id, $album_da $this->load_users_data(); - // Load online-information - if ($this->config['load_onlinetrack'] && sizeof($this->users_id_array)) - { - $sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline - FROM ' . SESSIONS_TABLE . ' - WHERE ' . $this->db->sql_in_set('session_user_id', $this->users_id_array) . ' - GROUP BY session_user_id'; - $result = $this->db->sql_query($sql); - - $update_time = $this->config['load_online_time'] * 60; - while ($row = $this->db->sql_fetchrow($result)) - { - $this->users_data_array[$row['session_user_id']]['online'] = (time() - $update_time < $row['online_time'] && (($row['viewonline']) || $this->auth->acl_get('u_viewonline'))) ? true : false; - } - $this->db->sql_freeresult($result); - } - foreach ($comments as $row) { $edit_info = ''; // Let's deploy new profile $poster_id = $row['comment_user_id']; - + $user_data = $this->users_data_array[$poster_id] ?? []; if ($row['comment_edit_count'] > 0) { $edit_info = ($row['comment_edit_count'] == 1) ? $this->language->lang('IMAGE_EDITED_TIME_TOTAL') : $this->language->lang('IMAGE_EDITED_TIMES_TOTAL'); $edit_info = sprintf($edit_info, get_username_string('full', $row['comment_edit_user_id'], $this->users_data_array[$row['comment_edit_user_id']]['username'], $this->users_data_array[$row['comment_edit_user_id']]['user_colour']), $this->user->format_date($row['comment_edit_time'], false, true), $row['comment_edit_count']); } - $user_deleted = (isset($this->users_data_array[$poster_id]) ? false : true); + $user_deleted = (isset($user_data) ? false : true); // End signature parsing, only if needed - if ($this->users_data_array[$poster_id]['sig'] && empty($this->users_data_array[$poster_id]['sig_parsed'])) + if ($user_data['sig'] && empty($user_data['sig_parsed'])) { - $parse_flags = ($this->users_data_array[$poster_id]['sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; - $user_cache[$poster_id]['sig'] = generate_text_for_display($this->users_data_array[$poster_id]['sig'], $this->users_data_array[$poster_id]['sig_bbcode_uid'], $this->users_data_array[$poster_id]['sig_bbcode_bitfield'], $parse_flags, true); + $parse_flags = ($user_data['sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $user_cache[$poster_id]['sig'] = generate_text_for_display($user_data['sig'], $user_data['sig_bbcode_uid'], $user_data['sig_bbcode_bitfield'], $parse_flags, true); $user_cache[$poster_id]['sig_parsed'] = true; } @@ -701,13 +684,13 @@ protected function display_comments($image_id, $image_data, $album_id, $album_da } $can_receive_pm = ( // They must be a "normal" user - $this->users_data_array[$poster_id]['user_type'] != USER_IGNORE && + $user_data['user_type'] != USER_IGNORE && // They must not be deactivated by the administrator - ($this->users_data_array[$poster_id]['user_type'] != USER_INACTIVE || $this->users_data_array[$poster_id]['user_inactive_reason'] != INACTIVE_MANUAL) && + ($user_data['user_type'] != USER_INACTIVE || $user_data['user_inactive_reason'] != INACTIVE_MANUAL) && // They must be able to read PMs in_array($poster_id, $this->can_receive_pm_list) && // They must allow users to contact via PM - (($this->auth->acl_gets('a_', 'm_') || $this->auth->acl_getf_global('m_')) || $this->users_data_array[$poster_id]['allow_pm']) + (($this->auth->acl_gets('a_', 'm_') || $this->auth->acl_getf_global('m_')) || $user_data['allow_pm']) ); $u_pm = ''; if ($this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && $can_receive_pm) @@ -715,6 +698,7 @@ protected function display_comments($image_id, $image_data, $album_id, $album_da $u_pm = append_sid("{$this->phpbb_root_path}ucp.$this->php_ext", 'i=pm&mode=compose'); } + $user_data = $this->users_data_array[$poster_id] ?? []; $comment_row = array( 'U_COMMENT' => $this->helper->route('phpbbgallery_core_image', array('image_id' => $image_id)) . '#comment_' . $row['comment_id'], 'COMMENT_ID' => $row['comment_id'], @@ -724,31 +708,34 @@ protected function display_comments($image_id, $image_data, $album_id, $album_da 'U_DELETE' => ($this->gallery_auth->acl_check('m_comments', $album_id, $album_data['album_user_id']) || ($this->gallery_auth->acl_check('c_delete', $album_id, $album_data['album_user_id']) && ($row['comment_user_id'] == $this->user->data['user_id']) && $this->user->data['is_registered'])) ? $this->helper->route('phpbbgallery_core_comment_delete', array('image_id' => $image_id, 'comment_id' => $row['comment_id'])) : '', 'U_QUOTE' => ($this->gallery_auth->acl_check('c_post', $album_id, $album_data['album_user_id'])) ? $this->helper->route('phpbbgallery_core_comment_add', array('image_id' => $image_id, 'comment_id' => $row['comment_id'])) : '', 'U_EDIT' => ($this->gallery_auth->acl_check('m_comments', $album_id, $album_data['album_user_id']) || ($this->gallery_auth->acl_check('c_edit', $album_id, $album_data['album_user_id']) && ($row['comment_user_id'] == $this->user->data['user_id']) && $this->user->data['is_registered'])) ? $this->helper->route('phpbbgallery_core_comment_edit', array('image_id' => $image_id, 'comment_id' => $row['comment_id'])) : '', - 'U_INFO' => ($this->auth->acl_get('a_')) ? $this->url->append_sid('mcp', 'mode=whois&ip=' . $row['comment_user_ip']) : '', - - 'POSTER_FULL' => get_username_string('full', $poster_id, $this->users_data_array[$poster_id]['username'], $this->users_data_array[$poster_id]['user_colour']), - 'POSTER_COLOUR' => get_username_string('colour', $poster_id, $this->users_data_array[$poster_id]['username'], $this->users_data_array[$poster_id]['user_colour']), - 'POSTER_USERNAME' => get_username_string('username', $poster_id, $this->users_data_array[$poster_id]['username'], $this->users_data_array[$poster_id]['user_colour']), - 'U_POSTER' => get_username_string('profile', $poster_id, $this->users_data_array[$poster_id]['username'], $this->users_data_array[$poster_id]['user_colour']), - - 'SIGNATURE' => ($row['comment_signature'] && !$user_deleted) ? generate_text_for_display($this->users_data_array[$poster_id]['sig'], $row['comment_uid'], $row['comment_bitfield'], 7) : '', - 'RANK_TITLE' => $user_deleted ? '' : $this->users_data_array[$poster_id]['rank_title'], - 'RANK_IMG' => $user_deleted ? '' : $this->users_data_array[$poster_id]['rank_image'], - 'RANK_IMG_SRC' => $user_deleted ? '' : $this->users_data_array[$poster_id]['rank_image_src'], - 'POSTER_JOINED' => $user_deleted ? '' : $this->users_data_array[$poster_id]['joined'], - 'POSTER_POSTS' => $user_deleted ? '' : $this->users_data_array[$poster_id]['posts'], - 'POSTER_FROM' => isset($this->users_data_array[$poster_id]['from']) ? $this->users_data_array[$poster_id]['from'] : '', - 'POSTER_AVATAR' => $user_deleted ? '' : $this->users_data_array[$poster_id]['avatar'], - 'POSTER_WARNINGS' => $user_deleted ? '' : $this->users_data_array[$poster_id]['warnings'], - 'POSTER_AGE' => $user_deleted ? '' : $this->users_data_array[$poster_id]['age'], - - 'MINI_POST_IMG' => $this->user->img('icon_post_target', 'POST'), - 'ICQ_STATUS_IMG' => isset($this->users_data_array[$poster_id]['icq_status_img']) ? $this->users_data_array[$poster_id]['icq_status_img'] : '', - 'ONLINE_IMG' => ($poster_id == ANONYMOUS || !$this->config['load_onlinetrack']) ? '' : ($user_deleted ? '' : (($this->users_data_array[$poster_id]['online']) ? $this->user->img('icon_user_online', 'ONLINE') : $this->user->img('icon_user_offline', 'OFFLINE'))), - 'S_ONLINE' => ($poster_id == ANONYMOUS || !$this->config['load_onlinetrack']) ? false : ($user_deleted ? '' : (($this->users_data_array[$poster_id]['online']) ? true : false)), + // TODO Whois link + // 'U_WHOIS' => ($this->auth->acl_get('a_')) ? $this->url->append_sid('mcp', 'mode=whois&ip=' . $row['comment_user_ip']) : '', + + 'POSTER_FULL' => get_username_string('full', $poster_id, $user_data['username'], $user_data['user_colour']), + 'POSTER_COLOUR' => get_username_string('colour', $poster_id, $user_data['username'], $user_data['user_colour']), + 'POSTER_USERNAME' => get_username_string('username', $poster_id, $user_data['username'], $user_data['user_colour']), + 'U_POSTER' => get_username_string('profile', $poster_id, $user_data['username'], $user_data['user_colour']), + 'POSTER_IP' => ($this->auth->acl_get('a_')) ? $row['comment_user_ip'] : '', + + 'POSTER_SIGNATURE' => ($row['comment_signature'] && !$user_deleted) ? generate_text_for_display($user_data['sig'], $row['comment_uid'], $row['comment_bitfield'], 7) : '', + 'POSTER_RANK_TITLE' => $user_deleted ? '' : $user_data['rank_title'], + 'POSTER_RANK_IMG' => $user_deleted ? '' : $user_data['rank_image'], + 'POSTER_RANK_IMG_SRC' => $user_deleted ? '' : $user_data['rank_image_src'], + 'POSTER_JOINED' => $user_deleted ? '' : $user_data['joined'], + 'POSTER_POSTS' => $user_deleted ? '' : $user_data['posts'], + 'POSTER_FROM' => isset($user_data['from']) ? $user_data['from'] : '', + 'POSTER_AVATAR' => $user_deleted ? '' : $user_data['avatar'], + 'POSTER_WARNINGS' => $user_deleted ? '' : $user_data['warnings'], + 'POSTER_AGE' => $user_deleted ? '' : $user_data['age'], + + // 'MINI_POST_IMG' => $this->user->img('icon_post_target', 'POST'), + // 'ICQ_STATUS_IMG' => isset($user_data['icq_status_img']) ? $user_data['icq_status_img'] : '', + 'POSTER_ONLINE_IMG' => ($poster_id == ANONYMOUS || !$this->config['load_onlinetrack']) ? '' : ($user_deleted ? '' : ($user_data['online'] ? $this->user->img('icon_user_online', 'ONLINE') : $this->user->img('icon_user_offline', 'OFFLINE'))), + 'S_POSTER_ONLINE' => ($poster_id == ANONYMOUS || !$this->config['load_onlinetrack']) ? false : ($user_deleted ? '' : $user_data['online']), 'S_CUSTOM_FIELDS' => (isset($cp_row['row']) && count($cp_row['row'])) ? true : false, ); + if (isset($cp_row['row']) && count($cp_row['row'])) { $comment_row = array_merge($comment_row, $cp_row['row']); @@ -764,12 +751,12 @@ protected function display_comments($image_id, $image_data, $album_id, $album_da array( 'ID' => 'email', 'NAME' => $this->language->lang('SEND_EMAIL'), - 'U_CONTACT' => $this->users_data_array[$poster_id]['email'], + 'U_CONTACT' => $user_data['email'], ), array( 'ID' => 'jabber', 'NAME' => $this->language->lang('JABBER'), - 'U_CONTACT' => $this->users_data_array[$poster_id]['jabber'], + 'U_CONTACT' => $user_data['jabber'], ), ); @@ -1188,6 +1175,7 @@ public function report($image_id) $this->template->assign_vars(array( 'ERROR' => $error, 'U_IMAGE' => ($image_id) ? $this->helper->route('phpbbgallery_core_image_file_medium', array('image_id' => $image_id)) : '', + 'IMAGE_NAME' => $image_data['image_name'], 'U_VIEW_IMAGE' => ($image_id) ? $this->helper->route('phpbbgallery_core_image', array('image_id' => $image_id)) : '', 'IMAGE_RSZ_WIDTH' => $this->gallery_config->get('medium_width'), 'IMAGE_RSZ_HEIGHT' => $this->gallery_config->get('medium_height'), @@ -1286,5 +1274,21 @@ protected function load_users_data() } $this->can_receive_pm_list = (empty($this->can_receive_pm_list) || !isset($this->can_receive_pm_list[0]['u_readpm'])) ? array() : $this->can_receive_pm_list[0]['u_readpm']; + // Load online-information + if ($this->config['load_onlinetrack'] && sizeof($this->users_id_array)) + { + $sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline + FROM ' . SESSIONS_TABLE . ' + WHERE ' . $this->db->sql_in_set('session_user_id', $this->users_id_array) . ' + GROUP BY session_user_id'; + $result = $this->db->sql_query($sql); + + $update_time = $this->config['load_online_time'] * 60; + while ($row = $this->db->sql_fetchrow($result)) + { + $this->users_data_array[$row['session_user_id']]['online'] = (time() - $update_time < $row['online_time'] && (($row['viewonline']) || $this->auth->acl_get('u_viewonline'))) ? true : false; + } + $this->db->sql_freeresult($result); + } } } diff --git a/core/controller/index.php b/core/controller/index.php index 497b4cecc..1912cdd46 100644 --- a/core/controller/index.php +++ b/core/controller/index.php @@ -68,6 +68,7 @@ class index const RRC_MODE_RECENT_COMMENTS = 4; const RRC_MODE_RANDOM_IMAGES = 2; const RRC_MODE_RECENT_IMAGES = 1; + /** * Constructor * @@ -303,22 +304,12 @@ protected function assign_dropdown_links($base_route) $this->gallery_auth->load_user_permissions($this->user->data['user_id']); // Now let's get display options - $show_comments = $show_random = $show_recent = false; - $show_options = $this->gallery_config->get('rrc_gindex_mode'); - if ($show_options >= 4) - { - $show_comments = true; - $show_options = $show_options - 4; - } - if ($show_options >= 2) - { - $show_random = true; - $show_options = $show_options - 2; - } - if ($show_options == 1) - { - $show_recent = true; - } + $show_options = (int) $this->gallery_config->get('rrc_gindex_mode'); + + $show_comments = (bool) ($show_options & self::RRC_MODE_RECENT_COMMENTS); + $show_random = (bool) ($show_options & self::RRC_MODE_RANDOM_IMAGES); + $show_recent = (bool) ($show_options & self::RRC_MODE_RECENT_IMAGES); + $this->template->assign_vars(array( 'TOTAL_IMAGES' => ($this->gallery_config->get('disp_statistic')) ? $this->language->lang('TOTAL_IMAGES_SPRINTF', $this->gallery_config->get('num_images')) : '', 'TOTAL_COMMENTS' => ($this->gallery_config->get('allow_comments')) ? $this->language->lang('TOTAL_COMMENTS_SPRINTF', $this->gallery_config->get('num_comments')) : '', @@ -329,14 +320,14 @@ protected function assign_dropdown_links($base_route) $this->template->assign_vars(array( 'U_MCP' => ($this->gallery_auth->acl_check_global('m_')) ? $this->helper->route('phpbbgallery_core_moderate') : '', 'U_MARK_ALBUMS' => ($this->user->data['is_registered']) ? $this->helper->route($base_route, array('hash' => generate_link_hash('global'), 'mark' => 'albums')) : '', - 'S_LOGIN_ACTION' => append_sid($this->root_path . 'ucp.' . $this->php_ext, 'mode=login&redirect=' . urlencode($this->helper->route($base_route))), + 'S_LOGIN_ACTION' => append_sid($this->root_path . 'ucp.' . $this->php_ext, 'mode=login&redirect=' . urlencode($this->helper->route($base_route))), 'U_GALLERY_SEARCH' => $this->helper->route('phpbbgallery_core_search'), 'U_G_SEARCH_COMMENTED' => $this->config['phpbb_gallery_allow_comments'] && $show_comments ? $this->helper->route('phpbbgallery_core_search_commented') : false, //'U_G_SEARCH_CONTESTS' => $this->config['phpbb_gallery_allow_rates'] && $this->config['phpbb_gallery_contests_ended'] ? $this->helper->route('phpbbgallery_core_search_contests') : '', 'U_G_SEARCH_RECENT' => $show_recent ? $this->helper->route('phpbbgallery_core_search_recent') : false, 'U_G_SEARCH_RANDOM' => $show_random ? $this->helper->route('phpbbgallery_core_search_random') : false, - 'U_G_SEARCH_SELF' => $this->helper->route('phpbbgallery_core_search_egosearch'), + 'U_G_SEARCH_SELF' => $this->helper->route('phpbbgallery_core_search_egosearch'), 'U_G_SEARCH_TOPRATED' => $this->config['phpbb_gallery_allow_rates'] ? $this->helper->route('phpbbgallery_core_search_toprated') : '', )); } diff --git a/core/controller/upload.php b/core/controller/upload.php index edcc0f29e..9bd929da5 100644 --- a/core/controller/upload.php +++ b/core/controller/upload.php @@ -210,6 +210,7 @@ public function main($album_id) trigger_error($this->language->lang('USER_REACHED_QUOTA', $this->auth->acl_check('i_count', $album_id, $album_data['album_user_id']))); } } + $upload_files_limit = ($this->auth->acl_check('i_unlimited', $album_id, $album_data['album_user_id'])) ? $this->gallery_config->get('num_uploads') : min(($this->auth->acl_check('i_count', $album_id, $album_data['album_user_id']) - $own_images), $this->gallery_config->get('num_uploads')); $process = $this->gallery_upload; $process->set_up($album_id, $upload_files_limit); diff --git a/core/ext.php b/core/ext.php index a6372019f..43bf60f55 100644 --- a/core/ext.php +++ b/core/ext.php @@ -9,7 +9,7 @@ * @license GPL-2.0-only */ -// this file is not really needed, when empty it can be ommitted +// this file is not really needed, when empty it can be omitted // however you can override the default methods and add custom // installation logic @@ -17,11 +17,12 @@ class ext extends \phpbb\extension\base { - protected $add_ons = array( + protected $sub_extensions = [ + 'phpbbgallery/acpcleanup', 'phpbbgallery/acpimport', 'phpbbgallery/exif', - 'phpbbgallery/acpcleanup', - ); + ]; + /** * Single enable step that installs any included migrations * @@ -33,26 +34,17 @@ function enable_step($old_state) switch ($old_state) { case '': // Empty means nothing has run yet - // Disable list of official extensions - $extensions = $this->container->get('ext.manager'); - $configured = $extensions->all_disabled(); - //var_dump($configured); - foreach ($this->add_ons as $var) - { - if (array_key_exists($var, $configured)) - { - $extensions->enable($var); - } - } // Enable board rules notifications $phpbb_notifications = $this->container->get('notification_manager'); $phpbb_notifications->enable_notifications('phpbbgallery.core.notification.image_for_approval'); $phpbb_notifications->enable_notifications('phpbbgallery.core.notification.image_approved'); - $phpbb_notifications->enable_notifications('phpbbgallery.core.notification.new_image'); + $phpbb_notifications->enable_notifications('phpbbgallery.core.notification.image_not_approved'); $phpbb_notifications->enable_notifications('phpbbgallery.core.notification.new_comment'); + $phpbb_notifications->enable_notifications('phpbbgallery.core.notification.new_image'); $phpbb_notifications->enable_notifications('phpbbgallery.core.notification.new_report'); return 'notifications'; break; + default: // Run parent enable step method return parent::enable_step($old_state); @@ -73,17 +65,18 @@ function disable_step($old_state) case '': // Empty means nothing has run yet // Disable list of official extensions $extensions = $this->container->get('ext.manager'); - foreach ($this->add_ons as $var) + foreach ($this->sub_extensions as $sub_ext) { - $extensions->disable($var); + $extensions->disable($sub_ext); } // Disable board rules notifications $phpbb_notifications = $this->container->get('notification_manager'); $phpbb_notifications->disable_notifications('phpbbgallery.core.notification.image_for_approval'); $phpbb_notifications->disable_notifications('phpbbgallery.core.notification.image_approved'); - $phpbb_notifications->disable_notifications('phpbbgallery.core.notification.new_image'); + $phpbb_notifications->disable_notifications('phpbbgallery.core.notification.image_not_approve'); $phpbb_notifications->disable_notifications('phpbbgallery.core.notification.new_comment'); + $phpbb_notifications->disable_notifications('phpbbgallery.core.notification.new_image'); $phpbb_notifications->disable_notifications('phpbbgallery.core.notification.new_report'); return 'notifications'; @@ -103,6 +96,27 @@ function disable_step($old_state) */ function purge_step($old_state) { + $extensions = $this->container->get('ext.manager'); + $configured = $extensions->all_disabled(); + + $disabled_sub_exts = []; + + foreach ($this->sub_extensions as $sub_ext) + { + if (isset($configured[$sub_ext])) + { + $disabled_sub_exts[] = '» ' . $sub_ext; + } + } + + if (!empty($disabled_sub_exts)) + { + $this->container->get('user')->add_lang_ext('phpbbgallery/core', 'install_gallery'); + $error_msg = sprintf($this->container->get('user')->lang( + 'GALLERY_SUB_EXT_UNINSTALL', implode('
', $disabled_sub_exts),count($disabled_sub_exts))); + trigger_error($error_msg, E_USER_WARNING); + } + switch ($old_state) { case '': // Empty means nothing has run yet diff --git a/core/language/bg/gallery.php b/core/language/bg/gallery.php index 58764c90c..755f0e26f 100644 --- a/core/language/bg/gallery.php +++ b/core/language/bg/gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/bg/gallery_acp.php b/core/language/bg/gallery_acp.php index af999e2d6..a2aae914c 100644 --- a/core/language/bg/gallery_acp.php +++ b/core/language/bg/gallery_acp.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/bg/gallery_mcp.php b/core/language/bg/gallery_mcp.php index 955b3c403..1a658805e 100644 --- a/core/language/bg/gallery_mcp.php +++ b/core/language/bg/gallery_mcp.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/bg/gallery_notifications.php b/core/language/bg/gallery_notifications.php index 1e3cd7233..f7da902fc 100644 --- a/core/language/bg/gallery_notifications.php +++ b/core/language/bg/gallery_notifications.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/bg/gallery_ucp.php b/core/language/bg/gallery_ucp.php index 846ecdc57..0a578db10 100644 --- a/core/language/bg/gallery_ucp.php +++ b/core/language/bg/gallery_ucp.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/bg/info_acp_gallery.php b/core/language/bg/info_acp_gallery.php index 198c5f1cd..1edd601b2 100644 --- a/core/language/bg/info_acp_gallery.php +++ b/core/language/bg/info_acp_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/bg/info_acp_gallery_logs.php b/core/language/bg/info_acp_gallery_logs.php index 816959ee2..4a340021d 100644 --- a/core/language/bg/info_acp_gallery_logs.php +++ b/core/language/bg/info_acp_gallery_logs.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/bg/info_ucp_gallery.php b/core/language/bg/info_ucp_gallery.php index 5c39d5f40..a26ae8b04 100644 --- a/core/language/bg/info_ucp_gallery.php +++ b/core/language/bg/info_ucp_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/bg/install_gallery.php b/core/language/bg/install_gallery.php index f670ff3bb..b4a1a3326 100644 --- a/core/language/bg/install_gallery.php +++ b/core/language/bg/install_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( @@ -130,5 +130,10 @@ 'UPDATE_INSTALLATION_EXPLAIN' => 'Here you can Update your phpBB Gallery-Version.', - 'VERSION_NOT_SUPPORTED' => 'Sorry, but your updates prior to 1.0.6 are not supported from this install/update-system.', + 'VERSION_NOT_SUPPORTED' => 'Sorry, but your updates prior to 1.0.6 are not supported from this install/update-system.', + + 'GALLERY_SUB_EXT_UNINSTALL' => array( + 1 => 'Трябва да деинсталирате разширението:
%s
преди да деинсталирате основното разширение.', + 2 => 'Трябва да деинсталирате разширенията:
%s
преди да деинсталирате основното разширение.', + ), )); diff --git a/core/language/bg/permissions_gallery.php b/core/language/bg/permissions_gallery.php index 248c82934..32bd69b7d 100644 --- a/core/language/bg/permissions_gallery.php +++ b/core/language/bg/permissions_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // Adding the permissions diff --git a/core/language/de/gallery.php b/core/language/de/gallery.php index 8c178c5c5..dc66ce613 100644 --- a/core/language/de/gallery.php +++ b/core/language/de/gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/de/gallery_acp.php b/core/language/de/gallery_acp.php index be2008673..b283a559d 100644 --- a/core/language/de/gallery_acp.php +++ b/core/language/de/gallery_acp.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/de/gallery_mcp.php b/core/language/de/gallery_mcp.php index c46c9a3b5..123c1241e 100644 --- a/core/language/de/gallery_mcp.php +++ b/core/language/de/gallery_mcp.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/de/gallery_notifications.php b/core/language/de/gallery_notifications.php index 946cb5a50..8426a9bd8 100644 --- a/core/language/de/gallery_notifications.php +++ b/core/language/de/gallery_notifications.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/de/gallery_ucp.php b/core/language/de/gallery_ucp.php index d308a65cf..682846d55 100644 --- a/core/language/de/gallery_ucp.php +++ b/core/language/de/gallery_ucp.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/de/info_acp_gallery.php b/core/language/de/info_acp_gallery.php index d48be24d3..46d778386 100644 --- a/core/language/de/info_acp_gallery.php +++ b/core/language/de/info_acp_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/de/info_acp_gallery_logs.php b/core/language/de/info_acp_gallery_logs.php index 35114eecb..5f5a18bfa 100644 --- a/core/language/de/info_acp_gallery_logs.php +++ b/core/language/de/info_acp_gallery_logs.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/de/info_ucp_gallery.php b/core/language/de/info_ucp_gallery.php index 8fc429992..03c748435 100644 --- a/core/language/de/info_ucp_gallery.php +++ b/core/language/de/info_ucp_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/de/install_gallery.php b/core/language/de/install_gallery.php index 763b5e08e..7837bea71 100644 --- a/core/language/de/install_gallery.php +++ b/core/language/de/install_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( @@ -131,4 +131,9 @@ 'UPDATE_INSTALLATION_EXPLAIN' => 'Mit dieser Option kannst du deine phpBB Gallery-Version auf den neuesten Stand bringen.', 'VERSION_NOT_SUPPORTED' => 'Leider konnte das Update-Schema für Versionen < 1.0.6 nicht übernommen werden.', + + 'GALLERY_SUB_EXT_UNINSTALL' => array( + 1 => 'Sie müssen die Erweiterung deinstallieren:
%s
bevor Sie die Kern-Erweiterung deinstallieren können.', + 2 => 'Sie müssen die Erweiterungen deinstallieren:
%s
bevor Sie die Kern-Erweiterung deinstallieren können.', + ), )); diff --git a/core/language/de/permissions_gallery.php b/core/language/de/permissions_gallery.php index 29b582a5a..f5ff4d592 100644 --- a/core/language/de/permissions_gallery.php +++ b/core/language/de/permissions_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // Adding the permissions diff --git a/core/language/en/gallery.php b/core/language/en/gallery.php index 6e0deb422..4916d7415 100644 --- a/core/language/en/gallery.php +++ b/core/language/en/gallery.php @@ -19,7 +19,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/en/gallery_acp.php b/core/language/en/gallery_acp.php index 85da67457..761e2a24b 100644 --- a/core/language/en/gallery_acp.php +++ b/core/language/en/gallery_acp.php @@ -19,7 +19,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/en/gallery_mcp.php b/core/language/en/gallery_mcp.php index 282dd8fe3..f16efa2a3 100644 --- a/core/language/en/gallery_mcp.php +++ b/core/language/en/gallery_mcp.php @@ -19,7 +19,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/en/gallery_notifications.php b/core/language/en/gallery_notifications.php index 7d160c74a..84e5e5c72 100644 --- a/core/language/en/gallery_notifications.php +++ b/core/language/en/gallery_notifications.php @@ -19,7 +19,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/en/gallery_ucp.php b/core/language/en/gallery_ucp.php index ba29dc7a1..5be875054 100644 --- a/core/language/en/gallery_ucp.php +++ b/core/language/en/gallery_ucp.php @@ -19,7 +19,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/en/info_acp_gallery.php b/core/language/en/info_acp_gallery.php index b70626c8f..5ac437f2b 100644 --- a/core/language/en/info_acp_gallery.php +++ b/core/language/en/info_acp_gallery.php @@ -19,7 +19,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/en/info_acp_gallery_logs.php b/core/language/en/info_acp_gallery_logs.php index f77926ea2..1453c87d0 100644 --- a/core/language/en/info_acp_gallery_logs.php +++ b/core/language/en/info_acp_gallery_logs.php @@ -19,7 +19,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/en/info_ucp_gallery.php b/core/language/en/info_ucp_gallery.php index 3596892f8..3cdc5a0e5 100644 --- a/core/language/en/info_ucp_gallery.php +++ b/core/language/en/info_ucp_gallery.php @@ -19,7 +19,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/en/install_gallery.php b/core/language/en/install_gallery.php index 7d77f566b..38cf3cee6 100644 --- a/core/language/en/install_gallery.php +++ b/core/language/en/install_gallery.php @@ -19,7 +19,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( @@ -129,5 +129,10 @@ 'UPDATE_INSTALLATION_EXPLAIN' => 'Here you can Update your phpBB Gallery-Version.', - 'VERSION_NOT_SUPPORTED' => 'Sorry, but your updates prior to 1.0.6 are not supported from this install/update-system.', + 'VERSION_NOT_SUPPORTED' => 'Sorry, but your updates prior to 1.0.6 are not supported from this install/update-system.', + + 'GALLERY_SUB_EXT_UNINSTALL' => array( + 1 => 'You must uninstall the extension:
%s
before uninstalling the core extension.', + 2 => 'You must uninstall the extensions:
%s
before uninstalling the core extension.', + ), )); diff --git a/core/language/en/permissions_gallery.php b/core/language/en/permissions_gallery.php index d31fa0103..26e4e6b9e 100644 --- a/core/language/en/permissions_gallery.php +++ b/core/language/en/permissions_gallery.php @@ -19,7 +19,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // Adding the permissions diff --git a/core/language/es/gallery.php b/core/language/es/gallery.php index 9323694a2..b4833fb98 100644 --- a/core/language/es/gallery.php +++ b/core/language/es/gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/es/gallery_acp.php b/core/language/es/gallery_acp.php index 1eec8b54d..137a81fa2 100644 --- a/core/language/es/gallery_acp.php +++ b/core/language/es/gallery_acp.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/es/gallery_mcp.php b/core/language/es/gallery_mcp.php index 10e756f5a..7ac119894 100644 --- a/core/language/es/gallery_mcp.php +++ b/core/language/es/gallery_mcp.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/es/gallery_notifications.php b/core/language/es/gallery_notifications.php index 81b78a7c6..06a7695f0 100644 --- a/core/language/es/gallery_notifications.php +++ b/core/language/es/gallery_notifications.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/es/gallery_ucp.php b/core/language/es/gallery_ucp.php index 5e461d04b..65cc6e4a0 100644 --- a/core/language/es/gallery_ucp.php +++ b/core/language/es/gallery_ucp.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/es/info_acp_gallery.php b/core/language/es/info_acp_gallery.php index b81e0f479..565a632b1 100644 --- a/core/language/es/info_acp_gallery.php +++ b/core/language/es/info_acp_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/es/info_acp_gallery_logs.php b/core/language/es/info_acp_gallery_logs.php index 43c7675ff..c26e2969b 100644 --- a/core/language/es/info_acp_gallery_logs.php +++ b/core/language/es/info_acp_gallery_logs.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/es/info_ucp_gallery.php b/core/language/es/info_ucp_gallery.php index e349a4c4e..005fa3fc0 100644 --- a/core/language/es/info_ucp_gallery.php +++ b/core/language/es/info_ucp_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/es/install_gallery.php b/core/language/es/install_gallery.php index 6ff2e3bea..39e2daa8b 100644 --- a/core/language/es/install_gallery.php +++ b/core/language/es/install_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( @@ -131,4 +131,9 @@ 'UPDATE_INSTALLATION_EXPLAIN' => 'Aquí puedes actualizar tu versión de la galería de phpBB.', 'VERSION_NOT_SUPPORTED' => 'Lo sentimos, pero sus actualizaciones anteriores a 1.0.6 no son compatibles con este sistema de instalación / actualización.', + + 'GALLERY_SUB_EXT_UNINSTALL' => array( + 1 => 'Debe desinstalar la extensión:
%s
antes de desinstalar la extensión principal.', + 2 => 'Debe desinstalar las extensiones:
%s
antes de desinstalar la extensión principal.', + ), )); diff --git a/core/language/es/permissions_gallery.php b/core/language/es/permissions_gallery.php index 588240a94..b0ace511c 100644 --- a/core/language/es/permissions_gallery.php +++ b/core/language/es/permissions_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // Adding the permissions diff --git a/core/language/fr/gallery.php b/core/language/fr/gallery.php index 53b40f108..f105e233c 100644 --- a/core/language/fr/gallery.php +++ b/core/language/fr/gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE diff --git a/core/language/fr/gallery_acp.php b/core/language/fr/gallery_acp.php index 0a6a4ca3f..01caa79a0 100644 --- a/core/language/fr/gallery_acp.php +++ b/core/language/fr/gallery_acp.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE diff --git a/core/language/fr/gallery_mcp.php b/core/language/fr/gallery_mcp.php index f51049d5b..60a096446 100644 --- a/core/language/fr/gallery_mcp.php +++ b/core/language/fr/gallery_mcp.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE diff --git a/core/language/fr/gallery_notifications.php b/core/language/fr/gallery_notifications.php index 47514c603..7d2d7fc2b 100644 --- a/core/language/fr/gallery_notifications.php +++ b/core/language/fr/gallery_notifications.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE diff --git a/core/language/fr/gallery_ucp.php b/core/language/fr/gallery_ucp.php index 43e59ec43..c337f084d 100644 --- a/core/language/fr/gallery_ucp.php +++ b/core/language/fr/gallery_ucp.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE diff --git a/core/language/fr/info_acp_gallery.php b/core/language/fr/info_acp_gallery.php index 85323df1d..c033c63fb 100644 --- a/core/language/fr/info_acp_gallery.php +++ b/core/language/fr/info_acp_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE diff --git a/core/language/fr/info_acp_gallery_logs.php b/core/language/fr/info_acp_gallery_logs.php index 650d1ea34..d3c6871c4 100644 --- a/core/language/fr/info_acp_gallery_logs.php +++ b/core/language/fr/info_acp_gallery_logs.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE diff --git a/core/language/fr/info_ucp_gallery.php b/core/language/fr/info_ucp_gallery.php index 16c0fef4f..b076d57be 100644 --- a/core/language/fr/info_ucp_gallery.php +++ b/core/language/fr/info_ucp_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE diff --git a/core/language/fr/install_gallery.php b/core/language/fr/install_gallery.php index d4f4e22fc..9f076d477 100644 --- a/core/language/fr/install_gallery.php +++ b/core/language/fr/install_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -146,5 +146,10 @@ 'UPDATE_INSTALLATION_EXPLAIN' => 'Ici, vous pouvez mettre à jour la Galerie phpBB.', - 'VERSION_NOT_SUPPORTED' => 'Désolé, mais les mises à jour inférieures à la version 1.0.6 ne sont pas supportées par cette version d’installation.', + 'VERSION_NOT_SUPPORTED' => 'Désolé, mais les mises à jour inférieures à la version 1.0.6 ne sont pas supportées par cette version d’installation.', + + 'GALLERY_SUB_EXT_UNINSTALL' => array( + 1 => 'Vous devez désinstaller l’extension:
%s
avant de désinstaller l’extension principale.', + 2 => 'Vous devez désinstaller les extensions:
%s
avant de désinstaller l’extension principale.', + ), )); diff --git a/core/language/fr/permissions_gallery.php b/core/language/fr/permissions_gallery.php index 46bf8dd4b..c28ce6626 100644 --- a/core/language/fr/permissions_gallery.php +++ b/core/language/fr/permissions_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE diff --git a/core/language/it/gallery.php b/core/language/it/gallery.php index deb5f95c1..96594508e 100644 --- a/core/language/it/gallery.php +++ b/core/language/it/gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/it/gallery_acp.php b/core/language/it/gallery_acp.php index 07a41838d..bf3456664 100644 --- a/core/language/it/gallery_acp.php +++ b/core/language/it/gallery_acp.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/it/gallery_mcp.php b/core/language/it/gallery_mcp.php index 9634c44ee..04679c2f5 100644 --- a/core/language/it/gallery_mcp.php +++ b/core/language/it/gallery_mcp.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/it/gallery_notifications.php b/core/language/it/gallery_notifications.php index 259f8bd32..b0880d11b 100644 --- a/core/language/it/gallery_notifications.php +++ b/core/language/it/gallery_notifications.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/it/gallery_ucp.php b/core/language/it/gallery_ucp.php index 2a1b530de..41c94335e 100644 --- a/core/language/it/gallery_ucp.php +++ b/core/language/it/gallery_ucp.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/it/info_acp_gallery.php b/core/language/it/info_acp_gallery.php index 647f27d08..513115f43 100644 --- a/core/language/it/info_acp_gallery.php +++ b/core/language/it/info_acp_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/it/info_acp_gallery_logs.php b/core/language/it/info_acp_gallery_logs.php index edf03c83c..28d6cf303 100644 --- a/core/language/it/info_acp_gallery_logs.php +++ b/core/language/it/info_acp_gallery_logs.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/it/info_ucp_gallery.php b/core/language/it/info_ucp_gallery.php index c82c24414..bff0b3f31 100644 --- a/core/language/it/info_ucp_gallery.php +++ b/core/language/it/info_ucp_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/it/install_gallery.php b/core/language/it/install_gallery.php index 2c94bb169..7b30172fd 100644 --- a/core/language/it/install_gallery.php +++ b/core/language/it/install_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( @@ -130,5 +130,10 @@ 'UPDATE_INSTALLATION_EXPLAIN' => 'Puoi aggiornare la tua versione di phpBB Gallery.', - 'VERSION_NOT_SUPPORTED' => 'Spiacente, ma gli aggiornamenti dalle versioni inferiori a < 0.2.0 non sono supportate con questo processo di installazione.', + 'VERSION_NOT_SUPPORTED' => 'Spiacente, ma gli aggiornamenti dalle versioni inferiori a < 0.2.0 non sono supportate con questo processo di installazione.', + + 'GALLERY_SUB_EXT_UNINSTALL' => array( + 1 => 'È necessario disinstallare l’estensione:
%s
prima di disinstallare l’estensione principale.', + 2 => 'È necessario disinstallare le estensioni:
%s
prima di disinstallare l’estensione principale.', + ), )); diff --git a/core/language/it/permissions_gallery.php b/core/language/it/permissions_gallery.php index 185d6e593..187cceca0 100644 --- a/core/language/it/permissions_gallery.php +++ b/core/language/it/permissions_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // Adding the permissions diff --git a/core/language/nl/gallery.php b/core/language/nl/gallery.php index 67adccb6d..ea347b81e 100644 --- a/core/language/nl/gallery.php +++ b/core/language/nl/gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/nl/gallery_acp.php b/core/language/nl/gallery_acp.php index 315592143..7b5e37ae1 100644 --- a/core/language/nl/gallery_acp.php +++ b/core/language/nl/gallery_acp.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/nl/gallery_mcp.php b/core/language/nl/gallery_mcp.php index c8a97694d..cc57ac583 100644 --- a/core/language/nl/gallery_mcp.php +++ b/core/language/nl/gallery_mcp.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/nl/gallery_notifications.php b/core/language/nl/gallery_notifications.php index f5b96cefa..83a60897c 100644 --- a/core/language/nl/gallery_notifications.php +++ b/core/language/nl/gallery_notifications.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/nl/gallery_ucp.php b/core/language/nl/gallery_ucp.php index ed0488e7f..3b9782f9d 100644 --- a/core/language/nl/gallery_ucp.php +++ b/core/language/nl/gallery_ucp.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/nl/info_acp_gallery.php b/core/language/nl/info_acp_gallery.php index e2ae1cc02..6debd1b21 100644 --- a/core/language/nl/info_acp_gallery.php +++ b/core/language/nl/info_acp_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/nl/info_acp_gallery_logs.php b/core/language/nl/info_acp_gallery_logs.php index cb582cf18..6f3c47404 100644 --- a/core/language/nl/info_acp_gallery_logs.php +++ b/core/language/nl/info_acp_gallery_logs.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/nl/info_ucp_gallery.php b/core/language/nl/info_ucp_gallery.php index 45ad9c5c9..e1a0e1a4f 100644 --- a/core/language/nl/info_ucp_gallery.php +++ b/core/language/nl/info_ucp_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/nl/install_gallery.php b/core/language/nl/install_gallery.php index d68d0a796..ddf514a34 100644 --- a/core/language/nl/install_gallery.php +++ b/core/language/nl/install_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( @@ -130,5 +130,10 @@ 'UPDATE_INSTALLATION_EXPLAIN' => 'Hier kan je de phpBB galerij updaten.', - 'VERSION_NOT_SUPPORTED' => 'Sorry, maar updates van voor versie 1.0.6 worden door deze installatie niet ondersteund.', + 'VERSION_NOT_SUPPORTED' => 'Sorry, maar updates van voor versie 1.0.6 worden door deze installatie niet ondersteund.', + + 'GALLERY_SUB_EXT_UNINSTALL' => array( + 1 => 'U moet de extensie:
%s
verwijderen voordat u de kern-extensie verwijdert.', + 2 => 'U moet de extensies:
%s
verwijderen voordat u de kern-extensie verwijdert.', + ), )); diff --git a/core/language/nl/permissions_gallery.php b/core/language/nl/permissions_gallery.php index dbd339c60..cfa5e5f8e 100644 --- a/core/language/nl/permissions_gallery.php +++ b/core/language/nl/permissions_gallery.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // Adding the permissions diff --git a/core/language/ru/gallery.php b/core/language/ru/gallery.php index 2c3d62e8f..d07c74b67 100644 --- a/core/language/ru/gallery.php +++ b/core/language/ru/gallery.php @@ -19,7 +19,7 @@ } if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( 'ADD_UPLOAD_FIELD' => 'Добавить несколько файлов', diff --git a/core/language/ru/gallery_acp.php b/core/language/ru/gallery_acp.php index 9208b8361..656ece49e 100644 --- a/core/language/ru/gallery_acp.php +++ b/core/language/ru/gallery_acp.php @@ -20,7 +20,7 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( diff --git a/core/language/ru/gallery_mcp.php b/core/language/ru/gallery_mcp.php index c6a3cf3bc..f4052aa16 100644 --- a/core/language/ru/gallery_mcp.php +++ b/core/language/ru/gallery_mcp.php @@ -19,7 +19,7 @@ } if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( 'CHOOSE_ACTION' => 'Выберите желаемое действие', diff --git a/core/language/ru/gallery_notifications.php b/core/language/ru/gallery_notifications.php index 53c27d60c..66e1f4226 100644 --- a/core/language/ru/gallery_notifications.php +++ b/core/language/ru/gallery_notifications.php @@ -19,7 +19,7 @@ } if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( 'NOTIFICATION_PHPBBGALLERY_IMAGE_FOR_APPROVAL' => '%2$s фото загружено для утверждения в альбоме %1$s', diff --git a/core/language/ru/gallery_ucp.php b/core/language/ru/gallery_ucp.php index 72ab8b45e..68562ebfb 100644 --- a/core/language/ru/gallery_ucp.php +++ b/core/language/ru/gallery_ucp.php @@ -19,7 +19,7 @@ } if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( 'ACCESS_CONTROL_ALL' => 'Все', diff --git a/core/language/ru/info_acp_gallery.php b/core/language/ru/info_acp_gallery.php index 7eb788cd2..941b708c7 100644 --- a/core/language/ru/info_acp_gallery.php +++ b/core/language/ru/info_acp_gallery.php @@ -19,7 +19,7 @@ } if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( 'ACP_GALLERY_ALBUM_MANAGEMENT' => 'Управление альбомом', diff --git a/core/language/ru/info_acp_gallery_logs.php b/core/language/ru/info_acp_gallery_logs.php index d30d30852..f7429aa74 100644 --- a/core/language/ru/info_acp_gallery_logs.php +++ b/core/language/ru/info_acp_gallery_logs.php @@ -19,7 +19,7 @@ } if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( 'ACP_LOG_GALLERY_MOD' => 'Логи модератора', diff --git a/core/language/ru/info_ucp_gallery.php b/core/language/ru/info_ucp_gallery.php index 609cff3f2..02b016fbd 100644 --- a/core/language/ru/info_ucp_gallery.php +++ b/core/language/ru/info_ucp_gallery.php @@ -19,7 +19,7 @@ } if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( 'UCP_GALLERY' => 'Галерея', diff --git a/core/language/ru/install_gallery.php b/core/language/ru/install_gallery.php index 8cefaa846..f92b2e16f 100644 --- a/core/language/ru/install_gallery.php +++ b/core/language/ru/install_gallery.php @@ -19,7 +19,7 @@ } if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } $lang = array_merge($lang, array( 'BBCODES_NEEDS_REPARSE' => 'BBCode нуждается в переобработке.', @@ -109,6 +109,13 @@ 'UNINSTALL_START' => 'Удаление', 'UNINSTALL_FINISHED' => 'Удаление почти закончено', 'UNINSTALL_FINISHED_EXPLAIN' => 'Вы успешно удалили phpBB Gallery.

Теперь вам осталось откатить изменения в файлах конференции, описанные в install.xml, и удалить файлы галереи. После этого ваша конференция будет полностью очищена от галереи.', + 'UPDATE_INSTALLATION_EXPLAIN' => 'Обновление phpBB Gallery.', - 'VERSION_NOT_SUPPORTED' => 'Извините, но обновление галереи с версий < 1.0.6 не поддерживаются данной версией инсталятора.', + + 'VERSION_NOT_SUPPORTED' => 'Извините, но обновление галереи с версий < 1.0.6 не поддерживаются данной версией инсталятора.', + + 'GALLERY_SUB_EXT_UNINSTALL' => array( + 1 => 'Вы должны удалить расширение:
%s
перед удалением основного расширения.', + 2 => 'Вы должны удалить расширения:
%s
перед удалением основного расширения.', + ), )); diff --git a/core/language/ru/permissions_gallery.php b/core/language/ru/permissions_gallery.php index ed00064f5..9f9424fe3 100644 --- a/core/language/ru/permissions_gallery.php +++ b/core/language/ru/permissions_gallery.php @@ -19,7 +19,7 @@ } if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // Adding the permissions $lang = array_merge($lang, array( diff --git a/core/migrations/release_1_2_0.php b/core/migrations/release_1_2_0.php index 1f856ef31..0d0f6e50b 100644 --- a/core/migrations/release_1_2_0.php +++ b/core/migrations/release_1_2_0.php @@ -12,12 +12,15 @@ namespace phpbbgallery\core\migrations; -class release_1_2_0 extends \phpbb\db\migration\migration +use phpbb\db\migration\migration; + +class release_1_2_0 extends migration { static public function depends_on() { return array('\phpbb\db\migration\data\v310\gold'); } + public function update_data() { return array( @@ -63,13 +66,6 @@ public function update_data() 'module_mode' => 'main', 'module_auth' => 'ext_phpbbgallery/core && acl_a_viewlogs', ))), - // Todo CLEANUP Add-on - /*array('module.add', array('acp', 'PHPBB_GALLERY', array( - 'module_basename' => '\phpbbgallery\core\acp\gallery_module', - 'module_langname' => 'ACP_GALLERY_CLEANUP', - 'module_mode' => 'cleanup', - 'module_auth' => 'ext_phpbbgallery/core && acl_a_gallery_cleanup', - ))),*/ // UCP array('module.add', array('ucp', '', 'UCP_GALLERY')), @@ -92,26 +88,32 @@ public function update_data() 'module_auth' => 'ext_phpbbgallery/core', ))), //@todo move -/* array('module.add', array('ucp', 'UCP_GALLERY', array( - 'module_basename' => '\phpbbgallery\core\ucp\main_module', - 'module_langname' => 'UCP_GALLERY_FAVORITES', - 'module_mode' => 'manage_favorites', - 'module_auth' => 'ext_phpbbgallery/core', - ))), - - // Logs - array('module.add', array('acp', 'ACP_FORUM_LOGS', array( - 'module_basename' => '\phpbbgallery\core\acp\gallery_logs_module', - 'module_langname' => 'ACP_GALLERY_LOGS', - 'module_mode' => 'main', - 'module_auth' => 'ext_phpbbgallery/core && acl_a_viewlogs', - ))),*/ + /* array('module.add', array('ucp', 'UCP_GALLERY', array( + 'module_basename' => '\phpbbgallery\core\ucp\main_module', + 'module_langname' => 'UCP_GALLERY_FAVORITES', + 'module_mode' => 'manage_favorites', + 'module_auth' => 'ext_phpbbgallery/core', + ))), + */ // @todo: ADD BBCODE array('custom', array(array(&$this, 'install_config'))), ); } + public function revert_data() + { + return array( + // Remove permissions added + array('permission.remove', array('a_gallery_manage')), + array('permission.remove', array('a_gallery_albums')), + array('permission.remove', array('a_gallery_cleanup')), + + // Remove config keys you installed + array('custom', array(array($this, 'uninstall_config'))), + ); + } + public function install_config() { global $config; @@ -131,6 +133,18 @@ public function install_config() return true; } + public function uninstall_config() + { + global $config; + + foreach (self::$configs as $name => $value) + { + $config->delete('phpbb_gallery_' . $name); + } + + return true; + } + static public $is_dynamic = array( 'mvc_time', 'mvc_version', @@ -150,6 +164,7 @@ public function install_config() 'allow_hotlinking' => true, 'allow_jpg' => true, 'allow_png' => true, + 'allow_webp' => true, 'allow_rates' => true, 'allow_resize' => true, 'allow_rotate' => true, @@ -173,11 +188,14 @@ public function install_config() 'disp_statistic' => true, 'disp_total_images' => true, 'disp_whoisonline' => true, + 'disp_gallery_icon' => true, 'gdlib_version' => 2, 'hotlinking_domains' => 'anavaro.com', + 'items_per_page' => 15, + 'jpg_quality' => 100, 'link_thumbnail' => 'image_page', @@ -217,13 +235,14 @@ public function install_config() 'prune_orphan_time' => 0, 'rrc_gindex_comments' => false, + //'rrc_gindex_contests' => 1, 'rrc_gindex_display' => 173, 'rrc_gindex_mode' => 7, 'rrc_gindex_pegas' => true, 'rrc_profile_display' => 141, + 'rrc_profile_items' => 4, 'rrc_profile_mode' => 3, //'rrc_profile_pegas' => true, - 'rrc_profile_items' => 4, 'search_display' => 45, @@ -243,9 +262,6 @@ public function install_config() 'watermark_source' => 'ext/phpbbgallery/core/images/watermark.png', 'watermark_width' => 200, - 'items_per_page' => 15, - - //Version 'version' => '1.2.0', ); } diff --git a/core/migrations/release_1_2_0_add_bbcode.php b/core/migrations/release_1_2_0_add_bbcode.php index 9d024583d..4b65b4e56 100644 --- a/core/migrations/release_1_2_0_add_bbcode.php +++ b/core/migrations/release_1_2_0_add_bbcode.php @@ -12,7 +12,9 @@ namespace phpbbgallery\core\migrations; -class release_1_2_0_add_bbcode extends \phpbb\db\migration\migration +use phpbb\db\migration\migration; + +class release_1_2_0_add_bbcode extends migration { static public function depends_on() { diff --git a/core/migrations/release_1_2_0_create_filesystem.php b/core/migrations/release_1_2_0_create_filesystem.php index 301925aab..23c5a9b20 100644 --- a/core/migrations/release_1_2_0_create_filesystem.php +++ b/core/migrations/release_1_2_0_create_filesystem.php @@ -11,7 +11,9 @@ namespace phpbbgallery\core\migrations; -class release_1_2_0_create_filesystem extends \phpbb\db\migration\migration +use phpbb\db\migration\migration; + +class release_1_2_0_create_filesystem extends migration { static public function depends_on() { @@ -41,7 +43,6 @@ public function create_file_system() $phpbbgallery_core_file_medium = $phpbb_root_path . 'files/phpbbgallery/core/medium'; $phpbbgallery_core_file_mini = $phpbb_root_path . 'files/phpbbgallery/core/mini'; $phpbbgallery_core_file_source = $phpbb_root_path . 'files/phpbbgallery/core/source'; - $phpbbgallery_import_file = $phpbb_root_path . 'files/phpbbgallery/import'; if (is_writable($phpbb_root_path . 'files')) { @@ -49,7 +50,6 @@ public function create_file_system() @mkdir($phpbbgallery_core_file_medium, 0755, true); @mkdir($phpbbgallery_core_file_mini, 0755, true); @mkdir($phpbbgallery_core_file_source, 0755, true); - @mkdir($phpbbgallery_import_file, 0755, true); } } @@ -61,17 +61,12 @@ public function remove_file_system() $phpbbgallery_core_file_medium = $phpbb_root_path . 'files/phpbbgallery/core/medium'; $phpbbgallery_core_file_mini = $phpbb_root_path . 'files/phpbbgallery/core/mini'; $phpbbgallery_core_file_source = $phpbb_root_path . 'files/phpbbgallery/core/source'; - $phpbbgallery_import_file = $phpbb_root_path . 'files/phpbbgallery/import'; // Clean dirs $this->recursiveRemoveDirectory($phpbbgallery_core_file_mini); $this->recursiveRemoveDirectory($phpbbgallery_core_file_medium); $this->recursiveRemoveDirectory($phpbbgallery_core_file_source); $this->recursiveRemoveDirectory($phpbbgallery_core_file); - if (file_exists($phpbbgallery_import_file)) - { - $this->recursiveRemoveDirectory($phpbbgallery_import_file); - } $this->recursiveRemoveDirectory($phpbb_root_path . 'files/phpbbgallery'); } @@ -84,6 +79,7 @@ public function copy_images() copy($phpbbgallery_core_images_source . '/upload/no_hotlinking.jpg', $phpbbgallery_core_file_source . '/no_hotlinking.jpg'); copy($phpbbgallery_core_images_source . '/upload/not_authorised.jpg', $phpbbgallery_core_file_source . '/not_authorised.jpg'); } + function recursiveRemoveDirectory($directory) { foreach (glob("{$directory}/*") as $file) diff --git a/core/migrations/release_1_2_0_db_create.php b/core/migrations/release_1_2_0_db_create.php index 12cb105fb..2a2a829d7 100644 --- a/core/migrations/release_1_2_0_db_create.php +++ b/core/migrations/release_1_2_0_db_create.php @@ -12,7 +12,9 @@ namespace phpbbgallery\core\migrations; -class release_1_2_0_db_create extends \phpbb\db\migration\migration +use phpbb\db\migration\migration; + +class release_1_2_0_db_create extends migration { static public function depends_on() { diff --git a/core/migrations/release_3_2_1_0.php b/core/migrations/release_3_2_1_0.php index 58a86108b..a900ee007 100644 --- a/core/migrations/release_3_2_1_0.php +++ b/core/migrations/release_3_2_1_0.php @@ -11,7 +11,9 @@ namespace phpbbgallery\core\migrations; -class release_3_2_1_0 extends \phpbb\db\migration\profilefield_base_migration +use phpbb\db\migration\profilefield_base_migration; + +class release_3_2_1_0 extends profilefield_base_migration { static public function depends_on() { diff --git a/core/migrations/release_3_2_1_1.php b/core/migrations/release_3_2_1_1.php index e177d0759..b919b179b 100644 --- a/core/migrations/release_3_2_1_1.php +++ b/core/migrations/release_3_2_1_1.php @@ -11,18 +11,20 @@ namespace phpbbgallery\core\migrations; -class release_3_2_1_1 extends \phpbb\db\migration\migration +use phpbb\db\migration\migration; + +class release_3_2_1_1 extends migration { static public function depends_on() { - return array('\phpbbgallery\core\migrations\release_1_2_0_db_create'); + return ['\phpbbgallery\core\migrations\release_1_2_0_db_create']; } public function update_data() { - return array( - array('config.update', array('phpbb_gallery_version', '3.2.2')) - ); + return [ + ['config.update', ['phpbb_gallery_version', '3.2.2']] + ]; } public function update_schema() diff --git a/core/migrations/release_3_3_0.php b/core/migrations/release_3_3_0.php index f80871449..5ba437bef 100644 --- a/core/migrations/release_3_3_0.php +++ b/core/migrations/release_3_3_0.php @@ -11,18 +11,20 @@ namespace phpbbgallery\core\migrations; -class release_3_3_0 extends \phpbb\db\migration\migration +use phpbb\db\migration\migration; + +class release_3_3_0 extends migration { static public function depends_on() { - return array('\phpbbgallery\core\migrations\release_1_2_0_db_create'); + return ['\phpbbgallery\core\migrations\release_1_2_0_db_create']; } public function update_data() { - return array( - array('config.update', array('phpbb_gallery_version', '3.3.0')) - ); + return [ + ['config.update', ['phpbb_gallery_version', '3.3.0']] + ]; } } diff --git a/core/migrations/release_3_4_0.php b/core/migrations/release_3_4_0.php new file mode 100644 index 000000000..2d650b80a --- /dev/null +++ b/core/migrations/release_3_4_0.php @@ -0,0 +1,29 @@ + - + diff --git a/core/styles/prosilver/template/gallery/viewimage_body.html b/core/styles/prosilver/template/gallery/viewimage_body.html index 1c66e91f0..8a8331a9e 100644 --- a/core/styles/prosilver/template/gallery/viewimage_body.html +++ b/core/styles/prosilver/template/gallery/viewimage_body.html @@ -70,9 +70,8 @@

{L_IMAGE_DESC}

{L_IMAGES}{L_COLON} {POSTER_GALLERY_IMAGES}{POSTER_GALLERY_IMAGES}
{L_JOINED}{L_COLON} {POSTER_JOINED}
{L_WARNINGS}{L_COLON} {POSTER_WARNINGS}
- -
{L_IP}{L_COLON} {POSTER_IP}
- +
{L_IP}{L_COLON} {POSTER_IP}
+
{PROFILE_FIELD1_NAME}{L_COLON} {PROFILE_FIELD1_VALUE}
@@ -241,7 +240,7 @@

{L_IMAGE_NAME}{L_COLON} - {commentrow.POSTER_AVATAR}{commentrow.POSTER_AVATAR} + {commentrow.POSTER_AVATAR}{commentrow.POSTER_AVATAR} @@ -258,7 +257,7 @@

{L_IMAGE_NAME}{L_COLON}
{L_IMAGES}{L_COLON} {POSTER_GALLERY_IMAGES}{POSTER_GALLERY_IMAGES}
{L_JOINED}{L_COLON} {commentrow.POSTER_JOINED}
{L_WARNINGS}{L_COLON} {commentrow.POSTER_WARNINGS}
-
{L_IP}{L_COLON} {commentrow.POSTER_IP}
+
{L_IP}{L_COLON} {commentrow.POSTER_IP}
@@ -267,12 +266,11 @@

{L_IMAGE_NAME}{L_COLON} -
{commentrow.custom_fields.PROFILE_FIELD_NAME}{L_COLON} {commentrow.custom_fields.PROFILE_FIELD_VALUE}
+
{commentrow.custom_fields.PROFILE_FIELD_NAME}{L_COLON} {commentrow.custom_fields.PROFILE_FIELD_VALUE}
-
{L_CONTACT}{L_COLON} @@ -304,12 +302,12 @@

{L_IMAGE_NAME}{L_COLON}
- +
diff --git a/core/upload.php b/core/upload.php index e6969118c..db1733d0b 100644 --- a/core/upload.php +++ b/core/upload.php @@ -202,7 +202,7 @@ public function upload_file($file_count) $this->file_count = (int) $file_count; //$this->files = $this->form_upload('files'); - $files = $this->file_upload->handle_upload('phpbbgallery.core.files.type.multiform', 'files'); + $files = $this->file_upload->handle_upload('phpbbgallery.core.files.types.multiform', 'files'); foreach ($files as $var) { @@ -613,7 +613,7 @@ private function get_current_upload_dir() return 0; } - // This code is never invoced. It's left here for future implementation. + // This code is never invoked. It's left here for future implementation. $this->gallery_config->inc('current_upload_dir_size', 1); if ($this->gallery_config->get('current_upload_dir_size') >= self::NUM_FILES_PER_DIR) { @@ -804,7 +804,7 @@ public function get_allowed_types($get_types = false, $ignore_zip = false) } /** - * Generate some kind of check so users only complete the uplaod for their images + * Generate some kind of check so users only complete the upload for their images */ public function generate_hidden_fields() { diff --git a/exif/composer.json b/exif/composer.json index cb635e4b5..56ccf185b 100644 --- a/exif/composer.json +++ b/exif/composer.json @@ -26,12 +26,12 @@ } ], "require": { - "php": ">=5.3" + "php": ">=7.1" }, "extra": { "display-name": "phpBB Gallery Add-on: Exif", "soft-require": { - "phpbb/phpbb": ">=3.1.0-RC2,<3.3.0@dev" + "phpbb/phpbb": ">=3.2.0,<4.0.0@dev" } }, "version-check": { diff --git a/exif/event/exif_listener.php b/exif/event/exif_listener.php index 17d3b1cf2..531626550 100644 --- a/exif/event/exif_listener.php +++ b/exif/event/exif_listener.php @@ -81,7 +81,7 @@ public function acp_config_get_display_vars($event) $return_ary = $event['return_ary']; if (isset($return_ary['vars']['IMAGE_SETTINGS'])) { - $this->user->add_lang_ext('phpbbgallery/exif', 'exif'); + $this->user->add_lang_ext('phpbbgallery/exif', 'info_exif'); $return_ary['vars']['IMAGE_SETTINGS']['disp_exifdata'] = array('lang' => 'DISP_EXIF_DATA', 'validate' => 'bool', 'type' => 'radio:yes_no'); $event['return_ary'] = $return_ary; @@ -144,7 +144,7 @@ public function posting_edit_before_rotate($event) public function ucp_set_settings_nosubmit() { global $template, $phpbb_ext_gallery; - $this->user->add_lang_ext('phpbbgallery/exif', 'exif'); + $this->user->add_lang_ext('phpbbgallery/exif', 'info_exif'); $template->assign_vars(array( 'S_VIEWEXIFS' => $this->gallery_user->get_data('user_viewexif'), @@ -236,7 +236,7 @@ public function user_validate_data($event) public function viewimage($event) { - $this->user->add_lang_ext('phpbbgallery/exif', 'exif'); + $this->user->add_lang_ext('phpbbgallery/exif', 'info_exif'); // To do (test contests) if ($this->gallery_config->get('disp_exifdata') && ($event['image_data']['image_has_exif'] != \phpbbgallery\exif\exif::UNAVAILABLE) && (substr($event['image_data']['image_filename'], -4) == '.jpg') && function_exists('exif_read_data') /*&& ($this->gallery_auth->acl_check('m_status', $event['image_data']['image_album_id'], $event['album_data']['album_user_id']) || ($event['image_data']['image_contest'] != phpbb_ext_gallery_core_image::IN_CONTEST))*/) diff --git a/exif/exif.php b/exif/exif.php index ff9fabaaa..0b624a940 100644 --- a/exif/exif.php +++ b/exif/exif.php @@ -174,7 +174,7 @@ private function prepare_data() { global $user; - $user->add_lang_ext('phpbbgallery/exif', 'exif'); + $user->add_lang_ext('phpbbgallery/exif', 'info_exif'); $this->prepared_data = array(); if (isset($this->data["EXIF"]["DateTimeOriginal"])) diff --git a/exif/ext.php b/exif/ext.php index 5ad09884f..2f26475b2 100644 --- a/exif/ext.php +++ b/exif/ext.php @@ -8,12 +8,59 @@ * @license GPL-2.0-only */ -// this file is not really needed, when empty it can be omitted -// however you can override the default methods and add custom -// installation logic - namespace phpbbgallery\exif; class ext extends \phpbb\extension\base { + /** + * Check whether or not the extension can be enabled. + * Checks dependencies and requirements. + * + * @return bool + */ + public function is_enableable() + { + $manager = $this->container->get('ext.manager'); + $user = $this->container->get('user'); + + $core_ext = 'phpbbgallery/core'; + + // Check if core is installed (enabled or disabled) + $is_enabled = $manager->is_enabled($core_ext); + $is_disabled = $manager->is_disabled($core_ext); + + if (!$is_enabled && !$is_disabled) + { + // Core not installed at all + $user->add_lang_ext('phpbbgallery/exif', 'info_exif'); + trigger_error($user->lang('GALLERY_CORE_NOT_FOUND'), E_USER_WARNING); + return false; + } + + if ($is_disabled) + { + // Core installed but disabled — enable it automatically + $manager->enable($core_ext); + } + + // If here, core is either enabled or just enabled now + return true; + } + + /** + * Perform additional tasks on extension enable + * + * @param mixed $old_state State returned by previous call of this method + * @return mixed Returns false after last step, otherwise temporary state + */ + public function enable_step($old_state) + { + if (empty($old_state)) + { + $this->container->get('user')->add_lang_ext('phpbbgallery/exif', 'info_exif'); + $this->container->get('template')->assign_var('L_EXTENSION_ENABLE_SUCCESS', $this->container->get('user')->lang['EXTENSION_ENABLE_SUCCESS']); + } + + return parent::enable_step($old_state); + } } diff --git a/exif/language/en/exif.php b/exif/language/bg/info_exif.php similarity index 93% rename from exif/language/en/exif.php rename to exif/language/bg/info_exif.php index 364efe772..0513c11ba 100644 --- a/exif/language/en/exif.php +++ b/exif/language/bg/info_exif.php @@ -22,13 +22,13 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } /** * Language for Exif data */ -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'EXIF_DATA' => 'Exif Data', 'EXIF_APERTURE' => 'F-number', 'EXIF_CAM_MODEL' => 'Camera-model', @@ -96,4 +96,7 @@ 'DISP_EXIF_DATA_EXP' => 'This feature can not be used at the moment, as the need function “exif_read_data“ is not included in your PHP Installation.', 'SHOW_EXIF' => 'show/hide', 'VIEWEXIFS_DEFAULT' => 'View Exif-Data by default', -)); + + 'GALLERY_CORE_NOT_FOUND' => 'Първо трябва да бъде инсталирано и активирано разширението phpBB Gallery Core.', + 'EXTENSION_ENABLE_SUCCESS' => 'Разширението е активирано успешно.', +]); diff --git a/exif/language/de/exif.php b/exif/language/de/info_exif.php similarity index 95% rename from exif/language/de/exif.php rename to exif/language/de/info_exif.php index a3f4b07df..3963fad2e 100644 --- a/exif/language/de/exif.php +++ b/exif/language/de/info_exif.php @@ -22,13 +22,13 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } /** * Language for Exif data */ -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'EXIF_DATA' => 'EXIF-Daten', 'EXIF_APERTURE' => 'Blende', 'EXIF_CAM_MODEL' => 'Kamera-Modell', @@ -96,4 +96,7 @@ 'DISP_EXIF_DATA_EXP' => 'Diese Funktion kann im Moment nicht verwendet werden, da die Funktion “exif_read_data“ nicht in Deiner PHP-Installation enthalten ist.', 'SHOW_EXIF' => 'ein-/ausblenden', 'VIEWEXIFS_DEFAULT' => 'Ansicht Exif-Daten standardmäßig', -)); + + 'GALLERY_CORE_NOT_FOUND' => 'Die phpBB Gallery Core-Erweiterung muss zuerst installiert und aktiviert werden.', + 'EXTENSION_ENABLE_SUCCESS' => 'Die Erweiterung wurde erfolgreich aktiviert.', +]); diff --git a/exif/language/bg/exif.php b/exif/language/en/info_exif.php similarity index 95% rename from exif/language/bg/exif.php rename to exif/language/en/info_exif.php index 415a0fcd9..6a371a7e1 100644 --- a/exif/language/bg/exif.php +++ b/exif/language/en/info_exif.php @@ -21,13 +21,13 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } /** * Language for Exif data */ -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'EXIF_DATA' => 'Exif Data', 'EXIF_APERTURE' => 'F-number', 'EXIF_CAM_MODEL' => 'Camera-model', @@ -95,4 +95,7 @@ 'DISP_EXIF_DATA_EXP' => 'This feature can not be used at the moment, as the need function “exif_read_data“ is not included in your PHP Installation.', 'SHOW_EXIF' => 'show/hide', 'VIEWEXIFS_DEFAULT' => 'View Exif-Data by default', -)); + + 'GALLERY_CORE_NOT_FOUND' => 'phpBB Gallery Core extension must be installed and enabled first.', + 'EXTENSION_ENABLE_SUCCESS' => 'The extension has been enabled successfully.', +]); diff --git a/exif/language/fr/exif.php b/exif/language/fr/info_exif.php similarity index 95% rename from exif/language/fr/exif.php rename to exif/language/fr/info_exif.php index 2ce64e9b2..32773855a 100644 --- a/exif/language/fr/exif.php +++ b/exif/language/fr/info_exif.php @@ -22,13 +22,13 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } /** * Language for Exif data */ -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'EXIF_DATA' => 'Informations des images', 'EXIF_APERTURE' => 'Nombre-F', 'EXIF_CAM_MODEL' => 'Modèle d’appareil photo', @@ -96,4 +96,7 @@ 'DISP_EXIF_DATA_EXP' => 'Cette fonctionnalité ne peut pas être utilisée pour le moment, car la fonction « exif_read_data » n’est pas incluse dans l’installation de votre PHP.', 'SHOW_EXIF' => 'Afficher/Cacher', 'VIEWEXIFS_DEFAULT' => 'Voir les informations des images par défaut', -)); + + 'GALLERY_CORE_NOT_FOUND' => 'L’extension phpBB Gallery Core doit d’abord être installée et activée.', + 'EXTENSION_ENABLE_SUCCESS' => 'L’extension a été activée avec succès.', +]); diff --git a/exif/language/it/exif.php b/exif/language/it/info_exif.php similarity index 95% rename from exif/language/it/exif.php rename to exif/language/it/info_exif.php index e6ec68b82..7c12ddaf9 100644 --- a/exif/language/it/exif.php +++ b/exif/language/it/info_exif.php @@ -22,13 +22,13 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } /** * Language for Exif data */ -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'EXIF_DATA' => 'Dati Exif', 'EXIF_APERTURE' => 'F-number', 'EXIF_CAM_MODEL' => 'Modello Camera', @@ -96,4 +96,7 @@ 'DISP_EXIF_DATA_EXP' => 'Questa caratteristica non puo\' essere utilizzatal momento, dato che la funzione “exif_read_data“ non e\' inclusa nella tua installazione di PHP.', 'SHOW_EXIF' => 'mostra/nascondi', 'VIEWEXIFS_DEFAULT' => 'Visualizza Dati-Exif in modo predefinito', -)); + + 'GALLERY_CORE_NOT_FOUND' => 'L\'estensione phpBB Gallery Core deve essere prima installata e abilitata.', + 'EXTENSION_ENABLE_SUCCESS' => 'L\'estensione è stata abilitata con successo.', +]); diff --git a/exif/language/ru/exif.php b/exif/language/ru/info_exif.php similarity index 95% rename from exif/language/ru/exif.php rename to exif/language/ru/info_exif.php index 67fc1c53e..137ff2d9a 100644 --- a/exif/language/ru/exif.php +++ b/exif/language/ru/info_exif.php @@ -22,13 +22,13 @@ if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } /** * Language for Exif data */ -$lang = array_merge($lang, array( +$lang = array_merge($lang, [ 'EXIF_DATA' => 'EXIF-Данные', 'EXIF_APERTURE' => 'Диафрагма', 'EXIF_CAM_MODEL' => 'Модель камеры', @@ -96,4 +96,7 @@ 'DISP_EXIF_DATA_EXP' => 'Эта функция не может использоваться на данный момент, т.к. функция "exif_read_data" не входит в установке PHP', 'SHOW_EXIF' => 'Показать / Скрыть', 'VIEWEXIFS_DEFAULT' => 'Просмотр EXIF-Данных по умолчанию', -)); + + 'GALLERY_CORE_NOT_FOUND' => 'Сначала необходимо установить и включить расширение phpBB Gallery Core.', + 'EXTENSION_ENABLE_SUCCESS' => 'Расширение успешно включено.', +]); diff --git a/exif/migrations/m1_init.php b/exif/migrations/m1_init.php index f17e6dc16..e8636af2f 100644 --- a/exif/migrations/m1_init.php +++ b/exif/migrations/m1_init.php @@ -12,47 +12,50 @@ namespace phpbbgallery\exif\migrations; -class m1_init extends \phpbb\db\migration\migration +use phpbb\db\migration\migration; + +class m1_init extends migration { - static public function depends_on() + public static function depends_on(): array { - return array('\phpbbgallery\core\migrations\release_1_2_0'); + return ['\phpbbgallery\core\migrations\release_1_2_0']; } - public function update_data() + public function update_data(): array { - return array( - // add config - array('config.add', array('phpbb_gallery_disp_exifdata', 1)) - ); + return [ + ['config.add', ['phpbb_gallery_disp_exifdata', 1]], + ]; } - //lets create the needed table - public function update_schema() + + // Let's create the needed table + public function update_schema(): array { - return array( - 'add_columns' => array( - $this->table_prefix . 'gallery_images' => array( - 'image_has_exif' => array('UINT:3', 2), - 'image_exif_data' => array('TEXT', ''), - ), - $this->table_prefix . 'gallery_users' => array( - 'user_viewexif' => array('UINT:1', 0), - ), - ), - ); + return [ + 'add_columns' => [ + $this->table_prefix . 'gallery_images' => [ + 'image_has_exif' => ['UINT:3', 2], + 'image_exif_data' => ['TEXT', ''], + ], + $this->table_prefix . 'gallery_users' => [ + 'user_viewexif' => ['UINT:1', 0], + ], + ], + ]; } - public function revert_schema() + + public function revert_schema(): array { - return array( - 'drop_columns' => array( - $this->table_prefix . 'gallery_images' => array( + return [ + 'drop_columns' => [ + $this->table_prefix . 'gallery_images' => [ 'image_has_exif', - 'image_exif_data' - ), - $this->table_prefix . 'gallery_users' => array( + 'image_exif_data', + ], + $this->table_prefix . 'gallery_users' => [ 'user_viewexif', - ), - ), - ); + ], + ], + ]; } } diff --git a/exif/migrations/m2_fix_exif_field.php b/exif/migrations/m2_fix_exif_field.php new file mode 100644 index 000000000..168d068c4 --- /dev/null +++ b/exif/migrations/m2_fix_exif_field.php @@ -0,0 +1,45 @@ + [ + $this->table_prefix . 'gallery_images' => [ + 'image_exif_data' => ['TEXT', null], + ], + ], + ]; + } + + public function revert_schema(): array + { + return [ + 'change_columns' => [ + $this->table_prefix . 'gallery_images' => [ + 'image_exif_data' => ['TEXT', ''], + ], + ], + ]; + } +} diff --git a/tests/functional/phpbbgallery_alpha_test.php b/tests/functional/phpbbgallery_alpha_test.php index 64a901bd5..1f06667f5 100644 --- a/tests/functional/phpbbgallery_alpha_test.php +++ b/tests/functional/phpbbgallery_alpha_test.php @@ -57,7 +57,7 @@ public function install_data() // This is core, now extensions 'exif' => array( 'phpbbgallery/exif', - 'exif', + 'info_exif', 'adm/index.php?i=-phpbbgallery-core-acp-config_module&mode=main', 'DISP_EXIF_DATA' ), @@ -69,7 +69,7 @@ public function install_data() ), 'acp_import' => array( 'phpbbgallery/acpimport', - 'info_acp_gallery_acpimport', + 'info_acp_gallery_import', 'adm/index.php?i=-phpbbgallery-acpimport-acp-main_module&mode=import_images', 'ACP_IMPORT_ALBUMS' ), @@ -91,7 +91,7 @@ public function test_install($ext, $lang, $path, $search) $this->logout(); } // Stop core so we can test if all works with all add-ons off - public function togle_data() + public function toggle_data() { return array( 'core' => array('phpbbgallery/core'), @@ -101,9 +101,9 @@ public function togle_data() ); } /** - * @dataProvider togle_data + * @dataProvider toggle_data */ - public function togle_core($ext) + public function toggle_core($ext) { $this->get_db(); if (strpos($this->db->get_sql_layer(), 'sqlite3') === 0) diff --git a/tests/functional/phpbbgallery_delta_test.php b/tests/functional/phpbbgallery_delta_test.php index 0668955b3..8bd1b4f5b 100644 --- a/tests/functional/phpbbgallery_delta_test.php +++ b/tests/functional/phpbbgallery_delta_test.php @@ -31,7 +31,7 @@ public function test_prepare_import() $this->add_lang_ext('phpbbgallery/core', 'gallery_acp'); $this->add_lang_ext('phpbbgallery/core', 'gallery'); - $this->add_lang_ext('phpbbgallery/acpimport', 'info_acp_gallery_acpimport'); + $this->add_lang_ext('phpbbgallery/acpimport', 'info_acp_gallery_import'); $crawler = self::request('GET', 'adm/index.php?i=-phpbbgallery-acpimport-acp-main_module&mode=import_images&sid=' . $this->sid); $album_id = $crawler->filter('option:contains("First test album!")')->attr('value'); @@ -71,7 +71,7 @@ public function test_acp_import_change_uploader() $this->add_lang_ext('phpbbgallery/core', 'gallery_acp'); $this->add_lang_ext('phpbbgallery/core', 'gallery'); - $this->add_lang_ext('phpbbgallery/acpimport', 'info_acp_gallery_acpimport'); + $this->add_lang_ext('phpbbgallery/acpimport', 'info_acp_gallery_import'); $crawler = self::request('GET', 'adm/index.php?i=-phpbbgallery-acpimport-acp-main_module&mode=import_images&sid=' . $this->sid); $album_id = $crawler->filter('option:contains("First test album!")')->attr('value'); @@ -110,7 +110,7 @@ public function test_acp_import_change_image_name() $this->add_lang_ext('phpbbgallery/core', 'gallery_acp'); $this->add_lang_ext('phpbbgallery/core', 'gallery'); - $this->add_lang_ext('phpbbgallery/acpimport', 'info_acp_gallery_acpimport'); + $this->add_lang_ext('phpbbgallery/acpimport', 'info_acp_gallery_import'); $crawler = self::request('GET', 'adm/index.php?i=-phpbbgallery-acpimport-acp-main_module&mode=import_images&sid=' . $this->sid); $album_id = $crawler->filter('option:contains("First test album!")')->attr('value'); @@ -150,7 +150,7 @@ public function test_acp_import_add_to_user_gallery_existing() $this->add_lang_ext('phpbbgallery/core', 'gallery_acp'); $this->add_lang_ext('phpbbgallery/core', 'gallery'); - $this->add_lang_ext('phpbbgallery/acpimport', 'info_acp_gallery_acpimport'); + $this->add_lang_ext('phpbbgallery/acpimport', 'info_acp_gallery_import'); $crawler = self::request('GET', 'adm/index.php?i=-phpbbgallery-acpimport-acp-main_module&mode=import_images&sid=' . $this->sid); //$album_id = $crawler->filter('option:contains("First test album!")')->attr('value'); @@ -189,7 +189,7 @@ public function test_acp_import_add_to_user_gallery_not_existing() $this->add_lang_ext('phpbbgallery/core', 'gallery_acp'); $this->add_lang_ext('phpbbgallery/core', 'gallery'); - $this->add_lang_ext('phpbbgallery/acpimport', 'info_acp_gallery_acpimport'); + $this->add_lang_ext('phpbbgallery/acpimport', 'info_acp_gallery_import'); $crawler = self::request('GET', 'adm/index.php?i=-phpbbgallery-acpimport-acp-main_module&mode=import_images&sid=' . $this->sid); //$album_id = $crawler->filter('option:contains("First test album!")')->attr('value'); @@ -256,7 +256,7 @@ public function test_exif($image, $state) $this->add_lang_ext('phpbbgallery/core', 'gallery_acp'); $this->add_lang_ext('phpbbgallery/core', 'gallery'); - $this->add_lang_ext('phpbbgallery/exif', 'exif'); + $this->add_lang_ext('phpbbgallery/exif', 'info_exif'); $this->set_option('disp_exifdata', $state); if ($image == 'first')