This file is indexed.

/usr/share/GNUstep/SOGo/WebServerResources/UIxContactsUserFolders.js is in sogo-common 2.1.1b-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
var d;

function onSearchFormSubmit(filterPanel) {
    var searchValue = filterPanel.down('[name="search"]');
    var encodedValue = encodeURI(searchValue.value);

    if (encodedValue.blank()) {
        checkAjaxRequestsState();
    }
    else {
        var url = (UserFolderURL
                   + "usersSearch?search=" + encodedValue);
        if (document.userFoldersRequest) {
            document.userFoldersRequest.aborted = true;
            document.userFoldersRequest.abort();
        }
        if (encodedValue.trim().length > minimumSearchLength) {
            startAnimation($("pageContent"), filterPanel);
            document.userFoldersRequest
                = triggerAjaxRequest(url, usersSearchCallback);
        }
    }

    return false;
}

function usersSearchCallback(http) {
    document.userFoldersRequest = null;
    var div = $("folders");
    if (http.status == 200) {
        var response = http.responseText.evalJSON();
        buildUsersTree(div, response);
    }
    else if (http.status == 404)
        div.update();
}

function addUserLineToTree(tree, parent, line) {
    // line[0] = uid
    // line[1] = cn
    // line[2] = email
    // line[3] = 1 if it's a group
    // line[4] = contact info
    var icon = ResourcesURL + '/busy.gif';

    var email = line[1] + " <" + line[2] + ">";
    if (line[4] && !line[4].empty())
        email += ", " + line[4].split("\n").join("; "); // extra contact info
    var icon_card = 'abcard.png';
    var datatype = 'user';
    if (line[3]) {
        icon_card = 'ablist.png';
        datatype = 'group';
    }
    tree.add(parent, 0, email, 0, '#', line[0], datatype,
             '', '',
             ResourcesURL + '/' + icon_card,
             ResourcesURL + '/' + icon_card);
    if (window.opener.userFolderType != "user") {
        tree.add(parent + 1, parent, _("Please wait..."), 0, '#', null,
                 null, '', '', icon, icon);
    }
}

function buildUsersTree(treeDiv, response) {
    if (!treeDiv.clean) {
        var oldD = $("d"); // the folders tree
        if (oldD) {
            oldD.remove();
            delete d;
        }
        treeDiv.clean = true;
        $("addButton").addClassName("disabled");
    }

    d = new dTree("d");
    d.config.hideRoot = true;
    d.icon.root = ResourcesURL + '/tbtv_account_17x17.gif';
    d.icon.folder = ResourcesURL + '/tbtv_leaf_corner_17x17.png';
    d.icon.folderOpen = ResourcesURL + '/tbtv_leaf_corner_17x17.png';
    d.icon.node = ResourcesURL + '/tbtv_leaf_corner_17x17.png';
    d.icon.line = ResourcesURL + '/tbtv_line_17x22.png';
    d.icon.join = ResourcesURL + '/tbtv_junction_17x22.png';
    d.icon.joinBottom = ResourcesURL + '/tbtv_corner_17x22.png';
    d.icon.plus = ResourcesURL + '/tbtv_plus_17x22.png';
    d.icon.plusBottom = ResourcesURL + '/tbtv_corner_plus_17x22.png';
    d.icon.minus = ResourcesURL + '/tbtv_minus_17x22.png';
    d.icon.minusBottom = ResourcesURL + '/tbtv_corner_minus_17x22.png';
    d.icon.nlPlus = ResourcesURL + '/tbtv_corner_plus_17x22.png';
    d.icon.nlMinus = ResourcesURL + '/tbtv_corner_minus_17x22.png';
    d.icon.empty = ResourcesURL + '/empty.gif';
    d.preload();
    d.add(0, -1, '');

    var isUserDialog = (window.opener.userFolderType == "user");
    var multiplier = ((isUserDialog) ? 1 : 2);

    if (response.length > 0) {
        for (var i = 0; i < response.length; i++)
            addUserLineToTree(d, 1 + i * multiplier, response[i]);
        treeDiv.appendChild(d.domObject ());
        treeDiv.clean = false;
        for (var i = 0; i < response.length; i++) {
            if (!isUserDialog) {
                var toggle = $("tgd" + (1 + i * 2));
                toggle.on("click", onUserNodeToggle);
            }
            var sd = $("sd" + (1 + i * multiplier));
            sd.on("click", onTreeItemClick);
        }
    }
    else {
        $$('[name="search"]').first().addClassName("notfound");
    }
}

function onUserNodeToggle(event) {
    this.stopObserving("click", onUserNodeToggle);

    var person = this.parentNode.getAttribute("dataname").unescapeHTML();

    var url = (UserFolderURLForUser(person) + "foldersSearch"
               + "?type=" + window.opener.userFolderType);
    var nodeId = this.getAttribute("id").substr(3);
    triggerAjaxRequest(url, foldersSearchCallback,
                       { nodeId: nodeId, user: person });
}

function onTreeItemClick(event) {
    preventDefault(event);

    var topNode = $("d");
    if (topNode.selectedEntry)
        topNode.selectedEntry.deselect();
    this.selectElement();
    topNode.selectedEntry = this;

    if (window.opener.userFolderType == "user")
        $("addButton").removeClassName("disabled");
    else {
        var dataname = this.parentNode.getAttribute("dataname");
        if (!dataname)
            dataname = "";
        if (dataname.indexOf(":") == -1)
            $("addButton").addClassName("disabled");
        else
            $("addButton").removeClassName("disabled");
    };
}

function foldersSearchCallback(http) {
    if (http.status == 200) {
        var response = http.responseText;
        var nodeId = parseInt(http.callbackData["nodeId"]);

        var dd = $("dd" + (nodeId + 2));
        var indentValue = (dd ? 1 : 0);
        d.aIndent.push(indentValue);

        var dd = $("dd" + nodeId);
        if (response.length) {
            var folders = response.split(";");
            var user = http.callbackData["user"];

            dd.innerHTML = '';
            for (var i = 1; i < folders.length - 1; i++)
                dd.appendChild (addFolderBranchToTree(d, user, folders[i], nodeId, i, false));
            dd.appendChild (addFolderBranchToTree(d, user, folders[folders.length-1], nodeId,
                                                  (folders.length - 1), true));
            //dd.update(str);
            for (var i = 1; i < folders.length; i++) {
                var sd = $("sd" + (nodeId + i));
                sd.on("click", onTreeItemClick);
            }
        }
        else {
            dd.innerHTML = '';
            dd.appendChild(addFolderNotFoundNode(d, nodeId, null));
            var sd = $("sd" + (nodeId + 1));
            sd.on("click", onTreeItemClick);
        }

        d.aIndent.pop();
    }
}

function addFolderBranchToTree(tree, user, folder, nodeId, subId, isLast) {
    var folderInfos = folder.split(":");
    var icon = ResourcesURL + '/';
    if (folderInfos[2] == 'Contact')
        icon += 'tb-mail-addressbook-flat-16x16.png';
    else
        icon += 'calendar-folder-16x16.png';
    var folderId = user + ":" + folderInfos[1].substr(1);

    // name has the format "Foldername (Firstname Lastname <email>)"
    // We sanitize the value to avoid XSS issues
    var name = folderInfos[0].escapeHTML(); 

    var pos = name.lastIndexOf(' (');
    if (pos > -1)
        name = name.substring(0, pos); // strip the part with fullname and email
    var node = new dTreeNode(subId, nodeId, name, 0, '#', folderId,
                             folderInfos[2] + '-folder', '', '', icon, icon);
    node._ls = isLast;
    var content = tree.node(node, (nodeId + subId), null);

    return content;
}

function addFolderNotFoundNode(tree, nodeId) {
    var icon = ResourcesURL + '/dot.png';
    var node = new dTreeNode(1, nodeId, _("No possible subscription"), 0, '#',
                             null, null, '', '', icon, icon);
    node._ls = true;
    return tree.node(node, (nodeId + 1));
}

function onConfirmFolderSelection(event) {
    if (!this.hasClassName("disabled")) {
        var topNode = $("d");
        if (topNode && topNode.selectedEntry) {
            var node = topNode.selectedEntry.parentNode;
            var folder = node.getAttribute("dataname");
            var type = node.getAttribute("datatype");

            var folderName;
            if (window.opener.userFolderType == "user") {
                var span = $(topNode.selectedEntry).down("SPAN.nodeName");
                var email = (span.innerHTML
                             .replace("&lt;", "<", "g")
                             .replace("&gt;", ">", "g"));
                folderName = email.replace(/>,.*$/, ">", "g");
            }
            else {
                var resource = $(topNode.selectedEntry).down("SPAN.nodeName");
                var user = $(node.parentNode.previousSibling).down("SPAN.nodeName");
                var email = (user.innerHTML
                             .replace("&lt;", "<", "g")
                             .replace("&gt;", ">", "g"));
                folderName = resource.innerHTML + ' (' + email + ')';
                folderName = folderName.replace(/>,.*(\))?$/, ">)$1", "g");
            }

            var data = { folderName: folderName, folder: folder, type: type, window: window };
            if (parent$(accessToSubscribedFolder(folder)))
                window.alert(_("You have already subscribed to that folder!"));
            else
                window.opener.subscribeToFolder(window.opener.userFolderCallback, data);
            this.blur(); // required by IE
        }
    }
}

function onFolderSearchKeyDown(event) {
    if (event.keyCode == Event.KEY_BACKSPACE
        || IsCharacterKey(event.keyCode)) {
        $(this).removeClassName("notfound");
        var div = $("folders");
        if (!div.clean) {
            var oldD = $("d"); // the folders tree
            if (oldD) {
                oldD.remove();
                delete d;
            }
            div.clean = true;
            $("addButton").addClassName("disabled");
        }
    }
}

function initUserFoldersWindow() {
    var searchValue = $$('[name="search"]').first();
    searchValue.on("keydown", onFolderSearchKeyDown);

    $("addButton").on("click", onConfirmFolderSelection);
    $("doneButton").on("click", onCloseButtonClick);

    searchValue.focus();
}

document.observe("dom:loaded", initUserFoldersWindow);