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