Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require_once ("/home/u972076373/public_html/engine/classes/mysql.php");
- include("config.php");
- function putComm($id){
- global $db;
- $result = $db->query("SELECT * FROM dle_iphoto_icomments WHERE id_post = '$id' ORDER BY date DESC");
- if($db->num_rows($result) > 0){
- while($row = $db->get_row($result)){
- $name = $row['name'];
- $email = $row['email'];
- $comment = $row['comment'];
- $date = $row['date'];
- $default = "mm";
- $size = 35;
- if($grav_url != NULL) {$grav_url = "http://www.gravatar.com/avatar/".md5(strtolower(trim($email)))."?d=".$default."&s=".$size;}else{$grav_url = "/comments/img/profile-img.jpg";};
- }}
- if($id){
- return "<div class=\"cmt-cnt\">
- <img src=\"{$grav_url}\" />
- <div class=\"thecom\">
- <h5>{$name}</h5><span data-utime=\"1371248446\" class=\"com-dt\">{$date}</span>
- <br/>
- <p>
- {$comment}
- </p>
- </div>
- </div>
- <div class=\"new-com-bt\" id=\"{$id}\">
- <span>Напишите комментарий ...</span>
- </div>
- <div class=\"new-com-cnt\" id=\"new-com-cnt{$id}\" >
- <input type=\"text\" id=\"name-com{$id}\" name=\"name-com\" value=\"\" placeholder=\"Имя\" />
- <input type=\"text\" id=\"mail-com{$id}\" name=\"mail-com\" value=\"\" placeholder=\"Емайл\" />
- <textarea id=\"new-com{$id}\" class=\"the-new-com\" placeholder=\"Сообщение\"></textarea>
- <div id=\"bt-add-com{$id}\" class=\"bt-add-com\">Post comment</div>
- <div class=\"bt-cancel-com\">Cancel</div>
- </div>
- <div class=\"clear\"></div>
- <script type=\"text/javascript\">
- $(function(){
- //alert(event.timeStamp);
- $('#{$id}').click(function(event){
- $(this).hide();
- $('#new-com-cnt{$id}').show();
- $('#name-com{$id}').focus();
- });
- $('.the-new-com').bind('input propertychange', function() {
- $(\"#bt-add-com{$id}\").css({opacity:0.6});
- var checklength = $(this).val().length;
- if(checklength){ $(\"#bt-add-com{$id}\").css({opacity:1}); }
- });
- /* on clic on the cancel button */
- $('.bt-cancel-com').click(function(){
- $('#new-com{$id}').val();
- $('#new-com-cnt{$id}').fadeOut('fast', function(){
- $('#{$id}').fadeIn('fast');
- });
- });
- // on post comment click
- $('#bt-add-com{$id}').click(function(){
- var theCom = $('#new-com{$id}');
- var theName = $('#name-com{$id}');
- var theMail = $('#mail-com{$id}');
- if( !theCom.val()){
- 'You need to write a comment!';
- }else{
- $.ajax({
- type: \"POST\",
- url: \"/comments/ajax/add-comment.php\",
- data: 'act=add-com&id_post='+{$id}+'&name='+theName.val()+'&email='+theMail.val()+'&comment='+theCom.val(),
- success: function(html){
- theCom.val('');
- theMail.val('');
- theName.val('');
- $('#new-com-cnt{$id}').hide('fast', function(){
- $('#{$id}').show('fast');
- $('#{$id}').before(html);
- })
- }
- });
- }
- });
- });
- </script>";
- }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement