Beispiel #1
0
    $filenamea = $a['filename'];
    $filenameb = $b['filename'];
    return $filenamea > $filenameb ? 1 : 0;
}
$directoryarray = array();
$updatearray1 = array();
// Create an array so we can sort it
while ($file_array = pdo_fetch_array($updatedfiles)) {
    $file = array();
    $file['filename'] = $file_array["filename"];
    $file['author'] = $file_array["author"];
    $file['status'] = $file_array["status"];
    // Only display email if the user is logged in
    if (isset($_SESSION['cdash'])) {
        if ($file_array['email'] == '') {
            $file['email'] = get_author_email($projectname, $file['author']);
        } else {
            $file['email'] = $file_array['email'];
        }
    } else {
        $file['email'] = "";
    }
    $file['log'] = $file_array["log"];
    $file['revision'] = $file_array["revision"];
    $updatearray1[] = $file;
    $directoryarray[] = substr($file_array["filename"], 0, strrpos($file_array["filename"], "/"));
}
$directoryarray = array_unique($directoryarray);
usort($directoryarray, "sort_array_by_directory");
usort($updatearray1, "sort_array_by_filename");
$updatearray = array();
Beispiel #2
0
function get_updates_xml_from_commits($projectname, $projectid, $dates, $commits)
{
    $xml = "<updates>\n";
    $xml .= "<timestamp>" . date(FMT_DATETIMETZ, $dates['nightly-0']) . "</timestamp>";
    // Get revision numbers for the current day and "the last time it ran before that..."
    // Only works if the LIMIT 2 query below returns exactly 2 records and the date from
    // the most recent record matches the current 'nightly-0' date... If those criteria
    // are not met, the revision strings will be empty and no revision information will
    // be displayed on the resulting web page.
    //
    $revision_current = '';
    $revision_prior = '';
    $qry = "SELECT date, revision FROM dailyupdate " . "WHERE projectid='{$projectid}' " . "  AND date <= '" . gmdate(FMT_DATE, $dates['nightly-0']) . "' " . "ORDER BY date DESC LIMIT 2";
    $rows = pdo_all_rows_query($qry);
    if (count($rows) == 2) {
        if ($rows[0]['date'] == gmdate(FMT_DATE, $dates['nightly-0'])) {
            $revision_current = $rows[0]['revision'];
            $revision_prior = $rows[1]['revision'];
        }
    }
    $xml .= add_XML_value("revision", $revision_current);
    $xml .= add_XML_value("priorrevision", $revision_prior);
    $xml .= add_XML_value("revisionurl", get_revision_url($projectid, $revision_current, $revision_prior));
    $xml .= add_XML_value("revisiondiff", get_revision_url($projectid, $revision_prior, ''));
    // no prior prior revision...
    $xml .= "<javascript>\n";
    // Args to dbAdd : "true" means directory, "false" means file
    //
    $xml .= "dbAdd(true, \"Updated files  (" . count($commits) . ")\", \"\", 0, \"\", \"1\", \"\", \"\", \"\", \"\", \"\")\n";
    $previousdir = "";
    usort($commits, "sort_by_directory_file_time");
    $projecturl = get_project_property($projectname, "cvsurl");
    foreach ($commits as $commit) {
        $directory = $commit['directory'];
        if ($directory != $previousdir) {
            $xml .= "dbAdd(true, \"" . $directory . "\", \"\", 1, \"\", \"1\", \"\", \"\", \"\", \"\", \"\")\n";
            $previousdir = $directory;
        }
        $filename = $commit['filename'];
        $revision = '';
        if ($commit['priorrevision'] != "-1") {
            $revision = $commit['revision'];
        }
        $time = gmdate(FMT_DATETIME, strtotime($commit['time']));
        $author = $commit['author'];
        // Only display email if the user is logged in
        if (isset($_SESSION['cdash'])) {
            if (isset($commit['email'])) {
                $email = $commit['email'];
            } else {
                $email = get_author_email($projectname, $author);
            }
        } else {
            // If the author is an email (git for instance) we remove everything after the @
            $posat = strpos($author, '@');
            if ($posat !== false) {
                $author = substr($author, 0, $posat);
            }
            $email = "";
        }
        $comment = $commit['comment'];
        $comment = str_replace("\n", " ", $comment);
        // Do this twice so that <something> ends up as
        // &amp;lt;something&amp;gt; because it gets sent to a
        // java script function not just displayed as html
        $comment = XMLStrFormat($comment);
        $comment = XMLStrFormat($comment);
        $diff_url = get_diff_url(get_project_id($projectname), $projecturl, $directory, $filename, $revision);
        $diff_url = XMLStrFormat($diff_url);
        $xml .= "dbAdd(false, \"" . $filename . "  Revision: " . $revision . "\",\"" . $diff_url . "\",2,\"\",\"1\",\"" . $author . "\",\"" . $email . "\",\"" . $comment . "\",\"" . $commit['bugurl'] . "\",\"" . $commit['bugid'] . "\",\"" . $commit['bugpos'] . "\")\n";
    }
    $xml .= "</javascript>\n";
    $xml .= "</updates>";
    return $xml;
}
Beispiel #3
0
function author_email($atts)
{
    global $thisarticle;
    assert_article();
    extract(lAtts(array('escape' => 'html', 'link' => ''), $atts));
    $author_email = get_author_email($thisarticle['authorid']);
    $display_email = $escape == 'html' ? txpspecialchars($author_email) : $author_email;
    return $link ? email(array('email' => $author_email, 'linktext' => $display_email)) : $display_email;
}
Beispiel #4
0
function author_email($atts)
{
    global $thisarticle, $thisauthor;
    extract(lAtts(array('escape' => 'html', 'link' => ''), $atts));
    if ($thisauthor) {
        $email = get_author_email($thisauthor['name']);
    } else {
        assert_article();
        $email = get_author_email($thisarticle['authorid']);
    }
    if ($escape == 'html') {
        $display_email = txpspecialchars($email);
    } else {
        $display_email = $email;
    }
    if ($link) {
        return email(array('email' => $email, 'linktext' => $display_email));
    }
    return $display_email;
}