本文整理汇总了PHP中Toolbox::canUseImapPop方法的典型用法代码示例。如果您正苦于以下问题:PHP Toolbox::canUseImapPop方法的具体用法?PHP Toolbox::canUseImapPop怎么用?PHP Toolbox::canUseImapPop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Toolbox
的用法示例。
在下文中一共展示了Toolbox::canUseImapPop方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MailCollector
GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkRight("config", "w");
Html::header(MailCollector::getTypeName(2), $_SERVER['PHP_SELF'], "config", "mailcollector");
if (!Toolbox::canUseImapPop()) {
echo "<div class='center'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2'>" . _n('Receiver', 'Receivers', 2) . "</th></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td class='center red'>" . __('Your PHP parser was compiled without the IMAP functions');
echo "</td></tr></table>";
echo "</div>";
Html::footer();
exit;
} else {
$mailcollector = new MailCollector();
$mailcollector->title();
Search::show('MailCollector');
Html::footer();
}
示例2: Login
//.........这里部分代码省略.........
$exists = $this->userExists(array('name' => addslashes($login_name)));
// Pas en premier car sinon on ne fait pas le blankpassword
// First try to connect via le DATABASE
if ($exists == 1) {
// Without UTF8 decoding
if (!$this->auth_succeded) {
$this->auth_succeded = $this->connection_db(addslashes($login_name), $login_password);
if ($this->auth_succeded) {
$this->extauth = 0;
$this->user_present = $this->user->getFromDBbyName(addslashes($login_name));
$this->user->fields["authtype"] = self::DB_GLPI;
$this->user->fields["password"] = $login_password;
}
}
} else {
if ($exists == 2) {
//The user is not authenticated on the GLPI DB, but we need to get information about him
//to find out his authentication method
$this->user->getFromDBbyName(addslashes($login_name));
//If the user has already been logged, the method_auth and auths_id are already set
//so we test this connection first
switch ($this->user->fields["authtype"]) {
case self::CAS:
case self::EXTERNAL:
case self::LDAP:
if (Toolbox::canUseLdap()) {
AuthLdap::tryLdapAuth($this, $login_name, $login_password, $this->user->fields["auths_id"], $this->user->fields["user_dn"]);
if (!$this->auth_succeded && $this->user_deleted_ldap) {
$user_deleted_ldap = true;
}
}
break;
case self::MAIL:
if (Toolbox::canUseImapPop()) {
AuthMail::tryMailAuth($this, $login_name, $login_password, $this->user->fields["auths_id"]);
}
break;
case self::NOT_YET_AUTHENTIFIED:
break;
}
} else {
if (!$exists) {
//test all ldap servers only is user is not present in glpi's DB
if (!$this->auth_succeded && Toolbox::canUseLdap()) {
AuthLdap::tryLdapAuth($this, $login_name, $login_password, 0, false, false);
}
//test all imap/pop servers
if (!$this->auth_succeded && Toolbox::canUseImapPop()) {
AuthMail::tryMailAuth($this, $login_name, $login_password, 0, false);
}
}
}
}
// Fin des tests de connexion
}
}
if ($user_deleted_ldap) {
User::manageDeletedUserInLdap($this->user->fields["id"]);
}
// Ok, we have gathered sufficient data, if the first return false the user
// is not present on the DB, so we add him.
// if not, we update him.
if ($this->auth_succeded) {
//Set user an not deleted from LDAP
$this->user->fields['is_deleted_ldap'] = 0;
// Prepare data
示例3: canList
/**
* @see RuleCollection::canList()
**/
function canList()
{
return static::canView() && Toolbox::canUseImapPop() && MailCollector::getNumberOfMailCollectors();
}
示例4: header
//.........这里部分代码省略.........
$menu['config']['content']['crontask']['title'] = _n('Automatic action', 'Automatic actions', 2);
$menu['config']['content']['crontask']['page'] = '/front/crontask.php';
$menu['config']['content']['crontask']['links']['search'] = "/front/crontask.php";
$menu['config']['content']['mailing']['options']['config']['title'] = __('Email');
$menu['config']['content']['mailing']['options']['config']['page'] = '/front/notificationmailsetting.form.php';
$menu['config']['content']['mailing']['options']['notificationtemplate']['title'] = _n('Notification template', 'Notification templates', 2);
$menu['config']['content']['mailing']['options']['notificationtemplate']['page'] = '/front/notificationtemplate.php';
$menu['config']['content']['mailing']['options']['notificationtemplate']['links']['add'] = '/front/notificationtemplate.form.php';
$menu['config']['content']['mailing']['options']['notificationtemplate']['links']['search'] = '/front/notificationtemplate.php';
$menu['config']['content']['extauth']['title'] = __('Authentication');
$menu['config']['content']['extauth']['page'] = '/front/setup.auth.php';
$menu['config']['content']['extauth']['options']['ldap']['title'] = _n('LDAP directory', 'LDAP directories', 2);
$menu['config']['content']['extauth']['options']['ldap']['page'] = '/front/authldap.php';
$menu['config']['content']['extauth']['options']['imap']['title'] = _n('Mail server', 'Mail servers', 2);
$menu['config']['content']['extauth']['options']['imap']['page'] = '/front/authmail.php';
$menu['config']['content']['extauth']['options']['others']['title'] = __('Others');
$menu['config']['content']['extauth']['options']['others']['page'] = '/front/auth.others.php';
$menu['config']['content']['extauth']['options']['settings']['title'] = __('Setup');
$menu['config']['content']['extauth']['options']['settings']['page'] = '/front/auth.settings.php';
switch ($option) {
case "ldap":
// LDAP
$menu['config']['content']['extauth']['options']['ldap']['links']['search'] = '/front/authldap.php';
$menu['config']['content']['extauth']['options']['ldap']['links']['add'] = '' . '/front/authldap.form.php';
break;
case "imap":
// IMAP
$menu['config']['content']['extauth']['links']['search'] = '/front/authmail.php';
$menu['config']['content']['extauth']['links']['add'] = '' . '/front/authmail.form.php';
break;
}
$menu['config']['content']['mailcollector']['title'] = _n('Receiver', 'Receivers', 2);
$menu['config']['content']['mailcollector']['page'] = '/front/mailcollector.php';
if (Toolbox::canUseImapPop()) {
$menu['config']['content']['mailcollector']['links']['search'] = '/front/mailcollector.php';
$menu['config']['content']['mailcollector']['links']['add'] = '/front/mailcollector.form.php';
$menu['config']['content']['mailcollector']['options']['rejectedemails']['links']['search'] = '/front/notimportedemail.php';
}
}
if (Session::haveRight("link", "r")) {
$menu['config']['content']['link']['title'] = _n('External link', 'External links', 2);
$menu['config']['content']['link']['page'] = '/front/link.php';
$menu['config']['content']['link']['hide'] = true;
$menu['config']['content']['link']['links']['search'] = '/front/link.php';
if (Session::haveRight("link", "w")) {
$menu['config']['content']['link']['links']['add'] = "/front/link.form.php";
}
}
if (Session::haveRight("config", "w")) {
$menu['config']['content']['plugins']['title'] = __('Plugins');
$menu['config']['content']['plugins']['page'] = '/front/plugin.php';
}
// Special items
$menu['preference']['title'] = __('My settings');
$menu['preference']['default'] = '/front/preference.php';
$already_used_shortcut = array('1');
echo "<div id='header'>";
echo "<div id='c_logo'>";
echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/central.php' accesskey='1' title=\"" . __s('Home') . "\">";
echo "</a></div>";
/// Prefs / Logout link
echo "<div id='c_preference' >";
echo "<ul>";
echo "<li id='deconnexion'><a href='" . $CFG_GLPI["root_doc"] . "/logout.php";
/// logout witout noAuto login for extauth
if (isset($_SESSION['glpiextauth']) && $_SESSION['glpiextauth']) {
示例5: showForm
/**
* Print the auth mail form
*
* @param $ID Integer : ID of the item
* @param $options array
*
* @return Nothing (display)
**/
function showForm($ID, $options = array())
{
if (!Config::canUpdate()) {
return false;
}
$spotted = false;
if (empty($ID)) {
if ($this->getEmpty()) {
$spotted = true;
}
} else {
if ($this->getFromDB($ID)) {
$spotted = true;
}
}
if (Toolbox::canUseImapPop()) {
$options['colspan'] = 1;
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'><td>" . __('Name') . "</td>";
echo "<td><input size='30' type='text' name='name' value='" . $this->fields["name"] . "'>";
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Active') . "</td>";
echo "<td colspan='3'>";
Dropdown::showYesNo('is_active', $this->fields['is_active']);
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Email domain Name (users email will be login@domain)') . "</td>";
echo "<td><input size='30' type='text' name='host' value='" . $this->fields["host"] . "'>";
echo "</td></tr>";
Toolbox::showMailServerConfig($this->fields["connect_string"]);
echo "<tr class='tab_bg_1'><td>" . __('Comments') . "</td>";
echo "<td>";
echo "<textarea cols='40' rows='4' name='comment'>" . $this->fields["comment"] . "</textarea>";
if ($ID > 0) {
echo "<br>";
//TRANS: %s is the datetime of update
printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
}
echo "</td></tr>";
$this->showFormButtons($options);
} else {
echo "<div class='center'> <table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2'>" . __('Email server configuration') . "</th></tr>";
echo "<tr class='tab_bg_2'><td class='center'>";
echo "<p class='red'>" . __('Your PHP parser was compiled without the IMAP functions') . "</p>";
echo "<p>" . __('Impossible to use email server as external source of connection') . "</p>";
echo "</td></tr></table></div>";
}
}