From 298c2990e6b039b9d8e7cf746fe70b6982b8182a Mon Sep 17 00:00:00 2001 From: Kamil Kaminski Date: Mon, 15 Dec 2014 20:14:14 -0600 Subject: nuke windows file endings, add notes and ideas --- README.md | 3 + ToDo.txt | 11 ++ edittext.php | 43 +++--- files/password | 1 + index.php | 193 +++++++++++++------------- js/editinplace.php | 88 ++++++------ js/rte.php | 4 +- plugins/README.md | 1 + themes/blue/style.css | 376 +++++++++++++++++++++++++------------------------- themes/blue/theme.php | 80 +++++------ 10 files changed, 411 insertions(+), 389 deletions(-) create mode 100644 README.md create mode 100644 ToDo.txt create mode 100644 files/password create mode 100644 plugins/README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..9f372bc --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +[install] +- files/ needs to be writable by server or php + diff --git a/ToDo.txt b/ToDo.txt new file mode 100644 index 0000000..aacede6 --- /dev/null +++ b/ToDo.txt @@ -0,0 +1,11 @@ +- bootstrap3 theme: https://github.com/cristoslc/Wondertron +- ckeditor plugin: https://github.com/nishantmendiratta/wondercms_with_ckeditor/blob/master/plugins/ckeditor/index.php +- implement ability to create wordpress like categories and tags +- add ability to upload images--include php/jquery file uploader +- add ability to create custom page titles +- add ability to a page to use misc js libs via toggable flags, e.g. to create a slideshow page +- add ability to create menuless pages +- leverage popular html5 boilerplate heuristics +- leverage underscore.js, backbone.js, bpg and svg file formats, vegas.js +- conver codebase into oo php5 code + diff --git a/edittext.php b/edittext.php index 961cea4..6fbe00e 100644 --- a/edittext.php +++ b/edittext.php @@ -1,21 +1,22 @@ - + + diff --git a/files/password b/files/password new file mode 100644 index 0000000..0c8026e --- /dev/null +++ b/files/password @@ -0,0 +1 @@ +21232f297a57a5a743894a0e4a801fc3 \ No newline at end of file diff --git a/index.php b/index.php index 3ee6317..5ef4c92 100644 --- a/index.php +++ b/index.php @@ -1,94 +1,99 @@ - - * - $d[] array is used to save a copy of default values from $c[] - * - files/menu file is used nav list, each entry in there should match to that of slug - * - when ?login is called, the 'case 'loggedin':' calls login_form() and prints out a form - * - .htaccess rewrites urls in such way that /foo will get called as ?page=foo with exepction of ?login and ?logout - * - */ -require 'lib/fraktured.php'; - -ob_start(); -session_start(); - -$rp = isset($_REQUEST['page']) ? $_REQUEST['page'] : ''; /* request page e.g. ?page=hello */ -$hostname = '//' . $_SERVER['HTTP_HOST'] . str_replace($rp, '', $_SERVER['REQUEST_URI']); /* strchr($hostname, '?', TRUE) might be needed in other parts of code that generate links */ -$c['password'] = 'admin'; -$c['loggedin'] = false; -$c['page'] = 'home'; -$d['page']['home'] = "

Congratulations! Your website is now powered by FracturedCMS.


\nLogin to the admin panel with the 'Login' link in the footer. The password is admin.
\nChange the password as soon as possible.

\n\nClick on the content to edit and click outside to save it."; -$d['page']['example'] = "This is an example page.

\n\nTo add a new one, click on the existing pages (in the admin panel) and enter a new one below the others."; -$d['new_page']['admin'] = "Page " . str_replace('-', ' ', $rp) . " created.

\n\nClick here to start editing!"; -$d['new_page']['visitor'] = "Sorry, but " . str_replace('-', ' ', $rp) . " doesn't exist. :("; -$d['default']['content'] = "Click to edit!"; -$c['theme_name'] = "blue"; -$c['menu'] = "Home
\nExample"; -$c['title'] = 'Website title'; -$c['subside'] = "

ABOUT YOUR WEBSITE


\nYour photo, website description, contact information, mini map or anything else.

\n\n This content is static and is visible on all pages."; -$c['description'] = 'Your website description.'; -$c['keywords'] = 'enter, your website, keywords'; -$c['copyright'] = '©' . date('Y') . ' Foobar'; -$sig = "Powered by FracturedCMS"; -$hook['admin-richText'] = "rte.php"; - -foreach ($c as $key => $val) { - if ($key == 'content') - continue; - - $fval = @file_get_contents('files/' . $key); /* for each key attempt to load associated file */ - $d['default'][$key] = $c[$key]; /* save a copy of default values */ - - if ($fval) - $c[$key] = $fval; /* if file exists at files/*, use that instead of predefined default above */ - - switch ($key) { - case 'password': - if (!$fval) - $c[$key] = save_password($val); /* will save md5'ed 'admin' files/password, will happen initially */ - break; - case 'loggedin': - if (isset($_SESSION['l']) and $_SESSION['l'] == $c['password']) - $c[$key] = true; - if (isset($_REQUEST['logout'])) { - session_destroy(); - header('Location: ./'); - exit; - } - if (isset($_REQUEST['login'])) { - if (is_loggedin()) - header('Location: ./'); - login_form(); - } - $lstatus = (is_loggedin()) ? "Logout" : "Login"; - break; - case 'page': - if ($rp) /* if there's a request page e.g. ?page=hello */ - $c[$key] = $rp; - $c[$key] = get_slug($c[$key]); - if (isset($_REQUEST['login'])) - continue; - $c['content'] = @file_get_contents("files/" . $c[$key]); - if (!$c['content']) { - if (!isset($d['page'][$c[$key]])) { - header('HTTP/1.1 404 Not Found'); - $c['content'] = (is_loggedin()) ? $d['new_page']['admin'] : $c['content'] = $d['new_page']['visitor']; - } else { - $c['content'] = $d['page'][$c[$key]]; - } - } - break; - default: - break; - } -} - -load_plugins(); -require("themes/" . $c['theme_name'] . "/theme.php"); - -ob_end_flush(); -?> + + * - $d[] array is used to save a copy of default values from $c[] + * - files/menu file is used nav list, each entry in there should match to that of slug + * - when ?login is called, the 'case 'loggedin':' calls login_form() and prints out a form + * - .htaccess rewrites urls in such way that /foo will get called as ?page=foo with exepction of ?login and ?logout + * - appending markup to $hook[] cause it to be included in section + * - to load plugins the code includes plugins/%dir/index.php files + * - new pages can be added by logging in, going to Settings, and adding new entry for Navigation + * - $rp variable aka router stands for page request and its slug is that of a fname, when set, it will be used to load content of a page from disk + * + */ +require 'lib/fraktured.php'; + +ob_start(); +session_start(); + +$rp = isset($_REQUEST['page']) ? $_REQUEST['page'] : ''; /* request page e.g. ?page=hello */ +$hostname = '//' . $_SERVER['HTTP_HOST'] . str_replace($rp, '', $_SERVER['REQUEST_URI']); /* strchr($hostname, '?', TRUE) might be needed in other parts of code that generate links */ +$c['password'] = 'admin'; +$c['loggedin'] = false; +$c['page'] = 'home'; +$d['page']['home'] = "

Congratulations! Your website is now powered by FracturedCMS.


\nLogin to the admin panel with the 'Login' link in the footer. The password is admin.
\nChange the password as soon as possible.

\n\nClick on the content to edit and click outside to save it."; +$d['page']['example'] = "This is an example page.

\n\nTo add a new one, click on the existing pages (in the admin panel) and enter a new one below the others."; +$d['new_page']['admin'] = "Page " . str_replace('-', ' ', $rp) . " created.

\n\nClick here to start editing!"; +$d['new_page']['visitor'] = "Sorry, but " . str_replace('-', ' ', $rp) . " doesn't exist. :("; +$d['default']['content'] = "Click to edit!"; +$c['theme_name'] = "blue"; +$c['menu'] = "Home
\nExample"; +$c['title'] = 'Website title'; +$c['subside'] = "

ABOUT YOUR WEBSITE


\nYour photo, website description, contact information, mini map or anything else.

\n\n This content is static and is visible on all pages."; +$c['description'] = 'Your website description.'; +$c['keywords'] = 'enter, your website, keywords'; +$c['copyright'] = '©' . date('Y') . ' Foobar'; +$sig = "Powered by FracturedCMS"; +$hook['admin-richText'] = "rte.php"; + +foreach ($c as $key => $val) { + if ($key == 'content') + continue; + + $fval = @file_get_contents('files/' . $key); /* for each key attempt to load associated file */ + $d['default'][$key] = $c[$key]; /* save a copy of default values */ + + if ($fval) + $c[$key] = $fval; /* if file exists at files/*, use that instead of predefined default above */ + + switch ($key) { + case 'password': + if (!$fval) + $c[$key] = save_password($val); /* will save md5'ed 'admin' files/password, will happen initially */ + break; + case 'loggedin': + if (isset($_SESSION['l']) and $_SESSION['l'] == $c['password']) + $c[$key] = true; + if (isset($_REQUEST['logout'])) { + session_destroy(); + header('Location: ./'); + exit; + } + if (isset($_REQUEST['login'])) { + if (is_loggedin()) + header('Location: ./'); + login_form(); + } + $lstatus = (is_loggedin()) ? "Logout" : "Login"; + break; + case 'page': + if ($rp) /* if there's a request page e.g. ?page=hello */ + $c[$key] = $rp; + $c[$key] = get_slug($c[$key]); + if (isset($_REQUEST['login'])) + continue; + $c['content'] = @file_get_contents("files/" . $c[$key]); + if (!$c['content']) { + if (!isset($d['page'][$c[$key]])) { + header('HTTP/1.1 404 Not Found'); + $c['content'] = (is_loggedin()) ? $d['new_page']['admin'] : $c['content'] = $d['new_page']['visitor']; + } else { + $c['content'] = $d['page'][$c[$key]]; + } + } + break; + default: + break; + } +} + +load_plugins(); +require("themes/" . $c['theme_name'] . "/theme.php"); + +ob_end_flush(); +?> + diff --git a/js/editinplace.php b/js/editinplace.php index 612617a..0765d50 100644 --- a/js/editinplace.php +++ b/js/editinplace.php @@ -1,44 +1,44 @@ -/*! -Autosize v1.18.1 - 2013-11-05 -Automatically adjust textarea height based on user input. -(c) 2013 Jack Moore - http://www.jacklmoore.com/autosize -license: http://www.opensource.org/licenses/mit-license.php -*/ -(function(e){var t,o={className:"autosizejs",append:"",callback:!1,resizeDelay:10},i='"); - a.children(':first').focus().autosize().trigger('autosize.resize'); - } - changing = true; - }); - - $('.toggle').click(function(){ - $('.hide').toggle('200'); - }); -}); - -function nl2br(s){ - return (s + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1
$2'); -} - -function fieldSave(key,val){ - $.post('edittext.php', {fieldname: key, content: val}).done(function(data){ - if(key == 'theme_name'){location.reload(true);} - else if(val==''){$('#'+key).html($('#'+key).attr('title'));} - else {$("#"+key).html(data);} - changing = false; - }); -} \ No newline at end of file +/*! +Autosize v1.18.1 - 2013-11-05 +Automatically adjust textarea height based on user input. +(c) 2013 Jack Moore - http://www.jacklmoore.com/autosize +license: http://www.opensource.org/licenses/mit-license.php +*/ +(function(e){var t,o={className:"autosizejs",append:"",callback:!1,resizeDelay:10},i='"); + a.children(':first').focus().autosize().trigger('autosize.resize'); + } + changing = true; + }); + + $('.toggle').click(function(){ + $('.hide').toggle('200'); + }); +}); + +function nl2br(s){ + return (s + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1
$2'); +} + +function fieldSave(key,val){ + $.post('edittext.php', {fieldname: key, content: val}).done(function(data){ + if(key == 'theme_name'){location.reload(true);} + else if(val==''){$('#'+key).html($('#'+key).attr('title'));} + else {$("#"+key).html(data);} + changing = false; + }); +} diff --git a/js/rte.php b/js/rte.php index 2a1d06a..fb30913 100644 --- a/js/rte.php +++ b/js/rte.php @@ -1,2 +1,2 @@ -a.html(""); -a.children(':first').focus().autosize().trigger('autosize.resize'); \ No newline at end of file +a.html(""); +a.children(':first').focus().autosize().trigger('autosize.resize'); diff --git a/plugins/README.md b/plugins/README.md new file mode 100644 index 0000000..34b7619 --- /dev/null +++ b/plugins/README.md @@ -0,0 +1 @@ +- plugins should be placed into arbitrary directory and should contain index.php diff --git a/themes/blue/style.css b/themes/blue/style.css index 473e832..c885028 100644 --- a/themes/blue/style.css +++ b/themes/blue/style.css @@ -1,188 +1,188 @@ -html { - min-height: 100%; - position: relative; -} - -body { - color: #fff; - margin: 0 0 100px; - background: #f3f3f3; - font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif; -} - -a { - color: #fff; - text-decoration: none; - border-bottom: 1px #fff dotted; -} - -.clear {clear: both;} -*:focus {outline: none;} -.toggle {cursor: pointer;} - -h3 { - margin: 0; - padding: 0; -} - -#main-title { - float: left; - display: inline; - font-size: 32px; - margin: 0 0 0 11%; - font-weight: normal; - padding: 13px 0 0 0; -} - -#main-title a { - border: 0; - text-decoration: none; -} - -#subtitle { - font-size: 16px; - padding: 0 0 10px 0; - text-transform: uppercase; -} - -#nav { - width: 100%; - float: left; - position: relative; - background: #1F2B33; -} - -#nav ul { - float: right; - margin: 0 8% 0 0; -} - -#nav li { - float: left; - font-size: 14px; - list-style: none; -} - -#nav li a { - border: 0; - color: #fff; - display: block; - text-transform: uppercase; - padding: 25px 20px 25px 25px; - -} - -#nav li a:hover { - background: #16a6b6; -} - -#wrapper { - width: 52%; - float: left; - color: #444; - height: auto; - padding: 20px; - font-size: 15px; - background: #fff; - margin-top: 40px; - margin-left: 10%; - line-height: 19px; - border: 1px solid #fff; -} - -#wrapper a { - color: #444; - border-bottom: 1px #444 dotted; -} - -#side { - width: 20%; - float: left; - height: auto; - padding: 20px; - font-size: 14px; - margin-left: 2%; - margin-top: 40px; - background: #16a6b6; -} - -span.editText { - display: block; - cursor: pointer; -} - -span.editText textarea { - border: 0; - padding: 0; - width: 100%; - resize: none; - color: inherit; - display: block; - overflow: hidden; - font-size: inherit; - line-height: inherit; - font-family: inherit; - background-color: transparent; -} - -.border { - border-radius: 5px; - margin-bottom: 10px; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; -} - -.hide { - margin: 0; - width: 100%; - display: none; -} - -.change { - width: 100%; - height: auto; - padding: 20px; - margin-top: 5px; - background: #1F2B33; -} - -.change select { - width: 20%; - color: #fff; - border: none; - padding: 10px; - font-weight: bold; - background: #16a6b6; -} - -.settings { - width: 100%; - clear: both; - color: #fff; - height: auto; - padding: 5px 0; - text-align: center; - background: #16a6b6; -} - -div.settings div.change { - width: 52%; - text-align: left; - margin-left: 10%; -} - -footer { - left: 0; - bottom: 0; - width: 100%; - min-height: 60px; - position: absolute; - background: #1F2B33; -} - -footer p { - padding: 20px; - font-size: 13px; - margin: 0 6% 0 0; - text-align: right; -} \ No newline at end of file +html { + min-height: 100%; + position: relative; +} + +body { + color: #fff; + margin: 0 0 100px; + background: #f3f3f3; + font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif; +} + +a { + color: #fff; + text-decoration: none; + border-bottom: 1px #fff dotted; +} + +.clear {clear: both;} +*:focus {outline: none;} +.toggle {cursor: pointer;} + +h3 { + margin: 0; + padding: 0; +} + +#main-title { + float: left; + display: inline; + font-size: 32px; + margin: 0 0 0 11%; + font-weight: normal; + padding: 13px 0 0 0; +} + +#main-title a { + border: 0; + text-decoration: none; +} + +#subtitle { + font-size: 16px; + padding: 0 0 10px 0; + text-transform: uppercase; +} + +#nav { + width: 100%; + float: left; + position: relative; + background: #1F2B33; +} + +#nav ul { + float: right; + margin: 0 8% 0 0; +} + +#nav li { + float: left; + font-size: 14px; + list-style: none; +} + +#nav li a { + border: 0; + color: #fff; + display: block; + text-transform: uppercase; + padding: 25px 20px 25px 25px; + +} + +#nav li a:hover { + background: #16a6b6; +} + +#wrapper { + width: 52%; + float: left; + color: #444; + height: auto; + padding: 20px; + font-size: 15px; + background: #fff; + margin-top: 40px; + margin-left: 10%; + line-height: 19px; + border: 1px solid #fff; +} + +#wrapper a { + color: #444; + border-bottom: 1px #444 dotted; +} + +#side { + width: 20%; + float: left; + height: auto; + padding: 20px; + font-size: 14px; + margin-left: 2%; + margin-top: 40px; + background: #16a6b6; +} + +span.editText { + display: block; + cursor: pointer; +} + +span.editText textarea { + border: 0; + padding: 0; + width: 100%; + resize: none; + color: inherit; + display: block; + overflow: hidden; + font-size: inherit; + line-height: inherit; + font-family: inherit; + background-color: transparent; +} + +.border { + border-radius: 5px; + margin-bottom: 10px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; +} + +.hide { + margin: 0; + width: 100%; + display: none; +} + +.change { + width: 100%; + height: auto; + padding: 20px; + margin-top: 5px; + background: #1F2B33; +} + +.change select { + width: 20%; + color: #fff; + border: none; + padding: 10px; + font-weight: bold; + background: #16a6b6; +} + +.settings { + width: 100%; + clear: both; + color: #fff; + height: auto; + padding: 5px 0; + text-align: center; + background: #16a6b6; +} + +div.settings div.change { + width: 52%; + text-align: left; + margin-left: 10%; +} + +footer { + left: 0; + bottom: 0; + width: 100%; + min-height: 60px; + position: absolute; + background: #1F2B33; +} + +footer p { + padding: 20px; + font-size: 13px; + margin: 0 6% 0 0; + text-align: right; +} diff --git a/themes/blue/theme.php b/themes/blue/theme.php index 0ce4cfd..fbec1e7 100644 --- a/themes/blue/theme.php +++ b/themes/blue/theme.php @@ -1,40 +1,40 @@ - - - - - " . $c['title'] . " - " . $c['page'] . " - - - - - "; - edit_tags(); -?> - - -
- -
- - -
-
- - -
- -
- - -
- -
- - - \ No newline at end of file + + + + + " . $c['title'] . " - " . $c['page'] . " + + + + + "; + edit_tags(); +?> + + +
+ +
+ + +
+
+ + +
+ +
+ + +
+ +
+ + + -- cgit v1.2.3