| <?php |
| |
| //error_reporting(E_ALL); ini_set("display_errors", true); |
| // ---------------------------------------------------------------------------- |
| // BEGIN CODE |
| |
| |
| // Global Errror Handler Function |
| // This replicates the look/functionality of userErrorHandler from harness.php |
| // but doesn't implement the test-specific checks for global flags. |
| // NOTE: This is not setup by default. If you need to enable this, |
| // do something like: $old_error_handler = set_error_handler("globalDisplayErrorHandler"); |
| // external_entry() sets this up if the context calls for it. |
| function globalDisplayErrorHandler($errno, $errmsg, $filename, $linenum, $vars) { |
| $errortype = array ( |
| E_ERROR => 'Error', |
| E_WARNING => 'Warning', |
| E_PARSE => 'Parsing Error', |
| E_NOTICE => 'Notice', |
| E_CORE_ERROR => 'Core Error', |
| E_CORE_WARNING => 'Core Warning', |
| E_COMPILE_ERROR => 'Compile Error', |
| E_COMPILE_WARNING => 'Compile Warning', |
| E_USER_ERROR => 'User Error', |
| E_USER_WARNING => 'User Warning', |
| E_USER_NOTICE => 'User Notice', |
| E_STRICT => 'Runtime Notice', |
| E_RECOVERABLE_ERROR => 'Catchable Fatal Error'); |
| switch($errno) { |
| case E_NOTICE: // discard NOTICEs |
| case E_STRICT: // discard RUNTIME notices for deprecated usages |
| return; |
| default: |
| echo "<p><table cellpadding=10 width=400 bgcolor=#ffcccc><tr><td><font size=+2>Trouble: </font>"; |
| echo "PHP $errortype[$errno]:<br>$errmsg<br>$filename ($linenum)"; |
| $mysql_error_func = 'mysql_error_check'; |
| if(function_exists($mysql_error_func)) { |
| $mysql_error_func(); |
| } |
| echo "</table></p>\n"; |
| } |
| } |
| //$old_error_handler = set_error_handler("globalDisplayErrorHandler"); |
| function row_cmp( $a, $b ) { |
| $ia = strpos( $a['ProjectID'] . '.', '.' ); |
| $ib = strpos( $b['ProjectID'] . '.', '.' ); |
| $wa = substr( $a['ProjectID'], 0, $ia ); |
| $wb = substr( $b['ProjectID'], 0, $ib ); |
| if( $wa == $wb ) { |
| if( $a['Level'] == $b['Level'] ) { |
| $sa = $a['Name']; |
| $sb = $b['Name']; |
| $sa = strtolower($sa); |
| $sb = strtolower($sb); |
| if( substr($sa,0,4) == 'the ' ) $sa = substr($sa,4); |
| if( substr($sa,0,8) == 'eclipse ' ) $sa = substr($sa,8); |
| if( substr($sb,0,4) == 'the ' ) $sb = substr($sb,4); |
| if( substr($sb,0,8) == 'eclipse ' ) $sb = substr($sb,8); |
| $v = strcmp( $sa, $sb ); |
| return $v; |
| } else { |
| if( $a['Level'] < $b['Level'] ) $v = -1; |
| else if( $a['Level'] > $b['Level'] ) $v = 1; |
| else $v = 0; |
| return $v; |
| } |
| } else { |
| $v = strcmp( $wa, $wb ); |
| return $v; |
| } |
| } |
| |
| /** |
| * This function walks through the plan and answers true if it finds |
| * at least one milestone that is in the future. It returns false otherwise. |
| */ |
| function has_future_milestone($plan) { |
| $now = strtotime("now"); |
| foreach($plan->release_milestones->milestone as $milestone) { |
| $date = strtotime($milestone['date']); |
| if ($date > $now) return true; |
| //echo $milestone['date'] . " -> " . date("Ymd", $date) . "<br/>"; |
| } |
| return false; |
| } |
| |
| function has_milestones($plan) { |
| if (!isset($plan->release_milestones)) return false; |
| if (!isset($plan->release_milestones->milestone)) return false; |
| return true; |
| } |
| |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php"); |
| //require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/nav.class.php"); |
| //require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/menu.class.php"); |
| |
| $App = new App(); |
| |
| require_once "/home/data/httpd/eclipse-php-classes/system/dbconnection_foundation_ro.class.php"; |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/classes/projects/projectInfoData.class.php"); |
| |
| ?><html><body> |
| <ul> |
| <?php |
| $_dbc = new DBConnectionFoundation(); |
| $_dbh = $_dbc->connect(); |
| $query = "SELECT * FROM Projects WHERE IsComponent = 0 ORDER BY ProjectID"; |
| $result = mysql_query($query,$_dbh); |
| if (!$result) { |
| echo("MySQL Error: ".mysql_error()); |
| } else { |
| $rows = array(); |
| while( $row = mysql_fetch_assoc($result) ) { |
| $rows[] = $row; |
| } |
| usort( $rows, 'row_cmp' ); |
| foreach( $rows as $row ) { |
| |
| // ---- Load up ProjectInfo ---- |
| $projectid = $row['ProjectID']; |
| $projectinfo = new ProjectInfoData($projectid); |
| |
| // ---- Exclude internal and archived projects ---- |
| if( !$row['IsActive'] ) continue; |
| if( $row['ProjectID'] == "foundation-internal" |
| || $row['ParentProjectID'] == 'foundation-internal' ) continue; |
| if( $row['ProjectPhase'] == 'Archive' |
| || strpos( $row['Name'], "[archived]") |
| || strpos( $row['Name'], "[closed]" ) ) continue; |
| if( $row['Level'] == 0 ) continue; |
| |
| ?><li><?= $projectid ?> - <?php |
| |
| $url = $projectinfo->projectplanurls[0]; |
| /* |
| * Verify that the url is pointing to eclipse.org to prevent cross-site attacks |
| */ |
| if (!$url) { |
| echo "<em><font color=\"red\">The project metadata \"projectplanurl\" plan has not been specified.</font></em>"; |
| } else if( preg_match("/^\w+:/", $url) && substr($url,0,23) != 'http://www.eclipse.org/' ) { |
| echo "<em><font color=\"red\">The project meta-data \"projectplanurl\" does not refer to an http://www.eclipse.org/ page.</font></em>"; |
| } elseif(preg_match('/project-plan.php/i', $url)) { |
| echo "<em><font color=\"red\">This project has bad meta-data: it points back to this page in an infinite loop.</font></em>"; |
| } else { |
| if( substr($url,0,5) != 'http:' ) |
| $url = $_SERVER['DOCUMENT_ROOT'] . $url; |
| if( preg_match( "/http:\/\/www.eclipse.org\/(.*)/", $url, $matches ) ) { |
| $url = "/home/local/data/httpd/www.eclipse.org/html/" . $matches[1]; |
| } |
| /* |
| * Load the XML file |
| */ |
| $xml = new DomDocument(); |
| $xml->load($url); |
| if( $xml === false ) { |
| $contents = @file_get_contents( $url ); |
| if( !$contents ) { |
| ?><em>the project meta-data "projectplanurl" (<?= $url ?>) points to an empty file.</em> |
| <?php |
| } else { |
| ?><em>the file is not a valid project plan XML file (xml->load fails)</em> |
| <?php |
| } |
| } else { |
| $plan = simplexml_load_file($url); |
| if ($plan == null) { |
| echo "<em><font color=\"red\">Cannot load the plan. The XML may not be well-structured.</font></em>"; |
| } else if (has_milestones($plan)) { |
| if (has_future_milestone($plan)) { |
| echo "<font color=\"green\">valid</font>"; |
| } else { |
| echo "<em><font color=\"red\">The plan has no future milestones.</font></em>"; |
| } |
| } else { |
| echo "<em><font color=\"red\">The plan has no milestones.</font></em>"; |
| } |
| }// if( !xml error ) |
| |
| $real_url = $projectinfo->projectplanurls[0]; |
| echo " <a href=\"$real_url\">(url)</a>"; |
| }// if( !cross site attack ) |
| ?></li> |
| <?php |
| }// foreach project |
| }// if( !mysql error ) |
| ?> |
| </ul> |
| </body> |
| </html> |