Upgrade highlight.php and do other stuff.

This commit is contained in:
Floorb 2023-02-25 05:03:19 -05:00
parent 5193b4266c
commit c238975adf
12 changed files with 39 additions and 31 deletions

View file

@ -16,7 +16,7 @@
"ext-openssl": "*", "ext-openssl": "*",
"ext-gd": "*", "ext-gd": "*",
"ext-mbstring": "*", "ext-mbstring": "*",
"scrivo/highlight.php": "v9.18.1.9", "scrivo/highlight.php": "^9.18",
"erusev/parsedown": "^1.7", "erusev/parsedown": "^1.7",
"illuminate/database": "^9.4", "illuminate/database": "^9.4",
"ext-redis": "*" "ext-redis": "*"

16
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "bc050acf9c5c5997281c5c3a6f33c811", "content-hash": "e4f29c3440a94cc63c1b5d37ca4f76e8",
"packages": [ "packages": [
{ {
"name": "brick/math", "name": "brick/math",
@ -797,16 +797,16 @@
}, },
{ {
"name": "scrivo/highlight.php", "name": "scrivo/highlight.php",
"version": "v9.18.1.9", "version": "v9.18.1.10",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/scrivo/highlight.php.git", "url": "https://github.com/scrivo/highlight.php.git",
"reference": "d45585504777e6194a91dffc7270ca39833787f8" "reference": "850f4b44697a2552e892ffe71490ba2733c2fc6e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/scrivo/highlight.php/zipball/d45585504777e6194a91dffc7270ca39833787f8", "url": "https://api.github.com/repos/scrivo/highlight.php/zipball/850f4b44697a2552e892ffe71490ba2733c2fc6e",
"reference": "d45585504777e6194a91dffc7270ca39833787f8", "reference": "850f4b44697a2552e892ffe71490ba2733c2fc6e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -816,8 +816,8 @@
"require-dev": { "require-dev": {
"phpunit/phpunit": "^4.8|^5.7", "phpunit/phpunit": "^4.8|^5.7",
"sabberworm/php-css-parser": "^8.3", "sabberworm/php-css-parser": "^8.3",
"symfony/finder": "^2.8|^3.4", "symfony/finder": "^2.8|^3.4|^5.4",
"symfony/var-dumper": "^2.8|^3.4" "symfony/var-dumper": "^2.8|^3.4|^5.4"
}, },
"suggest": { "suggest": {
"ext-mbstring": "Allows highlighting code with unicode characters and supports language with unicode keywords" "ext-mbstring": "Allows highlighting code with unicode characters and supports language with unicode keywords"
@ -871,7 +871,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2021-12-03T06:45:28+00:00" "time": "2022-12-17T21:53:22+00:00"
}, },
{ {
"name": "symfony/console", "name": "symfony/console",

View file

@ -149,6 +149,8 @@ function truncate(string $input, int $maxWords, int $maxChars) : string {
} }
function embedView($paste_id, $p_title, $content, $title) : bool { function embedView($paste_id, $p_title, $content, $title) : bool {
global $baseurl;
$stats = false; $stats = false;
if ($content) { if ($content) {
// Build the output // Build the output
@ -200,7 +202,7 @@ function embedView($paste_id, $p_title, $content, $title) : bool {
$output .= "</style>"; $output .= "</style>";
$output .= $content; // Paste content $output .= $content; // Paste content
$output .= "<div class='paste_embed_footer'>"; $output .= "<div class='paste_embed_footer'>";
$output .= "<a href='https://ponepaste.org/$paste_id'>$p_title</a> Hosted by <a href='https://ponepaste.org'>$title</a> | <a href='https://ponepaste.org/raw/$paste_id'>view raw</a>"; $output .= "<a href='{$baseurl}/{$paste_id}'>$p_title</a> Hosted by <a href='{$baseurl}'>$title</a> | <a href='{$baseurl}/raw/$paste_id'>view raw</a>";
$output .= "</div>"; $output .= "</div>";
$output .= "</div>"; $output .= "</div>";

View file

@ -125,7 +125,7 @@ if (PP_MOD_REWRITE) {
} }
/* Expiry */ /* Expiry */
if (!empty($paste->expiry)) { if (!empty($paste->expiry) && $paste->expiry !== 'NULL') {
if ($paste->expiry === 'SELF') { if ($paste->expiry === 'SELF') {
$paste->delete(); $paste->delete();
flashWarning('This paste has self-destructed - if you close this window, you will no longer be able to view it!'); flashWarning('This paste has self-destructed - if you close this window, you will no longer be able to view it!');
@ -186,7 +186,7 @@ $p_content = rtrim($p_content);
// Apply syntax highlight // Apply syntax highlight
$p_content = htmlspecialchars_decode($p_content); $p_content = htmlspecialchars_decode($p_content);
if ($paste_code === "pastedown") { if ($paste_code === "pastedown" || $paste_code === 'pastedown_old') {
$parsedown = new Parsedown(); $parsedown = new Parsedown();
$parsedown->setSafeMode(true); $parsedown->setSafeMode(true);
$p_content = $parsedown->text($p_content); $p_content = $parsedown->text($p_content);

View file

@ -184,6 +184,7 @@
<div class="column"> <div class="column">
<div class="field"> <div class="field">
<label class="label" for="field_tags">Tags</label> <label class="label" for="field_tags">Tags</label>
<small>Type a comma to separate each tag.</small>
<div class="control"> <div class="control">
<input name="tag_input" class="input js-tag-input" id="field_tags" <input name="tag_input" class="input js-tag-input" id="field_tags"
value="<?= (isset($_POST['tag_input'])) ? pp_html_escape($_POST['tag_input']) : ''; ?>" /> value="<?= (isset($_POST['tag_input'])) ? pp_html_escape($_POST['tag_input']) : ''; ?>" />

View file

@ -20,7 +20,7 @@ return array(
'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'), 'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
'PonePaste\\' => array($baseDir . '/includes'), 'PonePaste\\' => array($baseDir . '/includes'),
'Illuminate\\Support\\' => array($vendorDir . '/illuminate/macroable', $vendorDir . '/illuminate/conditionable', $vendorDir . '/illuminate/collections', $vendorDir . '/illuminate/support'), 'Illuminate\\Support\\' => array($vendorDir . '/illuminate/collections', $vendorDir . '/illuminate/conditionable', $vendorDir . '/illuminate/macroable', $vendorDir . '/illuminate/support'),
'Illuminate\\Database\\' => array($vendorDir . '/illuminate/database'), 'Illuminate\\Database\\' => array($vendorDir . '/illuminate/database'),
'Illuminate\\Contracts\\' => array($vendorDir . '/illuminate/contracts'), 'Illuminate\\Contracts\\' => array($vendorDir . '/illuminate/contracts'),
'Illuminate\\Container\\' => array($vendorDir . '/illuminate/container'), 'Illuminate\\Container\\' => array($vendorDir . '/illuminate/container'),

View file

@ -124,9 +124,9 @@ class ComposerStaticInit5bf95489f4eff2c10ec062bf7ba377da
), ),
'Illuminate\\Support\\' => 'Illuminate\\Support\\' =>
array ( array (
0 => __DIR__ . '/..' . '/illuminate/macroable', 0 => __DIR__ . '/..' . '/illuminate/collections',
1 => __DIR__ . '/..' . '/illuminate/conditionable', 1 => __DIR__ . '/..' . '/illuminate/conditionable',
2 => __DIR__ . '/..' . '/illuminate/collections', 2 => __DIR__ . '/..' . '/illuminate/macroable',
3 => __DIR__ . '/..' . '/illuminate/support', 3 => __DIR__ . '/..' . '/illuminate/support',
), ),
'Illuminate\\Database\\' => 'Illuminate\\Database\\' =>

View file

@ -830,17 +830,17 @@
}, },
{ {
"name": "scrivo/highlight.php", "name": "scrivo/highlight.php",
"version": "v9.18.1.9", "version": "v9.18.1.10",
"version_normalized": "9.18.1.9", "version_normalized": "9.18.1.10",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/scrivo/highlight.php.git", "url": "https://github.com/scrivo/highlight.php.git",
"reference": "d45585504777e6194a91dffc7270ca39833787f8" "reference": "850f4b44697a2552e892ffe71490ba2733c2fc6e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/scrivo/highlight.php/zipball/d45585504777e6194a91dffc7270ca39833787f8", "url": "https://api.github.com/repos/scrivo/highlight.php/zipball/850f4b44697a2552e892ffe71490ba2733c2fc6e",
"reference": "d45585504777e6194a91dffc7270ca39833787f8", "reference": "850f4b44697a2552e892ffe71490ba2733c2fc6e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -850,13 +850,13 @@
"require-dev": { "require-dev": {
"phpunit/phpunit": "^4.8|^5.7", "phpunit/phpunit": "^4.8|^5.7",
"sabberworm/php-css-parser": "^8.3", "sabberworm/php-css-parser": "^8.3",
"symfony/finder": "^2.8|^3.4", "symfony/finder": "^2.8|^3.4|^5.4",
"symfony/var-dumper": "^2.8|^3.4" "symfony/var-dumper": "^2.8|^3.4|^5.4"
}, },
"suggest": { "suggest": {
"ext-mbstring": "Allows highlighting code with unicode characters and supports language with unicode keywords" "ext-mbstring": "Allows highlighting code with unicode characters and supports language with unicode keywords"
}, },
"time": "2021-12-03T06:45:28+00:00", "time": "2022-12-17T21:53:22+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {

View file

@ -3,7 +3,7 @@
'name' => 'aftercase/ponepaste', 'name' => 'aftercase/ponepaste',
'pretty_version' => 'dev-main', 'pretty_version' => 'dev-main',
'version' => 'dev-main', 'version' => 'dev-main',
'reference' => '8914700af7493ab2f4da22d60e13d47c410057ab', 'reference' => '7be5984b3eea1200a34b91ba7330a415e3a61ff5',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
@ -13,7 +13,7 @@
'aftercase/ponepaste' => array( 'aftercase/ponepaste' => array(
'pretty_version' => 'dev-main', 'pretty_version' => 'dev-main',
'version' => 'dev-main', 'version' => 'dev-main',
'reference' => '8914700af7493ab2f4da22d60e13d47c410057ab', 'reference' => '7be5984b3eea1200a34b91ba7330a415e3a61ff5',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
@ -149,9 +149,9 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'scrivo/highlight.php' => array( 'scrivo/highlight.php' => array(
'pretty_version' => 'v9.18.1.9', 'pretty_version' => 'v9.18.1.10',
'version' => '9.18.1.9', 'version' => '9.18.1.10',
'reference' => 'd45585504777e6194a91dffc7270ca39833787f8', 'reference' => '850f4b44697a2552e892ffe71490ba2733c2fc6e',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../scrivo/highlight.php', 'install_path' => __DIR__ . '/../scrivo/highlight.php',
'aliases' => array(), 'aliases' => array(),

View file

@ -48,6 +48,12 @@ class RegExMatch implements \ArrayAccess, \Countable, \IteratorAggregate
/** @var string */ /** @var string */
public $input; public $input;
/** @var string */
public $type;
/** @var Mode|string */
public $rule;
/** /**
* @param array<int, string|null> $results * @param array<int, string|null> $results
*/ */

View file

@ -111,7 +111,6 @@ final class Terminators
if (is_string($rule)) { if (is_string($rule)) {
$match->type = $rule; $match->type = $rule;
$match->extra = array($this->mode->illegal, $this->mode->terminator_end);
} else { } else {
$match->type = "begin"; $match->type = "begin";
$match->rule = $rule; $match->rule = $rule;

View file

@ -52,8 +52,8 @@
"require-dev": { "require-dev": {
"phpunit/phpunit": "^4.8|^5.7", "phpunit/phpunit": "^4.8|^5.7",
"sabberworm/php-css-parser": "^8.3", "sabberworm/php-css-parser": "^8.3",
"symfony/finder": "^2.8|^3.4", "symfony/finder": "^2.8|^3.4|^5.4",
"symfony/var-dumper": "^2.8|^3.4" "symfony/var-dumper": "^2.8|^3.4|^5.4"
}, },
"suggest": { "suggest": {
"ext-mbstring": "Allows highlighting code with unicode characters and supports language with unicode keywords" "ext-mbstring": "Allows highlighting code with unicode characters and supports language with unicode keywords"