當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Toolbox::parseMailServerConnectString方法代碼示例

本文整理匯總了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 = "&nbsp;";
     }
     //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'];
 }
開發者ID:paisdelconocimiento,項目名稱:glpi-smartcities,代碼行數:67,代碼來源:toolbox.class.php

示例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";
開發者ID:paisdelconocimiento,項目名稱:glpi-smartcities,代碼行數:31,代碼來源:status.php


注:本文中的Toolbox::parseMailServerConnectString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。