blob: 309058e1c3efe0fc679f5f5255153e7cbc63f3f5 (
plain)
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
|
<?php
/**
* Tidypics Add Tag
*
*/
gatekeeper();
action_gatekeeper();
$coordinates_str = get_input('coordinates');
error_log($coordinates_str);
$user_id = get_input('user_id');
$image_guid = get_input('image_guid');
$word = get_input('word');
error_log($word);
error_log($user_id);
if ($image_guid == 0) {
register_error("error");
forward($_SERVER['HTTP_REFERER']);
}
$image = get_entity($image_guid);
if (!$image)
{
register_error(elgg_echo("image:phototagging:notexists"));
forward($_SERVER['HTTP_REFERER']);
}
if ($user_id != 0) {
$relationships_type = 'user';
$value = $user_id;
} else {
$relationships_type = 'word';
$value = $word;
}
// test for empty tag
// create string for javascript tag object
$tag->coords = $coordinates_str;
$tag->type = $relationships_type;
$tag->value = $value;
$access_id = $image->getAccessID();
$owner_id = get_loggedin_userid();
//Save annotation
if ($image->annotate('phototag', serialize($tag), $access_id, $owner_id)) {
system_message(elgg_echo("image:tagged"));
}
forward($_SERVER['HTTP_REFERER']);
?>
|