Profile
MAJ is an Open Source, PHP-based content management system (CMS) that can be deployed as a blog, bulletin or message board, Internet forum, and wiki. It is extensible via PHP panels and is HTML5 and CSS3 ready.
Git
This commit has been accessed 950 times via Git panel.

commit b5cce784c77372dd99122fd029004764abe15d23
tree 414dbb4e98b5c4fd60634b276bf3a494eff148ac
parent 56a028a1e0cfd62e861a4d4c192966fe24fd0930
author Engels Antonio <engels@majcms.org> 1277314188 +0800
committer Engels Antonio <engels@majcms.org> 1277314188 +0800

    maj-0.14-20070603-bb.zip

diff --git a/add.php b/add.php
index 1d6f1f6..819c4b0 100644
--- a/add.php
+++ b/add.php
@@ -29,7 +29,15 @@ if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
 }
 
 if ($_SESSION['logged_in'] != file_get_contents("data/username.txt")) {
-       if (file_exists("data/members/active/{$_SESSION['logged_in']}/rw.txt") and file_exists("data/bb.txt")) {
+
+       if (file_exists("data/members/active/{$_SESSION['logged_in']}/category.txt")) {
+               $bb_cat = file_get_contents("data/members/active/{$_SESSION['logged_in']}/category.txt");
+               if (!file_exists("data/categories/$bb_cat") or ($bb_cat == "")) {
+                       unlink("data/members/active/{$_SESSION['logged_in']}/category.txt");
+               }
+       }
+
+       if ((file_exists("data/members/active/{$_SESSION['logged_in']}/rw.txt") or file_exists("data/members/active/{$_SESSION['logged_in']}/category.txt")) and file_exists("data/bb.txt")) {
                $login_username = $_SESSION['logged_in'];
        }
 }
@@ -696,6 +704,7 @@ if (file_exists("data/members/active") and file_exists("data/ml.txt") and file_e
        $ml_body = str_replace('<img src=images/smileys/surprised.png border=0>', '=)', $ml_body);
        $ml_body = str_replace('<img src=images/smileys/undecided.png border=0>', ':\\', $ml_body);
        $ml_body = str_replace('<img src=images/smileys/wink.png border=0>', ';)', $ml_body);
+       $ml_body = strip_tags($ml_body);
 
        if (file_exists("data/ml-header.txt")) {
                $ml_header = file_get_contents("data/ml-header.txt");
@@ -708,6 +717,10 @@ if (file_exists("data/members/active") and file_exists("data/ml.txt") and file_e
 
        $ml_body = $ml_body . "\n\nPlease visit the following URL for the online version of this message:\n\n" . $ml_url;
 
+       if (file_exists("data/items/$entry/member.txt")) {
+               $ml_body = $ml_body . "\n\nYou need to login first to view the entry or to add a comment.";
+       }
+
        if (file_exists("data/ml-footer.txt")) {
                $ml_footer = file_get_contents("data/ml-footer.txt");
                $ml_body = $ml_body . "\n\n" . $ml_footer;
@@ -896,6 +909,14 @@ if (isset($_REQUEST['category']) and !empty($_REQUEST['category'])) {
        }
 }
 
+
+if (file_exists("data/members/active/{$_SESSION['logged_in']}/category.txt") and file_exists("data/bb.txt")) {
+       $bb_cat = file_get_contents("data/members/active/{$_SESSION['logged_in']}/category.txt");
+       if (file_exists("data/categories/$bb_cat")) {
+               copy("data/members/active/{$_SESSION['logged_in']}/category.txt","data/items/$entry/category.txt");
+       }
+}
+
 if (isset($_REQUEST['passwd']) and !empty($_REQUEST['passwd'])) {
        if (($_REQUEST['passwd'] == "password") or empty($_REQUEST['passwd'])) {
                unlink("data/items/$entry/passwd.txt");
@@ -933,7 +954,7 @@ foreach ($get_ping_urls as $ping_url) {
        //fwrite($fp_ping_urls_add_txt, $ping);
        //fclose($fp_ping_urls_add_txt);
 
-       clear($ping);
+       unset($ping);
 }
 
 ?>
diff --git a/album.php b/album.php
index 5d2d54b..4f1d3b3 100644
--- a/album.php
+++ b/album.php
@@ -46,8 +46,37 @@ if ((!isset($_REQUEST['caption']) or empty($_REQUEST['caption'])) and isset($_SE
 }
 
 if (isset($_REQUEST['caption']) and !empty($_REQUEST['caption']) and isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username) and isset($_REQUEST['edit']) and ($_REQUEST['edit'] == "on")) {
-       $caption = $_REQUEST['caption'];
-       $caption = ucfirst($caption);
+       $caption_put = ucfirst($_REQUEST['caption']);
+       $caption_put = str_replace(':((', '<img src=images/smileys/crying.png border=0>', $caption_put);
+       $caption_put = str_replace(':(', '<img src=images/smileys/frown.png border=0>', $caption_put);
+       $caption_put = str_replace(':|', '<img src=images/smileys/indifferent.png border=0>', $caption_put);
+       $caption_put = str_replace(':D', '<img src=images/smileys/laughing.png border=0>', $caption_put);
+       $caption_put = str_replace(':P', '<img src=images/smileys/lick.png border=0>', $caption_put);
+       $caption_put = str_replace(':O', '<img src=images/smileys/ohno.png border=0>', $caption_put);
+       $caption_put = str_replace(':)', '<img src=images/smileys/smile.png border=0>', $caption_put);
+       $caption_put = str_replace('=)', '<img src=images/smileys/surprised.png border=0>', $caption_put);
+       $caption_put = str_replace(':\\', '<img src=images/smileys/undecided.png border=0>', $caption_put);
+       $caption_put = str_replace(';)', '<img src=images/smileys/wink.png border=0>', $caption_put);
+       $caption_put = str_replace('[code]', '<code>', $caption_put);
+       $caption_put = str_replace('[/code]', '</code>', $caption_put);
+       $caption_put = str_replace("\n", '<br />', $caption_put);
+       $caption_put = str_replace('[b]', '<b>', $caption_put);
+       $caption_put = str_replace('[/b]', '</b>', $caption_put);
+       $caption_put = str_replace('[i]', '<i>', $caption_put);
+       $caption_put = str_replace('[/i]', '</i>', $caption_put);
+       $caption_put = str_replace('[u]', '<u>', $caption_put);
+       $caption_put = str_replace('[/u]', '</u>', $caption_put);
+       $caption_put = str_replace('[strike]', '<strike>', $caption_put);
+       $caption_put = str_replace('[/strike]', '</strike>', $caption_put);
+       $caption_put = str_replace('[sup]', '<sup>', $caption_put);
+       $caption_put = str_replace('[/sup]', '</sup>', $caption_put);
+       $caption_put = str_replace('[sub]', '<sub>', $caption_put);
+       $caption_put = str_replace('[/sub]', '</sub>', $caption_put);
+       $caption_put = str_replace('[highlight]', '<highlight>', $caption_put);
+       $caption_put = str_replace('[/highlight]', '</highlight>', $caption_put);
+       $caption_put = str_replace('<highlight>', '<span style="background-color: #ffff00;">', $caption_put);
+       $caption_put = str_replace('</highlight>', '</span>', $caption_put);
+
        if (!file_exists("data/items/{$_REQUEST['entry']}/album")) {
                mkdir("data/items/{$_REQUEST['entry']}/album");
        }
@@ -55,7 +84,7 @@ if (isset($_REQUEST['caption']) and !empty($_REQUEST['caption']) and isset($_SES
                mkdir("data/items/{$_REQUEST['entry']}/album/captions");
        }
        $open_caption_txt_file = fopen("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt","w");
-       fwrite($open_caption_txt_file,$caption);
+       fwrite($open_caption_txt_file,$caption_put);
        fclose($open_caption_txt_file);
 }
 
@@ -104,6 +133,21 @@ a:active {
 <?php
 
 if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
+
+       if (!file_exists("data/items/{$_REQUEST['entry']}/album/views")) {
+               mkdir("data/items/{$_REQUEST['entry']}/album/views");
+       }
+
+       if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
+               $fp_image_views_txt = fopen("data/items/{$_REQUEST['entry']}/album/views/{$_REQUEST['show']}.txt","r");
+               $image_views_value = fread($fp_image_views_txt,filesize("data/items/{$_REQUEST['entry']}/album/views/{$_REQUEST['show']}.txt"));
+               fclose($fp_image_views_txt);
+               $image_views_value = $image_views_value + 1;
+               $fp_image_views_txt = fopen("data/items/{$_REQUEST['entry']}/album/views/{$_REQUEST['show']}.txt","w");
+               fwrite($fp_image_views_txt, $image_views_value);
+               fclose($fp_image_views_txt);
+       }
+
        echo "<table cellspacing=1 cellpadding=2 border=0 bgcolor=#cccccc>";
 
        echo "<tr bgcolor=#ffffff><td><p align=center><b>{$_REQUEST['show']}</b></p></td><td><p align=center>";
@@ -116,24 +160,48 @@ if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
 
        $size = filesize("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}");
        $size_string = ($size > 512)?(  ($size/1024 > 512)  ?sprintf("%.02f MB",($size/1024)/1024)  :sprintf("%.02f KB",$size/1024))  :sprintf("%d B",$size);
-       echo "</p></td><td><p align=center>$size_string</p></td></tr>";
+       echo "</p></td><td><p align=center>$size_string</p></td><td><p align=center>";
+
+       $album_image_views = file_get_contents("data/items/{$_REQUEST['entry']}/album/views/{$_REQUEST['show']}.txt");
+       echo "$album_image_views view";
+
+       if ($album_image_views > 1) {
+               echo "s";
+       }
+
+       echo "</p></td></tr>";
 
-       echo "<tr bgcolor=#ffffff><td colspan=3>";
+       echo "<tr bgcolor=#ffffff><td colspan=4>";
        echo "<img src=images/{$_REQUEST['entry']}/album/{$_REQUEST['show']} width=$album_image_width height=$album_image_height border=0>";
        echo "</td></tr>";
        if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
-               echo "<form enctype=\"multipart\/form-data\" action=\"{$_SERVER['PHP_SELF']}\" method=\"post\"><tr bgcolor=#ffffff><td colspan=3>";
+               echo "<form enctype=\"multipart\/form-data\" action=\"{$_SERVER['PHP_SELF']}\" method=\"post\"><tr bgcolor=#ffffff><td colspan=4>";
                echo "<textarea class=input name=caption rows=3>";
                if (file_exists("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt")) {
-                       readfile("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt");
+                       $caption_get = file_get_contents("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt");
+                       $caption_get = str_replace('<br />', "\n", $caption_get);
+                       $caption_get = str_replace('<img src=images/smileys/crying.png border=0>', ':((', $caption_get);
+                       $caption_get = str_replace('<img src=images/smileys/frown.png border=0>', ':(', $caption_get);
+                       $caption_get = str_replace('<img src=images/smileys/indifferent.png border=0>', ':|', $caption_get);
+                       $caption_get = str_replace('<img src=images/smileys/laughing.png border=0>', ':D', $caption_get);
+                       $caption_get = str_replace('<img src=images/smileys/lick.png border=0>', ':P', $caption_get);
+                       $caption_get = str_replace('<img src=images/smileys/ohno.png border=0>', ':O', $caption_get);
+                       $caption_get = str_replace('<img src=images/smileys/smile.png border=0>', ':)', $caption_get);
+                       $caption_get = str_replace('<img src=images/smileys/surprised.png border=0>', '=)', $caption_get);
+                       $caption_get = str_replace('<img src=images/smileys/undecided.png border=0>', ':\\', $caption_get);
+                       $caption_get = str_replace('<img src=images/smileys/wink.png border=0>', ';)', $caption_get);
+                       $caption_get = str_replace('<span style="background-color: #ffff00;">', '<highlight>', $caption_get);
+                       $caption_get = str_replace('</span>', '</highlight>', $caption_get);
+                       echo $caption_get;
                }
                echo "</textarea>";
                echo "<input type=hidden name=entry value={$_REQUEST['entry']}><input type=hidden name=show value={$_REQUEST['show']}><input type=hidden name=edit value=on><input type=submit class=input value=\"click here to update caption\"></td></tr></form>";
        }
        if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
                if (file_exists("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt")) {
-                       echo "<tr bgcolor=#ffffff><td colspan=3><p>";
-                       readfile("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt");
+                       echo "<tr bgcolor=#ffffff><td colspan=4 width=$album_image_width><p>";
+                       $caption_get = file_get_contents("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt");
+                       echo $caption_get;
                        echo "</p></td></tr>";
                }
        }
@@ -144,7 +212,7 @@ if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
 
 echo "<p></p>";
 
-echo "<table cellspacing=1 cellpadding=2 border=0 bgcolor=#cccccc><tr bgcolor=#ffffff><td><p><b>Album</b></p></td></tr><tr bgcolor=#ffffff><td width={$album_image_width}>";
+echo "<table cellspacing=1 cellpadding=2 border=0 bgcolor=#cccccc><tr bgcolor=#ffffff><td width={$album_image_width}><p><b>Album</b></p></td></tr><tr bgcolor=#ffffff><td width={$album_image_width}>";
 
 if (file_exists("images/{$_REQUEST['entry']}/thumbnails")) {
        if ($dh_album = opendir("images/{$_REQUEST['entry']}/thumbnails")) {
@@ -239,7 +307,9 @@ if (file_exists("images/{$_REQUEST['entry']}/album")) {
 
                        if (file_exists("data/items/{$_REQUEST['entry']}/album/captions/{$album_entry}.txt")) {
                                echo ' alt="';
-                               readfile("data/items/{$_REQUEST['entry']}/album/captions/{$album_entry}.txt");
+                               $img_alt = file_get_contents("data/items/{$_REQUEST['entry']}/album/captions/{$album_entry}.txt");
+                               $img_alt = strip_tags($img_alt);
+                               echo $img_alt;
                                echo '"';
                        }
                        echo "></a>";
diff --git a/edit.php b/edit.php
index ac8c66e..b835f0c 100644
--- a/edit.php
+++ b/edit.php
@@ -285,6 +285,8 @@ readfile($date_file);
 if (file_exists($revisions_file)) {
                echo ' (Revision ';
                readfile($revisions_file);
+               echo " - ";
+               echo date("l, M j, Y, g:i A", filemtime("data/items/{$_REQUEST['entry']}/body.txt"));
                echo ')';
 }
 
@@ -379,6 +381,8 @@ else {
 
 <?php } ?>
 
+<br><input type=checkbox name=lastmod <?php $lastmod_sem = "data/items/{$_REQUEST['entry']}/lastmod.txt"; if (file_exists($lastmod_sem)) { echo checked; } ?>>Display last modification date and time.
+
 </p>
 <input type=hidden name=entry value="<?php echo $_REQUEST['entry']; ?>">
 
@@ -579,8 +583,39 @@ if (isset($_FILES['album_image_input']) and !empty($_FILES['album_image_input'])
                                                }
                                                $caption_file = 'data/items/' . $_REQUEST['entry'] . '/album/captions/' . $_FILES['album_image_input']['name'] . '.txt';
                                                if (!file_exists($caption_file)) {
+                                                       $caption_txt = ucfirst($_REQUEST['caption']);
+                                                       $caption_txt = str_replace(':((', '<img src=images/smileys/crying.png border=0>', $caption_txt);
+                                                       $caption_txt = str_replace(':(', '<img src=images/smileys/frown.png border=0>', $caption_txt);
+                                                       $caption_txt = str_replace(':|', '<img src=images/smileys/indifferent.png border=0>', $caption_txt);
+                                                       $caption_txt = str_replace(':D', '<img src=images/smileys/laughing.png border=0>', $caption_txt);
+                                                       $caption_txt = str_replace(':P', '<img src=images/smileys/lick.png border=0>', $caption_txt);
+                                                       $caption_txt = str_replace(':O', '<img src=images/smileys/ohno.png border=0>', $caption_txt);
+                                                       $caption_txt = str_replace(':)', '<img src=images/smileys/smile.png border=0>', $caption_txt);
+                                                       $caption_txt = str_replace('=)', '<img src=images/smileys/surprised.png border=0>', $caption_txt);
+                                                       $caption_txt = str_replace(':\\', '<img src=images/smileys/undecided.png border=0>', $caption_txt);
+                                                       $caption_txt = str_replace(';)', '<img src=images/smileys/wink.png border=0>', $caption_txt);
+                                                       $caption_txt = str_replace('[code]', '<code>', $caption_txt);
+                                                       $caption_txt = str_replace('[/code]', '</code>', $caption_txt);
+                                                       $caption_txt = str_replace("\n", '<br />', $caption_txt);
+                                                       $caption_txt = str_replace('[b]', '<b>', $caption_txt);
+                                                       $caption_txt = str_replace('[/b]', '</b>', $caption_txt);
+                                                       $caption_txt = str_replace('[i]', '<i>', $caption_txt);
+                                                       $caption_txt = str_replace('[/i]', '</i>', $caption_txt);
+                                                       $caption_txt = str_replace('[u]', '<u>', $caption_txt);
+                                                       $caption_txt = str_replace('[/u]', '</u>', $caption_txt);
+                                                       $caption_txt = str_replace('[strike]', '<strike>', $caption_txt);
+                                                       $caption_txt = str_replace('[/strike]', '</strike>', $caption_txt);
+                                                       $caption_txt = str_replace('[sup]', '<sup>', $caption_txt);
+                                                       $caption_txt = str_replace('[/sup]', '</sup>', $caption_txt);
+                                                       $caption_txt = str_replace('[sub]', '<sub>', $caption_txt);
+                                                       $caption_txt = str_replace('[/sub]', '</sub>', $caption_txt);
+                                                       $caption_txt = str_replace('[highlight]', '<highlight>', $caption_txt);
+                                                       $caption_txt = str_replace('[/highlight]', '</highlight>', $caption_txt);
+                                                       $caption_txt = str_replace('<highlight>', '<span style="background-color: #ffff00;">', $caption_txt);
+                                                       $caption_txt = str_replace('</highlight>', '</span>', $caption_txt);
+
                                                        $fp_caption_txt = fopen($caption_file,"w");
-                                                       fwrite($fp_caption_txt,$_REQUEST['caption']);
+                                                       fwrite($fp_caption_txt,$caption_txt);
                                                        fclose($fp_caption_txt);
                                                }
                                        }
@@ -748,6 +783,18 @@ if (!isset($_REQUEST['member']) or empty($_REQUEST['member'])) {
        }
 }
 
+$lastmod_sem = "data/items/{$_REQUEST['entry']}/lastmod.txt";
+if (isset($_REQUEST['lastmod']) and !empty($_REQUEST['lastmod']) and ($_REQUEST['lastmod'] == "on")) {
+       if (!file_exists($lastmod_sem)) {
+               touch($lastmod_sem);
+       }
+}
+if (!isset($_REQUEST['lastmod']) or empty($_REQUEST['lastmod'])) {
+       if (file_exists($lastmod_sem)) {
+               unlink($lastmod_sem);
+       }
+}
+
 if (isset($_REQUEST['pdf']) and !empty($_REQUEST['pdf']) and ($_REQUEST['pdf'] == "on")) {
        if (!file_exists("data/items/{$_REQUEST['entry']}/pdf")) {
                mkdir("data/items/{$_REQUEST['entry']}/pdf");
@@ -948,7 +995,7 @@ foreach ($get_ping_urls as $ping_url) {
        //fwrite($fp_ping_urls_edit_txt, $ping);
        //fclose($fp_ping_urls_edit_txt);
 
-       clear($ping);
+       unset($ping);
 }
 
 ?>
diff --git a/index.php b/index.php
index 4b179ad..6b65d83 100644
--- a/index.php
+++ b/index.php
@@ -493,7 +493,7 @@ if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
 
                        $comment_thanks = wordwrap($comment_thanks);
 
-                       mail($email_to, "Thanks for posting a comment on my blog!", $comment_thanks,
+                       mail($email_to, "Thanks for sharing your thoughts!", $comment_thanks,
                                "From: $from_email\r\n" .
                                "Reply-To: $from_email\r\n" .
                                "X-Mailer: $mailer");
@@ -504,7 +504,7 @@ if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
 
                        $comment_notice = wordwrap($comment_notice);
 
-                       mail($from_email, "Pending Blog Comment", $comment_notice,
+                       mail($from_email, "Pending Comment", $comment_notice,
                                "From: $from_email\r\n" .
                                "Reply-To: $from_email\r\n" .
                                "X-Mailer: $mailer");
@@ -868,6 +868,11 @@ else {
 <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="rss.php?ver=2.0">
 
 <?php
+
+if (file_exists("data/center.txt")) {
+       echo "<center>";
+}
+
 if (file_exists("header.php")) {
        include("header.php");
        echo '<p></p>';
@@ -959,7 +964,15 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username
        echo '<a href=colors.php>Colors</a><br>';
        echo '<a href=login.php>Logout</a>';
 } elseif (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username) and file_exists("data/members/active/{$_SESSION['logged_in']}") and file_exists("data/bb.txt")) {
-       if (file_exists("data/members/active/{$_SESSION['logged_in']}/rw.txt")) {
+
+       if (file_exists("data/members/active/{$_SESSION['logged_in']}/category.txt")) {
+               $bb_cat = file_get_contents("data/members/active/{$_SESSION['logged_in']}/category.txt");
+               if (!file_exists("data/categories/$bb_cat") or ($bb_cat == "")) {
+                       unlink("data/members/active/{$_SESSION['logged_in']}/category.txt");
+               }
+       }
+
+       if (file_exists("data/members/active/{$_SESSION['logged_in']}/rw.txt") or file_exists("data/members/active/{$_SESSION['logged_in']}/category.txt")) {
                echo '<a href=add.php>Add Entry</a><br>';
        }
        echo '<a href=options.php>Options</a><br>';
@@ -1546,12 +1559,16 @@ foreach ($disp as $d) {
                echo "<a href=member.php?id=$xavatar_author>$xavatar_author</a> - ";
        }
        readfile("$dir/$d/date.txt");
-       if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
+       if ((isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) or file_exists("$dir/$d/lastmod.txt")) {
                if (file_exists("$dir/$d/revisions.txt")) {
                        echo ' (Revision ';
                        readfile("$dir/$d/revisions.txt");
+                       echo " - ";
+                       echo date("l, M j, Y, g:i A", filemtime("$dir/$d/body.txt"));
                        echo ')';
                }
+       }
+       if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
                if (file_exists("$dir/$d/category.txt")) {
                        echo ' Filed under ';
                        $category_key = file_get_contents("$dir/$d/category.txt");
@@ -1564,6 +1581,7 @@ foreach ($disp as $d) {
                                echo "$category_key";
                        }
                }
+
        }
        echo '</font><font style="font-size: 5px;"><br><br></font>';
 
@@ -1834,6 +1852,23 @@ else {
                                        }
                                }
                        }
+
+                       /* caption auto-clean-up (20070216) This should delete captions of non-existent album images. */
+
+                       if (file_exists("data/items/$d/album/captions")) {
+                               if ($dh_album = opendir("data/items/$d/album/captions")) {
+                                       while (($caption_album = readdir($dh_album)) !== false) {
+                                               if ($caption_album != "." && $caption_album != ".." && fnmatch("*", $caption_album)) {
+                                                       $current_caption = "data/items/$d/album/captions/$caption_album";
+                                                       $parent_image = str_replace(".txt","",$caption_album);
+                                                       $parent_image = "images/$d/album/$parent_image";
+                                                       if (file_exists($current_caption) and !file_exists($parent_image)) {
+                                                               unlink($current_caption);
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
       
                        /* auto-sort entries (20060409) - MAJ previously relied on readdir() alone, causing entries to be displayed in the order in which they are stored by the filesystem. */
       
@@ -1918,7 +1953,9 @@ else {
 
                                                if (file_exists("data/items/$d/album/captions/{$album_entry}.txt")) {
                                                        echo ' alt="';
-                                                       readfile("data/items/$d/album/captions/{$album_entry}.txt");
+                                                       $img_alt = file_get_contents("data/items/$d/album/captions/{$album_entry}.txt");
+                                                       $img_alt = strip_tags($img_alt);
+                                                       echo $img_alt;
                                                        echo '"';
                                                }
                                                echo "></a>";
@@ -3390,4 +3427,9 @@ if (file_exists("footer.php")) {
        echo '<p></p>';
        include("footer.php");
 }
+
+if (file_exists("data/center.txt")) {
+       echo "</center>";
+}
+
 ?>
diff --git a/member.php b/member.php
index ca1789b..24ffb93 100644
--- a/member.php
+++ b/member.php
@@ -176,6 +176,17 @@ if (isset($_REQUEST['edit']) and !empty($_REQUEST['edit']) and ($_REQUEST['edit'
                unlink("data/members/active/{$_REQUEST['username']}/rank.txt");
        }
 
+       if (isset($_REQUEST['category']) and !empty($_REQUEST['category']) and (strtolower($_REQUEST['category']) != "none") and (file_exists("data/categories/{$_REQUEST['category']}"))) {
+               $category_file = "data/members/active/{$_REQUEST['username']}/category.txt";
+               $fp_category_txt = fopen($category_file,"w");
+               fwrite($fp_category_txt,$_REQUEST['category']);
+               fclose($fp_category_txt);
+       }
+
+       if ((!isset($_REQUEST['category']) or empty($_REQUEST['category']) or ($_REQUEST['category'] == "none")) and file_exists("data/members/active/{$_REQUEST['username']}/category.txt")) {
+               unlink("data/members/active/{$_REQUEST['username']}/category.txt");
+       }
+
        if (isset($_REQUEST['del']) and !empty($_REQUEST['del']) and ($_REQUEST['del'] == "on")) {
                function rmdirr($recurse_dirname)
                {
@@ -208,11 +219,11 @@ if (isset($_REQUEST['edit']) and !empty($_REQUEST['edit']) and ($_REQUEST['edit'
 
 ?>
 
-<table border=0 cellspacing=0 cellpadding=0 bgcolor=#CCCCCC style="background-color: transparent;" width=525><tr><td><div id=panel_title>Members</div><div id=panel_body><table border=0 cellspacing=1 cellpadding=2 bgcolor=#cccccc width=513>
+<table border=0 cellspacing=0 cellpadding=0 bgcolor=#CCCCCC style="background-color: transparent;" width=640><tr><td><div id=panel_title>Members</div><div id=panel_body><table border=0 cellspacing=1 cellpadding=2 bgcolor=#cccccc width=628>
 <tr><td bgcolor=#eeeeee align=center><p>status</p></td><td bgcolor=#eeeeee align=center><p>username</p></td><td bgcolor=#eeeeee align=center><p>member since</p></td><td bgcolor=#eeeeee align=center><p>logins</p></td><td bgcolor=#eeeeee align=center><p>posts</p></td><?php
 
 if (isset($_SESSION['logged_in']) and !empty($_SESSION['logged_in']) and ($_SESSION['logged_in'] == file_get_contents("data/username.txt"))) {
-       echo "<td bgcolor=#eeeeee align=center><p>rw</p></td><td bgcolor=#eeeeee align=center><p>ul</p></td><td bgcolor=#eeeeee align=center><p>noml</p></td><td bgcolor=#eeeeee align=center><p>delete</p></td><td bgcolor=#eeeeee align=center><p>rank</p></td><td bgcolor=#eeeeee align=center><p>action</p></td>";
+       echo "<td bgcolor=#eeeeee align=center><p>rw</p></td><td bgcolor=#eeeeee align=center><p>ul</p></td><td bgcolor=#eeeeee align=center><p>noml</p></td><td bgcolor=#eeeeee align=center><p>delete</p></td><td bgcolor=#eeeeee align=center><p>rank</p></td><td bgcolor=#eeeeee align=center><p>category</p></td><td bgcolor=#eeeeee align=center><p>action</p></td>";
 }
 
 ?></tr>
@@ -371,10 +382,48 @@ if (file_exists("data/members/active")) {
                                        else {
                                                echo member;
                                        }
-                                       echo "\"></p></td><td bgcolor=#ffffff align=center><p><input class=submit type=submit value=submit></p></td></form>";
+                                       echo "\"></p></td><td bgcolor=#ffffff><p><select name=category><option selected>";
+                                       if (file_exists("data/members/active/$member_list_entry/category.txt")) {
+                                               $bb_cat = file_get_contents("data/members/active/$member_list_entry/category.txt");
+                                               if (!file_exists("data/categories/$bb_cat")) {
+                                                       unlink("data/members/active/$member_list_entry/category.txt");
+                                               }
+                                       }
+
+                                       if (file_exists("data/members/active/$member_list_entry/category.txt")) {
+                                               readfile("data/members/active/$member_list_entry/category.txt");
+                                               echo "<option>none";
+                                       }
+
+                                       if (!file_exists("data/members/active/$member_list_entry/category.txt")) {
+                                               echo "none";
+                                       }
+
+       if (file_exists("data/categories")) {
+               if ($dh_cat = opendir("data/categories")) {
+                       while (($entry_cat = readdir($dh_cat)) !== false) {
+
+                               if ($entry_cat != "." && $entry_cat != ".." && fnmatch("*", $entry_cat)) {
+                                       $show_cat[] = $entry_cat;
+                               }
+                       }
+                       closedir($dh_cat);
+               }
+
+               sort($show_cat);
+               reset($show_cat);
+
+               foreach ($show_cat as $category) {
+                       echo "<option>";
+                       echo strtolower($category);
+                       unset($show_cat);
+               }
+       }
+
+                                       echo "</select></p></td><td bgcolor=#ffffff align=center><p><input class=submit type=submit value=submit></p></td></form>";
                                }
                                if ($member_list_entry == file_get_contents("data/username.txt")) {
-                                       echo "<td colspan=6 bgcolor=#ffffff align=center><p><a href=settings.php>administrator settings</a></p></td>";
+                                       echo "<td colspan=7 bgcolor=#ffffff align=center><p><a href=settings.php>administrator settings</a></p></td>";
                                }
                        }
                }
@@ -558,11 +607,11 @@ elseif (!file_exists("data/members/active/$id/rank.txt") and file_exists("data/r
 <?php
 if ((file_get_contents("data/username.txt") == $id) and file_exists("data/url.txt") and isset($_SESSION['logged_in']) and !empty($_SESSION['logged_in'])) {
        $member_url = file_get_contents("data/url.txt");
-       echo "<tr><td width=75><p>website</p></td><td><p><a href=$member_url target=_majbb><code>$member_url</code></a></p></td></tr>";
+       echo "<tr><td width=90><p>website</p></td><td><p><a href=$member_url target=_majbb><code>$member_url</code></a></p></td></tr>";
 }
 elseif (file_exists("data/members/active/$id/url.txt") and isset($_SESSION['logged_in']) and !empty($_SESSION['logged_in'])) {
        $member_url = file_get_contents("data/members/active/$id/url.txt");
-       echo "<tr><td width=75><p>website</p></td><td><p><a href=$member_url target=_majbb><code>$member_url</code></a></p></td></tr>";
+       echo "<tr><td width=90><p>website</p></td><td><p><a href=$member_url target=_majbb><code>$member_url</code></a></p></td></tr>";
 }
 
 if (file_exists("data/members/active/$id/timestamp.txt")) {
@@ -573,7 +622,7 @@ if (file_exists("data/members/active/$id/timestamp.txt")) {
        $joined_hh = substr($joined,8,2);
        $joined_mm = substr($joined,10,2);
        $member_since = date("d M Y H:i", mktime($joined_hh, $joined_mm, 0, $joined_month, $joined_day, $joined_year));
-       echo "<tr><td width=75><p>member since</p></td><td><p><code>$member_since</code></p></td></tr>";
+       echo "<tr><td width=90><p>member since</p></td><td><p><code>$member_since</code></p></td></tr>";
 }
 
 if ((file_get_contents("data/username.txt") == $id) and file_exists("data/lastlog.txt")) {
@@ -584,7 +633,7 @@ if ((file_get_contents("data/username.txt") == $id) and file_exists("data/lastlo
        $lastlog_hh = substr($lastlog,8,2);
        $lastlog_mm = substr($lastlog,10,2);
        $last_login = date("d M Y H:i", mktime($lastlog_hh, $lastlog_mm, 0, $lastlog_month, $lastlog_day, $lastlog_year));
-       echo "<tr><td width=75><p>last login</p></td><td><p><code>$last_login</code></p></td></tr>";
+       echo "<tr><td width=90><p>last login</p></td><td><p><code>$last_login</code></p></td></tr>";
 }
 elseif (file_exists("data/members/active/$id/bb-last.txt")) {
        $lastlog = file_get_contents("data/members/active/$id/bb-last.txt");
@@ -594,7 +643,7 @@ elseif (file_exists("data/members/active/$id/bb-last.txt")) {
        $lastlog_hh = substr($lastlog,8,2);
        $lastlog_mm = substr($lastlog,10,2);
        $last_login = date("d M Y H:i", mktime($lastlog_hh, $lastlog_mm, 0, $lastlog_month, $lastlog_day, $lastlog_year));
-       echo "<tr><td width=75><p>last login</p></td><td><p><code>$last_login</code></p></td></tr>";
+       echo "<tr><td width=90><p>last login</p></td><td><p><code>$last_login</code></p></td></tr>";
 }
 
 if ((file_get_contents("data/username.txt") == $id) and file_exists("data/lastpost.txt")) {
@@ -605,7 +654,7 @@ if ((file_get_contents("data/username.txt") == $id) and file_exists("data/lastpo
        $lastpost_hh = substr($lastpost,8,2);
        $lastpost_mm = substr($lastpost,10,2);
        $last_post = date("d M Y H:i", mktime($lastpost_hh, $lastpost_mm, 0, $lastpost_month, $lastpost_day, $lastpost_year));
-       echo "<tr><td width=75><p>last post</p></td><td><p><code>$last_post</code></p></td></tr>";
+       echo "<tr><td width=90><p>last post</p></td><td><p><code>$last_post</code></p></td></tr>";
 }
 elseif (file_exists("data/members/active/$id/bb-post.txt")) {
        $lastpost = file_get_contents("data/members/active/$id/bb-post.txt");
@@ -615,7 +664,7 @@ elseif (file_exists("data/members/active/$id/bb-post.txt")) {
        $lastpost_hh = substr($lastpost,8,2);
        $lastpost_mm = substr($lastpost,10,2);
        $last_post = date("d M Y H:i", mktime($lastpost_hh, $lastpost_mm, 0, $lastpost_month, $lastpost_day, $lastpost_year));
-       echo "<tr><td width=75><p>last post</p></td><td><p><code>$last_post</code></p></td></tr>";
+       echo "<tr><td width=90><p>last post</p></td><td><p><code>$last_post</code></p></td></tr>";
 }
 
 if (file_get_contents("data/username.txt") == $id) {
@@ -631,7 +680,7 @@ if (file_get_contents("data/username.txt") == $id) {
                fwrite($views_file, $views);
                fclose($views_file);
        }
-       echo "<tr><td width=75><p>profile views</p></td><td><p><code>$views</code></p></td></tr>";
+       echo "<tr><td width=90><p>profile views</p></td><td><p><code>$views</code></p></td></tr>";
 }
 elseif (file_exists("data/members/active/$id")) {
        if (!file_exists("data/members/active/$id/bb-views.txt")) {
@@ -648,16 +697,16 @@ elseif (file_exists("data/members/active/$id")) {
                        fclose($views_file);
                }
        }
-       echo "<tr><td width=75><p>profile views</p></td><td><p><code>$views</code></p></td></tr>";
+       echo "<tr><td width=90><p>profile views</p></td><td><p><code>$views</code></p></td></tr>";
 }
 
 if ((file_get_contents("data/username.txt") == $id) and file_exists("data/logins.txt")) {
        $logins = file_get_contents("data/logins.txt");
-       echo "<tr><td width=75><p>total logins</p></td><td><p><code>$logins</code></p></td></tr>";
+       echo "<tr><td width=90><p>total logins</p></td><td><p><code>$logins</code></p></td></tr>";
 }
 elseif (file_exists("data/members/active/$id") and file_exists("data/members/active/$id/bb-logins.txt")) {
        $logins = file_get_contents("data/members/active/$id/bb-logins.txt");
-       echo "<tr><td width=75><p>total logins</p></td><td><p><code>$logins</code></p></td></tr>";
+       echo "<tr><td width=90><p>total logins</p></td><td><p><code>$logins</code></p></td></tr>";
 }
 
 if ($dh_posts = opendir("data/items")) {
@@ -699,10 +748,10 @@ $posts = count($items_posts);
 $all_posts = count($total_posts);
 $ratio_posts = (($posts/$all_posts) * 90);
 $ratio_posts = number_format($ratio_posts,2);
-echo "<tr><td width=75><p>total posts</p></td><td><p><code>$posts</code></p></td></tr>";
-echo "<tr><td width=75><p>&nbsp;</p></td><td><p><code>{$ratio_posts}% of total</code></p></td></tr>";
+echo "<tr><td width=90><p>total posts</p></td><td><p><code>$posts</code></p></td></tr>";
+echo "<tr><td width=90><p>&nbsp;</p></td><td><p><code>{$ratio_posts}% of total</code></p></td></tr>";
 if ($posts > 0) {
-       echo "<tr><td width=75><p>&nbsp;</p></td><td><p><a href=index.php?author=$id><code>find all posts by $id</code></a></p></td></tr>";
+       echo "<tr><td width=90><p>&nbsp;</p></td><td><p><a href=index.php?author=$id><code>find all posts by $id</code></a></p></td></tr>";
 }
 unset($items_posts);
 unset($total_posts);
@@ -729,6 +778,29 @@ if (($id != file_get_contents("data/username.txt")) and file_exists("data/member
 }
 ?>
 </code></p></td></tr>
+<?php
+if (($id != file_get_contents("data/username.txt")) and file_exists("data/members/active/$id")) {
+
+       if (file_exists("data/members/active/$id/category.txt")) {
+               $bb_cat = file_get_contents("data/members/active/$id/category.txt");
+               if (!file_exists("data/categories/$bb_cat")) {
+                       unlink("data/members/active/$id/category.txt");
+               }
+       }
+
+       if (file_exists("data/members/active/$id/category.txt")) {
+               echo "<tr><td><p>group (rw)</p></td><td><p><code>";
+               $category_name = file_get_contents("data/members/active/$id/category.txt");
+               if (file_exists("data/categories/$category_name/title.txt")) {
+                       readfile("data/categories/$category_name/title.txt");
+               }
+               else {
+                       echo $category_name;
+               }
+               echo "</code></p></td></tr>";
+       }
+}
+?>
 <tr><td><p>status</p></td><td><p><code>
 <?php
 $sess_dir = session_save_path();
diff --git a/settings.php b/settings.php
index 00822f5..670ece5 100644
--- a/settings.php
+++ b/settings.php
@@ -189,6 +189,18 @@ if (!isset($_REQUEST['nocat']) or empty($_REQUEST['nocat'])) {
        }
 }
 
+if (isset($_REQUEST['center']) and !empty($_REQUEST['center']) and ($_REQUEST['center'] == "on") and !file_exists("data/center.txt")) {
+       touch("data/center.txt");
+}
+
+if (!isset($_REQUEST['center']) or empty($_REQUEST['center'])) {
+       if (isset($_REQUEST['edit']) and ($_REQUEST['edit'] == "on")) {
+               if (file_exists("data/center.txt")) {
+                       unlink("data/center.txt");
+               }
+       }
+}
+
 if (isset($_REQUEST['old']) and !empty($_REQUEST['old']) and ($_REQUEST['old'] == "on") and !file_exists("data/old.txt")) {
        touch("data/old.txt");
 }
@@ -900,10 +912,10 @@ a:active {
 <tr><td><p>ping on content change</p></td><td><input autocomplete=off class=input type=text name=ping value="<?php readfile("data/ping.txt"); ?>"></td></tr>
 <tr><td rowspan=<?php
        if (file_exists("data/email.txt")) {
-               echo "7";
+               echo "8";
        }
        else {
-               echo "6";
+               echo "7";
        }
 ?>
 ><p>toggles</p></td><td><p><input type=checkbox name=nocomment <?php if (file_exists("data/nocomment.txt")) { echo checked; } ?>> Do not allow visitors to post comments.</p></td></tr>
@@ -914,6 +926,16 @@ a:active {
 <tr><td><p><input type=checkbox name=xarc <?php if (file_exists("data/xarc.txt")) { echo checked; } ?>> Do not show archives panel.</p></td></tr>
 <tr><td><p><input type=checkbox name=xcat <?php if (file_exists("data/xcat.txt")) { echo checked; } ?>> Do not show categories panel.</p></td></tr>
 <tr><td><p><input type=checkbox name=nocat <?php if (file_exists("data/nocat.txt")) { echo checked; } ?>> Do not show categorized items with unfiled entries.</p></td></tr>
+<tr><td><p><input type=checkbox name=center <?php if (file_exists("data/center.txt")) { echo checked; } ?>> Display <?php
+
+if (file_exists("data/bb.txt")) {
+       echo "bulletin board";
+}
+else {
+       echo "blog";
+}
+
+?> on center of page.</p></td></tr>
 <tr><td><p><input type=checkbox name=old <?php if (file_exists("data/old.txt")) { echo checked; } ?>> Display entries from oldest to newest.</p></td></tr>
 <?php
 if (file_exists("favicon.ico")) {
@@ -1043,7 +1065,7 @@ if (file_exists("data/pf-censor.txt")) {
 
 <?php } ?>
 
-<tr><td <?php if (file_exists("data/bb.txt") and !file_exists("images/avatar.jpg") and !file_exists("images/avatar.gif") and !file_exists("images/avatar.png")) { echo "rowspan=8"; } if (file_exists("data/bb.txt") and (file_exists("images/avatar.jpg") or file_exists("images/avatar.gif") or file_exists("images/avatar.png"))) { echo "rowspan=9"; } ?>><p>bulletin board</p></td><td><p><input type=checkbox name=bb <?php if (file_exists("data/bb.txt")) { echo checked; } ?>> Enable simple bulletin board.</p></td></tr>
+<tr><td <?php if (file_exists("data/bb.txt") and !file_exists("images/avatar.jpg") and !file_exists("images/avatar.gif") and !file_exists("images/avatar.png")) { echo "rowspan=9"; } if (file_exists("data/bb.txt") and (file_exists("images/avatar.jpg") or file_exists("images/avatar.gif") or file_exists("images/avatar.png"))) { echo "rowspan=10"; } ?>><p>bulletin board</p></td><td><p><input type=checkbox name=bb <?php if (file_exists("data/bb.txt")) { echo checked; } ?>> Enable simple bulletin board.</p></td></tr>
 <?php if (file_exists("data/bb.txt")) { ?>
 <tr><td><p><input type=checkbox name=reg <?php if (file_exists("data/reg.txt")) { echo checked; } ?>> Enable new user registration.</p></td></tr>
 <tr><td><p><input type=checkbox name=xapp <?php if (file_exists("data/xapp.txt")) { echo checked; } ?>> Enable automatic activation of confirmed users.</p></td></tr>
 
Credits
Sunday, Sep 18, 2005, 12:00 AM (Revision 11 - Thursday, Jul 14, 2011, 7:30 PM)
Open Source enables software developers to stand on the shoulders of giants instead of reinventing the wheel, so to speak. Kudos and many thanks to the folks who made their work freely available for reuse in MAJ.

read more
Bugs and Exploits
Friday, Aug 26, 2005, 12:00 AM (Revision 23 - Wednesday, May 29, 2013, 5:25 AM)
Although MAJ started as a family project, care has been taken to make it as "safe" as possible. With more people now working on MAJ, bugs and exploitable code may sometimes slip in. We invite you to poke around and see if you can find any. Generally, there are two things you can do when you find a MAJ or PHP-related bug or exploit:

1. Take advantage of it. But hey, what's so exciting about messing up someone's blog? Ho-hum, right?
2. Report it here so that we can work on a fix and make MAJ better.

read more
Search
Download
MAJ 2.0
75 files
33012 downloads
MAJ 1.0
26 files
13144 downloads
MAJ 0.14
45 files
35026 downloads