[web-master] main: Move cvs-auth.php from include path to Composer autoload

From: Date: Sun, 11 Apr 2021 21:06:09 +0000
Subject: [web-master] main: Move cvs-auth.php from include path to Composer autoload
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-29222@lists.php.net to get a copy of this message
Author: Niklas Keller (kelunik) Date: 2021-04-11T22:51:54+02:00 Commit: https://github.com/php/web-master/commit/c155378dd6c89f86cf9067861cf8cbd82e227b88 Raw diff: https://github.com/php/web-master/commit/c155378dd6c89f86cf9067861cf8cbd82e227b88.diff Move cvs-auth.php from include path to Composer autoload Changed paths: A src/cvs-auth.php A vendor/composer/autoload_files.php D include/cvs-auth.inc M composer.json M include/login.inc M public/entry/svn-account.php M public/forgot.php M public/manage/event.php M public/manage/github.php M public/manage/pinfo.php M public/manage/user-notes.php M public/manage/users.php M vendor/composer/autoload_real.php M vendor/composer/autoload_static.php Diff: diff --git a/composer.json b/composer.json index ad2f0b0..bbe039a 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,9 @@ "autoload": { "psr-4": { "App\\": "src/" - } + }, + "files": [ + "src/cvs-auth.php" + ] } } diff --git a/include/login.inc b/include/login.inc index 22d3e51..e7ac61a 100644 --- a/include/login.inc +++ b/include/login.inc @@ -16,7 +16,6 @@ use App\DB; session_start(); -require 'cvs-auth.inc'; require 'functions.inc'; // User not logged in diff --git a/public/entry/svn-account.php b/public/entry/svn-account.php index bc105cc..49b9e99 100644 --- a/public/entry/svn-account.php +++ b/public/entry/svn-account.php @@ -1,7 +1,7 @@ <?php +require __DIR__ . '/../../vendor/autoload.php'; require __DIR__ . '/../../include/email-validation.inc'; -require __DIR__ . '/../../include/cvs-auth.inc'; require __DIR__ . '/../../include/functions.inc'; $valid_vars = ['name','email','username','passwd','note','group','yesno']; diff --git a/public/forgot.php b/public/forgot.php index 380a985..25912a7 100644 --- a/public/forgot.php +++ b/public/forgot.php @@ -1,6 +1,7 @@ <?php // vim: et ts=2 sw=2 + +require __DIR__ . '/../vendor/autoload.php'; require __DIR__ . '/../include/functions.inc'; -require __DIR__ . "/../include/cvs-auth.inc"; require __DIR__ . "/../include/mailer.php"; $id = $_REQUEST['id'] ?? false; diff --git a/public/manage/event.php b/public/manage/event.php index 85fb1a2..d770c4b 100644 --- a/public/manage/event.php +++ b/public/manage/event.php @@ -2,6 +2,7 @@ use App\Query; +require __DIR__ . '/../../vendor/autoload.php'; require __DIR__ . '/../../include/login.inc'; require __DIR__ . '/../../include/email-validation.inc'; diff --git a/public/manage/github.php b/public/manage/github.php index 69c6e28..d340be2 100644 --- a/public/manage/github.php +++ b/public/manage/github.php @@ -3,6 +3,7 @@ // This script evolved from a quick'n'dirty shell script. If you are reading // this feel free to clean it! +require __DIR__ . '/../../vendor/autoload.php'; require __DIR__ . '/../../include/login.inc'; @include __DIR__ . '/../../github-config.php'; diff --git a/public/manage/pinfo.php b/public/manage/pinfo.php index a562f70..ea31152 100644 --- a/public/manage/pinfo.php +++ b/public/manage/pinfo.php @@ -1,4 +1,6 @@ <?php + +require __DIR__ . '/../../vendor/autoload.php'; require __DIR__ . '/../../include/login.inc'; if (!is_mirror_site_admin($cuser)) { diff --git a/public/manage/user-notes.php b/public/manage/user-notes.php index 2b5ec79..becd0e9 100644 --- a/public/manage/user-notes.php +++ b/public/manage/user-notes.php @@ -1,9 +1,10 @@ <?php -// $Id$ -// Force login before action can be taken use App\Query; +require __DIR__ . '/../../vendor/autoload.php'; + +// Force login before action can be taken include __DIR__ . '/../../include/login.inc'; include __DIR__ . '/../../include/email-validation.inc'; include __DIR__ . '/../../include/note-reasons.inc'; @@ -44,7 +45,7 @@ /*------ BEGIN SEARCH ------*/ if (!$action) { head("user notes"); - + // someting done before ? if ($id) { $str = 'Note #' . $id . ' has been '; @@ -71,7 +72,7 @@ } echo $str . '<br />'; } - + if (isset($_REQUEST['keyword']) || isset($_REQUEST["view"])) { // Pagination start $page = isset($_REQUEST["page"]) ? intval($_REQUEST["page"]) : 0; @@ -159,7 +160,7 @@ 'WHERE (hostip >= ? AND hostip <= ?) OR (ip >= ? AND ip <= ?) '. 'ORDER BY votes.id DESC LIMIT ?int, 25', [$start, $end, $start, $end, $limitVotes]); - + } elseif (filter_var(html_entity_decode($_GET['votessearch'], ENT_QUOTES, 'UTF-8'), FILTER_VALIDATE_IP)) { $searchip = (int) ip2long(filter_var(html_entity_decode($_GET['votessearch'], ENT_QUOTES, 'UTF-8'), FILTER_VALIDATE_IP)); $resultCount = db_query_safe("SELECT count(votes.id) AS total_votes FROM votes JOIN(note) ON (votes.note_id = note.id) WHERE hostip = ? OR ip = ?", [$searchip, $searchip]); @@ -214,7 +215,7 @@ [$limit]); } } - + if ($result) { /* This is a special table only used for viewing the most recent votes */ $t = (isset($_GET['type']) ? '&type=' . $_GET['type'] : null); @@ -286,7 +287,7 @@ } else { $rating = "<span style=\"color: blue;\">$rating</span>"; } - + if (isset($row['rate'])) { // not all queries select the rate $percentage = $row['rate']; } else { @@ -297,7 +298,7 @@ } } $percentage = sprintf('%d%%', $percentage); - + echo "<div style=\"float: right; clear: both; border: 1px solid gray; padding: 5px; background-color: lightgray;\">\n". "<div style=\"display: inline-block; float: left; padding: 15px;\"><strong>Up votes</strong>: {$row['up']}</div>\n". "<div style=\"display: inline-block; float: left; padding: 15px;\"><strong>Down votes</strong>: {$row['down']}</div>\n". @@ -453,7 +454,7 @@ $step = 0; } } - + if ($step == 2) { $query = new Query('UPDATE note SET sect = ? WHERE ', [$_REQUEST["new_sect"]]); $query->addQuery($where); @@ -510,7 +511,7 @@ <th align="right">Move to section:</th> <td><input type="text" name="new_sect" value="<?= hsc($_REQUEST["new_sect"]); ?>" size="30" maxlength="80" /></td> </tr> - <tr> + <tr> <td align="center" colspan="2"> <input type="submit" value="Change" /> </td> @@ -525,11 +526,11 @@ case 'approve': if ($id) { if ($row = note_get_by_id($id)) { - + if ($row['status'] != 'na') { die ("Note #$id has already been approved"); } - + if ($row['id'] && db_query_safe("UPDATE note SET status=NULL WHERE id=?", [$id])) { note_mail_on_action( $cuser, @@ -538,7 +539,7 @@ "This note has been approved and will appear in the manual.\n\n----\n\n{$row['note']}" ); } - + print "Note #$id has been approved and will appear in the manual"; exit; } @@ -553,14 +554,14 @@ $cuser, $id, "note {$row['id']} $action_taken from {$row['sect']} by $cuser", - "Note Submitter: " . safe_email($row['user']) . + "Note Submitter: " . safe_email($row['user']) . (isset($reason) ? "\nReason: $reason" : " ") . "\n\n----\n\n{$row['note']}"); if ($action == 'reject') { note_mail_user($row['user'], "note $row[id] rejected and deleted from $row[sect] by notes editor $cuser",$reject_text."\n\n----- Copy of your note below -----\n\n".$row['note']); } } - + //if we came from an email, report _something_ if (isset($_GET['report'])) { header('Location: user-notes.php?id=' . $id . '&was=' . $action); @@ -830,7 +831,7 @@ function highlight_php($code, $return = FALSE) highlight_string($code); $highlighted = ob_get_contents(); ob_end_clean(); - + // Fix output to use CSS classes and wrap well $highlighted = '<div class="phpcode">' . str_replace( [ @@ -851,7 +852,7 @@ function highlight_php($code, $return = FALSE) ], $highlighted ) . '</div>'; - + if ($return) { return $highlighted; } else { echo $highlighted; } } diff --git a/public/manage/users.php b/public/manage/users.php index 3962a62..c426061 100644 --- a/public/manage/users.php +++ b/public/manage/users.php @@ -6,6 +6,7 @@ use App\Query; +require __DIR__ . '/../../vendor/autoload.php'; require __DIR__ . '/../../include/login.inc'; require __DIR__ . '/../../include/email-validation.inc'; require __DIR__ . '/../../include/email-templates.inc'; diff --git a/include/cvs-auth.inc b/src/cvs-auth.php similarity index 100% rename from include/cvs-auth.inc rename to src/cvs-auth.php diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php new file mode 100644 index 0000000..1ba823d --- /dev/null +++ b/vendor/composer/autoload_files.php @@ -0,0 +1,10 @@ +<?php + +// autoload_files.php @generated by Composer + +$vendorDir = dirname(dirname(__FILE__)); +$baseDir = dirname($vendorDir); + +return array( + 'f255b2695f755667cfcdad73757aa298' => $baseDir . '/src/cvs-auth.php', +); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index fe8adde..d76e639 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -52,6 +52,24 @@ public static function getLoader() $loader->register(true); + if ($useStaticLoader) { + $includeFiles = Composer\Autoload\ComposerStaticInit555eac2be6304e201001ec17b2028db4::$files; + } else { + $includeFiles = require __DIR__ . '/autoload_files.php'; + } + foreach ($includeFiles as $fileIdentifier => $file) { + composerRequire555eac2be6304e201001ec17b2028db4($fileIdentifier, $file); + } + return $loader; } } + +function composerRequire555eac2be6304e201001ec17b2028db4($fileIdentifier, $file) +{ + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + require $file; + + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + } +} diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 3cc16a5..a18c159 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -6,6 +6,10 @@ class ComposerStaticInit555eac2be6304e201001ec17b2028db4 { + public static $files = array ( + 'f255b2695f755667cfcdad73757aa298' => __DIR__ . '/../..' . '/src/cvs-auth.php', + ); + public static $prefixLengthsPsr4 = array ( 'P' => array (

« previous php.webmaster (#29222) next »