/* Decoded by unphp.net */
?>";
$skin_list .= "";
foreach ( $templates_list as $key => $value ) {
if( $key == $skin ) $selected = " selected";
else $selected = "";
$skin_list .= "";
}
$skin_list .= '';
return $skin_list;
}
if( !$action ) $action = "list";
if( $action == "list" ) {
$_SESSION['static_referrer'] = htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES, $config['charset'] );
echoheader( "{$lang['opt_sm_static']}", $lang['header_st_1'] );
$search_field = isset($_GET['search_field']) ? $db->safesql( trim( htmlspecialchars( stripslashes( @urldecode( $_GET['search_field'] ) ), ENT_QUOTES, $config['charset'] ) ) ) : '';
$search_field2 = isset($_REQUEST['search_field']) ? $db->safesql( addslashes(addslashes(trim( urldecode( $_REQUEST['search_field'] ) ) ) ) ) : '';
if (isset($_GET['fromnewsdate']) AND $_GET['fromnewsdate']) $fromnewsdate = strtotime( $_GET['fromnewsdate'] ); else $fromnewsdate = "";
if (isset($_GET['tonewsdate']) AND $_GET['tonewsdate']) $tonewsdate = strtotime( $_GET['tonewsdate'] ); else $tonewsdate = "";
if ($fromnewsdate === -1 OR !$fromnewsdate) $fromnewsdate = "";
if ($tonewsdate === -1 OR !$tonewsdate) $tonewsdate = "";
$start_from = isset($_GET['start_from']) ? intval( $_GET['start_from'] ) : 0;
$news_per_page = isset($_GET['news_per_page']) ? intval( $_GET['news_per_page'] ) : 0;
$gopage = isset($_REQUEST['gopage']) ? intval( $_REQUEST['gopage'] ) : 0;
if( ! $news_per_page or $news_per_page < 1 ) {
$news_per_page = 50;
}
if( $gopage ) $start_from = ($gopage - 1) * $news_per_page;
if( $start_from < 0 ) $start_from = 0;
$where = array ();
$where[] = "name != 'dle-rules-page'";
if( $search_field ) {
$search_field = preg_replace('/\s+/u', '%', $search_field);
if(!$_REQUEST['search_area']) {
$where[] = "(name like '%$search_field%' OR template like '%$search_field2%' OR descr like '%$search_field%')";
} elseif($_REQUEST['search_area'] == 1) {
$where[] = "name like '%{$search_field}%'";
} elseif($_REQUEST['search_area'] == 2) {
$where[] = "descr like '%{$search_field}%'";
} elseif($_REQUEST['search_area'] == 3) {
$where[] = "template like '%{$search_field2}%'";
}
}
if( $fromnewsdate != "" ) {
$where[] = "date >= '$fromnewsdate'";
}
if( $tonewsdate != "" ) {
$where[] = "date <= '$tonewsdate'";
}
if( count( $where ) ) {
$where = implode( " AND ", $where );
$where = " WHERE " . $where;
} else {
$where = "";
}
$order_by = array ();
$_REQUEST['search_order_t'] = isset($_REQUEST['search_order_t']) ? $_REQUEST['search_order_t'] : '';
$_REQUEST['search_order_d'] = isset($_REQUEST['search_order_d']) ? $_REQUEST['search_order_d'] : '';
$_REQUEST['search_order_v'] = isset($_REQUEST['search_order_v']) ? $_REQUEST['search_order_v'] : '';
if( $_REQUEST['search_order_t'] == "asc" or $_REQUEST['search_order_t'] == "desc" ) $search_order_t = $_REQUEST['search_order_t'];
else $search_order_t = "";
if( $_REQUEST['search_order_d'] == "asc" or $_REQUEST['search_order_d'] == "desc" ) $search_order_d = $_REQUEST['search_order_d'];
else $search_order_d = "";
if( $_REQUEST['search_order_v'] == "asc" or $_REQUEST['search_order_v'] == "desc" ) $search_order_v = $_REQUEST['search_order_v'];
else $search_order_v = "";
if( ! empty( $search_order_t ) ) {
$order_by[] = "name $search_order_t";
}
if( ! empty( $search_order_d ) ) {
$order_by[] = "date $search_order_d";
}
if( ! empty( $search_order_v ) ) {
$order_by[] = "views $search_order_v";
}
$order_by = implode( ", ", $order_by );
if( ! $order_by ) $order_by = "date desc";
$search_order_date = array ('----' => '', 'asc' => '', 'desc' => '' );
if( isset( $_REQUEST['search_order_d'] ) ) {
$search_order_date[$search_order_d] = 'selected';
} else {
$search_order_date['desc'] = 'selected';
}
$search_order_title = array ('----' => '', 'asc' => '', 'desc' => '' );
if( ! empty( $search_order_t ) ) {
$search_order_title[$search_order_t] = 'selected';
} else {
$search_order_title['----'] = 'selected';
}
$search_order_view = array ('----' => '', 'asc' => '', 'desc' => '' );
if( ! empty( $search_order_v ) ) {
$search_order_view[$search_order_v] = 'selected';
} else {
$search_order_view['----'] = 'selected';
}
$search_area = array('', '', '', '');
if( isset( $_REQUEST['search_area'] ) ) {
$_REQUEST['search_area'] = intval($_REQUEST['search_area']);
$search_area[$_REQUEST['search_area']] = 'selected';
} else {
$search_area[0] = 'selected';
}
$db->query( "SELECT id, name, descr, template, views, date, password FROM " . PREFIX . "_static" . $where . " ORDER BY " . $order_by . " LIMIT $start_from,$news_per_page" );
// Prelist Entries
$i = $start_from;
if( $start_from == "0" ) {
$start_from = "";
}
$entries_showed = 0;
$entries = "";
while ( $row = $db->get_array() ) {
$i ++;
if( !$langformatdate ) $langformatdate = "d.m.Y";
$itemdate = @date( $langformatdate, $row['date'] );
$title = htmlspecialchars( stripslashes( $row['name'] ), ENT_QUOTES, $config['charset'] );
$descr = stripslashes($row['descr']);
if( $config['allow_alt_url'] ) $vlink = $config['http_home_url'] . $row['name'] . ".html";
else $vlink = $config['http_home_url'] . "index.php?do=static&page=" . $row['name'];
if( $row['password'] ) $lock = ""; else $lock = "";
$row['views'] = number_format( $row['views'], 0, ',', ' ');
$entries .= "
$itemdate - {$lock}$title |
$descr |
{$row['views']} |
|
";
$entries_showed ++;
}
// End prelisting
$result_count = $db->super_query( "SELECT COUNT(*) as count FROM " . PREFIX . "_static" . $where );
$all_count_news = $result_count['count'];
if ( $fromnewsdate ) $fromnewsdate = date("Y-m-d", $fromnewsdate );
if ( $tonewsdate ) $tonewsdate = date("Y-m-d", $tonewsdate );
///////////////////////////////////////////
// Options Bar
echo <<
function search_submit(prm){
document.optionsbar.start_from.value=prm;
document.optionsbar.submit();
return false;
}
function gopage_submit(prm){
document.optionsbar.start_from.value= (prm - 1) * {$news_per_page};
document.optionsbar.submit();
return false;
}
HTML;
// End Options Bar
echo <<
JSCRIPT;
if( $entries_showed == 0 ) {
echo <<
HTML;
} else {
// pagination
$npp_nav = "";
if( $all_count_news > $news_per_page ) {
if( $start_from > 0 ) {
$previous = $start_from - $news_per_page;
$npp_nav .= "";
}
$enpages_count = @ceil( $all_count_news / $news_per_page );
$enpages_start_from = 0;
$enpages = "";
if( $enpages_count <= 10 ) {
for($j = 1; $j <= $enpages_count; $j ++) {
if( $enpages_start_from != $start_from ) {
$enpages .= "$j";
} else {
$enpages .= "$j";
}
$enpages_start_from += $news_per_page;
}
$npp_nav .= $enpages;
} else {
$start = 1;
$end = 10;
if( $start_from > 0 ) {
if( ($start_from / $news_per_page) > 4 ) {
$start = @ceil( $start_from / $news_per_page ) - 3;
$end = $start + 9;
if( $end > $enpages_count ) {
$start = $enpages_count - 10;
$end = $enpages_count - 1;
}
$enpages_start_from = ($start - 1) * $news_per_page;
}
}
if( $start > 2 ) {
$enpages .= "1 ...";
}
for($j = $start; $j <= $end; $j ++) {
if( $enpages_start_from != $start_from ) {
$enpages .= "$j";
} else {
$enpages .= "$j";
}
$enpages_start_from += $news_per_page;
}
$enpages_start_from = ($enpages_count - 1) * $news_per_page;
$enpages .= "...$enpages_count";
$npp_nav .= $enpages;
}
if( $all_count_news > $i ) {
$how_next = $all_count_news - $i;
if( $how_next > $news_per_page ) {
$how_next = $news_per_page;
}
$npp_nav .= "";
}
$npp_nav = "";
}
// pagination
echo <<
{$npp_nav}
HTML;
}
echofooter();
} elseif( $action == "addnew" ) {
if( $config['allow_static_wysiwyg'] == 1 ) {
$js_array[] = "engine/skins/codemirror/js/code.js";
$js_array[] = "engine/editor/jscripts/froala/editor.js";
$js_array[] = "engine/editor/jscripts/froala/languages/{$lang['language_code']}.js";
$css_array[] = "engine/editor/jscripts/froala/css/editor.css";
}
if( $config['allow_static_wysiwyg'] == 2 ) {
$js_array[] = "engine/editor/jscripts/tiny_mce/tinymce.min.js";
}
if( !$config['allow_static_wysiwyg'] ) {
$js_array[] = "engine/classes/js/typograf.min.js";
}
echoheader( "{$lang['opt_sm_static']}", array($_SESSION['static_referrer'] => $lang['opt_sm_static'], '' => $lang['static_a'] ) );
echo "
";
if( !$config['allow_static_wysiwyg'] ) $fix_br = "";
else $fix_br = "";
if ($member_id['user_group'] == 1 ) $fix_br .= "";
$groups = get_groups();
$skinlist = SelectSkin('');
if( $config['allow_static_wysiwyg'] == "2" ) echo "
HTML;
echofooter();
} elseif( $action == "dosavenew" ) {
@header('X-XSS-Protection: 0;');
if( !isset($_REQUEST['user_hash']) OR !$_REQUEST['user_hash'] OR $_REQUEST['user_hash'] != $dle_login_hash ) {
die( "Hacking attempt! User not found" );
}
if( !isset($_SESSION['static_referrer']) OR !$_SESSION['static_referrer'] ) {
$_SESSION['static_referrer'] = "?mod=static&action=list";
}
$allow_br = isset($_POST['allow_br']) ? intval( $_POST['allow_br'] ) : 0;
if ($member_id['user_group'] != 1 AND $allow_br > 1 ) $allow_br = 1;
if ($allow_br == 2) {
$template = trim( addslashes( $_POST['template'] ) );
} else {
if ( $config['allow_static_wysiwyg'] ) $parse->allow_code = false;
$template = $parse->process( $_POST['template'] );
if( $config['allow_static_wysiwyg'] or $allow_br != '1' ) {
$template = $parse->BB_Parse( $template );
} else {
$template = $parse->BB_Parse( $template, false );
}
}
$disable_index = isset( $_POST['disable_index'] ) ? intval( $_POST['disable_index'] ) : 0;
$disable_search = isset( $_POST['disable_search'] ) ? intval( $_POST['disable_search'] ) : 0;
$metatags = create_metatags( $template );
$name = totranslit( $_POST['name'], true, false, $config['translit_url'] );
$descr = $db->safesql( htmlspecialchars( strip_tags(trim($_POST['description'])), ENT_QUOTES, $config['charset'] ) );
$template = $db->safesql( $template );
$password = $db->safesql(trim($_POST['password']));
$tpl = $db->safesql(cleanpath( $_POST['static_tpl'] ));
$skin_name = totranslit( $_POST['skin_name'], false, false );
$newdate = $_POST['newdate'];
if( isset( $_POST['allow_now'] ) ) $allow_now = $_POST['allow_now']; else $allow_now = "";
if( ! count( $_POST['grouplevel'] ) ) $_POST['grouplevel'] = array ("all" );
$grouplevel = $db->safesql( implode( ',', $_POST['grouplevel'] ) );
$allow_template = intval( $_POST['allow_template'] );
$allow_count = intval( $_POST['allow_count'] );
$allow_sitemap = intval( $_POST['allow_sitemap'] );
$added_time = time();
$newsdate = strtotime( $newdate );
if( ($allow_now == "yes") OR ($newsdate === - 1) OR !$newsdate) {
$thistime = $added_time;
} else {
$thistime = $newsdate;
if( ! intval( $config['no_date'] ) and $newsdate > $added_time ) $thistime = $added_time;
}
if( $name == "" or $descr == "" or $template == "" ) msg( "error", $lang['static_err'], $lang['static_err_1'], $_SESSION['static_referrer'] );
$static_count = $db->super_query( "SELECT COUNT(*) as count FROM " . PREFIX . "_static WHERE name='{$name}'" );
if ($static_count['count']) msg( "error", $lang['static_err'], $lang['static_err_2'], $_SESSION['static_referrer'] );
$db->query( "INSERT INTO " . PREFIX . "_static (name, descr, template, allow_br, allow_template, grouplevel, tpl, metadescr, metakeys, template_folder, date, metatitle, allow_count, sitemap, disable_index, disable_search, password) values ('$name', '$descr', '$template', '$allow_br', '$allow_template', '$grouplevel', '$tpl', '{$metatags['description']}', '{$metatags['keywords']}', '{$skin_name}', '{$thistime}', '{$metatags['title']}', '$allow_count', '$allow_sitemap', '$disable_index', '$disable_search', '$password')" );
$row = $db->insert_id();
$db->query( "UPDATE " . PREFIX . "_static_files SET static_id='{$row}' WHERE author = '{$member_id['name']}' AND static_id = '0'" );
$db->query( "INSERT INTO " . USERPREFIX . "_admin_logs (name, date, ip, action, extras) values ('".$db->safesql($member_id['name'])."', '{$_TIME}', '{$_IP}', '59', '{$name}')" );
if( $config['allow_alt_url'] ) $full_link = $config['http_home_url'] . $name . ".html";
else $full_link = $config['http_home_url'] . "index.php?do=static&page=" . $name;
if( $config['news_indexnow'] ) {
$result = DLESEO::IndexNow( $full_link );
if( $result !== true ) {
$lang['indexnow_error_1'] = str_ireplace('{name}', md5(SECURE_AUTH_KEY), $lang['indexnow_error_1']);
$lang['indexnow_error_2'] = str_ireplace('{name}', md5(SECURE_AUTH_KEY), $lang['indexnow_error_2']);
if( $result === null ) $result = $lang['indexnow_error_1'];
elseif( $result === -1 ) $result = $lang['indexnow_error_2'];
elseif( is_array($result) ) {
$lang['indexnow_error_3'] = str_ireplace('{searchengine}', $result[0], $lang['indexnow_error_3']);
$lang['indexnow_error_3'] = str_ireplace('{errorcode}', $result[1], $lang['indexnow_error_3']);
$result = $lang['indexnow_error_3'];
}
$result = "".$result."
";
} else $result = '';
} else $result = '';
msg( "success", $lang['static_addok'], $lang['static_addok_1'].$result, array('?mod=static&action=addnew' => $lang['add_s_1'], '?mod=static&action=doedit&id='.$row => $lang['add_s_2'], $_SESSION['static_referrer'] => $lang['add_s_3'], $full_link => $lang['add_s_5'] ) );
} elseif( $action == "doedit" ) {
if (!isset($_SESSION['static_referrer']) or !$_SESSION['static_referrer']) {
$_SESSION['static_referrer'] = "?mod=static&action=list";
}
$id = isset($_GET['id']) ? intval( $_GET['id'] ) : 0;
if( isset($_GET['page']) AND $_GET['page'] == "rules" ) {
$row = $db->super_query( "SELECT * FROM " . PREFIX . "_static where name='dle-rules-page'" );
$lang['static_edit'] = $lang['rules_edit'];
if( !$row['id'] ) {
$id = "";
$row['allow_template'] = "1";
} else $id = $row['id'];
if( ! $config['registration_rules'] ) $lang['rules_descr'] = $lang['rules_descr'] . " " . $lang['rules_check'] . "";
$_SESSION['static_referrer'] = "?mod=static&action=list";
} else {
$row = $db->super_query( "SELECT * FROM " . PREFIX . "_static where id='$id'" );
if($row['name'] == "dle-rules-page") {
header( "Location: ?mod=static&action=doedit&page=rules" );
die();
}
}
if ($row['allow_br'] == 2) {
if ($member_id['user_group'] != 1) msg( "error", $lang['index_denied'], $lang['static_not_allowed'], $_SESSION['static_referrer'] );
$row['template'] = htmlspecialchars( stripslashes( $row['template'] ), ENT_QUOTES, $config['charset'] );
} else {
if( $row['allow_br'] != '1' or $config['allow_static_wysiwyg'] ) {
$row['template'] = $parse->decodeBBCodes( $row['template'], true, $config['allow_static_wysiwyg'] );
} else {
$row['template'] = $parse->decodeBBCodes( $row['template'], false );
}
}
$skinlist = SelectSkin( $row['template_folder'] );
$row['descr'] = stripslashes($row['descr']);
$row['metatitle'] = stripslashes( $row['metatitle'] );
$itemdate = @date( "Y-m-d H:i:s", $row['date'] );
if( $config['allow_static_wysiwyg'] == 1 ) {
$js_array[] = "engine/skins/codemirror/js/code.js";
$js_array[] = "engine/editor/jscripts/froala/editor.js";
$js_array[] = "engine/editor/jscripts/froala/languages/{$lang['language_code']}.js";
$css_array[] = "engine/editor/jscripts/froala/css/editor.css";
}
if( $config['allow_static_wysiwyg'] == 2 ) {
$js_array[] = "engine/editor/jscripts/tiny_mce/tinymce.min.js";
}
if( !$config['allow_static_wysiwyg'] ) {
$js_array[] = "engine/classes/js/typograf.min.js";
}
echoheader( "{$lang['opt_sm_static']}", array($_SESSION['static_referrer'] => $lang['opt_sm_static'], '' => $lang['static_edit'] ) );
echo <<
function confirmdelete(id) {
DLEconfirm( '{$lang['static_confirm']}', '{$lang['p_confirm']}', function () {
document.location="?mod=static&action=dodelete&user_hash={$dle_login_hash}&id="+id;
} );
}
function onPassChange(obj) {
var value = obj.checked;
if (value == true) {
$('#passlist').show();
} else {
$('#passlist').hide();
}
}
$(function(){
if( document.getElementById('need_pass') ) {
onPassChange(document.getElementById('need_pass'));
}
$('.cat_select').chosen({allow_single_deselect:true, no_results_text: '{$lang['addnews_cat_fault']}'});
});
HTML;
echo "
";
$check = array('', '', '');
$check[$row['allow_br']] = "checked=\"checked\"";
if( !$config['allow_static_wysiwyg'] ) $fix_br = "";
else $fix_br = "";
if ($member_id['user_group'] == 1 ) $fix_br .= "";
if( $row['allow_template'] ) $check_t = "checked";
else $check_t = "";
if( $row['allow_count'] ) $check_c = "checked";
else $check_c = "";
if( $row['disable_search'] ) $check_ds = "checked";
else $check_ds = "";
if( $row['password'] ) $check_pass = "checked";
else $check_pass = "";
$password = htmlspecialchars( $row['password'], ENT_QUOTES, $config['charset'] );
$_GET['page'] = isset($_GET['page']) ? $_GET['page'] : '';
if( $_GET['page'] != "rules" ) {
if( $row['sitemap'] ) $allow_sitemap = "";
else $allow_sitemap = "";
if( $row['disable_index'] ) $disable_index = "";
else $disable_index = "";
} else {$allow_sitemap = ""; $disable_index = "";}
$groups = get_groups( explode( ',', $row['grouplevel'] ) );
if( $row['grouplevel'] == "all" ) $check_all = "selected";
else $check_all = "";
if( $_GET['page'] == "rules" ) {
echo "
HTML;
echofooter();
} elseif( $action == "dosaveedit" ) {
@header('X-XSS-Protection: 0;');
if( !isset($_REQUEST['user_hash']) OR !$_REQUEST['user_hash'] OR $_REQUEST['user_hash'] != $dle_login_hash ) {
die( "Hacking attempt! User not found" );
}
if( !$_SESSION['static_referrer'] ) {
$_SESSION['static_referrer'] = "?mod=static&action=list";
}
$allow_br = isset($_POST['allow_br']) ? intval( $_POST['allow_br'] ) : 0;
if ($member_id['user_group'] != 1 AND $allow_br > 1 ) $allow_br = 1;
if ($allow_br == 2) {
$template = trim( addslashes( $_POST['template'] ) );
} else {
if ( $config['allow_static_wysiwyg'] ) $parse->allow_code = false;
$template = $parse->process( $_POST['template'] );
if( $config['allow_static_wysiwyg'] or $allow_br != '1' ) {
$template = $parse->BB_Parse( $template );
} else {
$template = $parse->BB_Parse( $template, false );
}
}
$metatags = create_metatags( $template );
if( isset($_GET['page']) AND $_GET['page'] == "rules" ) {
$name = "dle-rules-page";
} else {
$name = totranslit( $_POST['name'], true, false, $config['translit_url'] );
if( ! count( $_POST['grouplevel'] ) ) $_POST['grouplevel'] = array ("all" );
$grouplevel = $db->safesql( implode( ',', $_POST['grouplevel'] ) );
}
$descr = trim( $db->safesql( htmlspecialchars( $_POST['description'], ENT_QUOTES, $config['charset'] ) ) );
$disable_index = isset( $_POST['disable_index'] ) ? intval( $_POST['disable_index'] ) : 0;
$disable_search = isset( $_POST['disable_search'] ) ? intval( $_POST['disable_search'] ) : 0;
$need_pass = isset( $_POST['need_pass'] ) ? intval( $_POST['need_pass'] ) : 0;
$template = $db->safesql( $template );
$allow_template = isset( $_POST['allow_template'] ) ? intval( $_POST['allow_template'] ) : 0;
$allow_count = isset( $_POST['allow_count'] ) ? intval( $_POST['allow_count'] ) : 0;
$allow_sitemap = isset( $_POST['allow_sitemap'] ) ? intval( $_POST['allow_sitemap'] ) : 0;
$tpl = $db->safesql(cleanpath( $_POST['static_tpl'] ));
$skin_name = isset( $_POST['skin_name'] ) ? totranslit( $_POST['skin_name'], false, false ) : '';
if($need_pass AND trim($_POST['password'])) {
$password = $db->safesql(trim($_POST['password']));
} else $password = "";
$added_time = time();
$newdate = trim($_POST['newdate']);
if( isset( $_POST['allow_now'] ) ) $allow_now = $_POST['allow_now']; else $allow_now = "";
if( $newdate ) {
$newsdate = strtotime( $newdate );
if( $allow_now == "yes" ) {
$thistime = $added_time;
} elseif( ($newsdate === - 1) OR !$newsdate ) {
$thistime = $added_time;
} else {
$thistime = $newsdate;
if( ! intval( $config['no_date'] ) and $newsdate > $added_time ) {
$thistime = $added_time;
}
}
} else {
$thistime = $added_time;
}
if( isset($_GET['page']) AND $_GET['page'] == "rules" ) {
if( $_POST['id'] ) {
$db->query( "UPDATE " . PREFIX . "_static SET descr='$descr', template='$template', allow_br='$allow_br', allow_template='$allow_template', grouplevel='all', tpl='$tpl', metadescr='{$metatags['description']}', metakeys='{$metatags['keywords']}', template_folder='{$skin_name}', date='{$thistime}', metatitle='{$metatags['title']}', allow_count='{$allow_count}', sitemap='0', disable_index='0', disable_search='{$disable_search}', password='' WHERE name='dle-rules-page'" );
$db->query( "INSERT INTO " . USERPREFIX . "_admin_logs (name, date, ip, action, extras) values ('".$db->safesql($member_id['name'])."', '{$_TIME}', '{$_IP}', '60', 'dle-rules-page')" );
} else {
$db->query( "INSERT INTO " . PREFIX . "_static (name, descr, template, allow_br, allow_template, grouplevel, tpl, metadescr, metakeys, template_folder, date, metatitle, allow_count, sitemap, disable_index, disable_search, password) values ('$name', '$descr', '$template', '$allow_br', '$allow_template', 'all', '$tpl', '{$metatags['description']}', '{$metatags['keywords']}', '{$skin_name}', '{$thistime}', '{$metatags['title']}', '{$allow_count}', '0', '0', '{$disable_search}', '')" );
$row = $db->insert_id();
$db->query( "UPDATE " . PREFIX . "_static_files SET static_id='{$row}' WHERE author = '{$member_id['name']}' AND static_id = '0'" );
}
if( $config['allow_alt_url'] ) $full_link = $config['http_home_url'] . "rules.html";
else $full_link = $config['http_home_url'] . "?do=rules";
if( $config['news_indexnow'] ) {
$result = DLESEO::IndexNow( $full_link );
if( $result !== true ) {
$lang['indexnow_error_1'] = str_ireplace('{name}', md5(SECURE_AUTH_KEY), $lang['indexnow_error_1']);
$lang['indexnow_error_2'] = str_ireplace('{name}', md5(SECURE_AUTH_KEY), $lang['indexnow_error_2']);
if( $result === null ) $result = $lang['indexnow_error_1'];
elseif( $result === -1 ) $result = $lang['indexnow_error_2'];
elseif( is_array($result) ) {
$lang['indexnow_error_3'] = str_ireplace('{searchengine}', $result[0], $lang['indexnow_error_3']);
$lang['indexnow_error_3'] = str_ireplace('{errorcode}', $result[1], $lang['indexnow_error_3']);
$result = $lang['indexnow_error_3'];
}
$result = "".$result."
";
} else $result = '';
} else $result = '';
msg( "success", $lang['rules_ok'], $lang['rules_ok'].$result, array( '?mod=static&action=doedit&page=rules' => $lang['add_s_4'], $full_link => $lang['add_s_5'] ) );
} else {
$id = intval( $_GET['id'] );
if( $name == "" or $descr == "" or $template == "" ) msg( "error", $lang['static_err'], $lang['static_err_1'], $_SESSION['static_referrer'] );
$static_count = $db->super_query( "SELECT COUNT(*) as count FROM " . PREFIX . "_static WHERE name='$name' AND id != '$id'" );
if ($static_count['count']) msg( "error", $lang['static_err'], $lang['static_err_2'], $_SESSION['static_referrer'] );
$db->query( "UPDATE " . PREFIX . "_static SET name='$name', descr='$descr', template='$template', allow_br='$allow_br', allow_template='$allow_template', grouplevel='$grouplevel', tpl='$tpl', metadescr='{$metatags['description']}', metakeys='{$metatags['keywords']}', template_folder='{$skin_name}', date='{$thistime}', metatitle='{$metatags['title']}', allow_count='{$allow_count}', sitemap='{$allow_sitemap}', disable_index='$disable_index', disable_search='{$disable_search}', password='{$password}' WHERE id='$id'" );
$db->query( "INSERT INTO " . USERPREFIX . "_admin_logs (name, date, ip, action, extras) values ('".$db->safesql($member_id['name'])."', '{$_TIME}', '{$_IP}', '60', '{$name}')" );
if( $config['allow_alt_url'] ) $full_link = $config['http_home_url'] . $name . ".html";
else $full_link = $config['http_home_url'] . "index.php?do=static&page=" . $name;
if( $config['news_indexnow'] ) {
$result = DLESEO::IndexNow( $full_link );
if( $result !== true ) {
$lang['indexnow_error_1'] = str_ireplace('{name}', md5(SECURE_AUTH_KEY), $lang['indexnow_error_1']);
$lang['indexnow_error_2'] = str_ireplace('{name}', md5(SECURE_AUTH_KEY), $lang['indexnow_error_2']);
if( $result === null ) $result = $lang['indexnow_error_1'];
elseif( $result === -1 ) $result = $lang['indexnow_error_2'];
elseif( is_array($result) ) {
$lang['indexnow_error_3'] = str_ireplace('{searchengine}', $result[0], $lang['indexnow_error_3']);
$lang['indexnow_error_3'] = str_ireplace('{errorcode}', $result[1], $lang['indexnow_error_3']);
$result = $lang['indexnow_error_3'];
}
$result = "".$result."
";
} else $result = '';
} else $result = '';
msg( "success", $lang['static_addok'], $lang['static_addok_1'].$result, array( $_SESSION['static_referrer'] => $lang['add_s_3'], '?mod=static&action=doedit&id='.$id => $lang['add_s_4'], $full_link => $lang['add_s_5'] ) );
}
} elseif( $action == "dodelete" ) {
if( !isset($_REQUEST['user_hash']) OR !$_REQUEST['user_hash'] OR $_REQUEST['user_hash'] != $dle_login_hash ) {
die( "Hacking attempt! User not found" );
}
if( !$_SESSION['static_referrer'] ) {
$_SESSION['static_referrer'] = "?mod=static&action=list";
}
$id = intval( $_GET['id'] );
DLEFiles::init();
$db->query( "DELETE FROM " . PREFIX . "_static WHERE id='$id'" );
$db->query( "SELECT * FROM " . PREFIX . "_static_files WHERE static_id = '$id'" );
while ( $row = $db->get_row() ) {
if( $row['onserver'] ) {
if( trim($row['onserver']) == ".htaccess") die("Hacking attempt!");
if( $row['is_public'] ) $uploaded_path = 'public_files/'; else $uploaded_path = 'files/';
DLEFiles::Delete( $uploaded_path.$row['onserver'], $row['driver'] );
} else {
$dataimage = get_uploaded_image_info( $row['name'] );
DLEFiles::Delete( "posts/" . $dataimage->path, $row['driver'] );
if ($dataimage->hidpi) {
DLEFiles::Delete("posts/{$dataimage->folder}/{$dataimage->hidpi}", $row['driver']);
}
if( $dataimage->thumb ) {
DLEFiles::Delete( "posts/{$dataimage->folder}/thumbs/{$dataimage->name}", $row['driver'] );
if ($dataimage->hidpi) {
DLEFiles::Delete("posts/{$dataimage->folder}/thumbs/{$dataimage->hidpi}", $row['driver']);
}
}
if( $dataimage->medium ) {
DLEFiles::Delete( "posts/{$dataimage->folder}/medium/{$dataimage->name}", $row['driver'] );
if ($dataimage->hidpi) {
DLEFiles::Delete("posts/{$dataimage->folder}/medium/{$dataimage->hidpi}", $row['driver']);
}
}
}
}
$db->query( "DELETE FROM " . PREFIX . "_static_files WHERE static_id = '$id'" );
msg( "success", $lang['static_del'], $lang['static_del_1'], $_SESSION['static_referrer'] );
}
?>