| <?php | |
| /******************************************************************************* | |
| * Copyright (c) 2017 Eclipse Foundation and others. | |
| * All rights reserved. This program and the accompanying materials | |
| * are made available under the terms of the Eclipse Public License v2.0 | |
| * which accompanies this distribution, and is available at | |
| * http://www.eclipse.org/legal/epl-2.0 | |
| *******************************************************************************/ | |
| 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"); | |
| require_once dirname ( __FILE__ ) . '/../classes/database.inc'; | |
| require_once dirname ( __FILE__ ) . '/../classes/Project.class.php'; | |
| $App = new App(); | |
| $Nav = new Nav(); | |
| $Menu = new Menu(); | |
| include($App->getProjectCommon()); | |
| $pageTitle = "Eclipse Foundation Cryptography"; | |
| $pageKeywords = ""; | |
| $pageAuthor = "Wayne Beaton"; | |
| $since = null; | |
| if (isset($_GET['since'])) { | |
| $since = strtotime($_GET['since']); | |
| } | |
| function cryptographyDo($since, $function) { | |
| $sql = " | |
| select | |
| b.bug_id as id, | |
| cp.name as project, | |
| b.short_desc as title, | |
| kd.name as type, | |
| c.thetext as text | |
| from | |
| (select | |
| c.bug_id, min(c.comment_id) as comment_id | |
| from longdescs as c | |
| join keywords as k on c.bug_id=k.bug_id | |
| join keyworddefs as kd on k.keywordid=kd.id | |
| where kd.name='cryptography' | |
| group by bug_id) as crypto | |
| join bugs as b on crypto.bug_id=b.bug_id | |
| join longdescs as c on crypto.comment_id=c.comment_id | |
| join components as cp on b.component_id=cp.id | |
| join keywords as k on b.bug_id=k.bug_id | |
| join keyworddefs as kd on k.keywordid=kd.id | |
| where | |
| b.bug_severity in ('approved', 'license_certified') | |
| and kd.name in ('projectcode', 'thirdparty') | |
| and date(creation_ts) > date(':since') | |
| order by cp.name, b.bug_id"; | |
| // If $since is null, this should render as the | |
| // epoch start which effectively means "forever". | |
| $args = array(':since' => date('Y-m-d', $since)); | |
| query ( 'ipzilla', $sql, $args, function ($row) use ($function) { | |
| $cq = new Stdclass(); | |
| $cq->id = $row['id']; | |
| $cq->title = $row['title']; | |
| $cq->projectId = $row['project']; | |
| $cq->project = Project::getProject($row['project']); | |
| $cq->type = $row['type']; | |
| $cq->cryptography = getCryptographyStatement($row['text']); | |
| $function($cq); | |
| }); | |
| } | |
| function getCryptographyStatement($string) { | |
| if (preg_match('/Cryptography:.*/', $string, $matches)) | |
| return $matches[0]; | |
| return ''; | |
| } | |
| function probablyNoForCryptography($cq) { | |
| // No entry means no. | |
| if (!trim($cq->cryptography)) return true; | |
| if (preg_match('/^Cryptography:\s*(.*)$/', trim($cq->cryptography), $matches)) { | |
| $statement = trim($matches[1]); | |
| // Blank entry means no. | |
| if (!$statement) return true; | |
| // Explicit no or equivalent as the first word is no. | |
| if (preg_match('/^(?:no|none|not)\b/i', $statement)) return true; | |
| } | |
| return false; | |
| } | |
| function probablyYesForCryptography($cq) { | |
| if (preg_match('/^Cryptography:\s*(.*)$/', $cq->cryptography, $matches)) { | |
| $statement = trim($matches[1]); | |
| if (!$statement) return false; | |
| if (preg_match('/^(?:yes)\b/i', $statement)) return true; | |
| } | |
| return false; | |
| } | |
| $projects = array(); | |
| $cqs = array(); | |
| cryptographyDo($since, function($cq) use (&$projects, &$cqs) { | |
| if ($project = $cq->project) { | |
| $cqs[$project->getId()][] = $cq; | |
| $projects[$project->getId()] = $project; | |
| } | |
| }); | |
| ob_start(); | |
| ?> | |
| <div id="maincontent"> | |
| <div id="midcolumn"> | |
| <h1><?= $pageTitle ?></h1> | |
| <p>The following CQs all include the <em>cryptography</em> keyword.</p> | |
| <?php | |
| if ($since) { | |
| $date = $App->getFormattedDate($since); | |
| echo "<p>Showing changes since {$date}. Show <a href=\"?\">all</a>.</p>"; | |
| } else { | |
| echo "<p>Only show the <a href=\"?since=-1 month\">changes in the last month</a> | |
| or <a href=\"?since=-2 month\">changes in the last two months</a>.</p>"; | |
| } | |
| ?> | |
| <h3>Projects</h3> | |
| <p>Projects that contain encryption:<p> | |
| <ul> | |
| <?php | |
| foreach($projects as $project) { | |
| if ($project->isArchived()) continue; | |
| $name = $project->getFormalName(); | |
| echo "<li><a href=\"{$project->getUrl()}\">$name</a> {$project->getUrl()}/developer</li>"; | |
| } | |
| ?> | |
| </ul> | |
| <h3>Contribution Questionnaires</h3> | |
| <p>CQs that indicate that they contain cryptography:<p> | |
| <ul> | |
| <?php | |
| foreach($cqs as $id => $values) { | |
| $project = Project::getProject($id); | |
| echo "<li>{$project->getFormalName()}<ul>"; | |
| foreach($values as $cq) { | |
| echo "<li>[<a href=\"https://dev.eclipse.org/ipzilla/show_bug.cgi?id={$cq->id}\">{$cq->id}</a>] {$cq->title}</li>"; | |
| } | |
| echo "</ul></li>"; | |
| } | |
| ?> | |
| </ul> | |
| </div> | |
| </div> | |
| <?php | |
| $html = ob_get_contents(); | |
| ob_end_clean(); | |
| $App->generatePage($theme, $Menu, $Nav, $pageAuthor, $pageKeywords, $pageTitle, $html); | |
| ?> |