# HG changeset patch # User markus schnalke # Date 1469302757 -7200 # Node ID 081ba8764994f5fb4faa520f1800efa7df07de63 # Parent 22243e7c7dc596a2dd6a32d4d38a374365af3d07 The wiki-like system became a content-rendering system This is a single changeset to include all the changes throughout the last years. Owls no longer supports editing pages but only renders them. Also, it no longer uses a database to store the contents but reads the contents from the filesystem. All this made owls simpler ... anyway, it just reflects my needs. diff -r 22243e7c7dc5 -r 081ba8764994 Bbcodeparser.inc.php --- a/Bbcodeparser.inc.php Sun May 27 14:06:42 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ - - */ - - - /// path to smilies - define('SMILIE_DIR', 'Smilies/'); - - - - /** - * parses recursive quotes without a source mentioned - * - * @param $textinput the bbcode-text - * @param $level number of levels to go inside - * @return HTML-text - */ - function parse_quote1($textinput,$level = 1) { - $pattern = '#\[quote\](((?R)|(.*))*)\[/quote\]#isUe'; - $replacement = "'
[nl]Zitat:[nl]
[nl]'.parse_quote1('$1', - ". ($level + 1) ." - ).'[nl]
[nl]'"; - return preg_replace($pattern, $replacement, $textinput); - } - - /** - * parses recursive quotes with a source mentioned - * - * @param $textinput the bbcode-text - * @param $level number of levels to go inside - * @return HTML-text - */ - function parse_quote2($textinput,$level = 1) { - $pattern = '#\[quote\=(.*)\](((?R)|(.*))*)\[/quote\]#isUe'; - $replacement = "'
[nl]Zitat: ($1)[nl]
[nl]'.parse_quote2('$2', - ". ($level + 1) ." - ).'[nl]
[nl]'"; - return preg_replace($pattern, $replacement, $textinput); - } - - /** - * replaces smilies - * - * @param $text text with ASCII-smilies - * @return text with [img]-smilies - */ - function smilies($text) { - $smilies = array( ':-)' => 'Smile.gif', - ':)' => 'Smile.gif', - ';-)' => 'Wink.gif', - ';)' => 'Wink.gif', - ':-D' => 'Biggrin.gif', - ':D' => 'Biggrin.gif', - ':-(' => 'Sad.gif', - ':(' => 'Sad.gif', - ':-P' => 'Lick.gif', - ':P' => 'Lick.gif', - ':o' => 'Talk.gif', - ':-S' => 'Dontknow.gif', - ':dontknow:' => 'Dontknow.gif', - ':-@' => 'Angry.gif', - ':cool:' => 'Cool.gif', - 'B-)' => 'Cool.gif', - '%-)' => 'Crosseyed.gif', - '%-(' => 'Crosseyed.gif', - ':rolleyes:' => 'Rolleyes.gif', - ':eek:' => 'Shocked.gif'); - while(list($key, $val) = each($smilies)) { - $text = str_replace($key,'[img]'. SMILIE_DIR . $val .'[/img]', $text); - } - return $text; - } - - - /** - * turns bbcode in HTML - * - * @param $text the text with bbcode inside - * @param $smilies set to 1 causes smilies to be replaced with pics - * @param $images set to 1 causes images to be displayed ([img]-tag) - * @return text with HTML-code - */ - function bbcode($text, $smilies = 0, $images = 0) { - - // smilies - if ($smilies == 1) { - $text = smilies($text); - } - - // new-lines - $text = preg_replace("#(\r\n)|(\r)#", "\n", $text); - $text = str_replace("\n", '
[nl]', htmlentities($text)); - - // bold - $text = preg_replace("#\[b\](.*?)\[/b\]#i", "$1", $text); - // italic - $text = preg_replace("#\[i\](.*?)\[/i\]#i", "$1", $text); - // links - $text = preg_replace("#\[url\](.*)\[/url\]#iU", "$1", $text); - $text = preg_replace("#\[url=(.*)\](.*)\[/url\]#iU", "$2", $text); - // lists - //$text = preg_replace("#\[list\]\
(.*)\[/list\]#iU", "", $text); - //$text = preg_replace("#\[\*\](.*)\
#iU", "
  • $1
  • ", $text); - // quotes - $text = parse_quote1($text); - $text = parse_quote2($text); - // images - if ($images == 1) { - $text = preg_replace("#\[img\](.*?)\[/img\]#i", "\"<[Bild]>\"", $text); - } - - // remove backslashes - $text = preg_replace("#\\\#is", "", $text); - // new-lines - $text = str_replace('[nl]', "\n", $text); - - return $text; - } - -?> diff -r 22243e7c7dc5 -r 081ba8764994 Config/Config.inc.php --- a/Config/Config.inc.php Sun May 27 14:06:42 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ - diff -r 22243e7c7dc5 -r 081ba8764994 Config/Owls.css.php --- a/Config/Owls.css.php Sun May 27 14:06:42 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,221 +0,0 @@ - - - - -body { - font-family: sans-serif; - margin: 30px 0; - text-align: center; - color: ; - background-color: ; -} - - -#websiteContainer { - width: 760px; - margin: 0 auto; - text-align: justify; -} - -#banner { - display: block; - margin: 0 auto; -} - -#content { - position: relative; - margin-left: ; - padding: 1em; -} - - - -/* uhhh?? is this not needed anymore? are there no borders drawn by default? -img { - border: none; -} -*/ - - - - - - -/* links */ -a:link { - color: ; -} -a:visited { - color: ; -} -a:active, -a:hover { - color: ; -} - - - - - - -/* nav */ -#nav { - list-style: none; - float: left; - width: ; - padding: 0.5em 2em 1em 0.5em; - margin: 2.5em 0 1em 0; - font-size: 0.8em; -} - -#nav ul { - list-style: none; - margin-left: 0; - padding-left: 1em; -/* border: 1px solid #060; */ -} -#nav li { - padding: 1px; - margin: 0; -/* border: 1px solid #006; */ -} - -#nav a { - display: block; - text-decoration: none; - color: ; -} -#nav a:link, -#nav a:visited { - text-decoration: none; -} -#nav a:active, -#nav a:hover { - color: ; - text-decoration: none; -} - -#selected:link, -#selected:visited { - color: ; -} -#nav #selected:hover { - color: ; -} - - - - -/* orphans and broken */ -li#orphans, -li#broken { - margin-top: 3em; - font-style: italic; - color: ; -} - - - - -/* login */ -#loginform input { - background-color: transparent; - border: none; - border-bottom: 1px solid; /* TODO: think about other color */ - font-size: 0.8em; - width: 8em; -} - - - - - - -/* admin controls */ -.ctrl { - position: absolute; - right: 0; - text-align: right; - font-size: 0.8em; - color: ; -} -.ctrl a, -.ctrl a:visited, -.ctrl a:hover { - margin-left: 1em; - color: ; -} - - - - - - -/* edit form */ -#edit { - margin-top: 1.5em; -} -#edit input, -#edit select, -#edit textarea { - font-family: sans-serif; - font-size: 0.8em; - border: 1px solid; -} - diff -r 22243e7c7dc5 -r 081ba8764994 Config/Setup.php --- a/Config/Setup.php Sun May 27 14:06:42 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ - diff -r 22243e7c7dc5 -r 081ba8764994 Loginsys.class.php --- a/Loginsys.class.php Sun May 27 14:06:42 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ - - */ -class Loginsys { - - /// Consts - - /** - * time in seconds till the session expires - */ - const TIME_SESSION_EXPIRES = 1800; - - - - /// Constructors - - /** - * starts the session - * and puts an activity timestamp in it - */ - public function __construct() { - session_start(); - $this->heartbeat(); - } - - - - - /// Methods - - - /** - * trys to log in with the given login data - * - * @param $loginname username - * @param $password_md5 md5 password hash - */ - public function login($loginname, $password_md5) { // login ------------------------------------ - $rowuser = mysql_fetch_array(mysql_query("select * from ". DB_PREFIX ."User where loginname='$loginname' and password='$password_md5' ")); - if (mysql_affected_rows() == 1) { // valid login - $_SESSION[login][id] = $rowuser[id]; - $_SESSION[login][loginname] = $loginname; - $_SESSION[login][logintime] = time(); - } - } - - - /** - * logs the user out - */ - public function logout() { // logout ------------------------------------------------------------ - unset($_SESSION[login]); - } - - - /** - * proves if the user is logged in and if he wan't to long inactive - * - * @return bool 'true' if user is logged in, else 'false' - */ - public function loggedIn() { // return login-status --------------------------------------------- - return (isset($_SESSION[login][id]) && $_SESSION[login][logintime] > time()-self::TIME_SESSION_EXPIRES); - } - - - /** - * writes the current timestamp into the session - * this is relevant for the time of inactivity - */ - public function heartbeat() { - if ($this->loggedIn()) { - $_SESSION[login][logintime] = time(); - } - } - - - - /// Getter and Setter - - - /** - * @return user id - */ - public function getUserId() { - return $_SESSION[login][id]; - } - - /** - * @return user name - */ - public function getLoginname() { - return $_SESSION[login][loginname]; - } - -} - - -?> diff -r 22243e7c7dc5 -r 081ba8764994 Nav.inc.php --- a/Nav.inc.php Sun May 27 14:06:42 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ - - - -'. $row['name'] .''; - if ($row['id'] != $row['idParent']) { - $subtree = navtree($row['id']); - if (!empty($subtree)) { - #$return .= '  '; - $return .= ''; - } - unset($subtree); - } - $return .= ''; - } - unset($row); - mysql_free_result($result); - - // return - return $return; - } - -?> - - diff -r 22243e7c7dc5 -r 081ba8764994 Owls.php --- a/Owls.php Sun May 27 14:06:42 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,357 +0,0 @@ - - - - - - - - <?php echo htmlentities(TITLE); ?> - - - - - - - -
    - - - - -loggedIn()) { // new - create($lsys); - - } else if ($_GET['action'] == 'edit' && $lsys->loggedIn()) { // edit - edit($lsys); - - } else if ($_GET['action'] == 'delete' && $lsys->loggedIn()) { // delete - delete($lsys); - - } else if ($_GET['action'] == 'login') { // login - $lsys->login($_POST['login_loginname'], md5($_POST['login_password'])); - show($lsys); - - } else if ($_GET['action'] == 'logout') { // logout - $lsys->logout(); - show($lsys); - - } else { // startpage - $_GET['id'] = 1; - show($lsys); - - } - - - - - -?> - -
    - - - - - - -loggedIn()) { - $_POST['editDoc_title'] = addslashes($_POST['editDoc_title']); - $_POST['editDoc_text'] = addslashes($_POST['editDoc_text']); - mysql_query("update ". DB_PREFIX ."Owls set - name='$_POST[editDoc_title]', - text='$_POST[editDoc_text]', - idParent='$_POST[editDoc_idCategory]', - date=". time() ." - where id='$_GET[id]'") or die(mysql_error()); - } - - // print nav - include 'Nav.inc.php'; - - - - - // query data of the node - $result = mysql_query("select * from ". DB_PREFIX ."Owls where id=$_GET[id]"); - - // catch nodes that not exist - if (!mysql_num_rows($result)) { - - $fnord = array('', - 'Fnord is the space between the pixels on your screen.', - 'Fnord is the echo of silence.', - 'Fnord is evaporated herbal tea without the herbs.', - 'Fnord is what you see when you close your eyes.', - 'Fnord is the empty pages at the end of the book.', - 'Fnord is why ducks eat trees.', - 'Fnord is the bucket where they keep the unused serifs for H*lvetica.', - 'Fnord is the source of all the zero bits in your computer.' - ); - -?> -
    -

    Error 23 - fnord found

    -

    - -

    -'."\n"; - - // display admin controls or login form -?> -
    - - - last update: - - -loggedIn()) { -?> - new - edit -delete'; - } - echo ' logout'; - } else { -?> -
    - - - -
    - -
    -'.stripslashes($row['name']).''."\n"; - if (!empty($row['text'])) { - echo '

    '.bbcode(stripslashes($row['text']), 1, 1).'

    '; - } - } - echo "\n\n"; - -} - - - - - -/* - displays edit form -*/ -function edit($lsys) { - - include 'Nav.inc.php'; - - $sql = "select * from ". DB_PREFIX ."Owls where id=$_GET[id]"; - $result = mysql_query($sql) or die(mysql_error()); - $row = mysql_fetch_array($result); - echo '
    '; -?> -
    -
    - -

    - -
    -

    - -
    -
    - - diff -r 22243e7c7dc5 -r 081ba8764994 Owls.png Binary file Owls.png has changed diff -r 22243e7c7dc5 -r 081ba8764994 bbcodeparser.inc.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bbcodeparser.inc.php Sat Jul 23 21:39:17 2016 +0200 @@ -0,0 +1,158 @@ + + */ + + + /// path to smilies + define('SMILIE_DIR', 'smilies/'); + + + + /** + * parses recursive quotes without a source mentioned + * + * @param $textinput the bbcode-text + * @param $level number of levels to go inside + * @return HTML-text + */ + function parse_quote1($textinput,$level = 1) { + $pattern = '#\[quote\](((?R)|(.*))*)\[/quote\]#isUe'; + $replacement = "'
    [nl]Zitat:[nl]
    [nl]'.parse_quote1('$1', + ". ($level + 1) ." + ).'[nl]
    [nl]'"; + return preg_replace($pattern, $replacement, $textinput); + } + + /** + * parses recursive quotes with a source mentioned + * + * @param $textinput the bbcode-text + * @param $level number of levels to go inside + * @return HTML-text + */ + function parse_quote2($textinput,$level = 1) { + $pattern = '#\[quote\=(.*)\](((?R)|(.*))*)\[/quote\]#isUe'; + $replacement = "'
    [nl]Zitat: ($1)[nl]
    [nl]'.parse_quote2('$2', + ". ($level + 1) ." + ).'[nl]
    [nl]'"; + return preg_replace($pattern, $replacement, $textinput); + } + + /** + * replaces smilies + * + * @param $text text with ASCII-smilies + * @return text with [img]-smilies + */ + function smilies($text) { + $smilies = array( ':-?\)' => 'Smile.gif', + ';-?\)' => 'Wink.gif', + ':-?D' => 'Biggrin.gif', + ':-?\(' => 'Sad.gif', + ':-?P' => 'Lick.gif', + ':o' => 'Talk.gif', + ':-S' => 'Dontknow.gif', + ':dontknow:' => 'Dontknow.gif', + ':-@' => 'Angry.gif', + ':cool:' => 'Cool.gif', + 'B-\)' => 'Cool.gif', + '%-\)' => 'Crosseyed.gif', + '%-\(' => 'Crosseyed.gif', + ':rolleyes:' => 'Rolleyes.gif', + ':eek:' => 'Shocked.gif'); + while(list($key, $val) = each($smilies)) { + $key = '/(\s|^)'.$key.'(\s|$)/'; + $text = preg_replace($key, '$1[img]'. SMILIE_DIR . $val .'[/img]$2', $text); + } + return $text; + } + + + /** + * turns bbcode in HTML + * + * @param $text the text with bbcode inside + * @param $smilies set to 1 causes smilies to be replaced with pics + * @param $images set to 1 causes images to be displayed ([img]-tag) + * @return text with HTML-code + */ + function bbcode($text, $smilies = 0, $images = 0) { + + // line breaks and special chars + $text = preg_replace("#(\r\n)|(\r)#", "\n", htmlentities($text, ENT_COMPAT, 'UTF-8')); + $text = preg_replace("#(\n){3,}#", "\n\n", $text); + + // smilies + if ($smilies == 1) { + $text = smilies($text); + } + + /* + // new-lines + $text = preg_replace("#(\r\n)|(\r)#", "\n", $text); + $text = str_replace("\n", '
    [nl]', htmlentities($text, ENT_COMPAT, 'UTF-8')); + + // bold + $text = preg_replace("#\[b\](.*?)\[/b\]#i", "$1", $text); + // italic + $text = preg_replace("#\[i\](.*?)\[/i\]#i", "$1", $text); + // links + $text = preg_replace("#\[url\](.*)\[/url\]#iU", "$1", $text); + $text = preg_replace("#\[url=(.*)\](.*)\[/url\]#iU", "$2", $text); + // lists + //$text = preg_replace("#\[list\]\
    (.*)\[/list\]#iU", "
      $1
    ", $text); + //$text = preg_replace("#\[\*\](.*)\
    #iU", "
  • $1
  • ", $text); + // quotes + */ + $text = parse_quote1($text); + $text = parse_quote2($text); + // images + if ($images == 1) { + $text = preg_replace("#\[img\](.*?)\[/img\]#i", "\"<[Bild]>\"", $text); + } + + /* + // remove backslashes + $text = preg_replace("#\\\#is", "", $text); + // new-lines + $text = str_replace('[nl]', "\n", $text); + */ + + + // inline + $text = preg_replace('#\[b\](.*)\[/b\]#iU', '$1', $text); + $text = preg_replace('#\*(.*)\*#iU', '$1', $text); + $text = preg_replace('#\[i\](.*)\[/i\]#iU', '$1', $text); + $text = preg_replace('#[^A-Za-z0-9]_(.*)_[^A-Za-z0-9]#iU', '$1', $text); + $text = preg_replace('#{{{(.*)}}}#iUs', '$1', $text); + $text = preg_replace("#\[url\](.*)\[/url\]#iU","$1",$text); + $text = preg_replace("#\[url=(.*)\](.*)\[/url\]#iU","$2",$text); + $text = preg_replace("#\[img\](.*)\[/img\]#iU","\"[Bild]\"", $text); + $text = preg_replace("#^-{3,}$#iUm","
    ", $text); + + // Listen +# $text = preg_replace("#\[list\](.*)\[/list\]#i","
      $1
    ", $text); + $text = preg_replace("#^\s*\*(.*)\n#imU", "
  • $1
  • ", $text); + $text = preg_replace("#^((\s*\(.*)\\s*)+)$#im", "
      $1
    ", $text); + + + + + // boxes + + + $text = preg_replace('#^(.+)$#mU', "

    \n $1\n

    ", $text); + + # nicht wenn oder
      enthalten sind + $text = preg_replace("#\\n \[h([1-6]{1})\](.*)\[/h[1-6]{1}\]\n\#iU", "\n$2", $text); + $text = preg_replace("#\\n ===(.*)\n\#iU", "\n

      $1

      ", $text); + $text = preg_replace("#\\n ==(.*)\n\#iU", "\n

      $1

      ", $text); + + $text = preg_replace("#\\n \(.*)\\n\#iU", "
        \n $1\n
      ", $text); + return $text; + } + +?> diff -r 22243e7c7dc5 -r 081ba8764994 data/text --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data/text Sat Jul 23 21:39:17 2016 +0200 @@ -0,0 +1,3 @@ +Welcome to the Owls content rendering system. + +Put more files and directory structures into the data directory. diff -r 22243e7c7dc5 -r 081ba8764994 index.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/index.php Sat Jul 23 21:39:17 2016 +0200 @@ -0,0 +1,41 @@ + + + + Owls - content-rendering system + + + + + + +
      + + + + +'."\n"; + echo "

      ". preg_replace('/.*\//', '', $_GET['path']) ."

      \n"; + $file = 'data/'. $_GET['path'].'/text'; + if (is_file($file)) { + $text = file_get_contents($file); + } else { + $text = 'file not found'; + } + echo '

      '.bbcode($text, 1, 1).'

      '; + echo '
      '; + echo "\n\n"; +?> + +
    + + + diff -r 22243e7c7dc5 -r 081ba8764994 nav.inc.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nav.inc.php Sat Jul 23 21:39:17 2016 +0200 @@ -0,0 +1,42 @@ + + +$f"; + $subtree = navtree("$root$f"); + if (!empty($subtree)) { + $return .= ""; + } + unset($subtree); + } + $return .= ''; + return $return; +} + +?> diff -r 22243e7c7dc5 -r 081ba8764994 owls-banner.png Binary file owls-banner.png has changed diff -r 22243e7c7dc5 -r 081ba8764994 owls.css.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/owls.css.php Sat Jul 23 21:39:17 2016 +0200 @@ -0,0 +1,210 @@ + + + + +body { + font-family: sans-serif; + margin: 30px 0; + text-align: center; + color: ; + background-color: ; +} + + +#websiteContainer { + width: 760px; + margin: 0 auto; + text-align: justify; +} + +#banner { + display: block; + margin: 0 auto; + border: none; +} + +#content { + position: relative; + margin-left: ; + padding: 1em; +} + + + + + +/* links */ +a:link { + color: ; +} +a:visited { + color: ; +} +a:active, +a:hover { + color: ; +} + + + + + + +/* nav */ +#nav { + list-style: none; + float: left; + width: ; + padding: 0.5em 2em 1em 0.5em; + margin: 2.5em 0 1em 0; + font-size: 0.8em; +} + +#nav ul { + list-style: none; + margin-left: 0; + padding-left: 1em; +} +#nav li { + padding: 1px; + margin: 0; +} + +#nav a { + display: block; + text-decoration: none; + color: ; +} +#nav a:link, +#nav a:visited { + text-decoration: none; +} +#nav a:active, +#nav a:hover { + color: ; + text-decoration: none; +} + +#selected:link, +#selected:visited { + color: ; +} +#nav #selected:hover { + color: ; +} + + + + +/* orphans and broken */ +li#orphans, +li#broken { + margin-top: 3em; + font-style: italic; + color: ; +} + + + + +/* login */ +#loginform input { + background-color: transparent; + border: 1px solid; + font-size: 0.8em; + width: 8em; +} + + + + + + +/* admin controls */ +.ctrl { + position: absolute; + right: 0; + text-align: right; + font-size: 0.8em; + color: ; +} +.ctrl a, +.ctrl a:visited, +.ctrl a:hover { + margin-left: 1em; + color: ; +} + + + + + + +/* edit form */ +#edit { + margin-top: 1.5em; +} +#edit input, +#edit select, +#edit textarea { + font-family: sans-serif; + font-size: 0.8em; + border: 1px solid; +} + diff -r 22243e7c7dc5 -r 081ba8764994 smilies/Angry.gif Binary file smilies/Angry.gif has changed diff -r 22243e7c7dc5 -r 081ba8764994 smilies/Biggrin.gif Binary file smilies/Biggrin.gif has changed diff -r 22243e7c7dc5 -r 081ba8764994 smilies/Cool.gif Binary file smilies/Cool.gif has changed diff -r 22243e7c7dc5 -r 081ba8764994 smilies/Crosseyed.gif Binary file smilies/Crosseyed.gif has changed diff -r 22243e7c7dc5 -r 081ba8764994 smilies/Dontknow.gif Binary file smilies/Dontknow.gif has changed diff -r 22243e7c7dc5 -r 081ba8764994 smilies/Faustball.gif Binary file smilies/Faustball.gif has changed diff -r 22243e7c7dc5 -r 081ba8764994 smilies/Lick.gif Binary file smilies/Lick.gif has changed diff -r 22243e7c7dc5 -r 081ba8764994 smilies/Rolleyes.gif Binary file smilies/Rolleyes.gif has changed diff -r 22243e7c7dc5 -r 081ba8764994 smilies/Sad.gif Binary file smilies/Sad.gif has changed diff -r 22243e7c7dc5 -r 081ba8764994 smilies/Shocked.gif Binary file smilies/Shocked.gif has changed diff -r 22243e7c7dc5 -r 081ba8764994 smilies/Smile.gif Binary file smilies/Smile.gif has changed diff -r 22243e7c7dc5 -r 081ba8764994 smilies/Talk.gif Binary file smilies/Talk.gif has changed diff -r 22243e7c7dc5 -r 081ba8764994 smilies/Wink.gif Binary file smilies/Wink.gif has changed