* @package plugins
* @subpackage ldapfolderinfo
* @version $Id: subscription.php,v 1.2 2006/11/22 13:21:23 avel Exp $
*/
if (file_exists('../../include/init.php')) {
include_once('../../include/init.php');
} else if (file_exists('../../include/validate.php')) {
define('SM_PATH','../../');
require_once(SM_PATH . 'include/validate.php');
require_once(SM_PATH . 'functions/plugin.php');
require_once(SM_PATH . 'functions/html.php');
}
/* SquirrelMail required files. */
require_once(SM_PATH . 'functions/imap.php');
/* LDAP stuff */
include_once(SM_PATH . 'plugins/ldapuserdata/functions.php');
include_once(SM_PATH . 'plugins/ldapfolderinfo/include/functions.inc.php');
include_once(SM_PATH . 'plugins/useracl/imap_acl.php');
global $ldap, $folderattributes, $ldap_base_dn, $permarray, $username;
/* get globals we may need */
sqgetGlobalVar('username', $username, SQ_SESSION);
sqgetGlobalVar('key', $key, SQ_COOKIE);
sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
sqgetGlobalVar('success', $success, SQ_GET);
/* end of get globals */
$imapConnection = sqimap_login ($username, $key, $imapServerAddress, $imapPort, 0);
// force retrieval of a non cached folderlist
$boxes = sqimap_mailbox_list($imapConnection,true);
/* Actions */
/* Actions are handled ATM by existing Squirrelmail scripts. */
/*
if( (isset($_POST['subscribe']) || isset($_POST['unsubscribe']) ) && isset($_POST['mailbox']) ) {
$mailbox = $_POST['mailbox'];
if (isset($_POST['subscribe'])) {
if($no_list_for_subscribe && $imap_server_type == 'cyrus') {
if(!sqimap_mailbox_exists($imapConnection, $mailbox[0])) {
header("Location: $location/folders.php?success=subscribe-doesnotexist");
sqimap_logout($imapConnection);
exit(0);
}
}
for ($i=0; $i < count($mailbox); $i++) {
$mailbox[$i] = trim($mailbox[$i]);
sqimap_subscribe ($imapConnection, $mailbox[$i]);
}
$success = 'subscribe';
} elseif($_POST['unsubscribe']) {
for ($i=0; $i < count($mailbox); $i++) {
$mailbox[$i] = trim($mailbox[$i]);
sqimap_unsubscribe ($imapConnection, $mailbox[$i]);
}
$success = 'unsubscribe';
}
}
*/
$boxes_all = sqimap_mailbox_list_all ($imapConnection);
sqimap_logout($imapConnection);
$folderinfo = ldapfolderinfo_cache_ldap($boxes_all);
/**
* ================== Presentation Logic ==================
*/
displayPageHeader($color, 'None');
bindtextdomain ('ldapfolderinfo', SM_PATH . 'plugins/ldapfolderinfo/locale');
textdomain ('ldapfolderinfo');
echo '
' .
html_tag( 'table', '', 'center', $color[0], 'width="95%" cellpadding="1" cellspacing="0" border="0"' ) .
html_tag( 'tr' ) .
html_tag( 'td', '', 'center' ) . '' . _("Folders") . '' .
html_tag( 'table', '', 'center', '', 'width="100%" cellpadding="5" cellspacing="0" border="0"' ) .
html_tag( 'tr' ) .
html_tag( 'td', '', 'center', $color[4] );
if ( isset($success) && $success ) {
$td_str = '';
switch ($success)
{
case 'subscribe':
$td_str .= _("Subscribed successfully!");
break;
case 'unsubscribe':
$td_str .= _("Unsubscribed successfully!");
break;
case 'subscribe-doesnotexist':
$td_str .= _("Subscription Unsuccessful - Folder does not exist.");
break;
}
$td_str .= '
';
/* Subscribed Folders */
echo html_tag( 'table',
html_tag( 'tr',
html_tag( 'td', $td_str .
'' . _("refresh folder list") . '' , 'center' )
) ,
'center', '', 'width="100%" cellpadding="4" cellspacing="0" border="0"' );
}
echo "\n
";
/**
* -------------------- UNSUBSCRIBE FOLDERS --------------------
*/
echo html_tag( 'table', '', 'center', '', 'width="95%" cellpadding="4" cellspacing="0" border="0"' ) .
html_tag( 'tr',
html_tag( 'td', '' . _("Unsubscribe") . '', 'center', $color[9], 'colspan="2"' )
) .
html_tag( 'tr' ) . html_tag( 'td', '', 'center', $color[0], 'width="100%"' );
/* if ($count_special_folders < count($boxes)) { */ /* WTF? #1 */
echo '