Files
Testing/suggestion.php
sean 0e8a8b3028
Some checks are pending
deploy-testing / deploy (push) Waiting to run
Initial testing snapshot
2026-11-17 16:15:01 -05:00

247 lines
7.8 KiB
PHP

<?php
$page = "general";
include "header.php";
if(isset($_GET['task'])) { $task = $_GET['task']; } elseif(isset($_POST['task'])) { $task = $_POST['task']; } else { $task = "main"; }
if(isset($_GET['p'])) { $p = (int) $_GET['p']; } elseif(isset($_POST['p'])) { $p = (int) $_POST['p']; } else { $p = 1; }
if(isset($_GET['forum_id'])) { $forum_id = (int) $_GET['forum_id']; } elseif(isset($_POST['forum_id'])) { $forum_id = (int) $_POST['forum_id']; } else { $forum_id = 23; }
function general()
{
global $user, $url, $database;
if(isset($_GET['id'])) { $id = (int) $_GET['id']; } elseif(isset($_POST['id'])) { $id = (int) $_POST['id']; } else { $id = ""; }
?><h2>Suggestion</h2>
<?php
$query=$database->database_query("SELECT * FROM bateworldcom_zips.suggestions WHERE admin=0 AND id='".$database->database_real_escape_string($_GET["id"])."'");
if($database->database_num_rows($query)==0)
{
$page = "error";
echo "The content you're looking for doesn't exist<br />
<br />
";
return;
}
$row=$database->database_fetch_array($query);
if($_POST["comment"]!="")
{
$database->database_query("INSERT INTO bateworldcom_zips.suggestion_comments SET comment='".$database->database_real_escape_string($_POST["comment"])."', user='".$database->database_real_escape_string($user->user_info["user_id"])."', suggestionid='".$database->database_real_escape_string($_GET["id"])."'") or die($database->database_error());
}
if($_GET["id"]!="")
{
?>
<div class="col-sm-2">
<strong>Category: </strong></div><div class="col-sm-6"><?php
$query1=$database->database_query("SELECT * FROM bateworldcom_zips.suggestion_categories WHERE id='".$row["category"]."' ORDER BY title DESC");
$row1=$database->database_fetch_array($query1);
echo $row1["title"];?>
</div><div class="clearfix"></div><div class="col-sm-2">
<strong>Suggestion: </strong></div><div class="col-sm-6"><?php echo $row["suggestion"];?></div><div class="clearfix"></div><div class="col-sm-2">
<strong>More Info: </strong></div><div class="col-sm-6"><?php echo html_entity_decode($row["moreinfo"]);?></div><div class="clearfix"></div><div class="col-sm-2">
<strong>Status:</strong></div><div class="col-sm-6"><?php if($row["status"]==0){?>Suggestion<?php }?><?php if($row["status"]==1){?>Approved<?php }?><?php if($row["status"]==2){?>In Progress<?php }?><?php if($row["status"]==3){?>Rejected<?php }?><?php if($row["status"]==4){?>Completed<?php }?></div><div class="clearfix"></div>
<br />
<br />
<div class="col-sm-8">
<?php if($row["status"]!=4&&$row["status"]!=3){?>
<div id="menu1">
<div class="comment_headline">Comments (<span class="tc" id="totalcomments">
<?php
$query = $database->database_query("SELECT * FROM bateworldcom_zips.suggestion_comments WHERE suggestionid='".$database->database_real_escape_string($id)."' ORDER BY id DESC");
$total_friends=$database->database_num_rows($query);
echo $total_friends;
?>
</span>)</div>
<div class="clearfix"></div>
<div id="comments" style='margin-left: auto; margin-right: auto;'></div>
<?php
if($row["status"]!=3){?>
<form action="#" method="post" target="ajaxframe" onsubmit="return updatecount();"><div class="profile_postcomment"><textarea name="comment_body" id="comment_body" cols="25" class="comment_area" style="overflow: hidden; height: 70px;" placeholder="Write Something..."></textarea><div style="margin-top: 5px;">Allowed HTML Tags: b, img, a, br</div><div style="text-align: right; margin-top: 5px;">
<input type="submit" id="comment_submit" name="comment_submit" class="button" value="Post Comment" />
<input type="hidden" name="task" id="task" value="suggestioncomment_post"><input type="hidden" name="type" id="type" value="suggestioncomment"><input type="hidden" name="object_id" id="object_id" value="<?php echo $_GET["id"];?>"><input type="hidden" name="value" id="value" value="<?php echo $owner->user_info[user_id];?>"><input type="hidden" name="user" id="user" value="<?php echo $user->user_info["user_username"];?>"><input type="hidden" name="tab" id="tab" value="users"><input type="hidden" name="col" id="col" value="user"></div><div id="comment_error" style="color: #FF0000; display: none;"></div></div></form>
<?php }?>
<script>
function loadXMLDoc(page)
{/*
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("comments").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","grabprofilecomments.php?id=<?php echo $id;?>&user=<?php echo $owner->user_info["user_username"];?>&url=<?php echo $_SERVER["PHP_SELF"];?><?php if($_SERVER['QUERY_STRING']!=""){?>?<?php echo $_SERVER['QUERY_STRING'];}?>&type=suggestion&p="+page+"",true);
xmlhttp.send();
*/
jQuery("#comments").load("grabprofilecomments.php?id=<?php echo $id;?>&user=<?php echo $owner->user_info["user_username"];?>&url=<?php echo $_SERVER["PHP_SELF"];?><?php if($_SERVER['QUERY_STRING']!=""){?>?<?php echo $_SERVER['QUERY_STRING'];}?>&type=suggestion&p="+page+"", function(responseTxt, statusTxt, xhr){
if(xhr.state() == "resolved"){
// alert(statusTxt);
}
else
{
e.preventdefault();
return;
}
//alert(xhr.state());
});
}
jQuery(function() {
loadXMLDoc(1);
jQuery('#comment_body').autogrow();
});
</script>
<script type="text/javascript" src="/js/jquery.autogrow-textarea.js"></script>
<script type="text/javascript">
var video_id = 0;
function editComment1(commentID)
{
//var commentContainerElement = $(this.options.type + '_' + this.options.typeID + '_comments');
//var commentElement = commentContainerElement.getElement('profile_comment_body_' + commentID);
var commentElement = $('profile_comment_body_' + commentID);
var height = commentElement.offsetHeight + 10;
var commentText = commentElement.innerHTML.replace(/<br>/gi, '\r\n').replace(/>/gi, '&gt;');
var innerHTML = '';
innerHTML += "<form action='misc_js.php' method='post' target='ajaxframe' name='editCommentForm' id='editCommentForm'>";
innerHTML += "<textarea name='comment_edit' id='comment_edit_" + commentID + "' style='height: " + height +" px; width: 100%;' onblur='doCommentEdit("+commentID+")'>" + commentText + "</textarea>";
innerHTML += "<input type='hidden' name='task' value='suggestioncomment_edit'>";
innerHTML += "<input type='hidden' name='comment_id' value='" + commentID + "'>";
innerHTML += "<input type='hidden' name='type' value='profile'>";
innerHTML += "<input type='hidden' name='iden' value='user_id'>";
innerHTML += "<input type='hidden' name='value' value='<?php echo $owner->user_info["user_id"];?>'>";
innerHTML +=
'<input type="hidden" name="tab" value="users">';
innerHTML +=
'<input type="hidden" name="col" value="user">';
/* if( this.options.typeTabParent ) innerHTML +=
'<input type="hidden" name="tab_parent" value="' + this.options.typeTabParent + '">';
if( this.options.typeColParent ) innerHTML +=
'<input type="hidden" name="col_parent" value="' + this.options.typeColParent + '">';
if( this.options.typeChild ) innerHTML +=
'<input type="hidden" name="child" value="1">';
*/
innerHTML += "</form>";
// Inject
commentElement.innerHTML = innerHTML;
textarea_autogrow('comment_edit_' + commentID);
$('comment_edit_' + commentID).focus();
}
</script>
</div>
<?php }?>
</div>
<?php
}
}
include "footer.php";
?>