if ($replyCnt > 0) { echo "<h4>Reply List</h4>"; for ($i = 1; $i <= $replyCnt; $i++) { echo '<div class="panel panel-info">'; echo '<div class="panel-heading">Followup ' . $i . '</div>'; echo '<div class="panel-body">'; $replyUid = sql_get_uid_byEmail($replyArr[$i]['email']); echo '<a href="profile.php?uid=' . $replyUid . '">' . sql_get_username_byEmail($replyArr[$i]['email']) . '</a>:' . $replyArr[$i]['content']; echo '<div>'; echo '<small>Time: ' . $replyArr[$i]['time'] . '</small>'; echo '<a href="#subreply' . $i . '" id="show' . $i . '" class="btn btn-info pull-right" data-toggle="collapse" style="display: inline; width:120px;" onclick="changeDisplay(' . $i . ')">Replies (' . count($subreplyMat[$replyArr[$i]['id']]) . ')</a>'; echo '<a href="#subreply' . $i . '" id="packup' . $i . '" class="btn btn-info pull-right" data-toggle="collapse" style="display: none; width:120px;" onclick="changeDisplay(' . $i . ')">Packup Replies</a>'; echo '</div>'; echo '<div id="subreply' . $i . '" class="subreply collapse">'; foreach ($subreplyMat[$replyArr[$i]['id']] as $subrow) { $reppllyUid = sql_get_uid_byEmail($subrow['email']); echo '<a href="profile.php?uid=' . $reppllyUid . '">' . sql_get_username_byEmail($subrow['email']) . '</a>:' . $subrow['content']; echo '<div>'; echo '<small>Time: ' . $subrow['time'] . '</small>'; echo '</div>'; } // form for submitting sub-replies echo '<form method=post action=show-article.php?postid=' . $_GET["postid"] . '>'; echo '<input type=hidden name="parentid" value=' . $replyArr[$i]['id'] . '>'; echo '<input type=hidden name="replyedemail" value=' . $replyArr[$i]['email'] . '>'; echo '<input type=hidden name="title" value=' . $postTitle . '>'; echo '<div align="right" class="col-md-2 col-xs-2">Reply:</div>'; echo '<div class="col-md-8 col-xs-10"><textarea class="form-control" name=reply_content style="margin: 0px; width: 100%; height: 140px;" required></textarea>'; echo '<input id="replybutton" class="btn btn-primary" type=submit name=submit value=reply>'; echo '</div>'; echo '</form>';
function Print_Fav_Post($post_row, $email, $page, $fav_row) { if (count($post_row) == 0) { return; } $flag = 0; $cnt = 0; echo '<div class="panel-group">'; echo '<div class="panel panel-default">'; echo '<div class="panel-heading">'; echo '<h4 class="panel-title">'; echo '<a data-toggle="collapse" href="#collapse1">This week<i class="glyphicon glyphicon-triangle-bottom"></i></a>'; echo '</h4>'; echo '</div>'; echo '<div id="collapse1" class="panel-collapse collapse in">'; echo '<ul class="list-group">'; $total = 0; $index = 0; $favs = array(); //print_r($fav_row); //print_r($row2['postid']); //echo '<br><br>'; foreach ($fav_row as $row2) { //print_r($row2['postid']); array_push($favs, $row2['postid']); //print_r($favs); } //print_r($favs); foreach ($post_row as $row) { //$cnt = $cnt + 1; if (strtotime($row['time']) > strtotime('now')) { continue; } if ($flag == 0 && strtotime($row['time']) < strtotime('-7 day')) { $flag = 1; echo '</ul>'; echo '</div>'; echo '</div>'; echo '<div class="panel panel-default">'; echo '<div class="panel-heading">'; echo '<h4 class="panel-title">'; echo '<a data-toggle="collapse" href="#collapse2">A Week ago<i class="glyphicon glyphicon-triangle-bottom"></i></a>'; echo '</h4>'; echo '</div>'; $in = ""; if ($total == 0) { $in = "in"; } echo '<div id="collapse2" class="panel-collapse collapse ' . $in . '">'; echo '<ul class="list-group">'; } $cnt = $cnt + 1; if ($cnt < $page * 30) { continue; } //if($cnt % 2 == 0) echo '<li class="list-group-item">'; //else echo '<li class="list-group-item list-group-item-info">'; echo '<li class="list-group-item">'; echo '<div style="padding:5px">'; //else // echo ' '; echo '<a href="show-article.php?postid=' . $row["postid"] . '">' . $row["title"] . '</a>'; //echo $row["postid"]; if ($email == $row["user_email"] || admin_byEmail($email)) { echo '<a href="#" class="deletePost pull-right" data-email =' . $row["postid"] . '>×</a>'; } else { echo '<div class = "pull-right" style="color: white;margin-left:10px; font-size: 160%;"">×</div>'; } if (in_array($row["postid"], $favs)) { //echo $row["postid"]; //echo '<br>'; //print_r($favs); //print_r($row2); echo '<button class = "star glyphicon glyphicon-star pull-right" id="myImage' . $index . '" type=submit name="deleteFav" value =' . $row["postid"] . ' alt="STAR" width="34" height="26">'; } else { echo '<button class = "star glyphicon glyphicon-star-empty pull-right" id="myImage' . $index . '" type=submit name="addFav" value =' . $row["postid"] . ' alt="STAR" width="34" height="26">'; } echo '</button>'; //echo '<img id="myImage'. $index .'" type=submit name="deleteFav" value ='.$row["postid"].' onclick="changeImage(\'myImage'. $index .'\');document.forms[1].submit()" src="../pictures/jiaStaron.png" alt="STAR" width="34" height="26">'; $index = $index + 1; echo '<span class = "badge pull-right">' . $row["visit"] . ' view'; echo '</span>'; echo '</div>'; echo '<div style="padding:15px">'; echo '<span class="label label-info pull-left">' . $row["company"] . '</span>'; echo '<span class="label label-info pull-left" style ="margin-left:10px">' . $row["position"] . '</span>'; $uid = sql_get_uid_byEmail($row["user_email"]); echo '<small class = "pull-right" style="text-color:gray">Post by: <a href = "profile.php?uid=' . $uid . '">' . sql_get_username_byEmail($row["user_email"]) . '</a></small>'; echo '</div>'; echo '</li>'; $total = $total + 1; if ($cnt > ($page + 1) * 30) { break; } } echo '</ul>'; echo '</div>'; echo '</div>'; echo '</div>'; }
session_start(); include_once "header.php"; include_once "sqlfuncs.php"; if (!isset($_SESSION['email'])) { header('Location: index.php'); exit; } $myemail = $_SESSION["email"]; if (sql_is_verified($myemail, $_SESSION['type'])) { } else { echo "<h3>Please verify your email</h3>"; return; } echo '<div style="width:700px; margin:auto" class = "container">'; echo '<h1>Profile Page</h1>'; $myUid = sql_get_uid_byEmail($myemail); if (isset($_GET['uid'])) { display_profile($_GET['uid']); if ($_GET['uid'] == $myUid && !admin_byEmail($_SESSION['email'])) { ?> <p><a href='settings.php'>Edit your profile</a> <?php } } else { display_profile($myUid); if (!admin_byEmail($_SESSION['email'])) { ?> <p><a href='settings.php'>Edit your profile</a> <?php } }