public function CCOMSaveButtonClicked($sender, $param) { $SaveRecord = new CommentRecord(); $SaveRecord->com_cdate = date("Y-m-d"); $SaveRecord->com_content = $this->com_content->Text; $SaveRecord->com_modul = $this->page->ccom_modul->Text; $SaveRecord->com_id = $this->page->ccom_id->Text; $SaveRecord->idta_variante = $this->page->cidta_variante->Text; $SaveRecord->idta_periode = $this->page->cidta_periode->Text; $SaveRecord->idtm_organisation = $this->page->cidtm_organisation->Text; $SaveRecord->save(); $this->CCOMNewButtonClicked($sender, $param); $this->bindListComment(); }
public function CCOMSaveButtonClicked($sender, $param) { $SaveRecord = new CommentRecord(); $SaveRecord->com_cdate = date("Y-m-d"); $SaveRecord->com_content = $this->com_content->Text; $SaveRecord->com_modul = $this->Tedcom_tabelle->Text; $SaveRecord->com_id = $this->Tedcom_id->Text; $SaveRecord->idta_variante = $this->CBidta_organisation_art->Text; //sichtbar fuer bruecke $SaveRecord->idtm_organisation = $this->User->getUserOrgId($this->User->getUserId()); $SaveRecord->save(); $this->CCOMNewButtonClicked($sender, $param); $this->bindListComments(); $this->hideCommentDialog($sender, $param); }
function add_comment($sender, $param) { if (!$this->Page->IsValid) { return; } $record = new CommentRecord(); $record->username = $this->username->Text; $record->date_added = date('Y-m-d h:i:s'); $record->page = $this->getCurrentPagePath(); $record->block_id = $this->block_id->Value; $record->content = $this->content->Text; $record->save(); $this->content->Text = ''; $this->password->Text = ''; $cc = $this->Page->CallbackClient; $cc->appendContent('comment-list', $this->format_message($record)); $cc->callClientFunction('hide_add_comment'); $cc->callClientFunction('increment_count_tag', $record->block_id); if (!$this->Page->IsCallBack) { $this->comments->dataSource = $this->getCommentData(); $this->comments->dataBind(); } }
public function saveCommentAction() { if (!Config::get('commentsEnabled')) { $this->return404(); } $this->viewClass = "JsonView"; $siteId = $this->request->itemId; $site = $this->site->findByPk($siteId); if (empty($site)) { return $this->return404(); } $errorMessage = $this->comment->validate($this->request); if (Config::get('captchaEnabledOnComments') && !$errorMessage && !$this->captchaCode->validatePublicAndPrivateCodes($this->request)) { $errorMessage = 'You did not guess the security code.'; } if (empty($errorMessage)) { $comment = new CommentRecord(); $comment->fromArray($this->request->getArray(array("pseudo", "text", "rating"))); $comment->siteId = $site->siteId; $comment->validated = Config::get("automaticCommentValidation") ? 1 : 0; $comment->remoteIp = $this->request->getIp(); $comment->save(); if (Config::get("sendEmailsOnComment")) { Mailer::getInstance()->sendNewCommentNotificationToAdmin($site); } $this->comment->setSiteCookie($site->siteId); $this->set("status", "ok"); if (Config::get("automaticCommentValidation")) { $this->set("message", _t('Your comment was saved')); } else { $this->set("message", _t('Your comment was saved. He is awaiting moderation and will be published if it is useful for surfers')); } } else { $this->set("status", "error"); $this->set("message", _t($errorMessage)); } }
</form> <?php include_once "../php/dedugan.php"; $pd = connectDB(); if (isset($_FILES['uploadfile'])) { $f = file_get_contents($_FILES['uploadfile']['tmp_name']); unset($_FILES['uploadfile']); $comments = explode(";", $f); $i = 0; foreach ($comments as $val) { $comment = explode(",", $val); if (count($comment) != 4) { continue; } else { $i++; $comm = new CommentRecord("comments", $comment[0], $comment[1], $comment[2], $comment[3]); $comm->save($pd); } } echo "Было добавлено " . $i . " записей. "; } ?> </div> <!-- /.container-fluid --> </div> <!-- /#page-wrapper --> </div> <!-- /#wrapper -->
<div class="bodyc"> <?php $comment = new DataBase("comments"); if (isset($_POST['submit'])) { $val = new FormValidation(); $val->setRule('email', "/^[-\\w.]+@([A-z0-9][-A-z0-9]+\\.)+[A-z]{2,4}\$/"); $val->setRule('fio', "/^[А-Яа-яA-Za-z]+ [А-Яа-яA-Za-z]+ [А-Яа-яA-Za-z]+\$/"); $val->setRule('mes', "/\\w+/"); $val->validate($_POST); $er = $val->showErrors(); if (strripos($er, "Error") == false) { $fio = $_POST['fio']; $email = $_POST['email']; $mes = $_POST['mes']; $date = date('Y-m-d'); $comment = new CommentRecord("comments", $fio, $email, $mes, $date); $comment->save($pd); } else { echo $er . "<br>"; } } ?> <form method = post action="guest.php"> <a href = "openComment.php" id = "history">Открыть файл с записями </a> <br> <br> <br> <br> ФИО: <input name = "fio" > <br> <br>
function testBafflerFreetextValidates() { // create record $CommentRecord = new CommentRecord($this->Comment); $Data = $CommentRecord->random(); // add some invalid data $Data['text'] = 'A comment with an <i>unclosed tag'; // tests $this->assertFalse($this->Comment->freetext_validates($Data['text'])); $this->assertEqual($this->Comment->BaffleWarningList[0], 'mismatched html tag: please correct'); }