You plan to make a lot of changes to the content and/or features of the site, to make it fit your purposes. Unfortunately, the way the PHP code is structured, the content changes and functional changes will be mixed. The choice of PHP as a language doesnot help a lot, since it is a embedded script language, that main advantages is it can be mixed with content. This is not to say you should always do it. From the current code, everything is so tightly wound together that it takes weeks of studying the code to figure out all the loops. I will try to separate as much as possible these aspects and provides files or chunks of code where relevant.


I have found some description of sf adaptation by sswenson DATE: 2000-09-24


Here is a check list, that I ordered from the easiest to longer and more difficult, so that you progress smoothly. The goal is to follow from the out of the nox source Forge to your own collaborative service.

1) substitution of names

2) database adaptations : categories and default values in tables

3) chunk of static text Obviously, if you don't run a strict mirror or, you want to change the presentation of the site, then all company information and legal text: the staff, terms of service, license, trademarks, privacy policy

4) general layout : ad banner and top links, bottom disclaimer and links, logo

5) localization of text strings: this allow to change some strings used frequently in dynamic content (as navigation).

6) Themes, images, layout:

7) modularity of services versus your needs disconnect some services, add others ...

8) changes in dynamic content: schema adaptation, code evolution

9) your creativity in services, web design, database, behaviour, coding...

10) Private Projects and Security see post


-- to be written --
A major problem is that Source Forge design and specification are not public, only the code. The knowledge and expertise around it are the core of the paying service from VA Linux. You understand then that it is difficult to get information and help on this task.
There are major evolution planned by VA Linux that goes in the right direction: Content Manager, use of XML...


The goal are to separate the static content from the programming, to allow for localization of all the static content. To have features integrated via clean interface to allow deconstruction/reconstruction from perpendicular blocks. The display properties are located all over the place. We want to remove them from any script and put them in templates files organized in a theme. Using CSS, there should be only one .css per theme and no other use of color, font and decoration anywhere else.


0) configuration to the host/domain name, ports, and paths

As described in SF2.5install.html

1) substitution of names:

For adaptation to your domaine name, the easy way is to put your name directly in the source everywhere. I used rpl following an advise on sourceforge project. substitute the domain name using rpl, a global replacement tool download from Otherwise:
perl -pi -e "s/sourceforge/yourname/g" *.php
in all directories should work too.

 The downside, is that it replace also in the file header, which it should not. So I used it after to replace the pattern on these header that were changed.

Warning: there are some mispelled name as "sorceforge" in sendmessage.php

I introduced the variable $sys_name in php file. This is not so easy to do it automatically. There are two context:

In php code (inside <?php ... ?> )
In HTML code
s/sourceforge/ <?php echo $sys_name; ?>/

Next time, I shall do it cleanly with a perl script. I advise you to do so.

Of course using a variable is not possible in pure html code, althought there is a possibility with SSI, but I was surprised to see there is not a single html page in SF.

2) database adaptations

categories and default values in tables For the following tables :
Table content comment
frs_filetype  type of file for release define the list of file type for your site
frs_processor  : architecture for binary files 
forum_group_list  defaut forums
forum  default messages
bug_resolution  defaults 
bug_status  defaults 
themes  the themes available on the site based on your design

Project Defaults

These are the defaults values for table groups. These are modified for a standalone system as in the following example:
 psql $db_name 
 \d groups
# to see all attributes
alter table groups alter  use_patch set default '0';
alter table groups alter  use_cvs  set default '0';  
# modify the defaut for a projects NOT to have CVS and PATCH        

(you may modify as well the host names defined there, and a lot of other default).
Take care that some values are forced in the INSERT and UPDATE SQL commands from register/projectname.php and register/confirmation.php. I would recommand to suppress any hardcoded values in the php file, to allow to use the database defaults.

3) design of content adaptation

  1. run a script for some automatic substitutions
  2. review all files being modified.
  3. search for more suspect terminology than those that have equivalent, and review manually those. need to keep a table of all files edited (script/manu) and update header as well
  4. look for content pages that describe some specifics not valid for your site.
List of all files with some HTML: these are all *.php. Normally, not the *.class, except the languages/* (and BaseLanguage.php).

 An example: If the site is an on site intranet for a company, the reference to open source and licence type have to be suppressed. Also for a internal site, all the legal stuff is not needed (privacy, terms of service ...). If you run a service on the public internet, you will need this legal stuff, but you need to review and rewrite it carefully. References to valinux :

x ./contact.php:  one name  for press, sales 
x ./contest/index.php   ./contest/rules.php : (rmdir) 
x ./staff.php: wipe it ->  me or you/your staff 
x register/index.html
x  ./include/osdn.php -> ./tp/include/navbar.php
Open Source check for open source, all case
 grep -rHi "open source" www | grep -v Breaking
static content -------------- TASK: adapt static content, separate from dynamic e.g.: examples for software ... review all project/ page as well as file, patches ... do a table of all pages to check which are validated. review of site text content : (a selection)
./www/themes/classic/Theme.class theme.php

./www/include/Layout.class:>Show Source<
./www/my/index.php: developer survey

Important features:

requirements.php    step 1 Services & Requirements
tos.php:     step 2  Terms of Service Agreement
basicinfo.php     step 3  Registration (Description)
projectname.php     step 4  Project Name
license.php:     step 5  License
category.php     step 6  Category

Other Content :

The Foundry are listed, from static page. This list should be configurable, and need to be be maintained in DB.

4) general layout :

ad banner and top links, bottom disclaimer and links, logo redefining the upper banner osdn.php -> banner.php to remove the add on the top, it is enough to cut the section of code for it there.

 Substitute all the calls to

    osdn_print_navbar() in $SF/www/themes/*/Theme.class on line 152
by you own function, possibly enpty, if you don't want neither navigation inter sites or ad banner.

images in SF

used in Layout.class and Theme.class (include and themes/classic ) (moved under deprecated )
# these for reference in ./mirrors/index.php  or ./partners.php
others/         cosource142x31.gif  dmoz-cool1.gif  gnome1.png  kde-logotp3.png  suse_g_sm.png

ic/anvil24.png  --> ic/cp-te24.png
other references ./include/ldap.php: $entry['objectClass'][4]='x-sourceforgeAccount'; ./register/why.php:
  • Subdomain hosting -- i.e., ./sourceforge.css:/* This file, sourceforge.css, is deprecated. It is here because many ./stats/i18n.php: "their sourceforge user preferences; it \n".

    create images for the site
    (under images)
    check for the use of logo from sf and valinux (as from images)
    egrep -rH "sflogo|vat.*png|OSDN-lc|logo2border.png|osdn_logo_grey|sourceforge|anvil|forge9.png|others/" .
    ./include/Layout.class:  '/images/ic/anvil24.png',
    ./include/osdn.php:  images/osdn_logo_grey.png","135","33",    images/steel3.jpg  images/OSDN-lc.gif","100","40"
    ./include/Theme.class:        sflogo2-steel.png','143','70'
    ./project/admin/index.php:   sflogo.php  width="88" height="31"
    ./project/admin/index.php:  images/sflogo-88-1.png','88','31',
    ./themes/classic/theme.php: 'ic/anvil24.png';
    ./themes/classic/theme.php:      sflogo2-steel.png','143','70'
    ./themes/forged/theme.php:    'ic/anvil24.png';
    ./themes/forged/theme.php:   sflogo-hammer1.jpg","136","79"
    ./logo.php:  images/sflogo-88-1.png   x2

    5) localization of text strings

    this allow to change some strings used frequently in dynamic content (as navigation).

    6) Themes, images, layout:

    Here you can use your favorite web design contractor, inhouse guru, or web design tool, and try to merge this design with the PHP code to get the generation of the fancy code for design. At a minimum, you can adapt all images, the fonts and decoration...

    7) modularity of services versus your needs

    This section describe how to disconnect some services, add others ... This is a check list for such change: This Modularity is enough to add/remove some services, Changing the different areas availables in the site.
    List of services My choice Action
    LDAP no $sys_use_ldap=0
    SSL no edit login.php, register.php
    (see below)
    User Ranking no edit my/index.html
    Mirrors no rm from menu; rm -r mirrors
    Map yes trove.sql adapted
    Snippet yes text in snippet/*.php
    site doc yes select the docs from sfdocs.sql
    project help ?
    top projects ?
    compile farm no rm -r compile
    SSH ? install,firewall
    CVS ? install,firewall
    FTP no install,firewall,project_home.php
    New Release 

    file uploda

    See the thread started on this question An explanation on the file upload use by Bret (mogul) on 2001-01-24 The default SourceForge setup is pretty restrictive... Users are expected to ftp (or hopefully sftp) their files to a specific "incoming" directory on the server, then pick them from a web admin interface, whereupon a setuid-root executable moves the file to a download directory per project. While this is quite secure, it's also pretty intimidating for people who don't know their way around ftp. The main reason to avoid allowing people to upload in a form is that the size of the file could be large enough to make your server run out of swap space; someone could easily bring down the server if they wanted to.

     However, if you trust your project admins, you can allow it through a form. You can also limit uploaded files to a particular size in the interest of security as long as you don't expect people to exceed it often (see upload_max_filesize in php.ini). This is what I've done for our internal installation of SourceForge. Check for this as a patch in SF ?

    login and register without SSL

    3 modifications in login.php
    if (!$sys_use_ssl) {
    $urlbase_='http://' . $sys_default_domain;
    } else {
    $urlbase_='https://' . $sys_secure_domain;
    <form action="<?php echo $urlbase; ?>/account/login.php" method="post">
    <?php if ($sys_use_ssl) { ?>
    <INPUT TYPE="CHECKBOX" NAME="stay_in_ssl" ...  known problem.
    <?php } ?>
    3 modifications in register.php
    The same def for urlbase and
    <form action="<?php echo $urlbase.$PHP_SELF; ?>" method="post">

    Adding some search capability by an external site

    This is an example of adding external search capability already coded, while keeping the sourceforge themes and navigation. The idea is to include the result of other scripts that generate a HTML page inside the php script.

    in include/menu.php

            print "\t\n";
    in search/index.php
    if ($type_of_search == "link") {
    // The Resource Search  is implemented on another site
    // This will include the result as part of the page generated by this service
      if ($fp) {
      } else {
        echo "cannot access the service for now: the server $site doesnot answer";
    } else {
      if (!$words) {

    Adding a features in Projects

    For this example, we wish a new feature named 'IM' (for Instant Messaging) to be added as an optionnal feature for each project. In the database
     alter table groups add column use_im integer not null default '1'  ;
            function usesIM() {
                    return $this->project_data_array['use_im'];
            if (!$use_IM) {
            $result=db_query('UPDATE groups SET '
            Use IM: 
            function usesIM() {
                    return $this->project_data_array['use_im'];
    <Files im> 
    ForceType application/x-httpd-php 
                    // Instant Messaging
                    if ($project->usesIM()) {
                            $this->tab_entry('/tp/im/?group_id='.$group, $this->icons['IM'],
                                    $Language->GROUP_SHORT_IM, $toptab == 'IM');
    if ($project->usesIM()) {
            print '
    ';         print html_image("images/ic/notes16.png",'20','20',array('alt'=>$Language->GROUP_SHORT_IM));          print ' '.$Language->GROUP_LONG_IM.''; //      print " ( ". project_get_public_im_count($group_id) ." messages in "; //      print "". project_get_public_im_message_count($group_id) ." ims )\n"; }
            // ################## Instant Messages
            if ($project->usesIM()) {
                    $return .= '
    ';                 $return .= '';                 $return .= html_image("images/ic/notes16.png","20","20",array("BORDER"=>"0","ALT"=>"IM"));                 $return .= ' Ims';                 if ($mode != 'compact') { //                      $return .= " ( ". project_get_public_im_count($group_id) ." messages in "; //                      $return .= "". project_get_public_im_message_count($group_id) ." im )\n";                 }         }
            var $GROUP_SHORT_IM='IM';
            var $GROUP_LONG_IM='Instant Messaging';
    And of course in each language/<language>.class.

    Adding external features

    -- to be documented -- Say you have a database of resources that you can search according to the project categorization. The first step is to add the feature named 'resource' in the project as above.

    8) changes in dynamic content:

    schema adaptation, code evolution
    Separation of code :

    9) your creativity in services, web design, database, behaviour, coding...

    10) Private Projects and Security