function drawComments($comments, $cn_id, $cn_username, $cn_timestamp, $cn_comment, $username = '', $title = '', $title_tag = '') { $content = ''; if ($title != '') { if ($title_tag == '') { $title_tag = 'h3'; } $content .= "<{$title_tag}>{$title}</{$title_tag}>"; } $content .= '<div id="commentlist">'; $totalcomment = count($comments); if ($totalcomment > 0) { $hideold = false; if ($totalcomment > 4) { $hideold = true; $startshow = $totalcomment - 4; } foreach ($comments as $count => $c) { if ($hideold && $count == 0) { $content .= '<div class="comments-old">'; } $timestamp = is_numeric($c[$cn_timestamp]) ? $c[$cn_timestamp] : strtotime($c[$cn_timestamp]); $content .= drawSingleComment($c[$cn_id], $c[$cn_username], $timestamp, $c[$cn_comment], $username == $c['username']); if ($hideold && $count == $startshow) { $content .= '</div>'; $icon .= '<div class="ui-state-default ui-corner-all" style="width:16px;position:absolute;margin:3px 0 0 4px; "><span class="ui-icon ui-icon-comment""></span></div>'; $content .= $icon . '<div class="comments-old-tgl-icon"> View all ' . $totalcomment . ' comments</div>'; } } } $content .= '</div>'; $content .= '<div id="commentform" style="text-align:right;"><textarea id="comment" class="comment-new">' . DEFAULT_COMMENT_TEXT . '</textarea></div>'; return $content; }
include DIR_WS_EMAILS . $languages[2]['path'] . '/orders-updated.php'; $from_email_name = FROM_EMAIL_NAME; $from_email_address = FROM_EMAIL_ADDRESS; $sent = tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address); } else { $messagebox->add('ERROR found when redeeming code <strong>"' . $gv_no . '"</strong>, please recheck the voucher code.'); } } } elseif ($_POST['me_action'] == 'ADDNEWCOMMENT') { $order_id = tep_db_prepare_input($_POST['order_id']); $comment = tep_db_prepare_input(utf8_decode($_POST['comment'])); $comment_by = $session_userinfo['username']; $comment_id = $class_o->insertComment($order_id, $comment, $comment_by); //$comment = $class_o->retrieveCommentDetail($comment_id); //$comments = array($comment); $result = drawSingleComment($comment_id, $comment_by, time(), $comment); echo utf8_encode($result); exit; } elseif ($_POST['me_action'] == 'DELETECOMMENT') { $order_id = tep_db_prepare_input($_POST['order_id']); $comment_id = tep_db_prepare_input($_POST['comment_id']); $class_o->deleteComment($order_id, $comment_id); echo utf8_encode($comment_id); exit; } elseif ($_POST['me_action'] == 'UPDATEPAIDSTATUS') { $order_id = tep_db_prepare_input($_POST['order_id']); $paid_status = tep_db_prepare_input($_POST['paid_status']); $class_o->updatePaymentStatus($order_id, $paid_status, $session_userinfo['username']); $result = array(); if ($paid_status == '1') { $result['class'] = 'paid';