public function process_mailbox($p_mailbox) { $this->_mailbox = $p_mailbox + ERP_get_default_mailbox(); if ($this->_functionality_enabled) { if ($this->_mailbox['enabled']) { // Check whether EmailReporting supports the mailbox type. The check is based on available default ports if (isset($this->_default_ports[$this->_mailbox['mailbox_type']])) { if (project_exists($this->_mailbox['project_id'])) { if (category_exists($this->_mailbox['global_category_id'])) { $t_upload_folder_passed = TRUE; if ($this->_allow_file_upload && $this->_file_upload_method == DISK) { $t_upload_folder_passed = FALSE; $t_file_path = project_get_field($this->_mailbox['project_id'], 'file_path'); if ($t_file_path == '') { $t_file_path = config_get('absolute_path_default_upload_folder'); } $t_file_path = ERP_prepare_directory_string($t_file_path, TRUE); $t_real_file_path = ERP_prepare_directory_string($t_file_path); if (!file_exists($t_file_path) || !is_dir($t_file_path) || !is_writable($t_file_path) || !is_readable($t_file_path)) { $this->custom_error('Upload folder is not writable: ' . $t_file_path . "\n"); } elseif (strcasecmp($t_real_file_path, $t_file_path) !== 0) { $this->custom_error('Upload folder is not an absolute path' . "\n" . 'Upload folder: ' . $t_file_path . "\n" . 'Absolute path: ' . $t_real_file_path . "\n"); } else { $t_upload_folder_passed = TRUE; } } if ($t_upload_folder_passed) { $this->prepare_mailbox_hostname(); if (!$this->_test_only && $this->_mail_debug) { var_dump($this->_mailbox); } $this->show_memory_usage('Start process mailbox'); $t_process_mailbox_function = 'process_' . strtolower($this->_mailbox['mailbox_type']) . '_mailbox'; $this->{$t_process_mailbox_function}(); $this->show_memory_usage('Finished process mailbox'); } } else { $this->custom_error('Category does not exist'); } } else { $this->custom_error('Project does not exist'); } } else { $this->custom_error('Unknown mailbox type'); } } else { $this->custom_error('Mailbox disabled'); } } return $this->_result; }
ERP_print_menu($t_this_page); ?> <br /> <form action="<?php echo plugin_page($t_this_page . '_edit'); ?> " method="post"> <?php $GLOBALS['t_mailboxes'] = plugin_config_get('mailboxes'); $t_rules = plugin_config_get('rules'); $f_mailbox_action = gpc_get_string('mailbox_action', 'add'); $f_select_mailbox = gpc_get_int('select_mailbox', -1); // the defaults different from the default NULL value $t_mailbox = ERP_get_default_mailbox(); if ($f_mailbox_action !== 'add') { if (isset($GLOBALS['t_mailboxes'][$f_select_mailbox])) { // merge existing selected mailbox into the default mailbox overwriting existing default values $t_mailbox = $GLOBALS['t_mailboxes'][$f_select_mailbox] + $t_mailbox; // Add "Copy of" text if necessary to mailboxes being copied if ($f_mailbox_action === 'copy') { $t_mailbox['description'] = plugin_lang_get('copy_of') . ' ' . $t_mailbox['description']; } } else { $f_mailbox_action = 'add'; } } ERP_output_config_option('mailbox_action', 'hidden', $f_mailbox_action); ERP_output_config_option('select_mailbox', 'hidden', $f_select_mailbox); if ($f_mailbox_action === 'complete_test') {