source: extensions/user_custom_fields/include/function.inc.php @ 31813

Last change on this file since 31813 was 31542, checked in by ddtddt, 8 years ago

[extensions] - user_custom_fields - admin gest dee update data

File size: 2.7 KB
Line 
1<?php 
2
3// +-----------------------------------------------------------------------+
4// | User Custom Fields plugin for Piwigo                                  |
5// +-----------------------------------------------------------------------+
6// | Copyright(C) 2016 ddtddt                    http://temmii.com/piwigo/ |
7// +-----------------------------------------------------------------------+
8// | This program is free software; you can redistribute it and/or modify  |
9// | it under the terms of the GNU General Public License as published by  |
10// | the Free Software Foundation                                          |
11// |                                                                       |
12// | This program is distributed in the hope that it will be useful, but   |
13// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
14// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
15// | General Public License for more details.                              |
16// |                                                                       |
17// | You should have received a copy of the GNU General Public License     |
18// | along with this program; if not, write to the Free Software           |
19// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
20// | USA.                                                                  |
21// +-----------------------------------------------------------------------+
22
23/*public*/
24function tab_user_custom_fields_register(){
25  $query = 'SELECT id_ucf,wording,order_ucf,active,edit,adminonly,obligatory FROM ' . UCF_TABLE.' WHERE adminonly=0 AND active=1 ORDER BY order_ucf ASC;';
26  return pwg_query($query);
27}
28
29function data_info_user($id_user=null,$id_ucf=NULL){
30$query = '
31    SELECT data
32    FROM ' . UCFD_TABLE;
33    $wa='WHERE';
34    if($id_user!=null){
35        $query .=' '.$wa.' id_user='.$id_user;$wa='AND';
36    }
37    if($id_ucf!=null){
38        $query .=' '.$wa.' id_ucf='.$id_ucf;$wa='AND';
39    }
40$query .= ';';
41return pwg_query($query);
42}
43
44
45/*Admin*/
46function tab_user_custom_fields($id_ucf=NULL){
47  $query = '
48    SELECT id_ucf,wording,order_ucf,active,edit,adminonly,obligatory
49    FROM ' . UCF_TABLE;
50    if($id_ucf!=null){
51      $query .= ' WHERE id_ucf='.$id_ucf;
52    }
53  $query .= ' ORDER BY order_ucf ASC
54  ;';
55  return pwg_query($query);
56}
57
58function tab_user_custom_fields_adminlist($id_ucf=NULL){
59  $query = '
60    SELECT id_ucf,wording,order_ucf,active,edit,adminonly,obligatory
61    FROM ' . UCF_TABLE;
62 $query .= ' WHERE edit=1'; 
63   if($id_ucf!=null){
64      $query .= ' AND id_ucf='.$id_ucf;
65    }
66  $query .= ' ORDER BY order_ucf ASC
67  ;';
68  return pwg_query($query);
69}
70
71?>
Note: See TracBrowser for help on using the repository browser.