Skip to content
This repository has been archived by the owner on Oct 9, 2018. It is now read-only.

Add sharing options #84

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions pages/forum/view_topic.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,19 @@
// Can the user post a reply in this topic?
$can_reply = $forum->canPostReply($topic->forum_id, $user->data()->group_id);

//Get Self Url()
function getSelfUrl(){
if($_SERVER['SERVER_ADDR'] !== "127.0.0.1"){
if($_SERVER['SERVER_PORT'] == 80){
return $_SERVER['REQUEST_SCHEME']."://".$_SERVER['SERVER_NAME'];
}else{
return $_SERVER['REQUEST_SCHEME']."://".$_SERVER['SERVER_NAME'].":".$_SERVER['SERVER_PORT'];
}
}else{
return false;
}
}

// Quick reply
if(Input::exists()) {
if(!$user->isLoggedIn() && !$can_reply){
Expand Down Expand Up @@ -228,11 +241,12 @@
<?php
}
}

?>
<span class="pull-right">
<?php
// Is the user a moderator?
if($user->isLoggedIn() && ($user->data()->group_id == 2 || $user->data()->group_id == 3)){
?>
<span class="pull-right">
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
Mod Actions <span class="caret"></span>
Expand All @@ -245,10 +259,20 @@
<li><a href="/forum/sticky_thread/?tid=<?php echo $tid; ?>">Sticky Thread</a></li>
</ul>
</div>
</span>
<?php
}
?>
<!-- Share -->
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
Sharing <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a target="_blank" href="https://twitter.com/intent/tweet?text=<?php echo getSelfURL()."forum/view_topic/?tid=".$tid;?>">Share on Twitter</a></li>
<li><a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=<?php echo getSelfURL()."forum/view_topic/?tid=".$tid;?>">Share on Facebook</a></li>
</ul>
</div>
</span>
<br /><br />
<?php
// PAGINATION
Expand Down Expand Up @@ -599,4 +623,4 @@
}
?>
</body>
</html>
</html>