public function ThreadToPetitHTML()
 {
     global $threadInfos;
     $myFavoriFinder = new FavoriFinder($threadInfos['Thread ID']);
     $myCommentFinder = new CommentFinder($threadInfos['Thread ID']);
     $fav = $myFavoriFinder->Find();
     $comCount = $myCommentFinder->Find();
     if ($comCount == FALSE) {
         $comCount = 0;
     }
     $name2 = str_replace(" ", "-", $threadInfos['Thread Name']);
     $name3 = str_replace("?", "", $name2);
     $name4 = str_replace("ç", "c", $name3);
     $name4 = str_replace("ğ", "g", $name4);
     $name4 = str_replace("ı", "i", $name4);
     $name4 = str_replace("ö", "o", $name4);
     $name4 = str_replace("ş", "s", $name4);
     $name4 = str_replace("ü", "u", $name4);
     $name4 = str_replace("İ", "i", $name4);
     $name4 = str_replace("Ç", "C", $name4);
     $name4 = str_replace("Ğ", "G", $name4);
     $name4 = str_replace("Ö", "O", $name4);
     $name4 = str_replace("Ş", "S", $name4);
     $name4 = str_replace("Ü", "U", $name4);
     $name4 = str_replace("'", "-", $name4);
     $name4 = str_replace("\"", "-", $name4);
     $name4 = str_replace(",", "-", $name4);
     echo "\n\t<a href=\"http://serinhikaye.com/thread/" . $threadInfos['Thread ID'] . "/" . $name4 . "\">\n \t<div style=\"display:inline-block;margin-left:2.5%;background-color:#e6e6e6;width:250px;height:200px;\" class=\"thumbnail\">\n                <div style=\"font-family: 'Josefin Sans', sans-serif;font-size:18px;\" class=\"caption\">\n\t\t\t<p style=\"text-align:left;margin-left:2%;\">\n\t\t\t\t<span style=\"font-size:18px;\">\n\t\t\t\t" . $threadInfos['Thread Name'] . "\n\t\t\t\t</span>\n\t\t\t\t\n\t\t\t\t<br/><br/>\n\t\t\t\t<span style=\"color:#e6e6e6;font-style:italic;font-size:18px;\">\n\t\t\t\t\tBir " . $threadInfos['Thread Writer'] . " eseri.\n\t\t\t\t</span>\n\t\t\t</p>\n\t\t\t<p style=\"font-size:23px;font-style:bold;text-align:left;margin-left:2%;color:#d66f69;\">\n\t\t\t\t" . $threadInfos['Thread Point'] . " <i class=\"fa fa-heart\"></i>\n\t\t\t\t<span style=\"margin-left:1%;color:#ffb92a\">\n\t\t\t\t" . $fav . " <i class=\"fa fa-bookmark\"></i> </span> \n\t\t\t\t<span style=\"margin-left:1%;color:#aaf200\">\n\t\t\t\t" . $comCount . " <i class=\"fa fa-comment\"></i>\n\t\t\t\t</span>\n\t\t\t</p>\n                </div>\n\t\t</a>\n\t\t<div style=\"font-family: 'Josefin Sans', sans-serif;font-size:18px;\" class=\"caption-btm\">\n\t\t\t<p style=\"text-align:left;margin-left:2%;\">\n\t\t\t\t<span style=\"font-size:18px;\">\n\t\t\t\t" . $threadInfos['Thread Name'] . "\n\t\t\t\t</span>\n\t\t\t\t<br/>\n\t\t\t</p>\n\t\t</div>\n                <img style=\"width:100%;background-color:#e6e6e6;\" src=\"" . $threadInfos['Thread Picture'] . "\" alt=\"...\">\n\t\t<img style=\"width:100%;background-color:#e6e6e6;\" src=\"" . $threadInfos['Thread Picture'] . "\" alt=\"...\">\n        </div>\n\t";
     echo "<style media=\"screen\" type=\"text/css\">";
     echo "\t\n.thumbnail {\n    position:relative;\n    overflow:hidden;\n}\n.caption-btm{\n\tpadding-right:3%;\n\tpadding-left:3%;\n\tposition:absolute;\n\tbottom:0px;\n\twidth:100%;\n\tbackground:rgba(50,50,50,0.5);\n\tcolor :#e6e6e6;\n\tz-index:2;\n\tdisplay:table;\n}\n.caption {\n    position:absolute;\n    top:0px;\n    right:0;\n    background:rgba(50, 50,50, 0.5);\n    width:100%;\n    height:100%;\n    display: none;\n    text-align:center;\n    color:#fff !important;\n    z-index:2;\n}";
     echo "</style>";
     echo "<script type=\"text/javascript\">";
     echo "\t\n\t\$( document ).ready(function() {\n    \$(\"[rel='tooltip']\").tooltip();    \n \n    \$('.thumbnail').hover(\n        function(){\n\t\t\$(this).find('.caption-btm').fadeOut(260);\n        \t\$(this).find('.caption').fadeIn(260);\n        },\n        function(){\n            \$(this).find('.caption-btm').fadeIn(260);\n\t    \$(this).find('.caption').fadeOut(260);\n        }\n    ); \n});";
     echo "</script>";
 }
 public function ThreadToHTML()
 {
     global $threadInfos;
     $name2 = str_replace(" ", "-", $threadInfos['Thread Name']);
     $name3 = str_replace("?", "", $name2);
     $name4 = str_replace("ç", "c", $name3);
     $name4 = str_replace("ğ", "g", $name4);
     $name4 = str_replace("ı", "i", $name4);
     $name4 = str_replace("ö", "o", $name4);
     $name4 = str_replace("ş", "s", $name4);
     $name4 = str_replace("ü", "u", $name4);
     $name4 = str_replace("İ", "i", $name4);
     $name4 = str_replace("Ç", "C", $name4);
     $name4 = str_replace("Ğ", "G", $name4);
     $name4 = str_replace("Ö", "O", $name4);
     $name4 = str_replace("Ş", "S", $name4);
     $name4 = str_replace("Ü", "U", $name4);
     $name4 = str_replace("'", "-", $name4);
     $name4 = str_replace("\"", "-", $name4);
     $name4 = str_replace(",", "-", $name4);
     $threadID = $threadInfos['Thread ID'];
     if ($threadInfos['Thread Category'] == "Alakasız") {
         $catLink = "category.php?cat=a";
     }
     if ($threadInfos['Thread Category'] == "Bilim/Kültür") {
         $catLink = "category.php?cat=bk";
     }
     if ($threadInfos['Thread Category'] == "Sosyal ilişkiler") {
         $catLink = "category.php?cat=s";
     }
     if ($threadInfos['Thread Category'] == "Sağlık/Spor") {
         $catLink = "category.php?cat=ss";
     }
     if ($threadInfos['Thread Category'] == "Yemek/İçmek") {
         $catLink = "category.php?cat=yi";
     }
     if ($threadInfos['Thread Category'] == "Bilgisayar/Elektronik") {
         $catLink = "category.php?cat=be";
     }
     if ($threadInfos['Thread Category'] == "Sanat/Eğlence") {
         $catLink = "category.php?cat=se";
     }
     $twitterText = $this->twitterTextGenerator($threadInfos['Step Count'] . " adımda " . $threadInfos["Thread Name"]);
     echo " <style media=\"screen\" type=\"text/css\">";
     echo ".affix {\n\t\t\tposition : fixed;\n\t\t\ttop : 70px;\n\t\t\n\t\t}";
     echo " </style>";
     echo "<div id=\"wrapper_thread\" style=\"background-color:#e6e6e6;border:1px solid #c7d0d5;border-radius:15px;width: 100%; max-width:100%;\">";
     echo "<div id=\"hastag\" style=\"margin-top:1%;\">";
     echo "<a style=\" font-family: 'Josefin Sans', sans-serif; font-size:25px; margin-left:5%\" href=" . $catLink . ">";
     echo "#" . $threadInfos['Thread Category'];
     echo "</a>";
     echo "</div>";
     echo "<div id=\"div_img\" style=\"margin-left:5%; margin-top:1%;\">";
     echo "<img src=\"" . $threadInfos['Thread Picture'] . "\" style=\"max-width:80%;\"/>";
     echo "</div>";
     echo "<div id=\"thread_adi_ve_yazar_adi_div\" style=\"margin-top:1%\">";
     echo "<p style=\"color:#cb7c7a;margin-left:5%;font-size:28px;font-family: 'Josefin Sans', sans-serif;\">";
     echo $threadInfos['Thread Name'] . "<br/> [" . $threadInfos['Step Count'] . " adım]";
     echo "</p>";
     echo "<p style=\"color:#6e6e6e;margin-left:5%;font-size:20px;font-family: 'Josefin Sans', sans-serif;\" >";
     echo "Bir " . "<a href=\"user.php?name=" . $threadInfos['Thread Writer'] . "\">" . $threadInfos['Thread Writer'] . "</a>" . " eseri." . " (" . $threadInfos['Thread Date'] . ")";
     echo "</p>";
     echo "</div>";
     echo "<div id=\"sosyal buttonlar ve puan\" style=\"margin-bottom:2%;margin-left:5%;margin-top:1%;\">";
     echo "<button id=\"fbShareButton2\" title=\"Facebook\" class=\"btn btn-facebook\"><i class=\"fa fa-facebook\"></i></button>";
     echo "<a id=\"twtShareButton2\" href=\"http://twitter.com/share?text=" . $twitterText . "&hashtags=SerinHikaye\" title=\"Twitter\" style=\"\" class=\"btn btn-twitter\"><i class=\"fa fa-twitter\"></i></a>";
     /*echo "<a title=\"Yorum yap\" href=\"javascript:void(0)\" class=\"btn btn-warning\"><i class=\"fa fa-comment-o\"></i></a>";*/
     if (isset($_SESSION["user_name"])) {
         if ($_SESSION["user_name"] == $threadInfos['Thread Writer']) {
             echo "<form style=\"display:inline-block;\" id=\"thread_sil_formu\" method=\"post\" action=\"threadEreaser.php\">";
             echo "<input type=\"text\" name=\"thread_sil_id_input\" id=\"thread_sil_id_input\" style=\"display:none;\"/>";
             echo "</form>";
             echo "<a  title=\"Bu gönderini sil\"class=\"btn btn-danger\" id=\"sil_resmi\" href=\"javascript:void(0)\">";
             echo "<i class=\"fa fa-times\"></i>";
             echo "</a>";
         } else {
             echo "<a title=\"Yazara mesaj yolla\"class=\"btn btn-primary\" id=\"mesaj_yolla_resmi\" href=\"javascript:void(0)\">";
             echo "<i class=\"fa fa-envelope\"></i>";
             echo "</a>";
         }
     }
     echo "</div>";
     echo "</div>";
     echo "<div id=\"top\"></div>";
     for ($i = 1; $i <= $threadInfos['Step Count']; $i++) {
         $myStep = $this->loadStep($i);
         echo "<div id=\"div_" . $i . "\">";
         echo $myStep->StepToHTML();
         echo "</div>";
     }
     echo "<div class=\"container\" style=\"margin-top:2%;\">";
     echo "<div class=\"row\" id=\"before_sticker\"></div>";
     echo "<div class=\"row\" id=\"sticker\" >";
     echo "<div class=\"col-md-12 col-lg-1 \">";
     $fblink = "http://www.facebook.com/sharer.php?u=http://www.serinhikaye.com/thread.php?id=" . $threadInfos["Thread ID"];
     $caption = $threadInfos["Step Count"] . " adımda " . $threadInfos["Thread Name"];
     $petitcaption = "Bir " . $threadInfos["Thread Writer"] . " eseri.";
     $mySosyalButton = new SosyalButton(array($threadInfos["Thread Picture"], $caption, $threadInfos["Thread ID"], $petitcaption));
     $mySosyalButton->SosyalButtonToHTML();
     echo "<div title=\"Puan\" id=\"puan_div\" style=\"margin-bottom:5%;margin-top:5%;background-color:#e6e6e6;border:1px solid #c7d0d5;border-radius:15px;\">";
     echo "<p style=\"text-align:center;padding-top:5%;word-wrap:break-word;font-size:23px;color:#5bc236;font-family: 'Josefin Sans', sans-serif;width:100%\">";
     echo "<span id=\"puan_p\" style=\"display:block;\">";
     echo $threadInfos['Thread Point'];
     echo "</span>";
     echo "<img src=\"images/begeni.gif\" alt=\"puan\"style=\"width:50px;max-width:50px;\"/>";
     echo "</p>";
     echo "</div>";
     echo "<div title=\"Bunu favorileyenler\" id=\"favori_div\" style=\"margin-bottom:5%;margin-top:5%;background-color:#e6e6e6;border:1px solid #c7d0d5;border-radius:15px;\">";
     echo "<a href=\"javascript:void(0)\" id=\"bunu_favlayanlar_a\" style=\"text-decoration:none;\">";
     echo "<p style=\"text-align:center;padding-top:5%;word-wrap:break-word;font-size:23px;color:#ffb92a;font-family: 'Josefin Sans', sans-serif;width:100%\">";
     echo "<span id=\"puan_p\" style=\"display:block;\">";
     $myFavoriFinder = new FavoriFinder($threadID);
     echo $myFavoriFinder->Find();
     echo "</span>";
     echo "<img src=\"images/fav.gif\" alt=\"fav\"style=\"width:50px;max-width:50px;\"/>";
     echo "</p>";
     echo "</a>";
     echo "</div>";
     echo "</div>";
     echo "<div class=\"col-md-12 col-lg-8 col-sm-12 \" style=\"padding-right:2%;\">";
     $myComments = new Comments(intval($threadID));
     $myComments->CommentsToHTML();
     echo "</div>";
     echo "</div>";
     echo "</div>";
     echo "<div id=\"mesajyollayicidiv\"></div>";
     echo "<div id=\"bunu_favlayanlar_div\"></div>";
     echo "<script type=\"text/javascript\">\n\t\t\t\t\$('#twtShareButton2').click(function(e){\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tvar width  = 575,\n        \t\t\t\theight = 400,\n        \t\t\t\tleft   = (\$(window).width()  - width)  / 2,\n        \t\t\t\ttop    = (\$(window).height() - height) / 2,\n        \t\t\t\turl    = this.href,\n        \t\t\t\topts   = 'status=1' +\n                 \t\t\t',width='  + width  +\n                 \t\t\t',height=' + height +\n                 \t\t\t',top='    + top    +\n                 \t\t\t',left='   + left;\n    \n    \t\t\t\t\twindow.open(url, 'twitter', opts);\n\t\t\t\t});\n\t\t\t\$('#fbShareButton2').click(function(){\n\t\t\t\t\tFB.ui({\n  \t\t\t\t\tmethod: 'feed',\n  \t\t\t\t\tlink: 'http://serinhikaye.com/thread/" . $threadInfos["Thread ID"] . "/" . $name4 . "',\n  \t\t\t\t\tcaption: 'Bir " . $threadInfos['Thread Writer'] . " eseri.',\n\t\t\t\t\tpicture: 'http://www.serinhikaye.com/" . $threadInfos["Thread Picture"] . "',\n\t\t\t\t\tname: '" . $threadInfos['Step Count'] . " adımda " . $threadInfos['Thread Name'] . " - SerinHikaye.com'\n\t\t\t\t\t}, function(response){});\n\t\t\t});\n\n\t\t\t\$(document).ready(function() {\n\t\t\t\tvar currWidth = \$('#sticker').width();\n\t\t\t\t\n\t\t\t\tvar s = \$('#sticker');\n\t\t\t\tvar p = \$('#before_sticker');\n\n\t\t\t\t\$(window).scroll(function(){\n\t\t\t\t\tvar pos = p.position();\n\t\t\t\t\tvar windowpos = \$(window).scrollTop();\n\t\t\t\t\tif (windowpos >= pos.top) {\n\t\t\t\t\t\tif (\$(window).width()>1028){\n\t\t\t\t\t\t\ts.addClass(\"affix\");\n\t\t\t\t\t\t\ts.css(\"max-width\",currWidth);\n\t\t\t\t\t\t\ts.css(\"min-width\",currWidth);\n\t\t\t\t\t\t\tif (\$('#sticky_footer_div').is(':hidden'));\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\$('#sticky_footer_div').fadeIn(500);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tif (\$('#sticky_footer_div').is(':visible'))\n\t\t\t\t\t\t\t\$('#sticky_footer_div').fadeOut(500);\n\t\t\t\t\t\ts.removeClass(\"affix\");\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t\$('#mesaj_yolla_resmi').click(function(){\n\t\t\t\t\t\$('#mesajyollayicidiv').load('messagesender.php?kime=" . $threadInfos["Thread Writer"] . "',function(){\n\t\t\t\t\t\t\$('#mesaj_yollayici_modal').modal(\"toggle\");\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t\t\$('#bunu_favlayanlar_a').click(function(){\n\t\t\t\t\t\$('#bunu_favlayanlar_div').load('favlayanlar.php?id=" . $threadInfos["Thread ID"] . "',function(){\n\t\t\t\t\t\t\$('#bunu_favlayanlar_modal').modal(\"toggle\");\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\t\n\t\t\t\t\$('#sil_resmi').click(function(){\n\t\t\t\t\t\$('#thread_sil_id_input').val(\"" . $threadInfos['Thread ID'] . "\");\n\t\t\t\t\t\$('#thread_sil_formu').ajaxForm({\n\t\t\t\t\t\tsuccess: function(msg){\n\t\t\t\t\t\t\tmsg = \$.parseJSON(msg);\n\t\t\t\t\t\t\tif (msg=='OK')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\talert(\"İçeriğiniz başarıyla silindi.\");\n\t\t\t\t\t\t\t\twindow.location.href='http://www.serinhikaye.com';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (msg == 'CONNECT_ERR')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\talert(\"Şu an veritabanımıza bağlanamıyoruz. Bu sorunu en kısa sürede gidericez.\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (msg =='QUERY_ERR')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\talert(\"Veritabanımızla ilgili birtakım sıkıntılar yaşıyoruz. Bu sorunu en kısa sürede gidericez.\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror : function(){\n\t\t\t\t\t\t\talert(\"Form silici ltd şti sıçtı.\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}).submit();\n\t\t\t\t});\n\n\t\t\t});\t\t\t\n\t\t\t</script>";
 }