-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathUploadify.php
66 lines (51 loc) · 2.5 KB
/
Uploadify.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
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
$wgExtensionCredits["other"][] = array(
"name" => "Uploadify Extension",
"author" => "Tobias Strebitzer",
"version" => "0.2.0",
"url" => "http://www.strebitzer.at",
"description" => "uploadify-desc"
);
$wgHooks['SkinBuildSidebar'][] = 'tsUploadifyBox';
$dir = dirname(__FILE__) . '/';
$wgAvailableRights[] = 'uploadify';
$wgSpecialPages['UploadifyHandler'] = 'UploadifyHandler';
$wgAutoloadClasses['UploadifyHandler'] = $dir . "UploadifyHandler.php";
$wgExtensionMessagesFiles['Uploadify'] = $dir . 'Uploadify.i18n.php';
function tsUploadifyBox( $skin, &$bar ) {
global $wgScriptPath, $wgOut, $wgUser;
if ( !$wgUser->isAllowed( 'uploadify' ) ) {
return true;
}
// Add Scripts
$wgOut->addScript("<script language='javascript' type='text/javascript' src='$wgScriptPath/extensions/Uploadify/public/jquery-1.5.min.js'></script>");
$wgOut->addScript("<script language='javascript' type='text/javascript' src='$wgScriptPath/extensions/Uploadify/public/swfobject.js'></script>");
$wgOut->addScript("<script language='javascript' type='text/javascript' src='$wgScriptPath/extensions/Uploadify/public/jquery.uploadify.v2.1.4.min.js'></script>");
// Add Init Script
$script = "$(document).ready(function() {";
$script .= "$('#uploadify').uploadify({";
$script .= "'uploader' : '/extensions/Uploadify/public/uploadify.swf',";
$script .= "'cancelImg' : '/extensions/Uploadify/public/cancel.png',";
$script .= "'script' : '/Special:UploadifyHandler',";
$script .= "'folder' : '/uploads',";
$script .= "'auto' : true,";
$script .= "'multi' : true,";
$script .= "'buttonText': '" . wfMsg('uploadify-button-text') . "',";
$script .= "'removeCompleted': false,";
$script .= "'scriptData': { 'username': wgUserName },";
$script .= "'onComplete': function(event, id, fileObj, response, data) { $(\"div#uploadify\"+id).html(\"<div class='uploadify-mediawiki-result'>\" + response + \"</div>\"); }";
$script .= "});";
$script .= "});";
$wgOut->addScript("<script language='javascript' type='text/javascript'>$script</script>");
// Add Css
$wgOut->addScript("<link rel='stylesheet' type='text/css' href='$wgScriptPath/extensions/Uploadify/public/uploadify.css' media='all'>");
$out = "<div style='padding: 12px 6px;'>";
$out .= "<input id='uploadify' name='uploadify' type='file' />";
$out .= '</div>';
$out .= "<div class='uploadify-file-list-link'><a href='/Special:ListFiles' target='_parent'>";
$out .= wfMsg('uploadify-file-list');
$out .= "</a>";
$bar['Upload'] = $out;
return true;
}
?>