/**
     * It display a table with commit related to this tracker or task_extra_detail
     *
     * @param   string   $Query Query to be executed to get the commit entries.
     * @param   integer  $group_id Group_id of the actual Group_id
     *
     */
    function getCommitEntries($Query, $group_id)
    {
        $group =& group_get_object($group_id);
        if (!$group->usesPlugin($this->name)) {
            return;
        }
        $DBResult = db_query($Query);
        $Rows = db_numrows($DBResult);
        if ($Rows > 0) {
            echo '<tr><td colspan="2">';
            echo '<h4>' . _('Links to related CVS commits') . ':</h4>';
            $title_arr = $this->getTitleArr();
            echo $GLOBALS['HTML']->listTableTop($title_arr);
            for ($i = 0; $i < $Rows; $i++) {
                $Row = db_fetch_array($DBResult);
                echo '<tr ' . $GLOBALS['HTML']->boxGetAltRowStyle($i) . '>' . '<td>' . $this->getFileLink($group->getUnixName(), $Row['file'], $Row['actual_version']) . '</td>' . '<td>' . date(_('Y-m-d'), $Row['cvs_date']) . '</td>' . '<td>' . $this->getDiffLink($group->getUnixName(), $Row['file'], $Row['prev_version'], $Row['actual_version']) . '</td>' . '<td>' . $this->getActualVersionLink($group->getUnixName(), $Row['file'], $Row['actual_version']) . '</td>
				<td>' . htmlspecialchars($Row['log_text']) . '</td>
				<td>' . util_make_link_u($Row['author'], user_get_object_by_name($Row['author'])->getId(), $Row['author']) . '</td>
				</tr>';
            }
            echo $GLOBALS['HTML']->listTableBottom();
            echo '</td></tr>';
        } else {
            echo '<h4>' . _('No commits have been made.') . '</h4>';
        }
    }
 function AuthUser($loginname, $passwd)
 {
     global $feedback;
     if (!$loginname) {
         return false;
     }
     $u = user_get_object_by_name($loginname);
     if ($u) {
         // User exists in DB
         if ($u->getStatus() == 'A') {
             //we check if it's active
             $user_id = $u->getID();
             session_set_new($user_id);
             //create session cookie
             $GLOBALS['aselect_auth_failed'] = false;
             return true;
         } else {
             $GLOBALS['aselect_auth_failed'] = true;
             return false;
         }
     } else {
         $GLOBALS['aselect_auth_failed'] = true;
         return false;
     }
 }
Exemple #3
0
 function User_nforge($id = '')
 {
     if ($id) {
         $this->setID($id);
         $u =& user_get_object_by_name($id);
     } else {
         $u =& user_get_object(user_getid());
         if ($u and is_object($u) and !$u->isError()) {
             global $DBInfo;
             $id = $u->getUnixName();
         }
         if (!empty($id)) {
             $this->setID($id);
             $udb = new UserDB($DBInfo);
             $tmp = $udb->getUser($id);
             // get timezone and make timezone offset
             $tz_offset = date('Z');
             $update = 0;
             if ($tz_offset != $tmp->info['tz_offset']) {
                 $update = 1;
             }
             if (!empty($DBInfo->use_homepage_url) and empty($tmp->info['home']) or $update or empty($tmp->info['nick']) or $tmp->info['nick'] != $u->data_array['realname']) {
                 // register user
                 $tmp->info['tz_offset'] = $tz_offset;
                 $tmp->info['nick'] = $u->data_array['realname'];
                 if (!empty($DBInfo->use_homepage_url)) {
                     $tmp->info['home'] = util_make_url_u($u->getID(), true);
                 }
                 $udb->saveUser($tmp);
             }
         } else {
             $id = 'Anonymous';
             $this->setID('Anonymous');
         }
     }
     $this->css = isset($_COOKIE['MONI_CSS']) ? $_COOKIE['MONI_CSS'] : '';
     $this->theme = isset($_COOKIE['MONI_THEME']) ? $_COOKIE['MONI_THEME'] : '';
     $this->bookmark = isset($_COOKIE['MONI_BOOKMARK']) ? $_COOKIE['MONI_BOOKMARK'] : '';
     $this->trail = isset($_COOKIE['MONI_TRAIL']) ? _stripslashes($_COOKIE['MONI_TRAIL']) : '';
     $this->tz_offset = isset($_COOKIE['MONI_TZ']) ? _stripslashes($_COOKIE['MONI_TZ']) : '';
     $this->nick = isset($_COOKIE['MONI_NICK']) ? _stripslashes($_COOKIE['MONI_NICK']) : '';
     if ($this->tz_offset == '') {
         $this->tz_offset = date('Z');
     }
     if (!empty($id) and $id != 'Anonymous') {
         global $DBInfo;
         $udb = new UserDB($DBInfo);
         if (!$udb->_exists($id)) {
             $dummy = $udb->saveUser($this);
         }
     }
 }
Exemple #4
0
/**
 * Checks if the commit it's possible and parse arguments
 * Checks if repository, group and user_name are right.
 *  It extract group from cvsroot, and check if the plugin
 *  is availabe. It checks if the user exists.
 *
 * @param   array    $Config Config
 *
 * @return  array    Returns 'check'=true if check passed, group, group_id
 */
function parseConfig($Config)
{
    global $sys_cvsroot_path, $cvs_tracker_debug;
    $Result = array();
    $Result['check'] = true;
    $Repository = $Config['Repository'];
    $UserName = $Config['UserName'];
    // add a trailing / if needed
    if ($sys_cvsroot_path[strlen($sys_cvsroot_path) - 1] != '/') {
        $sys_cvsroot_path .= '/';
    }
    if (strncmp($Repository, $sys_cvsroot_path, strlen($sys_cvsroot_path)) == 0) {
        $GroupName = substr($Repository, strlen($sys_cvsroot_path));
    } else {
        $GroupName = $Repository;
    }
    if ($cvs_tracker_debug) {
        echo "GroupName = " . $GroupName . "\n";
        echo "CVSRootPath = " . $sys_cvsroot_path . "\n";
    }
    $Result['user'] = user_get_object_by_name($UserName);
    if (!$Result['user'] || !is_object($Result['user']) || $Result['user']->isError() || !$Result['user']->isActive()) {
        $Result['check'] = false;
        $Result['error'] = 'Invalid User';
        return $Result;
    }
    session_set_new($Result['user']->getID());
    $Result['group'] = group_get_object_by_name($GroupName);
    if (!$Result['group'] || !is_object($Result['group']) || $Result['group']->isError() || !$Result['group']->isActive()) {
        $Result['check'] = false;
        $Result['error'] = 'Group Not Found';
    } else {
        $Result['group_id'] = $Result['group']->getID();
        if (!$Result['group']->usesPlugin('cvstracker')) {
            $Result['check'] = false;
            $Result['error'] = 'Plugin not enabled for this Group';
        }
    }
    return $Result;
}
Exemple #5
0
$perm =& $group->getPermission(session_get_user());
if (!$perm || !is_object($perm)) {
    exit_error('Error', 'Could Not Get Permission');
} elseif ($perm->isError()) {
    exit_error('Error', $perm->getErrorMessage());
}
if (!$perm->isAdmin()) {
    exit_permission_denied();
}
if (getStringFromRequest('submit')) {
    if (getStringFromRequest('adduser')) {
        /*
        	add user to this project
        */
        $form_unix_name = getStringFromRequest('form_unix_name');
        $user_object =& user_get_object_by_name($form_unix_name);
        $user_id = $user_object->getID();
        $role_id = getIntFromRequest('role_id');
        if (!$group->addUser($form_unix_name, $role_id)) {
            $feedback .= $group->getErrorMessage();
        } else {
            $feedback = _('User Added Successfully');
            //plugin webcal
            //change assistant for webcal
            $params[0] = getIntFromRequest('user_id');
            $params[1] = getIntFromRequest('group_id');
            plugin_hook('change_cal_permission', $params);
            $group_id = getIntFromRequest('group_id');
            //if the user have requested to join this group
            //we should remove him from the request list
            //since it has already been added
Exemple #6
0
/**
 * Checks if the commit it's possible and parse arguments
 * Checks if repository, group and user_name are right.
 *  It extract group from svnroot, and check if the plugin
 *  is availabe. It checks if the user exists.
 *
 * @param   array    $Config Config
 *
 * @return  array    Returns 'check'=true if check passed, group, group_id
 */
function parseConfig(&$Config)
{
    global $sys_svnroot_path, $svn_tracker_debug, $file;
    $Result = array();
    $Result['check'] = true;
    $Repository = $Config['Repository'];
    $UserName = $Config['UserName'];
    if ($sys_svnroot_path[strlen($sys_svnroot_path) - 1] != '/') {
        $sys_svnroot_path .= '/';
    }
    $repo_root = substr($Repository, 0, strrpos($Repository, "/") + 1);
    //we get the directory of the repository root (with trailing slash)
    if (fileinode($sys_svnroot_path) == fileinode($repo_root)) {
        // since the $sys_svnroot_path is usually $sys_svnroot, and that one is a symlink, we check that the inode is the same for both
        $GroupName = substr($Repository, strrpos($Repository, "/") + 1);
        $Config['FileName'] = substr($Config['FileName'], strlen($Repository));
        //get only the filename relative to the repo
    } else {
        $GroupName = $Repository;
        $Config['FileName'] = $Config['FileName'];
    }
    if ($svn_tracker_debug) {
        echo "GroupName = " . $GroupName . "\n";
        echo "SVNRootPath = " . $sys_svnroot_path . "\n";
    }
    if ($svn_tracker_debug) {
        fwrite($file, $GroupName . "\n");
    }
    $Result['group'] = group_get_object_by_name($GroupName);
    $Result['user'] = user_get_object_by_name($UserName);
    if (!$Result['group'] || !is_object($Result['group']) || $Result['group']->isError() || !$Result['group']->isActive()) {
        $Result['check'] = false;
        $Result['error'] = 'Group Not Found';
    } else {
        $Result['group_id'] = $Result['group']->getID();
        if (!$Result['group']->usesPlugin('svntracker')) {
            $Result['check'] = false;
            $Result['error'] = 'Plugin not enabled for this Group';
        }
    }
    if (!$Result['user'] || !is_object($Result['user']) || $Result['user']->isError() || !$Result['user']->isActive()) {
        $Result['check'] = false;
        $Result['error'] = 'Invalid User';
    }
    return $Result;
}
Exemple #7
0
$env_group = getStringFromPost('group');
$env_user = getStringFromPost('user');
# Group must contain 3 - 15 alphanumeric chars or -
preg_match("/^([[:alnum:]-]{3,15})\$/", $env_group, $matches);
# User rules
# 1. Must only contain alphanumeric chars or _ or -
# 2. Must be 3 - 15 chars
preg_match("/[[:alnum:]_-]{3,15}/", $env_user, $matches2);
if (count($matches) == 0) {
    exit_error('', 'Invalid CVS repository : ' . $env_group);
} else {
    if (count($matches2) == 0) {
        exit_error('', 'Invalid username : '******'', 'User "' . $userName . '"not found');
    }
    session_set_new($User->getID());
    $projectName = $matches[count($matches) - 1];
    $Group =& group_get_object_by_name($projectName);
    if (!$Group || !is_object($Group) || $Group->isError()) {
        exit_no_group();
    }
    $perm =& permission_get_object($Group, $User);
    if (!$perm || !is_object($perm) || !$perm->isCVSWriter()) {
        exit_permission_denied();
    }
}
exit(0);
Exemple #8
0
        echo html_build_select_box_from_arrays(array(_('MAIL'), _('ALL')), array(_('Admin-initiated mailings'), _('All site mailings')), 'type', false, false);
        ?>
		<input type="submit" name="submit" value="<?php 
        echo _('Unsubscribe');
        ?>
" />
		</form>

		<?php 
        site_admin_footer(array());
        exit;
    } else {
        /*
        	Perform unsubscription
        */
        $u =& user_get_object_by_name($user_name);
        if (!$u || !is_object($u)) {
            exit_error('Error', 'Could Not Get User');
        } elseif ($u->isError()) {
            exit_error('Error', $u->getErrorMessage());
        }
        if (!$u->unsubscribeFromMailings($type == 'ALL' ? 1 : 0)) {
            exit_error(_('Error, Could not unsubscribe user:'******'User unsubscribed') . '<br />';
    }
}
site_admin_header(array('title' => _('Site Mailings Subscription Maintenance')));
?>

<h4>
Exemple #9
0
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GForge; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
require_once '../env.inc.php';
require_once $gfwww . 'include/pre.php';
$confirm_hash = getStringFromRequest('confirm_hash');
if (getStringFromRequest('submit')) {
    $loginname = getStringFromRequest('loginname');
    $passwd = getStringFromRequest('passwd');
    if (!$loginname) {
        exit_error(_('Missing paramater'), _('You must enter a user name.'));
    }
    $u = user_get_object_by_name($loginname);
    if (!$u || !is_object($u)) {
        exit_error('Error', 'Could Not Get User');
    } elseif ($u->isError()) {
        exit_error('Error', $u->getErrorMessage());
    }
    if ($u->getStatus() == 'A') {
        exit_error(_('Invalid operation'), _('Account already active.'));
    }
    $confirm_hash = html_clean_hash_string($confirm_hash);
    if ($confirm_hash != $u->getConfirmHash()) {
        exit_error(_('Invalid parameter'), _('Cannot confirm account identity - invalid confirmation hash (or login name)'));
    }
    if (!session_login_valid($loginname, $passwd, 1)) {
        exit_error(_('Access denied'), _('Credentials you entered do not correspond to valid account.'));
    }
 function AuthUser($loginname, $passwd)
 {
     global $feedback;
     if (!function_exists("ldap_connect")) {
         return false;
     }
     if (!$this->ldap_conn) {
         $this->ldap_conn = ldap_connect($this->ldap_server, $this->ldap_port);
     }
     if ($GLOBALS['sys_ldap_version']) {
         ldap_set_option($this->ldap_conn, LDAP_OPT_PROTOCOL_VERSION, $GLOBALS['sys_ldap_version']);
     }
     $dn = plugin_ldapextauth_getdn($this, $loginname);
     if (empty($dn)) {
         $GLOBALS['ldap_auth_failed'] = true;
         return false;
     }
     $u = user_get_object_by_name($loginname);
     if ($u) {
         // User exists in DB
         if (@ldap_bind($this->ldap_conn, $dn, $passwd)) {
             // Password from form is valid in LDAP
             if (session_login_valid_dbonly($loginname, $passwd, false)) {
                 // Also according to DB
                 $GLOBALS['ldap_auth_failed'] = false;
                 return true;
             } else {
                 // Passwords mismatch, update DB's
                 $u->setPasswd($passwd);
                 $GLOBALS['ldap_auth_failed'] = false;
                 return true;
             }
         } else {
             // Wrong password according to LDAP
             $feedback = _('Invalid Password Or User Name');
             $GLOBALS['ldap_auth_failed'] = true;
             return false;
         }
     } else {
         // User doesn't exist in DB yet
         if (@ldap_bind($this->ldap_conn, $dn, $passwd)) {
             // User authenticated
             // Now get her info
             if ($this->ldap_kind == "AD") {
                 $res = ldap_search($this->ldap_conn, $this->base_dn, "sAMAccountName=" . $loginname);
             } else {
                 $res = ldap_read($this->ldap_conn, $dn, "objectclass=*");
             }
             $info = ldap_get_entries($this->ldap_conn, $res);
             $ldapentry = $info[0];
             $mappedinfo = plugin_ldapextauth_mapping($ldapentry);
             // Insert into DB
             $u = new User();
             $unix_name = $loginname;
             $firstname = '';
             $lastname = '';
             $password1 = $passwd;
             $password2 = $passwd;
             $email = '';
             $mail_site = 1;
             $mail_va = 0;
             $language_id = 1;
             $timezone = 'GMT';
             $jabber_address = '';
             $jabber_only = 0;
             $theme_id = 1;
             $unix_box = '';
             $address = '';
             $address2 = '';
             $phone = '';
             $fax = '';
             $title = '';
             $ccode = 'US';
             $send_mail = false;
             if ($mappedinfo['firstname']) {
                 $firstname = $mappedinfo['firstname'];
             }
             if ($mappedinfo['lastname']) {
                 $lastname = $mappedinfo['lastname'];
             }
             if ($mappedinfo['email']) {
                 $email = $mappedinfo['email'];
             }
             if ($mappedinfo['language_id']) {
                 $language_id = $mappedinfo['language_id'];
             }
             if ($mappedinfo['timezone']) {
                 $timezone = $mappedinfo['timezone'];
             }
             if ($mappedinfo['jabber_address']) {
                 $jabber_address = $mappedinfo['jabber_address'];
             }
             if ($mappedinfo['address']) {
                 $address = $mappedinfo['address'];
             }
             if ($mappedinfo['address2']) {
                 $address2 = $mappedinfo['address2'];
             }
             if ($mappedinfo['phone']) {
                 $phone = $mappedinfo['phone'];
             }
             if ($mappedinfo['fax']) {
                 $fax = $mappedinfo['fax'];
             }
             if ($mappedinfo['title']) {
                 $title = $mappedinfo['title'];
             }
             if ($mappedinfo['ccode']) {
                 $ccode = $mappedinfo['ccode'];
             }
             if ($mappedinfo['themeid']) {
                 $theme_id = $mappedinfo['themeid'];
             }
             if (!$u->create($unix_name, $firstname, $lastname, $password1, $password2, $email, $mail_site, $mail_va, $language_id, $timezone, $jabber_address, $jabber_only, $theme_id, $unix_box, $address, $address2, $phone, $fax, $title, $ccode, $send_mail)) {
                 $GLOBALS['ldap_auth_failed'] = true;
                 $feedback = "<br>Error Creating User: "******"<br>Error Activating User: " . $u->getErrorMessage();
                 return false;
             }
             $GLOBALS['ldap_auth_failed'] = false;
             $GLOBALS['ldap_first_login'] = true;
             return true;
         } else {
             $GLOBALS['ldap_auth_failed'] = true;
             $feedback = _('Invalid Password Or User Name');
             return false;
             // Probably ignored, but just in case
         }
     }
 }
 function CallHook($hookname, $params)
 {
     global $use_mediawikiplugin, $G_SESSION, $HTML;
     if (isset($params['group_id'])) {
         $group_id = $params['group_id'];
     } elseif (isset($params['group'])) {
         $group_id = $params['group'];
     } else {
         $group_id = null;
     }
     if ($hookname == "outermenu") {
         $params['TITLES'][] = 'MediaWiki';
         $params['DIRS'][] = '/mediawiki';
     } elseif ($hookname == "usermenu") {
         $text = $this->text;
         // this is what shows in the tab
         if ($G_SESSION->usesPlugin("mediawiki")) {
             echo ' | ' . $HTML->PrintSubMenu(array($text), array('/mediawiki/index.php?title=User:'******'TITLES'][] = $this->text;
             $params['DIRS'][] = '/plugins/mediawiki/index.php?group_id=' . $project->getID();
         }
         $params['toptab'] == $this->name ? $params['selected'] = count($params['TITLES']) - 1 : '';
     } elseif ($hookname == "groupisactivecheckbox") {
         //Check if the group is active
         // this code creates the checkbox in the project edit public info page to activate/deactivate the plugin
         $group =& group_get_object($group_id);
         echo "<tr>";
         echo "<td>";
         echo ' <input type="CHECKBOX" name="use_mediawikiplugin" value="1" ';
         // CHECKED OR UNCHECKED?
         if ($group->usesPlugin($this->name)) {
             echo "CHECKED";
         }
         echo "><br/>";
         echo "</td>";
         echo "<td>";
         echo "<strong>Use " . $this->text . " Plugin</strong>";
         echo "</td>";
         echo "</tr>";
     } elseif ($hookname == "groupisactivecheckboxpost") {
         // this code actually activates/deactivates the plugin after the form was submitted in the project edit public info page
         $group =& group_get_object($group_id);
         $use_mediawikiplugin = getStringFromRequest('use_mediawikiplugin');
         if ($use_mediawikiplugin == 1) {
             $group->setPluginUse($this->name);
         } else {
             $group->setPluginUse($this->name, false);
         }
     } elseif ($hookname == "userisactivecheckbox") {
         //check if user is active
         // this code creates the checkbox in the user account manteinance page to activate/deactivate the plugin
         $user = $params['user'];
         echo "<tr>";
         echo "<td>";
         echo ' <input type="CHECKBOX" name="use_mediawikiplugin" value="1" ';
         // CHECKED OR UNCHECKED?
         if ($user->usesPlugin($this->name)) {
             echo "CHECKED";
         }
         echo ">    Use " . $this->text . " Plugin";
         echo "</td>";
         echo "</tr>";
     } elseif ($hookname == "userisactivecheckboxpost") {
         // this code actually activates/deactivates the plugin after the form was submitted in the user account manteinance page
         $user = $params['user'];
         $use_mediawikiplugin = getStringFromRequest('use_mediawikiplugin');
         if ($use_mediawikiplugin == 1) {
             $user->setPluginUse($this->name);
         } else {
             $user->setPluginUse($this->name, false);
         }
         echo "<tr>";
         echo "<td>";
         echo ' <input type="CHECKBOX" name="use_mediawikiplugin" value="1" ';
         // CHECKED OR UNCHECKED?
         if ($user->usesPlugin($this->name)) {
             echo "CHECKED";
         }
         echo ">    Use " . $this->text . " Plugin";
         echo "</td>";
         echo "</tr>";
     } elseif ($hookname == "user_personal_links") {
         // this displays the link in the user's profile page to it's personal MediaWiki (if you want other sto access it, youll have to change the permissions in the index.php
         $userid = $params['user_id'];
         $user = user_get_object($userid);
         $text = $params['text'];
         //check if the user has the plugin activated
         if ($user->usesPlugin($this->name)) {
             echo '	<p>';
             echo util_make_link("/plugins/helloworld/index.php?id={$userid}&type=user&pluginname=" . $this->name, _('View Personal MediaWiki'));
             echo '</p>';
         }
     } elseif ($hookname == "project_admin_plugins") {
         // this displays the link in the project admin options page to it's  MediaWiki administration
         $group_id = $params['group_id'];
         $group =& group_get_object($group_id);
         if ($group->usesPlugin($this->name)) {
             echo util_make_link("/plugins/projects_hierarchy/index.php?id=" . $group->getID() . '&type=admin&pluginname=' . $this->name, _('View the MediaWiki Administration'));
             echo '</p>';
         }
     } elseif ($hookname == "session_before_login") {
         $loginname = $params['loginname'];
         $passwd = $params['passwd'];
         if (!session_login_valid_dbonly($loginname, $passwd, false)) {
             return;
         }
         $u = user_get_object_by_name($loginname);
         define('MEDIAWIKI', true);
         if (is_file('/var/lib/mediawiki/LocalSettings.php')) {
             require_once '/var/lib/mediawiki/LocalSettings.php';
         } elseif (is_file('/var/lib/mediawiki1.10/LocalSettings.php')) {
             require_once '/var/lib/mediawiki1.10/LocalSettings.php';
         } else {
             return 1;
         }
         if (is_dir('/usr/share/mediawiki')) {
             $mw_share_path = "/usr/share/mediawiki";
         } elseif (is_dir('/usr/share/mediawiki1.10')) {
             $mw_share_path = "/usr/share/mediawiki1.10";
         } else {
             return 1;
         }
         require_once $mw_share_path . '/includes/Defines.php';
         require_once $mw_share_path . '/includes/Exception.php';
         require_once $mw_share_path . '/includes/GlobalFunctions.php';
         require_once $mw_share_path . '/StartProfiler.php';
         require_once $mw_share_path . '/includes/Database.php';
         $mwdb = new Database();
         $mwdb->open($wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname);
         $sql = "select count(*) from user where user_name=?";
         $res = $mwdb->safeQuery($sql, ucfirst($loginname));
         $row = $mwdb->fetchRow($res);
         if ($row[0] == 1) {
             $sql = "update user set user_password=?, user_email=?, user_real_name=? where user_name=?";
             $res = $mwdb->safeQuery($sql, md5($passwd), $u->getEmail(), $u->getRealName(), array(ucfirst($loginname)));
         } else {
             $sql = "insert into user (user_name, user_real_name, user_password, user_email, user_options) values (?, ?, ?, ?, ?)";
             $res = $mwdb->safeQuery($sql, array(ucfirst($loginname), $u->getRealName(), md5($passwd), $u->getEmail(), "skin=gforge\ncols=80\nrows=25"));
         }
     } elseif ($hookname == "blahblahblah") {
         // ...
     }
 }
 /**
  * Outputs user's FOAF profile
  * @param unknown_type $params
  */
 function content_negociated_user_home(&$params)
 {
     $username = $params['username'];
     $accept = $params['accept'];
     if ($accept == 'application/rdf+xml') {
         $params['content_type'] = 'application/rdf+xml';
         $user_obj = user_get_object_by_name($username);
         $user_real_name = $user_obj->getRealName();
         $user_email = $user_obj->getEmail();
         $mbox = 'mailto:' . $user_email;
         $mbox_sha1sum = sha1($mbox);
         $projects = $user_obj->getGroups();
         sortProjectList($projects);
         $roles = RBACEngine::getInstance()->getAvailableRolesForUser($user_obj);
         sortRoleList($roles);
         // Construct an ARC2_Resource containing the project's RDF (DOAP) description
         $ns = array('rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'rdfs' => 'http://www.w3.org/2000/01/rdf-schema#', 'foaf' => 'http://xmlns.com/foaf/0.1/', 'sioc' => 'http://rdfs.org/sioc/ns#', 'doap' => 'http://usefulinc.com/ns/doap#', 'dcterms' => 'http://purl.org/dc/terms/', 'planetforge' => 'http://coclico-project.org/ontology/planetforge#');
         $conf = array('ns' => $ns);
         // First, let's deal with the account
         $account_res = ARC2::getResource($conf);
         $account_uri = util_make_url_u($username, $user_obj->getID());
         $account_uri = rtrim($account_uri, '/');
         $person_uri = $account_uri . '#person';
         $account_res->setURI($account_uri);
         // $account_res->setRel('rdf:type', 'foaf:OnlineAccount');
         rdfutils_setPropToUri($account_res, 'rdf:type', 'foaf:OnlineAccount');
         rdfutils_setPropToUri($account_res, 'foaf:accountServiceHomepage', $account_uri . '/');
         $account_res->setProp('foaf:accountName', $username);
         rdfutils_setPropToUri($account_res, 'sioc:account_of', $person_uri);
         rdfutils_setPropToUri($account_res, 'foaf:accountProfilePage', $account_uri);
         $groups_index = array();
         $projects_index = array();
         $roles_index = array();
         $usergroups_uris = array();
         // see if there were any groups
         if (count($projects) >= 1) {
             foreach ($projects as $p) {
                 // TODO : report also private projects if authenticated, for instance through OAuth
                 if ($p->isPublic()) {
                     $project_link = util_make_link_g($p->getUnixName(), $p->getID(), $p->getPublicName());
                     $project_uri = util_make_url_g($p->getUnixName(), $p->getID());
                     // sioc:UserGroups for all members of a project are named after /projects/A_PROJECT/members/
                     $usergroup_uri = $project_uri . 'members/';
                     $role_names = array();
                     $usergroups_uris[] = $usergroup_uri;
                     $usergroup_res = ARC2::getResource($conf);
                     $usergroup_res->setURI($usergroup_uri);
                     rdfutils_setPropToUri($usergroup_res, 'rdf:type', 'sioc:UserGroup');
                     rdfutils_setPropToUri($usergroup_res, 'sioc:usergroup_of', $project_uri);
                     $roles_uris = array();
                     foreach ($roles as $r) {
                         if ($r instanceof RoleExplicit && $r->getHomeProject() != NULL && $r->getHomeProject()->getID() == $p->getID()) {
                             $role_names[$r->getID()] = $r->getName();
                             $role_uri = $project_uri . 'roles/' . $r->getID();
                             $roles_uris[] = $role_uri;
                         }
                     }
                     rdfutils_setPropToUri($usergroup_res, 'planetforge:group_has_function', $roles_uris);
                     $project_res = ARC2::getResource($conf);
                     $project_res->setURI($project_uri);
                     rdfutils_setPropToUri($project_res, 'rdf:type', 'planetforge:ForgeProject');
                     $project_res->setProp('doap:name', $p->getUnixName());
                     $projects_index = ARC2::getMergedIndex($projects_index, $project_res->index);
                     foreach ($role_names as $id => $name) {
                         $role_res = ARC2::getResource($conf);
                         $role_res->setURI($project_uri . 'roles/' . $id);
                         rdfutils_setPropToUri($role_res, 'rdf:type', 'sioc:Role');
                         $role_res->setProp('sioc:name', $name);
                         $roles_index = ARC2::getMergedIndex($roles_index, $role_res->index);
                     }
                     $groups_index = ARC2::getMergedIndex($groups_index, $usergroup_res->index);
                 }
             }
         }
         // end if groups
         rdfutils_setPropToUri($account_res, 'sioc:member_of', $usergroups_uris);
         // next, deal with the person
         $person_res = ARC2::getResource($conf);
         $person_res->setURI($person_uri);
         rdfutils_setPropToUri($person_res, 'rdf:type', 'foaf:Person');
         $person_res->setProp('foaf:name', $user_real_name);
         rdfutils_setPropToUri($person_res, 'foaf:holdsAccount', $account_uri);
         $person_res->setProp('foaf:mbox_sha1sum', $mbox_sha1sum);
         // merge the two sets of triples
         $merged_index = ARC2::getMergedIndex($account_res->index, $person_res->index);
         $merged_index = ARC2::getMergedIndex($merged_index, $groups_index);
         $merged_index = ARC2::getMergedIndex($merged_index, $projects_index);
         $merged_index = ARC2::getMergedIndex($merged_index, $roles_index);
         $conf = array('ns' => $ns, 'serializer_type_nodes' => true);
         $ser = ARC2::getRDFXMLSerializer($conf);
         /* Serialize a resource index */
         $doc = $ser->getSerializedIndex($merged_index);
         $params['content'] = $doc . "\n";
     }
 }