<commit_before><?php
	include 'includes/views/desktop/shared/page_top.php';

	if ($pageError) echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>" . $pageError . "</div>\n";
	elseif ($pageSuccess == 'sighting_added') echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>Successfully added sighting.</div>\n";
	elseif ($pageSuccess == 'sighting_removed') echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>Successfully removed sighting.</div>\n";
	elseif ($pageSuccess == 'tags_added') echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>Successfully added tag(s).</div>\n";
	elseif ($pageSuccess == 'tag_removed') echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>Successfully removed tag.</div>\n";
	elseif ($pageSuccess == 'comment_added') echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>Successfully added comment.</div>\n";
	elseif ($pageSuccess == 'comment_flagged') echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>Successfully flagged comment.</div>\n";
	elseif ($pageSuccess == 'added_to_watchlist') echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>Successfully added to watchlist.</div>\n";
	elseif ($pageSuccess == 'removed_from_watchlist') echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>Successfully removed from watchlist.</div>\n";
	elseif ($pageSuccess == 'rumour_updated') echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>Successfully updated rumour.</div>\n";
	
	// description
		echo "<div id='rumourTitle'";
		if (!$rumour[0]['enabled']) echo " class='muted'";
		echo ">\n";
		echo "  <div class='blockquoteOpen'>\n";
		echo "    <div class='blockquoteClose'>\n";
		echo "      " . $rumour[0]['description'] . "\n";
		if (!$rumour[0]['enabled']) echo "  (rumour disabled)\n";
		echo "      <span class='blockquoteCloseOrphan'>&nbsp;</span>\n";
		echo "    </div>\n";
		echo "  </div>\n";
		echo "</div>\n";

	// attribution
		echo $form->start('addAttributionForm', '', 'post', null, null, array('onSubmit'=>'return false;')) . "\n";
		echo $form->input('hidden', 'sightingToRemove') . "\n";
		echo "<div id='rumourAttribution'>\n";
		if ($sightings[0]['ok_to_show_profile']) $username = "<a href='/profile/" . $sightings[0]['username'] . "'>" . $sightings[0]['username'] . "</a>";
		else $username = "<b>anonymous</b>";
		echo "  <div>\n";
		echo "    Reported by " . $username . " via " . strtolower($rumourSources[$sightings[0]['source']]) . "\n";
		if ($sightings[0]['heard_on'] != '0000-00-00 00:00:00') "    on " . date('F j, Y', strtotime($sightings[0]['heard_on'])) . "\n";
		if ($sightings[0]['sighting_country']) echo "    in " . trim($sightings[0]['sighting_region'] . ', ' . $countries[$sightings[0]['sighting_country']], ' ,') . "\n";
		echo "  </div>\n";
		if (count($sightings) > 1) {
			echo "  <div>Also heard by <a href='' id='revealSightingsLink' onClick='return false;'>" . (count($sightings) - 1) . " other(s)</a></div>\n";
			$pageJavaScript .= "// add more tags\n";
			$pageJavaScript .= "  $('#revealSightingsLink').click(function () {\n";
			$pageJavaScript .= "    $('#rumourRemoveSightings').slideToggle();\n";
			$pageJavaScript .= "  });\n\n";
			echo "  <div id='rumourRemoveSightings'>\n";
			echo "    <table class='table table-hover table-condensed'>\n";
			for ($counter = 1; $counter < count($sightings); $counter++) {
				echo "    <tr>\n";
				// Username
					if ($sightings[$counter]['ok_to_show_profile']) $username = "<a href='/profile/" . $sightings[$counter]['username'] . "'>" . $sightings[$counter]['username'] . "</a>";
					else $username = "<b>anonymous</b>";
					echo "    <td><small>" . $username . "</small></td>\n";
				// Location & source
					echo "    <td><small>\n";
					echo "      " . trim($sightings[$counter]['sighting_region'] . ', ' . $countries[$sightings[$counter]['sighting_country']], ' ,') . "\n";
					if ($sightings[$counter]['source']) echo "      via " . strtolower($rumourSources[$sightings[$counter]['source']]) . "\n";
					echo "    </small></td>\n";
				// Date
					echo "    <td><small>" . date('F j, Y', strtotime($sightings[$counter]['heard_on'])) . "</small></td>\n";
				// Actions
					if (($logged_in['is_administrator'] && $logged_in['can_edit_content']) || $sightings[$counter]['created_by'] == $logged_in['user_id']  || $sightings[$counter]['entered_by'] == $logged_in['user_id']) {
						echo "    <td><a href='' onClick='removeSighting(" . '"' . $sightings[$counter]['sighting_id'] . '"' . "); return false;'><span class='glyphicon glyphicon-trash transluscent' title='Remove'></span></a></td>\n";
					}
					else {
						echo "    <td></td>\n";
					}
				echo "    </tr>\n";
			}
			echo "    </table>\n";
			echo "  </div>\n";
		}
		echo "</div>\n";
		echo $form->end() . "\n";
		
	// tags
		if (count($tags)) {
			echo $form->start('editTagsForm', '', 'post', 'form-inline', null, array('onSubmit'=>'return false;')) . "\n";
			echo $form->input('hidden', 'tagToRemove') . "\n";
			echo "<div id='rumourTags'>\n";
			echo "  <div id='rumourTagList'>\n";
			for ($counter = 0; $counter < count($tags); $counter++) {
				echo "    <span class='badge'>\n";
				echo "      <a href='/search_results/" . urlencode("tag_id=" . strtolower($tags[$counter]['tag_id'])) . "' class='tagLink'>" . $tags[$counter]['tag'] . "</a>\n";
				echo "      &nbsp; <a href='javascript:void(0)' onClick='removeTag(" . '"' . $tags[$counter]['tag_id'] . '"' . "); return false;'><span class='glyphicon glyphicon-remove glyphicon-white'></span></a>\n";
				echo "    </span>\n";
			}
			if ($logged_in) echo "    " . $form->input('button', 'addTagsButton', null, false, 'Add a tag', 'btn btn-sm btn-link') . "\n";
			echo "  </div>\n";
			if ($logged_in) {
				echo "  <div id='rumourAddTags'>\n";
				echo "    <div class='row'>\n";
				echo "      <div class='col-md-10'>" . $form->input('text', 'new_tag', @$_POST['new_tag'], true, '|Additional tags (separate with spaces)', 'form-control') . "</div>\n";
				echo "      <div class='col-md-2'>" . $form->input('submit', 'submitTags', null, false, 'Submit', 'btn btn-info', null, null, null, null, array('onClick'=>'validateeditTagsForm(); return false;')) . "</div>\n";
				echo "    </div>\n";
				echo "  </div>\n";
				$pageJavaScript .= "// add more tags\n";
				$pageJavaScript .= "  $('#addTagsButton').click(function () {\n";
				$pageJavaScript .= "    $('#rumourAddTags').slideToggle();\n";
				$pageJavaScript .= "  });\n\n";
			}
			echo "</div>\n";
			echo $form->end() . "\n";
		}

	// status and findings
		echo "<div id='rumourStatusAndFindings'>\n";
		echo "  <div id='rumourStatus'>This rumour is ";
		echo "<b>" . strtolower($rumourStatuses[$rumour[0]['status']]) . "</b>";
		if ($rumour[0]['assigned_to_username'] && ($rumour[0]['status'] == 'NU' || $rumour[0]['status'] == 'UI')) echo " and assigned to <a href='/profile/" . $rumour[0]['assigned_to_username'] . "'>" . $rumour[0]['assigned_to_username'] . "</a>";
		echo ".";
		if ($rumour[0]['findings']) echo " Here's why:";
		echo "\n";
		echo "  </div>\n";
		echo "  <div>\n";
		if ($rumour[0]['findings']) echo "    " . $rumour[0]['findings'] . "\n";
		elseif (!$hasBeenWatchlisted) echo "    Add this page to your watchlist to keep track of our progress.\n";
		echo "  </div>\n";
		echo "</div>\n";
		
	// actions
		echo "<div id='rumourActions'>\n";
		if ($logged_in) {
			echo "  " . $form->start('rumourActionsForm', '', 'post', '', null, array('onClick'=>'return false;')) . "\n";
			echo "  " . $form->input('hidden', 'addThisSighting') . "\n";
			echo "  " . $form->input('hidden', 'addToWatchlist') . "\n";
			echo "  " . $form->input('hidden', 'removeFromWatchlist') . "\n";
			echo "  <div id='rumourActionsButtons'>\n";
			if ($logged_in) echo "  " . $form->input('button', 'addSightingButton', null, false, 'I have also heard this rumour', 'btn btn-info') . "\n";
			if (!$hasBeenWatchlisted) echo "    <button id='addToWatchlistButton' name='addToWatchlistButton' class='btn btn-default' onClick='validateAddToWatchlist(); return false;'><span class='glyphicon glyphicon-plus'></span> Watchlist</button>\n";
			else echo "    <button id='removeFromWatchlistButton' name='removeFromWatchlistButton' class='btn btn-default' onClick='validateRemoveFromWatchlist(); return false;'><span class='glyphicon glyphicon-minus'></span> Stop watching</button>\n";
			echo "    <button id='leaveCommentButton' name='leaveCommentButton' class='btn btn-default'><span class='glyphicon glyphicon-comment'></span> Comment</button>\n";
			if ($logged_in['is_administrator'] && $logged_in['can_edit_content']) echo "  <button class='btn btn-default' onClick='document.location.href=" . '"/rumour_edit/' . $publicID . '"' . "; return false;'><span class='glyphicon glyphicon-edit'></span> Edit</button>\n";
			elseif ($logged_in['is_moderator']) {
				if (!$rumour[0]['assigned_to']) echo "  <button class='btn btn-default' onClick='document.location.href=" . '"/rumour_edit/' . $publicID . '"' . "; return false;'><span class='glyphicon glyphicon-edit'></span> Assign</button>\n";<commit_msg>Fixed bug preventing tag entry<commit_after><?php
	include 'includes/views/desktop/shared/page_top.php';

	if ($pageError) echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>" . $pageError . "</div>\n";
	elseif ($pageSuccess == 'sighting_added') echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>Successfully added sighting.</div>\n";
	elseif ($pageSuccess == 'sighting_removed') echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>Successfully removed sighting.</div>\n";
	elseif ($pageSuccess == 'tags_added') echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>Successfully added tag(s).</div>\n";
	elseif ($pageSuccess == 'tag_removed') echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>Successfully removed tag.</div>\n";
	elseif ($pageSuccess == 'comment_added') echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>Successfully added comment.</div>\n";
	elseif ($pageSuccess == 'comment_flagged') echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>Successfully flagged comment.</div>\n";
	elseif ($pageSuccess == 'added_to_watchlist') echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>Successfully added to watchlist.</div>\n";
	elseif ($pageSuccess == 'removed_from_watchlist') echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>Successfully removed from watchlist.</div>\n";
	elseif ($pageSuccess == 'rumour_updated') echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>Successfully updated rumour.</div>\n";
	
	// description
		echo "<div id='rumourTitle'";
		if (!$rumour[0]['enabled']) echo " class='muted'";
		echo ">\n";
		echo "  <div class='blockquoteOpen'>\n";
		echo "    <div class='blockquoteClose'>\n";
		echo "      " . $rumour[0]['description'] . "\n";
		if (!$rumour[0]['enabled']) echo "  (rumour disabled)\n";
		echo "      <span class='blockquoteCloseOrphan'>&nbsp;</span>\n";
		echo "    </div>\n";
		echo "  </div>\n";
		echo "</div>\n";

	// attribution
		echo $form->start('addAttributionForm', '', 'post', null, null, array('onSubmit'=>'return false;')) . "\n";
		echo $form->input('hidden', 'sightingToRemove') . "\n";
		echo "<div id='rumourAttribution'>\n";
		if ($sightings[0]['ok_to_show_profile']) $username = "<a href='/profile/" . $sightings[0]['username'] . "'>" . $sightings[0]['username'] . "</a>";
		else $username = "<b>anonymous</b>";
		echo "  <div>\n";
		echo "    Reported by " . $username . " via " . strtolower($rumourSources[$sightings[0]['source']]) . "\n";
		if ($sightings[0]['heard_on'] != '0000-00-00 00:00:00') "    on " . date('F j, Y', strtotime($sightings[0]['heard_on'])) . "\n";
		if ($sightings[0]['sighting_country']) echo "    in " . trim($sightings[0]['sighting_region'] . ', ' . $countries[$sightings[0]['sighting_country']], ' ,') . "\n";
		echo "  </div>\n";
		if (count($sightings) > 1) {
			echo "  <div>Also heard by <a href='' id='revealSightingsLink' onClick='return false;'>" . (count($sightings) - 1) . " other(s)</a></div>\n";
			$pageJavaScript .= "// add more tags\n";
			$pageJavaScript .= "  $('#revealSightingsLink').click(function () {\n";
			$pageJavaScript .= "    $('#rumourRemoveSightings').slideToggle();\n";
			$pageJavaScript .= "  });\n\n";
			echo "  <div id='rumourRemoveSightings'>\n";
			echo "    <table class='table table-hover table-condensed'>\n";
			for ($counter = 1; $counter < count($sightings); $counter++) {
				echo "    <tr>\n";
				// Username
					if ($sightings[$counter]['ok_to_show_profile']) $username = "<a href='/profile/" . $sightings[$counter]['username'] . "'>" . $sightings[$counter]['username'] . "</a>";
					else $username = "<b>anonymous</b>";
					echo "    <td><small>" . $username . "</small></td>\n";
				// Location & source
					echo "    <td><small>\n";
					echo "      " . trim($sightings[$counter]['sighting_region'] . ', ' . $countries[$sightings[$counter]['sighting_country']], ' ,') . "\n";
					if ($sightings[$counter]['source']) echo "      via " . strtolower($rumourSources[$sightings[$counter]['source']]) . "\n";
					echo "    </small></td>\n";
				// Date
					echo "    <td><small>" . date('F j, Y', strtotime($sightings[$counter]['heard_on'])) . "</small></td>\n";
				// Actions
					if (($logged_in['is_administrator'] && $logged_in['can_edit_content']) || $sightings[$counter]['created_by'] == $logged_in['user_id']  || $sightings[$counter]['entered_by'] == $logged_in['user_id']) {
						echo "    <td><a href='' onClick='removeSighting(" . '"' . $sightings[$counter]['sighting_id'] . '"' . "); return false;'><span class='glyphicon glyphicon-trash transluscent' title='Remove'></span></a></td>\n";
					}
					else {
						echo "    <td></td>\n";
					}
				echo "    </tr>\n";
			}
			echo "    </table>\n";
			echo "  </div>\n";
		}
		echo "</div>\n";
		echo $form->end() . "\n";
		
	// tags
		echo $form->start('editTagsForm', '', 'post', 'form-inline', null, array('onSubmit'=>'return false;')) . "\n";
		echo $form->input('hidden', 'tagToRemove') . "\n";
		echo "<div id='rumourTags'>\n";
		echo "  <div id='rumourTagList'>\n";
		if (count($tags)) {
			for ($counter = 0; $counter < count($tags); $counter++) {
				echo "    <span class='badge'>\n";
				echo "      <a href='/search_results/" . urlencode("tag_id=" . strtolower($tags[$counter]['tag_id'])) . "' class='tagLink'>" . $tags[$counter]['tag'] . "</a>\n";
				echo "      &nbsp; <a href='javascript:void(0)' onClick='removeTag(" . '"' . $tags[$counter]['tag_id'] . '"' . "); return false;'><span class='glyphicon glyphicon-remove glyphicon-white'></span></a>\n";
				echo "    </span>\n";
			}
		}
		if ($logged_in) echo "    " . $form->input('button', 'addTagsButton', null, false, 'Add a tag', 'btn btn-sm btn-link') . "\n";
		echo "  </div>\n";
		if ($logged_in) {
			echo "  <div id='rumourAddTags'>\n";
			echo "    <div class='row'>\n";
			echo "      <div class='col-md-10'>" . $form->input('text', 'new_tag', @$_POST['new_tag'], true, '|Additional tags (separate with spaces)', 'form-control') . "</div>\n";
			echo "      <div class='col-md-2'>" . $form->input('submit', 'submitTags', null, false, 'Submit', 'btn btn-info', null, null, null, null, array('onClick'=>'validateeditTagsForm(); return false;')) . "</div>\n";
			echo "    </div>\n";
			echo "  </div>\n";
			$pageJavaScript .= "// add more tags\n";
			$pageJavaScript .= "  $('#addTagsButton').click(function () {\n";
			$pageJavaScript .= "    $('#rumourAddTags').slideToggle();\n";
			$pageJavaScript .= "  });\n\n";
		}
		echo "</div>\n";
		echo $form->end() . "\n";

	// status and findings
		echo "<div id='rumourStatusAndFindings'>\n";
		echo "  <div id='rumourStatus'>This rumour is ";
		echo "<b>" . strtolower($rumourStatuses[$rumour[0]['status']]) . "</b>";
		if ($rumour[0]['assigned_to_username'] && ($rumour[0]['status'] == 'NU' || $rumour[0]['status'] == 'UI')) echo " and assigned to <a href='/profile/" . $rumour[0]['assigned_to_username'] . "'>" . $rumour[0]['assigned_to_username'] . "</a>";
		echo ".";
		if ($rumour[0]['findings']) echo " Here's why:";
		echo "\n";
		echo "  </div>\n";
		echo "  <div>\n";
		if ($rumour[0]['findings']) echo "    " . $rumour[0]['findings'] . "\n";
		elseif (!$hasBeenWatchlisted) echo "    Add this page to your watchlist to keep track of our progress.\n";
		echo "  </div>\n";
		echo "</div>\n";
		
	// actions
		echo "<div id='rumourActions'>\n";
		if ($logged_in) {
			echo "  " . $form->start('rumourActionsForm', '', 'post', '', null, array('onClick'=>'return false;')) . "\n";
			echo "  " . $form->input('hidden', 'addThisSighting') . "\n";
			echo "  " . $form->input('hidden', 'addToWatchlist') . "\n";
			echo "  " . $form->input('hidden', 'removeFromWatchlist') . "\n";
			echo "  <div id='rumourActionsButtons'>\n";
			if ($logged_in) echo "  " . $form->input('button', 'addSightingButton', null, false, 'I have also heard this rumour', 'btn btn-info') . "\n";
			if (!$hasBeenWatchlisted) echo "    <button id='addToWatchlistButton' name='addToWatchlistButton' class='btn btn-default' onClick='validateAddToWatchlist(); return false;'><span class='glyphicon glyphicon-plus'></span> Watchlist</button>\n";
			else echo "    <button id='removeFromWatchlistButton' name='removeFromWatchlistButton' class='btn btn-default' onClick='validateRemoveFromWatchlist(); return false;'><span class='glyphicon glyphicon-minus'></span> Stop watching</button>\n";
			echo "    <button id='leaveCommentButton' name='leaveCommentButton' class='btn btn-default'><span class='glyphicon glyphicon-comment'></span> Comment</button>\n";
			if ($logged_in['is_administrator'] && $logged_in['can_edit_content']) echo "  <button class='btn btn-default' onClick='document.location.href=" . '"/rumour_edit/' . $publicID . '"' . "; return false;'><span class='glyphicon glyphicon-edit'></span> Edit</button>\n";
			elseif ($logged_in['is_moderator']) {
				if (!$rumour[0]['assigned_to']) echo "  <button class='btn btn-default' onClick='document.location.href=" . '"/rumour_edit/' . $publicID . '"' . "; return false;'><span class='glyphicon glyphicon-edit'></span> Assign</button>\n";
{'fraction_non_alphanumeric': 0.23229745283490968, 'fraction_numerical': 0.004403743181704449, 'mean_word_length': 4.488602032408679, 'pattern_counts': {'":': 0, '<': 293, '<?xml version=': 0, '>': 325, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '523188', 'n_tokens_mistral': 7243, 'n_tokens_neox': 6634, 'n_words': 1307}