/**
  * getRows - get the html output for result rows
  *
  * @return string html output
  */
 function getRows()
 {
     $rowsCount = $this->searchQuery->getRowsCount();
     $result =& $this->searchQuery->getResult();
     $return = '';
     for ($i = 0; $i < $rowsCount; $i++) {
         $return .= '<tr ' . $GLOBALS['HTML']->boxGetAltRowStyle($i) . '>' . '<td width="40%"><a href="' . util_make_url_u(db_result($result, $i, 'user_name'), db_result($result, $i, 'user_id')) . '">' . html_image('ic/msg.png', '10', '12', array('border' => '0')) . ' ' . db_result($result, $i, 'user_name') . '</a></td>' . '<td width="60%">' . db_result($result, $i, 'realname') . '</td>' . '</tr>';
     }
     return $return;
 }
Beispiel #2
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);
         }
     }
 }
Beispiel #3
0
function util_make_link_u($username, $user_id, $text)
{
    return '<a href="' . util_make_url_u($username, $user_id) . '">' . $text . '</a>';
}
 /**
  * Declares itself as accepting RDF XML on /projects/...
  * @param unknown_type $params
  */
 function project_rdf_metadata(&$params)
 {
     # TODO : create another resource
     $group_id = $params['group'];
     $new_prefixes = array('admssw' => 'http://purl.org/adms/sw/', 'rad' => 'http://www.w3.org/ns/radion#', 'schema' => 'http://schema.org/');
     foreach ($new_prefixes as $s => $u) {
         if (!isset($params['prefixes'][$u])) {
             $params['prefixes'][$u] = $s;
         }
     }
     $res = $params['in_Resource'];
     // we could save the type doap:Project in such case, as there's an equivalence, but not sure all consumers do reasoning
     $types = array('doap:Project', 'admssw:SoftwareProject');
     rdfutils_setPropToUri($res, 'rdf:type', $types);
     $tags_list = NULL;
     if (forge_get_config('use_project_tags')) {
         $group = group_get_object($group_id);
         $tags_list = $group->getTags();
     }
     // connect to FusionForge internals
     $pm = ProjectManager::instance();
     $project = $pm->getProject($group_id);
     $tags = array();
     if ($tags_list) {
         $tags = split(', ', $tags_list);
         // reuse the same as dcterms:subject until further specialization of adms.sw keywords
         $res->setProp('rad:keyword', $tags);
     }
     $project_description = $project->getDescription();
     if ($project_description) {
         // it seems that doap:description is not equivalent to dcterms:description, so repeat
         $res->setProp('dcterms:description', $project_description);
     }
     $res->setProp('rdfs:comment', "Generated with the doaprdf and admssw plugins of fusionforge");
     rdfutils_setPropToUri($res, 'dcterms:isPartOf', util_make_url("/projects"));
     $admins = $project->getAdmins();
     $members = $project->getUsers();
     $contributors_uris = array();
     foreach ($admins as $u) {
         $contributor_uri = util_make_url_u($u->getUnixName(), $u->getID());
         $contributor_uri = rtrim($contributor_uri, '/');
         $contributor_uri = $contributor_uri . '#person';
         if (!in_array($contributor_uri, $contributors_uris)) {
             $contributors_uris[] = $contributor_uri;
         }
     }
     foreach ($members as $u) {
         $contributor_uri = util_make_url_u($u->getUnixName(), $u->getID());
         $contributor_uri = rtrim($contributor_uri, '/');
         $contributor_uri = $contributor_uri . '#person';
         if (!in_array($contributor_uri, $contributors_uris)) {
             $contributors_uris[] = $contributor_uri;
         }
     }
     rdfutils_setPropToUri($res, 'schema:contributor', $contributors_uris);
     $params['out_Resources'][] = $res;
 }
 /**
  * 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";
     }
 }
Beispiel #6
0
<?php printf(_('"Remember me". <i>(Allows to access your <a href="%s">personal page</a> without being logged in. You will still need to login explicitly before making any changes.)</i>'),util_make_url ('/my/'));
*/
?>

<p />
<?php 
if ($sys_use_ratings) {
    ?>
<input type="checkbox"  name="use_ratings" value="1"<?php 
    if ($u->usesRatings()) {
        print ' checked="checked"';
    }
    ?>
 />
		  <?php 
    printf(_('Participate in peer ratings. <i>(Allows you to rate other users using several criteria as well as to be rated by others. More information is available on your <a href="%s">user page</a> if you have chosen to participate in ratings.)</i>'), util_make_url_u($u->getUnixName(), $u->getId()));
}
?>
	
</td></tr>
<?php 
$hookParams['user'] = user_get_object(user_getid());
if (getStringFromRequest('submit')) {
    //if this is set, then the user has issued an Update
    plugin_hook("userisactivecheckboxpost", $hookParams);
} else {
    plugin_hook("userisactivecheckbox", $hookParams);
}
?>
<tr><td>