1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | Photo added by plugin for Piwigo by TEMMII | |
---|
4 | // +-----------------------------------------------------------------------+ |
---|
5 | // | Copyright(C) 2012-2021 ddtddt http://temmii.com/piwigo/ | |
---|
6 | // +-----------------------------------------------------------------------+ |
---|
7 | // | This program is free software; you can redistribute it and/or modify | |
---|
8 | // | it under the terms of the GNU General Public License as published by | |
---|
9 | // | the Free Software Foundation | |
---|
10 | // | | |
---|
11 | // | This program is distributed in the hope that it will be useful, but | |
---|
12 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
13 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
14 | // | General Public License for more details. | |
---|
15 | // | | |
---|
16 | // | You should have received a copy of the GNU General Public License | |
---|
17 | // | along with this program; if not, write to the Free Software | |
---|
18 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
19 | // | USA. | |
---|
20 | // +-----------------------------------------------------------------------+ |
---|
21 | |
---|
22 | if (!defined('PHPWG_ROOT_PATH')) |
---|
23 | die('Hacking attempt!'); |
---|
24 | |
---|
25 | //add prefiltre photo |
---|
26 | add_event_handler('loc_begin_admin', 'addpayadmin', 55); |
---|
27 | add_event_handler('loc_begin_admin_page', 'addpayadminA', 55); |
---|
28 | |
---|
29 | function addpayadmin() { |
---|
30 | global $template; |
---|
31 | $template->set_prefilter('picture_modify', 'addpayadminT'); |
---|
32 | } |
---|
33 | |
---|
34 | function addpayadminT($content, &$smarty) { |
---|
35 | $search = '# </div> |
---|
36 | <div id=\'picture-content\'>#'; |
---|
37 | $replacement = ' </div> |
---|
38 | <div style="writing-mode:vertical-rl; text-orientation:mixed; text-align: center;height:35vw; width:15px;"> |
---|
39 | {if $PABA} |
---|
40 | <strong>{\'Photo added by\'|@translate}</strong> {$PABA} |
---|
41 | {/if} |
---|
42 | </div> |
---|
43 | <div id=\'picture-content\'> |
---|
44 | '; |
---|
45 | |
---|
46 | return preg_replace($search, $replacement, $content); |
---|
47 | } |
---|
48 | |
---|
49 | function addpayadminA() { |
---|
50 | if (isset($_GET['image_id'])){ |
---|
51 | global $conf, $page, $template; |
---|
52 | load_language('plugin.lang', PAB_PATH); |
---|
53 | load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR, array('no_fallback'=>true, 'local'=>true) ); |
---|
54 | |
---|
55 | $query = 'select added_by FROM ' . IMAGES_TABLE . ' WHERE id = \''.$_GET['image_id'].'\';'; |
---|
56 | $result = pwg_query($query); |
---|
57 | $row = pwg_db_fetch_assoc($result); |
---|
58 | $userab=$row['added_by']; |
---|
59 | |
---|
60 | $query = 'select '.$conf['user_fields']['username'].' AS username FROM ' . USERS_TABLE . ' WHERE '.$conf['user_fields']['id'].' = \''.$userab.'\';'; |
---|
61 | $result = pwg_query($query); |
---|
62 | $row = pwg_db_fetch_assoc($result); |
---|
63 | $pab=$row['username']; |
---|
64 | |
---|
65 | $template->assign(array('PABA' => $pab,)); |
---|
66 | } |
---|
67 | } |
---|
68 | |
---|
69 | ?> |
---|