Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*=======================================================================*\
- | phpSpring - The Formspring Clone Project [version 1.0] [build 1.5.2] |
- | ====================================================================== |
- | Copyright (c) 2012, Leo 'Met0do' - http://www.met0do.org |
- | For more stuffs and data, http://www.met0do.org - [email protected] |
- | ====================================================================== |
- | This program is free software: you can redistribute it and/or modify |
- | it under the terms of the GNU General Public License as published by |
- | the Free Software Foundation, either version 3 of the License, or |
- | (at your option) any later version. |
- | ====================================================================== |
- | This program is distributed in the hope that it will be useful, |
- | but WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
- | GNU General Public License for more details. |
- \*=======================================================================*/
- /* requeriments */
- require_once 'met0do.org.php';
- /* receiving data */
- $userProfile = filterText(ucfirst(strtolower($_GET["user"])));
- /* special functions only to this page */
- function getQuestionComments($questionID){
- return mysql_num_rows(mysql_query('select * from comments where question_id = "'.$questionID.'" and alive = "1" ORDER BY id'));
- }
- function followersCount($userr){
- return mysql_num_rows(mysql_query('select * from users_friends where friend = "'.$userr.'"'));
- }
- function friendsCount($userr){
- return mysql_num_rows(mysql_query('select * from users_friends where username = "'.$userr.'"'));
- }
- function followIt($userr){
- return mysql_num_rows(mysql_query("select * from users_friends where friend = '".$userr."' AND username = '".$_SESSION["username"]."'"));
- }
- /* security - check if user is real */
- if(getUserInfo(NULL, $userProfile, true) != false){
- $pageExhibition = true;
- $pageTitle = getUserInfo("name", $userProfile).' ('.$userProfile.')';
- $pageTheme = getUserInfo("theme", $userProfile);
- $pageUserExists = true;
- } else {
- $pageExhibition = false;
- $pageTitle = 'User Not Found';
- $pageTheme = getUserInfo("theme", $_SESSION["id"]);
- $pageUserExists = false;
- }
- /* header stuff */
- getPageHeader($pageTitle);
- /* css stuff */
- getPageCssStyle("profile", $pageTheme, $pageUserExists);
- /* js stuff */
- echo('<script type="text/javascript" src="js/prototype.js"></script>
- <script type="text/javascript" src="js/scriptaculous.js"></script>
- <script type="text/javascript" src="js/site.js"></script>
- <script type="text/javascript" src="js/search.js"></script>
- <script type="text/javascript" src="js/settings.js"></script>
- <script type="text/javascript" src="js/inbox.js"></script>
- <script type="text/javascript" src="js/profile.js"></script>
- <script type="text/javascript" src="js/color_picker.js"></script>');
- /* menus stuff */
- getPageMenus(NULL, "profile");
- /* exhibition of the page if user exists */
- if($pageExhibition) { ?>
- <div id="content">
- <noscript><div class="error"><b>ERROR:</b> JavaScript is not enabled. You must enable JavaScript to use the application.</div></noscript>
- <div id="top">
- <div id="ask">
- <?php if(getUserInfo("spam_prevention", $userProfile) == 1 && !$_SESSION["online"]) { ?>
- <p class="message" style="margin-top:28px">
- You'll have to login before asking <?php echo getUserInfo("name", $userProfile); ?> a question. <a href="account/signup" target="_blank">Click here</a> to get started in 60 seconds. </p>
- </div>
- <?php } else { ?>
- <h3><?php echo getUserInfo("what_ask", $userProfile); ?></h3>
- <form method="post" id="askForm" onsubmit="ask('<?php echo $userProfile; ?>'); return false;">
- <textarea rows="4" cols="40" name="question" id="question"></textarea><br />
- <?php if($_SESSION["online"]) { ?>
- <input type="radio" name="anonymous" id="anonymous0" value="0" checked="checked" />
- <label for="anonymous0">Include Your User Info</label>
- <?php if(getUserInfo("spam_prevention", $userProfile) != 1) { ?>
- <input type="radio" name="anonymous" id="anonymous1" value="1" />
- <label for="anonymous1">Ask Anonymously</label>
- <?php } ?>
- <?php } else { ?>
- <input type="radio" name="anonymous" id="anonymous1" value="1" checked="checked" />
- <label for="anonymous1">Ask Anonymously</label>
- <?php } ?>
- <br />
- <input type="button" id="sendButton" value="Send" onclick="ask('<?php echo $userProfile; ?>')" class="button" />
- <img id="sendIndicator" src="images/indicator.gif" alt="." class="indicator" style="display:none" />
- </form>
- <div id="success" style="display:none">
- <h3>Thanks</h3>
- <p>Your question has been sent to <?php echo $userProfile; ?> successfully. Want to <a href="javascript://" onclick="askAgain()">ask another?</a></p>
- </div>
- </div>
- <?php } ?>
- <div id="profile">
- <div id="profileInfo">
- <div id="profileUser" class="noprofile">
- <div id="profilePhoto">
- <img src="http://<?php echo SITE_DOMAIN; ?>/images/uploads/<?php echo getUserInfo("photo", $userProfile); ?>" alt="lulz" width="75" />
- </div>
- </div>
- <strong><?php echo getUserInfo("name", $userProfile); ?></strong><br />
- <?php echo getUserInfo("location", $userProfile); ?><br />
- <a href="<?php echo getUserInfo("website", $userProfile); ?>" target="_blank" rel="nofollow"><?php echo getUserInfo("website", $userProfile); ?></a><br />
- </div>
- <div class="clear"></div>
- <p><?php echo getUserInfo("bio", $userProfile); ?>
- </p>
- <div class="attention"><center><br>Amigos e Fãs<br>
- <b><a href="followers/<?php echo $userProfile; ?>">Meus Seguidores (<?php echo followersCount($userProfile); ?>)</a> </b>/ <b><a href="friends/<?php echo $userProfile; ?>">Estou Seguindo (<?php echo friendsCount($userProfile); ?>)</a></b><br><br></center></div>
- <p></p>
- <?php if($_SESSION["online"] && $_SESSION["username"] != $userProfile) {
- if(followIt($userProfile) == 0){
- ?>
- <a class="buttoned" href="friends/follow/<?php echo $userProfile; ?>"><span><font color="white">Seguir</font></span></a>
- <?php }
- elseif(followIt($userProfile) == 1){
- ?>
- <a class="removebuttoned" href="friends/remove/<?php echo $userProfile; ?>"><span><font color="white">Deixar de seguir</font></span></a>
- <?php }
- } ?>
- </div>
- </div>
- <div class="clear"></div>
- <div id="questions">
- <?php
- /* get and show all questions answered */
- $getAnsweredQuestions = mysql_query('select * from questions where to_user = "'.$userProfile.'" and status = "1" and alive = "1" ORDER BY unixtime DESC');
- if(mysql_num_rows($getAnsweredQuestions) == 0){
- echo '<p>'.getUserInfo("name", $userProfile).' hasn\'t answered any questions yet.</p>';
- } else {
- $html .= '<div id="questionsanswered">';
- $html .= '<h2>Questions Answered</h2>';
- $html .= '</div>';
- if($_SESSION["online"] || getUserInfo("spam_prevention_2", $userProfile) != 1){
- while($getAQD = mysql_fetch_assoc($getAnsweredQuestions)){
- if($getAQD["anonymous"] == 1){ $askedBy = "Anonymous"; } else { $askedBy = '<a href="http://'.SITE_DOMAIN.'/'.$getAQD["from_user"].'">'.$getAQD["from_user"].'</a>'; }
- $html .= '<div class="question" id="question'.$getAQD["id"].'">';
- $html .= '<h4>'.html_entity_decode($getAQD["question"]).'</h4>';
- $html .= '<p>'.html_entity_decode($getAQD["answer"]).'</p>';
- $html .= '<p>';
- $html .= '<span id="questionInfo">';
- $html .= 'Asked on '.$getAQD["date"].' by '.$askedBy.' - ';
- $html .= '<a href="http://'.SITE_DOMAIN.'/'.$userProfile.'/q/'.$getAQD["id"].'" class="questionLink">View Question ('.getQuestionComments($getAQD["id"]).' Comments)</a> ';
- $html .= '</span>';
- if($userProfile == $_SESSION["username"]){
- $html .= '<a href="#" onclick="removeResponse('.$getAQD["id"].'); return false;" class="removeResponseLink" style="display:none">Delete Your Response</a>';
- $html .= '<img id="removeResponse'.$getAQD["id"].'Indicator" src="images/indicator.gif" alt="." class="indicator" style="display:none;">';
- }
- $html .= '</p>';
- $html .= '</div>';
- }
- $html .= '<span class="questionCount">'.$userProfile.' has answered '.mysql_num_rows($getAnsweredQuestions).' questions to date....</span>';
- echo($html);
- }
- else{ ?>
- <div id="questionsanswered">
- <h2>Questions Answered</h2>
- </div>
- Para ver as respostas, <a href="account/login">logue-se</a> ou <a href="account/signup">crie uma conta</a>.
- <?php }} ?>
- </div>
- </div>
- </div>
- <?php /* exhibition of the page if user exists */ } elseif(!$pageExhibition) { ?>
- <div id="content"> <noscript><div class="error"><b>ERROR:</b> JavaScript is not enabled. You must enable JavaScript to use the application.</div></noscript>
- <h1>User Not Found</h1>
- <p>The requested user does not exist, <a href="">click here</a> to visit the home page.</p>
- </div></div>
- <?php } getPageFooter(); ?>
Advertisement
Add Comment
Please, Sign In to add comment