Release Support > Release Discussion

Global Addressbook with hosted webspace....how?

(1/2) > >>

WeVo:
Hello,

we use with our club roundcube. I have installed it on a normal hosted webspace. Now we want to have a global addressbook. How is it possible to use that, because i have no Ldap server.

Is there any way to have an addressbook without a ldapserver where the admin or user can create new contacts and every user can see this contacts.
Thanks a lot for your help!

greetings to the world

Markus

owenhau:
May be...correct me if wrong...XD
Do a small hack in the file list.inc in program/steps/addressbook/

I've not did this test so...on your own risk...backup anything before your work

modify your rc db table:
ALTER TABLE `roundcubemail`.`contacts` ADD COLUMN `shared` TINYINT(1) SIGNED NOT NULL DEFAULT 0;

Modify list.inc
1 ;D

--- Quote ---// count contacts for this user
$sql_result = $DB->query("SELECT COUNT(contact_id) AS rows
             FROM ".get_table_name('contacts')."
             WHERE del1
             AND  user_id=?",
             $_SESSION['user_id']);

--- End quote ---
to

--- Quote ---// count contacts for this user
$sql_result = $DB->query("SELECT COUNT(contact_id) AS rows
             FROM ".get_table_name('contacts')."
             WHERE del1
             AND  user_id=?
             OR shared = 1",
             $_SESSION['user_id']);

--- End quote ---
2 :D

--- Quote ---// get contacts from DB
$sql_result = $DB->limitquery("SELECT * FROM ".get_table_name('contacts')."
                WHERE del1
                AND  user_id=?
                ORDER BY name",
                $start_row,
                $CONFIG['pagesize'],
                $_SESSION['user_id']);

--- End quote ---
to

--- Quote ---// get contacts from DB
$sql_result = $DB->limitquery("SELECT * FROM ".get_table_name('contacts')."
                WHERE del1
                AND  user_id=?
                OR shared = 1
                ORDER BY name",
                $start_row,
                $CONFIG['pagesize'],
                $_SESSION['user_id']);

--- End quote ---

This will show the contact which marked shared=1 in the table.
If you trust your user, this may allow all the user to modify/delete the shared contact.

The step you need to do sharing of contacts is a little bit...um....um.....
directly edit the table and change the column "shared" of that row to "1"

Remember, I don't know it works or not...XD

WeVo:
OK thanks.
Have i any possibility that only i as admin can create, delete and edit the global contacts?

owenhau:
I'm not sure the list.inc is for addressbook page or the dynamic menu of receiptxxx....(Oh...my poor english...) in the composer.

If you tried that script can show the shared contact at the composer but not in the addressbook page, then for your administration:

Create a new user, add/manage the share contact...
Run a sql script every time you updated the contact
UPDATE `contacts` set shared = 1 where user_id =

if you can't show the shared contact at the composer then....(Turn my head around and shout: Any one know the dynamic menu's function was load from which files ?)

but if you can see the shared contact in addressbook and not in the composer, may be i've got something wrong in above code. try to replace the original list.inc file and change the show.inc file


--- Quote --- $DB->query("SELECT * FROM ".get_table_name('contacts')."
       WHERE contact_id=?
       AND  user_id=?
       AND  del1",
       $cid,
       $_SESSION['user_id']);

--- End quote ---
to

--- Quote --- $DB->query("SELECT * FROM ".get_table_name('contacts')."
       WHERE (contact_id=?
       AND  user_id=?
       AND  del1")
       OR shared=1,
       $cid,
       $_SESSION['user_id']);

--- End quote ---

right, it seem i've missing the () in the above post...XD

seansan:

The direction looks good.... I was just thinking that maybe you can also create a linked table and update the get_table_name to UNION (or MySQL equivalent) with the shared table. I dont know how one would then disable the editing.

Navigation

[0] Message Index

[#] Next page

Go to full version