Skip to content

Commit

Permalink
First commit. It's buggy. But I'll improve it soon.
Browse files Browse the repository at this point in the history
  • Loading branch information
Magic committed Jun 15, 2011
0 parents commit 88f941f
Show file tree
Hide file tree
Showing 25 changed files with 2,175 additions and 0 deletions.
Empty file added .htaccess
Empty file.
11 changes: 11 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Short for communication cat. A CMS for Question and Answer site for all field. Like StackOverflow and Quora. Free for anyone.

Enviroment
Linux, Apache/Nginx, PHP, MongoDB

Installation
1: Prepare the enviroment mention above.
2: Download MongoDB and run it.
3: Install MongoDB PHP Driver.
4: Git and copy the source code to the web directory.
5: Enjoy your Question & Answer Site.
1 change: 1 addition & 0 deletions all.css

Large diffs are not rendered by default.

85 changes: 85 additions & 0 deletions askQuestion.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php
session_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Ask a Question - ComCat</title>
<link rel="shortcut icon" href="http://cdn.sstatic.net/stackoverflow/img/favicon.ico">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<link href="all.css" type="text/css" rel="stylesheet">
</head>
<body class="ask-page">
<!--<div id="notify-container"></div>
<div id="overlay-header"></div>
<div id="custom-header"></div>-->
<div class="container">
<?php
include 'header.php';
?>
<div id="content">
<div id="mainbar" class="ask-mainbar">
<form id="post-form" action="submit.php" method="post">
<div class="form-item ask-title">
<table class="ask-title-table">
<tr>
<td class="ask-title-cell-key">
<label for="title">Title</label>
</td>
<td class="ask-title-cell-value">
<input id="title" name="title" type="text" maxlength="300" tabindex="100" class="ask-title-field" value="">
<span class="edit-field-overlay">what&#39;s your programming question? be specific.</span>
</td>
</tr>
</table>
<div id="question-suggestions">
</div>
</div>
<div id="post-editor">
<div id="wmd-container">
<script src="./js/nicEdit.js" type="text/javascript"></script>
<script type="text/javascript">
bkLib.onDomLoaded(function() {new nicEditor({iconsPath : './images/nicEditorIcons.gif'}).panelInstance('area');});
</script>
<textarea cols="92" rows="10" id="area" name="post-text"></textarea>
</div>
</div>
<div class="form-item">
<label>Tags</label>
<input id="tagnames" name="tagnames" type="text" size="60" value="" tabindex="103">
<div id='tag-preview'></div>
<span class="edit-field-overlay">at least one tag such as (c++ android asp.net), max 5 tags</span>
</div>
<div id="notify-options">
<h2>
<input type="checkbox" id="notify-email" name="notify-email" > Notify
<input id="notify-email-address" name="notify-email-address" disabled="disabled" type="text" value="gmagic10@gmail.com"> daily of any new answers
</h2>

</div>
<div class="form-submit cbt"><input id="submit-button" type="submit" value="Post Your Question" tabindex="120"></div>

</form>
</div>
<div id="sidebar" class="ask-sidebar">
<div id="scroller-anchor"></div>
<div id="scroller">

<div class="module newuser sidebar-help" id="how-to-title">
<h4>How to Ask</h4>
<p><b>Is your question about programming?</b></p><p>We prefer questions that can be <i>answered</i>, not just discussed.</p><p>Provide details. Share your research.</p>
</div>
</div>
</div>

<br class="cbt">


</div>
</div>
<?php
include 'footer.php';
?>

</body>
</html>
14 changes: 14 additions & 0 deletions footer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<div id="footer">
<div class="footerwrap">
<div id="footer-menu">
<a href="/about">about</a> |
<a href="/faq">faq</a> |
<a href="mailto:gmagic10@gmail.com">contact us</a>
</div>
<div id="copyright">Copyright of Magic and Tracy
</div>
</div>
</div>
<noscript>
&lt;div id="noscript-warning"&gt;Stack Overflow works best with JavaScript enabled&lt;img src="http://pixel.quantserve.com/pixel/p-c1rF4kxgLUzNc.gif" alt="" class="dno"&gt;&lt;/div&gt;
</noscript>
56 changes: 56 additions & 0 deletions header.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<div id="header" style="background-color:#efe2ac">
<div id="headerContainer">
<div id="topbar">
<div id="hlinks">
<span id="hlinks-user">
<?php
require_once('user.php');
$user = new User();
if($user->getLoginStatus())
{
$id = $user->getLoginID();
echo '<span style="padding-right:6px">Welcome</span>';
echo '<span id="hlinks-nav"><span class="profile-triangle"></span><a class="profile-link" href="user_profile.php?id='.$id.'">Magic</a>&nbsp;<a href="/users/631852/magic?tab=reputation"><span title="your reputation; view reputation changes" class="reputation-score">11</span></a><span title="1 bronze badge"><span class="badge3"></span><span class="badgecount">1</span></span><span class="lsep">|</span></span>';
echo '<a href="login.php?action=logout">logout</a>';
}
else
{
echo '<a href="login.php">login</a>';
}
?>

</span>
</div>
<div id="hsearch">
<form method="get" action="/index.php" id="search">
<div>
<input type="text" value="search" size="28" maxlength="140" onfocus="if (this.value=='search') this.value = ''" tabindex="1" class="textbox" name="q">
</div>
</form>
</div>
</div>

<br class="cbt">
<div style="float:left;margin-left:15px">
<a href="/" title="ComCat"><img src="images/comcat.png"></img></a>
</div>
<div id="hmenus">
<div class="nav mainnavs">
<ul>
<li><a href="/index.php" id="nav-questions">Questions</a></li>
<li><a href="/tags_page.php" id="nav-tags">Tags</a></li>
<li><a href="/users_page.php" id="nav-users">Users</a></li>
<li><a href="/badges" id="nav-badges">Badges</a></li>
<li><a href="/index.php?action=unanswer" id="nav-unanswered">Unanswered</a></li>
</ul>
</div>
<div class="nav askquestion">
<ul>
<li>
<a href="askQuestion.php" id="nav-askquestion">Ask Question</a>
</li>
</ul>
</div>
</div>
</div>
</div>
Binary file added images/Thumbs.db
Binary file not shown.
Binary file added images/comcat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/nicEditorIcons.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/sprites.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
131 changes: 131 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
<?php
session_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>ComCat</title>
<link rel="shortcut icon" href="http://cdn.sstatic.net/stackoverflow/img/favicon.ico">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<link href="all.css" type="text/css" rel="stylesheet">
</head>
<body class="home-page">
<!--<noscript><div id="noscript-padding"></div></noscript>
<div id="notify-container"></div>
<div id="overlay-header"></div>
<div id="custom-header"></div>-->
<div class="container">
<?php
include 'header.php';
?>
<div id="content">

<div id="mainbar">
<div class="subheader">
<h1 id="h-top-questions">
Top Questions
</h1>
<div id="tabs">

<a class="youarehere" href="?tab=interesting" title="questions that may be of interest to you based on your history and tag preferences">interesting</a>
<!--<a href="?tab=featured" title="questions with an active bounty"><span class='bounty-indicator-tab'>222</span>featured</a>
<a href="?tab=hot" title="questions with the most views, answers, and votes over the last few days">hot</a>
<a href="?tab=week" title="questions with the most views, answers, and votes this week">week</a>
<a href="?tab=month" title="questions with the most views, answers, and votes this month">month</a>
-->
</div>
</div>
<div id="question-mini-list">


<?php
require_once('question.php');
$question = new Question();
if(isset($_REQUEST['tag']))
{
$questions = $question->getQuestionByTagName($_REQUEST['tag']);
require_once('tag.php');
$tag = new Tag();
$tagDetail = $tag->getTagDetail($_REQUEST['tag']);
//$tag->outputTagDetail($tagDetail);
}
else if(isset($_REQUEST['q']))
{
$questions = $question->searchQuestions($_REQUEST['q']);
}
else if(isset($_REQUEST['unanswer']))
{
$questions = $question->getUnanswer();
}
else if(isset($_REQUEST['tag']))
{
$questions = $question->getTag($_REQUEST['tag']);
}
else
{
$questions = $question->getQuestions();
}
$question->outputQuestion($questions);
?>
</div>
<h2 class="bottom-notice">Looking for more? Browse the <a href="/index.php">complete list of questions</a>, or <a href="/tags_page.php">popular tags</a>. Help us answer <a href="/index.php?action=unanswer">unanswered questions</a>.</h2>

</div>
<div id="sidebar">
<div class="module" id="interesting-tags">
<h4 id="h-interesting-tags">Favorite Tags</h4>
<div id="interestingTags"></div>
<table>
<tr>
<td class="vt"><input id="interestingTag" type="text" name="interestingTag"></td>

<td class="vt"><input id="interestingAdd" type="button" value="Add"></td>
</tr>
</table>
<h4 id="h-ignored-tags">Ignored Tags</h4>
<div id="ignoredTags"></div>
<table>
<tr>
<td class="vt"><input id="ignoredTag" type="text" name="ignoredTag"></td>

<td class="vt"><input id="ignoredAdd" type="button" value="Add"></td>
</tr>
</table>
<div class="dno">
<input type="checkbox" id="hideIgnored" title="hide ignored tags" ><label for="hideIgnored"> hide ignored tags</label>
</div>

<p class="ar" style="margin-top: 10px;"><a href="http://stackexchange.com/filters">network tag filters &raquo;</a></p>

</div>
<div class="module" id="recent-tags">
<h4 id="h-recent-tags">Recent Tags</h4>
<div id="recent-tags-list">
<?php
require_once('tag.php');
$tag = new Tag();
$tag->outputRecentTag();
?>
</div>
<p class="ar"><a href="tags_page.php">all tags &raquo;</a></p>
</div> <div class="module" id="recent-badges">
<h4 id="h-recent-badges">Recent Badges</h4>

<table>
<tr><td><a href="/badges/27/notable-question?userid=387300" title="silver badge: Asked a question with 2,500 views" class="badge"><span class="badge2"></span>&nbsp;Notable Question</a>
<a href="/users/387300/chessdev">ChessDev</a></td></tr>
<tr><td><a href="/badges/27/notable-question?userid=155799" title="silver badge: Asked a question with 2,500 views" class="badge"><span class="badge2"></span>&nbsp;Notable Question</a>
<a href="/users/155799/db83">db83</a></td></tr>

</table>
<p class="ar"><a href="/badges">all badges &raquo;</a></p>
</div>
</div>
</div>
</div>

<?php
include 'footer.php';
?>
</body>
</html>
Loading

0 comments on commit 88f941f

Please sign in to comment.