// load the suggestions $suggestions = load_wordcheck_events($projectid, $timeCutoff); if (!is_array($suggestions)) { $messages[] = sprintf(_("Unable to load suggestions: %s"), $suggestions); } // parse the suggestions complex array // it was pulled in the raw format $word_suggestions = array(); foreach ($suggestions as $suggestion) { list($time, $round, $page, $proofer, $words) = $suggestion; if (in_array($word, $words)) { array_push($word_suggestions, $suggestion); } } slim_header(_("Suggestion Detail")); $project_name = get_project_name($projectid); echo "<h2>", sprintf(_("Suggestion context for '%1\$s' in %2\$s"), $word, $project_name), "</h2>"; echo_word_freq_style(); echo "<p>"; echo "<a href='show_word_context.php?projectid={$projectid}&word={$encWord}' target='_PARENT'>" . _("Show full context set for this word") . "</a>"; echo " | "; echo "<a target='_PARENT' href='" . attr_safe($_SERVER['PHP_SELF']) . "?projectid={$projectid}&word={$encWord}&timeCutoff={$timeCutoff}&"; if ($layout == LAYOUT_HORIZ) { echo "layout=" . LAYOUT_VERT . "'>" . _("Change to vertical layout"); } else { echo "layout=" . LAYOUT_HORIZ . "'>" . _("Change to horizontal layout"); } echo "</a>"; echo "</p>"; foreach ($word_suggestions as $suggestion) { list($time, $round, $page, $proofer, $words) = $suggestion;
$Project = new Project(); $role = 0; if ($projectid) { $project = pdo_query("SELECT name FROM project WHERE id='{$projectid}'"); if (pdo_num_rows($project) > 0) { $project_array = pdo_fetch_array($project); $projectname = $project_array["name"]; } $Project->Id = $projectid; $role = $Project->GetUserRole($userid); } else { $projectname = 'Global'; } $xml = begin_XML_for_XSLT(); $xml .= "<title>Feed - " . $projectname . "</title>"; $xml .= get_cdash_dashboard_xml(get_project_name($projectid), $date); $sql = ''; if ($date) { $sql = "AND date>'" . $date . "'"; } // Get the errors $query = pdo_query("SELECT * FROM feed WHERE projectid=" . qnum($projectid) . " ORDER BY id DESC"); while ($query_array = pdo_fetch_array($query)) { $xml .= "<feeditem>"; $xml .= add_XML_value("date", $query_array["date"]); $xml .= add_XML_value("buildid", $query_array["buildid"]); $xml .= add_XML_value("type", $query_array["type"]); $xml .= add_XML_value("description", $query_array["description"]); $xml .= "</feeditem>"; } $xml .= add_XML_value("admin", $User->IsAdmin());
header("HTTP/1.0 404 Not Found"); exit; } pmx_require_header("Item List"); pmx_require_nav(".nav-left-proj"); $id = isset($_GET['id']) ? intval($_GET['id']) : ""; if (!is_item_exist($id)) { die("Error : Project id is invalid."); } $items = get_item_list($id); ?> <div class="main"> <div class="top-bar"> <div class="top-bar-title"> <?php echo esc_html(get_project_name($id)); ?> </div> </div> <div class="main-item-projs-items-bar"> <div class="pagination"> <span><small><?php echo esc_html(get_item_page_item_range()); ?> , Total <?php echo esc_html(get_item_num($id)); ?> </small></span> <a type="button" class="btn btn-default btn-xs btn-page" href="<?php echo get_item_prevpageurl();
/** Main function to parse the incoming xml from ctest */ function ctest_parse($filehandler, $projectid, $expected_md5 = '', $do_checksum = true, $scheduleid = 0) { include 'config/config.php'; require_once 'include/common.php'; require_once 'models/project.php'; include 'include/version.php'; global $CDASH_USE_LOCAL_DIRECTORY; if ($CDASH_USE_LOCAL_DIRECTORY && file_exists('local/ctestparser.php')) { require_once 'local/ctestparser.php'; $localParser = new LocalParser(); $localParser->SetProjectId($projectid); $localParser->BufferSizeMB = 8192 / (1024 * 1024); } // Check if this is a new style PUT submission. if (parse_put_submission($filehandler, $projectid, $expected_md5)) { return true; } $content = fread($filehandler, 8192); $handler = null; $parser = xml_parser_create(); $file = ''; if (preg_match('/<Update/', $content)) { // Should be first otherwise confused with Build $handler = new UpdateHandler($projectid, $scheduleid); $file = 'Update'; } elseif (preg_match('/<Build/', $content)) { $handler = new BuildHandler($projectid, $scheduleid); $file = 'Build'; } elseif (preg_match('/<Configure/', $content)) { $handler = new ConfigureHandler($projectid, $scheduleid); $file = 'Configure'; } elseif (preg_match('/<Testing/', $content)) { $handler = new TestingHandler($projectid, $scheduleid); $file = 'Test'; } elseif (preg_match('/<CoverageLog/', $content)) { // Should be before coverage $handler = new CoverageLogHandler($projectid, $scheduleid); $file = 'CoverageLog'; } elseif (preg_match('/<Coverage/', $content)) { $handler = new CoverageHandler($projectid, $scheduleid); $file = 'Coverage'; } elseif (preg_match('/<report/', $content)) { $handler = new CoverageJUnitHandler($projectid, $scheduleid); $file = 'Coverage'; } elseif (preg_match('/<Notes/', $content)) { $handler = new NoteHandler($projectid, $scheduleid); $file = 'Notes'; } elseif (preg_match('/<DynamicAnalysis/', $content)) { $handler = new DynamicAnalysisHandler($projectid, $scheduleid); $file = 'DynamicAnalysis'; } elseif (preg_match('/<Project/', $content)) { $handler = new ProjectHandler($projectid, $scheduleid); $file = 'Project'; } elseif (preg_match('/<Upload/', $content)) { $handler = new UploadHandler($projectid, $scheduleid); $file = 'Upload'; } elseif (preg_match('/<test-results/', $content)) { $handler = new TestingNUnitHandler($projectid, $scheduleid); $file = 'Test'; } elseif (preg_match('/<testsuite/', $content)) { $handler = new TestingJUnitHandler($projectid, $scheduleid); $file = 'Test'; } // Try to get the IP of the build global $CDASH_REMOTE_ADDR; $ip = $CDASH_REMOTE_ADDR ? $CDASH_REMOTE_ADDR : $_SERVER['REMOTE_ADDR']; if ($handler == null) { echo 'no handler found'; add_log('error: could not create handler based on xml content', 'ctest_parse', LOG_ERR); $Project = new Project(); $Project->Id = $projectid; $Project->SendEmailToAdmin('Cannot create handler based on XML content', 'An XML submission from ' . $ip . ' to the project ' . get_project_name($projectid) . ' cannot be parsed. The content of the file is as follow: ' . $content); return false; } xml_set_element_handler($parser, array($handler, 'startElement'), array($handler, 'endElement')); xml_set_character_data_handler($parser, array($handler, 'text')); xml_parse($parser, $content, false); $projectname = get_project_name($projectid); $sitename = ''; $buildname = ''; $stamp = ''; if ($file != 'Project') { // projects don't have some of these fields. $sitename = $handler->getSiteName(); $buildname = $handler->getBuildName(); $stamp = $handler->getBuildStamp(); } // Check if the build is in the block list $query = pdo_query('SELECT id FROM blockbuild WHERE projectid=' . qnum($projectid) . "\n AND (buildname='' OR buildname='" . $buildname . "')\n AND (sitename='' OR sitename='" . $sitename . "')\n AND (ipaddress='' OR ipaddress='" . $ip . "')"); if (pdo_num_rows($query) > 0) { echo 'The submission is banned from this CDash server.'; add_log('Submission is banned from this CDash server', 'ctestparser'); return false; } // If backups are disabled, switch the filename to that of the existing handle // Otherwise, create a backup file and process from that global $CDASH_BACKUP_TIMEFRAME; if ($CDASH_BACKUP_TIMEFRAME == '0') { $meta_data = stream_get_meta_data($filehandler); $filename = $meta_data['uri']; } else { $filename = writeBackupFile($filehandler, $content, $projectname, $buildname, $sitename, $stamp, $file . '.xml'); if ($filename === false) { return $handler; } } $statusarray = array(); $statusarray['status'] = 'OK'; $statusarray['message'] = ''; if ($do_checksum == true) { $md5sum = md5_file($filename); $md5error = false; if ($expected_md5 == '' || $expected_md5 == $md5sum) { $statusarray['status'] = 'OK'; } else { $statusarray['status'] = 'ERROR'; $statusarray['message'] = 'Checksum failed for file. Expected ' . $expected_md5 . ' but got ' . $md5sum; $md5error = true; } $statusarray['md5'] = $md5sum; if ($md5error) { displayReturnStatus($statusarray); add_log("Checksum failure on file: {$filename}", 'ctest_parse', LOG_ERR, $projectid); return false; } } $parsingerror = ''; if ($CDASH_USE_LOCAL_DIRECTORY && file_exists('local/ctestparser.php')) { $parsingerror = $localParser->StartParsing(); if ($parsingerror != '') { $statusarray['status'] = 'ERROR'; $statusarray['message'] = $parsingerror; displayReturnStatus($statusarray); exit; } } if (!($parseHandle = fopen($filename, 'r'))) { $statusarray['status'] = 'ERROR'; $statusarray['message'] = "ERROR: Cannot open file ({$filename})"; displayReturnStatus($statusarray); add_log("Cannot open file ({$filename})", 'parse_xml_file', LOG_ERR); return $handler; } //burn the first 8192 since we have already parsed it $content = fread($parseHandle, 8192); while (!feof($parseHandle)) { $content = fread($parseHandle, 8192); if ($CDASH_USE_LOCAL_DIRECTORY && file_exists('local/ctestparser.php')) { $parsingerror = $localParser->ParseFile(); if ($parsingerror != '') { $statusarray['status'] = 'ERROR'; $statusarray['message'] = $parsingerror; displayReturnStatus($statusarray); exit; } } xml_parse($parser, $content, false); } xml_parse($parser, null, true); xml_parser_free($parser); fclose($parseHandle); unset($parseHandle); if ($CDASH_USE_LOCAL_DIRECTORY && file_exists('local/ctestparser.php')) { $parsingerror = $localParser->EndParsingFile(); } check_for_immediate_deletion($filename); displayReturnStatus($statusarray); return $handler; }
/** Send an email to administrator of the project for users who are not registered */ function sendEmailUnregisteredUsers($projectid, $cvsauthors) { include "cdash/config.php"; require_once "models/userproject.php"; include_once "cdash/common.php"; $unregisteredusers = array(); foreach ($cvsauthors as $author) { if ($author == "Local User") { continue; } $UserProject = new UserProject(); $UserProject->RepositoryCredential = $author; $UserProject->ProjectId = $projectid; if (!$UserProject->FillFromRepositoryCredential()) { $unregisteredusers[] = $author; } } // Send the email if any if (count($unregisteredusers) > 0) { // Find the project administrators $email = ""; $emails = pdo_query("SELECT email FROM " . qid("user") . ",user2project WHERE " . qid("user") . ".id=user2project.userid\n AND user2project.projectid=" . qnum($projectid) . " AND user2project.role='2'"); while ($emails_array = pdo_fetch_array($emails)) { if ($email != "") { $email .= ", "; } $email .= $emails_array["email"]; } // Send the email if ($email != "") { $projectname = get_project_name($projectid); $serverName = $CDASH_SERVER_NAME; if (strlen($serverName) == 0) { $serverName = $_SERVER['SERVER_NAME']; } $title = "CDash [" . $projectname . "] - Unregistered users"; $body = "The following users are checking in code but are not registered for the project " . $projectname . ":\n"; foreach ($unregisteredusers as $unreg) { $body .= "* " . $unreg . "\n"; } $body .= "\n You should register these users to your project. They are currently not receiving any emails from CDash.\n"; $body .= "\n-CDash on " . $serverName . "\n"; add_log($title . " : " . $body . " : " . $email, "sendEmailUnregisteredUsers"); if (cdashmail("{$email}", $title, $body, "From: CDash <" . $CDASH_EMAIL_FROM . ">\nReply-To: " . $CDASH_EMAIL_REPLY . "\nContent-type: text/plain; charset=utf-8\nX-Mailer: PHP/" . phpversion() . "\nMIME-Version: 1.0")) { add_log("email sent to: " . $email, "sendEmailUnregisteredUsers"); return; } else { add_log("cannot send email to: " . $email, "sendEmailUnregisteredUsers"); } } } // end count() }
/** Send an email to administrator of the project for users who are not registered */ function sendEmailUnregisteredUsers($projectid, $cvsauthors) { include 'config/config.php'; require_once 'models/userproject.php'; include_once 'include/common.php'; $unregisteredusers = array(); foreach ($cvsauthors as $author) { if ($author == 'Local User') { continue; } $UserProject = new UserProject(); $UserProject->RepositoryCredential = $author; $UserProject->ProjectId = $projectid; if (!$UserProject->FillFromRepositoryCredential()) { $unregisteredusers[] = $author; } } // Send the email if any if (count($unregisteredusers) > 0) { // Find the project administrators $email = ''; $emails = pdo_query('SELECT email FROM ' . qid('user') . ',user2project WHERE ' . qid('user') . '.id=user2project.userid AND user2project.projectid=' . qnum($projectid) . " AND user2project.role='2'"); while ($emails_array = pdo_fetch_array($emails)) { if ($email != '') { $email .= ', '; } $email .= $emails_array['email']; } // Send the email if ($email != '') { $projectname = get_project_name($projectid); $serverName = $CDASH_SERVER_NAME; if (strlen($serverName) == 0) { $serverName = $_SERVER['SERVER_NAME']; } $title = 'CDash [' . $projectname . '] - Unregistered users'; $body = 'The following users are checking in code but are not registered for the project ' . $projectname . ":\n"; foreach ($unregisteredusers as $unreg) { $body .= '* ' . $unreg . "\n"; } $body .= "\n You should register these users to your project. They are currently not receiving any emails from CDash.\n"; $body .= "\n-CDash on " . $serverName . "\n"; add_log($title . ' : ' . $body . ' : ' . $email, 'sendEmailUnregisteredUsers'); if (cdashmail("{$email}", $title, $body)) { add_log('email sent to: ' . $email, 'sendEmailUnregisteredUsers'); return; } else { add_log('cannot send email to: ' . $email, 'sendEmailUnregisteredUsers'); } } } }
<a href="#" title="<?php echo $hostList_item["title"] != "" ? esc_html($hostList_item["title"]) : "unknow"; ?> "><span class="label label-info">T : <?php echo $hostList_item["title"] != "" ? esc_html(mb_substr($hostList_item["title"], 0, 10, "utf-8")) . "..." : "unknow"; ?> </span></a> <a href="#" title="<?php echo esc_html(get_project_name($hostList_item["pid"])); ?> "><span class="label label-info">P : <?php echo esc_html(mb_substr(get_project_name($hostList_item["pid"]), 0, 10, "utf-8") . "..."); ?> </span></a> </div> <div class="main-item-footer pull-left"> <div class="main-item-host-mark"> <a href="#"><span class="host-device-<?php echo $hostList_item["device"] != "" ? esc_html($hostList_item["device"]) : "unknow"; ?> "></span></a> <a href="#"><span class="host-system-<?php echo esc_html(host_get_system($hostList_item["HTTP_USER_AGENT"])); ?> "></span></a>
lines: { show: true }, points: { show: true }, xaxis: { mode: "time" }, grid: {backgroundColor: "#fffaff", clickable: true, hoverable: true, hoverFill: '#444', hoverRadius: 4}, selection: { mode: "x" }, colors: ["#0000FF", "#dba255", "#919733"] }; $("#grapholder").bind("selected", function (event, area) { plot = $.plot($("#grapholder"), [{label: "Number of changed files", data: d1}], $.extend(true, {}, options, {xaxis: { min: area.x1, max: area.x2 }})); }); $("#grapholder").bind("plotclick", function (e, pos, item) { if (item) { plot.highlight(item.series, item.datapoint); date = dates[item.datapoint[0]]; window.location = "viewChanges.php?project=<?php echo get_project_name($projectid); ?> &date="+date; } }); plot = $.plot($("#grapholder"), [{label: "Number of changed files", data: d1}],options); }); </script>
echo '<table width="90%"' . ">\n"; if (!isset($_GET['project_id'])) { echo '<tr><td colspan="2" align="center" class="naglowek">Wybierz projekt<hr></td></tr>' . "\n"; $active_projects = get_active_projects(); echo '<tr><td width="50%">'; show_select_project_form($active_projects, 'Projekty aktywne'); echo '</td><td width=50%">'; $inactive_projects = array_diff(get_projects(), $active_projects); show_select_project_form($inactive_projects, 'Projekty nieaktywne'); echo '</td></tr></table>' . "\n"; display_document_footer(); exit; } $show_orgs = isset($_GET['show_orgs']) ? $_GET['show_orgs'] : 0; $show_contacts = isset($_GET['show_contacts']) ? $_GET['show_contacts'] : 0; echo '<tr><td align="center" class="naglowek">Dane projektu <i>' . htmlspecialchars(get_project_name($_GET['project_id'])) . '</i>'; if (is_admin()) { echo ' [<a href="../admin/edit_project_form.php?project_id=' . $_GET['project_id'] . '" class="menu">Edytuj</a>]'; } echo "<hr></td></tr>\n"; ?> <tr><td align="center"> <table border="1" cellpadding="4" cellspacing="0" bgcolor="#eeeeee"> <tr> <th rowspan="3" align="center" valign="center">U¿ytkownik</th> <th colspan="3" align="center">Organizacje</th> <th colspan="3" align="center">Kontakty</th> </tr> <tr> <th rowspan="2" align="center">Przyznane</th> <th colspan="2" align="center">Skontaktowane?</th>
} $testtime = pdo_query('SELECT projectid, build.name AS buildname, build.type AS buildtype, SUM(' . $timediff . ') AS elapsed FROM build, buildupdate, build2update WHERE build.submittime > ' . $timestampadd . "\n AND build2update.buildid = build.id\n AND buildupdate.id = build2update.updateid\n AND build.siteid = '{$siteid}'\n GROUP BY projectid,buildname,buildtype\n ORDER BY elapsed\n "); $xml .= '<siteload>'; echo pdo_error(); $totalload = 0; while ($testtime_array = pdo_fetch_array($testtime)) { $projectid = $testtime_array['projectid']; if (checkUserPolicy(@$_SESSION['cdash']['loginid'], $projectid, 1)) { $timespent = round($testtime_array['elapsed'] / 7.0); // average over 7 days $xml .= '<build>'; $xml .= add_XML_value('name', $testtime_array['buildname']); $xml .= add_XML_value('project', get_project_name($projectid)); $xml .= add_XML_value('type', $testtime_array['buildtype']); $xml .= add_XML_value('time', $timespent); $totalload += $timespent; $xml .= '</build>'; } } // Compute the idle time $idletime = 24 * 3600 - $totalload; if ($idletime < 0) { $idletime = 0; } $xml .= '<idle>' . $idletime . '</idle>'; $xml .= '</siteload>'; if (isset($_SESSION['cdash'])) { $xml .= '<user>';
"> $ <?php echo $res->amount; ?> </td> <td class="<?php echo $class1; ?> "><?php echo get_datetime($res->transaction_time); ?> </td> <td class="<?php echo $class1; ?> "><?php $project_name = get_project_name($res->project_id); if (isset($project_name)) { echo $project_name; } ?> </td> <td class="<?php echo $class1; ?> "><?php echo $res->status; ?> <?php if ($res->status == 'Pending') { ?>
function display_link_to_project($project_id, $status = 1) { echo '<a href="' . get_www_root() . 'show/show_project.php?project_id=' . $project_id . '&show_orgs=0&show_contacts=0" class="' . ($status == 0 ? 'closed_project' : 'menu') . '">' . htmlspecialchars(get_project_name($project_id)) . '</a>'; }
} if (isset($_POST['project_name'])) { $project_name = stripslashes($_POST['project_name']); } else { $project_name = get_project_name($project_id); } display_html_header(); display_document_header(); display_menu(); if (!is_admin()) { display_no_auth(); display_document_footer(); exit; } echo '<table width="90%">'; echo '<tr><td align="center" class="naglowek">Edytuj dane projektu <i>' . htmlspecialchars(get_project_name($project_id)) . "</i><hr></td></tr>\n"; if (isset($_POST['ocp_id'])) { $ocp_id = $_POST['ocp_id']; } else { $ocp_id = get_project_ocp($project_id); } ?> <form action="edit_project.php" method="POST"> <input type="hidden" name="project_id" value="<?php echo $project_id; ?> "> <tr> <td><table> <tr> <td align="right">Nazwa projektu:</td>
echo '<input type="hidden" name="' . $name . '[' . $arr_k . '] value="' . $arr_v . '">' . "\n"; } } else { echo '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars(stripslashes($value)) . '">' . "\n"; } } } echo '<input type="hidden" name="new_orgs" value="' . htmlspecialchars(stripslashes(join("\n", $new_orgs))) . '">' . "\n"; echo '<input type="hidden" name="project_new_orgs" value="' . htmlspecialchars(stripslashes(join("\n", $project_new_orgs))) . '">' . "\n"; echo '<input type="hidden" name="confirmed" value="yes">' . "\n"; echo '<input type="submit" value="Zatwierd¼">' . "\n"; echo "</form></td></tr></table>\n"; echo "</td></tr></table>\n"; display_document_footer(); } else { if (stripslashes($_POST['project_name']) !== get_project_name($_POST['project_id']) && !change_project_name($_POST['project_id'], $_POST['project_name'])) { display_warning('Zmiana nazwy projektu zakoñczona niepowodzeniem!'); exit; } if ($_POST['ocp_id'] !== get_project_ocp($_POST['project_id']) && !change_project_ocp($_POST['project_id'], $_POST['ocp_id'])) { display_warning('Zmiana OCPa zakoñczona niepowodzeniem!'); exit; } if (isset($_POST['del_orgs']) && !delete_orgs_from_project(array_keys($_POST['del_orgs']), $_POST['project_id'])) { display_warning('Usuniêcie organizacji zakoñczone niepowodzeniem!'); exit; } if (isset($_POST['new_orgs'])) { $new_orgs = str_replace("\r", '', $_POST['new_orgs']); $new_orgs = explode("\n", $new_orgs); if (!empty($new_orgs[0])) {
/** Main function to parse the incoming xml from ctest */ function ctest_parse($filehandler, $projectid, $expected_md5 = '', $do_checksum = true, $scheduleid = 0) { include 'cdash/config.php'; require_once 'cdash/common.php'; require_once 'models/project.php'; include 'cdash/version.php'; if ($CDASH_USE_LOCAL_DIRECTORY && file_exists("local/ctestparser.php")) { require_once "local/ctestparser.php"; $localParser = new LocalParser(); $localParser->SetProjectId($projectid); $localParser->BufferSizeMB = 8192 / (1024 * 1024); } // Check if this is a new style PUT submission. if (parse_put_submission($filehandler, $projectid, $expected_md5)) { return true; } $content = fread($filehandler, 8192); $handler = null; $parser = xml_parser_create(); $file = ""; if (preg_match('/<Update/', $content)) { $handler = new UpdateHandler($projectid, $scheduleid); $file = "Update"; } else { if (preg_match('/<Build/', $content)) { $handler = new BuildHandler($projectid, $scheduleid); $file = "Build"; } else { if (preg_match('/<Configure/', $content)) { $handler = new ConfigureHandler($projectid, $scheduleid); $file = "Configure"; } else { if (preg_match('/<Testing/', $content)) { $handler = new TestingHandler($projectid, $scheduleid); $file = "Test"; } else { if (preg_match('/<CoverageLog/', $content)) { $handler = new CoverageLogHandler($projectid, $scheduleid); $file = "CoverageLog"; } else { if (preg_match('/<Coverage/', $content)) { $handler = new CoverageHandler($projectid, $scheduleid); $file = "Coverage"; } else { if (preg_match('/<report/', $content)) { $handler = new CoverageJUnitHandler($projectid, $scheduleid); $file = "Coverage"; } else { if (preg_match('/<Notes/', $content)) { $handler = new NoteHandler($projectid, $scheduleid); $file = "Notes"; } else { if (preg_match('/<DynamicAnalysis/', $content)) { $handler = new DynamicAnalysisHandler($projectid, $scheduleid); $file = "DynamicAnalysis"; } else { if (preg_match('/<Project/', $content)) { $handler = new ProjectHandler($projectid, $scheduleid); $file = "Project"; } else { if (preg_match('/<Upload/', $content)) { $handler = new UploadHandler($projectid, $scheduleid); $file = "Upload"; } else { if (preg_match('/<test-results/', $content)) { $handler = new TestingNUnitHandler($projectid, $scheduleid); $file = "Test"; } else { if (preg_match('/<testsuite/', $content)) { $handler = new TestingJUnitHandler($projectid, $scheduleid); $file = "Test"; } } } } } } } } } } } } } if ($handler == NULL) { echo "no handler found"; add_log('error: could not create handler based on xml content', 'ctest_parse', LOG_ERR); $Project = new Project(); $Project->Id = $projectid; // Try to get the IP of the build $ip = $_SERVER['REMOTE_ADDR']; $Project->SendEmailToAdmin('Cannot create handler based on XML content', 'An XML submission from ' . $ip . ' to the project ' . get_project_name($projectid) . ' cannot be parsed. The content of the file is as follow: ' . $content); return; } xml_set_element_handler($parser, array($handler, 'startElement'), array($handler, 'endElement')); xml_set_character_data_handler($parser, array($handler, 'text')); xml_parse($parser, $content, false); $projectname = get_project_name($projectid); $sitename = ""; $buildname = ""; $stamp = ""; if ($file != "Project") { $sitename = $handler->getSiteName(); $buildname = $handler->getBuildName(); $stamp = $handler->getBuildStamp(); } // Check if the build is in the block list $query = pdo_query("SELECT id FROM blockbuild WHERE projectid=" . qnum($projectid) . "\n AND (buildname='' OR buildname='" . $buildname . "')\n AND (sitename='' OR sitename='" . $sitename . "')\n AND (ipaddress='' OR ipaddress='" . $_SERVER['REMOTE_ADDR'] . "')"); if (pdo_num_rows($query) > 0) { echo $query_array['id']; echo "The submission is banned from this CDash server."; add_log("Submission is banned from this CDash server", "ctestparser"); return; } // Write the file to the backup directory. $filename = writeBackupFile($filehandler, $content, $projectname, $buildname, $sitename, $stamp, $file . ".xml"); if ($filename === false) { return $handler; } $statusarray = array(); $statusarray['status'] = 'OK'; $statusarray['message'] = ''; if ($do_checksum == true) { $md5sum = md5_file($filename); $md5error = false; if ($expected_md5 == '' || $expected_md5 == $md5sum) { $statusarray['status'] = 'OK'; } else { $statusarray['status'] = 'ERROR'; $statusarray['message'] = 'Checksum failed for file. Expected ' . $expected_md5 . ' but got ' . $md5sum; $md5error = true; } $statusarray['md5'] = $md5sum; if ($md5error) { displayReturnStatus($statusarray); add_log("Checksum failure on file: {$filename}", "ctest_parse", LOG_ERR, $projectid); return FALSE; } } $parsingerror = ''; if ($CDASH_USE_LOCAL_DIRECTORY && file_exists("local/ctestparser.php")) { $parsingerror = $localParser->StartParsing(); if ($parsingerror != '') { $statusarray['status'] = 'ERROR'; $statusarray['message'] = $parsingerror; displayReturnStatus($statusarray); exit; } } if (!($parseHandle = fopen($filename, 'r'))) { $statusarray['status'] = 'ERROR'; $statusarray['message'] = "ERROR: Cannot open file ({$filename})"; displayReturnStatus($statusarray); add_log("Cannot open file ({$filename})", "parse_xml_file", LOG_ERR); return $handler; } //burn the first 8192 since we have already parsed it $content = fread($parseHandle, 8192); while (!feof($parseHandle)) { $content = fread($parseHandle, 8192); if ($CDASH_USE_LOCAL_DIRECTORY && file_exists("local/ctestparser.php")) { $parsingerror = $localParser->ParseFile(); if ($parsingerror != '') { $statusarray['status'] = 'ERROR'; $statusarray['message'] = $parsingerror; displayReturnStatus($statusarray); exit; } } xml_parse($parser, $content, false); } xml_parse($parser, null, true); xml_parser_free($parser); fclose($parseHandle); unset($parseHandle); if ($CDASH_USE_LOCAL_DIRECTORY && file_exists("local/ctestparser.php")) { $parsingerror = $localParser->EndParsingFile(); } displayReturnStatus($statusarray); return $handler; }
include_once $relPath . 'wordcheck_engine.inc'; include_once $relPath . 'Project.inc'; include_once $relPath . 'theme.inc'; include_once $relPath . 'links.inc'; include_once "./word_freq_table.inc"; require_login(); set_time_limit(0); // no time limit $projectid = validate_projectID('projectid', @$_GET['projectid']); enforce_edit_authorization($projectid); $title = _("WordCheck Project Usage"); output_header($title, NO_STATSBAR); echo_word_freq_style(); echo_stylesheet(); echo "<h1>{$title}</h1>"; echo "<h2>" . get_project_name($projectid) . "</h2>"; // load the events $events = load_wordcheck_events($projectid); if (is_array($events)) { // parse the events complex array foreach ($events as $event) { list($time, $roundID, $page, $proofer, $words, $corrections) = $event; @$wordcheck_usage[$page][$roundID]++; } } echo "<p>" . _("The following table lists the number of times WordCheck was run against a page in each round and the last user to work on the page. Click the proofreader's username to compose a private message to them.") . "</p>"; echo "<p><b>" . _("Legend") . "</b></p>"; echo "<ul>"; echo "<li>" . _("Page has not been saved in the given round.") . "</li>"; echo "<li><span class='WC'>" . _("Page has had WordCheck run on it and is saved in the given round.") . "</span></li>"; echo "<li><span class='noWC'>" . _("Page has not had WordCheck run on it and is saved in the given round.") . "</span></li>";
$format = "html"; } list($all_suggestions_w_freq, $all_suggestions_w_occurrences, $round_suggestions_w_freq, $round_suggestions_w_occurrences, $rounds, $round_page_count, $messages) = _get_word_list($projectid, $timeCutoff); $title = _("Candidates for Good Words List from Proofreaders"); $page_text = sprintf(_("Displayed below are the words that proofreaders have suggested (via the %s button) in the WordCheck interface that have not been already included in the project's Good Words List."), "<img src='{$code_url}/graphics/Book-Plus-Small.gif'>"); $page_text .= " "; $page_text .= _("The results list also shows how many times each word occurs in the project text and how many times each word was suggested by proofreaders."); if ($format == "file") { $filename = "{$projectid}_proofer_suggestions.txt"; header("Content-type: text/plain"); header('Content-Disposition: attachment; filename="' . $filename . '"'); // The cache-control and pragma is a hack for IE not accepting filenames header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); echo $title . "\r\n"; echo sprintf(_("Project: %s"), get_project_name($projectid)) . "\r\n"; echo "\r\n"; echo strip_tags($page_text) . "\r\n"; echo "\r\n"; echo_page_instruction_text("good", $format); echo "\r\n"; echo_download_text($projectid, $format); echo "\r\n"; echo strip_tags($time_cutoff_text) . "\r\n"; echo _("Format: [word] - [frequency in text] - [frequency suggested]") . "\r\n"; echo "\r\n"; // print out the complete list first echo _("All rounds") . "\r\n"; foreach ($all_suggestions_w_freq as $word => $freq) { echo "{$word} - {$freq} - " . $all_suggestions_w_occurrences[$word] . "\r\n"; }
} else { $timediff = "TIME_TO_SEC(TIMEDIFF(build.submittime, buildupdate.starttime))"; $timestampadd = "TIMESTAMPADD(" . qiv("HOUR") . ", -167, NOW())"; } $testtime = pdo_query("SELECT projectid, build.name AS buildname, build.type AS buildtype, SUM(" . $timediff . ") AS elapsed\n FROM build, buildupdate, build2update\n WHERE\n build.submittime > " . $timestampadd . "\n AND build2update.buildid = build.id\n AND buildupdate.id = build2update.updateid\n AND build.siteid = '{$siteid}'\n GROUP BY projectid,buildname,buildtype\n ORDER BY elapsed\n "); $xml .= "<siteload>"; echo pdo_error(); $totalload = 0; while ($testtime_array = pdo_fetch_array($testtime)) { $projectid = $testtime_array["projectid"]; if (checkUserPolicy(@$_SESSION['cdash']['loginid'], $projectid, 1)) { $timespent = round($testtime_array["elapsed"] / 7.0); // average over 7 days $xml .= "<build>"; $xml .= add_XML_value("name", $testtime_array["buildname"]); $xml .= add_XML_value("project", get_project_name($projectid)); $xml .= add_XML_value("type", $testtime_array["buildtype"]); $xml .= add_XML_value("time", $timespent); $totalload += $timespent; $xml .= "</build>"; } } // Compute the idle time $idletime = 24 * 3600 - $totalload; if ($idletime < 0) { $idletime = 0; } $xml .= "<idle>" . $idletime . "</idle>"; $xml .= "</siteload>"; if (isset($_SESSION['cdash'])) { $xml .= "<user>";