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 929 times via Git panel.

commit 220f5d71bbce3597c2306c1b2f12c9ea11e76e9e
tree d5679b564a4e17cf672296de361aa145e086d12b
parent 13a084131b7d7c2b22226df912dc959b15434203
author Engels Antonio <engels@majcms.org> 1279498576 +0800
committer Engels Antonio <engels@majcms.org> 1279498576 +0800

    Add edit-only option.
    Add nomargin option for free panels.
    Fix user display of categories and members table.

diff --git a/add.php b/add.php
index 60f4698..59b0f21 100644
--- a/add.php
+++ b/add.php
@@ -47,7 +47,7 @@ if ($_SESSION['logged_in'] != file_get_contents("data/username.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")) {
+       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") and !file_exists("data/noadd.txt")) {
                $login_username = $_SESSION['logged_in'];
        }
 }
diff --git a/css.php b/css.php
index 202cc6a..161ed68 100644
--- a/css.php
+++ b/css.php
@@ -411,7 +411,7 @@ a.navlink:link,a.navlink:visited,a.navlink:active,a.navlink:hover {
 
 .panel_free {
        padding: 0px 0px 0px 0px;
-       margin: 0px 0px 10px 0px;
+       margin: 0px 0px 0px 0px;
 }
 
 .rbtop {
diff --git a/edit.php b/edit.php
index 268d2d6..528f03a 100644
--- a/edit.php
+++ b/edit.php
@@ -516,12 +516,12 @@ if (file_exists($revisions_file)) {
 
 <form enctype="multipart/form-data" action="edit.php" method="post">
 
+<p><table border="0" cellspacing="2" cellpadding="0" bgcolor="#ffffff">
+
 <?php if (($_SESSION['logged_in'] == $login_username) or (file_exists("data/members/active/{$_SESSION['logged_in']}/ul.txt") and file_exists("data/members/active/{$_SESSION['logged_in']}/rw.txt"))) { ?>
 
 <input type="hidden" name="max_file_size" value="<?php echo $max_file_size; ?>">
 
-<p><table border="0" cellspacing="2" cellpadding="0" bgcolor="#ffffff">
-
 <tr><td><input autocomplete="off" type="file" name="album_image_input"> Upload optional album image. Enter optional caption below.</td></tr>
 <tr><td><input autocomplete="off" type="text" name="caption" class="input_body"></td></tr>
 <tr><td><input type="hidden" name="max_file_size" value="<?php echo $max_file_size; ?>"></td></tr>
diff --git a/index.php b/index.php
index 654ca5c..33100b1 100644
--- a/index.php
+++ b/index.php
@@ -986,7 +986,7 @@ elseif (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $maj_login_
                }
        }
 
-       if (file_exists("data/members/active/{$_SESSION['logged_in']}/rw.txt") or file_exists("data/members/active/{$_SESSION['logged_in']}/categories/$maj_req_category")) {
+       if (!file_exists("data/noadd.txt") and (file_exists("data/members/active/{$_SESSION['logged_in']}/rw.txt") or file_exists("data/members/active/{$_SESSION['logged_in']}/categories/$maj_req_category"))) {
                echo '<a class="navlink" href="add.php">Add Entry</a><br>';
        }
 
@@ -1371,6 +1371,10 @@ if (file_exists("data/panels")) {
 
                        echo '</div>';
 
+                       if (file_exists("data/panels/$maj_left_panel/free.txt") and !file_exists("data/panels/$maj_left_panel/nomargin.txt")) {
+                               echo "<div style=\"height:10px;\"></div>";
+                       }
+
                        if (file_exists("data/round.txt") and !file_exists("data/panels/$maj_left_panel/free.txt")) {
 
                                echo '<b class="rbbottom"><b class="rb4b"';
@@ -1654,6 +1658,10 @@ if ($maj_count_top_panels > 0) {
 
                echo '</div>';
 
+               if (file_exists("data/panels/$maj_top_panel/free.txt") and !file_exists("data/panels/$maj_top_panel/nomargin.txt")) {
+                       echo "<div style=\"height:10px;\"></div>";
+               }
+
                if (file_exists("data/round.txt") and !file_exists("data/panels/$maj_top_panel/free.txt")) {
 
                        echo '<b class="rbbottom"><b class="rb4b"';
@@ -2348,6 +2356,10 @@ if ($maj_count_center_panels > 0) {
 
                echo '</div>';
 
+               if (file_exists("data/panels/$maj_center_panel/free.txt") and !file_exists("data/panels/$maj_center_panel/nomargin.txt")) {
+                       echo "<div style=\"height:10px;\"></div>";
+               }
+
                if (file_exists("data/round.txt") and !file_exists("data/panels/$maj_center_panel/free.txt")) {
 
                        echo '<b class="rbbottom"><b class="rb4b"';
@@ -3769,6 +3781,10 @@ foreach ($maj_disp as $maj_d) {
 
                        echo '</div>';
 
+                       if (file_exists("data/panels/$maj_entry_panel/free.txt") and !file_exists("data/panels/$maj_entry_panel/nomargin.txt")) {
+                               echo "<div style=\"height:10px;\"></div>";
+                       }
+
                        if (file_exists("data/round.txt") and !file_exists("data/panels/$maj_entry_panel/free.txt")) {
 
                                echo '<b class="rbbottom"><b class="rb4b"';
@@ -5991,6 +6007,10 @@ if ($maj_count_right_panels > 0) {
 
                echo '</div>';
 
+               if (file_exists("data/panels/$maj_right_panel/free.txt") and !file_exists("data/panels/$maj_right_panel/nomargin.txt")) {
+                       echo "<div style=\"height:10px;\"></div>";
+               }
+
                if (file_exists("data/round.txt") and !file_exists("data/panels/$maj_right_panel/free.txt")) {
 
                        echo '<b class="rbbottom"><b class="rb4b"';
diff --git a/panels.php b/panels.php
index c3be8f2..981e6d6 100644
--- a/panels.php
+++ b/panels.php
@@ -79,7 +79,7 @@ if (isset($_POST['new_id']) and !empty($_POST['new_id']) and isset($_POST['new_t
        fclose($new_content_file);
 }
 
-if ((!isset($_POST['panel_hide']) or !empty($_POST['panel_hide'])) and ($_POST['panel_edit'] == "on")) {
+if ((!isset($_POST['panel_hide']) or empty($_POST['panel_hide'])) and ($_POST['panel_edit'] == "on")) {
        if (file_exists("data/panels/{$_POST['panel_id']}/private.txt")) {
                unlink("data/panels/{$_POST['panel_id']}/private.txt");
        }
@@ -91,10 +91,37 @@ if (isset($_POST['panel_hide']) and !empty($_POST['panel_hide']) and ($_POST['pa
        }
 }
 
-if ((!isset($_POST['panel_free']) or !empty($_POST['panel_free'])) and ($_POST['panel_edit'] == "on")) {
+if ((!isset($_POST['panel_auth']) or empty($_POST['panel_auth'])) and ($_POST['panel_edit'] == "on")) {
+       if (file_exists("data/panels/{$_POST['panel_id']}/auth.txt")) {
+               unlink("data/panels/{$_POST['panel_id']}/auth.txt");
+       }
+}
+
+if (isset($_POST['panel_auth']) and !empty($_POST['panel_auth']) and ($_POST['panel_auth'] == "on")) {
+       if (!file_exists("data/panels/{$_POST['panel_id']}/auth.txt")) {
+               touch("data/panels/{$_POST['panel_id']}/auth.txt");
+       }
+}
+
+if ((!isset($_POST['panel_nomargin']) or empty($_POST['panel_nomargin'])) and ($_POST['panel_edit'] == "on")) {
+       if (file_exists("data/panels/{$_POST['panel_id']}/nomargin.txt")) {
+               unlink("data/panels/{$_POST['panel_id']}/nomargin.txt");
+       }
+}
+
+if (isset($_POST['panel_nomargin']) and !empty($_POST['panel_nomargin']) and ($_POST['panel_nomargin'] == "on")) {
+       if (!file_exists("data/panels/{$_POST['panel_id']}/nomargin.txt")) {
+               touch("data/panels/{$_POST['panel_id']}/nomargin.txt");
+       }
+}
+
+if ((!isset($_POST['panel_free']) or empty($_POST['panel_free'])) and ($_POST['panel_edit'] == "on")) {
        if (file_exists("data/panels/{$_POST['panel_id']}/free.txt")) {
                unlink("data/panels/{$_POST['panel_id']}/free.txt");
        }
+       if (file_exists("data/panels/{$_POST['panel_id']}/nomargin.txt")) {
+               unlink("data/panels/{$_POST['panel_id']}/nomargin.txt");
+       }
 }
 
 if (isset($_POST['panel_free']) and !empty($_POST['panel_free']) and ($_POST['panel_free'] == "on")) {
@@ -103,7 +130,7 @@ if (isset($_POST['panel_free']) and !empty($_POST['panel_free']) and ($_POST['pa
        }
 }
 
-if ((!isset($_POST['panel_right']) or !empty($_POST['panel_right'])) and ($_POST['panel_edit'] == "on")) {
+if ((!isset($_POST['panel_right']) or empty($_POST['panel_right'])) and ($_POST['panel_edit'] == "on")) {
        if (file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
                unlink("data/panels/{$_POST['panel_id']}/right.txt");
        }
@@ -115,7 +142,7 @@ if (isset($_POST['panel_right']) and !empty($_POST['panel_right']) and ($_POST['
        }
 }
 
-if ((!isset($_POST['panel_center']) or !empty($_POST['panel_center'])) and ($_POST['panel_edit'] == "on")) {
+if ((!isset($_POST['panel_center']) or empty($_POST['panel_center'])) and ($_POST['panel_edit'] == "on")) {
        if (file_exists("data/panels/{$_POST['panel_id']}/center.txt")) {
                unlink("data/panels/{$_POST['panel_id']}/center.txt");
        }
@@ -130,7 +157,7 @@ if (isset($_POST['panel_center']) and !empty($_POST['panel_center']) and ($_POST
        }
 }
 
-if ((!isset($_POST['panel_top']) or !empty($_POST['panel_top'])) and ($_POST['panel_edit'] == "on")) {
+if ((!isset($_POST['panel_top']) or empty($_POST['panel_top'])) and ($_POST['panel_edit'] == "on")) {
        if (file_exists("data/panels/{$_POST['panel_id']}/top.txt")) {
                unlink("data/panels/{$_POST['panel_id']}/top.txt");
        }
@@ -148,7 +175,7 @@ if (isset($_POST['panel_top']) and !empty($_POST['panel_top']) and ($_POST['pane
        }
 }
 
-if ((!isset($_POST['panel_entry']) or !empty($_POST['panel_entry'])) and ($_POST['panel_edit'] == "on")) {
+if ((!isset($_POST['panel_entry']) or empty($_POST['panel_entry'])) and ($_POST['panel_edit'] == "on")) {
        if (file_exists("data/panels/{$_POST['panel_id']}/entry.txt")) {
                unlink("data/panels/{$_POST['panel_id']}/entry.txt");
        }
@@ -170,7 +197,7 @@ if (isset($_POST['panel_entry']) and !empty($_POST['panel_entry']) and ($_POST['
        }
 }
 
-if ((!isset($_POST['panel_header']) or !empty($_POST['panel_header'])) and ($_POST['panel_edit'] == "on")) {
+if ((!isset($_POST['panel_header']) or empty($_POST['panel_header'])) and ($_POST['panel_edit'] == "on")) {
        if (file_exists("data/header.txt") and (file_get_contents("data/header.txt") == $_POST['panel_id'])) {
                unlink("data/header.txt");
        }
@@ -182,6 +209,10 @@ if (isset($_POST['panel_header']) and !empty($_POST['panel_header']) and ($_POST
                unlink("data/panels/{$_POST['panel_id']}/free.txt");
        }
 
+       if (file_exists("data/panels/{$_POST['panel_id']}/nomargin.txt")) {
+               unlink("data/panels/{$_POST['panel_id']}/nomargin.txt");
+       }
+
        if (file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
                unlink("data/panels/{$_POST['panel_id']}/right.txt");
        }
@@ -203,7 +234,7 @@ if (isset($_POST['panel_header']) and !empty($_POST['panel_header']) and ($_POST
        fclose($new_header_file);
 }
 
-if ((!isset($_POST['panel_footer']) or !empty($_POST['panel_footer'])) and ($_POST['panel_edit'] == "on")) {
+if ((!isset($_POST['panel_footer']) or empty($_POST['panel_footer'])) and ($_POST['panel_edit'] == "on")) {
        if (file_exists("data/footer.txt") and (file_get_contents("data/footer.txt") == $_POST['panel_id'])) {
                unlink("data/footer.txt");
        }
@@ -215,6 +246,10 @@ if (isset($_POST['panel_footer']) and !empty($_POST['panel_footer']) and ($_POST
                unlink("data/panels/{$_POST['panel_id']}/free.txt");
        }
 
+       if (file_exists("data/panels/{$_POST['panel_id']}/nomargin.txt")) {
+               unlink("data/panels/{$_POST['panel_id']}/nomargin.txt");
+       }
+
        if (file_exists("data/panels/{$_POST['panel_id']}/right.txt")) {
                unlink("data/panels/{$_POST['panel_id']}/right.txt");
        }
@@ -388,11 +423,19 @@ a:active {
                                if (file_exists("data/panels/$panel/private.txt")) {
                                        echo " checked";
                                }
-                               echo "> hide<br><input type=\"checkbox\" name=\"panel_free\"";
+                               echo "> hide<br><input type=\"checkbox\" name=\"panel_auth\"";
+                               if (file_exists("data/panels/$panel/auth.txt")) {
+                                       echo " checked";
+                               }
+                               echo "> auth<br><input type=\"checkbox\" name=\"panel_free\"";
                                if (file_exists("data/panels/$panel/free.txt")) {
                                        echo " checked";
                                }
-                               echo "> free<br><input type=\"checkbox\" name=\"panel_header\"";
+                               echo "> free<br><input type=\"checkbox\" name=\"panel_nomargin\"";
+                               if (file_exists("data/panels/$panel/nomargin.txt")) {
+                                       echo " checked";
+                               }
+                               echo "> nomargin<br><input type=\"checkbox\" name=\"panel_header\"";
                                if (file_exists("data/header.txt") and (file_get_contents("data/header.txt") == $panel)) {
                                        echo " checked";
                                }
@@ -423,7 +466,7 @@ a:active {
                                readfile("data/panels/$panel/title.txt");
                                echo "\" autocomplete=\"off\" maxlength=\"90\"></td></tr>";
 
-                               echo "<tr><td><textarea class=\"input\" name=\"panel_content\" rows=\"10\">";
+                               echo "<tr><td><textarea class=\"input\" name=\"panel_content\" rows=\"15\">";
                                readfile("data/panels/$panel/panel.php");
                                echo "</textarea></td></tr>";
 
diff --git a/rel.txt b/rel.txt
index 1fa96fa..9a8e6af 100644
--- a/rel.txt
+++ b/rel.txt
@@ -1 +1 @@
-201006260247
+201007190757
diff --git a/settings.php b/settings.php
index 230e399..e4d02e7 100644
--- a/settings.php
+++ b/settings.php
@@ -434,6 +434,18 @@ if (!isset($_POST['reset']) or empty($_POST['reset'])) {
        }
 }
 
+if (isset($_POST['noadd']) and !empty($_POST['noadd']) and ($_POST['noadd'] == "on") and !file_exists("data/noadd.txt")) {
+       touch("data/noadd.txt");
+}
+
+if (!isset($_POST['noadd']) or empty($_POST['noadd'])) {
+       if (isset($_POST['edit']) and ($_POST['edit'] == "on")) {
+               if (file_exists("data/noadd.txt")) {
+                       unlink("data/noadd.txt");
+               }
+       }
+}
+
 if (isset($_POST['member']) and !empty($_POST['member']) and ($_POST['member'] == "on") and !file_exists("data/member.txt")) {
        touch("data/member.txt");
 }
@@ -1341,7 +1353,7 @@ if (file_exists("data/pf-censor.txt")) {
 
 if (file_exists("data/bb.txt")) {
 
-       $bb_rowspan = "11";
+       $bb_rowspan = "12";
 
        if (file_exists("images/avatar.jpg") or file_exists("images/avatar.gif") or file_exists("images/avatar.png")) {
       
@@ -1365,6 +1377,7 @@ else {
 <tr><td><input type="checkbox" name="reg" <?php if (file_exists("data/reg.txt")) { echo checked; } ?>> Enable new user registration.</td></tr>
 <tr><td><input type="checkbox" name="xapp" <?php if (file_exists("data/xapp.txt")) { echo checked; } ?>> Enable automatic activation of confirmed users.</td></tr>
 <tr><td><input type="checkbox" name="reset" <?php if (file_exists("data/reset.txt")) { echo checked; } ?>> Enable password reset requests.</td></tr>
+<tr><td><input type="checkbox" name="noadd" <?php if (file_exists("data/noadd.txt")) { echo checked; } ?>> Edit only. Members cannot add new entries.</td></tr>
 <tr><td><input type="checkbox" name="member" <?php if (file_exists("data/member.txt")) { echo checked; } ?>> Only members can view posts of other members.</td></tr>
 <tr><td><input type="checkbox" name="nomem" <?php if (file_exists("data/nomem.txt")) { echo checked; } ?>> Only members can view member list and member info.</td></tr>
 <tr><td><input type="checkbox" name="stats" <?php if (file_exists("data/bb-stats.txt")) { echo checked; } ?>> Enable statistics panel.</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