当前位置: 首页>>代码示例>>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;未经允许,请勿转载。