public function addAction() { if (user::isGuest() && reg::getKey('/comments/only_reg')) { system::stop(); } if (user::isGuest() && !system::validCapcha('random_image')) { system::json(array('error' => 1, 'data' => lang::get('FEEDBACK_ERROR1'))); } // Добавляем новый комментарий $comment = new comment(); $comment->setParentId(system::POST('parent_id')); $comment->setObjId(system::POST('obj_id')); $comment->setUserName(system::POST('username')); $comment->setEmail(system::POST('email')); $comment->setText(system::POST('text')); $comment->setSendEmail(system::POST('send_email')); $obj_id = $comment->save(); if ($obj_id) { page::assign('current_url', system::POST('back_url')); $html = page::macros('comments')->view($comment->id()); system::json(array('error' => 0, 'data' => $html)); } else { system::json(array('error' => 2, 'data' => $comment->getErrorListText(' '))); } if (!empty($_POST['back_url']) && !system::isAjax()) { system::redirect($_POST['back_url'] . '#comment' . $obj_id, true); } else { system::stop(); } }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create(Request $request, $postId) { $comment = new comment(); $comment->message = $request->message; $comment->author_id = Auth::user()->id; $comment->insertion_id = $postId; $comment->save(); return view('posts.show', ['show' => $postId]); }
function update_mime_parts($commentID, $files) { $x = 2; // mime part 1 will be the message text foreach ((array) $files as $file) { $bits = array(); $bits["part"] = $file["part"] or $bits["part"] = $x++; $bits["name"] = $file["name"]; $bits["size"] = $file["size"]; $mimebits[] = $bits; } if ($commentID && $mimebits) { $comment = new comment($commentID); $comment->set_value("commentMimeParts", serialize($mimebits)); $comment->skip_modified_fields = true; $comment->updateSearchIndexLater = true; $comment->save(); } }
public function addComment($urlfriendly = null) { $C = new configuration(); $codice = $C->getBlogConfiguration(); if ($this->data) { if (is_null($urlfriendly) === true) { $this->redirect($codice['blog_siteurl'], true); } $P = new post(); $post = $P->findBy('urlfriendly', $urlfriendly); if ($P->isNew() === true) { $this->redirect($codice['blog_siteurl'], true); } if (isset($this->data["resultado"]) === true) { $captcha = $this->data['resultado']; if ($captcha != '5') { $this->session->flash('Tu comentario no puede ser agregado. Necesitas contestar la pregunta correctamente.'); $this->redirect("{$post['urlfriendly']}#comments"); } unset($this->data['resultado']); } else { $this->session->flash('Tu comentario no puede ser agregado. Necesitas contestar la pregunta.'); $this->redirect("{$post['urlfriendly']}#comments"); } if ($this->cookie->check('id_user')) { $this->data['user_id'] = $this->cookie->id_user; $this->data['status'] = 'publish'; } else { $this->data['user_id'] = 0; $this->data['status'] = 'waiting'; } $this->data['type'] = ''; //'pingback', 'trackback', '' $this->data['IP'] = utils::getIP(); $this->data['ID_post'] = $post["ID"]; $this->cookie->author = $this->data['author']; $this->cookie->email = $this->data['email']; $this->cookie->url = $this->data['url']; $C = new comment(); $C->prepareFromArray($this->data); $valid = $C->save(); if ($valid) { $this->registry->lastCommentID = $valid; $this->registry->postID = $post["ID"]; $this->plugin->call("index_comment_added"); } if ($valid and $this->isAjax()) { echo $valid; } else { if ($valid) { $this->redirect("{$post['urlfriendly']}#comment-{$valid}"); } else { $this->redirect("{$post['urlfriendly']}"); } } } }
public function approve($id) { $Comment = new comment(); $Comment->find($id); if ($Comment['type'] == 'pingback' or $Comment['type'] == 'trackback') { $Comment->setPingback(); } $Comment['status'] = 'publish'; $Comment->save(); $this->registry->lastCommentID = $id; $this->plugin->call("comment_approbed"); if ($this->isAjax()) { echo $id; } else { $this->redirect("comments"); } }
function import_planner_tasks($parentNode, $parentTaskId, $depth, $task_allocation, $resource_people, $project_manager_ID) { //Recursively imports tasks from GNOME Planner, given the parentNode. global $projectID; $current_user =& singleton("current_user"); $result = array(); // our dodgy DOM_NodeList doesn't support foreach.... for ($i = 0; $i < $parentNode->childNodes->length; $i++) { $taskXML = $parentNode->childNodes->item($i); if ($taskXML->nodeType == XML_ELEMENT_NODE && $taskXML->tagName == "task") { $task = new task(); $task->set_value('taskName', trim($taskXML->getAttribute("name"))); $task->set_value('projectID', $projectID); // We can find the task assignee's id in the $task_allocation array, and that person's Person record in the $resource_people array $planner_taskid = $taskXML->getAttribute("id"); // Dates we guess at (i.e., set to now) $task->set_value('dateCreated', date("Y-m-d H:i:s")); $task->set_value('dateAssigned', date("Y-m-d H:i:s")); if ($taskXML->hasAttribute("work-start")) { $task->set_value('dateTargetStart', import_planner_date($taskXML->getAttribute("work-start"))); } else { $task->set_value('dateTargetStart', import_planner_date($taskXML->getAttribute("start"))); $result[] = "Resorting to work value for " . $task->get_value('taskName'); } $task->set_value('dateTargetCompletion', import_planner_date($taskXML->getAttribute("end"))); if ($taskXML->hasAttribute("note")) { $task->set_value('taskDescription', $taskXML->getAttribute("note")); } $task->set_value('creatorID', $current_user->get_id()); $task->set_value('managerID', $project_manager_ID); if ($taskXML->hasAttribute("type") and $taskXML->getAttribute("type") == "milestone") { $task->set_value('taskTypeID', 'Milestone'); } else { $task->set_value('taskTypeID', 'Task'); } $task->set_value('taskStatus', 'open_notstarted'); $task->set_value('priority', '3'); $task->set_value('parentTaskID', $parentTaskId == 0 ? "" : $parentTaskId); // The following fields we leave at their default values: duplicateTaskID, dateActualCompletion, dateActualStart, closerID, timeExpected, dateClosed, parentTaskID, taskModifiedUser // Handle task assignment if (isset($task_allocation[$planner_taskid])) { if (is_array($task_allocation[$planner_taskid])) { // This task was assigned to more than one person. Assign it to the project manager and make a comment about it. $task->set_value('personID', $project_manager_ID); // Save the task so we have a task ID $task->save(); // Make a comment about this task $comment = new comment(); $comment->set_value("commentType", "task"); $comment->set_value("commentLinkID", $task->get_id()); $comment->set_value("commentCreatedTime", date("Y-m-d H:i:s")); // The user doing the import is (implicitly) the user creating the comment $comment->set_value("commentCreatedUser", $current_user->get_id()); // Get the relevant usernames $names = array(); foreach ($task_allocation[$planner_taskid] as $assignee) { $names[] = person::get_fullname($assignee); } $comment->set_value("comment", "Import notice: This task was originally assigned to " . implode($names, ', ') . "."); $comment->save(); $result[] = sprintf("<li>Note: multiple people were assigned to the task %d %s</li>", $task->get_id(), $task->get_value("taskName")); } else { $task->set_value('personID', $resource_people[$task_allocation[$taskXML->getAttribute("id")]]->get_id()); } } else { // Task not assigned to anyone, assign the task to the nominated manager $task->set_value('personID', $project_manager_ID); } $task->save(); $result[] = sprintf('<li>%sCreated task <a href="%s">%d %s</a>.</li>', str_repeat(">", $depth), $task->get_url(), $task->get_id(), $task->get_value('taskName')); // Do child nodes if ($taskXML->hasChildNodes()) { $result = array_merge($result, import_planner_tasks($taskXML, $task->get_id(), $depth + 1, $task_allocation, $resource_people, $project_manager_ID)); } } } return $result; }
function nvweb_comments($vars = array()) { global $website; global $DB; global $current; global $webgets; global $dictionary; global $webuser; global $theme; global $events; global $session; $webget = 'comments'; if (!isset($webgets[$webget])) { $webgets[$webget] = array(); global $lang; if (empty($lang)) { $lang = new language(); $lang->load($current['lang']); } // default translations $webgets[$webget]['translations'] = array('post_a_comment' => t(379, 'Post a comment'), 'name' => t(159, 'Name'), 'email' => t(44, 'E-Mail'), 'website' => t(177, 'Website'), 'message' => t(380, 'Message'), 'email_will_not_be_published' => t(381, 'E-Mail will not be published'), 'submit' => t(382, 'Submit'), 'sign_in_or_sign_up_to_post_a_comment' => t(383, 'Sign in or Sign up to post a comment'), 'comments_on_this_entry_are_closed' => t(384, 'Comments on this entry are closed'), 'please_dont_leave_any_field_blank' => t(385, 'Please don\'t leave any field blank'), 'your_comment_has_been_received_and_will_be_published_shortly' => t(386, 'Your comment has been received and will be published shortly'), 'new_comment' => t(387, 'New comment'), 'review_comments' => t(388, 'Review comments')); // theme translations // if the web theme has custom translations for this string subtypes, use it (for the user selected language) /* just add the following translations to your json theme dictionary: "post_a_comment": "Post a comment", "name": "Name", "email": "E-Mail", "website": "Website", "message": "Message", "email_will_not_be_published": "E-Mail will not be published", "submit": "Submit", "sign_in_or_sign_up_to_post_a_comment": "Sign in or Sign up to post a comment", "comments_on_this_entry_are_closed": "Comments on this entry are closed", "please_dont_leave_any_field_blank": "Please don't leave any field blank", "your_comment_has_been_received_and_will_be_published_shortly": "Your comment has been received and will be published shortly", "new_comment": "New comment", "review_comments": "Review comments" */ if (!empty($website->theme) && method_exists($theme, 't')) { foreach ($webgets[$webget]['translations'] as $code => $text) { $theme_translation = $theme->t($code); if (!empty($theme_translation) && $theme_translation != $code) { $webgets[$webget]['translations'][$code] = $theme_translation; } } } } // set default callback if (empty($vars['callback'])) { $vars['callback'] = 'alert'; } // check callback attributes $callback = $vars['callback']; if (!empty($vars['alert_callback'])) { $callback = $vars['alert_callback']; } else { if (!empty($vars['callback_alert'])) { $callback = $vars['callback_alert']; } } $callback_error = $callback; if (!empty($vars['error_callback'])) { $callback_error = $vars['error_callback']; } else { if (!empty($vars['callback_error'])) { $callback_error = $vars['callback_error']; } } $out = ''; // if the current page belongs to a structure entry // we need to get the associated elements to retrieve and post its comments // (because structure entry pages can't have associated comments) // so, ONLY the FIRST element associated to a category can have comments in a structure entry page // (of course if the element has its own page, it can have its own comments) $element = $current['object']; if ($current['type'] == 'structure') { if (empty($current['structure_elements'])) { $current['structure_elements'] = $element->elements(); } $element = $current['structure_elements'][0]; } switch (@$vars['mode']) { case 'process': if (isset($_GET['nv_approve_comment'])) { // process 1-click comment approval $comment = new comment(); $comment->load($_GET['id']); if (!empty($comment->id) && $comment->status == -1) { $hash = $_GET['hash']; if ($hash == sha1($comment->id . $comment->email . APP_UNIQUE . serialize($website->contact_emails))) { // hash check passed $comment->status = 0; $comment->save(); $response = t(555, "Item has been successfully published."); if ($vars['notify'] == 'inline' || $callback == 'inline') { $out = '<div class="comment-success">' . $response . '</div>'; } else { if (!isset($vars['notify']) || $vars['notify'] == 'callback') { nvweb_after_body("js", $callback . '("' . $response . '");'); } } } else { $response = t(344, "Security error"); if ($vars['notify'] == 'inline' || $callback_error == 'inline') { $out = '<div class="comment-error">' . $response . '</div>'; } else { if (!isset($vars['notify']) || $vars['notify'] == 'callback') { nvweb_after_body("js", $callback_error . '("' . $response . '");'); } } } } else { $response = t(56, "Unexpected error"); if ($vars['notify'] == 'inline' || $callback_error == 'inline') { $out = '<div class="comment-error">' . $response . '</div>'; } else { if (!isset($vars['notify']) || $vars['notify'] == 'callback') { nvweb_after_body("js", $callback_error . '("' . $response . '");'); } } } } if (isset($_GET['nv_remove_comment'])) { // process 1-click comment removal $comment = new comment(); $comment->load($_GET['id']); if (!empty($comment->id) && $comment->status == -1) { $hash = $_GET['hash']; if ($hash == sha1($comment->id . $comment->email . APP_UNIQUE . serialize($website->contact_emails))) { // hash check passed $comment->delete(); $response = t(55, "Item successfully deleted"); if ($vars['notify'] == 'inline' || $callback == 'inline') { $out = '<div class="comment-success">' . $response . '</div>'; } else { if (!isset($vars['notify']) || $vars['notify'] == 'callback') { nvweb_after_body("js", $callback . '("' . $response . '");'); } } } else { $response = t(344, "Security error"); if ($vars['notify'] == 'inline' || $callback_error == 'inline') { $out = '<div class="comment-error">' . $response . '</div>'; } else { if (!isset($vars['notify']) || $vars['notify'] == 'callback') { nvweb_after_body("js", $callback_error . '("' . $response . '");'); } } } } else { $response = t(56, "Unexpected error"); if ($vars['notify'] == 'inline' || $callback_error == 'inline') { $out = '<div class="comment-error">' . $response . '</div>'; } else { if (!isset($vars['notify']) || $vars['notify'] == 'callback') { nvweb_after_body("js", $callback_error . '("' . $response . '");'); } } } } if ($_REQUEST['form-type'] == 'comment-reply' || isset($_POST[$vars['field-message']])) { // add comment if (empty($vars['field-name'])) { $vars['field-name'] = 'reply-name'; } if (empty($vars['field-email'])) { $vars['field-email'] = 'reply-email'; } if (empty($vars['field-url'])) { $vars['field-url'] = 'reply-url'; } if (empty($vars['field-message'])) { $vars['field-message'] = 'reply-message'; } if (!empty($vars['element'])) { $element = $vars['element']; } $comment_name = @$_REQUEST[$vars['field-name']]; $comment_email = @$_REQUEST[$vars['field-email']]; $comment_url = @$_REQUEST[$vars['field-url']]; $comment_message = @$_REQUEST[$vars['field-message']]; if ((empty($comment_name) || empty($comment_email)) && empty($webuser->id) || empty($comment_message)) { $response = $webgets[$webget]['translations']['please_dont_leave_any_field_blank']; if ($vars['notify'] == 'inline' || $callback_error == 'inline') { $out = '<div class="comment-error">' . $response . '</div>'; } else { if (!isset($vars['notify']) || $vars['notify'] == 'callback') { nvweb_after_body("js", $callback_error . '("' . $response . '");'); } } return $out; } $status = -1; // new comment, not approved if (empty($element->comments_moderator)) { $status = 0; } // all comments auto-approved // remove any <nv /> or {{nv}} tag $comment_name = core_remove_nvtags($comment_name); $comment_name = strip_tags($comment_name); $comment_message = core_remove_nvtags($comment_message); $comment = new comment(); $comment->id = 0; $comment->website = $website->id; $comment->item = $element->id; $comment->user = empty($webuser->id) ? 0 : $webuser->id; $comment->name = $comment_name; $comment->email = filter_var($comment_email, FILTER_SANITIZE_EMAIL); $comment->url = filter_var($comment_url, FILTER_SANITIZE_URL); $comment->ip = core_ip(); $comment->date_created = core_time(); $comment->date_modified = 0; $comment->status = $status; $comment->message = $comment_message; $properties = array(); // check if there are comment properties values if (isset($vars['field-properties-prefix'])) { // check every possible property $e_properties = property::elements($element->template, 'comment'); for ($ep = 0; $ep < count($e_properties); $ep++) { if (isset($_POST[$vars['field-properties-prefix'] . $e_properties[$ep]->id])) { $properties[$e_properties[$ep]->id] = $_POST[$vars['field-properties-prefix'] . $e_properties[$ep]->id]; } } } // trigger the "new_comment" event through the extensions system before inserting it! $extensions_messages = $events->trigger('comment', 'before_insert', array('comment' => $comment, 'properties' => $properties)); foreach ($extensions_messages as $ext_name => $ext_result) { if (isset($ext_result['error'])) { $response = $ext_result['error']; if ($vars['notify'] == 'inline' || $callback_error == 'inline') { $out = '<div class="comment-error">' . $response . '</div>'; } else { if (!isset($vars['notify']) || $vars['notify'] == 'callback') { nvweb_after_body("js", $callback_error . '("' . $response . '");'); } } return $out; } } $comment->insert(); if (!empty($properties)) { property::save_properties_from_array('comment', $comment->id, $element->template, $properties); } // reload the element to retrieve the new comments $element = new item(); $element->load($comment->item); if ($current['type'] == 'item' && !isset($vars['element'])) { $current['object'] = $element; } // trigger the "new_comment" event through the extensions system $events->trigger('comment', 'after_insert', array('comment' => &$comment, 'properties' => $properties)); if (!empty($comment->id)) { if ($status == -1) { $response = $webgets[$webget]['translations']['your_comment_has_been_received_and_will_be_published_shortly']; if ($vars['notify'] == 'inline' || $callback_error == 'inline') { $out = '<div class="comment-success">' . $response . '</div>'; } else { if (!isset($vars['notify']) || $vars['notify'] == 'callback') { nvweb_after_body("js", $callback . '("' . $response . '");'); } } } else { $response = $webgets[$webget]['translations']['your_comment_has_been_received_and_will_be_published_shortly']; if ($vars['notify'] == 'inline' || $callback_error == 'inline') { $out = '<div class="comment-success">' . $response . '</div>'; } else { if (!isset($vars['notify']) || $vars['notify'] == 'callback') { nvweb_after_body("js", $callback . '("' . $response . '");'); } } } } $notify_addresses = $website->contact_emails; if (!empty($element->comments_moderator)) { $notify_addresses[] = user::email_of($element->comments_moderator); } $hash = sha1($comment->id . $comment->email . APP_UNIQUE . serialize($website->contact_emails)); $base_url = nvweb_source_url('element', $element->id); // default colors $background_color = '#E5F1FF'; $text_color = '#595959'; $title_color = '#595959'; $background_color_db = $DB->query_single('value', 'nv_permissions', 'name = ' . protect("nvweb.comments.background_color") . ' AND website = ' . protect($website->id), 'id DESC'); $text_color_db = $DB->query_single('value', 'nv_permissions', 'name = ' . protect("nvweb.comments.text_color") . ' AND website = ' . protect($website->id), 'id DESC'); $title_color_db = $DB->query_single('value', 'nv_permissions', 'name = ' . protect("nvweb.comments.titles_color") . ' AND website = ' . protect($website->id), 'id DESC'); if (!empty($background_color_db)) { $background_color = str_replace('"', '', $background_color_db); } if (!empty($text_color_db)) { $text_color = str_replace('"', '', $text_color_db); } if (!empty($title_color_db)) { $title_color = str_replace('"', '', $title_color_db); } $message = navigate_compose_email(array(array('title' => t(9, 'Content'), 'content' => $element->dictionary[$current['lang']]['title']), array('title' => $webgets[$webget]['translations']['name'], 'content' => $comment_name . @$webuser->username), array('title' => $webgets[$webget]['translations']['email'], 'content' => $comment_email . @$webuser->email), array('title' => $webgets[$webget]['translations']['website'], 'content' => $comment_url . @$webuser->social_website), array('title' => $webgets[$webget]['translations']['message'], 'content' => nl2br($comment_message)), array('footer' => '<a href="' . NAVIGATE_URL . '/' . NAVIGATE_MAIN . '?wid=' . $website->id . '&fid=10&act=2&tab=5&id=' . $element->id . '"><strong>' . $webgets[$webget]['translations']['review_comments'] . '</strong></a>' . ' | ' . '<a style=" color: #008830" href="' . $base_url . '?nv_approve_comment&id=' . $comment->id . '&hash=' . $hash . '">' . t(258, "Publish") . '</a>' . ' | ' . '<a style=" color: #FF0090" href="' . $base_url . '?nv_remove_comment&id=' . $comment->id . '&hash=' . $hash . '">' . t(525, "Remove comment (without confirmation)") . '</a>')), array('background' => $background_color, 'title-color' => $title_color, 'content-color' => $text_color)); // trying to implement One-Click actions (used in Google GMail) // You need to be registered with Google first: https://developers.google.com/gmail/markup/registering-with-google $one_click_actions = ' <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "name": "' . $webgets[$webget]['translations']['review_comments'] . '", "url": "' . NAVIGATE_URL . '/' . NAVIGATE_MAIN . '?wid=' . $website->id . '&fid=10&act=2&tab=5&id=' . $element->id . '" } } </script> '; $message = '<html><head>' . $one_click_actions . '</head><body>' . $message . '</body></html>'; foreach ($website->contact_emails as $contact_address) { @nvweb_send_email($website->name . ' | ' . $webgets[$webget]['translations']['new_comment'], $message, $contact_address, null, true); } } break; case 'reply': if ($element->comments_enabled_to == 2 && empty($webuser->id)) { // Post a comment form (unsigned users) $out = ' <div class="comments-reply"> <div><div class="comments-reply-info">' . $webgets[$webget]['translations']['post_a_comment'] . '</div></div> <br /> <form action="' . NVWEB_ABSOLUTE . '/' . $current['route'] . '" method="post"> <input type="hidden" name="form-type" value="comment-reply" /> <div class="comments-reply-field"><label>' . $webgets[$webget]['translations']['name'] . '</label> <input type="text" name="reply-name" value="" /></div> <div class="comments-reply-field"><label>' . $webgets[$webget]['translations']['email'] . ' *</label> <input type="text" name="reply-email" value="" /></div> <div class="comments-reply-field"><label>' . $webgets[$webget]['translations']['message'] . '</label> <textarea name="reply-message"></textarea></div> <!-- {{navigate-comments-reply-extra-fields-placeholder}} --> <div class="comments-reply-field comments-reply-field-info-email"><label> </label> * ' . $webgets[$webget]['translations']['email_will_not_be_published'] . '</div> <div class="comments-reply-field comments-reply-field-submit"><input class="comments-reply-submit" type="submit" value="' . $webgets[$webget]['translations']['submit'] . '" /></div> </form> </div> '; $extensions_messages = $events->trigger('comment', 'reply_extra_fields', array('html' => &$out)); // add any extra field generated if (!empty($extensions_messages)) { $extra_fields = array_map(function ($v) { return $v; }, array_values($extensions_messages)); $out = str_replace('<!-- {{navigate-comments-reply-extra-fields-placeholder}} -->', implode("\n", $extra_fields), $out); } } else { if ($element->comments_enabled_to > 0 && !empty($webuser->id)) { // Post a comment form (signed in users) if (empty($vars['avatar_size'])) { $vars['avatar_size'] = 32; } $avatar_url = NVWEB_OBJECT . '?type=blank'; if (!empty($webuser->avatar)) { $avatar_url = NVWEB_OBJECT . '?wid=' . $website->id . '&id=' . $webuser->avatar . '&disposition=inline&width=' . $vars['avatar_size'] . '&height=' . $vars['avatar_size']; } $out = ' <div class="comments-reply"> <div><div class="comments-reply-info">' . $webgets[$webget]['translations']['post_a_comment'] . '</div></div> <br /> <form action="' . NVWEB_ABSOLUTE . '/' . $current['route'] . '" method="post"> <input type="hidden" name="form-type" value="comment-reply" /> <div class="comments-reply-field"><label style="display: none;"> </label> <img src="' . $avatar_url . '" width="' . $vars['avatar_size'] . '" height="' . $vars['avatar_size'] . '" align="absmiddle" /> <span class="comments-reply-username">' . $webuser->username . '</span><a class="comments-reply-signout" href="?webuser_signout">(x)</a></div> <br /> <div class="comments-reply-field"><label>' . $webgets[$webget]['translations']['message'] . '</label> <textarea name="reply-message"></textarea></div> <!-- {{navigate-comments-reply-extra-fields-placeholder}} --> <div class="comments-reply-field-submit"><input class="comments-reply-submit" type="submit" value="' . $webgets[$webget]['translations']['submit'] . '" /></div> </form> </div> '; $extensions_messages = $events->trigger('comment', 'reply_extra_fields', array('html' => $out)); // add any extra field generated if (!empty($extensions_messages)) { $extra_fields = array_map(function ($v) { return $v; }, array_values($extensions_messages)); $out = str_replace('<!-- {{navigate-comments-reply-extra-fields-placeholder}} -->', implode("\n", $extra_fields), $out); } } else { if ($element->comments_enabled_to == 1) { $out = '<div class="comments-reply"> <div class="comments-reply-info">' . $webgets[$webget]['translations']['sign_in_or_sign_up_to_post_a_comment'] . '</div> </div>'; } else { $out = '<div class="comments-reply"> <div class="comments-reply-info">' . $webgets[$webget]['translations']['comments_on_this_entry_are_closed'] . '</div> </div>'; } } } break; case 'comments': setlocale(LC_ALL, $website->languages[$session['lang']]['system_locale']); list($comments, $comments_total) = nvweb_comments_list(0, NULL, NULL, $vars['order']); // get all comments of the current entry if (empty($vars['avatar_size'])) { $vars['avatar_size'] = '48'; } if (empty($vars['date_format'])) { $vars['date_format'] = '%d %B %Y %H:%M'; } for ($c = 0; $c < $comments_total; $c++) { $avatar = $comments[$c]->avatar; if (!empty($avatar)) { $avatar = '<img src="' . NVWEB_OBJECT . '?type=image&id=' . $avatar . '" width="' . $vars['avatar_size'] . 'px" height="' . $vars['avatar_size'] . 'px"/>'; } else { $avatar = '<img src="data:image/gif;base64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" width="' . $vars['avatar_size'] . 'px" height="' . $vars['avatar_size'] . 'px"/>'; } $comment = new comment(); $comment->load_from_resultset(array($comments[$c])); $depth = 'data-depth="' . $comment->depth() . '"'; $out .= ' <div class="comment"' . $depth . '> <div class="comment-avatar">' . $avatar . '</div> <div class="comment-username">' . (!empty($comments[$c]->username) ? $comments[$c]->username : $comments[$c]->name) . '</div> <div class="comment-date">' . Encoding::toUTF8(strftime($vars['date_format'], $comments[$c]->date_created)) . '</div> <div class="comment-message">' . nl2br($comments[$c]->message) . '</div> <div style="clear:both"></div> </div> '; } break; } return $out; }
$client->set_value("clientStateOne", $data[5]); $client->set_value("clientPostcodeOne", $data[6]); $client->set_value("clientStreetAddressTwo", $data[7]); $client->set_value("clientSuburbTwo", $data[8]); $client->set_value("clientStatus", "current"); $client->set_value("clientModifiedUser", $current_user->get_id()); $client->save(); if ($client->get_id()) { if (rtrim($data[9])) { $comment = new comment(); $comment->set_value("commentMaster", "client"); $comment->set_value("commentMasterID", $client->get_id()); $comment->set_value("commentType", "client"); $comment->set_value("commentLinkID", $client->get_id()); $comment->set_value("comment", $data[9]); $comment->save(); $comment_id = $comment->get_id(); } if ($data[10] || $data[11]) { $cc = new clientContact(); $cc->set_value("clientID", $client->get_id()); $cc->set_value("primaryContact", 1); $cc->set_value("clientContactName", $data[10]); $cc->set_value("clientContactEmail", $data[11]); $cc->save(); $cc_id = $cc->get_id(); } } $x++; echo "<br>" . $client->get_id() . " --- " . $cc_id . " --- " . $comment_id; if ($x > 4) {