本文整理汇总了PHP中Toolbox::parseMailServerConnectString方法的典型用法代码示例。如果您正苦于以下问题:PHP Toolbox::parseMailServerConnectString方法的具体用法?PHP Toolbox::parseMailServerConnectString怎么用?PHP Toolbox::parseMailServerConnectString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Toolbox
的用法示例。
在下文中一共展示了Toolbox::parseMailServerConnectString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showMailServerConfig
/**
* Display a mail server configuration form
*
* @param $value String host connect string ex
* {localhost:993/imap/ssl}INBOX
*
* @return String type of the server (imap/pop)
**/
static function showMailServerConfig($value)
{
if (!Config::canUpdate()) {
return false;
}
$tab = Toolbox::parseMailServerConnectString($value);
echo "<tr class='tab_bg_1'><td>" . __('Server') . "</td>";
echo "<td><input size='30' type='text' name='mail_server' value=\"" . $tab['address'] . "\">";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'><td>" . __('Connection options') . "</td><td>";
$values = array('' => '', '/imap' => __('IMAP'), '/pop' => __('POP'));
$svalue = !empty($tab['type']) ? '/' . $tab['type'] : '';
Dropdown::showFromArray('server_type', $values, array('value' => $svalue, 'width' => '10%'));
$values = array('' => '', '/ssl' => __('SSL'));
$svalue = $tab['ssl'] ? '/ssl' : '';
Dropdown::showFromArray('server_ssl', $values, array('value' => $svalue, 'width' => '10%'));
$values = array('' => '', '/tls' => __('TLS'), '/notls' => __('NO-TLS'));
$svalue = '';
if ($tab['tls'] === true) {
$svalue = '/tls';
}
if ($tab['tls'] === false) {
$svalue = '/notls';
}
Dropdown::showFromArray('server_tls', $values, array('value' => $svalue, 'width' => '14%'));
$values = array('' => '', '/novalidate-cert' => __('NO-VALIDATE-CERT'), '/validate-cert' => __('VALIDATE-CERT'));
$svalue = '';
if ($tab['validate-cert'] === false) {
$svalue = '/novalidate-cert';
}
if ($tab['validate-cert'] === true) {
$svalue = '/validate-cert';
}
Dropdown::showFromArray('server_cert', $values, array('value' => $svalue, 'width' => '20%'));
$values = array('' => '', '/norsh' => __('NORSH'));
$svalue = $tab['norsh'] === true ? '/norsh' : '';
Dropdown::showFromArray('server_rsh', $values, array('value' => $svalue, 'width' => '12%'));
$values = array('' => '', '/secure' => __('SECURE'));
$svalue = $tab['secure'] === true ? '/secure' : '';
Dropdown::showFromArray('server_secure', $values, array('value' => $svalue, 'width' => '12%'));
$values = array('' => '', '/debug' => __('DEBUG'));
$svalue = $tab['debug'] === true ? '/debug' : '';
Dropdown::showFromArray('server_debug', $values, array('value' => $svalue, 'width' => '12%'));
echo "<input type=hidden name=imap_string value='" . $value . "'>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'><td>" . __('Incoming mail folder (optional, often INBOX)') . "</td>";
echo "<td><input size='30' type='text' name='server_mailbox' value=\"" . $tab['mailbox'] . "\" >";
echo "</td></tr>\n";
//TRANS: for mail connection system
echo "<tr class='tab_bg_1'><td>" . __('Port (optional)') . "</td>";
echo "<td><input size='10' type='text' name='server_port' value='" . $tab['port'] . "'></td></tr>\n";
if (empty($value)) {
$value = " ";
}
//TRANS: for mail connection system
echo "<tr class='tab_bg_1'><td>" . __('Connection string') . "</td>";
echo "<td class='b'>{$value}</td></tr>\n";
return $tab['type'];
}
示例2: getAllDatasFromTable
} else {
echo "_PROBLEM";
$ok = false;
}
echo "\n";
}
} else {
echo "No LDAP server\n";
}
// Check IMAP Auth connections
$imap_methods = getAllDatasFromTable('glpi_authmails', '`is_active`=1');
if (count($imap_methods)) {
echo "Check IMAP servers:";
foreach ($imap_methods as $method) {
echo " " . $method['name'];
$param = Toolbox::parseMailServerConnectString($method['connect_string'], true);
if ($param['ssl'] === true) {
$host = 'ssl://' . $host;
} else {
if ($param['tls'] === true) {
$host = 'tls://' . $host;
}
}
if ($fp = @fsockopen($host, $param['port'], $errno, $errstr, 1)) {
echo "_OK";
} else {
echo "_PROBLEM";
$ok = false;
}
fclose($fp);
echo "\n";