-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuploadend.php
106 lines (102 loc) · 4.34 KB
/
uploadend.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
$path_parts = pathinfo($_SERVER['REQUEST_URI']);
$scriptpath = $path_parts['dirname'];
$serverpath = $_SERVER['SERVER_NAME']
?>
<br>
<div class="w3-bar w3-black">
<button class="w3-bar-item w3-button tablink w3-blue" onclick="openLink(event,'duzurl')">Düz URL</button>
<button class="w3-bar-item w3-button tablink" onclick="openLink(event,'bbcodeimg')">BBCode IMG</button>
<button class="w3-bar-item w3-button tablink" onclick="openLink(event,'direkurl')">Direk URL</button>
</div>
<div id="duzurl" class="w3-container w3-display-container link">
<span onclick="this.parentElement.style.display='none'"
class="w3-button w3-large w3-display-topright">×</span>
<input class="w3-input w3-animate-input w3-round-large w3-light-grey" type="text" id="copyTarget" value="<?php echo $serverpath.$scriptpath."/image/".$fileoutname; ?>">
<button class="w3-tag w3-round-large w3-light-grey" id="copyButton">Kopyala</button>
</div>
<div id="bbcodeimg" class="w3-container w3-display-container link" style="display:none">
<span onclick="this.parentElement.style.display='none'"
class="w3-button w3-large w3-display-topright">×</span>
<input class="w3-input w3-animate-input w3-round-large w3-light-grey" type="text" id="copyTarget" value="[url="<?php echo $serverpath.$scriptpath."/image/".$fileoutname; ?>"][img]<?php echo $serverpath.$scriptpath."/images/".$fileoutname; ?>[/img][/url]">
<button class="w3-tag w3-round-large w3-light-grey" id="copyButton">Kopyala</button>
</div>
<div id="direkurl" class="w3-container w3-display-container link" style="display:none">
<span onclick="this.parentElement.style.display='none'"
class="w3-button w3-large w3-display-topright">×</span>
<input class="w3-input w3-animate-input w3-round-large w3-light-grey" type="text" id="copyTarget" value="<?php echo $serverpath.$scriptpath."/images/".$fileoutname; ?>">
<button class="w3-tag w3-round-large w3-light-grey" id="copyButton">Kopyala</button>
</div>
<script>
function openLink(evt, linkName) {
var i;
var x = document.getElementsByClassName("link");
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
var tablinks = document.getElementsByClassName("tablink");
for (i = 0; i < x.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" w3-blue", "");
}
document.getElementById(linkName).style.display = "block";
evt.currentTarget.className += " w3-blue";
}
</script>
<br>
<br>
<div class="view">
<img class="w3-border" src="<?php echo $filemovedir.$fileoutname; ?>" style="display:block;margin-left:auto;margin-right:auto;width:70%" />
</div>
<hr>
<script>
document.getElementById("copyButton").addEventListener("click", function() {
copyToClipboard(document.getElementById("copyTarget"));
});
function copyToClipboard(elem) {
// create hidden text element, if it doesn't already exist
var targetId = "_hiddenCopyText_";
var isInput = elem.tagName === "INPUT" || elem.tagName === "TEXTAREA";
var origSelectionStart, origSelectionEnd;
if (isInput) {
// can just use the original source element for the selection and copy
target = elem;
origSelectionStart = elem.selectionStart;
origSelectionEnd = elem.selectionEnd;
} else {
// must use a temporary form element for the selection and copy
target = document.getElementById(targetId);
if (!target) {
var target = document.createElement("textarea");
target.style.position = "absolute";
target.style.left = "-9999px";
target.style.top = "0";
target.id = targetId;
document.body.appendChild(target);
}
target.textContent = elem.textContent;
}
// select the content
var currentFocus = document.activeElement;
target.focus();
target.setSelectionRange(0, target.value.length);
// copy the selection
var succeed;
try {
succeed = document.execCommand("copy");
} catch(e) {
succeed = false;
}
// restore original focus
if (currentFocus && typeof currentFocus.focus === "function") {
currentFocus.focus();
}
if (isInput) {
// restore prior selection
elem.setSelectionRange(origSelectionStart, origSelectionEnd);
} else {
// clear temporary content
target.textContent = "";
}
return succeed;
}
</script>