Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- =====================================================
- DataLife Engine - Edit News on the SITE
- -----------------------------------------------------
- http://bslab.uz/ - [email protected] - ICQ: 284296
- -----------------------------------------------------
- Copyright (c) 2010 Best Site Laboratory
- =====================================================
- Данный код защищен авторскими правами
- =====================================================
- Файл: editnews.php
- -----------------------------------------------------
- Назначение: Редактирование новости посетителем
- =====================================================
- */
- if( ! defined( 'DATALIFEENGINE' ) ) {
- die( "Hacking attempt!" );
- }
- $allow_addnews = true;
- include_once ENGINE_DIR . '/classes/parse.class.php';
- $parse = new ParseFilter( Array (), Array (), 1, 1 );
- if( $config['max_moderation'] and ! $user_group[$member_id['user_group']]['moderation'] ) {
- $stats_approve = $db->super_query( "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE approve != '1'" );
- $stats_approve = $stats_approve['count'];
- if( $stats_approve >= $config['max_moderation'] ) $allow_addnews = false;
- }
- if( $member_id['restricted'] and $member_id['restricted_days'] and $member_id['restricted_date'] < $_TIME ) {
- $member_id['restricted'] = 0;
- $db->query( "UPDATE LOW_PRIORITY " . USERPREFIX . "_users SET restricted='0', restricted_days='0', restricted_date='' WHERE user_id='{$member_id['user_id']}'" );
- }
- if( $member_id['restricted'] == 1 or $member_id['restricted'] == 3 ) {
- if( $member_id['restricted_days'] ) {
- $lang['news_info_4'] = str_replace( '{date}', langdate( "j M Y H:i", $member_id['restricted_date'] ), $lang['news_info_4'] );
- $lang['add_err_9'] = $lang['news_info_4'];
- } else {
- $lang['add_err_9'] = $lang['news_info_5'];
- }
- $allow_addnews = false;
- }
- if( ! $allow_addnews ) {
- msgbox( $lang['all_info'], $lang['add_err_9'] . "<br /><br /><a href=\"javascript:history.go(-1)\">$lang[all_prev]</a>" );
- } else {
- if( isset( $_REQUEST['mod'] ) and $_REQUEST['mod'] == "addnews" and $is_logged and $user_group[$member_id['user_group']]['allow_adds'] ) {
- $stop = "";
- if( $config['sec_addnews'] ) {
- $id_key = $_POST[$_SESSION['id_key']];
- if( $id_key == "" or $id_key != $dle_login_hash ) $stop .= "<li>ANTISPAM: User ID not valid</li>";
- if (clean_url($_SERVER['HTTP_REFERER']) != clean_url($_SERVER['HTTP_HOST'])) $stop .= "<li>ANTISPAM: User ID not valid</li>";
- }
- $allow_comm = intval( $_POST['allow_comm'] );
- if( $user_group[$member_id['user_group']]['allow_main'] ) $allow_main = intval( $_POST['allow_main'] );
- else $allow_main = 0;
- $approve = intval( $_POST['approve'] );
- $allow_rating = intval( $_POST['allow_rating'] );
- if( $user_group[$member_id['user_group']]['allow_fixed'] ) $news_fixed = intval( $_POST['news_fixed'] );
- else $news_fixed = 0;
- if( ! count( $_REQUEST['catlist'] ) ) {
- $catlist = array ();
- $catlist[] = '0';
- } else
- $catlist = $_REQUEST['catlist'];
- $category_list = $db->safesql( implode( ',', $catlist ) );
- if( ! $config['allow_add_tags'] ) $_POST['tags'] = "";
- elseif( preg_match( "/[\||\'|\<|\>|\"|\!|\?|\$|\@|\/|\\\|\&\~\*\+]/", $_POST['tags'] ) ) $_POST['tags'] = "";
- else $_POST['tags'] = $db->safesql( htmlspecialchars( strip_tags( stripslashes( trim( $_POST['tags'] ) ) ), ENT_QUOTES ) );
- if( ! $user_group[$member_id['user_group']]['moderation'] ) {
- $approve = 0;
- $allow_comm = 1;
- $allow_main = 1;
- $allow_rating = 1;
- $news_fixed = 0;
- }
- if( $approve ) $msg = $lang['add_ok_1_1'];
- else $msg = $lang['add_ok_2_1'];
- $allow_list = explode( ',', $user_group[$member_id['user_group']]['cat_add'] );
- if( $user_group[$member_id['user_group']]['moderation'] ) {
- foreach ( $catlist as $selected ) {
- if( $allow_list[0] != "all" and ! in_array( $selected, $allow_list ) and $member_id['user_group'] != "1" ) {
- $approve = 0;
- $msg = $lang['add_ok_3_1'];
- }
- }
- }
- if ( !$user_group[$member_id['user_group']]['allow_html'] ) {
- $config['allow_site_wysiwyg'] = 0;
- $_POST['short_story'] = strip_tags ($_POST['short_story']);
- $_POST['full_story'] = strip_tags ($_POST['short_story']);
- }
- if( $config['allow_site_wysiwyg'] ) {
- $parse->allow_code = false;
- $full_story = $db->safesql( $parse->BB_Parse( $parse->process( $_POST['short_story'] ) ) );
- $short_story = $db->safesql( $parse->BB_Parse( $parse->process( $_POST['short_story'] ) ) );
- $allow_br = 0;
- } else {
- $full_story = $db->safesql( $parse->BB_Parse( $parse->process( $_POST['short_story'] ), false ) );
- $short_story = $db->safesql( $parse->BB_Parse( $parse->process( $_POST['short_story'] ), false ) );
- $allow_br = 1;
- }
- if( $parse->not_allowed_text ) {
- $stop .= "<li>" . $lang['news_err_39'] . "</li>";
- }
- $parse->ParseFilter();
- $title = $db->safesql( $parse->process( trim( strip_tags ($_POST['title']) ) ) );
- $alt_name = trim( $parse->process( stripslashes( $_POST['alt_name'] ) ) );
- $add_module = "yes";
- $xfieldsaction = "init";
- $category = $catlist;
- include (ENGINE_DIR . '/inc/xfields1.php');
- $filecontents = array ();
- if( $config['safe_xfield'] ) {
- $parse->ParseFilter();
- $parse->safe_mode = true;
- } else {
- $parse = new ParseFilter( Array (), Array (), 1, 1 );
- }
- if( ! empty( $postedxfields ) ) {
- foreach ( $postedxfields as $xfielddataname => $xfielddatavalue ) {
- if( $xfielddatavalue == "" ) {
- continue;
- }
- $parse->allow_code = true;
- $xfielddatavalue = $db->safesql( $parse->BB_Parse( $parse->process( $xfielddatavalue ), false ) );
- $xfielddataname = $db->safesql( $xfielddataname );
- $xfielddataname = str_replace( "|", "|", $xfielddataname );
- $xfielddataname = str_replace( "\r\n", "__NEWL__", $xfielddataname );
- $xfielddatavalue = str_replace( "|", "|", $xfielddatavalue );
- $xfielddatavalue = str_replace( "\r\n", "__NEWL__", $xfielddatavalue );
- $filecontents[] = "$xfielddataname|$xfielddatavalue";
- }
- $filecontents = implode( "||", $filecontents );
- } else
- $filecontents = '';
- if( $alt_name == "" or ! $alt_name ) $alt_name = totranslit( stripslashes( $title ), true, false );
- else $alt_name = totranslit( $alt_name, true, false );
- if( $title == "" or ! $title ) $stop .= $lang['add_err_1'];
- if( strlen( $title ) > 200 ) $stop .= $lang['add_err_2'];
- if( trim( $short_story ) == "" or ! $short_story ) $stop .= $lang['add_err_5'];
- if( $user_group[$member_id['user_group']]['news_sec_code']) {
- if ($config['allow_recaptcha']) {
- require_once ENGINE_DIR . '/classes/recaptcha.php';
- $sec_code = 1;
- $sec_code_session = false;
- if ($_POST["recaptcha_response_field"] AND $_POST["recaptcha_response_field"]) {
- $resp = recaptcha_check_answer ($config['recaptcha_private_key'],
- $_SERVER["REMOTE_ADDR"],
- $_POST["recaptcha_challenge_field"],
- $_POST["recaptcha_response_field"]);
- if (!$resp->is_valid) {
- $stop .= "<li>" . $lang['news_err_30'] . "</li>";
- }
- } else $stop .= "<li>" . $lang['news_err_30'] . "</li>";
- } elseif( $_REQUEST['sec_code'] != $_SESSION['sec_code_session'] OR !$_SESSION['sec_code_session'] ) $stop .= "<li>" . $lang['news_err_30'] . "</li>";
- }
- if( $stop ) {
- $stop = "<ul>" . $stop . "</ul><a href=\"javascript:history.go(-1)\">$lang[all_prev]</a>";
- msgbox( $lang['add_err_6'], $stop );
- }
- if( ! $stop ) {
- $_SESSION['sec_code_session'] = 0;
- $id = (isset( $_REQUEST['id'] )) ? intval( $_REQUEST['id'] ) : 0;
- $found = false;
- if( $id ) {
- $row = $db->super_query( "SELECT * FROM " . PREFIX . "_post where id = '$id' and approve = '0'" );
- if( $id == $row['id'] and ($member_id['name'] == $row['autor'] or $user_group[$member_id['user_group']]['allow_all_edit']) ) $found = true;
- else $found = false;
- }
- $ndatesi = $db->super_query( "SELECT * FROM " . PREFIX . "_post where id = '$id'" );
- $newsdate = $ndatesi['date'];
- $newdate = strtotime( $_POST['newdate'] );
- $allow_date = intval( $_POST['allow_date'] );
- $allow_now = intval( $_POST['allow_now'] );
- // Обработка даты и времени
- $added_time = time() + ($config['date_adjust'] * 60);
- if( $allow_date != "1" and is_logged and $member_id['user_group'] < 3 ) {
- if( $allow_now != "1" ) {
- $thistime = date( "Y-m-d H:i:s", $newdate );
- } else {
- $thistime = date ('Y-m-d H:i:s', $added_time);
- }
- $db->query( "UPDATE " . PREFIX . "_post set title='$title', date='$thistime', short_story='$short_story', full_story='$full_story', xfields='$filecontents', descr='{$metatags['description']}', keywords='{$metatags['keywords']}', category='$category_list', alt_name='$alt_name', allow_comm='$allow_comm', approve='$approve', allow_main='$allow_main', fixed='$news_fixed', allow_br='$allow_br', symbol='$catalog_url', tags='{$_POST['tags']}', metatitle='{$metatags['title']}' WHERE id='$id'" );
- } else {
- $db->query( "UPDATE " . PREFIX . "_post set title='$title', short_story='$short_story', full_story='$full_story', xfields='$filecontents', category='$category_list', alt_name='$alt_name', allow_comm='$allow_comm', approve='$approve', allow_main='$allow_main', fixed='$news_fixed', allow_br='$allow_br', tags='" . $_POST['tags'] . "' WHERE id='$id'" );
- }
- // Облако тегов
- if( $_POST['tags'] != $row['tags'] or $approve ) {
- $db->query( "DELETE FROM " . PREFIX . "_tags WHERE news_id = '{$row['id']}'" );
- if( $_POST['tags'] != "" and $approve ) {
- $tags = array ();
- $_POST['tags'] = explode( ",", $_POST['tags'] );
- foreach ( $_POST['tags'] as $value ) {
- $tags[] = "('" . $row['id'] . "', '" . trim( $value ) . "')";
- }
- $tags = implode( ", ", $tags );
- $db->query( "INSERT INTO " . PREFIX . "_tags (news_id, tag) VALUES " . $tags );
- }
- }
- if( $config['allow_alt_url'] == "yes" ) msgbox( $lang['add_ok_ok'], "{$msg} <a href=\"{$config['http_home_url']}\">$lang[all_prev]</a>" );
- else msgbox( $lang['add_ok_ok'], "{$msg} <a href=\"{$config['http_home_url']}\">$lang[all_prev]</a>" );
- if( $approve ) clear_cache();
- }
- } elseif( $is_logged and $user_group[$member_id['user_group']]['allow_adds'] ) {
- $id = (isset( $_REQUEST['id'] )) ? intval( $_REQUEST['id'] ) : 0;
- $found = false;
- if( $id ) {
- $row = $db->super_query( "SELECT * FROM " . PREFIX . "_post where id = '$id' and approve = '0'" );
- if( $id == $row['id'] and ($member_id['name'] == $row['autor'] or $user_group[$member_id['user_group']]['allow_all_edit']) ) $found = true;
- else $found = false;
- }
- $id = intval( $_GET['id'] );
- $row = $db->super_query( "SELECT * FROM " . PREFIX . "_post where id = '$id'" );
- $cat_list = explode( ',', $row['category'] );
- // без категории
- // $cat_list[0] - первая рубрика
- if ($cat_list[0] == 0) {
- $tpl->load_template( 'editnews.tpl' );
- } else {
- // желательно проверить есть ли такой шаблон с № иначе отдать дефолтный
- $tpl->load_template( 'editnews'.$cat_list[0].'.tpl' );
- }
- // вырезано с верху
- $addtype = "addnews";
- if ( !$user_group[$member_id['user_group']]['allow_html'] ) {
- $config['allow_site_wysiwyg'] = 0;
- }
- if( $config['allow_site_wysiwyg'] ) {
- include_once ENGINE_DIR . '/editor/shortsite.php';
- include_once ENGINE_DIR . '/editor/fullsite.php';
- $bb_code = "";
- } else {
- $bb_editor = true;
- include_once ENGINE_DIR . '/modules/bbcode.php';
- }
- if( !$config['allow_site_wysiwyg'] ) {
- $tpl->set( '[not-wysywyg]', '' );
- $tpl->set( '[/not-wysywyg]', '' );
- } else
- $tpl->set_block( "'\\[not-wysywyg\\].*?\\[/not-wysywyg\\]'si", '' );
- if( $config['allow_site_wysiwyg'] ) {
- $tpl->set( '{shortarea}', $shortarea );
- $tpl->set( '{fullarea}', $fullarea );
- } else {
- $tpl->set( '{shortarea}', '' );
- $tpl->set( '{fullarea}', '' );
- }
- // конец вырезки
- $categories_list = CategoryNewsSelection( $cat_list, 0 );
- $tpl->set( '{title}', $parse->decodeBBCodes( $row['title'], false ) );
- $tpl->set( '{alt-name}', $row['alt_name'] );
- $tpl->set( '{datenews11}', $row['date'] );
- if( $config['allow_site_wysiwyg'] or $row['allow_br'] != '1' ) {
- $row['short_story'] = $parse->decodeBBCodes( $row['short_story'], TRUE, $config['allow_site_wysiwyg'] );
- $row['full_story'] = $parse->decodeBBCodes( $row['full_story'], TRUE, $config['allow_site_wysiwyg'] );
- } else {
- $row['short_story'] = $parse->decodeBBCodes( $row['short_story'], false );
- $row['full_story'] = $parse->decodeBBCodes( $row['full_story'], false );
- }
- $tpl->set( '{short-story}', $row['short_story'] );
- $tpl->set( '{full-story}', $row['full_story'] );
- $tpl->set( '{tags}', $row['tags'] );
- $xfieldsaction = "categoryfilter";
- include_once ENGINE_DIR . '/inc/xfields1.php';
- if( $config['allow_multi_category'] ) {
- $cats = "<select name=\"catlist[]\" id=\"category\" onchange=\"onCategoryChange(this.value)\" style=\"width:316px;height:73px;\" multiple>";
- } else {
- $cats = "<select name=\"catlist[]\" id=\"category\" onchange=\"onCategoryChange(this.value)\">";
- }
- $cats .= $categories_list;
- $cats .= "</select>";
- $tpl->set( '{bbcode}', $bb_code );
- $tpl->set( '{category}', $cats );
- if ($row['allow_comm'] == '1') $comm_chek = "checked=\"checked\"";
- if ($row['approve'] == '1') $app_chek = "checked=\"checked\"";
- if ($row['allow_main'] == '1') $main_chek = "checked=\"checked\"";
- if ($row['allow_rate'] == '1') $rate_chek = "checked=\"checked\"";
- if ($row['fixed'] == '1') $nfix_chek = "checked=\"checked\"";
- if( $user_group[$member_id['user_group']]['moderation'] ) {
- $admintag = "<input type=\"checkbox\" name=\"allow_comm\" id=\"allow_comm\" value=\"1\" ".$comm_chek." /><label for=\"allow_comm\">" . $lang['add_al_com'] . "</label>";
- if( $user_group[$member_id['user_group']]['allow_main'] ) $admintag .= " <input type=\"checkbox\" name=\"allow_main\" id=\"allow_main\" value=\"1\" ".$main_chek." /><label for=\"allow_main\">" . $lang['add_al_m'] . "</label>";
- $admintag .= "<br /><input type=\"checkbox\" name=\"approve\" id=\"approve\" value=\"1\" ".$app_chek." /><label for=\"approve\"> {$lang['add_al_ap']}</label>";
- if( $user_group[$member_id['user_group']]['allow_fixed'] ) $admintag .= "<br /><input type=\"checkbox\" name=\"news_fixed\" id=\"news_fixed\" value=\"1\" $nfix_chek /><label for=\"news_fixed\"> {$lang['add_al_fix']}</label>";
- $tpl->set( '{admintag}', $admintag );
- } else
- $tpl->set( '{admintag}', '' );
- if( $is_logged and $member_id['user_group'] < 3 ) {
- $tpl->set( '[urltag]', '' );
- $tpl->set( '[/urltag]', '' );
- } else
- $tpl->set_block( "'\\[urltag\\].*?\\[/urltag\\]'si", "" );
- if( $is_logged and $member_id['user_group'] < 3 ) {
- $tpl->set( '[dateedadm]', '' );
- $tpl->set( '[/dateedadm]', '' );
- } else
- $tpl->set_block( "'\\[dateedadm\\].*?\\[/dateedadm\\]'si", "" );
- $xfieldsaction = "list";
- $xfieldsid = $row['xfields'];
- $xfieldscat = $row['category'];
- include (ENGINE_DIR . '/inc/xfields1.php');
- $tpl->set( '{xfields}', $output );
- $tpl->set( '', $outputList );
- if( strpos( $tpl->copy_template, "[xfvalue_" ) !== false OR strpos( $tpl->copy_template, "[xfgiven_" ) !== false ) {
- $xfieldsdata = xfieldsdataload( $row['xfields'] );
- foreach ( $xfields as $value ) {
- $preg_safe_name = preg_quote( $value[0], "'" );
- if ( $value[6] AND !empty( $xfieldsdata[$value[0]] ) ) {
- $temp_array = explode( ",", $xfieldsdata[$value[0]] );
- $value3 = array();
- foreach ($temp_array as $value2) {
- $value2 = trim($value2);
- $value2 = str_replace("'", "'", $value2);
- if( $config['allow_alt_url'] ) $value3[] = "<a href=\"" . $config['http_home_url'] . "xfsearch/" . urlencode( $value2 ) . "/\">" . $value2 . "</a>";
- else $value3[] = "<a href=\"$PHP_SELF?do=xfsearch&xf=" . urlencode( $value2 ) . "\">" . $value2 . "</a>";
- }
- $xfieldsdata[$value[0]] = implode(", ", $value3);
- unset($temp_array);
- unset($value2);
- unset($value3);
- }
- if( empty( $xfieldsdata[$value[0]] ) ) {
- $tpl->copy_template = preg_replace( "'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template );
- $tpl->copy_template = str_replace( "[xfnotgiven_{$value[0]}]", "", $tpl->copy_template );
- $tpl->copy_template = str_replace( "[/xfnotgiven_{$value[0]}]", "", $tpl->copy_template );
- } else {
- $tpl->copy_template = preg_replace( "'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template );
- $tpl->copy_template = str_replace( "[xfgiven_{$value[0]}]", "", $tpl->copy_template );
- $tpl->copy_template = str_replace( "[/xfgiven_{$value[0]}]", "", $tpl->copy_template );
- }
- $xfieldsdata[$value[0]] = $parse->decodeBBCodes( $xfieldsdata[$value[0]], false );
- if ($config['allow_links'] AND $value[3] == "textarea" AND function_exists('replace_links')) $xfieldsdata[$value[0]] = replace_links ( $xfieldsdata[$value[0]], $replace_links['news'] );
- $tpl->copy_template = str_replace( "[xfvalue_{$value[0]}]", $xfieldsdata[$value[0]], $tpl->copy_template );
- if ( preg_match( "#\\[xfvalue_{$preg_safe_name} limit=['\"](.+?)['\"]\\]#i", $tpl->copy_template, $matches ) ) {
- $count= intval($matches[1]);
- $xfieldsdata[$value[0]] = str_replace( "</p><p>", " ", $xfieldsdata[$value[0]] );
- $xfieldsdata[$value[0]] = strip_tags( $xfieldsdata[$value[0]], "<br>" );
- $xfieldsdata[$value[0]] = trim(str_replace( "<br>", " ", str_replace( "<br />", " ", str_replace( "\n", " ", str_replace( "\r", "", $xfieldsdata[$value[0]] ) ) ) ));
- if( $count AND dle_strlen( $xfieldsdata[$value[0]], $config['charset'] ) > $count ) {
- $xfieldsdata[$value[0]] = dle_substr( $xfieldsdata[$value[0]], 0, $count, $config['charset'] );
- if( ($temp_dmax = dle_strrpos( $xfieldsdata[$value[0]], ' ', $config['charset'] )) ) $xfieldsdata[$value[0]] = dle_substr( $xfieldsdata[$value[0]], 0, $temp_dmax, $config['charset'] );
- }
- $tpl->set( $matches[0], $xfieldsdata[$value[0]] );
- }
- }
- }
- if( $user_group[$member_id['user_group']]['news_sec_code'] ) {
- if ( $config['allow_recaptcha'] ) {
- $tpl->set( '[recaptcha]', "" );
- $tpl->set( '[/recaptcha]', "" );
- $tpl->set( '{recaptcha}', '
- <script language="javascript" type="text/javascript">
- <!--
- var RecaptchaOptions = {
- theme: \''.$config['recaptcha_theme'].'\',
- lang: \''.$lang['wysiwyg_language'].'\'
- };
- //-->
- </script>
- <script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k='.$config['recaptcha_public_key'].'"></script>' );
- $tpl->set_block( "'\\[sec_code\\](.*?)\\[/sec_code\\]'si", "" );
- $tpl->set( '{reg_code}', "" );
- } else {
- $tpl->set( '[sec_code]', "" );
- $tpl->set( '[/sec_code]', "" );
- $path = parse_url( $config['http_home_url'] );
- $tpl->set( '{sec_code}', "<span id=\"dle-captcha\"><img src=\"" . $path['path'] . "engine/modules/antibot.php\" alt=\"${lang['sec_image']}\" border=\"0\" alt=\"\" /><br /><a onclick=\"reload(); return false;\" href=\"#\">{$lang['reload_code']}</a></span>" );
- $tpl->set_block( "'\\[recaptcha\\](.*?)\\[/recaptcha\\]'si", "" );
- $tpl->set( '{recaptcha}', "" );
- }
- } else {
- $tpl->set( '{sec_code}', "" );
- $tpl->set( '{recaptcha}', "" );
- $tpl->set_block( "'\\[recaptcha\\](.*?)\\[/recaptcha\\]'si", "" );
- $tpl->set_block( "'\\[sec_code\\](.*?)\\[/sec_code\\]'si", "" );
- }
- $script = "
- <script language=\"javascript\" type=\"text/javascript\">
- <!--
- function preview(){";
- if( $config['allow_site_wysiwyg'] == "yes" ) {
- $script .= "document.getElementById('short_story').value = tinyMCE.get('short_story').getContent();
- document.getElementById('full_story').value = tinyMCE.get('full_story').getContent();";
- }
- $script .= "if(document.entryform.short_story.value == '' || document.entryform.title.value == ''){ alert('$lang[add_err_7]'); }
- else{
- dd=window.open('','prv','height=400,width=750,resizable=0,scrollbars=1')
- document.entryform.mod.value='preview';document.entryform.action='{$config['http_home_url']}engine/preview.php';document.entryform.target='prv'
- document.entryform.submit();dd.focus()
- setTimeout(\"document.entryform.mod.value='addnews';document.entryform.action='';document.entryform.target='_self'\",500)
- }
- }";
- $script .= <<<HTML
- function reload () {
- var rndval = new Date().getTime();
- document.getElementById('dle-captcha').innerHTML = '<img src="{$path['path']}engine/modules/antibot.php?rndval=' + rndval + '" border="0" width="120" height="50" alt="" /><br /><a onclick="reload(); return false;" href="#">{$lang['reload_code']}</a>';
- };
- function CheckStatus(Form){
- if(Form.allow_date.checked) {
- Form.allow_now.disabled = true;
- Form.allow_now.checked = false;
- } else {
- Form.allow_now.disabled = false;
- }
- }
- //-->
- </script>
- HTML;
- if( $config['allow_site_wysiwyg'] == "yes" ) $script .= "<form method=post name=\"entryform\" id=\"entryform\" onsubmit=\"document.getElementById('short_story').value = tinyMCE.get('short_story').getContent(); document.getElementById('full_story').value = tinyMCE.get('full_story').getContent(); if(document.entryform.title.value == '' || document.entryform.short_story.value == ''){alert('$lang[add_err_7]');return false}\" action=\"\">";
- else $script .= "<form method=post name=\"entryform\" id=\"entryform\" onsubmit=\"if(document.entryform.title.value == '' || document.entryform.short_story.value == ''){alert('$lang[add_err_7]');return false}\" action=\"\">";
- if( $config['sec_addnews'] ) {
- $salt = "abchefghjkmnpqrstuvwxyz";
- srand( ( double ) microtime() * 1000000 );
- $random_key = "";
- for($i = 0; $i < 8; $i ++) {
- $random_key .= $salt{rand( 0, 23 )};
- }
- @session_register( 'id_key' );
- $_SESSION['id_key'] = $random_key;
- $random_key = "<input type=\"hidden\" name=\"{$random_key}\" value=\"{$dle_login_hash}\" />";
- } else
- $random_key = "";
- $tpl->copy_template = $categoryfilter . $script . $tpl->copy_template . "<input type=\"hidden\" name=\"mod\" value=\"addnews\" />{$random_key}</form>";
- $tpl->compile( 'content' );
- $tpl->clear();
- } else
- msgbox( $lang['all_info'], "$lang[add_err_8]<br /><a href=\"javascript:history.go(-1)\">$lang[all_prev]</a>" );
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment