function updateComment($logid, $ascmt) { global $modx; $fields['comment'] = $ascmt; $where = "id='" . $logid . "'"; $modx->db->update($fields, $this->tbName, $where); return true; } } //============================================================================== /* The code below handles comment sent if the $_POST variables are set. Used when the user post comment from the ajaxSearch results window */ if ($_POST['logid'] && $_POST['ascmt']) { $ascmt = $_POST['ascmt']; $logid = $_POST['logid']; $safeCmt = strlen($ascmt) < CMT_MAX_LENGTH && substr_count($ascmt, 'http') < CMT_MAX_LINKS; if ($ascmt != '' && $logid > 0 && $safeCmt) { // Setup the MODx API define('MODX_API_MODE', true); // initiate a new document parser include_once MODX_MANAGER_PATH . '/includes/document.parser.class.inc.php'; $modx = new DocumentParser(); $modx->db->connect(); $modx->getSettings(); $asLog = new AjaxSearchLog(); $asLog->updateComment($logid, $ascmt); echo "comment about record " . $logid . " registered"; } else { echo "ERROR: comment rejected"; } }