add multible email patch
This commit is contained in:
parent
8a334881bd
commit
e8d8d896ad
159
MultipleAdmin.php
Normal file
159
MultipleAdmin.php
Normal file
@ -0,0 +1,159 @@
|
||||
<?php
|
||||
/**
|
||||
* Display pending requests for logged in users.
|
||||
*
|
||||
* @author Brian Wong
|
||||
* @author Jeremy Fowler <jfowler06@users.sourceforge.net>
|
||||
* @version 04-03-07
|
||||
* @package MailZu
|
||||
*
|
||||
* Copyright (C) 2005 - 2007 MailZu
|
||||
* License: GPL, see LICENSE
|
||||
*/
|
||||
/**
|
||||
* Include Template class
|
||||
*/
|
||||
include_once('lib/Template.class.php');
|
||||
/**
|
||||
* Include common output functions
|
||||
*/
|
||||
include_once('templates/common.template.php');
|
||||
/**
|
||||
* Include quarantine-specific output functions
|
||||
*/
|
||||
include_once('templates/quarantine.template.php');
|
||||
/**
|
||||
* Include DB class
|
||||
*/
|
||||
include_once('lib/DBEngine.class.php');
|
||||
|
||||
if (!Auth::is_logged_in()) {
|
||||
Auth::print_login_msg(); // Check if user is logged in
|
||||
}
|
||||
|
||||
//Get content type
|
||||
$content_type = (CmnFns::get_ctype() ? CmnFns::get_ctype() : 'A');
|
||||
|
||||
$_SESSION['sessionNav'] = "Multiple Accounts";
|
||||
$t = new Template(translate('Multiple Accounts'));
|
||||
|
||||
$db = new DBEngine();
|
||||
|
||||
$t->printHTMLHeader();
|
||||
$t->printWelcome();
|
||||
$t->startMain();
|
||||
|
||||
// Break table into 2 columns, put quick links on left side and all other tables on the right
|
||||
startQuickLinksCol();
|
||||
showQuickLinks(); // Print out My Quick Links
|
||||
startDataDisplayCol();
|
||||
|
||||
echo '<br>';
|
||||
|
||||
// Print a loading message until database returns...
|
||||
printMessage(translate('Retrieving Messages...'));
|
||||
|
||||
// Connect to mysql and database
|
||||
$db_connect = @mysql_pconnect($conf['db']['hostSpec'],$conf['db']['dbUser'],$conf['db']['dbPass']) or die ("<html><body><h1>ERROR connecting to server</h1><br></body></html>"."\n");
|
||||
mysql_select_db ( $conf['db']['dbName'], $db_connect ) or die ("<html><body><h1>ERROR opening db</h1><br></body></html>"."\n");
|
||||
|
||||
// A simple query to the "Multiple" table to detect if we need to create one
|
||||
if(!(mysql_query("SELECT * FROM mailzu_multiple")))
|
||||
{
|
||||
// It didn exist so create one.
|
||||
$sql_mult_create = mysql_query("
|
||||
CREATE TABLE IF NOT EXISTS `mailzu_multiple` (
|
||||
`mult_id` int(11) NOT NULL auto_increment,
|
||||
`mult_email` varchar(64) default NULL,
|
||||
`mult_attach` varchar(64) default NULL,
|
||||
PRIMARY KEY (`mult_id`)
|
||||
)
|
||||
");
|
||||
|
||||
// Simple Javascript to force a page reload
|
||||
echo "
|
||||
<script language=\"javascript\">
|
||||
window.location=\"./MultipleAdmin.php\";
|
||||
</script>
|
||||
";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fetch all entries query
|
||||
$sql_emails_query = mysql_query("SELECT * FROM mailzu_multiple ORDER BY mult_email");
|
||||
$sql_emails_rows = mysql_num_rows($sql_emails_query);
|
||||
|
||||
// Delete entry
|
||||
if ($_GET['del']>='0')
|
||||
{
|
||||
$multi_delete = "DELETE FROM mailzu_multiple WHERE mult_id='".$_GET['del']."'";
|
||||
mysql_query($multi_delete);
|
||||
echo "
|
||||
|
||||
// Reload page
|
||||
<script language=\"javascript\">
|
||||
window.location=\"./MultipleAdmin.php\";
|
||||
</script>
|
||||
";
|
||||
}
|
||||
|
||||
// Insert entry
|
||||
else if ($_GET['edit']>='new')
|
||||
{
|
||||
mysql_query("insert into mailzu_multiple(mult_email,mult_attach) values('".$_POST[mult_emailacc]."','".$_POST[mult_emailatt]."')");
|
||||
echo "
|
||||
|
||||
// Reload page
|
||||
<script language=\"javascript\">
|
||||
window.location=\"./MultipleAdmin.php\";
|
||||
</script>
|
||||
";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Draw the table
|
||||
echo '
|
||||
<table border=\"1\">
|
||||
<tr>
|
||||
<td><b>'; echo translate('Email address'); echo '</b></td>
|
||||
<td><b>'; echo translate('Attached Email'); echo '</b></td>
|
||||
</tr>
|
||||
';
|
||||
|
||||
// Fetch entries one by one
|
||||
while($fetch_row = mysql_fetch_array($sql_emails_query))
|
||||
{
|
||||
if ($sql_emails_rows!=0)
|
||||
{
|
||||
extract($fetch_row);
|
||||
|
||||
echo "
|
||||
<tr>
|
||||
<td>$mult_email</td>
|
||||
<td>$mult_attach</td>
|
||||
<td><A HREF=\"./MultipleAdmin.php?del=$mult_id\"><IMG border=\"0\" SRC=\"./img/delete.gif\"></A></td>
|
||||
</tr>";
|
||||
}
|
||||
}
|
||||
|
||||
// Display option to create a new entry
|
||||
echo "
|
||||
<tr>
|
||||
<FORM name=\"mult_form\" method=\"post\" action=\"./MultipleAdmin.php?edit=new\">
|
||||
<td><input type=\"text\" maxlength=\"59\" name=\"mult_emailacc\"></td>
|
||||
<td><input type=\"text\" maxlength=\"59\" name=\"mult_emailatt\"></td>
|
||||
<td><A HREF=\"javascript:document.mult_form.submit()\"><IMG border=\"0\" SRC=\"./img/edit.gif\"></A></td>
|
||||
</FORM>
|
||||
</tr>
|
||||
</table>
|
||||
";
|
||||
}
|
||||
}
|
||||
|
||||
// Hide the message after the table loads.
|
||||
hideMessage(translate('Retrieving Messages...'));
|
||||
|
||||
endDataDisplayCol();
|
||||
$t->endMain();
|
||||
$t->printHTMLFooter();
|
||||
?>
|
BIN
img/delete.gif
Normal file
BIN
img/delete.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 217 B |
BIN
img/edit.gif
Normal file
BIN
img/edit.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 555 B |
@ -302,6 +302,7 @@ $strings['Clear All'] = "Clear All";
|
||||
$strings['Access Denied'] = "Access Denied";
|
||||
$strings['My Pending Requests'] = "My Pending Requests";
|
||||
$strings['Site Pending Requests'] = "Site Pending Requests";
|
||||
$strings['Multiple Accounts'] = "Multiple Accounts";
|
||||
$strings['Cancel Request'] = "Cancel Request";
|
||||
$strings['User is not allowed to login'] = "User is not allowed to login";
|
||||
$strings['Authentication successful'] = "Authentication successful";
|
||||
@ -341,4 +342,6 @@ $strings['Rule'] = 'Rule';
|
||||
$strings['My rules'] = 'My Rules';
|
||||
$strings['Site Rules'] = 'Site Rules';
|
||||
$strings['Search for rules whose:'] = 'Search for rules whose:';
|
||||
$strings['Retrieving Configuration...'] = 'Retrieving Configuration...';
|
||||
$strings['Attached Email'] = 'Attached Email';
|
||||
?>
|
||||
|
@ -284,6 +284,7 @@ $strings['Clear All'] = "Limpar Todas";
|
||||
$strings['Access Denied'] = "Acesso Negado";
|
||||
$strings['My Pending Requests'] = "Minhas Pendências<br /> de Liberação";
|
||||
$strings['Site Pending Requests'] = "Pendências de Liberação";
|
||||
$strings['Multiple Accounts'] = "Contas Múltiplas";
|
||||
$strings['Cancel Request'] = "Cancelar Requisição";
|
||||
$strings['User is not allowed to login'] = "Usuário sem permissão para entar";
|
||||
$strings['Authentication successful'] = "Autenticação efetuada com sucesso";
|
||||
@ -309,5 +310,7 @@ $strings['There are no matching records.'] = 'Nenhum registro encontrado.';
|
||||
$strings['Domain'] = 'Dominio';
|
||||
$strings['X-Amavis-Alert'] = 'X-Amavis-Alert';
|
||||
$strings['Loading Summary...'] = 'Loading Summary...';
|
||||
$strings['Retrieving Messages...'] = 'Retrieving Messages...';
|
||||
$strings['Retrieving Messages...'] = 'Aguarde: A abrir as mensagens...';
|
||||
$strings['Retrieving Configuration...'] = 'Aguarde: A abrir as configurações...';
|
||||
$strings['Attached Email'] = 'Email Anexado';
|
||||
?>
|
||||
|
@ -71,6 +71,39 @@ printMessage(translate('Retrieving Messages...'));
|
||||
|
||||
$messages = $db->get_user_messages($content_type, $_SESSION['sessionMail'], CmnFns::get_value_order($order), CmnFns::get_vert_order(), $search_array, 0, 0, $requestedPage);
|
||||
|
||||
|
||||
//// MULTI EMAIL ATTACHMENT ////
|
||||
// check if email attachement occurred once. Dont run twice.
|
||||
|
||||
if ($_SESSION['mult_flag'] != "1")
|
||||
{
|
||||
// flag variable to know that this code was already run
|
||||
$_SESSION['mult_flag']='1';
|
||||
|
||||
// count number of items in session array
|
||||
$mult_array_count = count ($_SESSION['sessionMail']);
|
||||
|
||||
// query database to fetch attached emails
|
||||
|
||||
$db_connect = @mysql_pconnect($conf['db']['hostSpec'],$conf['db']['dbUser'],$conf['db']['dbPass']) or die ("<html><body><h1>ERROR connecting to server</h1><br></body></html>"."\n");
|
||||
mysql_select_db ( $conf['db']['dbName'], $db_connect ) or die ("<html><body><h1>ERROR opening db</h1><br></body></html>"."\n");
|
||||
|
||||
// concatenate array with attached emails
|
||||
|
||||
for ($i = 0; $i < $mult_array_count; $i++)
|
||||
{
|
||||
$sql_emails_query = mysql_query("SELECT * FROM mailzu_multiple WHERE mult_email='".$_SESSION['sessionMail'][$i]."'");
|
||||
while ($row = mysql_fetch_array($sql_emails_query))
|
||||
{
|
||||
extract($row);
|
||||
$_SESSION['sessionMail'][$mult_array_count+$mult_count] = $mult_attach;
|
||||
$mult_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
//// END OF MULTI EMAIL ATTACHMENT CODE
|
||||
|
||||
|
||||
// Compute maximum number of pages
|
||||
$maxPage = (ceil($db->numRows/$sizeLimit)-1);
|
||||
|
||||
|
31
summary.php
31
summary.php
@ -47,6 +47,37 @@ startDataDisplayCol();
|
||||
// Print a loading message until database returns...
|
||||
printMessage(translate('Loading Summary...'));
|
||||
|
||||
//// MULTI EMAIL ATTACHMENT ////
|
||||
// check if email attachement occurred once. Dont run twice.
|
||||
|
||||
if ($_SESSION['mult_flag'] != "1")
|
||||
{
|
||||
// flag variable to know that this code was already run
|
||||
$_SESSION['mult_flag']='1';
|
||||
|
||||
// count number of items in session array
|
||||
$mult_array_count = count ($_SESSION['sessionMail']);
|
||||
|
||||
// query database to fetch attached emails
|
||||
|
||||
$db_connect = @mysql_pconnect($conf['db']['hostSpec'],$conf['db']['dbUser'],$conf['db']['dbPass']) or die ("<html><body><h1>ERROR connecting to server</h1><br></body></html>"."\n");
|
||||
mysql_select_db ( $conf['db']['dbName'], $db_connect ) or die ("<html><body><h1>ERROR opening db</h1><br></body></html>"."\n");
|
||||
|
||||
// concatenate array with attached emails
|
||||
|
||||
for ($i = 0; $i < $mult_array_count; $i++)
|
||||
{
|
||||
$sql_emails_query = mysql_query("SELECT * FROM mailzu_multiple WHERE mult_email='".$_SESSION['sessionMail'][$i]."'");
|
||||
while ($row = mysql_fetch_array($sql_emails_query))
|
||||
{
|
||||
extract($row);
|
||||
$_SESSION['sessionMail'][$mult_array_count+$mult_count] = $mult_attach;
|
||||
$mult_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
//// END OF MULTI EMAIL ATTACHMENT CODE
|
||||
|
||||
$count_array = $db->get_user_summary($_SESSION['sessionMail']);
|
||||
|
||||
showSummary( $count_array );
|
||||
|
@ -103,6 +103,11 @@ function showQuickLinks() {
|
||||
" <p><b>›</b>\t";
|
||||
$link->doLink('domainPendingAdmin.php?ctype=A', translate('Domain Pending Requests'));
|
||||
echo '</p>';
|
||||
echo "Multiple Accounts" == $_SESSION['sessionNav'] ?
|
||||
' <p class="selectedLink"><b>»</b>':
|
||||
" <p><b>›</b>\t";
|
||||
$link->doLink('MultipleAdmin.php', translate('Multiple Accounts'));
|
||||
echo '</p>';
|
||||
echo '<br>';
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user