]> git.mxchange.org Git - friendica.git/blob - addon/java_upload/java_upload.php
reinstate send slaps but only at the top level (and followup)
[friendica.git] / addon / java_upload / java_upload.php
1 <?php
2
3 /**
4  *
5  * Java photo uploader, uses Jumploader
6  *
7  * WARNING: This module currently has privacy issues.
8  * The java package does not pass the permissions array intact and could lead to
9  * photos being seen by people that were excluded from seeing them.
10  *
11  */
12
13
14 function java_upload_install() {
15         register_hook('photo_upload_form', 'addon/java_upload/java_upload.php', 'java_upload_form');
16         register_hook('photo_post_init',   'addon/java_upload/java_upload.php', 'java_upload_post_init');
17         register_hook('photo_post_end',    'addon/java_upload/java_upload.php', 'java_upload_post_end');
18 }
19
20
21 function java_upload_uninstall() {
22         unregister_hook('photo_upload_form', 'addon/java_upload/java_upload.php', 'java_upload_form');
23         unregister_hook('photo_post_init',   'addon/java_upload/java_upload.php', 'java_upload_post_init');
24         unregister_hook('photo_post_end',    'addon/java_upload/java_upload.php', 'java_upload_post_end');
25 }
26
27
28 function java_upload_form(&$a,&$b) {
29
30         $uploadurl = $b['post_url'];
31         $sessid = session_id();
32         $archive = $a->get_baseurl() . '/addon/java_upload/jumploader_z.jar';
33         $filestext = t('Select files to upload: ');
34
35         $nojava = t('Use the following controls only if the Java uploader [above] fails to launch.');
36
37         $b['default_upload'] = true;
38
39
40 $b['addon_text'] .= <<< EOT
41
42         <div id="photos-upload-select-files-text">$filestext</div>
43
44         <div id="photos_upload_applet_wrapper">
45                 <applet name="jumpLoaderApplet"
46                         code="jmaster.jumploader.app.JumpLoaderApplet.class"
47                         archive="$archive"
48                         width="700"
49                         height="600"
50                         mayscript >
51                         <param name="uc_uploadUrl" value="$uploadurl" />
52                         <param name="uc_uploadFormName" value="photos-upload-form" />
53                         <param name="gc_loggingLeveL" value="FATAL" />
54                         <param name="uc_fileParameterName" value="userfile" />
55                         <param name="uc_cookie" value="PHPSESSID=$sessid; path=/;" />
56                         <param name="vc_disableLocalFileSystem" value="false" />
57                         <param name="vc_uploadViewMenuBarVisible" value="false" />
58                         <param name="vc_mainViewFileListViewVisible" value="true" />
59                         <param name="vc_mainViewFileListViewHeightPercent" value="50" />
60                         <param name="vc_mainViewFileTreeViewVisible" value="true" />
61                         <param name="vc_mainViewFileTreeViewWidthPercent" value="35" />
62                         <param name="vc_lookAndFeel" value="system" />
63         
64                 </applet>
65                 
66         </div>
67
68         <div id="photos-upload-no-java-message" >
69         $nojava
70         </div>  
71
72 EOT;
73
74 }
75
76
77
78
79
80 function java_upload_photo_post_init(&$a,&$b) {
81
82         if($_POST['partitionCount'])
83                 $a->data['java_upload'] = true;
84         else
85                 $a->data['java_upload'] = false;
86
87
88 }
89
90
91 function java_upload_photo_post_end(&$a,&$b) {
92
93         if(x($a->data,'java_upload') && $a->data['java_upload'])
94                 killme();
95
96 }