1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: Perso Login Display |
---|
4 | Version: auto |
---|
5 | Description: Add bloc perso on login page |
---|
6 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid=903 |
---|
7 | Author: ddtddt |
---|
8 | Author URI: http://temmii.com/piwigo/ |
---|
9 | Has Settings: webmaster |
---|
10 | */ |
---|
11 | // +-----------------------------------------------------------------------+ |
---|
12 | // | Perso Login Display plugin for piwigo by TEMMII | |
---|
13 | // +-----------------------------------------------------------------------+ |
---|
14 | // | Copyright(C) 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 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
32 | |
---|
33 | define('PLD_DIR' , basename(dirname(__FILE__))); |
---|
34 | define('PLD_PATH' , PHPWG_PLUGINS_PATH . PLD_DIR . '/'); |
---|
35 | define('PLD_ADMIN',get_root_url().'admin.php?page=plugin-'.PLD_DIR); |
---|
36 | |
---|
37 | add_event_handler('loading_lang', 'perso_login_display_loading_lang'); |
---|
38 | function perso_login_display_loading_lang(){ |
---|
39 | load_language('plugin.lang', PPA_PATH); |
---|
40 | } |
---|
41 | |
---|
42 | if (script_basename() == 'identification'){ |
---|
43 | add_event_handler('loc_begin_identification', 'pld'); |
---|
44 | } |
---|
45 | |
---|
46 | function pld(){ |
---|
47 | global $template, $conf, $pwg_loaded_plugins; |
---|
48 | $template->set_prefilter('identification', 'pldTtop'); |
---|
49 | $template->set_prefilter('identification', 'pldTbefsub'); |
---|
50 | $template->set_prefilter('identification', 'pldTaftsub'); |
---|
51 | $template->set_prefilter('identification', 'pldTbottom'); |
---|
52 | if (isset($pwg_loaded_plugins['ExtendedDescription'])){ |
---|
53 | add_event_handler('AP_render_content', 'get_user_language_desc'); |
---|
54 | } |
---|
55 | $plddata = safe_unserialize($conf['PersoLoginDisplay']); |
---|
56 | $pldtop=trigger_change('AP_render_content', $plddata['top']); |
---|
57 | $pldTbefsub=trigger_change('AP_render_content', $plddata['befsub']); |
---|
58 | $pldTaftsub=trigger_change('AP_render_content', $plddata['aftsub']); |
---|
59 | $pldbottom=trigger_change('AP_render_content', $plddata['bottom']); |
---|
60 | if (!empty($pldtop)){ |
---|
61 | $template->assign('PLD_TOP', $pldtop); |
---|
62 | } |
---|
63 | if (!empty($pldTbefsub)){ |
---|
64 | $template->assign('PLD_BEFSUB', $pldTbefsub); |
---|
65 | } |
---|
66 | if (!empty($pldTaftsub)){ |
---|
67 | $template->assign('PLD_AFTSUB', $pldTaftsub); |
---|
68 | } |
---|
69 | if (!empty($pldbottom)){ |
---|
70 | $template->assign('PLD_BOTTOM', $pldbottom); |
---|
71 | } |
---|
72 | } |
---|
73 | |
---|
74 | function pldTtop($content, &$smarty){ |
---|
75 | $search = '</h2> |
---|
76 | </div>'; |
---|
77 | $replacement = '</h2> |
---|
78 | </div> |
---|
79 | <div id="pldtop">{$PLD_TOP}</div> |
---|
80 | '; |
---|
81 | return str_replace($search, $replacement, $content); |
---|
82 | } |
---|
83 | |
---|
84 | function pldTbefsub($content, &$smarty){ |
---|
85 | $search = '</fieldset>'; |
---|
86 | $replacement = '</fieldset> |
---|
87 | <div id="pldbfsub">{$PLD_BEFSUB}</div> |
---|
88 | '; |
---|
89 | return str_replace($search, $replacement, $content); |
---|
90 | } |
---|
91 | function pldTaftsub($content, &$smarty){ |
---|
92 | $search = '> |
---|
93 | </p>'; |
---|
94 | $replacement = '> |
---|
95 | </p> |
---|
96 | <div id="pldaftsub">{$PLD_AFTSUB}</div> |
---|
97 | '; |
---|
98 | return str_replace($search, $replacement, $content); |
---|
99 | } |
---|
100 | |
---|
101 | function pldTbottom($content, &$smarty){ |
---|
102 | $search = '</form>'; |
---|
103 | $replacement = '</form> |
---|
104 | <div id="pldbottom">{$PLD_BOTTOM}</div> |
---|
105 | '; |
---|
106 | return str_replace($search, $replacement, $content); |
---|
107 | } |
---|
108 | ?> |
---|