Checkin custom link module
authorJamie Cameron <jcameron@webmin.com>
Sun, 30 Sep 2007 19:59:52 +0000 (19:59 +0000)
committerJamie Cameron <jcameron@webmin.com>
Sun, 30 Sep 2007 19:59:52 +0000 (19:59 +0000)
12 files changed:
link/acl_security.pl [new file with mode: 0644]
link/config [new file with mode: 0644]
link/config.info [new file with mode: 0644]
link/images/icon.gif [new file with mode: 0644]
link/images/smallicon.gif [new file with mode: 0644]
link/index.cgi [new file with mode: 0755]
link/lang/en [new file with mode: 0644]
link/lang/ja_JP.UTF-8 [new file with mode: 0644]
link/lang/ja_JP.euc [new file with mode: 0644]
link/lang/ko_KR.UTF-8 [new file with mode: 0644]
link/lang/ko_KR.euc [new file with mode: 0644]
link/module.info [new file with mode: 0644]

diff --git a/link/acl_security.pl b/link/acl_security.pl
new file mode 100644 (file)
index 0000000..e575f1d
--- /dev/null
@@ -0,0 +1,17 @@
+
+do '../web-lib.pl';
+&init_config();
+
+sub acl_security_form
+{
+print "<tr> <td><b>$text{'acl_link'}</b></td>\n";
+printf "<td colspan=3><input name=link size=50 value='%s'></td> </tr>\n",
+       $_[0]->{'link'};
+}
+
+sub acl_security_save
+{
+$in{'link'} =~ /\S/ || &error($text{'acl_elink'});
+$_[0]->{'link'} = $in{'link'};
+}
+
diff --git a/link/config b/link/config
new file mode 100644 (file)
index 0000000..e163907
--- /dev/null
@@ -0,0 +1,2 @@
+immediate=0
+window=0
diff --git a/link/config.info b/link/config.info
new file mode 100644 (file)
index 0000000..c6a6c6e
--- /dev/null
@@ -0,0 +1,4 @@
+link=URL to link to,0
+desc=Description for URL,3,Automatic
+immediate=Go to URL immediately,1,1-Yes,0-No
+window=Open in separate window?,1,1-Yes,0-No
diff --git a/link/images/icon.gif b/link/images/icon.gif
new file mode 100644 (file)
index 0000000..fb6dede
Binary files /dev/null and b/link/images/icon.gif differ
diff --git a/link/images/smallicon.gif b/link/images/smallicon.gif
new file mode 100644 (file)
index 0000000..9ff74ec
Binary files /dev/null and b/link/images/smallicon.gif differ
diff --git a/link/index.cgi b/link/index.cgi
new file mode 100755 (executable)
index 0000000..2b12b48
--- /dev/null
@@ -0,0 +1,50 @@
+#!/usr/local/bin/perl
+# index.cgi
+# Redirect to another URL
+
+do '../web-lib.pl';
+&init_config();
+do '../ui-lib.pl';
+%access = &get_module_acl();
+$url = $access{'link'} || $config{'link'};
+$host = $ENV{'HTTP_HOST'};
+$host =~ s/:.*$//;
+$url =~ s/\$\{REMOTE_USER\}/$remote_user/g ||
+       $url =~ s/\$REMOTE_USER/$remote_user/g;
+$url =~ s/\$\{HTTP_HOST\}/$host/g ||
+       $url =~ s/\$HTTP_HOST/$host/g;
+if (($url =~ /\$VIRTUALSERVER_/ || $url =~ /\$\{VIRTUALSERVER_/) &&
+    &foreign_check("virtual-server")) {
+       &foreign_require("virtual-server", "virtual-server-lib.pl");
+       $dom = &virtual_server::get_domain_by("user", $remote_user,
+                                             "parent", "");
+       if ($dom) {
+               foreach $k (keys %$dom) {
+                       $uck = "VIRTUALSERVER_".uc($k);
+                       $url =~ s/\$\{$uck\}/$dom->{$k}/g ||
+                               $url =~ s/\$$uck/$dom->{$k}/g;
+                       }
+               }
+       else {
+               &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1);
+               &error($text{'index_evirtualmin'});
+               }
+       }
+if ($url && $config{'immediate'}) {
+       &redirect($access{'link'});
+       }
+else {
+       # Show a link page
+       &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1);
+       if ($url) {
+               $desc = $access{'desc'} || $config{'desc'} ||
+                       "Open URL $url";
+               $target = $config{'window'} ? "target=$module_name" : "";
+               print "<font size=+1><a href='$url' $target>$desc</a></font><p>\n";
+               }
+       else {
+               print &text('index_econfig', "../config.cgi?$module_name"),"<p>\n";
+               }
+       &ui_print_footer("/", $text{'index'});
+       }
+
diff --git a/link/lang/en b/link/lang/en
new file mode 100644 (file)
index 0000000..71b0935
--- /dev/null
@@ -0,0 +1,6 @@
+index_title=Custom Link
+index_econfig=No URL to link to has been configured. <a href='$1'>Click here</a> to specify a URL.
+index_evirtualmin=The URL contains Virtualmin-specific variables, but no server was found for the current user.
+
+acl_link=Redirect to URL
+acl_elink=Missing URL to redirect to
diff --git a/link/lang/ja_JP.UTF-8 b/link/lang/ja_JP.UTF-8
new file mode 100644 (file)
index 0000000..dc4e7ec
--- /dev/null
@@ -0,0 +1,2 @@
+index_title=\83J\83X\83^\83\80 \83\8a\83\93\83N
+index_config=No URL to link to has been configured. <a href='$1'>URL \82
\ No newline at end of file
diff --git a/link/lang/ja_JP.euc b/link/lang/ja_JP.euc
new file mode 100644 (file)
index 0000000..0a09bcd
--- /dev/null
@@ -0,0 +1,2 @@
+index_title=\83J\83X\83^\83\80 \83\8a\83\93\83N
+index_config=No URL to link to has been configured. <a href='$1'>URL \82ð\8ew\92è\82·\82é\82É\82Í</a> \82±\82±\82ð\83N\83\8a\83b\83N\82µ\82Ä\82­\82¾\82³\82¢\81B
diff --git a/link/lang/ko_KR.UTF-8 b/link/lang/ko_KR.UTF-8
new file mode 100644 (file)
index 0000000..e9c8594
--- /dev/null
@@ -0,0 +1,2 @@
+index_title=紫遂切 舛税 元滴
+index_config=元滴 企雌 URL聖 姥失馬走 省紹柔艦陥. <a href='$1'>食奄</a>研 喚君 URL聖 走舛馬淑獣神.
diff --git a/link/lang/ko_KR.euc b/link/lang/ko_KR.euc
new file mode 100644 (file)
index 0000000..5eab959
--- /dev/null
@@ -0,0 +1,2 @@
+index_title=»ç¿ëÀÚ Á¤ÀÇ ¸µÅ©
+index_config=¸µÅ© ´ë»ó URLÀ» ±¸¼ºÇÏÁö ¾Ê¾Ò½À´Ï´Ù. <a href='$1'>¿©±â</a>¸¦ ´­·¯ URLÀ» ÁöÁ¤ÇϽʽÿÀ.
diff --git a/link/module.info b/link/module.info
new file mode 100644 (file)
index 0000000..30c2eb2
--- /dev/null
@@ -0,0 +1,6 @@
+name=Link
+desc=Custom Link
+category=others
+version=1.3
+depends=1.170
+readonly=1