moved variable grabbler files out of the way so they can have more descriptive names

master
BodgeMaster 2021-09-02 06:38:21 +02:00
parent 295d8e97c1
commit 2c91728544
10 changed files with 28 additions and 28 deletions

View File

@ -54,6 +54,8 @@ This section has moved. Look in the files or their documentation below.
This folder contains all the files that are parts of ThreadR directly This folder contains all the files that are parts of ThreadR directly
### [[DIR] config](./config) ### [[DIR] config](./config)
A place to store the configuation for a specific ThreadR instance (contains official instance config for now, will be moved elsewhere eventually) A place to store the configuation for a specific ThreadR instance (contains official instance config for now, will be moved elsewhere eventually)
### [[DIR] macros](./macros)
files for variable_grabbler.py
### [admin.php](./admin.php) ### [admin.php](./admin.php)
This is the file that is shown on the internal admin page. It will contain a list of users, forums, threads, etc. This is the file that is shown on the internal admin page. It will contain a list of users, forums, threads, etc.
At the moment, it is just a convenient way to access the other internal administration tools. At the moment, it is just a convenient way to access the other internal administration tools.
@ -93,18 +95,3 @@ An alternative option to providing a string in the config is to add arrays defin
Read the source code for further information. Read the source code for further information.
NOTICE: This file (or rather a more up-to-date version of it) will be moved to a new repository containing the deployment system. NOTICE: This file (or rather a more up-to-date version of it) will be moved to a new repository containing the deployment system.
### [variable_grabbler.pass0.json](./variable_grabbler.pass0.json), [variable_grabbler.pass1.json](./variable_grabbler.pass1.json), [variable_grabbler.pass2.json](./variable_grabbler.pass2.json)
These are the the config files for variable_grabbler.py.
A short description of what the variables do and where they should go:
* `%NAVBAR%` (in HTML part of PHP file) → the Navbar, also includes an automatic logout-function if the user is in a place where they should never be logged in (triggered by absence of the $login variable)
* `%SET_LOGIN_VARIABLE%` (in PHP code) → sets the $login variable in PHP by detecting if the user has a valid logged in session
* `%NO_CHEAP_LOGIN_STEALING%` (in PHP code, before any non-header data is sent to client) → prevents the most primitive cookie stealing attempts, nothing advanced though
* `%BANNER_COOKIES%` (in HTML part of PHP file) → the cookie banner that every web page has
* `%PLEAZE_NO_CACHE%` (in PHP code, before any non-header data is sent to client) → requests the browser to not cache this page
* `%FORCE_LOGOUT%` (in PHP code) → logout immediately (obviously less common than the other variables...)
* `%CONTENT_DIR%` (anywhere in code) → the path to the ThreadR directory (without domain name)
* `%STYLESHEET%` (in HTML) → adds the tag linking the stylesheet
* `%REQUIRE_LOGIN%` (in PHP code, before any non-header data is sent to client) → sends users to the login page if they are not logged in
### [navbar.template](./navbar.template), [banner_cookies.template](./banner_cookies.template)
file templates for variables from the code variable replacement system

View File

@ -9,9 +9,9 @@ if [ -n "`shopt globstar | grep off`" ]; then shopt -s globstar; fi
rm ./threadr/**/README.md rm ./threadr/**/README.md
#run the code variable replacement #run the code variable replacement
echo -n "`find -name "*.php" -or -name "*.html" -or -name "*.css" -or -name "*.svg" | sed 's/^/python variable_grabbler.py /;s/$/ variable_grabbler.pass0.json/'`" | bash - echo -n "`find -name "*.php" -or -name "*.html" -or -name "*.css" -or -name "*.svg" | sed 's/^/python variable_grabbler.py /;s/$/ macros/variable_grabbler.pass0.json/'`" | bash -
echo -n "`find -name "*.php" -or -name "*.html" -or -name "*.css" -or -name "*.svg" | sed 's/^/python variable_grabbler.py /;s/$/ variable_grabbler.pass1.json/'`" | bash - echo -n "`find -name "*.php" -or -name "*.html" -or -name "*.css" -or -name "*.svg" | sed 's/^/python variable_grabbler.py /;s/$/ macros/variable_grabbler.pass1.json/'`" | bash -
echo -n "`find -name "*.php" -or -name "*.html" -or -name "*.css" -or -name "*.svg" | sed 's/^/python variable_grabbler.py /;s/$/ variable_grabbler.pass2.json/'`" | bash - echo -n "`find -name "*.php" -or -name "*.html" -or -name "*.css" -or -name "*.svg" | sed 's/^/python variable_grabbler.py /;s/$/ macros/variable_grabbler.pass2.json/'`" | bash -
echo "============================================================================== echo "==============================================================================
Done." Done."

17
macros/README.md Normal file
View File

@ -0,0 +1,17 @@
# Files
### [variable_grabbler.pass0.json](./variable_grabbler.pass0.json), [variable_grabbler.pass1.json](./variable_grabbler.pass1.json), [variable_grabbler.pass2.json](./variable_grabbler.pass2.json)
These are the the config files for ../variable_grabbler.py.
A short description of what the variables do and where they should go:
* `%NAVBAR%` (in HTML part of PHP file) → the Navbar, also includes an automatic logout-function if the user is in a place where they should never be logged in (triggered by absence of the $login variable)
* `%SET_LOGIN_VARIABLE%` (in PHP code) → sets the $login variable in PHP by detecting if the user has a valid logged in session
* `%NO_CHEAP_LOGIN_STEALING%` (in PHP code, before any non-header data is sent to client) → prevents the most primitive cookie stealing attempts, nothing advanced though
* `%BANNER_COOKIES%` (in HTML part of PHP file) → the cookie banner that every web page has
* `%PLEAZE_NO_CACHE%` (in PHP code, before any non-header data is sent to client) → requests the browser to not cache this page
* `%FORCE_LOGOUT%` (in PHP code) → logout immediately (obviously less common than the other variables...)
* `%CONTENT_DIR%` (anywhere in code) → the path to the ThreadR directory (without domain name)
* `%STYLESHEET%` (in HTML) → adds the tag linking the stylesheet
* `%REQUIRE_LOGIN%` (in PHP code, before any non-header data is sent to client) → sends users to the login page if they are not logged in
### [navbar.template](./navbar.template), [banner_cookies.template](./banner_cookies.template)
file templates for variables from the code variable replacement system
### [README.md](./README.md)
this file

View File

@ -0,0 +1,5 @@
{
"NAVBAR":["file","macros/navbar.template"],
"BANNER_COOKIES":["file","macros/banner_cookies.template"],
"ABOUT_PAGE":["file","config/about.template"]
}

View File

@ -3,11 +3,7 @@ session_start();
%PLEAZE_NO_CACHE% %PLEAZE_NO_CACHE%
$navbar = "login"; $navbar = "login";
if (isset($_SESSION['user_id'])){ if (isset($_SESSION['user_id'])){
if (ini_get("session.use_cookies")) { %FORCE_LOGOUT%
$params = session_get_cookie_params();
setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"]);
}
session_destroy();
} }
?> ?>
<!DOCTYPE html> <!DOCTYPE html>

View File

@ -1,5 +0,0 @@
{
"NAVBAR":["file","navbar.template"],
"BANNER_COOKIES":["file","banner_cookies.template"],
"ABOUT_PAGE":["file","config/about.template"]
}