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

commit ea16f749211bad99c50b4658ea9965874ace6328
tree 9f1363f085e07b8f23101df4bcbaa37e64111170
parent c5a572618d334ac43a832f439bf03b914659685e
author Engels Antonio <engels@majcms.org> 1277314184 +0800
committer Engels Antonio <engels@majcms.org> 1277314184 +0800

    maj-0.14-20060213.zip

diff --git a/cat.php b/cat.php
index ee4e268..0227269 100644
--- a/cat.php
+++ b/cat.php
@@ -40,7 +40,7 @@ if (isset($_REQUEST['new_id']) and !empty($_REQUEST['new_id'])) {
                mkdir("data/categories", 0777);
        }
 
-       $new_id = trim(strip_tags(strtolower($_REQUEST['new_id'])));
+       $new_id = trim(strip_tags(strtolower(str_replace(" ", "_", $_REQUEST['new_id']))));
 
        if (!file_exists("data/categories/$new_id")) {
                mkdir("data/categories/$new_id", 0777);
@@ -192,7 +192,7 @@ a:active {
                                echo $_SERVER['PHP_SELF'];
                                echo '" method="post">';
                                echo "<tr><td><p><b>";
-                               echo strtolower($category);
+                               echo strtolower(str_replace("_", " ", $category));
                                echo '</b></p></td><td><p><input type=text class=input name=cat_title value="';
                                readfile("data/categories/$category/title.txt");
                                echo '" autocomplete=off maxlength=90></p></td><td><p align=center><input type=checkbox name=cat_hide';
diff --git a/index.php b/index.php
index 2a4f25f..6c14d11 100644
--- a/index.php
+++ b/index.php
@@ -717,7 +717,7 @@ if (file_exists("header.php")) {
 }
 ?>
 
-<table border=0 cellspacing=0 cellpadding=0>
+<table border=0 cellspacing=0 cellpadding=0 width=905>
 <tr><td width=175 valign=top>
 
 <div id=panel_title>Profile</div>
@@ -1182,7 +1182,7 @@ else {
                        while (($entry_album = readdir($dh_album)) !== false) {
                                if ($entry_album != "." && $entry_album != ".." && fnmatch("*", $entry_album)) {
 
-                                       $current_image = 'images/' . $d . '/album/' . $entry_album;
+                                       $current_image = "images/$d/album/$entry_album";
                                        $current_image_size = getimagesize($current_image);
                                        $current_width = $current_image_size[0];
                                        $current_height = $current_image_size[1];
@@ -1199,16 +1199,46 @@ else {
                                        }
 
                                        $new_width = (int) ($current_width * $sizefactor);
-                                       $new_height = (int) ($current_height * $sizefactor);
+                                       $new_height = (int) ($current_height * $sizefactor);
+
+                                       /* auto-thumbnails (20060213) - In maj-0.14-20060131, album thumbnails were simply the original images displayed with smaller "width=" and "height=" values. Album index loading was painfully slow since the browser had to download the original images from the server. This should speed things up. We placed the "function" here instead of edit.php or add.php to make auto-thumbnail generation available for maj-0.14-20060131 users who may already have existing albums. */
+
+                                       if (!file_exists("images/$d/thumbnails/{$entry_album}-thumbnail.jpg")) {
+
+                                               $work_thumb = imagecreatetruecolor($new_width,$new_height);
+                                               $get_mimetype = image_type_to_mime_type(exif_imagetype($current_image));
+                                               switch($get_mimetype) {
+                                                       case "image/jpg":
+                                                       case "image/jpeg":
+                                                               $work_image = imagecreatefromjpeg($current_image);
+                                                               break;
+                                                       case "image/gif":
+                                                               $work_image = imagecreatefromgif($current_image);
+                                                               break;
+                                                       case "image/png":
+                                                               $work_image = imagecreatefrompng($current_image);
+                                                               break;
+                                               }
+
+                                               imagecopyresampled($work_thumb, $work_image ,0, 0, 0, 0, $new_width, $new_height, $current_width, $current_height);
+
+                                               if (!file_exists("images/$d/thumbnails")) {
+                                                       mkdir("images/$d/thumbnails", 0777);
+                                                       chmod("images/$d/thumbnails", 0777);
+                                               }
+
+                                               imagejpeg($work_thumb, "images/$d/thumbnails/{$entry_album}-thumbnail.jpg", 80);
 
-                                       echo '<a href=images/' . $d . '/album/' . $entry_album . '>';
-                                       echo '<img src=images/' . $d . '/album/' . $entry_album . ' width=' . $new_width .  ' height=' . $new_height . ' border=0 hspace=2 vspace=2';
+}
+
+                                       echo "<a href=images/$d/album/$entry_album>";
+                                       echo "<img src=images/$d/thumbnails/{$entry_album}-thumbnail.jpg width=$new_width height=$new_height border=0 hspace=2 vspace=2";
                                        if (file_exists("data/items/$d/album/captions/{$entry_album}.txt")) {
                                                echo ' alt="';
                                                readfile("data/items/$d/album/captions/{$entry_album}.txt");
                                                echo '"';
                                        }
-                                       echo '></a>';
+                                       echo "></a>";
 
                                }
                        }
@@ -1535,6 +1565,10 @@ if ($count_latest_items > 0) {
                if ($dh_categories = opendir("data/categories")) {
                        while (($entry_categories = readdir($dh_categories)) !== false) {
 
+                               if (file_exists("data/xcat.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+                                       continue;
+                               }
+
                                if (file_exists("data/categories/$entry_categories/private.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
                                        continue;
                                }
diff --git a/login.php b/login.php
index 1f04be7..d811cd5 100644
--- a/login.php
+++ b/login.php
@@ -67,6 +67,7 @@ $open_password_file = fopen($password_file,"r");
 $login_password = fread($open_password_file,filesize($password_file));
 fclose($open_password_file);
 
+/* Fun with crypt! */
 $crypt_password = sha1($_REQUEST['password']);
 $crypt_password = md5($crypt_password);
 $crypt_password = crypt($crypt_password, $crypt_password);
 
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
13143 downloads
MAJ 0.14
45 files
35025 downloads