html,body {
background:#5a70b3;
color:#000;
font-family:"Helvetica", "Arial", "Bitstream Vera Sans", "Verdana", sans-serif;
font-size:93.3%;
margin:0;
padding:0;
}

a {
color:#e77700;
text-decoration:none;
}

a:hover {
color:#FB9E3B;
text-decoration:none;
}

hr {
background-color:#5a70b3;
border:0;
clear:both;
color:#5a70b3;
height:1px;
}

table {
border-collapse:collapse;
border-spacing:0;
clear:both;
empty-cells:show;
width:100%;
}

th,td {
border:1px solid #e7e7e7;
}

th {
background:url(http://z4.ifrm.com/static/1/sub.png) repeat-x top #fafafa;
color:#777;
font-weight:400;
padding:3px 5px;
text-align:left;
}

td {
background:#fafafa;
color:#333;
padding:5px 10px;
}

th a,th a:hover {
color:#777;
font-weight:700;
}

h1 {
font-size:200%;
}

h2,h3 {
font-size:100%;
}

.category h2,.topic h2,#portal h2,#portal_foot h2,thead th {
background:url(http://z4.ifrm.com/static/1/css/h2.png) repeat-x top #6a7db6;
color:#fff;
font-size:110%;
font-weight:700;
}

thead th {
border:1px solid #5a70b3;
border-bottom-width:1px;
padding:5px;
text-align:center;
}

h2.special {
background:url(http://z4.ifrm.com/static/1/css/h2s.png) repeat-x top #FB9D3A;
border-color:#e77700;
}

input,select,textarea,button,a.btn_fake {
background:#fafafa;
border:1px solid #BFC8E3;
color:#333;
padding:3px 5px;
vertical-align:middle;
}

textarea {
font-family:"Verdana", sans-serif;
font-size:100%;
margin:auto;
width:98%;
}

input:focus,input.focus,textarea:focus,textarea.focus {
border-color:#5a70b3;
}

.submit_error {
background:#fff8eb;
border:1px solid #e77700;
}

button,a.btn_fake {
background:url(http://z4.ifrm.com/static/1/css/btn.png) repeat-x top #f8f8f8;
color:#666;
cursor:default;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:90%;
overflow:visible;
width:auto;
}

button:hover,a.btn_fake:hover {
border-color:#3a5197;
}

button.btn_text {
background:none;
border:0;
cursor:pointer;
font-family:Arial, "Bitstream Vera Sans", Verdana, sans-serif;
font-size:100%;
}

.notice {
background:#fff;
border:2px solid #e7e7e7;
color:#333;
margin:10px auto 0;
width:70%;
}

.notice dt {
color:#8CB5E7;
font-weight:700;
}

.notice dd {
font-style:italic;
}

dl.info {
background:#f6f6f6; 
border-color:#3a5197; 
}

.info dt {
background:#5a70b3;
color:#fff;
}

dl.error {
background:#fafafa;
border-color:#BC3737;
}

.error dt {
background:#e7e7e7;
color:#BC3737;
}

#top ul,#nav,ul.cat-pages,ul.cat-topicpages,table.calendar ul,div.meta_menu ul,#pm_folderlist,#profile_menuwrap ul {
list-style:none;
padding:0;
}

#profile_menuwrap ul,ul.cat-topicpages,blockquote dl,#fast-reply dd {
margin:0;
}

#top li,#nav li,ul.cat-pages li,ul.cat-topicpages li,table.calendar li,#pm_folderlist li,#profile_menuwrap li,#ucp_gallery li {
display:inline;
}

#top_bar {
background:url(http://z4.ifrm.com/static/1/css/topbar.png) repeat-x top #FB9D3A;
height:19px;
}

#top {
background:url(http://z4.ifrm.com/static/1/css/dropli.png) repeat-x top #586eb1;
border-bottom:1px solid #3a5197;
height:20px;
padding:0 2% 4px;
margin-bottom:12px;
}

#top_info {
color:#fff;
float:left;
margin-top:4px;
}

#top_menu {
background:#3a5197;
border-left:1px solid #3a5197;
float:right;
margin-top:0px;
}

.drop_menu li {
background:url(http://z4.ifrm.com/static/1/css/dropli.png) repeat-x top #586eb1;
float:left;
margin-right:1px;
text-align:center;
}

.drop_menu a {
color:#5a70b3;
display:block;
padding:4px .25em;
position:relative;
width:9em;
}

.drop_menu a:hover {
color:#ef7400;
}

.drop_menu ul {
-moz-opacity:0.85;
border-top:1px solid #3A5197;
color:#fff;
left:-999em;
margin:0;
opacity:0.85;
position:absolute;
width:9.4em;
}

.drop_menu ul li {
background:#5a70b3;
font-size:85%;
margin:0;
padding:0;
width:100%;
}

.drop_menu ul li a {
border:0 solid #3A5197;
border-width:0 1px 1px;
display:block;
padding:4px 5%;
width:90%;
}

.drop_menu li ul li a:hover {
background:#3a5197;
}

#logo {
background:url(http://z4.ifrm.com/static/1/css/logobg.png) repeat-x top #566cb0;
border:1px solid #3a5197;
border-bottom:0;
clear:both;
margin:0 2%;
}

#submenu_bar {
background:url(http://z4.ifrm.com/static/1/css/submenubar.png) repeat-x top #FB9D3A;
border-left:1px solid #3a5197;
border-right:1px solid #3a5197;
height:14px;
margin:0 2%;
}

#submenu {
background:url(http://z4.ifrm.com/static/1/css/dropli.png) repeat-x top #586eb1;
border-left:1px solid #3a5197;
border-right:1px solid #3a5197;
color:#586eb1;
font-size:85%;
margin:0 2%;
padding:3px 1% 4px;
text-align:right;
}

#wrap {
background:#fff;
border:1px solid #3A5197;
margin:0 2% 30px;
}

#nav {
color:#5a70b3;
height:1%;
padding:10px 1%;
}

.meta_box {
background:url(http://z4.ifrm.com/static/1/css/boxbg.png) repeat-x top #D8DCEB;
border:1px solid #BFC8E3;
font-size:85%;
line-height:150%;
padding:10px 25px;
}

.meta_menu {
background:#F6F6F6;
border:1px solid #e7e7e7;
padding:0;
width:49%;
}

.meta_menu h3 {
background:url(http://z4.ifrm.com/static/1/css/h2s.png) repeat-x top #FB9D3A;
border:1px solid #e77700;
clear:both;
color:#FFF;
font-size:100%;
font-weight:700;
margin:-1px;
text-align:center;
}

.meta_menu a,.meta_menu a:hover {
color:#666;
}

ul.cat-pages {
float:left;
font-size:90%;
margin:15px 0;
padding: 5px 1px;
width:49%;
}

.cat-pages a,.cat-pagesjump i,.cat-topicpages a {
background:#fff;
border:1px solid #e7e7e7;
color:#5a70b3;
}

.cat-pages a:hover,.cat-topicpages a:hover {
background:#f6f6f6;
color:#5a70b3;
}

.cat-pages span {
background:#5a70b3;
border:1px solid #3a5197;
color:#FFF;
cursor:default;
font-weight:700;
padding:2px 5px;
}

.cat-pages input {
background:#fff;
color:#5a70b3;
padding:3px 5px;
vertical-align:baseline;
}

ul.cat-topicpages {
float:right;
font-size:80%;
padding:1px 0;
}

tr.generic td,div.generic {
font-size:120%;
font-weight:700;
padding:20px;
text-align:center;
}

td.c_head,td.c_foot,td.c_sort {
background:url(http://z4.ifrm.com/static/1/sub.png) repeat-x top #f6f6f6;
color:#666;
font-size:80%;
}

td.c_desc {
background:#f6f6f6;
font-weight:700;
text-align:right;
vertical-align:middle;
width:200px;
}

td.c_desc small {
display:block;
font-weight:400;
}

tr.pm_new td {
background:#D8DCEB;
font-weight:700;
}

tr.hidden td.c_post {
background:#D8DCEB;
}

.bday {
background:url(http://z4.ifrm.com/static/1/s_minibday.png) no-repeat;
color:#425384;
font-size:90%;
font-weight:700;
height:16px;
padding:2px 2px 2px 18px;
width:20px;
}

.c_mark {
background:#f6f6f6;
text-align:center;
width:1%;
}

.c_forum {
color:#666;
font-size:80%;
width:60%;
}

.c_forum strong a,.c_last strong a {
color:#425384;
}

.c_forum strong a {
font-size:135%;
}

td.c_last {
background:#f6f6f6;
font-size:85%;
}

.c_forum-desc {
color:#333;
font-size:85%;
}

.c_last-title {
background:url(http://z4.ifrm.com/static/1/last.gif) no-repeat left;
display:block;
line-height:16px;
padding-left:10px;
}

td.c_info-v,td.c_info-t,td.c_info-r {
font-size:80%;
padding:5px;
text-align:center;
}

td.c_subforum {
background:#f6f6f6;
color:#425384;
font-size:80%;
font-style:italic;
}

.cat_head td {
border-color:#5a70b3;
padding:0;
}

#stats .cat_head td {
border-color:#e77700;
}

.description {
color:#666;
font-size:85%;
}

a.member:hover {
color:#666;
}

td#stats_events a,td#stats_events span {
background:url(http://z4.ifrm.com/static/1/s_minical.png) no-repeat 2px;
padding:4px 0 4px 20px;
}

td.c_username {
background:#f6f6f6;
padding:2px 0;
text-align:center;
}

td.c_username a {
font-size:140%;
font-weight:700;
}

td.c_user {
font-size:80%;
}

td.c_user dl {
background:#f6f6f6;
border:1px solid #e7e7e7;
margin:10px 0;
padding:5px 7px;
width:160px;
}

dl.user_profile {
overflow:hidden;
word-wrap:break-word;
}

dl.user_profile dd {
font-style:italic;
margin-left:8px;
}

dl.user_info dd {
font-weight:700;
margin-bottom:1px;
}

#profile_menu ul {
-moz-opacity:1;
border-top:0;
opacity:1;
}

#profile_menu a {
background:#5a70b3;
border:1px solid #3a5197;
}

#profile_menu li li a {
border-top:0;
}

#profile_menu li ul li a:hover {
background:#5a70b3;
}

td.c_poll-choice label {
font-weight:700;
padding-left:1em;
}

td.c_poll-votes {
font-size:120%;
text-align:center;
width:15%;
}

td.c_poll-bar div {
background:url(http://z4.ifrm.com/static/1/poll_b.png) no-repeat right;
float:left;
height:12px;
padding-right:3px;
}

td.c_poll-bar span {
background:url(http://z4.ifrm.com/static/1/poll_l.png) no-repeat;
display:block;
float:left;
height:12px;
width:3px;
}

.editby,.queued {
border:1px dotted #e7e7e7;
color:#999;
font-size:85%;
font-style:italic;
margin-top:1em;
padding:3px 5px;
}

.queued {
background-color:#D8DCEB;
border-color:#5a70b3;
}

blockquote {
background:#f6f6f6;
border:1px solid #3a5197;
margin:10px auto;
padding-bottom:1px;
width:98%;
}

blockquote dl {
background:url(http://z4.ifrm.com/static/1/quote.png) repeat-x top #6677AF;
border-bottom:1px solid #3a5197;
color:#fff;
}

blockquote dl dt {
color:#fff;
float:left;
font-weight:700;
}

code {
background:#f6f6f6;
display:block;
font-family:Monaco, Consolas, "Courier New", Courier, monospace;
white-space:normal;
}

div.spoiler {
border:1px solid #5a70b3;
border-top:0;
padding:5px 7px;
}

div.spoiler_toggle {
background:url(http://z4.ifrm.com/static/1/quote.png) repeat-x top #6677AF;
border:1px solid #3a5197;
color:#fff;
cursor:pointer;
font-weight:700;
padding:2px 4px;
}

td.c_postinfo {
background:#f6f6f6;
color:#999;
font-size:80%;
vertical-align:middle;
}

td.c_sig {
color:#666;
font-size:80%;
}

td.c_sig blockquote {
background:none transparent;
border:0;
border-left:3px solid #999;
padding-left:5px;
}

td.c_sig blockquote dl {
background:none transparent;
border:0;
color:#666;
}

td.c_sig blockquote dl dt,td.c_sig blockquote dl dd {
color:#666;
padding:0;
}

td.c_sig blockquote div {
background:transparent;
margin-left:5px;
padding:0;
}

tr.c_postfoot {
background:#f6f6f6;
clear:both;
}

td.c_footicons,td.c_postinfo {
width:100%;
}

td.c_username {
width:175px;
}

.c_next a {
display:block;
font-size:125%;
font-weight:700;
text-align:center;
}

td.c_view {
background:#f6f6f6;
color:#777;
}

div.c_view-list {
color:#999;
font-size:92.5%;
}

dl#fast-reply dt {
background:url(http://z4.ifrm.com/static/1/css/h2s.png) repeat-x top #FB9D3A;
border:1px solid #e77700;
color:#FFF;
font-size:110%;
font-weight:700;
margin:0;
padding:5px;
}

dl#fast-reply dd {
background:#fafafa;
border:1px solid #e7e7e7;
padding:15px 0;
text-align:center;
}

#c_post-preview {
background:#f6f6f6;
border:1px solid #BFC8E3;
margin:0 auto 10px;
padding:5px;
text-align:left;
width:98%;
}

#c_post-resize span {
color:#e7e7e7;
cursor:pointer;
font-size:225%;
padding:20px 5px 0;
}

#emot_wrap {
background:#f6f6f6;
border:1px solid #e7e7e7;
}

#emot_wrap h3 {
background:url(http://z4.ifrm.com/static/1/sub.png) repeat-x top #f6f6f6;
border-bottom:1px solid #e7e7e7;
color:#999;
font-size:120%;
text-align:center;
}

#emot_end {
border-top:1px solid #e7e7e7;
display:block;
font-weight:700;
padding:4px 0;
text-align:center;
}

#pm_folders {
border-left:1px solid #e7e7e7;
border-right:1px solid #e7e7e7;
padding-top:30px;
vertical-align:top;
width:150px;
}

#pm_folderlist {
position: relative;
margin-left:0;
margin-top:0
}

#pm_folderlist li {
background:url(http://z4.ifrm.com/static/1/pmfolder.png) no-repeat 5px;
display:list-item;
margin-bottom:4px;
padding-left:28px;
}

#pm_forwarded {
border:1px dotted #e7e7e7;
color:#999;
font-size:90%;
font-style:italic;
margin-top:1em;
padding:3px 5px;
}

#ucp_gallery a {
color:#425384;
font-weight:700;
}

#ucp_gallery a:hover {
color:#5A70B3;
}

.calendar td.cal_inactive {
background:#f6f6f6;
color:#e7e7e7!important;
}

.calendar td div {
background:#f6f6f6;
border-bottom:1px solid #e7e7e7;
font-weight:700;
padding:5px 7px;
}

.calendar div a {
background:url(http://z4.ifrm.com/static/1/s_minibday.png) no-repeat 5px;
float:right;
font-size:80%;
font-weight:400;
padding:0 0 6px 24px;
}

.calendar li a,.calendar li span {
border-color:transparent;
border-style:solid;
border-width:1px;
display:block;
padding:3px;
}

.calendar td#cal_current {
background:#fff;
border:2px solid #5a70b3;
}

div.portal_content {
background:#fafafa;
border:1px solid #e7e7e7;
font-size:88.3%;
margin:0;
padding:5px 7px;
}

#portal h2 {
font-size:88.3%;
}

#portal h4 {
background:url(http://z4.ifrm.com/static/1/sub.png) repeat-x top #fafafa;
border-left:1px solid #e7e7e7;
border-right:1px solid #e7e7e7;
color:#777;
font-size:88.3%;
font-weight:400;
margin:0;
padding:5px 7px;
}

#faq dt a {
color:#425384;
font-size:120%;
font-weight:700;
}

#faq dd.faq_more a,#faq dl.faq_more a:hover {
color:#999;
font-style:italic;
}

.search_results {
background:#fafafa;
border:1px solid #e7e7e7;
margin-bottom:1em;
padding:5px 7px;
}

.search_results h3 {
display:inline;
font-size:125%;
}

.search_results cite,.search_results p {
color:#777;
font-size:85%;
margin:0;
}

#findposts .c_mark {
color:#5a70b3;
font-size:200%;
font-weight:700;
vertical-align:top;
}

#pmtoast {
background:#fff;
border:2px solid #3a5197;
bottom:10px;
color:#333;
display:none;
font-size:90%;
position:fixed;
right:10px;
text-align:right;
text-decoration:none;
width:200px;
z-index:1;
}

#pmtoast:hover {
border-color:#3a5197;
}

#pmlink {
background:url(http://z4.ifrm.com/static/1/toast.png) no-repeat 5px;
color:#5a70b3;
display:block;
padding:10px 10px 10px 55px;
text-decoration:none;
}

#pmlink big {
color:#5a70b3;
display:block;
font-weight:700;
padding-bottom:5px;
}

#pmlink strong {
color:#E77700;
}

#pmclose {
border-top:1px solid #3a5197;
color:#5a70b3;
display:block;
font-size:80%;
padding:1px 10px;
}

#pmclose:hover {
color:#3a5197;
}

#foot_wrap {
margin:20px 1px 20px 0;
}

#foot td {
background:#fafafa;
border-bottom:1px solid #e7e7e7;
border-top:1px solid #e7e7e7;
border-left:0;
border-right:0;
color:#777;
font-size:80%;
}

#foot a,#foot a:hover {
color:#777;
}

#foot #foot_datetime {
border-left:1px solid #e7e7e7;
width:1%;
white-space:nowrap;
}

#copyright {
color:#FFF;
font-size:80%;
margin:10px 0;
text-align:center;
}

#copyright a {
color:#FB9E3B;
font-weight:700;
}

#c_tos h3 {
color:#333;
font-size:120%;
}

td.username_ok {
background:#e0fae0;
}

input.username_ok {
outline:2px solid #0c0;
}

td.username_no {
background:#fae0e0;
}

input.username_no {
outline:2px solid #e77700;
}

#acplogin {
background:url(http://z4.ifrm.com/static/acp/acpback.png) repeat-x 0 -195px #fff;
border:2px solid #3a5197;
height:275px;
left:50%;
margin:-137.5px 0 0 -250px;
padding:0;
position:absolute;
top:50%;
width:500px;
}

#acplogin h1 {
color:#FFF;
font-weight:400;
height:50px;
margin-bottom:20px;
padding:50px 20px 0 0;
text-align:right;
}

#acplogin h1 img {
position:absolute;
left:0;
top:0;
}

a img {
border:0;
}

form {
display:inline;
margin:0;
padding:0;
}

.category h2,.topic h2,#portal h2 {
padding:5px;
text-align:left;
}

h3 {
padding:3px 0;
}

input[type=checkbox] {
background:transparent;
border:0;
padding:0;
vertical-align:bottom;
}

input[type=radio] {
border:0;
}

select {
margin:0 7px;
padding:0;
vertical-align:bottom;
}

option {
margin:2px 0;
}

button.btn_img {
border:0;
cursor:pointer;
padding:0;
}

.notice dt,.notice dd {
padding:5px 7px;
}

.drop_menu a img {
vertical-align:bottom;
}

.drop_menu li:hover ul,.drop_menu li.hover ul {
left:auto;
}

#submenu a {
padding:3px 5px;
}

#main {
height:1%;
padding:0 1%;
}

#nav li img {
vertical-align:top;
}

.meta_box,.meta_menu {
margin:10px 0;
}

.meta_box li {
display:list-item;
list-style-position:inside;
list-style-type:square;
margin-left:10px;
}

.meta_menu ul {
font-size:90%;
margin:5px 5%;
}

.meta_menu img,.meta_menu span {
float:right;
margin:10px 20px;
}

.cat-pages a,.cat-pagesjump i,.cat-topicpages a {
cursor:pointer;
padding:2px 5px;
}

.cat-topicpages a {
padding:0 2px;
}

.cat-buttons,.topic-buttons {
float:right;
margin:15px 0;
text-align:right;
width:50%;
}

tr.postbtn td {
padding:5px;
text-align:center;
}

.row1,.row2 {
line-height:1.4;
}

td.c_head input,td.c_head button,td.c_foot input,td.c_foot button,td.c_sort input,td.c_sort button {
padding:1px;
}

td.c_desc img,td.c_desc input {
float:left;
vertical-align:middle;
}

.category {
margin:10px 0 0;
}

span.collapse,span.uncollapse {
cursor:pointer;
float:right;
position:relative;
}

.c_mark img {
display:block;
margin:auto;
}

.c_last {
line-height:1.4;
min-width:300px;
width:30%;
}

.category td.c_foot {
height:10px;
}

#stats_members {
line-height:1.2;
}

td.c_cat-mark,td.c_cat-icon {
padding:5px 0;
text-align:center;
width:30px;
}

td.c_cat-starter {
width:125px;
}

td.c_cat-lastpost {
width:175px;
}

.c_user {
vertical-align:top;
width:1px;
min-width:175px;
max-width:175px;
}

.c_post {
width:100%;
}

.c_sig,.c_nosig {
width:100%;
}

.avatar {
display:block;
margin:auto;
text-align:center;
}

.av_wrap {
overflow:hidden;
text-align:center;
margin:auto;
}

td.c_user .usertitle {
margin:3px 0;
overflow-x:hidden;
text-align:center;
}

.pip {
margin:3px 0;
white-space:nowrap;
}

dl.user_info dt,dl.user_info dd {
padding:.1em;
}

dl.user_info dt {
float:left;
margin:0;
min-width:4em;
}

dl.user_info dd.spacer,dl.user_profile dd.spacer {
clear:both;
float:none;
height:1px;
padding:0;
}

td.c_poll-choice {
line-height:1.5;
padding-left:45%;
}

td.c_poll-answer {
text-align:right;
width:42.5%;
}

td.c_poll-bar {
text-align:left;
vertical-align:middle;
width:42.5%;
}

* html td.c_poll-bar span {
margin-top:3px;
}

td.c_post {
line-height:1.7;
vertical-align:top;
}

 td.c_post ul {
list-style-type:square;
margin-left:10px;
}

.c_post img,#topic_review img {
max-width:90%;
}

.c_post-attachment {
font-size:83.3%;
margin-top:1em;
padding:1em;
}

.c_post-attachment dd {
margin-left:1em;
}

.post_sep {
font-size:1px;
height:1px;
}

td.c_sig,td.c_nosig {
height:1%;
vertical-align:top;
}

td.c_nosig {
border-top-style:hidden!important;
}

blockquote dl dt,blockquote dl dd {
padding:2px 4px;
}

blockquote div,blockquote code {
margin:0;
padding:5px;
}

dl#fast-reply {
clear:both;
margin:auto;
width:80%;
}

dl#fast-reply dd p {
margin:-3px;
padding:0 5% 10px;
text-align:left;
}

dl#fast-reply dd textarea {
display:block;
height:100px;
margin-bottom:10px;
padding:2px;
width:90%;
}

#c_post-text {
height:223px;
}

#c_post-resize {
float:right;
margin-top:-1px;
padding:4px 0 0;
text-align:right;
}

#btn_preview {
float:left;
margin:10px 0 0 1px;
}

#c_emot {
height:225px;
vertical-align:top;
width:210px;
}

#emot_list {
height:275px;
margin:0 auto;
overflow:auto;
padding:5px 0;
text-align:center;
}

div#emot_list {
padding:0;
}

#emot_list li {
display:inline;
padding:4px 10px;
}

#emot_list img {
cursor:pointer;
vertical-align:baseline;
}

.pm {
margin-bottom:1em;
}

#pm_datesent {
width:200px;
}

#pm_select {
text-align:center;
width:1px;
}

#conversation .c_post {
padding:2em;
}

#ucp_profile,#pm_messages {
float:right;
}

#ucp_settings img,#ucp_profile img {
margin:18px 20px;
}

#ucp_gallery li {
float:left;
margin:15px 5px;
}

#ucp_gallery button {
cursor:pointer;
text-align:center;
}

.ucp button.btn_text {
padding:5px 0;
text-align:center;
width:100%;
}

.calendar td {
height:125px;
padding:0;
vertical-align:top;
width:14.3%;
}

.calendar li {
display:list-item;
font-size:80%;
margin:0;
}

.calendar li.placeholder {
padding:4px;
}

.calendar li span {
cursor:default;
}

.calendar td#cal_current div {
padding-top:3px;
}

#portal_head {
margin-bottom:10px;
}

#portal_foot {
margin-top:10px;
}

#portal_l,#portal_r {
font-size:88.3%;
margin:0;
padding:0;
}

#portal_l {
float:left;
width:200px;
}

#portal_r {
float:right;
width:150px;
}

#portal_news {
margin:0 160px 0 210px;
}

#portal_clear {
background:transparent;
border:none;
clear:both;
font-size:1px;
height:1px;
margin:0;
padding:0;
}

.portal_box {
margin-bottom:5px;
padding:1px;
}

.portal_box table {
clear:none;
}

#portal h2,#portal_foot h2 {
clear:none;
margin:0;
padding:3px 5px;
}

#faq {
margin:20px 0;
}

#faq dl {
padding:1em;
}

#faq dt {
margin-bottom:5px;
}

#faq dd {
display:list-item;
margin:0 0 3px 15px;
padding-left:3px;
}

.search_results div {
display:block;
margin:5px 0;
}

#acplogin #loginform {
display:block;
padding:0 50px;
}

.category h2 a,#portal h2 a,#portal_foot h2 a,thead a,.category h2 a:hover,#portal h2 a:hover,#portal_foot h2 a:hover,thead a:hover,#top_info a,#top_info a:hover,.drop_menu a,.drop_menu a:hover,#submenu a,#submenu a:hover {
color:#fff;
}

input,select,td,th {
font-size:90%;
}

button.btn_default,#nav li span,.c_post-attachment dt,#c_tos dt {
font-weight:700;
}

#submenu a:hover,.meta_menu a:hover {
text-decoration:underline;
}

.meta_box h3,td.c_topicfoot strong,#meta_welcome strong {
font-size:120%;
}

.meta_box h3,.meta_box a,.meta_box a:hover,tr.pm_new td a,tr.pm_new td a:hover,tr.hidden td a,tr.hidden td a:hover,.c_forum strong a:hover,.c_last strong a:hover,#faq dt a:hover,.search_results h3 a,.search_results h3 a:hover {
color:#5a70b3;
}

.row2 td,blockquote div {
background:#f6f6f6;
}

a.member,.calendar td a,.calendar a:hover,#faq dd a,#faq dd a:hover {
color:#333;
}

img,.meta_box button img,td.c_cat-mark input,.c_post-attachment img,.warn img,#ucp_gallery a img {
vertical-align:middle;
}

h1,h2,h3,#nav,#boardmeta,#main {
clear:both;
margin:0;
}

#meta_welcome,.search_results {
clear:both;
}

#stats_events {
line-height:2;
}

.c_cat-starter,.c_cat-replies,.c_cat-views,td.c_poll-total,td.c_poll-vote,td.c_topicfoot,.warn,.ucp th,#c_notes,.calendar th {
text-align:center;
}

blockquote dl dd,#foot #foot_links {
text-align:right;
}

#c_post,#ucp_gallery {
text-align:center;
vertical-align:top;
}

#files_upload input,.pm .row1 a,.pm .row2 a,#ucp_gallery button img,#findposts td a {
display:block;
}

#ucp_settings,#pm_settings {
float:left;
}

#c_tos dd,#username_response {
margin-left:10px;
}

#vlx {
z-index:1;
}

#blog {
background:#5a70b3;
border:1px solid #3a5197;
color:#333;
margin:10px 0;
}

#blog blockquote {
background:none;
border:none;
font-size:85%;
padding:0 10px;
}

#blog h1 {
float:right;
}

#blog h2 {
background:none;
clear:none;
font-size:130%;
padding:0;
}

#blog h2,#blog h2 a,#blog h2 a:hover {
color:#5a70b3;
}

#blog_foot {
clear:both;
margin-bottom:20px;
}

#blog_head {
background:#f6f6f6;
border:8px solid #5a70b3;
padding:10px 14px;
}

#blog_head img.avatar {
display:inline;
}

#blog_main {
margin:20px 200px 10px 10px;
}

#blog_categories,#blog_readers,#blog_about,div.blog_options {
background:#f6f6f6;
margin:15px 0;
padding:5px 7px;
}

#blog_sidebar h3,#blog_sidebar dt {
color:#5a70b3;
font-weight:700;
}

#blog_sub {
background:#3a5197;
clear:both;
position:relative;
padding:5px 7px;
text-align:right;
}

#blog_sub span {
padding-top:4px;
}

#blog_sidebar {
background:#3a5197;
float:right;
font-size:93.3%;
margin:20px 10px 0 0;
padding:0 10px;
width:160px;
}

#blog_sidebar dd {
margin-left:10px;
}

#blog_user {
font-size:175%;
}

div.blog_options {
font-size:90%;
text-align:right;
}

div.blog_date {
background:#f6f6f6;
border:1px solid #3a5197;
color:#5a70b3;
float:right;
font-weight:700;
margin:0 15px;
text-align:center;
text-transform:uppercase;
width:40px;
}

div.blog_date span {
background:#fafafa;
border-top:1px solid #e7e7e7;
color:#e77700;
display:block;
font-size:130%;
font-weight:700;
padding:2px 4px;
}

div.blog_entry {
background:#fff;
margin:10px 0;
padding:5px 7px;
}

#blog_comments li {
padding:5px 7px;
}

#blog_comments li.odd {
background:#f6f6f6;
}

#shoutwrap {
background:#fafafa;
border:1px solid #e7e7e7;
font-size:88.3%;
}

#shoutwrap td {
padding:0;
}

#shoutbox {
list-style-type:none;
margin:0;
padding:0;
}

#shoutbox li {
padding:5px 7px;
}

#shoutbox li.odd {
background:#f6f6f6;
}

#shoutbox dl,#shoutbox dt,#shoutbox dd {
margin:0;
padding:0;
}

#shoutbox dt {
color:#777;
font-size:80%;
}

#shoutopts,#shoutpost {
clear:both;
text-align:center;
}
&lt;?php
/*======================================================================*\
|| #################################################################### ||
|| # vBulletin Blog 4.0.8 - Null by vietvbb-team
|| # ---------------------------------------------------------------- # ||
|| # Copyright ©2000-2010 vBulletin Solutions Inc. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| #################################################################### ||
\*======================================================================*/

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
if (!defined('THIS_SCRIPT')) { define('THIS_SCRIPT', 'blog'); }
define('VB_PRODUCT', 'vbblog');
define('CSRF_PROTECTION', true);
define('VBBLOG_PERMS', true);
define('VBBLOG_STYLE', true);
define('VBBLOG_SCRIPT', true);
define('GET_EDIT_TEMPLATES', 'blog,comments,list');

if (!defined('FRIENDLY_URL_LINK'))
{
	define('FRIENDLY_URL_LINK', 'blog');
}

// ################### PICK SOMETHING TO DO ######################
if (empty($_REQUEST['do']))
{
	if (THIS_SCRIPT == 'entry' OR !empty($_REQUEST['blogid']) OR !empty($_REQUEST['blogtextid']) OR !empty($_REQUEST['b']) OR !empty($_REQUEST['bt']))
	{
		$_REQUEST['do'] = 'blog';
	}
	else if (!empty($_REQUEST['tag']) OR !empty($_REQUEST['userid']) OR !empty($_REQUEST['u']) OR !empty($_REQUEST['username']) OR !empty($_REQUEST['blogcategoryid']))
	{
		$_REQUEST['do'] = 'list';
	}
	else if (!empty($_REQUEST['cp']))
	{
		$_REQUEST['do'] = 'custompage';
	}
	else
	{
		$_REQUEST['do'] = 'list';
	}
}

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array(
	'posting',
	'vbblogglobal',
	'postbit',
	'vbblogcat',
);

// $actionphrases is broken in 3.6.7 so simulate
if (in_array($_REQUEST['do'], array('sendtofriend', 'dosendtofriend')))
{
	$phrasegroups[] = 'messaging';
}

if (in_array($_REQUEST['do'], array('list', 'blog', 'comments')))
{
	$phrasegroups[] = 'inlinemod';
}

// get special data templates from the datastore
$specialtemplates = array(
	'smiliecache',
	'bbcodecache',
	'blogcategorycache',
	'blogstats',
	'blogfeatured_settings',
	'blogfeatured_entries',
);

if (in_array($_REQUEST['do'], array('list', 'bloglist', 'comments')))
{
	$specialtemplates[] = 'blogtagcloud';
}

if ($_REQUEST['do'] == 'blog')
{
	$specialtemplates[] = 'bookmarksitecache';
}

// pre-cache templates used by all actions
$globaltemplates = array(
	'BLOG',
	'blog_css',
	'blog_usercss',
	'blog_header_custompage_link',
	'ad_blogsidebar_start',
	'ad_blogsidebar_middle',
	'ad_blogsidebar_end',
	'facebook_publishcheckbox',
	'facebook_likebutton',
);

// pre-cache templates used by specific actions
$actiontemplates = array(
	'blog'				=>	array(
		'blog_bookmark',
		'blog_comment',
		'blog_comment_deleted',
		'blog_comment_ignore',
		'blog_entry_category',
		'blog_entry',
		'blog_entry_deleted',
		'blog_entry_ignore',
		'blog_show_entry',
		'blog_show_entry_recent_entry_link',
		'blog_sidebar_calendar',
		'blog_sidebar_calendar_day',
		'blog_sidebar_category_link',
		'blog_sidebar_comment_link',
		'blog_sidebar_custompage_link',
		'blog_sidebar_entry_link',
		'blog_sidebar_user',
		'blog_sidebar_user_block_archive',
		'blog_sidebar_user_block_category',
		'blog_sidebar_user_block_comments',
		'blog_sidebar_user_block_entries',
		'blog_sidebar_user_block_search',
		'blog_sidebar_user_block_tagcloud',
		'blog_sidebar_user_block_visitors',
		'blog_sidebar_user_block_custom',
		'blog_tag_cloud_link',
		'blog_tagbit',
		'blog_trackback',
		'memberinfo_visitorbit',
		'showthread_quickreply',
		'ad_blogshowentry_after',
		'ad_blogshowentry_before',
		'postbit_attachmentimage',
		'postbit_attachmentthumbnail',
	),
	'comments'				=> array(
		'blog_sidebar_calendar',
		'blog_sidebar_calendar_day',
		'blog_list_comments',
		'blog_comment',
		'blog_comment_deleted',
		'blog_comment_ignore',
		'blog_sidebar_category_link',
		'blog_sidebar_generic',
		'blog_sidebar_user',
		'blog_sidebar_comment_link',
		'blog_sidebar_custompage_link',
		'blog_sidebar_entry_link',
		'blog_sidebar_user_block_archive',
		'blog_sidebar_user_block_category',
		'blog_sidebar_user_block_comments',
		'blog_sidebar_user_block_entries',
		'blog_sidebar_user_block_search',
		'blog_sidebar_user_block_tagcloud',
		'blog_sidebar_user_block_visitors',
		'blog_sidebar_user_block_custom',
		'blog_tag_cloud_link',
		'blog_tagbit',
		'memberinfo_visitorbit',
	),
	'none'				=> array(
		'blog_list_entries',
	),
	'list'            => array(
		'blog_list_entries',
		'blog_sidebar_generic',
		'blog_entry',
		'blog_entry_category',
		'blog_entry_deleted',
		'blog_entry_ignore',
		'blog_sidebar_calendar',
		'blog_sidebar_calendar_day',
		'blog_sidebar_user',
		'blog_sidebar_comment_link',
		'blog_sidebar_custompage_link',
		'blog_sidebar_entry_link',
		'blog_sidebar_category_link',
		'blog_sidebar_user_block_archive',
		'blog_sidebar_user_block_category',
		'blog_sidebar_user_block_comments',
		'blog_sidebar_user_block_entries',
		'blog_sidebar_user_block_search',
		'blog_sidebar_user_block_tagcloud',
		'blog_sidebar_user_block_visitors',
		'blog_sidebar_user_block_custom',
		'blog_tag_cloud_link',
		'blog_tagbit',
		'memberinfo_visitorbit',
		'ad_bloglist_first_entry',
		'postbit_attachmentimage',
		'postbit_attachmentthumbnail',
		'blog_home_list_entry',
		'blog_entry_featured',
		'blog_home_list_comment',
	),
	'sendtofriend'   => array(
		'blog_send_to_friend',
		'humanverify',
		'newpost_errormessage',
		'newpost_usernamecode',
		'blog_sidebar_user',
		'blog_sidebar_user_block_archive',
		'blog_sidebar_user_block_category',
		'blog_sidebar_user_block_comments',
		'blog_sidebar_user_block_entries',
		'blog_sidebar_user_block_search',
		'blog_sidebar_user_block_tagcloud',
		'blog_sidebar_user_block_visitors',
		'blog_sidebar_user_block_custom',
		'blog_sidebar_comment_link',
		'blog_sidebar_custompage_link',
		'blog_sidebar_entry_link',
		'blog_sidebar_category_link',
		'blog_sidebar_calendar',
		'blog_sidebar_calendar_day',
		'blog_tag_cloud_link',
		'memberinfo_visitorbit',
	),
	'viewip'         => array(
		'blog_entry_ip',
	),
	'bloglist'       => array(
		'blog_blog_row',
		'blog_list_blogs_all',
		'blog_list_blogs_best',
		'blog_list_blogs_blog',
		'blog_list_blogs_blog_ignore',
		'blog_sidebar_calendar',
		'blog_sidebar_calendar_day',
		'blog_sidebar_category_link',
		'blog_sidebar_generic',
		'forumdisplay_sortarrow',
		'blog_tag_cloud_link',
	),
	'members'        => array(
		'blog_cp_css',
		'blog_grouplist',
		'blog_grouplist_userbit',
		'blog_sidebar_calendar',
		'blog_sidebar_calendar_day',
		'blog_sidebar_category_link',
		'blog_sidebar_user_block_archive',
		'blog_sidebar_user_block_category',
		'blog_sidebar_user_block_comments',
		'blog_sidebar_user_block_entries',
		'blog_sidebar_user_block_search',
		'blog_sidebar_user_block_tagcloud',
		'blog_sidebar_user_block_visitors',
		'blog_sidebar_user_block_custom',
		'blog_sidebar_comment_link',
		'blog_sidebar_custompage_link',
		'blog_sidebar_entry_link',
		'blog_sidebar_user',
		'blog_tag_cloud_link',
		'memberinfo_visitorbit',
	),
	'custompage'      => array(
		'blog_custompage',
		'blog_sidebar_calendar',
		'blog_sidebar_calendar_day',
		'blog_sidebar_user',
		'blog_sidebar_comment_link',
		'blog_sidebar_custompage_link',
		'blog_sidebar_entry_link',
		'blog_sidebar_category_link',
		'blog_sidebar_user_block_archive',
		'blog_sidebar_user_block_category',
		'blog_sidebar_user_block_comments',
		'blog_sidebar_user_block_entries',
		'blog_sidebar_user_block_search',
		'blog_sidebar_user_block_tagcloud',
		'blog_sidebar_user_block_visitors',
		'blog_sidebar_user_block_custom',
		'blog_tag_cloud_link',
		'memberinfo_visitorbit',
	),
);

$actiontemplates['dosendtofriend'] =& $actiontemplates['sendtofriend'];

// ####################### PRE-BACK-END ACTIONS ##########################
function exec_postvar_call_back()
{
	global $vbulletin;

	$vbulletin->input->clean_gpc('r', 'goto', TYPE_STR);

	if ($vbulletin->GPC['goto'] == 'newpost')
	{
		$vbulletin->noheader = true;
	}
}

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
require_once(DIR . '/includes/functions_bigthree.php');
require_once(DIR . '/includes/blog_init.php');
require_once(DIR . '/includes/blog_functions_main.php');

//get autoloader hooked up.
require_once(DIR . '/includes/class_bootstrap_framework.php');
vB_Bootstrap_Framework::init();

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

// ### STANDARD INITIALIZATIONS ###
$checked = array();
$blog = array();
$postattach = array();
$bloginfo = array();
$show['lightbox'] = ($vbulletin->options['lightboxenabled'] AND $vbulletin->options['usepopups']);
$show['moderatecomments'] = (!$vbulletin->options['blog_commentmoderation'] AND $vbulletin->userinfo['permissions']['vbblog_comment_permissions'] & $vbulletin->bf_ugp_vbblog_comment_permissions['blog_followcommentmoderation'] ? true : false);
$show['pingback'] = ($vbulletin->options['vbblog_pingback'] AND $vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canreceivepingback'] ? true : false);
$show['trackback'] = ($vbulletin->options['vbblog_trackback'] AND $vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canreceivepingback'] ? true : false);
$show['notify'] = ($vbulletin->options['vbblog_notifylinks'] AND $vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_cansendpingback'] ? true : false);
$navbits = array();

/* Check they can view a blog, any blog */
if (!($vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canviewothers']))
{
	if (!$vbulletin->userinfo['userid'] OR !($vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canviewown']))
	{
		print_no_permission();
	}
}

($hook = vBulletinHook::fetch_hook('blog_start')) ? eval($hook) : false;

//We'll need this in a bit. This is the info to mark as escalate to Article
if ($vbulletin->products['vbcms'])
{
	if (!isset(vB::$vbulletin->userinfo['permissions']['cms']))
	{
		require_once DIR . '/packages/vbcms/permissions.php';
		vBCMS_Permissions::getUserPerms();
	}
}

// #######################################################################
if ($_REQUEST['do'] == 'blog')
{
	$vbulletin->input->clean_array_gpc('r', array(
		'pagenumber' => TYPE_UINT,
		'goto'       => TYPE_STR,
		'uh'         => TYPE_BOOL,
	));

	$bloginfo = verify_blog($blogid);
	verify_seo_url('entry', $bloginfo, array('pagenumber' => $_REQUEST['pagenumber']));

	track_blog_visit($bloginfo['userid']);

	$wheresql = array();
	$state = array('visible');

	($hook = vBulletinHook::fetch_hook('blog_entry_start')) ? eval($hook) : false;

	if (can_moderate_blog('canmoderateentries') OR is_member_of_blog($vbulletin->userinfo, $bloginfo))
	{
		$state[] = 'moderation';
	}

	if (can_moderate_blog() OR is_member_of_blog($vbulletin->userinfo, $bloginfo))
	{
		$state[] = 'deleted';
		$deljoinsql = "LEFT JOIN " . TABLE_PREFIX . "blog_deletionlog AS blog_deletionlog ON (blog.blogid = blog_deletionlog.primaryid AND blog_deletionlog.type = 'blogid')";
	}

	if (is_member_of_blog($vbulletin->userinfo, $bloginfo))
	{
		$state[] = 'draft';
	}
	else
	{
		$wheresql[] = "blog.dateline &lt;= " . TIMENOW;
		$wheresql[] = "blog.pending = 0";
	}

	$wheresql[] = "blog.userid = $bloginfo[userid]";
	$wheresql[] = "blog.state IN ('" . implode("','", $state) . "')";

	// remove blog entries that don't interest us
	if ($coventry = fetch_coventry('string') AND !can_moderate_blog())
	{
		$wheresql[] = "blog.userid NOT IN ($coventry)";
	}

	if (!empty($vbulletin->userinfo['blogcategorypermissions']['cantview']) AND $bloginfo['userid'] != $vbulletin->userinfo['userid'])
	{
		$joinsql = "LEFT JOIN " . TABLE_PREFIX . "blog_categoryuser AS cu ON (cu.blogid = blog.blogid AND cu.blogcategoryid IN (" . implode(", ", $vbulletin->userinfo['blogcategorypermissions']['cantview']) . "))";
		$wheresql[] = "cu.blogcategoryid IS NULL";
	}

	if (!can_moderate_blog() AND !is_member_of_blog($vbulletin->userinfo, $bloginfo) AND !$bloginfo['buddyid'])
	{
		$wheresql[] = "~blog.options & " . $vbulletin->bf_misc_vbblogoptions['private'];
	}

	switch($vbulletin->GPC['goto'])
	{
		case 'next':
			$wheresql[] = "blog.dateline > $bloginfo[dateline]";
			if ($next = $db->query_first_slave("
				SELECT blog.blogid
				FROM " . TABLE_PREFIX . "blog AS blog
				$joinsql
				WHERE " . implode(" AND ", $wheresql) . "
				ORDER BY blog.dateline
				LIMIT 1
			"))
			{
				$blogid = $next['blogid'];
			}
			else
			{
				standard_error(fetch_error('nonextnewest_blog'));
			}
			break;
		case 'prev':
			$wheresql[] = "blog.dateline &lt; $bloginfo[dateline]";
			if ($prev = $db->query_first_slave("
				SELECT blog.blogid
				FROM " . TABLE_PREFIX . "blog AS blog
				$joinsql
				WHERE " . implode(" AND ", $wheresql) . "
				ORDER BY blog.dateline DESC
				LIMIT 1
			"))
			{
				$blogid = $prev['blogid'];
			}
			else
			{
				standard_error(fetch_error('nonextoldest_blog'));
			}
			break;
		case 'newpost':
			if ($vbulletin->options['threadmarking'] AND $vbulletin->userinfo['userid'])
			{
				$vbulletin->userinfo['lastvisit'] = max($bloginfo['blogread'], $bloginfo['bloguserread'], TIMENOW - ($vbulletin->options['markinglimit'] * 86400));
			}
			else if ($blogview = max(fetch_bbarray_cookie('blog_lastview', $bloginfo['blogid']), fetch_bbarray_cookie('blog_userread', $bloginfo['userid']), $vbulletin->userinfo['lastvisit']))
			{
				$vbulletin->userinfo['lastvisit'] = $blogview;
			}

			$comments = $db->query_first("
				SELECT MIN(blogtextid) AS blogtextid
				FROM " . TABLE_PREFIX . "blog_text
				WHERE
					blogid = $bloginfo[blogid]
						AND
					blogtextid &lt;> $bloginfo[firstblogtextid]
						AND
					state = 'visible'
						AND
					dateline > " . intval($vbulletin->userinfo['lastvisit']) . "
					" . (($coventry = fetch_coventry('string') AND !can_moderate_blog()) ? "AND userid NOT IN ($coventry)" : "") . "
			");
			if ($comments['blogtextid'])
			{
				$pageinfo = array('bt' => $comments['blogtextid']);
				exec_header_redirect(fetch_seo_url('entry|js', $bloginfo, $pageinfo) . "#comment$comments[blogtextid]");
			}
			else
			{
				$pageinfo = array('bt' => $bloginfo['lastblogtextid']);
				exec_header_redirect(fetch_seo_url('entry|js', $bloginfo, $pageinfo) . "#comment$bloginfo[lastblogtextid]");
			}
			break;
	}

	$bloginfo = verify_blog($blogid);

	if ($vbulletin->options['vbblog_nextprevlinks'])
	{
		$show['nextprevtitle'] = true;
		if ($next = $db->query_first_slave("
			SELECT blog.blogid, blog.title
			FROM " . TABLE_PREFIX . "blog AS blog
			$joinsql
			WHERE " . implode(" AND ", $wheresql) . "
				AND blog.dateline > $bloginfo[dateline]
			ORDER BY blog.dateline
			LIMIT 1
		"))
		{
			$show['nexttitle'] = true;
		}
		if ($prev = $db->query_first_slave("
			SELECT blog.blogid, blog.title
			FROM " . TABLE_PREFIX . "blog AS blog
			$joinsql
			WHERE " . implode(" AND ", $wheresql) . "
				AND blog.dateline &lt; $bloginfo[dateline]
			ORDER BY blog.dateline DESC
			LIMIT 1
		"))
		{
			$show['prevtitle'] = true;
		}
		$show['blognav'] = ($show['prevtitle'] OR $show['nexttitle']);
	}
	else
	{
		$show['blognav'] = true;
	}

	// this fetches permissions for the user who created the blog
	cache_permissions($bloginfo, false);

	$displayed_dateline = 0;

	$show['quickcomment'] =
	(
		$vbulletin->options['quickreply']
		AND
		$vbulletin->userinfo['userid']
		AND
		$bloginfo['cancommentmyblog']
		AND
		($bloginfo['allowcomments'] OR is_member_of_blog($vbulletin->userinfo, $bloginfo) OR can_moderate_blog())
		AND
		(
			(($vbulletin->userinfo['permissions']['vbblog_comment_permissions'] & $vbulletin->bf_ugp_vbblog_comment_permissions['blog_cancommentown']) AND $bloginfo['userid'] == $vbulletin->userinfo['userid'])
			OR
			(($vbulletin->userinfo['permissions']['vbblog_comment_permissions'] & $vbulletin->bf_ugp_vbblog_comment_permissions['blog_cancommentothers']) AND $bloginfo['userid'] != $vbulletin->userinfo['userid'])
		)
		AND
		(
			(
				$bloginfo['state'] == 'moderation'
					AND
				(
					can_moderate_blog('canmoderateentries')
						OR
					(
						$vbulletin->userinfo['userid']
							AND
						$bloginfo['userid'] == $vbulletin->userinfo['userid']
							AND
						$bloginfo['postedby_userid'] != $vbulletin->userinfo['userid']
							AND
						$bloginfo['membermoderate']
					)
				)
			)
				OR
			$bloginfo['state'] == 'visible'
		)
		AND
		!$bloginfo['pending']
		AND
		!fetch_require_hvcheck('post')
	);

	$show['postcomment'] = fetch_can_comment($bloginfo, $vbulletin->userinfo);

	// *********************************************************************************

	// display ratings
	if ($bloginfo['ratingnum'] >= $vbulletin->options['vbblog_ratingpost'])
	{
		$bloginfo['ratingavg'] = vb_number_format($bloginfo['ratingtotal'] / $bloginfo['ratingnum'], 2);
		$bloginfo['rating'] = intval(round($bloginfo['ratingtotal'] / $bloginfo['ratingnum']));
		$show['rating'] = true;
	}
	else
	{
		$show['rating'] = false;
	}

	// this is for a guest
	$rated = intval(fetch_bbarray_cookie('blog_rate', $bloginfo['blogid']));

	// voted already
	if ($bloginfo['vote'] OR $rated)
	{
		$rate_index = $rated;
		if ($bloginfo['vote'])
		{
			$rate_index = $bloginfo['vote'];
		}
		$voteselected["$rate_index"] = 'selected="selected"';
		$votechecked["$rate_index"] = 'checked="checked"';
	}
	else
	{
		$voteselected[0] = 'selected="selected"';
		$votechecked[0] = 'checked="checked"';
	}

	// *********************************************************************************
	// update views counter
	if ($bloginfo['state'] != 'draft' AND !$bloginfo['pending'])
	{
		if ($vbulletin->options['blogviewslive'])
		{
			// doing it as they happen; for optimization purposes
			$db->shutdown_query("
				UPDATE " . TABLE_PREFIX . "blog
				SET views = views + 1
				WHERE blogid = " . intval($bloginfo['blogid'])
			);
		}
		else
		{
			// or doing it once an hour
			$db->shutdown_query("
				INSERT INTO " . TABLE_PREFIX . "blog_views (blogid)
				VALUES (" . intval($bloginfo['blogid']) . ')'
			);
		}
	}

	require_once(DIR . '/includes/class_bbcode_blog.php');
	require_once(DIR . '/includes/class_blog_response.php');

	$bbcode = new vB_BbCodeParser_Blog($vbulletin, fetch_tag_list());

	$factory = new vB_Blog_ResponseFactory($vbulletin, $bbcode, $bloginfo);

	$responsebits = '';
	$saveparsed = '';
	$trackbackbits = '';
	$pagetext_cachable = true;
	$oldest_comment = TIMENOW;

	// Comments
	$deljoinsql = '';
	$state = array('visible');
	if (can_moderate_blog('canmoderatecomments') OR is_member_of_blog($vbulletin->userinfo, $bloginfo))
	{
		$state[] = 'moderation';
	}
	if (can_moderate_blog() OR is_member_of_blog($vbulletin->userinfo, $bloginfo))
	{
		$state[] = 'deleted';
		$deljoinsql = "LEFT JOIN " . TABLE_PREFIX . "blog_deletionlog AS blog_deletionlog ON (blog_text.blogtextid = blog_deletionlog.primaryid AND blog_deletionlog.type = 'blogtextid')";
	}
	else
	{
		$deljoinsql = '';
	}

	// Get our page
	if ($blogtextid)
	{
		$getpagenum = $db->query_first("
			SELECT COUNT(*) AS comments
			FROM " . TABLE_PREFIX . "blog_text AS blog_text
			WHERE blogid = $blogid
				AND state IN ('" . implode("','", $state) . "')
				AND blogtextid &lt;> $bloginfo[firstblogtextid]
				AND dateline &lt;= $blogtextinfo[dateline]
		");
		$vbulletin->GPC['pagenumber'] = ceil($getpagenum['comments'] / $vbulletin->options['blog_commentsperpage']);
	}
	if ($coventry = fetch_coventry('string') AND !can_moderate_blog())
	{
		$globalignore = "AND blog_text.userid NOT IN ($coventry)";
	}
	else
	{
		$globalignore = '';
	}

	$categories = array();
	// Get categories
	$cats = $db->query_read_slave("
		SELECT blog_categoryuser.blogcategoryid, blog_categoryuser.userid, blog_category.userid AS creatorid
		FROM " . TABLE_PREFIX . "blog_categoryuser AS blog_categoryuser
		LEFT JOIN " . TABLE_PREFIX . "blog_category AS blog_category ON (blog_category.blogcategoryid = blog_categoryuser.blogcategoryid)
		WHERE blog_categoryuser.blogid = $bloginfo[blogid]
	");
	while ($category = $db->fetch_array($cats))
	{
		if (!($bloginfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_cancreatecategory']) AND $category['creatorid'])
		{
			continue;
		}
		$category['title'] = $category['creatorid'] ? $bloginfo['categorycache']["$category[blogcategoryid]"]['title'] : $vbphrase['category' . $category['blogcategoryid'] . '_title'];
		$entry_categories["$bloginfo[blogid]"][] = $category;
	}

	// load attachments
	if ($bloginfo['attach'])
	{
		require_once(DIR . '/packages/vbattach/attach.php');
		$attach = new vB_Attach_Display_Content($vbulletin, 'vBBlog_BlogEntry');
		$postattach = $attach->fetch_postattach(0, $bloginfo['blogid']);
	}

	if ($vbulletin->options['vbblog_pingback'] AND $bloginfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canreceivepingback'])
	{
		$show['pingbacklink'] = true;
		$pingbackurl = $vbulletin->options['bburl'] . '/blog_callback.php';
		header("X-Pingback: $pingbackurl");
	}

	if ($vbulletin->options['vbblog_trackback'] AND $bloginfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canreceivepingback'])
	{
		$show['trackbackrdf'] = true;
		$trackbackurl = $vbulletin->options['bburl'] . '/blog_callback.php?b=' . $bloginfo['blogid'];
		$abouturl = $vbulletin->options['bburl'] . '/' . fetch_seo_url('entry', $bloginfo);
	}

	// Load trackbacks
	if ($show['pingbacklink'] OR $show['trackbackrdf'])
	{
		$canmoderation = (can_moderate_blog('canmoderatecomments') OR is_member_of_blog($vbulletin->userinfo, $bloginfo));
		if ($bloginfo['trackback_visible'] OR ($bloginfo['trackback_moderation'] AND $canmoderation))
		{
			$bgclass = 'alt2';
			$trackbacks = $db->query_read("
				SELECT blog_trackback.*
				FROM " . TABLE_PREFIX . "blog_trackback AS blog_trackback
				WHERE blogid = $bloginfo[blogid]
					" . (!$canmoderation ? "AND state = 'visible'" : "") . "
			");
			while ($trackback = $db->fetch_array($trackbacks))
			{
				$response_handler =& $factory->create($trackback);
				$response_handler->cachable = false;
				// we deliberately ignore the returned value since its been templated, we're not really interested in that :)
				$trackbackbits .= $response_handler->construct();
			}
			$show['inlinemod_trackback'] = (
				fetch_comment_perm('canremovecomments', $bloginfo)
					OR
				fetch_comment_perm('candeletecomments', $bloginfo)
					OR
				fetch_comment_perm('canmoderatecomments', $bloginfo)
			);
			$show['approve_trackback'] = true;
			$show['delete_trackback'] = true;
		}
	}

	if (!($vbulletin->userinfo['permissions']['vbblog_entry_permissions'] & $vbulletin->bf_ugp_vbblog_entry_permissions['blog_cangetattach']))
	{
		$vbulletin->options['viewattachedimages'] = 0;
		$vbulletin->options['attachthumbs'] = 0;
	}

	/* Handle the blog entry now */
	require_once(DIR . '/includes/class_blog_entry.php');
	$entry_factory = new vB_Blog_EntryFactory($vbulletin, $bbcode, $entry_categories);
	$entry_handler =& $entry_factory->create($bloginfo);
	$entry_handler->attachments = $postattach;
	$entry_handler->userinfo = $bloginfo;
	$entry_handler->construct();
	$blog =& $entry_handler->blog;
	$status =& $entry_handler->status;

	// *********************************************************************************
	// save parsed post HTML
	if (!empty($saveparsed))
	{
		$db->shutdown_query("
			REPLACE INTO " . TABLE_PREFIX . "blog_textparsed (blogtextid, dateline, hasimages, pagetexthtml, styleid, languageid)
			VALUES $saveparsed
		");
		unset($saveparsed);
	}

	// quick comment
	if ($show['quickcomment'])
	{
		require_once(DIR . '/includes/functions_editor.php');
		$editorid = construct_edit_toolbar(
			'',
			false,
			'blog_comment',
			$vbulletin->userinfo['permissions']['vbblog_comment_permissions'] & $vbulletin->bf_ugp_vbblog_comment_permissions['blog_allowsmilies'],
			true,
			false,
			'qr'
		);
		$show['ajax_js'] = true;
	}
	else if ($vbulletin->options['quickedit'])
	{
		$templater = vB_Template::create('editor_clientscript');
		$vBeditTemplate['clientscript'] = $templater->render();
		$show['ajax_js'] = true;
	}

	$show['quickedit'] = $vbulletin->options['quickedit'];

	// get ignored users
	$ignore = array();
	if (trim($vbulletin->userinfo['ignorelist']))
	{
		$ignorelist = preg_split('/( )+/', trim($vbulletin->userinfo['ignorelist']), -1, PREG_SPLIT_NO_EMPTY);
		foreach ($ignorelist AS $ignoreuserid)
		{
			$ignore["$ignoreuserid"] = 1;
		}
	}
	DEVDEBUG('ignored users: ' . implode(', ', array_keys($ignore)));

	// Comments
	do
	{
		if (!$vbulletin->GPC['pagenumber'])
		{
			$vbulletin->GPC['pagenumber'] = 1;
		}
		$start = ($vbulletin->GPC['pagenumber'] - 1) * $vbulletin->options['blog_commentsperpage'];
		$pagenumber = $vbulletin->GPC['pagenumber'];

		$state_or = array(
			"blog_text.state IN ('" . implode("','", $state) . "')"
		);

		// Get the viewing user's moderated entries
		if ($vbulletin->userinfo['userid'] AND $bloginfo['comments_moderation'] > 0 AND !can_moderate_blog('canmoderatecomments') AND !is_member_of_blog($vbulletin->userinfo, $bloginfo))
		{
			$state_or[] = "(blog_text.userid = " . $vbulletin->userinfo['userid'] . " AND state = 'moderation')";
		}

		$show['approve'] = $show['delete'] = $show['undelete'] = false;

		$hook_query_fields = $hook_query_joins = $hook_query_where = '';
		($hook = vBulletinHook::fetch_hook('blog_entry_comments_query')) ? eval($hook) : false;

		$comments = $db->query_read("
			SELECT SQL_CALC_FOUND_ROWS blog_text.*, blog_text.ipaddress AS blogipaddress,
				blog_textparsed.pagetexthtml, blog_textparsed.hasimages,
				user.*, userfield.*, blog_text.username AS postusername,
				blog_editlog.userid AS edit_userid, blog_editlog.dateline AS edit_dateline, blog_editlog.reason AS edit_reason, blog_editlog.username AS edit_username
				" . ($deljoinsql ? ",blog_deletionlog.moddelete AS del_moddelete ,blog_deletionlog.userid AS del_userid, blog_deletionlog.username AS del_username, blog_deletionlog.reason AS del_reason" : "") . "
				" . ($vbulletin->options['avatarenabled'] ? ",avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,customavatar.width AS avwidth,customavatar.height AS avheight" : "") . "
				$hook_query_fields
			FROM " . TABLE_PREFIX . "blog_text AS blog_text
			LEFT JOIN " . TABLE_PREFIX . "blog_textparsed AS blog_textparsed ON(blog_textparsed.blogtextid = blog_text.blogtextid AND blog_textparsed.styleid = " . intval(STYLEID) . " AND blog_textparsed.languageid = " . intval(LANGUAGEID) . ")
			LEFT JOIN " . TABLE_PREFIX . "user AS user ON (blog_text.userid = user.userid)
			LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON (userfield.userid = blog_text.userid)
			LEFT JOIN " . TABLE_PREFIX . "blog_editlog AS blog_editlog ON (blog_editlog.blogtextid = blog_text.blogtextid)
			" . ($vbulletin->options['avatarenabled'] ? "LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON(avatar.avatarid = user.avatarid) LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON(customavatar.userid = user.userid)" : "") . "
			$deljoinsql
			$hook_query_joins
			WHERE blogid = $bloginfo[blogid]
				AND blog_text.blogtextid &lt;> " . $bloginfo['firstblogtextid'] . "
				AND (" . implode(" OR ", $state_or) . ")
				$globalignore
				$hook_query_where
			ORDER BY blog_text.dateline ASC
			LIMIT $start, " . $vbulletin->options['blog_commentsperpage']
		);
		list($comment_count) = $db->query_first("SELECT FOUND_ROWS()", DBARRAY_NUM);

		if ($start >= $comment_count)
		{
			$vbulletin->GPC['pagenumber'] = ceil($comment_count / $vbulletin->options['blog_commentsperpage']);
		}
	}
	while ($start >= $comment_count AND $comment_count);

	// TODO: Update pagenav to work with SEO urls!
	$pagenav = construct_page_nav(
		$vbulletin->GPC['pagenumber'],
		$vbulletin->options['blog_commentsperpage'],
		$comment_count,
		'blog.php?' . $vbulletin->session->vars['sessionurl'] . "b=$bloginfo[blogid]",
		'',
		'comments'
	);

	$counter = 0;
	while ($comment = $db->fetch_array($comments))
	{
		if ($comment['state'] == 'visible')
		{
			$counter++;
		}
		$comment['firstshown'] = ($counter == 1 AND $comment['state'] == 'visible');
		$response_handler =& $factory->create($comment, 'Comment', $ignore);
		$response_handler->userinfo = $bloginfo;
		$response_handler->cachable = $pagetext_cachable;
		$responsebits .= $response_handler->construct();

		if ($pagetext_cachable AND $comment['pagetexthtml'] == '')
		{
			if (!empty($saveparsed))
			{
				$saveparsed .= ',';
			}
			$saveparsed .= "($comment[blogtextid], " . intval($bloginfo['lastcomment']) . ', ' . intval($response_handler->parsed_cache['has_images']) . ", '" . $db->escape_string($response_handler->parsed_cache['text']) . "', " . intval(STYLEID) . ", " . intval(LANGUAGEID) . ")";
		}

		if ($comment['dateline'] > $displayed_dateline)
		{
			$displayed_dateline = $comment['dateline'];
		}

		$oldest_comment = $comment['dateline'];

		if ($comment['state'] == 'deleted' OR $ignore["$comment[userid]"])
		{	// be aware $factory->create can change $response['state']
			$show['quickload'] = true;
		}
	}
	// This is only used by Quick Comment but init it either way
	$effective_lastcomment = max($displayed_dateline, $bloginfo['lastcomment']);

	$show['delete'] = (fetch_comment_perm('candeletecomments', $bloginfo) OR fetch_comment_perm('canremovecomments', $bloginfo));
	$show['undelete'] = fetch_comment_perm('canundeletecomments', $bloginfo);
	$show['approve'] = fetch_comment_perm('canmoderatecomments', $bloginfo);
	$show['inlinemod'] = ($responsebits AND ($show['delete'] OR $show['approve'] OR $show['undelete']));

	// Only allow AJAX QC on the last page and after one comment
	$allow_ajax_qc = ($comment_count > 0 AND ($vbulletin->GPC['pagenumber'] == ceil($comment_count / $vbulletin->options['blog_commentsperpage']))) ? 1 : 0;

	if ($vbulletin->userinfo['userid'])
	{
		mark_blog_read($bloginfo, $vbulletin->userinfo['userid'], $oldest_comment);
	}

	// Todo: allow ratings option or permission, hardcoded but we may want to add this
	$show['blograting'] = ($bloginfo['state'] == 'visible');
	$show['rateblog'] =
	(
		$show['blograting']
		AND
		(
			(
				(!$bloginfo['vote'] AND $vbulletin->userinfo['userid'])
			OR
				(!$rated AND !$vbulletin->userinfo['userid'])
			)
			OR
				$vbulletin->options['votechange']
		)
	);

	// Build Social Bookmark Links
	$guestuser = array(
		'userid'      => 0,
		'usergroupid' => 0,
	);
	cache_permissions($guestuser, false);

	$bookmarksites = '';
	if (
		$guestuser['permissions']['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview']
			AND
		$vbulletin->options['socialbookmarks'] AND is_array($vbulletin->bookmarksitecache) AND !empty($vbulletin->bookmarksitecache)
			AND
		$bloginfo['state'] == 'visible'
			AND
		$bloginfo['guest_canviewmyblog']
			AND
		$vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canviewothers']
	)
	{
		foreach($vbulletin->bookmarksitecache AS $bookmarksite)
		{
			$bookmarksite['link'] = str_replace(
				array('{URL}', '{TITLE}'),
				array(urlencode($vbulletin->options['bburl'] . '/' . fetch_seo_url('entry', $bloginfo)), urlencode($bloginfo['title'])),
				$bookmarksite['url']
			);

			($hook = vBulletinHook::fetch_hook('blog_entry_bookmarkbit')) ? eval($hook) : false;

			$templater = vB_Template::create('blog_bookmark');
				$templater->register('bloginfo', $bloginfo);
				$templater->register('bookmarksite', $bookmarksite);
			$bookmarksites .= $templater->render();
		}
	}

	$show['trackbacks'] = ($vbulletin->GPC['pagenumber'] &lt;= 1);
	$show['titlefirst'] = true;
	$show['entryonly'] = ($bloginfo['pending'] OR $bloginfo['state'] == 'draft' OR ((!$bloginfo['allowcomments'] AND !is_member_of_blog($vbulletin->userinfo, $bloginfo) AND !can_moderate_blog() AND empty($responsebits))));
	$show['privateentry'] = ($bloginfo['private']);

	$perform_floodcheck = (
		!($vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel'])
		AND $vbulletin->options['emailfloodtime']
		AND $vbulletin->userinfo['userid']
	);

	$show['registeruserid'] = true;
	$bloguserid = $bloginfo['userid'];

	$blogheader = parse_blog_description($bloginfo);
	$sidebar =& build_user_sidebar($bloginfo);

	$ad_location['blogshowentry_before'] = vB_Template::create('ad_blogshowentry_before')->render();
	$ad_location['blogshowentry_after'] = vB_Template::create('ad_blogshowentry_after')->render();

	// navbar and output
	$navbits[fetch_seo_url('blog', $bloginfo, null, 'userid', 'blog_title')] = $bloginfo['blog_title'];
	$navbits[fetch_seo_url('entry', $bloginfo)] = $bloginfo['title'];

	// prepare the member action drop-down menu
	if ($bloginfo['userid'] != $bloginfo['postedby_userid'])
	{
		$memberaction_dropdown = construct_memberaction_dropdown(fetch_userinfo($bloginfo['postedby_userid']));
	}
	else
	{
		$memberaction_dropdown = construct_memberaction_dropdown($bloginfo);
	}

	// facebook options
	if (is_facebookenabled())
	{
		// display publish to Facebook checkbox in quick editor?
		$fbpublishcheckbox = construct_fbpublishcheckbox();

		// display the like button for this thread?
		$fblikebutton = construct_fblikebutton();
	}

	($hook = vBulletinHook::fetch_hook('blog_entry_complete')) ? eval($hook) : false;

	$templater = vB_Template::create('blog_show_entry');
		$templater->register('pageinfo_ip', array('do' => 'viewip'));
		$templater->register('pageinfo_sf', array('do' => 'sendtofriend'));
		$templater->register('blogheader', $blogheader);
		$templater->register('ad_location', $ad_location);
		$templater->register('allow_ajax_qc', $allow_ajax_qc);
		$templater->register('blog', $blog);
		$templater->register('bloginfo', $bloginfo);
		$templater->register('memberaction_dropdown', $memberaction_dropdown);
		$templater->register('blogtextinfo', $blogtextinfo);
		$templater->register('bookmarksites', $bookmarksites);
		$templater->register('editorid', $editorid);
		$templater->register('effective_lastcomment', $effective_lastcomment);
		$templater->register('gobutton', $gobutton);
		$templater->register('messagearea', $messagearea);
		$templater->register('next', $next);
		$templater->register('pagenav', $pagenav);
		$templater->register('prev', $prev);
		$templater->register('responsebits', $responsebits);
		$templater->register('status', $status);
		$templater->register('trackbackbits', $trackbackbits);
		$templater->register('url', $url);
		$templater->register('vBeditTemplate', $vBeditTemplate);
		$templater->register('vbulletin', $vbulletin);
		$templater->register('votechecked', $votechecked);
		$templater->register('voteselected', $voteselected);
		$templater->register('fbpublishcheckbox', $fbpublishcheckbox);
		$templater->register('fblikebutton', $fblikebutton);

		//See if we want to display the authorization to escalate a blog post to
		// an article
		if (count(vB::$vbulletin->userinfo['permissions']['cms']['cancreate']))
		{
			$templater->register('promote_sectionid', vB::$vbulletin->userinfo['permissions']['cms']['canpublish'][0]);
			$templater->register('articletypeid', vB_Types::instance()->getContentTypeID('vBCms_Article'));
			$promote_url = vB_Route::create('vBCms_Route_Content', '1/addcontent/')->getCurrentURL();
			$promote_url .= (strrpos($promote_url, '?') ? '&amp;' : '?') .
				'contenttypeid=' . vB_Types::instance()->getContentTypeID('vBCms_Article') .
				"&amp;blogid=" . $blog['blogid'] . '&amp;parentid=1';
			$templater->register('promote_url', $promote_url);
		}
	$templater->register('vbulletin', $vbulletin);

	$content = $templater->render();
}

// #######################################################################
if ($_REQUEST['do'] == 'list')
{
	$vbulletin->input->clean_array_gpc('r', array(
		'pagenumber'     => TYPE_UINT,
		'perpage'        => TYPE_UINT,
		'month'          => TYPE_UINT,
		'year'           => TYPE_UINT,
		'day'            => TYPE_UINT,
		'blogtype'       => TYPE_NOHTML,
		'commenttype'    => TYPE_NOHTML,
		'type'           => TYPE_STR,
		'blogcategoryid' => TYPE_INT,
		'userid'         => TYPE_UINT,
		'username'       => TYPE_NOHTML,
		'tag'            => TYPE_NOHTML,
		'span'           => TYPE_UINT,
		'featured'       => TYPE_STR,
	));

	require_once(DIR . '/includes/class_bbcode_blog.php');

	if ($vbulletin->GPC['username'])
	{
		$user = $db->query_first_slave("SELECT userid FROM " . TABLE_PREFIX . "user WHERE username = '" . $db->escape_string($vbulletin->GPC['username']) . "'");
		$vbulletin->GPC['userid'] = $user['userid'];
	}

	if ($vbulletin->GPC['userid'])
	{
		$userinfo = verify_id('user', $vbulletin->GPC['userid'], 1, 1, 10);
		$show['entry_userinfo'] = false;

		verify_seo_url('blog', $userinfo, array('pagenumber' => $_REQUEST['pagenumber']), 'userid', 'username');

		if ($vbulletin->userinfo['userid'] != $userinfo['userid'] AND empty($userinfo['bloguserid']))
		{
			standard_error(fetch_error('blog_noblog', $userinfo['username']));
		}

		if (!$userinfo['canviewmyblog'])
		{
			print_no_permission();
		}
		if (in_coventry($userinfo['userid']) AND !can_moderate_blog())
		{
			standard_error(fetch_error('invalidid', $vbphrase['blog'], $vbulletin->options['contactuslink']));
		}

		if ($vbulletin->userinfo['userid'] == $userinfo['userid'] AND !($vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canviewown']))
		{
			print_no_permission();
		}

		if ($vbulletin->userinfo['userid'] != $userinfo['userid'] AND !($vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canviewothers']))
		{
			// Can't view other's entries so off you go to your own blog.
			$bloginfo = array(
				'userid' => $vbulletin->userinfo['userid'],
				'title'  => $vbulletin->userinfo['blog_title'] ? $vbulletin->userinfo['

.l {text-align:left}
.c {text-align:center}
.r {text-align:right}
.left {float:left}
.right {float:right}
#stats_members a.member, .bday_strip {white-space:nowrap}
.calendar li span {cursor:default}
#c_tos li {display:list-item;margin-left:25px}
#c_tos ul li {list-style:disc}
#c_tos ol li {list-style:lower-alpha}
#shoutrefresh {cursor:pointer}