owls

changeset 17:081ba8764994 owls-2.0

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.
author markus schnalke <meillo@marmaro.de>
date Sat, 23 Jul 2016 21:39:17 +0200
parents 22243e7c7dc5
children 98983ba58e2e
files Bbcodeparser.inc.php Config/Config.inc.php Config/Owls.css.php Config/Setup.php Loginsys.class.php Nav.inc.php Owls.php Owls.png bbcodeparser.inc.php data/text index.php nav.inc.php owls-banner.png owls.css.php smilies/Angry.gif smilies/Biggrin.gif smilies/Cool.gif smilies/Crosseyed.gif smilies/Dontknow.gif smilies/Faustball.gif smilies/Lick.gif smilies/Rolleyes.gif smilies/Sad.gif smilies/Shocked.gif smilies/Smile.gif smilies/Talk.gif smilies/Wink.gif
diffstat 27 files changed, 454 insertions(+), 995 deletions(-) [+]
line diff
     1.1 --- a/Bbcodeparser.inc.php	Sun May 27 14:06:42 2007 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,123 +0,0 @@
     1.4 -<?php
     1.5 -/**
     1.6 - * BB-Code-Parser
     1.7 - *
     1.8 - * @author Meillo  r e t u r n s <meillo@marmaro.de>
     1.9 - */
    1.10 -
    1.11 -
    1.12 -  /// path to smilies
    1.13 -  define('SMILIE_DIR', 'Smilies/');
    1.14 -
    1.15 -
    1.16 -
    1.17 -  /**
    1.18 -   * parses recursive quotes without a source mentioned
    1.19 -   *
    1.20 -   * @param $textinput the bbcode-text
    1.21 -   * @param $level number of levels to go inside
    1.22 -   * @return HTML-text
    1.23 -   */
    1.24 -  function parse_quote1($textinput,$level = 1) {
    1.25 -    $pattern = '#\[quote\](((?R)|(.*))*)\[/quote\]#isUe';
    1.26 -    $replacement = "'<br />[nl]<span class=\"quote0\">Zitat:</span>[nl]<div class=\"quote1\">[nl]'.parse_quote1('$1',
    1.27 -                     ". ($level + 1) ."
    1.28 -                   ).'[nl]</div>[nl]'";
    1.29 -    return preg_replace($pattern, $replacement, $textinput);
    1.30 -  }
    1.31 -
    1.32 -  /**
    1.33 -   * parses recursive quotes with a source mentioned
    1.34 -   *
    1.35 -   * @param $textinput the bbcode-text
    1.36 -   * @param $level number of levels to go inside
    1.37 -   * @return HTML-text
    1.38 -   */
    1.39 -  function parse_quote2($textinput,$level = 1) {
    1.40 -    $pattern = '#\[quote\=(.*)\](((?R)|(.*))*)\[/quote\]#isUe';
    1.41 -    $replacement = "'<br />[nl]<span class=\"quote0\">Zitat: ($1)</span>[nl]<div class=\"quote2\">[nl]'.parse_quote2('$2',
    1.42 -                     ". ($level + 1) ."
    1.43 -                   ).'[nl]</div>[nl]'";
    1.44 -    return preg_replace($pattern, $replacement, $textinput);
    1.45 -  }
    1.46 -
    1.47 -  /**
    1.48 -   * replaces smilies
    1.49 -   *
    1.50 -   * @param $text text with ASCII-smilies
    1.51 -   * @return text with [img]-smilies
    1.52 -   */
    1.53 -  function smilies($text) {
    1.54 -    $smilies = array( ':-)'        => 'Smile.gif',
    1.55 -                      ':)'         => 'Smile.gif',
    1.56 -                      ';-)'        => 'Wink.gif',
    1.57 -                      ';)'         => 'Wink.gif',
    1.58 -                      ':-D'        => 'Biggrin.gif',
    1.59 -                      ':D'         => 'Biggrin.gif',
    1.60 -                      ':-('        => 'Sad.gif',
    1.61 -                      ':('         => 'Sad.gif',
    1.62 -                      ':-P'        => 'Lick.gif',
    1.63 -                      ':P'         => 'Lick.gif',
    1.64 -                      ':o'         => 'Talk.gif',
    1.65 -                      ':-S'        => 'Dontknow.gif',
    1.66 -                      ':dontknow:' => 'Dontknow.gif',
    1.67 -                      ':-@'        => 'Angry.gif',
    1.68 -                      ':cool:'     => 'Cool.gif',
    1.69 -                      'B-)'        => 'Cool.gif',
    1.70 -                      '%-)'        => 'Crosseyed.gif',
    1.71 -                      '%-('        => 'Crosseyed.gif',
    1.72 -                      ':rolleyes:' => 'Rolleyes.gif',
    1.73 -                      ':eek:'      => 'Shocked.gif');
    1.74 -    while(list($key, $val) = each($smilies)) {
    1.75 -      $text = str_replace($key,'[img]'. SMILIE_DIR . $val .'[/img]', $text);
    1.76 -    }
    1.77 -    return $text;
    1.78 -  }
    1.79 -
    1.80 -
    1.81 -  /**
    1.82 -   * turns bbcode in HTML
    1.83 -   *
    1.84 -   * @param $text the text with bbcode inside
    1.85 -   * @param $smilies set to 1 causes smilies to be replaced with pics
    1.86 -   * @param $images set to 1 causes images to be displayed ([img]-tag)
    1.87 -   * @return text with HTML-code
    1.88 -   */
    1.89 -  function bbcode($text, $smilies = 0, $images = 0) {
    1.90 -
    1.91 -    // smilies
    1.92 -    if ($smilies == 1) {
    1.93 -      $text = smilies($text);
    1.94 -    }
    1.95 -
    1.96 -    // new-lines
    1.97 -    $text = preg_replace("#(\r\n)|(\r)#", "\n", $text);
    1.98 -    $text = str_replace("\n", '<br />[nl]', htmlentities($text));
    1.99 -
   1.100 -    // bold
   1.101 -    $text = preg_replace("#\[b\](.*?)\[/b\]#i", "<strong>$1</strong>", $text);
   1.102 -    // italic
   1.103 -    $text = preg_replace("#\[i\](.*?)\[/i\]#i", "<i>$1</i>", $text);
   1.104 -    // links
   1.105 -    $text = preg_replace("#\[url\](.*)\[/url\]#iU", "<a href=\"$1\">$1</a>", $text);
   1.106 -    $text = preg_replace("#\[url=(.*)\](.*)\[/url\]#iU", "<a href=\"$1\">$2</a>", $text);
   1.107 -    // lists
   1.108 -      //$text = preg_replace("#\[list\]\<br /\>(.*)\[/list\]#iU", "<ul>$1</ul>", $text);
   1.109 -      //$text = preg_replace("#\[\*\](.*)\<br \/\>#iU", "<li>$1</li>", $text);
   1.110 -    // quotes
   1.111 -    $text = parse_quote1($text);
   1.112 -    $text = parse_quote2($text);
   1.113 -    // images
   1.114 -    if ($images == 1) {
   1.115 -      $text = preg_replace("#\[img\](.*?)\[/img\]#i", "<img src=\"$1\" alt=\"&lt;[Bild]&gt;\" />", $text);
   1.116 -    }
   1.117 -
   1.118 -    // remove backslashes
   1.119 -    $text = preg_replace("#\\\#is", "", $text);
   1.120 -    // new-lines
   1.121 -    $text = str_replace('[nl]', "\n", $text);
   1.122 -
   1.123 -    return $text;
   1.124 -  }
   1.125 -
   1.126 -?>
     2.1 --- a/Config/Config.inc.php	Sun May 27 14:06:42 2007 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,15 +0,0 @@
     2.4 -<?php
     2.5 -
     2.6 -// Prefix for database tables (default: 'rem__')
     2.7 -$db_prefix = 'rem__1_';
     2.8 -
     2.9 -// Title of the website (default: 'Owls')
    2.10 -$title = 'Owls';
    2.11 -
    2.12 -// Location of the database connection script to include
    2.13 -$db_connect = '../../Db.inc.php';
    2.14 -
    2.15 -// Name of the banner pic
    2.16 -$banner = 'Owls.png';
    2.17 -
    2.18 -?>
     3.1 --- a/Config/Owls.css.php	Sun May 27 14:06:42 2007 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,221 +0,0 @@
     3.4 -<?php
     3.5 -/*########################################################
     3.6 -######    to modify the look of owls, edit below    ######
     3.7 -########################################################*/
     3.8 -
     3.9 -
    3.10 -/*
    3.11 -    color setup
    3.12 -    use color values according to http://www.w3.org/TR/CSS21/syndata.html#color-units
    3.13 -    you can assign the set variables too
    3.14 -*/
    3.15 -
    3.16 -  $c_Text             = '#000';
    3.17 -  $c_Background       = '#999';
    3.18 -
    3.19 -  $c_Border           = $c_Text;
    3.20 -
    3.21 -  $c_Link             = $c_Text;
    3.22 -  $c_LinkHover        = '#ff8040';
    3.23 -  $c_LinkVisited      = '#666';
    3.24 -
    3.25 -  $c_Nav              = $c_Link;
    3.26 -  $c_NavHover         = $c_LinkHover;
    3.27 -  $c_NavSelected      = '#eee';
    3.28 -
    3.29 -  $c_Login            = $c_LinkVisited;
    3.30 -  $c_Admin            = '#ffff80';
    3.31 -
    3.32 -
    3.33 -/*
    3.34 -    width of the menu area
    3.35 -    the unit 'em' is relative to the font-size
    3.36 -    see: http://www.w3.org/TR/CSS21/syndata.html#length-units
    3.37 -*/
    3.38 -
    3.39 -  $m_NavWidth         = '10em';
    3.40 -
    3.41 -
    3.42 -/*########################################################
    3.43 -#############    noobs, stop editing here    #############
    3.44 -########################################################*/
    3.45 -
    3.46 -
    3.47 -
    3.48 -
    3.49 -
    3.50 -
    3.51 -  header('Content-Type: text/css; charset=utf8');
    3.52 -
    3.53 -  // avoid caching    TODO: think about removing, cause it's just for dev
    3.54 -  header('Expires: Thu, 05 Apr 1984 04:47:00 GMT');
    3.55 -  header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
    3.56 -  header('Cache-Control: no-store');
    3.57 -  header('Pragma: no-cache');
    3.58 -  echo('/* Anti-Caching: '.microtime()." */\r\n");
    3.59 -
    3.60 -?>
    3.61 -
    3.62 -
    3.63 -
    3.64 -body {
    3.65 -  font-family: sans-serif;
    3.66 -  margin: 30px 0;
    3.67 -  text-align: center;
    3.68 -  color: <?php echo $c_Text; ?>;
    3.69 -  background-color: <?php echo $c_Background; ?>;
    3.70 -}
    3.71 -
    3.72 -
    3.73 -#websiteContainer {
    3.74 -  width: 760px;
    3.75 -  margin: 0 auto;
    3.76 -  text-align: justify;
    3.77 -}
    3.78 -
    3.79 -#banner {
    3.80 -  display: block;
    3.81 -  margin: 0 auto;
    3.82 -}
    3.83 -
    3.84 -#content {
    3.85 -  position: relative;
    3.86 -  margin-left: <?php echo $m_NavWidth; ?>;
    3.87 -  padding: 1em;
    3.88 -}
    3.89 -
    3.90 -
    3.91 -
    3.92 -/*  uhhh?? is this not needed anymore? are there no borders drawn by default?
    3.93 -img {
    3.94 -  border: none;
    3.95 -}
    3.96 -*/
    3.97 -
    3.98 -
    3.99 -
   3.100 -
   3.101 -
   3.102 -
   3.103 -/*  links  */
   3.104 -a:link {
   3.105 -  color: <?php echo $c_Link; ?>;
   3.106 -}
   3.107 -a:visited {
   3.108 -  color: <?php echo $c_LinkVisited;?>;
   3.109 -}
   3.110 -a:active,
   3.111 -a:hover {
   3.112 -  color: <?php echo $c_LinkHover; ?>;
   3.113 -}
   3.114 -
   3.115 -
   3.116 -
   3.117 -
   3.118 -
   3.119 -
   3.120 -/*  nav  */
   3.121 -#nav {
   3.122 -  list-style: none;
   3.123 -  float: left;
   3.124 -  width: <?php echo $m_NavWidth; ?>;
   3.125 -  padding: 0.5em 2em 1em 0.5em;
   3.126 -  margin: 2.5em 0 1em 0;
   3.127 -  font-size: 0.8em;
   3.128 -}
   3.129 -
   3.130 -#nav ul {
   3.131 -  list-style: none;
   3.132 -  margin-left: 0;
   3.133 -  padding-left: 1em;
   3.134 -/*  border: 1px solid #060; */
   3.135 -}
   3.136 -#nav li {
   3.137 -  padding: 1px;
   3.138 -  margin: 0;
   3.139 -/*  border: 1px solid #006; */
   3.140 -}
   3.141 -
   3.142 -#nav a {
   3.143 -  display: block;
   3.144 -  text-decoration: none;
   3.145 -  color: <?php echo $c_Nav; ?>;
   3.146 -}
   3.147 -#nav a:link,
   3.148 -#nav a:visited {
   3.149 -  text-decoration: none;
   3.150 -}
   3.151 -#nav a:active,
   3.152 -#nav a:hover {
   3.153 -  color: <?php echo $c_NavHover; ?>;
   3.154 -  text-decoration: none;
   3.155 -}
   3.156 -
   3.157 -#selected:link,
   3.158 -#selected:visited {
   3.159 -  color: <?php echo $c_NavSelected; ?>;
   3.160 -}
   3.161 -#nav #selected:hover {
   3.162 -  color: <?php echo $c_NavHover; ?>;
   3.163 -}
   3.164 -
   3.165 -
   3.166 -
   3.167 -
   3.168 -/*  orphans and broken  */
   3.169 -li#orphans,
   3.170 -li#broken {
   3.171 -  margin-top: 3em;
   3.172 -  font-style: italic;
   3.173 -  color: <?php echo $c_Admin; ?>;
   3.174 -}
   3.175 -
   3.176 -
   3.177 -
   3.178 -
   3.179 -/*  login  */
   3.180 -#loginform input {
   3.181 -  background-color: transparent;
   3.182 -  border: none;
   3.183 -  border-bottom: <?php echo $c_Login; ?> 1px solid;    /* TODO: think about other color */
   3.184 -  font-size: 0.8em;
   3.185 -  width: 8em;
   3.186 -}
   3.187 -
   3.188 -
   3.189 -
   3.190 -
   3.191 -
   3.192 -
   3.193 -/*  admin controls  */
   3.194 -.ctrl {
   3.195 -  position: absolute;
   3.196 -  right: 0;
   3.197 -  text-align: right;
   3.198 -  font-size: 0.8em;
   3.199 -  color: <?php echo $c_Login; ?>;
   3.200 -}
   3.201 -.ctrl a,
   3.202 -.ctrl a:visited,
   3.203 -.ctrl a:hover {
   3.204 -  margin-left: 1em;
   3.205 -  color: <?php echo $c_Admin; ?>;
   3.206 -}
   3.207 -
   3.208 -
   3.209 -
   3.210 -
   3.211 -
   3.212 -
   3.213 -/*  edit form  */
   3.214 -#edit {
   3.215 -  margin-top: 1.5em;
   3.216 -}
   3.217 -#edit input,
   3.218 -#edit select,
   3.219 -#edit textarea {
   3.220 -  font-family: sans-serif;
   3.221 -  font-size: 0.8em;
   3.222 -  border: <?php echo $c_Border; ?> 1px solid;
   3.223 -}
   3.224 -
     4.1 --- a/Config/Setup.php	Sun May 27 14:06:42 2007 +0200
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,52 +0,0 @@
     4.4 -<?php
     4.5 -
     4.6 -// you can customize the config here
     4.7 -
     4.8 -$dbPrefix = 'rem__2_';    // the names of the db-tables will be prefixed with this string
     4.9 -
    4.10 -//$modifyProtected = true;    // are guests allowed to modify data? (true or false)
    4.11 -
    4.12 -$defaultUser = 'admin';    // useraccount if "modifyProtected = true" above
    4.13 -$defaultUserPassword = 'admin';    // password for useraccount if "modifyProtected = true" above
    4.14 -
    4.15 -
    4.16 -
    4.17 -// dont change anything form here on (except you know what you do)
    4.18 -//##################################################################
    4.19 -
    4.20 -  // write db-login-data to textfile
    4.21 -
    4.22 -
    4.23 -  // connect to db and create tables
    4.24 -  require('../Db.inc.php');
    4.25 -
    4.26 -
    4.27 -  // table 'Owls' for the content data
    4.28 -  mysql_query("
    4.29 -    CREATE TABLE IF NOT EXISTS `". $dbPrefix ."Owls` (
    4.30 -      `id` int(11) NOT NULL auto_increment,
    4.31 -      `idParent` int(11) default '0',
    4.32 -      `name` text NOT NULL,
    4.33 -      `text` longtext NOT NULL,
    4.34 -      `permission` tinyint(4) NOT NULL default '1',
    4.35 -      `date` int(11) NOT NULL default '0',
    4.36 -      PRIMARY KEY  (`id`)
    4.37 -    )
    4.38 -  ") or die(mysql_error());
    4.39 -
    4.40 -  // insert startup nodes
    4.41 -  mysql_query("INSERT INTO `". $dbPrefix ."Owls` VALUES (1, 0, 'Index', 'Thanks for using [url=http://prog.marmaro.de/owls/]Owls[/url]!', 0, now())") or die(mysql_error());
    4.42 -
    4.43 -
    4.44 -
    4.45 -  // login should be managed via text file in future
    4.46 -  mysql_query("CREATE TABLE IF NOT EXISTS `". $dbPrefix ."User` (
    4.47 -    `id` int(11) NOT NULL auto_increment,
    4.48 -    `loginname` tinytext NOT NULL,
    4.49 -    `password` tinytext NOT NULL,
    4.50 -    PRIMARY KEY  (`id`)
    4.51 -  )") or die(mysql_error());
    4.52 -
    4.53 -  mysql_query("INSERT INTO `". $dbPrefix ."User` VALUES (1, '". $defaultUser ."', '". md5($defaultUserPassword) ."')") or die(mysql_error());
    4.54 -
    4.55 -?>
     5.1 --- a/Loginsys.class.php	Sun May 27 14:06:42 2007 +0200
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,102 +0,0 @@
     5.4 -<?php
     5.5 -/**
     5.6 - * simple loginsystem for owls
     5.7 - *
     5.8 - * @brief simple loginsystem for owls
     5.9 - * @author Meillo  r e t u r n s <meillo@marmaro.de>
    5.10 - */
    5.11 -class Loginsys {
    5.12 -
    5.13 -  /// Consts
    5.14 -
    5.15 -  /**
    5.16 -   * time in seconds till the session expires
    5.17 -   */
    5.18 -  const TIME_SESSION_EXPIRES = 1800;
    5.19 -
    5.20 -
    5.21 -
    5.22 -  /// Constructors
    5.23 -
    5.24 -  /**
    5.25 -   * starts the session
    5.26 -   * and puts an activity timestamp in it
    5.27 -   */
    5.28 -  public function __construct() {
    5.29 -    session_start();
    5.30 -    $this->heartbeat();
    5.31 -  }
    5.32 -
    5.33 -
    5.34 -
    5.35 -
    5.36 -  /// Methods
    5.37 -
    5.38 -
    5.39 -  /**
    5.40 -   * trys to log in with the given login data
    5.41 -   *
    5.42 -   * @param $loginname username
    5.43 -   * @param $password_md5 md5 password hash
    5.44 -   */
    5.45 -  public function login($loginname, $password_md5) {    // login ------------------------------------
    5.46 -    $rowuser = mysql_fetch_array(mysql_query("select * from ". DB_PREFIX ."User where loginname='$loginname' and password='$password_md5' "));
    5.47 -    if (mysql_affected_rows() == 1) {  // valid login
    5.48 -      $_SESSION[login][id] = $rowuser[id];
    5.49 -      $_SESSION[login][loginname] = $loginname;
    5.50 -      $_SESSION[login][logintime] = time();
    5.51 -    }
    5.52 -  }
    5.53 -
    5.54 -
    5.55 -  /**
    5.56 -   * logs the user out
    5.57 -   */
    5.58 -  public function logout() {    // logout ------------------------------------------------------------
    5.59 -    unset($_SESSION[login]);
    5.60 -  }
    5.61 -
    5.62 -
    5.63 -  /**
    5.64 -   * proves if the user is logged in and if he wan't to long inactive
    5.65 -   *
    5.66 -   * @return bool 'true' if user is logged in, else 'false'
    5.67 -   */
    5.68 -  public function loggedIn() {    // return login-status ---------------------------------------------
    5.69 -    return (isset($_SESSION[login][id]) && $_SESSION[login][logintime] > time()-self::TIME_SESSION_EXPIRES);
    5.70 -  }
    5.71 -
    5.72 -
    5.73 -  /**
    5.74 -   * writes the current timestamp into the session
    5.75 -   * this is relevant for the time of inactivity
    5.76 -   */
    5.77 -  public function heartbeat() {
    5.78 -    if ($this->loggedIn()) {
    5.79 -      $_SESSION[login][logintime] = time();
    5.80 -    }
    5.81 -  }
    5.82 -
    5.83 -
    5.84 -
    5.85 -  /// Getter and Setter
    5.86 -
    5.87 -
    5.88 -  /**
    5.89 -   * @return user id
    5.90 -   */
    5.91 -  public function getUserId() {
    5.92 -    return $_SESSION[login][id];
    5.93 -  }
    5.94 -
    5.95 -  /**
    5.96 -   * @return user name
    5.97 -   */
    5.98 -  public function getLoginname() {
    5.99 -    return $_SESSION[login][loginname];
   5.100 -  }
   5.101 -
   5.102 -}
   5.103 -
   5.104 -
   5.105 -?>
     6.1 --- a/Nav.inc.php	Sun May 27 14:06:42 2007 +0200
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,128 +0,0 @@
     6.4 -  <!-- Nav -->
     6.5 -  <ul id="nav">
     6.6 -
     6.7 -<?php
     6.8 -    // all nodes that are displayed in the nav
     6.9 -    global $nodesDisplayed;
    6.10 -    $nodesDisplayed = '';
    6.11 -
    6.12 -
    6.13 -    // build nav tree
    6.14 -    echo '    '. navtree(0) ."\n";
    6.15 -
    6.16 -
    6.17 -    // find nodes without existing parent (orphans)
    6.18 -    $sql = sprintf("
    6.19 -      select distinct
    6.20 -        idParent
    6.21 -      from %sOwls 
    6.22 -      where 
    6.23 -        idParent not in (select id from %sOwls) 
    6.24 -        and idParent != 0    -- not the real root
    6.25 -      order by name asc
    6.26 -      ",
    6.27 -      DB_PREFIX,
    6.28 -      DB_PREFIX
    6.29 -    );
    6.30 -    $result = mysql_query($sql) or die(mysql_error());
    6.31 -    unset($sql);
    6.32 -
    6.33 -    // output only if there are orphans
    6.34 -    if (mysql_num_rows($result)) {
    6.35 -      echo '    <li id="orphans">orphans<ul>';
    6.36 -      // output subtree for every orphan
    6.37 -      while($row = mysql_fetch_array($result)) {
    6.38 -        echo navtree($row['idParent']);
    6.39 -      }
    6.40 -      unset($row);
    6.41 -      mysql_free_result($result);
    6.42 -
    6.43 -      echo '</ul></li>'."\n";
    6.44 -    }
    6.45 -
    6.46 -
    6.47 -
    6.48 -    // find broken nodes - nodes not displayed in nav or orphans (i.e. rings)
    6.49 -    $sql = sprintf("
    6.50 -      select
    6.51 -        id, name
    6.52 -      from %sOwls 
    6.53 -      where 
    6.54 -        id not in ( %s )
    6.55 -      order by name asc
    6.56 -      ",
    6.57 -      DB_PREFIX,
    6.58 -      substr($nodesDisplayed, 2)
    6.59 -    );
    6.60 -    $result = mysql_query($sql) or die(mysql_error());
    6.61 -    unset($sql);
    6.62 -
    6.63 -    // output only if there are broken nodes
    6.64 -    if (mysql_num_rows($result)) {
    6.65 -      echo '    <li id="broken">broken<ul>';
    6.66 -      // output list of nodes (no tree, cause there may be rings!)
    6.67 -      while($row = mysql_fetch_array($result)) {
    6.68 -        echo '<li><a href="'. $row['id'] .'"'. (($_GET['id'] == $row['id']) ? ' id="selected"' : '') .'>'. $row['name'] .'</a></li>';
    6.69 -      }
    6.70 -      unset($row);
    6.71 -      mysql_free_result($result);
    6.72 -
    6.73 -      echo '</ul></li>'."\n";
    6.74 -    }
    6.75 -
    6.76 -?>
    6.77 -
    6.78 -
    6.79 -  </ul>
    6.80 -
    6.81 -<?php
    6.82 -
    6.83 -
    6.84 -    /**
    6.85 -     * recursive function creates the output for the nav tree
    6.86 -     *
    6.87 -     * @param $root the id of the parent of the root node
    6.88 -     * @return string HTML output that shows the nav tree
    6.89 -     */
    6.90 -    function navtree($root) {
    6.91 -      // fetch subcategories
    6.92 -      $sql = sprintf("
    6.93 -        select
    6.94 -          id, idParent, name
    6.95 -        from %sOwls
    6.96 -        where
    6.97 -          idParent = $root
    6.98 -        order by name asc
    6.99 -        ",
   6.100 -        DB_PREFIX
   6.101 -      );
   6.102 -      $result = mysql_query($sql) or die(mysql_error());
   6.103 -      unset($sql);
   6.104 -
   6.105 -      $return = '';
   6.106 -      while($row = mysql_fetch_array($result)) {
   6.107 -        // add to list of displayed nodes
   6.108 -        global $nodesDisplayed;
   6.109 -        $nodesDisplayed .= ', '. $row['id'];
   6.110 -
   6.111 -        $return .= '<li><a href="'. $row['id'] .'"'. (($_GET['id'] == $row['id']) ? ' id="selected"' : '') .'>'. $row['name'] .'</a>';
   6.112 -        if ($row['id'] != $row['idParent']) {
   6.113 -          $subtree = navtree($row['id']);
   6.114 -          if (!empty($subtree)) {
   6.115 -            #$return .= '&nbsp;&nbsp;<a href="javascript:toggleVisibility(\''. $row['id'] .'\')" id="ctrl'. $row['id'] .'" style="display: none;">-</a>';
   6.116 -            $return .= '<ul id="node'. $row['id'] .'">'. $subtree .'</ul>';
   6.117 -          }
   6.118 -          unset($subtree);
   6.119 -        }
   6.120 -        $return .= '</li>';
   6.121 -      }
   6.122 -      unset($row);
   6.123 -      mysql_free_result($result);
   6.124 -
   6.125 -      // return
   6.126 -      return $return;
   6.127 -    }
   6.128 -
   6.129 -?>
   6.130 -
   6.131 -  <!-- Content -->
     7.1 --- a/Owls.php	Sun May 27 14:06:42 2007 +0200
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,357 +0,0 @@
     7.4 -<?php
     7.5 -
     7.6 -  require_once 'Config/Config.inc.php';
     7.7 -
     7.8 -  define('DB_PREFIX', $db_prefix);
     7.9 -  define('TITLE', $title);
    7.10 -
    7.11 -  require_once $db_connect;
    7.12 -  require_once 'Loginsys.class.php';
    7.13 -  include_once 'Bbcodeparser.inc.php';
    7.14 -
    7.15 -  $lsys = &new Loginsys();
    7.16 -
    7.17 -?>
    7.18 -<!--
    7.19 -
    7.20 -                       `Owls' - some kind of wiki system
    7.21 -
    7.22 -
    7.23 -                (c) Copyright  2006 &>  by Meillo  r e t u r n s
    7.24 -
    7.25 -         This program is free software; you can redistribute it and/or
    7.26 -          modify it under the terms of the GNU General Public License
    7.27 -         as published by the Free Software Foundation; either version 2
    7.28 -             of the License, or (at your option) any later version.
    7.29 -
    7.30 -        This program is distributed in the hope that it will be useful,
    7.31 -         but WITHOUT ANY WARRANTY; without even the implied warranty of
    7.32 -         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7.33 -                  GNU General Public License for more details.
    7.34 -
    7.35 -
    7.36 -                          http://prog.marmaro.de/owls/
    7.37 -
    7.38 --->
    7.39 -
    7.40 -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    7.41 -
    7.42 -<html xml:lang="de" xmlns="http://www.w3.org/1999/xhtml">
    7.43 -<head>
    7.44 -  <title><?php echo htmlentities(TITLE); ?></title>
    7.45 -  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    7.46 -  <link rel="shortcut icon" href="favicon.ico" />
    7.47 -  <link rel="stylesheet" type="text/css" href="Config/Owls.css.php" />
    7.48 -  <script type="text/javascript">
    7.49 -  <!--
    7.50 -    function sureToDelete(id) {
    7.51 -      if (window.prompt("Type 'delete' to delete","") == "delete") {
    7.52 -        location.href = id +"d";
    7.53 -      }
    7.54 -    }
    7.55 -
    7.56 -/*  I want to use this function later ... perhaps
    7.57 -    function toggleVisibility(boxId) {
    7.58 -      if (document.getElementById('node'+ boxId).style.display == 'none') {
    7.59 -        document.getElementById('node'+ boxId).style.display = "";
    7.60 -        document.getElementById('ctrl'+ boxId).firstChild.nodeValue = "-";
    7.61 -      } else{
    7.62 -        document.getElementById('node'+ boxId).style.display = "none";
    7.63 -        document.getElementById('ctrl'+ boxId).firstChild.nodeValue = "+";
    7.64 -      }
    7.65 -    }
    7.66 -*/
    7.67 -  //-->  
    7.68 -  </script>
    7.69 -</head>
    7.70 -
    7.71 -<body>
    7.72 -<div id="websiteContainer">
    7.73 -
    7.74 -  <!-- Banner -->
    7.75 -  <img src="<?php echo $banner; ?>" id="banner" alt="<?php echo htmlentities(TITLE); ?>" />
    7.76 -
    7.77 -<?php
    7.78 -
    7.79 -
    7.80 -  if ($_GET['action'] == 'show') {    // show
    7.81 -    show($lsys);
    7.82 -
    7.83 -  } else if ($_GET['action'] == 'new' && $lsys->loggedIn()) {    // new
    7.84 -    create($lsys);
    7.85 -
    7.86 -  } else if ($_GET['action'] == 'edit' && $lsys->loggedIn()) {    // edit
    7.87 -    edit($lsys);
    7.88 -
    7.89 -  } else if ($_GET['action'] == 'delete' && $lsys->loggedIn()) {    // delete
    7.90 -    delete($lsys);
    7.91 -
    7.92 -  } else if ($_GET['action'] == 'login') {    // login
    7.93 -    $lsys->login($_POST['login_loginname'], md5($_POST['login_password']));
    7.94 -    show($lsys);
    7.95 -
    7.96 -  } else if ($_GET['action'] == 'logout') {    // logout
    7.97 -    $lsys->logout();
    7.98 -    show($lsys);
    7.99 -
   7.100 -  } else {    // startpage
   7.101 -    $_GET['id'] = 1;
   7.102 -    show($lsys);
   7.103 -
   7.104 -  }
   7.105 -
   7.106 -
   7.107 -
   7.108 -
   7.109 -
   7.110 -?>
   7.111 -
   7.112 -  </div>
   7.113 -
   7.114 -
   7.115 -</div>
   7.116 -
   7.117 -</body>
   7.118 -</html>
   7.119 -<?php
   7.120 -
   7.121 -
   7.122 -
   7.123 -
   7.124 -
   7.125 -
   7.126 -
   7.127 -
   7.128 -/*
   7.129 -    displays content of the node
   7.130 -    performs action 'edit'
   7.131 -    shows admincontrols if logged in
   7.132 -*/
   7.133 -function show($lsys) {
   7.134 -
   7.135 -
   7.136 -  // perform action: write edited node to db
   7.137 -  if (isset($_POST['editDoc']) && $lsys->loggedIn()) {
   7.138 -    $_POST['editDoc_title'] = addslashes($_POST['editDoc_title']);
   7.139 -    $_POST['editDoc_text'] = addslashes($_POST['editDoc_text']);
   7.140 -    mysql_query("update ". DB_PREFIX ."Owls set
   7.141 -      name='$_POST[editDoc_title]',
   7.142 -      text='$_POST[editDoc_text]',
   7.143 -      idParent='$_POST[editDoc_idCategory]',
   7.144 -      date=". time() ."
   7.145 -    where id='$_GET[id]'") or die(mysql_error());
   7.146 -  }
   7.147 -
   7.148 -  // print nav
   7.149 -  include 'Nav.inc.php';
   7.150 -
   7.151 -
   7.152 -
   7.153 -
   7.154 -  // query data of the node
   7.155 -  $result = mysql_query("select * from ". DB_PREFIX ."Owls where id=$_GET[id]");
   7.156 -  
   7.157 -  // catch nodes that not exist
   7.158 -  if (!mysql_num_rows($result)) {
   7.159 -
   7.160 -    $fnord = array('',
   7.161 -      'Fnord is the space between the pixels on your screen.',
   7.162 -      'Fnord is the echo of silence.',
   7.163 -      'Fnord is evaporated herbal tea without the herbs.',
   7.164 -      'Fnord is what you see when you close your eyes.',
   7.165 -      'Fnord is the empty pages at the end of the book.',
   7.166 -      'Fnord is why ducks eat trees.',
   7.167 -      'Fnord is the bucket where they keep the unused serifs for H*lvetica.',
   7.168 -      'Fnord is the source of all the zero bits in your computer.'
   7.169 -    );
   7.170 -
   7.171 -?>
   7.172 -      <div id="content">
   7.173 -        <h2>Error 23 - fnord found</h2>
   7.174 -        <p>
   7.175 -          <?php echo $fnord[rand(0, sizeof($fnord)-1)]; ?>
   7.176 -        </p>
   7.177 -<?php
   7.178 -
   7.179 -  } else {
   7.180 -
   7.181 -    $row = mysql_fetch_array($result);
   7.182 -    echo '  <div id="content">'."\n";
   7.183 -
   7.184 -      // display admin controls or login form
   7.185 -?>
   7.186 -        <div class="ctrl">
   7.187 -<?php
   7.188 -          // display last update
   7.189 -          if ($_GET['id'] == 1) {
   7.190 -            // root node displays date of last modification of any node
   7.191 -            $sql = sprintf("
   7.192 -              select
   7.193 -                max(date)
   7.194 -              from %sOwls
   7.195 -              ",
   7.196 -              DB_PREFIX
   7.197 -            );
   7.198 -          } else {
   7.199 -            $sql = sprintf("
   7.200 -              select
   7.201 -                date
   7.202 -              from %sOwls
   7.203 -              where
   7.204 -                id = ". $_GET['id'] ."
   7.205 -              ",
   7.206 -              DB_PREFIX
   7.207 -            );
   7.208 -          }
   7.209 -          $result = mysql_query($sql) or die(mysql_error());
   7.210 -          unset($sql);
   7.211 -
   7.212 -          $rowUpdate = mysql_fetch_row($result);
   7.213 -          $lastUpdate = $rowUpdate[0];
   7.214 -?>
   7.215 -          <span style="font-size: 0.8em;">
   7.216 -            last update: <?php echo date('d.m.Y H:i', $lastUpdate); ?>
   7.217 -          </span>
   7.218 -
   7.219 -<?php
   7.220 -      if ($lsys->loggedIn()) {
   7.221 -?>
   7.222 -          <a href="<?php echo $row['id'] .'n'; ?>">new</a>
   7.223 -          <a href="<?php echo $row['id'] .'e'; ?>">edit</a>
   7.224 -<?php
   7.225 -          if ($row['id'] != 1) {
   7.226 -            echo '<a href="javascript:sureToDelete('. $row['id'] .')">delete</a>';
   7.227 -          }
   7.228 -          echo '    <a href="'. $_GET['id'] .'logout" style="color: #c00;">logout</a>';
   7.229 -      } else {
   7.230 -?>
   7.231 -        <form name="loginform" id="loginform" action="<?php echo $_GET['id']; ?>login" method="post" enctype="multipart/form-data" style="display: inline;">
   7.232 -          <input name="login_loginname" type="text" />
   7.233 -          <input name="login_password" type="password" />
   7.234 -          <input name="login" type="submit" value="login" style="padding: 0; cursor: pointer; width: 5em;" />
   7.235 -        </form>
   7.236 -<?php
   7.237 -      }
   7.238 -?>
   7.239 -        </div>
   7.240 -<?php
   7.241 -
   7.242 -    // print content of the node
   7.243 -    echo '    <h2>'.stripslashes($row['name']).'</h2>'."\n";
   7.244 -    if (!empty($row['text'])) {
   7.245 -      echo '    <p>'.bbcode(stripslashes($row['text']), 1, 1).'</p>';
   7.246 -    }
   7.247 -  }
   7.248 -  echo "\n\n";
   7.249 -
   7.250 -}
   7.251 -
   7.252 -
   7.253 -
   7.254 -
   7.255 -
   7.256 -/*
   7.257 -    displays edit form
   7.258 -*/
   7.259 -function edit($lsys) {
   7.260 -
   7.261 -    include 'Nav.inc.php';
   7.262 -
   7.263 -    $sql = "select * from ". DB_PREFIX ."Owls where id=$_GET[id]";
   7.264 -    $result = mysql_query($sql) or die(mysql_error());
   7.265 -    $row = mysql_fetch_array($result);
   7.266 -      echo '<div id="content">';
   7.267 -?>
   7.268 -<div id="edit" style="position: relative; width: 99%">
   7.269 -  <form action="<?php echo $row['id']; ?>" method="post" enctype="multipart/form-data">
   7.270 -<?php
   7.271 -    if ($_GET['id'] != 1) {
   7.272 -?>
   7.273 -      <select name="editDoc_idCategory" style="width: 99%;">
   7.274 -<?php
   7.275 -      $sql = sprintf("
   7.276 -        select 
   7.277 -          * 
   7.278 -        from %sOwls 
   7.279 -        where 
   7.280 -          id != %d
   7.281 -          and idParent != %d
   7.282 --- not in (
   7.283 ---            select idParent from %sOwls
   7.284 ---          )
   7.285 -        order by name asc
   7.286 -        ",
   7.287 -        DB_PREFIX,
   7.288 -        $row['id'],
   7.289 -        $row['id'],
   7.290 -        DB_PREFIX
   7.291 -      );
   7.292 -      $result = mysql_query($sql) or die(mysql_error());
   7.293 -      unset($sql);
   7.294 -      while($rowCats = mysql_fetch_array($result)) {
   7.295 -        echo '  <option value="'.$rowCats['id'].'"'. (($row['idParent'] == $rowCats['id']) ? ' selected="selected" style="font-weight: bold;"' : '') .'>'.stripslashes($rowCats['name']).'</option>';
   7.296 -      }
   7.297 -?>
   7.298 -      </select><br /><br />
   7.299 -<?php
   7.300 -    }
   7.301 -?>
   7.302 -    <input name="editDoc_title" type="text" value="<?php echo stripslashes($row['name']); ?>" style="width: 99%; font-weight: bold;" /><br />
   7.303 -    <textarea name="editDoc_text" cols="60" rows="15" style="width: 99%; height: 30em;"><?php
   7.304 -      echo stripslashes($row['text']);
   7.305 -    ?></textarea><br /><br />
   7.306 -    <input name="editDoc" type="submit" value="edit" class="button" style="width: 99%;" />
   7.307 -  </form>
   7.308 -</div>
   7.309 -<?php
   7.310 -  unset($row);
   7.311 -  unset($result);
   7.312 -}
   7.313 -
   7.314 -
   7.315 -
   7.316 -
   7.317 -
   7.318 -
   7.319 -/*
   7.320 -    performs action 'new'
   7.321 -*/
   7.322 -function create($lsys) {
   7.323 -
   7.324 -  // perform action: new node
   7.325 -  mysql_query("
   7.326 -    insert into ". DB_PREFIX ."Owls
   7.327 -    (idParent, date)
   7.328 -    values('$_GET[id]',". time() .")
   7.329 -  ") or die(mysql_error());
   7.330 -
   7.331 -  // set node to jump to (new created node)
   7.332 -  $_GET['id'] = mysql_insert_id();
   7.333 -  edit($lsys);
   7.334 -}
   7.335 -
   7.336 -
   7.337 -
   7.338 -
   7.339 -
   7.340 -/*
   7.341 -    performs action 'delete'
   7.342 -*/
   7.343 -function delete($lsys) {
   7.344 -  // not allowed to delete the root
   7.345 -  if ($_GET['id'] != 1) {
   7.346 -    // TODO: get the parent of the one which is to delete
   7.347 -
   7.348 -    // delete
   7.349 -    mysql_query("delete from ". DB_PREFIX ."Owls where id='$_GET[id]'") or die(mysql_error());
   7.350 -  }
   7.351 -  // set node to jump to (TODO: parent from above)
   7.352 -  $_GET['id'] = 1;
   7.353 -  show($lsys);
   7.354 -}
   7.355 -
   7.356 -
   7.357 -
   7.358 -
   7.359 -?>
   7.360 -
     8.1 Binary file Owls.png has changed
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/bbcodeparser.inc.php	Sat Jul 23 21:39:17 2016 +0200
     9.3 @@ -0,0 +1,158 @@
     9.4 +<?php
     9.5 +/**
     9.6 + * BB-Code-Parser
     9.7 + *
     9.8 + * @author Meillo  r e t u r n s <meillo@marmaro.de>
     9.9 + */
    9.10 +
    9.11 +
    9.12 +  /// path to smilies
    9.13 +  define('SMILIE_DIR', 'smilies/');
    9.14 +
    9.15 +
    9.16 +
    9.17 +  /**
    9.18 +   * parses recursive quotes without a source mentioned
    9.19 +   *
    9.20 +   * @param $textinput the bbcode-text
    9.21 +   * @param $level number of levels to go inside
    9.22 +   * @return HTML-text
    9.23 +   */
    9.24 +  function parse_quote1($textinput,$level = 1) {
    9.25 +    $pattern = '#\[quote\](((?R)|(.*))*)\[/quote\]#isUe';
    9.26 +    $replacement = "'<br />[nl]<span class=\"quote0\">Zitat:</span>[nl]<div class=\"quote1\">[nl]'.parse_quote1('$1',
    9.27 +                     ". ($level + 1) ."
    9.28 +                   ).'[nl]</div>[nl]'";
    9.29 +    return preg_replace($pattern, $replacement, $textinput);
    9.30 +  }
    9.31 +
    9.32 +  /**
    9.33 +   * parses recursive quotes with a source mentioned
    9.34 +   *
    9.35 +   * @param $textinput the bbcode-text
    9.36 +   * @param $level number of levels to go inside
    9.37 +   * @return HTML-text
    9.38 +   */
    9.39 +  function parse_quote2($textinput,$level = 1) {
    9.40 +    $pattern = '#\[quote\=(.*)\](((?R)|(.*))*)\[/quote\]#isUe';
    9.41 +    $replacement = "'<br />[nl]<span class=\"quote0\">Zitat: ($1)</span>[nl]<div class=\"quote2\">[nl]'.parse_quote2('$2',
    9.42 +                     ". ($level + 1) ."
    9.43 +                   ).'[nl]</div>[nl]'";
    9.44 +    return preg_replace($pattern, $replacement, $textinput);
    9.45 +  }
    9.46 +
    9.47 +  /**
    9.48 +   * replaces smilies
    9.49 +   *
    9.50 +   * @param $text text with ASCII-smilies
    9.51 +   * @return text with [img]-smilies
    9.52 +   */
    9.53 +  function smilies($text) {
    9.54 +    $smilies = array( ':-?\)'        => 'Smile.gif',
    9.55 +                      ';-?\)'        => 'Wink.gif',
    9.56 +                      ':-?D'        => 'Biggrin.gif',
    9.57 +                      ':-?\('        => 'Sad.gif',
    9.58 +                      ':-?P'        => 'Lick.gif',
    9.59 +                      ':o'         => 'Talk.gif',
    9.60 +                      ':-S'        => 'Dontknow.gif',
    9.61 +                      ':dontknow:' => 'Dontknow.gif',
    9.62 +                      ':-@'        => 'Angry.gif',
    9.63 +                      ':cool:'     => 'Cool.gif',
    9.64 +                      'B-\)'        => 'Cool.gif',
    9.65 +                      '%-\)'        => 'Crosseyed.gif',
    9.66 +                      '%-\('        => 'Crosseyed.gif',
    9.67 +                      ':rolleyes:' => 'Rolleyes.gif',
    9.68 +                      ':eek:'      => 'Shocked.gif');
    9.69 +    while(list($key, $val) = each($smilies)) {
    9.70 +	$key = '/(\s|^)'.$key.'(\s|$)/';
    9.71 +	$text = preg_replace($key, '$1[img]'. SMILIE_DIR . $val .'[/img]$2', $text);
    9.72 +    }
    9.73 +    return $text;
    9.74 +  }
    9.75 +
    9.76 +
    9.77 +  /**
    9.78 +   * turns bbcode in HTML
    9.79 +   *
    9.80 +   * @param $text the text with bbcode inside
    9.81 +   * @param $smilies set to 1 causes smilies to be replaced with pics
    9.82 +   * @param $images set to 1 causes images to be displayed ([img]-tag)
    9.83 +   * @return text with HTML-code
    9.84 +   */
    9.85 +  function bbcode($text, $smilies = 0, $images = 0) {
    9.86 +
    9.87 +    // line breaks and special chars
    9.88 +    $text = preg_replace("#(\r\n)|(\r)#", "\n", htmlentities($text, ENT_COMPAT, 'UTF-8'));
    9.89 +    $text = preg_replace("#(\n){3,}#", "\n\n", $text);
    9.90 +
    9.91 +    // smilies
    9.92 +    if ($smilies == 1) {
    9.93 +      $text = smilies($text);
    9.94 +    }
    9.95 +
    9.96 +		/*
    9.97 +    // new-lines
    9.98 +    $text = preg_replace("#(\r\n)|(\r)#", "\n", $text);
    9.99 +    $text = str_replace("\n", '<br />[nl]', htmlentities($text, ENT_COMPAT, 'UTF-8'));
   9.100 +
   9.101 +    // bold
   9.102 +    $text = preg_replace("#\[b\](.*?)\[/b\]#i", "<strong>$1</strong>", $text);
   9.103 +    // italic
   9.104 +    $text = preg_replace("#\[i\](.*?)\[/i\]#i", "<i>$1</i>", $text);
   9.105 +    // links
   9.106 +    $text = preg_replace("#\[url\](.*)\[/url\]#iU", "<a href=\"$1\">$1</a>", $text);
   9.107 +    $text = preg_replace("#\[url=(.*)\](.*)\[/url\]#iU", "<a href=\"$1\">$2</a>", $text);
   9.108 +    // lists
   9.109 +      //$text = preg_replace("#\[list\]\<br /\>(.*)\[/list\]#iU", "<ul>$1</ul>", $text);
   9.110 +      //$text = preg_replace("#\[\*\](.*)\<br \/\>#iU", "<li>$1</li>", $text);
   9.111 +    // quotes
   9.112 +		*/
   9.113 +    $text = parse_quote1($text);
   9.114 +    $text = parse_quote2($text);
   9.115 +    // images
   9.116 +    if ($images == 1) {
   9.117 +      $text = preg_replace("#\[img\](.*?)\[/img\]#i", "<img src=\"$1\" alt=\"&lt;[Bild]&gt;\" />", $text);
   9.118 +    }
   9.119 +
   9.120 +		/*
   9.121 +    // remove backslashes
   9.122 +    $text = preg_replace("#\\\#is", "", $text);
   9.123 +    // new-lines
   9.124 +    $text = str_replace('[nl]', "\n", $text);
   9.125 +		*/
   9.126 +
   9.127 +
   9.128 +    // inline
   9.129 +    $text = preg_replace('#\[b\](.*)\[/b\]#iU', '<strong>$1</strong>', $text);
   9.130 +    $text = preg_replace('#\*(.*)\*#iU', '<strong>$1</strong>', $text);
   9.131 +    $text = preg_replace('#\[i\](.*)\[/i\]#iU', '<i>$1</i>', $text);
   9.132 +    $text = preg_replace('#[^A-Za-z0-9]_(.*)_[^A-Za-z0-9]#iU', '<em>$1</em>', $text);
   9.133 +    $text = preg_replace('#{{{(.*)}}}#iUs', '<tt>$1</tt>', $text);
   9.134 +    $text = preg_replace("#\[url\](.*)\[/url\]#iU","<a href=\"$1\">$1</a>",$text);
   9.135 +    $text = preg_replace("#\[url=(.*)\](.*)\[/url\]#iU","<a href=\"$1\">$2</a>",$text);
   9.136 +    $text = preg_replace("#\[img\](.*)\[/img\]#iU","<img src=\"$1\" alt=\"[Bild]\" />", $text);
   9.137 +    $text = preg_replace("#^-{3,}$#iUm","<hr />", $text);
   9.138 +
   9.139 +    // Listen
   9.140 +#      $text = preg_replace("#\[list\](.*)\[/list\]#i","<ul>$1</ul>", $text);
   9.141 +    $text = preg_replace("#^\s*\*(.*)\n#imU", "<li>$1</li>", $text);
   9.142 +    $text = preg_replace("#^((\s*\<li\>(.*)\</li\>\s*)+)$#im", "<ul>$1</ul>", $text);
   9.143 +
   9.144 +
   9.145 +
   9.146 +
   9.147 +    // boxes
   9.148 +
   9.149 +
   9.150 +    $text = preg_replace('#^(.+)$#mU', "<p>\n  $1\n</p>", $text);
   9.151 +
   9.152 +		# nicht wenn <h_> oder <ul> enthalten sind
   9.153 +    $text = preg_replace("#\<p\>\n  \[h([1-6]{1})\](.*)\[/h[1-6]{1}\]\n\</p\>#iU", "\n<h$1>$2</h$1>", $text);
   9.154 +    $text = preg_replace("#\<p\>\n  ===(.*)\n\</p\>#iU", "\n<h3>$1</h3>", $text);
   9.155 +    $text = preg_replace("#\<p\>\n  ==(.*)\n\</p\>#iU", "\n<h2>$1</h2>", $text);
   9.156 +
   9.157 +    $text = preg_replace("#\<p\>\n  \<ul\>(.*)\</ul\>\n\</p\>#iU", "<ul>\n  $1\n</ul>", $text);
   9.158 +    return $text;
   9.159 +  }
   9.160 +
   9.161 +?>
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/data/text	Sat Jul 23 21:39:17 2016 +0200
    10.3 @@ -0,0 +1,3 @@
    10.4 +Welcome to the Owls content rendering system.
    10.5 +
    10.6 +Put more files and directory structures into the data directory.
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/index.php	Sat Jul 23 21:39:17 2016 +0200
    11.3 @@ -0,0 +1,41 @@
    11.4 +<?php
    11.5 +	error_reporting(E_ALL);
    11.6 +	include_once 'bbcodeparser.inc.php';
    11.7 +?>
    11.8 +<html>
    11.9 +<head>
   11.10 +  <title>Owls - content-rendering system</title>
   11.11 +  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   11.12 +  <link rel="shortcut icon" href="favicon.ico" />
   11.13 +  <link rel="stylesheet" type="text/css" href="owls.css.php" />
   11.14 +</head>
   11.15 +
   11.16 +<body>
   11.17 +<div id="websiteContainer">
   11.18 +  <a href="/">
   11.19 +  <img src="owls-banner.png" id="banner" />
   11.20 +  </a>
   11.21 +
   11.22 +<?php
   11.23 +	include 'nav.inc.php';
   11.24 +
   11.25 +	if (!isset($_GET['path'])) {
   11.26 +		$_GET['path'] = '/';
   11.27 +	}
   11.28 +	echo '  <div id="content">'."\n";
   11.29 +	echo "    <h2>". preg_replace('/.*\//', '', $_GET['path']) ."</h2>\n";
   11.30 +	$file = 'data/'. $_GET['path'].'/text';
   11.31 +	if (is_file($file)) {
   11.32 +		$text = file_get_contents($file);
   11.33 +	} else {
   11.34 +		$text = 'file not found';
   11.35 +	}
   11.36 +	echo '    <p>'.bbcode($text, 1, 1).'</p>';
   11.37 +	echo '  </div>';
   11.38 +	echo "\n\n";
   11.39 +?>
   11.40 +
   11.41 +</div>
   11.42 +
   11.43 +</body>
   11.44 +</html>
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/nav.inc.php	Sat Jul 23 21:39:17 2016 +0200
    12.3 @@ -0,0 +1,42 @@
    12.4 +  <ul id="nav">
    12.5 +
    12.6 +<?php
    12.7 +
    12.8 +	define('BASE', 'data/');
    12.9 +
   12.10 +	echo '    <li><a href="."'. (empty($_GET['path']) ? ' id="selected"' : '') .">Home</a></li>";
   12.11 +	// build nav tree
   12.12 +	echo '    '. navtree("") ."\n";
   12.13 +?>
   12.14 +
   12.15 +
   12.16 +  </ul>
   12.17 +
   12.18 +<?php
   12.19 +
   12.20 +
   12.21 +
   12.22 +/* recursive function creates the output for the nav tree */
   12.23 +function navtree($root) {
   12.24 +
   12.25 +	if (!empty($root)) {
   12.26 +		$root .= '/';
   12.27 +	}
   12.28 +	$files = scandir(BASE."$root");
   12.29 +	$return = '';
   12.30 +	foreach ($files as $f) {
   12.31 +		if (!is_dir(BASE."$root$f") || substr($f, 0, 1) == '.') {
   12.32 +			continue;
   12.33 +		}
   12.34 +		$return .= "<li><a href=\"?path=$root$f\"". ((isset($_GET['path']) && $_GET['path'] == "$root$f") ? ' id="selected"' : '') .">$f</a>";
   12.35 +		$subtree = navtree("$root$f");
   12.36 +		if (!empty($subtree)) {
   12.37 +			$return .= "<ul>$subtree</ul>";
   12.38 +		}
   12.39 +		unset($subtree);
   12.40 +	}
   12.41 +	$return .= '</li>';
   12.42 +	return $return;
   12.43 +}
   12.44 +
   12.45 +?>
    13.1 Binary file owls-banner.png has changed
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/owls.css.php	Sat Jul 23 21:39:17 2016 +0200
    14.3 @@ -0,0 +1,210 @@
    14.4 +<?php
    14.5 +/*########################################################
    14.6 +######    to modify the look of owls, edit below    ######
    14.7 +########################################################*/
    14.8 +
    14.9 +
   14.10 +/*
   14.11 +    color setup
   14.12 +    use color values according to http://www.w3.org/TR/CSS21/syndata.html#color-units
   14.13 +    you can assign the set variables too
   14.14 +*/
   14.15 +
   14.16 +  $c_Text             = '#ccc';
   14.17 +  $c_Background       = '#333';
   14.18 +
   14.19 +  $c_Border           = $c_Text;
   14.20 +
   14.21 +  $c_Link             = $c_Text;
   14.22 +  $c_LinkHover        = '#6af';    // ff8040
   14.23 +  $c_LinkVisited      = '#666';
   14.24 +
   14.25 +  $c_Nav              = $c_Link;
   14.26 +  $c_NavHover         = $c_LinkHover;
   14.27 +  $c_NavSelected      = '#06f';
   14.28 +
   14.29 +  $c_Login            = '#000';
   14.30 +  $c_Admin            = '#ffff80';    //ffff80
   14.31 +
   14.32 +
   14.33 +/*
   14.34 +    width of the menu area
   14.35 +    the unit 'em' is relative to the font-size
   14.36 +    see: http://www.w3.org/TR/CSS21/syndata.html#length-units
   14.37 +*/
   14.38 +
   14.39 +  $m_NavWidth         = '10em';
   14.40 +
   14.41 +
   14.42 +/*########################################################
   14.43 +#################    stop editing here    ################
   14.44 +########################################################*/
   14.45 +
   14.46 +
   14.47 +
   14.48 +
   14.49 +
   14.50 +
   14.51 +  header('Content-Type: text/css; charset=utf8');
   14.52 +
   14.53 +  // avoid caching    TODO: think about removing, cause it's just for dev
   14.54 +  header('Expires: Thu, 05 Apr 1984 04:47:00 GMT');
   14.55 +  header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
   14.56 +  header('Cache-Control: no-store');
   14.57 +  header('Pragma: no-cache');
   14.58 +  echo('/* Anti-Caching: '.microtime()." */\r\n");
   14.59 +
   14.60 +?>
   14.61 +
   14.62 +
   14.63 +
   14.64 +body {
   14.65 +  font-family: sans-serif;
   14.66 +  margin: 30px 0;
   14.67 +  text-align: center;
   14.68 +  color: <?php echo $c_Text; ?>;
   14.69 +  background-color: <?php echo $c_Background; ?>;
   14.70 +}
   14.71 +
   14.72 +
   14.73 +#websiteContainer {
   14.74 +  width: 760px;
   14.75 +  margin: 0 auto;
   14.76 +  text-align: justify;
   14.77 +}
   14.78 +
   14.79 +#banner {
   14.80 +  display: block;
   14.81 +  margin: 0 auto;
   14.82 +  border: none;
   14.83 +}
   14.84 +
   14.85 +#content {
   14.86 +  position: relative;
   14.87 +  margin-left: <?php echo $m_NavWidth; ?>;
   14.88 +  padding: 1em;
   14.89 +}
   14.90 +
   14.91 +
   14.92 +
   14.93 +
   14.94 +
   14.95 +/*  links  */
   14.96 +a:link {
   14.97 +  color: <?php echo $c_Link; ?>;
   14.98 +}
   14.99 +a:visited {
  14.100 +  color: <?php echo $c_LinkVisited;?>;
  14.101 +}
  14.102 +a:active,
  14.103 +a:hover {
  14.104 +  color: <?php echo $c_LinkHover; ?>;
  14.105 +}
  14.106 +
  14.107 +
  14.108 +
  14.109 +
  14.110 +
  14.111 +
  14.112 +/*  nav  */
  14.113 +#nav {
  14.114 +  list-style: none;
  14.115 +  float: left;
  14.116 +  width: <?php echo $m_NavWidth; ?>;
  14.117 +  padding: 0.5em 2em 1em 0.5em;
  14.118 +  margin: 2.5em 0 1em 0;
  14.119 +  font-size: 0.8em;
  14.120 +}
  14.121 +
  14.122 +#nav ul {
  14.123 +  list-style: none;
  14.124 +  margin-left: 0;
  14.125 +  padding-left: 1em;
  14.126 +}
  14.127 +#nav li {
  14.128 +  padding: 1px;
  14.129 +  margin: 0;
  14.130 +}
  14.131 +
  14.132 +#nav a {
  14.133 +  display: block;
  14.134 +  text-decoration: none;
  14.135 +  color: <?php echo $c_Nav; ?>;
  14.136 +}
  14.137 +#nav a:link,
  14.138 +#nav a:visited {
  14.139 +  text-decoration: none;
  14.140 +}
  14.141 +#nav a:active,
  14.142 +#nav a:hover {
  14.143 +  color: <?php echo $c_NavHover; ?>;
  14.144 +  text-decoration: none;
  14.145 +}
  14.146 +
  14.147 +#selected:link,
  14.148 +#selected:visited {
  14.149 +  color: <?php echo $c_NavSelected; ?>;
  14.150 +}
  14.151 +#nav #selected:hover {
  14.152 +  color: <?php echo $c_NavHover; ?>;
  14.153 +}
  14.154 +
  14.155 +
  14.156 +
  14.157 +
  14.158 +/*  orphans and broken  */
  14.159 +li#orphans,
  14.160 +li#broken {
  14.161 +  margin-top: 3em;
  14.162 +  font-style: italic;
  14.163 +  color: <?php echo $c_Admin; ?>;
  14.164 +}
  14.165 +
  14.166 +
  14.167 +
  14.168 +
  14.169 +/*  login  */
  14.170 +#loginform input {
  14.171 +  background-color: transparent;
  14.172 +  border: <?php echo $c_Login; ?> 1px solid;
  14.173 +  font-size: 0.8em;
  14.174 +  width: 8em;
  14.175 +}
  14.176 +
  14.177 +
  14.178 +
  14.179 +
  14.180 +
  14.181 +
  14.182 +/*  admin controls  */
  14.183 +.ctrl {
  14.184 +  position: absolute;
  14.185 +  right: 0;
  14.186 +  text-align: right;
  14.187 +  font-size: 0.8em;
  14.188 +  color: <?php echo $c_Login; ?>;
  14.189 +}
  14.190 +.ctrl a,
  14.191 +.ctrl a:visited,
  14.192 +.ctrl a:hover {
  14.193 +  margin-left: 1em;
  14.194 +  color: <?php echo $c_Admin; ?>;
  14.195 +}
  14.196 +
  14.197 +
  14.198 +
  14.199 +
  14.200 +
  14.201 +
  14.202 +/*  edit form  */
  14.203 +#edit {
  14.204 +  margin-top: 1.5em;
  14.205 +}
  14.206 +#edit input,
  14.207 +#edit select,
  14.208 +#edit textarea {
  14.209 +  font-family: sans-serif;
  14.210 +  font-size: 0.8em;
  14.211 +  border: <?php echo $c_Border; ?> 1px solid;
  14.212 +}
  14.213 +
    15.1 Binary file smilies/Angry.gif has changed
    16.1 Binary file smilies/Biggrin.gif has changed
    17.1 Binary file smilies/Cool.gif has changed
    18.1 Binary file smilies/Crosseyed.gif has changed
    19.1 Binary file smilies/Dontknow.gif has changed
    20.1 Binary file smilies/Faustball.gif has changed
    21.1 Binary file smilies/Lick.gif has changed
    22.1 Binary file smilies/Rolleyes.gif has changed
    23.1 Binary file smilies/Sad.gif has changed
    24.1 Binary file smilies/Shocked.gif has changed
    25.1 Binary file smilies/Smile.gif has changed
    26.1 Binary file smilies/Talk.gif has changed
    27.1 Binary file smilies/Wink.gif has changed