forked from seanlebeck/site
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommentengine.php
More file actions
412 lines (331 loc) · 12.3 KB
/
commentengine.php
File metadata and controls
412 lines (331 loc) · 12.3 KB
1
<?phpinclude ('/accounts/includes/user_security.php'); // Works.include ('/accounts/includes/user_ads.php'); // Works.include ('/accounts/user_panel.php'); // Works. session_start(); $_SESSION['user_id'] = $_COOKIE[$ck_userid]; //echo $_SESSION['user_id']; //echo $_SESSION['user_id'];?><link rel="stylesheet" type="text/css" href="sjstyle.css"> <?php $id=$_COOKIE[$ck_userid];?><div id="menu" style="width:50px;padding-right:10px;margin-top:-8px;"> <!-- THIS IS THE MAIN ICON SHOWING THE COUNT --> <ul> <li> <div style="position:absolute;z-index:900;right:-20px;"> <a href="<?= $_SERVER["REQUEST_URI"] ?>#"style="cursor:pointer;padding:0px 0;"><div class="animate"> <a onclick="toggle_visibility('sub-menu')" class="count" style="font-weight:bold;position:absolute;z-index:900;text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.4);font-family:Roboto,Helvetica,Arial,'segoe ui',tahoma,sans-serif; color:white;margin-left:-12px;margin-top:7px;font-size:11pt;" id="notifycount"></a><img class="checkbid" id="<?php echo $id; ?>" onclick="toggle_visibility('sub-menu')" style="transition: zoom 10s ease-in-out 0s;opacity:.9;width:26px;margin-top:10px;max-width:26px; max-height:30px;"src="images/nomsg.png" valign="middle" /> </a> </div> </div> <ul id="sub-menu" class="sub-menu"> <?php $msql=mysql_query( "SELECT b.adid, f.* FROM `dojoep_messaging_db`.`dojoep_messaging_db`.`vivaru_comments`` f INNER JOIN vivaru_ads b ON f.object_id = b.adid WHERE b.user_id = '".$_COOKIE[$ck_userid]."' UNION select "); while($messagecount=mysql_fetch_array($msql)) $id=$messagecount['id']; $msgcontent=$messagecount['comment_text']; $sender=$rowsmall['sender_name']; ?> <li style="margin-top:40px;right:100px;"class="egg"> <div class="toppointer"><img src="top.png" /></div> <?php $sql=mysql_query( "SELECT b.adid, f.* FROM `dojoep_messaging_db`.`vivaru_comments` f INNER JOIN vivaru_ads b ON f.object_id = b.adid WHERE b.user_id = '".$_COOKIE[$ck_userid]."'"); $comment_count=mysql_num_rows($sql); if($comment_count>2) { $second_count=$comment_count-2; } else { $second_count=0; } ?> <?php $id=$_COOKIE[$ck_userid];?> <div id="view_comments<?php echo $id; ?>"></div> <div id="two_comments<?php echo $id; ?>"> <?php $listsql=mysql_query(" select * FROM `dojoep_messaging_db`.`vivaru_comments`, $t_ads a WHERE object_id = a.adid AND deleted != 1 AND a.user_id = '".$_COOKIE[$ck_userid]."' order by id desc limit 6 "); // builds container while($rowsmall=mysql_fetch_array($listsql)) { $c_id=$rowsmall['id']; $c_createdon = $rowsmall['created']; $c_sender=$rowsmall['sender_name']; //echo $c_sender; $comment=$rowsmall['comment_text']; $comment_curl=$rowsmall['comment_url']; $comment_curl=implode(' ', array_slice(explode(' ', $comment_curl), 0, 10)); ?> <div type="hidden" id="lastviewedmsg"></div> <div class="comment_ui"> <div class="comment_text"> <div onclick="location.href='<?php echo $comment_curl; ?>'" style="cursor:pointer;"class="comment_actual_text"> <font style="color:#000"> <?php if($c_sender != NULL) { echo "<b>".$c_sender ."</b>inquired on "; echo date('d/m/Y h:ia' , $rowsmall['created']); echo "<br>".$comment; } else { echo "<b>user</b> inquired on "; echo date('d/m/Y h:ia' , $rowsmall['created']); echo "<br>".$comment;}?></font> </div> <form style="display:inline-block;float:right;" method="post"><input type="submit" class="sean" name="button1" value="" /></form> </div> </div> <?php }?> <?php// if(isset($_POST['button1'])) {// $q = mysql_query(// "UPDATE ` `dojoep_messaging_db`.`vivaru_comments`` SET `deleted` = 1 WHERE `id` = '".$c_id."'"// )or die(mysql_error());// }// if(isset($_POST['button2'])){// echo("You clicked button two!");// }//if isset// if(isset($_POST['button3'])){// echo("You clicked button three!");// }//if isset// if(isset($_POST['button4'])){// echo("You clicked button four!");// }//if isset// ?> <div class="bbbbbbb" id="view<?php echo $id; ?>"> <div style="background-color: #F7F7F7; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; position: relative; z-index: 100; padding:8px; cursor:pointer;"> <a style="font-style:regular;font-family:sans-serif;font-size:12px" href="#" class="view_comments" id="<?php echo $id; ?>"><font style="regular" color="#000">View all <?php echo $comment_count; ?> comments</font></a> </div> </div> </li> </ul> <li> <div style="width:9px;float:left"> <a> <div class="inboxanimate"> <a class="inboxcount" style="text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.4);z-index:999;position:absolute;margin-left:-28px;font-size:12px;margin-top:-10px; font-weight:bold;font-family:Roboto,Helvetica,Arial,'segoe ui',tahoma,sans-serif; color:white; " id="inboxcount" href="?view=messagebox"></a> <img class="checkinbox" id="<?php echo $id; ?>" style="transition: zoom 10s ease-in-out 0s;opacity:.9;margin-top:-6px;height:auto;width:auto;margin-left:20px;max-width:29px; max-height:34px;" src="images/envnomessage2.png" valign="middle" /></a> </div></div></li> </ul></div><?php //inbox message start $sql = "SELECT `conversations`.`conversation_id`, `conversations`.`conversation_subject`, `conversations`.`conversation_subject`, `conversations_messages`.`adid`, MAX(`conversations_messages`.`message_date`) AS `conversation_last_reply`, MAX(`conversations_messages`.`message_date`) > `conversations_members`.`conversation_last_view` AS `conversation_unread` FROM `dojoep_messaging_db`.`conversations` LEFT JOIN `dojoep_messaging_db`.`conversations_messages` ON `conversations`.`conversation_id` = `conversations_messages`.`conversation_id` INNER JOIN `dojoep_messaging_db`.`conversations_members` ON `conversations`.`conversation_id`= `conversations_members`.`conversation_id` LEFT JOIN `vivaru_adpics` p ON p.adid = `dojoep_messaging_db`.`conversations_messages`.`adid` WHERE `conversations_members`.`user_id` = '".$_COOKIE[$ck_userid]."' AND `conversations_members`.`conversation_deleted` = 0 GROUP BY `conversations`.`conversation_id` ORDER BY `conversation_last_reply` DESC"; $result = mysql_query($sql); $conversations = array(); $count = '0'; while (($row = mysql_fetch_assoc($result)) !== false){ if ($row['conversation_unread'] == 1) { $count ++; } $conversations[] = array( 'id' => $row['conversation_id'], 'subject' => $row['conversation_subject'], 'last_reply' => $row['conversation_last_reply'], 'adid' => $row['adid'], 'unread_messages' => ($row['conversation_unread'] == 1), ); } // Here we gonna have more error checks around submission of formif (empty($conversations)){ $errors[] = 'You have no messages. ';} else { $success[] = 'You have messages. '; } // Here we check to see if error array is empty and if it isn't if (empty($errors) === false){ foreach ($errors as $error){ // echo '<div class="msg error">', $error, '</div>'; }}// inbox message end?><audio id="soundHandle_comment" value="" style="display: none;"></audio><audio id="soundHandle_message" value="" style="display: none;"></audio> <script type="text/javascript" charset="utf-8"> var oldTitle = "shufflebuy"; var msg = 'shufflebuy'; var timeoutId; document.title = "shufflebuy"; var blink = function() { document.title = document.title == msg ? ' ' : msg; }; var clear = function() { clearInterval(timeoutId); document.title = oldTitle; window.onmousemove = null; timeoutId = null; }; function addmsg(newcomment, newmessage){// use Jquery to create live elements //$("<div></div>").html('<p id="boxtext" style="font-weight:bold;" class="usertext">'+username+'</p><p style="display:inline-block;float:right;font-size:9pt;color:#CCCCCC;pading-right:8px;">'+date+'</p><p class="usertext" id="boxtext" class="text">'+text+'</p>').appendTo("#message");//$("#container").animate({"scrollTop": $('#messages_viewconversation')[0].scrollHeight}, "slow"); //alert(newcomment); //alert(newmessage); var lastcomment = $('#soundHandle_comment').val(); var lastmessage = $('#soundHandle_message').val(); if(lastcomment != newcomment && !!lastcomment) { soundHandle_comment.src = '/alertcomment.mp3'; // document.title = "("+newcomment+")shufflebuy"; soundHandle_comment.play(); // msg = newcomment+"comment"; // document.title = setInterval(blink, 2000);// window.onmousemover = clear; } if(lastmessage != newmessage && !!lastmessage) { soundHandle_message.src = '/alertmessage.mp3'; soundHandle_message.play(); if (!timeoutId) { msg = newmessage+" new msg"; timeoutId = setInterval(blink, 2000); window.onmousemove = clear; } } $('#soundHandle_comment').val(newcomment); $('#soundHandle_message').val(newmessage);// alert( $('#soundHandle_comment').val()); $('.checkbid').addClass('animated pulse'); $("#notifycount")[0].innerHTML = newcomment; $('.checkbid').attr('src','images/notifybubblered2.png'); $('.checkinbox').addClass('animated pulse'); $("#inboxcount")[0].innerHTML = newmessage; $('.checkinbox').attr('src','images/envmessage2.png'); } function waitForMsg(){ /* This requests the url "msgsrv.php" When it complete (or errors)*/ $.ajax({ type: "POST", url: "get_commentcount.php", async: true, /* If set to non-async, browser shows page as "Loading.."*/ cache: false, timeout:20000, /* Timeout in ms */ success: function(data){ /* called when request to barge.php completes */ // alert(data); // var myArr = $.parseJSON(data); var arr = eval('(' + data + ')'); // alert(arr); var newcomment = arr.newcomment; var newmessage_id = arr.newmessage_id; var newmessage = arr.newmessage; // alert(newmessage_id); // alert(arr.newmessage); addmsg(newcomment, newmessage); /* Add response to a .msg div (with the "new" class)*/ setTimeout( waitForMsg, /* Request next message */ 10000 /* ..after 1 seconds */ ); }, error: function(XMLHttpRequest, textStatus, errorThrown){ addmsg("error", textStatus + " (" + errorThrown + ")"); setTimeout( waitForMsg, /* Try again after.. */ 10000); /* milliseconds (15seconds) */ } }); }; $(document).ready(function(){ waitForMsg(); /* Start the inital request */ }); </script> <script type="text/javascript">$(function() {$(".view_comments").click(function() {var ID = $(this).attr("id");$.ajax({type: "POST",url: "viewajax.php",data: "msg_id="+ ID, cache: false,success: function(html){$("#view_comments"+ID).prepend(html);$("#view"+ID).remove();$("#two_comments"+ID).remove();}});return false;});});</script><script type="text/javascript">$(function() {$(".checkbid").click(function() {var ID = $(this).attr("id");$.ajax({type: "POST",url: "checkedbid.php",data: "bidid="+ ID, cache: false,success: function(data){ clearconsole();}});return false;setInterval(3000);});});</script><script type="text/javascript"><!-- function toggle_visibility(id) { var e = document.getElementById(id); if(e.style.display == 'block'){ e.style.display = 'none'; } else{ e.style.display = 'block';} }$('html').click(function() { //Hide the menus if visible}); $('#menucontainer').click(function(event){ event.stopPropagation();}); $(document).click(function(event) { if($(event.target).parents().index($('#menu')) == -1) { if($('#menu').is(":visible")) { $('#sub-menu').hide() } } })</script>