本文整理汇总了PHP中imap_get_quotaroot函数的典型用法代码示例。如果您正苦于以下问题:PHP imap_get_quotaroot函数的具体用法?PHP imap_get_quotaroot怎么用?PHP imap_get_quotaroot使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了imap_get_quotaroot函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSystemStatus
function getSystemStatus($email, $passw)
{
global $arrLang;
global $arrConf;
$dbEmails = new paloDB("sqlite3:///{$arrConf['elastix_dbdir']}/email.db");
if ($email != '' && $passw != '') {
$imap = imap_open("{localhost:143/notls}", "{$email}", "{$passw}");
} else {
return $arrLang["You don't have a webmail account"];
}
if (!$imap) {
return $arrLang["Imap: Connection error"];
}
$quotainfo = imap_get_quotaroot($imap, "INBOX");
imap_close($imap);
$content = $arrLang["Quota asigned"] . " {$quotainfo['limit']} KB<br>" . $arrLang["Quota Used"] . " {$quotainfo['usage']} KB<br>" . $arrLang["Quota free space"] . " " . (string) ($quotainfo['limit'] - $quotainfo['usage']) . " KB";
return $content;
}
示例2: min
<td>
<input type="text" size="5" name="quota" class="textfield"
value="<?php
echo $domrow['quotas'] == 0 ? $row['quota'] : ($row['quota'] == 0 ? $domrow['quotas'] : min($domrow['quotas'], $row['quota']));
?>
">
<?php
echo _('MB');
?>
</td>
</tr>
<?php
//}
if (function_exists('imap_get_quotaroot') && $imap_to_check_quota == "yes") {
$mbox = imap_open($imapquotaserver, $row['username'], $row['clear'], OP_HALFOPEN);
$quota = imap_get_quotaroot($mbox, "INBOX");
if (is_array($quota) && !empty($quota)) {
printf("<tr><td>" . _('Space used:') . "</td><td>" . _('%.2f MB') . "</td></tr>", $quota['STORAGE']['usage'] / 1024);
}
imap_close($mbox);
}
if ($domrow['pipe'] == "1") {
?>
<tr>
<td><?php
echo _('Pipe to command or alternative Maildir');
?>
:</td>
<td>
<input type="textfield" size="25" name="smtp" class="textfield"
value="<?php
示例3: getQuota
/**
* Retrieve the quota settings per user
* @return array - FALSE in the case of call failure
*/
protected function getQuota()
{
return imap_get_quotaroot($this->getImapStream(), 'INBOX');
}
示例4: getQuota
/**
* Retreives information about the current mailbox's quota. Rounds up quota sizes and
* appends the unit of measurment. Returns information in a multi-dimensional associative
* array.
*
* @param string $folder Folder to retrieve quota for.
* @param BOOL $rtn
* (optional) true by default, if true return the quota if false merge quota
* information into the $mailboxInfo member variable.
* @return array|false
* @access public
* @see imap_get_quotaroot
* @tutorial http://www.smilingsouls.net/Mail_IMAP?content=Mail_IMAP/getQuota
*/
function getQuota($folder = null, $rtn = true)
{
if (empty($folder) && !isset($this->mailboxInfo['folder'])) {
$folder = 'INBOX';
} else {
if (empty($folder) && isset($this->mailboxInfo['folder'])) {
$folder = $this->mailboxInfo['folder'];
}
}
$q = @imap_get_quotaroot($this->mailbox, $folder);
// STORAGE Values are returned in KB
// Convert back to bytes first
// Then round these to the simpliest unit of measurement
if (isset($q['STORAGE']['usage']) && isset($q['STORAGE']['limit'])) {
$q['STORAGE']['usage'] = $this->convertBytes($q['STORAGE']['usage'] * 1024);
$q['STORAGE']['limit'] = $this->convertBytes($q['STORAGE']['limit'] * 1024);
}
if (isset($q['MESSAGE']['usage']) && isset($q['MESSAGE']['limit'])) {
$q['MESSAGE']['usage'] = $this->convertBytes($q['MESSAGE']['usage']);
$q['MESSAGE']['limit'] = $this->convertBytes($q['MESSAGE']['limit']);
}
if (empty($q['STORAGE']['usage']) && empty($q['STORAGE']['limit'])) {
$this->error->push(Mail_IMAPv2_ERROR, 'error', null, 'Quota not available for this server.');
return false;
} else {
if ($rtn) {
return $q;
} else {
$this->mailboxInfo = array_merge($this->mailboxInfo, $q);
return true;
}
}
}
示例5: openConnection
function openConnection($_folderName = '', $_options = 0, $_adminConnection = false)
{
if (!function_exists('imap_open')) {
return lang('This PHP has no IMAP support compiled in!!');
}
if (!$this->mailPreferences['emailConfigValid']) {
return lang('no valid emailprofile selected!!') . "<pre>" . print_r($this->mailPreferences, 1) . "</pre>";
}
if ($_folderName == '' && !$_adminConnection) {
$_folderName = $this->sessionData['mailbox'];
}
if ($_adminConnection) {
$folderName = '';
$username = $this->mailPreferences['imapAdminUsername'];
$password = $this->mailPreferences['imapAdminPW'];
$options = '';
} else {
$folderName = $_folderName;
$username = $this->mailPreferences['username'];
$password = $this->mailPreferences['key'];
$options = $_options;
}
$mailboxString = ExecMethod('emailadmin.bo.getMailboxString', $_folderName, 3, $this->profileID);
if (!($this->mbox = @imap_open($mailboxString, $username, $password, $options))) {
return imap_last_error();
} else {
// get the quota for this mailboxbox
if (function_exists('imap_get_quotaroot') && !$_adminConnection) {
$quota = @imap_get_quotaroot($this->mbox, $this->decodeFolderName($folderName));
if (is_array($quota['STORAGE'])) {
$storage = $this->storageQuota = $quota['STORAGE'];
}
}
#$_folderName = "user.lars.Asterisk";
#print "$_folderName<br>";
#imap_setacl($this->mbox, $_folderName, 'support', 'lrswipcda');
#print "<pre>";
#print_r(imap_getacl($this->mbox, $_folderName));
#print "</pre>";
return True;
}
}
示例6: getQuotas
/**
* Method to get the quota limits asssociated with the mailbox and user
* This is not implemented on the test IMAP server, so it is untested
* Please could someone test this method on a fully implemented IMAP server and let me know?
*
* @access public
* @param void
* @return stdObject
*/
public function getQuotas()
{
$quota_values = @imap_get_quotaroot($this->conn, $this->mailbox);
if (is_array($quota_values)) {
return $quota_values;
} else {
return FALSE;
}
// $storage = $quota_values['STORAGE'];
// echo "STORAGE usage level is: " . $storage['usage'];
// echo "STORAGE limit level is: " . $storage['limit'];
// $message = $quota_values['MESSAGE'];
// echo "MESSAGE usage level is: " . $message['usage'];
// echo "MESSAGE limit is: " . $message['limit'];
}
示例7: getQuota
/**
* Retreives information about the current mailbox's quota. Rounds up quota sizes and
* appends the unit of measurment. Returns information in a multi-dimensional associative
* array.
*
* @param string $folder Folder to retrieve quota for.
* @return array|PEAR_Error
* @throws Quota not available on this server. Remedy: none.
* @access public
* @see imap_get_quotaroot
*/
function getQuota($folder = NULL)
{
if (empty($folder) && !isset($this->mailboxInfo['folder'])) {
$folder = 'INBOX';
} else {
if (empty($folder) && isset($this->mailboxInfo['folder'])) {
$folder = $this->mailboxInfo['folder'];
}
}
$quota = @imap_get_quotaroot($this->mailbox, $folder);
// STORAGE Values are returned in KB
// Convert back to bytes first
// Then round these to the simpliest unit of measurement
if (isset($quota['STORAGE']['usage']) && isset($quota['STORAGE']['limit'])) {
$rtn['STORAGE']['usage'] = Mail_IMAP::convertBytes($quota['STORAGE']['usage'] * 1024);
$rtn['STORAGE']['limit'] = Mail_IMAP::convertBytes($quota['STORAGE']['limit'] * 1024);
}
if (isset($quota['MESSAGE']['usage']) && isset($quota['MESSAGE']['limit'])) {
$rtn['MESSAGE']['usage'] = Mail_IMAP::convertBytes($quota['MESSAGE']['usage']);
$rtn['MESSAGE']['limit'] = Mail_IMAP::convertBytes($quota['MESSAGE']['limit']);
}
return empty($quota['STORAGE']['usage']) && empty($quota['STORAGE']['limit']) ? PEAR::raiseError('Mail_IMAP::getQuota: Quota not available for this server.') : $rtn;
}
示例8: leerInformacionImap
protected function leerInformacionImap($smarty, $module_name, $imap, &$respuesta)
{
$quotainfo = imap_get_quotaroot($imap, 'INBOX');
$respuesta['html'] = _tr('Quota asigned') . " {$quotainfo['limit']} KB<br/>\n" . _tr('Quota Used') . " {$quotainfo['usage']} KB<br/>\n" . _tr('Quota free space') . " " . (string) ($quotainfo['limit'] - $quotainfo['usage']) . " KB";
}
示例9: get_quota
function get_quota($params)
{
$folder_id = str_replace('/', $this->imap_delimiter, $params['folder_id']);
$folder_id = mb_convert_encoding($folder_id, "UTF7-IMAP", "UTF-8, ISO-8859-1, UTF7-IMAP");
if (!$this->mbox || !is_resource($this->mbox)) {
$this->mbox = $this->open_mbox();
}
$quota = imap_get_quotaroot($this->mbox, $folder_id);
if ($this->mbox && is_resource($this->mbox)) {
imap_close($this->mbox);
}
if (!$quota) {
return array('quota_percent' => 0, 'quota_used' => 0, 'quota_limit' => 0);
}
if (count($quota) && $quota['limit']) {
$quota_limit = $quota['limit'];
$quota_used = $quota['usage'];
if ($quota_used >= $quota_limit) {
$quotaPercent = 100;
} else {
$quotaPercent = $quota_used / $quota_limit * 100;
$quotaPercent = ($quotaPercent * 100 + 0.5) * 0.01;
}
return array('quota_percent' => floor($quotaPercent), 'quota_used' => $quota_used, 'quota_limit' => $quota_limit);
} else {
return array();
}
}
示例10: getquota
/**
* Get the user's quota
*
* @return array
* @access public
*/
function getquota()
{
if ($this->protocol == 'POP3') {
$this->errors[] = GM_NO_POP3_SUPPORT;
return false;
}
if ($this->use_native) {
$quota = imap_get_quotaroot($this->mailer, 'INBOX');
if ($quota) {
return $quota['STORAGE'];
} else {
return array(0, 0);
}
} else {
$quota = $this->mailer->getQuota($this->cur_mailbox);
if (!is_array($quota)) {
$quota = array(0, 0);
}
return $quota;
}
}
示例11: _client_generateMailAccountsList
/**
* Generate Mail accounts list
*
* @param iMSCP_pTemplate $tpl reference to the template object
* @param int $mainDmnId Customer main domain unique identifier
* @return int number of subdomain mails addresses
*/
function _client_generateMailAccountsList($tpl, $mainDmnId)
{
/** @var $cfg iMSCP_Config_Handler_File */
$cfg = iMSCP_Registry::get('config');
$stmt = exec_query("\n\t\t\tSELECT\n\t\t\t\t`mail_id`, `mail_pass`,\n\t\t\t \tCONCAT(LEFT(`mail_forward`, 30), IF(LENGTH(`mail_forward`) > 30, '...', '')) AS `mail_forward`,\n\t\t\t \t`mail_type`, `status`, `mail_auto_respond`, `quota`, `mail_addr`\n\t\t\tFROM\n\t\t\t\t`mail_users`\n\t\t\tWHERE\n\t\t\t\t`domain_id` = ?\n\t\t\tAND\n\t\t\t\t`mail_type` NOT LIKE '%catchall%'\n\t\t\tORDER BY\n\t\t\t\t`mail_addr` ASC, `mail_type` DESC\n\t\t", $mainDmnId);
$rowCount = $stmt->rowCount();
if (!$rowCount) {
return 0;
} else {
$mainDmnProps = get_domain_default_props($_SESSION['user_id']);
$mailQuotaLimit = $mainDmnProps['mail_quota'] ? bytesHuman($mainDmnProps['mail_quota']) : 0;
$imapAvailable = function_exists('imap_open');
if ($imapAvailable) {
imap_timeout(IMAP_OPENTIMEOUT, 1);
imap_timeout(IMAP_READTIMEOUT, 2);
imap_timeout(IMAP_CLOSETIMEOUT, 4);
}
$imapTimeoutReached = false;
while ($row = $stmt->fetchRow(PDO::FETCH_ASSOC)) {
list($mailDelete, $mailDeleteScript, $mailEdit, $mailEditScript) = _client_generateUserMailAction($row['mail_id'], $row['status']);
$mailAddr = $row['mail_addr'];
$mailTypes = explode(',', $row['mail_type']);
$mailType = '';
$isMailbox = 0;
foreach ($mailTypes as $type) {
$mailType .= user_trans_mail_type($type);
if (strpos($type, '_forward') !== false) {
$mailType .= ': ' . str_replace(',', ', ', $row['mail_forward']);
} else {
$isMailbox = 1;
}
$mailType .= '<br />';
}
if ($isMailbox && $row['status'] == 'ok') {
if ($imapAvailable) {
$quotaMax = $row['quota'];
if ($quotaMax) {
if (!$imapTimeoutReached && ($imapStream = @imap_open("{localhost/notls}", $mailAddr, $row['mail_pass'], OP_HALFOPEN))) {
$quotaUsage = imap_get_quotaroot($imapStream, 'INBOX');
imap_close($imapStream);
if (!empty($quotaUsage)) {
$quotaUsage = $quotaUsage['usage'] * 1024;
} else {
$quotaUsage = 0;
}
$quotaMax = bytesHuman($quotaMax);
$txtQuota = $mailQuotaLimit ? tr('%s / %s of %s', bytesHuman($quotaUsage), $quotaMax, $mailQuotaLimit) : sprintf('%s / %s', bytesHuman($quotaUsage), $quotaMax);
} else {
$imapTimeoutReached = true;
$txtQuota = tr('Info Unavailable');
}
} else {
$txtQuota = tr('unlimited');
}
} else {
$txtQuota = tr('Info Unavailable');
}
} else {
$txtQuota = '---';
}
$tpl->assign(array('MAIL_ADDR' => tohtml(decode_idna($mailAddr)), 'MAIL_TYPE' => $mailType, 'MAIL_STATUS' => translate_dmn_status($row['status']), 'MAIL_DELETE' => $mailDelete, 'MAIL_DELETE_SCRIPT' => $mailDeleteScript, 'MAIL_EDIT' => $mailEdit, 'MAIL_EDIT_SCRIPT' => $mailEditScript, 'MAIL_QUOTA_VALUE' => $txtQuota, 'DEL_ITEM' => $row['mail_id'], 'DISABLED_DEL_ITEM' => $row['status'] != 'ok' ? $cfg->HTML_DISABLED : ''));
_client_generateUserMailAutoRespond($tpl, $row['mail_id'], $row['status'], $row['mail_auto_respond']);
$tpl->parse('MAIL_ITEM', '.mail_item');
}
return $rowCount;
}
}
示例12: _getQuota
protected function _getQuota()
{
return imap_get_quotaroot($this->Stream, $this->_config['mailbox']);
}