alecpl
2011-06-29 c3dabfad7ac668cb9bdcbf8ccf221d82fadd9c9c
program/steps/addressbook/func.inc
@@ -161,7 +161,7 @@
    $jsdata = array();
    $line_templ = html::tag('li', array(
        'id' => 'rcmli%s', 'class' => 'addressbook %s'),
        'id' => 'rcmli%s', 'class' => '%s'),
        html::a(array('href' => '%s',
            'rel' => '%s',
            'onclick' => "return ".JS_OBJECT_NAME.".command('list','%s',this)"), '%s'));
@@ -177,9 +177,19 @@
    foreach ($sources as $j => $source) {
        $id = strval($source['id'] ? $source['id'] : $j);
        $js_id = JQ($id);
        // set class name(s)
        $class_name = 'addressbook';
        if ($current === $id)
            $class_name .= ' selected';
        if ($source['readonly'])
            $class_name .= ' readonly';
        if ($source['class_name'])
            $class_name .= ' ' . $source['class_name'];
        $out .= sprintf($line_templ,
            html_identifier($id),
            ($current === $id ? 'selected' : ''),
            $class_name,
            Q(rcmail_url(null, array('_source' => $id))),
            $source['id'],
            $js_id, (!empty($source['name']) ? Q($source['name']) : Q($id)));
@@ -609,7 +619,7 @@
function rcmail_contact_photo($attrib)
{
    global $CONTACTS, $CONTACT_COLTYPES, $RCMAIL, $CONFIG;
    global $SOURCE_ID, $CONTACTS, $CONTACT_COLTYPES, $RCMAIL, $CONFIG;
    if (!$CONTACT_COLTYPES['photo'])
        return '';
@@ -624,7 +634,7 @@
    if (strpos($record['photo'], 'http:') === 0)
        $photo_img = $record['photo'];
    else if ($record['photo'])
        $photo_img = $RCMAIL->url(array('_action' => 'photo', '_cid' => $record['ID'], '_source' => $_REQUEST['_source']));
        $photo_img = $RCMAIL->url(array('_action' => 'photo', '_cid' => $record['ID'], '_source' => $SOURCE_ID));
    else
        $ff_value = '-del-'; // will disable delete-photo action
@@ -660,7 +670,7 @@
    // containing contact ID and source name in form: <ID>-<SOURCE>
    $cid    = get_input_value('_cid', RCUBE_INPUT_GPC);
    $source = get_input_value('_source', RCUBE_INPUT_GPC);
    $source = (string) get_input_value('_source', RCUBE_INPUT_GPC);
    if (!preg_match('/^[a-zA-Z0-9\+\/=_-]+(,[a-zA-Z0-9\+\/=_-]+)*$/', $cid)) {
        return array();
@@ -676,10 +686,7 @@
        if (!$got_source) {
            list ($c, $s) = explode('-', $id, 2);
            if (strlen($s)) {
                $result[$s][] = $c;
            }
            else if (strlen($source)) {
                $result[$source][] = $c;
                $result[(string)$s][] = $c;
            }
        }
        else {