# HG changeset patch # User "Meillo r e t u r n s " # Date 1165181533 -3600 # Node ID 3021ce32ee142c32840dbc01d6db34487f9daab8 begin of using hg for owls diff -r 000000000000 -r 3021ce32ee14 .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Sun Dec 03 22:32:13 2006 +0100 @@ -0,0 +1,12 @@ +syntax: glob + +.*.swp +.*.swo +*~ + +_Dev + +Banner.png +Smilies +favicon.ico +robots.txt diff -r 000000000000 -r 3021ce32ee14 .htaccess --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.htaccess Sun Dec 03 22:32:13 2006 +0100 @@ -0,0 +1,16 @@ +RewriteEngine On +Options -MultiViews +DirectoryIndex Owls.php +#ErrorDocument 404 /Owls.php?error=404 + + +# rules + + RewriteRule ^([0-9]+)$ Owls.php?id=$1&action=show [NC] + RewriteRule ^([0-9]+)n$ Owls.php?id=$1&action=new [NC] + RewriteRule ^([0-9]+)e$ Owls.php?id=$1&action=edit [NC] + RewriteRule ^([0-9]+)d$ Owls.php?id=$1&action=delete [NC] + + RewriteRule ^([0-9]+)login$ Owls.php?id=$1&action=login [NC] + RewriteRule ^([0-9]+)logout$ Owls.php?id=$1&action=logout [NC] + diff -r 000000000000 -r 3021ce32ee14 Includes/Bbcodeparser.inc.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Includes/Bbcodeparser.inc.php Sun Dec 03 22:32:13 2006 +0100 @@ -0,0 +1,94 @@ +[nl]Zitat:[nl]
[nl]'.parse_quote1('$1', + ". ($level + 1) ." + ).'[nl]
[nl]'"; + return preg_replace($pattern, $replacement, $textinput); + } + function parse_quote2($textinput,$level = 1) { // mit Quelle + $pattern = '#\[quote\=(.*)\](((?R)|(.*))*)\[/quote\]#isUe'; + $replacement = "'
[nl]Zitat: ($1)[nl]
[nl]'.parse_quote2('$2', + ". ($level + 1) ." + ).'[nl]
[nl]'"; + return preg_replace($pattern, $replacement, $textinput); + } + + function smilies($text) { + $smilieDir = 'Pics/Smilies/'; // path to smilies + + $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', + '(H)' => 'Cool.gif', + '%-)' => 'Crosseyed.gif', + '%-(' => 'Crosseyed.gif', + ':rolleyes:' => 'Rolleyes.gif', + ':eek:' => 'Shocked.gif'); + while(list($key, $val) = each($smilies)) { + $text = str_replace($key,'[img]'.$smilieDir.$val.'[/img]',$text); + } + return $text; + } + + + 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; + } + +?> \ No newline at end of file diff -r 000000000000 -r 3021ce32ee14 Includes/Footer.inc.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Includes/Footer.inc.php Sun Dec 03 22:32:13 2006 +0100 @@ -0,0 +1,7 @@ + + + + + + + diff -r 000000000000 -r 3021ce32ee14 Includes/Header.inc.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Includes/Header.inc.php Sun Dec 03 22:32:13 2006 +0100 @@ -0,0 +1,71 @@ + + + + + + + + <?php echo htmlentities(TITLE); ?> + + + + + + + +
    + + + + diff -r 000000000000 -r 3021ce32ee14 Includes/Loginsys.class.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Includes/Loginsys.class.php Sun Dec 03 22:32:13 2006 +0100 @@ -0,0 +1,65 @@ +heartbeat(); + } + + + + + // Methods + + 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(); + } + } + + + + public function logout() { // logout ------------------------------------------------------------ + unset($_SESSION[login]); + } + + + + public function loggedIn() { // return login-status --------------------------------------------- + return (isset($_SESSION[login][id]) && $_SESSION[login][logintime] > time()-TIME_SESSION_EXPIRES); + } + + + + public function heartbeat() { + if ($this->loggedIn()) { + $_SESSION[login][logintime] = time(); + } + } + + + + // Getter and Setter + + public function getUserId() { + return $_SESSION[login][id]; + } + + + public function getLoginname() { + return $_SESSION[login][loginname]; + } + +} + + +?> diff -r 000000000000 -r 3021ce32ee14 Includes/Nav.inc.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Includes/Nav.inc.php Sun Dec 03 22:32:13 2006 +0100 @@ -0,0 +1,86 @@ + + + +'. $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 000000000000 -r 3021ce32ee14 Owls.css.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Owls.css.php Sun Dec 03 22:32:13 2006 +0100 @@ -0,0 +1,215 @@ + + + + +/*#### Standard ############################################################*/ +body { + font-family: sans-serif; + margin: 30px 0; + text-align: center; + background-color: ; +} + + +#websiteContainer { + width: 760px; + margin: 0 auto; + text-align: left; +} + +#banner { + display: block; + border: 1px solid ; +} + + +#content { + margin-left: ; + padding: 1em; +} + + +#edit input, +#edit select, +#edit textarea { + font-family: sans-serif; + font-size: 0.8em; +} + + +p { + text-align: justify; +} + + +a { + text-decoration: underline; +} +a:link { + color: #000; +} +a:visited { + color: #aaa; +} +a:active, +a:hover { + color: ; +} + + +img { + border: none; +} + +.small { + font-size: 0.8em; +} + + + + + + + + + +#nav { + float: left; + width: ; + padding: 0.5em 2em 1em 0.5em; + margin: 2.5em 0 1em 0; + font-size: 0.8em; +} + +#nav ul { + padding-left: 1em; +/* border: 1px solid #060; */ +} + +#nav li { + padding: 1px; + margin: 0; +/* border: 1px solid #006; */ +} + +#nav a { + 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: ; +} + + +li#orphans { + margin-top: 2em; + font-style: italic; + color: #aaa; +} + +li#login { + margin-top: 3em; +} +#login input { + background-color: transparent; + border: none; + border-left: #555 1px solid; + display: block; + font-size: 0.8em; + margin-bottom: 2px; + padding-left: 4px; +} + + + + +.ctrl { + text-align: right; + font-size: 0.8em; +} +.ctrl a { + margin-left: 1em; + color: #eee; +} + + + + + + + + +/*#### BBCode ##############################################################*/ + +.quote1 { + border:1px solid #c0c0c0; + margin:5px; + padding:5px; +} +.quote2 { + border:1px solid #c0c0c0; + margin:5px; + margin-bottom:0px; + padding:5px; +} +.quote0 { + color: #000; + font-size: 0.8em; +} + +ul { + list-style: none; + margin-left: 0; + padding-left: 1em; +} +li { + margin-left: 1em; + padding-left: 0; + /*list-style-image: url(Pics/Bullet.gif);*/ +} + diff -r 000000000000 -r 3021ce32ee14 Owls.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Owls.php Sun Dec 03 22:32:13 2006 +0100 @@ -0,0 +1,212 @@ +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); + + } + + + require_once 'Includes/Footer.inc.php'; + + + + + + + + + + + +/* + displays content of the node + performs action 'edit' + shows admincontrols if logged in +*/ +function show($lsys) { + + // perform action: write edited node to db + if (isset($_POST['editDoc']) && $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 'Includes/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 if logged in + if ($lsys->loggedIn()) { +?> +
    + new + edit +delete'; + } +?> +
    +'.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 'Includes/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 000000000000 -r 3021ce32ee14 Setup.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Setup.php Sun Dec 03 22:32:13 2006 +0100 @@ -0,0 +1,52 @@ +