806 lines
		
	
	
		
			30 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			806 lines
		
	
	
		
			30 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| 
 | |
| ## ----------------------
 | |
| ## - webmail.warenform.de
 | |
| ## -
 | |
| 
 | |
| . roundcube.env.webmail.warenform.de
 | |
| 
 | |
| ## -
 | |
| ## - END: webmail.warenform.de
 | |
| ## ----------------------------
 | |
| 
 | |
| ## ----------------------
 | |
| ## - webmail2.warenform.de
 | |
| ## -
 | |
| 
 | |
| . roundcube.env.webmail2.warenform.de
 | |
| 
 | |
| ## -
 | |
| ## - END: webmail.warenform.de
 | |
| ## ----------------------------
 | |
| 
 | |
| ## ----------------------
 | |
| ## - webmail.so36.net
 | |
| ## -
 | |
| 
 | |
| . roundcube.env.webmail.so36.net
 | |
| 
 | |
| ## -
 | |
| ## - END: webmail.so36.net
 | |
| ## ----------------------------
 | |
| 
 | |
| ## ----------------------
 | |
| ## - webmail.interventionistische-linke.org
 | |
| ## -
 | |
| 
 | |
| . roundcube.env.webmail.interventionistische-linke.org
 | |
| 
 | |
| ## -
 | |
| ## - END: webmail.interventionistische-linke.org
 | |
| ## ----------------------------
 | |
| 
 | |
| ## ----------------------
 | |
| ## - webmail.initiativenserver.de
 | |
| ## -
 | |
| 
 | |
| . roundcube.env.webmail.initiativenserver.de
 | |
| 
 | |
| ## -
 | |
| ## - END: webmail.interventionistische-linke.org
 | |
| ## ----------------------------
 | |
| 
 | |
| ## ----------------------
 | |
| ## - webmail2.initiativenserver.de
 | |
| ## -
 | |
| 
 | |
| . roundcube.env.webmail2.initiativenserver.de
 | |
| 
 | |
| ## -
 | |
| ## - END: webmail.interventionistische-linke.org
 | |
| ## ----------------------------
 | |
| 
 | |
| ## ----------------------
 | |
| ## - webmail2.oopen.de
 | |
| ## -
 | |
| 
 | |
| . roundcube.env.webmail2.oopen.de
 | |
| 
 | |
| ## -
 | |
| ## - END: webmail.oopen.de
 | |
| ## ----------------------------
 | |
| 
 | |
| ## ----------------------
 | |
| ## - webmail.oopen.de
 | |
| ## -
 | |
| 
 | |
| . roundcube.env.webmail.oopen.de
 | |
| 
 | |
| ## -
 | |
| ## - END: webmail.oopen.de
 | |
| ## ----------------------------
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| ## ----------------------------------------------- #
 | |
| ## --- integrate jqueryui plugin for roundcube --- #
 | |
| ## ----------------------------------------------- #
 | |
| 
 | |
| ## - jqueryui plugin comes with roundcube core distribution. So you have
 | |
| ## - only to register it.
 | |
| 
 | |
| ## - register jqueryui plugin with roundcube
 | |
| ## -
 | |
| ## - edit  $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/config.inc.php
 | |
| ## -
 | |
| ## - add "login_lang" to array plugins
 | |
| ## -    $config['plugins'] = array('jqueryui');
 | |
| ## -
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/config.inc.php
 | |
| 
 | |
| 
 | |
| 
 | |
| ## ----------------------------------------------- #
 | |
| ## --- integrate password plugin for roundcube --- #
 | |
| ## ----------------------------------------------- #
 | |
| 
 | |
| cp $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/password/config.inc.php.dist \
 | |
|    $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/password/config.inc.php
 | |
| 
 | |
| ## - edit $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/password/config.inc.php
 | |
| ## -
 | |
| ## - adjust:
 | |
| ## -
 | |
| ## -    $config['password_driver'] = 'sql';
 | |
| ## -    $config['password_confirm_current'] = true;
 | |
| ## -
 | |
| ## -    $config['password_minimum_length'] = 8;
 | |
| ## -    $config['password_require_nonalpha'] = true;
 | |
| ## -
 | |
| ## -    NOTE: The database configuration data from POSTFIX Dateabase are needed !!
 | |
| ## -          Put in your database credentials
 | |
| ## -
 | |
| ## -    $config['password_db_dsn'] = '${_db_type}://${_db_user}:${_db_pass}@localhost/${_db_name}';
 | |
| ## -
 | |
| ## -    $config['password_query'] = 'UPDATE mailbox SET password=%p WHERE username=%u';
 | |
| ## - 
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/password/config.inc.php
 | |
| 
 | |
| ## - register password plugin with roundcube
 | |
| ## -
 | |
| ## - edit  $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/config.inc.php
 | |
| ## -
 | |
| ## - add "password" to array plugins
 | |
| ## -    $config['plugins'] = array('jqueryui', 'password');
 | |
| ## -
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/config.inc.php
 | |
| 
 | |
| 
 | |
| 
 | |
| ## --------------------------------------------------- #
 | |
| ## --- Install vacation plugin bhusigen rc-vacation -- #
 | |
| ## --------------------------------------------------- #
 | |
| 
 | |
| ## - see: https://github.com/bhuisgen/rc-vacation/
 | |
| 
 | |
| ## - requirements, if using datepicker:
 | |
| ## -    - plugin jqueryui
 | |
| 
 | |
| ## - Download from site https://github.com/bhuisgen/rc-vacation/ and
 | |
| ## - store archive in $WEBMAIL_BASEDIR
 | |
| ## -
 | |
| cd $WEBMAIL_BASEDIR
 | |
| rm rc-vacation-master.zip
 | |
| wget -O rc-vacation-master.zip https://github.com/bhuisgen/rc-vacation/archive/master.zip
 | |
| 
 | |
| cd $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins
 | |
| unzip $WEBMAIL_BASEDIR/rc-vacation-master.zip
 | |
| ln -s rc-vacation-master $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/vacation
 | |
| 
 | |
| cp $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/vacation/config.inc.php.dist \
 | |
|    $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/vacation/config.inc.php
 | |
| 
 | |
| if [ "$_db_type" = "pgsql" ];then
 | |
| 
 | |
|    ## -------------------------------------------------------------- ##
 | |
|    ## - !! That (very long) part concerns to PostgeSQL Database !! - ##
 | |
|    ## -------------------------------------------------------------- ##
 | |
| 
 | |
|    ## - Note: In the following sql statements set the correct AUTOREPLY domain !!
 | |
|    ## -       Also chnage the database parameters as yor needs
 | |
|    ## -
 | |
|    ## - edit configuration $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/vacation/config.inc.php
 | |
|    ## -
 | |
|    ## -    $rcmail_config['vacation_gui_vacationdate'] = TRUE;
 | |
|    ## -    $rcmail_config['vacation_subject_default'] = 'Re: $SUBJECT';
 | |
|    ## -
 | |
|    ## -    $rcmail_config['vacation_gui_vacationforwarder'] = FALSE;
 | |
|    ## -
 | |
|    ## -    $rcmail_config['vacation_dateformat'] = 'Y-m-d' ;
 | |
|    ## -    $rcmail_config['vacation_jquery_calendar'] = TRUE;
 | |
|    ## -    $rcmail_config['vacation_jquery_dateformat'] = 'yy-m-d';
 | |
|    ## -
 | |
|    ## -    $rcmail_config['vacation_forwarder_multiple'] = FALSE;
 | |
|    ## -    $rcmail_config['vacation_forwarder_separator'] = ',';
 | |
|    ## -
 | |
|    ## -    $rcmail_config['vacation_driver'] = 'sql';
 | |
|    ## -
 | |
|    ## -    #configure your database connection to POSTFIX database
 | |
|    ## -    $rcmail_config['vacation_sql_dsn'] = '${_db_type}://${_db_user}:${_db_pass}@localhost/${_db_name}';
 | |
|    ## -
 | |
|    ## -
 | |
|    ## -    # !! NOTE: You have to create postgres function udf_forwarders_out and
 | |
|    ## -    #          udf_forwarders_in to get the following SQL statements working
 | |
|    ## -    #
 | |
|    ## -
 | |
|    ## -    // read data queries
 | |
|    ## -    $rcmail_config['vacation_sql_read'] =
 | |
|    ## -       array(
 | |
|    ## -          "SELECT 
 | |
|    ## -             subject AS vacation_subject, 
 | |
|    ## -             body AS vacation_message, 
 | |
|    ## -             date(activefrom) AS vacation_start,
 | |
|    ## -             date(activeuntil) AS vacation_end,
 | |
|    ## -             CASE WHEN vacation.active = TRUE THEN true ELSE false END AS vacation_enable,
 | |
|    ## -             udf_forwarders_out(%username,'$_autoreply_domain',',') AS vacation_forwarder
 | |
|    ## -          FROM vacation,alias
 | |
|    ## -          WHERE email=%username AND address=%username AND vacation.domain=%email_domain;"
 | |
|    ## -            );
 | |
|    ## -
 | |
|    ## -
 | |
|    ## -    // write data queries
 | |
|    ## -    /* !! Wichtig:  
 | |
|    ## -          Nur wenn rcmail_config['vacation_gui_vacationforwarder'] = FALSE
 | |
|    ## -    
 | |
|    ## -          NOTE: interval_time wird statisch gesetzt auf 86400 (1 Tag)
 | |
|    ## -    */
 | |
|    ## -    $rcmail_config['vacation_sql_write'] =
 | |
|    ## -       array("DELETE FROM vacation WHERE email=%email AND domain=%email_domain;",
 | |
|    ## -             "DELETE from vacation_notification WHERE on_vacation=%email;",
 | |
|    ## -             "INSERT INTO vacation (email,domain,subject,body,activefrom,activeuntil,interval_time,created,active) " .
 | |
|    ## -                "VALUES (%email,%email_domain,%vacation_subject,%vacation_message," .
 | |
|    ## -                         "to_timestamp(%vacation_start - extract(timezone from current_timestamp))," .
 | |
|    ## -                         "to_timestamp(%vacation_end + 86399 - extract(timezone from current_timestamp))," .
 | |
|    ## -                         "86400,NOW(),udf_set_active(%vacation_enable));",
 | |
|    ## -             "UPDATE alias SET goto = udf_forwarders_in(udf_forwarders_out(%email,'$_autoreply_domain',',')," .
 | |
|    ## -                                         "%email,'$_autoreply_domain',',',udf_set_active(%vacation_enable))" .
 | |
|    ## -                               ", modified = NOW() " .
 | |
|    ## -                           " WHERE address = %email"
 | |
|    ## -    
 | |
|    ## -       );
 | |
|    ## -    
 | |
|    ## -    /* !! Wichtig:  
 | |
|    ## -          Nur wenn rcmail_config['vacation_gui_vacationforwarder'] = TRUE 
 | |
|    ## -    
 | |
|    ## -          NOTE: interval_time wird statisch gesetzt auf 86400 (1 Tag)
 | |
|    ## -    */
 | |
|    ## -    /*
 | |
|    ## -    $rcmail_config['vacation_sql_write'] =
 | |
|    ## -       array("DELETE FROM vacation WHERE email=%email AND domain=%email_domain;",
 | |
|    ## -              "DELETE from vacation_notification WHERE on_vacation=%email;",
 | |
|    ## -             "INSERT INTO vacation (email,domain,subject,body,activefrom,activeuntil,interval_time,created,active) " .
 | |
|    ## -                "VALUES (%email,%email_domain,%vacation_subject,%vacation_message," .
 | |
|    ## -                         "to_timestamp(%vacation_start - extract(timezone from current_timestamp))," .
 | |
|    ## -                         "to_timestamp(%vacation_end + 86399 - extract(timezone from current_timestamp))," .
 | |
|    ## -                         "86400,NOW(),udf_set_active(%vacation_enable));",
 | |
|    ## -              "UPDATE alias SET goto = udf_forwarders_in(%vacation_forwarder," .
 | |
|    ## -                                       "%email,'$_autoreply_domain',',',udf_set_active(%vacation_enable))" .
 | |
|    ## -                            ", modified = NOW() " .
 | |
|    ## -                            " WHERE address = %email"
 | |
|    ## -       );
 | |
|    ## -
 | |
|    ## - !! Notice !!
 | |
|    ## - Replace '$_autoreply_domain' string with the true vaction domain.
 | |
|    ## - 
 | |
|    ## -    i.e for oopen.de: :1,$s/\$_autoreply_domain/autoreply.oopen.de/gc
 | |
|    ## -
 | |
|    vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/vacation/config.inc.php
 | |
| 
 | |
| 
 | |
|    ## - create postfix trigger function udf_forwarders_out:
 | |
|    ## -
 | |
|    cat <<EOF > /tmp/postgres.forwarders_out.sql
 | |
| CREATE LANGUAGE plpgsql;
 | |
| 
 | |
| CREATE FUNCTION udf_forwarders_out(email_str text, vacation_domain text, list_seperator character) RETURNS text
 | |
|     LANGUAGE plpgsql
 | |
|     AS \$\$
 | |
|    DECLARE
 | |
|       forward_str text;
 | |
|       local_email_part TEXT;
 | |
|       domain_email_part TEXT;
 | |
|    BEGIN
 | |
|       
 | |
|       -- get list of forwarders
 | |
|       --
 | |
|       SELECT goto INTO forward_str FROM alias WHERE address=email_str;
 | |
|       
 | |
|       -- entferne mailbox emailadresse
 | |
|       -- 
 | |
|       forward_str = replace(forward_str, email_str, '' );
 | |
|       
 | |
|       -- entferne vacation adresse
 | |
|       --
 | |
|       local_email_part = substring(email_str, 1, position('@' in email_str) - 1);
 | |
|       domain_email_part = substring(email_str,  position('@' in email_str) + 1 );
 | |
|       forward_str = replace(forward_str, local_email_part || '#' || domain_email_part || '@' || vacation_domain, '');
 | |
| 
 | |
|       -- enferne doppelte seperatorzeichen 
 | |
|       --
 | |
|       WHILE position( list_seperator || list_seperator in forward_str ) > 0 LOOP
 | |
|          forward_str = replace(forward_str, list_seperator || list_seperator , '');
 | |
|       END LOOP;
 | |
| 
 | |
|       -- entferne erstes zeichen wenn es das seperatorzeichen ist
 | |
|       --
 | |
|       IF substring(forward_str,1,1)  = list_seperator THEN
 | |
|          forward_str = substring(forward_str from 2);
 | |
|       END IF;
 | |
| 
 | |
| 
 | |
|       -- entferne letztes zeichen wenn es das seperatorzeichen ist
 | |
|       --
 | |
|       IF substring(forward_str from  char_length(forward_str))  = list_seperator THEN
 | |
|          forward_str = substring(forward_str, 1, char_length(forward_str) - 1);
 | |
|       END IF;
 | |
| 
 | |
| 
 | |
|       -- forward_str = substring(forward_str from  char_length(forward_str));
 | |
| 
 | |
|       RETURN forward_str;
 | |
|    END;
 | |
|    \$\$;
 | |
| EOF
 | |
| 
 | |
|    ## - create function
 | |
|    ## -
 | |
|    ## - Note 1.
 | |
|    ## - if datbase language plpgsql already exists, an error occurs. but you can
 | |
|    ## - savely ignore that error
 | |
|    ## -
 | |
|    ## - Note 2.
 | |
|    ## - if you create the function not as postfix database user, you have to
 | |
|    ## - give the permission afterwards:
 | |
|    ## -    ALTER FUNCTION public.udf_forwarders_out(email_str text, vacation_domain text, list_seperator character) OWNER TO postfix;
 | |
|    ## - But we will use the db postfix user (here also named postfix)
 | |
|    ## -
 | |
|    psql -Upostfix postfix < /tmp/postgres.forwarders_out.sql
 | |
| 
 | |
|    rm /tmp/postgres.forwarders_out.sql
 | |
| 
 | |
|    
 | |
|    ## - create sql file for installing function udf_set_active:
 | |
|    ## -
 | |
|    cat <<EOF > /tmp/postgres.set_active.sql
 | |
| CREATE LANGUAGE plpgsql;
 | |
|  
 | |
| CREATE FUNCTION udf_set_active(vacation_enable text) RETURNS boolean
 | |
|     LANGUAGE plpgsql
 | |
|     AS \$\$
 | |
|    DECLARE
 | |
|       return_val boolean;
 | |
|    BEGIN
 | |
|  
 | |
|       return_val = 't';
 | |
|  
 | |
|       IF vacation_enable = '' THEN
 | |
|          return_val = 'f';
 | |
|       END IF;
 | |
|  
 | |
|       IF vacation_enable = '0' THEN
 | |
|          return_val = 'f';
 | |
|       END IF;
 | |
|  
 | |
|       IF lower(vacation_enable) = 'false' THEN
 | |
|          return_val = 'f';
 | |
|       END IF;
 | |
|  
 | |
|       RETURN return_val;
 | |
|    END;
 | |
|    \$\$;
 | |
| EOF
 | |
|  
 | |
|    ## - create function udf_set_active
 | |
|    ## -
 | |
|    ## - Note 1.
 | |
|    ## - if datbase language plpgsql already exists, an error occurs. but you can
 | |
|    ## - savely ignore that error
 | |
|    ## -
 | |
|    ## - Note 2.
 | |
|    ## - if you create the function not as postfix database user, you have to
 | |
|    ## - give the permission afterwards:
 | |
|    ## -    ALTER FUNCTION public.udf_forwarders_in(forewarders_str text, email_str text, vacation_domain text, list_seperator character, vacation_enable boolean) OWNER TO postfix;
 | |
|    ## - But we will use the db postfix user (here also named postfix)
 | |
|    ## -
 | |
|    psql -Upostfix postfix < /tmp/postgres.set_active.sql
 | |
| 
 | |
|    rm /tmp/postgres.set_active.sql
 | |
| 
 | |
| 
 | |
|    ## - create postfix database function udf_forwarders_in:
 | |
|    ## -
 | |
|    cat <<EOF > /tmp/postgres.forwarders_in.sql
 | |
| CREATE LANGUAGE plpgsql;
 | |
| 
 | |
| CREATE FUNCTION udf_forwarders_in(forewarders_str text, email_str text, vacation_domain text, list_seperator character, vacation_enable boolean) RETURNS text
 | |
|     LANGUAGE plpgsql
 | |
|     AS \$\$
 | |
|    DECLARE
 | |
|       return_str text;
 | |
|       local_email_part TEXT;
 | |
|       domain_email_part TEXT;
 | |
|    BEGIN
 | |
| 
 | |
|       return_str = email_str;
 | |
| 
 | |
|       IF vacation_enable THEN
 | |
|         local_email_part = substring(email_str, 1, position('@' in email_str) - 1);
 | |
|         domain_email_part = substring(email_str,  position('@' in email_str) + 1 );
 | |
|         return_str = return_str || list_seperator || local_email_part || '#' || domain_email_part || '@' || vacation_domain;
 | |
|       END IF;
 | |
| 
 | |
|       IF char_length(forewarders_str) > 7 THEN
 | |
|          return_str = return_str || list_seperator || forewarders_str;
 | |
|       END IF;
 | |
| 
 | |
|       RETURN return_str;
 | |
|    END;
 | |
|    \$\$;
 | |
| EOF
 | |
| 
 | |
|    ## - create function udf_forwarders_in
 | |
|    ## -
 | |
|    ## - Note 1.
 | |
|    ## - if datbase language plpgsql already exists, an error occurs. but you can
 | |
|    ## - savely ignore that error
 | |
|    ## -
 | |
|    ## - Note 2.
 | |
|    ## - if you create the function not as postfix database user, you have to
 | |
|    ## - give the permission afterwards:
 | |
|    ## -    ALTER FUNCTION public.udf_forwarders_in(forewarders_str text, email_str text, vacation_domain text, list_seperator character, vacation_enable boolean) OWNER TO postfix;
 | |
|    ## - But we will use the db postfix user (here also named postfix)
 | |
|    ## -
 | |
|    psql -Upostfix postfix < /tmp/postgres.forwarders_in.sql
 | |
| 
 | |
|    rm /tmp/postgres.forwarders_in.sql
 | |
| 
 | |
| elif [ "$_db_type" = "mysql" ];then
 | |
| 
 | |
|    ## ---------------------------------------------------------- ##
 | |
|    ## - !! That (very long) part concerns to MySQL Database !! - ##
 | |
|    ## ---------------------------------------------------------- ##
 | |
| 
 | |
|    ## - Note: In the following sql statements set the correct AUTOREPLY domain !!
 | |
|    ## -       Also chnage the database parameters as yor needs
 | |
|    ## -
 | |
|    ## - edit configuration $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/vacation/config.inc.php
 | |
|    ## -
 | |
|    ## -    $rcmail_config['vacation_gui_vacationforwarder'] = FALSE;
 | |
|    ## -    $rcmail_config['vacation_forwarder_multiple'] = FALSE;
 | |
|    ## -    $rcmail_config['vacation_forwarder_separator'] = ',';
 | |
|    ## -
 | |
|    ## -    $rcmail_config['vacation_driver'] = 'sql';
 | |
|    ## -
 | |
|    ## -    #configure your database connection to POSTFIX database
 | |
|    ## -    $rcmail_config['vacation_sql_dsn'] = '${_db_type}://${_db_user}:${_db_pass}@localhost/${_db_name}';
 | |
|    ## -
 | |
|    ## -    # !! NOTE: You have to create myql functions FORWARDERS_OUT and 
 | |
|    ## -    #          FORWARDERS_IN to get the following SQL read statement working
 | |
|    ## -    #
 | |
|    ## -
 | |
|    ## -    // read data queries
 | |
|    ## -    /* - OLD: vcation.pl included in posfixadmin until version 2.3.7
 | |
|    ## -    $rcmail_config['vacation_sql_read'] =
 | |
|    ## -       array("SELECT subject AS vacation_subject, body AS vacation_message, " .
 | |
|    ## -                 "vacation.active AS vacation_enable, FORWARDERS_OUT(%username,'$_autoreply_domain',',') AS vacation_forwarder FROM vacation,alias " .
 | |
|    ## -             "WHERE email=%username AND address=%username  AND vacation.domain=%email_domain;"
 | |
|    ## -            );
 | |
|    ## -    *)
 | |
|    ## -    /* - NEW: vcation.pl included in posfixadmin since version 2.91 */
 | |
|    ## -    $rcmail_config['vacation_sql_read'] =
 | |
|    ## -       array("SELECT subject AS vacation_subject, body AS vacation_message," .
 | |
|    ## -                     "UNIX_TIMESTAMP(activefrom) AS vacation_start," .
 | |
|    ## -                     "UNIX_TIMESTAMP(activeuntil) AS vacation_end," .
 | |
|    ## -                     "vacation.active AS vacation_enable," .
 | |
|    ## -                     "FORWARDERS_OUT(%username,'$_autoreply_domain',',') AS vacation_forwarder " .
 | |
|    ## -             "FROM vacation,alias " .
 | |
|    ## -             "WHERE email=%username AND address=%username  AND vacation.domain=%email_domain;"
 | |
|    ## -            );
 | |
|    ## -    
 | |
|    ## -    
 | |
|    ## -    // write data queries
 | |
|    ## -    /* !! Wichtig:  
 | |
|    ## -          Nur wenn rcmail_config['vacation_gui_vacationforwarder'] = FALSE
 | |
|    ## -    */
 | |
|    ## -    
 | |
|    ## -    /* - OLD: vcation.pl included in posfixadmin until version 2.3.7
 | |
|    ## -    $rcmail_config['vacation_gui_vacationforwarder'] = FALSE;
 | |
|    ## -    $rcmail_config['vacation_sql_write'] =
 | |
|    ## -       array("DELETE FROM vacation WHERE email=%email AND " .
 | |
|    ## -                "domain=%email_domain;",
 | |
|    ## -              "DELETE from vacation_notification WHERE on_vacation=%email;",
 | |
|    ## -             "INSERT INTO vacation (email,domain,subject,body,created," .
 | |
|    ## -                "active) VALUES (%email,%email_domain,%vacation_subject," .
 | |
|    ## -                   "%vacation_message,NOW(),%vacation_enable);",
 | |
|    ## -              "UPDATE alias SET goto = FORWARDERS_IN(FORWARDERS_OUT(%email,'$_autoreply_domain',',')," .
 | |
|    ## -                                       "%email,'$_autoreply_domain',',',%vacation_enable)" .
 | |
|    ## -                                ", modified = NOW() " .
 | |
|    ## -                            " WHERE address = %email"
 | |
|    ## -      );
 | |
|    ## -    /*
 | |
|    ## -
 | |
|    ## -    /* - NEW: vcation.pl included in posfixadmin since version 2.91 */
 | |
|    ## -    /*
 | |
|    ## -    $rcmail_config['vacation_gui_vacationforwarder'] = FALSE;
 | |
|    ## -    $rcmail_config['vacation_sql_write'] =
 | |
|    ## -       array("DELETE FROM vacation WHERE email=%email AND domain=%email_domain;",
 | |
|    ## -             "DELETE from vacation_notification WHERE on_vacation=%email;",
 | |
|    ## -             "INSERT INTO vacation (email,domain,subject,body,activefrom,activeuntil,interval_time,created,active) " .
 | |
|    ## -                "VALUES (%email,%email_domain,%vacation_subject,%vacation_message," .
 | |
|    ## -                         "CONCAT(DATE(FROM_UNIXTIME(%vacation_start)), ' 00:00:00')," .
 | |
|    ## -                         "CONCAT(DATE(FROM_UNIXTIME(%vacation_end)), ' 23:59:59')," .
 | |
|    ## -                         "86400,NOW(),%vacation_enable);",
 | |
|    ## -              "UPDATE alias SET goto = FORWARDERS_IN(FORWARDERS_OUT(%email,'$_autoreply_domain',',')," .
 | |
|    ## -                                       "%email,'$_autoreply_domain',',',%vacation_enable)" .
 | |
|    ## -                                ", modified = NOW() " .
 | |
|    ## -                            " WHERE address = %email"
 | |
|    ## -      );
 | |
|    ## -    */
 | |
|    ## -    
 | |
|    ## -    /* !! Wichtig:  
 | |
|    ## -          Nur wenn rcmail_config['vacation_gui_vacationforwarder'] = TRUE
 | |
|    ## -    */
 | |
|    ## -    
 | |
|    ## -    /*
 | |
|    ## -
 | |
|    ## -    /* - OLD: vcation.pl included in posfixadmin until version 2.3.7
 | |
|    ## -    $rcmail_config['vacation_gui_vacationforwarder'] = TRUE;
 | |
|    ## -    $rcmail_config['vacation_sql_write'] =
 | |
|    ## -       array("DELETE FROM vacation WHERE email=%email AND " .
 | |
|    ## -                "domain=%email_domain;",
 | |
|    ## -              "DELETE from vacation_notification WHERE on_vacation=%email;",
 | |
|    ## -             "INSERT INTO vacation (email,domain,subject,body,created," .
 | |
|    ## -                "active) VALUES (%email,%email_domain,%vacation_subject," .
 | |
|    ## -                   "%vacation_message,NOW(),%vacation_enable);",
 | |
|    ## -              "UPDATE alias SET goto = FORWARDERS_IN(%vacation_forwarder," .
 | |
|    ## -                                       "%email,'$_autoreply_domain',',',%vacation_enable)" .
 | |
|    ## -                                ", modified = NOW() " .
 | |
|    ## -                            " WHERE address = %email"
 | |
|    ## -      );
 | |
|    ## -    */
 | |
|    ## -    
 | |
|    ## -    /* - NEW: vcation.pl included in posfixadmin since version 2.91 */
 | |
|    ## -    $rcmail_config['vacation_gui_vacationforwarder'] = TRUE;
 | |
|    ## -    $rcmail_config['vacation_sql_write'] =
 | |
|    ## -       array("DELETE FROM vacation WHERE email=%email AND domain=%email_domain;",
 | |
|    ## -             "DELETE from vacation_notification WHERE on_vacation=%email;",
 | |
|    ## -             "INSERT INTO vacation (email,domain,subject,body,activefrom,activeuntil,interval_time,created,active) " .
 | |
|    ## -                "VALUES (%email,%email_domain,%vacation_subject,%vacation_message," .
 | |
|    ## -                         "CONCAT(DATE(FROM_UNIXTIME(%vacation_start)), ' 00:00:00')," .
 | |
|    ## -                         "CONCAT(DATE(FROM_UNIXTIME(%vacation_end)), ' 23:59:59')," .
 | |
|    ## -                         "86400,NOW(),%vacation_enable);",
 | |
|    ## -              "UPDATE alias SET goto = FORWARDERS_IN(%vacation_forwarder," .
 | |
|    ## -                                       "%email,'$_autoreply_domain',',',%vacation_enable)" .
 | |
|    ## -                                ", modified = NOW() " .
 | |
|    ## -                            " WHERE address = %email"
 | |
|    ## -      );
 | |
|    ## -    
 | |
|    ## -
 | |
|    vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/vacation/config.inc.php
 | |
| 
 | |
| 
 | |
|    ## - create function FORWARDERS_OUT:
 | |
|    ## -
 | |
|    cat <<EOF > /tmp/FORWARDERS_OUT.sql
 | |
| DROP FUNCTION IF EXISTS FORWARDERS_OUT ;
 | |
| 
 | |
| DELIMITER |
 | |
| 
 | |
| CREATE FUNCTION FORWARDERS_OUT (email_str TEXT, vacation_domain TEXT , list_seperator CHAR)
 | |
|    RETURNS TEXT
 | |
|    DETERMINISTIC
 | |
|    BEGIN
 | |
|       DECLARE forward_str TEXT;
 | |
|       DECLARE local_email_part TEXT;
 | |
|       DECLARE domain_email_part TEXT;
 | |
|       DECLARE first_char CHAR;
 | |
|       DECLARE last_char CHAR;
 | |
| 
 | |
|       -- get list of forwarders
 | |
|       -- 
 | |
|       SELECT goto INTO forward_str FROM alias WHERE address=email_str;
 | |
| 
 | |
|       -- entferne mailbox emailadresse
 | |
|       --
 | |
|       SET forward_str =  REPLACE(forward_str, email_str, '' );
 | |
|       -- SELECT REPLACE(forward_str, email_str, '' ) INTO forward_str;
 | |
| 
 | |
|       -- entferne vacation adresse
 | |
|       -- 
 | |
|       SET local_email_part = SUBSTRING(email_str,1, LOCATE('@',email_str) - 1);
 | |
|       SET domain_email_part = SUBSTRING(email_str, LOCATE('@',email_str) + 1, LENGTH(email_str));
 | |
|       SET forward_str = REPLACE(forward_str, CONCAT(local_email_part, "#" ,domain_email_part,"@", vacation_domain), '');
 | |
|       -- SELECT REPLACE(forward_str, CONCAT(list_seperator,list_seperator), list_seperator) INTO forward_str;
 | |
| 
 | |
|       -- enferne doppelte seperatorzeichen
 | |
|       -- 
 | |
|       WHILE LOCATE(CONCAT(list_seperator,list_seperator) , forward_str) DO
 | |
|          SET forward_str = REPLACE(forward_str, CONCAT(list_seperator,list_seperator), list_seperator);
 | |
|          -- SELECT REPLACE(forward_str, CONCAT(list_seperator,list_seperator), list_seperator) INTO forward_str;
 | |
|       END WHILE ;
 | |
| 
 | |
|       -- entferne erstes zeichen wenn es das seperatorzeichen ist
 | |
|       --
 | |
|       IF LEFT(forward_str,1) = list_seperator THEN
 | |
|          SET forward_str =  SUBSTRING(forward_str FROM 2);
 | |
|          -- SELECT SUBSTRING(forward_str FROM 2) INTO forward_str;
 | |
|       END IF;
 | |
| 
 | |
|       -- entferne letztes zeichen wenn es das seperatorzeichen ist
 | |
|       --
 | |
|       IF RIGHT(forward_str,1) = list_seperator THEN
 | |
|          SET forward_str = SUBSTRING(forward_str , 1, LENGTH(forward_str) - 1);
 | |
|          -- SELECT SUBSTRING(forward_str , 1, LENGTH(forward_str) - 1) INTO forward_str;
 | |
|       END IF;
 | |
| 
 | |
|       RETURN forward_str;
 | |
|    END |
 | |
| 
 | |
| DELIMITER ;
 | |
| EOF
 | |
| 
 | |
|    ## - create function
 | |
|    ## -
 | |
|    ## - Note 1.
 | |
|    ## -  Create function as postfix database user
 | |
|    ## -
 | |
|    ## -  The postfix databaseuser wil need 'Super_priv'. At MySQL monitor 
 | |
|    ## -  (as mysql admin user i.e. root) type:
 | |
|    ## -        UPDATE user SET Super_priv = 'Y' WHERE User = 'postfix';
 | |
|    ## -
 | |
|    ## - Note 2.
 | |
|    ## - You can verify on mysql monitor (database postfix) with:
 | |
|    ## -    SHOW FUNCTION STATUS;
 | |
|    ## - or see the code:
 | |
|    ## -    SHOW CREATE FUNCTION FORWARDERS_OUT;
 | |
|    ## -
 | |
|    mysql -upostfix -p postfix < /tmp/FORWARDERS_OUT.sql
 | |
| 
 | |
|    rm /tmp/FORWARDERS_OUT.sql
 | |
| 
 | |
| 
 | |
|    ## - create database function FORWARDERS_IN:
 | |
|    ## -
 | |
|    cat <<EOF > /tmp/FORWARDERS_IN.sql
 | |
| DROP FUNCTION IF EXISTS FOWARDERS_IN ;
 | |
| 
 | |
| DELIMITER |
 | |
| 
 | |
| CREATE FUNCTION FORWARDERS_IN (forewarders_str TEXT,
 | |
|                                   email_str TEXT,
 | |
|                                   vacation_domain TEXT ,
 | |
|                                   list_seperator CHAR ,
 | |
|                                   vacation_enable BOOLEAN)
 | |
|    RETURNS TEXT
 | |
|    DETERMINISTIC
 | |
|    BEGIN
 | |
|       DECLARE return_str TEXT;
 | |
|       DECLARE local_email_part TEXT;
 | |
|       DECLARE domain_email_part TEXT;
 | |
| 
 | |
| 
 | |
|       SET return_str = email_str;
 | |
| 
 | |
|       IF vacation_enable THEN
 | |
|          SET local_email_part = SUBSTRING(email_str,1, LOCATE('@',email_str) - 1);
 | |
|          SET domain_email_part = SUBSTRING(email_str, LOCATE('@',email_str) + 1, LENGTH(email_str));
 | |
|          SET return_str = CONCAT(return_str, list_seperator, local_email_part, "#" ,domain_email_part,"@", vacation_domain);
 | |
|       END IF;
 | |
| 
 | |
|       IF LENGTH(forewarders_str) > 2 THEN
 | |
|          SET return_str = CONCAT(return_str, list_seperator, forewarders_str);
 | |
|       END IF;
 | |
| 
 | |
|       RETURN return_str;
 | |
|    END |
 | |
| 
 | |
| DELIMITER ;
 | |
| EOF
 | |
| 
 | |
| 
 | |
|    ## - create function FOWARDERS_IN
 | |
|    ## -
 | |
|    ## - Note 1.
 | |
|    ## -  Create function as postfix database user
 | |
|    ## -
 | |
|    ## -  The postfix databaseuser wil need 'Super_priv'. At MySQL monitor 
 | |
|    ## -  (as mysql admin user i.e. root) type:
 | |
|    ## -        UPDATE user SET Super_priv = 'Y' WHERE User = 'postfix';
 | |
|    ## -
 | |
|    ## - Note 2.
 | |
|    ## - You can verify on mysql monitor (database postfix) with:
 | |
|    ## -    SHOW FUNCTION STATUS;
 | |
|    ## - or see the code:
 | |
|    ## -    SHOW CREATE FUNCTION FOWARDERS_IN;
 | |
|    ## -
 | |
| 
 | |
|    mysql -upostfix -p postfix < /tmp/FORWARDERS_IN.sql
 | |
| 
 | |
|    rm /tmp/FORWARDERS_IN.sql
 | |
| 
 | |
| else
 | |
|    echo -e "\n\t[ ERROR ]: Unknown database type \"$_db_type\""
 | |
| fo
 | |
| 
 | |
| 
 | |
| ## - register vacation plugin with roundcube
 | |
| ## -
 | |
| ## - edit  $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/config.inc.php
 | |
| ## -
 | |
| ## - add "rc-vacation" to array plugins
 | |
| ## -    $rcmail_config['plugins'] = array('jquery', 'password', 'vacation');
 | |
| ## -
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/config.inc.php
 | |
| 
 | |
| 
 | |
| 
 | |
| ## -------------------------------------------------------- #
 | |
| ## --- Install plugin language selector on login screen --- #
 | |
| ## -------------------------------------------------------- #
 | |
| 
 | |
| ## - see: https://github.com/hassansin/roundcube-login-language/
 | |
| 
 | |
| ## - Download from site https://github.com/hassansin/roundcube-login-language/ and
 | |
| ## - store archive in $WEBMAIL_BASEDIR
 | |
| ## -
 | |
| cd $WEBMAIL_BASEDIR
 | |
| rm login-language-master.zip
 | |
| wget -O login-language-master.zip https://github.com/hassansin/roundcube-login-language/archive/master.zip
 | |
| 
 | |
| cd $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins
 | |
| unzip $WEBMAIL_BASEDIR/login-language-master.zip
 | |
| ln -s roundcube-login-language-master/ $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/login_lang
 | |
| 
 | |
| cp $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/login_lang/config.inc.php.dist \
 | |
|    $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/login_lang/config.inc.php
 | |
| 
 | |
| 
 | |
| ## - edit config.php and set default language selection
 | |
| ## - 
 | |
| ## -    $config['language_dropdown_selected'] = 'de_DE';
 | |
| ## -
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/login_lang/config.inc.php
 | |
| 
 | |
| 
 | |
| ## - register language selector plugin with roundcube
 | |
| ## -
 | |
| ## - edit  $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/config.inc.php
 | |
| ## -
 | |
| ## - add "login_lang" to array plugins
 | |
| ## -    $config['plugins'] = array('login_lang', 'jqueryui', 'password', 'vacation');
 | |
| ## -
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/config.inc.php
 | |
| 
 | |
| 
 | |
| 
 | |
| ## -------------------------------------------------- #
 | |
| ## --- integrate ContextMenu plugin for roundcube --- #
 | |
| ## -------------------------------------------------- #
 | |
| 
 | |
| ## - see: https://github.com/JohnDoh/Roundcube-Plugin-Context-Menu
 | |
| 
 | |
| ## - Download from site https://github.com/bhuisgen/rc-vacation/ and
 | |
| ## - store archive in $WEBMAIL_BASEDIR
 | |
| ## -
 | |
| cd $WEBMAIL_BASEDIR
 | |
| rm Roundcube-Plugin-Context-Menu-master.zip
 | |
| wget -O Roundcube-Plugin-Context-Menu-master.zip https://github.com/JohnDoh/Roundcube-Plugin-Context-Menu/archive/master.zip
 | |
| 
 | |
| cd $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins
 | |
| unzip $WEBMAIL_BASEDIR/Roundcube-Plugin-Context-Menu-master.zip
 | |
| ln -s Roundcube-Plugin-Context-Menu-master $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/contextmenu
 | |
| 
 | |
| 
 | |
| ## - register ContextMenu plugin with roundcube
 | |
| ## -
 | |
| ## - edit  $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/config.inc.php
 | |
| ## -
 | |
| ## - add "login_lang" to array plugins
 | |
| ## -    $config['plugins'] = array('login_lang', 'jqueryui', 'password', 'vacation', 'contextmenu');
 | |
| ## -
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/config.inc.php
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| ## ---------------------------------- #
 | |
| ## --- Install plugin markasjunk2 --- #
 | |
| ## ---------------------------------- #
 | |
| 
 | |
| cd $WEBMAIL_BASEDIR
 | |
| rm Roundcube-Plugin-Mark-as-Junk-2-master.zip
 | |
| wget -O Roundcube-Plugin-Mark-as-Junk-2-master.zip https://github.com/JohnDoh/Roundcube-Plugin-Mark-as-Junk-2/archive/master.zip
 | |
| 
 | |
| cd $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins
 | |
| unzip $WEBMAIL_BASEDIR/Roundcube-Plugin-Mark-as-Junk-2-master.zip
 | |
| ln -s Roundcube-Plugin-Mark-as-Junk-2-master $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/markasjunk2
 | |
| 
 | |
| cp $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/markasjunk2/config.inc.php.dist \
 | |
|    $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/plugins/markasjunk2/config.inc.php
 | |
| 
 | |
| 
 | |
| ## - register markasjunk2 plugin with roundcube
 | |
| ## -
 | |
| ## - edit  $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/config.inc.php
 | |
| ## -
 | |
| ## - add "login_lang" to array plugins
 | |
| ## -    $config['plugins'] = array('login_lang', 'jqueryui', 'password', 'vacation', 'contextmenu','markasjunk2');
 | |
| ## -
 | |
| vim $WEBMAIL_BASEDIR/roundcubemail-${ROUNDCUBE_VERSION}/config/config.inc.php
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 |