function newCmtFormHlr($author = false, $email = false, $author_id = false, $article_id = false, $content = false, $date = false) { if ($content == false) { $content = $_REQUEST['comment_text']; } if ($article_id == false) { $article_id = $_REQUEST['id']; } $reg = Registry::instance(); $_hinfo = $reg->get('hamster_info'); $login_status = $reg->get('login_status'); if ($login_status == 3) { $author = mysql_escape_string(htmlspecialchars($_hinfo['name'])); $email = ''; $author_id = intval($_hinfo['id']); if ($_REQUEST['comment_text'] == '') { return array(); } require_once 'lib/markdown/markdown.php'; $content = Markdown(strip_tags($content)); } else { $content = '<p>' . htmlspecialchars($content) . '</p>'; $email = mysql_escape_string(htmlspecialchars($_REQUEST['comment_email'])); if ($_REQUEST['comment_name'] != '' && $name == false) { $author = mysql_escape_string(htmlspecialchars($_REQUEST['comment_name'])); } else { $author = 'НЛО'; } if (strpos($_REQUEST['comment_text'], 'http://') !== false || $_REQUEST['comment_text'] == '' || $_REQUEST['comment_sid'] != $_SESSION['comment_sid'] || !isset($_SESSION['comment_sid']) || time() - $_SESSION['comment_stamp'] < 2) { return array(); } } $prs = array('author' => $author, 'email' => $email, 'author_id' => $author_id, 'article_id' => intval($article_id), 'content' => mysql_escape_string($content), 'date' => local2gm()); return $prs; }
function cvr_date2stamp($d = false, $m = false, $y = false, $h = false, $i = false) { $prs = compact("d", "m", "y", "h", "i"); foreach ($prs as $k => $p) { if ($p === false) { $prs[$k] = intval($_REQUEST['my_' . $k]); } } return local2gm(mktime($prs['h'], $prs['i'], date("s", gm2local(time(), TZ)), $prs['m'], $prs['d'], $prs['y'])); }
$artcl = $stor->make('article'); $artcl->setProps($prs); if ($artcl->add()) { $mes = '<i>' . my_lang('crt_artcl_t8') . '</i>'; } else { $mes = '<i>' . my_lang('error') . '</i>'; } } //значения для формы $db_title = ''; $db_description = ''; $db_content = ''; $db_meta_key_words = ''; $db_meta_description = ''; $db_sef = ''; $userloc = gm2local(local2gm(time(), TZ), TZ); $db_d = date("d", $userloc); $db_m = date("m", $userloc); $db_y = date("Y", $userloc); $db_h = date("H", $userloc); $db_i = date("i", $userloc); } elseif (@$_REQUEST['action'] == "edit") { //Получаем запись $stor = new Storage(); $stor = $stor->storType(TE_STORTYPE); $article = $stor->make('article'); $article->setProperty('id', $_REQUEST['id']); $article->get(); $article = $article->getProps(); if ($article['pre_content'] !== '') { $pre = true;