-
-
Save good-orbit/728619a6cfdb1fe5f528 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="LeftBlogs"> | |
<div id="BlogList"> | |
<ul> | |
<li class="<?php if(!empty($_GET['sort']) && $_GET['sort'] != 'date') { echo "un"; } ?>Highlighted round_10px"><a href="Questions.php?sort=date">Date</a></li> | |
<li class="<?php if($_GET['sort'] != 'popular') { echo "un"; } ?>Highlighted round_10px"><a href="Questions.php?sort=popular">Most Popular</a></li> | |
</ul> | |
</div> | |
<?php | |
if(!empty($_GET['subQuestionSearch'])) { | |
$query = "SELECT `id`, MATCH (`title`,`body`) AGAINST ('" . mysql_real_escape_string($_GET['QuestionSearch']) . "') AS `Relevance` FROM `cysticQuestions` WHERE MATCH (`title`,`body`) AGAINST ('" . mysql_real_escape_string($_GET['QuestionSearch']) . "') AND `status` != 'dead'"; | |
if(empty($_GET['sort']) || $_GET['sort'] == 'date') { | |
$query .= "ORDER BY `Relevance` ASC "; | |
}elseif($_GET['sort'] == 'popular') { | |
$query .= "ORDER BY `views` DESC "; | |
} | |
}else{ | |
$query = "SELECT `id` FROM `cysticQuestions` WHERE `status` != 'dead' "; | |
if(!empty($_GET['cat']) && $_GET['cat'] != "All") { | |
$query .= "&& `category` = '" . mysql_real_escape_string($_GET['cat']) . "' "; | |
} | |
if(empty($_GET['sort']) || $_GET['sort'] == 'date') { | |
$query .= "ORDER BY `date` DESC, `time` DESC "; | |
}elseif($_GET['sort'] == 'popular') { | |
$query .= "ORDER BY `views` DESC "; | |
} | |
} | |
//find out how many | |
$request = mysql_query($query,$connection) or die(mysql_error()); | |
$totalQuestions = @mysql_num_rows($request); | |
if(!empty($_GET['page'])) { | |
$query .= "LIMIT " . mysql_real_escape_string($_GET['page']) . ",10"; | |
}else{ | |
$query .= "LIMIT 10"; | |
} | |
$request = mysql_query($query,$connection) or die(mysql_error()); | |
while($result = mysql_fetch_array($request)) { | |
$question = new Question($result['id']); | |
$author = new User($question->author); | |
echo "<div class='future_mother_blog_archive_house'>"; | |
echo "<div id='future_blog_archive_body' class='round_10px'>"; | |
echo "<div class='all_name_pic round_10px' >"; | |
echo "<a href='" . $author->url() . "'>"; | |
echo "<img src='" . $author->img('mini') . "' border='0'/>"; | |
echo "</a>"; | |
echo "<div class='AllBlogName_future'>"; | |
echo "<div class='written'>"; | |
echo "asked by"; | |
echo "</div>"; | |
echo "<a href='" . $author->url() . "'>"; | |
echo strip_tags(stripslashes($author->first_name ." ".$author->last_name)); | |
echo "</a>"; | |
echo "<div class='dateBlogArch'>"; | |
echo "on " . date("M d, Y",strtotime($question->date)); | |
echo "</div>"; | |
echo "</div>"; | |
echo "</div>"; | |
echo "<div id='AllBlogArchiveTitle'>"; | |
echo "<div class='blogIcon' 'style='margin:0px 10px 0px 0px;'>"; | |
echo "<a href='" . $question->url() . "'>"; | |
echo "<img src='styles/images/question_icon_777.png' border='0'/>"; | |
echo "</a>"; | |
echo "</div>"; | |
echo "<a href='" . $question->url() . "'>"; | |
if(strlen($question->title) > 70) { echo substr(stripslashes(strip_tags($question->title)),0,70) . "..."; }else{ echo stripslashes(strip_tags($question->title)); } | |
echo "</a>"; | |
echo "<div id='all_cat_future'>"; | |
echo $question->category(); | |
echo "</div>"; | |
echo "</div>"; | |
echo "<div id='AllBlogArchiveStats'>"; | |
echo "<span class='AllBlogPipes'>"; | |
echo "<span class='AllBlogPipes'>"; | |
echo $question->views; | |
echo " Views "; | |
echo "</span>"; | |
echo " • "; | |
echo "<span class='AllBlogPipes'>"; | |
echo " " . $question->total_answers(); | |
echo " Answers "; | |
echo "</span>"; | |
echo "</div>"; | |
echo "</div>"; | |
echo "<div class='future_blog_blurb'>"; | |
if(strlen($question->body) > 300) { echo substr(stripslashes(strip_tags($question->body)),0,300) . "..."; }else{ echo stripslashes(strip_tags($question->body)); } | |
echo "<br /><br />"; | |
?> | |
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="http://www.cysticlife.org/QuestionsProfile.php?id=<?php echo $question->id; ?>" show_faces="true" width="400" font=""></fb:like> | |
<?php | |
echo "<div class='blurbLinks'>"; | |
echo "<a href='" . $question->url() . "'><br />read more</a>"; | |
if($auth->id == $author->id) { echo " <a href='EditQuestion.php?id=" . $question->id . "'>edit</a> <a href='#' onclick='confirmation(\"QuestionAllDeleteConfirm.php?id=" . $result['id'] ."\");'>delete</a>";} | |
echo "</div>"; | |
echo "</div>"; | |
echo "</div>"; | |
} | |
?> | |
<div id="all_page_turn"> | |
<ul> | |
<?php if($totalQuestions > 10 && $_GET['page'] >= 10) { ?> | |
<li class="PreviousPageBlog round_10px"> | |
<a href="Questions.php?id=<?php echo $userID; ?>&cat=<?php echo $_GET['cat']; ?>&sort=<?php echo $_GET['sort']; ?>&page=<?php echo ($_GET['page'] - 10); ?>">Previous Page</a> | |
</li> | |
<?php } ?> | |
<?php if($totalQuestions > 10 && $_GET['page'] < ($totalQuestions-10)) { ?> | |
<li class="NextPageBlog round_10px"> | |
<a href="Questions.php?id=<?php echo $userID; ?>&cat=<?php echo $_GET['cat']; ?>&sort=<?php echo $_GET['sort']; ?>&page=<?php echo ($_GET['page'] + 10); ?>">Next Page</a> | |
</li> | |
<?php } ?> | |
</ul> | |
</div> | |
</div> | |
<div id="RightBlogs"> | |
<div id="search_blogs_future" class="round_10px"> | |
<form name="searchBlogs" action="Questions.php" method="get"> | |
<input type="text" name="QuestionSearch" class="text" value="<?php if(empty($_GET['QuestionSearch'])) { echo "Search Questions"; }else{ echo $_GET['QuestionSearch'];} ?>" onclick="clearify(this);" /> | |
<input type="submit" name="subQuestionSearch" value="Search" /> | |
</form> | |
</div> | |
<div class='<?php if(empty($_GET['cat']) || $_GET['cat'] == "All") { echo "all_blog_cats_Highlighted"; }else{ echo "all_blog_cats_unHighlighted"; } ?> round_10px'> | |
<a href='Questions.php?id=<?php echo $userID; ?>cat=All'> | |
All | |
</a> | |
</div> | |
<?php | |
$query = "SELECT * FROM `cysticCategories_questions` ORDER BY CategoryName ASC"; | |
$request = mysql_query($query,$connection) or die(mysql_error()); | |
while($result = mysql_fetch_array($request)) { | |
if(!empty($_GET['cat'])) { | |
if($_GET['cat'] == $result['id']) { | |
$className = "all_blog_cats_Highlighted"; | |
}else{ | |
$className = "all_blog_cats_unHighlighted"; | |
} | |
}else{ | |
$className = "all_blog_cats_unHighlighted"; | |
} | |
echo "<div class='" . $className . " round_10px'>"; | |
echo "<a href='Questions.php?cat=".$result['id']."'>"; | |
echo $result['CategoryName']; | |
echo "</a>"; | |
echo "</div>"; | |
} | |
?> | |
<div id="most_all_future"> | |
<div id="most_all_title" class="round_10px"> | |
Top Askers | |
</div> | |
<table> | |
<tr> | |
<?php | |
$author_count = 0; | |
$query = "SELECT `userID`,COUNT(`id`) FROM `cysticQuestions` WHERE `Status` = 'active' GROUP BY `userID` ORDER BY COUNT(`id`) DESC LIMIT 8"; | |
$request = mysql_query($query,$connection); | |
while($result = mysql_fetch_array($request)) { | |
$author_count++; | |
$author = new User($result['userID']); | |
?> | |
<td class="topCommentPic round_10px"> | |
<a href="<?php echo $author->url(); ?>" border> | |
<img src="<?php echo $author->img('mini'); ?>" border="0" /> | |
</a><br /> | |
<div class="topCommentName"> | |
<a href="<?php echo $author->url(); ?>"> | |
<?php echo $author->first_name; ?><br /><?php echo $author->last_name; ?> | |
</a> | |
</div> | |
</td> | |
<?php | |
if($author_count == 4) { echo "</tr><tr>"; $author_count = 0;} | |
} | |
if($author_count < 4) { | |
for($author_count;$author_count<4;$author_count++) { | |
echo "<td></td>"; | |
} | |
echo "</tr>"; | |
} ?> | |
</table> | |
</div> | |
<div id="most_all_future"> | |
<div id="most_all_title" class="round_10px"> | |
Top Answerers | |
</div> | |
<table> | |
<tr> | |
<?php | |
$author_count = 0; | |
$query = "SELECT `userID`,COUNT(`id`) AS `total` FROM `cysticAnswers` WHERE (SELECT `Status` FROM `cysticUsers` WHERE `cysticUsers`.`id` = `cysticAnswers`.`userID` LIMIT 1) = 'active' GROUP BY `userID` ORDER BY `total` DESC LIMIT 8"; | |
$request = mysql_query($query,$connection); | |
while($result = mysql_fetch_array($request)) { | |
$author_count++; | |
$author = new User($result['userID']); | |
?> | |
<?php if($author->status = 'active') { ?> | |
<td class="topCommentPic round_10px"> | |
<a href="<?php echo $author->url(); ?>"> | |
<img src="<?php echo $author->img('mini'); ?>" border="0" /> | |
</a><br /> | |
<div class="topCommentName"> | |
<a href="<?php echo $author->url(); ?>"> | |
<?php echo $author->first_name; ?><br /><?php echo $author->last_name; ?> | |
</a> | |
</div> | |
</td> | |
<?php } ?> | |
<?php | |
if($author_count == 4) { echo "</tr><tr>"; $author_count = 0;} | |
} | |
if($author_count < 4) { | |
for($author_count;$author_count<4;$author_count++) { | |
echo "<td></td>"; | |
} | |
echo "</tr>"; | |
} ?> | |
</table> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment