adding squirrelmail to the index of the panel

This commit is contained in:
Benjamin Sonntag 2012-08-30 10:16:05 +00:00
parent db85f73d58
commit 594b264843
5 changed files with 77 additions and 4 deletions

1
.gitattributes vendored
View File

@ -502,6 +502,7 @@ selenium/20120826-alternc-panel-testsuite.html -text
selenium/README -text
selenium/alternc.domain-local-mail-tld.html -text
squirrelmail/Makefile -text
squirrelmail/class/m_squirrelmail.php -text
squirrelmail/squirrelmail-install -text
squirrelmail/templates/apache2/squirrelmail.conf -text
squirrelmail/templates/javascript-common/javascript-common.conf -text

View File

@ -83,10 +83,14 @@ if (!$_SERVER[HTTPS]) {
</td></tr>
<tr><td>
<?php if (variable_get("webmail_redirect","")) { ?>
<p><a href="/webmail"><?php __("If you want to read your mail, click here and enter your Email address and password in the next form, then click 'Enter'."); ?></a></p>
<?php } ?>
</td><td>
<?php
// Here we used to have a form to enter the squirrelmail's webmail.
// Following the "rule of less astonishment, we try to put it here again, even though the webmail is now a plugin.
$res=$hooks->invoke("hook_admin_webmail");
foreach($res as $r) if ($r!==false) echo $r;
?></td><td>
</td></tr>

View File

@ -4,3 +4,4 @@ etc/alternc/templates/apache2
etc/alternc/templates/javascript-common
etc/squirrelmail
usr/lib/alternc/install.d
var/alternc/bureau/class

View File

@ -27,3 +27,5 @@ install:
install -m 750 squirrelmail-install $(DESTDIR)/usr/lib/alternc/install.d/
# domaintype template:
install -m 644 templates/apache2/squirrelmail.conf $(DESTDIR)/etc/alternc/templates/apache2/squirrelmail.conf
# Desktop files
install -o 1999 -g 1999 -m 644 class/m_squirrelmail.php $(DESTDIR)/var/alternc/bureau/class/

View File

@ -0,0 +1,65 @@
<?php
/*
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2000-2012 by the AlternC Development Team.
https://alternc.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Purpose of file: Manage Squirrelmail webmail configuration
----------------------------------------------------------------------
*/
/**
* This class handle squirrelmail's webmail
* hook the main panel page to add a link to the webmail
*/
class m_squirrelmail {
function hook_admin_webmail() {
global $db;
// not found ? use admin account (2000)
$account=2000;
// Search for the domain where the panel is hosted, then search for a webmail in it.
$i=2;
$domain="";
do { // for each domain part (search panel.alternc.org then alternc.org then org, if the current panel is at www.panel.alternc.org)
list($host,$domain)=explode(".",$_SERVER["HTTP_HOST"],$i);
$dompart=$mat[1];
// We search for a 'squirrelmail' subdomain in that domain
$db->query("SELECT * FROM subdomaines s WHERE s.domaine='".addslashes($dompart)."' AND s.type='squirrelmail';");
if ($db->next_record()) {
$domain=$db->Record;
return "<p><a href=\"http://".$dompart["sub"].(($dompart["sub"])?".":"").$dompart["domaine"]."\">"._("To read your mail in a browser, click here to use the Squirrelmail Webmail")."</a></p>\n";
}
$i++;
} while (strpos($dompart,'.')!==false);
// not found: search for a webmail in the admin user account
$db->query("SELECT * FROM subdomaines s WHERE s.compte=2000 AND s.type='squirrelmail';");
if ($db->next_record()) {
$domain=$db->Record;
return "<p><a href=\"http://".$dompart["sub"].(($dompart["sub"])?".":"").$dompart["domaine"]."\">"._("To read your mail in a browser, click here to use the Squirrelmail Webmail")."</a></p>\n";
}
}
} /* Class Squirrelmail */