Skip to content

Commit

Permalink
Rewrite from scratch based on TinyIB
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Mar 30, 2018
1 parent bd67d18 commit 27540dd
Show file tree
Hide file tree
Showing 353 changed files with 6,226 additions and 18,957 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,5 @@ pip-log.txt
# Smarty
lexer/*.php
lexer/*.out

config.php
28 changes: 11 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@ SecretChan is **not production ready**

Fuck, it doesn't even work.

Overhaul Time
---------------------------
It's not uncommon for me to crack the shits and recode stuff. I had forgotten about this repo and started recoding this from scratch to use a MySQL database. Originally I wanted to avoid that, however it's much more economical in the long run to do so, as it'll solve a shit tonne of issues if it ever needs to be sharded.

Anyway, it's all basic shit for now. Login system should be easy to code :)

In addition to all this, I haven't written a database installer. So you /cannot/ get this working.

About "SecretChan"
-----------------------------
I had absolutely no idea what to call this little "project". The background here is that I wanted a project to learn a templating system. Smarty was my choice as I found it really easy to pick up during those quiet moments at work.
Expand All @@ -20,15 +12,17 @@ This is a "complicated" chan. "complexchan" might have been a better name! Orig

Here we have the basis of SecretChan.

I originally coded this from scratch but it took too long so I started using TinyBoard. This sufficed until I realized my web traffic was being monitored. I hacked a login system into TinyIB by forcing imgboard.php to create an index.php instead of index.html, then added a simple check for a php session and a login box to create the session. This would keep people away from the php side but not the image side.

Here we have the birth of SecretChans final form.

I have been playing with Bootstrap lately, so I used Smarty to serve a bootstrap template which will serve as the core of the website. All sections of the website will be handled by PHP, including images. This opens the avenue for using imagemagik to fuck with images but it also means increasd processing times for image load. The flip side is that I can set a password for each board so we can prevent prying eyes from seeing what we have hosted. I consider this a TinyIB rewrite as I've based it off the TinyIB database however I have not used it's code. Everything here has been drunkenly rewritten myself.

Things I need to do
---------------------------

1. Write functions for posting to a board
2. Write function for retrieving posts
3. ~~Figure out recursion in Smarty~~
4. ~~Figure out what I'm doing visa vi filenames~~
5. ~~Figure out how to do a "global template" ~~
6. Code the login system
7. Steal some sort of ACL schema off the internet
8. Steal a fancy login form from the internet
9. Hack that farm login form into a fancy posting form
1. A lot.
2. Login system based on database
3. Trip functions
4. Image processing - thumbnail generation and file upload
5. Full bootstrap display
38 changes: 38 additions & 0 deletions board.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
* Example Application
*
* @package Example-application
*/

require 'libs/Smarty.class.php';
$con = include('db.php');

function getPosts($parent, $board)
{
global $con;
$sql = 'select * from b_posts where parent = :parent and board = :board';
$q = $con->prepare($sql);
$q->bindParam(':parent', $parent);
$q->bindParam(':board', $board);
$q->execute();
return $q->fetchAll();
}

$posts = getPosts(0, 'b');

$smarty = new Smarty;

//$smarty->force_compile = true;
$smarty->debugging = false;
$smarty->caching = false;
$smarty->cache_lifetime = 120;


$smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"),
array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));

$smarty->assign('board', 'b');
$smarty->assign("posts", $posts);

$smarty->display('boardhome.tpl');
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
<?php
/* Smarty version 3.1.30-dev/52, created on 2016-03-08 04:31:27
from "/var/www/thevault/demo/templates/index.tpl" */
/* Smarty version 3.1.30, created on 2018-03-29 04:16:56
from "/home/nukeground/public_html/custom/templates/index.tpl" */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
'version' => '3.1.30-dev/52',
'unifunc' => 'content_56de559f8e03f9_88498294',
'version' => '3.1.30',
'unifunc' => 'content_5abc68b8da50f1_89698797',
'has_nocache_code' => true,
'file_dependency' =>
array (
'22b44164c36bd7c2e5c0fbaa84c1c61277881d45' =>
'ff8a2eea0c7633669d60b1d0ad40b8f83ab4650e' =>
array (
0 => '/var/www/thevault/demo/templates/index.tpl',
1 => 1457110450,
0 => '/home/nukeground/public_html/custom/templates/index.tpl',
1 => 1522296941,
2 => 'file',
),
'14cde0b65e096cccf7ab33f10e73f1d66a1c91d7' =>
'13f480ff618cc2fdc6b42726e9c47c959eef186c' =>
array (
0 => '/var/www/thevault/demo/templates/header.tpl',
1 => 1457110450,
0 => '/home/nukeground/public_html/custom/templates/header.tpl',
1 => 1522296941,
2 => 'file',
),
'7a4523751966aff83c8a10128e31325542a6088d' =>
'0279d17f497b7faf13336a2c347e587da1bb2431' =>
array (
0 => '/var/www/thevault/demo/templates/footer.tpl',
1 => 1457110450,
0 => '/home/nukeground/public_html/custom/templates/footer.tpl',
1 => 1522296941,
2 => 'file',
),
),
'cache_lifetime' => 120,
),true)) {
function content_56de559f8e03f9_88498294 (Smarty_Internal_Template $_smarty_tpl) {
function content_5abc68b8da50f1_89698797 (Smarty_Internal_Template $_smarty_tpl) {
?>

<HTML>
Expand All @@ -47,11 +47,11 @@ function content_56de559f8e03f9_88498294 (Smarty_Internal_Template $_smarty_tpl)
<b>
Title: Welcome To Smarty!
</b>
The current date and time is 2016-03-08 04:31:27
The current date and time is 2018-03-29 04:16:56

The value of global assigned variable $SCRIPT_NAME is /demo/index.php
The value of global assigned variable $SCRIPT_NAME is /custom/index.php

Example of accessing server environment variable SERVER_NAME: v108.org
Example of accessing server environment variable SERVER_NAME: nukeground.com

The value of {$Name} is <b><?php echo $_smarty_tpl->tpl_vars['Name']->value;?>
</b>
Expand Down Expand Up @@ -90,7 +90,7 @@ function content_56de559f8e03f9_88498294 (Smarty_Internal_Template $_smarty_tpl)
<p>

testing strip tags
<table border=0> <tr> <td> <A HREF="/demo/index.php"> <font color="red">This is a test </font> </A> </td> </tr> </table>
<table border=0><tr><td><A HREF="/custom/index.php"><font color="red">This is a test </font></A></td></tr></table>

</PRE>

Expand Down Expand Up @@ -119,7 +119,7 @@ function content_56de559f8e03f9_88498294 (Smarty_Internal_Template $_smarty_tpl)
<option value="5">05</option>
<option value="6">06</option>
<option value="7">07</option>
<option value="8" selected="selected">08</option>
<option value="8">08</option>
<option value="9">09</option>
<option value="10">10</option>
<option value="11">11</option>
Expand All @@ -140,7 +140,7 @@ function content_56de559f8e03f9_88498294 (Smarty_Internal_Template $_smarty_tpl)
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="29" selected="selected">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>
Expand Down Expand Up @@ -195,7 +195,7 @@ function content_56de559f8e03f9_88498294 (Smarty_Internal_Template $_smarty_tpl)
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="16" selected="selected">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
Expand All @@ -210,7 +210,7 @@ function content_56de559f8e03f9_88498294 (Smarty_Internal_Template $_smarty_tpl)
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31" selected="selected">31</option>
<option value="31">31</option>
<option value="32">32</option>
<option value="33">33</option>
<option value="34">34</option>
Expand Down Expand Up @@ -268,7 +268,7 @@ function content_56de559f8e03f9_88498294 (Smarty_Internal_Template $_smarty_tpl)
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27" selected="selected">27</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
Expand Down Expand Up @@ -297,7 +297,7 @@ function content_56de559f8e03f9_88498294 (Smarty_Internal_Template $_smarty_tpl)
<option value="53">53</option>
<option value="54">54</option>
<option value="55">55</option>
<option value="56">56</option>
<option value="56" selected="selected">56</option>
<option value="57">57</option>
<option value="58">58</option>
<option value="59">59</option>
Expand Down
11 changes: 11 additions & 0 deletions config.php.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

return array(
"dbuser" => "user",
"dbpass" => "pass",
"dbhost" => "host",
"dbname" => "name",
"sitename" => "CHAN L"
);

?>
5 changes: 0 additions & 5 deletions configs/test.conf

This file was deleted.

24 changes: 24 additions & 0 deletions css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.post
{
width: 300px;
height: 100px;
margin: 10px;
overflow:hidden;
}

.post img
{
float:left;
min-height: 100%;
max-width: 100%;
}

.post h1
{
float:left;
}

.imageview img
{
margin: 0;
}
48 changes: 0 additions & 48 deletions css/reset.css

This file was deleted.

79 changes: 0 additions & 79 deletions css/style.css

This file was deleted.

Loading

0 comments on commit 27540dd

Please sign in to comment.