maj.world

maj.world

Git

This commit has been accessed 484 times via Git panel.

commit 97bfad0e1f5b7e934037d42ef799bdad266b02ad
tree 2331f5a0129ab02c66a710a189257d77cd25892a
parent 67d7367e9cd8915aafdcee5944fa7d31e98527b3
author Engels Antonio <engels@majcms.org> 1277314186 +0800
committer Engels Antonio <engels@majcms.org> 1277314186 +0800

    maj-0.14-20060826.zip

diff --git a/add.php b/add.php
index b12a810..cd6c15a 100644
--- a/add.php
+++ b/add.php
@@ -286,6 +286,7 @@ $max_file_size = 8000000;
        }
 ?>
 <p><input type=checkbox name=sticky>Put entry title in Quick Links box.<br>
+<input type=checkbox name=pdf>Allow PDF generation for this entry.<br>
 <input type=checkbox name=display>Always display. If this is not a private entry, it will be displayed even if its category is hidden or isolated.<br>
 <input type=checkbox name=private>Private entry. This entry will unconditionally be invisible to visitors, even if always display is set.</p>
 
@@ -356,7 +357,6 @@ echo '<p>' . $entry . '<br>' . $timestamp . '<br>' . date("l, M j, Y, g:i A") .
 
 if (!file_exists("data/items")) {
        mkdir("data/items");
-       chmod("data/items", 0777);
 }
 
 $dir = "data/items/";
@@ -364,13 +364,37 @@ $item_dir = $dir . $entry;
 
 if (!file_exists("images")) {
        mkdir("images");
-       chmod("images", 0777);
 }
 
 $image_dir = 'images/' . $entry;
 $file_dir = $item_dir . '/filedrop';
 
+function reformat_html($defang)
+{
+   $store=split("<html>",$defang);
+   $defang="";
+   $defang.=$store[0];
+   foreach($store as $itm=>$refh)
+   {
+       if(eregi("</html>",$refh))
+       {
+           $store1=split("</html>",$refh);
+           $store1[0]=eregi_replace("\n","",$store1[0]);
+           foreach($store1 as $itm1=>$refh1)
+           {
+               if($itm1==0)
+                   $refh1="<!-- html -->$refh1<!-- /html -->";
+               $defang.=$refh1;
+           }
+       }      
+   }
+   return $defang;
+}
+
 $body_write_content = ucfirst($_REQUEST['body_input']);
+$body_write_content = str_replace("[html]", '<html>', $body_write_content);
+$body_write_content = str_replace("[/html]", '</html>', $body_write_content);
+$body_write_content = reformat_html($body_write_content);
 $body_write_content = str_replace("\n", '<br />', $body_write_content);
 $body_write_content = str_replace(':((', '<img src=images/smileys/crying.png border=0>', $body_write_content);
 $body_write_content = str_replace(':(', '<img src=images/smileys/frown.png border=0>', $body_write_content);
@@ -390,20 +414,27 @@ $body_write_content = str_replace('[u]', '<u>', $body_write_content);
 $body_write_content = str_replace('[/u]', '</u>', $body_write_content);
 $body_write_content = str_replace('[strike]', '<strike>', $body_write_content);
 $body_write_content = str_replace('[/strike]', '</strike>', $body_write_content);
-
-mkdir($item_dir, 0777);
-chmod($item_dir, 0777);
+$body_write_content = str_replace('[sup]', '<sup>', $body_write_content);
+$body_write_content = str_replace('[/sup]', '</sup>', $body_write_content);
+$body_write_content = str_replace('[sub]', '<sub>', $body_write_content);
+$body_write_content = str_replace('[/sub]', '</sub>', $body_write_content);
+$body_write_content = str_replace('[code]', '<code>', $body_write_content);
+$body_write_content = str_replace('[/code]', '</code>', $body_write_content);
+$body_write_content = str_replace('[highlight]', '<highlight>', $body_write_content);
+$body_write_content = str_replace('[/highlight]', '</highlight>', $body_write_content);
+$body_write_content = str_replace('<highlight>', '<span style="background-color: #ffff00;">', $body_write_content);
+$body_write_content = str_replace('</highlight>', '</span>', $body_write_content);
+
+mkdir($item_dir);
 
 $title_write_content = ucfirst($_REQUEST['title_input']);
 $title_file = $item_dir . '/title.txt';
 $fp_title_txt = fopen($title_file,"w");
-chmod($title_file, 0666);
 fwrite($fp_title_txt,$title_write_content);
 fclose($fp_title_txt);
 
 $date_file = $item_dir . '/date.txt';
 $fp_date_txt = fopen($date_file,"w");
-chmod($date_file, 0666);
 fwrite($fp_date_txt,$timestamp);
 fclose($fp_date_txt);
 
@@ -416,8 +447,7 @@ if (isset($_FILES['image_input']) and !empty($_FILES['image_input'])) {
                        if (($_FILES['image_input']['type']=="image/gif") || ($_FILES['image_input']['type']=="image/pjpeg") || ($_FILES['image_input']['type']=="image/jpeg") || ($_FILES['image_input']['type']=="image/png")) {
 
                                if (!file_exists($image_dir)) {
-                                       mkdir($image_dir, 0777);
-                                       chmod($image_dir, 0777);
+                                       mkdir($image_dir);
                                }
 
                                if (!file_exists($image_dir . '/' . $_FILES['image_input']['name'])) {
@@ -447,13 +477,11 @@ if (isset($_FILES['file_input']) and !empty($_FILES['file_input'])) {
                if ($_FILES['file_input']['size']<=$max_file_size) {
                        $filedrop_dir = "$item_dir/filedrop";
                        if (!file_exists($filedrop_dir)) {
-                               mkdir($filedrop_dir, 0777);
-                               chmod($filedrop_dir, 0777);
+                               mkdir($filedrop_dir);
                        }
                        $file_dir = "$filedrop_dir/files";
                        if (!file_exists($file_dir)) {
-                               mkdir($file_dir, 0777);
-                               chmod($file_dir, 0777);
+                               mkdir($file_dir);
                        }
                        if (!file_exists($file_dir . '/' . $_FILES['file_input']['name'])) {
                                $res = copy($_FILES['file_input']['tmp_name'], $file_dir . '/' . $_FILES['file_input']['name']);
@@ -463,7 +491,6 @@ if (isset($_FILES['file_input']) and !empty($_FILES['file_input'])) {
                                $fp_file_txt = fopen($file_file,"w");
                                fwrite($fp_file_txt,$file_src);
                                fclose($fp_file_txt);
-                               chmod($file_file, 0666);
                        }
                        else {
                                unlink($_FILES['file_input']['tmp_name']);
@@ -483,7 +510,6 @@ if (isset($_FILES['file_input']) and !empty($_FILES['file_input'])) {
 
 $body_file = $item_dir . '/body.txt';
 $fp_body_txt = fopen($body_file,"w");
-chmod($body_file, 0666);
 
 if (isset($_FILES['image_input']) and !empty($_FILES['image_input'])) {
        if (file_exists($image_dir . '/' . $_FILES['image_input']['name'])) {
@@ -510,12 +536,10 @@ fclose($fp_body_txt);
 $sticky_sem = 'data/sticky/' . $entry;
 if (isset($_REQUEST['sticky']) and !empty($_REQUEST['sticky']) and ($_REQUEST['sticky'] == "on")) {
        if (!file_exists("data/sticky")) {
-               mkdir("data/sticky", 0777);
-               chmod("data/sticky", 0777);
+               mkdir("data/sticky");
        }
        if (!file_exists($sticky_sem)) {
                touch($sticky_sem);
-               chmod($sticky_sem, 0666);
        }
 }
 
@@ -523,7 +547,6 @@ $display_sem = "data/items/$entry/cat.txt";
 if (isset($_REQUEST['display']) and !empty($_REQUEST['display']) and ($_REQUEST['display'] == "on")) {
        if (!file_exists($display_sem)) {
                touch($display_sem);
-               chmod($display_sem, 0666);
        }
 }
 
@@ -531,20 +554,158 @@ $private_sem = "data/items/$entry/private.txt";
 if (isset($_REQUEST['private']) and !empty($_REQUEST['private']) and ($_REQUEST['private'] == "on")) {
        if (!file_exists($private_sem)) {
                touch($private_sem);
-               chmod($private_sem, 0666);
        }
 }
 
+if (isset($_REQUEST['pdf']) and !empty($_REQUEST['pdf']) and ($_REQUEST['pdf'] == "on")) {
+       if (!file_exists("data/items/$entry/pdf")) {
+               mkdir("data/items/$entry/pdf");
+       }
+       if (!file_exists("data/items/$entry/pdf/file")) {
+               mkdir("data/items/$entry/pdf/file");
+       }
+       if (!file_exists("data/items/$entry/pdf/count")) {
+               mkdir("data/items/$entry/pdf/count");
+       }
+
+       $author_file = "data/author.txt";
+       $title_file = "data/items/$entry/title.txt";
+       $date_file = "data/items/$entry/date.txt";
+       $body_file = "data/items/$entry/body.txt";
+
+       $author = file_get_contents($author_file);
+       $title = file_get_contents($title_file);
+       $date = file_get_contents($date_file);
+
+       $link = "<a href=http://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . "?entry=" . $entry . ">http://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . "?entry=" . $entry . "</a>";
+       $link = str_replace("pdf.php?entry=","index.php?entry=",$link);
+
+       $body = file_get_contents($body_file);
+       $body = str_replace("\n","<br>",$body);
+
+       $html = "<br><i>by $author</i><br><br>$date<br><br>Canonical Source<br>$link<br><br><br>$body";
+
+       $filename = strtolower($title);
+       $filename = strtolower($_SERVER['SERVER_NAME']) . "-" . $entry . "-" . $filename . ".pdf";
+       $filename = str_replace(" ","-",$filename);
+       $filename = "data/items/$entry/pdf/file/$filename";
+
+       require('fpdf.php');
+
+       class PDF extends FPDF
+       {
+               var $B;
+               var $I;
+               var $U;
+               var $HREF;
+              
+               function PDF($orientation='P',$unit='mm',$format='letter')
+               {
+                   //Call parent constructor
+                   $this->FPDF($orientation,$unit,$format);
+                   //Initialization
+                   $this->B=0;
+                   $this->I=0;
+                   $this->U=0;
+                   $this->HREF='';
+               }
+      
+               function WriteHTML($html)
+               {
+                   //HTML parser
+                   $html=str_replace("\n",' ',$html);
+                   $a=preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE);
+                   foreach($a as $i=>$e)
+                   {
+                       if($i%2==0)
+                       {
+                           //Text
+                           if($this->HREF)
+                               $this->PutLink($this->HREF,$e);
+                           else
+                               $this->Write(5,$e);
+                       }
+                       else
+                       {
+                           //Tag
+                           if($e{0}=='/')
+                               $this->CloseTag(strtoupper(substr($e,1)));
+                           else
+                           {
+                               //Extract attributes
+                               $a2=explode(' ',$e);
+                               $tag=strtoupper(array_shift($a2));
+                               $attr=array();
+                               foreach($a2 as $v)
+                                   if(ereg('^([^=]*)=["\']?([^"\']*)["\']?$',$v,$a3))
+                                       $attr[strtoupper($a3[1])]=$a3[2];
+                               $this->OpenTag($tag,$attr);
+                           }
+                       }
+                   }
+               }
+              
+               function OpenTag($tag,$attr)
+               {
+                   //Opening tag
+                   if($tag=='B' or $tag=='I' or $tag=='U')
+                       $this->SetStyle($tag,true);
+                   if($tag=='A')
+                       $this->HREF=$attr['HREF'];
+                   if($tag=='BR')
+                       $this->Ln(5);
+               }
+              
+               function CloseTag($tag)
+               {
+                   //Closing tag
+                   if($tag=='B' or $tag=='I' or $tag=='U')
+                       $this->SetStyle($tag,false);
+                   if($tag=='A')
+                       $this->HREF='';
+               }
+              
+               function SetStyle($tag,$enable)
+               {
+                   //Modify style and select corresponding font
+                   $this->$tag+=($enable ? 1 : -1);
+                   $style='';
+                   foreach(array('B','I','U') as $s)
+                       if($this->$s>0)
+                           $style.=$s;
+                   $this->SetFont('',$style);
+               }
+              
+               function PutLink($URL,$txt)
+               {
+                   //Put a hyperlink
+                   $this->SetTextColor(0,0,255);
+                   $this->SetStyle('U',true);
+                   $this->Write(5,$txt,$URL);
+                   $this->SetStyle('U',false);
+                   $this->SetTextColor(0);
+               }
+       }
+
+       $pdf=new PDF();
+       $pdf->AddPage();
+       $pdf->SetTitle($title);
+       $pdf->SetAuthor($author);
+       $pdf->SetFont('Helvetica','B',14);
+       $pdf->WriteHTML($title);
+       $pdf->SetFont('Helvetica','',10);
+       $pdf->WriteHTML($html);
+       $pdf->Output($filename);
+}
+
 if (isset($_REQUEST['category']) and !empty($_REQUEST['category'])) {
        if (!file_exists("data/categories")) {
-               mkdir("data/categories", 0777);
-               chmod("data/categories", 0777);
+               mkdir("data/categories");
        }
        if (file_exists("data/categories/{$_REQUEST['category']}")) {
                $fp_category_txt = fopen("data/items/$entry/category.txt","w");
                fwrite($fp_category_txt, $_REQUEST['category']);
                fclose($fp_category_txt);
-               chmod("data/items/$entry/category.txt", 0666);
        }
 }
 
@@ -559,7 +720,6 @@ if (isset($_REQUEST['passwd']) and !empty($_REQUEST['passwd'])) {
                $passwd_crypt = crypt($passwd_crypt, $passwd_crypt);
                fwrite($fp_passwd_txt, $passwd_crypt);
                fclose($fp_passwd_txt);
-               chmod("data/items/$entry/passwd.txt", 0666);
        }
 }
 
@@ -570,7 +730,6 @@ if (!file_exists($ping_urls_file)) {
        $fp_default_ping_txt = fopen($ping_urls_file,"w");
        fwrite($fp_default_ping_txt, $default_ping_urls);
        fclose($fp_default_ping_txt);
-       chmod($ping_urls_file, 0666);
 }
 
 $fp_ping_urls = fopen($ping_urls_file, "r");
@@ -586,7 +745,6 @@ foreach ($get_ping_urls as $ping_url) {
        //$fp_ping_urls_add_txt = fopen($ping_urls_add_file,"w");
        //fwrite($fp_ping_urls_add_txt, $ping);
        //fclose($fp_ping_urls_add_txt);
-       //chmod($ping_urls_add_file, 0666);
 
        clear($ping);
 }
diff --git a/cat.php b/cat.php
index 0227269..08733cc 100644
--- a/cat.php
+++ b/cat.php
@@ -37,13 +37,13 @@ function rmdirr($recurse_dirname)
 if (isset($_REQUEST['new_id']) and !empty($_REQUEST['new_id'])) {
 
        if (!file_exists("data/categories")) {
-               mkdir("data/categories", 0777);
+               mkdir("data/categories");
        }
 
        $new_id = trim(strip_tags(strtolower(str_replace(" ", "_", $_REQUEST['new_id']))));
 
        if (!file_exists("data/categories/$new_id")) {
-               mkdir("data/categories/$new_id", 0777);
+               mkdir("data/categories/$new_id");
        }
 
        if (isset($_REQUEST['new_title']) and !empty($_REQUEST['new_title'])) {
@@ -51,7 +51,6 @@ if (isset($_REQUEST['new_id']) and !empty($_REQUEST['new_id'])) {
                $open_title_file = fopen("data/categories/$new_id/title.txt","w");
                fwrite($open_title_file,$new_title);
                fclose($open_title_file);
-               chmod("data/categories/$new_id/title.txt", 0666);
        }
 }
 
@@ -68,7 +67,6 @@ if ((!isset($_REQUEST['cat_hide']) or !empty($_REQUEST['cat_hide'])) and ($_REQU
 if (isset($_REQUEST['cat_hide']) and !empty($_REQUEST['cat_hide']) and ($_REQUEST['cat_hide'] == "on")) {
        if (!file_exists("data/categories/{$_REQUEST['cat_id']}/private.txt")) {
                touch("data/categories/{$_REQUEST['cat_id']}/private.txt");
-               chmod("data/categories/{$_REQUEST['cat_id']}/private.txt", 0666);
        }
 }
 
@@ -81,7 +79,6 @@ if ((!isset($_REQUEST['cat_book']) or !empty($_REQUEST['cat_book'])) and ($_REQU
 if (isset($_REQUEST['cat_book']) and !empty($_REQUEST['cat_book']) and ($_REQUEST['cat_book'] == "on")) {
        if (!file_exists("data/categories/{$_REQUEST['cat_id']}/book.txt")) {
                touch("data/categories/{$_REQUEST['cat_id']}/book.txt");
-               chmod("data/categories/{$_REQUEST['cat_id']}/book.txt", 0666);
        }
 }
 
@@ -93,7 +90,6 @@ if (isset($_REQUEST['cat_title']) and !empty($_REQUEST['cat_title'])) {
                $edit_title_file = fopen("data/categories/{$_REQUEST['cat_id']}/title.txt","w");
                fwrite($edit_title_file,$cat_title);
                fclose($edit_title_file);
-               chmod("data/categories/{$_REQUEST['cat_id']}/title.txt", 0666);
        }
 }
 
diff --git a/colors.php b/colors.php
index 8a62e29..0ce9dfc 100644
--- a/colors.php
+++ b/colors.php
@@ -16,8 +16,7 @@ else {
 }
 
 if (!file_exists("data/colors")) {
-       mkdir("data/colors", 0777);
-       chmod("data/colors", 0777);
+       mkdir("data/colors");
 }
 
 if (isset($_REQUEST['reset']) and ($_REQUEST['reset'] == "go")) {
@@ -69,7 +68,6 @@ if (isset($_REQUEST['target']) and !empty($_REQUEST['target']) and isset($_REQUE
                $color_file = str_replace("_", "-", $_REQUEST['target']);
                $color_file = "data/colors/{$color_file}.txt";
                $color_txt = fopen($color_file,"w");
-               chmod($color_file, 0666);
                fwrite($color_txt,$color_value);
                fclose($color_txt);
        }
diff --git a/del.php b/del.php
index e6bf2fe..6c6740d 100644
--- a/del.php
+++ b/del.php
@@ -45,6 +45,11 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username
                        rmdirr($filedrop_data_dir);
                        header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '?entry=' . $_REQUEST['entry']);
                }
+               if ($_REQUEST['target'] == "pdf") {
+                       $pdf_data_dir = 'data/items/' . $_REQUEST['entry'] . '/pdf/file';
+                       rmdirr($pdf_data_dir);
+                       header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '?entry=' . $_REQUEST['entry']);
+               }
        }
        if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['comment']) and !empty($_REQUEST['comment']) and isset($_REQUEST['type']) and !empty($_REQUEST['type'])) {
                $comment_dir = 'data/items/' . $_REQUEST['entry'] .'/comments/' . $_REQUEST['type'] . '/' . $_REQUEST['comment'];
diff --git a/edit.php b/edit.php
index 3f919d9..3beb47f 100644
--- a/edit.php
+++ b/edit.php
@@ -173,7 +173,6 @@ if (isset($_REQUEST['comment']) and !empty($_REQUEST['comment']) and isset($_REQ
        $open_comment_txt_file = fopen($comment_txt_file,"w");
        fwrite($open_comment_txt_file,$comment_txt);
        fclose($open_comment_txt_file);
-       chmod($comment_txt_file, 0666);
 
        $comment_revisions_file = "data/items/{$_REQUEST['entry']}/comments/live/{$_REQUEST['comment']}/revisions.txt";
        $fp_comment_revisions_file = fopen($comment_revisions_file, "r");
@@ -183,7 +182,6 @@ if (isset($_REQUEST['comment']) and !empty($_REQUEST['comment']) and isset($_REQ
        $fp_comment_revisions_file = fopen($comment_revisions_file, "w");
        fwrite($fp_comment_revisions_file, $comment_revisions_count);
        fclose($fp_comment_revisions_file);
-       chmod($comment_revisions_file, 0666);
 
 }
 
@@ -345,6 +343,7 @@ else {
        }
 ?>
 <p><input type=checkbox name=sticky <?php $sticky_sem = 'data/sticky/' . $_REQUEST['entry']; if (file_exists($sticky_sem)) { echo checked; } ?>>Put entry title in Quick Links box.<br>
+<input type=checkbox name=pdf <?php if (file_exists("data/items/{$_REQUEST['entry']}/pdf/file")) { echo checked; } ?>>Allow PDF generation for this entry.<br>
 <input type=checkbox name=display <?php $display_sem = "data/items/{$_REQUEST['entry']}/cat.txt"; if (file_exists($display_sem)) { echo checked; } ?>>Always display. If this is not a private entry, it will be displayed even if its category is hidden or isolated.<br>
 <input type=checkbox name=private <?php $private_sem = "data/items/{$_REQUEST['entry']}/private.txt"; if (file_exists($private_sem)) { echo checked; } ?>>Private entry. This entry will unconditionally be invisible to visitors, even if always display is set.</p>
 <input type=hidden name=entry value="<?php echo $_REQUEST['entry']; ?>">
@@ -371,6 +370,10 @@ $body_read_content = str_replace('<img src=images/smileys/smile.png border=0>',
 $body_read_content = str_replace('<img src=images/smileys/surprised.png border=0>', '=)', $body_read_content);
 $body_read_content = str_replace('<img src=images/smileys/undecided.png border=0>', ':\\', $body_read_content);
 $body_read_content = str_replace('<img src=images/smileys/wink.png border=0>', ';)', $body_read_content);
+$body_read_content = str_replace('<!-- html -->', '<html>', $body_read_content);
+$body_read_content = str_replace('<!-- /html -->', '</html>', $body_read_content);
+$body_read_content = str_replace('<span style="background-color: #ffff00;">', '<highlight>', $body_read_content);
+$body_read_content = str_replace('</span>', '</highlight>', $body_read_content);
 
 echo $body_read_content;
 
@@ -413,10 +416,34 @@ $title_write_content = ucfirst($_REQUEST['title_input']);
 $open_title_file = fopen($title_file,"w");
 fwrite($open_title_file,$title_write_content);
 fclose($open_title_file);
-chmod($title_file, 0666);
+
+function reformat_html($defang)
+{
+   $store=split("<html>",$defang);
+   $defang="";
+   $defang.=$store[0];
+   foreach($store as $itm=>$refh)
+   {
+       if(eregi("</html>",$refh))
+       {
+           $store1=split("</html>",$refh);
+           $store1[0]=eregi_replace("\n","",$store1[0]);
+           foreach($store1 as $itm1=>$refh1)
+           {
+               if($itm1==0)
+                   $refh1="<!-- html -->$refh1<!-- /html -->";
+               $defang.=$refh1;
+           }
+       }      
+   }
+   return $defang;
+}
 
 $body_write_content = ucfirst($_REQUEST['body_input']);
-$body_write_content = str_replace( "\n", '<br />', $body_write_content);
+$body_write_content = str_replace("[html]", '<html>', $body_write_content);
+$body_write_content = str_replace("[/html]", '</html>', $body_write_content);
+$body_write_content = reformat_html($body_write_content);
+$body_write_content = str_replace("\n", '<br />', $body_write_content);
 $body_write_content = str_replace(':((', '<img src=images/smileys/crying.png border=0>', $body_write_content);
 $body_write_content = str_replace(':(', '<img src=images/smileys/frown.png border=0>', $body_write_content);
 $body_write_content = str_replace(':|', '<img src=images/smileys/indifferent.png border=0>', $body_write_content);
@@ -435,6 +462,16 @@ $body_write_content = str_replace('[u]', '<u>', $body_write_content);
 $body_write_content = str_replace('[/u]', '</u>', $body_write_content);
 $body_write_content = str_replace('[strike]', '<strike>', $body_write_content);
 $body_write_content = str_replace('[/strike]', '</strike>', $body_write_content);
+$body_write_content = str_replace('[sup]', '<sup>', $body_write_content);
+$body_write_content = str_replace('[/sup]', '</sup>', $body_write_content);
+$body_write_content = str_replace('[sub]', '<sub>', $body_write_content);
+$body_write_content = str_replace('[/sub]', '</sub>', $body_write_content);
+$body_write_content = str_replace('[code]', '<code>', $body_write_content);
+$body_write_content = str_replace('[/code]', '</code>', $body_write_content);
+$body_write_content = str_replace('[highlight]', '<highlight>', $body_write_content);
+$body_write_content = str_replace('[/highlight]', '</highlight>', $body_write_content);
+$body_write_content = str_replace('<highlight>', '<span style="background-color: #ffff00;">', $body_write_content);
+$body_write_content = str_replace('</highlight>', '</span>', $body_write_content);
 
 $fp_revisions_file = fopen($revisions_file, "r");
 $revisions_count = fread($fp_revisions_file, filesize($revisions_file));
@@ -443,7 +480,6 @@ $revisions_count = $revisions_count + 1;
 $fp_revisions_file = fopen($revisions_file, "w");
 fwrite($fp_revisions_file, $revisions_count);
 fclose($fp_revisions_file);
-chmod($revisions_file, 0666);
 
 if (isset($_FILES['album_image_input']) and !empty($_FILES['album_image_input'])) {
 
@@ -457,40 +493,33 @@ if (isset($_FILES['album_image_input']) and !empty($_FILES['album_image_input'])
 
                                        $image_dir = $image_path . $_REQUEST['entry'];
                                        if (!file_exists($image_dir)) {
-                                               mkdir($image_dir, 0777);
-                                               chmod($image_dir, 0777);
+                                               mkdir($image_dir);
                                        }
                                        $album_dir = $image_path . $_REQUEST['entry'] . '/album';
                                        if (!file_exists($album_dir)) {
-                                               mkdir($album_dir, 0777);
-                                               chmod($album_dir, 0777);
+                                               mkdir($album_dir);
                                        }
                                        $album_sem = 'data/albums/' . $_REQUEST['entry'];
                                        if (!file_exists("data/albums")) {
-                                               mkdir("data/albums", 0777);
-                                               chmod("data/albums", 0777);
+                                               mkdir("data/albums");
                                        }
                                        if (!file_exists($album_sem)) {
-                                               mkdir($album_sem, 0777);
-                                               chmod($album_sem, 0777);
+                                               mkdir($album_sem);
                                        }
                                        if (isset($_REQUEST['caption']) and !empty($_REQUEST['caption'])) {
                                                $album_data_dir = 'data/items/' . $_REQUEST['entry'] . '/album';
                                                if (!file_exists($album_data_dir)) {
-                                                       mkdir($album_data_dir, 0777);
-                                                       chmod($album_data_dir, 0777);
+                                                       mkdir($album_data_dir);
                                                }
                                                $caption_dir = 'data/items/' . $_REQUEST['entry'] . '/album/captions';
                                                if (!file_exists($caption_dir)) {
-                                                       mkdir($caption_dir, 0777);
-                                                       chmod($caption_dir, 0777);
+                                                       mkdir($caption_dir);
                                                }
                                                $caption_file = 'data/items/' . $_REQUEST['entry'] . '/album/captions/' . $_FILES['album_image_input']['name'] . '.txt';
                                                if (!file_exists($caption_file)) {
                                                        $fp_caption_txt = fopen($caption_file,"w");
                                                        fwrite($fp_caption_txt,$_REQUEST['caption']);
                                                        fclose($fp_caption_txt);
-                                                       chmod($caption_file, 0666);
                                                }
                                        }
 
@@ -531,8 +560,7 @@ if (isset($_FILES['entry_image_input']) and !empty($_FILES['entry_image_input'])
 
                                        $image_dir = $image_path . $_REQUEST['entry'];
                                        if (!file_exists($image_dir)) {
-                                               mkdir($image_dir, 0777);
-                                               chmod($image_dir, 0777);
+                                               mkdir($image_dir);
                                        }
 
                                        $res = copy($_FILES['entry_image_input']['tmp_name'], $image_path . $_REQUEST['entry'] . '/' . $_FILES['entry_image_input']['name']);
@@ -575,13 +603,11 @@ if (isset($_FILES['file_input']) and !empty($_FILES['file_input'])) {
                if ($_FILES['file_input']['size']<=$max_file_size) {
                        $filedrop_dir = 'data/items/' . $_REQUEST['entry'] . '/filedrop';
                        if (!file_exists($filedrop_dir)) {
-                               mkdir($filedrop_dir, 0777);
-                               chmod($filedrop_dir, 0777);
+                               mkdir($filedrop_dir);
                        }
                        $file_dir = 'data/items/' . $_REQUEST['entry'] . '/filedrop/files';
                        if (!file_exists($file_dir)) {
-                               mkdir($file_dir, 0777);
-                               chmod($file_dir, 0777);
+                               mkdir($file_dir);
                        }
                        if (!file_exists($file_dir . '/' . $_FILES['file_input']['name'])) {
                                $res = copy($_FILES['file_input']['tmp_name'], $file_dir . '/' . $_FILES['file_input']['name']);
@@ -591,7 +617,6 @@ if (isset($_FILES['file_input']) and !empty($_FILES['file_input'])) {
                                $fp_file_txt = fopen($file_file,"w");
                                fwrite($fp_file_txt,$file_src);
                                fclose($fp_file_txt);
-                               chmod($file_file, 0666);
                        }
                        else {
                                unlink($_FILES['file_input']['tmp_name']);
@@ -609,17 +634,14 @@ if (isset($_FILES['file_input']) and !empty($_FILES['file_input'])) {
 $open_body_file = fopen($body_file,"w");
 fwrite($open_body_file,$body_write_content);
 fclose($open_body_file);
-chmod($body_file, 0666);
 
 $sticky_sem = 'data/sticky/' . $_REQUEST['entry'];
 if (isset($_REQUEST['sticky']) and !empty($_REQUEST['sticky']) and ($_REQUEST['sticky'] == "on")) {
        if (!file_exists("data/sticky")) {
-               mkdir("data/sticky", 0777);
-               chmod("data/sticky", 0777);
+               mkdir("data/sticky");
        }
        if (!file_exists($sticky_sem)) {
                touch($sticky_sem);
-               chmod($sticky_sem, 0666);
        }
 }
 if (!isset($_REQUEST['sticky']) or empty($_REQUEST['sticky'])) {
@@ -632,7 +654,6 @@ $display_sem = "data/items/{$_REQUEST['entry']}/cat.txt";
 if (isset($_REQUEST['display']) and !empty($_REQUEST['display']) and ($_REQUEST['display'] == "on")) {
        if (!file_exists($display_sem)) {
                touch($display_sem);
-               chmod($display_sem, 0666);
        }
 }
 if (!isset($_REQUEST['display']) or empty($_REQUEST['display'])) {
@@ -645,7 +666,6 @@ $private_sem = "data/items/{$_REQUEST['entry']}/private.txt";
 if (isset($_REQUEST['private']) and !empty($_REQUEST['private']) and ($_REQUEST['private'] == "on")) {
        if (!file_exists($private_sem)) {
                touch($private_sem);
-               chmod($private_sem, 0666);
        }
 }
 if (!isset($_REQUEST['private']) or empty($_REQUEST['private'])) {
@@ -654,10 +674,157 @@ if (!isset($_REQUEST['private']) or empty($_REQUEST['private'])) {
        }
 }
 
+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");
+       }
+       if (!file_exists("data/items/{$_REQUEST['entry']}/pdf/file")) {
+               mkdir("data/items/{$_REQUEST['entry']}/pdf/file");
+       }
+       if (!file_exists("data/items/{$_REQUEST['entry']}/pdf/count")) {
+               mkdir("data/items/{$_REQUEST['entry']}/pdf/count");
+       }
+
+       $entry = $_REQUEST['entry'];
+       $author_file = "data/author.txt";
+       $title_file = "data/items/$entry/title.txt";
+       $date_file = "data/items/$entry/date.txt";
+       $body_file = "data/items/$entry/body.txt";
+
+       $author = file_get_contents($author_file);
+       $title = file_get_contents($title_file);
+       $date = file_get_contents($date_file);
+
+       $link = "<a href=http://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . "?entry=" . $entry . ">http://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . "?entry=" . $entry . "</a>";
+       $link = str_replace("pdf.php?entry=","index.php?entry=",$link);
+
+       $body = file_get_contents($body_file);
+       $body = str_replace("\n","<br>",$body);
+
+       $html = "<br><i>by $author</i><br><br>$date<br><br>Canonical Source<br>$link<br><br><br>$body";
+
+       $filename = strtolower($title);
+       $filename = strtolower($_SERVER['SERVER_NAME']) . "-" . $entry . "-" . $filename . ".pdf";
+       $filename = str_replace(" ","-",$filename);
+       $filename = "data/items/$entry/pdf/file/$filename";
+
+       require('fpdf.php');
+
+       class PDF extends FPDF
+       {
+               var $B;
+               var $I;
+               var $U;
+               var $HREF;
+              
+               function PDF($orientation='P',$unit='mm',$format='letter')
+               {
+                   //Call parent constructor
+                   $this->FPDF($orientation,$unit,$format);
+                   //Initialization
+                   $this->B=0;
+                   $this->I=0;
+                   $this->U=0;
+                   $this->HREF='';
+               }
+      
+               function WriteHTML($html)
+               {
+                   //HTML parser
+                   $html=str_replace("\n",' ',$html);
+                   $a=preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE);
+                   foreach($a as $i=>$e)
+                   {
+                       if($i%2==0)
+                       {
+                           //Text
+                           if($this->HREF)
+                               $this->PutLink($this->HREF,$e);
+                           else
+                               $this->Write(5,$e);
+                       }
+                       else
+                       {
+                           //Tag
+                           if($e{0}=='/')
+                               $this->CloseTag(strtoupper(substr($e,1)));
+                           else
+                           {
+                               //Extract attributes
+                               $a2=explode(' ',$e);
+                               $tag=strtoupper(array_shift($a2));
+                               $attr=array();
+                               foreach($a2 as $v)
+                                   if(ereg('^([^=]*)=["\']?([^"\']*)["\']?$',$v,$a3))
+                                       $attr[strtoupper($a3[1])]=$a3[2];
+                               $this->OpenTag($tag,$attr);
+                           }
+                       }
+                   }
+               }
+              
+               function OpenTag($tag,$attr)
+               {
+                   //Opening tag
+                   if($tag=='B' or $tag=='I' or $tag=='U')
+                       $this->SetStyle($tag,true);
+                   if($tag=='A')
+                       $this->HREF=$attr['HREF'];
+                   if($tag=='BR')
+                       $this->Ln(5);
+               }
+              
+               function CloseTag($tag)
+               {
+                   //Closing tag
+                   if($tag=='B' or $tag=='I' or $tag=='U')
+                       $this->SetStyle($tag,false);
+                   if($tag=='A')
+                       $this->HREF='';
+               }
+              
+               function SetStyle($tag,$enable)
+               {
+                   //Modify style and select corresponding font
+                   $this->$tag+=($enable ? 1 : -1);
+                   $style='';
+                   foreach(array('B','I','U') as $s)
+                       if($this->$s>0)
+                           $style.=$s;
+                   $this->SetFont('',$style);
+               }
+              
+               function PutLink($URL,$txt)
+               {
+                   //Put a hyperlink
+                   $this->SetTextColor(0,0,255);
+                   $this->SetStyle('U',true);
+                   $this->Write(5,$txt,$URL);
+                   $this->SetStyle('U',false);
+                   $this->SetTextColor(0);
+               }
+       }
+
+       $pdf=new PDF();
+       $pdf->AddPage();
+       $pdf->SetTitle($title);
+       $pdf->SetAuthor($author);
+       $pdf->SetFont('Helvetica','B',14);
+       $pdf->WriteHTML($title);
+       $pdf->SetFont('Helvetica','',10);
+       $pdf->WriteHTML($html);
+       $pdf->Output($filename);
+}
+
+if (!isset($_REQUEST['pdf']) or empty($_REQUEST['pdf'])) {
+       if (file_exists("data/items/{$_REQUEST['entry']}/pdf/file")) {
+               rmdirr("data/items/{$_REQUEST['entry']}/pdf/file");
+       }
+}
+
 if (isset($_REQUEST['category']) and !empty($_REQUEST['category'])) {
        if (!file_exists("data/categories")) {
-               mkdir("data/categories", 0777);
-               chmod("data/categories", 0777);
+               mkdir("data/categories");
        }
        if ($_REQUEST['category'] == "unfiled") {
                unlink("data/items/{$_REQUEST['entry']}/category.txt");
@@ -666,7 +833,6 @@ if (isset($_REQUEST['category']) and !empty($_REQUEST['category'])) {
                $fp_category_txt = fopen("data/items/{$_REQUEST['entry']}/category.txt","w");
                fwrite($fp_category_txt, $_REQUEST['category']);
                fclose($fp_category_txt);
-               chmod("data/items/{$_REQUEST['entry']}/category.txt", 0666);
        }
 }
 
@@ -678,7 +844,6 @@ if (isset($_REQUEST['passwd']) and !empty($_REQUEST['passwd']) and ($_REQUEST['p
        $passwd_crypt = crypt($passwd_crypt, $passwd_crypt);
        fwrite($fp_passwd_txt, $passwd_crypt);
        fclose($fp_passwd_txt);
-       chmod("$passwd_file", 0666);
 }
 if (!isset($_REQUEST['passwd']) or empty($_REQUEST['passwd'])) {
        if (file_exists($passwd_file)) {
@@ -693,7 +858,6 @@ if (!file_exists($ping_urls_file)) {
        $fp_default_ping_txt = fopen($ping_urls_file,"w");
        fwrite($fp_default_ping_txt, $default_ping_urls);
        fclose($fp_default_ping_txt);
-       chmod($ping_urls_file, 0666);
 }
 
 $fp_ping_urls = fopen($ping_urls_file, "r");
@@ -709,7 +873,6 @@ foreach ($get_ping_urls as $ping_url) {
        //$fp_ping_urls_edit_txt = fopen($ping_urls_edit_file,"w");
        //fwrite($fp_ping_urls_edit_txt, $ping);
        //fclose($fp_ping_urls_edit_txt);
-       //chmod($ping_urls_edit_file, 0666);
 
        clear($ping);
 }
diff --git a/font/helvetica.php b/font/helvetica.php
new file mode 100755
index 0000000..ca94cdf
--- /dev/null
+++ b/font/helvetica.php
@@ -0,0 +1,15 @@
+<?php
+$fpdf_charwidths['helvetica']=array(
+       chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
+       chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584,
+       ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667,
+       'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
+       'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833,
+       'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556,
+       chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
+       chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
+       chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,
+       chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
+       chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,
+       chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
+?>
diff --git a/font/helveticab.php b/font/helveticab.php
new file mode 100755
index 0000000..276cfa8
--- /dev/null
+++ b/font/helveticab.php
@@ -0,0 +1,15 @@
+<?php
+$fpdf_charwidths['helveticaB']=array(
+       chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
+       chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,
+       ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722,
+       'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
+       'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889,
+       'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556,
+       chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
+       chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
+       chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
+       chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
+       chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,
+       chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);
+?>
diff --git a/font/helveticabi.php b/font/helveticabi.php
new file mode 100755
index 0000000..8d21774
--- /dev/null
+++ b/font/helveticabi.php
@@ -0,0 +1,15 @@
+<?php
+$fpdf_charwidths['helveticaBI']=array(
+       chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
+       chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,
+       ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722,
+       'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
+       'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889,
+       'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556,
+       chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
+       chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
+       chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
+       chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
+       chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,
+       chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);
+?>
diff --git a/font/helveticai.php b/font/helveticai.php
new file mode 100755
index 0000000..88bf437
--- /dev/null
+++ b/font/helveticai.php
@@ -0,0 +1,15 @@
+<?php
+$fpdf_charwidths['helveticaI']=array(
+       chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
+       chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584,
+       ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667,
+       'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
+       'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833,
+       'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556,
+       chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
+       chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
+       chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,
+       chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
+       chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,
+       chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
+?>
diff --git a/fpdf.php b/fpdf.php
new file mode 100755
index 0000000..f0a3e45
--- /dev/null
+++ b/fpdf.php
@@ -0,0 +1,1647 @@
+<?php
+/*******************************************************************************
+* Software: FPDF                                                               *
+* Version:  1.53                                                               *
+* Date:     2004-12-31                                                         *
+* Author:   Olivier PLATHEY                                                    *
+* License:  Freeware                                                           *
+*                                                                              *
+* You may use, modify and redistribute this software as you wish.              *
+*******************************************************************************/
+
+if(!class_exists('FPDF'))
+{
+define('FPDF_VERSION','1.53');
+
+class FPDF
+{
+//Private properties
+var $page;               //current page number
+var $n;                  //current object number
+var $offsets;            //array of object offsets
+var $buffer;             //buffer holding in-memory PDF
+var $pages;              //array containing pages
+var $state;              //current document state
+var $compress;           //compression flag
+var $DefOrientation;     //default orientation
+var $CurOrientation;     //current orientation
+var $OrientationChanges; //array indicating orientation changes
+var $k;                  //scale factor (number of points in user unit)
+var $fwPt,$fhPt;         //dimensions of page format in points
+var $fw,$fh;             //dimensions of page format in user unit
+var $wPt,$hPt;           //current dimensions of page in points
+var $w,$h;               //current dimensions of page in user unit
+var $lMargin;            //left margin
+var $tMargin;            //top margin
+var $rMargin;            //right margin
+var $bMargin;            //page break margin
+var $cMargin;            //cell margin
+var $x,$y;               //current position in user unit for cell positioning
+var $lasth;              //height of last cell printed
+var $LineWidth;          //line width in user unit
+var $CoreFonts;          //array of standard font names
+var $fonts;              //array of used fonts
+var $FontFiles;          //array of font files
+var $diffs;              //array of encoding differences
+var $images;             //array of used images
+var $PageLinks;          //array of links in pages
+var $links;              //array of internal links
+var $FontFamily;         //current font family
+var $FontStyle;          //current font style
+var $underline;          //underlining flag
+var $CurrentFont;        //current font info
+var $FontSizePt;         //current font size in points
+var $FontSize;           //current font size in user unit
+var $DrawColor;          //commands for drawing color
+var $FillColor;          //commands for filling color
+var $TextColor;          //commands for text color
+var $ColorFlag;          //indicates whether fill and text colors are different
+var $ws;                 //word spacing
+var $AutoPageBreak;      //automatic page breaking
+var $PageBreakTrigger;   //threshold used to trigger page breaks
+var $InFooter;           //flag set when processing footer
+var $ZoomMode;           //zoom display mode
+var $LayoutMode;         //layout display mode
+var $title;              //title
+var $subject;            //subject
+var $author;             //author
+var $keywords;           //keywords
+var $creator;            //creator
+var $AliasNbPages;       //alias for total number of pages
+var $PDFVersion;         //PDF version number
+
+/*******************************************************************************
+*                                                                              *
+*                               Public methods                                 *
+*                                                                              *
+*******************************************************************************/
+function FPDF($orientation='P',$unit='mm',$format='A4')
+{
+       //Some checks
+       $this->_dochecks();
+       //Initialization of properties
+       $this->page=0;
+       $this->n=2;
+       $this->buffer='';
+       $this->pages=array();
+       $this->OrientationChanges=array();
+       $this->state=0;
+       $this->fonts=array();
+       $this->FontFiles=array();
+       $this->diffs=array();
+       $this->images=array();
+       $this->links=array();
+       $this->InFooter=false;
+       $this->lasth=0;
+       $this->FontFamily='';
+       $this->FontStyle='';
+       $this->FontSizePt=12;
+       $this->underline=false;
+       $this->DrawColor='0 G';
+       $this->FillColor='0 g';
+       $this->TextColor='0 g';
+       $this->ColorFlag=false;
+       $this->ws=0;
+       //Standard fonts
+       $this->CoreFonts=array('courier'=>'Courier','courierB'=>'Courier-Bold','courierI'=>'Courier-Oblique','courierBI'=>'Courier-BoldOblique',
+               'helvetica'=>'Helvetica','helveticaB'=>'Helvetica-Bold','helveticaI'=>'Helvetica-Oblique','helveticaBI'=>'Helvetica-BoldOblique',
+               'times'=>'Times-Roman','timesB'=>'Times-Bold','timesI'=>'Times-Italic','timesBI'=>'Times-BoldItalic',
+               'symbol'=>'Symbol','zapfdingbats'=>'ZapfDingbats');
+       //Scale factor
+       if($unit=='pt')
+               $this->k=1;
+       elseif($unit=='mm')
+               $this->k=72/25.4;
+       elseif($unit=='cm')
+               $this->k=72/2.54;
+       elseif($unit=='in')
+               $this->k=72;
+       else
+               $this->Error('Incorrect unit: '.$unit);
+       //Page format
+       if(is_string($format))
+       {
+               $format=strtolower($format);
+               if($format=='a3')
+                       $format=array(841.89,1190.55);
+               elseif($format=='a4')
+                       $format=array(595.28,841.89);
+               elseif($format=='a5')
+                       $format=array(420.94,595.28);
+               elseif($format=='letter')
+                       $format=array(612,792);
+               elseif($format=='legal')
+                       $format=array(612,1008);
+               else
+                       $this->Error('Unknown page format: '.$format);
+               $this->fwPt=$format[0];
+               $this->fhPt=$format[1];
+       }
+       else
+       {
+               $this->fwPt=$format[0]*$this->k;
+               $this->fhPt=$format[1]*$this->k;
+       }
+       $this->fw=$this->fwPt/$this->k;
+       $this->fh=$this->fhPt/$this->k;
+       //Page orientation
+       $orientation=strtolower($orientation);
+       if($orientation=='p' || $orientation=='portrait')
+       {
+               $this->DefOrientation='P';
+               $this->wPt=$this->fwPt;
+               $this->hPt=$this->fhPt;
+       }
+       elseif($orientation=='l' || $orientation=='landscape')
+       {
+               $this->DefOrientation='L';
+               $this->wPt=$this->fhPt;
+               $this->hPt=$this->fwPt;
+       }
+       else
+               $this->Error('Incorrect orientation: '.$orientation);
+       $this->CurOrientation=$this->DefOrientation;
+       $this->w=$this->wPt/$this->k;
+       $this->h=$this->hPt/$this->k;
+       //Page margins (1 cm)
+       $margin=28.35/$this->k;
+       $this->SetMargins($margin,$margin);
+       //Interior cell margin (1 mm)
+       $this->cMargin=$margin/10;
+       //Line width (0.2 mm)
+       $this->LineWidth=.567/$this->k;
+       //Automatic page break
+       $this->SetAutoPageBreak(true,2*$margin);
+       //Full width display mode
+       $this->SetDisplayMode('fullwidth');
+       //Enable compression
+       $this->SetCompression(true);
+       //Set default PDF version number
+       $this->PDFVersion='1.3';
+}
+
+function SetMargins($left,$top,$right=-1)
+{
+       //Set left, top and right margins
+       $this->lMargin=$left;
+       $this->tMargin=$top;
+       if($right==-1)
+               $right=$left;
+       $this->rMargin=$right;
+}
+
+function SetLeftMargin($margin)
+{
+       //Set left margin
+       $this->lMargin=$margin;
+       if($this->page>0 && $this->x<$margin)
+               $this->x=$margin;
+}
+
+function SetTopMargin($margin)
+{
+       //Set top margin
+       $this->tMargin=$margin;
+}
+
+function SetRightMargin($margin)
+{
+       //Set right margin
+       $this->rMargin=$margin;
+}
+
+function SetAutoPageBreak($auto,$margin=0)
+{
+       //Set auto page break mode and triggering margin
+       $this->AutoPageBreak=$auto;
+       $this->bMargin=$margin;
+       $this->PageBreakTrigger=$this->h-$margin;
+}
+
+function SetDisplayMode($zoom,$layout='continuous')
+{
+       //Set display mode in viewer
+       if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom))
+               $this->ZoomMode=$zoom;
+       else
+               $this->Error('Incorrect zoom display mode: '.$zoom);
+       if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default')
+               $this->LayoutMode=$layout;
+       else
+               $this->Error('Incorrect layout display mode: '.$layout);
+}
+
+function SetCompression($compress)
+{
+       //Set page compression
+       if(function_exists('gzcompress'))
+               $this->compress=$compress;
+       else
+               $this->compress=false;
+}
+
+function SetTitle($title)
+{
+       //Title of document
+       $this->title=$title;
+}
+
+function SetSubject($subject)
+{
+       //Subject of document
+       $this->subject=$subject;
+}
+
+function SetAuthor($author)
+{
+       //Author of document
+       $this->author=$author;
+}
+
+function SetKeywords($keywords)
+{
+       //Keywords of document
+       $this->keywords=$keywords;
+}
+
+function SetCreator($creator)
+{
+       //Creator of document
+       $this->creator=$creator;
+}
+
+function AliasNbPages($alias='{nb}')
+{
+       //Define an alias for total number of pages
+       $this->AliasNbPages=$alias;
+}
+
+function Error($msg)
+{
+       //Fatal error
+       die('<B>FPDF error: </B>'.$msg);
+}
+
+function Open()
+{
+       //Begin document
+       $this->state=1;
+}
+
+function Close()
+{
+       //Terminate document
+       if($this->state==3)
+               return;
+       if($this->page==0)
+               $this->AddPage();
+       //Page footer
+       $this->InFooter=true;
+       $this->Footer();
+       $this->InFooter=false;
+       //Close page
+       $this->_endpage();
+       //Close document
+       $this->_enddoc();
+}
+
+function AddPage($orientation='')
+{
+       //Start a new page
+       if($this->state==0)
+               $this->Open();
+       $family=$this->FontFamily;
+       $style=$this->FontStyle.($this->underline ? 'U' : '');
+       $size=$this->FontSizePt;
+       $lw=$this->LineWidth;
+       $dc=$this->DrawColor;
+       $fc=$this->FillColor;
+       $tc=$this->TextColor;
+       $cf=$this->ColorFlag;
+       if($this->page>0)
+       {
+               //Page footer
+               $this->InFooter=true;
+               $this->Footer();
+               $this->InFooter=false;
+               //Close page
+               $this->_endpage();
+       }
+       //Start new page
+       $this->_beginpage($orientation);
+       //Set line cap style to square
+       $this->_out('2 J');
+       //Set line width
+       $this->LineWidth=$lw;
+       $this->_out(sprintf('%.2f w',$lw*$this->k));
+       //Set font
+       if($family)
+               $this->SetFont($family,$style,$size);
+       //Set colors
+       $this->DrawColor=$dc;
+       if($dc!='0 G')
+               $this->_out($dc);
+       $this->FillColor=$fc;
+       if($fc!='0 g')
+               $this->_out($fc);
+       $this->TextColor=$tc;
+       $this->ColorFlag=$cf;
+       //Page header
+       $this->Header();
+       //Restore line width
+       if($this->LineWidth!=$lw)
+       {
+               $this->LineWidth=$lw;
+               $this->_out(sprintf('%.2f w',$lw*$this->k));
+       }
+       //Restore font
+       if($family)
+               $this->SetFont($family,$style,$size);
+       //Restore colors
+       if($this->DrawColor!=$dc)
+       {
+               $this->DrawColor=$dc;
+               $this->_out($dc);
+       }
+       if($this->FillColor!=$fc)
+       {
+               $this->FillColor=$fc;
+               $this->_out($fc);
+       }
+       $this->TextColor=$tc;
+       $this->ColorFlag=$cf;
+}
+
+function Header()
+{
+       //To be implemented in your own inherited class
+}
+
+function Footer()
+{
+       //To be implemented in your own inherited class
+}
+
+function PageNo()
+{
+       //Get current page number
+       return $this->page;
+}
+
+function SetDrawColor($r,$g=-1,$b=-1)
+{
+       //Set color for all stroking operations
+       if(($r==0 && $g==0 && $b==0) || $g==-1)
+               $this->DrawColor=sprintf('%.3f G',$r/255);
+       else
+               $this->DrawColor=sprintf('%.3f %.3f %.3f RG',$r/255,$g/255,$b/255);
+       if($this->page>0)
+               $this->_out($this->DrawColor);
+}
+
+function SetFillColor($r,$g=-1,$b=-1)
+{
+       //Set color for all filling operations
+       if(($r==0 && $g==0 && $b==0) || $g==-1)
+               $this->FillColor=sprintf('%.3f g',$r/255);
+       else
+               $this->FillColor=sprintf('%.3f %.3f %.3f rg',$r/255,$g/255,$b/255);
+       $this->ColorFlag=($this->FillColor!=$this->TextColor);
+       if($this->page>0)
+               $this->_out($this->FillColor);
+}
+
+function SetTextColor($r,$g=-1,$b=-1)
+{
+       //Set color for text
+       if(($r==0 && $g==0 && $b==0) || $g==-1)
+               $this->TextColor=sprintf('%.3f g',$r/255);
+       else
+               $this->TextColor=sprintf('%.3f %.3f %.3f rg',$r/255,$g/255,$b/255);
+       $this->ColorFlag=($this->FillColor!=$this->TextColor);
+}
+
+function GetStringWidth($s)
+{
+       //Get width of a string in the current font
+       $s=(string)$s;
+       $cw=&$this->CurrentFont['cw'];
+       $w=0;
+       $l=strlen($s);
+       for($i=0;$i<$l;$i++)
+               $w+=$cw[$s{$i}];
+       return $w*$this->FontSize/1000;
+}
+
+function SetLineWidth($width)
+{
+       //Set line width
+       $this->LineWidth=$width;
+       if($this->page>0)
+               $this->_out(sprintf('%.2f w',$width*$this->k));
+}
+
+function Line($x1,$y1,$x2,$y2)
+{
+       //Draw a line
+       $this->_out(sprintf('%.2f %.2f m %.2f %.2f l S',$x1*$this->k,($this->h-$y1)*$this->k,$x2*$this->k,($this->h-$y2)*$this->k));
+}
+
+function Rect($x,$y,$w,$h,$style='')
+{
+       //Draw a rectangle
+       if($style=='F')
+               $op='f';
+       elseif($style=='FD' || $style=='DF')
+               $op='B';
+       else
+               $op='S';
+       $this->_out(sprintf('%.2f %.2f %.2f %.2f re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op));
+}
+
+function AddFont($family,$style='',$file='')
+{
+       //Add a TrueType or Type1 font
+       $family=strtolower($family);
+       if($file=='')
+               $file=str_replace(' ','',$family).strtolower($style).'.php';
+       if($family=='arial')
+               $family='helvetica';
+       $style=strtoupper($style);
+       if($style=='IB')
+               $style='BI';
+       $fontkey=$family.$style;
+       if(isset($this->fonts[$fontkey]))
+               $this->Error('Font already added: '.$family.' '.$style);
+       include($this->_getfontpath().$file);
+       if(!isset($name))
+               $this->Error('Could not include font definition file');
+       $i=count($this->fonts)+1;
+       $this->fonts[$fontkey]=array('i'=>$i,'type'=>$type,'name'=>$name,'desc'=>$desc,'up'=>$up,'ut'=>$ut,'cw'=>$cw,'enc'=>$enc,'file'=>$file);
+       if($diff)
+       {
+               //Search existing encodings
+               $d=0;
+               $nb=count($this->diffs);
+               for($i=1;$i<=$nb;$i++)
+               {
+                       if($this->diffs[$i]==$diff)
+                       {
+                               $d=$i;
+                               break;
+                       }
+               }
+               if($d==0)
+               {
+                       $d=$nb+1;
+                       $this->diffs[$d]=$diff;
+               }
+               $this->fonts[$fontkey]['diff']=$d;
+       }
+       if($file)
+       {
+               if($type=='TrueType')
+                       $this->FontFiles[$file]=array('length1'=>$originalsize);
+               else
+                       $this->FontFiles[$file]=array('length1'=>$size1,'length2'=>$size2);
+       }
+}
+
+function SetFont($family,$style='',$size=0)
+{
+       //Select a font; size given in points
+       global $fpdf_charwidths;
+
+       $family=strtolower($family);
+       if($family=='')
+               $family=$this->FontFamily;
+       if($family=='arial')
+               $family='helvetica';
+       elseif($family=='symbol' || $family=='zapfdingbats')
+               $style='';
+       $style=strtoupper($style);
+       if(strpos($style,'U')!==false)
+       {
+               $this->underline=true;
+               $style=str_replace('U','',$style);
+       }
+       else
+               $this->underline=false;
+       if($style=='IB')
+               $style='BI';
+       if($size==0)
+               $size=$this->FontSizePt;
+       //Test if font is already selected
+       if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size)
+               return;
+       //Test if used for the first time
+       $fontkey=$family.$style;
+       if(!isset($this->fonts[$fontkey]))
+       {
+               //Check if one of the standard fonts
+               if(isset($this->CoreFonts[$fontkey]))
+               {
+                       if(!isset($fpdf_charwidths[$fontkey]))
+                       {
+                               //Load metric file
+                               $file=$family;
+                               if($family=='times' || $family=='helvetica')
+                                       $file.=strtolower($style);
+                               include($this->_getfontpath().$file.'.php');
+                               if(!isset($fpdf_charwidths[$fontkey]))
+                                       $this->Error('Could not include font metric file');
+                       }
+                       $i=count($this->fonts)+1;
+                       $this->fonts[$fontkey]=array('i'=>$i,'type'=>'core','name'=>$this->CoreFonts[$fontkey],'up'=>-100,'ut'=>50,'cw'=>$fpdf_charwidths[$fontkey]);
+               }
+               else
+                       $this->Error('Undefined font: '.$family.' '.$style);
+       }
+       //Select it
+       $this->FontFamily=$family;
+       $this->FontStyle=$style;
+       $this->FontSizePt=$size;
+       $this->FontSize=$size/$this->k;
+       $this->CurrentFont=&$this->fonts[$fontkey];
+       if($this->page>0)
+               $this->_out(sprintf('BT /F%d %.2f Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
+}
+
+function SetFontSize($size)
+{
+       //Set font size in points
+       if($this->FontSizePt==$size)
+               return;
+       $this->FontSizePt=$size;
+       $this->FontSize=$size/$this->k;
+       if($this->page>0)
+               $this->_out(sprintf('BT /F%d %.2f Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
+}
+
+function AddLink()
+{
+       //Create a new internal link
+       $n=count($this->links)+1;
+       $this->links[$n]=array(0,0);
+       return $n;
+}
+
+function SetLink($link,$y=0,$page=-1)
+{
+       //Set destination of internal link
+       if($y==-1)
+               $y=$this->y;
+       if($page==-1)
+               $page=$this->page;
+       $this->links[$link]=array($page,$y);
+}
+
+function Link($x,$y,$w,$h,$link)
+{
+       //Put a link on the page
+       $this->PageLinks[$this->page][]=array($x*$this->k,$this->hPt-$y*$this->k,$w*$this->k,$h*$this->k,$link);
+}
+
+function Text($x,$y,$txt)
+{
+       //Output a string
+       $s=sprintf('BT %.2f %.2f Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt));
+       if($this->underline && $txt!='')
+               $s.=' '.$this->_dounderline($x,$y,$txt);
+       if($this->ColorFlag)
+               $s='q '.$this->TextColor.' '.$s.' Q';
+       $this->_out($s);
+}
+
+function AcceptPageBreak()
+{
+       //Accept automatic page break or not
+       return $this->AutoPageBreak;
+}
+
+function Cell($w,$h=0,$txt='',$border=0,$ln=0,$align='',$fill=0,$link='')
+{
+       //Output a cell
+       $k=$this->k;
+       if($this->y+$h>$this->PageBreakTrigger && !$this->InFooter && $this->AcceptPageBreak())
+       {
+               //Automatic page break
+               $x=$this->x;
+               $ws=$this->ws;
+               if($ws>0)
+               {
+                       $this->ws=0;
+                       $this->_out('0 Tw');
+               }
+               $this->AddPage($this->CurOrientation);
+               $this->x=$x;
+               if($ws>0)
+               {
+                       $this->ws=$ws;
+                       $this->_out(sprintf('%.3f Tw',$ws*$k));
+               }
+       }
+       if($w==0)
+               $w=$this->w-$this->rMargin-$this->x;
+       $s='';
+       if($fill==1 || $border==1)
+       {
+               if($fill==1)
+                       $op=($border==1) ? 'B' : 'f';
+               else
+                       $op='S';
+               $s=sprintf('%.2f %.2f %.2f %.2f re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op);
+       }
+       if(is_string($border))
+       {
+               $x=$this->x;
+               $y=$this->y;
+               if(strpos($border,'L')!==false)
+                       $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k);
+               if(strpos($border,'T')!==false)
+                       $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k);
+               if(strpos($border,'R')!==false)
+                       $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
+               if(strpos($border,'B')!==false)
+                       $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
+       }
+       if($txt!=='')
+       {
+               if($align=='R')
+                       $dx=$w-$this->cMargin-$this->GetStringWidth($txt);
+               elseif($align=='C')
+                       $dx=($w-$this->GetStringWidth($txt))/2;
+               else
+                       $dx=$this->cMargin;
+               if($this->ColorFlag)
+                       $s.='q '.$this->TextColor.' ';
+               $txt2=str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt)));
+               $s.=sprintf('BT %.2f %.2f Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$txt2);
+               if($this->underline)
+                       $s.=' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt);
+               if($this->ColorFlag)
+                       $s.=' Q';
+               if($link)
+                       $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link);
+       }
+       if($s)
+               $this->_out($s);
+       $this->lasth=$h;
+       if($ln>0)
+       {
+               //Go to next line
+               $this->y+=$h;
+               if($ln==1)
+                       $this->x=$this->lMargin;
+       }
+       else
+               $this->x+=$w;
+}
+
+function MultiCell($w,$h,$txt,$border=0,$align='J',$fill=0)
+{
+       //Output text with automatic or explicit line breaks
+       $cw=&$this->CurrentFont['cw'];
+       if($w==0)
+               $w=$this->w-$this->rMargin-$this->x;
+       $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
+       $s=str_replace("\r",'',$txt);
+       $nb=strlen($s);
+       if($nb>0 && $s[$nb-1]=="\n")
+               $nb--;
+       $b=0;
+       if($border)
+       {
+               if($border==1)
+               {
+                       $border='LTRB';
+                       $b='LRT';
+                       $b2='LR';
+               }
+               else
+               {
+                       $b2='';
+                       if(strpos($border,'L')!==false)
+                               $b2.='L';
+                       if(strpos($border,'R')!==false)
+                               $b2.='R';
+                       $b=(strpos($border,'T')!==false) ? $b2.'T' : $b2;
+               }
+       }
+       $sep=-1;
+       $i=0;
+       $j=0;
+       $l=0;
+       $ns=0;
+       $nl=1;
+       while($i<$nb)
+       {
+               //Get next character
+               $c=$s{$i};
+               if($c=="\n")
+               {
+                       //Explicit line break
+                       if($this->ws>0)
+                       {
+                               $this->ws=0;
+                               $this->_out('0 Tw');
+                       }
+                       $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
+                       $i++;
+                       $sep=-1;
+                       $j=$i;
+                       $l=0;
+                       $ns=0;
+                       $nl++;
+                       if($border && $nl==2)
+                               $b=$b2;
+                       continue;
+               }
+               if($c==' ')
+               {
+                       $sep=$i;
+                       $ls=$l;
+                       $ns++;
+               }
+               $l+=$cw[$c];
+               if($l>$wmax)
+               {
+                       //Automatic line break
+                       if($sep==-1)
+                       {
+                               if($i==$j)
+                                       $i++;
+                               if($this->ws>0)
+                               {
+                                       $this->ws=0;
+                                       $this->_out('0 Tw');
+                               }
+                               $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
+                       }
+                       else
+                       {
+                               if($align=='J')
+                               {
+                                       $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0;
+                                       $this->_out(sprintf('%.3f Tw',$this->ws*$this->k));
+                               }
+                               $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill);
+                               $i=$sep+1;
+                       }
+                       $sep=-1;
+                       $j=$i;
+                       $l=0;
+                       $ns=0;
+                       $nl++;
+                       if($border && $nl==2)
+                               $b=$b2;
+               }
+               else
+                       $i++;
+       }
+       //Last chunk
+       if($this->ws>0)
+       {
+               $this->ws=0;
+               $this->_out('0 Tw');
+       }
+       if($border && strpos($border,'B')!==false)
+               $b.='B';
+       $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
+       $this->x=$this->lMargin;
+}
+
+function Write($h,$txt,$link='')
+{
+       //Output text in flowing mode
+       $cw=&$this->CurrentFont['cw'];
+       $w=$this->w-$this->rMargin-$this->x;
+       $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
+       $s=str_replace("\r",'',$txt);
+       $nb=strlen($s);
+       $sep=-1;
+       $i=0;
+       $j=0;
+       $l=0;
+       $nl=1;
+       while($i<$nb)
+       {
+               //Get next character
+               $c=$s{$i};
+               if($c=="\n")
+               {
+                       //Explicit line break
+                       $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);
+                       $i++;
+                       $sep=-1;
+                       $j=$i;
+                       $l=0;
+                       if($nl==1)
+                       {
+                               $this->x=$this->lMargin;
+                               $w=$this->w-$this->rMargin-$this->x;
+                               $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
+                       }
+                       $nl++;
+                       continue;
+               }
+               if($c==' ')
+                       $sep=$i;
+               $l+=$cw[$c];
+               if($l>$wmax)
+               {
+                       //Automatic line break
+                       if($sep==-1)
+                       {
+                               if($this->x>$this->lMargin)
+                               {
+                                       //Move to next line
+                                       $this->x=$this->lMargin;
+                                       $this->y+=$h;
+                                       $w=$this->w-$this->rMargin-$this->x;
+                                       $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
+                                       $i++;
+                                       $nl++;
+                                       continue;
+                               }
+                               if($i==$j)
+                                       $i++;
+                               $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);
+                       }
+                       else
+                       {
+                               $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link);
+                               $i=$sep+1;
+                       }
+                       $sep=-1;
+                       $j=$i;
+                       $l=0;
+                       if($nl==1)
+                       {
+                               $this->x=$this->lMargin;
+                               $w=$this->w-$this->rMargin-$this->x;
+                               $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
+                       }
+                       $nl++;
+               }
+               else
+                       $i++;
+       }
+       //Last chunk
+       if($i!=$j)
+               $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',0,$link);
+}
+
+function Image($file,$x,$y,$w=0,$h=0,$type='',$link='')
+{
+       //Put an image on the page
+       if(!isset($this->images[$file]))
+       {
+               //First use of image, get info
+               if($type=='')
+               {
+                       $pos=strrpos($file,'.');
+                       if(!$pos)
+                               $this->Error('Image file has no extension and no type was specified: '.$file);
+                       $type=substr($file,$pos+1);
+               }
+               $type=strtolower($type);
+               $mqr=get_magic_quotes_runtime();
+               set_magic_quotes_runtime(0);
+               if($type=='jpg' || $type=='jpeg')
+                       $info=$this->_parsejpg($file);
+               elseif($type=='png')
+                       $info=$this->_parsepng($file);
+               else
+               {
+                       //Allow for additional formats
+                       $mtd='_parse'.$type;
+                       if(!method_exists($this,$mtd))
+                               $this->Error('Unsupported image type: '.$type);
+                       $info=$this->$mtd($file);
+               }
+               set_magic_quotes_runtime($mqr);
+               $info['i']=count($this->images)+1;
+               $this->images[$file]=$info;
+       }
+       else
+               $info=$this->images[$file];
+       //Automatic width and height calculation if needed
+       if($w==0 && $h==0)
+       {
+               //Put image at 72 dpi
+               $w=$info['w']/$this->k;
+               $h=$info['h']/$this->k;
+       }
+       if($w==0)
+               $w=$h*$info['w']/$info['h'];
+       if($h==0)
+               $h=$w*$info['h']/$info['w'];
+       $this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));
+       if($link)
+               $this->Link($x,$y,$w,$h,$link);
+}
+
+function Ln($h='')
+{
+       //Line feed; default value is last cell height
+       $this->x=$this->lMargin;
+       if(is_string($h))
+               $this->y+=$this->lasth;
+       else
+               $this->y+=$h;
+}
+
+function GetX()
+{
+       //Get x position
+       return $this->x;
+}
+
+function SetX($x)
+{
+       //Set x position
+       if($x>=0)
+               $this->x=$x;
+       else
+               $this->x=$this->w+$x;
+}
+
+function GetY()
+{
+       //Get y position
+       return $this->y;
+}
+
+function SetY($y)
+{
+       //Set y position and reset x
+       $this->x=$this->lMargin;
+       if($y>=0)
+               $this->y=$y;
+       else
+               $this->y=$this->h+$y;
+}
+
+function SetXY($x,$y)
+{
+       //Set x and y positions
+       $this->SetY($y);
+       $this->SetX($x);
+}
+
+function Output($name='',$dest='')
+{
+       //Output PDF to some destination
+       //Finish document if necessary
+       if($this->state<3)
+               $this->Close();
+       //Normalize parameters
+       if(is_bool($dest))
+               $dest=$dest ? 'D' : 'F';
+       $dest=strtoupper($dest);
+       if($dest=='')
+       {
+               if($name=='')
+               {
+                       $name='doc.pdf';
+                       $dest='I';
+               }
+               else
+                       $dest='F';
+       }
+       switch($dest)
+       {
+               case 'I':
+                       //Send to standard output
+                       if(ob_get_contents())
+                               $this->Error('Some data has already been output, can\'t send PDF file');
+                       if(php_sapi_name()!='cli')
+                       {
+                               //We send to a browser
+                               header('Content-Type: application/pdf');
+                               if(headers_sent())
+                                       $this->Error('Some data has already been output to browser, can\'t send PDF file');
+                               header('Content-Length: '.strlen($this->buffer));
+                               header('Content-disposition: inline; filename="'.$name.'"');
+                       }
+                       echo $this->buffer;
+                       break;
+               case 'D':
+                       //Download file
+                       if(ob_get_contents())
+                               $this->Error('Some data has already been output, can\'t send PDF file');
+                       if(isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'],'MSIE'))
+                               header('Content-Type: application/force-download');
+                       else
+                               header('Content-Type: application/octet-stream');
+                       if(headers_sent())
+                               $this->Error('Some data has already been output to browser, can\'t send PDF file');
+                       header('Content-Length: '.strlen($this->buffer));
+                       header('Content-disposition: attachment; filename="'.$name.'"');
+                       echo $this->buffer;
+                       break;
+               case 'F':
+                       //Save to local file
+                       $f=fopen($name,'wb');
+                       if(!$f)
+                               $this->Error('Unable to create output file: '.$name);
+                       fwrite($f,$this->buffer,strlen($this->buffer));
+                       fclose($f);
+                       break;
+               case 'S':
+                       //Return as a string
+                       return $this->buffer;
+               default:
+                       $this->Error('Incorrect output destination: '.$dest);
+       }
+       return '';
+}
+
+/*******************************************************************************
+*                                                                              *
+*                              Protected methods                               *
+*                                                                              *
+*******************************************************************************/
+function _dochecks()
+{
+       //Check for locale-related bug
+       if(1.1==1)
+               $this->Error('Don\'t alter the locale before including class file');
+       //Check for decimal separator
+       if(sprintf('%.1f',1.0)!='1.0')
+               setlocale(LC_NUMERIC,'C');
+}
+
+function _getfontpath()
+{
+       if(!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__).'/font'))
+               define('FPDF_FONTPATH',dirname(__FILE__).'/font/');
+       return defined('FPDF_FONTPATH') ? FPDF_FONTPATH : '';
+}
+
+function _putpages()
+{
+       $nb=$this->page;
+       if(!empty($this->AliasNbPages))
+       {
+               //Replace number of pages
+               for($n=1;$n<=$nb;$n++)
+                       $this->pages[$n]=str_replace($this->AliasNbPages,$nb,$this->pages[$n]);
+       }
+       if($this->DefOrientation=='P')
+       {
+               $wPt=$this->fwPt;
+               $hPt=$this->fhPt;
+       }
+       else
+       {
+               $wPt=$this->fhPt;
+               $hPt=$this->fwPt;
+       }
+       $filter=($this->compress) ? '/Filter /FlateDecode ' : '';
+       for($n=1;$n<=$nb;$n++)
+       {
+               //Page
+               $this->_newobj();
+               $this->_out('<</Type /Page');
+               $this->_out('/Parent 1 0 R');
+               if(isset($this->OrientationChanges[$n]))
+                       $this->_out(sprintf('/MediaBox [0 0 %.2f %.2f]',$hPt,$wPt));
+               $this->_out('/Resources 2 0 R');
+               if(isset($this->PageLinks[$n]))
+               {
+                       //Links
+                       $annots='/Annots [';
+                       foreach($this->PageLinks[$n] as $pl)
+                       {
+                               $rect=sprintf('%.2f %.2f %.2f %.2f',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]);
+                               $annots.='<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] ';
+                               if(is_string($pl[4]))
+                                       $annots.='/A <</S /URI /URI '.$this->_textstring($pl[4]).'>>>>';
+                               else
+                               {
+                                       $l=$this->links[$pl[4]];
+                                       $h=isset($this->OrientationChanges[$l[0]]) ? $wPt : $hPt;
+                                       $annots.=sprintf('/Dest [%d 0 R /XYZ 0 %.2f null]>>',1+2*$l[0],$h-$l[1]*$this->k);
+                               }
+                       }
+                       $this->_out($annots.']');
+               }
+               $this->_out('/Contents '.($this->n+1).' 0 R>>');
+               $this->_out('endobj');
+               //Page content
+               $p=($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n];
+               $this->_newobj();
+               $this->_out('<<'.$filter.'/Length '.strlen($p).'>>');
+               $this->_putstream($p);
+               $this->_out('endobj');
+       }
+       //Pages root
+       $this->offsets[1]=strlen($this->buffer);
+       $this->_out('1 0 obj');
+       $this->_out('<</Type /Pages');
+       $kids='/Kids [';
+       for($i=0;$i<$nb;$i++)
+               $kids.=(3+2*$i).' 0 R ';
+       $this->_out($kids.']');
+       $this->_out('/Count '.$nb);
+       $this->_out(sprintf('/MediaBox [0 0 %.2f %.2f]',$wPt,$hPt));
+       $this->_out('>>');
+       $this->_out('endobj');
+}
+
+function _putfonts()
+{
+       $nf=$this->n;
+       foreach($this->diffs as $diff)
+       {
+               //Encodings
+               $this->_newobj();
+               $this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>');
+               $this->_out('endobj');
+       }
+       $mqr=get_magic_quotes_runtime();
+       set_magic_quotes_runtime(0);
+       foreach($this->FontFiles as $file=>$info)
+       {
+               //Font file embedding
+               $this->_newobj();
+               $this->FontFiles[$file]['n']=$this->n;
+               $font='';
+               $f=fopen($this->_getfontpath().$file,'rb',1);
+               if(!$f)
+                       $this->Error('Font file not found');
+               while(!feof($f))
+                       $font.=fread($f,8192);
+               fclose($f);
+               $compressed=(substr($file,-2)=='.z');
+               if(!$compressed && isset($info['length2']))
+               {
+                       $header=(ord($font{0})==128);
+                       if($header)
+                       {
+                               //Strip first binary header
+                               $font=substr($font,6);
+                       }
+                       if($header && ord($font{$info['length1']})==128)
+                       {
+                               //Strip second binary header
+                               $font=substr($font,0,$info['length1']).substr($font,$info['length1']+6);
+                       }
+               }
+               $this->_out('<</Length '.strlen($font));
+               if($compressed)
+                       $this->_out('/Filter /FlateDecode');
+               $this->_out('/Length1 '.$info['length1']);
+               if(isset($info['length2']))
+                       $this->_out('/Length2 '.$info['length2'].' /Length3 0');
+               $this->_out('>>');
+               $this->_putstream($font);
+               $this->_out('endobj');
+       }
+       set_magic_quotes_runtime($mqr);
+       foreach($this->fonts as $k=>$font)
+       {
+               //Font objects
+               $this->fonts[$k]['n']=$this->n+1;
+               $type=$font['type'];
+               $name=$font['name'];
+               if($type=='core')
+               {
+                       //Standard font
+                       $this->_newobj();
+                       $this->_out('<</Type /Font');
+                       $this->_out('/BaseFont /'.$name);
+                       $this->_out('/Subtype /Type1');
+                       if($name!='Symbol' && $name!='ZapfDingbats')
+                               $this->_out('/Encoding /WinAnsiEncoding');
+                       $this->_out('>>');
+                       $this->_out('endobj');
+               }
+               elseif($type=='Type1' || $type=='TrueType')
+               {
+                       //Additional Type1 or TrueType font
+                       $this->_newobj();
+                       $this->_out('<</Type /Font');
+                       $this->_out('/BaseFont /'.$name);
+                       $this->_out('/Subtype /'.$type);
+                       $this->_out('/FirstChar 32 /LastChar 255');
+                       $this->_out('/Widths '.($this->n+1).' 0 R');
+                       $this->_out('/FontDescriptor '.($this->n+2).' 0 R');
+                       if($font['enc'])
+                       {
+                               if(isset($font['diff']))
+                                       $this->_out('/Encoding '.($nf+$font['diff']).' 0 R');
+                               else
+                                       $this->_out('/Encoding /WinAnsiEncoding');
+                       }
+                       $this->_out('>>');
+                       $this->_out('endobj');
+                       //Widths
+                       $this->_newobj();
+                       $cw=&$font['cw'];
+                       $s='[';
+                       for($i=32;$i<=255;$i++)
+                               $s.=$cw[chr($i)].' ';
+                       $this->_out($s.']');
+                       $this->_out('endobj');
+                       //Descriptor
+                       $this->_newobj();
+                       $s='<</Type /FontDescriptor /FontName /'.$name;
+                       foreach($font['desc'] as $k=>$v)
+                               $s.=' /'.$k.' '.$v;
+                       $file=$font['file'];
+                       if($file)
+                               $s.=' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R';
+                       $this->_out($s.'>>');
+                       $this->_out('endobj');
+               }
+               else
+               {
+                       //Allow for additional types
+                       $mtd='_put'.strtolower($type);
+                       if(!method_exists($this,$mtd))
+                               $this->Error('Unsupported font type: '.$type);
+                       $this->$mtd($font);
+               }
+       }
+}
+
+function _putimages()
+{
+       $filter=($this->compress) ? '/Filter /FlateDecode ' : '';
+       reset($this->images);
+       while(list($file,$info)=each($this->images))
+       {
+               $this->_newobj();
+               $this->images[$file]['n']=$this->n;
+               $this->_out('<</Type /XObject');
+               $this->_out('/Subtype /Image');
+               $this->_out('/Width '.$info['w']);
+               $this->_out('/Height '.$info['h']);
+               if($info['cs']=='Indexed')
+                       $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]');
+               else
+               {
+                       $this->_out('/ColorSpace /'.$info['cs']);
+                       if($info['cs']=='DeviceCMYK')
+                               $this->_out('/Decode [1 0 1 0 1 0 1 0]');
+               }
+               $this->_out('/BitsPerComponent '.$info['bpc']);
+               if(isset($info['f']))
+                       $this->_out('/Filter /'.$info['f']);
+               if(isset($info['parms']))
+                       $this->_out($info['parms']);
+               if(isset($info['trns']) && is_array($info['trns']))
+               {
+                       $trns='';
+                       for($i=0;$i<count($info['trns']);$i++)
+                               $trns.=$info['trns'][$i].' '.$info['trns'][$i].' ';
+                       $this->_out('/Mask ['.$trns.']');
+               }
+               $this->_out('/Length '.strlen($info['data']).'>>');
+               $this->_putstream($info['data']);
+               unset($this->images[$file]['data']);
+               $this->_out('endobj');
+               //Palette
+               if($info['cs']=='Indexed')
+               {
+                       $this->_newobj();
+                       $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal'];
+                       $this->_out('<<'.$filter.'/Length '.strlen($pal).'>>');
+                       $this->_putstream($pal);
+                       $this->_out('endobj');
+               }
+       }
+}
+
+function _putxobjectdict()
+{
+       foreach($this->images as $image)
+               $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
+}
+
+function _putresourcedict()
+{
+       $this->_out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
+       $this->_out('/Font <<');
+       foreach($this->fonts as $font)
+               $this->_out('/F'.$font['i'].' '.$font['n'].' 0 R');
+       $this->_out('>>');
+       $this->_out('/XObject <<');
+       $this->_putxobjectdict();
+       $this->_out('>>');
+}
+
+function _putresources()
+{
+       $this->_putfonts();
+       $this->_putimages();
+       //Resource dictionary
+       $this->offsets[2]=strlen($this->buffer);
+       $this->_out('2 0 obj');
+       $this->_out('<<');
+       $this->_putresourcedict();
+       $this->_out('>>');
+       $this->_out('endobj');
+}
+
+function _putinfo()
+{
+       $this->_out('/Producer '.$this->_textstring('FPDF '.FPDF_VERSION));
+       if(!empty($this->title))
+               $this->_out('/Title '.$this->_textstring($this->title));
+       if(!empty($this->subject))
+               $this->_out('/Subject '.$this->_textstring($this->subject));
+       if(!empty($this->author))
+               $this->_out('/Author '.$this->_textstring($this->author));
+       if(!empty($this->keywords))
+               $this->_out('/Keywords '.$this->_textstring($this->keywords));
+       if(!empty($this->creator))
+               $this->_out('/Creator '.$this->_textstring($this->creator));
+       $this->_out('/CreationDate '.$this->_textstring('D:'.date('YmdHis')));
+}
+
+function _putcatalog()
+{
+       $this->_out('/Type /Catalog');
+       $this->_out('/Pages 1 0 R');
+       if($this->ZoomMode=='fullpage')
+               $this->_out('/OpenAction [3 0 R /Fit]');
+       elseif($this->ZoomMode=='fullwidth')
+               $this->_out('/OpenAction [3 0 R /FitH null]');
+       elseif($this->ZoomMode=='real')
+               $this->_out('/OpenAction [3 0 R /XYZ null null 1]');
+       elseif(!is_string($this->ZoomMode))
+               $this->_out('/OpenAction [3 0 R /XYZ null null '.($this->ZoomMode/100).']');
+       if($this->LayoutMode=='single')
+               $this->_out('/PageLayout /SinglePage');
+       elseif($this->LayoutMode=='continuous')
+               $this->_out('/PageLayout /OneColumn');
+       elseif($this->LayoutMode=='two')
+               $this->_out('/PageLayout /TwoColumnLeft');
+}
+
+function _putheader()
+{
+       $this->_out('%PDF-'.$this->PDFVersion);
+}
+
+function _puttrailer()
+{
+       $this->_out('/Size '.($this->n+1));
+       $this->_out('/Root '.$this->n.' 0 R');
+       $this->_out('/Info '.($this->n-1).' 0 R');
+}
+
+function _enddoc()
+{
+       $this->_putheader();
+       $this->_putpages();
+       $this->_putresources();
+       //Info
+       $this->_newobj();
+       $this->_out('<<');
+       $this->_putinfo();
+       $this->_out('>>');
+       $this->_out('endobj');
+       //Catalog
+       $this->_newobj();
+       $this->_out('<<');
+       $this->_putcatalog();
+       $this->_out('>>');
+       $this->_out('endobj');
+       //Cross-ref
+       $o=strlen($this->buffer);
+       $this->_out('xref');
+       $this->_out('0 '.($this->n+1));
+       $this->_out('0000000000 65535 f ');
+       for($i=1;$i<=$this->n;$i++)
+               $this->_out(sprintf('%010d 00000 n ',$this->offsets[$i]));
+       //Trailer
+       $this->_out('trailer');
+       $this->_out('<<');
+       $this->_puttrailer();
+       $this->_out('>>');
+       $this->_out('startxref');
+       $this->_out($o);
+       $this->_out('%%EOF');
+       $this->state=3;
+}
+
+function _beginpage($orientation)
+{
+       $this->page++;
+       $this->pages[$this->page]='';
+       $this->state=2;
+       $this->x=$this->lMargin;
+       $this->y=$this->tMargin;
+       $this->FontFamily='';
+       //Page orientation
+       if(!$orientation)
+               $orientation=$this->DefOrientation;
+       else
+       {
+               $orientation=strtoupper($orientation{0});
+               if($orientation!=$this->DefOrientation)
+                       $this->OrientationChanges[$this->page]=true;
+       }
+       if($orientation!=$this->CurOrientation)
+       {
+               //Change orientation
+               if($orientation=='P')
+               {
+                       $this->wPt=$this->fwPt;
+                       $this->hPt=$this->fhPt;
+                       $this->w=$this->fw;
+                       $this->h=$this->fh;
+               }
+               else
+               {
+                       $this->wPt=$this->fhPt;
+                       $this->hPt=$this->fwPt;
+                       $this->w=$this->fh;
+                       $this->h=$this->fw;
+               }
+               $this->PageBreakTrigger=$this->h-$this->bMargin;
+               $this->CurOrientation=$orientation;
+       }
+}
+
+function _endpage()
+{
+       //End of page contents
+       $this->state=1;
+}
+
+function _newobj()
+{
+       //Begin a new object
+       $this->n++;
+       $this->offsets[$this->n]=strlen($this->buffer);
+       $this->_out($this->n.' 0 obj');
+}
+
+function _dounderline($x,$y,$txt)
+{
+       //Underline text
+       $up=$this->CurrentFont['up'];
+       $ut=$this->CurrentFont['ut'];
+       $w=$this->GetStringWidth($txt)+$this->ws*substr_count($txt,' ');
+       return sprintf('%.2f %.2f %.2f %.2f re f',$x*$this->k,($this->h-($y-$up/1000*$this->FontSize))*$this->k,$w*$this->k,-$ut/1000*$this->FontSizePt);
+}
+
+function _parsejpg($file)
+{
+       //Extract info from a JPEG file
+       $a=GetImageSize($file);
+       if(!$a)
+               $this->Error('Missing or incorrect image file: '.$file);
+       if($a[2]!=2)
+               $this->Error('Not a JPEG file: '.$file);
+       if(!isset($a['channels']) || $a['channels']==3)
+               $colspace='DeviceRGB';
+       elseif($a['channels']==4)
+               $colspace='DeviceCMYK';
+       else
+               $colspace='DeviceGray';
+       $bpc=isset($a['bits']) ? $a['bits'] : 8;
+       //Read whole file
+       $f=fopen($file,'rb');
+       $data='';
+       while(!feof($f))
+               $data.=fread($f,4096);
+       fclose($f);
+       return array('w'=>$a[0],'h'=>$a[1],'cs'=>$colspace,'bpc'=>$bpc,'f'=>'DCTDecode','data'=>$data);
+}
+
+function _parsepng($file)
+{
+       //Extract info from a PNG file
+       $f=fopen($file,'rb');
+       if(!$f)
+               $this->Error('Can\'t open image file: '.$file);
+       //Check signature
+       if(fread($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10))
+               $this->Error('Not a PNG file: '.$file);
+       //Read header chunk
+       fread($f,4);
+       if(fread($f,4)!='IHDR')
+               $this->Error('Incorrect PNG file: '.$file);
+       $w=$this->_freadint($f);
+       $h=$this->_freadint($f);
+       $bpc=ord(fread($f,1));
+       if($bpc>8)
+               $this->Error('16-bit depth not supported: '.$file);
+       $ct=ord(fread($f,1));
+       if($ct==0)
+               $colspace='DeviceGray';
+       elseif($ct==2)
+               $colspace='DeviceRGB';
+       elseif($ct==3)
+               $colspace='Indexed';
+       else
+               $this->Error('Alpha channel not supported: '.$file);
+       if(ord(fread($f,1))!=0)
+               $this->Error('Unknown compression method: '.$file);
+       if(ord(fread($f,1))!=0)
+               $this->Error('Unknown filter method: '.$file);
+       if(ord(fread($f,1))!=0)
+               $this->Error('Interlacing not supported: '.$file);
+       fread($f,4);
+       $parms='/DecodeParms <</Predictor 15 /Colors '.($ct==2 ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w.'>>';
+       //Scan chunks looking for palette, transparency and image data
+       $pal='';
+       $trns='';
+       $data='';
+       do
+       {
+               $n=$this->_freadint($f);
+               $type=fread($f,4);
+               if($type=='PLTE')
+               {
+                       //Read palette
+                       $pal=fread($f,$n);
+                       fread($f,4);
+               }
+               elseif($type=='tRNS')
+               {
+                       //Read transparency info
+                       $t=fread($f,$n);
+                       if($ct==0)
+                               $trns=array(ord(substr($t,1,1)));
+                       elseif($ct==2)
+                               $trns=array(ord(substr($t,1,1)),ord(substr($t,3,1)),ord(substr($t,5,1)));
+                       else
+                       {
+                               $pos=strpos($t,chr(0));
+                               if($pos!==false)
+                                       $trns=array($pos);
+                       }
+                       fread($f,4);
+               }
+               elseif($type=='IDAT')
+               {
+                       //Read image data block
+                       $data.=fread($f,$n);
+                       fread($f,4);
+               }
+               elseif($type=='IEND')
+                       break;
+               else
+                       fread($f,$n+4);
+       }
+       while($n);
+       if($colspace=='Indexed' && empty($pal))
+               $this->Error('Missing palette in '.$file);
+       fclose($f);
+       return array('w'=>$w,'h'=>$h,'cs'=>$colspace,'bpc'=>$bpc,'f'=>'FlateDecode','parms'=>$parms,'pal'=>$pal,'trns'=>$trns,'data'=>$data);
+}
+
+function _freadint($f)
+{
+       //Read a 4-byte integer from file
+       $a=unpack('Ni',fread($f,4));
+       return $a['i'];
+}
+
+function _textstring($s)
+{
+       //Format a text string
+       return '('.$this->_escape($s).')';
+}
+
+function _escape($s)
+{
+       //Add \ before \, ( and )
+       return str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$s)));
+}
+
+function _putstream($s)
+{
+       $this->_out('stream');
+       $this->_out($s);
+       $this->_out('endstream');
+}
+
+function _out($s)
+{
+       //Add a line to the document
+       if($this->state==2)
+               $this->pages[$this->page].=$s."\n";
+       else
+               $this->buffer.=$s."\n";
+}
+//End of class
+}
+
+//Handle special IE contype request
+if(isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT']=='contype')
+{
+       header('Content-Type: application/pdf');
+       exit;
+}
+
+}
+?>
diff --git a/images/pdf.png b/images/pdf.png
new file mode 100644
index 0000000..e542731
Binary files /dev/null and b/images/pdf.png differ
diff --git a/index.php b/index.php
index af428da..a185c8d 100644
--- a/index.php
+++ b/index.php
@@ -29,12 +29,9 @@ $default_username = "maj";
 $default_password = "php";
 $default_blog_profile = "This cool site is powered by <a href=http://engels.mortega.net/index.php?entry=20050521000019 target=_blank>My Activity Journal</a>, a dead-simple, <a href=http://php.net/ target=_blank>PHP</a>-based, <a href=http://www.opensource.org/licenses/gpl-license.php target=_blank>GPL</a>'ed blog written from scratch as a spare time family project by <a href=http://engels.mortega.net/ target=_blank>Engels</a>, <a href=http://gaffud.com/ target=_blank>Magie</a>, and <a href=http://psylocke.org/ target=_blank>Psylocke</a> Antonio.";
 $default_blog_author = "My Activity Journal";
-$default_blog_email = "root@localhost";
 
 if (!file_exists("data")) {
        mkdir("data");
-       chmod("data", 0777);
-       chmod("images/smileys", 0777);
 }
 
 if (!file_exists("data/.htaccess")) {
@@ -48,14 +45,12 @@ if (!file_exists("data/title.txt")) {
        $fp_default_title_txt = fopen("data/title.txt","w");
        fwrite($fp_default_title_txt, $default_blog_title);
        fclose($fp_default_title_txt);
-       chmod("data/title.txt", 0666);
 }
 
 if (!file_exists("data/username.txt")) {
        $fp_htaccess_txt = fopen("data/username.txt","w");
        fwrite($fp_htaccess_txt, $default_username);
        fclose($fp_htaccess_txt);
-       chmod("data/username.txt", 0666);
 }
 
 if (!file_exists("data/password.txt")) {
@@ -65,33 +60,23 @@ if (!file_exists("data/password.txt")) {
        $fp_htaccess_txt = fopen("data/password.txt","w");
        fwrite($fp_htaccess_txt, $default_password);
        fclose($fp_htaccess_txt);
-       chmod("data/password.txt", 0666);
 }
 
 if (!file_exists("data/profile.php")) {
        $fp_default_profile_txt = fopen("data/profile.php","w");
        fwrite($fp_default_profile_txt, $default_blog_profile);
        fclose($fp_default_profile_txt);
-       chmod("data/profile.php", 0666);
 }
 
 if (!file_exists("data/author.txt")) {
        $fp_default_author_txt = fopen("data/author.txt","w");
        fwrite($fp_default_author_txt, $default_blog_author);
        fclose($fp_default_author_txt);
-       chmod("data/author.txt", 0666);
-}
-
-if (!file_exists("data/email.txt")) {
-       $fp_default_email_txt = fopen("data/email.txt","w");
-       fwrite($fp_default_email_txt, $default_blog_email);
-       fclose($fp_default_email_txt);
-       chmod("data/email.txt", 0666);
 }
 
 $login_username = file_get_contents("data/username.txt");
 
-if (!isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+if ((!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
        $global_hits_file = fopen("data/hits.txt", "r");
        $global_hits_count = fread($global_hits_file, filesize("data/hits.txt"));
        fclose($global_hits_file);
@@ -99,7 +84,6 @@ if (!isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_usernam
        $global_hits_file = fopen("data/hits.txt", "w");
        fwrite($global_hits_file, $global_hits_count);
        fclose($global_hits_file);
-       chmod("data/hits.txt", 0666);
 }
 
 $agent = $_SERVER['HTTP_USER_AGENT'];
@@ -112,7 +96,6 @@ if (@ereg("Google", $agent)) {
        $google_hits_file = fopen("data/google.txt", "w");
        fwrite($google_hits_file, $google_hits_count);
        fclose($google_hits_file);
-       chmod("data/google.txt", 0666);
 }
 
 function str_rand($length = 8, $seeds = 'abcdefghijklmnopqrstuvwxyz0123456789')
@@ -163,14 +146,26 @@ if (isset($_REQUEST['download']) and !empty($_REQUEST['download'])) {
        die();
 }
 
-function go_download($entry_filedrop) {
+function go_download($dl_file) {
        $d = $_REQUEST['entry'];
+
+       if (isset($_REQUEST['type']) and !empty($_REQUEST['type']) and ($_REQUEST['type'] == pdf)) {
+               $dl_path = "data/items/$d/pdf/file";
+               $count_path = "data/items/$d/pdf/count";
+               $count_file = "dl.txt";
+       }
+       if (isset($_REQUEST['type']) and !empty($_REQUEST['type']) and ($_REQUEST['type'] == filedrop)) {
+               $dl_path = "data/items/$d/filedrop/files";
+               $count_path = "data/items/$d/filedrop/count";
+               $count_file = "{$dl_file}.txt";
+       }      
+
        header("Cache-Control: ");
        header("Pragma: ");
        header("Content-type: application/octet-stream");
-       header("Content-Disposition: attachment; filename=\"" . $entry_filedrop . "\"");
-       header("Content-length: " . filesize("data/items/$d/filedrop/files/$entry_filedrop"));
-       $get_it = fopen("data/items/$d/filedrop/files/$entry_filedrop", 'rb');
+       header("Content-Disposition: attachment; filename=\"" . $dl_file . "\"");
+       header("Content-length: " . filesize("$dl_path/$dl_file"));
+       $get_it = fopen("$dl_path/$dl_file", 'rb');
 
        while (!feof($get_it)) {
                $buf = fread($get_it, 4096);
@@ -178,15 +173,13 @@ function go_download($entry_filedrop) {
                $bytes_sent+=strlen($buf);
        }
 
-       if ($bytes_sent==filesize("data/items/$d/filedrop/files/$entry_filedrop")) {
+       if ($bytes_sent==filesize("$dl_path/$dl_file")) {
 
-               $filedrop_dl_count_dir = 'data/items/' . $_REQUEST['entry'] . '/filedrop/count';
-               if (!file_exists($filedrop_dl_count_dir)) {
-                       mkdir($filedrop_dl_count_dir);
-                       chmod($filedrop_dl_count_dir, 0777);
+               if (!file_exists($count_path)) {
+                       mkdir($count_path);
                }
 
-               $unique_downloads = $filedrop_dl_count_dir . '/' . $entry_filedrop . '.txt';
+               $unique_downloads = "$count_path/$count_file";
                $fp_unique_downloads = fopen($unique_downloads, "r");
                $count_unique_downloads = fread($fp_unique_downloads, filesize($unique_downloads));
                fclose($fp_unique_downloads);
@@ -194,7 +187,6 @@ function go_download($entry_filedrop) {
                $fp_unique_downloads = fopen($unique_downloads, "w");
                fwrite($fp_unique_downloads, $count_unique_downloads);
                fclose($fp_unique_downloads);
-               chmod($unique_downloads, 0666);
        }
 }
 
@@ -229,7 +221,6 @@ if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST
                                $fp_comment_count_txt = fopen("data/comments/pending/$pending_comment_flag_dir/count.txt","w");
                                fwrite($fp_comment_count_txt, $comment_count_value);
                                fclose($fp_comment_count_txt);
-                               chmod("data/comments/pending/$pending_comment_flag_dir/count.txt", 0666);
                        }
 
                        header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '?entry=' . $_REQUEST['entry'] . '&show=comments');
@@ -246,7 +237,7 @@ if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
                readfile($title);
                echo '</title>';
                $views = $check . '/views.txt';
-               if (!isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+               if ((!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
                        $fp_views = fopen($views, "r");
                        $count_views = fread($fp_views, filesize($views));
                        fclose($fp_views);
@@ -254,23 +245,19 @@ if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
                        $fp_views = fopen($views, "w");
                        fwrite($fp_views, $count_views);
                        fclose($fp_views);
-                       chmod($views, 0666);
                }
               
                if (isset($_REQUEST['show']) and !empty($_REQUEST['show']) and isset($_REQUEST['capcha_put']) and !empty($_REQUEST['capcha_get']) and isset($_REQUEST['firstname']) and !empty($_REQUEST['firstname']) and isset($_REQUEST['lastname']) and !empty($_REQUEST['lastname']) and isset($_REQUEST['email']) and !empty($_REQUEST['email']) and isset($_REQUEST['new_comment']) and !empty($_REQUEST['new_comment']) and isset($_REQUEST['capcha_put']) and !empty($_REQUEST['capcha_put']) and ($_REQUEST['capcha_get'] == $_REQUEST['capcha_put']) and (ereg("@", $_REQUEST['email'])) and (ereg("\.", $_REQUEST['email']))) {
               
                if (!file_exists("$check/comments")) {
                        mkdir("$check/comments");
-                       chmod("$check/comments", 0777);
                }
                if (!file_exists("$check/comments/pending")) {
                        mkdir("$check/comments/pending");
-                       chmod("$check/comments/pending", 0777);
                }
 
                if (!file_exists("$check/comments/live")) {
                        mkdir("$check/comments/live");
-                       chmod("$check/comments/live", 0777);
                }
 
                // GNU date format
@@ -282,7 +269,6 @@ if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
                $comment_entry_dir = date("YmdHis", time() + $offset);
 
                mkdir("$check/comments/pending/$comment_entry_dir");
-               chmod("$check/comments/pending/$comment_entry_dir", 0777);
 
                $body_content = ucfirst($_REQUEST['new_comment']);
                $body_content = htmlentities($body_content, ENT_NOQUOTES);
@@ -311,17 +297,14 @@ if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
                $body_content = str_replace(';)', '<img src=images/smileys/wink.png border=0>', $body_content);
 
                $fp_body_txt = fopen("$check/comments/pending/$comment_entry_dir/comment.txt","w");
-               chmod($fp_body_txt, 0666);
                fwrite($fp_body_txt,$body_content);
                fclose($fp_body_txt);
 
                $fp_timestamp_txt = fopen("$check/comments/pending/$comment_entry_dir/timestamp.txt","w");
-               chmod($fp_timestamp_txt, 0666);
                fwrite($fp_timestamp_txt,$timestamp);
                fclose($fp_timestamp_txt);
 
                $fp_firstname_txt = fopen("$check/comments/pending/$comment_entry_dir/firstname.txt","w");
-               chmod($fp_firstname_txt, 0666);
                $firstname = ucwords($_REQUEST['firstname']);
                $firstname = trim($firstname);
                $firstname = htmlentities($firstname, ENT_NOQUOTES);
@@ -329,7 +312,6 @@ if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
                fclose($fp_firstname_txt);
 
                $fp_lastname_txt = fopen("$check/comments/pending/$comment_entry_dir/lastname.txt","w");
-               chmod($fp_lastname_txt, 0666);
                $lastname = ucwords($_REQUEST['lastname']);
                $lastname = trim($lastname);
                $lastname = htmlentities($lastname, ENT_NOQUOTES);
@@ -337,7 +319,6 @@ if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
                fclose($fp_lastname_txt);
 
                $fp_email_txt = fopen("$check/comments/pending/$comment_entry_dir/email.txt","w");
-               chmod($fp_email_txt, 0666);
                $email = str_replace('@', ' at ', $_REQUEST['email']);
                $email = strtolower($email);
                $email = trim($email);
@@ -347,7 +328,6 @@ if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
 
                if (isset($_REQUEST['url']) and !empty($_REQUEST['url']) and (ereg("\.", $_REQUEST['url']))) {
                        $fp_url_txt = fopen("$check/comments/pending/$comment_entry_dir/url.txt","w");
-                       chmod($fp_url_txt, 0666);
                        $url = str_replace('http://', '', $_REQUEST['url']);
                        $url = strtolower($url);
                        $url = trim($url);
@@ -359,7 +339,6 @@ if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
 
                $key_rand = str_rand(14);
                $fp_key_txt = fopen("$check/comments/pending/$comment_entry_dir/key.txt","w");
-               chmod($fp_key_txt, 0666);
                fwrite($fp_key_txt,$key_rand);
                fclose($fp_key_txt);
 
@@ -378,10 +357,12 @@ if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
                $email_to = strtolower($_REQUEST['email']);
                $email_to = $firstname . " " . $lastname . ' <' . $email_to . '>';
 
-               $from_email_file = "data/email.txt";
-               $fp_from_email = fopen($from_email_file, "r");
-               $from_email = fread($fp_from_email, filesize($from_email_file));
-               fclose($fp_from_email);
+               if (file_exists("data/email.txt")) {
+                       $from_email_file = "data/email.txt";
+                       $fp_from_email = fopen($from_email_file, "r");
+                       $from_email = fread($fp_from_email, filesize($from_email_file));
+                       fclose($fp_from_email);
+               }
 
                $mailer = 'MAJ/0.14 (PHP/' . phpversion() . ')';
 
@@ -390,7 +371,7 @@ if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
                $commented_entry_title = fread($fp_commented_entry_title, filesize($commented_entry_title_file));
                fclose($fp_commented_entry_title);
 
-               if (!file_exists("data/nak.txt")) {
+               if (!file_exists("data/nak.txt") and file_exists("data/email.txt")) {
                        $comment_thanks = "Hi $firstname,\n\nThanks for submitting the following comment last $timestamp:\n\n\"$comment_quote\"\n\nIt will be e-mailed to me first for approval. Please visit the following URL to see if it has been posted:\n\n{$sig_url}index.php?entry={$_REQUEST['entry']}&show=comments\n\nThanks again! =)\n\n--\n$sig_author\n$sig_url\n";
 
                        $comment_thanks = wordwrap($comment_thanks);
@@ -401,30 +382,29 @@ if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
                                "X-Mailer: $mailer");
                }
 
-               $comment_notice = "The following comment was submitted by $email_to last $timestamp for the entry \"$commented_entry_title\":\n\n\"$comment_quote\"\n\nVisit the link below to approve and post this pending comment:\n\n{$sig_url}index.php?entry={$_REQUEST['entry']}&comment={$comment_entry_dir}&key={$key_rand}&action=approve\n\nVisit the link below to disapprove and delete this pending comment:\n\n{$sig_url}index.php?entry={$_REQUEST['entry']}&comment={$comment_entry_dir}&key={$key_rand}&action=delete\n\nYou can also approve or disapprove pending comments at a later time by logging on to your blog.";
+               if (file_exists("data/email.txt")) {
+                       $comment_notice = "The following comment was submitted by $email_to last $timestamp for the entry \"$commented_entry_title\":\n\n\"$comment_quote\"\n\nVisit the link below to approve and post this pending comment:\n\n{$sig_url}index.php?entry={$_REQUEST['entry']}&comment={$comment_entry_dir}&key={$key_rand}&action=approve\n\nVisit the link below to disapprove and delete this pending comment:\n\n{$sig_url}index.php?entry={$_REQUEST['entry']}&comment={$comment_entry_dir}&key={$key_rand}&action=delete\n\nYou can also approve or disapprove pending comments at a later time by logging on to your blog.";
 
-               $comment_notice = wordwrap($comment_notice);
+                       $comment_notice = wordwrap($comment_notice);
 
-               mail($from_email, "Pending Blog Comment", $comment_notice,
-                       "From: $from_email\r\n" .
-                       "Reply-To: $from_email\r\n" .
-                       "X-Mailer: $mailer");
+                       mail($from_email, "Pending Blog Comment", $comment_notice,
+                               "From: $from_email\r\n" .
+                               "Reply-To: $from_email\r\n" .
+                               "X-Mailer: $mailer");
+               }
 
                if (!file_exists("data/comments")) {
                        mkdir("data/comments");
-                       chmod("data/comments", 0777);
                }
 
                if (!file_exists("data/comments/pending")) {
                        mkdir("data/comments/pending");
-                       chmod("data/comments/pending", 0777);
                }
 
                $pending_comment_flag = $_REQUEST['entry'];
 
                if (!file_exists("data/comments/pending/$pending_comment_flag")) {
                        mkdir("data/comments/pending/$pending_comment_flag");
-                       chmod("data/comments/pending/$pending_comment_flag", 0777);
                }
 
                $fp_comment_count_txt = fopen("data/comments/pending/$pending_comment_flag/count.txt","r");
@@ -434,19 +414,28 @@ if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
                $fp_comment_count_txt = fopen("data/comments/pending/$pending_comment_flag/count.txt","w");
                fwrite($fp_comment_count_txt, $comment_count_value);
                fclose($fp_comment_count_txt);
-               chmod("data/comments/pending/$pending_comment_flag/count.txt", 0666);
 
                }
 
        }
        else {
                echo '<title>' . $default_title . '</title>';
-               $filter = "*";
+               if (isset($_REQUEST['archive']) and !empty($_REQUEST['archive'])) {
+                       $filter = $_REQUEST['archive'] . "*";
+               }
+               else {
+                       $filter = "*";
+               }
        }
 }
 else {
        echo '<title>' . $default_title . '</title>';
-       $filter = "*";
+       if (isset($_REQUEST['archive']) and !empty($_REQUEST['archive'])) {
+               $filter = $_REQUEST['archive'] . "*";
+       }
+       else {
+               $filter = "*";
+       }
 }
 
 ?>
@@ -464,7 +453,7 @@ else {
        echo "#666666";
 }
 ?>;
-       margin: 10px;
+       margin: 0px 0px 10px 10px;
        padding: 0px;
        text-align: left;
        font-family: verdana, helvetica, sans-serif;
@@ -587,7 +576,7 @@ else {
        echo "transparent";
 }
 ?>;
-       margin: 0px;
+       margin: 10px 0px 0px 0px;
        border-color: <?php
 if (file_exists("data/colors/border.txt")) {
        $panel_title_border_color = file_get_contents("data/colors/border.txt");
@@ -671,6 +660,7 @@ else {
 ?>;
        border-width: 0px 1px 1px 1px;
        border-style: none solid solid solid;
+       text-align: right;
 }
 .input {      
        color: <?php
@@ -782,7 +772,7 @@ if (file_exists("images/profile.png")) {
 include("data/profile.php");
 ?>
 </div>
-<p></p>
+
 <div id=panel_title>Navigation</div>
 <div id=panel_body>
 <a href="<?php echo $_SERVER['PHP_SELF']; ?>">Home</a><br>
@@ -803,21 +793,18 @@ else {
 
 </div>
 
-
-<p></p>
-
 <?php
 if (file_exists("data/sticky")) {
        if ($dh_sticky_list = opendir("data/sticky")) {
                while (($entry_sticky_list = readdir($dh_sticky_list)) !== false) {
 
-                       if (file_exists("data/items/$entry_sticky_list/private.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+                       if (file_exists("data/items/$entry_sticky_list/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
                                continue;
                        }
 
                        $get_cat_dir = file_get_contents("data/items/$entry_sticky_list/category.txt");
 
-                       if (file_exists("data/categories/$get_cat_dir/private.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username) and !file_exists("data/items/$entry_sticky_list/cat.txt")) {
+                       if (file_exists("data/categories/$get_cat_dir/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$entry_sticky_list/cat.txt")) {
                                continue;
                        }
 
@@ -847,14 +834,14 @@ if (file_exists("data/sticky")) {
 }
 ?>
 
-<p></p>
+
 
 <?php
 if (file_exists("data/panels")) {
        if ($dh_panel_list = opendir("data/panels")) {
                while (($entry_panel_list = readdir($dh_panel_list)) !== false) {
 
-                       if (file_exists("data/panels/$entry_panel_list/private.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+                       if (file_exists("data/panels/$entry_panel_list/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
                                continue;
                        }
 
@@ -875,13 +862,13 @@ if (file_exists("data/panels")) {
                        readfile("data/panels/$panel_list_entry/title.txt");
                        echo '</div><div id=panel_body>';
                        include("data/panels/$panel_list_entry/panel.php");
-                       echo '</div><p></p>';
+                       echo '</div>';
                }
        }
 }
 ?>
 
-</td><td width=15></td><td valign=top width=525>
+</td><td width=15>&nbsp;</td><td valign=top width=525>
 
 <?php
 
@@ -889,17 +876,17 @@ if (is_dir($dir)) {
        if ($dh = opendir($dir)) {
                while (($entry_main = readdir($dh)) !== false) {
 
-                       if (file_exists("data/items/$entry_main/private.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+                       if (file_exists("data/items/$entry_main/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
                                continue;
                        }
 
                        $cat_dir = file_get_contents("data/items/$entry_main/category.txt");
 
-                       if (file_exists("data/categories/$cat_dir/private.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username) and !file_exists("data/items/$entry_main/cat.txt")) {
+                       if (file_exists("data/categories/$cat_dir/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$entry_main/cat.txt")) {
                                continue;
                        }
 
-                       if (file_exists("data/nocat.txt") and file_exists("data/items/$entry_main/category.txt") and !file_exists("data/items/$entry_main/cat.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username) and (!isset($_REQUEST['category']) or empty($_REQUEST['category'])) and (!isset($_REQUEST['entry']) or empty($_REQUEST['entry']))) {
+                       if (file_exists("data/nocat.txt") and file_exists("data/items/$entry_main/category.txt") and !file_exists("data/items/$entry_main/cat.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and (!isset($_REQUEST['category']) or empty($_REQUEST['category'])) and (!isset($_REQUEST['entry']) or empty($_REQUEST['entry']))) {
                                continue;
                        }
 
@@ -961,11 +948,11 @@ foreach ($disp as $d) {
                }
        }
 
-       if (file_exists("$dir/$d/private.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+       if (file_exists("$dir/$d/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
                continue;
        }
 
-       echo '<p><table border=0 cellspacing=0 cellpadding=0 bgcolor=#CCCCCC style="background-color: transparent;"><tr><td width=525><div id=panel_title>';
+       echo '<table border=0 cellspacing=0 cellpadding=0 bgcolor=#CCCCCC style="background-color: transparent;"><tr><td width=525><div id=panel_title>';
        readfile("$dir/$d/title.txt");
       
        if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
@@ -1009,6 +996,17 @@ foreach ($disp as $d) {
        }
 
        echo '</div><div id=panel_body>';
+
+       if (file_exists("$dir/$d/passwd.txt")) {
+               $passwd = file_get_contents("$dir/$d/passwd.txt");
+       }
+
+       if (isset($_REQUEST['passwd']) and !empty($_REQUEST['passwd'])) {
+               $crypt_passwd = sha1($_REQUEST['passwd']);
+               $crypt_passwd = md5($crypt_passwd);
+               $crypt_passwd = crypt($crypt_passwd, $crypt_passwd);
+       }
+
        echo '<font style="font-size: 10px; color: #999999;">';
        readfile("$dir/$d/date.txt");
        if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
@@ -1032,14 +1030,6 @@ foreach ($disp as $d) {
        }
        echo '</font><font style="font-size: 5px;"><br><br></font>';
 
-       if (file_exists("$dir/$d/passwd.txt")) {
-               $passwd = file_get_contents("$dir/$d/passwd.txt");
-       }
-       if (isset($_REQUEST['passwd']) and !empty($_REQUEST['passwd'])) {
-               $crypt_passwd = sha1($_REQUEST['passwd']);
-               $crypt_passwd = md5($crypt_passwd);
-               $crypt_passwd = crypt($crypt_passwd, $crypt_passwd);
-       }
        if (file_exists("$dir/$d/passwd.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and (!isset($_REQUEST['passwd']) or ($crypt_passwd != $passwd))) {
                echo "This entry is password protected. If you know the magic word, click <a href=passwd.php?entry=$d>here</a> to enter it.";
        }
@@ -1048,7 +1038,6 @@ foreach ($disp as $d) {
        }
 
        echo '</div><div id=panel_footer>';
-       echo '<table border=0 cellspacing=0 cellpadding=0 width=513><tr><td align=right>';
        echo '<font style="font-size: 10px; color: ';
        if (file_exists("data/colors/pf-font.txt")) {
                readfile("data/colors/pf-font.txt");
@@ -1136,10 +1125,9 @@ else {
 
        if (file_exists("images/$d/album") and isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['show']) and !empty($_REQUEST['show']) and ($_REQUEST['show'] == album)) {
                if (!file_exists("$dir/$d/album")) {
-                       mkdir("$dir/$d/album", 0777);
-                       chmod("$dir/$d/album", 0777);
+                       mkdir("$dir/$d/album");
                }
-               if (!isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+               if ((!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
                        $fp_album_views_txt = fopen("$dir/$d/album/views.txt","r");
                        $album_views_value = fread($fp_album_views_txt,filesize("$dir/$d/album/views.txt"));
                        fclose($fp_album_views_txt);
@@ -1147,7 +1135,6 @@ else {
                        $fp_album_views_txt = fopen("$dir/$d/album/views.txt","w");
                        fwrite($fp_album_views_txt, $album_views_value);
                        fclose($fp_album_views_txt);
-                       chmod("$dir/$d/album/views.txt", 0666);
                }
        }
 
@@ -1169,9 +1156,9 @@ else {
        }
        else {
                if ($dh_filedrop = opendir("data/items/$d/filedrop/files")) {
-                       while (($entry_filedrop = readdir($dh_filedrop)) !== false) {
-                               if ($entry_filedrop != "." && $entry_filedrop != ".." && fnmatch("*", $entry_filedrop)) {
-                                       $items_filedrop[] = $entry_filedrop;
+                       while (($dl_file = readdir($dh_filedrop)) !== false) {
+                               if ($dl_file != "." && $dl_file != ".." && fnmatch("*", $dl_file)) {
+                                       $items_filedrop[] = $dl_file;
                                }
                        }
                closedir($dh_filedrop);
@@ -1193,10 +1180,9 @@ else {
 
        if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['show']) and !empty($_REQUEST['show']) and ($_REQUEST['show'] == filedrop)) {
                if (!file_exists("$dir/$d/filedrop")) {
-                       mkdir("$dir/$d/filedrop", 0777);
-                       chmod("$dir/$d/filedrop", 0777);
+                       mkdir("$dir/$d/filedrop");
                }
-               if (!isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+               if (file_exists("data/items/$d/filedrop/files") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
                        $fp_filedrop_views_txt = fopen("$dir/$d/filedrop/views.txt","r");
                        $filedrop_views_value = fread($fp_filedrop_views_txt,filesize("$dir/$d/filedrop/views.txt"));
                        fclose($fp_filedrop_views_txt);
@@ -1204,7 +1190,6 @@ else {
                        $fp_filedrop_views_txt = fopen("$dir/$d/filedrop/views.txt","w");
                        fwrite($fp_filedrop_views_txt, $filedrop_views_value);
                        fclose($fp_filedrop_views_txt);
-                       chmod("$dir/$d/filedrop/views.txt", 0666);
                }
        }
 
@@ -1221,15 +1206,38 @@ else {
                echo ' ';
        }
 
+       if (!file_exists("data/nopdf.txt") and file_exists("$dir/$d/pdf/file")) {
+
+               echo "| <a href={$_SERVER['PHP_SELF']}?entry=$d&show=pdf>pdf</a> ";
+
+               if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
+                       $pdf_views_value = file_get_contents("$dir/$d/pdf/count/views.txt");
+                       $pdf_views_value = $pdf_views_value + 1;
+                       $fp_pdf_views_txt = fopen("$dir/$d/pdf/count/views.txt","w");
+                       fwrite($fp_pdf_views_txt, $pdf_views_value);
+                       fclose($fp_pdf_views_txt);
+               }
+
+               $pdf_views_value = file_get_contents("$dir/$d/pdf/count/views.txt");
+               if ($pdf_views_value == 1) {
+                       echo ' ( ' . $pdf_views_value . ' view ) ';
+               }
+               elseif ($pdf_views_value > 1) {
+                       echo ' ( ' . $pdf_views_value . ' views ) ';
+               }
+               else {
+                       echo ' ';
+               }
+       }
+
        if (!file_exists("data/nocomment.txt")) {
-               echo '| <a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '>permalink</a>';
+               echo '| <a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '>permalink</a></font>';
        }
-       echo '</font></td></tr></table></div>';
 
-       echo '</td></tr></table></p>';
+       echo '</div></td></tr></table>';
 
-       if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['show']) and !empty($_REQUEST['show']) and ($_REQUEST['show'] == album)) {
-               echo '<p><table border=0 cellspacing=0 cellpadding=0 width=525><tr><td>';
+       if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['show']) and !empty($_REQUEST['show']) and ($_REQUEST['show'] == album) and file_exists("images/$d/album")) {
+               echo '<table border=0 cellspacing=0 cellpadding=0 width=525><tr><td>';
                echo '<div id=panel_title>Album';
                if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
                        echo '<a href=del.php?entry=';
@@ -1323,8 +1331,7 @@ else {
                                                        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);
+                                                               mkdir("images/$d/thumbnails");
                                                        }
       
                                                        imagejpeg($work_thumb, "images/$d/thumbnails/{$album_entry}-thumbnail.jpg", 80);
@@ -1351,12 +1358,12 @@ else {
                                }
                        }
                }
-               echo '</div></td></tr></table></p>';
+               echo '</div></td></tr></table>';
 
        }
 
-       if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['show']) and !empty($_REQUEST['show']) and ($_REQUEST['show'] == filedrop)) {
-               echo '<p><table border=0 cellspacing=0 cellpadding=0 width=525><tr><td>';
+       if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['show']) and !empty($_REQUEST['show']) and ($_REQUEST['show'] == filedrop) and file_exists("$dir/$d/filedrop/files")) {
+               echo '<table border=0 cellspacing=0 cellpadding=0 width=525><tr><td>';
                echo '<div id=panel_title>Filedrop';
                if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
                        echo '<a href=del.php?entry=';
@@ -1371,18 +1378,18 @@ else {
                else {
 
                        if ($dh_filedrop = opendir("data/items/$d/filedrop/files")) {
-                               while (($entry_filedrop = readdir($dh_filedrop)) !== false) {
-                                       if ($entry_filedrop != "." && $entry_filedrop != ".." && fnmatch("*", $entry_filedrop)) {
+                               while (($dl_file = readdir($dh_filedrop)) !== false) {
+                                       if ($dl_file != "." && $dl_file != ".." && fnmatch("*", $dl_file)) {
                                                echo '<table border=0 cellspacing=0 cellpadding=4><tr><td>';
-                                               echo '<a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '&download=' . $entry_filedrop. '>';
+                                               echo '<a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '&download=' . $dl_file. '&type=filedrop>';
                                                echo '<img src=images/filedrop.png width=36 height=36 border=0 alt="download file"></a></td>';
                                                echo '<td><p><b>';
-                                               echo $entry_filedrop;
+                                               echo $dl_file;
                                                echo'</b><br>';
-                                               $size = filesize("data/items/$d/filedrop/files/$entry_filedrop");
+                                               $size = filesize("data/items/$d/filedrop/files/$dl_file");
                                                $size_string = ($size > 512)?(  ($size/1024 > 512)  ?sprintf("%.02f MB",($size/1024)/1024)  :sprintf("%.02f KB",$size/1024))  :sprintf("%d B",$size);
                                                echo $size_string;
-                                               $filedrop_count_file = "data/items/$d/filedrop/count/$entry_filedrop" . '.txt';
+                                               $filedrop_count_file = "data/items/$d/filedrop/count/$dl_file" . '.txt';
                                                if (file_exists($filedrop_count_file)) {
                                                        $fp_filedrop_count = fopen($filedrop_count_file, "r");
                                                        $filedrop_count = fread($fp_filedrop_count, filesize($filedrop_count_file));
@@ -1402,7 +1409,57 @@ else {
                        closedir($dh_filedrop);
                        }
                }
-               echo '</div></td></tr></table></p>';
+               echo '</div></td></tr></table>';
+       }
+
+       if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['show']) and !empty($_REQUEST['show']) and ($_REQUEST['show'] == pdf) and file_exists("data/items/$d/pdf/file")) {
+               echo '<table border=0 cellspacing=0 cellpadding=0 width=525><tr><td>';
+               echo '<div id=panel_title>PDF';
+               if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
+                       echo '<a href=del.php?entry=';
+                       echo $d;
+                       echo '&target=pdf><img src=images/widget.del.png border=0 width=11 height=11 align=right alt="delete pdf"></a>';
+               }
+               echo '</div><div id=panel_body>';
+
+               if (file_exists("$dir/$d/passwd.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and (!isset($_REQUEST['passwd']) or ($crypt_passwd != $passwd))) {
+                       echo "This entry is password protected. If you know the magic word, click <a href=passwd.php?entry=$d&show=pdf>here</a> to enter it.";
+               }
+               else {
+
+                       if ($dh_pdf = opendir("data/items/$d/pdf/file")) {
+                               while (($dl_file = readdir($dh_pdf)) !== false) {
+                                       if ($dl_file != "." && $dl_file != ".." && fnmatch("*", $dl_file)) {
+                                               echo '<table border=0 cellspacing=0 cellpadding=4><tr><td>';
+                                               echo '<a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '&download=' . $dl_file. '&type=pdf>';
+                                               echo '<img src=images/pdf.png width=48 height=48 border=0 alt="download file"></a></td>';
+                                               echo '<td><p><b>';
+                                               echo $dl_file;
+                                               echo'</b><br>';
+                                               $size = filesize("data/items/$d/pdf/file/$dl_file");
+                                               $size_string = ($size > 512)?(  ($size/1024 > 512)  ?sprintf("%.02f MB",($size/1024)/1024)  :sprintf("%.02f KB",$size/1024))  :sprintf("%d B",$size);
+                                               echo $size_string;
+                                               $pdf_count_file = "data/items/$d/pdf/count/dl.txt";
+                                               if (file_exists($pdf_count_file)) {
+                                                       $fp_pdf_count = fopen($pdf_count_file, "r");
+                                                       $pdf_count = fread($fp_pdf_count, filesize($pdf_count_file));
+                                                       fclose($fp_pdf_count);
+                                                       echo '<br>';
+                                                       echo $pdf_count;
+                                                       if ($pdf_count == 1) {
+                                                               echo ' download';
+                                                       }
+                                                       if ($pdf_count > 1) {
+                                                               echo ' downloads';
+                                                       }
+                                               }
+                                               echo '</p></td></tr></table>';
+                                       }
+                               }
+                       closedir($dh_pdf);
+                       }
+               }
+               echo '</div></td></tr></table>';
        }
 
        if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['show']) and !empty($_REQUEST['show']) and ($_REQUEST['show'] == comments) and !file_exists("data/nocomment.txt")) {
@@ -1410,7 +1467,7 @@ else {
                if (file_exists("$dir/$d/passwd.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and (!isset($_REQUEST['passwd']) or ($crypt_passwd != $passwd))) {
                }
                else {
-                       echo '<p><table border=0 cellspacing=0 cellpadding=0 width=525><tr><td>';
+                       echo '<table border=0 cellspacing=0 cellpadding=0 width=525><tr><td>';
                        if ($dh_comments = opendir("$dir/$d/comments/live")) {
                                while (($entry_comments = readdir($dh_comments)) !== false) {
                                        if ($entry_comments != "." && $entry_comments != ".." && fnmatch("*", $entry_comments)) {                                       $show_comments[] = $entry_comments;
@@ -1461,25 +1518,34 @@ else {
                                }
                                echo '</font><font style="font-size: 5px;"><br><br></font>';
                                readfile("$dir/$d/comments/live/$comment/comment.txt");
-                               echo '</div><p></p>';
+                               echo '</div>';
                        }
                        unset($show_comments);
-                       echo '</td></tr></table></p>';
+                       echo '</td></tr></table>';
                }
 
 if (!file_exists("data/nocomment.txt")) {
 
-               echo '<table border=0 cellspacing=0 cellpadding=0 width=525><tr><td>';
-               echo '<p></p><p><font style="font-size: 12px;"><b>Add Comment</b></font></p>';
+               echo '<p><table border=0 cellspacing=0 cellpadding=0 width=525><tr><td>';
+               echo '<p><font style="font-size: 12px;"><b>Add Comment</b></font></p>';
 
                if (file_exists("$dir/$d/passwd.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and (!isset($_REQUEST['passwd']) or ($crypt_passwd != $passwd))) {
-                       echo "This entry is password protected. If you know the magic word, click <a href=passwd.php?entry=$d&show=comments>here</a> to enter it.";
+                       echo "<p>This entry is password protected. If you know the magic word, click <a href=passwd.php?entry=$d&show=comments>here</a> to enter it.</p>";
                }
                else {
       
                        $capcha_rand = str_rand(7);
       
-                       echo '<p>Fill out the form below and enter <b>' . $capcha_rand . '</b> in the anti-spam field to add your comment. Note that it will not be posted immediately, but will be e-mailed to me first.<br><br>';
+                       echo '<p>Fill out the form below and enter <b>' . $capcha_rand . '</b> in the anti-spam field to add your comment. Note that it will not be posted immediately, but will be ';
+                      
+                       if (file_exists("data/email.txt")) {
+                               echo "e-mailed";
+                       }
+                       else {
+                               echo "sent";
+                       }
+
+                       echo ' to me first.</p>';
       
                        ?>
                       
@@ -1516,7 +1582,7 @@ if (!file_exists("data/nocomment.txt")) {
 
 if (!isset($_SESSION['logged_in'])) {
        if (isset($_REQUEST['show']) and !empty($_REQUEST['show']) and isset($_REQUEST['capcha_put']) and !empty($_REQUEST['capcha_get']) and isset($_REQUEST['firstname']) and !empty($_REQUEST['firstname']) and isset($_REQUEST['lastname']) and !empty($_REQUEST['lastname']) and isset($_REQUEST['email']) and !empty($_REQUEST['email']) and isset($_REQUEST['new_comment']) and !empty($_REQUEST['new_comment']) and isset($_REQUEST['capcha_put']) and !empty($_REQUEST['capcha_put']) and ($_REQUEST['capcha_get'] == $_REQUEST['capcha_put']) and (ereg("@", $_REQUEST['email'])) and (ereg("\.", $_REQUEST['email']))) {
-               echo '<p><table border=0 cellspacing=0 cellpadding=0><tr><td><p><font style="font-size: 12px;"><b>Thanks!</b></font></p><p>Your comment has been submitted for approval.<br>Please check back soon to see if it has been posted.</p></td></tr></table>';
+               echo '<p><table border=0 cellspacing=0 cellpadding=0><tr><td><p><font style="font-size: 12px;"><b>Thanks!</b></font></p><p>Your comment has been submitted for approval.<br>Please check back soon to see if it has been posted.</p></td></tr></table></p>';
        }
 }
  ?>
@@ -1585,7 +1651,7 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username
                        readfile("$dir/$d/comments/pending/$pending_comment/timestamp.txt");
                        echo '</font><font style="font-size: 5px;"><br><br></font>';
                        readfile("$dir/$d/comments/pending/$pending_comment/comment.txt");
-                       echo '</div><p></p>';
+                       echo '</div>';
                        unset($show_pending_comments);
                        echo '</td></tr></table></p>';
                }
@@ -1598,17 +1664,23 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username
 <?php
 if (($start >= $increase) and ($start != 0)) {
        echo "<td align=left><p><a href=\"" . $_SERVER['PHP_SELF'] . "?";
-       if (isset($_REQUEST['category']) and !empty($_REQUEST['category']) and file_exists(strip_tags(strtolower(str_replace(" ", "_", "data/categories/{$_REQUEST['category']}"))))) {
+       if (isset($_REQUEST['category']) and !empty($_REQUEST['category']) and !file_exists("data/xcat.txt") and file_exists(strip_tags(strtolower(str_replace(" ", "_", "data/categories/{$_REQUEST['category']}"))))) {
                echo "category={$_REQUEST['category']}&";
        }
+       if (isset($_REQUEST['archive']) and !empty($_REQUEST['archive']) and !file_exists("data/xarc.txt")) {
+               echo "archive={$_REQUEST['archive']}&";
+       }
        echo "start=" . ($start-$increase) . "\">previous</a></p></td>";
 }
 
 if ($end < sizeof($items)) {
        echo "<td align=right><p><a href=\"" . $_SERVER['PHP_SELF'] . "?";
-       if (isset($_REQUEST['category']) and !empty($_REQUEST['category']) and file_exists(strip_tags(strtolower(str_replace(" ", "_", "data/categories/{$_REQUEST['category']}"))))) {
+       if (isset($_REQUEST['category']) and !empty($_REQUEST['category']) and !file_exists("data/xcat.txt") and file_exists(strip_tags(strtolower(str_replace(" ", "_", "data/categories/{$_REQUEST['category']}"))))) {
                echo "category={$_REQUEST['category']}&";
        }
+       if (isset($_REQUEST['archive']) and !empty($_REQUEST['archive']) and !file_exists("data/xarc.txt")) {
+               echo "archive={$_REQUEST['archive']}&";
+       }
        echo "start=" . ($start+$increase) . "\">next</a></p></td>";
 }
 ?>
@@ -1617,24 +1689,24 @@ if ($end < sizeof($items)) {
 
 </td>
 
-<td width=15></td>
+<td width=15>&nbsp;</td>
 <td width=175 valign=top>
 
 <?php
 if ($dh_latest_items = opendir($dir)) {
        while (($entry_latest_items = readdir($dh_latest_items)) !== false) {
 
-               if (file_exists("data/items/$entry_latest_items/private.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+               if (file_exists("data/items/$entry_latest_items/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
                        continue;
                }
 
                $cat_dir = file_get_contents("data/items/$entry_latest_items/category.txt");
 
-               if (file_exists("data/categories/$cat_dir/private.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username) and !file_exists("data/items/$entry_latest_items/cat.txt")) {
+               if (file_exists("data/categories/$cat_dir/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$entry_latest_items/cat.txt")) {
                        continue;
                }
 
-               if (file_exists("data/nocat.txt") and file_exists("data/items/$entry_latest_items/category.txt") and !file_exists("data/items/$entry_latest_items/cat.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+               if (file_exists("data/nocat.txt") and file_exists("data/items/$entry_latest_items/category.txt") and !file_exists("data/items/$entry_latest_items/cat.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
                        continue;
                }
 
@@ -1675,7 +1747,6 @@ if ($count_latest_items > 0) {
        echo '</div>';
 ?>
 
-<p></p>
 <form enctype="multipart/form-data" action="dig.php" method="post">
 <div id=panel_title>Search</div>
 <div id=panel_body>
@@ -1688,11 +1759,11 @@ 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)) {
+                               if (file_exists("data/xcat.txt") and (!isset($_SESSION['logged_in']) or ($_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)) {
+                               if (file_exists("data/categories/$entry_categories/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
                                        continue;
                                }
 
@@ -1709,7 +1780,7 @@ if ($count_latest_items > 0) {
                $count_categories = count($show_categories);
 
                if ($count_categories > 0) {
-                       echo '<p></p><div id=panel_title>Categories</div><div id=panel_body>';
+                       echo '<div id=panel_title>Categories</div><div id=panel_body>';
                        foreach ($show_categories as $category) {
                                echo "<a href=\"" . $_SERVER['PHP_SELF'] . "?category=" . $category . "\">";
                                if (file_exists("data/categories/$category/title.txt")) {
@@ -1726,7 +1797,7 @@ if ($count_latest_items > 0) {
        }
 
        if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
-               echo '<p></p><div id=panel_title>Statistics</div><div id=panel_body>';
+               echo '<div id=panel_title>Statistics</div><div id=panel_body>';
                echo "Total Entries: $count_latest_items";
                if (file_exists("data/hits.txt")) {
                        echo '<br>Site Hits: ';
@@ -1758,7 +1829,7 @@ if ($count_latest_items > 0) {
 
 ?>
 
-<p></p>
+
 
 <?php
 if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
@@ -1806,20 +1877,20 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username
 }
 ?>
 
-<p></p>
+
 
 <?php
 if (file_exists("data/albums")) {
        if ($dh_album_list = opendir("data/albums")) {
                while (($entry_album_list = readdir($dh_album_list)) !== false) {
 
-                       if (file_exists("data/items/$entry_album_list/private.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+                       if (file_exists("data/items/$entry_album_list/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
                                continue;
                        }
 
                        $pull_cat_dir = file_get_contents("data/items/$entry_album_list/category.txt");
 
-                       if (file_exists("data/categories/$pull_cat_dir/private.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username) and !file_exists("data/items/$entry_album_list/cat.txt")) {
+                       if (file_exists("data/categories/$pull_cat_dir/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$entry_album_list/cat.txt")) {
                                continue;
                        }
 
@@ -1849,7 +1920,61 @@ if (file_exists("data/albums")) {
 }
 ?>
 
-<p></p>
+
+
+<?php
+if (file_exists("data/items")) {
+       if ($dh_archive_list = opendir("data/items")) {
+               while (($entry_archive_list = readdir($dh_archive_list)) !== false) {
+
+                       if (file_exists("data/xarc.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+                               continue;
+                       }
+
+                       if (file_exists("data/items/$entry_archive_list/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+                               continue;
+                       }
+
+                       $get_cat_dir = file_get_contents("data/items/$entry_archive_list/category.txt");
+
+                       if (file_exists("data/categories/$get_cat_dir/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and !file_exists("data/items/$entry_archive_list/cat.txt")) {
+                               continue;
+                       }
+
+                       if ($entry_archive_list != "." && $entry_archive_list != ".." && fnmatch("*", $entry_archive_list)) {
+                               $entry_archive_list = substr("$entry_archive_list",0,6);
+                               $show_archive_list[] = $entry_archive_list;
+                       }
+               }
+               closedir($dh_archive_list);
+       }
+
+       rsort($show_archive_list);
+       reset($show_archive_list);
+       $count_archive_list = count($show_archive_list);
+      
+       if ($count_archive_list > 0) {
+
+               $archive_entries = implode(" ",$show_archive_list);
+               $unique_archive_list = array_unique($show_archive_list);
+               echo "<div id=panel_title>Archives ($count_archive_list)</div>";
+               echo "<div id=panel_body>";
+               foreach ($unique_archive_list as $archive_list_entry) {
+                       $archive_list_value = substr($archive_list_entry,0,6);
+                       $archive_list_year = substr($archive_list_entry,0,4);
+                       $archive_list_month = substr($archive_list_entry,4,2);
+                       $archive_list_month = date("F",mktime(0,0,0,$archive_list_month));
+                       echo "<a href=\"index.php?archive=$archive_list_value\">$archive_list_month $archive_list_year</a> (";
+                       echo substr_count($archive_entries,$archive_list_entry);
+                       echo ")<br>";
+               }
+               echo "</select></div></form>";
+       }
+}
+
+?>
+
+
 
 <?php
 
@@ -1857,7 +1982,7 @@ if (file_exists("data/clustrmaps.php")) {
        echo '<div id=panel_title>ClustrMaps</div>';
        echo '<div id=panel_body><center>';
        include("data/clustrmaps.php");
-       echo '</center></div><p></p>';
+       echo '</center></div>';
 }
 ?>
 
@@ -1867,7 +1992,7 @@ if (file_exists("data/adsense.php")) {
        echo '<div id=panel_title>AdSense</div>';
        echo '<div id=panel_body><center>';
        include("data/adsense.php");   
-       echo '</center></div><p></p>';
+       echo '</center></div>';
 }
 ?>
 
diff --git a/panels.php b/panels.php
index 941a2c7..0a166d1 100644
--- a/panels.php
+++ b/panels.php
@@ -37,27 +37,25 @@ function rmdirr($recurse_dirname)
 if (isset($_REQUEST['new_id']) and !empty($_REQUEST['new_id']) and isset($_REQUEST['new_title']) and !empty($_REQUEST['new_title']) and isset($_REQUEST['new_content']) and !empty($_REQUEST['new_content']) and !file_exists("data/panels/{$_REQUEST['new_id']}")) {
 
        if (!file_exists("data/panels")) {
-               mkdir("data/panels", 0777);
+               mkdir("data/panels");
        }
 
        $new_id = trim(strip_tags(strtolower(str_replace(" ", "_", $_REQUEST['new_id']))));
 
        if (!file_exists("data/panels/$new_id")) {
-               mkdir("data/panels/$new_id", 0777);
+               mkdir("data/panels/$new_id");
        }
 
        $new_title = ucfirst(strip_tags(trim($_REQUEST['new_title'])));
        $open_title_file = fopen("data/panels/$new_id/title.txt","w");
        fwrite($open_title_file,$new_title);
        fclose($open_title_file);
-       chmod("data/panels/$new_id/title.txt", 0666);
 
        $panel_content = ucfirst(trim($_REQUEST['new_content']));
       
        $new_content_file = fopen("data/panels/$new_id/panel.php","w");
        fwrite($new_content_file,$panel_content);
        fclose($new_content_file);
-       chmod("data/panels/{$_REQUEST['panel_id']}/panel.php", 0666);
 }
 
 if (isset($_REQUEST['panel_del']) and !empty($_REQUEST['panel_del']) and ($_REQUEST['panel_del'] == "on")) {
@@ -73,7 +71,6 @@ if ((!isset($_REQUEST['panel_hide']) or !empty($_REQUEST['panel_hide'])) and ($_
 if (isset($_REQUEST['panel_hide']) and !empty($_REQUEST['panel_hide']) and ($_REQUEST['panel_hide'] == "on")) {
        if (!file_exists("data/panels/{$_REQUEST['panel_id']}/private.txt")) {
                touch("data/panels/{$_REQUEST['panel_id']}/private.txt");
-               chmod("data/panels/{$_REQUEST['panel_id']}/private.txt", 0666);
        }
 }
 
@@ -85,7 +82,6 @@ if (isset($_REQUEST['panel_title']) and !empty($_REQUEST['panel_title'])) {
                $edit_title_file = fopen("data/panels/{$_REQUEST['panel_id']}/title.txt","w");
                fwrite($edit_title_file,$panel_title);
                fclose($edit_title_file);
-               chmod("data/panels/{$_REQUEST['panel_id']}/title.txt", 0666);
        }
 }
 
@@ -97,7 +93,6 @@ if (isset($_REQUEST['panel_content']) and !empty($_REQUEST['panel_content'])) {
                $edit_content_file = fopen("data/panels/{$_REQUEST['panel_id']}/panel.php","w");
                fwrite($edit_content_file,$panel_content);
                fclose($edit_content_file);
-               chmod("data/panels/{$_REQUEST['panel_id']}/panel.php", 0666);
        }
 }
 
diff --git a/passwd.php b/passwd.php
index 0c5b5e1..9e225e7 100644
--- a/passwd.php
+++ b/passwd.php
@@ -65,6 +65,10 @@ if (isset($_REQUEST['show']) and ($_REQUEST['show'] == filedrop)) {
                echo "&show=filedrop";
 }
 
+if (isset($_REQUEST['show']) and ($_REQUEST['show'] == pdf)) {
+               echo "&show=pdf";
+}
+
 ?>" method="post">
                <input autocomplete=off class=input type=password name=passwd>
                <input class=input type=submit value=submit>
diff --git a/rss.php b/rss.php
index f1a1919..eebe4a6 100644
--- a/rss.php
+++ b/rss.php
@@ -70,7 +70,6 @@ if (isset($_REQUEST['ver']) and !empty($_REQUEST['ver'])) {
                        $rss091_file = fopen("data/rss-0.91.txt", "w");
                        fwrite($rss091_file, $rss091_count);
                        fclose($rss091_file);
-                       chmod("data/rss-0.91.txt", 0666);
                        header('Content-type: application/xml');
                        echo "<rss version=\"0.91\">\n";
                        echo "<channel>\n";
@@ -114,7 +113,6 @@ if (isset($_REQUEST['ver']) and !empty($_REQUEST['ver'])) {
                        $rss10_file = fopen("data/rss-1.0.txt", "w");
                        fwrite($rss10_file, $rss10_count);
                        fclose($rss10_file);
-                       chmod("data/rss-1.0.txt", 0666);
                        header('Content-type: application/xml');
                        echo "<rdf:RDF\n";
                        echo "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n";
@@ -175,7 +173,6 @@ if (isset($_REQUEST['ver']) and !empty($_REQUEST['ver'])) {
                        $rss20_file = fopen("data/rss-2.0.txt", "w");
                        fwrite($rss20_file, $rss20_count);
                        fclose($rss20_file);
-                       chmod("data/rss-2.0.txt", 0666);
                        header('Content-type: application/xml');
                        echo "<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";
                        echo "<channel>\n";
diff --git a/settings.php b/settings.php
index cff1edb..fee92d0 100644
--- a/settings.php
+++ b/settings.php
@@ -11,7 +11,6 @@ if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username
 if (isset($_REQUEST['title']) and !empty($_REQUEST['title']) and (file_get_contents("data/title.txt") != $_REQUEST['title'])) {
        $title_write_content = ucfirst($_REQUEST['title']);
        $fp_title_txt = fopen("data/title.txt","w");
-       chmod("data/title.txt", 0666);
        fwrite($fp_title_txt,$title_write_content);
        fclose($fp_title_txt);
 }
@@ -19,7 +18,6 @@ if (isset($_REQUEST['title']) and !empty($_REQUEST['title']) and (file_get_conte
 if (isset($_REQUEST['author']) and !empty($_REQUEST['author']) and (file_get_contents("data/author.txt") != $_REQUEST['author'])) {
        $author_write_content = ucfirst($_REQUEST['author']);
        $fp_author_txt = fopen("data/author.txt","w");
-       chmod("data/author.txt", 0666);
        fwrite($fp_author_txt,$author_write_content);
        fclose($fp_author_txt);
 }
@@ -29,15 +27,21 @@ if (isset($_REQUEST['email']) and !empty($_REQUEST['email']) and (file_get_conte
        $email_write_content = trim($email_write_content);
        $email_write_content = htmlentities($email_write_content, ENT_NOQUOTES);
        $fp_email_txt = fopen("data/email.txt","w");
-       chmod("data/email.txt", 0666);
        fwrite($fp_email_txt,$email_write_content);
        fclose($fp_email_txt);
 }
 
+if (!isset($_REQUEST['email']) or empty($_REQUEST['email'])) {
+       if (isset($_REQUEST['edit']) and ($_REQUEST['edit'] == "on")) {
+               if (file_exists("data/email.txt")) {
+                       unlink("data/email.txt");
+               }
+       }
+}
+
 if (isset($_REQUEST['increase']) and !empty($_REQUEST['increase']) and is_numeric($_REQUEST['increase']) and ($_REQUEST['increase'] > 0) and (file_get_contents("data/increase.txt") != $_REQUEST['increase'])) {
        $increase_write_content = number_format($_REQUEST['increase'],0,'.','');
        $fp_increase_txt = fopen("data/increase.txt","w");
-       chmod("data/increase.txt", 0666);
        fwrite($fp_increase_txt,$increase_write_content);
        fclose($fp_increase_txt);
 }
@@ -52,7 +56,6 @@ if (!isset($_REQUEST['increase']) or empty($_REQUEST['increase']) or !is_numeric
 
 if (isset($_REQUEST['offset']) and !empty($_REQUEST['offset']) and is_numeric($_REQUEST['offset']) and (file_get_contents("data/offset.txt") != $_REQUEST['offset'])) {
        $fp_offset_txt = fopen("data/offset.txt","w");
-       chmod("data/offset.txt", 0666);
        fwrite($fp_offset_txt,$_REQUEST['offset']);
        fclose($fp_offset_txt);
 }
@@ -67,7 +70,6 @@ if (!isset($_REQUEST['offset']) or empty($_REQUEST['offset']) or !is_numeric($_R
 
 if (isset($_REQUEST['sfx']) and !empty($_REQUEST['sfx']) and is_numeric($_REQUEST['sfx']) and (file_get_contents("data/sfx.txt") != $_REQUEST['sfx'])) {
        $fp_sfx_txt = fopen("data/sfx.txt","w");
-       chmod("data/sfx.txt", 0666);
        fwrite($fp_sfx_txt,$_REQUEST['sfx']);
        fclose($fp_sfx_txt);
 }
@@ -85,7 +87,6 @@ if (isset($_REQUEST['ping']) and !empty($_REQUEST['ping']) and (file_get_content
        $ping_write_content = trim($ping_write_content);
        $ping_write_content = htmlentities($ping_write_content, ENT_NOQUOTES);
        $fp_ping_txt = fopen("data/ping.txt","w");
-       chmod("data/ping.txt", 0666);
        fwrite($fp_ping_txt,$ping_write_content);
        fclose($fp_ping_txt);
 }
@@ -100,7 +101,6 @@ if (!isset($_REQUEST['ping']) or empty($_REQUEST['ping'])) {
 
 if (isset($_REQUEST['nocomment']) and !empty($_REQUEST['nocomment']) and ($_REQUEST['nocomment'] == "on") and !file_exists("data/nocomment.txt")) {
        touch("data/nocomment.txt");
-       chmod("data/nocomment.txt", 0666);
 }
 
 if (!isset($_REQUEST['nocomment']) or empty($_REQUEST['nocomment'])) {
@@ -113,7 +113,6 @@ if (!isset($_REQUEST['nocomment']) or empty($_REQUEST['nocomment'])) {
 
 if (isset($_REQUEST['nak']) and !empty($_REQUEST['nak']) and ($_REQUEST['nak'] == "on") and !file_exists("data/nak.txt")) {
        touch("data/nak.txt");
-       chmod("data/nak.txt", 0666);
 }
 
 if (!isset($_REQUEST['nak']) or empty($_REQUEST['nak'])) {
@@ -124,9 +123,44 @@ if (!isset($_REQUEST['nak']) or empty($_REQUEST['nak'])) {
        }
 }
 
+if (isset($_REQUEST['nopdf']) and !empty($_REQUEST['nopdf']) and ($_REQUEST['nopdf'] == "on") and !file_exists("data/nopdf.txt")) {
+       touch("data/nopdf.txt");
+}
+
+if (!isset($_REQUEST['nopdf']) or empty($_REQUEST['nopdf'])) {
+       if (isset($_REQUEST['edit']) and ($_REQUEST['edit'] == "on")) {
+               if (file_exists("data/nopdf.txt")) {
+                       unlink("data/nopdf.txt");
+               }
+       }
+}
+
+if (isset($_REQUEST['xarc']) and !empty($_REQUEST['xarc']) and ($_REQUEST['xarc'] == "on") and !file_exists("data/xarc.txt")) {
+       touch("data/xarc.txt");
+}
+
+if (!isset($_REQUEST['xarc']) or empty($_REQUEST['xarc'])) {
+       if (isset($_REQUEST['edit']) and ($_REQUEST['edit'] == "on")) {
+               if (file_exists("data/xarc.txt")) {
+                       unlink("data/xarc.txt");
+               }
+       }
+}
+
+if (isset($_REQUEST['xcat']) and !empty($_REQUEST['xcat']) and ($_REQUEST['xcat'] == "on") and !file_exists("data/xcat.txt")) {
+       touch("data/xcat.txt");
+}
+
+if (!isset($_REQUEST['xcat']) or empty($_REQUEST['xcat'])) {
+       if (isset($_REQUEST['edit']) and ($_REQUEST['edit'] == "on")) {
+               if (file_exists("data/xcat.txt")) {
+                       unlink("data/xcat.txt");
+               }
+       }
+}
+
 if (isset($_REQUEST['nocat']) and !empty($_REQUEST['nocat']) and ($_REQUEST['nocat'] == "on") and !file_exists("data/nocat.txt")) {
        touch("data/nocat.txt");
-       chmod("data/nocat.txt", 0666);
 }
 
 if (!isset($_REQUEST['nocat']) or empty($_REQUEST['nocat'])) {
@@ -139,7 +173,6 @@ if (!isset($_REQUEST['nocat']) or empty($_REQUEST['nocat'])) {
 
 if (isset($_REQUEST['old']) and !empty($_REQUEST['old']) and ($_REQUEST['old'] == "on") and !file_exists("data/old.txt")) {
        touch("data/old.txt");
-       chmod("data/old.txt", 0666);
 }
 
 if (!isset($_REQUEST['old']) or empty($_REQUEST['old'])) {
@@ -172,7 +205,6 @@ if (isset($_REQUEST['del_picture']) and !empty($_REQUEST['del_picture']) and ($_
 
 if (isset($_REQUEST['bg_scroll']) and !empty($_REQUEST['bg_scroll']) and ($_REQUEST['bg_scroll'] == "on") and !file_exists("data/bg-scroll.txt")) {
        touch("data/bg-scroll.txt");
-       chmod("data/bg-scroll.txt", 0666);
 }
 
 if (!isset($_REQUEST['bg_scroll']) or empty($_REQUEST['bg_scroll'])) {
@@ -185,7 +217,6 @@ if (!isset($_REQUEST['bg_scroll']) or empty($_REQUEST['bg_scroll'])) {
 
 if (isset($_REQUEST['bg_repeat']) and !empty($_REQUEST['bg_repeat']) and (file_get_contents("data/bg-repeat.txt") != $_REQUEST['bg_repeat']) and ($_REQUEST['bg_repeat'] != "repeat")) {
        $fp_bg_repeat_txt = fopen("data/bg-repeat.txt","w");
-       chmod("data/bg-repeat.txt", 0666);
        fwrite($fp_bg_repeat_txt,$_REQUEST['bg_repeat']);
        fclose($fp_bg_repeat_txt);
 }
@@ -196,7 +227,6 @@ if (isset($_REQUEST['bg_repeat']) and !empty($_REQUEST['bg_repeat']) and (file_g
 
 if (isset($_REQUEST['bg_position']) and !empty($_REQUEST['bg_position']) and (file_get_contents("data/bg-position.txt") != $_REQUEST['bg_position']) and ($_REQUEST['bg_position'] != "top left")) {
        $fp_bg_position_txt = fopen("data/bg-position.txt","w");
-       chmod("data/bg-position.txt", 0666);
        fwrite($fp_bg_position_txt,$_REQUEST['bg_position']);
        fclose($fp_bg_position_txt);
 }
@@ -247,7 +277,6 @@ if (isset($_FILES['favicon']) and !empty($_FILES['favicon'])) {
 
                                $res = copy($_FILES['favicon']['tmp_name'], "favicon.ico");
                                unlink($_FILES['favicon']['tmp_name']);
-                               chmod("favicon.ico", 0666);
                        }
                        else {
                                unlink($_FILES['favicon']['tmp_name']);
@@ -271,8 +300,7 @@ if (isset($_FILES['picture']) and !empty($_FILES['picture'])) {
                        if (($_FILES['picture']['type']=="image/gif") || ($_FILES['picture']['type']=="image/pjpeg") || ($_FILES['picture']['type']=="image/jpeg") || ($_FILES['picture']['type']=="image/png")) {
 
                                if (!file_exists("images")) {
-                                       mkdir("images", 0777);
-                                       chmod("images", 0777);
+                                       mkdir("images");
                                }
 
                                if (file_exists("images/profile.gif")) {
@@ -290,19 +318,16 @@ if (isset($_FILES['picture']) and !empty($_FILES['picture'])) {
                                if ($_FILES['picture']['type']=="image/gif") {
                                        $res = copy($_FILES['picture']['tmp_name'], "images/profile.gif");
                                        unlink($_FILES['picture']['tmp_name']);
-                                       chmod("images/profile.gif", 0666);
                                }
 
                                if (($_FILES['picture']['type']=="image/jpeg") or ($_FILES['picture']['type']=="image/pjpeg")) {
                                        $res = copy($_FILES['picture']['tmp_name'], "images/profile.jpg");
                                        unlink($_FILES['picture']['tmp_name']);
-                                       chmod("images/profile.jpg", 0666);
                                }
 
                                if ($_FILES['picture']['type']=="image/png") {
                                        $res = copy($_FILES['picture']['tmp_name'], "images/profile.png");
                                        unlink($_FILES['picture']['tmp_name']);
-                                       chmod("images/profile.png", 0666);
                                }
                        }
                        else {
@@ -327,8 +352,7 @@ if (isset($_FILES['background']) and !empty($_FILES['background'])) {
                        if (($_FILES['background']['type']=="image/gif") || ($_FILES['background']['type']=="image/pjpeg") || ($_FILES['background']['type']=="image/jpeg") || ($_FILES['background']['type']=="image/png")) {
 
                                if (!file_exists("images")) {
-                                       mkdir("images", 0777);
-                                       chmod("images", 0777);
+                                       mkdir("images");
                                }
 
                                if (file_exists("images/background.gif")) {
@@ -346,19 +370,16 @@ if (isset($_FILES['background']) and !empty($_FILES['background'])) {
                                if ($_FILES['background']['type']=="image/gif") {
                                        $res = copy($_FILES['background']['tmp_name'], "images/background.gif");
                                        unlink($_FILES['background']['tmp_name']);
-                                       chmod("images/background.gif", 0666);
                                }
 
                                if (($_FILES['background']['type']=="image/jpeg") or ($_FILES['background']['type']=="image/pjpeg")) {
                                        $res = copy($_FILES['background']['tmp_name'], "images/background.jpg");
                                        unlink($_FILES['background']['tmp_name']);
-                                       chmod("images/background.jpg", 0666);
                                }
 
                                if ($_FILES['background']['type']=="image/png") {
                                        $res = copy($_FILES['background']['tmp_name'], "images/background.png");
                                        unlink($_FILES['background']['tmp_name']);
-                                       chmod("images/background.png", 0666);
                                }
                        }
                        else {
@@ -377,14 +398,12 @@ if (isset($_FILES['background']) and !empty($_FILES['background'])) {
 if (isset($_REQUEST['profile']) and !empty($_REQUEST['profile']) and (file_get_contents("data/profile.txt") != $_REQUEST['profile'])) {
        $profile_write_content = ucfirst($_REQUEST['profile']);
        $fp_profile_txt = fopen("data/profile.php","w");
-       chmod("data/profile.txt", 0666);
        fwrite($fp_profile_txt,$profile_write_content);
        fclose($fp_profile_txt);
 }
 
 if (isset($_REQUEST['username']) and !empty($_REQUEST['username']) and (file_get_contents("data/username.txt") != $_REQUEST['username'])) {
        $fp_username_txt = fopen("data/username.txt","w");
-       chmod("data/username.txt", 0666);
        fwrite($fp_username_txt,$_REQUEST['username']);
        fclose($fp_username_txt);
        $login_url = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/login.php";
@@ -439,14 +458,27 @@ a:active {
 <input type=hidden name=edit value=on>
 <tr><td><p>blog title*</p></td><td><input autocomplete=off class=input type=text name=title value="<?php readfile("data/title.txt"); ?>"></td></tr>
 <tr><td><p>author*</p></td><td><input autocomplete=off class=input type=text name=author value="<?php readfile("data/author.txt"); ?>"></td></tr>
-<tr><td><p>e-mail address*</p></td><td><input autocomplete=off class=input type=text name=email value="<?php readfile("data/email.txt"); ?>"></td></tr>
+<tr><td><p>e-mail address*</p></td><td><input autocomplete=off class=input type=text name=email <?php if (file_exists("data/email.txt")) { echo 'value="'; readfile("data/email.txt"); } ?>"></td></tr>
 <tr><td><p>username*</p></td><td><input autocomplete=off class=input type=text name=username value="<?php readfile("data/username.txt"); ?>"></td></tr>
 <tr><td><p>entries per page*</p></td><td><input autocomplete=off class=input type=text name=increase value="<?php readfile("data/increase.txt"); ?>"></td></tr>
 <tr><td><p>timezone offset in seconds</p></td><td><input autocomplete=off class=input type=text name=offset value="<?php readfile("data/offset.txt"); ?>"></td></tr>
 <tr><td><p>spread firefox <a href="http://www.spreadfirefox.com/?q=user/register&r=76458" target=_maj>affiliate</a> id</p></td><td><input autocomplete=off class=input type=text name=sfx value="<?php readfile("data/sfx.txt"); ?>"></td></tr>
 <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=4><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>
+<tr><td rowspan=<?php
+       if (file_exists("data/email.txt")) {
+               echo "7";
+       }
+       else {
+               echo "6";
+       }
+?>
+><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>
+<?php if (file_exists("data/email.txt")) { ?>
 <tr><td><p><input type=checkbox name=nak <?php if (file_exists("data/nak.txt")) { echo checked; } ?>> Do not acknowledge comment submissions via e-mail.</p></td></tr>
+<?php } ?>
+<tr><td><p><input type=checkbox name=nopdf <?php if (file_exists("data/nopdf.txt")) { echo checked; } ?>> Do not allow PDF generation for all entries.</p></td></tr>
+<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=old <?php if (file_exists("data/old.txt")) { echo checked; } ?>> Display entries from oldest to newest.</p></td></tr>
 <?php
@@ -573,7 +605,6 @@ if (isset($_REQUEST['passwd_new']) and !empty($_REQUEST['passwd_new']) and isset
        if ((file_get_contents("data/password.txt") != $passwd_new_crypt) and (file_get_contents("data/password.txt") == $passwd_cur_crypt)) {
 
                $fp_passwd_new_txt = fopen("data/password.txt","w");
-               chmod("data/password.txt", 0666);
                fwrite($fp_passwd_new_txt,$passwd_new_crypt);
                fclose($fp_passwd_new_txt);
                echo "<tr><td></td><td><p>password changed</p></td></tr>";
diff --git a/sitemap.php b/sitemap.php
index 8df62d9..c2ed80f 100644
--- a/sitemap.php
+++ b/sitemap.php
@@ -31,7 +31,6 @@ if ($count_sitemap_items > 0) {
        $sitemap_file = fopen("data/sitemap.txt", "w");
        fwrite($sitemap_file, $sitemap_count);
        fclose($sitemap_file);
-       chmod("data/sitemap.txt", 0666);
 
        header('Content-type: application/xml');
        echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
 
filedropmaj.git-01822e4.tar.bz2
147.95 KB
63 downloads
filedropmaj.git-01822e4.zip
201.96 KB
20 downloads
filedropmaj.git-0291349.tar.bz2
152.85 KB
61 downloads
filedropmaj.git-0291349.zip
211.90 KB
20 downloads
filedropmaj.git-02cb3b7.tar.bz2
151.48 KB
64 downloads
filedropmaj.git-02cb3b7.zip
209.82 KB
20 downloads
filedropmaj.git-0811dd5.tar.bz2
152.90 KB
60 downloads
filedropmaj.git-0811dd5.zip
211.90 KB
18 downloads
filedropmaj.git-083625f.tar.bz2
132.92 KB
59 downloads
filedropmaj.git-083625f.zip
179.59 KB
20 downloads
filedropmaj.git-0885d7b.tar.bz2
92.63 KB
60 downloads
filedropmaj.git-0885d7b.zip
132.34 KB
17 downloads
filedropmaj.git-09c6f33.tar.bz2
151.51 KB
59 downloads
filedropmaj.git-09c6f33.zip
202.12 KB
18 downloads
filedropmaj.git-0b26a85.tar.bz2
151.44 KB
57 downloads
filedropmaj.git-0b26a85.zip
209.75 KB
16 downloads
filedropmaj.git-0b32424.tar.bz2
151.66 KB
58 downloads
filedropmaj.git-0b32424.zip
206.72 KB
17 downloads
filedropmaj.git-0f3ac59.tar.bz2
152.14 KB
57 downloads
filedropmaj.git-0f3ac59.zip
211.45 KB
13 downloads
filedropmaj.git-11d4582.tar.bz2
143.02 KB
55 downloads
filedropmaj.git-11d4582.zip
195.12 KB
12 downloads
filedropmaj.git-17f105a.tar.bz2
137.96 KB
53 downloads
filedropmaj.git-17f105a.zip
193.02 KB
13 downloads
filedropmaj.git-183270b.tar.bz2
137.54 KB
57 downloads
filedropmaj.git-183270b.zip
187.93 KB
13 downloads
filedropmaj.git-197a49d.tar.bz2
152.03 KB
55 downloads
filedropmaj.git-197a49d.zip
211.32 KB
16 downloads
filedropmaj.git-1b9af25.tar.bz2
152.87 KB
53 downloads
filedropmaj.git-1b9af25.zip
211.96 KB
14 downloads
filedropmaj.git-1be2914.tar.bz2
149.30 KB
55 downloads
filedropmaj.git-1be2914.zip
203.09 KB
13 downloads
filedropmaj.git-1bed800.tar.bz2
138.15 KB
51 downloads
filedropmaj.git-1bed800.zip
190.15 KB
17 downloads
filedropmaj.git-1d330de.tar.bz2
151.65 KB
54 downloads
filedropmaj.git-1d330de.zip
210.80 KB
15 downloads
filedropmaj.git-1df190d.tar.bz2
151.72 KB
55 downloads
filedropmaj.git-1df190d.zip
210.85 KB
13 downloads
filedropmaj.git-1ee1167.tar.bz2
151.52 KB
56 downloads
filedropmaj.git-1ee1167.zip
202.16 KB
14 downloads
filedropmaj.git-2057838.tar.bz2
151.76 KB
52 downloads
filedropmaj.git-2057838.zip
202.36 KB
14 downloads
filedropmaj.git-2075213.tar.bz2
155.81 KB
52 downloads
filedropmaj.git-2075213.zip
208.39 KB
13 downloads
filedropmaj.git-211b7b0.tar.bz2
142.53 KB
55 downloads
filedropmaj.git-211b7b0.zip
194.64 KB
14 downloads
filedropmaj.git-2331f5a.tar.bz2
75.55 KB
55 downloads
filedropmaj.git-2331f5a.zip
100.32 KB
16 downloads
filedropmaj.git-25e3c4c.tar.bz2
147.57 KB
53 downloads
filedropmaj.git-25e3c4c.zip
201.46 KB
13 downloads
filedropmaj.git-2622313.tar.bz2
151.47 KB
50 downloads
filedropmaj.git-2622313.zip
206.44 KB
12 downloads
filedropmaj.git-273e4b2.tar.bz2
152.60 KB
52 downloads
filedropmaj.git-273e4b2.zip
203.40 KB
15 downloads
filedropmaj.git-2753e51.tar.bz2
136.37 KB
55 downloads
filedropmaj.git-2753e51.zip
184.34 KB
12 downloads
filedropmaj.git-2c1a589.tar.bz2
155.89 KB
49 downloads
filedropmaj.git-2c1a589.zip
208.69 KB
13 downloads
filedropmaj.git-2c3d544.tar.bz2
151.33 KB
51 downloads
filedropmaj.git-2c3d544.zip
206.23 KB
14 downloads
filedropmaj.git-2c85f72.tar.bz2
143.23 KB
50 downloads
filedropmaj.git-2c85f72.zip
194.84 KB
12 downloads
filedropmaj.git-2dc622c.tar.bz2
151.76 KB
48 downloads
filedropmaj.git-2dc622c.zip
202.35 KB
14 downloads
filedropmaj.git-2fabf8a.tar.bz2
151.35 KB
53 downloads
filedropmaj.git-2fabf8a.zip
206.24 KB
15 downloads
filedropmaj.git-322736b.tar.bz2
137.81 KB
45 downloads
filedropmaj.git-322736b.zip
190.18 KB
13 downloads
filedropmaj.git-374279c.tar.bz2
137.54 KB
46 downloads
filedropmaj.git-374279c.zip
189.58 KB
12 downloads
filedropmaj.git-37e852d.tar.bz2
151.32 KB
42 downloads
filedropmaj.git-37e852d.zip
206.21 KB
11 downloads
filedropmaj.git-38636de.tar.bz2
147.35 KB
42 downloads
filedropmaj.git-38636de.zip
201.16 KB
69 downloads
filedropmaj.git-3b25d71.tar.bz2
147.88 KB
35 downloads
filedropmaj.git-3b25d71.zip
201.85 KB
14 downloads
filedropmaj.git-3b6df7a.tar.bz2
153.39 KB
33 downloads
filedropmaj.git-3b6df7a.zip
204.55 KB
17 downloads
filedropmaj.git-3bf6bd2.tar.bz2
137.77 KB
38 downloads
filedropmaj.git-3bf6bd2.zip
190.16 KB
14 downloads
filedropmaj.git-3e012ff.tar.bz2
152.83 KB
34 downloads
filedropmaj.git-3e012ff.zip
211.89 KB
16 downloads
filedropmaj.git-4129ab8.tar.bz2
135.86 KB
42 downloads
filedropmaj.git-4129ab8.zip
184.30 KB
14 downloads
filedropmaj.git-414dbb4.tar.bz2
91.09 KB
40 downloads
filedropmaj.git-414dbb4.zip
130.29 KB
14 downloads
filedropmaj.git-43755d0.tar.bz2
150.25 KB
33 downloads
filedropmaj.git-43755d0.zip
204.44 KB
14 downloads
filedropmaj.git-4c20005.tar.bz2
55.59 KB
37 downloads
filedropmaj.git-4c20005.zip
74.20 KB
14 downloads
filedropmaj.git-4ccdbcd.tar.bz2
136.38 KB
38 downloads
filedropmaj.git-4ccdbcd.zip
185.22 KB
16 downloads
filedropmaj.git-4cd1a1c.tar.bz2
155.25 KB
35 downloads
filedropmaj.git-4cd1a1c.zip
207.88 KB
16 downloads
filedropmaj.git-4cf16d1.tar.bz2
76.32 KB
38 downloads
filedropmaj.git-4cf16d1.zip
101.80 KB
12 downloads
filedropmaj.git-4ec45a0.tar.bz2
131.16 KB
35 downloads
filedropmaj.git-4ec45a0.zip
172.66 KB
14 downloads
filedropmaj.git-4f73c22.tar.bz2
134.46 KB
35 downloads
filedropmaj.git-4f73c22.zip
182.45 KB
13 downloads
filedropmaj.git-5457969.tar.bz2
155.21 KB
38 downloads
filedropmaj.git-5457969.zip
207.63 KB
14 downloads
filedropmaj.git-57ee8a1.tar.bz2
145.49 KB
38 downloads
filedropmaj.git-57ee8a1.zip
198.12 KB
66 downloads
filedropmaj.git-592978d.tar.bz2
138.38 KB
36 downloads
filedropmaj.git-592978d.zip
190.58 KB
13 downloads
filedropmaj.git-5935b42.tar.bz2
135.60 KB
34 downloads
filedropmaj.git-5935b42.zip
183.28 KB
15 downloads
filedropmaj.git-5b443b6.tar.bz2
152.00 KB
36 downloads
filedropmaj.git-5b443b6.zip
211.07 KB
13 downloads
filedropmaj.git-5b4a9bf.tar.bz2
155.29 KB
34 downloads
filedropmaj.git-5b4a9bf.zip
207.93 KB
12 downloads
filedropmaj.git-5b6c01d.tar.bz2
147.13 KB
35 downloads
filedropmaj.git-5b6c01d.zip
200.86 KB
16 downloads
filedropmaj.git-5da45f7.tar.bz2
147.27 KB
36 downloads
filedropmaj.git-5da45f7.zip
201.02 KB
13 downloads
filedropmaj.git-5e53618.tar.bz2
75.57 KB
38 downloads
filedropmaj.git-5e53618.zip
100.78 KB
14 downloads
filedropmaj.git-5f8ca35.tar.bz2
136.39 KB
33 downloads
filedropmaj.git-5f8ca35.zip
185.32 KB
13 downloads
filedropmaj.git-61e3d7b.tar.bz2
153.52 KB
33 downloads
filedropmaj.git-61e3d7b.zip
204.73 KB
15 downloads
filedropmaj.git-62a635c.tar.bz2
155.90 KB
37 downloads
filedropmaj.git-62a635c.zip
208.73 KB
14 downloads
filedropmaj.git-6390d34.tar.bz2
138.39 KB
37 downloads
filedropmaj.git-6390d34.zip
190.56 KB
17 downloads
filedropmaj.git-649dfbe.tar.bz2
151.78 KB
37 downloads
filedropmaj.git-649dfbe.zip
210.91 KB
14 downloads
filedropmaj.git-65d6570.tar.bz2
151.63 KB
39 downloads
filedropmaj.git-65d6570.zip
210.80 KB
16 downloads
filedropmaj.git-660433f.tar.bz2
151.67 KB
36 downloads
filedropmaj.git-660433f.zip
206.68 KB
14 downloads
filedropmaj.git-6619ae5.tar.bz2
153.23 KB
47 downloads
filedropmaj.git-6619ae5.zip
204.28 KB
13 downloads
filedropmaj.git-68e4e3a.tar.bz2
135.13 KB
34 downloads
filedropmaj.git-68e4e3a.zip
182.91 KB
13 downloads
filedropmaj.git-6995297.tar.bz2
144.93 KB
38 downloads
filedropmaj.git-6995297.zip
197.18 KB
12 downloads
filedropmaj.git-69d6fd3.tar.bz2
143.23 KB
34 downloads
filedropmaj.git-69d6fd3.zip
194.89 KB
16 downloads
filedropmaj.git-6aa872a.tar.bz2
142.95 KB
39 downloads
filedropmaj.git-6aa872a.zip
195.11 KB
15 downloads
filedropmaj.git-6bad5c7.tar.bz2
147.04 KB
38 downloads
filedropmaj.git-6bad5c7.zip
200.79 KB
14 downloads
filedropmaj.git-6e96a2d.tar.bz2
152.13 KB
37 downloads
filedropmaj.git-6e96a2d.zip
207.21 KB
67 downloads
filedropmaj.git-73d46de.tar.bz2
138.42 KB
36 downloads
filedropmaj.git-73d46de.zip
190.59 KB
13 downloads
filedropmaj.git-75e0478.tar.bz2
144.54 KB
38 downloads
filedropmaj.git-75e0478.zip
196.70 KB
15 downloads
filedropmaj.git-784fc35.tar.bz2
143.07 KB
38 downloads
filedropmaj.git-784fc35.zip
195.01 KB
13 downloads
filedropmaj.git-7872a83.tar.bz2
138.51 KB
39 downloads
filedropmaj.git-7872a83.zip
190.69 KB
13 downloads
filedropmaj.git-788fb89.tar.bz2
138.30 KB
37 downloads
filedropmaj.git-788fb89.zip
191.26 KB
18 downloads
filedropmaj.git-796d8a3.tar.bz2
138.92 KB
35 downloads
filedropmaj.git-796d8a3.zip
191.24 KB
13 downloads
filedropmaj.git-79a5e8d.tar.bz2
132.43 KB
38 downloads
filedropmaj.git-79a5e8d.zip
176.90 KB
14 downloads
filedropmaj.git-7b3b2e0.tar.bz2
147.24 KB
36 downloads
filedropmaj.git-7b3b2e0.zip
201.05 KB
14 downloads
filedropmaj.git-7e28eed.tar.bz2
138.89 KB
33 downloads
filedropmaj.git-7e28eed.zip
191.24 KB
14 downloads
filedropmaj.git-8279296.tar.bz2
135.56 KB
38 downloads
filedropmaj.git-8279296.zip
183.25 KB
14 downloads
filedropmaj.git-84c17fe.tar.bz2
152.87 KB
38 downloads
filedropmaj.git-84c17fe.zip
211.90 KB
14 downloads
filedropmaj.git-87c5d5f.tar.bz2
135.78 KB
36 downloads
filedropmaj.git-87c5d5f.zip
183.64 KB
12 downloads
filedropmaj.git-8a48901.tar.bz2
147.27 KB
39 downloads
filedropmaj.git-8a48901.zip
201.06 KB
14 downloads
filedropmaj.git-8ad9892.tar.bz2
164.04 KB
36 downloads
filedropmaj.git-8ad9892.zip
224.42 KB
13 downloads
filedropmaj.git-8b4cf2a.tar.bz2
134.06 KB
37 downloads
filedropmaj.git-8b4cf2a.zip
180.78 KB
14 downloads
filedropmaj.git-8b7e38d.tar.bz2
138.04 KB
41 downloads
filedropmaj.git-8b7e38d.zip
190.39 KB
70 downloads
filedropmaj.git-8df6e40.tar.bz2
143.11 KB
38 downloads
filedropmaj.git-8df6e40.zip
194.66 KB
18 downloads
filedropmaj.git-8e80c84.tar.bz2
138.18 KB
36 downloads
filedropmaj.git-8e80c84.zip
190.30 KB
14 downloads
filedropmaj.git-8ec0fba.tar.bz2
138.37 KB
39 downloads
filedropmaj.git-8ec0fba.zip
191.39 KB
14 downloads
filedropmaj.git-8f7abf6.tar.bz2
153.36 KB
38 downloads
filedropmaj.git-8f7abf6.zip
211.80 KB
13 downloads
filedropmaj.git-923f11a.tar.bz2
138.14 KB
36 downloads
filedropmaj.git-923f11a.zip
191.03 KB
15 downloads
filedropmaj.git-955e82e.tar.bz2
42.71 KB
35 downloads
filedropmaj.git-955e82e.zip
59.77 KB
14 downloads
filedropmaj.git-95add4a.tar.bz2
151.23 KB
40 downloads
filedropmaj.git-95add4a.zip
205.91 KB
14 downloads
filedropmaj.git-96fe0ba.tar.bz2
137.68 KB
32 downloads
filedropmaj.git-96fe0ba.zip
190.34 KB
13 downloads
filedropmaj.git-99a90ce.tar.bz2
137.82 KB
39 downloads
filedropmaj.git-99a90ce.zip
191.20 KB
16 downloads
filedropmaj.git-9a69bb9.tar.bz2
143.19 KB
39 downloads
filedropmaj.git-9a69bb9.zip
194.70 KB
15 downloads
filedropmaj.git-9b6538e.tar.bz2
151.45 KB
36 downloads
filedropmaj.git-9b6538e.zip
202.15 KB
13 downloads
filedropmaj.git-9c4292d.tar.bz2
132.06 KB
37 downloads
filedropmaj.git-9c4292d.zip
176.93 KB
13 downloads
filedropmaj.git-9c78d40.tar.bz2
137.70 KB
37 downloads
filedropmaj.git-9c78d40.zip
190.49 KB
15 downloads
filedropmaj.git-9f1363f.tar.bz2
43.12 KB
40 downloads
filedropmaj.git-9f1363f.zip
60.31 KB
13 downloads
filedropmaj.git-a16c3eb.tar.bz2
90.22 KB
34 downloads
filedropmaj.git-a16c3eb.zip
128.62 KB
14 downloads
filedropmaj.git-a3aa72d.tar.bz2
153.00 KB
37 downloads
filedropmaj.git-a3aa72d.zip
203.86 KB
16 downloads
filedropmaj.git-a6886e4.tar.bz2
144.69 KB
37 downloads
filedropmaj.git-a6886e4.zip
196.95 KB
13 downloads
filedropmaj.git-a8669dc.tar.bz2
135.60 KB
35 downloads
filedropmaj.git-a8669dc.zip
183.34 KB
14 downloads
filedropmaj.git-a9477f1.tar.bz2
135.59 KB
37 downloads
filedropmaj.git-a9477f1.zip
183.45 KB
14 downloads
filedropmaj.git-aa285db.tar.bz2
151.73 KB
38 downloads
filedropmaj.git-aa285db.zip
210.85 KB
14 downloads
filedropmaj.git-aa6ae87.tar.bz2
135.44 KB
37 downloads
filedropmaj.git-aa6ae87.zip
183.88 KB
14 downloads
filedropmaj.git-ab6bc22.tar.bz2
151.71 KB
33 downloads
filedropmaj.git-ab6bc22.zip
210.84 KB
16 downloads
filedropmaj.git-adef726.tar.bz2
153.48 KB
36 downloads
filedropmaj.git-adef726.zip
212.32 KB
14 downloads
filedropmaj.git-afe5877.tar.bz2
144.73 KB
32 downloads
filedropmaj.git-afe5877.zip
197.01 KB
13 downloads
filedropmaj.git-b2d9f8e.tar.bz2
133.22 KB
35 downloads
filedropmaj.git-b2d9f8e.zip
179.27 KB
13 downloads
filedropmaj.git-b41f320.tar.bz2
151.56 KB
33 downloads
filedropmaj.git-b41f320.zip
209.85 KB
18 downloads
filedropmaj.git-b4432ce.tar.bz2
152.96 KB
34 downloads
filedropmaj.git-b4432ce.zip
203.86 KB
14 downloads
filedropmaj.git-b67b08f.tar.bz2
151.27 KB
36 downloads
filedropmaj.git-b67b08f.zip
206.15 KB
16 downloads
filedropmaj.git-b899831.tar.bz2
143.12 KB
35 downloads
filedropmaj.git-b899831.zip
194.60 KB
14 downloads
filedropmaj.git-b8b49c1.tar.bz2
132.59 KB
33 downloads
filedropmaj.git-b8b49c1.zip
178.90 KB
13 downloads
filedropmaj.git-b9c5bcf.tar.bz2
155.92 KB
34 downloads
filedropmaj.git-b9c5bcf.zip
208.70 KB
12 downloads
filedropmaj.git-bbddb1f.tar.bz2
151.63 KB
33 downloads
filedropmaj.git-bbddb1f.zip
209.92 KB
16 downloads
filedropmaj.git-bcaa744.tar.bz2
146.98 KB
37 downloads
filedropmaj.git-bcaa744.zip
200.79 KB
15 downloads
filedropmaj.git-c1ff9dc.tar.bz2
138.39 KB
38 downloads
filedropmaj.git-c1ff9dc.zip
191.43 KB
97 downloads
filedropmaj.git-c20c4b0.tar.bz2
151.64 KB
35 downloads
filedropmaj.git-c20c4b0.zip
210.79 KB
13 downloads
filedropmaj.git-c37f3f7.tar.bz2
145.45 KB
49 downloads
filedropmaj.git-c37f3f7.zip
198.11 KB
22 downloads
filedropmaj.git-c532394.tar.bz2
146.39 KB
37 downloads
filedropmaj.git-c532394.zip
199.91 KB
15 downloads
filedropmaj.git-c6317a4.tar.bz2
152.01 KB
36 downloads
filedropmaj.git-c6317a4.zip
207.08 KB
13 downloads
filedropmaj.git-c748176.tar.bz2
89.44 KB
34 downloads
filedropmaj.git-c748176.zip
126.35 KB
14 downloads
filedropmaj.git-c9ed81f.tar.bz2
135.56 KB
34 downloads
filedropmaj.git-c9ed81f.zip
183.28 KB
16 downloads
filedropmaj.git-c9f9b80.tar.bz2
138.50 KB
34 downloads
filedropmaj.git-c9f9b80.zip
190.66 KB
15 downloads
filedropmaj.git-ca65b73.tar.bz2
152.69 KB
35 downloads
filedropmaj.git-ca65b73.zip
207.87 KB
15 downloads
filedropmaj.git-cd80b77.tar.bz2
153.12 KB
35 downloads
filedropmaj.git-cd80b77.zip
212.01 KB
12 downloads
filedropmaj.git-cffbb2a.tar.bz2
138.22 KB
33 downloads
filedropmaj.git-cffbb2a.zip
190.28 KB
14 downloads
filedropmaj.git-d061ad7.tar.bz2
55.78 KB
47 downloads
filedropmaj.git-d061ad7.zip
74.39 KB
15 downloads
filedropmaj.git-d0af4d6.tar.bz2
57.28 KB
35 downloads
filedropmaj.git-d0af4d6.zip
78.56 KB
15 downloads
filedropmaj.git-d1caa0a.tar.bz2
144.57 KB
37 downloads
filedropmaj.git-d1caa0a.zip
196.63 KB
14 downloads
filedropmaj.git-d5679b5.tar.bz2
152.37 KB
34 downloads
filedropmaj.git-d5679b5.zip
207.52 KB
15 downloads
filedropmaj.git-d72f459.tar.bz2
147.90 KB
36 downloads
filedropmaj.git-d72f459.zip
201.92 KB
13 downloads
filedropmaj.git-d958c91.tar.bz2
144.67 KB
37 downloads
filedropmaj.git-d958c91.zip
196.88 KB
17 downloads
filedropmaj.git-d96784f.tar.bz2
135.58 KB
36 downloads
filedropmaj.git-d96784f.zip
183.46 KB
12 downloads
filedropmaj.git-da4b73f.tar.bz2
152.62 KB
33 downloads
filedropmaj.git-da4b73f.zip
203.48 KB
13 downloads
filedropmaj.git-dd24240.tar.bz2
138.27 KB
33 downloads
filedropmaj.git-dd24240.zip
190.45 KB
72 downloads
filedropmaj.git-e11e772.tar.bz2
152.09 KB
33 downloads
filedropmaj.git-e11e772.zip
211.33 KB
14 downloads
filedropmaj.git-e61478e.tar.bz2
135.95 KB
37 downloads
filedropmaj.git-e61478e.zip
183.91 KB
14 downloads
filedropmaj.git-e7a2547.tar.bz2
133.80 KB
33 downloads
filedropmaj.git-e7a2547.zip
180.05 KB
16 downloads
filedropmaj.git-e8a3b95.tar.bz2
138.15 KB
37 downloads
filedropmaj.git-e8a3b95.zip
191.04 KB
12 downloads
filedropmaj.git-eac86d5.tar.bz2
155.65 KB
33 downloads
filedropmaj.git-eac86d5.zip
208.28 KB
12 downloads
filedropmaj.git-ed83bf9.tar.bz2
135.16 KB
34 downloads
filedropmaj.git-ed83bf9.zip
182.91 KB
15 downloads
filedropmaj.git-ee50d40.tar.bz2
135.59 KB
36 downloads
filedropmaj.git-ee50d40.zip
183.48 KB
16 downloads
filedropmaj.git-efdb4df.tar.bz2
155.87 KB
36 downloads
filedropmaj.git-efdb4df.zip
208.72 KB
14 downloads
filedropmaj.git-f1554f8.tar.bz2
151.30 KB
37 downloads
filedropmaj.git-f1554f8.zip
206.22 KB
16 downloads
filedropmaj.git-f72a07b.tar.bz2
153.44 KB
37 downloads
filedropmaj.git-f72a07b.zip
212.11 KB
17 downloads
filedropmaj.git-f7ea5a1.tar.bz2
147.46 KB
36 downloads
filedropmaj.git-f7ea5a1.zip
201.32 KB
17 downloads
filedropmaj.git-f8a7353.tar.bz2
138.49 KB
36 downloads
filedropmaj.git-f8a7353.zip
190.66 KB
18 downloads
filedropmaj.git-fb84a8d.tar.bz2
137.61 KB
41 downloads
filedropmaj.git-fb84a8d.zip
190.70 KB
18 downloads
filedropmaj.git-fdcf5d3.tar.bz2
152.34 KB
40 downloads
filedropmaj.git-fdcf5d3.zip
207.53 KB
17 downloads
filedropmaj.git-feca42d.tar.bz2
132.90 KB
39 downloads
filedropmaj.git-feca42d.zip
179.44 KB
20 downloads