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); } } }
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')); } } } } }
/** * 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(); }
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; } }
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); } }
/** * 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(); }
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')); }
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; }
/** * 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; } }
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 = ''; } }
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; } }
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; }
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'); } } }
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'); }
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; }
/** * Plugin initialization */ function init() { $this->rc = rcmail::get_instance(); // Preferences hooks if ($this->rc->task == 'settings') { $this->add_hook('preferences_list', array($this, 'prefs_list')); $this->add_hook('preferences_save', array($this, 'prefs_save')); } else { // if ($this->rc->task == 'mail') { // add script when not in ajax and not in frame if ($this->rc->output->type == 'html' && empty($_REQUEST['_framed'])) { $this->add_texts('localization/'); $this->rc->output->add_label('newmail_notifier.title', 'newmail_notifier.body'); $this->include_script('newmail_notifier.js'); } if ($this->rc->action == 'refresh') { // Load configuration $this->load_config(); $this->opt['basic'] = $this->rc->config->get('newmail_notifier_basic'); $this->opt['sound'] = $this->rc->config->get('newmail_notifier_sound'); $this->opt['desktop'] = $this->rc->config->get('newmail_notifier_desktop'); if (!empty($this->opt)) { // Get folders to skip checking for $exceptions = array('drafts_mbox', 'sent_mbox', 'trash_mbox'); foreach ($exceptions as $folder) { $folder = $this->rc->config->get($folder); if (strlen($folder) && $folder != 'INBOX') { $this->exceptions[] = $folder; } } $this->add_hook('new_messages', array($this, 'notify')); } } } }
function settings_table($args) { if ($args['section'] == 'mailbox') { $a_list_cols = rcmail::get_instance()->config->get('list_cols'); $args['blocks']['roworder']['name'] = Q($this->gettext('roworder', 'msglistcols')); for ($i = 0; $i < 9; $i++) { $field_id = 'rcmfd_list_col' . $i; $select_col = new html_select(array('name' => '_list_cols[]', 'id' => $field_id)); $select_col->add(rcube_label('skip', 'msglistcols'), ''); $select_col->add(rcube_label('subject'), 'subject'); $select_col->add(rcube_label('from'), 'from'); $select_col->add(rcube_label('to'), 'to'); $select_col->add(rcube_label('cc'), 'cc'); $select_col->add(rcube_label('replyto'), 'replyto'); $select_col->add(rcube_label('date'), 'date'); $select_col->add(rcube_label('size'), 'size'); $select_col->add(rcube_label('flagged', 'msglistcols'), 'flag'); $select_col->add(rcube_label('attachment', 'msglistcols'), 'attachment'); $args['blocks']['roworder']['options']['listcol_' . $i]['title'] = Q($this->gettext('list_col_' . $i, 'msglistcols')); if (!empty($a_list_cols[$i])) { $selected = $a_list_cols[$i]; } else { $selected = ""; } $args['blocks']['roworder']['options']['listcol_' . $i]['content'] = $select_col->show($selected); unset($select_col); } } return $args; }
/** * i-MSCP - internet Multi Server Control Panel * Copyright (C) 2010-2011 by i-MSCP team * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * 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. * * @category iMSCP * @package iMSCP Roundcube password changer * @copyright 2010-2011 by i-MSCP team * @author Sascha Bay * @link http://www.i-mscp.net i-MSCP Home Site * @license http://www.gnu.org/licenses/gpl-2.0.html GPL v2 */ function password_save($passwd) { $rcmail = rcmail::get_instance(); $sql = "UPDATE `mail_users` SET `mail_pass` = %p WHERE `mail_addr` = %u LIMIT 1"; if ($dsn = $rcmail->config->get('password_db_dsn')) { // #1486067: enable new_link option 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'); } if ($err = $db->is_error()) { return PASSWORD_ERROR; } $sql = str_replace('%u', $db->quote($_SESSION['username'], 'text'), $sql); $sql = str_replace('%p', $db->quote($passwd, 'text'), $sql); $res = $db->query($sql); if (!$db->is_error()) { if ($db->affected_rows($res) == 1) { return PASSWORD_SUCCESS; // This is the good case: 1 row updated } } return PASSWORD_ERROR; }
public function init() { $version = '1.8.14'; $rcmail = rcmail::get_instance(); $this->load_config(); // include UI scripts $this->include_script("js/jquery-ui-{$version}.custom.min.js"); // include UI stylesheet $skin = $rcmail->config->get('skin', 'default'); $ui_map = $rcmail->config->get('jquery_ui_skin_map', array()); $ui_theme = $ui_map[$skin] ? $ui_map[$skin] : 'default'; if (file_exists($this->home . "/themes/{$ui_theme}/jquery-ui-{$version}.custom.css")) { $this->include_stylesheet("themes/{$ui_theme}/jquery-ui-{$version}.custom.css"); } else { $this->include_stylesheet("themes/default/jquery-ui-{$version}.custom.css"); } // jquery UI localization $jquery_ui_i18n = $rcmail->config->get('jquery_ui_i18n', array()); if (count($jquery_ui_i18n) > 0) { $lang_l = str_replace('_', '-', substr($_SESSION['language'], 0, 5)); $lang_s = substr($_SESSION['language'], 0, 2); foreach ($jquery_ui_i18n as $package) { if (file_exists($this->home . "/js/i18n/jquery.ui.{$package}-{$lang_l}.js")) { $this->include_script("js/i18n/jquery.ui.{$package}-{$lang_l}.js"); } else { if (file_exists($this->home . "/js/i18n/jquery.ui.{$package}-{$lang_s}.js")) { $this->include_script("js/i18n/jquery.ui.{$package}-{$lang_s}.js"); } } } } }
public function save($curpas, $newpass) { require_once 'xmlapi.php'; $rcmail = rcmail::get_instance(); $this->cuser = $rcmail->config->get('password_cpanel_username'); $cpanel_host = $rcmail->config->get('password_cpanel_host'); $cpanel_port = $rcmail->config->get('password_cpanel_port'); $cpanel_hash = $rcmail->config->get('password_cpanel_hash'); $cpanel_pass = $rcmail->config->get('password_cpanel_password'); // Setup the xmlapi connection $this->xmlapi = new xmlapi($cpanel_host); $this->xmlapi->set_port($cpanel_port); // Hash auth if (!empty($cpanel_hash)) { $this->xmlapi->hash_auth($this->cuser, $cpanel_hash); } else { if (!empty($cpanel_pass)) { $this->xmlapi->password_auth($this->cuser, $cpanel_pass); } else { return PASSWORD_ERROR; } } $this->xmlapi->set_output('json'); $this->xmlapi->set_debug(0); return $this->setPassword($_SESSION['username'], $newpass); }
function add_script($args) { $rcmail = rcmail::get_instance(); $exclude = array_flip($rcmail->config->get('piwik_tracking_exclude')); if (isset($exclude[$args['template']])) { return $args; } if ($rcmail->config->get('piwik_tracking_privacy') and !empty($_SESSION['user_id'])) { return $args; } if (!$rcmail->config->get('piwik_tracking_domain')) { return $args; } $script = ' <!-- Piwik --> <script type="text/javascript"> var _paq = _paq || []; _paq.push([\'trackPageView\']); _paq.push([\'enableLinkTracking\']); (function() { var u=(("https:" == document.location.protocol) ? "https" : "http") + "://' . $rcmail->config->get('piwik_tracking_domain') . '/"; _paq.push([\'setTrackerUrl\', u+\'piwik.php\']); _paq.push([\'setSiteId\', ' . $rcmail->config->get('piwik_tracking_id') . ']); var d=document, g=d.createElement(\'script\'), s=d.getElementsByTagName(\'script\')[0]; g.type=\'text/javascript\'; g.defer=true; g.async=true; g.src=u+\'piwik.js\'; s.parentNode.insertBefore(g,s); })(); </script> <noscript><p><img src="http://' . $rcmail->config->get('piwik_tracking_domain') . '/piwik.php?idsite=' . $rcmail->config->get('piwik_tracking_id') . '" style="border:0;" alt="" /></p></noscript> <!-- End Piwik Code --> '; // add script to end of page $rcmail->output->add_footer($script); return $args; }
function save($curpass, $passwd) { $rcmail = rcmail::get_instance(); if (is_null($curpass)) { $curpass = $rcmail->decrypt($_SESSION['password']); } if ($ch = curl_init()) { // initial login curl_setopt_array($ch, array(CURLOPT_RETURNTRANSFER => true, CURLOPT_URL => 'https://ssl.df.eu/chmail.php', CURLOPT_POST => true, CURLOPT_POSTFIELDS => array('login' => $rcmail->user->get_username(), 'pwd' => $curpass, 'action' => 'change'))); if ($result = curl_exec($ch)) { // login successful, get token! $postfields = array('pwd1' => $passwd, 'pwd2' => $passwd, 'action[update]' => 'Speichern'); preg_match_all('~<input name="(.+?)" type="hidden" value="(.+?)">~i', $result, $fields); foreach ($fields[1] as $field_key => $field_name) { $postfields[$field_name] = $fields[2][$field_key]; } // change password $ch = curl_copy_handle($ch); curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields); if ($result = curl_exec($ch)) { if (strpos($result, 'Einstellungen erfolgreich') !== false) { return PASSWORD_SUCCESS; } } else { return PASSWORD_CONNECT_ERROR; } } else { return PASSWORD_CONNECT_ERROR; } } else { return PASSWORD_CONNECT_ERROR; } return PASSWORD_ERROR; }
private function read_squirrel_prefs($uname) { $this->load_config(); $rcmail = rcmail::get_instance(); if ($srcdir = $rcmail->config->get('squirrelmail_data_dir')) { $prefsfile = slashify($srcdir) . $uname . '.pref'; $abookfile = slashify($srcdir) . $uname . '.abook'; $sigfile = slashify($srcdir) . $uname . '.sig'; if (is_readable($prefsfile)) { $this->prefs = array(); foreach (file($prefsfile) as $line) { list($key, $value) = explode('=', $line); $this->prefs[$key] = utf8_encode(rtrim($value)); } // also read signature file if exists if (is_readable($sigfile)) { $this->prefs['signature'] = utf8_encode(file_get_contents($sigfile)); } // parse addres book file if (filesize($abookfile)) { foreach (file($abookfile) as $line) { list($rec['name'], $rec['firstname'], $rec['surname'], $rec['email']) = explode('|', utf8_encode(rtrim($line))); if ($rec['name'] && $rec['email']) { $this->abook[] = $rec; } } } } } }
/** * Constructor * * @param string $lang Language code */ function __construct($lang = 'en') { $this->rc = rcmail::get_instance(); $this->engine = $this->rc->config->get('spellcheck_engine', 'googie'); $this->lang = $lang ? $lang : 'en'; $this->options = array('ignore_syms' => $this->rc->config->get('spellcheck_ignore_syms'), 'ignore_nums' => $this->rc->config->get('spellcheck_ignore_nums'), 'ignore_caps' => $this->rc->config->get('spellcheck_ignore_caps'), 'dictionary' => $this->rc->config->get('spellcheck_dictionary')); }
function save($curpass, $passwd) { $rcmail = rcmail::get_instance(); $vpopmaild = new Net_Socket(); $host = $rcmail->config->get('password_vpopmaild_host'); $port = $rcmail->config->get('password_vpopmaild_port'); $result = $vpopmaild->connect($host, $port, null); if (is_a($result, 'PEAR_Error')) { return PASSWORD_CONNECT_ERROR; } $vpopmaild->setTimeout($rcmail->config->get('password_vpopmaild_timeout'), 0); $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; }
function init() { $rcmail = rcmail::get_instance(); if ($rcmail->action == 'compose') { $this->include_script('attachment_reminder.js'); $this->add_texts('localization/', true); } }
function init() { $rcmail = rcmail::get_instance(); if ($rcmail->action == 'show' || $rcmail->action == 'preview') { $this->add_hook('message_load', array($this, 'message_load')); $this->add_hook('template_object_messageattachments', array($this, 'html_output')); } }
function folders_list($args) { $rcmail = rcmail::get_instance(); if (!$rcmail->config->get('use_subscriptions', true)) { $args['table']->remove_column('subscribed'); } return $args; }
/** * Provides the UAPI URL of the Email::passwd_pop function. * * @return string HTTPS URL */ public static function url() { $config = rcmail::get_instance()->config; $storage_host = $_SESSION['storage_host']; $host = $config->get('password_cpanel_webmail_host', $storage_host); $port = $config->get('password_cpanel_webmail_port', 2096); return "https://{$host}:{$port}/execute/Email/passwd_pop"; }
/** * This implements the 'singleton' design pattern * * @param integer Options to initialize with this instance. See rcube::INIT_WITH_* constants * * @return rcube The one and only instance */ static function get_instance($mode = 0) { if (!self::$instance) { self::$instance = new rcube(); self::$instance->init($mode); } return self::$instance; }