forked from web-cyradm/web-cyradm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathace.php
51 lines (49 loc) · 1.15 KB
/
ace.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
<?php
session_name('web-cyradm-session');
session_start();
if ($_SESSION['session_ok'] === TRUE){
?>
<html>
<body>
<?php
@include 'Net/IDNA.php';
$field = 'domain';
if (!empty($_GET['newdomain'])) {
$_GET['domain'] = $_GET['newdomain'];
$field = 'newdomain';
}
if (!empty($_GET['domain']) && substr($_GET['domain'],0,4) != 'xn--') {
if (class_exists("Net_IDNA")) {
$idn = Net_IDNA::getInstance();
$_GET['domain'] = iconv($_GET['charset'],'UTF-8',$_GET['domain']);
$ACE = $idn->encode($_GET['domain']);
?>
<script>
<!--
self.opener.document.mainform.<?php echo $field; ?>.value = '<?php echo $ACE; ?>';
self.close();
//-->
</script>
<?php
} else {
?>
<center>
<?php print _("To use Internationalized Domain Names (IDNs) you should install Net_IDNA class from");?> <a href="http://pear.php.net/package/Net_IDNA" target="_blank">pear.php.net</a><br>
<a href="javascript:self.close();"><?php print _("Close"); ?></a>
</center>
<?php
}
} else {
?>
<center>
<?php print _("Invalid domain name"); ?><br>
<a href="javascript:self.close();"><?php print _("Close"); ?></a>
</center>
<?php
}
?>
</body>
</html>
<?php
}
?>