author | Dan |
Sat, 23 Feb 2008 16:02:15 -0500 | |
changeset 25 | d9f37d2ea2cf |
parent 24 | 7f3bd3030ae9 |
child 33 | 6dc190e2158b |
permissions | -rw-r--r-- |
0
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
1 |
<?php |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
2 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
3 |
/* |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
4 |
* Snapr |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
5 |
* Version 0.1 beta 1 |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
6 |
* Copyright (C) 2007 Dan Fuhry |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
7 |
* |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
8 |
* This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
9 |
* as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
10 |
* |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
12 |
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
13 |
*/ |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
14 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
15 |
## |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
16 |
## GALLERY NAMESPACE HANDLER |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
17 |
## |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
18 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
19 |
$plugins->attachHook('page_not_found', 'gallery_namespace_handler($this);'); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
20 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
21 |
function gallery_namespace_handler(&$page) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
22 |
{ |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
23 |
global $db, $session, $paths, $template, $plugins; // Common objects |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
24 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
25 |
if ( $page->namespace != 'Gallery' ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
26 |
return false; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
27 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
28 |
if ( $page->page_id == 'Root' ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
29 |
{ |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
30 |
page_Special_Gallery(); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
31 |
return true; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
32 |
} |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
33 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
34 |
if ( preg_match('/^[0-9]+$/', $page->page_id) ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
35 |
{ |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
36 |
$img_id = intval($page->page_id); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
37 |
if ( !$img_id ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
38 |
return false; |
18
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
39 |
$q = $db->sql_query('SELECT img_id, img_title, img_desc, print_sizes, img_time_upload, img_time_mod, img_filename, folder_parent, img_tags FROM '.table_prefix.'gallery WHERE img_id=' . $img_id . ';'); |
0
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
40 |
if ( !$q ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
41 |
$db->_die(); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
42 |
} |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
43 |
else |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
44 |
{ |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
45 |
// Ech... he sent us a string... parse it and see what we get |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
46 |
if ( strstr($page->page_id, '/') ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
47 |
{ |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
48 |
$folders = explode('/', $page->page_id); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
49 |
} |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
50 |
else |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
51 |
{ |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
52 |
$folders = array($page->page_id); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
53 |
} |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
54 |
foreach ( $folders as $i => $_crap ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
55 |
{ |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
56 |
$folder =& $folders[$i]; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
57 |
$folder = dirtify_page_id($folder); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
58 |
$folder = str_replace('_', ' ', $folder); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
59 |
} |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
60 |
unset($folder); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
61 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
62 |
$folders = array_reverse($folders); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
63 |
// This is one of the best MySQL tricks on the market. We're going to reverse-travel a folder path using LEFT JOIN and the incredible power of metacoded SQL |
18
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
64 |
$sql = 'SELECT g0.img_id, g0.img_title, g0.img_desc, g0.print_sizes, g0.img_time_upload, g0.img_time_mod, g0.img_filename, g0.folder_parent, g0.img_tags FROM '.table_prefix.'gallery AS g0'; |
0
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
65 |
$where = "\n " . 'WHERE g0.img_title=\'' . $db->escape($folders[0]) . '\''; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
66 |
foreach ( $folders as $i => $folder ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
67 |
{ |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
68 |
if ( $i == 0 ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
69 |
continue; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
70 |
$i_dec = $i - 1; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
71 |
$folder = $db->escape($folder); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
72 |
$sql .= "\n LEFT JOIN ".table_prefix."gallery AS g{$i}\n ON ( g{$i}.img_id=g{$i_dec}.folder_parent AND g{$i}.img_title='$folder' )"; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
73 |
$where .= "\n ".'AND g'.$i.'.img_id IS NOT NULL'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
74 |
} |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
75 |
$where .= "\n AND g{$i}.folder_parent IS NULL"; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
76 |
$sql .= $where . ';'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
77 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
78 |
if ( !$db->sql_query($sql) ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
79 |
{ |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
80 |
$db->_die('The image metadata could not be loaded.'); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
81 |
} |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
82 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
83 |
// Now that the folder data is no longer needed, we can fool around with it a little |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
84 |
$folders = $page->page_id; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
85 |
if ( !strstr($folders, '/') ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
86 |
{ |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
87 |
$hier = '/'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
88 |
} |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
89 |
else |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
90 |
{ |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
91 |
$hier = preg_replace('/\/([^\/]+)$/', '/', $folders); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
92 |
$hier = sanitize_page_id($hier); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
93 |
} |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
94 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
95 |
} |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
96 |
if ( $db->numrows() < 1 ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
97 |
{ |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
98 |
// Image not found - show custom error message |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
99 |
$template->header(); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
100 |
echo '<h3>There is no image in the gallery with this ID.</h3>'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
101 |
echo '<p>You have requested an image that couldn\'t be looked up. Please check the URL and try again, or visit the <a href="' . makeUrlNS('Special', 'Gallery') . '">Gallery index</a>.</p>'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
102 |
$template->footer(); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
103 |
return false; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
104 |
} |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
105 |
$row = $db->fetchrow(); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
106 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
107 |
$db->free_result(); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
108 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
109 |
$img_id = $row['img_id']; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
110 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
111 |
if ( !$row['folder_parent'] ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
112 |
$row['folder_parent'] = ' IS NULL'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
113 |
else |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
114 |
$row['folder_parent'] = '=' . $row['folder_parent']; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
115 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
116 |
// Fetch image parent properties |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
117 |
$q = $db->sql_query('SELECT img_id, img_title FROM '.table_prefix.'gallery WHERE folder_parent' . $row['folder_parent'] . ' AND is_folder!=1 ORDER BY img_title ASC;'); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
118 |
if ( !$q ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
119 |
$db->_die(); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
120 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
121 |
$folder_total = $db->numrows(); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
122 |
$folder_this = 0; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
123 |
$prev = false; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
124 |
$next = false; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
125 |
$next_title = ''; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
126 |
$prev_title = ''; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
127 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
128 |
$i = 0; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
129 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
130 |
while ( $r = $db->fetchrow() ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
131 |
{ |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
132 |
$i++; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
133 |
if ( $i == $folder_total && $r['img_id'] == $img_id ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
134 |
{ |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
135 |
$folder_this = $i; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
136 |
$next = false; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
137 |
} |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
138 |
else if ( $i < $folder_total && $r['img_id'] == $img_id ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
139 |
{ |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
140 |
$folder_this = $i; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
141 |
$next = true; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
142 |
} |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
143 |
else |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
144 |
{ |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
145 |
if ( $next ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
146 |
{ |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
147 |
$next = $r['img_id']; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
148 |
$next_title = $r['img_title']; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
149 |
break; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
150 |
} |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
151 |
$prev = $r['img_id']; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
152 |
$prev_title = $r['img_title']; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
153 |
} |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
154 |
} |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
155 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
156 |
if ( $next ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
157 |
{ |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
158 |
$next_sanitized = sanitize_page_id($next_title); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
159 |
$next_url = ( isset($hier) ) ? makeUrlNS('Gallery', $hier . $next_sanitized ) : makeUrlNS('Gallery', $next); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
160 |
} |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
161 |
if ( $prev ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
162 |
{ |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
163 |
$prev_sanitized = sanitize_page_id($prev_title); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
164 |
$prev_url = ( isset($hier) ) ? makeUrlNS('Gallery', $hier . $prev_sanitized ) : makeUrlNS('Gallery', $prev); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
165 |
} |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
166 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
167 |
$db->free_result(); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
168 |
|
18
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
169 |
$perms = $session->fetch_page_acl(strval($img_id), 'Gallery'); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
170 |
|
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
171 |
if ( isset($_POST['ajax']) && @$_POST['ajax'] === 'true' && isset($_POST['act']) ) |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
172 |
{ |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
173 |
$mode =& $_POST['act']; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
174 |
$response = array(); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
175 |
switch($mode) |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
176 |
{ |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
177 |
case 'add_tag': |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
178 |
if ( !$perms->get_permissions('snapr_add_tag') ) |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
179 |
{ |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
180 |
die(snapr_json_encode(array( |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
181 |
'mode' => 'error', |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
182 |
'error' => 'You don\'t have permission to add tags.' |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
183 |
))); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
184 |
} |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
185 |
if ( empty($row['img_tags']) ) |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
186 |
{ |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
187 |
$row['img_tags'] = '[]'; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
188 |
} |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
189 |
$row['img_tags'] = snapr_json_decode($row['img_tags']); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
190 |
|
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
191 |
$canvas_data = snapr_json_decode($_POST['canvas_params']); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
192 |
$tag_data = array( |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
193 |
'tag' => sanitize_html($_POST['tag']), |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
194 |
'canvas_data' => $canvas_data |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
195 |
); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
196 |
$row['img_tags'][] = $tag_data; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
197 |
$tag_data['note_id'] = count($row['img_tags']) - 1; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
198 |
$tag_data['mode'] = 'add'; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
199 |
$tag_data['initial_hide'] = false; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
200 |
$tag_data['auth_delete'] = true; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
201 |
|
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
202 |
$row['img_tags'] = snapr_json_encode($row['img_tags']); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
203 |
$row['img_tags'] = $db->escape($row['img_tags']); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
204 |
$q = $db->sql_query('UPDATE ' . table_prefix . "gallery SET img_tags = '{$row['img_tags']}' WHERE img_id = $img_id;"); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
205 |
if ( !$q ) |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
206 |
$db->die_json(); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
207 |
|
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
208 |
$response[] = $tag_data; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
209 |
break; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
210 |
case 'del_tag': |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
211 |
if ( !$perms->get_permissions('snapr_add_tag') ) |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
212 |
{ |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
213 |
die(snapr_json_encode(array( |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
214 |
'mode' => 'error', |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
215 |
'error' => 'You don\'t have permission to add tags.' |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
216 |
))); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
217 |
} |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
218 |
if ( empty($row['img_tags']) ) |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
219 |
{ |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
220 |
$row['img_tags'] = '[]'; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
221 |
} |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
222 |
$row['img_tags'] = snapr_json_decode($row['img_tags']); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
223 |
|
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
224 |
$tag_id = intval(@$_POST['tag_id']); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
225 |
if ( isset($row['img_tags'][$tag_id]) ) |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
226 |
unset($row['img_tags'][$tag_id]); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
227 |
|
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
228 |
$row['img_tags'] = snapr_json_encode($row['img_tags']); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
229 |
$row['img_tags'] = $db->escape($row['img_tags']); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
230 |
$q = $db->sql_query('UPDATE ' . table_prefix . "gallery SET img_tags = '{$row['img_tags']}' WHERE img_id = $img_id;"); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
231 |
if ( !$q ) |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
232 |
$db->die_json(); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
233 |
|
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
234 |
$response[] = array( |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
235 |
'mode' => 'remove', |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
236 |
'note_id' => $tag_id |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
237 |
); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
238 |
break; |
24
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
239 |
case 'edit_tag': |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
240 |
if ( !$perms->get_permissions('snapr_add_tag') ) |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
241 |
{ |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
242 |
die(snapr_json_encode(array( |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
243 |
'mode' => 'error', |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
244 |
'error' => 'You don\'t have permission to edit tags.' |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
245 |
))); |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
246 |
} |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
247 |
if ( empty($row['img_tags']) ) |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
248 |
{ |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
249 |
$row['img_tags'] = '[]'; |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
250 |
} |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
251 |
$row['img_tags'] = snapr_json_decode($row['img_tags']); |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
252 |
|
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
253 |
$tag_id = intval(@$_POST['tag_id']); |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
254 |
if ( isset($row['img_tags'][$tag_id]) ) |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
255 |
{ |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
256 |
$row['img_tags'][$tag_id]['tag'] = sanitize_html($_POST['tag']); |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
257 |
// copy it |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
258 |
$tag_return = $row['img_tags'][$tag_id]; |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
259 |
unset($tag); |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
260 |
} |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
261 |
else |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
262 |
{ |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
263 |
die(snapr_json_encode(array( |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
264 |
'mode' => 'error', |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
265 |
'error' => 'That tag doesn\'t exist.' |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
266 |
))); |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
267 |
} |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
268 |
|
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
269 |
$row['img_tags'] = snapr_json_encode($row['img_tags']); |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
270 |
$row['img_tags'] = $db->escape($row['img_tags']); |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
271 |
$q = $db->sql_query('UPDATE ' . table_prefix . "gallery SET img_tags = '{$row['img_tags']}' WHERE img_id = $img_id;"); |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
272 |
if ( !$q ) |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
273 |
$db->die_json(); |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
274 |
|
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
275 |
$tag_return['mode'] = 'add'; |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
276 |
$tag_return['canvas_data'] = snapr_json_decode($_POST['canvas_params']); |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
277 |
$tag_return['auth_delete'] = $perms->get_permissions('snapr_add_tag'); |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
278 |
$tag_return['initial_hide'] = false; |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
279 |
$tag_return['note_id'] = $tag_id; |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
280 |
$response = array($tag_return); |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
281 |
|
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
282 |
break; |
18
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
283 |
case 'get_tags': |
25
d9f37d2ea2cf
Fixed race condition on canvas init (caused boxes to appear off by ~320px); fixed JSON response of null when row[img_tags] is NULL
Dan
parents:
24
diff
changeset
|
284 |
if ( empty($row['img_tags']) ) |
d9f37d2ea2cf
Fixed race condition on canvas init (caused boxes to appear off by ~320px); fixed JSON response of null when row[img_tags] is NULL
Dan
parents:
24
diff
changeset
|
285 |
{ |
d9f37d2ea2cf
Fixed race condition on canvas init (caused boxes to appear off by ~320px); fixed JSON response of null when row[img_tags] is NULL
Dan
parents:
24
diff
changeset
|
286 |
$row['img_tags'] = '[]'; |
d9f37d2ea2cf
Fixed race condition on canvas init (caused boxes to appear off by ~320px); fixed JSON response of null when row[img_tags] is NULL
Dan
parents:
24
diff
changeset
|
287 |
} |
18
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
288 |
$response = snapr_json_decode($row['img_tags']); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
289 |
foreach ( $response as $key => $_ ) |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
290 |
{ |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
291 |
unset($_); |
23 | 292 |
$tag = $response[$key]; |
293 |
unset($response[$key]); |
|
24
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
294 |
$tag['note_id'] = intval($key); |
18
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
295 |
$tag['mode'] = 'add'; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
296 |
$tag['initial_hide'] = true; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
297 |
$tag['auth_delete'] = $perms->get_permissions('snapr_add_tag'); |
23 | 298 |
$response[intval($key)] = $tag; |
18
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
299 |
} |
24
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
300 |
$response = array_values($response); |
18
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
301 |
unset($tag); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
302 |
break; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
303 |
} |
24
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
304 |
$encoded = snapr_json_encode($response); |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
305 |
header('Content-type: text/plain'); |
7f3bd3030ae9
Changed deletion method and added editing functionality for tags
Dan
parents:
23
diff
changeset
|
306 |
echo $encoded; |
18
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
307 |
return true; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
308 |
} |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
309 |
|
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
310 |
$have_notes = ( empty($row['img_tags']) ) ? false : ( count(snapr_json_decode($row['img_tags'])) > 0 ); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
311 |
|
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
312 |
$template->add_header('<script type="text/javascript" src="' . scriptPath . '/plugins/gallery/canvas.js"></script>'); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
313 |
$template->add_header('<script type="text/javascript" src="' . scriptPath . '/plugins/gallery/tagging.js"></script>'); |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
314 |
|
0
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
315 |
$template->tpl_strings['PAGE_NAME'] = 'Gallery image: ' . htmlspecialchars($row['img_title']); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
316 |
$title_spacey = strtolower(htmlspecialchars($row['img_title'])); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
317 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
318 |
$template->header(); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
319 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
320 |
$img_id = intval($img_id); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
321 |
$bc_folders = gallery_imgid_to_folder($img_id); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
322 |
$bc_folders = array_reverse($bc_folders); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
323 |
$bc_url = ''; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
324 |
$breadcrumbs = array(); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
325 |
$breadcrumbs[] = '<a href="' . makeUrlNS('Special', 'Gallery') . '">Gallery index</a>'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
326 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
327 |
foreach ( $bc_folders as $folder ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
328 |
{ |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
329 |
$bc_url .= '/' . dirtify_page_id($folder); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
330 |
$breadcrumbs[] = '<a href="' . makeUrlNS('Special', 'Gallery' . $bc_url, false, true) . '">' . htmlspecialchars($folder) . '</a>'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
331 |
} |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
332 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
333 |
$breadcrumbs[] = htmlspecialchars($row['img_title']); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
334 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
335 |
// From here, this breadcrumb stuff is a piece of... sourdough French bread :-) *smacks lips* |
11
3c4304fae21e
Updated browser and viewimage to use the breadcrumbs css class in enano-shared; this breaks 1.0 compatibility
Dan
parents:
9
diff
changeset
|
336 |
echo '<div class="breadcrumbs" style="padding: 4px; margin-bottom: 7px;">'; |
0
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
337 |
// The actual breadcrumbs |
11
3c4304fae21e
Updated browser and viewimage to use the breadcrumbs css class in enano-shared; this breaks 1.0 compatibility
Dan
parents:
9
diff
changeset
|
338 |
echo '<small>' . implode(' » ', $breadcrumbs) . '</small>'; |
0
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
339 |
echo '</div>'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
340 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
341 |
echo '<div style="text-align: center; margin: 10px auto; border: 1px solid #DDDDDD; padding: 7px 10px; display: table;">'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
342 |
$img_url = makeUrlNS('Special', 'GalleryFetcher/preview/' . $img_id); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
343 |
$img_href = makeUrlNS('Special', 'GalleryFetcher/full/' . $img_id); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
344 |
|
25
d9f37d2ea2cf
Fixed race condition on canvas init (caused boxes to appear off by ~320px); fixed JSON response of null when row[img_tags] is NULL
Dan
parents:
24
diff
changeset
|
345 |
// The actual image |
22
593180f9eea9
... Except now the IE hack broke Safari and Gran Paradiso.
Dan
parents:
19
diff
changeset
|
346 |
$iehack = ( strstr(@$_SERVER['HTTP_USER_AGENT'], 'MSIE') ) ? ' style="width: 1px;"' : ''; |
25
d9f37d2ea2cf
Fixed race condition on canvas init (caused boxes to appear off by ~320px); fixed JSON response of null when row[img_tags] is NULL
Dan
parents:
24
diff
changeset
|
347 |
echo '<div snapr:imgid="' . $img_id . '"' . $iehack . '><img onload="snapr_lock_onload_img = false; snapr_tags_onload_real();" alt="Image preview (640px max width)" src="' . $img_url . '" id="snapr_preview_img" style="border-width: 0; margin-bottom: 5px; display: block;" /></div>'; |
0
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
348 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
349 |
echo '<table border="0" width="100%"><tr><td style="text-align: left; width: 24px;">'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
350 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
351 |
// Prev button |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
352 |
if ( $prev ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
353 |
echo '<a href="' . $prev_url . '"><img style="border-width: 0px;" alt="< Previous" src="' . scriptPath . '/plugins/gallery/prev.gif" /></a>'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
354 |
//echo '</td><td style="text-align: left;">'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
355 |
// if ( $prev ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
356 |
// echo '<a href="' . $prev_url . '">previous image</a>'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
357 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
358 |
echo '</td><td style="text-align: center; letter-spacing: 5px;">'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
359 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
360 |
// Image title |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
361 |
echo $title_spacey; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
362 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
363 |
echo '</td><td style="text-align: right; width: 24px;">'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
364 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
365 |
// Next button |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
366 |
if ( $next ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
367 |
// echo '<a href="' . $next_url . '">next image</a>'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
368 |
//echo '</td><td style="text-align: right;">'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
369 |
if ( $next ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
370 |
echo '<a href="' . $next_url . '"><img style="border-width: 0px;" alt="< Previous" src="' . scriptPath . '/plugins/gallery/next.gif" /></a>'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
371 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
372 |
echo '</td></tr>'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
373 |
echo '<tr><td colspan="3">' . "image $folder_this of $folder_total" . '</td></tr>'; |
18
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
374 |
if ( $perms->get_permissions('gal_full_res') || $have_notes ) |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
375 |
{ |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
376 |
echo '<tr><td colspan="3"><small>'; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
377 |
|
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
378 |
if ( $perms->get_permissions('gal_full_res') ) |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
379 |
echo "<a href=\"$img_href\" onclick=\"window.open(this.href, '', 'toolbar=no,address=no,menus=no,status=no,scrollbars=yes'); return false;\">View in original resolution</a>"; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
380 |
|
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
381 |
if ( $perms->get_permissions('gal_full_res') && $have_notes ) |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
382 |
echo ' :: '; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
383 |
|
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
384 |
if ( $have_notes ) |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
385 |
echo 'Mouse over photo to view tags'; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
386 |
|
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
387 |
echo '</small></td></tr>'; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
388 |
} |
0
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
389 |
echo '</table>'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
390 |
echo '</div>'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
391 |
|
18
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
392 |
if ( $session->user_level >= USER_LEVEL_ADMIN || $perms->get_permissions('snapr_add_tag') ) |
0
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
393 |
{ |
18
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
394 |
echo '<div style="float: right;">'; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
395 |
if ( $session->user_level >= USER_LEVEL_ADMIN ) |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
396 |
echo '[ <a href="' . makeUrlNS('Special', 'GalleryUpload', 'edit_img=' . $img_id, true) . '">edit image</a> ] '; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
397 |
if ( $perms->get_permissions('snapr_add_tag') ) |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
398 |
echo '[ <a href="#" onclick="snapr_add_tag(); return false;"><img alt=" " src="' . scriptPath . '/plugins/gallery/tag-image.gif" style="border-width: 0;" /> add a tag</a> ] '; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
11
diff
changeset
|
399 |
echo '</div>'; |
0
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
400 |
} |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
401 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
402 |
if ( !empty($row['img_desc']) ) |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
403 |
{ |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
404 |
echo '<h2>Image description</h2>'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
405 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
406 |
$desc = RenderMan::render($row['img_desc']); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
407 |
echo $desc; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
408 |
} |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
409 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
410 |
echo '<div class="tblholder" style="font-size: smaller; display: table;' . ( empty($row['img_desc']) ? '' : 'margin: 0 auto;' ) . '"> |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
411 |
<table border="0" cellspacing="1" cellpadding="3">'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
412 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
413 |
// By the time I got to this point, it was 1:32AM (I was on vacation) and my 5-hour playlist on my iPod had been around about 3 times today. |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
414 |
// So I'm glad this is like the last thing on the list tonight. |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
415 |
|
9
ebd7003e73c6
Snapr now works with Enano's HTML/gzip optimization switches (1.0 compatibility broken, need 1.0.1 now)
Dan
parents:
2
diff
changeset
|
416 |
$ext = get_file_extension($row['img_filename']); |
ebd7003e73c6
Snapr now works with Enano's HTML/gzip optimization switches (1.0 compatibility broken, need 1.0.1 now)
Dan
parents:
2
diff
changeset
|
417 |
$ext = strtoupper($ext); |
ebd7003e73c6
Snapr now works with Enano's HTML/gzip optimization switches (1.0 compatibility broken, need 1.0.1 now)
Dan
parents:
2
diff
changeset
|
418 |
|
0
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
419 |
echo '<tr><th colspan="2">Image details</th></tr>'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
420 |
echo '<tr><td class="row2">Uploaded:</td><td class="row1">' . date('F d, Y h:i a', $row['img_time_upload']) . '</td></tr>'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
421 |
echo '<tr><td class="row2">Last modified:</td><td class="row1">' . date('F d, Y h:i a', $row['img_time_mod']) . '</td></tr>'; |
9
ebd7003e73c6
Snapr now works with Enano's HTML/gzip optimization switches (1.0 compatibility broken, need 1.0.1 now)
Dan
parents:
2
diff
changeset
|
422 |
echo '<tr><td class="row2">Original format:</td><td class="row1">' . $ext . '</td></tr>'; |
ebd7003e73c6
Snapr now works with Enano's HTML/gzip optimization switches (1.0 compatibility broken, need 1.0.1 now)
Dan
parents:
2
diff
changeset
|
423 |
echo '<tr><td class="row3" colspan="2" style="text-align: center;"><a href="' . makeUrlNS('Special', 'GalleryFetcher/full/' . $img_id, 'download', 'true') . '">Download image</a></td></tr>'; |
0
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
424 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
425 |
echo '</table></div>'; |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
426 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
427 |
$template->footer(); |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
428 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
429 |
} |
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
430 |
|
7caf561c50ee
Initial population; browser, viewer, uploader, and security are working
Dan
parents:
diff
changeset
|
431 |
?> |