Skip to content

Instantly share code, notes, and snippets.

@good-orbit
Created June 30, 2011 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save good-orbit/2ef2c90cac1fe81d255d to your computer and use it in GitHub Desktop.
Save good-orbit/2ef2c90cac1fe81d255d to your computer and use it in GitHub Desktop.
<div id="BlogLeft">
<?php require_once('includes/structural/future_idCard.php'); ?>
<div id="recent_blogs_future" class="round_10px">
<?php echo $prof->first_name; ?>'s Recent Blogs
</div>
<div id="SomeRecentBlogsHouse">
<?php
$query = "SELECT * FROM `cysticBlogs` WHERE `Author` = '".$prof->id."' && `id` != '" . mysql_real_escape_string($_GET['id']) . "' && `status` = 'active' ORDER BY `date` DESC, `time` DESC LIMIT 6";
$request = mysql_query($query,$connection);
while($result = mysql_fetch_array($request)) {
?>
<div class="old_blogs_future round_10px">
<div class="blog_icon_future">
<a href="BlogProfile.php?id=<?php echo $result['id']; ?>">
<img src="styles/images/blogIcon.png" border="0"/>
</a>
</div>
<div class="recentBlogTitles">
<a href="BlogProfile.php?id=<?php echo $result['id']; ?>">
<?php echo strip_tags(stripslashes($result['blogTitle'])); ?>
</a>
<br />
<span class="recentBlogdate">
on <?php echo date('M d, Y',strtotime($result['date'])); ?>
</span>
<br />
</div>
</div>
<?php } ?>
</div>
<div id="UserBlogArchivesLink">
<a href="UserBlogArchives.php?id=<?php echo $prof->id; ?>">
View All <?php echo $prof->first_name; ?>'s Blogs
</a>
</div>
</div>
<div id="BlogProfileRight">
<div id="blogName" style="clear:both;">
<?php echo strip_tags(stripslashes($blog->title())); ?>
</div>
<div id="blogInfo">
<?php echo date('M d, Y',strtotime($blog->date)) ." at ".date('g:i A',strtotime($blog->time)); ?>
</div>
<?php
if($prof->id == $auth->id) {
?>
<div id="blogInfo">
<a href="EditBlog.php?id=<?php echo $blog->id; ?>">
Edit
</a>
</div>
<?php } ?>
<div id="BlogBody">
<?php echo strip_tags(stripslashes(nl2br($blog->body)),"<p><img><b><br><br /><i><a><ul><li><ol><u><span><embed>"); ?>
</div>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="http://www.cysticlife.org/BlogProfile.php?id=<?php echo $blog->id; ?>" show_faces="true" width="400" action="recommend" font=""></fb:like>
<div id="CommentBlogSection">
<div id="comment_bar_future" style="margin:20px 0px 20px 0px;" class="round_10px">
Comments
</div>
<div id="comment_box_future">
<form name="CommentBox" method="post" action="BlogProfile.php?id=<?php echo $blog->id; ?>">
<?php if($auth) { ?>
<textarea name="BlogComment" class="round_10px defaulted"><?php if($auth->id != $prof->id) { echo 'Leave a comment on '." ".$prof->first_name.'\'s blog here...'; }else{ echo 'Leave a comment on your blog here...' ; } ?></textarea>
<input type="submit" name="commentBlogSubmit" value="Post" class="post" />
<?php }else{ ?>
<textarea name="BlogComment" class="round_10px" disabled>Please sign in to comment...</textarea>
<?php } ?>
</form>
</div>
<?php
$query = "SELECT * FROM `cysticBlogComments` WHERE `blogID` = '".$blog->id."' AND `status` != 'dead' ORDER BY `date` DESC, `time` DESC";
$request = mysql_query($query,$connection);
while($result = mysql_fetch_array($request)) {
$poster = new User($result['userID']);
?>
<div class="comment_structure_future clearfix">
<a name="comment_<?php echo $result['id']; ?>"></a>
<div class='comment_polaroid_future'>
<a href='http://www.cysticlife.org/Profile.php?id=<?php echo $poster->id ?>'>
<img src='<?php echo $poster->img('mini'); ?>' border='0'/>
</a>
</div>
<div class='comment_body_future round_10px'>
<div id='CommentNameProfile'>
<a href='http://www.cysticlife.org/Profile.php?id=<?php echo $poster->id; ?>'>
<?php echo $poster->first_name. " ". $poster->last_name; ?> says...
</a>
</div>
<?php echo strip_tags(stripslashes(nl2br($result['commentBody'])),'<br><br />'); ?>
<div id='CommentInfoProfile'>
<?php echo date('M d, Y',strtotime($result['date'])); ?> at <?php echo date('g:i A',strtotime($result['time'])); ?> &bull;
<?php if ($poster->id == $auth->id || $prof->id == $auth->id) { ?>
<a href="#" onclick="confirmation('DeleteBlogComment.php?id=<?php echo $result['id']; ?>');">
Delete
</a>
<?php } ?>
<a href='#reply_form_<?php echo $result['id']; ?>' name='reply_to_<?php echo $result['id']; ?>' class='reply_link'>Reply</a>
<div id="thumb_holder">
<div id="thumb_report">
<a href="mailto:info@cysticlife.org">
report
</a>
</div>
<div class= "thumb_counter" id="thumb_counter_<?php echo $result['id']; ?>">
+<?php echo $result['thumbsUp']; ?>
</div>
<div id="thumb_thumb">
<?php $comment_id = $result['id'];?>
<a class="myButtonLink" href="Profile_test.php?id=<?php echo $prof->id; ?>" id="<?php echo $comment_id; ?>">Vote Up!</a>
</div>
</div>
</div>
</div>
<div class='profile_comment_tail_future'>&nbsp;</div>
</div>
<?php
$query = "SELECT
*
FROM
`CysticBlogComments_replies`
WHERE
`BlogCommentID` = '" . $result['id'] . "'
&& `status` = 'active'
ORDER BY `date` ASC, `time` ASC";
$request2 = mysql_query($query,$connection);
while($reply = mysql_fetch_array($request2)) {
$replier = new User($reply['FromUserID']);
?>
<div class="response_structure_future">
<a name="response_<?php echo $reply['id']; ?>"></a>
<div class="response_polaroid_future">
<a href="http://www.cysticlife.org/Profile.php?id=<?php echo $replier->id; ?>">
<img src="<?php echo $replier->img('mini'); ?>" />
</a>
</div>
<div class="response_body_future round_10px">
<div class="response_arrow_future"></div>
<div class="response_tail_future"></div>
<div class="response_data_future">
<div class="response_name_future">
<a href="http://www.cysticlife.org/Profile.php?id=<?php echo $replier->id; ?>">
<?php echo $replier->first_name . " " . $replier->last_name; ?> says...
</a>
</div>
<?php echo strip_tags(stripslashes(nl2br($reply['comment'])),'<br><br />'); ?>
<div class="response_info_future">
<?php echo date('M d, Y',strtotime($reply['date'])); ?> at <?php echo date('g:i A',strtotime($reply['time'])); ?>
<?php if($auth->id == $replier->id || $auth->id == $result['ToUserID']) { ?>
<a onclick="confirmation('DeleteBlogCommentReply.php?id=<?php echo $reply['id']; ?>&ret=<?php echo urlencode($_SERVER['REQUEST_URI']); ?>');"> &bull; delete</a>
<?php } ?>
<div id="thumb_holder_replies">
<div id="thumb_report_replies">
<a href="mailto:info@cysticlife.org">
report
</a>
</div>
<div class= "thumb_counter_replies" id="thumb_counter_replies_<?php echo $reply['id']; ?>">
+<?php echo $reply['thumbsUp_reply']; ?>
</div>
<div id="thumb_thumb_replies">
<?php $comment_reply_id = $reply['id'];?>
<a class="myButtonLink" href="Profile_test.php?id=<?php echo $prof->id; ?>" id="<?php echo $comment_reply_id; ?>">Vote Up!</a>
</div>
</div>
</div>
</div>
</div>
</div>
<?php } ?>
<a name='reply_form_<?php echo $result['id']; ?>' style="clear:both"></a>
<div id='reply_to_<?php echo $result['id']; ?>' class="respond_structure_future" <?php if(isset($_GET['reply_to']) && $_GET['reply_to'] == $result['id']) { echo 'style="display:block;"';}else{ echo 'style="display:none;"';} ?>>
<div class="respond_polaroid_future">
<a href="http://www.cysticlife.org/Profile.php?id=<?php echo $auth->id; ?>">
<img src="<?php echo $auth->img('mini'); ?>" />
</a>
</div>
<form name='comment_reply' action='<?php echo $_SERVER['REQUEST_URI']; ?>' method='post'>
<div class="respond_body_future round_10px">
<div class="respond_arrow_future"></div>
<div class="respond_tail_future"></div>
<div class="respond_data_future">
<textarea id="reply_to_<?php echo $result['id']; ?>_textarea" name='reply'></textarea><br />
<input type='hidden' name='comment' value='<?php echo $result['id']; ?>' />
<div class="respond_nevermind">
<a href="reply_to_<?php echo $result['id']; ?>">nevermind</a>
</div>
<input type='submit' class="submit" name='sub_comment_reply' value='Reply' />
</div>
</div>
</form>
</div>
<?php } ?>
</div>
</div>
</div>
<div style="clear:both">
</div>
<!-- this is the click function -->
<script>
$('.myButtonLink').click(function(e) {
e.preventDefault();
var comment_id = $(this).attr('id');
var currentCount = $('#comment_id').text();
$('#comment_id').text(++currentCount);
$.ajax({
type: 'POST',
url: 'thumbs_blogs.php',
data: 'comment_id=' + comment_id,
success: function(data) {
$("#thumb_counter_"+comment_id).text("+ "+data);
if(data.result == "error") {
alert(data.msg);
} else {
$('#numvotes').html(data.msg);
}
}
});
});
</script>
<script>
$('.myButtonLink').click(function(e) {
e.preventDefault();
var comment_reply_id = $(this).attr('id');
var currentCount = $('#comment_reply_id').text();
$('#comment_reply_id').text(++currentCount);
$.ajax({
type: 'POST',
url: 'thumbs_blogs_reply.php',
data: 'comment_reply_id=' + comment_reply_id,
success: function(data) {
$("#thumb_counter_replies_"+comment_reply_id).text("+ "+data);
if(data.result == "error") {
alert(data.msg);
} else {
$('#numvotes').html(data.msg);
}
}
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment