- <?php
- Function PimpHandle( $handle_this ) {
- global $session;
- global $default;
- global $mail_action_message;
- global $title;
- global $server_settings_db;
- global $current_server_settings;
- global $user_obj;
- global $PIMP_VERSION;
- global $mail_folder;
- $mail_action_message = '';
- $current_server_settings = new MailServerSettings();
- $title = '';
- if ( $mail_folder == '' ) {
- $mail_folder = 'INBOX';
- $session->Add(
- $temp = new SessionElement( 'mail_folder', 'string' )
- );
- }
- /* Let's look up their use settings */
- $server_settings_db = new MailServer_Settings_Db();
- $server_settings_db = $server_settings_db->Db(
- $default->pimp_settings_db->driver,
- $default->pimp_settings_db
- );
- $ret_vals = $server_settings_db->Get( $user_obj->user_id );
- if ( $ret_vals[ 0 ] == 0 ) {
- $current_server_settings->user_id = $user_obj->user_id;
- $server_settings_db->Add( $current_server_settings );
- } else {
- $current_server_settings = $ret_vals[ 1 ];
- }
- if ( $current_server_settings->server_name == '' ) {
- $current_server_settings->server_name = $default->pimp->mail_server;
- }
- if ( $current_server_settings->server_username == '' ) {
- $current_server_settings->server_username = $user_obj->user_name;
- }
- if ( $current_server_settings->server_password == '' ) {
- $current_server_settings->server_password = $user_obj->password;
- }
- /*
- Debug jic -
- echo( '<!--' . "n" );
- echo( 'M : ' . $current_server_settings->server_name . "n" );
- echo( 'U : ' . $current_server_settings->server_username . "n" );
- echo( 'P : ' . $current_server_settings->server_password . "n" );
- echo( '-->' . "n" );
- */
- if ( $current_server_settings->from_name != '' ) {
- $title = $current_server_settings->from_name;
- }
- if ( $current_server_settings->from_address != '' ) {
- $title .= ' - ' . $current_server_settings->from_address;
- } else {
- if ( ereg( '@', $current_server_settings->server_username ) ) {
- /* Don't add a address format if its already there */
- $title .= ' - ' . $current_server_settings->server_username;
- } else {
- $title .= ' - ' .
- $current_server_settings->server_username . '@' .
- $current_server_settings->server_name;
- }
- }
- /* Default title setting */
- if ( $title == '' ) {
- if ( is_object( $user_obj ) ) {
- $title .= $user_obj->user_name;
- }
- if ( is_object( $user_domain_obj ) ) {
- if ( $user_domain_obj->domain_id != '' ) {
- $title .= '@' . $user_domain_obj->domain_name;
- } else {
- $title .= '@default';
- }
- }
- }
- $title .= ' - Mail ' . $PIMP_VERSION;
- }
- ?>