function git_commitdiff($projectroot, $project, $hash, $hash_parent)
{
    global $tpl;
    $cachekey = sha1($project) . "|" . $hash . "|" . $hash_parent;
    $git = new Git($projectroot . $project);
    $hash = sha1_bin($hash);
    if (isset($hash_parent)) {
        $hash_parent = sha1_bin($hash_parent);
    }
    if (!$tpl->is_cached('commitdiff.tpl', $cachekey)) {
        $co = git_read_commit($git, $hash);
        $ad = date_str($co['author_epoch']);
        $tpl->assign('committer', $co['committer']);
        $tpl->assign('rfc2822', $ad['rfc2822']);
        if (!isset($hash_parent) && isset($co['parent'])) {
            $hash_parent = sha1_bin($co['parent']);
        }
        $a_tree = isset($hash_parent) ? $git->getObject($hash_parent)->getTree() : array();
        $b_tree = $git->getObject(sha1_bin($co['tree']));
        $difftree = GitTree::diffTree($a_tree, $b_tree);
        $tpl->assign("hash", sha1_hex($hash));
        $tpl->assign("tree", $co['tree']);
        $tpl->assign("hashparent", sha1_hex($hash_parent));
        $tpl->assign("title", $co['title']);
        $refs = read_info_ref($git);
        if (isset($refs[$hash])) {
            $tpl->assign("commitref", $refs[$hash]);
        }
        $tpl->assign("comment", $co['comment']);
        $difftreelines = array();
        $status_map = array(GitTree::TREEDIFF_ADDED => "A", GitTree::TREEDIFF_REMOVED => "D", GitTree::TREEDIFF_CHANGED => "M");
        foreach ($difftree as $file => $diff) {
            $difftreeline = array();
            $difftreeline["from_mode"] = decoct($diff->old_mode);
            $difftreeline["to_mode"] = decoct($diff->new_mode);
            $difftreeline["from_id"] = sha1_hex($diff->old_obj);
            $difftreeline["to_id"] = sha1_hex($diff->new_obj);
            $difftreeline["status"] = $status_map[$diff->status];
            $difftreeline["file"] = $file;
            $difftreeline["md5"] = md5($file);
            $difftreeline["from_type"] = file_type($difftreeline["from_mode"]);
            $difftreeline["to_type"] = file_type($difftreeline["to_mode"]);
            if ($diff->status == GitTree::TREEDIFF_ADDED) {
                $difftreeline['diffout'] = explode("\n", git_diff($git, null, "/dev/null", $diff->new_obj, "b/" . $file));
            } else {
                if ($diff->status == GitTree::TREEDIFF_REMOVED) {
                    $difftreeline['diffout'] = explode("\n", git_diff($git, $diff->old_obj, "a/" . $file, null, "/dev/null"));
                } else {
                    if ($diff->status == GitTree::TREEDIFF_CHANGED && $diff->old_obj != $diff->new_obj) {
                        $difftreeline['diffout'] = explode("\n", git_diff($git, $diff->old_obj, "a/" . $file, $diff->new_obj, "b/" . $file));
                    }
                }
            }
            $difftreelines[] = $difftreeline;
        }
        $tpl->assign("difftreelines", $difftreelines);
    }
    $tpl->display('commitdiff.tpl', $cachekey);
}
function git_commitdiff_plain($projectroot, $project, $hash, $hash_parent)
{
    global $tpl;
    $cachekey = sha1($project) . "|" . $hash . "|" . $hash_parent;
    header("Content-type: text/plain; charset=UTF-8");
    header("Content-disposition: inline; filename=\"git-" . $hash . ".patch\"");
    if (!$tpl->is_cached('diff_plaintext.tpl', $cachekey)) {
        $ret = prep_tmpdir();
        if ($ret !== TRUE) {
            echo $ret;
            return;
        }
        $co = git_read_commit($projectroot . $project, $hash);
        if (!isset($hash_parent)) {
            $hash_parent = $co['parent'];
        }
        $diffout = git_diff_tree($projectroot . $project, $hash_parent . " " . $hash);
        $difftree = explode("\n", $diffout);
        $refs = read_info_ref($projectroot . $project, "tags");
        $listout = git_read_revlist($projectroot . $project, "HEAD");
        foreach ($listout as $i => $rev) {
            if (isset($refs[$rev])) {
                $tagname = $refs[$rev];
            }
            if ($rev == $hash) {
                break;
            }
        }
        $ad = date_str($co['author_epoch'], $co['author_tz']);
        $tpl->assign("from", $co['author']);
        $tpl->assign("date", $ad['rfc2822']);
        $tpl->assign("subject", $co['title']);
        if (isset($tagname)) {
            $tpl->assign("tagname", $tagname);
        }
        $tpl->assign("url", script_url() . "?p=" . $project . "&a=commitdiff&h=" . $hash);
        $tpl->assign("comment", $co['comment']);
        $diffs = array();
        foreach ($difftree as $i => $line) {
            if (preg_match("/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)\t(.*)\$/", $line, $regs)) {
                if ($regs[5] == "A") {
                    $diffs[] = git_diff($projectroot . $project, null, "/dev/null", $regs[4], "b/" . $regs[6]);
                } else {
                    if ($regs[5] == "D") {
                        $diffs[] = git_diff($projectroot . $project, $regs[3], "a/" . $regs[6], null, "/dev/null");
                    } else {
                        if ($regs[5] == "M") {
                            $diffs[] = git_diff($projectroot . $project, $regs[3], "a/" . $regs[6], $regs[4], "b/" . $regs[6]);
                        }
                    }
                }
            }
        }
        $tpl->assign("diffs", $diffs);
    }
    $tpl->display('diff_plaintext.tpl', $cachekey);
}
Example #3
0
function show_admin($user, $admin)
{
    $admin_user = BoincUser::lookup_id($admin->userid);
    $tokens = url_tokens($user->authenticator);
    $date = date_str($admin->create_time);
    echo "<tr>\n        <td>" . user_links($admin_user) . "</td>\n        <td>{$date}</td>\n        <td>\n    ";
    show_button("team_admins.php?teamid={$admin->teamid}&action=remove&userid={$admin_user->id}" . $tokens, tra("Remove"), tra("Remove Team Admin status from this member"));
    echo "</td></tr>\n    ";
}
function git_commitdiff_plain($projectroot, $project, $hash, $hash_parent)
{
    global $tpl;
    $cachekey = sha1($project) . "|" . $hash . "|" . $hash_parent;
    header("Content-type: text/plain; charset=UTF-8");
    header("Content-disposition: inline; filename=\"git-" . $hash . ".patch\"");
    $git = new Git($projectroot . $project);
    $hash = sha1_bin($hash);
    if (isset($hash_parent)) {
        $hash_parent = sha1_bin($hash_parent);
    }
    if (!$tpl->is_cached('diff_plaintext.tpl', $cachekey)) {
        $co = git_read_commit($git, $hash);
        if (!isset($hash_parent) && isset($co['parent'])) {
            $hash_parent = sha1_bin($co['parent']);
        }
        $a_tree = isset($hash_parent) ? $git->getObject($hash_parent)->getTree() : array();
        $b_tree = $git->getObject(sha1_bin($co['tree']));
        $difftree = GitTree::diffTree($a_tree, $b_tree);
        // FIXME: simplified tagname search is not implemented yet
        /*$refs = read_info_ref($git,"tags");
        		$listout = git_read_revlist($git, "HEAD");
        		foreach ($listout as $i => $rev) {
        			if (isset($refs[$rev]))
        				$tagname = $refs[$rev];
        			if ($rev == $hash)
        				break;
        		}*/
        $ad = date_str($co['author_epoch'], $co['author_tz']);
        $tpl->assign("from", $co['author']);
        $tpl->assign("date", $ad['rfc2822']);
        $tpl->assign("subject", $co['title']);
        if (isset($tagname)) {
            $tpl->assign("tagname", $tagname);
        }
        $tpl->assign("url", script_url() . "?p=" . $project . "&a=commitdiff&h=" . sha1_hex($hash));
        $tpl->assign("comment", $co['comment']);
        $diffs = array();
        foreach ($difftree as $file => $diff) {
            if ($diff->status == GitTree::TREEDIFF_ADDED) {
                $diffs[] = git_diff($git, null, "/dev/null", $diff->new_obj, "b/" . $file);
            } else {
                if ($diff->status == GitTree::TREEDIFF_REMOVED) {
                    $diffs[] = git_diff($git, $diff->old_obj, "a/" . $file, null, "/dev/null");
                } else {
                    if ($diff->status == GitTree::TREEDIFF_CHANGED) {
                        $diffs[] = git_diff($git, $diff->old_obj, "a/" . $file, $diff->new_obj, "b/" . $file);
                    }
                }
            }
        }
        $tpl->assign("diffs", $diffs);
    }
    $tpl->display('diff_plaintext.tpl', $cachekey);
}
function git_log($projectroot, $project, $hash, $page)
{
    global $tpl;
    $cachekey = sha1($project) . "|" . $hash . "|" . (isset($page) ? $page : 0);
    $git = new Git($projectroot . $project);
    if (!$tpl->is_cached('shortlog.tpl', $cachekey)) {
        $head = git_read_head($git);
        if (!isset($hash)) {
            $hash = $head;
        } else {
            $hash = $git->revParse($hash);
        }
        if (!isset($page)) {
            $page = 0;
        }
        $refs = read_info_ref($git);
        $tpl->assign("hash", sha1_hex($hash));
        $tpl->assign("head", sha1_hex($head));
        if ($page) {
            $tpl->assign("page", $page);
        }
        $revlist = git_read_revlist($git, $hash, 101, $page * 100);
        $revlistcount = count($revlist);
        $tpl->assign("revlistcount", $revlistcount);
        if (!$revlist) {
            $tpl->assign("norevlist", TRUE);
            $co = git_read_commit($git, $hash);
            $tpl->assign("lastchange", $co['age_string']);
        }
        $commitlines = array();
        $commitcount = min(100, $revlistcount);
        for ($i = 0; $i < $commitcount; ++$i) {
            $commit = $revlist[$i];
            $commithash = sha1_hex($commit->getName());
            $commitline = array();
            $co = git_read_commit($git, $commit->getName());
            $ad = date_str($co['author_epoch']);
            $commitline["project"] = $project;
            $commitline["commit"] = $commithash;
            if (isset($refs[$commit->getName()])) {
                $commitline["commitref"] = $refs[$commit->getName()];
                $commitline["commitclass"] = get_commit_class($refs[$commit->getName()]);
            }
            $commitline["agestring"] = $co['age_string'];
            $commitline["title"] = $co['title'];
            $commitline["authorname"] = $co['author_name'];
            $commitline["rfc2822"] = $ad['rfc2822'];
            $commitline["comment"] = $co['comment'];
            $commitlines[] = $commitline;
        }
        $tpl->assign("commitlines", $commitlines);
    }
    $tpl->display('log.tpl', $cachekey);
}
function show_bossa_app($app, $i)
{
    $j = $i % 2;
    echo "<tr class=row{$j}>\n        <td>Name: {$app->name}<br>\n            Short name: {$app->short_name}<br>\n            Description: {$app->description}<br>\n            Created: " . date_str($app->create_time) . "\n        </td>\n        <td>\n    ";
    if ($app->hidden) {
        show_button("bossa_admin.php?action=unhide&app_id={$app->id}", "Unhide", "Unhide this app");
    } else {
        show_button("bossa_admin.php?action=hide&app_id={$app->id}", "Hide", "Hide this app");
    }
    echo "<br>";
    show_button("bossa_admin.php?action=show_batches&app_id={$app->id}", "Show batches", "Show batches");
}
Example #7
0
function show_course($course)
{
    $x = "<b>{$course->name}</b>\n\t\t\t<br>Description: {$course->description}\n\t\t\t<br>Created: " . date_str($course->create_time) . "\n\t";
    $y = "<a href=bolt_map.php?course_id={$course->id}>Map</a>\n\t\t<br><a href=bolt_compare.php?course_id={$course->id}>Experiments</a>\n\t\t<br>\n\t";
    row2_init($x, $y);
    if ($course->hidden) {
        show_button("bolt_admin.php?action=unhide&course_id={$course->id}", "Unhide", "Unhide this course");
    } else {
        show_button("bolt_admin.php?action=hide&course_id={$course->id}", "Hide", "Hide this course");
    }
    show_button("bolt_admin.php?action=clear_confirm&course_id={$course->id}", "Clear data", "Clear student data for this course");
    echo "</td></tr>";
}
Example #8
0
function show_snap_form()
{
    global $course_id;
    admin_page_head("Data snapshot");
    $s = read_map_snapshot($course_id);
    if ($s) {
        $end = date_str($s->time);
        echo "\n\t\t\tA data snapshot exists for the {$s->dur} days prior to {$end}.\n\t\t";
        show_button("bolt_map.php?action=map&course_id={$course_id}", "Use this snapshot", "Use this snapshot");
    } else {
        echo "There is currently no snapshot.";
    }
    echo "\n\t\t<form action=bolt_map.php>\n\t\t<input type=hidden name=action value=snap_action>\n\t\t<input type=hidden name=course_id value={$course_id}>\n\t\tCreate a new snapshot using data from the last\n\t\t<input name=dur value=7> days.\n\t\t<input type=submit value=OK>\n\t\t</form>\n\t";
    admin_page_tail();
}
Example #9
0
function git_rss($projectroot, $project)
{
    global $tpl;
    header("Content-type: text/xml; charset=UTF-8");
    $cachekey = sha1($project);
    if (!$tpl->is_cached('rss.tpl', $cachekey)) {
        $head = git_read_head($projectroot . $project);
        $revlist = git_read_revlist($projectroot . $project, $head, GITPHP_RSS_ITEMS);
        $tpl->assign("self", script_url());
        $commitlines = array();
        $revlistcount = count($revlist);
        for ($i = 0; $i < $revlistcount; ++$i) {
            $commit = $revlist[$i];
            $co = git_read_commit($projectroot . $project, $commit);
            if ($i >= 20 && time() - $co['committer_epoch'] > 48 * 60 * 60) {
                break;
            }
            $cd = date_str($co['committer_epoch']);
            $difftree = array();
            $parent = '';
            if (!empty($co['parent'])) {
                $parent = $co['parent'];
            }
            $diffout = git_diff_tree($projectroot . $project, $parent . " " . $co['id']);
            $tok = strtok($diffout, "\n");
            while ($tok !== false) {
                if (preg_match("/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)([0-9]{0,3})\t(.*)\$/", $tok, $regs)) {
                    $difftree[] = $regs[7];
                }
                $tok = strtok("\n");
            }
            $commitline = array();
            $commitline["cdmday"] = $cd['mday'];
            $commitline["cdmonth"] = $cd['month'];
            $commitline["cdhour"] = $cd['hour'];
            $commitline["cdminute"] = $cd['minute'];
            $commitline["title"] = $co['title'];
            $commitline["author"] = $co['author'];
            $commitline["cdrfc2822"] = $cd['rfc2822'];
            $commitline["commit"] = $commit;
            $commitline["comment"] = $co['comment'];
            $commitline["difftree"] = $difftree;
            $commitlines[] = $commitline;
        }
        $tpl->assign("commitlines", $commitlines);
    }
    $tpl->display('rss.tpl', $cachekey);
}
Example #10
0
function git_shortlog($projectroot, $project, $hash, $page)
{
    global $tpl;
    $cachekey = sha1($project) . "|" . $hash . "|" . (isset($page) ? $page : 0);
    if (!$tpl->is_cached('shortlog.tpl', $cachekey)) {
        $head = git_read_head($projectroot . $project);
        if (!isset($hash)) {
            $hash = $head;
        }
        if (!isset($page)) {
            $page = 0;
        }
        $refs = read_info_ref($projectroot . $project);
        $tpl->assign("hash", $hash);
        $tpl->assign("head", $head);
        if ($page) {
            $tpl->assign("page", $page);
        }
        $revlist = git_read_revlist($projectroot . $project, $hash, 101, $page * 100);
        $revlistcount = count($revlist);
        $tpl->assign("revlistcount", $revlistcount);
        $commitlines = array();
        $commitcount = min(100, count($revlist));
        for ($i = 0; $i < $commitcount; ++$i) {
            $commit = $revlist[$i];
            if (strlen(trim($commit)) > 0) {
                $commitline = array();
                if (isset($refs[$commit])) {
                    $commitline["commitref"] = $refs[$commit];
                }
                $co = git_read_commit($projectroot . $project, $commit);
                $ad = date_str($co['author_epoch']);
                $commitline["commit"] = $commit;
                $commitline["agestringage"] = $co['age_string_age'];
                $commitline["agestringdate"] = $co['age_string_date'];
                $commitline["authorname"] = $co['author_name'];
                $commitline["title_short"] = $co['title_short'];
                if (strlen($co['title_short']) < strlen($co['title'])) {
                    $commitline["title"] = $co['title'];
                }
                $commitlines[] = $commitline;
            }
        }
        $tpl->assign("commitlines", $commitlines);
    }
    $tpl->display('shortlog.tpl', $cachekey);
}
Example #11
0
function git_tag($projectroot, $project, $hash)
{
    global $tpl;
    $cachekey = sha1($project) . "|" . $hash;
    if (!$tpl->is_cached('tag.tpl', $cachekey)) {
        $head = git_read_head($projectroot . $project);
        $tpl->assign("head", $head);
        $tpl->assign("hash", $hash);
        $tag = git_read_tag($projectroot . $project, $hash);
        $tpl->assign("tag", $tag);
        if (isset($tag['author'])) {
            $ad = date_str($tag['epoch'], $tag['tz']);
            $tpl->assign("datedata", $ad);
        }
    }
    $tpl->display('tag.tpl', $cachekey);
}
Example #12
0
function show_admin_page($user, $team)
{
    page_head(tra("Team administration for %1", $team->name));
    echo "\n        <ul>\n        <li><a href=team_edit_form.php?teamid={$team->id}>" . tra("Edit team info") . "</a>\n            <br><p class=\"text-muted\">" . tra("Change team name, URL, description, type, or country") . "</p>\n        <li>\n            " . tra("Member list:") . "\n        <a href=team_email_list.php?teamid={$team->id}>" . tra("HTML") . "</a>\n        &middot; <a href=team_email_list.php?teamid={$team->id}&plain=1>" . tra("text") . "</a>\n            <br><p class=\"text-muted\">" . tra("View member names and email addresses") . "</p>\n        <li>" . tra("View change history:") . "\n            <a href=team_delta.php?teamid={$team->id}>" . tra("HTML") . "</a>\n            &middot; <a href=team_delta.php?teamid={$team->id}&xml=1>" . tra("XML") . "</a>\n            <br><p class=\"text-muted\">" . tra("See when members joined or quit this team") . "</p>\n    ";
    // founder-only stuff follows
    //
    if ($team->userid == $user->id) {
        $tokens = url_tokens($user->authenticator);
        if ($team->ping_user > 0) {
            $user2 = BoincUser::lookup_id($team->ping_user);
            $deadline = date_str(transfer_ok_time($team));
            echo "<li>\n                <a href=team_change_founder_form.php?teamid={$team->id}><font color=red><strong>" . tra("Respond to foundership request.") . "</strong></font></a>  " . tra("If you don't respond by %1, %2 may assume foundership of this team.", $deadline, $user2->name);
        }
        echo "\n            <li><a href=team_remove_inactive_form.php?teamid={$team->id}>" . tra("Remove members") . "</a>\n                <br><p class=\"text-muted\">" . tra("Remove inactive or unwanted members from this team") . "</p>\n            <li><a href=team_change_founder_form.php?teamid={$team->id}>" . tra("Change founder") . "</a>\n                <br><p class=\"text-muted\">" . tra("Transfer foundership to another member") . "</p>\n            <li><a href=team_admins.php?teamid={$team->id}>" . tra("Add/remove Team Admins") . "</a>\n                <br><p class=\"text-muted\">" . tra("Give selected team members Team Admin privileges") . "</p>\n\n            <li><a href=team_manage.php?teamid={$team->id}&action=delete&{$tokens}>" . tra("Remove team") . "</a>\n                <br><p class=\"text-muted\">" . tra("Allowed only if team has no members") . "</p>\n            <li><a href=team_forum.php?teamid={$team->id}&cmd=manage>" . tra("Message board") . "</a>\n                <br><p class=\"text-muted\">" . tra("Create or manage a team message board") . "</p>\n        ";
    }
    echo "\n\n        <p>\n        <li>\n            " . tra("To have this team created on all BOINC projects (current and future) you can make it into a %1BOINC-wide team%2.", "<a href=http://boinc.berkeley.edu/teams/>", "</a>") . "\n        <li>\n            " . tra("Team admins are encouraged to join and participate in the Google %1boinc-team-founders%2 group.", "<a href=http://groups.google.com/group/boinc-team-founders>", "</a>") . "\n    </ul>\n    ";
    page_tail();
}
Example #13
0
function check_pending($user, $destuser)
{
    $friend = BoincFriend::lookup($user->id, $destuser->id);
    if ($friend) {
        if ($friend->reciprocated) {
            error_page(tra("Already friends"));
        }
        $notify = BoincNotify::lookup($destuser->id, NOTIFY_FRIEND_REQ, $user->id);
        if ($notify) {
            page_head(tra("Request pending"));
            $t = date_str($friend->create_time);
            echo tra("You requested friendship with %1 on %2.", $destuser->name, $t) . "\n                <p>" . tra("This request is still pending confirmation.");
            page_tail();
            exit;
        }
        BoincFriend::delete($user->id, $destuser->id);
    }
}
Example #14
0
function show_admin_page($user, $team)
{
    page_head("Team administration for {$team->name}");
    echo "\r\n\t\t<ul>\r\n\t\t<li><a href=team_edit_form.php?teamid={$team->id}>Edit team info</a>\r\n\t\t\t<br><span class=note>Change team name, URL, description, type, or country</span>\r\n\t\t<li>\r\n\t\t\tMember list:\r\n\t\t<a href=team_email_list.php?teamid={$team->id}>HTML</a>\r\n\t\t| <a href=team_email_list.php?teamid={$team->id}&plain=1>text</a>\r\n\t\t\t<br><span class=note> View member names and email addresses </span>\r\n\t\t<li>View change history:\r\n\t\t\t<a href=team_delta.php?teamid={$team->id}>HTML</a>\r\n\t\t\t| <a href=team_delta.php?teamid={$team->id}&xml=1>XML</a>\r\n\t\t\t<br><span class=note>See when members joined or quit this team</span>\r\n\t";
    // founder-only stuff follows
    //
    if ($team->userid == $user->id) {
        $tokens = url_tokens($user->authenticator);
        if ($team->ping_user > 0) {
            $user2 = BoincUser::lookup_id($team->ping_user);
            $deadline = date_str(transfer_ok_time($team));
            echo "<li>\r\n\t\t\t\t<a href=team_change_founder_form.php?teamid={$team->id}><font color=red><b>Respond to foundership request</b></font></a>.  If you don't respond by {$deadline}, {$user2->name} may assume foundership of this team.\r\n\t\t\t";
        }
        echo "\r\n\t\t\t<li><a href=team_remove_inactive_form.php?teamid={$team->id}>Remove members</a>\r\n\t\t\t\t<br><span class=note>Remove inactive or unwanted members from this team</span>\r\n\t\t\t<li><a href=team_change_founder_form.php?teamid={$team->id}>Change founder</a>\r\n\t\t\t\t<br><span class=note>Transfer foundership to another member</span>\r\n\t\t\t<li><a href=team_admins.php?teamid={$team->id}>Add/remove Team Admins</a>\r\n\t\t\t\t<br><span class=note>Give selected team members Team Admin privileges</span>\r\n\r\n\t\t\t<li><a href=team_manage.php?teamid={$team->id}&action=delete&{$tokens}>Remove team</a>\r\n\t\t\t\t<br><span class=note>Allowed only if team has no members</a>\r\n\t\t\t<li><a href=team_forum.php?teamid={$team->id}&cmd=manage>Message board</a>\r\n\t\t\t\t<br><span class=note>Create or manage team message board</span>\r\n\t\t";
    }
    echo "\r\n\r\n\t\t<p>\r\n\t\t<li>\r\n\t\t\tTo have this team created on all BOINC projects\r\n\t\t\t(current and future) you can make it into a\r\n\t\t\t<a href=http://boinc.berkeley.edu/teams/>BOINC-wide team</a>.\r\n\t\t<li>\r\n\t\t\tTeam admins are encouraged to join and participate in the Google\r\n\t\t\t<a href=http://groups.google.com/group/boinc-team-founders>boinc-team-founders</a> group.\r\n\t\t<li>\r\n\t\t\tOther resources for BOINC team admins\r\n\t\t\tare available from a third-party site,\r\n\t\t\t<a href=http://www.boincteams.com>www.boincteams.com</a>.\r\n\t</ul>\r\n\t";
    page_tail();
}
Example #15
0
function git_rss($projectroot, $project)
{
    global $tpl;
    header("Content-type: text/xml; charset=UTF-8");
    $cachekey = sha1($project);
    $git = new Git($projectroot . $project);
    if (!$tpl->is_cached('rss.tpl', $cachekey)) {
        $head = git_read_head($git);
        $revlist = git_read_revlist($git, $head, GITPHP_RSS_ITEMS);
        $tpl->assign("self", script_url());
        $commitlines = array();
        $revlistcount = count($revlist);
        for ($i = 0; $i < $revlistcount; ++$i) {
            $commit = $revlist[$i];
            $co = git_read_commit($git, $commit->getName());
            if ($i >= 20 && time() - $co['committer_epoch'] > 48 * 60 * 60) {
                break;
            }
            $cd = date_str($co['committer_epoch']);
            $difftree = array();
            $diffout = GitTree::diffTree(isset($commit->parent[0]) ? $commit->parent[0]->getTree() : null, $commit->getTree());
            foreach ($diffout as $file => $diff) {
                $difftree[] = $file;
            }
            $commitline = array();
            $commitline["cdmday"] = $cd['mday'];
            $commitline["cdmonth"] = $cd['month'];
            $commitline["cdhour"] = $cd['hour'];
            $commitline["cdminute"] = $cd['minute'];
            $commitline["title"] = $co['title'];
            $commitline["author"] = $co['author'];
            $commitline["cdrfc2822"] = $cd['rfc2822'];
            $commitline["commit"] = $commit;
            $commitline["comment"] = $co['comment'];
            $commitline["difftree"] = $difftree;
            $commitlines[] = $commitline;
        }
        $tpl->assign("commitlines", $commitlines);
    }
    $tpl->display('rss.tpl', $cachekey);
}
Example #16
0
function git_commit($projectroot, $project, $hash)
{
    global $tpl;
    $cachekey = sha1($project) . "|" . $hash;
    if (!$tpl->is_cached('commit.tpl', $cachekey)) {
        $co = git_read_commit($projectroot . $project, $hash);
        $ad = date_str($co['author_epoch'], $co['author_tz']);
        $cd = date_str($co['committer_epoch'], $co['committer_tz']);
        if (isset($co['parent'])) {
            $root = "";
            $parent = $co['parent'];
        } else {
            $root = "--root";
            $parent = "";
        }
        $diffout = git_diff_tree($projectroot . $project, $root . " " . $parent . " " . $hash, TRUE);
        $difftree = explode("\n", $diffout);
        $tpl->assign("hash", $hash);
        $tpl->assign("tree", $co['tree']);
        if (isset($co['parent'])) {
            $tpl->assign("parent", $co['parent']);
        }
        $tpl->assign("title", $co['title']);
        $refs = read_info_ref($projectroot . $project);
        if (isset($refs[$co['id']])) {
            $tpl->assign("commitref", $refs[$co['id']]);
        }
        $tpl->assign("author", $co['author']);
        $tpl->assign("adrfc2822", $ad['rfc2822']);
        $tpl->assign("adhourlocal", $ad['hour_local']);
        $tpl->assign("adminutelocal", $ad['minute_local']);
        $tpl->assign("adtzlocal", $ad['tz_local']);
        $tpl->assign("committer", $co['committer']);
        $tpl->assign("cdrfc2822", $cd['rfc2822']);
        $tpl->assign("cdhourlocal", $cd['hour_local']);
        $tpl->assign("cdminutelocal", $cd['minute_local']);
        $tpl->assign("cdtzlocal", $cd['tz_local']);
        $tpl->assign("id", $co['id']);
        $tpl->assign("repository", preg_replace('/^([a-zA-Z0-9\\-\\_]+).git$/', '$1', $project));
        $tpl->assign("parents", $co['parents']);
        $tpl->assign("comment", $co['comment']);
        $tpl->assign("difftreesize", count($difftree) + 1);
        $difftreelines = array();
        foreach ($difftree as $i => $line) {
            if (preg_match("/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)([0-9]{0,3})\t(.*)\$/", $line, $regs)) {
                $difftreeline = array();
                $difftreeline["from_mode"] = $regs[1];
                $difftreeline["to_mode"] = $regs[2];
                $difftreeline["from_mode_cut"] = substr($regs[1], -4);
                $difftreeline["to_mode_cut"] = substr($regs[2], -4);
                $difftreeline["from_id"] = $regs[3];
                $difftreeline["to_id"] = $regs[4];
                $difftreeline["status"] = $regs[5];
                $difftreeline["similarity"] = ltrim($regs[6], "0");
                $difftreeline["file"] = $regs[7];
                $difftreeline["from_file"] = strtok($regs[7], "\t");
                $difftreeline["from_filetype"] = file_type($regs[1]);
                $difftreeline["to_file"] = strtok("\t");
                $difftreeline["to_filetype"] = file_type($regs[2]);
                if ((octdec($regs[2]) & 0x8000) == 0x8000) {
                    $difftreeline["isreg"] = TRUE;
                }
                $modestr = "";
                if ((octdec($regs[1]) & 0x17000) != (octdec($regs[2]) & 0x17000)) {
                    $modestr .= " from " . file_type($regs[1]) . " to " . file_type($regs[2]);
                }
                if ((octdec($regs[1]) & 0777) != (octdec($regs[2]) & 0777)) {
                    if (octdec($regs[1]) & 0x8000 && octdec($regs[2]) & 0x8000) {
                        $modestr .= " mode: " . (octdec($regs[1]) & 0777) . "->" . (octdec($regs[2]) & 0777);
                    } else {
                        if (octdec($regs[2]) & 0x8000) {
                            $modestr .= " mode: " . (octdec($regs[2]) & 0777);
                        }
                    }
                }
                $difftreeline["modechange"] = $modestr;
                $simmodechg = "";
                if ($regs[1] != $regs[2]) {
                    $simmodechg .= ", mode: " . (octdec($regs[2]) & 0777);
                }
                $difftreeline["simmodechg"] = $simmodechg;
                $difftreelines[] = $difftreeline;
            }
        }
        $tpl->assign("difftreelines", $difftreelines);
    }
    $tpl->display('commit.tpl', $cachekey);
}
Example #17
0
function git_commit($projectroot, $project, $hash)
{
    global $tpl;
    $cachekey = sha1($project) . "|" . $hash;
    $git = new Git($projectroot . $project);
    $hash = $git->revParse($hash);
    if (!$tpl->is_cached('commit.tpl', $cachekey)) {
        $co = git_read_commit($git, $hash);
        $ad = date_str($co['author_epoch'], $co['author_tz']);
        $cd = date_str($co['committer_epoch'], $co['committer_tz']);
        if (isset($co['parent'])) {
            $a_tree = $git->getObject(sha1_bin($co['parent']))->getTree();
        } else {
            $a_tree = false;
        }
        $b_tree = $git->getObject(sha1_bin($co['tree']));
        $difftree = GitTree::diffTree($a_tree, $b_tree);
        ksort($difftree);
        $tpl->assign("hash", sha1_hex($hash));
        $tpl->assign("tree", $co['tree']);
        if (isset($co['parent'])) {
            $tpl->assign("parent", $co['parent']);
        }
        $tpl->assign("title", $co['title']);
        $refs = read_info_ref($git);
        if (isset($refs[$hash])) {
            $tpl->assign("commitref", $refs[$hash]);
        }
        $tpl->assign("author", $co['author']);
        $tpl->assign("adrfc2822", $ad['rfc2822']);
        $tpl->assign("adhourlocal", $ad['hour_local']);
        $tpl->assign("adminutelocal", $ad['minute_local']);
        $tpl->assign("adtzlocal", $ad['tz_local']);
        $tpl->assign("committer", $co['committer']);
        $tpl->assign("cdrfc2822", $cd['rfc2822']);
        $tpl->assign("cdhourlocal", $cd['hour_local']);
        $tpl->assign("cdminutelocal", $cd['minute_local']);
        $tpl->assign("cdtzlocal", $cd['tz_local']);
        $tpl->assign("id", $co['id']);
        $tpl->assign("parents", $co['parents']);
        $tpl->assign("comment", $co['comment']);
        $tpl->assign("difftreesize", count($difftree) + 1);
        $status_map = array(GitTree::TREEDIFF_ADDED => "A", GitTree::TREEDIFF_REMOVED => "D", GitTree::TREEDIFF_CHANGED => "M");
        $difftreelines = array();
        foreach ($difftree as $file => $diff) {
            $difftreeline = array();
            $difftreeline["from_mode"] = decoct($diff->old_mode);
            $difftreeline["to_mode"] = decoct($diff->new_mode);
            $difftreeline["from_mode_cut"] = substr(decoct($diff->old_mode), -4);
            $difftreeline["to_mode_cut"] = substr(decoct($diff->new_mode), -4);
            $difftreeline["from_id"] = sha1_hex($diff->old_obj);
            $difftreeline["to_id"] = sha1_hex($diff->new_obj);
            $difftreeline["status"] = $status_map[$diff->status];
            $difftreeline["similarity"] = "";
            $difftreeline["file"] = $file;
            $difftreeline["from_file"] = "";
            $difftreeline["from_filetype"] = "";
            $difftreeline["to_file"] = "";
            $difftreeline["to_filetype"] = "";
            $difftreeline["isreg"] = TRUE;
            $modestr = "";
            /*if ((octdec($regs[1]) & 0x17000) != (octdec($regs[2]) & 0x17000))
            			$modestr .= " from " . file_type($regs[1]) . " to " . file_type($regs[2]);
            		if ((octdec($regs[1]) & 0777) != (octdec($regs[2]) & 0777)) {
            			if ((octdec($regs[1]) & 0x8000) && (octdec($regs[2]) & 0x8000))
            				$modestr .= " mode: " . (octdec($regs[1]) & 0777) . "->" . (octdec($regs[2]) & 0777);
            			else if (octdec($regs[2]) & 0x8000)
            				$modestr .= " mode: " . (octdec($regs[2]) & 0777);*/
            $difftreeline["modechange"] = $modestr;
            $simmodechg = "";
            /*if ($regs[1] != $regs[2])
            		$simmodechg .= ", mode: " . (octdec($regs[2]) & 0777);*/
            $difftreeline["simmodechg"] = $simmodechg;
            $difftreelines[] = $difftreeline;
        }
        $tpl->assign("difftreelines", $difftreelines);
    }
    $tpl->display('commit.tpl', $cachekey);
}
Example #18
0
function show_form($updated)
{
    admin_page_head("Manage Applications");
    if ($updated) {
        echo "Updates were done.\n            <p>\n            <b>You must stop and restart the project\n            for these changes to take effect</b>.\n        ";
    }
    $self = $_SERVER['PHP_SELF'];
    echo "\n        <h2>Edit applications</h2>\n        <form action='{$self}' method='POST'>\n    ";
    start_table();
    table_header("ID", "Name and description<br><span class=note>Click for details</span>", "Created", "weight<br><a href=http://boinc.berkeley.edu/trac/wiki/BackendPrograms#feeder><span class=note>details</span></a>", "homogeneous redundancy type<br><a href=http://boinc.berkeley.edu/trac/wiki/HomogeneousRedundancy><span class=note>details</span></a>", "homogeneous app version?<br><a href=http://boinc.berkeley.edu/trac/wiki/HomogeneousAppVersion><span class=note>details</span></a>", "deprecated?", "Non-CPU-intensive?");
    $total_weight = mysql_query('SELECT SUM(weight) AS total_weight FROM app WHERE deprecated=0');
    $total_weight = mysql_fetch_assoc($total_weight);
    $total_weight = $total_weight['total_weight'];
    $q = "SELECT * FROM app ORDER BY id";
    $result = mysql_query($q);
    $Nrow = mysql_num_rows($result);
    for ($j = 1; $j <= $Nrow; $j++) {
        $item = mysql_fetch_object($result);
        $id = $item->id;
        // grey-out deprecated versions
        $f1 = $f2 = '';
        if ($item->deprecated == 1) {
            $f1 = "<font color='GREY'>";
            $f2 = "</font>";
        }
        echo "<tr> ";
        echo "  <TD align='center'>{$f1} {$id} {$f2}</TD>\n";
        $name = $item->name;
        $full_name = $item->user_friendly_name;
        echo "  <TD align='left'>{$f1}<a href=app_details.php?appid={$id}>{$name}</a><br> {$full_name} {$f2}</TD>\n";
        $time = $item->create_time;
        echo "  <TD align='center'>{$f1} " . date_str($time) . "{$f2}</TD>\n";
        $field = "weight_" . $id;
        $v = $item->weight;
        echo "  <TD align='center'>\n        <input type='text' size='4' name='{$field}' value='{$v}'></TD>\n";
        $field = "homogeneous_redundancy_" . $id;
        $v = $item->homogeneous_redundancy;
        echo "  <TD align='center'>\n            <input name='{$field}' value='{$v}'></TD>\n        ";
        $field = "homogeneous_app_version_" . $id;
        $v = '';
        if ($item->homogeneous_app_version) {
            $v = ' CHECKED ';
        }
        echo "  <TD align='center'>\n            <input name='{$field}' type='checkbox' {$v}></TD>\n        ";
        $field = "deprecated_" . $id;
        $v = '';
        if ($item->deprecated) {
            $v = ' CHECKED ';
        }
        echo "  <TD align='center'>\n            <input name='{$field}' type='checkbox' {$v}></TD>\n        ";
        $field = "non_cpu_intensive_" . $id;
        $v = '';
        if ($item->non_cpu_intensive) {
            $v = ' CHECKED ';
        }
        echo "  <TD align='center'>\n            <input name='{$field}' type='checkbox' {$v}></TD>\n        ";
        echo "</tr> ";
    }
    mysql_free_result($result);
    echo "<tr><td colspan=7></td><td><input type='submit' name='update' value='Update'></td></tr>";
    end_table();
    // Entry form to create a new application
    //
    echo "<P>\n         <h2>Add an application</h2>\n      To add an application enter the short name and description\n      ('user friendly name') below.  You can then edit the\n      application when it appears in the table above.\n     </p>\n";
    start_table("align='center' ");
    echo "<TR><TH>Name</TH>\n              <TH>Description</TH>\n              <TH> &nbsp;   </TH>\n          </TR>\n";
    echo "<TR>\n            <TD> <input type='text' size='12' name='add_name' value=''></TD>\n            <TD> <input type='text' size='35' name='add_user_friendly_name' value=''></TD>\n            <TD align='center' >\n                 <input type='submit' name='add_app' value='Add Application'></TD>\n            </TR>\n";
    end_table();
    echo "</form><p>\n";
    admin_page_tail();
}
Example #19
0
function show_snap_form($top_unit)
{
    global $course_id;
    $select_name = get_str('select_name');
    $xset_name = get_str('xset_name');
    admin_page_head("Data snapshot");
    $s = read_compare_snapshot($course_id, $select_name, $xset_name);
    if ($s) {
        $end = date_str($s->time);
        echo "\n\t\t\tA data snapshot exists for the {$s->dur} days prior to {$end}.\n\t\t";
        show_button("bolt_compare.php?action=compare&course_id={$course_id}&select_name={$select_name}&xset_name={$xset_name}", "Use this snapshot", "Use this snapshot");
    } else {
        echo "There is currently no snapshot.";
    }
    echo "\n\t\t<form action=bolt_compare.php>\n\t\t<input type=hidden name=action value=snap_action>\n\t\t<input type=hidden name=course_id value={$course_id}>\n\t\t<input type=hidden name=select_name value=\"{$select_name}\">\n\t\t<input type=hidden name=xset_name value=\"{$xset_name}\">\n\t\tCreate a new snapshot using data from the last\n\t\t<input name=dur value=7> days.\n\t\t<input type=submit value=OK>\n\t\t</form>\n\t";
    admin_page_tail();
}
Example #20
0
function show_simulation()
{
    $scen = get_str("scen");
    $sim = get_str("sim");
    $dir = "scenarios/{$scen}/simulations/{$sim}";
    if (!is_dir($dir)) {
        error_page("No such simulation");
    }
    page_head("Simulation {$sim}");
    start_table();
    $userid = (int) file_get_contents("{$dir}/userid");
    $user = BoincUser::lookup_id($userid);
    $date = date_str(filemtime($dir));
    row2("Scenario", "<a href=sim_web.php?action=show_scenario&name={$scen}>{$scen}</a>");
    row2("Who", $user->name);
    row2("When", $date);
    row2("Parameters", "<pre>" . file_get_contents("{$dir}/inputs.txt") . "</pre>");
    row2("Results", "<pre>" . file_get_contents("{$dir}/results.txt") . "</pre>");
    $x = file_get_contents("{$dir}/index.html");
    $x = str_replace("<h3>Output files</h3>", "", $x);
    $x = str_replace("href=", "href=scenarios/{$scen}/simulations/{$sim}/", $x);
    row2("Output files", $x);
    $x = get_comments($dir);
    if ($x) {
        row2("Comments", $x);
    }
    echo "<form action=sim_web.php>\n        <input type=hidden name=scen value={$scen}>\n        <input type=hidden name=sim value={$sim}>\n        <input type=hidden name=action value=add_comment>\n    ";
    row2("<input type=submit value=\"Add comment\">", "<textarea name=comment></textarea>");
    echo "</form>";
    end_table();
    page_tail();
}
$teamid = get_int("teamid");
$team = BoincTeam::lookup_id($teamid);
if (!$team) {
    error_page(tra("no such team"));
}
require_founder_login($user, $team);
page_head(tra("Change founder of %1", $team->name));
if ($team->ping_user != 0) {
    if ($team->ping_user < 0) {
        $ping_user = BoincUser::lookup_id(-$team->ping_user);
        $x = date_str($team->ping_time);
        echo "<p>" . tra("Team member %1 requested this team's foundership on %2, but left the team, thus canceling the request.", user_links($ping_user), $x) . "</p>";
        $team->update("ping_user=0, ping_time=0");
    } else {
        $ping_user = BoincUser::lookup_id($team->ping_user);
        $x = date_str(transfer_ok_time($team));
        echo "<p>" . tra("Team member %1 has requested this team's foundership. This may be because you left the team or haven't had contact with the team for a long time.", user_links($ping_user)) . "</p>";
        echo "<p>\n            <form method=\"post\" action=\"team_founder_transfer_action.php\">\n            <input type=\"hidden\" name=\"action\" value=\"decline\">\n            <input type=\"hidden\" name=\"teamid\" value=\"" . $team->id . "\">\n            <input type=\"submit\" value=\"" . tra("decline request") . "\">\n            </form>\n            <p>\n            " . tra("If you don't decline the request by %1, %2 will have the option of assuming team foundership.<br /><br />\n                  To accept the request, assign foundership to %3 using the form below.", $x, $ping_user->name, $ping_user->name) . "\n            </p>\n            <hr>\n            <p>\n        ";
    }
} else {
    echo tra("No transfer request is pending.") . "<br /><br />";
}
echo tra("To assign foundership of this team to another member, check the box next to member name and click <strong>Change founder</strong> below.") . "<form method=post action=team_change_founder_action.php>\n    <input type=hidden name=teamid value={$team->id}>";
echo form_tokens($user->authenticator);
start_table();
echo "<tr>\n    <th>" . tra("New founder?") . "</th>\n    <th>" . tra("Name") . "</th>\n    <th>" . tra("Total credit") . "</th>\n    <th>" . tra("Recent average credit") . "</th>\n    </tr>\n";
$users = BoincUser::enum("teamid={$team->id}");
$navailable_users = 0;
foreach ($users as $user) {
    if ($user->id != $team->userid) {
        //don't show current founder
    page_tail();
    exit;
}
if ($user->id == $team->ping_user) {
    echo "<p>" . tra("You requested the foundership of %1 on %2.", $team->name, date_str($team->ping_time)) . "\n    </p>";
    if (transfer_ok($team, $now)) {
        echo tra("60 days have elapsed since your request, and the founder has not responded. You may now assume foundership by clicking here:") . "<form method=\"post\" action=\"team_founder_transfer_action.php\">\n            <input type=\"hidden\" name=\"action\" value=\"finalize_transfer\">\n            <input class=\"btn btn-default\" type=\"submit\" value=\"" . tra("Assume foundership") . "\">\n            </form>\n        ";
    } else {
        echo "<p>" . tra("The founder was notified of your request. If he/she does not respond by %1 you will be given an option to become founder.", date_str(transfer_ok_time($team))) . "</p>";
    }
} else {
    if (new_transfer_request_ok($team, $now)) {
        echo "<form method=\"post\" action=\"team_founder_transfer_action.php\">";
        echo "<p>" . tra("If the team founder is not active and you want to assume the role of founder, click the button below. The current founder will be sent an email detailing your request, and will be able to transfer foundership to you or to decline your request. If the founder does not respond in 60 days, you will be allowed to become the founder.<br /><br />\n                       Are you sure you want to request foundership?") . "</p>";
        echo "<input type=\"hidden\" name=\"action\" value=\"initiate_transfer\">\n            <input class=\"btn btn-default\" type=\"submit\" value=\"" . tra("Request foundership") . "\">\n            </form>\n        ";
    } else {
        if ($team->ping_user) {
            if ($team->ping_user < 0) {
                $team->ping_user = -$team->ping_user;
            }
            $ping_user = BoincUser::lookup_id($team->ping_user);
            echo "<p>" . tra("Founder change has already been requested by %1 on %2.", user_links($ping_user), date_str($team->ping_time)) . "</p>";
        } else {
            echo "<p>" . tra("A foundership change was requested during the last 90 days, so new requests are not allowed. Please try again later.") . "</p>";
        }
    }
}
echo "<p><a href=\"team_display.php?teamid=" . $team->id . "\">" . tra("Return to team page") . "</a>";
page_tail();
$cvs_version_tracker[] = "\$Id\$";
//Generated automatically - do not edit
Example #23
0
function git_summary($projectroot, $project)
{
    global $tpl, $gitphp_conf;
    $cachekey = sha1($project);
    if (!$tpl->is_cached('project.tpl', $cachekey)) {
        $descr = git_project_descr($projectroot, $project);
        $head = git_read_head($projectroot . $project);
        $commit = git_read_commit($projectroot . $project, $head);
        $commitdate = date_str($commit['committer_epoch'], $commit['committer_tz']);
        $owner = git_project_owner($projectroot, $project);
        $refs = read_info_ref($projectroot . $project);
        $tpl->assign("head", $head);
        $tpl->assign("description", $descr);
        $tpl->assign("owner", $owner);
        $tpl->assign("lastchange", $commitdate['rfc2822']);
        if (isset($gitphp_conf['cloneurl'])) {
            $tpl->assign('cloneurl', $gitphp_conf['cloneurl'] . $project);
        }
        if (isset($gitphp_conf['pushurl'])) {
            $tpl->assign('pushurl', $gitphp_conf['pushurl'] . $project);
        }
        $revlist = git_read_revlist($projectroot . $project, $head, 17);
        foreach ($revlist as $i => $rev) {
            $revdata = array();
            $revco = git_read_commit($projectroot . $project, $rev);
            $authordate = date_str($revco['author_epoch']);
            $revdata["commit"] = $rev;
            if (isset($refs[$rev])) {
                $revdata["commitref"] = $refs[$rev];
            }
            $revdata["commitage"] = $revco['age_string'];
            $revdata["commitauthor"] = $revco['author_name'];
            if (strlen($revco['title_short']) < strlen($revco['title'])) {
                $revdata["title"] = $revco['title'];
                $revdata["title_short"] = $revco['title_short'];
            } else {
                $revdata["title_short"] = $revco['title'];
            }
            $revlist[$i] = $revdata;
        }
        $tpl->assign("revlist", $revlist);
        $taglist = git_read_refs($projectroot, $project, "refs/tags");
        if (isset($taglist) && count($taglist) > 0) {
            foreach ($taglist as $i => $tag) {
                if (isset($tag['comment'])) {
                    $com = trim($tag['comment'][0]);
                    if (strlen($com) > GITPHP_TRIM_LENGTH) {
                        $com = substr($trimmed, 0, GITPHP_TRIM_LENGTH) . "...";
                    }
                    $taglist[$i]['comment'] = $com;
                }
            }
            $tpl->assign("taglist", $taglist);
        }
        $headlist = git_read_refs($projectroot, $project, "refs/heads");
        if (isset($headlist) && count($headlist) > 0) {
            $tpl->assign("headlist", $headlist);
        }
    }
    $tpl->display('project.tpl', $cachekey);
}
function show_profile_link2($profile, $n)
{
    $user = BoincUser::lookup_id($profile->userid);
    echo "<tr><td>" . user_links($user) . "</td><td>" . date_str($user->create_time) . "</td><td>{$user->country}</td><td>" . (int) $user->total_credit . "</td><td>" . (int) $user->expavg_credit . "</td></tr>\n";
}
Example #25
0
function show_form()
{
    echo "\n        <h2>Edit applications</h2>\n    ";
    start_table();
    table_header("ID", "Name and description<br><p class=\"text-muted\">Click for details</p>", "Created", "weight<br><a href=https://boinc.berkeley.edu/trac/wiki/BackendPrograms#feeder><p class=\"text-muted\">details</p></a>", "shmem items", "HR type<br><a href=https://boinc.berkeley.edu/trac/wiki/HomogeneousRedundancy><p class=\"text-muted\">details</p></a>", "homogeneous app version?<br><a href=https://boinc.berkeley.edu/trac/wiki/HomogeneousAppVersion><p class=\"text-muted\">details</p></a>", "deprecated?", "Non-CPU-intensive?", "Beta?", "Exact fraction done?", "");
    $total_weight = BoincApp::sum("weight", "where deprecated=0");
    $swi = parse_config(get_config(), "<shmem_work_items>");
    if (!$swi) {
        $swi = 100;
    }
    $apps = BoincApp::enum("");
    $i = 0;
    foreach ($apps as $app) {
        // grey-out deprecated versions
        $f1 = $f2 = '';
        if ($app->deprecated == 1) {
            $f1 = "<font color='GREY'>";
            $f2 = "</font>";
        }
        echo "<tr class=row{$i}><form action=manage_apps.php method=POST>";
        $i = 1 - $i;
        echo "<input type=hidden name=id value={$app->id}>";
        echo "  <TD align='center'>{$f1} {$app->id} {$f2}</TD>\n";
        echo "  <TD align='left'>{$f1}<a href=app_details.php?appid={$app->id}>{$app->name}</a><br> {$app->user_friendly_name} {$f2}</TD>\n";
        echo "  <TD align='center'>{$f1} " . date_str($app->create_time) . "{$f2}</TD>\n";
        $v = $app->weight;
        echo "  <TD align='center'>\n        <input type='text' size='4' name='weight' value='{$v}'></TD>\n";
        if ($app->deprecated || $total_weight == 0) {
            echo '<td></td>';
        } else {
            echo '<td align="right">' . round($app->weight / $total_weight * $swi) . '</td>';
        }
        $v = $app->homogeneous_redundancy;
        echo "  <TD align='center'>\n            <input name='homogeneous_redundancy' value='{$v}'></TD>\n        ";
        $v = '';
        if ($app->homogeneous_app_version) {
            $v = ' CHECKED ';
        }
        echo "  <TD align='center'>\n            <input name='homogeneous_app_version' type='checkbox' {$v}></TD>\n        ";
        $v = '';
        if ($app->deprecated) {
            $v = ' CHECKED ';
        }
        echo "  <TD align='center'>\n            <input name='deprecated' type='checkbox' {$v}></TD>\n        ";
        $v = '';
        if ($app->non_cpu_intensive) {
            $v = ' CHECKED ';
        }
        echo "  <TD align='center'>\n            <input name='non_cpu_intensive' type='checkbox' {$v}></TD>\n        ";
        $v = '';
        if ($app->beta) {
            $v = ' CHECKED ';
        }
        echo "  <TD align='center'>\n            <input name='beta' type='checkbox' {$v}></TD>\n        ";
        $v = '';
        if ($app->fraction_done_exact) {
            $v = ' CHECKED ';
        }
        echo "  <TD align='center'>\n            <input name='fraction_done_exact' type='checkbox' {$v}></TD>\n        ";
        echo "<td><input class=\"btn btn-default\" type=submit name=submit value=Update>";
        echo "</tr></form>";
    }
    end_table();
    // Entry form to create a new application
    //
    echo "<P>\n        <h2>Add an application</h2>\n        To add an application enter the short name and description\n        ('user friendly name') below.  You can then edit the\n        application when it appears in the table above.\n        <p>\n        <form action=manage_apps.php method=POST>\n    ";
    start_table("align='center' ");
    table_header("Name", "Description", "&nbsp;");
    echo "<TR>\n            <TD> <input type='text' size='12' name='add_name' value=''></TD>\n            <TD> <input type='text' size='35' name='add_user_friendly_name' value=''></TD>\n            <TD align='center' >\n                 <input type='submit' name='add_app' value='Add Application'></TD>\n            </TR>\n";
    end_table();
    echo "</form><p>\n";
}
Example #26
0
require_once "../inc/bolt_util.inc";
page_head("Courses");
$user = get_logged_in_user(false);
if ($user) {
    BoltUser::lookup($user);
}
$courses = BoltCourse::enum();
start_table();
table_header("Course", "Status");
foreach ($courses as $course) {
    if ($course->hidden && !($user->bolt->flags & BOLT_FLAG_SHOW_ALL)) {
        continue;
    }
    $e = $user ? BoltEnrollment::lookup($user->id, $course->id) : null;
    if ($e) {
        $start = date_str($e->create_time);
        $view = BoltView::lookup_id($e->last_view_id);
        $ago = time_diff(time() - $view->start_time);
        $pct = number_format($view->fraction_done * 100, 0);
        $status = "Started {$start}\n            <br>Last visit: {$ago} ago\n            <br>{$pct}% done\n        ";
        if ($view->fraction_done < 1) {
            $status .= "<br><a href=bolt_sched.php?course_id={$course->id}&action=resume>Resume</a>\n            ";
        }
        $status .= "<br><a href=bolt_sched.php?course_id={$course->id}&action=start>Restart</a>\n            | <a href=bolt_course.php?course_id={$course->id}>History</a>\n        ";
    } else {
        $status = "\n            <a href=bolt_sched.php?course_id={$course->id}&action=start>Start</a>\n        ";
    }
    row2_init("<b>{$course->name}</b>\n        <br><span class=note>{$course->description}</span>", $status);
    show_refreshes();
    echo "</td></tr>\n";
}
    page_tail();
    exit;
}
if ($user->id == $team->ping_user) {
    echo "<p>You requested the foundership of {$team->name}\r\n\t\ton " . date_str($team->ping_time) . ".\r\n\t";
    if (transfer_ok($team, $now)) {
        echo "\r\n\t\t\t60 days have elapsed since your request,\r\n\t\t\tand the founder has not responded.\r\n\t\t\tYou may now assume foundership by clicking here:\r\n\t\t\t<form method=\"post\" action=\"team_founder_transfer_action.php\">\r\n\t\t\t<input type=\"hidden\" name=\"action\" value=\"finalize_transfer\">\r\n\t\t\t<input type=\"submit\" value=\"Assume foundership\">\r\n\t\t\t</form>\r\n\t\t";
    } else {
        echo "<p>\r\n\t\t\tThe founder was notified of your request.\r\n\t\t\tIf he/she does not respond by " . date_str(transfer_ok_time($team)) . "\r\n\t\t\tyou will be given an option to become founder.\r\n\t\t";
    }
} else {
    if (new_transfer_request_ok($team, $now)) {
        echo "<form method=\"post\" action=\"team_founder_transfer_action.php\">";
        echo "<p>If the team founder is not active and you want to assume\r\n\t\t\tthe role of founder, click the button below.\r\n\t\t\tThe current founder will be sent an email detailing your request,\r\n\t\t\tand will be able to transfer foundership to you\r\n\t\t\tor to decline your request.\r\n\t\t\tIf the founder does not respond in 60 days,\r\n\t\t\tyou will be allowed to become the founder.\r\n\t\t\t<p>\r\n\t\t\tAre you sure you want to request foundership?\r\n\t\t";
        echo "<input type=\"hidden\" name=\"action\" value=\"initiate_transfer\">\r\n\t\t\t<input type=\"submit\" value=\"Request foundership\">\r\n\t\t\t</form>\r\n\t\t";
    } else {
        if ($team->ping_user) {
            if ($team->ping_user < 0) {
                $team->ping_user = -$team->ping_user;
            }
            $ping_user = BoincUser::lookup_id($team->ping_user);
            echo "<p>Founder change has already been requested by " . user_links($ping_user) . " on " . date_str($team->ping_time) . ".\r\n\t\t\t";
        } else {
            echo "<p>A foundership change was requested during the last 90 days,\r\n\t\t\t\t so new requests are not allowed.\r\n\t\t\t\t Please try again later.\r\n\t\t\t";
        }
    }
}
echo "<p><a href=\"team_display.php?teamid=" . $team->id . "\">Return to team page</a>";
page_tail();
$cvs_version_tracker[] = "\$Id: team_founder_transfer_form.php 15992 2008-09-12 20:23:41Z boincadm \$";
//Generated automatically - do not edit