23 Commits

Author SHA1 Message Date
00a2458977 Update error pages 2022-07-08 09:10:14 -04:00
8302028049 Update pages with changes to /common/
The building block PHP files have been moved.
2022-07-07 22:40:11 -04:00
b692b22935 Move PHP files to /common/php/ 2022-07-07 22:33:21 -04:00
01de94a893 Update 2022-07-07 22:24:46 -04:00
bedc11a4ce Move CSS files to /common/css/
Moved all CSS files to their own sub-directory and updated header.php to
reflect this change.
2022-07-06 15:26:18 -04:00
842ea4e411 Remove /common/prisim/ from repository 2022-07-06 15:25:01 -04:00
8b4b5dd31d Updated header.php with new page_format.js path 2022-07-06 15:24:09 -04:00
35cd14e0b0 Move JS files to /common/js/
To cleanup the code in /common/ all JavaScript files have been moved to
/common/js/
issue#2
2022-07-06 15:20:32 -04:00
d743fb297b Move Prism files to a properly spelled directory
Moved the Prism project files from /common/prisim/ to /common/prism/.
Updated the code in /common/page_format.js that loads these files.
2022-07-06 15:17:41 -04:00
87a07aaf02 Merge pull request 'Add documentation.' (#13) from manfromhuh/simple_blog:master into master
Reviewed-on: #13
2022-07-05 15:22:31 -04:00
f1b3eec9d8 Readd README.md to resolve merge confilict 2022-07-05 15:16:48 -04:00
91119d3575 Merge branch 'code_docs' 2022-07-05 15:13:44 -04:00
6b06c36b0b Merge pull request 'Update to upstream master' (#1) from 20xd6/simple_blog:master into master
Reviewed-on: manfromhuh/simple_blog#1
2022-07-05 15:10:54 -04:00
394e34b7b8 Update URL path 2022-07-05 15:01:32 -04:00
de3986efcb Add comments to page_menu.php 2022-07-05 14:45:16 -04:00
58f94c415d Add comments to index.php 2022-07-05 14:40:20 -04:00
4117b552f2 Add comments to header.php
This file needs it's Title() function cleaned up.
2022-07-05 14:36:54 -04:00
a00013d619 Add comments to h1_month.php 2022-07-05 14:33:18 -04:00
ef7056be35 Add comments to get_month_name.php 2022-07-05 14:32:11 -04:00
93514c0e1d Add comments to page_format.js 2022-07-05 14:29:43 -04:00
e1ac241f2a Add Completed README.md 2022-07-05 14:18:49 -04:00
a2ee59d2f3 Fix for issue#8
The array was being processed such that it would stop when it reached
the number of row not the number of coloums.
2022-07-05 10:56:02 -04:00
cfc878013d Test README.md 2022-07-02 12:48:30 -04:00
30 changed files with 215 additions and 68 deletions

135
README.md
View File

@@ -1 +1,136 @@
# simple_blog # simple_blog
simple_blog is a basic blogging platform. It is designed to be a straightforward way to publish articles written in Markdown and display them using a renderer written in PHP. There is no login page or any way to manage simple_blog from the web. All management is done via the command line. This can be done with a shell script or with the python based [simple_blog_cms](/git/20xd6/simple_blog_cms).
## Requirements
* Currently tested with PHP 7.4
* Some shell access is necessary.
* The recommend way is via ssh.
* I don't see a technical reason it can't work with a web manager like cPannel or Ajenti as long has you have the ability to upload files and manage files.
## Publishing
Publishing can be done manually or with a script that accomplishes the following tasks.
1. Create a directory under `/blog/by_year/$CURRENT_YEAR/$CURRENT_MONTH/`
* For a post in January of 2022 this would be `/blog/by_year/2022/01/`
* The directory should start with a numeral otherwise it will be sorted alphabetically
2. Place a file named `article.md` containing the MarkDown formatted text of the article in the directory created in the previous step
3. Copy or symlink `/common/index.php` into the directory created in step 1
4. Place a file named `tags` containing a comma separated list of tags for the article in the directory created in step 1
5. Add the article's relative path and title to `/by_tag/tags.csv` under the appropriate headings.
The recommended method is to use [simple_blog_cms](/git/20xd6/simple_blog_cms "simple_blog_cms")
## Article Tags
### Per-article List
A file named `tags` is placed in the directory for each article. It should contain a comma separated list of tags being applied to the article. This will be parsed and displayed by [`/common/md_read.php`](/git/20xd6/simple_blog/src/branch/master/common/md_read.php) at the bottom of the article.
### by_tags
This folder contains an index file that displays an article list generated by parsing the `tags.csv` file. A format example is displayed below.
| "PHP" | "JS" | "Religion" | "Catholic" |
| ----- | ---- | ---------- | ---------- |
| "/blog/by_year/2021/10/03_Forcing_Elements_to_reload/" | "/blog/by_year/2021/10/03_Forcing_Elements_to_reload/" |"/blog/by_year/2021/10/reproduction_of_Gainer_Bishop_Ronald_4-1-16/" | reproduction_of_Gainer_Bishop_Ronald_4-1-16/" |
| "Forcing page elements to reload" | "Forcing page elements to reload" | "Open Letter to Bishop Ronald Gainer" | "Open Letter to Bishop Ronald Gainer" |
| "/blog/by_year/2022/06/28_A_Test_Post/"| | |
| "A Test Post" | | |
## File Descriptions
### blog
Contains the blog articles. The articles are placed in subdirectories of `by_year` according to the year and month they were published.
```
├── by_year
│   ├── 2021
│   │   ├── 12
│   │   └── index.php -> /path/to/common/index.php
│   ├── 2022
│   │   ├── 01
│   │   ├── 02
│   │   └── index.php -> /path/to/common/index.php
│   └── index.php
└── index.php -> /path/to/common/index.php
```
### common
This directory contains the files and libraries used to render the site's pages.
#### Composer files
* composer.json
* composer.lock
* [/common/vendor]() - Stores the composer files and libraries managed via composer.
#### CSS
* [styles.css](/git/20xd6/simple_blog/src/branch/master/common/styles.css) - The main site CSS.
* [jmenu.css]() - Used to render the responsive menus.
* [print.css]() - Used to style printed pages.
* [gallery.css]() - Styles the floating
#### JS
* font_size.js
* [page_format.js]() - The main JS file used for formatting and adding extra functions to pages.
* gallery.js
#### PHP
* [footer.php]() - The common page footer. Contains copyright information and links to the license.
* [get_month_name.php]() - Translates a numeral month into the corresponding name. I.E. 01 into January.
* [h1_month.php]() - Adds the proper `<h1>` heading based on the location of the
* [header.php]() - The common page header.
* [index.php]() - The index file used for most of the pages on the site.
* [markdown.php]()
* [md_read.php]() - Renders Markdown files and adds
* [menu.php]() - Generates the blog menu items in the navigation menu.
* [modal.php]() - Adds the modal `<div>` for displaying the image pop out.
* [page_menu.php]() - Generates a menu from the files and directories where it's run from.
* [page_menu_table.php]()
* [path_menu.php]()
#### /common/error_pages/
* [/common/403.php]() - The 403 not allowed page.
* [/common/404.php]() - The 404 page.
* [/common/500.php]() - Displayed for all HTTP 500 errors
#### /common/imgs/
Images used site wide.
* [cursor.gif]() - Blinking cursor used on the front page.
* [icon-rss.png]() - RSS icon
#### /common/prisim
Files for the prism syntax highlighter.
### license
This directory contains all the licensing information for simple_blog. simple_blog is licensed under the GPLv2 but uses components that are licensed under the MIT Open Source license. These components are:
* [Jmenu](https://github.com/jamesjohnson280/JMenu)
* [Parsedown](https://github.com/erusev/parsedown)
* [Parsedown-extra](https://github.com/erusev/parsedown-extra)
#### index.php
Displays all of the reverent license and the components they apply to.
* simple_blog is licensed GPLv2. This cannot be changed.
* Default license for articles published. This is [Creative Commons Attribution 3.0 Unported License](http://creativecommons.org/licenses/by/3.0/) by default. This licensed can be changed however the site admin wishes.
* [Jmenu](https://github.com/jamesjohnson280/JMenu) is licensed MIT. This cannot be changed.
* [Parsedown](https://github.com/erusev/parsedown) is licensed MIT. This cannot be changed.
* [Parsedown-extra](https://github.com/erusev/parsedown-extra) is licensed MIT. This cannot be changed.
Copies of all these licenses can be found in the `/license/` directory.

View File

@@ -1,6 +1,6 @@
<?php <?php
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/header.php'); include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/header.php');
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/menu.php'); include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/menu.php');
echo "<article><h1 id=\"page_title\">Posts by Tag</h1></article>"; echo "<article><h1 id=\"page_title\">Posts by Tag</h1></article>";
echo "<div id=\"search_inputs\"><input type=\"text\" id=\"tag_sort\" onkeyup=\"tag_search()\" placeholder=\"Search Tags...\" title=\"Type a tage to search\"><input id=\"search_toggle\" type=\"button\" value=\"Search Titles\" onclick=\"search_toggle()\"></div><!--End Div Search Inputs-->"; echo "<div id=\"search_inputs\"><input type=\"text\" id=\"tag_sort\" onkeyup=\"tag_search()\" placeholder=\"Search Tags...\" title=\"Type a tage to search\"><input id=\"search_toggle\" type=\"button\" value=\"Search Titles\" onclick=\"search_toggle()\"></div><!--End Div Search Inputs-->";
@@ -43,12 +43,12 @@
//echo "</pre>\n"; //echo "</pre>\n";
echo "<ul id=\"tag_menu\">\n"; echo "<ul id=\"tag_menu\">\n";
$coloum_number = 0; $coloum_number = 0;
for ($row_number = 0; $row_number < $tags_rows; $row_number++){ for ($row_number = 0; $row_number <= $tags_coloums; $row_number++){
#echo $row_number; //echo $row_number;
$section_title = $tags_csv[0][$coloum_number]; $section_title = $tags_csv[0][$coloum_number];
echo "\t<li id=\"" . $section_title . "\"><b>" . $section_title . " </b>\n"; echo "\t<li id=\"" . $section_title . "\"><b>" . $section_title . " </b>\n";
for ($row = 1; $row < $tags_coloums; $row++){ for ($row = 1; $row < $tags_coloums; $row++){
#echo "rn: " . $row_number . "\ncn:" . $coloum_number; //echo "rn: " . $row . "\ncn:" . $coloum_number ." ";
$tag_content = $tags_csv[$row][$coloum_number]; $tag_content = $tags_csv[$row][$coloum_number];
if ($tag_content == ""){ if ($tag_content == ""){
break; break;
@@ -64,5 +64,5 @@
$coloum_number++; $coloum_number++;
} }
echo "</ul>\n"; echo "</ul>\n";
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/footer.php'); include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/footer.php');
?> ?>

View File

@@ -1,6 +1,6 @@
<?php <?php
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/header.php'); include_once ($_SERVER['DOCUMENT_ROOT'].'common/php/header.php');
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/menu.php'); include_once ($_SERVER['DOCUMENT_ROOT'].'common/php/menu.php');
?> ?>
<h1 align="center">Error 403</h1> <h1 align="center">Error 403</h1>
<p align="center"> <p align="center">
@@ -11,4 +11,4 @@ include_once ($_SERVER['DOCUMENT_ROOT'].'/common/menu.php');
<br/> <br/>
You're not allowed here. Stop that.<br/> You're not allowed here. Stop that.<br/>
</p> </p>
<?php include_once ($_SERVER['DOCUMENT_ROOT'].'/common/footer.php');?> <?php include_once ($_SERVER['DOCUMENT_ROOT'].'common/php/footer.php');?>

View File

@@ -1,6 +1,6 @@
<?php <?php
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/header.php'); include_once ($_SERVER['DOCUMENT_ROOT'].'common/php/header.php');
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/menu.php'); include_once ($_SERVER['DOCUMENT_ROOT'].'common/php/menu.php');
?> ?>
<h1 align="center">Error 404</h1> <h1 align="center">Error 404</h1>
<p align="center"> <p align="center">
@@ -21,4 +21,4 @@ include_once ($_SERVER['DOCUMENT_ROOT'].'/common/menu.php');
</div> </div>
<br/> <br/>
<br/> <br/>
<?php include_once ($_SERVER['DOCUMENT_ROOT'].'/common/footer.php');?> <?php include_once ($_SERVER['DOCUMENT_ROOT'].'common/php/footer.php');?>

View File

@@ -1,10 +1,10 @@
<?php <?php
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/header.php'); include_once ($_SERVER['DOCUMENT_ROOT'].'common/php/header.php');
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/menu.php'); include_once ($_SERVER['DOCUMENT_ROOT'].'common/php/menu.php');
?> ?>
<h1 align="center">Error 500</h1> <h1 align="center">Error 500</h1>
<p align="center"> <p align="center">
<br/> <br/>
We done made a boo boo...<br/> We done made a boo boo...<br/>
</p> </p>
<?php include_once ($_SERVER['DOCUMENT_ROOT'].'/common/footer.php');?> <?php include_once ($_SERVER['DOCUMENT_ROOT'].'common/php/footer.php');?>

View File

@@ -1,11 +0,0 @@
<?php
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/header.php');
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/menu.php');
if (file_exists('article.md')){
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/md_read.php');
} else {
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/h1_month.php');
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/page_menu.php');
}
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/footer.php');
?>

View File

@@ -1,25 +1,30 @@
//
function format_page(){//Set the title of the page based on the main header, <h1>, tag.le != '' )){ function format_page(){//Set the title of the page based on the main header, <h1>, tag.le != '' )){
if ( document.getElementsByTagName('h1').length !== 0){ if ( document.getElementsByTagName('h1').length !== 0){
document.title = document.getElementsByTagName('h1')[0].innerText; document.title = document.getElementsByTagName('h1')[0].innerText;
} }
//detect if the page contains code blocks to be highlighted and loads the prisim.js and prism.css files to accomplish this. //Detect if the page contains code blocks to be highlighted and loads the
//prisim.js and prism.css files if codeblocks are found.
code_tag = document.getElementsByTagName('code').length; code_tag = document.getElementsByTagName('code').length;
if ( code_tag !== 0 ){ if ( code_tag !== 0 ){
var script = document.createElement('script'); var script = document.createElement('script');
var style_sheet = document.createElement('link'); var style_sheet = document.createElement('link');
script.type = 'text/javascript'; script.type = 'text/javascript';
script.src = '/common/prisim/prism.js'; script.src = '/common/prism/prism.js';
style_sheet.type = 'text/css'; style_sheet.type = 'text/css';
style_sheet.href = '/common/prisim/prism.css'; style_sheet.href = '/common/prism/prism.css';
style_sheet.rel = 'stylesheet'; style_sheet.rel = 'stylesheet';
document.head.appendChild(script); document.head.appendChild(script);
document.head.appendChild(style_sheet); document.head.appendChild(style_sheet);
} }
if ( document.getElementById("font_btns") ){//Show the font selection buttons. //Sets the displayed fontsize.
//This functionality won't work without JavaScript enabled. For this reason the
//buttons won't be shown if this script isn't run.
if ( document.getElementById("font_btns") ){//Show the font selection buttons.
document.getElementById("font_btns").style.display = 'inline'; document.getElementById("font_btns").style.display = 'inline';
var font_size = read_cookie("font_size"); var font_size = read_cookie("font_size");//reads a saved value for fontsize from the site cookie
if ( font_size != "" || font_size != "medium" ){ if ( font_size != "" || font_size != "medium" ){
font_set(font_size); font_set(font_size);//insure a sane default
} }
} }
if ( document.getElementById("search_inputs") ){//Show the search box and button on the tags page. if ( document.getElementById("search_inputs") ){//Show the search box and button on the tags page.
@@ -43,7 +48,7 @@ function format_page(){//Set the title of the page based on the main header, <h1
}); });
} }
} }
function font_set(size_to_set){ function font_set(size_to_set){//Set a cookie to remember the fontsize selection.
document.getElementById("article").style.fontSize = size_to_set; document.getElementById("article").style.fontSize = size_to_set;
set_cookie("font_size",size_to_set); set_cookie("font_size",size_to_set);
} }
@@ -52,7 +57,7 @@ function focus_element(element_id){
ele_to_focus.focus(); ele_to_focus.focus();
ele_to_focus.select(); ele_to_focus.select();
} }
function tag_search(){ function tag_search(){//searches in the avaliable tags and displays all articles matching the searched tag.
var search_input, filter, tag_list, li, a, i; var search_input, filter, tag_list, li, a, i;
search_input = document.getElementById("tag_sort"); search_input = document.getElementById("tag_sort");
filter = search_input.value.toUpperCase(); filter = search_input.value.toUpperCase();
@@ -66,9 +71,8 @@ function tag_search(){
li[i].style.display = "none"; li[i].style.display = "none";
} }
} }
} }
function title_search(){ function title_search(){//searches for matches in the article titles rather than tags. Allows more granular search
var search_input, filter, tag_list, li_list, ol, a, i; var search_input, filter, tag_list, li_list, ol, a, i;
search_input = document.getElementById("title_sort"); search_input = document.getElementById("title_sort");
filter = search_input.value.toUpperCase(); filter = search_input.value.toUpperCase();
@@ -88,7 +92,7 @@ function title_search(){
} }
} }
function search_toggle(){ function search_toggle(){//Toggles if the unit being sorted on is the article title or tag
if (document.getElementById("tag_sort")){ if (document.getElementById("tag_sort")){
document.getElementById("tag_sort").placeholder = "Search Titles"; document.getElementById("tag_sort").placeholder = "Search Titles";
document.getElementById("tag_sort").onkeyup = function() {title_search()}; document.getElementById("tag_sort").onkeyup = function() {title_search()};
@@ -107,10 +111,10 @@ function search_toggle(){
focus_element("tag_sort"); focus_element("tag_sort");
} }
} }
function set_cookie(prop_name, prop_value){ function set_cookie(prop_name, prop_value){//sets a passed cookie property and value.
document.cookie = prop_name + "=" + prop_value + ";path=/;SameSite=Strict;"; document.cookie = prop_name + "=" + prop_value + ";path=/;SameSite=Strict;";
} }
function read_cookie(cname){ function read_cookie(cname){//reads a property value
let prop_name = cname + '='; let prop_name = cname + '=';
let decoded_cookie = decodeURIComponent(document.cookie); let decoded_cookie = decodeURIComponent(document.cookie);
let split_cookie = decoded_cookie.split(';'); let split_cookie = decoded_cookie.split(';');
@@ -125,11 +129,11 @@ function read_cookie(cname){
} }
return ""; return "";
} }
function printDiv(divName) { function printDiv(divName) {//Formats the page for printing.
var printContents = document.getElementById(divName).innerHTML; var printContents = document.getElementById(divName).innerHTML;
w=window.open(); w=window.open();
w.document.write(printContents); w.document.write(printContents);
w.print(); w.print();
w.close(); w.close();
} }
window.onload = format_page; window.onload = format_page;//loades the page formatting script.

View File

@@ -1,4 +1,5 @@
<?php <?php
//Parses it's passed input to convert it to a month name.
function get_month_name($passed_var){ function get_month_name($passed_var){
switch($passed_var){ switch($passed_var){
case "01": case "01":

View File

@@ -1,5 +1,6 @@
<?php <?php
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/get_month_name.php'); //Sets the proper level 1 heading for the folder.
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/get_month_name.php');
$current_dir = basename(getcwd()); $current_dir = basename(getcwd());
$named_month = get_month_name($current_dir); $named_month = get_month_name($current_dir);
if ( $named_month == "blog") { if ( $named_month == "blog") {

View File

@@ -1,7 +1,8 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-US"> <html lang="en-US">
<?php <?php
function Title() { //Sets the page title based on the name of the current directory
function Title() {//Needs cleanup.
//~ $new_title = $_SERVER['REQUEST_URI']; //~ $new_title = $_SERVER['REQUEST_URI'];
//~ $new_title = preg_replace("/^^\//i", "", $new_title); //~ $new_title = preg_replace("/^^\//i", "", $new_title);
@@ -28,6 +29,7 @@
<head> <head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<?php <?php
//If a tags file is present parse it and add any tags found to the renderd page's metadata.
if(file_exists('tags')){ if(file_exists('tags')){
$tag_data_raw = fopen('tags',"r"); $tag_data_raw = fopen('tags',"r");
$tag_data = fread($tag_data_raw, filesize('tags')); $tag_data = fread($tag_data_raw, filesize('tags'));
@@ -38,10 +40,10 @@
?> ?>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title><?php $title = Title(); echo $title;?></title> <title><?php $title = Title(); echo $title;?></title>
<link href="/common/styles.css?v=<?php echo date('his'); ?>" type="text/css" rel="stylesheet"/> <link href="/common/css/styles.css?v=<?php echo date('his'); ?>" type="text/css" rel="stylesheet"/>
<link href="/common/jmenu.css?v=<?php echo date('his'); ?>" type="text/css" rel="stylesheet"/> <link href="/common/css/jmenu.css?v=<?php echo date('his'); ?>" type="text/css" rel="stylesheet"/>
<link href="/common/print.css?v=<?php echo date('his'); ?>" type="text/css" media="print" rel="stylesheet"/> <link href="/common/css/print.css?v=<?php echo date('his'); ?>" type="text/css" media="print" rel="stylesheet"/>
<script type="text/javascript" src="/common/page_format.js?v=<?php echo date('his'); ?>"></script> <script type="text/javascript" src="/common/js/page_format.js?v=<?php echo date('his'); ?>"></script>
</head> </head>
<body lang="en-US"> <body lang="en-US">
<div class="body" id="body"> <div class="body" id="body">

14
common/php/index.php Normal file
View File

@@ -0,0 +1,14 @@
<?php
//The common file used to render pages on the blog.
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/header.php');
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/menu.php');
//Looks for an article.md to see if the current directory is an article or not
//If it is not then it is a menu page.
if (file_exists('article.md')){
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/md_read.php');
} else {
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/h1_month.php');
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/page_menu.php');
}
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/footer.php');
?>

View File

@@ -37,5 +37,5 @@
} }
echo "</ul>\n</div>\n"; echo "</ul>\n</div>\n";
} }
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/modal.php'); include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/modal.php');
?> ?>

View File

@@ -2,8 +2,9 @@
<div class="pmenu"> <div class="pmenu">
<ul><li><a href=/>Home</a></li></ul> <ul><li><a href=/>Home</a></li></ul>
<?php <?php
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/get_month_name.php'); include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/get_month_name.php');
//Removes the number used to keep articles in post order from the displayed title.
function remove_sorting_number($link_title){ function remove_sorting_number($link_title){
$first_three = mb_substr($link_title, 0, 3,"UTF-8"); $first_three = mb_substr($link_title, 0, 3,"UTF-8");
@@ -31,14 +32,14 @@ if (file_exists($dir) && is_dir($dir) ) {
$file_array[] = $file; $file_array[] = $file;
} }
} }
foreach($file_array as $file) { foreach($file_array as $file) {//Renders the folder names as more readable titles.
$_replace = array('.php', '.html', '.htm'); $_replace = array('.php', '.html', '.htm');//Remove file extensions from webpages.
$link_title = str_replace('_',' ',$file); $link_title = str_replace('_',' ',$file);//Remove undersores and replace them with spaces
$link_title = str_replace($_replace,'',$link_title); $link_title = str_replace($_replace,'',$link_title);
$link_title = ucwords($link_title); $link_title = ucwords($link_title);//Set the first letter of each word to upercase.
$link_title = get_month_name($link_title); $link_title = get_month_name($link_title);//
$link_title = remove_sorting_number($link_title); $link_title = remove_sorting_number($link_title);//Removes the number used to keep articles in post order from the displayed title.
echo("<ul><li><a href='$file'> $link_title </a></li></ul>\n"); echo("<ul><li><a href='$file'> $link_title </a></li></ul>\n");//Output the result.
} }
} }
else { else {

View File

@@ -1,6 +1,6 @@
<?php <?php
include ($_SERVER['DOCUMENT_ROOT'].'/common/header.php'); include ($_SERVER['DOCUMENT_ROOT'].'/common/php/header.php');
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/menu.php'); include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/menu.php');
?> ?>
<article> <article>
<h1 title="Homepage for <?php $site = $_SERVER['SERVER_NAME'];echo"$site";?>">Homepage</h1> <h1 title="Homepage for <?php $site = $_SERVER['SERVER_NAME'];echo"$site";?>">Homepage</h1>
@@ -11,5 +11,5 @@ include_once ($_SERVER['DOCUMENT_ROOT'].'/common/menu.php');
</div> </div>
</article> </article>
<?php <?php
include ($_SERVER['DOCUMENT_ROOT'].'/common/footer.php'); include ($_SERVER['DOCUMENT_ROOT'].'/common/php/footer.php');
?> ?>

View File

@@ -1,7 +1,7 @@
<?php <?php
require ($_SERVER['DOCUMENT_ROOT'].'/common/vendor/autoload.php'); require ($_SERVER['DOCUMENT_ROOT'].'/common/vendor/autoload.php');
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/header.php'); include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/header.php');
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/menu.php'); include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/menu.php');
#Markdown parseing code. #Markdown parseing code.
$MD_Parser = new Parsedown(); $MD_Parser = new Parsedown();
$MD_Path = "gplv2.md"; $MD_Path = "gplv2.md";
@@ -10,5 +10,5 @@
echo "<article>".$MD_Parser->text($MD_Text); echo "<article>".$MD_Parser->text($MD_Text);
fclose($MD_File); fclose($MD_File);
echo "<p>A text version of this document can be found <a href=\"/GPLv2.txt\">here</a>.</p>\n</article>"; echo "<p>A text version of this document can be found <a href=\"/GPLv2.txt\">here</a>.</p>\n</article>";
include ($_SERVER['DOCUMENT_ROOT'].'/common/footer.php'); include ($_SERVER['DOCUMENT_ROOT'].'/common/php/footer.php');
?> ?>

View File

@@ -1,7 +1,7 @@
<?php <?php
require ($_SERVER['DOCUMENT_ROOT'].'/common/vendor/autoload.php'); require ($_SERVER['DOCUMENT_ROOT'].'/common/vendor/autoload.php');
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/header.php'); include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/header.php');
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/menu.php'); include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/menu.php');
echo "<article>"; echo "<article>";
?> ?>
<p>The MIT License (MIT)</p> <p>The MIT License (MIT)</p>
@@ -15,5 +15,5 @@
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p> <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>
<?php <?php
echo "<p>A text version of this document can be found <a href=\"/license/MIT.txt\">here</a>.</p>\n</article>"; echo "<p>A text version of this document can be found <a href=\"/license/MIT.txt\">here</a>.</p>\n</article>";
include ($_SERVER['DOCUMENT_ROOT'].'/common/footer.php'); include ($_SERVER['DOCUMENT_ROOT'].'/common/php/footer.php');
?> ?>

View File

@@ -3,8 +3,8 @@ function display_file($license_file){
$out = file_get_contents($license_file); $out = file_get_contents($license_file);
echo "<pre><code>".$out."</code></pre>"; echo "<pre><code>".$out."</code></pre>";
} }
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/header.php'); include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/header.php');
include_once ($_SERVER['DOCUMENT_ROOT'].'/common/menu.php'); include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/menu.php');
?> ?>
<article> <article>
<p>A summery of all licenses that apply to this website.</p> <p>A summery of all licenses that apply to this website.</p>
@@ -57,4 +57,4 @@ You can learn more on <a href="https://prismjs.com/">prismjs.com</a>.</p></block
Prism is <a href="/license/MIT.php">MIT Licensed</a>.</p> Prism is <a href="/license/MIT.php">MIT Licensed</a>.</p>
<?php display_file("MIT_License.txt"); ?> <?php display_file("MIT_License.txt"); ?>
</article> </article>
<?php include_once ($_SERVER['DOCUMENT_ROOT'].'/common/footer.php');?> <?php include_once ($_SERVER['DOCUMENT_ROOT'].'/common/php/footer.php');?>