1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: Block search |
---|
4 | Version: auto |
---|
5 | Description: Add a block search |
---|
6 | Plugin URI: https://piwigo.org/ext/extension_view.php?eid=896 |
---|
7 | Author: ddtddt |
---|
8 | Author URI: http://temmii.com/piwigo/ |
---|
9 | */ |
---|
10 | |
---|
11 | // +-----------------------------------------------------------------------+ |
---|
12 | // |Block search for Piwigo by TEMMII | |
---|
13 | // +-----------------------------------------------------------------------+ |
---|
14 | // | Copyright(C) 2020 - 2021 ddtddt http://temmii.com/piwigo/ | |
---|
15 | // +-----------------------------------------------------------------------+ |
---|
16 | // | This program is free software; you can redistribute it and/or modify | |
---|
17 | // | it under the terms of the GNU General Public License as published by | |
---|
18 | // | the Free Software Foundation | |
---|
19 | // | | |
---|
20 | // | This program is distributed in the hope that it will be useful, but | |
---|
21 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
22 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
23 | // | General Public License for more details. | |
---|
24 | // | | |
---|
25 | // | You should have received a copy of the GNU General Public License | |
---|
26 | // | along with this program; if not, write to the Free Software | |
---|
27 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
28 | // | USA. | |
---|
29 | // +-----------------------------------------------------------------------+ |
---|
30 | |
---|
31 | defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); |
---|
32 | |
---|
33 | define('BSEARCH_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'); |
---|
34 | |
---|
35 | add_event_handler('loading_lang', 'bsearch_loading_lang'); |
---|
36 | function bsearch_loading_lang(){ |
---|
37 | load_language('plugin.lang', BSEARCH_PATH); |
---|
38 | } |
---|
39 | |
---|
40 | $PWGSacc = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'PWG_Stuffs';")); |
---|
41 | |
---|
42 | if($PWGSacc['state'] == 'active'){ |
---|
43 | add_event_handler('get_stuffs_modules', 'register_bsearch_module'); |
---|
44 | |
---|
45 | function register_bsearch_module($modules){ |
---|
46 | array_push($modules, array( |
---|
47 | 'path' => BSEARCH_PATH.'/blocksearch', |
---|
48 | 'name' => l10n('Search'), |
---|
49 | 'description' => l10n('Add Search block'), |
---|
50 | )); |
---|
51 | return $modules; |
---|
52 | } |
---|
53 | }else{ |
---|
54 | if (script_basename() == 'admin'){ |
---|
55 | global $page; |
---|
56 | load_language('plugin.lang', BSEARCH_PATH); |
---|
57 | $page['errors'][] = l10n('For use "Block search" the plugin PWG_Stuffs must be installed and activated'); |
---|
58 | } |
---|
59 | } |
---|