0) { $user2project_array = pdo_fetch_array($user2project); $role = $user2project_array["role"]; } if(!$project_array["showcoveragecode"] && $role<2) { echo "This project doesn't allow display of coverage code. Contact the administrator of the project."; exit(); } list ($previousdate, $currenttime, $nextdate) = get_dates($date,$project_array["nightlytime"]); $logoid = getLogoID($projectid); $xml = begin_XML_for_XSLT(); $xml .= "CDash : ".$projectname.""; $xml .= get_cdash_dashboard_xml_by_name($projectname,$date); // Build $xml .= ""; $build = pdo_query("SELECT * FROM build WHERE id='$buildid'"); $build_array = pdo_fetch_array($build); $siteid = $build_array["siteid"]; $site_array = pdo_fetch_array(pdo_query("SELECT name FROM site WHERE id='$siteid'")); $xml .= add_XML_value("site",$site_array["name"]); $xml .= add_XML_value("buildname",$build_array["name"]); $xml .= add_XML_value("buildid",$build_array["id"]); $xml .= add_XML_value("buildtime",$build_array["starttime"]); $xml .= ""; // coverage $coveragefile_array = pdo_fetch_array(pdo_query("SELECT fullpath,file FROM coveragefile WHERE id='$fileid'")); $xml .= ""; $xml .= add_XML_value("fullpath",$coveragefile_array["fullpath"]); if($CDASH_USE_COMPRESSION) { if($CDASH_DB_TYPE == "pgsql") { if(is_resource($coveragefile_array["file"])) { $file = base64_decode(stream_get_contents($coveragefile_array["file"])); } else { $file = base64_decode($coveragefile_array["file"]); } } else { $file = $coveragefile_array["file"]; } @$uncompressedrow = gzuncompress($file); if($uncompressedrow !== false) { $file = $uncompressedrow; } } else { $file = $coveragefile_array["file"]; } // Generating the html file $file_array = explode("
",$file); $i = 0; // Get the codes in an array $linecodes = array(); $coveragefilelog = pdo_query("SELECT log FROM coveragefilelog WHERE fileid=".qnum($fileid)." AND buildid=".qnum($buildid)); if(pdo_num_rows($coveragefilelog)>0) { $coveragefilelog_array = pdo_fetch_array($coveragefilelog); if($CDASH_DB_TYPE == "pgsql") { $log = stream_get_contents($coveragefilelog_array['log']); } else { $log = $coveragefilelog_array['log']; } $linecode = explode(';',$log); foreach($linecode as $value) { if(!empty($value)) { $code = explode(':',$value); $linecodes[$code[0]] = $code[1]; } } } foreach($file_array as $line) { $linenumber = $i+1; $line = htmlentities($line); $file_array[$i] = ''.str_pad($linenumber,5,' ', STR_PAD_LEFT).''; if(array_key_exists($i,$linecodes)) { $code = $linecodes[$i]; if($code==0) { $file_array[$i] .= ''; } else { $file_array[$i] .= ''; } $file_array[$i] .= str_pad($code,5,' ', STR_PAD_LEFT)." | ".$line; $file_array[$i] .= ""; } else { $file_array[$i] .= str_pad('',5,' ', STR_PAD_LEFT)." | ".$line; } $i++; } $file = implode("
",$file_array); $xml .= "".utf8_encode(htmlspecialchars($file)).""; $xml .= "
"; $xml .= ""; // Now doing the xslt transition generate_XSLT($xml,"viewCoverageFile"); ?>