当前位置: 首页>>代码示例>>PHP>>正文


PHP rcmail类代码示例

本文整理汇总了PHP中rcmail的典型用法代码示例。如果您正苦于以下问题:PHP rcmail类的具体用法?PHP rcmail怎么用?PHP rcmail使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了rcmail类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: do_messagemove

function do_messagemove($uids, $spam)
{
    $rcmail = rcmail::get_instance();
    if ($spam) {
        $dest_dir = unslashify($rcmail->config->get('markasjunk2_spam_dir'));
    } else {
        $dest_dir = unslashify($rcmail->config->get('markasjunk2_ham_dir'));
    }
    if (!$dest_dir) {
        return;
    }
    $filename = $rcmail->config->get('markasjunk2_filename');
    $filename = str_replace('%u', $_SESSION['username'], $filename);
    $filename = str_replace('%t', $spam ? 'spam' : 'ham', $filename);
    if (strpos($_SESSION['username'], '@') !== false) {
        $parts = explode("@", $_SESSION['username'], 2);
        $filename = str_replace(array('%l', '%d'), array($parts[0], $parts[1]), $filename);
    }
    foreach (explode(",", $uids) as $uid) {
        $tmpfname = tempnam($dest_dir, $filename);
        file_put_contents($tmpfname, $rcmail->imap->get_raw_body($uid));
        if ($rcmail->config->get('markasjunk2_debug')) {
            write_log('markasjunk2', $tmpfname);
        }
    }
}
开发者ID:ehmedov,项目名称:www,代码行数:26,代码来源:dir_learn.php

示例2: init

 function init()
 {
     $this->rc = rcmail::get_instance();
     $this->load_config('config.inc.php.dist');
     $this->load_config('config.inc.php');
     $this->add_texts('localization/');
     if ($this->rc->task == 'mail') {
         $this->add_hook('messages_list', array($this, 'filters_checkmsg'));
     } else {
         if ($this->rc->task == 'settings') {
             $this->register_action('plugin.filters', array($this, 'filters_init'));
             $this->register_action('plugin.filters-save', array($this, 'filters_save'));
             $this->register_action('plugin.filters-delete', array($this, 'filters_delete'));
             $this->add_texts('localization/', array('filters', 'nosearchstring'));
             $this->rc->output->add_label('filters');
             $this->include_script('filters.js');
         } else {
             if ($this->rc->task == 'login') {
                 if ($this->rc->config->get('autoAddSpamFilterRule', true)) {
                     $this->add_hook('login_after', array($this, 'filters_addMoveSpamRule'));
                 }
             }
         }
     }
 }
开发者ID:PVasileff,项目名称:RC_Filters,代码行数:25,代码来源:filters.php

示例3: save_data

 /**
  * Handler for submitted form (ajax request)
  *
  * Check fields and save to default identity if valid.
  * Afterwards the session flag is removed and we're done.
  */
 function save_data()
 {
     $rcmail = rcmail::get_instance();
     $identity = $rcmail->user->get_identity();
     $ident_level = intval($rcmail->config->get('identities_level', 0));
     $disabled = array();
     $save_data = array('name' => rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST), 'email' => rcube_utils::get_input_value('_email', rcube_utils::INPUT_POST), 'organization' => rcube_utils::get_input_value('_organization', rcube_utils::INPUT_POST), 'signature' => rcube_utils::get_input_value('_signature', rcube_utils::INPUT_POST));
     if ($ident_level == 4) {
         $disabled = array('name', 'email', 'organization');
     } else {
         if (in_array($ident_level, array(1, 3))) {
             $disabled = array('email');
         }
     }
     foreach ($disabled as $key) {
         $save_data[$key] = $identity[$key];
     }
     if (empty($save_data['name']) || empty($save_data['email'])) {
         $rcmail->output->show_message('formincomplete', 'error');
     } else {
         if (!rcube_utils::check_email($save_data['email'] = rcube_utils::idn_to_ascii($save_data['email']))) {
             $rcmail->output->show_message('emailformaterror', 'error', array('email' => $save_data['email']));
         } else {
             // save data
             $rcmail->user->update_identity($identity['identity_id'], $save_data);
             $rcmail->session->remove('plugin.newuserdialog');
             // hide dialog
             $rcmail->output->command('new_user_dialog_close');
             $rcmail->output->show_message('successfullysaved', 'confirmation');
         }
     }
     $rcmail->output->send();
 }
开发者ID:JotapePinheiro,项目名称:roundcubemail,代码行数:39,代码来源:new_user_dialog.php

示例4: save

 public function save($curpass, $passwd)
 {
     $rcmail = rcmail::get_instance();
     $Socket = new HTTPSocket();
     $da_user = $_SESSION['username'];
     $da_curpass = $curpass;
     $da_newpass = $passwd;
     $da_host = $rcmail->config->get('password_directadmin_host');
     $da_port = $rcmail->config->get('password_directadmin_port');
     if (strpos($da_user, '@') === false) {
         return array('code' => PASSWORD_ERROR, 'message' => 'Change the SYSTEM user password through control panel!');
     }
     $da_host = str_replace('%h', $_SESSION['imap_host'], $da_host);
     $da_host = str_replace('%d', $rcmail->user->get_username('domain'), $da_host);
     $Socket->connect($da_host, $da_port);
     $Socket->set_method('POST');
     $Socket->query('/CMD_CHANGE_EMAIL_PASSWORD', array('email' => $da_user, 'oldpassword' => $da_curpass, 'password1' => $da_newpass, 'password2' => $da_newpass, 'api' => '1'));
     $response = $Socket->fetch_parsed_body();
     //DEBUG
     //rcube::console("Password Plugin: [USER: $da_user] [HOST: $da_host] - Response: [SOCKET: ".$Socket->result_status_code."] [DA ERROR: ".strip_tags($response['error'])."] [TEXT: ".$response[text]."]");
     if ($Socket->result_status_code != 200) {
         return array('code' => PASSWORD_CONNECT_ERROR, 'message' => $Socket->error[0]);
     } elseif ($response['error'] == 1) {
         return array('code' => PASSWORD_ERROR, 'message' => strip_tags($response['text']));
     } else {
         return PASSWORD_SUCCESS;
     }
 }
开发者ID:JotapePinheiro,项目名称:roundcubemail,代码行数:28,代码来源:directadmin.php

示例5: logout

 function logout($args)
 {
     // redirect to configured URL in order to clear HTTP auth credentials
     if (!empty($_SERVER['PHP_AUTH_USER']) && $args['user'] == $_SERVER['PHP_AUTH_USER'] && ($url = rcmail::get_instance()->config->get('logout_url'))) {
         header("Location: {$url}", true, 307);
     }
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:7,代码来源:http_authentication.php

示例6: save_vcard

 /**
  * Handler for request action
  */
 function save_vcard()
 {
     $this->add_texts('localization', true);
     $uid = get_input_value('_uid', RCUBE_INPUT_POST);
     $mbox = get_input_value('_mbox', RCUBE_INPUT_POST);
     $mime_id = get_input_value('_part', RCUBE_INPUT_POST);
     $rcmail = rcmail::get_instance();
     $part = $uid && $mime_id ? $rcmail->imap->get_message_part($uid, $mime_id) : null;
     $error_msg = $this->gettext('vcardsavefailed');
     if ($part && ($vcard = new rcube_vcard($part)) && $vcard->displayname && $vcard->email) {
         $contacts = $rcmail->get_address_book(null, true);
         // check for existing contacts
         $existing = $contacts->search('email', $vcard->email[0], true, false);
         if ($done = $existing->count) {
             $rcmail->output->command('display_message', $this->gettext('contactexists'), 'warning');
         } else {
             // add contact
             $success = $contacts->insert(array('name' => $vcard->displayname, 'firstname' => $vcard->firstname, 'surname' => $vcard->surname, 'email' => $vcard->email[0], 'vcard' => $vcard->export()));
             if ($success) {
                 $rcmail->output->command('display_message', $this->gettext('addedsuccessfully'), 'confirmation');
             } else {
                 $rcmail->output->command('display_message', $error_msg, 'error');
             }
         }
     } else {
         $rcmail->output->command('display_message', $error_msg, 'error');
     }
     $rcmail->output->send();
 }
开发者ID:DavidGarciaCat,项目名称:eyeos,代码行数:32,代码来源:vcard_attachments.php

示例7: init

 function init()
 {
     $this->app = rcmail::get_instance();
     $this->debug = $this->app->config->get('ldap_debug');
     $this->add_hook('user2email', array($this, 'user2email'));
     $this->add_hook('email2user', array($this, 'email2user'));
 }
开发者ID:jirutka,项目名称:roundcube-virtuser_ldap,代码行数:7,代码来源:virtuser_ldap.php

示例8: mail_forward_write

function mail_forward_write(array &$data)
{
    $rcmail = rcmail::get_instance();
    if ($dsn = $rcmail->config->get('forward_sql_dsn')) {
        if (is_array($dsn) && empty($dsn['new_link'])) {
            $dsn['new_link'] = true;
        } else {
            if (!is_array($dsn) && !preg_match('/\\?new_link=true/', $dsn)) {
                $dsn .= '?new_link=true';
            }
        }
        $db = rcube_db::factory($dsn, '', FALSE);
        $db->set_debug((bool) $rcmail->config->get('sql_debug'));
        $db->db_connect('w');
    } else {
        $db = $rcmail->get_dbh();
    }
    if ($err = $db->is_error()) {
        return PLUGIN_ERROR_CONNECT;
    }
    $search = array('%address', '%goto', '%modified');
    $replace = array($db->quote($data['address']), $db->quote($data['goto']), $db->quote($data['modified']));
    $query = str_replace($search, $replace, $rcmail->config->get('forward_sql_write'));
    $sql_result = $db->query($query);
    if ($err = $db->is_error()) {
        return PLUGIN_ERROR_PROCESS;
    }
    return PLUGIN_SUCCESS;
}
开发者ID:freedomson,项目名称:roundcube-forward,代码行数:29,代码来源:sql.php

示例9: password_save

/**
* Dovecot Password File Driver (dovecotpfd)
*
* Roundcube password plugin driver that adds functionality to change passwords stored in
* Dovecot passwd/userdb files (see: http://wiki.dovecot.org/AuthDatabase/PasswdFile)
*
* Copyright (C) 2011, Charlie Orford
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program 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 this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.     
*
*
* SCRIPT REQUIREMENTS:
*
*  - PHP 5.3.0 or higher, shell access and the ability to run php scripts from the CLI
*
*  - chgdovecotpw and dovecotpfd-setuid.c (these two files should have been bundled with this driver)
*
*  - dovecotpfd-setuid.c must be compiled and the resulting dovecotpfd-setuid binary placed in the same directory
*    as this script (see dovecotpfd-setuid.c source for compilation instructions, security info and options)
*
*  - chgdovecotpw must be placed in a location where dovecotpfd-setuid can access it once it has changed UID (normally /usr/sbin is a good choice)
*
*  - chgdovecotpw should only be executable by the user dovecotpfd-setuid changes UID to
*
*  - the dovecot passwd/userdb file must be accessible and writable by the same user dovecotpfd-setuid changes UID to
*
*  - dovecotpw (usually packaged with dovecot itself and found in /usr/sbin) must be available and executable by chgdovecotpw
*
*
* @version 1.1 (2011-09-08)
* @author Charlie Orford (charlie.orford@attackplan.net)
**/
function password_save($currpass, $newpass)
{
    $rcmail = rcmail::get_instance();
    $currdir = realpath(dirname(__FILE__));
    list($user, $domain) = explode("@", $_SESSION['username']);
    $username = rcmail::get_instance()->config->get('password_dovecotpfd_format') == "%n" ? $user : $_SESSION['username'];
    $scheme = rcmail::get_instance()->config->get('password_dovecotpfd_scheme');
    // Set path to dovecot passwd/userdb file
    // (the example below shows how you can support multiple passwd files, one for each domain. If you just use one file, replace sprintf with a simple string of the path to the passwd file)
    $passwdfile = sprintf("/home/mail/%s/passwd", $domain);
    // Build command to call dovecotpfd-setuid wrapper
    $exec_cmd = sprintf("%s/dovecotpfd-setuid -f=%s -u=%s -s=%s -p=\"%s\" 2>&1", $currdir, escapeshellcmd(realpath($passwdfile)), escapeshellcmd($username), escapeshellcmd($scheme), escapeshellcmd($newpass));
    // Call wrapper to change password
    if ($ph = @popen($exec_cmd, "r")) {
        $response = "";
        while (!feof($ph)) {
            $response .= fread($ph, 8192);
        }
        if (pclose($ph) == 0) {
            return PASSWORD_SUCCESS;
        }
        raise_error(array('code' => 600, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Password plugin: {$currdir}/dovecotpfd-setuid returned an error"), true, false);
        return PASSWORD_ERROR;
    } else {
        raise_error(array('code' => 600, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Password plugin: error calling {$currdir}/dovecotpfd-setuid"), true, false);
        return PASSWORD_ERROR;
    }
}
开发者ID:kaystrobach,项目名称:dovecotpfd,代码行数:71,代码来源:dovecotpfd.php

示例10: do_salearn

function do_salearn($uids, $spam)
{
    $rcmail = rcmail::get_instance();
    $temp_dir = realpath($rcmail->config->get('temp_dir'));
    if ($spam) {
        $command = $rcmail->config->get('markasjunk2_spam_cmd');
    } else {
        $command = $rcmail->config->get('markasjunk2_ham_cmd');
    }
    if (!$command) {
        return;
    }
    $command = str_replace('%u', $_SESSION['username'], $command);
    if (strpos($_SESSION['username'], '@') !== false) {
        $parts = explode("@", $_SESSION['username'], 2);
        $command = str_replace(array('%l', '%d'), array($parts[0], $parts[1]), $command);
    }
    foreach (explode(",", $uids) as $uid) {
        $tmpfname = tempnam($temp_dir, 'rcmSALearn');
        file_put_contents($tmpfname, $rcmail->imap->get_raw_body($uid));
        $tmp_command = str_replace('%f', $tmpfname, $command);
        exec($tmp_command, $output);
        if ($rcmail->config->get('markasjunk2_debug')) {
            write_log('markasjunk2', $tmp_command);
            write_log('markasjunk2', $output);
        }
        unlink($tmpfname);
        $output = '';
    }
}
开发者ID:ehmedov,项目名称:www,代码行数:30,代码来源:cmd_learn.php

示例11: save

 function save($curpass, $passwd)
 {
     $rcmail = rcmail::get_instance();
     $vesta_host = $rcmail->config->get('password_vesta_host');
     if (empty($vesta_host)) {
         $vesta_host = 'localhost';
     }
     $vesta_port = $rcmail->config->get('password_vesta_port');
     if (empty($vesta_port)) {
         $vesta_port = '8083';
     }
     $postvars = array('email' => $_SESSION['username'], 'password' => $curpass, 'new' => $passwd);
     $postdata = http_build_query($postvars);
     $send = 'POST /reset/mail/ HTTP/1.1' . PHP_EOL;
     $send .= 'Host: ' . $vesta_host . PHP_EOL;
     $send .= 'User-Agent: PHP Script' . PHP_EOL;
     $send .= 'Content-length: ' . strlen($postdata) . PHP_EOL;
     $send .= 'Content-type: application/x-www-form-urlencoded' . PHP_EOL;
     $send .= 'Connection: close' . PHP_EOL;
     $send .= PHP_EOL;
     $send .= $postdata . PHP_EOL . PHP_EOL;
     $fp = fsockopen('ssl://' . $vesta_host, $vesta_port);
     fputs($fp, $send);
     $result = fread($fp, 2048);
     fclose($fp);
     if (strpos($result, 'ok') && !strpos($result, 'error')) {
         return PASSWORD_SUCCESS;
     } else {
         return PASSWORD_ERROR;
     }
 }
开发者ID:DouglasDigital,项目名称:vesta,代码行数:31,代码来源:vesta.php

示例12: save

 function save($curpass, $passwd)
 {
     $rcmail = rcmail::get_instance();
     //    include('Net/Socket.php');
     $vpopmaild = new Net_Socket();
     if (PEAR::isError($vpopmaild->connect($rcmail->config->get('password_vpopmaild_host'), $rcmail->config->get('password_vpopmaild_port'), null))) {
         return PASSWORD_CONNECT_ERROR;
     }
     $result = $vpopmaild->readLine();
     if (!preg_match('/^\\+OK/', $result)) {
         $vpopmaild->disconnect();
         return PASSWORD_CONNECT_ERROR;
     }
     $vpopmaild->writeLine("slogin " . $_SESSION['username'] . " " . $curpass);
     $result = $vpopmaild->readLine();
     if (!preg_match('/^\\+OK/', $result)) {
         $vpopmaild->writeLine("quit");
         $vpopmaild->disconnect();
         return PASSWORD_ERROR;
     }
     $vpopmaild->writeLine("mod_user " . $_SESSION['username']);
     $vpopmaild->writeLine("clear_text_password " . $passwd);
     $vpopmaild->writeLine(".");
     $result = $vpopmaild->readLine();
     $vpopmaild->writeLine("quit");
     $vpopmaild->disconnect();
     if (!preg_match('/^\\+OK/', $result)) {
         return PASSWORD_ERROR;
     }
     return PASSWORD_SUCCESS;
 }
开发者ID:bbspike,项目名称:sentora-core,代码行数:31,代码来源:vpopmaild.php

示例13: _do_filterforget

 private function _do_filterforget($uids, $spam)
 {
     $rcmail = rcmail::get_instance();
     $rcmail->imap_connect();
     $user = $rcmail->user;
     $arr_prefs = $user->get_prefs();
     foreach ($uids as $uid) {
         $MESSAGE = new rcube_message($uid);
         $from = $MESSAGE->sender['mailto'];
         $found = false;
         foreach ($arr_prefs['filters'] as $key => $saved_filter) {
             if (stripslashes($saved_filter['searchstring']) == $from && $saved_filter['destfolder'] == 'Junk') {
                 $found = true;
                 $arr_prefs2 = $user->get_prefs();
                 $arr_prefs2['filters'][$key] = '';
                 $arr_prefs2['filters'] = array_diff($arr_prefs2['filters'], array(''));
                 if ($user->save_prefs($arr_prefs2)) {
                     $rcmail->output->command('display_message', 'Filter ' . $key . ' deleted', 'confirmation');
                 } else {
                     $rcmail->output->command('display_message', 'Filter  ' . $key . ' not deleted', 'error');
                 }
             }
         }
         if (!$found) {
             $rcmail->output->command('display_message', 'No filter found for ' . $from . '', 'confirmation');
         }
     }
 }
开发者ID:RavenB,项目名称:filter_learn,代码行数:28,代码来源:filter_learn.php

示例14: init

 function init()
 {
     $this->rcmail = rcmail::get_instance();
     $this->out = html::tag('div', array('style' => 'font-size: 12px; text-align: justify; position: absolute; margin-left: auto; left: 50%; margin-left: -250px; width: 500px;'), html::tag('h3', null, 'Welcome to MyRoundcube Plugins - Plugin Manager Installer') . html::tag('span', null, 'Please ' . html::tag('a', array('href' => $this->svn), 'download') . ' Plugin Manager package and upload the entire package to your Roundcube\'s plugin folder.' . html::tag('br') . html::tag('br') . ' If you are prompted to overwrite <i>"./plugins/plugin_manager"</i> please do so.') . html::tag('br') . html::tag('br') . html::tag('div', array('style' => 'display: inline; float: left'), html::tag('a', array('href' => 'javascript:void(0)', 'onclick' => 'document.location.href=\'./\''), $this->gettext('done'))));
     $this->register_handler('plugin.body', array($this, 'download'));
     $this->rcmail->output->send('plugin');
 }
开发者ID:MetallianFR68,项目名称:myroundcube,代码行数:7,代码来源:plugin_manager.php

示例15: prefs_list

 function prefs_list($args)
 {
     if ($args['section'] == 'mailbox') {
         $RCMAIL = rcmail::get_instance();
         $field_id = 'rcmfd_html5_notifier';
         $select_duration = new html_select(array('name' => '_html5_notifier_duration', 'id' => $field_id));
         $select_duration->add($this->gettext('off'), '0');
         $times = array('3', '5', '8', '10', '12', '15', '20', '25', '30');
         foreach ($times as $time) {
             $select_duration->add($time . ' ' . $this->gettext('seconds'), $time);
         }
         $select_duration->add($this->gettext('durable'), '-1');
         $select_smbox = new html_select(array('name' => '_html5_notifier_smbox', 'id' => $field_id));
         $select_smbox->add($this->gettext('no_mailbox'), '0');
         $select_smbox->add($this->gettext('short_mailbox'), '1');
         $select_smbox->add($this->gettext('full_mailbox'), '2');
         $content = $select_duration->show($RCMAIL->config->get('html5_notifier_duration') . '');
         $content .= $select_smbox->show($RCMAIL->config->get('html5_notifier_smbox') . '');
         $content .= html::a(array('href' => '#', 'id' => 'rcmfd_html5_notifier_browser_conf', 'onclick' => 'rcmail_browser_notifications(); return false;'), $this->gettext('conf_browser')) . ' ';
         $content .= html::a(array('href' => '#', 'onclick' => 'rcmail_browser_notifications_test(); return false;'), $this->gettext('test_browser'));
         $args['blocks']['new_message']['options']['html5_notifier'] = array('title' => html::label($field_id, rcube::Q($this->gettext('shownotifies'))), 'content' => $content);
         $check_only_new = new html_checkbox(array('name' => '_html5_notifier_only_new', 'id' => $field_id . '_only_new', 'value' => 1));
         $content = $check_only_new->show($RCMAIL->config->get('html5_notifier_only_new', false));
         $args['blocks']['new_message']['options']['html5_notifier_only_new'] = array('title' => html::label($field_id, rcube::Q($this->gettext('onlynew'))), 'content' => $content);
         $input_excluded = new html_inputfield(array('name' => '_html5_notifier_excluded_directories', 'id' => $field_id . '_excluded'));
         $args['blocks']['new_message']['options']['html5_notifier_excluded_directories'] = array('title' => html::label($field_id, rcube::Q($this->gettext('excluded_directories'))), 'content' => $input_excluded->show($RCMAIL->config->get('html5_notifier_excluded_directories') . ''));
         $select_type = new html_select(array('name' => '_html5_notifier_popuptype', 'id' => $field_id . '_popuptype'));
         $select_type->add($this->gettext('new_tab'), '0');
         $select_type->add($this->gettext('new_window'), '1');
         $args['blocks']['new_message']['options']['html5_notifier_popuptype'] = array('title' => html::label($field_id, rcube::Q($this->gettext('notifier_popuptype'))), 'content' => $select_type->show($RCMAIL->config->get('html5_notifier_popuptype') . ''));
         $RCMAIL->output->add_script("\$(document).ready(function(){ rcmail_browser_notifications_colorate(); });");
     }
     return $args;
 }
开发者ID:MiraMaX166,项目名称:html5_notifier,代码行数:34,代码来源:html5_notifier.php


注:本文中的rcmail类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。