source: extensions/Photo_add_by/initadmin.php @ 32459

Last change on this file since 32459 was 32442, checked in by ddtddt, 4 years ago

[Photo_add_by] add "Photo added by" #user in admin part

File size: 2.9 KB
Line 
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
22if (!defined('PHPWG_ROOT_PATH'))
23    die('Hacking attempt!');
24
25//add prefiltre photo
26add_event_handler('loc_begin_admin', 'addpayadmin', 55);
27add_event_handler('loc_begin_admin_page', 'addpayadminA', 55);
28
29function addpayadmin() {
30  global $template;
31  $template->set_prefilter('picture_modify', 'addpayadminT');
32}
33
34function 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
49function addpayadminA() {
50  if (isset($_GET['image_id'])){
51        global $conf, $page, $template;
52load_language('plugin.lang', PAB_PATH);
53load_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?>
Note: See TracBrowser for help on using the repository browser.