From: David Polakovic Date: Fri, 8 Sep 2023 22:32:39 +0000 (+0200) Subject: new index, blog, library, .htaccess X-Git-Url: http://git.dpolakovic.space/?a=commitdiff_plain;h=314dd4be4c83ba59fd8092da8118f3ce6219dab0;p=my-website new index, blog, library, .htaccess --- diff --git a/.htaccess b/.htaccess index b705e0b..fcc6cd4 100644 --- a/.htaccess +++ b/.htaccess @@ -1,16 +1,19 @@ -RewriteEngine on -#redirect /file.php to /file +RewriteEngine on + RewriteCond %{THE_REQUEST} \s/([^.]+)\.php [NC] RewriteRule ^ /%1 [NE,L,R] -# now we will internally map /file to /file.php RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)/?$ /$1.php [L] -RewriteEngine on -#redirect /file.html to /file + RewriteCond %{THE_REQUEST} \s/([^.]+)\.html [NC] RewriteRule ^ /%1 [NE,L,R] -# now we will internally map /file to/ file.html RewriteCond %{REQUEST_FILENAME}.html -f RewriteRule ^(.*)/?$ /$1.html [L] + +RewriteCond %{REQUEST_URI} !^/blogs/ [NC] +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule ^(.*)$ blogs/$1 [L] + diff --git a/README.txt b/README.txt old mode 100644 new mode 100755 index 7083b7d..32a7542 --- a/README.txt +++ b/README.txt @@ -1,9 +1,24 @@ my-website +A simple website that I run. Check it out on https://dpolakovic.space Copyright 2023, David Polakovic ABOUT: -This is simple website that I run. You can copy it for sure, -but read the licence first. +This is my static, old school, 90's, web 1.0 website. I despise the responsiveness, +mobile design and client side computing. So I made html/php site to occupy little +piece of cyberspace. Here is description of the files: + +.htaccess - hides file extensions in address bar +index.php - the "About page" with contacts (not much going on here) +blog.php - here I place my toughts which could be sorted by form (blogs or tweets) +lib.php - my book library in one table +gpg.html - page with my email gpg key +test.html - default test page for troubleshooting new features +both .txt files are sources for php sites with hand written content. +blog/pics/ - pictures for blogs +blogs/blog-list.html - source for tweets and links to blogs for blog.php +blogs/blog-template.html - default template for new blogs +Pictures/ - directory with all pictures for sites (except the blogs) +Styles/* - dir with font I use and CSS style file LICENSE: https://www.gnu.org/licenses/gpl-3.0.en.html diff --git a/Styles/styles.css b/Styles/styles.css index deab5d7..e8d15bb 100755 --- a/Styles/styles.css +++ b/Styles/styles.css @@ -1,3 +1,4 @@ + /* Styles.css this is a file for setting visual styles of the web page I am no webdesigner so the comments are rather simple @@ -262,3 +263,5 @@ body { color: inherit; text-decoration: inherit; } +/* styles.css */ + diff --git a/blog.php b/blog.php old mode 100755 new mode 100644 index 49345b1..fa574d7 --- a/blog.php +++ b/blog.php @@ -28,7 +28,7 @@ @@ -43,79 +43,162 @@
After eating and breathing, expressing opinions on the internet is the most important human need. Here are some of mine that occupied my mind - for more than few seconds. + for more than few seconds (but not much more). You can sort them to see + bigger blogs or smaller, more random "tweets".

'; - } - } - - // function to print file line by line in reverse order - function printFileReversed($filename) - { - $lines = file($filename); - $reversedLines = array_reverse($lines); - foreach ($reversedLines as $line) - { - echo $line . '
'; - } - } - - // function to print file line by line which has "Edit" in them - function printFileEdited($filename) - { - $file = fopen($filename, "r"); + + + // Function for front page, shows latest 5 entries + function printFile($filename) { + $lines = file($filename); + $count = 0; // counter for lines + echo '
'; // a container for the lines + + foreach ($lines as $line) { + echo $line . '
'; + $count++; + + // break the loop after displaying 5 lines + if ($count >= 5) { + break; + } + } + + echo '
'; + } + + + // Prints latest 15 tweets and offers user to see them all + function printFileTweets($filename) { + $lines = file($filename); + $count = 0; + echo '
'; + + foreach ($lines as $line) { + // check for word "tweet" in the lines + if (strpos($line, 'tweet') !== false) { + echo $line . '
'; // Display the line if it contains 'foo' + $count++; + + if ($count >= 15) { + break; // Break the loop after displaying 15 matching lines + } + } + } + + if ($count >= 15) { + // Display a clickable link if there are more than 15 matching lines + echo '
Check the rest...
'; + } + + echo '
'; + } + + // Prints all tweets + function printFileAllTweets($filename) { + $file = fopen($filename, "r"); + while (($line = fgets($file)) !== false) { - if (strpos($line, 'Edited') !== false) - { + // check for word "tweet" in the lines + if (strpos($line, 'tweet') !== false) { echo $line . '
'; - } - } - fclose($file); - } + } + } + fclose($file); + } + + + // Prints latest 15 blogs and offers user to see them all + function printFileBlogs($filename) { + $lines = file($filename); + $count = 0; + echo '
'; + + foreach ($lines as $line) { + // check for word "blog-prev" in the lines + if (strpos($line, 'blog-prev') !== false) { + echo $line . '
'; // Display the line if it contains 'foo' + $count++; + + if ($count >= 15) { + break; // Break the loop after displaying 15 matching lines + } + } + } + + if ($count >= 15) { + // Display a clickable link if there are more than 15 matching lines + echo '
Check the rest...
'; + } + echo '
'; + } + + + // Prints all blogs + function printFileAllBlogs($filename) { + $file = fopen($filename, "r"); + + while (($line = fgets($file)) !== false) { + // check for word "blog-prev" in the lines + if (strpos($line, 'blog-prev') !== false) { + echo $line . '
'; + } + } + fclose($file); + } ?>

Sort:   - New first   - Old first   - Edited only + + Tweets   + Blogs
-

-

+


Current value of key: $key
"; - if ($sort == "new") - { - printFile("./blogs/blog-list.html"); + //debug + //echo "
Current value of key: $key
"; + + // Print file sorted by user input + + // save path to the file into variable... + $filename = './blogs/blog-list.html'; + + // default - main page + if ($sort == "all") { + printFile($filename); + } + + // show first 15 tweets + if ($sort == "tweets") { + printFileTweets($filename); + } + + // show first 15 blogs + if ($sort == "blogs") { + printFileBlogs($filename); } - if ($sort == "old") - { - printFileReversed("./blogs/blog-list.html"); + + // show all tweets + if ($sort == "tweetsfull") { + printFileAllTweets($filename); + } + + // show all blogs + if ($sort == "blogsfull"){ + printFileAllBlogs($filename); } - if ($sort == "edit") - { - printFileEdited("./blogs/blog-list.html"); - } ?> -


@@ -126,6 +209,7 @@ CC BY-NC-ND 3.0 - this site is free software +

diff --git a/blogs/blog-list.html b/blogs/blog-list.html index 0ba85c5..614ecc6 100755 --- a/blogs/blog-list.html +++ b/blogs/blog-list.html @@ -1 +1,2 @@ +
01.01.2000
blah blah blah
text
  BLOG TITLE
  DATE
  text text text
diff --git a/blogs/blog-template.html b/blogs/blog-template.html index 6c391af..b298344 100755 --- a/blogs/blog-template.html +++ b/blogs/blog-template.html @@ -4,7 +4,7 @@ - Y2K38 bug + TITLE HERE @@ -31,7 +31,7 @@

-

Y2K38 bug

+

TITLE HERE

00.00.0000 - text text text

diff --git a/clue.php b/clue.php new file mode 100644 index 0000000..fb74f16 --- /dev/null +++ b/clue.php @@ -0,0 +1,111 @@ + + + + + + + dpolakovic.space + + + + + + + + + + +

+ + + + + +
+

+

My library

+ Tell me what you read and I will tell you who you are. +
+
+ These are books I own and read. I tend to organize my library by topics + of the books, time I bought them, color of the cover, mood and other + subjective, chaotic and random rules. All of these are physical copies + of which almost half is from used bookstores. +

+

+ Also, only ~5 million people speak my mother tongue, Slovak, so I + deeply value every opportunity I get to read a translated book. And since + most of my books are in Slovak language the table includes both English + title and traslation title as well. +

+
+ '; + + // Process each row + foreach ($rows as $key => $row) { + + // Set the "-" as escape char for new column + $columns = explode('-', $row); + + // Determine whether this is the first row + $isFirstRow = ($key === 0); + + // Start a new table row + echo ''; + + // Process each column and create table cells + foreach ($columns as $column) { + + // Use for the first row, for the rest + $cellTag = $isFirstRow ? 'th' : 'td'; + // again... sorry for the styles + echo '<' . $cellTag . ' style="padding: 2px; border: 1px solid grey">' . htmlspecialchars($column) . ''; + } + + // End the table row + echo ''; + } + + // End the HTML table + echo ''; + ?> +

+
+ + + +

+ + + diff --git a/cypher.html b/cypher.html new file mode 100755 index 0000000..7805add --- /dev/null +++ b/cypher.html @@ -0,0 +1,20 @@ + + + + + + + ? + + + + +
+






+
+

///revives.hours.hardly

+
+
+ + + diff --git a/dir.html b/dir.html deleted file mode 100755 index c709ff7..0000000 --- a/dir.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - dpolakovic.space - - - - - - - - - - - - - - - - -
-

-

My web directory

- Let's explore the Web. -
-
- Since the online space is vast and still expanding, it is good practice for - surfers to share links between each other in web directories like this one. - So here are links I thought you might find useful. -

-

-    Free software directory - - a collaborative catalog of free software
-    Cidr.xyz - - when you are setting up network and you don't want to die over subnet - tables [3]
-    CloudTube - - free software instance of youtube.com
-    Floppydisk.com - - new and refurbished floppies for okay prices [3]
-    Perl monks - - best place to seek help and wisdom in Perl
-    Web buttons - - here is list of 4000+ web buttons from Cyber Vanguards website
-    WinWorld - - online museum/library of vintage software
-    UESP Wiki - - everything I ever needed for TES III Morrowind I found here [2]
-

-

- Some of these websites contains "allergens"
- [1] - advertisements, - [2] - unnecessary cookies, - [3] - proprietary javascript -

-
-
- - - -

- - - diff --git a/index.php b/index.php old mode 100755 new mode 100644 index d7555c0..a2db92f --- a/index.php +++ b/index.php @@ -26,7 +26,8 @@ @@ -43,7 +44,7 @@ David and CC BY-NC-ND 3.0
this site is free software - + +
+
+ ..-. .. -. -.. / - .... . / -... .. --. --. . ... - / -.. --- - / .. -. / .-.. .. -... .-. .- .-. -.-- +
+
diff --git a/lib.php b/lib.php new file mode 100644 index 0000000..eaee183 --- /dev/null +++ b/lib.php @@ -0,0 +1,112 @@ + + + + + + + dpolakovic.space + + + + + + + + + + + + + + + + +
+

+

My library

+ Tell me what you read and I will tell you who you are. +
+
+ These are books I own and read. I tend to organize my library by topics + of the books, time I bought them, color of the cover, mood and other + subjective, chaotic and random rules. All of these are physical copies + of which almost half is from used bookstores. +

+

+ Also, only ~5 million people speak my mother tongue, Slovak, so I + deeply value every opportunity I get to read a translated book. And since + most of my books are in Slovak language the table includes both English + title and traslation title as well. +

+
+ '; + + // Process each row + foreach ($rows as $key => $row) { + + // Set the "-" as escape char for new column + $columns = explode('-', $row); + + // Determine whether this is the first row + $isFirstRow = ($key === 0); + + // Start a new table row + echo ''; + + // Process each column and create table cells + foreach ($columns as $column) { + + // Use for the first row, for the rest + $cellTag = $isFirstRow ? 'th' : 'td'; + // again... sorry for the styles + echo '<' . $cellTag . ' style="padding: 2px; border: 1px solid grey">' . htmlspecialchars($column) . ''; + } + + // End the table row + echo ''; + } + + // End the HTML table + echo ''; + ?> +

+
+ + + +

+ + + diff --git a/lib.txt b/lib.txt new file mode 100644 index 0000000..6426dc7 --- /dev/null +++ b/lib.txt @@ -0,0 +1,2 @@ +Lng - Author - English title - Translation title (if different) * +AA - Jon Doe - A book - Kniha * diff --git a/rnd.html b/rnd.html deleted file mode 100755 index 33307f6..0000000 --- a/rnd.html +++ /dev/null @@ -1,21 +0,0 @@ -my favorite junk food is fish sticks. -my favorite dinosaur is pterodactyl. -my favorite drink is White russian (and yes, it happened after I've seen Big Lebowsky). -my favorite color is yellow. -I still write "www" in address bar. -I unironically liked The Phantom Menace. -I have one tomcat. -I enjoy hacking board games. -I willingly play healers in D&D. -I prefer Star Trek TNG over the Original Series. -I bn gbo pg dszquphsbgz ;-) . -I still use shortcuts on desktop. -I prefer pencils over pens. -I still use floppy disks for backups. -I don't drink coffe, but sometimes I drink mate tea. -I use everything except bookmarks for bookmarking. -I think way too much about time travel. -I own ~200g of meteorites. -I never sit on swivel chairs. -I don't use Arch btw (I use Trisquel!). -my favorite ice cream flavor is vanilla. diff --git a/rnd.txt b/rnd.txt new file mode 100644 index 0000000..ada6b59 --- /dev/null +++ b/rnd.txt @@ -0,0 +1,2 @@ +example. +and here is another example. diff --git a/test.html b/test.html index dbc2583..fad1331 100755 --- a/test.html +++ b/test.html @@ -28,7 +28,8 @@