Author Topic: How to add a "spam-setting level" to the "Personal setting" Roundcube page  (Read 5820 times)

Offline voltron81

  • Jr. Member
  • **
  • Posts: 42
Hello to everybody.
I'm realizing a mail server based on ISPConfig 3 and Roundcube as webmail.

I would like to add a service to the customer roundcube webpage, so that a customer can set-up the level of spam filtering for his email(basically I want to add a slider with 10 spam levels on the "personal setting" roundcube page).

I've checked that, on ISPConfig 3, I can create "Policy record" that are stored on mysql database, exatly in "spamfilter_user" table, in the field names "policy_id", where the value of "policy_id" is the order of "Policy record" in ISPConfig page.

So, how can add on Roundcube this slider?
I don't think it's really difficult...but I'm not an expert of PHP at all!!! :)

Thanks
Michele

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
How to add a "spam-setting level" to the "Personal setting" Roundcube page
« Reply #1 on: September 09, 2009, 01:04:54 AM »
You really need PHP/HTML/CSS/Javascript skills for that as you will have to code a plugin.
Regards,
Rosali
__________________
MyRoundcube Project (commercial)

Offline voltron81

  • Jr. Member
  • **
  • Posts: 42
How to add a "spam-setting level" to the "Personal setting" Roundcube page
« Reply #2 on: September 09, 2009, 04:39:15 AM »
Ok, I'll try to do it with PHP, even if I'm not an expert...
If somebody can give me some suggestions... I'll really appreciate it :D

Offline voltron81

  • Jr. Member
  • **
  • Posts: 42
How to add a "spam-setting level" to the "Personal setting" Roundcube page
« Reply #3 on: September 09, 2009, 05:38:02 AM »
I've found a plugin for Roundcube named "SpamAssassin User Prefs" that:
Adds a 'Spam' tab to the 'Personal Settings' to allow the user to change their SpamAssassin preferences. Preferences must be stored in a SQL database. Default preferences are used when no user preference is found.

It's working with Spamassassin database.

Do you think is simple to modify it, so that it can work with ISPConfig database?

Thanks
Michele

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,855
How to add a "spam-setting level" to the "Personal setting" Roundcube page
« Reply #4 on: September 09, 2009, 06:00:09 AM »
you can set the database and tables the spamassassin user prefs plugin uses in the config but it only works with the spamassassin names for preferences, you will need to mod all the code to use different ones (find and replace should do it)
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and moreā€¦

Offline voltron81

  • Jr. Member
  • **
  • Posts: 42
How to add a "spam-setting level" to the "Personal setting" Roundcube page
« Reply #5 on: September 09, 2009, 06:28:48 AM »
ok so for now I'll try to use this plugin with Spamassassin...
Do you know if there is an "How-to" that explain me the steps?

I have read this: UsingSQL - Spamassassin Wiki but I think I'm still miss something...

Thanks
Michele

Offline voltron81

  • Jr. Member
  • **
  • Posts: 42
How to add a "spam-setting level" to the "Personal setting" Roundcube page
« Reply #6 on: September 09, 2009, 07:19:07 AM »
Change of programs... I can't do it using the pure Spamassassin without ISPConfig... so I need to modify that script or create a new one... :eek:

If somebody want to help me... 0:)

Offline voltron81

  • Jr. Member
  • **
  • Posts: 42
How to add a "spam-setting level" to the "Personal setting" Roundcube page
« Reply #7 on: September 15, 2009, 11:41:17 AM »
Hi.
Somebody can show me the right way please?

I've found in which part of the database ISPConfig write the spam policy.
I've integrated Roundcube with a slider that have 11 steps.

The only think that I've to do, and I've no idea of how to do it, is connect roundcube with dbispconfig, make a "SELECT * FROM spamfilter_users WHERE EMAIL = mail@mail.com" and then write the value of the policy in the column "policy_id".
I've already created 11 spam policy with ISPConfig and I know the policy_id of all of them.

Suggestions?
Thanks
Michele

Offline voltron81

  • Jr. Member
  • **
  • Posts: 42
How to add a "spam-setting level" to the "Personal setting" Roundcube page
« Reply #8 on: September 16, 2009, 07:26:14 AM »
Ok I'm integrating this modification of the MySQL in roundcube.
I've create the  mysql_query($query) and 11 queries, releated with the slider.

Now what I need is create a SELECT before that basically is doig:
Code: [Select]
SELECT policy_id FROM spamfilter_users WHERE email = $roundcube_username

Somebody know where I can find the variable $roundcube_username?

Thanks
Michele

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
How to add a "spam-setting level" to the "Personal setting" Roundcube page
« Reply #9 on: September 17, 2009, 07:14:47 AM »
$_SESSION['username'] or from the user object $rcmail->user->data('username') [italic part depends on how the rcmail object was referenced].
Regards,
Rosali
__________________
MyRoundcube Project (commercial)

Offline voltron81

  • Jr. Member
  • **
  • Posts: 42
How to add a "spam-setting level" to the "Personal setting" Roundcube page
« Reply #10 on: September 17, 2009, 08:45:01 AM »
Thanks a lot,
Just this morning I found it in one of my test :)