This repository was archived by the owner on Aug 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpnuserapi.php
More file actions
89 lines (73 loc) · 2.37 KB
/
Copy pathpnuserapi.php
File metadata and controls
89 lines (73 loc) · 2.37 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
/**
* PhotoGallery
*
* @copyright (c) PhotoGallery Team
* @link http://code.zikula.org/pagemaster/
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
* @package Zikula_3rdParty_Modules
* @subpackage PhotoGallery
* @originalAuthor Nathan Welch
* @maintainers Igor Vancouwenberge, Robert Gasch
*/
function photogallery_userapi_getallphotos ($args)
{
if (!SecurityUtil::checkPermission('PhotoGallery::', "::", ACCESS_READ)) {
return array();
}
$where = "pn_gid = $args[gid]";
$sort = '';
if ($args['cat_sort'] == '0') {
$sort = 'dateadded DESC';
} elseif ($args['cat_sort'] == '1') {
$sort = 'dateadded ASC';
} elseif ($args['cat_sort'] == '2') {
$sort = 'name ASC';
} else {
$sort = 'sortorder';
}
$photos = DBUtil::selectObjectArray ('photogallery_photos', $where, $sort);
if ($photos === false) {
return LogUtil::registerError (_PHOTO_GETFAILED);
}
$summary = array();
foreach ($photos as $k=>$v) {
foreach ($v as $kk=>$vv) {
$summary[$kk][$k] = $vv;
}
if ($v['pid'] == $args['this_pid']) {
$this_key = $k;
}
}
// Set counter for total photos and current photo
$summary['totalphotocount'] = count($photos);
$summary['thisphotocount'] = $this_key+1;
// Set keys for next and previous photos
if (isset($summary['pid'][$this_key+1])) {
$summary['nextkey'] = $this_key+1;
}
if (isset($summary['pid'][$this_key-1])) {
$summary['prevkey'] = $this_key-1;
}
return $summary;
}
// Create a select list of available galleries
function photogallery_userapi_galleryselectlist ()
{
if (!SecurityUtil::checkPermission('PhotoGallery::', "::", ACCESS_READ)) {
return array();
}
$where = 'pn_active = 1';
$sort = 'pn_sortorder';
return DBUtil::selectFieldArray ('photogallery_galleries', 'name', $where, $sort, false, 'gid');
}
// Create a select list of available photos
function photogallery_userapi_photoselectlist ()
{
if (!SecurityUtil::checkPermission('PhotoGallery::', "::", ACCESS_READ)) {
return array();
}
$where = 'pn_active = 1';
$sort = 'pn_name, pn_gid';
return DBUtil::selectFieldArray ('photogallery_photos', 'name', $where, $sort, false, 'pid');
}