develop i

Javascript must be enabled for this service to work.
Please enable Javascript on your browser.

Develop i

If you would like to help develop i, or host your own i service then this page will show you how!

How to get the code

The code is written in PHP, and it is available on the CERN SVN repositories (link to be added soon!) You can check it out and see the inner workings to better understand how i works. urls are rewritten using web.config on the CERN DFS servers (running Windows), and using .htaccess on apache servers. It has been tested in both these environments.

Files in the package

The package contains a variety of different files. Most of the work is done with PHP scripts. Since PHP has a reputation for security vulnerabilities, i does not use any databases, and it does not write anything to disk. Developers wishing to use databases or write access to disk are strongly recommended to pay special attention to prevent hacking and SQL injection attacks.

When the user types in a long url to be shortened the page sends a request via AJAX. This ensures that the processing the url is the same for all users, so it is performed server side. This also allows to use the service directly, without using the webpage. The package includes a copy of ZeroClipboard to make the copying of the shortened url easier. ZeroClipboard uses a flash object to achieve single click copying, but it is not necessary for the user to enable flash.

The web.config and .htaccess files are included, and they match three different regex strings.

The rest of the files include javascript source files, the CSS style sheet, some small graphics and PHP pages for the frontend.

Parsing short urls

The full regex for matching the short urls (in order of precedence) in web.config or .htaccess are given below:

Type of url regex
Category of meetings web.config: ^[C]([0-9]*)(?:[D]([0-9]*))?$
.htaccess: (^[cC]([0-9]*))
Meeting contribution web.config: ^([0-9]*)(?:[D]([0-9]*))?([CMRS][A-Z0-9]*)([CMRS][A-Z0-9]*)?([CMRS][A-Z0-9]*)?([CMRS][A-Z0-9]*)?$
.htaccess: (^([0-9]+))
Single meeting web.config: ^([0-9]*)(?:[D]([0-9]*))?$
.htaccess: (^([0-9]+))

In web.config the matches are case insensitive.

The short relative url is then passed as a string to process.php (via the $_GET variable) where it gets parsed. The first step is to convert the string to upper case to make matching simpler. The string is first matched against the regular expressions /^[C]([0-9]+)(?:[D]([0-9]*))?$/ (category page), '/^([0-9]*)(?:[D]([0-9]*))?$/' (meeting page), and /^([0-9]*)(?:[D]([0-9]*))?([CMRS])/ (meeting contribution), in order of precedence. If the string is successfully parsed the client gets redirected to the relevant indico page. If the string is not successfully parsed the client receives an error message, and then the scripts calls exit().

Domain argument

i supports multiple domains, and the domain is specified using the domain argument, ([dD][0-9]*)?. If no domain is specified then i chooses the first domain, https://indico.cern.ch. The domain argument is an optional argument that can specified in any of the short url forms.

Short category urls

The short url for a meeting category starts with the letter "c", followed by the category number. This is an unfortunate choice of letter, but it is one which is easier for users to remember. The domain argument may be added to the end of the short url.

Short meeting urls

The short url for a meeting is simply the meeting id. It is expected that this will be the most used part of the service. The domain argument may be added to the end of the short url.

Short meeting contribution urls

The short url for a meeting contribution is the most complex string to match. It consists of the meeting id, followed by arguments specifying the material id, the resource id, the domain id (if needed), and the contribution or session id, as appropriate. With the exception of the material id, each parameter is specified with a number. The domain argument may be added at any point in the short url, as long as it follows the meeting id.

The following regular expressions are used to match the various parameters:

Short url parameter Regular expression
contribId (contribution id) '/[C]([0-9]*)/'
domainId (Not an indico argument) '/[D]([0-9]*)/'
materialId (material id) /[M]([A-Z]|[0-9]*)/
resId (resource id) '/[R]([0-9]*)/'
sessionId (session id) '/[S]([0-9]*)/'

If more than one instance of a parameter is specified (which should not happen!) the first successful match is used. If a parameter is not specified it gets the value -1 and is not used when constructing the indico url.

The material id needs special attention because in an indico meeting page it can be referred to by a string or a number, and in some cases it is impossible to match a number to a string. To overcome this problem each of the strings is matched to a single letter code. The letters C, D, M, R, S are excluded from the list to prevent collisions with parameter names in the short url. This leaves eight spaces for future material ids. If the indico page specifies a numerical material id then this gets specified in the short url.

The material id lookup table is:

Key Material id string
A agenda
B document
E drawings
F list of actions
G live broadcast
H minutes
I more information
J paper
K pictures
L poster
N proceedings
O slides
P text
Q video