function onSubmit($vals) { loader_import('sitepoll.Comment'); $c = new SitepollComment(); $vals['ts'] = date('Y-m-d H:i:s'); unset($vals['submit_button']); $c->modify($vals['id'], $vals); page_title(intl_get('Comment Updated')); echo template_simple('comment_updated.spt', $vals); }
function onSubmit($vals) { loader_import('sitepoll.Comment'); $c = new SitepollComment(); $vals['ts'] = date('Y-m-d H:i:s'); unset($vals['submit_button']); $c->add($vals); $ce = appconf('comments_email'); if ($ce) { @mail($ce, intl_get('Poll Comment Notice'), template_simple('comment_email.spt', $vals), 'From: ' . 'sitepoll@' . site_domain()); } page_title(intl_get('Comment Added')); echo template_simple('comment_added.spt', $vals); }
<?php if (!session_admin() || !isset($parameters['id'])) { header('Location: ' . site_prefix() . '/index/sitepoll-app'); exit; } loader_import('sitepoll.Comment'); $c = new SitepollComment(); $comment = $c->get($parameters['id']); if (!$comment) { header('Location: ' . site_prefix() . '/index/sitepoll-app'); exit; } $c->remove($parameters['id']); page_title(intl_get('Comment Deleted')); echo template_simple('comment_deleted.spt', $comment);