aboutsummaryrefslogtreecommitdiff
path: root/views/default/tidypics/image_menu.php
blob: b804c8491b5524652aa84633d5b71b6960f7e022 (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
<?php

	/**************************************************************************
	 *
	 *  Tidypics Image Menu
	 *
	 *  This is the menu that appears below an image. Admins can override the
	 *  menu with a different view to provide a look and feel that matches
	 *  their themes. The view can be extended to provide additional controls.
	 *
	 **************************************************************************/

	$image_guid = $vars['image_guid'];
	$viewer = $vars['viewer'];
	$owner = $vars['owner'];
	$anytags = $vars['anytags'];
	$album = $vars['album'];

	if (get_plugin_setting('tagging', 'tidypics') != "disabled") {
		
		$can_tag = false;
		
		$container = get_entity($album->container_guid);
		if ($container instanceof ElggGroup) {
			$can_tag = $viewer && $container->isMember($viewer);
		} else {
			$can_tag = $viewer && $viewer->guid == $owner->guid || user_is_friend($owner->guid, $viewer->guid);
		}
		
		// only owner and friends of owner can tag
		if ($can_tag) {
?>
<li id="start_tagging"><a id="tidypics_tag_control" href="javascript:void(0)" onclick="startTagging()"><?= elgg_echo('tidypics:tagthisphoto') ?></a></li>
<?php
		}
		
		// only owner can delete tags
		if ($anytags && $viewer && $viewer->guid == $owner->guid) {
?>
<li id="delete_tags"><a href="javascript:void(0)" onclick="deleteTags()"><?= elgg_echo('tidypics:deletetag') ?></a></li>
<?php
		}
	}
	
	if (get_plugin_setting('download_link', 'tidypics') != "disabled") {
		$ts = time();
		$token = generate_action_token($ts);
	    	
		$download_url = $vars['url'] . "action/tidypics/download?file_guid=" . $image_guid . "&amp;__elgg_token=$token&__elgg_ts=$ts"; 
?>
<li id="download_image"><a href="<?php echo $download_url; ?>"><?php echo elgg_echo("image:download"); ?></a></li>
<?php
	} 
?>