[web-master] main: Move to public/ directory
| From: | Nikita Popov | Date: | Wed, 07 Apr 2021 10:12:46 +0000 |
| Subject: | [web-master] main: Move to public/ directory | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-29197@lists.php.net to get a copy of this message | ||
Author: Nikita Popov (nikic)
Date: 2021-04-07T12:12:02+02:00
Commit: https://github.com/php/web-master/commit/2a214490009e306bd13b740517ea6a0d538830c1
Raw diff: https://github.com/php/web-master/commit/2a214490009e306bd13b740517ea6a0d538830c1.diff
Move to public/ directory
Move everything that should be accessible from the webserver into
a public/ directory. Previously the document root was the root
of the repository, which is not great.
Changed paths:
A github-config.php.sample
A public/entry/event.php
A public/entry/subscribe.php
A public/entry/svn-account.php
A public/entry/user-note.php
A public/entry/user-notes-vote.php
A public/favicon.ico
A public/fetch/allusers.php
A public/fetch/cvsauth.php
A public/fetch/cvsforwarding.php
A public/fetch/events.php
A public/fetch/index.php
A public/fetch/mirrordns.php
A public/fetch/stats.php
A public/fetch/user-notes-rss.php
A public/fetch/user-notes.php
A public/fetch/user-profile.php
A public/fetch/user.php
A public/forgot.php
A public/github-webhook.php
A public/images/Robin.ico
A public/images/mirror_deactivated.png
A public/images/mirror_edit.png
A public/images/mirror_error.png
A public/images/mirror_info.png
A public/images/mirror_mail.png
A public/images/mirror_notice.png
A public/images/mirror_ok.png
A public/images/mirror_search.png
A public/images/mirror_special.png
A public/images/mirror_stats.png
A public/images/php-logo@2x.png
A public/images/php.gif
A public/index.php
A public/login.php
A public/mail/why.php
A public/manage/event.php
A public/manage/github.php
A public/manage/js/animatedcollapse.js
A public/manage/js/jquery.min.js
A public/manage/pinfo.php
A public/manage/user-notes.php
A public/manage/users.php
A public/network/status/.htaccess
A public/network/status/api.php
A public/network/status/index.php
A public/robots.txt
D entry/event.php
D entry/subscribe.php
D entry/svn-account.php
D entry/user-note.php
D entry/user-notes-vote.php
D favicon.ico
D fetch/allusers.php
D fetch/cvsauth.php
D fetch/cvsforwarding.php
D fetch/events.php
D fetch/index.php
D fetch/mirrordns.php
D fetch/stats.php
D fetch/user-notes-rss.php
D fetch/user-notes.php
D fetch/user-profile.php
D fetch/user.php
D forgot.php
D github-webhook.php
D images/Robin.ico
D images/mirror_deactivated.png
D images/mirror_edit.png
D images/mirror_error.png
D images/mirror_info.png
D images/mirror_mail.png
D images/mirror_notice.png
D images/mirror_ok.png
D images/mirror_search.png
D images/mirror_special.png
D images/mirror_stats.png
D images/php-logo@2x.png
D images/php.gif
D index.php
D login.php
D mail/why.php
D manage/event.php
D manage/github-config.php.sample
D manage/github.php
D manage/js/animatedcollapse.js
D manage/js/jquery.min.js
D manage/pinfo.php
D manage/user-notes.php
D manage/users.php
D network/status/.htaccess
D network/status/api.php
D network/status/index.php
D robots.txt
M .gitignore
M README.md
M include/functions.inc
M scripts/event-weekly-email
Diff:
diff --git a/.gitignore b/.gitignore
index 7b6cb71..70faa0d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,4 @@
.token
.token_flickr
tags
-manage/github-config.php
+github-config.php
diff --git a/README.md b/README.md
index 7fc315e..5b8a0c3 100644
--- a/README.md
+++ b/README.md
@@ -6,6 +6,7 @@ Local setup:
```shell
# TODO: This is supposed to be submodule, but not actually registered as one.
git clone git@github.com:php/web-shared.git shared
+ln -s ../shared public/shared
# Create database and users:
CREATE DATABASE phpmasterdb;
@@ -19,5 +20,5 @@ mysql -unobody phpmasterdb < schema.sql
INSERT INTO users (username, svnpasswd, cvsaccess) VALUES ('test',
'$2y$10$iGHyxmfHI62Xyr3DPf8faOPCvmU1UMVMlhJQ/FqooqgPJ3STMHTyG', 1);
# Run server (must have mysql ext)
-php -S localhost:8000 -d include_path="include/"
-derror_reporting="E_ALL&~E_DEPRECATED"
+php -S localhost:8000 -d include_path="include/"
-derror_reporting="E_ALL&~E_DEPRECATED" -t public
```
diff --git a/manage/github-config.php.sample b/github-config.php.sample
similarity index 100%
rename from manage/github-config.php.sample
rename to github-config.php.sample
diff --git a/include/functions.inc b/include/functions.inc
index 7497415..2f3fcd0 100644
--- a/include/functions.inc
+++ b/include/functions.inc
@@ -273,7 +273,7 @@ function get_ssh_keys($string) {
}
// We use markdown for people profiles
-include_once dirname(__FILE__) . '/../vendor/michelf/php-markdown-extra/markdown.php';
+include_once __DIR__ . '/../vendor/michelf/php-markdown-extra/markdown.php';
// -----------------------------------------------------------------------------------
//
diff --git a/entry/event.php b/public/entry/event.php
similarity index 98%
rename from entry/event.php
rename to public/entry/event.php
index b4a467e..bd153b6 100644
--- a/entry/event.php
+++ b/public/entry/event.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__ . '/../include/functions.inc';
+require_once __DIR__ . '/../../include/functions.inc';
$mailto = 'php-webmaster@lists.php.net';
#$mailto = 'jimw@apache.org';
diff --git a/entry/subscribe.php b/public/entry/subscribe.php
similarity index 100%
rename from entry/subscribe.php
rename to public/entry/subscribe.php
diff --git a/entry/svn-account.php b/public/entry/svn-account.php
similarity index 95%
rename from entry/svn-account.php
rename to public/entry/svn-account.php
index 23f1f20..bc105cc 100644
--- a/entry/svn-account.php
+++ b/public/entry/svn-account.php
@@ -1,8 +1,8 @@
<?php
-require dirname(__FILE__) . '/../include/email-validation.inc';
-require dirname(__FILE__) . '/../include/cvs-auth.inc';
-require dirname(__FILE__) . '/../include/functions.inc';
+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'];
foreach($valid_vars as $k) {
diff --git a/entry/user-note.php b/public/entry/user-note.php
similarity index 100%
rename from entry/user-note.php
rename to public/entry/user-note.php
diff --git a/entry/user-notes-vote.php b/public/entry/user-notes-vote.php
similarity index 100%
rename from entry/user-notes-vote.php
rename to public/entry/user-notes-vote.php
diff --git a/favicon.ico b/public/favicon.ico
similarity index 100%
rename from favicon.ico
rename to public/favicon.ico
diff --git a/fetch/allusers.php b/public/fetch/allusers.php
similarity index 100%
rename from fetch/allusers.php
rename to public/fetch/allusers.php
diff --git a/fetch/cvsauth.php b/public/fetch/cvsauth.php
similarity index 100%
rename from fetch/cvsauth.php
rename to public/fetch/cvsauth.php
diff --git a/fetch/cvsforwarding.php b/public/fetch/cvsforwarding.php
similarity index 92%
rename from fetch/cvsforwarding.php
rename to public/fetch/cvsforwarding.php
index 68a278e..e8b67d0 100644
--- a/fetch/cvsforwarding.php
+++ b/public/fetch/cvsforwarding.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__ . '/../include/functions.inc';
+require_once __DIR__ . '/../../include/functions.inc';
# token required, since this should only get accessed from php.net mx
if (!isset($_REQUEST['token']) || md5($_REQUEST['token']) !=
"19a3ec370affe2d899755f005e5cd90e")
diff --git a/fetch/events.php b/public/fetch/events.php
similarity index 98%
rename from fetch/events.php
rename to public/fetch/events.php
index ccca3fe..0b3d074 100644
--- a/fetch/events.php
+++ b/public/fetch/events.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__ . '/../include/functions.inc';
+require_once __DIR__ . '/../../include/functions.inc';
$valid_vars = ['token','cm','cy','cd','nm'];
foreach($valid_vars as $k) {
diff --git a/fetch/index.php b/public/fetch/index.php
similarity index 100%
rename from fetch/index.php
rename to public/fetch/index.php
diff --git a/fetch/mirrordns.php b/public/fetch/mirrordns.php
similarity index 100%
rename from fetch/mirrordns.php
rename to public/fetch/mirrordns.php
diff --git a/fetch/stats.php b/public/fetch/stats.php
similarity index 89%
rename from fetch/stats.php
rename to public/fetch/stats.php
index 3ce3b78..28b5b5e 100644
--- a/fetch/stats.php
+++ b/public/fetch/stats.php
@@ -1,7 +1,7 @@
<?php
// $Id$
-include_once '../include/functions.inc';
+include_once '../../include/functions.inc';
require_token();
diff --git a/fetch/user-notes-rss.php b/public/fetch/user-notes-rss.php
similarity index 97%
rename from fetch/user-notes-rss.php
rename to public/fetch/user-notes-rss.php
index 8bbf1d1..ed5e1cf 100644
--- a/fetch/user-notes-rss.php
+++ b/public/fetch/user-notes-rss.php
@@ -1,6 +1,6 @@
<?php
-require_once __DIR__ . '/../include/functions.inc';
+require_once __DIR__ . '/../../include/functions.inc';
db_connect();
diff --git a/fetch/user-notes.php b/public/fetch/user-notes.php
similarity index 100%
rename from fetch/user-notes.php
rename to public/fetch/user-notes.php
diff --git a/fetch/user-profile.php b/public/fetch/user-profile.php
similarity index 100%
rename from fetch/user-profile.php
rename to public/fetch/user-profile.php
diff --git a/fetch/user.php b/public/fetch/user.php
similarity index 100%
rename from fetch/user.php
rename to public/fetch/user.php
diff --git a/forgot.php b/public/forgot.php
similarity index 96%
rename from forgot.php
rename to public/forgot.php
index a67ebc6..741ad91 100644
--- a/forgot.php
+++ b/public/forgot.php
@@ -1,7 +1,7 @@
<?php // vim: et ts=2 sw=2
-require dirname(__FILE__) . '/include/functions.inc';
-require dirname(__FILE__) . "/include/cvs-auth.inc";
-require dirname(__FILE__) . "/include/mailer.php";
+require __DIR__ . '/../include/functions.inc';
+require __DIR__ . "/../include/cvs-auth.inc";
+require __DIR__ . "/../include/mailer.php";
$id = isset($_REQUEST['id']) ? $_REQUEST['id'] : false;
$user = isset($_REQUEST['user']) ? $_REQUEST['user'] : false;
diff --git a/github-webhook.php b/public/github-webhook.php
similarity index 99%
rename from github-webhook.php
rename to public/github-webhook.php
index 7bbae4b..6191981 100644
--- a/github-webhook.php
+++ b/public/github-webhook.php
@@ -3,7 +3,7 @@
const DRY_RUN = false;
if (!DRY_RUN) {
- require __DIR__ . '/include/mailer.php';
+ require __DIR__ . '/../include/mailer.php';
}
function verify_signature($requestBody) {
diff --git a/images/Robin.ico b/public/images/Robin.ico
similarity index 100%
rename from images/Robin.ico
rename to public/images/Robin.ico
diff --git a/images/mirror_deactivated.png b/public/images/mirror_deactivated.png
similarity index 100%
rename from images/mirror_deactivated.png
rename to public/images/mirror_deactivated.png
diff --git a/images/mirror_edit.png b/public/images/mirror_edit.png
similarity index 100%
rename from images/mirror_edit.png
rename to public/images/mirror_edit.png
diff --git a/images/mirror_error.png b/public/images/mirror_error.png
similarity index 100%
rename from images/mirror_error.png
rename to public/images/mirror_error.png
diff --git a/images/mirror_info.png b/public/images/mirror_info.png
similarity index 100%
rename from images/mirror_info.png
rename to public/images/mirror_info.png
diff --git a/images/mirror_mail.png b/public/images/mirror_mail.png
similarity index 100%
rename from images/mirror_mail.png
rename to public/images/mirror_mail.png
diff --git a/images/mirror_notice.png b/public/images/mirror_notice.png
similarity index 100%
rename from images/mirror_notice.png
rename to public/images/mirror_notice.png
diff --git a/images/mirror_ok.png b/public/images/mirror_ok.png
similarity index 100%
rename from images/mirror_ok.png
rename to public/images/mirror_ok.png
diff --git a/images/mirror_search.png b/public/images/mirror_search.png
similarity index 100%
rename from images/mirror_search.png
rename to public/images/mirror_search.png
diff --git a/images/mirror_special.png b/public/images/mirror_special.png
similarity index 100%
rename from images/mirror_special.png
rename to public/images/mirror_special.png
diff --git a/images/mirror_stats.png b/public/images/mirror_stats.png
similarity index 100%
rename from images/mirror_stats.png
rename to public/images/mirror_stats.png
diff --git a/images/php-logo@2x.png b/public/images/php-logo@2x.png
similarity index 100%
rename from images/php-logo@2x.png
rename to public/images/php-logo@2x.png
diff --git a/images/php.gif b/public/images/php.gif
similarity index 100%
rename from images/php.gif
rename to public/images/php.gif
diff --git a/index.php b/public/index.php
similarity index 100%
rename from index.php
rename to public/index.php
diff --git a/login.php b/public/login.php
similarity index 100%
rename from login.php
rename to public/login.php
diff --git a/mail/why.php b/public/mail/why.php
similarity index 100%
rename from mail/why.php
rename to public/mail/why.php
diff --git a/manage/event.php b/public/manage/event.php
similarity index 99%
rename from manage/event.php
rename to public/manage/event.php
index 338ab84..dbec990 100644
--- a/manage/event.php
+++ b/public/manage/event.php
@@ -1,6 +1,6 @@
<?php
-require __DIR__ . '/../include/login.inc';
-require __DIR__ . '/../include/email-validation.inc';
+require __DIR__ . '/../../include/login.inc';
+require __DIR__ . '/../../include/email-validation.inc';
define('PHP_SELF', hsc($_SERVER['PHP_SELF']));
diff --git a/manage/github.php b/public/manage/github.php
similarity index 98%
rename from manage/github.php
rename to public/manage/github.php
index 30f8417..5022a0c 100644
--- a/manage/github.php
+++ b/public/manage/github.php
@@ -3,9 +3,9 @@
// This script evolved from a quick'n'dirty shell script. If you are reading
// this feel free to clean it!
-require '../include/login.inc';
+require __DIR__ . '/../../include/login.inc';
-@include './github-config.php';
+@include __DIR__ . '/../../github-config.php';
if (!defined('GITHUB_CLIENT_ID') || !defined('GITHUB_CLIENT_SECRET')) {
die('GITHUB_CLIENT_ID or GITHUB_CLIENT_SECRET not defined. Please verify
./github-config.php');
}
diff --git a/manage/js/animatedcollapse.js b/public/manage/js/animatedcollapse.js
similarity index 100%
rename from manage/js/animatedcollapse.js
rename to public/manage/js/animatedcollapse.js
diff --git a/manage/js/jquery.min.js b/public/manage/js/jquery.min.js
similarity index 100%
rename from manage/js/jquery.min.js
rename to public/manage/js/jquery.min.js
diff --git a/manage/pinfo.php b/public/manage/pinfo.php
similarity index 68%
rename from manage/pinfo.php
rename to public/manage/pinfo.php
index 4968bb7..a562f70 100644
--- a/manage/pinfo.php
+++ b/public/manage/pinfo.php
@@ -1,5 +1,5 @@
<?php
-require '../include/login.inc';
+require __DIR__ . '/../../include/login.inc';
if (!is_mirror_site_admin($cuser)) {
warn("Sorry, you are not allowed to view this web page");
diff --git a/manage/user-notes.php b/public/manage/user-notes.php
similarity index 99%
rename from manage/user-notes.php
rename to public/manage/user-notes.php
index 0f3dccf..21cc102 100644
--- a/manage/user-notes.php
+++ b/public/manage/user-notes.php
@@ -2,9 +2,9 @@
// $Id$
// Force login before action can be taken
-include '../include/login.inc';
-include '../include/email-validation.inc';
-include '../include/note-reasons.inc';
+include __DIR__ . '/../../include/login.inc';
+include __DIR__ . '/../../include/email-validation.inc';
+include __DIR__ . '/../../include/note-reasons.inc';
define("NOTES_MAIL", "php-notes@lists.php.net");
define("PHP_SELF", hsc($_SERVER['PHP_SELF']));
diff --git a/manage/users.php b/public/manage/users.php
similarity index 98%
rename from manage/users.php
rename to public/manage/users.php
index cc2f432..0d46410 100644
--- a/manage/users.php
+++ b/public/manage/users.php
@@ -4,9 +4,9 @@
# acls
# handle flipping of the sort views
-require '../include/login.inc';
-require '../include/email-validation.inc';
-require '../include/email-templates.inc';
+require __DIR__ . '/../../include/login.inc';
+require __DIR__ . '/../../include/email-validation.inc';
+require __DIR__ . '/../../include/email-templates.inc';
function csrf_generate(&$mydata, $name) {
$mydata["CSRF"][$name] = $csrf = bin2hex(random_bytes(16));
diff --git a/network/status/.htaccess b/public/network/status/.htaccess
similarity index 100%
rename from network/status/.htaccess
rename to public/network/status/.htaccess
diff --git a/network/status/api.php b/public/network/status/api.php
similarity index 100%
rename from network/status/api.php
rename to public/network/status/api.php
diff --git a/network/status/index.php b/public/network/status/index.php
similarity index 100%
rename from network/status/index.php
rename to public/network/status/index.php
diff --git a/robots.txt b/public/robots.txt
similarity index 100%
rename from robots.txt
rename to public/robots.txt
diff --git a/scripts/event-weekly-email b/scripts/event-weekly-email
index 831eca3..0746204 100755
--- a/scripts/event-weekly-email
+++ b/scripts/event-weekly-email
@@ -3,7 +3,7 @@
This checks for unapproved events, and emails php-webmaster@ if they exist.
It should be checked weekly (via cron).
*/
-require dirname(dirname(__FILE__)).'/include/functions.inc';
+require dirname(__DIR__).'/include/functions.inc';
db_connect();