This blob has been accessed 504 times via Git panel.
- <?php
- header('Content-Type: text/html; charset=UTF-8');
- header('Cache-Control: private');
- ini_set("session.use_trans_sid","0");
- ini_set("mbstring.language","Neutral");
- ini_set("mbstring.internal_encoding","UTF-8");
- ini_set("mbstring.encoding_translation","On");
- ini_set("mbstring.http_input","auto");
- ini_set("mbstring.http_output","UTF-8");
- ini_set("mbstring.detect_order","auto");
- ini_set("mbstring.substitute_character","none");
- ini_set("default_charset","UTF-8");
- error_reporting(E_ERROR);
- session_start();
- $maj_data_directory = "data";
- $maj_image_directory = "images";
- $maj_mailer = "MAJ/2.0 (PHP/" . phpversion() . ")";
- $maj_default_title = file_get_contents("$maj_data_directory/title.txt");
- $maj_admin_username = file_get_contents("$maj_data_directory/username.txt");
- if (isset($_SESSION['logged_in'])) {
- $maj_logged_in_username = $_SESSION['logged_in'];
- }
- if (isset($maj_logged_in_username) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
- header("Location: login.php");
- }
- if (get_magic_quotes_gpc()) {
- function stripslashes_array($data) {
- if (is_array($data)) {
- foreach ($data as $key => $value) {
- $data[$key] = stripslashes_array($value);
- }
- return $data;
- }
- else {
- return stripslashes($data);
- }
- }
- $_REQUEST = stripslashes_array($_REQUEST);
- }
- if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
- $maj_req_entry = trim($_REQUEST['entry']);
- }
- if (isset($_REQUEST['show']) and !empty($_REQUEST['show'])) {
- $maj_req_show = trim($_REQUEST['show']);
- }
- if (isset($_REQUEST['find']) and !empty($_REQUEST['find'])) {
- $maj_req_find = trim($_REQUEST['find']);
- $maj_req_find = str_replace(" ","-",$maj_req_find);
- $maj_req_find = mb_strtolower($maj_req_find);
- $maj_req_find = strip_tags($maj_req_find);
- }
- if (isset($_REQUEST['category']) and !empty($_REQUEST['category'])) {
- $maj_req_category = trim($_REQUEST['category']);
- $maj_req_category = str_replace(" ","-",$maj_req_category);
- $maj_req_category = mb_strtolower($maj_req_category);
- $maj_req_category = strip_tags($maj_req_category);
- }
- if (isset($_REQUEST['archive']) and !empty($_REQUEST['archive'])) {
- $maj_req_archive = trim($_REQUEST['archive']);
- }
- if (isset($_REQUEST['author']) and !empty($_REQUEST['author'])) {
- $maj_req_author = trim($_REQUEST['author']);
- $maj_req_author = str_replace(" ","-",$maj_req_author);
- $maj_req_author = mb_strtolower($maj_req_author);
- $maj_req_author = strip_tags($maj_req_author);
- }
- if (file_exists("$maj_data_directory/offset.txt")) {
- $maj_offset = file_get_contents("$maj_data_directory/offset.txt");
- }
- else {
- $maj_offset = 0;
- }
- if (file_exists("$maj_data_directory/increase.txt")) {
- $maj_increase = file_get_contents("$maj_data_directory/increase.txt");
- }
- else {
- $maj_increase = 5;
- }
- $maj_wspace = "10";
- if (file_exists("$maj_data_directory/bb.txt") and file_exists("$maj_data_directory/avatar.txt")) {
- $maj_wpanel = "160";
- $maj_wentry = "600";
- $maj_ablock = "90";
- }
- else {
- $maj_wpanel = "205";
- $maj_wentry = "510";
- $maj_ablock = "0";
- }
- $maj_pimage = $maj_wpanel - $maj_wspace;
- $maj_aimage = $maj_ablock - $maj_wspace;
- $maj_eimage = $maj_wentry - $maj_wspace - $maj_ablock;
- $maj_uquery = count($_GET);
- if (file_exists("$maj_data_directory/panels-l.txt") or file_exists("$maj_data_directory/panels-r.txt")) {
- // $maj_wentry = $maj_wentry + $maj_space + $maj_wpanel;
- $maj_wtable = $maj_wspace + $maj_wpanel + $maj_wspace + $maj_wentry + $maj_wspace;
- }
- else {
- $maj_wtable = $maj_wspace + $maj_wpanel + $maj_wspace + $maj_wentry + $maj_wspace + $maj_wpanel + $maj_wspace;
- }
- $maj_default_blog_title = "My Activity Journal";
- $maj_default_username = "maj";
- $maj_default_password = "php";
- $maj_default_blog_profile = 'This cool site is powered by My Activity Journal (<a href="http://majcms.org/" target="_maj">MAJ</a>), a simple <a href="http://php.net/" target="_maj">PHP</a>-based, <a href="http://opensource.org/" target="_maj">Open Source</a> content management system (CMS) that can be deployed as a blog, bulletin board (Internet forum or message board), and wiki.';
- $maj_default_blog_author = "My Activity Journal";
- if (!file_exists($maj_data_directory)) {
- mkdir($maj_data_directory);
- }
- if (!file_exists("$maj_data_directory/.htaccess")) {
- $maj_htaccess = "Order deny,allow\nDeny from all";
- }
- if (!file_exists("$maj_data_directory/title.txt")) {
- }
- if (!file_exists("$maj_data_directory/username.txt")) {
- }
- if (!file_exists("$maj_data_directory/password.txt")) {
- $maj_default_password = sha1($maj_default_password);
- $maj_default_password = md5($maj_default_password);
- $maj_default_password = crypt($maj_default_password,$maj_default_password);
- }
- if (!file_exists("$maj_data_directory/profile.php")) {
- }
- if (!file_exists("$maj_data_directory/author.txt")) {
- }
- function str_rand($length = 8,$seeds = 'abcdefghijklmnopqrstuvwxyz0123456789') {
- $str = '';
- $count = mb_strlen($seeds);
- list($usec,$sec) = explode(' ',microtime());
- $seed = (float) $sec + ((float) $usec * 100000);
- mt_srand($seed);
- for ($i = 0; $length > $i; $i++) {
- $str .= $seeds{mt_rand(0,$count - 1)};
- }
- return $str;
- }
- function rmdirr($dir) {
- if (!file_exists($dir)) {
- return false;
- }
- if (is_file($dir)) {
- return unlink($dir);
- }
- $recurse = dir($dir);
- while (false !== $entry = $recurse->read()) {
- if ($entry == '.' || $entry == '..') {
- continue;
- }
- rmdirr("$dir/$entry");
- }
- $recurse->close();
- return rmdir($dir);
- }
- function return_bytes($val) {
- $val = trim($val);
- $last = $val{mb_strlen($val) - 1};
- switch ($last) {
- case 'k':
- case 'K':
- return(int)$val * 1024;
- break;
- case 'm':
- case 'M':
- return(int)$val * 1048576;
- break;
- default:
- return $val;
- }
- }
- $server_upload_max_filesize = return_bytes(ini_get('upload_max_filesize'));
- $server_post_max_size = return_bytes(ini_get('post_max_size'));
- $server_memory_limit = return_bytes(ini_get('memory_limit'));
- $max_file_size = $server_upload_max_filesize;
- if ($server_upload_max_filesize > $server_post_max_size) {
- $max_file_size = $server_post_max_size;
- }
- if ($server_post_max_size > $server_memory_limit) {
- $max_file_size = $server_memory_limit;
- }
- function entry2date($entry) {
- $year = mb_substr($entry, 0, 4);
- $month = mb_substr($entry, 4, 2);
- $day = mb_substr($entry, 6, 2);
- $hour = mb_substr($entry, 8, 2);
- $min = mb_substr($entry, 10, 2);
- $sec = mb_substr($entry, 12, 2);
- }
- function reformat_html($data) {
- $store_0 = mb_split("<html>", $data);
- $data = "";
- $data .= $store_0[0];
- foreach ($store_0 as $item_0 => $ref_0) {
- if (mb_eregi("</html>", $ref_0)) {
- $store_1 = mb_split("</html>", $ref_0);
- $store_1[0] = mb_eregi_replace("\n", "", $store_1[0]);
- foreach ($store_1 as $item_1 => $ref_1) {
- if ($item_1 == 0) {
- $ref_1 = "<!-- html -->$ref_1<!-- /html -->";
- }
- $data .= $ref_1;
- }
- }
- }
- return $data;
- }
- function reformat_code($data) {
- global $maj_image_directory;
- $store_0 = mb_split("<code>", $data);
- $data = "";
- $data .= $store_0[0];
- foreach ($store_0 as $item_0 => $ref_0) {
- if (mb_eregi("</code>", $ref_0)) {
- $store_1 = mb_split("</code>", $ref_0);
- $store_1[0] = mb_eregi_replace("<img src=\"$maj_image_directory/smileys/crying.png\" border=\"0\">", ':((', $store_1[0]);
- $store_1[0] = mb_eregi_replace("<img src=\"$maj_image_directory/smileys/frown.png\" border=\"0\">", ':(', $store_1[0]);
- $store_1[0] = mb_eregi_replace("<img src=\"$maj_image_directory/smileys/indifferent.png\" border=\"0\">", ':|', $store_1[0]);
- $store_1[0] = mb_eregi_replace("<img src=\"$maj_image_directory/smileys/laughing.png\" border=\"0\">", ':D', $store_1[0]);
- $store_1[0] = mb_eregi_replace("<img src=\"$maj_image_directory/smileys/lick.png\" border=\"0\">", ':P', $store_1[0]);
- $store_1[0] = mb_eregi_replace("<img src=\"$maj_image_directory/smileys/ohno.png\" border=\"0\">", ':O', $store_1[0]);
- $store_1[0] = mb_eregi_replace("<img src=\"$maj_image_directory/smileys/smile.png\" border=\"0\">", ':)', $store_1[0]);
- $store_1[0] = mb_eregi_replace("<img src=\"$maj_image_directory/smileys/surprised.png\" border=\"0\">", '=)', $store_1[0]);
- $store_1[0] = mb_eregi_replace("<img src=\"$maj_image_directory/smileys/undecided.png\" border=\"0\">", ':\\', $store_1[0]);
- $store_1[0] = mb_eregi_replace("<img src=\"$maj_image_directory/smileys/wink.png\" border=\"0\">", ';)', $store_1[0]);
- $store_1[0] = htmlentities($store_1[0], ENT_QUOTES, 'UTF-8');
- foreach ($store_1 as $item_1 => $ref_1) {
- if ($item_1 == 0) {
- $ref_1 = "<code>$ref_1</code>";
- }
- $data .= $ref_1;
- }
- }
- }
- return $data;
- }
- function format_title_put($data) {
- // 20100113 - auto-captialize title except articles, prepositions and conjunctions less tha 4 letters, and particle "to"
- $data = ucwords($data);
- $data = str_replace('<', '<', $data);
- $data = str_replace('>', '>', $data);
- $data = str_replace(' A ', ' a ', $data);
- $data = str_replace(' An ', ' an ', $data);
- $data = str_replace(' And ', ' and ', $data);
- $data = str_replace(' As ', ' as ', $data);
- $data = str_replace(' At ', ' at ', $data);
- $data = str_replace(' But ', ' but ', $data);
- $data = str_replace(' By ', ' by ', $data);
- $data = str_replace(' For ', ' for ', $data);
- $data = str_replace(' In ', ' in ', $data);
- $data = str_replace(' Of ', ' of ', $data);
- $data = str_replace(' On ', ' on ', $data);
- $data = str_replace(' Or ', ' or ', $data);
- $data = str_replace(' The ', ' the ', $data);
- $data = str_replace(' To ', ' to ', $data);
- return $data;
- }
- function format_body_put($data) {
- global $maj_image_directory;
- $data = ucfirst($data);
- $data = str_replace("[html]", '<html>', $data);
- $data = str_replace("[/html]", '</html>', $data);
- $data = reformat_html($data);
- $data = str_replace(':((', "<img src=\"$maj_image_directory/smileys/crying.png\" border=\"0\">", $data);
- $data = str_replace(':(', "<img src=\"$maj_image_directory/smileys/frown.png\" border=\"0\">", $data);
- $data = str_replace(':|', "<img src=\"$maj_image_directory/smileys/indifferent.png\" border=\"0\">", $data);
- $data = str_replace(':D', "<img src=\"$maj_image_directory/smileys/laughing.png\" border=\"0\">", $data);
- $data = str_replace(':P', "<img src=\"$maj_image_directory/smileys/lick.png\" border=\"0\">", $data);
- $data = str_replace(':O', "<img src=\"$maj_image_directory/smileys/ohno.png\" border=\"0\">", $data);
- $data = str_replace(':)', "<img src=\"$maj_image_directory/smileys/smile.png\" border=\"0\">", $data);
- $data = str_replace('=)', "<img src=\"$maj_image_directory/smileys/surprised.png\" border=\"0\">", $data);
- $data = str_replace(':\\', "<img src=\"$maj_image_directory/smileys/undecided.png\" border=\"0\">", $data);
- $data = str_replace(';)', "<img src=\"$maj_image_directory/smileys/wink.png\" border=\"0\">", $data);
- $data = str_replace('[code]', '<code>', $data);
- $data = str_replace('[/code]', '</code>', $data);
- $data = reformat_code($data);
- $data = str_replace("\n", '<br />', $data);
- $data = str_replace('[b]', '<b>', $data);
- $data = str_replace('[/b]', '</b>', $data);
- $data = str_replace('[i]', '<i>', $data);
- $data = str_replace('[/i]', '</i>', $data);
- $data = str_replace('[u]', '<u>', $data);
- $data = str_replace('[/u]', '</u>', $data);
- $data = str_replace('[strike]', '<strike>', $data);
- $data = str_replace('[/strike]', '</strike>', $data);
- $data = str_replace('[sup]', '<sup>', $data);
- $data = str_replace('[/sup]', '</sup>', $data);
- $data = str_replace('[sub]', '<sub>', $data);
- $data = str_replace('[/sub]', '</sub>', $data);
- $data = str_replace('[highlight]', '<highlight>', $data);
- $data = str_replace('[/highlight]', '</highlight>', $data);
- $data = str_replace('<highlight>', '<span style="background-color: #ffff00;">', $data);
- $data = str_replace('</highlight>', '</span>', $data);
- $data = preg_replace("/<([_\.0-9a-z-]+)@([0-9a-z][0-9a-z-]+)\.([_\.0-9a-z-]+)>/", '<$1@$2.$3>', $data);
- return $data;
- }
- function maj_avatar_image($author_username,$max_img_width=80,$show_username=1,$show_rank=1) {
- global $maj_admin_username;
- global $maj_data_directory;
- global $maj_image_directory;
- if (($maj_admin_username == $author_username) and (file_exists("$maj_image_directory/avatar.jpg") or file_exists("$maj_image_directory/avatar.gif") or file_exists("$maj_image_directory/avatar.png"))) {
- if (file_exists("$maj_image_directory/avatar.gif")) {
- $avatar_gif_image_size = getimagesize("$maj_image_directory/avatar.gif");
- $avatar_gif_image_width = $avatar_gif_image_size[0];
- $avatar_gif_image_height = $avatar_gif_image_size[1];
- if ($avatar_gif_image_width > $max_img_width) {
- $sizefactor = (double) ($max_img_width / $avatar_gif_image_width) ;
- $avatar_gif_image_width = (int) ($avatar_gif_image_width * $sizefactor);
- $avatar_gif_image_height = (int) ($avatar_gif_image_height * $sizefactor);
- if (file_exists("$maj_data_directory/avatar-resize-gif.txt")) {
- $avatar_gif_image_resize = imagecreatetruecolor($avatar_gif_image_width,$avatar_gif_image_height);
- imagealphablending($avatar_gif_image_resize, false);
- imagesavealpha($avatar_gif_image_resize, true);
- $avatar_gif_image_original = imagecreatefromgif("$maj_image_directory/avatar.gif");
- $avatar_gif_transparent_index = imagecolortransparent($avatar_gif_image_original);
- if ($avatar_gif_transparent_index >= 0) {
- $avatar_gif_transparent_color = imagecolorsforindex($avatar_gif_image_original, $avatar_gif_transparent_index);
- $avatar_gif_transparent_index = imagecolorallocate($avatar_gif_image_resize, $avatar_gif_transparent_color['red'], $avatar_gif_transparent_color['green'], $avatar_gif_transparent_color['blue']);
- imagefill($avatar_gif_image_resize, 0, 0, $avatar_gif_transparent_index);
- imagecolortransparent($avatar_gif_image_resize, $avatar_gif_transparent_index);
- }
- imagecopyresampled($avatar_gif_image_resize,$avatar_gif_image_original,0,0,0,0,$avatar_gif_image_width,$avatar_gif_image_height,$avatar_gif_image_size[0],$avatar_gif_image_size[1]);
- unlink("$maj_image_directory/avatar.gif");
- imagegif($avatar_gif_image_resize,"$maj_image_directory/avatar.gif",100);
- imagedestroy($avatar_gif_image_resize);
- imagedestroy($avatar_gif_image_original);
- }
- }
- echo "<a href=\"member.php?id=$author_username\"><img class=\"azoom\" src=\"$maj_image_directory/avatar.gif\" border=\"0\" width=\"$avatar_gif_image_width\" height=\"$avatar_gif_image_height\"></a><br>";
- }
- if (file_exists("$maj_image_directory/avatar.jpg")) {
- $avatar_jpg_image_size = getimagesize("$maj_image_directory/avatar.jpg");
- $avatar_jpg_image_width = $avatar_jpg_image_size[0];
- $avatar_jpg_image_height = $avatar_jpg_image_size[1];
- if ($avatar_jpg_image_width > $max_img_width) {
- $sizefactor = (double) ($max_img_width / $avatar_jpg_image_width) ;
- $avatar_jpg_image_width = (int) ($avatar_jpg_image_width * $sizefactor);
- $avatar_jpg_image_height = (int) ($avatar_jpg_image_height * $sizefactor);
- if (file_exists("$maj_data_directory/avatar-resize-jpg.txt")) {
- $avatar_jpg_image_resize = imagecreatetruecolor($avatar_jpg_image_width,$avatar_jpg_image_height);
- $avatar_jpg_image_original = imagecreatefromjpeg("$maj_image_directory/avatar.jpg");
- imagecopyresampled($avatar_jpg_image_resize,$avatar_jpg_image_original,0,0,0,0,$avatar_jpg_image_width,$avatar_jpg_image_height,$avatar_jpg_image_size[0],$avatar_jpg_image_size[1]);
- unlink("$maj_image_directory/avatar.jpg");
- imagejpeg($avatar_jpg_image_resize,"$maj_image_directory/avatar.jpg",100);
- imagedestroy($avatar_jpg_image_resize);
- imagedestroy($avatar_jpg_image_original);
- }
- }
- echo "<a href=\"member.php?id=$author_username\"><img class=\"azoom\" src=\"$maj_image_directory/avatar.jpg\" border=\"0\" width=\"$avatar_jpg_image_width\" height=\"$avatar_jpg_image_height\"></a><br>";
- }
- if (file_exists("$maj_image_directory/avatar.png")) {
- $avatar_png_image_size = getimagesize("$maj_image_directory/avatar.png");
- $avatar_png_image_width = $avatar_png_image_size[0];
- $avatar_png_image_height = $avatar_png_image_size[1];
- if ($avatar_png_image_width > $max_img_width) {
- $sizefactor = (double) ($max_img_width / $avatar_png_image_width) ;
- $avatar_png_image_width = (int) ($avatar_png_image_width * $sizefactor);
- $avatar_png_image_height = (int) ($avatar_png_image_height * $sizefactor);
- if (file_exists("$maj_data_directory/avatar-resize-png.txt")) {
- $avatar_png_image_resize = imagecreatetruecolor($avatar_png_image_width,$avatar_png_image_height);
- imagealphablending($avatar_png_image_resize, false);
- imagesavealpha($avatar_png_image_resize, true);
- $avatar_png_image_original = imagecreatefrompng("$maj_image_directory/avatar.png");
- imagecopyresampled($avatar_png_image_resize,$avatar_png_image_original,0,0,0,0,$avatar_png_image_width,$avatar_png_image_height,$avatar_png_image_size[0],$avatar_png_image_size[1]);
- unlink("$maj_image_directory/avatar.png");
- imagepng($avatar_png_image_resize,"$maj_image_directory/avatar.png",100);
- imagedestroy($avatar_png_image_resize);
- imagedestroy($avatar_png_image_original);
- }
- }
- echo "<a href=\"member.php?id=$author_username\"><img class=\"azoom\" src=\"$maj_image_directory/avatar.png\" border=\"0\" width=\"$avatar_png_image_width\" height=\"$avatar_png_image_height\"></a><br>";
- }
- }
- elseif (file_exists("$maj_image_directory/members/$author_username/avatar.jpg") or file_exists("$maj_image_directory/members/$author_username/avatar.gif") or file_exists("$maj_image_directory/members/$author_username/avatar.png")) {
- if (file_exists("$maj_image_directory/members/$author_username/avatar.gif")) {
- $avatar_gif_image_size = getimagesize("$maj_image_directory/members/$author_username/avatar.gif");
- $avatar_gif_image_width = $avatar_gif_image_size[0];
- $avatar_gif_image_height = $avatar_gif_image_size[1];
- if ($avatar_gif_image_width > $max_img_width) {
- $sizefactor = (double) ($max_img_width / $avatar_gif_image_width) ;
- $avatar_gif_image_width = (int) ($avatar_gif_image_width * $sizefactor);
- $avatar_gif_image_height = (int) ($avatar_gif_image_height * $sizefactor);
- if (file_exists("$maj_data_directory/avatar-resize-gif.txt")) {
- $avatar_gif_image_resize = imagecreatetruecolor($avatar_gif_image_width,$avatar_gif_image_height);
- imagealphablending($avatar_gif_image_resize, false);
- imagesavealpha($avatar_gif_image_resize, true);
- $avatar_gif_image_original = imagecreatefromgif("$maj_image_directory/members/$author_username/avatar.gif");
- $avatar_gif_transparent_index = imagecolortransparent($avatar_gif_image_original);
- if ($avatar_gif_transparent_index >= 0) {
- $avatar_gif_transparent_color = imagecolorsforindex($avatar_gif_image_original, $avatar_gif_transparent_index);
- $avatar_gif_transparent_index = imagecolorallocate($avatar_gif_image_resize, $avatar_gif_transparent_color['red'], $avatar_gif_transparent_color['green'], $avatar_gif_transparent_color['blue']);
- imagefill($avatar_gif_image_resize, 0, 0, $avatar_gif_transparent_index);
- imagecolortransparent($avatar_gif_image_resize, $avatar_gif_transparent_index);
- }
- imagecopyresampled($avatar_gif_image_resize,$avatar_gif_image_original,0,0,0,0,$avatar_gif_image_width,$avatar_gif_image_height,$avatar_gif_image_size[0],$avatar_gif_image_size[1]);
- unlink("$maj_image_directory/members/$author_username/avatar.gif");
- imagegif($avatar_gif_image_resize,"$maj_image_directory/members/$author_username/avatar.gif",100);
- imagedestroy($avatar_gif_image_resize);
- imagedestroy($avatar_gif_image_original);
- }
- }
- echo "<a href=\"member.php?id=$author_username\"><img class=\"azoom\" src=\"$maj_image_directory/members/$author_username/avatar.gif\" border=\"0\" width=\"$avatar_gif_image_width\" height=\"$avatar_gif_image_height\"></a><br>";
- }
- if (file_exists("$maj_image_directory/members/$author_username/avatar.jpg")) {
- $avatar_jpg_image_size = getimagesize("$maj_image_directory/members/$author_username/avatar.jpg");
- $avatar_jpg_image_width = $avatar_jpg_image_size[0];
- $avatar_jpg_image_height = $avatar_jpg_image_size[1];
- if ($avatar_jpg_image_width > $max_img_width) {
- $sizefactor = (double) ($max_img_width / $avatar_jpg_image_width) ;
- $avatar_jpg_image_width = (int) ($avatar_jpg_image_width * $sizefactor);
- $avatar_jpg_image_height = (int) ($avatar_jpg_image_height * $sizefactor);
- if (file_exists("$maj_data_directory/avatar-resize-jpg.txt")) {
- $avatar_jpg_image_resize = imagecreatetruecolor($avatar_jpg_image_width,$avatar_jpg_image_height);
- $avatar_jpg_image_original = imagecreatefromjpeg("$maj_image_directory/members/$author_username/avatar.jpg");
- imagecopyresampled($avatar_jpg_image_resize,$avatar_jpg_image_original,0,0,0,0,$avatar_jpg_image_width,$avatar_jpg_image_height,$avatar_jpg_image_size[0],$avatar_jpg_image_size[1]);
- unlink("$maj_image_directory/members/$author_username/avatar.jpg");
- imagejpeg($avatar_jpg_image_resize,"$maj_image_directory/members/$author_username/avatar.jpg",100);
- imagedestroy($avatar_jpg_image_resize);
- imagedestroy($avatar_jpg_image_original);
- }
- }
- echo "<a href=\"member.php?id=$author_username\"><img class=\"azoom\" src=\"$maj_image_directory/members/$author_username/avatar.jpg\" border=\"0\" width=\"$avatar_jpg_image_width\" height=\"$avatar_jpg_image_height\"></a><br>";
- }
- if (file_exists("$maj_image_directory/members/$author_username/avatar.png")) {
- $avatar_png_image_size = getimagesize("$maj_image_directory/members/$author_username/avatar.png");
- $avatar_png_image_width = $avatar_png_image_size[0];
- $avatar_png_image_height = $avatar_png_image_size[1];
- if ($avatar_png_image_width > $max_img_width) {
- $sizefactor = (double) ($max_img_width / $avatar_png_image_width) ;
- $avatar_png_image_width = (int) ($avatar_png_image_width * $sizefactor);
- $avatar_png_image_height = (int) ($avatar_png_image_height * $sizefactor);
- if (file_exists("$maj_data_directory/avatar-resize-png.txt")) {
- $avatar_png_image_resize = imagecreatetruecolor($avatar_png_image_width,$avatar_png_image_height);
- imagealphablending($avatar_png_image_resize, false);
- imagesavealpha($avatar_png_image_resize, true);
- $avatar_png_image_original = imagecreatefrompng("$maj_image_directory/members/$author_username/avatar.png");
- imagecopyresampled($avatar_png_image_resize,$avatar_png_image_original,0,0,0,0,$avatar_png_image_width,$avatar_png_image_height,$avatar_png_image_size[0],$avatar_png_image_size[1]);
- unlink("$maj_image_directory/members/$author_username/avatar.png");
- imagepng($avatar_png_image_resize,"$maj_image_directory/members/$author_username/avatar.png",100);
- imagedestroy($avatar_png_image_resize);
- imagedestroy($avatar_png_image_original);
- }
- }
- echo "<a href=\"member.php?id=$author_username\"><img class=\"azoom\" src=\"$maj_image_directory/members/$author_username/avatar.png\" border=\"0\" width=\"$avatar_png_image_width\" height=\"$avatar_png_image_height\"></a><br>";
- }
- }
- if ($show_username != 0) {
- echo "<a href=\"member.php?id=$author_username\"><b>$author_username</b></a><br>";
- }
- if ($show_rank != 0) {
- if (($maj_admin_username == $author_username) and file_exists("$maj_data_directory/rank.txt")) {
- echo "administrator<br>";
- }
- elseif (file_exists("$maj_data_directory/members/active/$author_username/rank.txt") and file_exists("$maj_data_directory/rank.txt")) {
- $rank = file_get_contents("$maj_data_directory/members/active/$author_username/rank.txt");
- echo "$rank<br>";
- }
- elseif (!file_exists("$maj_data_directory/members/active/$author_username/rank.txt") and file_exists("$maj_data_directory/rank.txt")) {
- echo "member<br>";
- }
- }
- }
- function maj_download_file($file_name,$file_dir,$count_dir) {
- $file_size = filesize("$file_dir/$file_name");
- header("Cache-Control: ");
- header("Pragma: ");
- header("Content-Type: application/octet-stream");
- header("Content-Disposition: attachment; filename=$file_name");
- header("Content-Length: $file_size");
- echo $file_buffer;
- flush();
- }
- if (($file_sent == $file_size) and isset($count_dir)) {
- if (!file_exists($count_dir)) {
- mkdir($count_dir,0700,true);
- }
- if (file_exists("$count_dir/{$file_name}.txt")) {
- $file_downloads = file_get_contents("$count_dir/{$file_name}.txt");
- }
- else {
- $file_downloads = "0";
- }
- $file_downloads = $file_downloads + 1;
- }
- }
- function maj_profile() {
- global $maj_data_directory;
- global $maj_image_directory;
- global $maj_logged_in_username;
- global $maj_admin_username;
- global $maj_pimage;
- if (!file_exists("$maj_data_directory/xprofile.txt") or ($maj_logged_in_username == $maj_admin_username)) {
- echo "\r\n<div class=\"panel_wrapper\">\r\n\r\n\t<div class=\"panel_title\">Profile</div>\r\n\r\n\t<div class=\"panel_body\">\r\n\t\t";
- if (file_exists("$maj_image_directory/profile.gif")) {
- $img = "$maj_image_directory/profile.gif";
- }
- if (file_exists("$maj_image_directory/profile.jpg")) {
- $img = "$maj_image_directory/profile.jpg";
- }
- if (file_exists("$maj_image_directory/profile.png")) {
- $img = "$maj_image_directory/profile.png";
- }
- if ($img) {
- $size = getimagesize($img);
- $width = $size[0];
- $height = $size[1];
- if ($width > $maj_pimage) {
- $factor = (double) ($maj_pimage / $width) ;
- $width = (int) ($width * $factor);
- $height = (int) ($height * $factor);
- echo "<a href=\".\"><img src=\"$img\" border=\"0\" width=\"$width\" height=\"$height\"></a><br>";
- }
- else {
- echo "<a href=\".\"><img src=\"$img\" border=\"0\" width=\"$width\" height=\"$height\" align=\"left\"></a>";
- }
- }
- include("$maj_data_directory/profile.php");
- echo "\r\n\t</div>\r\n</div>\r\n\r\n";
- }
- }
- function maj_navigation() {
- global $maj_data_directory;
- global $maj_logged_in_username;
- global $maj_admin_username;
- global $maj_req_category;
- if (!file_exists("$maj_data_directory/xnavigation.txt") or ($maj_logged_in_username == $maj_admin_username)) {
- echo "<div class=\"panel_wrapper\">\r\n\r\n\t<div class=\"panel_title\">Navigation</div>\r\n\r\n\t<div class=\"panel_body\">\r\n\t\t<a class=\"navlink\" href=\".\">Home</a><br>\r\n";
- if (file_exists("$maj_data_directory/bb.txt") and file_exists("$maj_data_directory/members/active")) {
- echo "\t\t<a class=\"navlink\" href=\"member.php?id=all\">Members</a><br>\r\n";
- }
- if (isset($maj_logged_in_username) and ($maj_logged_in_username == $maj_admin_username)) {
- echo "\t\t<a class=\"navlink\" href=\"add.php\">Add Entry</a><br>\r\n";
- echo "\t\t<a class=\"navlink\" href=\"settings.php\">Settings</a><br>\r\n";
- echo "\t\t<a class=\"navlink\" href=\"panels.php\">Panels</a><br>\r\n";
- echo "\t\t<a class=\"navlink\" href=\"cat.php\">Categories</a><br>\r\n";
- echo "\t\t<a class=\"navlink\" href=\"colors.php\">Colors</a><br>\r\n";
- echo "\t\t<a class=\"navlink\" href=\"fonts.php\">Fonts</a><br>\r\n";
- echo "\t\t<a class=\"navlink\" href=\"login.php\">Logout</a>\r\n";
- }
- elseif (isset($maj_logged_in_username) and ($maj_logged_in_username != $maj_admin_username) and file_exists("$maj_data_directory/members/active/$maj_logged_in_username") and file_exists("$maj_data_directory/bb.txt")) {
- if (file_exists("$maj_data_directory/members/active/$maj_logged_in_username/categories/$maj_req_category")) {
- if (!file_exists("$maj_data_directory/categories/$maj_req_category")) {
- rmdirr("$maj_data_directory/members/active/$maj_logged_in_username/categories/$maj_req_category");
- }
- }
- if (!file_exists("$maj_data_directory/noadd.txt") and (file_exists("$maj_data_directory/members/active/$maj_logged_in_username/bb-rw.txt") or file_exists("$maj_data_directory/members/active/$maj_logged_in_username/categories/$maj_req_category"))) {
- echo '<a class="navlink" href="add.php">Add Entry</a><br>';
- }
- echo '<a class="navlink" href="options.php">Options</a><br>';
- echo '<a class="navlink" href="login.php">Logout</a>';
- }
- else {
- if (file_exists("$maj_data_directory/bb.txt") and file_exists("$maj_data_directory/reg.txt")) {
- echo '<a class="navlink" href="reg.php">Register</a><br>';
- }
- echo '<a class="navlink" href="login.php">Login</a>';
- }
- echo "\t</div>\r\n</div>\r\n";
- }
- }
- function maj_quick_links() {
- global $maj_data_directory;
- global $maj_logged_in_username;
- global $maj_admin_username;
- if (file_exists("$maj_data_directory/sticky")) {
- if ($dh_sticky_data = opendir("$maj_data_directory/sticky")) {
- while (($entry = readdir($dh_sticky_data)) !== false) {
- if (file_exists("$maj_data_directory/items/$entry/private.txt") and (!isset($maj_logged_in_username) or ($maj_logged_in_username != $maj_admin_username))) {
- continue;
- }
- if (file_exists("$maj_data_directory/items/$entry/member.txt") and (!isset($maj_logged_in_username))) {
- continue;
- }
- $private = "0";
- if (file_exists("$maj_data_directory/items/$entry/categories")) {
- if ($dh_sticky_entry = opendir("$maj_data_directory/items/$entry/categories")) {
- while (($category = readdir($dh_sticky_entry)) !== false) {
- if ($category != "." && $category != "..") {
- if (file_exists("$maj_data_directory/categories/$category/private.txt")) {
- $private = $private + 1;
- }
- }
- }
- closedir($dh_sticky_entry);
- }
- }
- if (($private > 0) and (!isset($maj_logged_in_username) or ($maj_logged_in_username != $maj_admin_username)) and !file_exists("$maj_data_directory/items/$entry/cat.txt")) {
- continue;
- }
- if ($entry != "." && $entry != "..") {
- $entries[] = $entry;
- }
- }
- closedir($dh_sticky_data);
- }
- sort($entries);
- if (count($entries) > 0) {
- echo "<div class=\"panel_wrapper\">";
- echo "<div class=\"panel_title\">Quick Links</div>";
- echo "<div class=\"panel_body\">";
- foreach ($entries as $entry) {
- echo "<a class=\"navlink\" href=\"index.php?entry=$entry\">";
- readfile("$maj_data_directory/items/$entry/title.txt");
- echo "</a><br>";
- }
- echo "</div>";
- echo "</div>";
- }
- }
- }
- function maj_panels($panel_array) {
- global $maj_data_directory;
- global $maj_logged_in_username;
- global $maj_admin_username;
- global $maj_req_entry;
- global $maj_wspace;
- if (count($panel_array) > 0) {
- foreach ($panel_array as $panel) {
- if (file_exists("$maj_data_directory/panels/$panel/link.txt") and ($maj_logged_in_username != $maj_admin_username)) {
- if (file_get_contents("$maj_data_directory/panels/$panel/link.txt") != $maj_req_entry) {
- continue;
- }
- if (file_get_contents("$maj_data_directory/panels/$panel/link.txt") == $maj_req_entry) {
- if ($maj_req_entry > $today) {
- continue;
- }
- if (file_exists("$maj_data_directory/items/$maj_req_entry/private.txt")) {
- continue;
- }
- $pvt_cat = "0";
- if (file_exists("$maj_data_directory/items/$maj_req_entry/categories")) {
- if ($dh_cat = opendir("$maj_data_directory/items/$maj_req_entry/categories")) {
- while (($cat = readdir($dh_cat)) !== false) {
- if ($cat != "." && $cat != "..") {
- if (file_exists("$maj_data_directory/categories/$cat/private.txt")) {
- $pvt_cat = $pvt_cat + 1;
- }
- }
- }
- closedir($dh_cat);
- }
- }
- if (($pvt_cat > 0) and !file_exists("$maj_data_directory/items/$maj_req_entry/cat.txt")) {
- continue;
- }
- if ((file_exists("$maj_data_directory/items/$maj_req_entry/members") and !isset($maj_logged_in_username)) or (isset($maj_logged_in_username) and !file_exists("$maj_data_directory/items/$maj_req_entry/members/$maj_logged_in_username"))) {
- continue;
- }
- if (file_exists("$maj_data_directory/items/$maj_req_entry/member.txt") and (!isset($maj_logged_in_username))) {
- continue;
- }
- }
- }
- if (!file_exists("$maj_data_directory/panels/$panel/free.txt")) {
- if (file_exists("$maj_data_directory/panels/$panel/border.txt")) {
- $panel_border = file_get_contents("$maj_data_directory/panels/$panel/border.txt");
- }
- else {
- if (isset($panel_border)) {
- unset($panel_border);
- }
- }
- if (file_exists("$maj_data_directory/panels/$panel/bgcolor-t.txt")) {
- $panel_bgcolor_t = file_get_contents("$maj_data_directory/panels/$panel/bgcolor-t.txt");
- }
- else {
- if (isset($panel_bgcolor_t)) {
- unset($panel_bgcolor_t);
- }
- }
- if (file_exists("$maj_data_directory/panels/$panel/bgcolor-c.txt")) {
- $panel_bgcolor_c = file_get_contents("$maj_data_directory/panels/$panel/bgcolor-c.txt");
- }
- else {
- if (isset($panel_bgcolor_c)) {
- unset($panel_bgcolor_c);
- }
- }
- if (file_exists("$maj_data_directory/panels/$panel/text-t.txt")) {
- $panel_text_t = file_get_contents("$maj_data_directory/panels/$panel/text-t.txt");
- }
- else {
- if (isset($panel_text_t)) {
- unset($panel_text_t);
- }
- }
- if (file_exists("$maj_data_directory/panels/$panel/text-c.txt")) {
- $panel_text_c = file_get_contents("$maj_data_directory/panels/$panel/text-c.txt");
- }
- else {
- if (isset($panel_text_c)) {
- unset($panel_text_c);
- }
- }
- echo "\r\n<div class=\"panel_wrapper\">\r\n\r\n\t<div class=\"panel_title\"";
- if (isset($panel_border) or isset($panel_bgcolor_t) or isset($panel_text_t)) {
- echo ' style="';
- }
- if (isset($panel_bgcolor_t)) {
- echo "background-color: $panel_bgcolor_t;";
- }
- if (isset($panel_text_t)) {
- echo "color: $panel_text_t;";
- }
- if (isset($panel_border)) {
- echo "border-color: $panel_border;";
- }
- if (isset($panel_border) or isset($panel_bgcolor_t) or isset($panel_text_t)) {
- echo '"';
- }
- echo ">";
- readfile("$maj_data_directory/panels/$panel/title.txt");
- if (isset($maj_logged_in_username) and ($maj_logged_in_username == $maj_admin_username)) {
- echo "<a href=\"panels.php#{$panel}\">";
- echo '<img src="images/widget.edit.png" border="0" width="11" height="11" align="right"></a>';
- }
- if (file_exists("$maj_data_directory/panels/$panel/private.txt")) {
- echo '<img src="images/widget.private.png" border="0" width="11" height="11" align="right">';
- }
- echo "</div>";
- echo "\r\n\r\n\t<div class=\"panel_body\"";
- if (isset($panel_border) or isset($panel_bgcolor_c) or isset($panel_text_c)) {
- echo ' style="';
- }
- if (isset($panel_bgcolor_c)) {
- echo "background-color: $panel_bgcolor_c;";
- }
- if (isset($panel_text_c)) {
- echo "color: $panel_text_c;";
- }
- if (isset($panel_border)) {
- echo "border-color: $panel_border;";
- }
- if (isset($panel_border) or isset($panel_bgcolor_c) or isset($panel_text_c)) {
- echo '"';
- }
- echo ">\r\n\t\t";
- }
- if (file_exists("$maj_data_directory/panels/$panel/free.txt")) {
- echo '<div class=panel_free>';
- }
- include("$maj_data_directory/panels/$panel/panel.php");
- echo "\r\n\t</div>\r\n</div>\r\n";
- if (file_exists("$maj_data_directory/panels/$panel/free.txt") and !file_exists("$maj_data_directory/panels/$panel/nomargin.txt")) {
- echo "<div style=\"height: {$maj_wspace}px;\"></div>";
- }
- }
- }
- }
- function maj_pending_comments() {
- global $maj_logged_in_username;
- global $maj_admin_username;
- global $maj_data_directory;
- global $maj_count_latest;
- global $maj_font_Spx;
- if (isset($maj_logged_in_username) and ($maj_logged_in_username == $maj_admin_username)) {
- if ($dh_pending_comments = opendir("$maj_data_directory/comments/pending")) {
- while (($entry = readdir($dh_pending_comments)) !== false) {
- if ($entry != "." && $entry != "..") {
- $entries[] = $entry;
- }
- }
- closedir($dh_pending_comments);
- }
- rsort($entries);
- if (($maj_count_latest > 0) and (count($entries) > 0)) {
- echo "<div class=\"panel_wrapper\">";
- echo "<div class=\"panel_title\">Pending Comments</div>";
- echo "<div class=\"panel_body\">";
- foreach ($entries as $entry) {
- echo "<a href=\"index.php?entry=$entry&show=comments#pending\">";
- readfile("$maj_data_directory/items/$entry/title.txt");
- echo "</a><br><font style=\"font-size: $maj_font_Spx; color: #999999;\">";
- $count = file_get_contents("$maj_data_directory/comments/pending/$entry/count.txt");
- if ($count == 1) {
- echo " ($count comment) ";
- }
- elseif ($count > 1) {
- echo " ($count comments) ";
- }
- else {
- echo "";
- }
- echo "</font><br>";
- }
- }
- echo "</div>";
- echo "</div>";
- }
- }
- function maj_unread_comments() {
- global $maj_data_directory;
- global $maj_logged_in_username;
- global $maj_admin_username;
- if (!file_exists("$maj_data_directory/xucomment.txt") and isset($maj_logged_in_username)) {
- if ($maj_logged_in_username == $maj_admin_username) {
- if (file_exists("$maj_data_directory/comments/unread") and (count(glob("$maj_data_directory/comments/unread/*")) > 0)) {
- if ($dh_unread_comments = opendir("$maj_data_directory/comments/unread")) {
- while (($comment = readdir($dh_unread_comments)) !== false) {
- if ($comment != "." && $comment != "..") {
- if (!file_exists("$maj_data_directory/items/$comment")) {
- rmdirr("$maj_data_directory/comments/unread/$comment");
- }
- else {
- $comments[] = $comment;
- }
- }
- }
- closedir($dh_unread_comments);
- }
- }
- }
- else {
- if (file_exists("$maj_data_directory/members/active/$maj_logged_in_username")) {
- if (file_exists("$maj_data_directory/members/active/$maj_logged_in_username/comments/unread") and (count(glob("$maj_data_directory/members/active/$maj_logged_in_username/comments/unread/*")) > 0)) {
- if ($dh_unread_comments = opendir("$maj_data_directory/members/active/$maj_logged_in_username/comments/unread")) {
- while (($comment = readdir($dh_unread_comments)) !== false) {
- if ($comment != "." && $comment != "..") {
- if (!file_exists("$maj_data_directory/items/$comment")) {
- rmdirr("$maj_data_directory/members/active/$maj_logged_in_username/comments/unread/$comment");
- }
- else {
- $comments[] = $comment;
- }
- }
- }
- closedir($dh_unread_comments);
- }
- }
- }
- }
- sort($comments);
- if (count($comments) > 0) {
- echo "<div class=\"panel_wrapper\">";
- echo "<div class=\"panel_title\">";
- echo "<a href=\"del.php?target=unread\"><img src=\"images/widget.del.png\" border=\"0\" width=\"11\" height=\"11\" align=\"right\"></a>";
- echo "Unread Comments";
- echo "</div>";
- echo "<div class=\"panel_body\">";
- echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">";
- foreach ($comments as $comment) {
- $title = file_get_contents("$maj_data_directory/items/$comment/title.txt");
- echo "<tr><td><a class=\"navlink\" href=\"index.php?entry=$comment&show=comments\">$title</a></td></tr>";
- }
- echo "</table>";
- echo "</div>";
- echo "</div>";
- }
- }
- }
- function maj_pending_members() {
- global $maj_logged_in_username;
- global $maj_admin_username;
- global $maj_data_directory;
- if (isset($maj_logged_in_username) and ($maj_logged_in_username == $maj_admin_username) and file_exists("$maj_data_directory/members/confirmed") and !file_exists("$maj_data_directory/xapp.txt") and file_exists("$maj_data_directory/bb.txt") and file_exists("$maj_data_directory/reg.txt")) {
- if ($dh_members = opendir("$maj_data_directory/members/confirmed")) {
- while (($member = readdir($dh_members)) !== false) {
- if ($member != "." && $member != "..") {
- $members[] = $member;
- }
- }
- closedir($dh_members);
- }
- sort($members);
- $count = count($members);
- if ($count > 0) {
- echo "<div class=\"panel_wrapper\">";
- echo "<div class=\"panel_title\">";
- echo "Pending Member";
- if ($count > 1) {
- echo "s";
- }
- echo "</div>";
- echo "<div class=\"panel_body\">";
- echo "Please approve or deny $count pending membership request";
- if ($count > 1) {
- echo "s";
- }
- echo " below.";
- echo "</div>";
- echo "</div>";
- foreach ($members as $member) {
- echo "<div class=\"panel_wrapper\">";
- echo "<div class=\"panel_title\">";
- echo "$member";
- echo "<a href=\"reg.php?username=$member&key=";
- readfile("$maj_data_directory/members/confirmed/$member/key.txt");
- echo "&action=deny\"><img src=\"images/widget.del.png\" border=\"0\" width=\"11\" height=\"11\" align=\"right\" alt=\"deny\"></a>";
- echo "<a href=\"reg.php?username=$member&key=";
- readfile("$maj_data_directory/members/confirmed/$member/key.txt");
- echo "&action=approve\"><img src=\"images/widget.cat.png\" border=\"0\" width=\"11\" height=\"11\" align=\"right\" alt=\"approve\"></a>";
- echo "</div>";
- echo "<div class=\"panel_body\">";
- if (file_exists("$maj_data_directory/members/confirmed/$member/url.txt")) {
- echo "<a href=\"";
- readfile("$maj_data_directory/members/confirmed/$member/url.txt");
- echo "\" target=\"_pending\">";
- }
- readfile("$maj_data_directory/members/confirmed/$member/firstname.txt");
- echo " ";
- readfile("$maj_data_directory/members/confirmed/$member/lastname.txt");
- if (file_exists("$maj_data_directory/members/confirmed/$member/url.txt")) {
- echo "</a>";
- }
- echo "<br>";
- $email = file_get_contents("$maj_data_directory/members/confirmed/$member/email.txt");
- echo $email;
- if (file_exists("$maj_data_directory/members/confirmed/$member/timestamp.txt")) {
- $confirmed = file_get_contents("$maj_data_directory/members/confirmed/$member/timestamp.txt");
- $confirmed_year = mb_substr($confirmed,0,4);
- $confirmed_month = mb_substr($confirmed,4,2);
- $confirmed_day = mb_substr($confirmed,6,2);
- $confirmed_hh = mb_substr($confirmed,8,2);
- $confirmed_mm = mb_substr($confirmed,10,2);
- $email_confirmed = date("d M Y H:i",mktime($confirmed_hh,$confirmed_mm,0,$confirmed_month,$confirmed_day,$confirmed_year));
- echo "<br>$email_confirmed";
- }
- echo "</div>";
- echo "</div>";
- }
- }
- }
- }
- function maj_bb_stats() {
- global $maj_data_directory;
- global $maj_logged_in_username;
- global $maj_admin_username;
- if (file_exists("$maj_data_directory/bb.txt") and file_exists("$maj_data_directory/bb-stats.txt")) {
- echo "<div class=\"panel_wrapper\">";
- echo "<div class=\"panel_title\">Bulletin Board</div>";
- echo "<div class=\"panel_body\">";
- if (file_exists("$maj_data_directory/members/active") and file_exists("$maj_data_directory/bb.txt")) {
- if ($dh_active_members = opendir("$maj_data_directory/members/active")) {
- while (($active_member = readdir($dh_active_members)) !== false) {
- if ($active_member != "." && $active_member != "..") {
- $active_members[] = $active_member;
- }
- }
- closedir($dh_active_members);
- }
- sort($active_members);
- $count_members = count($active_members);
- if ($count_members > 0) {
- echo "Registered Members: $count_members";
- }
- }
- if (file_exists("$maj_data_directory/items")) {
- if ($dh_entries = opendir("$maj_data_directory/items")) {
- while (($entry = readdir($dh_entries)) !== false) {
- if (file_exists("$maj_data_directory/items/$entry/private.txt") and (!isset($maj_logged_in_username) or ($maj_logged_in_username != $maj_admin_username))) {
- continue;
- }
- $private = "0";
- if (file_exists("$maj_data_directory/items/$entry/categories")) {
- if ($dh_categories = opendir("$maj_data_directory/items/$entry/categories")) {
- while (($category = readdir($dh_categories)) !== false) {
- if ($category != "." && $category != "..") {
- if (file_exists("$maj_data_directory/categories/$category/private.txt")) {
- $private = $private + 1;
- }
- }
- }
- closedir($dh_categories);
- }
- }
- if (($private > 0) and (!isset($maj_logged_in_username) or ($maj_logged_in_username != $maj_admin_username)) and !file_exists("$maj_data_directory/items/$entry/cat.txt")) {
- continue;
- }
- if ($entry != "." && $entry != "..") {
- $entry = mb_substr("$entry",0,6);
- $entries[] = $entry;
- }
- }
- closedir($dh_entries);
- }
- rsort($entries);
- $count_entries = count($entries);
- echo "<br>Total Posts: $count_entries";
- unset($entries);
- }
- if (file_exists("$maj_data_directory/bb-new.txt")) {
- $bb_new = file_get_contents("$maj_data_directory/bb-new.txt");
- echo "<br>Newest User: <a href=member.php?id=$bb_new>$bb_new</a>";
- }
- if (file_exists("$maj_data_directory/bb-last.txt")) {
- $bb_last = file_get_contents("$maj_data_directory/bb-last.txt");
- echo "<br>Latest Login: <a href=member.php?id=$bb_last>$bb_last</a>";
- }
- echo "</div></div>";
- }
- }
- function maj_search() {
- global $maj_count_grand;
- global $maj_data_directory;
- global $maj_logged_in_username;
- global $maj_admin_username;
- if (($maj_count_grand > 0) and (!file_exists("$maj_data_directory/xsearch.txt") or ($maj_logged_in_username == $maj_admin_username))) {
- echo "<div class=\"panel_wrapper\"><div class=\"panel_title\">Search</div>";
- echo "<form enctype=\"multipart/form-data\" action=\"dig.php\" method=\"post\">";
- echo "<div class=\"panel_body\">";
- echo "<input type=\"search\" class=\"search\" name=\"search\" autocomplete=\"off\" maxlength=\"55\" required>";
- echo "</form>";
- echo "</div>";
- echo "</div>";
- }
- }
- function maj_find() {
- global $maj_logged_in_username;
- global $maj_admin_username;
- global $maj_data_directory;
- if (isset($maj_logged_in_username) and ($maj_logged_in_username == $maj_admin_username)) {
- echo "<div class=\"panel_wrapper\">";
- echo "<div class=\"panel_title\">Find Entries</div>";
- echo "<div class=panel_body>";
- echo "<a class=\"navlink\" href=\"index.php?find=private\">Private</a>";
- if (file_exists("$maj_data_directory/bb.txt")) {
- echo "<br><a class=\"navlink\" href=\"index.php?find=member\">Members-Only</a>";
- }
- echo "<br><a class=\"navlink\" href=\"index.php?find=unfiled\">Unfiled</a>";
- echo "<br><a class=\"navlink\" href=\"index.php?find=passwd\">Password Protected</a>";
- echo "<br><a class=\"navlink\" href=\"index.php?find=comments\">With Comments</a>";
- echo "<br><a class=\"navlink\" href=\"index.php?find=filedrop\">With Attached Files</a>";
- echo "<br><a class=\"navlink\" href=\"index.php?find=album\">With Photo Album</a>";
- echo "</div>";
- echo "</div>";
- }
- }
- function maj_categories() {
- global $maj_data_directory;
- global $maj_logged_in_username;
- global $maj_admin_username;
- if (file_exists("$maj_data_directory/categories")) {
- if ($dh_categories = opendir("$maj_data_directory/categories")) {
- while (($cat = readdir($dh_categories)) !== false) {
- if (file_exists("$maj_data_directory/xcat.txt") and (!isset($maj_logged_in_username) or ($maj_logged_in_username != $maj_admin_username))) {
- continue;
- }
- if (file_exists("$maj_data_directory/categories/$cat/private.txt") and (!isset($maj_logged_in_username) or ($maj_logged_in_username != $maj_admin_username))) {
- continue;
- }
- if ($cat != "." && $cat != "..") {
- $categories[] = $cat;
- }
- }
- closedir($dh_categories);
- }
- sort($categories);
- if (count($categories) > 0) {
- echo "<div class=\"panel_wrapper\">";
- echo "<div class=\"panel_title\">Categories</div>";
- echo "<div class=\"panel_body\">";
- foreach ($categories as $category) {
- echo "<a class=\"navlink\" href=\"index.php?category=$category\">";
- if (file_exists("$maj_data_directory/categories/$category/title.txt")) {
- $title = file_get_contents("$maj_data_directory/categories/$category/title.txt");
- }
- else {
- $title = ucfirst(str_replace("_"," ",$category));
- }
- echo "$title</a><br>";
- }
- echo "</div>";
- echo "</div>";
- }
- }
- }
- function maj_statistics() {
- global $maj_logged_in_username;
- global $maj_admin_username;
- global $maj_count_latest;
- global $maj_data_directory;
- if (isset($maj_logged_in_username) and ($maj_logged_in_username == $maj_admin_username)) {
- echo "<div class=\"panel_wrapper\">";
- echo "<div class=\"panel_title\">Statistics</div>";
- echo "<div class=\"panel_body\">";
- echo "Total Entries: $maj_count_latest";
- if (file_exists("$maj_data_directory/hits.txt")) {
- echo "<br>Site Hits: ";
- readfile("$maj_data_directory/hits.txt");
- }
- if (file_exists("$maj_data_directory/google.txt")) {
- echo "<br>Google Visits: ";
- readfile("$maj_data_directory/google.txt");
- }
- if (file_exists("$maj_data_directory/rss-0.91.txt")) {
- echo "<br>RSS 0.91 Hits: ";
- readfile("$maj_data_directory/rss-0.91.txt");
- }
- if (file_exists("$maj_data_directory/rss-1.0.txt")) {
- echo "<br>RSS 1.0 Hits: ";
- readfile("$maj_data_directory/rss-1.0.txt");
- }
- if (file_exists("$maj_data_directory/rss-2.0.txt")) {
- echo "<br>RSS 2.0 Hits: ";
- readfile("$maj_data_directory/rss-2.0.txt");
- }
- if (file_exists("$maj_data_directory/sitemap.txt")) {
- echo "<br>Sitemap Requests: ";
- readfile("$maj_data_directory/sitemap.txt");
- }
- echo "</div>";
- echo "</div>";
- }
- }
- function maj_recent() {
- global $maj_latest;
- global $maj_count_latest;
- global $maj_increase;
- global $maj_data_directory;
- global $maj_logged_in_username;
- global $maj_admin_username;
- if (($maj_count_latest > 0) and ($maj_count_latest > $maj_increase) and (!file_exists("$maj_data_directory/xrecent.txt") or ($maj_logged_in_username == $maj_admin_username))) {
- echo "<div class=\"panel_wrapper\">";
- echo "<div class=\"panel_title\">Recent Entries</div>";
- echo "<div class=\"panel_body\">";
- $increment = "0";
- if ($maj_count_latest < 10) {
- $maximum = $maj_count_latest;
- }
- else {
- $maximum = "10";
- }
- while ($increment < $maximum) {
- $title = file_get_contents("$maj_data_directory/items/$maj_latest[$increment]/title.txt");
- if (file_exists("$maj_data_directory/items/$maj_latest[$increment]/member.txt") and (!isset($maj_logged_in_username))) {
- echo "$title";
- }
- else {
- echo "<a class=\"navlink\" href=\"index.php?entry=$maj_latest[$increment]\">$title</a>";
- }
- echo "<br>";
- $increment = $increment + 1;
- }
- echo '</div></div>';
- }
- }
- function maj_albums() {
- global $maj_albums;
- global $maj_data_directory;
- global $maj_logged_in_username;
- global $maj_admin_username;
- if ((count($maj_albums) > 0) and (!file_exists("$maj_data_directory/xalbum.txt") or ($maj_logged_in_username == $maj_admin_username))) {
- echo "<div class=\"panel_wrapper\">";
- echo "<div class=\"panel_title\">Albums</div>";
- echo "<div class=\"panel_body\">";
- foreach ($maj_albums as $maj_album) {
- echo "<a class=\"navlink\" href=\"index.php?entry=$maj_album&show=album\">";
- readfile("$maj_data_directory/items/$maj_album/title.txt");
- echo "</a><br>";
- }
- echo "</div>";
- echo "</div>";
- }
- }
- function maj_random() {
- global $maj_data_directory;
- global $maj_logged_in_username;
- global $maj_admin_username;
- global $maj_random;
- global $maj_count_random;
- if (!file_exists("$maj_data_directory/xrand.txt") or ($maj_logged_in_username == $maj_admin_username)) {
- shuffle($maj_random);
- if (file_exists("$maj_data_directory/increase.txt")) {
- $maximum = file_get_contents("$maj_data_directory/increase.txt");
- }
- else {
- $maximum = 5;
- }
- if ($maj_count_random > $maximum) {
- echo "<div class=\"panel_wrapper\">";
- echo "<div class=\"panel_title\">Random Entries</div>";
- echo "<div class=\"panel_body\">";
- $increment = 0;
- if ($maj_count_random <= $maximum * 2) {
- $show = $maj_count_random - 1;
- }
- else {
- $show = $maximum * 2 - 1;
- }
- while ($increment <= $show) {
- echo "<a class=\"navlink\" href=\"index.php?entry={$maj_random[$increment]}\">";
- readfile("$maj_data_directory/items/$maj_random[$increment]/title.txt");
- echo "</a><br>";
- $increment = $increment + 1;
- }
- if ($maj_count_random > $maximum) {
- echo "</div>";
- echo "</div>";
- }
- }
- }
- }
- function maj_archives() {
- global $maj_archives;
- global $maj_count_latest;
- global $maj_increase;
- global $maj_data_directory;
- global $maj_logged_in_username;
- global $maj_admin_username;
- $count = count($maj_archives);
- if (($count > 0) and ($maj_count_latest > $maj_increase) and ($maj_count_latest > 0) and (!file_exists("$maj_data_directory/xarc.txt") or ($maj_logged_in_username == $maj_admin_username))) {
- $entries = implode(" ",$maj_archives);
- $unique = array_unique($maj_archives);
- echo "<div class=\"panel_wrapper\"><div class=\"panel_title\">Archives ($count)</div>";
- echo "<div class=\"panel_body\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">";
- foreach ($unique as $entry) {
- $value = mb_substr($entry,0,6);
- $year = mb_substr($entry,0,4);
- $month = mb_substr($entry,4,2);
- $num = mb_substr_count($entries,$entry);
- echo "<tr><td><a class=\"navlink\" href=\"index.php?archive=$value\"><nobr>$month $year</nobr></a></td><td align=right>$num</td></tr>";
- }
- echo "</table></div></div>";
- }
- }
- function maj_badges() {
- global $maj_count_latest;
- global $maj_data_directory;
- if ($maj_count_latest > 0) {
- $php_version = phpversion();
- echo "<div class=\"mbadge\"><nobr><a class=\"mblink\" target=\"_maj\" href=\"http://majcms.org/\"><span class=\"mbox1\">MAJ</span><span class=\"mbox2\">2.0</span></a></nobr></div>";
- echo "<div class=\"mbadge\"><nobr><a class=\"mblink\" target=\"_maj\" href=\"http://php.net/\"><span class=\"mbox1\">PHP</span><span class=\"mbox2\">$php_version</span></a></nobr></div>";
- if (file_exists("$maj_data_directory/b-rss-0.91.txt")) {
- echo "<div class=\"mbadge\"><nobr><a class=\"mblink\" target=\"_maj\" href=\"rss.php?ver=0.91\"><span class=\"mbox1\">RSS</span><span class=\"mbox2\">0.91</span></a></nobr></div>";
- }
- if (file_exists("$maj_data_directory/b-rss-1.0.txt")) {
- echo "<div class=\"mbadge\"><nobr><a class=\"mblink\" target=\"_maj\" href=\"rss.php?ver=1.0\"><span class=\"mbox1\">RSS</span><span class=\"mbox2\">1.0</span></a></nobr></div>";
- }
- echo "<div class=\"mbadge\"><nobr><a class=\"mblink\" target=\"_maj\" href=\"rss.php?ver=2.0\"><span class=\"mbox1\">RSS</span><span class=\"mbox2\">2.0</span></a></nobr></div>";
- echo "<div class=\"mbadge\"><nobr><a class=\"mblink\" target=\"_maj\" href=\"sitemap.php\"><span class=\"mbox1\">XML</span><span class=\"mbox2\">SITEMAP</span></a></nobr></div>";
- }
- }
- ?>