Elftown Files

This is a list of the files used to build Elftown.

heddate.pike

This is where most of the program code is located. It contains these important parts (in order as they appear):

Some useful functions and Roxen-demanded functions: This things are demanded by Roxen and there are also some #defines and small functions that is used everywhere in Heddate. Some useful functions are also added to the end of the file.

The Attribute class: This is a class that is used to handle the different attributes (like name, images and interests of members). It's pretty complicated to make changes here, but it's mostly not needed as new attributes (but not new kinds of attributes) can be added in the elftown/attributes.data file.

The Finder class: This is a class that is used to create the finder object. Methods in the finder object is called whenever someone requestes a file. Example: If someone goes to http://elftown.lysator.liu.se/help the method help() in the finder object is called.

If no finder-method can be found, the file elftown/foo.html is used to create the response.

The Tagfunctions class: This is a class that is used to create the tagfunction object. Methods in the finder object (Like banipform()) is called whenever <.METHODNAME> (For example <.BANIPFORM>) is found in a elftown/file_name.html file.

The fine_file function: This function is called by Roxen for every request and this function handels everything about it. Mostly it creates the answer by using the classes above, but it also sends some diagrams, files, images and other stuff. If needed for the file, that is requested, this function will do checks for banning and passwords.

Some more useful functions: Some of them are similar, but always try to use these functions instead of redo the code again.

db.pike

This is where the connection-to-the-MySQL-engine is located.

This is where most of the program code is located. It contains these important parts (in order as they appear):

Some important defines: It is important to use the right define when you put data into the database:

E(x): This is used when you put any normal data like a filename into the database. It turns "foo'bar.html" into "'foo\'bar.html'" so that you can write

db->query("update mytable set file_name="+E(file_name_variable)+
          " where nr="+nr_variable);

F(x): Same as E(x) but without the ''. Useful for LIKE-expressions:

db->query("update mytable set wrong_name='yes' "
          " where name LIKE '"+E(file_name_variable)+"%'");

EH(x): Same as E(x) but this should be used for all insertions of text like messages, wiki-pages, news and so on. It replaces [username] with [@usernumber] so that the link will work when the username is changed too.

The connect function: This function just connect Elftown to the MySQL engine.

The lock and unlock functions: These function are a try to make Elftown threaded, but that didn't work, so they aren't used.

The initdb function: This function creates new tables and adds new columns to the existing tables. Note: It do have some bugs. It always adds new colomns at the end, so SQL-questions with "insert into table_name values(0, 'foo', 'bar')" will be fucked up if you don't add the new names in the end. (You have to change all these functions anyway, but the columns will have the same order in future installations of Heddate.)

The mapping tables is where you add new tables and column-definitions.

The create index comments: This a comment that explains what indexes that is put on the tables on the Elftown server. The indexes are not needed on test-servers.

The Elftown directory

In the elftown/ directory all the data-files, layout-files, images and Elftown specific files are stored. Many of these files aren't reloaded until the Heddate Roxen modules is reloaded. (Like all data-files and almost all html-files)

text.data

This is where almost all the texts are stored. They are stored as one raw that starts with number:. Some texts have some html in them too. This is the place to change things like the Mainstreet links. Note: Some big texts are stored in files like help.h and some text are found in heddate.pike as they are considered as programming error messages.

start.html

This is an example of a html-file. It descibes how a page look like.

head.h and foot.h

The text from these files are included on almost all other pages. The login-page doesn't and the help-index-pages don't include the foot.h-file though.

attributes.data

This file describes the attributes used in Elftown.

Some other directories

elftown/i: Here a lot of images, that are used in Elftown, are stored.

elftown/img: Here a lot of images, that are uploaded to Elftown, are stored.


Back to index