phpBB

Code Changes

File: phpbb/event/md_exporter.php

  Unmodified   Added   Modified   Removed
Line 143Line 143

list($event_name, $details) = explode("\n===\n", $event, 2);
$this->validate_event_name($event_name);


list($event_name, $details) = explode("\n===\n", $event, 2);
$this->validate_event_name($event_name);

 
			$sorted_events = [$this->current_event, $event_name];
natsort($sorted_events);

			$this->current_event = $event_name;

if (isset($this->events[$this->current_event]))
{
throw new \LogicException("The event '{$this->current_event}' is defined multiple times");

			$this->current_event = $event_name;

if (isset($this->events[$this->current_event]))
{
throw new \LogicException("The event '{$this->current_event}' is defined multiple times");

 
			}

// Use array_values() to get actual first element and check against natural order
if (array_values($sorted_events)[0] === $event_name)
{
throw new \LogicException("The event '{$sorted_events[1]}' should be defined before '{$sorted_events[0]}'");

			}

if (($this->filter == 'adm' && strpos($this->current_event, 'acp_') !== 0)

			}

if (($this->filter == 'adm' && strpos($this->current_event, 'acp_') !== 0)

Line 381Line 389
			$files = explode("\n    + ", $file_details);
foreach ($files as $file)
{

			$files = explode("\n    + ", $file_details);
foreach ($files as $file)
{

 
				if (!preg_match('#^([^ ]+)( \([0-9]+\))?$#', $file))
{
throw new \LogicException("Invalid event instances for file '{$file}' found for event '{$this->current_event}'", 1);
}

list($file) = explode(" ", $file);


				if (!file_exists($this->path . $file) || substr($file, -5) !== '.html')
{

				if (!file_exists($this->path . $file) || substr($file, -5) !== '.html')
{

					throw new \LogicException("Invalid file '{$file}' not found for event '{$this->current_event}'", 1);

					throw new \LogicException("Invalid file '{$file}' not found for event '{$this->current_event}'", 2);

				}

if (($this->filter !== 'adm') && strpos($file, 'styles/prosilver/template/') === 0)

				}

if (($this->filter !== 'adm') && strpos($file, 'styles/prosilver/template/') === 0)

Line 396Line 411
				}
else
{

				}
else
{

					throw new \LogicException("Invalid file '{$file}' not found for event '{$this->current_event}'", 2);

					throw new \LogicException("Invalid file '{$file}' not found for event '{$this->current_event}'", 3);

				}

$this->events_by_file[$file][] = $this->current_event;

				}

$this->events_by_file[$file][] = $this->current_event;

Line 416Line 431
		}
else
{

		}
else
{

			throw new \LogicException("Invalid file list found for event '{$this->current_event}'", 2);

			throw new \LogicException("Invalid file list found for event '{$this->current_event}'", 1);

		}

return $files_list;

		}

return $files_list;