-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathajaximglist.php
53 lines (44 loc) · 1.48 KB
/
ajaximglist.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
<?php
/**
* ajaximglist.php - supply list of images defined for a page
*
* @copyright Copyright © 2013 geekwright, LLC. All rights reserved.
* @license gwiki/docs/license.txt GNU General Public License (GPL)
* @since 1.0
* @author Richard Griffith <[email protected]>
* @package gwiki
*/
include __DIR__ . '/../../mainfile.php';
$xoopsLogger->activated = false;
header('Pragma: public');
header('Cache-Control: no-cache');
/**
* @param $string
*
* @return string
*/
function cleaner($string)
{
$string = stripcslashes($string);
$string = html_entity_decode($string);
$string = strip_tags($string); // DANGER -- kills wiki text
$string = trim($string);
$string = stripslashes($string);
return $string;
}
// $_GET variables we use
unset($page, $bid, $id);
$page = isset($_GET['page']) ? cleaner($_GET['page']) : '';
$dir = basename(__DIR__);
$sql = 'SELECT * FROM ' . $xoopsDB->prefix('gwiki_page_images') . ' WHERE keyword = \'' . $page . '\' ' . ' ORDER BY image_name ';
$result = $xoopsDB->query($sql);
$images = array();
for ($i = 0, $iMax = $xoopsDB->getRowsNum($result); $i < $iMax; ++$i) {
$image = $xoopsDB->fetchArray($result);
// $image['link']=XOOPS_URL . '/uploads/' . $dir . '/' . $image['image_file'];
$image['link'] = XOOPS_URL . '/modules/' . $dir . '/getthumb.php?page=' . $image['keyword'] . '&name=' . $image['image_name'];
$images[] = $image;
}
$jsonimages = json_encode($images);
echo $jsonimages;
exit;